agent_orchestrator/lib.rs
1//! Public API surface for the agent orchestrator core crate.
2//!
3//! This crate exposes orchestration models, configuration loading, scheduling,
4//! persistence helpers, and service-facing data transfer types used by the CLI
5//! and daemon crates.
6//!
7//! # Examples
8//!
9//! ```rust
10//! use agent_orchestrator::config::WorkflowLoopGuardConfig;
11//!
12//! let guard = WorkflowLoopGuardConfig::default();
13//! assert!(guard.stop_when_no_unresolved);
14//! ```
15#![cfg_attr(
16 not(any(test, feature = "test-harness")),
17 deny(clippy::panic, clippy::unwrap_used, clippy::expect_used)
18)]
19#![deny(missing_docs)]
20#![deny(clippy::undocumented_unsafe_blocks)]
21
22pub mod agent_lifecycle;
23/// Anomaly classification types for scheduler traces and runtime diagnostics.
24pub mod anomaly;
25/// Async SQLite access helpers backed by `tokio_rusqlite` (**foundation layer**).
26///
27/// Provides a writer/reader `AsyncDatabase` connection pair that bridges tokio
28/// and SQLite's single-writer model. All async repository implementations
29/// (`task_repository`, `persistence/repository`, `session_store`) build on top
30/// of this layer.
31pub mod async_database;
32/// K8s-style declarative resource types shared by the CLI surface.
33pub use orchestrator_config::cli_types;
34pub mod collab;
35/// Extension trait adding CRD-projected accessors to `OrchestratorConfig`.
36pub mod config_ext;
37pub use orchestrator_config::config;
38/// Configuration loading, overlaying, and validation helpers.
39pub mod config_load;
40/// Custom resource definitions and resource store projections.
41pub mod crd;
42/// SQLite admin facade (**admin / facade layer**).
43///
44/// Re-exports connection primitives from `persistence::sqlite`, and provides
45/// project-scoped task queries, audit-record insertion, execution-metrics
46/// sampling, and database reset/housekeeping operations. This is the entry
47/// point for administrative database work; task-execution persistence lives in
48/// `task_repository`, and infrastructure (migrations, domain repos) lives in
49/// `persistence`.
50pub mod db;
51/// Database maintenance utilities: VACUUM and size reporting.
52pub mod db_maintenance;
53/// Serialized database write coordination for async callers (**async write layer**).
54///
55/// Wraps `AsyncSqliteTaskRepository` behind a `DbWriteCoordinator` that
56/// serializes event insertion, command-run updates, and phase-result
57/// persistence through the single-writer connection.
58pub mod db_write;
59/// Data transfer objects returned by public task and event APIs.
60pub mod dto;
61pub mod dynamic_orchestration;
62/// Environment resolution utilities for command execution.
63pub use orchestrator_config::env_resolve;
64/// Canonical error categories and error classification helpers.
65pub mod error;
66/// TTL-based event cleanup, archival, and statistics.
67pub mod event_cleanup;
68/// Event sink types and event-query helpers.
69pub mod events;
70/// Backfill helpers for reconstructing missing event streams.
71pub mod events_backfill;
72/// Health check models and endpoint support code.
73pub mod health;
74/// JSON extraction helpers used by dynamic orchestration and templating.
75pub mod json_extract;
76/// TTL-based log file cleanup for terminated tasks.
77pub mod log_cleanup;
78pub mod metrics;
79/// Legacy migration entry points preserved for compatibility.
80pub mod migration;
81/// Logging and metrics bootstrap helpers for runtime observability.
82pub mod observability;
83/// Output capture utilities for spawned commands.
84pub use orchestrator_runner::output_capture;
85/// Structured output validation and diagnostics.
86pub mod output_validation;
87/// Persistence infrastructure (**infrastructure layer**).
88///
89/// Connection management, schema migrations, and domain-specific repository
90/// traits and SQLite implementations: `ConfigRepository`, `SessionRepository`,
91/// `SchedulerRepository`, `WorkflowStoreRepository`. Distinct from
92/// `task_repository` which covers task-execution abstractions, and from `db`
93/// which provides admin/facade operations.
94pub mod persistence;
95/// Prehook execution models and support helpers.
96pub mod prehook;
97/// QA document parsing and validation utilities.
98pub mod qa_utils;
99/// Declarative resource CRUD support and manifest rendering.
100pub mod resource;
101/// Command runner abstractions, policies, and spawn helpers.
102pub use orchestrator_runner::runner;
103/// Daemon lifecycle state and runtime snapshots.
104pub mod runtime;
105/// Sandbox network allowlist parsing and validation.
106pub use orchestrator_runner::sandbox_network;
107/// Scheduler port: [`TaskEnqueuer`](scheduler_port::TaskEnqueuer) trait for
108/// cross-crate task enqueue dispatch (see module docs).
109pub mod scheduler_port;
110/// Secret key audit reports and validation routines.
111pub use orchestrator_security::secret_key_audit;
112/// Secret key rotation lifecycle primitives.
113pub use orchestrator_security::secret_key_lifecycle;
114/// Secret-store encryption and decryption helpers.
115pub use orchestrator_security::secret_store_crypto;
116/// Secure file and directory creation helpers.
117pub use orchestrator_security::secure_files;
118/// Agent selection algorithms and resolution helpers.
119pub mod selection;
120/// Self-referential workspace safety policies.
121pub mod self_referential_policy;
122/// Service-layer handlers used by the daemon.
123pub mod service;
124/// Session persistence models and repository helpers.
125pub mod session_store;
126/// Shared daemon state and state transition helpers.
127pub mod state;
128pub mod store;
129/// Auto-cleanup of terminated tasks and associated data.
130pub mod task_cleanup;
131/// High-level task mutation operations.
132pub mod task_ops;
133/// Task-execution persistence abstraction (**execution layer**).
134///
135/// Seven domain-aligned sub-traits compose into the backward-compatible
136/// `TaskRepository` supertrait: `TaskQueryRepository`,
137/// `TaskItemQueryRepository`, `TaskStateRepository`, `TaskItemMutRepository`,
138/// `CommandRunRepository`, `EventRepository`, `TaskGraphRepository`.
139/// The async wrapper `AsyncSqliteTaskRepository` is the primary runtime
140/// implementation.
141pub mod task_repository;
142/// Ticket discovery, preview, and creation helpers.
143pub mod ticket;
144/// Trigger engine: cron scheduler and event-driven task creation.
145pub mod trigger_engine;
146
147/// Test utilities and fixtures for building isolated orchestrator state.
148#[cfg(any(test, feature = "test-harness"))]
149pub mod test_utils;
150
151/// Re-export of the public workflow loop guard configuration type.
152pub use config::WorkflowLoopGuardConfig;