Skip to main content

Crate ailoop_context

Crate ailoop_context 

Source
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
CompactionStrategy trait and the two built-in implementations. See TruncateStrategy (drop the prefix) and SummarizeStrategy (replace the prefix with a model-generated summary).
errors
Failure surfaces of compaction and snapshot validation.
history
History + HistoryBuilder + the report type compact_if_needed returns.
history_store
HistoryStore trait + InMemoryHistoryStore / JsonFileHistoryStore backends.
snapshot
ConversationSnapshot — versioned wire format used by HistoryStore backends.

Structs§

CharTokenizer
Fallback Tokenizer that approximates tokens as text.len() / 4.
CompactionOutput
Result of a successful CompactionStrategy::compact call.
CompactionReport
Reports what History::compact_if_needed did when it ran. Returned wrapped in Option: None means compaction was not needed (history fits within max_tokens).
ConversationSnapshot
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.
HistoryBuilder
Configuration for a History.
InMemoryHistoryStore
Volatile HistoryStore kept entirely in process memory. Intended for tests and short-lived sessions where durable persistence is not required.
JsonFileHistoryStore
JSON-backed HistoryStore that writes the full snapshot to a single file. save pretty-prints; load returns Ok(None) when the file does not exist (first run) so callers can seed an empty conversation without branching on the missing-file case.
SummarizeStrategy
Compaction strategy that calls a CompletionModel to summarize the dropped portion of the history into a single text message, instead of dropping it outright.
TruncateStrategy
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".

Enums§

CompactionError
Failure surface of CompactionStrategy::compact (and therefore of History::compact_if_needed).
FromMessagesError
Returned by ConversationSnapshot::new and History::from_messages when the supplied parallel vectors are inconsistent. Surfaces at restore time so a malformed snapshot fails loudly instead of corrupting state silently.
JsonFileHistoryStoreError
HistoryStore::Error variant for JsonFileHistoryStore.

Constants§

DEFAULT_SUMMARIZER_PROMPT
Default system prompt used by SummarizeStrategy when the caller does not supply one. Kept terse to leave room for the actual transcript inside max_tokens.

Traits§

CompactionStrategy
User-implementable strategy for shrinking a History’s history when History::compact_if_needed runs.
HistoryStore
Persistence backend for conversation snapshots.
Tokenizer
Counts tokens in text and full messages.