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 read_paths;
27pub mod region;
28pub mod run_archive;
29pub mod run_meta;
30pub mod sandbox;
31pub mod secrets;
32pub mod taint;
33pub mod telemetry;
34pub mod text;
35
36pub use blueprint::{
37    Blueprint, ContextTransform, EdgeTransform, FileTrackingConfig, NudgeConfig, ReadPathsConfig,
38    RepetitionDetectionConfig, ResolvedNudge, Stage, StuckConfig, ToolResultRouting,
39    TransitionCondition, TransitionEdge, resolve_nudge,
40};
41pub use cache::CacheHint;
42pub use credentials::{
43    CredentialStore, CredentialStoreKind, MemoryStore, mcp_account, provider_account,
44};
45pub use error::{Error, Result, ValidationError};
46pub use layout::{BudgetSpec, ContextLayout, RegionDefinition};
47pub use lifecycle::CompactionConfig;
48pub use net::{
49    ClientTimeouts, UrlRejection, check_url, checked_client, client, client_builder,
50    is_restricted_addr,
51};
52pub use panic_payload::panic_message;
53pub use paths::{
54    agents_dir, canonicalize_for_match, data_dir, home_dir, is_safe_path_component, providers_dir,
55    resolves_within, tools_dir,
56};
57pub use policy::{AllowlistRule, McpToolOverride, PolicyConfig};
58pub use read_paths::{
59    ReadPathDecision, ReadPathEntry, ReadPathPolicy, ReadPathSet, validate_entry_syntax,
60};
61pub use region::{
62    ContentFormat, EntryKind, EvictionStrategy, Region, RegionEntry, RegionKind, RegionSchema,
63    SerializedToolCall,
64};
65pub use sandbox::{OnUnavailable, SandboxKind, ToolSandboxConfig, resolve_sandbox};
66pub use secrets::{
67    child_env_allowed, constant_time_eq, is_secret_header, is_sensitive_env_name, redact,
68    script_env_allowed,
69};
70pub use taint::{
71    GateDecision, GateDecisionSource, GateEvent, RegionTaint, SecurityConfig, TaintLevel,
72    ToolClassification, ToolDirection,
73};
74pub use text::{estimate_tokens, floor_char_boundary, truncate_at_boundary};