refactor(chat-runtime): AdapterEvent uses `type`, like DurableEvent
Approval required
SU
24d ago+308+308+012345678901234567890123456789-321-321-012345678901234567890123456789
Summary
AdapterEventnow usestype:likeDurableEvent, instead of a parallel union keyed onkind:. Every adapter,LiveSessionand the event-queue tests speak one vocabulary:item | turn | session, withdeltaas the only extra case.LiveSessionjournals item and turn events as the adapter sent them, instead of rebuilding each one.FakeHarness.stripDelaydrops its per-case copy.
Why
The two unions had the same item and turn shapes under different discriminator names, so every hop rebuilt the object and a reader had to remember which key applied where. They still differ in two ways, and those stay: session is a partial patch from the adapter (LiveSession merges it into full state), and delta is live-only and never journaled.
Compatibility
AdapterEvent never leaves the host. The wire format (Envelope) and the journal (DurableEvent) are unchanged, so released clients and stored chat.db rows are not affected.
How the change was made
- The field was renamed only at the positions
tscreported as.kindonAdapterEventorScriptedEvent, soitem.kind,source.kindand timelineentry.kindwere not touched. - Afterwards I searched for
.kind === "item"|"turn"|"session"|"delta"reads through untyped values. That foundhost-service/scripts/acp-smoke.ts, which is outside the typecheck, and it's updated too.
Testing
bun run typecheck: chat-runtime, chat, host-servicebun test: chat-runtime (375 pass, 2 skipped), chat (94 pass), host-servicetrpc/router/sessionsandchat-v3(56 pass)biome checkon changed files