Skip to content

Install-time behaviour

When the host installs a realm:

  1. Clone the realm repo (existing).
  2. If package.json has a build script, run npm install && npm run build. Produces dist/. Skipped silently when node/npm isn’t available; OpenAPI methods still work.
  3. Read dist/manifest.json if present; register each entry as a gateway method alongside OpenAPI-derived ones.
  4. At sandbox session start, copy each realm’s dist/ into /world/realm-handlers/<realm-name>/. The generated gateway.js require()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 outline

The raw gateway.docs.* call goes via HTTP (existing path). The wrapper dispatch is local — no extra hop.