pub struct ThinkSession {
pub thought_history: Vec<ThoughtData>,
pub branches: HashMap<String, Vec<ThoughtData>>,
pub max_history_size: usize,
pub session_id: String,
pub active_branch: Option<String>,
pub total_thought_count: usize,
pub created_at: u64,
pub last_activity: u64,
}Expand description
Session manager for tracking thought history and branches
Fields§
§thought_history: Vec<ThoughtData>Main thought history
branches: HashMap<String, Vec<ThoughtData>>Branches of thought (key is branch_id)
max_history_size: usizeMaximum number of thoughts to keep in history
session_id: StringSession identifier
active_branch: Option<String>Current active branch (if any)
total_thought_count: usizeTotal thoughts across all branches
created_at: u64Session creation timestamp
last_activity: u64Last activity timestamp
Implementations§
Source§impl ThinkSession
impl ThinkSession
Sourcepub fn add_thought(&mut self, thought: ThoughtData)
pub fn add_thought(&mut self, thought: ThoughtData)
Add a thought to the current history (main or branch)
Sourcepub fn create_branch(&mut self, from_thought: usize, branch_id: String)
pub fn create_branch(&mut self, from_thought: usize, branch_id: String)
Create a new branch from a specific thought
Sourcepub fn switch_branch(&mut self, branch_id: Option<String>)
pub fn switch_branch(&mut self, branch_id: Option<String>)
Switch to a different branch or back to main
Sourcepub fn current_history(&self) -> &[ThoughtData]
pub fn current_history(&self) -> &[ThoughtData]
Get the current thought history (main or branch)
Sourcepub fn find_thought_to_revise(
&self,
thought_number: usize,
) -> Option<&ThoughtData>
pub fn find_thought_to_revise( &self, thought_number: usize, ) -> Option<&ThoughtData>
Find a thought that can be revised
Sourcepub fn get_revisions(&self) -> Vec<&ThoughtData>
pub fn get_revisions(&self) -> Vec<&ThoughtData>
Get all thoughts that revised other thoughts
Sourcepub fn get_high_confidence_thoughts(&self, threshold: f32) -> Vec<&ThoughtData>
pub fn get_high_confidence_thoughts(&self, threshold: f32) -> Vec<&ThoughtData>
Get thoughts with high confidence
Sourcepub fn get_all_recommended_tools(&self) -> Vec<&ToolRecommendation>
pub fn get_all_recommended_tools(&self) -> Vec<&ToolRecommendation>
Get recommended tools from all thoughts
Sourcepub fn needs_more_thoughts(&self) -> bool
pub fn needs_more_thoughts(&self) -> bool
Check if more thoughts are needed
Trait Implementations§
Source§impl Clone for ThinkSession
impl Clone for ThinkSession
Source§fn clone(&self) -> ThinkSession
fn clone(&self) -> ThinkSession
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThinkSession
impl Debug for ThinkSession
Source§impl Default for ThinkSession
impl Default for ThinkSession
Source§impl<'de> Deserialize<'de> for ThinkSession
impl<'de> Deserialize<'de> for ThinkSession
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ThinkSession
impl RefUnwindSafe for ThinkSession
impl Send for ThinkSession
impl Sync for ThinkSession
impl Unpin for ThinkSession
impl UnwindSafe for ThinkSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more