pub struct InterruptSnapshot {
pub text: Option<String>,
pub completed_tool_calls: Vec<ToolCall>,
pub in_flight_tool: Option<InFlightTool>,
pub bytes_received: usize,
}Expand description
Snapshot of everything a StreamCollector had accumulated at the moment
the stream was interrupted. Used by the loop runner to pick a
RecoveryPlan.
Fields§
§text: Option<String>Assistant text accumulated before the interruption. None if no text
was received.
completed_tool_calls: Vec<ToolCall>Tool calls whose argument JSON parsed successfully before interruption.
in_flight_tool: Option<InFlightTool>The tool_use block (if any) that was open but not yet closed.
bytes_received: usizeTotal bytes of events processed (telemetry).
Implementations§
Source§impl InterruptSnapshot
impl InterruptSnapshot
Sourcepub fn from_partials<I>(
text: Option<String>,
partials: I,
bytes_received: usize,
) -> InterruptSnapshot
pub fn from_partials<I>( text: Option<String>, partials: I, bytes_received: usize, ) -> InterruptSnapshot
Build an InterruptSnapshot from a stream of (id, name, args_json)
triples in declaration order, plus the accumulated text.
Tools whose name is empty or whose args_json does not parse as
JSON become the in_flight_tool (last-write-wins if multiple);
the rest land in completed_tool_calls. This is the single source
of truth for partials → snapshot translation; the multiple
stream-collector implementations across the runtime delegate to
it instead of reimplementing.
Sourcepub fn plan(&self) -> RecoveryPlan
pub fn plan(&self) -> RecoveryPlan
Decide which recovery plan applies to this snapshot.
Trait Implementations§
Source§impl Clone for InterruptSnapshot
impl Clone for InterruptSnapshot
Source§fn clone(&self) -> InterruptSnapshot
fn clone(&self) -> InterruptSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for InterruptSnapshot
impl RefUnwindSafe for InterruptSnapshot
impl Send for InterruptSnapshot
impl Sync for InterruptSnapshot
impl Unpin for InterruptSnapshot
impl UnsafeUnpin for InterruptSnapshot
impl UnwindSafe for InterruptSnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more