Skip to main content

leviath_core/
lib.rs

1//! # Leviath Core
2//!
3//! Core types and traits for the Leviath agent framework.
4//!
5//! This crate provides the foundational types for building agents with structured,
6//! hardware-inspired context window management. It includes:
7//!
8//! - **Regions**: Typed memory regions with different lifecycle policies
9//! - **Layouts**: Complete memory maps defining how context is structured
10//! - **Blueprints**: Agent definitions including stages, models, and tools
11//! - **Lifecycle**: Policies for eviction, compaction, and context management
12
13pub mod blueprint;
14pub mod cache;
15pub mod config;
16pub mod credentials;
17pub mod error;
18pub mod interaction;
19pub mod layout;
20pub mod lifecycle;
21pub mod manifest;
22pub mod net;
23pub mod panic_payload;
24pub mod paths;
25pub mod policy;
26pub mod region;
27pub mod run_archive;
28pub mod run_meta;
29pub mod sandbox;
30pub mod secrets;
31pub mod taint;
32pub mod telemetry;
33pub mod text;
34
35pub use blueprint::{
36    Blueprint, ContextTransform, EdgeTransform, FileTrackingConfig, RepetitionDetectionConfig,
37    Stage, StuckConfig, ToolResultRouting, TransitionCondition, TransitionEdge,
38};
39pub use cache::CacheHint;
40pub use credentials::{
41    CredentialStore, CredentialStoreKind, MemoryStore, mcp_account, provider_account,
42};
43pub use error::{Error, Result, ValidationError};
44pub use layout::{BudgetSpec, ContextLayout, RegionDefinition};
45pub use lifecycle::CompactionConfig;
46pub use net::{
47    ClientTimeouts, UrlRejection, check_url, checked_client, client, client_builder,
48    is_restricted_addr,
49};
50pub use panic_payload::panic_message;
51pub use paths::{
52    agents_dir, data_dir, home_dir, is_safe_path_component, providers_dir, resolves_within,
53    tools_dir,
54};
55pub use policy::{AllowlistRule, McpToolOverride, PolicyConfig};
56pub use region::{
57    ContentFormat, EntryKind, EvictionStrategy, Region, RegionEntry, RegionKind, RegionSchema,
58    SerializedToolCall,
59};
60pub use sandbox::{OnUnavailable, SandboxKind, ToolSandboxConfig, resolve_sandbox};
61pub use secrets::{
62    child_env_allowed, constant_time_eq, is_secret_header, is_sensitive_env_name, redact,
63    script_env_allowed,
64};
65pub use taint::{
66    GateDecision, GateDecisionSource, GateEvent, RegionTaint, SecurityConfig, TaintLevel,
67    ToolClassification, ToolDirection,
68};
69pub use text::{estimate_tokens, floor_char_boundary, truncate_at_boundary};