From 1320ff828e8e812465bb4344ed5227387e2d1402 Mon Sep 17 00:00:00 2001 From: dipfocus Date: Sat, 5 Jul 2025 18:54:27 +0800 Subject: [PATCH 01/64] Refactor downloadFile function to use fetch API and support proxy configuration. --- .../scripts/download-copy-sqlite-esbuild.js | 89 +++++-------------- 1 file changed, 23 insertions(+), 66 deletions(-) diff --git a/extensions/vscode/scripts/download-copy-sqlite-esbuild.js b/extensions/vscode/scripts/download-copy-sqlite-esbuild.js index ea6f8ebd9..b595c3bdf 100644 --- a/extensions/vscode/scripts/download-copy-sqlite-esbuild.js +++ b/extensions/vscode/scripts/download-copy-sqlite-esbuild.js @@ -1,83 +1,40 @@ const { fork } = require("child_process"); const fs = require("fs"); -const https = require("https"); const path = require("path"); +const { ProxyAgent } = require("undici"); const { rimrafSync } = require("rimraf"); const { execCmdSync } = require("../../../scripts/util"); /** - * download a file using nodejs http + * download a file using fetch API * @param {string} url * @param {string} outputPath - * @param {number} maxRedirects */ -async function downloadFile(url, outputPath, maxRedirects = 5) { - return new Promise((resolve, reject) => { - const downloadWithRedirects = (currentUrl, redirectCount = 0) => { - if (redirectCount > maxRedirects) { - return reject(new Error(`Too many redirects (${maxRedirects})`)); - } +async function downloadFile(url, outputPath) { + // Use proxy if set in environment variables + const proxy = process.env.https_proxy || process.env.HTTPS_PROXY; + const agent = proxy ? new ProxyAgent(proxy) : undefined; - const request = https.get(currentUrl, (response) => { - if ( - response.statusCode >= 300 && - response.statusCode < 400 && - response.headers.location - ) { - return downloadWithRedirects( - response.headers.location, - redirectCount + 1, - ); - } - - if (response.statusCode !== 200) { - return reject( - new Error(`HTTP ${response.statusCode}: ${response.statusMessage}`), - ); - } - - const outputDir = path.dirname(outputPath); - if (!fs.existsSync(outputDir)) { - fs.mkdirSync(outputDir, { recursive: true }); - } - - const writeStream = fs.createWriteStream(outputPath); - - const totalSize = parseInt(response.headers["content-length"], 10); - let downloadedSize = 0; - - response.on("data", (chunk) => { - downloadedSize += chunk.length; - if (totalSize) { - const percent = ((downloadedSize / totalSize) * 100).toFixed(1); - process.stdout.write( - `\rDownloading: ${percent}% (${downloadedSize}/${totalSize} bytes)`, - ); - } - }); - - response.pipe(writeStream); - - writeStream.on("finish", () => { - console.log(`\nDownload completed: ${outputPath}`); - resolve(outputPath); - }); - - writeStream.on("error", reject); - response.on("error", reject); - }); - - request.on("error", reject); - request.setTimeout(30000, () => { - request.destroy(); - reject(new Error("Request timeout")); - }); - }; - - downloadWithRedirects(url); + const response = await fetch(url, { + redirect: "follow", // Automatically follow redirects + dispatcher: agent, }); + + if (!response.ok) { + throw new Error(`Failed to download file, status code: ${response.status}`); + } + + // Create output directory if it doesn't exist + const outputDir = path.dirname(outputPath); + if (!fs.existsSync(outputDir)) { + fs.mkdirSync(outputDir, { recursive: true }); + } + + // Get the response as an array buffer and write it to the file + const buffer = await response.arrayBuffer(); + fs.writeFileSync(outputPath, Buffer.from(buffer)); } /** From 4b4afe193eb17eddac68d0c9996d14494ad0a3e9 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 14 Jul 2025 12:48:36 -0700 Subject: [PATCH 03/64] perf: reduce redundant calculations, make window disappear immediately --- .../src/activation/NextEditWindowManager.ts | 87 +++++++++---------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 58d03239d..62ae5eaf5 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -117,6 +117,9 @@ export class NextEditWindowManager { // Track for logging purposes. private loggingService: NextEditLoggingService; private mostRecentCompletionId: string | null = null; + // Helps us skip redundant calculations. No need for cleanup because this always gets reassigned with new values at showNextEditWindow, and we don't reuse windows. + private editableRegionStartLine: number = 0; + private editableRegionEndLine: number = 0; // Disposables private disposables: vscode.Disposable[] = []; @@ -261,6 +264,7 @@ export class NextEditWindowManager { editor: vscode.TextEditor, currCursorPos: vscode.Position, editableRegionStartLine: number, + editableRegionEndLine: number, oldEditRangeSlice: string, newEditRangeSlice: string, diffLines: DiffLine[], @@ -272,11 +276,14 @@ export class NextEditWindowManager { // Clear any existing decorations first (very important to prevent overlapping). await this.hideAllNextEditWindows(); + this.editableRegionStartLine = editableRegionStartLine; + this.editableRegionEndLine = editableRegionEndLine; + // Store the current tooltip text for accepting later. this.currentTooltipText = newEditRangeSlice; // How far away is the current line from the start of the editable region? - const lineOffsetAtCursorPos = currCursorPos.line - editableRegionStartLine; + const lineOffsetAtCursorPos = currCursorPos.line - this.editableRegionStartLine; // How long is the line at the current cursor position? const lineContentAtCursorPos = @@ -291,7 +298,7 @@ export class NextEditWindowManager { // Calculate the actual line number in the editor by adding the startPos offset // to the line number from the diff calculation. this.finalCursorPos = new vscode.Position( - editableRegionStartLine + offset.line, + this.editableRegionStartLine + offset.line, offset.character, ); @@ -301,13 +308,13 @@ export class NextEditWindowManager { currCursorPos, oldEditRangeSlice, newEditRangeSlice, - editableRegionStartLine, + this.editableRegionStartLine, diffLines, ); const diffChars = myersCharDiff(oldEditRangeSlice, newEditRangeSlice); - this.renderDeletes(editor, editableRegionStartLine, diffChars); + this.renderDeletes(editor, diffChars); // Reserve tab and esc to either accept or reject the displayed next edit contents. await NextEditWindowManager.reserveTabAndEsc(); @@ -317,6 +324,8 @@ export class NextEditWindowManager { * Hide all tooltips in all editors. */ public async hideAllNextEditWindows() { + await NextEditWindowManager.freeTabAndEsc(); + if (this.currentDecoration) { vscode.window.visibleTextEditors.forEach((editor) => { editor.setDecorations(this.currentDecoration!, []); @@ -339,12 +348,10 @@ export class NextEditWindowManager { // Clear the current tooltip text. this.currentTooltipText = null; } - - await NextEditWindowManager.freeTabAndEsc(); } public async hideAllNextEditWindowsAndResetCompletionId() { - this.hideAllNextEditWindows(); + await this.hideAllNextEditWindows(); // Log with accept = false. await vscode.commands.executeCommand( @@ -352,6 +359,7 @@ export class NextEditWindowManager { this.mostRecentCompletionId, this.loggingService, ); + this.mostRecentCompletionId = null; } @@ -369,6 +377,10 @@ export class NextEditWindowManager { const position = editor.selection.active; let success = false; + + // Hide windows first for a snappier feel. + await this.hideAllNextEditWindows(); + if (this.textApplier) { success = await this.textApplier.applyText( editor, @@ -377,20 +389,12 @@ export class NextEditWindowManager { this.finalCursorPos, ); } else { - // Define the editable region. - const editableRegionStartLine = Math.max( - 0, - position.line - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, - ); - const editableRegionEndLine = Math.min( - editor.document.lineCount - 1, - position.line + NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, - ); - const startPos = new vscode.Position(editableRegionStartLine, 0); - const endPosChar = editor.document.lineAt(editableRegionEndLine).text + // Define the range to replace. + const startPos = new vscode.Position(this.editableRegionStartLine, 0); + const endPosChar = editor.document.lineAt(this.editableRegionEndLine).text .length; - const endPos = new vscode.Position(editableRegionEndLine, endPosChar); + const endPos = new vscode.Position(this.editableRegionEndLine, endPosChar); const editRange = new vscode.Range(startPos, endPos); success = await editor.edit((editBuilder) => { @@ -405,23 +409,19 @@ export class NextEditWindowManager { .update("editor.inlineSuggest.enabled", false, true); } - if (success) { + if (success && this.finalCursorPos) { // Move cursor to the final position if available. - if (this.finalCursorPos) { - editor.selection = new vscode.Selection( - this.finalCursorPos, - this.finalCursorPos, - ); - - // Reenable inline suggestions after we move the cursor. - await vscode.workspace - .getConfiguration() - .update("editor.inlineSuggest.enabled", true, true); - - await this.hideAllNextEditWindows(); - } + editor.selection = new vscode.Selection( + this.finalCursorPos, + this.finalCursorPos, + ); } + // Reenable inline suggestions. + await vscode.workspace + .getConfiguration() + .update("editor.inlineSuggest.enabled", true, true); + // Log with accept = true. await vscode.commands.executeCommand( "continue.logNextEditOutcomeAccept", @@ -454,7 +454,7 @@ export class NextEditWindowManager { */ private setupListeners() { // Theme change listener. - vscode.workspace.onDidChangeConfiguration((e) => { + vscode.workspace.onDidChangeConfiguration(async (e) => { if ( e.affectsConfiguration("workbench.colorTheme") || e.affectsConfiguration("editor.fontSize") || @@ -467,7 +467,7 @@ export class NextEditWindowManager { e.affectsConfiguration("workbench.preferredHighContrastLightColorTheme") ) { this.theme = getThemeString(); - this.codeRenderer.setTheme(this.theme); + await this.codeRenderer.setTheme(this.theme); console.log( "Theme updated:", this.theme ? "Theme exists" : "Theme is undefined", @@ -479,9 +479,9 @@ export class NextEditWindowManager { }); // Listen for active color theme changes. - vscode.window.onDidChangeActiveColorTheme(() => { + vscode.window.onDidChangeActiveColorTheme(async () => { this.theme = getThemeString(); - this.codeRenderer.setTheme(this.theme); + await this.codeRenderer.setTheme(this.theme); console.log( "Active theme changed:", this.theme ? "Theme exists" : "Theme is undefined", @@ -495,10 +495,11 @@ export class NextEditWindowManager { this.activeEditor && !vscode.window.visibleTextEditors.includes(this.activeEditor) ) { - if (this.mostRecentCompletionId) + if (this.mostRecentCompletionId) { this.loggingService.cancelRejectionTimeout( this.mostRecentCompletionId, ); + } await this.hideAllNextEditWindows(); } }); @@ -508,10 +509,11 @@ export class NextEditWindowManager { // If the selection changed in our active editor, hide the tooltip. if (this.activeEditor && e.textEditor === this.activeEditor) { // If the cursor moved because of something other than accepting next edit, stop logging it. - if (!this.accepted && this.mostRecentCompletionId) + if (!this.accepted && this.mostRecentCompletionId) { this.loggingService.cancelRejectionTimeout( this.mostRecentCompletionId, ); + } await this.hideAllNextEditWindows(); } }); @@ -788,9 +790,6 @@ export class NextEditWindowManager { private renderDeletes( editor: vscode.TextEditor, - editableRegionStartLine: number, - // oldEditRangeSlice: string, - // newEditRangeSlice: string, oldDiffChars: DiffChar[], ) { const charsToDelete: vscode.DecorationOptions[] = []; @@ -803,11 +802,11 @@ export class NextEditWindowManager { charsToDelete.push({ range: new vscode.Range( new vscode.Position( - editableRegionStartLine + diff.oldLineIndex!, + this.editableRegionStartLine + diff.oldLineIndex!, diff.oldCharIndexInLine!, ), new vscode.Position( - editableRegionStartLine + diff.oldLineIndex!, + this.editableRegionStartLine + diff.oldLineIndex!, diff.oldCharIndexInLine! + diff.char.length, ), ), From 5085c2f602cfc183511831cf8876d0fced937aac Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 14 Jul 2025 12:49:01 -0700 Subject: [PATCH 04/64] perf: pass editableRegionEndLine --- extensions/vscode/src/autocomplete/completionProvider.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index 88131a3e8..39b82c1a0 100644 --- a/extensions/vscode/src/autocomplete/completionProvider.ts +++ b/extensions/vscode/src/autocomplete/completionProvider.ts @@ -420,6 +420,7 @@ export class ContinueCompletionProvider editor, currCursorPos, editableRegionStartLine, + editableRegionEndLine, oldEditRangeSlice, newEditRangeSlice, diffLines, From 4bc7f0ca262145f3aa9252f68efb4f095f085b47 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 14 Jul 2025 14:21:47 -0700 Subject: [PATCH 05/64] feat: remove redundant hides --- .../src/activation/NextEditWindowManager.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 62ae5eaf5..5c432d0e6 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -6,10 +6,6 @@ import * as vscode from "vscode"; import { DiffChar, DiffLine } from "core"; import { CodeRenderer } from "core/codeRenderer/CodeRenderer"; import { myersCharDiff } from "core/diff/myers"; -import { - NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, -} from "core/nextEdit/constants"; import { getOffsetPositionAtLastNewLine } from "core/nextEdit/diff/diff"; import { NextEditLoggingService } from "core/nextEdit/NextEditLoggingService"; import { getThemeString } from "../util/getTheme"; @@ -283,7 +279,8 @@ export class NextEditWindowManager { this.currentTooltipText = newEditRangeSlice; // How far away is the current line from the start of the editable region? - const lineOffsetAtCursorPos = currCursorPos.line - this.editableRegionStartLine; + const lineOffsetAtCursorPos = + currCursorPos.line - this.editableRegionStartLine; // How long is the line at the current cursor position? const lineContentAtCursorPos = @@ -394,7 +391,10 @@ export class NextEditWindowManager { const endPosChar = editor.document.lineAt(this.editableRegionEndLine).text .length; - const endPos = new vscode.Position(this.editableRegionEndLine, endPosChar); + const endPos = new vscode.Position( + this.editableRegionEndLine, + endPosChar, + ); const editRange = new vscode.Range(startPos, endPos); success = await editor.edit((editBuilder) => { @@ -749,7 +749,6 @@ export class NextEditWindowManager { } // Store the decoration and editor. - await this.hideAllNextEditWindows(); this.currentDecoration = decoration; // TODO: This might be redundant. this.disposables.push(decoration); this.activeEditor = editor; @@ -788,10 +787,7 @@ export class NextEditWindowManager { ); } - private renderDeletes( - editor: vscode.TextEditor, - oldDiffChars: DiffChar[], - ) { + private renderDeletes(editor: vscode.TextEditor, oldDiffChars: DiffChar[]) { const charsToDelete: vscode.DecorationOptions[] = []; // const diffChars = myersCharDiff(oldEditRangeSlice, newEditRangeSlice); From f2c0357b2ffcde5c6caf93c29b1cf365e65d6773 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Wed, 16 Jul 2025 18:04:59 +0530 Subject: [PATCH 06/64] fix: double slash on opening hub urls --- core/core.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/core.ts b/core/core.ts index 915099a3e..dc6651eaa 100644 --- a/core/core.ts +++ b/core/core.ts @@ -359,7 +359,10 @@ export class Core { on("controlPlane/openUrl", async (msg) => { const env = await getControlPlaneEnv(this.ide.getIdeSettings()); - let url = `${env.APP_URL}${msg.data.path}`; + const urlPath = msg.data.path.startsWith("/") + ? msg.data.path.slice(1) + : msg.data.path; + let url = `${env.APP_URL}${urlPath}`; if (msg.data.orgSlug) { url += `?org=${msg.data.orgSlug}`; } From 87d55c5b4d9e5ec662a19018ee2cb4bbeb433070 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 16 Jul 2025 16:08:06 -0700 Subject: [PATCH 07/64] fix: test fix for fetch package and publish version with improved error logging --- packages/fetch/package-lock.json | 4 ++-- packages/fetch/package.json | 2 +- packages/fetch/src/stream.test.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/fetch/package-lock.json b/packages/fetch/package-lock.json index b832b32fd..a9a4742ff 100644 --- a/packages/fetch/package-lock.json +++ b/packages/fetch/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/fetch", - "version": "1.0.15", + "version": "1.0.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/fetch", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.5", diff --git a/packages/fetch/package.json b/packages/fetch/package.json index 5cd0a38e4..b50a7ce84 100644 --- a/packages/fetch/package.json +++ b/packages/fetch/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/fetch", - "version": "1.0.15", + "version": "1.0.16", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/fetch/src/stream.test.ts b/packages/fetch/src/stream.test.ts index eba47de26..d52221954 100644 --- a/packages/fetch/src/stream.test.ts +++ b/packages/fetch/src/stream.test.ts @@ -86,7 +86,7 @@ describe("parseDataLine", () => { test("parseDataLine should throw error when data contains error field", () => { const line = 'data: {"error":"something went wrong"}'; expect(() => parseDataLine(line)).toThrow( - "Error streaming response: something went wrong", + 'Error streaming response: "something went wrong"', ); }); From 0ecf32c37d1d94eefc6a07daaaac547f94e13662 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 16 Jul 2025 16:11:53 -0700 Subject: [PATCH 08/64] bump fetch version in openai-adapters, but don't publish a stable release of openai-adapters --- packages/openai-adapters/package-lock.json | 9 ++++----- packages/openai-adapters/package.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 97d95ef12..c168a46cd 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -13,7 +13,7 @@ "@aws-sdk/credential-providers": "^3.840.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", - "@continuedev/fetch": "^1.0.15", + "@continuedev/fetch": "^1.0.16", "dotenv": "^16.5.0", "json-schema": "^0.4.0", "node-fetch": "^3.3.2", @@ -1418,10 +1418,9 @@ } }, "node_modules/@continuedev/fetch": { - "version": "1.0.15", - "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.15.tgz", - "integrity": "sha512-49jLwAwAOczcFLfa2Og9+c+qxrq+Z6+p+B5BbXgHENrQIsuST1liKTXEiga5gSVAyHD+m+1Ftl4jqRq2oxMngw==", - "license": "Apache-2.0", + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.16.tgz", + "integrity": "sha512-LSjVbTKA+UwqCjV8x45sfJQGtG/iekkqCYpSJsakY0ruad807swwEuuui5luuYVUhJAZZpVfZzeJArHfjiJJSw==", "dependencies": { "@continuedev/config-types": "^1.0.5", "follow-redirects": "^1.15.6", diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index f7c7d3133..11aedc4c5 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -16,7 +16,7 @@ "@aws-sdk/credential-providers": "^3.840.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", - "@continuedev/fetch": "^1.0.15", + "@continuedev/fetch": "^1.0.16", "dotenv": "^16.5.0", "json-schema": "^0.4.0", "node-fetch": "^3.3.2", From 717e11321b9ece0781b9b531a3a2b329ae339b42 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 16 Jul 2025 17:26:01 -0700 Subject: [PATCH 09/64] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 4a0595a38..4ff2b89da 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -11,6 +11,7 @@ body: attributes: label: Before submitting your bug report options: + - label: I've tried using the "Ask AI" feature on the [Continue docs site](https://docs.continue.dev/) to see if the docs have an answer - label: I believe this is a bug. I'll try to join the [Continue Discord](https://discord.gg/NWtdYexhMs) for questions required: false - label: I'm not able to find an [open issue](https://github.com/continuedev/continue/issues?q=is%3Aopen+is%3Aissue) that reports the same bug From a69900c1462110a991ece8f5857de6abc3e1cc77 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 16 Jul 2025 17:27:44 -0700 Subject: [PATCH 10/64] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 4ff2b89da..cc85d0d0a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -12,6 +12,7 @@ body: label: Before submitting your bug report options: - label: I've tried using the "Ask AI" feature on the [Continue docs site](https://docs.continue.dev/) to see if the docs have an answer + required: false - label: I believe this is a bug. I'll try to join the [Continue Discord](https://discord.gg/NWtdYexhMs) for questions required: false - label: I'm not able to find an [open issue](https://github.com/continuedev/continue/issues?q=is%3Aopen+is%3Aissue) that reports the same bug From f1f4d1f09d7563546b98accc2763899c150909d2 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 18 Jul 2025 22:38:55 +0530 Subject: [PATCH 11/64] chore: add unit tests for file click on codeblock --- .../CodeBlock/CodeBlockPreview.test.tsx | 83 +++++++++++++++++++ .../extensions/CodeBlock/CodeBlockPreview.tsx | 2 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.test.tsx diff --git a/gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.test.tsx b/gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.test.tsx new file mode 100644 index 000000000..8478b56e5 --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.test.tsx @@ -0,0 +1,83 @@ +import { screen } from "@testing-library/react"; +import { NodeViewProps } from "@tiptap/react"; +import { ContextItemWithId } from "core"; +import { beforeEach, describe, it, vi } from "vitest"; +import { renderWithProviders } from "../../../../../util/test/render"; +import { CodeBlockPreview } from "./CodeBlockPreview"; + +const postIde = vi.fn(); + +vi.mock("../../../../../context/MockIdeMessenger", async (importOriginal) => { + const original = (await importOriginal()) as any; + return { + ...original, + MockIdeMessenger: class MockedMockIdeMessenger extends original.MockIdeMessenger { + post(...args: any[]) { + postIde(...args); + } + }, + }; +}); + +describe("CodeBlockPreview", () => { + const createMockContextItem = ( + overrides: Partial = {}, + ): ContextItemWithId => ({ + content: "console.log('test');", + name: "test.ts", + description: "Test file", + id: { + providerTitle: "file", + itemId: "test-item-id", + }, + uri: { + type: "file", + value: "/test/test.ts", + }, + ...overrides, + }); + + const createMockNodeViewProps = ( + item: ContextItemWithId, + selected = false, + ): NodeViewProps => ({ + node: { + attrs: { + item, + }, + } as any, + view: {} as any, + getPos: vi.fn(() => 0), + innerDecorations: {} as any, + editor: {} as any, + extension: {} as any, + HTMLAttributes: {}, + decorations: [] as any, + selected, + updateAttributes: vi.fn(), + deleteNode: vi.fn(), + }); + + beforeEach(async () => { + vi.clearAllMocks(); + }); + + it("opens file when title is clicked", async () => { + const item = createMockContextItem({ + id: { providerTitle: "file", itemId: "test-id" }, + uri: { type: "file", value: "/test/file.ts" }, + name: "test.ts", + }); + const props = createMockNodeViewProps(item); + + await renderWithProviders(); + + const title = screen.getByText("test.ts"); + title.click(); + + expect(postIde).toHaveBeenCalled(); + expect(postIde).toHaveBeenCalledWith("showFile", { + filepath: "/test/file.ts", + }); + }); +}); diff --git a/gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.tsx b/gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.tsx index b81a8c05f..f0a640a22 100644 --- a/gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.tsx +++ b/gui/src/components/mainInput/TipTapEditor/extensions/CodeBlock/CodeBlockPreview.tsx @@ -42,7 +42,7 @@ export const CodeBlockPreview = ({ }); } else if (item.id.providerTitle === "code") { const rif = ctxItemToRifWithContents(item, true); - ideMessenger.ide.showLines( + void ideMessenger.ide.showLines( rif.filepath, rif.range.start.line, rif.range.end.line, From 194b802ed3b1c67afeb6abfa7153401acecd51b6 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sat, 19 Jul 2025 19:39:09 +0200 Subject: [PATCH 12/64] fix: set high default pruning length, let server throw error unless context length known --- core/llm/constants.ts | 2 ++ core/llm/countTokens.ts | 10 ++++++---- core/llm/index.ts | 13 ++++++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/core/llm/constants.ts b/core/llm/constants.ts index 90de5c64d..b6759663d 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -1,6 +1,7 @@ const DEFAULT_MAX_TOKENS = 4096; const DEFAULT_CONTEXT_LENGTH = 32_768; const DEFAULT_TEMPERATURE = 0.5; +const DEFAULT_PRUNING_LENGTH = 128000; const DEFAULT_ARGS = { maxTokens: DEFAULT_MAX_TOKENS, @@ -24,5 +25,6 @@ export { DEFAULT_MAX_BATCH_SIZE, DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_TOKENS, + DEFAULT_PRUNING_LENGTH, PROXY_URL, }; diff --git a/core/llm/countTokens.ts b/core/llm/countTokens.ts index 852638d1c..03a106144 100644 --- a/core/llm/countTokens.ts +++ b/core/llm/countTokens.ts @@ -17,6 +17,7 @@ import { import { renderChatMessage } from "../util/messageContent.js"; import { AsyncEncoder, LlamaAsyncEncoder } from "./asyncEncoder.js"; +import { DEFAULT_PRUNING_LENGTH } from "./constants.js"; import llamaTokenizer from "./llamaTokenizer.js"; interface Encoding { encode: Tiktoken["encode"]; @@ -409,14 +410,14 @@ function pruneRawPromptFromTop( function compileChatMessages({ modelName, msgs, - contextLength, + knownContextLength, maxTokens, supportsImages, tools, }: { modelName: string; msgs: ChatMessage[]; - contextLength: number; + knownContextLength: number | undefined; maxTokens: number; supportsImages: boolean; tools?: Tool[]; @@ -465,6 +466,7 @@ function compileChatMessages({ toolTokens = countToolsTokens(tools, modelName); } + const contextLength = knownContextLength ?? DEFAULT_PRUNING_LENGTH; const countingSafetyBuffer = getTokenCountingBufferSafety(contextLength); const minOutputTokens = Math.min(MIN_RESPONSE_TOKENS, maxTokens); @@ -480,12 +482,12 @@ function compileChatMessages({ inputTokensAvailable -= lastMessagesTokens; // Make sure there's enough context for the non-excludable items - if (inputTokensAvailable < 0) { + if (knownContextLength !== undefined && inputTokensAvailable < 0) { throw new Error( `Not enough context available to include the system message, last user message, and tools. There must be at least ${minOutputTokens} tokens remaining for output. Request had the following token counts: - - contextLength: ${contextLength} + - contextLength: ${knownContextLength} - counting safety buffer: ${countingSafetyBuffer} - tools: ~${toolTokens} - system message: ~${systemMsgTokens} diff --git a/core/llm/index.ts b/core/llm/index.ts index fa16b8591..4d31e0902 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -145,7 +145,7 @@ export abstract class BaseLLM implements ILLM { baseChatSystemMessage?: string; basePlanSystemMessage?: string; baseAgentSystemMessage?: string; - contextLength: number; + _contextLength: number | undefined; maxStopWords?: number | undefined; completionOptions: CompletionOptions; requestOptions?: RequestOptions; @@ -217,8 +217,7 @@ export abstract class BaseLLM implements ILLM { this.baseAgentSystemMessage = options.baseAgentSystemMessage; this.basePlanSystemMessage = options.basePlanSystemMessage; this.baseChatSystemMessage = options.baseChatSystemMessage; - this.contextLength = - options.contextLength ?? llmInfo?.contextLength ?? DEFAULT_CONTEXT_LENGTH; + this._contextLength = options.contextLength ?? llmInfo?.contextLength; this.maxStopWords = options.maxStopWords ?? this.maxStopWords; this.completionOptions = { ...options.completionOptions, @@ -292,6 +291,10 @@ export abstract class BaseLLM implements ILLM { this.autocompleteOptions = options.autocompleteOptions; } + get contextLength() { + return this._contextLength ?? DEFAULT_CONTEXT_LENGTH; + } + getConfigurationStatus() { return LLMConfigurationStatuses.VALID; } @@ -895,7 +898,7 @@ export abstract class BaseLLM implements ILLM { return compileChatMessages({ modelName: completionOptions.model, msgs: message, - contextLength: this.contextLength, + knownContextLength: this._contextLength, maxTokens: completionOptions.maxTokens ?? DEFAULT_MAX_TOKENS, supportsImages: this.supportsImages(), tools: options.tools, @@ -944,7 +947,7 @@ export abstract class BaseLLM implements ILLM { const { compiledChatMessages } = compileChatMessages({ modelName: completionOptions.model, msgs: _messages, - contextLength: this.contextLength, + knownContextLength: this._contextLength, maxTokens: completionOptions.maxTokens ?? DEFAULT_MAX_TOKENS, supportsImages: this.supportsImages(), tools: options.tools, From 32911c07790b0cf2f7e2d9ff67ad5081184dbb67 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sat, 19 Jul 2025 19:47:01 +0200 Subject: [PATCH 13/64] fix: assign to contextLength basellm getter --- core/llm/llms/HuggingFaceTGI.ts | 2 +- core/llm/llms/Ollama.ts | 2 +- core/llm/llms/Vllm.ts | 2 +- core/util/generateRepoMap.test.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/llm/llms/HuggingFaceTGI.ts b/core/llm/llms/HuggingFaceTGI.ts index 8a86634c8..ca4acc6d9 100644 --- a/core/llm/llms/HuggingFaceTGI.ts +++ b/core/llm/llms/HuggingFaceTGI.ts @@ -25,7 +25,7 @@ class HuggingFaceTGI extends BaseLLM { } const json = await response.json(); this.model = json.model_id; - this.contextLength = Number.parseInt(json.max_input_length); + this._contextLength = Number.parseInt(json.max_input_length); }) .catch((e) => { console.log(`Failed to list models for HuggingFace TGI: ${e.message}`); diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index 106f99e1b..a944f90f9 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -184,7 +184,7 @@ class Ollama extends BaseLLM implements ModelInstaller { let value = parts[2]; switch (key) { case "num_ctx": - this.contextLength = + this._contextLength = options.contextLength ?? Number.parseInt(value); break; case "stop": diff --git a/core/llm/llms/Vllm.ts b/core/llm/llms/Vllm.ts index ac550f153..97bd936cb 100644 --- a/core/llm/llms/Vllm.ts +++ b/core/llm/llms/Vllm.ts @@ -72,7 +72,7 @@ class Vllm extends OpenAI { const json = await response.json(); const data = json.data[0]; this.model = data.id; - this.contextLength = Number.parseInt(data.max_model_len); + this._contextLength = Number.parseInt(data.max_model_len); }) .catch((e) => { console.log(`Failed to list models for vLLM: ${e.message}`); diff --git a/core/util/generateRepoMap.test.ts b/core/util/generateRepoMap.test.ts index 78f879f63..67c58c6fd 100644 --- a/core/util/generateRepoMap.test.ts +++ b/core/util/generateRepoMap.test.ts @@ -55,7 +55,7 @@ describe.skip("generateRepoMap", () => { }); // Set testLLM properties - testLLM.contextLength = 2048; + testLLM._contextLength = 2048; testLLM.countTokens = jest.fn().mockReturnValue(10); // Act @@ -115,7 +115,7 @@ describe.skip("generateRepoMap", () => { }); // Set testLLM properties - testLLM.contextLength = 2048; + testLLM._contextLength = 2048; testLLM.countTokens = jest.fn().mockReturnValue(10); // Act @@ -184,7 +184,7 @@ describe.skip("generateRepoMap", () => { .mockImplementation(() => {}); // Set testLLM properties - testLLM.contextLength = 2048; + testLLM._contextLength = 2048; testLLM.countTokens = jest.fn().mockReturnValue(10); // Act From 5c46a1e90b506319d71bca4db95fd37a16d02784 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 21 Jul 2025 11:00:54 -0700 Subject: [PATCH 14/64] feat: clarify mode alert in tools section --- .../tool-policies/ToolPoliciesSection.tsx | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx index 8adfa75d2..5aee1466f 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx @@ -1,4 +1,4 @@ -import { Tool } from "core"; +import { MessageModes, Tool } from "core"; import { useMemo } from "react"; import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks"; import { toggleToolGroupSetting } from "../../../../../redux/slices/uiSlice"; @@ -43,20 +43,28 @@ export const ToolPoliciesSection = () => { const allToolsOff = mode === "chat"; - const message = - mode === "chat" - ? "All tools disabled (Chat)" - : mode === "plan" - ? "Read-only/MCP tools available (Plan)" - : "All tools available (Agent)"; + const getMessage = (mode: MessageModes) => { + switch (mode) { + case "chat": + return "All tools disabled in Chat, switch to Plan or Agent mode to use tools"; + case "plan": + return "Read-only/MCP tools available in Plan mode"; + default: + return ""; + } + }; + + const message = getMessage(mode); return ( <> -
- - {message} - -
+ {(mode === "chat" || mode === "plan") && ( +
+ + {message} + +
+ )} {toolsByGroup.map(([groupName, tools]) => { const isGroupEnabled = !allToolsOff && toolGroupSettings[groupName] !== "exclude"; From 24574d354437539d2d80501e1bb631f26c37c713 Mon Sep 17 00:00:00 2001 From: Ting-Wai To <40179554+tingwai@users.noreply.github.com> Date: Tue, 22 Jul 2025 11:16:39 -0700 Subject: [PATCH 15/64] test: verify chunkDocument filters out chunks exceeding maxChunkSize --- core/indexing/chunk/chunk.test.ts | 60 ++++++++++++++++++++++++++++++- core/llm/countTokens.test.ts | 8 ++++- core/llm/countTokens.ts | 7 ++++ 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/core/indexing/chunk/chunk.test.ts b/core/indexing/chunk/chunk.test.ts index 7a8ce6f76..16bcdd2d9 100644 --- a/core/indexing/chunk/chunk.test.ts +++ b/core/indexing/chunk/chunk.test.ts @@ -1,6 +1,8 @@ import path from "path"; -import { shouldChunk } from "./chunk"; +import { Chunk } from "../../index.js"; +import { cleanupAsyncEncoders } from "../../llm/countTokens.js"; +import { chunkDocument, shouldChunk } from "./chunk"; describe("shouldChunk", () => { test("should chunk a typescript file", () => { @@ -28,6 +30,62 @@ describe("shouldChunk", () => { }); }); +describe("chunkDocument", () => { + afterAll(async () => { + // Clean up the global async encoders to prevent Jest from hanging + await cleanupAsyncEncoders(); + }); + + test("should return multiple chunks for large content with small maxChunkSize", async () => { + const filepath = "/test/file.txt"; + const maxChunkSize = 10; // small limit + const digest = "test-digest"; + + // Create content with multiple short lines - each line should fit within maxChunkSize + const lines = ["short line", "another line", "third line"]; + const contents = lines.join("\n"); + + const chunks: Chunk[] = []; + for await (const chunk of chunkDocument({ + filepath, + contents, + maxChunkSize, + digest, + })) { + chunks.push(chunk); + } + + // Verify chunks have valid content + chunks.forEach((chunk) => { + expect(chunk.content.length).toBeGreaterThan(0); + }); + }); + + test("should filter out chunks that exceed maxChunkSize in tokens", async () => { + const filepath = "/test/large.txt"; + const maxChunkSize = 10; // small limit + const digest = "test-digest-2"; + + const contents = + "This is a much longer line with many words that will likely exceed the maxChunkSize token limit and should be filtered out by the chunkDocument function. This is a much longer line with many words that will likely exceed the maxChunkSize token limit and should be filtered out by the chunkDocument function."; + + const chunks: Chunk[] = []; + for await (const chunk of chunkDocument({ + filepath, + contents, + maxChunkSize, + digest, + })) { + chunks.push(chunk); + } + + // Verify that no chunks were created since the content exceeds maxChunkSize + chunks.forEach((chunk) => { + expect(chunk.content.length).toBe(0); + }); + }); +}); + function generateString(length: number) { return "a".repeat(length); } diff --git a/core/llm/countTokens.test.ts b/core/llm/countTokens.test.ts index 9b08dca21..4cbe13a5b 100644 --- a/core/llm/countTokens.test.ts +++ b/core/llm/countTokens.test.ts @@ -2,6 +2,7 @@ // Generated by continue import { ChatMessage, MessagePart, ToolCall } from "../index.js"; import { + cleanupAsyncEncoders, compileChatMessages, countTokens, countTokensAsync, @@ -27,7 +28,12 @@ describe.skip("countTokens", () => { }); }); -describe.skip("countTokensAsync", () => { +describe("countTokensAsync", () => { + afterAll(async () => { + // Clean up the global async encoders to prevent Jest from hanging + await cleanupAsyncEncoders(); + }); + it("should count tokens asynchronously for a simple string", async () => { const content = "Hello world!"; const tokenCount = await countTokensAsync(content, "gpt-4"); diff --git a/core/llm/countTokens.ts b/core/llm/countTokens.ts index 852638d1c..8120c9167 100644 --- a/core/llm/countTokens.ts +++ b/core/llm/countTokens.ts @@ -536,7 +536,14 @@ function compileChatMessages({ }; } +async function cleanupAsyncEncoders(): Promise { + try { + await llamaAsyncEncoder.close(); + } catch (e) {} +} + export { + cleanupAsyncEncoders, compileChatMessages, countTokens, countTokensAsync, From 6bdae841d83c0c8fc129765acff1a0a9201f2894 Mon Sep 17 00:00:00 2001 From: Ting-Wai To <40179554+tingwai@users.noreply.github.com> Date: Wed, 23 Jul 2025 17:44:17 -0700 Subject: [PATCH 16/64] test: chunkDocumentWithoutId --- core/indexing/chunk/chunk.test.ts | 68 ++++++++++++++++++++++++++++++- core/indexing/chunk/chunk.ts | 2 +- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/core/indexing/chunk/chunk.test.ts b/core/indexing/chunk/chunk.test.ts index 16bcdd2d9..90febfa73 100644 --- a/core/indexing/chunk/chunk.test.ts +++ b/core/indexing/chunk/chunk.test.ts @@ -1,8 +1,8 @@ import path from "path"; -import { Chunk } from "../../index.js"; +import { Chunk, ChunkWithoutID } from "../../index.js"; import { cleanupAsyncEncoders } from "../../llm/countTokens.js"; -import { chunkDocument, shouldChunk } from "./chunk"; +import { chunkDocument, chunkDocumentWithoutId, shouldChunk } from "./chunk"; describe("shouldChunk", () => { test("should chunk a typescript file", () => { @@ -86,6 +86,70 @@ describe("chunkDocument", () => { }); }); +describe("chunkDocumentWithoutId", () => { + afterAll(async () => { + await cleanupAsyncEncoders(); + }); + + test("should return no chunks for empty content", async () => { + const contents = ""; + const chunks: ChunkWithoutID[] = []; + for await (const chunk of chunkDocumentWithoutId( + "file.txt", + contents, + 100, + )) { + chunks.push(chunk); + } + expect(chunks).toHaveLength(0); + }); + + test("should chunk text files", async () => { + const contents = "Line 1\nLine 2\nLine 3"; + const chunks: ChunkWithoutID[] = []; + for await (const chunk of chunkDocumentWithoutId( + "file.txt", + contents, + 100, + )) { + chunks.push(chunk); + } + expect(chunks.length).toBeGreaterThan(0); + expect(chunks[0].content).toContain("Line 1"); + }); + + test("should chunk for code files", async () => { + const contents = "function test() {\n return 42;\n}"; + const chunks: ChunkWithoutID[] = []; + for await (const chunk of chunkDocumentWithoutId( + "file.js", + contents, + 100, + )) { + chunks.push(chunk); + } + expect(chunks.length).toBeGreaterThan(0); + expect(chunks[0].content).toContain("function test"); + }); + + test("should chunk large content", async () => { + const contents = Array(100).fill("short line").join("\n"); // Large content with many lines + const maxChunkSize = 50; + const chunks: ChunkWithoutID[] = []; + for await (const chunk of chunkDocumentWithoutId( + "file.txt", + contents, + maxChunkSize, + )) { + chunks.push(chunk); + } + expect(chunks.length).toBeGreaterThan(1); // Should create multiple chunks + chunks.forEach((chunk) => { + expect(chunk.content.length).toBeGreaterThan(0); // Each chunk should have content + }); + }); +}); + function generateString(length: number) { return "a".repeat(length); } diff --git a/core/indexing/chunk/chunk.ts b/core/indexing/chunk/chunk.ts index d46dd2e3b..de9a33f9c 100644 --- a/core/indexing/chunk/chunk.ts +++ b/core/indexing/chunk/chunk.ts @@ -13,7 +13,7 @@ export type ChunkDocumentParam = { digest: string; }; -async function* chunkDocumentWithoutId( +export async function* chunkDocumentWithoutId( fileUri: string, contents: string, maxChunkSize: number, From 8819712cf5a02262dd61256da2d9d406dd70d69d Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Thu, 24 Jul 2025 12:51:09 +0530 Subject: [PATCH 17/64] fix: missing `alwaysApply` in local rule block --- core/config/yaml/loadYaml.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index b1682e751..4f1a1632f 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -57,6 +57,7 @@ function convertYamlRuleToContinueRule(rule: Rule): RuleWithSource { globs: rule.globs, name: rule.name, ruleFile: rule.sourceFile, + alwaysApply: rule.alwaysApply, }; } } From 90f703724dbbbd852afdc96926fade0e3a574fbc Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:52:53 +0530 Subject: [PATCH 18/64] improve: add filepath in editoutcome dev data --- extensions/vscode/src/extension/EditOutcomeTracker.ts | 1 + packages/config-yaml/src/schemas/data/editOutcome/index.ts | 1 + packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/extensions/vscode/src/extension/EditOutcomeTracker.ts b/extensions/vscode/src/extension/EditOutcomeTracker.ts index c69dbac72..69ac452fa 100644 --- a/extensions/vscode/src/extension/EditOutcomeTracker.ts +++ b/extensions/vscode/src/extension/EditOutcomeTracker.ts @@ -65,6 +65,7 @@ class EditOutcomeTracker { newCodeLines: pendingEdit.newCodeLines, lineChange: pendingEdit.lineChange, accepted, + filepath: pendingEdit.filepath, }, }); diff --git a/packages/config-yaml/src/schemas/data/editOutcome/index.ts b/packages/config-yaml/src/schemas/data/editOutcome/index.ts index ec902364c..32c34632c 100644 --- a/packages/config-yaml/src/schemas/data/editOutcome/index.ts +++ b/packages/config-yaml/src/schemas/data/editOutcome/index.ts @@ -12,4 +12,5 @@ export const editOutcomeEventAllSchema = baseDevDataAllSchema.extend({ newCodeLines: z.number(), lineChange: z.number(), accepted: z.boolean(), + filepath: z.string(), }); diff --git a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts index 1fdbfb967..acd3be4bd 100644 --- a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts @@ -20,6 +20,7 @@ export const editOutcomeEventSchema_0_2_0 = editOutcomeEventAllSchema.pick({ previousCodeLines: true, newCodeLines: true, lineChange: true, + filepath: true, }); export const editOutcomeEventSchema_0_2_0_noCode = From 55f5ed580f0e8ab5cc0dad2a524066af8187b667 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 24 Jul 2025 11:49:35 -0700 Subject: [PATCH 19/64] fix: use loading state for loading indicator, better error messages --- core/config/ConfigHandler.ts | 6 +++--- gui/src/components/modelSelection/ModelSelect.tsx | 3 +-- gui/src/redux/slices/configSlice.ts | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 1ca09b1e2..f936196fa 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -438,7 +438,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [], + errors: [{ message: "Current profile not found", fatal: true }], configLoadInterrupted: true, }; } @@ -494,7 +494,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [], + errors: [{ message: "Current profile not found", fatal: true }], configLoadInterrupted: true, }; } @@ -507,7 +507,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [], + errors: [{ message: "Current profile not found", fatal: true }], configLoadInterrupted: true, }; } diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index d474fe58a..a93009965 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -11,7 +11,6 @@ import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { AddModelForm } from "../../forms/AddModelForm"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { EMPTY_CONFIG } from "../../redux/slices/configSlice"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; import { updateSelectedModelByRole } from "../../redux/thunks/updateSelectedModelByRole"; import { @@ -94,6 +93,7 @@ function ModelSelect() { const isInEdit = useAppSelector((store) => store.session.isInEdit); const config = useAppSelector((state) => state.config.config); + const isConfigLoading = useAppSelector((state) => state.config.loading); const ideMessenger = useContext(IdeMessengerContext); const buttonRef = useRef(null); const [options, setOptions] = useState([]); @@ -192,7 +192,6 @@ function ModelSelect() { ); } - const isConfigLoading = config === EMPTY_CONFIG; const hasNoModels = allModels?.length === 0; return ( diff --git a/gui/src/redux/slices/configSlice.ts b/gui/src/redux/slices/configSlice.ts index 8766014a2..0deb9f6e4 100644 --- a/gui/src/redux/slices/configSlice.ts +++ b/gui/src/redux/slices/configSlice.ts @@ -68,6 +68,7 @@ export const configSlice = createSlice({ } else { state.config = config; } + state.loading = false; }, updateConfig: ( state, From 92f494488a4ef598f5164cf447378be0516ebee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20B=C5=82ach?= Date: Thu, 24 Jul 2025 21:46:47 +0200 Subject: [PATCH 20/64] fix: use JAVA_HOME instead of macOS-specific JVM (#6778) The previous homebrew-17 is specific to macOS and requires switching to JAVA_HOME on Windows/Linux. Workaround: ./idea/gradle.xml can be marked as unstaged, but this is inconvenient for developers. JAVA_HOME is a standard IMO. --- .idea/gradle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index c277e816e..324ac997a 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -5,7 +5,7 @@