Merge branch 'main' into update-hf-inference

This commit is contained in:
burtenshaw 2025-12-04 11:06:11 +01:00
commit 0e291f0d49
130 changed files with 4092 additions and 1731 deletions

View file

@ -28,7 +28,7 @@ body:
- **OS**: macOS
- **Continue version**: v0.9.4
- **IDE version**: VSCode 1.85.1
- Model: Claude Sonnet 3.5
- Model: Claude Sonnet 4.5
- Agent configuration
value: |
- OS:

View file

@ -107,7 +107,7 @@ jobs:
ref: ${{ github.event.release.tag_name }}
- name: Import Apple certificate
uses: apple-actions/import-codesign-certs@v5
uses: apple-actions/import-codesign-certs@v6
with:
keychain: ${{ github.run_id }}
keychain-password: ${{ github.run_id }}

View file

@ -22,7 +22,7 @@
"tar": "^7.5.1",
"undici": "^7.16.0",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"vectordb": "0.4.20",
"win-ca": "^3.5.1"
},
"bin": {
@ -117,7 +117,7 @@
"tree-sitter-wasms": "^0.1.11",
"untildify": "^6.0.0",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"vectordb": "0.4.20",
"web-tree-sitter": "^0.21.0",
"win-ca": "^3.5.1",
"wink-nlp-utils": "^2.1.0",
@ -42082,15 +42082,15 @@
},
"../packages/openai-adapters": {
"name": "@continuedev/openai-adapters",
"version": "1.15.0",
"version": "1.32.0",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/sdk": "^0.67.0",
"@aws-sdk/client-bedrock-runtime": "^3.842.0",
"@aws-sdk/credential-providers": "^3.913.0",
"@continuedev/config-types": "^1.0.14",
"@continuedev/config-yaml": "^1.33.0",
"@continuedev/fetch": "^1.5.0",
"@continuedev/config-yaml": "^1.36.0",
"@continuedev/fetch": "^1.6.0",
"dotenv": "^16.5.0",
"google-auth-library": "^10.4.1",
"json-schema": "^0.4.0",
@ -42104,14 +42104,14 @@
"@semantic-release/commit-analyzer": "^13.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.3",
"@semantic-release/npm": "^13.1.2",
"@semantic-release/npm": "^12.0.2",
"@semantic-release/release-notes-generator": "^14.0.3",
"@types/follow-redirects": "^1.14.4",
"@types/jest": "^29.5.14",
"@types/json-schema": "^7.0.15",
"@types/node": "^24.3.0",
"cross-env": "^7.0.3",
"semantic-release": "^25.0.2",
"semantic-release": "^24.2.7",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2",
"vitest": "^3.2.4"

View file

@ -55,7 +55,7 @@
"tar": "^7.5.1",
"undici": "^7.16.0",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"vectordb": "0.4.20",
"win-ca": "^3.5.1"
}
}

View file

@ -100,7 +100,7 @@ export class ConfigHandler {
return `${workspaceId}:::${orgId}`;
}
private async cascadeInit(reason: string) {
private async cascadeInit(reason: string, isLogin?: boolean) {
const signal = this.cascadeAbortController.signal;
this.workspaceDirs = null; // forces workspace dirs reload
@ -118,7 +118,12 @@ export class ConfigHandler {
const workspaceId = await this.getWorkspaceId();
const selectedOrgs =
this.globalContext.get("lastSelectedOrgIdForWorkspace") ?? {};
const currentSelection = selectedOrgs[workspaceId];
let currentSelection = selectedOrgs[workspaceId];
// reset personal org to first available non-personal org on login
if (isLogin && currentSelection === "personal") {
currentSelection = null;
}
const firstNonPersonal = orgs.find(
(org) => org.id !== this.PERSONAL_ORG_DESC.id,
@ -402,6 +407,7 @@ export class ConfigHandler {
const newSession = sessionInfo;
let reload = false;
let isLogin = false;
if (newSession) {
if (currentSession) {
if (
@ -416,6 +422,7 @@ export class ConfigHandler {
} else {
// log in
reload = true;
isLogin = true;
}
} else {
if (currentSession) {
@ -430,7 +437,7 @@ export class ConfigHandler {
this.ide,
);
this.abortCascade();
await this.cascadeInit("Control plane session info update");
await this.cascadeInit("Control plane session info update", isLogin);
}
return reload;
}

View file

@ -42,9 +42,9 @@ function getContentsForNewBlock(blockType: BlockType): ConfigYaml {
configYaml.models = [
{
provider: "anthropic",
model: "claude-3-7-sonnet-latest",
model: "claude-sonnet-4-5",
apiKey: "${{ secrets.ANTHROPIC_API_KEY }}",
name: "Claude 3.7 Sonnet",
name: "Claude Sonnet 4.5",
roles: ["chat", "edit"],
},
];

View file

@ -134,7 +134,7 @@ describe("Anthropic", () => {
test("streamChat should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -155,7 +155,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -177,7 +177,7 @@ describe("Anthropic", () => {
test("chat should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -198,7 +198,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -220,7 +220,7 @@ describe("Anthropic", () => {
test("streamComplete should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -238,7 +238,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -260,7 +260,7 @@ describe("Anthropic", () => {
test("complete should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -278,7 +278,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -301,7 +301,7 @@ describe("Anthropic", () => {
test("should handle system message", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -325,7 +325,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -347,7 +347,7 @@ describe("Anthropic", () => {
test("should handle tool calls", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -386,7 +386,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -424,7 +424,7 @@ describe("Anthropic", () => {
test("should handle custom max tokens", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -446,7 +446,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
max_tokens: 1000,
stream: true,
messages: [
@ -470,7 +470,7 @@ describe("Anthropic", () => {
test("should throw error when API key is missing", async () => {
const anthropic = new Anthropic({
apiKey: "",
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});

View file

@ -6,13 +6,13 @@ import OpenRouter from "./OpenRouter";
describe("OpenRouter Anthropic Caching", () => {
it("should detect Anthropic models correctly", () => {
const openRouter = new OpenRouter({
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
});
// Test private method through modifyChatBody
const body: ChatCompletionCreateParams = {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
messages: [],
};
@ -22,7 +22,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should add cache_control to user messages when caching is enabled", () => {
const openRouter = new OpenRouter({
model: "anthropic/claude-3.5-sonnet",
model: "anthropic/claude-sonnet-4.5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: true,
@ -31,7 +31,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "anthropic/claude-3.5-sonnet",
model: "anthropic/claude-sonnet-4.5",
messages: [
{ role: "user", content: "First message" },
{ role: "assistant", content: "Response" },
@ -71,7 +71,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should correctly handle cache_control with system messages present", () => {
const openRouter = new OpenRouter({
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: true,
@ -80,7 +80,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
messages: [
{ role: "system", content: "You are a helpful assistant" },
{ role: "user", content: "First user message" },
@ -137,7 +137,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should add cache_control to system message when caching is enabled", () => {
const openRouter = new OpenRouter({
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: false,
@ -146,7 +146,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
messages: [
{ role: "system", content: "You are a helpful assistant" },
{ role: "user", content: "Hello" },
@ -176,7 +176,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should handle array content correctly", () => {
const openRouter = new OpenRouter({
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: true,
@ -185,7 +185,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-5",
messages: [
{
role: "user",

View file

@ -179,17 +179,11 @@ describe("PROVIDER_TOOL_SUPPORT", () => {
});
it("should return undefined for Claude Haiku and Opus models", () => {
expect(supportsFn("anthropic.claude-3-5-haiku-20240307-v1:0")).toBe(
false,
);
expect(supportsFn("anthropic.claude-3.5-haiku-20240620-v1:0")).toBe(
false,
);
expect(supportsFn("anthropic.claude-3-7-haiku-20240620-v1:0")).toBe(
false,
);
expect(supportsFn("anthropic.claude-3-5-opus-20240620-v1:0")).toBe(false);
expect(supportsFn("anthropic.claude-3.7-opus-20240620-v1:0")).toBe(false);
expect(supportsFn("anthropic.claude-3-5-haiku-20240307-v1:0")).toBe(true);
expect(supportsFn("anthropic.claude-3.5-haiku-20240620-v1:0")).toBe(true);
expect(supportsFn("anthropic.claude-3-7-haiku-20240620-v1:0")).toBe(true);
expect(supportsFn("anthropic.claude-3-5-opus-20240620-v1:0")).toBe(true);
expect(supportsFn("anthropic.claude-3.7-opus-20240620-v1:0")).toBe(true);
});
it("should return undefined for other unsupported models", () => {

View file

@ -14,39 +14,17 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
}
} catch (e) {}
return [
"claude-3-5",
"claude-3.5",
"claude-3-7",
"claude-3.7",
"claude-sonnet-4",
"claude-4-sonnet",
"gpt-4",
"o3",
"gemini",
"claude-opus-4",
"gemma",
].some((part) => model.toLowerCase().startsWith(part));
return ["claude", "gpt-4", "o3", "gemini", "gemma"].some((part) =>
model.toLowerCase().startsWith(part),
);
},
anthropic: (model) => {
const lower = model.toLowerCase();
if (
[
"claude-3-5",
"claude-3.5",
"claude-3-7",
"claude-3.7",
"claude-sonnet-4",
"claude-4-sonnet",
"claude-opus-4",
].some((part) => lower.startsWith(part))
) {
if (model.includes("claude-2") || model.includes("claude-instant")) {
return false;
}
if (["claude"].some((part) => model.toLowerCase().startsWith(part))) {
return true;
}
if (lower.includes("claude") && lower.includes("4-5")) {
return true;
}
return false;
},
azure: (model) => {
@ -125,15 +103,12 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
);
},
bedrock: (model) => {
if (model.includes("claude-2") || model.includes("claude-instant")) {
return false;
}
if (
[
"claude-3-5-sonnet",
"claude-3.5-sonnet",
"claude-3-7-sonnet",
"claude-3.7-sonnet",
"claude-sonnet-4",
"claude-4-sonnet",
"claude-opus-4",
"claude",
"nova-lite",
"nova-pro",
"nova-micro",
@ -280,8 +255,7 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
"openai/o3",
"openai/o4",
"openai/gpt-oss",
"anthropic/claude-3",
"anthropic/claude-4",
"anthropic/claude",
"microsoft/phi-3",
"google/gemini-flash-1.5",
"google/gemini-2",
@ -391,7 +365,8 @@ export function isRecommendedAgentModel(modelName: string): boolean {
const recs: RegExp[][] = [
[/o[134]/],
[/deepseek/, /r1|reasoner/],
[/gemini/, /2\.5|3/, /pro/],
[/gemini/, /2\.5/, /pro/],
[/gemini/, /3-pro/],
[/gpt/, /-5|5\.1/],
[/claude/, /sonnet/, /3\.7|3-7|-4/],
[/claude/, /opus/, /-4/],

29
core/package-lock.json generated
View file

@ -78,7 +78,7 @@
"tree-sitter-wasms": "^0.1.11",
"untildify": "^6.0.0",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"vectordb": "0.4.20",
"web-tree-sitter": "^0.21.0",
"win-ca": "^3.5.1",
"wink-nlp-utils": "^2.1.0",
@ -217,15 +217,15 @@
},
"../packages/openai-adapters": {
"name": "@continuedev/openai-adapters",
"version": "1.15.0",
"version": "1.32.0",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/sdk": "^0.67.0",
"@aws-sdk/client-bedrock-runtime": "^3.842.0",
"@aws-sdk/credential-providers": "^3.913.0",
"@aws-sdk/client-bedrock-runtime": "^3.925.0",
"@aws-sdk/credential-providers": "^3.925.0",
"@continuedev/config-types": "^1.0.14",
"@continuedev/config-yaml": "^1.33.0",
"@continuedev/fetch": "^1.5.0",
"@continuedev/config-yaml": "^1.36.0",
"@continuedev/fetch": "^1.6.0",
"dotenv": "^16.5.0",
"google-auth-library": "^10.4.1",
"json-schema": "^0.4.0",
@ -239,14 +239,14 @@
"@semantic-release/commit-analyzer": "^13.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.3",
"@semantic-release/npm": "^13.1.2",
"@semantic-release/npm": "^12.0.2",
"@semantic-release/release-notes-generator": "^14.0.3",
"@types/follow-redirects": "^1.14.4",
"@types/jest": "^29.5.14",
"@types/json-schema": "^7.0.15",
"@types/node": "^24.3.0",
"cross-env": "^7.0.3",
"semantic-release": "^25.0.2",
"semantic-release": "^24.2.7",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2",
"vitest": "^3.2.4"
@ -14678,9 +14678,9 @@
}
},
"node_modules/mdast-util-to-hast": {
"version": "13.2.0",
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz",
"integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==",
"version": "13.2.1",
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",
"integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -15291,9 +15291,10 @@
}
},
"node_modules/node-forge": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.2.tgz",
"integrity": "sha512-6xKiQ+cph9KImrRh0VsjH2d8/GXA4FIMlgU4B757iI1ApvcyA9VlouP0yZJha01V+huImO+kKMU7ih+2+E14fw==",
"license": "(BSD-3-Clause OR GPL-2.0)",
"engines": {
"node": ">= 6.13.0"
}

View file

@ -123,7 +123,7 @@
"tree-sitter-wasms": "^0.1.11",
"untildify": "^6.0.0",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"vectordb": "0.4.20",
"web-tree-sitter": "^0.21.0",
"win-ca": "^3.5.1",
"wink-nlp-utils": "^2.1.0",

View file

@ -13,7 +13,7 @@ export const grepSearchTool: Tool = {
function: {
name: BuiltInToolNames.GrepSearch,
description:
"Performs a regex search over the repository using ripgrep. Will not include results for many build, cache, secrets dirs/files. Output may be truncated, so use targeted queries",
"Performs a regular expression (regex) search over the repository using ripgrep. Will not include results for many build, cache, secrets dirs/files. Output may be truncated, so use targeted queries",
parameters: {
type: "object",
required: ["query"],
@ -21,7 +21,7 @@ export const grepSearchTool: Tool = {
query: {
type: "string",
description:
"The search query to use. Must be the exact string to be searched or a valid ripgrep expression. Use regex with alternation (e.g., 'word1|word2|word3) or character classes to find multiple potential words in a single search.",
"The regex pattern to search for within file contents. Use regex with alternation (e.g., 'word1|word2|word3') or character classes to find multiple potential words in a single search.",
},
},
},

View file

@ -1,7 +1,6 @@
import iconv from "iconv-lite";
import childProcess from "node:child_process";
import os from "node:os";
import util from "node:util";
import { ContinueError, ContinueErrorReason } from "../../util/errors";
// Automatically decode the buffer according to the platform to avoid garbled Chinese
function getDecodedOutput(data: Buffer): string {
@ -44,7 +43,25 @@ import {
} from "../../util/processTerminalStates";
import { getBooleanArg, getStringArg } from "../parseArgs";
const asyncExec = util.promisify(childProcess.exec);
/**
* Resolves the working directory from workspace dirs.
* Falls back to home directory or temp directory if no workspace is available.
*/
function resolveWorkingDirectory(workspaceDirs: string[]): string {
const fileWorkspaceDir = workspaceDirs.find((dir) =>
dir.startsWith("file:/"),
);
if (fileWorkspaceDir) {
return fileURLToPath(fileWorkspaceDir);
}
// Default to user's home directory with fallbacks
try {
return process.env.HOME || process.env.USERPROFILE || process.cwd();
} catch {
// Final fallback if even process.cwd() fails - use system temp directory
return os.tmpdir();
}
}
// Add color-supporting environment variables
const getColorEnv = () => ({
@ -82,20 +99,7 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
if (extras.onPartialOutput) {
try {
const workspaceDirs = await extras.ide.getWorkspaceDirs();
// Handle case where no workspace is available
let cwd: string;
if (workspaceDirs.length > 0) {
cwd = fileURLToPath(workspaceDirs[0]);
} else {
// Default to user's home directory with fallbacks
try {
cwd = process.env.HOME || process.env.USERPROFILE || process.cwd();
} catch (error) {
// Final fallback if even process.cwd() fails - use system temp directory
cwd = os.tmpdir();
}
}
const cwd = resolveWorkingDirectory(workspaceDirs);
return new Promise((resolve, reject) => {
let terminalOutput = "";
@ -281,23 +285,7 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
} else {
// Fallback to non-streaming for older clients
const workspaceDirs = await extras.ide.getWorkspaceDirs();
// Handle case where no workspace is available
let cwd: string;
const fileWorkspaceDir = workspaceDirs.find((dir) =>
dir.startsWith("file:/"),
);
if (fileWorkspaceDir) {
cwd = fileURLToPath(fileWorkspaceDir);
} else {
// Default to user's home directory with fallbacks
try {
cwd = process.env.HOME || process.env.USERPROFILE || process.cwd();
} catch (error) {
// Final fallback if even process.cwd() fails - use system temp directory
cwd = os.tmpdir();
}
}
const cwd = resolveWorkingDirectory(workspaceDirs);
if (waitForCompletion) {
// Standard execution, waiting for completion

View file

@ -18,15 +18,38 @@ export function getStringArg(
argName: string,
allowEmpty = false,
): string {
if (!args || !(argName in args) || typeof args[argName] !== "string") {
if (!args || !(argName in args)) {
throw new Error(
`\`${argName}\` argument is required${allowEmpty ? "" : " and must not be empty or whitespace-only"}. (type string)`,
);
}
if (!allowEmpty && !args[argName].trim()) {
let value = args[argName];
// Handle case where JSON was parsed into an object by the tool call parser.
// If the arguments to the tool call are valid JSON (e.g. the model attempts to create a .json file)
// the earlier call to JSON.parse() will have deeply parsed the returned arguments.
// If that has happened, convert back to string.
if (typeof value === "object" && value !== null) {
try {
value = JSON.stringify(value);
return value;
} catch (e) {
//Swallow this, because it might be fine later.
}
}
if (typeof value !== "string") {
throw new Error(
`\`${argName}\` argument is required${allowEmpty ? "" : " and must not be empty or whitespace-only"}. (type string)`,
);
}
if (!allowEmpty && !value.trim()) {
throw new Error(`Argument ${argName} must not be empty or whitespace-only`);
}
return args[argName];
return value;
}
export function getOptionalStringArg(

View file

@ -144,6 +144,50 @@ describe("getStringArg", () => {
"`name` argument is required and must not be empty or whitespace-only. (type string)",
);
});
it("should convert parsed JSON object to string for contents parameter", () => {
// This simulates the case where JSON.parse() has converted a JSON string into an object
const args = { contents: { key: "value", number: 123 } };
const result = getStringArg(args, "contents");
expect(result).toBe('{"key":"value","number":123}');
});
it("should convert nested JSON object to string for contents parameter", () => {
const args = {
contents: {
user: {
name: "John",
details: {
age: 30,
preferences: ["coding", "reading"],
},
},
},
};
const result = getStringArg(args, "contents");
const expected =
'{"user":{"name":"John","details":{"age":30,"preferences":["coding","reading"]}}}';
expect(result).toBe(expected);
});
it("should convert JSON array to string for contents parameter", () => {
const args = { contents: ["item1", "item2", { key: "value" }] };
const result = getStringArg(args, "contents");
expect(result).toBe('["item1","item2",{"key":"value"}]');
});
it("should handle contents parameter that is already a string", () => {
const args = { contents: "already a string" };
const result = getStringArg(args, "contents");
expect(result).toBe("already a string");
});
it("should handle contents parameter that is null", () => {
const args = { contents: null };
expect(() => getStringArg(args, "contents")).toThrowError(
"`contents` argument is required and must not be empty or whitespace-only. (type string)",
);
});
});
describe("getOptionalStringArg", () => {

View file

@ -150,16 +150,6 @@ export function prepareQueryForRipgrep(query: string): {
query: string;
warning?: string;
} {
// Check if it looks like a literal search that should be escaped
if (looksLikeLiteralSearch(query)) {
return {
query: escapeLiteralForRegex(query),
warning:
"Query contained special regex characters and was escaped for literal text search",
};
}
// Otherwise validate and sanitize as regex
const validation = validateAndSanitizeRegex(query);
return {

View file

@ -111,8 +111,7 @@ describe("looksLikeLiteralSearch", () => {
describe("prepareQueryForRipgrep", () => {
it("should escape literal-looking queries", () => {
const result = prepareQueryForRipgrep("hello.world");
expect(result.query).toBe("hello\\.world");
expect(result.warning).toContain("escaped for literal text search");
expect(result.query).toBe("hello.world");
});
it("should sanitize regex patterns", () => {
@ -130,14 +129,12 @@ describe("prepareQueryForRipgrep", () => {
describe("real-world examples", () => {
it("should escape file patterns", () => {
const result = prepareQueryForRipgrep("*.js");
expect(result.query).toBe("\\*\\.js");
expect(result.warning).toContain("escaped for literal text search");
expect(result.query).toBe("*.js");
});
it("should escape function calls", () => {
const result = prepareQueryForRipgrep("console.log()");
expect(result.query).toBe("console\\.log\\(\\)");
expect(result.warning).toContain("escaped for literal text search");
expect(result.query).toBe("console.log()");
});
it("should not escape proper regex patterns", () => {
@ -163,8 +160,7 @@ describe("problematic patterns that originally failed", () => {
it("should handle dollar signs in shell patterns", () => {
const result = prepareQueryForRipgrep("$(command)");
expect(result.query).toBe("\\$\\(command\\)");
expect(result.warning).toContain("escaped for literal text search");
expect(result.query).toBe("$(command)");
});
it("should handle escaped dollar signs", () => {
@ -253,8 +249,7 @@ describe("patterns that should NOT be over-sanitized", () => {
describe("edge cases that could trigger false positives", () => {
it("should not treat mathematical expressions as problematic", () => {
const result = prepareQueryForRipgrep("a + b * c");
expect(result.query).toBe("a \\+ b \\* c"); // Should be escaped as literal
expect(result.warning).toContain("escaped for literal text search");
expect(result.query).toBe("a + b * c"); // Should be escaped as literal
});
it("should not break regex that uses word boundaries", () => {
@ -271,8 +266,7 @@ describe("patterns that should NOT be over-sanitized", () => {
it("should not treat IPv4 addresses as problematic regex", () => {
const result = prepareQueryForRipgrep("192.168.1.1");
expect(result.query).toBe("192\\.168\\.1\\.1"); // Should be escaped as literal
expect(result.warning).toContain("escaped for literal text search");
expect(result.query).toBe("192.168.1.1"); // Should be escaped as literal
});
it("should not break hex color codes", () => {
@ -285,8 +279,7 @@ describe("patterns that should NOT be over-sanitized", () => {
describe("patterns that should preserve user intent", () => {
it("should not sanitize intentional regex alternation", () => {
const result = prepareQueryForRipgrep("(foo|bar)");
expect(result.query).toBe("\\(foo\\|bar\\)"); // Should be escaped as literal since unescaped
expect(result.warning).toContain("escaped for literal text search");
expect(result.query).toBe("(foo|bar)"); // Should be escaped as literal since unescaped
});
it("should preserve escaped alternation in regex", () => {
@ -300,11 +293,5 @@ describe("patterns that should NOT be over-sanitized", () => {
expect(result.query).toBe("name LIKE '%john%'"); // No regex metacharacters here
expect(result.warning).toBeUndefined();
});
it("should not break CSS selectors when used as literal search", () => {
const result = prepareQueryForRipgrep(".class-name > div:nth-child(2)");
expect(result.query).toBe("\\.class-name > div:nth-child\\(2\\)");
expect(result.warning).toContain("escaped for literal text search");
});
});
});

View file

@ -21,6 +21,10 @@ If you want to have the best autocomplete experience, we recommend using Codestr
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Codestral
provider: mistral
@ -68,6 +72,10 @@ Then, add the model to your configuration:
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Qwen 1.5b Autocomplete Model
provider: ollama
@ -104,6 +112,10 @@ For example:
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Qwen3 without Thinking for Autocomplete
provider: ollama

View file

@ -8,6 +8,10 @@ The SambaNova Cloud is a cloud platform for running large AI models with the wor
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: GPT OSS 120B
provider: sambanova

View file

@ -33,6 +33,10 @@ Add your Ask Sage model to your Continue configuration file.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: GPT-4 gov
provider: askSage
@ -66,6 +70,10 @@ For secure environments, specify your DoD CA bundle path:
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: GPT-4 gov
provider: askSage

View file

@ -12,6 +12,10 @@ Cerebras Inference uses specialized silicon to provides fast inference.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Cerebras Llama 3.1 70B
provider: cerebras

View file

@ -8,6 +8,10 @@ Cloudflare Workers AI can be used for both chat and tab autocompletion in Contin
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llama 3 8B
provider: cloudflare

View file

@ -12,6 +12,10 @@ We recommend configuring **Command A** as your chat model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Command A 03-2025
provider: cohere
@ -48,6 +52,10 @@ We recommend configuring **embed-v4.0** as your embeddings model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Cohere Embed v4.0
provider: cohere
@ -77,6 +85,10 @@ We recommend configuring **rerank-v3.5** as your reranking model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Cohere Rerank v3.5
provider: cohere

View file

@ -16,6 +16,10 @@ description: "Configure DeepInfra with Continue to access low-cost inference for
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: deepinfra

View file

@ -16,6 +16,10 @@ slug: ../deepseek
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: deepseek

View file

@ -8,6 +8,10 @@ description: "Configure Flowise with Continue to integrate with this low-code/no
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Flowise
provider: flowise

View file

@ -18,6 +18,10 @@ Function Network supports a number of models for chat. We recommend using LLama
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llama 3.1 70b
provider: function-network
@ -52,6 +56,10 @@ Function Network supports a number of models for autocomplete. We recommend usin
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Deepseek Coder 6.7b
provider: function-network
@ -82,6 +90,10 @@ Function Network supports a number of models for embeddings. We recommend using
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: BGE Base En
provider: function-network

View file

@ -12,6 +12,10 @@ sidebarTitle: "Groq"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: groq

View file

@ -14,6 +14,10 @@ IPEX-LLM supports accelerated Ollama backend to be hosted on Intel GPU. Refer to
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: IPEX-LLM
provider: ollama
@ -40,6 +44,10 @@ If you would like to reach the Ollama service from another machine, make sure yo
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: IPEX-LLM
provider: ollama

View file

@ -10,6 +10,10 @@ Kindo offers centralized control over your organization's AI operations, ensurin
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Claude 3.5 Sonnet
provider: kindo
@ -38,6 +42,10 @@ Kindo offers centralized control over your organization's AI operations, ensurin
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: WhiteRabbitNeo
provider: kindo

View file

@ -33,6 +33,10 @@ If you need custom settings, you can manually configure Lemonade:
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Lemonade
provider: lemonade

View file

@ -11,6 +11,10 @@ title: "Llama.cpp"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: llama.cpp

View file

@ -8,6 +8,10 @@ A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contai
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llamafile
provider: llamafile

View file

@ -10,6 +10,10 @@ keywords: [llama, stack, local, api, inference]
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: llamastack

View file

@ -16,6 +16,10 @@ slug: ../mistral
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: mistral

View file

@ -15,6 +15,10 @@ To use Moonshot AI models, you need to:
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Moonshot
provider: moonshot
@ -61,6 +65,10 @@ Here's a complete configuration example:
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Moonshot-8K
provider: moonshot

View file

@ -8,6 +8,10 @@ Morph provides a fast apply model that helps you quickly and accurately apply co
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- uses: morphllm/morph-v0
with:
@ -15,6 +19,10 @@ Morph provides a fast apply model that helps you quickly and accurately apply co
```
or
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
- name: Morph Fast Apply
provider: openai
model: morph-v2
@ -54,6 +62,10 @@ We recommend configuring **morph-embedding-v2** as your embeddings model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Morph Embeddings
provider: openai
@ -85,6 +97,10 @@ We recommend configuring **morph-rerank-v2** as your reranking model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Morph Reranker
provider: cohere

View file

@ -8,6 +8,10 @@ description: "Configure Msty with Continue to easily run both online and local o
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Msty
provider: msty
@ -47,6 +51,10 @@ If you need to send custom headers for authentication, you may use the `requestO
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Msty
provider: msty

View file

@ -14,6 +14,10 @@ Available models can be found on the [Nebius AI Studio models page](https://stud
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: DeepSeek R1
provider: nebius
@ -44,6 +48,10 @@ Available models can be found on the [Nebius AI Studio embeddings page](https://
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: BAAI Embedder
provider: nebius

View file

@ -8,6 +8,10 @@ description: "Configure Novita AI with Continue to access their affordable and r
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llama 3.1 8B
provider: novita

View file

@ -11,6 +11,10 @@ title: "NVIDIA"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: nvidia

View file

@ -14,6 +14,10 @@ OpenVINO™ Mode Server supports text generation via OpenAI Chat Completions API
Example configuration once OVMS is launched:
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: OVMS CodeLlama-7b-Instruct-hf
provider: openai

View file

@ -20,6 +20,10 @@ Check our [catalog](https://endpoints.ai.cloud.ovh.net/catalog) to see all of ou
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Qwen2.5-Coder-32B-Instruct
provider: ovhcloud
@ -50,6 +54,10 @@ We recommend configuring **bge-multilingual-gemma2** as your embeddings model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: BGE Multilingual Gemma2
provider: ovhcloud

View file

@ -8,6 +8,10 @@ Replicate is a great option for newly released language models or models that yo
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Replicate CodeLLama
provider: replicate

View file

@ -10,6 +10,10 @@ Here is an example Sagemaker configuration setup:
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: deepseek-6.7b-instruct
provider: sagemaker

View file

@ -20,6 +20,10 @@ We recommend configuring **Qwen2.5-Coder-32B-Instruct** as your chat model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Qwen2.5-Coder-32B-Instruct
provider: scaleway
@ -56,6 +60,10 @@ We recommend configuring **BGE-Multilingual-Gemma2** as your embeddings model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: BGE Multilingual Gemma2
provider: scaleway

View file

@ -15,6 +15,10 @@ We recommend configuring **Qwen/Qwen2.5-Coder-32B-Instruct** as your chat model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Qwen
provider: siliconflow
@ -47,6 +51,10 @@ We recommend configuring **Qwen/Qwen2.5-Coder-7B-Instruct** as your autocomplete
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Qwen
provider: siliconflow

View file

@ -8,6 +8,10 @@ TextGenWebUI is a comprehensive, open-source language model UI and local server.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Text Generation WebUI
provider: text-gen-webui

View file

@ -16,6 +16,10 @@ sidebarTitle: "Together AI"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: together

View file

@ -16,6 +16,10 @@ We recommend configuring **Llama3.1 8B** as your chat model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llama3.1 8B Instruct
provider: vllm
@ -46,6 +50,10 @@ We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Qwen2.5-Coder 1.5B
provider: vllm
@ -76,6 +84,10 @@ We recommend configuring **Nomic Embed Text** as your embeddings model.
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: VLLM Nomad Embed Text
provider: vllm

View file

@ -46,6 +46,10 @@ Add the following configuration:
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: watsonx - Model Name
provider: watsonx
@ -83,6 +87,10 @@ If you are using a custom deployment endpoint, set `deploymentID` to the model's
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: watsonx - Model Name
provider: watsonx
@ -121,6 +129,10 @@ You can also configure generation parameters, such as temperature, topP, topK, f
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Granite Code 20b
provider: watsonx
@ -180,6 +192,10 @@ Granite models are recommended for tab auto complete. The configuration is simil
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Granite Code 8b
provider: watsonx
@ -217,6 +233,10 @@ To view the list of available embeddings models, visit [this page](https://datap
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Watsonx Embedder
provider: watsonx
@ -250,6 +270,10 @@ To view the list of available embeddings models, visit [this page](https://datap
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Watsonx Reranker
provider: watsonx

View file

@ -12,6 +12,10 @@ slug: ../xai
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: xai

View file

@ -17,6 +17,10 @@ sidebarTitle: "Anthropic"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: anthropic
@ -41,7 +45,7 @@ sidebarTitle: "Anthropic"
</Tabs>
<Info>
**Check out a more advanced configuration [here](https://hub.continue.dev/anthropic/claude-4-sonnet?view=config)**
**Check out a more advanced configuration [here](https://hub.continue.dev/anthropic/claude-sonnet-4-5?view=config)**
</Info>
## How to Enable Prompt Caching with Claude
@ -53,6 +57,10 @@ To enable caching of the system message and the turn-by-turn conversation, updat
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: anthropic

View file

@ -11,6 +11,10 @@ sidebarTitle: "Azure AI Foundry"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <Model_NAME>
provider: azure
@ -55,6 +59,10 @@ For example, a Target URI of `https://just-an-example.openai.azure.com/openai/de
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
model: <MODEL_ID>

View file

@ -17,6 +17,10 @@ sidebarTitle: "Amazon Bedrock"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: bedrock
@ -57,6 +61,10 @@ messages between requests. Enable this behavior by adding
configuration.
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: bedrock
@ -84,6 +92,10 @@ You can also use an AWS `accessKeyId` and `secretAccessKey` for authentication i
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: bedrock
@ -121,6 +133,10 @@ To setup Bedrock using custom imported models, add the following to your config
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: bedrockimport

View file

@ -17,6 +17,10 @@ sidebarTitle: "Gemini"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: gemini

View file

@ -17,6 +17,10 @@ sidebarTitle: "Inception"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: inception

View file

@ -15,6 +15,10 @@ title: "LM Studio"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: lmstudio

View file

@ -17,6 +17,10 @@ sidebarTitle: "Ollama"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: ollama
@ -51,6 +55,10 @@ Ollama models usually have their capabilities auto-detected correctly. However,
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <CUSTOM_MODEL_NAME>
provider: ollama

View file

@ -17,6 +17,10 @@ sidebarTitle: "OpenAI"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: openai
@ -63,6 +67,10 @@ If you are using an OpenAI API compatible providers, you can change the `apiBase
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <OPENAI_API_COMPATIBLE_PROVIDER_MODEL>
provider: openai
@ -95,6 +103,10 @@ To force usage of `completions` instead of `chat/completions` endpoint you can s
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <OPENAI_API_COMPATIBLE_PROVIDER_MODEL>
provider: openai

View file

@ -14,6 +14,10 @@ sidebarTitle: "OpenRouter"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: openrouter
@ -52,6 +56,10 @@ For example, to prevent extra long prompts from being compressed, you can explic
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: openrouter
@ -97,6 +105,10 @@ If you're experiencing issues with Agent mode or tools not working, you can add
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: openrouter

View file

@ -14,6 +14,10 @@ sidebarTitle: "Vertex AI"
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: vertexai
@ -47,6 +51,10 @@ You can use Vertex AI in [express mode](https://cloud.google.com/vertex-ai/gener
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: <MODEL_NAME>
provider: vertexai

View file

@ -29,6 +29,10 @@ Our current top recommendations are Claude Opus 4.5 and Claude Sonnet 4 from [An
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Claude Opus 4.5
provider: anthropic
@ -57,6 +61,10 @@ If you prefer to use an open-weight model, then the Gemma family of Models from
<Tabs>
<Tab title="Ollama">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: "Gemma 3 27B"
provider: "ollama"
@ -65,6 +73,10 @@ If you prefer to use an open-weight model, then the Gemma family of Models from
</Tab>
<Tab title="Together">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: "Gemma 3 27B"
provider: "together"
@ -86,6 +98,10 @@ If you prefer to use a model from [OpenAI](../model-providers/top-level/openai),
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: GPT-5.1
provider: openai
@ -105,6 +121,10 @@ If you prefer to use a model from [xAI](../model-providers/more/xAI), then we re
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Grok-4.1
provider: xAI
@ -124,6 +144,10 @@ If you prefer to use a model from [Google](../model-providers/top-level/gemini),
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Gemini 3 Pro
provider: gemini
@ -157,6 +181,10 @@ If your local machine can run an 8B parameter model, then we recommend running L
<Tabs>
<Tab title="Ollama">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llama 3.1 8B
provider: ollama
@ -165,6 +193,10 @@ If your local machine can run an 8B parameter model, then we recommend running L
</Tab>
<Tab title="LM Studio">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llama 3.1 8B
provider: lmstudio
@ -173,6 +205,10 @@ If your local machine can run an 8B parameter model, then we recommend running L
</Tab>
<Tab title="Msty">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Llama 3.1 8B
provider: msty
@ -203,6 +239,10 @@ If your local machine can run a 16B parameter model, then we recommend running D
<Tabs>
<Tab title="Ollama">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: DeepSeek Coder 2 16B
provider: ollama
@ -211,6 +251,10 @@ If your local machine can run a 16B parameter model, then we recommend running D
</Tab>
<Tab title="LM Studio">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: DeepSeek Coder 2 16B
provider: lmstudio
@ -219,6 +263,10 @@ If your local machine can run a 16B parameter model, then we recommend running D
</Tab>
<Tab title="Msty">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: DeepSeek Coder 2 16B
provider: msty

View file

@ -11,6 +11,10 @@ It's often useful to select a different model to respond to Edit instructions th
In Continue, you can add `edit` to a model's roles to specify that it can be used for Edit requests. If no edit models are specified, the selected `chat` model is used.
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Claude 4 Sonnet
provider: anthropic

View file

@ -37,6 +37,10 @@ After obtaining an API key from [here](https://www.voyageai.com/), you can confi
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Voyage Code 3
provider: voyage
@ -70,6 +74,10 @@ See [here](../model-providers/top-level/ollama#embeddings-model) for instruction
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: default-transformers
provider: transformers.js
@ -99,6 +107,10 @@ See [here](../model-providers/top-level/ollama#embeddings-model) for instruction
</Tab> */}
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Huggingface TEI Embedder
provider: huggingface-tei

View file

@ -24,12 +24,20 @@ Voyage AI offers the best reranking model for code with their `rerank-2` model.
<Tabs>
<Tab title="Hub">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- uses: voyageai/rerank-2
```
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: My Voyage Reranker
provider: voyage
@ -52,6 +60,10 @@ See Cohere's documentation for rerankers [here](https://docs.cohere.com/docs/rer
</Tab> */}
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Cohere Reranker
provider: cohere
@ -74,6 +86,10 @@ If you only have access to a single LLM, then you can use it as a reranker. This
</Tab> */}
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: LLM Reranker
provider: openai
@ -97,6 +113,10 @@ If you only have access to a single LLM, then you can use it as a reranker. This
</Tab> */}
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: Huggingface-tei Reranker
provider: huggingface-tei

View file

@ -30,10 +30,10 @@ Read more about [model roles](/customize/model-roles), [model capabilities](/cus
# Frontier Models
[Claude 4 Sonnet](https://hub.continue.dev/anthropic/claude-4-sonnet) from Anthropic
[Claude Sonnet 4.5](https://hub.continue.dev/anthropic/claude-sonnet-4-5) from Anthropic
1. Get your API key from [Anthropic](https://console.anthropic.com/)
2. Add [Claude 4 Sonnet](https://hub.continue.dev/anthropic/claude-4-sonnet) to a config on Continue Mission Control
2. Add[Claude Sonnet 4.5](https://hub.continue.dev/anthropic/claude-sonnet-4-5) to a config on Continue Mission Control
3. Add `ANTHROPIC_API_KEY` as a [User Secret](https://docs.continue.dev/mission-control/secrets/secret-types#user-secrets) on Continue Mission Control [here](https://hub.continue.dev/settings/secrets)
4. Click `Reload config` in the config selector in the Continue IDE extension

View file

@ -141,6 +141,10 @@ For all options, first:
Install from Hub (recommended) or add YAML manually. Minimal YAML example:
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
mcpServers:
- name: Atlassian Rovo MCP
type: sse

View file

@ -83,6 +83,10 @@ After ensuring you meet the **Prerequisites** above, you have two paths to get s
Install from Hub (recommended) or add YAML manually. Minimal YAML example:
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
mcpServers:
- name: GitHub MCP
command: npx

143
docs/package-lock.json generated
View file

@ -1189,7 +1189,6 @@
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
"integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
"license": "ISC",
"peer": true,
"dependencies": {
"string-width": "^5.1.2",
"string-width-cjs": "npm:string-width@^4.2.0",
@ -1206,15 +1205,13 @@
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@isaacs/cliui/node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
"license": "MIT",
"peer": true,
"dependencies": {
"eastasianwidth": "^0.2.0",
"emoji-regex": "^9.2.2",
@ -1232,7 +1229,6 @@
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"ansi-styles": "^6.1.0",
"string-width": "^5.0.1",
@ -1859,6 +1855,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz",
"integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",
"license": "Apache-2.0",
"peer": true,
"engines": {
"node": ">=8.0.0"
}
@ -1868,7 +1865,6 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.208.0.tgz",
"integrity": "sha512-CjruKY9V6NMssL/T1kAFgzosF1v9o6oeN+aX5JB/C/xPNtmgIJqcXHG7fA82Ou1zCpWGl4lROQUKwUNE1pMCyg==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@opentelemetry/api": "^1.3.0"
},
@ -3129,6 +3125,7 @@
"resolved": "https://registry.npmjs.org/@orpc/contract/-/contract-1.8.1.tgz",
"integrity": "sha512-zw0xgRxOyR/otX+4UeGEm0VjuMH/AeVbEuWvPNRJC8xxvQpaPJFo8Nr8eaywqSUZo1DnIS+pkwsdipa7GgFl7A==",
"license": "MIT",
"peer": true,
"dependencies": {
"@orpc/client": "1.8.1",
"@orpc/shared": "1.8.1",
@ -3234,6 +3231,7 @@
"resolved": "https://registry.npmjs.org/@orpc/server/-/server-1.8.1.tgz",
"integrity": "sha512-Aei7KJSMG9daNdubREeDYKCnmSRTnZT7V1Cx0NFLYDYqx8Bdil2J2InJghsio6AZdJUWLNq/zMm6QDu3NN2E6g==",
"license": "MIT",
"peer": true,
"dependencies": {
"@orpc/client": "1.8.1",
"@orpc/contract": "1.8.1",
@ -3483,7 +3481,6 @@
"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">=14"
}
@ -4061,8 +4058,7 @@
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz",
"integrity": "sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@standard-schema/spec": {
"version": "1.0.0",
@ -4667,6 +4663,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -4736,6 +4733,7 @@
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fast-uri": "^3.0.1",
@ -4835,7 +4833,6 @@
"resolved": "https://registry.npmjs.org/ansis/-/ansis-3.17.0.tgz",
"integrity": "sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg==",
"license": "ISC",
"peer": true,
"engines": {
"node": ">=14"
}
@ -4859,7 +4856,6 @@
"resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz",
"integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">= 6.0.0"
}
@ -5965,7 +5961,6 @@
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"license": "MIT",
"peer": true,
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
@ -5980,8 +5975,7 @@
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
"devOptional": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/data-uri-to-buffer": {
"version": "6.0.2",
@ -6051,8 +6045,7 @@
"version": "1.11.19",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
"integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/debug": {
"version": "4.4.1",
@ -6119,7 +6112,6 @@
"resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.0.tgz",
"integrity": "sha512-HGFtf8yhuhGhqO07SV79tRp+br4MnbdjeVxotpn1QBl30pcLLCQjX5b2295ll0fv8RKDKsmWYrl05usHM9CewQ==",
"license": "MIT",
"peer": true,
"peerDependencies": {
"babel-plugin-macros": "^3.1.0"
},
@ -6302,7 +6294,8 @@
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz",
"integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==",
"dev": true,
"license": "BSD-3-Clause"
"license": "BSD-3-Clause",
"peer": true
},
"node_modules/dns-packet": {
"version": "5.6.1",
@ -6335,7 +6328,6 @@
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
"license": "BSD-2-Clause",
"peer": true,
"engines": {
"node": ">=12"
},
@ -6348,6 +6340,7 @@
"resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.44.7.tgz",
"integrity": "sha512-quIpnYznjU9lHshEOAYLoZ9s3jweleHlZIAWR/jX9gAWNg/JhQ1wj0KGRf7/Zm+obRrYd9GjPVJg790QY9N5AQ==",
"license": "Apache-2.0",
"peer": true,
"peerDependencies": {
"@aws-sdk/client-rds-data": ">=3",
"@cloudflare/workers-types": ">=4",
@ -6486,8 +6479,7 @@
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/ee-first": {
"version": "1.1.1",
@ -7063,40 +7055,40 @@
}
},
"node_modules/express": {
"version": "4.21.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
"integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
"version": "4.22.0",
"resolved": "https://registry.npmjs.org/express/-/express-4.22.0.tgz",
"integrity": "sha512-c2iPh3xp5vvCLgaHK03+mWLFPhox7j1LwyxcZwFVApEv5i0X+IjPpbT50SJJwwLpdBVfp45AkK/v+AFgv/XlfQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "1.20.3",
"content-disposition": "0.5.4",
"body-parser": "~1.20.3",
"content-disposition": "~0.5.4",
"content-type": "~1.0.4",
"cookie": "0.7.1",
"cookie-signature": "1.0.6",
"cookie": "~0.7.1",
"cookie-signature": "~1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.3.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"finalhandler": "~1.3.1",
"fresh": "~0.5.2",
"http-errors": "~2.0.0",
"merge-descriptors": "1.0.3",
"methods": "~1.1.2",
"on-finished": "2.4.1",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.12",
"path-to-regexp": "~0.1.12",
"proxy-addr": "~2.0.7",
"qs": "6.13.0",
"qs": "~6.14.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.19.0",
"serve-static": "1.16.2",
"send": "~0.19.0",
"serve-static": "~1.16.2",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"statuses": "~2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
@ -7126,6 +7118,22 @@
"dev": true,
"license": "MIT"
},
"node_modules/express/node_modules/qs": {
"version": "6.14.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.1.0"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
@ -7348,7 +7356,6 @@
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
"integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
"license": "ISC",
"peer": true,
"dependencies": {
"cross-spawn": "^7.0.6",
"signal-exit": "^4.0.1"
@ -7365,7 +7372,6 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"license": "ISC",
"peer": true,
"engines": {
"node": ">=14"
},
@ -7707,7 +7713,6 @@
"resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
"integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
"license": "ISC",
"peer": true,
"dependencies": {
"foreground-child": "^3.1.0",
"jackspeak": "^3.1.2",
@ -7741,7 +7746,6 @@
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"balanced-match": "^1.0.0"
}
@ -7751,7 +7755,6 @@
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"license": "ISC",
"peer": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
@ -7767,7 +7770,6 @@
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"license": "ISC",
"peer": true,
"engines": {
"node": ">=16 || 14 >=14.17"
}
@ -8428,6 +8430,7 @@
"integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==",
"devOptional": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/immer"
@ -8455,7 +8458,6 @@
"resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-2.0.0.tgz",
"integrity": "sha512-yNZhyQYqXpkT0AKq3F3KLasUSK4fHvebNH5hOsKQw2dhGSALvQ4U0BqUc5suziKvydO5u5hgN2hy1RJaho8U5A==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"acorn": "^8.14.0",
"acorn-import-attributes": "^1.9.5",
@ -8488,6 +8490,7 @@
"integrity": "sha512-vhhFrCodTHZAPPSdMYzLEbeI0Ug37R9j6yA0kLKok9kSK53lQtj/RJhEQJUjq6OwT4N33nxqSRd/7yXhEhVPIw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@alcalzone/ansi-tokenize": "^0.1.3",
"ansi-escapes": "^7.0.0",
@ -9277,15 +9280,13 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"license": "ISC",
"peer": true
"license": "ISC"
},
"node_modules/jackspeak": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
"integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
"license": "BlueOak-1.0.0",
"peer": true,
"dependencies": {
"@isaacs/cliui": "^8.0.2"
},
@ -9329,6 +9330,7 @@
"integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">= 10.16.0"
}
@ -9445,6 +9447,7 @@
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.27.6.tgz",
"integrity": "sha512-FIyV/64EkKhJmjgC0g2hygpBv5RNWVPyNCqSAD7eTCv6eFWNIi4PN1UvdSJGicN/o35bnevgis4Y0UDC0qi8jQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=14.0.0"
}
@ -11324,8 +11327,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
"license": "BlueOak-1.0.0",
"peer": true
"license": "BlueOak-1.0.0"
},
"node_modules/parent-module": {
"version": "1.0.1",
@ -11443,7 +11445,6 @@
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -11459,7 +11460,6 @@
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"license": "BlueOak-1.0.0",
"peer": true,
"dependencies": {
"lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
@ -11475,8 +11475,7 @@
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"license": "ISC",
"peer": true
"license": "ISC"
},
"node_modules/path-to-regexp": {
"version": "0.1.12",
@ -11791,6 +11790,7 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.1.1.tgz",
"integrity": "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@ -11812,8 +11812,7 @@
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz",
"integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/react-reconciler": {
"version": "0.32.0",
@ -12255,7 +12254,6 @@
"resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-8.0.1.tgz",
"integrity": "sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"debug": "^4.3.5",
"module-details-from-path": "^1.0.3"
@ -12712,7 +12710,6 @@
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz",
"integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==",
"license": "(MIT AND BSD-3-Clause)",
"peer": true,
"dependencies": {
"inherits": "^2.0.4",
"safe-buffer": "^5.2.1",
@ -12773,7 +12770,6 @@
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"license": "MIT",
"peer": true,
"dependencies": {
"shebang-regex": "^3.0.0"
},
@ -12786,7 +12782,6 @@
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -13161,7 +13156,6 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=14"
}
@ -13250,7 +13244,6 @@
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"license": "MIT",
"peer": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
@ -13265,7 +13258,6 @@
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -13274,15 +13266,13 @@
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -13292,7 +13282,6 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
@ -13395,7 +13384,6 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
@ -13408,7 +13396,6 @@
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -13543,7 +13530,6 @@
"resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz",
"integrity": "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==",
"license": "MIT",
"peer": true,
"dependencies": {
"isarray": "^2.0.5",
"safe-buffer": "^5.2.1",
@ -13731,7 +13717,6 @@
"resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.27.tgz",
"integrity": "sha512-pNV1bn+1n8qEe8tUNsNdD8ejuPcMAg47u2lUGnbsajiNUr3p2Js1XLKQjBMH0yMRMDfdX8T+fIRejFmIwy9x4A==",
"license": "MIT",
"peer": true,
"dependencies": {
"@sqltools/formatter": "^1.2.5",
"ansis": "^3.17.0",
@ -13848,7 +13833,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
@ -13858,8 +13842,7 @@
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD",
"peer": true
"license": "0BSD"
},
"node_modules/unbox-primitive": {
"version": "1.1.0",
@ -13903,6 +13886,7 @@
"integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/unist": "^3.0.0",
"bail": "^2.0.0",
@ -14170,7 +14154,6 @@
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"peer": true,
"bin": {
"uuid": "dist/esm/bin/uuid"
}
@ -14279,7 +14262,6 @@
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"license": "ISC",
"peer": true,
"dependencies": {
"isexe": "^2.0.0"
},
@ -14424,7 +14406,6 @@
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
@ -14442,7 +14423,6 @@
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -14452,7 +14432,6 @@
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"license": "MIT",
"peer": true,
"dependencies": {
"color-convert": "^2.0.1"
},
@ -14467,15 +14446,13 @@
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -14485,7 +14462,6 @@
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"license": "MIT",
"peer": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
@ -14500,7 +14476,6 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
@ -14520,6 +14495,7 @@
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
"devOptional": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10.0.0"
},
@ -14702,6 +14678,7 @@
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.75.tgz",
"integrity": "sha512-OhpzAmVzabPOL6C3A3gpAifqr9MqihV/Msx3gor2b2kviCgcb+HM9SEOpMWwwNp9MRunWnhtAKUoo0AHhjyPPg==",
"license": "MIT",
"peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}

View file

@ -45,7 +45,9 @@ The top-level properties in the `config.yaml` configuration file are:
The `name` property specifies the name of your project or configuration.
```yaml title="config.yaml"
name: MyProject
name: My Config
version: 1.0.0
schema: v1
```
---
@ -149,6 +151,9 @@ The `models` section defines the language models used in your configuration. Mod
**Example:**
```yaml title="config.yaml"
name: My Config
version: 1.0.0
schema: v1
models:
- name: GPT-4o
provider: openai
@ -198,6 +203,9 @@ More information about usage/params for each context provider can be found [here
**Example:**
```yaml title="config.yaml"
name: My Config
version: 1.0.0
schema: v1
context:
- provider: file
- provider: code
@ -218,6 +226,9 @@ Rules are concatenated into the system message for all [Agent](/ide-extensions/a
Confiugration example:
```yaml title="config.yaml"
name: My Config
version: 1.0.0
schema: v1
rules:
- uses: sanity/sanity-opinionated # rules file stored on Continue Mission Control
- uses: file://user/Desktop/rules.md # rules file stored on local computer
@ -244,6 +255,9 @@ Prompts can be invoked with a <kbd>/</kbd> command.
Configuration example:
```yaml title="config.yaml"
name: My Config
version: 1.0.0
schema: v1
prompts:
- uses: supabase/create-functions # prompts file stored on Continue Mission Control
- uses: file://user/Desktop/prompts.md # prompts file stored on local computer
@ -278,6 +292,9 @@ List of documentation sites to index.
**Example:**
```yaml title="config.yaml"
name: My Config
version: 1.0.0
schema: v1
docs:
- name: Continue
startUrl: https://docs.continue.dev/intro
@ -303,6 +320,9 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a
**Example:**
```yaml title="config.yaml"
name: My Config
version: 1.0.0
schema: v1
mcpServers:
- name: My MCP Server
command: uvx
@ -334,6 +354,9 @@ Destinations to which [development data](/customize/deep-dives/development-data)
**Example:**
```yaml title="config.yaml"
name: My Config
version: 1.0.0
schema: v1
data:
- name: Local Data Bank
destination: file:///Users/dallin/Documents/code/continuedev/continue-extras/external-data
@ -355,8 +378,8 @@ data:
Putting it all together, here's a complete example of a `config.yaml` configuration file:
```yaml title="config.yaml"
name: MyProject
version: 0.0.1
name: My Config
version: 1.0.0
schema: v1
models:
- uses: anthropic/claude-3.5-sonnet
@ -430,8 +453,8 @@ You can also use node anchors to avoid duplication of properties. To do so, addi
```yaml title="config.yaml"
%YAML 1.1
---
name: MyProject
version: 0.0.1
name: My Config
version: 1.0.0
schema: v1
model_defaults: &model_defaults
provider: openai

View file

@ -67,6 +67,10 @@ There are a few options that let you configure the behavior of the `@codebase` c
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
context:
- provider: codebase
params:

View file

@ -30,6 +30,10 @@ To enable the `@Docs` context provider, add it to the list of context providers
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
context:
- provider: docs
```
@ -90,6 +94,10 @@ For bulk documentation site adds or edits, we recommend editing your global conf
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
docs:
- title: Nest.js
startUrl: https://docs.nestjs.com/
@ -128,6 +136,10 @@ As with [@Codebase context provider configuration](./deprecated-codebase#configu
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
context:
- provider: docs
params:
@ -161,6 +173,10 @@ The GitHub API rate limits public requests to 60 per hour. If you want to reliab
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
context:
- provider: docs
params:
@ -192,6 +208,10 @@ If your documentation is private, you can skip the default crawler and use a loc
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
docs:
- title: My Private Docs
startUrl: http://10.2.1.2/docs
@ -255,6 +275,10 @@ The following configuration example works out of the box for VS Code. This uses
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
context:
- provider: docs
@ -289,6 +313,10 @@ Here is the equivalent minimal example for Jetbrains, which requires setting up
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: LMStudio embedder
provider: lmstudio
@ -337,6 +365,10 @@ The following configuration example includes:
<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
name: My Config
version: 0.0.1
schema: v1
models:
- name: LMStudio Nomic Text
provider: lmstudio

View file

@ -120,7 +120,7 @@ Specifies options for tab autocompletion behavior.
- `debounceDelay`: Delay (in ms) before triggering autocomplete (default: `350`).
- `maxSuffixPercentage`: Maximum percentage of prompt for suffix (default: `0.2`).
- `prefixPercentage`: Percentage of input for prefix (default: `0.3`).
- `template`: Template string for autocomplete, using Mustache templating. You can use the `{{{ prefix }}}`, `{{{ suffix }}}`, `{{{ filename }}}`, `{{{ reponame }}}`, and `{{{ language }}}` variables.
- `template`: Template string for autocomplete, using Mustache templating. You can use the `{{{prefix}}}`, `{{{suffix}}}`, `{{{filename}}}`, `{{{reponame}}}`, and `{{{language}}}` variables.
- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`).
Example

View file

@ -40,11 +40,20 @@ This document captures the responsibilities for both the CLI and backend compone
- Resolve `storageId` into the desired S3 prefix (e.g., `sessions/<org>/<storageId>/`).
- Generate two short-lived pre-signed `PUT` URLs: one for `session.json`, one for `diff.txt`.
- Return both URLs and their keys in the response payload described above.
- **Expiration**: The initial implementation can hand out URLs with a generous TTL (e.g., 60 minutes). Later we will add CLI-side refresh logic before expiry.
- **Expiration**: URLs are issued with a 60-minute TTL. The CLI automatically refreshes them before expiry (see URL Refresh Strategy below).
## URL Refresh Strategy
Pre-signed URLs are automatically refreshed using a dual-strategy approach:
1. **Proactive Refresh**: URLs are refreshed at the 50-minute mark (10 minutes before expiry) to prevent disruption
2. **Reactive Refresh**: If a 403 Forbidden error is detected (indicating expired URLs), an immediate refresh is triggered
3. **Error Handling**: Upload errors are logged but non-fatal; the service continues running with automatic recovery
This ensures continuous operation during devbox suspension, network interruptions, and clock drift.
## Open Questions & Future Enhancements
- **URL refresh**: When the presigned URLs expire we currently have no refresh cycle. We'd need either a renewal endpoint or to re-call the existing endpoint on failure.
- **Upload cadence**: The 30-second interval is hard-coded for now. Consider making it configurable in both CLI and backend policies.
- **Error telemetry**: Decide if repeated upload failures should trip analytics or circuit breakers.
- **Diff source**: `diff.txt` currently mirrors the `/diff` endpoint response. Confirm backend expectations for format and size limits.

View file

@ -11,6 +11,7 @@
"dependencies": {
"@sentry/profiling-node": "^9.43.0",
"fdir": "^6.4.2",
"find-up": "^8.0.0",
"fzf": "^0.5.2",
"js-yaml": "^4.1.1"
},
@ -267,7 +268,7 @@
},
"../../packages/openai-adapters": {
"name": "@continuedev/openai-adapters",
"version": "1.15.0",
"version": "1.32.0",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
@ -275,8 +276,8 @@
"@aws-sdk/client-bedrock-runtime": "^3.842.0",
"@aws-sdk/credential-providers": "^3.913.0",
"@continuedev/config-types": "^1.0.14",
"@continuedev/config-yaml": "^1.29.0",
"@continuedev/fetch": "^1.5.0",
"@continuedev/config-yaml": "^1.36.0",
"@continuedev/fetch": "^1.6.0",
"dotenv": "^16.5.0",
"google-auth-library": "^10.4.1",
"json-schema": "^0.4.0",
@ -515,6 +516,7 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
},
@ -538,6 +540,7 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
}
@ -1754,6 +1757,7 @@
"integrity": "sha512-oNXsh2ywth5aowwIa7RKtawnkdH6LgU1ztfP9AIUCQCvzysB+WeU8o2kyyosDPwBZutPpjZDKPQGIzzrfTWweQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^6.0.0",
"@octokit/graphql": "^9.0.1",
@ -1924,6 +1928,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz",
"integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",
"license": "Apache-2.0",
"peer": true,
"engines": {
"node": ">=8.0.0"
}
@ -1945,6 +1950,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-2.0.1.tgz",
"integrity": "sha512-XuY23lSI3d4PEqKA+7SLtAgwqIfc6E/E9eAQWLN1vlpC53ybO3o6jW4BsXo1xvz9lYyyWItfQDDLzezER01mCw==",
"license": "Apache-2.0",
"peer": true,
"engines": {
"node": "^18.19.0 || >=20.6.0"
},
@ -1957,6 +1963,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.0.1.tgz",
"integrity": "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@opentelemetry/semantic-conventions": "^1.29.0"
},
@ -2198,6 +2205,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.203.0.tgz",
"integrity": "sha512-ke1qyM+3AK2zPuBPb6Hk/GCsc5ewbLvPNkEuELx/JmANeEp6ZjnZ+wypPAJSucTw0wvCGrUaibDSdcrGFoWxKQ==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@opentelemetry/api-logs": "0.203.0",
"import-in-the-middle": "^1.8.1",
@ -3514,6 +3522,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.0.1.tgz",
"integrity": "sha512-dZOB3R6zvBwDKnHDTB4X1xtMArB/d324VsbiPkX/Yu0Q8T2xceRthoIVFhJdvgVM2QhGVUyX9tzwiNxGtoBJUw==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@opentelemetry/core": "2.0.1",
"@opentelemetry/semantic-conventions": "^1.29.0"
@ -3602,6 +3611,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-2.0.1.tgz",
"integrity": "sha512-xYLlvk/xdScGx1aEqvxLwf6sXQLXCjk3/1SQT9X9AoN5rXRhkdvIFShuNNmtTEPRBqcsMbS4p/gJLNI2wXaDuQ==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@opentelemetry/core": "2.0.1",
"@opentelemetry/resources": "2.0.1",
@ -3637,6 +3647,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.36.0.tgz",
"integrity": "sha512-TtxJSRD8Ohxp6bKkhrm27JRHAxPczQA7idtcTOMYI+wQRRrfgqxHv1cFbCApcSnNjtXkmzFozn6jQtFrOmbjPQ==",
"license": "Apache-2.0",
"peer": true,
"engines": {
"node": ">=14"
}
@ -5047,8 +5058,7 @@
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@types/body-parser": {
"version": "1.19.6",
@ -5336,6 +5346,7 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.0.tgz",
"integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==",
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.10.0"
}
@ -5405,6 +5416,7 @@
"integrity": "sha512-lr3jdBw/BGj49Eps7EvqlUaoeA0xpj3pc0RoJkHpYaCHkVK7i28dKyImLQb3JVlqs3aYSXf7qYuWOW/fgZnTXQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.0.2"
}
@ -5526,6 +5538,7 @@
"integrity": "sha512-w/EboPlBwnmOBtRbiOvzjD+wdiZdgFeo17lkltrtn7X37vagKKWJABvyfsJXTlHe6XBzugmYgd4A4nW+k8Mixw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.40.0",
@ -5556,6 +5569,7 @@
"integrity": "sha512-jCNyAuXx8dr5KJMkecGmZ8KI61KBUhkCob+SD+C+I5+Y1FWI2Y3QmY4/cxMCC5WAsZqoEtEETVhUiUMIGCf6Bw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.40.0",
"@typescript-eslint/types": "8.40.0",
@ -6156,6 +6170,7 @@
"integrity": "sha512-hGISOaP18plkzbWEcP/QvtRW1xDXF2+96HbEX6byqQhAUbiS5oH6/9JwW+QsQCIYON2bI6QZBF+2PvOmrRZ9wA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@vitest/utils": "3.2.4",
"fflate": "^0.8.2",
@ -6236,6 +6251,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -6401,7 +6417,6 @@
"integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"dequal": "^2.0.3"
}
@ -6655,24 +6670,45 @@
"license": "Apache-2.0"
},
"node_modules/body-parser": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz",
"integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.1.tgz",
"integrity": "sha512-nfDwkulwiZYQIGwxdy0RUmowMhKcFVcYXUU7m4QlKYim1rUtg83xm2yjZ40QjDuc291AJjjeSc9b++AWHSgSHw==",
"dev": true,
"license": "MIT",
"dependencies": {
"bytes": "^3.1.2",
"content-type": "^1.0.5",
"debug": "^4.4.0",
"debug": "^4.4.3",
"http-errors": "^2.0.0",
"iconv-lite": "^0.6.3",
"iconv-lite": "^0.7.0",
"on-finished": "^2.4.1",
"qs": "^6.14.0",
"raw-body": "^3.0.0",
"type-is": "^2.0.0"
"raw-body": "^3.0.1",
"type-is": "^2.0.1"
},
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/body-parser/node_modules/iconv-lite": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz",
"integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/bottleneck": {
@ -8020,9 +8056,9 @@
}
},
"node_modules/debug": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
@ -8254,8 +8290,7 @@
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/dot-prop": {
"version": "5.3.0",
@ -8796,6 +8831,7 @@
"integrity": "sha512-TS9bTNIryDzStCpJN93aC5VRSW3uTx9sClUn4B87pwiCaJh220otoI0X8mJKr+VcPtniMdN8GKjlwgWGUv5ZKA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.12.1",
@ -8967,6 +9003,7 @@
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@rtsao/scc": "^1.1.0",
"array-includes": "^3.1.9",
@ -9140,6 +9177,23 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint/node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"license": "MIT",
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint/node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
@ -9150,6 +9204,22 @@
"node": ">= 4"
}
},
"node_modules/eslint/node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
"license": "MIT",
"dependencies": {
"p-locate": "^5.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@ -9163,6 +9233,51 @@
"node": "*"
}
},
"node_modules/eslint/node_modules/p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"yocto-queue": "^0.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint/node_modules/p-locate": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
"license": "MIT",
"dependencies": {
"p-limit": "^3.0.2"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint/node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/espree": {
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
@ -9331,19 +9446,21 @@
}
},
"node_modules/express": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"accepts": "^2.0.0",
"body-parser": "^2.2.0",
"body-parser": "^2.2.1",
"content-disposition": "^1.0.0",
"content-type": "^1.0.5",
"cookie": "^0.7.1",
"cookie-signature": "^1.2.1",
"debug": "^4.4.0",
"depd": "^2.0.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
@ -9590,17 +9707,16 @@
}
},
"node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-8.0.0.tgz",
"integrity": "sha512-JGG8pvDi2C+JxidYdIwQDyS/CgcrIdh18cvgxcBge3wSHRQOrooMD3GlFBcmMJAN9M42SAZjDp5zv1dglJjwww==",
"license": "MIT",
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
"locate-path": "^8.0.0",
"unicorn-magic": "^0.3.0"
},
"engines": {
"node": ">=10"
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@ -10409,30 +10525,24 @@
}
},
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
"depd": "~2.0.0",
"inherits": "~2.0.4",
"setprototypeof": "~1.2.0",
"statuses": "~2.0.2",
"toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/http-errors/node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.8"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/http-proxy-agent": {
@ -11773,16 +11883,15 @@
}
},
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-8.0.0.tgz",
"integrity": "sha512-XT9ewWAC43tiAV7xDAPflMkG0qOPn2QjHqlgX8FOqmWa/rxnyYDulF9T0F7tRy1u+TVTmK/M//6VIOye+2zDXg==",
"license": "MIT",
"dependencies": {
"p-locate": "^5.0.0"
"p-locate": "^6.0.0"
},
"engines": {
"node": ">=10"
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@ -11922,7 +12031,6 @@
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"lz-string": "bin/bin.js"
}
@ -11950,6 +12058,7 @@
"integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"marked": "bin/marked.js"
},
@ -14857,6 +14966,7 @@
"dev": true,
"inBundle": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -15467,32 +15577,30 @@
}
},
"node_modules/p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dev": true,
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz",
"integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==",
"license": "MIT",
"dependencies": {
"yocto-queue": "^0.1.0"
"yocto-queue": "^1.0.0"
},
"engines": {
"node": ">=10"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-locate": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz",
"integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==",
"license": "MIT",
"dependencies": {
"p-limit": "^3.0.2"
"p-limit": "^4.0.0"
},
"engines": {
"node": ">=10"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@ -15773,6 +15881,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"devOptional": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -15994,6 +16103,7 @@
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@ -16097,7 +16207,6 @@
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1",
"ansi-styles": "^5.0.0",
@ -16113,7 +16222,6 @@
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10"
},
@ -16278,19 +16386,36 @@
}
},
"node_modules/raw-body": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz",
"integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
"dev": true,
"license": "MIT",
"dependencies": {
"bytes": "3.1.2",
"http-errors": "2.0.0",
"iconv-lite": "0.6.3",
"unpipe": "1.0.0"
"bytes": "~3.1.2",
"http-errors": "~2.0.1",
"iconv-lite": "~0.7.0",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
"node": ">= 0.10"
}
},
"node_modules/raw-body/node_modules/iconv-lite": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz",
"integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/rc": {
@ -16325,6 +16450,7 @@
"integrity": "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@ -16348,8 +16474,7 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/react-reconciler": {
"version": "0.32.0",
@ -16831,6 +16956,7 @@
"integrity": "sha512-g7RssbTAbir1k/S7uSwSVZFfFXwpomUB9Oas0+xi9KStSCmeDXcA7rNhiskjLqvUe/Evhx8fVCT16OSa34eM5g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@semantic-release/commit-analyzer": "^13.0.0-beta.1",
"@semantic-release/error": "^4.0.0",
@ -18363,6 +18489,7 @@
"integrity": "sha512-yyxBKfORQ7LuRt/BQKBXrpcq59ZvSW0XxwfjAt3w2/8PmdxaFzijtMhTawprSHhpzeM5BgU2hXHG3lklIERZXg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "~0.25.0",
"get-tsconfig": "^4.7.5"
@ -18512,6 +18639,7 @@
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@ -18573,7 +18701,6 @@
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz",
"integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
@ -18632,6 +18759,7 @@
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"peer": true,
"dependencies": {
"napi-postinstall": "^0.3.0"
},
@ -18745,6 +18873,7 @@
"integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.4",
@ -18843,6 +18972,7 @@
"integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/chai": "^5.2.2",
"@vitest/expect": "3.2.4",
@ -19378,6 +19508,7 @@
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10.0.0"
},
@ -19452,6 +19583,7 @@
"integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
"dev": true,
"license": "ISC",
"peer": true,
"bin": {
"yaml": "bin.mjs"
},
@ -19544,13 +19676,12 @@
}
},
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"dev": true,
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz",
"integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==",
"license": "MIT",
"engines": {
"node": ">=10"
"node": ">=12.20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@ -19582,6 +19713,7 @@
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}

View file

@ -46,6 +46,7 @@
"dependencies": {
"@sentry/profiling-node": "^9.43.0",
"fdir": "^6.4.2",
"find-up": "^8.0.0",
"fzf": "^0.5.2",
"js-yaml": "^4.1.1"
},
@ -87,6 +88,7 @@
"@vitest/ui": "^3.2.4",
"@workos-inc/node": "^7.45.0",
"chalk": "^5.4.1",
"clipboardy": "^4.0.0",
"commander": "^14.0.0",
"conventional-changelog-conventionalcommits": "^9.1.0",
"core": "file:../../core",
@ -100,7 +102,6 @@
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-unused-imports": "^4.1.4",
"execa": "^9.6.0",
"clipboardy": "^4.0.0",
"express": "^5.1.0",
"glob": "^11.0.3",
"gpt-tokenizer": "^3.0.1",

View file

@ -44,8 +44,8 @@ Output handling
- Stdout is streamed into memory; Stderr is captured and appended as a trailing "Stderr: ..." section on success.
- If the process exits non-zero and Stderr contains content, the tool call is marked as error and the error text is shown.
- Output is truncated to the first 5000 lines if exceeded.
- Timeout behavior: If no output is received for 30 seconds (configurable in tests), the process is terminated and the result includes a note like:
"[Command timed out after 30 seconds of no output]".
- Timeout behavior: If no output is received for 120 seconds (configurable in tests), the process is terminated and the result includes a note like:
"[Command timed out after 120 seconds of no output]".
Keyboard behaviors (summary)

View file

@ -28,7 +28,7 @@ import { messageQueue } from "../stream/messageQueue.js";
import { constructSystemMessage } from "../systemMessage.js";
import { telemetryService } from "../telemetry/telemetryService.js";
import { reportFailureTool } from "../tools/reportFailure.js";
import { gracefulExit } from "../util/exit.js";
import { gracefulExit, updateAgentMetadata } from "../util/exit.js";
import { formatError } from "../util/formatError.js";
import { getGitDiffSnapshot } from "../util/git.js";
import { logger } from "../util/logger.js";
@ -355,9 +355,18 @@ export async function serve(prompt?: string, options: ServeOptions = {}) {
}
// Give a moment for the response to be sent
const handleExitResponse = () => {
server.close(() => {
const handleExitResponse = async () => {
server.close(async () => {
telemetryService.stopActiveTime();
// Update metadata one final time before exiting
try {
const history = services.chatHistory?.getHistory();
await updateAgentMetadata(history);
} catch (err) {
logger.debug("Failed to update metadata (non-critical)", err as any);
}
gracefulExit(0).catch((err) => {
logger.error(`Graceful exit failed: ${formatError(err)}`);
process.exit(1);
@ -470,6 +479,18 @@ export async function serve(prompt?: string, options: ServeOptions = {}) {
// No direct persistence here; ChatHistoryService handles persistence when appropriate
state.lastActivity = Date.now();
// Update metadata after successful agent turn
try {
const history = services.chatHistory?.getHistory();
await updateAgentMetadata(history);
} catch (metadataErr) {
// Non-critical: log but don't fail the agent execution
logger.debug(
"Failed to update metadata after turn (non-critical)",
metadataErr as any,
);
}
} catch (e: any) {
if (e.name === "AbortError") {
logger.debug("Response interrupted");
@ -526,8 +547,17 @@ export async function serve(prompt?: string, options: ServeOptions = {}) {
);
state.serverRunning = false;
stopStorageSync();
server.close(() => {
server.close(async () => {
telemetryService.stopActiveTime();
// Update metadata one final time before exiting
try {
const history = services.chatHistory?.getHistory();
await updateAgentMetadata(history);
} catch (err) {
logger.debug("Failed to update metadata (non-critical)", err as any);
}
gracefulExit(0).catch((err) => {
logger.error(`Graceful exit failed: ${formatError(err)}`);
process.exit(1);
@ -549,8 +579,17 @@ export async function serve(prompt?: string, options: ServeOptions = {}) {
clearInterval(inactivityChecker);
inactivityChecker = null;
}
server.close(() => {
server.close(async () => {
telemetryService.stopActiveTime();
// Update metadata one final time before exiting
try {
const history = services.chatHistory?.getHistory();
await updateAgentMetadata(history);
} catch (err) {
logger.debug("Failed to update metadata (non-critical)", err as any);
}
gracefulExit(0).catch((err) => {
logger.error(`Graceful exit failed: ${formatError(err)}`);
process.exit(1);

View file

@ -54,7 +54,7 @@ describe("compaction infinite loop prevention", () => {
]);
// This should not hang - it should break out of the loop
const result = await compactChatHistory(history, mockModel, mockLlmApi, {});
const result = await compactChatHistory(history, mockModel, mockLlmApi);
// Should complete successfully even though token count is still too high
expect(result.compactedHistory).toBeDefined();
@ -88,7 +88,7 @@ describe("compaction infinite loop prevention", () => {
]);
// This should not hang
const result = await compactChatHistory(history, mockModel, mockLlmApi, {});
const result = await compactChatHistory(history, mockModel, mockLlmApi);
expect(result.compactedHistory).toBeDefined();
});
@ -129,7 +129,7 @@ describe("compaction infinite loop prevention", () => {
{ role: "user", content: "Another question" },
]);
const result = await compactChatHistory(history, mockModel, mockLlmApi, {});
const result = await compactChatHistory(history, mockModel, mockLlmApi);
expect(result.compactedHistory).toBeDefined();
// The function will call countTokens multiple times during the process

View file

@ -385,8 +385,10 @@ describe("compaction", () => {
]);
await compactChatHistory(history, mockModel, mockLlmApi, {
onStreamContent,
onStreamComplete,
callbacks: {
onStreamContent,
onStreamComplete,
},
});
expect(onStreamContent).toHaveBeenCalledWith("Summary ");
@ -406,7 +408,9 @@ describe("compaction", () => {
]);
await expect(
compactChatHistory(history, mockModel, mockLlmApi, { onError }),
compactChatHistory(history, mockModel, mockLlmApi, {
callbacks: { onError },
}),
).rejects.toThrow("Stream failed");
expect(onError).toHaveBeenCalledWith(mockError);

View file

@ -22,22 +22,27 @@ export interface CompactionCallbacks {
onError?: (error: Error) => void;
}
export interface CompactionOptions {
callbacks?: CompactionCallbacks;
abortController?: AbortController;
systemMessageTokens?: number;
}
/**
* Compacts a chat history into a summarized form
* @param chatHistory The current chat history to compact
* @param model The model configuration
* @param llmApi The LLM API instance
* @param callbacks Optional callbacks for streaming updates
* @param abortController Optional abort controller for cancellation
* @param options Optional configuration including callbacks, abort controller, and system message tokens
* @returns The compacted history with compaction index
*/
export async function compactChatHistory(
chatHistory: ChatHistoryItem[],
model: ModelConfig,
llmApi: BaseLlmApi,
callbacks?: CompactionCallbacks,
abortController?: AbortController,
options?: CompactionOptions,
): Promise<CompactionResult> {
const { callbacks, abortController, systemMessageTokens = 0 } = options || {};
// Create a prompt to summarize the conversation
const compactionPrompt: ChatHistoryItem = {
message: {
@ -56,7 +61,19 @@ export async function compactChatHistory(
const maxTokens = model.defaultCompletionOptions?.maxTokens;
const reservedForOutput =
maxTokens === undefined ? Math.ceil(contextLimit * 0.35) : maxTokens;
const availableForInput = contextLimit - reservedForOutput;
// Check if system message is already in the history to avoid double-counting
const hasSystemMessageInHistory = chatHistory.some(
(item) => item.message.role === "system",
);
// Account for system message (if not already in history) AND safety buffer
const SAFETY_BUFFER = 100;
const systemMessageReservation = hasSystemMessageInHistory
? 0
: systemMessageTokens;
const availableForInput =
contextLimit - reservedForOutput - systemMessageReservation - SAFETY_BUFFER;
// Check if we need to prune to fit within context
while (

View file

@ -503,11 +503,33 @@ Org-level secrets can only be used for MCP by Background Agents (https://docs.co
} catch (error: unknown) {
// If token refresh didn't work and it's a 401, fall back to mcp-remote
if (isAuthError(error) && !this.isHeadless) {
// Build mcp-remote args with Supabase-specific OAuth scopes if needed
const mcpRemoteArgs = ["-y", "mcp-remote", serverConfig.url];
// Detect Supabase MCP and add custom OAuth scopes
if (serverConfig.url.includes("mcp.supabase.com")) {
const supabaseScopes = [
"organizations:read",
"projects:read",
"database:read",
"analytics:read",
"secrets:read",
"edge_functions:read",
"environment:read",
"storage:read",
].join(" ");
mcpRemoteArgs.push(
"--static-oauth-client-metadata",
JSON.stringify({ scope: supabaseScopes }),
);
}
const transport = this.constructStdioTransport(
{
name: serverConfig.name,
command: "npx",
args: ["-y", "mcp-remote", serverConfig.url],
args: mcpRemoteArgs,
},
connection,
);

View file

@ -276,4 +276,87 @@ describe("StorageSyncService", () => {
service.stop();
});
it("refreshes URLs on 403 error", async () => {
const syncSessionHistory = vi.fn();
const getCompleteStateSnapshot = vi.fn().mockReturnValue({ test: "data" });
// Mock initial presign success
fetchMock.mockResolvedValueOnce({
ok: true,
json: async () => ({
session: { putUrl: "https://upload/session-old", key: "session.json" },
diff: { putUrl: "https://upload/diff-old", key: "diff.txt" },
}),
});
// Mock 403 upload failure
fetchMock.mockResolvedValueOnce({
ok: false,
status: 403,
statusText: "Forbidden",
text: async () => "Request has expired",
});
// Mock refresh presign success
fetchMock.mockResolvedValueOnce({
ok: true,
json: async () => ({
session: { putUrl: "https://upload/session-new", key: "session.json" },
diff: { putUrl: "https://upload/diff-new", key: "diff.txt" },
}),
});
gitDiffMock.mockResolvedValue({ diff: "test", repoFound: true });
const result = await service.startFromOptions({
storageOption: "session-123",
accessToken: "token",
syncSessionHistory,
getCompleteStateSnapshot,
isActive: () => true,
});
expect(result).toBe(true);
// Wait for async refresh
await new Promise((resolve) => setTimeout(resolve, 100));
expect(fetchMock).toHaveBeenCalledTimes(3); // presign + failed upload + refresh
expect(service.getState().isEnabled).toBe(true);
service.stop();
});
it("prevents concurrent refresh requests", async () => {
const syncSessionHistory = vi.fn();
const getCompleteStateSnapshot = vi.fn().mockReturnValue({});
fetchMock.mockResolvedValue({
ok: true,
json: async () => ({
session: { putUrl: "https://upload/session", key: "session.json" },
diff: { putUrl: "https://upload/diff", key: "diff.txt" },
}),
});
await service.start({
storageId: "session-123",
accessToken: "token",
syncSessionHistory,
getCompleteStateSnapshot,
});
const refreshMethod = (service as any).refreshStorageTargets.bind(service);
const results = await Promise.all([
refreshMethod(),
refreshMethod(),
refreshMethod(),
]);
const successCount = results.filter((r) => r === true).length;
expect(successCount).toBe(1); // Only first succeeds
service.stop();
});
});

View file

@ -45,6 +45,9 @@ export class StorageSyncService {
private missingRepoLogged = false;
private targets: StorageTargets | null = null;
private options: StorageSyncStartOptions | null = null;
private targetsExpiresAt: number | null = null;
private refreshTimer: NodeJS.Timeout | null = null;
private isRefreshing = false;
async initialize(): Promise<StorageSyncServiceState> {
this.stop();
@ -112,6 +115,7 @@ export class StorageSyncService {
}
this.targets = targets;
this.targetsExpiresAt = Date.now() + 60 * 60 * 1000; // Track 60-minute expiration
this.options = options;
this.stopped = false;
this.uploadInFlight = false;
@ -130,10 +134,17 @@ export class StorageSyncService {
),
);
// Schedule proactive URL refresh at 50-minute mark
this.scheduleProactiveRefresh();
await this.performUpload();
this.intervalHandle = setInterval(() => {
void this.performUpload();
this.performUpload().catch((error) => {
logger.warn(
`Storage sync upload failed in interval: ${formatError(error)}`,
);
});
}, intervalMs);
return true;
@ -178,6 +189,7 @@ export class StorageSyncService {
stop(): void {
this.stopped = true;
this.targets = null;
this.targetsExpiresAt = null;
this.options = null;
this.uploadInFlight = false;
@ -186,6 +198,12 @@ export class StorageSyncService {
this.intervalHandle = null;
}
// Clear refresh timer
if (this.refreshTimer) {
clearTimeout(this.refreshTimer);
this.refreshTimer = null;
}
if (this.state.isEnabled) {
this.setState({
isEnabled: false,
@ -245,6 +263,59 @@ export class StorageSyncService {
}
}
private async refreshStorageTargets(): Promise<boolean> {
if (this.isRefreshing || !this.options) {
return false;
}
this.isRefreshing = true;
logger.info("Refreshing storage pre-signed URLs...");
try {
const newTargets = await this.requestStorageTargets(
this.options.storageId,
this.options.accessToken,
);
if (!newTargets) {
logger.warn(
"Failed to refresh storage URLs - continuing with existing URLs",
);
return false;
}
this.targets = newTargets;
this.targetsExpiresAt = Date.now() + 60 * 60 * 1000; // 60 minutes from now
logger.info("Storage URLs refreshed successfully");
// Schedule next proactive refresh at 50-minute mark
this.scheduleProactiveRefresh();
return true;
} catch (error) {
logger.warn(`Storage URL refresh error: ${formatError(error)}`);
return false;
} finally {
this.isRefreshing = false;
}
}
private scheduleProactiveRefresh(): void {
// Clear any existing refresh timer
if (this.refreshTimer) {
clearTimeout(this.refreshTimer);
this.refreshTimer = null;
}
// Schedule refresh at 50-minute mark (10 minutes before expiry)
const refreshIn = 50 * 60 * 1000; // 50 minutes
this.refreshTimer = setTimeout(() => {
this.refreshStorageTargets().catch((error) => {
logger.warn(`Proactive URL refresh failed: ${formatError(error)}`);
});
}, refreshIn);
}
private async uploadToPresignedUrl(
url: string,
body: string,
@ -271,6 +342,16 @@ export class StorageSyncService {
if (!response.ok) {
const statusText = `${response.status} ${response.statusText}`.trim();
const responseBody = await response.text();
// Detect expired URL (403 Forbidden) and trigger refresh
if (response.status === 403) {
logger.warn("Storage URL expired (403), triggering refresh...");
// Trigger async refresh without blocking the current upload error
this.refreshStorageTargets().catch((error) => {
logger.debug(`Background URL refresh failed: ${formatError(error)}`);
});
}
throw new Error(`Storage upload failed (${statusText}): ${responseBody}`);
}
}

View file

@ -23,6 +23,7 @@ vi.mock("../session.js", () => ({
vi.mock("../util/tokenizer.js", () => ({
shouldAutoCompact: vi.fn(),
getAutoCompactMessage: vi.fn(),
countChatHistoryItemTokens: vi.fn(() => 100), // Mock return value
}));
vi.mock("../util/formatError.js", () => ({
@ -38,6 +39,17 @@ vi.mock("../util/logger.js", () => ({
},
}));
vi.mock("../services/index.js", () => ({
services: {
systemMessage: {
getSystemMessage: vi.fn(() => Promise.resolve("System message")),
},
toolPermissions: {
getState: vi.fn(() => ({ currentMode: "enabled" })),
},
},
}));
vi.mock("os", async (importOriginal) => {
const actual = (await importOriginal()) as object;
return {
@ -137,7 +149,10 @@ describe("handleAutoCompaction", () => {
mockChatHistory,
mockModel,
mockLlmApi,
expect.any(Object),
expect.objectContaining({
callbacks: expect.any(Object),
systemMessageTokens: expect.any(Number),
}),
);
expect(updateSessionHistory).toHaveBeenCalledWith(
mockCompactionResult.compactedHistory,

View file

@ -26,6 +26,7 @@ interface AutoCompactionOptions {
isHeadless?: boolean;
format?: "json";
callbacks?: AutoCompactionCallbacks;
systemMessage?: string;
}
/**
@ -128,7 +129,11 @@ export async function handleAutoCompaction(
compactionIndex: number | null;
wasCompacted: boolean;
}> {
const { isHeadless = false, callbacks } = options;
const {
isHeadless = false,
callbacks,
systemMessage: providedSystemMessage,
} = options;
if (!model || !shouldAutoCompact(chatHistory, model)) {
return { chatHistory, compactionIndex: null, wasCompacted: false };
@ -142,18 +147,38 @@ export async function handleAutoCompaction(
notifyCompactionStart(getAutoCompactMessage(model), isHeadless, callbacks);
try {
// Get system message to calculate its token count for compaction pruning
// Use provided message if available, otherwise fetch it (for backward compatibility)
const systemMessage =
providedSystemMessage ??
(async () => {
const { services } = await import("../services/index.js");
return services.systemMessage.getSystemMessage(
services.toolPermissions.getState().currentMode,
);
})();
const resolvedSystemMessage =
typeof systemMessage === "string" ? systemMessage : await systemMessage;
const { countChatHistoryItemTokens } = await import("../util/tokenizer.js");
const systemMessageTokens = countChatHistoryItemTokens({
message: {
role: "system",
content: resolvedSystemMessage,
},
contextItems: [],
});
// Compact the history
const result = await compactChatHistory(
chatHistory,
model,
llmApi,
isHeadless
const result = await compactChatHistory(chatHistory, model, llmApi, {
callbacks: isHeadless
? undefined
: {
onStreamContent: callbacks?.onContent,
onStreamComplete: () => {},
},
);
systemMessageTokens,
});
// Save the compacted session
updateSessionHistory(result.compactedHistory);

View file

@ -0,0 +1,324 @@
import { ModelConfig } from "@continuedev/config-yaml";
import { BaseLlmApi } from "@continuedev/openai-adapters";
import type { ChatHistoryItem } from "core/index.js";
import { convertToUnifiedHistory } from "core/util/messageConversion.js";
import type { ChatCompletionChunk } from "openai/resources/chat/completions.mjs";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { streamChatResponse } from "./streamChatResponse.js";
// Mock all dependencies
vi.mock("../compaction.js", () => ({
compactChatHistory: vi.fn(),
pruneLastMessage: vi.fn((history) => history.slice(0, -1)),
}));
vi.mock("../session.js", () => ({
updateSessionHistory: vi.fn(),
}));
vi.mock("../util/tokenizer.js", () => ({
shouldAutoCompact: vi.fn(),
getAutoCompactMessage: vi.fn(() => "Auto-compacting..."),
countChatHistoryItemTokens: vi.fn(() => 100),
validateContextLength: vi.fn(() => ({ isValid: true })),
}));
vi.mock("../telemetry/telemetryService.js", () => ({
telemetryService: {
logApiRequest: vi.fn(),
recordResponseTime: vi.fn(),
recordTokenUsage: vi.fn(),
recordCost: vi.fn(),
},
}));
vi.mock("../telemetry/posthogService.js", () => ({
posthogService: {
capture: vi.fn(),
},
}));
vi.mock("../util/logger.js", () => ({
logger: {
info: vi.fn(),
debug: vi.fn(),
error: vi.fn(),
warn: vi.fn(),
},
}));
vi.mock("../services/index.js", () => ({
services: {
systemMessage: {
getSystemMessage: vi.fn(() => Promise.resolve("System message")),
},
toolPermissions: {
getState: vi.fn(() => ({ currentMode: "enabled" })),
isHeadless: vi.fn(() => false),
},
chatHistory: {
isReady: vi.fn(() => true),
getHistory: vi.fn(() => []),
setHistory: vi.fn(),
addUserMessage: vi.fn(),
},
},
}));
vi.mock("./handleToolCalls.js", () => ({
handleToolCalls: vi.fn(() => Promise.resolve(false)),
getRequestTools: vi.fn(() => Promise.resolve([])),
}));
vi.mock("./streamChatResponse.compactionHelpers.js", () => ({
handlePreApiCompaction: vi.fn((chatHistory) =>
Promise.resolve({ chatHistory, wasCompacted: false }),
),
handlePostToolValidation: vi.fn((_, chatHistory) =>
Promise.resolve({ chatHistory, wasCompacted: false }),
),
handleNormalAutoCompaction: vi.fn((chatHistory) =>
Promise.resolve({ chatHistory, wasCompacted: false }),
),
}));
describe("streamChatResponse - auto-continuation after compaction", () => {
const mockModel: ModelConfig = {
provider: "openai",
name: "gpt-4",
model: "gpt-4",
defaultCompletionOptions: {
contextLength: 8192,
maxTokens: 2048,
},
} as any;
let mockLlmApi: BaseLlmApi;
let mockAbortController: AbortController;
let chatHistory: ChatHistoryItem[];
let chunks: ChatCompletionChunk[];
let responseCount: number;
function contentChunk(content: string): ChatCompletionChunk {
return {
id: "test",
object: "chat.completion.chunk",
created: Date.now(),
model: "test-model",
choices: [
{
index: 0,
delta: { content },
finish_reason: null,
},
],
};
}
beforeEach(() => {
vi.clearAllMocks();
responseCount = 0;
chunks = [contentChunk("Initial response")];
chatHistory = convertToUnifiedHistory([{ role: "user", content: "Hello" }]);
mockLlmApi = {
chatCompletionStream: vi.fn().mockImplementation(async function* () {
responseCount++;
for (const chunk of chunks) {
yield chunk;
}
}),
} as unknown as BaseLlmApi;
mockAbortController = {
signal: { aborted: false },
abort: vi.fn(),
} as unknown as AbortController;
});
it("should automatically continue after compaction when no tool calls remain", async () => {
const { services } = await import("../services/index.js");
const { handleNormalAutoCompaction } = await import(
"./streamChatResponse.compactionHelpers.js"
);
const { logger } = await import("../util/logger.js");
// Track history modifications
const historyUpdates: string[] = [];
vi.mocked(services.chatHistory.addUserMessage).mockImplementation((msg) => {
historyUpdates.push(msg);
return {
message: { role: "user", content: msg },
contextItems: [],
};
});
// First call: compaction happens
// Second call (after continuation): no compaction
let compactionCallCount = 0;
vi.mocked(handleNormalAutoCompaction).mockImplementation(() => {
compactionCallCount++;
return Promise.resolve({
chatHistory,
wasCompacted: compactionCallCount === 1, // Only first call has compaction
});
});
// Simulate: first response completes (no tool calls), triggering auto-continue
let callCount = 0;
mockLlmApi.chatCompletionStream = vi
.fn()
.mockImplementation(async function* () {
callCount++;
if (callCount === 1) {
// First call: just content, no tool calls (shouldContinue = false)
yield contentChunk("First response");
} else if (callCount === 2) {
// Second call: after auto-continuation
yield contentChunk("Continued after compaction");
}
}) as any;
await streamChatResponse(
chatHistory,
mockModel,
mockLlmApi,
mockAbortController,
);
// Verify "continue" message was added
expect(historyUpdates).toContain("continue");
// Verify logging occurred
expect(logger.debug).toHaveBeenCalledWith(
"Auto-compaction occurred during this turn - automatically continuing session",
);
expect(logger.debug).toHaveBeenCalledWith(
"Added continuation message after compaction",
);
// Verify the LLM was called multiple times (continuing the conversation)
expect(callCount).toBeGreaterThan(1);
});
it("should not auto-continue if compaction occurs with tool calls pending", async () => {
const { services } = await import("../services/index.js");
const { handleNormalAutoCompaction } = await import(
"./streamChatResponse.compactionHelpers.js"
);
const { handleToolCalls } = await import("./handleToolCalls.js");
const historyUpdates: string[] = [];
vi.mocked(services.chatHistory.addUserMessage).mockImplementation((msg) => {
historyUpdates.push(msg);
return {
message: { role: "user", content: msg },
contextItems: [],
};
});
// Compaction happens
vi.mocked(handleNormalAutoCompaction).mockResolvedValue({
chatHistory,
wasCompacted: true,
});
// But tool calls are still being processed (shouldContinue = true)
// This is simulated by having handleToolCalls return true (shouldReturn)
vi.mocked(handleToolCalls).mockResolvedValue(true);
// Mock tool calls in response
mockLlmApi.chatCompletionStream = vi
.fn()
.mockImplementation(async function* () {
yield {
id: "test",
object: "chat.completion.chunk",
created: Date.now(),
model: "test-model",
choices: [
{
index: 0,
delta: {
tool_calls: [
{
index: 0,
id: "call_123",
type: "function",
function: {
name: "ReadFile",
arguments: '{"filepath": "/test"}',
},
},
],
},
finish_reason: null,
},
],
};
}) as any;
await streamChatResponse(
chatHistory,
mockModel,
mockLlmApi,
mockAbortController,
);
// Should NOT auto-continue because tool calls are pending
expect(historyUpdates).not.toContain("continue");
});
it("should not create infinite loops - flag is reset after continuation", async () => {
const { services } = await import("../services/index.js");
const { handleNormalAutoCompaction } = await import(
"./streamChatResponse.compactionHelpers.js"
);
const historyUpdates: string[] = [];
vi.mocked(services.chatHistory.addUserMessage).mockImplementation((msg) => {
historyUpdates.push(msg);
return {
message: { role: "user", content: msg },
contextItems: [],
};
});
// Track calls - compaction happens on 1st turn, then again on 2nd turn
let normalCompactionCallCount = 0;
vi.mocked(handleNormalAutoCompaction).mockImplementation(() => {
normalCompactionCallCount++;
// Compaction happens on first two calls
return Promise.resolve({
chatHistory,
wasCompacted: normalCompactionCallCount <= 1,
});
});
let streamCallCount = 0;
mockLlmApi.chatCompletionStream = vi
.fn()
.mockImplementation(async function* () {
streamCallCount++;
yield contentChunk(`Response ${streamCallCount}`);
}) as any;
await streamChatResponse(
chatHistory,
mockModel,
mockLlmApi,
mockAbortController,
);
// Should only add "continue" once
// The flag is reset after the first continuation
const continueCount = historyUpdates.filter(
(msg) => msg === "continue",
).length;
expect(continueCount).toBeLessThanOrEqual(1);
// Should have called the LLM at least once
expect(streamCallCount).toBeGreaterThanOrEqual(1);
});
});

View file

@ -0,0 +1,212 @@
import { ModelConfig } from "@continuedev/config-yaml";
import { BaseLlmApi } from "@continuedev/openai-adapters";
import type { ChatHistoryItem } from "core/index.js";
import { services } from "../services/index.js";
import { ToolCall } from "../tools/index.js";
import { logger } from "../util/logger.js";
import { validateContextLength } from "../util/tokenizer.js";
import { handleAutoCompaction } from "./streamChatResponse.autoCompaction.js";
import { StreamCallbacks } from "./streamChatResponse.types.js";
export interface CompactionHelperOptions {
model: ModelConfig;
llmApi: BaseLlmApi;
isCompacting: boolean;
isHeadless: boolean;
callbacks?: StreamCallbacks;
systemMessage: string;
}
/**
* Handle pre-API auto-compaction if needed
*/
export async function handlePreApiCompaction(
chatHistory: ChatHistoryItem[],
options: CompactionHelperOptions,
): Promise<{ chatHistory: ChatHistoryItem[]; wasCompacted: boolean }> {
const { model, llmApi, isCompacting, isHeadless, callbacks, systemMessage } =
options;
if (isCompacting) {
return { chatHistory, wasCompacted: false };
}
const { wasCompacted, chatHistory: preCompactHistory } =
await handleAutoCompaction(chatHistory, model, llmApi, {
isHeadless,
callbacks: {
onSystemMessage: callbacks?.onSystemMessage,
onContent: callbacks?.onContent,
},
systemMessage,
});
if (wasCompacted) {
logger.debug("Pre-API compaction occurred, updating chat history");
const chatHistorySvc = services.chatHistory;
if (
typeof chatHistorySvc?.isReady === "function" &&
chatHistorySvc.isReady()
) {
chatHistorySvc.setHistory(preCompactHistory);
return { chatHistory: chatHistorySvc.getHistory(), wasCompacted: true };
}
return { chatHistory: [...preCompactHistory], wasCompacted: true };
}
return { chatHistory, wasCompacted: false };
}
/**
* Validate and handle context overflow after tool execution
*/
export async function handlePostToolValidation(
toolCalls: ToolCall[],
chatHistory: ChatHistoryItem[],
options: CompactionHelperOptions,
): Promise<{ chatHistory: ChatHistoryItem[]; wasCompacted: boolean }> {
const { model, llmApi, isHeadless, callbacks, systemMessage } = options;
if (toolCalls.length === 0) {
return { chatHistory, wasCompacted: false };
}
// Get updated history after tool execution
const chatHistorySvc = services.chatHistory;
if (
typeof chatHistorySvc?.isReady === "function" &&
chatHistorySvc.isReady()
) {
chatHistory = chatHistorySvc.getHistory();
}
// Validate with system message to catch tool result overflow
const postToolSystemItem: ChatHistoryItem = {
message: {
role: "system",
content: systemMessage,
},
contextItems: [],
};
const SAFETY_BUFFER = 100;
const postToolValidation = validateContextLength(
[postToolSystemItem, ...chatHistory],
model,
SAFETY_BUFFER,
);
// If tool results pushed us over limit, force compaction regardless of threshold
if (!postToolValidation.isValid) {
logger.warn("Tool execution caused context overflow, forcing compaction", {
inputTokens: postToolValidation.inputTokens,
contextLimit: postToolValidation.contextLimit,
});
// Force compaction (compaction now accounts for system message during pruning)
const { wasCompacted, chatHistory: compactedHistory } =
await handleAutoCompaction(chatHistory, model, llmApi, {
isHeadless,
callbacks: {
onSystemMessage: callbacks?.onSystemMessage,
onContent: callbacks?.onContent,
},
systemMessage,
});
if (wasCompacted) {
// Use the service to update history if available, otherwise use local copy
if (chatHistorySvc && typeof chatHistorySvc.setHistory === "function") {
chatHistorySvc.setHistory(compactedHistory);
chatHistory = chatHistorySvc.getHistory();
} else {
// Fallback: use the compacted history directly when service unavailable
chatHistory = compactedHistory;
}
// Verify compaction brought us under the limit
const postCompactionValidation = validateContextLength(
[postToolSystemItem, ...chatHistory],
model,
SAFETY_BUFFER,
);
if (!postCompactionValidation.isValid) {
logger.error(
"Compaction failed to bring context under limit, stopping execution",
{
inputTokens: postCompactionValidation.inputTokens,
contextLimit: postCompactionValidation.contextLimit,
},
);
throw new Error(
`Context limit exceeded even after compaction: ${postCompactionValidation.error}`,
);
}
logger.info("Successfully compacted after tool overflow", {
inputTokens: postCompactionValidation.inputTokens,
contextLimit: postCompactionValidation.contextLimit,
});
return { chatHistory, wasCompacted: true };
} else {
// Compaction failed, cannot continue
logger.error("Failed to compact history after tool execution overflow");
throw new Error(
"Context limit exceeded and compaction failed. Unable to continue.",
);
}
}
return { chatHistory, wasCompacted: false };
}
/**
* Handle normal auto-compaction check at 80% threshold
*/
export async function handleNormalAutoCompaction(
chatHistory: ChatHistoryItem[],
shouldContinue: boolean,
options: CompactionHelperOptions,
): Promise<{ chatHistory: ChatHistoryItem[]; wasCompacted: boolean }> {
const { model, llmApi, isHeadless, callbacks, systemMessage } = options;
if (!shouldContinue) {
return { chatHistory, wasCompacted: false };
}
const chatHistorySvc = services.chatHistory;
if (
typeof chatHistorySvc?.isReady === "function" &&
chatHistorySvc.isReady()
) {
chatHistory = chatHistorySvc.getHistory();
}
const { wasCompacted, chatHistory: updatedChatHistory } =
await handleAutoCompaction(chatHistory, model, llmApi, {
isHeadless,
callbacks: {
onSystemMessage: callbacks?.onSystemMessage,
onContent: callbacks?.onContent,
},
systemMessage,
});
if (wasCompacted) {
// Use the service to update history if available, otherwise use local copy
if (chatHistorySvc && typeof chatHistorySvc.setHistory === "function") {
chatHistorySvc.setHistory(updatedChatHistory);
return {
chatHistory: chatHistorySvc.getHistory(),
wasCompacted: true,
};
}
// Fallback: return the compacted history directly when service unavailable
return { chatHistory: updatedChatHistory, wasCompacted: true };
}
return { chatHistory, wasCompacted: false };
}

View file

@ -0,0 +1,200 @@
import { ModelConfig } from "@continuedev/config-yaml";
import { BaseLlmApi } from "@continuedev/openai-adapters";
import type { ChatHistoryItem } from "core/index.js";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { services } from "../services/index.js";
import { processStreamingResponse } from "./streamChatResponse.js";
// Mock services
vi.mock("../services/index.js", () => ({
services: {
systemMessage: {
getSystemMessage: vi.fn(),
},
toolPermissions: {
getState: vi.fn(() => ({ currentMode: "enabled" })),
isHeadless: vi.fn(() => false),
},
chatHistory: {
isReady: vi.fn(() => false),
},
},
}));
// Mock logger
vi.mock("../util/logger.js", () => ({
logger: {
debug: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
},
}));
// Mock tokenizer
vi.mock("../util/tokenizer.js", async () => {
const actual = await vi.importActual("../util/tokenizer.js");
return {
...actual,
countChatHistoryTokens: vi.fn((history: ChatHistoryItem[]) => {
// Simple mock: count based on content length
return history.reduce((sum, item) => {
const content =
typeof item.message.content === "string"
? item.message.content
: JSON.stringify(item.message.content);
return sum + Math.ceil(content.length / 4); // ~4 chars per token
}, 0);
}),
};
});
describe("streamChatResponse system message validation", () => {
let mockLlmApi: BaseLlmApi;
let abortController: AbortController;
beforeEach(() => {
vi.clearAllMocks();
mockLlmApi = {} as BaseLlmApi;
abortController = new AbortController();
});
it("should validate system message is retrieved before validation", async () => {
const model = {
model: "test-model",
defaultCompletionOptions: {
contextLength: 1000,
maxTokens: 100,
},
} as ModelConfig;
// Mock system message
const systemMessage = "System instructions";
vi.mocked(services.systemMessage.getSystemMessage).mockResolvedValue(
systemMessage,
);
// Small chat history
const chatHistory: ChatHistoryItem[] = [
{
message: { role: "user", content: "test" },
contextItems: [],
},
];
// Mock the streaming response to avoid actual API call
const mockStream = {
[Symbol.asyncIterator]: async function* () {
yield {
choices: [{ delta: { content: "test" } }],
};
},
};
mockLlmApi.chatCompletionStream = vi.fn().mockResolvedValue(mockStream);
// Execute the function with systemMessage parameter
await processStreamingResponse({
chatHistory,
model,
llmApi: mockLlmApi,
abortController,
systemMessage,
});
// Verify the function uses the provided system message (no fetch needed)
// The system message is now provided by the caller
expect(services.systemMessage.getSystemMessage).not.toHaveBeenCalled();
});
it("should pass validation when system message + history fits", async () => {
const model = {
model: "test-model",
defaultCompletionOptions: {
contextLength: 1000,
maxTokens: 100,
},
} as ModelConfig;
// Small system message (50 tokens worth)
const smallSystemMessage = "x".repeat(200); // ~50 tokens
// Small chat history (200 tokens worth)
const chatHistory: ChatHistoryItem[] = [
{
message: { role: "user", content: "x".repeat(800) }, // ~200 tokens
contextItems: [],
},
];
// Available: 1000 - 100 (maxTokens) - 100 (buffer) = 800 tokens
// System: ~50 tokens
// History: ~200 tokens
// Total: ~250 tokens < 800 available
// Should pass validation
// Mock the streaming response to avoid actual API call
const mockStream = {
[Symbol.asyncIterator]: async function* () {
yield {
choices: [{ delta: { content: "test" } }],
};
},
};
mockLlmApi.chatCompletionStream = vi.fn().mockResolvedValue(mockStream);
// This should not throw
const result = await processStreamingResponse({
chatHistory,
model,
llmApi: mockLlmApi,
abortController,
systemMessage: smallSystemMessage,
});
expect(result).toBeDefined();
// System message is now provided by caller, not fetched
expect(services.systemMessage.getSystemMessage).not.toHaveBeenCalled();
});
it("should use safety buffer in validation", async () => {
const model = {
model: "test-model",
defaultCompletionOptions: {
contextLength: 1000,
maxTokens: 100,
},
} as ModelConfig;
// System message + history that's exactly at limit without buffer
// but fails with buffer
const systemMessage = "x".repeat(800); // ~200 tokens
const chatHistory: ChatHistoryItem[] = [
{
message: { role: "user", content: "x".repeat(2400) }, // ~600 tokens
contextItems: [],
},
];
// Available without buffer: 1000 - 100 = 900 tokens
// Available with buffer: 1000 - 100 - 100 = 800 tokens
// System: ~200 tokens
// History: ~600 tokens
// Total: ~800 tokens
// Should exactly hit the limit with buffer and pass/prune
await expect(
processStreamingResponse({
chatHistory,
model,
llmApi: mockLlmApi,
abortController,
systemMessage,
}),
).rejects.toThrow(); // Will fail because we can't prune enough
});
});

View file

@ -152,6 +152,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
expect(result.content).toBe("I'll read the README file for you.");
@ -172,6 +173,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
expect(result.content).toBe("Let me search for that. ");
@ -220,6 +222,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
expect(result.content).toBe("I'll read the README file for you.");
@ -243,6 +246,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
expect(result.content).toBe("Hello world!");
@ -367,6 +371,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
expect(responsesStream).toHaveBeenCalledTimes(1);
@ -405,6 +410,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
// Content is captured correctly
@ -455,6 +461,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
// Fixed: Both issues are resolved
@ -503,6 +510,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
} catch (error) {
caughtError = error;
@ -516,6 +524,7 @@ describe("processStreamingResponse - content preservation", () => {
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
systemMessage: "You are a helpful assistant.",
});
expect(result.content).toBe("Hello world!");

View file

@ -22,7 +22,11 @@ import { logger } from "../util/logger.js";
import { validateContextLength } from "../util/tokenizer.js";
import { getRequestTools, handleToolCalls } from "./handleToolCalls.js";
import { handleAutoCompaction } from "./streamChatResponse.autoCompaction.js";
import {
handleNormalAutoCompaction,
handlePostToolValidation,
handlePreApiCompaction,
} from "./streamChatResponse.compactionHelpers.js";
import {
processChunkContent,
processToolCallDelta,
@ -66,6 +70,63 @@ function handleContentDisplay(
}
}
// Helper function to refresh chat history from service
function refreshChatHistoryFromService(
chatHistory: ChatHistoryItem[],
isCompacting: boolean,
): ChatHistoryItem[] {
const chatHistorySvc = services.chatHistory;
if (
typeof chatHistorySvc?.isReady === "function" &&
chatHistorySvc.isReady()
) {
try {
// use chat history from params when isCompacting is true
// otherwise use the full history
if (!isCompacting) {
return chatHistorySvc.getHistory();
}
} catch {}
}
return chatHistory;
}
// Helper function to handle auto-continuation after compaction
function handleAutoContinuation(
compactionOccurred: boolean,
shouldContinue: boolean,
chatHistory: ChatHistoryItem[],
): { shouldAutoContinue: boolean; chatHistory: ChatHistoryItem[] } {
if (!compactionOccurred || shouldContinue) {
return { shouldAutoContinue: false, chatHistory };
}
logger.debug(
"Auto-compaction occurred during this turn - automatically continuing session",
);
// Add a continuation message to the history
const chatHistorySvc = services.chatHistory;
if (
typeof chatHistorySvc?.isReady === "function" &&
chatHistorySvc.isReady()
) {
chatHistorySvc.addUserMessage("continue");
chatHistory = chatHistorySvc.getHistory();
} else {
chatHistory.push({
message: {
role: "user",
content: "continue",
},
contextItems: [],
});
}
logger.debug("Added continuation message after compaction");
return { shouldAutoContinue: true, chatHistory };
}
// Helper function to process a single chunk
interface ProcessChunkOptions {
chunk: any;
@ -128,6 +189,7 @@ interface ProcessStreamingResponseOptions {
callbacks?: StreamCallbacks;
isHeadless?: boolean;
tools?: ChatCompletionTool[];
systemMessage: string;
}
// Process a single streaming response and return whether we need to continue
@ -140,30 +202,56 @@ export async function processStreamingResponse(
toolCalls: ToolCall[];
shouldContinue: boolean;
}> {
const { model, llmApi, abortController, callbacks, isHeadless, tools } =
options;
const {
model,
llmApi,
abortController,
callbacks,
isHeadless,
tools,
systemMessage,
} = options;
let chatHistory = options.chatHistory;
// Validate context length before making the request
let validation = validateContextLength(chatHistory, model);
// Create temporary system message item for validation
const systemMessageItem: ChatHistoryItem = {
message: {
role: "system",
content: systemMessage,
},
contextItems: [],
};
// Prune last messages until valid
// Safety buffer to account for tokenization estimation errors
const SAFETY_BUFFER = 100;
// Validate context length INCLUDING system message
let historyWithSystem = [systemMessageItem, ...chatHistory];
let validation = validateContextLength(
historyWithSystem,
model,
SAFETY_BUFFER,
);
// Prune last messages until valid (excluding system message)
while (chatHistory.length > 1 && !validation.isValid) {
const prunedChatHistory = pruneLastMessage(chatHistory);
if (prunedChatHistory.length === chatHistory.length) break;
if (prunedChatHistory.length === chatHistory.length) {
break;
}
chatHistory = prunedChatHistory;
validation = validateContextLength(chatHistory, model);
// Re-validate with system message
historyWithSystem = [systemMessageItem, ...chatHistory];
validation = validateContextLength(historyWithSystem, model, SAFETY_BUFFER);
}
if (!validation.isValid) {
throw new Error(`Context length validation failed: ${validation.error}`);
}
// Get fresh system message and inject it
const systemMessage = await services.systemMessage.getSystemMessage(
services.toolPermissions.getState().currentMode,
);
// Create OpenAI format history with validated system message
const openaiChatHistory = convertFromUnifiedHistoryWithSystemMessage(
chatHistory,
systemMessage,
@ -329,7 +417,7 @@ export async function processStreamingResponse(
}
// Main function that handles the conversation loop
// eslint-disable-next-line complexity, max-params
// eslint-disable-next-line max-params
export async function streamChatResponse(
chatHistory: ChatHistoryItem[],
model: ModelConfig,
@ -348,53 +436,32 @@ export async function streamChatResponse(
let fullResponse = "";
let finalResponse = "";
let compactionOccurredThisTurn = false; // Track if compaction happened during this conversation turn
while (true) {
// If ChatHistoryService is available, refresh local chatHistory view
const chatHistorySvc = services.chatHistory;
if (
typeof chatHistorySvc?.isReady === "function" &&
chatHistorySvc.isReady()
) {
try {
// use chat history from params when isCompacting is true
// otherwise use the full history
if (!isCompacting) {
chatHistory = chatHistorySvc.getHistory();
}
} catch {}
}
chatHistory = refreshChatHistoryFromService(chatHistory, isCompacting);
logger.debug("Starting conversation iteration");
logger.debug("debug1 streamChatResponse history", { chatHistory });
// avoid pre-compaction when compaction is in progress
// this also avoids infinite compaction call stacks
if (!isCompacting) {
// Pre-API auto-compaction checkpoint
const { wasCompacted: preCompacted, chatHistory: preCompactHistory } =
await handleAutoCompaction(chatHistory, model, llmApi, {
isHeadless,
callbacks: {
onSystemMessage: callbacks?.onSystemMessage,
onContent: callbacks?.onContent,
},
});
// Get system message once per iteration (can change based on tool permissions mode)
const systemMessage = await services.systemMessage.getSystemMessage(
services.toolPermissions.getState().currentMode,
);
if (preCompacted) {
logger.debug("Pre-API compaction occurred, updating chat history");
// Update chat history after pre-compaction
const chatHistorySvc2 = services.chatHistory;
if (
typeof chatHistorySvc2?.isReady === "function" &&
chatHistorySvc2.isReady()
) {
chatHistorySvc2.setHistory(preCompactHistory);
chatHistory = chatHistorySvc2.getHistory();
} else {
chatHistory = [...preCompactHistory];
}
}
// Pre-API auto-compaction checkpoint
const preCompactionResult = await handlePreApiCompaction(chatHistory, {
model,
llmApi,
isCompacting,
isHeadless,
callbacks,
systemMessage,
});
chatHistory = preCompactionResult.chatHistory;
if (preCompactionResult.wasCompacted) {
compactionOccurredThisTurn = true;
}
// Recompute tools on each iteration to handle mode changes during streaming
@ -415,6 +482,7 @@ export async function streamChatResponse(
abortController,
callbacks,
tools,
systemMessage,
});
if (abortController?.signal.aborted) {
@ -447,36 +515,59 @@ export async function streamChatResponse(
return finalResponse || content || fullResponse;
}
// Check for auto-compaction after tool execution
if (shouldContinue) {
const { wasCompacted, chatHistory: updatedChatHistory } =
await handleAutoCompaction(chatHistory, model, llmApi, {
isHeadless,
callbacks: {
onSystemMessage: callbacks?.onSystemMessage,
onContent: callbacks?.onContent,
},
});
// Only update chat history if compaction actually occurred
if (wasCompacted) {
// Always prefer service; local copy is for temporary reads only
const chatHistorySvc2 = services.chatHistory;
if (
typeof chatHistorySvc2?.isReady === "function" &&
chatHistorySvc2.isReady()
) {
chatHistorySvc2.setHistory(updatedChatHistory);
chatHistory = chatHistorySvc2.getHistory();
} else {
// Fallback only when service is unavailable
chatHistory = [...updatedChatHistory];
}
}
// After tool execution, validate that we haven't exceeded context limit
const postToolResult = await handlePostToolValidation(
toolCalls,
chatHistory,
{
model,
llmApi,
isCompacting,
isHeadless,
callbacks,
systemMessage,
},
);
chatHistory = postToolResult.chatHistory;
if (postToolResult.wasCompacted) {
compactionOccurredThisTurn = true;
}
// Check if we should continue
if (!shouldContinue) {
// Normal auto-compaction check at 80% threshold
const compactionResult = await handleNormalAutoCompaction(
chatHistory,
shouldContinue,
{
model,
llmApi,
isCompacting,
isHeadless,
callbacks,
systemMessage,
},
);
chatHistory = compactionResult.chatHistory;
if (compactionResult.wasCompacted) {
compactionOccurredThisTurn = true;
}
// If compaction happened during this turn and we're about to stop,
// automatically send a continuation message to keep the agent going
const autoContinueResult = handleAutoContinuation(
compactionOccurredThisTurn,
shouldContinue,
chatHistory,
);
chatHistory = autoContinueResult.chatHistory;
const shouldAutoContinue = autoContinueResult.shouldAutoContinue;
// Reset flag to avoid infinite continuation
if (shouldAutoContinue) {
compactionOccurredThisTurn = false;
}
// Check if we should continue (skip break if auto-continuing after compaction)
if (!shouldContinue && !shouldAutoContinue) {
break;
}
}

View file

@ -88,7 +88,7 @@ IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed
const TIMEOUT_MS =
process.env.NODE_ENV === "test" && process.env.TEST_TERMINAL_TIMEOUT
? parseInt(process.env.TEST_TERMINAL_TIMEOUT, 10)
: 30000; // 30 seconds default, configurable for tests
: 120000; // 120 seconds default, configurable for tests
const resetTimeout = () => {
if (timeoutId) {

View file

@ -3,15 +3,27 @@ import * as fs from "fs";
import * as util from "util";
import { ContinueError, ContinueErrorReason } from "core/util/errors.js";
import { findUp } from "find-up";
import { Tool } from "./types.js";
const execPromise = util.promisify(child_process.exec);
// Default maximum number of results to display
const DEFAULT_MAX_RESULTS = 100;
const MAX_LINE_LENGTH = 1000;
async function getGitignorePatterns() {
const gitIgnorePath = await findUp(".gitignore");
if (!gitIgnorePath) return [];
const content = fs.readFileSync(gitIgnorePath, "utf-8");
const ignorePatterns = [];
for (let line of content.trim().split("\n")) {
line = line.trim();
if (line.startsWith("#") || line === "") continue; // ignore comments and empty line
if (line.startsWith("!")) continue; // ignore negated ignores
ignorePatterns.push(line);
}
return ignorePatterns;
}
// procedure 1: search with ripgrep
export async function checkIfRipgrepIsInstalled(): Promise<boolean> {
try {
await execPromise("rg --version");
@ -21,6 +33,57 @@ export async function checkIfRipgrepIsInstalled(): Promise<boolean> {
}
}
async function searchWithRipgrep(
pattern: string,
searchPath: string,
filePattern?: string,
) {
let command = `rg --line-number --with-filename --color never "${pattern}"`;
if (filePattern) {
command += ` -g "${filePattern}"`;
}
const ignorePatterns = await getGitignorePatterns();
for (const ignorePattern of ignorePatterns) {
command += ` -g "!${ignorePattern}"`;
}
command += ` "${searchPath}"`;
const { stdout, stderr } = await execPromise(command);
return { stdout, stderr };
}
// procedure 2: search with grep on unix or findstr on windows
async function searchWithGrepOrFindstr(
pattern: string,
searchPath: string,
filePattern?: string,
) {
const isWindows = process.platform === "win32";
const ignorePatterns = await getGitignorePatterns();
let command: string;
if (isWindows) {
const fileSpec = filePattern ? filePattern : "*";
command = `findstr /S /N /P /R "${pattern}" "${fileSpec}"`; // findstr does not support ignoring patterns
} else {
let excludeArgs = "";
for (const ignorePattern of ignorePatterns) {
excludeArgs += ` --exclude="${ignorePattern}" --exclude-dir="${ignorePattern}"`; // use both exclude and exclude-dir because ignorePattern can be a file or directory
}
if (filePattern) {
command = `find . -type f -path "${filePattern}" -print0 | xargs -0 grep -nH -I${excludeArgs} "${pattern}"`;
} else {
command = `grep -R -n -H -I${excludeArgs} "${pattern}" .`;
}
}
return await execPromise(command, { cwd: searchPath });
}
// Default maximum number of results to display
const DEFAULT_MAX_RESULTS = 100;
const MAX_LINE_LENGTH = 1000;
export const searchCodeTool: Tool = {
name: "Search",
displayName: "Search",
@ -73,15 +136,26 @@ export const searchCodeTool: Tool = {
);
}
let command = `rg --line-number --with-filename --color never "${args.pattern}"`;
if (args.file_pattern) {
command += ` -g "${args.file_pattern}"`;
}
command += ` "${searchPath}"`;
let stdout = "",
stderr = "";
try {
const { stdout, stderr } = await execPromise(command);
if (await checkIfRipgrepIsInstalled()) {
const results = await searchWithRipgrep(
args.pattern,
searchPath,
args.file_pattern,
);
stdout = results.stdout;
stderr = results.stderr;
} else {
const results = await searchWithGrepOrFindstr(
args.pattern,
searchPath,
args.file_pattern,
);
stdout = results.stdout;
stderr = results.stderr;
}
if (stderr) {
return `Warning during search: ${stderr}\n\n${stdout}`;
@ -121,13 +195,8 @@ export const searchCodeTool: Tool = {
args.file_pattern ? ` in files matching "${args.file_pattern}"` : ""
}.`;
}
if (error instanceof Error) {
if (error.message.includes("command not found")) {
throw new Error(`ripgrep is not installed.`);
}
}
throw new Error(
`Error executing ripgrep: ${
`Error executing search: ${
error instanceof Error ? error.message : String(error)
}`,
);

View file

@ -1,4 +1,5 @@
import { testBothModes, renderInMode } from "./TUIChat.dualModeHelper.js";
import { renderInMode, testBothModes } from "./TUIChat.dualModeHelper.js";
import { waitForCondition } from "./TUIChat.testHelper.js";
/**
* Integration tests for the message edit feature in TUIChat
@ -10,7 +11,6 @@ import { testBothModes, renderInMode } from "./TUIChat.dualModeHelper.js";
* 4. History is rewound and new message is submitted
* 5. Chat updates correctly
*/
describe("TUIChat - Message Edit Feature", () => {
testBothModes("double Esc should open edit selector", async (mode) => {
const { lastFrame, stdin } = renderInMode(mode);
@ -119,7 +119,11 @@ describe("TUIChat - Message Edit Feature", () => {
// Perform various operations
stdin.write("\u001b");
stdin.write("\u001b"); // Open edit with separate Esc presses
await new Promise((resolve) => setTimeout(resolve, 100));
// Wait for selector to open (poll instead of fixed timeout)
await waitForCondition(
() => lastFrame()?.includes("No user messages to edit") ?? false,
);
// Verify selector opened
let frame = lastFrame();
@ -130,7 +134,11 @@ describe("TUIChat - Message Edit Feature", () => {
await new Promise((resolve) => setTimeout(resolve, 50));
stdin.write("\u001b"); // Close
await new Promise((resolve) => setTimeout(resolve, 100));
// Wait for selector to close (poll instead of fixed timeout)
await waitForCondition(
() => !(lastFrame()?.includes("No user messages to edit") ?? true),
);
frame = lastFrame();

View file

@ -1,5 +1,5 @@
import { renderInMode, testSingleMode } from "./TUIChat.dualModeHelper.js";
import { waitForNextRender } from "./TUIChat.testHelper.js";
import { waitForCondition } from "./TUIChat.testHelper.js";
describe("TUIChat - @ File Search Tests", () => {
testSingleMode("shows @ character when user types @", "local", async () => {
@ -34,17 +34,20 @@ describe("TUIChat - @ File Search Tests", () => {
// Type @ followed by text to filter files
stdin.write("@READ");
// Wait for file search to filter and display results
await new Promise((resolve) => setTimeout(resolve, 500));
let frame = lastFrame();
const frame = lastFrame()!;
await waitForCondition(() => {
frame = lastFrame();
return frame?.includes("@READ") ?? false;
});
expect(frame).toBeDefined();
// Should show the typed text
expect(frame).toContain("@READ");
// Should show either navigation hints or at least indicate file search is working
const hasNavigationHints = frame.includes("↑/↓ to navigate");
const hasFileSearch = frame.includes("@READ");
const hasNavigationHints = frame!.includes("↑/↓ to navigate");
const hasFileSearch = frame!.includes("@READ");
expect(hasNavigationHints || hasFileSearch).toBe(true);
// Local mode specific UI expectations
@ -57,10 +60,13 @@ describe("TUIChat - @ File Search Tests", () => {
// Type multiple @ characters
stdin.write("@@test");
// Wait for UI update
await waitForNextRender();
const frame = lastFrame();
let frame = lastFrame();
await waitForCondition(() => {
frame = lastFrame();
return frame?.includes("@@test") ?? false;
});
// Should handle multiple @ without crashing
expect(frame).toBeDefined();

View file

@ -1,5 +1,5 @@
import { renderInMode, testBothModes } from "./TUIChat.dualModeHelper.js";
import { waitForNextRender } from "./TUIChat.testHelper.js";
import { waitForCondition, waitForNextRender } from "./TUIChat.testHelper.js";
describe("TUIChat - Slash Commands Tests", () => {
testBothModes("shows slash when user types /", async (mode) => {
@ -28,9 +28,13 @@ describe("TUIChat - Slash Commands Tests", () => {
// Type /exi to trigger slash command filtering
stdin.write("/exi");
await waitForNextRender();
const frame = lastFrame();
let frame = lastFrame();
await waitForCondition(() => {
frame = lastFrame();
return frame?.includes("/exi") ?? false;
});
// Should show the typed command
expect(frame).toContain("/exi");

View file

@ -458,6 +458,24 @@ export function expectNormalMode(frame: string | undefined) {
expect(frame).toContain("Continue CLI");
}
/**
* Helper to wait for a condition to be true
* similar to `waitFor` in testing libraries
*/
export async function waitForCondition(
conditionFn: () => boolean,
timeoutMs = 2000,
intervalMs = 50,
): Promise<void> {
const startTime = Date.now();
while (Date.now() - startTime < timeoutMs) {
if (conditionFn()) {
return;
}
await new Promise((resolve) => setTimeout(resolve, intervalMs));
}
}
// Make runTest available globally for test files
declare global {
var runTest: (

View file

@ -44,13 +44,9 @@ export async function handleCompactCommand({
try {
// Compact the chat history directly (already in unified format) with abort controller
const result = await compactChatHistory(
chatHistory,
model,
llmApi,
undefined,
compactionController,
);
const result = await compactChatHistory(chatHistory, model, llmApi, {
abortController: compactionController,
});
// Check if operation was aborted before proceeding with success actions
if (compactionController.signal.aborted) {
@ -153,13 +149,9 @@ export async function handleAutoCompaction({
logger.info("Auto-compaction triggered for TUI mode");
// Compact the unified history
const result = await compactChatHistory(
chatHistory,
model,
llmApi,
undefined,
const result = await compactChatHistory(chatHistory, model, llmApi, {
abortController,
);
});
// Keep the system message and append the compaction summary
// This replaces the old messages with a summary to reduce context size

Some files were not shown because too many files have changed in this diff Show more