Skip to main content

SessionGraph

Struct SessionGraph 

Source
pub struct SessionGraph { /* private fields */ }

Implementations§

Source§

impl SessionGraph

Source

pub fn append_active_read_delta(&mut self, messages: &[Message])

Source

pub fn append_active_read_delta_for_agent_frame( &mut self, agent_frame_id: &str, messages: &[Message], )

Source

pub fn from_nodes( nodes: Vec<SessionNodeRecord>, leaf_node_id: Option<String>, ) -> Self

Source

pub fn append_message(&mut self, message: Message) -> String

Source

pub fn append_plugin( &mut self, plugin_type: impl Into<String>, body: Value, ) -> String

Source

pub fn active_path_nodes(&self) -> Vec<&SessionNodeRecord>

Source

pub fn append_protocol_event(&mut self, event: ProtocolEvent) -> String

Source

pub fn user_message_count(&self) -> usize

Source

pub fn first_user_message(&self) -> String

Source

pub fn branch_to(&mut self, node_id: Option<String>)

Source

pub fn set_leaf_node_id(&mut self, node_id: Option<String>)

Source

pub fn push_node_record(&mut self, node: SessionNodeRecord)

Source

pub fn extend_node_records<I>(&mut self, nodes: I)

Source

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.

Source

pub fn active_path_contains(&self, node_id: &str) -> bool

Source

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.

Source

pub fn fork_current_path(&self) -> SessionGraph

Source

pub fn find_node(&self, node_id: &str) -> Option<&SessionNodeRecord>

Source

pub fn node_index(&self, node_id: &str) -> Option<usize>

Source

pub fn replace_active_read_state(&mut self, messages: &[Message])

Source

pub fn replace_active_read_state_for_agent_frame( &mut self, agent_frame_id: &str, messages: &[Message], )

Source

pub fn from_active_read_state(messages: &[Message]) -> Self

Source

pub fn message_tree(&self) -> Vec<SessionMessageTreeNode>

Trait Implementations§

Source§

impl Clone for SessionGraph

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SessionGraph

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for SessionGraph

Source§

type Target = SessionGraphData

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for SessionGraph

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SessionGraph

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more