Expand description
The one history-reduction path.
A run previously reduced history twice: a message-count pass over
crate::uar::context::ContextStrategy followed by an independent
token-budget pass with its own strategy enum and its own tokenizer. The two
disagreed about what a token was, neither knew the system message was
pinned, and neither knew about tool-call pairs.
reduce_history is now the only way a run reduces history. It runs the
structural stage and the token-budget stage in order, from the single
operator-declared strategy, with the system message pinned out of reach of
both. Canonical tool groups are validated before reduction and must survive
byte-for-byte or the reduction returns an explicit overflow.
The operator-facing crate::uar::context::ContextStrategy remains the
only declared strategy. The internal
crate::uar::domain::context::ContextStrategy is derived from it here and
is not part of any persisted policy.
Structs§
- Reduce
Report - What
reduce_historydid to a run’s history.
Enums§
- Reduce
History Error - Why a history cannot be prepared within the requested reduction policy.
Functions§
- budget_
strategy_ for - Map the operator-declared strategy onto the token-budget stage’s strategy.
- reduce_
history - Reduce a run’s history once: lossless validation, structural stage, token budget, then protected-group verification, with the system message pinned.
- reduce_
history_ with_ marked_ prose - Reduce history while permitting only explicitly host-marked prose ranges to enter summarization. Span indices address conversation history after the optional leading system message is removed.