Expand description
P4e (COMPOSABLE-HARNESS-DESIGN.md §1.6/§3.1 core.session.export_format,
catalog:283 “transcript export for humans”): a READ-ONLY rendering of a
crate::Session’s conversation into text a human reads directly
(terminal/file/clipboard) or opens in a browser — CC’s /export+/copy,
CX’s Ctrl+O copy-last. This is core, not gated by the session.share
module (§1.6: “export-to-human is universal while share links … are
the OC+PI-only part session.share actually narrows to”).
Deliberately distinct from crate::reduce::export_session, which
translates a session losslessly BETWEEN harness wire formats (priority-1
“translate” — machine-to-machine, round-trippable, JSONL). This module
goes the other direction: session (any harness, already loaded) to a
human-readable rendering (JSONL in, prose/markup out — deliberately NOT
round-trippable, and never claims to be). Per §1.13, the session DATA
itself stays typed/lossless in the sidecar; a render is a projection a
human reads, never a channel anything is reconstructed from — so
render_transcript takes &Session (never mutates it) and returns an
owned String.
Enums§
- Human
Export Format core.session.export_format(§3.1): which renderingrender_transcriptproduces.
Functions§
- render_
messages - The lower-level entry point
render_transcriptdelegates to: render a baremessagesslice (noSessionwrapper required) — for a caller (e.g. the CLI’ssessions export) that already has the parsedChatMessages and a session name/model but not a fullSession(which is#[non_exhaustive]and cannot be constructed outside this crate). Same read-only/idempotent contract asrender_transcript. - render_
transcript - Render
session’s conversation (session.messages, in order) for a human, informat. Pure/read-only:sessionis untouched, and calling this twice on the same session is idempotent (same output both times). System messages are included — they’re part of the honest record of what happened (e.g. compaction markers,context_injectionsblocks).