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;
14pub mod bootstrap;
15pub mod caller_identity;
16pub(crate) mod capability_requirements;
17mod child_resources;
18mod child_roster;
19mod clock;
20pub mod control;
21pub mod daemon_config;
22#[cfg(test)]
23pub(crate) mod dispatch_spike;
24pub mod fleet_lint;
25pub mod forwarding;
26pub mod identity;
27mod live_children;
28pub mod local_listener;
29pub mod machine_id;
30pub mod observability;
31pub mod operator_apps;
32pub mod operator_confirm;
33pub mod privileged_prompt;
34#[allow(dead_code)]
35mod provenance;
36pub mod registry;
37mod route_outage;
38pub mod router;
39mod run_dir_lock;
40mod scopes;
41pub mod server;
42pub mod stderr_tail;
43pub mod supervise;
44mod systemd_kill_mode;
45mod terminal_journal;
46pub mod terminal_ring;
47pub mod watchdog;
48
49#[cfg(feature = "bench-harness")]
50pub mod bench_harness;
51
52pub use control::{ControlHandler, MIN_SUPPORTED_VERSION};
53pub use forwarding::{ForwardingError, ForwardingTable, ModuleEndpointId};
54// The frame codec now lives in its natural homes: the `Frame` data type in
55// subc-protocol (pure, with the envelope it accompanies) and the async I/O loop
56// in subc-transport (with the authenticated stream). Re-exported here for
57// callers that use the daemon library to build and exchange frames.
58pub use control::{
59    DEFAULT_ROUTE_BIND_BREAKER_COOLDOWN, DEFAULT_ROUTE_BIND_BREAKER_THRESHOLD,
60    DEFAULT_ROUTE_BIND_RELAY_TIMEOUT,
61};
62pub use identity::{IdentityError, ProjectRootId, RequestIdentity, SessionId};
63pub use observability::{ConnectedClients, DaemonCounters};
64pub use registry::{ChannelState, ConnectionId, ModuleRegistration, Registry, RegistryError};
65pub use router::{
66    Backend, EchoBackend, ForwardBackend, FrameSink, RouteCtx, Router, RouterConnection,
67    RouterError,
68};
69pub use server::{
70    handle_connection, serve_listener, serve_listeners, serve_local_listener, ConnectionError,
71    ServerAuth, ServerError, DEFAULT_AUTH_DEADLINE, DEFAULT_MAX_UNAUTHENTICATED_CONNECTIONS,
72};
73pub use subc_protocol::{Frame, FrameBuildError};
74pub use subc_transport::{read_frame, write_frame, FrameIoError, ReadStage};
75pub use supervise::{
76    ExitKind, ExitReport, HealthAction, HealthConfig, ModuleHealthStatus, ModuleOverlap,
77    ModuleProcessLiveness, ModuleSpec, ModuleState, ModuleStatus, RestartPolicy, SuperviseError,
78    SupervisedModule, Supervisor, SupervisorHandle, SupervisorProcessLiveness, SwapFailureArm,
79    SwapRefusal, DEFAULT_DRAIN_TIMEOUT, DEFAULT_SWAP_READY_TIMEOUT, SPAWN_ROLE_SWAP_CANDIDATE,
80    SUBC_ARG, SUBC_SPAWN_ROLE_ENV,
81};
82pub use watchdog::{
83    DaemonSelfWatchdog, DaemonSelfWatchdogConfig, WatchdogStage, WatchdogTickError,
84    DEFAULT_SELF_WATCHDOG_DEADLINE, DEFAULT_SELF_WATCHDOG_INTERVAL,
85};