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§
Sourcefn persistence(&self) -> &Arc<LockedSessionStore>
fn persistence(&self) -> &Arc<LockedSessionStore>
Per-session write-serialising persistence layer.
Sourcefn agent_runners(&self) -> &Arc<RwLock<HashMap<String, AgentRunner>>>
fn agent_runners(&self) -> &Arc<RwLock<HashMap<String, AgentRunner>>>
Active agent runners, keyed by session id.
Sourcefn account_sink(&self) -> &Arc<AccountEventSink>
fn account_sink(&self) -> &Arc<AccountEventSink>
Account-wide durable change-feed sink.
Sourcefn provider_registry(&self) -> &Arc<ProviderRegistry>
fn provider_registry(&self) -> &Arc<ProviderRegistry>
Multi-provider registry.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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<'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.
Sourcefn get_provider_for_model_ref(
&self,
target: &ProviderModelRef,
) -> Option<Arc<dyn LLMProvider>>
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).
Sourcefn 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 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).
Sourcefn title_gen_acquire(&self, session_id: &str) -> bool
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.
Sourcefn title_gen_release(&self, session_id: &str)
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".