Skip to main content

Module text

Module text 

Source
Expand description

A compact, one-way text projection of the canonical transcript model.

to_text is intended for LLM context, not archival or round trips. It preserves conversational content and compact tool data while discarding replay-only data: message timestamps, usage, stop reasons, reasoning signatures/encrypted payloads, and inline image bytes.

to_text_fragment renders a Span of the body in the same format, with a ── #N ── rule numbering each message by its 1-based position in the full session — the same ordinals fragment refs (<id>#5-12) use, so what a reader sees is what they can reference.

Functions§

to_text
Render a canonical transcript as compact, LLM-oriented text.
to_text_fragment
Render span of the transcript in to_text’s format, a ── #N ── rule before each message carrying its 1-based ordinal in the full body. Partial spans add fragment=/of= header fields naming the slice. None when span is out of bounds, mirroring Transcript::fragment.