diff --git a/CLAUDE.md b/CLAUDE.md index 5ba307c2..b8bf1c8f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -474,7 +474,7 @@ Key events for frontend handling (see `app.js:handleSSEEvent()`): - `respawn:detectionUpdate` - Multi-layer idle detection status (confidence level, waiting state) - `spawn:queued`, `spawn:started`, `spawn:completed`, `spawn:failed`, `spawn:timeout`, `spawn:cancelled` - Agent lifecycle - `spawn:progress`, `spawn:message`, `spawn:budgetWarning`, `spawn:stateUpdate` - Agent monitoring -- `hook:idle_prompt`, `hook:permission_prompt`, `hook:stop` - Claude Code hooks (desktop notifications) +- `hook:idle_prompt`, `hook:permission_prompt`, `hook:elicitation_dialog`, `hook:stop` - Claude Code hooks (desktop notifications) ### Frontend (app.js) @@ -678,7 +678,7 @@ Long-running sessions are supported with automatic trimming: | GET | `/api/spawn/status` | Orchestrator status (counts, config) | | PUT | `/api/spawn/config` | Update orchestrator config | | POST | `/api/spawn/trigger` | Programmatic spawn (bypass terminal detection) | -| POST | `/api/hook-event` | Receive Claude Code hook callbacks (idle_prompt, permission_prompt, stop) | +| POST | `/api/hook-event` | Receive Claude Code hook callbacks (idle_prompt, permission_prompt, elicitation_dialog, stop) | ## Keyboard Shortcuts (Web UI) diff --git a/README.md b/README.md index 0fe284c8..3e30990b 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,21 @@ curl -X POST localhost:3000/api/sessions/:id/auto-compact \ --- +### 🔔 Desktop Notifications via Hooks + +Automatic desktop notifications when sessions need attention — powered by Claude Code's hooks system: + +| Hook Event | Urgency | Meaning | +|------------|---------|---------| +| `permission_prompt` | Critical | Claude needs tool approval | +| `elicitation_dialog` | Critical | Claude is asking a question | +| `idle_prompt` | Warning | Session idle, waiting for input | +| `stop` | Info | Response complete | + +Hooks are auto-configured per case directory (`.claude/settings.local.json`). Requires `--https` flag for browser notification API support. + +--- + ### 🖥️ Multi-Session Dashboard Run **20 parallel sessions** with full visibility: @@ -257,6 +272,11 @@ npx tsx src/index.ts web | `POST` | `/api/spawn/agents/:id/cancel` | Cancel agent | | `POST` | `/api/spawn/trigger` | Programmatic spawn | +### Hooks & Notifications +| Method | Endpoint | Description | +|--------|----------|-------------| +| `POST` | `/api/hook-event` | Claude Code hook callbacks | + ### Real-Time | Method | Endpoint | Description | |--------|----------|-------------| diff --git a/src/web/public/app.js b/src/web/public/app.js index 2db8b175..fab7d263 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -1120,6 +1120,19 @@ class ClaudemanApp { }); }); + this.eventSource.addEventListener('hook:elicitation_dialog', (e) => { + const data = JSON.parse(e.data); + const session = this.sessions.get(data.sessionId); + this.notificationManager?.notify({ + urgency: 'critical', + category: 'hook-elicitation', + sessionId: data.sessionId, + sessionName: session?.name || data.sessionId, + title: 'Question Asked', + message: 'Claude is asking a question and waiting for your answer', + }); + }); + this.eventSource.addEventListener('hook:stop', (e) => { const data = JSON.parse(e.data); const session = this.sessions.get(data.sessionId);