feat: add ignore option for permission requests (UI-only dismissal)
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user