Merge branch 'main' into dallin/context-defaults
This commit is contained in:
commit
3d942da4c2
60 changed files with 692 additions and 138 deletions
|
|
@ -52,7 +52,7 @@ Retrieve the following sites per these providers, and consider these notes on ho
|
|||
// TODO: add info for openai, ollama, etc
|
||||
|
||||
For any other providers, search the web for "latest [provider] models" and find the most relevant model information using your best judgement.
|
||||
Generally, ignore models that do not support text output. These models will be used in a coding assistant client that only supports text/image input and text/output, so extraneous capabilities can be ignored.
|
||||
Generally, ignore models that do not support text output. These models will be used in a coding agent client that only supports text/image input and text/output, so extraneous capabilities can be ignored.
|
||||
Sometimes, "Experimental", "Preview", or similar versions of models are available. The latest-date version of each should have its own information maintained.
|
||||
|
||||
3. UPDATE THE INFORMATION
|
||||
|
|
|
|||
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -29,7 +29,7 @@ body:
|
|||
- **Continue version**: v0.9.4
|
||||
- **IDE version**: VSCode 1.85.1
|
||||
- Model: Claude Sonnet 3.5
|
||||
- Assistant configuration
|
||||
- Agent configuration
|
||||
value: |
|
||||
- OS:
|
||||
- Continue version:
|
||||
|
|
@ -39,7 +39,7 @@ body:
|
|||
```yaml
|
||||
|
||||
```
|
||||
OR link to assistant in Continue hub:
|
||||
OR link to agent in Continue hub:
|
||||
render: Markdown
|
||||
validations:
|
||||
required: false
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Run Detailed PR Review
|
||||
uses: continuedev/continue/actions/detailed-review@23d9260536372acf4eb57a41e6ab62bc5869b070
|
||||
uses: continuedev/continue/actions/detailed-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe
|
||||
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@23d9260536372acf4eb57a41e6ab62bc5869b070
|
||||
uses: continuedev/continue/actions/general-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe
|
||||
with:
|
||||
continue-api-key: ${{ secrets.CONTINUE_API_KEY }}
|
||||
continue-org: "continuedev"
|
||||
|
|
|
|||
3
.github/workflows/reusable-release.yml
vendored
3
.github/workflows/reusable-release.yml
vendored
|
|
@ -51,6 +51,9 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup packages
|
||||
uses: ./.github/actions/setup-packages
|
||||
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -170,4 +170,5 @@ extensions/.continue-debug/
|
|||
|
||||
.continuerules
|
||||
**/.continue/assistants/
|
||||
**/.continue/agents/
|
||||
keys
|
||||
|
|
@ -288,4 +288,4 @@ We require all contributors to accept the CLA and have made it as easy as commen
|
|||
I have read the CLA Document and I hereby sign the CLA
|
||||
```
|
||||
|
||||
3. The CLA‑Assistant bot records your signature in the repo and marks the status check as passed.
|
||||
3. The CLA-Assistant bot records your signature in the repo and marks the status check as passed.
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ We recommend using a specific commit SHA for stability and predictability:
|
|||
Example:
|
||||
|
||||
```yaml
|
||||
uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a984af13f8266
|
||||
uses: continuedev/continue/actions/general-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
|
|
|||
|
|
@ -29,12 +29,17 @@ runs:
|
|||
SHOULD_RUN="false"
|
||||
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
# Check PR author association
|
||||
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
|
||||
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
|
||||
SHOULD_RUN="true"
|
||||
# Check if PR is a draft
|
||||
if [ "${{ github.event.pull_request.draft }}" = "true" ]; then
|
||||
echo "::notice::Skipping review - PR is a draft"
|
||||
else
|
||||
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
|
||||
# Check PR author association
|
||||
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
|
||||
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
|
||||
SHOULD_RUN="true"
|
||||
else
|
||||
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
|
||||
fi
|
||||
fi
|
||||
elif [ "${{ github.event_name }}" = "issue_comment" ]; then
|
||||
# Check if it's a PR comment with the trigger phrase
|
||||
|
|
@ -268,7 +273,23 @@ runs:
|
|||
console.log('Invalid comments:', JSON.stringify(invalidComments, null, 2));
|
||||
}
|
||||
|
||||
const comments = validComments.map(comment => ({
|
||||
// Deduplicate comments based on path + position + body
|
||||
const uniqueComments = [];
|
||||
const seen = new Set();
|
||||
|
||||
for (const comment of validComments) {
|
||||
const key = `${comment.path}:${comment.position}:${comment.body}`;
|
||||
if (!seen.has(key)) {
|
||||
seen.add(key);
|
||||
uniqueComments.push(comment);
|
||||
}
|
||||
}
|
||||
|
||||
if (uniqueComments.length < validComments.length) {
|
||||
console.log(`Filtered out ${validComments.length - uniqueComments.length} duplicate comments (same path + position + body)`);
|
||||
}
|
||||
|
||||
const comments = uniqueComments.map(comment => ({
|
||||
path: comment.path,
|
||||
position: comment.position,
|
||||
body: comment.body
|
||||
|
|
@ -283,12 +304,19 @@ runs:
|
|||
// Create the review
|
||||
if (comments.length > 0) {
|
||||
try {
|
||||
let reviewBody = `${reviewData.review_summary || 'AI Code Review'}\n\n---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`;
|
||||
|
||||
// Add triggered by note if from comment
|
||||
if (context.eventName === 'issue_comment') {
|
||||
reviewBody = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewBody}`;
|
||||
}
|
||||
|
||||
await github.rest.pulls.createReview({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: prNumber,
|
||||
commit_id: commitSha,
|
||||
body: `${reviewData.review_summary || 'AI Code Review'}\n\n---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`,
|
||||
body: reviewBody,
|
||||
event: 'COMMENT',
|
||||
comments: comments
|
||||
});
|
||||
|
|
@ -310,22 +338,19 @@ runs:
|
|||
}
|
||||
} else {
|
||||
// No inline comments, just post the summary
|
||||
let summaryBody = `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*\n\n` +
|
||||
`---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`;
|
||||
|
||||
// Add triggered by note if from comment
|
||||
if (context.eventName === 'issue_comment') {
|
||||
summaryBody = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${summaryBody}`;
|
||||
}
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: prNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*\n\n` +
|
||||
`---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`
|
||||
});
|
||||
}
|
||||
|
||||
// Add triggered by note if from comment
|
||||
if (context.eventName === 'issue_comment') {
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: prNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `*Inline review triggered by @${context.payload.comment.user.login}*`
|
||||
body: summaryBody
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,12 +29,17 @@ runs:
|
|||
SHOULD_RUN="false"
|
||||
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
# Check PR author association
|
||||
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
|
||||
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
|
||||
SHOULD_RUN="true"
|
||||
# Check if PR is a draft
|
||||
if [ "${{ github.event.pull_request.draft }}" = "true" ]; then
|
||||
echo "::notice::Skipping review - PR is a draft"
|
||||
else
|
||||
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
|
||||
# Check PR author association
|
||||
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
|
||||
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
|
||||
SHOULD_RUN="true"
|
||||
else
|
||||
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
|
||||
fi
|
||||
fi
|
||||
elif [ "${{ github.event_name }}" = "issue_comment" ]; then
|
||||
# Check if it's a PR comment with the trigger phrase
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import { PolicySingleton } from "../control-plane/PolicySingleton.js";
|
|||
import { Logger } from "../util/Logger.js";
|
||||
import { Telemetry } from "../util/posthog.js";
|
||||
import {
|
||||
ASSISTANTS,
|
||||
getAllDotContinueDefinitionFiles,
|
||||
LoadAssistantFilesOptions,
|
||||
} from "./loadLocalAssistants.js";
|
||||
|
|
@ -339,7 +338,7 @@ export class ConfigHandler {
|
|||
|
||||
async getLocalProfiles(options: LoadAssistantFilesOptions) {
|
||||
/**
|
||||
* Users can define as many local assistants as they want in a `.continue/assistants` folder
|
||||
* Users can define as many local agents as they want in a `.continue/agents` (or previous .continue/assistants) folder
|
||||
*/
|
||||
|
||||
// Local customization disabled for on-premise deployments
|
||||
|
|
@ -358,9 +357,14 @@ export class ConfigHandler {
|
|||
const assistantFiles = await getAllDotContinueDefinitionFiles(
|
||||
this.ide,
|
||||
options,
|
||||
ASSISTANTS,
|
||||
"assistants",
|
||||
);
|
||||
const profiles = assistantFiles.map((assistant) => {
|
||||
const agentFiles = await getAllDotContinueDefinitionFiles(
|
||||
this.ide,
|
||||
options,
|
||||
"agents",
|
||||
);
|
||||
const profiles = [...assistantFiles, ...agentFiles].map((assistant) => {
|
||||
return new LocalProfileLoader(
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ConfigYaml } from "@continuedev/config-yaml";
|
||||
|
||||
export const defaultConfig: ConfigYaml = {
|
||||
name: "Local Assistant",
|
||||
name: "Local Agent",
|
||||
version: "1.0.0",
|
||||
schema: "v1",
|
||||
models: [],
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ import { getGlobalFolderWithName } from "../util/paths";
|
|||
import { localPathToUri } from "../util/pathToUri";
|
||||
import { joinPathsToUri } from "../util/uri";
|
||||
|
||||
export const ASSISTANTS = "assistants";
|
||||
export const ASSISTANTS_FOLDER = `.continue/${ASSISTANTS}`;
|
||||
|
||||
export function isLocalDefinitionFile(uri: string): boolean {
|
||||
if (!uri.endsWith(".yaml") && !uri.endsWith(".yml") && !uri.endsWith(".md")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const normalizedUri = URI.normalize(uri);
|
||||
return normalizedUri.includes(`/${ASSISTANTS_FOLDER}/`);
|
||||
return (
|
||||
normalizedUri.includes(`/.continue/agents/`) ||
|
||||
normalizedUri.includes(`/.continue/assistants/`)
|
||||
);
|
||||
}
|
||||
|
||||
async function getDefinitionFilesInDir(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
getAllDotContinueDefinitionFiles,
|
||||
LoadAssistantFilesOptions,
|
||||
} from "./loadLocalAssistants";
|
||||
describe("getAllDotContinueDefinitionFiles with fileExtType option", () => {
|
||||
describe("ASSISTANTS getAllDotContinueDefinitionFiles with fileExtType option", () => {
|
||||
beforeEach(() => {
|
||||
setUpTestDir();
|
||||
walkDirCache.invalidate();
|
||||
|
|
@ -240,3 +240,232 @@ describe("getAllDotContinueDefinitionFiles with fileExtType option", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("AGENTS getAllDotContinueDefinitionFiles with fileExtType option", () => {
|
||||
beforeEach(() => {
|
||||
setUpTestDir();
|
||||
walkDirCache.invalidate();
|
||||
|
||||
// Add test files to the test directory
|
||||
addToTestDir([
|
||||
".continue/agents/",
|
||||
[".continue/agents/agent1.yaml", "yaml content 1"],
|
||||
[".continue/agents/agent2.yml", "yaml content 2"],
|
||||
[".continue/agents/agent3.md", "markdown content 1"],
|
||||
[".continue/agents/agent4.txt", "txt content"],
|
||||
]);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
tearDownTestDir();
|
||||
walkDirCache.invalidate();
|
||||
});
|
||||
|
||||
it("should return only YAML files when fileExtType is 'yaml'", async () => {
|
||||
const options: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false, // Only test workspace for simplicity
|
||||
includeWorkspace: true,
|
||||
fileExtType: "yaml",
|
||||
};
|
||||
|
||||
const result = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
options,
|
||||
"agents",
|
||||
);
|
||||
expect(result).toHaveLength(2);
|
||||
expect(result.map((f) => f.path.split("/").pop())).toEqual(
|
||||
expect.arrayContaining(["agent1.yaml", "agent2.yml"]),
|
||||
);
|
||||
expect(result.map((f) => f.path.split("/").pop())).not.toContain(
|
||||
"agent3.md",
|
||||
);
|
||||
});
|
||||
|
||||
it("should return only Markdown files when fileExtType is 'markdown'", async () => {
|
||||
const options: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
fileExtType: "markdown",
|
||||
};
|
||||
|
||||
const result = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
options,
|
||||
"agents",
|
||||
);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result.map((f) => f.path.split("/").pop())).toEqual(["agent3.md"]);
|
||||
expect(result.map((f) => f.path.split("/").pop())).not.toContain(
|
||||
"agent1.yaml",
|
||||
);
|
||||
expect(result.map((f) => f.path.split("/").pop())).not.toContain(
|
||||
"agent2.yml",
|
||||
);
|
||||
});
|
||||
|
||||
it("should return all supported files when fileExtType is not specified", async () => {
|
||||
const options: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
// fileExtType not specified
|
||||
};
|
||||
|
||||
const result = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
options,
|
||||
"agents",
|
||||
);
|
||||
expect(result).toHaveLength(3);
|
||||
expect(result.map((f) => f.path.split("/").pop())).toEqual(
|
||||
expect.arrayContaining(["agent1.yaml", "agent2.yml", "agent3.md"]),
|
||||
);
|
||||
// Should not include .txt files
|
||||
expect(result.map((f) => f.path.split("/").pop())).not.toContain(
|
||||
"agent4.txt",
|
||||
);
|
||||
});
|
||||
|
||||
it("should respect includeWorkspace option with fileExtType", async () => {
|
||||
// Test with includeWorkspace: false
|
||||
const workspaceOffOptions: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: false,
|
||||
fileExtType: "yaml",
|
||||
};
|
||||
|
||||
const noWorkspaceResult = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
workspaceOffOptions,
|
||||
"agents",
|
||||
);
|
||||
expect(noWorkspaceResult).toHaveLength(0);
|
||||
|
||||
// Test with includeWorkspace: true
|
||||
const workspaceOnOptions: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
fileExtType: "yaml",
|
||||
};
|
||||
|
||||
const workspaceResult = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
workspaceOnOptions,
|
||||
"agents",
|
||||
);
|
||||
expect(workspaceResult).toHaveLength(2);
|
||||
expect(workspaceResult.map((f) => f.path.split("/").pop())).toEqual(
|
||||
expect.arrayContaining(["agent1.yaml", "agent2.yml"]),
|
||||
);
|
||||
});
|
||||
|
||||
it("should return empty array when no files match the specified extension type", async () => {
|
||||
// Create a test directory with only non-matching files
|
||||
tearDownTestDir();
|
||||
walkDirCache.invalidate();
|
||||
setUpTestDir();
|
||||
addToTestDir([
|
||||
".continue/agents/",
|
||||
[".continue/agents/nonmatch1.txt", "txt content"],
|
||||
[".continue/agents/nonmatch2.json", "json content"],
|
||||
]);
|
||||
|
||||
const options: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
|
||||
fileExtType: "yaml",
|
||||
};
|
||||
|
||||
const result = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
options,
|
||||
"agents",
|
||||
);
|
||||
expect(result).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("should handle directories that don't exist", async () => {
|
||||
// Create a clean test directory without the agents folder
|
||||
tearDownTestDir();
|
||||
setUpTestDir();
|
||||
|
||||
const options: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
fileExtType: "yaml",
|
||||
};
|
||||
|
||||
const result = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
options,
|
||||
"agents",
|
||||
);
|
||||
expect(result).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("should return correct file content", async () => {
|
||||
const options: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
fileExtType: "yaml",
|
||||
};
|
||||
|
||||
const result = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
options,
|
||||
"agents",
|
||||
);
|
||||
expect(result).toHaveLength(2);
|
||||
const yamlFile = result.find((f) => f.path.includes("agent1.yaml"));
|
||||
expect(yamlFile?.content).toBe("yaml content 1");
|
||||
});
|
||||
|
||||
it("should filter by file extension case sensitively", async () => {
|
||||
// Add files with uppercase extensions
|
||||
addToTestDir([
|
||||
[".continue/agents/agent5.YAML", "uppercase yaml"],
|
||||
[".continue/agents/agent6.YML", "uppercase yml"],
|
||||
[".continue/agents/agent7.MD", "uppercase md"],
|
||||
]);
|
||||
|
||||
const yamlOptions: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
fileExtType: "yaml",
|
||||
};
|
||||
|
||||
const yamlResult = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
yamlOptions,
|
||||
"agents",
|
||||
);
|
||||
// Should only get lowercase extensions (current implementation)
|
||||
expect(yamlResult).toHaveLength(2);
|
||||
expect(yamlResult.map((f) => f.path.split("/").pop())).toEqual(
|
||||
expect.arrayContaining(["agent1.yaml", "agent2.yml"]),
|
||||
);
|
||||
expect(yamlResult.map((f) => f.path.split("/").pop())).not.toContain(
|
||||
"agent5.YAML",
|
||||
);
|
||||
|
||||
const markdownOptions: LoadAssistantFilesOptions = {
|
||||
includeGlobal: false,
|
||||
includeWorkspace: true,
|
||||
fileExtType: "markdown",
|
||||
};
|
||||
|
||||
const markdownResult = await getAllDotContinueDefinitionFiles(
|
||||
testIde,
|
||||
markdownOptions,
|
||||
"agents",
|
||||
);
|
||||
expect(markdownResult).toHaveLength(1);
|
||||
expect(markdownResult.map((f) => f.path.split("/").pop())).toEqual([
|
||||
"agent3.md",
|
||||
]);
|
||||
expect(markdownResult.map((f) => f.path.split("/").pop())).not.toContain(
|
||||
"agent7.MD",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
iconUrl: "",
|
||||
title: overrideAssistantFile?.path
|
||||
? getUriPathBasename(overrideAssistantFile.path)
|
||||
: "Local Assistant",
|
||||
: "Local Agent",
|
||||
errors: undefined,
|
||||
uri:
|
||||
overrideAssistantFile?.path ??
|
||||
|
|
@ -48,7 +48,7 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
);
|
||||
this.description.title = parsedAssistant.name;
|
||||
} catch (e) {
|
||||
console.error("Failed to parse assistant file: ", e);
|
||||
console.error("Failed to parse agent file: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ export default async function doLoadConfig(options: {
|
|||
const uniqueId = await ide.getUniqueId();
|
||||
const ideSettings = await ideSettingsPromise;
|
||||
const workOsAccessToken = await controlPlaneClient.getAccessToken();
|
||||
const isSignedIn = await controlPlaneClient.isSignedIn();
|
||||
|
||||
// Migrations for old config files
|
||||
// Removes
|
||||
|
|
@ -280,6 +281,7 @@ export default async function doLoadConfig(options: {
|
|||
rules: newConfig.rules,
|
||||
enableExperimentalTools:
|
||||
newConfig.experimental?.enableExperimentalTools ?? false,
|
||||
isSignedIn,
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { AssistantUnrolled } from "@continuedev/config-yaml";
|
|||
export const defaultConfigYaml: AssistantUnrolled = {
|
||||
models: [],
|
||||
context: [],
|
||||
name: "Local Assistant",
|
||||
name: "Local Agent",
|
||||
version: "1.0.0",
|
||||
schema: "v1",
|
||||
};
|
||||
|
|
@ -12,7 +12,7 @@ export const defaultConfigYaml: AssistantUnrolled = {
|
|||
export const defaultConfigYamlJetBrains: AssistantUnrolled = {
|
||||
models: [],
|
||||
context: [],
|
||||
name: "Local Assistant",
|
||||
name: "Local Agent",
|
||||
version: "1.0.0",
|
||||
schema: "v1",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
validateConfigYaml,
|
||||
AssistantUnrolledNonNullable,
|
||||
validateConfigYaml,
|
||||
} from "@continuedev/config-yaml";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("MCP Server cwd configuration", () => {
|
||||
describe("YAML schema validation", () => {
|
||||
it("should accept valid MCP server with cwd", () => {
|
||||
const config: AssistantUnrolledNonNullable = {
|
||||
name: "test-assistant",
|
||||
name: "test-agent",
|
||||
version: "1.0.0",
|
||||
mcpServers: [
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ describe("MCP Server cwd configuration", () => {
|
|||
|
||||
it("should accept MCP server without cwd", () => {
|
||||
const config: AssistantUnrolledNonNullable = {
|
||||
name: "test-assistant",
|
||||
name: "test-agent",
|
||||
version: "1.0.0",
|
||||
mcpServers: [
|
||||
{
|
||||
|
|
@ -45,7 +45,7 @@ describe("MCP Server cwd configuration", () => {
|
|||
|
||||
it("should accept relative paths in cwd", () => {
|
||||
const config: AssistantUnrolledNonNullable = {
|
||||
name: "test-assistant",
|
||||
name: "test-agent",
|
||||
version: "1.0.0",
|
||||
mcpServers: [
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ describe("MCP Server cwd configuration", () => {
|
|||
|
||||
it("should accept empty string cwd", () => {
|
||||
const config: AssistantUnrolledNonNullable = {
|
||||
name: "test-assistant",
|
||||
name: "test-agent",
|
||||
version: "1.0.0",
|
||||
mcpServers: [
|
||||
{
|
||||
|
|
@ -115,7 +115,7 @@ describe("MCP Server cwd configuration", () => {
|
|||
|
||||
configs.forEach(({ name, server }) => {
|
||||
const config: AssistantUnrolledNonNullable = {
|
||||
name: "test-assistant",
|
||||
name: "test-agent",
|
||||
version: "1.0.0",
|
||||
mcpServers: [server],
|
||||
};
|
||||
|
|
|
|||
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -1111,6 +1111,7 @@ interface ToolChoice {
|
|||
export interface ConfigDependentToolParams {
|
||||
rules: RuleWithSource[];
|
||||
enableExperimentalTools: boolean;
|
||||
isSignedIn: boolean;
|
||||
}
|
||||
|
||||
export type GetTool = (params: ConfigDependentToolParams) => Tool;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { ChunkWithoutID } from "../..";
|
||||
|
||||
import { cleanupAsyncEncoders, countTokensAsync } from "../../llm/countTokens";
|
||||
import { codeChunker } from "./code";
|
||||
|
||||
async function genToArr<T>(generator: AsyncGenerator<T>): Promise<T[]> {
|
||||
|
|
@ -71,3 +71,60 @@ describe.skip("codeChunker", () => {
|
|||
expect(chunks).toContain('def method20():\n return "Hello, 20!"');
|
||||
});
|
||||
});
|
||||
|
||||
async function collectContents(
|
||||
filepath: string,
|
||||
contents: string,
|
||||
maxChunkSize: number,
|
||||
): Promise<string[]> {
|
||||
const out: string[] = [];
|
||||
for await (const c of codeChunker(filepath, contents, maxChunkSize)) {
|
||||
out.push(c.content);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
describe("codeChunker function definition", () => {
|
||||
afterAll(async () => await cleanupAsyncEncoders());
|
||||
|
||||
test("class methods never exceed maxChunkSize", async () => {
|
||||
const body = Array.from(
|
||||
{ length: 200 },
|
||||
(_, i) => `console.log(${i});`,
|
||||
).join("\n");
|
||||
const contents = `
|
||||
class C {
|
||||
a() {
|
||||
${body}
|
||||
}
|
||||
b() {
|
||||
${body}
|
||||
}
|
||||
}
|
||||
`;
|
||||
const max = 50;
|
||||
const chunks = await collectContents("filename1.ts", contents, max);
|
||||
const counts = await Promise.all(chunks.map((s) => countTokensAsync(s)));
|
||||
counts.forEach((n) => expect(n).toBeLessThanOrEqual(max));
|
||||
});
|
||||
|
||||
test("top-level functions never exceed maxChunkSize", async () => {
|
||||
const body = Array.from(
|
||||
{ length: 150 },
|
||||
(_, i) => `const x${i} = ${i};`,
|
||||
).join("\n");
|
||||
const contents = `
|
||||
function f() {
|
||||
${body}
|
||||
}
|
||||
|
||||
function g() {
|
||||
${body}
|
||||
}
|
||||
`;
|
||||
const max = 60;
|
||||
const chunks = await collectContents("filename2.ts", contents, max);
|
||||
const counts = await Promise.all(chunks.map((s) => countTokensAsync(s)));
|
||||
counts.forEach((n) => expect(n).toBeLessThanOrEqual(max));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -128,25 +128,46 @@ async function constructFunctionDefinitionChunk(
|
|||
maxChunkSize: number,
|
||||
): Promise<string> {
|
||||
const bodyNode = node.children[node.children.length - 1];
|
||||
const funcText =
|
||||
code.slice(node.startIndex, bodyNode.startIndex) +
|
||||
collapsedReplacement(bodyNode);
|
||||
const collapsedBody = collapsedReplacement(bodyNode);
|
||||
const signature = code.slice(node.startIndex, bodyNode.startIndex);
|
||||
const funcText = signature + collapsedBody;
|
||||
|
||||
if (
|
||||
const isInClass =
|
||||
node.parent &&
|
||||
["block", "declaration_list"].includes(node.parent.type) &&
|
||||
node.parent.parent &&
|
||||
["class_definition", "impl_item"].includes(node.parent.parent.type)
|
||||
) {
|
||||
// If inside a class, include the class header
|
||||
const classNode = node.parent.parent;
|
||||
const classBlock = node.parent;
|
||||
return `${code.slice(
|
||||
classNode.startIndex,
|
||||
classBlock.startIndex,
|
||||
)}...\n\n${" ".repeat(node.startPosition.column)}${funcText}`;
|
||||
["class_definition", "impl_item"].includes(node.parent.parent.type);
|
||||
|
||||
if (isInClass) {
|
||||
const classNode = node.parent!.parent!;
|
||||
const classBlock = node.parent!;
|
||||
const classHeader = code.slice(classNode.startIndex, classBlock.startIndex);
|
||||
const indent = " ".repeat(node.startPosition.column);
|
||||
const combined = `${classHeader}...\n\n${indent}${funcText}`;
|
||||
|
||||
if ((await countTokensAsync(combined)) <= maxChunkSize) {
|
||||
return combined;
|
||||
}
|
||||
if ((await countTokensAsync(funcText)) <= maxChunkSize) {
|
||||
return funcText;
|
||||
}
|
||||
const firstLine = signature.split("\n")[0] ?? "";
|
||||
const minimal = `${firstLine} ${collapsedBody}`;
|
||||
if ((await countTokensAsync(minimal)) <= maxChunkSize) {
|
||||
return minimal;
|
||||
}
|
||||
return collapsedBody;
|
||||
}
|
||||
return funcText;
|
||||
|
||||
if ((await countTokensAsync(funcText)) <= maxChunkSize) {
|
||||
return funcText;
|
||||
}
|
||||
const firstLine = signature.split("\n")[0] ?? "";
|
||||
const minimal = `${firstLine} ${collapsedBody}`;
|
||||
if ((await countTokensAsync(minimal)) <= maxChunkSize) {
|
||||
return minimal;
|
||||
}
|
||||
return collapsedBody;
|
||||
}
|
||||
|
||||
const collapsedNodeConstructors: {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ describe("Nested directory rules application", () => {
|
|||
// A global rule for comparison
|
||||
const globalRule: RuleWithSource = {
|
||||
name: "Global Rule",
|
||||
rule: "SOLID Design Principles - Coding Assistant Guidelines",
|
||||
rule: "SOLID Design Principles - Coding Agent Guidelines",
|
||||
source: "rules-block",
|
||||
ruleFile: ".continue/rules.md",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ Please only respond with code and put it inside of a markdown code block. Do not
|
|||
\`\`\`{{{language}}}
|
||||
`;
|
||||
|
||||
const xWinCoderEditPrompt = `<system>: You are an AI coding assistant that helps people with programming. Write a response that appropriately completes the user's request.
|
||||
const xWinCoderEditPrompt = `<system>: You are an AI coding agent that helps people with programming. Write a response that appropriately completes the user's request.
|
||||
<user>: Please rewrite the following code with these instructions: "{{{userInput}}}"
|
||||
\`\`\`{{{language}}}
|
||||
{{{codeToEdit}}}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export const INSTINCT_EDITABLE_REGION_START_TOKEN = "<|editable_region_start|>";
|
|||
export const INSTINCT_EDITABLE_REGION_END_TOKEN = "<|editable_region_end|>";
|
||||
export const INSTINCT_CONTEXT_FILE_TOKEN = "<|context_file|>";
|
||||
export const INSTINCT_SNIPPET_TOKEN = "<|snippet|>";
|
||||
export const INSTINCT_SYSTEM_PROMPT = `You are Instinct, an intelligent next-edit predictor developed by Continue.dev. Your role as an AI assistant is to help developers complete their code tasks by predicting the next edit that they will make within the section of code marked by <|editable_region_start|> and <|editable_region_end|> tags.
|
||||
export const INSTINCT_SYSTEM_PROMPT = `You are Instinct, an intelligent next-edit predictor developed by Continue.dev. Your role as an AI agent is to help developers complete their code tasks by predicting the next edit that they will make within the section of code marked by <|editable_region_start|> and <|editable_region_end|> tags.
|
||||
|
||||
You have access to the following information to help you make informed suggestions:
|
||||
|
||||
|
|
@ -64,4 +64,4 @@ export const MERCURY_EDIT_DIFF_HISTORY_OPEN = "<|edit_diff_history|>";
|
|||
export const MERCURY_EDIT_DIFF_HISTORY_CLOSE = "<|/edit_diff_history|>";
|
||||
export const MERCURY_CURSOR = "<|cursor|>";
|
||||
export const MERCURY_SYSTEM_PROMPT =
|
||||
"You are Mercury, created by Inception Labs. You are an AI Assistant and an expert at coding. Your role as an AI assistant is to help developers complete their code tasks by assisting in editing specific sections of code marked by the <|code_to_edit|> and <|/code_to_edit|> tags.\n\nYou have access to the following information to help you make informed suggestions:\n\n- recently_viewed_code_snippets: These are code snippets that the developer has recently looked at, which might provide context or examples relevant to the current task. They are listed from oldest to newest, with line numbers in the form #| to help you understand the edit diff history. It'\''s possible these are entirely irrelevant to the developer'\''s change.\n- current_file_content: The content of the file the developer is currently working on, providing the broader context of the code. Line numbers in the form #| are included to help you understand the edit diff history.\n- edit_diff_history: A record of changes made to the code, helping you understand the evolution of the code and the developer'\''s intentions. These changes are listed from oldest to latest. It'\''s possible a lot of old edit diff history is entirely irrelevant to the developer'\''s change.\n- cursor position marked as <|cursor|>: Indicates where the developer'\''s cursor is currently located, which can be crucial for understanding what part of the code they are focusing on.\n\nYour task is to predict and complete the changes the developer would have made next in the <|code_to_edit|> section. The developer may have stopped in the middle of typing. Your goal is to keep the developer on the path that you think they'\''re following. Some examples include further implementing a class, method, or variable, or improving the quality of the code. Make sure the developer doesn'\''t get distracted and ensure your suggestion is relevant. Consider what changes need to be made next, if any. If you think changes should be made, ask yourself if this is truly what needs to happen. If you are confident about it, then proceed with the changes.\n\n# Steps\n\n1. **Review Context**: Analyze the context from the resources provided, such as recently viewed snippets, edit history, surrounding code, and cursor location.\n2. **Evaluate Current Code**: Determine if the current code within the tags requires any corrections or enhancements.\n3. **Suggest Edits**: If changes are required, ensure they align with the developers patterns and improve code quality.\n4. **Maintain Consistency**: Ensure indentation and formatting follow the existing code style.\n\n# Output Format\n\n- Provide only the revised code within the tags. If no changes are necessary, simply return the original code from within the <|code_to_edit|> and <|/code_to_edit|> tags.\n- There are line numbers in the form #| in the code displayed to you above, but these are just for your reference. Please do not include the numbers of the form #| in your response.\n- Ensure that you do not output duplicate code that exists outside of these tags. The output should be the revised code that was between these tags including the <|code_to_edit|> and <|/code_to_edit|> tags.\n\n# Notes\n\n- Avoid undoing or reverting the developer'\''s last change unless there are obvious typos or errors.\n- Don'\''t include the line numbers of the form #| in your response.";
|
||||
"You are Mercury, created by Inception Labs. You are an AI Agent and an expert at coding. Your role as an AI agent is to help developers complete their code tasks by assisting in editing specific sections of code marked by the <|code_to_edit|> and <|/code_to_edit|> tags.\n\nYou have access to the following information to help you make informed suggestions:\n\n- recently_viewed_code_snippets: These are code snippets that the developer has recently looked at, which might provide context or examples relevant to the current task. They are listed from oldest to newest, with line numbers in the form #| to help you understand the edit diff history. It'''s possible these are entirely irrelevant to the developer'''s change.\n- current_file_content: The content of the file the developer is currently working on, providing the broader context of the code. Line numbers in the form #| are included to help you understand the edit diff history.\n- edit_diff_history: A record of changes made to the code, helping you understand the evolution of the code and the developer'''s intentions. These changes are listed from oldest to latest. It'''s possible a lot of old edit diff history is entirely irrelevant to the developer'''s change.\n- cursor position marked as <|cursor|>: Indicates where the developer'''s cursor is currently located, which can be crucial for understanding what part of the code they are focusing on.\n\nYour task is to predict and complete the changes the developer would have made next in the <|code_to_edit|> section. The developer may have stopped in the middle of typing. Your goal is to keep the developer on the path that you think they'''re following. Some examples include further implementing a class, method, or variable, or improving the quality of the code. Make sure the developer doesn'''t get distracted and ensure your suggestion is relevant. Consider what changes need to be made next, if any. If you think changes should be made, ask yourself if this is truly what needs to happen. If you are confident about it, then proceed with the changes.\n\n# Steps\n\n1. **Review Context**: Analyze the context from the resources provided, such as recently viewed snippets, edit history, surrounding code, and cursor location.\n2. **Evaluate Current Code**: Determine if the current code within the tags requires any corrections or enhancements.\n3. **Suggest Edits**: If changes are required, ensure they align with the developers patterns and improve code quality.\n4. **Maintain Consistency**: Ensure indentation and formatting follow the existing code style.\n\n# Output Format\n\n- Provide only the revised code within the tags. If no changes are necessary, simply return the original code from within the <|code_to_edit|> and <|/code_to_edit|> tags.\n- There are line numbers in the form #| in the code displayed to you above, but these are just for your reference. Please do not include the numbers of the form #| in your response.\n- Ensure that you do not output duplicate code that exists outside of these tags. The output should be the revised code that was between these tags including the <|code_to_edit|> and <|/code_to_edit|> tags.\n\n# Notes\n\n- Avoid undoing or reverting the developer'''s last change unless there are obvious typos or errors.\n- Don'''t include the line numbers of the form #| in your response.";
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ describe("Tool Definitions", () => {
|
|||
const mockParams: ConfigDependentToolParams = {
|
||||
rules: [],
|
||||
enableExperimentalTools: false,
|
||||
isSignedIn: false,
|
||||
};
|
||||
|
||||
// Helper function to get the actual tool object
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ const getBaseToolDefinitions = () => [
|
|||
toolDefinitions.createNewFileTool,
|
||||
toolDefinitions.runTerminalCommandTool,
|
||||
toolDefinitions.globSearchTool,
|
||||
toolDefinitions.searchWebTool,
|
||||
toolDefinitions.viewDiffTool,
|
||||
toolDefinitions.readCurrentlyOpenFileTool,
|
||||
toolDefinitions.lsTool,
|
||||
|
|
@ -27,6 +26,8 @@ export const getConfigDependentToolDefinitions = (
|
|||
toolDefinitions.searchAndReplaceInFileTool,
|
||||
// Keep edit file tool available for models that need it
|
||||
toolDefinitions.editFileTool,
|
||||
// Web search is only available for signed-in users
|
||||
...(params.isSignedIn ? [toolDefinitions.searchWebTool] : []),
|
||||
...(params.enableExperimentalTools
|
||||
? [
|
||||
toolDefinitions.viewRepoMapTool,
|
||||
|
|
|
|||
30
core/tools/searchWebGating.vitest.ts
Normal file
30
core/tools/searchWebGating.vitest.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { test, expect } from "vitest";
|
||||
import { getConfigDependentToolDefinitions } from "./index";
|
||||
import { BuiltInToolNames } from "./builtIn";
|
||||
|
||||
test("searchWeb tool is only available when user is signed in", () => {
|
||||
// Test with signed-in user
|
||||
const signedInTools = getConfigDependentToolDefinitions({
|
||||
rules: [],
|
||||
enableExperimentalTools: false,
|
||||
isSignedIn: true,
|
||||
});
|
||||
|
||||
const searchWebToolSignedIn = signedInTools.find(
|
||||
(tool) => tool.function.name === BuiltInToolNames.SearchWeb,
|
||||
);
|
||||
expect(searchWebToolSignedIn).toBeDefined();
|
||||
expect(searchWebToolSignedIn?.displayTitle).toBe("Search Web");
|
||||
|
||||
// Test with non-signed-in user
|
||||
const notSignedInTools = getConfigDependentToolDefinitions({
|
||||
rules: [],
|
||||
enableExperimentalTools: false,
|
||||
isSignedIn: false,
|
||||
});
|
||||
|
||||
const searchWebToolNotSignedIn = notSignedInTools.find(
|
||||
(tool) => tool.function.name === BuiltInToolNames.SearchWeb,
|
||||
);
|
||||
expect(searchWebToolNotSignedIn).toBeUndefined();
|
||||
});
|
||||
|
|
@ -396,10 +396,6 @@ export function getGlobalPromptsPath(): string {
|
|||
return getGlobalFolderWithName("prompts");
|
||||
}
|
||||
|
||||
export function getGlobalAssistantsPath(): string {
|
||||
return getGlobalFolderWithName("assistants");
|
||||
}
|
||||
|
||||
export function readAllGlobalPromptFiles(
|
||||
folderPath: string = getGlobalPromptsPath(),
|
||||
): { path: string; content: string }[] {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@
|
|||
"features/autocomplete/how-it-works",
|
||||
"features/autocomplete/model-setup",
|
||||
"features/autocomplete/how-to-customize",
|
||||
"features/autocomplete/context-selection"
|
||||
"features/autocomplete/context-selection",
|
||||
"features/autocomplete/next-edit"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,3 +25,10 @@ Language models aren't perfect, but can be made much closer by adjusting their o
|
|||
- Occasionally discarding low-quality responses, such as those with excessive repetition
|
||||
|
||||
You can learn more about how it works in the [Autocomplete deep dive](/customization/models#autocomplete).
|
||||
|
||||
<Info>
|
||||
**Looking for AI that predicts your next changes or additions?** Check out
|
||||
[Next Edit](/features/autocomplete/next-edit), an experimental feature that
|
||||
proactively suggests code changes before you even start typing, going beyond
|
||||
traditional autocomplete to anticipate entire code modifications.
|
||||
</Info>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,16 @@ This model provides good suggestions while keeping your code completely private.
|
|||
2. Add [Qwen 2.5 Coder 1.5B](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b) to your assistant on Continue Hub
|
||||
3. Click `Reload config` in the assistant selector in the Continue IDE extension
|
||||
|
||||
## Next Edit Model
|
||||
|
||||
For proactive code prediction that anticipates your next edit, Continue supports specialized [Next Edit](/features/edit/next-edit) models:
|
||||
|
||||
**Supported Next Edit model:**
|
||||
|
||||
- `mercury-coder-nextedit`: Primary model optimized for next edit prediction
|
||||
|
||||
Next Edit automatically activates when you have a compatible model configured for autocomplete and the appropriate access permissions.
|
||||
|
||||
## Need Help?
|
||||
|
||||
If you're not seeing any completions or need more detailed configuration options, check out our comprehensive [autocomplete deep dive guide](/customize/deep-dives/autocomplete).
|
||||
|
|
|
|||
153
docs/features/autocomplete/next-edit.mdx
Normal file
153
docs/features/autocomplete/next-edit.mdx
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
---
|
||||
title: "Next Edit"
|
||||
description: "Learn how Continue's Next Edit feature predicts and suggests your next code changes using AI, going beyond traditional autocomplete to anticipate entire code modifications"
|
||||
---
|
||||
|
||||
<Warning>
|
||||
Next Edit is currently an experimental feature. It requires Mercury Coder Next
|
||||
Edit model configured in your Continue autocomplete settings and is not yet
|
||||
available for JetBrains use.
|
||||
</Warning>
|
||||
|
||||
## What is Next Edit?
|
||||
|
||||
Next Edit is an advanced AI-powered code prediction feature that anticipates what changes you'll make next in your code. Unlike traditional autocomplete that reacts to your typing, Next Edit proactively analyzes your recent edits and coding patterns to suggest entire code modifications before you even start typing.
|
||||
|
||||
Think of it as having an AI pair programmer that understands your coding flow and suggests the logical next step in your development process.
|
||||
|
||||
## How Next Edit Works
|
||||
|
||||
### The Prediction Process
|
||||
|
||||
1. **Context Analysis**: Captures your current cursor position and recent edit history
|
||||
2. **Pattern Recognition**: Analyzes your coding patterns and the surrounding code context
|
||||
3. **Next Step Prediction**: Uses specialized AI models to predict what you'll likely change next
|
||||
4. **Visual Presentation**: Shows predictions as diff overlays rather than simple text completions
|
||||
5. **Interactive Review**: Lets you accept (Tab) or reject (Esc) the suggested changes
|
||||
6. **Jump to Next Edit Location**: Lets you jump (Tab) to the next edit location or reject (Esc)
|
||||
|
||||
### Intelligent Triggering
|
||||
|
||||
Next Edit activates automatically when:
|
||||
|
||||
- You finish making a code change
|
||||
- The AI detects a logical continuation point
|
||||
- Specialized next-edit models are available
|
||||
- The current context suggests a predictable next step
|
||||
|
||||
## Next Edit vs Traditional Autocomplete
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Prediction Scope">
|
||||
**Autocomplete**: Completes the current line or statement you're typing
|
||||
|
||||
**Next Edit**: Predicts entire code modifications across multiple lines
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="User Interaction">
|
||||
**Autocomplete**: Shows ghost text at your cursor position
|
||||
|
||||
**Next Edit**: Displays diff overlays showing before/after changes, while also displaying ghost text if the change is purely additive.
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Timing">
|
||||
**Autocomplete**: Reactive - responds to what you're currently typing
|
||||
|
||||
**Next Edit**: Proactive - anticipates what you'll do next
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Context Awareness">
|
||||
**Autocomplete**: Focuses on immediate code completion
|
||||
|
||||
**Next Edit**: Analyzes recent edit patterns and broader code context
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## How to Use Next Edit
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Next Edit requires:
|
||||
|
||||
- Compatible AI models (Mercury Coder Next Edit)
|
||||
- Continue development team access
|
||||
- VS Code (JetBrains support coming soon)
|
||||
- **API Keys**: Organizations can add API keys to [org secrets](/hub/secrets/secret-types) for team-wide access. Individual users need to provide their own API keys in their [model configuration](/customize/model-providers/overview)
|
||||
|
||||
<Note>
|
||||
To use Next Edit, you must have the Mercury Coder Next Edit model configured
|
||||
in your Continue autocomplete model settings. This model is specifically
|
||||
designed for next edit predictions. Once it's been loaded, you must reload VS
|
||||
Code to activate it.
|
||||
<img
|
||||
src="/images/features/autocomplete/images/mercury-coder-next-edit.png"
|
||||
alt="Next Edit Model Setup"
|
||||
/>
|
||||
</Note>
|
||||
|
||||
### Using Next Edit Predictions
|
||||
|
||||
<Steps>
|
||||
<Step title="Make a Code Change">
|
||||
Edit your code normally. Next Edit will analyze your change patterns.
|
||||
</Step>
|
||||
|
||||
<Step title="Review Predictions">
|
||||
When Next Edit activates, you'll see a diff overlay showing predicted changes
|
||||
in an editable region.
|
||||
</Step>
|
||||
|
||||
<Step title="Accept or Reject">
|
||||
- **Tab**: Accept the prediction and apply changes - **Esc**: Reject the
|
||||
prediction and continue coding normally
|
||||
</Step>
|
||||
|
||||
<Step title="Continue Coding">
|
||||
If accepted, your cursor moves to the last changed line. If rejected, your
|
||||
workflow continues uninterrupted.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## What are the Model Requirements for Next Edit?
|
||||
|
||||
### Specialized Models
|
||||
|
||||
Next Edit requires AI models specifically trained for code prediction:
|
||||
|
||||
- **Mercury Coder Next Edit**: Primary model optimized for next edit prediction
|
||||
|
||||
### Automatic Detection
|
||||
|
||||
Continue automatically enables Next Edit when:
|
||||
|
||||
1. Your configured autocomplete model supports next edit capabilities
|
||||
2. You have development team access permissions
|
||||
3. The current code context suggests predictable next steps
|
||||
|
||||
## Best Practices
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Trust the Process" icon="robot">
|
||||
Let Next Edit observe your coding patterns for a few editing sessions before expecting highly accurate predictions.
|
||||
</Card>
|
||||
|
||||
<Card title="Review Carefully" icon="magnifying-glass">
|
||||
Always review suggested changes before accepting, especially for complex logic
|
||||
modifications.
|
||||
</Card>
|
||||
|
||||
<Card title="Provide Feedback" icon="message">
|
||||
Have feedback? We want to hear it. __[Add your thoughts to our feedback
|
||||
discussions](https://github.com/continuedev/continue/discussions/categories/feedback)__
|
||||
to help us improve.
|
||||
</Card>
|
||||
|
||||
<Card title="Combine with Other Features" icon="puzzle-piece">
|
||||
Use Next Edit alongside Continue's Chat and Agent modes for comprehensive AI-assisted development.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
---
|
||||
|
||||
_Next Edit represents Continue's vision for proactive AI coding assistance that anticipates developer needs rather than just reacting to input. As this feature evolves, it will become a powerful tool for accelerating development workflows and reducing repetitive coding tasks._
|
||||
|
|
@ -13,4 +13,8 @@ When you start an edit session, Continue:
|
|||
|
||||
If you accept the diff, we remove the previously highlighted lines, and if you reject the diff, we remove the proposed changes.
|
||||
|
||||
<Info>
|
||||
**Looking for AI that predicts your next edit?** Check out [Next Edit](/features/edit/next-edit), an experimental feature that proactively suggests code changes before you even start typing, going beyond traditional autocomplete to anticipate entire code modifications.
|
||||
</Info>
|
||||
|
||||
If you would like to view the exact prompt that is sent to the model during an edit, you can [find it in the prompt logs](/troubleshooting#check-the-logs).
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Project Purpose
|
||||
|
||||
JetBrains/IntelliJ extension for Continue AI code assistant. Provides chat, autocomplete, inline edit, and agent features within JetBrains IDEs.
|
||||
JetBrains/IntelliJ extension for Continue AI code agent. Provides chat, autocomplete, inline edit, and agent features within JetBrains IDEs.
|
||||
|
||||
## Architecture
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ describe("GUI Test", () => {
|
|||
const description = await GUISelectors.getDescription(view);
|
||||
|
||||
expect(await description.getText()).has.string(
|
||||
"Log in to quickly build your first custom AI code assistant",
|
||||
"Log in to quickly build your first custom AI code agent",
|
||||
);
|
||||
}).timeout(DEFAULT_TIMEOUT.XL);
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ describe("GUI Test", () => {
|
|||
|
||||
// Verify the rule content
|
||||
const ruleItemText = await ruleItem.getText();
|
||||
expect(ruleItemText).to.include("Assistant rule");
|
||||
expect(ruleItemText).to.include("Agent rule");
|
||||
expect(ruleItemText).to.include("Always applied");
|
||||
expect(ruleItemText).to.include("TEST_SYS_MSG");
|
||||
}).timeout(DEFAULT_TIMEOUT.MD);
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
"homepage": "https://continue.dev",
|
||||
"qna": "https://github.com/continuedev/continue/issues/new/choose",
|
||||
"license": "Apache-2.0",
|
||||
"displayName": "Continue - open-source AI code assistant",
|
||||
"displayName": "Continue - open-source AI code agent",
|
||||
"pricing": "Free",
|
||||
"description": "The leading open-source AI code assistant",
|
||||
"description": "The leading open-source AI code agent",
|
||||
"publisher": "Continue",
|
||||
"engines": {
|
||||
"vscode": "^1.70.0",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
The `extensions/vscode` folder contains code for the "Continue" VS Code Extension. Continue is a coding assistant extension which extends IDE functionality with AI.
|
||||
The `extensions/vscode` folder contains code for the "Continue" VS Code Extension. Continue is a coding extension which extends IDE functionality with AI.
|
||||
Core IDE functionality, such as reading files, is implemented using the `VSCodeIDE` class. Code to enable editing/diff streaming into the editor, code suggestion autocompletion, and more can also be found in this directory.
|
||||
Shared code that has abstract logic for the extension is in `core/`. Avoid importing code from `core/` directly where possible. Core is designed to be bundalable as a binary. Use `core.invoke` to send messages to the
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export class ApplyManager {
|
|||
} finally {
|
||||
await this.webviewProtocol.request("updateApplyState", {
|
||||
streamId,
|
||||
status: "closed",
|
||||
status: "done",
|
||||
toolCallId,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ export function AssistantOptions({
|
|||
return (
|
||||
<>
|
||||
<div className="flex gap-1.5 px-3 pb-1 pt-2">
|
||||
<label className="text-vsc-foreground font-semibold">Assistants</label>
|
||||
<label className="text-vsc-foreground font-semibold">Agents</label>
|
||||
<div className="flex cursor-pointer flex-row items-center gap-1 hover:brightness-125"></div>
|
||||
</div>
|
||||
|
||||
<div className="thin-scrollbar flex max-h-[300px] flex-col overflow-y-auto">
|
||||
{profiles?.length === 0 ? (
|
||||
<div className="text-vsc-foreground px-3 py-2 opacity-70">
|
||||
No assistants found
|
||||
No agents found
|
||||
</div>
|
||||
) : (
|
||||
profiles?.map((profile, idx) => (
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export function SelectedAssistantButton({
|
|||
>
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
{selectedProfile === null ? (
|
||||
"Create your first assistant"
|
||||
"Create your first agent"
|
||||
) : configLoading ? (
|
||||
<span className="text-description flex flex-row items-center">
|
||||
<ArrowPathIcon
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ export function AssistantAndOrgListbox() {
|
|||
className="text-description flex flex-row items-center"
|
||||
style={{ fontSize: tinyFont }}
|
||||
>
|
||||
<PlusIcon className="mr-1 h-3 w-3" /> New Assistant
|
||||
<PlusIcon className="mr-1 h-3 w-3" /> New Agent
|
||||
</span>
|
||||
</ListboxOption>
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ export function AssistantAndOrgListbox() {
|
|||
configLoading && "animate-spin-slow",
|
||||
)}
|
||||
/>
|
||||
Reload assistants
|
||||
Reload agents
|
||||
</span>
|
||||
</ListboxOption>
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ export function AssistantAndOrgListbox() {
|
|||
style={{ fontSize: tinyFont }}
|
||||
>
|
||||
<span className="block" style={{ fontSize: tinyFont - 1 }}>
|
||||
<code>{getMetaKeyLabel()} ⇧ '</code> to toggle assistant
|
||||
<code>{getMetaKeyLabel()} ⇧ '</code> to toggle agent
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,13 +25,10 @@ export function ExploreHubCard() {
|
|||
>
|
||||
<div className="flex flex-col items-center gap-1 px-4 text-center">
|
||||
<div className="mb-4">
|
||||
<h2 className="mb-1 text-xl font-semibold">
|
||||
Create Your Own Assistant
|
||||
</h2>
|
||||
<h2 className="mb-1 text-xl font-semibold">Create Your Own Agent</h2>
|
||||
|
||||
<p className="text-lightgray my-0 max-w-lg text-sm font-light leading-relaxed">
|
||||
Discover and remix popular assistants, or create your own from
|
||||
scratch
|
||||
Discover and remix popular agents, or create your own from scratch
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
@ -39,12 +36,12 @@ export function ExploreHubCard() {
|
|||
className="w-full"
|
||||
onClick={() => {
|
||||
ideMessenger.request("controlPlane/openUrl", {
|
||||
path: "/explore/assistants",
|
||||
path: "/?type=assistants",
|
||||
orgSlug: undefined,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Explore Assistants
|
||||
Explore Agents
|
||||
</Button>
|
||||
|
||||
<ButtonSubtext
|
||||
|
|
@ -56,7 +53,7 @@ export function ExploreHubCard() {
|
|||
}}
|
||||
>
|
||||
<div className="flex cursor-pointer items-center justify-center gap-1">
|
||||
<span>Or, create your own assistant from scratch</span>
|
||||
<span>Or, create your own agent from scratch</span>
|
||||
<ChevronRightIcon className="h-3 w-3" />
|
||||
</div>
|
||||
</ButtonSubtext>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export function OnboardingCardLanding({
|
|||
<>
|
||||
<p className="xs:w-3/4 w-full text-sm">
|
||||
You've reached the free trial limit. Visit the Continue Platform to
|
||||
select a Coding Assistant.
|
||||
select a Coding Agent.
|
||||
</p>
|
||||
<Button
|
||||
onClick={openPastFreeTrialOnboarding}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import {
|
||||
BookOpenIcon,
|
||||
ChatBubbleLeftIcon,
|
||||
ChevronLeftIcon,
|
||||
CubeIcon,
|
||||
|
|
@ -47,7 +46,6 @@ interface Section {
|
|||
const sections: Section[] = [
|
||||
{ id: "models", title: "Models", tooltip: "Models", icon: CubeIcon },
|
||||
{ id: "rules", title: "Rules", tooltip: "Rules", icon: PencilIcon },
|
||||
{ id: "docs", title: "Docs", tooltip: "Docs", icon: BookOpenIcon },
|
||||
{
|
||||
id: "prompts",
|
||||
title: "Prompts",
|
||||
|
|
@ -241,7 +239,7 @@ export function BlockSettingsTopToolbar() {
|
|||
<AssistantAndOrgListbox />
|
||||
)}
|
||||
<ToolTip id="assistant-select-tooltip" place="top">
|
||||
{isUsingFreeTrial ? "View free trial usage" : "Select Assistant"}
|
||||
{isUsingFreeTrial ? "View free trial usage" : "Select Agent"}
|
||||
</ToolTip>
|
||||
</HoverItem>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
|||
} else if (rule.source === "model-options-chat") {
|
||||
return "Base System Chat Message";
|
||||
} else {
|
||||
return "Assistant rule";
|
||||
return "Agent rule";
|
||||
}
|
||||
}
|
||||
}, [rule]);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { useLump } from "../LumpContext";
|
||||
import { ContextSection } from "./ContextSection";
|
||||
import DocsSection from "./docs/DocsSection";
|
||||
import { ErrorSection } from "./errors/ErrorSection";
|
||||
import MCPSection from "./mcp/MCPSection";
|
||||
import { ModelsSection } from "./ModelsSection";
|
||||
|
|
@ -19,8 +18,6 @@ export function SelectedSection() {
|
|||
return <ModelsSection />;
|
||||
case "rules":
|
||||
return <RulesSection />;
|
||||
case "docs":
|
||||
return <DocsSection />;
|
||||
case "prompts":
|
||||
return <PromptsSection />;
|
||||
case "context":
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export function RulesPeekItem({ rule }: RulesPeekItemProps) {
|
|||
|
||||
<div className="flex min-w-0 flex-1 gap-2 text-xs">
|
||||
<div className="max-w-[50%] flex-shrink-0 truncate font-medium">
|
||||
{rule.name || "Assistant rule"}
|
||||
{rule.name || "Agent rule"}
|
||||
</div>
|
||||
|
||||
<div className="min-w-0 flex-1 overflow-hidden truncate whitespace-nowrap text-xs text-gray-500">
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export function HelpCenterSection() {
|
|||
<div className="-mx-4 flex flex-col">
|
||||
<MoreHelpRow
|
||||
title="Continue Hub"
|
||||
description="Visit hub.continue.dev to explore custom assistants and blocks"
|
||||
description="Visit hub.continue.dev to explore custom agents and blocks"
|
||||
Icon={ArrowTopRightOnSquareIcon}
|
||||
onClick={() =>
|
||||
ideMessenger.post("openUrl", "https://hub.continue.dev/")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const STATUS_TO_SUBTITLE_TEXT: Record<
|
|||
indexing: "Click to pause",
|
||||
paused: "Click to resume",
|
||||
failed: "Click to retry",
|
||||
disabled: "Click to open assistant configuration",
|
||||
disabled: "Click to open agent configuration",
|
||||
cancelled: "Click to restart",
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,37 @@
|
|||
import DocsIndexingStatuses from "../../components/mainInput/Lump/sections/docs/DocsSection";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import IndexingProgress from "./IndexingProgress";
|
||||
|
||||
export function IndexingSettingsSection() {
|
||||
const config = useAppSelector((state) => state.config.config);
|
||||
return (
|
||||
<div className="py-5">
|
||||
<div className="flex flex-col gap-3 py-5">
|
||||
<div>
|
||||
<h3 className="mx-auto mb-1 mt-0 text-xl">@codebase index</h3>
|
||||
<span className="text-lightgray w-3/4 text-xs">
|
||||
Local embeddings of your codebase
|
||||
</span>
|
||||
{config.disableIndexing ? (
|
||||
<div className="pb-2 pt-5">
|
||||
<p className="py-1 text-center font-semibold">
|
||||
Indexing is disabled
|
||||
</p>
|
||||
<p className="text-lightgray cursor-pointer text-center text-xs">
|
||||
Open settings and toggle <code>Enable Indexing</code> to re-enable
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<IndexingProgress />
|
||||
)}
|
||||
</div>
|
||||
{config.disableIndexing ? (
|
||||
<div className="pb-2 pt-5">
|
||||
<p className="py-1 text-center font-semibold">Indexing is disabled</p>
|
||||
<p className="text-lightgray cursor-pointer text-center text-xs">
|
||||
Open settings and toggle <code>Enable Indexing</code> to re-enable
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<IndexingProgress />
|
||||
)}
|
||||
|
||||
<div className="mt-5">
|
||||
<h3 className="mx-auto mb-1 mt-0 text-xl">@docs index</h3>
|
||||
<span className="text-lightgray w-3/4 text-xs">
|
||||
Local embeddings of your documentation sources
|
||||
</span>
|
||||
</div>
|
||||
<DocsIndexingStatuses />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,9 +201,9 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
|
|||
<div className="flex flex-col gap-2">
|
||||
{session && selectedProfile && !isLocalProfile(selectedProfile) && (
|
||||
<div className="flex flex-col gap-1">
|
||||
<span>{`If your hub secret values may have changed, refresh your assistants`}</span>
|
||||
<span>{`If your hub secret values may have changed, refresh your agents`}</span>
|
||||
<SecondaryButton onClick={handleRefreshProfiles}>
|
||||
Refresh assistant secrets
|
||||
Refresh agent secrets
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const initialState: ProfilesState = {
|
|||
id: "personal",
|
||||
profiles: [
|
||||
{
|
||||
title: "Local Assistant",
|
||||
title: "Local Agent",
|
||||
id: "local",
|
||||
errors: [],
|
||||
profileType: "local",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ function logDomText() {
|
|||
const doc = parser.parseFromString(bodyText, "text/html");
|
||||
let cleaned = doc.body.textContent ?? "";
|
||||
cleaned = cleaned?.replace(
|
||||
"No resultsAaModelsRulesDocsPromptsToolsMCPCreate your first assistant",
|
||||
"No resultsAaModelsRulesDocsPromptsToolsMCPCreate your first agent",
|
||||
"",
|
||||
);
|
||||
cleaned = cleaned?.replace(
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ describe("E2E Scenarios", () => {
|
|||
uriType: "slug",
|
||||
fullSlug: {
|
||||
ownerSlug: "test-org",
|
||||
packageSlug: "assistant-with-non-existing-block",
|
||||
packageSlug: "agent-with-non-existing-block",
|
||||
versionSlug: "latest",
|
||||
},
|
||||
},
|
||||
|
|
@ -130,7 +130,7 @@ describe("E2E Scenarios", () => {
|
|||
uriType: "slug",
|
||||
fullSlug: {
|
||||
ownerSlug: "test-org",
|
||||
packageSlug: "assistant",
|
||||
packageSlug: "agent",
|
||||
versionSlug: "latest",
|
||||
},
|
||||
},
|
||||
|
|
@ -221,7 +221,7 @@ describe("E2E Scenarios", () => {
|
|||
uriType: "slug",
|
||||
fullSlug: {
|
||||
ownerSlug: "test-org",
|
||||
packageSlug: "assistant",
|
||||
packageSlug: "agent",
|
||||
versionSlug: "latest",
|
||||
},
|
||||
},
|
||||
|
|
@ -276,7 +276,7 @@ describe("E2E Scenarios", () => {
|
|||
const unrolledConfig = await unrollAssistant(
|
||||
{
|
||||
uriType: "file",
|
||||
fileUri: "./src/__tests__/local-files/duplicate-test-assistant.yaml",
|
||||
fileUri: "./src/__tests__/local-files/duplicate-test-agent.yaml",
|
||||
},
|
||||
registry,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
name: Duplicate Test Assistant
|
||||
name: Duplicate Test Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
name: Assistant with non-existing block
|
||||
name: Agent with non-existing block
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
name: Assistant
|
||||
name: Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ describe("parseMarkdownRuleOrAssistantUnrolled tests", () => {
|
|||
fileUri: "./foo/bar.yaml",
|
||||
};
|
||||
const yamlContent = `
|
||||
name: Test Assistant
|
||||
name: Test Agent
|
||||
version: 1.0.0
|
||||
|
||||
models:
|
||||
|
|
@ -17,7 +17,7 @@ models:
|
|||
provider: ollama
|
||||
`;
|
||||
const result = parseMarkdownRuleOrAssistantUnrolled(yamlContent, mockId);
|
||||
expect(result).toHaveProperty("name", "Test Assistant");
|
||||
expect(result).toHaveProperty("name", "Test Agent");
|
||||
expect(result).toHaveProperty("version", "1.0.0");
|
||||
expect(result.models?.length).toBe(1);
|
||||
expect(result.models?.[0]).toHaveProperty("name", "model");
|
||||
|
|
@ -58,7 +58,7 @@ This is the rule
|
|||
fileUri: "./foo/bar.yaml",
|
||||
};
|
||||
const invalidContent = `
|
||||
name: Test Assistant
|
||||
name: Test Agent
|
||||
version: 1.0.0
|
||||
|
||||
model: # should be models
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ export function parseConfigYaml(configYaml: string): ConfigYaml {
|
|||
"cause" in e &&
|
||||
e.cause === "result.success was false"
|
||||
) {
|
||||
throw new Error(`Failed to parse assistant: ${e.message}`);
|
||||
throw new Error(`Failed to parse agent: ${e.message}`);
|
||||
} else if (e instanceof ZodError) {
|
||||
throw new Error(`Failed to parse assistant: ${formatZodError(e)}`);
|
||||
throw new Error(`Failed to parse agent: ${formatZodError(e)}`);
|
||||
} else {
|
||||
throw new Error(
|
||||
`Failed to parse assistant: ${e instanceof Error ? e.message : e}`,
|
||||
`Failed to parse agent: ${e instanceof Error ? e.message : e}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ export function parseAssistantUnrolled(configYaml: string): AssistantUnrolled {
|
|||
console.error(
|
||||
`Failed to parse unrolled assistant: ${e.message}\n\n${configYaml}`,
|
||||
);
|
||||
throw new Error(`Failed to parse unrolled assistant: ${formatZodError(e)}`);
|
||||
throw new Error(`Failed to parse agent: ${formatZodError(e)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue