aither-agent 0.31.0

AI agent framework with planning, memory, and tool execution for aither
Documentation
//! Context management: one window, one policy, one budget.
//!
//! Context is the agent's scarcest resource and the one it cannot measure
//! directly, so this module is organised around the few facts that are
//! actually knowable and derives everything else from them:
//!
//! - [`window`] owns the layout, and guarantees it grows only at the end so a
//!   provider's prefix cache survives the conversation growing;
//! - [`system`] orders the system prompt as the host lays it out and keeps
//!   external content inside boundaries it cannot close;
//! - [`budget`] turns the provider's own token counts into a usage figure,
//!   instead of trusting a character heuristic that is wrong by a different
//!   factor for prose, code and tool arguments;
//! - [`policy`] holds every threshold there is — when to compact, when to
//!   wait for it, when to rebuild, how much may be restored;
//! - [`cache`] translates the layout into per-provider cache controls;
//! - [`prefix`] hashes each request's prefix block by block, so a host can
//!   tell where the prefix changed when the cache misses;
//! - [`compaction`] forks a typed handoff at a request boundary and applies
//!   it at the next one, so the run never stops to summarize itself;
//! - [`reassembly`] re-reads what the handoff named, within budget;
//! - [`source`] is how everything ambient — state changes, events, running
//!   jobs — reaches the model without the agent loop knowing about any of it
//!   in particular, in the tail or, appended once, in the cacheable prefix;
//! - [`live`] is how prefix content that changes mid-session — `AGENTS.md`,
//!   a command table — reaches the model as one diff while the prefix is
//!   cached and as its clean version after the next reassembly.

pub mod budget;
pub mod cache;
pub mod compaction;
pub mod live;
pub mod policy;
pub mod prefix;
pub mod reassembly;
pub(crate) mod recovery;
pub mod source;
pub mod system;
pub mod window;

pub use crate::event::SourceId;
pub use budget::ContextBudget;
pub use cache::{CacheLifetime, PromptCache};
pub use compaction::{
    AnyFileReferences, AttachmentCatalogEntry, AttachmentRef, CompactionError, CompactionFork,
    CompletedCompaction, ContextFile, FileReferences, Handoff, HandoffDocument, HandoffPrompt,
    HandoffSchema, InvalidHandoff, KeptAttachment, LineRange, PendingCompaction, Restoration,
    SkillCatalogEntry, build_file_index,
};
pub use live::{LiveContent, LiveUpdate};
pub use policy::ContextPolicy;
pub use prefix::{PrefixBlock, PrefixChain, PrefixRewrites, PromptPrefix};
pub use reassembly::restore_context;
pub use source::{
    AnyContextSource, AnyLiveSource, Block, ContextBlock, ContextSource, LiveChange, LiveSource,
    Moment, Placement,
};
pub use system::{
    BlockKind, External, ExternalContent, ExternalSlot, Instruction, InstructionSlot, Slot,
    Sourced, SourcedSlot, SystemLayout, SystemRegion,
};
pub use window::{Context, ContextCheckpoint, ContextItem, ReassemblyReport};