Add abort signal handling to read, write, and edit tools
All tools now check the abort signal before executing and throw "Operation aborted" error if the signal is already aborted. This ensures consistent abort behavior across all tools.
This commit is contained in:
@@ -32,7 +32,13 @@ export const editTool: AgentTool<typeof editSchema> = {
|
||||
execute: async (
|
||||
_toolCallId: string,
|
||||
{ path, oldText, newText }: { path: string; oldText: string; newText: string },
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
// Check if already aborted
|
||||
if (signal?.aborted) {
|
||||
throw new Error("Operation aborted");
|
||||
}
|
||||
|
||||
const absolutePath = resolve(expandPath(path));
|
||||
|
||||
if (!existsSync(absolutePath)) {
|
||||
|
||||
Reference in New Issue
Block a user