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/// The release changelog embedded in the binary, serving the console's
39/// "What's new" panel: what changed in the version this server RUNS, never a
40/// file read from disk.
41pub mod changelog;
42/// SS-5b automatic multi-node failover detection (cluster supervisor). Only
43/// meaningful for a distributed (`[store.cluster]`) boot; dormant otherwise.
44pub mod cluster;
45/// WS3 cluster topology/ownership broadcast publisher. The ops console's cluster
46/// channel is served on every boot, showing calm state with no peers on a
47/// single-node server.
48pub mod cluster_publisher;
49/// Runtime configuration loading and validation.
50pub mod config;
51pub mod control;
52/// Durable record of what killed the server process on paths that never
53/// reach the graceful-shutdown log.
54pub mod death_note;
55/// Operator deploy surface authorization.
56pub mod deploy;
57/// Local dev-server surface: trigger a run, stream it over the existing
58/// firehose, mock a named activity per-run, and replay a failed run — all over
59/// the real engine, store, and event stream.
60pub mod dev_ui;
61/// Server error and stream-failure types.
62pub mod error;
63/// Descriptor-relative filesystem confinement for sensitive server roots.
64pub(crate) mod filesystem;
65/// Engine-internal workflow filtering for enumeration surfaces.
66/// The Model Context Protocol surface (2026-07-28 stateless revision): the
67/// tool catalog, the tool implementations, and the `/mcp` mount.
68pub mod mcp;
69/// Namespace resolution and authorization guard types.
70pub mod namespace;
71/// Health, metrics, and tracing support.
72pub mod observability;
73/// Ops-console asset serving helpers.
74pub mod ops_console;
75/// Distributed request routing: the gRPC-edge availability layer over the fence.
76pub mod routing;
77/// Server run loop: configuration load, transports, and graceful shutdown.
78pub mod run;
79/// Cooperative shutdown and drain handling.
80pub mod shutdown;
81/// Shared server state construction and access.
82pub mod state;
83/// The process-wide count of opens the server issues through its held
84/// directory capabilities — the instrument behind the boot-cost pin (a boot
85/// over a million object files must not open a million files).
86pub use filesystem::{capability_opens, reset_capability_opens};
87/// The operator walk that brings a pre-0.12.1 store's files to their private
88/// modes (`aion store harden`).
89pub mod store_harden;
90/// WebSocket event-streaming support.
91pub mod stream;
92/// Umask-independent temporary directories for tests that exercise
93/// private-root validation.
94#[cfg(test)]
95pub(crate) mod test_support;
96/// The transcript serving boundary's reconstruction of compacted provider
97/// envelopes, shared by every surface that serves a transcript.
98pub(crate) mod transcript_resolve;
99/// The built-in manual-only update check: embedded document, boot install,
100/// completed-check recording, and the served last-check state.
101pub mod update_check;
102/// Remote-worker registry, heartbeat, and dispatch support.
103pub mod worker;
104
105pub use build_identity::BuildIdentity;
106pub use config::ServerConfig;
107pub use deploy::DeployGuard;
108pub use dev_ui::{ActivityMockRegistry, DevMockingDispatcher, MockedActivity};
109pub use error::{ServerError, StreamFailure};
110pub use mcp::{AionToolService, McpRuntime};
111pub use namespace::{
112 CallerIdentity, DISPLAY_NAME_ATTRIBUTE, GRANT_WORDS, GrantWord, NAMESPACE_ATTRIBUTE,
113 NamespaceGuard, NamespaceMinter, NamespaceOperation, NamespaceResolver,
114 ScheduleNamespaceSource, ScheduleTarget, ScopedEngine, StaticScheduleNamespaces,
115 StaticWorkflowNamespaces, SubscriptionScope, TASK_QUEUE_ATTRIBUTE, WorkflowAttribution,
116 WorkflowNamespaceSource, WorkflowTarget, require_grant,
117};
118pub use run::run;
119pub use state::ServerState;
120pub use worker::{
121 HeartbeatSweeper, HeartbeatTracker, HeartbeatUpdate, InFlightActivity, LostWorkerReport,
122 TaskLiveness,
123};