pub struct ChatSession { /* private fields */ }Expand description
Persistent chat session.
Storage layout (matching Python SDK, stored in ~/.skilllite/):
sessions.json — session metadata
transcripts/{key}-{date}.jsonl — append-only transcript
Implementations§
Source§impl ChatSession
impl ChatSession
Sourcepub fn new(
config: AgentConfig,
session_key: &str,
skills: Vec<LoadedSkill>,
) -> Self
pub fn new( config: AgentConfig, session_key: &str, skills: Vec<LoadedSkill>, ) -> Self
Full constructor: starts periodic evolution timer. Use for long-lived chat.
Sourcepub fn new_for_clear(
config: AgentConfig,
session_key: &str,
skills: Vec<LoadedSkill>,
) -> Self
pub fn new_for_clear( config: AgentConfig, session_key: &str, skills: Vec<LoadedSkill>, ) -> Self
For one-off clear-session: no Tokio spawn. Avoids “no reactor running” when run from sync CLI.
Sourcepub async fn run_turn(
&mut self,
user_message: &str,
event_sink: &mut dyn EventSink,
) -> Result<AgentResult>
pub async fn run_turn( &mut self, user_message: &str, event_sink: &mut dyn EventSink, ) -> Result<AgentResult>
Run one conversation turn.
Sourcepub async fn run_turn_with_history(
&mut self,
user_message: &str,
event_sink: &mut dyn EventSink,
history_override: Vec<ChatMessage>,
) -> Result<AgentResult>
pub async fn run_turn_with_history( &mut self, user_message: &str, event_sink: &mut dyn EventSink, history_override: Vec<ChatMessage>, ) -> Result<AgentResult>
A13: Run with overridden history (for –resume from checkpoint).
Sourcepub fn shutdown(&mut self)
pub fn shutdown(&mut self)
Graceful shutdown: flush evolution metrics, cancel evolution timers.
Sourcepub async fn force_compact(&mut self) -> Result<bool>
pub async fn force_compact(&mut self) -> Result<bool>
Force compaction: summarize history via LLM regardless of threshold. Returns true if compaction was performed, false if history was too short.
Sourcepub async fn clear_full(&mut self) -> Result<()>
pub async fn clear_full(&mut self) -> Result<()>
Full clear (OpenClaw-style): summarize to memory, archive transcript, reset counts.
Used by Assistant /new and skilllite clear-session.
Auto Trait Implementations§
impl Freeze for ChatSession
impl RefUnwindSafe for ChatSession
impl Send for ChatSession
impl Sync for ChatSession
impl Unpin for ChatSession
impl UnsafeUnpin for ChatSession
impl UnwindSafe for ChatSession
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
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>
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>
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