pub fn truncate_to_budget<'a>(
system_messages: &'a [Message],
history_messages: &'a [Message],
tool_tokens: usize,
policy: &ContextWindowPolicy,
) -> TruncationResult<'a>Expand description
Truncate conversation history to fit within the context window budget.
System messages are never truncated. History messages are dropped from the oldest end, but tool-call/result pairs are kept or dropped as a unit.
Returns references into the input slices.