aion_server/lib.rs
1//! Deployable HTTP, gRPC, WebSocket, and worker endpoint for Aion workflows.
2//!
3//! This crate wraps the transport-agnostic engine with API handlers, namespace
4//! isolation, observability, shutdown handling, ops-console assets, and
5//! remote-worker task dispatch.
6//!
7//! # Example
8//!
9//! ```
10//! use aion_server::ServerConfig;
11//!
12//! let config = ServerConfig::default();
13//! println!("serving gRPC on {}", config.server.grpc_address);
14//! ```
15
16/// HTTP, gRPC, and worker API handlers.
17/// Transcript retention bounds: per-event size truncation for the durable `O`
18/// keyspace (`[observability]` config).
19pub(crate) mod activity_bounds;
20/// NOI-5 transcript sequencer + live fan-out — commit-allocated `store_seq` over
21/// the durable `O` keyspace, plus the resumable transcript broadcast.
22pub mod activity_publisher;
23pub mod api;
24#[cfg(feature = "auth")]
25/// Authentication middleware and token validation.
26pub mod auth;
27/// Server-side Gleam authoring surface (compile, type-check, package, hot-load).
28pub mod authoring;
29
30/// The built-in assistant: the embedded AWL document, its boot install, and
31/// the description the server serves of it.
32pub mod assistant;
33/// In-process AWL checking, formatting, semantics, and workspace documents.
34pub(crate) mod awl;
35/// What code this server is: the revision stamped into the binary at build
36/// time, so a running server can be asked rather than guessed about (#123).
37pub mod build_identity;
38/// SS-5b automatic multi-node failover detection (cluster supervisor). Only
39/// meaningful for a distributed haematite boot, so gated behind the backend.
40#[cfg(feature = "haematite-backend")]
41pub mod cluster;
42/// WS3 cluster topology/ownership broadcast publisher (not backend-gated: the
43/// ops console's cluster channel is served on every boot, showing calm state with
44/// no peers on a single-node server).
45pub mod cluster_publisher;
46/// Runtime configuration loading and validation.
47pub mod config;
48/// Operator deploy surface authorization.
49pub mod deploy;
50/// Local dev-server surface: trigger a run, stream it over the existing
51/// firehose, mock a named activity per-run, and replay a failed run — all over
52/// the real engine, store, and event stream.
53pub mod dev_ui;
54/// Server error and stream-failure types.
55pub mod error;
56/// Descriptor-relative filesystem confinement for sensitive server roots.
57pub(crate) mod filesystem;
58/// Engine-internal workflow filtering for enumeration surfaces.
59mod internal_workflow;
60/// The Model Context Protocol surface (2026-07-28 stateless revision): the
61/// tool catalog, the tool implementations, and the `/mcp` mount.
62pub mod mcp;
63/// Namespace resolution and authorization guard types.
64pub mod namespace;
65/// Health, metrics, and tracing support.
66pub mod observability;
67/// Ops-console asset serving helpers.
68pub mod ops_console;
69/// Distributed request routing: the gRPC-edge availability layer over the fence.
70pub mod routing;
71/// Server run loop: configuration load, transports, and graceful shutdown.
72pub mod run;
73/// Cooperative shutdown and drain handling.
74pub mod shutdown;
75/// Shared server state construction and access.
76pub mod state;
77/// WebSocket event-streaming support.
78pub mod stream;
79/// Umask-independent temporary directories for tests that exercise
80/// private-root validation.
81#[cfg(test)]
82pub(crate) mod test_support;
83/// Remote-worker registry, heartbeat, and dispatch support.
84pub mod worker;
85
86pub use build_identity::BuildIdentity;
87pub use config::ServerConfig;
88pub use deploy::DeployGuard;
89pub use dev_ui::{ActivityMockRegistry, DevMockingDispatcher, MockedActivity};
90pub use error::{ServerError, StreamFailure};
91pub use mcp::{AionToolService, McpRuntime};
92pub use namespace::{
93 CallerIdentity, NAMESPACE_ATTRIBUTE, NamespaceGuard, NamespaceMinter, NamespaceOperation,
94 NamespaceResolver, ScheduleNamespaceSource, ScheduleTarget, ScopedEngine,
95 StaticScheduleNamespaces, StaticWorkflowNamespaces, SubscriptionScope, TASK_QUEUE_ATTRIBUTE,
96 WorkflowAttribution, WorkflowNamespaceSource, WorkflowTarget,
97};
98pub use run::run;
99pub use state::ServerState;
100pub use worker::{
101 HeartbeatSweeper, HeartbeatTracker, HeartbeatUpdate, InFlightActivity, LostWorkerReport,
102 TaskLiveness,
103};