From 3101127df60752d83e1c4278e47210f287a25b03 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:40:13 -0700 Subject: [PATCH 1/4] fix args bugs, iterate on lazy description --- core/tools/definitions/editFile.ts | 9 +++++---- .../gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx | 2 +- gui/src/util/clientTools/editImpl.ts | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/tools/definitions/editFile.ts b/core/tools/definitions/editFile.ts index 6ee5cee6b..b6739bbbe 100644 --- a/core/tools/definitions/editFile.ts +++ b/core/tools/definitions/editFile.ts @@ -3,7 +3,7 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; export interface EditToolArgs { filepath: string; - new_contents: string; + changes: string; } export const editFileTool: Tool = { @@ -20,16 +20,17 @@ export const editFileTool: Tool = { "Use this tool to edit an existing file. If you don't know the contents of the file, read it first.", parameters: { type: "object", - required: ["filepath", "new_contents"], + required: ["filepath", "changes"], properties: { filepath: { type: "string", description: "The path of the file to edit, relative to the root of the workspace.", }, - new_contents: { + changes: { type: "string", - description: "The new file contents", + description: + "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", }, }, }, diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index d9906794e..2ce148016 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -25,7 +25,7 @@ function FunctionSpecificToolCallDiv({ return ( ); diff --git a/gui/src/util/clientTools/editImpl.ts b/gui/src/util/clientTools/editImpl.ts index 2a6d3e1d4..3e5271228 100644 --- a/gui/src/util/clientTools/editImpl.ts +++ b/gui/src/util/clientTools/editImpl.ts @@ -19,7 +19,7 @@ export const editToolImpl: ClientToolImpl = async ( } const apply = await extras.ideMessenger.request("applyToFile", { streamId: extras.activeToolStreamId, - text: args.new_contents, + text: args.changes, toolCallId, filepath: firstUriMatch, }); From 63bffa948fcb07a3d172f1f32623a94f80312235 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:43:33 -0700 Subject: [PATCH 2/4] lazy edit file tool --- gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 2 +- gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 304dcb4c7..04da12cc9 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -6,7 +6,7 @@ import { useAppSelector } from "../../../redux/hooks"; type EditToolCallProps = { relativeFilePath: string; - newContents: string; + changes: string; toolCallId?: string; }; diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index 2ce148016..02759dd18 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -25,7 +25,7 @@ function FunctionSpecificToolCallDiv({ return ( ); From a1bbd2d45ab8cbe0492afcc7ef2758f4ea5b3533 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:44:39 -0700 Subject: [PATCH 3/4] iteration on edit file lazy tool --- core/tools/definitions/editFile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tools/definitions/editFile.ts b/core/tools/definitions/editFile.ts index b6739bbbe..9e2d60219 100644 --- a/core/tools/definitions/editFile.ts +++ b/core/tools/definitions/editFile.ts @@ -30,7 +30,7 @@ export const editFileTool: Tool = { changes: { type: "string", description: - "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", + "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", }, }, }, From 4b407e542938c4fca24ed1cd763baa2cd3a9a6b3 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 24 Apr 2025 21:50:29 -0700 Subject: [PATCH 4/4] fix broken change --- gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 04da12cc9..a298325b5 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -11,7 +11,7 @@ type EditToolCallProps = { }; export function EditFile(props: EditToolCallProps) { - const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.newContents ?? ""}\n\`\`\``; + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes ?? ""}\n\`\`\``; const isStreaming = useAppSelector((state) => state.session.isStreaming); const states = useAppSelector((store) => store.session.codeBlockApplyStates);