Crate agentmux_launcher

Crate agentmux_launcher 

Source

ModulesΒ§

config πŸ”’
data_dir πŸ”’
Compatibility shim around agentmux_common::DataPaths.
diag πŸ”’
event_log πŸ”’
hash πŸ”’
host_pipe πŸ”’
ipc πŸ”’
mem_supervisor πŸ”’
Memory-pressure-aware host supervision β€” P0 of docs/specs/SPEC_MEMORY_PRESSURE_SUPERVISION_2026_06_16.md.
reducer πŸ”’
saga πŸ”’
splash πŸ”’
Native pre-splash for Windows: a borderless layered popup showing the AgentMux brain logo (pulsing) on a solid dark background while CefInitialize runs (200–600 ms cold start).
splash_config πŸ”’
β€œDisable the splash” preference, resolved by the launcher before it spawns the splash (and before the host/srv exist), per SPEC_SPLASH_USERINFO_AND_DISABLE_2026_06_21.md Β§6.
splash_font πŸ”’
splash_info πŸ”’
Identity shown in the splash footer: user@host and v<version> (+ a dev label on non-stable builds). Gathered once in the launcher and handed to each platform’s splash backend, so the three render identical content.
splash_text πŸ”’
Software text blitter for the splash footer β€” shared by the Linux software buffers (splash_linux) and the Win32 layered-window DIB (splash.rs). macOS uses native NSTextField instead, so it does not use this module.
srv_spawner πŸ”’
state πŸ”’
wrr πŸ”’

StructsΒ§

JobHandle πŸ”’
Owns a Windows Job Object handle. CloseHandle on drop. The job’s JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag means closing the last handle terminates every assigned process β€” which is what we want as a backstop if this launcher dies abruptly.

EnumsΒ§

ForwardError πŸ”’
Phase B.6 (post-fix) β€” forward an open_new_window request to the already-running host and let this launcher exit 0.

ConstantsΒ§

HOST_RESTART_BUDGET πŸ”’
Phase 1 host supervision (spec docs/specs/SPEC_SERVICE_SUPERVISION_AND_RECOVERY_2026_05_20.md): on an abnormal host exit the launcher relaunches the host, but at most HOST_RESTART_BUDGET times within HOST_RESTART_WINDOW β€” a crash budget so a deterministic crash cannot spin forever (spec Β§10-A). Shared by the Windows (run_windows) and Unix (run_unix) supervisors.
HOST_RESTART_WINDOW πŸ”’

FunctionsΒ§

create_job_object πŸ”’
Create a Job Object J0 with KILL_ON_JOB_CLOSE. Caller assigns processes to it via srv_spawner::assign_pid_to_job(pid, job).
dirs_fallback_home πŸ”’
Home dir without depending on dirs for THIS specific lookup. Kept to avoid a dirs dep cycle from log() β€” log() is called from data_dir::resolve_paths via failure paths, and we want it to work even if dirs itself is mid-failure.
find_cef_binary πŸ”’
Find the CEF host binary in the runtime directory. Tries versioned name first (agentmux-X.Y.Z.exe), then the old agentmux-cef-X.Y.Z.exe pattern for backwards compat, then plain agentmux-cef.exe (dev mode).
forward_open_new_window πŸ”’
launcher_main πŸ”’
log πŸ”’
Append a timestamped line to ~/.agentmux/logs/agentmux-launcher.log. Best-effort β€” silently no-ops if the log dir doesn’t exist yet.
main πŸ”’
Process entry point. suppress_os_crash_dialogs() runs FIRST β€” before the Tokio runtime is built. The runtime is built explicitly here (rather than via #[tokio::main], whose generated wrapper would construct it before any of our code runs) so a fault during runtime construction can’t surface the Windows crash modal either. Spec: docs/specs/SPEC_SERVICE_SUPERVISION_AND_RECOVERY_2026_05_20.md.
resume_main_thread πŸ”’
Resume the (single) main thread of a CREATE_SUSPENDED process.
run_windows πŸ”’
Windows main flow: resolve paths β†’ create J0 β†’ spawn srv β†’ spawn host with srv endpoints in env β†’ supervised wait β†’ cleanup.
show_fatal_dialog πŸ”’
Show a modal error dialog before the launcher exits. Used for genuine bind failures (NOT the β€œalready running” path β€” that silently forwards via forward_open_new_window). Without this, the launcher exit is silent (it has the windows subsystem in release, so eprintln! goes nowhere).
spawn_host_supervised πŸ”’
Spawn the CEF host suspended, assign it to the launcher’s Job Object, and resume it. Returns the running child, or None if any step failed β€” the caller decides (fatal on first launch, give-up on a restart). splash_event is passed on every launch β€” including restarts β€” so a relaunched host can still dismiss a splash left pending by a host that crashed pre-first-frame. disable_gpu is the retry ladder’s rung-2 degraded mode (spec Β§7): when set the host is launched with --disable-gpu (software rendering).
splash_selftest πŸ”’
--splash-selftest: show the splash with no srv/host behind it, hold it for a few seconds (or AGENTMUX_SPLASH_HOLD_MS), then exit. A demo/dev affordance for eyeballing the footer + centering without launching the whole app.
suppress_os_crash_dialogs πŸ”’
Suppress the Windows β€œApplication Error” / WER crash dialog so an unhandled fault terminates the process immediately instead of wedging it behind a modal. No-op off Windows. Spec: docs/specs/SPEC_SERVICE_SUPERVISION_AND_RECOVERY_2026_05_20.md.