- kurgan/hw/protocol.py: newline-delimited JSON between the app and the
coming kurgan.hw service. Requests {"op", "args", "id"}; replies {"id",
"ok", "result"|"error": {"code", "message"}}. Operations: hello (protocol
and service versions; required first on every connection), state,
set_profile, set_ram_lighting, and ram_chase, which carries the app's chase
clock so the RAM stays in step with the case fan and GPU chases.
- Strict: a 64 KiB line cap (an oversized line closes the connection),
unknown operations and fields, missing or mistyped arguments, NaN and
Infinity, duplicate keys and deep nesting are all rejected. Profiles and RAM
modes are checked against the same lists the web API uses, on both sides:
the client encodes through the same checks before sending.
- Session: one connection's state machine (hello first, a version mismatch is
answered then closed, operation errors map to invalid/unavailable/internal,
a reply that can't be encoded is an internal error, not a dead connection).
- Tests: 15 new (malformed, oversized and unknown input, version mismatch).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>