pub trait CommandSessionLifecycleContext {
Show 13 methods
// Required methods
fn transition_blocked(&self) -> bool;
fn transition_blockers(&self) -> Vec<String>;
fn branch_current_leaf_hint(&self) -> Option<String>;
fn branch_to(
&mut self,
entry_id: &str,
) -> Result<SessionBranchOutcome, String>;
fn tree_body(&self) -> Result<TreeBodyProjection, String>;
fn save_session(
&mut self,
explicit_path: Option<String>,
) -> Result<SessionSaveReceipt, String>;
fn fork_active(&mut self) -> Result<SessionForkReceipt, String>;
fn fork_from(
&mut self,
session_id_or_prefix: &str,
) -> Result<SessionForkFromReceipt, String>;
fn fresh_session(
&mut self,
force: bool,
) -> Result<SessionNewReceipt, String>;
fn load_session(&mut self, path: &str) -> Result<PathBuf, String>;
fn open_picker(&mut self, preselected: Option<String>);
fn set_archived(
&mut self,
session_id: &str,
archived: bool,
) -> Result<SessionArchiveReceipt, String>;
fn prune_sessions(&mut self, days: u64) -> Result<usize, String>;
}Expand description
Lifecycle authority for the session command slice (FEAT-023 D2).
Operation-granular synchronous delegates over the exact minimum host work the nine commands consume. Delegates may return the explicit host-error text the baseline surfaces for a failing stage; successful results are structured portable fields so handlers retain byte-identical composition.
Required Methods§
Sourcefn transition_blocked(&self) -> bool
fn transition_blocked(&self) -> bool
Live transition gate. Handlers return their own blocked-error text
before invoking any mutating delegate, matching the baseline ordering
(/branch, /fork, /load, /new). /fork picker and /tree
never consult it in the baseline, so their paths must not either.
Sourcefn transition_blockers(&self) -> Vec<String>
fn transition_blockers(&self) -> Vec<String>
Why the transition gate is closed, in operator terms; empty means the
transition is allowed. Consulted only after Self::transition_blocked
reports a block, so the refusal can name the work that holds the
session instead of restating that it is held.
Display projection, not a data source: the strings are pre-rendered for a refusal message and carry no stable shape. A caller that needs ids, durations, or owners should add a structured method instead of parsing these back out.
Sourcefn branch_current_leaf_hint(&self) -> Option<String>
fn branch_current_leaf_hint(&self) -> Option<String>
/branch with no argument: the current leaf when an active journaled
session resolves, otherwise None (the baseline silently falls back
to the usage message on this path).
Sourcefn branch_to(&mut self, entry_id: &str) -> Result<SessionBranchOutcome, String>
fn branch_to(&mut self, entry_id: &str) -> Result<SessionBranchOutcome, String>
/branch <entry_id>: persist the leaf move and apply the branched
transcript. Errors are the exact baseline message for the failing
stage (no active session, directory open, load, persist, or branch
failure).
Sourcefn tree_body(&self) -> Result<TreeBodyProjection, String>
fn tree_body(&self) -> Result<TreeBodyProjection, String>
/tree: produce the journal/linear/empty/no-session projection.
Errors are the exact baseline directory-open message.
Sourcefn save_session(
&mut self,
explicit_path: Option<String>,
) -> Result<SessionSaveReceipt, String>
fn save_session( &mut self, explicit_path: Option<String>, ) -> Result<SessionSaveReceipt, String>
/save [path]: the full baseline persistence sequence.
Sourcefn fork_active(&mut self) -> Result<SessionForkReceipt, String>
fn fork_active(&mut self) -> Result<SessionForkReceipt, String>
/fork (active conversation): the full baseline parent/child save and
switch sequence.
Sourcefn fork_from(
&mut self,
session_id_or_prefix: &str,
) -> Result<SessionForkFromReceipt, String>
fn fork_from( &mut self, session_id_or_prefix: &str, ) -> Result<SessionForkFromReceipt, String>
/fork <session_id|prefix>: explicit-source fork.
Sourcefn fresh_session(&mut self, force: bool) -> Result<SessionNewReceipt, String>
fn fresh_session(&mut self, force: bool) -> Result<SessionNewReceipt, String>
/new [--force]: fresh-session transition. The caller has already
parsed the argument and applied the transition-blocked gate; blocker,
busy-work-state, and success handling match the baseline.
Sourcefn load_session(&mut self, path: &str) -> Result<PathBuf, String>
fn load_session(&mut self, path: &str) -> Result<PathBuf, String>
/load <path>: resolve the path (separator-bearing direct vs
workspace-relative) and validate the saved-session shape without
applying state or emitting a premature success receipt.
Sourcefn open_picker(&mut self, preselected: Option<String>)
fn open_picker(&mut self, preselected: Option<String>)
/sessions picker open with optional preselection (bare, show,
list, picker, and open <id> forms). Picker construction and
locale selection stay host-side.
Sourcefn set_archived(
&mut self,
session_id: &str,
archived: bool,
) -> Result<SessionArchiveReceipt, String>
fn set_archived( &mut self, session_id: &str, archived: bool, ) -> Result<SessionArchiveReceipt, String>
/sessions archive|unarchive|restore <id>: durable lifecycle state
update that also syncs the live cached metadata atomically.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".