From 400013333da31cef12135441a2fede4627b5d004 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sun, 20 Jul 2025 12:42:03 +0200 Subject: [PATCH] chore: system message tools: cleanup and restore edit test --- ...fySystemTools.ts => convertSystemTools.ts} | 0 .../interceptSystemToolCalls.ts | 6 ++- .../systemMessageTools/openAiToolCallId.ts | 13 ------- .../systemMessageTools/systemToolUtils.ts | 24 +++++++----- extensions/vscode/e2e/tests/Edit.test.ts | 2 +- extensions/vscode/e2e/tests/GUI.test.ts | 5 ++- extensions/vscode/package-lock.json | 7 ++-- gui/package-lock.json | 3 +- gui/src/redux/util/constructMessages.ts | 2 +- manual-testing-sandbox/test.js | 37 +++++++++++++++++++ 10 files changed, 66 insertions(+), 33 deletions(-) rename core/tools/systemMessageTools/{textifySystemTools.ts => convertSystemTools.ts} (100%) delete mode 100644 core/tools/systemMessageTools/openAiToolCallId.ts diff --git a/core/tools/systemMessageTools/textifySystemTools.ts b/core/tools/systemMessageTools/convertSystemTools.ts similarity index 100% rename from core/tools/systemMessageTools/textifySystemTools.ts rename to core/tools/systemMessageTools/convertSystemTools.ts diff --git a/core/tools/systemMessageTools/interceptSystemToolCalls.ts b/core/tools/systemMessageTools/interceptSystemToolCalls.ts index 59c7bf3d9..56e47c835 100644 --- a/core/tools/systemMessageTools/interceptSystemToolCalls.ts +++ b/core/tools/systemMessageTools/interceptSystemToolCalls.ts @@ -1,13 +1,15 @@ import { ChatMessage, PromptLog, TextMessagePart } from "../.."; import { normalizeToMessageParts } from "../../util/messageContent"; import { detectToolCallStart } from "./detectToolCallStart"; -import { generateOpenAIToolCallId } from "./openAiToolCallId"; import { getInitialTooLCallParseState, handleToolCallBuffer, ToolCallParseState, } from "./parseSystemToolCall"; -import { splitAtCodeblocksAndNewLines } from "./systemToolUtils"; +import { + generateOpenAIToolCallId, + splitAtCodeblocksAndNewLines, +} from "./systemToolUtils"; /* Function to intercept tool calls in markdown code blocks format from a chat message stream diff --git a/core/tools/systemMessageTools/openAiToolCallId.ts b/core/tools/systemMessageTools/openAiToolCallId.ts deleted file mode 100644 index f0f609f7e..000000000 --- a/core/tools/systemMessageTools/openAiToolCallId.ts +++ /dev/null @@ -1,13 +0,0 @@ -function randomLettersAndNumbers(length: number): string { - const characters = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - let result = ""; - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * characters.length)); - } - return result; -} - -export function generateOpenAIToolCallId(): string { - return `call_${randomLettersAndNumbers(24)}`; -} diff --git a/core/tools/systemMessageTools/systemToolUtils.ts b/core/tools/systemMessageTools/systemToolUtils.ts index 83eb88e0a..6b12c8120 100644 --- a/core/tools/systemMessageTools/systemToolUtils.ts +++ b/core/tools/systemMessageTools/systemToolUtils.ts @@ -2,16 +2,20 @@ export function closeTag(openingTag: string): string { return ` { return codeLens; } - it("Accepts an Edit in the GUI", async () => { + it.only("Accepts an Edit in the GUI", async () => { ({ view } = await GUIActions.switchToReactIframe()); await EditActions.acceptEditInGUI(view); diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 7d6814041..66481cb14 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -3,6 +3,7 @@ import { By, EditorView, Key, + VSBrowser, WebDriver, WebElement, WebView, @@ -15,14 +16,14 @@ import { DEFAULT_TIMEOUT } from "../constants"; import { GUISelectors } from "../selectors/GUI.selectors"; import { TestUtils } from "../TestUtils"; -describe.only("GUI Test", () => { +describe("GUI Test", () => { let view: WebView; let driver: WebDriver; before(async function () { this.timeout(DEFAULT_TIMEOUT.XL); // Uncomment this line for faster testing - // await GUIActions.moveContinueToSidebar(VSBrowser.instance.driver); + await GUIActions.moveContinueToSidebar(VSBrowser.instance.driver); await GlobalActions.openTestWorkspace(); await GlobalActions.clearAllNotifications(); }); diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 8780ab1e2..a6a86e3b4 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.63", + "version": "1.1.66", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.63", + "version": "1.1.66", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", @@ -129,6 +129,7 @@ "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", + "iconv-lite": "^0.6.3", "ignore": "^5.3.1", "is-localhost-ip": "^2.0.0", "jinja-js": "0.1.8", @@ -142,7 +143,7 @@ "node-html-markdown": "^1.3.0", "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", - "openai": "^4.76.0", + "openai": "^4.104.0", "p-limit": "^6.1.0", "partial-json": "^0.1.7", "pg": "^8.11.3", diff --git a/gui/package-lock.json b/gui/package-lock.json index d611543e2..c9ad23ed0 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -140,6 +140,7 @@ "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", + "iconv-lite": "^0.6.3", "ignore": "^5.3.1", "is-localhost-ip": "^2.0.0", "jinja-js": "0.1.8", @@ -153,7 +154,7 @@ "node-html-markdown": "^1.3.0", "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", - "openai": "^4.76.0", + "openai": "^4.104.0", "p-limit": "^6.1.0", "partial-json": "^0.1.7", "pg": "^8.11.3", diff --git a/gui/src/redux/util/constructMessages.ts b/gui/src/redux/util/constructMessages.ts index 524730d90..ac70bdafa 100644 --- a/gui/src/redux/util/constructMessages.ts +++ b/gui/src/redux/util/constructMessages.ts @@ -14,7 +14,7 @@ import { CANCELLED_TOOL_CALL_MESSAGE, NO_TOOL_CALL_OUTPUT_MESSAGE, } from "core/tools/constants"; -import { convertToolCallStatesToSystemCallsAndOutput } from "core/tools/systemMessageTools/textifySystemTools"; +import { convertToolCallStatesToSystemCallsAndOutput } from "core/tools/systemMessageTools/convertSystemTools"; import { findLast, findLastIndex } from "core/util/findLast"; import { normalizeToMessageParts, diff --git a/manual-testing-sandbox/test.js b/manual-testing-sandbox/test.js index d2920d6af..0e60af4e0 100644 --- a/manual-testing-sandbox/test.js +++ b/manual-testing-sandbox/test.js @@ -1,21 +1,50 @@ +/** + * Calculator class for performing basic arithmetic operations + * Uses method chaining to allow consecutive operations + */ class Calculator { + /** + * Initialize calculator with result set to 0 + */ constructor() { this.result = 0; } + /** + * Add a number to the current result + * @param {number} number - The number to add + * @returns {Calculator} - Returns this instance for method chaining + */ add(number) { this.result += number; return this; } + + /** + * Subtract a number from the current result + * @param {number} number - The number to subtract + * @returns {Calculator} - Returns this instance for method chaining + */ subtract(number) { return this; } + /** + * Multiply the current result by a number + * @param {number} number - The number to multiply by + * @returns {Calculator} - Returns this instance for method chaining + */ multiply(number) { this.result *= number; return this; } + /** + * Divide the current result by a number + * @param {number} number - The number to divide by + * @returns {Calculator} - Returns this instance for method chaining + * @throws {Error} - Throws error if attempting to divide by zero + */ divide(number) { if (number === 0) { throw new Error("Cannot divide by zero"); @@ -24,10 +53,18 @@ class Calculator { return this; } + /** + * Get the current result value + * @returns {number} - The current result + */ getResult() { return this.result; } + /** + * Reset the result to 0 + * @returns {Calculator} - Returns this instance for method chaining + */ reset() { this.result = 0; return this;