Merge branch 'main' of https://github.com/continuedev/continue into uinstinct/cli-danger-command

This commit is contained in:
Dallin Romney 2025-09-25 16:54:03 -07:00
commit affc0cba09
101 changed files with 4949 additions and 1349 deletions

View file

@ -0,0 +1,3 @@
{
"install": "npm i"
}

View file

@ -1,11 +1,17 @@
name: Release @continuedev/llm-info
on:
push:
branches:
- main
paths:
- "packages/llm-info/**"
- ".github/workflows/release-llm-info.yml"
- ".github/workflows/reusable-release.yml"
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release:
@ -16,14 +22,3 @@ jobs:
secrets:
SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }}
AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}

View file

@ -1,302 +0,0 @@
name: Respond to @continuedev Comments
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
permissions:
contents: write
pull-requests: write
issues: write
jobs:
respond-to-comment:
# Only run on pull request comments
if: github.event_name == 'issue_comment' && github.event.issue.pull_request
runs-on: ubuntu-latest
steps:
- name: Check if comment contains @continuedev
id: check-mention
run: |
# Create a temporary file to safely handle comment body with special characters
cat > /tmp/comment.txt << 'COMMENT_EOF'
${{ github.event.comment.body }}
COMMENT_EOF
if grep -q "@continuedev" /tmp/comment.txt; then
echo "contains_mention=true" >> $GITHUB_OUTPUT
else
echo "contains_mention=false" >> $GITHUB_OUTPUT
fi
- name: Add eyes reaction to comment
if: steps.check-mention.outputs.contains_mention == 'true'
uses: actions/github-script@v8
with:
script: |
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ github.event.comment.id }},
content: 'eyes'
});
- name: Checkout PR branch
if: steps.check-mention.outputs.contains_mention == 'true'
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Get PR information
if: steps.check-mention.outputs.contains_mention == 'true'
id: pr-info
uses: actions/github-script@v8
with:
script: |
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
core.setOutput('head_ref', pr.head.ref);
core.setOutput('head_sha', pr.head.sha);
return pr;
- name: Checkout PR branch
if: steps.check-mention.outputs.contains_mention == 'true'
run: |
git checkout ${{ steps.pr-info.outputs.head_ref }}
- name: Setup Node.js
if: steps.check-mention.outputs.contains_mention == 'true'
uses: actions/setup-node@v5
with:
node-version: "20"
- name: Install Continue CLI globally
if: steps.check-mention.outputs.contains_mention == 'true'
run: npm i -g @continuedev/cli
- name: Start remote session
if: steps.check-mention.outputs.contains_mention == 'true'
id: remote-session
env:
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
run: |
# Create a temporary file for the prompt to handle special characters and newlines properly
cat > /tmp/prompt.txt << 'PROMPT_EOF'
Please help with the following request from @${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}:
${{ github.event.comment.body }}
Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch.
PROMPT_EOF
# Debug output
echo "PROMPT content:"
cat /tmp/prompt.txt
# Start remote session and capture JSON output
echo "Starting cn with prompt..."
SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ steps.pr-info.outputs.head_ref }})
echo "Raw session output: $SESSION_OUTPUT"
# Extract URL from JSON output
SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
echo "Failed to extract session URL from output: $SESSION_OUTPUT"
exit 1
fi
echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
echo "✅ Started remote session: $SESSION_URL"
- name: Comment with session URL
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
uses: actions/github-script@v8
env:
ORIGINAL_COMMENT: ${{ github.event.comment.body }}
with:
script: |
const sessionUrl = '${{ steps.remote-session.outputs.session_url }}';
const originalComment = process.env.ORIGINAL_COMMENT;
const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
- name: Log session details
if: steps.check-mention.outputs.contains_mention == 'true'
run: |
echo "✅ Successfully started remote session for comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}"
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
echo "Original comment:"
cat /tmp/comment.txt
respond-to-review-comment:
# Only run on pull request review comments
if: github.event_name == 'pull_request_review_comment'
runs-on: ubuntu-latest
steps:
- name: Check if comment contains @continuedev
id: check-mention
run: |
# Create a temporary file to safely handle comment body with special characters
cat > /tmp/review_comment.txt << 'COMMENT_EOF'
${{ github.event.comment.body }}
COMMENT_EOF
if grep -q "@continuedev" /tmp/review_comment.txt; then
echo "contains_mention=true" >> $GITHUB_OUTPUT
else
echo "contains_mention=false" >> $GITHUB_OUTPUT
fi
- name: Add eyes reaction to comment
if: steps.check-mention.outputs.contains_mention == 'true'
uses: actions/github-script@v8
with:
script: |
await github.rest.reactions.createForPullRequestReviewComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ github.event.comment.id }},
content: 'eyes'
});
- name: Checkout PR branch
if: steps.check-mention.outputs.contains_mention == 'true'
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Node.js
if: steps.check-mention.outputs.contains_mention == 'true'
uses: actions/setup-node@v5
with:
node-version: "20"
- name: Install Continue CLI globally
if: steps.check-mention.outputs.contains_mention == 'true'
run: npm i -g @continuedev/cli
- name: Get review context
if: steps.check-mention.outputs.contains_mention == 'true'
id: review-context
uses: actions/github-script@v8
with:
script: |
let reviewContext = '';
// Check if this comment is a reply to another review comment
if (context.payload.comment.in_reply_to_id) {
try {
const { data: originalComment } = await github.rest.pulls.getReviewComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.in_reply_to_id
});
reviewContext = `**Original review comment by @${originalComment.user.login}:**
${originalComment.body}
**Reply by @${{ github.event.comment.user.login }}:**
${{ github.event.comment.body }}`;
} catch (error) {
console.log('Could not fetch original comment, using current comment only');
reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
${{ github.event.comment.body }}`;
}
} else {
reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
${{ github.event.comment.body }}`;
}
core.setOutput('context', reviewContext);
- name: Start remote session
if: steps.check-mention.outputs.contains_mention == 'true'
id: remote-session
env:
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
run: |
# Debug: Echo the branch we're starting the session on
echo "Starting remote session on branch: ${{ github.event.pull_request.head.ref }}"
# Create a temporary file for the prompt to handle special characters and newlines properly
cat > /tmp/prompt.txt << 'PROMPT_EOF'
Please help with the following code review discussion from PR #${{ github.event.pull_request.number }}:
**File:** ${{ github.event.comment.path }}
**Line:** ${{ github.event.comment.line || github.event.comment.original_line || 'N/A' }}
${{ steps.review-context.outputs.context }}
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.
PROMPT_EOF
# Debug output
echo "PROMPT content:"
cat /tmp/prompt.txt
# Start remote session and capture JSON output
echo "Starting cn with prompt..."
SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ github.event.pull_request.head.ref }})
echo "Raw session output: $SESSION_OUTPUT"
# Extract URL from JSON output
SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
echo "Failed to extract session URL from output: $SESSION_OUTPUT"
exit 1
fi
echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
echo "✅ Started remote session: $SESSION_URL"
- name: Comment with session URL
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
uses: actions/github-script@v8
env:
ORIGINAL_COMMENT: ${{ github.event.comment.body }}
with:
script: |
const sessionUrl = '${{ steps.remote-session.outputs.session_url }}';
const originalComment = process.env.ORIGINAL_COMMENT;
const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment;
const commentParams = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.pull_request.number }},
body: commentBody,
commit_id: '${{ github.event.pull_request.head.sha }}',
path: '${{ github.event.comment.path }}',
in_reply_to: ${{ github.event.comment.id }}
};
await github.rest.pulls.createReviewComment(commentParams);
- name: Log session details
if: steps.check-mention.outputs.contains_mention == 'true'
run: |
echo "✅ Successfully started remote session for review comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}"
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
echo "File: ${{ github.event.comment.path }}"
echo "Line: ${{ github.event.comment.line }}"
echo "Original comment:"
cat /tmp/review_comment.txt

5
.gitignore vendored
View file

@ -172,4 +172,7 @@ extensions/.continue-debug/
.continuerules
**/.continue/assistants/
**/.continue/agents/
keys
keys
.channels_cache.json
.users_cache.json

1
.husky/pre-commit Normal file
View file

@ -0,0 +1 @@
npx lint-staged

View file

@ -11,9 +11,13 @@ extensions/vscode/.vscode-test
extensions/vscode/bin
extensions/vscode/build
extensions/vscode/out
extensions/vscode/textmate-syntaxes
extensions/vscode/gui
extensions/vscode/e2e/.test-extensions
extensions/vscode/e2e/test-continue
extensions/vscode/e2e/_output
extensions/vscode/e2e/storage
extensions/vscode/e2e/vsix
extensions/vscode/models
extensions/intellij/src/main/resources
gui/dist
@ -26,4 +30,5 @@ CHANGELOG.md
core/vendor
coverage
# e2e
packages/continue-sdk
packages/continue-sdk
.conductor

View file

@ -252,7 +252,7 @@ add it with the following steps:
3. If your provider supports images, add it to the `PROVIDER_SUPPORTS_IMAGES` array
in [core/llm/autodetect.ts](./core/llm/autodetect.ts).
4. Add a documentation page for your provider in [
`docs/docs/customize/model-providers/more`](./docs/docs/customize/model-providers/more). This should show an example
`docs/customize/model-providers/more`](./docs/customize/model-providers/more). This should show an example
of configuring your provider in `config.yaml` and explain what options are available.
### Adding Models

View file

@ -4,6 +4,15 @@ import {
} from "@continuedev/config-yaml";
import { joinPathsToUri } from "../../util/uri";
function createRelativeRuleFilePathParts(ruleName: string): string[] {
const safeRuleName = sanitizeRuleName(ruleName);
return [".continue", "rules", `${safeRuleName}.${RULE_FILE_EXTENSION}`];
}
export function createRelativeRuleFilePath(ruleName: string): string {
return createRelativeRuleFilePathParts(ruleName).join("/");
}
/**
* Creates the file path for a rule in the workspace .continue/rules directory
*/
@ -11,11 +20,8 @@ export function createRuleFilePath(
workspaceDir: string,
ruleName: string,
): string {
const safeRuleName = sanitizeRuleName(ruleName);
return joinPathsToUri(
workspaceDir,
".continue",
"rules",
`${safeRuleName}.${RULE_FILE_EXTENSION}`,
...createRelativeRuleFilePathParts(ruleName),
);
}

View file

@ -85,6 +85,7 @@ class MCPConnection {
}
async disconnect() {
this.status = "not-connected";
this.abortController.abort();
await this.client.close();
await this.transport.close();

View file

@ -13,6 +13,7 @@ export class MCPManagerSingleton {
public onConnectionsRefreshed?: () => void;
public connections: Map<string, MCPConnection> = new Map();
private disconnectedServers: string[] = [];
private abortController: AbortController = new AbortController();
@ -25,6 +26,18 @@ export class MCPManagerSingleton {
return MCPManagerSingleton.instance;
}
addDisconnectedServer(serverId: string) {
this.disconnectedServers.push(serverId);
}
removeDisconnectedServer(serverId: string) {
this.disconnectedServers = this.disconnectedServers.filter(
(server) => server !== serverId,
);
}
getDisconnectedServers() {
return this.disconnectedServers;
}
createConnection(id: string, options: MCPOptions): MCPConnection {
if (this.connections.has(id)) {
return this.connections.get(id)!;
@ -163,9 +176,19 @@ export class MCPManagerSingleton {
}),
(async () => {
await Promise.all(
Array.from(this.connections.values()).map(async (connection) => {
await connection.connectClient(force, this.abortController.signal);
}),
Array.from(this.connections.values())
.filter(
(connection) =>
!this.disconnectedServers.some(
(s) => s === connection.options.id,
),
)
.map(async (connection) => {
await connection.connectClient(
force,
this.abortController.signal,
);
}),
);
if (this.onConnectionsRefreshed) {
this.onConnectionsRefreshed();

View file

@ -12,7 +12,7 @@ import { IDE, MCPServerStatus, SSEOptions } from "../..";
import http from "http";
import url from "url";
import crypto from "crypto";
import { v4 as uuidv4 } from "uuid";
import { GlobalContext, GlobalContextType } from "../../util/GlobalContext";
// Use a Map to support concurrent authentications for different servers
@ -249,7 +249,7 @@ export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) {
await authProvider.ensureRedirectUrl();
// Generate a unique state parameter for this auth flow
const state = crypto.randomUUID();
const state = uuidv4();
// Store context for this specific server with state
authenticatingContexts.set(mcpServerUrl, {

View file

@ -492,6 +492,20 @@ export class Core {
on("mcp/reloadServer", async (msg) => {
await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id);
MCPManagerSingleton.getInstance().removeDisconnectedServer(msg.data.id);
});
on("mcp/disconnectServer", async (msg) => {
const mcpConnection = MCPManagerSingleton.getInstance().getConnection(
msg.data.id,
);
if (!mcpConnection)
throw new Error(`MCP connection with id ${msg.data.id} not found`);
MCPManagerSingleton.getInstance().addDisconnectedServer(msg.data.id);
await mcpConnection.disconnect();
await this.configHandler.refreshAll("MCP Servers disconnected");
});
on("mcp/getDisconnectedServers", async (_msg) => {
return MCPManagerSingleton.getInstance().getDisconnectedServers();
});
on("mcp/getPrompt", async (msg) => {
const { serverName, promptName, args } = msg.data;

View file

@ -2,6 +2,7 @@ const DEFAULT_MAX_TOKENS = 4096;
const DEFAULT_CONTEXT_LENGTH = 32_768;
const DEFAULT_TEMPERATURE = 0.5;
const DEFAULT_PRUNING_LENGTH = 128000;
const DEFAULT_REASONING_TOKENS = 2048;
const DEFAULT_ARGS = {
maxTokens: DEFAULT_MAX_TOKENS,
@ -31,5 +32,6 @@ export {
DEFAULT_MAX_CHUNK_SIZE,
DEFAULT_MAX_TOKENS,
DEFAULT_PRUNING_LENGTH,
DEFAULT_REASONING_TOKENS,
PROXY_URL,
};

View file

@ -65,7 +65,6 @@ import {
toCompleteBody,
toFimBody,
} from "./openaiTypeConverters.js";
export class LLMError extends Error {
constructor(
message: string,
@ -214,7 +213,7 @@ export abstract class BaseLLM implements ILLM {
this.providerName === "continue-proxy"
? this.model?.split("/").pop() || this.model
: this.model;
const llmInfo = findLlmInfo(modelSearchString);
const llmInfo = findLlmInfo(modelSearchString, this.underlyingProviderName);
const templateType =
options.template ?? autodetectTemplateType(options.model);
@ -558,12 +557,14 @@ export abstract class BaseLLM implements ILLM {
private _formatChatMessage(msg: ChatMessage): string {
let contentToShow = renderChatMessage(msg);
if (msg.role === "assistant" && msg.toolCalls?.length) {
contentToShow += msg.toolCalls
?.map(
(toolCall) =>
`${toolCall.function?.name}(${toolCall.function?.arguments})`,
)
.join("\n");
contentToShow +=
"\n" +
msg.toolCalls
?.map(
(toolCall) =>
`${toolCall.function?.name}(${toolCall.function?.arguments})`,
)
.join("\n");
}
return `<${msg.role}>\n${contentToShow}\n\n`;

View file

@ -58,6 +58,10 @@ const messagesWithInvalidToolCallArgs: ChatMessage[] = [
describe("LLM Pre-fetch", () => {
beforeEach(() => {
vi.resetAllMocks();
// Mock getAnthropicHeaders to return fake headers
vi.mocked(openAiAdapters.getAnthropicHeaders).mockReturnValue({
fake: "headers",
});
// Log to verify the mock is properly set up
console.log("Mock setup:", openAiAdapters);
});

View file

@ -1,30 +1,36 @@
import {
Tool as AnthropicTool,
ContentBlockParam,
MessageCreateParams,
MessageParam,
RawContentBlockDeltaEvent,
RawContentBlockStartEvent,
RawMessageDeltaEvent,
RawMessageStartEvent,
RawMessageStreamEvent,
ToolUseBlock,
} from "@anthropic-ai/sdk/resources/messages.mjs";
import { streamSse } from "@continuedev/fetch";
import {
addCacheControlToLastTwoUserMessages,
getAnthropicErrorMessage,
getAnthropicHeaders,
getAnthropicMediaTypeFromDataUrl,
} from "@continuedev/openai-adapters";
import {
ChatMessage,
CompletionOptions,
LLMOptions,
MessageContent,
Tool,
ToolCallDelta,
Usage,
} from "../../index.js";
import { safeParseToolCallArgs } from "../../tools/parseArgs.js";
import { renderChatMessage, stripImages } from "../../util/messageContent.js";
import { DEFAULT_REASONING_TOKENS } from "../constants.js";
import { BaseLLM } from "../index.js";
const errorMessages = {
invalid_request_error:
"There was an issue with the format or content of your request.",
authentication_error: "There's an issue with your API key.",
permission_error:
"Your API key does not have permission to use the specified resource.",
not_found_error: "The requested resource was not found.",
request_too_large:
"Request exceeds the maximum allowed number of bytes (32 MB limit).",
rate_limit_error: "Your account has hit a rate limit.",
api_error:
"An unexpected error has occurred internal to Anthropic's systems.",
overloaded_error:
"Anthropic's API is temporarily overloaded. Please check their status page: https://status.anthropic.com/#past-incidents",
};
class Anthropic extends BaseLLM {
static providerName = "anthropic";
static defaultOptions: Partial<LLMOptions> = {
@ -36,8 +42,21 @@ class Anthropic extends BaseLLM {
apiBase: "https://api.anthropic.com/v1/",
};
public convertArgs(options: CompletionOptions) {
// should be public for use within VertexAI
private convertToolToAnthropicTool(tool: Tool): AnthropicTool {
return {
name: tool.function.name,
description: tool.function.description,
input_schema: (tool.function.parameters as AnthropicTool.InputSchema) ?? {
// TODO unsafe tool.function.parameters casting
type: "object",
},
};
}
// Public for use within VertexAI
public convertArgs(
options: CompletionOptions,
): Omit<MessageCreateParams, "messages"> {
const finalOptions = {
top_k: options.topK,
top_p: options.topP,
@ -46,20 +65,17 @@ class Anthropic extends BaseLLM {
model: options.model === "claude-2" ? "claude-2.1" : options.model,
stop_sequences: options.stop?.filter((x) => x.trim() !== ""),
stream: options.stream ?? true,
tools: options.tools?.map((tool) => ({
name: tool.function.name,
description: tool.function.description,
input_schema: tool.function.parameters,
})),
tools: options.tools?.map(this.convertToolToAnthropicTool),
thinking: options.reasoning
? {
type: "enabled",
budget_tokens: options.reasoningBudgetTokens,
type: "enabled" as const,
budget_tokens:
options.reasoningBudgetTokens ?? DEFAULT_REASONING_TOKENS,
}
: undefined,
tool_choice: options.toolChoice
? {
type: "tool",
type: "tool" as const,
name: options.toolChoice.function.name,
}
: undefined,
@ -68,138 +84,146 @@ class Anthropic extends BaseLLM {
return finalOptions;
}
private buildTextPart(text: string, addCaching: boolean) {
const part: any = {
type: "text",
text,
};
if (addCaching) {
part.cache_control = { type: "ephemeral" };
private convertMessageContentToBlocks(
content: MessageContent,
): ContentBlockParam[] {
if (typeof content === "string") {
return [
{
type: "text",
text: content,
},
];
}
return part;
return content.map((part) => {
if (part.type === "text") {
return {
type: "text",
text: part.text,
};
}
return {
type: "image",
source: {
type: "base64",
media_type: getAnthropicMediaTypeFromDataUrl(part.imageUrl.url),
data: part.imageUrl.url.split(",")[1],
},
};
});
}
private convertMessage(message: ChatMessage, addCaching: boolean): any {
if (message.role === "tool") {
private convertToolCallsToBlocks(
toolCall: ToolCallDelta,
): ToolUseBlock | undefined {
const toolCallId = toolCall.id;
const toolName = toolCall.function?.name;
if (toolCallId && toolName) {
return {
role: "user",
content: [
type: "tool_use",
id: toolCallId,
name: toolName,
input: safeParseToolCallArgs(toolCall),
};
}
}
private getContentBlocksFromChatMessage(
message: ChatMessage,
): ContentBlockParam[] {
switch (message.role) {
// One tool message = one tool_result block
case "tool":
return [
{
type: "tool_result",
tool_use_id: message.toolCallId,
content: renderChatMessage(message) || undefined,
},
],
};
} else if (message.role === "assistant" && message.toolCalls) {
const parts: any[] = [];
if (message.content) {
];
case "user":
return this.convertMessageContentToBlocks(message.content);
case "thinking":
if (message.redactedThinking) {
return [
{
type: "redacted_thinking",
data: message.redactedThinking,
},
];
}
if (typeof message.content === "string") {
parts.push(this.buildTextPart(message.content, addCaching));
} else if (message.content.length > 0) {
const textContent = message.content.filter((p) => p.type === "text");
const textParts = textContent.map((part, idx) => {
const cache = idx === textContent.length - 1 && addCaching;
return this.buildTextPart(part.text, cache);
});
parts.push(...textParts);
return [
{
type: "thinking",
thinking: message.content,
signature: message.signature ?? "", // TODO - unsafe signature
},
];
}
}
parts.push(
...message.toolCalls.map((toolCall) => ({
type: "tool_use",
id: toolCall.id,
name: toolCall.function?.name,
input: safeParseToolCallArgs(toolCall),
})),
);
return {
role: "assistant",
content: parts,
};
} else if (message.role === "thinking" && !message.redactedThinking) {
return {
role: "assistant",
content: [
{
type: "thinking",
thinking: message.content,
signature: message.signature,
},
],
};
} else if (message.role === "thinking" && message.redactedThinking) {
return {
role: "assistant",
content: [
{
type: "redacted_thinking",
data: message.redactedThinking,
},
],
};
}
if (typeof message.content === "string") {
var chatMessage = {
role: message.role,
content: [
{
type: "text",
text: message.content,
...(addCaching ? { cache_control: { type: "ephemeral" } } : {}),
},
],
};
return chatMessage;
}
return {
role: message.role,
content: message.content.map((part, contentIdx) => {
if (part.type === "text") {
const newpart = {
...part,
// If multiple text parts, only add cache_control to the last one
...(addCaching && contentIdx === message.content.length - 1
? { cache_control: { type: "ephemeral" } }
: {}),
};
return newpart;
const textParts = message.content.filter((p) => p.type === "text");
return textParts.map((part) => ({
type: "thinking",
thinking: part.text,
signature: message.signature ?? "", // TODO - unsafe signature
}));
case "assistant":
const blocks: ContentBlockParam[] = this.convertMessageContentToBlocks(
message.content,
);
// If any tool calls are present, always put them last
// Loses order vs what was originally sent, but they typically come last
for (const toolCall of message.toolCalls ?? []) {
const block = this.convertToolCallsToBlocks(toolCall);
if (block) {
blocks.push(block);
}
}
return {
type: "image",
source: {
type: "base64",
media_type: "image/jpeg",
data: part.imageUrl?.url.split(",")[1],
},
};
}),
};
return blocks;
// system, etc.
default:
return [];
}
}
public convertMessages(msgs: ChatMessage[]): any[] {
// should be public for use within VertexAI
const filteredmessages = msgs.filter((m) => m.role !== "system");
const lastTwoUserMsgIndices = filteredmessages
.map((msg, index) => (msg.role === "user" ? index : -1))
.filter((index) => index !== -1)
.slice(-2);
public convertMessages(
msgs: ChatMessage[],
cachePrompt: boolean,
): MessageParam[] {
const nonSystemMessages = msgs.filter((m) => m.role !== "system");
const messages = filteredmessages.map((message, filteredMsgIdx) => {
// Add cache_control parameter to the last two user messages
// The second-to-last because it retrieves potentially already cached contents,
// The last one because we want it cached for later retrieval.
// See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
const addCaching =
this.cacheBehavior?.cacheConversation &&
lastTwoUserMsgIndices.includes(filteredMsgIdx);
const convertedMessages: MessageParam[] = [];
let currentRole: "user" | "assistant" | undefined = undefined;
let currentParts: ContentBlockParam[] = [];
const chatMessage = this.convertMessage(message, !!addCaching);
return chatMessage;
});
return messages;
const flushCurrentMessage = () => {
if (currentRole && currentParts.length > 0) {
convertedMessages.push({
role: currentRole,
content: currentParts,
});
currentParts = [];
}
};
for (const message of nonSystemMessages) {
const newRole =
message.role === "user" || message.role === "tool"
? "user"
: "assistant";
if (currentRole !== newRole) {
flushCurrentMessage();
currentRole = newRole;
}
currentParts.push(...this.getContentBlocksFromChatMessage(message));
}
flushCurrentMessage();
if (cachePrompt) {
addCacheControlToLastTwoUserMessages(convertedMessages);
}
return convertedMessages;
}
protected async *_streamComplete(
@ -224,12 +248,7 @@ class Anthropic extends BaseLLM {
if (!response.ok) {
const json = await response.json();
if (json.type === "error") {
if (json.error?.type in errorMessages) {
throw new Error(
errorMessages[json.error.type as keyof typeof errorMessages],
);
}
throw new Error(json.message);
throw new Error(getAnthropicErrorMessage(json));
}
throw new Error(
`Anthropic API sent back ${response.status}: ${JSON.stringify(json)}`,
@ -237,17 +256,17 @@ class Anthropic extends BaseLLM {
}
if (stream === false) {
const data = await response.json();
const cost = data.usage
const json = await response.json();
const cost = json.usage
? {
inputTokens: data.usage.input_tokens,
outputTokens: data.usage.output_tokens,
totalTokens: data.usage.input_tokens + data.usage.output_tokens,
inputTokens: json.usage.input_tokens,
outputTokens: json.usage.output_tokens,
totalTokens: json.usage.input_tokens + json.usage.output_tokens,
}
: {};
yield {
role: "assistant",
content: data.content[0].text,
content: json.content[0].text,
...(Object.keys(cost).length > 0 ? { cost } : {}),
};
return;
@ -264,51 +283,59 @@ class Anthropic extends BaseLLM {
},
};
for await (const value of streamSse(response)) {
for await (const event of streamSse(response)) {
// https://docs.anthropic.com/en/api/messages-streaming#event-types
switch (value.type) {
const rawEvent = event as RawMessageStreamEvent;
switch (event.type) {
case "message_start":
// Capture initial usage information
usage.promptTokens = value.message.usage.input_tokens;
const startEvent = rawEvent as RawMessageStartEvent;
usage.promptTokens = startEvent.message.usage.input_tokens;
usage.promptTokensDetails!.cachedTokens =
value.message.usage.cache_read_input_tokens;
startEvent.message.usage.cache_read_input_tokens ?? undefined;
usage.promptTokensDetails!.cacheWriteTokens =
value.message.usage.cache_creation_input_tokens;
startEvent.message.usage.cache_creation_input_tokens ?? undefined;
break;
case "message_delta":
// Update usage information during streaming
if (value.usage) {
usage.completionTokens = value.usage.output_tokens;
const deltaEvent = rawEvent as RawMessageDeltaEvent;
if (deltaEvent.usage) {
usage.completionTokens = deltaEvent.usage.output_tokens;
}
break;
case "content_block_start":
if (value.content_block.type === "tool_use") {
lastToolUseId = value.content_block.id;
lastToolUseName = value.content_block.name;
const blockStartEvent = rawEvent as RawContentBlockStartEvent;
if (blockStartEvent.content_block.type === "tool_use") {
lastToolUseId = blockStartEvent.content_block.id;
lastToolUseName = blockStartEvent.content_block.name;
}
// handle redacted thinking
if (value.content_block.type === "redacted_thinking") {
if (blockStartEvent.content_block.type === "redacted_thinking") {
yield {
role: "thinking",
content: "",
redactedThinking: value.content_block.data,
redactedThinking: blockStartEvent.content_block.data,
};
}
break;
case "content_block_delta":
// https://docs.anthropic.com/en/api/messages-streaming#delta-types
switch (value.delta.type) {
const blockDeltaEvent = rawEvent as RawContentBlockDeltaEvent;
switch (blockDeltaEvent.delta.type) {
case "text_delta":
yield { role: "assistant", content: value.delta.text };
yield { role: "assistant", content: blockDeltaEvent.delta.text };
break;
case "thinking_delta":
yield { role: "thinking", content: value.delta.thinking };
yield {
role: "thinking",
content: blockDeltaEvent.delta.thinking,
};
break;
case "signature_delta":
yield {
role: "thinking",
content: "",
signature: value.delta.signature,
signature: blockDeltaEvent.delta.signature,
};
break;
case "input_json_delta":
@ -324,7 +351,7 @@ class Anthropic extends BaseLLM {
type: "function",
function: {
name: lastToolUseName,
arguments: value.delta.partial_json,
arguments: blockDeltaEvent.delta.partial_json,
},
},
],
@ -365,32 +392,35 @@ class Anthropic extends BaseLLM {
const shouldCacheSystemMessage = !!(
this.cacheBehavior?.cacheSystemMessage && systemMessage
);
const shouldCachePrompt = !!(
this.cacheBehavior?.cacheConversation ||
this.completionOptions.promptCaching
);
const msgs = this.convertMessages(messages, shouldCachePrompt);
const headers = getAnthropicHeaders(
this.apiKey,
shouldCacheSystemMessage || shouldCachePrompt,
);
const body: MessageCreateParams = {
...this.convertArgs(options),
messages: msgs,
system: shouldCacheSystemMessage
? [
{
type: "text",
text: systemMessage,
cache_control: { type: "ephemeral" },
},
]
: systemMessage,
};
const msgs = this.convertMessages(messages);
const response = await this.fetch(new URL("messages", this.apiBase), {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"anthropic-version": "2023-06-01",
"x-api-key": this.apiKey as string,
...(shouldCacheSystemMessage || this.cacheBehavior?.cacheConversation
? { "anthropic-beta": "prompt-caching-2024-07-31" }
: {}),
},
body: JSON.stringify({
...this.convertArgs(options),
messages: msgs,
system: shouldCacheSystemMessage
? [
{
type: "text",
text: systemMessage,
cache_control: { type: "ephemeral" },
},
]
: systemMessage,
}),
headers,
body: JSON.stringify(body),
signal,
});

358
core/llm/llms/CometAPI.ts Normal file
View file

@ -0,0 +1,358 @@
import { LLMOptions } from "../../index.js";
import { allModelProviders } from "@continuedev/llm-info";
import OpenAI from "./OpenAI.js";
/**
* CometAPI-specific error types for better error handling
*/
export class CometAPIError extends Error {
constructor(
message: string,
public code?: string,
public statusCode?: number,
) {
super(message);
this.name = "CometAPIError";
}
}
export class CometAPIAuthenticationError extends CometAPIError {
constructor(message: string = "Invalid CometAPI API key") {
super(message, "AUTHENTICATION_ERROR", 401);
this.name = "CometAPIAuthenticationError";
}
}
export class CometAPIQuotaExceededError extends CometAPIError {
constructor(message: string = "CometAPI quota exceeded") {
super(message, "QUOTA_EXCEEDED", 429);
this.name = "CometAPIQuotaExceededError";
}
}
/**
* CometAPI LLM provider - aggregates multiple mainstream models
* from various providers (GPT, Claude, Gemini, Grok, DeepSeek, Qwen, etc.)
*
* Uses OpenAI-compatible API format with bearer token authentication
*/
class CometAPI extends OpenAI {
static providerName = "cometapi";
static defaultOptions: Partial<LLMOptions> = {
apiBase: "https://api.cometapi.com/v1/",
model: "gpt-4o-mini", // Default to a commonly available model
};
constructor(options: LLMOptions) {
// Validate required configuration before calling super
CometAPI.validateConfig(options);
super(options);
// Align contextLength with llm-info for cometapi specifically (non-breaking for others)
try {
const cometProvider = allModelProviders.find((p) => p.id === "cometapi");
const info = cometProvider?.models.find((m) =>
m.regex ? m.regex.test(this.model) : m.model === this.model,
);
if (info?.contextLength) {
// Always prefer cometapi-specific llm-info over generic provider matches
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - accessing protected for targeted fix
this._contextLength = info.contextLength;
}
} catch {
// no-op: do not fail construction on metadata issues
}
}
/**
* Validate CometAPI configuration
*/
private static validateConfig(options: LLMOptions): void {
// Allow constructing without API key (tests that only instantiate should pass).
// Enforce credentials at request time instead.
if (!options.apiKey) {
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "test") {
console.warn(
"CometAPI: No API key provided. Requests will fail until an API key is configured. Get one at https://api.cometapi.com/console/token",
);
}
return;
}
if (options.apiBase && !CometAPI.isValidApiBase(options.apiBase)) {
throw new CometAPIError(
`Invalid CometAPI base URL: ${options.apiBase}. Expected https://api.cometapi.com/v1/ or compatible endpoint`,
);
}
if (
options.model &&
!CometAPI.isValidModelFormat(options.model) &&
typeof process !== "undefined" &&
process.env?.NODE_ENV !== "test"
) {
console.warn(
`CometAPI: Model "${options.model}" may not be supported. Check CometAPI documentation for available models.`,
);
}
}
/**
* Validate API base URL format
*/
private static isValidApiBase(apiBase: string): boolean {
try {
const url = new URL(apiBase);
return (
url.protocol === "https:" &&
(url.hostname === "api.cometapi.com" ||
url.hostname.endsWith(".cometapi.com") ||
apiBase.includes("v1")) // Allow custom compatible endpoints
);
} catch {
return false;
}
}
/**
* Basic model format validation
*/
private static isValidModelFormat(model: string): boolean {
// Allow common model patterns
const validPatterns = [
/^gpt-/i,
/^claude-/i,
/^gemini-/i,
/^grok/i,
/^deepseek/i,
/^qwen/i,
/^text-/i,
/^chat/i,
];
return validPatterns.some((pattern) => pattern.test(model));
}
/**
* Patterns to filter out non-chat models from the model list
* Based on CometAPI documentation requirements
*/
private static IGNORE_PATTERNS = [
// Image generation models
"dall-e",
"dalle",
"midjourney",
"mj_",
"stable-diffusion",
"sd-",
"flux-",
"playground-v",
"ideogram",
"recraft-",
"black-forest-labs",
"/recraft-v3",
"recraftv3",
"stability-ai/",
"sdxl",
// Audio generation models
"suno_",
"tts",
"whisper",
// Video generation models
"runway",
"luma_",
"luma-",
"veo",
"kling_",
"minimax_video",
"hunyuan-t1",
// Utility models
"embedding",
"search-gpts",
"files_retrieve",
"moderation",
];
/**
* Recommended chat models from CometAPI documentation
*/
private static RECOMMENDED_MODELS = [
// GPT series
"gpt-5-chat-latest",
"chatgpt-4o-latest",
"gpt-5-mini",
"gpt-5-nano",
"gpt-5",
"gpt-4.1-mini",
"gpt-4.1-nano",
"gpt-4.1",
"gpt-4o-mini",
"o4-mini-2025-04-16",
"o3-pro-2025-06-10",
// Claude series
"claude-opus-4-1-20250805",
"claude-opus-4-1-20250805-thinking",
"claude-sonnet-4-20250514",
"claude-sonnet-4-20250514-thinking",
"claude-3-7-sonnet-latest",
"claude-3-5-haiku-latest",
// Gemini series
"gemini-2.5-pro",
"gemini-2.5-flash",
"gemini-2.5-flash-lite",
"gemini-2.0-flash",
// Grok series
"grok-4-0709",
"grok-3",
"grok-3-mini",
"grok-2-image-1212",
// DeepSeek series
"deepseek-v3.1",
"deepseek-v3",
"deepseek-r1-0528",
"deepseek-chat",
"deepseek-reasoner",
// Qwen series
"qwen3-30b-a3b",
"qwen3-coder-plus-2025-07-22",
];
/**
* Filter model list to exclude non-chat models
* Uses pattern matching against model names
*/
protected filterChatModels(models: any[]): any[] {
if (!models || !Array.isArray(models)) {
return [];
}
return models.filter((model) => {
const modelId = model.id || model.model || "";
const modelName = modelId.toLowerCase();
// Check if model matches any ignore pattern
const shouldIgnore = CometAPI.IGNORE_PATTERNS.some((pattern) =>
modelName.includes(pattern.toLowerCase()),
);
return !shouldIgnore;
});
}
/**
* Get recommended models for CometAPI
* Returns predefined list since CometAPI model info is limited
*/
protected getRecommendedModels(): string[] {
return [...CometAPI.RECOMMENDED_MODELS];
}
/**
* Override listModels method to apply model filtering with enhanced error handling
*/
async listModels(): Promise<string[]> {
try {
const allModels = await super.listModels();
const filteredModels = this.filterChatModels(
allModels.map((id) => ({ id })),
);
// If filtered list is empty or very limited, return recommended models
if (filteredModels.length < 5) {
console.info(
"CometAPI: Limited models available, using recommended set",
);
return this.getRecommendedModels();
}
return filteredModels.map((model) => model.id);
} catch (error: any) {
// Enhanced error handling with specific error types
const errorMessage = error?.message || "Unknown error";
const statusCode = error?.status || error?.statusCode;
if (statusCode === 401) {
throw new CometAPIAuthenticationError(
"CometAPI authentication failed. Please check your API key.",
);
} else if (statusCode === 429) {
throw new CometAPIQuotaExceededError(
"CometAPI rate limit exceeded. Please try again later.",
);
} else if (statusCode >= 400 && statusCode < 500) {
throw new CometAPIError(
`CometAPI client error: ${errorMessage}`,
"CLIENT_ERROR",
statusCode,
);
} else if (statusCode >= 500) {
console.warn(
"CometAPI server error, falling back to recommended models:",
errorMessage,
);
return this.getRecommendedModels();
} else {
// Network or other errors - fallback gracefully
console.warn(
"CometAPI: Failed to fetch model list, using recommended models",
errorMessage,
);
return this.getRecommendedModels();
}
}
}
/**
* Override chat completion with enhanced error handling
*/
protected async *_streamChat(
messages: any[],
signal: AbortSignal,
options: any = {},
): AsyncGenerator<any> {
try {
yield* super._streamChat(messages, signal, options);
} catch (error: any) {
const statusCode = error?.status || error?.statusCode;
const errorMessage = error?.message || "Unknown error";
if (statusCode === 401) {
throw new CometAPIAuthenticationError(
"CometAPI authentication failed during chat completion",
);
} else if (statusCode === 429) {
throw new CometAPIQuotaExceededError(
"CometAPI rate limit exceeded during chat completion",
);
} else if (
errorMessage.includes("model") &&
errorMessage.includes("not found")
) {
throw new CometAPIError(
`Model "${this.model}" is not available on CometAPI. Please check available models.`,
"MODEL_NOT_FOUND",
404,
);
} else {
// Re-throw with more context
throw new CometAPIError(
`CometAPI chat completion failed: ${errorMessage}`,
"COMPLETION_ERROR",
statusCode,
);
}
}
}
}
export default CometAPI;

View file

@ -13,6 +13,7 @@ import LMStudio from "./LMStudio.js";
import Cerebras from "./Cerebras.js";
import DeepInfra from "./DeepInfra.js";
import Nvidia from "./Nvidia.js";
import CometAPI from "./CometAPI.js";
// Base OpenAI tests
import { afterEach, describe, expect, test, vi } from "vitest";
@ -292,3 +293,13 @@ createOpenAISubclassTests(Nvidia, {
truncate: "END",
},
});
createOpenAISubclassTests(CometAPI, {
providerName: "cometapi",
defaultApiBase: "https://api.cometapi.com/v1/",
modelConversions: {
"gpt-5-mini": "gpt-5-mini",
"claude-4-sonnet": "claude-sonnet-4-20250514",
},
modelConversionContent: "hello",
});

View file

@ -223,6 +223,10 @@ class VertexAI extends BaseLLM {
const shouldCacheSystemMessage = !!(
this.cacheBehavior?.cacheSystemMessage && systemMessage
);
const shouldCachePrompt = !!(
this.cacheBehavior?.cacheConversation ??
this.completionOptions.promptCaching
);
// <code>/v1/publishers/anthropic/models/claude-3-5-sonnet-20240620:streamRawPredict
@ -234,13 +238,16 @@ class VertexAI extends BaseLLM {
const response = await this.fetch(apiURL, {
method: "POST",
headers: {
...(shouldCacheSystemMessage || this.cacheBehavior?.cacheConversation
...(shouldCacheSystemMessage || shouldCachePrompt
? { "anthropic-beta": "prompt-caching-2024-07-31" }
: {}),
},
body: JSON.stringify({
...this._anthropicConvertArgs(options),
messages: this.anthropicInstance.convertMessages(messages),
messages: this.anthropicInstance.convertMessages(
messages,
shouldCachePrompt,
),
system: shouldCacheSystemMessage
? [
{

View file

@ -17,6 +17,7 @@ import BedrockImport from "./BedrockImport";
import Cerebras from "./Cerebras";
import Cloudflare from "./Cloudflare";
import Cohere from "./Cohere";
import CometAPI from "./CometAPI";
import DeepInfra from "./DeepInfra";
import Deepseek from "./Deepseek";
import Docker from "./Docker";
@ -67,6 +68,7 @@ import xAI from "./xAI";
export const LLMClasses = [
Anthropic,
Cohere,
CometAPI,
FunctionNetwork,
Gemini,
Llamafile,

View file

@ -7,14 +7,6 @@ class xAI extends OpenAI {
static defaultOptions: Partial<LLMOptions> = {
apiBase: "https://api.x.ai/v1/",
};
private static MODEL_IDS: { [name: string]: string } = {
"grok-beta": "grok-beta", // Future names might not line up
};
protected _convertModelName(model: string) {
return xAI.MODEL_IDS[model] || this.model;
}
}
export default xAI;

View file

@ -280,6 +280,23 @@ describe("PROVIDER_TOOL_SUPPORT", () => {
});
});
describe("xAI", () => {
const supportsFn = PROVIDER_TOOL_SUPPORT["xAI"];
it("should return true for Grok-3 models", () => {
expect(supportsFn("grok-3")).toBe(true);
expect(supportsFn("grok-3-mini")).toBe(true);
expect(supportsFn("grok-3-fast")).toBe(true);
});
it("should return true for Grok-4 models", () => {
expect(supportsFn("grok-4")).toBe(true);
expect(supportsFn("grok-4-fast-non-reasoning")).toBe(true);
expect(supportsFn("grok-4-fast-reasoning")).toBe(true);
expect(supportsFn("Grok-4-Fast")).toBe(true);
});
});
describe("novita", () => {
const supportsFn = PROVIDER_TOOL_SUPPORT["novita"];

View file

@ -110,6 +110,10 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
}
return ["claude", "gemini"].some((val) => lowerCaseModel.includes(val));
},
xAI: (model) => {
const lowerCaseModel = model.toLowerCase();
return ["grok-3", "grok-4"].some((val) => lowerCaseModel.includes(val));
},
bedrock: (model) => {
if (
[

View file

@ -1,49 +1,47 @@
import { getSecureID } from "./getSecureID";
// Mock the crypto.randomUUID function
const mockRandomUUID = jest.fn();
global.crypto = {
...global.crypto,
randomUUID: mockRandomUUID,
};
describe("getSecureID", () => {
beforeEach(() => {
// Reset the static property before each test
(getSecureID as any).uuid = undefined;
// Reset the mock implementation
mockRandomUUID.mockReset();
// Setup a mock implementation that returns a fixed value for testing
mockRandomUUID.mockReturnValue("test-uuid-1234");
});
test("should generate a UUID on first call", () => {
const result = getSecureID();
expect(mockRandomUUID).toHaveBeenCalledTimes(1);
expect(result).toBe("<!-- SID: test-uuid-1234 -->");
// Should return a properly formatted string with SID comment
expect(result).toMatch(
/^<!-- SID: [0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12} -->$/,
);
// Should have set the static uuid property
expect((getSecureID as any).uuid).toBeDefined();
expect(typeof (getSecureID as any).uuid).toBe("string");
});
test("should reuse the same UUID on subsequent calls", () => {
const firstResult = getSecureID();
const secondResult = getSecureID();
// The UUID generation should only happen once
expect(mockRandomUUID).toHaveBeenCalledTimes(1);
// Both results should be identical
expect(firstResult).toBe(secondResult);
expect(firstResult).toBe("<!-- SID: test-uuid-1234 -->");
// Should match UUID format
expect(firstResult).toMatch(
/^<!-- SID: [0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12} -->$/,
);
});
test("should maintain the same UUID across different test cases if not reset", () => {
// Don't reset the UUID here to test persistence
// Set a specific UUID to test persistence
(getSecureID as any).uuid = "persistent-uuid";
const result = getSecureID();
// No new UUID should be generated
expect(mockRandomUUID).not.toHaveBeenCalled();
// Should use the pre-existing UUID
expect(result).toBe("<!-- SID: persistent-uuid -->");
// The static property should remain unchanged
expect((getSecureID as any).uuid).toBe("persistent-uuid");
});
});

View file

@ -1,8 +1,10 @@
import { v4 as uuidv4 } from "uuid";
// Utility function to get or generate UUID for LLM prompts
export function getSecureID(): string {
// Adding a type declaration for the static property
if (!(getSecureID as any).uuid) {
(getSecureID as any).uuid = crypto.randomUUID();
(getSecureID as any).uuid = uuidv4();
}
return `<!-- SID: ${(getSecureID as any).uuid} -->`;
}

25
core/package-lock.json generated
View file

@ -9,6 +9,7 @@
"version": "1.1.0",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/sdk": "^0.62.0",
"@aws-sdk/client-bedrock-runtime": "^3.779.0",
"@aws-sdk/client-sagemaker-runtime": "^3.777.0",
"@aws-sdk/credential-providers": "^3.778.0",
@ -201,7 +202,7 @@
},
"../packages/llm-info": {
"name": "@continuedev/llm-info",
"version": "1.0.9",
"version": "1.0.10",
"license": "Apache-2.0",
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
@ -218,6 +219,7 @@
"version": "1.15.0",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/sdk": "^0.62.0",
"@aws-sdk/client-bedrock-runtime": "^3.842.0",
"@aws-sdk/credential-providers": "^3.840.0",
"@continuedev/config-types": "^1.0.14",
@ -297,6 +299,15 @@
"node": ">=6.0.0"
}
},
"node_modules/@anthropic-ai/sdk": {
"version": "0.62.0",
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.62.0.tgz",
"integrity": "sha512-gT2VFKX0gSp7KJNlav/vzRFjJOPYDZxCJRx7MYUc+fqURc5aS6OI/UJeD2KytJkjsIWv0OOwH1ePc1S5QE2GZw==",
"license": "MIT",
"bin": {
"anthropic-ai-sdk": "bin/cli"
}
},
"node_modules/@apache-arrow/ts": {
"version": "14.0.2",
"resolved": "https://registry.npmjs.org/@apache-arrow/ts/-/ts-14.0.2.tgz",
@ -16353,9 +16364,9 @@
}
},
"node_modules/prebuild-install/node_modules/tar-fs": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.3.tgz",
"integrity": "sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg==",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz",
"integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==",
"license": "MIT",
"dependencies": {
"chownr": "^1.1.1",
@ -18312,9 +18323,9 @@
}
},
"node_modules/tar-fs": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.9.tgz",
"integrity": "sha512-XF4w9Xp+ZQgifKakjZYmFdkLoSWd34VGKcsTCwlNWM7QG3ZbaxnTsaBwnjFZqHRf/rROxaR8rXnbtwdvaDI+lA==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz",
"integrity": "sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==",
"license": "MIT",
"dependencies": {
"pump": "^3.0.0",

View file

@ -54,6 +54,7 @@
"vitest": "^3.1.4"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.62.0",
"@aws-sdk/client-bedrock-runtime": "^3.779.0",
"@aws-sdk/client-sagemaker-runtime": "^3.777.0",
"@aws-sdk/credential-providers": "^3.778.0",

View file

@ -148,6 +148,8 @@ export type ToCoreFromIdeOrWebviewProtocol = {
},
void,
];
"mcp/disconnectServer": [{ id: string }, void];
"mcp/getDisconnectedServers": [undefined, string[]];
"mcp/getPrompt": [
{
serverName: string;

View file

@ -32,6 +32,8 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
"mcp/getPrompt",
"mcp/startAuthentication",
"mcp/removeAuthentication",
"mcp/disconnectServer",
"mcp/getDisconnectedServers",
"context/getContextItems",
"context/getSymbolsForFiles",
"context/loadSubmenuItems",

134
docs/cli/install.mdx Normal file
View file

@ -0,0 +1,134 @@
---
title: "Install Continue CLI"
description: "Get Continue CLI installed and configured for command-line AI coding assistance and automation"
sidebarTitle: "Install"
---
<Info>
Make sure you have [Node.js 18 or higher
installed](https://nodejs.org/en/download/).
</Info>
## Installation
Install Continue CLI globally using npm:
```bash
npm i -g @continuedev/cli
```
## Two Ways to Use Continue CLI
<Info>
**Quick Overview**: Continue CLI works in two modes - TUI for interactive
conversations or headless for automated commands.
</Info>
<Tabs>
<Tab title="TUI Mode">
**Interactive development sessions**
Start a conversation with AI in your terminal:
```bash
cn
> @src/app.js Generate unit tests for this component
```
Perfect for exploration, debugging, and iterative development.
</Tab>
<Tab title="Headless Mode">
**Automation and scripting**
Single commands that return results:
```bash
cn -p "Generate a commit message for current changes"
cn -p "Review the last 5 commits for issues"
```
Perfect for CI/CD, git hooks, and automated workflows.
</Tab>
</Tabs>
## Setup
<Tabs>
<Tab title="cn TUI Mode">
For interactive development and exploration:
<Steps>
<Step title="Login to Continue CLI">
```bash
cn login
```
This will open your browser to authenticate with Continue Hub.
</Step>
<Step title="Test TUI Mode">
Start an interactive session:
```bash
cn
```
Try asking a question:
```
> Tell me about the CLI
```
</Step>
</Steps>
</Tab>
<Tab title="cn Headless Mode">
For automation workflows and scripting:
<Steps>
<Step title="Get API Key for Automation">
For automation workflows, get an API key:
1. Visit [Continue Hub API Keys](https://hub.continue.dev/settings/api-keys)
2. Click **"+ New API Key"**
3. Copy the API key immediately (you won't see it again!)
4. Login using your Continue account
</Step>
<Step title="Add Secrets for Workflows">
Store secure credentials for CLI workflows:
1. Visit [Continue Hub Secrets](https://hub.continue.dev/settings/secrets)
2. Add your API keys and sensitive data
3. Reference in configurations with `${{ secrets.SECRET_NAME }}`
</Step>
<Step title="Test Headless Mode">
Try headless mode for automation:
```bash
cn -p "Generate a conventional commit message for the current git changes"
```
</Step>
</Steps>
</Tab>
</Tabs>
## What's Next?
<CardGroup cols={2}>
<Card title="Quick Start Guide" icon="rocket" href="/cli/quick-start">
Learn basic usage with practical examples
</Card>
<Card title="Create your first workflow" icon="gear" href="/guides/posthog-github-continuous-ai">
Build automated workflows with Continue CLI
</Card>
</CardGroup>
## Getting Help
If you encounter issues:
- Ask for help in [our discussions](https://github.com/continuedev/continue/discussions)
- Report bugs on [GitHub](https://github.com/continuedev/continue)

228
docs/cli/overview.mdx Normal file
View file

@ -0,0 +1,228 @@
---
title: "Continue CLI (cn) Overview"
description: "Command-line interface for automated coding tasks, scripting, and headless development workflows with Continue's AI coding capabilities"
sidebarTitle: "Overview"
---
<Frame>
<img src="/images/cn-demo.gif" />
</Frame>
**Continue enables developers to ship faster with Continuous AI.**
<Tip>
Build features from descriptions. Debug and fix issues. Navigate any codebase.
Automate tedious tasks.
</Tip>
## Get started in 30 seconds
Prerequisites:
- [Node.js 18 or newer](https://nodejs.org/en/download/)
- A [Continue Hub](https://hub.continue.dev) account (recommended) or local configuration
```bash npm
# Install Continue CLI
npm install -g @continuedev/cli
# Navigate to your project
cd your-awesome-project
# Start coding with Continue
cn
# You'll be prompted to set up on first use
```
That's it! You're ready to start automating with Continue CLI.
[Continue with CLI Quickstart →](/cli/quick-start)
## Two Ways to Use Continue CLI
Continue CLI offers two distinct modes designed for different workflows:
### TUI Mode: Interactive Development
**Perfect for exploration, debugging, and iterating on AI workflows**
```bash
cn
> @src/components/UserProfile.js Review this component for security issues
> Generate comprehensive unit tests
> Suggest performance improvements
```
- **Interactive conversations** with your codebase
- **Iterate and refine** prompts and approaches
- **Explore and understand** complex codebases
- **Perfect for experimentation** and learning
### Headless Mode: Production Automation
**Perfect for CI/CD, automation, and reliable workflows**
```bash
cn -p "Generate a conventional commit message for staged changes"
cn -p "Review pull request changes for security vulnerabilities"
cn -p "Update documentation based on recent code changes"
```
- **Single-command execution** for automation
- **Reliable, repeatable results** for production use
- **CI/CD and pipeline integration**
- **Git hooks and automated workflows**
### Development Workflow: TUI → Headless
<Tip>
**Pro Tip**: Start in TUI mode to iterate on your AI agent and prompts. Once
you have a workflow that works reliably, deploy it as a Continuous AI
automation.
</Tip>
1. **Experiment in TUI mode** to perfect your prompts and agent configuration
2. **Test different approaches** interactively until you get consistent results
3. **Convert successful workflows** to automated Continuous AI commands
4. **Deploy in production** with confidence in your proven approach
## Why developers love Continue CLI
- **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.
- **Takes action**: Continue CLI can directly edit files, run commands, and create commits. Need more? Check out our [MCPs](/customize/deep-dives/mcp).
- **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.
- **Flexible development flow**: Start interactive, then automate proven workflows.
## Key Capabilities
### Context Engineering
- Use `@` to reference files and provide context
- Use `/` to run slash commands for specific tasks
- Access the same context providers as IDE extensions
### Tool Integration
- File editing and creation
- Terminal command execution
- Codebase understanding and analysis
- Git integration
- Web search and documentation access
### Model Flexibility
- Switch between models with `/model` command
- Use any model configured in your `config.yaml`
- Access Continue Hub models and configurations
## Continue Hub Integration
Continue CLI integrates seamlessly with [Continue Hub](https://hub.continue.dev) for:
### API Access
Get an API key for automation workflows:
1. Visit [Continue Hub API Keys](https://hub.continue.dev/settings/api-keys)
2. Create a new API key
3. Use with `cn login` or in your automation scripts
### Secrets Management
Store secure credentials for CLI workflows:
1. Visit [Continue Hub Secrets](https://hub.continue.dev/settings/secrets)
2. Add your API keys and sensitive data
3. Reference in configurations with `${{ secrets.SECRET_NAME }}`
### Configuration Sync
- Cloud-managed configurations automatically sync
- Share configurations across team members
- Version control for your AI workflows
## Common Use Cases
### TUI Mode Examples
**Interactive development and exploration:**
<CodeGroup>
```bash Codebase Exploration
# Start interactive session
cn
> @src/components Find all unused React components
> /explain How does authentication work in this codebase?
> @auth/ What security patterns are used here?
```
```bash Iterative Debugging
# Debug issues interactively
cn
> @tests/auth.test.js This test is failing, help me understand why
> @src/auth/middleware.js Let's examine this middleware
> /debug What could be causing the timeout error?
```
```bash Workflow Development
# Develop and test automation workflows
cn
> @package.json @CHANGELOG.md Generate a release notes template
> # Test and refine the approach
> # Once working, convert to: cn -p "Generate release notes"
```
</CodeGroup>
### Headless Mode Examples
**Production automation and scripting:**
<CodeGroup>
```bash Git Automation
# Generate commit messages
cn -p "Generate a conventional commit message for the current changes"
# Code review automation
cn -p "Review the current git changes for bugs and suggest improvements"
````
```bash CI/CD Integration
# In your pipeline scripts
cn -p "Analyze test failures and suggest fixes"
# Automated documentation updates
cn -p "@README.md Update this documentation based on recent changes"
````
```bash Issue Management
# Create GitHub issues from PostHog data
cn -p "@posthog-data.json Create GitHub issues for UX problems found in this session data"
# Automated security audits
cn -p "Scan the codebase for potential security vulnerabilities"
```
</CodeGroup>
## Next steps
<CardGroup cols={3}>
<Card title="CLI Quickstart" href="/cli/quick-start">
Learn basic commands and common workflows
</Card>
<Card title="Installation Guide" href="/cli/install">
Install Continue CLI and set up your environment
</Card>
<Card title="CLI Workflows" href="/guides/overview#continuous-ai">
Task-specific tutorials and examples
</Card>
</CardGroup>

176
docs/cli/quick-start.mdx Normal file
View file

@ -0,0 +1,176 @@
---
title: "Continue CLI Quick Start"
description: "Get hands-on experience with Continue CLI through practical examples and common use cases"
sidebarTitle: "Quick Start"
---
Get hands-on experience with Continue CLI through practical development workflows.
<Tabs>
<Tab title="TUI Mode">
TUI Mode (`cn` command) is for **large development tasks** that require
agentic workflows with human oversight. Perfect for complex refactors,
feature implementation, or one-off automation tasks that need monitoring and
iteration.
</Tab>
<Tab title="Headless Mode">
Headless Mode (`-p` flag) is for **reliable, repeatable tasks** that no
longer need constant supervision. Perfect for CI/CD pipelines, git hooks,
and automated workflows you've already tested and refined.
</Tab>
</Tabs>
## TUI Mode: Large Development Tasks
Make sure you have [Continue CLI installed](/cli/install) and are in a project directory.
### Example: Implementing a New Feature
```bash
# Navigate to your project directory
cd your-awesome-project
# Start TUI Mode for complex development work
cn
```
**Example workflow for adding authentication:**
```
> I need to add JWT authentication to this Express app. Let me start by showing you the current structure.
> @src/app.js @package.json Here's my current setup. Can you implement JWT auth with middleware, login/register routes, and user model?
> [Agent analyzes codebase and implements auth system]
> [You review changes, test, and provide feedback]
> [Agent iterates based on your input until the feature is complete]
```
### Example: Complex Refactoring
```bash
cn
```
**Refactoring a monolithic component:**
```
> @src/components/Dashboard.jsx This component is 800 lines and does too much. Help me break it into smaller, reusable components.
> [Agent analyzes component structure]
> [Proposes component breakdown strategy]
> [You approve approach]
> [Agent implements the refactor with proper props and state management]
> [You test and request adjustments]
```
### When to Use TUI Mode
✅ **Large development tasks** that need oversight
✅ **Complex refactors** requiring multiple steps
✅ **New feature implementation** with unknowns
✅ **One-off automation tasks** you haven't done before
✅ **Debugging complex issues** that need exploration
## Headless Mode: Automated Workflows
Once you've refined a workflow in TUI Mode, convert it to Continuous AI for automation.
### Example: From REPL → Continuous AI
**Step 1: Develop in TUI Mode**
```bash
cn
> @package.json @CHANGELOG.md Generate release notes for version 2.1.0
> [Test and refine the prompt until it works perfectly]
```
**Step 2: Convert to Continuous AI**
```bash
# Now use the refined workflow in automation
cn -p "Generate release notes for the current version based on package.json and recent commits"
```
### Common Continuous AI Workflows
```bash
# Git automation
cn -p "Generate a conventional commit message for staged changes"
cn -p "Review the last 3 commits for potential issues"
# Code quality
cn -p "Fix all TypeScript errors in the src/ directory"
cn -p "Update outdated dependencies and fix breaking changes"
# Documentation
cn -p "@README.md Update documentation based on recent changes"
cn -p "Generate API documentation from JSDoc comments"
# CI/CD integration
cn -p "Analyze test failures and create GitHub issue with findings"
cn -p "Update version numbers and create release branch"
```
### When to Use Headless Mode
✅ **Proven workflows** you've tested in TUI Mode
✅ **Repetitive tasks** that no longer need oversight
✅ **CI/CD automation** in pipelines
✅ **Git hooks** for automated checks
✅ **Scheduled tasks** that run unattended
### Available Slash Commands
Common slash commands available in CLI:
- `/clear` - Clear the chat history
- `/compact` - Summarize chat history into a compact form
- `/config` - Switch configuration or organization
- `/exit` - Exit the chat
- `/fork` - Start a forked chat session from the current history
- `/help` - Show help message
- `/info` - Show session information
- `/init` - Create an AGENTS.md file
- `/login` - Authenticate with your account
- `/logout` - Sign out of your current session
- `/mcp` - Manage MCP server connections
- `/model` - Switch between available chat models
- `/resume` - Resume a previous chat session
- `/whoami` - Check who you're currently logged in as
<Info>Use `/help` to see all available commands.</Info>
## The Development Workflow
<Info>
**Recommended Approach**: Start complex tasks in TUI Mode to iterate and
refine your approach. Once you have a reliable workflow, convert it to
Headless Mode for automation.
</Info>
### Workflow Pattern
1. **🔬 Experiment in TUI Mode**
- Try complex development tasks with human oversight
- Iterate on prompts and approaches until they work reliably
- Test edge cases and refine the agent's behavior
2. **⚡ Automate with Continuous AI**
- Convert proven REPL workflows to single commands
- Deploy in CI/CD, git hooks, or scheduled tasks
- Run with confidence knowing the approach is tested
## Next Steps
<CardGroup cols={2}>
<Card title="Create Your First Workflow" href="/guides/posthog-github-continuous-ai">
Build an automated PostHog to GitHub issues workflow
</Card>
<Card title="Continuous AI Guide" href="/guides/continuous-ai">
Learn to build and deploy AI-powered development workflows
</Card>
</CardGroup>

View file

@ -65,10 +65,10 @@ Read more about [model roles](/customize/model-roles), [model capabilities](/cus
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)
4. Click `Reload config` in the agent selector in the Continue IDE extension
[Grok 4](https://hub.continue.dev/xai/grok-4) from xAI
[Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) from xAI
1. Get your API key from [xAI](https://console.x.ai/)
2. Add [Grok 4](https://hub.continue.dev/xai/grok-4) to an agent on Continue Hub
2. Add [Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) to an agent on Continue Hub
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)
4. Click `Reload config` in the agent selector in the Continue IDE extension

View file

@ -210,9 +210,14 @@ This matrix shows which models support tool use and image input capabilities. Co
### xAI
| Model | Tool Use | Image Input | Context Window |
| :----- | -------- | ----------- | -------------- |
| Grok 4 | Yes | Yes | 128k |
| Model | Tool Use | Image Input | Context Window |
| :------------------------ | -------- | ----------- | -------------- |
| Grok Code Fast 1 | Yes | Yes | 256k |
| Grok 4 Fast Reasoning | Yes | Yes | 2M |
| Grok 4 Fast Non-Reasoning | Yes | Yes | 2M |
| Grok 4 | Yes | Yes | 256k |
| Grok 3 | Yes | Yes | 131k |
| Grok 3 Mini | Yes | Yes | 131k |
### Moonshot AI

View file

@ -3,13 +3,9 @@ title: xAI
slug: ../xai
---
<Tip>
**Discover xAI models [here](https://hub.continue.dev/xai)**
</Tip>
<Tip>**Discover xAI models [here](https://hub.continue.dev/xai)**</Tip>
<Info>
Get an API key from the [xAI Console](https://console.x.ai/)
</Info>
<Info>Get an API key from the [xAI Console](https://console.x.ai/)</Info>
## Configuration
@ -29,7 +25,7 @@ slug: ../xai
"models": [
{
"title": "<MODEL_NAME>",
"provider": "anthropic",
"provider": "xai",
"model": "<MODEL_ID>",
"apiKey": "<YOUR_XAI_API_KEY>"
}
@ -40,5 +36,6 @@ slug: ../xai
</Tabs>
<Info>
**Check out a more advanced configuration [here](https://hub.continue.dev/xai/grok-4?view=config)**
</Info>
**Check out a more advanced configuration
[here](https://hub.continue.dev/xai/grok-code-fast-1?view=config)**
</Info>

View file

@ -23,6 +23,11 @@
"getting-started/quick-start"
]
},
{
"group": "CLI",
"icon": "terminal",
"pages": ["cli/overview", "cli/install", "cli/quick-start"]
},
{
"group": "Features",
"icon": "star",
@ -230,10 +235,10 @@
"pages": [
"guides/overview",
"guides/understanding-agents",
"guides/configuring-models-rules-tools",
"guides/codebase-documentation-awareness",
"guides/cli",
"guides/continuous-ai",
"guides/snyk-mcp-continue-cookbook",
"guides/continuous-ai-readiness-assessment",
"guides/plan-mode-guide",
"guides/ollama-guide",
@ -248,6 +253,7 @@
"icon": "book-open-cover",
"pages": [
"guides/posthog-github-continuous-ai",
"guides/snyk-mcp-continue-cookbook",
"guides/netlify-mcp-continuous-deployment"
]
}

View file

@ -6,7 +6,7 @@ description: "Learn how Continue's Next Edit feature predicts and suggests your
<Warning>
Next Edit is currently an experimental feature. It requires
[Instinct](https://hub.continue.dev/continuedev/instinct) or [Mercury Coder
model](https://hub.continue.dev/inceptionlabs/mercury-coder) configured in
model](https://hub.continue.dev/inception/mercury-coder) configured in
your Continue autocomplete settings and is not yet available for JetBrains
use.
</Warning>
@ -73,7 +73,6 @@ Next Edit activates automatically when:
Next Edit requires:
- Compatible AI models (Mercury Coder or Instinct)
- Continue development team access
- VS Code (JetBrains support coming soon)
- **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)

View file

@ -0,0 +1,168 @@
---
title: "Configuring Models, Rules, and Tools"
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."
---
## What Are Models, Rules, and Tools?
Continue agents are built from three main types of configuration:
<Columns cols={3}>
<Card title="Models" icon="cube">
Language models that power different capabilities like chat, autocomplete, and agent mode
</Card>
<Card title="Rules" icon="pencil">
Guidelines and instructions that shape how the AI behaves and responds
</Card>
<Card title="Tools" icon="server">
MCP tools that provide additional capabilities like database access, web search, or custom functions
</Card>
</Columns>
There are two places where you can define these configurations:
<Columns cols={2}>
<Card title="Local" icon="computer">
Custom configurations you create and manage in your workspace or globally
</Card>
<Card title="Hub" icon="cloud">
Pre-built models, rules, and tools from the Continue community that you can import and use immediately
</Card>
</Columns>
## Local
Local configurations let you create custom models, rules, and tools that automatically apply to multiple agents, reducing duplication and ensuring consistency across your setup.
<Columns cols={2}>
<Card title="Global" icon="globe">
Applied to all agents across all workspaces. Ideal for personal preferences, universal coding standards, or tools you use everywhere.
</Card>
<Card title="Workspace" icon="folder-open">
Applied automatically to all agents when working in a specific project.
Perfect for project-specific setups like TypeScript rules for web apps or the Playwright MCP tool.
</Card>
</Columns>
## Hub
Continue hub uses a slug in the format of `owner/item-name` to resolve blocks.
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`.
Import from the hub using the `uses` syntax alongside your custom configurations:
```yaml config.yaml highlight={6}
name: Team Agent
version: 1.0.0
schema: v1
models:
- uses: anthropic/claude-4-sonnet
with:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} # Use a hub secret
```
### Organization
Organize your local configurations using these directories:
<Columns cols={3}>
<Card title="Models" icon="cube">
`.continue/models`
</Card>
<Card title="Rules" icon="pencil">
`.continue/rules`
</Card>
<Card title="Tools" icon="server">
`.continue/mcpServers`
</Card>
</Columns>
## Working with Secrets
Models, and many MCP servers, require a secret for things like API keys.
On the hub, you can configure secrets when adding a model or MCP server.
This will use mustache notation to pass the secret, eg `${{ secrets.SECRET_NAME }}`
When configuring a local model or MCP server, you can use the same mustache notation for secrets which read from:
<Columns cols={2}>
<Card title="Global" icon="globe">
`.env` file in `~/.continue/.env`
</Card>
<Card title="Workspace" icon="folder-open">
`.env` file at your project root
</Card>
</Columns>
## Overriding Properties
You can directly override properties using the `override` syntax:
```yaml title="config.yaml" highlight={10-13}
name: myprofile/custom-agent
version: 1.0.0
schema: v1
models:
- uses: myprofile/custom-model
with:
ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }}
TEMP: 0.9
override:
roles:
- chat
```
## Advanced
### Inputs
Models and MCP server authors can configure inputs that require the user to provide a secret value by defining a `${{ inputs.SECRET_NAME }}` value.
For example, here is how you could require that the user provide a value for the `apiKey` property on a model:
```yaml title="config.yaml" highlight={8}
name: myprofile/custom-model
version: 1.0.0
schema: v1
models:
- name: My Favorite Model
# ... other model properties ...
apiKey: ${{ inputs.SECRET_NAME }}
```
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`.
```yaml title="config.yaml" highlight={8}
name: myprofile/custom-agent
version: 1.0.0
schema: v1
models:
- uses: myprofile/custom-model
with:
SECRET_NAME: ${{ secrets.SECRET_NAME }}
```
## Next Steps
Now that you understand how models, rules, and tools work, explore:
- **[Config Reference](/reference)**: Detailed documentation of all available properties
- **[Continue Hub](https://hub.continue.dev)**: Browse community models, rules, and tools
- **[Custom Context Providers](/customize/deep-dives/custom-providers)**: Create advanced context integrations
- **[Model Roles](/customize/model-roles/intro)**: Understanding how different models work together

View file

@ -44,18 +44,82 @@ This cookbook teaches you to:
## Quick Setup
<Info>
The Netlify Development Rules bundle includes guardrails for:
- Proper `.gitignore` configuration
- Function structure and placement
- Edge function constraints
- Local development best practices
</Info>
For all options, first:
<Steps>
<Step title="Install Continue CLI">
<Step title="Install Continue CLI">
```bash
npm i -g @continuedev/cli
```
</Step>
<Step title="Install Netlify CLI">
1. Install Netlify CLI: `npm i -g netlify-cli`
2. Authenticate with Netlify:
`netlify login`
</Step>
</Steps>
## Netlify Continuous AI Workflow Options
<Card title="🚀 Fastest Path to Success" icon="zap">
Skip the manual setup and use our pre-built Netlify Continuous AI agent that includes
optimized prompts, rules, and the Netlify MCP for more consistent results.
</Card>
After completing **Quick Setup** above, you have two paths to get started:
<Tabs>
<Tab title="⚡ Quick Start (Recommended)">
<Steps>
<Step title="Add the Pre-Built Agent">
Visit the [Netlify Continuous AI Agent](https://hub.continue.dev/continuedev/netlify-continuous-ai) on Continue Hub and click **"Install Agent"**
This agent includes:
- **Optimized prompts** for Netlify deployment and performance analysis
- **Built-in rules** for consistent formatting and error handling
- **Netlify MCP** for more reliable API interactions
</Step>
<Step title="Verify Your Setup">
The agent uses the Netlify MCP automatically and includes best practice rules for deployment and performance optimization.
</Step>
<Step title="Run Performance Analysis">
Navigate to your project directory and run:
```bash
cn "Analyze my Netlify site's performance and optimize it for better Core Web Vitals."
```
That's it! The agent handles everything automatically.
</Step>
</Steps>
<Info>
**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.
</Info>
</Tab>
<Tab title="🛠️ Manual Setup">
<Steps>
<Step title="Configure Netlify MCP">
1. Install Netlify CLI: `npm i -g netlify-cli` 2. Authenticate with Netlify:
`netlify login` 3. Visit [Netlify MCP on Continue
Hub](https://hub.continue.dev/netlify/netlify-mcp) 4. Follow the configuration
instructions for your editor
1. Authenticate with Netlify:
`netlify login`
2. Visit [Netlify MCP on Continue
Hub](https://hub.continue.dev/netlify/netlify-mcp)
3. Follow the configuration instructions for your editor
</Step>
<Step title="Add Development Rules">
@ -77,13 +141,26 @@ This cookbook teaches you to:
```
</Step>
</Steps>
<Info>
The Netlify Development Rules bundle includes guardrails for: - Proper
`.gitignore` configuration - Function structure and placement - Edge function
constraints - Local development best practices
</Info>
</Steps>
<Info>
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.
</Info>
</Tab>
</Tabs>
<Accordion title="Agent Requirements">
To use the pre-built agent, you need either:
- **Continue CLI Pro Plan** with
the models add-on, OR
- **Your own API keys** added to Continue Hub secrets
The agent will automatically detect and use your
configuration along with the Netlify MCP for deployment operations.
</Accordion>
---
## Performance Optimization Steps
@ -375,6 +452,14 @@ Unlike Google Analytics, Netlify Analytics:
## Automated Performance Checks
### Add GitHub Secrets
Navigate to **Repository Settings → Secrets and variables → Actions** and add:
- `CONTINUE_API_KEY`: Your Continue API key from [hub.continue.dev/settings/api-keys](https://hub.continue.dev/settings/api-keys)
- `NETLIFY_AUTH_TOKEN`: Your Netlify personal access token
- `NETLIFY_SITE_ID`: Your Netlify site ID
### GitHub Actions Performance Guard
Block PRs that degrade performance:
@ -394,17 +479,28 @@ jobs:
with:
node-version: "22"
- name: Install Continue CLI
run: |
npm install -g @continuedev/cli
echo "✅ Continue CLI installed"
- name: Authenticate Continue CLI
env:
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
run: |
cn auth login --api-key "$CONTINUE_API_KEY"
echo "✅ Continue CLI authenticated"
- name: Deploy and Test Performance
id: perf
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
npx @continuedev/cli@latest << 'EOF'
Deploy PR preview and run Lighthouse.
Compare scores with main branch.
Output JSON with score deltas.
EOF > performance.json
echo "🚀 Deploying PR preview and analyzing performance..."
cn -p "Deploy PR preview and run Lighthouse.
Compare scores with main branch.
Output JSON with score deltas." > performance.json
- name: Comment Performance Results
uses: actions/github-script@v7
@ -442,9 +538,11 @@ jobs:
```
<Warning>
This workflow will: - **Block merge** if performance score drops >10 points -
**Warn** on any performance regression - **Celebrate** improvements with green
indicators
This workflow will:
- **Block merge** if performance score drops >10 points
- **Warn** on any performance regression
- **Celebrate** improvements with green indicators
</Warning>
## Performance Testing Locally
@ -528,9 +626,12 @@ Features many developers don't know Netlify offers:
<Card title="On-Demand Builders" icon="hammer">
**[On-Demand
Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)** -
Generate pages only when requested - Cache dynamically generated content -
Perfect for large sites (10k+ pages) - Reduce build times dramatically
Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)**
- Generate pages only when requested
- Cache dynamically generated content
- Perfect for large sites (10k+ pages)
- Reduce build times dramatically
</Card>
<Card title="Netlify Functions" icon="function">

View file

@ -1,23 +1,32 @@
---
title: "Building a Continuous AI Workflow with PostHog and GitHub"
description: "Build an automated system that continuously monitors PostHog session recordings, analyzes UX issues using Continue CLI, and creates GitHub issues automatically."
sidebarTitle: "PostHog Session Analysis with Continue CLI"
description: "Build an automated system that continuously monitors PostHog analytics, analyzes user behavior with AI, and creates GitHub issues automatically using PostHog MCP."
sidebarTitle: "PostHog Analytics with Continue CLI"
---
<Card title="What You'll Build" icon="robot">
A fully automated workflow that uses Continue CLI to fetch PostHog session
data, analyze user experience issues with AI, and automatically create GitHub
issues with specific technical recommendations
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
issues with the GitHub CLI.
</Card>
## What You'll Learn
This cookbook teaches you to:
- 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)
- Analyze user behavior patterns with AI
- Automatically create GitHub issues using GitHub CLI
- Set up continuous monitoring with GitHub Actions
## Prerequisites
Before starting, ensure you have:
- GitHub repository where you want to create issues
- PostHog account with **[session recordings enabled and collecting data](https://posthog.com/docs/session-replay/installation)**
- [PostHog account](https://posthog.com) with [session recordings enabled](https://posthog.com/docs/session-replay/installation) and data collecting
- Node.js 18+ installed locally
- Continue CLI account with **active credits** (required for API usage)
- [Continue CLI](https://docs.continue.dev/guides/cli) with **active credits** (required for API usage)
- [GitHub CLI](https://cli.github.com/) installed (`gh` command)
<Steps>
<Step title="Install Continue CLI">
@ -66,39 +75,38 @@ First, you'll need to gather your PostHog and GitHub API credentials and add the
7. Note your PostHog host URL (e.g., `https://us.posthog.com` or your custom domain)
8. You'll also need your POSTHOG_AUTH_HEADER value, which is simply `Bearer YOUR_API_KEY`
<Tip>
**Find Your Project Details**: Your Project ID is in your PostHog URL:
`https://app.posthog.com/project/YOUR_PROJECT_ID`
</Tip>
<Info>
**Continue Secrets**: The `POSTHOG_AUTH_HEADER` secret should be stored in
Continue's secure secrets storage. This keeps your API key safe and the MCP
automatically connects to your default PostHog project.
</Info>
</Tab>
<Tab title="GitHub Personal Access Token">
You'll need a **Personal Access Token** to create issues in your GitHub repository:
<Tab title="Set Up GitHub CLI Authentication">
GitHub CLI handles authentication automatically - no manual PAT needed:
1. Go to [GitHub Personal Access Tokens](https://github.com/settings/personal-access-tokens/new)
2. Click **"Generate new token (classic)"**
3. Name it "Continue CLI PostHog Analysis"
4. Select these scopes:
- `repo` (or just `public_repo` if your repository is public)
- `issues:write` - **Required** for creating issues
5. Copy the token immediately
1. Install GitHub CLI if not already installed
2. Run `gh auth login` and follow the prompts
3. Choose authentication method (browser or token)
4. Grant necessary permissions when prompted (`issues:write` is **required** for creating issues)
</Tab>
</Tabs>
<Tab title= "Configure API Access in Continue CLI">
<Tip>
See https://docs.continue.dev/hub/secrets/secret-types#secret-types for adding secrets
</Tip>
### Add Secrets to Continue CLI
To add environment variables to your Continue Hub account:
You only need to configure the PostHog MCP credential - it automatically handles project selection. To add environment variables to your Continue Hub account:
1. Go to the [Continue Hub](https://hub.continue.dev)
2. Sign in to your account
3. Navigate to your user settings
4. Look for the "Secrets" section
5. Add your variables there (like POSTHOG_API_KEY, POSTHOG_PROJECT_ID,
POSTHOG_HOST,GITHUB_PAT, etc.)
5. Add your Personal API Key from PostHog (phx_...) as POSTHOG_AUTH_HEADER secret with format: Bearer YOUR_API_KEY
These environment variables will then be securely stored and available for use in
your Continue workflows.
</Tab>
</Tabs>
## PostHog GitHub Continuous AI Workflow Options
@ -107,7 +115,17 @@ your Continue workflows.
optimized prompts, rules, and the PostHog MCP for more consistent results.
</Card>
After completing **Step 1** below, you have two paths to get started:
<Info>
**How PostHog MCP Works**:
- Your API key is tied to your PostHog account and
organization
- It automatically uses your default project (no project ID
needed)
- If you have multiple projects, use `mcp__posthog__switch-project` to
change
- The MCP connects via `https://mcp.posthog.com/sse` using your account context.
</Info>
<Tabs>
<Tab title="⚡ Quick Start (Recommended)">
@ -115,20 +133,16 @@ After completing **Step 1** below, you have two paths to get started:
<Steps>
<Step title="Add the Pre-Built Agent">
Visit the [PostHog GitHub Continuous AI Agent](https://hub.continue.dev/continuedev/awesome-models-posthog-gh) on Continue Hub and click **"Install Agent"**
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:
```bash
cn --config continuedev/awesome-models-posthog-gh
```
This agent includes:
- **Optimized prompts** for PostHog analysis and GitHub issue creation
- **Built-in rules** for consistent formatting and error handling
- **PostHog MCP** for more reliable API interactions
</Step>
<Step title="Verify Your Secrets">
The agent uses these Hub resources automatically:
- **Environment Variables**: [bekahhw/env-vars](https://hub.continue.dev/bekahhw/env-vars)
- **Analysis Rules**: [bekah-hawrot-weigel/posthog-github-continuous-ai-rules](https://hub.continue.dev/bekah-hawrot-weigel/posthog-github-continuous-ai-rules)
- **Analysis Prompt**: [continuedev/posthog-analysis](https://hub.continue.dev/continuedev/posthog-analysis)
- **Issue Creation Prompt**: [continuedev/github-issues](https://hub.continue.dev/continuedev/github-issues)
- **Optimized prompts** for [PostHog analysis](https://hub.continue.dev/continuedev/posthog-analysis) and [GitHub issue creation](https://hub.continue.dev/continuedev/posthog-github-issues)
- **[Built-in rules](https://hub.continue.dev/bekah-hawrot-weigel/posthog-github-continuous-ai-rules)** for consistent formatting and error handling
- **[PostHog MCP](https://hub.continue.dev/posthog/posthog-mcp)** for more reliable API interactions
</Step>
<Step title="Run the Analysis">
@ -148,72 +162,41 @@ After completing **Step 1** below, you have two paths to get started:
</Tab>
<Tab title="🛠️ Manual Setup">
**Perfect for:** Learning the process and customizing prompts.
<Steps>
<Step title="Add PostHog MCP to Continue CLI">
First, install the [PostHog MCP](https://hub.continue.dev/posthog/posthog-mcp) or run:
```bash
npx -y mcp-remote@latest https://mcp.posthog.com/sse --header Authorization:${{ secrets.continuedev/awesome-models-posthog-gh/posthog/posthog-mcp/POSTHOG_AUTH_HEADER }}
```
</Step>
<Step title="Add PostHog + GitHub Analysis Rules">
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.
</Step>
<Step title="Create Your Custom Prompts">
Use this prompt with Continue CLI to analyze PostHog data and create GitHub issues:
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.
```bash
### Run the PostHog Analysis
Use this prompt with Continue CLI to fetch and analyze your PostHog sessions:
```bash
cn -p "I need you to help me analyze PostHog session recordings to identify UX issues. Please:
1. First, fetch session recordings from PostHog using these details:
- Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from my secrets
- API endpoint: {POSTHOG_HOST}/api/projects/{POSTHOG_PROJECT_ID}/session_recordings/?limit=20
- Include Authorization header: 'Bearer {POSTHOG_API_KEY}'
2. Filter the sessions to find problematic ones with either:
- console_error_count > 0 (JavaScript errors)
- recording_duration > 300 (sessions longer than 5 minutes)
3. Analyze the filtered sessions and create exactly 3 GitHub issues for the most critical UX problems.
4. Format each issue like this:
### 1. **Issue Title Here**
**Problem**: One sentence describing the user problem
**Technical Causes**: Brief technical explanation
**Affected Pages**: List the URLs
**Recommended Fix**:
- Specific action item 1
- Specific action item 2
**Priority**: **HIGH** or **MEDIUM** or **LOW**
**Impact**: Quantify the impact (e.g., 'Affects 80% of sessions')
Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data."
```
### Create GitHub Issues from PostHog Analysis
Now use Continue CLI to create GitHub issues from your analysis results:
```bash
cn -p "I have analyzed PostHog session data and identified UX issues. Now I need you to create GitHub issues using the GitHub API.
Use these details from my secrets:
- GITHUB_PAT: My GitHub Personal Access Token
- Repository: Extract from git remote or ask me to specify
For each issue in my analysis:
1. Parse the issue title, body content, and priority level
2. Create a GitHub issue via API POST to: https://api.github.com/repos/{owner}/{repo}/issues
3. Use these headers:
- Authorization: token {GITHUB_PAT}
- Accept: application/vnd.github.v3+json
- Content-Type: application/json
4. Set labels based on priority:
- HIGH: [\"bug\", \"high-priority\", \"user-experience\", \"automated\"]
- MEDIUM: [\"enhancement\", \"medium-priority\", \"user-experience\", \"automated\"]
- LOW: [\"low-priority\", \"user-experience\", \"automated\"]
5. Format the issue title as: \"🔍 UX Issue: {original title}\"
Please create the GitHub issues and confirm they were successfully created with issue numbers and URLs.
"
```
# In cn TUI mode:
"Create GitHub issues from the PostHog analysis using gh CLI:
- For each issue, run: gh issue create --title '🔍 UX Issue: [title]' --body '[details]'
- Add labels: --label 'bug,user-experience,automated'
- Set priority labels (high/medium/low)
- Include session data and technical details in the body
Execute the commands and confirm each issue was created with URL."
```
</Step>
</Steps>
</Tab>
</Tabs>
<Info>
**Why GitHub CLI over GitHub MCP**: While GitHub MCP is available, it can be
token-expensive to run. The `gh` CLI is more efficient, requires no API tokens
(authenticated via `gh auth login`), and provides a cleaner command-line
experience. GitHub MCP remains an option if you prefer full MCP integration.
</Info>
<Accordion title="Agent Requirements">
To use the pre-built agent, you need either:
@ -492,16 +475,17 @@ Consider enhancing your workflow with these advanced Continue CLI prompts:
<CardGroup cols={2}>
<Card title="Performance Analysis" icon="chart-line">
"Analyze PostHog performance metrics alongside session recordings to
identify slow page loads affecting user experience"
"Analyze [PostHog performance
metrics](https://posthog.com/docs/web-analytics) alongside session
recordings to identify slow page loads affecting user experience"
</Card>
<Card title="Error Correlation" icon="bug">
"Cross-reference JavaScript console errors with user actions to identify the
root cause of UX issues"
</Card>
<Card title="Feature Flag Analysis" icon="flag">
"Analyze how PostHog feature flags impact user behavior in session
recordings"
"Analyze how [PostHog feature flags](https://posthog.com/docs/feature-flags)
impact user behavior in session recordings"
</Card>
<Card title="Custom Slack Alerts" icon="slack">
"Create Slack alerts when critical UX issues are detected in PostHog
@ -511,7 +495,19 @@ Consider enhancing your workflow with these advanced Continue CLI prompts:
## Next Steps
1. **Monitor your first issues** - Review the GitHub issues created and implement fixes
2. **Measure impact** - Track how resolved issues improve PostHog metrics
3. **Refine prompts** - Adjust the Continue CLI prompts based on issue quality
4. **Scale the system** - Add more data sources or create specialized analysis workflows
- Consider [GitHub MCP](https://hub.continue.dev/github/github-mcp) as an alternative (note: can be token-expensive)
- Configure [Slack MCP](https://hub.continue.dev/slack/slack-mcp) for alerts
- Set up [PostHog performance monitoring](https://posthog.com/docs/web-analytics)
- Join the [Continue Discord](https://discord.gg/continue) for support
## Resources
- [PostHog API Documentation](https://posthog.com/docs/api)
- [PostHog MCP Documentation](https://posthog.com/docs/model-context-protocol)
- [PostHog Session Replay](https://posthog.com/docs/session-replay)
- [PostHog Feature Flags](https://posthog.com/docs/feature-flags)
- [PostHog Error Tracking](https://posthog.com/docs/error-tracking)
- [GitHub CLI Documentation](https://cli.github.com/)
- [GitHub MCP on Continue Hub](https://hub.continue.dev/github/github-mcp) (alternative option)
- [Continue CLI Guide](https://docs.continue.dev/guides/cli)
- [Continuous AI Best Practices](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)

View file

@ -20,9 +20,74 @@ Before starting, ensure you have:
- [Snyk account](https://snyk.io/) (free tier works)
- A local project to scan for vulnerabilities
For all options, first:
<Steps>
<Step title="Install Continue CLI">
```bash
npm i -g @continuedev/cli
```
</Step>
<Step title="Add Your Project to Snyk">
1. Sign up for a Snyk account at [snyk.io](https://snyk.io/)
2. Create a new project in Snyk by importing your code repository (Git
provider or manual upload)
</Step>
</Steps>
<Warning>
To use agents in headless mode, you need a [Continue API key](https://hub.continue.dev/settings/api-keys).
</Warning>
## Snyk Continuous AI Workflow Options
<Card title="🚀 Fastest Path to Success" icon="zap">
Skip the manual setup and use our pre-built Snyk Continuous AI agent that includes
the Snyk MCP and optimized security scanning workflows for more consistent results.
</Card>
After ensuring you meet the **Prerequisites** above, you have two paths to get started:
<Tabs>
<Tab title="⚡ Quick Start (Recommended)">
<Steps>
<Step title="Load the Pre-Built Agent">
Navigate to your project directory and run:
```bash
cn --config continuedev/snyk-continuous-ai
```
This agent includes:
- **Snyk MCP** pre-configured and ready to use
- **Security-focused rules** for best practices
</Step>
<Step title="Run Your First Security Scan">
Start with a comprehensive security scan:
```bash
# TUI mode
cn -p "Run a complete security scan on this project including code vulnerabilities, dependencies, and any IaC files. Summarize findings by severity."
```
That's it! The agent handles everything automatically.
</Step>
</Steps>
<Info>
**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.
</Info>
</Tab>
<Tab title="🛠️ Manual Setup">
<Steps>
<Step title="Create a New Agent via the Continue Hub">
Go to the [Continue Hub](https://hub.continue.dev) and [create a new agent](https://hub.continue.dev/new?type=agent).
</Step>
<Step title="Connect Snyk MCP via Continue Hub">
Visit the [Snyk MCP on Continue Hub](https://hub.continue.dev/snyk/snyk-mcp) and click **Install** to add it to your Continue account.
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.
This will add Snyk MCP to your agent's available tools. The Hub listing automatically configures the MCP command:
```bash
@ -31,7 +96,7 @@ Before starting, ensure you have:
<Tip>
**Alternative installation methods:**
1. **Quick CLI install**: `cn -p --mcp snyk/snyk-mcp`
1. **Quick CLI install**: `cn --mcp snyk/snyk-mcp`
2. **Manual configuration**: Add the MCP to your `~/.continue/config.json` under the `mcpServers` section
Once installed, Snyk MCP tools become available to your Continue agent for all prompts.
@ -59,35 +124,42 @@ Before starting, ensure you have:
</Step>
<Step title="Authenticate with Snyk">
Use this prompt with your Continue agent to set up authentication:
```
Check Snyk auth status. If not authenticated, authenticate me and confirm my org context.
```
Or use the Continue CLI:
<Step title="Run Your First Security Scan">
Start with a comprehensive security scan:
```bash
cn -p "Check Snyk auth status. If not authenticated, authenticate me and confirm my org context."
# TUI mode
cn "Run a complete security scan on this project including code vulnerabilities, dependencies, and any IaC files. Summarize findings by severity."
```
<Tip>
A browser window will open for Snyk login. After authenticating, approve
the request to trust your project folder when prompted.
</Tip>
</Step>
</Steps>
</Tab>
</Tabs>
<Accordion title="Agent Requirements">
To use the pre-built agent, you need either:
- **Continue CLI Pro Plan** with the models add-on, OR
- **Your own API keys** added to Continue Hub secrets (same as manual setup)
The agent will automatically detect and use your configuration along with the pre-configured Snyk MCP for security scanning operations.
</Accordion>
---
## Security Scanning Recipes
Now you can use natural language prompts to run comprehensive security scans. The Continue agent automatically calls the appropriate Snyk MCP tools.
<Info>
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.
</Info>
<Info>
**Where to run these workflows:**
- **IDE Extensions**: Use Continue in VS Code, JetBrains, or other supported IDEs
- **Terminal (TUI mode)**: Run `cn` to enter interactive mode, then type your prompts
- **CLI (headless mode)**: Use `cn -p "your prompt"` for one-off commands
- **CLI (headless mode)**: Use `cn -p "your prompt"` for headless commands
**Test in Plan Mode First**: Before running security scans that might make
changes, test your prompts in plan mode (see the [Plan Mode
@ -101,14 +173,14 @@ Now you can use natural language prompts to run comprehensive security scans. Th
<Card title="Static Application Security Testing" icon="code">
Scan your source code for security vulnerabilities and code quality issues.
**Example prompt:**
**TUI Mode Prompt:**
```
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.
```
**Using Continue CLI:**
**Headless Mode Prompt:**
```bash
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."
```
@ -120,14 +192,14 @@ cn -p "Run a Snyk Code scan on this repo with severity threshold medium. Summari
<Card title="Software Composition Analysis" icon="cube">
Check open source dependencies for known vulnerabilities.
**Example prompt:**
**TUI Mode Prompt:**
```
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).
```
**Using Continue CLI:**
**Headless Mode Prompt:**
```bash
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)."
```
@ -139,13 +211,13 @@ cn -p "Run Snyk Open Source on this repo (include dev deps). Summarize vulnerabl
<Card title="IaC Security" icon="cloud">
Scan Terraform, CloudFormation, and Kubernetes configs for misconfigurations.
**Example prompt:**
**TUI Mode Prompt:**
```
Scan ./infra with Snyk IaC. Report high/critical misconfigs
with exact files/lines. Provide code changes and re-scan to confirm.
```
**Using Continue CLI:**
**Headless Mode Prompt:**
```bash
cn -p "Scan ./infra with Snyk IaC. Report high/critical misconfigs with exact files/lines. Provide code changes and re-scan to confirm."
```
@ -157,14 +229,14 @@ cn -p "Scan ./infra with Snyk IaC. Report high/critical misconfigs with exact fi
<Card title="Container Security" icon="docker">
Analyze Docker images for vulnerabilities in base images and packages.
**Example prompt:**
**TUI Mode Prompt:**
```
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).
```
**Using Continue CLI:**
**Headless Mode Prompt:**
```bash
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)."
```
@ -176,13 +248,13 @@ cn -p "Scan image my-api:latest. Exclude base image vulns. Print dependency tree
<Card title="Changed Files Only" icon="code-branch">
Focus scanning on modified files to catch issues before merging.
**Example prompt:**
**TUI Mode Prompt:**
```
Scan only files changed since origin/main with Snyk Code.
Block if new high issues would be introduced. Show deltas.
```
**Using Continue CLI:**
**Headless Mode Prompt:**
```bash
cn -p "Scan only files changed since origin/main with Snyk Code. Block if new high issues would be introduced. Show deltas."
```
@ -194,12 +266,12 @@ cn -p "Scan only files changed since origin/main with Snyk Code. Block if new hi
<Card title="Snyk Learn Integration" icon="graduation-cap">
Access security education resources based on identified vulnerabilities ([CWE](https://cwe.mitre.org/)).
**Example prompt:**
**TUI Mode Prompt:**
```
Open Snyk Learn lessons related to the top CWE(s) from this scan.
```
**Using Continue CLI:**
**Headless Mode Prompt:**
```bash
cn -p "Open Snyk Learn lessons related to the top CWE(s) from this scan."
```
@ -208,7 +280,7 @@ cn -p "Open Snyk Learn lessons related to the top CWE(s) from this scan."
## Continuous Security with GitHub Actions
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.
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.
### Add GitHub Secrets
@ -249,8 +321,10 @@ jobs:
echo "✅ Continue CLI installed"
- name: Authenticate Continue CLI
env:
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
run: |
cn auth login --api-key "${{ secrets.CONTINUE_API_KEY }}"
cn auth login --api-key "$CONTINUE_API_KEY"
echo "✅ Continue CLI authenticated"
- name: Run Security Scans

View file

@ -8,7 +8,8 @@ sidebarTitle: "Create an AI Agent"
To create an agent from scratch, select “New agent” in the top bar.
![New agent button](/images/hub/assistants/images/assistant-new-button-16070e2cff9ce25ec9ebfeecb0e2f2b5.png)
![New agent button](/images/hub/new-agent-button.png)
Choose a name, slug, description, and icon for your agent.
@ -24,7 +25,7 @@ You can also create an agent by remixing an existing one. This is useful if you
By clicking the “remix” button, you’ll be taken to the “Create a remix” page.
![Remix Agent Button](/images/hub/assistants/images/assistant-remix-button-728ececa73983140eeab42e33cc3903b.png)
![Remix Agent Button](/images/hub/agent-remix-button.png)
Once here, you’ll be able to

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 MiB

After

Width:  |  Height:  |  Size: 6.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View file

@ -1,55 +1,148 @@
---
title: "Introduction"
title: "Welcome to Continue"
icon: book-open
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"
description: "Practice Continuous AI with an open-source CLI, open-source IDE extensions, and a Hub for custom AI coding agents"
---
<Frame>
<img src="/images/intro-0c302b9c15b890c251b1ad04586c880f.png" />
</Frame>
**Continue enables developers to ship faster with Continuous AI.**
<Note>
**Build faster with AI across your IDE, terminal, and CI/CD pipelines with
Continue.**
</Note>
**You can use Continue to build and run custom agents across your IDE, terminal, and CI.**
## Continue CLI
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
<Info>Terminal-native AI coding assistance with TUI and headless modes.</Info>
2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback
<CodeGroup>
3. Discover models, rules, and MCP tools on [Continue Hub](https://hub.continue.dev/)
```bash npm
npm install -g @continuedev/cli
```
```bash yarn
yarn global add @continuedev/cli
```
```bash pnpm
pnpm add -g @continuedev/cli
```
</CodeGroup>
<CardGroup cols={2}>
<Card
title="Agent"
icon="robot"
href="/features/agent/quick-start"
horizontal
title="TUI Mode"
icon="terminal"
href="/cli/overview#tui-mode%3A-interactive-development"
>
to work on development tasks together with AI
Interactive terminal interface for development workflows
<br />
<sub>• Automate builds & refactoring</sub>
<br />
<sub>• Pre-commit hooks & scripted fixes</sub>
<br />
<sub>• Terminal-first development</sub>
</Card>
<Card
title="Chat"
icon="messages"
href="/features/chat/quick-start"
horizontal
title="Headless Mode"
icon="server"
href="/cli/overview#headless-mode%3A-production-automation"
>
to ask general questions and clarify code sections
Automated AI coding for CI/CD and server environments
<br />
<sub>• Run in CI/CD pipelines</sub>
<br />
<sub>• Batch processing & bulk operations</sub>
<br />
<sub>• Server & container deployments</sub>
</Card>
</CardGroup>
## IDE Extensions
<Info>
**Complement your CLI workflow** - Rich editor integrations for interactive
development.
</Info>
<CardGroup cols={2}>
<Card
title="VS Code"
icon="code"
href="https://marketplace.visualstudio.com/items?itemName=Continue.continue"
>
Install from VS Code Marketplace
<br />
<sub>Real-time coding assistance and refactoring</sub>
</Card>
<Card
title="Edit"
icon="pen-to-square"
href="/features/edit/quick-start"
horizontal
title="JetBrains"
icon="jet-fighter"
href="https://plugins.jetbrains.com/plugin/22707-continue-extension"
>
to modify a code section without leaving your current file
Install from JetBrains Plugin Repository
<br />
<sub>Autocomplete and multi-file edits</sub>
</Card>
</CardGroup>
## Core Features
<CardGroup cols={2}>
<Card title="Agent" icon="robot" href="/features/agent/quick-start">
Multi-step workflows and complex task automation
</Card>
<Card title="Chat" icon="messages" href="/features/chat/quick-start">
Ask questions and explore your codebase
</Card>
<Card title="Edit" icon="pen-to-square" href="/features/edit/quick-start">
In-place code editing without breaking flow
</Card>
<Card
title="Autocomplete"
icon="sparkles"
href="/features/autocomplete/quick-start"
horizontal
>
to receive inline code suggestions as you type
Inline AI suggestions as you type
</Card>
</CardGroup>
## Configuration
<CardGroup cols={3}>
<Card title="Models" icon="brain" href="/customization/models">
Connect your preferred AI models
</Card>
<Card title="Rules" icon="shield" href="/customization/rules">
Configure AI behavior and constraints
</Card>
<Card title="MCPs" icon="wrench" href="/customization/mcp-tools">
Extend functionality with MCP tools
</Card>
</CardGroup>
## Resources
<CardGroup cols={3}>
<Card title="Continue Hub" icon="globe" href="https://hub.continue.dev/">
Community models, rules, and tools
</Card>
<Card
title="GitHub Discussions"
icon="comments"
href="https://github.com/continuedev/continue/discussions"
>
Get help from the community
</Card>
<Card
title="CLI Examples"
icon="code-branch"
href="/guides/overview#continuous-ai"
>
TUI and headless workflow examples
</Card>
</CardGroup>

View file

@ -1,136 +1,23 @@
---
title: "config.yaml Reference"
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."
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."
---
## Introduction
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
Continue Agents are defined using the `config.yaml` specification.
- [Continue Hub](https://hub.continue.dev/explore/agents) - YAML is stored on the hub and automatically synced to the extension
**Agents** are composed of models, rules, and tools (MCP servers).
- Locally
- 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`
- in your workspace in a `/.continue/agents` folder, with the same naming convention
<Columns cols={2}>
<Card title="Configuring Models, Rules, and Tools" icon="cube" href="/guides/configuring-models-rules-tools">
Learn how to work with Continue's configuration system, including using hub models, rules, and tools, creating local configurations, and organizing your setup.
</Card>
<Info>
Config YAML replaces `config.json`, which is deprecated. View the **[Migration
Guide](/reference/yaml-migration)**.
</Info>
An agent is made up of:
1. **Top level properties**, which specify the `name`, `version`, and `config.yaml` `schema` for the agent
2. **Block lists**, which are composable arrays of coding agent building blocks available to the agent, such as models, docs, and context providers.
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.
Examples of blocks and agents can be found on the [Continue Hub](https://hub.continue.dev).
Agents can either explicitly define blocks - see [Properties](#properties) below - or import and configure existing hub blocks.
### Using Blocks
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).
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.
For example, the following agent imports an Anthropic model and defines an Ollama DeepSeek one.
Agent models section
```yaml
name: Team Agent
version: 1.0.0
schema: v1
models:
- uses: anthropic/claude-3.5-sonnet # an imported model block
- model: deepseek-reasoner # an explicit model block
provider: ollama
```
### Local Blocks
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).
Place your YAML files in the following folders:
Agents:
- `.continue/agents` - for agents
Blocks:
- `.continue/rules` - for rules
- `.continue/models` - for models
- `.continue/prompts` - for prompts
- `.continue/context` - for context providers
- `.continue/docs` - for docs
- `.continue/data` - for data
- `.continue/mcpServers` - for MCP Servers
You can find many examples of each of these block types on the [Continue Explore Page](https://hub.continue.dev/explore/models)
<Info>
Local blocks utilizing mustache notation for secrets (`${{ secrets.SECRET_NAME }}`) can read secret values:
- globally, from a `.env` located in the global `.continue` folder (`~/.continue/.env`)
- per-workspace, from a `.env` file located at the root of the current workspace.
</Info>
### Inputs
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:
```yaml title="config.yaml"
name: myprofile/custom-model
version: 1.0.0
schema: v1
models:
- name: My Favorite Model
provider: anthropic
apiKey: ${{ inputs.ANTHROPIC_API_KEY }}
defaultCompletionOptions:
temperature: ${{ inputs.TEMP }}
```
Which can then be imported like this:
```yaml title="config.yaml"
name: myprofile/custom-agent
version: 1.0.0
schema: v1
models:
- uses: myprofile/custom-model
with:
ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }}
TEMP: 0.9
```
Note that hub secrets can be passed as inputs, using a similar mustache format: `secrets.SECRET_NAME`.
### Overrides
Block properties can be also be directly overriden using `override`. For example:
```yaml title="config.yaml"
name: myprofile/custom-agent
version: 1.0.0
schema: v1
models:
- uses: myprofile/custom-model
with:
ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }}
TEMP: 0.9
override:
roles:
- chat
```
<Card title="Understanding Agents" icon="robot" href="/guides/understanding-agents">
Learn how to build and configure agents, understand their capabilities, and customize them for your development workflow.
</Card>
</Columns>
## Properties
@ -566,3 +453,9 @@ models:
maxPromptTokens: 1024
onlyMyCode: true
```
---
## `config.json` Deprecation
`config.yaml `replaces `config.json`, which is deprecated. View the **[Migration Guide](/reference/yaml-migration)** for help transitioning from the old format.

View file

@ -1,9 +1,11 @@
import { type AssistantConfig } from "@continuedev/sdk";
import { createRelativeRuleFilePath } from "core/config/markdown/utils.js";
import { SlashCommandResult } from "../ui/hooks/useChat.types.js";
function createInitPrompt(): string {
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.
const relativeRuleFilepath = createRelativeRuleFilePath("review");
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.
Create an AGENTS.md file with the following structure:
@ -30,7 +32,23 @@ Create an AGENTS.md file with the following structure:
- Development environment setup
- Lint and format commands
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.`;
Additionally, create a slash command file at ${relativeRuleFilepath} with the following structure:
\`\`\`md
---
invokable: true
---
Review this code for potential issues, including:
<insert custom things to look for based on the repository details you find>
Provide specific, actionable feedback for improvements.
\`\`\`
This slash command will be invokable using /review and will provide instructions for code review tasks common to this repository.
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.`;
}
export async function handleInit(

View file

@ -22,13 +22,27 @@ export const listFilesTool: Tool = {
readonly: true,
isBuiltIn: true,
preprocess: async (args) => {
// Resolve relative paths
const normalizedPath = path.normalize(args.dirpath);
const dirPath = path.resolve(process.cwd(), normalizedPath);
if (!fs.existsSync(dirPath)) {
throw new Error(`Directory does not exist: ${dirPath}`);
}
if (!fs.statSync(dirPath).isDirectory()) {
throw new Error(`Error: Path is not a directory: ${dirPath}`);
}
return {
args,
args: {
dirpath: dirPath,
},
preview: [
{
type: "text",
content: args.dirpath
? `Will list files in: ${formatToolArgument(args.dirpath)}`
content: dirPath
? `Will list files in: ${formatToolArgument(dirPath)}`
: "Will list files in current directory",
},
],
@ -36,14 +50,6 @@ export const listFilesTool: Tool = {
},
run: async (args: { dirpath: string }): Promise<string> => {
try {
if (!fs.existsSync(args.dirpath)) {
return `Error: Directory does not exist: ${args.dirpath}`;
}
if (!fs.statSync(args.dirpath).isDirectory()) {
return `Error: Path is not a directory: ${args.dirpath}`;
}
const files = fs.readdirSync(args.dirpath);
const fileDetails = files.map((file) => {
const fullPath = path.join(args.dirpath, file);

View file

@ -0,0 +1,63 @@
import { render } from "ink-testing-library";
import React from "react";
import { ChecklistDisplay } from "./ChecklistDisplay.js";
describe("ChecklistDisplay", () => {
it("should highlight the first incomplete item", () => {
const content = `Task list status:
- [x] Completed task
- [ ] First incomplete task
- [ ] Second incomplete task`;
const { lastFrame } = render(<ChecklistDisplay content={content} />);
const output = lastFrame();
// The output should contain the checkbox symbols and text
expect(output).toContain("✓");
expect(output).toContain("○");
expect(output).toContain("Completed task");
expect(output).toContain("First incomplete task");
expect(output).toContain("Second incomplete task");
});
it("should handle empty checklist", () => {
const content = "Task list status:";
const { lastFrame } = render(<ChecklistDisplay content={content} />);
const output = lastFrame();
expect(output).toBeDefined();
});
it("should handle all completed tasks", () => {
const content = `Task list status:
- [x] Completed task 1
- [x] Completed task 2`;
const { lastFrame } = render(<ChecklistDisplay content={content} />);
const output = lastFrame();
expect(output).toContain("✓");
expect(output).toContain("Completed task 1");
expect(output).toContain("Completed task 2");
});
it("should handle mixed content with headers", () => {
const content = `Task list status:
## Important Tasks
- [x] Done task
- [ ] Todo task
## Other Tasks
- [ ] Another todo`;
const { lastFrame } = render(<ChecklistDisplay content={content} />);
const output = lastFrame();
expect(output).toContain("Important Tasks");
expect(output).toContain("Other Tasks");
expect(output).toContain("✓");
expect(output).toContain("○");
});
});

View file

@ -13,6 +13,17 @@ export const ChecklistDisplay: React.FC<ChecklistDisplayProps> = ({
}) => {
const lines = content.split("\n");
// Find the index of the first incomplete checkbox item
let firstIncompleteIndex = -1;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const checkboxMatch = line.match(/^(\s*)-\s*\[([ x])\]\s*(.*)$/);
if (checkboxMatch && checkboxMatch[2] === " ") {
firstIncompleteIndex = i;
break;
}
}
return (
<Box flexDirection="column" paddingLeft={2}>
{lines.map((line, index) => {
@ -25,6 +36,7 @@ export const ChecklistDisplay: React.FC<ChecklistDisplayProps> = ({
if (checkboxMatch) {
const [, indent, status, taskText] = checkboxMatch;
const isCompleted = status === "x";
const isFirstIncomplete = index === firstIncompleteIndex;
return (
<Box key={index}>
@ -34,8 +46,11 @@ export const ChecklistDisplay: React.FC<ChecklistDisplayProps> = ({
</Text>
<Text> </Text>
<Text
color={isCompleted ? "gray" : "white"}
color={
isCompleted ? "gray" : isFirstIncomplete ? "cyan" : "white"
}
strikethrough={isCompleted}
bold={isFirstIncomplete}
>
{taskText}
</Text>

View file

@ -1,5 +1,5 @@
pluginGroup=com.github.continuedev.continueintellijextension
pluginVersion=1.0.45
pluginVersion=1.0.46
platformVersion=2024.1
kotlin.stdlib.default.dependency=false
org.gradle.configuration-cache=true

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "1.3.10",
"version": "1.3.12",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "1.3.10",
"version": "1.3.12",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "file:../../packages/config-types",
@ -12881,9 +12881,9 @@
}
},
"node_modules/tar-fs": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.2.tgz",
"integrity": "sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz",
"integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==",
"license": "MIT",
"dependencies": {
"chownr": "^1.1.1",
@ -12981,9 +12981,9 @@
}
},
"node_modules/targz/node_modules/tar-fs": {
"version": "1.16.4",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.4.tgz",
"integrity": "sha512-u3XczWoYAIVXe5GOKK6+VeWaHjtc47W7hyuTo3+4cNakcCcuDmlkYiiHEsECwTkcI3h1VUgtwBQ54+RvY6cM4w==",
"version": "1.16.6",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.6.tgz",
"integrity": "sha512-JkOgFt3FxM/2v2CNpAVHqMW2QASjc/Hxo7IGfNd3MHaDYSW/sBFiS7YVmmhmr8x6vwN1VFQDQGdT2MWpmIuVKA==",
"dev": true,
"license": "MIT",
"dependencies": {

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "1.3.12",
"version": "1.3.13",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
@ -373,6 +373,12 @@
"category": "Continue",
"title": "Generate Rule",
"group": "Continue"
},
{
"command": "continue.openInNewWindow",
"category": "Continue",
"title": "Open in new window",
"group": "Continue"
}
],
"keybindings": [
@ -443,6 +449,12 @@
"mac": "cmd+shift+r",
"key": "ctrl+shift+r"
},
{
"command": "continue.openInNewWindow",
"mac": "cmd+k cmd+m",
"key": "ctrl+k ctrl+m",
"when": "!terminalFocus"
},
{
"command": "continue.toggleTabAutocompleteEnabled",
"mac": "cmd+k cmd+a",
@ -512,6 +524,9 @@
},
{
"command": "continue.generateRule"
},
{
"command": "continue.openInNewWindow"
}
],
"editor/context": [

View file

@ -46,6 +46,15 @@ import { getMetaKeyLabel } from "./util/util";
import { openEditorAndRevealRange } from "./util/vscode";
import { VsCodeIde } from "./VsCodeIde";
let fullScreenPanel: vscode.WebviewPanel | undefined;
function getFullScreenTab() {
const tabs = vscode.window.tabGroups.all.flatMap((tabGroup) => tabGroup.tabs);
return tabs.find((tab) =>
(tab.input as any)?.viewType?.endsWith("continue.continueGUIView"),
);
}
type TelemetryCaptureParams = Parameters<typeof Telemetry.capture>;
/**
@ -59,15 +68,27 @@ function captureCommandTelemetry(
}
function focusGUI() {
// focus sidebar
vscode.commands.executeCommand("continue.continueGUIView.focus");
// vscode.commands.executeCommand("workbench.action.focusAuxiliaryBar");
const fullScreenTab = getFullScreenTab();
if (fullScreenTab) {
// focus fullscreen
fullScreenPanel?.reveal();
} else {
// focus sidebar
vscode.commands.executeCommand("continue.continueGUIView.focus");
// vscode.commands.executeCommand("workbench.action.focusAuxiliaryBar");
}
}
function hideGUI() {
// focus sidebar
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
// vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar");
const fullScreenTab = getFullScreenTab();
if (fullScreenTab) {
// focus fullscreen
fullScreenPanel?.dispose();
} else {
// focus sidebar
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
// vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar");
}
}
function waitForSidebarReady(
@ -602,6 +623,11 @@ const getCommandsMap: (
label: "$(comment) Open chat",
description: getMetaKeyLabel() + " + L",
},
{
label: "$(screen-full) Open full screen chat",
description:
getMetaKeyLabel() + " + K, " + getMetaKeyLabel() + " + M",
},
{
label: quickPickStatusText(targetStatus),
description:
@ -644,6 +670,8 @@ const getCommandsMap: (
}
} else if (selectedOption === "$(comment) Open chat") {
vscode.commands.executeCommand("continue.focusContinueInput");
} else if (selectedOption === "$(screen-full) Open full screen chat") {
vscode.commands.executeCommand("continue.openInNewWindow");
} else if (selectedOption === "$(gear) Open settings") {
vscode.commands.executeCommand("continue.navigateTo", "/config");
}
@ -770,6 +798,74 @@ const getCommandsMap: (
vscode.ConfigurationTarget.Global,
);
},
"continue.openInNewWindow": async () => {
focusGUI();
const sessionId = await sidebar.webviewProtocol.request(
"getCurrentSessionId",
undefined,
);
// Check if full screen is already open by checking open tabs
const fullScreenTab = getFullScreenTab();
if (fullScreenTab && fullScreenPanel) {
// Full screen open, but not focused - focus it
fullScreenPanel.reveal();
return;
}
// Clear the sidebar to prevent overwriting changes made in fullscreen
vscode.commands.executeCommand("continue.newSession");
// Full screen not open - open it
captureCommandTelemetry("openInNewWindow");
// Create the full screen panel
let panel = vscode.window.createWebviewPanel(
"continue.continueGUIView",
"Continue",
vscode.ViewColumn.One,
{
retainContextWhenHidden: true,
enableScripts: true,
},
);
fullScreenPanel = panel;
// Add content to the panel
panel.webview.html = sidebar.getSidebarContent(
extensionContext,
panel,
undefined,
undefined,
true,
);
const sessionLoader = panel.onDidChangeViewState(() => {
vscode.commands.executeCommand("continue.newSession");
if (sessionId) {
vscode.commands.executeCommand(
"continue.focusContinueSessionId",
sessionId,
);
}
panel.reveal();
sessionLoader.dispose();
});
// When panel closes, reset the webview and focus
panel.onDidDispose(
() => {
sidebar.resetWebviewProtocolWebview();
vscode.commands.executeCommand("continue.focusContinueInput");
},
null,
extensionContext.subscriptions,
);
vscode.commands.executeCommand("workbench.action.copyEditorToNewWindow");
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
},
"continue.forceNextEdit": async () => {
captureCommandTelemetry("forceNextEdit");

View file

@ -113,6 +113,9 @@ export class VsCodeMessenger {
this.onWebview("focusEditor", (msg) => {
vscode.commands.executeCommand("workbench.action.focusActiveEditorGroup");
});
this.onWebview("toggleFullScreen", (msg) => {
vscode.commands.executeCommand("continue.openInNewWindow");
});
this.onWebview("acceptDiff", async ({ data: { filepath, streamId } }) => {
await vscode.commands.executeCommand(

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View file

@ -48,9 +48,7 @@ export function SelectedAssistantButton({
) : (
<>
<AssistantIcon assistant={selectedProfile} size={iconSize} />
<span
className={`select-none truncate text-xs ${isSidebar && "hidden md:block"}`}
>
<span className={`xs:line-clamp-1 hidden select-none text-xs`}>
{selectedProfile.title}
</span>
</>

View file

@ -150,7 +150,7 @@ export function AssistantAndOrgListbox({
/>
<Transition>
<ListboxOptions
className="max-h-32 -translate-x-1.5 overflow-y-auto pb-0"
className="max-h-32 scale-x-[97%] overflow-y-auto pb-0"
style={{ zIndex: 200 }}
>
<div className="flex items-center justify-between px-1.5 py-1">

View file

@ -141,7 +141,7 @@ export default function MermaidDiagram({ code }: { code: string }) {
{!!error ? (
<div className="text-error whitespace-pre text-sm">{error}</div>
) : (
<div className="relative">
<div className="mermaid relative">
<div className="absolute right-0 z-10 m-2 flex items-center gap-x-1">
<ToolTip content={"Zoom In"}>
<MagnifyingGlassPlusIcon

View file

@ -84,6 +84,26 @@ const StyledMarkdown = styled.div<{
font-family: var(--vscode-editor-font-family);
}
ul ul,
ul ol,
ol ul,
ol ol {
padding-left: 1.5em;
margin-top: 1em;
}
li {
margin-bottom: 0.8em;
}
li:last-child {
margin-bottom: 0;
}
ul,
ol {
padding-left: 2em;
}
code:not(pre > code) {
font-family: var(--vscode-editor-font-family);
}

View file

@ -1038,3 +1038,6 @@ body[data-color-mode*="light"] {
.token.entity {
cursor: help;
}
.mermaid foreignObject {
width: 100%;
}

View file

@ -56,7 +56,6 @@ function InputToolbar(props: InputToolbarProps) {
const hasReasoningEnabled = useAppSelector(
(store) => store.session.hasReasoningEnabled,
);
const isEnterDisabled =
props.disabled || (isInEdit && codeToEdit.length === 0);

View file

@ -105,7 +105,7 @@ export function BlockSettingsTopToolbar() {
};
return (
<div className="flex flex-1 items-center justify-between gap-1.5">
<div className="flex flex-1 items-center justify-between gap-3">
<div className="flex items-center gap-1">
{shouldShowError && (
<ToolTip delayShow={700} content="View configuration errors">

View file

@ -12,6 +12,7 @@ import { callToolById } from "../../../../redux/thunks/callToolById";
import { cancelStream } from "../../../../redux/thunks/cancelStream";
import { logToolUsage } from "../../../../redux/util";
import { isJetBrains } from "../../../../util";
import { useMainEditor } from "../../TipTapEditor";
import { BlockSettingsTopToolbar } from "./BlockSettingsTopToolbar";
import { EditOutcomeToolbar } from "./EditOutcomeToolbar";
import { EditToolbar } from "./EditToolbar";
@ -64,6 +65,7 @@ export function LumpToolbar() {
(state) => state.status === "done",
);
const isApplying = applyStates.some((state) => state.status === "streaming");
const editor = useMainEditor();
// Get ALL running terminal commands
const runningToolCalls = useAppSelector((state) =>
@ -140,7 +142,10 @@ export function LumpToolbar() {
// Stop running terminal commands
void handleStopAction();
} else if (firstPendingToolCall) {
// Cancel pending tool call
// Cancel pending tool call. If last call, focus editor
if (pendingToolCalls.length === 1) {
editor.mainEditor?.commands.focus();
}
void dispatch(
cancelToolCall({
toolCallId: firstPendingToolCall.toolCallId,
@ -155,7 +160,13 @@ export function LumpToolbar() {
return () => {
document.removeEventListener("keydown", handleToolCallKeyboardShortcuts);
};
}, [firstPendingToolCall, hasRunningTerminalCommand, runningTerminalCalls]);
}, [
firstPendingToolCall,
pendingToolCalls,
editor,
hasRunningTerminalCommand,
runningTerminalCalls,
]);
if (isApplying) {
return <IsApplyingToolbar />;

View file

@ -4,6 +4,7 @@ import { callToolById } from "../../../../redux/thunks/callToolById";
import { cancelToolCallThunk } from "../../../../redux/thunks/cancelToolCall";
import { getAltKeyLabel, getMetaKeyLabel, isJetBrains } from "../../../../util";
import { Button } from "../../../ui";
import { useMainEditor } from "../../TipTapEditor";
export const generateToolCallButtonTestId = (
action: "accept" | "reject",
@ -16,6 +17,7 @@ export function PendingToolCallToolbar() {
const dispatch = useAppDispatch();
const jetbrains = isJetBrains();
const pendingToolCalls = useAppSelector(selectPendingToolCalls);
const editor = useMainEditor();
if (pendingToolCalls.length === 0) {
return null;
@ -26,6 +28,10 @@ export function PendingToolCallToolbar() {
};
const handleReject = (toolCallId: string) => {
// put cursor in editor after last rejection
if (pendingToolCalls.length === 1) {
editor.mainEditor?.commands.focus();
}
void dispatch(cancelToolCallThunk({ toolCallId }));
};

View file

@ -5,17 +5,15 @@ import {
CubeIcon,
PlusIcon,
} from "@heroicons/react/24/outline";
import { useContext, useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { useNavigate } from "react-router-dom";
import { useAuth } from "../../context/Auth";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { AddModelForm } from "../../forms/AddModelForm";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import { updateSelectedModelByRole } from "../../redux/thunks/updateSelectedModelByRole";
import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
import { CONFIG_ROUTES } from "../../util/navigation";
import { ToolTip } from "../gui/Tooltip";
import {
Button,
Listbox,
@ -52,6 +50,15 @@ function modelSelectTitle(model: any): string {
return model?.class_name;
}
/**makeshift way to close the headlessui listbox due to absence of open state on the listbox */
function closeDropDown(button: HTMLButtonElement | null) {
if (!button) return;
button.classList.add("hidden");
setTimeout(() => {
button.classList.remove("hidden");
});
}
function ModelOption({
option,
idx,
@ -117,7 +124,6 @@ function ModelSelect() {
const isInEdit = useAppSelector((store) => store.session.isInEdit);
const config = useAppSelector((state) => state.config.config);
const isConfigLoading = useAppSelector((state) => state.config.loading);
const ideMessenger = useContext(IdeMessengerContext);
const buttonRef = useRef<HTMLButtonElement>(null);
const [options, setOptions] = useState<Option[]>([]);
const [sortedOptions, setSortedOptions] = useState<Option[]>([]);
@ -201,10 +207,8 @@ function ModelSelect() {
e.stopPropagation();
e.preventDefault();
// Close the dropdown
if (buttonRef.current) {
buttonRef.current.click();
}
closeDropDown(buttonRef.current);
dispatch(setShowDialog(true));
dispatch(
setDialogMessage(
@ -221,10 +225,7 @@ function ModelSelect() {
e.stopPropagation();
e.preventDefault();
// Close the dropdown
if (buttonRef.current) {
buttonRef.current.click();
}
closeDropDown(buttonRef.current);
navigate(CONFIG_ROUTES.MODELS);
}

View file

@ -40,7 +40,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
className={cn(
"cursor-pointer transition-all duration-200",
"hover:enabled:cursor-pointer",
"disabled:text-description-muted disabled:pointer-events-none disabled:opacity-50",
"disabled:cursor-not-allowed disabled:opacity-50",
buttonVariants[variant],
isIcon
? iconButtonSizes[size]

View file

@ -10,6 +10,7 @@ import {
LLMInteractionSuccess,
} from "core";
import { useEffect, useReducer } from "react";
import { v4 as uuidv4 } from "uuid";
declare const vscode: any;
@ -231,7 +232,7 @@ export default function useLLMLog() {
// messages from the previous generation. In particular, this
// avoids problems when React.StrictMode runs this effect
// twice - we don't want to process two "init" messages.
const uuid = crypto.randomUUID();
const uuid = uuidv4();
const onMessage = (event: MessageEvent<ToConsoleView>) => {
if (event.data.uuid !== uuid) {
return;

View file

@ -1585,14 +1585,83 @@ export const models: { [key: string]: ModelPackage } = {
providerOptions: ["scaleway", "nebius", "ovhcloud", "ncompass"],
isOpenSource: true,
},
grokBeta: {
title: "Grok Beta",
description: "Generative artificial intelligence chatbot developed by xAI.",
refUrl: "",
grokCodeFast1: {
title: "Grok Code Fast 1",
description:
"A speedy and economical reasoning model that excels at agentic coding",
refUrl: "https://docs.x.ai/docs/models/grok-code-fast-1",
params: {
title: "Grok Beta",
model: "grok-beta",
contextLength: 128_000,
title: "Grok Code Fast 1",
model: "grok-code-fast-1",
contextLength: 256000,
},
icon: "xAI.png",
providerOptions: ["xAI", "askSage"],
isOpenSource: false,
},
grok4FastReasoning: {
title: "Grok 4 Fast Reasoning",
description: "xAI's latest advancement in cost-efficient reasoning models",
refUrl: "https://docs.x.ai/docs/models/grok-4-fast-reasoning",
params: {
title: "Grok 4 Fast Reasoning",
model: "grok-4-fast-reasoning",
contextLength: 2_000_000,
},
icon: "xAI.png",
providerOptions: ["xAI", "askSage"],
isOpenSource: false,
},
grok4FastNonReasoning: {
title: "Grok 4 Fast Non-Reasoning",
description: "xAI's latest advancement in cost-efficient models",
refUrl: "https://docs.x.ai/docs/models/grok-4-fast-non-reasoning",
params: {
title: "Grok 4 Fast Non-Reasoning",
model: "grok-4-fast-non-reasoning",
contextLength: 2_000_000,
},
icon: "xAI.png",
providerOptions: ["xAI", "askSage"],
isOpenSource: false,
},
grok4: {
title: "Grok 4",
description:
"xAI's latest and greatest flagship model, offering strong performance in natural language, math and reasoning.",
refUrl: "https://docs.x.ai/docs/models/grok-4",
params: {
title: "Grok 4",
model: "grok-4",
contextLength: 256_000,
},
icon: "xAI.png",
providerOptions: ["xAI", "askSage"],
isOpenSource: false,
},
grok3: {
title: "Grok 3",
description:
"Excels at enterprise use cases like data extraction, coding, and text summarization",
refUrl: "https://docs.x.ai/docs/models/grok-3",
params: {
title: "Grok 3",
model: "grok-3",
contextLength: 131_072,
},
icon: "xAI.png",
providerOptions: ["xAI", "askSage"],
isOpenSource: false,
},
grok3Mini: {
title: "Grok 3 Mini",
description:
"A lightweight model that thinks before responding. Fast, smart, and great for logic-based tasks that do not require deep domain knowledge.",
refUrl: "https://docs.x.ai/docs/models/grok-3-mini",
params: {
title: "Grok 3 Mini",
model: "grok-3-mini",
contextLength: 131_072,
},
icon: "xAI.png",
providerOptions: ["xAI", "askSage"],
@ -1836,4 +1905,380 @@ export const models: { [key: string]: ModelPackage } = {
providerOptions: [],
isOpenSource: false,
},
// CometAPI Models
// GPT series models via CometAPI
cometapiGpt5ChatLatest: {
title: "GPT-5 Chat Latest",
description:
"GPT-5 Chat Latest via CometAPI - OpenAI's most advanced conversational model.",
params: {
model: "gpt-5-chat-latest",
contextLength: 400_000,
title: "GPT-5 Chat Latest",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGpt5Mini: {
title: "GPT-5 Mini",
description:
"GPT-5 Mini via CometAPI - compact version of GPT-5 optimized for efficiency.",
params: {
model: "gpt-5-mini",
contextLength: 400_000,
title: "GPT-5 Mini",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGpt5: {
title: "GPT-5",
description:
"GPT-5 via CometAPI - OpenAI's flagship model with advanced reasoning capabilities.",
params: {
model: "gpt-5",
contextLength: 200_000,
title: "GPT-5",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiChatgpt4oLatest: {
title: "ChatGPT-4o Latest",
description:
"ChatGPT-4o Latest via CometAPI - latest version of GPT-4o with enhanced capabilities.",
params: {
model: "chatgpt-4o-latest",
contextLength: 128_000,
title: "ChatGPT-4o Latest",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGpt41: {
title: "GPT-4.1",
description:
"GPT-4.1 via CometAPI - enhanced version of GPT-4.1 with improved reasoning.",
params: {
model: "gpt-4.1",
contextLength: 100_000,
title: "GPT-4.1",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiO4Mini: {
title: "O4 Mini",
description:
"O4 Mini via CometAPI - OpenAI's reasoning model optimized for efficiency.",
params: {
model: "o4-mini-2025-04-16",
contextLength: 200_000,
title: "O4 Mini",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiO3Pro: {
title: "O3 Pro",
description:
"O3 Pro via CometAPI - advanced reasoning model with enhanced problem-solving capabilities.",
params: {
model: "o3-pro-2025-06-10",
contextLength: 200_000,
title: "O3 Pro",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
// Claude series models via CometAPI
cometapiClaudeOpus41: {
title: "Claude Opus 4.1",
description:
"Claude Opus 4.1 via CometAPI - Anthropic's most capable model with advanced reasoning.",
params: {
model: "claude-opus-4-1-20250805",
contextLength: 200_000,
title: "Claude Opus 4.1",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiClaudeOpus41Thinking: {
title: "Claude Opus 4.1 Thinking",
description:
"Claude Opus 4.1 Thinking via CometAPI - version with enhanced thinking capabilities.",
params: {
model: "claude-opus-4-1-20250805-thinking",
contextLength: 200_000,
title: "Claude Opus 4.1 Thinking",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiClaudeSonnet4: {
title: "Claude Sonnet 4",
description:
"Claude Sonnet 4 via CometAPI - balanced performance and efficiency from Anthropic.",
params: {
model: "claude-sonnet-4-20250514",
contextLength: 200_000,
title: "Claude Sonnet 4",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiClaudeSonnet4Thinking: {
title: "Claude Sonnet 4 Thinking",
description:
"Claude Sonnet 4 Thinking via CometAPI - version with enhanced reasoning capabilities.",
params: {
model: "claude-sonnet-4-20250514-thinking",
contextLength: 200_000,
title: "Claude Sonnet 4 Thinking",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiClaude37SonnetLatest: {
title: "Claude 3.7 Sonnet Latest",
description:
"Claude 3.7 Sonnet Latest via CometAPI - latest version of Claude 3.7 Sonnet.",
params: {
model: "claude-3-7-sonnet-latest",
contextLength: 200_000,
title: "Claude 3.7 Sonnet Latest",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiClaude35HaikuLatest: {
title: "Claude 3.5 Haiku Latest",
description:
"Claude 3.5 Haiku Latest via CometAPI - fast and efficient model from Anthropic.",
params: {
model: "claude-3-5-haiku-latest",
contextLength: 200_000,
title: "Claude 3.5 Haiku Latest",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
// Gemini series models via CometAPI
cometapiGemini25Pro: {
title: "Gemini 2.5 Pro",
description:
"Gemini 2.5 Pro via CometAPI - Google's advanced multimodal model with enhanced capabilities.",
params: {
model: "gemini-2.5-pro",
contextLength: 1_000_000,
title: "Gemini 2.5 Pro",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGemini25Flash: {
title: "Gemini 2.5 Flash",
description:
"Gemini 2.5 Flash via CometAPI - optimized for speed and efficiency.",
params: {
model: "gemini-2.5-flash",
contextLength: 1_000_000,
title: "Gemini 2.5 Flash",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGemini25FlashLite: {
title: "Gemini 2.5 Flash Lite",
description:
"Gemini 2.5 Flash Lite via CometAPI - lightweight version for faster responses.",
params: {
model: "gemini-2.5-flash-lite",
contextLength: 8_000,
title: "Gemini 2.5 Flash Lite",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGemini20Flash: {
title: "Gemini 2.0 Flash",
description:
"Gemini 2.0 Flash via CometAPI - Google's powerful workhorse model with low latency.",
params: {
model: "gemini-2.0-flash",
contextLength: 32_000,
title: "Gemini 2.0 Flash",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
// Grok series models via CometAPI
cometapiGrok40709: {
title: "Grok 4",
description:
"Grok 4 via CometAPI - xAI's advanced model with real-time information access.",
params: {
model: "grok-4-0709",
contextLength: 256_000,
title: "Grok 4",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGrok3: {
title: "Grok 3",
description: "Grok 3 via CometAPI - powerful reasoning model from xAI.",
params: {
model: "grok-3",
contextLength: 128_000,
title: "Grok 3",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiGrok3Mini: {
title: "Grok 3 Mini",
description: "Grok 3 Mini via CometAPI - efficient version of Grok 3.",
params: {
model: "grok-3-mini",
contextLength: 128_000,
title: "Grok 3 Mini",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
// DeepSeek series models via CometAPI (additional)
cometapiDeepseekV31: {
title: "DeepSeek V3.1",
description:
"DeepSeek V3.1 via CometAPI - enhanced version with improved performance.",
params: {
model: "deepseek-v3.1",
contextLength: 128_000,
title: "DeepSeek V3.1",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiDeepseekR10528: {
title: "DeepSeek R1",
description:
"DeepSeek R1 via CometAPI - reasoning model with enhanced problem-solving capabilities.",
params: {
model: "deepseek-r1-0528",
contextLength: 64_000,
title: "DeepSeek R1",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiDeepseekChat: {
title: "DeepSeek Chat",
description:
"DeepSeek Chat via CometAPI - optimized for conversational AI tasks.",
params: {
model: "deepseek-chat",
contextLength: 64_000,
title: "DeepSeek Chat",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiDeepseekReasoner: {
title: "DeepSeek Reasoner",
description:
"DeepSeek Reasoner via CometAPI - specialized model for complex reasoning tasks.",
params: {
model: "deepseek-reasoner",
contextLength: 64_000,
title: "DeepSeek Reasoner",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
// Qwen series models via CometAPI
cometapiQwen330BA3B: {
title: "Qwen 3 30B A3B",
description:
"Qwen 3 30B A3B via CometAPI - Alibaba's advanced language model with 30B parameters.",
params: {
model: "qwen3-30b-a3b",
contextLength: 128_000,
title: "Qwen 3 30B A3B",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
cometapiQwen3CoderPlus: {
title: "Qwen 3 Coder Plus",
description:
"Qwen 3 Coder Plus via CometAPI - specialized coding model from Alibaba.",
params: {
model: "qwen3-coder-plus-2025-07-22",
contextLength: 262_000,
title: "Qwen 3 Coder Plus",
apiKey: "",
},
providerOptions: ["cometapi"],
icon: "cometapi.png",
isOpenSource: false,
},
};

View file

@ -49,6 +49,65 @@ export const apiBaseInput: InputDescriptor = {
};
export const providers: Partial<Record<string, ProviderInfo>> = {
cometapi: {
title: "CometAPI",
provider: "cometapi",
description: "500+ AI Model API,All In One API. Just In CometAPI",
longDescription:
"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.",
icon: "cometapi.png",
tags: [ModelProviderTags.RequiresApiKey],
collectInputFor: [
{
inputType: "text",
key: "apiKey",
label: "API Key",
placeholder: "Enter your CometAPI key",
required: true,
},
...completionParamsInputsConfigs,
],
packages: [
// GPT, OpenAI family
models.cometapiGpt5ChatLatest,
models.cometapiGpt5Mini,
models.cometapiGpt5,
models.cometapiChatgpt4oLatest,
models.cometapiGpt41,
models.cometapiO4Mini,
models.cometapiO3Pro,
// Anthropic Claude family
models.cometapiClaudeOpus41,
models.cometapiClaudeOpus41Thinking,
models.cometapiClaudeSonnet4,
models.cometapiClaudeSonnet4Thinking,
models.cometapiClaude37SonnetLatest,
models.cometapiClaude35HaikuLatest,
// Google Gemini family
models.cometapiGemini25Pro,
models.cometapiGemini25Flash,
models.cometapiGemini25FlashLite,
models.cometapiGemini20Flash,
// xAI Grok family
models.cometapiGrok40709,
models.cometapiGrok3,
models.cometapiGrok3Mini,
// Deepseek family
models.cometapiDeepseekV31,
models.cometapiDeepseekR10528,
models.cometapiDeepseekChat,
models.cometapiDeepseekReasoner,
// Qwen family
models.cometapiQwen330BA3B,
models.cometapiQwen3CoderPlus,
//TODO: Need to wait for the improvement after the upgrade of the cometapi model list interface
// {
// ...models.AUTODETECT,
// params: { ...models.AUTODETECT.params, title: "CometAPI" },
// },
],
apiKeyUrl: "https://api.cometapi.com/console/token",
},
openai: {
title: "OpenAI",
provider: "openai",
@ -563,7 +622,14 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
required: true,
},
],
packages: [models.grokBeta],
packages: [
models.grokCodeFast1,
models.grok4FastReasoning,
models.grok4FastNonReasoning,
models.grok4,
models.grok3,
models.grok3Mini,
],
apiKeyUrl: "https://console.x.ai/",
},
lemonade: {

View file

@ -45,7 +45,7 @@ export function useToolPolicies() {
case "chat":
return "All tools disabled in Chat, switch to Plan or Agent mode to use tools";
case "plan":
return "Read-only/MCP tools available in Plan mode";
return "Read-only tools available in Plan mode";
default:
return "";
}

View file

@ -91,7 +91,7 @@ export function ModelsSection() {
<span>
Used in Chat, Plan, Agent mode (
<a
href="https://docs.continue.dev/features/chat/quick-start hover:text-inherit"
href="https://docs.continue.dev/features/chat/quick-start"
target="_blank"
rel="noopener noreferrer"
className="text-inherit underline hover:brightness-125"

View file

@ -4,16 +4,27 @@ import {
ChevronDownIcon,
CircleStackIcon,
CommandLineIcon,
EllipsisVerticalIcon,
GlobeAltIcon,
PlayCircleIcon,
StopCircleIcon,
UserCircleIcon,
WrenchScrewdriverIcon,
} from "@heroicons/react/24/outline";
import { MCPServerStatus } from "core";
import { useContext, useMemo, useState } from "react";
import { MCPConnectionStatus, MCPServerStatus } from "core";
import { useContext, useEffect, useMemo, useState } from "react";
import Alert from "../../../components/gui/Alert";
import { ToolTip } from "../../../components/gui/Tooltip";
import EditBlockButton from "../../../components/mainInput/Lump/EditBlockButton";
import { Button, Card, EmptyState } from "../../../components/ui";
import {
Button,
Card,
EmptyState,
Listbox,
ListboxButton,
ListboxOption,
ListboxOptions,
} from "../../../components/ui";
import { useAuth } from "../../../context/Auth";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
@ -27,14 +38,32 @@ interface MCPServerStatusProps {
serverFromYaml?: NonNullable<ConfigYaml["mcpServers"]>[number];
}
const ServerStatusTooltip: Record<MCPConnectionStatus, string> = {
connected: "Active",
connecting: "Connecting",
"not-connected": "Inactive",
authenticating: "Authenticating",
error: "Error",
};
const ServerStatusColor: Record<MCPConnectionStatus, string> = {
connected: "bg-success",
connecting: "bg-warning",
"not-connected": "bg-description-muted",
authenticating: "bg-warning",
error: "bg-error",
};
function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
const [expandedSections, setExpandedSections] = useState<{
[key: string]: boolean;
}>({});
const [disconnectedMCPServers, setDisconnectedMCPServers] = useState<
string[]
>([]);
const ideMessenger = useContext(IdeMessengerContext);
const config = useAppSelector((store) => store.config.config);
const dispatch = useAppDispatch();
const updateMCPServerStatus = (status: MCPServerStatus["status"]) => {
// optimistic config update
dispatch(
@ -64,9 +93,35 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
const onRefresh = async () => {
updateMCPServerStatus("connecting");
ideMessenger.post("mcp/reloadServer", {
await ideMessenger.request("mcp/reloadServer", {
id: server.id,
});
await fetchDisconectedMCPServers();
};
const onDisconnect = async () => {
updateMCPServerStatus("not-connected");
setDisconnectedMCPServers((prev) => [...prev, server.id]);
dispatch(
updateConfig({
...config,
tools: config.tools.filter((tool) => tool.group !== server.id),
}),
);
await ideMessenger.request("mcp/disconnectServer", {
id: server.id,
});
await fetchDisconectedMCPServers();
};
const fetchDisconectedMCPServers = async () => {
const disconnectedServersData = await ideMessenger.request(
"mcp/getDisconnectedServers",
undefined,
);
if (disconnectedServersData.status === "success") {
setDisconnectedMCPServers(disconnectedServersData.content);
}
};
const toggleSection = (section: string) => {
@ -76,6 +131,8 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
}));
};
useEffect(() => void fetchDisconectedMCPServers(), []);
const ResourceRow = ({
title,
items,
@ -83,7 +140,11 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
sectionKey,
}: {
title: string;
items: any[];
items:
| MCPServerStatus["tools"]
| MCPServerStatus["prompts"]
| MCPServerStatus["resources"]
| MCPServerStatus["resourceTemplates"];
icon: React.ReactNode;
sectionKey: string;
}) => {
@ -146,23 +207,17 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
<div className="flex-1">
<div className="flex items-center gap-3">
<h3 className="my-0 text-sm font-medium">{server.name}</h3>
<div
className={`h-2 w-2 flex-shrink-0 rounded-full ${
server.status === "connected"
? "bg-success"
: server.status === "connecting"
? "bg-warning"
: server.status === "not-connected"
? "bg-description-muted"
: "bg-error"
}`}
/>
<ToolTip content={ServerStatusTooltip[server.status] ?? "Error"}>
<div
className={`h-2 w-2 flex-shrink-0 rounded-full ${ServerStatusColor[server.status] ?? "bg-error"}`}
/>
</ToolTip>
</div>
</div>
</div>
<div className="-mr-2.5 flex items-center gap-1">
{server.isProtectedResource && (
{server.isProtectedResource && server.status !== "connected" && (
<ToolTip
content={
server.status === "error"
@ -182,7 +237,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
}
variant="ghost"
size="sm"
className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0"
className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0 pt-0.5"
disabled={server.status === "authenticating"}
>
{server.status === "authenticating" ? (
@ -193,27 +248,59 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
</Button>
</ToolTip>
)}
<Listbox>
<ListboxButton>
<EllipsisVerticalIcon className="h-4 w-4 flex-shrink-0" />
</ListboxButton>
<ListboxOptions className="min-w-fit" anchor="bottom end">
{server.isProtectedResource && server.status === "connected" && (
<ListboxOption
value="remove auth"
onClick={onRemoveAuth}
className="justify-start gap-x-1.5"
>
<UserCircleIcon className="h-4 w-4 flex-shrink-0" /> Logout
</ListboxOption>
)}
<ToolTip content="Edit server configuration">
<div>
<EditBlockButton
blockType={"mcpServers"}
block={serverFromYaml}
sourceFile={server.sourceFile}
/>
</div>
</ToolTip>
<ListboxOption
value="edit mcp"
className="justify-start gap-x-1.5"
>
<EditBlockButton
blockType={"mcpServers"}
block={serverFromYaml}
sourceFile={server.sourceFile}
className="h-3.5 w-3.5 text-inherit"
/>
Edit
</ListboxOption>
<ToolTip content="Refresh server">
<Button
onClick={onRefresh}
variant="ghost"
size="sm"
className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0"
>
<ArrowPathIcon className="h-4 w-4 flex-shrink-0" />
</Button>
</ToolTip>
{!disconnectedMCPServers.includes(server.name) && (
<ListboxOption
value="disconnect"
onClick={onDisconnect}
className="justify-start gap-x-1.5"
>
<StopCircleIcon className="h-4 w-4 flex-shrink-0" />{" "}
Disconnect
</ListboxOption>
)}
<ListboxOption
value="reconnect"
onClick={onRefresh}
className="justify-start gap-x-1.5"
>
{disconnectedMCPServers.includes(server.name) ? (
<PlayCircleIcon className="h-4 w-4 flex-shrink-0" />
) : (
<ArrowPathIcon className="h-4 w-4 flex-shrink-0" />
)}
Reload
</ListboxOption>
</ListboxOptions>
</Listbox>
</div>
</div>
@ -294,6 +381,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
function McpSubsection() {
const currentOrg = useAppSelector(selectCurrentOrg);
const mode = useAppSelector((store) => store.session.mode);
const servers = useAppSelector(
(store) => store.config.config.mcpServerStatuses,
);
@ -317,7 +405,7 @@ function McpSubsection() {
.map((server) => [server.name, server]) ?? [],
);
return (servers ?? []).map((doc) => ({
return (servers ?? []).map((doc: MCPServerStatus) => ({
block: doc,
blockFromYaml: yamlServersByName.get(doc.name),
}));
@ -348,6 +436,13 @@ function McpSubsection() {
<Card>
<EmptyState message="MCP servers are disabled in your organization" />
</Card>
) : mode === "chat" ? (
<Alert type="info" size="sm">
<span className="text-2xs italic">
All MCPs are disabled in Chat, switch to Plan or Agent mode to use
MCPs
</span>
</Alert>
) : mergedBlocks.length > 0 ? (
mergedBlocks.map(({ block, blockFromYaml }, index) => (
<div key={block.id}>

View file

@ -290,10 +290,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
<GhostButton
className="flex flex-row items-center gap-2 rounded px-3 py-1.5"
onClick={() => {
ideMessenger.post("controlPlane/openUrl", {
path: GITHUB_LINK,
orgSlug: undefined,
});
ideMessenger.post("openUrl", GITHUB_LINK);
}}
>
<GithubIcon className="h-5 w-5" />
@ -302,10 +299,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
<GhostButton
className="flex flex-row items-center gap-2 rounded px-3 py-1.5"
onClick={() => {
ideMessenger.post("controlPlane/openUrl", {
path: DISCORD_LINK,
orgSlug: undefined,
});
ideMessenger.post("openUrl", DISCORD_LINK);
}}
>
<DiscordIcon className="h-5 w-5" />

View file

@ -185,24 +185,22 @@ export function FindAndReplaceDisplay({
const statusIcon = useMemo(() => {
const status = toolCallState?.status;
if (status) {
if (status === "canceled" || status === "errored" || status === "done") {
return (
<div
className={`mr-1 h-4 w-4 flex-shrink-0 ${toolCallState.output ? "cursor-pointer" : ""}`}
onClick={(e) => {
if (toolCallState.output) {
e.stopPropagation();
ideMessenger.post("showVirtualFile", {
name: "Edit output",
content: renderContextItems(toolCallState.output),
});
}
}}
>
{getStatusIcon(toolCallState.status)}
</div>
);
}
return (
<div
className={`mr-1 h-4 w-4 flex-shrink-0 ${toolCallState.output ? "cursor-pointer" : ""}`}
onClick={(e) => {
if (toolCallState.output) {
e.stopPropagation();
ideMessenger.post("showVirtualFile", {
name: "Edit output",
content: renderContextItems(toolCallState.output),
});
}
}}
>
{getStatusIcon(status)}
</div>
);
}
}, [toolCallState?.status, toolCallState?.output]);

View file

@ -7,6 +7,7 @@ import {
import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { ToggleWithIcon } from "./ToggleWithIcon";
import { ToolCallStatusMessage } from "./ToolCallStatusMessage";
import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon";
import { toolCallStateToContextItems } from "./utils";
interface SimpleToolCallUIProps {
@ -61,6 +62,10 @@ export function SimpleToolCallUI({
/>
<ToolCallStatusMessage tool={tool} toolCallState={toolCallState} />
</div>
{!!toolCallState.output?.length && (
<ToolTruncateHistoryIcon historyIndex={historyIndex} />
)}
</div>
{isToggleable && (

View file

@ -1,5 +1,10 @@
import { Tool, ToolCallState } from "core";
import { useContext, useMemo } from "react";
import { openContextItem } from "../../../components/mainInput/belowMainInput/ContextItemsPeek";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { ToolCallStatusMessage } from "./ToolCallStatusMessage";
import { toolCallStateToContextItems } from "./utils";
import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon";
interface ToolCallDisplayProps {
children: React.ReactNode;
@ -16,11 +21,29 @@ export function ToolCallDisplay({
icon,
historyIndex,
}: ToolCallDisplayProps) {
const ideMessenger = useContext(IdeMessengerContext);
const shownContextItems = useMemo(() => {
const contextItems = toolCallStateToContextItems(toolCallState);
return contextItems.filter((item) => !item.hidden);
}, [toolCallState]);
const isClickable = shownContextItems.length > 0;
function handleClick() {
if (shownContextItems.length > 0) {
openContextItem(shownContextItems[0], ideMessenger);
}
}
return (
<div className="flex flex-col justify-center px-4">
<div className="mb-2 flex flex-col">
<div className="flex flex-row items-center justify-between gap-1.5">
<div className="flex min-w-0 flex-row items-center gap-2">
<div className="flex flex-row items-start justify-between gap-1.5">
<div
className={`flex min-w-0 flex-row items-center gap-2 transition-colors duration-200 ease-in-out ${
isClickable ? "cursor-pointer hover:brightness-125" : ""
}`}
onClick={isClickable ? handleClick : undefined}
>
<div className="mt-[1px] h-4 w-4 flex-shrink-0 font-semibold">
{icon}
</div>
@ -29,6 +52,9 @@ export function ToolCallDisplay({
)}
<ToolCallStatusMessage tool={tool} toolCallState={toolCallState} />
</div>
{!!toolCallState.output?.length && (
<ToolTruncateHistoryIcon historyIndex={historyIndex} />
)}
</div>
</div>
<div>{children}</div>

View file

@ -53,7 +53,7 @@ export function ToolCallStatusMessage({
return (
<div
className="text-description line-clamp-4 min-w-0 break-all"
className="text-description line-clamp-4 min-w-0 break-words"
data-testid="tool-call-title"
>
{`Continue ${intro} ${message}`}

View file

@ -21,7 +21,8 @@ export function ToolTruncateHistoryIcon({
const { mainEditor } = useMainEditor();
if (historyIndex === lastMessageIndex) {
return null;
// filler so doesn't jump in
return <div className="h-3 w-3" />;
}
return (

757
package-lock.json generated
View file

@ -9,6 +9,8 @@
"@typescript-eslint/parser": "^7.8.0",
"concurrently": "^9.1.2",
"eslint-plugin-import": "^2.29.1",
"husky": "^9.1.7",
"lint-staged": "^15.5.2",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8",
"typescript": "^5.6.3"
@ -385,6 +387,22 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/ansi-escapes": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.1.1.tgz",
"integrity": "sha512-Zhl0ErHcSRUaVfGUeUdDuLgpkEo8KIFjB4Y9uAc46ScOpdDiU1Dbyplh7qWJeJ/ZHpbyMSM26+X3BySgnIz40Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"environment": "^1.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@ -698,6 +716,93 @@
"node": ">=8"
}
},
"node_modules/cli-cursor": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz",
"integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==",
"dev": true,
"license": "MIT",
"dependencies": {
"restore-cursor": "^5.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-truncate": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz",
"integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==",
"dev": true,
"license": "MIT",
"dependencies": {
"slice-ansi": "^5.0.0",
"string-width": "^7.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-truncate/node_modules/ansi-regex": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
"integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
"node_modules/cli-truncate/node_modules/emoji-regex": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.5.0.tgz",
"integrity": "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg==",
"dev": true,
"license": "MIT"
},
"node_modules/cli-truncate/node_modules/string-width": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^10.3.0",
"get-east-asian-width": "^1.0.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-truncate/node_modules/strip-ansi": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
"integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^6.0.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
"node_modules/cliui": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
@ -733,6 +838,23 @@
"dev": true,
"license": "MIT"
},
"node_modules/colorette": {
"version": "2.0.20",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
"dev": true,
"license": "MIT"
},
"node_modules/commander": {
"version": "13.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz",
"integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -772,7 +894,6 @@
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
@ -947,6 +1068,19 @@
"dev": true,
"license": "MIT"
},
"node_modules/environment": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",
"integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/es-abstract": {
"version": "1.24.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz",
@ -1444,6 +1578,37 @@
"node": ">=0.10.0"
}
},
"node_modules/eventemitter3": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
"integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
"dev": true,
"license": "MIT"
},
"node_modules/execa": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz",
"integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==",
"dev": true,
"license": "MIT",
"dependencies": {
"cross-spawn": "^7.0.3",
"get-stream": "^8.0.1",
"human-signals": "^5.0.0",
"is-stream": "^3.0.0",
"merge-stream": "^2.0.0",
"npm-run-path": "^5.1.0",
"onetime": "^6.0.0",
"signal-exit": "^4.1.0",
"strip-final-newline": "^3.0.0"
},
"engines": {
"node": ">=16.17"
},
"funding": {
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@ -1652,6 +1817,19 @@
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/get-east-asian-width": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz",
"integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
@ -1691,6 +1869,19 @@
"node": ">= 0.4"
}
},
"node_modules/get-stream": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",
"integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/get-symbol-description": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz",
@ -1942,6 +2133,32 @@
"node": ">= 0.4"
}
},
"node_modules/human-signals": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz",
"integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=16.17.0"
}
},
"node_modules/husky": {
"version": "9.1.7",
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
"integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
"dev": true,
"license": "MIT",
"bin": {
"husky": "bin.js"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/typicode"
}
},
"node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
@ -2332,6 +2549,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-stream": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
"integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-string": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz",
@ -2441,8 +2671,7 @@
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true,
"license": "ISC",
"peer": true
"license": "ISC"
},
"node_modules/js-yaml": {
"version": "4.1.0",
@ -2521,6 +2750,163 @@
"node": ">= 0.8.0"
}
},
"node_modules/lilconfig": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
"integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/antonk52"
}
},
"node_modules/lint-staged": {
"version": "15.5.2",
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.5.2.tgz",
"integrity": "sha512-YUSOLq9VeRNAo/CTaVmhGDKG+LBtA8KF1X4K5+ykMSwWST1vDxJRB2kv2COgLb1fvpCo+A/y9A0G0znNVmdx4w==",
"dev": true,
"license": "MIT",
"dependencies": {
"chalk": "^5.4.1",
"commander": "^13.1.0",
"debug": "^4.4.0",
"execa": "^8.0.1",
"lilconfig": "^3.1.3",
"listr2": "^8.2.5",
"micromatch": "^4.0.8",
"pidtree": "^0.6.0",
"string-argv": "^0.3.2",
"yaml": "^2.7.0"
},
"bin": {
"lint-staged": "bin/lint-staged.js"
},
"engines": {
"node": ">=18.12.0"
},
"funding": {
"url": "https://opencollective.com/lint-staged"
}
},
"node_modules/lint-staged/node_modules/chalk": {
"version": "5.6.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
"integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^12.17.0 || ^14.13 || >=16.0.0"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/listr2": {
"version": "8.3.3",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-8.3.3.tgz",
"integrity": "sha512-LWzX2KsqcB1wqQ4AHgYb4RsDXauQiqhjLk+6hjbaeHG4zpjjVAB6wC/gz6X0l+Du1cN3pUB5ZlrvTbhGSNnUQQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"cli-truncate": "^4.0.0",
"colorette": "^2.0.20",
"eventemitter3": "^5.0.1",
"log-update": "^6.1.0",
"rfdc": "^1.4.1",
"wrap-ansi": "^9.0.0"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/listr2/node_modules/ansi-regex": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
"integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
"node_modules/listr2/node_modules/ansi-styles": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/listr2/node_modules/emoji-regex": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.5.0.tgz",
"integrity": "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg==",
"dev": true,
"license": "MIT"
},
"node_modules/listr2/node_modules/string-width": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^10.3.0",
"get-east-asian-width": "^1.0.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/listr2/node_modules/strip-ansi": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
"integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^6.0.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
"node_modules/listr2/node_modules/wrap-ansi": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
"integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^6.2.1",
"string-width": "^7.0.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
@ -2553,6 +2939,144 @@
"license": "MIT",
"peer": true
},
"node_modules/log-update": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz",
"integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-escapes": "^7.0.0",
"cli-cursor": "^5.0.0",
"slice-ansi": "^7.1.0",
"strip-ansi": "^7.1.0",
"wrap-ansi": "^9.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/log-update/node_modules/ansi-regex": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
"integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
"node_modules/log-update/node_modules/ansi-styles": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/log-update/node_modules/emoji-regex": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.5.0.tgz",
"integrity": "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg==",
"dev": true,
"license": "MIT"
},
"node_modules/log-update/node_modules/is-fullwidth-code-point": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz",
"integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"get-east-asian-width": "^1.3.1"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/log-update/node_modules/slice-ansi": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz",
"integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^6.2.1",
"is-fullwidth-code-point": "^5.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/chalk/slice-ansi?sponsor=1"
}
},
"node_modules/log-update/node_modules/string-width": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^10.3.0",
"get-east-asian-width": "^1.0.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/log-update/node_modules/strip-ansi": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
"integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^6.0.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
"node_modules/log-update/node_modules/wrap-ansi": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
"integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^6.2.1",
"string-width": "^7.0.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@ -2563,6 +3087,13 @@
"node": ">= 0.4"
}
},
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
"dev": true,
"license": "MIT"
},
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@ -2587,6 +3118,32 @@
"node": ">=8.6"
}
},
"node_modules/mimic-fn": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mimic-function": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz",
"integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
@ -2628,6 +3185,35 @@
"license": "MIT",
"peer": true
},
"node_modules/npm-run-path": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz",
"integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^4.0.0"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/npm-run-path/node_modules/path-key": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
@ -2736,6 +3322,22 @@
"wrappy": "1"
}
},
"node_modules/onetime": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
"integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"mimic-fn": "^4.0.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@ -2849,7 +3451,6 @@
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -2884,6 +3485,19 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/pidtree": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz",
"integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==",
"dev": true,
"license": "MIT",
"bin": {
"pidtree": "bin/pidtree.js"
},
"engines": {
"node": ">=0.10"
}
},
"node_modules/possible-typed-array-names": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
@ -3118,6 +3732,39 @@
"node": ">=4"
}
},
"node_modules/restore-cursor": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz",
"integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==",
"dev": true,
"license": "MIT",
"dependencies": {
"onetime": "^7.0.0",
"signal-exit": "^4.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/restore-cursor/node_modules/onetime": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz",
"integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"mimic-function": "^5.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/reusify": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
@ -3129,6 +3776,13 @@
"node": ">=0.10.0"
}
},
"node_modules/rfdc": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
"dev": true,
"license": "MIT"
},
"node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
@ -3304,7 +3958,6 @@
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"shebang-regex": "^3.0.0"
},
@ -3318,7 +3971,6 @@
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -3412,6 +4064,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@ -3422,6 +4087,49 @@
"node": ">=8"
}
},
"node_modules/slice-ansi": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz",
"integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^6.0.0",
"is-fullwidth-code-point": "^4.0.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/slice-ansi?sponsor=1"
}
},
"node_modules/slice-ansi/node_modules/ansi-styles": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/slice-ansi/node_modules/is-fullwidth-code-point": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz",
"integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/stop-iteration-iterator": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz",
@ -3436,6 +4144,16 @@
"node": ">= 0.4"
}
},
"node_modules/string-argv": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz",
"integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.6.19"
}
},
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@ -3533,6 +4251,19 @@
"node": ">=4"
}
},
"node_modules/strip-final-newline": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
"integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@ -3796,7 +4527,6 @@
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"license": "ISC",
"peer": true,
"dependencies": {
"isexe": "^2.0.0"
},
@ -3943,6 +4673,19 @@
"node": ">=10"
}
},
"node_modules/yaml": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz",
"integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
"dev": true,
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14.6"
}
},
"node_modules/yargs": {
"version": "17.7.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",

View file

@ -7,12 +7,18 @@
"tsc:watch:core": "tsc --project core/tsconfig.json --watch --noEmit --pretty",
"tsc:watch:binary": "tsc --project binary/tsconfig.json --watch --noEmit --pretty",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore --ignore-path .prettierignore",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore --ignore-path .prettierignore"
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore --ignore-path .prettierignore",
"prepare": "husky"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css,md}": "prettier --write"
},
"devDependencies": {
"@typescript-eslint/parser": "^7.8.0",
"concurrently": "^9.1.2",
"eslint-plugin-import": "^2.29.1",
"husky": "^9.1.7",
"lint-staged": "^15.5.2",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8",
"typescript": "^5.6.3"

View file

@ -1,6 +1,6 @@
{
"name": "@continuedev/llm-info",
"version": "1.0.9",
"version": "1.0.10",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -2,6 +2,7 @@ import { Anthropic } from "./providers/anthropic.js";
import { Azure } from "./providers/azure.js";
import { Bedrock } from "./providers/bedrock.js";
import { Cohere } from "./providers/cohere.js";
import { CometAPI } from "./providers/cometapi.js";
import { Gemini } from "./providers/gemini.js";
import { Mistral } from "./providers/mistral.js";
import { Ollama } from "./providers/ollama.js";
@ -9,7 +10,7 @@ import { OpenAi } from "./providers/openai.js";
import { Vllm } from "./providers/vllm.js";
import { Voyage } from "./providers/voyage.js";
import { xAI } from "./providers/xAI.js";
import { LlmInfo, ModelProvider, UseCase } from "./types.js";
import { LlmInfoWithProvider, ModelProvider, UseCase } from "./types.js";
export const allModelProviders: ModelProvider[] = [
OpenAi,
@ -22,19 +23,36 @@ export const allModelProviders: ModelProvider[] = [
Vllm,
Bedrock,
Cohere,
CometAPI,
xAI,
];
export const allLlms: LlmInfo[] = allModelProviders.flatMap((provider) =>
provider.models.map((model) => ({ ...model, provider: provider.id })),
export const allLlms: LlmInfoWithProvider[] = allModelProviders.flatMap(
(provider) =>
provider.models.map((model) => ({ ...model, provider: provider.id })),
);
export function findLlmInfo(model: string): LlmInfo | undefined {
export function findLlmInfo(
model: string,
preferProviderId?: string,
): LlmInfoWithProvider | undefined {
if (preferProviderId) {
const provider = allModelProviders.find((p) => p.id === preferProviderId);
const info = provider?.models.find((llm) =>
llm.regex ? llm.regex.test(model) : llm.model === model,
);
if (info) {
return {
...info,
provider: preferProviderId,
};
}
}
return allLlms.find((llm) =>
llm.regex ? llm.regex.test(model) : llm.model === model,
);
}
export function getAllRecommendedFor(useCase: UseCase): LlmInfo[] {
export function getAllRecommendedFor(useCase: UseCase): LlmInfoWithProvider[] {
return allLlms.filter((llm) => llm.recommendedFor?.includes(useCase));
}

View file

@ -0,0 +1,280 @@
import { ModelProvider } from "../types.js";
export const CometAPI: ModelProvider = {
id: "cometapi",
displayName: "CometAPI",
models: [
// GPT Series
{
model: "gpt-5-chat-latest",
displayName: "GPT-5 Chat Latest",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
"Latest GPT-5 model optimized for chat conversations with enhanced reasoning capabilities.",
recommendedFor: ["chat"],
},
{
model: "chatgpt-4o-latest",
displayName: "ChatGPT-4o Latest",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Latest ChatGPT-4o model with improved performance and updated training data.",
recommendedFor: ["chat"],
},
{
model: "gpt-5-mini",
displayName: "GPT-5 Mini",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Efficient version of GPT-5 with faster response times while maintaining high quality.",
recommendedFor: ["chat"],
},
{
model: "gpt-5-nano",
displayName: "GPT-5 Nano",
contextLength: 64000,
maxCompletionTokens: 2048,
description:
"Ultra-fast GPT-5 variant optimized for quick responses and simple tasks.",
recommendedFor: ["chat"],
},
{
model: "gpt-5",
displayName: "GPT-5",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
"Advanced GPT-5 model with state-of-the-art language understanding and generation.",
recommendedFor: ["chat"],
},
{
model: "gpt-4o-mini",
displayName: "GPT-4o Mini",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Compact version of GPT-4o with excellent performance for most use cases.",
recommendedFor: ["chat"],
},
{
model: "o4-mini-2025-04-16",
displayName: "o4 Mini (2025-04-16)",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Optimized o4 mini model with April 2025 training improvements.",
recommendedFor: ["chat"],
},
{
model: "o3-pro-2025-06-10",
displayName: "o3 Pro (2025-06-10)",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
"Professional-grade o3 model with enhanced reasoning and problem-solving capabilities.",
recommendedFor: ["chat"],
},
// Claude Series
{
model: "claude-opus-4-1-20250805",
displayName: "Claude Opus 4.1 (2025-08-05)",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
"Most capable Claude model with exceptional reasoning, analysis, and creative capabilities.",
recommendedFor: ["chat"],
},
{
model: "claude-opus-4-1-20250805-thinking",
displayName: "Claude Opus 4.1 Thinking (2025-08-05)",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
"Claude Opus with enhanced thinking process for complex problem-solving tasks.",
recommendedFor: ["chat"],
},
{
model: "claude-sonnet-4-20250514",
displayName: "Claude Sonnet 4 (2025-05-14)",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
"Balanced Claude model offering excellent performance across various tasks.",
recommendedFor: ["chat"],
},
{
model: "claude-sonnet-4-20250514-thinking",
displayName: "Claude Sonnet 4 Thinking (2025-05-14)",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
"Claude Sonnet with enhanced reasoning capabilities for analytical tasks.",
recommendedFor: ["chat"],
},
{
model: "claude-3-7-sonnet-latest",
displayName: "Claude 3.7 Sonnet Latest",
contextLength: 200000,
maxCompletionTokens: 4096,
description:
"Latest Claude 3.7 Sonnet with improved instruction following and safety.",
recommendedFor: ["chat"],
},
{
model: "claude-3-5-haiku-latest",
displayName: "Claude 3.5 Haiku Latest",
contextLength: 200000,
maxCompletionTokens: 4096,
description:
"Fast and efficient Claude model optimized for quick responses.",
recommendedFor: ["chat"],
},
// Gemini Series
{
model: "gemini-2.5-pro",
displayName: "Gemini 2.5 Pro",
contextLength: 2000000,
maxCompletionTokens: 8192,
description:
"Advanced Gemini model with extensive context window and multimodal capabilities.",
recommendedFor: ["chat"],
},
{
model: "gemini-2.5-flash",
displayName: "Gemini 2.5 Flash",
contextLength: 1000000,
maxCompletionTokens: 8192,
description:
"Fast Gemini model with large context window optimized for speed.",
recommendedFor: ["chat"],
},
{
model: "gemini-2.5-flash-lite",
displayName: "Gemini 2.5 Flash Lite",
contextLength: 1000000,
maxCompletionTokens: 4096,
description:
"Lightweight version of Gemini Flash for efficient processing.",
recommendedFor: ["chat"],
},
{
model: "gemini-2.0-flash",
displayName: "Gemini 2.0 Flash",
contextLength: 1000000,
maxCompletionTokens: 8192,
description:
"High-performance Gemini model with excellent speed-quality balance.",
recommendedFor: ["chat"],
},
// Grok Series
{
model: "grok-4-0709",
displayName: "Grok 4 (07-09)",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Latest Grok model with improved reasoning and conversational abilities.",
recommendedFor: ["chat"],
},
{
model: "grok-3",
displayName: "Grok 3",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Advanced Grok model with enhanced understanding and generation capabilities.",
recommendedFor: ["chat"],
},
{
model: "grok-3-mini",
displayName: "Grok 3 Mini",
contextLength: 64000,
maxCompletionTokens: 2048,
description:
"Compact Grok model optimized for efficiency and quick responses.",
recommendedFor: ["chat"],
},
{
model: "grok-2-image-1212",
displayName: "Grok 2 Image (12-12)",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Grok model with enhanced image understanding and multimodal capabilities.",
recommendedFor: ["chat"],
},
// DeepSeek Series
{
model: "deepseek-v3.1",
displayName: "DeepSeek V3.1",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Latest DeepSeek model with improved reasoning and coding capabilities.",
recommendedFor: ["chat"],
},
{
model: "deepseek-v3",
displayName: "DeepSeek V3",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Advanced DeepSeek model with strong performance in technical domains.",
recommendedFor: ["chat"],
},
{
model: "deepseek-r1-0528",
displayName: "DeepSeek R1 (05-28)",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"DeepSeek reasoning model optimized for complex problem-solving tasks.",
recommendedFor: ["chat"],
},
{
model: "deepseek-chat",
displayName: "DeepSeek Chat",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"DeepSeek model specifically optimized for conversational interactions.",
recommendedFor: ["chat"],
},
{
model: "deepseek-reasoner",
displayName: "DeepSeek Reasoner",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"DeepSeek model with enhanced reasoning capabilities for analytical tasks.",
recommendedFor: ["chat"],
},
// Qwen Series
{
model: "qwen3-30b-a3b",
displayName: "Qwen3 30B A3B",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Large Qwen model with 30B parameters for high-quality text generation.",
recommendedFor: ["chat"],
},
{
model: "qwen3-coder-plus-2025-07-22",
displayName: "Qwen3 Coder Plus (2025-07-22)",
contextLength: 128000,
maxCompletionTokens: 4096,
description:
"Qwen model specialized for coding tasks with enhanced programming capabilities.",
recommendedFor: ["chat"],
},
],
};

View file

@ -7,6 +7,60 @@ export const xAI: ModelProvider = {
displayName: "Grok Beta",
contextLength: 128000,
recommendedFor: ["chat"],
regex: /grok-beta/,
},
{
model: "grok-2",
displayName: "Grok 2",
contextLength: 131072,
recommendedFor: ["chat"],
regex: /grok-2/,
},
{
model: "grok-3-mini",
displayName: "Grok 3 Mini",
contextLength: 131072,
maxCompletionTokens: 8000,
recommendedFor: ["chat"],
regex: /grok-3-mini/,
},
{
model: "grok-3",
displayName: "Grok 3",
contextLength: 131072,
recommendedFor: ["chat"],
regex: /grok-3/,
},
{
model: "grok-4-fast-reasoning",
displayName: "Grok 4 Fast Reasoning",
contextLength: 2000000,
maxCompletionTokens: 30000,
recommendedFor: ["chat"],
regex: /grok-4-fast-reasoning/,
},
{
model: "grok-4-fast-non-reasoning",
displayName: "Grok 4 Fast Non-Reasoning",
contextLength: 2000000,
maxCompletionTokens: 30000,
recommendedFor: ["chat"],
regex: /grok-4-fast-non-reasoning/,
},
{
model: "grok-4",
displayName: "Grok 4 Fast",
contextLength: 256000,
recommendedFor: ["chat"],
regex: /grok-4/,
},
{
model: "grok-code-fast-1",
displayName: "Grok Code Fast 1",
contextLength: 256000,
maxCompletionTokens: 10000,
recommendedFor: ["chat"],
regex: /grok-code-fast-1/,
},
],
id: "xAI",

View file

@ -9,6 +9,7 @@
"version": "1.15.0",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/sdk": "^0.62.0",
"@aws-sdk/client-bedrock-runtime": "^3.842.0",
"@aws-sdk/credential-providers": "^3.840.0",
"@continuedev/config-types": "^1.0.14",
@ -40,6 +41,15 @@
"vitest": "^3.2.4"
}
},
"node_modules/@anthropic-ai/sdk": {
"version": "0.62.0",
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.62.0.tgz",
"integrity": "sha512-gT2VFKX0gSp7KJNlav/vzRFjJOPYDZxCJRx7MYUc+fqURc5aS6OI/UJeD2KytJkjsIWv0OOwH1ePc1S5QE2GZw==",
"license": "MIT",
"bin": {
"anthropic-ai-sdk": "bin/cli"
}
},
"node_modules/@aws-crypto/crc32": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz",
@ -15179,6 +15189,7 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"dev": true,
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View file

@ -12,6 +12,7 @@
"author": "Nate Sesti and Ty Dunn",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/sdk": "^0.62.0",
"@aws-sdk/client-bedrock-runtime": "^3.842.0",
"@aws-sdk/credential-providers": "^3.840.0",
"@continuedev/config-types": "^1.0.14",

View file

@ -1,8 +1,22 @@
import {
ContentBlockParam,
MessageCreateParams,
MessageParam,
RawContentBlockDeltaEvent,
RawContentBlockStartEvent,
RawMessageDeltaEvent,
RawMessageStartEvent,
RawMessageStreamEvent,
Tool,
ToolUseBlock,
} from "@anthropic-ai/sdk/resources";
import { streamSse } from "@continuedev/fetch";
import { OpenAI } from "openai/index";
import {
ChatCompletion,
ChatCompletionChunk,
ChatCompletionContentPartRefusal,
ChatCompletionContentPartText,
ChatCompletionCreateParamsNonStreaming,
ChatCompletionCreateParamsStreaming,
Completion,
@ -24,6 +38,12 @@ import {
CACHING_STRATEGIES,
CachingStrategyName,
} from "./AnthropicCachingStrategies.js";
import {
getAnthropicHeaders,
getAnthropicMediaTypeFromDataUrl,
openAiToolChoiceToAnthropicToolChoice,
openaiToolToAnthropicTool,
} from "./AnthropicUtils.js";
import {
BaseLlmApi,
CreateRerankResponse,
@ -59,11 +79,12 @@ export class AnthropicApi implements BaseLlmApi {
if (model.includes("haiku")) {
return 8192;
}
return 32_000;
}
public _convertToCleanAnthropicBody(oaiBody: ChatCompletionCreateParams) {
public _convertToCleanAnthropicBody(
oaiBody: ChatCompletionCreateParams,
): MessageCreateParams {
let stop = undefined;
if (oaiBody.stop && Array.isArray(oaiBody.stop)) {
stop = oaiBody.stop.filter((x) => x.trim() !== "");
@ -75,145 +96,198 @@ export class AnthropicApi implements BaseLlmApi {
(msg) => msg.role === "system",
)?.content;
const anthropicBody = {
// TODO support custom tools
const functionTools = oaiBody.tools?.filter((t) => t.type === "function");
let tools: Tool[] | undefined = undefined;
if (
oaiBody.tool_choice !== "none" &&
functionTools &&
functionTools.length > 0
) {
if (
typeof oaiBody.tool_choice !== "string" &&
oaiBody.tool_choice?.type === "allowed_tools"
) {
const allowedToolNames = new Set(
oaiBody.tool_choice?.allowed_tools.tools.map(
(tool) => tool["name"],
) ?? [],
);
const allowedTools = functionTools.filter((t) =>
allowedToolNames.has(t.function.name),
);
tools = allowedTools.map(openaiToolToAnthropicTool);
} else {
tools = functionTools.map(openaiToolToAnthropicTool);
}
}
const anthropicBody: MessageCreateParams = {
messages: this._convertMessages(
oaiBody.messages.filter((msg) => msg.role !== "system"),
),
system: systemMessage
? [
{
type: "text",
text: systemMessage,
},
]
: systemMessage,
top_p: oaiBody.top_p,
temperature: oaiBody.temperature,
system:
typeof systemMessage === "string"
? [
{
type: "text",
text: systemMessage,
},
]
: systemMessage,
top_p: oaiBody.top_p ?? undefined,
temperature: oaiBody.temperature ?? undefined,
max_tokens: oaiBody.max_tokens ?? this.maxTokensForModel(oaiBody.model), // max_tokens is required
model: oaiBody.model,
stop_sequences: stop,
stream: oaiBody.stream,
tools: oaiBody.tools?.map((tool) => {
// Type guard for function tools
if (tool.type === "function" && "function" in tool) {
return {
name: tool.function.name,
description: tool.function.description,
input_schema: tool.function.parameters,
};
} else {
throw new Error(`Unsupported tool type in Anthropic: ${tool.type}`);
}
}),
tool_choice: oaiBody.tool_choice
? {
type: "tool",
name:
typeof oaiBody.tool_choice === "string"
? oaiBody.tool_choice
: oaiBody.tool_choice && "function" in oaiBody.tool_choice
? oaiBody.tool_choice.function.name
: undefined,
}
: undefined,
stream: oaiBody.stream ?? undefined,
tools,
tool_choice: openAiToolChoiceToAnthropicToolChoice(oaiBody.tool_choice),
};
return anthropicBody;
}
private _convertMessages(
msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[],
): any[] {
const messages = msgs.map((message) => {
if (message.role === "tool") {
return {
role: "user",
content: [
{
type: "tool_result",
tool_use_id: message.tool_call_id,
content:
typeof message.content === "string"
? message.content
: message.content.map((part) => part.text).join(""),
},
],
};
} else if (message.role === "assistant" && message.tool_calls) {
const parts: any[] = [];
if (message.content) {
if (typeof message.content === "string") {
parts.push({
type: "text",
text: message.content,
});
} else if (message.content.length > 0) {
parts.push(
message.content.map((c) => ({
type: "text",
text: c.type === "text" ? c.text : c.refusal,
})),
);
}
}
parts.push(
...message.tool_calls.map((toolCall) => {
// Type guard for function tool calls
if (toolCall.type === "function" && "function" in toolCall) {
return {
type: "tool_use",
id: toolCall.id,
name: toolCall.function?.name,
input: safeParseArgs(
toolCall.function?.arguments,
`${toolCall.function?.name} ${toolCall.id}`,
),
};
} else {
throw new Error(`Unsupported tool call type: ${toolCall.type}`);
}
}),
);
return {
role: "assistant",
content: parts,
};
}
if (!Array.isArray(message.content)) {
return message;
}
private convertToolCallsToBlocks(
toolCall: OpenAI.Chat.Completions.ChatCompletionMessageFunctionToolCall,
): ToolUseBlock | undefined {
const toolCallId = toolCall.id;
const toolName = toolCall.function?.name;
if (toolCallId && toolName) {
return {
...message,
content: message.content
.map((part) => {
if (part.type === "text") {
if ((part.text?.trim() ?? "") === "") {
return null;
}
return part;
}
const dataUrl =
(part as OpenAI.Chat.Completions.ChatCompletionContentPartImage)
?.image_url?.url || "";
// Extract media type from data URL (ex. "data:image/png;base64,..." -> "image/png")
const mediaTypeMatch = dataUrl.match(/^data:([^;]+);base64,/);
const mediaType = mediaTypeMatch ? mediaTypeMatch[1] : "image/jpeg";
type: "tool_use",
id: toolCallId,
name: toolName,
input: safeParseArgs(
toolCall.function.arguments,
`${toolName} ${toolCallId}`,
),
};
}
}
return {
// 1. ignores empty content
// 2. converts string content to text parts
// 3. converts text and refusal parts to text blocks
// 4. converts image parts to image blocks
private convertMessageContentToBlocks(
content:
| string
| OpenAI.Chat.Completions.ChatCompletionContentPart[]
| (ChatCompletionContentPartText | ChatCompletionContentPartRefusal)[],
): ContentBlockParam[] {
const blocks: ContentBlockParam[] = [];
if (typeof content === "string") {
if (content) {
blocks.push({
type: "text",
text: content,
});
}
} else {
const supportedParts = content.filter(
(p) =>
p.type === "text" || p.type === "image_url" || p.type === "refusal",
);
for (const part of supportedParts) {
if (part.type === "image_url") {
const dataUrl = part.image_url.url;
if (dataUrl?.startsWith("data:")) {
blocks.push({
type: "image",
source: {
type: "base64",
media_type: mediaType,
media_type: getAnthropicMediaTypeFromDataUrl(dataUrl),
data: dataUrl.split(",")[1],
},
};
})
.filter((x) => x !== null),
};
});
return messages;
});
}
} else {
const text = part.type === "text" ? part.text : part.refusal;
if (text) {
blocks.push({
type: "text",
text,
});
}
}
}
}
return blocks;
}
private getContentBlocksFromChatMessage(
message: OpenAI.Chat.Completions.ChatCompletionMessageParam,
): ContentBlockParam[] {
switch (message.role) {
// One tool message = one tool_result block
case "tool":
return [
{
type: "tool_result",
tool_use_id: message.tool_call_id,
content: message.content,
},
];
case "user":
return this.convertMessageContentToBlocks(message.content);
case "assistant":
const blocks: ContentBlockParam[] = message.content
? this.convertMessageContentToBlocks(message.content)
: [];
// If any tool calls are present, always put them last
// Loses order vs what was originally sent, but they typically come last
for (const toolCall of message.tool_calls ?? []) {
if (toolCall.type !== "function") {
// TODO support custom tool calls
continue;
}
const block = this.convertToolCallsToBlocks(toolCall);
if (block) {
blocks.push(block);
}
}
return blocks;
// system, etc.
default:
return [];
}
}
private _convertMessages(
msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[],
): MessageParam[] {
const nonSystemMessages = msgs.filter((m) => m.role !== "system");
const convertedMessages: MessageParam[] = [];
let currentRole: "user" | "assistant" | undefined = undefined;
let currentParts: ContentBlockParam[] = [];
const flushCurrentMessage = () => {
if (currentRole && currentParts.length > 0) {
convertedMessages.push({
role: currentRole,
content: currentParts,
});
currentParts = [];
}
};
for (const message of nonSystemMessages) {
const newRole =
message.role === "user" || message.role === "tool"
? "user"
: "assistant";
if (currentRole !== newRole) {
flushCurrentMessage();
currentRole = newRole;
}
currentParts.push(...this.getContentBlocksFromChatMessage(message));
}
flushCurrentMessage();
return convertedMessages;
}
async chatCompletionNonStream(
@ -224,13 +298,7 @@ export class AnthropicApi implements BaseLlmApi {
new URL("messages", this.apiBase),
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"anthropic-version": "2023-06-01",
"anthropic-beta": "prompt-caching-2024-07-31",
"x-api-key": this.config.apiKey,
},
headers: this.getHeaders(),
body: JSON.stringify(this._convertBody(body)),
signal,
},
@ -240,7 +308,7 @@ export class AnthropicApi implements BaseLlmApi {
return EMPTY_CHAT_COMPLETION;
}
const completion = (await response.json()) as any;
const completion = await response.json();
const usage: Record<string, number> | undefined = completion.usage;
return {
@ -281,30 +349,36 @@ export class AnthropicApi implements BaseLlmApi {
prompt_tokens: 0,
total_tokens: 0,
};
for await (const value of streamSse(response as any)) {
for await (const event of streamSse(response)) {
// https://docs.anthropic.com/en/api/messages-streaming#event-types
switch (value.type) {
const rawEvent = event as RawMessageStreamEvent;
switch (rawEvent.type) {
case "content_block_start":
if (value.content_block.type === "tool_use") {
lastToolUseId = value.content_block.id;
lastToolUseName = value.content_block.name;
const blockStartEvent = rawEvent as RawContentBlockStartEvent;
if (blockStartEvent.content_block.type === "tool_use") {
lastToolUseId = blockStartEvent.content_block.id;
lastToolUseName = blockStartEvent.content_block.name;
}
break;
case "message_start":
usage.prompt_tokens = value.message.usage?.input_tokens ?? 0;
const startEvent = rawEvent as RawMessageStartEvent;
usage.prompt_tokens = startEvent.message.usage?.input_tokens ?? 0;
usage.prompt_tokens_details = {
cached_tokens: value.message.usage?.cache_read_input_tokens ?? 0,
cached_tokens:
startEvent.message.usage?.cache_read_input_tokens ?? 0,
};
break;
case "message_delta":
usage.completion_tokens = value.usage?.output_tokens ?? 0;
const deltaEvent = rawEvent as RawMessageDeltaEvent;
usage.completion_tokens = deltaEvent.usage?.output_tokens ?? 0;
break;
case "content_block_delta":
// https://docs.anthropic.com/en/api/messages-streaming#delta-types
switch (value.delta.type) {
const blockDeltaEvent = rawEvent as RawContentBlockDeltaEvent;
switch (blockDeltaEvent.delta.type) {
case "text_delta":
yield chatChunk({
content: value.delta.text,
content: blockDeltaEvent.delta.text,
model,
});
break;
@ -322,7 +396,7 @@ export class AnthropicApi implements BaseLlmApi {
index: 0,
function: {
name: lastToolUseName,
arguments: value.delta.partial_json,
arguments: blockDeltaEvent.delta.partial_json,
},
},
],
@ -352,25 +426,24 @@ export class AnthropicApi implements BaseLlmApi {
async *chatCompletionStream(
body: ChatCompletionCreateParamsStreaming,
signal: AbortSignal,
): AsyncGenerator<ChatCompletionChunk, any, unknown> {
body.messages;
): AsyncGenerator<ChatCompletionChunk> {
const response = await customFetch(this.config.requestOptions)(
new URL("messages", this.apiBase),
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"anthropic-version": "2023-06-01",
"anthropic-beta": "prompt-caching-2024-07-31",
"x-api-key": this.config.apiKey,
},
headers: this.getHeaders(),
body: JSON.stringify(this._convertBody(body)),
signal,
},
);
yield* this.handleStreamResponse(response, body.model);
}
private getHeaders(): Record<string, string> {
const enableCaching = this.config?.cachingStrategy !== "none";
return getAnthropicHeaders(this.config.apiKey, enableCaching);
}
async completionNonStream(
body: CompletionCreateParamsNonStreaming,
signal: AbortSignal,
@ -380,13 +453,13 @@ export class AnthropicApi implements BaseLlmApi {
async *completionStream(
body: CompletionCreateParamsStreaming,
signal: AbortSignal,
): AsyncGenerator<Completion, any, unknown> {
): AsyncGenerator<Completion> {
throw new Error("Method not implemented.");
}
async *fimStream(
body: FimCreateParamsStreaming,
signal: AbortSignal,
): AsyncGenerator<ChatCompletionChunk, any, unknown> {
): AsyncGenerator<ChatCompletionChunk> {
throw new Error("Method not implemented.");
}

View file

@ -1,24 +1,42 @@
import { MessageCreateParams, ToolUnion } from "@anthropic-ai/sdk/resources";
import {
CACHING_STRATEGIES,
CachingStrategy,
CachingStrategyName,
getAvailableStrategies,
getStrategyDescription,
} from "./AnthropicCachingStrategies.js";
const body_params = {
model: "claude",
stream: true,
max_tokens: 8192,
};
const makeTool = (name: string): ToolUnion => ({
name,
input_schema: {
type: "object",
},
});
describe("AnthropicCachingStrategies", () => {
describe("noCachingStrategy", () => {
it("should return the body unchanged", () => {
const body = { system: "test", messages: [] };
const body: MessageCreateParams = {
system: "test",
messages: [],
...body_params,
};
const result = CACHING_STRATEGIES.none(body);
expect(result).toBe(body);
});
it("should not modify complex objects", () => {
const body = {
system: [{ text: "test" }],
tools: [{ name: "test" }],
messages: [{ content: "test" }],
const body: MessageCreateParams = {
system: [{ type: "text", text: "test" }],
tools: [makeTool("test")],
messages: [{ role: "user", content: "test" }],
...body_params,
};
const result = CACHING_STRATEGIES.none(body);
expect(result).toBe(body);
@ -27,24 +45,37 @@ describe("AnthropicCachingStrategies", () => {
describe("systemOnlyStrategy", () => {
it("should add cache_control to system messages array", () => {
const body = {
system: [{ text: "system message 1" }, { text: "system message 2" }],
messages: [{ content: "user message" }],
const body: MessageCreateParams = {
system: [
{ type: "text", text: "system message 1" },
{ type: "text", text: "system message 2" },
],
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemOnly(body);
expect(result.system).toEqual([
{ text: "system message 1", cache_control: { type: "ephemeral" } },
{ text: "system message 2", cache_control: { type: "ephemeral" } },
{
type: "text",
text: "system message 1",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 2",
cache_control: { type: "ephemeral" },
},
]);
expect(result.messages).toEqual(body.messages);
});
it("should return body unchanged if system is not an array", () => {
const body = {
const body: MessageCreateParams = {
system: "string system message",
messages: [{ content: "user message" }],
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemOnly(body);
@ -52,8 +83,9 @@ describe("AnthropicCachingStrategies", () => {
});
it("should return body unchanged if system is undefined", () => {
const body = {
messages: [{ content: "user message" }],
const body: MessageCreateParams = {
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemOnly(body);
@ -61,25 +93,42 @@ describe("AnthropicCachingStrategies", () => {
});
it("should not add more than 5 cached messages", () => {
const body = {
const body: MessageCreateParams = {
system: [
{ text: "system message 1" },
{ text: "system message 2" },
{ text: "system message 3" },
{ text: "system message 4" },
{ text: "system message 5" },
{ type: "text", text: "system message 1" },
{ type: "text", text: "system message 2" },
{ type: "text", text: "system message 3" },
{ type: "text", text: "system message 4" },
{ type: "text", text: "system message 5" },
],
messages: [{ content: "user message" }],
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemOnly(body);
expect(result.system).toEqual([
{ text: "system message 1", cache_control: { type: "ephemeral" } },
{ text: "system message 2", cache_control: { type: "ephemeral" } },
{ text: "system message 3", cache_control: { type: "ephemeral" } },
{ text: "system message 4", cache_control: { type: "ephemeral" } },
{ text: "system message 5" },
{
type: "text",
text: "system message 1",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 2",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 3",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 4",
cache_control: { type: "ephemeral" },
},
{ type: "text", text: "system message 5" },
]);
expect(result.messages).toEqual(body.messages);
});
@ -87,82 +136,116 @@ describe("AnthropicCachingStrategies", () => {
describe("systemAndToolsStrategy", () => {
it("should add cache_control to both system and tools", () => {
const body = {
system: [{ text: "system message" }],
tools: [{ name: "tool1" }, { name: "tool2" }],
messages: [{ content: "user message" }],
const body: MessageCreateParams = {
system: [{ type: "text", text: "system message" }],
tools: [makeTool("tool1"), makeTool("tool2")],
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemAndTools(body);
expect(result.system).toEqual([
{ text: "system message", cache_control: { type: "ephemeral" } },
{
type: "text",
text: "system message",
cache_control: { type: "ephemeral" },
},
]);
expect(result.tools).toEqual([
{ name: "tool1" },
{ name: "tool2", cache_control: { type: "ephemeral" } },
{
name: "tool1",
input_schema: {
type: "object",
},
},
{
name: "tool2",
input_schema: {
type: "object",
},
cache_control: { type: "ephemeral" },
},
]);
expect(result.messages).toEqual(body.messages);
});
it("should handle missing system messages", () => {
const body = {
tools: [{ name: "tool1" }],
messages: [{ content: "user message" }],
const body: MessageCreateParams = {
tools: [makeTool("tool1")],
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemAndTools(body);
expect(result.tools).toEqual([
{ name: "tool1", cache_control: { type: "ephemeral" } },
{
name: "tool1",
input_schema: {
type: "object",
},
cache_control: { type: "ephemeral" },
},
]);
expect(result.messages).toEqual(body.messages);
});
it("should handle missing tools", () => {
const body = {
system: [{ text: "system message" }],
messages: [{ content: "user message" }],
const body: MessageCreateParams = {
system: [{ type: "text", text: "system message" }],
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemAndTools(body);
expect(result.system).toEqual([
{ text: "system message", cache_control: { type: "ephemeral" } },
{
type: "text",
text: "system message",
cache_control: { type: "ephemeral" },
},
]);
expect(result.messages).toEqual(body.messages);
});
it("should handle non-array system and tools", () => {
const body = {
system: "string system",
tools: "string tools",
messages: [{ content: "user message" }],
};
const result = CACHING_STRATEGIES.systemAndTools(body);
expect(result).toEqual(body);
});
it("should add only 4 cache controls in total to both system and tools", () => {
const body = {
const body: MessageCreateParams = {
system: [
{ text: "system message 1" },
{ text: "system message 2" },
{ text: "system message 3" },
{ text: "system message 4" },
{ type: "text", text: "system message 1" },
{ type: "text", text: "system message 2" },
{ type: "text", text: "system message 3" },
{ type: "text", text: "system message 4" },
],
tools: [{ name: "tool1" }, { name: "tool2" }],
messages: [{ content: "user message" }],
tools: [makeTool("tool1"), makeTool("tool2")],
messages: [{ role: "user", content: "user message" }],
...body_params,
};
const result = CACHING_STRATEGIES.systemAndTools(body);
expect(result.system).toEqual([
{ text: "system message 1", cache_control: { type: "ephemeral" } },
{ text: "system message 2", cache_control: { type: "ephemeral" } },
{ text: "system message 3", cache_control: { type: "ephemeral" } },
{ text: "system message 4", cache_control: { type: "ephemeral" } },
{
type: "text",
text: "system message 1",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 2",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 3",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 4",
cache_control: { type: "ephemeral" },
},
]);
expect(result.tools).toEqual(body.tools);
expect(result.messages).toEqual(body.messages);
@ -171,32 +254,45 @@ describe("AnthropicCachingStrategies", () => {
describe("optimizedStrategy", () => {
it("should cache system messages and tools", () => {
const body = {
system: [{ text: "system message" }],
tools: [{ name: "tool1" }],
messages: [{ content: "short message" }],
const body: MessageCreateParams = {
system: [{ type: "text", text: "system message" }],
tools: [makeTool("tool1")],
messages: [{ role: "user", content: "short message" }],
...body_params,
};
const result = CACHING_STRATEGIES.optimized(body);
expect(result.system).toEqual([
{ text: "system message", cache_control: { type: "ephemeral" } },
{
type: "text",
text: "system message",
cache_control: { type: "ephemeral" },
},
]);
expect(result.tools).toEqual([
{ name: "tool1", cache_control: { type: "ephemeral" } },
{
name: "tool1",
input_schema: {
type: "object",
},
cache_control: { type: "ephemeral" },
},
]);
});
it("should cache large string messages (>500 tokens)", () => {
const largeContent = "a".repeat(2100); // ~525 tokens
const body = {
messages: [{ content: largeContent }],
const body: MessageCreateParams = {
messages: [{ role: "user", content: largeContent }],
...body_params,
};
const result = CACHING_STRATEGIES.optimized(body);
expect(result.messages).toEqual([
{
role: "user",
content: [
{
type: "text",
@ -210,30 +306,42 @@ describe("AnthropicCachingStrategies", () => {
it("should not cache small string messages (<500 tokens)", () => {
const smallContent = "a".repeat(100); // ~25 tokens
const body = {
messages: [{ content: smallContent }],
const body: MessageCreateParams = {
messages: [{ role: "user", content: smallContent }],
...body_params,
};
const result = CACHING_STRATEGIES.optimized(body);
expect(result.messages).toEqual([{ content: smallContent }]);
expect(result.messages).toEqual([
{ role: "user", content: smallContent },
]);
});
it("should cache large text items in array content but only once per message", () => {
const largeText = "a".repeat(2100); // ~525 tokens
const anotherLargeText = "b".repeat(2100); // Also ~525 tokens
const smallText = "a".repeat(100); // ~25 tokens
const body = {
const body: MessageCreateParams = {
messages: [
{
role: "user",
content: [
{ type: "text", text: largeText },
{ type: "text", text: anotherLargeText },
{ type: "text", text: smallText },
{ type: "image", data: "image_data" },
{
type: "image",
source: {
data: "image_data",
media_type: "image/jpeg",
type: "base64",
},
},
],
},
],
...body_params,
};
const result = CACHING_STRATEGIES.optimized(body);
@ -241,6 +349,7 @@ describe("AnthropicCachingStrategies", () => {
// Only the first large text item should get cache_control
expect(result.messages).toEqual([
{
role: "user",
content: [
{
type: "text",
@ -249,40 +358,78 @@ describe("AnthropicCachingStrategies", () => {
},
{ type: "text", text: anotherLargeText },
{ type: "text", text: smallText },
{ type: "image", data: "image_data" },
{
type: "image",
source: {
data: "image_data",
media_type: "image/jpeg",
type: "base64",
},
},
],
},
]);
});
it("should add maximum 4 cache control blocks", () => {
const body = {
system: [{ text: "system message 1" }, { text: "system message 2" }],
tools: [{ name: "tool" }],
const body: MessageCreateParams = {
system: [
{ type: "text", text: "system message 1" },
{ type: "text", text: "system message 2" },
],
tools: [makeTool("tool")],
messages: [
{ content: "small content" },
{ content: "a".repeat(2100) },
{ content: "b".repeat(2100) },
{ role: "user", content: "small content" },
{ role: "user", content: "a".repeat(2100) },
{ role: "user", content: "b".repeat(2100) },
{
role: "user",
content: [
{ type: "text", text: "c".repeat(2100) },
{ type: "image", data: "image" },
{
type: "image",
source: {
data: "image_data",
media_type: "image/jpeg",
type: "base64",
},
},
],
},
],
...body_params,
};
const result = CACHING_STRATEGIES.optimized(body);
expect(result.system).toEqual([
{ text: "system message 1", cache_control: { type: "ephemeral" } },
{ text: "system message 2", cache_control: { type: "ephemeral" } },
{
type: "text",
text: "system message 1",
cache_control: { type: "ephemeral" },
},
{
type: "text",
text: "system message 2",
cache_control: { type: "ephemeral" },
},
]);
expect(result.tools).toEqual([
{ name: "tool", cache_control: { type: "ephemeral" } },
{
name: "tool",
input_schema: {
type: "object",
},
cache_control: { type: "ephemeral" },
},
]);
expect(result.messages[0]).toEqual({ content: "small content" });
expect(result.messages[0]).toEqual({
role: "user",
content: "small content",
});
expect(result.messages[1]).toEqual({
role: "user",
content: [
{
type: "text",
@ -296,31 +443,50 @@ describe("AnthropicCachingStrategies", () => {
});
it("should handle complex message structure", () => {
const body = {
system: [{ text: "system" }],
tools: [{ name: "tool" }],
const body: MessageCreateParams = {
system: [{ type: "text", text: "system" }],
tools: [makeTool("tool")],
messages: [
{ content: "small content" },
{ content: "a".repeat(2100) }, // large content
{ role: "user", content: "small content" },
{ role: "user", content: "a".repeat(2100) }, // large content
{
role: "user",
content: [
{ type: "text", text: "a".repeat(2100) }, // large text
{ type: "image", data: "image" },
{
type: "image",
source: {
data: "image_data",
media_type: "image/jpeg",
type: "base64",
},
},
],
},
],
...body_params,
};
const result = CACHING_STRATEGIES.optimized(body);
expect(result.system).toEqual([
{ text: "system", cache_control: { type: "ephemeral" } },
{ type: "text", text: "system", cache_control: { type: "ephemeral" } },
]);
expect(result.tools).toEqual([
{ name: "tool", cache_control: { type: "ephemeral" } },
{
name: "tool",
input_schema: {
type: "object",
},
cache_control: { type: "ephemeral" },
},
]);
expect(result.messages[0]).toEqual({ content: "small content" });
expect(result.messages[0]).toEqual({
role: "user",
content: "small content",
});
expect(result.messages[1]).toEqual({
role: "user",
content: [
{
type: "text",
@ -337,30 +503,17 @@ describe("AnthropicCachingStrategies", () => {
});
it("should handle empty or missing messages", () => {
const body = {
system: [{ text: "system" }],
const body: MessageCreateParams = {
system: [{ type: "text", text: "system" }],
messages: [],
...body_params,
};
const result = CACHING_STRATEGIES.optimized(body);
expect(result.system).toEqual([
{ text: "system", cache_control: { type: "ephemeral" } },
{ type: "text", text: "system", cache_control: { type: "ephemeral" } },
]);
expect(result.messages).toBeUndefined();
});
it("should handle non-array messages", () => {
const body = {
system: [{ text: "system" }],
messages: "not an array",
};
const result = CACHING_STRATEGIES.optimized(body);
expect(result.system).toEqual([
{ text: "system", cache_control: { type: "ephemeral" } },
]);
expect(result.messages).toBe("not an array");
});
});
@ -370,8 +523,14 @@ describe("AnthropicCachingStrategies", () => {
const smallContent = "a".repeat(100); // ~25 tokens
const largeContent = "a".repeat(2100); // ~525 tokens
const bodySmall = { messages: [{ content: smallContent }] };
const bodyLarge = { messages: [{ content: largeContent }] };
const bodySmall: MessageCreateParams = {
messages: [{ role: "user", content: smallContent }],
...body_params,
};
const bodyLarge: MessageCreateParams = {
messages: [{ role: "user", content: largeContent }],
...body_params,
};
const resultSmall = CACHING_STRATEGIES.optimized(bodySmall);
const resultLarge = CACHING_STRATEGIES.optimized(bodyLarge);
@ -429,21 +588,6 @@ describe("AnthropicCachingStrategies", () => {
});
});
});
describe("CachingStrategy type", () => {
it("should accept valid caching strategy functions", () => {
const customStrategy: CachingStrategy = (body) => ({
...body,
custom: true,
});
const input = { test: "value" };
const result = customStrategy(input);
expect(result).toEqual({ test: "value", custom: true });
});
});
describe("CachingStrategyName type", () => {
it("should work with valid strategy names", () => {
const strategyNames: CachingStrategyName[] = [

View file

@ -1,21 +1,25 @@
import { MessageCreateParams } from "@anthropic-ai/sdk/resources";
const MAX_CACHING_MESSAGES = 4;
// Caching strategy type - transforms a clean Anthropic body by adding cache_control
export type CachingStrategy = (anthropicBody: any) => any;
export type CachingStrategy = (
anthropicBody: MessageCreateParams,
) => MessageCreateParams;
// Utility function to estimate token count
const estimateTokenCount = (text: string): number => Math.ceil(text.length / 4);
// Strategy 1: No Caching (Baseline)
// Strategy 1: No Caching
const noCachingStrategy: CachingStrategy = (body) => body;
// Strategy 2: System Messages Only (Current Implementation)
// Strategy 2: System Messages Only
const systemOnlyStrategy: CachingStrategy = (body) => {
let availableCacheMessages = MAX_CACHING_MESSAGES;
if (body.system && Array.isArray(body.system)) {
return {
...body,
system: body.system.map((item: any) => {
system: body.system.map((item) => {
if (availableCacheMessages > 0) {
availableCacheMessages -= 1;
return {
@ -37,7 +41,7 @@ const systemAndToolsStrategy: CachingStrategy = (body) => {
// Cache system messages
if (result.system && Array.isArray(result.system)) {
result.system = result.system.map((item: any) => {
result.system = result.system.map((item) => {
if (availableCacheMessages > 0) {
availableCacheMessages -= 1;
return {
@ -51,8 +55,8 @@ const systemAndToolsStrategy: CachingStrategy = (body) => {
// Cache tool definitions
if (result.tools && Array.isArray(result.tools) && result.tools.length > 0) {
result.tools = result.tools.map((tool: any, index: number) => {
if (index === result.tools.length - 1 && availableCacheMessages > 0) {
result.tools = result.tools.map((tool, index: number) => {
if (index === result.tools!.length - 1 && availableCacheMessages > 0) {
availableCacheMessages -= 1;
return {
...tool,
@ -73,7 +77,7 @@ const optimizedStrategy: CachingStrategy = (body) => {
// Always cache system messages
if (result.system && Array.isArray(result.system)) {
result.system = result.system.map((item: any) => {
result.system = result.system.map((item) => {
if (availableCacheMessages > 0) {
availableCacheMessages -= 1;
return {
@ -87,8 +91,8 @@ const optimizedStrategy: CachingStrategy = (body) => {
// Cache tool definitions
if (result.tools && Array.isArray(result.tools) && result.tools.length > 0) {
result.tools = result.tools.map((tool: any, index: number) => {
if (index === result.tools.length - 1 && availableCacheMessages > 0) {
result.tools = result.tools.map((tool, index: number) => {
if (index === result.tools!.length - 1 && availableCacheMessages > 0) {
availableCacheMessages -= 1;
return {
...tool,
@ -101,7 +105,7 @@ const optimizedStrategy: CachingStrategy = (body) => {
// Cache large messages (>500 tokens)
if (result.messages && Array.isArray(result.messages)) {
result.messages = result.messages.map((message: any) => {
result.messages = result.messages.map((message) => {
if (message.content && typeof message.content === "string") {
const tokens = estimateTokenCount(message.content);
if (tokens > 500 && availableCacheMessages > 0) {
@ -112,7 +116,7 @@ const optimizedStrategy: CachingStrategy = (body) => {
{
type: "text",
text: message.content,
cache_control: { type: "ephemeral" },
cache_control: { type: "ephemeral" as const },
},
],
};
@ -120,7 +124,7 @@ const optimizedStrategy: CachingStrategy = (body) => {
} else if (message.content && Array.isArray(message.content)) {
// Only add one cache control per message with array content
let addedCacheControl = false;
const updatedContent = message.content.map((item: any) => {
const updatedContent = message.content.map((item) => {
if (item.type === "text" && item.text) {
const tokens = estimateTokenCount(item.text);
if (
@ -132,7 +136,7 @@ const optimizedStrategy: CachingStrategy = (body) => {
addedCacheControl = true;
return {
...item,
cache_control: { type: "ephemeral" },
cache_control: { type: "ephemeral" as const },
};
}
}

View file

@ -0,0 +1,139 @@
import {
Base64ImageSource,
ErrorResponse,
MessageParam,
Tool,
ToolChoice,
} from "@anthropic-ai/sdk/resources";
import {
ChatCompletionTool,
ChatCompletionToolChoiceOption,
} from "openai/resources";
export function getAnthropicErrorMessage(response: ErrorResponse): string {
switch (response.error.type) {
case "api_error":
return "An unexpected error has occurred internal to Anthropic's systems.";
case "invalid_request_error":
return "There was an issue with the format or content of your request.";
case "authentication_error":
return "There's an issue with your API key.";
case "permission_error":
return "Your API key does not have permission to use the specified resource.";
case "not_found_error":
return "The requested resource was not found.";
case "rate_limit_error":
return "Your account has hit a rate limit.";
case "overloaded_error":
return "Anthropic's API is temporarily overloaded. Please check their status page: https://status.anthropic.com/#past-incidents";
case "timeout_error":
return "Anthropic API timed out. Please check their status page: https://status.anthropic.com/#past-incidents";
case "billing_error":
default:
return response.error.message;
}
}
export function getAnthropicHeaders(
apiKey: string,
enableCaching: boolean,
): Record<string, string> {
const headers: Record<string, string> = {
"Content-Type": "application/json",
Accept: "application/json",
"anthropic-version": "2023-06-01",
"x-api-key": apiKey,
};
if (enableCaching) {
headers["anthropic-beta"] = "prompt-caching-2024-07-31";
}
return headers;
}
export function addCacheControlToLastTwoUserMessages(messages: MessageParam[]) {
let userMessages = 0;
for (let i = messages.length - 1; i >= 0; i--) {
const msg = messages[i];
if (msg.role === "user") {
userMessages++;
if (typeof msg.content === "string") {
continue;
}
for (let j = msg.content.length - 1; j >= 0; j--) {
const part = msg.content[j];
if (part.type === "text") {
part.cache_control = { type: "ephemeral" };
break;
}
}
if (userMessages >= 2) {
break;
}
}
}
}
export function openAiToolChoiceToAnthropicToolChoice(
toolChoice: ChatCompletionToolChoiceOption | undefined,
): ToolChoice | undefined {
if (!toolChoice) {
return undefined;
}
switch (toolChoice) {
case "none":
// "none" is handled by excluding tools
return undefined;
case "required":
return {
type: "any",
};
case "auto":
return {
type: "auto",
};
default:
switch (toolChoice.type) {
case "allowed_tools":
// Filtering of tools is handled elsewhere
return {
type: toolChoice.allowed_tools.mode === "auto" ? "auto" : "any",
};
case "custom":
return undefined; // TODO not supported yet
case "function":
return {
type: "tool",
name: toolChoice.function.name,
};
}
}
}
export function openaiToolToAnthropicTool(tool: ChatCompletionTool): Tool {
if (tool.type === "function" && "function" in tool) {
return {
name: tool.function.name,
description: tool.function.description,
input_schema: tool.function.parameters as Tool.InputSchema, // TODO unsafe cast, may be differences between openai tool schema and anthropic tool schema,
};
} else {
throw new Error(`Unsupported tool type in Anthropic: ${tool.type}`);
}
}
// Extract media type from data URL (ex. "data:image/png;base64,..." -> "image/png")
export function getAnthropicMediaTypeFromDataUrl(
dataUrl: string,
): Base64ImageSource["media_type"] {
const match = dataUrl.match(/^data:([^;]+);base64,/);
if (match) {
switch (match[1]) {
case "image/png":
case "image/gif":
case "image/webp":
return match[1];
}
}
return "image/jpeg";
}

View file

@ -44,7 +44,7 @@ import {
function getSecureID(): string {
// Adding a type declaration for the static property
if (!(getSecureID as any).uuid) {
(getSecureID as any).uuid = crypto.randomUUID();
(getSecureID as any).uuid = uuidv4();
}
return `<!-- SID: ${(getSecureID as any).uuid} -->`;
}

View file

@ -0,0 +1,132 @@
import {
ChatCompletion,
ChatCompletionChunk,
ChatCompletionCreateParams,
ChatCompletionCreateParamsNonStreaming,
ChatCompletionCreateParamsStreaming,
Completion,
CompletionCreateParamsNonStreaming,
CompletionCreateParamsStreaming,
CreateEmbeddingResponse,
EmbeddingCreateParams,
Model,
} from "openai/resources/index";
import { CometAPIConfig } from "../types.js";
import {
BaseLlmApi,
CreateRerankResponse,
FimCreateParamsStreaming,
RerankCreateParams,
} from "./base.js";
import { OpenAIApi } from "./OpenAI.js";
/**
* CometAPI adapter - extends OpenAI adapter since CometAPI is OpenAI-compatible
*
* CometAPI provides access to multiple LLM providers (GPT, Claude, Gemini, etc.)
* through a unified OpenAI-compatible API interface.
*/
export class CometAPIApi extends OpenAIApi implements BaseLlmApi {
// Store the original CometAPI config separately
private cometConfig: CometAPIConfig;
constructor(config: CometAPIConfig) {
// CometAPI uses OpenAI-compatible API, so we can reuse OpenAI adapter
// Convert CometAPI config to OpenAI-compatible config for the base class
const openAICompatibleConfig = {
...config,
provider: "openai" as const,
apiBase: config.apiBase ?? "https://api.cometapi.com/v1/",
};
super(openAICompatibleConfig);
// Store original config after super() call
this.cometConfig = config;
}
/**
* Override list method to handle CometAPI-specific model filtering
* The core filtering logic is handled in the CometAPI provider class
*/
async list(): Promise<Model[]> {
try {
return await super.list();
} catch (error) {
// Fallback to empty list if model listing fails
console.warn("CometAPI: Failed to fetch model list", error);
return [];
}
}
/**
* Chat completion - uses OpenAI-compatible format
*/
async chatCompletionNonStream(
body: ChatCompletionCreateParamsNonStreaming,
signal: AbortSignal,
): Promise<ChatCompletion> {
return super.chatCompletionNonStream(body, signal);
}
/**
* Streaming chat completion - uses OpenAI-compatible format
*/
async *chatCompletionStream(
body: ChatCompletionCreateParamsStreaming,
signal: AbortSignal,
): AsyncGenerator<ChatCompletionChunk> {
yield* super.chatCompletionStream(body, signal);
}
/**
* Legacy completion endpoint support
*/
completionNonStream(
body: CompletionCreateParamsNonStreaming,
signal: AbortSignal,
): Promise<Completion> {
return super.completionNonStream(body, signal);
}
/**
* Legacy streaming completion endpoint support
*/
completionStream(
body: CompletionCreateParamsStreaming,
signal: AbortSignal,
): AsyncGenerator<Completion> {
return super.completionStream(body, signal);
}
/**
* Fill-in-the-middle completion support
*/
fimStream(
body: FimCreateParamsStreaming,
signal: AbortSignal,
): AsyncGenerator<ChatCompletionChunk> {
return super.fimStream(body, signal);
}
/**
* Embeddings support (if available through CometAPI)
*/
async embed(body: EmbeddingCreateParams): Promise<CreateEmbeddingResponse> {
try {
return await super.embed(body);
} catch (error) {
throw new Error(`CometAPI embeddings not supported: ${error}`);
}
}
/**
* Reranking support (if available through CometAPI)
*/
async rerank(body: RerankCreateParams): Promise<CreateRerankResponse> {
try {
return await super.rerank(body);
} catch (error) {
throw new Error(`CometAPI reranking not supported: ${error}`);
}
}
}

View file

@ -18,6 +18,7 @@ import { VertexAIApi } from "./apis/VertexAI.js";
import { WatsonXApi } from "./apis/WatsonX.js";
import { BaseLlmApi } from "./apis/base.js";
import { LLMConfig, OpenAIConfigSchema } from "./types.js";
import { CometAPIApi } from "./apis/CometAPI.js";
import { appendPathToUrlIfNotPresent } from "./util/appendPathToUrl.js";
dotenv.config();
@ -69,6 +70,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined {
return new BedrockApi(config);
case "cohere":
return new CohereApi(config);
case "cometapi":
return new CometAPIApi(config);
case "anthropic":
return new AnthropicApi(config);
case "gemini":
@ -177,3 +180,10 @@ export {
// export
export type { BaseLlmApi } from "./apis/base.js";
export type { LLMConfig } from "./types.js";
export {
addCacheControlToLastTwoUserMessages,
getAnthropicErrorMessage,
getAnthropicHeaders,
getAnthropicMediaTypeFromDataUrl,
} from "./apis/AnthropicUtils.js";

View file

@ -50,7 +50,17 @@ describe("Anthropic Adapter Tests", () => {
"x-api-key": "test-api-key",
},
body: {
messages: [{ role: "user", content: "hello" }],
messages: [
{
role: "user",
content: [
{
type: "text",
text: "hello",
},
],
},
],
system: undefined,
model: "claude-3-5-sonnet-20241022",
max_tokens: 32000,
@ -104,7 +114,17 @@ describe("Anthropic Adapter Tests", () => {
"x-api-key": "test-api-key",
},
body: {
messages: [{ role: "user", content: "hello" }],
messages: [
{
role: "user",
content: [
{
type: "text",
text: "hello",
},
],
},
],
system: undefined,
model: "claude-3-5-sonnet-20241022",
max_tokens: 32000,
@ -159,7 +179,17 @@ describe("Anthropic Adapter Tests", () => {
"x-api-key": "test-api-key",
},
body: {
messages: [{ role: "user", content: "hello" }],
messages: [
{
role: "user",
content: [
{
type: "text",
text: "hello",
},
],
},
],
system: [
{
type: "text",

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