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
impl StreamEventCollector
Sourcepub fn new(turn_id: TurnId, conversation_id: Option<ConversationId>) -> Self
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.
Sourcepub fn events(&self) -> Vec<ContextEvent>
pub fn events(&self) -> Vec<ContextEvent>
The delta events collected while the turn ran, in arrival order.
Borrowed form — convenient behind an Arc wiring.
Sourcepub fn into_events(self) -> Vec<ContextEvent>
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
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,
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,
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,
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§
impl !Freeze for StreamEventCollector
impl RefUnwindSafe for StreamEventCollector
impl Send for StreamEventCollector
impl Sync for StreamEventCollector
impl Unpin for StreamEventCollector
impl UnsafeUnpin for StreamEventCollector
impl UnwindSafe for StreamEventCollector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more