refactor: add canonical transcript assembly seam

This commit is contained in:
tommy0103
2026-07-21 00:58:34 +08:00
parent 3ee44de4e5
commit f79f1b3e3b
39 changed files with 1741 additions and 670 deletions
@@ -33,7 +33,9 @@ binding-agnostic and does not need a per-binding implementation.
`IndexUnit` when correctness requires whole-unit semantics — for example,
Codex duplicate reconciliation or Kimi `context.undo` / `context.clear`
replay. Each adapter maps its own resume/change semantics onto the existing
`mtime` and `lines_processed` cursor pair in `index_state`.
`mtime` and `lines_processed` cursor pair in `index_state`. The emitted
`TranscriptRecord` stream is also the input to provider-independent session
detail assembly; see ADR-0007.
- **Persist axis — one shared orchestration.** A single provider-agnostic,
binding-agnostic layer consumes records from any adapter and writes them:
incremental `index_state` bookkeeping, FTS maintenance, and the canonical
@@ -56,9 +58,9 @@ main process migrates to ESM (ADR-0003) to import the shared core. The real work
is disentangling the currently interleaved parse-and-write inside `indexJsonl` /
`indexCodexJsonl` into (pure adapter parse) + (shared persist).
The SQLite schema and normalized `IndexRecord` union are the stable center of
the design. Provider-only concepts are either projected lossily into that
language or ignored; they do not add provider columns or tables. The registry,
The normalized `TranscriptRecord` union is the stable center of the design, and
SQLite is one serialization adapter for it. Provider-only concepts are either
projected lossily into that language or ignored. The registry,
not provider switches, drives both indexers, watcher roots, persisted source
roots, source catalog/UI labels and colors, and raw-record routing. Adding Pi
therefore changes the Pi adapter, its registration, and its conformance tests;