Repository navigation
cables.gl PCHI relay — HTTP/WebSocket translation for a browser-sandboxed tool - #10
Merged
Merged
Conversation
Third PCHI integration this session, alongside Resolume (#3) and TiXL (#6, #8). cables.gl (https://github.com/cables-gl/cables, 562-star open-source browser-based node/patch tool) runs in a browser sandbox, which can't open the raw UDP socket the Conductor's control-update path requires — so unlike TiXL's native operators, this needs a relay: HTTP in (cables can always fetch()) -> raw JSON-over-UDP out to the Conductor, and the Conductor's real governance-event WebSocket -> relayed straight through to a WebSocket server cables can connect to directly. The governance-telemetry leg needed zero new protocol work: confirmed from a real official example (cables-gl/websocket-example) that cables already ships a working WebSocket-receive op against a plain `ws` server — this relay's cables-facing WS server is deliberately that same shape, not something invented for this integration. Requires #5 (WS accept-loop fix) on the Conductor for governance telemetry; control updates work regardless. ## A real mistake found and fixed along the way Building this surfaced that the Heartbeat-exclusion fix (originally meant to land in #5) had never actually made it into main — I'd pushed it as a second commit onto that PR's branch and reported it as included, but the merged PR only ever contained the first commit. Live-testing this relay reproduced the exact duplicate-DENY bug the fix was supposed to have eliminated. Re-landed as #9, cherry-picked cleanly, re-verified live against this relay specifically (22s, 4+ heartbeat cycles, 1 receipt instead of 5) before writing this commit. ## Verification Live, both directions, against a real Conductor: - Outbound: a real POST (with an Origin header, and an explicit OPTIONS preflight check with Access-Control-Request-* headers — not just a bare curl a browser's CORS enforcement wouldn't accept) reaches the Conductor and is applied. - Inbound: a real DENY is broadcast by the Conductor, relayed, and arrives at a real external WS client with the documented enriched shape (flattened gate_state/receipt_id/tool plus the full raw event). Not tested against real cables.gl itself — the WebSocket-receive shape is confirmed from a real official example; the HTTP-request op and message parsing on the cables side are not independently confirmed the way TiXL's operators were confirmed against real compiled source. README states this plainly. Co-Authored-By: Claude Sonnet 5 <[email protected]>
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third PCHI integration this session, alongside Resolume (#3) and TiXL (#6, #8). cables.gl (562-star open-source browser-based node/patch tool) runs in a browser sandbox — no raw UDP, which is what the Conductor's control-update path requires. Unlike TiXL's native operators (#8), this needs a relay:
The governance-telemetry leg needed zero new protocol work: confirmed from a real official example (cables-gl/websocket-example) that cables already ships a working WebSocket-receive op against a plain
wsserver. This relay's cables-facing WS server is deliberately that same shape.Requires #5 on the Conductor for governance telemetry; control updates work regardless.
A real mistake found and fixed along the way
Building this surfaced that the Heartbeat-exclusion fix — originally meant to land in #5 — had never actually made it into
main. I'd pushed it as a second commit onto that PR's branch and reported it as included; the merged PR only ever contained the first commit (confirmed via the GitHub API:commitCount: 1). Live-testing this relay reproduced the exact duplicate-DENY bug the fix was supposed to eliminate. Re-landed as #9 (please merge that one too, or first — this PR doesn't depend on it, but the bug it fixes is real and currently live onmain).Test plan
POST /pchi/control, with an explicitOPTIONSpreflight check (Access-Control-Request-Method/-Headers, exactly what a browser sends before a JSON POST — not just a barecurlthat skips CORS enforcement entirely) — both return the rightAccess-Control-Allow-*headers, and the actual update reaches the Conductor and is applied.🤖 Generated with Claude Code