pub struct Session { /* private fields */ }Expand description
Immutable session state created by session_start / session_create.
Cloned (via Arc) into each module. Holds the project root and
cross-cutting concerns that every module may need.
alias and last_used_at are interior-mutable (RwLock) so the ledger
can rename or touch sessions without invalidating outstanding Arc<Session>
handles held by tool handlers.
Implementations§
Source§impl Session
impl Session
pub fn new(config: SessionConfig) -> Result<Self, CoreError>
Sourcepub fn worktrees_dir(&self) -> &Path
pub fn worktrees_dir(&self) -> &Path
Directory where this session’s git worktrees live.
Absolute path. Resolved once at Session::new from
SessionConfig::worktrees_dir → env LDS_WORKTREES_DIR →
<root>/.worktrees. See SessionConfig::worktrees_dir for the
setup expectation (gitignore requirement).
pub fn root(&self) -> &Path
pub fn id(&self) -> &str
pub fn alias(&self) -> Option<String>
pub fn created_at(&self) -> u64
pub fn last_used_at(&self) -> u64
pub fn touch(&self)
pub fn timeout(&self) -> Duration
pub fn max_output(&self) -> usize
pub fn global_recipe_dirs(&self) -> &[PathBuf]
Sourcepub fn ensure_alive(&self) -> Result<(), SessionError>
pub fn ensure_alive(&self) -> Result<(), SessionError>
Check that the session root directory still exists.
Call this at each entry point (e.g. list, run) to detect a deleted
root before attempting I/O. Returns SessionError::RootGone if the
directory no longer exists.