// Lifecycle owner for the `omlx serve` child process. // // State machine // stopped ─start()→ starting ─/health 200→ running ─/health fail×3→ unresponsive // │ │ ↑ │ // │ │ └─/health or status OK──┘ // │ │ // │ └─process exit → auto-restart // └─process exit during startup → auto-restart // // stop() : * → stopping → SIGTERM → wait ≤10s → SIGKILL → stopped // forceRestart() : * → SIGKILL → start() // crashes : auto-restart with 5s/10s/20s backoff, max 3 attempts, counter // resets after 60s of stable .running // // Spawn invocation: // -m omlx.cli serve --base-path --port // stdout+stderr → ~/Library/Application Support/oMLX/logs/server.log // PATH = parent + Homebrew prefixes // // Dev override: OMLX_DEV_SERVER_SCRIPT spawns