Render node fleet management.
Release-line note: v2.0.30 exists on
releases.experiencenet.combut not in git — it was a phantom build accidentally produced from a misplacedv2.0.30tag (intended forhydraheadflatscreen) that was deleted seconds later, after CI had already cut a binary. The v2.0.30 binary is byte-identical to v2.0.26. v2.0.31 is the next clean release-line version on master and supersedes both.
| Resource | Value |
|---|---|
| Server | hydracluster.experiencenet.com (46.224.29.125) |
| Config | /root/.hydracluster/config.yaml |
| Data | /root/.hydracluster/nodes.yaml |
| Service | systemctl status hydracluster |
| Logs | journalctl -u hydracluster -f |
HydraCluster manages render node enrollment, provisioning, and monitoring. Render nodes are Windows machines running LarkXR Standalone (cloud rendering). They are enrolled via a web UI and managed through the node agent (hydranode).
/enroll, admin assigns roles and venues. The form accepts optional ?name= and ?ip= URL params (pre-filled by HydraNeck's Enrol button for admin-initiated remote enrolment — the submitted ip field overrides the request's remote address so the correct device IP is stored). Windows, Linux, and macOS enrollment also offers a HydraGuard network selector. The default remains the legacy wg0 mesh; a selection is explicit and stored as network_segment_id.ssh root@hydracluster.experiencenet.com
# or
ssh root@46.224.29.125
curl -s https://hydracluster.experiencenet.com/api/v1/health
HydraCluster fetches the authenticated catalog from
https://hydraguard.experiencenet.com/api/v1/network-segments and renders only
the non-secret metadata. Each option includes HydraGuard's resolved endpoint and
UDP port. The HydraGuard token never reaches the browser or node.
network_segment_id calls the existing /api/v1/air/provision or
/api/v1/gateway/provision endpoint and preserves the legacy wg0 behavior./api/v1/network-segments/{id}/air/provision or
/api/v1/network-segments/{id}/venue/provision.route_lan: false; moving a venue LAN
route remains a separate operator cutover.Admin API helpers:
GET /api/v1/network-segments
POST /api/v1/nodes/{id}/network-segment
{"network_segment_id":"experiencenet.bxl1"}
The admin UI includes a real-time event stream at /admin/events (requires admin login). All significant cluster events — eligible body discovery, sunshine PIN submissions, stream start/stop, head status changes — appear here as they happen, colour-coded by type.
Use this first when debugging iPad/kiosk pairing and streaming issues. It is faster than SSHing in and tailing journalctl.
eligible_bodies: body discovery ran; shows count and names foundsunshine_pin: PIN was submitted to a body's Sunshine; green = accepted, red = failedstream_start: head started streamingstream_stop (Success: true): stream ended cleanly — either the body self-reported idle (Sunshine closed after Moonlight disconnect) or an operator/head issued a stopstream_stop (Success: false): stream ended uncleanly — body went offline while streaming, or an operator stop failedterminate_pending (Success: true): iPad tapped exit; body will receive TerminateStream on its next heartbeat (≤5 s)terminate_pending (Success: false): session watchdog fired (body heartbeat silent >60 s, or head-only heartbeat silent >120 s); body will receive TerminateStream on next heartbeatstream_stop is emitted for every session close that had an active session record: body self-reports idle, body goes offline mid-stream, admin stop, iPad cancel, and flatscreen stop. It is NOT emitted as a duplicate if the session was already closed by a prior path (e.g. iPad cancel closes the session immediately; when the body then reports idle, no second event fires).
The SSE endpoint (GET /api/v1/events/stream) is also accessible directly with an admin bearer token — useful for scripted monitoring. The server buffers the last 200 events; new connections receive the full buffer before live events begin.
The providers: map in /root/.hydracluster/config.yaml is keyed by district
ID. Each entry carries the Sunshine API credentials a body in that district
uses for its own management calls:
providers:
bxl1:
provider: sunshine
username: sunshine
password: <redacted>
head_service_url: https://hydracluster.experiencenet.com
A district with no entry of its own inherits from the district it was carved
out of, walking outwards one - segment at a time, so bxl1-mercator-39
falls back to bxl1-mercator and then to bxl1. An exact entry always wins,
so a district needing different credentials still gets them by being listed.
The inheritance is logged: [provider-config] district X has no entry, inheriting from Y.
The map is read once, at startup. There is no SIGHUP or file watch, so a
change needs systemctl restart hydracluster.
SunshineUsername and SunshinePassword are omitempty in BodyConfig. When
the three per-head districts bxl1-mercator-35/37/39 were carved out of bxl1
without entries of their own, the two keys did not arrive as empty strings, they
vanished from the config each body received, with nothing to read as an error.
hydrabody then called the Sunshine API with no auth header at all, Sunshine
answered 401, and the hydrabody watchdog read that as a hung video thread and
killed every session about 26 seconds in. Video and audio were flowing the whole
time. All three bodies reported sunshine_api_unreachable for six weeks while
looking otherwise healthy.
Two things follow for anyone carving out a district:
providers: in the same change if it needs its own credentials.
Otherwise confirm the ancestor it will inherit from is the right one.config_cache.yaml is moved aside and
the HydraBody scheduled task is restarted. A forced reprovision is not a
substitute: it stops Sunshine before a download that currently 404s, and
leaves the body with no provider at all.A body reporting any provider_status that begins sunshine_api_ raises the
sunshine_unreachable event on the transition. hydrabody distinguishes
sunshine_api_unreachable (no answer, possibly hung), sunshine_api_unauthorized
(answered 401 or 403, so it is running and the credentials are wrong) and
sunshine_api_error (any other non-2xx). Match the prefix, never one literal.
https://hydracluster.experiencenet.com/admin/events first — the stream going dead confirms the service is down.ssh root@46.224.29.125systemctl status hydraclusterjournalctl -u hydracluster --since '10 min ago' --no-pagersystemctl restart hydraclusterIf POST endpoints (e.g. /api/v1/nodes/{id}/exec) start hanging with 0 bytes received while GETs still respond, and the journal shows lots of GETs but no recent POSTs to the slow endpoint, suspect an auth-middleware self-deadlock.
This was the v2.0.32 → v2.0.33 regression: requireAdminOrNodeToken used defer s.mu.Unlock() and then called next(). The downstream heads handlers (handleListHeads et al.) also acquired s.mu → non-reentrant mutex → goroutine deadlocked on its own lock → mutex pinned → every other lock acquirer queued forever. hydranode's network-recovery routine on the same box then misread the wedged API as a network failure and rebooted the cluster.
Rule for any new server middleware:
s.mu.Lock() briefly inside a middleware to look something up.s.mu BEFORE calling next(). Do NOT hold it via defer across a handler invocation. Downstream handlers do their own locking.requireNodeToken survives this rule only because every handler it wraps (handleBodyHeartbeat, handleBodyShellCheck, etc.) reads node state via the nodeContext value rather than re-locking s.mu. Don't break that invariant.If you suspect this is happening live, the fingerprint in journalctl -u hydracluster is many GET /api/v1/body/shell/check lines but no recent matching POST log line for the slow request — the POST is queued waiting for the lock and never reaches its log statement.
HydraCluster supports two exec modes for running commands on body machines.
Commands are sent as JSON via the API, executed directly by the node agent (PowerShell on Windows, bash on Linux), with clean stdout/stderr separation and proper exit codes. No PTY involved.
# Basic command
hydracluster exec <nodeId> "Get-Process | Select-Object -First 5"
# With timeout
hydracluster exec <nodeId> "choco list --local-only" --timeout 60s
# From a local file (avoids all shell escaping)
hydracluster exec <nodeId> --file ./setup.ps1
# JSON output (for scripting)
hydracluster exec <nodeId> "hostname" --json
The command is queued on the server and picked up by the node agent on its next heartbeat (up to 30 seconds). The CLI polls for the result until it arrives or the timeout expires.
status fieldAnything that calls the API directly instead of using the CLI has to
reimplement the poll, and the shape is easy to get wrong. The canonical
implementation is runExec in internal/cli/cluster/shell.go; match it.
POST /api/v1/nodes/{id}/exec answers {"id":"exec-..."}. Then poll
GET /api/v1/nodes/{id}/exec/{execId}/result and branch on the HTTP status
code:
| Status | Meaning | Do |
|---|---|---|
202 Accepted |
Queued or in flight | Keep polling |
404 Not Found |
Not yet picked up by the agent | Keep polling, this is NOT an error |
200 OK |
Finished | Read the body |
| anything else | Real failure | Stop and report it |
404 is a pending state, not a failure. A poller that treats it as one gives up on every exec that waits for the node's next heartbeat, which can be up to 30 seconds away.
The 200 body is {"id","stdout","stderr","exit_code","duration","error"}.
There is no status field anywhere in it. A poller that waits for
.status == "complete" waits forever and then reports a timeout, while the
command itself ran correctly on the node. error describes a transport or
agent failure; a command that ran and failed reports that in exit_code and
stderr, with an empty error.
# Minimal correct poll. $SRV, $TOKEN, $NODE set by the caller.
ID=$(curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"command":"hostname","timeout":30}' "$SRV/api/v1/nodes/$NODE/exec" | jq -r .id)
for _ in $(seq 40); do
CODE=$(curl -s -m 30 -o /tmp/exec.out -w '%{http_code}' \
-H "Authorization: Bearer $TOKEN" "$SRV/api/v1/nodes/$NODE/exec/$ID/result")
case "$CODE" in
200) jq -r '.stdout // ""' /tmp/exec.out; break ;;
202|404) sleep 2 ;;
*) echo "exec failed: HTTP $CODE" >&2; cat /tmp/exec.out >&2; break ;;
esac
done
hydracluster exec --shell <nodeId> "top -bn1 | head -5" --timeout 10s
These are two distinct transports. Understanding the difference matters when the node is slow to respond or the queue is backed up.
| Async exec queue (default) | WebSocket shell (--shell) |
|
|---|---|---|
| Transport | HTTP poll: hydranode fetches commands on its tick (up to 30 s delay) | WebSocket PTY: direct connection, responds immediately |
| Queue | Commands pile up in-memory on hydracluster; processed FIFO | No queue — each --shell call opens a fresh PTY session |
| Use when | Scripting, JSON output, fire-and-forget, parallel commands | Queue is backed up; need immediate response; binary data (base64) |
| Failure mode | Times out if queue is long or hydranode stopped polling | Fails fast if WebSocket connection can't be established |
When the async queue backs up: this happens when many exec requests accumulate (e.g. after a debugging session with many rapid execs, or after a node reboot where hydranode was offline and the queue grew). The node heartbeat still arrives (node shows online) but exec results stay pending indefinitely. Switch to --shell until the queue drains.
Detecting a backed-up queue: use the queue status endpoint to see exactly what is waiting:
curl -s -H "Authorization: Bearer $ADMIN_TOKEN" \
https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/exec/queue | jq .
# {"queued": 4, "in_flight": 1, "items": [...]}
Clearing a backed-up queue: drop all pending (not yet dequeued) execs:
curl -s -X DELETE -H "Authorization: Bearer $ADMIN_TOKEN" \
https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/exec/queue | jq .
# {"cleared": 4}
To cancel a single exec by ID:
curl -s -X DELETE -H "Authorization: Bearer $ADMIN_TOKEN" \
"https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/exec/queue/<execId>" | jq .
# {"cancelled": "exec-1716123456789"}
In-flight execs (already dequeued to the agent) cannot be cancelled — only queued ones. A hydracluster restart is the nuclear option to drop in-flight execs as well.
A queue that never drains is a different fault. The paragraph above is about a backlog that clears on its own. One exec that is dequeued and never reports back is not a backlog: the worker stops taking work and does not start again, for hours, until hydranode restarts. Seen on node-50ab5309 on 2026-10-14, hydraissue #794.
It looks like this:
curl -s -H "Authorization: Bearer $ADMIN_TOKEN" \
https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/exec/queue | jq .
# {"queued": 0, "in_flight": 1, "items": []} <- empty queue, one stuck
in_flight: 1 with nothing queued, and it stays that way. Everything else about the node is healthy and says so: heartbeats every 30s, scales_reported_at fresh, every service answering, status: online, and --shell working normally. The agent log shows the request line for that exec and no matching finished line:
22:25:15 exec request exec-...13456: incus config device show hydraexperiencelibrary
22:25:15 exec exec-...13456 finished: exit_code=0 duration=32ms
22:27:33 exec request exec-...52186: for s in ...; do incus exec $s -- grep -rl ... | head -3; done
(nothing)
Note that the request's own timeout does not rescue it. The one above was 90 seconds and was still in flight 100 minutes later.
What to do:
--shell for everything on that node. It is a different websocket and is unaffected, and it is enough to deploy, edit config and restart scales.DELETE /exec/queue before you walk away. A queued exec does not expire either, so anything left behind runs whenever the worker recovers, which may be hours later and long after it was a good idea.--shell instead.What NOT to blame: a long or heavy command. The one that wedged this node was a grep across three containers of 18 to 107 MB, and no process from it was left running, so the command had finished and the agent was stuck after it.
The queue is in-memory on hydracluster — it does not survive a hydracluster restart.
Exec is for ad-hoc, one-off operations. When a workflow is used regularly by operators (stream control, status checks, etc.), the receiver binary must expose a proper named Cobra subcommand for it. Exec then invokes that named command — no curl+JSON quoting, no piped commands, no inline shell scripting.
Bad (fragile):
hydracluster exec node-X "curl -s -X POST -H 'Content-Type: application/json' -d '{\"experience\":\"mercator-talks\"}' http://127.0.0.1:9740/api/v1/stream/start"
Good (named command on the receiver):
hydracluster exec node-X "hydraheadflatscreen stream-start mercator-talks"
A named command on the binary is testable, readable, and unambiguous. If an exec command starts looking like a shell script (quoting, pipes, flags), that is a signal to add a Cobra subcommand to the receiver instead.
The exec shell does not include ~/.hydranode/bin in PATH. Always use the full binary
path when calling receiver-side commands:
# macOS and Linux kiosk heads (hydraheadflatscreen)
hydracluster exec node-X "~/.hydranode/bin/hydraheadflatscreen stream-start mercator-talks"
hydracluster exec node-X "~/.hydranode/bin/hydraheadflatscreen stream-stop"
# Disable the self-service kiosk on a head whose machine doubles as a
# workstation (agent v2.2.3+ idles instead of relaunching the kiosk UI):
curl -sk -X POST https://hydracluster.experiencenet.com/api/v1/nodes/node-X/kiosk-mode \
-H "Authorization: Bearer <admin-token>" -H "Content-Type: application/json" \
-d '{"disabled":true}'
Linux heads (Arch/omarchy) provision via recipes/hydraheadflatscreen-linux.yaml: assign the hydraheadflatscreen role and a district; the recipe installs packages, the agent binary, config, a WireGuard sudoers rule, and the systemd --user unit. See the hydraheadflatscreen runbook's "Linux heads (omarchy)" section for head-side details.
The write-config step in recipes/hydraheadflatscreen-macos.yaml writes the
head's config.yaml whole, with cat > "$HOME/.hydraheadflatscreen/config.yaml"
and the five server-supplied keys. recipes/hydraheadflatscreen-windows.yaml
does the same with WriteAllText to C:\hydraheadwindows\config.yaml. The
next step, install-service, restarts the agent. Every per-machine key in that
file is lost: local_apps, inactivity_timeout and the probe settings. The
cluster stores none of them, so nothing restores them and no warning is given.
This applies to POST /api/v1/nodes/{id}/provision/{role}, to a role
reassignment through POST /api/v1/nodes/{id}/roles, and to any rerun of the
recipe. On a head that carries local experiences (stream_mode: local tiles,
#833, #866) it takes the stand down.
Before reprovisioning such a head, copy the file off the box:
hydracluster exec <head-node> 'cat ~/.hydraheadflatscreen/config.yaml' \
--server "$HC_SERVER" --admin-token "$HC_TOKEN" --timeout 30s
Restore the per-machine keys afterwards by appending them to the newly
written file, so the fresh token and head id survive, then restart the agent.
The recovery and verification procedure is in the hydraheadflatscreen runbook
under "A reprovision wipes local_apps".
Note the delay. local_apps is read once at agent startup, so a running agent
keeps serving tiles from memory after the file has lost them. On the two FTI
stands the Mac broke in the same second as the write while the Windows head ran
a further day and broke at its next restart. A working stand right after a
reprovision is not evidence that the config survived.
| Endpoint | Auth | Purpose |
|---|---|---|
POST /api/v1/nodes/{id}/exec |
Admin | Submit command, returns {"id": "exec-..."} |
GET /api/v1/nodes/{id}/exec/{execId}/result |
Admin | Poll for result (200=done, 202 AND 404=pending, no status field) |
GET /api/v1/nodes/{id}/exec/queue |
Admin | Inspect queue: {"queued": N, "in_flight": N, "items": [...]} |
DELETE /api/v1/nodes/{id}/exec/queue |
Admin | Clear all queued (not yet dequeued) execs, returns {"cleared": N} |
DELETE /api/v1/nodes/{id}/exec/queue/{execId} |
Admin | Cancel one queued exec by ID; 404 if in-flight or already complete |
GET /api/v1/body/exec |
Node token | Agent fetches next queued command |
POST /api/v1/body/exec/result |
Node token | Agent reports result |
POST /api/v1/body/scales |
Node token | hydraskin node reports its Incus inventory (403 unless the node has the hydraskin role) |
GET /api/v1/nodes |
Admin or read-only | Node list, including scale inventory |
server.read_only_token in the config grants GET /api/v1/nodes and nothing
else. It exists so hydrascalerouter — which runs on a public-facing district
server — can read which scales claim which domains without holding a credential
that could mutate the fleet.
Scales may report a domain and endpoint, carried through verbatim on
GET /api/v1/nodes. hydracluster applies no routing policy: it does not
validate the domain or resolve conflicts between scales claiming the same one.
That belongs to hydrascalerouter, which is the only place that sees every node
at once. Both fields are capped at 253 bytes because they are node-supplied and
render into the dashboard.
Assign roles to a node via API (roles must be in the RoleCatalog):
curl -s -X POST https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/roles \
-H "Authorization: Bearer <ADMIN_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"roles": ["hydraguard-air", "hydraheadflatscreen"]}'
The node agent picks up new roles on its next provision poll and executes the matching recipe.
curl -s -X POST https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/name \
-H "Authorization: Bearer <ADMIN_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"name": "ipad-head-lobby"}'
# {"status":"ok","name":"ipad-head-lobby"}
Names must be unique across nodes that are not denied, the same rule enrollment
applies. Renaming a node to the name it already holds is a no-op, not a conflict.
Errors are 400: name is required for an empty name, node "<name>" already exists for a duplicate, node "<ID>" not found for an unknown node.
Renaming does not propagate to HydraGuard. A head iPad's WireGuard peer is created under the name the node held at provisioning time, and nothing renames it afterwards. The tunnel keeps working — WireGuard matches on public key, not name — but the two systems now disagree. If that head is later re-provisioned, hydracluster asks HydraGuard for a peer under the new name, which allocates a fresh address and orphans the old peer. Removing the orphan is a manual edit today (hydraguard #457).
Renaming is also the fix when a device enrolls under a colliding name — see Recovering a head with no WireGuard config below.
Use this to retire a node hydracluster should forget — decommissioned hardware, a device you no longer possess, or a duplicate/mis-enrolled entry.
curl -s -X DELETE https://hydracluster.experiencenet.com/api/v1/nodes/<ID> \
-H "Authorization: Bearer <ADMIN_TOKEN>"
# {"status":"ok"} — or 404 {"error":"node \"<ID>\" not found"}
Three equivalent paths, all of which do the same thing under the hood
(Store.Remove(id) + Store.Save()):
DELETE /api/v1/nodes/{id} (admin token). Use this for remote/scripted removal.hydracluster nodes remove <id>. Edits the local nodes.yaml, so it must run on the server (the store on an operator laptop is empty)./admin/nodes/{id} (session-cookie auth).What it does and does not do. Removal only deletes the node's entry from hydracluster's YAML store. It does not tear down WireGuard peers, close active sessions, uninstall the agent, or send anything to the device. Practical implications:
401 invalid token on every heartbeat (POST /api/v1/body/heartbeat
for bodies; the GET /api/v1/heads/{id} config poll for iPad/flatscreen heads) —
the store lookup by token no longer resolves. Nothing recreates the node; the
body agent's GET /api/v1/enroll/{token}/status fallback also 404s, so it just
logs failures. A deleted device cannot silently rejoin the fleet.hydranode install /
reinstall); iPad heads re-scan the fleet enrollment QR (POST /api/v1/heads).
The old ID does not return.GET /api/v1/nodes — deletion is by ID, and names
are not unique guarantees.Head devices (hydraheadflatscreen, hydraheadwindows) stream from body nodes via Moonlight/Sunshine. In production, heads pick their body through the eligibility discovery procedure (GET /api/v1/bodies/eligible). See body-selection.md for the selection discipline and head-identity design principles.
The endpoint below is an admin override for exceptional situations. For normal operations, do not manually pin a body to a head. Instead, change the inputs to selection (body district/venue/owner, eligibility rules, drain flag). See body-selection.md.
curl -s -X POST https://hydracluster.experiencenet.com/api/v1/nodes/<HEAD_ID>/head-assignment \
-H "Authorization: Bearer <ADMIN_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"body_id": "<BODY_NODE_ID>", "app_id": "Desktop"}'
curl -s https://hydracluster.experiencenet.com/api/v1/heads/<HEAD_ID> \
-H "Authorization: Bearer <ADMIN_TOKEN>"
Returns stream config with both WireGuard (stream_url) and LAN (stream_url_lan) addresses resolved from the body node. The hydraheadflatscreen agent probes LAN first (TCP 47990, 1s timeout) and falls back to WireGuard. Also returns sunshine_username and sunshine_password from the head's district provider config.
Moonlight pairing PIN submission: Sunshine's web UI (port 47990) is localhost-only, so remote heads cannot submit the PIN directly. Use the sunshine-pin proxy endpoint instead — it execs the submission on the body machine where localhost:47990 is always reachable:
curl -s -X POST https://hydracluster.experiencenet.com/api/v1/nodes/<BODY_NODE_ID>/sunshine-pin \
-H "Authorization: Bearer <ADMIN_OR_NODE_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"pin":"<PIN>"}'
HydraHeadiPad calls this endpoint automatically during self-service pairing.
curl -s https://hydracluster.experiencenet.com/api/v1/heads \
-H "Authorization: Bearer <ADMIN_TOKEN>"
Returns an array of head objects. Each entry includes node_status ("online"/"offline" — node heartbeat state), last_seen (RFC3339 timestamp of the last hydranode heartbeat), assigned_body_name (the name of the body currently in use — see priority below), and diagnostics (a map of agent-reported key/value pairs, omitted when empty) in addition to the head-level status ("idle"/"streaming"/"error" — reported by the kiosk agent). Use node_status to distinguish a kiosk that is genuinely offline from one that is online but idle. Use assigned_body_name to correlate heads to bodies without resolving IP addresses. Diagnostic keys set by hydraheadflatscreen include version, wireguard ("up"/"down"), app ("kiosk"/"moonlight"/"none"), routing ("lan"/"wireguard"/"unknown"), and latency_ms (TCP RTT in milliseconds to Sunshine port 47990, present only when streaming).
assigned_body_name resolution priority: (1) live_body_id — the body node ID reported in the most recent hydraheadflatscreen heartbeat (PUT /api/v1/heads/{id} body_id field); clears automatically when no stream is active. (2) head_body_id — the admin-configured body assignment (set via POST /api/v1/nodes/{id}/head-assignment). Self-service kiosk heads populate the live field; centrally-assigned heads populate the admin field. The stream config (stream_url, stream_url_lan) is always derived from the admin assignment only.
iPad enrollment is a two-step self-registration flow. No head entry needs to exist before scanning.
Step 1 — display the QR code (admin web UI, recommended):
https://hydracluster.experiencenet.com/enrollStep 1 (alternative) — get the raw payload via API:
curl -s https://hydracluster.experiencenet.com/api/v1/enroll-qr \
-H "Authorization: Bearer <ADMIN_TOKEN>"
Returns {"server_url":"...","enrollment_token":"..."}. Encode this JSON as a QR code and print/display it — one QR serves all iPads in the fleet.
Step 2 — iPad scans the QR, app self-registers:
The app POSTs to POST /api/v1/heads using the enrollment token:
curl -s -X POST https://hydracluster.experiencenet.com/api/v1/heads \
-H "Authorization: Bearer <FLEET_ENROLLMENT_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"name":"ipad-lobby","district":"bxl1","venue":"cloud-seven"}'
Returns {"head_id":"node-...","token":"...","server_url":"..."}. The iPad saves these as its permanent identity. The head is auto-approved with role hydraheadipad and OS ios, and immediately starts heartbeating. It appears in GET /api/v1/heads with type: "hydraheadipad".
If HydraGuard is configured (hydraguard_url + hydraguard_token in config.yaml), enrollment also calls POST /api/v1/headipad/provision on HydraGuard and stores the resulting WireGuard config and peer IP on the node. Failure is non-fatal — the head is still enrolled.
Config: fleet_enrollment_token must be set in config.yaml under server:. The token is the same for all iPads — treat it as a moderately sensitive credential (anyone with it can enroll new heads).
After enrollment, the head's WireGuard configuration can be retrieved with the admin token:
curl -s https://hydracluster.experiencenet.com/api/v1/heads/<HEAD_ID>/wireguard-config \
-H "Authorization: Bearer <ADMIN_TOKEN>"
or with that head's own node token, which is what the HydraHeadiPad app uses to set up its own tunnel without an operator scanning a QR off a screen (hydracluster #449):
curl -s https://hydracluster.experiencenet.com/api/v1/heads/<HEAD_ID>/wireguard-config \
-H "Authorization: Bearer <THAT_HEADS_NODE_TOKEN>"
Returns the WireGuard config as text/plain (the full [Interface] + [Peer] block), with Cache-Control: no-store. Returns 404 if the head was enrolled without HydraGuard provisioning.
An unknown node ID returns 404 for the admin token, but 403 for a node token: the middleware refuses before any lookup, so it never reveals whether a given ID exists. A denied node also gets 403 even for its own ID, so denying a node revokes its access to its own tunnel credential.
Auth model: admin credential, or the head's own node token, and nothing else.
Any other valid node token (another head, any body, any skin) gets 403, and a
token that is not enrolled at all gets 401. The route deliberately does not use
requireAdminOrNodeToken, which authenticates any enrolled node and never compares
it to {id} (hydracluster #456): behind that wrapper every node token in the fleet
could read every head's tunnel private key. The self-scoped wrapper lives in
pkg/api/selfscope.go and compares the authenticated node's ID to the path ID.
The config embeds the tunnel's private key. HydraGuard shows a private key only at creation and never stores it, so this endpoint and the QR below are the only copies. Treat the output accordingly: do not paste it into tickets or chat, and do not publish it anywhere reachable without auth.
The WireGuard iOS app imports a tunnel by scanning a QR. The node detail page renders one for any head that has a stored config:
/admin/nodes/<HEAD_ID> in hydracluster admin (signed in).The image itself is at GET /admin/heads/{id}/wireguard-qr.png (session-cookie auth,
Cache-Control: no-store). It returns 404 when the head has no stored config.
The section only appears when a config exists, and the QR is collapsed by default so that opening a head does not put a VPN credential on screen. For the same reason it is behind cookie auth: it must never be exposed publicly.
Symptom: wireguard-config returns 404 and the node page shows no WireGuard
section, on a head that should have a tunnel.
WireGuard provisioning at enrollment is non-fatal. If HydraGuard rejects it, the head still enrolls and nothing surfaces the failure — the only trace is a line in the hydracluster log at enrollment time:
journalctl -u hydracluster --since '-1h' | grep -i 'WireGuard provisioning'
# WireGuard provisioning for <name> failed (non-fatal): hydraguard returned 409:
# head iPad peer "<name>" already exists on 10.10.200.N/32; its private key was
# shown only at creation and is not stored.
The common cause is a name collision. The iPad app sends no name, so
handleFleetEnrollHead defaults every device to ipad-head; if a peer of that name
survives from a previous device, HydraGuard returns 409 and the new head gets no
tunnel.
There is no re-provision endpoint — provisionHeadIPadWireGuard is only called from
the enrollment handler — so recovery means enrolling again under a name that is free
on both sides:
mesh.yaml freehand.DELETE /api/v1/nodes/{id}) so its name is free here too./enroll, then rename it to something device-specific
(see Renaming a node), noting that the HydraGuard peer keeps the enrollment-time
name.Verify with GET /api/v1/heads/{id}/wireguard-config returning 200, and the peer
present on the hub: wg show wg0 dump | awk '$4 ~ /10.10.200./'.
Decommissioning. Deleting a head does not remove its WireGuard peer. When a
device leaves — returned rental, retired hardware — revoke the peer on the hub as
well, or it keeps routed access to the mesh (AllowedIPs covers 10.10.0.0/16 and
10.0.0.0/8). See hydraguard #457.
curl -s https://hydracluster.experiencenet.com/api/v1/heads/<HEAD_ID>/experiences \
-H "Authorization: Bearer <ADMIN_TOKEN>"
Returns the catalog of experiences a kiosk should display, sourced from hydraexperiencelibrary's /api/v1/experiences/live endpoint keyed by the head's district + venue. If the head has a non-empty AllowedExperiences whitelist, the result is intersected with it.
This endpoint is the source of truth for kiosk grids and is intentionally independent of body availability — a venue with no body online still returns its catalog (or [] if nothing is planted there yet). Body discovery only runs at stream-start time (POST /api/v1/stream/start on the agent's local API).
Status codes:
200 — catalog (possibly [])400 — node exists but is not a hydraheadflatscreen head404 — no node with that id502 — hydraexperiencelibrary upstream returned an error503 — experienceLibrary.url is not configured on hydraclusterReturns image/jpeg directly. The mechanism differs by head type:
TOKEN="<admin-token>"
curl -sf -H "Authorization: Bearer $TOKEN" \
"https://hydracluster.experiencenet.com/api/v1/heads/<HEAD_ID>/screenshot" \
> /tmp/kiosk.jpg
Flatscreen heads (hydraheadflatscreen): fetches via exec channel → curl http://127.0.0.1:9740/api/v1/screenshot | base64 on the head. Requires the Terminal screenshot loop to be running (see hydraheadflatscreen runbook → Screenshots). Times out after 20 s.
Status codes: 200 JPEG on success; 502 if screenshot file is stale or absent (Terminal loop not running); 504 if the exec channel doesn't respond within 20 s.
If 504 (exec queue backed up): use the WebSocket shell path instead — it bypasses the async exec queue:
"$HC_BIN" exec <node-id> "base64 -i /tmp/hydra-live-screenshot.jpg" \
--shell --server "$HC_SERVER" --admin-token "$HC_TOKEN" --timeout 30s \
> /tmp/raw.txt
grep -E '^[A-Za-z0-9+/]+=*$' /tmp/raw.txt | tr -d '\n' | base64 -d > /tmp/kiosk.jpg
Note: macOS base64 requires -i <file> not a positional argument. The grep strips shell prompts before decoding.
iPad heads (hydraheadipad): no exec channel — uses a push flow instead. The server sets a pending flag and waits up to 15 s for the iPad to poll GET /api/v1/heads/{id}/commands (every 3 s), capture via RPScreenRecorder, and upload to POST /api/v1/heads/{id}/screenshot. Full Metal framebuffer is captured (Moonlight video included). Times out after 15 s.
Status codes: 200 JPEG on success; 504 if the iPad does not respond within 15 s (app backgrounded, device offline, or still booting).
The admin node detail page also exposes a Take Screenshot button for iPad heads — click it and the JPEG appears inline within ~5 s.
Returns the last 200 lines of the head agent log as JSON ({"log_path":"...","lines":[...]}):
curl -sf -H "Authorization: Bearer $TOKEN" \
"https://hydracluster.experiencenet.com/api/v1/heads/<HEAD_ID>/logs" | jq '.lines[-20:]'
Status codes: 200 JSON on success; 504 if the head exec channel doesn't respond within 15 s.
Quest heads (role hydraheadquest) stream immersively through ALVR instead of
Moonlight (issue #556). The cluster brokers one XR session per body. The
session record lives on the body's entry in nodes.yaml, so it survives a
cluster restart. The flat session store never sees XR sessions.
How it works:
POST /api/v1/heads/{id}/xr-session with a body it picked
from GET /api/v1/bodies/eligible?head_id=<id>&stream_mode=xr.POST /api/v1/body/status
response (xr_session directive). It stops Sunshine, registers the ALVR
driver, starts the chain, and reports xr_state back on the same channel.GET /api/v1/heads/{id}/xr-session until state is
armed, then launches the ALVR client. Arming takes 45 to 90 seconds,
worst case about 110.DELETE /api/v1/heads/{id}/xr-session ends the session. The body tears
down, unregisters the driver, restarts Sunshine, and returns to the flat
pool.Session states: requested, arming, armed, active, draining,
ending, failed. Failure reasons appear in the reason field
(arm_timeout, connect_timeout, chain_unstable). Failed sessions are
held for 60 seconds so the head can read the reason, then cleared.
Cluster timers (10 second cadence, in the session watchdog):
requested/arming older than 150 seconds fails with arm_timeout.ending.ending session whose body never confirms teardown is cleared after
15 minutes (safety valve for a dead body machine).Enable a body for XR:
# Add the alvr role next to hydrabody (ALVR must be staged at C:\hydra\alvr,
# see the hydrabody runbook). Then restart hydrabody or set Reprovision:
# body config only propagates on first boot or reprovision.
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"roles":["hydrabody","alvr"]}' \
"https://hydracluster.experiencenet.com/api/v1/nodes/<BODY_ID>/roles"
Set the head's ALVR client hostname (also editable on the node detail page):
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"hostname":"0529.client"}' \
"https://hydracluster.experiencenet.com/api/v1/nodes/<HEAD_ID>/xr-client-hostname"
Enroll a Quest head through fleet enrollment by adding "type":"hydraheadquest"
to the POST /api/v1/heads body. Without the field the endpoint keeps today's
iPad behavior.
Exclusivity rules:
stream_count 1 to flat heads, so
flat heads never pick it.?stream_mode=xr on eligible-bodies returns only bodies that advertise
xr_drivers containing alvr, are XR-idle, serve no flat stream, and hold
no session. The POST re-validates the same conditions under the store lock.xr_drivers, so they are never XR-eligible. Old
heads never send stream_mode=xr and never see XR catalog tiles.| Endpoint | Auth | Purpose |
|---|---|---|
POST /api/v1/heads/{id}/xr-session |
Admin or node token | Create an XR session. Body: {"body_id","experience","client_hostname","client_ip"}. Returns 201 with the GET shape. 409 {"error":"body_busy"} when the body is taken, 409 {"error":"not_xr_capable"} when it cannot serve XR. |
GET /api/v1/heads/{id}/xr-session |
Admin or node token | Read the head's session: {"session_id","state","body_id","experience","body_host","reason"}. body_host is the body's WireGuard IP. 404 when the head has no session. |
DELETE /api/v1/heads/{id}/xr-session |
Admin or node token | End the session. Idempotent, always 204. |
POST /api/v1/nodes/{id}/xr-client-hostname |
Admin | Set the head's ALVR client hostname, e.g. 0529.client. |
GET /api/v1/bodies/eligible?head_id=<id>&stream_mode=xr |
Admin or node token | Filter to XR-capable idle bodies. Entries gain xr_drivers and xr_state. |
| Endpoint | Auth | Purpose |
|---|---|---|
POST /api/v1/nodes/{id}/roles |
Admin | Set roles on a node |
POST /api/v1/nodes/{id}/provision/{role} |
Admin | Queue only one assigned recipe-backed role for reprovisioning; HydraBrain readiness is invalidated immediately. Destructive on a flatscreen head carrying local_apps: see "Reprovisioning a flatscreen head destroys its local settings" above |
PUT /api/v1/nodes/{id}/hydrabrain |
Admin | Set verified inference desired state for a node carrying the hydrabrain role; invalidates prior readiness unless only a provider label changed |
POST /api/v1/nodes/{id}/hydrabrain/rotate-token |
Admin | Rotate the node's inference-only token and invalidate readiness until reconciled |
GET /api/v1/hydrabrain/config |
Node token | Return only that node's desired workload, exact mesh listener, and scoped gateway token |
POST /api/v1/hydrabrain/status |
Node token | Report runtime/model state and vendor-neutral machine capacity |
GET /api/v1/hydrabrains |
Admin or brain discovery token | List fresh ready providers with scoped inference credentials, provider labels, and machine capacity |
DELETE /api/v1/nodes/{id} |
Admin | Remove a node from the store. Returns {"status":"ok"}, or 404 if the ID is unknown. Store-only: no WireGuard peer teardown, no session cleanup, no signal to the device. See "Removing a node" below. |
POST /api/v1/nodes/{id}/update-node |
Admin | Flag node for immediate hydranode self-update |
POST /api/v1/nodes/{id}/update-services |
Admin | Flag node to update all provisioned service binaries |
POST /api/v1/nodes/{id}/head-assignment |
Admin | Assign body to head |
POST /api/v1/nodes/{id}/allowed-experiences |
Admin | Set experience filter for kiosk head |
DELETE /api/v1/nodes/{id}/stream |
Admin | Close the active Sunshine session on a body and clear stream_status (orphaned stream recovery). Sends exec-based ForceStop (synchronous, 15 s timeout) AND sets TerminatePending so the body receives TerminateStream=true on its next heartbeat (≤5 s) as a fallback if exec fails. Session closed as admin_stop. See body-recovery.md. |
GET /api/v1/heads |
Admin | List all head nodes with stream config |
GET /api/v1/heads/{id} |
Admin | Get head config (includes experience_library_url, allowed_experiences) |
GET /api/v1/heads/{id}/experiences |
Admin | Get the kiosk experience catalog for a head (proxied from hydraexperiencelibrary) |
GET /api/v1/heads/{id}/screenshot |
Admin | Fetch kiosk screen as JPEG — flatscreen: exec channel (20 s timeout); iPad: push flow via commands poll (15 s timeout) |
POST /api/v1/heads/{id}/screenshot |
Admin or node token | iPad uploads captured JPEG after seeing screenshot: true in commands response |
GET /api/v1/heads/{id}/commands |
Admin or node token | Lightweight fast-poll for pending iPad commands (iPad polls every 3 s); returns {"screenshot": true/false} |
GET /api/v1/heads/{id}/logs |
Admin | Fetch last 200 lines of head agent log as JSON via exec channel |
GET /api/v1/heads/{id}/wireguard-config |
Admin or that head's own node token | Fetch stored WireGuard config (text/plain, Cache-Control: no-store) provisioned at iPad enrollment. Self-scoped: any other node's token gets 403, an unenrolled token 401. Used by HydraHeadiPad to set up its own tunnel |
POST /api/v1/heads/{id}/stream |
Admin | Start stream on flatscreen head (exec hydraheadflatscreen stream-start <experience>) |
DELETE /api/v1/heads/{id}/stream |
Admin or node token | Stop stream. Flatscreen: exec hydraheadflatscreen stream-stop on the head (blocks up to 15 s). iPad: immediately marks body idle in cluster memory, sets TerminatePending so body receives TerminateStream=true on its next heartbeat (≤5 s), closes session as head_stop, and fire-and-forgets a body exec as belt-and-suspenders; returns immediately. Request body {"body_id":"<id>"} is optional for iPads (falls back to last heartbeat live_body_id). |
PUT /api/v1/heads/{id} |
Admin | Update head status |
HydraCluster owns desired hardware/workload state and provider reachability, not
prompts, sessions, knowledge, or agent semantics. Configure a dedicated discovery
credential in /root/.hydracluster/config.yaml:
server:
brain_discovery_token: "<random service credential>"
Assign hydrabrain before sending desired state. HydraCluster returns the matching
OS recipe through HydraNode's generic recipe executor; the verified HydraBrain
binary then installs and owns its operating-system service. Adding this role does
not require HydraNode role-specific code. The per-node gateway token is generated
by HydraCluster and is never included in the ordinary node inventory response.
curl -sf -X POST -H "Authorization: Bearer $HYDRACLUSTER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"roles":["hydrabody","hydravoice","hydraguard-air","hydrabrain"]}' \
"$HC_SERVER/api/v1/nodes/$BRAIN_NODE/roles"
curl -sf -X PUT -H "Authorization: Bearer $HYDRACLUSTER_TOKEN" \
-H 'Content-Type: application/json' --data-binary @desired-lobo.json \
"$HC_SERVER/api/v1/nodes/$BRAIN_NODE/hydrabrain"
curl -sf -H "Authorization: Bearer $HYDRABRAIN_DISCOVERY_TOKEN" \
"$HC_SERVER/api/v1/hydrabrains" | jq .
Each provider's capacity reports hardware facts for model-aware consumers:
OS/architecture, CPU model and logical cores, total/available system memory,
total/available model-storage space, and every detected accelerator with its
VRAM, driver, and compute capability. HydraCluster validates and relays these
facts; it does not decide which models are compatible.
Two optional fields label a provider so a consumer can tell two providers of the
same model alias apart: quantization (a short printable label, for example
Q6_K or IQ3_S) and tokens_per_second (the single-stream rate measured at
acceptance, 1 to 100000). Both are declared with the desired state, both appear
in GET /api/v1/hydrabrains, and neither reaches the agent. An edit that
changes only a label therefore keeps the provider in discovery and never
restarts a workload. Keep tokens_per_second honest: re-measure it whenever the
model file, the arguments, or the card changes, and leave it unset rather than
guessing. Discovery returns providers in store order and ranks nothing; a
consumer that cares ranks them itself. HydraBrainServer orders them fastest
first, so a wrong rate there moves traffic.
A label-only edit is recognised by comparison, not by trust.
handleSetHydraBrainConfig encodes the agent-facing projection of the new and
of the stored document, plus mesh_port, and clears readiness only when those
bytes differ. An encoding error counts as a change, so the unsafe side is the
side that restarts. GET /api/v1/hydrabrain/config serves that same
projection, so what the agent reads and what the comparison sees cannot drift
apart.
Trap, found live on v2.0.123: the first version compared the documents field by
field and read a missing map as different from an empty one. nodes.yaml omits
an empty environment, so a PUT that carried "environment": {} looked like a
workload change and withdrew both providers from discovery for about a minute.
v2.0.124 compares the encoded projection and holds readiness across the edit.
Label edits therefore need v2.0.124 or later: v2.0.123 accepts the fields and
withdraws the provider, and v2.0.122 and earlier reject the document with
400 invalid JSON, because unknown fields are refused.
Rotate a possibly exposed inference credential without touching node/admin tokens:
curl -sf -X POST -H "Authorization: Bearer $HYDRACLUSTER_TOKEN" \
"$HC_SERVER/api/v1/nodes/$BRAIN_NODE/hydrabrain/rotate-token"
The canonical desired-state schema, Fluffy rollout order, rollback procedure, and
NimsForest handoff live in the HydraBrain repository runbook. The exact
credential-free Fluffy desired document is
docs/runbooks/desired-lobo.json in that repository. Changing a role,
WireGuard IP, node group, or HydraBrain desired state clears old readiness, with
the provider-label exception above; the
agent must report the current configuration before discovery returns it again.
The node detail page has a credential-redacted HydraBrain panel showing desired runtime/model/context, private endpoint, verified-artifact count, live health, agent version, runtime PID, GPU/VRAM, and last report. It must never render the gateway token, command arguments, environment values, or artifact URLs.
Live acceptance on 2026-09-06 used the role-only endpoint against Fluffy on
HydraCluster v2.0.112. Discovery withdrew before the response completed, the
agent progressed stopped -> starting -> ready, and authenticated direct,
SSE, and Club NimsForest-container inference passed afterward. Anonymous access
remained HTTP 401 and acceptance prompt markers were absent from agent/runtime
logs.
| Endpoint | Auth | Purpose |
|---|---|---|
GET /api/v1/sessions |
Admin | List all currently active streaming sessions |
GET /api/v1/sessions/history |
Admin | List closed sessions (last 500), most recent first |
GET /api/v1/sessions/{id}/logs |
Admin | Fetch correlated body + head logs for a session; see below |
GET /api/v1/nodes/{id}/body-logs |
Admin | Fetch last 500 lines of hydrabody.log from a body node; accepts ?since=<RFC3339>&until=<RFC3339> for time-window filtering |
Returns last 500 lines of C:\Windows\System32\config\systemprofile\.hydrabody\hydrabody.log
from the body node via the exec channel:
curl -sf -H "Authorization: Bearer $TOKEN" \
"https://hydracluster.experiencenet.com/api/v1/nodes/<BODY_ID>/body-logs" | jq '.lines[-20:]'
Optional time filter (RFC3339):
curl -sf -H "Authorization: Bearer $TOKEN" \
"https://hydracluster.experiencenet.com/api/v1/nodes/<BODY_ID>/body-logs?since=2026-05-22T10:00:00Z&until=2026-05-22T10:30:00Z" | jq '.lines[]'
Status codes: 200 JSON on success; 400 if node is not a body node; 504 if the exec channel doesn't respond within 30 s.
Fetches both the body log and the head log for the duration of a specific session,
returned in a single response. Session ID comes from GET /api/v1/sessions or GET /api/v1/sessions/history.
curl -sf -H "Authorization: Bearer $TOKEN" \
"https://hydracluster.experiencenet.com/api/v1/sessions/<SESSION_ID>/logs" | jq '{body_logs: .body_logs[-10:], head_logs: .head_logs[-10:]}'
Response shape:
{
"session_id": "abc12345-7",
"body_id": "node-abc12345",
"body_name": "cosmic-pretzel-98",
"head_id": "node-xyz99",
"started_at": "2026-05-22T10:15:00Z",
"ended_at": "2026-05-22T10:45:00Z",
"body_logs": ["2026/05/22 12:15:00 [stream] ...", "..."],
"head_logs": ["...", "..."]
}
head_logs is empty ([]) if the session has no associated head ID (session opened before
head heartbeat was received). ended_at is null for active sessions.
Status codes: 200 on success (even if exec failed — errors are logged server-side and the
affected log array is empty); 404 if session not found.
Send gamepad and keyboard input into a head's live stream from the cluster. The head turns the script into the same Limelight events a physical gamepad and a physical keyboard produce, so the body and the experience receive input they cannot tell apart from a person at the device.
This exists so that a stream can be driven without somebody at the venue. Paired
with GET /api/v1/heads/{id}/screenshot it gives see and act, which is what
walking a head testbook remotely needs.
Never send a password, a token or a licence key in a text step.
A script travels as JSON through POST /api/v1/heads/{id}/input, is held in
this server's memory, and is printed on the terminal by
scripts/send-controller-input.sh. A password sent this way lands in all three
at once. The issue tracker of this fleet is public, and credentials have leaked
into it before.
Use this for menus, search boxes, chat and in-game text. Account credentials stay what issue 1119 decided: the session is stored on the body, and no credential is handled here.
POST /api/v1/heads/{id}/input (admin token)
{
"steps": [
{"buttons": ["a"], "hold_milliseconds": 80},
{"wait_milliseconds": 200},
{"buttons": ["start", "back", "left_shoulder", "right_shoulder"],
"hold_milliseconds": 2000},
{"left_stick_x": -32000, "hold_milliseconds": 500},
{"left_trigger": 255, "buttons": ["a"], "hold_milliseconds": 120},
{"text": "hello world", "hold_milliseconds": 50},
{"key": "enter", "hold_milliseconds": 50},
{"key": "a", "modifiers": ["control"], "hold_milliseconds": 50}
]
}
A step either holds a state for hold_milliseconds and then returns to
neutral, or rests at neutral for wait_milliseconds. It cannot do both, and a
step with no duration is refused.
Fields on a step: buttons, left_trigger, right_trigger (0 to 255),
left_stick_x, left_stick_y, right_stick_x, right_stick_y
(-32768 to 32767), text, key, modifiers, hold_milliseconds,
wait_milliseconds.
Button names, spelled in full: a, b, x, y, up, down, left,
right, left_shoulder, right_shoulder, start, back,
left_stick_button, right_stick_button.
Those fourteen are exactly the buttons the virtual gamepad declares to the
host when it reports its arrival. The declaration is the else branch of
reportControllerArrival: in the head's ControllerSupport.m, which describes
an Xbox style pad. Sending a button that was never declared is not worth the
risk, so special, the paddles, the touchpad and the share button are not
in the vocabulary. If that declaration ever grows, grow three lists together:
headInputButtonFlagNames here, HydraSyntheticControllerButtonNames in the
head, and the help text of scripts/send-controller-input.sh.
A step with text types the characters as one UTF-8 text event. A step with
key presses one named key, holds it for hold_milliseconds and releases it.
modifiers holds the key down with up to four of shift, control, alt and
meta.
Key names, spelled in full:
| Group | Names |
|---|---|
| Editing | enter, escape, backspace, tab, space, delete, insert |
| Navigation | home, end, page_up, page_down |
| Arrows | arrow_up, arrow_down, arrow_left, arrow_right |
| Function | function_one to function_twelve |
| Letters | any single lowercase letter, a to z |
| Digits | any single digit, 0 to 9 |
An arrow key is arrow_up, never up. The four names up, down, left
and right already mean the d-pad in this vocabulary, and the sender script
writes a step as a word, where up:50 is a d-pad press. A shared name would
quietly turn a keyboard step into a gamepad step, so the script would run and
do the wrong thing with no complaint. The arrow keys therefore carry the
arrow_ prefix, and a key of up is refused with a message that says so.
Rules the validator enforces:
text and key.modifiers needs a key.Text and keys need a live stream, and only the head can know that. A keyboard event goes straight to the host, so the validator here cannot refuse a text step: it does not know whether the head has a stream. A head with no stream drives its own experience grid instead, and the grid has no text entry, so the head refuses the text and key steps there and logs the reason. See the hydraheadipad runbook.
Text limits, counted in UTF-8 bytes: 256 bytes in one step, 1024 bytes in one script. Bytes rather than characters, because that is what the wire carries and what both the cluster and the head can count the same way; counting characters gives two different answers for an accent or an emoji. The caps are there to keep this a remote operator pressing keys, not a file transfer.
Replies:
| Code | Meaning |
|---|---|
202 |
Queued. The head collects it within one command poll, so up to 3 seconds. |
400 |
The script is malformed. The body names the step and the reason. |
404 |
No head with that id. |
409 |
The head has not collected the previous script yet. |
Limits enforced before queueing: at most 64 steps, at most 10000 milliseconds for one step, at most 30000 milliseconds for the whole script, at most 8 buttons in one step, no button named twice in one step, at most 4 modifiers in one step, and at most 256 bytes of text in one step and 1024 in one script.
Every one of those limits is enforced twice, here and again in
HydraSyntheticController on the head. That is on purpose: the cluster refuses
a bad script at send time, so the operator learns at once, and the head refuses
it again so that layer stands on its own if it is ever driven from somewhere
else.
A head holds one script at a time. A second send before the head collects
the first is answered 409 rather than merged, because merging would send input
nobody asked for. With a 3 second poll the wait is short.
The head learns a script is waiting from the command poll:
GET /api/v1/heads/{id}/commands -> {"screenshot": false, "input": true}
Every value in that payload must stay a boolean. Heads already in the field decode the whole payload as a dictionary of booleans, so a value of any other type breaks their screenshot command the moment the cluster updates. A new command therefore arrives as another boolean doorbell, and anything larger is collected from its own route. Here that route is:
GET /api/v1/heads/{id}/input (admin or the head's own resource token)
Collection empties the slot, so a head that asks twice does not run the sequence
twice. An empty steps list means the slot was already taken or had gone stale.
A script queued for a head that never collects it goes stale after 30 seconds, so an offline head does not block its own slot for good.
GET /api/v1/heads/{id}/input/state (admin token)
{"state": "collected", "steps": 3,
"queued_at": "2026-11-09T13:01:02Z", "resolved_at": "2026-11-09T13:01:04Z"}
States: none (nothing ever queued), waiting, collected, expired.
Reading it never changes anything, so polling it cannot stop a head getting its
script.
Why this route exists. The command poll cannot answer the question. A head
with nothing waiting reports "input": false whether it collected a script or
never saw one, and the reassuring reading is the default. On 2026-11-09 the
author of this feature queued a script, watched it sit, later saw
"input": false and nearly concluded the head had taken it. It had expired
unseen at the 30 second limit, because the head was asleep.
That is the same disease as Process.Responding returning true for a wedged
process: one value standing for two opposite states, with the comfortable
reading as the default. It is a defect even when both states are harmless,
because it sends you looking in the wrong place.
scripts/send-controller-input.sh now polls this after queueing and prints
COLLECTED by the head or EXPIRED unseen rather than the old optimistic
"the head collects it within 3 seconds".
The head repo carries a sender that takes compact step words, so no JSON needs writing:
scripts/send-controller-input.sh <head-id> a:80 wait:200 \
start+back+left_shoulder+right_shoulder:2000
Keyboard words, added with issue 1159. Quote a text step, because the text can hold spaces:
scripts/send-controller-input.sh <head-id> \
'text=sunset over the river:50' key=enter:50 key=control+a:60
A text word is read whole, so a plus sign or a colon inside the text is kept. The duration is taken from the last colon. In a key word the modifiers come first, joined with a plus sign, and the last part is the key.
It reads the cluster URL and the admin token from HYDRACLUSTER_URL and
HYDRACLUSTER_TOKEN, or from ~/.hydracluster/config.yaml, and never prints
the token or puts it in a command line. It does print the script, which is why
a password must never go in one.
It cannot raise the iPad keyboard, and so it cannot reproduce issue 1153. That behaviour comes from the iPadOS focus engine, which reacts to the physical input device before the application sees the event. Synthetic input enters below that layer. Any test of the focus engine needs a person with a real controller.
It cannot type into a head with no live stream. A gamepad step then drives the
head's own experience grid, but the grid has no text entry, so a text or
key step is refused there with a log line that says why. Typing needs a
stream.
It must not carry a credential. See the warning at the top of this section.
Render nodes are Windows machines that run LarkXR Standalone (cloud rendering). They are enrolled in HydraCluster, which provisions them via the node agent.
hydracluster.experiencenet.com and releases.experiencenet.comhttps://hydracluster.experiencenet.com/enroll on the machinerender-node role and set district/venueThe node agent will:
larkxr-standalone-windows.zip from the release serverC:\LarkXR\larkxr-standalone\install/ folder)larkxr_center MySQL databaseAfter provisioning, verify these ports are listening:
Check via remote shell:
Get-Process *lark*,*java*,*mysql*,*redis*,*nginx* | Format-Table Name,Id
netstat -an | Select-String '8181|8282|13306'
The dashboard should show provider_status: running.
When LarkXR needs to be fully reinstalled:
Stop all LarkXR processes:
Stop-Process -Name LarkXRLauncher,LarkXRServer,CloudLarkRenderServer,java,mysqld,nginx,redis-server -Force -ErrorAction SilentlyContinue
Remove old installation and cached state:
Remove-Item C:\LarkXR -Recurse -Force
Remove-Item C:\Windows\System32\config\systemprofile\.hydranode\provider_version.txt -Force
Remove-Item C:\Windows\System32\config\systemprofile\.hydranode\config_cache.yaml -Force
Remove-Item C:\Windows\System32\config\systemprofile\.hydranode\downloads -Recurse -Force
The node agent will detect the missing installation on its next heartbeat (30s) and reprovision automatically.
Alternatively, trigger reprovision from the dashboard (node detail page > Reprovision button). As of v0.23.10+, the Reprovision button triggers a forced reinstall -- the node agent stops the provider and re-downloads regardless of existing files.
If the node is offline (node agent not heartbeating):
Windows:
# Check if the scheduled task exists
schtasks /query /tn HydraNode
# Start it
schtasks /run /tn HydraNode
# If missing, reinstall
C:\hydranode\hydranode.exe install
schtasks /run /tn HydraNode
Recovery instructions are also available at https://hydracluster.experiencenet.com/enroll (no admin login needed).
The node agent auto-updates from the release server. As of v0.23.9:
ensureInstall)To force an update on a remote machine via API:
curl -s -X POST https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/update-node \
-H "Authorization: Bearer <ADMIN_TOKEN>"
The node picks up the flag on its next heartbeat and triggers the self-updater immediately. To update service binaries (not hydranode itself):
curl -s -X POST https://hydracluster.experiencenet.com/api/v1/nodes/<ID>/update-services \
-H "Authorization: Bearer <ADMIN_TOKEN>"
Manual update on Windows (last resort):
# Download new binary
Invoke-WebRequest -Uri 'https://releases.experiencenet.com/hydranode/production/latest/hydranode-windows-amd64.exe' -OutFile C:\hydranode\hydranode-new.exe
# Stop, replace, reinstall, start
schtasks /End /TN HydraNode
Start-Sleep 3
Copy-Item C:\hydranode\hydranode-new.exe C:\hydranode\hydranode.exe -Force
Remove-Item C:\hydranode\hydranode-new.exe
C:\hydranode\hydranode.exe install
schtasks /Run /TN HydraNode
Warning: Stopping the node agent on a remote-only machine (private LAN) means you lose remote access until it restarts. The task's repetition interval (1 minute) should auto-restart it, but if the binary is locked, the replacement will fail silently.
| Path | Purpose |
|---|---|
C:\hydranode\hydranode.exe |
Node agent binary |
C:\hydranode\enroll.yaml |
Enrollment token |
C:\Windows\System32\config\systemprofile\.hydranode\ |
SYSTEM profile data dir |
...\.hydranode\config.yaml |
Node config (server URL, token) |
...\.hydranode\config_cache.yaml |
Cached config from server |
...\.hydranode\provider_version.txt |
Installed provider version |
...\.hydranode\hydranode.log |
Node agent log |
C:\LarkXR\larkxr-standalone\ |
LarkXR installation |
C:\LarkXR\larkxr-standalone\log\ |
LarkXR Launcher logs |
CreateProcessAsUser to launch it in the logged-in user's session. If no user is logged in, the launcher won't start.C:\LarkXR and provider_version.txt first on those.Nodes with the hydraskin role run Incus as
container hosts. A container on such a node is called a scale.
The operational runbook lives in the hydraskin repo:
hydraskin/docs/runbooks/hydraskin.md —
instance kinds (OCI / system container / VM), scale defaults and overrides, disk
caps and the btrfs quota requirement, hydraskin project and hydraskin expose
(publishing a scale on the node's LAN address so the mesh can reach it),
GOMEMLIMIT guidance, debugging the reporter, port 8443, and reprovisioning.
Moving a service onto a scale is covered in
hydraskin/docs/runbooks/service-cutover.md.
What lives in this repo:
recipes/hydraskin-linux.yaml — the provisioning recipe (5 steps). Node
construction lives in the hydraskin binary: the recipe installs it from
releases.experiencenet.com and runs hydraskin install, which is idempotent
and leaves running scales alone. Incus is installed by that binary, not
embedded in it — incusd is a ~59MB CGO daemon linked against liblxc and
libcowsql.pkg/api/ — POST /api/v1/body/scales, the node-token endpoint scales are
reported to, surfaced on GET /api/v1/nodes as scales / scales_reported_at
/ skin_host (see the endpoint table above)pkg/api/handlers_api.go (RoleCatalog, category container)Default recipes are embedded in the HydraCluster release binary and become active
when that release restarts. Files in /root/.hydracluster/recipes/ are optional
operator overrides; a matching role/OS pair there replaces the embedded default.
Hetzner automated daily server snapshots are enabled on hydracluster (46.224.29.125), context hydraexperiencenet. Backup window: 14:00–18:00 UTC, 7-day retention.
The snapshot covers the entire server disk, including:
~/.hydracluster/nodes.yaml — full render node fleet config~/.hydracluster/config.yaml — server config and tokenshydraexperiencenet project), open Servers → hydracluster → Backups.curl https://hydracluster.experiencenet.com/api/v1/health
curl -H "Authorization: Bearer $TOKEN" https://hydracluster.experiencenet.com/api/v1/nodes | jq length
Implementation branch only; not deployed and not a claim of Samsung support.
The original hydraheadsamsungtv source is still inaccessible. This is
independent cluster preparation for its Tizen 6.5 adaptation, not a replacement
launcher or an installable package. QM43B-T and QM55B-T device gates are NOT RUN.
An operator uses the existing authenticated POST /api/v1/heads with the fleet
enrollment credential and this body:
{"type":"hydraheadsamsungtv","name":"signage-example","district":"district-a","venue":"venue-a","allowed_experiences":["flat-game"]}
Unlike native head enrollment, the Samsung response contains head_id, a
256-bit enrollment_code, and expires_at (15 minutes). Provision this one-device
invitation through the operator setup flow. Never include the fleet credential
in the app, its package, browser storage, or a URL. No WireGuard peer is created.
The intended device must securely generate and persist a stable device_id
(16–128 alphanumeric/underscore/hyphen characters) and random 32-byte
device_token (64 lowercase hex characters) before making the claim:
POST /api/v1/signage/enroll
{"head_id":"…","enrollment_code":"…","device_id":"…","device_token":"…"}
The returned identity acknowledges the claim; the token is not echoed. Retry a lost response with the identical values before expiry. The invitation cannot be claimed by another identity or token. Both secrets are stored as SHA-256 hashes; only the device holds its bearer credential. After restart use the saved credential directly; do not enroll again. Duplicate identities/tokens, ambiguous node IDs, expired invitations and denied devices fail closed. Operator recovery uses the admin-only invitation state/rotation API documented below.
Use HTTPS and Authorization: Bearer DEVICE_TOKEN for:
GET /api/v1/heads/{id}/signage-config: own identity, venue, explicit experience
scope, desired body_id/app_id assignment, assignment revision and heartbeat
interval. No Sunshine, cluster, WireGuard or generic node credentials.POST /api/v1/heads/{id}/signage-heartbeat: status (idle, connecting,
streaming, offline or error) and optional version. Records last-seen and
device state without allowing assignment or scope mutation.GET /api/v1/heads/{id}/signage-experiences: scoped live library catalog,
filtered by the explicit allowlist and flat stream modes. XR and unknown modes
are excluded. The response contains only name, label, orientation and input
mode, never executable paths or arbitrary upstream fields. Authorization and
scope are checked again after library I/O. Upstream failure returns 503; no
global/default catalog fallback is used.Enrollment may include input_modes, an object keyed only by allowed experience
names with values absoluteMouse or touch. Unspecified entries use
absoluteMouse. These are per-experience choices, not global browser defaults.
The mediator/stream integration must apply them inside the actual stream frame.
A device credential authenticates only these signage routes. Generic node, body, pairing, exec, fleet enrollment and other-head routes reject it. Denying this node through the existing admin route revokes its token and invitation.
Operators continue to assign with
POST /api/v1/nodes/{id}/head-assignment and body_id/app_id. Samsung
assignments require a body in the same district and venue and an experience in
the invitation's allowed list. Empty body/app clears the assignment. Changes
increment a persisted revision for stale-response handling. Body/app IDs are
not permissions to allocate a live body. The session mediator must additionally
verify the current scoped library entry is flat, reserve the body and own/clean
up the relay session before launching anything.
Session mediation is implemented on the cluster branch as described below. The matching managed-relay contract is still being implemented; these endpoints must not be enabled for a live head against the legacy relay session endpoint. Browser launcher lifecycle, source recovery and package recovery remain open. This contract alone does not make a streaming signage head.
POST /api/v1/heads/{id}/signage-session accepts only
{"assignment_revision": N} using the device bearer. It re-fetches the scoped
live flat catalog, revalidates the credential/assignment, and persists a random
session ID and body ownership before sending a request to the relay. The
client cannot choose another body, app, provider credentials or stream URL.
Repeated requests renew the same session, rather than allocate another one.
The mediator sends the server-held Sunshine credential and fixed profile
tizen65-h264-sdr-720p30-v1, orientation, per-experience input mode and a 45-second
lease to the relay. The browser gets only session ID, status, its assigned stream
URL, revision and lease expiry. Renew via POST every 15 seconds while streaming.
GET on the same route returns current state or 204 when absent. DELETE
requires {"session_id":"CURRENT_ID"} so a stale callback cannot stop a newer
stream. Normal head heartbeat is separate and does not renew a stream lease.
Ownership is persisted separately from head records. On startup and every ten seconds the watchdog checks for expired leases, denied/deleted heads, changed scope/credentials/assignment and pending stops, then retries cleanup. A failed or ambiguous delete retains the body claim and hides the URL. Reassignment may briefly return 409 while cleanup finishes. Other heads cannot assign or select a claimed body as free. Existing active native/XR/body reservations are refused before relay creation. A disconnected head's persisted body assignment is also reserved even when its live body is empty; clear that assignment before reuse. Software tests allocate no actual body.
Required relay protocol (not yet delivered):
PUT /api/v1/signage-sessions/{PERSISTED_ID} must be idempotent, enforce exact-app
selection (no Desktop fallback), apply the fixed H.264 SDR profile and input
mode, and enforce lease expiry even with active WebSocket viewers. Successful
responses identify the protocol profile. DELETE must return 204 only after
cleanup is confirmed and prevent a late PUT from resurrecting that ID. A bare
404 is not sufficient: it might be an old relay missing the route. There is no
fallback to the legacy /sessions endpoint, whose pre-stop and app fallback
semantics do not meet signage ownership requirements. The neck draft now has
durable controller routing and a browser resource allowlist; its worker launch,
ownership-safe provider teardown and process recovery remain incomplete.
Network calls are made outside the cluster store mutex, with timeouts and redirects disabled. Session state transitions are serialized independently of ordinary fleet handlers. The device is reauthenticated after upstream I/O; a late response after reassignment/revocation is cleaned up without exposing its stream URL. An uncertain create keeps the same persisted ID for retry/cleanup.
An operator with cluster admin authentication reads
GET /api/v1/heads/{id}/signage-invitation for assignment_revision, claimed
state and invitation expiry. Generate and retain a fresh 256-bit lowercase hex
enrollment_code locally before posting it with that revision to the same path.
The POST response returns head ID, new revision and expiry, not the code. Deliver
that device-specific code through the intended local setup process; never put
cluster admin/fleet/provider credentials on the display.
Rotation revokes the old device credential, replaces the invitation for 15 minutes and advances the assignment revision. Scope/assignment and the head ID are preserved. A lost-response retry with the exact code and original revision returns the same expiry and does not revoke a replacement device that has already enrolled. A stale revision, expired retry or reused code is rejected; read current state and use a new code for a new rotation. Denied/unscoped heads must be explicitly approved/scoped first. Native/fleet/device tokens cannot use these admin-only recovery endpoints.
Any prior durable session/body claim is retained. The cleanup watchdog must receive managed relay confirmation before that body can be reused. This is an operator API, not a completed on-display Tizen recovery UI.
Managed signage mediation now passes the assigned body's token only in the
server-to-server relay request. Missing body credentials reject admission before
relay side effects. The head never receives body/provider tokens; the neck
fingerprints them and retains only a separately scoped stop credential for
worker crash recovery. Code 9f47058 passed API/store race CI in
run 38434882097.
Body/worker service integration is still incomplete and no fleet rollout is enabled.