Expand description
Session glue — adapts zero_session::Store to the TUI.
The TUI does not care whether persistence is on. If the user
asked for --no-persist, or the DB failed to open, we fall
back to a no-op sink so the render path is unchanged.
This module hosts two adaptor surfaces:
SessionSink— the write side. EveryLogEntryflowing throughAppState::pushis mirrored here.SessionAdapter— the read side plus the fork/save hooks. It implementszero_commands::SessionSourceso/sessions,/resume,/fork,/saveall reach the store withoutzero-commandstaking a hard dep onzero-session.
Both share an Arc<Mutex<ActiveSession>> so a /fork command
can atomically swap the sink’s target under the dispatcher’s
feet without a round-trip through apply_dispatch — keeping
the “every persisted line lands in the current session” rule
enforceable without ceremony.
Structs§
- Session
Adapter - Read + fork/save adaptor over a
Store, implementingSessionSourceso the dispatcher can reach the on-disk history. Carries the sameArc<Mutex<ActiveSession>>asSessionSinkso/forkatomically swaps the write target. - Session
Sink - A write sink for session persistence.
Nonemeans persistence is disabled; callers treat it as an append-only log.
Functions§
- replay
- Rehydrate stored events into log entries, preserving the original timestamps so rendered “age” reads stay truthful.
- summarize
- Heuristic summary of a prior session for the resume banner.
- to_
entry_ kind - Translate the persisted kind back into a TUI entry kind. The
schema’s
mode_changerows are folded intoSystemon replay — the mode switch already happened; the row is a breadcrumb.