From d98a63ce17519983dcf58c27432723e2f4b96e75 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sun, 21 Jun 2026 02:19:54 +0900 Subject: feat(chat): message queue + steering — mid-turn injection at tool-result boundaries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consume the message-queue + steering handoff (wire@0.8.0, transport-contract@0.12.0). Re-pinned file: deps + re-mirrored .dispatch/*.reference.md. - fold steering AgentEvent into the transcript as a provisional user bubble (after the tool-result it followed; no de-dup — the queue surface carried it) - add rendererId: "message-queue" custom renderer (pure parser + MessageQueueList) rendered as a compact panel above the Composer (hidden when queue is empty) - add ChatStore.queueMessage / AppStore.queueMessage — sends chat.queue WS op (trim/validate non-empty; auto-starts a turn if idle) - Composer switches to chat.queue while generating (button → Queue, placeholder → Steer the conversation...) - exhaustiveness guards updated for steering + chat.queue - carry-to-new-turn needs no special handling (normal new turn) 664 tests green. --- src/core/wire/conformance.test.ts | 8 ++++++-- src/core/wire/conformance.ts | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/core/wire') diff --git a/src/core/wire/conformance.test.ts b/src/core/wire/conformance.test.ts index a258873..2fdd3cb 100644 --- a/src/core/wire/conformance.test.ts +++ b/src/core/wire/conformance.test.ts @@ -75,6 +75,7 @@ describe("classifies every AgentEvent type", () => { { type: "error", conversationId: "c1", turnId: "t1", message: "oops" }, { type: "done", conversationId: "c1", turnId: "t1", reason: "complete" }, { type: "turn-sealed", conversationId: "c1", turnId: "t1" }, + { type: "steering", conversationId: "c1", turnId: "t1", text: "steer mid-turn" }, ]; it("returns a stable label for every AgentEvent.type variant", () => { @@ -93,11 +94,12 @@ describe("classifies every AgentEvent type", () => { "error", "done", "turn-sealed", + "steering", ]); }); - it("covers all 13 AgentEvent variants", () => { - expect(samples).toHaveLength(13); + it("covers all 14 AgentEvent variants", () => { + expect(samples).toHaveLength(14); }); }); @@ -152,6 +154,7 @@ describe("classifies every WsClientMessage type", () => { { type: "chat.send" as const, message: "hi" }, { type: "chat.subscribe" as const, conversationId: "c1" }, { type: "chat.unsubscribe" as const, conversationId: "c1" }, + { type: "chat.queue" as const, conversationId: "c1", text: "steer" }, ]; const labels = msgs.map(assertWsClientMessageExhaustive); expect(labels).toEqual([ @@ -161,6 +164,7 @@ describe("classifies every WsClientMessage type", () => { "chat.send", "chat.subscribe", "chat.unsubscribe", + "chat.queue", ]); }); }); diff --git a/src/core/wire/conformance.ts b/src/core/wire/conformance.ts index 13be78c..6e87e5c 100644 --- a/src/core/wire/conformance.ts +++ b/src/core/wire/conformance.ts @@ -34,6 +34,8 @@ export function assertAgentEventExhaustive(event: AgentEvent): string { return "turn-sealed"; case "step-complete": return "step-complete"; + case "steering": + return "steering"; default: return event satisfies never; } @@ -102,6 +104,8 @@ export function assertWsClientMessageExhaustive(msg: WsClientMessage): string { return "chat.subscribe"; case "chat.unsubscribe": return "chat.unsubscribe"; + case "chat.queue": + return "chat.queue"; default: return msg satisfies never; } -- cgit v1.2.3