From 2699ff36793d2b93285563e87add99ad7e8b6a8f Mon Sep 17 00:00:00 2001 From: Hong Jiarong Date: Sat, 25 Jul 2026 14:18:57 +0800 Subject: [PATCH] fix(hub): include Edit in default single-agent tools Removing the claude_code preset dropped Edit. Unrestricted roles need it for in-place file edits; write_file also grants Edit for restricted roles. --- hub/src/agent/roleTools.ts | 4 +++- hub/test/unit/runner.test.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hub/src/agent/roleTools.ts b/hub/src/agent/roleTools.ts index 79c8c22..89262d8 100644 --- a/hub/src/agent/roleTools.ts +++ b/hub/src/agent/roleTools.ts @@ -1,6 +1,7 @@ export const DEFAULT_CLAUDE_BUILT_IN_TOOLS = [ "Read", "Write", + "Edit", "Bash", "Glob", "Grep", @@ -31,7 +32,7 @@ export interface ClaudeSdkToolConfig { const ROLE_TOOL_TO_CLAUDE_BUILT_INS: Readonly> = { read_file: ["Read"], - write_file: ["Write"], + write_file: ["Write", "Edit"], list_files: ["Glob"], search_files: ["Grep"], bash: ["Bash"], @@ -46,6 +47,7 @@ const ROLE_TOOL_TO_CLAUDE_BUILT_INS: Readonly> TodoWrite: ["TodoWrite"], Read: ["Read"], Write: ["Write"], + Edit: ["Edit"], Bash: ["Bash"], Glob: ["Glob"], Grep: ["Grep"], diff --git a/hub/test/unit/runner.test.ts b/hub/test/unit/runner.test.ts index df324f6..71e6805 100644 --- a/hub/test/unit/runner.test.ts +++ b/hub/test/unit/runner.test.ts @@ -114,7 +114,7 @@ describe("runAgent", () => { allowDangerouslySkipPermissions: true, settingSources: [], settings: { disableBundledSkills: true, todoFeatureEnabled: true }, - tools: expect.arrayContaining(["Read", "Write", "Bash", "Glob", "Grep", "TodoWrite"]), + tools: expect.arrayContaining(["Read", "Write", "Edit", "Bash", "Glob", "Grep", "TodoWrite"]), allowedTools: expect.arrayContaining(["TodoWrite", "mcp__cph_hub__todo_write"]), disallowedTools: expect.arrayContaining(["Agent", "SendMessage", "Task", "TeamCreate", "ScheduleWakeup"]), sandbox: expect.objectContaining({ @@ -151,6 +151,7 @@ describe("runAgent", () => { expect(call?.options?.tools).toEqual([ "Read", "Write", + "Edit", "Bash", "Glob", "Grep",