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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more