Skip to main content

Module transcript

Module transcript 

Source
Expand description

Transcript view-model (DESIGN §5.1 #12, §11 Altitude-2 Transcript tab).

An agent’s conversation is a directory of message files at <workspace>/agents/<agent-id>/messages/. Each file is NNN-<origin>.<ext> — order lives in the filename (the NNN counter), and origin lives in the filename token:

extorigin tokenentry
md<sender>delivered message, envelope stripped — bar its epitaph:
jsontooltool_result (content / is_error / tool_use_id)
json<model-id>model output — canonical content blocks

Both .json origins carry the same envelope: a bare array of canonical blocks as legacy litany committed it, or an API-shaped object wrapping them in content — with the provider’s token usage report as content’s sibling when one was reported (lernie ≥0.0.4). One function answers where the blocks live (parse::block_array) — two answers left every real NNN-tool.json in the Raw bucket (bl-47ec). | other / unparseable name / unparseable bytes | — | Raw bucket (never dropped) |

The directory is not append-only. litany’s compactor deletes message files and squashes the span they lived in, so a hole in the NNN counter is entries that were removed — [compaction] derives each one and seats a virtual EntryKind::Compacted marker in it, carrying whatever summary/** the compactor wrote in their place.

Everything is a pure function of the on-disk bytes (§3.5 stateless re-read): no field caches a fact the files already carry. “Tool in progress” is a query over the entries (a committed tool_use with no committed tool_result), never a stored flag (PRINCIPLES: single source of truth).

build reads only what is committed. The live streaming tail is Transcript::with_live, a virtual trailing entry the caller folds on from the rendered snapshot’s Stream — because the two have different clocks (§7.2): the committed read is memoized per published snapshot, and the tail moves at frame cadence. Merging them into one build made the tail as slow as the derivation, which is the defect bl-54f7 closed.

Structs§

Entry
One transcript row. raw is the verbatim backing bytes surfaced by the Raw toggle for any entry (§11 “every tab has a Raw toggle showing verbatim bytes”); kind is the parsed projection.
Transcript
A parsed agent transcript: the ordered messages/ entries, plus — when the latest step is in flight — the live streaming tail as a virtual trailing entry.

Enums§

Block
One content block of a model message (§4.4 canonical blocks).
EntryKind
The origin classification of a transcript entry (see the module table).

Functions§

build
Build the committed transcript for agent_id in workspace: the messages/ directory, with a marker seated in every hole compaction left in its counter ([compaction] — the directory is not append-only, and a readdir alone renders a rewritten record as if it were the whole record). The live tail is Transcript::with_live — see the module doc for why the two are not one call.

Type Aliases§

Usage
The committed usage record’s token counters, verbatim from the bytes (lernie ≥0.0.4 seals the provider’s report beside content: {"content":[…],"usage":{"input_tokens":5,…}}). Counter names are the provider’s own — no vocabulary is pinned here, so a counter brazen adds rides through with no edit. Empty is the general path: a legacy bare-array entry, or a provider that reported nothing (a 0 would be a lie).