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:
Dave
2026-02-23 15:56:01 +00:00
parent 5e33a0c0b3
commit e0bc4bdc90
7 changed files with 341 additions and 43 deletions

View File

@@ -0,0 +1,26 @@
---
name: Agent Permission Prompts in Web UI
test_plan: pending
---
# Story 62: Agent Permission Prompts in Web UI
## User Story
As a user interacting with an agent through the web UI, I want to be prompted for permission approvals (e.g. file writes, commits) so that the agent can complete tasks that require elevated permissions without getting blocked.
Right now, the web UI does not have any way of the user allowing permissions requests, so dev processes are basically blocked.
## Acceptance Criteria
- [ ] When an agent action requires permission (e.g. writing to a file, committing), the web UI surfaces a prompt to the user
- [ ] The user can approve or deny the permission request from the UI
- [ ] On approval, the agent continues with the requested action
- [ ] On denial, the agent receives the denial and adjusts its approach
- [ ] Permission prompts display enough context (file path, action type) for the user to make an informed decision
## Out of Scope
- Bulk/blanket permission grants (e.g. "allow all writes to this directory")
- Persisting permission decisions across sessions