pub async fn run_daemon<D: DaemonDispatch>(dispatcher: D) -> Result<()>Expand description
Run the daemon: bind the socket, warm in the background, serve request frames until SIGTERM/SIGINT.
Fatally acquires its own startup lock. This only protects
cleanup→bind→pid-write; by the time this function runs, dispatcher (a
DaemonDispatch built from a KhiveMcpServer) has already run
migrations and applied pack schema plans while constructing itself,
unguarded. Production boot must go through
run_daemon_with_boot_guard instead, which extends the same lock back
over that construction step. This entry point remains for callers (and
tests) that build the dispatcher and start serving as one atomic step with
no separate boot-guard window to protect — but it still acquires the boot
guard fatally (never proceeds unguarded), so the cleanup→bind→pid-write
race surface is always mutually excluded.