Expand description
The streaming assistant message, folded from message_update frames (Rust-only). A message_update event
carries the provider frame and the usage so far, not the message: sending the whole message with every delta made
streaming quadratic in the answer’s length (serialized, sent and diffed once per token). A watcher starts from
the message_start message and folds each frame into it, as the provider built its partial:
text_start/thinking_startopen an empty block at the frame’s index;*_deltaappends;*_endsets the block’s final text.toolcall_startopens a call (id,toolNamefrom the frame) with empty arguments;toolcall_deltaappends to its streamed argument text, kept beside the call aspartialJson, and parses it as the providers do (jsrt::json_parse::parse_streaming_json);toolcall_endputs the finished call in its place.
A message_update from an older worker still carries message: it replaces the fold (message_of).
Constants§
- PARTIAL_
JSON - The streamed argument text of a tool call still being written (dropped when the call ends).
Functions§
- fold_
frame - fold_
update - Fold one
message_updateevent intomessage(the streaming message so far): its frame, and its usage. - message_
of - The message an update gives a watcher that had none: an older worker’s whole message, else nothing.