diff options
| author | Adam Malczewski <[email protected]> | 2026-06-12 02:25:57 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-12 02:25:57 +0900 |
| commit | 86b5137c4f7f2bcc08f0580f1edaa05d14015e63 (patch) | |
| tree | 20215a5dccf1b76cf9cf95fceec1eca450aa8559 /packages/transport-http/src | |
| parent | 839f5c02676a0b7def27ace7125fbec3aa08bda5 (diff) | |
| download | dispatch-86b5137c4f7f2bcc08f0580f1edaa05d14015e63.tar.gz dispatch-86b5137c4f7f2bcc08f0580f1edaa05d14015e63.zip | |
feat(turns): detached turns + multi-client live view
A turn no longer dies when its WebSocket connection closes. The turn-broadcast
hub moves into the core (session-orchestrator): turns run detached, persist at
seal regardless of clients, and fan out AgentEvents to N subscribers per
conversation with in-flight buffer replay for late-joiners. transport-ws stops
aborting turns on socket close and gains chat.subscribe/chat.unsubscribe so a
second device (or a reloaded browser) can watch a running turn.
- @dispatch/transport-contract 0.6.0->0.7.0: chat.subscribe/chat.unsubscribe WS ops
- session-orchestrator: startTurn/subscribe/isActive; persistent subscribers +
per-turn buffer (two-map model); handleMessage = convenience wrapper (no signal)
- transport-ws: per-connection chat-subscription fan-out; no turn-abort-on-close
- transport-http: test fakes updated for the widened interface (runtime unchanged)
- design notes/turn-continuity-design.md; FE courier frontend-turn-continuity-handoff.md
Live-verified vs flash (2-client WS): sender disconnect mid-turn -> other client
streams to done + turn persists; late-join replays turn from turn-start. 891 vitest
+ transport bun green; tsc -b EXIT 0; biome clean.
Diffstat (limited to 'packages/transport-http/src')
| -rw-r--r-- | packages/transport-http/src/app.test.ts | 27 | ||||
| -rw-r--r-- | packages/transport-http/src/server.bun.test.ts | 9 |
2 files changed, 36 insertions, 0 deletions
diff --git a/packages/transport-http/src/app.test.ts b/packages/transport-http/src/app.test.ts index 07f6777..32e9689 100644 --- a/packages/transport-http/src/app.test.ts +++ b/packages/transport-http/src/app.test.ts @@ -106,6 +106,15 @@ function createFakeConversationStore( function createFakeOrchestrator(events: AgentEvent[]): SessionOrchestrator { return { + startTurn() { + return { started: true, turnId: "fake-turn" }; + }, + subscribe() { + return () => {}; + }, + isActive() { + return false; + }, async handleMessage(input) { for (const event of events) { input.onEvent(event); @@ -124,6 +133,15 @@ function createCapturingOrchestrator(): SessionOrchestrator & { get received() { return state.received; }, + startTurn() { + return { started: true, turnId: "fake-turn" }; + }, + subscribe() { + return () => {}; + }, + isActive() { + return false; + }, async handleMessage(input) { state.received = input; }, @@ -132,6 +150,15 @@ function createCapturingOrchestrator(): SessionOrchestrator & { function createThrowingOrchestrator(error: Error): SessionOrchestrator { return { + startTurn() { + return { started: true, turnId: "fake-turn" }; + }, + subscribe() { + return () => {}; + }, + isActive() { + return false; + }, async handleMessage() { throw error; }, diff --git a/packages/transport-http/src/server.bun.test.ts b/packages/transport-http/src/server.bun.test.ts index b43469f..8a719c0 100644 --- a/packages/transport-http/src/server.bun.test.ts +++ b/packages/transport-http/src/server.bun.test.ts @@ -55,6 +55,15 @@ function fakeConversationStore(): ConversationStore { function fakeOrchestrator(): SessionOrchestrator { return { + startTurn() { + return { started: true, turnId: "fake-turn" }; + }, + subscribe() { + return () => {}; + }, + isActive() { + return false; + }, async handleMessage() {}, }; } |
