Expand description
max_output_bytes enforcement: UTF-8-safe truncation and hit-list shrinking.
Budgeting always cuts on a structural boundary — a whole hit, or a char boundary inside markdown. Slicing raw JSON text would emit an unparseable document, which is strictly worse for an agent than an over-budget one.
Functions§
- apply_
output_ budget_ search_ crates - Reduce
search-crateshits until the success envelope fitsmax_output_bytes. - apply_
output_ budget_ search_ in_ crate - Reduce
search-in-cratehits until the success envelope fitsmax_output_bytes. - apply_
truncation_ to_ item - Apply max_output_bytes truncation to get-item payload.
- apply_
truncation_ to_ readme - Apply max_output_bytes truncation to readme payload.
- truncate_
output - Truncate UTF-8 text on a char boundary; returns (text, truncated).