feat(story-62): add permission request prompts to web UI
When Claude Code requires user approval before executing a tool (file writes, commits, etc.) the agent sends a permission_request message over the WebSocket. The web UI now intercepts that message, surfaces a modal dialog showing the tool name and input, and lets the user approve or deny. The decision is sent back as a permission_response, allowing the agent to continue or adjust its approach. Backend changes: - claude_code.rs: parse "permission_request" NDJSON events from the PTY, block the PTY thread via a sync channel, and write the user's decision back to the PTY stdin as a JSON permission_response. - chat.rs: thread an optional UnboundedSender<PermissionReqMsg> through to the provider. - ws.rs: create a permission-request channel, forward requests to the client, collect responses via a pending-perms map, and interleave all of this with the active chat session using tokio::select!. Frontend changes: - client.ts: add permission_request to WsResponse, permission_response to WsRequest, onPermissionRequest handler to ChatWebSocket.connect(), and sendPermissionResponse() method. - types.ts: mirror the same type additions. - Chat.tsx: add permissionRequest state, wire onPermissionRequest callback, and render an approval modal with tool name, input context, Approve and Deny buttons. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Reference in New Issue
Block a user