rowboat/apps/x
Ramnique Singh 91bb3cc8cd Dedup turn transcripts, record model usage, make event delivery live
Three follow-ups from the runtime design review:

Transcript prefix dedup (storage-level, transparent):
- A session turn's input starts with the previous turn's closed transcript
  (copy-forward); storing it again made session storage quadratic and every
  fact append rewrote the whole transcript. Stores now keep only the suffix
  past prefix_length and recompute the prefix on read from the immutable
  previous turn (closedTranscript moved to agent-loop/types.ts; shared
  split/join helpers in prefix-dedup.ts with loud tripwires).
- Opportunistic: input that doesn't extend the previous transcript (e.g.
  future compaction summaries) falls back to whole-row storage. Nothing
  above the stores changed; InMemoryTurnStore mirrors SQLite exactly.
- Migration 0005 adds prefix_length (default 0 = stored whole).

Per-model-call usage recording:
- New modelUsage fact log on the turn: one entry per model call, committed
  in the same write as the assistant message it paid for. ModelAdapter
  results now carry {message, usage}; VercelModelAdapter treats usage
  reporting failures as null rather than failing a completed step.
- totalUsage() derives turn aggregates; null means never reported.
- Migration 0004 adds the model_usage column.

EventStream: replay removed, bus-style live delivery:
- Events go to consumers attached at push time and are dropped otherwise,
  matching the runtime's IBus philosophy (facts persisted, deltas cosmetic,
  renderer reconciles from snapshots). No buffering without consumers;
  per-iterator queues bounded by consumer lag. Iterators attach
  synchronously at creation so the loop's own for-await never misses events.

Also: dispatched-call closures get honest wording ("may have completed
externally") distinct from interrupted and never-ran; SqliteTurnStore.update
keeps the no-op write guard alongside the prefix_length read.

8 new tests (87 total).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 21:44:53 +05:30
..
apps Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
packages Dedup turn transcripts, record model usage, make event delivery live 2026-06-12 21:44:53 +05:30
patches feat: run code mode on an in-app ACP client with live approvals (#593) 2026-06-05 14:45:08 +05:30
.gitignore chore: ignore test-fixtures dir 2026-05-08 17:04:25 +05:30
ANALYTICS.md Add app version to analytics events 2026-05-29 17:02:01 +05:30
eslint.config.mts ignore renderer eslint 2026-01-16 12:05:33 +05:30
LIVE_NOTE.md Refactor builtin file tools beyond workspace scope 2026-05-25 16:21:51 +05:30
package.json integrate electron forge 2026-01-17 10:28:44 +05:30
pnpm-lock.yaml Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
pnpm-workspace.yaml Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
tsconfig.base.json bootstrap new electron app 2026-01-16 12:05:33 +05:30