From 79d74977d3854e2ca7cbdc9b898adf138330c830 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Tue, 24 Jun 2025 11:28:10 -0700 Subject: [PATCH 01/82] adds cwd to the MCP yaml as an option. --- core/config/types.ts | 2 + core/config/yaml/loadYaml.cwd.vitest.ts | 125 ++++++++++++++++++++++ core/config/yaml/loadYaml.ts | 1 + core/context/mcp/MCPConnection.test.ts | 19 ++++ core/context/mcp/MCPConnection.ts | 1 + core/index.d.ts | 1 + packages/config-yaml/src/schemas/index.ts | 1 + 7 files changed, 150 insertions(+) create mode 100644 core/config/yaml/loadYaml.cwd.vitest.ts diff --git a/core/config/types.ts b/core/config/types.ts index df29d6071..406f40ddd 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -1004,6 +1004,8 @@ declare global { type: "stdio"; command: string; args: string[]; + env?: Record; + cwd?: string; } interface WebSocketOptions { diff --git a/core/config/yaml/loadYaml.cwd.vitest.ts b/core/config/yaml/loadYaml.cwd.vitest.ts new file mode 100644 index 000000000..2b7e3ee61 --- /dev/null +++ b/core/config/yaml/loadYaml.cwd.vitest.ts @@ -0,0 +1,125 @@ +import { describe, it, expect } from "vitest"; +import { validateConfigYaml, AssistantUnrolled } from "@continuedev/config-yaml"; + +describe("MCP Server cwd configuration", () => { + describe("YAML schema validation", () => { + it("should accept valid MCP server with cwd", () => { + const config: AssistantUnrolled = { + name: "test-assistant", + version: "1.0.0", + mcpServers: [ + { + name: "test-server", + command: "node", + args: ["server.js"], + env: { NODE_ENV: "production" }, + cwd: "/path/to/project", + connectionTimeout: 5000, + }, + ], + }; + + const errors = validateConfigYaml(config); + expect(errors).toHaveLength(0); + }); + + it("should accept MCP server without cwd", () => { + const config: AssistantUnrolled = { + name: "test-assistant", + version: "1.0.0", + mcpServers: [ + { + name: "test-server", + command: "python", + args: ["-m", "server"], + }, + ], + }; + + const errors = validateConfigYaml(config); + expect(errors).toHaveLength(0); + }); + + it("should accept relative paths in cwd", () => { + const config: AssistantUnrolled = { + name: "test-assistant", + version: "1.0.0", + mcpServers: [ + { + name: "test-server", + command: "cargo", + args: ["run"], + cwd: "./rust-project", + }, + ], + }; + + const errors = validateConfigYaml(config); + expect(errors).toHaveLength(0); + }); + + it("should accept empty string cwd", () => { + const config: AssistantUnrolled = { + name: "test-assistant", + version: "1.0.0", + mcpServers: [ + { + name: "test-server", + command: "deno", + args: ["run", "server.ts"], + cwd: "", + }, + ], + }; + + const errors = validateConfigYaml(config); + expect(errors).toHaveLength(0); + }); + }); + + describe("MCP server configuration examples", () => { + it("should support common MCP server patterns with cwd", () => { + const configs = [ + { + name: "Local project MCP server", + server: { + name: "project-mcp", + command: "npm", + args: ["run", "mcp-server"], + cwd: "/Users/developer/my-project", + }, + }, + { + name: "Python MCP with virtual environment", + server: { + name: "python-mcp", + command: "python", + args: ["-m", "my_mcp_server"], + env: { PYTHONPATH: "./src" }, + cwd: "/home/user/python-project", + }, + }, + { + name: "Relative path MCP server", + server: { + name: "relative-mcp", + command: "node", + args: ["index.js"], + cwd: "../mcp-servers/filesystem", + }, + }, + ]; + + configs.forEach(({ name, server }) => { + const config: AssistantUnrolled = { + name: "test-assistant", + version: "1.0.0", + mcpServers: [server], + }; + + const errors = validateConfigYaml(config); + expect(errors).toHaveLength(0); + }); + }); + }); +}); \ No newline at end of file diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 0c6436c38..3467c15dd 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -70,6 +70,7 @@ function convertYamlMcpToContinueMcp( command: server.command, args: server.args ?? [], env: server.env, + cwd: server.cwd, } as any, // TODO: Fix the mcpServers types in config-yaml (discriminated union) timeout: server.connectionTimeout, }; diff --git a/core/context/mcp/MCPConnection.test.ts b/core/context/mcp/MCPConnection.test.ts index f8f146f07..84fb1a703 100644 --- a/core/context/mcp/MCPConnection.test.ts +++ b/core/context/mcp/MCPConnection.test.ts @@ -25,6 +25,25 @@ describe("MCPConnection", () => { expect(conn.status).toBe("not-connected"); }); + it("should create instance with stdio transport including cwd", () => { + const options = { + name: "test-mcp", + id: "test-id", + transport: { + type: "stdio" as const, + command: "test-cmd", + args: ["--test"], + env: { TEST: "true" }, + cwd: "/path/to/working/directory", + }, + }; + + const conn = new MCPConnection(options); + expect(conn).toBeInstanceOf(MCPConnection); + expect(conn.status).toBe("not-connected"); + expect(conn.options.transport.cwd).toBe("/path/to/working/directory"); + }); + it("should create instance with websocket transport", () => { const options = { name: "test-mcp", diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index c66a93ed3..af971d813 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -329,6 +329,7 @@ class MCPConnection { command, args, env, + cwd: options.transport.cwd, stderr: "pipe", }); diff --git a/core/index.d.ts b/core/index.d.ts index 9b54701ff..ba3f84767 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1129,6 +1129,7 @@ export interface StdioOptions { command: string; args: string[]; env?: Record; + cwd?: string; requestOptions?: RequestOptions; } diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts index 917cb9866..b3d7782f4 100644 --- a/packages/config-yaml/src/schemas/index.ts +++ b/packages/config-yaml/src/schemas/index.ts @@ -22,6 +22,7 @@ const mcpServerSchema = z.object({ faviconUrl: z.string().optional(), args: z.array(z.string()).optional(), env: z.record(z.string()).optional(), + cwd: z.string().optional(), connectionTimeout: z.number().gt(0).optional(), requestOptions: requestOptionsSchema.optional(), }); From a2b62aafc6f66bd003ea1f986f115bead413efc3 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Tue, 24 Jun 2025 12:05:56 -0700 Subject: [PATCH 02/82] update the docs --- docs/docs/customize/deep-dives/mcp.mdx | 15 +++++++++++++-- docs/docs/reference.md | 6 +++++- docs/docs/yaml-migration.md | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/docs/customize/deep-dives/mcp.mdx b/docs/docs/customize/deep-dives/mcp.mdx index 9899518e7..589b04798 100644 --- a/docs/docs/customize/deep-dives/mcp.mdx +++ b/docs/docs/customize/deep-dives/mcp.mdx @@ -110,6 +110,7 @@ MCP blocks follow the established syntax for blocks, with a few additional prope - `type` (optional): The type of the MCP server: `sse`, `stdio`, `streamable-http` - `args` (optional): Arguments to pass to the command. - `env` (optional): Secrets to be injected into the command as environment variables. +- `cwd` (optional): Working directory to run the command in. Can be absolute or relative path. ### Transport Types @@ -132,12 +133,22 @@ For local MCP servers that communicate via standard input and output: ```yaml mcpServers: - - name: Name + - name: SQLite Server type: stdio command: npx args: - "@modelcontextprotocol/server-sqlite" - - "/path/to/your/database.db" + - "./database.db" + cwd: "/path/to/project" + + - name: Local Project Server + command: npm + args: + - "run" + - "mcp-server" + cwd: "./my-project" + env: + NODE_ENV: "production" ``` #### Streamable HTTP Transport diff --git a/docs/docs/reference.md b/docs/docs/reference.md index 9ff1077f9..25328e80d 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -384,6 +384,7 @@ prompts, context, and tool use. Continue supports any MCP server with the MCP co - `command` (**required**): The command used to start the server. - `args`: An optional array of arguments for the command. - `env`: An optional map of environment variables for the server process. +- `cwd`: An optional working directory to run the command in. Can be absolute or relative path. - `connectionTimeout`: An optional connection timeout number to the server in milliseconds. **Example:** @@ -395,7 +396,10 @@ mcpServers: args: - mcp-server-sqlite - --db-path - - /Users/NAME/test.db + - ./test.db + cwd: /Users/NAME/project + env: + NODE_ENV: production ``` ### `data` diff --git a/docs/docs/yaml-migration.md b/docs/docs/yaml-migration.md index c07f99c18..1b65aaecc 100644 --- a/docs/docs/yaml-migration.md +++ b/docs/docs/yaml-migration.md @@ -288,6 +288,7 @@ docs: - `command` (**required**): The command used to start the server. - `args`: An optional array of arguments for the command. - `env`: An optional map of environment variables for the server process. +- `cwd`: An optional working directory to run the command in. Can be absolute or relative path. **Before** From 6e72c496c73e663e8543f4791be9253f00211ea3 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Tue, 24 Jun 2025 12:08:54 -0700 Subject: [PATCH 03/82] npm run format --- core/config/yaml/loadYaml.cwd.vitest.ts | 17 ++++++++++------- core/context/mcp/MCPConnection.test.ts | 5 ++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/core/config/yaml/loadYaml.cwd.vitest.ts b/core/config/yaml/loadYaml.cwd.vitest.ts index 2b7e3ee61..fd6769f70 100644 --- a/core/config/yaml/loadYaml.cwd.vitest.ts +++ b/core/config/yaml/loadYaml.cwd.vitest.ts @@ -1,10 +1,13 @@ import { describe, it, expect } from "vitest"; -import { validateConfigYaml, AssistantUnrolled } from "@continuedev/config-yaml"; +import { + validateConfigYaml, + AssistantUnrolledNonNullable, +} from "@continuedev/config-yaml"; describe("MCP Server cwd configuration", () => { describe("YAML schema validation", () => { it("should accept valid MCP server with cwd", () => { - const config: AssistantUnrolled = { + const config: AssistantUnrolledNonNullable = { name: "test-assistant", version: "1.0.0", mcpServers: [ @@ -24,7 +27,7 @@ describe("MCP Server cwd configuration", () => { }); it("should accept MCP server without cwd", () => { - const config: AssistantUnrolled = { + const config: AssistantUnrolledNonNullable = { name: "test-assistant", version: "1.0.0", mcpServers: [ @@ -41,7 +44,7 @@ describe("MCP Server cwd configuration", () => { }); it("should accept relative paths in cwd", () => { - const config: AssistantUnrolled = { + const config: AssistantUnrolledNonNullable = { name: "test-assistant", version: "1.0.0", mcpServers: [ @@ -59,7 +62,7 @@ describe("MCP Server cwd configuration", () => { }); it("should accept empty string cwd", () => { - const config: AssistantUnrolled = { + const config: AssistantUnrolledNonNullable = { name: "test-assistant", version: "1.0.0", mcpServers: [ @@ -111,7 +114,7 @@ describe("MCP Server cwd configuration", () => { ]; configs.forEach(({ name, server }) => { - const config: AssistantUnrolled = { + const config: AssistantUnrolledNonNullable = { name: "test-assistant", version: "1.0.0", mcpServers: [server], @@ -122,4 +125,4 @@ describe("MCP Server cwd configuration", () => { }); }); }); -}); \ No newline at end of file +}); diff --git a/core/context/mcp/MCPConnection.test.ts b/core/context/mcp/MCPConnection.test.ts index 84fb1a703..fb9def814 100644 --- a/core/context/mcp/MCPConnection.test.ts +++ b/core/context/mcp/MCPConnection.test.ts @@ -1,6 +1,7 @@ import { jest } from "@jest/globals"; import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import MCPConnection from "./MCPConnection"; +import { StdioOptions } from "../../index.d.js"; describe("MCPConnection", () => { beforeEach(() => { @@ -41,7 +42,9 @@ describe("MCPConnection", () => { const conn = new MCPConnection(options); expect(conn).toBeInstanceOf(MCPConnection); expect(conn.status).toBe("not-connected"); - expect(conn.options.transport.cwd).toBe("/path/to/working/directory"); + if (conn.options.transport.type === "stdio") { + expect(conn.options.transport.cwd).toBe("/path/to/working/directory"); + } }); it("should create instance with websocket transport", () => { From e662a66fab07471ea65f54b2b688c72868c84844 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Thu, 26 Jun 2025 05:20:19 -0700 Subject: [PATCH 04/82] rename test --- core/config/yaml/{loadYaml.cwd.vitest.ts => loadYaml.vitest.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename core/config/yaml/{loadYaml.cwd.vitest.ts => loadYaml.vitest.ts} (100%) diff --git a/core/config/yaml/loadYaml.cwd.vitest.ts b/core/config/yaml/loadYaml.vitest.ts similarity index 100% rename from core/config/yaml/loadYaml.cwd.vitest.ts rename to core/config/yaml/loadYaml.vitest.ts From 2b1997e02f84ec6001b777ec14c0beae838de3d0 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 3 Jul 2025 02:46:28 -0700 Subject: [PATCH 05/82] limit ls tool output and add tests --- core/tools/implementations/lsTool.ts | 38 +++++++-- core/tools/implementations/lsTool.vitest.ts | 90 +++++++++++++++++++++ 2 files changed, 120 insertions(+), 8 deletions(-) create mode 100644 core/tools/implementations/lsTool.vitest.ts diff --git a/core/tools/implementations/lsTool.ts b/core/tools/implementations/lsTool.ts index 4a7f8bcb5..088ab7feb 100644 --- a/core/tools/implementations/lsTool.ts +++ b/core/tools/implementations/lsTool.ts @@ -2,29 +2,51 @@ import { ToolImpl } from "."; import { walkDir } from "../../indexing/walkDir"; import { resolveRelativePathInDir } from "../../util/ideUtils"; +export function resolveLsToolDirPath(dirPath: string | undefined) { + if (!dirPath || dirPath === ".") { + return "/"; + } + if (dirPath.startsWith(".")) { + return dirPath.slice(1); + } + return dirPath.replace(/\\/g, "/"); +} + +const MAX_LS_TOOL_LINES = 200; + export const lsToolImpl: ToolImpl = async (args, extras) => { - const uri = await resolveRelativePathInDir(args.dirPath, extras.ide); + const dirPath = resolveLsToolDirPath(args?.dirPath); + const uri = await resolveRelativePathInDir(dirPath, extras.ide); if (!uri) { throw new Error( - `Directory ${args.dirPath} not found. Make sure to use forward-slash paths. Do not use e.g. "."`, + `Directory ${args.dirPath} not found. Make sure to use forward-slash paths`, ); } const entries = await walkDir(uri, extras.ide, { returnRelativeUrisPaths: true, include: "both", - recursive: args.recursive ?? false, + recursive: args?.recursive ?? false, }); - const content = - entries.length > 0 - ? entries.join("\n") - : `No files/folders found in ${args.dirPath}`; + const lines = entries.slice(0, MAX_LS_TOOL_LINES); + + let content = + lines.length > 0 + ? lines.join("\n") + : `No files/folders found in ${dirPath}`; + + if (entries.length > MAX_LS_TOOL_LINES) { + content += `\n... ${entries.length - MAX_LS_TOOL_LINES} entries were truncated`; + if (args?.recursive) { + content += ". Try using a non-recursive search"; + } + } return [ { name: "File/folder list", - description: `Files/folders in ${args.dirPath}`, + description: `Files/folders in ${dirPath}`, content, }, ]; diff --git a/core/tools/implementations/lsTool.vitest.ts b/core/tools/implementations/lsTool.vitest.ts new file mode 100644 index 000000000..fe51171a6 --- /dev/null +++ b/core/tools/implementations/lsTool.vitest.ts @@ -0,0 +1,90 @@ +import { expect, test, vi } from "vitest"; +import { ToolExtras } from "../.."; +import * as walkDirModule from "../../indexing/walkDir"; +import { lsToolImpl, resolveLsToolDirPath } from "./lsTool"; + +vi.mock("../../indexing/walkDir"); + +const mockExtras = { + ide: { + fileExists: async (path: string) => true, + getWorkspaceDirs: async () => ["dir1"], + }, +} as unknown as ToolExtras; + +test("resolveLsToolDirPath handles undefined path", () => { + expect(resolveLsToolDirPath(undefined)).toBe("/"); +}); + +test("resolveLsToolDirPath handles empty string", () => { + expect(resolveLsToolDirPath("")).toBe("/"); +}); + +test("resolveLsToolDirPath handles dot", () => { + expect(resolveLsToolDirPath(".")).toBe("/"); +}); + +test("resolveLsToolDirPath handles dot relative", () => { + expect(resolveLsToolDirPath("./hi")).toBe("/hi"); +}); + +test("resolveLsToolDirPath normalizes backslashes to forward slashes", () => { + expect(resolveLsToolDirPath("path\\to\\dir")).toBe("path/to/dir"); +}); + +test("resolveLsToolDirPath preserves forward slashes", () => { + expect(resolveLsToolDirPath("path/to/dir")).toBe("path/to/dir"); +}); + +test("lsToolImpl truncates output when entries exceed MAX_LS_TOOL_LINES", async () => { + // Generate more than MAX_LS_TOOL_LINES entries (which is 200) + const mockEntries = Array.from({ length: 250 }, (_, i) => `file${i}.txt`); + + // Mock walkDir to return our large array + vi.spyOn(walkDirModule, "walkDir").mockResolvedValue(mockEntries); + + const result = await lsToolImpl( + { dirPath: "testDir", recursive: true }, + mockExtras, + ); + + // Check that the result contains the truncation message + expect(result[0].content).toContain("... 50 entries were truncated"); + + // Check that only MAX_LS_TOOL_LINES entries are included + const contentLines = result[0].content.split("\n"); + // Account for the truncation message line + expect(contentLines.length).toBe(201); + + // Check the suggestion to use non-recursive search is included + expect(result[0].content).toContain("Try using a non-recursive search"); +}); + +test("lsToolImpl shows truncation message without suggestion for non-recursive search", async () => { + // Generate more than MAX_LS_TOOL_LINES entries + const mockEntries = Array.from({ length: 250 }, (_, i) => `file${i}.txt`); + + // Mock walkDir to return our large array + vi.spyOn(walkDirModule, "walkDir").mockResolvedValue(mockEntries); + + const result = await lsToolImpl( + { dirPath: "testDir", recursive: false }, + mockExtras, + ); + + // Check that the result contains the truncation message + expect(result[0].content).toContain("... 50 entries were truncated"); + + // Check that the suggestion to use non-recursive search is NOT included + expect(result[0].content).not.toContain("Try using a non-recursive search"); +}); + +test("lsToolImpl shows message when no files are found", async () => { + // Mock walkDir to return empty array + vi.spyOn(walkDirModule, "walkDir").mockResolvedValue([]); + + const result = await lsToolImpl({ dirPath: "emptyDir" }, mockExtras); + + // Check that the result contains the "no files found" message + expect(result[0].content).toBe("No files/folders found in emptyDir"); +}); From 28b02c16365a5bbbe24ab8aa9bba6f7b068ca5b7 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 3 Jul 2025 02:53:49 -0700 Subject: [PATCH 06/82] move to warning context item paradigm and update tests for ls tool --- core/tools/implementations/lsTool.ts | 23 ++++++++++++++------- core/tools/implementations/lsTool.vitest.ts | 16 +++++++++----- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/core/tools/implementations/lsTool.ts b/core/tools/implementations/lsTool.ts index 088ab7feb..0418b37f6 100644 --- a/core/tools/implementations/lsTool.ts +++ b/core/tools/implementations/lsTool.ts @@ -36,18 +36,25 @@ export const lsToolImpl: ToolImpl = async (args, extras) => { ? lines.join("\n") : `No files/folders found in ${dirPath}`; - if (entries.length > MAX_LS_TOOL_LINES) { - content += `\n... ${entries.length - MAX_LS_TOOL_LINES} entries were truncated`; - if (args?.recursive) { - content += ". Try using a non-recursive search"; - } - } - - return [ + const contextItems = [ { name: "File/folder list", description: `Files/folders in ${dirPath}`, content, }, ]; + + if (entries.length > MAX_LS_TOOL_LINES) { + let warningContent = `${entries.length - MAX_LS_TOOL_LINES} ls entries were truncated`; + if (args?.recursive) { + warningContent += ". Try using a non-recursive search"; + } + contextItems.push({ + name: "ls truncation warning", + description: "Informs the model that ls results were truncated", + content: warningContent, + }); + } + + return contextItems; }; diff --git a/core/tools/implementations/lsTool.vitest.ts b/core/tools/implementations/lsTool.vitest.ts index fe51171a6..b697a90c5 100644 --- a/core/tools/implementations/lsTool.vitest.ts +++ b/core/tools/implementations/lsTool.vitest.ts @@ -49,15 +49,19 @@ test("lsToolImpl truncates output when entries exceed MAX_LS_TOOL_LINES", async ); // Check that the result contains the truncation message - expect(result[0].content).toContain("... 50 entries were truncated"); + expect(result.length).toBe(2); + expect(result[0].content).toContain("file1.txt"); + expect(result[0].content).toContain("file199.txt"); + expect(result[1].content).toContain("Try using a non-recursive search"); + expect(result[1].content).toContain("50 ls entries were truncated"); // Check that only MAX_LS_TOOL_LINES entries are included const contentLines = result[0].content.split("\n"); // Account for the truncation message line - expect(contentLines.length).toBe(201); + expect(contentLines.length).toBe(200); // Check the suggestion to use non-recursive search is included - expect(result[0].content).toContain("Try using a non-recursive search"); + expect(result[1].content).toContain("Try using a non-recursive search"); }); test("lsToolImpl shows truncation message without suggestion for non-recursive search", async () => { @@ -73,10 +77,11 @@ test("lsToolImpl shows truncation message without suggestion for non-recursive s ); // Check that the result contains the truncation message - expect(result[0].content).toContain("... 50 entries were truncated"); + expect(result.length).toBe(2); + expect(result[1].content).toContain("50 ls entries were truncated"); // Check that the suggestion to use non-recursive search is NOT included - expect(result[0].content).not.toContain("Try using a non-recursive search"); + expect(result[1].content).not.toContain("Try using a non-recursive search"); }); test("lsToolImpl shows message when no files are found", async () => { @@ -86,5 +91,6 @@ test("lsToolImpl shows message when no files are found", async () => { const result = await lsToolImpl({ dirPath: "emptyDir" }, mockExtras); // Check that the result contains the "no files found" message + expect(result.length).toBe(1); expect(result[0].content).toBe("No files/folders found in emptyDir"); }); From 6635d021b7c5ef7bf475c754ccd7302cb75bfb04 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 3 Jul 2025 15:03:41 -0700 Subject: [PATCH 07/82] truncate output for fetchUrlContent, searchWeb, and viewDiff --- core/tools/implementations/fetchUrlContent.ts | 30 ++++- .../implementations/fetchUrlContent.vitest.ts | 91 +++++++++++++++ core/tools/implementations/searchWeb.ts | 32 +++++- .../tools/implementations/searchWeb.vitest.ts | 107 ++++++++++++++++++ core/tools/implementations/viewDiff.ts | 28 ++++- core/tools/implementations/viewDiff.vitest.ts | 89 +++++++++++++++ 6 files changed, 372 insertions(+), 5 deletions(-) create mode 100644 core/tools/implementations/fetchUrlContent.vitest.ts create mode 100644 core/tools/implementations/searchWeb.vitest.ts create mode 100644 core/tools/implementations/viewDiff.vitest.ts diff --git a/core/tools/implementations/fetchUrlContent.ts b/core/tools/implementations/fetchUrlContent.ts index d2c031d4e..16259780a 100644 --- a/core/tools/implementations/fetchUrlContent.ts +++ b/core/tools/implementations/fetchUrlContent.ts @@ -1,6 +1,34 @@ import { ToolImpl } from "."; import { getUrlContextItems } from "../../context/providers/URLContextProvider"; +const DEFAULT_FETCH_URL_CHAR_LIMIT = 20000; + export const fetchUrlContentImpl: ToolImpl = async (args, extras) => { - return getUrlContextItems(args.url, extras.fetch); + const contextItems = await getUrlContextItems(args.url, extras.fetch); + + // Track truncated content + const truncatedUrls: string[] = []; + + // Check and truncate each context item + const processedItems = contextItems.map((item) => { + if (item.content.length > DEFAULT_FETCH_URL_CHAR_LIMIT) { + truncatedUrls.push(args.url); + return { + ...item, + content: item.content.substring(0, DEFAULT_FETCH_URL_CHAR_LIMIT), + }; + } + return item; + }); + + // Add truncation warning if needed + if (truncatedUrls.length > 0) { + processedItems.push({ + name: "URL content truncation warning", + description: "Informs that URL content was truncated", + content: `The content from ${truncatedUrls.join(", ")} was truncated because it exceeded the ${DEFAULT_FETCH_URL_CHAR_LIMIT} character limit. If you need more content, consider fetching specific sections or using a more targeted approach.`, + }); + } + + return processedItems; }; diff --git a/core/tools/implementations/fetchUrlContent.vitest.ts b/core/tools/implementations/fetchUrlContent.vitest.ts new file mode 100644 index 000000000..9d103893d --- /dev/null +++ b/core/tools/implementations/fetchUrlContent.vitest.ts @@ -0,0 +1,91 @@ +import { expect, test, vi } from "vitest"; +import { fetchUrlContentImpl } from "./fetchUrlContent"; + +vi.mock("../../context/providers/URLContextProvider", () => ({ + getUrlContextItems: vi.fn(), +})); + +import { ToolExtras } from "../.."; +import { getUrlContextItems } from "../../context/providers/URLContextProvider"; +const mockExtras = { + fetch: vi.fn() as any, + ide: {} as any, +} as unknown as ToolExtras; + +test("fetchUrlContent should not truncate content under character limit", async () => { + const shortContent = "This is a short content"; + const mockContextItems = [ + { + name: "Test URL", + description: "Test URL description", + content: shortContent, + }, + ]; + + (getUrlContextItems as any).mockResolvedValue(mockContextItems); + + const result = await fetchUrlContentImpl( + { url: "https://example.com" }, + mockExtras, + ); + + expect(result).toHaveLength(1); + expect(result[0].content).toBe(shortContent); +}); + +test("fetchUrlContent should truncate content exceeding character limit", async () => { + const DEFAULT_FETCH_URL_CHAR_LIMIT = 20000; + // Create a string exceeding the character limit + const longContent = "a".repeat(DEFAULT_FETCH_URL_CHAR_LIMIT + 1000); + const mockContextItems = [ + { + name: "Test URL", + description: "Test URL description", + content: longContent, + }, + ]; + + (getUrlContextItems as any).mockResolvedValue(mockContextItems); + + const result = await fetchUrlContentImpl( + { url: "https://example.com" }, + mockExtras, + ); + + expect(result).toHaveLength(2); // Original item + warning + expect(result[0].content.length).toBe(DEFAULT_FETCH_URL_CHAR_LIMIT); + expect(result[1].name).toBe("URL content truncation warning"); + expect(result[1].content).toContain("was truncated"); + expect(result[1].content).toContain("20000 character limit"); +}); + +test("fetchUrlContent should add truncation warning with multiple truncated items", async () => { + const DEFAULT_FETCH_URL_CHAR_LIMIT = 20000; + // Create strings exceeding the character limit + const longContent1 = "a".repeat(DEFAULT_FETCH_URL_CHAR_LIMIT + 500); + const longContent2 = "b".repeat(DEFAULT_FETCH_URL_CHAR_LIMIT + 1000); + const mockContextItems = [ + { + name: "Test URL 1", + description: "Test URL description 1", + content: longContent1, + }, + { + name: "Test URL 2", + description: "Test URL description 2", + content: longContent2, + }, + ]; + + (getUrlContextItems as any).mockResolvedValue(mockContextItems); + + const result = await fetchUrlContentImpl( + { url: "https://example.com" }, + mockExtras, + ); + + expect(result).toHaveLength(3); // Two original items + warning + expect(result[0].content.length).toBe(DEFAULT_FETCH_URL_CHAR_LIMIT); + expect(result[1].content.length).toBe(DEFAULT_FETCH_URL_CHAR_LIMIT); + expect(result[2].name).toBe("URL content truncation warning"); +}); diff --git a/core/tools/implementations/searchWeb.ts b/core/tools/implementations/searchWeb.ts index a01212659..c7b64feb3 100644 --- a/core/tools/implementations/searchWeb.ts +++ b/core/tools/implementations/searchWeb.ts @@ -1,8 +1,36 @@ +import { ToolImpl } from "."; import { fetchSearchResults } from "../../context/providers/WebContextProvider"; -import { ToolImpl } from "."; +const DEFAULT_WEB_SEARCH_CHAR_LIMIT = 8000; export const searchWebImpl: ToolImpl = async (args, extras) => { const webResults = await fetchSearchResults(args.query, 5, extras.fetch); - return webResults; + + // Track truncated results + const truncatedResults: string[] = []; + + // Check and truncate each result + const processedResults = webResults.map((result, index) => { + if (result.content.length > DEFAULT_WEB_SEARCH_CHAR_LIMIT) { + truncatedResults.push( + result.name || result.description || `Result #${index + 1}`, + ); + return { + ...result, + content: result.content.substring(0, DEFAULT_WEB_SEARCH_CHAR_LIMIT), + }; + } + return result; + }); + + // Add truncation warning if needed + if (truncatedResults.length > 0) { + processedResults.push({ + name: "Web search truncation warning", + description: "Informs that search results were truncated", + content: `The content from the following search results was truncated because it exceeded the ${DEFAULT_WEB_SEARCH_CHAR_LIMIT} character limit: ${truncatedResults.join(", ")}. For more detailed information, consider refining your search query.`, + }); + } + + return processedResults; }; diff --git a/core/tools/implementations/searchWeb.vitest.ts b/core/tools/implementations/searchWeb.vitest.ts new file mode 100644 index 000000000..17ddd4925 --- /dev/null +++ b/core/tools/implementations/searchWeb.vitest.ts @@ -0,0 +1,107 @@ +import { expect, test, vi } from "vitest"; +import { searchWebImpl } from "./searchWeb"; + +// Mock the fetchSearchResults function +vi.mock("../../context/providers/WebContextProvider", () => ({ + fetchSearchResults: vi.fn(), +})); +const mockExtras = { + fetch: vi.fn() as any, + ide: {} as any, +} as unknown as ToolExtras; + +import { ToolExtras } from "../.."; +import { fetchSearchResults } from "../../context/providers/WebContextProvider"; + +test("searchWeb should not truncate results under character limit", async () => { + const shortContent = "This is a short search result content"; + const mockSearchResults = [ + { + name: "Result 1", + description: "Search result description 1", + content: shortContent, + }, + { + name: "Result 2", + description: "Search result description 2", + content: shortContent, + }, + ]; + + (fetchSearchResults as any).mockResolvedValue(mockSearchResults); + + const result = await searchWebImpl({ query: "test query" }, mockExtras); + + expect(result).toHaveLength(2); + expect(result[0].content).toBe(shortContent); + expect(result[1].content).toBe(shortContent); +}); + +test("searchWeb should truncate results exceeding character limit", async () => { + const DEFAULT_WEB_SEARCH_CHAR_LIMIT = 8000; + // Create a string exceeding the character limit + const longContent = "a".repeat(DEFAULT_WEB_SEARCH_CHAR_LIMIT + 1000); + const shortContent = "This is a short search result content"; + const mockSearchResults = [ + { + name: "Result 1", + description: "Search result description 1", + content: longContent, + }, + { + name: "Result 2", + description: "Search result description 2", + content: shortContent, + }, + ]; + + (fetchSearchResults as any).mockResolvedValue(mockSearchResults); + + const result = await searchWebImpl({ query: "test query" }, mockExtras); + + expect(result).toHaveLength(3); // Two results + warning + expect(result[0].content.length).toBe(DEFAULT_WEB_SEARCH_CHAR_LIMIT); + expect(result[1].content).toBe(shortContent); + expect(result[2].name).toBe("Web search truncation warning"); + expect(result[2].content).toContain("truncated"); + expect(result[2].content).toContain("Result 1"); + expect(result[2].content).not.toContain("Result 2"); +}); + +test("searchWeb should include all truncated results in the warning", async () => { + const DEFAULT_WEB_SEARCH_CHAR_LIMIT = 8000; + // Create strings exceeding the character limit + const longContent1 = "a".repeat(DEFAULT_WEB_SEARCH_CHAR_LIMIT + 500); + const longContent2 = "b".repeat(DEFAULT_WEB_SEARCH_CHAR_LIMIT + 1000); + const shortContent = "This is a short search result content"; + const mockSearchResults = [ + { + name: "Result 1", + description: "Search result description 1", + content: longContent1, + }, + { + name: "Result 2", + description: "Search result description 2", + content: longContent2, + }, + { + name: "Result 3", + description: "Search result description 3", + content: shortContent, + }, + ]; + + (fetchSearchResults as any).mockResolvedValue(mockSearchResults); + + const result = await searchWebImpl({ query: "test query" }, mockExtras); + + expect(result).toHaveLength(4); // Three results + warning + expect(result[0].content.length).toBe(DEFAULT_WEB_SEARCH_CHAR_LIMIT); + expect(result[1].content.length).toBe(DEFAULT_WEB_SEARCH_CHAR_LIMIT); + expect(result[2].content).toBe(shortContent); + expect(result[3].name).toBe("Web search truncation warning"); + expect(result[3].content).toContain("Result 1"); + expect(result[3].content).toContain("Result 2"); + expect(result[3].content).not.toContain("Result 3"); +}); diff --git a/core/tools/implementations/viewDiff.ts b/core/tools/implementations/viewDiff.ts index fd1dfdb8a..d3e7e2ef8 100644 --- a/core/tools/implementations/viewDiff.ts +++ b/core/tools/implementations/viewDiff.ts @@ -1,15 +1,39 @@ import { ToolImpl } from "."; +import { ContextItem } from "../.."; import { getDiffsFromCache } from "../../autocomplete/snippets/gitDiffCache"; +const DEFAULT_GIT_DIFF_LINE_LIMIT = 5000; + export const viewDiffImpl: ToolImpl = async (args, extras) => { const diffs = await getDiffsFromCache(extras.ide); // const diffs = await extras.ide.getDiff(true); // TODO includeUnstaged should be an option - return [ + const combinedDiff = diffs.join("\n"); + const diffLines = combinedDiff.split("\n"); + + let truncated = false; + let processedDiff = combinedDiff; + + if (diffLines.length > DEFAULT_GIT_DIFF_LINE_LIMIT) { + truncated = true; + processedDiff = diffLines.slice(0, DEFAULT_GIT_DIFF_LINE_LIMIT).join("\n"); + } + + const contextItems: ContextItem[] = [ { name: "Diff", description: "The current git diff", - content: diffs.join("\n"), + content: processedDiff, }, ]; + + if (truncated) { + contextItems.push({ + name: "Diff truncation warning", + description: "Informs that git diff was truncated", + content: `The git diff was truncated because it exceeded ${DEFAULT_GIT_DIFF_LINE_LIMIT} lines. Consider viewing specific files or focusing on smaller changes.`, + }); + } + + return contextItems; }; diff --git a/core/tools/implementations/viewDiff.vitest.ts b/core/tools/implementations/viewDiff.vitest.ts new file mode 100644 index 000000000..c9dfe211c --- /dev/null +++ b/core/tools/implementations/viewDiff.vitest.ts @@ -0,0 +1,89 @@ +import { expect, test, vi } from "vitest"; +import { viewDiffImpl } from "./viewDiff"; + +// Mock the getDiffsFromCache function +vi.mock("../../autocomplete/snippets/gitDiffCache", () => ({ + getDiffsFromCache: vi.fn(), +})); + +import { ToolExtras } from "../.."; +import { getDiffsFromCache } from "../../autocomplete/snippets/gitDiffCache"; +const mockExtras = { + fetch: vi.fn() as any, + ide: {} as any, +} as unknown as ToolExtras; + +test("viewDiff should not truncate diffs under line limit", async () => { + // Create a small diff with just a few lines + const smallDiff = [ + "diff --git a/file1.txt b/file1.txt", + "index 1234..5678 100644", + "--- a/file1.txt", + "+++ b/file1.txt", + "@@ -1,3 +1,4 @@", + " line1", + "-line2", + "+line2 modified", + "+line3 added", + ]; + + (getDiffsFromCache as any).mockResolvedValue(smallDiff); + + const result = await viewDiffImpl({}, mockExtras); + + expect(result).toHaveLength(1); // Just the diff, no warning + expect(result[0].name).toBe("Diff"); + expect(result[0].content).toBe(smallDiff.join("\n")); +}); + +test("viewDiff should truncate diffs exceeding line limit", async () => { + const DEFAULT_GIT_DIFF_LINE_LIMIT = 5000; + + // Create a large diff that exceeds the line limit + const largeDiffLines = Array(DEFAULT_GIT_DIFF_LINE_LIMIT + 1000).fill( + "line content", + ); + const largeDiff = [ + "diff --git a/file1.txt b/file1.txt", + "index 1234..5678 100644", + ...largeDiffLines, + ]; + + (getDiffsFromCache as any).mockResolvedValue([largeDiff.join("\n")]); + + const result = await viewDiffImpl({}, mockExtras); + + expect(result).toHaveLength(2); // Diff + warning + + // Count the number of lines in the result + const resultLines = result[0].content.split("\n"); + expect(resultLines.length).toBe(DEFAULT_GIT_DIFF_LINE_LIMIT); + + // Check the warning + expect(result[1].name).toBe("Diff truncation warning"); + expect(result[1].content).toContain("truncated"); + expect(result[1].content).toContain(`${DEFAULT_GIT_DIFF_LINE_LIMIT} lines`); +}); + +test("viewDiff should handle multiple diffs correctly", async () => { + const DEFAULT_GIT_DIFF_LINE_LIMIT = 5000; + + // Create multiple diffs that together exceed the line limit + const diff1Lines = Array(3000).fill("diff1 line"); + const diff2Lines = Array(3000).fill("diff2 line"); + const diff1 = diff1Lines.join("\n"); + const diff2 = diff2Lines.join("\n"); + + (getDiffsFromCache as any).mockResolvedValue([diff1, diff2]); + + const result = await viewDiffImpl({}, mockExtras); + + expect(result).toHaveLength(2); // Diff + warning + + // Count the number of lines in the result + const resultLines = result[0].content.split("\n"); + expect(resultLines.length).toBe(DEFAULT_GIT_DIFF_LINE_LIMIT); + + // Check the warning + expect(result[1].name).toBe("Diff truncation warning"); +}); From 14dfdecf2982e1a5b937aecb4b7c2bc1c80f2c14 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Thu, 3 Jul 2025 17:05:34 -0700 Subject: [PATCH 08/82] try to align window as much as possible --- core/codeRenderer/CodeRenderer.ts | 22 +++++++- .../src/activation/NextEditWindowManager.ts | 52 ++++++++++--------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 3d4084f7a..aab98222a 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -148,10 +148,18 @@ export class CodeRenderer { async highlightCode( code: string, language: string = "javascript", + currLineOffsetFromTop: number, ): Promise { return await codeToHtml(code, { lang: language, theme: this.currentTheme, + decorations: [ + { + start: { line: currLineOffsetFromTop, character: 0 }, + end: { line: currLineOffsetFromTop, character: 0 }, + properties: { class: "highlighted-line" }, + }, + ], }); } @@ -163,8 +171,15 @@ export class CodeRenderer { dimensions: Dimensions, lineHeight: number, options: ConversionOptions, + currLineOffsetFromTop: number, ): Promise { - const highlightedCodeHtml = await this.highlightCode(code, language); + const strokeWidth = 1; + const highlightedCodeHtml = await this.highlightCode( + code, + language, + currLineOffsetFromTop, + ); + console.log(highlightedCodeHtml); const guts = this.convertShikiHtmlToSvgGut( highlightedCodeHtml, @@ -176,10 +191,11 @@ export class CodeRenderer { const svg = ` - + ${guts} `; + console.log(svg); return Buffer.from(svg, "utf8"); } @@ -244,6 +260,7 @@ export class CodeRenderer { dimensions: Dimensions, lineHeight: number, options: ConversionOptions, + currLineOffsetFromTop: number, ): Promise { switch (options.imageType) { // case "png": @@ -265,6 +282,7 @@ export class CodeRenderer { dimensions, lineHeight, options, + currLineOffsetFromTop, ); return `data:image/svg+xml;base64,${svgBuffer.toString("base64")}`; } diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 25cd64acc..3e601ede2 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -29,7 +29,7 @@ const SVG_CONFIG = { radius: 3, leftMargin: 40, defaultText: "", - lineSpacing: 1.2, // Line spacing multiplier + lineSpacing: 1.3, // Line spacing multiplier cursorOffset: 4, // Spaces to offset from cursor get fontSize() { @@ -261,7 +261,12 @@ export class NextEditWindowManager { ); // Create and apply decoration with the text. - await this.renderTooltip(editor, currCursorPos, newEditRangeSlice); + await this.renderTooltip( + editor, + currCursorPos, + newEditRangeSlice, + editableRegionStartLine, + ); // Reserve tab and esc to either accept or reject the displayed next edit contents. await NextEditWindowManager.reserveTabAndEsc(); @@ -457,6 +462,7 @@ export class NextEditWindowManager { */ private async createCodeRender( text: string, + currLineOffsetFromTop: number, ): Promise< | { uri: vscode.Uri; dimensions: { width: number; height: number } } | undefined @@ -479,6 +485,7 @@ export class NextEditWindowManager { { imageType: "svg", }, + currLineOffsetFromTop, ); return { @@ -498,8 +505,14 @@ export class NextEditWindowManager { */ private async createCodeRenderDecoration( code: string, + position: vscode.Position, + editableRegionStartLine: number, ): Promise { - const uriAndDimensions = await this.createCodeRender(code); + const currLineOffsetFromTop = position.line - editableRegionStartLine; + const uriAndDimensions = await this.createCodeRender( + code, + currLineOffsetFromTop, + ); if (!uriAndDimensions) { return undefined; } @@ -508,38 +521,22 @@ export class NextEditWindowManager { const tipWidth = dimensions.width; const tipHeight = dimensions.height; + const offsetFromTop = + (position.line - editableRegionStartLine) * SVG_CONFIG.lineHeight + + SVG_CONFIG.strokeWidth * 2; + return vscode.window.createTextEditorDecorationType({ after: { contentIconPath: uri, - // border: `;box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px ${backgroundColour}; - // border-radius: ${SVG_CONFIG.radius}px; - // filter: ${SVG_CONFIG.filter}`, - // width: `${tipWidth}px`, - // height: `${tipHeight}px`, - // border: `transparent; position: absolute; z-index: 1000; - // box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, - // inset 0 0 0 ${tipHeight}px ${backgroundColour}; - // border-radius: ${SVG_CONFIG.radius}px; - // filter: ${SVG_CONFIG.filter}; - // margin-left: ${SVG_CONFIG.cursorOffset * 8}px;`, border: `transparent; position: absolute; z-index: 1000; box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px; filter: ${SVG_CONFIG.filter}; border-radius: ${SVG_CONFIG.radius}px; + margin-top: ${-1 * offsetFromTop}px; margin-left: ${SVG_CONFIG.cursorOffset * 8}px;`, - // border: `solid 1px white; position: absolute; z-index: 1000; - // margin-left: ${SVG_CONFIG.cursorOffset * 8}px; - // margin-top: 0em;`, - // border: `solid 1px white; position: absolute; z-index: 1000; - // margin: 0em; padding: 0em; - // margin-left: ${SVG_CONFIG.cursorOffset * 8}px; - // margin-top: 0em;`, width: `${tipWidth}px`, height: `${tipHeight}px`, - // textDecoration: `none; transform: translateY(-100%);`, }, - // Set a negative margin to make the decoration float if it starts to displace text. - // Also use absolute positioning. rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed, }); } @@ -635,13 +632,18 @@ export class NextEditWindowManager { editor: vscode.TextEditor, position: vscode.Position, text: string, + editableRegionStartLine: number, ) { console.log("renderTooltip"); // Capture document version to detect changes. const docVersion = editor.document.version; // Create a new decoration with the text. - const decoration = await this.createCodeRenderDecoration(text); + const decoration = await this.createCodeRenderDecoration( + text, + position, + editableRegionStartLine, + ); if (!decoration) { console.error("Failed to create decoration for text:", text); return; From dafcfec5de6fb15151532e578974a346778d1ffd Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Thu, 3 Jul 2025 17:36:38 -0700 Subject: [PATCH 09/82] experimenting with styles --- core/codeRenderer/CodeRenderer.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index aab98222a..9b9f469d1 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -8,6 +8,8 @@ * we rarely ever need syntax highlighting outside of * creating a render of it. */ +import { transformerColorizedBrackets } from "@shikijs/colorized-brackets"; +import { transformerNotationHighlight } from "@shikijs/transformers"; import { JSDOM } from "jsdom"; import { BundledTheme, codeToHtml, getSingletonHighlighter } from "shiki"; import { escapeForSVG, kebabOfStr } from "../util/text"; @@ -150,9 +152,20 @@ export class CodeRenderer { language: string = "javascript", currLineOffsetFromTop: number, ): Promise { - return await codeToHtml(code, { + const annotatedCode = code + .split("\n") + .map((line, i) => + i === currLineOffsetFromTop ? line + "// [\!code highlight]" : line, + ) + .join("\n"); + + return await codeToHtml(annotatedCode, { lang: language, theme: this.currentTheme, + transformers: [ + transformerColorizedBrackets(), + transformerNotationHighlight(), + ], decorations: [ { start: { line: currLineOffsetFromTop, character: 0 }, From 8a7baaaa489596e6e8b74149883d76becfcd1f9a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 3 Jul 2025 20:45:23 -0700 Subject: [PATCH 10/82] plan mode --- gui/src/components/ModeSelect/ModeIcon.tsx | 10 +- gui/src/components/ModeSelect/ModeSelect.tsx | 89 +++++++++++++++-- gui/src/components/gui/Switch.tsx | 8 +- .../tool-policies/ToolPoliciesSection.tsx | 96 +++++++++++++------ .../sections/tool-policies/ToolPolicyItem.tsx | 15 ++- gui/src/redux/slices/sessionSlice.ts | 6 ++ gui/src/redux/store.ts | 1 + gui/src/redux/thunks/streamNormalInput.ts | 10 +- 8 files changed, 187 insertions(+), 48 deletions(-) diff --git a/gui/src/components/ModeSelect/ModeIcon.tsx b/gui/src/components/ModeSelect/ModeIcon.tsx index 83201d5ae..1a34eb988 100644 --- a/gui/src/components/ModeSelect/ModeIcon.tsx +++ b/gui/src/components/ModeSelect/ModeIcon.tsx @@ -1,8 +1,12 @@ -import { ChatBubbleLeftIcon, SparklesIcon } from "@heroicons/react/24/outline"; +import { + ChatBubbleLeftIcon, + SparklesIcon, + SwatchIcon, +} from "@heroicons/react/24/outline"; import { MessageModes } from "core"; interface ModeIconProps { - mode: MessageModes; + mode: MessageModes | "plan"; className?: string; } @@ -13,6 +17,8 @@ export function ModeIcon({ switch (mode) { case "agent": return ; + case "plan": + return ; case "chat": return ; } diff --git a/gui/src/components/ModeSelect/ModeSelect.tsx b/gui/src/components/ModeSelect/ModeSelect.tsx index 9e1b5afef..df29976a9 100644 --- a/gui/src/components/ModeSelect/ModeSelect.tsx +++ b/gui/src/components/ModeSelect/ModeSelect.tsx @@ -1,11 +1,16 @@ -import { CheckIcon, ChevronDownIcon } from "@heroicons/react/24/outline"; +import { + CheckIcon, + ChevronDownIcon, + InformationCircleIcon, +} from "@heroicons/react/24/outline"; import { MessageModes } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; import { useCallback, useEffect, useMemo } from "react"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectSelectedChatModel } from "../../redux/slices/configSlice"; -import { setMode } from "../../redux/slices/sessionSlice"; +import { setMode, setReadOnly } from "../../redux/slices/sessionSlice"; import { getFontSize, getMetaKeyLabel } from "../../util"; +import { ToolTip } from "../gui/Tooltip"; import { useMainEditor } from "../mainInput/TipTapEditor"; import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "../ui"; import { ModeIcon } from "./ModeIcon"; @@ -32,13 +37,25 @@ export function ModeSelect() { } }, [mode, agentModeSupported, dispatch, selectedModel]); + const readOnlyMode = useAppSelector((store) => store.session.readOnlyMode); + const pseudoMode = useMemo(() => { + return mode === "chat" ? "chat" : readOnlyMode ? "plan" : "agent"; + }, [mode, readOnlyMode]); const cycleMode = useCallback(() => { - dispatch(setMode(mode === "chat" ? "agent" : "chat")); + if (pseudoMode === "chat") { + dispatch(setMode("agent")); + dispatch(setReadOnly(true)); + } else if (pseudoMode === "plan") { + dispatch(setReadOnly(false)); + } else { + dispatch(setReadOnly(true)); + dispatch(setMode("chat")); + } // Only focus main editor if another one doesn't already have focus if (!document.activeElement?.classList?.contains("ProseMirror")) { mainEditor?.commands.focus(); } - }, [mode, mainEditor]); + }, [pseudoMode, mainEditor]); const selectMode = useCallback( (newMode: MessageModes) => { @@ -72,9 +89,13 @@ export function ModeSelect() { data-testid="mode-select-button" className="xs:px-2 text-description bg-lightgray/20 gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200 hover:brightness-110" > - + - {mode.charAt(0).toUpperCase() + mode.slice(1)} + {pseudoMode === "chat" + ? "Chat" + : pseudoMode === "agent" + ? "Agent" + : "Plan"} - {mode === "chat" && } + {pseudoMode === "chat" && } - { + dispatch(setReadOnly(true)); + }} + > +
+ + Agent (Plan) + + + In Plan mode, the Agent can only use read-only tools + +
+ {agentModeSupported ? ( + + ) : ( + (Not supported) + )} +
+ { + dispatch(setReadOnly(false)); + }} >
- Agent + Agent (Act) + + + In Act mode, the Agent can use create/edit tools +
{agentModeSupported ? ( - mode === "agent" && + ) : ( (Not supported) )} diff --git a/gui/src/components/gui/Switch.tsx b/gui/src/components/gui/Switch.tsx index 7004ae9d8..2422c6cd5 100644 --- a/gui/src/components/gui/Switch.tsx +++ b/gui/src/components/gui/Switch.tsx @@ -7,6 +7,7 @@ type ToggleSwitchProps = { text: string; size?: number; showIfToggled?: ReactNode; + disabled?: boolean; }; const ToggleSwitch: React.FC = ({ @@ -15,15 +16,18 @@ const ToggleSwitch: React.FC = ({ text, size = 16, showIfToggled, + disabled = false, }) => { return ( -
+
{text}
{isToggled && !!showIfToggled && showIfToggled}
void; + isSelected: boolean; +} +const ModeBadge = ({ text, onClick, isSelected, icon }: ModeBadgeProps) => { + return ( +
+ {icon} + {text} +
+ ); +}; + export const ToolPoliciesSection = () => { + const mode = useAppSelector((state) => state.session.mode); + const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); const availableTools = useAppSelector((state) => state.config.config.tools); const toolGroupSettings = useAppSelector( (store) => store.ui.toolGroupSettings, @@ -39,38 +60,57 @@ export const ToolPoliciesSection = () => { ); }, [availableTools]); + const allToolsOff = mode === "chat"; + + const pseudoMode = mode === "chat" ? "chat" : readOnlyMode ? "plan" : "act"; + const message = + pseudoMode === "chat" + ? "All tools are disabled in Chat mode" + : pseudoMode === "plan" + ? "Plan mode: only MCP and read-only tools" + : "Act mode: all tool policies apply"; + return ( <> - {toolsByGroup.map(([groupName, tools]) => ( -
-
-

- {groupName} -

- dispatch(toggleToolGroupSetting(groupName))} - text="" - size={10} - /> -
-
- {tools.map((tool) => ( - + + {message} +
+ {toolsByGroup.map(([groupName, tools]) => { + const isGroupEnabled = + !allToolsOff && toolGroupSettings[groupName] !== "exclude"; + return ( +
+
+

+ {groupName} +

+ dispatch(toggleToolGroupSetting(groupName))} + text="" + size={10} + disabled={allToolsOff} /> - ))} +
+
+ {tools.map((tool) => ( + + ))} +
-
- ))} + ); + })} ); }; diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index b92816839..38f9416fe 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -3,6 +3,7 @@ import { InformationCircleIcon, } from "@heroicons/react/24/outline"; import { Tool } from "core"; +import { BUILT_IN_GROUP_NAME } from "core/tools/builtIn"; import { useEffect, useMemo, useState } from "react"; import { useDispatch } from "react-redux"; import { useAppSelector } from "../../../../../redux/hooks"; @@ -16,7 +17,7 @@ import { useFontSize } from "../../../../ui/font"; interface ToolDropdownItemProps { tool: Tool; duplicatesDetected: boolean; - excluded: boolean; + isGroupEnabled: boolean; } function ToolPolicyItem(props: ToolDropdownItemProps) { @@ -25,6 +26,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { (state) => state.ui.toolSettings[props.tool.function.name], ); const [isExpanded, setIsExpanded] = useState(false); + const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); useEffect(() => { if (!policy) { @@ -44,6 +46,12 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { const fontSize = useFontSize(-2); + const disabled = + !props.isGroupEnabled || + (readOnlyMode && + props.tool.group === BUILT_IN_GROUP_NAME && + !props.tool.readonly); + if (!policy) { return null; } @@ -106,8 +114,9 @@ function ToolPolicyItem(props: ToolDropdownItemProps) {
+
{ dispatch(toggleToolSetting(props.tool.function.name)); @@ -115,7 +124,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { e.preventDefault(); }} > - {props.excluded || policy === "disabled" ? ( + {disabled || policy === "disabled" ? ( <> Off diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 6cd96dd8e..c48a9840d 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -54,6 +54,7 @@ type SessionState = { mainEditorContentTrigger?: JSONContent | undefined; symbols: FileSymbolMap; mode: MessageModes; + readOnlyMode: boolean; isInEdit: boolean; codeBlockApplyStates: { states: ApplyState[]; @@ -73,6 +74,7 @@ const initialState: SessionState = { streamAborter: new AbortController(), symbols: {}, mode: "chat", + readOnlyMode: false, isInEdit: false, codeBlockApplyStates: { states: [], @@ -668,6 +670,9 @@ export const sessionSlice = createSlice({ setMode: (state, action: PayloadAction) => { state.mode = action.payload; }, + setReadOnly: (state, action: PayloadAction) => { + state.readOnlyMode = action.payload; + }, setIsInEdit: (state, action: PayloadAction) => { state.isInEdit = action.payload; }, @@ -768,6 +773,7 @@ export const { setToolGenerated, updateToolCallOutput, setMode, + setReadOnly, setIsSessionMetadataLoading, setAllSessionMetadata, addSessionMetadata, diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 10ecdd2e5..40bd76160 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -42,6 +42,7 @@ const saveSubsetFilters = [ // Persist edit mode in case closes in middle "mode", + "readOnlyMode", // higher risk to persist // codeBlockApplyStates diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index c7c4de02d..2d25f9e29 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -40,12 +40,16 @@ export const streamNormalInput = createAsyncThunk< // Get tools const activeTools = selectActiveTools(state); const toolsSupported = modelSupportsTools(selectedChatModel); + const readOnlyMode = state.session.readOnlyMode; + const filteredTools = readOnlyMode + ? activeTools.filter((t) => t.readonly) + : activeTools; // Construct completion options let completionOptions: LLMFullCompletionOptions = {}; - if (toolsSupported && activeTools.length > 0) { + if (toolsSupported && filteredTools.length > 0) { completionOptions = { - tools: activeTools, + tools: filteredTools, }; } @@ -125,7 +129,7 @@ export const streamNormalInput = createAsyncThunk< modelTitle: selectedChatModel.title, sessionId: state.session.id, ...(state.session.mode === "agent" && { - tools: activeTools.map((tool) => tool.function.name), + tools: filteredTools.map((tool) => tool.function.name), }), }, }); From d1651b4a2dde8a5680a90bb186bcfe2df97d39ab Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 3 Jul 2025 20:47:01 -0700 Subject: [PATCH 11/82] add plan to toggle test --- gui/src/pages/gui/chat-tests/Chat.test.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gui/src/pages/gui/chat-tests/Chat.test.tsx b/gui/src/pages/gui/chat-tests/Chat.test.tsx index d3e6aa18b..d1bae6d07 100644 --- a/gui/src/pages/gui/chat-tests/Chat.test.tsx +++ b/gui/src/pages/gui/chat-tests/Chat.test.tsx @@ -27,7 +27,19 @@ test("should be able to toggle modes", async () => { ); }); - // Check that it switched to Agent mode + // Check that it switched to Plan mode + await getElementByText("Plan"); + + act(() => { + document.dispatchEvent( + new KeyboardEvent("keydown", { + key: ".", + metaKey: true, // cmd key on Mac + }), + ); + }); + + // Check that it switched to Plan mode await getElementByText("Agent"); act(() => { From f3755707da5e6cc87be30ea3eabb4facdc19e449 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 4 Jul 2025 00:55:09 -0700 Subject: [PATCH 12/82] Optimize config unroll with parallel processing for blocks and sections --- packages/config-yaml/src/load/unroll.ts | 271 ++++++++++++++++-------- 1 file changed, 184 insertions(+), 87 deletions(-) diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 1424b2aea..a2f96dbac 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -24,7 +24,7 @@ import { packageIdentifierToShorthandSlug, useProxyForUnrenderedSecrets, } from "./clientRender.js"; -import { getBlockType } from "./getBlockType.js"; +import { BlockType, getBlockType } from "./getBlockType.js"; export function parseConfigYaml(configYaml: string): ConfigYaml { try { @@ -322,12 +322,15 @@ export async function unrollBlocks( "name" | "version" | "rules" | "schema" | "metadata" >)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"]; - // For each section, replace "uses/with" blocks with the real thing - for (const section of sections) { - if (assistant[section]) { - const sectionBlocks: any[] = []; + // Process all sections in parallel + const sectionPromises = sections.map(async (section) => { + if (!assistant[section]) { + return { section, blocks: null }; + } - for (const unrolledBlock of assistant[section]) { + // Process all blocks in this section in parallel + const blockPromises = assistant[section].map( + async (unrolledBlock, index) => { // "uses/with" block if ("uses" in unrolledBlock) { try { @@ -338,10 +341,13 @@ export async function unrollBlocks( ); const block = blockConfigYaml[section]?.[0]; if (block) { - sectionBlocks.push( - mergeOverrides(block, unrolledBlock.override ?? {}), - ); + return { + index, + block: mergeOverrides(block, unrolledBlock.override ?? {}), + error: null, + }; } + return { index, block: null, error: null }; } catch (err) { let msg = ""; if ( @@ -353,99 +359,190 @@ export async function unrollBlocks( msg = `${(err as Error).message}.\n> ${JSON.stringify(unrolledBlock.uses)}`; } - errors.push({ - fatal: false, - message: msg, - }); - console.error( `Failed to unroll block ${JSON.stringify(unrolledBlock.uses)}: ${(err as Error).message}`, ); - sectionBlocks.push(null); + + return { + index, + block: null, + error: { + fatal: false, + message: msg, + }, + }; } } else { // Normal block - sectionBlocks.push(unrolledBlock); + return { index, block: unrolledBlock, error: null }; } - } + }, + ); - unrolledAssistant[section] = sectionBlocks; + const blockResults = await Promise.all(blockPromises); + + // Collect errors and maintain order + const sectionBlocks: any[] = []; + const sectionErrors: ConfigValidationError[] = []; + + for (const result of blockResults) { + if (result.error) { + sectionErrors.push(result.error); + } + sectionBlocks[result.index] = result.block; + } + + return { section, blocks: sectionBlocks, errors: sectionErrors }; + }); + + // Process rules in parallel + const rulesPromise = assistant.rules + ? (async () => { + const rulePromises = assistant.rules!.map(async (rule, index) => { + if (typeof rule === "string" || !("uses" in rule)) { + return { index, rule, error: null }; + } else if ("uses" in rule) { + try { + const blockConfigYaml = await resolveBlock( + decodePackageIdentifier(rule.uses), + rule.with, + registry, + ); + const block = blockConfigYaml.rules?.[0]; + return { index, rule: block || null, error: null }; + } catch (err) { + console.error( + `Failed to unroll block ${rule.uses}: ${(err as Error).message}`, + ); + + return { + index, + rule: null, + error: { + fatal: false, + message: `${(err as Error).message}:\n${rule.uses}`, + }, + }; + } + } + return { index, rule: null, error: null }; + }); + + const ruleResults = await Promise.all(rulePromises); + + const rules: (Rule | null)[] = []; + const ruleErrors: ConfigValidationError[] = []; + + for (const result of ruleResults) { + if (result.error) { + ruleErrors.push(result.error); + } + rules[result.index] = result.rule; + } + + return { rules, errors: ruleErrors }; + })() + : Promise.resolve({ rules: undefined, errors: [] }); + + // Process injected blocks in parallel + const injectedBlocksPromise = injectBlocks + ? (async () => { + const injectedBlockPromises = injectBlocks.map(async (injectBlock) => { + try { + const blockConfigYaml = await registry.getContent(injectBlock); + const parsedBlock = parseMarkdownRuleOrConfigYaml( + blockConfigYaml, + injectBlock, + ); + const blockType = getBlockType(parsedBlock); + const resolvedBlock = await resolveBlock( + injectBlock, + undefined, + registry, + ); + + return { + blockType, + resolvedBlock, + error: null, + }; + } catch (err) { + let msg = ""; + if (injectBlock.uriType === "file") { + msg = `${(err as Error).message}.\n> ${injectBlock.filePath}`; + } else { + msg = `${(err as Error).message}.\n> ${injectBlock.fullSlug}`; + } + + console.error( + `Failed to unroll block ${JSON.stringify(injectBlock)}: ${(err as Error).message}`, + ); + + return { + blockType: null, + resolvedBlock: null, + error: { + fatal: false, + message: msg, + }, + }; + } + }); + + const injectedResults = await Promise.all(injectedBlockPromises); + const injectedErrors: ConfigValidationError[] = []; + const injectedBlocks: { blockType: string; resolvedBlock: any }[] = []; + + for (const result of injectedResults) { + if (result.error) { + injectedErrors.push(result.error); + } else if (result.blockType && result.resolvedBlock) { + injectedBlocks.push({ + blockType: result.blockType, + resolvedBlock: result.resolvedBlock, + }); + } + } + + return { injectedBlocks, errors: injectedErrors }; + })() + : Promise.resolve({ injectedBlocks: [], errors: [] }); + + // Wait for all parallel operations to complete + const [sectionResults, rulesResult, injectedResult] = await Promise.all([ + Promise.all(sectionPromises), + rulesPromise, + injectedBlocksPromise, + ]); + + // Collect all errors + for (const sectionResult of sectionResults) { + if (sectionResult.errors) { + errors.push(...sectionResult.errors); + } + } + errors.push(...rulesResult.errors); + errors.push(...injectedResult.errors); + + // Assign section results + for (const sectionResult of sectionResults) { + if (sectionResult.blocks) { + unrolledAssistant[sectionResult.section] = sectionResult.blocks; } } - // Rules are a bit different because they can be strings, so handle separately - if (assistant.rules) { - const rules: (Rule | null)[] = []; - for (const rule of assistant.rules) { - if (typeof rule === "string" || !("uses" in rule)) { - rules.push(rule); - } else if ("uses" in rule) { - try { - const blockConfigYaml = await resolveBlock( - decodePackageIdentifier(rule.uses), - rule.with, - registry, - ); - const block = blockConfigYaml.rules?.[0]; - if (block) { - rules.push(block); - } - } catch (err) { - errors.push({ - fatal: false, - message: `${(err as Error).message}:\n${rule.uses}`, - }); - - console.error( - `Failed to unroll block ${rule.uses}: ${(err as Error).message}`, - ); - rules.push(null); - } - } - } - - unrolledAssistant.rules = rules; + // Assign rules result + if (rulesResult.rules) { + unrolledAssistant.rules = rulesResult.rules; } // Add injected blocks - for (const injectBlock of injectBlocks ?? []) { - try { - const blockConfigYaml = await registry.getContent(injectBlock); - const parsedBlock = parseMarkdownRuleOrConfigYaml( - blockConfigYaml, - injectBlock, - ); - const blockType = getBlockType(parsedBlock); - const resolvedBlock = await resolveBlock( - injectBlock, - undefined, - registry, - ); - - if (blockType) { - if (!unrolledAssistant[blockType]) { - unrolledAssistant[blockType] = []; - } - unrolledAssistant[blockType]?.push( - ...(resolvedBlock[blockType] as any), - ); - } - } catch (err) { - let msg = ""; - if (injectBlock.uriType === "file") { - msg = `${(err as Error).message}.\n> ${injectBlock.filePath}`; - } else { - msg = `${(err as Error).message}.\n> ${injectBlock.fullSlug}`; - } - errors.push({ - fatal: false, - message: msg, - }); - - console.error( - `Failed to unroll block ${JSON.stringify(injectBlock)}: ${(err as Error).message}`, - ); + for (const { blockType, resolvedBlock } of injectedResult.injectedBlocks) { + const key = blockType as BlockType; + if (!unrolledAssistant[key]) { + unrolledAssistant[key] = []; } + unrolledAssistant[key]?.push(...(resolvedBlock[blockType] as any)); } const configResult: ConfigResult = { From fa533adb39a9ac172a5887033d1729ddff894a4b Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 15:00:21 -0700 Subject: [PATCH 13/82] center align the window --- extensions/vscode/src/activation/NextEditWindowManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 3821340a4..1e9beb6d5 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -572,8 +572,8 @@ export class NextEditWindowManager { const tipHeight = dimensions.height; const offsetFromTop = - (position.line - editableRegionStartLine) * SVG_CONFIG.lineHeight + - SVG_CONFIG.strokeWidth * 2; + (position.line - editableRegionStartLine) * SVG_CONFIG.lineHeight; + // + SVG_CONFIG.strokeWidth * 2; return vscode.window.createTextEditorDecorationType({ after: { From 1dfe3144b7f1590a6903952f3f789782039cc78a Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 15:20:15 -0700 Subject: [PATCH 14/82] add current line highlighting --- core/codeRenderer/CodeRenderer.ts | 97 +++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 24 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 9b9f469d1..a12557437 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -8,10 +8,19 @@ * we rarely ever need syntax highlighting outside of * creating a render of it. */ -import { transformerColorizedBrackets } from "@shikijs/colorized-brackets"; -import { transformerNotationHighlight } from "@shikijs/transformers"; +import { + transformerMetaHighlight, + transformerNotationDiff, + transformerNotationFocus, + transformerNotationHighlight, +} from "@shikijs/transformers"; import { JSDOM } from "jsdom"; -import { BundledTheme, codeToHtml, getSingletonHighlighter } from "shiki"; +import { + BundledLanguage, + BundledTheme, + getSingletonHighlighter, + Highlighter, +} from "shiki"; import { escapeForSVG, kebabOfStr } from "../util/text"; interface CodeRendererOptions { @@ -44,6 +53,8 @@ export class CodeRenderer { private currentTheme: string = "dark-plus"; private editorBackground: string = "#000000"; private editorForeground: string = "#FFFFFF"; + private editorLineHighlight: string = "#000000"; + private highlighter: Highlighter | null = null; private constructor() {} @@ -64,13 +75,25 @@ export class CodeRenderer { ? "dark-plus" : kebabOfStr(themeName); - const highlighter = await getSingletonHighlighter({ + this.highlighter = await getSingletonHighlighter({ + langs: ["typescript"], themes: [this.currentTheme], }); - const th = highlighter.getTheme(this.currentTheme); + const th = this.highlighter.getTheme(this.currentTheme); + // const customTheme = { + // ...th, + // colors: { + // ...th.colors, + // // "editor.lineHighlightBackground": "#ffffff1a", // VS Code's highlight color + // }, + // }; + this.editorBackground = th.bg; this.editorForeground = th.fg; + this.editorLineHighlight = + th.colors!["editor.lineHighlightBackground"] ?? "#000000"; + console.log(th.colors); } else { this.currentTheme = "dark-plus"; } @@ -155,24 +178,31 @@ export class CodeRenderer { const annotatedCode = code .split("\n") .map((line, i) => - i === currLineOffsetFromTop ? line + "// [\!code highlight]" : line, + i === currLineOffsetFromTop + ? line + " \/\/ \[\!code highlight\]" + : line, ) .join("\n"); - return await codeToHtml(annotatedCode, { + await this.highlighter!.loadLanguage(language as BundledLanguage); + + return this.highlighter!.codeToHtml(annotatedCode, { lang: language, theme: this.currentTheme, transformers: [ - transformerColorizedBrackets(), + // transformerColorizedBrackets(), + transformerMetaHighlight(), transformerNotationHighlight(), + transformerNotationDiff(), + transformerNotationFocus(), ], - decorations: [ - { - start: { line: currLineOffsetFromTop, character: 0 }, - end: { line: currLineOffsetFromTop, character: 0 }, - properties: { class: "highlighted-line" }, - }, - ], + // decorations: [ + // { + // start: { line: currLineOffsetFromTop, character: 0 }, + // end: { line: currLineOffsetFromTop, character: 0 }, + // properties: { class: "highlighted-line" }, + // }, + // ], }); } @@ -194,7 +224,7 @@ export class CodeRenderer { ); console.log(highlightedCodeHtml); - const guts = this.convertShikiHtmlToSvgGut( + const { guts, lineBackgrounds } = this.convertShikiHtmlToSvgGut( highlightedCodeHtml, fontSize, fontFamily, @@ -204,7 +234,7 @@ export class CodeRenderer { const svg = ` - + ${lineBackgrounds} ${guts} `; @@ -218,7 +248,7 @@ export class CodeRenderer { fontSize: number, fontFamily: string, lineHeight: number, - ): string { + ): { guts: string; lineBackgrounds: string } { const dom = new JSDOM(shikiHtml); const document = dom.window.document; @@ -233,19 +263,38 @@ export class CodeRenderer { const el = node as HTMLElement; const style = el.getAttribute("style") || ""; const colorMatch = style.match(/color:\s*(#[0-9a-fA-F]{6})/); - const fill = colorMatch ? ` fill="${colorMatch[1]}"` : ""; + const classes = el.getAttribute("class") || ""; + let fill = colorMatch ? ` fill="${colorMatch[1]}"` : ""; + if (classes.includes("highlighted")) { + fill = ` fill="${this.editorLineHighlight}"`; + } else if (classes.includes("focused")) { + fill = ` fill="#111111"`; + } const content = el.textContent || ""; return `${escapeForSVG(content)}`; }) .join(""); - const y = (index + 1) * lineHeight; - return `${spans}`; + // const y = index * lineHeight + lineHeight / 2 + fontSize / 3; + const y = index * lineHeight + lineHeight / 2; + return `${spans}`; }); - return ` - ${svgLines.join("\n")} - `.trim(); + const lineBackgrounds = [...lines, null] + .map((line, index) => { + const classes = line?.getAttribute("class") || ""; + const bgColor = classes.includes("highlighted") + ? this.editorLineHighlight + : this.editorBackground; + const y = index * lineHeight; + return ``; + }) + .join("\n"); + + return { + guts: svgLines.join("\n"), + lineBackgrounds, + }; } getBackgroundColor(shikiHtml: string): string { From a24947b5760979343d343321bde0179b955b1dba Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 15:48:33 -0700 Subject: [PATCH 15/82] align text properly --- core/codeRenderer/CodeRenderer.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index a12557437..00f8007c1 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -232,7 +232,7 @@ export class CodeRenderer { ); const backgroundColor = this.getBackgroundColor(highlightedCodeHtml); - const svg = ` + const svg = ` ${lineBackgrounds} ${guts} @@ -267,17 +267,24 @@ export class CodeRenderer { let fill = colorMatch ? ` fill="${colorMatch[1]}"` : ""; if (classes.includes("highlighted")) { fill = ` fill="${this.editorLineHighlight}"`; - } else if (classes.includes("focused")) { - fill = ` fill="#111111"`; } const content = el.textContent || ""; return `${escapeForSVG(content)}`; }) .join(""); - // const y = index * lineHeight + lineHeight / 2 + fontSize / 3; + // Typography notes: + // Each line of code is a inside a . + // Math becomes interesting here; the y value is actually aligned to the topmost border. + // So y = 0 will have the rect be flush with the top border. + // More importantly, text will also be positioned that way. + // Since y = 0 is the axis the text will align itself to, the default settings will actually have the text sitting "on top of" the y = 0 axis, which effectively shifts them up. + // To prevent this, we want the alignment axis to be at the middle of each rect, and have the text align itself vertically to the center (skwered by the axis). + // The first step is to add lineHeight / 2 to move the axis down. + // The second step is to add 'dominant-baseline="central"' to vertically center the text. + // Note that we choose "central" over "middle". "middle" will center the text too perfectly, which is actually undesirable! const y = index * lineHeight + lineHeight / 2; - return `${spans}`; + return `${spans}`; }); const lineBackgrounds = [...lines, null] @@ -287,6 +294,10 @@ export class CodeRenderer { ? this.editorLineHighlight : this.editorBackground; const y = index * lineHeight; + // SVG notes: + // By default SVGs have anti-aliasing on. + // This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps. + // Turning it off with 'shape-rendering="crispEdges"' solves the issue. return ``; }) .join("\n"); From 48c021f51b4e0bc38c93ae0cb8a8c30af21af178 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 16:34:09 -0700 Subject: [PATCH 16/82] add an overall background --- core/codeRenderer/CodeRenderer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 00f8007c1..90cabe549 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -234,6 +234,7 @@ export class CodeRenderer { const svg = ` + ${lineBackgrounds} ${guts} From d003f45dbf18ca5e7d47396182d3cd30c183c971 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 16:34:30 -0700 Subject: [PATCH 17/82] window does not hide existing code --- extensions/vscode/src/activation/NextEditWindowManager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 1e9beb6d5..8c3238fb7 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -575,6 +575,10 @@ export class NextEditWindowManager { (position.line - editableRegionStartLine) * SVG_CONFIG.lineHeight; // + SVG_CONFIG.strokeWidth * 2; + // Set the margin-left so that it's never covering code inside the editable region. + const marginLeft = + SVG_CONFIG.getTipWidth(code) - + SVG_CONFIG.getTipWidth(code.split("\n")[currLineOffsetFromTop]); return vscode.window.createTextEditorDecorationType({ after: { contentIconPath: uri, @@ -583,7 +587,7 @@ export class NextEditWindowManager { filter: ${SVG_CONFIG.filter}; border-radius: ${SVG_CONFIG.radius}px; margin-top: ${-1 * offsetFromTop}px; - margin-left: ${SVG_CONFIG.cursorOffset * 8}px;`, + margin-left: ${marginLeft}px;`, width: `${tipWidth}px`, height: `${tipHeight}px`, }, From ac3279a3e109908fc8c1bed60ba9fde77f5fe745 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 17:00:48 -0700 Subject: [PATCH 18/82] fix gitlens displacement --- extensions/vscode/src/activation/NextEditWindowManager.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 8c3238fb7..8cfdd5452 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -573,16 +573,15 @@ export class NextEditWindowManager { const offsetFromTop = (position.line - editableRegionStartLine) * SVG_CONFIG.lineHeight; - // + SVG_CONFIG.strokeWidth * 2; // Set the margin-left so that it's never covering code inside the editable region. const marginLeft = SVG_CONFIG.getTipWidth(code) - SVG_CONFIG.getTipWidth(code.split("\n")[currLineOffsetFromTop]); return vscode.window.createTextEditorDecorationType({ - after: { + before: { contentIconPath: uri, - border: `transparent; position: absolute; z-index: 1000; + border: `transparent; position: absolute; z-index: 2147483647; box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px; filter: ${SVG_CONFIG.filter}; border-radius: ${SVG_CONFIG.radius}px; @@ -591,7 +590,7 @@ export class NextEditWindowManager { width: `${tipWidth}px`, height: `${tipHeight}px`, }, - rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed, + rangeBehavior: vscode.DecorationRangeBehavior.OpenOpen, }); } From 9503509ac70665ad1ce73ff2851acfdd00839376 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 17:01:05 -0700 Subject: [PATCH 19/82] remove console.logs --- core/codeRenderer/CodeRenderer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 90cabe549..0475f4930 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -93,7 +93,7 @@ export class CodeRenderer { this.editorForeground = th.fg; this.editorLineHighlight = th.colors!["editor.lineHighlightBackground"] ?? "#000000"; - console.log(th.colors); + // console.log(th.colors); } else { this.currentTheme = "dark-plus"; } @@ -222,7 +222,7 @@ export class CodeRenderer { language, currLineOffsetFromTop, ); - console.log(highlightedCodeHtml); + // console.log(highlightedCodeHtml); const { guts, lineBackgrounds } = this.convertShikiHtmlToSvgGut( highlightedCodeHtml, @@ -239,7 +239,7 @@ export class CodeRenderer { ${guts} `; - console.log(svg); + // console.log(svg); return Buffer.from(svg, "utf8"); } From 0c3f7b225e304dcf51103926dcc2547ad7a40733 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 17:01:16 -0700 Subject: [PATCH 20/82] calculate margins with old code --- .../src/activation/NextEditWindowManager.ts | 28 +++++++++++++------ .../src/autocomplete/completionProvider.ts | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 8cfdd5452..7d68d78cb 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -244,6 +244,7 @@ export class NextEditWindowManager { editor: vscode.TextEditor, currCursorPos: vscode.Position, editableRegionStartLine: number, + oldEditRangeSlice: string, newEditRangeSlice: string, diffLines: DiffLine[], ) { @@ -281,6 +282,7 @@ export class NextEditWindowManager { await this.renderTooltip( editor, currCursorPos, + oldEditRangeSlice, newEditRangeSlice, editableRegionStartLine, ); @@ -554,13 +556,14 @@ export class NextEditWindowManager { * @returns The decoration. */ private async createCodeRenderDecoration( - code: string, + originalCode: string, + predictedCode: string, position: vscode.Position, editableRegionStartLine: number, ): Promise { const currLineOffsetFromTop = position.line - editableRegionStartLine; const uriAndDimensions = await this.createCodeRender( - code, + predictedCode, currLineOffsetFromTop, ); if (!uriAndDimensions) { @@ -576,8 +579,15 @@ export class NextEditWindowManager { // Set the margin-left so that it's never covering code inside the editable region. const marginLeft = - SVG_CONFIG.getTipWidth(code) - - SVG_CONFIG.getTipWidth(code.split("\n")[currLineOffsetFromTop]); + SVG_CONFIG.getTipWidth(originalCode) - + SVG_CONFIG.getTipWidth(originalCode.split("\n")[currLineOffsetFromTop]); + + console.log(marginLeft); + console.log(SVG_CONFIG.getTipWidth(originalCode)); + console.log( + SVG_CONFIG.getTipWidth(originalCode.split("\n")[currLineOffsetFromTop]), + ); + console.log(originalCode.split("\n")[currLineOffsetFromTop]); return vscode.window.createTextEditorDecorationType({ before: { contentIconPath: uri, @@ -590,7 +600,7 @@ export class NextEditWindowManager { width: `${tipWidth}px`, height: `${tipHeight}px`, }, - rangeBehavior: vscode.DecorationRangeBehavior.OpenOpen, + rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed, }); } @@ -684,7 +694,8 @@ export class NextEditWindowManager { private async renderTooltip( editor: vscode.TextEditor, position: vscode.Position, - text: string, + originalCode: string, + predictedCode: string, editableRegionStartLine: number, ) { console.log("renderTooltip"); @@ -693,12 +704,13 @@ export class NextEditWindowManager { // Create a new decoration with the text. const decoration = await this.createCodeRenderDecoration( - text, + originalCode, + predictedCode, position, editableRegionStartLine, ); if (!decoration) { - console.error("Failed to create decoration for text:", text); + console.error("Failed to create decoration for text:", predictedCode); return; } diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index 3f3995878..88131a3e8 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, + oldEditRangeSlice, newEditRangeSlice, diffLines, ); From eb374fb2f6acf8c707abf465aff552847f91c8e6 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 17:02:36 -0700 Subject: [PATCH 21/82] remove console.logs --- core/codeRenderer/CodeRenderer.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 0475f4930..269354a0f 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -81,19 +81,11 @@ export class CodeRenderer { }); const th = this.highlighter.getTheme(this.currentTheme); - // const customTheme = { - // ...th, - // colors: { - // ...th.colors, - // // "editor.lineHighlightBackground": "#ffffff1a", // VS Code's highlight color - // }, - // }; this.editorBackground = th.bg; this.editorForeground = th.fg; this.editorLineHighlight = th.colors!["editor.lineHighlightBackground"] ?? "#000000"; - // console.log(th.colors); } else { this.currentTheme = "dark-plus"; } @@ -196,13 +188,6 @@ export class CodeRenderer { transformerNotationDiff(), transformerNotationFocus(), ], - // decorations: [ - // { - // start: { line: currLineOffsetFromTop, character: 0 }, - // end: { line: currLineOffsetFromTop, character: 0 }, - // properties: { class: "highlighted-line" }, - // }, - // ], }); } From 8e914b54bbe2af872657ace44786383c03a095e5 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Fri, 4 Jul 2025 17:54:25 -0700 Subject: [PATCH 22/82] Update packages/config-yaml/src/load/unroll.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- packages/config-yaml/src/load/unroll.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index a2f96dbac..7802be705 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -542,7 +542,7 @@ export async function unrollBlocks( if (!unrolledAssistant[key]) { unrolledAssistant[key] = []; } - unrolledAssistant[key]?.push(...(resolvedBlock[blockType] as any)); + unrolledAssistant[key]?.push(...((resolvedBlock[blockType] ?? []) as any)); } const configResult: ConfigResult = { From c320cabc4ac197164ddc2143ac71dd5104e1f6a1 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 19:01:11 -0700 Subject: [PATCH 23/82] only round the first and last lines --- core/codeRenderer/CodeRenderer.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 269354a0f..d4e71cc60 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -218,8 +218,15 @@ export class CodeRenderer { const backgroundColor = this.getBackgroundColor(highlightedCodeHtml); const svg = ` + - + ${lineBackgrounds} ${guts} @@ -273,18 +280,22 @@ export class CodeRenderer { return `${spans}`; }); - const lineBackgrounds = [...lines, null] + const lineBackgrounds = lines .map((line, index) => { const classes = line?.getAttribute("class") || ""; const bgColor = classes.includes("highlighted") ? this.editorLineHighlight : this.editorBackground; const y = index * lineHeight; + const isFirst = index === 0; + const isLast = index === lines.length - 1; + const topRadius = isFirst ? "10" : "0"; + const bottomRadius = isLast ? "10" : "0"; // SVG notes: // By default SVGs have anti-aliasing on. // This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps. // Turning it off with 'shape-rendering="crispEdges"' solves the issue. - return ``; + return ``; }) .join("\n"); From 6117c7057a92ece38bd327a9386df188f82df5ce Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 19:01:24 -0700 Subject: [PATCH 24/82] add continue-themed drop shadows --- .../src/activation/NextEditWindowManager.ts | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 7d68d78cb..d40447a8a 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -23,10 +23,22 @@ export interface TextApplier { } const SVG_CONFIG = { - stroke: "#999998", + // stroke: "#999998", + stroke: "#666667", strokeWidth: 1, textColor: "#999998", - filter: "drop-shadow(0 2px 2px rgba(0,0,0,0.2))", + purple: "rgba(112, 114, 209)", + blue: "rgba(107, 166, 205)", + green: "rgba(136 194 163)", + // filter: "drop-shadow(0 2px 2px rgba(0,0,0,0.2))", + // filter: "drop-shadow(0 2px 2px rgba(255,255,255,0.2))", + // filter: + // "drop-shadow(0 2px 4px rgb(112, 114, 209)) drop-shadow(0 4px 8px rgb(136, 194, 163)) drop-shadow(0 6px 12px rgb(107, 166, 205));", + // filter: + // "drop-shadow(0 3px 6px rgba(112, 114, 209, 0.4)) drop-shadow(0 3px 6px rgba(136, 194, 163, 0.4)) drop-shadow(0 3px 6px rgba(107, 166, 205, 0.4));", + filter: `drop-shadow(4px 4px 0px rgba(112, 114, 209, 0.4)) + drop-shadow(8px 8px 0px rgba(107, 166, 205, 0.3)) + drop-shadow(12px 12px 0px rgba(136, 194, 163, 0.2));`, radius: 3, leftMargin: 40, defaultText: "", @@ -591,12 +603,10 @@ export class NextEditWindowManager { return vscode.window.createTextEditorDecorationType({ before: { contentIconPath: uri, - border: `transparent; position: absolute; z-index: 2147483647; - box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px; - filter: ${SVG_CONFIG.filter}; - border-radius: ${SVG_CONFIG.radius}px; - margin-top: ${-1 * offsetFromTop}px; - margin-left: ${marginLeft}px;`, + border: `transparent; position: absolute; z-index: 2147483647; + filter: ${SVG_CONFIG.filter}; + margin-top: ${-1 * offsetFromTop}px; + margin-left: ${marginLeft}px;`, width: `${tipWidth}px`, height: `${tipHeight}px`, }, From 0443be225af6eca49079a7901848013edb9b121d Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 19:01:38 -0700 Subject: [PATCH 25/82] add shiki deps --- core/package-lock.json | 89 ++++++++++++++++++++++++++---------------- core/package.json | 2 + 2 files changed, 58 insertions(+), 33 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index a5b9cea03..dc7ec2d63 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -82,6 +82,8 @@ "@babel/preset-env": "^7.24.7", "@biomejs/biome": "1.6.4", "@google/generative-ai": "^0.11.4", + "@shikijs/colorized-brackets": "^3.7.0", + "@shikijs/transformers": "^3.7.0", "@types/diff": "^7.0.1", "@types/follow-redirects": "^1.14.4", "@types/jest": "^29.5.12", @@ -4752,66 +4754,87 @@ "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", "peer": true }, - "node_modules/@shikijs/core": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.6.0.tgz", - "integrity": "sha512-9By7Xb3olEX0o6UeJyPLI1PE1scC4d3wcVepvtv2xbuN9/IThYN4Wcwh24rcFeASzPam11MCq8yQpwwzCgSBRw==", + "node_modules/@shikijs/colorized-brackets": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/colorized-brackets/-/colorized-brackets-3.7.0.tgz", + "integrity": "sha512-4tGMLMTqP7cw3AddjIjz7AlpPFuXpm2aDO25+uUHhGOVJvyDkm3a4cVb5W66QiBZFYsOyU6mx+lnsSimNTLsWQ==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.6.0", + "shiki": "3.7.0" + } + }, + "node_modules/@shikijs/core": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.7.0.tgz", + "integrity": "sha512-yilc0S9HvTPyahHpcum8eonYrQtmGTU0lbtwxhA6jHv4Bm1cAdlPFRCJX4AHebkCm75aKTjjRAW+DezqD1b/cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.7.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" } }, "node_modules/@shikijs/engine-javascript": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.6.0.tgz", - "integrity": "sha512-7YnLhZG/TU05IHMG14QaLvTW/9WiK8SEYafceccHUSXs2Qr5vJibUwsDfXDLmRi0zHdzsxrGKpSX6hnqe0k8nA==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.7.0.tgz", + "integrity": "sha512-0t17s03Cbv+ZcUvv+y33GtX75WBLQELgNdVghnsdhTgU3hVcWcMsoP6Lb0nDTl95ZJfbP1mVMO0p3byVh3uuzA==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.6.0", + "@shikijs/types": "3.7.0", "@shikijs/vscode-textmate": "^10.0.2", "oniguruma-to-es": "^4.3.3" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.6.0.tgz", - "integrity": "sha512-nmOhIZ9yT3Grd+2plmW/d8+vZ2pcQmo/UnVwXMUXAKTXdi+LK0S08Ancrz5tQQPkxvjBalpMW2aKvwXfelauvA==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.7.0.tgz", + "integrity": "sha512-5BxcD6LjVWsGu4xyaBC5bu8LdNgPCVBnAkWTtOCs/CZxcB22L8rcoWfv7Hh/3WooVjBZmFtyxhgvkQFedPGnFw==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.6.0", + "@shikijs/types": "3.7.0", "@shikijs/vscode-textmate": "^10.0.2" } }, "node_modules/@shikijs/langs": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.6.0.tgz", - "integrity": "sha512-IdZkQJaLBu1LCYCwkr30hNuSDfllOT8RWYVZK1tD2J03DkiagYKRxj/pDSl8Didml3xxuyzUjgtioInwEQM/TA==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.7.0.tgz", + "integrity": "sha512-1zYtdfXLr9xDKLTGy5kb7O0zDQsxXiIsw1iIBcNOO8Yi5/Y1qDbJ+0VsFoqTlzdmneO8Ij35g7QKF8kcLyznCQ==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.6.0" + "@shikijs/types": "3.7.0" } }, "node_modules/@shikijs/themes": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.6.0.tgz", - "integrity": "sha512-Fq2j4nWr1DF4drvmhqKq8x5vVQ27VncF8XZMBuHuQMZvUSS3NBgpqfwz/FoGe36+W6PvniZ1yDlg2d4kmYDU6w==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.7.0.tgz", + "integrity": "sha512-VJx8497iZPy5zLiiCTSIaOChIcKQwR0FebwE9S3rcN0+J/GTWwQ1v/bqhTbpbY3zybPKeO8wdammqkpXc4NVjQ==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.6.0" + "@shikijs/types": "3.7.0" + } + }, + "node_modules/@shikijs/transformers": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-3.7.0.tgz", + "integrity": "sha512-VplaqIMRNsNOorCXJHkbF5S0pT6xm8Z/s7w7OPZLohf8tR93XH0krvUafpNy/ozEylrWuShJF0+ftEB+wFRwGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/core": "3.7.0", + "@shikijs/types": "3.7.0" } }, "node_modules/@shikijs/types": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.6.0.tgz", - "integrity": "sha512-cLWFiToxYu0aAzJqhXTQsFiJRTFDAGl93IrMSBNaGSzs7ixkLfdG6pH11HipuWFGW5vyx4X47W8HDQ7eSrmBUg==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.7.0.tgz", + "integrity": "sha512-MGaLeaRlSWpnP0XSAum3kP3a8vtcTsITqoEPYdt3lQG3YCdQH4DnEhodkYcNMcU0uW0RffhoD1O3e0vG5eSBBg==", "dev": true, "license": "MIT", "dependencies": { @@ -16249,18 +16272,18 @@ } }, "node_modules/shiki": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.6.0.tgz", - "integrity": "sha512-tKn/Y0MGBTffQoklaATXmTqDU02zx8NYBGQ+F6gy87/YjKbizcLd+Cybh/0ZtOBX9r1NEnAy/GTRDKtOsc1L9w==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.7.0.tgz", + "integrity": "sha512-ZcI4UT9n6N2pDuM2n3Jbk0sR4Swzq43nLPgS/4h0E3B/NrFn2HKElrDtceSf8Zx/OWYOo7G1SAtBLypCp+YXqg==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/core": "3.6.0", - "@shikijs/engine-javascript": "3.6.0", - "@shikijs/engine-oniguruma": "3.6.0", - "@shikijs/langs": "3.6.0", - "@shikijs/themes": "3.6.0", - "@shikijs/types": "3.6.0", + "@shikijs/core": "3.7.0", + "@shikijs/engine-javascript": "3.7.0", + "@shikijs/engine-oniguruma": "3.7.0", + "@shikijs/langs": "3.7.0", + "@shikijs/themes": "3.7.0", + "@shikijs/types": "3.7.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } diff --git a/core/package.json b/core/package.json index fd1be11e0..9c9af5851 100644 --- a/core/package.json +++ b/core/package.json @@ -18,6 +18,8 @@ "@babel/preset-env": "^7.24.7", "@biomejs/biome": "1.6.4", "@google/generative-ai": "^0.11.4", + "@shikijs/colorized-brackets": "^3.7.0", + "@shikijs/transformers": "^3.7.0", "@types/diff": "^7.0.1", "@types/follow-redirects": "^1.14.4", "@types/jest": "^29.5.12", From f485442d467e9d2a96466978d3d7c790f1349928 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 19:46:38 -0700 Subject: [PATCH 26/82] add bezier curves --- core/codeRenderer/CodeRenderer.ts | 24 +++++++++++++++++-- .../src/activation/NextEditWindowManager.ts | 8 +++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index d4e71cc60..9c8e7bf61 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -214,6 +214,7 @@ export class CodeRenderer { fontSize, fontFamily, lineHeight, + dimensions, ); const backgroundColor = this.getBackgroundColor(highlightedCodeHtml); @@ -231,7 +232,7 @@ export class CodeRenderer { ${guts} `; - // console.log(svg); + console.log(svg); return Buffer.from(svg, "utf8"); } @@ -241,6 +242,7 @@ export class CodeRenderer { fontSize: number, fontFamily: string, lineHeight: number, + dimensions: Dimensions, ): { guts: string; lineBackgrounds: string } { const dom = new JSDOM(shikiHtml); const document = dom.window.document; @@ -295,7 +297,25 @@ export class CodeRenderer { // By default SVGs have anti-aliasing on. // This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps. // Turning it off with 'shape-rendering="crispEdges"' solves the issue. - return ``; + return isFirst + ? `` + : isLast + ? `` + : ``; }) .join("\n"); diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index d40447a8a..f35ede049 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -36,9 +36,13 @@ const SVG_CONFIG = { // "drop-shadow(0 2px 4px rgb(112, 114, 209)) drop-shadow(0 4px 8px rgb(136, 194, 163)) drop-shadow(0 6px 12px rgb(107, 166, 205));", // filter: // "drop-shadow(0 3px 6px rgba(112, 114, 209, 0.4)) drop-shadow(0 3px 6px rgba(136, 194, 163, 0.4)) drop-shadow(0 3px 6px rgba(107, 166, 205, 0.4));", + // filter: `drop-shadow(4px 4px 0px rgba(112, 114, 209, 0.4)) + // drop-shadow(8px 8px 0px rgba(107, 166, 205, 0.3)) + // drop-shadow(12px 12px 0px rgba(136, 194, 163, 0.2));`, filter: `drop-shadow(4px 4px 0px rgba(112, 114, 209, 0.4)) - drop-shadow(8px 8px 0px rgba(107, 166, 205, 0.3)) - drop-shadow(12px 12px 0px rgba(136, 194, 163, 0.2));`, + drop-shadow(-2px 4px 0px rgba(107, 166, 205, 0.3)) + drop-shadow(4px -2px 0px rgba(136, 194, 163, 0.2)) + drop-shadow(-2px -2px 0px rgba(112, 114, 209, 0.2));`, radius: 3, leftMargin: 40, defaultText: "", From ee0a9a4320adaa39bc2ab9dfc137b15dc1c26770 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 4 Jul 2025 19:48:10 -0700 Subject: [PATCH 27/82] use radius instead of 10 --- core/codeRenderer/CodeRenderer.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 9c8e7bf61..576088ca2 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -291,31 +291,30 @@ export class CodeRenderer { const y = index * lineHeight; const isFirst = index === 0; const isLast = index === lines.length - 1; - const topRadius = isFirst ? "10" : "0"; - const bottomRadius = isLast ? "10" : "0"; + const radius = 10; // SVG notes: // By default SVGs have anti-aliasing on. // This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps. // Turning it off with 'shape-rendering="crispEdges"' solves the issue. return isFirst ? `` : isLast ? `` - : ``; + : ``; }) .join("\n"); From 15a61ba8b84e5e6d188736f0c0d43ad6a4383bb4 Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Fri, 4 Jul 2025 21:24:39 -0700 Subject: [PATCH 28/82] feat: :sparkles: Enable amazon nova pro models --- core/edit/streamDiffLines.ts | 6 +++++- core/llm/autodetect.ts | 5 +++++ core/llm/toolSupport.ts | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/edit/streamDiffLines.ts b/core/edit/streamDiffLines.ts index 7cf1af2f7..c2cd32b0e 100644 --- a/core/edit/streamDiffLines.ts +++ b/core/edit/streamDiffLines.ts @@ -55,7 +55,11 @@ export async function* addIndentation( } function modelIsInept(model: string): boolean { - return !(model.includes("gpt") || model.includes("claude")); + return !( + model.includes("gpt") || + model.includes("claude") || + model.includes("nova") + ); } export async function* streamDiffLines({ diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index a13ffe8dc..9a3d37af9 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -237,6 +237,11 @@ function autodetectTemplateType(model: string): TemplateType | undefined { return "none"; } + // Nova Pro requests always sent through Converse API, so formatting not necessary + if (lower.includes("nova")) { + return "none"; + } + if (lower.includes("codestral")) { return "none"; } diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index b578569cb..9c3db3e74 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -96,6 +96,10 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = "claude-3.7-sonnet", "claude-sonnet-4", "claude-opus-4", + "nova-lite", + "nova-pro", + "nova-micro", + "nova-premier", ].some((part) => model.toLowerCase().includes(part)) ) { return true; From fd550f4087b95f3ff6ac501589f6e3e336f4367c Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Fri, 4 Jul 2025 21:35:44 -0700 Subject: [PATCH 29/82] added tests --- core/llm/autodetect.vitest.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/llm/autodetect.vitest.ts b/core/llm/autodetect.vitest.ts index c5cbf08fe..e9d7180ae 100644 --- a/core/llm/autodetect.vitest.ts +++ b/core/llm/autodetect.vitest.ts @@ -106,6 +106,19 @@ test("autodetectTemplateType returns 'none' for Codestral models", () => { expect(autodetectTemplateType("codestral-22b")).toBe("none"); }); +test("autodetectTemplateType returns 'none' for Nova models", () => { + expect(autodetectTemplateType("nova")).toBe("none"); + expect(autodetectTemplateType("Nova")).toBe("none"); + expect(autodetectTemplateType("nova-pro")).toBe("none"); + expect(autodetectTemplateType("nova-lite")).toBe("none"); + expect(autodetectTemplateType("nova-micro")).toBe("none"); + expect(autodetectTemplateType("nova-premier")).toBe("none"); + expect(autodetectTemplateType("amazon-nova-pro")).toBe("none"); + expect(autodetectTemplateType("amazon-nova-lite")).toBe("none"); + expect(autodetectTemplateType("amazon-nova-micro")).toBe("none"); + expect(autodetectTemplateType("amazon-nova-premier")).toBe("none"); +}); + test("autodetectTemplateType returns 'alpaca' for Alpaca and Wizard models", () => { expect(autodetectTemplateType("alpaca")).toBe("alpaca"); expect(autodetectTemplateType("Alpaca")).toBe("alpaca"); From 2df6b1ee7dcd714c35222df5bf4cfb88cab4b3c6 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:10:46 -0700 Subject: [PATCH 30/82] encourage multiple find/replace blocks in the same tool call --- core/tools/definitions/searchAndReplaceInFile.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index b654f9c32..03b9defaf 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -56,7 +56,10 @@ Critical rules: * Include just the changing lines, and a few surrounding lines if needed for uniqueness. * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. -4. Special operations: +4. Avoid extra tool calls: + * When making multiple edits to the same file ALWAYS try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls + * If you need to make follow up edits, it is okay to perform additional tool calls +5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From 5b6b1d5609e217bd2aa95b5258f1afe1500a57a3 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:21:57 -0700 Subject: [PATCH 31/82] adjust instructions --- core/tools/definitions/searchAndReplaceInFile.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index 03b9defaf..46d92bfb2 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -57,8 +57,8 @@ Critical rules: * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. 4. Avoid extra tool calls: - * When making multiple edits to the same file ALWAYS try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls - * If you need to make follow up edits, it is okay to perform additional tool calls + * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls + * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls 5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From f16cd61d231411707ed0b1df2f419e5a082a9140 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:30:18 -0700 Subject: [PATCH 32/82] more adjustments --- core/tools/definitions/searchAndReplaceInFile.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index 46d92bfb2..90fe0a0e4 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -59,6 +59,7 @@ Critical rules: 4. Avoid extra tool calls: * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls + * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do 5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From 5f8b6eff2c5167770484e212856fcb651cb73c01 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:31:35 -0700 Subject: [PATCH 33/82] remove unused prop --- gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 1 - gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 27b093799..eee3a9bb3 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -6,7 +6,6 @@ type EditToolCallProps = { changes: string; historyIndex: number; toolCallId?: string; - expandCodeblocks?: boolean; }; export function EditFile(props: EditToolCallProps) { diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index c20f8f7d2..37c1911dc 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -36,7 +36,6 @@ function FunctionSpecificToolCallDiv({ case BuiltInToolNames.SearchAndReplaceInFile: return ( Date: Sat, 5 Jul 2025 10:36:40 -0700 Subject: [PATCH 34/82] more prompt adjustment --- core/tools/definitions/searchAndReplaceInFile.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index 90fe0a0e4..dc64e49fc 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -56,8 +56,8 @@ Critical rules: * Include just the changing lines, and a few surrounding lines if needed for uniqueness. * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. -4. Avoid extra tool calls: - * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls +4. Splitting up tool calls: + * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple separate tool calls * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do 5. Special operations: From c105ea1d1099911691bd69f1ee923a51333dfa2c Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:37:40 -0700 Subject: [PATCH 35/82] bump package.json --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 7d5c2a12a..5cff792dc 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.57", + "version": "1.1.58", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From e7d17e78a98fd6a10a91791d448e384d3a206cf9 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:42:34 -0700 Subject: [PATCH 36/82] fix tool use for claude-sonnet-4 --- core/llm/toolSupport.ts | 3 +++ extensions/vscode/package-lock.json | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index b578569cb..43b7e6dae 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -19,6 +19,7 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = "claude-3-7", "claude-3.7", "claude-sonnet-4", + "claude-4-sonnet", "gpt-4", "o3", "gemini", @@ -33,6 +34,7 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = "claude-3-7", "claude-3.7", "claude-sonnet-4", + "claude-4-sonnet", "claude-opus-4", ].some((part) => model.toLowerCase().startsWith(part)) ) { @@ -95,6 +97,7 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = "claude-3-7-sonnet", "claude-3.7-sonnet", "claude-sonnet-4", + "claude-4-sonnet", "claude-opus-4", ].some((part) => model.toLowerCase().includes(part)) ) { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 0f87e013c..d62caf298 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.55", + "version": "1.1.58", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.55", + "version": "1.1.58", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", From d868b901326a39f40f7e0f117c4820ec31fa0d8d Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:56:29 -0700 Subject: [PATCH 37/82] adjust prompt --- core/tools/definitions/searchAndReplaceInFile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index dc64e49fc..f4c601009 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -59,7 +59,7 @@ Critical rules: 4. Splitting up tool calls: * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple separate tool calls * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls - * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do + * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do. For example, instead of [explanation, tool call, tool call] you should do [explanation, tool call, explanation, tool call] 5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From c11b17042e3be03554d700e978c8261eb79341e0 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 11:06:58 -0700 Subject: [PATCH 38/82] don't show extra text during find / replace tool call --- gui/src/pages/gui/ToolCallDiv/index.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gui/src/pages/gui/ToolCallDiv/index.tsx b/gui/src/pages/gui/ToolCallDiv/index.tsx index f573a45a0..158b653c3 100644 --- a/gui/src/pages/gui/ToolCallDiv/index.tsx +++ b/gui/src/pages/gui/ToolCallDiv/index.tsx @@ -85,6 +85,22 @@ export function ToolCallDiv(props: ToolCallDivProps) { ); } + // Trying this out while it's an experimental feature + // Obviously missing the truncate and args buttons + // All the info from args is displayed here + // But we'd need a nicer place to put the truncate button and the X icon when tool call fails + if ( + props.toolCall.function?.name === BuiltInToolNames.SearchAndReplaceInFile + ) { + return ( + + ); + } + return ( Date: Sat, 5 Jul 2025 11:17:21 -0700 Subject: [PATCH 39/82] optimize find / replace / edit tool call UI so it shows up earlier --- .../StyledMarkdownPreview/StepContainerPreToolbar/index.tsx | 1 - gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx index 1d252dbdb..03aa1c4f5 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx @@ -219,7 +219,6 @@ export function StepContainerPreToolbar({ if (isGeneratingCodeBlock) { return ( - {!isExpanded ? `${numLines} line${plural}` : "Generating"}{" "}
diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index eee3a9bb3..dae07c549 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -9,11 +9,11 @@ type EditToolCallProps = { }; export function EditFile(props: EditToolCallProps) { - if (!props.relativeFilePath || !props.changes) { + if (!props.relativeFilePath) { return null; } - const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath)} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; return ( Date: Sat, 5 Jul 2025 11:27:05 -0700 Subject: [PATCH 40/82] autoscroll to the first diff after apply --- .../vscode/src/diff/vertical/handler.ts | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/diff/vertical/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts index 68c3436e8..339f9e84b 100644 --- a/extensions/vscode/src/diff/vertical/handler.ts +++ b/extensions/vscode/src/diff/vertical/handler.ts @@ -174,9 +174,12 @@ export class VerticalDiffHandler implements vscode.Disposable { // Clear deletion buffer await this.insertDeletionBuffer(); - await this.reapplyWithMyersDiff(diffLines); + const myersDiffs = await this.reapplyWithMyersDiff(diffLines); - const range = new vscode.Range(this.startLine, 0, this.startLine, 0); + // Scroll to the first diff + const scrollToLine = + this.getFirstChangedLine(myersDiffs) ?? this.startLine; + const range = new vscode.Range(scrollToLine, 0, scrollToLine, 0); this.editor.revealRange(range, vscode.TextEditorRevealType.Default); this.options.onStatusUpdate( @@ -370,6 +373,8 @@ export class VerticalDiffHandler implements vscode.Disposable { this.editorToVerticalDiffCodeLens.set(this.fileUri, codeLensBlocks); this.refreshCodeLens(); + + return myersDiffs; } private async insertDeletionBuffer() { @@ -550,4 +555,17 @@ export class VerticalDiffHandler implements vscode.Disposable { this.refreshCodeLens(); } + + /** + * Gets the first line number that was changed in a diff + */ + private getFirstChangedLine(diff: DiffLine[]): number | null { + for (let i = 0; i < diff.length; i++) { + const item = diff[i]; + if (item.type === "old" || item.type === "new") { + return this.startLine + i; + } + } + return null; + } } From a41c1a001731812966f8a63a788f4b65ac63c5c6 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Thu, 12 Jun 2025 05:29:18 -0400 Subject: [PATCH 41/82] fix: enable parsing of qwen3 agent mode chat messages --- gui/src/redux/slices/sessionSlice.test.ts | 418 ++++++++++++++++++++++ gui/src/redux/slices/sessionSlice.ts | 169 ++++++--- 2 files changed, 542 insertions(+), 45 deletions(-) create mode 100644 gui/src/redux/slices/sessionSlice.test.ts diff --git a/gui/src/redux/slices/sessionSlice.test.ts b/gui/src/redux/slices/sessionSlice.test.ts new file mode 100644 index 000000000..f332d74cc --- /dev/null +++ b/gui/src/redux/slices/sessionSlice.test.ts @@ -0,0 +1,418 @@ +import { ChatMessage } from "core"; +import { renderChatMessage } from "core/util/messageContent"; +import { v4 as uuidv4 } from "uuid"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { addToolCallDeltaToState } from "../../util/toolCallState"; +import { ChatHistoryItemWithMessageId, sessionSlice } from "./sessionSlice"; + +// Mock dependencies +vi.mock("uuid"); +vi.mock("core/util/messageContent"); +vi.mock("../../util/toolCallState"); + +const mockUuidv4 = vi.mocked(uuidv4); +const mockRenderChatMessage = vi.mocked(renderChatMessage); +const mockAddToolCallDeltaToState = vi.mocked(addToolCallDeltaToState); + +describe("sessionSlice streamUpdate", () => { + beforeEach(() => { + // Reset mocks before each test + vi.clearAllMocks(); + + // Mock uuidv4 to return predictable values + let callCount = 0; + mockUuidv4.mockImplementation(() => `mock-uuid-${++callCount}`); + + // Mock renderChatMessage to return content as is + mockRenderChatMessage.mockImplementation((message: ChatMessage) => { + if (typeof message.content === "string") { + return message.content; + } + return ""; + }); + + // Mock addToolCallDeltaToState + mockAddToolCallDeltaToState.mockImplementation((delta, state) => { + return { + status: "generating" as const, + toolCall: { + id: delta.id || "mock-tool-id", + type: "function" as const, + function: { + name: delta.function?.name || "mock-function", + arguments: delta.function?.arguments || "{}", + }, + }, + toolCallId: delta.id || "mock-tool-id", + parsedArgs: {}, + }; + }); + }); + + const createInitialState = () => ({ + lastSessionId: undefined, + allSessionMetadata: [], + history: [ + { + message: { + role: "user" as const, + content: "This is a test.", + id: "initial-user-message", + }, + contextItems: [], + }, + ] as ChatHistoryItemWithMessageId[], + isStreaming: false, + title: "Test Session", + id: "test-session-id", + streamAborter: new AbortController(), + symbols: {}, + mode: "chat" as const, + isInEdit: false, + codeBlockApplyStates: { + states: [], + curIndex: 0, + }, + newestToolbarPreviewForInput: {}, + isSessionMetadataLoading: false, + }); + + describe("Basic Chat Message", () => { + it("should append assistant message to history", () => { + const initialState = createInitialState(); + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "Here is a response to your message without thinking.", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe( + "Here is a response to your message without thinking.", + ); + expect(newState.history[1].message.id).toBe("mock-uuid-1"); + expect(newState.history[1].contextItems).toEqual([]); + }); + }); + + describe("Chat Message With Thinking", () => { + it("should split thinking and assistant content correctly", () => { + const initialState = createInitialState(); + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: + "I should send the user a response. Here is a response to your message with thinking.", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + + // Check reasoning + expect(newState.history[0].reasoning?.text).toBe( + "I should send the user a response.", + ); + + // Check assistant message + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe( + "Here is a response to your message with thinking.", + ); + expect(newState.history[1].message.id).toBe("mock-uuid-1"); + }); + }); + + describe("Tool Call With Response", () => { + it("should handle tool call followed by tool response and assistant message", () => { + const initialState = createInitialState(); + const toolCallAction = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "I should use a tool call.", + toolCalls: [ + { + id: "1234", + type: "function" as const, + function: { + name: "builtin_ls", + arguments: '{"dirPath":".","recursive":false}', + }, + }, + ], + }, + ], + }; + + let newState = sessionSlice.reducer(initialState, toolCallAction); + expect(newState.history).toHaveLength(2); + + // Check reasoning + expect(newState.history[0].reasoning?.text).toBe( + "I should use a tool call.", + ); + + // Check generating message + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe(""); + expect(newState.history[1].toolCallState?.status).toBe("generating"); + expect(newState.history[1].toolCallState?.toolCallId).toBe("1234"); + + const toolResponseAction = { + type: "session/streamUpdate", + payload: [ + { + role: "tool" as const, + toolCallId: "1234", + content: "foo.txt\nbar.txt\nexample.php", + }, + { + role: "assistant" as const, + content: "I see, the tool found 3 files.", + }, + ], + }; + newState = sessionSlice.reducer(newState, toolResponseAction); + expect(newState.history).toHaveLength(4); + + // Check tool message + expect(newState.history[2].message.role).toBe("tool"); + expect(newState.history[2].message.content).toBe( + "foo.txt\nbar.txt\nexample.php", + ); + expect((newState.history[2].message as any).toolCallId).toBe("1234"); + + // Check final assistant message + expect(newState.history[3].message.role).toBe("assistant"); + expect(newState.history[3].message.content).toBe( + "I see, the tool found 3 files.", + ); + }); + }); + + describe("Tool Call With Streaming Response", () => { + it("should handle streaming assistant response after tool call", () => { + const initialState = createInitialState(); + const toolCallAction = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "I should use a tool call.", + toolCalls: [ + { + id: "1234", + type: "function" as const, + function: { + name: "builtin_ls", + arguments: '{"dirPath":".","recursive":false}', + }, + }, + ], + }, + ], + }; + + let newState = sessionSlice.reducer(initialState, toolCallAction); + expect(newState.history).toHaveLength(2); + + // Check reasoning + expect(newState.history[0].reasoning?.text).toBe( + "I should use a tool call.", + ); + + // Check generating message + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe(""); + expect(newState.history[1].toolCallState?.status).toBe("generating"); + expect(newState.history[1].toolCallState?.toolCallId).toBe("1234"); + + const toolResponseAction = { + type: "session/streamUpdate", + payload: [ + { + role: "tool" as const, + toolCallId: "1234", + content: "foo.txt\nbar.txt\nexample.php", + }, + { + role: "assistant" as const, + content: "", + }, + { + role: "assistant" as const, + content: "Good, ", + }, + { + role: "assistant" as const, + content: "I received a list", + }, + { + role: "assistant" as const, + content: " of files.", + }, + { + role: "assistant" as const, + content: "", + }, + { + role: "assistant" as const, + content: "\n", + }, + { + role: "assistant" as const, + content: "I see, ", + }, + { + role: "assistant" as const, + content: "the tool ", + }, + { + role: "assistant" as const, + content: "found 3 ", + }, + { + role: "assistant" as const, + content: "files.", + }, + ], + }; + + newState = sessionSlice.reducer(newState, toolResponseAction); + + expect(newState.history).toHaveLength(4); + + // Check tool message + expect(newState.history[2].message.role).toBe("tool"); + expect(newState.history[2].message.content).toBe( + "foo.txt\nbar.txt\nexample.php", + ); + + // Check response message + expect(newState.history[3].message.role).toBe("assistant"); + expect(newState.history[3].message.content).toBe( + "I see, the tool found 3 files.", + ); + expect(newState.history[3].reasoning?.text).toBe( + "Good, I received a list of files.", + ); + expect(newState.history[3].reasoning?.active).toBe(false); + }); + }); + + describe("Edge Cases", () => { + it("should handle empty history gracefully", () => { + const initialState = createInitialState(); + initialState.history = []; + + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "Hello", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + // Should not crash and history should remain empty + expect(newState.history).toHaveLength(0); + }); + + it("should handle redacted thinking messages", () => { + const initialState = createInitialState(); + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "thinking" as const, + content: "This should be hidden", + redactedThinking: true, + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect(newState.history[1].message.role).toBe("thinking"); + expect(newState.history[1].message.content).toBe( + "internal reasoning is hidden due to safety reasons", + ); + expect((newState.history[1].message as any).redactedThinking).toBe(true); + }); + + it("should handle signature updates for thinking messages", () => { + const initialState = createInitialState(); + // First add a thinking message + initialState.history.push({ + message: { + role: "thinking", + content: "Some thinking", + id: "thinking-message", + }, + contextItems: [], + }); + + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "thinking" as const, + signature: "test-signature", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect((newState.history[1].message as any).signature).toBe( + "test-signature", + ); + }); + + it("should accumulate content for same role messages", () => { + const initialState = createInitialState(); + // Add an assistant message first + initialState.history.push({ + message: { + role: "assistant", + content: "Hello ", + id: "assistant-message", + }, + contextItems: [], + }); + + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "world!", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect(newState.history[1].message.content).toBe("Hello world!"); + }); + }); +}); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 45d68b456..8d1ef3e3e 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -8,6 +8,7 @@ import { import { JSONContent } from "@tiptap/react"; import { ApplyState, + AssistantChatMessage, ChatHistoryItem, ChatMessage, ContextItem, @@ -18,6 +19,7 @@ import { RuleWithSource, Session, SessionMetadata, + ThinkingChatMessage, Tool, } from "core"; import { NEW_SESSION_TITLE } from "core/util/constants"; @@ -330,12 +332,10 @@ export const sessionSlice = createSlice({ streamUpdate: (state, action: PayloadAction) => { if (state.history.length) { for (const message of action.payload) { - const lastItem = state.history[state.history.length - 1]; - const lastMessage = lastItem.message; + let lastItem = state.history[state.history.length - 1]; + let lastMessage = lastItem.message; if (message.role === "thinking" && message.redactedThinking) { - console.log("add redacted_thinking blocks"); - state.history.push({ message: { role: "thinking", @@ -348,6 +348,74 @@ export const sessionSlice = createSlice({ continue; } + const messageContent = message.content + ? renderChatMessage(message) + : ""; + + // OpenAI-compatible models in agent mode sometimes send + // all of their data in one message, so we handle that case early. + if (messageContent) { + const thinkMatches = messageContent.match( + /([\s\S]*)<\/think>([\s\S]*)/, + ); + if (thinkMatches) { + // The order that they seem to consistently use is: + // + // Thinking text + // Text to show to the user + + lastItem.reasoning = { + text: thinkMatches[1].trim(), + startAt: Date.now(), + endAt: Date.now(), + active: false, + }; + + // This is the chat message that we should show to the user. + // We always need to push this even if it is empty, + // because we cannot attach tool calls to a Thinking message. + // That would break `messageHasToolCallId`. + state.history.push({ + message: { + role: "assistant", + content: thinkMatches[2].trim(), + id: uuidv4(), + }, + contextItems: [], + }); + lastItem = state.history[state.history.length - 1]; + lastMessage = lastItem.message; + + if ( + (message.role === "assistant" || message.role === "thinking") && + message.toolCalls?.[0] + ) { + // Only support one tool call for now. + // There are further changes required throughout the system + // to support multiple tool calls in a single message from + // OpenAI-compatible providers. + const toolCallDelta = message.toolCalls[0]; + const newToolCallState = addToolCallDeltaToState( + toolCallDelta, + lastItem.toolCallState, + ); + lastItem.toolCallState = newToolCallState; + // We know this is one of these two types because we just added it + const curMessage = lastMessage as + | AssistantChatMessage + | ThinkingChatMessage; + if (curMessage.toolCalls) { + curMessage.toolCalls.push(newToolCallState.toolCall); + } else { + curMessage.toolCalls = [newToolCallState.toolCall]; + } + } + + return; + } + } + + // The remainder of this function handles streaming messages if ( lastMessage.role !== message.role || // This is for when a tool call comes immediately before/after tool call @@ -363,7 +431,7 @@ export const sessionSlice = createSlice({ const historyItem: ChatHistoryItemWithMessageId = { message: { ...message, - content: renderChatMessage(message), + content: "", id: uuidv4(), }, contextItems: [], @@ -376,51 +444,62 @@ export const sessionSlice = createSlice({ ); } state.history.push(historyItem); - } else { - // Add to the existing message - if (message.content) { - const messageContent = renderChatMessage(message); - if (messageContent.includes("")) { - lastItem.reasoning = { - startAt: Date.now(), - active: true, - text: messageContent.replace("", "").trim(), - }; - } else if ( - lastItem.reasoning?.active && - messageContent.includes("") + lastItem = state.history[state.history.length - 1]; + lastMessage = lastItem.message; + } + + // Add to the existing message + if (messageContent) { + if (messageContent.includes("")) { + lastItem.reasoning = { + startAt: Date.now(), + active: true, + text: messageContent.replace("", "").trim(), + }; + } else if ( + lastItem.reasoning?.active && + messageContent.includes("") + ) { + const [reasoningEnd, answerStart] = + messageContent.split(""); + lastItem.reasoning.text += reasoningEnd.trimEnd(); + lastItem.reasoning.active = false; + lastItem.reasoning.endAt = Date.now(); + lastMessage.content += answerStart.trimStart(); + } else if (lastItem.reasoning?.active) { + if ( + lastItem.reasoning.text.length > 0 || + messageContent.trim().length > 0 ) { - const [reasoningEnd, answerStart] = - messageContent.split(""); - lastItem.reasoning.text += reasoningEnd.trimEnd(); - lastItem.reasoning.active = false; - lastItem.reasoning.endAt = Date.now(); - lastMessage.content += answerStart.trimStart(); - } else if (lastItem.reasoning?.active) { lastItem.reasoning.text += messageContent; - } else { - // Note this only works because new message above - // was already rendered from parts to string + } + } else { + // Note this only works because new message above + // was already rendered from parts to string + if ( + lastMessage.content.length > 0 || + messageContent.trim().length > 0 + ) { lastMessage.content += messageContent; } - } else if (message.role === "thinking" && message.signature) { - if (lastMessage.role === "thinking") { - lastMessage.signature = message.signature; - } - } else if ( - message.role === "assistant" && - message.toolCalls?.[0] && - lastMessage.role === "assistant" - ) { - // Intentionally only supporting one tool call for now. - const toolCallDelta = message.toolCalls[0]; - const newToolCallState = addToolCallDeltaToState( - toolCallDelta, - lastItem.toolCallState, - ); - lastItem.toolCallState = newToolCallState; - lastMessage.toolCalls = [newToolCallState.toolCall]; } + } else if (message.role === "thinking" && message.signature) { + if (lastMessage.role === "thinking") { + lastMessage.signature = message.signature; + } + } else if ( + message.role === "assistant" && + message.toolCalls?.[0] && + lastMessage.role === "assistant" + ) { + // Intentionally only supporting one tool call for now. + const toolCallDelta = message.toolCalls[0]; + const newToolCallState = addToolCallDeltaToState( + toolCallDelta, + lastItem.toolCallState, + ); + lastItem.toolCallState = newToolCallState; + lastMessage.toolCalls = [newToolCallState.toolCall]; } } } From 7abc031c9c8f98821b5c0dc58c179fa5f50e871d Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sat, 5 Jul 2025 22:32:50 -0700 Subject: [PATCH 42/82] allow interruptions --- gui/src/pages/gui/Chat.tsx | 18 +++++++++--------- gui/src/pages/gui/ToolCallDiv/ToolCall.tsx | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 700e5352e..09a3884b7 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -33,6 +33,7 @@ import { selectCurrentToolCallApplyState, } from "../../redux/selectors/selectCurrentToolCall"; import { + cancelToolCall, newSession, updateToolCallOutput, } from "../../redux/slices/sessionSlice"; @@ -108,7 +109,6 @@ export function Chat() { (state) => state.config.config.ui?.showChatScrollbar, ); const codeToEdit = useAppSelector((state) => state.editModeState.codeToEdit); - const toolCallState = useAppSelector(selectCurrentToolCall); const mode = useAppSelector((store) => store.session.mode); const isInEdit = useAppSelector((store) => store.session.isInEdit); @@ -147,6 +147,7 @@ export function Chat() { isStreaming, ); + const currentToolCallState = useAppSelector(selectCurrentToolCall); const currentToolCallApplyState = useAppSelector( selectCurrentToolCallApplyState, ); @@ -158,20 +159,19 @@ export function Chat() { index?: number, editorToClearOnSend?: Editor, ) => { - if (toolCallState?.status === "generated") { - return console.error( - "Cannot submit message while awaiting tool confirmation", + if (currentToolCallState) { + dispatch( + cancelToolCall({ + toolCallId: currentToolCallState.toolCallId, + }), ); } if ( currentToolCallApplyState && currentToolCallApplyState.status !== "closed" ) { - return console.error( - "Cannot submit message while awaiting tool call apply", - ); + ideMessenger.post("rejectDiff", currentToolCallApplyState); } - const model = isInEdit ? (selectedModels?.edit ?? selectedModels?.chat) : selectedModels?.chat; @@ -241,7 +241,7 @@ export function Chat() { mode, isInEdit, codeToEdit, - toolCallState, + currentToolCallState, currentToolCallApplyState, ], ); diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx index 956ef791b..c0e6ddba8 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx @@ -27,7 +27,7 @@ export function ToolCallDisplay({ return ( <> -
+
From 5d02e362dd7b32116cd923df3b7bbb9719cf8066 Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Mon, 7 Jul 2025 17:17:07 +0200 Subject: [PATCH 43/82] fix: Attach environment type to reported exceptions Motivation: * Everything right now goes under "production" and it's hard to distinguish exceptions that I triggered myself during development from real ones. * In Sentry, there is an issue called JobCancellationException, which I believe is related to ci/e2e tests. I want to recognize that. * It's a common practice to distinguish environments, and it will be easy to hide non-production issues (with query like `?environment=production`). Introduced types: * production (default) * dev (when `runIde`) * e2e (when robot enabled) --- .../error/ContinueErrorService.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt index b1fdae571..21f920ef9 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt @@ -21,6 +21,7 @@ class ContinueErrorService { init { Sentry.init { config -> config.dsn = SENTRY_DSN + config.environment = recognizeEnvironment() config.isSendDefaultPii = false config.setTag("ide_version", ApplicationInfo.getInstance().build.asString()) config.setTag("jcef_supported", JBCefApp.isSupported().toString()) @@ -45,6 +46,12 @@ class ContinueErrorService { private const val PLUGIN_ID = "com.github.continuedev.continueintellijextension" private const val SENTRY_DSN = "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016" - } + private fun recognizeEnvironment() = + when { + System.getProperty("robot-server.port") != null -> "e2e" + System.getProperty("idea.is.internal").toBoolean() -> "dev" + else -> "production" + } + } } \ No newline at end of file From 4a5323c80878a349589811c25994bbc365d41497 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Mon, 7 Jul 2025 10:17:52 -0700 Subject: [PATCH 44/82] move /advanced to /customize --- .../{advanced => customize}/00-overview.mdx | 0 .../context/_category_.json | 0 .../context/codebase.mdx | 0 .../context/documentation.mdx | 0 .../custom-providers.mdx | 0 .../deep-dives/_apply.md | 0 .../deep-dives/_category_.json | 0 .../deep-dives/autocomplete.mdx | 0 .../deep-dives/configuration.md | 0 .../deep-dives/development-data.md | 0 .../deep-dives/mcp.mdx | 0 .../deep-dives/prompts.md | 0 .../deep-dives/rules.mdx | 0 .../deep-dives/settings.md | 0 .../deep-dives/slash-commands.mdx | 0 .../deep-dives/vscode-actions.md | 0 .../{advanced => customize}/json-reference.md | 0 .../model-providers/_category_.json | 0 .../model-providers/assets/watsonx2.gif | Bin .../model-providers/llamastack.mdx | 0 .../model-providers/more/SambaNova.mdx | 0 .../model-providers/more/_category_.json | 0 .../model-providers/more/asksage.mdx | 0 .../model-providers/more/cerebras.mdx | 0 .../model-providers/more/cloudflare.mdx | 0 .../model-providers/more/cohere.mdx | 0 .../model-providers/more/deepinfra.mdx | 0 .../model-providers/more/flowise.mdx | 0 .../model-providers/more/function-network.mdx | 0 .../model-providers/more/groq.mdx | 0 .../more/huggingfaceinferenceapi.mdx | 0 .../model-providers/more/ipex_llm.mdx | 0 .../model-providers/more/kindo.mdx | 0 .../model-providers/more/llamacpp.mdx | 0 .../model-providers/more/llamafile.mdx | 0 .../model-providers/more/lmstudio.mdx | 0 .../model-providers/more/moonshot.mdx | 0 .../model-providers/more/morph.mdx | 0 .../model-providers/more/msty.mdx | 0 .../model-providers/more/ncompass.mdx | 0 .../model-providers/more/nebius.mdx | 0 .../model-providers/more/novita.mdx | 0 .../model-providers/more/nvidia.mdx | 0 .../model-providers/more/openrouter.mdx | 0 .../more/openvino_model_server.mdx | 0 .../model-providers/more/ovhcloud.mdx | 0 .../model-providers/more/relace.mdx | 0 .../model-providers/more/replicatellm.mdx | 0 .../model-providers/more/sagemaker.mdx | 0 .../model-providers/more/scaleway.mdx | 0 .../model-providers/more/siliconflow.mdx | 0 .../model-providers/more/textgenwebui.mdx | 0 .../model-providers/more/together.mdx | 0 .../model-providers/more/venice.md | 0 .../model-providers/more/vllm.mdx | 0 .../model-providers/more/watsonx.mdx | 0 .../model-providers/top-level/_category_.json | 0 .../model-providers/top-level/anthropic.mdx | 0 .../model-providers/top-level/azure.mdx | 0 .../model-providers/top-level/bedrock.mdx | 0 .../model-providers/top-level/deepseek.mdx | 0 .../model-providers/top-level/gemini.mdx | 0 .../model-providers/top-level/inception.mdx | 0 .../model-providers/top-level/mistral.mdx | 0 .../model-providers/top-level/ollama.mdx | 0 .../model-providers/top-level/openai.mdx | 0 .../model-providers/top-level/vertexai.mdx | 0 .../model-providers/top-level/xAI.mdx | 0 .../model-roles/00-intro.mdx | 0 .../model-roles/_category_.json | 0 .../model-roles/apply.mdx | 0 .../model-roles/autocomplete.md | 0 .../model-roles/chat.mdx | 0 .../model-roles/edit.mdx | 0 .../model-roles/embeddings.mdx | 0 .../model-roles/reranking.mdx | 0 .../{advanced => customize}/telemetry.mdx | 0 .../yaml-migration.mdx | 0 docs/docusaurus.config.js | 145 +++++++++--------- docs/plugins/custom-llms-txt.js | 6 +- docs/sidebars.js | 4 +- 81 files changed, 80 insertions(+), 75 deletions(-) rename docs/docs/{advanced => customize}/00-overview.mdx (100%) rename docs/docs/{advanced => customize}/context/_category_.json (100%) rename docs/docs/{advanced => customize}/context/codebase.mdx (100%) rename docs/docs/{advanced => customize}/context/documentation.mdx (100%) rename docs/docs/{advanced => customize}/custom-providers.mdx (100%) rename docs/docs/{advanced => customize}/deep-dives/_apply.md (100%) rename docs/docs/{advanced => customize}/deep-dives/_category_.json (100%) rename docs/docs/{advanced => customize}/deep-dives/autocomplete.mdx (100%) rename docs/docs/{advanced => customize}/deep-dives/configuration.md (100%) rename docs/docs/{advanced => customize}/deep-dives/development-data.md (100%) rename docs/docs/{advanced => customize}/deep-dives/mcp.mdx (100%) rename docs/docs/{advanced => customize}/deep-dives/prompts.md (100%) rename docs/docs/{advanced => customize}/deep-dives/rules.mdx (100%) rename docs/docs/{advanced => customize}/deep-dives/settings.md (100%) rename docs/docs/{advanced => customize}/deep-dives/slash-commands.mdx (100%) rename docs/docs/{advanced => customize}/deep-dives/vscode-actions.md (100%) rename docs/docs/{advanced => customize}/json-reference.md (100%) rename docs/docs/{advanced => customize}/model-providers/_category_.json (100%) rename docs/docs/{advanced => customize}/model-providers/assets/watsonx2.gif (100%) rename docs/docs/{advanced => customize}/model-providers/llamastack.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/SambaNova.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/_category_.json (100%) rename docs/docs/{advanced => customize}/model-providers/more/asksage.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/cerebras.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/cloudflare.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/cohere.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/deepinfra.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/flowise.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/function-network.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/groq.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/huggingfaceinferenceapi.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/ipex_llm.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/kindo.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/llamacpp.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/llamafile.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/lmstudio.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/moonshot.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/morph.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/msty.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/ncompass.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/nebius.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/novita.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/nvidia.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/openrouter.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/openvino_model_server.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/ovhcloud.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/relace.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/replicatellm.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/sagemaker.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/scaleway.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/siliconflow.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/textgenwebui.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/together.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/venice.md (100%) rename docs/docs/{advanced => customize}/model-providers/more/vllm.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/more/watsonx.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/_category_.json (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/anthropic.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/azure.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/bedrock.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/deepseek.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/gemini.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/inception.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/mistral.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/ollama.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/openai.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/vertexai.mdx (100%) rename docs/docs/{advanced => customize}/model-providers/top-level/xAI.mdx (100%) rename docs/docs/{advanced => customize}/model-roles/00-intro.mdx (100%) rename docs/docs/{advanced => customize}/model-roles/_category_.json (100%) rename docs/docs/{advanced => customize}/model-roles/apply.mdx (100%) rename docs/docs/{advanced => customize}/model-roles/autocomplete.md (100%) rename docs/docs/{advanced => customize}/model-roles/chat.mdx (100%) rename docs/docs/{advanced => customize}/model-roles/edit.mdx (100%) rename docs/docs/{advanced => customize}/model-roles/embeddings.mdx (100%) rename docs/docs/{advanced => customize}/model-roles/reranking.mdx (100%) rename docs/docs/{advanced => customize}/telemetry.mdx (100%) rename docs/docs/{advanced => customize}/yaml-migration.mdx (100%) diff --git a/docs/docs/advanced/00-overview.mdx b/docs/docs/customize/00-overview.mdx similarity index 100% rename from docs/docs/advanced/00-overview.mdx rename to docs/docs/customize/00-overview.mdx diff --git a/docs/docs/advanced/context/_category_.json b/docs/docs/customize/context/_category_.json similarity index 100% rename from docs/docs/advanced/context/_category_.json rename to docs/docs/customize/context/_category_.json diff --git a/docs/docs/advanced/context/codebase.mdx b/docs/docs/customize/context/codebase.mdx similarity index 100% rename from docs/docs/advanced/context/codebase.mdx rename to docs/docs/customize/context/codebase.mdx diff --git a/docs/docs/advanced/context/documentation.mdx b/docs/docs/customize/context/documentation.mdx similarity index 100% rename from docs/docs/advanced/context/documentation.mdx rename to docs/docs/customize/context/documentation.mdx diff --git a/docs/docs/advanced/custom-providers.mdx b/docs/docs/customize/custom-providers.mdx similarity index 100% rename from docs/docs/advanced/custom-providers.mdx rename to docs/docs/customize/custom-providers.mdx diff --git a/docs/docs/advanced/deep-dives/_apply.md b/docs/docs/customize/deep-dives/_apply.md similarity index 100% rename from docs/docs/advanced/deep-dives/_apply.md rename to docs/docs/customize/deep-dives/_apply.md diff --git a/docs/docs/advanced/deep-dives/_category_.json b/docs/docs/customize/deep-dives/_category_.json similarity index 100% rename from docs/docs/advanced/deep-dives/_category_.json rename to docs/docs/customize/deep-dives/_category_.json diff --git a/docs/docs/advanced/deep-dives/autocomplete.mdx b/docs/docs/customize/deep-dives/autocomplete.mdx similarity index 100% rename from docs/docs/advanced/deep-dives/autocomplete.mdx rename to docs/docs/customize/deep-dives/autocomplete.mdx diff --git a/docs/docs/advanced/deep-dives/configuration.md b/docs/docs/customize/deep-dives/configuration.md similarity index 100% rename from docs/docs/advanced/deep-dives/configuration.md rename to docs/docs/customize/deep-dives/configuration.md diff --git a/docs/docs/advanced/deep-dives/development-data.md b/docs/docs/customize/deep-dives/development-data.md similarity index 100% rename from docs/docs/advanced/deep-dives/development-data.md rename to docs/docs/customize/deep-dives/development-data.md diff --git a/docs/docs/advanced/deep-dives/mcp.mdx b/docs/docs/customize/deep-dives/mcp.mdx similarity index 100% rename from docs/docs/advanced/deep-dives/mcp.mdx rename to docs/docs/customize/deep-dives/mcp.mdx diff --git a/docs/docs/advanced/deep-dives/prompts.md b/docs/docs/customize/deep-dives/prompts.md similarity index 100% rename from docs/docs/advanced/deep-dives/prompts.md rename to docs/docs/customize/deep-dives/prompts.md diff --git a/docs/docs/advanced/deep-dives/rules.mdx b/docs/docs/customize/deep-dives/rules.mdx similarity index 100% rename from docs/docs/advanced/deep-dives/rules.mdx rename to docs/docs/customize/deep-dives/rules.mdx diff --git a/docs/docs/advanced/deep-dives/settings.md b/docs/docs/customize/deep-dives/settings.md similarity index 100% rename from docs/docs/advanced/deep-dives/settings.md rename to docs/docs/customize/deep-dives/settings.md diff --git a/docs/docs/advanced/deep-dives/slash-commands.mdx b/docs/docs/customize/deep-dives/slash-commands.mdx similarity index 100% rename from docs/docs/advanced/deep-dives/slash-commands.mdx rename to docs/docs/customize/deep-dives/slash-commands.mdx diff --git a/docs/docs/advanced/deep-dives/vscode-actions.md b/docs/docs/customize/deep-dives/vscode-actions.md similarity index 100% rename from docs/docs/advanced/deep-dives/vscode-actions.md rename to docs/docs/customize/deep-dives/vscode-actions.md diff --git a/docs/docs/advanced/json-reference.md b/docs/docs/customize/json-reference.md similarity index 100% rename from docs/docs/advanced/json-reference.md rename to docs/docs/customize/json-reference.md diff --git a/docs/docs/advanced/model-providers/_category_.json b/docs/docs/customize/model-providers/_category_.json similarity index 100% rename from docs/docs/advanced/model-providers/_category_.json rename to docs/docs/customize/model-providers/_category_.json diff --git a/docs/docs/advanced/model-providers/assets/watsonx2.gif b/docs/docs/customize/model-providers/assets/watsonx2.gif similarity index 100% rename from docs/docs/advanced/model-providers/assets/watsonx2.gif rename to docs/docs/customize/model-providers/assets/watsonx2.gif diff --git a/docs/docs/advanced/model-providers/llamastack.mdx b/docs/docs/customize/model-providers/llamastack.mdx similarity index 100% rename from docs/docs/advanced/model-providers/llamastack.mdx rename to docs/docs/customize/model-providers/llamastack.mdx diff --git a/docs/docs/advanced/model-providers/more/SambaNova.mdx b/docs/docs/customize/model-providers/more/SambaNova.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/SambaNova.mdx rename to docs/docs/customize/model-providers/more/SambaNova.mdx diff --git a/docs/docs/advanced/model-providers/more/_category_.json b/docs/docs/customize/model-providers/more/_category_.json similarity index 100% rename from docs/docs/advanced/model-providers/more/_category_.json rename to docs/docs/customize/model-providers/more/_category_.json diff --git a/docs/docs/advanced/model-providers/more/asksage.mdx b/docs/docs/customize/model-providers/more/asksage.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/asksage.mdx rename to docs/docs/customize/model-providers/more/asksage.mdx diff --git a/docs/docs/advanced/model-providers/more/cerebras.mdx b/docs/docs/customize/model-providers/more/cerebras.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/cerebras.mdx rename to docs/docs/customize/model-providers/more/cerebras.mdx diff --git a/docs/docs/advanced/model-providers/more/cloudflare.mdx b/docs/docs/customize/model-providers/more/cloudflare.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/cloudflare.mdx rename to docs/docs/customize/model-providers/more/cloudflare.mdx diff --git a/docs/docs/advanced/model-providers/more/cohere.mdx b/docs/docs/customize/model-providers/more/cohere.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/cohere.mdx rename to docs/docs/customize/model-providers/more/cohere.mdx diff --git a/docs/docs/advanced/model-providers/more/deepinfra.mdx b/docs/docs/customize/model-providers/more/deepinfra.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/deepinfra.mdx rename to docs/docs/customize/model-providers/more/deepinfra.mdx diff --git a/docs/docs/advanced/model-providers/more/flowise.mdx b/docs/docs/customize/model-providers/more/flowise.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/flowise.mdx rename to docs/docs/customize/model-providers/more/flowise.mdx diff --git a/docs/docs/advanced/model-providers/more/function-network.mdx b/docs/docs/customize/model-providers/more/function-network.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/function-network.mdx rename to docs/docs/customize/model-providers/more/function-network.mdx diff --git a/docs/docs/advanced/model-providers/more/groq.mdx b/docs/docs/customize/model-providers/more/groq.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/groq.mdx rename to docs/docs/customize/model-providers/more/groq.mdx diff --git a/docs/docs/advanced/model-providers/more/huggingfaceinferenceapi.mdx b/docs/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/huggingfaceinferenceapi.mdx rename to docs/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx diff --git a/docs/docs/advanced/model-providers/more/ipex_llm.mdx b/docs/docs/customize/model-providers/more/ipex_llm.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/ipex_llm.mdx rename to docs/docs/customize/model-providers/more/ipex_llm.mdx diff --git a/docs/docs/advanced/model-providers/more/kindo.mdx b/docs/docs/customize/model-providers/more/kindo.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/kindo.mdx rename to docs/docs/customize/model-providers/more/kindo.mdx diff --git a/docs/docs/advanced/model-providers/more/llamacpp.mdx b/docs/docs/customize/model-providers/more/llamacpp.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/llamacpp.mdx rename to docs/docs/customize/model-providers/more/llamacpp.mdx diff --git a/docs/docs/advanced/model-providers/more/llamafile.mdx b/docs/docs/customize/model-providers/more/llamafile.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/llamafile.mdx rename to docs/docs/customize/model-providers/more/llamafile.mdx diff --git a/docs/docs/advanced/model-providers/more/lmstudio.mdx b/docs/docs/customize/model-providers/more/lmstudio.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/lmstudio.mdx rename to docs/docs/customize/model-providers/more/lmstudio.mdx diff --git a/docs/docs/advanced/model-providers/more/moonshot.mdx b/docs/docs/customize/model-providers/more/moonshot.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/moonshot.mdx rename to docs/docs/customize/model-providers/more/moonshot.mdx diff --git a/docs/docs/advanced/model-providers/more/morph.mdx b/docs/docs/customize/model-providers/more/morph.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/morph.mdx rename to docs/docs/customize/model-providers/more/morph.mdx diff --git a/docs/docs/advanced/model-providers/more/msty.mdx b/docs/docs/customize/model-providers/more/msty.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/msty.mdx rename to docs/docs/customize/model-providers/more/msty.mdx diff --git a/docs/docs/advanced/model-providers/more/ncompass.mdx b/docs/docs/customize/model-providers/more/ncompass.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/ncompass.mdx rename to docs/docs/customize/model-providers/more/ncompass.mdx diff --git a/docs/docs/advanced/model-providers/more/nebius.mdx b/docs/docs/customize/model-providers/more/nebius.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/nebius.mdx rename to docs/docs/customize/model-providers/more/nebius.mdx diff --git a/docs/docs/advanced/model-providers/more/novita.mdx b/docs/docs/customize/model-providers/more/novita.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/novita.mdx rename to docs/docs/customize/model-providers/more/novita.mdx diff --git a/docs/docs/advanced/model-providers/more/nvidia.mdx b/docs/docs/customize/model-providers/more/nvidia.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/nvidia.mdx rename to docs/docs/customize/model-providers/more/nvidia.mdx diff --git a/docs/docs/advanced/model-providers/more/openrouter.mdx b/docs/docs/customize/model-providers/more/openrouter.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/openrouter.mdx rename to docs/docs/customize/model-providers/more/openrouter.mdx diff --git a/docs/docs/advanced/model-providers/more/openvino_model_server.mdx b/docs/docs/customize/model-providers/more/openvino_model_server.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/openvino_model_server.mdx rename to docs/docs/customize/model-providers/more/openvino_model_server.mdx diff --git a/docs/docs/advanced/model-providers/more/ovhcloud.mdx b/docs/docs/customize/model-providers/more/ovhcloud.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/ovhcloud.mdx rename to docs/docs/customize/model-providers/more/ovhcloud.mdx diff --git a/docs/docs/advanced/model-providers/more/relace.mdx b/docs/docs/customize/model-providers/more/relace.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/relace.mdx rename to docs/docs/customize/model-providers/more/relace.mdx diff --git a/docs/docs/advanced/model-providers/more/replicatellm.mdx b/docs/docs/customize/model-providers/more/replicatellm.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/replicatellm.mdx rename to docs/docs/customize/model-providers/more/replicatellm.mdx diff --git a/docs/docs/advanced/model-providers/more/sagemaker.mdx b/docs/docs/customize/model-providers/more/sagemaker.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/sagemaker.mdx rename to docs/docs/customize/model-providers/more/sagemaker.mdx diff --git a/docs/docs/advanced/model-providers/more/scaleway.mdx b/docs/docs/customize/model-providers/more/scaleway.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/scaleway.mdx rename to docs/docs/customize/model-providers/more/scaleway.mdx diff --git a/docs/docs/advanced/model-providers/more/siliconflow.mdx b/docs/docs/customize/model-providers/more/siliconflow.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/siliconflow.mdx rename to docs/docs/customize/model-providers/more/siliconflow.mdx diff --git a/docs/docs/advanced/model-providers/more/textgenwebui.mdx b/docs/docs/customize/model-providers/more/textgenwebui.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/textgenwebui.mdx rename to docs/docs/customize/model-providers/more/textgenwebui.mdx diff --git a/docs/docs/advanced/model-providers/more/together.mdx b/docs/docs/customize/model-providers/more/together.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/together.mdx rename to docs/docs/customize/model-providers/more/together.mdx diff --git a/docs/docs/advanced/model-providers/more/venice.md b/docs/docs/customize/model-providers/more/venice.md similarity index 100% rename from docs/docs/advanced/model-providers/more/venice.md rename to docs/docs/customize/model-providers/more/venice.md diff --git a/docs/docs/advanced/model-providers/more/vllm.mdx b/docs/docs/customize/model-providers/more/vllm.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/vllm.mdx rename to docs/docs/customize/model-providers/more/vllm.mdx diff --git a/docs/docs/advanced/model-providers/more/watsonx.mdx b/docs/docs/customize/model-providers/more/watsonx.mdx similarity index 100% rename from docs/docs/advanced/model-providers/more/watsonx.mdx rename to docs/docs/customize/model-providers/more/watsonx.mdx diff --git a/docs/docs/advanced/model-providers/top-level/_category_.json b/docs/docs/customize/model-providers/top-level/_category_.json similarity index 100% rename from docs/docs/advanced/model-providers/top-level/_category_.json rename to docs/docs/customize/model-providers/top-level/_category_.json diff --git a/docs/docs/advanced/model-providers/top-level/anthropic.mdx b/docs/docs/customize/model-providers/top-level/anthropic.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/anthropic.mdx rename to docs/docs/customize/model-providers/top-level/anthropic.mdx diff --git a/docs/docs/advanced/model-providers/top-level/azure.mdx b/docs/docs/customize/model-providers/top-level/azure.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/azure.mdx rename to docs/docs/customize/model-providers/top-level/azure.mdx diff --git a/docs/docs/advanced/model-providers/top-level/bedrock.mdx b/docs/docs/customize/model-providers/top-level/bedrock.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/bedrock.mdx rename to docs/docs/customize/model-providers/top-level/bedrock.mdx diff --git a/docs/docs/advanced/model-providers/top-level/deepseek.mdx b/docs/docs/customize/model-providers/top-level/deepseek.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/deepseek.mdx rename to docs/docs/customize/model-providers/top-level/deepseek.mdx diff --git a/docs/docs/advanced/model-providers/top-level/gemini.mdx b/docs/docs/customize/model-providers/top-level/gemini.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/gemini.mdx rename to docs/docs/customize/model-providers/top-level/gemini.mdx diff --git a/docs/docs/advanced/model-providers/top-level/inception.mdx b/docs/docs/customize/model-providers/top-level/inception.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/inception.mdx rename to docs/docs/customize/model-providers/top-level/inception.mdx diff --git a/docs/docs/advanced/model-providers/top-level/mistral.mdx b/docs/docs/customize/model-providers/top-level/mistral.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/mistral.mdx rename to docs/docs/customize/model-providers/top-level/mistral.mdx diff --git a/docs/docs/advanced/model-providers/top-level/ollama.mdx b/docs/docs/customize/model-providers/top-level/ollama.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/ollama.mdx rename to docs/docs/customize/model-providers/top-level/ollama.mdx diff --git a/docs/docs/advanced/model-providers/top-level/openai.mdx b/docs/docs/customize/model-providers/top-level/openai.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/openai.mdx rename to docs/docs/customize/model-providers/top-level/openai.mdx diff --git a/docs/docs/advanced/model-providers/top-level/vertexai.mdx b/docs/docs/customize/model-providers/top-level/vertexai.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/vertexai.mdx rename to docs/docs/customize/model-providers/top-level/vertexai.mdx diff --git a/docs/docs/advanced/model-providers/top-level/xAI.mdx b/docs/docs/customize/model-providers/top-level/xAI.mdx similarity index 100% rename from docs/docs/advanced/model-providers/top-level/xAI.mdx rename to docs/docs/customize/model-providers/top-level/xAI.mdx diff --git a/docs/docs/advanced/model-roles/00-intro.mdx b/docs/docs/customize/model-roles/00-intro.mdx similarity index 100% rename from docs/docs/advanced/model-roles/00-intro.mdx rename to docs/docs/customize/model-roles/00-intro.mdx diff --git a/docs/docs/advanced/model-roles/_category_.json b/docs/docs/customize/model-roles/_category_.json similarity index 100% rename from docs/docs/advanced/model-roles/_category_.json rename to docs/docs/customize/model-roles/_category_.json diff --git a/docs/docs/advanced/model-roles/apply.mdx b/docs/docs/customize/model-roles/apply.mdx similarity index 100% rename from docs/docs/advanced/model-roles/apply.mdx rename to docs/docs/customize/model-roles/apply.mdx diff --git a/docs/docs/advanced/model-roles/autocomplete.md b/docs/docs/customize/model-roles/autocomplete.md similarity index 100% rename from docs/docs/advanced/model-roles/autocomplete.md rename to docs/docs/customize/model-roles/autocomplete.md diff --git a/docs/docs/advanced/model-roles/chat.mdx b/docs/docs/customize/model-roles/chat.mdx similarity index 100% rename from docs/docs/advanced/model-roles/chat.mdx rename to docs/docs/customize/model-roles/chat.mdx diff --git a/docs/docs/advanced/model-roles/edit.mdx b/docs/docs/customize/model-roles/edit.mdx similarity index 100% rename from docs/docs/advanced/model-roles/edit.mdx rename to docs/docs/customize/model-roles/edit.mdx diff --git a/docs/docs/advanced/model-roles/embeddings.mdx b/docs/docs/customize/model-roles/embeddings.mdx similarity index 100% rename from docs/docs/advanced/model-roles/embeddings.mdx rename to docs/docs/customize/model-roles/embeddings.mdx diff --git a/docs/docs/advanced/model-roles/reranking.mdx b/docs/docs/customize/model-roles/reranking.mdx similarity index 100% rename from docs/docs/advanced/model-roles/reranking.mdx rename to docs/docs/customize/model-roles/reranking.mdx diff --git a/docs/docs/advanced/telemetry.mdx b/docs/docs/customize/telemetry.mdx similarity index 100% rename from docs/docs/advanced/telemetry.mdx rename to docs/docs/customize/telemetry.mdx diff --git a/docs/docs/advanced/yaml-migration.mdx b/docs/docs/customize/yaml-migration.mdx similarity index 100% rename from docs/docs/advanced/yaml-migration.mdx rename to docs/docs/customize/yaml-migration.mdx diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 2ce94b2c6..9051f00cf 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -254,28 +254,28 @@ const config = { from: ["/install/vscode", "/install/jetbrains"], }, { - to: "/advanced/deep-dives/settings", - from: "/customize/settings", + to: "/customize/deep-dives/settings", + from: "/advanced/deep-dives/settings", }, { - to: "/advanced/model-roles/intro", - from: ["/customize/model-types", "/setup/overview"], + to: "/customize/model-roles/intro", + from: ["/customize/model-types", "/setup/overview", "/advanced/model-roles/intro"], }, { - to: "/advanced/model-roles/embeddings", - from: "/customize/model-types/embeddings", + to: "/customize/model-roles/embeddings", + from: ["/customize/model-types/embeddings", "/advanced/model-roles/embeddings"], }, { - to: "/advanced/model-roles/autocomplete", - from: "/customize/model-types/autocomplete", + to: "/customize/model-roles/autocomplete", + from: ["/customize/model-types/autocomplete", "/advanced/model-roles/autocomplete"], }, { - to: "/advanced/model-roles/chat", - from: "/customize/model-types/chat", + to: "/customize/model-roles/chat", + from: ["/customize/model-types/chat", "/advanced/model-roles/chat"], }, { - to: "/advanced/model-roles/reranking", - from: "/customize/model-types/reranking", + to: "/customize/model-roles/reranking", + from: ["/customize/model-types/reranking", "/advanced/model-roles/reranking"], }, { to: "/getting-started/overview", @@ -288,31 +288,33 @@ const config = { ], }, { - to: "/advanced/model-providers/anthropic", - from: ["/setup/select-provider", "/setup/model-providers"], + to: "/customize/model-providers/anthropic", + from: ["/setup/select-provider", "/setup/model-providers", "/advanced/model-providers/anthropic"], }, { - to: "/advanced/context/codebase", + to: "/customize/context/codebase", from: [ "/walkthroughs/codebase-embeddings", "/features/codebase-embeddings", "/advanced/deep-dives/codebase", + "/advanced/context/codebase", ], }, { - to: "/advanced/deep-dives/autocomplete", + to: "/customize/deep-dives/autocomplete", from: [ "/walkthroughs/tab-autocomplete", "/features/tab-autocomplete", + "/advanced/deep-dives/autocomplete", ], }, { - to: "/advanced/deep-dives/prompts", - from: ["/walkthroughs/prompt-files", "/features/prompt-files"], + to: "/customize/deep-dives/prompts", + from: ["/walkthroughs/prompt-files", "/features/prompt-files", "/advanced/deep-dives/prompts"], }, // TODO - actions redirects { - to: "/advanced/deep-dives/slash-commands", + to: "/customize/deep-dives/slash-commands", from: [ "/actions/how-to-use-it", "/actions/how-to-customize", @@ -322,12 +324,13 @@ const config = { "/actions/how-it-works", "/customize/slash-commands", "/customization/slash-commands", + "/advanced/deep-dives/slash-commands", ], }, { - to: "/advanced/deep-dives/vscode-actions", - from: ["/walkthroughs/quick-actions"], + to: "/customize/deep-dives/vscode-actions", + from: ["/walkthroughs/quick-actions", "/advanced/deep-dives/vscode-actions"], }, { to: "/reference", @@ -342,147 +345,149 @@ const config = { ], }, { - to: "/advanced/custom-providers", + to: "/customize/custom-providers", from: [ "/customization/context-providers", "/advanced/context-integration/custom-providers", "/advanced/context/custom-providers", + "/advanced/custom-providers", ], }, { - to: "/advanced/deep-dives/development-data", - from: ["/development-data", "/customize/development-data"], + to: "/customize/deep-dives/development-data", + from: ["/development-data", "/customize/development-data", "/advanced/deep-dives/development-data"], }, { - to: "/advanced/context/documentation", + to: "/customize/context/documentation", from: [ "/features/talk-to-your-docs", "/advanced/context-integration/documentation", "/advanced/deep-dives/docs", + "/advanced/context/documentation", ], }, { - to: "/advanced/model-providers/anthropic", - from: "/reference/Model Providers/anthropicllm", + to: "/customize/model-providers/anthropic", + from: ["/reference/Model Providers/anthropicllm", "/advanced/model-providers/anthropic"], }, { - to: "/advanced/model-providers/azure", - from: "/reference/Model Providers/azure", + to: "/customize/model-providers/azure", + from: ["/reference/Model Providers/azure", "/advanced/model-providers/azure"], }, { - to: "/advanced/model-providers/bedrock", - from: "/reference/Model Providers/bedrock", + to: "/customize/model-providers/bedrock", + from: ["/reference/Model Providers/bedrock", "/advanced/model-providers/bedrock"], }, { - to: "/advanced/model-providers/deepseek", - from: "/reference/Model Providers/deepseek", + to: "/customize/model-providers/deepseek", + from: ["/reference/Model Providers/deepseek", "/advanced/model-providers/deepseek"], }, { - to: "/advanced/model-providers/anthropic", + to: "/customize/model-providers/anthropic", from: "/reference/Model Providers/freetrial", }, { - to: "/advanced/model-providers/gemini", - from: "/reference/Model Providers/geminiapi", + to: "/customize/model-providers/gemini", + from: ["/reference/Model Providers/geminiapi", "/advanced/model-providers/gemini"], }, { - to: "/advanced/model-providers/mistral", - from: "/reference/Model Providers/mistral", + to: "/customize/model-providers/mistral", + from: ["/reference/Model Providers/mistral", "/advanced/model-providers/mistral"], }, { - to: "/advanced/model-providers/ollama", - from: "/reference/Model Providers/ollama", + to: "/customize/model-providers/ollama", + from: ["/reference/Model Providers/ollama", "/advanced/model-providers/ollama"], }, { - to: "/advanced/model-providers/openai", - from: "/reference/Model Providers/openai", + to: "/customize/model-providers/openai", + from: ["/reference/Model Providers/openai", "/advanced/model-providers/openai"], }, { to: "/", from: "/intro", }, { - to: "/advanced/model-providers/more/cloudflare", + to: "/customize/model-providers/more/cloudflare", from: "/reference/Model Providers/cloudflare", }, { - to: "/advanced/model-providers/more/cohere", + to: "/customize/model-providers/more/cohere", from: "/reference/Model Providers/cohere", }, { - to: "/advanced/model-providers/more/deepinfra", + to: "/customize/model-providers/more/deepinfra", from: "/reference/Model Providers/deepinfra", }, { - to: "/advanced/model-providers/more/flowise", + to: "/customize/model-providers/more/flowise", from: "/reference/Model Providers/flowise", }, { - to: "/advanced/model-providers/llamastack", + to: "/customize/model-providers/llamastack", from: "/advanced/model-providers/more/llamastack", }, { - to: "/advanced/model-providers/more/huggingfaceinferenceapi", + to: "/customize/model-providers/more/huggingfaceinferenceapi", from: "/reference/Model Providers/huggingfaceinferenceapi", }, { - to: "/advanced/model-providers/more/ipex_llm", + to: "/customize/model-providers/more/ipex_llm", from: "/reference/Model Providers/ipex_llm", }, { - to: "/advanced/model-providers/more/kindo", + to: "/customize/model-providers/more/kindo", from: "/reference/Model Providers/kindo", }, { - to: "/advanced/model-providers/more/llamacpp", + to: "/customize/model-providers/more/llamacpp", from: "/reference/Model Providers/llamacpp", }, { - to: "/advanced/model-providers/more/llamafile", + to: "/customize/model-providers/more/llamafile", from: "/reference/Model Providers/llamafile", }, { - to: "/advanced/model-providers/more/lmstudio", + to: "/customize/model-providers/more/lmstudio", from: "/reference/Model Providers/lmstudio", }, { - to: "/advanced/model-providers/more/msty", + to: "/customize/model-providers/more/msty", from: "/reference/Model Providers/msty", }, { - to: "/advanced/model-providers/more/openrouter", + to: "/customize/model-providers/more/openrouter", from: "/reference/Model Providers/openrouter", }, { - to: "/advanced/model-providers/more/replicatellm", + to: "/customize/model-providers/more/replicatellm", from: "/reference/Model Providers/replicatellm", }, { - to: "/advanced/model-providers/more/sagemaker", + to: "/customize/model-providers/more/sagemaker", from: "/reference/Model Providers/sagemaker", }, { - to: "/advanced/model-providers/more/textgenwebui", + to: "/customize/model-providers/more/textgenwebui", from: "/reference/Model Providers/textgenwebui", }, { - to: "/advanced/model-providers/more/together", + to: "/customize/model-providers/more/together", from: "/reference/Model Providers/together", }, { - to: "/advanced/model-providers/more/novita", + to: "/customize/model-providers/more/novita", from: "/reference/Model Providers/novita", }, { - to: "/advanced/model-providers/more/vllm", + to: "/customize/model-providers/more/vllm", from: "/reference/Model Providers/vllm", }, { - to: "/advanced/model-providers/more/watsonx", + to: "/customize/model-providers/more/watsonx", from: "/reference/Model Providers/watsonx", }, { - to: "/advanced/model-providers/more/nebius", + to: "/customize/model-providers/more/nebius", from: "/reference/Model Providers/nebius", }, // Sidebar items that should route directly to a subpage @@ -507,7 +512,7 @@ const config = { from: "/getting-started", }, { - to: "/advanced/deep-dives/prompts", + to: "/customize/deep-dives/prompts", from: "/customize/deep-dives/prompt-files", }, // Migrated from netlify.toml @@ -528,16 +533,16 @@ const config = { from: "/agent/how-it-works", }, { - to: "/advanced/telemetry", - from: "/telemetry", + to: "/customize/telemetry", + from: ["/telemetry", "/advanced/telemetry"], }, { - to: "/advanced/yaml-migration", - from: "/yaml-migration", + to: "/customize/yaml-migration", + from: ["/yaml-migration", "/advanced/yaml-migration"], }, { - to: "/advanced/json-reference", - from: "/json-reference", + to: "/customize/json-reference", + from: ["/json-reference", "/advanced/json-reference"], }, ], }, diff --git a/docs/plugins/custom-llms-txt.js b/docs/plugins/custom-llms-txt.js index 30762c9c1..9674bc8b7 100644 --- a/docs/plugins/custom-llms-txt.js +++ b/docs/plugins/custom-llms-txt.js @@ -28,7 +28,7 @@ module.exports = function customLLMsTxtPlugin(context, options) { Features: [], Guides: [], Customization: [], - Advanced: [], + Customize: [], Hub: [], }; @@ -73,8 +73,8 @@ module.exports = function customLLMsTxtPlugin(context, options) { sections["Guides"].push(docInfo); } else if (cleanPath.includes("customization")) { sections["Customization"].push(docInfo); - } else if (cleanPath.includes("advanced")) { - sections["Advanced"].push(docInfo); + } else if (cleanPath.includes("customize")) { + sections["Customize"].push(docInfo); } else if (cleanPath.includes("hub")) { sections["Hub"].push(docInfo); } else if (cleanPath === "" || cleanPath === "/") { diff --git a/docs/sidebars.js b/docs/sidebars.js index f225961f4..49748072c 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -47,11 +47,11 @@ const sidebars = { }, { type: "category", - label: "Advanced", + label: "Customize", items: [ { type: "autogenerated", - dirName: "advanced", + dirName: "customize", }, ], }, From 7476742fbde2e301dc4c96be4707650fd42c8072 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Mon, 7 Jul 2025 10:27:08 -0700 Subject: [PATCH 45/82] fix broken links --- docs/docs/customization/00-overview.mdx | 12 ++++++------ docs/docs/customization/mcp-tools.mdx | 4 ++-- docs/docs/customization/models.mdx | 16 ++++++++-------- docs/docs/customization/prompts.mdx | 2 +- docs/docs/customization/rules.mdx | 2 +- docs/docs/customize/json-reference.md | 6 +++--- docs/docs/features/agent/how-it-works.mdx | 2 +- docs/docs/features/autocomplete/how-it-works.mdx | 2 +- docs/docs/features/chat/how-it-works.mdx | 4 ++-- .../guides/build-your-own-context-provider.mdx | 2 +- docs/docs/guides/custom-code-rag.mdx | 2 +- .../guides/running-continue-without-internet.mdx | 4 ++-- docs/docs/hub/blocks/block-types.md | 12 ++++++------ docs/docs/reference.mdx | 12 ++++++------ docs/docusaurus.config.js | 2 +- 15 files changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/docs/customization/00-overview.mdx b/docs/docs/customization/00-overview.mdx index 423901141..767709951 100644 --- a/docs/docs/customization/00-overview.mdx +++ b/docs/docs/customization/00-overview.mdx @@ -6,11 +6,11 @@ keywords: [customize, configure, config] Continue can be deeply customized. For example you might: -- **Change your Model Provider**. Continue allows you to choose your favorite or even add multiple model providers. This allows you to use different models for different tasks, or to try another model if you're not happy with the results from your current model. Continue supports all of the popular model providers, including OpenAI, Anthropic, Microsoft/Azure, Mistral, and more. You can even self host your own model provider if you'd like. Learn more about [model providers](../advanced/model-providers/top-level/openai.mdx). -- **Select different models for specific tasks**. Different Continue features can use different models. We call these _model roles_. For example, you can use a different model for chat than you do for autocomplete. Learn more about [model roles](../advanced/model-roles/00-intro.mdx). -- **Add a Context Provider**. Context providers allow you to add information to your prompts, giving your LLM additional context to work with. Context providers allow you to reference snippets from your codebase, or lookup relevant documentation, or use a search engine to find information and much more. Learn more about [context providers](../advanced/custom-providers.mdx). -- **Create a Slash Command**. Slash commands allow you to easily add custom functionality to Continue. You can use a slash command that allows you to generate a shell command from natural language, or perhaps generate a commit message, or create your own custom command to do whatever you want. Learn more about [slash commands](../advanced/deep-dives/slash-commands.mdx). -- **Call external tools and functions**. Unchain your LLM with the power of tools using [Agent](../features/agent/quick-start.mdx). Add custom tools using [MCP Servers](../advanced/deep-dives/mcp.mdx) +- **Change your Model Provider**. Continue allows you to choose your favorite or even add multiple model providers. This allows you to use different models for different tasks, or to try another model if you're not happy with the results from your current model. Continue supports all of the popular model providers, including OpenAI, Anthropic, Microsoft/Azure, Mistral, and more. You can even self host your own model provider if you'd like. Learn more about [model providers](../customize/model-providers/top-level/openai.mdx). +- **Select different models for specific tasks**. Different Continue features can use different models. We call these _model roles_. For example, you can use a different model for chat than you do for autocomplete. Learn more about [model roles](../customize/model-roles/00-intro.mdx). +- **Add a Context Provider**. Context providers allow you to add information to your prompts, giving your LLM additional context to work with. Context providers allow you to reference snippets from your codebase, or lookup relevant documentation, or use a search engine to find information and much more. Learn more about [context providers](../customize/custom-providers.mdx). +- **Create a Slash Command**. Slash commands allow you to easily add custom functionality to Continue. You can use a slash command that allows you to generate a shell command from natural language, or perhaps generate a commit message, or create your own custom command to do whatever you want. Learn more about [slash commands](../customize/deep-dives/slash-commands.mdx). +- **Call external tools and functions**. Unchain your LLM with the power of tools using [Agent](../features/agent/quick-start.mdx). Add custom tools using [MCP Servers](../customize/deep-dives/mcp.mdx) Whatever you choose, you'll probably start by editing your Assistant. @@ -21,4 +21,4 @@ You can easily access your assistant configuration from the Continue Chat sideba ![configure an assistant](/img/configure-continue.png) - See [Editing Hub Assistants](../hub/assistants/edit-an-assistant.md) for more details on managing your hub assistant -- See the [Config Deep Dive](../advanced/deep-dives/configuration.md) for more details on configuring local assistants. +- See the [Config Deep Dive](../customize/deep-dives/configuration.md) for more details on configuring local assistants. diff --git a/docs/docs/customization/mcp-tools.mdx b/docs/docs/customization/mcp-tools.mdx index f9af25609..098835c59 100644 --- a/docs/docs/customization/mcp-tools.mdx +++ b/docs/docs/customization/mcp-tools.mdx @@ -18,7 +18,7 @@ Model Context Protocol servers provide specialized functionality: ## Learn More -Learn more in the [MCP deep dive](../advanced/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. +Learn more in the [MCP deep dive](../customize/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. description: Model Context Protocol servers provide specialized functionality keywords: [mcp, blocks, model context protocol, integrations, tools] sidebar_position: 4 @@ -37,4 +37,4 @@ Model Context Protocol servers provide specialized functionality: ## Learn More -Learn more in the [MCP deep dive](../advanced/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. +Learn more in the [MCP deep dive](../customize/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. diff --git a/docs/docs/customization/models.mdx b/docs/docs/customization/models.mdx index d612aea47..dac342360 100644 --- a/docs/docs/customization/models.mdx +++ b/docs/docs/customization/models.mdx @@ -8,17 +8,17 @@ sidebar_position: 1 These blocks form the foundation of the entire assistant experience, offering different specialized capabilities: -- **[Chat](../advanced/model-roles/chat.mdx)**: Power conversational interactions about code and provide detailed guidance -- **[Edit](../advanced/model-roles/edit.mdx)**: Handle complex code transformations and refactoring tasks -- **[Apply](../advanced/model-roles/apply.mdx)**: Execute targeted code modifications with high accuracy -- **[Autocomplete](../advanced/model-roles/autocomplete.md)**: Provide real-time suggestions as developers type -- **[Embedding](../advanced/model-roles/embeddings.mdx)**: Transform code into vector representations for semantic search -- **[Reranker](../advanced/model-roles/reranking.mdx)**: Improve search relevance by ordering results based on semantic meaning +- **[Chat](../customize/model-roles/chat.mdx)**: Power conversational interactions about code and provide detailed guidance +- **[Edit](../customize/model-roles/edit.mdx)**: Handle complex code transformations and refactoring tasks +- **[Apply](../customize/model-roles/apply.mdx)**: Execute targeted code modifications with high accuracy +- **[Autocomplete](../customize/model-roles/autocomplete.md)**: Provide real-time suggestions as developers type +- **[Embedding](../customize/model-roles/embeddings.mdx)**: Transform code into vector representations for semantic search +- **[Reranker](../customize/model-roles/reranking.mdx)**: Improve search relevance by ordering results based on semantic meaning ![Model Blocks Overview](/img/model-blocks-overview.png) ## Learn More -Continue supports [many model providers](../advanced/model-providers/top-level/openai.mdx), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have various roles like `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. +Continue supports [many model providers](../customize/model-providers/top-level/openai.mdx), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have various roles like `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. -Read more about roles [here](../advanced/model-roles/00-intro.mdx) and view [`models`](/reference#models) in the YAML Reference. +Read more about roles [here](../customize/model-roles/00-intro.mdx) and view [`models`](/reference#models) in the YAML Reference. diff --git a/docs/docs/customization/prompts.mdx b/docs/docs/customization/prompts.mdx index 38c359f78..ab27abcf8 100644 --- a/docs/docs/customization/prompts.mdx +++ b/docs/docs/customization/prompts.mdx @@ -18,4 +18,4 @@ These are the specialized instructions that shape how models respond: ## Learn More -Prompt blocks have the same syntax as [prompt files](../advanced/deep-dives/prompts.md). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). +Prompt blocks have the same syntax as [prompt files](../customize/deep-dives/prompts.md). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). diff --git a/docs/docs/customization/rules.mdx b/docs/docs/customization/rules.mdx index 28ffb2fcc..6181dcef4 100644 --- a/docs/docs/customization/rules.mdx +++ b/docs/docs/customization/rules.mdx @@ -22,4 +22,4 @@ Your assistant detects rule blocks and applies the specified rules while in [Age ## Learn More -Learn more in the [rules deep dive](../advanced/deep-dives/rules.mdx), and view [`rules`](/reference#rules) in the YAML Reference for more details. +Learn more in the [rules deep dive](../customize/deep-dives/rules.mdx), and view [`rules`](/reference#rules) in the YAML Reference for more details. diff --git a/docs/docs/customize/json-reference.md b/docs/docs/customize/json-reference.md index e65aeb387..38d876bb5 100644 --- a/docs/docs/customize/json-reference.md +++ b/docs/docs/customize/json-reference.md @@ -14,7 +14,7 @@ Below are details for each property that can be set in `config.json`. The config ### `models` -Your **chat** models are defined here, which are used for [Chat](/features/chat/how-it-works), [Edit](/features/edit/how-it-works) and [VS Code actions](/advanced/deep-dives/vscode-actions). +Your **chat** models are defined here, which are used for [Chat](/features/chat/how-it-works), [Edit](/features/edit/how-it-works) and [VS Code actions](/customize/deep-dives/vscode-actions). Each model has specific configuration options tailored to its provider and functionality, which can be seen as suggestions while editing the json. @@ -506,7 +506,7 @@ Example ### Fully deprecated settings -Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](/advanced/deep-dives/settings). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. +Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](/customize/deep-dives/settings). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. - `allowAnonymousTelemetry`: This value will be migrated to the safest merged value (`false` if either are `false`). - `promptPath`: This value will override during migration. @@ -527,4 +527,4 @@ Some deprecated `config.json` settings are no longer stored in config and have b - `displayRawMarkdown` - `showChatScrollbar` - See [User Settings Page](/advanced/deep-dives/settings) for more information about each option. + See [User Settings Page](/customize/deep-dives/settings) for more information about each option. diff --git a/docs/docs/features/agent/how-it-works.mdx b/docs/docs/features/agent/how-it-works.mdx index 31e0b1cc2..f8690f003 100644 --- a/docs/docs/features/agent/how-it-works.mdx +++ b/docs/docs/features/agent/how-it-works.mdx @@ -35,6 +35,6 @@ Continue includes several built-in tools which provide the model access to IDE f - **Run terminal command** (`run_terminal_command`): run a terminal command from the workspace root - **Search web** (`search_web`): Perform a web search to get top results - **View diff** (`view_diff`): View the current working git diff -- **View repo map** (`view_repo_map`): request a copy of the repository map—same as the [Repo Map Context Provider](../../advanced/custom-providers#repository-map) +- **View repo map** (`view_repo_map`): request a copy of the repository map—same as the [Repo Map Context Provider](../../customize/custom-providers#repository-map) - **View subdirectory** (`view_subdirectory`): request a copy of a repo map for a specific directory within the project - **Create Rule Block** (`create_rule_block`): creates a new rule block in `.continue/rules` based on the contents of the conversation diff --git a/docs/docs/features/autocomplete/how-it-works.mdx b/docs/docs/features/autocomplete/how-it-works.mdx index 8e313e7eb..45780cc5a 100644 --- a/docs/docs/features/autocomplete/how-it-works.mdx +++ b/docs/docs/features/autocomplete/how-it-works.mdx @@ -27,4 +27,4 @@ Language models aren't perfect, but can be made much closer by adjusting their o We will also occasionally entirely filter out responses if they are bad. This is often due to extreme repetition. -You can learn more about how it works in the [Autocomplete deep dive](../../advanced/deep-dives/autocomplete.mdx). +You can learn more about how it works in the [Autocomplete deep dive](../../customize/deep-dives/autocomplete.mdx). diff --git a/docs/docs/features/chat/how-it-works.mdx b/docs/docs/features/chat/how-it-works.mdx index 6b7b04520..90465799c 100644 --- a/docs/docs/features/chat/how-it-works.mdx +++ b/docs/docs/features/chat/how-it-works.mdx @@ -56,8 +56,8 @@ View the exact prompt sent to the AI model in the [prompt logs](/troubleshooting Learn more about how context providers work: -- [Codebase Context](../../advanced/context/codebase) -- [Documentation Context](../../advanced/context/documentation) +- [Codebase Context](../../customize/context/codebase) +- [Documentation Context](../../customize/context/documentation) --- diff --git a/docs/docs/guides/build-your-own-context-provider.mdx b/docs/docs/guides/build-your-own-context-provider.mdx index ba32eae0f..fe2169b69 100644 --- a/docs/docs/guides/build-your-own-context-provider.mdx +++ b/docs/docs/guides/build-your-own-context-provider.mdx @@ -60,7 +60,7 @@ The `"options"` property can be used to send additional parameters to your endpo ``` :::info -The following methods for creating custom context providers are deprecated. We recommend using HTTP context providers, [MCP Servers](../customization/mcp-tools.mdx), and [Prompts](../advanced/deep-dives/prompts.md) where possible. +The following methods for creating custom context providers are deprecated. We recommend using HTTP context providers, [MCP Servers](../customization/mcp-tools.mdx), and [Prompts](../customize/deep-dives/prompts.md) where possible. ::: ## Using CustomContextProvider diff --git a/docs/docs/guides/custom-code-rag.mdx b/docs/docs/guides/custom-code-rag.mdx index c5e53c045..2c2fcf252 100644 --- a/docs/docs/guides/custom-code-rag.mdx +++ b/docs/docs/guides/custom-code-rag.mdx @@ -8,7 +8,7 @@ import TabItem from "@theme/TabItem"; # Custom code RAG -While Continue comes with [@Codebase](../advanced/context/codebase.mdx) out of the box, you might wish to set up your own vector database and build a custom retrieval-augmented generation (RAG) system. This can allow you to access code that is not available locally, to index code a single time across all users, or to include custom logic. In this guide, we'll walk you through the steps it takes to build this. +While Continue comes with [@Codebase](../customize/context/codebase.mdx) out of the box, you might wish to set up your own vector database and build a custom retrieval-augmented generation (RAG) system. This can allow you to access code that is not available locally, to index code a single time across all users, or to include custom logic. In this guide, we'll walk you through the steps it takes to build this. ## Step 1: Choose an embeddings model diff --git a/docs/docs/guides/running-continue-without-internet.mdx b/docs/docs/guides/running-continue-without-internet.mdx index 0591373ed..ec9f09384 100644 --- a/docs/docs/guides/running-continue-without-internet.mdx +++ b/docs/docs/guides/running-continue-without-internet.mdx @@ -7,6 +7,6 @@ keywords: [no internet, air-gapped, local model] Continue can be run even on an air-gapped computer if you use a local model. Only a few adjustments are required for this to work. 1. Download the latest .vsix file from the [Open VSX Registry](https://open-vsx.org/extension/Continue/continue) and [install it to VS Code](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix). -2. Open the [User Settings Page](../advanced/deep-dives/settings.md) and turn off "Allow Anonymous Telemetry". This will stop Continue from attempting requests to PostHog for [anonymous telemetry](../advanced/telemetry.mdx). -3. Also in `config.json`, set the default model to a local model. You can available options [here](../advanced/model-providers/top-level/openai.mdx). +2. Open the [User Settings Page](../customize/deep-dives/settings.md) and turn off "Allow Anonymous Telemetry". This will stop Continue from attempting requests to PostHog for [anonymous telemetry](../customize/telemetry.mdx). +3. Also in `config.json`, set the default model to a local model. You can available options [here](../customize/model-providers/top-level/openai.mdx). 4. Restart VS Code to ensure that the changes to `config.json` or `config.yaml` take effect. diff --git a/docs/docs/hub/blocks/block-types.md b/docs/docs/hub/blocks/block-types.md index 49181d975..89cccf41c 100644 --- a/docs/docs/hub/blocks/block-types.md +++ b/docs/docs/hub/blocks/block-types.md @@ -11,7 +11,7 @@ sidebar_label: Types Models are blocks that let you specify Large Language Models (LLMs) and other deep learning models to be used for various roles in the open-source IDE extension like Chat, Autocomplete, Edit, Embed, Rerank, etc. You can explore available models on [the hub](https://hub.continue.dev/explore/models). -Continue supports [many model providers](../../advanced/model-providers/top-level/openai.mdx), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have one or more of the following roles depending on its capabilities, including `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. Read more about roles [here](../../advanced/model-roles/00-intro.mdx). View [`models`](/reference#models) in the YAML Reference for more details. +Continue supports [many model providers](../../customize/model-providers/top-level/openai.mdx), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have one or more of the following roles depending on its capabilities, including `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. Read more about roles [here](../../customize/model-roles/00-intro.mdx). View [`models`](/reference#models) in the YAML Reference for more details. ## Context @@ -23,28 +23,28 @@ Learn more about context providers [here](/reference#context), and check out [th Docs are blocks that point to documentation sites, which will be indexed locally and then can be referenced as context using @Docs in Chat. [Explore docs](https://hub.continue.dev/explore/docs) on the hub. -Learn more in the [@Docs deep dive](../../advanced/context/documentation.mdx), and view [`docs`](/reference#docs) in the YAML Reference for more details. +Learn more in the [@Docs deep dive](../../customize/context/documentation.mdx), and view [`docs`](/reference#docs) in the YAML Reference for more details. ## MCP Servers Model Context Protocol (MCP) is a standard way of building and sharing tools for language models. MCP Servers can be defined in `mcpServers` blocks. [Explore MCP Servers](https://hub.continue.dev/explore/mcp) on the hub. -Learn more in the [MCP deep dive](../../advanced/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. +Learn more in the [MCP deep dive](../../customize/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. ## Rules Rules blocks are instructions that your custom AI code assistant will always keep in mind - the contents of rules are inserted into the system message for all Chat requests. [Explore rules](https://hub.continue.dev/explore/rules) on the hub. -Learn more in the [rules deep dive](../../advanced/deep-dives/rules.mdx), and view [`rules`](/reference#rules) in the YAML Reference for more details. +Learn more in the [rules deep dive](../../customize/deep-dives/rules.mdx), and view [`rules`](/reference#rules) in the YAML Reference for more details. ## Prompts Prompts blocks are pre-written, reusable prompts that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. [Explore prompts](https://hub.continue.dev/explore/prompts) on the hub. -Prompt blocks have the same syntax as [prompt files](../../advanced/deep-dives/prompts.md). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). +Prompt blocks have the same syntax as [prompt files](../../customize/deep-dives/prompts.md). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). ## Data -Data blocks allow you send your development data to custom destinations of your choice. Development data can be used for a variety of purposes, including analyzing usage, gathering insights, or fine-tuning models. You can read more about development data [here](../../advanced/deep-dives/development-data.md). Explore data block examples [here](https://hub.continue.dev/explore/data). +Data blocks allow you send your development data to custom destinations of your choice. Development data can be used for a variety of purposes, including analyzing usage, gathering insights, or fine-tuning models. You can read more about development data [here](../../customize/deep-dives/development-data.md). Explore data block examples [here](https://hub.continue.dev/explore/data). Data destinations are configured in the [`data`](/reference#data) section of `config.yaml`. diff --git a/docs/docs/reference.mdx b/docs/docs/reference.mdx index 72c84d792..8f9db1347 100644 --- a/docs/docs/reference.mdx +++ b/docs/docs/reference.mdx @@ -19,7 +19,7 @@ from [the Hub](https://hub.continue.dev/explore/assistants) or locally - in your workspace in a `/.continue/assistants` folder, with the same naming convention :::info -Config YAML replaces `config.json`, which is deprecated. View the **[Migration Guide](/advanced/yaml-migration)**. +Config YAML replaces `config.json`, which is deprecated. View the **[Migration Guide](/customize/yaml-migration)**. ::: An assistant is made up of: @@ -191,9 +191,9 @@ chat, editing, and summarizing. provider and model. Supported capabilities include `tool_use` and `image_input`. - `maxStopWords`: Maximum number of stop words allowed, to avoid API errors with extensive lists. - `promptTemplates`: Can be used to override the default prompt templates for different model roles. Valid values are - `chat`, [`edit`](/advanced/model-roles/edit#prompt-templating), [ - `apply`](/advanced/model-roles/apply#prompt-templating) and [ - `autocomplete`](/advanced/model-roles/autocomplete#prompt-templating). The `chat` property must be a + `chat`, [`edit`](/customize/model-roles/edit#prompt-templating), [ + `apply`](/customize/model-roles/apply#prompt-templating) and [ + `autocomplete`](/customize/model-roles/autocomplete#prompt-templating). The `chat` property must be a valid template name, such as `llama3` or `anthropic`. - `chatOptions`: If the model includes role `chat`, these settings apply for Chat and Agent mode: - `baseSystemMessage`: Can be used to override the default system prompt for **Chat** mode. @@ -263,7 +263,7 @@ models: The `context` section defines context providers, which supply additional information or context to the language models. Each context provider can be configured with specific parameters. -More information about usage/params for each context provider can be found [here](/advanced/custom-providers) +More information about usage/params for each context provider can be found [here](/customize/custom-providers) **Properties:** @@ -400,7 +400,7 @@ mcpServers: ### `data` -Destinations to which [development data](/advanced/deep-dives/development-data) will be sent. +Destinations to which [development data](/customize/deep-dives/development-data) will be sent. **Properties:** diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 9051f00cf..35cac6b6a 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -368,7 +368,7 @@ const config = { }, { to: "/customize/model-providers/anthropic", - from: ["/reference/Model Providers/anthropicllm", "/advanced/model-providers/anthropic"], + from: ["/reference/Model Providers/anthropicllm"], }, { to: "/customize/model-providers/azure", From 1e895390e6e539528286d209ded108f3c31064b8 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Mon, 7 Jul 2025 10:30:01 -0700 Subject: [PATCH 46/82] prettier --- docs/docusaurus.config.js | 79 +++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 35cac6b6a..1632d0eb7 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -259,15 +259,25 @@ const config = { }, { to: "/customize/model-roles/intro", - from: ["/customize/model-types", "/setup/overview", "/advanced/model-roles/intro"], + from: [ + "/customize/model-types", + "/setup/overview", + "/advanced/model-roles/intro", + ], }, { to: "/customize/model-roles/embeddings", - from: ["/customize/model-types/embeddings", "/advanced/model-roles/embeddings"], + from: [ + "/customize/model-types/embeddings", + "/advanced/model-roles/embeddings", + ], }, { to: "/customize/model-roles/autocomplete", - from: ["/customize/model-types/autocomplete", "/advanced/model-roles/autocomplete"], + from: [ + "/customize/model-types/autocomplete", + "/advanced/model-roles/autocomplete", + ], }, { to: "/customize/model-roles/chat", @@ -275,7 +285,10 @@ const config = { }, { to: "/customize/model-roles/reranking", - from: ["/customize/model-types/reranking", "/advanced/model-roles/reranking"], + from: [ + "/customize/model-types/reranking", + "/advanced/model-roles/reranking", + ], }, { to: "/getting-started/overview", @@ -289,7 +302,11 @@ const config = { }, { to: "/customize/model-providers/anthropic", - from: ["/setup/select-provider", "/setup/model-providers", "/advanced/model-providers/anthropic"], + from: [ + "/setup/select-provider", + "/setup/model-providers", + "/advanced/model-providers/anthropic", + ], }, { to: "/customize/context/codebase", @@ -310,7 +327,11 @@ const config = { }, { to: "/customize/deep-dives/prompts", - from: ["/walkthroughs/prompt-files", "/features/prompt-files", "/advanced/deep-dives/prompts"], + from: [ + "/walkthroughs/prompt-files", + "/features/prompt-files", + "/advanced/deep-dives/prompts", + ], }, // TODO - actions redirects { @@ -330,7 +351,10 @@ const config = { { to: "/customize/deep-dives/vscode-actions", - from: ["/walkthroughs/quick-actions", "/advanced/deep-dives/vscode-actions"], + from: [ + "/walkthroughs/quick-actions", + "/advanced/deep-dives/vscode-actions", + ], }, { to: "/reference", @@ -355,7 +379,11 @@ const config = { }, { to: "/customize/deep-dives/development-data", - from: ["/development-data", "/customize/development-data", "/advanced/deep-dives/development-data"], + from: [ + "/development-data", + "/customize/development-data", + "/advanced/deep-dives/development-data", + ], }, { to: "/customize/context/documentation", @@ -372,15 +400,24 @@ const config = { }, { to: "/customize/model-providers/azure", - from: ["/reference/Model Providers/azure", "/advanced/model-providers/azure"], + from: [ + "/reference/Model Providers/azure", + "/advanced/model-providers/azure", + ], }, { to: "/customize/model-providers/bedrock", - from: ["/reference/Model Providers/bedrock", "/advanced/model-providers/bedrock"], + from: [ + "/reference/Model Providers/bedrock", + "/advanced/model-providers/bedrock", + ], }, { to: "/customize/model-providers/deepseek", - from: ["/reference/Model Providers/deepseek", "/advanced/model-providers/deepseek"], + from: [ + "/reference/Model Providers/deepseek", + "/advanced/model-providers/deepseek", + ], }, { to: "/customize/model-providers/anthropic", @@ -388,19 +425,31 @@ const config = { }, { to: "/customize/model-providers/gemini", - from: ["/reference/Model Providers/geminiapi", "/advanced/model-providers/gemini"], + from: [ + "/reference/Model Providers/geminiapi", + "/advanced/model-providers/gemini", + ], }, { to: "/customize/model-providers/mistral", - from: ["/reference/Model Providers/mistral", "/advanced/model-providers/mistral"], + from: [ + "/reference/Model Providers/mistral", + "/advanced/model-providers/mistral", + ], }, { to: "/customize/model-providers/ollama", - from: ["/reference/Model Providers/ollama", "/advanced/model-providers/ollama"], + from: [ + "/reference/Model Providers/ollama", + "/advanced/model-providers/ollama", + ], }, { to: "/customize/model-providers/openai", - from: ["/reference/Model Providers/openai", "/advanced/model-providers/openai"], + from: [ + "/reference/Model Providers/openai", + "/advanced/model-providers/openai", + ], }, { to: "/", From be561ff54c1ed59a28fd98c8a9f8a7af62a39477 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:35:39 -0700 Subject: [PATCH 47/82] add plan as actual mode in redux, add basePlanSystemMessage --- core/config/load.ts | 1 + core/config/yaml/models.ts | 1 + core/index.d.ts | 10 ++- core/llm/defaultSystemMessages.ts | 2 + core/llm/index.ts | 2 + core/llm/llms/index.ts | 8 +- gui/src/components/ModeSelect/ModeIcon.tsx | 2 +- gui/src/components/ModeSelect/ModeSelect.tsx | 52 +++++-------- .../mainInput/Lump/sections/RulesSection.tsx | 36 ++++++--- .../tool-policies/ToolPoliciesSection.tsx | 6 +- .../mainInput/belowMainInput/RulesPeek.tsx | 6 +- gui/src/redux/selectors/selectActiveTools.ts | 13 +++- gui/src/redux/slices/sessionSlice.ts | 6 -- gui/src/redux/store.ts | 1 - gui/src/redux/thunks/edit.ts | 73 +++++++++---------- gui/src/redux/thunks/streamNormalInput.ts | 36 ++++----- gui/src/redux/thunks/streamThunkWrapper.tsx | 2 +- gui/src/redux/util/constructMessages.test.ts | 14 +++- gui/src/redux/util/constructMessages.ts | 3 + packages/config-yaml/src/schemas/models.ts | 1 + 20 files changed, 146 insertions(+), 129 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index 3504cd8d5..4f5226bf0 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -643,6 +643,7 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription { template: llm.template, completionOptions: llm.completionOptions, baseAgentSystemMessage: llm.baseAgentSystemMessage, + basePlanSystemMessage: llm.basePlanSystemMessage, baseChatSystemMessage: llm.baseChatSystemMessage, requestOptions: llm.requestOptions, promptTemplates: serializePromptTemplates(llm.promptTemplates), diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index edb47f59e..f1a3df43b 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -63,6 +63,7 @@ async function modelConfigToBaseLLM({ template: model.promptTemplates?.chat, promptTemplates: model.promptTemplates, baseAgentSystemMessage: model.chatOptions?.baseAgentSystemMessage, + basePlanSystemMessage: model.chatOptions?.basePlanSystemMessage, baseChatSystemMessage: model.chatOptions?.baseSystemMessage, capabilities: { tools: model.capabilities?.includes("tool_use"), diff --git a/core/index.d.ts b/core/index.d.ts index fdee1f262..7eae1a493 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -427,7 +427,7 @@ export interface PromptLog { completion: string; } -export type MessageModes = "chat" | "agent"; +export type MessageModes = "chat" | "agent" | "plan"; export type ToolStatus = | "generating" @@ -567,6 +567,7 @@ export interface LLMOptions { title?: string; uniqueId?: string; baseAgentSystemMessage?: string; + basePlanSystemMessage?: string; baseChatSystemMessage?: string; autocompleteOptions?: Partial; contextLength?: number; @@ -1090,6 +1091,7 @@ export interface ModelDescription { template?: TemplateType; completionOptions?: BaseCompletionOptions; baseAgentSystemMessage?: string; + basePlanSystemMessage?: string; baseChatSystemMessage?: string; requestOptions?: RequestOptions; promptTemplates?: { [key: string]: string }; @@ -1629,9 +1631,11 @@ export interface TerminalOptions { export type RuleSource = | "default-chat" + | "default-plan" | "default-agent" - | "model-chat-options" - | "model-agent-options" + | "model-options-chat" + | "model-options-plan" + | "model-options-agent" | "rules-block" | "json-systemMessage" | ".continuerules"; diff --git a/core/llm/defaultSystemMessages.ts b/core/llm/defaultSystemMessages.ts index c2f82bac4..e51ea0013 100644 --- a/core/llm/defaultSystemMessages.ts +++ b/core/llm/defaultSystemMessages.ts @@ -66,3 +66,5 @@ export const DEFAULT_AGENT_SYSTEM_MESSAGE = `\ ${CODEBLOCK_FORMATTING_INSTRUCTIONS} `; + +export const DEFAULT_PLAN_SYSTEM_MESSAGE = DEFAULT_AGENT_SYSTEM_MESSAGE; diff --git a/core/llm/index.ts b/core/llm/index.ts index bfb5c1085..47d6c57cf 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -141,6 +141,7 @@ export abstract class BaseLLM implements ILLM { title?: string; baseChatSystemMessage?: string; + basePlanSystemMessage?: string; baseAgentSystemMessage?: string; contextLength: number; maxStopWords?: number | undefined; @@ -209,6 +210,7 @@ export abstract class BaseLLM implements ILLM { this.title = options.title; this.uniqueId = options.uniqueId ?? "None"; this.baseAgentSystemMessage = options.baseAgentSystemMessage; + this.basePlanSystemMessage = options.basePlanSystemMessage; this.baseChatSystemMessage = options.baseChatSystemMessage; this.contextLength = options.contextLength ?? llmInfo?.contextLength ?? DEFAULT_CONTEXT_LENGTH; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index e45828c40..0522bbda6 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -8,7 +8,6 @@ import { LLMOptions, } from "../.."; import { renderTemplatedString } from "../../util/handlebars/renderTemplatedString"; -import { DEFAULT_CHAT_SYSTEM_MESSAGE } from "../defaultSystemMessages"; import { BaseLLM } from "../index"; import Anthropic from "./Anthropic"; import Asksage from "./Asksage"; @@ -141,9 +140,9 @@ export async function llmFromDescription( let baseChatSystemMessage: string | undefined = undefined; if (desc.systemMessage !== undefined) { - baseChatSystemMessage = DEFAULT_CHAT_SYSTEM_MESSAGE; - baseChatSystemMessage += "\n\n"; - baseChatSystemMessage += await renderTemplatedString( + // baseChatSystemMessage = DEFAULT_CHAT_SYSTEM_MESSAGE; + // baseChatSystemMessage += "\n\n"; + baseChatSystemMessage = await renderTemplatedString( Handlebars, desc.systemMessage, {}, @@ -163,6 +162,7 @@ export async function llmFromDescription( cls.defaultOptions?.completionOptions?.maxTokens, }, baseChatSystemMessage, + basePlanSystemMessage: baseChatSystemMessage, baseAgentSystemMessage: baseChatSystemMessage, logger: llmLogger, uniqueId, diff --git a/gui/src/components/ModeSelect/ModeIcon.tsx b/gui/src/components/ModeSelect/ModeIcon.tsx index 1a34eb988..92dfc1723 100644 --- a/gui/src/components/ModeSelect/ModeIcon.tsx +++ b/gui/src/components/ModeSelect/ModeIcon.tsx @@ -6,7 +6,7 @@ import { import { MessageModes } from "core"; interface ModeIconProps { - mode: MessageModes | "plan"; + mode: MessageModes; className?: string; } diff --git a/gui/src/components/ModeSelect/ModeSelect.tsx b/gui/src/components/ModeSelect/ModeSelect.tsx index df29976a9..224799184 100644 --- a/gui/src/components/ModeSelect/ModeSelect.tsx +++ b/gui/src/components/ModeSelect/ModeSelect.tsx @@ -8,7 +8,7 @@ import { modelSupportsTools } from "core/llm/autodetect"; import { useCallback, useEffect, useMemo } from "react"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectSelectedChatModel } from "../../redux/slices/configSlice"; -import { setMode, setReadOnly } from "../../redux/slices/sessionSlice"; +import { setMode } from "../../redux/slices/sessionSlice"; import { getFontSize, getMetaKeyLabel } from "../../util"; import { ToolTip } from "../gui/Tooltip"; import { useMainEditor } from "../mainInput/TipTapEditor"; @@ -32,30 +32,24 @@ export function ModeSelect() { if (!selectedModel) { return; } - if (mode === "agent" && !agentModeSupported) { + if (mode !== "chat" && !agentModeSupported) { dispatch(setMode("chat")); } }, [mode, agentModeSupported, dispatch, selectedModel]); - const readOnlyMode = useAppSelector((store) => store.session.readOnlyMode); - const pseudoMode = useMemo(() => { - return mode === "chat" ? "chat" : readOnlyMode ? "plan" : "agent"; - }, [mode, readOnlyMode]); const cycleMode = useCallback(() => { - if (pseudoMode === "chat") { + if (mode === "chat") { + dispatch(setMode("plan")); + } else if (mode === "plan") { dispatch(setMode("agent")); - dispatch(setReadOnly(true)); - } else if (pseudoMode === "plan") { - dispatch(setReadOnly(false)); } else { - dispatch(setReadOnly(true)); dispatch(setMode("chat")); } // Only focus main editor if another one doesn't already have focus if (!document.activeElement?.classList?.contains("ProseMirror")) { mainEditor?.commands.focus(); } - }, [pseudoMode, mainEditor]); + }, [mode, mainEditor]); const selectMode = useCallback( (newMode: MessageModes) => { @@ -89,13 +83,9 @@ export function ModeSelect() { data-testid="mode-select-button" className="xs:px-2 text-description bg-lightgray/20 gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200 hover:brightness-110" > - + - {pseudoMode === "chat" - ? "Chat" - : pseudoMode === "agent" - ? "Agent" - : "Plan"} + {mode === "chat" ? "Chat" : mode === "agent" ? "Agent" : "Plan"}
- {pseudoMode === "chat" && } + {mode === "chat" && } { - dispatch(setReadOnly(true)); - }} >
- Agent (Plan) + Plan - In Plan mode, the Agent can only use read-only tools + In Plan mode, only use read-only and MCP tools are enabled
{agentModeSupported ? ( ) : ( (Not supported) @@ -151,29 +138,26 @@ export function ModeSelect() { value="agent" disabled={!agentModeSupported} className={"gap-1"} - onClick={() => { - dispatch(setReadOnly(false)); - }} >
- Agent (Act) + Agent - In Act mode, the Agent can use create/edit tools + All tools are enabled based on policies
{agentModeSupported ? ( ) : ( (Not supported) diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 761973428..8a6754457 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -54,6 +54,8 @@ const RuleCard: React.FC = ({ rule }) => { }); } else if (rule.source === "default-chat" && mode === "chat") { ideMessenger.post("openUrl", DEFAULT_CHAT_SYSTEM_MESSAGE_URL); + } else if (rule.source === "default-plan" && mode === "plan") { + ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); } else if (rule.source === "default-agent" && mode === "agent") { ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); } else { @@ -81,9 +83,11 @@ const RuleCard: React.FC = ({ rule }) => { return "Default agent system message"; } else if (rule.source === "json-systemMessage") { return "JSON systemMessage)"; - } else if (rule.source === "model-agent-options") { + } else if (rule.source === "model-options-agent") { return "Base System Agent Message"; - } else if (rule.source === "model-chat-options") { + } else if (rule.source === "model-options-plan") { + return "Base System Plan Message"; + } else if (rule.source === "model-options-chat") { return "Base System Chat Message"; } else { return "Assistant rule"; @@ -215,11 +219,24 @@ export function RulesSection() { } } - if (mode === "agent") { + if (mode === "chat") { + if (config.selectedModelByRole.chat?.baseChatSystemMessage) { + rules.unshift({ + rule: config.selectedModelByRole.chat?.baseChatSystemMessage, + source: "model-options-chat", + }); + } else { + rules.unshift({ + rule: DEFAULT_CHAT_SYSTEM_MESSAGE, + source: "default-chat", + }); + } + } else if (mode === "agent") { + // agent if (config.selectedModelByRole.chat?.baseAgentSystemMessage) { rules.unshift({ rule: config.selectedModelByRole.chat?.baseAgentSystemMessage, - source: "model-agent-options", + source: "model-options-agent", }); } else { rules.unshift({ @@ -228,15 +245,16 @@ export function RulesSection() { }); } } else { - if (config.selectedModelByRole.chat?.baseChatSystemMessage) { + // plan + if (config.selectedModelByRole.chat?.basePlanSystemMessage) { rules.unshift({ - rule: config.selectedModelByRole.chat?.baseChatSystemMessage, - source: "model-chat-options", + rule: config.selectedModelByRole.chat?.basePlanSystemMessage, + source: "model-options-plan", }); } else { rules.unshift({ - rule: DEFAULT_CHAT_SYSTEM_MESSAGE, - source: "default-chat", + rule: DEFAULT_AGENT_SYSTEM_MESSAGE, + source: "default-agent", }); } } 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 eec72c7fe..718051103 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx @@ -27,7 +27,6 @@ const ModeBadge = ({ text, onClick, isSelected, icon }: ModeBadgeProps) => { export const ToolPoliciesSection = () => { const mode = useAppSelector((state) => state.session.mode); - const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); const availableTools = useAppSelector((state) => state.config.config.tools); const toolGroupSettings = useAppSelector( (store) => store.ui.toolGroupSettings, @@ -62,11 +61,10 @@ export const ToolPoliciesSection = () => { const allToolsOff = mode === "chat"; - const pseudoMode = mode === "chat" ? "chat" : readOnlyMode ? "plan" : "act"; const message = - pseudoMode === "chat" + mode === "chat" ? "All tools are disabled in Chat mode" - : pseudoMode === "plan" + : mode === "plan" ? "Plan mode: only MCP and read-only tools" : "Act mode: all tool policies apply"; diff --git a/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx b/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx index 12bd90811..4bc45e3a3 100644 --- a/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx +++ b/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx @@ -19,9 +19,11 @@ const getSourceLabel = (source: RuleSource): string => { return "Default Chat"; case "default-agent": return "Default Agent"; - case "model-chat-options": + case "model-options-chat": return "Model Chat Options"; - case "model-agent-options": + case "model-options-plan": + return "Model Plan Options"; + case "model-options-agent": return "Model Agent Options"; case "rules-block": return "Rules Block"; diff --git a/gui/src/redux/selectors/selectActiveTools.ts b/gui/src/redux/selectors/selectActiveTools.ts index 7aae43765..2e90bbfd5 100644 --- a/gui/src/redux/selectors/selectActiveTools.ts +++ b/gui/src/redux/selectors/selectActiveTools.ts @@ -1,5 +1,6 @@ import { createSelector } from "@reduxjs/toolkit"; import { Tool } from "core"; +import { BUILT_IN_GROUP_NAME } from "core/tools/builtIn"; import { RootState } from "../store"; export const selectActiveTools = createSelector( @@ -12,14 +13,18 @@ export const selectActiveTools = createSelector( (mode, tools, policies, groupPolicies): Tool[] => { if (mode === "chat") { return []; - } else if (mode === "agent") { - return tools.filter( + } else { + const enabledTools = tools.filter( (tool) => policies[tool.function.name] !== "disabled" && groupPolicies[tool.group] !== "exclude", ); - } else { - return []; + if (mode === "plan") { + return enabledTools.filter( + (t) => t.group !== BUILT_IN_GROUP_NAME || t.readonly, + ); + } + return enabledTools; } }, ); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index c48a9840d..6cd96dd8e 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -54,7 +54,6 @@ type SessionState = { mainEditorContentTrigger?: JSONContent | undefined; symbols: FileSymbolMap; mode: MessageModes; - readOnlyMode: boolean; isInEdit: boolean; codeBlockApplyStates: { states: ApplyState[]; @@ -74,7 +73,6 @@ const initialState: SessionState = { streamAborter: new AbortController(), symbols: {}, mode: "chat", - readOnlyMode: false, isInEdit: false, codeBlockApplyStates: { states: [], @@ -670,9 +668,6 @@ export const sessionSlice = createSlice({ setMode: (state, action: PayloadAction) => { state.mode = action.payload; }, - setReadOnly: (state, action: PayloadAction) => { - state.readOnlyMode = action.payload; - }, setIsInEdit: (state, action: PayloadAction) => { state.isInEdit = action.payload; }, @@ -773,7 +768,6 @@ export const { setToolGenerated, updateToolCallOutput, setMode, - setReadOnly, setIsSessionMetadataLoading, setAllSessionMetadata, addSessionMetadata, diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 40bd76160..10ecdd2e5 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -42,7 +42,6 @@ const saveSubsetFilters = [ // Persist edit mode in case closes in middle "mode", - "readOnlyMode", // higher risk to persist // codeBlockApplyStates diff --git a/gui/src/redux/thunks/edit.ts b/gui/src/redux/thunks/edit.ts index 73b65740e..4fc8bac7a 100644 --- a/gui/src/redux/thunks/edit.ts +++ b/gui/src/redux/thunks/edit.ts @@ -73,52 +73,49 @@ export const streamEditThunk = createAsyncThunk< export const exitEdit = createAsyncThunk< void, - { goToMode?: MessageModes; openNewSession?: boolean }, + { openNewSession?: boolean }, ThunkApiType ->( - "edit/exit", - async ({ goToMode, openNewSession }, { dispatch, extra, getState }) => { - const state = getState(); - const codeToEdit = state.editModeState.codeToEdit; - const isInEdit = state.session.isInEdit; - const previousModeEditorContent = - state.editModeState.previousModeEditorContent; +>("edit/exit", async ({ openNewSession }, { dispatch, extra, getState }) => { + const state = getState(); + const codeToEdit = state.editModeState.codeToEdit; + const isInEdit = state.session.isInEdit; + const previousModeEditorContent = + state.editModeState.previousModeEditorContent; - if (!isInEdit) { - return; - } + if (!isInEdit) { + return; + } - if (codeToEdit[0] && state.editModeState.applyState.numDiffs) { - extra.ideMessenger.post("rejectDiff", { - filepath: codeToEdit[0].filepath, - }); - } + if (codeToEdit[0] && state.editModeState.applyState.numDiffs) { + extra.ideMessenger.post("rejectDiff", { + filepath: codeToEdit[0].filepath, + }); + } - extra.ideMessenger.post("edit/clearDecorations", undefined); + extra.ideMessenger.post("edit/clearDecorations", undefined); - dispatch(clearCodeToEdit()); - dispatch(updateEditStateApplyState(INITIAL_EDIT_APPLY_STATE)); - dispatch(setIsInEdit(false)); + dispatch(clearCodeToEdit()); + dispatch(updateEditStateApplyState(INITIAL_EDIT_APPLY_STATE)); + dispatch(setIsInEdit(false)); - // Restore the previous editor content if available - if (previousModeEditorContent) { - dispatch(setMainEditorContentTrigger(previousModeEditorContent)); - dispatch(setPreviousModeEditorContent(undefined)); - } + // Restore the previous editor content if available + if (previousModeEditorContent) { + dispatch(setMainEditorContentTrigger(previousModeEditorContent)); + dispatch(setPreviousModeEditorContent(undefined)); + } - if (openNewSession || state.editModeState.lastNonEditSessionWasEmpty) { - dispatch(newSession()); - } else { - await dispatch( - loadLastSession({ - saveCurrentSession: false, - }), - ); - } + if (openNewSession || state.editModeState.lastNonEditSessionWasEmpty) { + dispatch(newSession()); + } else { + await dispatch( + loadLastSession({ + saveCurrentSession: false, + }), + ); + } - dispatch(setMode(goToMode ?? state.editModeState.returnToMode)); - }, -); + dispatch(setMode(state.editModeState.returnToMode)); +}); export const enterEdit = createAsyncThunk< void, diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 2d25f9e29..ab86aa85c 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -40,16 +40,12 @@ export const streamNormalInput = createAsyncThunk< // Get tools const activeTools = selectActiveTools(state); const toolsSupported = modelSupportsTools(selectedChatModel); - const readOnlyMode = state.session.readOnlyMode; - const filteredTools = readOnlyMode - ? activeTools.filter((t) => t.readonly) - : activeTools; // Construct completion options let completionOptions: LLMFullCompletionOptions = {}; - if (toolsSupported && filteredTools.length > 0) { + if (toolsSupported && activeTools.length > 0) { completionOptions = { - tools: filteredTools, + tools: activeTools, }; } @@ -119,21 +115,19 @@ export const streamNormalInput = createAsyncThunk< dispatch(addPromptCompletionPair([next.value])); try { - if (state.session.mode === "chat" || state.session.mode === "agent") { - extra.ideMessenger.post("devdata/log", { - name: "chatInteraction", - data: { - prompt: next.value.prompt, - completion: next.value.completion, - modelProvider: selectedChatModel.underlyingProviderName, - modelTitle: selectedChatModel.title, - sessionId: state.session.id, - ...(state.session.mode === "agent" && { - tools: filteredTools.map((tool) => tool.function.name), - }), - }, - }); - } + extra.ideMessenger.post("devdata/log", { + name: "chatInteraction", + data: { + prompt: next.value.prompt, + completion: next.value.completion, + modelProvider: selectedChatModel.underlyingProviderName, + modelTitle: selectedChatModel.title, + sessionId: state.session.id, + ...(!!activeTools.length && { + tools: activeTools.map((tool) => tool.function.name), + }), + }, + }); // else if (state.session.mode === "edit") { // extra.ideMessenger.post("devdata/log", { // name: "editInteraction", diff --git a/gui/src/redux/thunks/streamThunkWrapper.tsx b/gui/src/redux/thunks/streamThunkWrapper.tsx index 9e40f4f06..00de92227 100644 --- a/gui/src/redux/thunks/streamThunkWrapper.tsx +++ b/gui/src/redux/thunks/streamThunkWrapper.tsx @@ -13,7 +13,7 @@ export const streamThunkWrapper = createAsyncThunk< try { await runStream(); const state = getState(); - if (state.session.mode === "chat" || state.session.mode === "agent") { + if (!state.session.isInEdit) { await dispatch( saveCurrentSession({ openNewSession: false, diff --git a/gui/src/redux/util/constructMessages.test.ts b/gui/src/redux/util/constructMessages.test.ts index 18ab0ed45..b1d808662 100644 --- a/gui/src/redux/util/constructMessages.test.ts +++ b/gui/src/redux/util/constructMessages.test.ts @@ -12,6 +12,7 @@ import { import { DEFAULT_AGENT_SYSTEM_MESSAGE, DEFAULT_CHAT_SYSTEM_MESSAGE, + DEFAULT_PLAN_SYSTEM_MESSAGE, } from "core/llm/defaultSystemMessages"; import { renderChatMessage } from "core/util/messageContent"; import { beforeEach, describe, expect, test, vi } from "vitest"; @@ -90,8 +91,9 @@ vi.mock("core/llm/rules/getSystemMessageWithRules", async (importOriginal) => { test("getBaseSystemMessage should return the correct system message based on mode", () => { const mockModel = { - baseAgentSystemMessage: "Custom Agent System Message", baseChatSystemMessage: "Custom Chat System Message", + basePlanSystemMessage: "Custom Plan System Message", + baseAgentSystemMessage: "Custom Agent System Message", } as ModelDescription; // Test agent mode with custom message @@ -99,6 +101,11 @@ test("getBaseSystemMessage should return the correct system message based on mod "Custom Agent System Message", ); + // Test plan mode with custom message + expect(getBaseSystemMessage("plan", mockModel)).toBe( + "Custom Plan System Message", + ); + // Test chat mode with custom message expect(getBaseSystemMessage("chat", mockModel)).toBe( "Custom Chat System Message", @@ -109,6 +116,11 @@ test("getBaseSystemMessage should return the correct system message based on mod DEFAULT_AGENT_SYSTEM_MESSAGE, ); + // Test agent mode with default message + expect(getBaseSystemMessage("plan", {} as ModelDescription)).toBe( + DEFAULT_PLAN_SYSTEM_MESSAGE, + ); + // Test chat mode with default message expect(getBaseSystemMessage("chat", {} as ModelDescription)).toBe( DEFAULT_CHAT_SYSTEM_MESSAGE, diff --git a/gui/src/redux/util/constructMessages.ts b/gui/src/redux/util/constructMessages.ts index 15f8120db..566608d67 100644 --- a/gui/src/redux/util/constructMessages.ts +++ b/gui/src/redux/util/constructMessages.ts @@ -11,6 +11,7 @@ import { import { DEFAULT_AGENT_SYSTEM_MESSAGE, DEFAULT_CHAT_SYSTEM_MESSAGE, + DEFAULT_PLAN_SYSTEM_MESSAGE, } from "core/llm/defaultSystemMessages"; import { chatMessageIsEmpty } from "core/llm/messages"; import { getSystemMessageWithRules } from "core/llm/rules/getSystemMessageWithRules"; @@ -167,6 +168,8 @@ export function getBaseSystemMessage( ): string { if (messageMode === "agent") { return model.baseAgentSystemMessage ?? DEFAULT_AGENT_SYSTEM_MESSAGE; + } else if (messageMode === "plan") { + return model.basePlanSystemMessage ?? DEFAULT_PLAN_SYSTEM_MESSAGE; } else { return model.baseChatSystemMessage ?? DEFAULT_CHAT_SYSTEM_MESSAGE; } diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 99d324ac2..103cdff55 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -85,6 +85,7 @@ export type EmbedOptions = z.infer; export const chatOptionsSchema = z.object({ baseSystemMessage: z.string().optional(), baseAgentSystemMessage: z.string().optional(), + basePlanSystemMessage: z.string().optional(), }); export type ChatOptions = z.infer; From 5789e7e1a17188bdb3743ff8653c465f0de13ff3 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Mon, 7 Jul 2025 10:39:46 -0700 Subject: [PATCH 48/82] move settings to match old location --- docs/docs/customize/deep-dives/autocomplete.mdx | 2 +- docs/docs/customize/json-reference.md | 4 ++-- docs/docs/customize/{deep-dives => }/settings.md | 0 docs/docs/customize/telemetry.mdx | 2 +- docs/docs/customize/yaml-migration.mdx | 2 +- docs/docs/guides/running-continue-without-internet.mdx | 2 +- docs/docusaurus.config.js | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) rename docs/docs/customize/{deep-dives => }/settings.md (100%) diff --git a/docs/docs/customize/deep-dives/autocomplete.mdx b/docs/docs/customize/deep-dives/autocomplete.mdx index 488667dbe..9ecc14d96 100644 --- a/docs/docs/customize/deep-dives/autocomplete.mdx +++ b/docs/docs/customize/deep-dives/autocomplete.mdx @@ -91,7 +91,7 @@ Explore autocomplete model configurations on [the hub](https://hub.continue.dev/ ### Autocomplete User Settings {/* - `Use autocomplete cache`: If on, caches completions */} -The following settings can be configured for autocompletion in the IDE extension [User Settings Page](./settings.md): +The following settings can be configured for autocompletion in the IDE extension [User Settings Page](../settings.md): - `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto` - `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt" diff --git a/docs/docs/customize/json-reference.md b/docs/docs/customize/json-reference.md index 38d876bb5..ef145c845 100644 --- a/docs/docs/customize/json-reference.md +++ b/docs/docs/customize/json-reference.md @@ -506,7 +506,7 @@ Example ### Fully deprecated settings -Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](/customize/deep-dives/settings). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. +Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](/customize/settings). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. - `allowAnonymousTelemetry`: This value will be migrated to the safest merged value (`false` if either are `false`). - `promptPath`: This value will override during migration. @@ -527,4 +527,4 @@ Some deprecated `config.json` settings are no longer stored in config and have b - `displayRawMarkdown` - `showChatScrollbar` - See [User Settings Page](/customize/deep-dives/settings) for more information about each option. + See [User Settings Page](/customize/settings) for more information about each option. diff --git a/docs/docs/customize/deep-dives/settings.md b/docs/docs/customize/settings.md similarity index 100% rename from docs/docs/customize/deep-dives/settings.md rename to docs/docs/customize/settings.md diff --git a/docs/docs/customize/telemetry.mdx b/docs/docs/customize/telemetry.mdx index aca00a5e4..73b6f5af4 100644 --- a/docs/docs/customize/telemetry.mdx +++ b/docs/docs/customize/telemetry.mdx @@ -26,6 +26,6 @@ The following usage information is collected and reported: ## How to Opt Out -You can disable anonymous telemetry by visiting the [User Settings Page](./deep-dives/settings.md) and toggling "Allow Anonymous Telemetry" off. +You can disable anonymous telemetry by visiting the [User Settings Page](./settings.md) and toggling "Allow Anonymous Telemetry" off. Alternatively in VS Code, you can disable telemetry through your VS Code settings by unchecking the "Continue: Telemetry Enabled" box (this will override the Settings Page settings). VS Code settings can be accessed with `File` > `Preferences` > `Settings` (or use the keyboard shortcut ctrl + , on Windows/Linux or cmd + , on macOS). diff --git a/docs/docs/customize/yaml-migration.mdx b/docs/docs/customize/yaml-migration.mdx index 69e27c409..5ffd50e7c 100644 --- a/docs/docs/customize/yaml-migration.mdx +++ b/docs/docs/customize/yaml-migration.mdx @@ -328,7 +328,7 @@ mcpServers: ## Deprecated configuration options -Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](./deep-dives/settings.md) (Gear Icon). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. +Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](./settings.md) (Gear Icon). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. See the [JSON Config Reference](/reference) for more information on fully deprecated options. diff --git a/docs/docs/guides/running-continue-without-internet.mdx b/docs/docs/guides/running-continue-without-internet.mdx index ec9f09384..1edea6a8e 100644 --- a/docs/docs/guides/running-continue-without-internet.mdx +++ b/docs/docs/guides/running-continue-without-internet.mdx @@ -7,6 +7,6 @@ keywords: [no internet, air-gapped, local model] Continue can be run even on an air-gapped computer if you use a local model. Only a few adjustments are required for this to work. 1. Download the latest .vsix file from the [Open VSX Registry](https://open-vsx.org/extension/Continue/continue) and [install it to VS Code](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix). -2. Open the [User Settings Page](../customize/deep-dives/settings.md) and turn off "Allow Anonymous Telemetry". This will stop Continue from attempting requests to PostHog for [anonymous telemetry](../customize/telemetry.mdx). +2. Open the [User Settings Page](../customize/settings.md) and turn off "Allow Anonymous Telemetry". This will stop Continue from attempting requests to PostHog for [anonymous telemetry](../customize/telemetry.mdx). 3. Also in `config.json`, set the default model to a local model. You can available options [here](../customize/model-providers/top-level/openai.mdx). 4. Restart VS Code to ensure that the changes to `config.json` or `config.yaml` take effect. diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 1632d0eb7..b1cf831ca 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -254,8 +254,8 @@ const config = { from: ["/install/vscode", "/install/jetbrains"], }, { - to: "/customize/deep-dives/settings", - from: "/advanced/deep-dives/settings", + to: "/customize/settings", + from: ["/advanced/deep-dives/settings", "/customize/deep-dives/settings"], }, { to: "/customize/model-roles/intro", From 518e18df43b766810c66b2c610432a97b73ddd95 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:45:24 -0700 Subject: [PATCH 49/82] update plan mode system message --- core/llm/defaultSystemMessages.ts | 19 ++++++++++++++----- .../mainInput/Lump/sections/RulesSection.tsx | 15 +++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/core/llm/defaultSystemMessages.ts b/core/llm/defaultSystemMessages.ts index e51ea0013..a6b3afc6c 100644 --- a/core/llm/defaultSystemMessages.ts +++ b/core/llm/defaultSystemMessages.ts @@ -1,7 +1,4 @@ -export const DEFAULT_CHAT_SYSTEM_MESSAGE_URL = - "https://github.com/continuedev/continue/blob/main/core/llm/defaultSystemMessages.ts"; - -export const DEFAULT_AGENT_SYSTEM_MESSAGE_URL = +export const DEFAULT_SYSTEM_MESSAGES_URL = "https://github.com/continuedev/continue/blob/main/core/llm/defaultSystemMessages.ts"; export const CODEBLOCK_FORMATTING_INSTRUCTIONS = `\ @@ -67,4 +64,16 @@ export const DEFAULT_AGENT_SYSTEM_MESSAGE = `\ ${CODEBLOCK_FORMATTING_INSTRUCTIONS} `; -export const DEFAULT_PLAN_SYSTEM_MESSAGE = DEFAULT_AGENT_SYSTEM_MESSAGE; +// The note about read-only tools is for MCP servers +// For now, all MCP tools are included so model can decide if they are read-only +export const DEFAULT_PLAN_SYSTEM_MESSAGE = `\ + + You are in plan mode, in which you help the user understand and construct a plan. + Only use read-only tools. Do not use any tools that would write to non-temporary files. + If the user wants to make changes, offer that they can switch to Agent mode to give you access to write tools to make the suggested updates. + +${CODEBLOCK_FORMATTING_INSTRUCTIONS} +${EDIT_CODE_INSTRUCTIONS} + + In plan mode, only write code when directly suggesting changes. Prioritize understanding and developing a plan. +`; diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 8a6754457..5f145a169 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -7,9 +7,8 @@ import { import { RuleWithSource } from "core"; import { DEFAULT_AGENT_SYSTEM_MESSAGE, - DEFAULT_AGENT_SYSTEM_MESSAGE_URL, DEFAULT_CHAT_SYSTEM_MESSAGE, - DEFAULT_CHAT_SYSTEM_MESSAGE_URL, + DEFAULT_SYSTEM_MESSAGES_URL, } from "core/llm/defaultSystemMessages"; import { useContext, useMemo } from "react"; import { useAuth } from "../../../../context/Auth"; @@ -52,12 +51,12 @@ const RuleCard: React.FC = ({ rule }) => { ideMessenger.post("openFile", { path: rule.ruleFile, }); - } else if (rule.source === "default-chat" && mode === "chat") { - ideMessenger.post("openUrl", DEFAULT_CHAT_SYSTEM_MESSAGE_URL); - } else if (rule.source === "default-plan" && mode === "plan") { - ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); - } else if (rule.source === "default-agent" && mode === "agent") { - ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); + } else if ( + rule.source === "default-chat" || + rule.source === "default-plan" || + rule.source === "default-agent" + ) { + ideMessenger.post("openUrl", DEFAULT_SYSTEM_MESSAGES_URL); } else { ideMessenger.post("config/openProfile", { profileId: undefined, From b855109408776508dd647db6fa17543a3fe15a58 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:46:56 -0700 Subject: [PATCH 50/82] fix tool policies copy --- .../Lump/sections/tool-policies/ToolPoliciesSection.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 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 718051103..9303f3392 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx @@ -65,8 +65,8 @@ export const ToolPoliciesSection = () => { mode === "chat" ? "All tools are disabled in Chat mode" : mode === "plan" - ? "Plan mode: only MCP and read-only tools" - : "Act mode: all tool policies apply"; + ? "Plan mode: only read-only and MCP tools" + : "Agent mode: all tool policies apply"; return ( <> From bfa6e29b7a49c289d944323bc1eda18427e0d731 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Mon, 7 Jul 2025 10:48:46 -0700 Subject: [PATCH 51/82] fix redirects --- docs/docusaurus.config.js | 105 ++++++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 21 deletions(-) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index b1cf831ca..a48bd4707 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -255,7 +255,10 @@ const config = { }, { to: "/customize/settings", - from: ["/advanced/deep-dives/settings", "/customize/deep-dives/settings"], + from: [ + "/advanced/deep-dives/settings", + "/customize/deep-dives/settings", + ], }, { to: "/customize/model-roles/intro", @@ -457,19 +460,31 @@ const config = { }, { to: "/customize/model-providers/more/cloudflare", - from: "/reference/Model Providers/cloudflare", + from: [ + "/reference/Model Providers/cloudflare", + "/advanced/model-providers/more/cloudflare", + ], }, { to: "/customize/model-providers/more/cohere", - from: "/reference/Model Providers/cohere", + from: [ + "/reference/Model Providers/cohere", + "/advanced/model-providers/more/cohere", + ], }, { to: "/customize/model-providers/more/deepinfra", - from: "/reference/Model Providers/deepinfra", + from: [ + "/reference/Model Providers/deepinfra", + "/advanced/model-providers/more/deepinfra", + ], }, { to: "/customize/model-providers/more/flowise", - from: "/reference/Model Providers/flowise", + from: [ + "/reference/Model Providers/flowise", + "/advanced/model-providers/more/flowise", + ], }, { to: "/customize/model-providers/llamastack", @@ -477,67 +492,115 @@ const config = { }, { to: "/customize/model-providers/more/huggingfaceinferenceapi", - from: "/reference/Model Providers/huggingfaceinferenceapi", + from: [ + "/reference/Model Providers/huggingfaceinferenceapi", + "/advanced/model-providers/more/huggingfaceinferenceapi", + ], }, { to: "/customize/model-providers/more/ipex_llm", - from: "/reference/Model Providers/ipex_llm", + from: [ + "/reference/Model Providers/ipex_llm", + "/advanced/model-providers/more/ipex_llm", + ], }, { to: "/customize/model-providers/more/kindo", - from: "/reference/Model Providers/kindo", + from: [ + "/reference/Model Providers/kindo", + "/advanced/model-providers/more/kindo", + ], }, { to: "/customize/model-providers/more/llamacpp", - from: "/reference/Model Providers/llamacpp", + from: [ + "/reference/Model Providers/llamacpp", + "/advanced/model-providers/more/llamacpp", + ], }, { to: "/customize/model-providers/more/llamafile", - from: "/reference/Model Providers/llamafile", + from: [ + "/reference/Model Providers/llamafile", + "/advanced/model-providers/more/llamafile", + ], }, { to: "/customize/model-providers/more/lmstudio", - from: "/reference/Model Providers/lmstudio", + from: [ + "/reference/Model Providers/lmstudio", + "/advanced/model-providers/more/lmstudio", + ], }, { to: "/customize/model-providers/more/msty", - from: "/reference/Model Providers/msty", + from: [ + "/reference/Model Providers/msty", + "/advanced/model-providers/more/msty", + ], }, { to: "/customize/model-providers/more/openrouter", - from: "/reference/Model Providers/openrouter", + from: [ + "/reference/Model Providers/openrouter", + "/advanced/model-providers/more/openrouter", + ], }, { to: "/customize/model-providers/more/replicatellm", - from: "/reference/Model Providers/replicatellm", + from: [ + "/reference/Model Providers/replicatellm", + "/advanced/model-providers/more/replicatellm", + ], }, { to: "/customize/model-providers/more/sagemaker", - from: "/reference/Model Providers/sagemaker", + from: [ + "/reference/Model Providers/sagemaker", + "/advanced/model-providers/more/sagemaker", + ], }, { to: "/customize/model-providers/more/textgenwebui", - from: "/reference/Model Providers/textgenwebui", + from: [ + "/reference/Model Providers/textgenwebui", + "/advanced/model-providers/more/textgenwebui", + ], }, { to: "/customize/model-providers/more/together", - from: "/reference/Model Providers/together", + from: [ + "/reference/Model Providers/together", + "/advanced/model-providers/more/together", + ], }, { to: "/customize/model-providers/more/novita", - from: "/reference/Model Providers/novita", + from: [ + "/reference/Model Providers/novita", + "/advanced/model-providers/more/novita", + ], }, { to: "/customize/model-providers/more/vllm", - from: "/reference/Model Providers/vllm", + from: [ + "/reference/Model Providers/vllm", + "/advanced/model-providers/more/vllm", + ], }, { to: "/customize/model-providers/more/watsonx", - from: "/reference/Model Providers/watsonx", + from: [ + "/reference/Model Providers/watsonx", + "/advanced/model-providers/more/watsonx", + ], }, { to: "/customize/model-providers/more/nebius", - from: "/reference/Model Providers/nebius", + from: [ + "/reference/Model Providers/nebius", + "/advanced/model-providers/more/nebius", + ], }, // Sidebar items that should route directly to a subpage { From 9b66433abc3fa3a00ac6a078c7fbeaa7f6fd0e62 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:52:14 -0700 Subject: [PATCH 52/82] fix tool policies logic --- .../mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index 38f9416fe..4a575a812 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -26,7 +26,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { (state) => state.ui.toolSettings[props.tool.function.name], ); const [isExpanded, setIsExpanded] = useState(false); - const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); + const mode = useAppSelector((state) => state.session.mode); useEffect(() => { if (!policy) { @@ -48,7 +48,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { const disabled = !props.isGroupEnabled || - (readOnlyMode && + (mode === "plan" && props.tool.group === BUILT_IN_GROUP_NAME && !props.tool.readonly); From b984c25b8fe2dedfa3bd35da7b52a817d42df439 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:58:40 -0700 Subject: [PATCH 53/82] cubic-feedback --- .../Lump/sections/tool-policies/ToolPolicyItem.tsx | 14 +++++++++----- gui/src/pages/gui/chat-tests/Chat.test.tsx | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index 4a575a812..edccf3923 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -118,11 +118,15 @@ function ToolPolicyItem(props: ToolDropdownItemProps) {
{ - dispatch(toggleToolSetting(props.tool.function.name)); - e.stopPropagation(); - e.preventDefault(); - }} + onClick={ + disabled + ? undefined + : (e) => { + dispatch(toggleToolSetting(props.tool.function.name)); + e.stopPropagation(); + e.preventDefault(); + } + } > {disabled || policy === "disabled" ? ( <> diff --git a/gui/src/pages/gui/chat-tests/Chat.test.tsx b/gui/src/pages/gui/chat-tests/Chat.test.tsx index d1bae6d07..b0164a437 100644 --- a/gui/src/pages/gui/chat-tests/Chat.test.tsx +++ b/gui/src/pages/gui/chat-tests/Chat.test.tsx @@ -39,7 +39,7 @@ test("should be able to toggle modes", async () => { ); }); - // Check that it switched to Plan mode + // Check that it switched to Agent mode await getElementByText("Agent"); act(() => { From 559faae1530d0abf3937ec03d87bd8f571160b2d Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 11:24:19 -0700 Subject: [PATCH 54/82] use exported diff lines limit --- core/tools/implementations/viewDiff.ts | 2 +- core/tools/implementations/viewDiff.vitest.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/tools/implementations/viewDiff.ts b/core/tools/implementations/viewDiff.ts index d3e7e2ef8..2b5da1ab8 100644 --- a/core/tools/implementations/viewDiff.ts +++ b/core/tools/implementations/viewDiff.ts @@ -2,7 +2,7 @@ import { ToolImpl } from "."; import { ContextItem } from "../.."; import { getDiffsFromCache } from "../../autocomplete/snippets/gitDiffCache"; -const DEFAULT_GIT_DIFF_LINE_LIMIT = 5000; +export const DEFAULT_GIT_DIFF_LINE_LIMIT = 5000; export const viewDiffImpl: ToolImpl = async (args, extras) => { const diffs = await getDiffsFromCache(extras.ide); // const diffs = await extras.ide.getDiff(true); diff --git a/core/tools/implementations/viewDiff.vitest.ts b/core/tools/implementations/viewDiff.vitest.ts index c9dfe211c..914e3a014 100644 --- a/core/tools/implementations/viewDiff.vitest.ts +++ b/core/tools/implementations/viewDiff.vitest.ts @@ -1,5 +1,5 @@ import { expect, test, vi } from "vitest"; -import { viewDiffImpl } from "./viewDiff"; +import { DEFAULT_GIT_DIFF_LINE_LIMIT, viewDiffImpl } from "./viewDiff"; // Mock the getDiffsFromCache function vi.mock("../../autocomplete/snippets/gitDiffCache", () => ({ @@ -37,8 +37,6 @@ test("viewDiff should not truncate diffs under line limit", async () => { }); test("viewDiff should truncate diffs exceeding line limit", async () => { - const DEFAULT_GIT_DIFF_LINE_LIMIT = 5000; - // Create a large diff that exceeds the line limit const largeDiffLines = Array(DEFAULT_GIT_DIFF_LINE_LIMIT + 1000).fill( "line content", From 714a41c1d8b43e1982d3201f701454743fe52e69 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:26:26 -0700 Subject: [PATCH 55/82] feat: add comprehensive PR compliance checks workflow --- .github/workflows/conventional-commit.yaml | 315 +++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 .github/workflows/conventional-commit.yaml diff --git a/.github/workflows/conventional-commit.yaml b/.github/workflows/conventional-commit.yaml new file mode 100644 index 000000000..92de63175 --- /dev/null +++ b/.github/workflows/conventional-commit.yaml @@ -0,0 +1,315 @@ +name: PR Compliance Checks + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: [main] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + conventional-commits: + name: Validate Conventional Commits (Warning Only) + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + continue-on-error: true + permissions: + pull-requests: write + issues: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate conventional commits + uses: wagoid/commitlint-github-action@v6 + with: + configFile: .commitlintrc.warning.json + continue-on-error: true + + - name: Add commit message guidance comment + if: failure() + uses: actions/github-script@v7 + with: + script: | + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('Conventional Commit Format') + ); + + if (!botComment) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: [ + "## ⚠️ Conventional Commit Format", + "", + "Your commit messages don't follow the conventional commit format, but **this won't block your PR from being merged**.", + "", + "### Expected Format:", + "```", + "[optional scope]: ", + "", + "[optional body]", + "", + "[optional footer(s)]", + "```", + "", + "### Examples:", + "- `feat: add changelog generation support`", + "- `fix: resolve login redirect issue`", + "- `docs: update README with new instructions`", + "- `chore: update dependencies`", + "", + "### Valid Types:", + "`feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`", + "", + "This helps with:", + "- 📝 Automatic changelog generation", + "- 🚀 Automated semantic versioning", + "- 📊 Better project history tracking", + "", + "*This is a non-blocking warning - your PR can still be merged without fixing this.*" + ].join('\n') + }); + } + + code-quality: + name: Code Quality Checks + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Run TypeScript type checking + run: npm run build + + - name: Debug environment + run: | + echo "Node version: $(node --version)" + echo "NPM version: $(npm --version)" + echo "Current directory: $(pwd)" + echo "Package.json type: $(node -p 'JSON.parse(require("fs").readFileSync("package.json", "utf8")).type')" + ls -la node_modules/@nivo/ || echo "@nivo not found" + ls -la node_modules/d3-interpolate/ || echo "d3-interpolate not found" + + - name: Run tests + run: npm test -- --coverage --passWithNoTests --reporter=verbose + env: + VITE_OPENAI_API_KEY: test-key-for-ci + NODE_OPTIONS: "--unhandled-rejections=strict" + + - name: Upload coverage reports + uses: codecov/codecov-action@v4 + with: + file: ./coverage/lcov.info + fail_ci_if_error: false + + security-audit: + name: Security Audit + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + permissions: + security-events: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Fix vulnerabilities + run: npm audit fix + + - name: Run npm audit + run: npm audit --audit-level=moderate + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: javascript + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + + bundle-size: + name: Bundle Size Impact + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Build application + run: npm run build:prod + + - name: Analyze bundle size + run: | + echo "## Bundle Size Analysis" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Get bundle sizes + if [ -d "dist" ]; then + echo "### JavaScript Bundles:" >> $GITHUB_STEP_SUMMARY + find dist -name "*.js" -not -name "*.map" -exec du -h {} \; | sort -hr | head -10 >> $GITHUB_STEP_SUMMARY + + echo "" >> $GITHUB_STEP_SUMMARY + echo "### CSS Bundles:" >> $GITHUB_STEP_SUMMARY + find dist -name "*.css" -exec du -h {} \; | sort -hr >> $GITHUB_STEP_SUMMARY + + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Total Size:" >> $GITHUB_STEP_SUMMARY + du -sh dist >> $GITHUB_STEP_SUMMARY + + # Check if bundle sizes are reasonable (warn if JS > 2MB) + total_js_size=$(find dist -name "*.js" -not -name "*.map" -exec stat -c%s {} \; | awk '{sum+=$1} END {print sum}') + if [ "$total_js_size" -gt 2097152 ]; then + echo "⚠️ **Warning**: Total JavaScript bundle size is $(( total_js_size / 1024 / 1024 ))MB" >> $GITHUB_STEP_SUMMARY + else + echo "✅ Bundle size looks good!" >> $GITHUB_STEP_SUMMARY + fi + else + echo "❌ No dist folder found" >> $GITHUB_STEP_SUMMARY + fi + + file-validation: + name: Required Files Check + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check required files + run: | + required_files=( + "package.json" + "README.md" + "LICENSE" + ".gitignore" + "tsconfig.json" + ) + + missing_files=() + for file in "${required_files[@]}"; do + if [[ ! -f "$file" ]]; then + missing_files+=("$file") + fi + done + + if [[ ${#missing_files[@]} -gt 0 ]]; then + echo "❌ Missing required files:" + printf '%s\n' "${missing_files[@]}" + exit 1 + else + echo "✅ All required files present" + fi + + pr-labels: + name: PR Label Management + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + permissions: + pull-requests: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Auto-label PR based on changes + uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/pr-labeler.yml + + compliance-summary: + name: Compliance Summary + runs-on: ubuntu-latest + needs: + [ + conventional-commits, + code-quality, + security-audit, + bundle-size, + file-validation, + pr-labels, + ] + if: always() && !github.event.pull_request.draft + steps: + - name: Check compliance status + run: | + echo "## 🔍 Compliance Check Results" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + if [[ "${{ needs.conventional-commits.result }}" == "success" ]]; then + echo "✅ Conventional Commits: PASSED" >> $GITHUB_STEP_SUMMARY + elif [[ "${{ needs.conventional-commits.result }}" == "failure" ]]; then + echo "⚠️ Conventional Commits: WARNING (non-blocking)" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Conventional Commits: SKIPPED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.code-quality.result }}" == "success" ]]; then + echo "✅ Code Quality: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Code Quality: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.security-audit.result }}" == "success" ]]; then + echo "✅ Security Audit: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Security Audit: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.bundle-size.result }}" == "success" ]]; then + echo "✅ Bundle Size: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Bundle Size: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.file-validation.result }}" == "success" ]]; then + echo "✅ File Validation: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ File Validation: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + echo "" >> $GITHUB_STEP_SUMMARY + echo "📊 **Overall Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY From 8b8a8123e7515fb633e308085219315a26dd9fe5 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:37:36 -0700 Subject: [PATCH 56/82] update compliance.yaml --- ...nventional-commit.yaml => compliance.yaml} | 139 ++---------------- 1 file changed, 10 insertions(+), 129 deletions(-) rename .github/workflows/{conventional-commit.yaml => compliance.yaml} (58%) diff --git a/.github/workflows/conventional-commit.yaml b/.github/workflows/compliance.yaml similarity index 58% rename from .github/workflows/conventional-commit.yaml rename to .github/workflows/compliance.yaml index 92de63175..ad3828d7f 100644 --- a/.github/workflows/conventional-commit.yaml +++ b/.github/workflows/compliance.yaml @@ -86,47 +86,6 @@ jobs: }); } - code-quality: - name: Code Quality Checks - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Run TypeScript type checking - run: npm run build - - - name: Debug environment - run: | - echo "Node version: $(node --version)" - echo "NPM version: $(npm --version)" - echo "Current directory: $(pwd)" - echo "Package.json type: $(node -p 'JSON.parse(require("fs").readFileSync("package.json", "utf8")).type')" - ls -la node_modules/@nivo/ || echo "@nivo not found" - ls -la node_modules/d3-interpolate/ || echo "d3-interpolate not found" - - - name: Run tests - run: npm test -- --coverage --passWithNoTests --reporter=verbose - env: - VITE_OPENAI_API_KEY: test-key-for-ci - NODE_OPTIONS: "--unhandled-rejections=strict" - - - name: Upload coverage reports - uses: codecov/codecov-action@v4 - with: - file: ./coverage/lcov.info - fail_ci_if_error: false - security-audit: name: Security Audit runs-on: ubuntu-latest @@ -141,7 +100,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "20" + node-version-file: ".nvmrc" cache: "npm" - name: Install dependencies @@ -161,55 +120,8 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 - bundle-size: - name: Bundle Size Impact - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Build application - run: npm run build:prod - - - name: Analyze bundle size - run: | - echo "## Bundle Size Analysis" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - # Get bundle sizes - if [ -d "dist" ]; then - echo "### JavaScript Bundles:" >> $GITHUB_STEP_SUMMARY - find dist -name "*.js" -not -name "*.map" -exec du -h {} \; | sort -hr | head -10 >> $GITHUB_STEP_SUMMARY - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### CSS Bundles:" >> $GITHUB_STEP_SUMMARY - find dist -name "*.css" -exec du -h {} \; | sort -hr >> $GITHUB_STEP_SUMMARY - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Total Size:" >> $GITHUB_STEP_SUMMARY - du -sh dist >> $GITHUB_STEP_SUMMARY - - # Check if bundle sizes are reasonable (warn if JS > 2MB) - total_js_size=$(find dist -name "*.js" -not -name "*.map" -exec stat -c%s {} \; | awk '{sum+=$1} END {print sum}') - if [ "$total_js_size" -gt 2097152 ]; then - echo "⚠️ **Warning**: Total JavaScript bundle size is $(( total_js_size / 1024 / 1024 ))MB" >> $GITHUB_STEP_SUMMARY - else - echo "✅ Bundle size looks good!" >> $GITHUB_STEP_SUMMARY - fi - else - echo "❌ No dist folder found" >> $GITHUB_STEP_SUMMARY - fi - + # Use this for any files that we want to be certain exist + # Basically creates a forcing function to discuss were anyone to want to remove them file-validation: name: Required Files Check runs-on: ubuntu-latest @@ -222,10 +134,16 @@ jobs: run: | required_files=( "package.json" + "package-lock.json" "README.md" "LICENSE" ".gitignore" "tsconfig.json" + "SECURITY.md" + "CONTRIBUTING.md" + ".nvmrc" + ".prettierrc" + ".prettierignore" ) missing_files=() @@ -243,35 +161,10 @@ jobs: echo "✅ All required files present" fi - pr-labels: - name: PR Label Management - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - permissions: - pull-requests: write - contents: read - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Auto-label PR based on changes - uses: actions/labeler@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/pr-labeler.yml - compliance-summary: name: Compliance Summary runs-on: ubuntu-latest - needs: - [ - conventional-commits, - code-quality, - security-audit, - bundle-size, - file-validation, - pr-labels, - ] + needs: [conventional-commits, security-audit, file-validation] if: always() && !github.event.pull_request.draft steps: - name: Check compliance status @@ -287,24 +180,12 @@ jobs: echo "❌ Conventional Commits: SKIPPED" >> $GITHUB_STEP_SUMMARY fi - if [[ "${{ needs.code-quality.result }}" == "success" ]]; then - echo "✅ Code Quality: PASSED" >> $GITHUB_STEP_SUMMARY - else - echo "❌ Code Quality: FAILED" >> $GITHUB_STEP_SUMMARY - fi - if [[ "${{ needs.security-audit.result }}" == "success" ]]; then echo "✅ Security Audit: PASSED" >> $GITHUB_STEP_SUMMARY else echo "❌ Security Audit: FAILED" >> $GITHUB_STEP_SUMMARY fi - if [[ "${{ needs.bundle-size.result }}" == "success" ]]; then - echo "✅ Bundle Size: PASSED" >> $GITHUB_STEP_SUMMARY - else - echo "❌ Bundle Size: FAILED" >> $GITHUB_STEP_SUMMARY - fi - if [[ "${{ needs.file-validation.result }}" == "success" ]]; then echo "✅ File Validation: PASSED" >> $GITHUB_STEP_SUMMARY else From 2c8fd74cd13250295c55956ba7db6d7c02daaa15 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:46:02 -0700 Subject: [PATCH 57/82] fix: comment with guidance --- .github/workflows/compliance.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml index ad3828d7f..9875695ef 100644 --- a/.github/workflows/compliance.yaml +++ b/.github/workflows/compliance.yaml @@ -27,13 +27,14 @@ jobs: fetch-depth: 0 - name: Validate conventional commits + id: commitlint uses: wagoid/commitlint-github-action@v6 with: configFile: .commitlintrc.warning.json continue-on-error: true - name: Add commit message guidance comment - if: failure() + if: steps.commitlint.outcome == 'failure' uses: actions/github-script@v7 with: script: | From 81c80ebf52c199fc0aed8bd45d5724e9a00a8f33 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:49:03 -0700 Subject: [PATCH 58/82] ci: add link to recommended extension for conv commits --- .github/workflows/compliance.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml index 9875695ef..13dbdc9f3 100644 --- a/.github/workflows/compliance.yaml +++ b/.github/workflows/compliance.yaml @@ -57,7 +57,7 @@ jobs: body: [ "## ⚠️ Conventional Commit Format", "", - "Your commit messages don't follow the conventional commit format, but **this won't block your PR from being merged**.", + "Your commit messages don't follow the conventional commit format, but **this won't block your PR from being merged**. We recommend downloading [this extension](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits) if you are using VS Code.", "", "### Expected Format:", "```", From 860174eaa420b6010ae9c5dc89d82d35d76f9c8f Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 13:04:50 -0700 Subject: [PATCH 59/82] fix typo --- gui/src/components/ModeSelect/ModeSelect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/ModeSelect/ModeSelect.tsx b/gui/src/components/ModeSelect/ModeSelect.tsx index 224799184..9de391852 100644 --- a/gui/src/components/ModeSelect/ModeSelect.tsx +++ b/gui/src/components/ModeSelect/ModeSelect.tsx @@ -123,7 +123,7 @@ export function ModeSelect() { zIndex: 200001, }} > - In Plan mode, only use read-only and MCP tools are enabled + In Plan mode, only read-only and MCP tools are enabled
{agentModeSupported ? ( From d92e198b0e473544a51f31b17a3b780c9b718aef Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 13:30:49 -0700 Subject: [PATCH 60/82] make find/replace tool available by default for claude --- core/tools/index.ts | 13 +++--- gui/src/redux/thunks/streamNormalInput.ts | 51 +++++++++++++++++++++-- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/core/tools/index.ts b/core/tools/index.ts index 198438eb1..95e0ac50f 100644 --- a/core/tools/index.ts +++ b/core/tools/index.ts @@ -39,14 +39,13 @@ export const getConfigDependentToolDefinitions = ( params: ConfigDependentToolParams, ): Tool[] => [ requestRuleTool(params), + // Search and replace is now generally available + searchAndReplaceInFileTool, + // Keep edit file tool available for models that need it + editFileTool, ...(params.enableExperimentalTools - ? [ - searchAndReplaceInFileTool, - viewRepoMapTool, - viewSubdirectoryTool, - codebaseTool, - ] - : [editFileTool]), + ? [viewRepoMapTool, viewSubdirectoryTool, codebaseTool] + : []), ]; export const getToolsForIde = async (ide: IDE): Promise => diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index c7c4de02d..ace25915e 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -1,7 +1,8 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; -import { LLMFullCompletionOptions } from "core"; +import { LLMFullCompletionOptions, ModelDescription, Tool } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; import { ToCoreProtocol } from "core/protocol"; +import { BuiltInToolNames } from "core/tools/builtIn"; import { selectActiveTools } from "../selectors/selectActiveTools"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { selectSelectedChatModel } from "../slices/configSlice"; @@ -21,6 +22,49 @@ import { } from "../util/constructMessages"; import { callCurrentTool } from "./callCurrentTool"; +/** + * Filters tools based on the selected model's capabilities. + * Returns either the edit file tool or search and replace tool, but not both. + */ +function filterToolsForModel( + tools: Tool[], + selectedModel: ModelDescription, +): Tool[] { + const editFileTool = tools.find( + (tool) => tool.function.name === BuiltInToolNames.EditExistingFile, + ); + const searchAndReplaceTool = tools.find( + (tool) => tool.function.name === BuiltInToolNames.SearchAndReplaceInFile, + ); + + // If we don't have both tools, return tools as-is + if (!editFileTool || !searchAndReplaceTool) { + return tools; + } + + // Determine which tool to use based on the model + const shouldUseFindReplace = shouldUseFindReplaceEdits(selectedModel); + + // Filter out the unwanted tool + return tools.filter((tool) => { + if (tool.function.name === BuiltInToolNames.EditExistingFile) { + return !shouldUseFindReplace; + } + if (tool.function.name === BuiltInToolNames.SearchAndReplaceInFile) { + return shouldUseFindReplace; + } + return true; + }); +} + +/** + * Determines whether to use search and replace tool instead of edit file + * Right now we only know that this is reliable with Claude models + */ +function shouldUseFindReplaceEdits(model: ModelDescription): boolean { + return model.model.includes("claude"); +} + export const streamNormalInput = createAsyncThunk< void, { @@ -37,8 +81,9 @@ export const streamNormalInput = createAsyncThunk< throw new Error("No chat model selected"); } - // Get tools - const activeTools = selectActiveTools(state); + // Get tools and filter them based on the selected model + const allActiveTools = selectActiveTools(state); + const activeTools = filterToolsForModel(allActiveTools, selectedChatModel); const toolsSupported = modelSupportsTools(selectedChatModel); // Construct completion options From ee12f2bd6598df009dab11cbc3f79ec5e2a3d5cb Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 14:56:30 -0700 Subject: [PATCH 61/82] WIP: bedrock openai adapter --- core/llm/llms/Bedrock.ts | 38 +- packages/openai-adapters/package-lock.json | 1428 ++++++++++++++++++ packages/openai-adapters/package.json | 1 + packages/openai-adapters/src/apis/Bedrock.ts | 705 +++++++++ packages/openai-adapters/src/index.ts | 3 + packages/openai-adapters/src/types.ts | 13 + 6 files changed, 2178 insertions(+), 10 deletions(-) create mode 100644 packages/openai-adapters/src/apis/Bedrock.ts diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 1c1c61ed3..cf13edd6a 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -21,6 +21,7 @@ import { import { safeParseToolCallArgs } from "../../tools/parseArgs.js"; import { renderChatMessage, stripImages } from "../../util/messageContent.js"; import { BaseLLM } from "../index.js"; +import { LlmApiRequestType } from "../openaiTypeConverters.js"; import { PROVIDER_TOOL_SUPPORT } from "../toolSupport.js"; import { getSecureID } from "../utils/getSecureID.js"; @@ -47,6 +48,7 @@ interface PromptCachingMetrics { } class Bedrock extends BaseLLM { + protected useOpenAIAdapterFor: (LlmApiRequestType | "*")[] = ["*"]; static providerName = "bedrock"; static defaultOptions: Partial = { region: "us-east-1", @@ -76,6 +78,7 @@ class Bedrock extends BaseLLM { } else { this.profile = "bedrock"; } + this.requestOptions = { region: options.region, headers: {}, @@ -609,17 +612,32 @@ class Bedrock extends BaseLLM { } private async _getCredentials() { - try { - return await fromNodeProviderChain({ - profile: this.profile, - ignoreCache: true, - })(); - } catch (e) { - console.warn( - `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, - ); - return await fromNodeProviderChain()(); + if (this.apiKey) { + const [accessKeyId, secretAccessKey] = this.apiKey.split(":"); + if (!accessKeyId || !secretAccessKey) { + throw new Error( + "Invalid Bedrock API key format. Expected format: accessKeyId:secretAccessKey", + ); + } + return { + accessKeyId, + secretAccessKey, + }; } + + if (this.profile) { + try { + return await fromNodeProviderChain({ + profile: this.profile, + ignoreCache: true, + })(); + } catch (e) { + console.warn( + `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, + ); + } + } + return await fromNodeProviderChain()(); } // EMBED // diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 0782d06d8..86228c0d9 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.44", "license": "Apache-2.0", "dependencies": { + "@aws-sdk/client-bedrock-runtime": "^3.842.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", @@ -42,6 +43,731 @@ "node": ">=6.0.0" } }, + "node_modules/@aws-crypto/crc32": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", + "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", + "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-js": "^5.2.0", + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/supports-web-crypto": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", + "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-bedrock-runtime": { + "version": "3.842.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.842.0.tgz", + "integrity": "sha512-CrGuU9YGqYZPm2hjjqJYC5+HMjky/HuvlUmboFDdpH96mwm/RrUQAO6sXYojeUPy9ceidUiHd3HskqvpiMTl2Q==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-node": "3.840.0", + "@aws-sdk/eventstream-handler-node": "3.840.0", + "@aws-sdk/middleware-eventstream": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/middleware-websocket": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/token-providers": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/eventstream-serde-browser": "^4.0.4", + "@smithy/eventstream-serde-config-resolver": "^4.1.2", + "@smithy/eventstream-serde-node": "^4.0.4", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-stream": "^4.2.2", + "@smithy/util-utf8": "^4.0.0", + "@types/uuid": "^9.0.1", + "tslib": "^2.6.2", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/client-bedrock-runtime/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@aws-sdk/client-sso": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.840.0.tgz", + "integrity": "sha512-3Zp+FWN2hhmKdpS0Ragi5V2ZPsZNScE3jlbgoJjzjI/roHZqO+e3/+XFN4TlM0DsPKYJNp+1TAjmhxN6rOnfYA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/core": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.840.0.tgz", + "integrity": "sha512-x3Zgb39tF1h2XpU+yA4OAAQlW6LVEfXNlSedSYJ7HGKXqA/E9h3rWQVpYfhXXVVsLdYXdNw5KBUkoAoruoZSZA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@aws-sdk/xml-builder": "3.821.0", + "@smithy/core": "^3.6.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/signature-v4": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-utf8": "^4.0.0", + "fast-xml-parser": "4.4.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.840.0.tgz", + "integrity": "sha512-EzF6VcJK7XvQ/G15AVEfJzN2mNXU8fcVpXo4bRyr1S6t2q5zx6UPH/XjDbn18xyUmOq01t+r8gG+TmHEVo18fA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.840.0.tgz", + "integrity": "sha512-wbnUiPGLVea6mXbUh04fu+VJmGkQvmToPeTYdHE8eRZq3NRDi3t3WltT+jArLBKD/4NppRpMjf2ju4coMCz91g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/util-stream": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.840.0.tgz", + "integrity": "sha512-7F290BsWydShHb+7InXd+IjJc3mlEIm9I0R57F/Pjl1xZB69MdkhVGCnuETWoBt4g53ktJd6NEjzm/iAhFXFmw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-env": "3.840.0", + "@aws-sdk/credential-provider-http": "3.840.0", + "@aws-sdk/credential-provider-process": "3.840.0", + "@aws-sdk/credential-provider-sso": "3.840.0", + "@aws-sdk/credential-provider-web-identity": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.840.0.tgz", + "integrity": "sha512-KufP8JnxA31wxklLm63evUPSFApGcH8X86z3mv9SRbpCm5ycgWIGVCTXpTOdgq6rPZrwT9pftzv2/b4mV/9clg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.840.0", + "@aws-sdk/credential-provider-http": "3.840.0", + "@aws-sdk/credential-provider-ini": "3.840.0", + "@aws-sdk/credential-provider-process": "3.840.0", + "@aws-sdk/credential-provider-sso": "3.840.0", + "@aws-sdk/credential-provider-web-identity": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.840.0.tgz", + "integrity": "sha512-HkDQWHy8tCI4A0Ps2NVtuVYMv9cB4y/IuD/TdOsqeRIAT12h8jDb98BwQPNLAImAOwOWzZJ8Cu0xtSpX7CQhMw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.840.0.tgz", + "integrity": "sha512-2qgdtdd6R0Z1y0KL8gzzwFUGmhBHSUx4zy85L2XV1CXhpRNwV71SVWJqLDVV5RVWVf9mg50Pm3AWrUC0xb0pcA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-sso": "3.840.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/token-providers": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.840.0.tgz", + "integrity": "sha512-dpEeVXG8uNZSmVXReE4WP0lwoioX2gstk4RnUgrdUE3YaPq8A+hJiVAyc3h+cjDeIqfbsQbZm9qFetKC2LF9dQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/eventstream-handler-node": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.840.0.tgz", + "integrity": "sha512-m/zVrSSAEHq+6h4sy0JUEBScB1pGgs/1+iRVhfzfbnf+/gTr4ut2jRq4tDiNEX9pQ1oFVvw+ntPua5qfquQeRQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/eventstream-codec": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-eventstream": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-eventstream/-/middleware-eventstream-3.840.0.tgz", + "integrity": "sha512-4khgf7AjJ4llh3aiNmZ+x4PGl4vkKNxRHn0xTgi6Iw1J3SChsF2mnNaLXK8hoXeydx756rw+JhqOuZH91i5l4w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-host-header": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.840.0.tgz", + "integrity": "sha512-ub+hXJAbAje94+Ya6c6eL7sYujoE8D4Bumu1NUI8TXjUhVVn0HzVWQjpRLshdLsUp1AW7XyeJaxyajRaJQ8+Xg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-logger": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.840.0.tgz", + "integrity": "sha512-lSV8FvjpdllpGaRspywss4CtXV8M7NNNH+2/j86vMH+YCOZ6fu2T/TyFd/tHwZ92vDfHctWkRbQxg0bagqwovA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.840.0.tgz", + "integrity": "sha512-Gu7lGDyfddyhIkj1Z1JtrY5NHb5+x/CRiB87GjaSrKxkDaydtX2CU977JIABtt69l9wLbcGDIQ+W0uJ5xPof7g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.840.0.tgz", + "integrity": "sha512-hiiMf7BP5ZkAFAvWRcK67Mw/g55ar7OCrvrynC92hunx/xhMkrgSLM0EXIZ1oTn3uql9kH/qqGF0nqsK6K555A==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@smithy/core": "^3.6.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-websocket": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-websocket/-/middleware-websocket-3.840.0.tgz", + "integrity": "sha512-v9jJD1zjKMUg8iEZlFP5TLY7+DdwKodLgkNtls34+LMRbW+7Bue+H3gPi1VML5sks2o/+PJ6fz58Wo3bXZ8XHA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-format-url": "3.840.0", + "@smithy/eventstream-codec": "^4.0.4", + "@smithy/eventstream-serde-browser": "^4.0.4", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/signature-v4": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@aws-sdk/nested-clients": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.840.0.tgz", + "integrity": "sha512-LXYYo9+n4hRqnRSIMXLBb+BLz+cEmjMtTudwK1BF6Bn2RfdDv29KuyeDRrPCS3TwKl7ZKmXUmE9n5UuHAPfBpA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/region-config-resolver": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.840.0.tgz", + "integrity": "sha512-Qjnxd/yDv9KpIMWr90ZDPtRj0v75AqGC92Lm9+oHXZ8p1MjG5JE2CW0HL8JRgK9iKzgKBL7pPQRXI8FkvEVfrA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "@smithy/util-config-provider": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/token-providers": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.840.0.tgz", + "integrity": "sha512-6BuTOLTXvmgwjK7ve7aTg9JaWFdM5UoMolLVPMyh3wTv9Ufalh8oklxYHUBIxsKkBGO2WiHXytveuxH6tAgTYg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/types": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.840.0.tgz", + "integrity": "sha512-xliuHaUFZxEx1NSXeLLZ9Dyu6+EJVQKEoD+yM+zqUo3YDZ7medKJWY6fIOKiPX/N7XbLdBYwajb15Q7IL8KkeA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-endpoints": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.840.0.tgz", + "integrity": "sha512-eqE9ROdg/Kk0rj3poutyRCFauPDXIf/WSvCqFiRDDVi6QOnCv/M0g2XW8/jSvkJlOyaXkNCptapIp6BeeFFGYw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "@smithy/util-endpoints": "^3.0.6", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-format-url": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-format-url/-/util-format-url-3.840.0.tgz", + "integrity": "sha512-VB1PWyI1TQPiPvg4w7tgUGGQER1xxXPNUqfh3baxUSFi1Oh8wHrDnFywkxLm3NMmgDmnLnSZ5Q326qAoyqKLSg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-locate-window": { + "version": "3.804.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.804.0.tgz", + "integrity": "sha512-zVoRfpmBVPodYlnMjgVjfGoEZagyRF5IPn3Uo6ZvOZp24chnW/FRstH7ESDHDDRga4z3V+ElUQHKpFDXWyBW5A==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.840.0.tgz", + "integrity": "sha512-JdyZM3EhhL4PqwFpttZu1afDpPJCCc3eyZOLi+srpX11LsGj6sThf47TYQN75HT1CarZ7cCdQHGzP2uy3/xHfQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.840.0.tgz", + "integrity": "sha512-Fy5JUEDQU1tPm2Yw/YqRYYc27W5+QD/J4mYvQvdWjUGZLB5q3eLFMGD35Uc28ZFoGMufPr4OCxK/bRfWROBRHQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/xml-builder": { + "version": "3.821.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.821.0.tgz", + "integrity": "sha512-DIIotRnefVL6DiaHtO6/21DhJ4JZnnIwdNbpwiAhdt/AVbttcE4yw925gsjur0OGv5BTYXQXU3YnANBYnZjuQA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", @@ -1022,6 +1748,656 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@smithy/abort-controller": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-4.0.4.tgz", + "integrity": "sha512-gJnEjZMvigPDQWHrW3oPrFhQtkrgqBkyjj3pCIdF3A5M6vsZODG93KNlfJprv6bp4245bdT32fsHK4kkH3KYDA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/config-resolver": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-4.1.4.tgz", + "integrity": "sha512-prmU+rDddxHOH0oNcwemL+SwnzcG65sBF2yXRO7aeXIn/xTlq2pX7JLVbkBnVLowHLg4/OL4+jBmv9hVrVGS+w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "@smithy/util-config-provider": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/core": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.6.0.tgz", + "integrity": "sha512-Pgvfb+TQ4wUNLyHzvgCP4aYZMh16y7GcfF59oirRHcgGgkH1e/s9C0nv/v3WP+Quymyr5je71HeFQCwh+44XLg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/middleware-serde": "^4.0.8", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-stream": "^4.2.2", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/credential-provider-imds": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-4.0.6.tgz", + "integrity": "sha512-hKMWcANhUiNbCJouYkZ9V3+/Qf9pteR1dnwgdyzR09R4ODEYx8BbUysHwRSyex4rZ9zapddZhLFTnT4ZijR4pw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-codec": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-4.0.4.tgz", + "integrity": "sha512-7XoWfZqWb/QoR/rAU4VSi0mWnO2vu9/ltS6JZ5ZSZv0eovLVfDfu0/AX4ub33RsJTOth3TiFWSHS5YdztvFnig==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/crc32": "5.2.0", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-browser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-4.0.4.tgz", + "integrity": "sha512-3fb/9SYaYqbpy/z/H3yIi0bYKyAa89y6xPmIqwr2vQiUT2St+avRt8UKwsWt9fEdEasc5d/V+QjrviRaX1JRFA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-config-resolver": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-4.1.2.tgz", + "integrity": "sha512-JGtambizrWP50xHgbzZI04IWU7LdI0nh/wGbqH3sJesYToMi2j/DcoElqyOcqEIG/D4tNyxgRuaqBXWE3zOFhQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-node": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-4.0.4.tgz", + "integrity": "sha512-RD6UwNZ5zISpOWPuhVgRz60GkSIp0dy1fuZmj4RYmqLVRtejFqQ16WmfYDdoSoAjlp1LX+FnZo+/hkdmyyGZ1w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-universal": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-4.0.4.tgz", + "integrity": "sha512-UeJpOmLGhq1SLox79QWw/0n2PFX+oPRE1ZyRMxPIaFEfCqWaqpB7BU9C8kpPOGEhLF7AwEqfFbtwNxGy4ReENA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-codec": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/fetch-http-handler": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-5.0.4.tgz", + "integrity": "sha512-AMtBR5pHppYMVD7z7G+OlHHAcgAN7v0kVKEpHuTO4Gb199Gowh0taYi9oDStFeUhetkeP55JLSVlTW1n9rFtUw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/hash-node": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-4.0.4.tgz", + "integrity": "sha512-qnbTPUhCVnCgBp4z4BUJUhOEkVwxiEi1cyFM+Zj6o+aY8OFGxUQleKWq8ltgp3dujuhXojIvJWdoqpm6dVO3lQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/invalid-dependency": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-4.0.4.tgz", + "integrity": "sha512-bNYMi7WKTJHu0gn26wg8OscncTt1t2b8KcsZxvOv56XA6cyXtOAAAaNP7+m45xfppXfOatXF3Sb1MNsLUgVLTw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/is-array-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-4.0.0.tgz", + "integrity": "sha512-saYhF8ZZNoJDTvJBEWgeBccCg+yvp1CX+ed12yORU3NilJScfc6gfch2oVb4QgxZrGUx3/ZJlb+c/dJbyupxlw==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-content-length": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-4.0.4.tgz", + "integrity": "sha512-F7gDyfI2BB1Kc+4M6rpuOLne5LOcEknH1n6UQB69qv+HucXBR1rkzXBnQTB2q46sFy1PM/zuSJOB532yc8bg3w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-endpoint": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-4.1.13.tgz", + "integrity": "sha512-xg3EHV/Q5ZdAO5b0UiIMj3RIOCobuS40pBBODguUDVdko6YK6QIzCVRrHTogVuEKglBWqWenRnZ71iZnLL3ZAQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.6.0", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-retry": { + "version": "4.1.14", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-4.1.14.tgz", + "integrity": "sha512-eoXaLlDGpKvdmvt+YBfRXE7HmIEtFF+DJCbTPwuLunP0YUnrydl+C4tS+vEM0+nyxXrX3PSUFqC+lP1+EHB1Tw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/protocol-http": "^5.1.2", + "@smithy/service-error-classification": "^4.0.6", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "tslib": "^2.6.2", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-retry/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@smithy/middleware-serde": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-4.0.8.tgz", + "integrity": "sha512-iSSl7HJoJaGyMIoNn2B7czghOVwJ9nD7TMvLhMWeSB5vt0TnEYyRRqPJu/TqW76WScaNvYYB8nRoiBHR9S1Ddw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-stack": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-4.0.4.tgz", + "integrity": "sha512-kagK5ggDrBUCCzI93ft6DjteNSfY8Ulr83UtySog/h09lTIOAJ/xUSObutanlPT0nhoHAkpmW9V5K8oPyLh+QA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-config-provider": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-4.1.3.tgz", + "integrity": "sha512-HGHQr2s59qaU1lrVH6MbLlmOBxadtzTsoO4c+bF5asdgVik3I8o7JIOzoeqWc5MjVa+vD36/LWE0iXKpNqooRw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-http-handler": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.0.6.tgz", + "integrity": "sha512-NqbmSz7AW2rvw4kXhKGrYTiJVDHnMsFnX4i+/FzcZAfbOBauPYs2ekuECkSbtqaxETLLTu9Rl/ex6+I2BKErPA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/abort-controller": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/property-provider": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-4.0.4.tgz", + "integrity": "sha512-qHJ2sSgu4FqF4U/5UUp4DhXNmdTrgmoAai6oQiM+c5RZ/sbDwJ12qxB1M6FnP+Tn/ggkPZf9ccn4jqKSINaquw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/protocol-http": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-5.1.2.tgz", + "integrity": "sha512-rOG5cNLBXovxIrICSBm95dLqzfvxjEmuZx4KK3hWwPFHGdW3lxY0fZNXfv2zebfRO7sJZ5pKJYHScsqopeIWtQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-builder": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-4.0.4.tgz", + "integrity": "sha512-SwREZcDnEYoh9tLNgMbpop+UTGq44Hl9tdj3rf+yeLcfH7+J8OXEBaMc2kDxtyRHu8BhSg9ADEx0gFHvpJgU8w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "@smithy/util-uri-escape": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-4.0.4.tgz", + "integrity": "sha512-6yZf53i/qB8gRHH/l2ZwUG5xgkPgQF15/KxH0DdXMDHjesA9MeZje/853ifkSY0x4m5S+dfDZ+c4x439PF0M2w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/service-error-classification": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-4.0.6.tgz", + "integrity": "sha512-RRoTDL//7xi4tn5FrN2NzH17jbgmnKidUqd4KvquT0954/i6CXXkh1884jBiunq24g9cGtPBEXlU40W6EpNOOg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/shared-ini-file-loader": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-4.0.4.tgz", + "integrity": "sha512-63X0260LoFBjrHifPDs+nM9tV0VMkOTl4JRMYNuKh/f5PauSjowTfvF3LogfkWdcPoxsA9UjqEOgjeYIbhb7Nw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/signature-v4": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-5.1.2.tgz", + "integrity": "sha512-d3+U/VpX7a60seHziWnVZOHuEgJlclufjkS6zhXvxcJgkJq4UWdH5eOBLzHRMx6gXjsdT9h6lfpmLzbrdupHgQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.0.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-uri-escape": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/smithy-client": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-4.4.5.tgz", + "integrity": "sha512-+lynZjGuUFJaMdDYSTMnP/uPBBXXukVfrJlP+1U/Dp5SFTEI++w6NMga8DjOENxecOF71V9Z2DllaVDYRnGlkg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.6.0", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-stream": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.3.1.tgz", + "integrity": "sha512-UqKOQBL2x6+HWl3P+3QqFD4ncKq0I8Nuz9QItGv5WuKuMHuuwlhvqcZCoXGfc+P1QmfJE7VieykoYYmrOoFJxA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/url-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-4.0.4.tgz", + "integrity": "sha512-eMkc144MuN7B0TDA4U2fKs+BqczVbk3W+qIvcoCY6D1JY3hnAdCuhCZODC+GAeaxj0p6Jroz4+XMUn3PCxQQeQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/querystring-parser": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-base64": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-4.0.0.tgz", + "integrity": "sha512-CvHfCmO2mchox9kjrtzoHkWHxjHZzaFojLc8quxXY7WAAMAg43nuxwv95tATVgQFNDwd4M9S1qFzj40Ul41Kmg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-4.0.0.tgz", + "integrity": "sha512-sNi3DL0/k64/LO3A256M+m3CDdG6V7WKWHdAiBBMUN8S3hK3aMPhwnPik2A/a2ONN+9doY9UxaLfgqsIRg69QA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-node": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-4.0.0.tgz", + "integrity": "sha512-q0iDP3VsZzqJyje8xJWEJCNIu3lktUGVoSy1KB0UWym2CL1siV3artm+u1DFYTLejpsrdGyCSWBdGNjJzfDPjg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-buffer-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-4.0.0.tgz", + "integrity": "sha512-9TOQ7781sZvddgO8nxueKi3+yGvkY35kotA0Y6BWRajAv8jjmigQ1sBwz0UX47pQMYXJPahSKEKYFgt+rXdcug==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-config-provider": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-4.0.0.tgz", + "integrity": "sha512-L1RBVzLyfE8OXH+1hsJ8p+acNUSirQnWQ6/EgpchV88G6zGBTDPdXiiExei6Z1wR2RxYvxY/XLw6AMNCCt8H3w==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-browser": { + "version": "4.0.21", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.21.tgz", + "integrity": "sha512-wM0jhTytgXu3wzJoIqpbBAG5U6BwiubZ6QKzSbP7/VbmF1v96xlAbX2Am/mz0Zep0NLvLh84JT0tuZnk3wmYQA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.0.4", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-node": { + "version": "4.0.21", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.21.tgz", + "integrity": "sha512-/F34zkoU0GzpUgLJydHY8Rxu9lBn8xQC/s/0M0U9lLBkYbA1htaAFjWYJzpzsbXPuri5D1H8gjp2jBum05qBrA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/config-resolver": "^4.1.4", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-endpoints": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-3.0.6.tgz", + "integrity": "sha512-YARl3tFL3WgPuLzljRUnrS2ngLiUtkwhQtj8PAL13XZSyUiNLQxwG3fBBq3QXFqGFUXepIN73pINp3y8c2nBmA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-hex-encoding": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-4.0.0.tgz", + "integrity": "sha512-Yk5mLhHtfIgW2W2WQZWSg5kuMZCVbvhFmC7rV4IO2QqnZdbEFPmQnCcGMAX2z/8Qj3B9hYYNjZOhWym+RwhePw==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-middleware": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-4.0.4.tgz", + "integrity": "sha512-9MLKmkBmf4PRb0ONJikCbCwORACcil6gUWojwARCClT7RmLzF04hUR4WdRprIXal7XVyrddadYNfp2eF3nrvtQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-retry": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-4.0.6.tgz", + "integrity": "sha512-+YekoF2CaSMv6zKrA6iI/N9yva3Gzn4L6n35Luydweu5MMPYpiGZlWqehPHDHyNbnyaYlz/WJyYAZnC+loBDZg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/service-error-classification": "^4.0.6", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-stream": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-4.2.2.tgz", + "integrity": "sha512-aI+GLi7MJoVxg24/3J1ipwLoYzgkB4kUfogZfnslcYlynj3xsQ0e7vk4TnTro9hhsS5PvX1mwmkRqqHQjwcU7w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-hex-encoding": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-uri-escape": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-4.0.0.tgz", + "integrity": "sha512-77yfbCbQMtgtTylO9itEAdpPXSog3ZxMe09AEhm0dU0NLTalV70ghDZFR+Nfi1C60jnJoh/Re4090/DuZh2Omg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-utf8": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-4.0.0.tgz", + "integrity": "sha512-b+zebfKCfRdgNJDknHCob3O7FpeYQN6ZG6YLExMcasDHsCXlsXCEuiPZeLnJLpwa5dvPetGlnGCiMHuLwGvFow==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", @@ -1173,6 +2549,12 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "node_modules/@types/uuid": { + "version": "9.0.8", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", + "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==", + "license": "MIT" + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -1446,6 +2828,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==", + "license": "MIT" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2004,6 +3392,28 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "node_modules/fast-xml-parser": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", + "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -3974,6 +5384,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strnum": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz", + "integrity": "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -4151,6 +5573,12 @@ } } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index ed24b5ef8..e3d6423df 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -12,6 +12,7 @@ "author": "Nate Sesti and Ty Dunn", "license": "Apache-2.0", "dependencies": { + "@aws-sdk/client-bedrock-runtime": "^3.842.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts new file mode 100644 index 000000000..ef27890b9 --- /dev/null +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -0,0 +1,705 @@ +import { + BedrockRuntimeClient, + ContentBlock, + ConversationRole, + ConverseStreamCommand, + ConverseStreamCommandInput, + ImageFormat, + Message, + ToolConfiguration, +} from "@aws-sdk/client-bedrock-runtime"; +import { OpenAI } from "openai/index"; +import { v4 as uuidv4 } from "uuid"; + +import { + ChatCompletion, + ChatCompletionChunk, + ChatCompletionCreateParams, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + ChatCompletionMessageToolCall, + Completion, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + CreateEmbeddingResponse, + EmbeddingCreateParams, + Model, +} from "openai/resources/index"; + +import { BedrockConfig } from "../types.js"; +import { chatChunk, chatChunkFromDelta } from "../util.js"; +import { safeParseArgs } from "../util/parseArgs.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; + +// Utility function to get or generate UUID for prompt caching +function getSecureID(): string { + // Adding a type declaration for the static property + if (!(getSecureID as any).uuid) { + (getSecureID as any).uuid = crypto.randomUUID(); + } + return ``; +} + +/** + * Interface for tool use state tracking + */ +interface ToolUseState { + toolUseId: string; + name: string; + input: string; +} + +export class BedrockApi implements BaseLlmApi { + private client: BedrockRuntimeClient; + private _currentToolResponse: Partial | null = null; + + constructor(protected config: BedrockConfig) { + if (!config.env?.region) { + throw new Error("region is required for Bedrock API"); + } + if (!config.apiKey) { + throw new Error( + "apiKey in the format accessKeyId:secretAccessKey is required for Bedrock API", + ); + } + + const [accessKeyId, secretAccessKey] = config.apiKey.split(":"); + if (!accessKeyId || !secretAccessKey) { + throw new Error( + "Bedrock apiKey must be in the format accessKeyId:secretAccessKey", + ); + } + + this.client = new BedrockRuntimeClient({ + region: config.env.region, + credentials: { + accessKeyId, + secretAccessKey, + }, + }); + } + + private _oaiPartToBedrockPart( + part: + | OpenAI.Chat.Completions.ChatCompletionContentPart + | OpenAI.Chat.Completions.ChatCompletionContentPartRefusal, + ): ContentBlock { + switch (part.type) { + case "refusal": + return { + text: part.refusal, + }; + case "text": + return { + text: part.text, + }; + case "input_audio": + throw new Error("Unsupported part type: input_audio"); + case "image_url": + default: + try { + const [mimeType, base64Data] = part.image_url.url.split(","); + const format = mimeType.split("/")[1]?.split(";")[0] || "jpeg"; + if ( + format === ImageFormat.JPEG || + format === ImageFormat.PNG || + format === ImageFormat.WEBP || + format === ImageFormat.GIF + ) { + return { + image: { + format, + source: { + bytes: Uint8Array.from(Buffer.from(base64Data, "base64")), + }, + }, + }; + } else { + console.warn( + `Bedrock: skipping unsupported image part format: ${format}`, + ); + return { text: "[Unsupported image format]" }; + } + } catch (error) { + console.warn("Bedrock: failed to process image part", error); + return { text: "[Failed to process image]" }; + } + } + } + + private _convertMessages( + oaiMessages: OpenAI.Chat.Completions.ChatCompletionMessageParam[], + availableTools: Set, + ): Message[] { + let currentRole: "user" | "assistant" = "user"; + let currentBlocks: ContentBlock[] = []; + const converted: Message[] = []; + const hasAddedToolCallIds = new Set(); + + const pushCurrentMessage = () => { + if (currentBlocks.length > 0) { + converted.push({ + role: currentRole, + content: currentBlocks, + }); + currentBlocks = []; + } + }; + + const nonSystemMessages = oaiMessages.filter((m) => m.role !== "system"); + + for (let idx = 0; idx < nonSystemMessages.length; idx++) { + const message = nonSystemMessages[idx]; + + if (message.role === "user" || message.role === "tool") { + // Detect conversational turn change + if (currentRole !== ConversationRole.USER) { + pushCurrentMessage(); + currentRole = ConversationRole.USER; + } + + // USER messages + if (message.role === "user") { + const content = message.content; + if (content) { + if (typeof content === "string") { + currentBlocks.push({ text: content }); + } else { + content.forEach((part) => { + currentBlocks.push(this._oaiPartToBedrockPart(part)); + }); + } + } + } + // TOOL messages + else if (message.role === "tool") { + const trimmedContent = + typeof message.content === "string" + ? message.content.trim() + : JSON.stringify(message.content); + + if (hasAddedToolCallIds.has(message.tool_call_id)) { + currentBlocks.push({ + toolResult: { + toolUseId: message.tool_call_id, + content: [ + { + text: trimmedContent || "No tool output", + }, + ], + }, + }); + } else { + currentBlocks.push({ + text: `Tool call output for Tool Call ID ${message.tool_call_id}:\n\n${trimmedContent || "No tool output"}`, + }); + } + } + } else if (message.role === "assistant") { + // Detect conversational turn change + if (currentRole !== ConversationRole.ASSISTANT) { + pushCurrentMessage(); + currentRole = ConversationRole.ASSISTANT; + } + + // ASSISTANT messages + const content = message.content; + if (content) { + if (typeof content === "string") { + currentBlocks.push({ text: content }); + } else { + content.forEach((part) => { + currentBlocks.push(this._oaiPartToBedrockPart(part)); + }); + } + } + + // TOOL CALLS + if (message.tool_calls) { + for (const toolCall of message.tool_calls) { + if (toolCall.id && toolCall.function?.name) { + if (availableTools.has(toolCall.function.name)) { + currentBlocks.push({ + toolUse: { + toolUseId: toolCall.id, + name: toolCall.function.name, + input: safeParseArgs( + toolCall.function.arguments, + `Call: ${toolCall.function.name} ${toolCall.id}`, + ), + }, + }); + hasAddedToolCallIds.add(toolCall.id); + } else { + const toolCallText = `Assistant tool call:\nTool name: ${toolCall.function.name}\nTool Call ID: ${toolCall.id}\nArguments: ${toolCall.function?.arguments ?? "{}"}`; + currentBlocks.push({ + text: toolCallText, + }); + } + } + } + } + } + } + + if (currentBlocks.length > 0) { + pushCurrentMessage(); + } + + // If caching is enabled, add cache points + // if (this.config.cacheBehavior?.cacheConversation) { + // this._addCachingToLastTwoUserMessages(converted); + // } + + return converted; + } + + private _addCachingToLastTwoUserMessages(converted: Message[]) { + let numCached = 0; + for (let i = converted.length - 1; i >= 0; i--) { + const message = converted[i]; + if (message.role === "user") { + message.content?.forEach((block) => { + if (block.text) { + block.text += getSecureID(); + } + }); + message.content?.push({ cachePoint: { type: "default" } }); + numCached++; + } + if (numCached === 2) { + break; + } + } + } + + private _convertBody( + oaiBody: ChatCompletionCreateParams, + ): ConverseStreamCommandInput { + // Extract system message + const systemMessage = + oaiBody.messages.find((msg) => msg.role === "system")?.content || ""; + + const systemMessageText = + typeof systemMessage === "string" + ? systemMessage + : systemMessage + .map((part) => + part.type === "text" ? part.text : "[Non-text content]", + ) + .join(" "); + + // Check for tools + const availableTools = new Set(); + let toolConfig: ToolConfiguration | undefined = undefined; + + if (oaiBody.tools && oaiBody.tools.length > 0) { + toolConfig = { + tools: oaiBody.tools.map((tool) => ({ + toolSpec: { + name: tool.function.name, + description: tool.function.description, + inputSchema: { + json: tool.function.parameters, + }, + }, + })), + } as ToolConfiguration; + + // Add cache point if needed + // if (this.config.cacheBehavior?.cacheSystemMessage) { + // toolConfig!.tools!.push({ cachePoint: { type: "default" } }); + // } + + oaiBody.tools.forEach((tool) => { + availableTools.add(tool.function.name); + }); + } + + // Convert messages + const convertedMessages = this._convertMessages( + oaiBody.messages, + availableTools, + ); + + // Build final request body + const body: any = { + modelId: oaiBody.model, + messages: convertedMessages, + inferenceConfig: { + temperature: oaiBody.temperature, + topP: oaiBody.top_p, + maxTokens: oaiBody.max_tokens, + stopSequences: Array.isArray(oaiBody.stop) + ? oaiBody.stop.filter((s) => s.trim() !== "").slice(0, 4) + : oaiBody.stop + ? [oaiBody.stop].filter((s) => s.trim() !== "") + : undefined, + }, + }; + + // Add system message if present + if (systemMessageText) { + body.system = false // this.config.cacheBehavior?.cacheSystemMessage // TODO + ? [{ text: systemMessageText }, { cachePoint: { type: "default" } }] + : [{ text: systemMessageText }]; + } + + // Add tool config if present + if (toolConfig) { + body.toolConfig = toolConfig; + } + + // Add reasoning if needed + // TODO REASONING + // if (this.c) { + // body.additionalModelRequestFields = { + // thinking: { + // type: "enabled", + // budget_tokens: + // oaiBody.additionalModelRequestFields.reasoningBudgetTokens, + // }, + // }; + // } + + return body; + } + + async chatCompletionNonStream( + body: ChatCompletionCreateParamsNonStreaming, + signal: AbortSignal, + ): Promise { + let completion = ""; + const toolCalls: ChatCompletionMessageToolCall[] = []; + + for await (const chunk of this.chatCompletionStream( + { + ...body, + stream: true, + }, + signal, + )) { + if (chunk.choices[0].delta.content) { + completion += chunk.choices[0].delta.content; + } + // TODO tool calls not supported + } + + return { + id: uuidv4(), + object: "chat.completion", + model: body.model, + created: Date.now(), + choices: [ + { + index: 0, + logprobs: null, + finish_reason: "stop", + message: { + role: "assistant", + content: completion, + tool_calls: toolCalls.length > 0 ? toolCalls : undefined, + refusal: null, + }, + }, + ], + usage: undefined, + }; + } + + async *chatCompletionStream( + body: ChatCompletionCreateParamsStreaming, + signal: AbortSignal, + ): AsyncGenerator { + const requestBody = this._convertBody(body); + + try { + const command = new ConverseStreamCommand({ + ...requestBody, + }); + + const response = await this.client.send(command, { abortSignal: signal }); + + if (!response?.stream) { + throw new Error("No stream received from Bedrock API"); + } + + this._currentToolResponse = null; + + for await (const chunk of response.stream) { + if (chunk.contentBlockDelta?.delta) { + const delta: any = chunk.contentBlockDelta.delta; + + // Handle text content + if (delta.text) { + yield chatChunk({ + content: delta.text, + model: body.model, + }); + continue; + } + + // Handle thinking content (if reasoning enabled) + if (delta.reasoningContent?.text) { + // TODO reasoning + // Reasoning is not directly supported in OpenAI format, + // but we could add it as a special message + continue; + } + + // Handle tool use + if (delta.toolUse?.input && this._currentToolResponse) { + if (this._currentToolResponse.input === undefined) { + this._currentToolResponse.input = ""; + } + this._currentToolResponse.input += delta.toolUse.input; + continue; + } + } + + if (chunk.contentBlockStart?.start) { + const start: any = chunk.contentBlockStart.start; + + // Handle tool start + const toolUse = start.toolUse; + if (toolUse?.toolUseId && toolUse?.name) { + this._currentToolResponse = { + toolUseId: toolUse.toolUseId, + name: toolUse.name, + input: "", + }; + } + continue; + } + + if (chunk.contentBlockStop) { + // End of a content block + if (this._currentToolResponse) { + yield chatChunkFromDelta({ + model: body.model, + delta: { + tool_calls: [ + { + index: 0, + id: this._currentToolResponse.toolUseId, + type: "function", + function: { + name: this._currentToolResponse.name, + arguments: this._currentToolResponse.input, + }, + }, + ], + }, + }); + this._currentToolResponse = null; + } + continue; + } + } + } catch (error) { + this._currentToolResponse = null; + if (error instanceof Error) { + if ("code" in error) { + throw new Error( + `AWS Bedrock stream error (${(error as any).code}): ${error.message}`, + ); + } + throw new Error(`Error processing Bedrock stream: ${error.message}`); + } + throw new Error( + "Error processing Bedrock stream: Unknown error occurred", + ); + } + } + + completionNonStream( + body: CompletionCreateParamsNonStreaming, + ): Promise { + throw new Error("Bedrock does not support completions API"); + } + + completionStream( + body: CompletionCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Bedrock does not support completions API"); + } + + fimStream( + body: FimCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Bedrock does not support FIM directly"); + } + + async embed(body: EmbeddingCreateParams): Promise { + throw new Error("Not implemented"); + // // Determine which embedding model is being used based on the model prefix + // const modelPrefix = this._getEmbeddingModelPrefix(body.model); + + // if (!modelPrefix) { + // throw new Error(`Unsupported embedding model: ${body.model}`); + // } + + // const inputs = Array.isArray(body.input) ? body.input : [body.input]; + + // try { + // const embeddings = await Promise.all( + // inputs.map(async (input) => { + // const payload = this._formatEmbeddingPayload(input, modelPrefix); + + // const response = await customFetch(this.config.requestOptions)( + // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, + // { + // method: "POST", + // body: JSON.stringify(payload), + // headers: { + // "Content-Type": "application/json", + // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", + // "X-Amz-Date": new Date() + // .toISOString() + // .replace(/[:-]|\.\d{3}/g, ""), + // }, + // aws: { + // region: this.config.region, + // service: "bedrock", + // credentials: { + // accessKeyId: this.config.accessKeyId, + // secretAccessKey: this.config.secretAccessKey, + // }, + // }, + // }, + // ); + + // const data = await response.json(); + // return this._extractEmbedding(data, modelPrefix); + // }), + // ); + + // return embedding({ + // model: body.model, + // usage: { + // total_tokens: inputs.reduce((sum, input) => sum + input.length, 0), + // prompt_tokens: inputs.reduce((sum, input) => sum + input.length, 0), + // }, + // data: embeddings, + // }); + // } catch (error) { + // if (error instanceof Error) { + // throw new Error(`Bedrock embedding error: ${error.message}`); + // } + // throw new Error("Unknown error in Bedrock embedding"); + // } + } + + private _getEmbeddingModelPrefix(model: string): string | undefined { + if (model.startsWith("cohere")) { + return "cohere"; + } + if (model.startsWith("amazon.titan-embed")) { + return "amazon.titan-embed"; + } + return undefined; + } + + private _formatEmbeddingPayload(text: string, modelPrefix: string): any { + if (modelPrefix === "cohere") { + return { + texts: [text], + input_type: "search_document", + truncate: "END", + }; + } + if (modelPrefix === "amazon.titan-embed") { + return { + inputText: text, + }; + } + throw new Error(`Unsupported model prefix: ${modelPrefix}`); + } + + private _extractEmbedding(data: any, modelPrefix: string): number[] { + if (modelPrefix === "cohere") { + return data.embeddings?.[0] || []; + } + if (modelPrefix === "amazon.titan-embed") { + return data.embedding || []; + } + return []; + } + + async rerank(body: RerankCreateParams): Promise { + throw new Error("Not implemented"); + // if (!body.query || !body.documents.length) { + // throw new Error("Query and documents must not be empty"); + // } + + // try { + // // Build the payload + // const payload: any = { + // query: body.query, + // documents: body.documents, + // top_n: body.documents.length, + // }; + + // // Add api_version for Cohere model + // if (body.model.startsWith("cohere.rerank")) { + // payload.api_version = 2; + // } + + // const response = await customFetch(this.config.requestOptions)( + // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, + // { + // method: "POST", + // body: JSON.stringify(payload), + // headers: { + // "Content-Type": "application/json", + // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", + // "X-Amz-Date": new Date().toISOString().replace(/[:-]|\.\d{3}/g, ""), + // }, + // aws: { + // region: this.config.region, + // service: "bedrock", + // credentials: { + // accessKeyId: this.config.accessKeyId, + // secretAccessKey: this.config.secretAccessKey, + // }, + // }, + // }, + // ); + + // const data = await response.json(); + + // // Process the response + // if (!data.results) { + // throw new Error("Invalid response format from Bedrock reranker"); + // } + + // // Return the results in a format compatible with OpenAI's reranker + // return { + // object: "list", + // model: body.model, + // data: data.results.map((result: any, index: number) => ({ + // document_index: result.index || index, + // relevance_score: result.relevance_score, + // text: body.documents[result.index || index], + // })), + // usage: { + // total_tokens: 0, // TODO + // }, + // }; + // } catch (error) { + // if (error instanceof Error) { + // throw new Error(`Bedrock rerank error: ${error.message}`); + // } + // throw new Error("Unknown error in Bedrock reranker"); + // } + } + + list(): Promise { + throw new Error("Method not implemented."); + } +} diff --git a/packages/openai-adapters/src/index.ts b/packages/openai-adapters/src/index.ts index b4254046e..2114f4f34 100644 --- a/packages/openai-adapters/src/index.ts +++ b/packages/openai-adapters/src/index.ts @@ -2,6 +2,7 @@ import dotenv from "dotenv"; import { z } from "zod"; import { AnthropicApi } from "./apis/Anthropic.js"; import { AzureApi } from "./apis/Azure.js"; +import { BedrockApi } from "./apis/Bedrock.js"; import { CohereApi } from "./apis/Cohere.js"; import { DeepSeekApi } from "./apis/DeepSeek.js"; import { GeminiApi } from "./apis/Gemini.js"; @@ -34,6 +35,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined { return new OpenAIApi(config); case "azure": return new AzureApi(config); + case "bedrock": + return new BedrockApi(config); case "cohere": return new CohereApi(config); case "anthropic": diff --git a/packages/openai-adapters/src/types.ts b/packages/openai-adapters/src/types.ts index 3c79db7bf..4d7521dde 100644 --- a/packages/openai-adapters/src/types.ts +++ b/packages/openai-adapters/src/types.ts @@ -71,6 +71,18 @@ export const DeepseekConfigSchema = OpenAIConfigSchema.extend({ }); export type DeepseekConfig = z.infer; +export const BedrockConfigSchema = OpenAIConfigSchema.extend({ + provider: z.literal("bedrock"), + // cacheBehavior: z.object({ + // cacheSystemMessage: z.boolean().optional(), + // cacheConversation: z.boolean().optional(), + // }).optional(), + env: z.object({ + region: z.string().optional(), + }), +}); +export type BedrockConfig = z.infer; + export const LlamastackConfigSchema = OpenAIConfigSchema.extend({ provider: z.literal("llamastack"), }); @@ -142,6 +154,7 @@ export type InceptionConfig = z.infer; // Discriminated union export const LLMConfigSchema = z.discriminatedUnion("provider", [ OpenAIConfigSchema, + BedrockConfigSchema, MoonshotConfigSchema, DeepseekConfigSchema, CohereConfigSchema, From 537d5439d09f57c031ed943bfffd0a757ae81907 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 15:29:33 -0700 Subject: [PATCH 62/82] fix empty message bedrock openai adapter bug --- packages/openai-adapters/src/apis/Bedrock.ts | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index ef27890b9..400d3e97e 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -181,7 +181,10 @@ export class BedrockApi implements BaseLlmApi { const trimmedContent = typeof message.content === "string" ? message.content.trim() - : JSON.stringify(message.content); + : message.content + .map((c) => c.text) + .join("\n") + .trim(); if (hasAddedToolCallIds.has(message.tool_call_id)) { currentBlocks.push({ @@ -208,15 +211,19 @@ export class BedrockApi implements BaseLlmApi { } // ASSISTANT messages - const content = message.content; - if (content) { - if (typeof content === "string") { - currentBlocks.push({ text: content }); - } else { - content.forEach((part) => { - currentBlocks.push(this._oaiPartToBedrockPart(part)); - }); + if (typeof message.content === "string") { + const trimmedText = message.content.trim(); + if (trimmedText) { + currentBlocks.push({ text: trimmedText }); } + } else { + message.content?.forEach((part) => { + const text = part.type === "text" ? part.text : part.refusal; + const trimmedText = text.trim(); + if (trimmedText) { + currentBlocks.push({ text: trimmedText }); + } + }); } // TOOL CALLS From 81860c60287346a4912fab3ceb86f0577ffa0295 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 18:17:55 -0700 Subject: [PATCH 63/82] rerank and embed functions --- packages/openai-adapters/src/apis/Bedrock.ts | 258 ++++++++----------- 1 file changed, 109 insertions(+), 149 deletions(-) diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index 400d3e97e..e34f65722 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -5,6 +5,7 @@ import { ConverseStreamCommand, ConverseStreamCommandInput, ImageFormat, + InvokeModelCommand, Message, ToolConfiguration, } from "@aws-sdk/client-bedrock-runtime"; @@ -27,7 +28,7 @@ import { } from "openai/resources/index"; import { BedrockConfig } from "../types.js"; -import { chatChunk, chatChunkFromDelta } from "../util.js"; +import { chatChunk, chatChunkFromDelta, embedding, rerank } from "../util.js"; import { safeParseArgs } from "../util/parseArgs.js"; import { BaseLlmApi, @@ -542,168 +543,127 @@ export class BedrockApi implements BaseLlmApi { throw new Error("Bedrock does not support FIM directly"); } + private async getInvokeModelResponseBody(model: string, jsonBody: object) { + const payload = { + body: JSON.stringify(jsonBody), + modelId: model, + accept: "*/*", + contentType: "application/json", + }; + const command = new InvokeModelCommand(payload); + const response = await this.client.send(command); + if (!response.body) { + throw new Error("No response body"); + } + const decoder = new TextDecoder(); + const decoded = decoder.decode(response.body); + return JSON.parse(decoded); + } + + private getEmbedTexts(body: EmbeddingCreateParams): string[] { + const texts: string[] = []; + if (typeof body.input === "string") { + texts.push(body.input); + } else if (body.input.length > 0) { + const firstVal = body.input[0]; + if (Array.isArray(firstVal)) { + throw new Error("Unsupported embeddings type received: number[][]"); + } + if (typeof firstVal === "string") { + texts.push(...(body.input as string[])); + } else { + throw new Error("Unsupported embeddings type received: number[]"); + } + } + return texts; + } + async embed(body: EmbeddingCreateParams): Promise { - throw new Error("Not implemented"); - // // Determine which embedding model is being used based on the model prefix - // const modelPrefix = this._getEmbeddingModelPrefix(body.model); + const texts = this.getEmbedTexts(body); - // if (!modelPrefix) { - // throw new Error(`Unsupported embedding model: ${body.model}`); - // } - - // const inputs = Array.isArray(body.input) ? body.input : [body.input]; - - // try { - // const embeddings = await Promise.all( - // inputs.map(async (input) => { - // const payload = this._formatEmbeddingPayload(input, modelPrefix); - - // const response = await customFetch(this.config.requestOptions)( - // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, - // { - // method: "POST", - // body: JSON.stringify(payload), - // headers: { - // "Content-Type": "application/json", - // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", - // "X-Amz-Date": new Date() - // .toISOString() - // .replace(/[:-]|\.\d{3}/g, ""), - // }, - // aws: { - // region: this.config.region, - // service: "bedrock", - // credentials: { - // accessKeyId: this.config.accessKeyId, - // secretAccessKey: this.config.secretAccessKey, - // }, - // }, - // }, - // ); - - // const data = await response.json(); - // return this._extractEmbedding(data, modelPrefix); - // }), - // ); - - // return embedding({ - // model: body.model, - // usage: { - // total_tokens: inputs.reduce((sum, input) => sum + input.length, 0), - // prompt_tokens: inputs.reduce((sum, input) => sum + input.length, 0), - // }, - // data: embeddings, - // }); - // } catch (error) { - // if (error instanceof Error) { - // throw new Error(`Bedrock embedding error: ${error.message}`); - // } - // throw new Error("Unknown error in Bedrock embedding"); - // } - } - - private _getEmbeddingModelPrefix(model: string): string | undefined { - if (model.startsWith("cohere")) { - return "cohere"; - } - if (model.startsWith("amazon.titan-embed")) { - return "amazon.titan-embed"; - } - return undefined; - } - - private _formatEmbeddingPayload(text: string, modelPrefix: string): any { - if (modelPrefix === "cohere") { - return { - texts: [text], + let embeddings: number[][]; + if (body.model.startsWith("cohere")) { + const payload = { + texts, input_type: "search_document", truncate: "END", }; + const output = await this.getInvokeModelResponseBody(body.model, payload); + embeddings = [output.embedding]; + } else if (body.model.startsWith("amazon.titan-embed")) { + embeddings = await Promise.all( + texts.map(async (text) => { + const payload = { + inputText: text, + }; + const output = await this.getInvokeModelResponseBody( + body.model, + payload, + ); + return output.embeddings || []; + }), + ); + } else { + throw new Error(`Unsupported model: ${body.model}`); } - if (modelPrefix === "amazon.titan-embed") { - return { - inputText: text, - }; - } - throw new Error(`Unsupported model prefix: ${modelPrefix}`); - } - private _extractEmbedding(data: any, modelPrefix: string): number[] { - if (modelPrefix === "cohere") { - return data.embeddings?.[0] || []; - } - if (modelPrefix === "amazon.titan-embed") { - return data.embedding || []; - } - return []; + return embedding({ + data: embeddings, + model: body.model, + usage: { + prompt_tokens: 0, + total_tokens: 0, + }, + }); } async rerank(body: RerankCreateParams): Promise { - throw new Error("Not implemented"); - // if (!body.query || !body.documents.length) { - // throw new Error("Query and documents must not be empty"); - // } + if (!body.query || !body.documents.length) { + throw new Error("Query and chunks must not be empty"); + } - // try { - // // Build the payload - // const payload: any = { - // query: body.query, - // documents: body.documents, - // top_n: body.documents.length, - // }; + // Base payload for both models + const payload: any = { + query: body.query, + documents: body.documents, + top_n: body.top_k ?? body.documents.length, + }; - // // Add api_version for Cohere model - // if (body.model.startsWith("cohere.rerank")) { - // payload.api_version = 2; - // } + // Add api_version for Cohere model + if (body.model.startsWith("cohere.rerank")) { + payload.api_version = 2; + } - // const response = await customFetch(this.config.requestOptions)( - // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, - // { - // method: "POST", - // body: JSON.stringify(payload), - // headers: { - // "Content-Type": "application/json", - // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", - // "X-Amz-Date": new Date().toISOString().replace(/[:-]|\.\d{3}/g, ""), - // }, - // aws: { - // region: this.config.region, - // service: "bedrock", - // credentials: { - // accessKeyId: this.config.accessKeyId, - // secretAccessKey: this.config.secretAccessKey, - // }, - // }, - // }, - // ); + try { + const responseBody = await this.getInvokeModelResponseBody( + body.model, + payload, + ); + const scores = responseBody.results + .sort((a: any, b: any) => a.index - b.index) + .map((result: any) => result.relevance_score); - // const data = await response.json(); - - // // Process the response - // if (!data.results) { - // throw new Error("Invalid response format from Bedrock reranker"); - // } - - // // Return the results in a format compatible with OpenAI's reranker - // return { - // object: "list", - // model: body.model, - // data: data.results.map((result: any, index: number) => ({ - // document_index: result.index || index, - // relevance_score: result.relevance_score, - // text: body.documents[result.index || index], - // })), - // usage: { - // total_tokens: 0, // TODO - // }, - // }; - // } catch (error) { - // if (error instanceof Error) { - // throw new Error(`Bedrock rerank error: ${error.message}`); - // } - // throw new Error("Unknown error in Bedrock reranker"); - // } + return rerank({ + model: body.model, + usage: { + total_tokens: 0, + }, + data: scores, + }); + } catch (error) { + if (error instanceof Error) { + if ("code" in error) { + // AWS SDK specific errors + throw new Error( + `AWS Bedrock rerank error (${(error as any).code}): ${error.message}`, + ); + } + throw new Error(`Error in BedrockReranker.rerank: ${error.message}`); + } + throw new Error( + "Error in BedrockReranker.rerank: Unknown error occurred", + ); + } } list(): Promise { From 2b88e54e3799ad18b87bd21d17b9c1ded2cd81cc Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 18:47:37 -0700 Subject: [PATCH 64/82] support secretAccessKey and accessKeyId for bedrock --- core/config/yaml/models.ts | 6 ++ core/index.d.ts | 2 + core/llm/index.ts | 4 + core/llm/llms/Bedrock.ts | 39 +++----- extensions/vscode/config_schema.json | 22 ++++- packages/openai-adapters/package-lock.json | 97 ++++++++++++++++++++ packages/openai-adapters/package.json | 1 + packages/openai-adapters/src/apis/Bedrock.ts | 59 ++++++++---- packages/openai-adapters/src/types.ts | 3 + 9 files changed, 190 insertions(+), 43 deletions(-) diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index edb47f59e..200cfc221 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -126,6 +126,12 @@ async function modelConfigToBaseLLM({ if ("profile" in env && typeof env.profile === "string") { options.profile = env.profile; } + if ("accessKeyId" in env && typeof env.accessKeyId === "string") { + options.accessKeyId = env.accessKeyId; + } + if ("secretAccessKey" in env && typeof env.secretAccessKey === "string") { + options.secretAccessKey = env.secretAccessKey; + } if ("modelArn" in env && typeof env.modelArn === "string") { options.modelArn = env.modelArn; } diff --git a/core/index.d.ts b/core/index.d.ts index 3d6f1602c..57a4e222f 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -611,6 +611,8 @@ export interface LLMOptions { // AWS options profile?: string; modelArn?: string; + accessKeyId?: string; + secretAccessKey?: string; // AWS and VertexAI Options region?: string; diff --git a/core/llm/index.ts b/core/llm/index.ts index 47fdf8011..fe76acea7 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -172,6 +172,8 @@ export abstract class BaseLLM implements ILLM { accountId?: string; aiGatewaySlug?: string; profile?: string | undefined; + accessKeyId?: string; + secretAccessKey?: string; // For IBM watsonx deploymentId?: string; @@ -270,6 +272,8 @@ export abstract class BaseLLM implements ILLM { this.region = options.region; this.projectId = options.projectId; this.profile = options.profile; + this.accessKeyId = options.accessKeyId; + this.secretAccessKey = options.secretAccessKey; this.openaiAdapter = this.createOpenAiAdapter(); diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index cf13edd6a..21dda2288 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -73,11 +73,6 @@ class Bedrock extends BaseLLM { if (!options.apiBase) { this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; } - if (options.profile) { - this.profile = options.profile; - } else { - this.profile = "bedrock"; - } this.requestOptions = { region: options.region, @@ -612,30 +607,22 @@ class Bedrock extends BaseLLM { } private async _getCredentials() { - if (this.apiKey) { - const [accessKeyId, secretAccessKey] = this.apiKey.split(":"); - if (!accessKeyId || !secretAccessKey) { - throw new Error( - "Invalid Bedrock API key format. Expected format: accessKeyId:secretAccessKey", - ); - } + if (this.accessKeyId && this.secretAccessKey) { return { - accessKeyId, - secretAccessKey, + accessKeyId: this.accessKeyId, + secretAccessKey: this.secretAccessKey, }; } - - if (this.profile) { - try { - return await fromNodeProviderChain({ - profile: this.profile, - ignoreCache: true, - })(); - } catch (e) { - console.warn( - `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, - ); - } + const profile = this.profile ?? "bedrock"; + try { + return await fromNodeProviderChain({ + profile: profile, + ignoreCache: true, + })(); + } catch (e) { + console.warn( + `AWS profile with name ${profile} not found in ~/.aws/credentials, using default profile`, + ); } return await fromNodeProviderChain()(); } diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 29d882489..86675a1ac 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -359,8 +359,18 @@ "description": "The AWS security profile to use", "type": "string" }, + "accessKeyId": { + "title": "Access Key ID", + "description": "AWS access key id (can be used together with secretAccessKey in place of profile)", + "type": "string" + }, + "secretAccessKey": { + "title": "Secret Access Key", + "description": "AWS secret access key (can be used together with secretAccessKey in place of profile)", + "type": "string" + }, "modelArn": { - "title": "Profile", + "title": "Model ARN", "description": "The AWS arn for the imported model", "type": "string" }, @@ -2903,6 +2913,16 @@ "title": "Profile", "description": "The AWS security profile to use", "type": "string" + }, + "accessKeyId": { + "title": "Access Key ID", + "description": "AWS access key id (can be used together with secretAccessKey in place of profile)", + "type": "string" + }, + "secretAccessKey": { + "title": "Secret Access Key", + "description": "AWS secret access key (can be used together with secretAccessKey in place of profile)", + "type": "string" } }, "required": ["provider"], diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 86228c0d9..2c71d9e7f 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -10,6 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.842.0", + "@aws-sdk/credential-providers": "^3.840.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", @@ -255,6 +256,56 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/@aws-sdk/client-cognito-identity": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.840.0.tgz", + "integrity": "sha512-0sn/X63Xqqh5D1FYmdSHiS9SkDzTitoGO++/8IFik4xf/jpn4ZQkIoDPvpxFZcLvebMuUa6jAQs4ap4RusKGkg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-node": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@aws-sdk/client-sso": { "version": "3.840.0", "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.840.0.tgz", @@ -330,6 +381,22 @@ "node": ">=18.0.0" } }, + "node_modules/@aws-sdk/credential-provider-cognito-identity": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.840.0.tgz", + "integrity": "sha512-p1RaMVd6+6ruYjKsWRCZT/jWhrYfDKbXY+/ScIYTvcaOOf9ArMtVnhFk3egewrC7kPXFGRYhg2GPmxRotNYMng==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-cognito-identity": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@aws-sdk/credential-provider-env": { "version": "3.840.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.840.0.tgz", @@ -467,6 +534,36 @@ "node": ">=18.0.0" } }, + "node_modules/@aws-sdk/credential-providers": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.840.0.tgz", + "integrity": "sha512-+CxYdGd+uM4NZ9VUvFTU1c/H61qhDB4q362k8xKU+bz24g//LDQ5Mpwksv8OUD1en44v4fUwgZ4SthPZMs+eFQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-cognito-identity": "3.840.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-cognito-identity": "3.840.0", + "@aws-sdk/credential-provider-env": "3.840.0", + "@aws-sdk/credential-provider-http": "3.840.0", + "@aws-sdk/credential-provider-ini": "3.840.0", + "@aws-sdk/credential-provider-node": "3.840.0", + "@aws-sdk/credential-provider-process": "3.840.0", + "@aws-sdk/credential-provider-sso": "3.840.0", + "@aws-sdk/credential-provider-web-identity": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@aws-sdk/eventstream-handler-node": { "version": "3.840.0", "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.840.0.tgz", diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index e3d6423df..c5f98f556 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -13,6 +13,7 @@ "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.842.0", + "@aws-sdk/credential-providers": "^3.840.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index e34f65722..67246aff4 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -27,6 +27,7 @@ import { Model, } from "openai/resources/index"; +import { fromNodeProviderChain } from "@aws-sdk/credential-providers"; import { BedrockConfig } from "../types.js"; import { chatChunk, chatChunkFromDelta, embedding, rerank } from "../util.js"; import { safeParseArgs } from "../util/parseArgs.js"; @@ -56,32 +57,56 @@ interface ToolUseState { } export class BedrockApi implements BaseLlmApi { - private client: BedrockRuntimeClient; private _currentToolResponse: Partial | null = null; constructor(protected config: BedrockConfig) { if (!config.env?.region) { throw new Error("region is required for Bedrock API"); } - if (!config.apiKey) { + + if (config.env?.accessKeyId || config?.env?.secretAccessKey) { + if (!config.env?.accessKeyId) { + throw new Error( + "accessKeyId is required for Bedrock API. Only found secretAccessKey", + ); + } + if (!config.env?.secretAccessKey) { + throw new Error( + "secretAccessKey is required for Bedrock API. Only found accessKeyId", + ); + } + } else if (!config.env?.profile) { throw new Error( - "apiKey in the format accessKeyId:secretAccessKey is required for Bedrock API", + "AWS credentials profile not found. Please provide accessKeyId and secretAccessKey or profile", ); } + } - const [accessKeyId, secretAccessKey] = config.apiKey.split(":"); - if (!accessKeyId || !secretAccessKey) { - throw new Error( - "Bedrock apiKey must be in the format accessKeyId:secretAccessKey", + async getCreds() { + if (this.config?.env?.accessKeyId && this.config?.env?.secretAccessKey) { + return { + accessKeyId: this.config.env.accessKeyId, + secretAccessKey: this.config.env.secretAccessKey, + }; + } + const profile = this.config.env.profile ?? "bedrock"; + try { + return await fromNodeProviderChain({ + profile: profile, + ignoreCache: true, + })(); + } catch (e) { + console.warn( + `AWS profile with name ${profile} not found in ~/.aws/credentials, using default profile`, ); } - - this.client = new BedrockRuntimeClient({ - region: config.env.region, - credentials: { - accessKeyId, - secretAccessKey, - }, + return await fromNodeProviderChain()(); + } + async getClient(): Promise { + const creds = await this.getCreds(); + return new BedrockRuntimeClient({ + region: this.config.env.region, + credentials: creds, }); } @@ -431,7 +456,8 @@ export class BedrockApi implements BaseLlmApi { ...requestBody, }); - const response = await this.client.send(command, { abortSignal: signal }); + const client = await this.getClient(); + const response = await client.send(command, { abortSignal: signal }); if (!response?.stream) { throw new Error("No stream received from Bedrock API"); @@ -551,7 +577,8 @@ export class BedrockApi implements BaseLlmApi { contentType: "application/json", }; const command = new InvokeModelCommand(payload); - const response = await this.client.send(command); + const client = await this.getClient(); + const response = await client.send(command); if (!response.body) { throw new Error("No response body"); } diff --git a/packages/openai-adapters/src/types.ts b/packages/openai-adapters/src/types.ts index 4d7521dde..7a6ce37cf 100644 --- a/packages/openai-adapters/src/types.ts +++ b/packages/openai-adapters/src/types.ts @@ -79,6 +79,9 @@ export const BedrockConfigSchema = OpenAIConfigSchema.extend({ // }).optional(), env: z.object({ region: z.string().optional(), + accessKeyId: z.string().optional(), + secretAccessKey: z.string().optional(), + profile: z.string().optional(), }), }); export type BedrockConfig = z.infer; From e389050dda369c23868b283ca13f126f38d82236 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 19:26:55 -0700 Subject: [PATCH 65/82] proxy missing env secrets --- core/config/load.ts | 1 + core/index.d.ts | 2 ++ core/llm/constants.ts | 1 + core/llm/index.ts | 2 ++ core/llm/llms/stubs/ContinueProxy.ts | 21 ++++++++++++--- gui/src/pages/config/ModelRoleSelector.tsx | 25 +++++++++++++----- packages/config-yaml/src/load/clientRender.ts | 26 +++++++++++++++++-- packages/config-yaml/src/schemas/models.ts | 6 +++-- .../typescript/src/createOpenAIClient.ts | 1 + 9 files changed, 71 insertions(+), 14 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index a084bbd38..18c3a72a0 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -650,6 +650,7 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription { roles: llm.roles, configurationStatus: llm.getConfigurationStatus(), apiKeyLocation: llm.apiKeyLocation, + envSecretLocations: llm.envSecretLocations, }; } diff --git a/core/index.d.ts b/core/index.d.ts index 57a4e222f..cb5d5871a 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -583,6 +583,7 @@ export interface LLMOptions { // continueProperties apiKeyLocation?: string; + envSecretLocations?: Record; apiBase?: string; orgScopeId?: string | null; @@ -1084,6 +1085,7 @@ export interface ModelDescription { apiBase?: string; apiKeyLocation?: string; + envSecretLocations?: Record; orgScopeId?: string | null; onPremProxyUrl?: string | null; diff --git a/core/llm/constants.ts b/core/llm/constants.ts index 0975fc142..90de5c64d 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -15,6 +15,7 @@ const DEFAULT_MAX_BATCH_SIZE = 64; export enum LLMConfigurationStatuses { VALID = "valid", MISSING_API_KEY = "missing-api-key", + MISSING_ENV_SECRET = "missing-env-secret", } export { diff --git a/core/llm/index.ts b/core/llm/index.ts index fe76acea7..ba10058a6 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -155,6 +155,7 @@ export abstract class BaseLLM implements ILLM { // continueProperties apiKeyLocation?: string; + envSecretLocations?: Record; apiBase?: string; orgScopeId?: string | null; @@ -248,6 +249,7 @@ export abstract class BaseLLM implements ILLM { // continueProperties this.apiKeyLocation = options.apiKeyLocation; + this.envSecretLocations = options.envSecretLocations; this.orgScopeId = options.orgScopeId; this.apiBase = options.apiBase; diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index b49d00548..d7f788a33 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -40,6 +40,7 @@ class ContinueProxy extends OpenAI { this.apiType = undefined; this.actualApiBase = options.apiBase; this.apiKeyLocation = options.apiKeyLocation; + this.envSecretLocations = options.envSecretLocations; this.orgScopeId = options.orgScopeId; this.onPremProxyUrl = options.onPremProxyUrl; if (this.onPremProxyUrl) { @@ -60,6 +61,7 @@ class ContinueProxy extends OpenAI { protected extraBodyProperties(): Record { const continueProperties: ContinueProperties = { apiKeyLocation: this.apiKeyLocation, + envSecretLocations: this.envSecretLocations, apiBase: this.actualApiBase, orgScopeId: this.orgScopeId ?? null, env: this.configEnv, @@ -70,13 +72,24 @@ class ContinueProxy extends OpenAI { } getConfigurationStatus() { - if (!this.apiKeyLocation) { + if (!this.apiKeyLocation && !this.envSecretLocations) { return LLMConfigurationStatuses.VALID; } - const secretLocation = decodeSecretLocation(this.apiKeyLocation); - if (secretLocation.secretType === SecretType.NotFound) { - return LLMConfigurationStatuses.MISSING_API_KEY; + if (this.apiKeyLocation) { + const secretLocation = decodeSecretLocation(this.apiKeyLocation); + if (secretLocation.secretType === SecretType.NotFound) { + return LLMConfigurationStatuses.MISSING_API_KEY; + } + } + + if (this.envSecretLocations) { + for (const secretLocation of Object.values(this.envSecretLocations)) { + const decoded = decodeSecretLocation(secretLocation); + if (decoded.secretType === SecretType.NotFound) { + return LLMConfigurationStatuses.MISSING_ENV_SECRET; + } + } } return LLMConfigurationStatuses.VALID; diff --git a/gui/src/pages/config/ModelRoleSelector.tsx b/gui/src/pages/config/ModelRoleSelector.tsx index 0065552a8..1b73751b9 100644 --- a/gui/src/pages/config/ModelRoleSelector.tsx +++ b/gui/src/pages/config/ModelRoleSelector.tsx @@ -119,19 +119,32 @@ const ModelRoleSelector = ({ {[...models] .sort((a, b) => a.title.localeCompare(b.title)) .map((option, idx) => { - const showMissingApiKeyMsg = + const isConfigInvalid = + option.configurationStatus !== + LLMConfigurationStatuses.VALID; + let invalidMessage = "(Invalid config)"; + if ( option.configurationStatus === - LLMConfigurationStatuses.MISSING_API_KEY; + LLMConfigurationStatuses.MISSING_ENV_SECRET + ) { + invalidMessage = "(Missing env secret)"; + } + if ( + option.configurationStatus === + LLMConfigurationStatuses.MISSING_API_KEY + ) { + invalidMessage = "(Missing API Key)"; + } return ( setHoveredIdx(idx)} onMouseLeave={() => setHoveredIdx(null)} onClick={(e: any) => - handleOptionClick(showMissingApiKeyMsg, e) + handleOptionClick(isConfigInvalid, e) } className="" > @@ -144,9 +157,9 @@ const ModelRoleSelector = ({ style={{ fontSize: fontSize(-3) }} > {option.title} - {showMissingApiKeyMsg && ( + {isConfigInvalid && ( - (Missing API key) + {invalidMessage} )} diff --git a/packages/config-yaml/src/load/clientRender.ts b/packages/config-yaml/src/load/clientRender.ts index 46001b847..760ae48a6 100644 --- a/packages/config-yaml/src/load/clientRender.ts +++ b/packages/config-yaml/src/load/clientRender.ts @@ -133,7 +133,27 @@ export function useProxyForUnrenderedSecrets( const apiKeyLocation = getUnrenderedSecretLocation( config.models[i]?.apiKey, ); - if (apiKeyLocation) { + const encodedApiKeyLocation = apiKeyLocation + ? encodeSecretLocation(apiKeyLocation) + : undefined; + + let encodedEnvSecretLocations: Record | undefined = + undefined; + if (config.models[i]?.env) { + Object.entries(config.models[i]?.env!).forEach(([key, value]) => { + if (typeof value === "string") { + const secretLocation = getUnrenderedSecretLocation(value); + if (secretLocation) { + encodedEnvSecretLocations = { + ...encodedEnvSecretLocations, + [key]: encodeSecretLocation(secretLocation), + }; + } + } + }); + } + + if (encodedApiKeyLocation || encodedEnvSecretLocations) { config.models[i] = { ...config.models[i], name: config.models[i]?.name ?? "", @@ -143,7 +163,8 @@ export function useProxyForUnrenderedSecrets( config.models[i]?.provider ?? "", config.models[i]?.model ?? "", ), - apiKeyLocation: encodeSecretLocation(apiKeyLocation), + apiKeyLocation: encodedApiKeyLocation, + envSecretLocations: encodedEnvSecretLocations, orgScopeId, onPremProxyUrl, apiKey: undefined, @@ -158,6 +179,7 @@ export function useProxyForUnrenderedSecrets( /** The additional properties that are added to the otherwise OpenAI-compatible body when requesting a Continue proxy */ export const continuePropertiesSchema = z.object({ apiKeyLocation: z.string().optional(), + envSecretLocations: z.record(z.string(), z.string()).optional(), apiBase: z.string().optional(), orgScopeId: z.string().nullable(), env: z.record(z.string(), z.any()).optional(), diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 99d324ac2..96d295994 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -154,7 +154,8 @@ export const modelSchema = z.union([ z.object({ ...baseModelFields, provider: z.literal("continue-proxy"), - apiKeyLocation: z.string(), + apiKeyLocation: z.string().optional(), + envSecretLocations: z.record(z.string(), z.string()).optional(), orgScopeId: z.string().nullable(), onPremProxyUrl: z.string().nullable(), }), @@ -169,7 +170,8 @@ export const partialModelSchema = z.union([ .object({ ...baseModelFields, provider: z.literal("continue-proxy"), - apiKeyLocation: z.string(), + apiKeyLocation: z.string().optional(), + envSecretLocations: z.record(z.string(), z.string()).optional(), }) .partial(), z diff --git a/packages/continue-sdk/typescript/src/createOpenAIClient.ts b/packages/continue-sdk/typescript/src/createOpenAIClient.ts index cd3cd0ce5..d63e706ee 100644 --- a/packages/continue-sdk/typescript/src/createOpenAIClient.ts +++ b/packages/continue-sdk/typescript/src/createOpenAIClient.ts @@ -79,6 +79,7 @@ export function createOpenAIClient({ const continueProperties: ContinueProperties = { apiKeyLocation: modelConfig.apiKeyLocation, + envSecretLocations: modelConfig.envSecretLocations, orgScopeId: organizationId ?? null, }; From ed3217aaffc4613cc03a489b39623565a8c2420c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 19:53:50 -0700 Subject: [PATCH 66/82] remove extraneous bedrock load errors, don't force bedrock openai adapter --- core/llm/llms/Bedrock.ts | 2 -- packages/openai-adapters/src/apis/Bedrock.ts | 8 -------- 2 files changed, 10 deletions(-) diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 21dda2288..11d772b7b 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -21,7 +21,6 @@ import { import { safeParseToolCallArgs } from "../../tools/parseArgs.js"; import { renderChatMessage, stripImages } from "../../util/messageContent.js"; import { BaseLLM } from "../index.js"; -import { LlmApiRequestType } from "../openaiTypeConverters.js"; import { PROVIDER_TOOL_SUPPORT } from "../toolSupport.js"; import { getSecureID } from "../utils/getSecureID.js"; @@ -48,7 +47,6 @@ interface PromptCachingMetrics { } class Bedrock extends BaseLLM { - protected useOpenAIAdapterFor: (LlmApiRequestType | "*")[] = ["*"]; static providerName = "bedrock"; static defaultOptions: Partial = { region: "us-east-1", diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index 67246aff4..2a580456a 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -60,10 +60,6 @@ export class BedrockApi implements BaseLlmApi { private _currentToolResponse: Partial | null = null; constructor(protected config: BedrockConfig) { - if (!config.env?.region) { - throw new Error("region is required for Bedrock API"); - } - if (config.env?.accessKeyId || config?.env?.secretAccessKey) { if (!config.env?.accessKeyId) { throw new Error( @@ -75,10 +71,6 @@ export class BedrockApi implements BaseLlmApi { "secretAccessKey is required for Bedrock API. Only found accessKeyId", ); } - } else if (!config.env?.profile) { - throw new Error( - "AWS credentials profile not found. Please provide accessKeyId and secretAccessKey or profile", - ); } } From b3ed984e166716a60d7a3b8d7f4c87b74b431b7f Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 19:54:45 -0700 Subject: [PATCH 67/82] add env secret resolution for continue sdk --- packages/continue-sdk/typescript/src/createOpenAIClient.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/continue-sdk/typescript/src/createOpenAIClient.ts b/packages/continue-sdk/typescript/src/createOpenAIClient.ts index d63e706ee..6f693d8c9 100644 --- a/packages/continue-sdk/typescript/src/createOpenAIClient.ts +++ b/packages/continue-sdk/typescript/src/createOpenAIClient.ts @@ -71,9 +71,9 @@ export function createOpenAIClient({ ); } - if (!("apiKeyLocation" in modelConfig)) { + if (!("apiKeyLocation" in modelConfig) && !("envSecretLocations" in modelConfig)) { throw new Error( - `Model ${modelName} does not have an apiKeyLocation defined`, + `Model ${modelName} does not have an apiKeyLocation or envSecretLocations defined`, ); } From d02fa8593597b26441aa759f8e1b36673451253e Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 21:52:56 -0700 Subject: [PATCH 68/82] test: no longer check for context items peek after terminal tool call (we don't show it anymore) --- extensions/vscode/e2e/tests/GUI.test.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index a709266ec..3a540ee48 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -347,7 +347,7 @@ describe("GUI Test", () => { }); describe("Context providers", () => { - it("should successfully use the terminal context provider", async () => { + it.only("should successfully use the terminal context provider", async () => { await GUIActions.selectModelFromDropdown(view, "LAST MESSAGE MOCK LLM"); // Enter just the context provider in the input and send @@ -357,20 +357,6 @@ describe("GUI Test", () => { await messageInput.sendKeys(Key.ENTER); await messageInput.sendKeys(Key.ENTER); - // Open the context items peek - const contextItemsPeek = await GUISelectors.getContextItemsPeek(view); - await contextItemsPeek.click(); - - await TestUtils.waitForSuccess(async () => { - const firstContextItemInPeek = - await GUISelectors.getFirstContextItemsPeekItem(view); - await firstContextItemInPeek.click(); - - // Check that item is there with correct name - const description = await firstContextItemInPeek.getText(); - expect(description).to.include("Terminal"); - }); - // Check that the contents match what we expect (repeated back by the mock LLM) await TestUtils.waitForSuccess(() => { return GUISelectors.getThreadMessageByText( From cfa50c4d6e28e1d751ad42458f1275ef62cc560f Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 21:53:29 -0700 Subject: [PATCH 69/82] chore: bump package.json --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 5cff792dc..cb33e7a31 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.58", + "version": "1.1.59", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 87d0f94171c2c174a06cebba08ce1e3350cc97d5 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 21:57:49 -0700 Subject: [PATCH 70/82] add void to async functions --- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index b59abe665..781a3b633 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -100,11 +100,11 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { this.secretStorage = new SecretStorage(context); // Immediately refresh any existing sessions - this.refreshSessions(); + void this.refreshSessions(); // Set up a regular interval to refresh tokens this._refreshInterval = setInterval(() => { - this.refreshSessions(); + void this.refreshSessions(); }, WorkOsAuthProvider.REFRESH_INTERVAL_MS); } From 6bce891c871c1ea95bdaae9e36e41d406b5e3c08 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 22:52:35 -0700 Subject: [PATCH 71/82] chore: bump openai-adapters to 45 --- packages/openai-adapters/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index c5f98f556..f7c7d3133 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/openai-adapters", - "version": "1.0.44", + "version": "1.0.45", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", From 26cef4e4a1d35106a8e694236f43eadcf4618067 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 22:56:39 -0700 Subject: [PATCH 72/82] chore: config-yaml v96 --- packages/config-yaml/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index aaadfe13a..e0cb53693 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.95", + "version": "1.0.96", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", From ebfb1922f5ee1d20e6546ffdad2c7cc3779957fd Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 22:59:52 -0700 Subject: [PATCH 73/82] fix: always refresh with retries Even if an access token is expired, the refresh token could be valid. They don't expire until much longer --- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index 781a3b633..bdb94129f 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -198,12 +198,9 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { const finalSessions = []; for (const session of sessions) { try { - // For expired tokens, don't use retries - if refresh fails, we drop the session - const refreshMethod = this.jwtIsExpiredOrInvalid(session.accessToken) - ? this._refreshSession.bind(this) // Direct refresh for expired tokens - : this._refreshSessionWithRetry.bind(this); // Retry for valid tokens - - const newSession = await refreshMethod(session.refreshToken); + const newSession = await this._refreshSessionWithRetry( + session.refreshToken, + ); finalSessions.push({ ...session, accessToken: newSession.accessToken, From 1732ee9e8384c378fa259c36483248c1f97ccb3b Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 23:01:11 -0700 Subject: [PATCH 74/82] fix: exponential backoff refresh token fix don't set a limit to the max number of retries in token refresh. they are valid for a very long time --- .../vscode/src/stubs/WorkOsAuthProvider.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index bdb94129f..1cb0bcec3 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -229,7 +229,6 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { private async _refreshSessionWithRetry( refreshToken: string, attempt = 1, - maxAttempts = 3, baseDelay = 1000, ): Promise<{ accessToken: string; @@ -243,26 +242,22 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { if ( error.message?.includes("401") || error.message?.includes("Invalid refresh token") || - error.message?.includes("Unauthorized") || - attempt >= maxAttempts + error.message?.includes("Unauthorized") ) { throw error; } // For network errors or transient server issues, retry with backoff // Calculate exponential backoff delay with jitter - const delay = - baseDelay * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5); + const delay = Math.min( + baseDelay * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5), + 60 * 60 * 1000, // 1 hour in milliseconds + ); // Schedule retry after delay return new Promise((resolve, reject) => { setTimeout(() => { - this._refreshSessionWithRetry( - refreshToken, - attempt + 1, - maxAttempts, - baseDelay, - ) + this._refreshSessionWithRetry(refreshToken, attempt + 1, baseDelay) .then(resolve) .catch(reject); }, delay); @@ -357,7 +352,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { return session; } catch (e) { - window.showErrorMessage(`Sign in failed: ${e}`); + void window.showErrorMessage(`Sign in failed: ${e}`); throw e; } } From 73d44d75c7e968ee9b40fd7a9104daa7741b2116 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 23:26:01 -0700 Subject: [PATCH 75/82] fix: don't spawn infinite exponential backoff loops --- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index 1cb0bcec3..f8914f31e 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -77,6 +77,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { { promise: Promise; cancel: EventEmitter } >(); private _refreshInterval: NodeJS.Timeout | null = null; + private _isRefreshing = false; private static EXPIRATION_TIME_MS = 1000 * 60 * 15; // 15 minutes private static REFRESH_INTERVAL_MS = 1000 * 60 * 10; // 10 minutes @@ -182,10 +183,18 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { } async refreshSessions() { + // Prevent concurrent refresh operations + if (this._isRefreshing) { + return; + } + try { + this._isRefreshing = true; await this._refreshSessions(); } catch (e) { console.error(`Error refreshing sessions: ${e}`); + } finally { + this._isRefreshing = false; } } @@ -238,7 +247,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { try { return await this._refreshSession(refreshToken); } catch (error: any) { - // Don't retry for auth errors (401 Unauthorized) or if we've reached max attempts + // Don't retry for auth errors if ( error.message?.includes("401") || error.message?.includes("Invalid refresh token") || @@ -251,10 +260,9 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { // Calculate exponential backoff delay with jitter const delay = Math.min( baseDelay * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5), - 60 * 60 * 1000, // 1 hour in milliseconds + 2 * 60 * 1000, // 2 minutes ); - // Schedule retry after delay return new Promise((resolve, reject) => { setTimeout(() => { this._refreshSessionWithRetry(refreshToken, attempt + 1, baseDelay) From 94b9782d72ed0afe2573b8959d926a31727db28c Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 08:28:13 -0700 Subject: [PATCH 76/82] fix: workosauthprovider test --- extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts index 55cac92df..f0a7b746d 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts @@ -641,7 +641,7 @@ it("should preserve valid tokens during network errors by retrying", async () => } }); -it("should remove expired tokens when refresh fails", async () => { +it("should remove expired tokens when refresh fails with a 401 error", async () => { // Mock Date.now to return a time that makes tokens appear expired const originalDateNow = Date.now; const futureTime = Date.now() + 7200000; // 2 hours in the future @@ -675,7 +675,7 @@ it("should remove expired tokens when refresh fails", async () => { global.setInterval = vi.fn().mockReturnValue(123 as any); // Refresh will fail with network error - fetchMock.mockRejectedValueOnce(new Error("Network error")); + fetchMock.mockRejectedValueOnce(new Error("401")); // Setup storage mockSecretStorageGet.mockResolvedValue(JSON.stringify([expiredSession])); From 9a15213f63d4da546fa5c9be593144c5ae6d0d84 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 8 Jul 2025 09:35:13 -0700 Subject: [PATCH 77/82] fix: use correct styling on truncate btn --- .../ToolCallDiv/ToolTruncateHistoryIcon.tsx | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx index 12000042d..804dd2918 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx @@ -2,8 +2,8 @@ import { BarsArrowUpIcon } from "@heroicons/react/24/outline"; import { chatMessageIsEmpty } from "core/llm/messages"; import { findLastIndex } from "core/util/findLast"; import { useMemo } from "react"; +import { ToolTip } from "../../../components/gui/Tooltip"; import { useMainEditor } from "../../../components/mainInput/TipTapEditor"; -import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip"; import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; import { truncateHistoryToMessage } from "../../../redux/slices/sessionSlice"; @@ -19,27 +19,38 @@ export function ToolTruncateHistoryIcon({ }, [history]); const dispatch = useAppDispatch(); const { mainEditor } = useMainEditor(); + + const truncateTooltipId = useMemo(() => { + return "truncate-hover-" + historyIndex; + }, [historyIndex]); + if (historyIndex === lastMessageIndex) { return null; } + return ( - { - if (isStreaming) { - return; - } - dispatch( - truncateHistoryToMessage({ - index: historyIndex, - }), - ); - mainEditor?.commands.focus(); - }} - > - - + <> +
{ + e.stopPropagation(); + if (isStreaming) { + return; + } + dispatch( + truncateHistoryToMessage({ + index: historyIndex, + }), + ); + mainEditor?.commands.focus(); + }} + className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isStreaming ? "cursor-not-allowed opacity-50" : "bg-transparent"}`} + > + +
+ + {isStreaming ? "" : "Trim chat to this message"} + + ); } From 7205639dec58fb874e534d89a171181c2a674254 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 8 Jul 2025 09:38:57 -0700 Subject: [PATCH 78/82] fix: update toolbar btn stylings --- .../ToolbarButtonWithTooltip.tsx | 19 ++++---- .../pages/gui/ToolCallDiv/ToolCallArgs.tsx | 30 ++++-------- .../ToolCallDiv/ToolTruncateHistoryIcon.tsx | 47 ++++++++----------- 3 files changed, 37 insertions(+), 59 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx index 58f05ef0c..f8293cd50 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx @@ -1,6 +1,5 @@ import { ReactNode, useMemo } from "react"; -import { Tooltip } from "react-tooltip"; -import { getFontSize } from "../../../util"; +import { ToolTip } from "../../gui/Tooltip"; interface ToolbarButtonWithTooltipProps { onClick: () => void; @@ -22,20 +21,20 @@ export function ToolbarButtonWithTooltip({ return ( <> - - +
+ {tooltipContent} - + ); } diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx index 0c5c188e4..c1b1ec0c7 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx @@ -1,6 +1,5 @@ import { CodeBracketIcon } from "@heroicons/react/24/outline"; -import { useMemo } from "react"; -import { ToolTip } from "../../../components/gui/Tooltip"; +import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip"; interface ArgsToggleIconProps { isShowing: boolean; @@ -13,26 +12,15 @@ export const ArgsToggleIcon = ({ setIsShowing, toolCallId, }: ArgsToggleIconProps) => { - const argsTooltipId = useMemo(() => { - return "args-hover-" + toolCallId; - }, [toolCallId]); - return ( - <> -
{ - e.stopPropagation(); - setIsShowing(!isShowing); - }} - className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isShowing ? "bg-description-muted/30" : "bg-transparent"}`} - > - -
- - {isShowing ? "Hide args" : "Show args"} - - + { + setIsShowing(!isShowing); + }} + > + + ); }; diff --git a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx index 804dd2918..d28cd9328 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx @@ -2,8 +2,8 @@ import { BarsArrowUpIcon } from "@heroicons/react/24/outline"; import { chatMessageIsEmpty } from "core/llm/messages"; import { findLastIndex } from "core/util/findLast"; import { useMemo } from "react"; -import { ToolTip } from "../../../components/gui/Tooltip"; import { useMainEditor } from "../../../components/mainInput/TipTapEditor"; +import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip"; import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; import { truncateHistoryToMessage } from "../../../redux/slices/sessionSlice"; @@ -20,37 +20,28 @@ export function ToolTruncateHistoryIcon({ const dispatch = useAppDispatch(); const { mainEditor } = useMainEditor(); - const truncateTooltipId = useMemo(() => { - return "truncate-hover-" + historyIndex; - }, [historyIndex]); - if (historyIndex === lastMessageIndex) { return null; } return ( - <> -
{ - e.stopPropagation(); - if (isStreaming) { - return; - } - dispatch( - truncateHistoryToMessage({ - index: historyIndex, - }), - ); - mainEditor?.commands.focus(); - }} - className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isStreaming ? "cursor-not-allowed opacity-50" : "bg-transparent"}`} - > - -
- - {isStreaming ? "" : "Trim chat to this message"} - - + { + if (isStreaming) { + return; + } + dispatch( + truncateHistoryToMessage({ + index: historyIndex, + }), + ); + mainEditor?.commands.focus(); + }} + > + + ); } From 2e29e79ab1b6a178d50e04adc3d2a6ea58209fe1 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 09:45:53 -0700 Subject: [PATCH 79/82] chore: bump --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 7d5c2a12a..5cff792dc 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.57", + "version": "1.1.58", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From adc27ff10973076154ef154d918ddfd174886bbc Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 10:11:16 -0700 Subject: [PATCH 80/82] chore: remove .only --- extensions/vscode/e2e/tests/GUI.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 3a540ee48..8eae48307 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -347,7 +347,7 @@ describe("GUI Test", () => { }); describe("Context providers", () => { - it.only("should successfully use the terminal context provider", async () => { + it("should successfully use the terminal context provider", async () => { await GUIActions.selectModelFromDropdown(view, "LAST MESSAGE MOCK LLM"); // Enter just the context provider in the input and send From f8881f43b18447cf0a4c26c24d45c41ad839c32e Mon Sep 17 00:00:00 2001 From: Rohit Khanwani Date: Mon, 7 Jul 2025 01:24:28 +0100 Subject: [PATCH 81/82] change default mode to agent --- gui/src/redux/slices/sessionSlice.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 8d1ef3e3e..dbf019a22 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -74,7 +74,7 @@ const initialState: SessionState = { id: uuidv4(), streamAborter: new AbortController(), symbols: {}, - mode: "chat", + mode: "agent", isInEdit: false, codeBlockApplyStates: { states: [], From ca0938c6799e143fb6bff9e15331208a1772e201 Mon Sep 17 00:00:00 2001 From: Rohit Khanwani Date: Mon, 7 Jul 2025 01:26:58 +0100 Subject: [PATCH 82/82] change tests to check for agent mode as default --- gui/src/pages/gui/chat-tests/Chat.test.tsx | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gui/src/pages/gui/chat-tests/Chat.test.tsx b/gui/src/pages/gui/chat-tests/Chat.test.tsx index b0164a437..638d3538a 100644 --- a/gui/src/pages/gui/chat-tests/Chat.test.tsx +++ b/gui/src/pages/gui/chat-tests/Chat.test.tsx @@ -15,7 +15,7 @@ test("should render input box", async () => { test("should be able to toggle modes", async () => { await renderWithProviders(); - await getElementByText("Chat"); + await getElementByText("Agent"); // Simulate cmd+. keyboard shortcut to toggle modes act(() => { @@ -27,6 +27,18 @@ test("should be able to toggle modes", async () => { ); }); + // Check that it switched to Chat mode + await getElementByText("Chat"); + + act(() => { + document.dispatchEvent( + new KeyboardEvent("keydown", { + key: ".", + metaKey: true, // cmd key on Mac + }), + ); + }); + // Check that it switched to Plan mode await getElementByText("Plan"); @@ -39,19 +51,7 @@ test("should be able to toggle modes", async () => { ); }); - // Check that it switched to Agent mode await getElementByText("Agent"); - - act(() => { - document.dispatchEvent( - new KeyboardEvent("keydown", { - key: ".", - metaKey: true, // cmd key on Mac - }), - ); - }); - - await getElementByText("Chat"); }); test("should send a message and receive a response", async () => {