Files
hermes-guest/guide/endo-guest.md
T
dckc 783e4c595f feat: teach the guest call, WebApps and define; install through the host
- guide/endo-guest.md, served as the MCP resource endo://guide: names
  and messages, toybox-style call, WebApps, define, and moving bytes
  over host.sock from the shell.
- The fake host gains call, define (toybox's modules-and-slots shape,
  recorded for the host) and a WebApp narrowed to one URL, with
  getBase64 for bytes, since toybox's fetch device answers text.
- demo.py --task install: with a real model, Hermes installs six and ms
  with no network but package-index WebApps its host grants; on macOS
  under sandbox-exec with outbound network denied. Checked by importing
  both from where Hermes put them.
- Temp cleanup logs, rather than fails, when Hermes's detached helpers
  are still writing.

Generated-by: Claude Opus 5.5
2026-11-29 17:14:02 -06:00

4.7 KiB

Being an Endo guest

You are a guest of one host, in the Endo style of object capabilities. You can affect the world only through the references your host has given you, and only by the tools of the host MCP server. You have no network, and no other services.

Names, not references

The references themselves stay with your host, in your pet store. You hold names for them:

  • list shows your names, and lookup shows what one refers to: plain data as it is, or an object by its interface, such as {"interface": "WebApp"}.
  • HOST is your host.

Messages

listMessages shows your inbox. A message has strings and names, with each named reference sitting between two strings: one more string than names. To send "Here is the pen!" with the reference pen:

{"to": "HOST", "strings": ["Here is the ", "!"], "edgeNames": ["pen"], "petNames": ["pen"]}

edgeNames are what the recipient sees; petNames are your names for the references. reply does the same, to a message number. adopt keeps a reference from a message under a name of yours, and dismiss removes a message.

Asking and calling

  • request(to, description, responseName) asks your host for something, in words. Its answer is kept under responseName.
  • call(target, method, args, saveAs) calls a method of an object you have a name for. In args, {"@name": "n"} passes the reference n names. If the answer is a reference, it's kept under saveAs.

WebApps

A WebApp is a handle to one URL, and to nothing outside it.

  • pathjoin(path) narrows it to a path within its URL, and query(params) adds query parameters. Both answer a new WebApp, so give saveAs.
  • get() and post(body) fire the request and answer the body as text.
  • getBase64() answers the body as base64, for bytes such as a tarball or a wheel.

For example, with a WebApp named npm for https://registry.npmjs.org/:

{"target": "npm", "method": "pathjoin", "args": ["ms"], "saveAs": "ms-meta"}
{"target": "ms-meta", "method": "get"}

Moving bytes: speak to host.sock from your shell

What a tool answers comes into your context, not onto your disk. To get a file onto disk, have your code talk to the host directly. The host MCP server is the Unix socket HOST_SOCK, speaking MCP's stdio framing, one JSON-RPC message per line. For example, in Python:

import base64, json, socket

def host_call(*calls):
    """Make MCP tools/call requests on host.sock; answer each one's text."""
    s = socket.socket(socket.AF_UNIX)
    s.connect("HOST_SOCK")
    f = s.makefile("rw")
    def rpc(id, method, params):
        f.write(json.dumps({"jsonrpc": "2.0", "id": id, "method": method, "params": params}) + "\n")
        f.flush()
        return json.loads(f.readline())
    rpc(0, "initialize", {"protocolVersion": "2025-06-18", "capabilities": {},
                          "clientInfo": {"name": "shell", "version": "0"}})
    f.write(json.dumps({"jsonrpc": "2.0", "method": "notifications/initialized"}) + "\n")
    out = []
    for i, (name, arguments) in enumerate(calls, 1):
        result = rpc(i, "tools/call", {"name": name, "arguments": arguments})["result"]
        if result.get("isError"):
            raise RuntimeError(result["content"][0]["text"])
        out.append(json.loads(result["content"][0]["text"]))
    return out

[b64] = host_call(("call", {"target": "some-file", "method": "getBase64"}))
open("some-file", "wb").write(base64.b64decode(b64))

It's the same socket, and the same authority, as your host tools.

Proposing code: define

To get something done with references you don't hold, propose code to your host with define(modules, slots):

  • modules maps each module's path to its source, which is JavaScript in a vat;
  • slots names the vat's parameters, each with a label saying what it should be.

Your host reads the source and decides. It may endow the definition: fill each slot with a reference it holds, run the vat, and keep its root. The root is your host's, to keep or send to you. So you ask for an attenuation of what your host holds, and your host decides what goes in and who gets what comes out.

A vat's main module exports buildRootObject(powers, params):

  • powers holds E (eventual send: E(x).method(...) answers a promise), Far (makes a remotable object) and M (method guards).
  • params holds your slots, by name.

For example, a vat that answers the latest version of an npm package, given a WebApp for the registry:

{
  "modules": {
    "main.js": "export const buildRootObject = ({ E, Far }, { registry }) => Far('Latest', { async of(name) { const meta = JSON.parse(await E(E(registry).pathjoin(name)).get()); return meta['dist-tags'].latest; } });"
  },
  "slots": {"registry": {"label": "a WebApp for https://registry.npmjs.org/"}}
}