Skip to main content

Module session

Module session 

Source
Expand description

Session-store abstraction for the dispatcher.

The session cohort commands (/sessions, /resume, /fork, /save) need read/write access to the on-disk session store. We reach it through a trait (rather than a hard dependency on zero-session) for the same reason dispatch reaches operator-state through crate::StateSource: keep zero-commands pluggable, testable without SQLite, and free of migrations noise.

Data crossing the trait is plain Rust — String ulids, epoch milliseconds, and the crate-local ReplayKind enum. Callers translate to / from their durable types (zero_session::EventKind, chrono::DateTime<Utc>) at the boundary.

Error policy mirrors StateSource: the trait returns Result so SQLite-backed impls can surface IO failures, but the dispatcher wraps every call in a function that downgrades the error to an [OutputLine::Alert]. A DB hiccup must never take down the TUI — the operator still needs to read the engine.

Structs§

ReplayEvent
One replayed event. at_ms is the original wall-clock timestamp, so “resuming: X prior events, most recent 14m ago” reads from a truthful clock source rather than a rendered approximation.
SessionSummary
One session row surfaced to the dispatcher. Minimal by design: everything beyond what /sessions renders is looked up on demand through SessionSource::list_events.

Enums§

ReplayKind
Categorisation of a replayed event, stripped of the concrete EventKind enum in zero-session. The dispatcher hands these to the TUI which renders them through its own [EntryKind-equivalent] palette.
SessionError
Errors a SessionSource can surface.

Traits§

SessionSource
The dispatcher’s view of the session store. Implemented by the TUI (wrapping a zero_session::Store + a label index on top of milestones) and by test scaffolding that keeps every call in-memory.