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 scanner;
41pub mod time;
42pub mod topology;
43
44pub use dev_tool::GovernanceLevel;
45pub use identity::{AgentId, SessionId};
46pub use policy::{EnforcementMode, FileMode, PolicyDecision, PolicyError};
47pub use risk_tier::RiskTier;
48
49#[cfg(feature = "alloc")]
50pub use agent::{AgentContext, AgentContextBuilder};
51#[cfg(feature = "alloc")]
52pub use approval::ApprovalKind;
53#[cfg(feature = "alloc")]
54pub use dev_tool::DevToolKind;
55#[cfg(feature = "alloc")]
56pub use dev_tool::McpServerInfo;
57#[cfg(feature = "std")]
58pub use dev_tool::{AdapterError, DevToolAdapter, DevToolInfo};
59
60#[cfg(feature = "alloc")]
61pub use policy::{ArgsJson, GovernanceAction, PolicyDocument, PolicyEvaluator, PolicyResult, PolicyRule};
62
63#[cfg(all(feature = "alloc", feature = "test-utils"))]
64pub use evaluators::{DenyAllEvaluator, PermitAllEvaluator};
65
66#[cfg(feature = "alloc")]
67pub use audit::{AuditEntry, AuditEventType, AuditLog, AuditLogError, Lineage};
68
69#[cfg(feature = "std")]
70pub use audit::Redaction;
71
72#[cfg(feature = "alloc")]
73pub use capability::{
74    action_to_capability, merge_capabilities, Capability, CapabilitySet, EffectivePermissions, PermissionSource,
75};
76
77#[cfg(feature = "std")]
78pub use scanner::{CredentialFinding, CredentialKind, CredentialScanner, ScanResult, ScannerConfig};
79
80#[cfg(feature = "std")]
81pub use config::{
82    AgentConnectConfig, ConfigError, DeploymentMode, GatewayConfig, LocalModeConfig, RemoteModeConfig, TlsConfig,
83};
84
85pub use topology::EdgeType;
86#[cfg(all(feature = "std", feature = "test-utils"))]
87pub use topology::MockEdgeRepo;
88#[cfg(feature = "alloc")]
89pub use topology::UnknownEdgeType;
90#[cfg(feature = "std")]
91pub use topology::{cycle_detect, Edge, EdgeRepo, EdgeRepoError, NewEdge};