pub struct SessionGraph { /* private fields */ }Implementations§
Source§impl SessionGraph
impl SessionGraph
pub fn append_active_read_delta(&mut self, messages: &[Message])
pub fn append_active_read_delta_for_agent_frame( &mut self, agent_frame_id: &str, messages: &[Message], )
pub fn from_nodes( nodes: Vec<SessionNodeRecord>, leaf_node_id: Option<String>, ) -> Self
pub fn append_message(&mut self, message: Message) -> String
pub fn append_plugin( &mut self, plugin_type: impl Into<String>, body: Value, ) -> String
pub fn active_path_nodes(&self) -> Vec<&SessionNodeRecord>
pub fn append_protocol_event(&mut self, event: ProtocolEvent) -> String
pub fn user_message_count(&self) -> usize
pub fn first_user_message(&self) -> String
pub fn branch_to(&mut self, node_id: Option<String>)
pub fn set_leaf_node_id(&mut self, node_id: Option<String>)
pub fn push_node_record(&mut self, node: SessionNodeRecord)
pub fn extend_node_records<I>(&mut self, nodes: I)where
I: IntoIterator<Item = SessionNodeRecord>,
Sourcepub fn extend_active_path(&mut self, nodes: Vec<SessionNodeRecord>)
pub fn extend_active_path(&mut self, nodes: Vec<SessionNodeRecord>)
Append nodes that extend the current active path, advancing the
leaf to the last node and updating the cache incrementally
instead of invalidating it. Use this when the appended nodes are
genuinely new descendants of the current leaf — e.g. the
turn-driver merging turn-local graph editor deltas into the base graph.
Use extend_node_records + set_leaf_node_id for store-side
replay paths that don’t follow the active-path append shape.
pub fn active_path_contains(&self, node_id: &str) -> bool
Sourcepub fn heal_orphaned_leaf(&mut self) -> bool
pub fn heal_orphaned_leaf(&mut self) -> bool
If leaf_node_id points to a node that no longer exists in
self.nodes (e.g. after compaction rewrote the graph, or a
stored session referenced a node that was later purged), fall
back to the most recent message node. Returns true if the
leaf was repaired. Call this on load paths where an orphan
leaf would project to an empty transcript and silently drop
the user’s history.