Skip to main content

Module session

Module session 

Source

Structs§

BranchSummaryEntry
CompactionEntry
CustomEntry
CustomMessageEntry
LabelEntry
MessageEntry
Base fields shared by all entries.
ModelChangeEntry
SessionContext
Resolved conversation context sent to the LLM.
SessionHeader
The first entry in every session file.
SessionInfo
Lightweight metadata about a session, used for listing and selection.
SessionInfoEntry
SessionManager
Manages conversation sessions as append-only trees in JSONL files.
ThinkingLevelChangeEntry

Enums§

SessionEntry
A session entry — one JSON line in the session file.

Constants§

CURRENT_SESSION_VERSION

Functions§

append_entry_to_file
Append a single entry to the session file (one JSON line).
encode_cwd_for_dir
Encode a working directory path into a safe directory name. Mirrors pi’s encoding: strip leading /, replace / \ : with -, wrap in –…–
find_most_recent_session
Find the most recent session file by mtime.
generate_entry_id
Generate a unique ID for session entries (8 hex chars, collision-checked).
get_default_session_dir
Get the default session directory for a cwd.
load_entries_from_file
Load all entries from a session JSONL file. Returns (header, entries) or empty vec if the file is missing or corrupted.
parse_session_entry_line
Parse a single line as a SessionEntry. Returns None for empty/malformed lines.
parse_session_header_line
Parse a single line as a SessionHeader.
read_session_header
Read the session header from a JSONL file (first line only).
write_entries_to_file
Write entries to a session file (used for initial write / rewrite). Does NOT write the session header — caller must include it.