Expand description
Server bootstrap sequence, extracted from main().
Each function here corresponds to one (or a small cluster of) the
numbered phases that used to live inline in async fn main():
crash-monitor branch -> parent-process watchdog -> logging init ->
PATH enrichment -> CLI/config parsing -> data-dir + migration setup ->
DB/store opening -> event bus + subagent watcher + background task
spawns -> TCP listener binds -> router/AppState build -> ESTART stderr
emission -> stdin-watch thread -> SIGINT/SIGTERM handler.
This module is purely a relocation of that logic into named functions;
main() calls them in the same order with the same effect.
Re-exportsΒ§
pub use watchers::*;pub use logging::*;pub use stores::*;pub use background::*;pub use network::*;pub use plumbing::*;pub use shutdown::*;pub use delivery::*;pub use state_services::*;
ModulesΒ§
- background π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
- carry_
forward π - A new version starts with the data of the version before it
(
docs/specs/SPEC_UPGRADE_FOR_USERS_AND_AGENTS_2026_10_15.mdΒ§6). - delivery π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
- logging π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
- messaging_
bridges π - The messaging bridges (Discord, Telegram, Slack, WhatsApp) started once the settings are
loaded, one function each. Moved out of
spawn_background_subsystemswithout a change in behaviour. - network π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
- plumbing π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
- shared_
guard π - Two AgentMux installs of different versions must not write the shared stores together.
- shared_
root π - A srv given a data folder of its own must not write into the real shared folder by accident.
- shutdown π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
- state_
services π - What
app_mainstarts once the app state exists, in the order it started them: the hooks that let an agent be reached and resumed, the job run ledger and the cron scheduler, the sagas an earlier run left unresolved, and the services that run beside the server. Moved out ofapp_mainwithout a change in behaviour. - store_
attach π - The steps of
open_stores_and_migratethat attach the registries and open each store, one function each, in the order they ran. Moved out of that function without a change in behaviour. - store_
boot π - The steps of
open_stores_and_migratethat prepare the data folder, seed the first launch and install the key resolvers. Moved out of that function without a change in behaviour. - stores π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
- watchers π
- Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
MacrosΒ§
- eprintln_
lossy π eprintln!that canβt panic. srvβs stderr is a pipe the launcher reads, so once the launcher is gone a write fails with EPIPE (Rust ignores SIGPIPE), andeprintln!panics on a failed write. On the paths that must run when the launcher has died, the parent and stdin watchers, that panic killed the watcher thread before it could shut srv down, which left srv running with no launcher, holdingsrv.lock, so the app could not be opened again.