Skip to main content

Module transcript

Module transcript 

Source
Expand description

session.get_transcript’s response shape (#2058).

Why: SessionRegistry::set_run_outcome (#2056) already persists a finished execution’s turn-by-turn transcript, aggregate token usage, and priced cost onto the SessionEntry — this is the M1 cut-line’s “inspect transcript” verb, exposing that stored record over the wire without recomputing anything. Kept as its own small file (rather than growing registry.rs) so the wire shape has one obvious home and stays decoupled from the registry’s storage/locking internals. What: TranscriptRecord is a plain, Serialize+Deserialize DTO (#2060: the Deserialize half lets tcode’s CLI thin client — see crate::cli_client — parse session.get_transcript’s JSON-RPC result straight back into this type rather than picking fields off a raw serde_json::Value): session_id, the ordered turns (each already role/model/text/tool_calls/ usage — see crate::run_task::TurnRecord), the aggregate usage, and cost_usd exactly as stored (None either because pricing was unavailable for the run, or because no run has ever completed on this session — the two cases are indistinguishable here by design, matching RunReport::cost_usd’s existing convention). A session that has never run a task returns turns: [], usage all-zero, cost_usd: null — a valid, empty transcript, not an error. mode (#2059) is the resolved HarnessMode task.run set via SessionRegistry::set_mode — None for the same “never run” case. compaction_events (#2349, epic #2343) is the session’s pm_transcript’s cumulative count of #2308 threshold-compactor fires — 0 for a never-run session, and the field epic #2343’s success metric (“500+ turn session with compaction_events == 0”) reads. (#2350) goals is a serialisable snapshot of the session’s 5 fixed goal slots at the moment get_transcript was called, so a client round-tripping session.get_transcript sees the same goal state session.get_goals reports, with no separate call needed. Test: session::registry_tests::get_transcript_*, session::registry_tests::get_transcript_round_trips_goal_state.

Structs§

GoalSlotRecord
A serialisable snapshot of one occupied goal slot, as TranscriptRecord.goals and session.get_goals (#2350) expose it.
TranscriptRecord
The full stored run record for one session, as session.get_transcript returns it.