Struct SessionStore
pub struct SessionStore {
pub session_queue: Arc<SessionActorQueue>,
/* private fields */
}Fields§
§session_queue: Arc<SessionActorQueue>Implementations§
Source§impl SessionStore
impl SessionStore
pub fn new(max_sessions: usize, session_queue: Arc<SessionActorQueue>) -> Self
pub async fn insert( &self, id: String, session: RpcSession, ) -> Result<(), &'static str>
pub async fn get_agent(&self, id: &str) -> Option<Arc<Mutex<Agent>>>
pub async fn touch(&self, id: &str)
pub async fn set_overrides( &self, id: &str, patch: SessionOverrides, ) -> Option<SessionOverrides>
pub async fn preview_overrides( &self, id: &str, patch: &SessionOverrides, ) -> Option<SessionOverrides>
Sourcepub async fn apply_model_provider(
&self,
id: &str,
model_provider: Box<dyn ModelProvider>,
model_provider_name: String,
model_name: String,
tool_dispatcher: Box<dyn ToolDispatcher>,
) -> bool
pub async fn apply_model_provider( &self, id: &str, model_provider: Box<dyn ModelProvider>, model_provider_name: String, model_name: String, tool_dispatcher: Box<dyn ToolDispatcher>, ) -> bool
Swap a freshly built ModelProvider box (and its name) onto the
session’s agent. Called by the dispatcher after it constructs the
box from config, keeping model_provider-build logic out of the store.
pub async fn get_overrides(&self, id: &str) -> Option<SessionOverrides>
Sourcepub async fn get_upload(
&self,
session_id: &str,
ref_id: &str,
) -> Option<UploadEntry>
pub async fn get_upload( &self, session_id: &str, ref_id: &str, ) -> Option<UploadEntry>
Look up an existing upload by ref_id. Returns None if the session
or entry doesn’t exist.
Sourcepub async fn insert_upload(&self, session_id: &str, entry: UploadEntry)
pub async fn insert_upload(&self, session_id: &str, entry: UploadEntry)
Insert (or overwrite) an upload entry in the session’s index.
Sourcepub async fn get_workspace_dir(&self, session_id: &str) -> Option<String>
pub async fn get_workspace_dir(&self, session_id: &str) -> Option<String>
Get the workspace directory for a session.
Sourcepub async fn get_agent_alias(&self, session_id: &str) -> Option<String>
pub async fn get_agent_alias(&self, session_id: &str) -> Option<String>
Get the agent alias bound to a session, if known. Used by the dispatcher to route uploads to the agent’s own workspace dir rather than to the user’s session cwd (which is often a git repo we shouldn’t be writing into).
pub async fn seed_history(&self, id: &str, msgs: &[ChatMessage])
pub async fn seed_history_with_event( &self, id: &str, msgs: &[ChatMessage], ) -> Option<TurnEvent>
Sourcepub async fn set_plan(&self, id: &str, entries: Vec<PlanEntry>)
pub async fn set_plan(&self, id: &str, entries: Vec<PlanEntry>)
Replace the session’s execution plan wholesale (TodoWrite whole-list semantics). No-op if the session is unknown.
Sourcepub async fn get_plan(&self, id: &str) -> Option<Vec<PlanEntry>>
pub async fn get_plan(&self, id: &str) -> Option<Vec<PlanEntry>>
Current stored plan for a session. None if the session is
unknown; Some(empty) if the session exists with no/cleared plan.
pub async fn seed_conversation_history( &self, id: &str, msgs: Vec<ConversationMessage>, )
pub async fn seed_conversation_history_with_event( &self, id: &str, msgs: Vec<ConversationMessage>, ) -> Option<TurnEvent>
pub async fn chat_mode(&self, id: &str) -> Option<ChatMode>
pub async fn history_len(&self, id: &str) -> Option<usize>
pub async fn history_slice_from( &self, id: &str, from: usize, ) -> Option<Vec<ConversationMessage>>
pub async fn remove(&self, id: &str) -> bool
pub async fn evict_same_mode_sibling( &self, tui_id: &str, chat_mode: &ChatMode, except_id: &str, ) -> Vec<(String, String)>
Sourcepub async fn session_owner_tui_id(
&self,
session_id: &str,
) -> Option<Option<String>>
pub async fn session_owner_tui_id( &self, session_id: &str, ) -> Option<Option<String>>
Read the owner_tui_id stamp from a session. Returns None if the
session doesn’t exist, Some(None) if it exists but is unowned (e.g.
created by an anonymous connection), Some(Some(id)) if owned by id.
pub async fn list_ids(&self) -> Vec<String>
pub fn register_cancel_token(&self, id: &str, token: CancellationToken) -> u64
pub fn remove_cancel_token(&self, id: &str, generation: u64)
pub fn cancel_session(&self, id: &str) -> bool
Sourcepub fn has_inflight_turn(&self, id: &str) -> bool
pub fn has_inflight_turn(&self, id: &str) -> bool
Returns true if a cancel token is registered — i.e. a turn is in flight.
pub async fn kill_session(&self, id: &str) -> bool
Sourcepub fn record_cancel_cause(&self, id: &str, cause: CancelCause)
pub fn record_cancel_cause(&self, id: &str, cause: CancelCause)
Record the cause for an imminent cancel-token fire. Call immediately before firing so the verdict site can attribute the cancel.
Sourcepub fn take_cancel_cause(&self, id: &str) -> Option<CancelCause>
pub fn take_cancel_cause(&self, id: &str) -> Option<CancelCause>
Drain the recorded cancel cause for a session. Returns None only
when no cancel actually fired (clean completion); every firing path
records before token.cancel(), so Some(_) after a fired token is
the invariant the verdict audit relies on.
pub async fn count(&self) -> usize
Sourcepub async fn count_by_agent(&self) -> HashMap<String, usize>
pub async fn count_by_agent(&self) -> HashMap<String, usize>
Count active sessions grouped by agent alias.
Auto Trait Implementations§
impl !Freeze for SessionStore
impl !RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnsafeUnpin for SessionStore
impl !UnwindSafe for SessionStore
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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