pub struct SessionRecorder { /* private fields */ }Expand description
Records conversations to disk
Implementations§
Source§impl SessionRecorder
impl SessionRecorder
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Get the session ID
Sourcepub fn record_user_message(&mut self, content: &str)
pub fn record_user_message(&mut self, content: &str)
Record a user message
Sourcepub fn record_assistant_message(
&mut self,
content: &str,
tool_calls: Option<&[ToolCallRecord]>,
)
pub fn record_assistant_message( &mut self, content: &str, tool_calls: Option<&[ToolCallRecord]>, )
Record an assistant message with optional tool calls
Sourcepub fn save_with_history(&mut self, history: &ConversationHistory) -> Result<()>
pub fn save_with_history(&mut self, history: &ConversationHistory) -> Result<()>
Save the session with full conversation history snapshot This preserves compacted context for session resume
Sourcepub fn has_messages(&self) -> bool
pub fn has_messages(&self) -> bool
Check if the session has any messages
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the number of messages
Auto Trait Implementations§
impl Freeze for SessionRecorder
impl RefUnwindSafe for SessionRecorder
impl Send for SessionRecorder
impl Sync for SessionRecorder
impl Unpin for SessionRecorder
impl UnwindSafe for SessionRecorder
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> 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> 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 moreCreates a shared type from an unshared type.