Slice 4: graceful project handoff (pending switch + ack)

Add pending-switch coordination to internal/activity (RequestSwitch/PendingSwitch/AckSwitch/CancelSwitch); AckSwitch atomically sets the active project and records switch-completed with Claude's summary. New MCP tools get_pending_switch and ack_switch (request is user-only via HTTP). HTTP GET/POST/DELETE /api/switch. New <handoff-bar> component (ask/waiting/cancel/completed) over SSE; activity-feed reflects switch-completed. Test covers request->ack->clear. Verified live: request/waiting/cancel over SSE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 08:27:22 -04:00
parent 65daedc902
commit 2b77e15b36
13 changed files with 449 additions and 10 deletions
+3 -1
View File
@@ -50,7 +50,9 @@ class ActivityFeed extends HTMLElement {
#onEvent(ev) {
this.#events.push(ev);
if (this.#events.length > 200) this.#events = this.#events.slice(-200);
if (ev.kind === 'active-project-changed') this.#renderActive(ev.repo || '');
if (ev.kind === 'active-project-changed' || ev.kind === 'switch-completed') {
this.#renderActive(ev.repo || '');
}
this.#renderFeed();
}
@@ -19,6 +19,8 @@ graceful project handoff (§8.3).
## History
- 2026-09-20: created — slice 3; live active-project + activity view over SSE.
- 2026-09-20: also update the active-project display on `switch-completed` events
(slice 4 handoff), not only `active-project-changed`.
## Notes / gotchas
- All server-derived text is escaped before insertion (repo paths, details,