Units
Declarative behaviours — clocks, counters, tickers, formatters, watch rules and data feeds — that write to the store.
Driving units from outside the editor.
Every unit action goes through one endpoint: POST /api/pages/<id>/units/command. The route holds no logic — it parses the body, validates the envelope, hands it to the port and maps the result to a status code. What a command means lives in the domain and application layers.
curl -X POST http://localhost:4004/api/pages/<pageId>/units/command \
-H "Content-Type: application/json" \
-d '{"type":"counter","unitId":"<unitId>","action":"increment"}'
- An unknown action is rejected with the list of known actions for that kind — “clock has no action "go". Known: start, pause, stop, …”.
- unitId addresses a stored unit; the request object fully describes the command, with no hidden editor state.
- The same gate backs buttons, Stream Deck keys, reactions and the MCP tools, so behaviour is identical whoever fires it.
A poller can also be probed on its own: POST /api/pages/<id>/runtime/units/<unitId>/probe.