feat: M2 — management REST API with OpenAPI doc (control-pane groundwork)

A versioned control-plane REST API (/api/v1) on its own port (default
127.0.0.1:47990) serving host info, runtime status, paired-client
management, the pairing PIN flow, and session control (stop / force-IDR).
The OpenAPI 3.1 document is generated from the handlers by utoipa, served
live at /api/v1/openapi.json (+ Scalar docs at /api/docs), printable via
`lumen-host openapi`, and checked in at docs/api/openapi.json for client
codegen — a test fails if it drifts, mirroring the cbindgen header rule.

Auth: optional bearer token (--mgmt-token / LUMEN_MGMT_TOKEN), enforced on
everything but /health, and mandatory for non-loopback binds. PinGate
gains a waiter count so the API can report pin_pending; logs moved to
stderr so stdout stays machine-readable. Supersedes the web.rs stub.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-09 21:35:43 +00:00
parent 22a982a1cb
commit a339a0466e
10 changed files with 1862 additions and 49 deletions
+6 -2
View File
@@ -34,13 +34,17 @@ bash crates/lumen-core/tests/c/run.sh # standalone C-ABI link + round-trip pro
`include/lumen_core.h` is generated from `crates/lumen-core/src/abi.rs` by cbindgen
(`build.rs`) on every build and is **checked in**; CI fails if it drifts, so commit the
regenerated header when the ABI changes.
regenerated header when the ABI changes. Same deal for the management API's OpenAPI
document: `docs/api/openapi.json` is **checked in** for client codegen and a test fails if
it drifts — regenerate with `cargo run -p lumen-host -- openapi > docs/api/openapi.json`
(the spec lives in `crates/lumen-host/src/mgmt.rs`).
## Layout
```
crates/lumen-core/ protocol · FEC · pacing · crypto — the C ABI (lib + cdylib + staticlib)
crates/lumen-host/ Linux host: vdisplay · capture · encode · inject · web · pipeline (cfg-gated)
crates/lumen-host/ Linux host: vdisplay · capture · encode · inject · gamestream · mgmt · pipeline
docs/api/openapi.json generated management-API spec (codegen input)
crates/lumen-client-rs/ reference client (M4)
tools/{loss-harness,latency-probe}/ measurement (plan §10)
clients/{apple,android}/ native client scaffolds (import lumen_core.h)