Skip to main content

TurnInteraction

Trait TurnInteraction 

Source
pub trait TurnInteraction: Send + Sync {
    // Provided methods
    fn on_delta<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _round_id: RoundId,
        _delta: &'life1 StreamDelta,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn decide_batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _calls: &'life1 [ToolCallPayload],
    ) -> Pin<Box<dyn Future<Output = BatchDecision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn pending_inputs<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<TextPayload>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Host observations and decisions while a turn is in flight.

Provided Methods§

Source

fn on_delta<'life0, 'life1, 'async_trait>( &'life0 self, _round_id: RoundId, _delta: &'life1 StreamDelta, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Streaming-delta observation. Called once per provider delta in the model phase, with the round the delta belongs to (round attribution is driver state — the port carries it so hosts never have to guess round boundaries). Deltas observed here are advisory: a retried attempt re-streams the same frame and the host decides how to present the partial-then-reset flow.

Source

fn decide_batch<'life0, 'life1, 'async_trait>( &'life0 self, _calls: &'life1 [ToolCallPayload], ) -> Pin<Box<dyn Future<Output = BatchDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Batch decision gate: called after the tool-use hook has filtered the model-emitted batch and before executor dispatch. Default BatchDecision::Proceed — the literal absence of opinion. Returning BatchDecision::Pause suspends the turn (crate::driver::TurnResult::Paused, context left open) until the host resumes it through crate::resume::resume_turn with the withheld crate::hook::HookOutcome — approve is passthrough, reject is all-rejected, rewrite is the edited batch; the HookOutcome constructors cover every decision, so no separate resume-decision enum exists.

Source

fn pending_inputs<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<TextPayload>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Steering inputs, pulled by the driver at every round boundary before the frame materializes; each non-empty entry is appended to the active turn with the user.steering source label and the next model round sees it. Default: empty (zero-cost pull). The queue itself is host vocabulary — the runtime holds no channel type.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§