Add tool confirmation UI with Accept/Decline for write operations
Before executing any write tool (create/update/delete), the backend now pauses with an asyncio.Future and emits a tool_pending SSE event. The frontend displays a ToolConfirmCard with Accept and Decline buttons. Clicking Accept resolves the Future and proceeds; Decline records a declined tool_call chip and falls through to regular streaming. Typing single-word yes/no responses (e.g. "yes", "cancel") also works as confirmation. 120s timeout auto-declines if no response. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,9 @@ class GenerationBuffer:
|
||||
finished_at: float | None = None
|
||||
cancel_event: asyncio.Event = field(default_factory=asyncio.Event)
|
||||
_notify: asyncio.Event = field(default_factory=asyncio.Event)
|
||||
# Tool confirmation — set when a write tool is awaiting user approval
|
||||
confirmation_future: asyncio.Future | None = None
|
||||
pending_tool: dict | None = None
|
||||
|
||||
def append_event(self, event_type: str, data: dict) -> SSEEvent:
|
||||
event = SSEEvent(index=len(self.events), event_type=event_type, data=data)
|
||||
|
||||
Reference in New Issue
Block a user