Skip to main content

Module session

Module session 

Source
Expand description

Append-only JSONL session persistence.

Records session metadata, transcript events, tool audits, and context control actions for audit and resume without storing full raw provider payloads.

Each SessionRecord is one append-only JSONL line tagged with schema_version, a monotonic seq, time, and type.

Structs§

AcpPermissionOptionRecord
A permission option recorded without protocol payloads.
AcpSessionMetadata
External-agent session identity persisted once per run.
CompactionAudit
Complete durable audit payload for one compaction.
CompactionSourceHash
Source hash associated with a compacted input item.
CompactionTokenUsage
Provider token usage for the compaction request, when reported.
ContextDiagnosticMeta
Content-free diagnostic emitted while selecting context.
ContextItemMeta
Content-free audit metadata for one context-ledger item.
ContextLedgerMeta
Content-free context ledger snapshot persisted for a prompt turn.
ContextSourceMeta
Metadata for a loaded context source, without its model-visible content.
McpToolSessionMeta
MCP-specific identity attached to an external tool call.
PromptMetadata
Metadata for a single prompt turn, suitable for append-only JSONL storage.
SessionConfigFile
A loaded config file recorded in session metadata.
SessionConfigMeta
Effective configuration provenance persisted with a session.
SessionReader
Reads a session JSONL file and reconstructs transcript entries.
SessionSummary
Compact session metadata for sidebar display.
SessionWriter
Append-only JSONL session writer.
SkillReferenceRecord
Persisted metadata for a loaded skill reference.

Enums§

CompactionReviewResult
Review state recorded for a compaction summary.
CompactionRisk
Risk classification for the compacted range.
CompactionTrigger
How compaction was initiated.
SessionLookupError
An error resolving a user-supplied local session identifier.
SessionRecord
A single line in a session JSONL file.

Constants§

MAX_LOG_OUTPUT_BYTES
Maximum amount of redacted log text returned by a reader.
SCHEMA_VERSION
Current JSONL schema version.

Functions§

generate_session_id
Generate a session id from a timestamp (format: session-YYYYMMDD-HHMMSS).
latest_session_file
Find the most recently modified session file in a directory.
list_session_files
List session files in a directory, sorted newest-first by modification time.
list_session_summaries
List session sidebar summaries, newest-first.
list_session_titles
List session titles from a directory, newest-first.
read_redacted_log_tail
Read the last max_lines of a text log, redacting values and bounding the returned payload. Missing files produce an empty result.
resolve_session_file
Resolve an exact session id or a unique id prefix.
sessions_dir
The sessions directory under a workspace root: {root}/.thndrs/sessions/.