pub struct StreamState {
pub first: bool,
pub blocks: Vec<bool>,
pub thinking_index: Option<usize>,
pub text_index: Option<usize>,
pub tool_base_index: Option<usize>,
pub input_tokens: u64,
pub stop_reason: Option<String>,
pub pending_usage: Option<TerminalUsage>,
pub message_stopped: bool,
pub stop_window: Option<StopWindow>,
}Fields§
§first: boolgates the message_start preamble
blocks: Vec<bool>per-content-block open/closed, indexed by block index
thinking_index: Option<usize>fixed index for the upstream thinking block, once opened. Thinking uses indices 0..max_thinking_index; everything else opens after.
text_index: Option<usize>index the upstream content text started at; parallel tool calls come
after this. None until first text delta arrives.
tool_base_index: Option<usize>where parallel tool calls start; runs after any thinking/text blocks that have already been opened.
input_tokens: u64known-at-preamble input tokens carried through from the upstream
message_start chunk (Anthropic) — 0 until the first payload arrives
stop_reason: Option<String>§pending_usage: Option<TerminalUsage>usage from a choice-less trailer chunk that arrived BEFORE any finish chunk: buffered here and flushed with the terminal message_delta, instead of terminating the stream early.
message_stopped: bool§stop_window: Option<StopWindow>Present only when the request carried stop sequences.