Install-time behaviour
When the host installs a realm:
- Clone the realm repo (existing).
- If
package.jsonhas abuildscript, runnpm install && npm run build. Producesdist/. Skipped silently whennode/npmisn’t available; OpenAPI methods still work. - Read
dist/manifest.jsonif present; register each entry as a gateway method alongside OpenAPI-derived ones. - At sandbox session start, copy each realm’s
dist/into/world/realm-handlers/<realm-name>/. The generatedgateway.jsrequire()s these modules and routes realm-method calls locally instead of via HTTP.
A handler call from inside the sandbox:
LLM-emitted script gateway.docsEditor.getOutline({ documentId }) ↓ generated gateway.js routes to local handler require('/world/realm-handlers/google/api/docs-editor.js').getOutline(gateway, args) ↓ handler calls back through gateway for raw API gateway.docs.documentsGet({ documentId }) ← HTTP to the host gateway ↓ returns handler shapes the result ↓LLM-emitted script receives the typed outlineThe raw gateway.docs.* call goes via HTTP (existing path). The wrapper dispatch is local — no extra hop.

