Elffuss BraidHub

kikocis/continue public

Merge branch 'main' into install-guide-mcp
Changeset8ec1a9e770aef609c83c9faa2bdf6d98d21027c4575afce69e43d80b5aeea042
Authoruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-18 11:43 +05:30
Committeruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-18 11:43 +05:30
Parents9334ee37bf04, d4eec0630c2e

Browse the files at this changeset

125 files changed

modified .github/workflows/continue-detailed-review.yaml +1 −1
@@ -18,7 +18,7 @@
1818 timeout-minutes: 10
1919 steps:
2020 - name: Run Detailed PR Review
21- uses: continuedev/continue/actions/detailed-review@8373ac24010df1110cd00512f925b63813362da1
21+ uses: continuedev/continue/actions/detailed-review@3ebd8232440080aa8891909753f69d75a87b2c86
2222 with:
2323 continue-api-key: ${{ secrets.CONTINUE_API_KEY }}
2424 continue-org: continuedev
modified .github/workflows/continue-general-review.yaml +1 −1
@@ -18,7 +18,7 @@
1818 timeout-minutes: 10
1919 steps:
2020 - name: Run Continue PR Review Action
21- uses: continuedev/continue/actions/general-review@8373ac24010df1110cd00512f925b63813362da1
21+ uses: continuedev/continue/actions/general-review@3ebd8232440080aa8891909753f69d75a87b2c86
2222 with:
2323 continue-api-key: ${{ secrets.CONTINUE_API_KEY }}
2424 continue-org: "continuedev"
modified .github/workflows/pr-checks.yaml +5 −0
@@ -84,6 +84,9 @@
8484 AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }}
8585 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
8686 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
87+ VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
88+ RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
89+ INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
8790
8891 gui-checks:
8992 runs-on: ubuntu-latest
@@ -217,6 +220,8 @@
217220 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
218221 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
219222 VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
223+ RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
224+ INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
220225
221226 vscode-get-test-file-matrix:
222227 runs-on: ubuntu-latest
modified .github/workflows/release-config-yaml.yml +2 −0
@@ -32,3 +32,5 @@
3232 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
3333 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
3434 VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
35+ RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
36+ INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
modified .github/workflows/release-fetch.yml +2 −0
@@ -32,3 +32,5 @@
3232 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
3333 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
3434 VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
35+ RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
36+ INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
modified .github/workflows/release-llm-info.yml +4 −1
@@ -23,4 +23,7 @@
2323 AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
2424 AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }}
2525 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
26- AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
No newline at the end of the file
26+ AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
27+ VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
28+ RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
29+ INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
modified .github/workflows/release-openai-adapters.yml +2 −0
@@ -32,3 +32,5 @@
3232 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
3333 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
3434 VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
35+ RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
36+ INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
modified .github/workflows/reusable-release.yml +6 −0
@@ -32,6 +32,10 @@
3232 required: false
3333 VOYAGE_API_KEY:
3434 required: false
35+ RELACE_API_KEY:
36+ required: false
37+ INCEPTION_API_KEY:
38+ required: false
3539
3640 permissions:
3741 contents: write
@@ -77,6 +81,8 @@
7781 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
7882 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
7983 VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
84+ RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
85+ INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
8086
8187 - name: Release
8288 env:
modified binary/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified core/config/load.ts +3 −1
@@ -215,8 +215,8 @@
215215 // Prepare models
216216 for (const model of models) {
217217 model.requestOptions = {
218- ...model.requestOptions,
219218 ...config.requestOptions,
219+ ...model.requestOptions,
220220 };
221221 if (roles !== undefined) {
222222 model.roles = model.roles ?? roles;
@@ -545,6 +545,7 @@
545545
546546 // Trigger MCP server refreshes (Config is reloaded again once connected!)
547547 const mcpManager = MCPManagerSingleton.getInstance();
548+
548549 const orgPolicy = PolicySingleton.getInstance().policy;
549550 if (orgPolicy?.policy?.allowMcpServers === false) {
550551 await mcpManager.shutdown();
@@ -555,6 +556,7 @@
555556 id: `continue-mcp-server-${index + 1}`,
556557 name: `MCP Server`,
557558 ...server,
559+ requestOptions: config.requestOptions,
558560 }),
559561 ),
560562 false,
modified core/config/profile/doLoadConfig.ts +0 −1
@@ -187,7 +187,6 @@
187187 const mcpManager = MCPManagerSingleton.getInstance();
188188 const mcpServerStatuses = mcpManager.getStatuses();
189189
190- // Slightly hacky just need connection's client to make slash command for now
191190 const serializableStatuses = mcpServerStatuses.map((server) => {
192191 const { client, ...rest } = server;
193192 return rest;
modified core/config/yaml/loadYaml.ts +17 −17
@@ -4,6 +4,7 @@
44 ConfigResult,
55 ConfigValidationError,
66 isAssistantUnrolledNonNullable,
7+ mergeConfigYamlRequestOptions,
78 mergeUnrolledAssistants,
89 ModelRole,
910 PackageIdentifier,
@@ -34,10 +35,7 @@
3435 import { unrollLocalYamlBlocks } from "./loadLocalYamlBlocks";
3536 import { LocalPlatformClient } from "./LocalPlatformClient";
3637 import { llmsFromModelConfig } from "./models";
37-import {
38- convertYamlMcpToContinueMcp,
39- convertYamlRuleToContinueRule,
40-} from "./yamlToContinueConfig";
38+import { convertYamlRuleToContinueRule } from "./yamlToContinueConfig";
4139
4240 async function loadConfigYaml(options: {
4341 overrideConfigYaml: AssistantUnrolled | undefined;
@@ -155,16 +153,15 @@
155153 };
156154 }
157155
158-async function configYamlToContinueConfig(options: {
156+export async function configYamlToContinueConfig(options: {
159157 config: AssistantUnrolled;
160158 ide: IDE;
161- ideSettings: IdeSettings;
162159 ideInfo: IdeInfo;
163160 uniqueId: string;
164161 llmLogger: ILLMLogger;
165162 workOsAccessToken: string | undefined;
166163 }): Promise<{ config: ContinueConfig; errors: ConfigValidationError[] }> {
167- let { config, ide, ideSettings, ideInfo, uniqueId, llmLogger } = options;
164+ let { config, ide, ideInfo, uniqueId, llmLogger } = options;
168165
169166 const localErrors: ConfigValidationError[] = [];
170167
@@ -192,6 +189,7 @@
192189 summarize: null,
193190 },
194191 rules: [],
192+ requestOptions: { ...config.requestOptions },
195193 };
196194
197195 // Right now, if there are any missing packages in the config, then we will just throw an error
@@ -226,7 +224,13 @@
226224 }
227225 }
228226
229- continueConfig.data = config.data;
227+ continueConfig.data = config.data?.map((d) => ({
228+ ...d,
229+ requestOptions: mergeConfigYamlRequestOptions(
230+ d.requestOptions,
231+ continueConfig.requestOptions,
232+ ),
233+ }));
230234 continueConfig.docs = config.docs?.map((doc) => ({
231235 title: doc.name,
232236 startUrl: doc.startUrl,
@@ -250,12 +254,6 @@
250254 });
251255 });
252256
253- continueConfig.experimental = {
254- modelContextProtocolServers: config.mcpServers?.map(
255- convertYamlMcpToContinueMcp,
256- ),
257- };
258-
259257 // Prompt files -
260258 try {
261259 const promptFiles = await getAllPromptFiles(ide, undefined, true);
@@ -307,9 +305,7 @@
307305 try {
308306 const llms = await llmsFromModelConfig({
309307 model,
310- ide,
311308 uniqueId,
312- ideSettings,
313309 llmLogger,
314310 config: continueConfig,
315311 });
@@ -394,6 +390,7 @@
394390
395391 // Trigger MCP server refreshes (Config is reloaded again once connected!)
396392 const mcpManager = MCPManagerSingleton.getInstance();
393+
397394 const orgPolicy = PolicySingleton.getInstance().policy;
398395 if (orgPolicy?.policy?.allowMcpServers === false) {
399396 await mcpManager.shutdown();
@@ -406,6 +403,10 @@
406403 transport: {
407404 type: "stdio",
408405 args: [],
406+ requestOptions: mergeConfigYamlRequestOptions(
407+ server.requestOptions,
408+ config.requestOptions,
409+ ),
409410 ...(server as any), // TODO: fix the types on mcpServers in config-yaml
410411 },
411412 timeout: server.connectionTimeout,
@@ -464,7 +465,6 @@
464465 await configYamlToContinueConfig({
465466 config: configYamlResult.config,
466467 ide,
467- ideSettings,
468468 ideInfo,
469469 uniqueId,
470470 llmLogger,
modified core/config/yaml/models.ts +11 −22
@@ -1,12 +1,9 @@
1-import { ModelConfig } from "@continuedev/config-yaml";
2-
31 import {
4- ContinueConfig,
5- IDE,
6- IdeSettings,
7- ILLMLogger,
8- LLMOptions,
9-} from "../..";
2+ mergeConfigYamlRequestOptions,
3+ ModelConfig,
4+} from "@continuedev/config-yaml";
5+
6+import { ContinueConfig, ILLMLogger, LLMOptions } from "../..";
107 import { BaseLLM } from "../../llm";
118 import { LLMClasses } from "../../llm/llms";
129
@@ -29,14 +26,12 @@
2926 async function modelConfigToBaseLLM({
3027 model,
3128 uniqueId,
32- ideSettings,
3329 llmLogger,
3430 config,
3531 isFromAutoDetect,
3632 }: {
3733 model: ModelConfig;
3834 uniqueId: string;
39- ideSettings: IdeSettings;
4035 llmLogger: ILLMLogger;
4136 config: ContinueConfig;
4237 isFromAutoDetect?: boolean;
@@ -49,6 +44,11 @@
4944
5045 const { capabilities, ...rest } = model;
5146
47+ const mergedRequestOptions = mergeConfigYamlRequestOptions(
48+ rest.requestOptions,
49+ config.requestOptions,
50+ );
51+
5252 let options: LLMOptions = {
5353 ...rest,
5454 contextLength: model.defaultCompletionOptions?.contextLength,
@@ -74,6 +74,7 @@
7474 },
7575 autocompleteOptions: model.autocompleteOptions,
7676 isFromAutoDetect,
77+ requestOptions: mergedRequestOptions,
7778 };
7879
7980 // Model capabilities - need to be undefined if not found
@@ -154,17 +155,13 @@
154155 async function autodetectModels({
155156 llm,
156157 model,
157- ide,
158158 uniqueId,
159- ideSettings,
160159 llmLogger,
161160 config,
162161 }: {
163162 llm: BaseLLM;
164163 model: ModelConfig;
165- ide: IDE;
166164 uniqueId: string;
167- ideSettings: IdeSettings;
168165 llmLogger: ILLMLogger;
169166 config: ContinueConfig;
170167 }): Promise<BaseLLM[]> {
@@ -183,7 +180,6 @@
183180 name: modelName,
184181 },
185182 uniqueId,
186- ideSettings,
187183 llmLogger,
188184 config,
189185 isFromAutoDetect: true,
@@ -199,23 +195,18 @@
199195
200196 export async function llmsFromModelConfig({
201197 model,
202- ide,
203198 uniqueId,
204- ideSettings,
205199 llmLogger,
206200 config,
207201 }: {
208202 model: ModelConfig;
209- ide: IDE;
210203 uniqueId: string;
211- ideSettings: IdeSettings;
212204 llmLogger: ILLMLogger;
213205 config: ContinueConfig;
214206 }): Promise<BaseLLM[]> {
215207 const baseLlm = await modelConfigToBaseLLM({
216208 model,
217209 uniqueId,
218- ideSettings,
219210 llmLogger,
220211 config,
221212 });
@@ -227,9 +218,7 @@
227218 const models = await autodetectModels({
228219 llm: baseLlm,
229220 model,
230- ide,
231221 uniqueId,
232- ideSettings,
233222 llmLogger,
234223 config,
235224 });
added core/config/yaml/models.vitest.ts +355 −0
@@ -0,0 +1,355 @@
1+import { ModelConfig } from "@continuedev/config-yaml";
2+import { beforeEach, describe, expect, it, vi } from "vitest";
3+
4+import { ContinueConfig, ILLMLogger } from "../..";
5+import { llmsFromModelConfig } from "./models";
6+
7+// Mock the LLM classes
8+vi.mock("../../llm/llms", () => ({
9+ LLMClasses: [
10+ class MockOpenAI {
11+ static providerName = "openai";
12+ static defaultOptions = {
13+ completionOptions: {
14+ maxTokens: 2048,
15+ },
16+ };
17+
18+ constructor(options: any) {
19+ Object.assign(this, options);
20+ }
21+
22+ async listModels() {
23+ return ["gpt-4", "gpt-3.5-turbo"];
24+ }
25+ },
26+ class MockAnthropic {
27+ static providerName = "anthropic";
28+ static defaultOptions = {
29+ completionOptions: {
30+ maxTokens: 4096,
31+ },
32+ };
33+
34+ constructor(options: any) {
35+ Object.assign(this, options);
36+ }
37+
38+ async listModels() {
39+ return ["claude-3-5-sonnet-20241022", "claude-3-haiku-20240307"];
40+ }
41+ },
42+ ],
43+}));
44+
45+describe("llmsFromModelConfig requestOptions merging", () => {
46+ let mockLLMLogger: ILLMLogger;
47+ let mockConfig: ContinueConfig;
48+
49+ beforeEach(() => {
50+ mockLLMLogger = { log: vi.fn() } as any;
51+ mockConfig = {
52+ requestOptions: {
53+ timeout: 30000,
54+ headers: {
55+ "User-Agent": "Continue/1.0.0",
56+ },
57+ proxy: "global-proxy",
58+ },
59+ contextProviders: [],
60+ mcpServerStatuses: [],
61+ rules: [],
62+ selectedModelByRole: {
63+ apply: null,
64+ autocomplete: null,
65+ chat: null,
66+ edit: null,
67+ embed: null,
68+ rerank: null,
69+ summarize: null,
70+ },
71+ modelsByRole: {
72+ apply: [],
73+ autocomplete: [],
74+ chat: [],
75+ edit: [],
76+ embed: [],
77+ rerank: [],
78+ summarize: [],
79+ },
80+ slashCommands: [],
81+ tools: [],
82+ allowAnonymousTelemetry: false,
83+ } as ContinueConfig;
84+ vi.clearAllMocks();
85+ });
86+
87+ it("should merge model requestOptions with config requestOptions", async () => {
88+ const model: ModelConfig = {
89+ name: "test-openai",
90+ provider: "openai",
91+ model: "gpt-4",
92+ requestOptions: {
93+ timeout: 60000,
94+ headers: {
95+ Authorization: "Bearer token123",
96+ },
97+ proxy: "model-proxy",
98+ },
99+ };
100+
101+ const result = await llmsFromModelConfig({
102+ model,
103+ uniqueId: "test-id",
104+ llmLogger: mockLLMLogger,
105+ config: mockConfig,
106+ });
107+
108+ expect(result).toHaveLength(1);
109+ const llm = result[0];
110+
111+ // The LLM should have merged requestOptions
112+ expect(llm.requestOptions).toEqual({
113+ timeout: 60000, // model-specific takes precedence
114+ headers: {
115+ "User-Agent": "Continue/1.0.0", // from global request options
116+ Authorization: "Bearer token123", // from model
117+ },
118+ proxy: "model-proxy", // model-specific takes precedence
119+ });
120+ });
121+
122+ it("should use config requestOptions when model has no requestOptions", async () => {
123+ const model: ModelConfig = {
124+ name: "test-openai",
125+ provider: "openai",
126+ model: "gpt-4",
127+ // no requestOptions
128+ };
129+
130+ const result = await llmsFromModelConfig({
131+ model,
132+ uniqueId: "test-id",
133+ llmLogger: mockLLMLogger,
134+ config: mockConfig,
135+ });
136+
137+ expect(result).toHaveLength(1);
138+ const llm = result[0];
139+
140+ // The LLM should have config requestOptions
141+ expect(llm.requestOptions).toEqual(mockConfig.requestOptions);
142+ });
143+
144+ it("should use model requestOptions when config has no requestOptions", async () => {
145+ const model: ModelConfig = {
146+ name: "test-openai",
147+ provider: "openai",
148+ model: "gpt-4",
149+ requestOptions: {
150+ timeout: 45000,
151+ headers: {
152+ "API-Key": "secret",
153+ },
154+ },
155+ };
156+
157+ const configWithoutOptions = { ...mockConfig };
158+ delete configWithoutOptions.requestOptions;
159+
160+ const result = await llmsFromModelConfig({
161+ model,
162+ uniqueId: "test-id",
163+ llmLogger: mockLLMLogger,
164+ config: configWithoutOptions,
165+ });
166+
167+ expect(result).toHaveLength(1);
168+ const llm = result[0];
169+
170+ // The LLM should have model requestOptions
171+ expect(llm.requestOptions).toEqual(model.requestOptions);
172+ });
173+
174+ it("should handle empty headers correctly in merge", async () => {
175+ const model: ModelConfig = {
176+ name: "test-openai",
177+ provider: "openai",
178+ model: "gpt-4",
179+ requestOptions: {
180+ timeout: 60000,
181+ headers: {},
182+ },
183+ };
184+
185+ const configWithEmptyHeaders = {
186+ ...mockConfig,
187+ requestOptions: {
188+ ...mockConfig.requestOptions!,
189+ headers: {},
190+ },
191+ };
192+
193+ const result = await llmsFromModelConfig({
194+ model,
195+ uniqueId: "test-id",
196+ llmLogger: mockLLMLogger,
197+ config: configWithEmptyHeaders,
198+ });
199+
200+ expect(result).toHaveLength(1);
201+ const llm = result[0];
202+
203+ // When headers merge to empty object, they should be undefined
204+ expect(llm.requestOptions).toEqual({
205+ timeout: 60000,
206+ proxy: "global-proxy",
207+ headers: undefined,
208+ });
209+ });
210+
211+ it("should handle autodetect models with merged requestOptions", async () => {
212+ const model: ModelConfig = {
213+ name: "autodetect-openai",
214+ provider: "openai",
215+ model: "AUTODETECT",
216+ requestOptions: {
217+ timeout: 120000,
218+ headers: {
219+ "X-Custom": "autodetect",
220+ },
221+ },
222+ };
223+
224+ const result = await llmsFromModelConfig({
225+ model,
226+ uniqueId: "test-id",
227+ llmLogger: mockLLMLogger,
228+ config: mockConfig,
229+ });
230+
231+ // Should return multiple models from listModels()
232+ expect(result.length).toBeGreaterThan(0);
233+
234+ // Each detected model should have the merged requestOptions
235+ result.forEach((llm) => {
236+ expect(llm.requestOptions).toEqual({
237+ timeout: 120000, // model-specific takes precedence
238+ headers: {
239+ "User-Agent": "Continue/1.0.0", // from global request options
240+ "X-Custom": "autodetect", // from model
241+ },
242+ proxy: "global-proxy", // from global request options
243+ });
244+ });
245+ });
246+
247+ it("should handle unknown provider gracefully", async () => {
248+ const model: ModelConfig = {
249+ name: "unknown-provider",
250+ provider: "unknown",
251+ model: "unknown-model",
252+ requestOptions: {
253+ timeout: 60000,
254+ },
255+ };
256+
257+ const result = await llmsFromModelConfig({
258+ model,
259+ uniqueId: "test-id",
260+ llmLogger: mockLLMLogger,
261+ config: mockConfig,
262+ });
263+
264+ // Should return empty array for unknown provider
265+ expect(result).toHaveLength(0);
266+ });
267+
268+ it("should preserve other model properties while merging requestOptions", async () => {
269+ const model: ModelConfig = {
270+ name: "test-anthropic",
271+ provider: "anthropic",
272+ model: "claude-3-5-sonnet-20241022",
273+ roles: ["chat", "summarize"],
274+ capabilities: ["tool_use", "image_input"],
275+ defaultCompletionOptions: {
276+ temperature: 0.7,
277+ maxTokens: 1000,
278+ },
279+ requestOptions: {
280+ timeout: 90000,
281+ },
282+ };
283+
284+ const result = await llmsFromModelConfig({
285+ model,
286+ uniqueId: "test-id",
287+ llmLogger: mockLLMLogger,
288+ config: mockConfig,
289+ });
290+
291+ expect(result).toHaveLength(1);
292+ const llm = result[0];
293+
294+ // Should preserve model properties
295+ expect(llm.title).toBe("test-anthropic");
296+ expect(llm.completionOptions?.temperature).toBe(0.7);
297+ expect(llm.completionOptions?.maxTokens).toBe(1000);
298+ expect(llm.capabilities?.tools).toBe(true);
299+ expect(llm.capabilities?.uploadImage).toBe(true);
300+
301+ // Should have merged requestOptions
302+ expect(llm.requestOptions).toEqual({
303+ timeout: 90000,
304+ headers: {
305+ "User-Agent": "Continue/1.0.0",
306+ },
307+ proxy: "global-proxy",
308+ });
309+ });
310+
311+ it("should handle complex header merging scenarios", async () => {
312+ const model: ModelConfig = {
313+ name: "complex-headers",
314+ provider: "openai",
315+ model: "gpt-4",
316+ requestOptions: {
317+ headers: {
318+ Authorization: "Bearer model-token",
319+ Accept: "application/json", // Should override config Accept
320+ "X-Model-Specific": "true",
321+ },
322+ },
323+ };
324+
325+ const configWithMoreHeaders = {
326+ ...mockConfig,
327+ requestOptions: {
328+ ...mockConfig.requestOptions!,
329+ headers: {
330+ ...mockConfig.requestOptions!.headers,
331+ Accept: "text/plain", // Should be overridden by model
332+ "Cache-Control": "no-cache",
333+ },
334+ },
335+ };
336+
337+ const result = await llmsFromModelConfig({
338+ model,
339+ uniqueId: "test-id",
340+ llmLogger: mockLLMLogger,
341+ config: configWithMoreHeaders,
342+ });
343+
344+ expect(result).toHaveLength(1);
345+ const llm = result[0];
346+
347+ expect(llm.requestOptions?.headers).toEqual({
348+ "User-Agent": "Continue/1.0.0", // from global request options
349+ "Cache-Control": "no-cache", // from global request options
350+ Authorization: "Bearer model-token", // from model
351+ Accept: "application/json", // from model (overrides config)
352+ "X-Model-Specific": "true", // from model
353+ });
354+ });
355+});
modified core/core.ts +6 −0
@@ -18,6 +18,7 @@
1818 import DocsService from "./indexing/docs/DocsService";
1919 import { countTokens } from "./llm/countTokens";
2020 import Ollama from "./llm/llms/Ollama";
21+import Lemonade from "./llm/llms/Lemonade";
2122 import { EditAggregator } from "./nextEdit/context/aggregateEdits";
2223 import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile";
2324 import { callTool } from "./tools/callTool";
@@ -1263,6 +1264,9 @@
12631264 if (msg.data.title === "Ollama") {
12641265 const models = await new Ollama({ model: "" }).listModels();
12651266 return models;
1267+ } else if (msg.data.title === "Lemonade") {
1268+ const models = await new Lemonade({ model: "" }).listModels();
1269+ return models;
12661270 } else {
12671271 return undefined;
12681272 }
@@ -1348,6 +1352,8 @@
13481352 selectedCode,
13491353 reranker: config.selectedModelByRole.rerank,
13501354 fetch: (url, init) =>
1355+ // Important note: context providers fetch uses global request options not LLM request options
1356+ // Because LLM calls are handled separately
13511357 fetchwithRequestOptions(url, init, config.requestOptions),
13521358 isInAgentMode: msg.data.isInAgentMode,
13531359 });
modified core/index.d.ts +2 −0
@@ -1099,6 +1099,7 @@
10991099 exampleArgs?: Array<[string, string | number]>;
11001100 };
11011101 defaultToolPolicy?: ToolPolicy;
1102+ toolCallIcon?: string;
11021103 evaluateToolCallPolicy?: (
11031104 basePolicy: ToolPolicy,
11041105 parsedArgs: Record<string, unknown>,
@@ -1281,6 +1282,7 @@
12811282 transport: TransportOptions;
12821283 faviconUrl?: string;
12831284 timeout?: number;
1285+ requestOptions?: RequestOptions;
12841286 }
12851287
12861288 export type MCPConnectionStatus =
modified core/indexing/ignore.ts +7 −0
@@ -203,6 +203,13 @@
203203 ...ADDITIONAL_INDEXING_IGNORE_DIRS,
204204 ];
205205
206+export const DEFAULT_IGNORES = [
207+ ...DEFAULT_IGNORE_FILETYPES,
208+ ...DEFAULT_IGNORE_DIRS,
209+];
210+
211+export const defaultIgnoresGlob = `!{${DEFAULT_IGNORES.join(",")}}`;
212+
206213 // Create ignore instances
207214 export const defaultSecurityIgnoreFile = ignore().add(
208215 DEFAULT_SECURITY_IGNORE_FILETYPES,
modified core/llm/autodetect.ts +2 −0
@@ -45,6 +45,7 @@
4545
4646 const PROVIDER_HANDLES_TEMPLATING: string[] = [
4747 "lmstudio",
48+ "lemonade",
4849 "openai",
4950 "nvidia",
5051 "ollama",
@@ -67,6 +68,7 @@
6768 const PROVIDER_SUPPORTS_IMAGES: string[] = [
6869 "openai",
6970 "ollama",
71+ "lemonade",
7072 "cohere",
7173 "gemini",
7274 "msty",
modified core/llm/countTokens.ts +1 −1
@@ -85,7 +85,7 @@
8585
8686 function countImageTokens(content: MessagePart): number {
8787 if (content.type === "imageUrl") {
88- return 85;
88+ return 1024;
8989 }
9090 throw new Error("Non-image content type");
9191 }
modified core/llm/index.ts +22 −7
@@ -30,6 +30,7 @@
3030 TemplateType,
3131 Usage,
3232 } from "../index.js";
33+import { isLemonadeInstalled } from "../util/lemonadeHelper.js";
3334 import { Logger } from "../util/Logger.js";
3435 import mergeJson from "../util/merge.js";
3536 import { renderChatMessage } from "../util/messageContent.js";
@@ -503,6 +504,24 @@
503504 : "Unable to connect to local Ollama instance. Ollama may not be installed or may not running.";
504505 throw new Error(message);
505506 }
507+ if (
508+ e.code === "ECONNREFUSED" &&
509+ e.message.includes("http://localhost:8000")
510+ ) {
511+ const isInstalled = await isLemonadeInstalled();
512+ let message: string;
513+ if (process.platform === "linux") {
514+ // On Linux, isLemonadeInstalled checks if it's running (via health endpoint)
515+ message =
516+ "Unable to connect to local Lemonade instance. Please ensure Lemonade is running. Visit http://lemonade-server.ai for setup instructions.";
517+ } else {
518+ // On Windows, we can check if it's installed
519+ message = isInstalled
520+ ? "Unable to connect to local Lemonade instance. Lemonade server may not be running."
521+ : "Unable to connect to local Lemonade instance. Lemonade may not be installed or may not be running.";
522+ }
523+ throw new Error(message);
524+ }
506525 }
507526 throw e;
508527 }
@@ -537,18 +556,14 @@
537556 }
538557
539558 private _formatChatMessage(msg: ChatMessage): string {
540- let contentToShow = "";
541- if (msg.role === "tool") {
542- contentToShow = msg.content;
543- } else if (msg.role === "assistant" && msg.toolCalls?.length) {
544- contentToShow = msg.toolCalls
559+ let contentToShow = renderChatMessage(msg);
560+ if (msg.role === "assistant" && msg.toolCalls?.length) {
561+ contentToShow += msg.toolCalls
545562 ?.map(
546563 (toolCall) =>
547564 `${toolCall.function?.name}(${toolCall.function?.arguments})`,
548565 )
549566 .join("\n");
550- } else if ("content" in msg) {
551- contentToShow = renderChatMessage(msg);
552567 }
553568
554569 return `<${msg.role}>\n${contentToShow}\n\n`;
modified core/llm/llms/Anthropic.ts +31 −6
@@ -68,6 +68,17 @@
6868 return finalOptions;
6969 }
7070
71+ private buildTextPart(text: string, addCaching: boolean) {
72+ const part: any = {
73+ type: "text",
74+ text,
75+ };
76+ if (addCaching) {
77+ part.cache_control = { type: "ephemeral" };
78+ }
79+ return part;
80+ }
81+
7182 private convertMessage(message: ChatMessage, addCaching: boolean): any {
7283 if (message.role === "tool") {
7384 return {
@@ -81,14 +92,30 @@
8192 ],
8293 };
8394 } else if (message.role === "assistant" && message.toolCalls) {
84- return {
85- role: "assistant",
86- content: message.toolCalls.map((toolCall) => ({
95+ const parts: any[] = [];
96+ if (message.content) {
97+ if (typeof message.content === "string") {
98+ parts.push(this.buildTextPart(message.content, addCaching));
99+ } else if (message.content.length > 0) {
100+ const textContent = message.content.filter((p) => p.type === "text");
101+ const textParts = textContent.map((part, idx) => {
102+ const cache = idx === textContent.length - 1 && addCaching;
103+ return this.buildTextPart(part.text, cache);
104+ });
105+ parts.push(...textParts);
106+ }
107+ }
108+ parts.push(
109+ ...message.toolCalls.map((toolCall) => ({
87110 type: "tool_use",
88111 id: toolCall.id,
89112 name: toolCall.function?.name,
90113 input: safeParseToolCallArgs(toolCall),
91114 })),
115+ );
116+ return {
117+ role: "assistant",
118+ content: parts,
92119 };
93120 } else if (message.role === "thinking" && !message.redactedThinking) {
94121 return {
@@ -154,9 +181,7 @@
154181
155182 public convertMessages(msgs: ChatMessage[]): any[] {
156183 // should be public for use within VertexAI
157- const filteredmessages = msgs.filter(
158- (m) => m.role !== "system" && !!m.content,
159- );
184+ const filteredmessages = msgs.filter((m) => m.role !== "system");
160185 const lastTwoUserMsgIndices = filteredmessages
161186 .map((msg, index) => (msg.role === "user" ? index : -1))
162187 .filter((index) => index !== -1)
added core/llm/llms/Lemonade.ts +12 −0
@@ -0,0 +1,12 @@
1+import { LLMOptions } from "../../index.js";
2+
3+import OpenAI from "./OpenAI.js";
4+
5+class Lemonade extends OpenAI {
6+ static providerName = "lemonade";
7+ static defaultOptions: Partial<LLMOptions> = {
8+ apiBase: "http://localhost:8000/api/v1/",
9+ };
10+}
11+
12+export default Lemonade;
modified core/llm/llms/Ollama.ts +5 −0
@@ -269,6 +269,11 @@
269269 return this.modelMap[this.model] ?? this.model;
270270 }
271271
272+ get contextLength() {
273+ const DEFAULT_OLLAMA_CONTEXT_LENGTH = 8192; // twice of https://github.com/ollama/ollama/blob/29ddfc2cab7f5a83a96c3133094f67b22e4f27d1/envconfig/config.go#L185
274+ return this._contextLength ?? DEFAULT_OLLAMA_CONTEXT_LENGTH;
275+ }
276+
272277 private _getModelFileParams(
273278 options: CompletionOptions,
274279 ): OllamaModelFileParams {
modified core/llm/llms/OpenAI.ts +1 −1
@@ -174,7 +174,7 @@
174174 protected _getHeaders() {
175175 return {
176176 "Content-Type": "application/json",
177- Authorization: `Bearer ${this.apiKey}`,
177+ ...(this.apiKey && { Authorization: `Bearer ${this.apiKey}` }),
178178 "api-key": this.apiKey ?? "", // For Azure
179179 };
180180 }
modified core/llm/llms/index.ts +2 −0
@@ -33,6 +33,7 @@
3333 import LlamaCpp from "./LlamaCpp";
3434 import Llamafile from "./Llamafile";
3535 import LlamaStack from "./LlamaStack";
36+import Lemonade from "./Lemonade";
3637 import LMStudio from "./LMStudio";
3738 import Mistral from "./Mistral";
3839 import MockLLM from "./Mock";
@@ -82,6 +83,7 @@
8283 LlamaCpp,
8384 OpenAI,
8485 OVHcloud,
86+ Lemonade,
8587 LMStudio,
8688 Mistral,
8789 Bedrock,
modified core/llm/streamChat.ts +1 −1
@@ -95,7 +95,7 @@
9595 ...init,
9696 signal: abortController.signal,
9797 },
98- config.requestOptions,
98+ model.requestOptions,
9999 ),
100100 completionOptions,
101101 abortController,
modified core/llm/toolSupport.ts +1 −2
@@ -374,9 +374,8 @@
374374 [/o[134]/],
375375 [/deepseek/, /r1|reasoner/],
376376 [/gemini/, /2\.5/, /pro/],
377- [/gpt/, /4/],
378377 [/gpt-5/],
379- [/claude/, /sonnet/, /3\.5|3\.7|3-5|3-7|-4/],
378+ [/claude/, /sonnet/, /3\.7|3-7|-4/],
380379 [/claude/, /opus/, /-4/],
381380 ];
382381 for (const combo of recs) {
modified core/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified core/tools/definitions/createRuleBlock.ts +1 −0
@@ -84,4 +84,5 @@
8484 ["alwaysApply", "false"],
8585 ],
8686 },
87+ toolCallIcon: "PencilIcon",
8788 };
modified core/tools/definitions/fetchUrlContent.ts +1 −0
@@ -30,4 +30,5 @@
3030 prefix: `To fetch the content of a URL, use the ${BuiltInToolNames.FetchUrlContent} tool. For example, to read the contents of a webpage, you might respond with:`,
3131 exampleArgs: [["url", "https://example.com"]],
3232 },
33+ toolCallIcon: "GlobeAltIcon",
3334 };
modified core/tools/definitions/globSearch.ts +2 −1
@@ -13,7 +13,7 @@
1313 function: {
1414 name: BuiltInToolNames.FileGlobSearch,
1515 description:
16- "Search for files recursively in the project using glob patterns. Supports ** for recursive directory search. Output may be truncated; use targeted patterns",
16+ "Search for files recursively in the project using glob patterns. Supports ** for recursive directory search. Will not show many build, cache, secrets dirs/files (can use ls tool instead). Output may be truncated; use targeted patterns",
1717 parameters: {
1818 type: "object",
1919 required: ["pattern"],
@@ -30,4 +30,5 @@
3030 prefix: `To return a list of files based on a glob search pattern, use the ${BuiltInToolNames.FileGlobSearch} tool`,
3131 exampleArgs: [["pattern", "*.py"]],
3232 },
33+ toolCallIcon: "MagnifyingGlassIcon",
3334 };
modified core/tools/definitions/grepSearch.ts +2 −1
@@ -13,7 +13,7 @@
1313 function: {
1414 name: BuiltInToolNames.GrepSearch,
1515 description:
16- "Perform a search over the repository using ripgrep. Output may be truncated, so use targeted queries",
16+ "Perform a 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",
1717 parameters: {
1818 type: "object",
1919 required: ["query"],
@@ -31,4 +31,5 @@
3131 prefix: `To perform a grep search within the project, call the ${BuiltInToolNames.GrepSearch} tool with the query pattern to match. For example:`,
3232 exampleArgs: [["query", ".*main_services.*"]],
3333 },
34+ toolCallIcon: "MagnifyingGlassIcon",
3435 };
modified core/tools/definitions/ls.ts +1 −0
@@ -38,4 +38,5 @@
3838 ["recursive", "false"],
3939 ],
4040 },
41+ toolCallIcon: "FolderIcon",
4142 };
modified core/tools/definitions/readCurrentlyOpenFile.ts +1 −0
@@ -24,4 +24,5 @@
2424 prefix: `To view the user's currently open file, use the ${BuiltInToolNames.ReadCurrentlyOpenFile} tool.
2525 If the user is asking about a file and you don't see any code, use this to check the current file`,
2626 },
27+ toolCallIcon: "DocumentTextIcon",
2728 };
modified core/tools/definitions/readFile.ts +1 −0
@@ -31,4 +31,5 @@
3131 exampleArgs: [["filepath", "path/to/the_file.txt"]],
3232 },
3333 defaultToolPolicy: "allowedWithoutPermission",
34+ toolCallIcon: "DocumentIcon",
3435 };
modified core/tools/definitions/readFileRange.ts +1 −0
@@ -48,4 +48,5 @@
4848 ],
4949 },
5050 defaultToolPolicy: "allowedWithoutPermission",
51+ toolCallIcon: "DocumentIcon",
5152 };
modified core/tools/definitions/searchWeb.ts +1 −0
@@ -30,4 +30,5 @@
3030 prefix: `To search the web, use the ${BuiltInToolNames.SearchWeb} tool with a natural language query. For example, to search for the current weather, you would respond with:`,
3131 exampleArgs: [["query", "What is the current weather in San Francisco?"]],
3232 },
33+ toolCallIcon: "GlobeAltIcon",
3334 };
modified core/tools/definitions/viewDiff.ts +1 −0
@@ -23,4 +23,5 @@
2323 prefix: `To view the current git diff, use the ${BuiltInToolNames.ViewDiff} tool. This will show you the changes made in the working directory compared to the last commit.`,
2424 },
2525 defaultToolPolicy: "allowedWithoutPermission",
26+ toolCallIcon: "CodeBracketIcon",
2627 };
modified core/tools/definitions/viewRepoMap.ts +1 −0
@@ -23,4 +23,5 @@
2323 prefix: `To view the repository map, use the ${BuiltInToolNames.ViewRepoMap} tool. This will provide a visual representation of the project's structure and organization.`,
2424 },
2525 defaultToolPolicy: "allowedWithPermission",
26+ toolCallIcon: "MapIcon",
2627 };
modified core/tools/definitions/viewSubdirectory.ts +1 −0
@@ -30,4 +30,5 @@
3030 exampleArgs: [["directory_path", "path/to/subdirectory"]],
3131 },
3232 defaultToolPolicy: "allowedWithPermission",
33+ toolCallIcon: "FolderOpenIcon",
3334 };
modified core/tools/index.ts +3 −3
@@ -1,10 +1,10 @@
11 import { ConfigDependentToolParams, Tool } from "..";
2+import { isRecommendedAgentModel } from "../llm/toolSupport";
23 import * as toolDefinitions from "./definitions";
34
45 // I'm writing these as functions because we've messed up 3 TIMES by pushing to const, causing duplicate tool definitions on subsequent config loads.
56 export const getBaseToolDefinitions = () => [
67 toolDefinitions.readFileTool,
7-
88 toolDefinitions.createNewFileTool,
99 toolDefinitions.runTerminalCommandTool,
1010 toolDefinitions.globSearchTool,
@@ -13,7 +13,6 @@
1313 toolDefinitions.lsTool,
1414 toolDefinitions.createRuleBlock,
1515 toolDefinitions.fetchUrlContentTool,
16- toolDefinitions.singleFindAndReplaceTool,
1716 ];
1817
1918 export const getConfigDependentToolDefinitions = (
@@ -38,10 +37,11 @@
3837 );
3938 }
4039
41- if (modelName?.includes("claude") || modelName?.includes("gpt-5")) {
40+ if (modelName && isRecommendedAgentModel(modelName)) {
4241 tools.push(toolDefinitions.multiEditTool);
4342 } else {
4443 tools.push(toolDefinitions.editFileTool);
44+ tools.push(toolDefinitions.singleFindAndReplaceTool);
4545 }
4646
4747 // missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269
modified core/util/GlobalContext.ts +6 −25
@@ -44,9 +44,8 @@
4444 isSupportedLanceDbCpuTargetForLinux: boolean;
4545 sharedConfig: SharedConfigSchema;
4646 failedDocs: SiteIndexingConfig[];
47- shownDeprecatedProviderWarnings: {
48- [providerTitle: string]: boolean;
49- };
47+ shownDeprecatedProviderWarnings: { [providerTitle: string]: boolean };
48+ autoUpdateCli: boolean;
5049 mcpOauthStorage: {
5150 [serverUrl: string]: {
5251 clientInformation?: OAuthClientInformationFull;
@@ -66,16 +65,7 @@
6665 ) {
6766 const filepath = getGlobalContextFilePath();
6867 if (!fs.existsSync(filepath)) {
69- fs.writeFileSync(
70- filepath,
71- JSON.stringify(
72- {
73- [key]: value,
74- },
75- null,
76- 2,
77- ),
78- );
68+ fs.writeFileSync(filepath, JSON.stringify({ [key]: value }, null, 2));
7969 } else {
8070 const data = fs.readFileSync(filepath, "utf-8");
8171
@@ -113,10 +103,7 @@
113103 }
114104
115105 // Recreate the file with salvaged values plus the new value
116- const newData = {
117- ...salvaged,
118- [key]: value,
119- };
106+ const newData = { ...salvaged, [key]: value };
120107
121108 fs.writeFileSync(filepath, JSON.stringify(newData, null, 2));
122109 return;
@@ -174,10 +161,7 @@
174161 newValues: Partial<SharedConfigSchema>,
175162 ): SharedConfigSchema {
176163 const currentSharedConfig = this.getSharedConfig();
177- const updatedSharedConfig = {
178- ...currentSharedConfig,
179- ...newValues,
180- };
164+ const updatedSharedConfig = { ...currentSharedConfig, ...newValues };
181165 this.update("sharedConfig", updatedSharedConfig);
182166 return updatedSharedConfig;
183167 }
@@ -189,10 +173,7 @@
189173 ): GlobalContextModelSelections {
190174 const currentSelections = this.get("selectedModelsByProfileId") ?? {};
191175 const forProfile = currentSelections[profileId] ?? {};
192- const newSelections = {
193- ...forProfile,
194- [role]: title,
195- };
176+ const newSelections = { ...forProfile, [role]: title };
196177
197178 this.update("selectedModelsByProfileId", {
198179 ...currentSelections,
added core/util/lemonadeHelper.ts +59 −0
@@ -0,0 +1,59 @@
1+import { exec } from "node:child_process";
2+import { IDE } from "..";
3+
4+export async function isLemonadeInstalled(): Promise<boolean> {
5+ // On Windows, check if lemonade-server command exists
6+ if (process.platform === "win32") {
7+ return new Promise((resolve, _reject) => {
8+ exec("where.exe lemonade-server", (error, _stdout, _stderr) => {
9+ resolve(!error);
10+ });
11+ });
12+ }
13+
14+ // On Linux, check if the health endpoint is accessible
15+ try {
16+ const response = await fetch("http://localhost:8000/api/v1/health", {
17+ method: "GET",
18+ signal: AbortSignal.timeout(3000), // 3 second timeout
19+ });
20+
21+ if (response.ok) {
22+ const data = await response.json();
23+ return data.status === "ok";
24+ }
25+ return false;
26+ } catch {
27+ return false;
28+ }
29+}
30+
31+export async function startLocalLemonade(ide: IDE): Promise<any> {
32+ let startCommand: string | undefined;
33+
34+ switch (process.platform) {
35+ case "linux": // Linux
36+ // On Linux, direct users to start Lemonade manually
37+ return ide.showToast(
38+ "info",
39+ "Please start Lemonade manually. Visit https://lemonade-server.ai for instructions.",
40+ );
41+
42+ case "win32": // Windows
43+ startCommand = "lemonade-server serve\n";
44+ break;
45+
46+ default:
47+ return ide.showToast(
48+ "error",
49+ "Cannot start Lemonade: platform not supported!",
50+ );
51+ }
52+
53+ if (startCommand) {
54+ return ide.runCommand(startCommand, {
55+ reuseTerminal: true,
56+ terminalName: "Start Lemonade",
57+ });
58+ }
59+}
added docs/customize/model-providers/assets/tetrate-get-api-key.png +0 −0

Binary content is not shown. View the file.

modified docs/customize/model-providers/assets/tetrate-remix.png +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

added docs/customize/model-providers/assets/tetrate-sign-in.png +0 −0

Binary content is not shown. View the file.

added docs/customize/model-providers/more/lemonade.mdx +81 −0
@@ -0,0 +1,81 @@
1+---
2+title: "Lemonade Server"
3+description: "Configure Lemonade Server with Continue for refreshingly fast local LLM inference on GPUs and NPUs"
4+---
5+
6+<Info>
7+ Get started with [Lemonade Server](https://lemonade-server.ai/) - Refreshingly fast LLMs on GPUs and NPUs with seamless Continue integration
8+</Info>
9+
10+## Overview
11+
12+Lemonade Server provides optimized local LLM inference with support for GPU and NPU hardware acceleration. It offers an OpenAI-compatible API that seamlessly integrates with Continue and other open-source platforms.
13+
14+## Installation
15+
16+Download and install Lemonade Server from [lemonade-server.ai](https://lemonade-server.ai/).
17+
18+## Configuration
19+
20+Lemonade Server is available directly in the Continue UI as a provider. You can select it from the model provider dropdown without manual configuration.
21+
22+### Option 1: Using the Continue UI (Recommended)
23+
24+1. Click on the model selector dropdown in Continue
25+2. Select "Add Model"
26+3. Choose "Lemonade Server" from the provider list
27+4. Continue will automatically configure the connection
28+
29+### Option 2: Manual Configuration
30+
31+If you need custom settings, you can manually configure Lemonade:
32+
33+<Tabs>
34+ <Tab title="YAML">
35+ ```yaml title="config.yaml"
36+ models:
37+ - name: Lemonade
38+ provider: lemonade
39+ model: <MODEL_NAME>
40+ apiBase: http://localhost:8000/api/v1/
41+ ```
42+ </Tab>
43+ <Tab title="JSON (Deprecated)">
44+ ```json title="config.json"
45+ {
46+ "models": [
47+ {
48+ "title": "Lemonade",
49+ "provider": "lemonade",
50+ "model": "<MODEL_NAME>",
51+ "apiBase": "http://localhost:8000/api/v1/"
52+ }
53+ ]
54+ }
55+ ```
56+ </Tab>
57+</Tabs>
58+
59+## Getting Started
60+
61+1. **Install Lemonade Server**: Download from [lemonade-server.ai](https://lemonade-server.ai/)
62+2. **Start the server**: Launch Lemonade Server (runs on `http://localhost:8000/api/v1/` by default)
63+3. **Add to Continue**: Select Lemonade Server from the model provider dropdown in Continue
64+4. **Load a model**: Choose your preferred model through the interface
65+
66+## Hardware Support
67+
68+Lemonade Server automatically detects and optimizes for available hardware:
69+- **NPU**: Neural Processing Unit acceleration for efficient inference
70+- **GPU**: Full GPU acceleration support
71+- **CPU**: Optimized CPU fallback when accelerators are unavailable
72+
73+## Key Features
74+
75+- OpenAI-compatible API for seamless integration
76+- Support for popular model formats
77+- Automatic hardware detection and optimization
78+- Integration with Continue, Open WebUI, Gaia, and AnythingLLM
79+- Active open-source community
80+
81+[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Lemonade.ts)
No newline at the end of the file
modified docs/customize/model-providers/top-level/tetrate_agent_router_service.mdx +226 −57
@@ -3,81 +3,250 @@
33 sidebarTitle: "Tetrate Agent Router Service"
44 slug: ../tetrate-agent-router-service
55 ---
6-
7-The **Tetrate Agent Router Service** provides a unified Gateway for accessing various AI models with fast inference capabilities as well as embedding services.
6+The **Tetrate Agent Router Service** provides a unified Gateway for accessing various AI models with fast inference capabilities.
87
98 This gateway acts as an intelligent router that can distribute requests across multiple model providers, offering enterprise-grade reliability and performance optimization.
109
11-## Getting Started
10+<Tip>
11+Want to get started quickly? Sign up for the [Tetrate Agent Router Service](https://router.tetrate.ai/) to get an API key, then use [Tetrate on Continue Hub](https://hub.continue.dev/tetrate) to get started fast.
12+</Tip>
1213
13-1. Obtain an API key from the [Agent Router Service portal](https://api.router.tetrate.ai/)
14-2. Configure Continue to use Agent Router Service as your model provider
14+## Setup
1515
16-## Configuring Models
16+<Steps>
17+<Step title="Sign in or sign up">
18+Visit the [Agent Router Service portal](https://router.tetrate.ai/) and create an account to get your API key
19+<img src="../assets/tetrate-sign-in.png" alt="Tetrate sign in page" style={{width: '250px', maxWidth: '100%'}} />
20+</Step>
1721
18-You can also quickly use models from Tetrate on the Cotninue Hub by visiting Tetrate on the Continue Hub [here](https://hub.continue.dev/tetrate). The easiest way if you don't see the model you want to use is to remix one of the models on the Tetrate page and change the model to the one you want to use.
22+<Step title="Get your API key">
23+Go to the [API keys page](https://router.tetrate.ai/api-keys) to get your key
24+<img src="../assets/tetrate-get-api-key.png" alt="Tetrate get API key" style={{width: '250px', maxWidth: '100%'}} />
25+</Step>
1926
20-![Remix a model from Tetrate on Continue Hub](../assets/tetrate-remix.png)
27+<Step title="Configure Continue">
28+- Choose a configuration method below.
29+- If you use the Continue VS Code extension, install version `>=1.2.3`.
30+</Step>
31+
32+</Steps>
2133
22-### Available Models
2334
24-Agent Router Service supports routing to various models.
25-Go to the [Agent Router Service model catalog](https://router.tetrate.ai/models) for a full list of supported models.
35+### Quickstart with Continue Hub
2636
27-## Configuration Options
37+Fastest way: use preconfigured models from Tetrate on Continue Hub
2838
29-As Agent Router Service is an OpenAI API compatible provider, you can configure it like any other OpenAI API compatible provider. Therefore you will be setting `provider: openai` and `apiBase: https://api.router.tetrate.ai/v1`.
39+<Steps>
40+<Step title="Browse models">
41+Open [Tetrate on Continue Hub](https://hub.continue.dev/tetrate) and pick a model (e.g., [Claude Sonnet 4](https://hub.continue.dev/tetrate/claude-sonnet-4))
42+</Step>
3043
31-Update your Continue configuration file (`~/.continue/config.yaml`) with your Agent Router Service API key:
44+<Step title="Use or remix">
45+Click "Use Model", or "Remix" to change the model ID if needed
46+</Step>
3247
33-### On your local machine
48+<Step title="Add your API key">
49+Add your API key to Continue. See [adding secrets in Continue Hub](/hub/secrets/secret-types) and [managing local secrets in the FAQ](/faqs#managing-local-secrets-and-environment-variables)
50+<Tip>
51+Add it as a Continue Hub secret named `TETRATE_API_KEY` to reuse across projects.
52+</Tip>
53+</Step>
54+</Steps>
3455
35-#### In your config.yaml
56+![Remix a model from Tetrate on Continue Hub](../assets/tetrate-remix.png)
3657
37-```yaml title="config.yaml"
58+<Info>
59+If a model is missing, remix a similar one and set the `model` field to the target ID.
60+</Info>
61+
62+### Configuration Methods
63+
64+<CardGroup cols={1}>
65+ <Card title="In Local Agent Configuration" icon="folder" vertical>
66+ Use a Tetrate model block from the Hub or define it directly in your local agent configuration.
67+ </Card>
68+ <Card title="Continue Hub" icon="cloud" vertical>
69+ Use a Tetrate model block from the Hub or define your own on the Hub.
70+ </Card>
71+ <Card title="Using Local Model Blocks" icon="file-lines" vertical>
72+ Create a local model block for reuse across agents without publishing it to the Hub.
73+ </Card>
74+</CardGroup>
75+
76+
77+### Configuration Examples
78+<Info>
79+**Click a tab** to see an example.
80+</Info>
81+<Tabs>
82+<Tab title="In Local Agent Configuration">
83+
84+**When to use**: Simple local setups (like using the VS Code extension) when you don't need shared or published blocks.
85+
86+Use a Tetrate model block from the Hub in your local agent configuration:
87+
88+```yaml title="~/.continue/config.yaml"
89+name: Local Agent
90+version: 1.0.0
91+schema: v1
3892 models:
39- - name: <MODEL_NAME>
40- provider: openai
41- model: <MODEL_ID>
42- apiKey: <TETRATE_API_KEY>
43- apiBase: https://api.router.tetrate.ai/v1
93+ - uses: tetrate/claude-sonnet-4
94+ with:
95+ TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }}
96+context:
97+ - provider: code
98+ - provider: docs
99+ - provider: diff
100+ - provider: terminal
101+ - provider: problems
102+ - provider: folder
103+ - provider: codebase
44104 ```
45105
46-#### As a local model block
47-
48-Review the configuration reference for [model blocks](/reference#models) and using [local blocks](/reference#local-blocks). Ensure you look at the roles and capabilities section and review the [model capabilities guide](/customize/deep-dives/model-capabilities).
49-
50-```yaml title="model_name.yaml"
51- name: <MODEL_NAME>
52- models:
53- - name: <MODEL_NAME>
54- provider: openai
55- model: <MODEL_ID>
56- apiKey: ${{ inputs.TETRATE_API_KEY }}
57- apiBase: https://api.router.tetrate.ai/v1
58- roles:
59- - chat
60- - edit
61- - apply
62- capabilities:
63- - tool_use
106+Or define the model directly:
107+
108+```yaml title="~/.continue/config.yaml"
109+name: Local Agent
110+version: 1.0.0
111+schema: v1
112+models:
113+ - name: Claude Sonnet 4
114+ provider: tars
115+ model: claude-4-sonnet-20250514
116+ apiKey: ${{ secrets.TETRATE_API_KEY }}
117+ roles:
118+ - chat
119+ - edit
120+ - apply
121+ capabilities:
122+ - tool_use
123+context:
124+ - provider: code
125+ - provider: docs
126+ - provider: diff
127+ - provider: terminal
128+ - provider: problems
129+ - provider: folder
130+ - provider: codebase
131+```
132+</Tab>
133+<Tab title="Continue Hub">
134+**When to use**: Share configurations across teams or contribute to the community.
135+
136+**The Model Block:**
137+
138+```yaml title="tetrate/claude-sonnet-4"
139+name: Claude Sonnet 4
140+version: 1.0.14
141+schema: v1
142+models:
143+ - name: Claude Sonnet 4 - Tetrate
144+ provider: tars
145+ model: claude-4-sonnet-20250514
146+ apiKey: ${{ inputs.TETRATE_API_KEY }}
147+ roles:
148+ - chat
149+ - edit
150+ - apply
151+ capabilities:
152+ - tool_use
64153 ```
154+View the model block `tetrate/claude-sonnet-4` on the [Continue Hub](https://hub.continue.dev/tetrate/claude-sonnet-4).
65155
66-### On Model Block on Continue Hub
67-Learn how to use model blocks on Continue Hub [here](/hub/blocks/create-a-block).
68-
69-```yaml title="model_name.yaml"
70- name: <MODEL_NAME>
71- models:
72- - name: <MODEL_NAME>
73- provider: openai
74- model: <MODEL_ID>
75- apiKey: ${{ inputs.TETRATE_API_KEY }}
76- apiBase: https://api.router.tetrate.ai/v1
77- roles:
78- - chat
79- - edit
80- - apply
81- capabilities:
82- - tool_use
156+**Reference it in your Agent configuration:**
157+
158+```yaml title="my-agent"
159+name: My Agent
160+version: 1.0.0
161+schema: v1
162+models:
163+ - uses: tetrate/claude-sonnet-4
164+ with:
165+ TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }}
166+context:
167+ - uses: continuedev/diff-context
168+ - uses: continuedev/terminal-context
169+ - uses: continuedev/file-context
170+```
171+<Tip>
172+To customize, see the [model block creation guide](/hub/blocks/create-a-block).
173+</Tip>
174+
175+</Tab>
176+
177+<Tab title="Using Local Model Blocks">
178+**When to use**: Reuse configurations across agents and keep them local or in GitHub (not on Continue Hub).
179+
180+**The Local Model Block:**
181+<Info>
182+Name the file `my-claude-4-model.yaml` so you can reference it in the Agent.
183+</Info>
184+
185+```yaml title="~/.continue/models/my-claude-4-model.yaml"
186+name: Claude Sonnet 4
187+version: 1.0.1
188+schema: v1
189+models:
190+ - name: Claude Sonnet 4
191+ provider: tars
192+ model: claude-4-sonnet-20250514
193+ apiKey: ${{ inputs.TETRATE_API_KEY }}
194+ roles:
195+ - chat
196+ - edit
197+ - apply
198+ capabilities:
199+ - tool_use
200+```
201+Reference it as `my-claude-4-model` in your Agent configuration:
202+
203+```yaml title="~/.continue/agents/simple-agent.yaml"
204+name: Simple Agent
205+version: 1.0.0
206+schema: v1
207+models:
208+ - uses: my-claude-4-model
209+ with:
210+ TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }}
211+context:
212+ - uses: continuedev/diff-context
213+ - uses: continuedev/terminal-context
214+ - uses: continuedev/file-context
83215 ```
216+
217+<Tip>
218+Learn more about [model blocks](/reference#models) and [local blocks](/reference#local-blocks).
219+</Tip>
220+
221+</Tab>
222+</Tabs>
223+
224+---
225+
226+## Troubleshooting Common Issues
227+
228+<CardGroup cols={2}>
229+ <Card title="Invalid API key" icon="key" vertical>
230+ Verify your API key is active and has no extra spaces.
231+ </Card>
232+ <Card title="Model not found" icon="ban" href="https://router.tetrate.ai/models" vertical>
233+ Confirm the model ID matches the Tetrate catalog.
234+ </Card>
235+ <Card title="Slow responses" icon="code" vertical>
236+ Check your network or try a less-loaded model. Contact Tetrate support if issues persist.
237+ </Card>
238+ <Card title="Configuration not loading" icon="file-lines" vertical>
239+ Validate YAML syntax and review error messages in Continue. If using Hub, ensure the block is published.
240+ </Card>
241+</CardGroup>
242+
243+---
244+
245+## Join the Community
246+Connect with Tetrate and other builders for help and discussion.
247+
248+<CardGroup cols={1}>
249+ <Card title="Join the Tetrate Community" icon="slack" href="https://join.slack.com/t/tetrate-agent-router/shared_invite/zt-399tv7hjm-6YMXztGywTOQrMIolvEBNg">
250+Get answers, insights, and best practices for secure, scalable infrastructure
251+ </Card>
252+</CardGroup>
modified docs/docs.json +1 −4
@@ -233,6 +233,7 @@
233233 "guides/codebase-documentation-awareness",
234234 "guides/cli",
235235 "guides/continuous-ai",
236+ "guides/posthog-github-continuous-ai",
236237 "guides/continuous-ai-readiness-assessment",
237238 "guides/plan-mode-guide",
238239 "guides/ollama-guide",
@@ -354,10 +355,6 @@
354355 "source": "/hub/blocks",
355356 "destination": "/hub/blocks/intro"
356357 },
357- {
358- "source": "/hub/agents/intro",
359- "destination": "/hub/agents/intro"
360- },
361358 {
362359 "source": "/customize",
363360 "destination": "/customization/overview"
modified docs/guides/overview.mdx +1 −0
@@ -14,6 +14,7 @@
1414 - [Continuous AI: A Developer's Guide](/guides/continuous-ai) - Integrating AI into development workflows
1515 - [How to Use Continue CLI (cn)](/guides/cli) - Command-line interface for Continue
1616 - [Continuous AI Readiness Assessment](/guides/continuous-ai-readiness-assessment) - Evaluate team readiness for Continuous AI adoption
17+- [PostHog Session Analysis with Continue CLI](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation
1718
1819 ## What Advanced Tutorials Are Available
1920
added docs/guides/posthog-github-continuous-ai.mdx +496 −0
@@ -0,0 +1,496 @@
1+---
2+title: "Building a Continuous AI Workflow with PostHog and GitHub"
3+description: "Build an automated system that continuously monitors PostHog session recordings, analyzes UX issues using Continue CLI, and creates GitHub issues automatically."
4+sidebarTitle: "PostHog Session Analysis with Continue CLI"
5+---
6+
7+<Card title="What You'll Build" icon="robot">
8+ A fully automated workflow that uses Continue CLI to fetch PostHog session
9+ data, analyze user experience issues with AI, and automatically create GitHub
10+ issues with specific technical recommendations
11+</Card>
12+
13+## Prerequisites
14+
15+Before starting, ensure you have:
16+
17+- GitHub repository where you want to create issues
18+- PostHog account with **[session recordings enabled and collecting data](https://posthog.com/docs/session-replay/installation)**
19+- Node.js 18+ installed locally
20+- Continue CLI account with **active credits** (required for API usage)
21+
22+<Steps>
23+ <Step title="Install Continue CLI">
24+ ```bash
25+ npm i -g @continuedev/cli
26+ ```
27+ </Step>
28+
29+ <Step title="Set up Continue CLI Account & API Key">
30+ 1. Visit [Continue Organizations](https://hub.continue.dev/settings/organizations)
31+ 2. Sign up or log in to your Continue account
32+ 3. Navigate to your organization settings
33+ 4. Click **"API Keys"** and then **"+ New API Key"**
34+ 5. Copy the API key immediately (you won't see it again!)
35+ 6. Login to the CLI: `cn login`
36+ </Step>
37+
38+ <Step title="Add Required Secrets to Continue CLI">
39+ Continue CLI will securely store your API keys as secrets that can be referenced in prompts.
40+ </Step>
41+</Steps>
42+
43+<Tip>
44+ Continue CLI handles all the complex API interactions - you just need to
45+ provide the right prompts!
46+</Tip>
47+
48+## Step 1: Set Up Your Credentials
49+
50+First, you'll need to gather your API credentials and add them as secrets in Continue CLI.
51+
52+### Get Your PostHog API Credentials
53+
54+You need a **Personal API Key** (not a Project API key) to access session recordings:
55+
56+1. Go to [Personal API Keys](https://app.posthog.com/settings/user-api-keys) in PostHog
57+2. Click **+ Create a personal API Key**
58+3. Name it "Continue CLI Session Analysis"
59+4. Select these scopes:
60+ - `session_recording:read` - **Required** for accessing session data
61+ - `insight:read` - Optional, for additional analytics
62+5. Copy the key immediately (you won't see it again!)
63+
64+<Tip>
65+ **Find Your Project Details**: Your Project ID is in your PostHog URL:
66+ `https://app.posthog.com/project/YOUR_PROJECT_ID`
67+</Tip>
68+
69+### Get Your GitHub Personal Access Token
70+
71+1. Go to [GitHub Personal Access Tokens](https://github.com/settings/personal-access-tokens/new)
72+2. Click **"Generate new token (classic)"**
73+3. Name it "Continue CLI PostHog Analysis"
74+4. Select these scopes:
75+ - `repo` (or just `public_repo` if your repository is public)
76+ - `issues:write` - **Required** for creating issues
77+5. Copy the token immediately
78+
79+### Add Secrets to Continue CLI
80+
81+Use Continue CLI's built-in environment setup helper:
82+
83+```bash
84+cn -p "Help me set up my environment for PostHog session analysis. Please:
85+1. Check if I have the required secrets configured in Continue CLI:
86+ - POSTHOG_API_KEY
87+ - POSTHOG_PROJECT_ID
88+ - POSTHOG_HOST
89+ - GITHUB_PAT
90+2. If any are missing, guide me through:
91+ - How to get PostHog Personal API Key from PostHog settings
92+ - How to find my PostHog Project ID from the URL
93+ - How to create a GitHub Personal Access Token with issues:write permission
94+ - How to add these as secrets in Continue CLI
95+3. Help me identify my GitHub repository owner and name by:
96+ - Checking git remote origin URL
97+ - Or asking me to provide them
98+4. Test the API connections by making a simple API call to both PostHog and GitHub to verify the credentials work.
99+Please walk me through this setup process step by step."
100+```
101+
102+<Info>
103+ Continue CLI will guide you through adding secrets and testing your API
104+ connections. Follow the prompts to add: - `POSTHOG_API_KEY`: Your PostHog
105+ Personal API Key - `POSTHOG_PROJECT_ID`: Your PostHog Project ID -
106+ `POSTHOG_HOST`: `https://us.posthog.com` (or your custom PostHog host) -
107+ `GITHUB_PAT`: Your GitHub Personal Access Token
108+</Info>
109+
110+## Step 2: Analyze PostHog Sessions with Continue CLI
111+
112+Now you'll use Continue CLI to fetch PostHog session data and analyze it for UX issues. Continue CLI handles all the API calls and analysis automatically.
113+
114+### Run the Analysis
115+
116+Use this prompt with Continue CLI to fetch and analyze your PostHog sessions:
117+
118+```bash
119+cn -p "I need you to help me analyze PostHog session recordings to identify UX issues. Please:
120+
121+1. First, fetch session recordings from PostHog using these details:
122+ - Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from my secrets
123+ - API endpoint: {POSTHOG_HOST}/api/projects/{POSTHOG_PROJECT_ID}/session_recordings/?limit=20
124+ - Include Authorization header: 'Bearer {POSTHOG_API_KEY}'
125+
126+2. Filter the sessions to find problematic ones with either:
127+ - console_error_count > 0 (JavaScript errors)
128+ - recording_duration > 300 (sessions longer than 5 minutes)
129+
130+3. Analyze the filtered sessions and create exactly 3 GitHub issues for the most critical UX problems.
131+
132+4. Format each issue like this:
133+### 1. **Issue Title Here**
134+**Problem**: One sentence describing the user problem
135+**Technical Causes**: Brief technical explanation
136+**Affected Pages**: List the URLs
137+**Recommended Fix**:
138+- Specific action item 1
139+- Specific action item 2
140+**Priority**: **HIGH** or **MEDIUM** or **LOW**
141+**Impact**: Quantify the impact (e.g., 'Affects 80% of sessions')
142+
143+Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data."
144+```
145+
146+<Info>
147+ **What Continue CLI Does:** - Makes authenticated API calls to PostHog using
148+ your stored secrets - Fetches and filters session recordings automatically -
149+ Analyzes patterns in the data using AI - Generates structured issue
150+ descriptions ready for GitHub
151+</Info>
152+
153+<Tip>
154+ Save the analysis output to a file by adding `> analysis-results.txt` to the
155+ command if you want to review it later.
156+</Tip>
157+
158+## Step 3: Create GitHub Issues Automatically
159+
160+Now use Continue CLI to create GitHub issues from your analysis results:
161+
162+```bash
163+cn -p "I have analyzed PostHog session data and identified UX issues. Now I need you to create GitHub issues using the GitHub API.
164+
165+Use these details from my secrets:
166+- GITHUB_PAT: My GitHub Personal Access Token
167+- Repository: Extract from git remote or ask me to specify
168+
169+For each issue in my analysis:
170+1. Parse the issue title, body content, and priority level
171+2. Create a GitHub issue via API POST to: https://api.github.com/repos/{owner}/{repo}/issues
172+3. Use these headers:
173+ - Authorization: token {GITHUB_PAT}
174+ - Accept: application/vnd.github.v3+json
175+ - Content-Type: application/json
176+4. Set labels based on priority:
177+ - HIGH: [\"bug\", \"high-priority\", \"user-experience\", \"automated\"]
178+ - MEDIUM: [\"enhancement\", \"medium-priority\", \"user-experience\", \"automated\"]
179+ - LOW: [\"low-priority\", \"user-experience\", \"automated\"]
180+5. Format the issue title as: \"🔍 UX Issue: {original title}\"
181+
182+Please create the GitHub issues and confirm they were successfully created with issue numbers and URLs.
183+"
184+```
185+
186+<Warning>
187+**Repository Labels Required**: Make sure your GitHub repository has these labels:
188+- `bug`, `enhancement`
189+- `high-priority`, `medium-priority`, `low-priority`
190+- `user-experience`, `automated`
191+
192+Create missing labels in your repo at: **Settings → Labels → New label**
193+
194+</Warning>
195+
196+<Info>
197+ **What Continue CLI Does:** - Parses your analysis results automatically -
198+ Makes authenticated GitHub API calls using your stored token - Creates
199+ properly formatted issues with appropriate labels - Checks for duplicate
200+ issues to avoid spam - Provides confirmation with issue URLs
201+</Info>
202+
203+## Step 4: Set Up Automated GitHub Actions Workflow
204+
205+Create a GitHub Actions workflow that runs your Continue CLI analysis automatically on a schedule.
206+
207+### Add GitHub Secrets
208+
209+First, add these secrets to your GitHub repository:
210+
211+1. Go to **Repository Settings → Secrets and variables → Actions**
212+2. Click **"New repository secret"** and add:
213+ - `CONTINUE_API_KEY`: Your Continue API key from hub.continue.dev
214+ - `POSTHOG_API_KEY`: Your PostHog Personal API Key
215+ - `POSTHOG_PROJECT_ID`: Your PostHog Project ID
216+ - `POSTHOG_HOST`: `https://us.posthog.com` (or your custom PostHog host)
217+ - `GITHUB_PAT`: Your GitHub Personal Access Token
218+
219+### Create GitHub Actions Workflow
220+
221+Create `.github/workflows/posthog-analysis.yml` in your repository:
222+
223+```yaml
224+name: PostHog Session Analysis with Continue CLI
225+
226+on:
227+ schedule:
228+ - cron: "0 6 * * *" # Run at 6 AM UTC daily
229+ workflow_dispatch: # Allow manual triggering
230+
231+jobs:
232+ analyze:
233+ runs-on: ubuntu-latest
234+
235+ permissions:
236+ contents: read
237+ issues: write
238+
239+ steps:
240+ - uses: actions/checkout@v4
241+
242+ - name: Set up Node.js
243+ uses: actions/setup-node@v4
244+ with:
245+ node-version: "18"
246+
247+ - name: Install Continue CLI
248+ run: |
249+ npm install -g @continuedev/cli
250+ echo "✅ Continue CLI installed"
251+ cn --version
252+
253+ - name: Set up environment variables
254+ run: |
255+ echo "POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> $GITHUB_ENV
256+ echo "POSTHOG_PROJECT_ID=${{ secrets.POSTHOG_PROJECT_ID }}" >> $GITHUB_ENV
257+ echo "POSTHOG_HOST=${{ secrets.POSTHOG_HOST || 'https://us.posthog.com' }}" >> $GITHUB_ENV
258+ echo "GITHUB_PAT=${{ secrets.GITHUB_PAT }}" >> $GITHUB_ENV
259+ echo "GITHUB_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
260+ echo "GITHUB_REPO=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV
261+
262+ - name: Authenticate with Continue CLI
263+ run: |
264+ # Set Continue API key
265+ export CONTINUE_API_KEY="${{ secrets.CONTINUE_API_KEY }}"
266+ # Login to Continue CLI
267+ if ! cn auth login --api-key "$CONTINUE_API_KEY"; then
268+ echo "❌ Failed to authenticate with Continue CLI"
269+ exit 1
270+ fi
271+ echo "✅ Continue CLI authenticated"
272+
273+ - name: Run PostHog Session Analysis
274+ run: |
275+ echo "🎬 Starting PostHog session analysis..."
276+ # Create the analysis prompt
277+ cat > analysis_prompt.txt << 'EOF'
278+ I need you to help me analyze PostHog session recordings to identify UX issues. Please:
279+
280+ 1. First, fetch session recordings from PostHog using these details:
281+ - Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from environment variables
282+ - API endpoint: $POSTHOG_HOST/api/projects/$POSTHOG_PROJECT_ID/session_recordings/?limit=20
283+ - Include Authorization header: "Bearer $POSTHOG_API_KEY"
284+
285+ 2. Filter the sessions to find problematic ones with either:
286+ - console_error_count > 0 (JavaScript errors)
287+ - recording_duration > 300 (sessions longer than 5 minutes)
288+
289+ 3. Analyze the filtered sessions and create exactly 3 GitHub issues for the most critical UX problems.
290+
291+ 4. Format each issue like this:
292+ ### 1. **Issue Title Here**
293+ **Problem**: One sentence describing the user problem
294+ **Technical Causes**: Brief technical explanation
295+ **Affected Pages**: List the URLs
296+ **Recommended Fix**:
297+ - Specific action item 1
298+ - Specific action item 2
299+ **Priority**: **HIGH** or **MEDIUM** or **LOW**
300+ **Impact**: Quantify the impact (e.g., 'Affects 80% of sessions')
301+
302+ Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data.
303+
304+ Environment context:
305+ - POSTHOG_API_KEY: $POSTHOG_API_KEY
306+ - POSTHOG_PROJECT_ID: $POSTHOG_PROJECT_ID
307+ - POSTHOG_HOST: $POSTHOG_HOST
308+ - GitHub Repo: $GITHUB_OWNER/$GITHUB_REPO
309+ EOF
310+
311+ # Run the analysis
312+ cn < analysis_prompt.txt > analysis-results.txt 2>&1
313+
314+ # Check if analysis completed
315+ if [ ! -s analysis-results.txt ]; then
316+ echo "❌ Analysis failed or produced no output"
317+ exit 1
318+ fi
319+
320+ echo "✅ Analysis completed"
321+ echo "📄 Analysis results preview:"
322+ head -20 analysis-results.txt
323+
324+ - name: Create GitHub Issues from Analysis
325+ run: |
326+ echo "📝 Creating GitHub issues from analysis..."
327+ # Create the issue creation prompt
328+ cat > issue_prompt.txt << 'EOF'
329+ I have analyzed PostHog session data and identified UX issues. Now I need you to create GitHub issues using the GitHub API.
330+
331+ Use these details from environment variables:
332+ - GITHUB_PAT: My GitHub Personal Access Token
333+ - Repository: $GITHUB_OWNER/$GITHUB_REPO
334+
335+ For each issue in my analysis:
336+ 1. Parse the issue title, body content, and priority level
337+ 2. Create a GitHub issue via API POST to: https://api.github.com/repos/$GITHUB_OWNER/$GITHUB_REPO/issues
338+ 3. Use these headers:
339+ - Authorization: token $GITHUB_PAT
340+ - Accept: application/vnd.github.v3+json
341+ - Content-Type: application/json
342+ 4. Set labels based on priority:
343+ - HIGH: ["bug", "high-priority", "user-experience", "automated"]
344+ - MEDIUM: ["enhancement", "medium-priority", "user-experience", "automated"]
345+ - LOW: ["low-priority", "user-experience", "automated"]
346+ 5. Format the issue title as: "🔍 UX Issue: {original title}"
347+
348+ Please create the GitHub issues and confirm they were successfully created with issue numbers and URLs.
349+
350+ Here's my analysis to process:
351+ EOF
352+
353+ # Append the analysis results to the prompt
354+ cat analysis-results.txt >> issue_prompt.txt
355+
356+ # Run the issue creation
357+ cn < issue_prompt.txt > issue-creation-results.txt 2>&1
358+
359+ echo "✅ Issue creation completed"
360+ echo "📄 Issue creation results:"
361+ cat issue-creation-results.txt
362+
363+ - name: Upload Analysis Artifacts
364+ uses: actions/upload-artifact@v4
365+ if: always()
366+ with:
367+ name: analysis-results-${{ github.run_number }}
368+ path: |
369+ analysis-results.txt
370+ issue-creation-results.txt
371+ retention-days: 30
372+
373+ - name: Summary
374+ run: |
375+ echo "✅ PostHog analysis workflow completed!"
376+ echo "📊 Check the artifacts for detailed analysis results"
377+ echo "🐛 Check your repository issues for newly created UX issues"
378+```
379+
380+## Step 5: Testing Your Workflow
381+
382+### Test Locally First
383+
384+Before setting up automation, test the workflow locally:
385+
386+**Test 1: Session Analysis**
387+
388+```bash
389+cn -p "[Paste the PostHog analysis prompt from Step 2]"
390+```
391+
392+Expected: Analysis output with 3 formatted GitHub issues
393+
394+**Test 2: Issue Creation**
395+
396+```bash
397+cn -p "[Paste the GitHub issue creation prompt from Step 3 with your analysis results]"
398+```
399+
400+Expected: Confirmation of GitHub issues created with URLs
401+
402+### Test the GitHub Actions Workflow
403+
404+1. **Manual Trigger**: Go to **Actions** tab in your repository and manually trigger the workflow
405+2. **Check Artifacts**: Download the analysis results from the workflow run
406+3. **Verify Issues**: Check that GitHub issues were created in your repository
407+
408+<Check>
409+ **Success Indicators:** - PostHog API returns session data (not empty) -
410+ Continue CLI generates analysis with identified issues - GitHub issues are
411+ created with proper labels and formatting - Workflow completes without errors
412+</Check>
413+
414+## Troubleshooting
415+
416+If you encounter issues, use this helpful prompt to diagnose problems:
417+
418+```bash
419+cn -p "Help me set up my environment for PostHog session analysis. Please:
420+
421+1. Check if I have the required secrets configured in Continue CLI:
422+ - POSTHOG_API_KEY
423+ - POSTHOG_PROJECT_ID
424+ - POSTHOG_HOST
425+ - GITHUB_PAT
426+
427+2. If any are missing, guide me through:
428+ - How to get PostHog Personal API Key from PostHog settings
429+ - How to find my PostHog Project ID from the URL
430+ - How to create a GitHub Personal Access Token with issues:write permission
431+ - How to add these as secrets in Continue CLI
432+
433+3. Help me identify my GitHub repository owner and name by:
434+ - Checking git remote origin URL
435+ - Or asking me to provide them
436+
437+4. Test the API connections by making a simple API call to both PostHog and GitHub to verify the credentials work.
438+
439+Please walk me through this setup process step by step."
440+```
441+
442+## What You've Built
443+
444+After completing this guide, you have a complete **Continuous AI system** that:
445+
446+✅ **Monitors user experience** - Automatically fetches and analyzes PostHog session data
447+✅ **Identifies problems intelligently** - Uses AI to spot patterns and technical issues
448+✅ **Creates actionable tasks** - Generates GitHub issues with specific recommendations
449+✅ **Runs autonomously** - Operates daily without manual intervention using GitHub Actions
450+✅ **Scales with your team** - Handles growing amounts of session data automatically
451+
452+<Card title="Continuous AI" icon="rocket">
453+ Your system now operates at **[Level 2 Continuous
454+ AI](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)** -
455+ AI handles routine analysis tasks with human oversight through GitHub issue
456+ review and prioritization.
457+</Card>
458+
459+## Security Best Practices
460+
461+<Warning>
462+ **Protect Your API Keys:** - Store all credentials as GitHub Secrets, never in
463+ code - Use Continue CLI's secure secret storage - Limit token scopes to
464+ minimum required permissions - Rotate API keys regularly (every 90 days
465+ recommended) - Monitor token usage for unusual activity
466+</Warning>
467+
468+## Advanced Prompts
469+
470+Consider enhancing your workflow with these advanced Continue CLI prompts:
471+
472+<CardGroup cols={2}>
473+ <Card title="Performance Analysis" icon="chart-line">
474+ "Analyze PostHog performance metrics alongside session recordings to
475+ identify slow page loads affecting user experience"
476+ </Card>
477+ <Card title="Error Correlation" icon="bug">
478+ "Cross-reference JavaScript console errors with user actions to identify the
479+ root cause of UX issues"
480+ </Card>
481+ <Card title="Feature Flag Analysis" icon="flag">
482+ "Analyze how PostHog feature flags impact user behavior in session
483+ recordings"
484+ </Card>
485+ <Card title="Custom Slack Alerts" icon="slack">
486+ "Create Slack alerts when critical UX issues are detected in PostHog
487+ sessions"
488+ </Card>
489+</CardGroup>
490+
491+## Next Steps
492+
493+1. **Monitor your first issues** - Review the GitHub issues created and implement fixes
494+2. **Measure impact** - Track how resolved issues improve PostHog metrics
495+3. **Refine prompts** - Adjust the Continue CLI prompts based on issue quality
496+4. **Scale the system** - Add more data sources or create specialized analysis workflows
modified docs/reference.mdx +1 −0
@@ -403,6 +403,7 @@
403403 - `env`: An optional map of environment variables for the server process.
404404 - `cwd`: An optional working directory to run the command in. Can be absolute or relative path.
405405 - `connectionTimeout`: An optional connection timeout number to the server in milliseconds.
406+- `requestOptions`: Optional request options for `sse` and `streamable-http` servers. Same format as [model requestOptions](#models).
406407
407408 **Example:**
408409
modified extensions/cli/package.json +1 −1
@@ -37,7 +37,7 @@
3737 "license": "Apache-2.0",
3838 "repository": {
3939 "type": "git",
40- "url": "https://github.com/continuedev/cli.git"
40+ "url": "https://github.com/continuedev/continue.git"
4141 },
4242 "bugs": {
4343 "url": "https://github.com/continuedev/continue/issues"
modified extensions/cli/src/commands/commands.ts +5 −0
@@ -40,6 +40,11 @@
4040 description: "Sign out of your current session",
4141 category: "system",
4242 },
43+ {
44+ name: "update",
45+ description: "Update the Continue CLI",
46+ category: "system",
47+ },
4348 {
4449 name: "whoami",
4550 description: "Check who you're currently logged in as",
modified extensions/cli/src/infoScreen.ts +0 −3
@@ -9,13 +9,10 @@
99 } from "./auth/workos.js";
1010 import { services } from "./services/index.js";
1111 import { getCurrentSession, getSessionFilePath } from "./session.js";
12-import { posthogService } from "./telemetry/posthogService.js";
1312 import { logger } from "./util/logger.js";
1413 import { getVersion } from "./version.js";
1514
1615 export async function handleInfoSlashCommand() {
17- posthogService.capture("useSlashCommand", { name: "info" });
18-
1916 const infoLines = [];
2017
2118 // Version and working directory info
added extensions/cli/src/services/UpdateService.ts +241 −0
@@ -0,0 +1,241 @@
1+import { exec, spawn } from "child_process";
2+import { promisify } from "util";
3+
4+import { GlobalContext } from "core/util/GlobalContext.js";
5+
6+import { logger } from "src/util/logger.js";
7+
8+import { compareVersions, getLatestVersion, getVersion } from "../version.js";
9+
10+import { BaseService } from "./BaseService.js";
11+import { serviceContainer } from "./ServiceContainer.js";
12+import { UpdateServiceState, UpdateStatus } from "./types.js";
13+const execAsync = promisify(exec);
14+
15+/**
16+ * Service for checking and performing CLI updates
17+ */
18+export class UpdateService extends BaseService<UpdateServiceState> {
19+ constructor() {
20+ super("update", {
21+ autoUpdate: true,
22+ isAutoUpdate: true,
23+ status: UpdateStatus.IDLE,
24+ message: "",
25+ error: null,
26+ isUpdateAvailable: false,
27+ latestVersion: null,
28+ currentVersion: getVersion(),
29+ });
30+ }
31+
32+ /**
33+ * Initialize the update service
34+ */
35+ async doInitialize(headless?: boolean) {
36+ // Don't automatically check in tests/headless
37+ if (!headless && process.env.NODE_ENV !== "test") {
38+ void this.checkAndAutoUpdate();
39+ }
40+
41+ return this.currentState;
42+ }
43+
44+ private async checkAndAutoUpdate() {
45+ // First get auto update setting from global context
46+ const globalContext = new GlobalContext();
47+ const autoUpdate = globalContext.get("autoUpdateCli") ?? true;
48+ this.setState({
49+ autoUpdate,
50+ });
51+
52+ try {
53+ // Check for updates
54+ this.setState({
55+ status: UpdateStatus.CHECKING,
56+ message: "Checking for updates",
57+ });
58+
59+ const latestVersion = await getLatestVersion();
60+ this.setState({
61+ latestVersion,
62+ });
63+
64+ if (!latestVersion) {
65+ this.setState({
66+ status: UpdateStatus.IDLE,
67+ message: "Continue CLI",
68+ isUpdateAvailable: false,
69+ });
70+ return;
71+ }
72+
73+ const comparison = compareVersions(
74+ this.currentState.currentVersion,
75+ latestVersion,
76+ );
77+ const isUpdateAvailable = comparison === "older";
78+ this.setState({
79+ isUpdateAvailable,
80+ });
81+
82+ if (this.currentState.currentVersion === "0.0.0-dev") {
83+ this.setState({
84+ status: UpdateStatus.IDLE,
85+ message: `Continue CLI`,
86+ isUpdateAvailable,
87+ latestVersion,
88+ });
89+ return; // Uncomment to test auto-update behavior in dev
90+ }
91+
92+ // If update is available, automatically update
93+ if (
94+ autoUpdate &&
95+ isUpdateAvailable &&
96+ this.currentState.status !== "updating" &&
97+ !process.env.CONTINUE_CLI_AUTO_UPDATED //Already auto updated, preventing sequential auto-update
98+ ) {
99+ await this.performUpdate(true);
100+ } else {
101+ this.setState({
102+ status: UpdateStatus.IDLE,
103+ message: isUpdateAvailable
104+ ? `Update available: v${latestVersion}`
105+ : `Continue CLI v${this.currentState.currentVersion}`,
106+ isUpdateAvailable,
107+ latestVersion,
108+ });
109+ }
110+ } catch (error: any) {
111+ logger.error("Error checking for updates:", error);
112+ this.setState({
113+ status: UpdateStatus.ERROR,
114+ message: `Continue CLI v${this.currentState.currentVersion}`,
115+ error,
116+ });
117+ }
118+ }
119+
120+ public async setAutoUpdate(value: boolean) {
121+ const globalContext = new GlobalContext();
122+ globalContext.update("autoUpdateCli", value);
123+ this.setState({
124+ autoUpdate: value,
125+ });
126+ }
127+
128+ // TODO this is a hack because our service state update code is broken
129+ // Currently all things that need update use serviceContainer.set manually
130+ // Rather than actually using the stateChanged event
131+ setState(newState: Partial<UpdateServiceState>): void {
132+ super.setState(newState);
133+ serviceContainer.set("update", this.currentState);
134+ }
135+
136+ async performUpdate(isAutoUpdate?: boolean) {
137+ if (this.currentState.status === "updating") {
138+ return;
139+ }
140+
141+ try {
142+ this.setState({
143+ isAutoUpdate,
144+ status: UpdateStatus.UPDATING,
145+ message: `${isAutoUpdate ? "Auto-updating" : "Updating"} to v${this.currentState.latestVersion}`,
146+ });
147+
148+ // Install the update
149+ const { stdout, stderr } = await execAsync("npm i -g @continuedev/cli");
150+ logger.debug("Update output:", { stdout, stderr });
151+
152+ if (stderr) {
153+ const errLines = stderr.split("\n");
154+ for (const line of errLines) {
155+ const lower = line.toLowerCase().trim();
156+ if (
157+ !line ||
158+ lower.includes("debugger") ||
159+ lower.includes("npm warn")
160+ ) {
161+ continue;
162+ }
163+ this.setState({
164+ status: UpdateStatus.ERROR,
165+ message: `Error updating to v${this.currentState.latestVersion}`,
166+ error: new Error(stderr),
167+ });
168+ return;
169+ }
170+ }
171+
172+ this.setState({
173+ status: UpdateStatus.UPDATED,
174+ message: `${isAutoUpdate ? "Auto-updated to" : "Restart for"} v${this.currentState.latestVersion}`,
175+ isUpdateAvailable: false,
176+ });
177+ if (isAutoUpdate) {
178+ this.restartCLI();
179+ }
180+ } catch (error: any) {
181+ logger.error("Error updating CLI:", error);
182+ this.setState({
183+ status: UpdateStatus.ERROR,
184+ message: isAutoUpdate ? "Auto-update failed" : "Update failed",
185+ error,
186+ });
187+ setTimeout(() => {
188+ this.setState({
189+ status: UpdateStatus.IDLE,
190+ message: `/update to v${this.currentState.latestVersion}`,
191+ });
192+ }, 4000);
193+ }
194+ }
195+
196+ private restartCLI(): void {
197+ try {
198+ const entryPoint = process.argv[1];
199+ const cliArgs = process.argv.slice(2);
200+ const nodeExecutable = process.execPath;
201+
202+ logger.debug(
203+ `Preparing for CLI restart with: ${nodeExecutable} ${entryPoint} ${cliArgs.join(
204+ " ",
205+ )}`,
206+ );
207+
208+ // Halt/clean up parent cn process
209+ try {
210+ // Remove all input listeners
211+ global.clearTimeout = () => {};
212+ global.clearInterval = () => {};
213+ process.stdin.removeAllListeners();
214+ process.stdin.pause();
215+ // console.clear(); // Don't want to clear things that were in console before cn started
216+ } catch (e) {
217+ logger.debug("Error cleaning up terminal:", e);
218+ }
219+
220+ // Spawn a new detached cn process
221+ const child = spawn(nodeExecutable, [entryPoint, ...cliArgs], {
222+ detached: true,
223+ stdio: "inherit",
224+ env: {
225+ ...process.env,
226+ CONTINUE_CLI_AUTO_UPDATED: "true",
227+ },
228+ });
229+
230+ // I did not find a way on existing to avoid a bug where next process has input glitches without leaving parent in place
231+ // So instead of existing, parent will exit when child exits
232+ // process.exit(0);
233+ child.on("exit", (code) => {
234+ process.exit(code);
235+ });
236+ child.unref();
237+ } catch (error) {
238+ logger.error("Failed to restart CLI:", error);
239+ }
240+ }
241+}
modified extensions/cli/src/services/index.ts +12 −11
@@ -21,6 +21,7 @@
2121 ServiceInitOptions,
2222 ServiceInitResult,
2323 } from "./types.js";
24+import { UpdateService } from "./UpdateService.js";
2425
2526 // Service instances
2627 const authService = new AuthService();
@@ -31,6 +32,7 @@
3132 const fileIndexService = new FileIndexService();
3233 const resourceMonitoringService = new ResourceMonitoringService();
3334 const chatHistoryService = new ChatHistoryService();
35+const updateService = new UpdateService();
3436
3537 /**
3638 * Initialize all services and register them with the service container
@@ -132,6 +134,12 @@
132134 [], // No dependencies
133135 );
134136
137+ serviceContainer.register(
138+ SERVICE_NAMES.UPDATE,
139+ () => updateService.initialize(),
140+ [], // No dependencies
141+ );
142+
135143 serviceContainer.register(
136144 SERVICE_NAMES.API_CLIENT,
137145 async () => {
@@ -283,17 +291,9 @@
283291 * Check if all core services are ready
284292 */
285293 export function areServicesReady(): boolean {
286- return [
287- SERVICE_NAMES.TOOL_PERMISSIONS,
288- SERVICE_NAMES.AUTH,
289- SERVICE_NAMES.API_CLIENT,
290- SERVICE_NAMES.CONFIG,
291- SERVICE_NAMES.MODEL,
292- SERVICE_NAMES.MCP,
293- SERVICE_NAMES.FILE_INDEX,
294- SERVICE_NAMES.RESOURCE_MONITORING,
295- SERVICE_NAMES.CHAT_HISTORY,
296- ].every((name) => serviceContainer.isReady(name));
294+ return Object.values(SERVICE_NAMES).every((name) =>
295+ serviceContainer.isReady(name),
296+ );
297297 }
298298
299299 /**
@@ -317,6 +317,7 @@
317317 resourceMonitoring: resourceMonitoringService,
318318 systemMessage: systemMessageService,
319319 chatHistory: chatHistoryService,
320+ updateService: updateService,
320321 } as const;
321322
322323 // Export the service container for advanced usage
modified extensions/cli/src/services/types.ts +21 −1
@@ -81,6 +81,25 @@
8181 prompts: MCPPrompt[];
8282 }
8383
84+export enum UpdateStatus {
85+ IDLE = "idle",
86+ CHECKING = "checking",
87+ UPDATING = "updating",
88+ UPDATED = "updated",
89+ ERROR = "error",
90+}
91+
92+export interface UpdateServiceState {
93+ autoUpdate: boolean;
94+ isAutoUpdate: boolean;
95+ status: UpdateStatus;
96+ message: string;
97+ error?: Error | null;
98+ isUpdateAvailable: boolean;
99+ latestVersion: string | null;
100+ currentVersion: string;
101+}
102+
84103 export interface ApiClientServiceState {
85104 apiClient: DefaultApiInterface | null;
86105 }
@@ -92,8 +111,8 @@
92111 originalPolicies?: ToolPermissions;
93112 }
94113
95-export type { FileIndexServiceState } from "./FileIndexService.js";
96114 export type { ChatHistoryState } from "./ChatHistoryService.js";
115+export type { FileIndexServiceState } from "./FileIndexService.js";
97116
98117 /**
99118 * Service names as constants to prevent typos
@@ -109,6 +128,7 @@
109128 RESOURCE_MONITORING: "resourceMonitoring",
110129 SYSTEM_MESSAGE: "systemMessage",
111130 CHAT_HISTORY: "chatHistory",
131+ UPDATE: "update",
112132 } as const;
113133
114134 /**
modified extensions/cli/src/slashCommands.ts +4 −26
@@ -48,12 +48,10 @@
4848 ` Type ${chalk.cyan("/")} to see available slash commands`,
4949 ` Type ${chalk.cyan("!")} followed by a command to execute bash directly`,
5050 ].join("\n");
51- posthogService.capture("useSlashCommand", { name: "help" });
5251 return { output: helpMessage };
5352 }
5453
5554 async function handleLogin() {
56- posthogService.capture("useSlashCommand", { name: "login" });
5755 try {
5856 const newAuthState = await services.auth.login();
5957 await reloadService(SERVICE_NAMES.AUTH);
@@ -79,7 +77,6 @@
7977 }
8078
8179 async function handleLogout() {
82- posthogService.capture("useSlashCommand", { name: "logout" });
8380 try {
8481 await services.auth.logout();
8582 return {
@@ -95,7 +92,6 @@
9592 }
9693
9794 function handleWhoami() {
98- posthogService.capture("useSlashCommand", { name: "whoami" });
9995 if (isAuthenticated()) {
10096 const config = loadAuthConfig();
10197 if (config && isAuthenticatedConfig(config)) {
@@ -118,8 +114,6 @@
118114 }
119115
120116 async function handleFork() {
121- posthogService.capture("useSlashCommand", { name: "fork" });
122-
123117 try {
124118 const currentSession = getCurrentSession();
125119 const forkCommand = `cn --fork ${currentSession.sessionId}`;
@@ -148,15 +142,12 @@
148142 const commandHandlers: Record<string, CommandHandler> = {
149143 help: handleHelp,
150144 clear: () => {
151- posthogService.capture("useSlashCommand", { name: "clear" });
152145 return { clear: true, output: "Chat history cleared" };
153146 },
154147 exit: () => {
155- posthogService.capture("useSlashCommand", { name: "exit" });
156148 return { exit: true, output: "Goodbye!" };
157149 },
158150 config: () => {
159- posthogService.capture("useSlashCommand", { name: "config" });
160151 return { openConfigSelector: true };
161152 },
162153 login: handleLogin,
@@ -165,38 +156,25 @@
165156 info: handleInfoSlashCommand,
166157 model: () => ({ openModelSelector: true }),
167158 compact: () => {
168- posthogService.capture("useSlashCommand", { name: "compact" });
169159 return { compact: true };
170160 },
171161 mcp: () => {
172- posthogService.capture("useSlashCommand", { name: "mcp" });
173162 return { openMcpSelector: true };
174163 },
175164 resume: () => {
176- posthogService.capture("useSlashCommand", { name: "resume" });
177165 return { openSessionSelector: true };
178166 },
179167 fork: handleFork,
180- init: (args, assistant) => {
181- posthogService.capture("useSlashCommand", { name: "init" });
182- return handleInit(args, assistant);
168+ init: handleInit,
169+ update: () => {
170+ return { openUpdateSelector: true };
183171 },
184172 };
185173
186174 export async function handleSlashCommands(
187175 input: string,
188176 assistant: AssistantConfig,
189-): Promise<{
190- output?: string;
191- exit?: boolean;
192- newInput?: string;
193- clear?: boolean;
194- openConfigSelector?: boolean;
195- openModelSelector?: boolean;
196- openMCPSelector?: boolean;
197- openSessionSelector?: boolean;
198- compact?: boolean;
199-} | null> {
177+): Promise<SlashCommandResult | null> {
200178 // Only trigger slash commands if slash is the very first character
201179 if (!input.startsWith("/") || !input.trim().startsWith("/")) {
202180 return null;
modified extensions/cli/src/stream/streamChatResponse.ts +15 −0
@@ -16,9 +16,11 @@
1616 import { ToolCall } from "../tools/index.js";
1717 import {
1818 chatCompletionStreamWithBackoff,
19+ isContextLengthError,
1920 withExponentialBackoff,
2021 } from "../util/exponentialBackoff.js";
2122 import { logger } from "../util/logger.js";
23+import { validateContextLength } from "../util/tokenizer.js";
2224
2325 import { getAllTools, handleToolCalls } from "./handleToolCalls.js";
2426 import { handleAutoCompaction } from "./streamChatResponse.autoCompaction.js";
@@ -148,6 +150,12 @@
148150 tools,
149151 } = options;
150152
153+ // Validate context length before making the request
154+ const validation = validateContextLength(chatHistory, model);
155+ if (!validation.isValid) {
156+ throw new Error(`Context length validation failed: ${validation.error}`);
157+ }
158+
151159 // Get fresh system message and inject it
152160 const systemMessage = await systemMessageService.getSystemMessage();
153161 const openaiChatHistory = convertFromUnifiedHistoryWithSystemMessage(
@@ -277,6 +285,13 @@
277285 shouldContinue: false,
278286 };
279287 }
288+
289+ // Handle context length errors with helpful message
290+ if (isContextLengthError(error)) {
291+ logger.debug(`Context length exceeded: ${error}`);
292+ throw new Error(`Context length exceeded: ${error}`);
293+ }
294+
280295 throw error;
281296 }
282297
modified extensions/cli/src/tools/index.tsx +48 −2
@@ -6,8 +6,10 @@
66 serviceContainer,
77 } from "../services/index.js";
88 import type { ToolPermissionServiceState } from "../services/ToolPermissionService.js";
9+import type { ModelServiceState } from "../services/types.js";
910 import { telemetryService } from "../telemetry/telemetryService.js";
1011 import { logger } from "../util/logger.js";
12+import { isModelCapable } from "../utils/index.js";
1113
1214 import { editTool } from "./edit.js";
1315 import { exitTool } from "./exit.js";
@@ -66,9 +68,53 @@
6668 return dynamicTools;
6769 }
6870
69-// Get all builtin tools including dynamic ones
71+// Check if the current model is capable and should exclude Edit tool
72+function shouldExcludeEditTool(): boolean {
73+ try {
74+ const modelServiceResult = getServiceSync<ModelServiceState>(
75+ SERVICE_NAMES.MODEL,
76+ );
77+
78+ if (
79+ modelServiceResult.state === "ready" &&
80+ modelServiceResult.value?.model
81+ ) {
82+ const { name, provider, model } = modelServiceResult.value.model;
83+
84+ // Check if model is capable
85+ const isCapable = isModelCapable(provider, name, model);
86+
87+ logger.debug("Capability-based tool filtering", {
88+ provider,
89+ name,
90+ isCapable,
91+ willExcludeEdit: isCapable,
92+ });
93+
94+ return isCapable;
95+ }
96+ } catch (error) {
97+ logger.debug("Error checking model capability for tool filtering", {
98+ error,
99+ });
100+ }
101+ return false;
102+}
103+
104+// Get all builtin tools including dynamic ones, with capability-based filtering
70105 export function getAllBuiltinTools(): Tool[] {
71- return [...BUILTIN_TOOLS, ...getDynamicTools()];
106+ let builtinTools = [...BUILTIN_TOOLS];
107+
108+ // Apply capability-based filtering for edit tools
109+ // If model is capable, exclude editTool in favor of multiEditTool
110+ if (shouldExcludeEditTool()) {
111+ builtinTools = builtinTools.filter((tool) => tool.name !== editTool.name);
112+ logger.debug(
113+ "Excluded Edit tool for capable model - MultiEdit will be used instead",
114+ );
115+ }
116+
117+ return [...builtinTools, ...getDynamicTools()];
72118 }
73119
74120 export function getToolDisplayName(toolName: string): string {
modified extensions/cli/src/tools/multiEdit.ts +2 −3
@@ -9,7 +9,6 @@
99 getLanguageFromFilePath,
1010 } from "../telemetry/utils.js";
1111
12-import { editTool } from "./edit.js";
1312 import { readFilesSet, readFileTool } from "./readFile.js";
1413 import { Tool } from "./types.js";
1514 import { generateDiff } from "./writeFile.js";
@@ -133,8 +132,8 @@
133132 displayName: "MultiEdit",
134133 readonly: false,
135134 isBuiltIn: true,
136- description: `This is a tool for making multiple edits to a single file in one operation. It is built on top of the ${editTool.name} tool and allows you to perform multiple find-and-replace operations efficiently.
137-Prefer this tool over the ${editTool.name} tool when you need to make multiple edits to the same file.
135+ description: `This is a tool for making multiple edits to a single file in one operation. It allows you to perform multiple find-and-replace operations efficiently.
136+This tool is ideal when you need to make multiple edits to the same file.
138137
139138 To make multiple edits to a file, provide the following:
140139 1. file_path: The absolute path to the file to modify (must be absolute, not relative)
added extensions/cli/src/ui/LoadingText.tsx +33 −0
@@ -0,0 +1,33 @@
1+import { Text } from "ink";
2+import React, { useEffect, useState } from "react";
3+
4+interface LoadingTextProps {
5+ text: string;
6+ color?: string;
7+ interval?: number;
8+}
9+
10+export const LoadingText: React.FC<LoadingTextProps> = ({
11+ text,
12+ color = "gray",
13+ interval = 300,
14+}) => {
15+ const [dotsCount, setDotsCount] = useState(1);
16+
17+ useEffect(() => {
18+ const timer = setInterval(() => {
19+ setDotsCount((current) => (current % 3) + 1);
20+ }, interval);
21+
22+ return () => clearInterval(timer);
23+ }, [interval]);
24+
25+ const dots = ".".repeat(dotsCount);
26+
27+ return (
28+ <Text color={color}>
29+ {text}
30+ {dots}
31+ </Text>
32+ );
33+};
modified extensions/cli/src/ui/TUIChat.tsx +4 −1
@@ -14,6 +14,7 @@
1414 ConfigServiceState,
1515 MCPServiceState,
1616 ModelServiceState,
17+ UpdateServiceState,
1718 } from "../services/types.js";
1819 import { logger } from "../util/logger.js";
1920
@@ -93,7 +94,8 @@
9394 model: ModelServiceState;
9495 mcp: MCPServiceState;
9596 apiClient: ApiClientServiceState;
96- }>(["auth", "config", "model", "mcp", "apiClient"]);
97+ update: UpdateServiceState;
98+ }>(["auth", "config", "model", "mcp", "apiClient", "update"]);
9799
98100 return { services, allServicesReady, isRemoteMode };
99101 }
@@ -207,6 +209,7 @@
207209 onShowConfigSelector: () => navigateTo("config"),
208210 onShowModelSelector: () => navigateTo("model"),
209211 onShowMCPSelector: () => navigateTo("mcp"),
212+ onShowUpdateSelector: () => navigateTo("update"),
210213 onShowSessionSelector: () => navigateTo("session"),
211214 onLoginPrompt: handleLoginPrompt,
212215 onReload: handleReload,
modified extensions/cli/src/ui/UpdateNotification.test.tsx +173 −71
@@ -1,10 +1,3 @@
1-// Mock the version module before any other imports
2-vi.mock("../version.js", () => ({
3- getVersion: vi.fn(),
4- getLatestVersion: vi.fn(),
5- compareVersions: vi.fn(),
6-}));
7-
81 // Mock useTerminalSize hook
92 vi.mock("./hooks/useTerminalSize.js", () => ({
103 useTerminalSize: () => ({ columns: 80, rows: 24 }),
@@ -30,93 +23,202 @@
3023 import React from "react";
3124 import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3225
33-import * as versionModule from "../version.js";
26+import { UpdateStatus } from "../services/types.js";
3427
3528 import { UpdateNotification } from "./UpdateNotification.js";
3629
37-const mockVersionModule = vi.mocked(versionModule);
30+// Mock useServices hook
31+const mockUseServices = vi.fn();
32+vi.mock("../hooks/useService.js", () => ({
33+ useServices: () => mockUseServices(),
34+}));
3835
3936 describe("UpdateNotification", () => {
40- let originalNodeEnv: string | undefined;
41-
4237 beforeEach(() => {
4338 vi.clearAllMocks();
44- originalNodeEnv = process.env.NODE_ENV;
45- // Default mock implementations
46- mockVersionModule.getLatestVersion.mockResolvedValue("1.0.1");
47- mockVersionModule.compareVersions.mockReturnValue("older");
39+ // Default mock implementation - no update available
40+ mockUseServices.mockReturnValue({
41+ services: {
42+ update: {
43+ autoUpdate: true,
44+ status: UpdateStatus.IDLE,
45+ message: "Continue CLI v1.0.0",
46+ error: null,
47+ isUpdateAvailable: false,
48+ latestVersion: null,
49+ currentVersion: "1.0.0",
50+ },
51+ },
52+ });
4853 });
4954
5055 afterEach(() => {
51- // Restore original NODE_ENV
52- if (originalNodeEnv === undefined) {
53- delete process.env.NODE_ENV;
54- } else {
55- process.env.NODE_ENV = originalNodeEnv;
56- }
56+ vi.clearAllMocks();
5757 });
5858
59- it("should not check for updates when version ends with -dev", async () => {
60- // Set NODE_ENV to non-test value to enable update checks
61- process.env.NODE_ENV = "development";
62- mockVersionModule.getVersion.mockReturnValue("1.0.0-dev");
63-
64- render(<UpdateNotification />);
59+ it("should show default message when no update is available", () => {
60+ const { lastFrame } = render(<UpdateNotification />);
6561
66- // Wait a bit to ensure useEffect has run
67- await new Promise((resolve) => setTimeout(resolve, 50));
68-
69- // getLatestVersion should not have been called for dev versions
70- expect(mockVersionModule.getLatestVersion).not.toHaveBeenCalled();
62+ expect(lastFrame()).toContain("◉ Continue CLI v1.0.0");
7163 });
7264
73- it("should check for updates when version does not end with -dev", async () => {
74- // Set NODE_ENV to non-test value to enable update checks
75- process.env.NODE_ENV = "development";
76- mockVersionModule.getVersion.mockReturnValue("1.0.0");
77-
78- render(<UpdateNotification />);
79-
80- // Wait a bit to ensure useEffect has run
81- await new Promise((resolve) => setTimeout(resolve, 50));
82-
83- // getLatestVersion should have been called for non-dev versions
84- expect(mockVersionModule.getLatestVersion).toHaveBeenCalled();
65+ it("should show update available message when update is available", () => {
66+ mockUseServices.mockReturnValue({
67+ services: {
68+ update: {
69+ autoUpdate: true,
70+ status: UpdateStatus.IDLE,
71+ message: "Update available: v1.0.1",
72+ error: null,
73+ isUpdateAvailable: true,
74+ latestVersion: "1.0.1",
75+ currentVersion: "1.0.0",
76+ },
77+ },
78+ });
79+
80+ const { lastFrame } = render(<UpdateNotification />);
81+
82+ expect(lastFrame()).toContain("◉ Update available: v1.0.1");
8583 });
8684
87- it("should handle various dev version formats", async () => {
88- // Set NODE_ENV to non-test value to enable update checks
89- process.env.NODE_ENV = "development";
90- const devVersions = ["1.0.0-dev", "2.1.3-dev", "0.5.0-dev"];
91-
92- for (const version of devVersions) {
93- vi.clearAllMocks();
94- mockVersionModule.getVersion.mockReturnValue(version);
95-
96- render(<UpdateNotification />);
97-
98- // Wait a bit to ensure useEffect has run
99- await new Promise((resolve) => setTimeout(resolve, 50));
85+ it("should show checking message when checking for updates", () => {
86+ mockUseServices.mockReturnValue({
87+ services: {
88+ update: {
89+ autoUpdate: true,
90+ status: UpdateStatus.CHECKING,
91+ message: "Checking for updates",
92+ error: null,
93+ isUpdateAvailable: false,
94+ latestVersion: null,
95+ currentVersion: "1.0.0",
96+ },
97+ },
98+ });
99+
100+ const { lastFrame } = render(<UpdateNotification />);
101+
102+ expect(lastFrame()).toContain("◉ Checking for updates");
103+ });
100104
101- expect(mockVersionModule.getLatestVersion).not.toHaveBeenCalled();
102- }
105+ it("should show updating message when updating", () => {
106+ mockUseServices.mockReturnValue({
107+ services: {
108+ update: {
109+ autoUpdate: true,
110+ status: UpdateStatus.UPDATING,
111+ message: "Updating to v1.0.1",
112+ error: null,
113+ isUpdateAvailable: false,
114+ latestVersion: "1.0.1",
115+ currentVersion: "1.0.0",
116+ },
117+ },
118+ });
119+
120+ const { lastFrame } = render(<UpdateNotification />);
121+
122+ expect(lastFrame()).toContain("◉ Updating to v1.0.1");
103123 });
104124
105- it("should still check for updates with other version suffixes", async () => {
106- // Set NODE_ENV to non-test value to enable update checks
107- process.env.NODE_ENV = "development";
108- const nonDevVersions = ["1.0.0-beta", "1.0.0-alpha", "1.0.0-rc1"];
125+ it("should show updated message when update completes", () => {
126+ mockUseServices.mockReturnValue({
127+ services: {
128+ update: {
129+ autoUpdate: true,
130+ status: UpdateStatus.UPDATED,
131+ message: "Auto-updated to v1.0.1",
132+ error: null,
133+ isUpdateAvailable: false,
134+ latestVersion: "1.0.1",
135+ currentVersion: "1.0.0",
136+ },
137+ },
138+ });
139+
140+ const { lastFrame } = render(<UpdateNotification />);
141+
142+ expect(lastFrame()).toContain("◉ Auto-updated to v1.0.1");
143+ });
109144
110- for (const version of nonDevVersions) {
111- vi.clearAllMocks();
112- mockVersionModule.getVersion.mockReturnValue(version);
145+ it("should show error message when update fails", () => {
146+ mockUseServices.mockReturnValue({
147+ services: {
148+ update: {
149+ autoUpdate: true,
150+ status: UpdateStatus.ERROR,
151+ message: "Update failed",
152+ error: new Error("Update error"),
153+ isUpdateAvailable: true,
154+ latestVersion: "1.0.1",
155+ currentVersion: "1.0.0",
156+ },
157+ },
158+ });
159+
160+ const { lastFrame } = render(<UpdateNotification />);
161+
162+ expect(lastFrame()).toContain("◉ Update failed");
163+ });
113164
114- render(<UpdateNotification />);
165+ it("should show remote mode when in remote mode and no update available", () => {
166+ mockUseServices.mockReturnValue({
167+ services: {
168+ update: {
169+ autoUpdate: true,
170+ status: UpdateStatus.IDLE,
171+ message: "Continue CLI v1.0.0",
172+ error: null,
173+ isUpdateAvailable: false,
174+ latestVersion: null,
175+ currentVersion: "1.0.0",
176+ },
177+ },
178+ });
179+
180+ const { lastFrame } = render(<UpdateNotification isRemoteMode={true} />);
181+
182+ expect(lastFrame()).toContain("◉ Remote Mode");
183+ });
115184
116- // Wait a bit to ensure useEffect has run
117- await new Promise((resolve) => setTimeout(resolve, 50));
185+ it("should show update message even in remote mode when update is available", () => {
186+ mockUseServices.mockReturnValue({
187+ services: {
188+ update: {
189+ autoUpdate: true,
190+ status: UpdateStatus.IDLE,
191+ message: "Update available: v1.0.1",
192+ error: null,
193+ isUpdateAvailable: true,
194+ latestVersion: "1.0.1",
195+ currentVersion: "1.0.0",
196+ },
197+ },
198+ });
199+
200+ const { lastFrame } = render(<UpdateNotification isRemoteMode={true} />);
201+
202+ expect(lastFrame()).toContain("◉ Update available: v1.0.1");
203+ });
118204
119- expect(mockVersionModule.getLatestVersion).toHaveBeenCalled();
120- }
205+ it("should show default message when update service has no message", () => {
206+ mockUseServices.mockReturnValue({
207+ services: {
208+ update: {
209+ autoUpdate: true,
210+ status: UpdateStatus.IDLE,
211+ message: "",
212+ error: null,
213+ isUpdateAvailable: false,
214+ latestVersion: null,
215+ currentVersion: "1.0.0",
216+ },
217+ },
218+ });
219+
220+ const { lastFrame } = render(<UpdateNotification />);
221+
222+ expect(lastFrame()).toContain("◉ Continue CLI");
121223 });
122224 });
modified extensions/cli/src/ui/UpdateNotification.tsx +32 −57
@@ -1,79 +1,54 @@
11 import { Text } from "ink";
2-import React, { useEffect, useMemo, useState } from "react";
3-
4-import { compareVersions, getLatestVersion, getVersion } from "../version.js";
2+import React, { useMemo } from "react";
3+
4+import { useServices } from "../hooks/useService.js";
5+import {
6+ SERVICE_NAMES,
7+ UpdateServiceState,
8+ UpdateStatus,
9+} from "../services/types.js";
510
611 import { useTerminalSize } from "./hooks/useTerminalSize.js";
712
813 interface UpdateNotificationProps {
914 isRemoteMode?: boolean;
1015 }
11-
1216 const UpdateNotification: React.FC<UpdateNotificationProps> = ({
1317 isRemoteMode = false,
1418 }) => {
15- const [updateAvailable, setUpdateAvailable] = useState(false);
16- const [latestVersion, setLatestVersion] = useState<string>("");
17- const [currentVersion] = useState(getVersion());
1819 const { columns } = useTerminalSize();
1920
20- useEffect(() => {
21- // Skip update check in test environment
22- if (process.env.NODE_ENV === "test") {
23- return;
21+ const { services } = useServices<{
22+ update: UpdateServiceState;
23+ }>([SERVICE_NAMES.UPDATE]);
24+
25+ const color = useMemo(() => {
26+ switch (services.update?.status) {
27+ case UpdateStatus.UPDATING:
28+ case UpdateStatus.CHECKING:
29+ return "yellow";
30+ case UpdateStatus.UPDATED:
31+ return "green";
32+ case UpdateStatus.ERROR:
33+ return "red";
34+ default:
35+ return "dim";
2436 }
37+ }, [services.update?.status]);
2538
26- // Skip update check for development versions
27- if (currentVersion.endsWith("-dev")) {
28- return;
39+ const text = useMemo(() => {
40+ if (!services.update?.message) {
41+ return "Continue CLI";
2942 }
3043
31- const abortController = new AbortController();
32-
33- const checkForUpdate = async () => {
34- try {
35- const latest = await getLatestVersion(abortController.signal);
36- if (latest) {
37- setLatestVersion(latest);
38- const comparison = compareVersions(currentVersion, latest);
39- setUpdateAvailable(comparison === "older");
40- }
41- } catch (error) {
42- // Silently fail - we don't want to interrupt the user experience
43- if (error instanceof Error && error.name !== "AbortError") {
44- console.debug("Failed to check for updates:", error);
45- }
46- }
47- };
48-
49- // Check for updates but don't block
50- checkForUpdate();
51-
52- // Cleanup function to abort the request when component unmounts
53- return () => {
54- abortController.abort();
55- };
56- }, [currentVersion]);
44+ return services.update.message;
45+ }, [columns, services.update?.message]);
5746
58- const text = useMemo(() => {
59- if (columns < 75) {
60- return `v${latestVersion} available`;
61- }
62- return `Update available: v${latestVersion} (npm i -g @continuedev/cli)`;
63- }, [columns, latestVersion]);
64-
65- if (!updateAvailable) {
66- if (isRemoteMode) {
67- return <Text color="cyan">◉ Remote Mode</Text>;
68- }
69- return (
70- <Text wrap="truncate-end" color="gray">
71- ● Continue CLI
72- </Text>
73- );
47+ if (!services.update?.isUpdateAvailable && isRemoteMode) {
48+ return <Text color="cyan">◉ Remote Mode</Text>;
7449 }
7550
76- return <Text color="dim">{text}</Text>;
51+ return <Text color={color}>{`◉ ${text}`}</Text>;
7752 };
7853
7954 export { UpdateNotification };
added extensions/cli/src/ui/UpdateSelector.tsx +93 −0
@@ -0,0 +1,93 @@
1+import React, { useMemo, useState } from "react";
2+
3+import { useService } from "../hooks/useService.js";
4+import { services } from "../services/index.js";
5+import type { UpdateServiceState } from "../services/types.js";
6+import { SERVICE_NAMES } from "../services/types.js";
7+
8+import { Selector, SelectorOption } from "./Selector.js";
9+
10+interface UpdateSelectorProps {
11+ onCancel: () => void;
12+}
13+
14+interface UpdateOption extends SelectorOption {
15+ action: "run" | "toggle-auto" | "back";
16+}
17+
18+export const UpdateSelector: React.FC<UpdateSelectorProps> = ({ onCancel }) => {
19+ const [selectedIndex, setSelectedIndex] = useState(0);
20+ const updateServiceState = useService<UpdateServiceState>(
21+ SERVICE_NAMES.UPDATE,
22+ );
23+
24+ const updateState = updateServiceState.value;
25+
26+ const isWorking =
27+ updateServiceState.state === "loading" ||
28+ updateState?.status === "checking" ||
29+ updateState?.status === "updating";
30+
31+ const error: string | null = useMemo(() => {
32+ if (updateServiceState.state === "error") {
33+ return updateServiceState.error?.message || "Update service error";
34+ }
35+ if (updateState?.status === "error") {
36+ return updateState.message || "Update failed";
37+ }
38+ return null;
39+ }, [updateServiceState.state, updateServiceState.error, updateState]);
40+
41+ const loadingMessage = useMemo(() => {
42+ if (!updateState) return "Preparing update...";
43+ return updateState.message || "Working...";
44+ }, [updateState]);
45+
46+ const options: UpdateOption[] = useMemo(() => {
47+ const runLabel = updateState?.latestVersion
48+ ? `Run update to v${updateState.latestVersion}`
49+ : "Run update";
50+
51+ const autoUpdateLabel = updateState?.autoUpdate
52+ ? "Turn off auto-updates"
53+ : "Turn on auto-updates";
54+
55+ return [
56+ { id: "run-update", name: runLabel, action: "run" },
57+ { id: "toggle-auto", name: autoUpdateLabel, action: "toggle-auto" },
58+ { id: "back", name: "Back", action: "back" },
59+ ];
60+ }, [updateState?.latestVersion, updateState?.autoUpdate]);
61+
62+ const handleSelect = async (option: UpdateOption) => {
63+ switch (option.action) {
64+ case "run":
65+ // Perform a manual update (not auto-update)
66+ await services.updateService.performUpdate(false);
67+ return; // Keep selector open to show status changes
68+ case "toggle-auto":
69+ // Toggle auto-update setting
70+ const newValue = !updateState?.autoUpdate;
71+ await services.updateService.setAutoUpdate(newValue);
72+ return; // Keep selector open to show updated label
73+ case "back":
74+ onCancel();
75+ return;
76+ }
77+ };
78+
79+ return (
80+ <Selector
81+ title="Update Continue CLI"
82+ options={options}
83+ selectedIndex={selectedIndex}
84+ loading={!!isWorking}
85+ error={error}
86+ loadingMessage={loadingMessage}
87+ currentId={null}
88+ onSelect={handleSelect}
89+ onCancel={onCancel}
90+ onNavigate={setSelectedIndex}
91+ />
92+ );
93+};
modified extensions/cli/src/ui/components/ScreenContent.tsx +19 −0
@@ -1,6 +1,8 @@
11 import { Box, Text } from "ink";
22 import React from "react";
33
4+import { UpdateServiceState } from "src/services/types.js";
5+
46 import { listSessions } from "../../session.js";
57 import { ConfigSelector } from "../ConfigSelector.js";
68 import type { NavigationScreen } from "../context/NavigationContext.js";
@@ -9,6 +11,7 @@
911 import { ModelSelector } from "../ModelSelector.js";
1012 import { SessionSelector } from "../SessionSelector.js";
1113 import type { ConfigOption, ModelOption } from "../types/selectorTypes.js";
14+import { UpdateSelector } from "../UpdateSelector.js";
1215 import { UserInput } from "../UserInput.js";
1316
1417 import { ToolPermissionSelector } from "./ToolPermissionSelector.js";
@@ -42,6 +45,14 @@
4245 onImageInClipboardChange?: (hasImage: boolean) => void;
4346 }
4447
48+function hideScreenContent(state?: UpdateServiceState) {
49+ return (
50+ (state?.status === "checking" && state?.autoUpdate) ||
51+ (state?.isAutoUpdate &&
52+ (state?.status === "updating" || state?.status === "updated"))
53+ );
54+}
55+
4556 export const ScreenContent: React.FC<ScreenContentProps> = ({
4657 isScreenActive,
4758 navState,
@@ -65,6 +76,10 @@
6576 isRemoteMode,
6677 onImageInClipboardChange,
6778 }) => {
79+ if (hideScreenContent(services.update)) {
80+ return null;
81+ }
82+
6883 // Login prompt
6984 if (isScreenActive("login") && navState.screenData) {
7085 return (
@@ -106,6 +121,10 @@
106121 return <MCPSelector onCancel={closeCurrentScreen} />;
107122 }
108123
124+ if (isScreenActive("update")) {
125+ return <UpdateSelector onCancel={closeCurrentScreen} />;
126+ }
127+
109128 // Model selector
110129 if (isScreenActive("model")) {
111130 return (
modified extensions/cli/src/ui/context/NavigationContext.tsx +3 −2
@@ -1,9 +1,9 @@
11 import React, {
22 createContext,
3+ ReactNode,
4+ useCallback,
35 useContext,
46 useReducer,
5- useCallback,
6- ReactNode,
77 } from "react";
88
99 /**
@@ -17,6 +17,7 @@
1717 | "free-trial" // Free trial transition UI
1818 | "login" // Login prompt
1919 | "mcp" // MCP selector
20+ | "update" // Update selector
2021 | "session"; // Session selector
2122
2223 interface NavigationState {
modified extensions/cli/src/ui/hooks/useChat.helpers.ts +7 −0
@@ -48,6 +48,7 @@
4848 setChatHistory: React.Dispatch<React.SetStateAction<ChatHistoryItem[]>>;
4949 onShowConfigSelector: () => void;
5050 onShowModelSelector?: () => void;
51+ onShowUpdateSelector?: () => void;
5152 onShowMCPSelector?: () => void;
5253 onShowSessionSelector?: () => void;
5354 onClear?: () => void;
@@ -61,6 +62,7 @@
6162 chatHistory,
6263 setChatHistory,
6364 onShowConfigSelector,
65+ onShowUpdateSelector,
6466 onShowModelSelector,
6567 onShowMCPSelector,
6668 onShowSessionSelector,
@@ -75,6 +77,11 @@
7577 return null;
7678 }
7779
80+ if (result.openUpdateSelector) {
81+ onShowUpdateSelector?.();
82+ return null;
83+ }
84+
7885 if (result.openConfigSelector) {
7986 onShowConfigSelector();
8087 return null;
modified extensions/cli/src/ui/hooks/useChat.ts +2 −0
@@ -55,6 +55,7 @@
5555 additionalPrompts,
5656 onShowConfigSelector,
5757 onShowModelSelector,
58+ onShowUpdateSelector,
5859 onShowMCPSelector,
5960 onShowSessionSelector,
6061 onLoginPrompt: _onLoginPrompt,
@@ -419,6 +420,7 @@
419420 onShowModelSelector,
420421 onShowMCPSelector,
421422 onShowSessionSelector,
423+ onShowUpdateSelector,
422424 onClear,
423425 });
424426
modified extensions/cli/src/ui/hooks/useChat.types.ts +2 −0
@@ -15,6 +15,7 @@
1515 additionalPrompts?: string[];
1616 onShowConfigSelector: () => void;
1717 onShowMCPSelector: () => void;
18+ onShowUpdateSelector: () => void;
1819 onShowModelSelector?: () => void;
1920 onShowSessionSelector?: () => void;
2021 onLoginPrompt?: (promptText: string) => Promise<string>;
@@ -57,6 +58,7 @@
5758 openConfigSelector?: boolean;
5859 openModelSelector?: boolean;
5960 openMcpSelector?: boolean;
61+ openUpdateSelector?: boolean;
6062 openSessionSelector?: boolean;
6163 compact?: boolean;
6264 }
modified extensions/cli/src/util/exponentialBackoff.ts +30 −0
@@ -77,10 +77,40 @@
7777 );
7878 }
7979
80+/**
81+ * Checks if the error indicates a context length issue (non-retryable)
82+ */
83+export function isContextLengthError(error: any): boolean {
84+ const errorMessage = error.message?.toLowerCase() || "";
85+ const contextLengthPatterns = [
86+ // Anthropic Claude
87+ "input length and max_tokens exceed context limit",
88+ "decrease input length or max_tokens",
89+ // OpenAI
90+ "maximum context length",
91+ "reduce the length of the messages",
92+ // Mistral
93+ "tokens in the prompt exceeds",
94+ "use a shorter prompt",
95+ // Generic patterns
96+ "context_length_exceeded",
97+ "invalid_request_error",
98+ ];
99+
100+ return contextLengthPatterns.some((pattern) =>
101+ errorMessage.includes(pattern),
102+ );
103+}
104+
80105 /**
81106 * Determines if an error is retryable based on the error type and status code
82107 */
83108 function isRetryableError(error: any): boolean {
109+ // Context length errors are never retryable - they need user intervention
110+ if (isContextLengthError(error)) {
111+ return false;
112+ }
113+
84114 // Network errors are retryable
85115 if (isNetworkError(error)) {
86116 return true;
added extensions/cli/src/util/tokenizer.contextValidation.test.ts +62 −0
@@ -0,0 +1,62 @@
1+import { ModelConfig } from "@continuedev/config-yaml";
2+import { describe, expect, it } from "vitest";
3+
4+import { validateContextLength } from "./tokenizer.js";
5+
6+describe("validateContextLength", () => {
7+ const createMockModel = (
8+ contextLength: number,
9+ maxTokens?: number,
10+ ): ModelConfig => ({
11+ name: "test-model",
12+ model: "test",
13+ provider: "openai",
14+ defaultCompletionOptions: {
15+ contextLength,
16+ maxTokens,
17+ },
18+ });
19+
20+ const createMockHistory = (messageCount: number, contentLength = 100) => {
21+ return Array.from({ length: messageCount }, (_, i) => ({
22+ message: {
23+ role: "user" as const,
24+ content: "x".repeat(contentLength), // Roughly contentLength/4 tokens
25+ },
26+ contextItems: [],
27+ }));
28+ };
29+
30+ it("should pass validation when within context limits", () => {
31+ const model = createMockModel(1000, 200);
32+ const chatHistory = createMockHistory(5, 40); // ~50 tokens total
33+
34+ const result = validateContextLength(chatHistory, model);
35+
36+ expect(result.isValid).toBe(true);
37+ expect(result.error).toBeUndefined();
38+ });
39+
40+ it("should fail validation when input + maxTokens exceeds context limit", () => {
41+ const model = createMockModel(1000, 800);
42+ const chatHistory = createMockHistory(20, 100); // ~500+ tokens
43+
44+ const result = validateContextLength(chatHistory, model);
45+
46+ expect(result.isValid).toBe(false);
47+ expect(result.error).toContain("Context length exceeded");
48+ expect(result.error).toContain("input");
49+ expect(result.error).toContain("max_tokens");
50+ expect(result.error).toContain("context_limit");
51+ });
52+
53+ it("should handle large models with appropriate scaling", () => {
54+ const model = createMockModel(200_000, 64_000); // Claude-like model
55+ const chatHistory = createMockHistory(100, 1000); // Large conversation
56+
57+ const result = validateContextLength(chatHistory, model);
58+
59+ expect(result.contextLimit).toBe(200_000);
60+ expect(result.maxTokens).toBe(64_000);
61+ });
62+});
modified extensions/cli/src/util/tokenizer.test.ts +2 −2
@@ -78,14 +78,14 @@
7878 role: "user",
7979 content: [
8080 { type: "text", text: "Hello" }, // 5 chars -> ~2 tokens
81- { type: "imageUrl", imageUrl: { url: "test.jpg" } }, // +85 tokens
81+ { type: "imageUrl", imageUrl: { url: "test.jpg" } }, // +1024 tokens
8282 ],
8383 },
8484 contextItems: [],
8585 };
8686
8787 const tokenCount = countChatHistoryItemTokens(historyItem);
88- expect(tokenCount).toBe(89); // 2 + 85 + 2 role tokens
88+ expect(tokenCount).toBe(1028); // 2 + 1024 + 2 role tokens
8989 });
9090
9191 it("should count tokens for tool calls", () => {
modified extensions/cli/src/util/tokenizer.ts +44 −1
@@ -47,7 +47,7 @@
4747 // Images and other content types have their own token costs
4848 // but we'll use a rough estimate for now
4949 if (part.type === "imageUrl") {
50- tokenCount += 85; // Rough estimate for image tokens
50+ tokenCount += 1024; // Rough estimate for image tokens
5151 }
5252 }
5353 }
@@ -192,3 +192,46 @@
192192 const limit = getModelContextLimit(model);
193193 return `Approaching context limit (${(limit / 1000).toFixed(0)}K tokens). Auto-compacting chat history...`;
194194 }
195+
196+/**
197+ * Validates that the input tokens + max_tokens don't exceed context limit
198+ * @param chatHistory The chat history to validate
199+ * @param model The model configuration
200+ * @returns Validation result with error details if invalid
201+ */
202+export function validateContextLength(
203+ chatHistory: ChatHistoryItem[],
204+ model: ModelConfig,
205+): {
206+ isValid: boolean;
207+ error?: string;
208+ inputTokens?: number;
209+ contextLimit?: number;
210+ maxTokens?: number;
211+} {
212+ const inputTokens = countChatHistoryTokens(chatHistory);
213+ const contextLimit = getModelContextLimit(model);
214+ const maxTokens = model.defaultCompletionOptions?.maxTokens || 0;
215+
216+ // If maxTokens is not set, use 35% default reservation for output
217+ const reservedForOutput =
218+ maxTokens > 0 ? maxTokens : Math.ceil(contextLimit * 0.35);
219+ const totalRequired = inputTokens + reservedForOutput;
220+
221+ if (totalRequired > contextLimit) {
222+ return {
223+ isValid: false,
224+ error: `Context length exceeded: input (${inputTokens.toLocaleString()}) + max_tokens (${reservedForOutput.toLocaleString()}) = ${totalRequired.toLocaleString()} > context_limit (${contextLimit.toLocaleString()})`,
225+ inputTokens,
226+ contextLimit,
227+ maxTokens: reservedForOutput,
228+ };
229+ }
230+
231+ return {
232+ isValid: true,
233+ inputTokens,
234+ contextLimit,
235+ maxTokens: reservedForOutput,
236+ };
237+}
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +82 −2
@@ -45,6 +45,76 @@
4545 private val continuePluginService: ContinuePluginService,
4646
4747 ) : IDE {
48+
49+ // Security-focused ignore patterns - should always be excluded for security reasons
50+ private val DEFAULT_SECURITY_IGNORE_FILETYPES = listOf(
51+ // Environment and configuration files with secrets
52+ "*.env", "*.env.*", ".env*", "config.json", "config.yaml", "config.yml",
53+ "settings.json", "appsettings.json", "appsettings.*.json",
54+
55+ // Certificate and key files
56+ "*.key", "*.pem", "*.p12", "*.pfx", "*.crt", "*.cer", "*.jks",
57+ "*.keystore", "*.truststore",
58+
59+ // Database files that may contain sensitive data
60+ "*.db", "*.sqlite", "*.sqlite3", "*.mdb", "*.accdb",
61+
62+ // Credential and secret files
63+ "*.secret", "*.secrets", "credentials", "credentials.*", "auth.json",
64+ "token", "token.*", "*.token",
65+
66+ // Backup files that might contain sensitive data
67+ "*.bak", "*.backup", "*.old", "*.orig",
68+
69+ // Docker secrets
70+ "docker-compose.override.yml", "docker-compose.override.yaml",
71+
72+ // SSH and GPG
73+ "id_rsa", "id_dsa", "id_ecdsa", "id_ed25519", "*.ppk", "*.gpg"
74+ )
75+
76+ private val DEFAULT_SECURITY_IGNORE_DIRS = listOf(
77+ // Environment and configuration directories
78+ ".env/", "env/",
79+
80+ // Cloud provider credential directories
81+ ".aws/", ".gcp/", ".azure/", ".kube/", ".docker/",
82+
83+ // Secret directories
84+ "secrets/", ".secrets/", "private/", ".private/", "certs/",
85+ "certificates/", "keys/", ".ssh/", ".gnupg/", ".gpg/",
86+
87+ // Temporary directories that might contain sensitive data
88+ "tmp/secrets/", "temp/secrets/", ".tmp/"
89+ )
90+
91+ // Additional non-security patterns for general indexing exclusion
92+ private val ADDITIONAL_SEARCH_IGNORE_FILETYPES = listOf(
93+ "*.DS_Store", "*-lock.json", "*.lock", "*.log", "*.ttf", "*.png",
94+ "*.jpg", "*.jpeg", "*.gif", "*.mp4", "*.svg", "*.ico", "*.pdf",
95+ "*.zip", "*.gz", "*.tar", "*.dmg", "*.tgz", "*.rar", "*.7z",
96+ "*.exe", "*.dll", "*.obj", "*.o", "*.o.d", "*.a", "*.lib",
97+ "*.so", "*.dylib", "*.ncb", "*.sdf", "*.woff", "*.woff2",
98+ "*.eot", "*.cur", "*.avi", "*.mpg", "*.mpeg", "*.mov", "*.mp3",
99+ "*.mkv", "*.webm", "*.jar", "*.onnx", "*.parquet", "*.pqt",
100+ "*.wav", "*.webp", "*.wasm", "*.plist", "*.profraw", "*.gcda",
101+ "*.gcno", "go.sum", "*.gitignore", "*.gitkeep", "*.continueignore",
102+ "*.csv", "*.uasset", "*.pdb", "*.bin", "*.pag", "*.swp", "*.jsonl"
103+ )
104+
105+ private val ADDITIONAL_SEARCH_IGNORE_DIRS = listOf(
106+ ".git/", ".svn/", "node_modules/", "dist/", "build/", "Build/",
107+ "target/", "out/", "bin/", ".pytest_cache/", ".vscode-test/",
108+ "__pycache__/", "site-packages/", ".gradle/", ".mvn/", ".cache/",
109+ "gems/", "vendor/", ".venv/", "venv/", ".vscode/", ".idea/", ".vs/",
110+ ".continue/"
111+ )
112+
113+ // Combined patterns for use in ripgrep
114+ private val DEFAULT_IGNORES = DEFAULT_SECURITY_IGNORE_FILETYPES +
115+ DEFAULT_SECURITY_IGNORE_DIRS +
116+ ADDITIONAL_SEARCH_IGNORE_FILETYPES +
117+ ADDITIONAL_SEARCH_IGNORE_DIRS
48118
49119 private val gitService = GitService(project, continuePluginService)
50120 private val fileUtils = FileUtils(project)
@@ -335,6 +405,9 @@
335405 val ideInfo = this.getIdeInfo()
336406 if (ideInfo.remoteName == "local") {
337407 try {
408+ // Create a single combined ignore pattern using glob brace expansion
409+ val defaultIgnorePattern = DEFAULT_IGNORES.joinToString(",") { it }
410+
338411 var commandArgs = mutableListOf<String>(
339412 ripgrep,
340413 "--files",
@@ -343,7 +416,9 @@
343416 "--ignore-file",
344417 ".continueignore",
345418 "--ignore-file",
346- ".gitignore"
419+ ".gitignore",
420+ "--glob",
421+ "!{${defaultIgnorePattern}}"
347422 )
348423 if (maxResults != null) {
349424 commandArgs.add("--max-count")
@@ -370,6 +445,9 @@
370445 val ideInfo = this.getIdeInfo()
371446 if (ideInfo.remoteName == "local") {
372447 try {
448+ // Create a single combined ignore pattern for ripgrep
449+ val defaultIgnorePattern = DEFAULT_IGNORES.joinToString(",") { it }
450+
373451 val commandArgs = mutableListOf(
374452 ripgrep,
375453 "-i",
@@ -379,7 +457,9 @@
379457 ".gitignore",
380458 "-C",
381459 "2",
382- "--heading"
460+ "--heading",
461+ "--glob",
462+ "!{${defaultIgnorePattern}}" // Exclude all default ignores using brace expansion
383463 )
384464
385465 // Conditionally add maxResults flag
modified extensions/vscode/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified extensions/vscode/package.json +1 −1
@@ -2,7 +2,7 @@
22 "name": "continue",
33 "icon": "media/icon.png",
44 "author": "Continue Dev, Inc",
5- "version": "1.3.9",
5+ "version": "1.3.10",
66 "repository": {
77 "type": "git",
88 "url": "https://github.com/continuedev/continue"
modified extensions/vscode/src/VsCodeIde.ts +18 −1
@@ -3,6 +3,7 @@
33
44 import { Range } from "core";
55 import { EXTENSION_NAME } from "core/control-plane/env";
6+import { DEFAULT_IGNORES, defaultIgnoresGlob } from "core/indexing/ignore";
67 import * as URI from "uri-js";
78 import * as vscode from "vscode";
89
@@ -452,7 +453,9 @@
452453 resolve(output);
453454 } else if (code === 1) {
454455 // No matches
455- resolve("No matches found");
456+ resolve(
457+ "No matches found. Build, secrets, etc. dirs and files are not included.",
458+ );
456459 } else {
457460 reject(new Error(`Process exited with code ${code}`));
458461 }
@@ -464,6 +467,8 @@
464467 pattern: string,
465468 maxResults?: number,
466469 ): Promise<string[]> {
470+ // Create a single combined ignore pattern for ripgrep (calculated once)
471+
467472 if (vscode.env.remoteName) {
468473 // TODO better tests for this remote search implementation
469474 // throw new Error("Ripgrep not supported, this workspace is remote");
@@ -475,6 +480,11 @@
475480 );
476481
477482 const ignoreGlobs: Set<string> = new Set();
483+ // Add default ignores from core
484+ for (const pattern of DEFAULT_IGNORES) {
485+ ignoreGlobs.add(pattern);
486+ }
487+
478488 for (const file of ignoreFiles) {
479489 const content = await this.ideUtils.readFile(file);
480490 if (content === null) {
@@ -535,6 +545,7 @@
535545 return results.map((result) => vscode.workspace.asRelativePath(result));
536546 } else {
537547 const results: string[] = [];
548+ // Create a single combined ignore pattern using glob brace expansion
538549 for (const dir of await this.getWorkspaceDirs()) {
539550 const dirResults = await this.runRipgrepQuery(dir, [
540551 "--files",
@@ -544,6 +555,8 @@
544555 ".continueignore",
545556 "--ignore-file",
546557 ".gitignore",
558+ "--glob",
559+ defaultIgnoresGlob,
547560 ...(maxResults ? ["--max-count", String(maxResults)] : []),
548561 ]);
549562
@@ -566,6 +579,7 @@
566579 throw new Error("Ripgrep not supported, this workspace is remote");
567580 }
568581 const results: string[] = [];
582+
569583 for (const dir of await this.getWorkspaceDirs()) {
570584 const dirResults = await this.runRipgrepQuery(dir, [
571585 "-i", // Case-insensitive search
@@ -576,6 +590,9 @@
576590 "-C",
577591 "2", // Show 2 lines of context
578592 "--heading", // Only show filepath once per result
593+ // Use a single glob with all default ignores
594+ "--glob",
595+ defaultIgnoresGlob,
579596 ...(maxResults ? ["-m", maxResults.toString()] : []),
580597 "-e",
581598 query, // Pattern to search for
modified extensions/vscode/src/commands.ts +4 −0
@@ -9,6 +9,7 @@
99 import { walkDirAsync } from "core/indexing/walkDir";
1010 import { isModelInstaller } from "core/llm";
1111 import { startLocalOllama } from "core/util/ollamaHelper";
12+import { startLocalLemonade } from "core/util/lemonadeHelper";
1213 import { getConfigJsonPath, getConfigYamlPath } from "core/util/paths";
1314 import { Telemetry } from "core/util/posthog";
1415 import * as vscode from "vscode";
@@ -620,6 +621,9 @@
620621 "continue.startLocalOllama": () => {
621622 startLocalOllama(ide);
622623 },
624+ "continue.startLocalLemonade": () => {
625+ startLocalLemonade(ide);
626+ },
623627 "continue.installModel": async (
624628 modelName: string,
625629 llmProvider: ILLM | undefined,
modified extensions/vscode/src/diff/vertical/handler.ts +38 −0
@@ -76,6 +76,39 @@
7676 this.disposables.push(disposable);
7777 }
7878
79+ /** ensures the current target file is open and focused before performing edits*/
80+ private async ensureCurrentFileIsFocused() {
81+ const targetUri = this.editor.document.uri;
82+ const active = vscode.window.activeTextEditor;
83+ if (
84+ active &&
85+ URI.equal(active.document.uri.toString(), targetUri.toString())
86+ ) {
87+ this.editor = active;
88+ return;
89+ }
90+
91+ const visible = vscode.window.visibleTextEditors.find((foundEditor) =>
92+ URI.equal(foundEditor.document.uri.toString(), targetUri.toString()),
93+ );
94+ if (visible) {
95+ await vscode.window.showTextDocument(visible.document, {
96+ preview: false,
97+ preserveFocus: false,
98+ viewColumn: visible.viewColumn,
99+ });
100+ this.editor = vscode.window.activeTextEditor ?? visible;
101+ return;
102+ }
103+
104+ const doc = await vscode.workspace.openTextDocument(targetUri);
105+ const editor = await vscode.window.showTextDocument(doc, {
106+ preview: false,
107+ preserveFocus: false,
108+ });
109+ this.editor = editor;
110+ }
111+
79112 public get range(): vscode.Range {
80113 const startLine = Math.min(this.startLine, this.endLine);
81114 const endLine = Math.max(this.startLine, this.endLine);
@@ -296,6 +329,8 @@
296329 // Diff is messed up without this delay.
297330 await new Promise((resolve) => setTimeout(resolve, 100));
298331
332+ await this.ensureCurrentFileIsFocused();
333+
299334 // First, we reset the original diff by rejecting all pending diff blocks
300335 const blocks = this.editorToVerticalDiffCodeLens.get(this.fileUri) ?? [];
301336 for (const block of blocks.reverse()) {
@@ -443,6 +478,7 @@
443478 }
444479
445480 private async insertTextAboveLine(index: number, text: string) {
481+ await this.ensureCurrentFileIsFocused();
446482 await this.editor.edit(
447483 (editBuilder) => {
448484 const lineCount = this.editor.document.lineCount;
@@ -471,6 +507,7 @@
471507
472508 private async deleteLinesAt(index: number, numLines = 1) {
473509 const startLine = new vscode.Position(index, 0);
510+ await this.ensureCurrentFileIsFocused();
474511 await this.editor.edit(
475512 (editBuilder) => {
476513 editBuilder.delete(
@@ -482,6 +519,7 @@
482519 }
483520
484521 private async deleteRangeLines(ranges: vscode.Range[]) {
522+ await this.ensureCurrentFileIsFocused();
485523 await this.editor.edit(
486524 (editBuilder) => {
487525 for (const range of ranges) {
modified extensions/vscode/src/diff/vertical/manager.ts +1 −1
@@ -51,7 +51,7 @@
5151 this.fileUriToHandler.get(fileUri)?.clear(false);
5252 this.fileUriToHandler.delete(fileUri);
5353 }
54- const editor = vscode.window.activeTextEditor; // TODO might cause issues if user switches files
54+ const editor = vscode.window.activeTextEditor;
5555 if (editor && URI.equal(editor.document.uri.toString(), fileUri)) {
5656 const handler = new VerticalDiffHandler(
5757 startLine,
modified extensions/vscode/src/util/errorHandling.ts +29 −1
@@ -3,13 +3,41 @@
33 import * as vscode from "vscode";
44
55 /**
6- * @param error Handles common LLM errors. Currently only handles Ollama-related errors.
6+ * @param error Handles common LLM errors. Currently handles Ollama and Lemonade-related errors.
77 * @returns true if error is handled, false otherwise
88 */
99 export async function handleLLMError(error: unknown): Promise<boolean> {
1010 if (!error || !(error instanceof Error) || !error.message) {
1111 return false;
1212 }
13+
14+ // Handle Lemonade errors
15+ if (error.message.toLowerCase().includes("lemonade")) {
16+ let message: string = error.message;
17+ let options: string[] | undefined;
18+
19+ // For Windows, offer to start Lemonade if it's installed but not running
20+ if (
21+ process.platform === "win32" &&
22+ message.includes("Lemonade server may not be running")
23+ ) {
24+ options = ["Start Lemonade", "Setup Instructions"];
25+ } else {
26+ // For all other cases (Linux, not installed, etc.), direct to setup instructions
27+ options = ["Setup Instructions"];
28+ }
29+
30+ vscode.window.showErrorMessage(message, ...options).then((val) => {
31+ if (val === "Setup Instructions") {
32+ vscode.env.openExternal(vscode.Uri.parse("https://lemonade-server.ai"));
33+ } else if (val === "Start Lemonade") {
34+ vscode.commands.executeCommand("continue.startLocalLemonade");
35+ }
36+ });
37+ return true;
38+ }
39+
40+ // Handle Ollama errors
1341 if (!error.message.toLowerCase().includes("ollama")) {
1442 return false;
1543 }
modified extensions/vscode/src/webviewProtocol.ts +1 −1
@@ -107,7 +107,7 @@
107107
108108 if (e.cause) {
109109 if (e.cause.name === "ConnectTimeoutError") {
110- message = `Connection timed out. If you expect it to take a long time to connect, you can increase the timeout in config.json by setting "requestOptions": { "timeout": 10000 }. You can find the full config reference here: https://docs.continue.dev/reference/config`;
110+ message = `Connection timed out. If you expect it to take a long time to connect, you can increase the timeout in your config by setting "requestOptions": { "timeout": 10000 }. You can find the full config reference here: https://docs.continue.dev/reference/config`;
111111 } else if (e.cause.code === "ECONNREFUSED") {
112112 message = `Connection was refused. This likely means that there is no server running at the specified URL. If you are running your own server you may need to set the "apiBase" parameter in config.json. For example, you can set up an OpenAI-compatible server like here: https://docs.continue.dev/reference/Model%20Providers/openai#openai-compatible-servers--apis`;
113113 } else {
modified gui/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

added gui/public/logos/lemonade.png +0 −0

Binary content is not shown. View the file.

modified gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx +19 −2
@@ -1,4 +1,7 @@
1-import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
1+import {
2+ Cog6ToothIcon,
3+ ExclamationTriangleIcon,
4+} from "@heroicons/react/24/outline";
25 import { ProfileDescription } from "core/config/ProfileLifecycleManager";
36 import { useContext, useMemo } from "react";
47 import { useNavigate } from "react-router-dom";
@@ -48,7 +51,7 @@
4851 disabled={hasFatalErrors}
4952 onClick={!hasFatalErrors ? handleOptionClick : undefined}
5053 fontSizeModifier={-2}
51- className={selected ? "bg-list-active text-list-active-foreground" : ""}
54+ className={`group ${selected ? "bg-list-active text-list-active-foreground" : ""}`}
5255 >
5356 <div className="flex w-full items-center justify-between gap-10 py-0.5">
5457 <div className="flex w-full items-center gap-3">
@@ -62,6 +65,20 @@
6265 </span>
6366 </div>
6467 <div className="flex flex-row items-center gap-1.5">
68+ <Button
69+ variant="ghost"
70+ size="sm"
71+ className="text-description-muted hover:enabled:text-foreground my-0 h-4 w-4 p-0 opacity-0 transition-opacity group-hover:opacity-100"
72+ onClick={(e) => {
73+ e.stopPropagation();
74+ ideMessenger.post("config/openProfile", {
75+ profileId: profile.id,
76+ });
77+ onClick(); // Close the listbox
78+ }}
79+ >
80+ <Cog6ToothIcon className="h-3.5 w-3.5" />
81+ </Button>
6582 {profile.errors && profile.errors?.length > 0 && (
6683 <ToolTip content="View errors">
6784 <Button
modified gui/src/components/AssistantAndOrgListbox/OrganizationOption.tsx +18 −4
@@ -1,14 +1,16 @@
1-import { CheckIcon } from "@heroicons/react/24/outline";
1+import { Cog6ToothIcon } from "@heroicons/react/24/outline";
22 import {
33 BuildingOfficeIcon,
44 UserCircleIcon,
55 UserIcon,
66 } from "@heroicons/react/24/solid";
77 import { useContext } from "react";
8+import { useNavigate } from "react-router-dom";
89 import { IdeMessengerContext } from "../../context/IdeMessenger";
910 import { useAppDispatch, useAppSelector } from "../../redux/hooks";
1011 import { setSelectedOrgId } from "../../redux/slices/profilesSlice";
11-import { ListboxOption } from "../ui";
12+import { CONFIG_ROUTES } from "../../util/navigation";
13+import { Button, ListboxOption } from "../ui";
1214
1315 interface OrganizationOptionProps {
1416 organization: { id: string; name: string; iconUrl?: string | null };
@@ -45,6 +47,7 @@
4547 onClose,
4648 }: OrganizationOptionProps) {
4749 const dispatch = useAppDispatch();
50+ const navigate = useNavigate();
4851 const ideMessenger = useContext(IdeMessengerContext);
4952 const selectedOrgId = useAppSelector(
5053 (state) => state.profiles.selectedOrganizationId,
@@ -64,7 +67,7 @@
6467 value={organization.id}
6568 onClick={handleOptionClick}
6669 fontSizeModifier={-2}
67- className={isSelected ? "bg-list-active text-list-active-foreground" : ""}
70+ className={`group ${isSelected ? "bg-list-active text-list-active-foreground" : ""}`}
6871 >
6972 <div className="flex w-full items-center justify-between gap-10 py-0.5">
7073 <div className="flex w-full items-center gap-3">
@@ -78,7 +81,18 @@
7881 </span>
7982 </div>
8083 <div className="flex flex-row items-center gap-1.5">
81- {isSelected && <CheckIcon className="h-3.5 w-3.5 flex-shrink-0" />}
84+ <Button
85+ variant="ghost"
86+ size="sm"
87+ className="text-description-muted hover:enabled:text-foreground my-0 h-4 w-4 p-0 opacity-0 transition-opacity group-hover:opacity-100"
88+ onClick={(e) => {
89+ e.stopPropagation();
90+ navigate(CONFIG_ROUTES.ORGANIZATIONS);
91+ onClose(); // Close the listbox
92+ }}
93+ >
94+ <Cog6ToothIcon className="h-3.5 w-3.5" />
95+ </Button>
8296 </div>
8397 </div>
8498 </ListboxOption>
modified gui/src/components/AssistantAndOrgListbox/index.tsx +2 −32
@@ -2,9 +2,7 @@
22 ArrowPathIcon,
33 ArrowRightStartOnRectangleIcon,
44 Cog6ToothIcon,
5- PencilIcon,
65 PlusIcon,
7- WrenchScrewdriverIcon,
86 } from "@heroicons/react/24/outline";
97 import { isOnPremSession } from "core/control-plane/AuthTypes";
108 import { useContext, useEffect, useRef } from "react";
@@ -155,7 +153,7 @@
155153 className="max-h-32 -translate-x-1.5 overflow-y-auto pb-0"
156154 style={{ zIndex: 200 }}
157155 >
158- <div className="flex items-center justify-between p-2">
156+ <div className="flex items-center justify-between px-1.5 py-1">
159157 <span className="text-description text-xs font-medium">
160158 Agents
161159 </span>
@@ -193,7 +191,7 @@
193191 {shouldRenderOrgInfo && (
194192 <>
195193 <Divider className="!mb-0.5 !mt-0" />
196- <div className="flex items-center justify-between p-2">
194+ <div className="flex items-center justify-between px-1.5 py-1">
197195 <span className="text-description text-xs font-medium">
198196 Organizations
199197 </span>
@@ -232,34 +230,6 @@
232230 {/* Settings Section */}
233231 {variant !== "sidebar" && (
234232 <div>
235- <Button
236- onClick={(e) => {
237- e.stopPropagation();
238- onRulesConfig();
239- }}
240- variant="ghost"
241- size="sm"
242- className="text-description hover:bg-input my-0 w-full justify-start py-1.5 pl-1 text-left"
243- >
244- <div className="flex w-full items-center">
245- <PencilIcon className="ml-1.5 mr-2 h-3.5 w-3.5 flex-shrink-0" />
246- <span className="text-2xs">Rules</span>
247- </div>
248- </Button>
249- <Button
250- onClick={(e) => {
251- e.stopPropagation();
252- onToolsConfig();
253- }}
254- variant="ghost"
255- size="sm"
256- className="text-description hover:bg-input my-0 w-full justify-start py-1.5 pl-1 text-left"
257- >
258- <div className="flex w-full items-center">
259- <WrenchScrewdriverIcon className="ml-1.5 mr-2 h-3.5 w-3.5 flex-shrink-0" />
260- <span className="text-2xs">Tools</span>
261- </div>
262- </Button>
263233 <Button
264234 onClick={(e) => {
265235 e.stopPropagation();
modified gui/src/components/mainInput/ContinueInputBox.tsx +10 −6
@@ -1,6 +1,6 @@
11 import { Editor, JSONContent } from "@tiptap/react";
22 import { ContextItemWithId, InputModifiers, RuleWithSource } from "core";
3-import { useMemo } from "react";
3+import { memo, useMemo } from "react";
44 import { defaultBorderRadius, vscBackground } from "..";
55 import { useAppSelector } from "../../redux/hooks";
66 import { selectSlashCommandComboBoxInputs } from "../../redux/selectors";
@@ -69,16 +69,20 @@
6969 const historyKey = isInEdit ? "edit" : "chat";
7070 const placeholder = isInEdit ? "Edit selected code" : undefined;
7171
72- const toolbarOptions: ToolbarOptions = isInEdit
73- ? {
72+ const toolbarOptions: ToolbarOptions = useMemo(() => {
73+ if (isInEdit) {
74+ return {
7475 hideAddContext: false,
7576 hideImageUpload: false,
7677 hideUseCodebase: true,
7778 hideSelectModel: false,
7879 enterText:
7980 editModeState.applyState.status === "done" ? "Retry" : "Edit",
80- }
81- : {};
81+ } as ToolbarOptions;
82+ }
83+ // Stable empty object to avoid re-renders from identity changes
84+ return {} as ToolbarOptions;
85+ }, [isInEdit, editModeState.applyState.status]);
8286
8387 const { appliedRules = [], contextItems = [] } = props;
8488
@@ -123,4 +127,4 @@
123127 );
124128 }
125129
126-export default ContinueInputBox;
130+export default memo(ContinueInputBox);
modified gui/src/components/mainInput/InputToolbar.tsx +22 −2
@@ -9,7 +9,7 @@
99 modelSupportsImages,
1010 modelSupportsReasoning,
1111 } from "core/llm/autodetect";
12-import { useContext, useRef } from "react";
12+import { memo, useContext, useRef } from "react";
1313 import { IdeMessengerContext } from "../../context/IdeMessenger";
1414 import { useAppDispatch, useAppSelector } from "../../redux/hooks";
1515 import { selectUseActiveFile } from "../../redux/selectors";
@@ -242,4 +242,24 @@
242242 );
243243 }
244244
245-export default InputToolbar;
245+function shallowToolbarOptionsEqual(a?: ToolbarOptions, b?: ToolbarOptions) {
246+ if (a === b) return true;
247+ if (!a || !b) return false;
248+ return (
249+ a.hideAddContext === b.hideAddContext &&
250+ a.hideImageUpload === b.hideImageUpload &&
251+ a.hideUseCodebase === b.hideUseCodebase &&
252+ a.hideSelectModel === b.hideSelectModel &&
253+ a.enterText === b.enterText
254+ );
255+}
256+
257+export default memo(
258+ InputToolbar,
259+ (prev, next) =>
260+ prev.hidden === next.hidden &&
261+ prev.disabled === next.disabled &&
262+ prev.isMainInput === next.isMainInput &&
263+ prev.activeKey === next.activeKey &&
264+ shallowToolbarOptionsEqual(prev.toolbarOptions, next.toolbarOptions),
265+);
modified gui/src/components/mainInput/Lump/EditBlockButton.tsx +1 −1
@@ -6,7 +6,7 @@
66
77 type SectionKey = Exclude<
88 keyof ConfigYaml,
9- "name" | "version" | "schema" | "metadata" | "env"
9+ "name" | "version" | "schema" | "metadata" | "env" | "requestOptions"
1010 >;
1111
1212 interface EditBlockButtonProps<T extends SectionKey> {
modified gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx +77 −3
@@ -1,24 +1,45 @@
1-import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
1+import {
2+ CubeIcon,
3+ ExclamationTriangleIcon,
4+ PencilIcon,
5+ WrenchScrewdriverIcon,
6+} from "@heroicons/react/24/outline";
27 import { useContext, useEffect, useState } from "react";
38 import { useNavigate } from "react-router-dom";
49 import { IdeMessengerContext } from "../../../../context/IdeMessenger";
5-import { useAppSelector } from "../../../../redux/hooks";
10+import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
11+import {
12+ selectPendingToolCalls,
13+ selectToolCallsByStatus,
14+} from "../../../../redux/selectors/selectToolCalls";
15+import { setSelectedProfile } from "../../../../redux/slices/profilesSlice";
616 import FreeTrialButton from "../../../FreeTrialButton";
717 import { ToolTip } from "../../../gui/Tooltip";
18+import HoverItem from "../../InputToolbar/HoverItem";
819
920 import { usesFreeTrialApiKey } from "core/config/usesFreeTrialApiKey";
1021 import type { FreeTrialStatus } from "core/control-plane/client";
22+import { useAuth } from "../../../../context/Auth";
1123 import { getLocalStorage } from "../../../../util/localStorage";
1224 import { CONFIG_ROUTES } from "../../../../util/navigation";
1325 import { AssistantAndOrgListbox } from "../../../AssistantAndOrgListbox";
1426
1527 export function BlockSettingsTopToolbar() {
1628 const navigate = useNavigate();
29+ const dispatch = useAppDispatch();
30+ const { selectedProfile } = useAuth();
1731
1832 const configError = useAppSelector((store) => store.config.configError);
1933 const config = useAppSelector((state) => state.config.config);
2034 const ideMessenger = useContext(IdeMessengerContext);
2135
36+ const pendingToolCalls = useAppSelector(selectPendingToolCalls);
37+ const callingToolCalls = useAppSelector((state) =>
38+ selectToolCallsByStatus(state, "calling"),
39+ );
40+ const hasActiveContent =
41+ pendingToolCalls.length > 0 || callingToolCalls.length > 0;
42+
2243 const [freeTrialStatus, setFreeTrialStatus] =
2344 useState<FreeTrialStatus | null>(null);
2445 const hasExitedFreeTrial = getLocalStorage("hasExitedFreeTrial");
@@ -53,9 +74,39 @@
5374
5475 const shouldShowError = configError && configError?.length > 0;
5576
77+ const handleRulesClick = () => {
78+ if (selectedProfile) {
79+ dispatch(setSelectedProfile(selectedProfile.id));
80+ ideMessenger.post("didChangeSelectedProfile", {
81+ id: selectedProfile.id,
82+ });
83+ }
84+ navigate(CONFIG_ROUTES.RULES);
85+ };
86+
87+ const handleToolsClick = () => {
88+ if (selectedProfile) {
89+ dispatch(setSelectedProfile(selectedProfile.id));
90+ ideMessenger.post("didChangeSelectedProfile", {
91+ id: selectedProfile.id,
92+ });
93+ }
94+ navigate(CONFIG_ROUTES.TOOLS);
95+ };
96+
97+ const handleModelsClick = () => {
98+ if (selectedProfile) {
99+ dispatch(setSelectedProfile(selectedProfile.id));
100+ ideMessenger.post("didChangeSelectedProfile", {
101+ id: selectedProfile.id,
102+ });
103+ }
104+ navigate(CONFIG_ROUTES.MODELS);
105+ };
106+
56107 return (
57108 <div className="flex flex-1 items-center justify-between gap-1.5">
58- <div>
109+ <div className="flex items-center gap-1">
59110 {shouldShowError && (
60111 <ToolTip delayShow={700} content="View configuration errors">
61112 <div
@@ -78,7 +129,30 @@
78129 </div>
79130 </ToolTip>
80131 )}
132+
133+ {!hasActiveContent && (
134+ <div className="flex items-center gap-1.5">
135+ <ToolTip content="Configure rules">
136+ <HoverItem onClick={handleRulesClick} px={2}>
137+ <PencilIcon className="text-description-muted h-3 w-3 hover:brightness-125" />
138+ </HoverItem>
139+ </ToolTip>
140+
141+ <ToolTip content="Configure tools">
142+ <HoverItem onClick={handleToolsClick} px={2}>
143+ <WrenchScrewdriverIcon className="text-description-muted h-3 w-3 hover:brightness-125" />
144+ </HoverItem>
145+ </ToolTip>
146+
147+ <ToolTip content="Configure models">
148+ <HoverItem onClick={handleModelsClick} px={2}>
149+ <CubeIcon className="text-description-muted h-3 w-3 hover:brightness-125" />
150+ </HoverItem>
151+ </ToolTip>
152+ </div>
153+ )}
81154 </div>
155+
82156 <ToolTip
83157 place="top"
84158 content={isUsingFreeTrial ? "View free trial usage" : "Select Agent"}
modified gui/src/components/mainInput/TipTapEditor/TipTapEditor.tsx +67 −8
@@ -1,7 +1,14 @@
11 import { Editor, EditorContent, JSONContent } from "@tiptap/react";
22 import { ContextProviderDescription, InputModifiers } from "core";
33 import { modelSupportsImages } from "core/llm/autodetect";
4-import { useCallback, useContext, useEffect, useRef, useState } from "react";
4+import {
5+ memo,
6+ useCallback,
7+ useContext,
8+ useEffect,
9+ useRef,
10+ useState,
11+} from "react";
512 import { IdeMessengerContext } from "../../../context/IdeMessenger";
613 import useIsOSREnabled from "../../../hooks/useIsOSREnabled";
714 import useUpdatingRef from "../../../hooks/useUpdatingRef";
@@ -38,7 +45,7 @@
3845
3946 export const TIPPY_DIV_ID = "tippy-js-div";
4047
41-export function TipTapEditor(props: TipTapEditorProps) {
48+function TipTapEditorInner(props: TipTapEditorProps) {
4249 const dispatch = useAppDispatch();
4350 const mainEditorContext = useMainEditor();
4451
@@ -72,12 +79,13 @@
7279 return;
7380 }
7481 const placeholder = getPlaceholderText(props.placeholder, historyLength);
75-
76- editor.extensionManager.extensions.filter(
77- (extension) => extension.name === "placeholder",
78- )[0].options["placeholder"] = placeholder;
79-
80- editor.view.dispatch(editor.state.tr);
82+ const placeholderExt = editor.extensionManager.extensions.find(
83+ (e) => e.name === "placeholder",
84+ ) as any;
85+ if (placeholderExt) {
86+ placeholderExt.options["placeholder"] = placeholder;
87+ editor.view.dispatch(editor.state.tr);
88+ }
8189 }, [editor, props.placeholder, historyLength]);
8290
8391 useEffect(() => {
@@ -112,6 +120,23 @@
112120 }
113121 }, [props.isMainInput, isStreaming, editor]);
114122
123+ // Recovery mechanism: ensure historical inputs regain editability when streaming ends
124+ useEffect(() => {
125+ if (!isStreaming && !props.isMainInput && editor) {
126+ // Small delay to ensure editor state has settled after streaming transition
127+ const timeoutId = setTimeout(() => {
128+ if (editor && !editor.isDestroyed) {
129+ // Force re-enable the editor
130+ editor.setOptions({ editable: true });
131+ // Trigger view update to refresh editor state
132+ editor.view.dispatch(editor.state.tr);
133+ }
134+ }, 100);
135+
136+ return () => clearTimeout(timeoutId);
137+ }
138+ }, [isStreaming, props.isMainInput]);
139+
115140 const [showDragOverMsg, setShowDragOverMsg] = useState(false);
116141
117142 const [activeKey, setActiveKey] = useState<string | null>(null);
@@ -281,3 +306,37 @@
281306 </InputBoxDiv>
282307 );
283308 }
309+
310+function toolbarOptionsEqual(a?: ToolbarOptions, b?: ToolbarOptions) {
311+ if (a === b) return true;
312+ if (!a || !b) return false;
313+ return (
314+ a.hideAddContext === b.hideAddContext &&
315+ a.hideImageUpload === b.hideImageUpload &&
316+ a.hideUseCodebase === b.hideUseCodebase &&
317+ a.hideSelectModel === b.hideSelectModel &&
318+ a.enterText === b.enterText
319+ );
320+}
321+
322+const MemoInner = memo(
323+ TipTapEditorInner,
324+ (prev, next) =>
325+ prev.isMainInput === next.isMainInput &&
326+ prev.placeholder === next.placeholder &&
327+ prev.historyKey === next.historyKey &&
328+ prev.inputId === next.inputId &&
329+ toolbarOptionsEqual(prev.toolbarOptions, next.toolbarOptions) &&
330+ (prev.availableContextProviders?.length || 0) ===
331+ (next.availableContextProviders?.length || 0) &&
332+ (prev.availableSlashCommands?.length || 0) ===
333+ (next.availableSlashCommands?.length || 0),
334+);
335+
336+export function TipTapEditor(props: TipTapEditorProps) {
337+ return (
338+ <div className="relative w-full">
339+ <MemoInner {...props} />
340+ </div>
341+ );
342+}
modified gui/src/components/mainInput/TipTapEditor/utils/keyHandlers.ts +14 −4
@@ -1,5 +1,5 @@
11 import { Editor } from "@tiptap/react";
2-import { KeyboardEvent } from "react";
2+import { KeyboardEvent, useRef } from "react";
33 import { isJetBrains, isMetaEquivalentKeyPressed } from "../../../../util";
44 import {
55 handleJetBrainsOSRMetaKeyIssues,
@@ -13,6 +13,7 @@
1313 setActiveKey: (key: string | null) => void;
1414 }) {
1515 const { editor, isOSREnabled, editorFocusedRef, setActiveKey } = options;
16+ const metaActiveRef = useRef(false);
1617
1718 /**
1819 * This handles various issues with meta key actions
@@ -31,10 +32,14 @@
3132 return;
3233 }
3334
34- setActiveKey(e.key);
35-
3635 if (!editorFocusedRef?.current || !isMetaEquivalentKeyPressed(e)) return;
3736
37+ // Only set activeKey for Meta/Control/Alt to drive toolbar highlighting
38+ if (e.key === "Meta" || e.key === "Control" || e.key === "Alt") {
39+ setActiveKey(e.key);
40+ metaActiveRef.current = true;
41+ }
42+
3843 if (isOSREnabled) {
3944 handleJetBrainsOSRMetaKeyIssues(e, editor);
4045 } else if (!isJetBrains()) {
@@ -42,7 +47,12 @@
4247 }
4348 };
4449
45- const handleKeyUp = () => setActiveKey(null);
50+ const handleKeyUp = () => {
51+ if (metaActiveRef.current) {
52+ setActiveKey(null);
53+ metaActiveRef.current = false;
54+ }
55+ };
4656
4757 return { handleKeyDown, handleKeyUp };
4858 }
modified gui/src/components/modelSelection/ModelSelect.tsx +49 −32
@@ -1,6 +1,5 @@
11 import {
22 ArrowPathIcon,
3- CheckIcon,
43 ChevronDownIcon,
54 Cog6ToothIcon,
65 CubeIcon,
@@ -16,7 +15,9 @@
1615 import { updateSelectedModelByRole } from "../../redux/thunks/updateSelectedModelByRole";
1716 import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
1817 import { CONFIG_ROUTES } from "../../util/navigation";
18+import { ToolTip } from "../gui/Tooltip";
1919 import {
20+ Button,
2021 Listbox,
2122 ListboxButton,
2223 ListboxOption,
@@ -57,6 +58,8 @@
5758 showMissingApiKeyMsg,
5859 isSelected,
5960 }: ModelOptionProps) {
61+ const navigate = useNavigate();
62+
6063 function handleOptionClick(e: any) {
6164 if (showMissingApiKeyMsg) {
6265 e.preventDefault();
@@ -64,12 +67,18 @@
6467 }
6568 }
6669
70+ function handleConfigureClick(e: React.MouseEvent) {
71+ e.stopPropagation();
72+ navigate(CONFIG_ROUTES.MODELS);
73+ }
74+
6775 return (
6876 <ListboxOption
6977 key={idx}
7078 disabled={showMissingApiKeyMsg}
7179 value={option.value}
7280 onClick={handleOptionClick}
81+ className={`group ${isSelected ? "bg-list-active text-list-active-foreground" : ""}`}
7382 >
7483 <div className="flex w-full items-center justify-between gap-5">
7584 <div className="flex items-center gap-2 py-0.5">
@@ -88,9 +97,14 @@
8897 )}
8998 </span>
9099 </div>
91- <CheckIcon
92- className={`h-3 w-3 flex-shrink-0 ${isSelected ? "" : "invisible"}`}
93- />
100+ <Button
101+ variant="ghost"
102+ size="sm"
103+ className="text-description-muted hover:enabled:text-foreground my-0 h-4 w-4 p-0 opacity-0 transition-opacity group-hover:opacity-100"
104+ onClick={handleConfigureClick}
105+ >
106+ <Cog6ToothIcon className="h-3.5 w-3.5" />
107+ </Button>
94108 </div>
95109 </ListboxOption>
96110 );
@@ -245,8 +259,21 @@
245259 />
246260 </ListboxButton>
247261 <ListboxOptions className="min-w-[160px]">
248- <div className="flex items-center justify-between gap-1 px-2 py-1">
249- <span className="text-description font-semibold">Models</span>
262+ <div className="flex items-center justify-between px-1.5 py-1">
263+ <span className="text-description text-xs font-medium">Models</span>
264+ <div className="flex items-center gap-0.5">
265+ <Button
266+ onClick={(e) => {
267+ e.stopPropagation();
268+ onClickConfigureModels(e);
269+ }}
270+ variant="ghost"
271+ size="sm"
272+ className="my-0 h-5 w-5 p-0"
273+ >
274+ <Cog6ToothIcon className="text-description h-3.5 w-3.5" />
275+ </Button>
276+ </div>
250277 </div>
251278
252279 <div className="no-scrollbar max-h-[300px] overflow-y-auto">
@@ -274,36 +301,26 @@
274301
275302 {!isConfigLoading && (
276303 <>
277- <Divider className="!mb-0" />
278-
279304 {selectedProfile?.profileType === "local" && (
280- <ListboxOption
281- key={options.length}
282- onClick={onClickAddModel}
283- value={"addModel" as any}
284- fontSizeModifier={-2}
285- className="px-2 py-2"
286- >
287- <span className="text-description text-2xs flex flex-row items-center">
288- <PlusIcon className="mr-1.5 h-3.5 w-3.5" />
289- Add Chat model
290- </span>
291- </ListboxOption>
305+ <>
306+ <Divider className="!mb-0" />
307+ <ListboxOption
308+ key={options.length}
309+ onClick={onClickAddModel}
310+ value={"addModel" as any}
311+ fontSizeModifier={-2}
312+ className="px-2 py-2"
313+ >
314+ <span className="text-description text-2xs flex flex-row items-center">
315+ <PlusIcon className="mr-1.5 h-3.5 w-3.5" />
316+ Add Chat model
317+ </span>
318+ </ListboxOption>
319+ </>
292320 )}
293321
294- <ListboxOption
295- value="configure-models"
296- fontSizeModifier={-2}
297- className="px-2 py-2"
298- onClick={onClickConfigureModels}
299- >
300- <span className="text-description text-2xs flex flex-row items-center">
301- <Cog6ToothIcon className="mr-1.5 h-3.5 w-3.5" />
302- Configure models
303- </span>
304- </ListboxOption>
305322 <Divider className="!my-0" />
306- <div className="text-description flex items-center justify-between gap-1.5 px-2 py-2">
323+ <div className="text-description flex items-center justify-start p-2">
307324 <span className="block" style={{ fontSize: tinyFont }}>
308325 <code>{getMetaKeyLabel()}'</code> to toggle model
309326 </span>
deleted gui/src/components/modelSelection/Toggle.tsx +0 −57
@@ -1,57 +0,0 @@
1-import styled from "styled-components";
2-import {
3- defaultBorderRadius,
4- lightGray,
5- vscInputBackground,
6- vscListActiveBackground,
7- vscListActiveForeground,
8-} from "..";
9-
10-const TopDiv = styled.div`
11- display: flex;
12- align-items: center;
13- text-align: center;
14- margin: auto;
15- width: fit-content;
16- cursor: pointer;
17-
18- border: 1px solid ${lightGray};
19-
20- background-color: ${vscInputBackground};
21- border-radius: ${defaultBorderRadius};
22-
23- &:hover {
24- background-color: ${lightGray}55;
25- }
26-`;
27-
28-const SubDiv = styled.div<{ selected: boolean }>`
29- text-align: center;
30- padding: 8px 12px;
31- border-radius: ${defaultBorderRadius};
32-
33- transition: all 0.2s ease-in-out;
34-
35- ${(props) =>
36- props.selected &&
37- `
38- background-color: ${vscListActiveBackground};
39- color: ${vscListActiveForeground};
40- `}
41-`;
42-
43-function Toggle(props: {
44- optionOne: string;
45- optionTwo: string;
46- selected: boolean;
47- onClick: () => void;
48-}) {
49- return (
50- <TopDiv onClick={props.onClick}>
51- <SubDiv selected={props.selected}>{props.optionOne}</SubDiv>
52- <SubDiv selected={!props.selected}>{props.optionTwo}</SubDiv>
53- </TopDiv>
54- );
55-}
56-
57-export default Toggle;
added gui/src/hooks/useRenderDebug.tsx +70 −0
@@ -0,0 +1,70 @@
1+import { CSSProperties, useEffect, useRef } from "react";
2+
3+/**
4+ * useRenderDebug
5+ *
6+ * Developer utility to visualize component re-renders.
7+ *
8+ * - Returns a `ref` to attach to a container element and a `count` that
9+ * increments on every render of the component using this hook.
10+ * - On each render, it briefly adds a CSS class (default: `rerender-flash`)
11+ * to the element for a quick visual flash.
12+ * - Use together with <RenderCountBadge /> to show the render count inline.
13+ *
14+ * Options:
15+ * - enabled: boolean to toggle the effect (default true)
16+ * - flashClassName: class added on each render (default `rerender-flash`)
17+ * - flashDurationMs: duration of the flash animation in ms (default 180)
18+ */
19+
20+export function useRenderDebug(options?: {
21+ enabled?: boolean;
22+ flashClassName?: string;
23+ flashDurationMs?: number;
24+}) {
25+ const {
26+ enabled = true,
27+ flashClassName = "rerender-flash",
28+ flashDurationMs = 180,
29+ } = options || {};
30+
31+ const ref = useRef<HTMLElement | null>(null);
32+ const countRef = useRef(0);
33+ countRef.current += 1;
34+
35+ useEffect(() => {
36+ if (!enabled || !ref.current) return;
37+ const el = ref.current;
38+ el.classList.add(flashClassName);
39+ const t = setTimeout(
40+ () => el.classList.remove(flashClassName),
41+ flashDurationMs,
42+ );
43+ return () => {
44+ clearTimeout(t);
45+ // Ensure we don't leave the flash class applied on cleanup
46+ el.classList.remove(flashClassName);
47+ };
48+ });
49+
50+ return { ref, count: countRef.current, countRef } as const;
51+}
52+
53+export function RenderCountBadge(props: {
54+ count: number;
55+ title?: string;
56+ style?: CSSProperties;
57+ className?: string;
58+}) {
59+ // Simple badge for use with useRenderDebug; keep lightweight.
60+ const { count, title = `Renders: ${count}`, style, className } = props;
61+ return (
62+ <span
63+ className={`render-count ${className || ""}`}
64+ title={title}
65+ style={style}
66+ >
67+ R{count}
68+ </span>
69+ );
70+}
modified gui/src/index.css +25 −0
@@ -119,3 +119,28 @@
119119 .scroll-container:is(:hover, :focus)::-webkit-scrollbar {
120120 display: block; /* Show scrollbar only on hover or focus */
121121 }
122+
123+/* Debug: visible flash when component re-renders */
124+@keyframes rerenderFlash {
125+ 0% {
126+ box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.9) inset;
127+ }
128+ 100% {
129+ box-shadow: 0 0 0 0 rgba(255, 0, 0, 0) inset;
130+ }
131+}
132+
133+.rerender-flash {
134+ animation: rerenderFlash 180ms ease-out;
135+}
136+
137+.render-count {
138+ display: inline-block;
139+ margin-right: 6px;
140+ padding: 0 4px;
141+ border-radius: 3px;
142+ background: rgba(255, 0, 0, 0.15);
143+ color: rgba(255, 0, 0, 0.9);
144+ font-weight: 600;
145+ letter-spacing: 0.02em;
146+}
modified gui/src/pages/AddNewModel/configs/providers.ts +32 −0
@@ -566,6 +566,38 @@
566566 packages: [models.grokBeta],
567567 apiKeyUrl: "https://console.x.ai/",
568568 },
569+ lemonade: {
570+ title: "Lemonade",
571+ provider: "lemonade",
572+ description:
573+ "High-performance local LLM inference with AMD hardware optimization",
574+ longDescription:
575+ "Lemonade provides optimized local LLM inference with support for AMD NPU, GPU, and CPU acceleration. Visit [lemonade-server.ai](https://lemonade-server.ai/) for installation and setup instructions. Once the Lemonade server is running, you can begin using Continue with your local models.",
576+ icon: "lemonade.png",
577+ tags: [ModelProviderTags.Local, ModelProviderTags.OpenSource],
578+ params: {
579+ apiBase: "http://localhost:8000/api/v1/",
580+ },
581+ packages: [
582+ {
583+ ...models.AUTODETECT,
584+ params: {
585+ ...models.AUTODETECT.params,
586+ title: "Lemonade",
587+ },
588+ },
589+ ...openSourceModels,
590+ ],
591+ collectInputFor: [
592+ ...completionParamsInputsConfigs,
593+ {
594+ ...apiBaseInput,
595+ defaultValue: "http://localhost:8000/api/v1/",
596+ required: true,
597+ },
598+ ],
599+ downloadUrl: "http://lemonade-server.ai",
600+ },
569601 lmstudio: {
570602 title: "LM Studio",
571603 provider: "lmstudio",
modified gui/src/pages/config/index.tsx +4 −10
@@ -1,5 +1,5 @@
11 import { isOnPremSession } from "core/control-plane/AuthTypes";
2-import React, { useEffect, useState } from "react";
2+import React, { useState } from "react";
33 import { useNavigate, useSearchParams } from "react-router-dom";
44 import { AssistantAndOrgListbox } from "../../components/AssistantAndOrgListbox";
55 import Alert from "../../components/gui/Alert";
@@ -14,17 +14,11 @@
1414 useNavigationListener();
1515 const navigate = useNavigate();
1616 const [searchParams] = useSearchParams();
17- const [activeTab, setActiveTab] = useState("settings");
17+ const [activeTab, setActiveTab] = useState(() => {
18+ return searchParams.get("tab") || "settings";
19+ });
1820 const { session, organizations } = useAuth();
1921
20- // Set initial tab from URL parameter
21- useEffect(() => {
22- const tab = searchParams.get("tab");
23- if (tab) {
24- setActiveTab(tab);
25- }
26- }, [searchParams]);
27-
2822 const allTabs = getAllTabs();
2923 const shouldRenderOrgInfo =
3024 session && organizations.length > 1 && !isOnPremSession(session);
modified gui/src/pages/gui/Chat.tsx +21 −24
@@ -49,6 +49,8 @@
4949 import { EmptyChatBody } from "./EmptyChatBody";
5050 import { ExploreDialogWatcher } from "./ExploreDialogWatcher";
5151 import { useAutoScroll } from "./useAutoScroll";
52+import { useStore } from "react-redux";
53+import { RootState } from "../../redux/store";
5254
5355 // Helper function to find the index of the latest conversation summary
5456 function findLatestSummaryIndex(history: ChatHistoryItem[]): number {
@@ -98,13 +100,11 @@
98100 export function Chat() {
99101 const dispatch = useAppDispatch();
100102 const ideMessenger = useContext(IdeMessengerContext);
103+ const reduxStore = useStore<RootState>();
101104 const onboardingCard = useOnboardingCard();
102105 const showSessionTabs = useAppSelector(
103106 (store) => store.config.config.ui?.showSessionTabs,
104107 );
105- const selectedModels = useAppSelector(
106- (store) => store.config?.config.selectedModelByRole,
107- );
108108 const isStreaming = useAppSelector((state) => state.session.isStreaming);
109109 const [stepsOpen] = useState<(boolean | undefined)[]>([]);
110110 const mainTextInputRef = useRef<HTMLInputElement>(null);
@@ -115,7 +115,6 @@
115115 (state) => state.config.config.ui?.showChatScrollbar,
116116 );
117117 const codeToEdit = useAppSelector((state) => state.editModeState.codeToEdit);
118- const mode = useAppSelector((store) => store.session.mode);
119118 const isInEdit = useAppSelector((store) => store.session.isInEdit);
120119
121120 const lastSessionId = useAppSelector((state) => state.session.lastSessionId);
@@ -152,9 +151,6 @@
152151 isStreaming,
153152 );
154153
155- const pendingToolCalls = useAppSelector(selectPendingToolCalls);
156- const pendingApplyStates = useAppSelector(selectDoneApplyStates);
157-
158154 const sendInput = useCallback(
159155 (
160156 editorState: JSONContent,
@@ -162,8 +158,16 @@
162158 index?: number,
163159 editorToClearOnSend?: Editor,
164160 ) => {
161+ const stateSnapshot = reduxStore.getState();
162+ const latestPendingToolCalls = selectPendingToolCalls(stateSnapshot);
163+ const latestPendingApplyStates = selectDoneApplyStates(stateSnapshot);
164+ const isCurrentlyInEdit = stateSnapshot.session.isInEdit;
165+ const codeToEditSnapshot = stateSnapshot.editModeState.codeToEdit;
166+ const selectedModelByRole =
167+ stateSnapshot.config.config.selectedModelByRole;
168+
165169 // Cancel all pending tool calls
166- pendingToolCalls.forEach((toolCallState) => {
170+ latestPendingToolCalls.forEach((toolCallState) => {
167171 dispatch(
168172 cancelToolCall({
169173 toolCallId: toolCallState.toolCallId,
@@ -172,19 +176,20 @@
172176 });
173177
174178 // Reject all pending apply states
175- pendingApplyStates.forEach((applyState) => {
179+ latestPendingApplyStates.forEach((applyState) => {
176180 if (applyState.status !== "closed") {
177181 ideMessenger.post("rejectDiff", applyState);
178182 }
179183 });
180- const model = isInEdit
181- ? (selectedModels?.edit ?? selectedModels?.chat)
182- : selectedModels?.chat;
184+ const model = isCurrentlyInEdit
185+ ? (selectedModelByRole.edit ?? selectedModelByRole.chat)
186+ : selectedModelByRole.chat;
187+
183188 if (!model) {
184189 return;
185190 }
186191
187- if (isInEdit && codeToEdit.length === 0) {
192+ if (isCurrentlyInEdit && codeToEditSnapshot.length === 0) {
188193 return;
189194 }
190195
@@ -212,11 +217,11 @@
212217 // }
213218 // }
214219
215- if (isInEdit) {
220+ if (isCurrentlyInEdit) {
216221 void dispatch(
217222 streamEditThunk({
218223 editorState,
219- codeToEdit,
224+ codeToEdit: codeToEditSnapshot,
220225 }),
221226 );
222227 } else {
@@ -227,15 +232,7 @@
227232 }
228233 }
229234 },
230- [
231- history,
232- selectedModels,
233- mode,
234- isInEdit,
235- codeToEdit,
236- pendingToolCalls,
237- pendingApplyStates,
238- ],
235+ [dispatch, ideMessenger, reduxStore],
239236 );
240237
241238 useWebviewListener(
modified gui/src/pages/gui/ToolCallDiv/FindAndReplace.test.tsx +10 −3
@@ -19,9 +19,16 @@
1919 useFontSize: () => 14,
2020 }));
2121
22-vi.mock("../../../util/clientTools/findAndReplaceUtils", () => ({
23- performFindAndReplace: vi.fn(),
24-}));
22+vi.mock("../../../util/clientTools/findAndReplaceUtils", async () => {
23+ const actual = await vi.importActual(
24+ "../../../util/clientTools/findAndReplaceUtils",
25+ );
26+
27+ return {
28+ performFindAndReplace: vi.fn(),
29+ trimEmptyLines: actual.trimEmptyLines,
30+ };
31+});
2532
2633 vi.mock("./utils", () => ({
2734 getStatusIcon: vi.fn(() => <div data-testid="status-icon">✓</div>),
modified gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx +8 −3
@@ -13,7 +13,10 @@
1313 selectApplyStateByToolCallId,
1414 selectToolCallById,
1515 } from "../../../redux/selectors/selectToolCalls";
16-import { performFindAndReplace } from "../../../util/clientTools/findAndReplaceUtils";
16+import {
17+ performFindAndReplace,
18+ trimEmptyLines,
19+} from "../../../util/clientTools/findAndReplaceUtils";
1720 import { cn } from "../../../util/cn";
1821 import { getStatusIcon } from "./utils";
1922
@@ -313,14 +316,16 @@
313316 const showMiddleEllipses =
314317 !isFirst && !isLast && lines.length > MAX_SAME_LINES * 2 + 1;
315318
316- const startLines = showStartEllipsis
319+ let startLines = showStartEllipsis
317320 ? lines.slice(-MAX_SAME_LINES)
318321 : showMiddleEllipses || showEndEllipsis
319322 ? lines.slice(0, MAX_SAME_LINES)
320323 : lines;
321- const endLines = showMiddleEllipses
324+ startLines = trimEmptyLines({ lines: startLines, fromEnd: false });
325+ let endLines = showMiddleEllipses
322326 ? lines.slice(-MAX_SAME_LINES)
323327 : [];
328+ endLines = trimEmptyLines({ lines: endLines, fromEnd: true });
324329
325330 return (
326331 <div key={index}>
modified gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +0 −13
@@ -43,18 +43,6 @@
4343 }
4444 }
4545
46- function handleToggleClick() {
47- if (isToggleable) {
48- setOpen((prev) => !prev);
49- }
50- }
51-
52- function handleIconClick() {
53- if (isSingleItem) {
54- openContextItem(shownContextItems[0], ideMessenger);
55- }
56- }
57-
5846 return (
5947 <div className="mt-1 flex flex-col px-4">
6048 <div className="flex min-w-0 flex-row items-center justify-between gap-2">
@@ -69,7 +57,6 @@
6957 icon={Icon}
7058 isToggleable={isToggleable}
7159 open={shouldShowContent}
72- onClick={isToggleable ? handleToggleClick : handleIconClick}
7360 isClickable={isSingleItem}
7461 />
7562 <ToolCallStatusMessage tool={tool} toolCallState={toolCallState} />
modified gui/src/pages/gui/ToolCallDiv/index.tsx +9 −3
@@ -1,4 +1,7 @@
1-import { ArrowRightIcon } from "@heroicons/react/24/outline";
1+import {
2+ ArrowRightIcon,
3+ MagnifyingGlassIcon,
4+} from "@heroicons/react/24/outline";
25 import { ToolCallState } from "core";
36 import { BuiltInToolNames } from "core/tools/builtIn";
47 import { useState } from "react";
@@ -7,7 +10,7 @@
710 import { GroupedToolCallHeader } from "./GroupedToolCallHeader";
811 import { SimpleToolCallUI } from "./SimpleToolCallUI";
912 import { ToolCallDisplay } from "./ToolCallDisplay";
10-import { getStatusIcon, toolCallIcons } from "./utils";
13+import { getIconByName, getStatusIcon } from "./utils";
1114
1215 interface ToolCallDivProps {
1316 toolCallStates: ToolCallState[];
@@ -37,7 +40,10 @@
3740 (tool) => toolCallState.toolCall.function?.name === tool.function.name,
3841 );
3942 const functionName = toolCallState.toolCall.function?.name;
40- const icon = functionName && toolCallIcons[functionName];
43+ const icon =
44+ functionName && tool?.toolCallIcon
45+ ? getIconByName(tool.toolCallIcon)
46+ : undefined;
4147
4248 if (icon) {
4349 return (
modified gui/src/pages/gui/ToolCallDiv/utils.tsx +15 −32
@@ -1,25 +1,11 @@
1-import {
2- ArrowRightIcon,
3- CheckIcon,
4- CodeBracketIcon,
5- DocumentIcon,
6- DocumentTextIcon,
7- FolderIcon,
8- FolderOpenIcon,
9- GlobeAltIcon,
10- MagnifyingGlassIcon,
11- MapIcon,
12- PencilIcon,
13- XMarkIcon,
14-} from "@heroicons/react/24/outline";
1+import * as Icons from "@heroicons/react/24/outline";
152 import {
163 ContextItem,
174 ContextItemWithId,
185 ToolCallState,
196 ToolStatus,
207 } from "core";
21-import { BuiltInToolNames } from "core/tools/builtIn";
22-import { ComponentType } from "react";
8+import { ComponentType, SVGProps } from "react";
239 import { vscButtonBackground } from "../../../components";
2410 import Spinner from "../../../components/gui/Spinner";
2511
@@ -70,19 +56,16 @@
7056 return "Performing";
7157 }
7258
73-export const toolCallIcons: Record<string, ComponentType> = {
74- [BuiltInToolNames.FileGlobSearch]: MagnifyingGlassIcon,
75- [BuiltInToolNames.GrepSearch]: MagnifyingGlassIcon,
76- [BuiltInToolNames.LSTool]: FolderIcon,
77- [BuiltInToolNames.ReadCurrentlyOpenFile]: DocumentTextIcon,
78- [BuiltInToolNames.ReadFile]: DocumentIcon,
79- [BuiltInToolNames.FetchUrlContent]: GlobeAltIcon,
80- [BuiltInToolNames.SearchWeb]: GlobeAltIcon,
81- [BuiltInToolNames.ViewDiff]: CodeBracketIcon,
82- [BuiltInToolNames.ViewRepoMap]: MapIcon,
83- [BuiltInToolNames.ViewSubdirectory]: FolderOpenIcon,
84- [BuiltInToolNames.CreateRuleBlock]: PencilIcon,
85-};
59+type IconName = keyof typeof Icons;
60+
61+type Icon = ComponentType<SVGProps<SVGSVGElement>> | undefined;
62+
63+export function getIconByName(name: string): Icon | null {
64+ if (name in Icons) {
65+ return Icons[name as IconName] as Icon;
66+ }
67+ return null;
68+}
8669
8770 export function getStatusIcon(state: ToolStatus) {
8871 switch (state) {
@@ -90,12 +73,12 @@
9073 case "calling":
9174 return <Spinner />;
9275 case "generated":
93- return <ArrowRightIcon color={vscButtonBackground} />;
76+ return <Icons.ArrowRightIcon color={vscButtonBackground} />;
9477 case "done":
95- return <CheckIcon className="text-success" />;
78+ return <Icons.CheckIcon className="text-success" />;
9679 case "canceled":
9780 case "errored":
98- return <XMarkIcon className="text-error" />;
81+ return <Icons.XMarkIcon className="text-error" />;
9982 }
10083 }
10184
modified gui/src/util/clientTools/findAndReplaceUtils.test.ts +21 −0
@@ -4,6 +4,7 @@
44 EMPTY_NON_FIRST_EDIT_MESSAGE,
55 FOUND_MULTIPLE_FIND_STRINGS_ERROR,
66 performFindAndReplace,
7+ trimEmptyLines,
78 validateCreatingForMultiEdit,
89 validateSingleEdit,
910 } from "./findAndReplaceUtils";
@@ -454,3 +455,23 @@
454455 });
455456 });
456457 });
458+
459+describe("trimEmptyLines", () => {
460+ it("trims leading empty lines from start", () => {
461+ const input = ["", "", "a", "", "b"];
462+ const result = trimEmptyLines({ lines: input, fromEnd: false });
463+ expect(result).toEqual(["a", "", "b"]);
464+ });
465+
466+ it("trims trailing empty lines from end", () => {
467+ const input = ["a", "", "b", "", ""];
468+ const result = trimEmptyLines({ lines: input, fromEnd: true });
469+ expect(result).toEqual(["a", "", "b"]);
470+ });
471+
472+ it("returns empty array when all lines are empty", () => {
473+ const input = ["", "", ""];
474+ const result = trimEmptyLines({ lines: input, fromEnd: false });
475+ expect(result).toEqual([]);
476+ });
477+});
modified gui/src/util/clientTools/findAndReplaceUtils.ts +19 −0
@@ -95,3 +95,22 @@
9595
9696 return isCreating;
9797 }
98+
99+export function trimEmptyLines({
100+ lines,
101+ fromEnd,
102+}: {
103+ lines: string[];
104+ fromEnd: boolean;
105+}): string[] {
106+ lines = fromEnd ? lines.toReversed() : lines.slice();
107+ const newLines: string[] = [];
108+ let shouldContinueRemoving = true;
109+ for (let index = 0; index < lines.length; index++) {
110+ const line = lines[index];
111+ if (shouldContinueRemoving && line.trim() === "") continue;
112+ shouldContinueRemoving = false;
113+ newLines.push(line);
114+ }
115+ return fromEnd ? newLines.reverse() : newLines;
116+}
modified packages/config-yaml/package.json +1 −1
@@ -1,6 +1,6 @@
11 {
22 "name": "@continuedev/config-yaml",
3- "version": "1.14.0",
3+ "version": "1.17.0",
44 "description": "",
55 "main": "dist/index.js",
66 "types": "dist/index.d.ts",
modified packages/config-yaml/src/converter.ts +1 −0
@@ -193,6 +193,7 @@
193193 prompts,
194194 mcpServers,
195195 docs,
196+ requestOptions: configJson.requestOptions,
196197 };
197198
198199 return configYaml;
modified packages/config-yaml/src/interfaces/slugs.ts +11 −4
@@ -1,3 +1,5 @@
1+import os from "node:os";
2+
13 export interface PackageSlug {
24 ownerSlug: string;
35 packageSlug: string;
@@ -61,13 +63,18 @@
6163 fileUri: identifier.substring(7),
6264 };
6365 }
64- // Otherwise, it's a slug
65- else {
66+ // support ~ by replacing with home directory
67+ else if (identifier.startsWith("~")) {
6668 return {
67- uriType: "slug",
68- fullSlug: decodeFullSlug(identifier),
69+ uriType: "file",
70+ fileUri: identifier.replace("~", os.homedir()),
6971 };
7072 }
73+ // Otherwise, it's a slug
74+ return {
75+ uriType: "slug",
76+ fullSlug: decodeFullSlug(identifier),
77+ };
7178 }
7279
7380 export enum VirtualTags {
added packages/config-yaml/src/load/merge.test.ts +235 −0
@@ -0,0 +1,235 @@
1+import { describe, expect, it } from "@jest/globals";
2+import type { RequestOptions } from "../schemas/models.js";
3+import { mergeConfigYamlRequestOptions } from "./merge.js";
4+
5+describe("mergeConfigYamlRequestOptions", () => {
6+ it("should return undefined when both base and global are undefined", () => {
7+ const result = mergeConfigYamlRequestOptions(undefined, undefined);
8+ expect(result).toBeUndefined();
9+ });
10+
11+ it("should return global when base is undefined", () => {
12+ const global: RequestOptions = {
13+ timeout: 5000,
14+ verifySsl: true,
15+ headers: { Authorization: "Bearer token" },
16+ };
17+ const result = mergeConfigYamlRequestOptions(undefined, global);
18+ expect(result).toEqual(global);
19+ });
20+
21+ it("should return base when global is undefined", () => {
22+ const base: RequestOptions = {
23+ timeout: 3000,
24+ verifySsl: false,
25+ headers: { "X-Custom": "value" },
26+ };
27+ const result = mergeConfigYamlRequestOptions(base, undefined);
28+ expect(result).toEqual(base);
29+ });
30+
31+ it("should merge headers from both objects", () => {
32+ const base: RequestOptions = {
33+ headers: { "X-Base": "base-value", "X-Common": "base-common" },
34+ };
35+ const global: RequestOptions = {
36+ headers: { "X-Global": "global-value", "X-Common": "global-common" },
37+ };
38+ const result = mergeConfigYamlRequestOptions(base, global);
39+ expect(result?.headers).toEqual({
40+ "X-Global": "global-value",
41+ "X-Common": "base-common", // base overrides global
42+ "X-Base": "base-value",
43+ });
44+ });
45+
46+ it("should override simple values with base values", () => {
47+ const base: RequestOptions = {
48+ timeout: 3000,
49+ verifySsl: false,
50+ proxy: "http://base-proxy.com",
51+ };
52+ const global: RequestOptions = {
53+ timeout: 5000,
54+ verifySsl: true,
55+ proxy: "http://global-proxy.com",
56+ caBundlePath: "/path/to/ca",
57+ };
58+ const result = mergeConfigYamlRequestOptions(base, global);
59+ expect(result).toEqual({
60+ timeout: 3000, // base overrides
61+ verifySsl: false, // base overrides
62+ proxy: "http://base-proxy.com", // base overrides
63+ caBundlePath: "/path/to/ca", // only in global
64+ headers: undefined,
65+ });
66+ });
67+
68+ it("should handle noProxy array properly (base overrides)", () => {
69+ const base: RequestOptions = {
70+ noProxy: ["localhost", "127.0.0.1"],
71+ };
72+ const global: RequestOptions = {
73+ noProxy: ["192.168.1.1", "example.com"],
74+ };
75+ const result = mergeConfigYamlRequestOptions(base, global);
76+ expect(result?.noProxy).toEqual(["localhost", "127.0.0.1"]); // base overrides completely
77+ });
78+
79+ it("should handle extraBodyProperties (base overrides)", () => {
80+ const base: RequestOptions = {
81+ extraBodyProperties: { baseProp: "baseValue", common: "base" },
82+ };
83+ const global: RequestOptions = {
84+ extraBodyProperties: { globalProp: "globalValue", common: "global" },
85+ };
86+ const result = mergeConfigYamlRequestOptions(base, global);
87+ expect(result?.extraBodyProperties).toEqual({
88+ baseProp: "baseValue",
89+ common: "base",
90+ }); // base overrides completely
91+ });
92+
93+ it("should handle clientCertificate (base overrides)", () => {
94+ const base: RequestOptions = {
95+ clientCertificate: {
96+ cert: "base-cert",
97+ key: "base-key",
98+ passphrase: "base-pass",
99+ },
100+ };
101+ const global: RequestOptions = {
102+ clientCertificate: {
103+ cert: "global-cert",
104+ key: "global-key",
105+ },
106+ };
107+ const result = mergeConfigYamlRequestOptions(base, global);
108+ expect(result?.clientCertificate).toEqual({
109+ cert: "base-cert",
110+ key: "base-key",
111+ passphrase: "base-pass",
112+ }); // base overrides completely
113+ });
114+
115+ it("should return undefined headers when both have empty headers", () => {
116+ const base: RequestOptions = {
117+ headers: {},
118+ timeout: 1000,
119+ };
120+ const global: RequestOptions = {
121+ headers: {},
122+ verifySsl: true,
123+ };
124+ const result = mergeConfigYamlRequestOptions(base, global);
125+ expect(result?.headers).toBeUndefined();
126+ expect(result?.timeout).toBe(1000);
127+ expect(result?.verifySsl).toBe(true);
128+ });
129+
130+ it("should handle caBundlePath as string", () => {
131+ const base: RequestOptions = {
132+ caBundlePath: "/base/ca.pem",
133+ };
134+ const global: RequestOptions = {
135+ caBundlePath: "/global/ca.pem",
136+ };
137+ const result = mergeConfigYamlRequestOptions(base, global);
138+ expect(result?.caBundlePath).toBe("/base/ca.pem"); // base overrides
139+ });
140+
141+ it("should handle caBundlePath as array", () => {
142+ const base: RequestOptions = {
143+ caBundlePath: ["/base/ca1.pem", "/base/ca2.pem"],
144+ };
145+ const global: RequestOptions = {
146+ caBundlePath: ["/global/ca.pem"],
147+ };
148+ const result = mergeConfigYamlRequestOptions(base, global);
149+ expect(result?.caBundlePath).toEqual(["/base/ca1.pem", "/base/ca2.pem"]); // base overrides
150+ });
151+
152+ it("should preserve all fields from base when global has different fields", () => {
153+ const base: RequestOptions = {
154+ timeout: 3000,
155+ headers: { "X-Base": "value" },
156+ noProxy: ["localhost"],
157+ };
158+ const global: RequestOptions = {
159+ verifySsl: true,
160+ proxy: "http://proxy.com",
161+ caBundlePath: "/ca.pem",
162+ };
163+ const result = mergeConfigYamlRequestOptions(base, global);
164+ expect(result).toEqual({
165+ timeout: 3000,
166+ verifySsl: true,
167+ proxy: "http://proxy.com",
168+ caBundlePath: "/ca.pem",
169+ headers: { "X-Base": "value" },
170+ noProxy: ["localhost"],
171+ });
172+ });
173+
174+ it("should handle complex header merging scenario", () => {
175+ const base: RequestOptions = {
176+ headers: {
177+ Authorization: "Bearer base-token",
178+ "X-Custom-Header": "base-custom",
179+ "Content-Type": "application/json",
180+ },
181+ };
182+ const global: RequestOptions = {
183+ headers: {
184+ Authorization: "Bearer global-token",
185+ "X-Global-Header": "global-value",
186+ "Accept-Language": "en-US",
187+ },
188+ };
189+ const result = mergeConfigYamlRequestOptions(base, global);
190+ expect(result?.headers).toEqual({
191+ Authorization: "Bearer base-token", // base overrides
192+ "X-Global-Header": "global-value", // from global
193+ "Accept-Language": "en-US", // from global
194+ "X-Custom-Header": "base-custom", // from base
195+ "Content-Type": "application/json", // from base
196+ });
197+ });
198+
199+ it("should handle all possible fields", () => {
200+ const base: RequestOptions = {
201+ timeout: 1000,
202+ verifySsl: false,
203+ caBundlePath: ["/base/ca.pem"],
204+ proxy: "http://base-proxy.com",
205+ headers: { "X-Base": "base" },
206+ extraBodyProperties: { baseProp: true },
207+ noProxy: ["base.local"],
208+ clientCertificate: { cert: "base-cert", key: "base-key" },
209+ };
210+ const global: RequestOptions = {
211+ timeout: 2000,
212+ verifySsl: true,
213+ caBundlePath: ["/global/ca.pem"],
214+ proxy: "http://global-proxy.com",
215+ headers: { "X-Global": "global" },
216+ extraBodyProperties: { globalProp: false },
217+ noProxy: ["global.local"],
218+ clientCertificate: { cert: "global-cert", key: "global-key" },
219+ };
220+ const result = mergeConfigYamlRequestOptions(base, global);
221+ expect(result).toEqual({
222+ timeout: 1000, // base overrides
223+ verifySsl: false, // base overrides
224+ caBundlePath: ["/base/ca.pem"], // base overrides
225+ proxy: "http://base-proxy.com", // base overrides
226+ headers: {
227+ "X-Global": "global",
228+ "X-Base": "base",
229+ }, // merged
230+ extraBodyProperties: { baseProp: true }, // base overrides
231+ noProxy: ["base.local"], // base overrides
232+ clientCertificate: { cert: "base-cert", key: "base-key" }, // base overrides
233+ });
234+ });
235+});
modified packages/config-yaml/src/load/merge.ts +35 −0
@@ -1,3 +1,4 @@
1+import { RequestOptions } from "../browser.js";
12 import { AssistantUnrolled, ConfigYaml } from "../schemas/index.js";
23
34 export function mergePackages(
@@ -14,6 +15,10 @@
1415 prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])],
1516 docs: [...(current.docs ?? []), ...(incoming.docs ?? [])],
1617 env: { ...current.env, ...incoming.env },
18+ requestOptions: mergeConfigYamlRequestOptions(
19+ current.requestOptions,
20+ incoming.requestOptions,
21+ ),
1722 };
1823 }
1924
@@ -31,5 +36,35 @@
3136 mcpServers: [...(current.mcpServers ?? []), ...(incoming.mcpServers ?? [])],
3237 prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])],
3338 env: { ...current.env, ...incoming.env },
39+ requestOptions: mergeConfigYamlRequestOptions(
40+ current.requestOptions,
41+ incoming.requestOptions,
42+ ),
43+ };
44+}
45+
46+export function mergeConfigYamlRequestOptions(
47+ base: RequestOptions | undefined,
48+ global: RequestOptions | undefined,
49+): RequestOptions | undefined {
50+ if (!base && !global) {
51+ return undefined;
52+ }
53+ if (!base) {
54+ return global;
55+ }
56+ if (!global) {
57+ return base;
58+ }
59+
60+ const headers = {
61+ ...global.headers,
62+ ...base.headers,
63+ };
64+
65+ return {
66+ ...global,
67+ ...base, // base overrides for simple values as well as noProxy and extraBodyProperties
68+ headers: Object.keys(headers).length === 0 ? undefined : headers, // headers are the only thing that really merge
3469 };
3570 }
modified packages/config-yaml/src/load/unroll.ts +23 −3
@@ -1,5 +1,6 @@
11 import * as YAML from "yaml";
22 import { ZodError } from "zod";
3+import { mergeConfigYamlRequestOptions, RequestOptions } from "../browser.js";
34 import { PlatformClient, Registry } from "../interfaces/index.js";
45 import { encodeSecretLocation } from "../interfaces/SecretResult.js";
56 import {
@@ -203,6 +204,7 @@
203204 injectBlocks?: PackageIdentifier[];
204205 allowlistedBlocks?: PackageSlug[];
205206 blocklistedBlocks?: PackageSlug[];
207+ injectRequestOptions?: RequestOptions;
206208 }
207209
208210 export interface DoNotRenderSecretsUnrollAssistantOptions
@@ -274,6 +276,7 @@
274276 options.injectBlocks,
275277 options.allowlistedBlocks,
276278 options.blocklistedBlocks,
279+ options.injectRequestOptions,
277280 );
278281
279282 // Back to a string so we can fill in template variables
@@ -302,14 +305,14 @@
302305 const renderedYaml = renderTemplateData(templatedYaml, { secrets });
303306
304307 // Parse again and replace models with proxy versions where secrets weren't rendered
305- const finalConfig = useProxyForUnrenderedSecrets(
308+ const renderedConfig = useProxyForUnrenderedSecrets(
306309 parseAssistantUnrolled(renderedYaml),
307310 id,
308311 options.orgScopeId,
309312 options.onPremProxyUrl,
310313 );
311314
312- return { config: finalConfig, errors, configLoadInterrupted };
315+ return { config: renderedConfig, errors, configLoadInterrupted };
313316 }
314317
315318 function isPackageAllowed(
@@ -350,6 +353,7 @@
350353 injectBlocks: PackageIdentifier[] | undefined,
351354 allowlistedBlocks?: PackageSlug[],
352355 blocklistedBlocks?: PackageSlug[],
356+ injectRequestOptions?: RequestOptions,
353357 ): Promise<ConfigResult<AssistantUnrolled>> {
354358 const errors: ConfigValidationError[] = [];
355359
@@ -363,11 +367,27 @@
363367 const unrolledAssistant: AssistantUnrolled = {
364368 name: assistant.name,
365369 version: assistant.version,
370+ requestOptions: assistant.requestOptions,
366371 };
367372
373+ if (injectRequestOptions) {
374+ unrolledAssistant.requestOptions = mergeConfigYamlRequestOptions(
375+ assistant.requestOptions,
376+ injectRequestOptions,
377+ );
378+ } else {
379+ unrolledAssistant.requestOptions = assistant.requestOptions;
380+ }
381+
368382 const sections: (keyof Omit<
369383 ConfigYaml,
370- "name" | "version" | "rules" | "schema" | "metadata" | "env"
384+ | "name"
385+ | "version"
386+ | "rules"
387+ | "schema"
388+ | "metadata"
389+ | "env"
390+ | "requestOptions"
371391 >)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"];
372392
373393 // Process all sections in parallel
modified packages/config-yaml/src/markdown/createMarkdownRule.ts +5 −0
@@ -36,6 +36,7 @@
3636 globs?: string | string[];
3737 regex?: string | string[];
3838 alwaysApply?: boolean;
39+ invokable?: boolean;
3940 } = {},
4041 ): string {
4142 const frontmatter: RuleFrontmatter = {};
@@ -54,6 +55,10 @@
5455 frontmatter.description = options.description.trim();
5556 }
5657
58+ if (options.invokable !== undefined) {
59+ frontmatter.invokable = options.invokable;
60+ }
61+
5762 if (options.alwaysApply !== undefined) {
5863 frontmatter.alwaysApply = options.alwaysApply;
5964 }
modified packages/config-yaml/src/schemas/index.ts +2 −0
@@ -117,6 +117,7 @@
117117 schema: z.string().optional(),
118118 metadata: z.record(z.string()).and(commonMetadataSchema.partial()).optional(),
119119 env: envRecord.optional(),
120+ requestOptions: requestOptionsSchema.optional(),
120121 });
121122
122123 const modelsUsesSchema = z
@@ -262,6 +263,7 @@
262263 api_base: z.string().optional(),
263264 api_key: z.string().optional(),
264265 env: envRecord.optional(),
266+ requestOptions: requestOptionsSchema.optional(),
265267 });
266268
267269 export type Config = z.infer<typeof configSchema>;
modified packages/continue-sdk/package-lock.json +2 −2
@@ -20,10 +20,10 @@
2020 },
2121 "../config-yaml": {
2222 "name": "@continuedev/config-yaml",
23- "version": "1.0.96",
23+ "version": "1.14.0",
2424 "license": "Apache-2.0",
2525 "dependencies": {
26- "@continuedev/config-types": "file:../config-types",
26+ "@continuedev/config-types": "^1.0.14",
2727 "yaml": "^2.6.1",
2828 "zod": "^3.24.2"
2929 },
modified packages/llm-info/src/providers/os.ts +1 −0
@@ -4,5 +4,6 @@
44 {
55 model: "starcoder2:3b",
66 displayName: "StarCoder 2 3B",
7+ contextLength: 8192,
78 },
89 ];
modified packages/openai-adapters/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified packages/openai-adapters/package.json +1 −1
@@ -1,6 +1,6 @@
11 {
22 "name": "@continuedev/openai-adapters",
3- "version": "1.14.0",
3+ "version": "1.15.0",
44 "description": "",
55 "main": "dist/index.js",
66 "types": "dist/index.d.ts",
modified packages/openai-adapters/src/apis/Anthropic.ts +23 −3
@@ -140,9 +140,25 @@
140140 ],
141141 };
142142 } else if (message.role === "assistant" && message.tool_calls) {
143- return {
144- role: "assistant",
145- content: message.tool_calls.map((toolCall) => {
143+ const parts: any[] = [];
144+ if (message.content) {
145+ if (typeof message.content === "string") {
146+ parts.push({
147+ type: "text",
148+ text: message.content,
149+ });
150+ } else if (message.content.length > 0) {
151+ parts.push(
152+ message.content.map((c) => ({
153+ type: "text",
154+ text: c.type === "text" ? c.text : c.refusal,
155+ })),
156+ );
157+ }
158+ }
159+
160+ parts.push(
161+ ...message.tool_calls.map((toolCall) => {
146162 // Type guard for function tool calls
147163 if (toolCall.type === "function" && "function" in toolCall) {
148164 return {
@@ -158,6 +174,10 @@
158174 throw new Error(`Unsupported tool call type: ${toolCall.type}`);
159175 }
160176 }),
177+ );
178+ return {
179+ role: "assistant",
180+ content: parts,
161181 };
162182 }
163183
modified packages/openai-adapters/src/test/main.test.ts +4 −2
@@ -12,6 +12,7 @@
1212 export interface TestConfigOptions {
1313 skipTools: boolean;
1414 expectUsage?: boolean;
15+ skipSystemMessage?: boolean;
1516 }
1617
1718 function testConfig(_config: ModelConfig & { options?: TestConfigOptions }) {
@@ -98,9 +99,9 @@
9899 },
99100 {
100101 provider: "mistral",
101- model: "codestral",
102+ model: "codestral-latest",
102103 apiKey: process.env.MISTRAL_API_KEY!,
103- roles: ["chat"],
104+ roles: ["chat", "autocomplete"],
104105 options: {
105106 skipTools: false,
106107 expectUsage: true,
@@ -150,6 +151,7 @@
150151 options: {
151152 skipTools: true,
152153 expectUsage: true,
154+ skipSystemMessage: true,
153155 },
154156 },
155157 {
modified packages/openai-adapters/src/test/util.ts +24 −22
@@ -210,26 +210,28 @@
210210 });
211211
212212 test("should acknowledge system message in chat", async () => {
213- const response = await api.chatCompletionNonStream(
214- {
215- model,
216- messages: [
217- {
218- role: "system",
219- content:
220- "Regardless of what is asked of you, your answer should start with 'RESPONSE: '.",
221- },
222- { role: "user", content: "Who are you?" },
223- ],
224- stream: false,
225- },
226- new AbortController().signal,
227- );
228- expect(response.choices.length).toBeGreaterThan(0);
229- const completion = response.choices[0].message.content;
230- expect(typeof completion).toBe("string");
231- expect(completion?.length).toBeGreaterThan(0);
232- expect(completion?.startsWith("RESPONSE: ")).toBe(true);
213+ if (options?.skipSystemMessage !== true) {
214+ const response = await api.chatCompletionNonStream(
215+ {
216+ model,
217+ messages: [
218+ {
219+ role: "system",
220+ content:
221+ "Regardless of what is asked of you, your answer should start with 'RESPONSE: '.",
222+ },
223+ { role: "user", content: "Who are you?" },
224+ ],
225+ stream: false,
226+ },
227+ new AbortController().signal,
228+ );
229+ expect(response.choices.length).toBeGreaterThan(0);
230+ const completion = response.choices[0].message.content;
231+ expect(typeof completion).toBe("string");
232+ expect(completion?.length).toBeGreaterThan(0);
233+ expect(completion?.startsWith("RESPONSE: ")).toBe(true);
234+ }
233235 });
234236
235237 if (options?.skipTools === false) {
@@ -315,14 +317,14 @@
315317 arguments: '{"name":"Nate"}',
316318 name: "say_hello",
317319 },
318- id: "tool_call_1",
320+ id: "toolcall1", // mistral requires alphanumeric length of 9
319321 type: "function",
320322 },
321323 ],
322324 },
323325 {
324326 role: "tool",
325- tool_call_id: "tool_call_1",
327+ tool_call_id: "toolcall1",
326328 content: "Nate was greeted",
327329 },
328330 ],