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