Expand description
This crate has been renamed to ailoop-history.
All items are re-exported here with a #[deprecated] notice so
existing code keeps compiling while you migrate. The previous
ContextManager / ContextManagerBuilder types were renamed to
History / HistoryBuilder at the same time — see the
ailoop-history crate for
details and migration guidance.
Modules§
- compaction
CompactionStrategytrait and the two built-in implementations. SeeTruncateStrategy(drop the prefix) andSummarizeStrategy(replace the prefix with a model-generated summary).- errors
- Failure surfaces of compaction and snapshot validation.
- history
History+HistoryBuilder+ the report typecompact_if_neededreturns.- history_
store HistoryStoretrait +InMemoryHistoryStore/JsonFileHistoryStorebackends.- snapshot
ConversationSnapshot— versioned wire format used byHistoryStorebackends.
Structs§
- Char
Tokenizer - Fallback
Tokenizerthat approximates tokens astext.len() / 4. - Compaction
Output - Result of a successful
CompactionStrategy::compactcall. - Compaction
Report - Reports what
History::compact_if_neededdid when it ran. Returned wrapped inOption:Nonemeans compaction was not needed (history fits withinmax_tokens). - Conversation
Snapshot - Persistable image of a conversation’s logical state.
- History
- Owns the message vector backing a single conversation, plus the budget and pin mask that govern how compaction reduces it.
- History
Builder - Configuration for a
History. - InMemory
History Store - Volatile
HistoryStorekept entirely in process memory. Intended for tests and short-lived sessions where durable persistence is not required. - Json
File History Store - JSON-backed
HistoryStorethat writes the full snapshot to a single file.savepretty-prints;loadreturnsOk(None)when the file does not exist (first run) so callers can seed an empty conversation without branching on the missing-file case. - Summarize
Strategy - Compaction strategy that calls a
CompletionModelto summarize the dropped portion of the history into a single text message, instead of dropping it outright. - Truncate
Strategy - Default
CompactionStrategy: drop the oldest unpinned messages until the preserved tail starts at a safeUser-without-ToolResultboundary. Pinned messages from the dropped prefix survive verbatim at their relative position; the cut never strands aToolResultfrom itsToolCall. Reports underCompactionStrategy::nameas"truncate".
Enums§
- Compaction
Error - Failure surface of
CompactionStrategy::compact(and therefore ofHistory::compact_if_needed). - From
Messages Error - Returned by
ConversationSnapshot::newandHistory::from_messageswhen the supplied parallel vectors are inconsistent. Surfaces at restore time so a malformed snapshot fails loudly instead of corrupting state silently. - Json
File History Store Error HistoryStore::Errorvariant forJsonFileHistoryStore.
Constants§
- DEFAULT_
SUMMARIZER_ PROMPT - Default system prompt used by
SummarizeStrategywhen the caller does not supply one. Kept terse to leave room for the actual transcript insidemax_tokens.
Traits§
- Compaction
Strategy - User-implementable strategy for shrinking a
History’s history whenHistory::compact_if_neededruns. - History
Store - Persistence backend for conversation snapshots.
- Tokenizer
- Counts tokens in text and full messages.