pub struct SessionState { /* private fields */ }Implementations§
Source§impl SessionState
impl SessionState
pub fn new(requested_id: Option<SessionId>) -> Self
pub fn new_with_history( requested_id: Option<SessionId>, events: Vec<AgentEvent>, created_at: Option<u64>, updated_at: Option<u64>, ) -> Self
pub fn start(&mut self)
pub fn id(&self) -> &SessionId
pub fn title(&self) -> Option<&str>
Sourcepub fn set_title(&mut self, title: Option<String>)
pub fn set_title(&mut self, title: Option<String>)
Set an explicit session title (provisional user-derived or model-named).
pub fn events(&self) -> &[AgentEvent]
pub fn created_at(&self) -> u64
pub fn updated_at(&self) -> u64
pub fn set_updated_at(&mut self, ts: u64)
pub fn started(&self) -> bool
pub fn runtime(&self) -> Option<&SessionRuntime>
pub fn set_runtime( &mut self, runtime: SessionRuntime, event_rx: UnboundedReceiver<AgentEvent>, )
pub fn next_turn_id(&mut self) -> String
pub fn push_event(&mut self, event: AgentEvent)
Sourcepub fn replace_events(&mut self, events: Vec<AgentEvent>)
pub fn replace_events(&mut self, events: Vec<AgentEvent>)
Replace the entire event log (used after compaction so reloads stay small).
Sourcepub fn truncate_events_to_user_turns(&mut self, keep_user_turns: usize)
pub fn truncate_events_to_user_turns(&mut self, keep_user_turns: usize)
Drop events from the (keep_user_turns + 1)-th UserTaskSubmitted onward.
Used when rewinding the live session after the UI edits a past user message.
Sourcepub fn update_title_from_events(&mut self)
pub fn update_title_from_events(&mut self)
Derive a title from events only when none is set yet.
Keeps provisional / model-assigned titles stable across mid-turn updates and end-of-turn snapshots.
Sourcepub fn force_update_title_from_events(&mut self)
pub fn force_update_title_from_events(&mut self)
Force re-derive from events (e.g. after rewind).
pub fn snapshot( &self, project_dir: &Path, session_store: &SessionStore, event_bus: &EventBus, goal: Option<SessionGoal>, ) -> Result<SessionSnapshot>
pub async fn snapshot_async( &self, project_dir: &Path, session_store: &SessionStore, event_bus: &EventBus, goal: Option<SessionGoal>, ) -> Result<SessionSnapshot>
Auto Trait Implementations§
impl Freeze for SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnsafeUnpin for SessionState
impl UnwindSafe for SessionState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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