Skip to main content

StreamEventCollector

Struct StreamEventCollector 

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

A collecting TurnInteraction — the bridge between a live streaming turn and the ContextEvent sequence. Wire it through TurnRunOptions.interaction; when the turn finishes, feed StreamEventCollector::into_events into project_streaming_turn to produce the canonical full sequence.

Usage / Done / Error deltas collect nothing: usage and the terminal state ride the final TurnOutcome event’s trace/result.

Implementations§

Source§

impl StreamEventCollector

Source

pub fn new(turn_id: TurnId, conversation_id: Option<ConversationId>) -> Self

A collector for the given turn (and optional conversation); wire it as TurnRunOptions.interaction for a streaming run.

Source

pub fn events(&self) -> Vec<ContextEvent>

The delta events collected while the turn ran, in arrival order. Borrowed form — convenient behind an Arc wiring.

Source

pub fn into_events(self) -> Vec<ContextEvent>

The delta events collected while the turn ran, in arrival order.

Trait Implementations§

Source§

impl TurnInteraction for StreamEventCollector

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.

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, 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