diff --git a/.github/actions/build-vscode-extension/action.yml b/.github/actions/build-vscode-extension/action.yml index fb17816f2..f9c17f31b 100644 --- a/.github/actions/build-vscode-extension/action.yml +++ b/.github/actions/build-vscode-extension/action.yml @@ -18,6 +18,9 @@ inputs: description: 'Commit SHA for version modification (optional, uses first 7 chars)' required: false default: '' + github-token: + description: 'GitHub token for downloading ripgrep' + required: true outputs: target: description: 'The target string used for the build' @@ -83,7 +86,7 @@ runs: npm ci env: # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ inputs.github-token }} - name: Install gui dependencies shell: bash @@ -98,6 +101,12 @@ runs: npm ci npm i vectordb + - name: Build GUI + shell: bash + run: | + cd gui + npm run build + - name: Prepackage the extension shell: bash run: | diff --git a/.github/actions/run-jetbrains-tests/action.yml b/.github/actions/run-jetbrains-tests/action.yml index 71051101d..6c2d431ff 100644 --- a/.github/actions/run-jetbrains-tests/action.yml +++ b/.github/actions/run-jetbrains-tests/action.yml @@ -28,6 +28,13 @@ runs: cd core npm ci + - name: Install gui node_modules and build + shell: bash + run: | + cd gui + npm ci + npm run build + - name: Setup Java uses: actions/setup-java@v4.5.0 with: diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 2024b083b..739553f7b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -80,8 +80,7 @@ jobs: arch: ${{ matrix.arch }} npm_config_arch: ${{ matrix.npm_config_arch }} pre-release: false - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Upload .vsix artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/pr-build-upload-vsix.yaml b/.github/workflows/pr-build-upload-vsix.yaml index 17a3dc5ba..6a8250a83 100644 --- a/.github/workflows/pr-build-upload-vsix.yaml +++ b/.github/workflows/pr-build-upload-vsix.yaml @@ -36,8 +36,7 @@ jobs: npm_config_arch: ${{ matrix.arch }} pre-release: false commit-sha: ${{ github.sha }} - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Upload build artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 9ea007d5f..63afde345 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -269,8 +269,7 @@ jobs: npm_config_arch: x64 pre-release: false commit-sha: ${{ github.sha }} - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Upload build artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 611a96f5e..434588f96 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -80,8 +80,7 @@ jobs: arch: ${{ matrix.arch }} npm_config_arch: ${{ matrix.npm_config_arch }} pre-release: true - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Upload .vsix artifact uses: actions/upload-artifact@v4 diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 4b8646f07..a08ec41ef 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,24 +12,18 @@ "isDefault": true }, "presentation": { - "reveal": "always", - "panel": "new" + "group": "dev-watchers", + "panel": "dedicated", + "reveal": "always" } }, - // Compile and bundle the extension { "label": "vscode-extension:build", "dependsOn": [ - // TSC type checking "tsc:watch", - // To build the React app that is used in the extension "vscode-extension:continue-ui:build", - // // To bundle the code the same way we do for publishing "vscode-extension:esbuild", - // To ensure extension.js is regenerated even if - // vscode-extension:esbuild was already running in background "vscode-extension:esbuild-notify", - // Start the React app that is used in the extension "gui:dev" ], "group": { @@ -42,7 +36,15 @@ "dependsOn": ["vscode-extension:esbuild"], "type": "npm", "script": "esbuild-notify", - "path": "extensions/vscode" + "path": "extensions/vscode", + "presentation": { + "group": "build-tasks", + "panel": "shared", + "reveal": "silent", + "revealProblems": "onProblem", + "close": true, + "clear": true + } }, { "label": "vscode-extension:esbuild", @@ -51,6 +53,11 @@ "script": "esbuild-watch", "path": "extensions/vscode", "isBackground": true, + "presentation": { + "group": "dev-watchers", + "panel": "dedicated", + "reveal": "silent" + }, "problemMatcher": [ { "pattern": [ @@ -77,6 +84,11 @@ "type": "npm", "script": "package", "path": "extensions/vscode", + "presentation": { + "group": "build-tasks", + "panel": "shared", + "reveal": "always" + }, "problemMatcher": [ { "pattern": [ @@ -99,7 +111,11 @@ "args": ["${workspaceFolder}/extensions/vscode/scripts/prepackage.js"], "problemMatcher": ["$tsc"], "presentation": { + "group": "build-tasks", + "panel": "shared", + "reveal": "silent", "revealProblems": "onProblem", + "close": true, "clear": true }, "options": { @@ -109,16 +125,18 @@ "cwd": "${workspaceFolder}/extensions/vscode" } }, - // Install or update all dependencies for all projects in the monrepo { "label": "install-all-dependencies", "type": "shell", "windows": { "command": "./scripts/install-dependencies.ps1" }, "command": "./scripts/install-dependencies.sh", - "problemMatcher": [] // Empty so users are not prompted to select progress reporting + "problemMatcher": [], + "presentation": { + "group": "maintenance", + "panel": "shared", + "reveal": "always" + } }, - // - // Start the React App for debugging with Vite { "label": "gui:dev", "type": "shell", @@ -128,6 +146,16 @@ }, "args": ["run", "dev"], "isBackground": true, + "runOptions": { + "instanceLimit": 1 + }, + "presentation": { + "group": "dev-watchers", + "panel": "dedicated", + "reveal": "always", + "focus": false, + "showReuseMessage": false + }, "problemMatcher": [ { "pattern": [ @@ -146,14 +174,17 @@ } ] }, - // - // esbuild for the core binary { "label": "binary:esbuild", "type": "shell", "command": "npm", "args": ["run", "esbuild"], "problemMatcher": [], + "presentation": { + "group": "build-tasks", + "panel": "shared", + "reveal": "always" + }, "options": { "cwd": "binary" } @@ -164,6 +195,11 @@ "command": "npm", "args": ["run", "start", "--", "--no-open"], "problemMatcher": [], + "presentation": { + "group": "docs", + "panel": "dedicated", + "reveal": "always" + }, "options": { "cwd": "docs" } @@ -173,7 +209,12 @@ "type": "shell", "command": "node", "args": ["${workspaceFolder}/scripts/uninstall.js"], - "problemMatcher": [] + "problemMatcher": [], + "presentation": { + "group": "maintenance", + "panel": "shared", + "reveal": "always" + } }, { "label": "refresh-dependencies:core", @@ -185,6 +226,9 @@ "cwd": "${workspaceFolder}/core" }, "presentation": { + "group": "maintenance", + "panel": "shared", + "reveal": "silent", "close": true } }, @@ -198,6 +242,9 @@ "cwd": "${workspaceFolder}/extensions/vscode" }, "presentation": { + "group": "maintenance", + "panel": "shared", + "reveal": "silent", "close": true } }, @@ -211,6 +258,9 @@ "cwd": "${workspaceFolder}/gui" }, "presentation": { + "group": "maintenance", + "panel": "shared", + "reveal": "silent", "close": true } }, @@ -222,35 +272,45 @@ "refresh-dependencies:vscode" ], "type": "shell", - "problemMatcher": [] + "problemMatcher": [], + "presentation": { + "group": "maintenance", + "panel": "shared", + "reveal": "always" + } }, { - "label": "Build Continue packages", + "label": "continue-packages:build", "type": "shell", "command": "node ./scripts/build-packages.js", - "isBackground": true, - "problemMatcher": { - "pattern": { - "regexp": "__DUMMY_PATTERN_THAT_NEVER_MATCHES__", - "file": 1 - }, - "background": { - "activeOnStart": true, - "beginsPattern": ".", - "endsPattern": "." - } - }, + "problemMatcher": [], "presentation": { - "reveal": "silent", - "panel": "shared" + "group": "build-tasks", + "panel": "shared", + "reveal": "always", + "close": true, + "revealProblems": "onProblem" } }, { "label": "vscode-extension:build-with-packages", - // "dependsOn": ["vscode-extension:build"], - "dependsOn": ["Build Continue packages", "vscode-extension:build"], + "dependsOn": ["continue-packages:build", "vscode-extension:build"], "type": "shell", - "problemMatcher": [] + "command": "echo", + "args": ["Build with packages completed"], + "problemMatcher": [], + "dependsOrder": "sequence", + "runOptions": { + "instanceLimit": 1, + "reevaluateOnRerun": true + }, + "presentation": { + "group": "build-tasks", + "panel": "shared", + "reveal": "silent", + "close": true, + "focus": false + } } ] } diff --git a/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts b/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts index ad966f89a..fa49bee2e 100644 --- a/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts +++ b/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts @@ -119,11 +119,11 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { results.sort( (a, b) => scores[chunkIndexMap.get(b)!] - scores[chunkIndexMap.get(a)!], ); - results = results.slice(-this.options.nFinal); + results = results.slice(0, this.options.nFinal); return results; } catch (e) { console.warn(`Failed to rerank retrieval results\n${e}`); - return chunks.slice(-this.options.nFinal); + return chunks.slice(0, this.options.nFinal); } } diff --git a/core/llm/llms/TransformersJsWorkerThread.js b/core/llm/llms/TransformersJsWorkerThread.js deleted file mode 100644 index 6ea26172e..000000000 --- a/core/llm/llms/TransformersJsWorkerThread.js +++ /dev/null @@ -1,64 +0,0 @@ -import path from "node:path"; -import { parentPort } from "node:worker_threads"; - -import { - env, - pipeline, -} from "../../vendor/node_modules/@xenova/transformers/types/transformers"; - -import TransformersJsEmbeddingsProvider from "./TransformersJsEmbeddingsProvider"; - -env.allowLocalModels = true; -env.allowRemoteModels = false; -if (typeof window === "undefined") { - // The embeddings provider should just never be called in the browser - env.localModelPath = path.join(__dirname, "..", "models"); -} - -class EmbeddingsPipeline { - static task = "feature-extraction"; - static model = TransformersJsEmbeddingsProvider.ModelName; - static instance = null; - - static async getInstance() { - if (EmbeddingsPipeline.instance === null) { - EmbeddingsPipeline.instance = await pipeline( - EmbeddingsPipeline.task, - EmbeddingsPipeline.model, - ); - } - - return EmbeddingsPipeline.instance; - } -} - -parentPort.on("message", async (chunks) => { - try { - const extractor = await EmbeddingsPipeline.getInstance(); - - if (!extractor) { - throw new Error("TransformerJS embeddings pipeline is not initialized"); - } - - const outputs = []; - for ( - let i = 0; - i < chunks.length; - i += TransformersJsEmbeddingsProvider.maxGroupSize - ) { - const chunkGroup = chunks.slice( - i, - i + TransformersJsEmbeddingsProvider.maxGroupSize, - ); - const output = await extractor(chunkGroup, { - pooling: "mean", - normalize: true, - }); - outputs.push(...output.tolist()); - } - - parentPort.postMessage(outputs); - } catch (error) { - parentPort.postMessage({ error: error.message }); - } -}); diff --git a/docs/package-lock.json b/docs/package-lock.json index e5bf20a17..c2baedd69 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -2801,14 +2801,14 @@ } }, "node_modules/axios": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz", - "integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", + "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", "dev": true, "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", + "form-data": "^4.0.4", "proxy-from-env": "^1.1.0" } }, @@ -4948,9 +4948,9 @@ } }, "node_modules/form-data": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz", - "integrity": "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", "dev": true, "license": "MIT", "dependencies": { diff --git a/extensions/vscode/e2e/tests/PromptFile.test.ts b/extensions/vscode/e2e/tests/PromptFile.test.ts index 7cf87fd54..2717fd17e 100644 --- a/extensions/vscode/e2e/tests/PromptFile.test.ts +++ b/extensions/vscode/e2e/tests/PromptFile.test.ts @@ -42,11 +42,25 @@ describe("Prompt file", () => { "terminal", "tree", ]; + for (const provider of providers) { - await editor.typeText("@" + provider.slice(0, 2)); - await editor.typeText(Key.ENTER); + // Type the @ symbol to trigger completion + await editor.typeText("@"); + + // Wait a moment for the completion to appear + await new Promise((resolve) => setTimeout(resolve, 500)); + + // Type the first few characters + await editor.typeText(provider.slice(0, 2)); + + // Wait for completion popup to update + await new Promise((resolve) => setTimeout(resolve, 300)); + + // Use Tab to accept completion instead of Enter + await editor.typeText(Key.TAB); + const text = await editor.getText(); - expect(text).equals("@" + provider); + expect(text).to.include("@" + provider); await editor.clearText(); } diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index 802a4eb4f..29dbf2e8e 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -55,8 +55,6 @@ console.log("[info] Using target: ", target); const exe = os === "win32" ? ".exe" : ""; -const isInGitHubAction = !!process.env.GITHUB_ACTIONS; - const isArmTarget = target === "darwin-arm64" || target === "linux-arm64" || @@ -86,15 +84,6 @@ void (async () => { process.chdir(path.join(continueDir, "gui")); - if (isInGitHubAction) { - const guiBuildStart = Date.now(); - console.log(`[timer] Starting GUI build at ${new Date().toISOString()}`); - execCmdSync("npm run build"); - console.log( - `[timer] GUI build completed in ${Date.now() - guiBuildStart}ms`, - ); - } - // Copy over the dist folder to the JetBrains extension // const intellijExtensionWebviewPath = path.join( "..", @@ -140,6 +129,7 @@ void (async () => { // Then copy over the dist folder to the VSCode extension // const vscodeGuiPath = path.join("../extensions/vscode/gui"); + rimrafSync(vscodeGuiPath); fs.mkdirSync(vscodeGuiPath, { recursive: true }); const vscodeCopyStart = Date.now(); console.log(`[timer] Starting VSCode copy at ${new Date().toISOString()}`); diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index a93009965..5aa221609 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -135,7 +135,7 @@ function ModelSelect() { }; }), ); - }, [config]); + }, [allModels]); useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { diff --git a/scripts/build-packages.js b/scripts/build-packages.js index 238a8f0ea..996323f8a 100644 --- a/scripts/build-packages.js +++ b/scripts/build-packages.js @@ -86,7 +86,7 @@ async function main() { await buildPackagesInParallel(["fetch", "config-yaml", "llm-info"]); // Phase 3: Build packages that depend on other local packages - await buildPackagesInParallel(["openai-adapters", "continue-sdk"], true); + await buildPackagesInParallel(["openai-adapters", "continue-sdk"]); console.log("🎉 All packages built successfully!"); } catch (error) {