Elffuss BraidHub

kikocis/continue public

Merge branch 'main' of https://github.com/continuedev/continue into uinstinct/cli-danger-command
Changesetdf04de9d7ffe87078a1f0f7e57fd48a7122bc28ebace634903b6af63c8f768c5
AuthorDallin Romney <dallinromney@gmail.com> · 2025-09-25 16:54 -07:00
CommitterDallin Romney <dallinromney@gmail.com> · 2025-09-25 16:54 -07:00
Parentsece2990dc091, 5314170e5809

Browse the files at this changeset

101 files changed

added .continue/environment.json +3 −0
@@ -0,0 +1,3 @@
1+{
2+ "install": "npm i"
3+}
modified .github/workflows/release-llm-info.yml +7 −12
@@ -1,11 +1,17 @@
11 name: Release @continuedev/llm-info
2-
32 on:
43 push:
54 branches:
65 - main
76 paths:
87 - "packages/llm-info/**"
8+ - ".github/workflows/release-llm-info.yml"
9+ - ".github/workflows/reusable-release.yml"
10+
11+permissions:
12+ contents: write
13+ issues: write
14+ pull-requests: write
915
1016 jobs:
1117 release:
@@ -16,14 +22,3 @@
1622 secrets:
1723 SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
1824 SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
19- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
20- ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
21- GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
22- MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
23- AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
24- AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }}
25- 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 }}
27- VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
28- RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
29- INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
deleted .github/workflows/respond-to-cubic.yaml +0 −302
@@ -1,302 +0,0 @@
1-name: Respond to @continuedev Comments
2-
3-on:
4- issue_comment:
5- types: [created]
6- pull_request_review_comment:
7- types: [created]
8-
9-permissions:
10- contents: write
11- pull-requests: write
12- issues: write
13-
14-jobs:
15- respond-to-comment:
16- # Only run on pull request comments
17- if: github.event_name == 'issue_comment' && github.event.issue.pull_request
18- runs-on: ubuntu-latest
19-
20- steps:
21- - name: Check if comment contains @continuedev
22- id: check-mention
23- run: |
24- # Create a temporary file to safely handle comment body with special characters
25- cat > /tmp/comment.txt << 'COMMENT_EOF'
26- ${{ github.event.comment.body }}
27- COMMENT_EOF
28-
29- if grep -q "@continuedev" /tmp/comment.txt; then
30- echo "contains_mention=true" >> $GITHUB_OUTPUT
31- else
32- echo "contains_mention=false" >> $GITHUB_OUTPUT
33- fi
34-
35- - name: Add eyes reaction to comment
36- if: steps.check-mention.outputs.contains_mention == 'true'
37- uses: actions/github-script@v8
38- with:
39- script: |
40- await github.rest.reactions.createForIssueComment({
41- owner: context.repo.owner,
42- repo: context.repo.repo,
43- comment_id: ${{ github.event.comment.id }},
44- content: 'eyes'
45- });
46-
47- - name: Checkout PR branch
48- if: steps.check-mention.outputs.contains_mention == 'true'
49- uses: actions/checkout@v5
50- with:
51- token: ${{ secrets.GITHUB_TOKEN }}
52- fetch-depth: 0
53-
54- - name: Get PR information
55- if: steps.check-mention.outputs.contains_mention == 'true'
56- id: pr-info
57- uses: actions/github-script@v8
58- with:
59- script: |
60- const { data: pr } = await github.rest.pulls.get({
61- owner: context.repo.owner,
62- repo: context.repo.repo,
63- pull_number: context.issue.number
64- });
65-
66- core.setOutput('head_ref', pr.head.ref);
67- core.setOutput('head_sha', pr.head.sha);
68- return pr;
69-
70- - name: Checkout PR branch
71- if: steps.check-mention.outputs.contains_mention == 'true'
72- run: |
73- git checkout ${{ steps.pr-info.outputs.head_ref }}
74-
75- - name: Setup Node.js
76- if: steps.check-mention.outputs.contains_mention == 'true'
77- uses: actions/setup-node@v5
78- with:
79- node-version: "20"
80-
81- - name: Install Continue CLI globally
82- if: steps.check-mention.outputs.contains_mention == 'true'
83- run: npm i -g @continuedev/cli
84-
85- - name: Start remote session
86- if: steps.check-mention.outputs.contains_mention == 'true'
87- id: remote-session
88- env:
89- CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
90- run: |
91- # Create a temporary file for the prompt to handle special characters and newlines properly
92- cat > /tmp/prompt.txt << 'PROMPT_EOF'
93- Please help with the following request from @${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}:
94-
95- ${{ github.event.comment.body }}
96-
97- Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch.
98- PROMPT_EOF
99-
100- # Debug output
101- echo "PROMPT content:"
102- cat /tmp/prompt.txt
103-
104- # Start remote session and capture JSON output
105- echo "Starting cn with prompt..."
106- SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ steps.pr-info.outputs.head_ref }})
107- echo "Raw session output: $SESSION_OUTPUT"
108-
109- # Extract URL from JSON output
110- SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
111-
112- if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
113- echo "Failed to extract session URL from output: $SESSION_OUTPUT"
114- exit 1
115- fi
116-
117- echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
118- echo "✅ Started remote session: $SESSION_URL"
119-
120- - name: Comment with session URL
121- if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
122- uses: actions/github-script@v8
123- env:
124- ORIGINAL_COMMENT: ${{ github.event.comment.body }}
125- with:
126- script: |
127- const sessionUrl = '${{ steps.remote-session.outputs.session_url }}';
128- const originalComment = process.env.ORIGINAL_COMMENT;
129- const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment;
130-
131- await github.rest.issues.createComment({
132- owner: context.repo.owner,
133- repo: context.repo.repo,
134- issue_number: context.issue.number,
135- body: commentBody
136- });
137-
138- - name: Log session details
139- if: steps.check-mention.outputs.contains_mention == 'true'
140- run: |
141- echo "✅ Successfully started remote session for comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}"
142- echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
143- echo "Original comment:"
144- cat /tmp/comment.txt
145-
146- respond-to-review-comment:
147- # Only run on pull request review comments
148- if: github.event_name == 'pull_request_review_comment'
149- runs-on: ubuntu-latest
150-
151- steps:
152- - name: Check if comment contains @continuedev
153- id: check-mention
154- run: |
155- # Create a temporary file to safely handle comment body with special characters
156- cat > /tmp/review_comment.txt << 'COMMENT_EOF'
157- ${{ github.event.comment.body }}
158- COMMENT_EOF
159-
160- if grep -q "@continuedev" /tmp/review_comment.txt; then
161- echo "contains_mention=true" >> $GITHUB_OUTPUT
162- else
163- echo "contains_mention=false" >> $GITHUB_OUTPUT
164- fi
165-
166- - name: Add eyes reaction to comment
167- if: steps.check-mention.outputs.contains_mention == 'true'
168- uses: actions/github-script@v8
169- with:
170- script: |
171- await github.rest.reactions.createForPullRequestReviewComment({
172- owner: context.repo.owner,
173- repo: context.repo.repo,
174- comment_id: ${{ github.event.comment.id }},
175- content: 'eyes'
176- });
177-
178- - name: Checkout PR branch
179- if: steps.check-mention.outputs.contains_mention == 'true'
180- uses: actions/checkout@v5
181- with:
182- token: ${{ secrets.GITHUB_TOKEN }}
183- fetch-depth: 0
184- ref: ${{ github.event.pull_request.head.ref }}
185-
186- - name: Setup Node.js
187- if: steps.check-mention.outputs.contains_mention == 'true'
188- uses: actions/setup-node@v5
189- with:
190- node-version: "20"
191-
192- - name: Install Continue CLI globally
193- if: steps.check-mention.outputs.contains_mention == 'true'
194- run: npm i -g @continuedev/cli
195-
196- - name: Get review context
197- if: steps.check-mention.outputs.contains_mention == 'true'
198- id: review-context
199- uses: actions/github-script@v8
200- with:
201- script: |
202- let reviewContext = '';
203-
204- // Check if this comment is a reply to another review comment
205- if (context.payload.comment.in_reply_to_id) {
206- try {
207- const { data: originalComment } = await github.rest.pulls.getReviewComment({
208- owner: context.repo.owner,
209- repo: context.repo.repo,
210- comment_id: context.payload.comment.in_reply_to_id
211- });
212-
213- reviewContext = `**Original review comment by @${originalComment.user.login}:**
214- ${originalComment.body}
215-
216- **Reply by @${{ github.event.comment.user.login }}:**
217- ${{ github.event.comment.body }}`;
218- } catch (error) {
219- console.log('Could not fetch original comment, using current comment only');
220- reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
221- ${{ github.event.comment.body }}`;
222- }
223- } else {
224- reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
225- ${{ github.event.comment.body }}`;
226- }
227-
228- core.setOutput('context', reviewContext);
229-
230- - name: Start remote session
231- if: steps.check-mention.outputs.contains_mention == 'true'
232- id: remote-session
233- env:
234- CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
235- run: |
236- # Debug: Echo the branch we're starting the session on
237- echo "Starting remote session on branch: ${{ github.event.pull_request.head.ref }}"
238-
239- # Create a temporary file for the prompt to handle special characters and newlines properly
240- cat > /tmp/prompt.txt << 'PROMPT_EOF'
241- Please help with the following code review discussion from PR #${{ github.event.pull_request.number }}:
242-
243- **File:** ${{ github.event.comment.path }}
244- **Line:** ${{ github.event.comment.line || github.event.comment.original_line || 'N/A' }}
245-
246- ${{ steps.review-context.outputs.context }}
247-
248- Please analyze the specific file and line mentioned, understand the review feedback and any discussion context, implement the necessary changes, and commit them to this branch.
249- PROMPT_EOF
250-
251- # Debug output
252- echo "PROMPT content:"
253- cat /tmp/prompt.txt
254-
255- # Start remote session and capture JSON output
256- echo "Starting cn with prompt..."
257- SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ github.event.pull_request.head.ref }})
258- echo "Raw session output: $SESSION_OUTPUT"
259-
260- # Extract URL from JSON output
261- SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
262-
263- if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
264- echo "Failed to extract session URL from output: $SESSION_OUTPUT"
265- exit 1
266- fi
267-
268- echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
269- echo "✅ Started remote session: $SESSION_URL"
270-
271- - name: Comment with session URL
272- if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
273- uses: actions/github-script@v8
274- env:
275- ORIGINAL_COMMENT: ${{ github.event.comment.body }}
276- with:
277- script: |
278- const sessionUrl = '${{ steps.remote-session.outputs.session_url }}';
279- const originalComment = process.env.ORIGINAL_COMMENT;
280- const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment;
281-
282- const commentParams = {
283- owner: context.repo.owner,
284- repo: context.repo.repo,
285- pull_number: ${{ github.event.pull_request.number }},
286- body: commentBody,
287- commit_id: '${{ github.event.pull_request.head.sha }}',
288- path: '${{ github.event.comment.path }}',
289- in_reply_to: ${{ github.event.comment.id }}
290- };
291-
292- await github.rest.pulls.createReviewComment(commentParams);
293-
294- - name: Log session details
295- if: steps.check-mention.outputs.contains_mention == 'true'
296- run: |
297- echo "✅ Successfully started remote session for review comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}"
298- echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
299- echo "File: ${{ github.event.comment.path }}"
300- echo "Line: ${{ github.event.comment.line }}"
301- echo "Original comment:"
302- cat /tmp/review_comment.txt
modified .gitignore +4 −1
@@ -172,4 +172,7 @@
172172 .continuerules
173173 **/.continue/assistants/
174174 **/.continue/agents/
175-keys
No newline at the end of the file
175+keys
176+
177+.channels_cache.json
178+.users_cache.json
added .husky/pre-commit +1 −0
@@ -0,0 +1,1 @@
1+npx lint-staged
modified .prettierignore +6 −1
@@ -11,9 +11,13 @@
1111 extensions/vscode/bin
1212 extensions/vscode/build
1313 extensions/vscode/out
14+extensions/vscode/textmate-syntaxes
1415 extensions/vscode/gui
1516 extensions/vscode/e2e/.test-extensions
1617 extensions/vscode/e2e/test-continue
18+extensions/vscode/e2e/_output
19+extensions/vscode/e2e/storage
20+extensions/vscode/e2e/vsix
1721 extensions/vscode/models
1822 extensions/intellij/src/main/resources
1923 gui/dist
@@ -26,4 +30,5 @@
2630 core/vendor
2731 coverage
2832 # e2e
29-packages/continue-sdk
No newline at the end of the file
33+packages/continue-sdk
34+.conductor
No newline at the end of the file
modified CONTRIBUTING.md +1 −1
@@ -252,7 +252,7 @@
252252 3. If your provider supports images, add it to the `PROVIDER_SUPPORTS_IMAGES` array
253253 in [core/llm/autodetect.ts](./core/llm/autodetect.ts).
254254 4. Add a documentation page for your provider in [
255- `docs/docs/customize/model-providers/more`](./docs/docs/customize/model-providers/more). This should show an example
255+ `docs/customize/model-providers/more`](./docs/customize/model-providers/more). This should show an example
256256 of configuring your provider in `config.yaml` and explain what options are available.
257257
258258 ### Adding Models
modified core/config/markdown/utils.ts +10 −4
@@ -4,6 +4,15 @@
44 } from "@continuedev/config-yaml";
55 import { joinPathsToUri } from "../../util/uri";
66
7+function createRelativeRuleFilePathParts(ruleName: string): string[] {
8+ const safeRuleName = sanitizeRuleName(ruleName);
9+ return [".continue", "rules", `${safeRuleName}.${RULE_FILE_EXTENSION}`];
10+}
11+
12+export function createRelativeRuleFilePath(ruleName: string): string {
13+ return createRelativeRuleFilePathParts(ruleName).join("/");
14+}
15+
716 /**
817 * Creates the file path for a rule in the workspace .continue/rules directory
918 */
@@ -11,11 +20,8 @@
1120 workspaceDir: string,
1221 ruleName: string,
1322 ): string {
14- const safeRuleName = sanitizeRuleName(ruleName);
1523 return joinPathsToUri(
1624 workspaceDir,
17- ".continue",
18- "rules",
19- `${safeRuleName}.${RULE_FILE_EXTENSION}`,
25+ ...createRelativeRuleFilePathParts(ruleName),
2026 );
2127 }
modified core/context/mcp/MCPConnection.ts +1 −0
@@ -85,6 +85,7 @@
8585 }
8686
8787 async disconnect() {
88+ this.status = "not-connected";
8889 this.abortController.abort();
8990 await this.client.close();
9091 await this.transport.close();
modified core/context/mcp/MCPManagerSingleton.ts +26 −3
@@ -13,6 +13,7 @@
1313
1414 public onConnectionsRefreshed?: () => void;
1515 public connections: Map<string, MCPConnection> = new Map();
16+ private disconnectedServers: string[] = [];
1617
1718 private abortController: AbortController = new AbortController();
1819
@@ -25,6 +26,18 @@
2526 return MCPManagerSingleton.instance;
2627 }
2728
29+ addDisconnectedServer(serverId: string) {
30+ this.disconnectedServers.push(serverId);
31+ }
32+ removeDisconnectedServer(serverId: string) {
33+ this.disconnectedServers = this.disconnectedServers.filter(
34+ (server) => server !== serverId,
35+ );
36+ }
37+ getDisconnectedServers() {
38+ return this.disconnectedServers;
39+ }
40+
2841 createConnection(id: string, options: MCPOptions): MCPConnection {
2942 if (this.connections.has(id)) {
3043 return this.connections.get(id)!;
@@ -163,9 +176,19 @@
163176 }),
164177 (async () => {
165178 await Promise.all(
166- Array.from(this.connections.values()).map(async (connection) => {
167- await connection.connectClient(force, this.abortController.signal);
168- }),
179+ Array.from(this.connections.values())
180+ .filter(
181+ (connection) =>
182+ !this.disconnectedServers.some(
183+ (s) => s === connection.options.id,
184+ ),
185+ )
186+ .map(async (connection) => {
187+ await connection.connectClient(
188+ force,
189+ this.abortController.signal,
190+ );
191+ }),
169192 );
170193 if (this.onConnectionsRefreshed) {
171194 this.onConnectionsRefreshed();
modified core/context/mcp/MCPOauth.ts +2 −2
@@ -12,7 +12,7 @@
1212
1313 import http from "http";
1414 import url from "url";
15-import crypto from "crypto";
15+import { v4 as uuidv4 } from "uuid";
1616 import { GlobalContext, GlobalContextType } from "../../util/GlobalContext";
1717
1818 // Use a Map to support concurrent authentications for different servers
@@ -249,7 +249,7 @@
249249 await authProvider.ensureRedirectUrl();
250250
251251 // Generate a unique state parameter for this auth flow
252- const state = crypto.randomUUID();
252+ const state = uuidv4();
253253
254254 // Store context for this specific server with state
255255 authenticatingContexts.set(mcpServerUrl, {
modified core/core.ts +14 −0
@@ -492,6 +492,20 @@
492492
493493 on("mcp/reloadServer", async (msg) => {
494494 await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id);
495+ MCPManagerSingleton.getInstance().removeDisconnectedServer(msg.data.id);
496+ });
497+ on("mcp/disconnectServer", async (msg) => {
498+ const mcpConnection = MCPManagerSingleton.getInstance().getConnection(
499+ msg.data.id,
500+ );
501+ if (!mcpConnection)
502+ throw new Error(`MCP connection with id ${msg.data.id} not found`);
503+ MCPManagerSingleton.getInstance().addDisconnectedServer(msg.data.id);
504+ await mcpConnection.disconnect();
505+ await this.configHandler.refreshAll("MCP Servers disconnected");
506+ });
507+ on("mcp/getDisconnectedServers", async (_msg) => {
508+ return MCPManagerSingleton.getInstance().getDisconnectedServers();
495509 });
496510 on("mcp/getPrompt", async (msg) => {
497511 const { serverName, promptName, args } = msg.data;
modified core/llm/constants.ts +2 −0
@@ -2,6 +2,7 @@
22 const DEFAULT_CONTEXT_LENGTH = 32_768;
33 const DEFAULT_TEMPERATURE = 0.5;
44 const DEFAULT_PRUNING_LENGTH = 128000;
5+const DEFAULT_REASONING_TOKENS = 2048;
56
67 const DEFAULT_ARGS = {
78 maxTokens: DEFAULT_MAX_TOKENS,
@@ -31,5 +32,6 @@
3132 DEFAULT_MAX_CHUNK_SIZE,
3233 DEFAULT_MAX_TOKENS,
3334 DEFAULT_PRUNING_LENGTH,
35+ DEFAULT_REASONING_TOKENS,
3436 PROXY_URL,
3537 };
modified core/llm/index.ts +9 −8
@@ -65,7 +65,6 @@
6565 toCompleteBody,
6666 toFimBody,
6767 } from "./openaiTypeConverters.js";
68-
6968 export class LLMError extends Error {
7069 constructor(
7170 message: string,
@@ -214,7 +213,7 @@
214213 this.providerName === "continue-proxy"
215214 ? this.model?.split("/").pop() || this.model
216215 : this.model;
217- const llmInfo = findLlmInfo(modelSearchString);
216+ const llmInfo = findLlmInfo(modelSearchString, this.underlyingProviderName);
218217
219218 const templateType =
220219 options.template ?? autodetectTemplateType(options.model);
@@ -558,12 +557,14 @@
558557 private _formatChatMessage(msg: ChatMessage): string {
559558 let contentToShow = renderChatMessage(msg);
560559 if (msg.role === "assistant" && msg.toolCalls?.length) {
561- contentToShow += msg.toolCalls
562- ?.map(
563- (toolCall) =>
564- `${toolCall.function?.name}(${toolCall.function?.arguments})`,
565- )
566- .join("\n");
560+ contentToShow +=
561+ "\n" +
562+ msg.toolCalls
563+ ?.map(
564+ (toolCall) =>
565+ `${toolCall.function?.name}(${toolCall.function?.arguments})`,
566+ )
567+ .join("\n");
567568 }
568569
569570 return `<${msg.role}>\n${contentToShow}\n\n`;
modified core/llm/llm-pre-fetch.vitest.ts +4 −0
@@ -58,6 +58,10 @@
5858 describe("LLM Pre-fetch", () => {
5959 beforeEach(() => {
6060 vi.resetAllMocks();
61+ // Mock getAnthropicHeaders to return fake headers
62+ vi.mocked(openAiAdapters.getAnthropicHeaders).mockReturnValue({
63+ fake: "headers",
64+ });
6165 // Log to verify the mock is properly set up
6266 console.log("Mock setup:", openAiAdapters);
6367 });
modified core/llm/llms/Anthropic.ts +224 −194
@@ -1,30 +1,36 @@
1+import {
2+ Tool as AnthropicTool,
3+ ContentBlockParam,
4+ MessageCreateParams,
5+ MessageParam,
6+ RawContentBlockDeltaEvent,
7+ RawContentBlockStartEvent,
8+ RawMessageDeltaEvent,
9+ RawMessageStartEvent,
10+ RawMessageStreamEvent,
11+ ToolUseBlock,
12+} from "@anthropic-ai/sdk/resources/messages.mjs";
113 import { streamSse } from "@continuedev/fetch";
14+import {
15+ addCacheControlToLastTwoUserMessages,
16+ getAnthropicErrorMessage,
17+ getAnthropicHeaders,
18+ getAnthropicMediaTypeFromDataUrl,
19+} from "@continuedev/openai-adapters";
220 import {
321 ChatMessage,
422 CompletionOptions,
523 LLMOptions,
24+ MessageContent,
25+ Tool,
26+ ToolCallDelta,
627 Usage,
728 } from "../../index.js";
829 import { safeParseToolCallArgs } from "../../tools/parseArgs.js";
930 import { renderChatMessage, stripImages } from "../../util/messageContent.js";
31+import { DEFAULT_REASONING_TOKENS } from "../constants.js";
1032 import { BaseLLM } from "../index.js";
1133
12-const errorMessages = {
13- invalid_request_error:
14- "There was an issue with the format or content of your request.",
15- authentication_error: "There's an issue with your API key.",
16- permission_error:
17- "Your API key does not have permission to use the specified resource.",
18- not_found_error: "The requested resource was not found.",
19- request_too_large:
20- "Request exceeds the maximum allowed number of bytes (32 MB limit).",
21- rate_limit_error: "Your account has hit a rate limit.",
22- api_error:
23- "An unexpected error has occurred internal to Anthropic's systems.",
24- overloaded_error:
25- "Anthropic's API is temporarily overloaded. Please check their status page: https://status.anthropic.com/#past-incidents",
26-};
27-
2834 class Anthropic extends BaseLLM {
2935 static providerName = "anthropic";
3036 static defaultOptions: Partial<LLMOptions> = {
@@ -36,8 +42,21 @@
3642 apiBase: "https://api.anthropic.com/v1/",
3743 };
3844
39- public convertArgs(options: CompletionOptions) {
40- // should be public for use within VertexAI
45+ private convertToolToAnthropicTool(tool: Tool): AnthropicTool {
46+ return {
47+ name: tool.function.name,
48+ description: tool.function.description,
49+ input_schema: (tool.function.parameters as AnthropicTool.InputSchema) ?? {
50+ // TODO unsafe tool.function.parameters casting
51+ type: "object",
52+ },
53+ };
54+ }
55+
56+ // Public for use within VertexAI
57+ public convertArgs(
58+ options: CompletionOptions,
59+ ): Omit<MessageCreateParams, "messages"> {
4160 const finalOptions = {
4261 top_k: options.topK,
4362 top_p: options.topP,
@@ -46,20 +65,17 @@
4665 model: options.model === "claude-2" ? "claude-2.1" : options.model,
4766 stop_sequences: options.stop?.filter((x) => x.trim() !== ""),
4867 stream: options.stream ?? true,
49- tools: options.tools?.map((tool) => ({
50- name: tool.function.name,
51- description: tool.function.description,
52- input_schema: tool.function.parameters,
53- })),
68+ tools: options.tools?.map(this.convertToolToAnthropicTool),
5469 thinking: options.reasoning
5570 ? {
56- type: "enabled",
57- budget_tokens: options.reasoningBudgetTokens,
71+ type: "enabled" as const,
72+ budget_tokens:
73+ options.reasoningBudgetTokens ?? DEFAULT_REASONING_TOKENS,
5874 }
5975 : undefined,
6076 tool_choice: options.toolChoice
6177 ? {
62- type: "tool",
78+ type: "tool" as const,
6379 name: options.toolChoice.function.name,
6480 }
6581 : undefined,
@@ -68,138 +84,146 @@
6884 return finalOptions;
6985 }
7086
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" };
87+ private convertMessageContentToBlocks(
88+ content: MessageContent,
89+ ): ContentBlockParam[] {
90+ if (typeof content === "string") {
91+ return [
92+ {
93+ type: "text",
94+ text: content,
95+ },
96+ ];
7897 }
79- return part;
98+ return content.map((part) => {
99+ if (part.type === "text") {
100+ return {
101+ type: "text",
102+ text: part.text,
103+ };
104+ }
105+ return {
106+ type: "image",
107+ source: {
108+ type: "base64",
109+ media_type: getAnthropicMediaTypeFromDataUrl(part.imageUrl.url),
110+ data: part.imageUrl.url.split(",")[1],
111+ },
112+ };
113+ });
80114 }
81115
82- private convertMessage(message: ChatMessage, addCaching: boolean): any {
83- if (message.role === "tool") {
116+ private convertToolCallsToBlocks(
117+ toolCall: ToolCallDelta,
118+ ): ToolUseBlock | undefined {
119+ const toolCallId = toolCall.id;
120+ const toolName = toolCall.function?.name;
121+ if (toolCallId && toolName) {
84122 return {
85- role: "user",
86- content: [
123+ type: "tool_use",
124+ id: toolCallId,
125+ name: toolName,
126+ input: safeParseToolCallArgs(toolCall),
127+ };
128+ }
129+ }
130+
131+ private getContentBlocksFromChatMessage(
132+ message: ChatMessage,
133+ ): ContentBlockParam[] {
134+ switch (message.role) {
135+ // One tool message = one tool_result block
136+ case "tool":
137+ return [
87138 {
88139 type: "tool_result",
89140 tool_use_id: message.toolCallId,
90141 content: renderChatMessage(message) || undefined,
91142 },
92- ],
93- };
94- } else if (message.role === "assistant" && message.toolCalls) {
95- const parts: any[] = [];
96- if (message.content) {
143+ ];
144+ case "user":
145+ return this.convertMessageContentToBlocks(message.content);
146+ case "thinking":
147+ if (message.redactedThinking) {
148+ return [
149+ {
150+ type: "redacted_thinking",
151+ data: message.redactedThinking,
152+ },
153+ ];
154+ }
97155 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);
156+ return [
157+ {
158+ type: "thinking",
159+ thinking: message.content,
160+ signature: message.signature ?? "", // TODO - unsafe signature
161+ },
162+ ];
106163 }
107- }
108- parts.push(
109- ...message.toolCalls.map((toolCall) => ({
110- type: "tool_use",
111- id: toolCall.id,
112- name: toolCall.function?.name,
113- input: safeParseToolCallArgs(toolCall),
114- })),
115- );
116- return {
117- role: "assistant",
118- content: parts,
119- };
120- } else if (message.role === "thinking" && !message.redactedThinking) {
121- return {
122- role: "assistant",
123- content: [
124- {
125- type: "thinking",
126- thinking: message.content,
127- signature: message.signature,
128- },
129- ],
130- };
131- } else if (message.role === "thinking" && message.redactedThinking) {
132- return {
133- role: "assistant",
134- content: [
135- {
136- type: "redacted_thinking",
137- data: message.redactedThinking,
138- },
139- ],
140- };
164+ const textParts = message.content.filter((p) => p.type === "text");
165+ return textParts.map((part) => ({
166+ type: "thinking",
167+ thinking: part.text,
168+ signature: message.signature ?? "", // TODO - unsafe signature
169+ }));
170+ case "assistant":
171+ const blocks: ContentBlockParam[] = this.convertMessageContentToBlocks(
172+ message.content,
173+ );
174+ // If any tool calls are present, always put them last
175+ // Loses order vs what was originally sent, but they typically come last
176+ for (const toolCall of message.toolCalls ?? []) {
177+ const block = this.convertToolCallsToBlocks(toolCall);
178+ if (block) {
179+ blocks.push(block);
180+ }
181+ }
182+ return blocks;
183+ // system, etc.
184+ default:
185+ return [];
141186 }
187+ }
142188
143- if (typeof message.content === "string") {
144- var chatMessage = {
145- role: message.role,
146- content: [
147- {
148- type: "text",
149- text: message.content,
150- ...(addCaching ? { cache_control: { type: "ephemeral" } } : {}),
151- },
152- ],
153- };
154- return chatMessage;
189+ public convertMessages(
190+ msgs: ChatMessage[],
191+ cachePrompt: boolean,
192+ ): MessageParam[] {
193+ const nonSystemMessages = msgs.filter((m) => m.role !== "system");
194+
195+ const convertedMessages: MessageParam[] = [];
196+ let currentRole: "user" | "assistant" | undefined = undefined;
197+ let currentParts: ContentBlockParam[] = [];
198+
199+ const flushCurrentMessage = () => {
200+ if (currentRole && currentParts.length > 0) {
201+ convertedMessages.push({
202+ role: currentRole,
203+ content: currentParts,
204+ });
205+ currentParts = [];
206+ }
207+ };
208+
209+ for (const message of nonSystemMessages) {
210+ const newRole =
211+ message.role === "user" || message.role === "tool"
212+ ? "user"
213+ : "assistant";
214+ if (currentRole !== newRole) {
215+ flushCurrentMessage();
216+ currentRole = newRole;
217+ }
218+ currentParts.push(...this.getContentBlocksFromChatMessage(message));
155219 }
220+ flushCurrentMessage();
156221
157- return {
158- role: message.role,
159- content: message.content.map((part, contentIdx) => {
160- if (part.type === "text") {
161- const newpart = {
162- ...part,
163- // If multiple text parts, only add cache_control to the last one
164- ...(addCaching && contentIdx === message.content.length - 1
165- ? { cache_control: { type: "ephemeral" } }
166- : {}),
167- };
168- return newpart;
169- }
170- return {
171- type: "image",
172- source: {
173- type: "base64",
174- media_type: "image/jpeg",
175- data: part.imageUrl?.url.split(",")[1],
176- },
177- };
178- }),
179- };
180- }
222+ if (cachePrompt) {
223+ addCacheControlToLastTwoUserMessages(convertedMessages);
224+ }
181225
182- public convertMessages(msgs: ChatMessage[]): any[] {
183- // should be public for use within VertexAI
184- const filteredmessages = msgs.filter((m) => m.role !== "system");
185- const lastTwoUserMsgIndices = filteredmessages
186- .map((msg, index) => (msg.role === "user" ? index : -1))
187- .filter((index) => index !== -1)
188- .slice(-2);
189-
190- const messages = filteredmessages.map((message, filteredMsgIdx) => {
191- // Add cache_control parameter to the last two user messages
192- // The second-to-last because it retrieves potentially already cached contents,
193- // The last one because we want it cached for later retrieval.
194- // See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
195- const addCaching =
196- this.cacheBehavior?.cacheConversation &&
197- lastTwoUserMsgIndices.includes(filteredMsgIdx);
198-
199- const chatMessage = this.convertMessage(message, !!addCaching);
200- return chatMessage;
201- });
202- return messages;
226+ return convertedMessages;
203227 }
204228
205229 protected async *_streamComplete(
@@ -224,12 +248,7 @@
224248 if (!response.ok) {
225249 const json = await response.json();
226250 if (json.type === "error") {
227- if (json.error?.type in errorMessages) {
228- throw new Error(
229- errorMessages[json.error.type as keyof typeof errorMessages],
230- );
231- }
232- throw new Error(json.message);
251+ throw new Error(getAnthropicErrorMessage(json));
233252 }
234253 throw new Error(
235254 `Anthropic API sent back ${response.status}: ${JSON.stringify(json)}`,
@@ -237,17 +256,17 @@
237256 }
238257
239258 if (stream === false) {
240- const data = await response.json();
241- const cost = data.usage
259+ const json = await response.json();
260+ const cost = json.usage
242261 ? {
243- inputTokens: data.usage.input_tokens,
244- outputTokens: data.usage.output_tokens,
245- totalTokens: data.usage.input_tokens + data.usage.output_tokens,
262+ inputTokens: json.usage.input_tokens,
263+ outputTokens: json.usage.output_tokens,
264+ totalTokens: json.usage.input_tokens + json.usage.output_tokens,
246265 }
247266 : {};
248267 yield {
249268 role: "assistant",
250- content: data.content[0].text,
269+ content: json.content[0].text,
251270 ...(Object.keys(cost).length > 0 ? { cost } : {}),
252271 };
253272 return;
@@ -264,51 +283,59 @@
264283 },
265284 };
266285
267- for await (const value of streamSse(response)) {
286+ for await (const event of streamSse(response)) {
268287 // https://docs.anthropic.com/en/api/messages-streaming#event-types
269- switch (value.type) {
288+ const rawEvent = event as RawMessageStreamEvent;
289+ switch (event.type) {
270290 case "message_start":
271291 // Capture initial usage information
272- usage.promptTokens = value.message.usage.input_tokens;
292+ const startEvent = rawEvent as RawMessageStartEvent;
293+ usage.promptTokens = startEvent.message.usage.input_tokens;
273294 usage.promptTokensDetails!.cachedTokens =
274- value.message.usage.cache_read_input_tokens;
295+ startEvent.message.usage.cache_read_input_tokens ?? undefined;
275296 usage.promptTokensDetails!.cacheWriteTokens =
276- value.message.usage.cache_creation_input_tokens;
297+ startEvent.message.usage.cache_creation_input_tokens ?? undefined;
277298 break;
278299 case "message_delta":
279300 // Update usage information during streaming
280- if (value.usage) {
281- usage.completionTokens = value.usage.output_tokens;
301+ const deltaEvent = rawEvent as RawMessageDeltaEvent;
302+ if (deltaEvent.usage) {
303+ usage.completionTokens = deltaEvent.usage.output_tokens;
282304 }
283305 break;
284306 case "content_block_start":
285- if (value.content_block.type === "tool_use") {
286- lastToolUseId = value.content_block.id;
287- lastToolUseName = value.content_block.name;
307+ const blockStartEvent = rawEvent as RawContentBlockStartEvent;
308+ if (blockStartEvent.content_block.type === "tool_use") {
309+ lastToolUseId = blockStartEvent.content_block.id;
310+ lastToolUseName = blockStartEvent.content_block.name;
288311 }
289312 // handle redacted thinking
290- if (value.content_block.type === "redacted_thinking") {
313+ if (blockStartEvent.content_block.type === "redacted_thinking") {
291314 yield {
292315 role: "thinking",
293316 content: "",
294- redactedThinking: value.content_block.data,
317+ redactedThinking: blockStartEvent.content_block.data,
295318 };
296319 }
297320 break;
298321 case "content_block_delta":
299322 // https://docs.anthropic.com/en/api/messages-streaming#delta-types
300- switch (value.delta.type) {
323+ const blockDeltaEvent = rawEvent as RawContentBlockDeltaEvent;
324+ switch (blockDeltaEvent.delta.type) {
301325 case "text_delta":
302- yield { role: "assistant", content: value.delta.text };
326+ yield { role: "assistant", content: blockDeltaEvent.delta.text };
303327 break;
304328 case "thinking_delta":
305- yield { role: "thinking", content: value.delta.thinking };
329+ yield {
330+ role: "thinking",
331+ content: blockDeltaEvent.delta.thinking,
332+ };
306333 break;
307334 case "signature_delta":
308335 yield {
309336 role: "thinking",
310337 content: "",
311- signature: value.delta.signature,
338+ signature: blockDeltaEvent.delta.signature,
312339 };
313340 break;
314341 case "input_json_delta":
@@ -324,7 +351,7 @@
324351 type: "function",
325352 function: {
326353 name: lastToolUseName,
327- arguments: value.delta.partial_json,
354+ arguments: blockDeltaEvent.delta.partial_json,
328355 },
329356 },
330357 ],
@@ -365,32 +392,35 @@
365392 const shouldCacheSystemMessage = !!(
366393 this.cacheBehavior?.cacheSystemMessage && systemMessage
367394 );
395+ const shouldCachePrompt = !!(
396+ this.cacheBehavior?.cacheConversation ||
397+ this.completionOptions.promptCaching
398+ );
399+
400+ const msgs = this.convertMessages(messages, shouldCachePrompt);
401+ const headers = getAnthropicHeaders(
402+ this.apiKey,
403+ shouldCacheSystemMessage || shouldCachePrompt,
404+ );
405+
406+ const body: MessageCreateParams = {
407+ ...this.convertArgs(options),
408+ messages: msgs,
409+ system: shouldCacheSystemMessage
410+ ? [
411+ {
412+ type: "text",
413+ text: systemMessage,
414+ cache_control: { type: "ephemeral" },
415+ },
416+ ]
417+ : systemMessage,
418+ };
368419
369- const msgs = this.convertMessages(messages);
370420 const response = await this.fetch(new URL("messages", this.apiBase), {
371421 method: "POST",
372- headers: {
373- "Content-Type": "application/json",
374- Accept: "application/json",
375- "anthropic-version": "2023-06-01",
376- "x-api-key": this.apiKey as string,
377- ...(shouldCacheSystemMessage || this.cacheBehavior?.cacheConversation
378- ? { "anthropic-beta": "prompt-caching-2024-07-31" }
379- : {}),
380- },
381- body: JSON.stringify({
382- ...this.convertArgs(options),
383- messages: msgs,
384- system: shouldCacheSystemMessage
385- ? [
386- {
387- type: "text",
388- text: systemMessage,
389- cache_control: { type: "ephemeral" },
390- },
391- ]
392- : systemMessage,
393- }),
422+ headers,
423+ body: JSON.stringify(body),
394424 signal,
395425 });
396426
added core/llm/llms/CometAPI.ts +358 −0
@@ -0,0 +1,358 @@
1+import { LLMOptions } from "../../index.js";
2+import { allModelProviders } from "@continuedev/llm-info";
3+import OpenAI from "./OpenAI.js";
4+
5+/**
6+ * CometAPI-specific error types for better error handling
7+ */
8+export class CometAPIError extends Error {
9+ constructor(
10+ message: string,
11+ public code?: string,
12+ public statusCode?: number,
13+ ) {
14+ super(message);
15+ this.name = "CometAPIError";
16+ }
17+}
18+
19+export class CometAPIAuthenticationError extends CometAPIError {
20+ constructor(message: string = "Invalid CometAPI API key") {
21+ super(message, "AUTHENTICATION_ERROR", 401);
22+ this.name = "CometAPIAuthenticationError";
23+ }
24+}
25+
26+export class CometAPIQuotaExceededError extends CometAPIError {
27+ constructor(message: string = "CometAPI quota exceeded") {
28+ super(message, "QUOTA_EXCEEDED", 429);
29+ this.name = "CometAPIQuotaExceededError";
30+ }
31+}
32+
33+/**
34+ * CometAPI LLM provider - aggregates multiple mainstream models
35+ * from various providers (GPT, Claude, Gemini, Grok, DeepSeek, Qwen, etc.)
36+ *
37+ * Uses OpenAI-compatible API format with bearer token authentication
38+ */
39+class CometAPI extends OpenAI {
40+ static providerName = "cometapi";
41+
42+ static defaultOptions: Partial<LLMOptions> = {
43+ apiBase: "https://api.cometapi.com/v1/",
44+ model: "gpt-4o-mini", // Default to a commonly available model
45+ };
46+
47+ constructor(options: LLMOptions) {
48+ // Validate required configuration before calling super
49+ CometAPI.validateConfig(options);
50+ super(options);
51+
52+ // Align contextLength with llm-info for cometapi specifically (non-breaking for others)
53+ try {
54+ const cometProvider = allModelProviders.find((p) => p.id === "cometapi");
55+ const info = cometProvider?.models.find((m) =>
56+ m.regex ? m.regex.test(this.model) : m.model === this.model,
57+ );
58+ if (info?.contextLength) {
59+ // Always prefer cometapi-specific llm-info over generic provider matches
60+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
61+ // @ts-ignore - accessing protected for targeted fix
62+ this._contextLength = info.contextLength;
63+ }
64+ } catch {
65+ // no-op: do not fail construction on metadata issues
66+ }
67+ }
68+
69+ /**
70+ * Validate CometAPI configuration
71+ */
72+ private static validateConfig(options: LLMOptions): void {
73+ // Allow constructing without API key (tests that only instantiate should pass).
74+ // Enforce credentials at request time instead.
75+ if (!options.apiKey) {
76+ if (typeof process !== "undefined" && process.env?.NODE_ENV !== "test") {
77+ console.warn(
78+ "CometAPI: No API key provided. Requests will fail until an API key is configured. Get one at https://api.cometapi.com/console/token",
79+ );
80+ }
81+ return;
82+ }
83+
84+ if (options.apiBase && !CometAPI.isValidApiBase(options.apiBase)) {
85+ throw new CometAPIError(
86+ `Invalid CometAPI base URL: ${options.apiBase}. Expected https://api.cometapi.com/v1/ or compatible endpoint`,
87+ );
88+ }
89+
90+ if (
91+ options.model &&
92+ !CometAPI.isValidModelFormat(options.model) &&
93+ typeof process !== "undefined" &&
94+ process.env?.NODE_ENV !== "test"
95+ ) {
96+ console.warn(
97+ `CometAPI: Model "${options.model}" may not be supported. Check CometAPI documentation for available models.`,
98+ );
99+ }
100+ }
101+
102+ /**
103+ * Validate API base URL format
104+ */
105+ private static isValidApiBase(apiBase: string): boolean {
106+ try {
107+ const url = new URL(apiBase);
108+ return (
109+ url.protocol === "https:" &&
110+ (url.hostname === "api.cometapi.com" ||
111+ url.hostname.endsWith(".cometapi.com") ||
112+ apiBase.includes("v1")) // Allow custom compatible endpoints
113+ );
114+ } catch {
115+ return false;
116+ }
117+ }
118+
119+ /**
120+ * Basic model format validation
121+ */
122+ private static isValidModelFormat(model: string): boolean {
123+ // Allow common model patterns
124+ const validPatterns = [
125+ /^gpt-/i,
126+ /^claude-/i,
127+ /^gemini-/i,
128+ /^grok/i,
129+ /^deepseek/i,
130+ /^qwen/i,
131+ /^text-/i,
132+ /^chat/i,
133+ ];
134+
135+ return validPatterns.some((pattern) => pattern.test(model));
136+ }
137+
138+ /**
139+ * Patterns to filter out non-chat models from the model list
140+ * Based on CometAPI documentation requirements
141+ */
142+ private static IGNORE_PATTERNS = [
143+ // Image generation models
144+ "dall-e",
145+ "dalle",
146+ "midjourney",
147+ "mj_",
148+ "stable-diffusion",
149+ "sd-",
150+ "flux-",
151+ "playground-v",
152+ "ideogram",
153+ "recraft-",
154+ "black-forest-labs",
155+ "/recraft-v3",
156+ "recraftv3",
157+ "stability-ai/",
158+ "sdxl",
159+
160+ // Audio generation models
161+ "suno_",
162+ "tts",
163+ "whisper",
164+
165+ // Video generation models
166+ "runway",
167+ "luma_",
168+ "luma-",
169+ "veo",
170+ "kling_",
171+ "minimax_video",
172+ "hunyuan-t1",
173+
174+ // Utility models
175+ "embedding",
176+ "search-gpts",
177+ "files_retrieve",
178+ "moderation",
179+ ];
180+
181+ /**
182+ * Recommended chat models from CometAPI documentation
183+ */
184+ private static RECOMMENDED_MODELS = [
185+ // GPT series
186+ "gpt-5-chat-latest",
187+ "chatgpt-4o-latest",
188+ "gpt-5-mini",
189+ "gpt-5-nano",
190+ "gpt-5",
191+ "gpt-4.1-mini",
192+ "gpt-4.1-nano",
193+ "gpt-4.1",
194+ "gpt-4o-mini",
195+ "o4-mini-2025-04-16",
196+ "o3-pro-2025-06-10",
197+
198+ // Claude series
199+ "claude-opus-4-1-20250805",
200+ "claude-opus-4-1-20250805-thinking",
201+ "claude-sonnet-4-20250514",
202+ "claude-sonnet-4-20250514-thinking",
203+ "claude-3-7-sonnet-latest",
204+ "claude-3-5-haiku-latest",
205+
206+ // Gemini series
207+ "gemini-2.5-pro",
208+ "gemini-2.5-flash",
209+ "gemini-2.5-flash-lite",
210+ "gemini-2.0-flash",
211+
212+ // Grok series
213+ "grok-4-0709",
214+ "grok-3",
215+ "grok-3-mini",
216+ "grok-2-image-1212",
217+
218+ // DeepSeek series
219+ "deepseek-v3.1",
220+ "deepseek-v3",
221+ "deepseek-r1-0528",
222+ "deepseek-chat",
223+ "deepseek-reasoner",
224+
225+ // Qwen series
226+ "qwen3-30b-a3b",
227+ "qwen3-coder-plus-2025-07-22",
228+ ];
229+
230+ /**
231+ * Filter model list to exclude non-chat models
232+ * Uses pattern matching against model names
233+ */
234+ protected filterChatModels(models: any[]): any[] {
235+ if (!models || !Array.isArray(models)) {
236+ return [];
237+ }
238+
239+ return models.filter((model) => {
240+ const modelId = model.id || model.model || "";
241+ const modelName = modelId.toLowerCase();
242+
243+ // Check if model matches any ignore pattern
244+ const shouldIgnore = CometAPI.IGNORE_PATTERNS.some((pattern) =>
245+ modelName.includes(pattern.toLowerCase()),
246+ );
247+
248+ return !shouldIgnore;
249+ });
250+ }
251+
252+ /**
253+ * Get recommended models for CometAPI
254+ * Returns predefined list since CometAPI model info is limited
255+ */
256+ protected getRecommendedModels(): string[] {
257+ return [...CometAPI.RECOMMENDED_MODELS];
258+ }
259+
260+ /**
261+ * Override listModels method to apply model filtering with enhanced error handling
262+ */
263+ async listModels(): Promise<string[]> {
264+ try {
265+ const allModels = await super.listModels();
266+ const filteredModels = this.filterChatModels(
267+ allModels.map((id) => ({ id })),
268+ );
269+
270+ // If filtered list is empty or very limited, return recommended models
271+ if (filteredModels.length < 5) {
272+ console.info(
273+ "CometAPI: Limited models available, using recommended set",
274+ );
275+ return this.getRecommendedModels();
276+ }
277+
278+ return filteredModels.map((model) => model.id);
279+ } catch (error: any) {
280+ // Enhanced error handling with specific error types
281+ const errorMessage = error?.message || "Unknown error";
282+ const statusCode = error?.status || error?.statusCode;
283+
284+ if (statusCode === 401) {
285+ throw new CometAPIAuthenticationError(
286+ "CometAPI authentication failed. Please check your API key.",
287+ );
288+ } else if (statusCode === 429) {
289+ throw new CometAPIQuotaExceededError(
290+ "CometAPI rate limit exceeded. Please try again later.",
291+ );
292+ } else if (statusCode >= 400 && statusCode < 500) {
293+ throw new CometAPIError(
294+ `CometAPI client error: ${errorMessage}`,
295+ "CLIENT_ERROR",
296+ statusCode,
297+ );
298+ } else if (statusCode >= 500) {
299+ console.warn(
300+ "CometAPI server error, falling back to recommended models:",
301+ errorMessage,
302+ );
303+ return this.getRecommendedModels();
304+ } else {
305+ // Network or other errors - fallback gracefully
306+ console.warn(
307+ "CometAPI: Failed to fetch model list, using recommended models",
308+ errorMessage,
309+ );
310+ return this.getRecommendedModels();
311+ }
312+ }
313+ }
314+
315+ /**
316+ * Override chat completion with enhanced error handling
317+ */
318+ protected async *_streamChat(
319+ messages: any[],
320+ signal: AbortSignal,
321+ options: any = {},
322+ ): AsyncGenerator<any> {
323+ try {
324+ yield* super._streamChat(messages, signal, options);
325+ } catch (error: any) {
326+ const statusCode = error?.status || error?.statusCode;
327+ const errorMessage = error?.message || "Unknown error";
328+
329+ if (statusCode === 401) {
330+ throw new CometAPIAuthenticationError(
331+ "CometAPI authentication failed during chat completion",
332+ );
333+ } else if (statusCode === 429) {
334+ throw new CometAPIQuotaExceededError(
335+ "CometAPI rate limit exceeded during chat completion",
336+ );
337+ } else if (
338+ errorMessage.includes("model") &&
339+ errorMessage.includes("not found")
340+ ) {
341+ throw new CometAPIError(
342+ `Model "${this.model}" is not available on CometAPI. Please check available models.`,
343+ "MODEL_NOT_FOUND",
344+ 404,
345+ );
346+ } else {
347+ // Re-throw with more context
348+ throw new CometAPIError(
349+ `CometAPI chat completion failed: ${errorMessage}`,
350+ "COMPLETION_ERROR",
351+ statusCode,
352+ );
353+ }
354+ }
355+ }
356+}
357+
358+export default CometAPI;
modified core/llm/llms/OpenAI-compatible-core.vitest.ts +11 −0
@@ -13,6 +13,7 @@
1313 import Cerebras from "./Cerebras.js";
1414 import DeepInfra from "./DeepInfra.js";
1515 import Nvidia from "./Nvidia.js";
16+import CometAPI from "./CometAPI.js";
1617
1718 // Base OpenAI tests
1819 import { afterEach, describe, expect, test, vi } from "vitest";
@@ -292,3 +293,13 @@
292293 truncate: "END",
293294 },
294295 });
296+
297+createOpenAISubclassTests(CometAPI, {
298+ providerName: "cometapi",
299+ defaultApiBase: "https://api.cometapi.com/v1/",
300+ modelConversions: {
301+ "gpt-5-mini": "gpt-5-mini",
302+ "claude-4-sonnet": "claude-sonnet-4-20250514",
303+ },
304+ modelConversionContent: "hello",
305+});
modified core/llm/llms/VertexAI.ts +9 −2
@@ -223,6 +223,10 @@
223223 const shouldCacheSystemMessage = !!(
224224 this.cacheBehavior?.cacheSystemMessage && systemMessage
225225 );
226+ const shouldCachePrompt = !!(
227+ this.cacheBehavior?.cacheConversation ??
228+ this.completionOptions.promptCaching
229+ );
226230
227231 // <code>/v1/publishers/anthropic/models/claude-3-5-sonnet-20240620:streamRawPredict
228232
@@ -234,13 +238,16 @@
234238 const response = await this.fetch(apiURL, {
235239 method: "POST",
236240 headers: {
237- ...(shouldCacheSystemMessage || this.cacheBehavior?.cacheConversation
241+ ...(shouldCacheSystemMessage || shouldCachePrompt
238242 ? { "anthropic-beta": "prompt-caching-2024-07-31" }
239243 : {}),
240244 },
241245 body: JSON.stringify({
242246 ...this._anthropicConvertArgs(options),
243- messages: this.anthropicInstance.convertMessages(messages),
247+ messages: this.anthropicInstance.convertMessages(
248+ messages,
249+ shouldCachePrompt,
250+ ),
244251 system: shouldCacheSystemMessage
245252 ? [
246253 {
modified core/llm/llms/index.ts +2 −0
@@ -17,6 +17,7 @@
1717 import Cerebras from "./Cerebras";
1818 import Cloudflare from "./Cloudflare";
1919 import Cohere from "./Cohere";
20+import CometAPI from "./CometAPI";
2021 import DeepInfra from "./DeepInfra";
2122 import Deepseek from "./Deepseek";
2223 import Docker from "./Docker";
@@ -67,6 +68,7 @@
6768 export const LLMClasses = [
6869 Anthropic,
6970 Cohere,
71+ CometAPI,
7072 FunctionNetwork,
7173 Gemini,
7274 Llamafile,
modified core/llm/llms/xAI.ts +0 −8
@@ -7,14 +7,6 @@
77 static defaultOptions: Partial<LLMOptions> = {
88 apiBase: "https://api.x.ai/v1/",
99 };
10-
11- private static MODEL_IDS: { [name: string]: string } = {
12- "grok-beta": "grok-beta", // Future names might not line up
13- };
14-
15- protected _convertModelName(model: string) {
16- return xAI.MODEL_IDS[model] || this.model;
17- }
1810 }
1911
2012 export default xAI;
modified core/llm/toolSupport.test.ts +17 −0
@@ -280,6 +280,23 @@
280280 });
281281 });
282282
283+ describe("xAI", () => {
284+ const supportsFn = PROVIDER_TOOL_SUPPORT["xAI"];
285+
286+ it("should return true for Grok-3 models", () => {
287+ expect(supportsFn("grok-3")).toBe(true);
288+ expect(supportsFn("grok-3-mini")).toBe(true);
289+ expect(supportsFn("grok-3-fast")).toBe(true);
290+ });
291+
292+ it("should return true for Grok-4 models", () => {
293+ expect(supportsFn("grok-4")).toBe(true);
294+ expect(supportsFn("grok-4-fast-non-reasoning")).toBe(true);
295+ expect(supportsFn("grok-4-fast-reasoning")).toBe(true);
296+ expect(supportsFn("Grok-4-Fast")).toBe(true);
297+ });
298+ });
299+
283300 describe("novita", () => {
284301 const supportsFn = PROVIDER_TOOL_SUPPORT["novita"];
285302
modified core/llm/toolSupport.ts +4 −0
@@ -110,6 +110,10 @@
110110 }
111111 return ["claude", "gemini"].some((val) => lowerCaseModel.includes(val));
112112 },
113+ xAI: (model) => {
114+ const lowerCaseModel = model.toLowerCase();
115+ return ["grok-3", "grok-4"].some((val) => lowerCaseModel.includes(val));
116+ },
113117 bedrock: (model) => {
114118 if (
115119 [
modified core/llm/utils/getSecureID.test.ts +19 −21
@@ -1,49 +1,47 @@
11 import { getSecureID } from "./getSecureID";
22
3-// Mock the crypto.randomUUID function
4-const mockRandomUUID = jest.fn();
5-global.crypto = {
6- ...global.crypto,
7- randomUUID: mockRandomUUID,
8-};
9-
103 describe("getSecureID", () => {
114 beforeEach(() => {
125 // Reset the static property before each test
136 (getSecureID as any).uuid = undefined;
14-
15- // Reset the mock implementation
16- mockRandomUUID.mockReset();
17- // Setup a mock implementation that returns a fixed value for testing
18- mockRandomUUID.mockReturnValue("test-uuid-1234");
197 });
208
219 test("should generate a UUID on first call", () => {
2210 const result = getSecureID();
23- expect(mockRandomUUID).toHaveBeenCalledTimes(1);
24- expect(result).toBe("<!-- SID: test-uuid-1234 -->");
11+
12+ // Should return a properly formatted string with SID comment
13+ expect(result).toMatch(
14+ /^<!-- SID: [0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12} -->$/,
15+ );
16+
17+ // Should have set the static uuid property
18+ expect((getSecureID as any).uuid).toBeDefined();
19+ expect(typeof (getSecureID as any).uuid).toBe("string");
2520 });
2621
2722 test("should reuse the same UUID on subsequent calls", () => {
2823 const firstResult = getSecureID();
2924 const secondResult = getSecureID();
3025
31- // The UUID generation should only happen once
32- expect(mockRandomUUID).toHaveBeenCalledTimes(1);
33-
3426 // Both results should be identical
3527 expect(firstResult).toBe(secondResult);
36- expect(firstResult).toBe("<!-- SID: test-uuid-1234 -->");
28+
29+ // Should match UUID format
30+ expect(firstResult).toMatch(
31+ /^<!-- SID: [0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12} -->$/,
32+ );
3733 });
3834
3935 test("should maintain the same UUID across different test cases if not reset", () => {
40- // Don't reset the UUID here to test persistence
36+ // Set a specific UUID to test persistence
4137 (getSecureID as any).uuid = "persistent-uuid";
4238
4339 const result = getSecureID();
4440
45- // No new UUID should be generated
46- expect(mockRandomUUID).not.toHaveBeenCalled();
41+ // Should use the pre-existing UUID
4742 expect(result).toBe("<!-- SID: persistent-uuid -->");
43+
44+ // The static property should remain unchanged
45+ expect((getSecureID as any).uuid).toBe("persistent-uuid");
4846 });
4947 });
modified core/llm/utils/getSecureID.ts +3 −1
@@ -1,8 +1,10 @@
1+import { v4 as uuidv4 } from "uuid";
2+
13 // Utility function to get or generate UUID for LLM prompts
24 export function getSecureID(): string {
35 // Adding a type declaration for the static property
46 if (!(getSecureID as any).uuid) {
5- (getSecureID as any).uuid = crypto.randomUUID();
7+ (getSecureID as any).uuid = uuidv4();
68 }
79 return `<!-- SID: ${(getSecureID as any).uuid} -->`;
810 }
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/package.json +1 −0
@@ -54,6 +54,7 @@
5454 "vitest": "^3.1.4"
5555 },
5656 "dependencies": {
57+ "@anthropic-ai/sdk": "^0.62.0",
5758 "@aws-sdk/client-bedrock-runtime": "^3.779.0",
5859 "@aws-sdk/client-sagemaker-runtime": "^3.777.0",
5960 "@aws-sdk/credential-providers": "^3.778.0",
modified core/protocol/core.ts +2 −0
@@ -148,6 +148,8 @@
148148 },
149149 void,
150150 ];
151+ "mcp/disconnectServer": [{ id: string }, void];
152+ "mcp/getDisconnectedServers": [undefined, string[]];
151153 "mcp/getPrompt": [
152154 {
153155 serverName: string;
modified core/protocol/passThrough.ts +2 −0
@@ -32,6 +32,8 @@
3232 "mcp/getPrompt",
3333 "mcp/startAuthentication",
3434 "mcp/removeAuthentication",
35+ "mcp/disconnectServer",
36+ "mcp/getDisconnectedServers",
3537 "context/getContextItems",
3638 "context/getSymbolsForFiles",
3739 "context/loadSubmenuItems",
added docs/cli/install.mdx +134 −0
@@ -0,0 +1,134 @@
1+---
2+title: "Install Continue CLI"
3+description: "Get Continue CLI installed and configured for command-line AI coding assistance and automation"
4+sidebarTitle: "Install"
5+---
6+
7+<Info>
8+ Make sure you have [Node.js 18 or higher
9+ installed](https://nodejs.org/en/download/).
10+</Info>
11+
12+## Installation
13+
14+Install Continue CLI globally using npm:
15+
16+```bash
17+npm i -g @continuedev/cli
18+```
19+
20+## Two Ways to Use Continue CLI
21+
22+<Info>
23+ **Quick Overview**: Continue CLI works in two modes - TUI for interactive
24+ conversations or headless for automated commands.
25+</Info>
26+
27+<Tabs>
28+<Tab title="TUI Mode">
29+**Interactive development sessions**
30+
31+Start a conversation with AI in your terminal:
32+
33+```bash
34+cn
35+> @src/app.js Generate unit tests for this component
36+```
37+
38+Perfect for exploration, debugging, and iterative development.
39+
40+</Tab>
41+
42+<Tab title="Headless Mode">
43+**Automation and scripting**
44+
45+Single commands that return results:
46+
47+```bash
48+cn -p "Generate a commit message for current changes"
49+cn -p "Review the last 5 commits for issues"
50+```
51+
52+Perfect for CI/CD, git hooks, and automated workflows.
53+
54+</Tab>
55+</Tabs>
56+
57+## Setup
58+
59+<Tabs>
60+<Tab title="cn TUI Mode">
61+
62+For interactive development and exploration:
63+
64+<Steps>
65+<Step title="Login to Continue CLI">
66+```bash
67+cn login
68+```
69+This will open your browser to authenticate with Continue Hub.
70+</Step>
71+
72+<Step title="Test TUI Mode">
73+Start an interactive session:
74+```bash
75+cn
76+```
77+
78+Try asking a question:
79+
80+```
81+> Tell me about the CLI
82+```
83+
84+</Step>
85+</Steps>
86+</Tab>
87+<Tab title="cn Headless Mode">
88+
89+For automation workflows and scripting:
90+
91+<Steps>
92+<Step title="Get API Key for Automation">
93+For automation workflows, get an API key:
94+1. Visit [Continue Hub API Keys](https://hub.continue.dev/settings/api-keys)
95+2. Click **"+ New API Key"**
96+3. Copy the API key immediately (you won't see it again!)
97+4. Login using your Continue account
98+</Step>
99+
100+<Step title="Add Secrets for Workflows">
101+Store secure credentials for CLI workflows:
102+1. Visit [Continue Hub Secrets](https://hub.continue.dev/settings/secrets)
103+2. Add your API keys and sensitive data
104+3. Reference in configurations with `${{ secrets.SECRET_NAME }}`
105+</Step>
106+
107+<Step title="Test Headless Mode">
108+Try headless mode for automation:
109+```bash
110+cn -p "Generate a conventional commit message for the current git changes"
111+```
112+</Step>
113+</Steps>
114+</Tab>
115+</Tabs>
116+
117+## What's Next?
118+
119+<CardGroup cols={2}>
120+<Card title="Quick Start Guide" icon="rocket" href="/cli/quick-start">
121+ Learn basic usage with practical examples
122+</Card>
123+
124+<Card title="Create your first workflow" icon="gear" href="/guides/posthog-github-continuous-ai">
125+ Build automated workflows with Continue CLI
126+</Card>
127+</CardGroup>
128+
129+## Getting Help
130+
131+If you encounter issues:
132+
133+- Ask for help in [our discussions](https://github.com/continuedev/continue/discussions)
134+- Report bugs on [GitHub](https://github.com/continuedev/continue)
added docs/cli/overview.mdx +228 −0
@@ -0,0 +1,228 @@
1+---
2+title: "Continue CLI (cn) Overview"
3+description: "Command-line interface for automated coding tasks, scripting, and headless development workflows with Continue's AI coding capabilities"
4+sidebarTitle: "Overview"
5+---
6+
7+<Frame>
8+ <img src="/images/cn-demo.gif" />
9+</Frame>
10+
11+**Continue enables developers to ship faster with Continuous AI.**
12+
13+<Tip>
14+ Build features from descriptions. Debug and fix issues. Navigate any codebase.
15+ Automate tedious tasks.
16+</Tip>
17+
18+## Get started in 30 seconds
19+
20+Prerequisites:
21+
22+- [Node.js 18 or newer](https://nodejs.org/en/download/)
23+- A [Continue Hub](https://hub.continue.dev) account (recommended) or local configuration
24+
25+```bash npm
26+# Install Continue CLI
27+npm install -g @continuedev/cli
28+
29+# Navigate to your project
30+
31+cd your-awesome-project
32+
33+# Start coding with Continue
34+
35+cn
36+
37+# You'll be prompted to set up on first use
38+
39+```
40+
41+That's it! You're ready to start automating with Continue CLI.
42+
43+[Continue with CLI Quickstart →](/cli/quick-start)
44+
45+## Two Ways to Use Continue CLI
46+
47+Continue CLI offers two distinct modes designed for different workflows:
48+
49+### TUI Mode: Interactive Development
50+
51+**Perfect for exploration, debugging, and iterating on AI workflows**
52+
53+```bash
54+cn
55+> @src/components/UserProfile.js Review this component for security issues
56+> Generate comprehensive unit tests
57+> Suggest performance improvements
58+```
59+
60+- **Interactive conversations** with your codebase
61+- **Iterate and refine** prompts and approaches
62+- **Explore and understand** complex codebases
63+- **Perfect for experimentation** and learning
64+
65+### Headless Mode: Production Automation
66+
67+**Perfect for CI/CD, automation, and reliable workflows**
68+
69+```bash
70+cn -p "Generate a conventional commit message for staged changes"
71+cn -p "Review pull request changes for security vulnerabilities"
72+cn -p "Update documentation based on recent code changes"
73+```
74+
75+- **Single-command execution** for automation
76+- **Reliable, repeatable results** for production use
77+- **CI/CD and pipeline integration**
78+- **Git hooks and automated workflows**
79+
80+### Development Workflow: TUI → Headless
81+
82+<Tip>
83+ **Pro Tip**: Start in TUI mode to iterate on your AI agent and prompts. Once
84+ you have a workflow that works reliably, deploy it as a Continuous AI
85+ automation.
86+</Tip>
87+
88+1. **Experiment in TUI mode** to perfect your prompts and agent configuration
89+2. **Test different approaches** interactively until you get consistent results
90+3. **Convert successful workflows** to automated Continuous AI commands
91+4. **Deploy in production** with confidence in your proven approach
92+
93+## Why developers love Continue CLI
94+
95+- **Works in your terminal**: Not another chat window. Not another IDE. Continue CLI meets you where you already work, with the tools you already love.
96+- **Takes action**: Continue CLI can directly edit files, run commands, and create commits. Need more? Check out our [MCPs](/customize/deep-dives/mcp).
97+- **Automate tasks**: Create issues from PostHog data, automatically assign labels to issues, and more. Do all this in a single command from your developer machines, or automatically in CI.
98+- **Flexible development flow**: Start interactive, then automate proven workflows.
99+
100+## Key Capabilities
101+
102+### Context Engineering
103+
104+- Use `@` to reference files and provide context
105+- Use `/` to run slash commands for specific tasks
106+- Access the same context providers as IDE extensions
107+
108+### Tool Integration
109+
110+- File editing and creation
111+- Terminal command execution
112+- Codebase understanding and analysis
113+- Git integration
114+- Web search and documentation access
115+
116+### Model Flexibility
117+
118+- Switch between models with `/model` command
119+- Use any model configured in your `config.yaml`
120+- Access Continue Hub models and configurations
121+
122+## Continue Hub Integration
123+
124+Continue CLI integrates seamlessly with [Continue Hub](https://hub.continue.dev) for:
125+
126+### API Access
127+
128+Get an API key for automation workflows:
129+
130+1. Visit [Continue Hub API Keys](https://hub.continue.dev/settings/api-keys)
131+2. Create a new API key
132+3. Use with `cn login` or in your automation scripts
133+
134+### Secrets Management
135+
136+Store secure credentials for CLI workflows:
137+
138+1. Visit [Continue Hub Secrets](https://hub.continue.dev/settings/secrets)
139+2. Add your API keys and sensitive data
140+3. Reference in configurations with `${{ secrets.SECRET_NAME }}`
141+
142+### Configuration Sync
143+
144+- Cloud-managed configurations automatically sync
145+- Share configurations across team members
146+- Version control for your AI workflows
147+
148+## Common Use Cases
149+
150+### TUI Mode Examples
151+
152+**Interactive development and exploration:**
153+
154+<CodeGroup>
155+```bash Codebase Exploration
156+# Start interactive session
157+cn
158+> @src/components Find all unused React components
159+> /explain How does authentication work in this codebase?
160+> @auth/ What security patterns are used here?
161+```
162+
163+```bash Iterative Debugging
164+# Debug issues interactively
165+cn
166+> @tests/auth.test.js This test is failing, help me understand why
167+> @src/auth/middleware.js Let's examine this middleware
168+> /debug What could be causing the timeout error?
169+```
170+
171+```bash Workflow Development
172+# Develop and test automation workflows
173+cn
174+> @package.json @CHANGELOG.md Generate a release notes template
175+> # Test and refine the approach
176+> # Once working, convert to: cn -p "Generate release notes"
177+```
178+
179+</CodeGroup>
180+
181+### Headless Mode Examples
182+
183+**Production automation and scripting:**
184+
185+<CodeGroup>
186+```bash Git Automation
187+# Generate commit messages
188+cn -p "Generate a conventional commit message for the current changes"
189+
190+# Code review automation
191+
192+cn -p "Review the current git changes for bugs and suggest improvements"
193+
194+````
195+
196+```bash CI/CD Integration
197+# In your pipeline scripts
198+cn -p "Analyze test failures and suggest fixes"
199+
200+# Automated documentation updates
201+cn -p "@README.md Update this documentation based on recent changes"
202+````
203+
204+```bash Issue Management
205+# Create GitHub issues from PostHog data
206+cn -p "@posthog-data.json Create GitHub issues for UX problems found in this session data"
207+
208+# Automated security audits
209+cn -p "Scan the codebase for potential security vulnerabilities"
210+```
211+
212+</CodeGroup>
213+
214+## Next steps
215+
216+<CardGroup cols={3}>
217+ <Card title="CLI Quickstart" href="/cli/quick-start">
218+ Learn basic commands and common workflows
219+ </Card>
220+
221+<Card title="Installation Guide" href="/cli/install">
222+ Install Continue CLI and set up your environment
223+</Card>
224+
225+ <Card title="CLI Workflows" href="/guides/overview#continuous-ai">
226+ Task-specific tutorials and examples
227+ </Card>
228+</CardGroup>
added docs/cli/quick-start.mdx +176 −0
@@ -0,0 +1,176 @@
1+---
2+title: "Continue CLI Quick Start"
3+description: "Get hands-on experience with Continue CLI through practical examples and common use cases"
4+sidebarTitle: "Quick Start"
5+---
6+
7+Get hands-on experience with Continue CLI through practical development workflows.
8+
9+<Tabs>
10+ <Tab title="TUI Mode">
11+ TUI Mode (`cn` command) is for **large development tasks** that require
12+ agentic workflows with human oversight. Perfect for complex refactors,
13+ feature implementation, or one-off automation tasks that need monitoring and
14+ iteration.
15+ </Tab>
16+ <Tab title="Headless Mode">
17+ Headless Mode (`-p` flag) is for **reliable, repeatable tasks** that no
18+ longer need constant supervision. Perfect for CI/CD pipelines, git hooks,
19+ and automated workflows you've already tested and refined.
20+ </Tab>
21+</Tabs>
22+
23+## TUI Mode: Large Development Tasks
24+
25+Make sure you have [Continue CLI installed](/cli/install) and are in a project directory.
26+
27+### Example: Implementing a New Feature
28+
29+```bash
30+# Navigate to your project directory
31+cd your-awesome-project
32+
33+# Start TUI Mode for complex development work
34+cn
35+```
36+
37+**Example workflow for adding authentication:**
38+
39+```
40+> I need to add JWT authentication to this Express app. Let me start by showing you the current structure.
41+
42+> @src/app.js @package.json Here's my current setup. Can you implement JWT auth with middleware, login/register routes, and user model?
43+
44+> [Agent analyzes codebase and implements auth system]
45+> [You review changes, test, and provide feedback]
46+> [Agent iterates based on your input until the feature is complete]
47+```
48+
49+### Example: Complex Refactoring
50+
51+```bash
52+cn
53+```
54+
55+**Refactoring a monolithic component:**
56+
57+```
58+> @src/components/Dashboard.jsx This component is 800 lines and does too much. Help me break it into smaller, reusable components.
59+
60+> [Agent analyzes component structure]
61+> [Proposes component breakdown strategy]
62+> [You approve approach]
63+> [Agent implements the refactor with proper props and state management]
64+> [You test and request adjustments]
65+```
66+
67+### When to Use TUI Mode
68+
69+✅ **Large development tasks** that need oversight
70+✅ **Complex refactors** requiring multiple steps
71+✅ **New feature implementation** with unknowns
72+✅ **One-off automation tasks** you haven't done before
73+✅ **Debugging complex issues** that need exploration
74+
75+## Headless Mode: Automated Workflows
76+
77+Once you've refined a workflow in TUI Mode, convert it to Continuous AI for automation.
78+
79+### Example: From REPL → Continuous AI
80+
81+**Step 1: Develop in TUI Mode**
82+
83+```bash
84+cn
85+> @package.json @CHANGELOG.md Generate release notes for version 2.1.0
86+> [Test and refine the prompt until it works perfectly]
87+```
88+
89+**Step 2: Convert to Continuous AI**
90+
91+```bash
92+# Now use the refined workflow in automation
93+cn -p "Generate release notes for the current version based on package.json and recent commits"
94+```
95+
96+### Common Continuous AI Workflows
97+
98+```bash
99+# Git automation
100+cn -p "Generate a conventional commit message for staged changes"
101+cn -p "Review the last 3 commits for potential issues"
102+
103+# Code quality
104+cn -p "Fix all TypeScript errors in the src/ directory"
105+cn -p "Update outdated dependencies and fix breaking changes"
106+
107+# Documentation
108+cn -p "@README.md Update documentation based on recent changes"
109+cn -p "Generate API documentation from JSDoc comments"
110+
111+# CI/CD integration
112+cn -p "Analyze test failures and create GitHub issue with findings"
113+cn -p "Update version numbers and create release branch"
114+```
115+
116+### When to Use Headless Mode
117+
118+✅ **Proven workflows** you've tested in TUI Mode
119+✅ **Repetitive tasks** that no longer need oversight
120+✅ **CI/CD automation** in pipelines
121+✅ **Git hooks** for automated checks
122+✅ **Scheduled tasks** that run unattended
123+
124+### Available Slash Commands
125+
126+Common slash commands available in CLI:
127+
128+- `/clear` - Clear the chat history
129+- `/compact` - Summarize chat history into a compact form
130+- `/config` - Switch configuration or organization
131+- `/exit` - Exit the chat
132+- `/fork` - Start a forked chat session from the current history
133+- `/help` - Show help message
134+- `/info` - Show session information
135+- `/init` - Create an AGENTS.md file
136+- `/login` - Authenticate with your account
137+- `/logout` - Sign out of your current session
138+- `/mcp` - Manage MCP server connections
139+- `/model` - Switch between available chat models
140+- `/resume` - Resume a previous chat session
141+- `/whoami` - Check who you're currently logged in as
142+
143+<Info>Use `/help` to see all available commands.</Info>
144+
145+## The Development Workflow
146+
147+<Info>
148+ **Recommended Approach**: Start complex tasks in TUI Mode to iterate and
149+ refine your approach. Once you have a reliable workflow, convert it to
150+ Headless Mode for automation.
151+</Info>
152+
153+### Workflow Pattern
154+
155+1. **🔬 Experiment in TUI Mode**
156+
157+ - Try complex development tasks with human oversight
158+ - Iterate on prompts and approaches until they work reliably
159+ - Test edge cases and refine the agent's behavior
160+
161+2. **⚡ Automate with Continuous AI**
162+ - Convert proven REPL workflows to single commands
163+ - Deploy in CI/CD, git hooks, or scheduled tasks
164+ - Run with confidence knowing the approach is tested
165+
166+## Next Steps
167+
168+<CardGroup cols={2}>
169+ <Card title="Create Your First Workflow" href="/guides/posthog-github-continuous-ai">
170+ Build an automated PostHog to GitHub issues workflow
171+ </Card>
172+
173+ <Card title="Continuous AI Guide" href="/guides/continuous-ai">
174+ Learn to build and deploy AI-powered development workflows
175+ </Card>
176+</CardGroup>
modified docs/customization/models.mdx +2 −2
@@ -65,10 +65,10 @@
6565 3. Add `GEMINI_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets)
6666 4. Click `Reload config` in the agent selector in the Continue IDE extension
6767
68-[Grok 4](https://hub.continue.dev/xai/grok-4) from xAI
68+[Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) from xAI
6969
7070 1. Get your API key from [xAI](https://console.x.ai/)
71-2. Add [Grok 4](https://hub.continue.dev/xai/grok-4) to an agent on Continue Hub
71+2. Add [Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) to an agent on Continue Hub
7272 3. Add `XAI_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets)
7373 4. Click `Reload config` in the agent selector in the Continue IDE extension
7474
modified docs/customize/deep-dives/model-capabilities.mdx +8 −3
@@ -210,9 +210,14 @@
210210
211211 ### xAI
212212
213-| Model | Tool Use | Image Input | Context Window |
214-| :----- | -------- | ----------- | -------------- |
215-| Grok 4 | Yes | Yes | 128k |
213+| Model | Tool Use | Image Input | Context Window |
214+| :------------------------ | -------- | ----------- | -------------- |
215+| Grok Code Fast 1 | Yes | Yes | 256k |
216+| Grok 4 Fast Reasoning | Yes | Yes | 2M |
217+| Grok 4 Fast Non-Reasoning | Yes | Yes | 2M |
218+| Grok 4 | Yes | Yes | 256k |
219+| Grok 3 | Yes | Yes | 131k |
220+| Grok 3 Mini | Yes | Yes | 131k |
216221
217222 ### Moonshot AI
218223
modified docs/customize/model-providers/more/xAI.mdx +6 −9
@@ -3,13 +3,9 @@
33 slug: ../xai
44 ---
55
6-<Tip>
7- **Discover xAI models [here](https://hub.continue.dev/xai)**
8-</Tip>
6+<Tip>**Discover xAI models [here](https://hub.continue.dev/xai)**</Tip>
97
10-<Info>
11- Get an API key from the [xAI Console](https://console.x.ai/)
12-</Info>
8+<Info>Get an API key from the [xAI Console](https://console.x.ai/)</Info>
139
1410 ## Configuration
1511
@@ -29,7 +25,7 @@
2925 "models": [
3026 {
3127 "title": "<MODEL_NAME>",
32- "provider": "anthropic",
28+ "provider": "xai",
3329 "model": "<MODEL_ID>",
3430 "apiKey": "<YOUR_XAI_API_KEY>"
3531 }
@@ -40,5 +36,6 @@
4036 </Tabs>
4137
4238 <Info>
43- **Check out a more advanced configuration [here](https://hub.continue.dev/xai/grok-4?view=config)**
44-</Info>
No newline at the end of the file
39+ **Check out a more advanced configuration
40+ [here](https://hub.continue.dev/xai/grok-code-fast-1?view=config)**
41+</Info>
modified docs/docs.json +7 −1
@@ -23,6 +23,11 @@
2323 "getting-started/quick-start"
2424 ]
2525 },
26+ {
27+ "group": "CLI",
28+ "icon": "terminal",
29+ "pages": ["cli/overview", "cli/install", "cli/quick-start"]
30+ },
2631 {
2732 "group": "Features",
2833 "icon": "star",
@@ -230,10 +235,10 @@
230235 "pages": [
231236 "guides/overview",
232237 "guides/understanding-agents",
238+ "guides/configuring-models-rules-tools",
233239 "guides/codebase-documentation-awareness",
234240 "guides/cli",
235241 "guides/continuous-ai",
236- "guides/snyk-mcp-continue-cookbook",
237242 "guides/continuous-ai-readiness-assessment",
238243 "guides/plan-mode-guide",
239244 "guides/ollama-guide",
@@ -248,6 +253,7 @@
248253 "icon": "book-open-cover",
249254 "pages": [
250255 "guides/posthog-github-continuous-ai",
256+ "guides/snyk-mcp-continue-cookbook",
251257 "guides/netlify-mcp-continuous-deployment"
252258 ]
253259 }
modified docs/features/autocomplete/next-edit.mdx +1 −2
@@ -6,7 +6,7 @@
66 <Warning>
77 Next Edit is currently an experimental feature. It requires
88 [Instinct](https://hub.continue.dev/continuedev/instinct) or [Mercury Coder
9- model](https://hub.continue.dev/inceptionlabs/mercury-coder) configured in
9+ model](https://hub.continue.dev/inception/mercury-coder) configured in
1010 your Continue autocomplete settings and is not yet available for JetBrains
1111 use.
1212 </Warning>
@@ -73,7 +73,6 @@
7373 Next Edit requires:
7474
7575 - Compatible AI models (Mercury Coder or Instinct)
76-- Continue development team access
7776 - VS Code (JetBrains support coming soon)
7877 - **API Keys**: Organizations can add API keys to [org secrets](/hub/secrets/secret-types) for team-wide access. Individual users need to provide their own API keys in their [model configuration](/customize/model-providers/overview)
7978
added docs/guides/configuring-models-rules-tools.mdx +168 −0
@@ -0,0 +1,168 @@
1+---
2+title: "Configuring Models, Rules, and Tools"
3+description: "Learn how to work with Continue's configuration system. Understand how to use hub models, rules, and tools, create local configurations, and organize your setup for maximum reusability."
4+---
5+
6+## What Are Models, Rules, and Tools?
7+
8+Continue agents are built from three main types of configuration:
9+
10+<Columns cols={3}>
11+<Card title="Models" icon="cube">
12+Language models that power different capabilities like chat, autocomplete, and agent mode
13+</Card>
14+
15+<Card title="Rules" icon="pencil">
16+ Guidelines and instructions that shape how the AI behaves and responds
17+</Card>
18+
19+<Card title="Tools" icon="server">
20+MCP tools that provide additional capabilities like database access, web search, or custom functions
21+</Card>
22+</Columns>
23+
24+There are two places where you can define these configurations:
25+
26+<Columns cols={2}>
27+<Card title="Local" icon="computer">
28+Custom configurations you create and manage in your workspace or globally
29+</Card>
30+
31+<Card title="Hub" icon="cloud">
32+Pre-built models, rules, and tools from the Continue community that you can import and use immediately
33+</Card>
34+</Columns>
35+
36+## Local
37+
38+Local configurations let you create custom models, rules, and tools that automatically apply to multiple agents, reducing duplication and ensuring consistency across your setup.
39+
40+<Columns cols={2}>
41+<Card title="Global" icon="globe">
42+Applied to all agents across all workspaces. Ideal for personal preferences, universal coding standards, or tools you use everywhere.
43+</Card>
44+<Card title="Workspace" icon="folder-open">
45+Applied automatically to all agents when working in a specific project.
46+
47+Perfect for project-specific setups like TypeScript rules for web apps or the Playwright MCP tool.
48+
49+</Card>
50+
51+</Columns>
52+
53+## Hub
54+
55+Continue hub uses a slug in the format of `owner/item-name` to resolve blocks.
56+
57+For example, to use the [Claude 4 Sonnet model](https://hub.continue.dev/anthropic/claude-4-sonnet), you'd reference it as `anthropic/claude-4-sonnet`.
58+
59+Import from the hub using the `uses` syntax alongside your custom configurations:
60+
61+```yaml config.yaml highlight={6}
62+name: Team Agent
63+version: 1.0.0
64+schema: v1
65+
66+models:
67+ - uses: anthropic/claude-4-sonnet
68+ with:
69+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} # Use a hub secret
70+```
71+
72+### Organization
73+
74+Organize your local configurations using these directories:
75+
76+<Columns cols={3}>
77+<Card title="Models" icon="cube">
78+ `.continue/models`
79+</Card>
80+
81+<Card title="Rules" icon="pencil">
82+ `.continue/rules`
83+</Card>
84+
85+<Card title="Tools" icon="server">
86+ `.continue/mcpServers`
87+</Card>
88+</Columns>
89+
90+## Working with Secrets
91+
92+Models, and many MCP servers, require a secret for things like API keys.
93+
94+On the hub, you can configure secrets when adding a model or MCP server.
95+
96+This will use mustache notation to pass the secret, eg `${{ secrets.SECRET_NAME }}`
97+
98+When configuring a local model or MCP server, you can use the same mustache notation for secrets which read from:
99+
100+<Columns cols={2}>
101+<Card title="Global" icon="globe">
102+`.env` file in `~/.continue/.env`
103+</Card>
104+
105+<Card title="Workspace" icon="folder-open">
106+`.env` file at your project root
107+</Card>
108+</Columns>
109+
110+## Overriding Properties
111+
112+You can directly override properties using the `override` syntax:
113+
114+```yaml title="config.yaml" highlight={10-13}
115+name: myprofile/custom-agent
116+version: 1.0.0
117+schema: v1
118+
119+models:
120+ - uses: myprofile/custom-model
121+ with:
122+ ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }}
123+ TEMP: 0.9
124+ override:
125+ roles:
126+ - chat
127+```
128+
129+## Advanced
130+
131+### Inputs
132+
133+Models and MCP server authors can configure inputs that require the user to provide a secret value by defining a `${{ inputs.SECRET_NAME }}` value.
134+
135+For example, here is how you could require that the user provide a value for the `apiKey` property on a model:
136+
137+```yaml title="config.yaml" highlight={8}
138+name: myprofile/custom-model
139+version: 1.0.0
140+schema: v1
141+
142+models:
143+ - name: My Favorite Model
144+ # ... other model properties ...
145+ apiKey: ${{ inputs.SECRET_NAME }}
146+```
147+
148+Users then map their secret to this input using a `${{ secrets.SECRET_NAME }}` value that maps to a property name which matches the required input, e.g. `SECRET_NAME`.
149+
150+```yaml title="config.yaml" highlight={8}
151+name: myprofile/custom-agent
152+version: 1.0.0
153+schema: v1
154+
155+models:
156+ - uses: myprofile/custom-model
157+ with:
158+ SECRET_NAME: ${{ secrets.SECRET_NAME }}
159+```
160+
161+## Next Steps
162+
163+Now that you understand how models, rules, and tools work, explore:
164+
165+- **[Config Reference](/reference)**: Detailed documentation of all available properties
166+- **[Continue Hub](https://hub.continue.dev)**: Browse community models, rules, and tools
167+- **[Custom Context Providers](/customize/deep-dives/custom-providers)**: Create advanced context integrations
168+- **[Model Roles](/customize/model-roles/intro)**: Understanding how different models work together
modified docs/guides/netlify-mcp-continuous-deployment.mdx +123 −22
@@ -44,18 +44,82 @@
4444
4545 ## Quick Setup
4646
47+<Info>
48+ The Netlify Development Rules bundle includes guardrails for:
49+ - Proper `.gitignore` configuration
50+ - Function structure and placement
51+ - Edge function constraints
52+ - Local development best practices
53+
54+</Info>
55+For all options, first:
4756 <Steps>
48- <Step title="Install Continue CLI">
57+<Step title="Install Continue CLI">
4958 ```bash
5059 npm i -g @continuedev/cli
5160 ```
5261 </Step>
5362
63+<Step title="Install Netlify CLI">
64+
65+ 1. Install Netlify CLI: `npm i -g netlify-cli`
66+ 2. Authenticate with Netlify:
67+ `netlify login`
68+ </Step>
69+</Steps>
70+
71+## Netlify Continuous AI Workflow Options
72+
73+<Card title="🚀 Fastest Path to Success" icon="zap">
74+ Skip the manual setup and use our pre-built Netlify Continuous AI agent that includes
75+ optimized prompts, rules, and the Netlify MCP for more consistent results.
76+</Card>
77+
78+After completing **Quick Setup** above, you have two paths to get started:
79+
80+<Tabs>
81+ <Tab title="⚡ Quick Start (Recommended)">
82+
83+ <Steps>
84+ <Step title="Add the Pre-Built Agent">
85+ Visit the [Netlify Continuous AI Agent](https://hub.continue.dev/continuedev/netlify-continuous-ai) on Continue Hub and click **"Install Agent"**
86+
87+ This agent includes:
88+ - **Optimized prompts** for Netlify deployment and performance analysis
89+ - **Built-in rules** for consistent formatting and error handling
90+ - **Netlify MCP** for more reliable API interactions
91+ </Step>
92+
93+ <Step title="Verify Your Setup">
94+ The agent uses the Netlify MCP automatically and includes best practice rules for deployment and performance optimization.
95+ </Step>
96+
97+ <Step title="Run Performance Analysis">
98+ Navigate to your project directory and run:
99+ ```bash
100+ cn "Analyze my Netlify site's performance and optimize it for better Core Web Vitals."
101+ ```
102+
103+ That's it! The agent handles everything automatically.
104+ </Step>
105+ </Steps>
106+
107+ <Info>
108+ **Why Use the Agent?** Results are more consistent and debugging is easier thanks to the Netlify MCP integration and pre-tested prompts. You can remix the agent later to customize it to your needs.
109+ </Info>
110+
111+ </Tab>
112+
113+ <Tab title="🛠️ Manual Setup">
114+<Steps>
115+
54116 <Step title="Configure Netlify MCP">
55- 1. Install Netlify CLI: `npm i -g netlify-cli` 2. Authenticate with Netlify:
56- `netlify login` 3. Visit [Netlify MCP on Continue
57- Hub](https://hub.continue.dev/netlify/netlify-mcp) 4. Follow the configuration
58- instructions for your editor
117+ 1. Authenticate with Netlify:
118+ `netlify login`
119+ 2. Visit [Netlify MCP on Continue
120+ Hub](https://hub.continue.dev/netlify/netlify-mcp)
121+ 3. Follow the configuration instructions for your editor
122+
59123 </Step>
60124
61125 <Step title="Add Development Rules">
@@ -77,13 +141,26 @@
77141 ```
78142
79143 </Step>
80-</Steps>
81144
82-<Info>
83- The Netlify Development Rules bundle includes guardrails for: - Proper
84- `.gitignore` configuration - Function structure and placement - Edge function
85- constraints - Local development best practices
86-</Info>
145+
146+</Steps>
147+ <Info>
148+ You're all set! Now you can use cn CLI to interact with Netlify using natural language prompts. Check out the examples below to get started.
149+ </Info>
150+ </Tab>
151+</Tabs>
152+
153+<Accordion title="Agent Requirements">
154+ To use the pre-built agent, you need either:
155+ - **Continue CLI Pro Plan** with
156+ the models add-on, OR
157+ - **Your own API keys** added to Continue Hub secrets
158+ The agent will automatically detect and use your
159+ configuration along with the Netlify MCP for deployment operations.
160+
161+</Accordion>
162+
163+---
87164
88165 ## Performance Optimization Steps
89166
@@ -375,6 +452,14 @@
375452
376453 ## Automated Performance Checks
377454
455+### Add GitHub Secrets
456+
457+Navigate to **Repository Settings → Secrets and variables → Actions** and add:
458+
459+- `CONTINUE_API_KEY`: Your Continue API key from [hub.continue.dev/settings/api-keys](https://hub.continue.dev/settings/api-keys)
460+- `NETLIFY_AUTH_TOKEN`: Your Netlify personal access token
461+- `NETLIFY_SITE_ID`: Your Netlify site ID
462+
378463 ### GitHub Actions Performance Guard
379464
380465 Block PRs that degrade performance:
@@ -394,17 +479,28 @@
394479 with:
395480 node-version: "22"
396481
482+ - name: Install Continue CLI
483+ run: |
484+ npm install -g @continuedev/cli
485+ echo "✅ Continue CLI installed"
486+
487+ - name: Authenticate Continue CLI
488+ env:
489+ CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
490+ run: |
491+ cn auth login --api-key "$CONTINUE_API_KEY"
492+ echo "✅ Continue CLI authenticated"
493+
397494 - name: Deploy and Test Performance
398495 id: perf
399496 env:
400497 NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
401498 NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
402499 run: |
403- npx @continuedev/cli@latest << 'EOF'
404- Deploy PR preview and run Lighthouse.
405- Compare scores with main branch.
406- Output JSON with score deltas.
407- EOF > performance.json
500+ echo "🚀 Deploying PR preview and analyzing performance..."
501+ cn -p "Deploy PR preview and run Lighthouse.
502+ Compare scores with main branch.
503+ Output JSON with score deltas." > performance.json
408504
409505 - name: Comment Performance Results
410506 uses: actions/github-script@v7
@@ -442,9 +538,11 @@
442538 ```
443539
444540 <Warning>
445- This workflow will: - **Block merge** if performance score drops >10 points -
446- **Warn** on any performance regression - **Celebrate** improvements with green
447- indicators
541+ This workflow will:
542+ - **Block merge** if performance score drops >10 points
543+ - **Warn** on any performance regression
544+ - **Celebrate** improvements with green indicators
545+
448546 </Warning>
449547
450548 ## Performance Testing Locally
@@ -528,9 +626,12 @@
528626
529627 <Card title="On-Demand Builders" icon="hammer">
530628 **[On-Demand
531- Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)** -
532- Generate pages only when requested - Cache dynamically generated content -
533- Perfect for large sites (10k+ pages) - Reduce build times dramatically
629+ Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)**
630+ - Generate pages only when requested
631+ - Cache dynamically generated content
632+ - Perfect for large sites (10k+ pages)
633+ - Reduce build times dramatically
634+
534635 </Card>
535636
536637 <Card title="Netlify Functions" icon="function">
modified docs/guides/posthog-github-continuous-ai.mdx +109 −113
@@ -1,23 +1,32 @@
11 ---
22 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"
3+description: "Build an automated system that continuously monitors PostHog analytics, analyzes user behavior with AI, and creates GitHub issues automatically using PostHog MCP."
4+sidebarTitle: "PostHog Analytics with Continue CLI"
55 ---
66
77 <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
8+ A fully automated workflow that uses Continue CLI with the PostHog MCP to fetch analytics data, analyze user experience issues with AI, and automatically create GitHub
9+ issues with the GitHub CLI.
1110 </Card>
1211
12+## What You'll Learn
13+
14+This cookbook teaches you to:
15+
16+- Use [PostHog MCP](https://posthog.com/docs/model-context-protocol) to query [analytics](https://posthog.com/docs/web-analytics), [errors](https://posthog.com/docs/error-tracking), and [feature flags](https://posthog.com/docs/feature-flags)
17+- Analyze user behavior patterns with AI
18+- Automatically create GitHub issues using GitHub CLI
19+- Set up continuous monitoring with GitHub Actions
20+
1321 ## Prerequisites
1422
1523 Before starting, ensure you have:
1624
1725 - 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)**
26+- [PostHog account](https://posthog.com) with [session recordings enabled](https://posthog.com/docs/session-replay/installation) and data collecting
1927 - Node.js 18+ installed locally
20-- Continue CLI account with **active credits** (required for API usage)
28+- [Continue CLI](https://docs.continue.dev/guides/cli) with **active credits** (required for API usage)
29+- [GitHub CLI](https://cli.github.com/) installed (`gh` command)
2130
2231 <Steps>
2332 <Step title="Install Continue CLI">
@@ -66,39 +75,38 @@
6675 7. Note your PostHog host URL (e.g., `https://us.posthog.com` or your custom domain)
6776 8. You'll also need your POSTHOG_AUTH_HEADER value, which is simply `Bearer YOUR_API_KEY`
6877
69- <Tip>
70- **Find Your Project Details**: Your Project ID is in your PostHog URL:
71- `https://app.posthog.com/project/YOUR_PROJECT_ID`
72- </Tip>
78+ <Info>
79+ **Continue Secrets**: The `POSTHOG_AUTH_HEADER` secret should be stored in
80+ Continue's secure secrets storage. This keeps your API key safe and the MCP
81+ automatically connects to your default PostHog project.
82+</Info>
7383
7484 </Tab>
75- <Tab title="GitHub Personal Access Token">
76- You'll need a **Personal Access Token** to create issues in your GitHub repository:
77-
78- 1. Go to [GitHub Personal Access Tokens](https://github.com/settings/personal-access-tokens/new)
79- 2. Click **"Generate new token (classic)"**
80- 3. Name it "Continue CLI PostHog Analysis"
81- 4. Select these scopes:
82- - `repo` (or just `public_repo` if your repository is public)
83- - `issues:write` - **Required** for creating issues
84- 5. Copy the token immediately
85+ <Tab title="Set Up GitHub CLI Authentication">
86+ GitHub CLI handles authentication automatically - no manual PAT needed:
8587
86- </Tab>
87-</Tabs>
88+ 1. Install GitHub CLI if not already installed
89+ 2. Run `gh auth login` and follow the prompts
90+ 3. Choose authentication method (browser or token)
91+ 4. Grant necessary permissions when prompted (`issues:write` is **required** for creating issues)
8892
89-### Add Secrets to Continue CLI
93+ </Tab>
94+<Tab title= "Configure API Access in Continue CLI">
95+
96+<Tip>
97+See https://docs.continue.dev/hub/secrets/secret-types#secret-types for adding secrets
98+</Tip>
9099
91-To add environment variables to your Continue Hub account:
100+You only need to configure the PostHog MCP credential - it automatically handles project selection. To add environment variables to your Continue Hub account:
92101
93102 1. Go to the [Continue Hub](https://hub.continue.dev)
94103 2. Sign in to your account
95104 3. Navigate to your user settings
96105 4. Look for the "Secrets" section
97-5. Add your variables there (like POSTHOG_API_KEY, POSTHOG_PROJECT_ID,
98- POSTHOG_HOST,GITHUB_PAT, etc.)
106+5. Add your Personal API Key from PostHog (phx_...) as POSTHOG_AUTH_HEADER secret with format: Bearer YOUR_API_KEY
99107
100-These environment variables will then be securely stored and available for use in
101-your Continue workflows.
108+</Tab>
109+</Tabs>
102110
103111 ## PostHog GitHub Continuous AI Workflow Options
104112
@@ -107,7 +115,17 @@
107115 optimized prompts, rules, and the PostHog MCP for more consistent results.
108116 </Card>
109117
110-After completing **Step 1** below, you have two paths to get started:
118+<Info>
119+ **How PostHog MCP Works**:
120+ - Your API key is tied to your PostHog account and
121+ organization
122+ - It automatically uses your default project (no project ID
123+ needed)
124+ - If you have multiple projects, use `mcp__posthog__switch-project` to
125+ change
126+ - The MCP connects via `https://mcp.posthog.com/sse` using your account context.
127+
128+</Info>
111129
112130 <Tabs>
113131 <Tab title="⚡ Quick Start (Recommended)">
@@ -115,20 +133,16 @@
115133
116134 <Steps>
117135 <Step title="Add the Pre-Built Agent">
118- Visit the [PostHog GitHub Continuous AI Agent](https://hub.continue.dev/continuedev/awesome-models-posthog-gh) on Continue Hub and click **"Install Agent"**
136+ Visit the [PostHog GitHub Continuous AI Agent](https://hub.continue.dev/continuedev/awesome-models-posthog-gh) on Continue Hub and click **"Install Agent"** or run:
137+
138+ ```bash
139+ cn --config continuedev/awesome-models-posthog-gh
140+ ```
119141
120142 This agent includes:
121- - **Optimized prompts** for PostHog analysis and GitHub issue creation
122- - **Built-in rules** for consistent formatting and error handling
123- - **PostHog MCP** for more reliable API interactions
124- </Step>
125-
126- <Step title="Verify Your Secrets">
127- The agent uses these Hub resources automatically:
128- - **Environment Variables**: [bekahhw/env-vars](https://hub.continue.dev/bekahhw/env-vars)
129- - **Analysis Rules**: [bekah-hawrot-weigel/posthog-github-continuous-ai-rules](https://hub.continue.dev/bekah-hawrot-weigel/posthog-github-continuous-ai-rules)
130- - **Analysis Prompt**: [continuedev/posthog-analysis](https://hub.continue.dev/continuedev/posthog-analysis)
131- - **Issue Creation Prompt**: [continuedev/github-issues](https://hub.continue.dev/continuedev/github-issues)
143+ - **Optimized prompts** for [PostHog analysis](https://hub.continue.dev/continuedev/posthog-analysis) and [GitHub issue creation](https://hub.continue.dev/continuedev/posthog-github-issues)
144+ - **[Built-in rules](https://hub.continue.dev/bekah-hawrot-weigel/posthog-github-continuous-ai-rules)** for consistent formatting and error handling
145+ - **[PostHog MCP](https://hub.continue.dev/posthog/posthog-mcp)** for more reliable API interactions
132146 </Step>
133147
134148 <Step title="Run the Analysis">
@@ -148,72 +162,41 @@
148162 </Tab>
149163
150164 <Tab title="🛠️ Manual Setup">
151- **Perfect for:** Learning the process and customizing prompts.
152-
153- 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.
154-
155-### Run the PostHog Analysis
156-
157-Use this prompt with Continue CLI to fetch and analyze your PostHog sessions:
158-
159-```bash
160-cn -p "I need you to help me analyze PostHog session recordings to identify UX issues. Please:
161-
162-1. First, fetch session recordings from PostHog using these details:
163- - Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from my secrets
164- - API endpoint: {POSTHOG_HOST}/api/projects/{POSTHOG_PROJECT_ID}/session_recordings/?limit=20
165- - Include Authorization header: 'Bearer {POSTHOG_API_KEY}'
166-
167-2. Filter the sessions to find problematic ones with either:
168- - console_error_count > 0 (JavaScript errors)
169- - recording_duration > 300 (sessions longer than 5 minutes)
170-
171-3. Analyze the filtered sessions and create exactly 3 GitHub issues for the most critical UX problems.
172-
173-4. Format each issue like this:
174-### 1. **Issue Title Here**
175-**Problem**: One sentence describing the user problem
176-**Technical Causes**: Brief technical explanation
177-**Affected Pages**: List the URLs
178-**Recommended Fix**:
179-- Specific action item 1
180-- Specific action item 2
181-**Priority**: **HIGH** or **MEDIUM** or **LOW**
182-**Impact**: Quantify the impact (e.g., 'Affects 80% of sessions')
183-
184-Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data."
185-```
186-
187-### Create GitHub Issues from PostHog Analysis
188-
189-Now use Continue CLI to create GitHub issues from your analysis results:
190-
191-```bash
192-cn -p "I have analyzed PostHog session data and identified UX issues. Now I need you to create GitHub issues using the GitHub API.
193-
194-Use these details from my secrets:
195-- GITHUB_PAT: My GitHub Personal Access Token
196-- Repository: Extract from git remote or ask me to specify
197-
198-For each issue in my analysis:
199-1. Parse the issue title, body content, and priority level
200-2. Create a GitHub issue via API POST to: https://api.github.com/repos/{owner}/{repo}/issues
201-3. Use these headers:
202- - Authorization: token {GITHUB_PAT}
203- - Accept: application/vnd.github.v3+json
204- - Content-Type: application/json
205-4. Set labels based on priority:
206- - HIGH: [\"bug\", \"high-priority\", \"user-experience\", \"automated\"]
207- - MEDIUM: [\"enhancement\", \"medium-priority\", \"user-experience\", \"automated\"]
208- - LOW: [\"low-priority\", \"user-experience\", \"automated\"]
209-5. Format the issue title as: \"🔍 UX Issue: {original title}\"
210-
211-Please create the GitHub issues and confirm they were successfully created with issue numbers and URLs.
212-"
213-```
165+ <Steps>
166+ <Step title="Add PostHog MCP to Continue CLI">
167+ First, install the [PostHog MCP](https://hub.continue.dev/posthog/posthog-mcp) or run:
168+ ```bash
169+ npx -y mcp-remote@latest https://mcp.posthog.com/sse --header Authorization:${{ secrets.continuedev/awesome-models-posthog-gh/posthog/posthog-mcp/POSTHOG_AUTH_HEADER }}
170+ ```
171+ </Step>
172+ <Step title="Add PostHog + GitHub Analysis Rules">
173+ In the Continue Hub, add the [PostHog GitHub Continuous AI Rules](https://hub.continue.dev/bekah-hawrot-weigel/posthog-github-continuous-ai-rules) to your account for better formatting and error handling.
174+ </Step>
175+ <Step title="Create Your Custom Prompts">
176+ Use this prompt with Continue CLI to analyze PostHog data and create GitHub issues:
177+
178+ ```bash
179+
180+ # In cn TUI mode:
181+ "Create GitHub issues from the PostHog analysis using gh CLI:
182+ - For each issue, run: gh issue create --title '🔍 UX Issue: [title]' --body '[details]'
183+ - Add labels: --label 'bug,user-experience,automated'
184+ - Set priority labels (high/medium/low)
185+ - Include session data and technical details in the body
186+ Execute the commands and confirm each issue was created with URL."
187+ ```
188+ </Step>
189+</Steps>
214190
215191 </Tab>
216192 </Tabs>
193+<Info>
194+
195+ **Why GitHub CLI over GitHub MCP**: While GitHub MCP is available, it can be
196+ token-expensive to run. The `gh` CLI is more efficient, requires no API tokens
197+ (authenticated via `gh auth login`), and provides a cleaner command-line
198+ experience. GitHub MCP remains an option if you prefer full MCP integration.
199+</Info>
217200
218201 <Accordion title="Agent Requirements">
219202 To use the pre-built agent, you need either:
@@ -492,16 +475,17 @@
492475
493476 <CardGroup cols={2}>
494477 <Card title="Performance Analysis" icon="chart-line">
495- "Analyze PostHog performance metrics alongside session recordings to
496- identify slow page loads affecting user experience"
478+ "Analyze [PostHog performance
479+ metrics](https://posthog.com/docs/web-analytics) alongside session
480+ recordings to identify slow page loads affecting user experience"
497481 </Card>
498482 <Card title="Error Correlation" icon="bug">
499483 "Cross-reference JavaScript console errors with user actions to identify the
500484 root cause of UX issues"
501485 </Card>
502486 <Card title="Feature Flag Analysis" icon="flag">
503- "Analyze how PostHog feature flags impact user behavior in session
504- recordings"
487+ "Analyze how [PostHog feature flags](https://posthog.com/docs/feature-flags)
488+ impact user behavior in session recordings"
505489 </Card>
506490 <Card title="Custom Slack Alerts" icon="slack">
507491 "Create Slack alerts when critical UX issues are detected in PostHog
@@ -511,7 +495,19 @@
511495
512496 ## Next Steps
513497
514-1. **Monitor your first issues** - Review the GitHub issues created and implement fixes
515-2. **Measure impact** - Track how resolved issues improve PostHog metrics
516-3. **Refine prompts** - Adjust the Continue CLI prompts based on issue quality
517-4. **Scale the system** - Add more data sources or create specialized analysis workflows
498+- Consider [GitHub MCP](https://hub.continue.dev/github/github-mcp) as an alternative (note: can be token-expensive)
499+- Configure [Slack MCP](https://hub.continue.dev/slack/slack-mcp) for alerts
500+- Set up [PostHog performance monitoring](https://posthog.com/docs/web-analytics)
501+- Join the [Continue Discord](https://discord.gg/continue) for support
502+
503+## Resources
504+
505+- [PostHog API Documentation](https://posthog.com/docs/api)
506+- [PostHog MCP Documentation](https://posthog.com/docs/model-context-protocol)
507+- [PostHog Session Replay](https://posthog.com/docs/session-replay)
508+- [PostHog Feature Flags](https://posthog.com/docs/feature-flags)
509+- [PostHog Error Tracking](https://posthog.com/docs/error-tracking)
510+- [GitHub CLI Documentation](https://cli.github.com/)
511+- [GitHub MCP on Continue Hub](https://hub.continue.dev/github/github-mcp) (alternative option)
512+- [Continue CLI Guide](https://docs.continue.dev/guides/cli)
513+- [Continuous AI Best Practices](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)
modified docs/guides/snyk-mcp-continue-cookbook.mdx +106 −32
@@ -20,9 +20,74 @@
2020 - [Snyk account](https://snyk.io/) (free tier works)
2121 - A local project to scan for vulnerabilities
2222
23+For all options, first:
2324 <Steps>
25+<Step title="Install Continue CLI">
26+ ```bash
27+ npm i -g @continuedev/cli
28+ ```
29+ </Step>
30+
31+<Step title="Add Your Project to Snyk">
32+
33+ 1. Sign up for a Snyk account at [snyk.io](https://snyk.io/)
34+ 2. Create a new project in Snyk by importing your code repository (Git
35+ provider or manual upload)
36+ </Step>
37+</Steps>
38+ <Warning>
39+ To use agents in headless mode, you need a [Continue API key](https://hub.continue.dev/settings/api-keys).
40+ </Warning>
41+
42+## Snyk Continuous AI Workflow Options
43+
44+<Card title="🚀 Fastest Path to Success" icon="zap">
45+ Skip the manual setup and use our pre-built Snyk Continuous AI agent that includes
46+ the Snyk MCP and optimized security scanning workflows for more consistent results.
47+</Card>
48+
49+
50+After ensuring you meet the **Prerequisites** above, you have two paths to get started:
51+
52+<Tabs>
53+ <Tab title="⚡ Quick Start (Recommended)">
54+ <Steps>
55+ <Step title="Load the Pre-Built Agent">
56+ Navigate to your project directory and run:
57+ ```bash
58+ cn --config continuedev/snyk-continuous-ai
59+ ```
60+
61+ This agent includes:
62+ - **Snyk MCP** pre-configured and ready to use
63+ - **Security-focused rules** for best practices
64+ </Step>
65+
66+ <Step title="Run Your First Security Scan">
67+ Start with a comprehensive security scan:
68+ ```bash
69+ # TUI mode
70+ cn -p "Run a complete security scan on this project including code vulnerabilities, dependencies, and any IaC files. Summarize findings by severity."
71+ ```
72+
73+ That's it! The agent handles everything automatically.
74+ </Step>
75+ </Steps>
76+
77+ <Info>
78+ **Why Use the Agent?** The pre-built agent provides consistent security scanning workflows and handles MCP configuration automatically, making it easier to get started with AI-powered security scanning.
79+ </Info>
80+
81+ </Tab>
82+
83+ <Tab title="🛠️ Manual Setup">
84+<Steps>
85+ <Step title="Create a New Agent via the Continue Hub">
86+ Go to the [Continue Hub](https://hub.continue.dev) and [create a new agent](https://hub.continue.dev/new?type=agent).
87+ </Step>
88+
2489 <Step title="Connect Snyk MCP via Continue Hub">
25- Visit the [Snyk MCP on Continue Hub](https://hub.continue.dev/snyk/snyk-mcp) and click **Install** to add it to your Continue account.
90+ Visit the [Snyk MCP on Continue Hub](https://hub.continue.dev/snyk/snyk-mcp) and click **Install** to add it to the agent you created in the step above.
2691
2792 This will add Snyk MCP to your agent's available tools. The Hub listing automatically configures the MCP command:
2893 ```bash
@@ -31,7 +96,7 @@
3196
3297 <Tip>
3398 **Alternative installation methods:**
34- 1. **Quick CLI install**: `cn -p --mcp snyk/snyk-mcp`
99+ 1. **Quick CLI install**: `cn --mcp snyk/snyk-mcp`
35100 2. **Manual configuration**: Add the MCP to your `~/.continue/config.json` under the `mcpServers` section
36101
37102 Once installed, Snyk MCP tools become available to your Continue agent for all prompts.
@@ -59,35 +124,42 @@
59124
60125 </Step>
61126
62- <Step title="Authenticate with Snyk">
63- Use this prompt with your Continue agent to set up authentication:
64-
65- ```
66- Check Snyk auth status. If not authenticated, authenticate me and confirm my org context.
67- ```
68-
69- Or use the Continue CLI:
127+ <Step title="Run Your First Security Scan">
128+ Start with a comprehensive security scan:
70129 ```bash
71- cn -p "Check Snyk auth status. If not authenticated, authenticate me and confirm my org context."
130+ # TUI mode
131+ cn "Run a complete security scan on this project including code vulnerabilities, dependencies, and any IaC files. Summarize findings by severity."
72132 ```
73-
74- <Tip>
75- A browser window will open for Snyk login. After authenticating, approve
76- the request to trust your project folder when prompted.
77- </Tip>
78-
79133 </Step>
80134 </Steps>
81135
136+ </Tab>
137+</Tabs>
138+
139+<Accordion title="Agent Requirements">
140+ To use the pre-built agent, you need either:
141+ - **Continue CLI Pro Plan** with the models add-on, OR
142+ - **Your own API keys** added to Continue Hub secrets (same as manual setup)
143+
144+ The agent will automatically detect and use your configuration along with the pre-configured Snyk MCP for security scanning operations.
145+
146+</Accordion>
147+
148+---
149+
82150 ## Security Scanning Recipes
83151
84152 Now you can use natural language prompts to run comprehensive security scans. The Continue agent automatically calls the appropriate Snyk MCP tools.
85153
154+<Info>
155+You can add prompts to your agent's configuration for easy access in future sessions. Go to your agent in the [Continue Hub](https://hub.continue.dev), click **Edit**, and add prompts under the **Prompts** section.
156+</Info>
157+
86158 <Info>
87159 **Where to run these workflows:**
88160 - **IDE Extensions**: Use Continue in VS Code, JetBrains, or other supported IDEs
89161 - **Terminal (TUI mode)**: Run `cn` to enter interactive mode, then type your prompts
90- - **CLI (headless mode)**: Use `cn -p "your prompt"` for one-off commands
162+ - **CLI (headless mode)**: Use `cn -p "your prompt"` for headless commands
91163
92164 **Test in Plan Mode First**: Before running security scans that might make
93165 changes, test your prompts in plan mode (see the [Plan Mode
@@ -101,14 +173,14 @@
101173 <Card title="Static Application Security Testing" icon="code">
102174 Scan your source code for security vulnerabilities and code quality issues.
103175
104-**Example prompt:**
176+**TUI Mode Prompt:**
105177 ```
106178 Run a Snyk Code scan on this repo with severity threshold medium.
107179 Summarize issues with file:line. Propose minimal diffs for the top 3
108180 and rerun to verify.
109181 ```
110182
111-**Using Continue CLI:**
183+**Headless Mode Prompt:**
112184 ```bash
113185 cn -p "Run a Snyk Code scan on this repo with severity threshold medium. Summarize issues with file:line. Propose minimal diffs for the top 3 and rerun to verify."
114186 ```
@@ -120,14 +192,14 @@
120192 <Card title="Software Composition Analysis" icon="cube">
121193 Check open source dependencies for known vulnerabilities.
122194
123-**Example prompt:**
195+**TUI Mode Prompt:**
124196 ```
125197 Run Snyk Open Source on this repo (include dev deps).
126198 Summarize vulnerable paths and propose a minimal-risk upgrade plan.
127199 Re-test after the plan (dry run).
128200 ```
129201
130-**Using Continue CLI:**
202+**Headless Mode Prompt:**
131203 ```bash
132204 cn -p "Run Snyk Open Source on this repo (include dev deps). Summarize vulnerable paths and propose a minimal-risk upgrade plan. Re-test after the plan (dry run)."
133205 ```
@@ -139,13 +211,13 @@
139211 <Card title="IaC Security" icon="cloud">
140212 Scan Terraform, CloudFormation, and Kubernetes configs for misconfigurations.
141213
142-**Example prompt:**
214+**TUI Mode Prompt:**
143215 ```
144216 Scan ./infra with Snyk IaC. Report high/critical misconfigs
145217 with exact files/lines. Provide code changes and re-scan to confirm.
146218 ```
147219
148-**Using Continue CLI:**
220+**Headless Mode Prompt:**
149221 ```bash
150222 cn -p "Scan ./infra with Snyk IaC. Report high/critical misconfigs with exact files/lines. Provide code changes and re-scan to confirm."
151223 ```
@@ -157,14 +229,14 @@
157229 <Card title="Container Security" icon="docker">
158230 Analyze Docker images for vulnerabilities in base images and packages.
159231
160-**Example prompt:**
232+**TUI Mode Prompt:**
161233 ```
162234 Scan image my-api:latest. Exclude base image vulns.
163235 Print dependency tree. Recommend a safer base image or upgrades.
164236 Re-test after the change (dry run).
165237 ```
166238
167-**Using Continue CLI:**
239+**Headless Mode Prompt:**
168240 ```bash
169241 cn -p "Scan image my-api:latest. Exclude base image vulns. Print dependency tree. Recommend a safer base image or upgrades. Re-test after the change (dry run)."
170242 ```
@@ -176,13 +248,13 @@
176248 <Card title="Changed Files Only" icon="code-branch">
177249 Focus scanning on modified files to catch issues before merging.
178250
179-**Example prompt:**
251+**TUI Mode Prompt:**
180252 ```
181253 Scan only files changed since origin/main with Snyk Code.
182254 Block if new high issues would be introduced. Show deltas.
183255 ```
184256
185-**Using Continue CLI:**
257+**Headless Mode Prompt:**
186258 ```bash
187259 cn -p "Scan only files changed since origin/main with Snyk Code. Block if new high issues would be introduced. Show deltas."
188260 ```
@@ -194,12 +266,12 @@
194266 <Card title="Snyk Learn Integration" icon="graduation-cap">
195267 Access security education resources based on identified vulnerabilities ([CWE](https://cwe.mitre.org/)).
196268
197-**Example prompt:**
269+**TUI Mode Prompt:**
198270 ```
199271 Open Snyk Learn lessons related to the top CWE(s) from this scan.
200272 ```
201273
202-**Using Continue CLI:**
274+**Headless Mode Prompt:**
203275 ```bash
204276 cn -p "Open Snyk Learn lessons related to the top CWE(s) from this scan."
205277 ```
@@ -208,7 +280,7 @@
208280
209281 ## Continuous Security with GitHub Actions
210282
211-This example demonstrates a **Continuous AI workflow** where security scanning runs automatically in your CI/CD pipeline using Continue CLI in headless mode (`cn -p`) with Snyk MCP.
283+This example demonstrates a **Continuous AI workflow** where security scanning runs automatically in your CI/CD pipeline Headless Mode Prompt in headless mode (`cn -p`) with Snyk MCP.
212284
213285 ### Add GitHub Secrets
214286
@@ -249,8 +321,10 @@
249321 echo "✅ Continue CLI installed"
250322
251323 - name: Authenticate Continue CLI
324+ env:
325+ CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
252326 run: |
253- cn auth login --api-key "${{ secrets.CONTINUE_API_KEY }}"
327+ cn auth login --api-key "$CONTINUE_API_KEY"
254328 echo "✅ Continue CLI authenticated"
255329
256330 - name: Run Security Scans
modified docs/hub/agents/create-an-agent.mdx +3 −2
@@ -8,7 +8,8 @@
88
99 To create an agent from scratch, select “New agent” in the top bar.
1010
11-![New agent button](/images/hub/assistants/images/assistant-new-button-16070e2cff9ce25ec9ebfeecb0e2f2b5.png)
11+![New agent button](/images/hub/new-agent-button.png)
12+
1213
1314 Choose a name, slug, description, and icon for your agent.
1415
@@ -24,7 +25,7 @@
2425
2526 By clicking the “remix” button, you’ll be taken to the “Create a remix” page.
2627
27-![Remix Agent Button](/images/hub/assistants/images/assistant-remix-button-728ececa73983140eeab42e33cc3903b.png)
28+![Remix Agent Button](/images/hub/agent-remix-button.png)
2829
2930 Once here, you’ll be able to
3031
modified docs/images/cn-demo.gif +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/images/hub/agent-remix-button.png +0 −0

Binary content is not shown. View the file.

deleted docs/images/hub/assistant-new-button.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.

deleted docs/images/hub/assistants/images/assistant-new-button-16070e2cff9ce25ec9ebfeecb0e2f2b5.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.

deleted docs/images/hub/assistants/images/assistant-new-button.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.

deleted docs/images/hub/assistants/images/assistant-remix-button.png +0 −0

Binary content is not shown. View the file.

added docs/images/hub/new-agent-button.png +0 −0

Binary content is not shown. View the file.

modified docs/index.mdx +117 −24
@@ -1,55 +1,148 @@
11 ---
2-title: "Introduction"
2+title: "Welcome to Continue"
33 icon: book-open
4-description: "Continue is an open source platform for building AI-powered coding assistants with customizable components for chat, autocomplete, edit, and agent workflows in VS Code and JetBrains IDEs"
4+description: "Practice Continuous AI with an open-source CLI, open-source IDE extensions, and a Hub for custom AI coding agents"
55 ---
66
77 <Frame>
88 <img src="/images/intro-0c302b9c15b890c251b1ad04586c880f.png" />
99 </Frame>
1010
11-**Continue enables developers to ship faster with Continuous AI.**
11+<Note>
12+ **Build faster with AI across your IDE, terminal, and CI/CD pipelines with
13+ Continue.**
14+</Note>
1215
13-**You can use Continue to build and run custom agents across your IDE, terminal, and CI.**
16+## Continue CLI
1417
15-1. Get started with Continue in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions
18+<Info>Terminal-native AI coding assistance with TUI and headless modes.</Info>
1619
17-2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback
20+<CodeGroup>
1821
19-3. Discover models, rules, and MCP tools on [Continue Hub](https://hub.continue.dev/)
22+ ```bash npm
23+ npm install -g @continuedev/cli
24+ ```
25+
26+ ```bash yarn
27+ yarn global add @continuedev/cli
28+ ```
29+
30+ ```bash pnpm
31+ pnpm add -g @continuedev/cli
32+ ```
33+
34+</CodeGroup>
2035
2136 <CardGroup cols={2}>
2237 <Card
23- title="Agent"
24- icon="robot"
25- href="/features/agent/quick-start"
26- horizontal
38+ title="TUI Mode"
39+ icon="terminal"
40+ href="/cli/overview#tui-mode%3A-interactive-development"
2741 >
28- to work on development tasks together with AI
42+ Interactive terminal interface for development workflows
43+ <br />
44+ <sub>• Automate builds & refactoring</sub>
45+ <br />
46+ <sub>• Pre-commit hooks & scripted fixes</sub>
47+ <br />
48+ <sub>• Terminal-first development</sub>
2949 </Card>
3050 <Card
31- title="Chat"
32- icon="messages"
33- href="/features/chat/quick-start"
34- horizontal
51+ title="Headless Mode"
52+ icon="server"
53+ href="/cli/overview#headless-mode%3A-production-automation"
54+ >
55+ Automated AI coding for CI/CD and server environments
56+ <br />
57+ <sub>• Run in CI/CD pipelines</sub>
58+ <br />
59+ <sub>• Batch processing & bulk operations</sub>
60+ <br />
61+ <sub>• Server & container deployments</sub>
62+ </Card>
63+</CardGroup>
64+
65+## IDE Extensions
66+
67+<Info>
68+ **Complement your CLI workflow** - Rich editor integrations for interactive
69+ development.
70+</Info>
71+
72+<CardGroup cols={2}>
73+ <Card
74+ title="VS Code"
75+ icon="code"
76+ href="https://marketplace.visualstudio.com/items?itemName=Continue.continue"
3577 >
36- to ask general questions and clarify code sections
78+ Install from VS Code Marketplace
79+ <br />
80+ <sub>Real-time coding assistance and refactoring</sub>
3781 </Card>
3882 <Card
39- title="Edit"
40- icon="pen-to-square"
41- href="/features/edit/quick-start"
42- horizontal
83+ title="JetBrains"
84+ icon="jet-fighter"
85+ href="https://plugins.jetbrains.com/plugin/22707-continue-extension"
4386 >
44- to modify a code section without leaving your current file
87+ Install from JetBrains Plugin Repository
88+ <br />
89+ <sub>Autocomplete and multi-file edits</sub>
90+ </Card>
91+</CardGroup>
92+
93+## Core Features
94+
95+<CardGroup cols={2}>
96+ <Card title="Agent" icon="robot" href="/features/agent/quick-start">
97+ Multi-step workflows and complex task automation
98+ </Card>
99+ <Card title="Chat" icon="messages" href="/features/chat/quick-start">
100+ Ask questions and explore your codebase
101+ </Card>
102+ <Card title="Edit" icon="pen-to-square" href="/features/edit/quick-start">
103+ In-place code editing without breaking flow
45104 </Card>
46105 <Card
47106 title="Autocomplete"
48107 icon="sparkles"
49108 href="/features/autocomplete/quick-start"
50- horizontal
51109 >
52- to receive inline code suggestions as you type
110+ Inline AI suggestions as you type
111+ </Card>
112+</CardGroup>
113+
114+## Configuration
115+
116+<CardGroup cols={3}>
117+ <Card title="Models" icon="brain" href="/customization/models">
118+ Connect your preferred AI models
119+ </Card>
120+ <Card title="Rules" icon="shield" href="/customization/rules">
121+ Configure AI behavior and constraints
122+ </Card>
123+ <Card title="MCPs" icon="wrench" href="/customization/mcp-tools">
124+ Extend functionality with MCP tools
53125 </Card>
126+</CardGroup>
54127
128+## Resources
129+
130+<CardGroup cols={3}>
131+ <Card title="Continue Hub" icon="globe" href="https://hub.continue.dev/">
132+ Community models, rules, and tools
133+ </Card>
134+ <Card
135+ title="GitHub Discussions"
136+ icon="comments"
137+ href="https://github.com/continuedev/continue/discussions"
138+ >
139+ Get help from the community
140+ </Card>
141+ <Card
142+ title="CLI Examples"
143+ icon="code-branch"
144+ href="/guides/overview#continuous-ai"
145+ >
146+ TUI and headless workflow examples
147+ </Card>
55148 </CardGroup>
modified docs/reference.mdx +17 −124
@@ -1,136 +1,23 @@
11 ---
22 title: "config.yaml Reference"
3-description: "Comprehensive guide to the config.yaml format used by Continue.dev for building custom coding agents. Learn how to define models, context providers, rules, prompts, and more using reusable blocks and YAML configuration."
3+description: "Comprehensive guide to the config.yaml format used by Continue.dev for building custom coding agents. Learn how to define models, context providers, rules, prompts, and more using YAML configuration."
44 ---
55
66 ## Introduction
77
8-Continue hub agents are defined using the `config.yaml` specification. Agents can be loaded from [the Hub](https://hub.continue.dev/explore/agents) or locally
8+Continue Agents are defined using the `config.yaml` specification.
99
10-- [Continue Hub](https://hub.continue.dev/explore/agents) - YAML is stored on the hub and automatically synced to the extension
10+**Agents** are composed of models, rules, and tools (MCP servers).
1111
12-- Locally
13- - in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) within `.continue/agents`. The name of the file will be used as the display name of the agent, e.g. `My Agent.yaml`
14- - in your workspace in a `/.continue/agents` folder, with the same naming convention
12+<Columns cols={2}>
13+<Card title="Configuring Models, Rules, and Tools" icon="cube" href="/guides/configuring-models-rules-tools">
14+Learn how to work with Continue's configuration system, including using hub models, rules, and tools, creating local configurations, and organizing your setup.
15+</Card>
1516
16-<Info>
17- Config YAML replaces `config.json`, which is deprecated. View the **[Migration
18- Guide](/reference/yaml-migration)**.
19-</Info>
20-
21-An agent is made up of:
22-
23-1. **Top level properties**, which specify the `name`, `version`, and `config.yaml` `schema` for the agent
24-2. **Block lists**, which are composable arrays of coding agent building blocks available to the agent, such as models, docs, and context providers.
25-
26-A block is a single standalone building block of a coding agents, e.g., one model or one documentation source. In `config.yaml` syntax, a block consists of the same top-level properties as agents (`name`, `version`, and `schema`), but only has **ONE** item under whichever block type it is.
27-
28-Examples of blocks and agents can be found on the [Continue Hub](https://hub.continue.dev).
29-
30-Agents can either explicitly define blocks - see [Properties](#properties) below - or import and configure existing hub blocks.
31-
32-### Using Blocks
33-
34-Hub blocks and agents are identified with a slug in the format `owner-slug/block-or-agent-slug`, where an owner can be a user or organization (For example, if you want to use the [OpenAI 4o Model block](https://hub.continue.dev/openai/gpt-4o), your slug would be `openai/gpt-4o`). These blocks are pulled from [https://hub.continue.dev](https://hub.continue.dev).
35-
36-Blocks can be imported into an agent by adding a `uses` clause under the block type. This can be alongside other `uses` clauses or explicit blocks of that type.
37-
38-For example, the following agent imports an Anthropic model and defines an Ollama DeepSeek one.
39-
40-Agent models section
41-
42-```yaml
43-name: Team Agent
44-version: 1.0.0
45-schema: v1
46-
47-models:
48- - uses: anthropic/claude-3.5-sonnet # an imported model block
49- - model: deepseek-reasoner # an explicit model block
50- provider: ollama
51-```
52-
53-### Local Blocks
54-
55-It is also possible to define blocks locally in a `.continue` folder. This folder can be located at either the root of your workspace (these will automatically be applied to all agents when you are in that workspace) or in your home directory at `~/.continue` (these will automatically be applied globally).
56-
57-Place your YAML files in the following folders:
58-
59-Agents:
60-
61-- `.continue/agents` - for agents
62-
63-Blocks:
64-
65-- `.continue/rules` - for rules
66-- `.continue/models` - for models
67-- `.continue/prompts` - for prompts
68-- `.continue/context` - for context providers
69-- `.continue/docs` - for docs
70-- `.continue/data` - for data
71-- `.continue/mcpServers` - for MCP Servers
72-
73-You can find many examples of each of these block types on the [Continue Explore Page](https://hub.continue.dev/explore/models)
74-
75-<Info>
76-Local blocks utilizing mustache notation for secrets (`${{ secrets.SECRET_NAME }}`) can read secret values:
77-
78-- globally, from a `.env` located in the global `.continue` folder (`~/.continue/.env`)
79-- per-workspace, from a `.env` file located at the root of the current workspace.
80-
81-</Info>
82-
83-### Inputs
84-
85-Blocks can be passed user inputs, including hub secrets and raw text values. To create a block that has an input, use mustache templating as follows:
86-
87-```yaml title="config.yaml"
88-name: myprofile/custom-model
89-version: 1.0.0
90-schema: v1
91-
92-models:
93- - name: My Favorite Model
94- provider: anthropic
95- apiKey: ${{ inputs.ANTHROPIC_API_KEY }}
96- defaultCompletionOptions:
97- temperature: ${{ inputs.TEMP }}
98-```
99-
100-Which can then be imported like this:
101-
102-```yaml title="config.yaml"
103-name: myprofile/custom-agent
104-version: 1.0.0
105-schema: v1
106-
107-models:
108- - uses: myprofile/custom-model
109- with:
110- ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }}
111- TEMP: 0.9
112-```
113-
114-Note that hub secrets can be passed as inputs, using a similar mustache format: `secrets.SECRET_NAME`.
115-
116-### Overrides
117-
118-Block properties can be also be directly overriden using `override`. For example:
119-
120-```yaml title="config.yaml"
121-name: myprofile/custom-agent
122-version: 1.0.0
123-schema: v1
124-
125-models:
126- - uses: myprofile/custom-model
127- with:
128- ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }}
129- TEMP: 0.9
130- override:
131- roles:
132- - chat
133-```
17+<Card title="Understanding Agents" icon="robot" href="/guides/understanding-agents">
18+Learn how to build and configure agents, understand their capabilities, and customize them for your development workflow.
19+</Card>
20+</Columns>
13421
13522 ## Properties
13623
@@ -566,3 +453,9 @@
566453 maxPromptTokens: 1024
567454 onlyMyCode: true
568455 ```
456+
457+---
458+
459+## `config.json` Deprecation
460+
461+`config.yaml `replaces `config.json`, which is deprecated. View the **[Migration Guide](/reference/yaml-migration)** for help transitioning from the old format.
modified extensions/cli/src/commands/init.ts +20 −2
@@ -1,9 +1,11 @@
11 import { type AssistantConfig } from "@continuedev/sdk";
2+import { createRelativeRuleFilePath } from "core/config/markdown/utils.js";
23
34 import { SlashCommandResult } from "../ui/hooks/useChat.types.js";
45
56 function createInitPrompt(): string {
6- return `Please analyze this repository and create a comprehensive AGENTS.md file. Use your available tools to understand the project structure, read important files like README.md, package.json, requirements.txt, and other configuration files to understand the technology stack and setup.
7+ const relativeRuleFilepath = createRelativeRuleFilePath("review");
8+ return `Please analyze this repository and create a comprehensive AGENTS.md file, along with a custom slash command. Use your available tools to understand the project structure, read important files like README.md, package.json, requirements.txt, and other configuration files to understand the technology stack and setup.
79
810 Create an AGENTS.md file with the following structure:
911
@@ -30,7 +32,23 @@
3032 - Development environment setup
3133 - Lint and format commands
3234
33-Please create the AGENTS.md file using the Write tool after analyzing the repository. Focus on providing actionable information that would help both AI agents and human developers understand and work effectively with this codebase. Keep the file concise but informational.`;
35+Additionally, create a slash command file at ${relativeRuleFilepath} with the following structure:
36+
37+\`\`\`md
38+---
39+invokable: true
40+---
41+
42+Review this code for potential issues, including:
43+
44+<insert custom things to look for based on the repository details you find>
45+
46+Provide specific, actionable feedback for improvements.
47+\`\`\`
48+
49+This slash command will be invokable using /review and will provide instructions for code review tasks common to this repository.
50+
51+Please create both the AGENTS.md file and the .continue/rules/review.md file using the Write tool after analyzing the repository. Focus on providing actionable information that would help both AI agents and human developers understand and work effectively with this codebase. Keep the files concise but informational.`;
3452 }
3553
3654 export async function handleInit(
modified extensions/cli/src/tools/listFiles.ts +17 −11
@@ -22,13 +22,27 @@
2222 readonly: true,
2323 isBuiltIn: true,
2424 preprocess: async (args) => {
25+ // Resolve relative paths
26+ const normalizedPath = path.normalize(args.dirpath);
27+ const dirPath = path.resolve(process.cwd(), normalizedPath);
28+
29+ if (!fs.existsSync(dirPath)) {
30+ throw new Error(`Directory does not exist: ${dirPath}`);
31+ }
32+
33+ if (!fs.statSync(dirPath).isDirectory()) {
34+ throw new Error(`Error: Path is not a directory: ${dirPath}`);
35+ }
36+
2537 return {
26- args,
38+ args: {
39+ dirpath: dirPath,
40+ },
2741 preview: [
2842 {
2943 type: "text",
30- content: args.dirpath
31- ? `Will list files in: ${formatToolArgument(args.dirpath)}`
44+ content: dirPath
45+ ? `Will list files in: ${formatToolArgument(dirPath)}`
3246 : "Will list files in current directory",
3347 },
3448 ],
@@ -36,14 +50,6 @@
3650 },
3751 run: async (args: { dirpath: string }): Promise<string> => {
3852 try {
39- if (!fs.existsSync(args.dirpath)) {
40- return `Error: Directory does not exist: ${args.dirpath}`;
41- }
42-
43- if (!fs.statSync(args.dirpath).isDirectory()) {
44- return `Error: Path is not a directory: ${args.dirpath}`;
45- }
46-
4753 const files = fs.readdirSync(args.dirpath);
4854 const fileDetails = files.map((file) => {
4955 const fullPath = path.join(args.dirpath, file);
added extensions/cli/src/ui/components/ChecklistDisplay.test.tsx +63 −0
@@ -0,0 +1,63 @@
1+import { render } from "ink-testing-library";
2+import React from "react";
3+
4+import { ChecklistDisplay } from "./ChecklistDisplay.js";
5+
6+describe("ChecklistDisplay", () => {
7+ it("should highlight the first incomplete item", () => {
8+ const content = `Task list status:
9+- [x] Completed task
10+- [ ] First incomplete task
11+- [ ] Second incomplete task`;
12+
13+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
14+ const output = lastFrame();
15+
16+ // The output should contain the checkbox symbols and text
17+ expect(output).toContain("✓");
18+ expect(output).toContain("○");
19+ expect(output).toContain("Completed task");
20+ expect(output).toContain("First incomplete task");
21+ expect(output).toContain("Second incomplete task");
22+ });
23+
24+ it("should handle empty checklist", () => {
25+ const content = "Task list status:";
26+
27+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
28+ const output = lastFrame();
29+
30+ expect(output).toBeDefined();
31+ });
32+
33+ it("should handle all completed tasks", () => {
34+ const content = `Task list status:
35+- [x] Completed task 1
36+- [x] Completed task 2`;
37+
38+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
39+ const output = lastFrame();
40+
41+ expect(output).toContain("✓");
42+ expect(output).toContain("Completed task 1");
43+ expect(output).toContain("Completed task 2");
44+ });
45+
46+ it("should handle mixed content with headers", () => {
47+ const content = `Task list status:
48+## Important Tasks
49+- [x] Done task
50+- [ ] Todo task
51+
52+## Other Tasks
53+- [ ] Another todo`;
54+
55+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
56+ const output = lastFrame();
57+
58+ expect(output).toContain("Important Tasks");
59+ expect(output).toContain("Other Tasks");
60+ expect(output).toContain("✓");
61+ expect(output).toContain("○");
62+ });
63+});
modified extensions/cli/src/ui/components/ChecklistDisplay.tsx +16 −1
@@ -13,6 +13,17 @@
1313 }) => {
1414 const lines = content.split("\n");
1515
16+ // Find the index of the first incomplete checkbox item
17+ let firstIncompleteIndex = -1;
18+ for (let i = 0; i < lines.length; i++) {
19+ const line = lines[i];
20+ const checkboxMatch = line.match(/^(\s*)-\s*\[([ x])\]\s*(.*)$/);
21+ if (checkboxMatch && checkboxMatch[2] === " ") {
22+ firstIncompleteIndex = i;
23+ break;
24+ }
25+ }
26+
1627 return (
1728 <Box flexDirection="column" paddingLeft={2}>
1829 {lines.map((line, index) => {
@@ -25,6 +36,7 @@
2536 if (checkboxMatch) {
2637 const [, indent, status, taskText] = checkboxMatch;
2738 const isCompleted = status === "x";
39+ const isFirstIncomplete = index === firstIncompleteIndex;
2840
2941 return (
3042 <Box key={index}>
@@ -34,8 +46,11 @@
3446 </Text>
3547 <Text> </Text>
3648 <Text
37- color={isCompleted ? "gray" : "white"}
49+ color={
50+ isCompleted ? "gray" : isFirstIncomplete ? "cyan" : "white"
51+ }
3852 strikethrough={isCompleted}
53+ bold={isFirstIncomplete}
3954 >
4055 {taskText}
4156 </Text>
modified extensions/intellij/gradle.properties +1 −1
@@ -1,5 +1,5 @@
11 pluginGroup=com.github.continuedev.continueintellijextension
2-pluginVersion=1.0.45
2+pluginVersion=1.0.46
33 platformVersion=2024.1
44 kotlin.stdlib.default.dependency=false
55 org.gradle.configuration-cache=true
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 +16 −1
@@ -2,7 +2,7 @@
22 "name": "continue",
33 "icon": "media/icon.png",
44 "author": "Continue Dev, Inc",
5- "version": "1.3.12",
5+ "version": "1.3.13",
66 "repository": {
77 "type": "git",
88 "url": "https://github.com/continuedev/continue"
@@ -373,6 +373,12 @@
373373 "category": "Continue",
374374 "title": "Generate Rule",
375375 "group": "Continue"
376+ },
377+ {
378+ "command": "continue.openInNewWindow",
379+ "category": "Continue",
380+ "title": "Open in new window",
381+ "group": "Continue"
376382 }
377383 ],
378384 "keybindings": [
@@ -443,6 +449,12 @@
443449 "mac": "cmd+shift+r",
444450 "key": "ctrl+shift+r"
445451 },
452+ {
453+ "command": "continue.openInNewWindow",
454+ "mac": "cmd+k cmd+m",
455+ "key": "ctrl+k ctrl+m",
456+ "when": "!terminalFocus"
457+ },
446458 {
447459 "command": "continue.toggleTabAutocompleteEnabled",
448460 "mac": "cmd+k cmd+a",
@@ -512,6 +524,9 @@
512524 },
513525 {
514526 "command": "continue.generateRule"
527+ },
528+ {
529+ "command": "continue.openInNewWindow"
515530 }
516531 ],
517532 "editor/context": [
modified extensions/vscode/src/commands.ts +102 −6
@@ -46,6 +46,15 @@
4646 import { openEditorAndRevealRange } from "./util/vscode";
4747 import { VsCodeIde } from "./VsCodeIde";
4848
49+let fullScreenPanel: vscode.WebviewPanel | undefined;
50+
51+function getFullScreenTab() {
52+ const tabs = vscode.window.tabGroups.all.flatMap((tabGroup) => tabGroup.tabs);
53+ return tabs.find((tab) =>
54+ (tab.input as any)?.viewType?.endsWith("continue.continueGUIView"),
55+ );
56+}
57+
4958 type TelemetryCaptureParams = Parameters<typeof Telemetry.capture>;
5059
5160 /**
@@ -59,15 +68,27 @@
5968 }
6069
6170 function focusGUI() {
62- // focus sidebar
63- vscode.commands.executeCommand("continue.continueGUIView.focus");
64- // vscode.commands.executeCommand("workbench.action.focusAuxiliaryBar");
71+ const fullScreenTab = getFullScreenTab();
72+ if (fullScreenTab) {
73+ // focus fullscreen
74+ fullScreenPanel?.reveal();
75+ } else {
76+ // focus sidebar
77+ vscode.commands.executeCommand("continue.continueGUIView.focus");
78+ // vscode.commands.executeCommand("workbench.action.focusAuxiliaryBar");
79+ }
6580 }
6681
6782 function hideGUI() {
68- // focus sidebar
69- vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
70- // vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar");
83+ const fullScreenTab = getFullScreenTab();
84+ if (fullScreenTab) {
85+ // focus fullscreen
86+ fullScreenPanel?.dispose();
87+ } else {
88+ // focus sidebar
89+ vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
90+ // vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar");
91+ }
7192 }
7293
7394 function waitForSidebarReady(
@@ -602,6 +623,11 @@
602623 label: "$(comment) Open chat",
603624 description: getMetaKeyLabel() + " + L",
604625 },
626+ {
627+ label: "$(screen-full) Open full screen chat",
628+ description:
629+ getMetaKeyLabel() + " + K, " + getMetaKeyLabel() + " + M",
630+ },
605631 {
606632 label: quickPickStatusText(targetStatus),
607633 description:
@@ -644,6 +670,8 @@
644670 }
645671 } else if (selectedOption === "$(comment) Open chat") {
646672 vscode.commands.executeCommand("continue.focusContinueInput");
673+ } else if (selectedOption === "$(screen-full) Open full screen chat") {
674+ vscode.commands.executeCommand("continue.openInNewWindow");
647675 } else if (selectedOption === "$(gear) Open settings") {
648676 vscode.commands.executeCommand("continue.navigateTo", "/config");
649677 }
@@ -770,6 +798,74 @@
770798 vscode.ConfigurationTarget.Global,
771799 );
772800 },
801+ "continue.openInNewWindow": async () => {
802+ focusGUI();
803+
804+ const sessionId = await sidebar.webviewProtocol.request(
805+ "getCurrentSessionId",
806+ undefined,
807+ );
808+ // Check if full screen is already open by checking open tabs
809+ const fullScreenTab = getFullScreenTab();
810+
811+ if (fullScreenTab && fullScreenPanel) {
812+ // Full screen open, but not focused - focus it
813+ fullScreenPanel.reveal();
814+ return;
815+ }
816+
817+ // Clear the sidebar to prevent overwriting changes made in fullscreen
818+ vscode.commands.executeCommand("continue.newSession");
819+
820+ // Full screen not open - open it
821+ captureCommandTelemetry("openInNewWindow");
822+
823+ // Create the full screen panel
824+ let panel = vscode.window.createWebviewPanel(
825+ "continue.continueGUIView",
826+ "Continue",
827+ vscode.ViewColumn.One,
828+ {
829+ retainContextWhenHidden: true,
830+ enableScripts: true,
831+ },
832+ );
833+ fullScreenPanel = panel;
834+
835+ // Add content to the panel
836+ panel.webview.html = sidebar.getSidebarContent(
837+ extensionContext,
838+ panel,
839+ undefined,
840+ undefined,
841+ true,
842+ );
843+
844+ const sessionLoader = panel.onDidChangeViewState(() => {
845+ vscode.commands.executeCommand("continue.newSession");
846+ if (sessionId) {
847+ vscode.commands.executeCommand(
848+ "continue.focusContinueSessionId",
849+ sessionId,
850+ );
851+ }
852+ panel.reveal();
853+ sessionLoader.dispose();
854+ });
855+
856+ // When panel closes, reset the webview and focus
857+ panel.onDidDispose(
858+ () => {
859+ sidebar.resetWebviewProtocolWebview();
860+ vscode.commands.executeCommand("continue.focusContinueInput");
861+ },
862+ null,
863+ extensionContext.subscriptions,
864+ );
865+
866+ vscode.commands.executeCommand("workbench.action.copyEditorToNewWindow");
867+ vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
868+ },
773869 "continue.forceNextEdit": async () => {
774870 captureCommandTelemetry("forceNextEdit");
775871
modified extensions/vscode/src/extension/VsCodeMessenger.ts +3 −0
@@ -113,6 +113,9 @@
113113 this.onWebview("focusEditor", (msg) => {
114114 vscode.commands.executeCommand("workbench.action.focusActiveEditorGroup");
115115 });
116+ this.onWebview("toggleFullScreen", (msg) => {
117+ vscode.commands.executeCommand("continue.openInNewWindow");
118+ });
116119
117120 this.onWebview("acceptDiff", async ({ data: { filepath, streamId } }) => {
118121 await vscode.commands.executeCommand(
added gui/public/logos/cometapi.png +0 −0

Binary content is not shown. View the file.

modified gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx +1 −3
@@ -48,9 +48,7 @@
4848 ) : (
4949 <>
5050 <AssistantIcon assistant={selectedProfile} size={iconSize} />
51- <span
52- className={`select-none truncate text-xs ${isSidebar && "hidden md:block"}`}
53- >
51+ <span className={`xs:line-clamp-1 hidden select-none text-xs`}>
5452 {selectedProfile.title}
5553 </span>
5654 </>
modified gui/src/components/AssistantAndOrgListbox/index.tsx +1 −1
@@ -150,7 +150,7 @@
150150 />
151151 <Transition>
152152 <ListboxOptions
153- className="max-h-32 -translate-x-1.5 overflow-y-auto pb-0"
153+ className="max-h-32 scale-x-[97%] overflow-y-auto pb-0"
154154 style={{ zIndex: 200 }}
155155 >
156156 <div className="flex items-center justify-between px-1.5 py-1">
modified gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx +1 −1
@@ -141,7 +141,7 @@
141141 {!!error ? (
142142 <div className="text-error whitespace-pre text-sm">{error}</div>
143143 ) : (
144- <div className="relative">
144+ <div className="mermaid relative">
145145 <div className="absolute right-0 z-10 m-2 flex items-center gap-x-1">
146146 <ToolTip content={"Zoom In"}>
147147 <MagnifyingGlassPlusIcon
modified gui/src/components/StyledMarkdownPreview/index.tsx +20 −0
@@ -84,6 +84,26 @@
8484 font-family: var(--vscode-editor-font-family);
8585 }
8686
87+ ul ul,
88+ ul ol,
89+ ol ul,
90+ ol ol {
91+ padding-left: 1.5em;
92+ margin-top: 1em;
93+ }
94+
95+ li {
96+ margin-bottom: 0.8em;
97+ }
98+ li:last-child {
99+ margin-bottom: 0;
100+ }
101+
102+ ul,
103+ ol {
104+ padding-left: 2em;
105+ }
106+
87107 code:not(pre > code) {
88108 font-family: var(--vscode-editor-font-family);
89109 }
modified gui/src/components/StyledMarkdownPreview/markdown.css +3 −0
@@ -1038,3 +1038,6 @@
10381038 .token.entity {
10391039 cursor: help;
10401040 }
1041+.mermaid foreignObject {
1042+ width: 100%;
1043+}
modified gui/src/components/mainInput/InputToolbar.tsx +0 −1
@@ -56,7 +56,6 @@
5656 const hasReasoningEnabled = useAppSelector(
5757 (store) => store.session.hasReasoningEnabled,
5858 );
59-
6059 const isEnterDisabled =
6160 props.disabled || (isInEdit && codeToEdit.length === 0);
6261
modified gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx +1 −1
@@ -105,7 +105,7 @@
105105 };
106106
107107 return (
108- <div className="flex flex-1 items-center justify-between gap-1.5">
108+ <div className="flex flex-1 items-center justify-between gap-3">
109109 <div className="flex items-center gap-1">
110110 {shouldShowError && (
111111 <ToolTip delayShow={700} content="View configuration errors">
modified gui/src/components/mainInput/Lump/LumpToolbar/LumpToolbar.tsx +13 −2
@@ -12,6 +12,7 @@
1212 import { cancelStream } from "../../../../redux/thunks/cancelStream";
1313 import { logToolUsage } from "../../../../redux/util";
1414 import { isJetBrains } from "../../../../util";
15+import { useMainEditor } from "../../TipTapEditor";
1516 import { BlockSettingsTopToolbar } from "./BlockSettingsTopToolbar";
1617 import { EditOutcomeToolbar } from "./EditOutcomeToolbar";
1718 import { EditToolbar } from "./EditToolbar";
@@ -64,6 +65,7 @@
6465 (state) => state.status === "done",
6566 );
6667 const isApplying = applyStates.some((state) => state.status === "streaming");
68+ const editor = useMainEditor();
6769
6870 // Get ALL running terminal commands
6971 const runningToolCalls = useAppSelector((state) =>
@@ -140,7 +142,10 @@
140142 // Stop running terminal commands
141143 void handleStopAction();
142144 } else if (firstPendingToolCall) {
143- // Cancel pending tool call
145+ // Cancel pending tool call. If last call, focus editor
146+ if (pendingToolCalls.length === 1) {
147+ editor.mainEditor?.commands.focus();
148+ }
144149 void dispatch(
145150 cancelToolCall({
146151 toolCallId: firstPendingToolCall.toolCallId,
@@ -155,7 +160,13 @@
155160 return () => {
156161 document.removeEventListener("keydown", handleToolCallKeyboardShortcuts);
157162 };
158- }, [firstPendingToolCall, hasRunningTerminalCommand, runningTerminalCalls]);
163+ }, [
164+ firstPendingToolCall,
165+ pendingToolCalls,
166+ editor,
167+ hasRunningTerminalCommand,
168+ runningTerminalCalls,
169+ ]);
159170
160171 if (isApplying) {
161172 return <IsApplyingToolbar />;
modified gui/src/components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar.tsx +6 −0
@@ -4,6 +4,7 @@
44 import { cancelToolCallThunk } from "../../../../redux/thunks/cancelToolCall";
55 import { getAltKeyLabel, getMetaKeyLabel, isJetBrains } from "../../../../util";
66 import { Button } from "../../../ui";
7+import { useMainEditor } from "../../TipTapEditor";
78
89 export const generateToolCallButtonTestId = (
910 action: "accept" | "reject",
@@ -16,6 +17,7 @@
1617 const dispatch = useAppDispatch();
1718 const jetbrains = isJetBrains();
1819 const pendingToolCalls = useAppSelector(selectPendingToolCalls);
20+ const editor = useMainEditor();
1921
2022 if (pendingToolCalls.length === 0) {
2123 return null;
@@ -26,6 +28,10 @@
2628 };
2729
2830 const handleReject = (toolCallId: string) => {
31+ // put cursor in editor after last rejection
32+ if (pendingToolCalls.length === 1) {
33+ editor.mainEditor?.commands.focus();
34+ }
2935 void dispatch(cancelToolCallThunk({ toolCallId }));
3036 };
3137
modified gui/src/components/modelSelection/ModelSelect.tsx +13 −12
@@ -5,17 +5,15 @@
55 CubeIcon,
66 PlusIcon,
77 } from "@heroicons/react/24/outline";
8-import { useContext, useEffect, useRef, useState } from "react";
8+import { useEffect, useRef, useState } from "react";
99 import { useNavigate } from "react-router-dom";
1010 import { useAuth } from "../../context/Auth";
11-import { IdeMessengerContext } from "../../context/IdeMessenger";
1211 import { AddModelForm } from "../../forms/AddModelForm";
1312 import { useAppDispatch, useAppSelector } from "../../redux/hooks";
1413 import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
1514 import { updateSelectedModelByRole } from "../../redux/thunks/updateSelectedModelByRole";
1615 import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
1716 import { CONFIG_ROUTES } from "../../util/navigation";
18-import { ToolTip } from "../gui/Tooltip";
1917 import {
2018 Button,
2119 Listbox,
@@ -52,6 +50,15 @@
5250 return model?.class_name;
5351 }
5452
53+/**makeshift way to close the headlessui listbox due to absence of open state on the listbox */
54+function closeDropDown(button: HTMLButtonElement | null) {
55+ if (!button) return;
56+ button.classList.add("hidden");
57+ setTimeout(() => {
58+ button.classList.remove("hidden");
59+ });
60+}
61+
5562 function ModelOption({
5663 option,
5764 idx,
@@ -117,7 +124,6 @@
117124 const isInEdit = useAppSelector((store) => store.session.isInEdit);
118125 const config = useAppSelector((state) => state.config.config);
119126 const isConfigLoading = useAppSelector((state) => state.config.loading);
120- const ideMessenger = useContext(IdeMessengerContext);
121127 const buttonRef = useRef<HTMLButtonElement>(null);
122128 const [options, setOptions] = useState<Option[]>([]);
123129 const [sortedOptions, setSortedOptions] = useState<Option[]>([]);
@@ -201,10 +207,8 @@
201207 e.stopPropagation();
202208 e.preventDefault();
203209
204- // Close the dropdown
205- if (buttonRef.current) {
206- buttonRef.current.click();
207- }
210+ closeDropDown(buttonRef.current);
211+
208212 dispatch(setShowDialog(true));
209213 dispatch(
210214 setDialogMessage(
@@ -221,10 +225,7 @@
221225 e.stopPropagation();
222226 e.preventDefault();
223227
224- // Close the dropdown
225- if (buttonRef.current) {
226- buttonRef.current.click();
227- }
228+ closeDropDown(buttonRef.current);
228229
229230 navigate(CONFIG_ROUTES.MODELS);
230231 }
modified gui/src/components/ui/Button.tsx +1 −1
@@ -40,7 +40,7 @@
4040 className={cn(
4141 "cursor-pointer transition-all duration-200",
4242 "hover:enabled:cursor-pointer",
43- "disabled:text-description-muted disabled:pointer-events-none disabled:opacity-50",
43+ "disabled:cursor-not-allowed disabled:opacity-50",
4444 buttonVariants[variant],
4545 isIcon
4646 ? iconButtonSizes[size]
modified gui/src/hooks/useLLMLog.ts +2 −1
@@ -10,6 +10,7 @@
1010 LLMInteractionSuccess,
1111 } from "core";
1212 import { useEffect, useReducer } from "react";
13+import { v4 as uuidv4 } from "uuid";
1314
1415 declare const vscode: any;
1516
@@ -231,7 +232,7 @@
231232 // messages from the previous generation. In particular, this
232233 // avoids problems when React.StrictMode runs this effect
233234 // twice - we don't want to process two "init" messages.
234- const uuid = crypto.randomUUID();
235+ const uuid = uuidv4();
235236 const onMessage = (event: MessageEvent<ToConsoleView>) => {
236237 if (event.data.uuid !== uuid) {
237238 return;
modified gui/src/pages/AddNewModel/configs/models.ts +452 −7
@@ -1585,14 +1585,83 @@
15851585 providerOptions: ["scaleway", "nebius", "ovhcloud", "ncompass"],
15861586 isOpenSource: true,
15871587 },
1588- grokBeta: {
1589- title: "Grok Beta",
1590- description: "Generative artificial intelligence chatbot developed by xAI.",
1591- refUrl: "",
1588+ grokCodeFast1: {
1589+ title: "Grok Code Fast 1",
1590+ description:
1591+ "A speedy and economical reasoning model that excels at agentic coding",
1592+ refUrl: "https://docs.x.ai/docs/models/grok-code-fast-1",
15921593 params: {
1593- title: "Grok Beta",
1594- model: "grok-beta",
1595- contextLength: 128_000,
1594+ title: "Grok Code Fast 1",
1595+ model: "grok-code-fast-1",
1596+ contextLength: 256000,
1597+ },
1598+ icon: "xAI.png",
1599+ providerOptions: ["xAI", "askSage"],
1600+ isOpenSource: false,
1601+ },
1602+ grok4FastReasoning: {
1603+ title: "Grok 4 Fast Reasoning",
1604+ description: "xAI's latest advancement in cost-efficient reasoning models",
1605+ refUrl: "https://docs.x.ai/docs/models/grok-4-fast-reasoning",
1606+ params: {
1607+ title: "Grok 4 Fast Reasoning",
1608+ model: "grok-4-fast-reasoning",
1609+ contextLength: 2_000_000,
1610+ },
1611+ icon: "xAI.png",
1612+ providerOptions: ["xAI", "askSage"],
1613+ isOpenSource: false,
1614+ },
1615+ grok4FastNonReasoning: {
1616+ title: "Grok 4 Fast Non-Reasoning",
1617+ description: "xAI's latest advancement in cost-efficient models",
1618+ refUrl: "https://docs.x.ai/docs/models/grok-4-fast-non-reasoning",
1619+ params: {
1620+ title: "Grok 4 Fast Non-Reasoning",
1621+ model: "grok-4-fast-non-reasoning",
1622+ contextLength: 2_000_000,
1623+ },
1624+ icon: "xAI.png",
1625+ providerOptions: ["xAI", "askSage"],
1626+ isOpenSource: false,
1627+ },
1628+ grok4: {
1629+ title: "Grok 4",
1630+ description:
1631+ "xAI's latest and greatest flagship model, offering strong performance in natural language, math and reasoning.",
1632+ refUrl: "https://docs.x.ai/docs/models/grok-4",
1633+ params: {
1634+ title: "Grok 4",
1635+ model: "grok-4",
1636+ contextLength: 256_000,
1637+ },
1638+ icon: "xAI.png",
1639+ providerOptions: ["xAI", "askSage"],
1640+ isOpenSource: false,
1641+ },
1642+ grok3: {
1643+ title: "Grok 3",
1644+ description:
1645+ "Excels at enterprise use cases like data extraction, coding, and text summarization",
1646+ refUrl: "https://docs.x.ai/docs/models/grok-3",
1647+ params: {
1648+ title: "Grok 3",
1649+ model: "grok-3",
1650+ contextLength: 131_072,
1651+ },
1652+ icon: "xAI.png",
1653+ providerOptions: ["xAI", "askSage"],
1654+ isOpenSource: false,
1655+ },
1656+ grok3Mini: {
1657+ title: "Grok 3 Mini",
1658+ description:
1659+ "A lightweight model that thinks before responding. Fast, smart, and great for logic-based tasks that do not require deep domain knowledge.",
1660+ refUrl: "https://docs.x.ai/docs/models/grok-3-mini",
1661+ params: {
1662+ title: "Grok 3 Mini",
1663+ model: "grok-3-mini",
1664+ contextLength: 131_072,
15961665 },
15971666 icon: "xAI.png",
15981667 providerOptions: ["xAI", "askSage"],
@@ -1836,4 +1905,380 @@
18361905 providerOptions: [],
18371906 isOpenSource: false,
18381907 },
1908+
1909+ // CometAPI Models
1910+
1911+ // GPT series models via CometAPI
1912+ cometapiGpt5ChatLatest: {
1913+ title: "GPT-5 Chat Latest",
1914+ description:
1915+ "GPT-5 Chat Latest via CometAPI - OpenAI's most advanced conversational model.",
1916+ params: {
1917+ model: "gpt-5-chat-latest",
1918+ contextLength: 400_000,
1919+ title: "GPT-5 Chat Latest",
1920+ apiKey: "",
1921+ },
1922+ providerOptions: ["cometapi"],
1923+ icon: "cometapi.png",
1924+ isOpenSource: false,
1925+ },
1926+ cometapiGpt5Mini: {
1927+ title: "GPT-5 Mini",
1928+ description:
1929+ "GPT-5 Mini via CometAPI - compact version of GPT-5 optimized for efficiency.",
1930+ params: {
1931+ model: "gpt-5-mini",
1932+ contextLength: 400_000,
1933+ title: "GPT-5 Mini",
1934+ apiKey: "",
1935+ },
1936+ providerOptions: ["cometapi"],
1937+ icon: "cometapi.png",
1938+ isOpenSource: false,
1939+ },
1940+ cometapiGpt5: {
1941+ title: "GPT-5",
1942+ description:
1943+ "GPT-5 via CometAPI - OpenAI's flagship model with advanced reasoning capabilities.",
1944+ params: {
1945+ model: "gpt-5",
1946+ contextLength: 200_000,
1947+ title: "GPT-5",
1948+ apiKey: "",
1949+ },
1950+ providerOptions: ["cometapi"],
1951+ icon: "cometapi.png",
1952+ isOpenSource: false,
1953+ },
1954+ cometapiChatgpt4oLatest: {
1955+ title: "ChatGPT-4o Latest",
1956+ description:
1957+ "ChatGPT-4o Latest via CometAPI - latest version of GPT-4o with enhanced capabilities.",
1958+ params: {
1959+ model: "chatgpt-4o-latest",
1960+ contextLength: 128_000,
1961+ title: "ChatGPT-4o Latest",
1962+ apiKey: "",
1963+ },
1964+ providerOptions: ["cometapi"],
1965+ icon: "cometapi.png",
1966+ isOpenSource: false,
1967+ },
1968+ cometapiGpt41: {
1969+ title: "GPT-4.1",
1970+ description:
1971+ "GPT-4.1 via CometAPI - enhanced version of GPT-4.1 with improved reasoning.",
1972+ params: {
1973+ model: "gpt-4.1",
1974+ contextLength: 100_000,
1975+ title: "GPT-4.1",
1976+ apiKey: "",
1977+ },
1978+ providerOptions: ["cometapi"],
1979+ icon: "cometapi.png",
1980+ isOpenSource: false,
1981+ },
1982+ cometapiO4Mini: {
1983+ title: "O4 Mini",
1984+ description:
1985+ "O4 Mini via CometAPI - OpenAI's reasoning model optimized for efficiency.",
1986+ params: {
1987+ model: "o4-mini-2025-04-16",
1988+ contextLength: 200_000,
1989+ title: "O4 Mini",
1990+ apiKey: "",
1991+ },
1992+ providerOptions: ["cometapi"],
1993+ icon: "cometapi.png",
1994+ isOpenSource: false,
1995+ },
1996+ cometapiO3Pro: {
1997+ title: "O3 Pro",
1998+ description:
1999+ "O3 Pro via CometAPI - advanced reasoning model with enhanced problem-solving capabilities.",
2000+ params: {
2001+ model: "o3-pro-2025-06-10",
2002+ contextLength: 200_000,
2003+ title: "O3 Pro",
2004+ apiKey: "",
2005+ },
2006+ providerOptions: ["cometapi"],
2007+ icon: "cometapi.png",
2008+ isOpenSource: false,
2009+ },
2010+
2011+ // Claude series models via CometAPI
2012+ cometapiClaudeOpus41: {
2013+ title: "Claude Opus 4.1",
2014+ description:
2015+ "Claude Opus 4.1 via CometAPI - Anthropic's most capable model with advanced reasoning.",
2016+ params: {
2017+ model: "claude-opus-4-1-20250805",
2018+ contextLength: 200_000,
2019+ title: "Claude Opus 4.1",
2020+ apiKey: "",
2021+ },
2022+ providerOptions: ["cometapi"],
2023+ icon: "cometapi.png",
2024+ isOpenSource: false,
2025+ },
2026+ cometapiClaudeOpus41Thinking: {
2027+ title: "Claude Opus 4.1 Thinking",
2028+ description:
2029+ "Claude Opus 4.1 Thinking via CometAPI - version with enhanced thinking capabilities.",
2030+ params: {
2031+ model: "claude-opus-4-1-20250805-thinking",
2032+ contextLength: 200_000,
2033+ title: "Claude Opus 4.1 Thinking",
2034+ apiKey: "",
2035+ },
2036+ providerOptions: ["cometapi"],
2037+ icon: "cometapi.png",
2038+ isOpenSource: false,
2039+ },
2040+ cometapiClaudeSonnet4: {
2041+ title: "Claude Sonnet 4",
2042+ description:
2043+ "Claude Sonnet 4 via CometAPI - balanced performance and efficiency from Anthropic.",
2044+ params: {
2045+ model: "claude-sonnet-4-20250514",
2046+ contextLength: 200_000,
2047+ title: "Claude Sonnet 4",
2048+ apiKey: "",
2049+ },
2050+ providerOptions: ["cometapi"],
2051+ icon: "cometapi.png",
2052+ isOpenSource: false,
2053+ },
2054+ cometapiClaudeSonnet4Thinking: {
2055+ title: "Claude Sonnet 4 Thinking",
2056+ description:
2057+ "Claude Sonnet 4 Thinking via CometAPI - version with enhanced reasoning capabilities.",
2058+ params: {
2059+ model: "claude-sonnet-4-20250514-thinking",
2060+ contextLength: 200_000,
2061+ title: "Claude Sonnet 4 Thinking",
2062+ apiKey: "",
2063+ },
2064+ providerOptions: ["cometapi"],
2065+ icon: "cometapi.png",
2066+ isOpenSource: false,
2067+ },
2068+ cometapiClaude37SonnetLatest: {
2069+ title: "Claude 3.7 Sonnet Latest",
2070+ description:
2071+ "Claude 3.7 Sonnet Latest via CometAPI - latest version of Claude 3.7 Sonnet.",
2072+ params: {
2073+ model: "claude-3-7-sonnet-latest",
2074+ contextLength: 200_000,
2075+ title: "Claude 3.7 Sonnet Latest",
2076+ apiKey: "",
2077+ },
2078+ providerOptions: ["cometapi"],
2079+ icon: "cometapi.png",
2080+ isOpenSource: false,
2081+ },
2082+ cometapiClaude35HaikuLatest: {
2083+ title: "Claude 3.5 Haiku Latest",
2084+ description:
2085+ "Claude 3.5 Haiku Latest via CometAPI - fast and efficient model from Anthropic.",
2086+ params: {
2087+ model: "claude-3-5-haiku-latest",
2088+ contextLength: 200_000,
2089+ title: "Claude 3.5 Haiku Latest",
2090+ apiKey: "",
2091+ },
2092+ providerOptions: ["cometapi"],
2093+ icon: "cometapi.png",
2094+ isOpenSource: false,
2095+ },
2096+
2097+ // Gemini series models via CometAPI
2098+ cometapiGemini25Pro: {
2099+ title: "Gemini 2.5 Pro",
2100+ description:
2101+ "Gemini 2.5 Pro via CometAPI - Google's advanced multimodal model with enhanced capabilities.",
2102+ params: {
2103+ model: "gemini-2.5-pro",
2104+ contextLength: 1_000_000,
2105+ title: "Gemini 2.5 Pro",
2106+ apiKey: "",
2107+ },
2108+ providerOptions: ["cometapi"],
2109+ icon: "cometapi.png",
2110+ isOpenSource: false,
2111+ },
2112+ cometapiGemini25Flash: {
2113+ title: "Gemini 2.5 Flash",
2114+ description:
2115+ "Gemini 2.5 Flash via CometAPI - optimized for speed and efficiency.",
2116+ params: {
2117+ model: "gemini-2.5-flash",
2118+ contextLength: 1_000_000,
2119+ title: "Gemini 2.5 Flash",
2120+ apiKey: "",
2121+ },
2122+ providerOptions: ["cometapi"],
2123+ icon: "cometapi.png",
2124+ isOpenSource: false,
2125+ },
2126+ cometapiGemini25FlashLite: {
2127+ title: "Gemini 2.5 Flash Lite",
2128+ description:
2129+ "Gemini 2.5 Flash Lite via CometAPI - lightweight version for faster responses.",
2130+ params: {
2131+ model: "gemini-2.5-flash-lite",
2132+ contextLength: 8_000,
2133+ title: "Gemini 2.5 Flash Lite",
2134+ apiKey: "",
2135+ },
2136+ providerOptions: ["cometapi"],
2137+ icon: "cometapi.png",
2138+ isOpenSource: false,
2139+ },
2140+ cometapiGemini20Flash: {
2141+ title: "Gemini 2.0 Flash",
2142+ description:
2143+ "Gemini 2.0 Flash via CometAPI - Google's powerful workhorse model with low latency.",
2144+ params: {
2145+ model: "gemini-2.0-flash",
2146+ contextLength: 32_000,
2147+ title: "Gemini 2.0 Flash",
2148+ apiKey: "",
2149+ },
2150+ providerOptions: ["cometapi"],
2151+ icon: "cometapi.png",
2152+ isOpenSource: false,
2153+ },
2154+
2155+ // Grok series models via CometAPI
2156+ cometapiGrok40709: {
2157+ title: "Grok 4",
2158+ description:
2159+ "Grok 4 via CometAPI - xAI's advanced model with real-time information access.",
2160+ params: {
2161+ model: "grok-4-0709",
2162+ contextLength: 256_000,
2163+ title: "Grok 4",
2164+ apiKey: "",
2165+ },
2166+ providerOptions: ["cometapi"],
2167+ icon: "cometapi.png",
2168+ isOpenSource: false,
2169+ },
2170+ cometapiGrok3: {
2171+ title: "Grok 3",
2172+ description: "Grok 3 via CometAPI - powerful reasoning model from xAI.",
2173+ params: {
2174+ model: "grok-3",
2175+ contextLength: 128_000,
2176+ title: "Grok 3",
2177+ apiKey: "",
2178+ },
2179+ providerOptions: ["cometapi"],
2180+ icon: "cometapi.png",
2181+ isOpenSource: false,
2182+ },
2183+ cometapiGrok3Mini: {
2184+ title: "Grok 3 Mini",
2185+ description: "Grok 3 Mini via CometAPI - efficient version of Grok 3.",
2186+ params: {
2187+ model: "grok-3-mini",
2188+ contextLength: 128_000,
2189+ title: "Grok 3 Mini",
2190+ apiKey: "",
2191+ },
2192+ providerOptions: ["cometapi"],
2193+ icon: "cometapi.png",
2194+ isOpenSource: false,
2195+ },
2196+
2197+ // DeepSeek series models via CometAPI (additional)
2198+ cometapiDeepseekV31: {
2199+ title: "DeepSeek V3.1",
2200+ description:
2201+ "DeepSeek V3.1 via CometAPI - enhanced version with improved performance.",
2202+ params: {
2203+ model: "deepseek-v3.1",
2204+ contextLength: 128_000,
2205+ title: "DeepSeek V3.1",
2206+ apiKey: "",
2207+ },
2208+ providerOptions: ["cometapi"],
2209+ icon: "cometapi.png",
2210+ isOpenSource: false,
2211+ },
2212+ cometapiDeepseekR10528: {
2213+ title: "DeepSeek R1",
2214+ description:
2215+ "DeepSeek R1 via CometAPI - reasoning model with enhanced problem-solving capabilities.",
2216+ params: {
2217+ model: "deepseek-r1-0528",
2218+ contextLength: 64_000,
2219+ title: "DeepSeek R1",
2220+ apiKey: "",
2221+ },
2222+ providerOptions: ["cometapi"],
2223+ icon: "cometapi.png",
2224+ isOpenSource: false,
2225+ },
2226+ cometapiDeepseekChat: {
2227+ title: "DeepSeek Chat",
2228+ description:
2229+ "DeepSeek Chat via CometAPI - optimized for conversational AI tasks.",
2230+ params: {
2231+ model: "deepseek-chat",
2232+ contextLength: 64_000,
2233+ title: "DeepSeek Chat",
2234+ apiKey: "",
2235+ },
2236+ providerOptions: ["cometapi"],
2237+ icon: "cometapi.png",
2238+ isOpenSource: false,
2239+ },
2240+ cometapiDeepseekReasoner: {
2241+ title: "DeepSeek Reasoner",
2242+ description:
2243+ "DeepSeek Reasoner via CometAPI - specialized model for complex reasoning tasks.",
2244+ params: {
2245+ model: "deepseek-reasoner",
2246+ contextLength: 64_000,
2247+ title: "DeepSeek Reasoner",
2248+ apiKey: "",
2249+ },
2250+ providerOptions: ["cometapi"],
2251+ icon: "cometapi.png",
2252+ isOpenSource: false,
2253+ },
2254+
2255+ // Qwen series models via CometAPI
2256+ cometapiQwen330BA3B: {
2257+ title: "Qwen 3 30B A3B",
2258+ description:
2259+ "Qwen 3 30B A3B via CometAPI - Alibaba's advanced language model with 30B parameters.",
2260+ params: {
2261+ model: "qwen3-30b-a3b",
2262+ contextLength: 128_000,
2263+ title: "Qwen 3 30B A3B",
2264+ apiKey: "",
2265+ },
2266+ providerOptions: ["cometapi"],
2267+ icon: "cometapi.png",
2268+ isOpenSource: false,
2269+ },
2270+ cometapiQwen3CoderPlus: {
2271+ title: "Qwen 3 Coder Plus",
2272+ description:
2273+ "Qwen 3 Coder Plus via CometAPI - specialized coding model from Alibaba.",
2274+ params: {
2275+ model: "qwen3-coder-plus-2025-07-22",
2276+ contextLength: 262_000,
2277+ title: "Qwen 3 Coder Plus",
2278+ apiKey: "",
2279+ },
2280+ providerOptions: ["cometapi"],
2281+ icon: "cometapi.png",
2282+ isOpenSource: false,
2283+ },
18392284 };
modified gui/src/pages/AddNewModel/configs/providers.ts +67 −1
@@ -49,6 +49,65 @@
4949 };
5050
5151 export const providers: Partial<Record<string, ProviderInfo>> = {
52+ cometapi: {
53+ title: "CometAPI",
54+ provider: "cometapi",
55+ description: "500+ AI Model API,All In One API. Just In CometAPI",
56+ longDescription:
57+ "Unified Access to Leading AI Models, see [here](https://www.cometapi.com/?utm_source=continue&utm_medium=integration&utm_campaign=cometapi_integration&utm_content=continue_plugin) for more details.",
58+ icon: "cometapi.png",
59+ tags: [ModelProviderTags.RequiresApiKey],
60+ collectInputFor: [
61+ {
62+ inputType: "text",
63+ key: "apiKey",
64+ label: "API Key",
65+ placeholder: "Enter your CometAPI key",
66+ required: true,
67+ },
68+ ...completionParamsInputsConfigs,
69+ ],
70+ packages: [
71+ // GPT, OpenAI family
72+ models.cometapiGpt5ChatLatest,
73+ models.cometapiGpt5Mini,
74+ models.cometapiGpt5,
75+ models.cometapiChatgpt4oLatest,
76+ models.cometapiGpt41,
77+ models.cometapiO4Mini,
78+ models.cometapiO3Pro,
79+ // Anthropic Claude family
80+ models.cometapiClaudeOpus41,
81+ models.cometapiClaudeOpus41Thinking,
82+ models.cometapiClaudeSonnet4,
83+ models.cometapiClaudeSonnet4Thinking,
84+ models.cometapiClaude37SonnetLatest,
85+ models.cometapiClaude35HaikuLatest,
86+ // Google Gemini family
87+ models.cometapiGemini25Pro,
88+ models.cometapiGemini25Flash,
89+ models.cometapiGemini25FlashLite,
90+ models.cometapiGemini20Flash,
91+ // xAI Grok family
92+ models.cometapiGrok40709,
93+ models.cometapiGrok3,
94+ models.cometapiGrok3Mini,
95+ // Deepseek family
96+ models.cometapiDeepseekV31,
97+ models.cometapiDeepseekR10528,
98+ models.cometapiDeepseekChat,
99+ models.cometapiDeepseekReasoner,
100+ // Qwen family
101+ models.cometapiQwen330BA3B,
102+ models.cometapiQwen3CoderPlus,
103+ //TODO: Need to wait for the improvement after the upgrade of the cometapi model list interface
104+ // {
105+ // ...models.AUTODETECT,
106+ // params: { ...models.AUTODETECT.params, title: "CometAPI" },
107+ // },
108+ ],
109+ apiKeyUrl: "https://api.cometapi.com/console/token",
110+ },
52111 openai: {
53112 title: "OpenAI",
54113 provider: "openai",
@@ -563,7 +622,14 @@
563622 required: true,
564623 },
565624 ],
566- packages: [models.grokBeta],
625+ packages: [
626+ models.grokCodeFast1,
627+ models.grok4FastReasoning,
628+ models.grok4FastNonReasoning,
629+ models.grok4,
630+ models.grok3,
631+ models.grok3Mini,
632+ ],
567633 apiKeyUrl: "https://console.x.ai/",
568634 },
569635 lemonade: {
modified gui/src/pages/config/hooks/useToolPolicies.ts +1 −1
@@ -45,7 +45,7 @@
4545 case "chat":
4646 return "All tools disabled in Chat, switch to Plan or Agent mode to use tools";
4747 case "plan":
48- return "Read-only/MCP tools available in Plan mode";
48+ return "Read-only tools available in Plan mode";
4949 default:
5050 return "";
5151 }
modified gui/src/pages/config/sections/ModelsSection.tsx +1 −1
@@ -91,7 +91,7 @@
9191 <span>
9292 Used in Chat, Plan, Agent mode (
9393 <a
94- href="https://docs.continue.dev/features/chat/quick-start hover:text-inherit"
94+ href="https://docs.continue.dev/features/chat/quick-start"
9595 target="_blank"
9696 rel="noopener noreferrer"
9797 className="text-inherit underline hover:brightness-125"
modified gui/src/pages/config/sections/ToolsSection.tsx +136 −41
@@ -4,16 +4,27 @@
44 ChevronDownIcon,
55 CircleStackIcon,
66 CommandLineIcon,
7+ EllipsisVerticalIcon,
78 GlobeAltIcon,
9+ PlayCircleIcon,
10+ StopCircleIcon,
811 UserCircleIcon,
912 WrenchScrewdriverIcon,
1013 } from "@heroicons/react/24/outline";
11-import { MCPServerStatus } from "core";
12-import { useContext, useMemo, useState } from "react";
14+import { MCPConnectionStatus, MCPServerStatus } from "core";
15+import { useContext, useEffect, useMemo, useState } from "react";
1316 import Alert from "../../../components/gui/Alert";
1417 import { ToolTip } from "../../../components/gui/Tooltip";
1518 import EditBlockButton from "../../../components/mainInput/Lump/EditBlockButton";
16-import { Button, Card, EmptyState } from "../../../components/ui";
19+import {
20+ Button,
21+ Card,
22+ EmptyState,
23+ Listbox,
24+ ListboxButton,
25+ ListboxOption,
26+ ListboxOptions,
27+} from "../../../components/ui";
1728 import { useAuth } from "../../../context/Auth";
1829 import { IdeMessengerContext } from "../../../context/IdeMessenger";
1930 import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
@@ -27,14 +38,32 @@
2738 serverFromYaml?: NonNullable<ConfigYaml["mcpServers"]>[number];
2839 }
2940
41+const ServerStatusTooltip: Record<MCPConnectionStatus, string> = {
42+ connected: "Active",
43+ connecting: "Connecting",
44+ "not-connected": "Inactive",
45+ authenticating: "Authenticating",
46+ error: "Error",
47+};
48+
49+const ServerStatusColor: Record<MCPConnectionStatus, string> = {
50+ connected: "bg-success",
51+ connecting: "bg-warning",
52+ "not-connected": "bg-description-muted",
53+ authenticating: "bg-warning",
54+ error: "bg-error",
55+};
56+
3057 function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
3158 const [expandedSections, setExpandedSections] = useState<{
3259 [key: string]: boolean;
3360 }>({});
61+ const [disconnectedMCPServers, setDisconnectedMCPServers] = useState<
62+ string[]
63+ >([]);
3464 const ideMessenger = useContext(IdeMessengerContext);
3565 const config = useAppSelector((store) => store.config.config);
3666 const dispatch = useAppDispatch();
37-
3867 const updateMCPServerStatus = (status: MCPServerStatus["status"]) => {
3968 // optimistic config update
4069 dispatch(
@@ -64,9 +93,35 @@
6493
6594 const onRefresh = async () => {
6695 updateMCPServerStatus("connecting");
67- ideMessenger.post("mcp/reloadServer", {
96+ await ideMessenger.request("mcp/reloadServer", {
97+ id: server.id,
98+ });
99+ await fetchDisconectedMCPServers();
100+ };
101+
102+ const onDisconnect = async () => {
103+ updateMCPServerStatus("not-connected");
104+ setDisconnectedMCPServers((prev) => [...prev, server.id]);
105+ dispatch(
106+ updateConfig({
107+ ...config,
108+ tools: config.tools.filter((tool) => tool.group !== server.id),
109+ }),
110+ );
111+ await ideMessenger.request("mcp/disconnectServer", {
68112 id: server.id,
69113 });
114+ await fetchDisconectedMCPServers();
115+ };
116+
117+ const fetchDisconectedMCPServers = async () => {
118+ const disconnectedServersData = await ideMessenger.request(
119+ "mcp/getDisconnectedServers",
120+ undefined,
121+ );
122+ if (disconnectedServersData.status === "success") {
123+ setDisconnectedMCPServers(disconnectedServersData.content);
124+ }
70125 };
71126
72127 const toggleSection = (section: string) => {
@@ -76,6 +131,8 @@
76131 }));
77132 };
78133
134+ useEffect(() => void fetchDisconectedMCPServers(), []);
135+
79136 const ResourceRow = ({
80137 title,
81138 items,
@@ -83,7 +140,11 @@
83140 sectionKey,
84141 }: {
85142 title: string;
86- items: any[];
143+ items:
144+ | MCPServerStatus["tools"]
145+ | MCPServerStatus["prompts"]
146+ | MCPServerStatus["resources"]
147+ | MCPServerStatus["resourceTemplates"];
87148 icon: React.ReactNode;
88149 sectionKey: string;
89150 }) => {
@@ -146,23 +207,17 @@
146207 <div className="flex-1">
147208 <div className="flex items-center gap-3">
148209 <h3 className="my-0 text-sm font-medium">{server.name}</h3>
149- <div
150- className={`h-2 w-2 flex-shrink-0 rounded-full ${
151- server.status === "connected"
152- ? "bg-success"
153- : server.status === "connecting"
154- ? "bg-warning"
155- : server.status === "not-connected"
156- ? "bg-description-muted"
157- : "bg-error"
158- }`}
159- />
210+ <ToolTip content={ServerStatusTooltip[server.status] ?? "Error"}>
211+ <div
212+ className={`h-2 w-2 flex-shrink-0 rounded-full ${ServerStatusColor[server.status] ?? "bg-error"}`}
213+ />
214+ </ToolTip>
160215 </div>
161216 </div>
162217 </div>
163218
164219 <div className="-mr-2.5 flex items-center gap-1">
165- {server.isProtectedResource && (
220+ {server.isProtectedResource && server.status !== "connected" && (
166221 <ToolTip
167222 content={
168223 server.status === "error"
@@ -182,7 +237,7 @@
182237 }
183238 variant="ghost"
184239 size="sm"
185- className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0"
240+ className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0 pt-0.5"
186241 disabled={server.status === "authenticating"}
187242 >
188243 {server.status === "authenticating" ? (
@@ -193,27 +248,59 @@
193248 </Button>
194249 </ToolTip>
195250 )}
196-
197- <ToolTip content="Edit server configuration">
198- <div>
199- <EditBlockButton
200- blockType={"mcpServers"}
201- block={serverFromYaml}
202- sourceFile={server.sourceFile}
203- />
204- </div>
205- </ToolTip>
206-
207- <ToolTip content="Refresh server">
208- <Button
209- onClick={onRefresh}
210- variant="ghost"
211- size="sm"
212- className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0"
213- >
214- <ArrowPathIcon className="h-4 w-4 flex-shrink-0" />
215- </Button>
216- </ToolTip>
251+ <Listbox>
252+ <ListboxButton>
253+ <EllipsisVerticalIcon className="h-4 w-4 flex-shrink-0" />
254+ </ListboxButton>
255+ <ListboxOptions className="min-w-fit" anchor="bottom end">
256+ {server.isProtectedResource && server.status === "connected" && (
257+ <ListboxOption
258+ value="remove auth"
259+ onClick={onRemoveAuth}
260+ className="justify-start gap-x-1.5"
261+ >
262+ <UserCircleIcon className="h-4 w-4 flex-shrink-0" /> Logout
263+ </ListboxOption>
264+ )}
265+
266+ <ListboxOption
267+ value="edit mcp"
268+ className="justify-start gap-x-1.5"
269+ >
270+ <EditBlockButton
271+ blockType={"mcpServers"}
272+ block={serverFromYaml}
273+ sourceFile={server.sourceFile}
274+ className="h-3.5 w-3.5 text-inherit"
275+ />
276+ Edit
277+ </ListboxOption>
278+
279+ {!disconnectedMCPServers.includes(server.name) && (
280+ <ListboxOption
281+ value="disconnect"
282+ onClick={onDisconnect}
283+ className="justify-start gap-x-1.5"
284+ >
285+ <StopCircleIcon className="h-4 w-4 flex-shrink-0" />{" "}
286+ Disconnect
287+ </ListboxOption>
288+ )}
289+
290+ <ListboxOption
291+ value="reconnect"
292+ onClick={onRefresh}
293+ className="justify-start gap-x-1.5"
294+ >
295+ {disconnectedMCPServers.includes(server.name) ? (
296+ <PlayCircleIcon className="h-4 w-4 flex-shrink-0" />
297+ ) : (
298+ <ArrowPathIcon className="h-4 w-4 flex-shrink-0" />
299+ )}
300+ Reload
301+ </ListboxOption>
302+ </ListboxOptions>
303+ </Listbox>
217304 </div>
218305 </div>
219306
@@ -294,6 +381,7 @@
294381
295382 function McpSubsection() {
296383 const currentOrg = useAppSelector(selectCurrentOrg);
384+ const mode = useAppSelector((store) => store.session.mode);
297385 const servers = useAppSelector(
298386 (store) => store.config.config.mcpServerStatuses,
299387 );
@@ -317,7 +405,7 @@
317405 .map((server) => [server.name, server]) ?? [],
318406 );
319407
320- return (servers ?? []).map((doc) => ({
408+ return (servers ?? []).map((doc: MCPServerStatus) => ({
321409 block: doc,
322410 blockFromYaml: yamlServersByName.get(doc.name),
323411 }));
@@ -348,6 +436,13 @@
348436 <Card>
349437 <EmptyState message="MCP servers are disabled in your organization" />
350438 </Card>
439+ ) : mode === "chat" ? (
440+ <Alert type="info" size="sm">
441+ <span className="text-2xs italic">
442+ All MCPs are disabled in Chat, switch to Plan or Agent mode to use
443+ MCPs
444+ </span>
445+ </Alert>
351446 ) : mergedBlocks.length > 0 ? (
352447 mergedBlocks.map(({ block, blockFromYaml }, index) => (
353448 <div key={block.id}>
modified gui/src/pages/gui/StreamError.tsx +2 −8
@@ -290,10 +290,7 @@
290290 <GhostButton
291291 className="flex flex-row items-center gap-2 rounded px-3 py-1.5"
292292 onClick={() => {
293- ideMessenger.post("controlPlane/openUrl", {
294- path: GITHUB_LINK,
295- orgSlug: undefined,
296- });
293+ ideMessenger.post("openUrl", GITHUB_LINK);
297294 }}
298295 >
299296 <GithubIcon className="h-5 w-5" />
@@ -302,10 +299,7 @@
302299 <GhostButton
303300 className="flex flex-row items-center gap-2 rounded px-3 py-1.5"
304301 onClick={() => {
305- ideMessenger.post("controlPlane/openUrl", {
306- path: DISCORD_LINK,
307- orgSlug: undefined,
308- });
302+ ideMessenger.post("openUrl", DISCORD_LINK);
309303 }}
310304 >
311305 <DiscordIcon className="h-5 w-5" />
modified gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx +16 −18
@@ -185,24 +185,22 @@
185185 const statusIcon = useMemo(() => {
186186 const status = toolCallState?.status;
187187 if (status) {
188- if (status === "canceled" || status === "errored" || status === "done") {
189- return (
190- <div
191- className={`mr-1 h-4 w-4 flex-shrink-0 ${toolCallState.output ? "cursor-pointer" : ""}`}
192- onClick={(e) => {
193- if (toolCallState.output) {
194- e.stopPropagation();
195- ideMessenger.post("showVirtualFile", {
196- name: "Edit output",
197- content: renderContextItems(toolCallState.output),
198- });
199- }
200- }}
201- >
202- {getStatusIcon(toolCallState.status)}
203- </div>
204- );
205- }
188+ return (
189+ <div
190+ className={`mr-1 h-4 w-4 flex-shrink-0 ${toolCallState.output ? "cursor-pointer" : ""}`}
191+ onClick={(e) => {
192+ if (toolCallState.output) {
193+ e.stopPropagation();
194+ ideMessenger.post("showVirtualFile", {
195+ name: "Edit output",
196+ content: renderContextItems(toolCallState.output),
197+ });
198+ }
199+ }}
200+ >
201+ {getStatusIcon(status)}
202+ </div>
203+ );
206204 }
207205 }, [toolCallState?.status, toolCallState?.output]);
208206
modified gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +5 −0
@@ -7,6 +7,7 @@
77 import { IdeMessengerContext } from "../../../context/IdeMessenger";
88 import { ToggleWithIcon } from "./ToggleWithIcon";
99 import { ToolCallStatusMessage } from "./ToolCallStatusMessage";
10+import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon";
1011 import { toolCallStateToContextItems } from "./utils";
1112
1213 interface SimpleToolCallUIProps {
@@ -61,6 +62,10 @@
6162 />
6263 <ToolCallStatusMessage tool={tool} toolCallState={toolCallState} />
6364 </div>
65+
66+ {!!toolCallState.output?.length && (
67+ <ToolTruncateHistoryIcon historyIndex={historyIndex} />
68+ )}
6469 </div>
6570
6671 {isToggleable && (
modified gui/src/pages/gui/ToolCallDiv/ToolCallDisplay.tsx +28 −2
@@ -1,5 +1,10 @@
11 import { Tool, ToolCallState } from "core";
2+import { useContext, useMemo } from "react";
3+import { openContextItem } from "../../../components/mainInput/belowMainInput/ContextItemsPeek";
4+import { IdeMessengerContext } from "../../../context/IdeMessenger";
25 import { ToolCallStatusMessage } from "./ToolCallStatusMessage";
6+import { toolCallStateToContextItems } from "./utils";
7+import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon";
38
49 interface ToolCallDisplayProps {
510 children: React.ReactNode;
@@ -16,11 +21,29 @@
1621 icon,
1722 historyIndex,
1823 }: ToolCallDisplayProps) {
24+ const ideMessenger = useContext(IdeMessengerContext);
25+ const shownContextItems = useMemo(() => {
26+ const contextItems = toolCallStateToContextItems(toolCallState);
27+ return contextItems.filter((item) => !item.hidden);
28+ }, [toolCallState]);
29+
30+ const isClickable = shownContextItems.length > 0;
31+
32+ function handleClick() {
33+ if (shownContextItems.length > 0) {
34+ openContextItem(shownContextItems[0], ideMessenger);
35+ }
36+ }
1937 return (
2038 <div className="flex flex-col justify-center px-4">
2139 <div className="mb-2 flex flex-col">
22- <div className="flex flex-row items-center justify-between gap-1.5">
23- <div className="flex min-w-0 flex-row items-center gap-2">
40+ <div className="flex flex-row items-start justify-between gap-1.5">
41+ <div
42+ className={`flex min-w-0 flex-row items-center gap-2 transition-colors duration-200 ease-in-out ${
43+ isClickable ? "cursor-pointer hover:brightness-125" : ""
44+ }`}
45+ onClick={isClickable ? handleClick : undefined}
46+ >
2447 <div className="mt-[1px] h-4 w-4 flex-shrink-0 font-semibold">
2548 {icon}
2649 </div>
@@ -29,6 +52,9 @@
2952 )}
3053 <ToolCallStatusMessage tool={tool} toolCallState={toolCallState} />
3154 </div>
55+ {!!toolCallState.output?.length && (
56+ <ToolTruncateHistoryIcon historyIndex={historyIndex} />
57+ )}
3258 </div>
3359 </div>
3460 <div>{children}</div>
modified gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx +1 −1
@@ -53,7 +53,7 @@
5353
5454 return (
5555 <div
56- className="text-description line-clamp-4 min-w-0 break-all"
56+ className="text-description line-clamp-4 min-w-0 break-words"
5757 data-testid="tool-call-title"
5858 >
5959 {`Continue ${intro} ${message}`}
modified gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +2 −1
@@ -21,7 +21,8 @@
2121 const { mainEditor } = useMainEditor();
2222
2323 if (historyIndex === lastMessageIndex) {
24- return null;
24+ // filler so doesn't jump in
25+ return <div className="h-3 w-3" />;
2526 }
2627
2728 return (
modified package-lock.json +750 −7
@@ -9,6 +9,8 @@
99 "@typescript-eslint/parser": "^7.8.0",
1010 "concurrently": "^9.1.2",
1111 "eslint-plugin-import": "^2.29.1",
12+ "husky": "^9.1.7",
13+ "lint-staged": "^15.5.2",
1214 "prettier": "^3.3.3",
1315 "prettier-plugin-tailwindcss": "^0.6.8",
1416 "typescript": "^5.6.3"
@@ -385,6 +387,22 @@
385387 "url": "https://github.com/sponsors/epoberezkin"
386388 }
387389 },
390+ "node_modules/ansi-escapes": {
391+ "version": "7.1.1",
392+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.1.1.tgz",
393+ "integrity": "sha512-Zhl0ErHcSRUaVfGUeUdDuLgpkEo8KIFjB4Y9uAc46ScOpdDiU1Dbyplh7qWJeJ/ZHpbyMSM26+X3BySgnIz40Q==",
394+ "dev": true,
395+ "license": "MIT",
396+ "dependencies": {
397+ "environment": "^1.0.0"
398+ },
399+ "engines": {
400+ "node": ">=18"
401+ },
402+ "funding": {
403+ "url": "https://github.com/sponsors/sindresorhus"
404+ }
405+ },
388406 "node_modules/ansi-regex": {
389407 "version": "5.0.1",
390408 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -698,6 +716,93 @@
698716 "node": ">=8"
699717 }
700718 },
719+ "node_modules/cli-cursor": {
720+ "version": "5.0.0",
721+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz",
722+ "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==",
723+ "dev": true,
724+ "license": "MIT",
725+ "dependencies": {
726+ "restore-cursor": "^5.0.0"
727+ },
728+ "engines": {
729+ "node": ">=18"
730+ },
731+ "funding": {
732+ "url": "https://github.com/sponsors/sindresorhus"
733+ }
734+ },
735+ "node_modules/cli-truncate": {
736+ "version": "4.0.0",
737+ "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz",
738+ "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==",
739+ "dev": true,
740+ "license": "MIT",
741+ "dependencies": {
742+ "slice-ansi": "^5.0.0",
743+ "string-width": "^7.0.0"
744+ },
745+ "engines": {
746+ "node": ">=18"
747+ },
748+ "funding": {
749+ "url": "https://github.com/sponsors/sindresorhus"
750+ }
751+ },
752+ "node_modules/cli-truncate/node_modules/ansi-regex": {
753+ "version": "6.2.2",
754+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
755+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
756+ "dev": true,
757+ "license": "MIT",
758+ "engines": {
759+ "node": ">=12"
760+ },
761+ "funding": {
762+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
763+ }
764+ },
765+ "node_modules/cli-truncate/node_modules/emoji-regex": {
766+ "version": "10.5.0",
767+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.5.0.tgz",
768+ "integrity": "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg==",
769+ "dev": true,
770+ "license": "MIT"
771+ },
772+ "node_modules/cli-truncate/node_modules/string-width": {
773+ "version": "7.2.0",
774+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
775+ "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
776+ "dev": true,
777+ "license": "MIT",
778+ "dependencies": {
779+ "emoji-regex": "^10.3.0",
780+ "get-east-asian-width": "^1.0.0",
781+ "strip-ansi": "^7.1.0"
782+ },
783+ "engines": {
784+ "node": ">=18"
785+ },
786+ "funding": {
787+ "url": "https://github.com/sponsors/sindresorhus"
788+ }
789+ },
790+ "node_modules/cli-truncate/node_modules/strip-ansi": {
791+ "version": "7.1.2",
792+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
793+ "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
794+ "dev": true,
795+ "license": "MIT",
796+ "dependencies": {
797+ "ansi-regex": "^6.0.1"
798+ },
799+ "engines": {
800+ "node": ">=12"
801+ },
802+ "funding": {
803+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
804+ }
805+ },
701806 "node_modules/cliui": {
702807 "version": "8.0.1",
703808 "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
@@ -733,6 +838,23 @@
733838 "dev": true,
734839 "license": "MIT"
735840 },
841+ "node_modules/colorette": {
842+ "version": "2.0.20",
843+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
844+ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
845+ "dev": true,
846+ "license": "MIT"
847+ },
848+ "node_modules/commander": {
849+ "version": "13.1.0",
850+ "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz",
851+ "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==",
852+ "dev": true,
853+ "license": "MIT",
854+ "engines": {
855+ "node": ">=18"
856+ }
857+ },
736858 "node_modules/concat-map": {
737859 "version": "0.0.1",
738860 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -772,7 +894,6 @@
772894 "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
773895 "dev": true,
774896 "license": "MIT",
775- "peer": true,
776897 "dependencies": {
777898 "path-key": "^3.1.0",
778899 "shebang-command": "^2.0.0",
@@ -947,6 +1068,19 @@
9471068 "dev": true,
9481069 "license": "MIT"
9491070 },
1071+ "node_modules/environment": {
1072+ "version": "1.1.0",
1073+ "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",
1074+ "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==",
1075+ "dev": true,
1076+ "license": "MIT",
1077+ "engines": {
1078+ "node": ">=18"
1079+ },
1080+ "funding": {
1081+ "url": "https://github.com/sponsors/sindresorhus"
1082+ }
1083+ },
9501084 "node_modules/es-abstract": {
9511085 "version": "1.24.0",
9521086 "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz",
@@ -1444,6 +1578,37 @@
14441578 "node": ">=0.10.0"
14451579 }
14461580 },
1581+ "node_modules/eventemitter3": {
1582+ "version": "5.0.1",
1583+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
1584+ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
1585+ "dev": true,
1586+ "license": "MIT"
1587+ },
1588+ "node_modules/execa": {
1589+ "version": "8.0.1",
1590+ "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz",
1591+ "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==",
1592+ "dev": true,
1593+ "license": "MIT",
1594+ "dependencies": {
1595+ "cross-spawn": "^7.0.3",
1596+ "get-stream": "^8.0.1",
1597+ "human-signals": "^5.0.0",
1598+ "is-stream": "^3.0.0",
1599+ "merge-stream": "^2.0.0",
1600+ "npm-run-path": "^5.1.0",
1601+ "onetime": "^6.0.0",
1602+ "signal-exit": "^4.1.0",
1603+ "strip-final-newline": "^3.0.0"
1604+ },
1605+ "engines": {
1606+ "node": ">=16.17"
1607+ },
1608+ "funding": {
1609+ "url": "https://github.com/sindresorhus/execa?sponsor=1"
1610+ }
1611+ },
14471612 "node_modules/fast-deep-equal": {
14481613 "version": "3.1.3",
14491614 "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -1652,6 +1817,19 @@
16521817 "node": "6.* || 8.* || >= 10.*"
16531818 }
16541819 },
1820+ "node_modules/get-east-asian-width": {
1821+ "version": "1.4.0",
1822+ "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz",
1823+ "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==",
1824+ "dev": true,
1825+ "license": "MIT",
1826+ "engines": {
1827+ "node": ">=18"
1828+ },
1829+ "funding": {
1830+ "url": "https://github.com/sponsors/sindresorhus"
1831+ }
1832+ },
16551833 "node_modules/get-intrinsic": {
16561834 "version": "1.3.0",
16571835 "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
@@ -1691,6 +1869,19 @@
16911869 "node": ">= 0.4"
16921870 }
16931871 },
1872+ "node_modules/get-stream": {
1873+ "version": "8.0.1",
1874+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",
1875+ "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==",
1876+ "dev": true,
1877+ "license": "MIT",
1878+ "engines": {
1879+ "node": ">=16"
1880+ },
1881+ "funding": {
1882+ "url": "https://github.com/sponsors/sindresorhus"
1883+ }
1884+ },
16941885 "node_modules/get-symbol-description": {
16951886 "version": "1.1.0",
16961887 "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz",
@@ -1942,6 +2133,32 @@
19422133 "node": ">= 0.4"
19432134 }
19442135 },
2136+ "node_modules/human-signals": {
2137+ "version": "5.0.0",
2138+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz",
2139+ "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==",
2140+ "dev": true,
2141+ "license": "Apache-2.0",
2142+ "engines": {
2143+ "node": ">=16.17.0"
2144+ }
2145+ },
2146+ "node_modules/husky": {
2147+ "version": "9.1.7",
2148+ "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
2149+ "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
2150+ "dev": true,
2151+ "license": "MIT",
2152+ "bin": {
2153+ "husky": "bin.js"
2154+ },
2155+ "engines": {
2156+ "node": ">=18"
2157+ },
2158+ "funding": {
2159+ "url": "https://github.com/sponsors/typicode"
2160+ }
2161+ },
19452162 "node_modules/ignore": {
19462163 "version": "5.3.2",
19472164 "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
@@ -2332,6 +2549,19 @@
23322549 "url": "https://github.com/sponsors/ljharb"
23332550 }
23342551 },
2552+ "node_modules/is-stream": {
2553+ "version": "3.0.0",
2554+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
2555+ "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
2556+ "dev": true,
2557+ "license": "MIT",
2558+ "engines": {
2559+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
2560+ },
2561+ "funding": {
2562+ "url": "https://github.com/sponsors/sindresorhus"
2563+ }
2564+ },
23352565 "node_modules/is-string": {
23362566 "version": "1.1.1",
23372567 "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz",
@@ -2441,8 +2671,7 @@
24412671 "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
24422672 "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
24432673 "dev": true,
2444- "license": "ISC",
2445- "peer": true
2674+ "license": "ISC"
24462675 },
24472676 "node_modules/js-yaml": {
24482677 "version": "4.1.0",
@@ -2521,6 +2750,163 @@
25212750 "node": ">= 0.8.0"
25222751 }
25232752 },
2753+ "node_modules/lilconfig": {
2754+ "version": "3.1.3",
2755+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
2756+ "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
2757+ "dev": true,
2758+ "license": "MIT",
2759+ "engines": {
2760+ "node": ">=14"
2761+ },
2762+ "funding": {
2763+ "url": "https://github.com/sponsors/antonk52"
2764+ }
2765+ },
2766+ "node_modules/lint-staged": {
2767+ "version": "15.5.2",
2768+ "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.5.2.tgz",
2769+ "integrity": "sha512-YUSOLq9VeRNAo/CTaVmhGDKG+LBtA8KF1X4K5+ykMSwWST1vDxJRB2kv2COgLb1fvpCo+A/y9A0G0znNVmdx4w==",
2770+ "dev": true,
2771+ "license": "MIT",
2772+ "dependencies": {
2773+ "chalk": "^5.4.1",
2774+ "commander": "^13.1.0",
2775+ "debug": "^4.4.0",
2776+ "execa": "^8.0.1",
2777+ "lilconfig": "^3.1.3",
2778+ "listr2": "^8.2.5",
2779+ "micromatch": "^4.0.8",
2780+ "pidtree": "^0.6.0",
2781+ "string-argv": "^0.3.2",
2782+ "yaml": "^2.7.0"
2783+ },
2784+ "bin": {
2785+ "lint-staged": "bin/lint-staged.js"
2786+ },
2787+ "engines": {
2788+ "node": ">=18.12.0"
2789+ },
2790+ "funding": {
2791+ "url": "https://opencollective.com/lint-staged"
2792+ }
2793+ },
2794+ "node_modules/lint-staged/node_modules/chalk": {
2795+ "version": "5.6.2",
2796+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
2797+ "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
2798+ "dev": true,
2799+ "license": "MIT",
2800+ "engines": {
2801+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
2802+ },
2803+ "funding": {
2804+ "url": "https://github.com/chalk/chalk?sponsor=1"
2805+ }
2806+ },
2807+ "node_modules/listr2": {
2808+ "version": "8.3.3",
2809+ "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.3.3.tgz",
2810+ "integrity": "sha512-LWzX2KsqcB1wqQ4AHgYb4RsDXauQiqhjLk+6hjbaeHG4zpjjVAB6wC/gz6X0l+Du1cN3pUB5ZlrvTbhGSNnUQQ==",
2811+ "dev": true,
2812+ "license": "MIT",
2813+ "dependencies": {
2814+ "cli-truncate": "^4.0.0",
2815+ "colorette": "^2.0.20",
2816+ "eventemitter3": "^5.0.1",
2817+ "log-update": "^6.1.0",
2818+ "rfdc": "^1.4.1",
2819+ "wrap-ansi": "^9.0.0"
2820+ },
2821+ "engines": {
2822+ "node": ">=18.0.0"
2823+ }
2824+ },
2825+ "node_modules/listr2/node_modules/ansi-regex": {
2826+ "version": "6.2.2",
2827+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
2828+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
2829+ "dev": true,
2830+ "license": "MIT",
2831+ "engines": {
2832+ "node": ">=12"
2833+ },
2834+ "funding": {
2835+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
2836+ }
2837+ },
2838+ "node_modules/listr2/node_modules/ansi-styles": {
2839+ "version": "6.2.3",
2840+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
2841+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
2842+ "dev": true,
2843+ "license": "MIT",
2844+ "engines": {
2845+ "node": ">=12"
2846+ },
2847+ "funding": {
2848+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
2849+ }
2850+ },
2851+ "node_modules/listr2/node_modules/emoji-regex": {
2852+ "version": "10.5.0",
2853+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.5.0.tgz",
2854+ "integrity": "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg==",
2855+ "dev": true,
2856+ "license": "MIT"
2857+ },
2858+ "node_modules/listr2/node_modules/string-width": {
2859+ "version": "7.2.0",
2860+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
2861+ "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
2862+ "dev": true,
2863+ "license": "MIT",
2864+ "dependencies": {
2865+ "emoji-regex": "^10.3.0",
2866+ "get-east-asian-width": "^1.0.0",
2867+ "strip-ansi": "^7.1.0"
2868+ },
2869+ "engines": {
2870+ "node": ">=18"
2871+ },
2872+ "funding": {
2873+ "url": "https://github.com/sponsors/sindresorhus"
2874+ }
2875+ },
2876+ "node_modules/listr2/node_modules/strip-ansi": {
2877+ "version": "7.1.2",
2878+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
2879+ "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
2880+ "dev": true,
2881+ "license": "MIT",
2882+ "dependencies": {
2883+ "ansi-regex": "^6.0.1"
2884+ },
2885+ "engines": {
2886+ "node": ">=12"
2887+ },
2888+ "funding": {
2889+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
2890+ }
2891+ },
2892+ "node_modules/listr2/node_modules/wrap-ansi": {
2893+ "version": "9.0.2",
2894+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
2895+ "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
2896+ "dev": true,
2897+ "license": "MIT",
2898+ "dependencies": {
2899+ "ansi-styles": "^6.2.1",
2900+ "string-width": "^7.0.0",
2901+ "strip-ansi": "^7.1.0"
2902+ },
2903+ "engines": {
2904+ "node": ">=18"
2905+ },
2906+ "funding": {
2907+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
2908+ }
2909+ },
25242910 "node_modules/locate-path": {
25252911 "version": "6.0.0",
25262912 "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
@@ -2553,6 +2939,144 @@
25532939 "license": "MIT",
25542940 "peer": true
25552941 },
2942+ "node_modules/log-update": {
2943+ "version": "6.1.0",
2944+ "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz",
2945+ "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==",
2946+ "dev": true,
2947+ "license": "MIT",
2948+ "dependencies": {
2949+ "ansi-escapes": "^7.0.0",
2950+ "cli-cursor": "^5.0.0",
2951+ "slice-ansi": "^7.1.0",
2952+ "strip-ansi": "^7.1.0",
2953+ "wrap-ansi": "^9.0.0"
2954+ },
2955+ "engines": {
2956+ "node": ">=18"
2957+ },
2958+ "funding": {
2959+ "url": "https://github.com/sponsors/sindresorhus"
2960+ }
2961+ },
2962+ "node_modules/log-update/node_modules/ansi-regex": {
2963+ "version": "6.2.2",
2964+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
2965+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
2966+ "dev": true,
2967+ "license": "MIT",
2968+ "engines": {
2969+ "node": ">=12"
2970+ },
2971+ "funding": {
2972+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
2973+ }
2974+ },
2975+ "node_modules/log-update/node_modules/ansi-styles": {
2976+ "version": "6.2.3",
2977+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
2978+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
2979+ "dev": true,
2980+ "license": "MIT",
2981+ "engines": {
2982+ "node": ">=12"
2983+ },
2984+ "funding": {
2985+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
2986+ }
2987+ },
2988+ "node_modules/log-update/node_modules/emoji-regex": {
2989+ "version": "10.5.0",
2990+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.5.0.tgz",
2991+ "integrity": "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg==",
2992+ "dev": true,
2993+ "license": "MIT"
2994+ },
2995+ "node_modules/log-update/node_modules/is-fullwidth-code-point": {
2996+ "version": "5.1.0",
2997+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz",
2998+ "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==",
2999+ "dev": true,
3000+ "license": "MIT",
3001+ "dependencies": {
3002+ "get-east-asian-width": "^1.3.1"
3003+ },
3004+ "engines": {
3005+ "node": ">=18"
3006+ },
3007+ "funding": {
3008+ "url": "https://github.com/sponsors/sindresorhus"
3009+ }
3010+ },
3011+ "node_modules/log-update/node_modules/slice-ansi": {
3012+ "version": "7.1.2",
3013+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz",
3014+ "integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==",
3015+ "dev": true,
3016+ "license": "MIT",
3017+ "dependencies": {
3018+ "ansi-styles": "^6.2.1",
3019+ "is-fullwidth-code-point": "^5.0.0"
3020+ },
3021+ "engines": {
3022+ "node": ">=18"
3023+ },
3024+ "funding": {
3025+ "url": "https://github.com/chalk/slice-ansi?sponsor=1"
3026+ }
3027+ },
3028+ "node_modules/log-update/node_modules/string-width": {
3029+ "version": "7.2.0",
3030+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
3031+ "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
3032+ "dev": true,
3033+ "license": "MIT",
3034+ "dependencies": {
3035+ "emoji-regex": "^10.3.0",
3036+ "get-east-asian-width": "^1.0.0",
3037+ "strip-ansi": "^7.1.0"
3038+ },
3039+ "engines": {
3040+ "node": ">=18"
3041+ },
3042+ "funding": {
3043+ "url": "https://github.com/sponsors/sindresorhus"
3044+ }
3045+ },
3046+ "node_modules/log-update/node_modules/strip-ansi": {
3047+ "version": "7.1.2",
3048+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
3049+ "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
3050+ "dev": true,
3051+ "license": "MIT",
3052+ "dependencies": {
3053+ "ansi-regex": "^6.0.1"
3054+ },
3055+ "engines": {
3056+ "node": ">=12"
3057+ },
3058+ "funding": {
3059+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
3060+ }
3061+ },
3062+ "node_modules/log-update/node_modules/wrap-ansi": {
3063+ "version": "9.0.2",
3064+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
3065+ "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
3066+ "dev": true,
3067+ "license": "MIT",
3068+ "dependencies": {
3069+ "ansi-styles": "^6.2.1",
3070+ "string-width": "^7.0.0",
3071+ "strip-ansi": "^7.1.0"
3072+ },
3073+ "engines": {
3074+ "node": ">=18"
3075+ },
3076+ "funding": {
3077+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
3078+ }
3079+ },
25563080 "node_modules/math-intrinsics": {
25573081 "version": "1.1.0",
25583082 "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@@ -2563,6 +3087,13 @@
25633087 "node": ">= 0.4"
25643088 }
25653089 },
3090+ "node_modules/merge-stream": {
3091+ "version": "2.0.0",
3092+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
3093+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
3094+ "dev": true,
3095+ "license": "MIT"
3096+ },
25663097 "node_modules/merge2": {
25673098 "version": "1.4.1",
25683099 "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -2587,6 +3118,32 @@
25873118 "node": ">=8.6"
25883119 }
25893120 },
3121+ "node_modules/mimic-fn": {
3122+ "version": "4.0.0",
3123+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
3124+ "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
3125+ "dev": true,
3126+ "license": "MIT",
3127+ "engines": {
3128+ "node": ">=12"
3129+ },
3130+ "funding": {
3131+ "url": "https://github.com/sponsors/sindresorhus"
3132+ }
3133+ },
3134+ "node_modules/mimic-function": {
3135+ "version": "5.0.1",
3136+ "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz",
3137+ "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==",
3138+ "dev": true,
3139+ "license": "MIT",
3140+ "engines": {
3141+ "node": ">=18"
3142+ },
3143+ "funding": {
3144+ "url": "https://github.com/sponsors/sindresorhus"
3145+ }
3146+ },
25903147 "node_modules/minimatch": {
25913148 "version": "9.0.5",
25923149 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
@@ -2628,6 +3185,35 @@
26283185 "license": "MIT",
26293186 "peer": true
26303187 },
3188+ "node_modules/npm-run-path": {
3189+ "version": "5.3.0",
3190+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz",
3191+ "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==",
3192+ "dev": true,
3193+ "license": "MIT",
3194+ "dependencies": {
3195+ "path-key": "^4.0.0"
3196+ },
3197+ "engines": {
3198+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
3199+ },
3200+ "funding": {
3201+ "url": "https://github.com/sponsors/sindresorhus"
3202+ }
3203+ },
3204+ "node_modules/npm-run-path/node_modules/path-key": {
3205+ "version": "4.0.0",
3206+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
3207+ "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
3208+ "dev": true,
3209+ "license": "MIT",
3210+ "engines": {
3211+ "node": ">=12"
3212+ },
3213+ "funding": {
3214+ "url": "https://github.com/sponsors/sindresorhus"
3215+ }
3216+ },
26313217 "node_modules/object-inspect": {
26323218 "version": "1.13.4",
26333219 "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
@@ -2736,6 +3322,22 @@
27363322 "wrappy": "1"
27373323 }
27383324 },
3325+ "node_modules/onetime": {
3326+ "version": "6.0.0",
3327+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
3328+ "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
3329+ "dev": true,
3330+ "license": "MIT",
3331+ "dependencies": {
3332+ "mimic-fn": "^4.0.0"
3333+ },
3334+ "engines": {
3335+ "node": ">=12"
3336+ },
3337+ "funding": {
3338+ "url": "https://github.com/sponsors/sindresorhus"
3339+ }
3340+ },
27393341 "node_modules/optionator": {
27403342 "version": "0.9.4",
27413343 "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@@ -2849,7 +3451,6 @@
28493451 "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
28503452 "dev": true,
28513453 "license": "MIT",
2852- "peer": true,
28533454 "engines": {
28543455 "node": ">=8"
28553456 }
@@ -2884,6 +3485,19 @@
28843485 "url": "https://github.com/sponsors/jonschlinkert"
28853486 }
28863487 },
3488+ "node_modules/pidtree": {
3489+ "version": "0.6.0",
3490+ "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz",
3491+ "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==",
3492+ "dev": true,
3493+ "license": "MIT",
3494+ "bin": {
3495+ "pidtree": "bin/pidtree.js"
3496+ },
3497+ "engines": {
3498+ "node": ">=0.10"
3499+ }
3500+ },
28873501 "node_modules/possible-typed-array-names": {
28883502 "version": "1.1.0",
28893503 "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
@@ -3118,6 +3732,39 @@
31183732 "node": ">=4"
31193733 }
31203734 },
3735+ "node_modules/restore-cursor": {
3736+ "version": "5.1.0",
3737+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz",
3738+ "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==",
3739+ "dev": true,
3740+ "license": "MIT",
3741+ "dependencies": {
3742+ "onetime": "^7.0.0",
3743+ "signal-exit": "^4.1.0"
3744+ },
3745+ "engines": {
3746+ "node": ">=18"
3747+ },
3748+ "funding": {
3749+ "url": "https://github.com/sponsors/sindresorhus"
3750+ }
3751+ },
3752+ "node_modules/restore-cursor/node_modules/onetime": {
3753+ "version": "7.0.0",
3754+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz",
3755+ "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==",
3756+ "dev": true,
3757+ "license": "MIT",
3758+ "dependencies": {
3759+ "mimic-function": "^5.0.0"
3760+ },
3761+ "engines": {
3762+ "node": ">=18"
3763+ },
3764+ "funding": {
3765+ "url": "https://github.com/sponsors/sindresorhus"
3766+ }
3767+ },
31213768 "node_modules/reusify": {
31223769 "version": "1.1.0",
31233770 "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
@@ -3129,6 +3776,13 @@
31293776 "node": ">=0.10.0"
31303777 }
31313778 },
3779+ "node_modules/rfdc": {
3780+ "version": "1.4.1",
3781+ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
3782+ "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
3783+ "dev": true,
3784+ "license": "MIT"
3785+ },
31323786 "node_modules/rimraf": {
31333787 "version": "3.0.2",
31343788 "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
@@ -3304,7 +3958,6 @@
33043958 "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
33053959 "dev": true,
33063960 "license": "MIT",
3307- "peer": true,
33083961 "dependencies": {
33093962 "shebang-regex": "^3.0.0"
33103963 },
@@ -3318,7 +3971,6 @@
33183971 "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
33193972 "dev": true,
33203973 "license": "MIT",
3321- "peer": true,
33223974 "engines": {
33233975 "node": ">=8"
33243976 }
@@ -3412,6 +4064,19 @@
34124064 "url": "https://github.com/sponsors/ljharb"
34134065 }
34144066 },
4067+ "node_modules/signal-exit": {
4068+ "version": "4.1.0",
4069+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
4070+ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
4071+ "dev": true,
4072+ "license": "ISC",
4073+ "engines": {
4074+ "node": ">=14"
4075+ },
4076+ "funding": {
4077+ "url": "https://github.com/sponsors/isaacs"
4078+ }
4079+ },
34154080 "node_modules/slash": {
34164081 "version": "3.0.0",
34174082 "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -3422,6 +4087,49 @@
34224087 "node": ">=8"
34234088 }
34244089 },
4090+ "node_modules/slice-ansi": {
4091+ "version": "5.0.0",
4092+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz",
4093+ "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==",
4094+ "dev": true,
4095+ "license": "MIT",
4096+ "dependencies": {
4097+ "ansi-styles": "^6.0.0",
4098+ "is-fullwidth-code-point": "^4.0.0"
4099+ },
4100+ "engines": {
4101+ "node": ">=12"
4102+ },
4103+ "funding": {
4104+ "url": "https://github.com/chalk/slice-ansi?sponsor=1"
4105+ }
4106+ },
4107+ "node_modules/slice-ansi/node_modules/ansi-styles": {
4108+ "version": "6.2.3",
4109+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
4110+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
4111+ "dev": true,
4112+ "license": "MIT",
4113+ "engines": {
4114+ "node": ">=12"
4115+ },
4116+ "funding": {
4117+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
4118+ }
4119+ },
4120+ "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": {
4121+ "version": "4.0.0",
4122+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz",
4123+ "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==",
4124+ "dev": true,
4125+ "license": "MIT",
4126+ "engines": {
4127+ "node": ">=12"
4128+ },
4129+ "funding": {
4130+ "url": "https://github.com/sponsors/sindresorhus"
4131+ }
4132+ },
34254133 "node_modules/stop-iteration-iterator": {
34264134 "version": "1.1.0",
34274135 "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz",
@@ -3436,6 +4144,16 @@
34364144 "node": ">= 0.4"
34374145 }
34384146 },
4147+ "node_modules/string-argv": {
4148+ "version": "0.3.2",
4149+ "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz",
4150+ "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==",
4151+ "dev": true,
4152+ "license": "MIT",
4153+ "engines": {
4154+ "node": ">=0.6.19"
4155+ }
4156+ },
34394157 "node_modules/string-width": {
34404158 "version": "4.2.3",
34414159 "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@@ -3533,6 +4251,19 @@
35334251 "node": ">=4"
35344252 }
35354253 },
4254+ "node_modules/strip-final-newline": {
4255+ "version": "3.0.0",
4256+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
4257+ "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
4258+ "dev": true,
4259+ "license": "MIT",
4260+ "engines": {
4261+ "node": ">=12"
4262+ },
4263+ "funding": {
4264+ "url": "https://github.com/sponsors/sindresorhus"
4265+ }
4266+ },
35364267 "node_modules/strip-json-comments": {
35374268 "version": "3.1.1",
35384269 "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@@ -3796,7 +4527,6 @@
37964527 "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
37974528 "dev": true,
37984529 "license": "ISC",
3799- "peer": true,
38004530 "dependencies": {
38014531 "isexe": "^2.0.0"
38024532 },
@@ -3943,6 +4673,19 @@
39434673 "node": ">=10"
39444674 }
39454675 },
4676+ "node_modules/yaml": {
4677+ "version": "2.8.1",
4678+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz",
4679+ "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
4680+ "dev": true,
4681+ "license": "ISC",
4682+ "bin": {
4683+ "yaml": "bin.mjs"
4684+ },
4685+ "engines": {
4686+ "node": ">= 14.6"
4687+ }
4688+ },
39464689 "node_modules/yargs": {
39474690 "version": "17.7.2",
39484691 "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
modified package.json +7 −1
@@ -7,12 +7,18 @@
77 "tsc:watch:core": "tsc --project core/tsconfig.json --watch --noEmit --pretty",
88 "tsc:watch:binary": "tsc --project binary/tsconfig.json --watch --noEmit --pretty",
99 "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore --ignore-path .prettierignore",
10- "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore --ignore-path .prettierignore"
10+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore --ignore-path .prettierignore",
11+ "prepare": "husky"
12+ },
13+ "lint-staged": {
14+ "*.{js,jsx,ts,tsx,json,css,md}": "prettier --write"
1115 },
1216 "devDependencies": {
1317 "@typescript-eslint/parser": "^7.8.0",
1418 "concurrently": "^9.1.2",
1519 "eslint-plugin-import": "^2.29.1",
20+ "husky": "^9.1.7",
21+ "lint-staged": "^15.5.2",
1622 "prettier": "^3.3.3",
1723 "prettier-plugin-tailwindcss": "^0.6.8",
1824 "typescript": "^5.6.3"
modified packages/llm-info/package.json +1 −1
@@ -1,6 +1,6 @@
11 {
22 "name": "@continuedev/llm-info",
3- "version": "1.0.9",
3+ "version": "1.0.10",
44 "description": "",
55 "main": "dist/index.js",
66 "types": "dist/index.d.ts",
modified packages/llm-info/src/index.ts +23 −5
@@ -2,6 +2,7 @@
22 import { Azure } from "./providers/azure.js";
33 import { Bedrock } from "./providers/bedrock.js";
44 import { Cohere } from "./providers/cohere.js";
5+import { CometAPI } from "./providers/cometapi.js";
56 import { Gemini } from "./providers/gemini.js";
67 import { Mistral } from "./providers/mistral.js";
78 import { Ollama } from "./providers/ollama.js";
@@ -9,7 +10,7 @@
910 import { Vllm } from "./providers/vllm.js";
1011 import { Voyage } from "./providers/voyage.js";
1112 import { xAI } from "./providers/xAI.js";
12-import { LlmInfo, ModelProvider, UseCase } from "./types.js";
13+import { LlmInfoWithProvider, ModelProvider, UseCase } from "./types.js";
1314
1415 export const allModelProviders: ModelProvider[] = [
1516 OpenAi,
@@ -22,19 +23,36 @@
2223 Vllm,
2324 Bedrock,
2425 Cohere,
26+ CometAPI,
2527 xAI,
2628 ];
2729
28-export const allLlms: LlmInfo[] = allModelProviders.flatMap((provider) =>
29- provider.models.map((model) => ({ ...model, provider: provider.id })),
30+export const allLlms: LlmInfoWithProvider[] = allModelProviders.flatMap(
31+ (provider) =>
32+ provider.models.map((model) => ({ ...model, provider: provider.id })),
3033 );
3134
32-export function findLlmInfo(model: string): LlmInfo | undefined {
35+export function findLlmInfo(
36+ model: string,
37+ preferProviderId?: string,
38+): LlmInfoWithProvider | undefined {
39+ if (preferProviderId) {
40+ const provider = allModelProviders.find((p) => p.id === preferProviderId);
41+ const info = provider?.models.find((llm) =>
42+ llm.regex ? llm.regex.test(model) : llm.model === model,
43+ );
44+ if (info) {
45+ return {
46+ ...info,
47+ provider: preferProviderId,
48+ };
49+ }
50+ }
3351 return allLlms.find((llm) =>
3452 llm.regex ? llm.regex.test(model) : llm.model === model,
3553 );
3654 }
3755
38-export function getAllRecommendedFor(useCase: UseCase): LlmInfo[] {
56+export function getAllRecommendedFor(useCase: UseCase): LlmInfoWithProvider[] {
3957 return allLlms.filter((llm) => llm.recommendedFor?.includes(useCase));
4058 }
added packages/llm-info/src/providers/cometapi.ts +280 −0
@@ -0,0 +1,280 @@
1+import { ModelProvider } from "../types.js";
2+
3+export const CometAPI: ModelProvider = {
4+ id: "cometapi",
5+ displayName: "CometAPI",
6+ models: [
7+ // GPT Series
8+ {
9+ model: "gpt-5-chat-latest",
10+ displayName: "GPT-5 Chat Latest",
11+ contextLength: 200000,
12+ maxCompletionTokens: 8192,
13+ description:
14+ "Latest GPT-5 model optimized for chat conversations with enhanced reasoning capabilities.",
15+ recommendedFor: ["chat"],
16+ },
17+ {
18+ model: "chatgpt-4o-latest",
19+ displayName: "ChatGPT-4o Latest",
20+ contextLength: 128000,
21+ maxCompletionTokens: 4096,
22+ description:
23+ "Latest ChatGPT-4o model with improved performance and updated training data.",
24+ recommendedFor: ["chat"],
25+ },
26+ {
27+ model: "gpt-5-mini",
28+ displayName: "GPT-5 Mini",
29+ contextLength: 128000,
30+ maxCompletionTokens: 4096,
31+ description:
32+ "Efficient version of GPT-5 with faster response times while maintaining high quality.",
33+ recommendedFor: ["chat"],
34+ },
35+ {
36+ model: "gpt-5-nano",
37+ displayName: "GPT-5 Nano",
38+ contextLength: 64000,
39+ maxCompletionTokens: 2048,
40+ description:
41+ "Ultra-fast GPT-5 variant optimized for quick responses and simple tasks.",
42+ recommendedFor: ["chat"],
43+ },
44+ {
45+ model: "gpt-5",
46+ displayName: "GPT-5",
47+ contextLength: 200000,
48+ maxCompletionTokens: 8192,
49+ description:
50+ "Advanced GPT-5 model with state-of-the-art language understanding and generation.",
51+ recommendedFor: ["chat"],
52+ },
53+ {
54+ model: "gpt-4o-mini",
55+ displayName: "GPT-4o Mini",
56+ contextLength: 128000,
57+ maxCompletionTokens: 4096,
58+ description:
59+ "Compact version of GPT-4o with excellent performance for most use cases.",
60+ recommendedFor: ["chat"],
61+ },
62+ {
63+ model: "o4-mini-2025-04-16",
64+ displayName: "o4 Mini (2025-04-16)",
65+ contextLength: 128000,
66+ maxCompletionTokens: 4096,
67+ description:
68+ "Optimized o4 mini model with April 2025 training improvements.",
69+ recommendedFor: ["chat"],
70+ },
71+ {
72+ model: "o3-pro-2025-06-10",
73+ displayName: "o3 Pro (2025-06-10)",
74+ contextLength: 200000,
75+ maxCompletionTokens: 8192,
76+ description:
77+ "Professional-grade o3 model with enhanced reasoning and problem-solving capabilities.",
78+ recommendedFor: ["chat"],
79+ },
80+
81+ // Claude Series
82+ {
83+ model: "claude-opus-4-1-20250805",
84+ displayName: "Claude Opus 4.1 (2025-08-05)",
85+ contextLength: 200000,
86+ maxCompletionTokens: 8192,
87+ description:
88+ "Most capable Claude model with exceptional reasoning, analysis, and creative capabilities.",
89+ recommendedFor: ["chat"],
90+ },
91+ {
92+ model: "claude-opus-4-1-20250805-thinking",
93+ displayName: "Claude Opus 4.1 Thinking (2025-08-05)",
94+ contextLength: 200000,
95+ maxCompletionTokens: 8192,
96+ description:
97+ "Claude Opus with enhanced thinking process for complex problem-solving tasks.",
98+ recommendedFor: ["chat"],
99+ },
100+ {
101+ model: "claude-sonnet-4-20250514",
102+ displayName: "Claude Sonnet 4 (2025-05-14)",
103+ contextLength: 200000,
104+ maxCompletionTokens: 8192,
105+ description:
106+ "Balanced Claude model offering excellent performance across various tasks.",
107+ recommendedFor: ["chat"],
108+ },
109+ {
110+ model: "claude-sonnet-4-20250514-thinking",
111+ displayName: "Claude Sonnet 4 Thinking (2025-05-14)",
112+ contextLength: 200000,
113+ maxCompletionTokens: 8192,
114+ description:
115+ "Claude Sonnet with enhanced reasoning capabilities for analytical tasks.",
116+ recommendedFor: ["chat"],
117+ },
118+ {
119+ model: "claude-3-7-sonnet-latest",
120+ displayName: "Claude 3.7 Sonnet Latest",
121+ contextLength: 200000,
122+ maxCompletionTokens: 4096,
123+ description:
124+ "Latest Claude 3.7 Sonnet with improved instruction following and safety.",
125+ recommendedFor: ["chat"],
126+ },
127+ {
128+ model: "claude-3-5-haiku-latest",
129+ displayName: "Claude 3.5 Haiku Latest",
130+ contextLength: 200000,
131+ maxCompletionTokens: 4096,
132+ description:
133+ "Fast and efficient Claude model optimized for quick responses.",
134+ recommendedFor: ["chat"],
135+ },
136+
137+ // Gemini Series
138+ {
139+ model: "gemini-2.5-pro",
140+ displayName: "Gemini 2.5 Pro",
141+ contextLength: 2000000,
142+ maxCompletionTokens: 8192,
143+ description:
144+ "Advanced Gemini model with extensive context window and multimodal capabilities.",
145+ recommendedFor: ["chat"],
146+ },
147+ {
148+ model: "gemini-2.5-flash",
149+ displayName: "Gemini 2.5 Flash",
150+ contextLength: 1000000,
151+ maxCompletionTokens: 8192,
152+ description:
153+ "Fast Gemini model with large context window optimized for speed.",
154+ recommendedFor: ["chat"],
155+ },
156+ {
157+ model: "gemini-2.5-flash-lite",
158+ displayName: "Gemini 2.5 Flash Lite",
159+ contextLength: 1000000,
160+ maxCompletionTokens: 4096,
161+ description:
162+ "Lightweight version of Gemini Flash for efficient processing.",
163+ recommendedFor: ["chat"],
164+ },
165+ {
166+ model: "gemini-2.0-flash",
167+ displayName: "Gemini 2.0 Flash",
168+ contextLength: 1000000,
169+ maxCompletionTokens: 8192,
170+ description:
171+ "High-performance Gemini model with excellent speed-quality balance.",
172+ recommendedFor: ["chat"],
173+ },
174+
175+ // Grok Series
176+ {
177+ model: "grok-4-0709",
178+ displayName: "Grok 4 (07-09)",
179+ contextLength: 128000,
180+ maxCompletionTokens: 4096,
181+ description:
182+ "Latest Grok model with improved reasoning and conversational abilities.",
183+ recommendedFor: ["chat"],
184+ },
185+ {
186+ model: "grok-3",
187+ displayName: "Grok 3",
188+ contextLength: 128000,
189+ maxCompletionTokens: 4096,
190+ description:
191+ "Advanced Grok model with enhanced understanding and generation capabilities.",
192+ recommendedFor: ["chat"],
193+ },
194+ {
195+ model: "grok-3-mini",
196+ displayName: "Grok 3 Mini",
197+ contextLength: 64000,
198+ maxCompletionTokens: 2048,
199+ description:
200+ "Compact Grok model optimized for efficiency and quick responses.",
201+ recommendedFor: ["chat"],
202+ },
203+ {
204+ model: "grok-2-image-1212",
205+ displayName: "Grok 2 Image (12-12)",
206+ contextLength: 128000,
207+ maxCompletionTokens: 4096,
208+ description:
209+ "Grok model with enhanced image understanding and multimodal capabilities.",
210+ recommendedFor: ["chat"],
211+ },
212+
213+ // DeepSeek Series
214+ {
215+ model: "deepseek-v3.1",
216+ displayName: "DeepSeek V3.1",
217+ contextLength: 128000,
218+ maxCompletionTokens: 4096,
219+ description:
220+ "Latest DeepSeek model with improved reasoning and coding capabilities.",
221+ recommendedFor: ["chat"],
222+ },
223+ {
224+ model: "deepseek-v3",
225+ displayName: "DeepSeek V3",
226+ contextLength: 128000,
227+ maxCompletionTokens: 4096,
228+ description:
229+ "Advanced DeepSeek model with strong performance in technical domains.",
230+ recommendedFor: ["chat"],
231+ },
232+ {
233+ model: "deepseek-r1-0528",
234+ displayName: "DeepSeek R1 (05-28)",
235+ contextLength: 128000,
236+ maxCompletionTokens: 4096,
237+ description:
238+ "DeepSeek reasoning model optimized for complex problem-solving tasks.",
239+ recommendedFor: ["chat"],
240+ },
241+ {
242+ model: "deepseek-chat",
243+ displayName: "DeepSeek Chat",
244+ contextLength: 128000,
245+ maxCompletionTokens: 4096,
246+ description:
247+ "DeepSeek model specifically optimized for conversational interactions.",
248+ recommendedFor: ["chat"],
249+ },
250+ {
251+ model: "deepseek-reasoner",
252+ displayName: "DeepSeek Reasoner",
253+ contextLength: 128000,
254+ maxCompletionTokens: 4096,
255+ description:
256+ "DeepSeek model with enhanced reasoning capabilities for analytical tasks.",
257+ recommendedFor: ["chat"],
258+ },
259+
260+ // Qwen Series
261+ {
262+ model: "qwen3-30b-a3b",
263+ displayName: "Qwen3 30B A3B",
264+ contextLength: 128000,
265+ maxCompletionTokens: 4096,
266+ description:
267+ "Large Qwen model with 30B parameters for high-quality text generation.",
268+ recommendedFor: ["chat"],
269+ },
270+ {
271+ model: "qwen3-coder-plus-2025-07-22",
272+ displayName: "Qwen3 Coder Plus (2025-07-22)",
273+ contextLength: 128000,
274+ maxCompletionTokens: 4096,
275+ description:
276+ "Qwen model specialized for coding tasks with enhanced programming capabilities.",
277+ recommendedFor: ["chat"],
278+ },
279+ ],
280+};
modified packages/llm-info/src/providers/xAI.ts +54 −0
@@ -7,6 +7,60 @@
77 displayName: "Grok Beta",
88 contextLength: 128000,
99 recommendedFor: ["chat"],
10+ regex: /grok-beta/,
11+ },
12+ {
13+ model: "grok-2",
14+ displayName: "Grok 2",
15+ contextLength: 131072,
16+ recommendedFor: ["chat"],
17+ regex: /grok-2/,
18+ },
19+ {
20+ model: "grok-3-mini",
21+ displayName: "Grok 3 Mini",
22+ contextLength: 131072,
23+ maxCompletionTokens: 8000,
24+ recommendedFor: ["chat"],
25+ regex: /grok-3-mini/,
26+ },
27+ {
28+ model: "grok-3",
29+ displayName: "Grok 3",
30+ contextLength: 131072,
31+ recommendedFor: ["chat"],
32+ regex: /grok-3/,
33+ },
34+ {
35+ model: "grok-4-fast-reasoning",
36+ displayName: "Grok 4 Fast Reasoning",
37+ contextLength: 2000000,
38+ maxCompletionTokens: 30000,
39+ recommendedFor: ["chat"],
40+ regex: /grok-4-fast-reasoning/,
41+ },
42+ {
43+ model: "grok-4-fast-non-reasoning",
44+ displayName: "Grok 4 Fast Non-Reasoning",
45+ contextLength: 2000000,
46+ maxCompletionTokens: 30000,
47+ recommendedFor: ["chat"],
48+ regex: /grok-4-fast-non-reasoning/,
49+ },
50+ {
51+ model: "grok-4",
52+ displayName: "Grok 4 Fast",
53+ contextLength: 256000,
54+ recommendedFor: ["chat"],
55+ regex: /grok-4/,
56+ },
57+ {
58+ model: "grok-code-fast-1",
59+ displayName: "Grok Code Fast 1",
60+ contextLength: 256000,
61+ maxCompletionTokens: 10000,
62+ recommendedFor: ["chat"],
63+ regex: /grok-code-fast-1/,
1064 },
1165 ],
1266 id: "xAI",
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 −0
@@ -12,6 +12,7 @@
1212 "author": "Nate Sesti and Ty Dunn",
1313 "license": "Apache-2.0",
1414 "dependencies": {
15+ "@anthropic-ai/sdk": "^0.62.0",
1516 "@aws-sdk/client-bedrock-runtime": "^3.842.0",
1617 "@aws-sdk/credential-providers": "^3.840.0",
1718 "@continuedev/config-types": "^1.0.14",
modified packages/openai-adapters/src/apis/Anthropic.ts +225 −152
@@ -1,8 +1,22 @@
1+import {
2+ ContentBlockParam,
3+ MessageCreateParams,
4+ MessageParam,
5+ RawContentBlockDeltaEvent,
6+ RawContentBlockStartEvent,
7+ RawMessageDeltaEvent,
8+ RawMessageStartEvent,
9+ RawMessageStreamEvent,
10+ Tool,
11+ ToolUseBlock,
12+} from "@anthropic-ai/sdk/resources";
113 import { streamSse } from "@continuedev/fetch";
214 import { OpenAI } from "openai/index";
315 import {
416 ChatCompletion,
517 ChatCompletionChunk,
18+ ChatCompletionContentPartRefusal,
19+ ChatCompletionContentPartText,
620 ChatCompletionCreateParamsNonStreaming,
721 ChatCompletionCreateParamsStreaming,
822 Completion,
@@ -24,6 +38,12 @@
2438 CACHING_STRATEGIES,
2539 CachingStrategyName,
2640 } from "./AnthropicCachingStrategies.js";
41+import {
42+ getAnthropicHeaders,
43+ getAnthropicMediaTypeFromDataUrl,
44+ openAiToolChoiceToAnthropicToolChoice,
45+ openaiToolToAnthropicTool,
46+} from "./AnthropicUtils.js";
2747 import {
2848 BaseLlmApi,
2949 CreateRerankResponse,
@@ -59,11 +79,12 @@
5979 if (model.includes("haiku")) {
6080 return 8192;
6181 }
62-
6382 return 32_000;
6483 }
6584
66- public _convertToCleanAnthropicBody(oaiBody: ChatCompletionCreateParams) {
85+ public _convertToCleanAnthropicBody(
86+ oaiBody: ChatCompletionCreateParams,
87+ ): MessageCreateParams {
6788 let stop = undefined;
6889 if (oaiBody.stop && Array.isArray(oaiBody.stop)) {
6990 stop = oaiBody.stop.filter((x) => x.trim() !== "");
@@ -75,145 +96,198 @@
7596 (msg) => msg.role === "system",
7697 )?.content;
7798
78- const anthropicBody = {
99+ // TODO support custom tools
100+ const functionTools = oaiBody.tools?.filter((t) => t.type === "function");
101+ let tools: Tool[] | undefined = undefined;
102+
103+ if (
104+ oaiBody.tool_choice !== "none" &&
105+ functionTools &&
106+ functionTools.length > 0
107+ ) {
108+ if (
109+ typeof oaiBody.tool_choice !== "string" &&
110+ oaiBody.tool_choice?.type === "allowed_tools"
111+ ) {
112+ const allowedToolNames = new Set(
113+ oaiBody.tool_choice?.allowed_tools.tools.map(
114+ (tool) => tool["name"],
115+ ) ?? [],
116+ );
117+ const allowedTools = functionTools.filter((t) =>
118+ allowedToolNames.has(t.function.name),
119+ );
120+ tools = allowedTools.map(openaiToolToAnthropicTool);
121+ } else {
122+ tools = functionTools.map(openaiToolToAnthropicTool);
123+ }
124+ }
125+
126+ const anthropicBody: MessageCreateParams = {
79127 messages: this._convertMessages(
80128 oaiBody.messages.filter((msg) => msg.role !== "system"),
81129 ),
82- system: systemMessage
83- ? [
84- {
85- type: "text",
86- text: systemMessage,
87- },
88- ]
89- : systemMessage,
90- top_p: oaiBody.top_p,
91- temperature: oaiBody.temperature,
130+ system:
131+ typeof systemMessage === "string"
132+ ? [
133+ {
134+ type: "text",
135+ text: systemMessage,
136+ },
137+ ]
138+ : systemMessage,
139+ top_p: oaiBody.top_p ?? undefined,
140+ temperature: oaiBody.temperature ?? undefined,
92141 max_tokens: oaiBody.max_tokens ?? this.maxTokensForModel(oaiBody.model), // max_tokens is required
93142 model: oaiBody.model,
94143 stop_sequences: stop,
95- stream: oaiBody.stream,
96- tools: oaiBody.tools?.map((tool) => {
97- // Type guard for function tools
98- if (tool.type === "function" && "function" in tool) {
99- return {
100- name: tool.function.name,
101- description: tool.function.description,
102- input_schema: tool.function.parameters,
103- };
104- } else {
105- throw new Error(`Unsupported tool type in Anthropic: ${tool.type}`);
106- }
107- }),
108- tool_choice: oaiBody.tool_choice
109- ? {
110- type: "tool",
111- name:
112- typeof oaiBody.tool_choice === "string"
113- ? oaiBody.tool_choice
114- : oaiBody.tool_choice && "function" in oaiBody.tool_choice
115- ? oaiBody.tool_choice.function.name
116- : undefined,
117- }
118- : undefined,
144+ stream: oaiBody.stream ?? undefined,
145+ tools,
146+ tool_choice: openAiToolChoiceToAnthropicToolChoice(oaiBody.tool_choice),
119147 };
120148
121149 return anthropicBody;
122150 }
123151
124- private _convertMessages(
125- msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[],
126- ): any[] {
127- const messages = msgs.map((message) => {
128- if (message.role === "tool") {
129- return {
130- role: "user",
131- content: [
132- {
133- type: "tool_result",
134- tool_use_id: message.tool_call_id,
135- content:
136- typeof message.content === "string"
137- ? message.content
138- : message.content.map((part) => part.text).join(""),
139- },
140- ],
141- };
142- } else if (message.role === "assistant" && message.tool_calls) {
143- const parts: any[] = [];
144- if (message.content) {
145- if (typeof message.content === "string") {
146- parts.push({
152+ private convertToolCallsToBlocks(
153+ toolCall: OpenAI.Chat.Completions.ChatCompletionMessageFunctionToolCall,
154+ ): ToolUseBlock | undefined {
155+ const toolCallId = toolCall.id;
156+ const toolName = toolCall.function?.name;
157+ if (toolCallId && toolName) {
158+ return {
159+ type: "tool_use",
160+ id: toolCallId,
161+ name: toolName,
162+ input: safeParseArgs(
163+ toolCall.function.arguments,
164+ `${toolName} ${toolCallId}`,
165+ ),
166+ };
167+ }
168+ }
169+
170+ // 1. ignores empty content
171+ // 2. converts string content to text parts
172+ // 3. converts text and refusal parts to text blocks
173+ // 4. converts image parts to image blocks
174+ private convertMessageContentToBlocks(
175+ content:
176+ | string
177+ | OpenAI.Chat.Completions.ChatCompletionContentPart[]
178+ | (ChatCompletionContentPartText | ChatCompletionContentPartRefusal)[],
179+ ): ContentBlockParam[] {
180+ const blocks: ContentBlockParam[] = [];
181+ if (typeof content === "string") {
182+ if (content) {
183+ blocks.push({
184+ type: "text",
185+ text: content,
186+ });
187+ }
188+ } else {
189+ const supportedParts = content.filter(
190+ (p) =>
191+ p.type === "text" || p.type === "image_url" || p.type === "refusal",
192+ );
193+ for (const part of supportedParts) {
194+ if (part.type === "image_url") {
195+ const dataUrl = part.image_url.url;
196+ if (dataUrl?.startsWith("data:")) {
197+ blocks.push({
198+ type: "image",
199+ source: {
200+ type: "base64",
201+ media_type: getAnthropicMediaTypeFromDataUrl(dataUrl),
202+ data: dataUrl.split(",")[1],
203+ },
204+ });
205+ }
206+ } else {
207+ const text = part.type === "text" ? part.text : part.refusal;
208+ if (text) {
209+ blocks.push({
147210 type: "text",
148- text: message.content,
211+ text,
149212 });
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- );
157213 }
158214 }
215+ }
216+ }
217+ return blocks;
218+ }
159219
160- parts.push(
161- ...message.tool_calls.map((toolCall) => {
162- // Type guard for function tool calls
163- if (toolCall.type === "function" && "function" in toolCall) {
164- return {
165- type: "tool_use",
166- id: toolCall.id,
167- name: toolCall.function?.name,
168- input: safeParseArgs(
169- toolCall.function?.arguments,
170- `${toolCall.function?.name} ${toolCall.id}`,
171- ),
172- };
173- } else {
174- throw new Error(`Unsupported tool call type: ${toolCall.type}`);
175- }
176- }),
177- );
178- return {
179- role: "assistant",
180- content: parts,
181- };
220+ private getContentBlocksFromChatMessage(
221+ message: OpenAI.Chat.Completions.ChatCompletionMessageParam,
222+ ): ContentBlockParam[] {
223+ switch (message.role) {
224+ // One tool message = one tool_result block
225+ case "tool":
226+ return [
227+ {
228+ type: "tool_result",
229+ tool_use_id: message.tool_call_id,
230+ content: message.content,
231+ },
232+ ];
233+ case "user":
234+ return this.convertMessageContentToBlocks(message.content);
235+ case "assistant":
236+ const blocks: ContentBlockParam[] = message.content
237+ ? this.convertMessageContentToBlocks(message.content)
238+ : [];
239+ // If any tool calls are present, always put them last
240+ // Loses order vs what was originally sent, but they typically come last
241+ for (const toolCall of message.tool_calls ?? []) {
242+ if (toolCall.type !== "function") {
243+ // TODO support custom tool calls
244+ continue;
245+ }
246+ const block = this.convertToolCallsToBlocks(toolCall);
247+ if (block) {
248+ blocks.push(block);
249+ }
250+ }
251+ return blocks;
252+ // system, etc.
253+ default:
254+ return [];
255+ }
256+ }
257+
258+ private _convertMessages(
259+ msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[],
260+ ): MessageParam[] {
261+ const nonSystemMessages = msgs.filter((m) => m.role !== "system");
262+
263+ const convertedMessages: MessageParam[] = [];
264+ let currentRole: "user" | "assistant" | undefined = undefined;
265+ let currentParts: ContentBlockParam[] = [];
266+
267+ const flushCurrentMessage = () => {
268+ if (currentRole && currentParts.length > 0) {
269+ convertedMessages.push({
270+ role: currentRole,
271+ content: currentParts,
272+ });
273+ currentParts = [];
182274 }
275+ };
183276
184- if (!Array.isArray(message.content)) {
185- return message;
277+ for (const message of nonSystemMessages) {
278+ const newRole =
279+ message.role === "user" || message.role === "tool"
280+ ? "user"
281+ : "assistant";
282+ if (currentRole !== newRole) {
283+ flushCurrentMessage();
284+ currentRole = newRole;
186285 }
187- return {
188- ...message,
189- content: message.content
190- .map((part) => {
191- if (part.type === "text") {
192- if ((part.text?.trim() ?? "") === "") {
193- return null;
194- }
195- return part;
196- }
197- const dataUrl =
198- (part as OpenAI.Chat.Completions.ChatCompletionContentPartImage)
199- ?.image_url?.url || "";
200- // Extract media type from data URL (ex. "data:image/png;base64,..." -> "image/png")
201- const mediaTypeMatch = dataUrl.match(/^data:([^;]+);base64,/);
202- const mediaType = mediaTypeMatch ? mediaTypeMatch[1] : "image/jpeg";
203-
204- return {
205- type: "image",
206- source: {
207- type: "base64",
208- media_type: mediaType,
209- data: dataUrl.split(",")[1],
210- },
211- };
212- })
213- .filter((x) => x !== null),
214- };
215- });
216- return messages;
286+ currentParts.push(...this.getContentBlocksFromChatMessage(message));
287+ }
288+ flushCurrentMessage();
289+
290+ return convertedMessages;
217291 }
218292
219293 async chatCompletionNonStream(
@@ -224,13 +298,7 @@
224298 new URL("messages", this.apiBase),
225299 {
226300 method: "POST",
227- headers: {
228- "Content-Type": "application/json",
229- Accept: "application/json",
230- "anthropic-version": "2023-06-01",
231- "anthropic-beta": "prompt-caching-2024-07-31",
232- "x-api-key": this.config.apiKey,
233- },
301+ headers: this.getHeaders(),
234302 body: JSON.stringify(this._convertBody(body)),
235303 signal,
236304 },
@@ -240,7 +308,7 @@
240308 return EMPTY_CHAT_COMPLETION;
241309 }
242310
243- const completion = (await response.json()) as any;
311+ const completion = await response.json();
244312
245313 const usage: Record<string, number> | undefined = completion.usage;
246314 return {
@@ -281,30 +349,36 @@
281349 prompt_tokens: 0,
282350 total_tokens: 0,
283351 };
284- for await (const value of streamSse(response as any)) {
352+ for await (const event of streamSse(response)) {
285353 // https://docs.anthropic.com/en/api/messages-streaming#event-types
286- switch (value.type) {
354+ const rawEvent = event as RawMessageStreamEvent;
355+ switch (rawEvent.type) {
287356 case "content_block_start":
288- if (value.content_block.type === "tool_use") {
289- lastToolUseId = value.content_block.id;
290- lastToolUseName = value.content_block.name;
357+ const blockStartEvent = rawEvent as RawContentBlockStartEvent;
358+ if (blockStartEvent.content_block.type === "tool_use") {
359+ lastToolUseId = blockStartEvent.content_block.id;
360+ lastToolUseName = blockStartEvent.content_block.name;
291361 }
292362 break;
293363 case "message_start":
294- usage.prompt_tokens = value.message.usage?.input_tokens ?? 0;
364+ const startEvent = rawEvent as RawMessageStartEvent;
365+ usage.prompt_tokens = startEvent.message.usage?.input_tokens ?? 0;
295366 usage.prompt_tokens_details = {
296- cached_tokens: value.message.usage?.cache_read_input_tokens ?? 0,
367+ cached_tokens:
368+ startEvent.message.usage?.cache_read_input_tokens ?? 0,
297369 };
298370 break;
299371 case "message_delta":
300- usage.completion_tokens = value.usage?.output_tokens ?? 0;
372+ const deltaEvent = rawEvent as RawMessageDeltaEvent;
373+ usage.completion_tokens = deltaEvent.usage?.output_tokens ?? 0;
301374 break;
302375 case "content_block_delta":
303376 // https://docs.anthropic.com/en/api/messages-streaming#delta-types
304- switch (value.delta.type) {
377+ const blockDeltaEvent = rawEvent as RawContentBlockDeltaEvent;
378+ switch (blockDeltaEvent.delta.type) {
305379 case "text_delta":
306380 yield chatChunk({
307- content: value.delta.text,
381+ content: blockDeltaEvent.delta.text,
308382 model,
309383 });
310384 break;
@@ -322,7 +396,7 @@
322396 index: 0,
323397 function: {
324398 name: lastToolUseName,
325- arguments: value.delta.partial_json,
399+ arguments: blockDeltaEvent.delta.partial_json,
326400 },
327401 },
328402 ],
@@ -352,25 +426,24 @@
352426 async *chatCompletionStream(
353427 body: ChatCompletionCreateParamsStreaming,
354428 signal: AbortSignal,
355- ): AsyncGenerator<ChatCompletionChunk, any, unknown> {
356- body.messages;
429+ ): AsyncGenerator<ChatCompletionChunk> {
357430 const response = await customFetch(this.config.requestOptions)(
358431 new URL("messages", this.apiBase),
359432 {
360433 method: "POST",
361- headers: {
362- "Content-Type": "application/json",
363- Accept: "application/json",
364- "anthropic-version": "2023-06-01",
365- "anthropic-beta": "prompt-caching-2024-07-31",
366- "x-api-key": this.config.apiKey,
367- },
434+ headers: this.getHeaders(),
368435 body: JSON.stringify(this._convertBody(body)),
369436 signal,
370437 },
371438 );
372439 yield* this.handleStreamResponse(response, body.model);
373440 }
441+
442+ private getHeaders(): Record<string, string> {
443+ const enableCaching = this.config?.cachingStrategy !== "none";
444+ return getAnthropicHeaders(this.config.apiKey, enableCaching);
445+ }
446+
374447 async completionNonStream(
375448 body: CompletionCreateParamsNonStreaming,
376449 signal: AbortSignal,
@@ -380,13 +453,13 @@
380453 async *completionStream(
381454 body: CompletionCreateParamsStreaming,
382455 signal: AbortSignal,
383- ): AsyncGenerator<Completion, any, unknown> {
456+ ): AsyncGenerator<Completion> {
384457 throw new Error("Method not implemented.");
385458 }
386459 async *fimStream(
387460 body: FimCreateParamsStreaming,
388461 signal: AbortSignal,
389- ): AsyncGenerator<ChatCompletionChunk, any, unknown> {
462+ ): AsyncGenerator<ChatCompletionChunk> {
390463 throw new Error("Method not implemented.");
391464 }
392465
modified packages/openai-adapters/src/apis/AnthropicCachingStrategies.test.ts +277 −133
@@ -1,24 +1,42 @@
1+import { MessageCreateParams, ToolUnion } from "@anthropic-ai/sdk/resources";
12 import {
23 CACHING_STRATEGIES,
3- CachingStrategy,
44 CachingStrategyName,
55 getAvailableStrategies,
66 getStrategyDescription,
77 } from "./AnthropicCachingStrategies.js";
88
9+const body_params = {
10+ model: "claude",
11+ stream: true,
12+ max_tokens: 8192,
13+};
14+
15+const makeTool = (name: string): ToolUnion => ({
16+ name,
17+ input_schema: {
18+ type: "object",
19+ },
20+});
21+
922 describe("AnthropicCachingStrategies", () => {
1023 describe("noCachingStrategy", () => {
1124 it("should return the body unchanged", () => {
12- const body = { system: "test", messages: [] };
25+ const body: MessageCreateParams = {
26+ system: "test",
27+ messages: [],
28+ ...body_params,
29+ };
1330 const result = CACHING_STRATEGIES.none(body);
1431 expect(result).toBe(body);
1532 });
1633
1734 it("should not modify complex objects", () => {
18- const body = {
19- system: [{ text: "test" }],
20- tools: [{ name: "test" }],
21- messages: [{ content: "test" }],
35+ const body: MessageCreateParams = {
36+ system: [{ type: "text", text: "test" }],
37+ tools: [makeTool("test")],
38+ messages: [{ role: "user", content: "test" }],
39+ ...body_params,
2240 };
2341 const result = CACHING_STRATEGIES.none(body);
2442 expect(result).toBe(body);
@@ -27,24 +45,37 @@
2745
2846 describe("systemOnlyStrategy", () => {
2947 it("should add cache_control to system messages array", () => {
30- const body = {
31- system: [{ text: "system message 1" }, { text: "system message 2" }],
32- messages: [{ content: "user message" }],
48+ const body: MessageCreateParams = {
49+ system: [
50+ { type: "text", text: "system message 1" },
51+ { type: "text", text: "system message 2" },
52+ ],
53+ messages: [{ role: "user", content: "user message" }],
54+ ...body_params,
3355 };
3456
3557 const result = CACHING_STRATEGIES.systemOnly(body);
3658
3759 expect(result.system).toEqual([
38- { text: "system message 1", cache_control: { type: "ephemeral" } },
39- { text: "system message 2", cache_control: { type: "ephemeral" } },
60+ {
61+ type: "text",
62+ text: "system message 1",
63+ cache_control: { type: "ephemeral" },
64+ },
65+ {
66+ type: "text",
67+ text: "system message 2",
68+ cache_control: { type: "ephemeral" },
69+ },
4070 ]);
4171 expect(result.messages).toEqual(body.messages);
4272 });
4373
4474 it("should return body unchanged if system is not an array", () => {
45- const body = {
75+ const body: MessageCreateParams = {
4676 system: "string system message",
47- messages: [{ content: "user message" }],
77+ messages: [{ role: "user", content: "user message" }],
78+ ...body_params,
4879 };
4980
5081 const result = CACHING_STRATEGIES.systemOnly(body);
@@ -52,8 +83,9 @@
5283 });
5384
5485 it("should return body unchanged if system is undefined", () => {
55- const body = {
56- messages: [{ content: "user message" }],
86+ const body: MessageCreateParams = {
87+ messages: [{ role: "user", content: "user message" }],
88+ ...body_params,
5789 };
5890
5991 const result = CACHING_STRATEGIES.systemOnly(body);
@@ -61,25 +93,42 @@
6193 });
6294
6395 it("should not add more than 5 cached messages", () => {
64- const body = {
96+ const body: MessageCreateParams = {
6597 system: [
66- { text: "system message 1" },
67- { text: "system message 2" },
68- { text: "system message 3" },
69- { text: "system message 4" },
70- { text: "system message 5" },
98+ { type: "text", text: "system message 1" },
99+ { type: "text", text: "system message 2" },
100+ { type: "text", text: "system message 3" },
101+ { type: "text", text: "system message 4" },
102+ { type: "text", text: "system message 5" },
71103 ],
72- messages: [{ content: "user message" }],
104+ messages: [{ role: "user", content: "user message" }],
105+ ...body_params,
73106 };
74107
75108 const result = CACHING_STRATEGIES.systemOnly(body);
76109
77110 expect(result.system).toEqual([
78- { text: "system message 1", cache_control: { type: "ephemeral" } },
79- { text: "system message 2", cache_control: { type: "ephemeral" } },
80- { text: "system message 3", cache_control: { type: "ephemeral" } },
81- { text: "system message 4", cache_control: { type: "ephemeral" } },
82- { text: "system message 5" },
111+ {
112+ type: "text",
113+ text: "system message 1",
114+ cache_control: { type: "ephemeral" },
115+ },
116+ {
117+ type: "text",
118+ text: "system message 2",
119+ cache_control: { type: "ephemeral" },
120+ },
121+ {
122+ type: "text",
123+ text: "system message 3",
124+ cache_control: { type: "ephemeral" },
125+ },
126+ {
127+ type: "text",
128+ text: "system message 4",
129+ cache_control: { type: "ephemeral" },
130+ },
131+ { type: "text", text: "system message 5" },
83132 ]);
84133 expect(result.messages).toEqual(body.messages);
85134 });
@@ -87,82 +136,116 @@
87136
88137 describe("systemAndToolsStrategy", () => {
89138 it("should add cache_control to both system and tools", () => {
90- const body = {
91- system: [{ text: "system message" }],
92- tools: [{ name: "tool1" }, { name: "tool2" }],
93- messages: [{ content: "user message" }],
139+ const body: MessageCreateParams = {
140+ system: [{ type: "text", text: "system message" }],
141+ tools: [makeTool("tool1"), makeTool("tool2")],
142+ messages: [{ role: "user", content: "user message" }],
143+ ...body_params,
94144 };
95145
96146 const result = CACHING_STRATEGIES.systemAndTools(body);
97147
98148 expect(result.system).toEqual([
99- { text: "system message", cache_control: { type: "ephemeral" } },
149+ {
150+ type: "text",
151+ text: "system message",
152+ cache_control: { type: "ephemeral" },
153+ },
100154 ]);
101155 expect(result.tools).toEqual([
102- { name: "tool1" },
103- { name: "tool2", cache_control: { type: "ephemeral" } },
156+ {
157+ name: "tool1",
158+ input_schema: {
159+ type: "object",
160+ },
161+ },
162+ {
163+ name: "tool2",
164+ input_schema: {
165+ type: "object",
166+ },
167+ cache_control: { type: "ephemeral" },
168+ },
104169 ]);
105170 expect(result.messages).toEqual(body.messages);
106171 });
107172
108173 it("should handle missing system messages", () => {
109- const body = {
110- tools: [{ name: "tool1" }],
111- messages: [{ content: "user message" }],
174+ const body: MessageCreateParams = {
175+ tools: [makeTool("tool1")],
176+ messages: [{ role: "user", content: "user message" }],
177+ ...body_params,
112178 };
113179
114180 const result = CACHING_STRATEGIES.systemAndTools(body);
115181
116182 expect(result.tools).toEqual([
117- { name: "tool1", cache_control: { type: "ephemeral" } },
183+ {
184+ name: "tool1",
185+ input_schema: {
186+ type: "object",
187+ },
188+ cache_control: { type: "ephemeral" },
189+ },
118190 ]);
119191 expect(result.messages).toEqual(body.messages);
120192 });
121193
122194 it("should handle missing tools", () => {
123- const body = {
124- system: [{ text: "system message" }],
125- messages: [{ content: "user message" }],
195+ const body: MessageCreateParams = {
196+ system: [{ type: "text", text: "system message" }],
197+ messages: [{ role: "user", content: "user message" }],
198+ ...body_params,
126199 };
127200
128201 const result = CACHING_STRATEGIES.systemAndTools(body);
129202
130203 expect(result.system).toEqual([
131- { text: "system message", cache_control: { type: "ephemeral" } },
204+ {
205+ type: "text",
206+ text: "system message",
207+ cache_control: { type: "ephemeral" },
208+ },
132209 ]);
133210 expect(result.messages).toEqual(body.messages);
134211 });
135212
136- it("should handle non-array system and tools", () => {
137- const body = {
138- system: "string system",
139- tools: "string tools",
140- messages: [{ content: "user message" }],
141- };
142-
143- const result = CACHING_STRATEGIES.systemAndTools(body);
144- expect(result).toEqual(body);
145- });
146-
147213 it("should add only 4 cache controls in total to both system and tools", () => {
148- const body = {
214+ const body: MessageCreateParams = {
149215 system: [
150- { text: "system message 1" },
151- { text: "system message 2" },
152- { text: "system message 3" },
153- { text: "system message 4" },
216+ { type: "text", text: "system message 1" },
217+ { type: "text", text: "system message 2" },
218+ { type: "text", text: "system message 3" },
219+ { type: "text", text: "system message 4" },
154220 ],
155- tools: [{ name: "tool1" }, { name: "tool2" }],
156- messages: [{ content: "user message" }],
221+ tools: [makeTool("tool1"), makeTool("tool2")],
222+ messages: [{ role: "user", content: "user message" }],
223+ ...body_params,
157224 };
158225
159226 const result = CACHING_STRATEGIES.systemAndTools(body);
160227
161228 expect(result.system).toEqual([
162- { text: "system message 1", cache_control: { type: "ephemeral" } },
163- { text: "system message 2", cache_control: { type: "ephemeral" } },
164- { text: "system message 3", cache_control: { type: "ephemeral" } },
165- { text: "system message 4", cache_control: { type: "ephemeral" } },
229+ {
230+ type: "text",
231+ text: "system message 1",
232+ cache_control: { type: "ephemeral" },
233+ },
234+ {
235+ type: "text",
236+ text: "system message 2",
237+ cache_control: { type: "ephemeral" },
238+ },
239+ {
240+ type: "text",
241+ text: "system message 3",
242+ cache_control: { type: "ephemeral" },
243+ },
244+ {
245+ type: "text",
246+ text: "system message 4",
247+ cache_control: { type: "ephemeral" },
248+ },
166249 ]);
167250 expect(result.tools).toEqual(body.tools);
168251 expect(result.messages).toEqual(body.messages);
@@ -171,32 +254,45 @@
171254
172255 describe("optimizedStrategy", () => {
173256 it("should cache system messages and tools", () => {
174- const body = {
175- system: [{ text: "system message" }],
176- tools: [{ name: "tool1" }],
177- messages: [{ content: "short message" }],
257+ const body: MessageCreateParams = {
258+ system: [{ type: "text", text: "system message" }],
259+ tools: [makeTool("tool1")],
260+ messages: [{ role: "user", content: "short message" }],
261+ ...body_params,
178262 };
179263
180264 const result = CACHING_STRATEGIES.optimized(body);
181265
182266 expect(result.system).toEqual([
183- { text: "system message", cache_control: { type: "ephemeral" } },
267+ {
268+ type: "text",
269+ text: "system message",
270+ cache_control: { type: "ephemeral" },
271+ },
184272 ]);
185273 expect(result.tools).toEqual([
186- { name: "tool1", cache_control: { type: "ephemeral" } },
274+ {
275+ name: "tool1",
276+ input_schema: {
277+ type: "object",
278+ },
279+ cache_control: { type: "ephemeral" },
280+ },
187281 ]);
188282 });
189283
190284 it("should cache large string messages (>500 tokens)", () => {
191285 const largeContent = "a".repeat(2100); // ~525 tokens
192- const body = {
193- messages: [{ content: largeContent }],
286+ const body: MessageCreateParams = {
287+ messages: [{ role: "user", content: largeContent }],
288+ ...body_params,
194289 };
195290
196291 const result = CACHING_STRATEGIES.optimized(body);
197292
198293 expect(result.messages).toEqual([
199294 {
295+ role: "user",
200296 content: [
201297 {
202298 type: "text",
@@ -210,30 +306,42 @@
210306
211307 it("should not cache small string messages (<500 tokens)", () => {
212308 const smallContent = "a".repeat(100); // ~25 tokens
213- const body = {
214- messages: [{ content: smallContent }],
309+ const body: MessageCreateParams = {
310+ messages: [{ role: "user", content: smallContent }],
311+ ...body_params,
215312 };
216313
217314 const result = CACHING_STRATEGIES.optimized(body);
218315
219- expect(result.messages).toEqual([{ content: smallContent }]);
316+ expect(result.messages).toEqual([
317+ { role: "user", content: smallContent },
318+ ]);
220319 });
221320
222321 it("should cache large text items in array content but only once per message", () => {
223322 const largeText = "a".repeat(2100); // ~525 tokens
224323 const anotherLargeText = "b".repeat(2100); // Also ~525 tokens
225324 const smallText = "a".repeat(100); // ~25 tokens
226- const body = {
325+ const body: MessageCreateParams = {
227326 messages: [
228327 {
328+ role: "user",
229329 content: [
230330 { type: "text", text: largeText },
231331 { type: "text", text: anotherLargeText },
232332 { type: "text", text: smallText },
233- { type: "image", data: "image_data" },
333+ {
334+ type: "image",
335+ source: {
336+ data: "image_data",
337+ media_type: "image/jpeg",
338+ type: "base64",
339+ },
340+ },
234341 ],
235342 },
236343 ],
344+ ...body_params,
237345 };
238346
239347 const result = CACHING_STRATEGIES.optimized(body);
@@ -241,6 +349,7 @@
241349 // Only the first large text item should get cache_control
242350 expect(result.messages).toEqual([
243351 {
352+ role: "user",
244353 content: [
245354 {
246355 type: "text",
@@ -249,40 +358,78 @@
249358 },
250359 { type: "text", text: anotherLargeText },
251360 { type: "text", text: smallText },
252- { type: "image", data: "image_data" },
361+ {
362+ type: "image",
363+ source: {
364+ data: "image_data",
365+ media_type: "image/jpeg",
366+ type: "base64",
367+ },
368+ },
253369 ],
254370 },
255371 ]);
256372 });
257373
258374 it("should add maximum 4 cache control blocks", () => {
259- const body = {
260- system: [{ text: "system message 1" }, { text: "system message 2" }],
261- tools: [{ name: "tool" }],
375+ const body: MessageCreateParams = {
376+ system: [
377+ { type: "text", text: "system message 1" },
378+ { type: "text", text: "system message 2" },
379+ ],
380+ tools: [makeTool("tool")],
262381 messages: [
263- { content: "small content" },
264- { content: "a".repeat(2100) },
265- { content: "b".repeat(2100) },
382+ { role: "user", content: "small content" },
383+ { role: "user", content: "a".repeat(2100) },
384+ { role: "user", content: "b".repeat(2100) },
266385 {
386+ role: "user",
267387 content: [
268388 { type: "text", text: "c".repeat(2100) },
269- { type: "image", data: "image" },
389+ {
390+ type: "image",
391+ source: {
392+ data: "image_data",
393+ media_type: "image/jpeg",
394+ type: "base64",
395+ },
396+ },
270397 ],
271398 },
272399 ],
400+ ...body_params,
273401 };
274402
275403 const result = CACHING_STRATEGIES.optimized(body);
276404
277405 expect(result.system).toEqual([
278- { text: "system message 1", cache_control: { type: "ephemeral" } },
279- { text: "system message 2", cache_control: { type: "ephemeral" } },
406+ {
407+ type: "text",
408+ text: "system message 1",
409+ cache_control: { type: "ephemeral" },
410+ },
411+ {
412+ type: "text",
413+ text: "system message 2",
414+ cache_control: { type: "ephemeral" },
415+ },
280416 ]);
281417 expect(result.tools).toEqual([
282- { name: "tool", cache_control: { type: "ephemeral" } },
418+ {
419+ name: "tool",
420+ input_schema: {
421+ type: "object",
422+ },
423+ cache_control: { type: "ephemeral" },
424+ },
283425 ]);
284- expect(result.messages[0]).toEqual({ content: "small content" });
426+ expect(result.messages[0]).toEqual({
427+ role: "user",
428+ content: "small content",
429+ });
430+
285431 expect(result.messages[1]).toEqual({
432+ role: "user",
286433 content: [
287434 {
288435 type: "text",
@@ -296,31 +443,50 @@
296443 });
297444
298445 it("should handle complex message structure", () => {
299- const body = {
300- system: [{ text: "system" }],
301- tools: [{ name: "tool" }],
446+ const body: MessageCreateParams = {
447+ system: [{ type: "text", text: "system" }],
448+ tools: [makeTool("tool")],
302449 messages: [
303- { content: "small content" },
304- { content: "a".repeat(2100) }, // large content
450+ { role: "user", content: "small content" },
451+ { role: "user", content: "a".repeat(2100) }, // large content
305452 {
453+ role: "user",
306454 content: [
307455 { type: "text", text: "a".repeat(2100) }, // large text
308- { type: "image", data: "image" },
456+ {
457+ type: "image",
458+ source: {
459+ data: "image_data",
460+ media_type: "image/jpeg",
461+ type: "base64",
462+ },
463+ },
309464 ],
310465 },
311466 ],
467+ ...body_params,
312468 };
313469
314470 const result = CACHING_STRATEGIES.optimized(body);
315471
316472 expect(result.system).toEqual([
317- { text: "system", cache_control: { type: "ephemeral" } },
473+ { type: "text", text: "system", cache_control: { type: "ephemeral" } },
318474 ]);
319475 expect(result.tools).toEqual([
320- { name: "tool", cache_control: { type: "ephemeral" } },
476+ {
477+ name: "tool",
478+ input_schema: {
479+ type: "object",
480+ },
481+ cache_control: { type: "ephemeral" },
482+ },
321483 ]);
322- expect(result.messages[0]).toEqual({ content: "small content" });
484+ expect(result.messages[0]).toEqual({
485+ role: "user",
486+ content: "small content",
487+ });
323488 expect(result.messages[1]).toEqual({
489+ role: "user",
324490 content: [
325491 {
326492 type: "text",
@@ -337,30 +503,17 @@
337503 });
338504
339505 it("should handle empty or missing messages", () => {
340- const body = {
341- system: [{ text: "system" }],
342- };
343-
344- const result = CACHING_STRATEGIES.optimized(body);
345-
346- expect(result.system).toEqual([
347- { text: "system", cache_control: { type: "ephemeral" } },
348- ]);
349- expect(result.messages).toBeUndefined();
350- });
351-
352- it("should handle non-array messages", () => {
353- const body = {
354- system: [{ text: "system" }],
355- messages: "not an array",
506+ const body: MessageCreateParams = {
507+ system: [{ type: "text", text: "system" }],
508+ messages: [],
509+ ...body_params,
356510 };
357511
358512 const result = CACHING_STRATEGIES.optimized(body);
359513
360514 expect(result.system).toEqual([
361- { text: "system", cache_control: { type: "ephemeral" } },
515+ { type: "text", text: "system", cache_control: { type: "ephemeral" } },
362516 ]);
363- expect(result.messages).toBe("not an array");
364517 });
365518 });
366519
@@ -370,8 +523,14 @@
370523 const smallContent = "a".repeat(100); // ~25 tokens
371524 const largeContent = "a".repeat(2100); // ~525 tokens
372525
373- const bodySmall = { messages: [{ content: smallContent }] };
374- const bodyLarge = { messages: [{ content: largeContent }] };
526+ const bodySmall: MessageCreateParams = {
527+ messages: [{ role: "user", content: smallContent }],
528+ ...body_params,
529+ };
530+ const bodyLarge: MessageCreateParams = {
531+ messages: [{ role: "user", content: largeContent }],
532+ ...body_params,
533+ };
375534
376535 const resultSmall = CACHING_STRATEGIES.optimized(bodySmall);
377536 const resultLarge = CACHING_STRATEGIES.optimized(bodyLarge);
@@ -429,21 +588,6 @@
429588 });
430589 });
431590 });
432-
433- describe("CachingStrategy type", () => {
434- it("should accept valid caching strategy functions", () => {
435- const customStrategy: CachingStrategy = (body) => ({
436- ...body,
437- custom: true,
438- });
439-
440- const input = { test: "value" };
441- const result = customStrategy(input);
442-
443- expect(result).toEqual({ test: "value", custom: true });
444- });
445- });
446-
447591 describe("CachingStrategyName type", () => {
448592 it("should work with valid strategy names", () => {
449593 const strategyNames: CachingStrategyName[] = [
modified packages/openai-adapters/src/apis/AnthropicCachingStrategies.ts +18 −14
@@ -1,21 +1,25 @@
1+import { MessageCreateParams } from "@anthropic-ai/sdk/resources";
2+
13 const MAX_CACHING_MESSAGES = 4;
24
35 // Caching strategy type - transforms a clean Anthropic body by adding cache_control
4-export type CachingStrategy = (anthropicBody: any) => any;
6+export type CachingStrategy = (
7+ anthropicBody: MessageCreateParams,
8+) => MessageCreateParams;
59
610 // Utility function to estimate token count
711 const estimateTokenCount = (text: string): number => Math.ceil(text.length / 4);
812
9-// Strategy 1: No Caching (Baseline)
13+// Strategy 1: No Caching
1014 const noCachingStrategy: CachingStrategy = (body) => body;
1115
12-// Strategy 2: System Messages Only (Current Implementation)
16+// Strategy 2: System Messages Only
1317 const systemOnlyStrategy: CachingStrategy = (body) => {
1418 let availableCacheMessages = MAX_CACHING_MESSAGES;
1519 if (body.system && Array.isArray(body.system)) {
1620 return {
1721 ...body,
18- system: body.system.map((item: any) => {
22+ system: body.system.map((item) => {
1923 if (availableCacheMessages > 0) {
2024 availableCacheMessages -= 1;
2125 return {
@@ -37,7 +41,7 @@
3741
3842 // Cache system messages
3943 if (result.system && Array.isArray(result.system)) {
40- result.system = result.system.map((item: any) => {
44+ result.system = result.system.map((item) => {
4145 if (availableCacheMessages > 0) {
4246 availableCacheMessages -= 1;
4347 return {
@@ -51,8 +55,8 @@
5155
5256 // Cache tool definitions
5357 if (result.tools && Array.isArray(result.tools) && result.tools.length > 0) {
54- result.tools = result.tools.map((tool: any, index: number) => {
55- if (index === result.tools.length - 1 && availableCacheMessages > 0) {
58+ result.tools = result.tools.map((tool, index: number) => {
59+ if (index === result.tools!.length - 1 && availableCacheMessages > 0) {
5660 availableCacheMessages -= 1;
5761 return {
5862 ...tool,
@@ -73,7 +77,7 @@
7377
7478 // Always cache system messages
7579 if (result.system && Array.isArray(result.system)) {
76- result.system = result.system.map((item: any) => {
80+ result.system = result.system.map((item) => {
7781 if (availableCacheMessages > 0) {
7882 availableCacheMessages -= 1;
7983 return {
@@ -87,8 +91,8 @@
8791
8892 // Cache tool definitions
8993 if (result.tools && Array.isArray(result.tools) && result.tools.length > 0) {
90- result.tools = result.tools.map((tool: any, index: number) => {
91- if (index === result.tools.length - 1 && availableCacheMessages > 0) {
94+ result.tools = result.tools.map((tool, index: number) => {
95+ if (index === result.tools!.length - 1 && availableCacheMessages > 0) {
9296 availableCacheMessages -= 1;
9397 return {
9498 ...tool,
@@ -101,7 +105,7 @@
101105
102106 // Cache large messages (>500 tokens)
103107 if (result.messages && Array.isArray(result.messages)) {
104- result.messages = result.messages.map((message: any) => {
108+ result.messages = result.messages.map((message) => {
105109 if (message.content && typeof message.content === "string") {
106110 const tokens = estimateTokenCount(message.content);
107111 if (tokens > 500 && availableCacheMessages > 0) {
@@ -112,7 +116,7 @@
112116 {
113117 type: "text",
114118 text: message.content,
115- cache_control: { type: "ephemeral" },
119+ cache_control: { type: "ephemeral" as const },
116120 },
117121 ],
118122 };
@@ -120,7 +124,7 @@
120124 } else if (message.content && Array.isArray(message.content)) {
121125 // Only add one cache control per message with array content
122126 let addedCacheControl = false;
123- const updatedContent = message.content.map((item: any) => {
127+ const updatedContent = message.content.map((item) => {
124128 if (item.type === "text" && item.text) {
125129 const tokens = estimateTokenCount(item.text);
126130 if (
@@ -132,7 +136,7 @@
132136 addedCacheControl = true;
133137 return {
134138 ...item,
135- cache_control: { type: "ephemeral" },
139+ cache_control: { type: "ephemeral" as const },
136140 };
137141 }
138142 }
added packages/openai-adapters/src/apis/AnthropicUtils.ts +139 −0
@@ -0,0 +1,139 @@
1+import {
2+ Base64ImageSource,
3+ ErrorResponse,
4+ MessageParam,
5+ Tool,
6+ ToolChoice,
7+} from "@anthropic-ai/sdk/resources";
8+import {
9+ ChatCompletionTool,
10+ ChatCompletionToolChoiceOption,
11+} from "openai/resources";
12+
13+export function getAnthropicErrorMessage(response: ErrorResponse): string {
14+ switch (response.error.type) {
15+ case "api_error":
16+ return "An unexpected error has occurred internal to Anthropic's systems.";
17+ case "invalid_request_error":
18+ return "There was an issue with the format or content of your request.";
19+ case "authentication_error":
20+ return "There's an issue with your API key.";
21+ case "permission_error":
22+ return "Your API key does not have permission to use the specified resource.";
23+ case "not_found_error":
24+ return "The requested resource was not found.";
25+ case "rate_limit_error":
26+ return "Your account has hit a rate limit.";
27+ case "overloaded_error":
28+ return "Anthropic's API is temporarily overloaded. Please check their status page: https://status.anthropic.com/#past-incidents";
29+ case "timeout_error":
30+ return "Anthropic API timed out. Please check their status page: https://status.anthropic.com/#past-incidents";
31+ case "billing_error":
32+ default:
33+ return response.error.message;
34+ }
35+}
36+
37+export function getAnthropicHeaders(
38+ apiKey: string,
39+ enableCaching: boolean,
40+): Record<string, string> {
41+ const headers: Record<string, string> = {
42+ "Content-Type": "application/json",
43+ Accept: "application/json",
44+ "anthropic-version": "2023-06-01",
45+ "x-api-key": apiKey,
46+ };
47+
48+ if (enableCaching) {
49+ headers["anthropic-beta"] = "prompt-caching-2024-07-31";
50+ }
51+ return headers;
52+}
53+
54+export function addCacheControlToLastTwoUserMessages(messages: MessageParam[]) {
55+ let userMessages = 0;
56+ for (let i = messages.length - 1; i >= 0; i--) {
57+ const msg = messages[i];
58+ if (msg.role === "user") {
59+ userMessages++;
60+ if (typeof msg.content === "string") {
61+ continue;
62+ }
63+ for (let j = msg.content.length - 1; j >= 0; j--) {
64+ const part = msg.content[j];
65+ if (part.type === "text") {
66+ part.cache_control = { type: "ephemeral" };
67+ break;
68+ }
69+ }
70+ if (userMessages >= 2) {
71+ break;
72+ }
73+ }
74+ }
75+}
76+
77+export function openAiToolChoiceToAnthropicToolChoice(
78+ toolChoice: ChatCompletionToolChoiceOption | undefined,
79+): ToolChoice | undefined {
80+ if (!toolChoice) {
81+ return undefined;
82+ }
83+ switch (toolChoice) {
84+ case "none":
85+ // "none" is handled by excluding tools
86+ return undefined;
87+ case "required":
88+ return {
89+ type: "any",
90+ };
91+ case "auto":
92+ return {
93+ type: "auto",
94+ };
95+ default:
96+ switch (toolChoice.type) {
97+ case "allowed_tools":
98+ // Filtering of tools is handled elsewhere
99+ return {
100+ type: toolChoice.allowed_tools.mode === "auto" ? "auto" : "any",
101+ };
102+ case "custom":
103+ return undefined; // TODO not supported yet
104+ case "function":
105+ return {
106+ type: "tool",
107+ name: toolChoice.function.name,
108+ };
109+ }
110+ }
111+}
112+
113+export function openaiToolToAnthropicTool(tool: ChatCompletionTool): Tool {
114+ if (tool.type === "function" && "function" in tool) {
115+ return {
116+ name: tool.function.name,
117+ description: tool.function.description,
118+ input_schema: tool.function.parameters as Tool.InputSchema, // TODO unsafe cast, may be differences between openai tool schema and anthropic tool schema,
119+ };
120+ } else {
121+ throw new Error(`Unsupported tool type in Anthropic: ${tool.type}`);
122+ }
123+}
124+
125+// Extract media type from data URL (ex. "data:image/png;base64,..." -> "image/png")
126+export function getAnthropicMediaTypeFromDataUrl(
127+ dataUrl: string,
128+): Base64ImageSource["media_type"] {
129+ const match = dataUrl.match(/^data:([^;]+);base64,/);
130+ if (match) {
131+ switch (match[1]) {
132+ case "image/png":
133+ case "image/gif":
134+ case "image/webp":
135+ return match[1];
136+ }
137+ }
138+ return "image/jpeg";
139+}
modified packages/openai-adapters/src/apis/Bedrock.ts +1 −1
@@ -44,7 +44,7 @@
4444 function getSecureID(): string {
4545 // Adding a type declaration for the static property
4646 if (!(getSecureID as any).uuid) {
47- (getSecureID as any).uuid = crypto.randomUUID();
47+ (getSecureID as any).uuid = uuidv4();
4848 }
4949 return `<!-- SID: ${(getSecureID as any).uuid} -->`;
5050 }
added packages/openai-adapters/src/apis/CometAPI.ts +132 −0
@@ -0,0 +1,132 @@
1+import {
2+ ChatCompletion,
3+ ChatCompletionChunk,
4+ ChatCompletionCreateParams,
5+ ChatCompletionCreateParamsNonStreaming,
6+ ChatCompletionCreateParamsStreaming,
7+ Completion,
8+ CompletionCreateParamsNonStreaming,
9+ CompletionCreateParamsStreaming,
10+ CreateEmbeddingResponse,
11+ EmbeddingCreateParams,
12+ Model,
13+} from "openai/resources/index";
14+import { CometAPIConfig } from "../types.js";
15+import {
16+ BaseLlmApi,
17+ CreateRerankResponse,
18+ FimCreateParamsStreaming,
19+ RerankCreateParams,
20+} from "./base.js";
21+import { OpenAIApi } from "./OpenAI.js";
22+
23+/**
24+ * CometAPI adapter - extends OpenAI adapter since CometAPI is OpenAI-compatible
25+ *
26+ * CometAPI provides access to multiple LLM providers (GPT, Claude, Gemini, etc.)
27+ * through a unified OpenAI-compatible API interface.
28+ */
29+export class CometAPIApi extends OpenAIApi implements BaseLlmApi {
30+ // Store the original CometAPI config separately
31+ private cometConfig: CometAPIConfig;
32+
33+ constructor(config: CometAPIConfig) {
34+ // CometAPI uses OpenAI-compatible API, so we can reuse OpenAI adapter
35+ // Convert CometAPI config to OpenAI-compatible config for the base class
36+ const openAICompatibleConfig = {
37+ ...config,
38+ provider: "openai" as const,
39+ apiBase: config.apiBase ?? "https://api.cometapi.com/v1/",
40+ };
41+ super(openAICompatibleConfig);
42+
43+ // Store original config after super() call
44+ this.cometConfig = config;
45+ }
46+
47+ /**
48+ * Override list method to handle CometAPI-specific model filtering
49+ * The core filtering logic is handled in the CometAPI provider class
50+ */
51+ async list(): Promise<Model[]> {
52+ try {
53+ return await super.list();
54+ } catch (error) {
55+ // Fallback to empty list if model listing fails
56+ console.warn("CometAPI: Failed to fetch model list", error);
57+ return [];
58+ }
59+ }
60+
61+ /**
62+ * Chat completion - uses OpenAI-compatible format
63+ */
64+ async chatCompletionNonStream(
65+ body: ChatCompletionCreateParamsNonStreaming,
66+ signal: AbortSignal,
67+ ): Promise<ChatCompletion> {
68+ return super.chatCompletionNonStream(body, signal);
69+ }
70+
71+ /**
72+ * Streaming chat completion - uses OpenAI-compatible format
73+ */
74+ async *chatCompletionStream(
75+ body: ChatCompletionCreateParamsStreaming,
76+ signal: AbortSignal,
77+ ): AsyncGenerator<ChatCompletionChunk> {
78+ yield* super.chatCompletionStream(body, signal);
79+ }
80+
81+ /**
82+ * Legacy completion endpoint support
83+ */
84+ completionNonStream(
85+ body: CompletionCreateParamsNonStreaming,
86+ signal: AbortSignal,
87+ ): Promise<Completion> {
88+ return super.completionNonStream(body, signal);
89+ }
90+
91+ /**
92+ * Legacy streaming completion endpoint support
93+ */
94+ completionStream(
95+ body: CompletionCreateParamsStreaming,
96+ signal: AbortSignal,
97+ ): AsyncGenerator<Completion> {
98+ return super.completionStream(body, signal);
99+ }
100+
101+ /**
102+ * Fill-in-the-middle completion support
103+ */
104+ fimStream(
105+ body: FimCreateParamsStreaming,
106+ signal: AbortSignal,
107+ ): AsyncGenerator<ChatCompletionChunk> {
108+ return super.fimStream(body, signal);
109+ }
110+
111+ /**
112+ * Embeddings support (if available through CometAPI)
113+ */
114+ async embed(body: EmbeddingCreateParams): Promise<CreateEmbeddingResponse> {
115+ try {
116+ return await super.embed(body);
117+ } catch (error) {
118+ throw new Error(`CometAPI embeddings not supported: ${error}`);
119+ }
120+ }
121+
122+ /**
123+ * Reranking support (if available through CometAPI)
124+ */
125+ async rerank(body: RerankCreateParams): Promise<CreateRerankResponse> {
126+ try {
127+ return await super.rerank(body);
128+ } catch (error) {
129+ throw new Error(`CometAPI reranking not supported: ${error}`);
130+ }
131+ }
132+}
modified packages/openai-adapters/src/index.ts +10 −0
@@ -18,6 +18,7 @@
1818 import { WatsonXApi } from "./apis/WatsonX.js";
1919 import { BaseLlmApi } from "./apis/base.js";
2020 import { LLMConfig, OpenAIConfigSchema } from "./types.js";
21+import { CometAPIApi } from "./apis/CometAPI.js";
2122 import { appendPathToUrlIfNotPresent } from "./util/appendPathToUrl.js";
2223
2324 dotenv.config();
@@ -69,6 +70,8 @@
6970 return new BedrockApi(config);
7071 case "cohere":
7172 return new CohereApi(config);
73+ case "cometapi":
74+ return new CometAPIApi(config);
7275 case "anthropic":
7376 return new AnthropicApi(config);
7477 case "gemini":
@@ -177,3 +180,10 @@
177180 // export
178181 export type { BaseLlmApi } from "./apis/base.js";
179182 export type { LLMConfig } from "./types.js";
183+
184+export {
185+ addCacheControlToLastTwoUserMessages,
186+ getAnthropicErrorMessage,
187+ getAnthropicHeaders,
188+ getAnthropicMediaTypeFromDataUrl,
189+} from "./apis/AnthropicUtils.js";
modified packages/openai-adapters/src/test/anthropic-adapter.vitest.ts +33 −3
@@ -50,7 +50,17 @@
5050 "x-api-key": "test-api-key",
5151 },
5252 body: {
53- messages: [{ role: "user", content: "hello" }],
53+ messages: [
54+ {
55+ role: "user",
56+ content: [
57+ {
58+ type: "text",
59+ text: "hello",
60+ },
61+ ],
62+ },
63+ ],
5464 system: undefined,
5565 model: "claude-3-5-sonnet-20241022",
5666 max_tokens: 32000,
@@ -104,7 +114,17 @@
104114 "x-api-key": "test-api-key",
105115 },
106116 body: {
107- messages: [{ role: "user", content: "hello" }],
117+ messages: [
118+ {
119+ role: "user",
120+ content: [
121+ {
122+ type: "text",
123+ text: "hello",
124+ },
125+ ],
126+ },
127+ ],
108128 system: undefined,
109129 model: "claude-3-5-sonnet-20241022",
110130 max_tokens: 32000,
@@ -159,7 +179,17 @@
159179 "x-api-key": "test-api-key",
160180 },
161181 body: {
162- messages: [{ role: "user", content: "hello" }],
182+ messages: [
183+ {
184+ role: "user",
185+ content: [
186+ {
187+ type: "text",
188+ text: "hello",
189+ },
190+ ],
191+ },
192+ ],
163193 system: [
164194 {
165195 type: "text",
modified packages/openai-adapters/src/types.ts +6 −0
@@ -116,6 +116,11 @@
116116 });
117117 export type CohereConfig = z.infer<typeof CohereConfigSchema>;
118118
119+export const CometAPIConfigSchema = OpenAIConfigSchema.extend({
120+ provider: z.literal("cometapi"),
121+});
122+export type CometAPIConfig = z.infer<typeof CometAPIConfigSchema>;
123+
119124 export const AzureConfigSchema = OpenAIConfigSchema.extend({
120125 provider: z.literal("azure"),
121126 env: z
@@ -197,5 +202,6 @@
197202 VertexAIConfigSchema,
198203 LlamastackConfigSchema,
199204 ContinueProxyConfigSchema,
205+ CometAPIConfigSchema,
200206 ]);
201207 export type LLMConfig = z.infer<typeof LLMConfigSchema>;