Merge branch 'main' into docs-beta-cli

This commit is contained in:
uinstinct 2025-11-04 09:07:56 +05:30
commit e38b99799d
107 changed files with 3689 additions and 687 deletions

View file

@ -27,5 +27,5 @@ jobs:
path-to-document: "https://github.com/continuedev/continue/blob/main/CLA.md"
branch: cla-signatures
# Bots and CLAs signed outside of GitHub
allowlist: dependabot[bot],fbricon,panyamkeerthana,Jazzcort,owtaylor,halfline,agent@continue.dev,action@github.com
allowlist: dependabot[bot],fbricon,panyamkeerthana,Jazzcort,owtaylor,halfline,agent@continue.dev,action@github.com,snyk-bot
signed-commit-message: "CLA signed in $pullRequestNo"

View file

@ -294,44 +294,44 @@ jobs:
# Store already-built plugin as an artifact for downloading
- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./extensions/intellij/build/distributions/content/*/*
# Upload binaries as artifacts
- name: Upload artifact (darwin-arm64)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: continue-binary-darwin-arm64
path: ./binary/bin/darwin-arm64/
- name: Upload artifact (darwin-x64)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: continue-binary-darwin-x64
path: ./binary/bin/darwin-x64/
- name: Upload artifact (win32-x64)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: continue-binary-win32-x64
path: ./binary/bin/win32-x64/
- name: Upload artifact (win32-arm64)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: continue-binary-win32-arm64
path: ./binary/bin/win32-arm64/
- name: Upload artifact (linux-arm64)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: continue-binary-linux-arm64
path: ./binary/bin/linux-arm64/
- name: Upload artifact (linux-x64)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: continue-binary-linux-x64
path: ./binary/bin/linux-x64/
@ -398,7 +398,7 @@ jobs:
# Download the binary artifact
- name: Download binary artifact
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }}
path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/
@ -420,7 +420,7 @@ jobs:
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: core-logs-${{ matrix.platform }}-${{ matrix.arch }}
path: ~/.continue/logs/core.log
@ -455,7 +455,7 @@ jobs:
# Collect Tests Result of failed tests
- name: Collect Tests Result
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: tests-result
path: ${{ github.workspace }}/extensions/intellij/build/reports/tests
@ -540,7 +540,7 @@ jobs:
# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
if: ${{ always() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier
@ -563,7 +563,7 @@ jobs:
# ./gradlew patchChangelog --release-note="$CHANGELOG"
- name: Download the plugin
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/

View file

@ -101,7 +101,7 @@ jobs:
echo "✅ Successfully downloaded artifact"
- name: Republish as main branch artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: vscode-extension-build-${{ matrix.platform }}
path: ./temp-download/*

View file

@ -99,7 +99,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload .vsix artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix
path: "extensions/vscode/*.vsix"
@ -120,7 +120,7 @@ jobs:
git config --local user.name "GitHub Action"
# Download the .vsix artifacts
- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v6
with:
pattern: "*-vsix"
path: vsix-artifacts
@ -156,7 +156,7 @@ jobs:
run: git fetch origin ${{ github.ref }} && git checkout ${{ github.ref }}
# 1. Download the artifacts
- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v6
with:
pattern: "*-vsix"
path: vsix-artifacts

View file

@ -69,7 +69,7 @@ jobs:
${{ steps.read-metrics.outputs.metrics_content }}
- name: Upload metrics report as artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: issue-metrics-report
path: ./issue_metrics.md

View file

@ -39,13 +39,13 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: vscode-extension-build-${{ matrix.platform }}-${{ matrix.arch }}
path: extensions/vscode/build
- name: Upload .vsix artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix
path: "extensions/vscode/*.vsix"

View file

@ -303,7 +303,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: vscode-extension-build-Linux
path: extensions/vscode/build

View file

@ -83,7 +83,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload .vsix artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix
path: "extensions/vscode/*.vsix"
@ -104,7 +104,7 @@ jobs:
git config --local user.name "GitHub Action"
# Download the .vsix artifacts
- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v6
with:
pattern: "*-vsix"
path: vsix-artifacts
@ -142,7 +142,7 @@ jobs:
run: git fetch origin ${{ github.ref }} && git checkout ${{ github.ref }}
# 1. Download the artifacts
- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v6
with:
pattern: "*-vsix"
path: vsix-artifacts

View file

@ -27,35 +27,29 @@
**Ship faster with Continuous AI**
**Build and run custom agents across your IDE, terminal, and CI**
**The future of coding isn't writing more code. It's delegating the boring parts, so you can build the interesting stuff**
</div>
Get started in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue), [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension), or [CLI](https://docs.continue.dev/guides/cli)
Get started in [Mission Control](https://hub.continue.dev/agents), [CLI (Headless Mode)](https://docs.continue.dev/cli/quick-start#headless-mode), or [CLI (TUI mode)](https://docs.continue.dev/cli/quick-start#tui-mode)
## Agent
## Background Agents
[Agent](https://docs.continue.dev/ide-extensions/agent/quick-start) to work on development tasks together with AI
Set workflows to run automatically on [PR opens](https://docs.continue.dev/guides/continuous-ai#pattern-2-the-pr-review-agent), [schedules](https://docs.continue.dev/guides/continuous-ai#pattern-1-the-async-triage-bot), or [any event trigger](https://docs.continue.dev/cli/quick-start#headless-mode)
![agent](docs/images/agent.gif)
![Background Agents](docs/images/background-agent.gif)
## Chat
## CLI Agents
[Chat](https://docs.continue.dev/ide-extensions/chat/quick-start) to ask general questions and clarify code sections
Watch workflows execute in real-time and approve decisions step-by-step from your [terminal](https://docs.continue.dev/cli/quick-start#tui-mode)
![chat](docs/images/chat.gif)
![CLI Agents](docs/images/cli-agent.gif)
## Edit
## IDE Agents
[Edit](https://docs.continue.dev/ide-extensions/edit/quick-start) to modify a code section without leaving your current file
Trigger workflows from [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)—let agents handle the refactoring while you keep coding
![edit](docs/images/edit.gif)
## Autocomplete
[Autocomplete](https://docs.continue.dev/ide-extensions/autocomplete/quick-start) to receive inline code suggestions as you type
![autocomplete](docs/images/autocomplete.gif)
![IDE Agents](docs/images/agent.gif)
</div>

View file

@ -115,6 +115,45 @@ runs:
shell: bash
run: npm install -g @continuedev/cli@latest
- name: Setup Action Scripts
if: env.SHOULD_RUN == 'true'
shell: bash
run: |
# Create directory for scripts
mkdir -p .continue-action-scripts
# Check if we're running in the Continue repo itself (scripts exist locally)
if [ -f "actions/general-review/scripts/buildPrompt.js" ] && [ -f "actions/general-review/scripts/writeMarkdown.js" ]; then
echo "Running in Continue repo - using local scripts from current checkout"
cp actions/general-review/scripts/buildPrompt.js .continue-action-scripts/buildPrompt.js
cp actions/general-review/scripts/writeMarkdown.js .continue-action-scripts/writeMarkdown.js
else
echo "Running in external repo - downloading scripts from Continue repo"
# Download scripts from Continue repo
echo "Downloading buildPrompt.js..."
curl -sSL https://raw.githubusercontent.com/continuedev/continue/main/actions/general-review/scripts/buildPrompt.js \
-o .continue-action-scripts/buildPrompt.js
echo "Downloading writeMarkdown.js..."
curl -sSL https://raw.githubusercontent.com/continuedev/continue/main/actions/general-review/scripts/writeMarkdown.js \
-o .continue-action-scripts/writeMarkdown.js
fi
# Verify scripts exist
if [ ! -f .continue-action-scripts/buildPrompt.js ]; then
echo "Error: buildPrompt.js not found"
exit 1
fi
if [ ! -f .continue-action-scripts/writeMarkdown.js ]; then
echo "Error: writeMarkdown.js not found"
exit 1
fi
echo "Scripts ready:"
ls -lh .continue-action-scripts/
- name: Post Initial Comment
if: env.SHOULD_RUN == 'true'
id: initial-comment
@ -218,7 +257,7 @@ runs:
# Gather PR context and build prompt without heredocs
gh pr diff "$PR_NUMBER" > pr_diff.txt
gh pr view "$PR_NUMBER" --json title,author,body,files > pr_data.json
node actions/general-review/scripts/buildPrompt.js "$PR_NUMBER"
node .continue-action-scripts/buildPrompt.js "$PR_NUMBER"
rm -f pr_data.json
- name: Run Continue CLI Review
@ -241,7 +280,7 @@ runs:
if [ -z "$CONTINUE_API_KEY" ]; then
echo "Warning: CONTINUE_API_KEY environment variable is not set"
# Create fallback review and continue
node actions/general-review/scripts/writeMarkdown.js code_review.md missing_api_key
node .continue-action-scripts/writeMarkdown.js code_review.md missing_api_key
echo "SKIP_CLI=true" >> $GITHUB_ENV
else
echo "SKIP_CLI=false" >> $GITHUB_ENV
@ -263,7 +302,7 @@ runs:
echo "Testing Continue CLI..."
if ! which cn > /dev/null 2>&1; then
echo "Warning: Continue CLI not found or not working"
node actions/general-review/scripts/writeMarkdown.js code_review.md cli_install_failed
node .continue-action-scripts/writeMarkdown.js code_review.md cli_install_failed
echo "SKIP_CLI=true" >> $GITHUB_ENV
else
echo "Continue CLI found at: $(which cn)"
@ -299,7 +338,7 @@ runs:
# Check if output is empty
if [ ! -s code_review.md ]; then
echo "Warning: Continue CLI returned empty output"
node actions/general-review/scripts/writeMarkdown.js code_review.md empty_output
node .continue-action-scripts/writeMarkdown.js code_review.md empty_output
fi
else
echo "Error: Continue CLI command failed with exit code $?"
@ -308,13 +347,13 @@ runs:
# Check for specific error patterns
if grep -q "not found\|ENOENT" cli_error.log 2>/dev/null; then
node actions/general-review/scripts/writeMarkdown.js code_review.md cli_not_found
node .continue-action-scripts/writeMarkdown.js code_review.md cli_not_found
elif grep -q "config\|assistant" cli_error.log 2>/dev/null; then
node actions/general-review/scripts/writeMarkdown.js code_review.md config_error
node .continue-action-scripts/writeMarkdown.js code_review.md config_error
elif grep -q "api\|auth" cli_error.log 2>/dev/null; then
node actions/general-review/scripts/writeMarkdown.js code_review.md auth_error
node .continue-action-scripts/writeMarkdown.js code_review.md auth_error
else
node actions/general-review/scripts/writeMarkdown.js code_review.md generic_failure
node .continue-action-scripts/writeMarkdown.js code_review.md generic_failure
fi
fi

View file

@ -71,6 +71,21 @@ const qwenCoderFimTemplate: AutocompleteTemplate = {
},
};
// https://www.ibm.com/granite/docs/models/granite#fim
const granite4FimTemplate: AutocompleteTemplate = {
template:
"<|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|>",
completionOptions: {
stop: [
"<|end_of_text|>",
"<|fim_prefix|>",
"<|fim_middle|>",
"<|fim_suffix|>",
"<|fim_pad|>",
],
},
};
const seedCoderFimTemplate: AutocompleteTemplate = {
template:
"<[fim-prefix]>{{{prefix}}}<[fim-suffix]>{{{suffix}}}<[fim-middle]>",
@ -442,6 +457,10 @@ export function getTemplateForModel(model: string): AutocompleteTemplate {
return qwenCoderFimTemplate;
}
if (lowerCaseModel.includes("granite") && lowerCaseModel.includes("4")) {
return granite4FimTemplate;
}
if (lowerCaseModel.includes("seed") && lowerCaseModel.includes("coder")) {
return seedCoderFimTemplate;
}

View file

@ -79,7 +79,13 @@ export async function loadMarkdownRules(ide: IDE): Promise<{
uriType: "file",
fileUri: file.path,
});
rules.push({ ...rule, source: "rules-block", sourceFile: file.path });
if (!rule.invokable) {
rules.push({
...rule,
source: "rules-block",
sourceFile: file.path,
});
}
} catch (e) {
errors.push({
fatal: false,

View file

@ -173,13 +173,6 @@ export function migrateJsonSharedConfig(filepath: string, ide: IDE): void {
effected = true;
}
const { autoAcceptEditToolDiffs, ...withoutAutoApply } = migratedUI;
if (autoAcceptEditToolDiffs !== undefined) {
shareConfigUpdates.autoAcceptEditToolDiffs = autoAcceptEditToolDiffs;
migratedUI = withoutAutoApply;
effected = true;
}
const { showChatScrollbar, ...withoutShowChatScrollbar } = migratedUI;
if (showChatScrollbar !== undefined) {
shareConfigUpdates.showChatScrollbar = showChatScrollbar;

View file

@ -31,7 +31,6 @@ export const sharedConfigSchema = z
codeWrap: z.boolean(),
displayRawMarkdown: z.boolean(),
showChatScrollbar: z.boolean(),
autoAcceptEditToolDiffs: z.boolean(),
continueAfterToolRejection: z.boolean(),
// `tabAutocompleteOptions` in `ContinueConfig`
@ -140,10 +139,6 @@ export function modifyAnyConfigWithSharedConfig<
if (sharedConfig.showChatScrollbar !== undefined) {
configCopy.ui.showChatScrollbar = sharedConfig.showChatScrollbar;
}
if (sharedConfig.autoAcceptEditToolDiffs !== undefined) {
configCopy.ui.autoAcceptEditToolDiffs =
sharedConfig.autoAcceptEditToolDiffs;
}
if (sharedConfig.allowAnonymousTelemetry !== undefined) {
configCopy.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry;

View file

@ -352,7 +352,6 @@ export class ControlPlaneClient {
/**
* Check if remote sessions should be enabled based on feature flags
* Requires: PostHog feature flag AND @continue.dev email
*/
public async shouldEnableRemoteSessions(): Promise<boolean> {
// Check if user is signed in
@ -360,17 +359,13 @@ export class ControlPlaneClient {
return false;
}
// Check if user has @continue.dev email
try {
const sessionInfo = await this.sessionInfoPromise;
if (isOnPremSession(sessionInfo) || !sessionInfo) {
return false;
}
const hubSession = sessionInfo as HubSessionInfo;
const email = hubSession.account?.id;
return email ? email.includes("@continue.dev") : false;
return true;
} catch (e) {
Logger.error(e, {
context: "control_plane_check_remote_sessions_enabled",
@ -388,7 +383,6 @@ export class ControlPlaneClient {
/**
* Fetch remote agents/sessions from the control plane
* Currently restricted to @continue.dev emails for internal use
*/
public async listRemoteSessions(): Promise<RemoteSessionMetadata[]> {
if (!(await this.isSignedIn())) {
@ -396,8 +390,6 @@ export class ControlPlaneClient {
}
try {
// Note: This endpoint is currently restricted to internal @continue.dev users
// In the future, this may be expanded to support broader remote session access
const resp = await this.requestAndHandleError("agents/devboxes", {
method: "GET",
});

View file

@ -70,6 +70,7 @@ import {
import { MCPManagerSingleton } from "./context/mcp/MCPManagerSingleton";
import { performAuth, removeMCPAuth } from "./context/mcp/MCPOauth";
import { setMdmLicenseKey } from "./control-plane/mdm/mdm";
import { myersDiff } from "./diff/myers";
import { ApplyAbortManager } from "./edit/applyAbortManager";
import { streamDiffLines } from "./edit/streamDiffLines";
import { shouldIgnore } from "./indexing/shouldIgnore";
@ -796,6 +797,10 @@ export class Core {
);
});
on("getDiffLines", (msg) => {
return myersDiff(msg.data.oldContent, msg.data.newContent);
});
on("cancelApply", async (msg) => {
const abortManager = ApplyAbortManager.getInstance();
abortManager.clear(); // for now abort all streams

1
core/index.d.ts vendored
View file

@ -1404,7 +1404,6 @@ export interface ContinueUIConfig {
showChatScrollbar?: boolean;
codeWrap?: boolean;
showSessionTabs?: boolean;
autoAcceptEditToolDiffs?: boolean;
continueAfterToolRejection?: boolean;
}

View file

@ -185,6 +185,14 @@ function modelSupportsReasoning(
if (!model) {
return false;
}
if (model.completionOptions?.reasoning !== undefined) {
// Reasoning support is forced at the config level. Model might not necessarily support it though!
return model.completionOptions.reasoning;
}
// Seems our current way of disabling reasoning is not working for grok code so results in useless lightbulb
// if (model.model.includes("grok-code")) {
// return true;
// }
// do not turn reasoning on by default for claude 3 models
if (
model.model.includes("claude") &&
@ -196,10 +204,7 @@ function modelSupportsReasoning(
if (model.model.includes("deepseek-r")) {
return true;
}
if (model.completionOptions?.reasoning) {
// Reasoning support is forced at the config level. Model might not necessarily support it though!
return true;
}
return false;
}

View file

@ -63,7 +63,7 @@ export const DEFAULT_AGENT_SYSTEM_MESSAGE = `\
<important_rules>
You are in agent mode.
If you need to use multiple tools, you can call multiple read only tools simultaneously.
If you need to use multiple tools, you can call multiple read-only tools simultaneously.
${CODEBLOCK_FORMATTING_INSTRUCTIONS}

View file

@ -101,9 +101,18 @@ class ContinueProxy extends OpenAI {
protected _getHeaders() {
const headers: any = super._getHeaders();
headers["x-continue-unique-id"] = Telemetry.uniqueId;
headers["user-agent"] = this._getUserAgent();
return headers;
}
private _getUserAgent(): string {
const ideInfo = Telemetry.ideInfo;
const extensionVersion = ideInfo?.extensionVersion ?? "unknown";
const ideName = ideInfo?.name ?? "unknown";
const ideType = ideInfo?.ideType ?? "unknown";
return `Continue/${extensionVersion} (${ideName}; ${ideType})`;
}
supportsCompletions(): boolean {
// This was a hotfix and contains duplicate logic from class-specific completion support methods
if (this.underlyingProviderName === "vllm") {
@ -129,6 +138,7 @@ class ContinueProxy extends OpenAI {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${this.apiKey}`,
"user-agent": this._getUserAgent(),
},
body: JSON.stringify({
query,

View file

@ -29,6 +29,7 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
].some((part) => model.toLowerCase().startsWith(part));
},
anthropic: (model) => {
const lower = model.toLowerCase();
if (
[
"claude-3-5",
@ -38,10 +39,13 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
"claude-sonnet-4",
"claude-4-sonnet",
"claude-opus-4",
].some((part) => model.toLowerCase().startsWith(part))
].some((part) => lower.startsWith(part))
) {
return true;
}
if (lower.includes("claude") && lower.includes("4-5")) {
return true;
}
return false;
},
@ -112,7 +116,9 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
},
xAI: (model) => {
const lowerCaseModel = model.toLowerCase();
return ["grok-3", "grok-4"].some((val) => lowerCaseModel.includes(val));
return ["grok-3", "grok-4", "grok-code"].some((val) =>
lowerCaseModel.includes(val),
);
},
bedrock: (model) => {
if (
@ -189,6 +195,8 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
"llama3-groq",
"granite3",
"granite-3",
"granite4",
"granite-4",
"aya-expanse",
"firefunction-v2",
"mistral",
@ -383,6 +391,8 @@ export function isRecommendedAgentModel(modelName: string): boolean {
[/gpt-5/],
[/claude/, /sonnet/, /3\.7|3-7|-4/],
[/claude/, /opus/, /-4/],
[/grok-code/],
[/claude/, /4-5/],
];
for (const combo of recs) {
if (combo.every((regex) => modelName.toLowerCase().match(regex))) {

View file

@ -225,7 +225,7 @@
"@aws-sdk/credential-providers": "^3.840.0",
"@continuedev/config-types": "^1.0.14",
"@continuedev/config-yaml": "^1.14.0",
"@continuedev/fetch": "^1.1.0",
"@continuedev/fetch": "^1.5.0",
"dotenv": "^16.5.0",
"google-auth-library": "^10.1.0",
"json-schema": "^0.4.0",

View file

@ -24,7 +24,9 @@ export async function getPromptFilesFromDir(
const uris = await walkDir(dir, ide, {
source: "get dir prompt files",
});
const promptFilePaths = uris.filter((p) => p.endsWith(".prompt"));
const promptFilePaths = uris.filter(
(p) => p.endsWith(".prompt") || p.endsWith(".md"),
);
const results = promptFilePaths.map(async (uri) => {
const content = await ide.readFile(uri); // make a try catch
return { path: uri, content };
@ -68,10 +70,11 @@ export async function getAllPromptFiles(
);
promptFiles.push(...promptFilesFromRulesDirectory);
return await Promise.all(
const result = await Promise.all(
promptFiles.map(async (file) => {
const content = await ide.readFile(file.path);
return { path: file.path, content };
}),
);
return result;
}

View file

@ -241,6 +241,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
AsyncGenerator<ChatMessage, PromptLog>,
];
streamDiffLines: [StreamDiffLinesPayload, AsyncGenerator<DiffLine>];
getDiffLines: [{ oldContent: string; newContent: string }, DiffLine[]];
"llm/compileChat": [
{ messages: ChatMessage[]; options: LLMFullCompletionOptions },
CompiledMessagesResult,

View file

@ -30,7 +30,7 @@ describe("ChatDescriber", () => {
expect(result).toBeUndefined();
});
it("should set completionOptions.maxTokens to 12", async () => {
it("should set completionOptions.maxTokens to 16", async () => {
const message = "Test message";
const completionOptions: LLMFullCompletionOptions = { temperature: 0.7 };

View file

@ -8,7 +8,7 @@ import { renderChatMessage } from "./messageContent";
import { convertFromUnifiedHistory } from "./messageConversion";
export class ChatDescriber {
static maxTokens = 12;
static maxTokens = 16; // Increased from 12 to meet GPT-5 minimum requirement
static prompt: string | undefined =
"Given the following... please reply with a title for the chat that is 3-4 words in length, all words used should be directly related to the content of the chat, avoid using verbs unless they are directly related to the content of the chat, no additional text or explanation, you don't need ending punctuation.\n\n";
static messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>;

View file

@ -77,6 +77,21 @@ cn -p "Update documentation based on recent code changes"
- **CI/CD and pipeline integration**
- **Git hooks and automated workflows**
<Info>
**Tool Permissions in TUI vs Headless Mode**
Continue CLI tools have three permission levels:
- **allow**: Executes automatically without confirmation
- **ask**: Prompts for user confirmation before execution (e.g., `writeFile`, `runTerminalCommand`)
- **exclude**: Tool is not available to the AI
**In headless mode**, tools with "ask" permission are automatically excluded to prevent the AI from seeing tools it cannot call. This ensures reliable automation without user intervention.
**In TUI mode**, tools with "ask" permission are available and will prompt for confirmation when the AI attempts to use them.
💡 **Tip**: If your workflow requires tools that need confirmation (like file writes or terminal commands), use TUI mode. For fully automated workflows with read-only operations, use headless mode.
</Info>
### Development Workflow: TUI → Headless
<Tip>

View file

@ -121,6 +121,16 @@ cn -p "Update version numbers and create release branch"
✅ **Git hooks** for automated checks
✅ **Scheduled tasks** that run unattended
<Info>
**Tool Permission Differences Between Modes**
Tools requiring user confirmation ("ask" permission) like `writeFile` and `runTerminalCommand` are:
- **Available in TUI mode** - AI can use them with your approval
- **Excluded in headless mode** - AI cannot see or call them
This prevents the AI from attempting operations that require user interaction when running in automated environments. Choose TUI mode if your workflow needs tools that modify files or run commands.
</Info>
### Available Slash Commands
Common slash commands available in CLI:

View file

@ -88,6 +88,10 @@ Read more about [model roles](/customize/model-roles), [model capabilities](/cus
### Local Models
<Info>
Need a quick setup walkthrough? Check out [Using Ollama with Continue: A Developer's Guide](https://docs.continue.dev/guides/ollama-guide).
</Info>
These models can be run on your computer if you have enough VRAM.
Their limited tool calling and reasoning capabilities will make it challenging to use agent mode.

View file

@ -29,7 +29,7 @@
"hub/introduction",
{
"group": "Configs",
"icon": "robot",
"icon": "book",
"pages": [
"hub/configs/intro",
"hub/configs/use-a-config",
@ -260,6 +260,7 @@
"guides/posthog-github-continuous-ai",
"guides/continue-docs-mcp-cookbook",
"guides/github-mcp-continue-cookbook",
"guides/atlassian-mcp-continue-cookbook",
"guides/sanity-mcp-continue-cookbook",
"guides/sentry-mcp-error-monitoring",
"guides/snyk-mcp-continue-cookbook",
@ -342,7 +343,8 @@
"x": "https://twitter.com/continuedev",
"github": "https://github.com/continuedev/continue",
"linkedin": "https://linkedin.com/company/continuedev",
"discord": "https://discord.gg/vapESyrFmJ"
"discord": "https://discord.gg/vapESyrFmJ",
"youtube": "https://www.youtube.com/@continuedev"
}
},
"contextual": {

View file

@ -0,0 +1,511 @@
---
title: "Jira Issues and Confluence Pages with Atlassian MCP and Continue"
description: "Use Continue and the Atlassian Rovo MCP to search, summarize, and manage Jira issues, Confluence pages, and Compass components with natural language prompts."
sidebarTitle: "Atlassian Workflows with Continue"
---
<Card title="What You'll Build" icon="atlassian">
An Atlassian workflow assistant that uses Continue with the Atlassian Rovo MCP to:
- Search and summarize Jira issues across projects
- Find and digest Confluence documentation
- Create and update Jira issues with natural language
- Query Compass components and service dependencies
- Automate Atlassian workflows with headless CLI runs
</Card>
## Prerequisites
Before starting, ensure you have:
- Continue account with **Hub access**
- Read: [Understanding Configs — How to get started with Hub configs](/guides/understanding-configs#how-to-get-started-with-hub-configs)
- Node.js 18+ installed locally
- An Atlassian Cloud site with Jira, Confluence, and/or Compass
- Access to the Atlassian products you want to integrate with
<Note>
The Atlassian Rovo MCP Server is currently in **Beta**. Core functionality is available, but some features are still under development.
</Note>
For all options, first:
<Steps>
<Step title="Install Continue CLI">
```bash
npm i -g @continuedev/cli
```
</Step>
<Step title="Understand OAuth Flow">
The Atlassian MCP uses **OAuth 2.1** for authentication. The first time you connect, you'll complete a browser-based authorization flow that respects your existing Atlassian permissions.
</Step>
</Steps>
<Warning>
To use agents in headless mode, you need a [Continue API key](https://hub.continue.dev/settings/api-keys).
All data access respects your existing Jira, Confluence, and Compass user permissions.
</Warning>
## Choose Your Atlassian Agent
<Card title="🚀 Two Specialized Agents" icon="rocket">
We've created two ready-to-use agents to help you get started fast - they come pre-configured with optimized prompts, rules, and the Atlassian MCP. You don't have to use these agents, but they're designed to give you the best experience right away. Choose the agent that matches your needs, or create your own custom agent.
</Card>
### Agent Quick Reference
| Agent | Best For | Use Cases | Link |
|-------|----------|-----------|------|
| **Jira Agent** | Issue Management | Search issues, create stories, sprint planning, status updates, bulk operations | [View Agent](https://hub.continue.dev/continuedev/atlassian-continuous-ai-jira-agent) |
| **Confluence Agent** | Documentation | Search pages, summarize docs, create/update pages, manage spaces | [View Agent](https://hub.continue.dev/continuedev/atlassian-continuous-ai-confluence-agent) |
<Note>
**Cross-product workflows**: Both agents can work with Jira, Confluence, and Compass. Choose based on your primary focus area, or create your own agent using the [Atlassian MCP](https://hub.continue.dev/atlassian/atlassian-mcp). The Atlassian MCP can work with Jira, Compass, or Confluence.
</Note>
<Tabs>
<Tab title="📋 Jira Agent (Recommended for Issue Management)">
<Steps>
<Step title="Use the Jira Agent">
Visit the [Atlassian Continuous AI - Jira Agent](https://hub.continue.dev/continuedev/atlassian-continuous-ai-jira-agent) on Continue Hub. This agent is optimized for:
- Searching and filtering Jira issues
- Creating and updating issues
- Sprint planning and workload analysis
- Issue transitions and status updates
No installation needed - you can start using it immediately from the command line!
</Step>
<Step title="Complete OAuth Authorization">
On first use, you'll be prompted to authorize the MCP server in your browser. This is a one-time setup that grants access based on your Atlassian permissions.
</Step>
<Step title="Run Your First Command">
From anywhere in your terminal:
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Show me my open issues assigned to me"
```
The agent will connect to your Atlassian site and return results.
</Step>
</Steps>
<Info>
**Pro tip**: Create a shell alias for the Jira agent:
```bash
alias jira-ai='cn --agent continuedev/atlassian-continuous-ai-jira-agent'
```
Then use: `jira-ai "your prompt"`
</Info>
</Tab>
<Tab title="📄 Confluence Agent (Recommended for Documentation)">
<Steps>
<Step title="Use the Confluence Agent">
Visit the [Atlassian Continuous AI - Confluence Agent](https://hub.continue.dev/continuedev/atlassian-continuous-ai-confluence-agent) on Continue Hub. This agent is optimized for:
- Searching and summarizing documentation
- Creating and updating Confluence pages
- Managing spaces and content
- Documentation discovery
No installation needed - you can start using it immediately from the command line!
</Step>
<Step title="Complete OAuth Authorization">
On first use, you'll be prompted to authorize the MCP server in your browser. This is a one-time setup that grants access based on your Atlassian permissions.
</Step>
<Step title="Run Your First Command">
From anywhere in your terminal:
```bash
cn --agent continuedev/atlassian-continuous-ai-confluence-agent "Summarize the Q2 planning page"
```
The agent will connect to your Atlassian site and return results.
</Step>
</Steps>
<Info>
**Pro tip**: Create a shell alias for the Confluence agent:
```bash
alias confluence-ai='cn --agent continuedev/atlassian-continuous-ai-confluence-agent'
```
Then use: `confluence-ai "your prompt"`
</Info>
</Tab>
<Tab title="🛠️ Manual Setup">
<Steps>
<Step title="Create a New Agent on 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="Add Atlassian MCP">
Install from Hub (recommended) or add YAML manually. Minimal YAML example:
```yaml title="config.yaml"
mcpServers:
- name: Atlassian Rovo MCP
type: sse
url: https://mcp.atlassian.com/v1/sse
connectionTimeout: 30
```
Notes:
- The Atlassian MCP uses **Server-Sent Events (SSE)** transport type
- OAuth is handled automatically on first connection
- No API keys or tokens needed in the config
</Step>
<Step title="Test the Connection">
Launch Continue and ask:
```
List my Jira projects
```
You'll be prompted to authorize in your browser if this is your first time.
</Step>
</Steps>
</Tab>
</Tabs>
<Accordion title="Agent Requirements">
To use Atlassian MCP with Continue CLI, 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 Atlassian MCP for Jira, Confluence, and Compass operations.
</Accordion>
---
## Jira Workflows
<Note>
**Using the Jira Agent**: All examples below use the [Jira Agent](https://hub.continue.dev/continuedev/atlassian-continuous-ai-jira-agent) which is optimized for issue management.
</Note>
Use natural language to explore, triage, and manage Jira issues. The agent calls Atlassian MCP tools under the hood.
<Info>
**Running in headless mode**: Add `-p` flag before your prompt and `--auto` flag at the end:
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent -p "your prompt" --auto
```
**Important**: Complete browser OAuth authentication first before using headless mode.
</Info>
### Search and Discovery
<AccordionGroup>
<Accordion title="Find Open Bugs" icon="bug">
Search for bugs across your projects.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Find all open bugs in Project Alpha"
```
</Accordion>
<Accordion title="My Assigned Issues" icon="user">
Get a list of issues assigned to you.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Show me all issues assigned to me that are in progress"
```
</Accordion>
<Accordion title="Sprint Planning" icon="calendar">
Analyze sprint workload and priorities.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "List all issues in the current sprint. Group by assignee and priority. Summarize the workload distribution and flag any overloaded team members."
```
</Accordion>
</AccordionGroup>
### Create and Update
<AccordionGroup>
<Accordion title="Create Story from Description" icon="plus">
Turn natural language into a Jira story.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Create a story titled 'Redesign onboarding flow' in Project Alpha. Description: We need to simplify the user registration process by reducing steps from 5 to 3. Target completion: Q3."
```
</Accordion>
<Accordion title="Bulk Issue Creation" icon="list">
Create multiple issues from meeting notes or specs.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Create five Jira issues from these meeting notes: 1) Fix login timeout bug 2) Update API documentation 3) Implement dark mode toggle 4) Review security audit findings 5) Optimize database queries"
```
</Accordion>
<Accordion title="Update Issue Status" icon="arrows-rotate">
Transition issues with natural language.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Move PROJ-123 to In Progress and add a comment: Starting work on this today. ETA: end of week."
```
</Accordion>
</AccordionGroup>
---
## Confluence Workflows
<Note>
**Using the Confluence Agent**: All examples below use the [Confluence Agent](https://hub.continue.dev/continuedev/atlassian-continuous-ai-confluence-agent) which is optimized for documentation management.
</Note>
Access, search, and manage your team's documentation directly from Continue.
<Info>
**Running in headless mode**: Add `-p` flag before your prompt and `--auto` flag at the end:
```bash
cn --agent continuedev/atlassian-continuous-ai-confluence-agent -p "your prompt" --auto
```
**Important**: Complete browser OAuth authentication first before using headless mode.
</Info>
### Search and Summarize
<AccordionGroup>
<Accordion title="Summarize Documentation" icon="book">
Get a quick summary of a Confluence page.
```bash
cn --agent continuedev/atlassian-continuous-ai-confluence-agent "Summarize the Q2 planning page from the Engineering space"
```
</Accordion>
<Accordion title="Find Documentation" icon="magnifying-glass">
Search for specific information across Confluence.
```bash
cn --agent continuedev/atlassian-continuous-ai-confluence-agent "Find all pages about API authentication in our developer docs"
```
</Accordion>
<Accordion title="List Available Spaces" icon="folder">
Discover what Confluence spaces you have access to.
```bash
cn --agent continuedev/atlassian-continuous-ai-confluence-agent "What Confluence spaces do I have access to?"
```
</Accordion>
</AccordionGroup>
### Create and Update
<AccordionGroup>
<Accordion title="Create Documentation Page" icon="file-plus">
Generate a new Confluence page with structured content.
```bash
cn --agent continuedev/atlassian-continuous-ai-confluence-agent "Create a page titled 'Team Goals Q3' in the Engineering space. Include sections for: Objectives, Key Results, and Timeline."
```
</Accordion>
<Accordion title="Update Existing Page" icon="pen-to-square">
Modify content on an existing page.
```bash
cn --agent continuedev/atlassian-continuous-ai-confluence-agent "Update the 'Onboarding Guide' page to add a new section about our code review process"
```
</Accordion>
</AccordionGroup>
---
## Compass Workflows
<Note>
**Using Either Agent**: Compass workflows work with both agents. Use the Jira agent for component-to-issue workflows, or the Confluence agent for component-to-docs workflows.
</Note>
Query and manage your service architecture with Compass integration.
<Info>
**Running in headless mode**: Add `-p` flag before your prompt and `--auto` flag at the end. Complete browser OAuth authentication first before using headless mode.
</Info>
### Service Discovery
<AccordionGroup>
<Accordion title="Query Dependencies" icon="diagram-project">
Understand service relationships.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "What services depend on the api-gateway component?"
```
</Accordion>
<Accordion title="Create Service Component" icon="server">
Register a new service in Compass.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Create a service component for the current repository. Use the package.json to infer details."
```
</Accordion>
<Accordion title="Bulk Import Components" icon="upload">
Import multiple components from structured data.
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Import Compass components and custom fields from this CSV: [paste CSV data]"
```
Or reference a file:
```bash
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Import Compass components from services.csv in the current directory"
```
</Accordion>
</AccordionGroup>
---
## Combined Workflows
<Note>
**Cross-Product Workflows**: These workflows span multiple Atlassian products. Choose the agent based on your primary focus:
- Use **Jira Agent** when the workflow is issue-centric
- Use **Confluence Agent** when the workflow is documentation-centric
</Note>
Integrate actions across Jira, Confluence, and Compass for powerful cross-product workflows.
<Info>
**Running in headless mode**: Add `-p` flag before your prompt and `--auto` flag at the end. Complete browser OAuth authentication first before using headless mode.
</Info>
<AccordionGroup>
<Accordion title="Link Jira to Confluence" icon="link">
Connect related content across products.
```bash
# Using Jira Agent for issue-centric workflow
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Link Jira tickets PROJ-123, PROJ-456, and PROJ-789 to the 'Sprint 23 Release Plan' Confluence page"
```
</Accordion>
<Accordion title="Service Documentation Lookup" icon="search">
Find documentation for a specific component.
```bash
# Using Confluence Agent for docs-centric workflow
cn --agent continuedev/atlassian-continuous-ai-confluence-agent "Fetch the Confluence documentation page linked to the user-authentication Compass component"
```
</Accordion>
<Accordion title="Release Notes Generation" icon="file-lines">
Create release documentation from completed work.
```bash
# Using Jira Agent to pull issue data and create in Confluence
cn --agent continuedev/atlassian-continuous-ai-jira-agent "Generate release notes for all Jira issues completed in Sprint 23. Create a Confluence page in the Release Notes space with: New features (grouped by epic), Bug fixes, Known issues, Deployment instructions"
```
</Accordion>
</AccordionGroup>
---
## Troubleshooting
<AccordionGroup>
<Accordion title="OAuth Authorization Issues">
- **"Your site admin must authorize this app"**: A site admin needs to complete the OAuth flow first before other users can connect
- **Can't complete browser authorization**: Ensure you're logged into the correct Atlassian Cloud site and have necessary permissions
- **Connection timeout**: Increase `connectionTimeout` in your MCP config or check your network connection
</Accordion>
<Accordion title="Permission Errors">
- **"Access denied" or "Forbidden"**: The MCP respects your existing Atlassian permissions. Verify you have access to the project/space/component you're trying to access
- **Can't create issues**: Ensure you have "Create issues" permission in the target Jira project
- **Can't edit Confluence pages**: Verify you have edit permissions in the target Confluence space
</Accordion>
<Accordion title="Rate Limiting">
- **Standard plan**: Moderate usage thresholds
- **Premium/Enterprise plans**: Higher quotas (1,000 requests/hour plus per-user limits)
- If you hit rate limits, reduce query frequency or batch operations
</Accordion>
<Accordion title="Beta Limitations">
- Bulk operations may be constrained by rate limits
- Custom Jira fields may not be recognized without explicit setup
- Workspace/site switching not available within a single session
- Check [Atlassian Community](https://community.atlassian.com/) for known issues
</Accordion>
</AccordionGroup>
### Admin Considerations
<Card title="For Atlassian Site Admins" icon="shield">
**Installation**: The Atlassian Rovo MCP is automatically installed on first OAuth authorization (JIT installation) - no Marketplace installation needed.
**Managing Access**:
- View connected apps in [Admin Hub](https://admin.atlassian.com)
- Users can revoke access from their [profile settings](https://id.atlassian.com/manage-profile/apps)
- Block user-installed apps via "user-installed apps" control in Admin Hub
**Security**: All traffic is encrypted via HTTPS (TLS 1.2+), and access respects existing user permissions.
</Card>
---
## What You've Built
After completing this guide, you have a complete **AI-powered Atlassian workflow system** that:
- ✅ Uses natural language — Simple prompts for complex Atlassian operations
- ✅ Spans multiple products — Seamlessly works across Jira, Confluence, and Compass
- ✅ Respects permissions — Secure OAuth-based access with existing role enforcement
- ✅ Runs headlessly — Integrate into CI/CD pipelines and automation scripts
<Card title="Continuous AI" icon="rocket">
Your Atlassian workflows now operate at **[Level 2 Continuous
AI](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)** -
AI handles routine project management tasks with human oversight through
review and approval.
</Card>
## Next Steps
1. **Explore your projects** - Try the Jira search and triage prompts
2. **Organize documentation** - Use Confluence workflows to summarize and create pages
3. **Map your services** - Query Compass for service dependencies
4. **Customize prompts** - Tailor workflows to your team's specific needs
5. **Monitor usage** - Track how AI improves your Atlassian workflows
## Additional Resources
<CardGroup cols={2}>
<Card title="Atlassian Rovo MCP" icon="link" href="https://support.atlassian.com/atlassian-rovo-mcp-server/docs/getting-started-with-the-atlassian-remote-mcp-server/">
Official Atlassian MCP documentation
</Card>
<Card title="MCP in Continue" icon="book" href="/customize/deep-dives/mcp">
How MCP works with Continue agents
</Card>
<Card title="Continue Hub" icon="globe" href="https://hub.continue.dev">
Create and manage your agents
</Card>
<Card title="Atlassian Community" icon="users" href="https://community.atlassian.com/">
Get help and share feedback
</Card>
</CardGroup>
## Example Use Cases
<CardGroup cols={2}>
<Card title="Release Management" icon="rocket">
Automate release notes generation, link issues to documentation, and track deployment status across Jira and Confluence.
</Card>
<Card title="Sprint Planning" icon="calendar-days">
Analyze workload distribution, identify blockers, and generate sprint summaries automatically.
</Card>
<Card title="Service Ownership" icon="sitemap">
Map service dependencies in Compass, link to technical documentation in Confluence, and track related issues in Jira.
</Card>
<Card title="Onboarding Automation" icon="user-plus">
Create standardized Jira onboarding tickets, link to Confluence guides, and track new hire progress.
</Card>
</CardGroup>

View file

@ -21,16 +21,51 @@ description: "Comprehensive collection of practical guides for Continue includin
Step-by-step guides for integrating Model Context Protocol (MCP) servers with Continue:
- [Continue Docs MCP Cookbook](/guides/continue-docs-mcp-cookbook) - Use the Continue Docs MCP to write cookbooks, guides, and documentation with AI-powered workflows
- [GitHub MCP Cookbook](/guides/github-mcp-continue-cookbook) - Use GitHub MCP to list, filter, and summarize open issues and merged PRs, and post AI-generated comments
- [PostHog Session Analysis Cookbook](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation
- [Netlify Performance Optimization Cookbook](/guides/netlify-mcp-continuous-deployment) - Optimize web performance with A/B testing and automated monitoring using Netlify MCP
- [Chrome DevTools Performance Cookbook](/guides/chrome-devtools-mcp-performance) - Measure and optimize web performance with automated traces, Core Web Vitals monitoring, and performance budgets
- [Sanity CMS Integration Cookbook](/guides/sanity-mcp-continue-cookbook) - Manage headless CMS content with AI-powered workflows using Sanity MCP
- [Sentry Error Monitoring Cookbook](/guides/sentry-mcp-error-monitoring) - Automated error analysis with Sentry MCP to identify patterns and create actionable GitHub issues
- [Snyk + Continue Hub Agent Cookbook (MCP)](/guides/snyk-mcp-continue-cookbook) - Integrate Snyk MCP via Continue Hub to scan code, deps, IaC, and containers
- [Supabase Database Workflow Cookbook](/guides/supabase-mcp-database-workflow) - Audit Row Level Security in your Supabase database, identify vulnerabilities, and automatically generate fixes using Supabase MCP
- [dlt Data Pipelines Cookbook](/guides/dlt-mcp-continue-cookbook) - Build AI-powered data pipelines with dlt MCP for pipeline inspection, schema management, and debugging
<CardGroup cols={3}>
<Card title="Continue Docs MCP Cookbook" icon="book" href="/guides/continue-docs-mcp-cookbook">
Use the Continue Docs MCP to write cookbooks, guides, and documentation with AI-powered workflows
</Card>
<Card title="GitHub MCP Cookbook" icon="github" href="/guides/github-mcp-continue-cookbook">
Use GitHub MCP to list, filter, and summarize open issues and merged PRs, and post AI-generated comments
</Card>
<Card title="Atlassian MCP Cookbook" icon="atlassian" href="/guides/atlassian-mcp-continue-cookbook">
Use Atlassian Rovo MCP to search and manage Jira issues, Confluence pages, and Compass components with natural language
</Card>
<Card title="PostHog Session Analysis Cookbook" icon="chart-line" href="/guides/posthog-github-continuous-ai">
Analyze user behavior data to optimize your codebase with automatic issue creation
</Card>
<Card title="Netlify Performance Optimization Cookbook" icon="globe" href="/guides/netlify-mcp-continuous-deployment">
Optimize web performance with A/B testing and automated monitoring using Netlify MCP
</Card>
<Card title="Chrome DevTools Performance Cookbook" icon="gauge" href="/guides/chrome-devtools-mcp-performance">
Measure and optimize web performance with automated traces, Core Web Vitals monitoring, and performance budgets
</Card>
<Card title="Sanity CMS Integration Cookbook" icon="database" href="/guides/sanity-mcp-continue-cookbook">
Manage headless CMS content with AI-powered workflows using Sanity MCP
</Card>
<Card title="Sentry Error Monitoring Cookbook" icon="bug" href="/guides/sentry-mcp-error-monitoring">
Automated error analysis with Sentry MCP to identify patterns and create actionable GitHub issues
</Card>
<Card title="Snyk + Continue Hub Agent Cookbook (MCP)" icon="shield" href="/guides/snyk-mcp-continue-cookbook">
Integrate Snyk MCP via Continue Hub to scan code, deps, IaC, and containers
</Card>
<Card title="Supabase Database Workflow Cookbook" icon="database" href="/guides/supabase-mcp-database-workflow">
Audit Row Level Security in your Supabase database, identify vulnerabilities, and automatically generate fixes using Supabase MCP
</Card>
<Card title="dlt Data Pipelines Cookbook" icon="pipe" href="/guides/dlt-mcp-continue-cookbook">
Build AI-powered data pipelines with dlt MCP for pipeline inspection, schema management, and debugging
</Card>
</CardGroup>
## What Advanced Tutorials Are Available

View file

@ -10,6 +10,18 @@ sidebarTitle: "Snyk Security Scanning with Continue"
containers - all through simple natural language prompts
</Card>
## Demo Video
<iframe
width="100%"
height="400"
src="https://www.youtube.com/embed/cwVnKOf3tVg"
title="Snyk MCP Continue Cookbook Demo"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
## Prerequisites
Before starting, ensure you have:

View file

@ -3,6 +3,16 @@ title: "How to Understand Hub vs Local Configuration"
description: "Learn how to choose between cloud-managed Hub and local configuration for AI development assistance in Continue, including setup, management, and best practices for each approach"
---
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/ljym650IW3Y"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
Every developer has unique needs when it comes to AI assistance. Some prefer the convenience of cloud-managed configurations, while others need the control and privacy of local setups. Continue offers both paths, and this guide will help you choose the right one for your workflow.
## What Are the Two Paths to AI Assistance?

View file

@ -7,7 +7,7 @@ description: "Connect with the Continue community to discover, share, and collab
Join thousands of developers using Continue. Share experiences, get help, and contribute to the ecosystem.
[Join our Discord Community →](https://discord.gg/continue)
[Join our Discord Community →](https://discord.gg/vapESyrFmJ)
## Publishing

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

BIN
docs/images/cli-agent.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

View file

@ -1,7 +1,7 @@
---
title: "Welcome to Continue"
icon: book-open
description: "Practice Continuous AI with an open-source CLI, open-source IDE extensions, and a Hub for custom agents"
description: "Kick off agents from the terminal, IDE, or Mission Control"
---
<Frame>
@ -9,8 +9,7 @@ description: "Practice Continuous AI with an open-source CLI, open-source IDE ex
</Frame>
<Note>
**Build faster with AI across your IDE, terminal, and CI/CD pipelines with
Continue.**
**Launch background agents, iterate in terminal, and deploy workflows in CI/CD**
</Note>
## Continue CLI

View file

@ -13,4 +13,5 @@ config.yaml
.continue-debug/
*.expect
!demo.expect
!demo.expect
*.cast

View file

@ -44,6 +44,10 @@ cn ls --json
- `--resume`: Resume the last session for this terminal
- `<prompt>`: Optional prompt to start with
## Environment Variables
- `CONTINUE_CLI_DISABLE_COMMIT_SIGNATURE`: Disable adding the Continue commit signature to generated commit messages
## Commands
- `cn`: Start an interactive chat session

View file

@ -184,6 +184,7 @@
"system-ca": "^1.0.3",
"tar": "^7.4.3",
"tree-sitter-wasms": "^0.1.11",
"untildify": "^6.0.0",
"uuid": "^9.0.1",
"vectordb": "^0.4.20",
"web-tree-sitter": "^0.21.0",
@ -274,7 +275,7 @@
"@aws-sdk/credential-providers": "^3.840.0",
"@continuedev/config-types": "^1.0.14",
"@continuedev/config-yaml": "^1.14.0",
"@continuedev/fetch": "^1.1.0",
"@continuedev/fetch": "^1.5.0",
"dotenv": "^16.5.0",
"google-auth-library": "^10.1.0",
"json-schema": "^0.4.0",

View file

@ -15,6 +15,30 @@ import {
getOrganizationId,
} from "./auth/workos.js";
import { env } from "./env.js";
import { getVersion } from "./version.js";
/**
* Creates User-Agent header value for CLI requests
*/
function getUserAgent(): string {
const version = getVersion();
return `Continue-CLI/${version}`;
}
/**
* Merges User-Agent header into request options
*/
function mergeUserAgentIntoRequestOptions(
requestOptions: ModelConfig["requestOptions"],
): ModelConfig["requestOptions"] {
return {
...requestOptions,
headers: {
...requestOptions?.headers,
"User-Agent": getUserAgent(),
},
};
}
/**
* Creates an LLM API instance from a ModelConfig and auth configuration
@ -31,7 +55,9 @@ export function createLlmApi(
model.provider === "continue-proxy"
? {
provider: model.provider,
requestOptions: model.requestOptions,
requestOptions: mergeUserAgentIntoRequestOptions(
model.requestOptions,
),
apiBase: model.apiBase,
apiKey: accessToken ?? undefined,
env: {
@ -46,7 +72,9 @@ export function createLlmApi(
provider: model.provider as any,
apiKey: model.apiKey,
apiBase: model.apiBase,
requestOptions: model.requestOptions,
requestOptions: mergeUserAgentIntoRequestOptions(
model.requestOptions,
),
env: model.env,
};

View file

@ -50,6 +50,7 @@ export class MCPService
private connections: Map<string, ServerConnection> = new Map();
private assistant: AssistantConfig | null = null;
private isShuttingDown = false;
private isHeadless = false;
getDependencies(): string[] {
return [SERVICE_NAMES.CONFIG];
@ -77,6 +78,9 @@ export class MCPService
serverCount: assistant.mcpServers?.length || 0,
});
// Store headless mode flag
this.isHeadless = waitForConnections;
await this.shutdownConnections();
this.assistant = assistant;
@ -103,6 +107,19 @@ export class MCPService
);
if (waitForConnections) {
await connectionInit;
// In headless mode, throw error if any MCP server failed to connect
const failedConnections = Array.from(this.connections.values()).filter(
(c) => c.status === "error",
);
if (failedConnections.length > 0) {
const errorMessages = failedConnections.map(
(c) => `${c.config?.name}: ${c.error}`,
);
throw new Error(
`MCP server(s) failed to load in headless mode:\n${errorMessages.join("\n")}`,
);
}
} else {
this.updateState();
}
@ -259,6 +276,13 @@ export class MCPService
name: serverName,
error: errorMessage,
});
// In headless mode, throw error on capability failures
if (this.isHeadless) {
throw new Error(
`Failed to load prompts from MCP server ${serverName}: ${errorMessage}`,
);
}
}
}
@ -276,18 +300,30 @@ export class MCPService
name: serverName,
error: errorMessage,
});
// In headless mode, throw error on capability failures
if (this.isHeadless) {
throw new Error(
`Failed to load tools from MCP server ${serverName}: ${errorMessage}`,
);
}
}
}
logger.debug("MCP server restarted successfully", { name: serverName });
logger.debug("MCP server connected successfully", { name: serverName });
} catch (error) {
const errorMessage = getErrorString(error);
connection.status = "error";
connection.error = errorMessage;
logger.error("Failed to restart MCP server", {
logger.error("Failed to connect to MCP server", {
name: serverName,
error: errorMessage,
});
// In headless mode, re-throw the error to fail fast
if (this.isHeadless) {
throw error;
}
}
this.updateState();

View file

@ -0,0 +1,675 @@
import { ALL_BUILT_IN_TOOLS } from "src/tools/allBuiltIns.js";
import { ToolPermissionService } from "./ToolPermissionService.js";
import { AgentFileServiceState, MCPServiceState } from "./types.js";
describe("ToolPermissionService - Agent File Integration", () => {
let service: ToolPermissionService;
beforeEach(() => {
service = new ToolPermissionService();
});
describe("generateAgentFilePolicies - No parsed tools", () => {
it("should allow all tools when agent file is present but parsedTools is null", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: null, // No parsed tools
parsedRules: null,
};
const policies = service.generateAgentFilePolicies(agentFileState);
expect(policies).toEqual([
{
tool: "*",
permission: "allow",
},
]);
});
it("should allow all tools when agent file is present but parsedTools is undefined", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: undefined as any,
parsedRules: null,
};
const policies = service.generateAgentFilePolicies(agentFileState);
expect(policies).toEqual([
{
tool: "*",
permission: "allow",
},
]);
});
it("should allow all tools when agentFileServiceState is undefined", () => {
const policies = service.generateAgentFilePolicies(undefined);
expect(policies).toEqual([
{
tool: "*",
permission: "allow",
},
]);
});
});
describe("generateAgentFilePolicies - With MCP servers", () => {
it("should allow specific MCP tools when explicitly listed", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/mcp-server"],
tools: [{ mcpServer: "owner/mcp-server", toolName: "specific_tool" }],
allBuiltIn: false,
},
parsedRules: null,
};
const mcpState: MCPServiceState = {
mcpService: null,
connections: [
{
config: { sourceSlug: "owner/mcp-server" } as any,
status: "connected",
tools: [
{ name: "specific_tool" } as any,
{ name: "other_tool" } as any,
{ name: "another_tool" } as any,
],
prompts: [],
warnings: [],
},
],
tools: [],
prompts: [],
};
const policies = service.generateAgentFilePolicies(
agentFileState,
mcpState,
);
// Should allow the specific tool
expect(policies).toContainEqual({
tool: "specific_tool",
permission: "allow",
});
// Should exclude the other tools from the same server
expect(policies).toContainEqual({
tool: "other_tool",
permission: "exclude",
});
expect(policies).toContainEqual({
tool: "another_tool",
permission: "exclude",
});
// Should have wildcard allow at the end
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
it("should allow all tools from MCP server when server is listed without specific tools", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/mcp-server"],
tools: [
{ mcpServer: "owner/mcp-server" }, // No toolName = all tools from this server
],
allBuiltIn: false,
},
parsedRules: null,
};
const mcpState: MCPServiceState = {
mcpService: null,
connections: [
{
config: { sourceSlug: "owner/mcp-server" } as any,
status: "connected",
tools: [
{ name: "tool1" } as any,
{ name: "tool2" } as any,
{ name: "tool3" } as any,
],
prompts: [],
warnings: [],
},
],
tools: [],
prompts: [],
};
const policies = service.generateAgentFilePolicies(
agentFileState,
mcpState,
);
// Since no specific tools were mentioned, MCP logic doesn't explicitly allow/exclude
// The wildcard allow at the end covers all MCP tools
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
it("should handle multiple MCP servers with mixed specific and blanket access", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/server1", "owner/server2"],
tools: [
{ mcpServer: "owner/server1", toolName: "specific_tool" },
{ mcpServer: "owner/server2" }, // All tools from server2
],
allBuiltIn: false,
},
parsedRules: null,
};
const mcpState: MCPServiceState = {
mcpService: null,
connections: [
{
config: { sourceSlug: "owner/server1" } as any,
status: "connected",
tools: [
{ name: "specific_tool" } as any,
{ name: "other_tool" } as any,
],
prompts: [],
warnings: [],
},
{
config: { sourceSlug: "owner/server2" } as any,
status: "connected",
tools: [{ name: "tool_a" } as any, { name: "tool_b" } as any],
prompts: [],
warnings: [],
},
],
tools: [],
prompts: [],
};
const policies = service.generateAgentFilePolicies(
agentFileState,
mcpState,
);
// Server1: Should allow specific_tool and exclude other_tool
expect(policies).toContainEqual({
tool: "specific_tool",
permission: "allow",
});
expect(policies).toContainEqual({
tool: "other_tool",
permission: "exclude",
});
// Server2: No specific tools, so wildcard covers them
// Should have wildcard allow at the end
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
it("should handle MCP server not found in connections", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/missing-server"],
tools: [
{ mcpServer: "owner/missing-server", toolName: "specific_tool" },
],
allBuiltIn: false,
},
parsedRules: null,
};
const mcpState: MCPServiceState = {
mcpService: null,
connections: [], // No connections
tools: [],
prompts: [],
};
const policies = service.generateAgentFilePolicies(
agentFileState,
mcpState,
);
// Should still have wildcard allow at the end
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
});
describe("generateAgentFilePolicies - With built-in tools", () => {
it("should allow only specific built-in tools when listed", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: [],
tools: [{ toolName: "Bash" }, { toolName: "Read" }],
allBuiltIn: false,
},
parsedRules: null,
};
const policies = service.generateAgentFilePolicies(agentFileState);
// Should allow the specific built-in tools
expect(policies).toContainEqual({
tool: "Bash",
permission: "allow",
});
expect(policies).toContainEqual({
tool: "Read",
permission: "allow",
});
// Should exclude all other built-in tools
const allBuiltInNames = ALL_BUILT_IN_TOOLS.map((t) => t.name);
const notListed = allBuiltInNames.filter(
(name) => name !== "Bash" && name !== "Read",
);
for (const toolName of notListed) {
expect(policies).toContainEqual({
tool: toolName,
permission: "exclude",
});
}
// Should have wildcard allow at the end
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
it("should allow all built-in tools when allBuiltIn is true", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: [],
tools: [],
allBuiltIn: true,
},
parsedRules: null,
};
const policies = service.generateAgentFilePolicies(agentFileState);
// Should NOT have any exclude policies for built-in tools
const excludePolicies = policies.filter(
(p) => p.permission === "exclude",
);
expect(excludePolicies).toEqual([]);
// Should have wildcard allow at the end
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
it("should exclude built-in tools when MCP servers are present but allBuiltIn is false", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/mcp-server"],
tools: [{ mcpServer: "owner/mcp-server" }],
allBuiltIn: false,
},
parsedRules: null,
};
const mcpState: MCPServiceState = {
mcpService: null,
connections: [
{
config: { sourceSlug: "owner/mcp-server" } as any,
status: "connected",
tools: [{ name: "mcp_tool" } as any],
prompts: [],
warnings: [],
},
],
tools: [],
prompts: [],
};
const policies = service.generateAgentFilePolicies(
agentFileState,
mcpState,
);
// Should exclude all built-in tools
const allBuiltInNames = ALL_BUILT_IN_TOOLS.map((t) => t.name);
for (const toolName of allBuiltInNames) {
expect(policies).toContainEqual({
tool: toolName,
permission: "exclude",
});
}
// Should have wildcard allow at the end
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
it("should allow both built-in tools and MCP tools when both are specified", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/mcp-server"],
tools: [
{ toolName: "Bash" },
{ toolName: "Read" },
{ mcpServer: "owner/mcp-server", toolName: "mcp_tool" },
],
allBuiltIn: false,
},
parsedRules: null,
};
const mcpState: MCPServiceState = {
mcpService: null,
connections: [
{
config: { sourceSlug: "owner/mcp-server" } as any,
status: "connected",
tools: [
{ name: "mcp_tool" } as any,
{ name: "other_mcp_tool" } as any,
],
prompts: [],
warnings: [],
},
],
tools: [],
prompts: [],
};
const policies = service.generateAgentFilePolicies(
agentFileState,
mcpState,
);
// Should allow the specific MCP tool
expect(policies).toContainEqual({
tool: "mcp_tool",
permission: "allow",
});
// Should exclude the other MCP tool
expect(policies).toContainEqual({
tool: "other_mcp_tool",
permission: "exclude",
});
// Should allow the specific built-in tools
expect(policies).toContainEqual({
tool: "Bash",
permission: "allow",
});
expect(policies).toContainEqual({
tool: "Read",
permission: "allow",
});
// Should exclude other built-in tools
const allBuiltInNames = ALL_BUILT_IN_TOOLS.map((t) => t.name);
const notListed = allBuiltInNames.filter(
(name) => name !== "Bash" && name !== "Read",
);
for (const toolName of notListed) {
expect(policies).toContainEqual({
tool: toolName,
permission: "exclude",
});
}
// Should have wildcard allow at the end
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
});
describe("initializeSync with agent file", () => {
it("should use agent file policies when agent file is present with no parsed tools", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: null, // No parsed tools
parsedRules: null,
};
const state = service.initializeSync(undefined, agentFileState);
// Should have wildcard allow policy
expect(state.permissions.policies).toEqual([
{
tool: "*",
permission: "allow",
},
]);
});
it("should use agent file policies when agent file is present with parsed tools", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: [],
tools: [{ toolName: "Bash" }],
allBuiltIn: false,
},
parsedRules: null,
};
const state = service.initializeSync(undefined, agentFileState);
// Should have specific policies for Bash and exclusions for others
expect(state.permissions.policies).toContainEqual({
tool: "Bash",
permission: "allow",
});
// Should exclude other built-in tools
const allBuiltInNames = ALL_BUILT_IN_TOOLS.map((t) => t.name);
const notBash = allBuiltInNames.filter((name) => name !== "Bash");
for (const toolName of notBash) {
expect(state.permissions.policies).toContainEqual({
tool: toolName,
permission: "exclude",
});
}
// Should have wildcard allow at the end
const lastPolicy =
state.permissions.policies[state.permissions.policies.length - 1];
expect(lastPolicy).toEqual({
tool: "*",
permission: "allow",
});
});
it("should use normal resolution when agent file is not present", () => {
const state = service.initializeSync(undefined, undefined);
// Should have normal policies (not just wildcard allow)
expect(state.permissions.policies.length).toBeGreaterThan(1);
// Should not be just wildcard allow
expect(state.permissions.policies).not.toEqual([
{
tool: "*",
permission: "allow",
},
]);
});
it("should prioritize agent file over runtime overrides", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: [],
tools: [{ toolName: "Read" }],
allBuiltIn: false,
},
parsedRules: null,
};
const runtimeOverrides = {
allow: ["Bash", "Write"],
exclude: ["Read"],
};
const state = service.initializeSync(
runtimeOverrides,
agentFileState,
undefined,
);
// Agent file should take precedence, so Read should be allowed (not excluded)
expect(state.permissions.policies).toContainEqual({
tool: "Read",
permission: "allow",
});
// Bash should be excluded (not in agent file)
expect(state.permissions.policies).toContainEqual({
tool: "Bash",
permission: "exclude",
});
});
});
describe("Edge cases and boundary conditions", () => {
it("should handle empty parsed tools arrays - allows everything", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: [],
tools: [],
allBuiltIn: false,
},
parsedRules: null,
};
const policies = service.generateAgentFilePolicies(agentFileState);
// With empty tools array and no MCP servers, the logic doesn't enter
// the exclusion path, so it just returns wildcard allow
// This is the "blank = all built-in tools" case from the comments
expect(policies).toEqual([
{
tool: "*",
permission: "allow",
},
]);
});
it("should handle MCP state with empty connections array", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/mcp-server"],
tools: [{ mcpServer: "owner/mcp-server", toolName: "specific_tool" }],
allBuiltIn: false,
},
parsedRules: null,
};
const mcpState: MCPServiceState = {
mcpService: null,
connections: [],
tools: [],
prompts: [],
};
const policies = service.generateAgentFilePolicies(
agentFileState,
mcpState,
);
// Should still generate policies and have wildcard allow
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
it("should handle MCP state being undefined", () => {
const agentFileState: AgentFileServiceState = {
agentFile: { name: "test-agent" } as any,
slug: "test-slug",
agentFileModel: null,
parsedTools: {
mcpServers: ["owner/mcp-server"],
tools: [{ mcpServer: "owner/mcp-server", toolName: "specific_tool" }],
allBuiltIn: false,
},
parsedRules: null,
};
const policies = service.generateAgentFilePolicies(
agentFileState,
undefined,
);
// Should still generate policies and have wildcard allow
expect(policies[policies.length - 1]).toEqual({
tool: "*",
permission: "allow",
});
});
});
});

View file

@ -30,7 +30,6 @@ describe("ToolPermissionService", () => {
currentMode: "normal",
isHeadless: false,
modePolicyCount: 0,
agentFilePolicyCount: 0,
});
});

View file

@ -30,7 +30,6 @@ export interface ToolPermissionServiceState {
currentMode: PermissionMode;
isHeadless: boolean;
modePolicyCount?: number; // Track how many policies are from mode vs other sources
agentFilePolicyCount?: number;
originalPolicies?: ToolPermissions; // Store original policies when switching modes
}
@ -74,10 +73,16 @@ export class ToolPermissionService
generateAgentFilePolicies(
agentFileServiceState?: AgentFileServiceState,
mcpServiceState?: MCPServiceState,
): undefined | ToolPermissionPolicy[] {
): ToolPermissionPolicy[] {
// With --agent, all available tools are allowed if not specified
const parsedTools = agentFileServiceState?.parsedTools;
if (!parsedTools?.tools.length) {
return undefined;
if (!parsedTools) {
return [
{
tool: "*",
permission: "allow",
},
];
}
const policies: ToolPermissionPolicy[] = [];
@ -222,23 +227,20 @@ export class ToolPermissionService
this.setState({ isHeadless: runtimeOverrides.isHeadless });
}
const agentFilePolicies = this.generateAgentFilePolicies(
agentFileServiceState,
mcpServiceState,
);
const modePolicies = this.generateModePolicies();
// For plan and auto modes, use ONLY mode policies (absolute override)
// For normal mode, combine with user configuration
let allPolicies: ToolPermissionPolicy[];
if (agentFilePolicies) {
if (agentFileServiceState?.agentFile) {
// Agent file policies take full precedence on init
allPolicies = agentFilePolicies;
allPolicies = this.generateAgentFilePolicies(
agentFileServiceState,
mcpServiceState,
);
} else if (
this.currentState.currentMode === "plan" ||
this.currentState.currentMode === "auto"
) {
// Absolute override: ignore all user configuration
// For plan and auto modes, use ONLY mode policies (absolute override)
allPolicies = modePolicies;
} else {
// Normal mode: combine mode policies with user configuration
@ -255,7 +257,6 @@ export class ToolPermissionService
currentMode: this.currentState.currentMode,
isHeadless: this.currentState.isHeadless,
modePolicyCount: modePolicies.length,
agentFilePolicyCount: (agentFilePolicies ?? []).length,
});
(this as any).isInitialized = true;

View file

@ -50,6 +50,15 @@ export class UpdateService extends BaseService<UpdateServiceState> {
});
try {
// skip checking for updates in dev
if (this.currentState.currentVersion === "0.0.0-dev") {
this.setState({
status: UpdateStatus.IDLE,
message: `Continue CLI`,
});
return; // Uncomment to test auto-update behavior in dev
}
// Check for updates
this.setState({
status: UpdateStatus.CHECKING,
@ -79,16 +88,6 @@ export class UpdateService extends BaseService<UpdateServiceState> {
isUpdateAvailable,
});
if (this.currentState.currentVersion === "0.0.0-dev") {
this.setState({
status: UpdateStatus.IDLE,
message: `Continue CLI`,
isUpdateAvailable,
latestVersion,
});
return; // Uncomment to test auto-update behavior in dev
}
// If update is available, automatically update
if (
autoUpdate &&

View file

@ -360,7 +360,7 @@ describe("SessionManager", () => {
const firstSession = createSession();
const firstSessionId = firstSession.sessionId;
vi.mocked(uuidv4).mockReturnValue("new-uuid-456" as any);
vi.mocked(uuidv4).mockReturnValue("new-uuid-456");
const secondSession = startNewSession();
@ -381,7 +381,7 @@ describe("SessionManager", () => {
},
];
vi.mocked(uuidv4).mockReturnValue("new-uuid-789" as any);
vi.mocked(uuidv4).mockReturnValue("new-uuid-789");
const session = startNewSession(history);
@ -392,7 +392,7 @@ describe("SessionManager", () => {
it("should set the new session as current", () => {
const originalSession = createSession();
vi.mocked(uuidv4).mockReturnValue("new-session-id" as any);
vi.mocked(uuidv4).mockReturnValue("new-session-id");
const newSession = startNewSession();
const currentSession = getCurrentSession();
@ -401,4 +401,100 @@ describe("SessionManager", () => {
expect(currentSession).not.toBe(originalSession);
});
});
describe("session isolation", () => {
it("should not pollute new sessions with previous session history", () => {
// Simulate first CLI session
vi.mocked(uuidv4).mockReturnValue("session-1");
const session1 = createSession();
const history1: ChatHistoryItem[] = [
{
message: {
role: "user",
content: "Tell me about dogs",
},
contextItems: [],
},
{
message: {
role: "assistant",
content: "Dogs are loyal companions...",
},
contextItems: [],
},
];
updateSessionHistory(history1);
// Simulate starting a new CLI session (without --resume)
vi.mocked(uuidv4).mockReturnValue("session-2");
const session2 = startNewSession([]);
// New session should have clean state
expect(session2.sessionId).toBe("session-2");
expect(session2.sessionId).not.toBe(session1.sessionId);
expect(session2.history).toEqual([]);
expect(session2.history.length).toBe(0);
});
it("should create independent sessions for concurrent operations", () => {
// Create first session with some data
vi.mocked(uuidv4).mockReturnValue("concurrent-1");
const session1 = createSession();
updateSessionTitle("Session 1");
updateSessionHistory([
{
message: {
role: "user",
content: "First session message",
},
contextItems: [],
},
]);
// Start a new session
vi.mocked(uuidv4).mockReturnValue("concurrent-2");
const session2 = startNewSession([]);
// Verify session2 is clean
expect(session2.title).toBe("Untitled Session");
expect(session2.history).toEqual([]);
expect(session2.sessionId).not.toBe(session1.sessionId);
});
it("should properly clear session state when transitioning between sessions", () => {
// First session with complex history
vi.mocked(uuidv4).mockReturnValue("complex-session-1");
const session1 = createSession();
updateSessionTitle("Complex Session");
const complexHistory: ChatHistoryItem[] = [
{
message: {
role: "user",
content: "What were we discussing?",
},
contextItems: [],
},
{
message: {
role: "assistant",
content: "We were discussing dogs earlier.",
},
contextItems: [],
},
];
updateSessionHistory(complexHistory);
// Verify first session has data
expect(getCurrentSession().history.length).toBe(2);
// Start fresh session
vi.mocked(uuidv4).mockReturnValue("fresh-session-2");
const session2 = startNewSession([]);
// Verify clean state
expect(session2.history.length).toBe(0);
expect(session2.title).toBe("Untitled Session");
expect(getCurrentSession().sessionId).toBe("fresh-session-2");
});
});
});

View file

@ -337,11 +337,7 @@ export async function getRemoteSessions(): Promise<ExtendedSessionMetadata[]> {
const authConfig = loadAuthConfig();
const accessToken = getAccessToken(authConfig);
if (
!accessToken ||
!isAuthenticatedConfig(authConfig) ||
!authConfig.userEmail.endsWith("@continue.dev")
) {
if (!accessToken || !isAuthenticatedConfig(authConfig)) {
return [];
}

View file

@ -9,7 +9,11 @@ import * as versionModule from "./version.js";
// Mock all dependencies
vi.mock("./auth/workos.js");
vi.mock("./version.js");
vi.mock("./version.js", () => ({
getVersion: vi.fn(() => "1.2.3"),
getLatestVersion: vi.fn(() => Promise.resolve(null)),
compareVersions: vi.fn(() => "same"),
}));
vi.mock("./session.js");
vi.mock("./telemetry/posthogService.js");

View file

@ -123,26 +123,18 @@ export async function handleToolCalls(
return true; // Signal early return needed
}
// Convert tool results and add them to the chat history with per-result status
// Convert tool results and add them to the chat history with status from execution
toolResults.forEach((toolResult) => {
const resultContent =
typeof toolResult.content === "string" ? toolResult.content : "";
// Derive per-result status instead of applying batch-wide hasRejection
let status: ToolStatus = "done";
const lower = resultContent.toLowerCase();
if (
lower.includes("permission denied by user") ||
lower.includes("cancelled due to previous tool rejection") ||
lower.includes("canceled due to previous tool rejection")
) {
status = "canceled";
} else if (
lower.startsWith("error executing tool") ||
lower.startsWith("error:")
) {
status = "errored" as ToolStatus;
}
// Use the status from the tool execution result instead of text matching
const status = toolResult.status;
logger.debug("Tool result status", {
status,
toolCallId: toolResult.tool_call_id,
});
if (useService) {
chatHistorySvc.addToolResult(

View file

@ -1,5 +1,6 @@
// Helper functions extracted from streamChatResponse.ts to reduce file size
import type { ToolStatus } from "core/index.js";
import { ContinueError, ContinueErrorReason } from "core/util/errors.js";
import { ChatCompletionToolMessageParam } from "openai/resources/chat/completions.mjs";
@ -27,6 +28,10 @@ import { logger } from "../util/logger.js";
import { StreamCallbacks } from "./streamChatResponse.types.js";
export interface ToolResultWithStatus extends ChatCompletionToolMessageParam {
status: ToolStatus;
}
// Helper function to handle permission denied
export function handlePermissionDenied(
toolCall: PreprocessedToolCall,
@ -389,7 +394,7 @@ export async function preprocessStreamedToolCalls(
* Executes preprocessed tool calls, handling permissions and results
* @param preprocessedCalls - The preprocessed tool calls ready for execution
* @param callbacks - Optional callbacks for notifying of events
* @returns - Chat history entries with tool results
* @returns - Chat history entries with tool results and status information
*/
export async function executeStreamedToolCalls(
preprocessedCalls: PreprocessedToolCall[],
@ -397,7 +402,7 @@ export async function executeStreamedToolCalls(
isHeadless?: boolean,
): Promise<{
hasRejection: boolean;
chatHistoryEntries: ChatCompletionToolMessageParam[];
chatHistoryEntries: ToolResultWithStatus[];
}> {
// Strategy: queue permissions (preserve order), then run approved tools in parallel.
// If any permission is rejected, cancel the remaining tools in this batch.
@ -408,7 +413,7 @@ export async function executeStreamedToolCalls(
call,
}));
const entriesByIndex = new Map<number, ChatCompletionToolMessageParam>();
const entriesByIndex = new Map<number, ToolResultWithStatus>();
const execPromises: Promise<void>[] = [];
let hasRejection = false;
@ -439,17 +444,18 @@ export async function executeStreamedToolCalls(
);
if (!permissionResult.approved) {
// Permission denied: record and mark rejection
// Permission denied: create entry with canceled status
const denialReason = permissionResult.denialReason || "user";
const deniedMessage =
denialReason === "policy"
? `Command blocked by security policy`
: `Permission denied by user`;
const deniedEntry: ChatCompletionToolMessageParam = {
const deniedEntry: ToolResultWithStatus = {
role: "tool",
tool_call_id: call.id,
content: deniedMessage,
status: "canceled",
};
entriesByIndex.set(index, deniedEntry);
callbacks?.onToolResult?.(
@ -484,10 +490,11 @@ export async function executeStreamedToolCalls(
arguments: call.arguments,
});
const toolResult = await executeToolCall(call);
const entry: ChatCompletionToolMessageParam = {
const entry: ToolResultWithStatus = {
role: "tool",
tool_call_id: call.id,
content: toolResult,
status: "done",
};
entriesByIndex.set(index, entry);
callbacks?.onToolResult?.(toolResult, call.name, "done");
@ -511,6 +518,7 @@ export async function executeStreamedToolCalls(
role: "tool",
tool_call_id: call.id,
content: errorMessage,
status: "errored",
});
callbacks?.onToolError?.(errorMessage, call.name);
// Immediate service update for UI feedback
@ -536,6 +544,7 @@ export async function executeStreamedToolCalls(
role: "tool",
tool_call_id: call.id,
content: errorMessage,
status: "errored",
});
callbacks?.onToolError?.(errorMessage, call.name);
// Treat permission errors like execution errors but do not stop the batch
@ -552,9 +561,9 @@ export async function executeStreamedToolCalls(
await Promise.all(execPromises);
// Assemble final entries in original order
const chatHistoryEntries: ChatCompletionToolMessageParam[] = preprocessedCalls
const chatHistoryEntries: ToolResultWithStatus[] = preprocessedCalls
.map((_, index) => entriesByIndex.get(index))
.filter((e): e is ChatCompletionToolMessageParam => !!e);
.filter((e): e is ToolResultWithStatus => !!e);
return {
hasRejection,

View file

@ -252,6 +252,135 @@ describe("processStreamingResponse - content preservation", () => {
expect(result.finalContent).toBe("Hello world!");
});
it("routes gpt-5 models through responsesStream and preserves streaming tool updates", async () => {
const gpt5Chunks: ChatCompletionChunk[] = [
{
id: "resp_gpt5",
object: "chat.completion.chunk",
created: Date.now(),
model: "gpt-5",
choices: [
{
index: 0,
delta: { role: "assistant" },
finish_reason: null,
},
],
},
{
id: "resp_gpt5",
object: "chat.completion.chunk",
created: Date.now(),
model: "gpt-5",
choices: [
{
index: 0,
delta: { content: "Analyzing repository…" },
finish_reason: null,
},
],
},
{
id: "resp_gpt5",
object: "chat.completion.chunk",
created: Date.now(),
model: "gpt-5",
choices: [
{
index: 0,
delta: {
tool_calls: [
{
index: 0,
id: "call_final",
type: "function",
function: {
name: "searchDocs",
arguments: '{"query":"unit',
},
},
],
},
finish_reason: null,
},
],
},
{
id: "resp_gpt5",
object: "chat.completion.chunk",
created: Date.now(),
model: "gpt-5",
choices: [
{
index: 0,
delta: {
tool_calls: [
{
index: 0,
type: "function",
function: {
arguments: ' tests"}',
},
},
],
},
finish_reason: null,
},
],
},
{
id: "resp_gpt5",
object: "chat.completion.chunk",
created: Date.now(),
model: "gpt-5",
choices: [
{
index: 0,
delta: {},
finish_reason: "tool_calls",
},
],
},
];
const responsesStream = vi.fn().mockImplementation(async function* () {
for (const chunk of gpt5Chunks) {
yield chunk;
}
});
const chatCompletionStream = vi.fn().mockImplementation(async function* () {
throw new Error("chatCompletionStream should not be used for gpt-5");
});
mockLlmApi = {
responsesStream,
chatCompletionStream,
} as unknown as BaseLlmApi;
mockModel = {
model: "gpt-5-preview",
provider: "openai",
} as unknown as ModelConfig;
const result = await processStreamingResponse({
chatHistory,
model: mockModel,
llmApi: mockLlmApi,
abortController: mockAbortController,
});
expect(responsesStream).toHaveBeenCalledTimes(1);
expect(chatCompletionStream).not.toHaveBeenCalled();
expect(result.content).toBe("Analyzing repository…");
expect(result.toolCalls).toHaveLength(1);
expect(result.toolCalls[0]).toMatchObject({
id: "call_final",
name: "searchDocs",
arguments: { query: "unit tests" },
});
expect(result.shouldContinue).toBe(true);
});
it("handles provider that only sends tool ID in first chunk then uses index", async () => {
chunks = [
contentChunk("I'll read the README.md file for you and then say hello!"),

View file

@ -173,12 +173,14 @@ export async function constructSystemMessage(
systemMessage +=
'\n<context name="planMode">You are operating in _Plan Mode_, which means that your goal is to help the user investigate their ideas and develop a plan before taking action. You only have access to read-only tools and should not attempt to circumvent them to write / delete / create files. For example, it is not acceptable to use the Bash tool to write to files.</context>\n';
} else {
// TODO - make including this coauthor commit configurable
systemMessage += `\n<context name="commitSignature">When creating commits using any CLI or tool, include the following in the commit message:
// Check if commit signature is disabled via environment variable
if (!process.env.CONTINUE_CLI_DISABLE_COMMIT_SIGNATURE) {
systemMessage += `\n<context name="commitSignature">When creating commits using any CLI or tool, include the following in the commit message:
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
</context>\n`;
}
}
// In headless mode, add instructions to be concise and only provide final answers

View file

@ -43,7 +43,7 @@ export function ToolCallTitle(props: { toolName: string; args?: any }) {
}
return (
<Text>
<Text wrap="truncate">
<Text bold>{displayName}</Text>({formattedValue})
</Text>
);

View file

@ -96,23 +96,21 @@ describe("fetchTool", () => {
expect(result).toBe("Content from page 1\n\nContent from page 2");
});
it("should return error message when no content items returned", async () => {
it("should throw error when no content items returned", async () => {
mockFetchUrlContentImpl.mockResolvedValue([]);
const result = await fetchTool.run({ url: "https://example.com" });
expect(result).toBe(
"Error: Could not fetch content from https://example.com",
await expect(fetchTool.run({ url: "https://example.com" })).rejects.toThrow(
"Could not fetch content from https://example.com",
);
});
it("should handle errors from core implementation", async () => {
it("should throw errors from core implementation", async () => {
const error = new Error("Network error");
mockFetchUrlContentImpl.mockRejectedValue(error);
const result = await fetchTool.run({ url: "https://example.com" });
expect(result).toBe("Error: Network error");
await expect(fetchTool.run({ url: "https://example.com" })).rejects.toThrow(
"Error: Network error",
);
});
it("should call fetchUrlContentImpl with correct arguments", async () => {

View file

@ -1,5 +1,6 @@
import type { ContextItem } from "core/index.js";
import { fetchUrlContentImpl } from "core/tools/implementations/fetchUrlContent.js";
import { ContinueError, ContinueErrorReason } from "core/util/errors.js";
import { Tool } from "./types.js";
@ -46,7 +47,10 @@ export const fetchTool: Tool = {
console.error = originalConsoleError;
if (contextItems.length === 0) {
return `Error: Could not fetch content from ${url}`;
throw new ContinueError(
ContinueErrorReason.Unspecified,
`Could not fetch content from ${url}`,
);
}
// Format the results for CLI display
@ -59,7 +63,12 @@ export const fetchTool: Tool = {
})
.join("\n\n");
} catch (error) {
return `Error: ${error instanceof Error ? error.message : String(error)}`;
if (error instanceof ContinueError) {
throw error;
}
throw new Error(
`Error: ${error instanceof Error ? error.message : String(error)}`,
);
}
},
};

View file

@ -228,7 +228,7 @@ export async function executeToolCall(
errorReason,
});
return `Error executing tool "${toolCall.name}": ${errorMessage}`;
throw error;
}
}

View file

@ -61,9 +61,11 @@ export const listFilesTool: Tool = {
return `Files in ${args.dirpath}:\n${fileDetails.join("\n")}`;
} catch (error) {
return `Error listing files: ${
error instanceof Error ? error.message : String(error)
}`;
throw new Error(
`Error listing files: ${
error instanceof Error ? error.message : String(error)
}`,
);
}
},
};

View file

@ -1,6 +1,7 @@
import * as fs from "fs";
import { throwIfFileIsSecurityConcern } from "core/indexing/ignore.js";
import { ContinueError, ContinueErrorReason } from "core/util/errors.js";
import { formatToolArgument } from "./formatters.js";
import { Tool } from "./types.js";
@ -51,7 +52,10 @@ export const readFileTool: Tool = {
}
if (!fs.existsSync(filepath)) {
return `Error: File does not exist: ${filepath}`;
throw new ContinueError(
ContinueErrorReason.Unspecified,
`File does not exist: ${filepath}`,
);
}
const realPath = fs.realpathSync(filepath);
const content = fs.readFileSync(realPath, "utf-8");
@ -66,9 +70,14 @@ export const readFileTool: Tool = {
return `Content of ${filepath}:\n${content}`;
} catch (error) {
return `Error reading file: ${
error instanceof Error ? error.message : String(error)
}`;
if (error instanceof ContinueError) {
throw error;
}
throw new Error(
`Error reading file: ${
error instanceof Error ? error.message : String(error)
}`,
);
}
},
};

View file

@ -2,6 +2,8 @@ import * as child_process from "child_process";
import * as fs from "fs";
import * as util from "util";
import { ContinueError, ContinueErrorReason } from "core/util/errors.js";
import { Tool } from "./types.js";
const execPromise = util.promisify(child_process.exec);
@ -53,64 +55,66 @@ export const searchCodeTool: Tool = {
path?: string;
file_pattern?: string;
}): Promise<string> => {
const searchPath = args.path || process.cwd();
if (!fs.existsSync(searchPath)) {
throw new ContinueError(
ContinueErrorReason.Unspecified,
`Path does not exist: ${searchPath}`,
);
}
let command = `rg --line-number --with-filename --color never "${args.pattern}"`;
if (args.file_pattern) {
command += ` -g "${args.file_pattern}"`;
}
command += ` "${searchPath}"`;
try {
const searchPath = args.path || process.cwd();
if (!fs.existsSync(searchPath)) {
return `Error: Path does not exist: ${searchPath}`;
const { stdout, stderr } = await execPromise(command);
if (stderr) {
return `Warning during search: ${stderr}\n\n${stdout}`;
}
let command = `rg --line-number --with-filename --color never "${args.pattern}"`;
if (args.file_pattern) {
command += ` -g "${args.file_pattern}"`;
}
command += ` "${searchPath}"`;
try {
const { stdout, stderr } = await execPromise(command);
if (stderr) {
return `Warning during search: ${stderr}\n\n${stdout}`;
}
if (!stdout.trim()) {
return `No matches found for pattern "${args.pattern}"${
args.file_pattern ? ` in files matching "${args.file_pattern}"` : ""
}.`;
}
// Split the results into lines and limit the number of results
const lines = stdout.split("\n");
const truncated = lines.length > DEFAULT_MAX_RESULTS;
const limitedLines = lines.slice(0, DEFAULT_MAX_RESULTS);
const resultText = limitedLines.join("\n");
const truncationMessage = truncated
? `\n\n[Results truncated: showing ${DEFAULT_MAX_RESULTS} of ${lines.length} matches]`
: "";
return `Search results for pattern "${args.pattern}"${
if (!stdout.trim()) {
return `No matches found for pattern "${args.pattern}"${
args.file_pattern ? ` in files matching "${args.file_pattern}"` : ""
}:\n\n${resultText}${truncationMessage}`;
} catch (error: any) {
if (error.code === 1) {
return `No matches found for pattern "${args.pattern}"${
args.file_pattern ? ` in files matching "${args.file_pattern}"` : ""
}.`;
}
if (error instanceof Error) {
if (error.message.includes("command not found")) {
return `Error: ripgrep is not installed.`;
}
}
return `Error executing ripgrep: ${
error instanceof Error ? error.message : String(error)
}`;
}.`;
}
} catch (error) {
return `Error searching code: ${
error instanceof Error ? error.message : String(error)
}`;
// Split the results into lines and limit the number of results
const lines = stdout.split("\n");
const truncated = lines.length > DEFAULT_MAX_RESULTS;
const limitedLines = lines.slice(0, DEFAULT_MAX_RESULTS);
const resultText = limitedLines.join("\n");
const truncationMessage = truncated
? `\n\n[Results truncated: showing ${DEFAULT_MAX_RESULTS} of ${lines.length} matches]`
: "";
return `Search results for pattern "${args.pattern}"${
args.file_pattern ? ` in files matching "${args.file_pattern}"` : ""
}:\n\n${resultText}${truncationMessage}`;
} catch (error: any) {
if (error instanceof ContinueError) {
throw error;
}
if (error.code === 1) {
return `No matches found for pattern "${args.pattern}"${
args.file_pattern ? ` in files matching "${args.file_pattern}"` : ""
}.`;
}
if (error instanceof Error) {
if (error.message.includes("command not found")) {
throw new Error(`ripgrep is not installed.`);
}
}
throw new Error(
`Error executing ripgrep: ${
error instanceof Error ? error.message : String(error)
}`,
);
}
},
};

View file

@ -1,3 +1,5 @@
import { ContinueError, ContinueErrorReason } from "core/util/errors.js";
import {
ApiRequestError,
AuthenticationRequiredError,
@ -53,7 +55,7 @@ You should use this tool to notify the user whenever the state of your work chan
const errorMessage =
"Agent ID is required. Please use the --id flag with cn serve.";
logger.error(errorMessage);
return `Error: ${errorMessage}`;
throw new ContinueError(ContinueErrorReason.Unspecified, errorMessage);
}
// Call the API endpoint using shared client
@ -62,19 +64,25 @@ You should use this tool to notify the user whenever the state of your work chan
logger.info(`Status: ${args.status}`);
return `Status set: ${args.status}`;
} catch (error) {
if (error instanceof ContinueError) {
throw error;
}
if (error instanceof AuthenticationRequiredError) {
logger.error(error.message);
return "Error: Authentication required";
throw new Error("Error: Authentication required");
}
if (error instanceof ApiRequestError) {
return `Error setting status: ${error.status} ${error.response || error.statusText}`;
throw new Error(
`Error setting status: ${error.status} ${error.response || error.statusText}`,
);
}
const errorMessage =
error instanceof Error ? error.message : String(error);
logger.error(`Error setting status: ${errorMessage}`);
return `Error setting status: ${errorMessage}`;
throw new Error(`Error setting status: ${errorMessage}`);
}
},
};

View file

@ -1,6 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import { ContinueError, ContinueErrorReason } from "core/util/errors.js";
import { createTwoFilesPatch } from "diff";
import { telemetryService } from "../telemetry/telemetryService.js";
@ -159,10 +160,15 @@ export const writeFileTool: Tool = {
return `Successfully created file: ${args.filepath}`;
}
} catch (error) {
const errorMessage =
error instanceof Error ? error.message : String(error);
return `Error writing to file: ${errorMessage}`;
if (error instanceof ContinueError) {
throw error;
}
throw new ContinueError(
ContinueErrorReason.FileWriteError,
`Error writing to file: ${
error instanceof Error ? error.message : String(error)
}`,
);
}
},
};

View file

@ -4,6 +4,18 @@ import React, { useMemo } from "react";
import { getAllSlashCommands } from "../commands/commands.js";
const MAX_DESCRIPTION_LENGTH = 80;
const truncateDescription = (description: string): string => {
if (description.length <= MAX_DESCRIPTION_LENGTH) {
return description;
}
return (
Array.from(description).slice(0, MAX_DESCRIPTION_LENGTH).join("").trim() +
"…"
);
};
interface SlashCommandUIProps {
assistant?: AssistantConfig;
filter: string;
@ -74,7 +86,7 @@ const SlashCommandUI: React.FC<SlashCommandUIProps> = ({
{paddedCommandName}
<Text color={isSelected ? "blue" : "gray"}>
{" "}
{command.description}
{truncateDescription(command.description)}
</Text>
</Text>
</Box>

View file

@ -64,7 +64,7 @@ export const BottomStatusBar: React.FC<BottomStatusBarProps> = ({
</React.Fragment>
)}
<ModeIndicator />
{contextPercentage !== undefined && contextPercentage > 75 && (
{contextPercentage !== undefined && contextPercentage > 0 && (
<React.Fragment>
<Text key="context-separator" color="dim">
{" "}

View file

@ -7,14 +7,12 @@ interface ContextPercentageDisplayProps {
/**
* Component to display the current context usage percentage
* Shows the percentage in gray color for consistency with other status indicators
* Only displays when percentage exceeds 75% threshold
* Shows the non-zero percentage in gray color for consistency with other status indicators
*/
export const ContextPercentageDisplay: React.FC<
ContextPercentageDisplayProps
> = ({ percentage }) => {
// Only show if percentage is greater than 75%
if (percentage <= 75) {
if (percentage === 0) {
return null;
}

View file

@ -56,13 +56,6 @@ export const MemoizedMessage = memo<MemoizedMessageProps>(
// Handle system messages
if (isSystem) {
// TODO: Properly separate LLM system messages from UI informational messages
// using discriminated union types. For now, skip displaying the first system
// message which is typically the LLM's system prompt.
if (index === 0) {
return null;
}
return (
<Box key={index} marginBottom={1}>
<Text color="dim" italic>
@ -116,24 +109,28 @@ export const MemoizedMessage = memo<MemoizedMessageProps>(
flexDirection="column"
marginBottom={1}
>
<Box>
<Text
color={
isErrored
? "red"
: isCompleted
? "green"
: toolState.status === "generated"
? "yellow"
: "white"
}
>
{isCompleted || isErrored ? "●" : "○"}
</Text>
<Text color="white">
{" "}
<ToolCallTitle toolName={toolName} args={toolArgs} />
</Text>
<Box width="100%">
<Box flexShrink={0}>
<Text
color={
isErrored
? "red"
: isCompleted
? "green"
: toolState.status === "generated"
? "yellow"
: "white"
}
>
{isCompleted || isErrored ? "●" : "○"}
</Text>
</Box>
<Box flexGrow={1} flexShrink={1} minWidth={0}>
<Text color="white">
{" "}
<ToolCallTitle toolName={toolName} args={toolArgs} />
</Text>
</Box>
</Box>
{isErrored ? (

View file

@ -1,4 +1,4 @@
import { BaseLlmApi } from "@continuedev/openai-adapters";
import { BaseLlmApi, isResponsesModel } from "@continuedev/openai-adapters";
import type { ChatCompletionCreateParamsStreaming } from "openai/resources.mjs";
import { error, warn } from "../logging.js";
@ -173,6 +173,14 @@ export async function chatCompletionStreamWithBackoff(
throw new Error("Request aborted");
}
const useResponses =
typeof llmApi.responsesStream === "function" &&
isResponsesModel(params.model);
if (useResponses) {
return llmApi.responsesStream!(params, abortSignal);
}
return llmApi.chatCompletionStream(params, abortSignal);
} catch (err: any) {
lastError = err;
@ -189,6 +197,14 @@ export async function chatCompletionStreamWithBackoff(
// Only retry if the error is retryable
if (!isRetryableError(err)) {
// Log full error details for non-retryable errors
logger.error("Non-retryable LLM API error", err, {
status: err.status,
statusText: err.statusText,
message: err.message,
error: err.error,
model: params.model,
});
throw err;
}

View file

@ -16,9 +16,15 @@
<p></p>
<div align="center">
**Ship faster with Continuous AI**
**Build and run custom agents across your IDE, terminal, and CI**
**The future of coding isn't writing more code. It's delegating the boring parts, so you can build the interesting stuff**
</div>
Get started in [Mission Control](https://hub.continue.dev/agents), [CLI (Headless Mode)](https://docs.continue.dev/cli/quick-start#headless-mode), or [CLI (TUI mode)](https://docs.continue.dev/cli/quick-start#tui-mode)
## Agent

View file

@ -122,6 +122,7 @@ class MessageTypes {
"llm/listModels",
"llm/compileChat",
"streamDiffLines",
"getDiffLines",
"chatDescriber/describe",
"conversation/compact",
"stats/getTokensPerDay",

View file

@ -83,17 +83,7 @@ class ApplyToFileHandler(
val diffStreamHandler = createDiffStreamHandler(editorUtils.editor, startLine, endLine)
diffStreamService.register(diffStreamHandler, editorUtils.editor)
// Stream the diffs between current and new content
// For search/replace, we pass the new content as "input" and current as "highlighted"
diffStreamHandler.streamDiffLinesToEditor(
input = newContent, // The new content (full rewrite)
prefix = "", // No prefix since we're rewriting the whole file
highlighted = currentContent, // Current file content
suffix = "", // No suffix since we're rewriting the whole file
modelTitle = null, // No model needed for search/replace instant apply
includeRulesInSystemMessage = false, // No LLM involved, just diff generation
isApply = true
)
diffStreamHandler.instantApplyDiffLines(currentContent, newContent)
}
private fun notifyStreamStarted() {

View file

@ -3,6 +3,7 @@ package com.github.continuedev.continueintellijextension.editor
import com.github.continuedev.continueintellijextension.ApplyState
import com.github.continuedev.continueintellijextension.ApplyStateStatus
import com.github.continuedev.continueintellijextension.StreamDiffLinesPayload
import com.github.continuedev.continueintellijextension.GetDiffLinesPayload
import com.github.continuedev.continueintellijextension.browser.ContinueBrowserService.Companion.getBrowser
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
import com.intellij.openapi.application.ApplicationManager
@ -131,6 +132,138 @@ class DiffStreamHandler(
}
}
fun instantApplyDiffLines(
currentContent: String,
newContent: String
) {
isRunning = true
sendUpdate(ApplyStateStatus.STREAMING)
project.service<ContinuePluginService>().coreMessenger?.request(
"getDiffLines",
GetDiffLinesPayload(
oldContent=currentContent,
newContent=newContent
),
null
) { response ->
if (!isRunning) return@request
val diffLines = parseDiffLinesResponse(response) ?: run {
println("Error: Invalid response format for getDiffLines")
ApplicationManager.getApplication().invokeLater {
setClosed()
}
return@request
}
ApplicationManager.getApplication().invokeLater {
WriteCommandAction.runWriteCommandAction(project) {
applyAllDiffLines(diffLines)
createDiffBlocksFromDiffLines(diffLines)
cleanupProgressHighlighters()
if (diffBlocks.isEmpty()) {
setClosed()
} else {
sendUpdate(ApplyStateStatus.DONE)
}
onFinish()
}
}
}
}
private fun parseDiffLinesResponse(response: Any?): List<Map<String, Any>>? {
if (response !is Map<*, *>) return null
val success = response["status"] as? String
if (success != "success") return null
val content = response["content"] as? List<*> ?: return null
val result = mutableListOf<Map<String, Any>>()
for (item in content) {
if (item !is Map<*, *>) return null
val type = item["type"] as? String ?: return null
val line = item["line"] as? String ?: return null
result.add(mapOf("type" to type, "line" to line))
}
return result
}
private fun applyAllDiffLines(diffLines: List<Map<String, Any>>) {
var currentLine = startLine
diffLines.forEach { line ->
val type = getDiffLineType(line["type"] as String)
val text = line["line"] as String
when (type) {
DiffLineType.OLD -> {
// Delete line
val document = editor.document
val start = document.getLineStartOffset(currentLine)
val end = document.getLineEndOffset(currentLine)
document.deleteString(start, if (currentLine < document.lineCount - 1) end + 1 else end)
}
DiffLineType.NEW -> {
// Insert line
val offset = if (currentLine >= editor.document.lineCount) editor.document.textLength else editor.document.getLineStartOffset(currentLine)
editor.document.insertString(offset, text + "\n")
currentLine++
}
DiffLineType.SAME -> {
currentLine++
}
}
}
}
private fun createDiffBlocksFromDiffLines(diffLines: List<Map<String, Any>>) {
var currentBlock: VerticalDiffBlock? = null
var currentLine = startLine
diffLines.forEach { line ->
val type = getDiffLineType(line["type"] as String)
val text = line["line"] as String
when (type) {
DiffLineType.OLD -> {
if (currentBlock == null) {
currentBlock = createDiffBlock()
currentBlock!!.startLine = currentLine
}
currentBlock!!.deletedLines.add(text)
}
DiffLineType.NEW -> {
if (currentBlock == null) {
currentBlock = createDiffBlock()
currentBlock!!.startLine = currentLine
}
currentBlock!!.addedLines.add(text)
currentLine++
}
DiffLineType.SAME -> {
if (currentBlock != null) {
currentBlock!!.onLastDiffLine()
currentBlock = null
}
currentLine++
}
}
}
// Handle last block if it doesn't end with SAME
currentBlock?.onLastDiffLine()
}
private fun initUnfinishedRangeHighlights() {
val editorUtils = EditorUtils(editor)
val unfinishedKey = editorUtils.createTextAttributesKey("CONTINUE_DIFF_UNFINISHED_LINE", 0x20888888)

View file

@ -310,6 +310,11 @@ data class StreamDiffLinesPayload(
val isApply: Boolean
)
data class GetDiffLinesPayload(
val oldContent: String,
val newContent: String,
)
data class AcceptOrRejectDiffPayload(
val filepath: String? = null,
val streamId: String? = null

View file

@ -41,7 +41,6 @@
displayType="BALLOON"/>
<actionPromoter order="last"
implementation="com.github.continuedev.continueintellijextension.actions.ContinueActionPromote"/>
<errorHandler implementation="com.github.continuedev.continueintellijextension.error.ContinueErrorSubmitter"/>
<postStartupActivity
implementation="com.github.continuedev.continueintellijextension.activities.ContinuePluginStartupActivity"/>
<postStartupActivity implementation="com.github.continuedev.continueintellijextension.proxy.ProxyPoolingActivity"/>

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "1.3.23",
"version": "1.3.24",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -58,13 +58,9 @@ export class ApplyManager {
// Currently `isSearchAndReplace` will always provide a full file rewrite
// as the contents of `text`, so we can just instantly apply
if (isSearchAndReplace) {
const diffLinesGenerator = generateLines(
myersDiff(activeTextEditor.document.getText(), text),
);
await this.verticalDiffManager.streamDiffLines(
diffLinesGenerator,
true,
await this.verticalDiffManager.instantApplyDiff(
originalFileContent,
text,
streamId,
toolCallId,
);

View file

@ -11,6 +11,7 @@ import {
import type { ApplyState, DiffLine } from "core";
import type { VerticalDiffCodeLens } from "./manager";
import { getFirstChangedLine } from "./util";
export interface VerticalDiffHandlerOptions {
input?: string;
@ -211,7 +212,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
// Scroll to the first diff
const scrollToLine =
this.getFirstChangedLine(myersDiffs) ?? this.startLine;
getFirstChangedLine(myersDiffs, this.startLine) ?? this.startLine;
const range = new vscode.Range(scrollToLine, 0, scrollToLine, 0);
this.editor.revealRange(range, vscode.TextEditorRevealType.Default);
@ -605,13 +606,4 @@ export class VerticalDiffHandler implements vscode.Disposable {
/**
* Gets the first line number that was changed in a diff
*/
private getFirstChangedLine(diff: DiffLine[]): number | null {
for (let i = 0; i < diff.length; i++) {
const item = diff[i];
if (item.type === "old" || item.type === "new") {
return this.startLine + i;
}
}
return null;
}
}

View file

@ -10,12 +10,14 @@ import EditDecorationManager from "../../quickEdit/EditDecorationManager";
import { handleLLMError } from "../../util/errorHandling";
import { VsCodeWebviewProtocol } from "../../webviewProtocol";
import { myersDiff } from "core/diff/myers";
import { ApplyAbortManager } from "core/edit/applyAbortManager";
import { EDIT_MODE_STREAM_ID } from "core/edit/constants";
import { stripImages } from "core/util/messageContent";
import { getLastNPathParts } from "core/util/uri";
import { editOutcomeTracker } from "../../extension/EditOutcomeTracker";
import { VerticalDiffHandler, VerticalDiffHandlerOptions } from "./handler";
import { getFirstChangedLine } from "./util";
export interface VerticalDiffCodeLens {
start: number;
@ -293,6 +295,65 @@ export class VerticalDiffManager {
}
}
async instantApplyDiff(
oldContent: string,
newContent: string,
streamId: string,
toolCallId?: string,
) {
vscode.commands.executeCommand("setContext", "continue.diffVisible", true);
const editor = vscode.window.activeTextEditor;
if (!editor) {
return;
}
const fileUri = editor.document.uri.toString();
const myersDiffs = myersDiff(oldContent, newContent);
const diffHandler = this.createVerticalDiffHandler(
fileUri,
0,
editor.document.lineCount - 1,
{
instant: true,
onStatusUpdate: (status, numDiffs, fileContent) =>
void this.webviewProtocol.request("updateApplyState", {
streamId,
status,
numDiffs,
fileContent,
filepath: fileUri,
toolCallId,
}),
streamId,
},
);
if (!diffHandler) {
console.warn("Issue occurred while creating vertical diff handler");
return;
}
await diffHandler.reapplyWithMyersDiff(myersDiffs);
const scrollToLine = getFirstChangedLine(myersDiffs, 0) ?? 0;
const range = new vscode.Range(scrollToLine, 0, scrollToLine, 0);
editor.revealRange(range, vscode.TextEditorRevealType.Default);
this.enableDocumentChangeListener();
await this.webviewProtocol.request("updateApplyState", {
streamId,
status: "done",
numDiffs: this.fileUriToCodeLens.get(fileUri)?.length ?? 0,
fileContent: editor.document.getText(),
filepath: fileUri,
toolCallId,
});
}
async streamEdit({
input,
llm,

View file

@ -0,0 +1,14 @@
import { DiffLine } from "core";
export function getFirstChangedLine(
diff: DiffLine[],
startLine: number,
): number | null {
for (let i = 0; i < diff.length; i++) {
const item = diff[i];
if (item.type === "old" || item.type === "new") {
return startLine + i;
}
}
return null;
}

View file

@ -6,7 +6,6 @@ import {
} from "@heroicons/react/24/outline";
import { MessageModes } from "core";
import { isRecommendedAgentModel } from "core/llm/toolSupport";
import { capitalize } from "lodash";
import { useCallback, useEffect, useMemo } from "react";
import { useAuth } from "../../context/Auth";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
@ -89,14 +88,14 @@ export function ModeSelect() {
}
}, [mode, isLocalAgent, dispatch]);
const notGreatAtAgent = (
const notGreatAtAgent = (mode: string) => (
<>
<ToolTip
style={{
zIndex: 200001, // in front of listbox
}}
className="flex items-center gap-1"
content={`${capitalize(mode)} might not work well with this model.`}
content={`${mode} might not work well with this model.`}
>
<ExclamationTriangleIcon className="text-warning h-2.5 w-2.5" />
</ToolTip>
@ -162,7 +161,7 @@ export function ModeSelect() {
<InformationCircleIcon className="h-2.5 w-2.5 flex-shrink-0" />
</ToolTip>
</div>
{!isGoodAtAgentMode && notGreatAtAgent}
{!isGoodAtAgentMode && notGreatAtAgent("Plan")}
<CheckIcon
className={`ml-auto h-3 w-3 ${mode === "plan" ? "" : "opacity-0"}`}
/>
@ -181,7 +180,7 @@ export function ModeSelect() {
<InformationCircleIcon className="h-2.5 w-2.5 flex-shrink-0" />
</ToolTip>
</div>
{!isGoodAtAgentMode && notGreatAtAgent}
{!isGoodAtAgentMode && notGreatAtAgent("Agent")}
<CheckIcon
className={`ml-auto h-3 w-3 ${mode === "agent" ? "" : "opacity-0"}`}
/>

View file

@ -115,9 +115,11 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
<div className={`relative flex flex-col px-2`}>
{props.isMainInput && <Lump />}
<GradientBorder
loading={isStreaming && props.isLastUserInput ? 1 : 0}
loading={isStreaming && (props.isLastUserInput || isInEdit) ? 1 : 0}
borderColor={
isStreaming && props.isLastUserInput ? undefined : vscBackground
isStreaming && (props.isLastUserInput || isInEdit)
? undefined
: vscBackground
}
borderRadius={defaultBorderRadius}
>

View file

@ -350,7 +350,7 @@ export function createEditorConfig(options: {
if (!editor) {
return;
}
if (isStreaming || (codeToEdit.length === 0 && isInEdit)) {
if (isStreamingRef.current || (codeToEdit.length === 0 && isInEdit)) {
return;
}

View file

@ -18,13 +18,41 @@ export const LocalStorageProvider: React.FC<{ children: React.ReactNode }> = ({
}) => {
const [values, setValues] = useState<LocalStorageType>(DEFAULT_LOCAL_STORAGE);
// TODO setvalue
useEffect(() => {
// Helper function to sync state with localStorage
const syncWithLocalStorage = () => {
const isJetbrains = getLocalStorage("ide") === "jetbrains";
let fontSize = getLocalStorage("fontSize") ?? (isJetbrains ? 15 : 14);
setValues({
const fontSize = getLocalStorage("fontSize") ?? (isJetbrains ? 15 : 14);
setValues((prev) => ({
...prev,
fontSize,
});
}));
};
// Initialize with values from localStorage
useEffect(() => {
syncWithLocalStorage();
}, []);
// Listen for current tab changes using CustomEvent
useEffect(() => {
const handleLocalStorageChange = (event: CustomEvent) => {
if (event.detail?.key === "fontSize") {
syncWithLocalStorage();
}
};
window.addEventListener(
"localStorageChange",
handleLocalStorageChange as EventListener,
);
return () => {
window.removeEventListener(
"localStorageChange",
handleLocalStorageChange as EventListener,
);
};
}, []);
return (

View file

@ -1079,6 +1079,19 @@ export const models: { [key: string]: ModelPackage } = {
icon: "openai.png",
isOpenSource: false,
},
gpt5Codex: {
title: "GPT-5 Codex",
description:
"OpenAI's most advanced code generation model, optimized for programming tasks",
params: {
model: "gpt-5-codex",
contextLength: 400_000,
title: "GPT-5 Codex",
},
providerOptions: ["openai"],
icon: "openai.png",
isOpenSource: false,
},
gpt4turbo: {
title: "GPT-4 Turbo",
description:

View file

@ -118,6 +118,7 @@ export const providers: Partial<Record<string, ProviderInfo>> = {
tags: [ModelProviderTags.RequiresApiKey],
packages: [
models.gpt5,
models.gpt5Codex,
models.gpt4o,
models.gpt4omini,
models.gpt4turbo,

View file

@ -2,6 +2,7 @@ import {
ChevronDownIcon,
WrenchScrewdriverIcon,
} from "@heroicons/react/24/outline";
import { Tool } from "core";
import { useMemo, useState } from "react";
import ToggleSwitch from "../../../components/gui/Switch";
import { ToolTip } from "../../../components/gui/Tooltip";
@ -28,7 +29,9 @@ export function ToolPoliciesGroup({
const dispatch = useAppDispatch();
const [isExpanded, setIsExpanded] = useState(false);
const availableTools = useAppSelector((state) => state.config.config.tools);
const availableTools = useAppSelector(
(state) => state.config.config.tools as Tool[],
);
const tools = useMemo(() => {
return availableTools.filter((t) => t.group === groupName);
}, [availableTools, groupName]);

View file

@ -19,7 +19,6 @@ import {
import { useFontSize } from "../../../components/ui/font";
import { useAppSelector } from "../../../redux/hooks";
import { addTool, setToolPolicy } from "../../../redux/slices/uiSlice";
import { isEditTool } from "../../../util/toolCallState";
interface ToolPolicyItemProps {
tool: Tool;
@ -29,22 +28,12 @@ interface ToolPolicyItemProps {
export function ToolPolicyItem(props: ToolPolicyItemProps) {
const dispatch = useDispatch();
const toolPolicy = useAppSelector(
const policy = useAppSelector(
(state) => state.ui.toolSettings[props.tool.function.name],
);
const [isExpanded, setIsExpanded] = useState(false);
const mode = useAppSelector((state) => state.session.mode);
const autoAcceptEditToolDiffs = useAppSelector(
(state) => state.config.config.ui?.autoAcceptEditToolDiffs,
);
const isAutoAcceptedToolCall =
isEditTool(props.tool.function.name) && autoAcceptEditToolDiffs;
const policy = isAutoAcceptedToolCall
? "allowedWithoutPermission"
: toolPolicy;
useEffect(() => {
if (!policy) {
dispatch(addTool(props.tool));
@ -64,7 +53,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
const fontSize = useFontSize(-2);
const disabled =
isAutoAcceptedToolCall ||
!props.isGroupEnabled ||
(mode === "plan" &&
props.tool.group === BUILT_IN_GROUP_NAME &&
@ -112,19 +100,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
<InformationCircleIcon className="h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
</ToolTip>
) : null}
{isAutoAcceptedToolCall ? (
<ToolTip
place="bottom"
className="flex flex-wrap items-center"
content={
<p className="m-0 p-0">
Auto-Accept Agent Edits setting is on
</p>
}
>
<InformationCircleIcon className="h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
</ToolTip>
) : null}
{props.tool.faviconUrl && (
<img
src={props.tool.faviconUrl}
@ -164,13 +139,11 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
data-tooltip-id={disabled ? disabledTooltipId : undefined}
>
<span className="text-xs">
{isAutoAcceptedToolCall
? "Automatic"
: disabled || policy === "disabled"
? "Excluded"
: policy === "allowedWithoutPermission"
? "Automatic"
: "Ask First"}
{disabled || policy === "disabled"
? "Excluded"
: policy === "allowedWithoutPermission"
? "Automatic"
: "Ask First"}
</span>
<ChevronDownIcon className="h-3 w-3" />
</ListboxButton>

View file

@ -79,7 +79,40 @@ export function UserSetting(props: UserSettingProps) {
<input
type="number"
value={props.value}
onChange={(e) => props.onChange(Number(e.target.value))}
onChange={(e) => {
const value = Number(e.target.value);
// Allow temporary invalid values during input
props.onChange(value);
}}
onBlur={(e) => {
// Apply min/max constraints when input loses focus
const value = Number(e.target.value);
const min = props.min ?? 0;
const max = props.max ?? 100;
if (value < min) {
props.onChange(min);
} else if (value > max) {
props.onChange(max);
}
}}
onKeyDown={(e) => {
// Apply constraints when user presses Enter
if (e.key === "Enter") {
const value = Number(e.currentTarget.value);
const min = props.min ?? 0;
const max = props.max ?? 100;
if (value < min) {
props.onChange(min);
} else if (value > max) {
props.onChange(max);
}
// Blur the input to complete the editing
e.currentTarget.blur();
}
}}
min={props.min ?? 0}
max={props.max ?? 100}
disabled={disabled}

View file

@ -73,7 +73,7 @@ export function ConfigsSection() {
error.fatal
? "text-error bg-error/10"
: "bg-yellow-500/10 text-yellow-500"
} rounded border border-solid border-transparent px-2 py-1 text-xs ${error.uri ? "cursor-pointer " + (error.fatal ? "hover:border-error" : "hover:border-yellow-500") : ""}`}
} break-all rounded border border-solid border-transparent px-2 py-1 text-xs ${error.uri ? "cursor-pointer " + (error.fatal ? "hover:border-error" : "hover:border-yellow-500") : ""}`}
>
{error.message}
</div>

View file

@ -64,7 +64,6 @@ export function UserSettingsSection() {
const codeWrap = config.ui?.codeWrap ?? false;
const showChatScrollbar = config.ui?.showChatScrollbar ?? false;
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
const autoAcceptEditToolDiffs = config.ui?.autoAcceptEditToolDiffs ?? false;
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
const disableSessionTitles = config.disableSessionTitles ?? false;
const useCurrentFileAsContext =
@ -163,15 +162,6 @@ export function UserSettingsSection() {
handleUpdate({ displayRawMarkdown: !value })
}
/>
<UserSetting
type="toggle"
title="Auto-Accept Agent Edits"
description="Diffs generated by the edit tool are automatically accepted and Agent proceeds with the next conversational turn."
value={autoAcceptEditToolDiffs}
onChange={(value) =>
handleUpdate({ autoAcceptEditToolDiffs: value })
}
/>
</div>
</Card>
</div>

View file

@ -1,9 +1,4 @@
import { BuiltInToolNames } from "core/tools/builtIn";
import { generateToolCallButtonTestId } from "../../../components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar";
import {
addAndSelectMockLlm,
triggerConfigUpdate,
} from "../../../util/test/config";
import { updateConfig } from "../../../redux/slices/configSlice";
import { renderWithProviders } from "../../../util/test/render";
import { Chat } from "../Chat";
@ -11,7 +6,6 @@ import { Chat } from "../Chat";
import { waitFor } from "@testing-library/dom";
import { act } from "@testing-library/react";
import { ChatMessage } from "core";
import { setToolPolicy } from "../../../redux/slices/uiSlice";
import { setInactive } from "../../../redux/slices/sessionSlice";
import {
getElementByTestId,
@ -133,12 +127,6 @@ test(
await user.click(toggleCodeblockChevron);
await getElementByText(EDIT_CHANGES);
// Pending tool call - find and click the accept button
const acceptToolCallButton = await getElementByTestId(
generateToolCallButtonTestId("accept", EDIT_TOOL_CALL_ID),
);
await user.click(acceptToolCallButton);
// Tool call, check that applyToFile was called for edit
await waitFor(() => {
expect(messengerRequestSpy).toHaveBeenCalledWith("applyToFile", {

View file

@ -1,228 +0,0 @@
import { BuiltInToolNames } from "core/tools/builtIn";
import { generateToolCallButtonTestId } from "../../../components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar";
import { triggerConfigUpdate } from "../../../util/test/config";
import { updateConfig } from "../../../redux/slices/configSlice";
import { renderWithProviders } from "../../../util/test/render";
import { Chat } from "../Chat";
import { waitFor } from "@testing-library/dom";
import { act } from "@testing-library/react";
import { ChatMessage } from "core";
import { setToolPolicy } from "../../../redux/slices/uiSlice";
import { setInactive } from "../../../redux/slices/sessionSlice";
import {
getElementByTestId,
getElementByText,
sendInputWithMockedResponse,
verifyNotPresentByTestId,
} from "../../../util/test/utils";
const EDIT_WORKSPACE_DIR = "file:///workspace";
const EDIT_FILEPATH = "test.txt";
const EDIT_FILE_URI = `${EDIT_WORKSPACE_DIR}/${EDIT_FILEPATH}`;
const EDIT_CHANGES = "New content";
const EDIT_TOOL_CALL_ID = "known-id";
const EDIT_MESSAGES: ChatMessage[] = [
{
role: "assistant",
content: "I'll edit the file for you.",
},
{
role: "assistant",
content: "",
toolCalls: [
{
id: EDIT_TOOL_CALL_ID,
function: {
name: BuiltInToolNames.EditExistingFile,
arguments: JSON.stringify({
filepath: EDIT_FILEPATH,
changes: EDIT_CHANGES,
}),
},
},
],
},
];
const POST_EDIT_RESPONSE = "Edit applied successfully";
beforeEach(async () => {
vi.clearAllMocks();
// Clear any persisted state to ensure test isolation
localStorage.clear();
sessionStorage.clear();
// Add a small delay to ensure cleanup is complete
await new Promise((resolve) => setTimeout(resolve, 50));
});
test("Edit run with no policy and yolo mode", { timeout: 15000 }, async () => {
// Additional cleanup before test starts
localStorage.clear();
sessionStorage.clear();
await new Promise((resolve) => setTimeout(resolve, 100));
// Setup
const { ideMessenger, store, user } = await renderWithProviders(<Chat />);
// Reset mocks to ensure clean state
ideMessenger.resetMocks();
// Reset streaming state to prevent test interference
store.dispatch(setInactive());
// Additional delay to ensure state is fully reset
await new Promise((resolve) => setTimeout(resolve, 100));
ideMessenger.responses["getWorkspaceDirs"] = [EDIT_WORKSPACE_DIR];
ideMessenger.responses["tools/evaluatePolicy"] = {
policy: "allowedWithoutPermission",
};
// Mock context/getSymbolsForFiles to prevent errors during streaming
ideMessenger.responses["context/getSymbolsForFiles"] = {};
const messengerPostSpy = vi.spyOn(ideMessenger, "post");
const messengerRequestSpy = vi.spyOn(ideMessenger, "request");
// Instead of using addAndSelectMockLlm (which relies on events that might be failing),
// directly dispatch the config update to set the selected model
const currentConfig = store.getState().config.config;
store.dispatch(
updateConfig({
...currentConfig,
selectedModelByRole: {
...currentConfig.selectedModelByRole,
chat: {
model: "mock",
provider: "mock",
title: "Mock LLM",
underlyingProviderName: "mock",
},
},
modelsByRole: {
...currentConfig.modelsByRole,
chat: [
...(currentConfig.modelsByRole.chat || []),
{
model: "mock",
provider: "mock",
title: "Mock LLM",
underlyingProviderName: "mock",
},
],
},
}),
);
// Enable automatic edit and yolo mode
store.dispatch(
setToolPolicy({
toolName: BuiltInToolNames.EditExistingFile,
policy: "allowedWithoutPermission",
}),
);
triggerConfigUpdate({
store,
ideMessenger,
editConfig: (current) => {
current.ui = {
...current.ui,
autoAcceptEditToolDiffs: true, // Enable auto-accept for edit tool diffs
};
return current;
},
});
expect(store.getState().config.config.ui?.autoAcceptEditToolDiffs).toBe(true);
// Send the input that will respond with an edit tool call
await sendInputWithMockedResponse(
ideMessenger,
"Edit this file",
EDIT_MESSAGES,
);
// Wait for streaming to complete and tool calls to be processed
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
});
// Toggle the codeblock and make sure the changes show
const toggleCodeblockChevron = await getElementByTestId("toggle-codeblock");
await user.click(toggleCodeblockChevron);
await getElementByText(EDIT_CHANGES);
// Make sure there's no pending tool call
await verifyNotPresentByTestId(
generateToolCallButtonTestId("accept", EDIT_TOOL_CALL_ID),
);
// Tool call, check that applyToFile was called for edit
await waitFor(() => {
expect(messengerRequestSpy).toHaveBeenCalledWith("applyToFile", {
streamId: expect.any(String),
filepath: EDIT_FILE_URI,
text: EDIT_CHANGES,
toolCallId: EDIT_TOOL_CALL_ID,
});
});
// Extract stream ID and initiate mock streaming
const streamId = messengerRequestSpy.mock.calls.find(
(call) => call[0] === "applyToFile",
)?.[1]?.streamId;
expect(streamId).toBeDefined();
ideMessenger.mockMessageToWebview("updateApplyState", {
status: "streaming",
streamId,
toolCallId: EDIT_TOOL_CALL_ID,
filepath: EDIT_FILE_URI,
});
// Mid stream, should show applying in notch
await getElementByTestId("notch-applying-text");
await getElementByTestId("notch-applying-cancel-button");
// Close the stream
ideMessenger.mockMessageToWebview("updateApplyState", {
status: "done",
streamId,
toolCallId: EDIT_TOOL_CALL_ID,
filepath: EDIT_FILE_URI,
});
// Set the chat response text before the auto-accept triggers
ideMessenger.setChatResponseText(POST_EDIT_RESPONSE);
await waitFor(() => {
expect(messengerPostSpy).toHaveBeenCalledWith("acceptDiff", {
streamId,
filepath: EDIT_FILE_URI,
});
});
// Close the stream, ensure response is shown and diff buttons are not present
ideMessenger.mockMessageToWebview("updateApplyState", {
status: "closed",
streamId,
toolCallId: EDIT_TOOL_CALL_ID,
filepath: EDIT_FILE_URI,
});
// Allow time for the auto-streaming to complete
await new Promise((resolve) => setTimeout(resolve, 1000));
await verifyNotPresentByTestId("edit-accept-button");
await verifyNotPresentByTestId("edit-reject-button");
// Try to manually trigger the streaming by checking if the response is set
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 500));
});
// TODO: Fix this test - the POST_EDIT_RESPONSE is not being displayed
// await waitFor(() => getElementByText(POST_EDIT_RESPONSE), {
// timeout: 8000,
// });
});

View file

@ -21,13 +21,9 @@ async function evaluateToolPolicy(
activeTools: Tool[],
toolCallState: ToolCallState,
toolPolicies: ToolPolicies,
autoAcceptEditToolDiffs: boolean | undefined,
): Promise<EvaluatedPolicy> {
// allow edit tool calls without permission if auto-accept is enabled
if (
isEditTool(toolCallState.toolCall.function.name) &&
autoAcceptEditToolDiffs
) {
// allow edit tool calls without permission
if (isEditTool(toolCallState.toolCall.function.name)) {
return { policy: "allowedWithoutPermission", toolCallState };
}
@ -81,7 +77,6 @@ export async function evaluateToolPolicies(
activeTools: Tool[],
generatedToolCalls: ToolCallState[],
toolPolicies: ToolPolicies,
autoAcceptEditToolDiffs: boolean | undefined,
): Promise<EvaluatedPolicy[]> {
// Check if ALL tool calls are auto-approved using dynamic evaluation
const policyResults = await Promise.all(
@ -91,7 +86,6 @@ export async function evaluateToolPolicies(
activeTools,
toolCallState,
toolPolicies,
autoAcceptEditToolDiffs,
),
),
);

View file

@ -161,61 +161,6 @@ describe("handleApplyStateUpdate", () => {
expect.objectContaining({ type: "session/updateApplyState" }),
);
});
it("should auto-accept diffs when configured and status is done", async () => {
mockGetState.mockReturnValue({
config: {
config: {
ui: {
autoAcceptEditToolDiffs: true,
},
},
},
session: { history: [] },
});
const applyState: ApplyState = {
streamId: "chat-stream",
toolCallId: "test-tool-call",
status: "done",
filepath: "test.txt",
numDiffs: 1,
};
const thunk = handleApplyStateUpdate(applyState);
await thunk(mockDispatch, mockGetState, mockExtra);
expect(mockExtra.ideMessenger.post).toHaveBeenCalledWith("acceptDiff", {
streamId: "chat-stream",
filepath: "test.txt",
});
});
it("should not auto-accept when config is disabled", async () => {
mockGetState.mockReturnValue({
config: {
config: {
ui: {
autoAcceptEditToolDiffs: false,
},
},
},
session: { history: [] },
});
const applyState: ApplyState = {
streamId: "chat-stream",
toolCallId: "test-tool-call",
status: "done",
filepath: "test.txt",
numDiffs: 1,
};
const thunk = handleApplyStateUpdate(applyState);
await thunk(mockDispatch, mockGetState, mockExtra);
expect(mockExtra.ideMessenger.post).not.toHaveBeenCalled();
});
});
describe("closed status handling", () => {

View file

@ -44,22 +44,24 @@ export const handleApplyStateUpdate = createAsyncThunk<
// Handle apply status updates - use toolCallId from event payload
if (applyState.toolCallId) {
const toolCallState = findToolCallById(
getState().session.history,
applyState.toolCallId,
);
if (
applyState.status === "done" &&
getState().config.config?.ui?.autoAcceptEditToolDiffs
toolCallState?.toolCall.function.name &&
getState().ui.toolSettings[toolCallState.toolCall.function.name] ===
"allowedWithoutPermission"
) {
extra.ideMessenger.post("acceptDiff", {
streamId: applyState.streamId,
filepath: applyState.filepath,
});
}
if (applyState.status === "closed") {
// Find the tool call to check if it was canceled
const toolCallState = findToolCallById(
getState().session.history,
applyState.toolCallId,
);
if (applyState.status === "closed") {
if (toolCallState) {
const accepted = toolCallState.status !== "canceled";

View file

@ -317,7 +317,6 @@ export const streamNormalInput = createAsyncThunk<
activeTools,
generatedCalls3,
toolPolicies,
state3.config.config.ui?.autoAcceptEditToolDiffs,
);
const anyRequireApproval = policies.find(
({ policy }) => policy === "allowedWithPermission",

View file

@ -49,4 +49,11 @@ export function setLocalStorage<T extends keyof LocalStorageTypes>(
value: LocalStorageTypes[T],
): void {
localStorage.setItem(key, JSON.stringify(value));
// Dispatch custom event to notify current tab listeners
window.dispatchEvent(
new CustomEvent("localStorageChange", {
detail: { key, value },
}),
);
}

View file

@ -1,2 +1,3 @@
export * from "./browser.js";
export * from "./registryClient.js";
export { parseAgentFileRules } from "./markdown/agentFiles.js";

View file

@ -9,7 +9,7 @@
"version": "0.0.7",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.14.0"
"@continuedev/config-yaml": "^1.26.0"
},
"devDependencies": {
"@types/jest": "^29.5.14",
@ -544,9 +544,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.14.0.tgz",
"integrity": "sha512-MRi2SKTLkXme/lyFZruXGhWsaH9eMHvgkj/gAQcAhe6LxvbEOt2SyG7IS/t/8fDRJ2pXIjK/FtJpdKarXokJpA==",
"version": "1.26.0",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.26.0.tgz",
"integrity": "sha512-v+JWNpB8ufsRcsmzsGolo+hqOpZNQQfqKXyY945XZDrctfpUdw1COBR9td2LTaAXhaqOPUqOWThanGV+lOy2Gw==",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",

View file

@ -12,7 +12,7 @@
"author": "Continue Dev, Inc.",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.14.0"
"@continuedev/config-yaml": "^1.26.0"
},
"devDependencies": {
"@types/jest": "^29.5.14",

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