fix: forward hook event data to notifications

The server was dropping the `data` field from hook-event POST requests,
so notifications always showed generic messages. Now forwards tool name,
command, question text, and reason to the frontend.

Notifications now show:
- permission_prompt: "Bash: docker push prod:latest"
- elicitation_dialog: "Merge PR #42 to main?"
- idle_prompt: custom message if provided
- stop: reason if provided

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-24 03:58:51 +01:00
co-authored by Claude Opus 4.5
parent a2d4303300
commit 6393e00e95
3 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -1459,7 +1459,7 @@ export class WebServer extends EventEmitter {
// ========== Hook Events ==========
this.app.post('/api/hook-event', async (req) => {
const { event, sessionId } = req.body as HookEventRequest;
const { event, sessionId, data } = req.body as HookEventRequest;
const validEvents = ['idle_prompt', 'permission_prompt', 'elicitation_dialog', 'stop'] as const;
if (!event || !validEvents.includes(event as typeof validEvents[number])) {
return createErrorResponse(ApiErrorCode.INVALID_INPUT, 'Invalid event type');
@@ -1476,7 +1476,7 @@ export class WebServer extends EventEmitter {
}
}
this.broadcast(`hook:${event}`, { sessionId, timestamp: Date.now() });
this.broadcast(`hook:${event}`, { sessionId, timestamp: Date.now(), ...data });
return { success: true };
});
}