pub struct AgentSessionRuntime { /* private fields */ }Expand description
Owns the current session. Extension command contexts reach it
through a weak link for newSession / fork / switchSession / shutdown.
Implementations§
Source§impl AgentSessionRuntime
impl AgentSessionRuntime
Sourcepub async fn create(
services: Arc<Services>,
options: SessionOptions,
) -> Result<Self, ServicesError>
pub async fn create( services: Arc<Services>, options: SessionOptions, ) -> Result<Self, ServicesError>
Creates the runtime and its first session; emits session_start{reason:"startup"},
resources_discover and the model restore.
§Errors
Session file failures.
Sourcepub async fn create_for_hub(
services: Arc<Services>,
options: SessionOptions,
) -> Result<Self, SessionOpError>
pub async fn create_for_hub( services: Arc<Services>, options: SessionOptions, ) -> Result<Self, SessionOpError>
Creates the runtime and its first session keeping SessionOpError variants
intact (E-LAZY, core spec §2.2): the hub maps SessionLocked (D-TAKEOVER deadline)
to its locked state instead of a generic failure text.
§Errors
Session file and lease failures, with variants preserved.
Sourcepub fn model_fallback_message(&self) -> Option<&str>
pub fn model_fallback_message(&self) -> Option<&str>
Message shown when the model falls back.
Sourcepub fn extension_settings(&self) -> &Arc<ExtensionSettings> ⓘ
pub fn extension_settings(&self) -> &Arc<ExtensionSettings> ⓘ
Extension settings for frontends (settings hub, modes §4 _oino/get_settings_schema,
get_extension_settings, set_extension_setting): schema, layered values with masked
secrets, scoped writes and change notifications.
Sourcepub fn session(&self) -> AgentSession
pub fn session(&self) -> AgentSession
The current session.
Sourcepub fn subscribe(&self) -> EventStream
pub fn subscribe(&self) -> EventStream
Client events across session replacements.
Sourcepub fn shutdown_requested(&self) -> Receiver<bool>
pub fn shutdown_requested(&self) -> Receiver<bool>
Becomes true when an extension called ctx.shutdown();
frontends exit once the session is idle.
Sourcepub async fn new_session(
&self,
parent: Option<PathBuf>,
) -> Result<Replaced, SessionOpError>
pub async fn new_session( &self, parent: Option<PathBuf>, ) -> Result<Replaced, SessionOpError>
Sourcepub async fn switch_session(
&self,
path: PathBuf,
cwd_override: Option<PathBuf>,
) -> Result<Replaced, SessionOpError>
pub async fn switch_session( &self, path: PathBuf, cwd_override: Option<PathBuf>, ) -> Result<Replaced, SessionOpError>
Sourcepub async fn fork(
&self,
entry: &EntryId,
position: ForkPosition,
) -> Result<Replaced, SessionOpError>
pub async fn fork( &self, entry: &EntryId, position: ForkPosition, ) -> Result<Replaced, SessionOpError>
Sourcepub async fn clone_session(&self) -> Result<Replaced, SessionOpError>
pub async fn clone_session(&self) -> Result<Replaced, SessionOpError>
Clones the session at its leaf (fork At the leaf).
§Errors
As AgentSessionRuntime::fork; Nothing to clone for an empty session.
Sourcepub async fn import_jsonl(
&self,
path: PathBuf,
cwd_override: Option<PathBuf>,
) -> Result<Replaced, SessionOpError>
pub async fn import_jsonl( &self, path: PathBuf, cwd_override: Option<PathBuf>, ) -> Result<Replaced, SessionOpError>
Sourcepub fn set_takeover_handler(&self, handler: Option<TakeoverHandler>)
pub fn set_takeover_handler(&self, handler: Option<TakeoverHandler>)
Installs the embedding’s takeover behaviour override (D-TAKEOVER on_takeover);
None restores the default (dispose the session, keep the runtime usable with a
fresh one, publish OinoEvent::SessionTakenOver, ask frontends to exit).
Sourcepub async fn evict(&self)
pub async fn evict(&self)
Idle eviction (E-LAZY, core spec §2.2): disposes the session so it returns to a
record — session_shutdown{reason:"idle"} reaches the extensions (guests drop
their SessionMap entry), the lease is released, and
OinoEvent::SessionEvicted is published before the client streams end. Unlike
AgentSessionRuntime::dispose, no fresh session replaces the current one: the
hub re-opens the file on demand.
Sourcepub async fn evict_taken_over(&self, by: LeaseInfo)
pub async fn evict_taken_over(&self, by: LeaseInfo)
Hub variant of the D-TAKEOVER holder behaviour: another runner asked this process
to give the session up. Disposes the session (releasing the lease) without the
default handler’s fresh replacement session, publishes
OinoEvent::SessionTakenOver on the session stream and asks frontends to return
to their session list (shutdown watch).