pub struct SessionTree { /* private fields */ }Expand description
A reconstructed session tree with branch metadata.
Built from session entries via SessionTree::from_entries. The tree
identifies distinct branches in the conversation by detecting nodes with
multiple children in the parent_id graph. The “trunk” is the first
branch (root to the first fork point or to the tip if no fork exists).
Each child branch starts from a fork point and extends to its own tip.
The active branch is determined by the last Leaf entry’s
entry_id. Without leaves, the active branch is the trunk.
Implementations§
Source§impl SessionTree
impl SessionTree
Sourcepub fn from_entries(entries: &[SessionEntry]) -> Self
pub fn from_entries(entries: &[SessionEntry]) -> Self
Reconstruct the session tree from a slice of session entries.
This is a read-only operation; it does not modify session storage.
Sourcepub fn branches(&self) -> &[BranchInfo]
pub fn branches(&self) -> &[BranchInfo]
Return the list of discovered branches.
Sourcepub fn active_tip(&self) -> Option<&str>
pub fn active_tip(&self) -> Option<&str>
Return the entry ID at the tip of the active branch.
Determined by the last Leaf entry’s entry_id. If no leaf entries
exist (legacy linear sessions), falls back to the trunk branch tip.
Returns None only when the session has no content entries.
Sourcepub fn active_branch_index(&self) -> Option<usize>
pub fn active_branch_index(&self) -> Option<usize>
Return the index of the active branch in the branches list.
If no leaf entries exist, returns index 0 (trunk).
Sourcepub fn branch_at(&self, index: usize) -> Option<&BranchInfo>
pub fn branch_at(&self, index: usize) -> Option<&BranchInfo>
Return the branch at the given index, or None if out of bounds.
Trait Implementations§
Source§impl Clone for SessionTree
impl Clone for SessionTree
Source§fn clone(&self) -> SessionTree
fn clone(&self) -> SessionTree
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more