Skip to main content

subc_daemon/
lib.rs

1//! subc daemon core.
2//!
3//! This crate owns the loopback TCP transport and the thin splice-router core:
4//! routing decisions are made from the 21-byte envelope header, while message
5//! bodies are carried as opaque bytes and are never deserialized by the router.
6
7#![forbid(unsafe_code)]
8
9mod activity;
10/// `app.open` starts a known operator app from its installed location. See
11/// the module for the ordered decision, the launch table, and the platform
12/// launchers.
13pub mod app_open;
14mod bind_compat;
15pub mod bootstrap;
16pub mod caller_identity;
17pub(crate) mod capability_requirements;
18mod child_resources;
19mod child_roster;
20mod clock;
21pub mod control;
22pub mod daemon_config;
23#[cfg(test)]
24pub(crate) mod dispatch_spike;
25pub mod fleet_lint;
26pub mod forwarding;
27pub mod identity;
28mod live_children;
29pub mod local_listener;
30pub mod machine_id;
31pub mod observability;
32pub mod operator_apps;
33pub mod operator_confirm;
34pub mod privileged_prompt;
35#[allow(dead_code)]
36mod provenance;
37pub mod registry;
38mod route_outage;
39pub mod router;
40mod run_dir_lock;
41mod scopes;
42pub mod server;
43pub mod stderr_tail;
44mod subtree_resources;
45pub mod supervise;
46mod systemd_kill_mode;
47mod terminal_journal;
48pub mod terminal_ring;
49pub mod watchdog;
50
51#[cfg(feature = "bench-harness")]
52pub mod bench_harness;
53
54pub use control::{ControlHandler, MIN_SUPPORTED_VERSION};
55pub use forwarding::{ForwardingError, ForwardingTable, ModuleEndpointId};
56// The frame codec now lives in its natural homes: the `Frame` data type in
57// subc-protocol (pure, with the envelope it accompanies) and the async I/O loop
58// in subc-transport (with the authenticated stream). Re-exported here for
59// callers that use the daemon library to build and exchange frames.
60pub use control::{
61    DEFAULT_ROUTE_BIND_BREAKER_COOLDOWN, DEFAULT_ROUTE_BIND_BREAKER_THRESHOLD,
62    DEFAULT_ROUTE_BIND_RELAY_TIMEOUT,
63};
64pub use identity::{IdentityError, ProjectRootId, RequestIdentity, SessionId};
65pub use observability::{ConnectedClients, DaemonCounters};
66pub use registry::{ChannelState, ConnectionId, ModuleRegistration, Registry, RegistryError};
67pub use router::{
68    Backend, EchoBackend, ForwardBackend, FrameSink, RouteCtx, Router, RouterConnection,
69    RouterError,
70};
71pub use server::{
72    handle_connection, serve_listener, serve_listeners, serve_local_listener, ConnectionError,
73    ServerAuth, ServerError, DEFAULT_AUTH_DEADLINE, DEFAULT_MAX_UNAUTHENTICATED_CONNECTIONS,
74};
75pub use subc_protocol::{Frame, FrameBuildError};
76pub use subc_transport::{read_frame, write_frame, FrameIoError, ReadStage};
77pub use supervise::{
78    ExitKind, ExitReport, HealthAction, HealthConfig, ModuleHealthStatus, ModuleOverlap,
79    ModuleProcessLiveness, ModuleSpec, ModuleState, ModuleStatus, RestartPolicy, SuperviseError,
80    SupervisedModule, Supervisor, SupervisorHandle, SupervisorProcessLiveness, SwapFailureArm,
81    SwapRefusal, DEFAULT_DRAIN_TIMEOUT, DEFAULT_SWAP_READY_TIMEOUT, SPAWN_ROLE_SWAP_CANDIDATE,
82    SUBC_ARG, SUBC_SPAWN_ROLE_ENV,
83};
84pub use watchdog::{
85    DaemonSelfWatchdog, DaemonSelfWatchdogConfig, WatchdogStage, WatchdogTickError,
86    DEFAULT_SELF_WATCHDOG_DEADLINE, DEFAULT_SELF_WATCHDOG_INTERVAL,
87};