Skip to main content

AgentSessionContext

Trait AgentSessionContext 

Source
pub trait AgentSessionContext: Send + Sync {
Show 15 methods // Required methods fn sessions(&self) -> &Arc<RwLock<HashMap<String, Session>>>; fn storage(&self) -> &Arc<dyn Storage>; fn persistence(&self) -> &Arc<LockedSessionStore>; fn agent_runners(&self) -> &Arc<RwLock<HashMap<String, AgentRunner>>>; fn account_sink(&self) -> &Arc<AccountEventSink>; fn config(&self) -> &Arc<RwLock<Config>>; fn provider_registry(&self) -> &Arc<ProviderRegistry>; fn get_session_event_sender<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Sender<AgentEvent>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_session_merged<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<Session>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn save_and_cache_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 mut Session, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_provider<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Arc<dyn LLMProvider>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_provider_for_model_ref( &self, target: &ProviderModelRef, ) -> Option<Arc<dyn LLMProvider>>; fn get_provider_for_endpoint<'life0, 'life1, 'async_trait>( &'life0 self, provider_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<Arc<dyn LLMProvider>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn title_gen_acquire(&self, session_id: &str) -> bool; fn title_gen_release(&self, session_id: &str);
}
Expand description

Shared application context the agent-session-orchestration cluster depends on, in place of the server’s concrete AppState.

Implemented by the server on AppState. Every accessor mirrors an existing AppState field or method; the trait exists solely to invert the cluster→server dependency.

Required Methods§

Source

fn sessions(&self) -> &Arc<RwLock<HashMap<String, Session>>>

In-memory session cache.

Source

fn storage(&self) -> &Arc<dyn Storage>

Persistent session storage backend.

Source

fn persistence(&self) -> &Arc<LockedSessionStore>

Per-session write-serialising persistence layer.

Source

fn agent_runners(&self) -> &Arc<RwLock<HashMap<String, AgentRunner>>>

Active agent runners, keyed by session id.

Source

fn account_sink(&self) -> &Arc<AccountEventSink>

Account-wide durable change-feed sink.

Source

fn config(&self) -> &Arc<RwLock<Config>>

Hot-reloadable application configuration.

Source

fn provider_registry(&self) -> &Arc<ProviderRegistry>

Multi-provider registry.

Source

fn get_session_event_sender<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Sender<AgentEvent>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get (or create) the long-lived broadcast sender for a session’s events.

Source

fn load_session_merged<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<Session>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load a session, merging the in-memory and on-disk copies.

Source

fn save_and_cache_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 mut Session, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist a session and refresh the in-memory cache.

Source

fn get_provider<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Arc<dyn LLMProvider>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the always-current default provider handle.

Source

fn get_provider_for_model_ref( &self, target: &ProviderModelRef, ) -> Option<Arc<dyn LLMProvider>>

Route to a provider for a specific provider/model ref.

Returns None on failure (the server’s fallible lookup discards its actix-coupled error type).

Source

fn get_provider_for_endpoint<'life0, 'life1, 'async_trait>( &'life0 self, provider_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<Arc<dyn LLMProvider>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a provider for a named provider endpoint.

Returns None on failure (see Self::get_provider_for_model_ref).

Source

fn title_gen_acquire(&self, session_id: &str) -> bool

Try to claim the title-generation slot for session_id. Returns true on success, false if generation is already in flight.

Source

fn title_gen_release(&self, session_id: &str)

Release the title-generation slot for session_id. Idempotent.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§