Skip to main content

auto_compact_messages

Function auto_compact_messages 

Source
pub async fn auto_compact_messages(
    input: AutoCompactionInput<'_>,
    history: &mut Vec<Message>,
) -> Result<Option<AutoCompactionOutcome>>
Expand description

Compress history in place when automatic compaction should fire.

Returns None when compaction is disabled, the history is below the trigger threshold, or the engine produced no change. On a successful pass the compacted history (with envelope injected) replaces history and an AutoCompactionOutcome is returned; the caller is responsible for emitting the thread.compact_boundary event and resetting token accounting.