Skip to main content

AgentSessionHost

Struct AgentSessionHost 

Source
pub struct AgentSessionHost { /* private fields */ }
Expand description

Production SessionHost over a live Arc<AgentSession> and the owning Arc<AgentSessionRuntime>.

All async session methods route to the real AgentSession. New / fork / switch / clone go through AgentSessionRuntime so the replacement pipeline runs (teardown → apply → rebind). The host clones the Arcs so it is 'static and cheap to share with the runtime.

Implementations§

Source§

impl AgentSessionHost

Source

pub fn new(runtime: Arc<AgentSessionRuntime>) -> Self

Construct a new host around the live runtime + its current session.

Source

pub fn session(&self) -> Arc<AgentSession>

Snapshot the underlying session Arc (for rebind wiring).

Source

pub fn refresh(&self)

Refresh the cached session Arc from the runtime (after a replacement).

Trait Implementations§

Source§

impl Clone for AgentSessionHost

Source§

fn clone(&self) -> AgentSessionHost

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl SessionHost for AgentSessionHost

Source§

fn snapshot(&self) -> SessionSnapshot

Snapshot of synchronous state for view projection.
Source§

fn footer_snapshot(&self) -> BoxFuture<'_, SessionFooterSnapshot>

Snapshot persisted token/cost/context state for the footer.
Source§

fn subscribe(&self) -> EventSubscription

Subscribe to public session events. The returned EventSubscription owns an mpsc receiver plus the unsubscribe token.
Source§

fn partial_rx(&self) -> Receiver<Option<Arc<AssistantMessage>>>

Receiver for the latest partial assistant message (None when idle).
Source§

fn prompt( &self, text: &str, opts: PromptOptions, ) -> BoxFuture<'_, Result<(), String>>

Submit a prompt.
Source§

fn steer(&self, text: &str) -> BoxFuture<'_, Result<(), String>>

Steer the in-flight stream (mid-turn injection).
Source§

fn follow_up(&self, text: &str) -> BoxFuture<'_, Result<(), String>>

Queue a follow-up message for the next turn.
Source§

fn abort(&self) -> BoxFuture<'static, Result<(), String>>

Abort the active run, retry, compaction, bash, or branch summary. Read more
Source§

fn compact( &self, instructions: Option<&str>, ) -> BoxFuture<'_, Result<(), String>>

Manually compact the context with optional custom instructions.
Source§

fn cycle_thinking_level(&self) -> BoxFuture<'_, Result<(), String>>

Cycle the thinking level forward.
Source§

fn cycle_model(&self, forward: bool) -> BoxFuture<'_, Result<(), String>>

Cycle the active model in the given direction.
Source§

fn reload(&self) -> BoxFuture<'_, Result<(), String>>

Reload extensions / resources / keybindings.
Source§

fn messages(&self) -> Vec<AgentMessage>

Returns the full transcript for the current session (used on rebind).
Source§

fn host_extension_runner(&self) -> Option<Arc<HostExtensionRunner>>

Concrete extension host for interactive UI bridging, when enabled.
Source§

fn hide_thinking_block(&self) -> bool

Initial persisted thinking-block visibility.
Source§

fn set_hide_thinking_block(&self, hide: bool) -> Result<(), String>

Persist thinking-block visibility. Read more
Source§

fn external_editor_command(&self) -> String

Configured external editor command.
Source§

fn get_model_entries( &self, ) -> BoxFuture<'_, Result<Vec<ModelSelectorEntry>, String>>

Fetch the model list for the model selector.
Source§

fn get_session_entries( &self, ) -> BoxFuture<'_, Result<Vec<SessionPickerEntry>, String>>

Fetch the recent sessions for the session picker.
Source§

fn get_tree_entries(&self) -> BoxFuture<'_, Result<Vec<TreeEntry>, String>>

Fetch the session tree (entries with depth) for the tree selector.
Source§

fn get_fork_entries(&self) -> BoxFuture<'_, Result<Vec<TreeEntry>, String>>

Fetch the user-message fork list (tree entries, only user messages).
Source§

fn get_trust_entries(&self) -> BoxFuture<'_, Result<Vec<SettingsRow>, String>>

Fetch the trust-state settings rows.
Source§

fn get_auth_entries( &self, ) -> BoxFuture<'_, Result<Vec<AuthSelectorEntry>, String>>

Fetch the auth selector entries (provider list).
Source§

fn get_scoped_models_entries( &self, ) -> BoxFuture<'_, Result<ScopedModelEntries, String>>

Fetch the scoped-models selector entries with current enabled map.
Source§

fn get_settings_entries( &self, ) -> BoxFuture<'_, Result<Vec<SettingsRow>, String>>

Fetch the settings selector rows.
Source§

fn get_config_entries(&self) -> BoxFuture<'_, Result<Vec<SettingsRow>, String>>

Fetch the config selector rows.
Source§

fn execute_bash( &self, command: &str, exclude_from_context: bool, ) -> BoxFuture<'_, Result<(), String>>

Execute a bash command (the runtime passes the typed command minus the ! / !! prefix).
Source§

fn new_session(&self) -> BoxFuture<'_, Result<(), String>>

Start a new session (replacement pipeline).
Source§

fn fork(&self, entry_id: &str) -> BoxFuture<'_, Result<(), String>>

Open the fork selector’s confirmation; runtime supplies the entry id.
Source§

fn clone(&self) -> BoxFuture<'_, Result<(), String>>

Clone the session at the current leaf.
Source§

fn switch_session(&self, path: &str) -> BoxFuture<'_, Result<(), String>>

Switch to a different session file (resume).
Source§

fn export_html( &self, path: Option<&str>, ) -> BoxFuture<'_, Result<String, String>>

Export the current session to HTML; runtime passes an optional path.
Source§

fn set_session_name(&self, name: &str) -> BoxFuture<'_, Result<(), String>>

Set the session display name.
Source§

fn logout(&self) -> BoxFuture<'_, Result<(), String>>

Log out of the active auth / open the login selector.
Source§

fn last_assistant_text(&self) -> BoxFuture<'_, Result<Option<String>, String>>

Copy the last assistant text (returns the text so the runtime can resolve the platform clipboard).

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
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