Skip to main content

aa_core/
lib.rs

1//! Core domain logic for Agent Assembly.
2//!
3//! This crate is `no_std` compatible and contains the foundational types,
4//! traits, and pure logic shared across all other crates in the workspace.
5//! It has no runtime or I/O dependencies.
6//!
7//! # Feature Flags
8//!
9//! - `std` (default): enables `std`-dependent convenience impls (e.g. `From<SystemTime>`)
10//! - `alloc`: enables heap types (`String`, `Vec`, `BTreeMap`) in `no_std` environments
11//! - `serde`: enables `Serialize`/`Deserialize` derives on all core types (added in AAASM-22–25)
12//! - `test-utils`: exposes `PermitAllEvaluator` and `DenyAllEvaluator` for downstream test code
13//! - `std` (also default): enables `CredentialScanner` and all std-dependent types
14//! - `alloc` (also default via std): enables `AuditEntry`, `AuditEventType`, and all audit types
15
16#![cfg_attr(not(feature = "std"), no_std)]
17#![warn(missing_docs)]
18
19cfg_if::cfg_if! {
20    if #[cfg(feature = "alloc")] {
21        extern crate alloc;
22    }
23}
24
25pub mod agent;
26#[cfg(feature = "alloc")]
27pub mod approval;
28#[cfg(feature = "alloc")]
29pub mod audit;
30#[cfg(feature = "alloc")]
31pub mod capability;
32#[cfg(feature = "std")]
33pub mod config;
34pub mod dev_tool;
35pub mod evaluators;
36pub mod identity;
37pub mod policy;
38pub mod risk_tier;
39#[cfg(feature = "std")]
40pub mod storage;
41pub mod time;
42pub mod topology;
43#[cfg(feature = "alloc")]
44pub mod types;
45
46pub use dev_tool::GovernanceLevel;
47pub use identity::{AgentId, SessionId};
48pub use policy::{EnforcementMode, FileMode, PolicyDecision, PolicyError};
49pub use risk_tier::RiskTier;
50
51#[cfg(feature = "alloc")]
52pub use agent::{AgentContext, AgentContextBuilder};
53#[cfg(feature = "alloc")]
54pub use approval::ApprovalKind;
55#[cfg(feature = "alloc")]
56pub use dev_tool::DevToolKind;
57#[cfg(feature = "alloc")]
58pub use dev_tool::McpServerInfo;
59#[cfg(feature = "std")]
60pub use dev_tool::{AdapterError, DevToolAdapter, DevToolInfo};
61
62#[cfg(feature = "alloc")]
63pub use policy::{ArgsJson, GovernanceAction, PolicyDocument, PolicyEvaluator, PolicyResult, PolicyRule};
64
65#[cfg(all(feature = "alloc", feature = "test-utils"))]
66pub use evaluators::{DenyAllEvaluator, PermitAllEvaluator};
67
68#[cfg(feature = "alloc")]
69pub use audit::{AuditEntry, AuditEventType, AuditLog, AuditLogError, Lineage};
70
71#[cfg(feature = "alloc")]
72pub use capability::{
73    action_to_capability, merge_capabilities, Capability, CapabilitySet, EffectivePermissions, PermissionSource,
74};
75
76#[cfg(feature = "std")]
77pub use config::{
78    AgentConnectConfig, ConfigError, DeploymentMode, GatewayConfig, LocalModeConfig, RemoteModeConfig, TlsConfig,
79};
80
81pub use topology::EdgeType;
82#[cfg(all(feature = "std", feature = "test-utils"))]
83pub use topology::MockEdgeRepo;
84#[cfg(feature = "alloc")]
85pub use topology::UnknownEdgeType;
86#[cfg(feature = "std")]
87pub use topology::{cycle_detect, Edge, EdgeRepo, EdgeRepoError, NewEdge};