Skip to main content

export_session

Function export_session 

Source
pub fn export_session(sidecar: &str, format: SessionFormat) -> Result<String>
Expand description

Export a (possibly reduced) live session in format.

A11 (SPEC.md §6): export always reconstructs from sidecar — the full-fidelity append-only log (Session::from_sidecar_str) — never from a projected/reduced view or a ReductionLog. Those are not inputs to this function at all, so a reduced view can only ever reach an exporter through a bug in the caller, not through this code path.

Leak guard (fail-closed): canonical message fields are checked for grammar-valid reduction placeholders before serialization. A mere mention of REDUCTION_SENTINEL inside ordinary historical text is not a stub and must remain exportable; exact placeholders (including ones nested in tool arguments/content parts) still fail closed. Some reductions retain a visible prefix or diff around the placeholder, so every standalone line is checked rather than only parsing the complete field.