Skip to main content

AgentSessionRuntime

Struct AgentSessionRuntime 

Source
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

Source

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.

Source

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.

Source

pub fn model_fallback_message(&self) -> Option<&str>

Message shown when the model falls back.

Source

pub fn services(&self) -> &Arc<Services> ⓘ

The services.

Source

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.

Source

pub fn session(&self) -> AgentSession

The current session.

Source

pub fn subscribe(&self) -> EventStream

Client events across session replacements.

Source

pub fn shutdown_requested(&self) -> Receiver<bool>

Becomes true when an extension called ctx.shutdown(); frontends exit once the session is idle.

Source

pub async fn new_session( &self, parent: Option<PathBuf>, ) -> Result<Replaced, SessionOpError>

Starts a new session.

§Errors

Session file failures.

Source

pub async fn switch_session( &self, path: PathBuf, cwd_override: Option<PathBuf>, ) -> Result<Replaced, SessionOpError>

Switches to another session.

§Errors

The file cannot be opened.

Source

pub async fn fork( &self, entry: &EntryId, position: ForkPosition, ) -> Result<Replaced, SessionOpError>

Forks the session.

§Errors

Invalid entry ID for forking and session file failures.

Source

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.

Source

pub async fn import_jsonl( &self, path: PathBuf, cwd_override: Option<PathBuf>, ) -> Result<Replaced, SessionOpError>

Copies the file into the sessions dir and switches to it.

§Errors

Missing file or copy failure.

Source

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

Source

pub async fn dispose(&self)

Shuts the current session down (session_shutdown{reason:"quit"}).

Source

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.

Source

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

Trait Implementations§

Source§

impl Debug for AgentSessionRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.

Source§

impl<T> Instrument for T

Source§

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

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

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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