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