# Corrosion Host Agent Rust rewrite of the Go companion agent (`companion-agent/`, retained as the behavior reference until parity). One agent per machine supervises every game instance on that host — Rust, Conan Exiles, Soulmask, Dune: Awakening. - **Wire protocol**: see [PROTOCOL.md](./PROTOCOL.md) (v2, instance-scoped subjects) - **Config**: see [agent.example.toml](./agent.example.toml) ## Status — Phase 0 - [x] Multi-instance TOML config + env overrides (`CORROSION_LICENSE_ID`, `CORROSION_NATS_URL`, `CORROSION_NATS_TOKEN`) - [x] NATS connection (infinite reconnect, capped backoff, 30s ping, offline send-buffering, `tls://` support) - [x] Host heartbeat with real telemetry (sysinfo: CPU, memory, disks) — no fabricated values - [x] Connectivity prober (outbound TCP, periodic + on-demand) - [x] Host command channel (`ping`, `probe`, `sysinfo`) - [x] Graceful shutdown (cancellation token, going-offline beacon, NATS flush) - [x] Phase 1a: process supervision — per-instance start/stop/restart/status over `{instance}.cmd` request-reply, push state events on `{instance}.status`, crash detection with exit codes, live state in heartbeats (integration-tested with real processes + live-NATS contract test) - [ ] Phase 1b: RCON trait (WebRCON rust / TCP conan+soulmask), SteamCMD, jailed file manager - [~] Phase 2: Dune Docker adapter — **compose lifecycle done** (`docker compose up -d/stop/restart` via the `Supervisor` trait + `DockerComposeSupervisor`); RabbitMQ admin bus + Postgres admin surface deferred. Container crash-detection + state adoption on agent restart land with Phase 3b. - [x] Phase 3a: SIGNED self-update — minisign-verified download+swap+relaunch (NATS `update` func); embedded public key; CI signs releases - [ ] Phase 3b: service install (systemd/SCM), PID adoption ## Build ```bash cargo build --release # native cargo build --release --target x86_64-unknown-linux-gnu # linux deploy target cargo build --release --target x86_64-pc-windows-msvc # windows (cargo-xwin on non-Windows) ``` ## Run ```bash corrosion-host-agent --config ./agent.toml # foreground corrosion-host-agent --config ./agent.toml check # validate config only corrosion-host-agent version # semver + git hash + build ts ```