Skip to main content

Module human_export

Module human_export 

Source
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§

HumanExportFormat
core.session.export_format (§3.1): which rendering render_transcript produces.

Functions§

render_messages
The lower-level entry point render_transcript delegates to: render a bare messages slice (no Session wrapper required) — for a caller (e.g. the CLI’s sessions export) that already has the parsed ChatMessages and a session name/model but not a full Session (which is #[non_exhaustive] and cannot be constructed outside this crate). Same read-only/idempotent contract as render_transcript.
render_transcript
Render session’s conversation (session.messages, in order) for a human, in format. Pure/read-only: session is 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_injections blocks).