//! Core runtime engine for Common Agent Runtime.
//!
//! The runtime loop:
//! 1. Receive a proposal (batch of actions from a model)
//! 2. Build a DAG from state_dependencies
//! 3. Execute each level (concurrent if no ABORT actions, sequential otherwise)
//! 4. Validate, execute with idempotency + timeout + retry, commit
//! 5. On abort: rollback state to pre-proposal snapshot

pub mod agent_basics;
pub mod agent_capability;
pub mod authz;
pub mod builtin_agents;
pub mod cache;
pub mod capabilities;
pub mod checkpoint;
mod executor;
pub mod mcp;
pub mod rate_limit;
pub mod registry;
pub mod subprocess;

pub use agent_basics::entries as agent_basic_entries;
pub use agent_capability::AgentCapabilityRegistry;
pub use builtin_agents::{
    agent_metadata, format_capability_payload, register_builtins, BuiltinAgent,
    CapabilityPayloadError, BUILTIN_AGENTS,
};
pub use authz::{
    AllowAllPermissions, AuthzDecision, AuthzPipeline, AuthzResult, AuthzStage, PermissionHandler,
    Restriction,
};
pub use cache::ResultCache;
pub use capabilities::CapabilitySet;
pub use checkpoint::Checkpoint;
pub use executor::{
    format_tool_result, CostBudget, FailedActionSummary, ReplanCallback, ReplanConfig,
    ReplanContext, Runtime, ToolExecutor, CANCELED_PREFIX,
};
pub use mcp::{McpServer, McpServerConfig, McpToolExecutor, McpToolInfo};
pub use rate_limit::{RateLimit, RateLimiter};
pub use registry::{ToolEntry, ToolPermission, ToolRegistry, ToolSource};
pub use subprocess::{SubprocessTool, SubprocessToolExecutor};

#[cfg(test)]
mod tests;
