Skip to main content

enforce_stream_byte_limit

Function enforce_stream_byte_limit 

Source
pub fn enforce_stream_byte_limit(
    stream: &ToolCallStream,
    max_total_bytes: u64,
) -> Result<(), KernelError>
Expand description

Sum the canonical byte size of a materialized stream and deny with Overloaded { StreamBytes } if it exceeds max_total_bytes (0 = unlimited). Uses the same per-chunk measurement as truncate_stream_to_limits, so the at-arrival count and the finalize-time count agree by construction.