# toybox: vats whose code is installed at runtime, each a Durable Object facet. # # Sockets have no address here: whoever starts workerd hands them in # (-S name=fd from systemd, or -s name=addr), so holding a socket is the # authority it grants. `state` is likewise overridden with -d state=, # and the switchboard's address with -e switchboard=. using Workerd = import "/workerd/workerd.capnp"; const config :Workerd.Config = ( services = [ (name = "main", worker = .supervisor), (name = "nowhere", network = (allow = [])), # the way out: see switchboard.capnp (name = "switchboard", external = (address = "unix:switchboard.sock", http = (style = proxy))), (name = "state", disk = (path = "state", writable = true)), ], sockets = [ # reach a running vat by name (name = "http", http = (), service = (name = "main", entrypoint = "Public")), # install code into a vat and (re)start it (name = "admin", http = (), service = (name = "main", entrypoint = "Admin")), ], ); const supervisor :Workerd.Worker = ( compatibilityDate = "2026-10-01", modules = [(name = "supervisor.js", esModule = embed "supervisor.js")], durableObjectNamespaces = [(className = "Vat", uniqueKey = "toybox-vat", enableSql = true)], durableObjectStorage = (localDisk = "state"), bindings = [ (name = "VATS", durableObjectNamespace = "Vat"), (name = "LOADER", workerLoader = ()), (name = "SWITCHBOARD", service = "switchboard"), ], globalOutbound = "nowhere", );