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