rowboat/apps/x/packages/core/src
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
..
account use rowboat model gateway when logged in 2026-03-12 23:29:42 +05:30
agent-loop Dedup turn transcripts, record model usage, make event delivery live 2026-06-12 21:44:53 +05:30
agent-schedule add posthog analytics for llm usage and auth events 2026-04-28 19:53:40 +05:30
agents feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
analytics Add app version to analytics events 2026-05-29 17:02:01 +05:30
application feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
auth Fix spurious "Reconnect Google" on cold start 2026-05-27 02:25:03 +05:30
background-tasks feat: render background-task HTML output and open its links externally (#615) 2026-06-11 01:45:10 +05:30
billing Show split monthly and daily credits 2026-05-24 12:48:23 +05:30
code-mode feat: run code mode on an in-app ACP client with live approvals (#593) 2026-06-05 14:45:08 +05:30
composio feat: native google sign-in for signed-in users 2026-05-05 14:29:13 +05:30
config feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
di feat: run code mode on an in-app ACP client with live approvals (#593) 2026-06-05 14:45:08 +05:30
events send LLM use-case metadata through Rowboat gateway 2026-05-20 07:11:06 +05:30
filesystem Refactor builtin file tools beyond workspace scope 2026-05-25 16:21:51 +05:30
knowledge feat: add user-configurable notification settings (#601) 2026-06-11 19:43:26 +05:30
local-sites Iframe (#502) 2026-04-18 12:10:40 +05:30
mcp remove default exa server 2026-03-19 18:46:08 +05:30
migrations feat: native google sign-in for signed-in users 2026-05-05 14:29:13 +05:30
models Add run-level auto permission mode 2026-06-03 07:58:04 +05:30
pre_built Refactor builtin file tools beyond workspace scope 2026-05-25 16:21:51 +05:30
runs Add run-level auto permission mode 2026-06-03 07:58:04 +05:30
schedule feat: background tasks 2026-05-12 17:43:25 +05:30
search Add global search across knowledge and chats 2026-02-18 18:08:24 +05:30
security Add run-level auto permission mode 2026-06-03 07:58:04 +05:30
services code clean up 2026-02-06 23:17:32 +05:30
sessions Dedup turn transcripts, record model usage, make event delivery live 2026-06-12 21:44:53 +05:30
slack Slack2 (#410) 2026-03-10 16:26:51 +05:30
storage Dedup turn transcripts, record model usage, make event delivery live 2026-06-12 21:44:53 +05:30
voice fix workdir everywhere (#475) 2026-04-10 10:40:46 +05:30
workspace Add SQLite storage foundation 2026-06-12 18:22:36 +05:30
index.ts Add SQLite storage foundation 2026-06-12 18:22:36 +05:30