feat: add ignore option for permission requests (UI-only dismissal)

This commit is contained in:
2026-02-21 03:52:26 -06:00
parent 07783f2aea
commit 24ba1fdf76
5 changed files with 77 additions and 3 deletions

View File

@@ -348,6 +348,31 @@ export async function handleHooksApprovalRespondPlan(req: Request): Promise<Resp
}
}
// ── Ignore (remove from UI state only, don't respond to Claude Code) ──
export async function handleHooksApprovalIgnore(req: Request): Promise<Response | null> {
if (req.method !== 'POST') return null
try {
const body = await req.json() as { requestId: string }
if (!body.requestId) {
return errorResponse('Missing requestId', 400)
}
console.log(`[HooksApproval] Ignoring ${body.requestId} (removing from UI state only)`)
// Remove from session state → broadcasts patch to all clients
// The long-poll promise stays alive and will timeout naturally (120s),
// at which point Claude Code gets {} and handles it with default behavior.
notifyResolveApproval(body.requestId, 'ignore')
return jsonResponse({ success: true, requestId: body.requestId })
} catch (e) {
return errorResponse('Invalid JSON body', 400)
}
}
// ── List pending (for state recovery) ──
export async function handleHooksApprovalList(req: Request): Promise<Response | null> {