pub enum CompactionStep {
Excerpt {
msg_idx: Vec<usize>,
},
Snip {
msg_idx: Vec<usize>,
per_msg_limit: u32,
},
DropOldest {
count: usize,
},
}Expand description
A fully-specified compaction step the cache-aware planner emits; the executor applies it mechanically (all selection already done by the planner via the pure helpers above).
Variants§
Excerpt
Excerpt the tool results at these history-message indices. Prefix-safe in practice: tool results are interleaved mid/late, so the earliest touched index is rarely the cache prefix.
Snip
Cap the oversized text messages at these indices to per_msg_limit.
DropOldest
Drop the count oldest messages (the pipeline summarizes them). Prefix-breaking at index 0.
Implementations§
Source§impl CompactionStep
impl CompactionStep
Sourcepub fn invalidates_prefix_at(&self) -> Option<usize>
pub fn invalidates_prefix_at(&self) -> Option<usize>
The earliest history-message index this step rewrites or removes — i.e. where it invalidates
the prompt-cache prefix. None = prefix-safe (touches nothing). A lower index is a higher
cache cost (Anthropic keys the cache off the first N messages), so the planner prefers None
or a later index, and escalates to a prefix-breaking drop only when the safe steps can’t free
enough.
Trait Implementations§
Source§impl Clone for CompactionStep
impl Clone for CompactionStep
Source§fn clone(&self) -> CompactionStep
fn clone(&self) -> CompactionStep
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompactionStep
impl Debug for CompactionStep
Source§impl PartialEq for CompactionStep
impl PartialEq for CompactionStep
Source§fn eq(&self, other: &CompactionStep) -> bool
fn eq(&self, other: &CompactionStep) -> bool
self and other values to be equal, and is used by ==.