Changesets · Branches · Tags · Compare
| Changeset | 74b917bba7fc23c57623f59b3d0ea16ff51198283bbffe17144b816c3e6cb681 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-07-08 10:23 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-08 10:23 -07:00 |
| Parents | fcc262fbb143, 9e87b2fb4169 |
12 files changed
modified core/llm/toolSupport.ts +3 −0
| @@ -19,6 +19,7 @@ | ||
| 19 | 19 | "claude-3-7", |
| 20 | 20 | "claude-3.7", |
| 21 | 21 | "claude-sonnet-4", |
| 22 | + "claude-4-sonnet", | |
| 22 | 23 | "gpt-4", |
| 23 | 24 | "o3", |
| 24 | 25 | "gemini", |
| @@ -33,6 +34,7 @@ | ||
| 33 | 34 | "claude-3-7", |
| 34 | 35 | "claude-3.7", |
| 35 | 36 | "claude-sonnet-4", |
| 37 | + "claude-4-sonnet", | |
| 36 | 38 | "claude-opus-4", |
| 37 | 39 | ].some((part) => model.toLowerCase().startsWith(part)) |
| 38 | 40 | ) { |
| @@ -95,6 +97,7 @@ | ||
| 95 | 97 | "claude-3-7-sonnet", |
| 96 | 98 | "claude-3.7-sonnet", |
| 97 | 99 | "claude-sonnet-4", |
| 100 | + "claude-4-sonnet", | |
| 98 | 101 | "claude-opus-4", |
| 99 | 102 | "nova-lite", |
| 100 | 103 | "nova-pro", |
modified core/tools/definitions/searchAndReplaceInFile.ts +5 −1
| @@ -56,7 +56,11 @@ | ||
| 56 | 56 | * Include just the changing lines, and a few surrounding lines if needed for uniqueness. |
| 57 | 57 | * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. |
| 58 | 58 | * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. |
| 59 | -4. Special operations: | |
| 59 | +4. Splitting up tool calls: | |
| 60 | + * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple separate tool calls | |
| 61 | + * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls | |
| 62 | + * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do. For example, instead of [explanation, tool call, tool call] you should do [explanation, tool call, explanation, tool call] | |
| 63 | +5. Special operations: | |
| 60 | 64 | * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) |
| 61 | 65 | * To delete code: Use empty REPLACE section |
| 62 | 66 |
modified core/tools/index.ts +6 −7
| @@ -39,14 +39,13 @@ | ||
| 39 | 39 | params: ConfigDependentToolParams, |
| 40 | 40 | ): Tool[] => [ |
| 41 | 41 | requestRuleTool(params), |
| 42 | + // Search and replace is now generally available | |
| 43 | + searchAndReplaceInFileTool, | |
| 44 | + // Keep edit file tool available for models that need it | |
| 45 | + editFileTool, | |
| 42 | 46 | ...(params.enableExperimentalTools |
| 43 | - ? [ | |
| 44 | - searchAndReplaceInFileTool, | |
| 45 | - viewRepoMapTool, | |
| 46 | - viewSubdirectoryTool, | |
| 47 | - codebaseTool, | |
| 48 | - ] | |
| 49 | - : [editFileTool]), | |
| 47 | + ? [viewRepoMapTool, viewSubdirectoryTool, codebaseTool] | |
| 48 | + : []), | |
| 50 | 49 | ]; |
| 51 | 50 | |
| 52 | 51 | export const getToolsForIde = async (ide: IDE): Promise<Tool[]> => |
modified extensions/vscode/e2e/tests/GUI.test.ts +0 −14
| @@ -357,20 +357,6 @@ | ||
| 357 | 357 | await messageInput.sendKeys(Key.ENTER); |
| 358 | 358 | await messageInput.sendKeys(Key.ENTER); |
| 359 | 359 | |
| 360 | - // Open the context items peek | |
| 361 | - const contextItemsPeek = await GUISelectors.getContextItemsPeek(view); | |
| 362 | - await contextItemsPeek.click(); | |
| 363 | - | |
| 364 | - await TestUtils.waitForSuccess(async () => { | |
| 365 | - const firstContextItemInPeek = | |
| 366 | - await GUISelectors.getFirstContextItemsPeekItem(view); | |
| 367 | - await firstContextItemInPeek.click(); | |
| 368 | - | |
| 369 | - // Check that item is there with correct name | |
| 370 | - const description = await firstContextItemInPeek.getText(); | |
| 371 | - expect(description).to.include("Terminal"); | |
| 372 | - }); | |
| 373 | - | |
| 374 | 360 | // Check that the contents match what we expect (repeated back by the mock LLM) |
| 375 | 361 | await TestUtils.waitForSuccess(() => { |
| 376 | 362 | return GUISelectors.getThreadMessageByText( |
modified extensions/vscode/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified extensions/vscode/package.json +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | "name": "continue", |
| 3 | 3 | "icon": "media/icon.png", |
| 4 | 4 | "author": "Continue Dev, Inc", |
| 5 | - "version": "1.1.58", | |
| 5 | + "version": "1.1.59", | |
| 6 | 6 | "repository": { |
| 7 | 7 | "type": "git", |
| 8 | 8 | "url": "https://github.com/continuedev/continue" |
modified extensions/vscode/src/diff/vertical/handler.ts +21 −3
| @@ -174,9 +174,12 @@ | ||
| 174 | 174 | // Clear deletion buffer |
| 175 | 175 | await this.insertDeletionBuffer(); |
| 176 | 176 | |
| 177 | - await this.reapplyWithMyersDiff(diffLines); | |
| 178 | - | |
| 179 | - const range = new vscode.Range(this.startLine, 0, this.startLine, 0); | |
| 177 | + const myersDiffs = await this.reapplyWithMyersDiff(diffLines); | |
| 178 | + | |
| 179 | + // Scroll to the first diff | |
| 180 | + const scrollToLine = | |
| 181 | + this.getFirstChangedLine(myersDiffs) ?? this.startLine; | |
| 182 | + const range = new vscode.Range(scrollToLine, 0, scrollToLine, 0); | |
| 180 | 183 | this.editor.revealRange(range, vscode.TextEditorRevealType.Default); |
| 181 | 184 | |
| 182 | 185 | this.options.onStatusUpdate( |
| @@ -370,6 +373,8 @@ | ||
| 370 | 373 | |
| 371 | 374 | this.editorToVerticalDiffCodeLens.set(this.fileUri, codeLensBlocks); |
| 372 | 375 | this.refreshCodeLens(); |
| 376 | + | |
| 377 | + return myersDiffs; | |
| 373 | 378 | } |
| 374 | 379 | |
| 375 | 380 | private async insertDeletionBuffer() { |
| @@ -550,4 +555,17 @@ | ||
| 550 | 555 | |
| 551 | 556 | this.refreshCodeLens(); |
| 552 | 557 | } |
| 558 | + | |
| 559 | + /** | |
| 560 | + * Gets the first line number that was changed in a diff | |
| 561 | + */ | |
| 562 | + private getFirstChangedLine(diff: DiffLine[]): number | null { | |
| 563 | + for (let i = 0; i < diff.length; i++) { | |
| 564 | + const item = diff[i]; | |
| 565 | + if (item.type === "old" || item.type === "new") { | |
| 566 | + return this.startLine + i; | |
| 567 | + } | |
| 568 | + } | |
| 569 | + return null; | |
| 570 | + } | |
| 553 | 571 | } |
modified gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +0 −1
| @@ -219,7 +219,6 @@ | ||
| 219 | 219 | if (isGeneratingCodeBlock) { |
| 220 | 220 | return ( |
| 221 | 221 | <span className="text-lightgray inline-flex items-center gap-2 text-right"> |
| 222 | - {!isExpanded ? `${numLines} line${plural}` : "Generating"}{" "} | |
| 223 | 222 | <div> |
| 224 | 223 | <Spinner /> |
| 225 | 224 | </div> |
modified gui/src/pages/gui/ToolCallDiv/EditFile.tsx +2 −3
| @@ -6,15 +6,14 @@ | ||
| 6 | 6 | changes: string; |
| 7 | 7 | historyIndex: number; |
| 8 | 8 | toolCallId?: string; |
| 9 | - expandCodeblocks?: boolean; | |
| 10 | 9 | }; |
| 11 | 10 | |
| 12 | 11 | export function EditFile(props: EditToolCallProps) { |
| 13 | - if (!props.relativeFilePath || !props.changes) { | |
| 12 | + if (!props.relativeFilePath) { | |
| 14 | 13 | return null; |
| 15 | 14 | } |
| 16 | 15 | |
| 17 | - const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; | |
| 16 | + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath)} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; | |
| 18 | 17 | |
| 19 | 18 | return ( |
| 20 | 19 | <StyledMarkdownPreview |
modified gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +0 −1
| @@ -36,7 +36,6 @@ | ||
| 36 | 36 | case BuiltInToolNames.SearchAndReplaceInFile: |
| 37 | 37 | return ( |
| 38 | 38 | <EditFile |
| 39 | - expandCodeblocks | |
| 40 | 39 | relativeFilePath={args.filepath ?? ""} |
| 41 | 40 | changes={args.diff ?? ""} |
| 42 | 41 | toolCallId={toolCall.id} |
modified gui/src/pages/gui/ToolCallDiv/index.tsx +16 −0
| @@ -85,6 +85,22 @@ | ||
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | + // Trying this out while it's an experimental feature | |
| 89 | + // Obviously missing the truncate and args buttons | |
| 90 | + // All the info from args is displayed here | |
| 91 | + // But we'd need a nicer place to put the truncate button and the X icon when tool call fails | |
| 92 | + if ( | |
| 93 | + props.toolCall.function?.name === BuiltInToolNames.SearchAndReplaceInFile | |
| 94 | + ) { | |
| 95 | + return ( | |
| 96 | + <FunctionSpecificToolCallDiv | |
| 97 | + toolCall={props.toolCall} | |
| 98 | + toolCallState={props.toolCallState} | |
| 99 | + historyIndex={props.historyIndex} | |
| 100 | + /> | |
| 101 | + ); | |
| 102 | + } | |
| 103 | + | |
| 88 | 104 | return ( |
| 89 | 105 | <ToolCallDisplay |
| 90 | 106 | icon={getStatusIcon(props.toolCallState.status)} |
modified gui/src/redux/thunks/streamNormalInput.ts +48 −3
| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; |
| 2 | -import { LLMFullCompletionOptions } from "core"; | |
| 2 | +import { LLMFullCompletionOptions, ModelDescription, Tool } from "core"; | |
| 3 | 3 | import { modelSupportsTools } from "core/llm/autodetect"; |
| 4 | 4 | import { ToCoreProtocol } from "core/protocol"; |
| 5 | +import { BuiltInToolNames } from "core/tools/builtIn"; | |
| 5 | 6 | import { selectActiveTools } from "../selectors/selectActiveTools"; |
| 6 | 7 | import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; |
| 7 | 8 | import { selectSelectedChatModel } from "../slices/configSlice"; |
| @@ -21,6 +22,49 @@ | ||
| 21 | 22 | } from "../util/constructMessages"; |
| 22 | 23 | import { callCurrentTool } from "./callCurrentTool"; |
| 23 | 24 | |
| 25 | +/** | |
| 26 | + * Filters tools based on the selected model's capabilities. | |
| 27 | + * Returns either the edit file tool or search and replace tool, but not both. | |
| 28 | + */ | |
| 29 | +function filterToolsForModel( | |
| 30 | + tools: Tool[], | |
| 31 | + selectedModel: ModelDescription, | |
| 32 | +): Tool[] { | |
| 33 | + const editFileTool = tools.find( | |
| 34 | + (tool) => tool.function.name === BuiltInToolNames.EditExistingFile, | |
| 35 | + ); | |
| 36 | + const searchAndReplaceTool = tools.find( | |
| 37 | + (tool) => tool.function.name === BuiltInToolNames.SearchAndReplaceInFile, | |
| 38 | + ); | |
| 39 | + | |
| 40 | + // If we don't have both tools, return tools as-is | |
| 41 | + if (!editFileTool || !searchAndReplaceTool) { | |
| 42 | + return tools; | |
| 43 | + } | |
| 44 | + | |
| 45 | + // Determine which tool to use based on the model | |
| 46 | + const shouldUseFindReplace = shouldUseFindReplaceEdits(selectedModel); | |
| 47 | + | |
| 48 | + // Filter out the unwanted tool | |
| 49 | + return tools.filter((tool) => { | |
| 50 | + if (tool.function.name === BuiltInToolNames.EditExistingFile) { | |
| 51 | + return !shouldUseFindReplace; | |
| 52 | + } | |
| 53 | + if (tool.function.name === BuiltInToolNames.SearchAndReplaceInFile) { | |
| 54 | + return shouldUseFindReplace; | |
| 55 | + } | |
| 56 | + return true; | |
| 57 | + }); | |
| 58 | +} | |
| 59 | + | |
| 60 | +/** | |
| 61 | + * Determines whether to use search and replace tool instead of edit file | |
| 62 | + * Right now we only know that this is reliable with Claude models | |
| 63 | + */ | |
| 64 | +function shouldUseFindReplaceEdits(model: ModelDescription): boolean { | |
| 65 | + return model.model.includes("claude"); | |
| 66 | +} | |
| 67 | + | |
| 24 | 68 | export const streamNormalInput = createAsyncThunk< |
| 25 | 69 | void, |
| 26 | 70 | { |
| @@ -37,8 +81,9 @@ | ||
| 37 | 81 | throw new Error("No chat model selected"); |
| 38 | 82 | } |
| 39 | 83 | |
| 40 | - // Get tools | |
| 41 | - const activeTools = selectActiveTools(state); | |
| 84 | + // Get tools and filter them based on the selected model | |
| 85 | + const allActiveTools = selectActiveTools(state); | |
| 86 | + const activeTools = filterToolsForModel(allActiveTools, selectedChatModel); | |
| 42 | 87 | const toolsSupported = modelSupportsTools(selectedChatModel); |
| 43 | 88 | |
| 44 | 89 | // Construct completion options |