Skip to main content

Module session

Module session 

Source

Modules§

scratchpad
Per-session scratch directories.

Structs§

ConversationManager
Manages conversation persistence for a project
ConversationMeta
Lightweight session metadata, persisted as an <id>.meta sidecar so listing sessions doesn’t have to read a transcript at all.
SessionEntry
One row in the picker: a conversation plus its on-disk size (shown in the meta line; not stored on the history itself).
SessionIndexReport
What a rebuild changed.

Functions§

detect_git_branch
Best-effort current git branch of dir, for labelling --resume rows. None when dir isn’t a git work tree, git is absent, or HEAD is detached. Kept out of the pure reducer — callers invoke it in the impure startup path and stamp the result onto the conversation.
detect_git_sha
Best-effort short git SHA of dir’s HEAD, for session provenance. None outside a git work tree or when git is absent. Impure — stamped at startup alongside detect_git_branch, never in the reducer.
probe_session_provenance
Probe the session’s provenance. Impure — spawns git twice — so it is a value the shell resolves once at startup and delivers as Msg::SessionProvenanceResolved.
rebuild_session_index
Rebuild the index from disk for every project the store knows: backfill a row for each session that has files but no row, and drop rows whose files are gone. A project directory that does not exist is left alone – an unmounted drive is indistinguishable from a deleted checkout, and a stale row for an unreachable project costs nothing. Per-project I/O errors are logged and skipped; they never fail the rebuild.
select_conversation
Show the searchable resume picker and return the chosen conversation, or None if the user cancelled. now is injected so the relative-time labels are testable and match the caller’s clock.
session_row
The index row for a session snapshot. The single mapping from the file’s contents to the table’s columns.