Skip to main content

CommandHost

Trait CommandHost 

Source
pub trait CommandHost: Send + Sync {
    // Required methods
    fn turn_context<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<CommandTurnContext>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn completion<'life0, 'async_trait>(
        &'life0 self,
        request: SessionCompletionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<SessionCompletion, SessionCompletionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn completion_stream<'life0, 'async_trait>(
        &'life0 self,
        _request: SessionCompletionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<SessionCompletionStream, SessionCompletionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Host facilities available to crate::capabilities::Capability::execute_command.

Hosts that cannot provide these facilities use DisabledCommandHost so misconfiguration surfaces at invocation time with a clear error.

Required Methods§

Source

fn turn_context<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<CommandTurnContext>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Assemble the same merged context a main turn would see.

Source

fn completion<'life0, 'async_trait>( &'life0 self, request: SessionCompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<SessionCompletion, SessionCompletionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run a tool-less completion against the session’s resolved model (or a Controls model override). Persists nothing.

Provided Methods§

Source

fn completion_stream<'life0, 'async_trait>( &'life0 self, _request: SessionCompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<SessionCompletionStream, SessionCompletionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Streaming variant of Self::completion for commands that surface progressive output. Same request semantics, same out-of-band guarantee: nothing is persisted.

Default: SessionCompletionError::StreamingUnsupported. Hosts that can stream override this; commands match on that variant to fall back to Self::completion.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§