pub struct SessionContext {Show 16 fields
pub agent_type: String,
pub extraction_started: DateTime<Utc>,
pub extraction_completed: Option<DateTime<Utc>>,
pub session_id: Option<String>,
pub conversation: Vec<ConversationMessage>,
pub decisions: Vec<Decision>,
pub files: Vec<FileInfo>,
pub tasks: Vec<TaskInfo>,
pub insights: Vec<String>,
pub errors: Vec<ErrorInfo>,
pub subagent_executions: Vec<SubagentExecution>,
pub commands_run: Vec<String>,
pub custom: HashMap<String, Value>,
pub extraction_source: String,
pub reliability_score: f32,
pub rescorer: Option<Arc<SessionRescorer>>,
}Expand description
Extracted session context from an agent
Fields§
§agent_type: StringAgent type that created this context
extraction_started: DateTime<Utc>When extraction started
extraction_completed: Option<DateTime<Utc>>When extraction completed
session_id: Option<String>Session ID (if available)
conversation: Vec<ConversationMessage>Conversation messages
decisions: Vec<Decision>Decisions made during session
files: Vec<FileInfo>Files worked on
tasks: Vec<TaskInfo>Tasks completed
insights: Vec<String>Key insights/learnings
errors: Vec<ErrorInfo>Errors encountered
subagent_executions: Vec<SubagentExecution>Subagent executions (for pi-mono, oh-my-pi)
commands_run: Vec<String>Commands run
custom: HashMap<String, Value>Custom context data
extraction_source: StringSource of extraction
reliability_score: f32Reliability score (0.0-1.0)
rescorer: Option<Arc<SessionRescorer>>Optional re-scorer for active sessions
Implementations§
Source§impl SessionContext
impl SessionContext
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Create with extraction source
Sourcepub fn with_reliability(self, score: f32) -> Self
pub fn with_reliability(self, score: f32) -> Self
Create with reliability score
Sourcepub fn add_message(
&mut self,
role: impl Into<String>,
content: impl Into<String>,
)
pub fn add_message( &mut self, role: impl Into<String>, content: impl Into<String>, )
Add a conversation message
Sourcepub fn add_decision(&mut self, decision: Decision)
pub fn add_decision(&mut self, decision: Decision)
Add a decision
Sourcepub fn add_insight(&mut self, insight: impl Into<String>)
pub fn add_insight(&mut self, insight: impl Into<String>)
Add an insight
Sourcepub fn add_command(&mut self, command: impl Into<String>)
pub fn add_command(&mut self, command: impl Into<String>)
Add a command
Sourcepub fn add_custom(&mut self, key: impl Into<String>, value: Value)
pub fn add_custom(&mut self, key: impl Into<String>, value: Value)
Add custom data
Sourcepub fn stats(&self) -> SessionStats
pub fn stats(&self) -> SessionStats
Get summary statistics
Sourcepub fn to_memory_content(&self) -> String
pub fn to_memory_content(&self) -> String
Convert to memory content string
Trait Implementations§
Source§impl Clone for SessionContext
impl Clone for SessionContext
Source§fn clone(&self) -> SessionContext
fn clone(&self) -> SessionContext
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 SessionContext
impl Debug for SessionContext
Source§impl Default for SessionContext
impl Default for SessionContext
Source§impl<'de> Deserialize<'de> for SessionContext
impl<'de> Deserialize<'de> for SessionContext
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 SessionContext
impl !RefUnwindSafe for SessionContext
impl Send for SessionContext
impl Sync for SessionContext
impl Unpin for SessionContext
impl UnsafeUnpin for SessionContext
impl !UnwindSafe for SessionContext
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> 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