fix: Wire up interactive permission, question, and plan cards in PromptBar

- Broadcast PermissionRequest hook as claude-permission WS event
- Fix dedup bug where undefined requestId blocked all permission cards
- Add sendInput() to AgentTerminal for char-by-char PTY responses
- Make AskUserQuestion options clickable (sends option number to PTY)
- Add Approve/Reject buttons for ExitPlanMode plan cards
- Permission Allow/Deny now sends y/n to PTY instead of broken HTTP call
This commit is contained in:
2026-02-16 01:11:39 -06:00
parent 55265d5145
commit a91f82e1c3
3 changed files with 122 additions and 38 deletions

View File

@@ -107,7 +107,20 @@ export async function handleClaudeHook(req: Request): Promise<Response | null> {
console.error('[claude-hook] Failed to forward hook to terminal server:', e)
}
// 2. Derive status and broadcast for backward compat (App.vue/AgentBar.vue)
// 2. Forward PermissionRequest to /claude-permission so PromptBar WS listener picks it up
if (body.hook_event_name === 'PermissionRequest') {
try {
await fetch(`http://localhost:${PORT_TERMINAL}/claude-permission`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(hookData)
})
} catch (e) {
console.error('[claude-hook] Failed to forward permission to terminal server:', e)
}
}
// 3. Derive status and broadcast for backward compat (App.vue/AgentBar.vue)
const { status, tool } = deriveStatus(body)
try {
await fetch(`http://localhost:${PORT_TERMINAL}/claude-status`, {
@@ -119,7 +132,7 @@ export async function handleClaudeHook(req: Request): Promise<Response | null> {
console.error('[claude-hook] Failed to forward status to terminal server:', e)
}
// 3. Incremental transcript reading for real-time chat
// 4. Incremental transcript reading for real-time chat
if (body.session_id && body.transcript_path) {
const agentName = agent || 'main'
setActiveSession(agentName, body.session_id, body.transcript_path as string)