From b3d270803f95db2467e20bb742aa42faf6867f91 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Fri, 12 Jun 2026 14:58:33 +0900 Subject: fix(turns): emit user prompt on the turn event stream (CR-3) A pure watcher (subscribed but not the sender) couldn't see the user prompt until the turn sealed: the user message was only persisted at seal and never entered the live/replayable stream. Add an additive TurnInputEvent {type:"user-message", conversationId, turnId, text} to the AgentEvent union and emit it via the broadcast/buffer path as the first event of every turn, so it is replayed to all subscribers (live + late-join) and on the HTTP path. Persistence and metrics unchanged; the union widening breaks no exhaustive switch. - @dispatch/wire 0.5.0->0.6.0; @dispatch/transport-contract 0.7.0->0.8.0 (re-export) - session-orchestrator: emit user-message at runTurnDetached start; +3 tests, 3 Wave-1 tests updated (user-message precedes turn-start) - FE courier: frontend-cr3-user-message-handoff.md Live-verified vs flash: watcher receives user-message (correct text) as its first chat.delta before turn-sealed. 894 vitest + transport bun green; tsc -b EXIT 0. --- tasks.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tasks.md') diff --git a/tasks.md b/tasks.md index b745810..f7e9330 100644 --- a/tasks.md +++ b/tasks.md @@ -5,7 +5,7 @@ > Keep this lean and current; do not let it re-accrete a step-by-step changelog. ## Status (current) -`tsc -b` EXIT 0 · biome clean · **891 vitest + transport bun green**. +`tsc -b` EXIT 0 · biome clean · **894 vitest + transport bun green**. Built and verified live (full-fidelity: every feature is a manifest-loaded extension through the host): @@ -283,6 +283,23 @@ Principle enforced: **the FE is only a control interface; the AI runs independen zero deltas though the turn ran+persisted. Caught by live-verify (unit test had subscribed AFTER start, masking it). Fixed via the persistent-subscribers / per-turn-buffer split. +## Turn continuity — CR-3: user prompt on the event stream (DONE) +FE bug (multi-client): a pure watcher (subscribed, not the sender) couldn't see the USER prompt until +seal — the user message was passed to the provider + persisted only at seal, never on the turn's +outward stream/buffer. FE courier: `frontend-cr3-user-message-handoff.md`. +- **Contract:** `@dispatch/wire` `0.5.0→0.6.0` — additive `TurnInputEvent` + `{ type:"user-message"; conversationId; turnId; text }` on the `AgentEvent` union (kernel barrels + re-export it). `@dispatch/transport-contract` `0.7.0→0.8.0` (re-export only). Widening broke NO + exhaustive switch (typecheck clean) — zero consumer fan-out. +- **session-orchestrator:** `emitToHub({type:"user-message",…})` as the FIRST event of `runTurnDetached` + (before `runTurn`) → buffered + broadcast to all subscribers (live + late-join); HTTP path covered via + `handleMessage`'s buffer replay. Persistence + metrics unchanged. +3 tests; 3 Wave-1 tests updated + (user-message now precedes turn-start). +- **LIVE-VERIFIED vs flash:** a watcher that never sent receives `user-message` (correct text) as its + FIRST `chat.delta`, before `turn-sealed`, then the streaming reply. `RESULT: OK`. +- **Process note:** implemented directly by the orchestrator (user directive: "do implementations + yourself going forward") rather than via a summoned owner-agent. + ## Open items - **Context window LIMIT (next, sibling of context size):** expose the selected model's max context-window token limit so the FE can render `contextSize / limit` (e.g. `1286 / 200000`). -- cgit v1.2.3