Skip to main content

Module session

Module session 

Source
Expand description

Session management and persistence.

Sessions are stored as JSONL files with a tree structure that enables branching and history navigation.

Structs§

AutosaveQueueMetrics
Snapshot of autosave queue state and lifecycle counters.
BranchInfo
Summary of branches in a session.
BranchSummaryEntry
Branch summary entry.
CompactionEntry
Compaction entry.
CustomEntry
Custom entry.
EntryBase
Base entry fields.
ExportSnapshot
Lightweight snapshot of session data for non-blocking export.
ForkPlan
Result of planning a /fork operation from a specific user message.
LabelEntry
Label entry.
MessageEntry
Message entry.
ModelChangeEntry
Model change entry.
Session
A session manages conversation state and persistence.
SessionHandle
Handle to a thread-safe shared session.
SessionHeader
Session file header.
SessionInfoEntry
Session info entry.
SessionOpenDiagnostics
Diagnostics captured while opening a session file.
SessionOpenOrphanedParentLink
SessionOpenSkippedEntry
SiblingBranch
A sibling branch at a fork point.
ThinkingLevelChangeEntry
Thinking level change entry.

Enums§

AutosaveDurabilityMode
Durability mode for write-behind autosave behavior.
AutosaveFlushTrigger
Autosave flush trigger used for observability.
MigrationState
Current migration state of a JSONL session.
SessionEntry
A session entry.
SessionMessage
Session message payload.
SessionStoreKind
Session persistence backend.
V2OpenMode
Loading strategy for reconstructing a Session from a V2 store.

Constants§

DEFAULT_SHARE_VIEWER_URL
Default base URL for the Pi session share viewer.
SESSION_VERSION
Current session file format version.

Functions§

create_v2_sidecar_from_jsonl
Create a V2 sidecar store from an existing JSONL session file.
encode_cwd
Encode a working directory path for use in session directory names.
get_share_viewer_url
Get the share viewer URL for a gist ID.
migrate_dry_run
Dry-run a JSONL → V2 migration without persisting the sidecar.
migrate_jsonl_to_v2
Migrate a JSONL session to V2 with full verification and event logging.
migration_status
Query the migration state of a JSONL session file.
recover_partial_migration
Recover from a partial or corrupted V2 migration.
rollback_v2_sidecar
Remove a V2 sidecar, reverting to JSONL-only storage.
verify_v2_against_jsonl
Verify a V2 sidecar against its source JSONL for fidelity.