Fix merge conflicts for guides - overview
This commit is contained in:
commit
06732643ee
414 changed files with 18874 additions and 9171 deletions
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Get file path from hook input
|
||||
FILE_PATH=$(cat | jq -r '.tool_input.file_path // .tool_input.edits[].file_path // empty' | head -n1)
|
||||
|
||||
# Function to run lint and typecheck
|
||||
run_checks() {
|
||||
local dir=$1
|
||||
cd "$dir"
|
||||
npm run lint >&2 && npm run tsc:check >&2
|
||||
}
|
||||
|
||||
# Run checks based on file location
|
||||
if [[ "$FILE_PATH" == *"/core/"* ]]; then
|
||||
run_checks core
|
||||
elif [[ "$FILE_PATH" == *"/gui/"* ]]; then
|
||||
run_checks gui
|
||||
elif [[ "$FILE_PATH" == *"/extensions/vscode/"* ]]; then
|
||||
run_checks extensions/vscode
|
||||
fi
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Write|Edit|MultiEdit",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/.claude/lint-check.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
5
.continue/rules/no-any-types.md
Normal file
5
.continue/rules/no-any-types.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
globs: "**/*.{ts,tsx}"
|
||||
---
|
||||
|
||||
Avoid using the `any` type wherever possible. Use unknown or find the correct type. The only acceptable place to use any is when typecasting for test mocks, and even then it's better to avoid and provide a proper mock.
|
||||
21
.github/actions/run-vscode-e2e-test/action.yml
vendored
21
.github/actions/run-vscode-e2e-test/action.yml
vendored
|
|
@ -1,25 +1,25 @@
|
|||
name: 'Run VS Code E2E Test'
|
||||
description: 'Run a single VS Code E2E test with all required setup'
|
||||
name: "Run VS Code E2E Test"
|
||||
description: "Run a single VS Code E2E test with all required setup"
|
||||
inputs:
|
||||
test_file:
|
||||
description: 'E2E test file to run'
|
||||
description: "E2E test file to run"
|
||||
required: true
|
||||
command:
|
||||
description: 'Command to run (e2e:ci:run or e2e:ci:run-yaml)'
|
||||
description: "Command to run (e2e:ci:run or e2e:ci:run-yaml)"
|
||||
required: true
|
||||
ssh_key:
|
||||
description: 'SSH private key for testing'
|
||||
description: "SSH private key for testing"
|
||||
required: false
|
||||
ssh_host:
|
||||
description: 'SSH host for testing'
|
||||
description: "SSH host for testing"
|
||||
required: false
|
||||
is_fork:
|
||||
description: 'Whether this is a fork (affects SSH tests)'
|
||||
description: "Whether this is a fork (affects SSH tests)"
|
||||
required: false
|
||||
default: 'false'
|
||||
default: "false"
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -58,6 +58,7 @@ runs:
|
|||
cd core
|
||||
npm ci
|
||||
cd ../extensions/vscode
|
||||
npm ci
|
||||
npm run e2e:ci:download
|
||||
else
|
||||
cd core
|
||||
|
|
@ -131,4 +132,4 @@ runs:
|
|||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: e2e-logs-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ inputs.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }}
|
||||
path: extensions/vscode/e2e.log
|
||||
path: extensions/vscode/e2e.log
|
||||
|
|
|
|||
170
.github/workflows/auto-fix-failed-tests.yml
vendored
Normal file
170
.github/workflows/auto-fix-failed-tests.yml
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
name: Auto Fix Failed Tests
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["PR Checks", "CLI PR Checks"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
fix-failed-tests:
|
||||
# Only run if the workflow failed
|
||||
# DISABLED: Remove 'false && ' on the next line to enable auto-fixing
|
||||
if: false && github.event.workflow_run.conclusion == 'failure'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Get workflow run details
|
||||
id: workflow-details
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const workflowRun = context.payload.workflow_run;
|
||||
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: workflowRun.id
|
||||
});
|
||||
|
||||
// Find all failed jobs since we're only monitoring specific test workflows
|
||||
const failedJobs = jobs.jobs.filter(job => job.conclusion === 'failure');
|
||||
|
||||
if (failedJobs.length === 0) {
|
||||
core.info('No failed jobs found');
|
||||
return null;
|
||||
}
|
||||
|
||||
core.setOutput('has_failed_tests', 'true');
|
||||
core.setOutput('workflow_name', workflowRun.name);
|
||||
core.setOutput('workflow_run_id', workflowRun.id);
|
||||
core.setOutput('head_branch', workflowRun.head_branch);
|
||||
core.setOutput('head_sha', workflowRun.head_sha);
|
||||
core.setOutput('failed_jobs', JSON.stringify(failedJobs.map(j => j.name)));
|
||||
|
||||
return failedJobs;
|
||||
|
||||
- name: Get job logs for failed tests
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
id: get-logs
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const workflowRunId = ${{ github.event.workflow_run.id }};
|
||||
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: workflowRunId
|
||||
});
|
||||
|
||||
let errorLogs = '';
|
||||
|
||||
for (const job of jobs.jobs) {
|
||||
if (job.conclusion === 'failure') {
|
||||
try {
|
||||
const { data: logData } = await github.rest.actions.downloadJobLogsForWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
job_id: job.id
|
||||
});
|
||||
|
||||
errorLogs += `\n\n=== Job: ${job.name} ===\n`;
|
||||
errorLogs += logData;
|
||||
} catch (error) {
|
||||
core.warning(`Could not fetch logs for job ${job.name}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store logs in environment file for next step
|
||||
const fs = require('fs');
|
||||
fs.writeFileSync('/tmp/test_failure_logs.txt', errorLogs);
|
||||
|
||||
core.setOutput('has_logs', errorLogs.length > 0 ? 'true' : 'false');
|
||||
|
||||
- name: Checkout repository
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
ref: ${{ steps.workflow-details.outputs.head_sha }}
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Install Continue CLI globally
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
run: npm i -g @continuedev/cli
|
||||
|
||||
- name: Start remote session to fix failed tests
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
id: remote-session
|
||||
env:
|
||||
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
|
||||
run: |
|
||||
# Create a detailed prompt for fixing the failed tests
|
||||
cat > /tmp/fix_tests_prompt.txt << 'PROMPT_EOF'
|
||||
🔧 **Auto Test Fix Request**
|
||||
|
||||
The following tests failed in workflow "${{ steps.workflow-details.outputs.workflow_name }}" (Run ID: ${{ steps.workflow-details.outputs.workflow_run_id }}):
|
||||
|
||||
**Failed Jobs:** ${{ steps.workflow-details.outputs.failed_jobs }}
|
||||
**Branch:** ${{ steps.workflow-details.outputs.head_branch }}
|
||||
**Commit:** ${{ steps.workflow-details.outputs.head_sha }}
|
||||
|
||||
**Your Task:**
|
||||
1. Analyze the test failure logs and error messages
|
||||
2. Identify the root cause of the test failures
|
||||
3. Fix the failing tests by updating the test code or the underlying implementation
|
||||
4. Ensure all tests pass after your changes
|
||||
5. Commit your fixes with a descriptive message
|
||||
|
||||
**Test Failure Context:**
|
||||
Please examine the repository structure, run the failing tests locally to understand the errors, and implement appropriate fixes.
|
||||
|
||||
Focus on:
|
||||
- Understanding what the tests are trying to validate
|
||||
- Identifying why they're failing (code changes, environment issues, test logic errors)
|
||||
- Making minimal, targeted fixes that address the root cause
|
||||
- Ensuring the fixes don't break other functionality
|
||||
|
||||
Please start by examining the failing tests and their error messages, then proceed with the necessary fixes.
|
||||
PROMPT_EOF
|
||||
|
||||
echo "Starting Continue CLI remote session for test fixes..."
|
||||
echo "Prompt content:"
|
||||
cat /tmp/fix_tests_prompt.txt
|
||||
|
||||
# Start remote session and capture JSON output
|
||||
SESSION_OUTPUT=$(cat /tmp/fix_tests_prompt.txt | cn remote -s --branch ${{ steps.workflow-details.outputs.head_branch }})
|
||||
echo "Raw session output: $SESSION_OUTPUT"
|
||||
|
||||
# Extract URL from JSON output
|
||||
SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
|
||||
|
||||
if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
|
||||
echo "Failed to extract session URL from output: $SESSION_OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
|
||||
echo "✅ Started remote session: $SESSION_URL"
|
||||
|
||||
- name: Log session details
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
run: |
|
||||
echo "✅ Successfully started auto-fix session for failed tests"
|
||||
echo "Workflow: ${{ steps.workflow-details.outputs.workflow_name }}"
|
||||
echo "Run ID: ${{ steps.workflow-details.outputs.workflow_run_id }}"
|
||||
echo "Branch: ${{ steps.workflow-details.outputs.head_branch }}"
|
||||
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
|
||||
echo "Failed jobs: ${{ steps.workflow-details.outputs.failed_jobs }}"
|
||||
2
.github/workflows/beta-release.yml
vendored
2
.github/workflows/beta-release.yml
vendored
|
|
@ -24,7 +24,7 @@ jobs:
|
|||
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
|
|
|||
5
.github/workflows/cli-pr-checks.yml
vendored
5
.github/workflows/cli-pr-checks.yml
vendored
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
cache: "npm"
|
||||
|
|
@ -59,6 +59,7 @@ jobs:
|
|||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [18, 20, 22, 24]
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
|
|
@ -66,7 +67,7 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
|
|
|||
4
.github/workflows/compliance.yaml
vendored
4
.github/workflows/compliance.yaml
vendored
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
|
||||
- name: Add PR title guidance comment
|
||||
if: always() && steps.pr-title-check.outputs.valid == 'false'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const { data: comments } = await github.rest.issues.listComments({
|
||||
|
|
@ -104,7 +104,7 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "npm"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Run Detailed PR Review
|
||||
uses: continuedev/continue/actions/detailed-review@80c679747b7c7b2624d15db31ff5bdadc9681c65
|
||||
uses: continuedev/continue/actions/detailed-review@5dc7a050db441934c26eb910b8433291f627db7f
|
||||
with:
|
||||
continue-api-key: ${{ secrets.CONTINUE_API_KEY }}
|
||||
continue-org: continuedev
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Run Continue PR Review Action
|
||||
uses: continuedev/continue/actions/general-review@80c679747b7c7b2624d15db31ff5bdadc9681c65
|
||||
uses: continuedev/continue/actions/general-review@5dc7a050db441934c26eb910b8433291f627db7f
|
||||
with:
|
||||
continue-api-key: ${{ secrets.CONTINUE_API_KEY }}
|
||||
continue-org: "continuedev"
|
||||
|
|
|
|||
4
.github/workflows/jetbrains-release.yaml
vendored
4
.github/workflows/jetbrains-release.yaml
vendored
|
|
@ -152,7 +152,7 @@ jobs:
|
|||
|
||||
# # Setup Node.js
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ jobs:
|
|||
|
||||
# 2. Install npm dependencies
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
2
.github/workflows/label-merged-prs.yml
vendored
2
.github/workflows/label-merged-prs.yml
vendored
|
|
@ -44,7 +44,7 @@ jobs:
|
|||
|
||||
- name: Determine and apply tier label
|
||||
if: steps.check-author.outputs.should_label == 'true'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const pr = context.payload.pull_request;
|
||||
|
|
|
|||
4
.github/workflows/main.yaml
vendored
4
.github/workflows/main.yaml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
- id: check
|
||||
working-directory: .
|
||||
run: |
|
||||
if [[ "${{ github.event.release.tag_name }}" == v1.0.*-vscode ]]; then
|
||||
if [[ "${{ github.event.release.tag_name }}" == v1.2.*-vscode ]]; then
|
||||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "should_run=false" >> $GITHUB_OUTPUT
|
||||
|
|
@ -70,7 +70,7 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
6
.github/workflows/pr-checks.yaml
vendored
6
.github/workflows/pr-checks.yaml
vendored
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ jobs:
|
|||
test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
|
|
|||
4
.github/workflows/preview.yaml
vendored
4
.github/workflows/preview.yaml
vendored
|
|
@ -70,7 +70,7 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ jobs:
|
|||
|
||||
# 4. Create PR with version bump
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
109
.github/workflows/respond-to-cubic.yaml
vendored
109
.github/workflows/respond-to-cubic.yaml
vendored
|
|
@ -21,7 +21,12 @@ jobs:
|
|||
- name: Check if comment contains @continuedev
|
||||
id: check-mention
|
||||
run: |
|
||||
if echo "${{ github.event.comment.body }}" | grep -q "@continuedev"; then
|
||||
# Create a temporary file to safely handle comment body with special characters
|
||||
cat > /tmp/comment.txt << 'COMMENT_EOF'
|
||||
${{ github.event.comment.body }}
|
||||
COMMENT_EOF
|
||||
|
||||
if grep -q "@continuedev" /tmp/comment.txt; then
|
||||
echo "contains_mention=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "contains_mention=false" >> $GITHUB_OUTPUT
|
||||
|
|
@ -29,7 +34,7 @@ jobs:
|
|||
|
||||
- name: Add eyes reaction to comment
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
await github.rest.reactions.createForIssueComment({
|
||||
|
|
@ -49,7 +54,7 @@ jobs:
|
|||
- name: Get PR information
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: pr-info
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const { data: pr } = await github.rest.pulls.get({
|
||||
|
|
@ -69,7 +74,7 @@ jobs:
|
|||
|
||||
- name: Setup Node.js
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
|
|
@ -83,15 +88,22 @@ jobs:
|
|||
env:
|
||||
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
|
||||
run: |
|
||||
# Create the prompt for remote session
|
||||
PROMPT="Please help with the following request from @${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}:
|
||||
# Create a temporary file for the prompt to handle special characters and newlines properly
|
||||
cat > /tmp/prompt.txt << 'PROMPT_EOF'
|
||||
Please help with the following request from @${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}:
|
||||
|
||||
${{ github.event.comment.body }}
|
||||
|
||||
Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch."
|
||||
Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch.
|
||||
PROMPT_EOF
|
||||
|
||||
# Debug output
|
||||
echo "PROMPT content:"
|
||||
cat /tmp/prompt.txt
|
||||
|
||||
# Start remote session and capture JSON output
|
||||
SESSION_OUTPUT=$(echo "$PROMPT" | cn remote -s --branch ${{ steps.pr-info.outputs.head_ref }})
|
||||
echo "Starting cn with prompt..."
|
||||
SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ steps.pr-info.outputs.head_ref }})
|
||||
echo "Raw session output: $SESSION_OUTPUT"
|
||||
|
||||
# Extract URL from JSON output
|
||||
|
|
@ -107,11 +119,14 @@ jobs:
|
|||
|
||||
- name: Comment with session URL
|
||||
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
env:
|
||||
ORIGINAL_COMMENT: ${{ github.event.comment.body }}
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request:
|
||||
> ${{ github.event.comment.body }}`;
|
||||
const sessionUrl = '${{ steps.remote-session.outputs.session_url }}';
|
||||
const originalComment = process.env.ORIGINAL_COMMENT;
|
||||
const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
|
|
@ -125,7 +140,8 @@ jobs:
|
|||
run: |
|
||||
echo "✅ Successfully started remote session for comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}"
|
||||
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
|
||||
echo "Original comment: ${{ github.event.comment.body }}"
|
||||
echo "Original comment:"
|
||||
cat /tmp/comment.txt
|
||||
|
||||
respond-to-review-comment:
|
||||
# Only run on pull request review comments
|
||||
|
|
@ -136,7 +152,12 @@ jobs:
|
|||
- name: Check if comment contains @continuedev
|
||||
id: check-mention
|
||||
run: |
|
||||
if echo "${{ github.event.comment.body }}" | grep -q "@continuedev"; then
|
||||
# Create a temporary file to safely handle comment body with special characters
|
||||
cat > /tmp/review_comment.txt << 'COMMENT_EOF'
|
||||
${{ github.event.comment.body }}
|
||||
COMMENT_EOF
|
||||
|
||||
if grep -q "@continuedev" /tmp/review_comment.txt; then
|
||||
echo "contains_mention=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "contains_mention=false" >> $GITHUB_OUTPUT
|
||||
|
|
@ -144,7 +165,7 @@ jobs:
|
|||
|
||||
- name: Add eyes reaction to comment
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
await github.rest.reactions.createForPullRequestReviewComment({
|
||||
|
|
@ -164,7 +185,7 @@ jobs:
|
|||
|
||||
- name: Setup Node.js
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
|
|
@ -172,21 +193,59 @@ jobs:
|
|||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
run: npm i -g @continuedev/cli
|
||||
|
||||
- name: Get review context
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: review-context
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
let reviewContext = '';
|
||||
|
||||
// Check if this comment is a reply to another review comment
|
||||
if (context.payload.comment.in_reply_to_id) {
|
||||
try {
|
||||
const { data: originalComment } = await github.rest.pulls.getReviewComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: context.payload.comment.in_reply_to_id
|
||||
});
|
||||
|
||||
reviewContext = `**Original review comment by @${originalComment.user.login}:**
|
||||
${originalComment.body}
|
||||
|
||||
**Reply by @${{ github.event.comment.user.login }}:**
|
||||
${{ github.event.comment.body }}`;
|
||||
} catch (error) {
|
||||
console.log('Could not fetch original comment, using current comment only');
|
||||
reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
|
||||
${{ github.event.comment.body }}`;
|
||||
}
|
||||
} else {
|
||||
reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
|
||||
${{ github.event.comment.body }}`;
|
||||
}
|
||||
|
||||
core.setOutput('context', reviewContext);
|
||||
|
||||
- name: Start remote session
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: remote-session
|
||||
env:
|
||||
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
|
||||
run: |
|
||||
# Debug: Echo the branch we're starting the session on
|
||||
echo "Starting remote session on branch: ${{ github.event.pull_request.head.ref }}"
|
||||
|
||||
# Create a temporary file for the prompt to handle special characters and newlines properly
|
||||
cat > /tmp/prompt.txt << 'PROMPT_EOF'
|
||||
Please help with the following code review comment from @${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}:
|
||||
Please help with the following code review discussion from PR #${{ github.event.pull_request.number }}:
|
||||
|
||||
**File:** ${{ github.event.comment.path }}
|
||||
**Line:** ${{ github.event.comment.line || github.event.comment.original_line || 'N/A' }}
|
||||
**Comment:** ${{ github.event.comment.body }}
|
||||
|
||||
Please analyze the specific file and line mentioned, understand the review feedback, implement the necessary changes, and commit them to this branch.
|
||||
${{ steps.review-context.outputs.context }}
|
||||
|
||||
Please analyze the specific file and line mentioned, understand the review feedback and any discussion context, implement the necessary changes, and commit them to this branch.
|
||||
PROMPT_EOF
|
||||
|
||||
# Debug output
|
||||
|
|
@ -195,7 +254,7 @@ jobs:
|
|||
|
||||
# Start remote session and capture JSON output
|
||||
echo "Starting cn with prompt..."
|
||||
SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --branch ${{ github.event.pull_request.head.ref }})
|
||||
SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ github.event.pull_request.head.ref }})
|
||||
echo "Raw session output: $SESSION_OUTPUT"
|
||||
|
||||
# Extract URL from JSON output
|
||||
|
|
@ -211,11 +270,14 @@ jobs:
|
|||
|
||||
- name: Comment with session URL
|
||||
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
env:
|
||||
ORIGINAL_COMMENT: ${{ github.event.comment.body }}
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request:
|
||||
> ${{ github.event.comment.body }}`;
|
||||
const sessionUrl = '${{ steps.remote-session.outputs.session_url }}';
|
||||
const originalComment = process.env.ORIGINAL_COMMENT;
|
||||
const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment;
|
||||
|
||||
const commentParams = {
|
||||
owner: context.repo.owner,
|
||||
|
|
@ -236,4 +298,5 @@ jobs:
|
|||
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
|
||||
echo "File: ${{ github.event.comment.path }}"
|
||||
echo "Line: ${{ github.event.comment.line }}"
|
||||
echo "Original comment: ${{ github.event.comment.body }}"
|
||||
echo "Original comment:"
|
||||
cat /tmp/review_comment.txt
|
||||
|
|
|
|||
2
.github/workflows/reusable-release.yml
vendored
2
.github/workflows/reusable-release.yml
vendored
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
uses: ./.github/actions/setup-packages
|
||||
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
6
.github/workflows/similar-issues.yml
vendored
6
.github/workflows/similar-issues.yml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
|||
path: deja-view
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ jobs:
|
|||
echo "confidence=$CONFIDENCE" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Comment with analysis
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
let comment = '';
|
||||
|
|
@ -307,7 +307,7 @@ jobs:
|
|||
|
||||
- name: Add labels
|
||||
if: github.event_name == 'issues'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const labels = [];
|
||||
|
|
|
|||
2
.github/workflows/stable-release.yml
vendored
2
.github/workflows/stable-release.yml
vendored
|
|
@ -40,7 +40,7 @@ jobs:
|
|||
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
|
|
|||
2
.github/workflows/stale-issue-helper.yaml
vendored
2
.github/workflows/stale-issue-helper.yaml
vendored
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
close-issue-message: "This issue was closed because it wasn't updated for 10 days after being marked stale. If it's still important, please reopen + comment and we'll gladly take another look!"
|
||||
stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue."
|
||||
|
|
|
|||
2
.github/workflows/vscode-version-bump.yml
vendored
2
.github/workflows/vscode-version-bump.yml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
gh auth login --with-token <<< "${{ github.token }}"
|
||||
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
|
@ -43,7 +43,8 @@
|
|||
"extensions/vscode/e2e/storage": true,
|
||||
"extensions/vscode/e2e/vsix": true,
|
||||
"extensions/.continue-debug": true,
|
||||
"extensions/cli/dist/**": true
|
||||
"extensions/cli/dist/**": true,
|
||||
"packages/config-yaml/dist/**": true
|
||||
// "sync/**": true
|
||||
},
|
||||
"editor.formatOnSave": true,
|
||||
|
|
|
|||
|
|
@ -176,9 +176,9 @@ See [`intellij/CONTRIBUTING.md`](./extensions/intellij/CONTRIBUTING.md) for the
|
|||
### Our Git Workflow
|
||||
|
||||
We keep a single permanent branch: `main`. When we are ready to create a "pre-release" version, we create a tag on the
|
||||
`main` branch titled `v1.1.x-vscode`, which automatically triggers the workflow
|
||||
`main` branch titled `v1.3.x-vscode`, which automatically triggers the workflow
|
||||
in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When
|
||||
a release has been sufficiently tested, we will create a new release titled `v1.0x-vscode`, triggering a similar
|
||||
a release has been sufficiently tested, we will create a new release titled `v1.2.x-vscode`, triggering a similar
|
||||
workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code
|
||||
extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question. This workflow
|
||||
is well explained by <http://releaseflow.org>.
|
||||
|
|
|
|||
|
|
@ -166,8 +166,13 @@ export const CODE_KEYWORDS_ENDING_IN_SEMICOLON = ["def"];
|
|||
export const CODE_STOP_BLOCK = "[/CODE]";
|
||||
export const BRACKET_ENDING_CHARS = [")", "]", "}", ";"];
|
||||
export const PREFIXES_TO_SKIP = ["<COMPLETION>"];
|
||||
export const LINES_TO_STOP_AT = ["# End of file.", "<STOP EDITING HERE"];
|
||||
export const LINES_TO_SKIP = ["</START EDITING HERE>"];
|
||||
export const LINES_TO_STOP_AT = [
|
||||
"# End of file.",
|
||||
"<STOP EDITING HERE",
|
||||
"<|/updated_code|>",
|
||||
"```",
|
||||
];
|
||||
export const LINES_TO_SKIP = ["</START EDITING HERE>", "<|updated_code|>"];
|
||||
export const LINES_TO_REMOVE_BEFORE_START = [
|
||||
"<COMPLETION>",
|
||||
"[CODE]",
|
||||
|
|
|
|||
15
core/commands/slash/ruleBlockSlashCommand.ts
Normal file
15
core/commands/slash/ruleBlockSlashCommand.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { RuleWithSource, SlashCommandWithSource } from "../..";
|
||||
|
||||
export function convertRuleBlockToSlashCommand(
|
||||
rule: RuleWithSource,
|
||||
): SlashCommandWithSource {
|
||||
return {
|
||||
name:
|
||||
rule.name ||
|
||||
(rule.rule.length > 20 ? rule.rule.substring(0, 20) + "..." : rule.rule),
|
||||
description: rule.description ?? "",
|
||||
prompt: rule.rule,
|
||||
source: "invokable-rule",
|
||||
promptFile: rule.ruleFile,
|
||||
};
|
||||
}
|
||||
93
core/commands/slash/ruleBlockSlashCommand.vitest.ts
Normal file
93
core/commands/slash/ruleBlockSlashCommand.vitest.ts
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { RuleWithSource } from "../..";
|
||||
import { convertRuleBlockToSlashCommand } from "./ruleBlockSlashCommand";
|
||||
|
||||
describe("convertRuleBlockToSlashCommand", () => {
|
||||
it("should convert a rule with all properties to a slash command", () => {
|
||||
const rule: RuleWithSource = {
|
||||
name: "Code Review",
|
||||
rule: "Review this code for best practices",
|
||||
description: "Performs a code review",
|
||||
source: "rules-block",
|
||||
ruleFile: "/path/to/rules.yaml",
|
||||
invokable: true,
|
||||
};
|
||||
|
||||
const result = convertRuleBlockToSlashCommand(rule);
|
||||
|
||||
expect(result).toEqual({
|
||||
name: "Code Review",
|
||||
description: "Performs a code review",
|
||||
prompt: "Review this code for best practices",
|
||||
source: "invokable-rule",
|
||||
promptFile: "/path/to/rules.yaml",
|
||||
});
|
||||
});
|
||||
|
||||
it("should handle a rule without name", () => {
|
||||
const rule: RuleWithSource = {
|
||||
rule: "Review this code",
|
||||
source: "rules-block",
|
||||
invokable: true,
|
||||
};
|
||||
|
||||
const result = convertRuleBlockToSlashCommand(rule);
|
||||
|
||||
expect(result.name).toBe("Review this code");
|
||||
expect(result.prompt).toBe("Review this code");
|
||||
});
|
||||
|
||||
it("should truncate long rule text when used as name", () => {
|
||||
const rule: RuleWithSource = {
|
||||
rule: "This is a very long rule text that should be truncated",
|
||||
source: "rules-block",
|
||||
invokable: true,
|
||||
};
|
||||
|
||||
const result = convertRuleBlockToSlashCommand(rule);
|
||||
|
||||
expect(result.name).toBe("This is a very long ...");
|
||||
expect(result.prompt).toBe(
|
||||
"This is a very long rule text that should be truncated",
|
||||
);
|
||||
});
|
||||
|
||||
it("should handle a rule without description", () => {
|
||||
const rule: RuleWithSource = {
|
||||
name: "Test Rule",
|
||||
rule: "Test rule content",
|
||||
source: "rules-block",
|
||||
invokable: true,
|
||||
};
|
||||
|
||||
const result = convertRuleBlockToSlashCommand(rule);
|
||||
|
||||
expect(result.description).toBe("");
|
||||
});
|
||||
|
||||
it("should use rule text as the prompt", () => {
|
||||
const rule: RuleWithSource = {
|
||||
name: "Explain Code",
|
||||
rule: "Explain what this code does in simple terms",
|
||||
source: "rules-block",
|
||||
invokable: true,
|
||||
};
|
||||
|
||||
const result = convertRuleBlockToSlashCommand(rule);
|
||||
|
||||
expect(result.prompt).toBe("Explain what this code does in simple terms");
|
||||
});
|
||||
|
||||
it("should always set source to 'invokable-rule'", () => {
|
||||
const rule: RuleWithSource = {
|
||||
name: "Test",
|
||||
rule: "Test",
|
||||
source: "default-chat",
|
||||
invokable: true,
|
||||
};
|
||||
|
||||
const result = convertRuleBlockToSlashCommand(rule);
|
||||
|
||||
expect(result.source).toBe("invokable-rule");
|
||||
});
|
||||
});
|
||||
|
|
@ -59,27 +59,17 @@ export class ConfigHandler {
|
|||
|
||||
constructor(
|
||||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private llmLogger: ILLMLogger,
|
||||
sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
|
||||
initialSessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
|
||||
this.controlPlaneClient = new ControlPlaneClient(
|
||||
sessionInfoPromise,
|
||||
ideSettingsPromise,
|
||||
this.ide.getIdeInfo(),
|
||||
initialSessionInfoPromise,
|
||||
this.ide,
|
||||
);
|
||||
|
||||
// This profile manager will always be available
|
||||
this.globalLocalProfileManager = new ProfileLifecycleManager(
|
||||
new LocalProfileLoader(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.llmLogger,
|
||||
),
|
||||
new LocalProfileLoader(ide, this.controlPlaneClient, this.llmLogger),
|
||||
this.ide,
|
||||
);
|
||||
|
||||
|
|
@ -97,6 +87,7 @@ export class ConfigHandler {
|
|||
}
|
||||
|
||||
private workspaceDirs: string[] | null = null;
|
||||
|
||||
async getWorkspaceId() {
|
||||
if (!this.workspaceDirs) {
|
||||
this.workspaceDirs = await this.ide.getWorkspaceDirs();
|
||||
|
|
@ -113,6 +104,13 @@ export class ConfigHandler {
|
|||
const signal = this.cascadeAbortController.signal;
|
||||
this.workspaceDirs = null; // forces workspace dirs reload
|
||||
|
||||
// Always update globalLocalProfileManager before recreating all the loaders
|
||||
// during every cascadeInit so it holds the most recent controlPlaneClient.
|
||||
this.globalLocalProfileManager = new ProfileLifecycleManager(
|
||||
new LocalProfileLoader(this.ide, this.controlPlaneClient, this.llmLogger),
|
||||
this.ide,
|
||||
);
|
||||
|
||||
try {
|
||||
const { orgs, errors } = await this.getOrgs();
|
||||
|
||||
|
|
@ -248,7 +246,6 @@ export class ConfigHandler {
|
|||
versionSlug: assistant.configResult.config?.version ?? "latest",
|
||||
controlPlaneClient: this.controlPlaneClient,
|
||||
ide: this.ide,
|
||||
ideSettingsPromise: this.ideSettingsPromise,
|
||||
llmLogger: this.llmLogger,
|
||||
rawYaml: assistant.rawYaml,
|
||||
orgScopeId: orgScopeId,
|
||||
|
|
@ -369,7 +366,6 @@ export class ConfigHandler {
|
|||
const profiles = [...assistantFiles, ...agentFiles].map((assistant) => {
|
||||
return new LocalProfileLoader(
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.llmLogger,
|
||||
assistant,
|
||||
|
|
@ -394,7 +390,6 @@ export class ConfigHandler {
|
|||
|
||||
// Ide settings change: refresh session and cascade refresh from the top
|
||||
async updateIdeSettings(ideSettings: IdeSettings) {
|
||||
this.ideSettingsPromise = Promise.resolve(ideSettings);
|
||||
this.abortCascade();
|
||||
await this.cascadeInit("IDE settings update");
|
||||
}
|
||||
|
|
@ -432,8 +427,7 @@ export class ConfigHandler {
|
|||
if (reload) {
|
||||
this.controlPlaneClient = new ControlPlaneClient(
|
||||
Promise.resolve(sessionInfo),
|
||||
this.ideSettingsPromise,
|
||||
this.ide.getIdeInfo(),
|
||||
this.ide,
|
||||
);
|
||||
this.abortCascade();
|
||||
await this.cascadeInit("Control plane session info update");
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
import { IDE } from "..";
|
||||
import { joinPathsToUri } from "../util/uri";
|
||||
|
||||
const DEFAULT_ASSISTANT_FILE = `# This is an example assistant configuration file
|
||||
# It is used to define custom AI assistants within Continue
|
||||
# Each assistant file can be accessed by selecting it from the assistant dropdown
|
||||
const DEFAULT_ASSISTANT_FILE = `# This is an example agent configuration file
|
||||
# It is used to define custom AI agents within Continue
|
||||
# Each agent file can be accessed by selecting it from the agent dropdown
|
||||
|
||||
# To learn more, see the full assistant reference: https://docs.continue.dev/reference
|
||||
# To learn more, see the full config.yaml reference: https://docs.continue.dev/reference
|
||||
|
||||
name: Example Assistant
|
||||
name: Example Agent
|
||||
version: 1.0.0
|
||||
schema: v1
|
||||
|
||||
# Models define which AI models this assistant can use
|
||||
# Models define which AI models this agent can use
|
||||
# https://docs.continue.dev/customization/models
|
||||
models:
|
||||
- name: my gpt-5
|
||||
provider: openai
|
||||
model: gpt-5
|
||||
apiKey: YOUR_API_KEY_HERE
|
||||
apiKey: YOUR_OPENAI_API_KEY_HERE
|
||||
- uses: ollama/qwen2.5-coder-7b
|
||||
- uses: anthropic/claude-4-sonnet
|
||||
with:
|
||||
ANTHROPIC_API_KEY: \${{ secrets.ANTHROPIC_API_KEY }}
|
||||
|
||||
# Context providers define what information the assistant can access
|
||||
context:
|
||||
- provider: code
|
||||
- provider: docs
|
||||
- provider: diff
|
||||
- provider: terminal
|
||||
- provider: problems
|
||||
- provider: folder
|
||||
- provider: codebase
|
||||
# MCP Servers the agent can use
|
||||
# https://docs.continue.dev/customization/mcp-tools
|
||||
mcpServers:
|
||||
- uses: anthropic/memory-mcp
|
||||
`;
|
||||
|
||||
export async function createNewAssistantFile(
|
||||
|
|
@ -42,7 +42,7 @@ export async function createNewAssistantFile(
|
|||
|
||||
const baseDirUri = joinPathsToUri(
|
||||
workspaceDirs[0],
|
||||
assistantPath ?? ".continue/assistants",
|
||||
assistantPath ?? ".continue/agents",
|
||||
);
|
||||
|
||||
// Find the first available filename
|
||||
|
|
@ -50,10 +50,7 @@ export async function createNewAssistantFile(
|
|||
let assistantFileUri: string;
|
||||
do {
|
||||
const suffix = counter === 0 ? "" : `-${counter}`;
|
||||
assistantFileUri = joinPathsToUri(
|
||||
baseDirUri,
|
||||
`new-assistant${suffix}.yaml`,
|
||||
);
|
||||
assistantFileUri = joinPathsToUri(baseDirUri, `new-agent${suffix}.yaml`);
|
||||
counter++;
|
||||
} while (await ide.fileExists(assistantFileUri));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ConfigResult, parseConfigYaml } from "@continuedev/config-yaml";
|
||||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
|
||||
import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
|
||||
import { getPrimaryConfigFilePath } from "../../util/paths.js";
|
||||
|
|
@ -15,7 +15,6 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
|
||||
constructor(
|
||||
private ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private controlPlaneClient: ControlPlaneClient,
|
||||
private llmLogger: ILLMLogger,
|
||||
private overrideAssistantFile?:
|
||||
|
|
@ -57,7 +56,6 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
const result = await doLoadConfig({
|
||||
ide: this.ide,
|
||||
ideSettingsPromise: this.ideSettingsPromise,
|
||||
controlPlaneClient: this.controlPlaneClient,
|
||||
llmLogger: this.llmLogger,
|
||||
profileId: this.description.id,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { AssistantUnrolled, ConfigResult } from "@continuedev/config-yaml";
|
|||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { getControlPlaneEnv } from "../../control-plane/env.js";
|
||||
import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
|
||||
import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
|
|
@ -28,7 +28,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
private readonly versionSlug: string;
|
||||
private readonly controlPlaneClient: ControlPlaneClient;
|
||||
private readonly ide: IDE;
|
||||
private ideSettingsPromise: Promise<IdeSettings>;
|
||||
private llmLogger: ILLMLogger;
|
||||
readonly description: ProfileDescription;
|
||||
private readonly orgScopeId: string | null;
|
||||
|
|
@ -41,7 +40,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug,
|
||||
controlPlaneClient,
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
description,
|
||||
orgScopeId,
|
||||
|
|
@ -53,7 +51,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug: string;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
ide: IDE;
|
||||
ideSettingsPromise: Promise<IdeSettings>;
|
||||
llmLogger: ILLMLogger;
|
||||
description: ProfileDescription;
|
||||
orgScopeId: string | null;
|
||||
|
|
@ -65,7 +62,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
this.versionSlug = versionSlug;
|
||||
this.controlPlaneClient = controlPlaneClient;
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.llmLogger = llmLogger;
|
||||
this.description = description;
|
||||
this.orgScopeId = orgScopeId;
|
||||
|
|
@ -79,7 +75,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug,
|
||||
controlPlaneClient,
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
rawYaml,
|
||||
orgScopeId,
|
||||
|
|
@ -91,12 +86,11 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug: string;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
ide: IDE;
|
||||
ideSettingsPromise: Promise<IdeSettings>;
|
||||
llmLogger: ILLMLogger;
|
||||
rawYaml: string;
|
||||
orgScopeId: string | null;
|
||||
}): Promise<PlatformProfileLoader> {
|
||||
const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise);
|
||||
const controlPlaneEnv = await getControlPlaneEnv(ide.getIdeSettings());
|
||||
|
||||
const description: ProfileDescription = {
|
||||
id: `${ownerSlug}/${packageSlug}`,
|
||||
|
|
@ -121,7 +115,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug,
|
||||
controlPlaneClient,
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
description,
|
||||
orgScopeId,
|
||||
|
|
@ -139,7 +132,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
|
||||
const results = await doLoadConfig({
|
||||
ide: this.ide,
|
||||
ideSettingsPromise: this.ideSettingsPromise,
|
||||
controlPlaneClient: this.controlPlaneClient,
|
||||
llmLogger: this.llmLogger,
|
||||
overrideConfigYaml: this.configResult.config,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import {
|
|||
import {
|
||||
ContinueConfig,
|
||||
IDE,
|
||||
IdeSettings,
|
||||
ILLMLogger,
|
||||
RuleWithSource,
|
||||
SerializedContinueConfig,
|
||||
|
|
@ -70,7 +69,6 @@ async function loadRules(ide: IDE) {
|
|||
}
|
||||
export default async function doLoadConfig(options: {
|
||||
ide: IDE;
|
||||
ideSettingsPromise: Promise<IdeSettings>;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
llmLogger: ILLMLogger;
|
||||
overrideConfigJson?: SerializedContinueConfig;
|
||||
|
|
@ -82,7 +80,6 @@ export default async function doLoadConfig(options: {
|
|||
}): Promise<ConfigResult<ContinueConfig>> {
|
||||
const {
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
controlPlaneClient,
|
||||
llmLogger,
|
||||
overrideConfigJson,
|
||||
|
|
@ -95,7 +92,7 @@ export default async function doLoadConfig(options: {
|
|||
|
||||
const ideInfo = await ide.getIdeInfo();
|
||||
const uniqueId = await ide.getUniqueId();
|
||||
const ideSettings = await ideSettingsPromise;
|
||||
const ideSettings = await ide.getIdeSettings();
|
||||
const workOsAccessToken = await controlPlaneClient.getAccessToken();
|
||||
const isSignedIn = await controlPlaneClient.isSignedIn();
|
||||
|
||||
|
|
@ -374,7 +371,7 @@ export default async function doLoadConfig(options: {
|
|||
const useOnPremProxy =
|
||||
controlPlane?.useContinueForTeamsProxy === false && controlPlane?.proxyUrl;
|
||||
|
||||
const env = await getControlPlaneEnv(ideSettingsPromise);
|
||||
const env = await getControlPlaneEnv(Promise.resolve(ideSettings));
|
||||
let controlPlaneProxyUrl: string = useOnPremProxy
|
||||
? controlPlane?.proxyUrl
|
||||
: env.DEFAULT_CONTROL_PLANE_PROXY_URL;
|
||||
|
|
|
|||
|
|
@ -1061,6 +1061,7 @@ declare global {
|
|||
filepath?: string;
|
||||
fileContent?: string;
|
||||
originalFileContent?: string;
|
||||
autoFormattingDiff?: string;
|
||||
}
|
||||
|
||||
export interface RangeInFileWithContents {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
|
|||
|
||||
import { convertPromptBlockToSlashCommand } from "../../commands/slash/promptBlockSlashCommand";
|
||||
import { slashCommandFromPromptFile } from "../../commands/slash/promptFileSlashCommand";
|
||||
import { convertRuleBlockToSlashCommand } from "../../commands/slash/ruleBlockSlashCommand";
|
||||
import { getControlPlaneEnvSync } from "../../control-plane/env";
|
||||
import { PolicySingleton } from "../../control-plane/PolicySingleton";
|
||||
import { getBaseToolDefinitions } from "../../tools";
|
||||
|
|
@ -208,7 +209,21 @@ async function configYamlToContinueConfig(options: {
|
|||
}
|
||||
|
||||
for (const rule of config.rules ?? []) {
|
||||
continueConfig.rules.push(convertYamlRuleToContinueRule(rule));
|
||||
const convertedRule = convertYamlRuleToContinueRule(rule);
|
||||
continueConfig.rules.push(convertedRule);
|
||||
|
||||
// Convert invokable rules to slash commands
|
||||
if (convertedRule.invokable) {
|
||||
try {
|
||||
const slashCommand = convertRuleBlockToSlashCommand(convertedRule);
|
||||
continueConfig.slashCommands?.push(slashCommand);
|
||||
} catch (e) {
|
||||
localErrors.push({
|
||||
message: `Error converting invokable rule ${convertedRule.name} to slash command: ${e instanceof Error ? e.message : e}`,
|
||||
fatal: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
continueConfig.data = config.data;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ export function convertYamlRuleToContinueRule(rule: Rule): RuleWithSource {
|
|||
rule: rule.rule,
|
||||
globs: rule.globs,
|
||||
name: rule.name,
|
||||
description: rule.description,
|
||||
ruleFile: rule.sourceFile,
|
||||
alwaysApply: rule.alwaysApply,
|
||||
invokable: rule.invokable,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class CodeContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Code",
|
||||
description: "Type to search",
|
||||
type: "submenu",
|
||||
dependsOnIndexing: true,
|
||||
dependsOnIndexing: ["chunk", "codeSnippets"],
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class CodebaseContextProvider extends BaseContextProvider {
|
|||
description: "Automatically find relevant files",
|
||||
type: "normal",
|
||||
renderInlineAs: "",
|
||||
dependsOnIndexing: true,
|
||||
dependsOnIndexing: ["embeddings", "fullTextSearch", "chunk"],
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class FolderContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Folder",
|
||||
description: "Type to search",
|
||||
type: "submenu",
|
||||
dependsOnIndexing: true,
|
||||
dependsOnIndexing: ["embeddings", "fullTextSearch", "chunk"],
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ async function getContextProviderExtras(
|
|||
): Promise<ContextProviderExtras> {
|
||||
setUpTestDir();
|
||||
const ide = new FileSystemIde(TEST_DIR);
|
||||
const ideSettingsPromise = ide.getIdeSettings();
|
||||
const llmLogger = new LLMLogger();
|
||||
const configHandler = new ConfigHandler(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
import fetch, { RequestInit, Response } from "node-fetch";
|
||||
|
||||
import { OrganizationDescription } from "../config/ProfileLifecycleManager.js";
|
||||
import { IdeInfo, IdeSettings, ModelDescription } from "../index.js";
|
||||
import { IDE, ModelDescription } from "../index.js";
|
||||
import { Logger } from "../util/Logger.js";
|
||||
|
||||
import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js";
|
||||
|
|
@ -44,8 +44,7 @@ export const TRIAL_PROXY_URL =
|
|||
export class ControlPlaneClient {
|
||||
constructor(
|
||||
readonly sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
|
||||
private readonly ideSettingsPromise: Promise<IdeSettings>,
|
||||
private readonly ideInfoPromise: Promise<IdeInfo>,
|
||||
private readonly ide: IDE,
|
||||
) {}
|
||||
|
||||
async resolveFQSNs(
|
||||
|
|
@ -90,9 +89,9 @@ export class ControlPlaneClient {
|
|||
throw new Error("No access token");
|
||||
}
|
||||
|
||||
const env = await getControlPlaneEnv(this.ideSettingsPromise);
|
||||
const env = await getControlPlaneEnv(this.ide.getIdeSettings());
|
||||
const url = new URL(path, env.CONTROL_PLANE_URL).toString();
|
||||
const ideInfo = await this.ideInfoPromise;
|
||||
const ideInfo = await this.ide.getIdeInfo();
|
||||
|
||||
const resp = await fetch(url, {
|
||||
...init,
|
||||
|
|
|
|||
32
core/core.ts
32
core/core.ts
|
|
@ -29,8 +29,9 @@ import { editConfigFile, migrateV1DevDataFiles } from "./util/paths";
|
|||
import { Telemetry } from "./util/posthog";
|
||||
import {
|
||||
isProcessBackgrounded,
|
||||
killTerminalProcess,
|
||||
markProcessAsBackgrounded,
|
||||
} from "./util/processTerminalBackgroundStates";
|
||||
} from "./util/processTerminalStates";
|
||||
import { getSymbolsForManyFiles } from "./util/treeSitter";
|
||||
import { TTS } from "./util/tts";
|
||||
|
||||
|
|
@ -138,7 +139,7 @@ export class Core {
|
|||
|
||||
const ideInfoPromise = messenger.request("getIdeInfo", undefined);
|
||||
const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
|
||||
const sessionInfoPromise = messenger.request(
|
||||
const initialSessionInfoPromise = messenger.request(
|
||||
"getControlPlaneSessionInfo",
|
||||
{
|
||||
silent: true,
|
||||
|
|
@ -148,9 +149,8 @@ export class Core {
|
|||
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettingsPromise,
|
||||
this.llmLogger,
|
||||
sessionInfoPromise,
|
||||
initialSessionInfoPromise,
|
||||
);
|
||||
|
||||
this.docsService = DocsService.createSingleton(
|
||||
|
|
@ -175,6 +175,13 @@ export class Core {
|
|||
}
|
||||
};
|
||||
|
||||
this.codeBaseIndexer = new CodebaseIndexer(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
this.globalContext.get("indexingPaused"),
|
||||
);
|
||||
|
||||
this.configHandler.onConfigUpdate((result) => {
|
||||
void (async () => {
|
||||
const serializedResult =
|
||||
|
|
@ -187,6 +194,12 @@ export class Core {
|
|||
selectedOrgId: this.configHandler.currentOrg?.id ?? null,
|
||||
});
|
||||
|
||||
if (await this.codeBaseIndexer.wasAnyOneIndexAdded()) {
|
||||
await this.codeBaseIndexer.refreshCodebaseIndex(
|
||||
await this.ide.getWorkspaceDirs(),
|
||||
);
|
||||
}
|
||||
|
||||
// update additional submenu context providers registered via VSCode API
|
||||
const additionalProviders =
|
||||
this.configHandler.getAdditionalSubmenuContextProviders();
|
||||
|
|
@ -198,13 +211,6 @@ export class Core {
|
|||
})();
|
||||
});
|
||||
|
||||
this.codeBaseIndexer = new CodebaseIndexer(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
this.globalContext.get("indexingPaused"),
|
||||
);
|
||||
|
||||
// Dev Data Logger
|
||||
const dataLogger = DataLogger.getInstance();
|
||||
dataLogger.core = this;
|
||||
|
|
@ -1057,6 +1063,10 @@ export class Core {
|
|||
},
|
||||
);
|
||||
|
||||
on("process/killTerminalProcess", async ({ data: { toolCallId } }) => {
|
||||
await killTerminalProcess(toolCallId);
|
||||
});
|
||||
|
||||
on("mdm/setLicenseKey", ({ data: { licenseKey } }) => {
|
||||
const isValid = setMdmLicenseKey(licenseKey);
|
||||
return isValid;
|
||||
|
|
|
|||
|
|
@ -108,23 +108,24 @@ export async function* streamDiffLines({
|
|||
|
||||
// Rules can be included with edit prompt
|
||||
// If any rules are present this will result in using chat instead of legacy completion
|
||||
const systemMessage = rulesToInclude
|
||||
? getSystemMessageWithRules({
|
||||
availableRules: rulesToInclude,
|
||||
userMessage:
|
||||
typeof prompt === "string"
|
||||
? ({
|
||||
role: "user",
|
||||
content: prompt,
|
||||
} as UserChatMessage)
|
||||
: (findLast(
|
||||
prompt,
|
||||
(msg) => msg.role === "user" || msg.role === "tool",
|
||||
) as UserChatMessage | ToolResultChatMessage | undefined),
|
||||
baseSystemMessage: undefined,
|
||||
contextItems: [],
|
||||
}).systemMessage
|
||||
: undefined;
|
||||
const systemMessage =
|
||||
rulesToInclude || llm.baseChatSystemMessage
|
||||
? getSystemMessageWithRules({
|
||||
availableRules: rulesToInclude ?? [],
|
||||
userMessage:
|
||||
typeof prompt === "string"
|
||||
? ({
|
||||
role: "user",
|
||||
content: prompt,
|
||||
} as UserChatMessage)
|
||||
: (findLast(
|
||||
prompt,
|
||||
(msg) => msg.role === "user" || msg.role === "tool",
|
||||
) as UserChatMessage | ToolResultChatMessage | undefined),
|
||||
baseSystemMessage: llm.baseChatSystemMessage,
|
||||
contextItems: [],
|
||||
}).systemMessage
|
||||
: undefined;
|
||||
|
||||
if (systemMessage) {
|
||||
if (typeof prompt === "string") {
|
||||
|
|
|
|||
14
core/index.d.ts
vendored
14
core/index.d.ts
vendored
|
|
@ -173,6 +173,11 @@ export interface ModelInstaller {
|
|||
}
|
||||
|
||||
export type ContextProviderType = "normal" | "query" | "submenu";
|
||||
export type ContextIndexingType =
|
||||
| "chunk"
|
||||
| "embeddings"
|
||||
| "fullTextSearch"
|
||||
| "codeSnippets";
|
||||
|
||||
export interface ContextProviderDescription {
|
||||
title: ContextProviderName;
|
||||
|
|
@ -180,7 +185,7 @@ export interface ContextProviderDescription {
|
|||
description: string;
|
||||
renderInlineAs?: string;
|
||||
type: ContextProviderType;
|
||||
dependsOnIndexing?: boolean;
|
||||
dependsOnIndexing?: ContextIndexingType[];
|
||||
}
|
||||
|
||||
export type FetchFunction = (url: string | URL, init?: any) => Promise<any>;
|
||||
|
|
@ -1070,11 +1075,6 @@ export interface ToolExtras {
|
|||
codeBaseIndexer?: CodebaseIndexer;
|
||||
}
|
||||
|
||||
export type ToolPolicy =
|
||||
| "allowedWithPermission"
|
||||
| "allowedWithoutPermission"
|
||||
| "disabled";
|
||||
|
||||
export interface Tool {
|
||||
type: "function";
|
||||
function: {
|
||||
|
|
@ -1387,6 +1387,7 @@ export interface ApplyState {
|
|||
fileContent?: string;
|
||||
originalFileContent?: string;
|
||||
toolCallId?: string;
|
||||
autoFormattingDiff?: string;
|
||||
}
|
||||
|
||||
export interface StreamDiffLinesPayload {
|
||||
|
|
@ -1807,6 +1808,7 @@ export interface RuleWithSource {
|
|||
description?: string;
|
||||
ruleFile?: string;
|
||||
alwaysApply?: boolean;
|
||||
invokable?: boolean;
|
||||
}
|
||||
export interface CompleteOnboardingPayload {
|
||||
mode: OnboardingModes;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import CodebaseContextProvider from "../context/providers/CodebaseContextProvide
|
|||
import { ContinueConfig } from "../index.js";
|
||||
import { localPathToUri } from "../util/pathToUri.js";
|
||||
import { CodebaseIndexer } from "./CodebaseIndexer.js";
|
||||
import { FullTextSearchCodebaseIndex } from "./FullTextSearchCodebaseIndex.js";
|
||||
import { getComputeDeleteAddRemove } from "./refreshIndex.js";
|
||||
import { TestCodebaseIndex } from "./TestCodebaseIndex.js";
|
||||
import { CodebaseIndex } from "./types.js";
|
||||
|
|
@ -675,5 +676,154 @@ describe("CodebaseIndexer", () => {
|
|||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getIndexesToBuild", () => {
|
||||
let indexer: CodebaseIndexer;
|
||||
let mockConfig: any;
|
||||
let mockEmbeddingsModel: any;
|
||||
let mockIdeSettings: any;
|
||||
|
||||
beforeEach(async () => {
|
||||
indexer = new CodebaseIndexer(
|
||||
testConfigHandler,
|
||||
testIde,
|
||||
mockMessenger as any,
|
||||
false,
|
||||
);
|
||||
|
||||
mockEmbeddingsModel = {
|
||||
maxEmbeddingChunkSize: 1000,
|
||||
model: "test-model",
|
||||
provider: "test-provider",
|
||||
};
|
||||
|
||||
mockIdeSettings = {
|
||||
remoteConfigServerUrl: "http://test.com",
|
||||
userToken: "test-token",
|
||||
};
|
||||
|
||||
mockConfig = {
|
||||
selectedModelByRole: {
|
||||
embed: mockEmbeddingsModel,
|
||||
},
|
||||
contextProviders: [],
|
||||
};
|
||||
|
||||
jest
|
||||
.spyOn(testIde, "getIdeSettings")
|
||||
.mockResolvedValue(mockIdeSettings);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test("should create specific indexTypes for the requested context providers", async () => {
|
||||
mockConfig.contextProviders = [
|
||||
{
|
||||
description: {
|
||||
dependsOnIndexing: ["chunk", "codeSnippets"],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
jest.spyOn(testConfigHandler, "loadConfig").mockResolvedValue({
|
||||
config: mockConfig,
|
||||
errors: [],
|
||||
configLoadInterrupted: false,
|
||||
});
|
||||
|
||||
const indexes = (await (
|
||||
indexer as any
|
||||
).getIndexesToBuild()) as CodebaseIndex[];
|
||||
|
||||
expect(indexes).toHaveLength(2);
|
||||
expect(indexes[0].artifactId).toBe("chunks");
|
||||
expect(indexes[1].artifactId).toBe("codeSnippets");
|
||||
});
|
||||
|
||||
test("should handle duplicate contexts", async () => {
|
||||
mockConfig.contextProviders = [
|
||||
{
|
||||
description: {
|
||||
dependsOnIndexing: ["codeSnippets"],
|
||||
},
|
||||
},
|
||||
{
|
||||
description: {
|
||||
dependsOnIndexing: ["codeSnippets"],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
jest.spyOn(testConfigHandler, "loadConfig").mockResolvedValue({
|
||||
config: mockConfig,
|
||||
errors: [],
|
||||
configLoadInterrupted: false,
|
||||
});
|
||||
|
||||
const indexes = await (indexer as any).getIndexesToBuild();
|
||||
|
||||
expect(indexes).toHaveLength(1);
|
||||
expect(indexes[0].artifactId).toBe("codeSnippets");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("wasAnyOneIndexAdded", () => {
|
||||
let testIndexer: TestCodebaseIndexer;
|
||||
let mockGetIndexesToBuild: jest.MockedFunction<any>;
|
||||
|
||||
beforeEach(() => {
|
||||
testIndexer = new TestCodebaseIndexer(
|
||||
testConfigHandler,
|
||||
testIde,
|
||||
mockMessenger as any,
|
||||
false,
|
||||
);
|
||||
|
||||
// Mock getIndexesToBuild to control what indexes should be built
|
||||
mockGetIndexesToBuild = jest
|
||||
.spyOn(testIndexer as any, "getIndexesToBuild")
|
||||
.mockResolvedValue([]);
|
||||
|
||||
jest
|
||||
.spyOn(testIndexer, "refreshCodebaseIndex")
|
||||
.mockImplementation(async () => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test("should return true when indexes to build differ from built indexes", async () => {
|
||||
const mockIndex1 = new TestCodebaseIndex();
|
||||
const mockIndex2 = new FullTextSearchCodebaseIndex();
|
||||
mockGetIndexesToBuild.mockResolvedValue([mockIndex1]);
|
||||
(testIndexer as any).builtIndexes = [mockIndex2];
|
||||
|
||||
const result = await testIndexer.wasAnyOneIndexAdded();
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
test("should return true when there are more indexes to build than built indexes", async () => {
|
||||
const mockIndex1 = new TestCodebaseIndex();
|
||||
const mockIndex2 = new FullTextSearchCodebaseIndex();
|
||||
mockGetIndexesToBuild.mockResolvedValue([mockIndex1, mockIndex2]);
|
||||
(testIndexer as any).builtIndexes = [mockIndex1];
|
||||
|
||||
const result = await testIndexer.wasAnyOneIndexAdded();
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
test("should return false when there are fewer indexes to build than built indexes", async () => {
|
||||
const mockIndex1 = new TestCodebaseIndex();
|
||||
const mockIndex2 = new FullTextSearchCodebaseIndex();
|
||||
mockGetIndexesToBuild.mockResolvedValue([mockIndex1]);
|
||||
(testIndexer as any).builtIndexes = [mockIndex1, mockIndex2];
|
||||
|
||||
const result = await testIndexer.wasAnyOneIndexAdded();
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import * as fs from "fs/promises";
|
|||
|
||||
import { ConfigHandler } from "../config/ConfigHandler.js";
|
||||
import {
|
||||
ContextIndexingType,
|
||||
ContinueConfig,
|
||||
IDE,
|
||||
IndexingProgressUpdate,
|
||||
|
|
@ -58,6 +59,7 @@ export class CodebaseIndexer {
|
|||
private indexingCancellationController: AbortController;
|
||||
private codebaseIndexingState: IndexingProgressUpdate;
|
||||
private readonly pauseToken: PauseToken;
|
||||
private builtIndexes: CodebaseIndex[] = [];
|
||||
|
||||
private getUserFriendlyIndexName(artifactId: string): string {
|
||||
if (artifactId === FullTextSearchCodebaseIndex.artifactId)
|
||||
|
|
@ -166,28 +168,46 @@ export class CodebaseIndexer {
|
|||
return [];
|
||||
}
|
||||
|
||||
const indexes: CodebaseIndex[] = [
|
||||
new ChunkCodebaseIndex(
|
||||
this.ide.readFile.bind(this.ide),
|
||||
continueServerClient,
|
||||
embeddingsModel.maxEmbeddingChunkSize,
|
||||
), // Chunking must come first
|
||||
];
|
||||
|
||||
const lanceDbIndex = await LanceDbIndex.create(
|
||||
embeddingsModel,
|
||||
this.ide.readFile.bind(this.ide),
|
||||
const indexTypesToBuild = new Set( // use set to remove duplicates
|
||||
config.contextProviders
|
||||
.map((provider) => provider.description.dependsOnIndexing)
|
||||
.filter((indexType) => Array.isArray(indexType)) // remove undefined indexTypes
|
||||
.flat(),
|
||||
);
|
||||
|
||||
if (lanceDbIndex) {
|
||||
indexes.push(lanceDbIndex);
|
||||
const indexTypeToIndexerMapping: Record<
|
||||
ContextIndexingType,
|
||||
() => Promise<CodebaseIndex | null>
|
||||
> = {
|
||||
chunk: async () =>
|
||||
new ChunkCodebaseIndex(
|
||||
this.ide.readFile.bind(this.ide),
|
||||
continueServerClient,
|
||||
embeddingsModel.maxEmbeddingChunkSize,
|
||||
),
|
||||
codeSnippets: async () => new CodeSnippetsCodebaseIndex(this.ide),
|
||||
fullTextSearch: async () => new FullTextSearchCodebaseIndex(),
|
||||
embeddings: async () => {
|
||||
const lanceDbIndex = await LanceDbIndex.create(
|
||||
embeddingsModel,
|
||||
this.ide.readFile.bind(this.ide),
|
||||
);
|
||||
return lanceDbIndex;
|
||||
},
|
||||
};
|
||||
|
||||
const indexes: CodebaseIndex[] = [];
|
||||
// not parallelizing to avoid race conditions in sqlite
|
||||
for (const indexType of indexTypesToBuild) {
|
||||
if (indexType && indexType in indexTypeToIndexerMapping) {
|
||||
const index = await indexTypeToIndexerMapping[indexType]();
|
||||
if (index) {
|
||||
indexes.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
indexes.push(
|
||||
new FullTextSearchCodebaseIndex(),
|
||||
new CodeSnippetsCodebaseIndex(this.ide),
|
||||
);
|
||||
|
||||
this.builtIndexes = indexes;
|
||||
return indexes;
|
||||
}
|
||||
|
||||
|
|
@ -694,6 +714,15 @@ export class CodebaseIndexer {
|
|||
}
|
||||
}
|
||||
|
||||
public async wasAnyOneIndexAdded() {
|
||||
const indexes = await this.getIndexesToBuild();
|
||||
return !indexes.every((index) =>
|
||||
this.builtIndexes.some(
|
||||
(builtIndex) => builtIndex.artifactId === index.artifactId,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public async refreshCodebaseIndex(paths: string[]) {
|
||||
if (!this.indexingCancellationController.signal.aborted) {
|
||||
this.indexingCancellationController.abort();
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ export default class DocsService {
|
|||
id: doc.startUrl,
|
||||
isReindexing: false,
|
||||
title: doc.title,
|
||||
debugInfo: `max depth: ${doc.maxDepth}`,
|
||||
debugInfo: `max depth: ${doc.maxDepth ?? "unlimited"}`,
|
||||
icon: doc.faviconUrl,
|
||||
url: doc.startUrl,
|
||||
};
|
||||
|
|
@ -468,7 +468,7 @@ export default class DocsService {
|
|||
embeddingsProviderId: provider.embeddingId,
|
||||
isReindexing: forceReindex && indexExists,
|
||||
title: siteIndexingConfig.title,
|
||||
debugInfo: `max depth: ${siteIndexingConfig.maxDepth}`,
|
||||
debugInfo: `max depth: ${siteIndexingConfig.maxDepth ?? "unlimited"}`,
|
||||
icon: siteIndexingConfig.faviconUrl,
|
||||
url: siteIndexingConfig.startUrl,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import { ChatMessage, ModelCapability, TemplateType } from "../index.js";
|
||||
import {
|
||||
ChatMessage,
|
||||
ModelCapability,
|
||||
ModelDescription,
|
||||
TemplateType,
|
||||
} from "../index.js";
|
||||
import { NEXT_EDIT_MODELS } from "./constants.js";
|
||||
|
||||
import {
|
||||
|
|
@ -126,6 +131,26 @@ function modelSupportsImages(
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
function modelSupportsReasoning(
|
||||
model: ModelDescription | null | undefined,
|
||||
): boolean {
|
||||
if (!model) {
|
||||
return false;
|
||||
}
|
||||
if ("anthropic" === model.underlyingProviderName) {
|
||||
return true;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
const PARALLEL_PROVIDERS: string[] = [
|
||||
"anthropic",
|
||||
"bedrock",
|
||||
|
|
@ -421,4 +446,5 @@ export {
|
|||
llmCanGenerateInParallel,
|
||||
modelSupportsImages,
|
||||
modelSupportsNextEdit,
|
||||
modelSupportsReasoning,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -370,8 +370,17 @@ export abstract class BaseLLM implements ILLM {
|
|||
},
|
||||
});
|
||||
|
||||
if (error !== undefined) {
|
||||
if (error === "cancel" || error.name === "AbortError") {
|
||||
if (typeof error === "undefined") {
|
||||
interaction?.logItem({
|
||||
kind: "success",
|
||||
promptTokens,
|
||||
generatedTokens,
|
||||
thinkingTokens,
|
||||
usage,
|
||||
});
|
||||
return "success";
|
||||
} else {
|
||||
if (error === "cancel" || error?.name?.includes("AbortError")) {
|
||||
interaction?.logItem({
|
||||
kind: "cancel",
|
||||
promptTokens,
|
||||
|
|
@ -393,15 +402,6 @@ export abstract class BaseLLM implements ILLM {
|
|||
});
|
||||
return "error";
|
||||
}
|
||||
} else {
|
||||
interaction?.logItem({
|
||||
kind: "success",
|
||||
promptTokens,
|
||||
generatedTokens,
|
||||
thinkingTokens,
|
||||
usage,
|
||||
});
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -615,6 +615,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
kind: "chunk",
|
||||
chunk: formattedContent,
|
||||
});
|
||||
|
||||
completion += formattedContent;
|
||||
yield content;
|
||||
}
|
||||
|
|
@ -630,6 +631,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
kind: "chunk",
|
||||
chunk,
|
||||
});
|
||||
|
||||
completion += chunk;
|
||||
yield chunk;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ describe("Bedrock", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("should add cache points for prompt caching when needed", () => {
|
||||
it("should add cache points when cacheBehavior.cacheConversation is enabled", () => {
|
||||
// Create a test instance with caching behavior enabled
|
||||
const bedrockWithCaching = new TestBedrock({
|
||||
apiKey: "test-key",
|
||||
|
|
@ -576,5 +576,95 @@ describe("Bedrock", () => {
|
|||
const userMessageText = converted[0].content?.[0].text;
|
||||
expect(userMessageText).toMatch(/First message.+/);
|
||||
});
|
||||
|
||||
it("should add cache points when completionOptions.promptCaching is enabled", () => {
|
||||
// Create a test instance with prompt caching enabled via completionOptions
|
||||
const bedrockWithPromptCaching = new TestBedrock({
|
||||
apiKey: "test-key",
|
||||
model: "anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
region: "us-east-1",
|
||||
});
|
||||
|
||||
// Set completionOptions.promptCaching (without cacheBehavior)
|
||||
bedrockWithPromptCaching.completionOptions = {
|
||||
...bedrockWithPromptCaching.completionOptions,
|
||||
promptCaching: true,
|
||||
};
|
||||
|
||||
const messages: ChatMessage[] = [
|
||||
{ role: "user", content: "First message" } as UserChatMessage,
|
||||
{ role: "assistant", content: "First response" },
|
||||
{ role: "user", content: "Second message" } as UserChatMessage,
|
||||
];
|
||||
|
||||
const availableTools = new Set<string>();
|
||||
const converted = bedrockWithPromptCaching["_convertMessages"](
|
||||
messages,
|
||||
availableTools,
|
||||
);
|
||||
|
||||
// The last two user messages should have cache points
|
||||
expect(converted.length).toBe(3);
|
||||
expect(converted[0].role).toBe("user");
|
||||
expect(converted[0].content?.some((block) => block.cachePoint)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(converted[1].role).toBe("assistant");
|
||||
expect(converted[2].role).toBe("user");
|
||||
expect(converted[2].content?.some((block) => block.cachePoint)).toBe(
|
||||
true,
|
||||
);
|
||||
|
||||
// Verify that text content includes a cache ID suffix
|
||||
const userMessageText = converted[0].content?.[0].text;
|
||||
expect(userMessageText).toMatch(/First message.+/);
|
||||
});
|
||||
|
||||
it("should not add cache points when both caching options are disabled", () => {
|
||||
// Create a test instance with no caching enabled
|
||||
const bedrockNoCaching = new TestBedrock({
|
||||
apiKey: "test-key",
|
||||
model: "anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
region: "us-east-1",
|
||||
});
|
||||
|
||||
// Explicitly set no caching
|
||||
bedrockNoCaching.cacheBehavior = {
|
||||
cacheConversation: false,
|
||||
cacheSystemMessage: false,
|
||||
};
|
||||
bedrockNoCaching.completionOptions = {
|
||||
...bedrockNoCaching.completionOptions,
|
||||
promptCaching: false,
|
||||
};
|
||||
|
||||
const messages: ChatMessage[] = [
|
||||
{ role: "user", content: "First message" } as UserChatMessage,
|
||||
{ role: "assistant", content: "First response" },
|
||||
{ role: "user", content: "Second message" } as UserChatMessage,
|
||||
];
|
||||
|
||||
const availableTools = new Set<string>();
|
||||
const converted = bedrockNoCaching["_convertMessages"](
|
||||
messages,
|
||||
availableTools,
|
||||
);
|
||||
|
||||
// No cache points should be added
|
||||
expect(converted.length).toBe(3);
|
||||
expect(converted[0].role).toBe("user");
|
||||
expect(converted[0].content?.some((block) => block.cachePoint)).toBe(
|
||||
false,
|
||||
);
|
||||
expect(converted[1].role).toBe("assistant");
|
||||
expect(converted[2].role).toBe("user");
|
||||
expect(converted[2].content?.some((block) => block.cachePoint)).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
// Verify that text content doesn't include a cache ID suffix
|
||||
const userMessageText = converted[0].content?.[0].text;
|
||||
expect(userMessageText).toBe("First message");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -513,7 +513,10 @@ class Bedrock extends BaseLLM {
|
|||
// The second-to-last because it retrieves potentially already cached contents,
|
||||
// The last one because we want it cached for later retrieval.
|
||||
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
|
||||
if (this.cacheBehavior?.cacheConversation) {
|
||||
if (
|
||||
this.cacheBehavior?.cacheConversation ||
|
||||
this.completionOptions.promptCaching
|
||||
) {
|
||||
this._addCachingToLastTwoUserMessages(converted);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ interface OllamaChatOptions extends OllamaBaseOptions {
|
|||
tools?: OllamaTool[]; // the tools of the chat, this can be used to keep a tool memory
|
||||
// Not supported yet - tools: tools for the model to use if supported. Requires stream to be set to false
|
||||
// And correspondingly, tool calls in OllamaChatMessage
|
||||
think?: boolean; // if true the model will be prompted to think about the response before generating it
|
||||
}
|
||||
|
||||
type OllamaBaseResponse = {
|
||||
|
|
@ -146,11 +147,10 @@ class Ollama extends BaseLLM implements ModelInstaller {
|
|||
private static modelsBeingInstalledMutex = new Mutex();
|
||||
|
||||
private fimSupported: boolean = false;
|
||||
|
||||
constructor(options: LLMOptions) {
|
||||
super(options);
|
||||
|
||||
if (options.isFromAutoDetect) {
|
||||
if (options.model === "AUTODETECT") {
|
||||
return;
|
||||
}
|
||||
const headers: Record<string, string> = {
|
||||
|
|
@ -393,6 +393,7 @@ class Ollama extends BaseLLM implements ModelInstaller {
|
|||
model: this._getModel(),
|
||||
messages: ollamaMessages,
|
||||
options: this._getModelFileParams(options),
|
||||
think: options.reasoning,
|
||||
keep_alive: options.keepAlive ?? 60 * 30, // 30 minutes
|
||||
stream: options.stream,
|
||||
// format: options.format, // Not currently in base completion options
|
||||
|
|
|
|||
|
|
@ -7,16 +7,23 @@ class Scaleway extends OpenAI {
|
|||
static providerName = "scaleway";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://api.scaleway.ai/v1/",
|
||||
model: "qwen2.5-coder-32b-instruct",
|
||||
model: "qwen3-coder-30b-a3b-instruct",
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
private static MODEL_IDS: { [name: string]: string } = {
|
||||
"llama3.1-8b": "llama-3.1-8b-instruct",
|
||||
"llama3.3-70b": "llama-3.3-70b-instruct",
|
||||
"pixtral-12b": "pixtral-12b-2409",
|
||||
"mistral-small3.1": "mistral-small-3.1-24b-instruct-2503",
|
||||
"mistral-small3.2": "mistral-small-3.2-24b-instruct-2506",
|
||||
"devstral-small": "devstral-small-2505",
|
||||
"deepseek-r1-distill-llama-70b": "deepseek-r1-distill-llama-70b",
|
||||
"qwen2.5-coder-32b": "qwen2.5-coder-32b-instruct",
|
||||
"qwen3-coder-30b-a3b": "qwen3-coder-30b-a3b-instruct",
|
||||
"qwen3-235b-a22b": "qwen3-235b-a22b-instruct-2507",
|
||||
"gemma-3-27b": "gemma-3-27b-it",
|
||||
"gpt-oss-120b": "gpt-oss-120b",
|
||||
};
|
||||
|
||||
protected _convertModelName(model: string) {
|
||||
|
|
|
|||
56
core/package-lock.json
generated
56
core/package-lock.json
generated
|
|
@ -17,6 +17,7 @@
|
|||
"@continuedev/fetch": "file:../packages/fetch",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
@ -238,6 +239,20 @@
|
|||
"vitest": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"../packages/terminal-security": {
|
||||
"name": "@continuedev/terminal-security",
|
||||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"shell-quote": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.19",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"typescript": "^5.5.2",
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@75lb/deep-merge": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz",
|
||||
|
|
@ -2957,6 +2972,10 @@
|
|||
"resolved": "../packages/openai-adapters",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@continuedev/terminal-security": {
|
||||
"resolved": "../packages/terminal-security",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@dabh/diagnostics": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz",
|
||||
|
|
@ -7884,13 +7903,13 @@
|
|||
"integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
|
||||
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.0.tgz",
|
||||
"integrity": "sha512-oXTDccv8PcfjZmPGlWsPSwtOJCZ/b6W5jAMCNcfwJbCzDckwG0jrYJFaWH1yvivfCXjVzV/SPDEhMB3Q+DSurg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
"form-data": "^4.0.4",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
|
|
@ -9903,14 +9922,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/es-set-tostringtag": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz",
|
||||
"integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==",
|
||||
"peer": true,
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.2.4",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.6",
|
||||
"has-tostringtag": "^1.0.2",
|
||||
"hasown": "^2.0.1"
|
||||
"hasown": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
|
|
@ -11307,12 +11327,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
|
||||
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"es-set-tostringtag": "^2.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -11961,7 +11984,6 @@
|
|||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
||||
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
|
|
@ -19332,9 +19354,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.3.5",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz",
|
||||
"integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==",
|
||||
"version": "6.3.6",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.6.tgz",
|
||||
"integrity": "sha512-0msEVHJEScQbhkbVTb/4iHZdJ6SXp/AvxL2sjwYQFfBqleHtnCqv1J3sa9zbWz/6kW1m9Tfzn92vW+kZ1WV6QA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
"@continuedev/fetch": "file:../packages/fetch",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
DevDataLogEvent,
|
||||
ModelRole,
|
||||
} from "@continuedev/config-yaml";
|
||||
import { ToolPolicy } from "@continuedev/terminal-security";
|
||||
|
||||
import {
|
||||
AutocompleteInput,
|
||||
|
|
@ -39,7 +40,6 @@ import {
|
|||
SlashCommandDescWithSource,
|
||||
StreamDiffLinesPayload,
|
||||
ToolCall,
|
||||
ToolPolicy,
|
||||
} from "../";
|
||||
import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types";
|
||||
import { GetLspDefinitionsFunction } from "../autocomplete/types";
|
||||
|
|
@ -313,5 +313,6 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
];
|
||||
"process/markAsBackgrounded": [{ toolCallId: string }, void];
|
||||
"process/isBackgrounded": [{ toolCallId: string }, boolean];
|
||||
"process/killTerminalProcess": [{ toolCallId: string }, void];
|
||||
"mdm/setLicenseKey": [{ licenseKey: string }, boolean];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
|
|||
"isItemTooBig",
|
||||
"process/markAsBackgrounded",
|
||||
"process/isBackgrounded",
|
||||
"process/killTerminalProcess",
|
||||
];
|
||||
|
||||
// Message types to pass through from core to webview
|
||||
|
|
|
|||
|
|
@ -12,13 +12,11 @@ export const ideSettingsPromise = testIde.getIdeSettings();
|
|||
|
||||
export const testControlPlaneClient = new ControlPlaneClient(
|
||||
Promise.resolve(undefined),
|
||||
ideSettingsPromise,
|
||||
testIde.getIdeInfo(),
|
||||
testIde,
|
||||
);
|
||||
|
||||
export const testConfigHandler = new ConfigHandler(
|
||||
testIde,
|
||||
ideSettingsPromise,
|
||||
new LLMLogger(),
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { CallToolResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { ContextItem, Tool, ToolCall, ToolExtras } from "..";
|
||||
import { MCPManagerSingleton } from "../context/mcp/MCPManagerSingleton";
|
||||
import { canParseUrl } from "../util/url";
|
||||
|
|
@ -87,10 +88,14 @@ async function callToolFromUri(
|
|||
if (!client) {
|
||||
throw new Error("MCP connection not found");
|
||||
}
|
||||
const response = await client.client.callTool({
|
||||
name: toolName,
|
||||
arguments: args,
|
||||
});
|
||||
const response = await client.client.callTool(
|
||||
{
|
||||
name: toolName,
|
||||
arguments: args,
|
||||
},
|
||||
CallToolResultSchema,
|
||||
{ timeout: client.options.timeout },
|
||||
);
|
||||
|
||||
if (response.isError === true) {
|
||||
throw new Error(JSON.stringify(response.content));
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ export interface EditToolArgs {
|
|||
changes: string;
|
||||
}
|
||||
|
||||
export const NO_PARALLEL_TOOL_CALLING_INTSRUCTION =
|
||||
"Note this tool CANNOT be called in parallel with other tools.";
|
||||
export const NO_PARALLEL_TOOL_CALLING_INSTRUCTION =
|
||||
"This tool CANNOT be called in parallel with other tools.";
|
||||
|
||||
const CHANGES_DESCRIPTION =
|
||||
"Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock or write anything besides the code changes. In larger files, use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... existing code ...'";
|
||||
|
|
@ -24,7 +24,7 @@ export const editFileTool: Tool = {
|
|||
isInstant: false,
|
||||
function: {
|
||||
name: BuiltInToolNames.EditExistingFile,
|
||||
description: `Use this tool to edit an existing file. If you don't know the contents of the file, read it first.\n${EDIT_CODE_INSTRUCTIONS}\n${NO_PARALLEL_TOOL_CALLING_INTSRUCTION}`,
|
||||
description: `Use this tool to edit an existing file. If you don't know the contents of the file, read it first.\n${EDIT_CODE_INSTRUCTIONS}\n${NO_PARALLEL_TOOL_CALLING_INSTRUCTION}`,
|
||||
parameters: {
|
||||
type: "object",
|
||||
required: ["filepath", "changes"],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Tool } from "../..";
|
||||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
||||
import { NO_PARALLEL_TOOL_CALLING_INTSRUCTION } from "./editFile";
|
||||
import { NO_PARALLEL_TOOL_CALLING_INSTRUCTION } from "./editFile";
|
||||
import { singleFindAndReplaceTool } from "./singleFindAndReplace";
|
||||
|
||||
export interface EditOperation {
|
||||
old_string: string;
|
||||
|
|
@ -24,60 +25,41 @@ export const multiEditTool: Tool = {
|
|||
isInstant: false,
|
||||
function: {
|
||||
name: BuiltInToolNames.MultiEdit,
|
||||
description: `This is a tool for making multiple edits to a single file in one operation. It
|
||||
is built on top of the single find and replace tool and allows you to perform multiple
|
||||
find-and-replace operations efficiently. Prefer this tool over the single find and replace tool
|
||||
when you need to make multiple edits to the same file.
|
||||
description: `This is a tool for making multiple edits to a single file in one operation. It is built on top of the ${singleFindAndReplaceTool.function.name} and allows you to perform multiple find-and-replace operations efficiently.
|
||||
Prefer this tool over the ${singleFindAndReplaceTool.function.name} tool when you need to make multiple edits to the same file.
|
||||
|
||||
Before using this tool:
|
||||
|
||||
1. Use the read_file tool to understand the file's contents and context
|
||||
2. Verify the directory path is correct
|
||||
|
||||
To make multiple file edits, provide the following:
|
||||
|
||||
1. filepath: The path to the file to modify (relative to the root of the workspace)
|
||||
To make multiple edits to a file, provide the following:
|
||||
1. filepath: The path to the file to modify, RELATIVE to the project/workspace root (verify the directory path is correct)
|
||||
2. edits: An array of edit operations to perform, where each edit contains:
|
||||
- old_string: The text to replace (must match the file contents exactly, including all whitespace and indentation)
|
||||
- old_string: The text to replace (must match the old file contents exactly, including all whitespace/indentation)
|
||||
- new_string: The edited text to replace the old_string
|
||||
- replace_all: Replace all occurrences of old_string. This parameter is optional and defaults to false.
|
||||
|
||||
IMPORTANT:
|
||||
- All edits are applied in sequence, in the order they are provided
|
||||
- Each edit operates on the result of the previous edit
|
||||
- All edits must be valid for the operation to succeed - if any edit fails,
|
||||
none will be applied
|
||||
- This tool is ideal when you need to make several changes to different parts
|
||||
of the same file
|
||||
- Each edit operates on the result of the previous edit, so plan your edits carefully to avoid conflicts between sequential operations
|
||||
- Edits are atomic - all edits must be valid for the operation to succeed - if any edit fails, none will be applied
|
||||
- This tool is ideal when you need to make several changes to different parts of the same file
|
||||
|
||||
CRITICAL REQUIREMENTS:
|
||||
|
||||
1. All edits follow the same requirements as the single find and replace tool
|
||||
2. The edits are atomic - either all succeed or none are applied
|
||||
3. Plan your edits carefully to avoid conflicts between sequential operations
|
||||
4. ${NO_PARALLEL_TOOL_CALLING_INTSRUCTION}
|
||||
|
||||
WARNING:
|
||||
|
||||
- The tool will fail if edits.old_string doesn't match the file contents
|
||||
exactly (including whitespace)
|
||||
- The tool will fail if edits.old_string and edits.new_string are the same
|
||||
- Since edits are applied in sequence, ensure that earlier edits don't affect
|
||||
the text that later edits are trying to find
|
||||
|
||||
When making edits:
|
||||
|
||||
1. ALWAYS use the ${BuiltInToolNames.ReadFile} tool just before making edits, to understand the file's up-to-date contents and context. The user can also edit the file while you are working with it.
|
||||
2. ${NO_PARALLEL_TOOL_CALLING_INSTRUCTION}
|
||||
3. When making edits:
|
||||
- Ensure all edits result in idiomatic, correct code
|
||||
- Do not leave the code in a broken state
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to
|
||||
files unless asked.
|
||||
- Use replace_all for replacing and renaming strings across the file. This
|
||||
parameter is useful if you want to rename a variable for instance.
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked
|
||||
- Use replace_all for replacing and renaming all matches for a string across the file. This parameter is useful if you want to rename a variable, for instance
|
||||
|
||||
If you want to create a new file, use:
|
||||
- A new file path
|
||||
- A new file path, including new directory if needed
|
||||
- First edit: empty old_string and the new file's contents as new_string
|
||||
- Subsequent edits are not allowed - there is no need since you are creating`,
|
||||
- Subsequent edits are not allowed - there is no need since you are creating
|
||||
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required
|
||||
|
||||
WARNINGS:
|
||||
- If earlier edits affect the text that later edits are trying to find, files can become mangled
|
||||
- The tool will fail if edits.old_string doesn't match the file contents exactly (including whitespace)
|
||||
- The tool will fail if edits.old_string and edits.new_string are the same - they MUST be different`,
|
||||
parameters: {
|
||||
type: "object",
|
||||
required: ["filepath", "edits"],
|
||||
|
|
@ -97,16 +79,18 @@ If you want to create a new file, use:
|
|||
properties: {
|
||||
old_string: {
|
||||
type: "string",
|
||||
description: "The text to replace",
|
||||
description:
|
||||
"The text to replace (exact match including whitespace/indentation)",
|
||||
},
|
||||
new_string: {
|
||||
type: "string",
|
||||
description: "The text to replace it with",
|
||||
description:
|
||||
"The text to replace it with. MUST be different than old_string.",
|
||||
},
|
||||
replace_all: {
|
||||
type: "boolean",
|
||||
description:
|
||||
"Replace all occurrences of old_string (default false)",
|
||||
"Replace all occurrences of old_string (default false) in the file",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import os from "os";
|
||||
import { Tool, ToolPolicy } from "../..";
|
||||
import { Tool } from "../..";
|
||||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
||||
import { evaluateTerminalCommandSecurity } from "../security/terminalCommandSecurity";
|
||||
import {
|
||||
evaluateTerminalCommandSecurity,
|
||||
ToolPolicy,
|
||||
} from "@continuedev/terminal-security";
|
||||
|
||||
/**
|
||||
* Get the preferred shell for the current platform
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Tool } from "../..";
|
||||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
||||
import { NO_PARALLEL_TOOL_CALLING_INTSRUCTION } from "./editFile";
|
||||
import { NO_PARALLEL_TOOL_CALLING_INSTRUCTION } from "./editFile";
|
||||
|
||||
export interface SingleFindAndReplaceArgs {
|
||||
filepath: string;
|
||||
|
|
@ -20,33 +20,18 @@ export const singleFindAndReplaceTool: Tool = {
|
|||
isInstant: false,
|
||||
function: {
|
||||
name: BuiltInToolNames.SingleFindAndReplace,
|
||||
description: `Performs exact string replacements in files.
|
||||
description: `Performs exact string replacements in a file.
|
||||
|
||||
Usage:
|
||||
IMPORTANT:
|
||||
- ALWAYS use the \`${BuiltInToolNames.ReadFile}\` tool just before making edits, to understand the file's up-to-date contents and context. The user can also edit the file while you are working with it.
|
||||
- ${NO_PARALLEL_TOOL_CALLING_INSTRUCTION}
|
||||
- When editing text from \`${BuiltInToolNames.ReadFile}\` tool output, ensure you preserve exact whitespace/indentation.
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
||||
- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable, for instance.
|
||||
|
||||
- You must use your \`read_file\` tool at least once in the conversation before
|
||||
editing. This tool will error if you attempt an edit without reading the file.
|
||||
|
||||
- When editing text from read_file tool output, ensure you preserve the exact
|
||||
indentation (tabs/spaces) as it appears AFTER the line number prefix. The line
|
||||
number prefix format is: spaces + line number + tab. Everything after that tab
|
||||
is the actual file content to match. Never include any part of the line number
|
||||
prefix in the old_string or new_string.
|
||||
|
||||
- ALWAYS prefer editing existing files in the codebase. NEVER write new files
|
||||
unless explicitly required.
|
||||
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to
|
||||
files unless asked.
|
||||
|
||||
- ${NO_PARALLEL_TOOL_CALLING_INTSRUCTION}
|
||||
|
||||
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide
|
||||
a larger string with more surrounding context to make it unique or use
|
||||
\`replace_all\` to change every instance of \`old_string\`.
|
||||
|
||||
- Use \`replace_all\` for replacing and renaming strings across the file. This
|
||||
parameter is useful if you want to rename a variable for instance.`,
|
||||
WARNINGS:
|
||||
- When not using \`replace_all\`, the edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.
|
||||
- The edit will likely fail if you have not recently used the \`${BuiltInToolNames.ReadFile}\` tool to view up-to-date file contents.`,
|
||||
parameters: {
|
||||
type: "object",
|
||||
required: ["filepath", "old_string", "new_string"],
|
||||
|
|
@ -58,12 +43,13 @@ parameter is useful if you want to rename a variable for instance.`,
|
|||
},
|
||||
old_string: {
|
||||
type: "string",
|
||||
description: "The text to replace",
|
||||
description:
|
||||
"The text to replace - must be exact including whitespace/indentation",
|
||||
},
|
||||
new_string: {
|
||||
type: "string",
|
||||
description:
|
||||
"The text to replace it with (must be different from old_string)",
|
||||
"The text to replace it with (MUST be different from old_string)",
|
||||
},
|
||||
replace_all: {
|
||||
type: "boolean",
|
||||
|
|
|
|||
|
|
@ -36,8 +36,11 @@ import { fileURLToPath } from "node:url";
|
|||
import { ToolImpl } from ".";
|
||||
import {
|
||||
isProcessBackgrounded,
|
||||
markProcessAsRunning,
|
||||
removeBackgroundedProcess,
|
||||
} from "../../util/processTerminalBackgroundStates";
|
||||
removeRunningProcess,
|
||||
updateProcessOutput,
|
||||
} from "../../util/processTerminalStates";
|
||||
import { getBooleanArg, getStringArg } from "../parseArgs";
|
||||
|
||||
const asyncExec = util.promisify(childProcess.exec);
|
||||
|
|
@ -120,6 +123,16 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
env: getColorEnv(), // Add enhanced environment for colors
|
||||
});
|
||||
|
||||
// Track this process for foreground cancellation
|
||||
if (toolCallId && waitForCompletion) {
|
||||
markProcessAsRunning(
|
||||
toolCallId,
|
||||
childProc,
|
||||
extras.onPartialOutput,
|
||||
terminalOutput,
|
||||
);
|
||||
}
|
||||
|
||||
childProc.stdout?.on("data", (data) => {
|
||||
// Skip if this process has been backgrounded
|
||||
if (isProcessBackgrounded(toolCallId)) return;
|
||||
|
|
@ -127,6 +140,11 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
const newOutput = getDecodedOutput(data);
|
||||
terminalOutput += newOutput;
|
||||
|
||||
// Update the tracked output for potential cancellation notifications
|
||||
if (toolCallId && waitForCompletion) {
|
||||
updateProcessOutput(toolCallId, terminalOutput);
|
||||
}
|
||||
|
||||
// Send partial output to UI
|
||||
if (extras.onPartialOutput) {
|
||||
const status = waitForCompletion
|
||||
|
|
@ -153,6 +171,11 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
const newOutput = getDecodedOutput(data);
|
||||
terminalOutput += newOutput;
|
||||
|
||||
// Update the tracked output for potential cancellation notifications
|
||||
if (toolCallId && waitForCompletion) {
|
||||
updateProcessOutput(toolCallId, terminalOutput);
|
||||
}
|
||||
|
||||
// Send partial output to UI, status is not required
|
||||
if (extras.onPartialOutput) {
|
||||
extras.onPartialOutput({
|
||||
|
|
@ -182,15 +205,19 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
}
|
||||
|
||||
childProc.on("close", (code) => {
|
||||
// If this process has been backgrounded, clean it up from the map and return
|
||||
if (isProcessBackgrounded(toolCallId)) {
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
return;
|
||||
// Clean up process tracking
|
||||
if (toolCallId) {
|
||||
if (isProcessBackgrounded(toolCallId)) {
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
return;
|
||||
}
|
||||
// Remove from foreground tracking if it was tracked
|
||||
removeRunningProcess(toolCallId);
|
||||
}
|
||||
|
||||
if (waitForCompletion) {
|
||||
// Normal completion, resolve now
|
||||
if (code === 0) {
|
||||
if (!code || code === 0) {
|
||||
const status = "Command completed";
|
||||
resolve([
|
||||
{
|
||||
|
|
@ -234,10 +261,14 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
});
|
||||
|
||||
childProc.on("error", (error) => {
|
||||
// If this process has been backgrounded, clean it up from the map and return
|
||||
if (isProcessBackgrounded(toolCallId)) {
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
return;
|
||||
// Clean up process tracking
|
||||
if (toolCallId) {
|
||||
if (isProcessBackgrounded(toolCallId)) {
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
return;
|
||||
}
|
||||
// Remove from foreground tracking if it was tracked
|
||||
removeRunningProcess(toolCallId);
|
||||
}
|
||||
|
||||
reject(error);
|
||||
|
|
@ -281,6 +312,11 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
},
|
||||
);
|
||||
|
||||
// Track this process for foreground cancellation
|
||||
if (toolCallId) {
|
||||
markProcessAsRunning(toolCallId, childProc, undefined, "");
|
||||
}
|
||||
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
|
||||
|
|
@ -293,6 +329,11 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
});
|
||||
|
||||
childProc.on("close", (code) => {
|
||||
// Clean up process tracking
|
||||
if (toolCallId) {
|
||||
removeRunningProcess(toolCallId);
|
||||
}
|
||||
|
||||
if (code === 0) {
|
||||
resolve({ stdout, stderr });
|
||||
} else {
|
||||
|
|
@ -305,6 +346,10 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
|
|||
});
|
||||
|
||||
childProc.on("error", (error) => {
|
||||
// Clean up process tracking
|
||||
if (toolCallId) {
|
||||
removeRunningProcess(toolCallId);
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import * as fs from "node:fs";
|
|||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { IDE, ToolExtras } from "../..";
|
||||
import * as processBackgroundStates from "../../util/processTerminalBackgroundStates";
|
||||
import * as processTerminalStates from "../../util/processTerminalStates";
|
||||
import { runTerminalCommandImpl } from "./runTerminalCommand";
|
||||
import { runTerminalCommandTool } from "../definitions/runTerminalCommand";
|
||||
|
||||
|
|
@ -39,12 +39,8 @@ describe("runTerminalCommandImpl", () => {
|
|||
vi.resetAllMocks();
|
||||
|
||||
// Setup backgrounded processes handling - don't mock, just make sure it's empty
|
||||
// Get any processes that might be already tracked and clear them
|
||||
const processMap = (processBackgroundStates as any)
|
||||
.processTerminalBackgroundStates;
|
||||
if (processMap && typeof processMap.clear === "function") {
|
||||
processMap.clear();
|
||||
}
|
||||
// Clear any processes that might be already tracked
|
||||
processTerminalStates.clearAllBackgroundProcesses();
|
||||
|
||||
// Setup IDE mocks
|
||||
mockGetIdeInfo.mockReturnValue(Promise.resolve({ remoteName: "local" }));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,17 @@ export const viewDiffImpl: ToolImpl = async (args, extras) => {
|
|||
// TODO includeUnstaged should be an option
|
||||
|
||||
const combinedDiff = diffs.join("\n");
|
||||
|
||||
if (!combinedDiff.trim()) {
|
||||
return [
|
||||
{
|
||||
name: "Diff",
|
||||
description: "current Git diff",
|
||||
content: "The current diff is empty",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const diffLines = combinedDiff.split("\n");
|
||||
|
||||
let truncated = false;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,21 @@ export function renderContextItems(contextItems: ContextItem[]): string {
|
|||
return contextItems.map((item) => item.content).join("\n\n");
|
||||
}
|
||||
|
||||
export function renderContextItemsWithStatus(contextItems: any[]): string {
|
||||
return contextItems
|
||||
.map((item) => {
|
||||
let result = item.content;
|
||||
|
||||
// If this item has a status, append it directly after the content
|
||||
if (item.status) {
|
||||
result += `\n[Status: ${item.status}]`;
|
||||
}
|
||||
|
||||
return result;
|
||||
})
|
||||
.join("\n\n");
|
||||
}
|
||||
|
||||
export function normalizeToMessageParts(message: ChatMessage): MessagePart[] {
|
||||
switch (message.role) {
|
||||
case "user":
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = {
|
|||
transform: true,
|
||||
showWhateverWeHaveAtXMs: 300,
|
||||
// Experimental options: true = enabled, false = disabled, number = enabled w priority
|
||||
experimental_includeClipboard: true,
|
||||
experimental_includeClipboard: false,
|
||||
experimental_includeRecentlyVisitedRanges: true,
|
||||
experimental_includeRecentlyEditedRanges: true,
|
||||
experimental_includeDiff: true,
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
import {
|
||||
markProcessAsBackgrounded,
|
||||
isProcessBackgrounded,
|
||||
removeBackgroundedProcess,
|
||||
} from "./processTerminalBackgroundStates";
|
||||
|
||||
describe("processTerminalBackgroundStates", () => {
|
||||
beforeEach(() => {
|
||||
// Clear any backgrounded processes before each test
|
||||
const backgroundedProcesses = Array.from(
|
||||
Object.getOwnPropertySymbols(global),
|
||||
).find(
|
||||
(symbol) => String(symbol) === "Symbol(processTerminalBackgroundStates)",
|
||||
);
|
||||
|
||||
if (backgroundedProcesses) {
|
||||
// Reset the map by reimporting the module
|
||||
jest.resetModules();
|
||||
}
|
||||
});
|
||||
|
||||
test("should mark a process as backgrounded", () => {
|
||||
const toolCallId = "test-123";
|
||||
markProcessAsBackgrounded(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(true);
|
||||
});
|
||||
|
||||
test("should correctly identify non-backgrounded processes", () => {
|
||||
const toolCallId = "test-123";
|
||||
const anotherToolCallId = "test-456";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId);
|
||||
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(true);
|
||||
expect(isProcessBackgrounded(anotherToolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should remove a process from backgrounded state", () => {
|
||||
const toolCallId = "test-123";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(true);
|
||||
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should handle removing non-existent processes", () => {
|
||||
const toolCallId = "test-123";
|
||||
|
||||
// Should not throw an error
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should handle multiple processes", () => {
|
||||
const toolCallId1 = "test-123";
|
||||
const toolCallId2 = "test-456";
|
||||
const toolCallId3 = "test-789";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId1);
|
||||
markProcessAsBackgrounded(toolCallId2);
|
||||
|
||||
expect(isProcessBackgrounded(toolCallId1)).toBe(true);
|
||||
expect(isProcessBackgrounded(toolCallId2)).toBe(true);
|
||||
expect(isProcessBackgrounded(toolCallId3)).toBe(false);
|
||||
|
||||
removeBackgroundedProcess(toolCallId1);
|
||||
|
||||
expect(isProcessBackgrounded(toolCallId1)).toBe(false);
|
||||
expect(isProcessBackgrounded(toolCallId2)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Track which processes have been backgrounded
|
||||
const processTerminalBackgroundStates = new Map<string, boolean>();
|
||||
|
||||
// Function to mark a process as backgrounded
|
||||
export function markProcessAsBackgrounded(toolCallId: string): void {
|
||||
processTerminalBackgroundStates.set(toolCallId, true);
|
||||
}
|
||||
|
||||
// Function to check if a process is backgrounded
|
||||
export function isProcessBackgrounded(toolCallId: string): boolean {
|
||||
return processTerminalBackgroundStates.has(toolCallId);
|
||||
}
|
||||
|
||||
// Function to remove a process from the backgrounded processes map
|
||||
export function removeBackgroundedProcess(toolCallId: string): void {
|
||||
processTerminalBackgroundStates.delete(toolCallId);
|
||||
}
|
||||
367
core/util/processTerminalStates.test.ts
Normal file
367
core/util/processTerminalStates.test.ts
Normal file
|
|
@ -0,0 +1,367 @@
|
|||
import { ChildProcess } from "child_process";
|
||||
import {
|
||||
clearAllBackgroundProcesses,
|
||||
getAllBackgroundedProcessIds,
|
||||
getAllRunningProcessIds,
|
||||
getRunningProcess,
|
||||
isProcessBackgrounded,
|
||||
isProcessRunning,
|
||||
killAllRunningTerminalProcesses,
|
||||
killMultipleTerminalProcesses,
|
||||
killTerminalProcess,
|
||||
markProcessAsBackgrounded,
|
||||
markProcessAsRunning,
|
||||
removeBackgroundedProcess,
|
||||
removeRunningProcess,
|
||||
updateProcessOutput,
|
||||
} from "./processTerminalStates";
|
||||
|
||||
// Mock ChildProcess
|
||||
const createMockProcess = (
|
||||
pid: number = 123,
|
||||
killed: boolean = false,
|
||||
): jest.Mocked<ChildProcess> => {
|
||||
const mockProcess = {
|
||||
pid,
|
||||
killed,
|
||||
kill: jest.fn(),
|
||||
} as unknown as jest.Mocked<ChildProcess>;
|
||||
|
||||
// Make kill() update the killed property
|
||||
mockProcess.kill.mockImplementation(() => {
|
||||
(mockProcess as any).killed = true;
|
||||
return true;
|
||||
});
|
||||
|
||||
return mockProcess;
|
||||
};
|
||||
|
||||
describe("processTerminalStates", () => {
|
||||
beforeEach(() => {
|
||||
// Clear all running processes
|
||||
const runningIds = getAllRunningProcessIds();
|
||||
runningIds.forEach((id) => removeRunningProcess(id));
|
||||
|
||||
// Clear all backgrounded processes
|
||||
const backgroundedIds = getAllBackgroundedProcessIds();
|
||||
backgroundedIds.forEach((id) => removeBackgroundedProcess(id));
|
||||
|
||||
// Clear all timers
|
||||
jest.clearAllTimers();
|
||||
});
|
||||
|
||||
test("should mark a process as backgrounded", () => {
|
||||
const toolCallId = "test-123";
|
||||
markProcessAsBackgrounded(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(true);
|
||||
});
|
||||
|
||||
test("should correctly identify non-backgrounded processes", () => {
|
||||
const toolCallId = "test-123";
|
||||
const anotherToolCallId = "test-456";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId);
|
||||
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(true);
|
||||
expect(isProcessBackgrounded(anotherToolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should remove a process from backgrounded state", () => {
|
||||
const toolCallId = "test-123";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(true);
|
||||
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should handle removing non-existent processes", () => {
|
||||
const toolCallId = "test-123";
|
||||
|
||||
// Should not throw an error
|
||||
removeBackgroundedProcess(toolCallId);
|
||||
expect(isProcessBackgrounded(toolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should handle multiple processes", () => {
|
||||
const toolCallId1 = "test-123";
|
||||
const toolCallId2 = "test-456";
|
||||
const toolCallId3 = "test-789";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId1);
|
||||
markProcessAsBackgrounded(toolCallId2);
|
||||
|
||||
expect(isProcessBackgrounded(toolCallId1)).toBe(true);
|
||||
expect(isProcessBackgrounded(toolCallId2)).toBe(true);
|
||||
expect(isProcessBackgrounded(toolCallId3)).toBe(false);
|
||||
|
||||
removeBackgroundedProcess(toolCallId1);
|
||||
|
||||
expect(isProcessBackgrounded(toolCallId1)).toBe(false);
|
||||
expect(isProcessBackgrounded(toolCallId2)).toBe(true);
|
||||
});
|
||||
|
||||
describe("foreground process functions", () => {
|
||||
test("should mark a process as running", () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess();
|
||||
const mockCallback = jest.fn();
|
||||
const initialOutput = "initial output";
|
||||
|
||||
markProcessAsRunning(
|
||||
toolCallId,
|
||||
mockProcess,
|
||||
mockCallback,
|
||||
initialOutput,
|
||||
);
|
||||
|
||||
expect(isProcessRunning(toolCallId)).toBe(true);
|
||||
expect(getRunningProcess(toolCallId)).toBe(mockProcess);
|
||||
});
|
||||
|
||||
test("should handle process without callback or initial output", () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess();
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess);
|
||||
|
||||
expect(isProcessRunning(toolCallId)).toBe(true);
|
||||
expect(getRunningProcess(toolCallId)).toBe(mockProcess);
|
||||
});
|
||||
|
||||
test("should correctly identify non-running processes", () => {
|
||||
const toolCallId = "test-123";
|
||||
const anotherToolCallId = "test-456";
|
||||
const mockProcess = createMockProcess();
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess);
|
||||
|
||||
expect(isProcessRunning(toolCallId)).toBe(true);
|
||||
expect(isProcessRunning(anotherToolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should update process output", () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess();
|
||||
const initialOutput = "initial";
|
||||
const updatedOutput = "updated output";
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess, undefined, initialOutput);
|
||||
updateProcessOutput(toolCallId, updatedOutput);
|
||||
|
||||
// We can't directly test the output value, but we can ensure the function doesn't throw
|
||||
expect(() =>
|
||||
updateProcessOutput(toolCallId, updatedOutput),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
test("should handle updating output for non-existent process", () => {
|
||||
const toolCallId = "non-existent";
|
||||
|
||||
expect(() =>
|
||||
updateProcessOutput(toolCallId, "some output"),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
test("should remove a process from running state", () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess();
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess);
|
||||
expect(isProcessRunning(toolCallId)).toBe(true);
|
||||
|
||||
removeRunningProcess(toolCallId);
|
||||
expect(isProcessRunning(toolCallId)).toBe(false);
|
||||
expect(getRunningProcess(toolCallId)).toBeUndefined();
|
||||
});
|
||||
|
||||
test("should handle removing non-existent running processes", () => {
|
||||
const toolCallId = "test-123";
|
||||
|
||||
expect(() => removeRunningProcess(toolCallId)).not.toThrow();
|
||||
expect(isProcessRunning(toolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should return undefined for non-existent running process", () => {
|
||||
const toolCallId = "non-existent";
|
||||
|
||||
expect(getRunningProcess(toolCallId)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("terminal command cancellation", () => {
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
test("should cancel a running terminal command", async () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess();
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess);
|
||||
expect(isProcessRunning(toolCallId)).toBe(true);
|
||||
|
||||
await killTerminalProcess(toolCallId);
|
||||
|
||||
expect(mockProcess.kill).toHaveBeenCalledWith("SIGTERM");
|
||||
expect(isProcessRunning(toolCallId)).toBe(false);
|
||||
});
|
||||
|
||||
test("should handle cancelling non-existent process", async () => {
|
||||
const toolCallId = "non-existent";
|
||||
|
||||
await expect(killTerminalProcess(toolCallId)).resolves.not.toThrow();
|
||||
});
|
||||
|
||||
test("should handle cancelling already killed process", async () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess(123, true); // Already killed
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess);
|
||||
|
||||
await killTerminalProcess(toolCallId);
|
||||
|
||||
expect(mockProcess.kill).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("should send SIGKILL after timeout if process not killed", async () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess();
|
||||
|
||||
// Mock kill to not actually set killed=true for SIGTERM
|
||||
mockProcess.kill.mockImplementation((signal) => {
|
||||
if (signal === "SIGKILL") {
|
||||
(mockProcess as any).killed = true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess);
|
||||
|
||||
const cancelPromise = killTerminalProcess(toolCallId);
|
||||
|
||||
// Fast-forward time to trigger the timeout
|
||||
jest.advanceTimersByTime(5000);
|
||||
|
||||
await cancelPromise;
|
||||
|
||||
expect(mockProcess.kill).toHaveBeenCalledWith("SIGTERM");
|
||||
expect(mockProcess.kill).toHaveBeenCalledWith("SIGKILL");
|
||||
});
|
||||
|
||||
test("should not send SIGKILL if process was already killed", async () => {
|
||||
const toolCallId = "test-123";
|
||||
const mockProcess = createMockProcess();
|
||||
|
||||
markProcessAsRunning(toolCallId, mockProcess);
|
||||
|
||||
const cancelPromise = killTerminalProcess(toolCallId);
|
||||
|
||||
// Fast-forward time to trigger the timeout
|
||||
jest.advanceTimersByTime(5000);
|
||||
|
||||
await cancelPromise;
|
||||
|
||||
expect(mockProcess.kill).toHaveBeenCalledWith("SIGTERM");
|
||||
expect(mockProcess.kill).toHaveBeenCalledTimes(1); // Only SIGTERM, no SIGKILL
|
||||
});
|
||||
});
|
||||
|
||||
describe("utility functions", () => {
|
||||
test("should get all running process IDs", () => {
|
||||
const toolCallId1 = "test-123";
|
||||
const toolCallId2 = "test-456";
|
||||
const mockProcess1 = createMockProcess(123);
|
||||
const mockProcess2 = createMockProcess(456);
|
||||
|
||||
markProcessAsRunning(toolCallId1, mockProcess1);
|
||||
markProcessAsRunning(toolCallId2, mockProcess2);
|
||||
|
||||
const runningIds = getAllRunningProcessIds();
|
||||
expect(runningIds).toContain(toolCallId1);
|
||||
expect(runningIds).toContain(toolCallId2);
|
||||
expect(runningIds).toHaveLength(2);
|
||||
});
|
||||
|
||||
test("should get all backgrounded process IDs", () => {
|
||||
const toolCallId1 = "test-123";
|
||||
const toolCallId2 = "test-456";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId1);
|
||||
markProcessAsBackgrounded(toolCallId2);
|
||||
|
||||
const backgroundedIds = getAllBackgroundedProcessIds();
|
||||
expect(backgroundedIds).toContain(toolCallId1);
|
||||
expect(backgroundedIds).toContain(toolCallId2);
|
||||
expect(backgroundedIds).toHaveLength(2);
|
||||
});
|
||||
|
||||
test("should return empty arrays when no processes", () => {
|
||||
expect(getAllRunningProcessIds()).toEqual([]);
|
||||
expect(getAllBackgroundedProcessIds()).toEqual([]);
|
||||
});
|
||||
|
||||
test("should cancel multiple terminal commands", async () => {
|
||||
const toolCallId1 = "test-123";
|
||||
const toolCallId2 = "test-456";
|
||||
const mockProcess1 = createMockProcess(123);
|
||||
const mockProcess2 = createMockProcess(456);
|
||||
|
||||
markProcessAsRunning(toolCallId1, mockProcess1);
|
||||
markProcessAsRunning(toolCallId2, mockProcess2);
|
||||
|
||||
await killMultipleTerminalProcesses([toolCallId1, toolCallId2]);
|
||||
|
||||
expect(mockProcess1.kill).toHaveBeenCalledWith("SIGTERM");
|
||||
expect(mockProcess2.kill).toHaveBeenCalledWith("SIGTERM");
|
||||
expect(isProcessRunning(toolCallId1)).toBe(false);
|
||||
expect(isProcessRunning(toolCallId2)).toBe(false);
|
||||
});
|
||||
|
||||
test("should cancel all running terminal commands", async () => {
|
||||
const toolCallId1 = "test-123";
|
||||
const toolCallId2 = "test-456";
|
||||
const mockProcess1 = createMockProcess(123);
|
||||
const mockProcess2 = createMockProcess(456);
|
||||
|
||||
markProcessAsRunning(toolCallId1, mockProcess1);
|
||||
markProcessAsRunning(toolCallId2, mockProcess2);
|
||||
|
||||
const cancelledIds = await killAllRunningTerminalProcesses();
|
||||
|
||||
expect(cancelledIds).toContain(toolCallId1);
|
||||
expect(cancelledIds).toContain(toolCallId2);
|
||||
expect(cancelledIds).toHaveLength(2);
|
||||
expect(mockProcess1.kill).toHaveBeenCalledWith("SIGTERM");
|
||||
expect(mockProcess2.kill).toHaveBeenCalledWith("SIGTERM");
|
||||
expect(isProcessRunning(toolCallId1)).toBe(false);
|
||||
expect(isProcessRunning(toolCallId2)).toBe(false);
|
||||
});
|
||||
|
||||
test("should return empty array when no running commands to cancel", async () => {
|
||||
const cancelledIds = await killAllRunningTerminalProcesses();
|
||||
expect(cancelledIds).toEqual([]);
|
||||
});
|
||||
|
||||
test("should clear all background processes", () => {
|
||||
const toolCallId1 = "test-123";
|
||||
const toolCallId2 = "test-456";
|
||||
|
||||
markProcessAsBackgrounded(toolCallId1);
|
||||
markProcessAsBackgrounded(toolCallId2);
|
||||
|
||||
expect(getAllBackgroundedProcessIds()).toHaveLength(2);
|
||||
|
||||
clearAllBackgroundProcesses();
|
||||
|
||||
expect(getAllBackgroundedProcessIds()).toEqual([]);
|
||||
expect(isProcessBackgrounded(toolCallId1)).toBe(false);
|
||||
expect(isProcessBackgrounded(toolCallId2)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
119
core/util/processTerminalStates.ts
Normal file
119
core/util/processTerminalStates.ts
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
import { ChildProcess } from "child_process";
|
||||
|
||||
// Track which processes have been backgrounded
|
||||
const processTerminalBackgroundStates = new Map<string, boolean>();
|
||||
|
||||
// Track which foreground processes are currently running
|
||||
interface RunningProcessInfo {
|
||||
process: ChildProcess;
|
||||
onPartialOutput?: (params: {
|
||||
toolCallId: string;
|
||||
contextItems: any[];
|
||||
}) => void;
|
||||
currentOutput: string;
|
||||
}
|
||||
|
||||
const processTerminalForegroundStates = new Map<string, RunningProcessInfo>();
|
||||
|
||||
// Background process functions (existing)
|
||||
export function markProcessAsBackgrounded(toolCallId: string): void {
|
||||
processTerminalBackgroundStates.set(toolCallId, true);
|
||||
}
|
||||
|
||||
export function isProcessBackgrounded(toolCallId: string): boolean {
|
||||
return processTerminalBackgroundStates.has(toolCallId);
|
||||
}
|
||||
|
||||
export function removeBackgroundedProcess(toolCallId: string): void {
|
||||
processTerminalBackgroundStates.delete(toolCallId);
|
||||
}
|
||||
|
||||
// Foreground process functions (new)
|
||||
export function markProcessAsRunning(
|
||||
toolCallId: string,
|
||||
process: ChildProcess,
|
||||
onPartialOutput?: (params: {
|
||||
toolCallId: string;
|
||||
contextItems: any[];
|
||||
}) => void,
|
||||
currentOutput: string = "",
|
||||
): void {
|
||||
processTerminalForegroundStates.set(toolCallId, {
|
||||
process,
|
||||
onPartialOutput,
|
||||
currentOutput,
|
||||
});
|
||||
}
|
||||
|
||||
export function isProcessRunning(toolCallId: string): boolean {
|
||||
return processTerminalForegroundStates.has(toolCallId);
|
||||
}
|
||||
|
||||
export function getRunningProcess(
|
||||
toolCallId: string,
|
||||
): ChildProcess | undefined {
|
||||
const info = processTerminalForegroundStates.get(toolCallId);
|
||||
return info?.process;
|
||||
}
|
||||
|
||||
export function updateProcessOutput(toolCallId: string, output: string): void {
|
||||
const info = processTerminalForegroundStates.get(toolCallId);
|
||||
if (info) {
|
||||
info.currentOutput = output;
|
||||
}
|
||||
}
|
||||
|
||||
export function removeRunningProcess(toolCallId: string): void {
|
||||
processTerminalForegroundStates.delete(toolCallId);
|
||||
}
|
||||
|
||||
export async function killTerminalProcess(toolCallId: string): Promise<void> {
|
||||
const processInfo = processTerminalForegroundStates.get(toolCallId);
|
||||
if (processInfo && !processInfo.process.killed) {
|
||||
const { process } = processInfo;
|
||||
|
||||
process.kill("SIGTERM");
|
||||
|
||||
// Force kill after 5 seconds if still running
|
||||
setTimeout(() => {
|
||||
if (!process.killed) {
|
||||
process.kill("SIGKILL");
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
processTerminalForegroundStates.delete(toolCallId);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to cancel multiple terminal commands at once
|
||||
export async function killMultipleTerminalProcesses(
|
||||
toolCallIds: string[],
|
||||
): Promise<void> {
|
||||
const cancelPromises = toolCallIds.map((toolCallId) =>
|
||||
killTerminalProcess(toolCallId),
|
||||
);
|
||||
await Promise.all(cancelPromises);
|
||||
}
|
||||
|
||||
// Function to cancel ALL currently running terminal commands
|
||||
export async function killAllRunningTerminalProcesses(): Promise<string[]> {
|
||||
const runningIds = getAllRunningProcessIds();
|
||||
if (runningIds.length > 0) {
|
||||
await killMultipleTerminalProcesses(runningIds);
|
||||
}
|
||||
return runningIds; // Return the IDs that were cancelled
|
||||
}
|
||||
|
||||
// Utility functions
|
||||
export function getAllRunningProcessIds(): string[] {
|
||||
return Array.from(processTerminalForegroundStates.keys());
|
||||
}
|
||||
|
||||
export function getAllBackgroundedProcessIds(): string[] {
|
||||
return Array.from(processTerminalBackgroundStates.keys());
|
||||
}
|
||||
|
||||
// Utility function for testing - clears all background process states
|
||||
export function clearAllBackgroundProcesses(): void {
|
||||
processTerminalBackgroundStates.clear();
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
title: "Chat"
|
||||
sidebarTitle: "How To Use AI Chat"
|
||||
icon: "circle-question"
|
||||
description: "Learn how to use Continue's AI chat assistant to solve coding problems without leaving your IDE, including code context sharing, applying generated solutions, and switching between models"
|
||||
description: "Learn how to use Continue's AI chat agent to solve coding problems without leaving your IDE, including code context sharing, applying generated solutions, and switching between models"
|
||||
---
|
||||
|
||||
<Frame>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "Customization Overview"
|
||||
description: "Learn how to customize Continue with model providers, context providers, slash commands, and tools to create your perfect AI coding assistant"
|
||||
description: "Learn how to customize Continue with model providers, context providers, slash commands, and tools to create your perfect AI coding agent"
|
||||
---
|
||||
|
||||
Continue can be deeply customized to fit your specific development workflow and preferences. This guide covers the main ways you can customize Continue to enhance your coding experience.
|
||||
|
|
@ -21,15 +21,15 @@ Slash commands allow you to easily add custom functionality to Continue. You can
|
|||
|
||||
Unchain your LLM with the power of tools using [Agent](/features/agent/quick-start). Add custom tools using [MCP Servers](/customization/mcp-tools)
|
||||
|
||||
Whatever you choose, you'll probably start by editing your Assistant.
|
||||
Whatever you choose, you'll probably start by editing your Agent.
|
||||
|
||||
## Edit Your Assistant
|
||||
## Edit Your Agent
|
||||
|
||||
You can easily access your assistant configuration from the Continue Chat sidebar. Open the sidebar by pressing `cmd/ctrl` + `L` (VS Code) or `cmd/ctrl` + `J` (JetBrains) and click the Assistant selector above the main chat input. Then, you can hover over an assistant and click the `new window` (hub assistants) or `gear` (local assistants) icon.
|
||||
You can easily access your agent configuration from the Continue Chat sidebar. Open the sidebar by pressing `cmd/ctrl` + `L` (VS Code) or `cmd/ctrl` + `J` (JetBrains) and click the Agent selector above the main chat input. Then, you can hover over an agent and click the `new window` (hub agents) or `gear` (local agents) icon.
|
||||
|
||||

|
||||

|
||||
|
||||
## Manage Your Assistant
|
||||
## Manage Your Agent
|
||||
|
||||
- See [Editing Hub Assistants](/hub/assistants/edit-an-assistant) for more details on managing your hub assistant
|
||||
- See the [Config Deep Dive](/reference) for more details on configuring local assistants.
|
||||
- See [Editing Hub Agents](/hub/agents/edit-an-agent) for more details on managing your hub agent
|
||||
- See the [Config Deep Dive](/reference) for more details on configuring local agents.
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
title: "Rules"
|
||||
description: "Rules allow you to provide specific instructions that guide how the AI assistant behaves when working with your code. Instead of the AI making assumptions about your coding standards, architecture patterns, or project-specific requirements, you can explicitly define guidelines that ensure consistent, contextually appropriate responses."
|
||||
description: "Rules allow you to provide specific instructions that guide how the AI agent behaves when working with your code. Instead of the AI making assumptions about your coding standards, architecture patterns, or project-specific requirements, you can explicitly define guidelines that ensure consistent, contextually appropriate responses."
|
||||
---
|
||||
|
||||
Think of these as the guardrails for your AI coding assistants:
|
||||
Think of these as the guardrails for your AI coding agents:
|
||||
|
||||
- **Enforce company-specific coding standards** and security practices
|
||||
- **Implement quality checks** that match your engineering culture
|
||||
- **Create paved paths** for developers to follow organizational best practices
|
||||
|
||||
By implementing rules, you transform the AI from a generic coding assistant into a knowledgeable team member that understands your project's unique requirements and constraints.
|
||||
By implementing rules, you transform the AI from a generic coding agent into a knowledgeable team member that understands your project's unique requirements and constraints.
|
||||
|
||||
## How Rules Work
|
||||
|
||||
Your assistant detects rules and applies the specified rules while in [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) modes.
|
||||
Your agent detects rules and applies the specified rules while in [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) modes.
|
||||
|
||||
Learn more in the [rules deep dive](/customize/deep-dives/rules), and view [`rules`](/reference#rules) in the YAML Reference for more details.
|
||||
|
|
@ -1,26 +1,26 @@
|
|||
---
|
||||
title: "How to Configure Continue Assistants"
|
||||
description: Learn how to access and manage Continue assistant configurations through Hub or local YAML files
|
||||
title: "How to Configure Continue Agents"
|
||||
description: Learn how to access and manage Continue agent configurations through Hub or local YAML files
|
||||
keywords: [config, settings, customize]
|
||||
sidebarTitle: "Assistant Configuration"
|
||||
sidebarTitle: "Agent Configuration"
|
||||
---
|
||||
|
||||
You can easily access your assistant configuration from the Continue Chat sidebar. Open the sidebar by pressing <kbd>cmd/ctrl</kbd> + <kbd>L</kbd> (VS Code) or <kbd>cmd/ctrl</kbd> + <kbd>J</kbd> (JetBrains) and click the Assistant selector above the main chat input. Then, you can hover over an assistant and click the `new window` (hub assistants) or `gear` (local assistants) icon.
|
||||
You can easily access your agent configuration from the Continue Chat sidebar. Open the sidebar by pressing <kbd>cmd/ctrl</kbd> + <kbd>L</kbd> (VS Code) or <kbd>cmd/ctrl</kbd> + <kbd>J</kbd> (JetBrains) and click the Agent selector above the main chat input. Then, you can hover over an agent and click the `new window` (hub agents) or `gear` (local agents) icon.
|
||||
|
||||

|
||||

|
||||
|
||||
## How to Manage Hub Assistants
|
||||
## How to Manage Hub Agents
|
||||
|
||||
Hub Assistants can be managed in [the Hub](https://hub.continue.dev). See [Editing an Assistant](../../hub/assistants/edit-an-assistant.md)
|
||||
Hub Agents can be managed in [the Hub](https://hub.continue.dev). See [Editing an Agent](../../hub/agents/edit-an-agent.md)
|
||||
|
||||
## How to Configure Local Assistants with YAML
|
||||
## How to Configure Local Agents with YAML
|
||||
|
||||
Local user-level configuration is stored and can be edited in your home directory in `config.yaml`:
|
||||
|
||||
- `~/.continue/config.yaml` (MacOS / Linux)
|
||||
- `%USERPROFILE%\.continue\config.yaml` (Windows)
|
||||
|
||||
To open this `config.yaml`, you need to open the assistants dropdown in the top-right portion of the chat input. On that dropdown beside the "Local Assistant" option, select the cog icon. It will open the local `config.yaml`.
|
||||
To open this `config.yaml`, you need to open the agents dropdown in the top-right portion of the chat input. On that dropdown beside the "Local Agent" option, select the cog icon. It will open the local `config.yaml`.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ that can be set up with custom tools.
|
|||
Currently custom tools can be configured using the Model Context
|
||||
Protocol standard to unify prompts, context, and tool use.
|
||||
|
||||
MCP Servers can be added to hub Assistants using `mcpServers` blocks. You can
|
||||
MCP Servers can be added to hub Agents using `mcpServers` blocks. You can
|
||||
explore available MCP server blocks
|
||||
[here](https://hub.continue.dev/explore/mcp).
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ explore available MCP server blocks
|
|||
|
||||
## Quick Start: How to Set Up Your First MCP Server
|
||||
|
||||
Below is a quick example of setting up a new MCP server for use in your assistant:
|
||||
Below is a quick example of setting up a new MCP server for use in your agent:
|
||||
|
||||
1. Create a folder called `.continue/mcpServers` at the top level of your workspace
|
||||
2. Add a file called `playwright-mcp.yaml` to this folder.
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ Now test your rules by asking a question about a file in chat.
|
|||
|
||||
## How to Create Rules Blocks
|
||||
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Assistant's rules.
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Agent's rules.
|
||||
|
||||

|
||||
|
||||
|
|
@ -53,7 +53,7 @@ For example, you can say "Create a rule for this", and a rule will be created fo
|
|||
|
||||
</Info>
|
||||
|
||||
Rules can also be added to an Assistant on the Continue Hub.
|
||||
Rules can also be added to an Agent on the Continue Hub.
|
||||
|
||||
Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Now test your rules by asking a question about a file in chat.
|
|||
|
||||
## Creating `rules` blocks
|
||||
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Assistant's rules.
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Agent's rules.
|
||||
|
||||

|
||||
|
||||
|
|
@ -49,7 +49,7 @@ Automatically create local rule blocks: When in Agent mode, you can prompt the a
|
|||
For example, you can say "Create a rule for this", and a rule will be created for you in `.continue/rules` based on your conversation.
|
||||
</Info>
|
||||
|
||||
Rules can also be added to an Assistant on the Continue Hub.
|
||||
Rules can also be added to an Agent on the Continue Hub.
|
||||
|
||||
Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ name: New rule
|
|||
Always give concise responses
|
||||
```
|
||||
|
||||
This is also done when selecting "Add Rule" in the Assistant settings. This will create a new folder in `.continue/rules` with a default file named `new-rule.md`.
|
||||
This is also done when selecting "Add Rule" in the Agent settings. This will create a new folder in `.continue/rules` with a default file named `new-rule.md`.
|
||||
|
||||
### Examples
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ Slash commands can be combined with additional instructions, including highlight
|
|||
|
||||
## Ways to Create Slash Commands in Continue
|
||||
|
||||
### Assistant Prompt Blocks
|
||||
### Agent Prompt Blocks
|
||||
|
||||
The easiest way to add a slash command is by adding [`prompt` blocks](../../hub/blocks/block-types#prompts) to your assistant, which show up as slash commands in [Chat](../../features/chat/how-it-works).
|
||||
The easiest way to add a slash command is by adding [`prompt` blocks](../../hub/blocks/block-types#prompts) to your agent, which show up as slash commands in [Chat](../../features/chat/how-it-works).
|
||||
|
||||
### Prompt Files
|
||||
|
||||
|
|
|
|||
BIN
docs/customize/model-providers/assets/tetrate-remix.png
Normal file
BIN
docs/customize/model-providers/assets/tetrate-remix.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
|
|
@ -1,44 +0,0 @@
|
|||
---
|
||||
title: "Tetrate Agent Router Service"
|
||||
---
|
||||
|
||||
The Tetrate Agent Router Service (TARS) provides a unified API gateway for accessing various AI models with fast inference capabilities. TARS acts as an intelligent router that can distribute requests across multiple model providers, offering enterprise-grade reliability and performance optimization.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Obtain an API key from the [Tetrate Agent Router Service portal](https://api.router.tetrate.ai/)
|
||||
2. Configure Continue to use TARS as your model provider
|
||||
|
||||
## Configuration
|
||||
|
||||
Update your Continue configuration file (`~/.continue/config.json` or `~/.continue/config.yaml`) with your TARS API key:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: TARS GPT-5 Mini
|
||||
provider: tars
|
||||
model: gpt-5-mini
|
||||
apiKey: <YOUR_TARS_API_KEY>
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "TARS GPT-5 Mini",
|
||||
"provider": "tars",
|
||||
"model": "gpt-5-mini",
|
||||
"apiKey": "<YOUR_TARS_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Available Models
|
||||
|
||||
TARS supports routing to various models. Go to the [Tetrate Agent Router Service model catalog](https://router.tetrate.ai/models) for a full list of supported models.
|
||||
|
|
@ -33,6 +33,7 @@ Beyond the top-level providers, Continue supports many other options:
|
|||
| [Together AI](/customize/model-providers/more/together) | Platform for running a variety of open models |
|
||||
| [DeepInfra](/customize/model-providers/more/deepinfra) | Hosting for various open source models |
|
||||
| [OpenRouter](/customize/model-providers/top-level/openrouter) | Gateway to multiple model providers |
|
||||
| [Tetrate Agent Router Service](/customize/model-providers/top-level/tetrate_agent_router_service) | Gateway with intelligent routing across multiple model providers |
|
||||
| [Cohere](/customize/model-providers/more/cohere) | Models specialized for semantic search and text generation |
|
||||
| [NVIDIA](/customize/model-providers/more/nvidia) | GPU-accelerated model hosting |
|
||||
| [Cloudflare](/customize/model-providers/more/cloudflare) | Edge-based AI inference services |
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ sidebarTitle: "OpenAI"
|
|||
"models": [
|
||||
{
|
||||
"title": "<MODEL_NAME>",
|
||||
"provider": "openai",
|
||||
"provider": "openai",
|
||||
"model": "<MODEL_ID>",
|
||||
"apiKey": "<YOUR_OPENAI_API_KEY>"
|
||||
}
|
||||
|
|
@ -56,6 +56,7 @@ OpenAI API compatible providers include
|
|||
- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples)
|
||||
- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html)
|
||||
- [BerriAI/litellm](https://github.com/BerriAI/litellm)
|
||||
- [Tetrate Agent Router Service](https://router.tetrate.ai)
|
||||
|
||||
If you are using an OpenAI API compatible providers, you can change the `apiBase` like this:
|
||||
|
||||
|
|
@ -75,7 +76,7 @@ If you are using an OpenAI API compatible providers, you can change the `apiBase
|
|||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
|
||||
"title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
|
||||
"provider": "openai",
|
||||
"model": "<MODEL_NAME>",
|
||||
"apiKey": "<YOUR_CUSTOM_API_KEY>",
|
||||
|
|
@ -110,7 +111,7 @@ To force usage of `chat/completions` instead of `completions` endpoint you can s
|
|||
"title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
|
||||
"provider": "openai",
|
||||
"model": "<MODEL_NAME>",
|
||||
"apiBase": "http://localhost:8000/v1",
|
||||
"apiBase": "http://localhost:8000/v1",
|
||||
"useLegacyCompletionsEndpoint": true
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
---
|
||||
title: "Tetrate Agent Router Service"
|
||||
sidebarTitle: "Tetrate Agent Router Service"
|
||||
slug: ../tetrate-agent-router-service
|
||||
---
|
||||
|
||||
The **Tetrate Agent Router Service** provides a unified Gateway for accessing various AI models with fast inference capabilities as well as embedding services.
|
||||
|
||||
This gateway acts as an intelligent router that can distribute requests across multiple model providers, offering enterprise-grade reliability and performance optimization.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Obtain an API key from the [Agent Router Service portal](https://api.router.tetrate.ai/)
|
||||
2. Configure Continue to use Agent Router Service as your model provider
|
||||
|
||||
## Configuring Models
|
||||
|
||||
You can also quickly use models from Tetrate on the Cotninue Hub by visiting Tetrate on the Continue Hub [here](https://hub.continue.dev/tetrate). The easiest way if you don't see the model you want to use is to remix one of the models on the Tetrate page and change the model to the one you want to use.
|
||||
|
||||

|
||||
|
||||
### Available Models
|
||||
|
||||
Agent Router Service supports routing to various models.
|
||||
Go to the [Agent Router Service model catalog](https://router.tetrate.ai/models) for a full list of supported models.
|
||||
|
||||
## Configuration Options
|
||||
|
||||
As Agent Router Service is an OpenAI API compatible provider, you can configure it like any other OpenAI API compatible provider. Therefore you will be setting `provider: openai` and `apiBase: https://api.router.tetrate.ai/v1`.
|
||||
|
||||
Update your Continue configuration file (`~/.continue/config.yaml`) with your Agent Router Service API key:
|
||||
|
||||
### On your local machine
|
||||
|
||||
#### In your config.yaml
|
||||
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: <MODEL_NAME>
|
||||
provider: openai
|
||||
model: <MODEL_ID>
|
||||
apiKey: <TETRATE_API_KEY>
|
||||
apiBase: https://api.router.tetrate.ai/v1
|
||||
```
|
||||
|
||||
#### As a local model block
|
||||
|
||||
Review the configuration reference for [model blocks](/reference#models) and using [local blocks](/reference#local-blocks). Ensure you look at the roles and capabilities section and review the [model capabilities guide](/customize/deep-dives/model-capabilities).
|
||||
|
||||
```yaml title="model_name.yaml"
|
||||
name: <MODEL_NAME>
|
||||
models:
|
||||
- name: <MODEL_NAME>
|
||||
provider: openai
|
||||
model: <MODEL_ID>
|
||||
apiKey: ${{ inputs.TETRATE_API_KEY }}
|
||||
apiBase: https://api.router.tetrate.ai/v1
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
capabilities:
|
||||
- tool_use
|
||||
```
|
||||
|
||||
### On Model Block on Continue Hub
|
||||
Learn how to use model blocks on Continue Hub [here](/hub/blocks/create-a-block).
|
||||
|
||||
```yaml title="model_name.yaml"
|
||||
name: <MODEL_NAME>
|
||||
models:
|
||||
- name: <MODEL_NAME>
|
||||
provider: openai
|
||||
model: <MODEL_ID>
|
||||
apiKey: ${{ inputs.TETRATE_API_KEY }}
|
||||
apiBase: https://api.router.tetrate.ai/v1
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
capabilities:
|
||||
- tool_use
|
||||
```
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
title: "Model roles"
|
||||
sidebarTitle: Overview
|
||||
icon: "circle-info"
|
||||
description: "Learn about the different model roles in Continue including chat, autocomplete, edit, apply, embeddings, and reranking for customizing your AI coding assistant's capabilities"
|
||||
description: "Learn about the different model roles in Continue including chat, autocomplete, edit, apply, embeddings, and reranking for customizing your AI coding agent's capabilities"
|
||||
---
|
||||
|
||||
<CardGroup>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ These roles can be specified for a `config.yaml` model block using `roles`. See
|
|||
|
||||
## Selecting model roles
|
||||
|
||||
You can control which of the models in your assistant for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
You can control which of the models in your agent for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ These roles can be specified for a `config.yaml` model block using `roles`. See
|
|||
|
||||
## Selecting model roles
|
||||
|
||||
You can control which of the models in your assistant for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
You can control which of the models in your agent for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
|
||||
<Frame>
|
||||
<img src="/images/settings-model-roles-5e5f8a6bd9137b70cf94178a7e45847c.png" />
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@
|
|||
"customize/model-providers/top-level/ollama",
|
||||
"customize/model-providers/top-level/openrouter",
|
||||
"customize/model-providers/top-level/openai",
|
||||
"customize/model-providers/top-level/tetrate_agent_router_service",
|
||||
"customize/model-providers/top-level/vertexai"
|
||||
]
|
||||
},
|
||||
|
|
@ -179,13 +180,13 @@
|
|||
"pages": [
|
||||
"hub/introduction",
|
||||
{
|
||||
"group": "Assistants",
|
||||
"group": "agents",
|
||||
"icon": "robot",
|
||||
"pages": [
|
||||
"hub/assistants/intro",
|
||||
"hub/assistants/use-an-assistant",
|
||||
"hub/assistants/create-an-assistant",
|
||||
"hub/assistants/edit-an-assistant"
|
||||
"hub/agents/intro",
|
||||
"hub/agents/use-an-agent",
|
||||
"hub/agents/create-an-agent",
|
||||
"hub/agents/edit-an-agent"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -228,11 +229,15 @@
|
|||
"group": "Guides",
|
||||
"pages": [
|
||||
"guides/overview",
|
||||
"guides/understanding-assistants",
|
||||
"guides/understanding-agents",
|
||||
"guides/codebase-documentation-awareness",
|
||||
"guides/cli",
|
||||
"guides/continuous-ai",
|
||||
<<<<<<< HEAD
|
||||
"guides/posthog-github-continuous-ai",
|
||||
=======
|
||||
"guides/continuous-ai-readiness-assessment",
|
||||
>>>>>>> main
|
||||
"guides/plan-mode-guide",
|
||||
"guides/ollama-guide",
|
||||
"guides/instinct",
|
||||
|
|
@ -349,17 +354,13 @@
|
|||
"source": "/hub/secrets",
|
||||
"destination": "/hub/secrets/secret-types"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants",
|
||||
"destination": "/hub/assistants/intro"
|
||||
},
|
||||
{
|
||||
"source": "/hub/blocks",
|
||||
"destination": "/hub/blocks/intro"
|
||||
},
|
||||
{
|
||||
"source": "/hub/agents/intro",
|
||||
"destination": "/hub/assistants/intro"
|
||||
"destination": "/hub/agents/intro"
|
||||
},
|
||||
{
|
||||
"source": "/customize",
|
||||
|
|
@ -1107,7 +1108,7 @@
|
|||
},
|
||||
{
|
||||
"source": "/troubleshooting#changes-to-assistants-not-showing-in-vs-code",
|
||||
"destination": "/faqs#changes-to-assistants-not-showing-in-vs-code"
|
||||
"destination": "/faqs#changes-to-agents-not-showing-in-vs-code"
|
||||
},
|
||||
{
|
||||
"source": "/troubleshooting#i-installed-continue-but-dont-see-the-sidebar-window",
|
||||
|
|
@ -1176,6 +1177,26 @@
|
|||
{
|
||||
"source": "/features/edit/next-edit",
|
||||
"destination": "/features/autocomplete/next-edit"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/intro",
|
||||
"destination": "/hub/agents/intro"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/use-an-assistant",
|
||||
"destination": "/hub/agents/use-an-agent"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/create-an-assistant",
|
||||
"destination": "/hub/agents/create-an-agent"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/edit-an-assistant",
|
||||
"destination": "/hub/agents/edit-an-agent"
|
||||
},
|
||||
{
|
||||
"source": "/guides/understanding-assistants",
|
||||
"destination": "/guides/understanding-agents"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ If you are using VS Code and require requests to be made through a proxy, you ar
|
|||
|
||||
Continue can be used in [code-server](https://coder.com/), but if you are running across an error in the logs that includes "This is likely because the editor is not running in a secure context", please see [their documentation on securely exposing code-server](https://coder.com/docs/code-server/latest/guide#expose-code-server).
|
||||
|
||||
## Changes to assistants not showing in VS Code
|
||||
## Changes to agents not showing in VS Code
|
||||
|
||||
If you've made changes to assistants (adding, modifying, or removing them) but the changes aren't appearing in the Continue extension in VS Code, try reloading the VS Code window:
|
||||
If you've made changes to agents (adding, modifying, or removing them) but the changes aren't appearing in the Continue extension in VS Code, try reloading the VS Code window:
|
||||
|
||||
1. Open the command palette (`cmd/ctrl` + `shift` + `P`)
|
||||
2. Type "Reload Window"
|
||||
3. Select the reload option
|
||||
|
||||
This will restart VS Code and reload all extensions, which should make your assistant changes visible.
|
||||
This will restart VS Code and reload all extensions, which should make your agent changes visible.
|
||||
|
||||
## I installed Continue, but don't see the sidebar window
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ If you're getting parse errors with remote Ollama:
|
|||
|
||||
3. **Check URL format**: Ensure you're using `http://` not `https://` for local network addresses
|
||||
|
||||
## Local Assistant
|
||||
## Local Agent
|
||||
|
||||
### Managing Local Secrets and Environment Variables
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ If your API keys aren't being recognized:
|
|||
|
||||
### Using Model Addons Locally
|
||||
|
||||
You can leverage model addons from the Continue Hub in your local assistant configurations using the `uses:` syntax. This allows you to reference pre-configured model blocks without duplicating configuration.
|
||||
You can leverage model addons from the Continue Hub in your local agent configurations using the `uses:` syntax. This allows you to reference pre-configured model blocks without duplicating configuration.
|
||||
|
||||
#### Requirements
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ You can leverage model addons from the Continue Hub in your local assistant conf
|
|||
In your local `config.yaml`, reference model addons using the format `provider/model-name`:
|
||||
|
||||
```yaml
|
||||
name: My Local Assistant
|
||||
name: My Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
@ -344,7 +344,7 @@ models:
|
|||
You can combine hub model addons with local models:
|
||||
|
||||
```yaml
|
||||
name: My Local Assistant
|
||||
name: My Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ sidebarTitle: "Customize Agent"
|
|||
|
||||
## How to Add Rules Blocks
|
||||
|
||||
Adding Rules can be done in your assistant locally or in the Hub. You can explore Rules on the Continue Hub and refer to the [Rules deep dive](/customize/deep-dives/rules) for more details.
|
||||
Adding Rules can be done in your agent locally or in the Hub. You can explore Rules on the Continue Hub and refer to the [Rules deep dive](/customize/deep-dives/rules) for more details.
|
||||
|
||||
## How to Customize System Messages
|
||||
|
||||
|
|
@ -18,14 +18,14 @@ models:
|
|||
provider: openai
|
||||
model: gpt-4o
|
||||
chatOptions:
|
||||
baseSystemMessage: "You are a helpful coding assistant."
|
||||
baseAgentSystemMessage: "You are a systematic coding assistant. Break down problems methodically."
|
||||
basePlanSystemMessage: "You are a planning assistant. Create clear, actionable steps."
|
||||
baseSystemMessage: "You are a helpful coding agent."
|
||||
baseAgentSystemMessage: "You are a systematic coding agent. Break down problems methodically."
|
||||
basePlanSystemMessage: "You are a planning agent. Create clear, actionable steps."
|
||||
```
|
||||
|
||||
## How to Add MCP Tools
|
||||
|
||||
You can add MCP servers to your assistant to give Agent access to more tools. Explore [MCP Servers on the Hub](https://hub.continue.dev) and consult the [MCP guide](/customize/deep-dives/mcp) for more details.
|
||||
You can add MCP servers to your agent to give Agent access to more tools. Explore [MCP Servers on the Hub](https://hub.continue.dev) and consult the [MCP guide](/customize/deep-dives/mcp) for more details.
|
||||
|
||||
## How to Configure Tool Policies
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ title: “Customize Autocomplete Settings in Continue”
|
|||
description: “Learn how to customize autocomplete behavior in Continue, including user settings, configuration options, and adjustments to improve AI code suggestions in your IDE.”
|
||||
---
|
||||
|
||||
Continue offers a handful of settings to customize autocomplete behavior. Visit the [User Settings Page](/customize/settings) to manage these settings.
|
||||
Continue offers a handful of settings to customize autocomplete behavior. Visit the User Settings Page (Gear Icon) to manage these settings.
|
||||
|
||||
For a comprehensive guide on all configuration options and their impacts, see the [Autocomplete deep dive](/customize/deep-dives/autocomplete).
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ sidebarTitle: "Customize Edit"
|
|||
|
||||
## How to Set Active Edit/Apply Model
|
||||
|
||||
You can configure particular models from your Assistant to be used for Edit and Apply requests.
|
||||
You can configure particular models from your Agent to be used for Edit and Apply requests.
|
||||
|
||||
1. Click the 3 dots above the main input
|
||||
2. Click the cube icon to expand the "Models" section
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "Understanding Assistants"
|
||||
title: "Understanding Agents"
|
||||
description: "Continue offers two ways to configure your AI assistants"
|
||||
---
|
||||
|
||||
This content has moved to our comprehensive guide: [Understanding Assistants: Hub vs Local Configuration](/guides/understanding-assistants)
|
||||
This content has moved to our comprehensive guide: [Understanding Agents: Hub vs Local Configuration](/guides/understanding-assistants)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ The Continue logo will appear on the left sidebar. For a better experience, move
|
|||
</Step>
|
||||
|
||||
<Step title="Sign In">
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first assistant
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first agent
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ Click `Install`, which will cause the Continue logo to show up on the right tool
|
|||
</Step>
|
||||
|
||||
<Step title="Sign In">
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first assistant
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first agent
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
|
|
@ -68,6 +68,6 @@ Click `Install`, which will cause the Continue logo to show up on the right tool
|
|||
|
||||
## Signing in
|
||||
|
||||
Click "Get started" to sign in to the hub and start using assistants.
|
||||
Click "Get started" to sign in to the hub and start using agents.
|
||||
|
||||

|
||||
|
|
|
|||
|
|
@ -57,6 +57,6 @@ description: "To quickly understand what you can do with Continue, check out eac
|
|||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## AI Coding Assistants
|
||||
## AI Coding Agents
|
||||
|
||||
Continue offers flexible AI assistants that enhance your development workflow. You can choose between cloud-managed **Hub Assistants** for easy setup and synchronization, or **Local Assistants** for complete control and privacy. Learn more about [understanding and configuring assistants](/guides/understanding-assistants).
|
||||
Continue offers flexible AI assistants that enhance your development workflow. You can choose between cloud-managed **Hub Agents** for easy setup and synchronization, or **Local Agents** for complete control and privacy. Learn more about [understanding and configuring assistants](/guides/understanding-assistants).
|
||||
|
|
|
|||
|
|
@ -247,12 +247,12 @@ Ready to master specific features? Check out these detailed guides:
|
|||
|
||||
<Accordion title="Chat & Agent Best Practices">
|
||||
Discover [effective prompting techniques](/customize/deep-dives/prompts), [hub
|
||||
v. local assistants](/guides/understanding-assistants), and [custom slash
|
||||
v. local agents](/guides/understanding-agents), and [custom slash
|
||||
commands](/customize/deep-dives/slash-commands).
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Enterprise & Teams">
|
||||
Explore [Hub Assistants](/hub/assistants/intro), [organization
|
||||
Explore [Hub Agents](/hub/agents/intro), [organization
|
||||
management](/hub/governance/creating-an-org), and [sharing
|
||||
configurations](/hub/sharing).
|
||||
</Accordion>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
---
|
||||
title: How to make your agent aware of codebases and documentation
|
||||
title: How to Make Your Agent Aware of Codebases and Documentation
|
||||
description: Learn how to give your AI agent access to codebases and documentation for more context-aware assistance
|
||||
keywords: [agent, codebase, documentation, MCP, context, RAG, tools]
|
||||
sidebarTitle: Codebase and Documentation Awareness
|
||||
---
|
||||
|
||||
# How to make your agent aware of codebases and documentation
|
||||
|
||||
AI coding agents work best when they understand the context of your project. This guide shows you how to give your agent access to codebases and documentation, making it more helpful and accurate.
|
||||
|
||||
## Make your agent aware of your open codebase
|
||||
|
|
@ -28,18 +27,21 @@ Rules guide your agent's behavior and understanding. Place markdown files in `.c
|
|||
# Project Architecture
|
||||
|
||||
This is a React application with:
|
||||
|
||||
- Components in `/src/components`
|
||||
- API routes in `/src/api`
|
||||
- State management using Redux in `/src/store`
|
||||
|
||||
## Coding Standards
|
||||
|
||||
- Use TypeScript for all new files
|
||||
- Follow the existing naming conventions
|
||||
- Write tests for all new features
|
||||
```
|
||||
|
||||
<Tip>
|
||||
Place rules files at different levels of your project hierarchy to scope when they trigger
|
||||
Place rules files at different levels of your project hierarchy to scope when
|
||||
they trigger
|
||||
</Tip>
|
||||
|
||||
Learn more about [rules configuration](/customize/deep-dives/rules).
|
||||
|
|
@ -60,6 +62,7 @@ Create rules that point to external codebases:
|
|||
# External Dependencies
|
||||
|
||||
Our authentication system is based on:
|
||||
|
||||
- [Auth.js documentation](https://authjs.dev/)
|
||||
- [Example implementation](https://github.com/nextauthjs/next-auth-example)
|
||||
|
||||
|
|
@ -76,6 +79,7 @@ Add rules to guide CLI usage:
|
|||
# Repository Access
|
||||
|
||||
You can use the `gh` CLI to:
|
||||
|
||||
- Search for issues: `gh issue list --repo owner/repo`
|
||||
- View pull requests: `gh pr list --repo owner/repo`
|
||||
- Clone repositories: `gh repo clone owner/repo`
|
||||
|
|
@ -86,6 +90,7 @@ You can use the `gh` CLI to:
|
|||
[DeepWiki MCP](https://hub.continue.dev/deepwiki/deepwiki-mcp) lets your agent explore any public GitHub repository.
|
||||
|
||||
Once configured, your agent can explore repositories like:
|
||||
|
||||
- "Explore the React repository structure"
|
||||
- "Find how authentication is implemented in NextAuth.js"
|
||||
|
||||
|
|
@ -115,6 +120,7 @@ Guide your agent to relevant documentation:
|
|||
# Documentation Resources
|
||||
|
||||
For framework-specific questions, refer to:
|
||||
|
||||
- React: https://react.dev/reference/react
|
||||
- Next.js: https://nextjs.org/docs
|
||||
- Tailwind CSS: https://tailwindcss.com/docs
|
||||
|
|
@ -127,6 +133,7 @@ Always cite documentation when explaining concepts.
|
|||
[Context7 MCP](https://hub.continue.dev/upstash/context7-mcp) enables your agent to search and retrieve information from public documentation:
|
||||
|
||||
Your agent can then answer questions like:
|
||||
|
||||
- "How do I use React hooks?"
|
||||
- "What's the syntax for Tailwind CSS animations?"
|
||||
|
||||
|
|
@ -142,6 +149,7 @@ Create rules that reference internal resources:
|
|||
# Internal Documentation
|
||||
|
||||
Our team documentation is available at:
|
||||
|
||||
- API Documentation: https://internal.docs/api
|
||||
- Architecture Guide: https://internal.docs/architecture
|
||||
- Deployment Process: https://internal.docs/deployment
|
||||
|
|
|
|||
309
docs/guides/continuous-ai-readiness-assessment.mdx
Normal file
309
docs/guides/continuous-ai-readiness-assessment.mdx
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
---
|
||||
title: Assessing Your Team's Readiness for Continuous AI
|
||||
description: Complete framework to evaluate team readiness for Continuous AI adoption with maturity levels, assessment criteria, and implementation roadmap.
|
||||
sidebarTitle: Continuous AI Readiness Assessment
|
||||
---
|
||||
|
||||
<Info>
|
||||
**TL;DR:** Use this assessment framework to determine if your team is ready to
|
||||
move from individual AI tool usage to automated Continuous AI workflows.
|
||||
Covers technical infrastructure, processes, culture, and organizational
|
||||
support.
|
||||
</Info>
|
||||
|
||||
## Assessing Continuous AI Readiness
|
||||
|
||||
Continuous AI can dramatically improve development velocity and code quality, but successful implementation requires careful evaluation across four key dimensions.
|
||||
|
||||
<Warning>
|
||||
Rushing into Continuous AI without proper foundations leads to frustration and
|
||||
failed initiatives. Use this framework to identify gaps before scaling.
|
||||
</Warning>
|
||||
|
||||
### 1. Identify Your Current Maturity Level
|
||||
|
||||
Determine where your team falls on the Continuous AI maturity spectrum:
|
||||
|
||||
<CardGroup cols={1}>
|
||||
<Card title="Level 1: Manual AI Assistance" icon="user">
|
||||
Developers use AI tools inconsistently with highly variable results.
|
||||
|
||||
**Characteristics:**
|
||||
- High rejection rates of AI-generated code (>50%)
|
||||
- No shared standards or prompting rules
|
||||
- AI tools lack context about your codebase
|
||||
- Ad-hoc usage without team coordination
|
||||
|
||||
</Card>
|
||||
|
||||
<Card title="Level 2: Workflow Automation" icon="gear">
|
||||
AI is systematically integrated into team workflows and CI/CD pipelines.
|
||||
|
||||
**Characteristics:**
|
||||
|
||||
- Consistent adoption across 80%+ of team members
|
||||
- AI integrated into code reviews and deployment processes
|
||||
- Documented standards for prompts and tool usage
|
||||
- Basic metrics tracking AI impact
|
||||
|
||||
</Card>
|
||||
|
||||
<Card title="Level 3: Zero-Intervention Workflows" icon="robot">
|
||||
Certain development processes run autonomously with minimal human oversight.
|
||||
|
||||
**Characteristics:**
|
||||
- Human intervention rates below 15%
|
||||
- Robust monitoring and automated rollback systems
|
||||
- Measurable ROI from automation initiatives
|
||||
- Advanced context awareness and learning loops
|
||||
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### 2. Evaluate Readiness Across Four Key Dimensions
|
||||
|
||||
Assess your team's strengths and potential risks across these critical areas:
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Technical Infrastructure Assessment">
|
||||
**Key Questions:**
|
||||
- Do our development tools integrate reliably?
|
||||
- Can we measure AI effectiveness and impact?
|
||||
- Are security policies compatible with AI workflows?
|
||||
|
||||
**🟢 Green Flags:**
|
||||
- Stable tool integrations with >99.5% uptime
|
||||
- Comprehensive monitoring and observability
|
||||
- Security policies that support AI tool usage
|
||||
- Automated testing and deployment pipelines
|
||||
|
||||
**🔴 Red Flags:**
|
||||
- Frequent integration breakdowns
|
||||
- No performance tracking or metrics
|
||||
- Restrictive security policies blocking AI tools
|
||||
- Manual deployment processes
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Process Maturity Assessment">
|
||||
**Key Questions:**
|
||||
- Are our development workflows consistent and documented?
|
||||
- Do we have quality gates and review processes?
|
||||
- Can we reproduce builds and deployments reliably?
|
||||
|
||||
**🟢 Green Flags:**
|
||||
- Clear coding standards and style guides
|
||||
- Automated CI/CD with quality gates
|
||||
- Documented, repeatable processes
|
||||
- Consistent code review practices
|
||||
|
||||
**🔴 Red Flags:**
|
||||
- Inconsistent code reviews
|
||||
- Ad-hoc deployment processes
|
||||
- "Works on my machine" culture
|
||||
- Undocumented tribal knowledge
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Team Culture & Skills Assessment">
|
||||
**Key Questions:**
|
||||
- Are developers open to adopting new AI-powered workflows?
|
||||
- How does the team handle experimentation and failure?
|
||||
- Do team members collaborate effectively on new initiatives?
|
||||
|
||||
**🟢 Green Flags:**
|
||||
- High curiosity and willingness to experiment
|
||||
- Collaborative problem-solving culture
|
||||
- Constructive feedback and learning mindset
|
||||
- Active knowledge sharing practices
|
||||
|
||||
**🔴 Red Flags:**
|
||||
|
||||
- Strong resistance to workflow changes
|
||||
- Blame culture around mistakes
|
||||
- Perfectionism blocking experimentation
|
||||
- Siloed work with minimal collaboration
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Organizational Support Assessment">
|
||||
**Key Questions:**
|
||||
- Does leadership provide budget and resources for AI initiatives?
|
||||
- Is there tolerance for experimentation and learning?
|
||||
- Are expectations realistic for ROI timelines?
|
||||
|
||||
**🟢 Green Flags:**
|
||||
- Executive buy-in and strategic alignment
|
||||
- Dedicated budget for training and tools
|
||||
- 3-6 month ROI expectations
|
||||
- Support for calculated risk-taking
|
||||
|
||||
**🔴 Red Flags:**
|
||||
- Pressure for immediate ROI (weeks)
|
||||
- No allocated budget for AI initiatives
|
||||
- High risk aversion culture
|
||||
- Lack of leadership engagement
|
||||
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
### 3. Critical Warning Signs
|
||||
|
||||
<Warning>
|
||||
**Stop and address these issues before scaling Continuous AI:**
|
||||
</Warning>
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Technical Red Flags" icon="triangle-exclamation">
|
||||
- Builds breaking regularly (>5% failure rate)
|
||||
- Unstable deployments or rollback frequency >10%
|
||||
- No monitoring or observability systems
|
||||
- Critical security policy conflicts
|
||||
|
||||
</Card>
|
||||
|
||||
<Card title="Team & Culture Red Flags" icon="users-slash">
|
||||
- More than 30% of team opposed to AI tools
|
||||
- No established feedback or learning culture
|
||||
- History of failed automation initiatives
|
||||
- Resistance to changing existing workflows
|
||||
|
||||
</Card>
|
||||
|
||||
<Card title="Process Red Flags" icon="exclamation-triangle">
|
||||
- Inconsistent development workflows
|
||||
- No quality gates or review processes
|
||||
- Manual deployment and testing processes
|
||||
- Lack of documentation and standards
|
||||
|
||||
</Card>
|
||||
|
||||
<Card title="Organizational Red Flags" icon="building">
|
||||
- Leadership expecting ROI in weeks vs months
|
||||
- No allocated budget for AI initiatives
|
||||
- High pressure, low experimentation tolerance
|
||||
- Lack of strategic alignment on AI adoption
|
||||
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### 4. Implementation Roadmap
|
||||
|
||||
Based on your assessment results, follow this step-by-step approach:
|
||||
|
||||
<Steps>
|
||||
<Step title="Establish Baseline Metrics">
|
||||
Document current performance across key areas:
|
||||
|
||||
- Development velocity (story
|
||||
points, cycle time)
|
||||
- Code quality metrics (bug rates, technical debt)
|
||||
- Review times and approval rates
|
||||
- Developer satisfaction and productivity
|
||||
scores
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Select Initial Automation Target">
|
||||
Choose one high-impact, low-risk workflow to automate first:
|
||||
|
||||
- **Code Review:** Automated analysis and suggestions
|
||||
- **Documentation:** Auto-generated API docs and README updates
|
||||
- **Testing:** Automated test generation and maintenance
|
||||
- **Refactoring:** Systematic code improvement suggestions
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Standardize Team AI Usage">
|
||||
Create and document consistent practices:
|
||||
- AI tool selection and configuration guidelines
|
||||
|
||||
- Prompting standards and best practices
|
||||
|
||||
- Quality gates and review processes
|
||||
|
||||
- Security and compliance requirements
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Pilot and Measure Impact">
|
||||
Run controlled experiments with success criteria:
|
||||
- Start with 2-3 team members for 2-4 weeks
|
||||
- Track metrics against baseline performance
|
||||
- Gather qualitative feedback on developer experience
|
||||
- Document lessons learned and optimization opportunities
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Scale Deliberately">
|
||||
Expand successful pilots across the organization:
|
||||
- Roll out to additional team members gradually
|
||||
- Implement monitoring and alerting systems
|
||||
- Establish feedback loops for continuous improvement
|
||||
- Plan next automation targets based on results
|
||||
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="Building Async Agents with Continue CLI"
|
||||
icon="blog"
|
||||
href="https://blog.continue.dev/building-async-agents-with-continue-cli/"
|
||||
>
|
||||
Comprehensive explanation of maturity levels and organizational readiness
|
||||
factors
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title="Developer's Guide"
|
||||
icon="book"
|
||||
href="https://docs.continue.dev/guides/continuous-ai"
|
||||
>
|
||||
Technical implementation details and best practices for Continuous AI
|
||||
workflows
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Quick Assessment Checklist
|
||||
|
||||
<Tip>
|
||||
**Ready to get started?** Use this quick checklist to gauge your immediate
|
||||
readiness:
|
||||
</Tip>
|
||||
|
||||
**Technical Foundation (Score: \_\_\_/4)**
|
||||
|
||||
- Stable CI/CD pipelines with \<5% failure rate
|
||||
- Monitoring and observability systems in place
|
||||
- Security policies support AI tool integration
|
||||
- Development environment standardization
|
||||
|
||||
**Process Maturity (Score: \_\_\_/4)**
|
||||
|
||||
- Documented coding standards and review processes
|
||||
- Consistent deployment and rollback procedures
|
||||
- Quality gates and automated testing
|
||||
- Regular retrospectives and process improvement
|
||||
|
||||
**Team Culture (Score: \_\_\_/4)**
|
||||
|
||||
- \<30% resistance to AI tool adoption
|
||||
- Active experimentation and learning culture
|
||||
- Collaborative problem-solving approach
|
||||
- Constructive feedback and knowledge sharing
|
||||
|
||||
**Organizational Support (Score: \_\_\_/4)**
|
||||
|
||||
- Leadership buy-in and strategic alignment
|
||||
- Dedicated budget for AI initiatives and training
|
||||
- 3-6 month ROI expectations (not weeks)
|
||||
- Support for calculated risk-taking
|
||||
|
||||
---
|
||||
|
||||
**Overall Readiness Score: \_\_\_/16**
|
||||
|
||||
- **12-16:** Ready to begin Continuous AI implementation
|
||||
- **8-11:** Address gaps in 1-2 areas before scaling
|
||||
- **\<8:** Focus on foundational improvements first
|
||||
|
|
@ -123,8 +123,8 @@ Track how often you need to correct AI output. Lower intervention rates mean hig
|
|||
Imagine setting up an AI agent that checks new GitHub issues every morning and leaves the first helpful response. This lightens the load for maintainers and ensures community members feel heard quickly.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Pattern 2: The PR Review Assistant">
|
||||
AI can automatically review new pull requests for security, performance, and style issues. The reviewer still has the final say, but the assistant highlights common problems and speeds up the feedback loop.
|
||||
<Accordion title="Pattern 2: The PR Review Agent">
|
||||
AI can automatically review new pull requests for security, performance, and style issues. The reviewer still has the final say, but the agent highlights common problems and speeds up the feedback loop.
|
||||
|
||||
</Accordion>
|
||||
<Accordion title="Pattern 3: The Documentation Guardian">
|
||||
|
|
@ -203,5 +203,5 @@ Ready to amplify your development workflow with Continuous AI? Start with one si
|
|||
|
||||
<Card title="Want to dive deeper?" icon="rocket">
|
||||
Check out our guides on [Continue CLI](/guides/cli) and [Understanding
|
||||
Assistants](/guides/understanding-assistants).
|
||||
Agents](/guides/understanding-agents).
|
||||
</Card>
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ There are multiple ways to configure Ollama models in Continue:
|
|||
|
||||
The easiest way is to use [pre-configured model blocks](/reference#local-blocks) from the Continue Hub in your local configuration:
|
||||
|
||||
```yaml title="~/.continue/assistants/My Local Assistant.yaml"
|
||||
name: My Local Assistant
|
||||
```yaml title="~/.continue/agents/My Local Agent.yaml"
|
||||
name: My Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
@ -309,11 +309,11 @@ ollama pull deepseek-r1:32b
|
|||
#### Using Hub Blocks in Local Config
|
||||
|
||||
**Problem**: Unclear how to use hub models locally
|
||||
**Solution**: Create a local assistant file:
|
||||
**Solution**: Create a local agent file:
|
||||
|
||||
```yaml
|
||||
# ~/.continue/assistants/Local.yaml
|
||||
name: Local Assistant
|
||||
# ~/.continue/agents/Local.yaml
|
||||
name: Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ description: "Comprehensive collection of practical guides for Continue includin
|
|||
|
||||
- [Continuous AI: A Developer's Guide](/guides/continuous-ai) - Integrating AI into development workflows
|
||||
- [How to Use Continue CLI (cn)](/guides/cli) - Command-line interface for Continue
|
||||
- [Continuous AI Readiness Assessment](/guides/continuous-ai-readiness-assessment) - Evaluate team readiness for Continuous AI adoption
|
||||
- [PostHog Session Analysis with Continue CLI](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation
|
||||
|
||||
## What Advanced Tutorials Are Available
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue