diff options
| author | Adam Malczewski <[email protected]> | 2026-06-06 19:39:05 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-06 19:39:05 +0900 |
| commit | 44e27177892a48a51c440676ff3f6613deef5164 (patch) | |
| tree | c4e11755df86b1284e3b12b46d25ab4c62b81860 /packages/session-orchestrator/src | |
| parent | 22936857685c318b71752d625808100b1a96e63e (diff) | |
| download | dispatch-44e27177892a48a51c440676ff3f6613deef5164.tar.gz dispatch-44e27177892a48a51c440676ff3f6613deef5164.zip | |
feat(wire,conversation-store): per-chunk seq sync cursor (StoredChunk)
Add StoredChunk { seq, role, chunk } to @dispatch/wire (re-exported via the
kernel contract shims). Keeps Chunk pure (provider-facing, no cursor); the
sync cursor lives only on the envelope.
conversation-store: rekey conv:<id>:msg:<seq> -> conv:<id>:chunk:<seq>;
append explodes messages into role-tagged seq'd chunks (1-based, gap-free,
monotonic) with internal boundary metadata so load() round-trips ChatMessage[]
losslessly and still reconciles; new loadSince(id, sinceSeq?) raw sync stream.
session-orchestrator test fake conforms to the widened interface.
FE Slice 2 backend prereq (per-chunk seq). typecheck clean, 469 vitest, biome clean.
Diffstat (limited to 'packages/session-orchestrator/src')
| -rw-r--r-- | packages/session-orchestrator/src/orchestrator.test.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/session-orchestrator/src/orchestrator.test.ts b/packages/session-orchestrator/src/orchestrator.test.ts index d381d6c..39c95d5 100644 --- a/packages/session-orchestrator/src/orchestrator.test.ts +++ b/packages/session-orchestrator/src/orchestrator.test.ts @@ -6,6 +6,7 @@ import type { ProviderEvent, RunTurnInput, RunTurnResult, + StoredChunk, } from "@dispatch/kernel"; import { runTurn } from "@dispatch/kernel"; import { describe, expect, it } from "vitest"; @@ -24,6 +25,20 @@ function createInMemoryStore(): ConversationStore & { async load(conversationId) { return [...(data.get(conversationId) ?? [])]; }, + async loadSince(conversationId, sinceSeq) { + const messages = data.get(conversationId) ?? []; + const result: StoredChunk[] = []; + let seq = 1; + for (const msg of messages) { + for (const chunk of msg.chunks) { + if (sinceSeq === undefined || seq > sinceSeq) { + result.push({ seq, role: msg.role, chunk }); + } + seq++; + } + } + return result; + }, }; } |
