Skip to main content

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 doctor observability queries for `task_execution_metrics`.
98pub mod qa_doctor;
99/// QA document parsing and validation utilities.
100pub mod qa_utils;
101/// Declarative resource CRUD support and manifest rendering.
102pub mod resource;
103/// Command runner abstractions, policies, and spawn helpers.
104pub use orchestrator_runner::runner;
105/// Daemon lifecycle state and runtime snapshots.
106pub mod runtime;
107/// Sandbox network allowlist parsing and validation.
108pub use orchestrator_runner::sandbox_network;
109/// Scheduler port: [`TaskEnqueuer`](scheduler_port::TaskEnqueuer) trait for
110/// cross-crate task enqueue dispatch (see module docs).
111pub mod scheduler_port;
112/// Secret key audit reports and validation routines.
113pub use orchestrator_security::secret_key_audit;
114/// Secret key rotation lifecycle primitives.
115pub use orchestrator_security::secret_key_lifecycle;
116/// Secret-store encryption and decryption helpers.
117pub use orchestrator_security::secret_store_crypto;
118/// Secure file and directory creation helpers.
119pub use orchestrator_security::secure_files;
120/// Agent selection algorithms and resolution helpers.
121pub mod selection;
122/// Self-referential workspace safety policies.
123pub mod self_referential_policy;
124/// Service-layer handlers used by the daemon.
125pub mod service;
126/// Session persistence models and repository helpers.
127pub mod session_store;
128/// Shared daemon state and state transition helpers.
129pub mod state;
130pub mod store;
131/// Auto-cleanup of terminated tasks and associated data.
132pub mod task_cleanup;
133/// High-level task mutation operations.
134pub mod task_ops;
135/// Task-execution persistence abstraction (**execution layer**).
136///
137/// Seven domain-aligned sub-traits compose into the backward-compatible
138/// `TaskRepository` supertrait: `TaskQueryRepository`,
139/// `TaskItemQueryRepository`, `TaskStateRepository`, `TaskItemMutRepository`,
140/// `CommandRunRepository`, `EventRepository`, `TaskGraphRepository`.
141/// The async wrapper `AsyncSqliteTaskRepository` is the primary runtime
142/// implementation.
143pub mod task_repository;
144/// Ticket discovery, preview, and creation helpers.
145pub mod ticket;
146/// Trigger engine: cron scheduler and event-driven task creation.
147pub mod trigger_engine;
148
149/// Test utilities and fixtures for building isolated orchestrator state.
150#[cfg(any(test, feature = "test-harness"))]
151pub mod test_utils;
152
153/// Re-export of the public workflow loop guard configuration type.
154pub use config::WorkflowLoopGuardConfig;