Skip to main content

RpcSessionHost

Trait RpcSessionHost 

Source
pub trait RpcSessionHost: Send + Sync {
Show 37 methods // Required methods fn prompt( &self, message: String, images: Vec<ImageContent>, streaming_behavior: Option<StreamingBehavior>, preflight: PreflightCallback, ) -> BoxFuture<'static, Result<(), String>>; fn steer( &self, message: String, images: Vec<ImageContent>, ) -> BoxFuture<'static, Result<(), String>>; fn follow_up( &self, message: String, images: Vec<ImageContent>, ) -> BoxFuture<'static, Result<(), String>>; fn abort(&self) -> BoxFuture<'static, ()>; fn get_state(&self) -> BoxFuture<'static, RpcSessionState>; fn get_available_models(&self) -> BoxFuture<'static, Vec<Model>>; fn set_model(&self, model: Model) -> BoxFuture<'static, Result<(), String>>; fn cycle_model(&self) -> BoxFuture<'static, Option<ModelCycleResult>>; fn set_thinking_level( &self, level: ModelThinkingLevel, ) -> BoxFuture<'static, bool>; fn cycle_thinking_level( &self, ) -> BoxFuture<'static, Option<ModelThinkingLevel>>; fn set_steering_mode(&self, mode: QueueMode) -> BoxFuture<'static, ()>; fn set_follow_up_mode(&self, mode: QueueMode) -> BoxFuture<'static, ()>; fn compact( &self, custom_instructions: Option<String>, ) -> BoxFuture<'static, Result<CompactionResult, String>>; fn set_auto_compaction(&self, enabled: bool) -> BoxFuture<'static, ()>; fn set_auto_retry(&self, enabled: bool) -> BoxFuture<'static, ()>; fn abort_retry(&self) -> BoxFuture<'static, ()>; fn execute_bash( &self, command: String, exclude_from_context: Option<bool>, ) -> BoxFuture<'static, Result<BashResult, String>>; fn abort_bash(&self) -> BoxFuture<'static, ()>; fn get_session_stats(&self) -> BoxFuture<'static, SessionStats>; fn export_to_html( &self, output_path: Option<String>, ) -> BoxFuture<'static, Result<String, String>>; fn set_session_name( &self, name: String, ) -> BoxFuture<'static, Result<(), String>>; fn new_session( &self, parent_session: Option<String>, ) -> BoxFuture<'static, Result<bool, String>>; fn switch_session( &self, session_path: String, ) -> BoxFuture<'static, Result<bool, String>>; fn fork( &self, entry_id: String, position: ForkPosition, ) -> BoxFuture<'static, Result<ForkOutcome, String>>; fn get_entries(&self) -> BoxFuture<'static, Vec<SessionEntry>>; fn get_leaf_id(&self) -> BoxFuture<'static, Option<String>>; fn get_tree(&self) -> BoxFuture<'static, Vec<RpcSessionTreeNode>>; fn get_fork_messages(&self) -> BoxFuture<'static, Vec<ForkMessage>>; fn get_last_assistant_text(&self) -> BoxFuture<'static, Option<String>>; fn get_messages(&self) -> BoxFuture<'static, Vec<AgentMessage>>; fn get_commands(&self) -> BoxFuture<'static, Vec<RpcSlashCommand>>; fn subscribe( &self, listener: Arc<dyn Fn(&AgentSessionEvent) + Send + Sync>, ) -> Box<dyn Fn() + Send + Sync>; fn register_backpressure_hook( &self, hook: Arc<dyn Fn() -> BoxFuture<'static, ()> + Send + Sync>, ) -> Box<dyn Fn() + Send + Sync>; fn bind_extensions_rpc( &self, bindings: ExtensionBindings, ) -> BoxFuture<'static, Result<(), String>>; fn dispose(&self) -> BoxFuture<'static, ()>; fn set_rebind(&self, callback: Option<RebindCallback>); // Provided method fn host_extension_runner(&self) -> Option<Arc<HostExtensionRunner>> { ... }
}
Expand description

Abstracts the AgentSessionRuntime + AgentSession surface consumed by the 31 RpcCommand variants.

All async methods return BoxFuture<'static> so they can be tokio::spawn’d without borrowing the host; the preflight callback fires synchronously during the first poll of prompt, which is how the prompt-response frame is enqueued before any agent event in the central write FIFO.

Required Methods§

Source

fn prompt( &self, message: String, images: Vec<ImageContent>, streaming_behavior: Option<StreamingBehavior>, preflight: PreflightCallback, ) -> BoxFuture<'static, Result<(), String>>

Submit a user prompt. The preflight callback fires with true on accept (before the run starts) or false on reject.

Source

fn steer( &self, message: String, images: Vec<ImageContent>, ) -> BoxFuture<'static, Result<(), String>>

Steer into the active turn.

Source

fn follow_up( &self, message: String, images: Vec<ImageContent>, ) -> BoxFuture<'static, Result<(), String>>

Queue a follow-up after the current turn finishes.

Source

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

Abort the active agent run + retry, wait for idle.

Source

fn get_state(&self) -> BoxFuture<'static, RpcSessionState>

Snapshot the current session for the get_state RPC.

Source

fn get_available_models(&self) -> BoxFuture<'static, Vec<Model>>

List available models from the model runtime.

Source

fn set_model(&self, model: Model) -> BoxFuture<'static, Result<(), String>>

Set the active model.

Source

fn cycle_model(&self) -> BoxFuture<'static, Option<ModelCycleResult>>

Cycle to the next model (scoped or all-available).

Source

fn set_thinking_level( &self, level: ModelThinkingLevel, ) -> BoxFuture<'static, bool>

Set the thinking level. Resolves true only when the level change was durably committed (or was already effective).

Source

fn cycle_thinking_level(&self) -> BoxFuture<'static, Option<ModelThinkingLevel>>

Cycle to the next thinking level.

Source

fn set_steering_mode(&self, mode: QueueMode) -> BoxFuture<'static, ()>

Set steering queue drain mode.

Source

fn set_follow_up_mode(&self, mode: QueueMode) -> BoxFuture<'static, ()>

Set follow-up queue drain mode.

Source

fn compact( &self, custom_instructions: Option<String>, ) -> BoxFuture<'static, Result<CompactionResult, String>>

Compact the session.

Source

fn set_auto_compaction(&self, enabled: bool) -> BoxFuture<'static, ()>

Enable / disable auto-compaction.

Source

fn set_auto_retry(&self, enabled: bool) -> BoxFuture<'static, ()>

Enable / disable auto-retry.

Source

fn abort_retry(&self) -> BoxFuture<'static, ()>

Abort in-flight retry sleep.

Source

fn execute_bash( &self, command: String, exclude_from_context: Option<bool>, ) -> BoxFuture<'static, Result<BashResult, String>>

Execute a bash command.

Source

fn abort_bash(&self) -> BoxFuture<'static, ()>

Abort a running bash command.

Source

fn get_session_stats(&self) -> BoxFuture<'static, SessionStats>

Aggregate session statistics for get_session_stats.

Source

fn export_to_html( &self, output_path: Option<String>, ) -> BoxFuture<'static, Result<String, String>>

Export the session to HTML. Returns the written file path.

Source

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

Set the session display name.

Source

fn new_session( &self, parent_session: Option<String>, ) -> BoxFuture<'static, Result<bool, String>>

Start a new session. Returns true when cancelled by an extension hook.

Source

fn switch_session( &self, session_path: String, ) -> BoxFuture<'static, Result<bool, String>>

Switch to another session file. Returns true when cancelled.

Source

fn fork( &self, entry_id: String, position: ForkPosition, ) -> BoxFuture<'static, Result<ForkOutcome, String>>

Fork the session. Returns the fork outcome.

Source

fn get_entries(&self) -> BoxFuture<'static, Vec<SessionEntry>>

All session entries.

Source

fn get_leaf_id(&self) -> BoxFuture<'static, Option<String>>

Current leaf entry id.

Source

fn get_tree(&self) -> BoxFuture<'static, Vec<RpcSessionTreeNode>>

Session tree (wire-facing nodes).

Source

fn get_fork_messages(&self) -> BoxFuture<'static, Vec<ForkMessage>>

Forkable user messages.

Source

fn get_last_assistant_text(&self) -> BoxFuture<'static, Option<String>>

Last assistant text content, if any.

Source

fn get_messages(&self) -> BoxFuture<'static, Vec<AgentMessage>>

All agent messages.

Source

fn get_commands(&self) -> BoxFuture<'static, Vec<RpcSlashCommand>>

Available slash commands (extension + prompt + skill).

Source

fn subscribe( &self, listener: Arc<dyn Fn(&AgentSessionEvent) + Send + Sync>, ) -> Box<dyn Fn() + Send + Sync>

Subscribe to public session events. Returns an unsubscribe closure.

Source

fn register_backpressure_hook( &self, hook: Arc<dyn Fn() -> BoxFuture<'static, ()> + Send + Sync>, ) -> Box<dyn Fn() + Send + Sync>

Register a backpressure hook invoked when the agent has pending events.

Source

fn bind_extensions_rpc( &self, bindings: ExtensionBindings, ) -> BoxFuture<'static, Result<(), String>>

Bind extensions for RPC mode.

Source

fn dispose(&self) -> BoxFuture<'static, ()>

Dispose the current session and runtime.

Source

fn set_rebind(&self, callback: Option<RebindCallback>)

Set the rebind callback invoked after session replacement.

Provided Methods§

Source

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

Current concrete extension host, when this session uses one.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl RpcSessionHost for Arc<AgentSessionRuntime>

Source§

fn prompt( &self, message: String, images: Vec<ImageContent>, streaming_behavior: Option<StreamingBehavior>, preflight: PreflightCallback, ) -> BoxFuture<'static, Result<(), String>>

Source§

fn steer( &self, message: String, images: Vec<ImageContent>, ) -> BoxFuture<'static, Result<(), String>>

Source§

fn follow_up( &self, message: String, images: Vec<ImageContent>, ) -> BoxFuture<'static, Result<(), String>>

Source§

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

Source§

fn get_state(&self) -> BoxFuture<'static, RpcSessionState>

Source§

fn get_available_models(&self) -> BoxFuture<'static, Vec<Model>>

Source§

fn set_model(&self, model: Model) -> BoxFuture<'static, Result<(), String>>

Source§

fn cycle_model(&self) -> BoxFuture<'static, Option<ModelCycleResult>>

Source§

fn set_thinking_level( &self, level: ModelThinkingLevel, ) -> BoxFuture<'static, bool>

Source§

fn cycle_thinking_level(&self) -> BoxFuture<'static, Option<ModelThinkingLevel>>

Source§

fn set_steering_mode(&self, mode: QueueMode) -> BoxFuture<'static, ()>

Source§

fn set_follow_up_mode(&self, mode: QueueMode) -> BoxFuture<'static, ()>

Source§

fn compact( &self, custom_instructions: Option<String>, ) -> BoxFuture<'static, Result<CompactionResult, String>>

Source§

fn set_auto_compaction(&self, enabled: bool) -> BoxFuture<'static, ()>

Source§

fn set_auto_retry(&self, enabled: bool) -> BoxFuture<'static, ()>

Source§

fn abort_retry(&self) -> BoxFuture<'static, ()>

Source§

fn execute_bash( &self, command: String, exclude_from_context: Option<bool>, ) -> BoxFuture<'static, Result<BashResult, String>>

Source§

fn abort_bash(&self) -> BoxFuture<'static, ()>

Source§

fn get_session_stats(&self) -> BoxFuture<'static, SessionStats>

Source§

fn export_to_html( &self, output_path: Option<String>, ) -> BoxFuture<'static, Result<String, String>>

Source§

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

Source§

fn new_session( &self, parent_session: Option<String>, ) -> BoxFuture<'static, Result<bool, String>>

Source§

fn switch_session( &self, session_path: String, ) -> BoxFuture<'static, Result<bool, String>>

Source§

fn fork( &self, entry_id: String, position: ForkPosition, ) -> BoxFuture<'static, Result<ForkOutcome, String>>

Source§

fn get_entries(&self) -> BoxFuture<'static, Vec<SessionEntry>>

Source§

fn get_leaf_id(&self) -> BoxFuture<'static, Option<String>>

Source§

fn get_tree(&self) -> BoxFuture<'static, Vec<RpcSessionTreeNode>>

Source§

fn get_fork_messages(&self) -> BoxFuture<'static, Vec<ForkMessage>>

Source§

fn get_last_assistant_text(&self) -> BoxFuture<'static, Option<String>>

Source§

fn get_messages(&self) -> BoxFuture<'static, Vec<AgentMessage>>

Source§

fn get_commands(&self) -> BoxFuture<'static, Vec<RpcSlashCommand>>

Source§

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

Source§

fn subscribe( &self, listener: Arc<dyn Fn(&AgentSessionEvent) + Send + Sync>, ) -> Box<dyn Fn() + Send + Sync>

Source§

fn register_backpressure_hook( &self, hook: Arc<dyn Fn() -> BoxFuture<'static, ()> + Send + Sync>, ) -> Box<dyn Fn() + Send + Sync>

Source§

fn bind_extensions_rpc( &self, bindings: ExtensionBindings, ) -> BoxFuture<'static, Result<(), String>>

Source§

fn dispose(&self) -> BoxFuture<'static, ()>

Source§

fn set_rebind(&self, callback: Option<RebindCallback>)

Implementors§