pub struct TruncateStrategy;Expand description
Default CompactionStrategy: drop the oldest unpinned messages
until the preserved tail starts at a safe User-without-
ToolResult boundary. Pinned messages from the dropped prefix
survive verbatim at their relative position; the cut never strands
a ToolResult from its ToolCall. Reports under
CompactionStrategy::name as "truncate".
Trait Implementations§
Source§impl CompactionStrategy for TruncateStrategy
impl CompactionStrategy for TruncateStrategy
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable, machine-readable name of the strategy. Used by
HistoryCompacted events so callers can attribute compaction
to a specific algorithm in logs/metrics.Source§fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
pinned: &'life2 [bool],
preserve_n_last: usize,
) -> Pin<Box<dyn Future<Output = Result<CompactionOutput, CompactionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
TruncateStrategy: 'async_trait,
fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
pinned: &'life2 [bool],
preserve_n_last: usize,
) -> Pin<Box<dyn Future<Output = Result<CompactionOutput, CompactionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
TruncateStrategy: 'async_trait,
Compact
messages into a smaller history. Read moreAuto Trait Implementations§
impl Freeze for TruncateStrategy
impl RefUnwindSafe for TruncateStrategy
impl Send for TruncateStrategy
impl Sync for TruncateStrategy
impl Unpin for TruncateStrategy
impl UnsafeUnpin for TruncateStrategy
impl UnwindSafe for TruncateStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more