Skip to main content

SessionStore

Struct SessionStore 

pub struct SessionStore {
    pub session_queue: Arc<SessionActorQueue>,
    /* private fields */
}

Fields§

§session_queue: Arc<SessionActorQueue>

Implementations§

Source§

impl SessionStore

Source

pub fn new(max_sessions: usize, session_queue: Arc<SessionActorQueue>) -> Self

Source

pub async fn insert( &self, id: String, session: RpcSession, ) -> Result<(), &'static str>

Source

pub async fn get_agent(&self, id: &str) -> Option<Arc<Mutex<Agent>>>

Source

pub async fn touch(&self, id: &str)

Source

pub async fn set_overrides( &self, id: &str, patch: SessionOverrides, ) -> Option<SessionOverrides>

Source

pub async fn preview_overrides( &self, id: &str, patch: &SessionOverrides, ) -> Option<SessionOverrides>

Source

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.

Source

pub async fn get_overrides(&self, id: &str) -> Option<SessionOverrides>

Source

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.

Source

pub async fn insert_upload(&self, session_id: &str, entry: UploadEntry)

Insert (or overwrite) an upload entry in the session’s index.

Source

pub async fn get_workspace_dir(&self, session_id: &str) -> Option<String>

Get the workspace directory for a session.

Source

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).

Source

pub async fn seed_history(&self, id: &str, msgs: &[ChatMessage])

Source

pub async fn seed_history_with_event( &self, id: &str, msgs: &[ChatMessage], ) -> Option<TurnEvent>

Source

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.

Source

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.

Source

pub async fn seed_conversation_history( &self, id: &str, msgs: Vec<ConversationMessage>, )

Source

pub async fn seed_conversation_history_with_event( &self, id: &str, msgs: Vec<ConversationMessage>, ) -> Option<TurnEvent>

Source

pub async fn chat_mode(&self, id: &str) -> Option<ChatMode>

Source

pub async fn history_len(&self, id: &str) -> Option<usize>

Source

pub async fn history_slice_from( &self, id: &str, from: usize, ) -> Option<Vec<ConversationMessage>>

Source

pub async fn remove(&self, id: &str) -> bool

Source

pub async fn evict_same_mode_sibling( &self, tui_id: &str, chat_mode: &ChatMode, except_id: &str, ) -> Vec<(String, String)>

Source

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.

Source

pub async fn list_ids(&self) -> Vec<String>

Source

pub fn register_cancel_token(&self, id: &str, token: CancellationToken) -> u64

Source

pub fn remove_cancel_token(&self, id: &str, generation: u64)

Source

pub fn cancel_session(&self, id: &str) -> bool

Source

pub fn has_inflight_turn(&self, id: &str) -> bool

Returns true if a cancel token is registered — i.e. a turn is in flight.

Source

pub async fn kill_session(&self, id: &str) -> bool

Source

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.

Source

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.

Source

pub async fn count(&self) -> usize

Source

pub async fn count_by_agent(&self) -> HashMap<String, usize>

Count active sessions grouped by agent alias.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,