#!/usr/bin/env node /** * Local test console server: one process that serves the console UI, holds * the operator's saved credentials, and drives test runs with live status. * * Launched via `bun run test:console`. Binds 127.0.0.1 only — it holds raw * API keys and can execute repo code, so it must never listen on a routable * interface; there is deliberately no auth layer beyond that. The browser * gets presence/suffix hints for saved secrets, never the values. * * Surface: * GET / console UI (ui/index.html, self-contained) * GET /api/state registry + connections + run snapshot + history * GET /api/events SSE stream of run/task/log events * POST /api/connections/:id save credential values DELETE — remove * POST /api/connections/:id/verify live probe * POST /api/gates toggle an opt-in gate * POST /api/run start a run {mode, lane, labels?, concurrency?} * POST /api/run/cancel cancel the active run * GET /api/runs/:id/log?task=