From 9cc3d69e4dfc467fefd9cd98b90ed9be64df8468 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 10 Sep 2025 18:15:23 -0700 Subject: [PATCH] fix: edit impl --- .../redux/thunks/handleApplyStateUpdate.ts | 27 +++++++++++++++++++ gui/src/util/clientTools/editImpl.ts | 14 +++------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/gui/src/redux/thunks/handleApplyStateUpdate.ts b/gui/src/redux/thunks/handleApplyStateUpdate.ts index 25532e750..1a28cc3d4 100644 --- a/gui/src/redux/thunks/handleApplyStateUpdate.ts +++ b/gui/src/redux/thunks/handleApplyStateUpdate.ts @@ -89,6 +89,33 @@ export const handleApplyStateUpdate = createAsyncThunk< toolCallId: applyState.toolCallId, }), ); + dispatch( + updateToolCallOutput({ + toolCallId: applyState.toolCallId, + contextItems: [ + { + name: "Edit Success", + content: `Successfully edited ${applyState.filepath}`, + description: "", + hidden: true, + }, + ], + }), + ); + } else { + dispatch( + updateToolCallOutput({ + toolCallId: applyState.toolCallId, + contextItems: [ + { + name: "Edit Failed", + content: `Failed to edited ${applyState.filepath}. To continue working with the file, read it again to see the most up-to-date contents`, + description: "", + hidden: true, + }, + ], + }), + ); } void dispatch( diff --git a/gui/src/util/clientTools/editImpl.ts b/gui/src/util/clientTools/editImpl.ts index cefc6832f..967b3cc8d 100644 --- a/gui/src/util/clientTools/editImpl.ts +++ b/gui/src/util/clientTools/editImpl.ts @@ -17,13 +17,13 @@ export const editToolImpl: ClientToolImpl = async ( filepath = filepath.slice(2); } - const openFiles = await extras.ideMessenger.ide.getOpenFiles(); let firstUriMatch = await resolveRelativePathInDir( filepath, extras.ideMessenger.ide, ); - + if (!firstUriMatch) { + const openFiles = await extras.ideMessenger.ide.getOpenFiles(); for (const uri of openFiles) { if (uri.endsWith(filepath)) { firstUriMatch = uri; @@ -46,13 +46,7 @@ export const editToolImpl: ClientToolImpl = async ( ); return { - respondImmediately: true, - output: [ - { - name: "File edited successfully", - content: `Successfully initiated edit for ${firstUriMatch}`, - description: "File edit operation started", - }, - ], + respondImmediately: false, + output: undefined, // no immediate output - output for edit tools should be added based on apply state coming in }; };