Appearance
system.gateway.http
system.gateway.http (provided by @open-matrix/system-gateway-http) is the HTTP gateway. It serves Director's static assets, handles the browser bootstrap, and proxies the WebSocket-NATS connection. Director has no direct adapter calls into gateway actors — its relationship is entirely as an HTTP client of the gateway plus a NATS-WS consumer.
What the gateway provides Director
- Static asset serving. Director's
dist/is published at/apps/director/. The Vite config (vite.config.ts:12) setsbase: '/apps/director/'so produced assets reference paths the gateway already maps. - Bootstrap. When the page loads,
<matrix-dsl-host bootstrap-mode="hosted" url-params>(src/index.html:50-55) requests bootstrap data from the gateway. The response provides the WebSocket-NATS endpoint, authority root, address root, runtime target root, and credentials for that browser session. - WebSocket transport. After bootstrap,
<matrix-dsl-host>openswss://<gateway>/nats-wsand uses it as the NATS transport. AllRequestReply.executecalls Director makes ride this transport. - Dev proxy paths. In
vite dev, the local Vite server proxies/.matrix,/api,/auth,/login,/logout,/healthz, and/nats-wstoMATRIX_DAEMON_ORIGIN(defaulthttp://127.0.0.1:3100). Seevite.config.ts:46-55.
What Director does not call
Director does not call system.gateway.http for any business logic:
- No
gateway.routes.listor similar reflective calls. - No
gateway.bootstrap.invalidate. - No upload/file API.
- No
auth.*calls.
Auth lives in system-auth. The gateway is a transport-and-routing layer, not a Director adapter target.
Bootstrap envelope (consumed values)
Director's directorReadiness (src/index.ts:81-114) reads three values from the <matrix-dsl-host> element after bootstrap completes:
| Source attribute | Purpose |
|---|---|
host.getAttribute('root') | The page's primary mount-path root for the topology view. |
host.dataset.addressRoot | Authenticated authority root. |
host.dataset.runtimeTargetRoot | Where to send runtime-targeted RequestReply calls. |
If any are missing, Director never declares ready. That's the "loading" screen you see when the gateway responds slowly or the bootstrap response was incomplete.
Implications
Because Director is gateway-agnostic at the actor level, swapping gateway implementations (or running Director against a different gateway in dev) only requires producing a compatible bootstrap response and a working /nats-ws upgrade. Director itself doesn't need any code changes.
For developer ergonomics, MATRIX_DAEMON_ORIGIN lets you run Director against an arbitrary host (e.g., a remote dev box) without touching code:
bash
MATRIX_DAEMON_ORIGIN=http://192.168.1.10:3100 pnpm --filter @open-matrix/director devSee also
Source:
projects/matrix-3/packages/director/src/index.html,src/index.ts:74-114,vite.config.ts.