From 9c8c4017228065dc891671bdf77c3f5d12814705 Mon Sep 17 00:00:00 2001 From: Lukas Kosina Date: Mon, 2 Mar 2026 16:00:53 +0100 Subject: [PATCH] Fix Bash permission requests showing "Running" instead of "Waiting for input" (#29) Add Bash, Write, Edit, and NotebookEdit to INTERACTIVE_TOOLS set so PreToolUse events for these tools produce status "waiting" and trigger notifications. Co-Authored-By: Claude Opus 4.6 --- src/state.test.ts | 34 +++++++++++++++++++++++++++++++++- src/state.ts | 9 ++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/state.test.ts b/src/state.test.ts index 3d2d334..507309d 100644 --- a/src/state.test.ts +++ b/src/state.test.ts @@ -158,12 +158,44 @@ describe("createStore", () => { const session = store.handleEvent({ session_id: "s1", hook_event_name: "PreToolUse", - tool_name: "Bash", + tool_name: "Read", }); assert.equal(session?.status, "running"); + assert.equal(session?.lastEvent, "Read"); + }); + + it("PreToolUse with Bash transitions to waiting", () => { + const store = createStore(); + store.handleEvent({ session_id: "s1", hook_event_name: "SessionStart" }); + store.handleEvent({ + session_id: "s1", + hook_event_name: "UserPromptSubmit", + }); + const session = store.handleEvent({ + session_id: "s1", + hook_event_name: "PreToolUse", + tool_name: "Bash", + }); + assert.equal(session?.status, "waiting"); assert.equal(session?.lastEvent, "Bash"); }); + it("PreToolUse with Write transitions to waiting", () => { + const store = createStore(); + store.handleEvent({ session_id: "s1", hook_event_name: "SessionStart" }); + store.handleEvent({ + session_id: "s1", + hook_event_name: "UserPromptSubmit", + }); + const session = store.handleEvent({ + session_id: "s1", + hook_event_name: "PreToolUse", + tool_name: "Write", + }); + assert.equal(session?.status, "waiting"); + assert.equal(session?.lastEvent, "Write"); + }); + it("PreToolUse without tool_name falls back to PreToolUse display", () => { const store = createStore(); store.handleEvent({ session_id: "s1", hook_event_name: "SessionStart" }); diff --git a/src/state.ts b/src/state.ts index ce3c536..379ca56 100644 --- a/src/state.ts +++ b/src/state.ts @@ -30,7 +30,14 @@ const EVENT_TO_STATUS: Record = { Stop: "done", }; -const INTERACTIVE_TOOLS = new Set(["ExitPlanMode", "AskUserQuestion"]); +const INTERACTIVE_TOOLS = new Set([ + "ExitPlanMode", + "AskUserQuestion", + "Bash", + "Write", + "Edit", + "NotebookEdit", +]); export function createStore(): Store { const sessions = new Map();