Skip to main content

Module session_storage

Module session_storage 

Source
Expand description

Session storage: append-only JSONL transcript persistence.

Each session is a .jsonl file with one entry per line.

When a session file exceeds MAX_SESSION_SIZE (50MB), writes automatically fork to a new part file (session_part2.jsonl, _part3.jsonl, etc.). Loading stitches all parts together transparently.

Structs§

SummaryEntry
A compaction summary entry.
TombstoneEntry
A soft-delete marker.
TranscriptMessage
A conversation message entry.

Enums§

TranscriptEntry
A single entry in the session transcript.

Functions§

all_part_paths
List all part files for a session, in order (base first, then _part2, _part3, …).
load_transcript
Load a session transcript from all part files, respecting tombstones.
messages_from_transcript
Extract API messages from transcript entries.
tombstone_entry
Write a tombstone (soft-delete) entry.
total_session_size
Total size across all session parts.
transcript_path
Compute the base transcript file path for a session.
write_assistant_entry
Write an assistant message entry.
write_transcript_entry
Append a transcript entry to the session file. Automatically forks to a new part file if the current one exceeds 50MB.
write_user_entry
Write a user message entry.