@parcha/agentrun-computer 0.1.0-beta.41 → 0.1.0-beta.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/NOTICE +2 -0
  2. package/README.md +254 -14
  3. package/box/README.md +2 -2
  4. package/box/build-e2b.mjs +1 -1
  5. package/dist/box-image.d.ts +1 -3
  6. package/dist/box-image.js +1 -11
  7. package/dist/boxd.d.ts +126 -0
  8. package/dist/boxd.js +418 -0
  9. package/dist/cloudflare.d.ts +32 -0
  10. package/dist/cloudflare.js +179 -0
  11. package/dist/computerd-linux-amd64 +0 -0
  12. package/dist/computerd-linux-arm64 +0 -0
  13. package/dist/computerd.json +2 -2
  14. package/dist/conformance/boxd.d.ts +77 -0
  15. package/dist/conformance/boxd.js +113 -0
  16. package/dist/conformance/cases/isolation.js +1 -17
  17. package/dist/conformance/cloudflare.d.ts +42 -0
  18. package/dist/conformance/cloudflare.js +54 -0
  19. package/dist/conformance/dial-only.d.ts +6 -0
  20. package/dist/conformance/dial-only.js +9 -0
  21. package/dist/conformance/e2b.d.ts +12 -3
  22. package/dist/conformance/e2b.js +21 -4
  23. package/dist/conformance/fly.d.ts +52 -0
  24. package/dist/conformance/fly.js +52 -0
  25. package/dist/conformance/modal.d.ts +15 -2
  26. package/dist/conformance/modal.js +36 -3
  27. package/dist/conformance/morph.d.ts +59 -0
  28. package/dist/conformance/morph.js +95 -0
  29. package/dist/conformance/phone-harness.js +2 -2
  30. package/dist/conformance/runner.js +3 -3
  31. package/dist/conformance/sweep.d.ts +1 -6
  32. package/dist/conformance/sweep.js +8 -18
  33. package/dist/descriptors/boxd.d.ts +52 -0
  34. package/dist/descriptors/boxd.js +29 -0
  35. package/dist/descriptors/cloudflare.d.ts +21 -0
  36. package/dist/descriptors/cloudflare.js +29 -0
  37. package/dist/descriptors/e2b.d.ts +4 -0
  38. package/dist/descriptors/e2b.js +3 -0
  39. package/dist/descriptors/fly.d.ts +19 -0
  40. package/dist/descriptors/fly.js +28 -0
  41. package/dist/descriptors/index.d.ts +113 -1
  42. package/dist/descriptors/index.js +7 -2
  43. package/dist/descriptors/modal.d.ts +3 -0
  44. package/dist/descriptors/modal.js +7 -2
  45. package/dist/descriptors/morph.d.ts +15 -0
  46. package/dist/descriptors/morph.js +21 -0
  47. package/dist/descriptors/phone-harness.d.ts +1 -0
  48. package/dist/descriptors/phone-harness.js +2 -0
  49. package/dist/e2b.d.ts +7 -1
  50. package/dist/e2b.js +87 -44
  51. package/dist/fly.d.ts +43 -0
  52. package/dist/fly.js +245 -0
  53. package/dist/host.d.ts +8 -28
  54. package/dist/hosted/process.d.ts +19 -0
  55. package/dist/hosted/process.js +28 -0
  56. package/dist/hosted/provider.d.ts +11 -22
  57. package/dist/hosted/provider.js +30 -201
  58. package/dist/hosted/scripts.d.ts +2 -8
  59. package/dist/hosted/scripts.js +2 -22
  60. package/dist/hosted/ssh-exec.d.ts +2 -1
  61. package/dist/hosted/ssh-exec.js +58 -2
  62. package/dist/hosted/values.d.ts +5 -0
  63. package/dist/hosted/values.js +9 -0
  64. package/dist/index.d.ts +1 -1
  65. package/dist/index.js +2 -2
  66. package/dist/modal.d.ts +6 -0
  67. package/dist/modal.js +20 -10
  68. package/dist/morph.d.ts +65 -0
  69. package/dist/morph.js +495 -0
  70. package/dist/phone-harness.d.ts +15 -5
  71. package/dist/phone-harness.js +50 -15
  72. package/dist/screen-watch.js +2 -2
  73. package/package.json +20 -2
package/NOTICE CHANGED
@@ -1,6 +1,8 @@
1
1
  AgentRun
2
2
  Copyright 2026 Parcha Labs, Inc.
3
3
 
4
+ The boxd computer provider (packages/computer/src/boxd.ts) was contributed by Michiel Voortman.
5
+
4
6
  This product includes software from E2B infra (https://github.com/e2b-dev/infra), envd, Copyright 2023 FoundryLabs, Inc., licensed under the Apache License 2.0.
5
7
 
6
8
  This product includes software from Kubernetes agent-sandbox (https://github.com/kubernetes-sigs/agent-sandbox), sandboxd, Copyright 2026 The Kubernetes Authors, licensed under the Apache License 2.0.
package/README.md CHANGED
@@ -16,7 +16,7 @@ import { checkMount, readBackOf, WORKSPACE, type MountSpec } from "@parcha/agent
16
16
 
17
17
  The package root holds the protocol, the registry and the descriptors, and loads no provider: a provider loads by its
18
18
  id (`providerFor(id, options)`, which imports that one provider's file), or from its subpath (`/docker`, `/daytona`,
19
- `/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`). A provider's
19
+ `/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`). A provider's
20
20
  option types (`DockerProviderOptions`, `ModalProviderOptions` and the like) come from its subpath too, not the root.
21
21
 
22
22
  The package carries the daemon for Linux amd64 and arm64 in `dist/`, so a provider runs it with no Go on the host. A
@@ -37,8 +37,9 @@ full VM, a machine. The protocol has two layers:
37
37
  - **A daemon in every computer.** `computerd` is one small static Go program (Linux, amd64 and arm64, no cgo). It speaks
38
38
  JSON-RPC 2.0, one JSON object per line, over stdin and stdout, so it works in a computer with no network.
39
39
  - **One provisioner per vendor.** A provisioner makes, finds and ends computers, and opens a stream to the daemon
40
- inside. It never runs commands itself: the daemon does. This package has four: Docker, Modal's VM runtime, Daytona
41
- and E2B (desktops), each one line of the provider registry (see [Adding a computer](#adding-a-computer)).
40
+ inside. It never runs commands itself: the daemon does. This package has five: Docker, Modal's VM runtime, Daytona,
41
+ E2B (desktops) and boxd (microVMs, contributed by Michiel Voortman), each one line of the provider registry (see
42
+ [Adding a computer](#adding-a-computer)).
42
43
 
43
44
  The protocol is published as a spec, [`spec/computer/`](../../spec/computer/README.md), at protocol version 0.2
44
45
  (`PROTOCOL_VERSION`, which `hello` carries as `protocol`). Its JSON Schema and constants are generated from
@@ -503,7 +504,7 @@ provider declares, either way.
503
504
 
504
505
  | group | methods |
505
506
  | --- | --- |
506
- | `screen` | `screen.shot({ region? })`: a PNG (8-bit, non-interlaced), its first `MAX_CHUNK_BYTES` in `data`, with `width`, `height` (the image's pixels, the input coordinate space, never downscaled), `scale` and `cursor?`; `screen.read({ id, offset })` for the rest. One shot is held, until its eof or the next shot. `screen.watch({ after, waitMs?, maxWidth?, quality? })`: the live view's frames, paced by the caller's ack (`after`, the seq of the last frame it has whole; an older one gets the newest frame at once; on a computer whose hello lists `screen.ahead`, one past the newest waits as the newest does, so two asks can be in flight): the next frame once the screen or the pointer changed, else `changed: false` when `waitMs` (default 2000, at most 10000) is over. Computerd on a desktop learns what changed from the X server's DAMAGE extension and gives at most 15 frames a second; on an X server without DAMAGE, `screen.watch` is refused, `unsupported`, in words. A frame is `{ seq, changed, format, frameWidth, frameHeight, width, height, cursor? }` and its bytes as a shot's (`data`, `id` and `screen.read`); `format` is `jpeg` from computerd (scaled to `maxWidth`, default 1280, at `quality`, default 60) and `png` from the phone client. One watch per connection. |
507
+ | `screen` | `screen.shot({ region? })`: a PNG (8-bit, non-interlaced), its first `MAX_CHUNK_BYTES` in `data`, with `width`, `height` (the image's pixels, the input coordinate space, never downscaled), `scale` and `cursor?`; `screen.read({ id, offset })` for the rest. One shot is held, until its eof or the next shot. `screen.watch({ after, waitMs?, maxWidth?, quality? })`: the live view's frames, paced by the caller's ack (`after`, the seq of the last frame it has whole; an older one gets the newest frame at once; on a computer whose hello lists `screen.ahead`, one past the newest waits as the newest does, so two asks can be in flight): the next frame once the screen or the pointer changed, else `changed: false` when `waitMs` (default 2000, at most 10000) is over. Computerd on a desktop learns what changed from the X server's DAMAGE extension and gives at most 15 frames a second; on an X server without DAMAGE, `screen.watch` is refused, `unsupported`, in words. A frame is `{ seq, changed, format, frameWidth, frameHeight, width, height, cursor? }` and its bytes as a shot's (`data`, `id` and `screen.read`); `format` is `jpeg` from computerd and from phoned (scaled to `maxWidth`, default 1280, at `quality`, default 60); phoned reads the phone's screen at most every 200 ms while a watch waits, and encodes only a changed one, and the phone-harness provider's watch asks 720 wide when its caller names no width. One watch per connection. |
507
508
  | `input.pointer` | `input.actions`: `move`, `down`, `up`, `click` (`count` 1-3, held `keys`), `drag` (a path of 2 or more points), `scroll` (`unit` clicks or px) |
508
509
  | `input.keys` | `input.actions`: `key` (one key pressed, or a combo released in reverse; `repeat`), `hold` (`ms`), `type` |
509
510
  | `input.touch` | `input.actions`: `tap`, `long_press`, `swipe`, `pinch` (`scale` above 1 apart, below together), `button` (back, home, app_switch) |
@@ -660,6 +661,7 @@ live under:
660
661
  | `E2B_API_KEY` | E2B's `apiKey`: serve's new name for the E2B box |
661
662
  | `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID` | Browserbase's `apiKey`, `projectId`: the names pi-browser reads today |
662
663
  | `KERNEL_API_KEY` | Kernel's `apiKey`: the name pi-browser reads today |
664
+ | `BOXD_API_KEY`, `BOXD_ORG`, `BOXD_REGION` | boxd's `apiKey`, `org` and `region` (unset: the key's own org, the API's home region) |
663
665
 
664
666
  - **the conformance CLI and the live harness** (`src/conformance/`: the CLI, each provider's conformance module and the
665
667
  sweeps) read their own `COMPUTER_<ID>_*` names, the ones the live scripts set, through each module's
@@ -1360,7 +1362,7 @@ The conformance module, `dist/conformance/modal.js` (`--provider modal`), reads
1360
1362
  (`settingsFromEnv`) and passes each to `create()` as its option: `COMPUTER_MODAL_TOKEN_ID` and
1361
1363
  `COMPUTER_MODAL_TOKEN_SECRET` (never `MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET`: a host may hold a production token under
1362
1364
  those names, and with only them set it refuses, naming the `COMPUTER_MODAL_` pair), `COMPUTER_MODAL_APP`, and, if set,
1363
- `COMPUTER_MODAL_SERVER_URL`. It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
1365
+ `COMPUTER_MODAL_SERVER_URL` and `COMPUTER_MODAL_CONNECT` (`connect`). It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
1364
1366
  anything else. Its `createDriftedProvider()` uploads a daemon it builds with Go as version `<version>-drift`, so Go must
1365
1367
  be on PATH. Every computer of a run gets `maxLifetimeMs` 30 minutes. Core `provider.stop` expects Modal's refusal (it
1366
1368
  declares no stop), and the Full `provider.janitor` case is skipped (`lifetime:janitor`, `release:stop`).
@@ -1377,6 +1379,18 @@ Its output is `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`, as for ev
1377
1379
  file records where it listed, the app and the server (`sweepScope`), and `--after` refuses, exit 2, before it lists
1378
1380
  anything, a file of another app or server, or one that names none: every computer there would read as new.
1379
1381
 
1382
+ ### Modal on dial
1383
+
1384
+ With `connect: "dial"` (a server's `modalConnect` setting; `exec` by default) a Modal sandbox dials the server instead
1385
+ ([PROVIDERS.md](PROVIDERS.md#machines-that-dial-in)): its command is the box image's `agentrun-dial` and the
1386
+ boot env goes in as `env`, which the SDK sends as an ephemeral Secret (`Secret.fromObject`, modal@0.11.1
1387
+ `mergeEnvIntoSecrets`). Nothing is uploaded and nothing runs through exec: the host has none. init is `agentrun-dial`'s
1388
+ child (`daemon: "child"`), and Modal still ends the sandbox at its timeout. No Archil mount; GPUs stay offered, on
1389
+ gVisor. **Unverified**: that a GPU sandbox on gVisor runs `agentrun-dial` as the VM runtime does (no live run yet). The
1390
+ conformance module's `dialKit()` refuses, as E2B's does: the Core run happens inside the public server's process. Its
1391
+ run image with `COMPUTER_MODAL_CONNECT=dial` is the box image, the one that holds `agentrun-dial` (debian:bookworm-slim
1392
+ on exec, as before).
1393
+
1380
1394
  ## Daytona
1381
1395
 
1382
1396
  ```ts
@@ -1735,7 +1749,7 @@ made instead of making a second.
1735
1749
  An E2B computer is a sandbox made from an E2B template. The descriptor names no default: it says `prepareImage`, and
1736
1750
  `prepareImage()` answers the box template, `boxE2bTemplate()` (`src/box-image.ts`), with no call and no wait. That is
1737
1751
  `<BOX_E2B_PUBLISHER>/agentrun-archil-<recipe hash>`, the box image (`box/Dockerfile`: the archil client and helper,
1738
- the tool user, FUSE, Xvfb, xfwm4 and the apps) that the release's `box-e2b` job builds as a template in the publishing
1752
+ the tool user, FUSE, Xvfb, xfwm4 and the apps) that the release's `box` job builds as a template in the publishing
1739
1753
  team and makes public, so any E2B account starts it by that name. A sandbox and a desktop both start from it, in either
1740
1754
  mode. It is kind `desktop`: computerd starts the X server and xfwm4 itself (`src/desktop.ts`), as on a Docker desktop,
1741
1755
  and its X11 shim drives it. With `kind: "linux"` it is kind `linux` on any template, with no display: the same
@@ -1959,9 +1973,26 @@ also sweeps its own label through the host at its end (the report's `cleanup.swe
1959
1973
  The conformance module's `settingsFromEnv` reads these names, and the sweep reads them through it (`createHost`),
1960
1974
  each passed to `create()` as the option in brackets: `COMPUTER_E2B_API_KEY` (`apiKey`, required),
1961
1975
  `COMPUTER_E2B_DOMAIN` (`domain`), `COMPUTER_E2B_DAEMON` (`daemonPath`), `COMPUTER_E2B_KIND` (`kind`),
1962
- `COMPUTER_E2B_MAX_LIFETIME_MS` (`maxLifetimeMs`, a whole number of ms) and `COMPUTER_E2B_USER` (`daemonUser`). It
1963
- refuses while `E2B_SANDBOX_URL` is set in the environment it reads, as the provider does in `process.env`.
1964
- `COMPUTER_E2B_PUBLIC_STREAM` is no longer read.
1976
+ `COMPUTER_E2B_MAX_LIFETIME_MS` (`maxLifetimeMs`, a whole number of ms), `COMPUTER_E2B_USER` (`daemonUser`) and
1977
+ `COMPUTER_E2B_CONNECT` (`connect`). It refuses while `E2B_SANDBOX_URL` is set in the environment it reads, as the
1978
+ provider does in `process.env`. `COMPUTER_E2B_PUBLIC_STREAM` is no longer read.
1979
+
1980
+ ### E2B on dial
1981
+
1982
+ With `connect: "dial"` (a server's `e2bConnect` setting; `exec` by default) an E2B sandbox dials the server instead
1983
+ ([PROVIDERS.md](PROVIDERS.md#machines-that-dial-in)): kind linux alone (its default on dial; a desktop named
1984
+ there is refused), no Archil mount, and the host has no
1985
+ exec and no upload. E2B runs a template's start command once, at the template's build, and snapshots it running, so
1986
+ it never sees a create's env ([docs.e2b.dev/template/start-ready-command](https://docs.e2b.dev/template/start-ready-command)).
1987
+ So create starts the box template's `agentrun-dial` itself, once, right after `Sandbox.create`: one envd process as
1988
+ root with the boot env as that process's env alone (never the sandbox's `envs`, which envd gives every process), after
1989
+ the root-only and session-bus steps the exec path runs before init. It lets go of the process stream once envd has
1990
+ started it, and the process runs on ([docs.e2b.dev/commands/background](https://docs.e2b.dev/commands/background):
1991
+ with no command timeout, "the process keeps running after the client disconnects"). Its output goes to
1992
+ `/run/agentrun-dial.log`, root's alone. The conformance module's `dialKit()` refuses: a dial machine dials the server
1993
+ that minted its token, so its Core run happens inside the public server's process
1994
+ (`packages/serve/scripts/dial-conformance.mjs`), never from the CLI. With `COMPUTER_E2B_CONNECT=dial` and no
1995
+ `COMPUTER_E2B_TEMPLATE`, its run image is the box template, the one that holds `agentrun-dial`.
1965
1996
 
1966
1997
  ### What waits for a live run
1967
1998
 
@@ -2006,7 +2037,8 @@ of the key's workspace on its first run ([below](#the-desktop-agentrun-box)).
2006
2037
  `create(options)` takes the workspace's API key as `options.apiKey` and the private half of an SSH key registered on
2007
2038
  the same workspace (`POST /v1/ssh-keys`, or `agent37 ssh-keys add`) as `options.sshKey`, its contents, never a path:
2008
2039
  the provider reads no file and no environment. A key pasted into Settings comes back on one line (a password field
2009
- drops line breaks), so the provider wraps a one-line key's body again before ssh2 reads it. REST takes the API key as
2040
+ drops line breaks), so the provider wraps a one-line key's body again before ssh2 reads it. A PKCS#8 key (PEM label
2041
+ `PRIVATE KEY`), which ssh2 does not read, is converted first: RSA to PKCS#1, EC to SEC1, Ed25519 to OpenSSH's format. REST takes the API key as
2010
2042
  `Authorization: Bearer <key>`; the SSH tunnel's edge takes the same key in `X-Agent37-Key` (npm `agent37@0.4.1`
2011
2043
  `src/cli.js`, `wsHandshake` and `runTunnel`). Neither key appears in an error, a note or a label: the sweep's scope
2012
2044
  names the API key by its sha256 prefix alone.
@@ -2136,6 +2168,76 @@ errors; instance-sizing; vm-instances; instance-network; ssh; templates; custom-
2136
2168
  `agent37@0.4.1` `src/cli.js` (the tunnel); `ssh2@1.17.0` (`lib/client.js`, `lib/Channel.js`, `lib/utils.js`); and
2137
2169
  the live runs above.
2138
2170
 
2171
+ ## Morph
2172
+
2173
+ ```ts
2174
+ import { providerFor } from "@parcha/agentrun-computer";
2175
+
2176
+ // The key is the caller's to pass (serve's MORPH_API_KEY), and ssh2 is the host's own.
2177
+ const morph = await providerFor("morph", { apiKey });
2178
+ const box = await morph.prepareImage(); // the box image as a snapshot in the key's account
2179
+ const made = await morph.create({ image: box.value, lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
2180
+ ```
2181
+
2182
+ Morph runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/morph.ts` is Morph's `MachineHost`.
2183
+ A Morph computer is kind `linux`, an instance (a VM) started from a snapshot through Morph's REST API
2184
+ (`https://cloud.morph.so/api`, `Authorization: Bearer <key>`; OpenAPI at `https://cloud.morph.so/api/openapi.json`).
2185
+
2186
+ | MachineHost | Morph |
2187
+ | --- | --- |
2188
+ | `create` | `POST /instance` with the snapshot, the labels as metadata, and the lifetime as `ttl_seconds` with `ttl_action: "stop"` |
2189
+ | `get` | `GET /instance/{id}`: `ready` is running, `pending` and `saving` starting, `paused` stopped, `error` gone |
2190
+ | `list` | `GET /instance`, the account's every instance; the adapter matches the labels (the `metadata[...]` filter is not used: whether a dotted key survives it is **unverified**) |
2191
+ | `delete` | `DELETE /instance/{id}`, then this host's SSH connections to it end |
2192
+ | `extend` | `POST /instance/{id}/ttl`, never past the max-deadline label, its read-back end held to the call's now plus the seconds; then `POST /instance/{id}/metadata` with the deadline label moved |
2193
+ | `exec` | SSH through the gateway `ssh.cloud.morph.so:22` as `<instance id>` with the instance's own key (`GET /instance/{id}/ssh/key`, PKCS#8, converted to a form ssh2 reads; read once and kept until delete or a refused login); one channel per process on the shared connection, and the shared pid wrapper for `kill` |
2194
+ | `check` | an image is a snapshot id (`snapshot_...`); a size is the snapshot's, so `cpus` and `memoryMb` are refused |
2195
+
2196
+ Morph's REST exec (`POST /instance/{id}/exec`) answers when the command ends, with no stdin, so it is not used. Both
2197
+ Morph SDKs log in as `<instance id>:<API key>` with any key; this provider does not, since Morph publishes no host key
2198
+ for its gateway, and a host posing as it would read the account's key out of the username. A public-key login with the
2199
+ instance's key hands such a host nothing to reuse. Morph has no egress control: network `none`, `open` and a list are
2200
+ init's. No Archil mount and no desktop yet.
2201
+
2202
+ **The box snapshot.** `prepareImage()` answers the snapshot whose digest is `agentrun-box-<recipe hash>` in the key's
2203
+ account, or builds it once: a base snapshot of `morphvm-minimal` at 2 vCPUs, 4 GiB and 16 GiB of disk (`POST
2204
+ /snapshot`), an instance from it with a 2 h TTL of its own, `box/install.sh` run as root over SSH, then `POST
2205
+ /instance/{id}/snapshot` with the digest, and the instance deleted. The box snapshot and its base have no TTL, so
2206
+ neither expires. A build that fails before it asks for the box snapshot deletes its base as well, so it leaves nothing.
2207
+ A cancel does the same: the base's and the instance's creates take no cancel signal, only their own time bound, so
2208
+ their ids are always read and then deleted. `POST /snapshot` answers only once the base is made (78 s at 1 vCPU, 2 GiB
2209
+ and 8 GiB of disk), so its bound is the build's remaining time. The base carries the label `agentrun-box-build=<name>`,
2210
+ and a build looks for one by it before it makes one: a ready one is used, a pending one waited for, a failed one
2211
+ deleted. A base create whose answer is lost (a timeout, a dropped connection, a 5xx) looks again the same way, so the
2212
+ base Morph made all the same is used, never left. A failed box snapshot, with none other, is refused in words until it
2213
+ is deleted in the account.
2214
+
2215
+ **Unverified** (the lane's live kit settles them): that the gateway takes the instance's key for the user `<instance
2216
+ id>`; that SSH lands as root; that `morphvm-minimal` has apt and dpkg;
2217
+ that `/ttl` counts from the call; whether `/metadata` merges or replaces (the whole map is sent); that a deleted instance
2218
+ answers 404; the arch (amd64) and the guest's sshd port (22); Morph's longest lifetime (24 h is taken) and whether
2219
+ activity resets a TTL; whether a snapshot needs its base; and whether instances started from one snapshot share the
2220
+ guest's RNG state and machine id.
2221
+
2222
+ ### Conformance on Morph
2223
+
2224
+ ```sh
2225
+ AGENTRUN_COMPUTER_LIVE_MORPH=1 COMPUTER_MORPH_API_KEY=... \
2226
+ npm run conformance -w @parcha/agentrun-computer -- --provider morph
2227
+ ```
2228
+
2229
+ The conformance module, `dist/conformance/morph.js`, checks `AGENTRUN_COMPUTER_LIVE_MORPH=1` first, then reads
2230
+ `COMPUTER_MORPH_API_KEY` (`apiKey`, required), `COMPUTER_MORPH_SNAPSHOT` (the run's image, default the box snapshot
2231
+ `prepareImage()` finds or builds), `COMPUTER_MORPH_API_URL`, `COMPUTER_MORPH_DAEMON` (`daemonPath`) and
2232
+ `COMPUTER_MORPH_MAX_LIFETIME_MS`, never `MORPH_API_KEY`. Every computer of a run lives at most 30 minutes. The live sweep
2233
+ is the shared one, `dist/conformance/sweep.js --provider morph`; its scope is the key's account.
2234
+
2235
+ ### Sources
2236
+
2237
+ Morph's OpenAPI (`https://cloud.morph.so/api/openapi.json`), its docs (`https://cloud.morph.so/docs/documentation/instances/ttl`),
2238
+ and its SDKs: `morph-python-sdk` `morphcloud/api.py` (`ssh_connect`) and `morph-typescript-sdk` `src/api.ts` (the
2239
+ gateway and its login), read 2026-11-16. No live run yet.
2240
+
2139
2241
  ## Orgo: Windows and macOS desktops (parked)
2140
2242
 
2141
2243
  Orgo offers its Linux desktop alone, which runs computerd (`src/orgo.ts`). Its Windows and macOS desktops are parked:
@@ -2400,6 +2502,10 @@ const made = await phones.create({ image: "android", lifetimeMs: 10 * 60_000, ne
2400
2502
  (phone-harness.com). The phone harness bills it at 5 cents a minute from the account's credit. A cloud iPhone (driven by
2401
2503
  the API's control URL) is a later change: `platform: "ios"` is refused in words.
2402
2504
 
2505
+ - **Apps.** `apks: [{ path, sha256 }]`, else `env.PHONE_HARNESS_APKS` (its descriptor's hostEnv, a comma list of
2506
+ `<absolute path>@sha256:<hex>`), names APK files on this machine that each phone installs (`pm install -r`) before
2507
+ phoned starts, once per phone. A file not there, or whose bytes are not its pin, refuses `create()` before a phone is
2508
+ rented, and `connect()`.
2403
2509
  - **phoned, the phone's driver.** `connect()` asks the phone harness for the session's adb link, connects to it,
2404
2510
  unlocks the phone with the session's code (never in a result or an error) and probes it. Then it starts phoned
2405
2511
  (`daemon-android/`, one dex jar built by `npm run build:phoned` into `dist/phoned.jar`) and speaks the protocol to it:
@@ -2502,6 +2608,143 @@ through `ui.observe` (`src/conformance/cases/settings.ts`):
2502
2608
 
2503
2609
  `touch.pinch` skips in the provider's own refusal.
2504
2610
 
2611
+ ## boxd
2612
+
2613
+ ```ts
2614
+ import { providerFor } from "@parcha/agentrun-computer";
2615
+
2616
+ // The key is the caller's to pass (serve's BOXD_API_KEY), and the @boxd-sh/sdk package is the host's own (npm 0.3.1).
2617
+ const boxd = await providerFor("boxd", { apiKey, org: "my-org", region: "fra" });
2618
+ const made = await boxd.create({ image: "default", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
2619
+ ```
2620
+
2621
+ A boxd computer is a [boxd](https://boxd.sh?ref=agentrun) machine: a KVM microVM running Ubuntu 24.04, with its own
2622
+ kernel and disk. It is kind `linux` by default, and kind `desktop` with `kind: "desktop"`: computerd starts Xvfb itself,
2623
+ as on E2B and a Docker desktop, and its X11 shim drives it. boxd runs on the shared machine-host adapter
2624
+ ([PROVIDERS.md](PROVIDERS.md)): `src/boxd.ts` is boxd's `MachineHost`, its SDK slice and the mapping of a boxd machine
2625
+ to a machine, and `src/hosted/provider.ts` does everything that is not boxd's own (the computer's name, idempotent
2626
+ create, the upload, the install, init's start, the stdio bridge, the probe, the janitor's extend, delete-then-wait-gone,
2627
+ the sweep of a create that lands late). Every call goes through the host's boxd TypeScript SDK, the `@boxd-sh/sdk`
2628
+ package's `Boxd` class, of which `src/boxd.ts` names only the slice it calls and imports nothing at load. The package is
2629
+ the host's to install, as E2B's and Modal's are; this repository pins it as a root devDependency for the live tests.
2630
+
2631
+ ### The desktop snapshot
2632
+
2633
+ boxd's own image (`"default"`) has Xvfb but lists none of a desktop's stock apps (Xfce's text editor and terminal,
2634
+ xterm), so a boxd desktop starts from a snapshot that adds one. `prepareImage()` answers it by name,
2635
+ `agentrun-desktop-<12 hex>`, the hash of the recipe in `src/boxd.ts`, so a new recipe is a new snapshot. When the
2636
+ key's org has none, it builds it once, telling `onWait` "build" first:
2637
+
2638
+ 1. `machines.create` of an isolated machine of boxd's own image, named `agentrun-desktop-build-<8 hex>`, with no labels
2639
+ (a restore carries a snapshot's labels over to every machine made from it) and boxd's delete timer at 2 hours;
2640
+ 2. the recipe as root through the image user's passwordless sudo: `apt-get install mousepad` (Ubuntu's universe), its
2641
+ `org.xfce.mousepad.desktop` checked;
2642
+ 3. `snapshots.create` under the name, read until boxd says `ready`;
2643
+ 4. the build machine deleted and read gone, pass, fail or cancel: the id create answered, read through `get` (a
2644
+ lagging list can't hide it), and any machine of its name in the org's list, so a create whose reply was lost is
2645
+ cleaned up too. One that can't be deleted within 2 minutes fails the call in words
2646
+ (after the build's own error, when it failed), and boxd's delete timer ends it.
2647
+
2648
+ A cancelled call makes no build machine, and a cancel while one starts stops the wait. Two servers that build the
2649
+ first snapshot of an org at once each pay for a build machine; both captures land under the one name, and boxd keeps
2650
+ the latest.
2651
+
2652
+ The snapshot stays in the org: it is the image of every boxd desktop, and the next `prepareImage()` finds it with no
2653
+ build. One that failed, or that boxd archived (it makes no machine from an archived snapshot), is refused in words:
2654
+ delete it with `boxd snapshots remove`, and the next call builds it anew. A sandbox's `prepareImage()` answers
2655
+ `"default"` with no call.
2656
+
2657
+ A desktop asked for on `"default"` is refused in words, and so is a desktop with `vcpu` and `memory`: a restore keeps
2658
+ the size the snapshot was captured at (the org's default). The box image's recipe (`box/install.sh`) is not used here:
2659
+ it is written for Debian's `python:3.12-slim`, not Ubuntu, and it takes sudo away, while boxd's exec runs as the
2660
+ image's user, which reaches root through sudo alone.
2661
+
2662
+ ### Settings
2663
+
2664
+ `create(options)` takes the key as `options.apiKey` and nowhere else, and refuses in words without it. It reads no
2665
+ setting from the environment: serve passes its own `BOXD_API_KEY`, `BOXD_ORG` and `BOXD_REGION`, and the conformance
2666
+ module the `COMPUTER_BOXD_*` names it reads. The provider gives the SDK the key, the API's address and the region
2667
+ explicitly, so the SDK takes none of them from the environment.
2668
+
2669
+ | Option | Meaning | Unset |
2670
+ | --- | --- | --- |
2671
+ | `apiKey` | the boxd API key | required |
2672
+ | `org` | the org machines are made in and listed from, by name or id | the key's own |
2673
+ | `region` | the region machines are made in (`fra`, `nyc`) | the API's home region |
2674
+ | `baseUrl` | the API's address | `https://boxd.sh:9443` |
2675
+ | `vcpu`, `memory` | a boxd size: 1 and `4G`, 2 and `8G`, 4 and `16G`, or 8 and `32G`; both or neither; a sandbox's alone | the org's default |
2676
+ | `kind` | `linux` or `desktop` (from the desktop snapshot) | `linux` |
2677
+ | `maxLifetimeMs` | the longest lifetime `check` takes, at most 30 days | 24 h |
2678
+ | `daemonUser` | uid:gid the daemon runs as; never root, never the image's own user (1000) | `2510:2510` |
2679
+ | `daemonPath`, `desktop`, `timeouts`, `probeTargets` | as on E2B | |
2680
+
2681
+ ### The mapping
2682
+
2683
+ | MachineHost | boxd |
2684
+ | --- | --- |
2685
+ | `create` | `machines.create` with the adapter's name and labels, the org, `isolated: true` (the machine joins none of the org's networks and holds no in-machine credential), `config.autoSuspendTimeout: 0` and the size; any image but `"default"` is a snapshot, restored with `fromSnapshot`; `deleteAfter` at the request's `backstopAt`, 5 minutes past the most it may live. Its own client, bounded by `createMs` and never sent twice. Then `machines.waitUntilReady`, `setEgressAllow(id, ["none"])` and `setAutoHibernateTimeout(id, 0)`: boxd's idle timers watch network traffic, and a computer's programs may work for a long time with none |
2686
+ | `get` | `machines.get`: the labels, the state and `createdAt`; a machine of another org is none |
2687
+ | `list` | `machines.list` by the labels, in the org |
2688
+ | `delete` | `machines.delete`; not found is done |
2689
+ | `exec` | one `machines.streamExec` of the argv quoted; boxd runs it as the image's user (`boxd`, uid 1000) with passwordless sudo, and the adapter's scripts `sudo -n` to root. `kill` cancels the stream: boxd ends the process group |
2690
+ | `upload` | `files.upload` |
2691
+ | `extend` | `machines.updateLabels({ set })` of the janitor's deadline label |
2692
+ | `errorCode` | the SDK's error names (`NotFoundError`, `AuthenticationError`, `RateLimitError`, `ConflictError`, ...), then an `APIStatusError`'s gRPC code (3 invalid, 4 and 14 timeout, 8 limit, 9 refused) |
2693
+ | `check` | `"default"` or a snapshot's name, a desktop's a snapshot alone, and no snapshot when the provider names a size (a restore has the snapshot's); no `cpus` or `memoryMb` in the spec (the size is the provider's); label names of 1 to 63 of `a-z0-9._/-`, not `boxd/` |
2694
+
2695
+ `get` reads the state: `suspended` (standby that wakes on the next call) and `migrating` run; `hibernated` and
2696
+ `stopped` are stopped; `failed`, `destroyed` and any status it does not know are gone. boxd keeps a name to one
2697
+ machine, so a create that loses a race for its name is `exists`, and the adapter's retry finds the machine by its name.
2698
+
2699
+ boxd's in-machine agent, which carries the SDK's exec and file calls, listens on TCP 57073. Init starts with
2700
+ `--own-network`, so the daemon and every program it starts run in a network namespace of their own, their loopback
2701
+ alone (see [Init, the socket and the bridge](#init-the-socket-and-the-bridge)): `vendorAgentPorts` declares 57073, and
2702
+ `isolation.vendor-agent` checks that a program of the computer's user reaches it on neither loopback.
2703
+
2704
+ ### Capabilities
2705
+
2706
+ | Capability | Declared | Why |
2707
+ | --- | --- | --- |
2708
+ | `kind` | `linux` (default) or `desktop` | `options.kind`; a desktop's X server is computerd's own, on the desktop snapshot |
2709
+ | `lifetime` | `janitor` | the janitor deletes a computer past its deadline label, and init ends every process at the deadline itself; boxd's own delete timer ends it 5 minutes past the most it may live, even when the server that made it is gone |
2710
+ | `network` | `none` | the egress allowlist `["none"]`, and the daemon's own network namespace, read from inside by the probe |
2711
+ | `networkReadBack` | `false` | as on every vendor on the adapter |
2712
+ | `isolation` | `microvm` | a KVM microVM with its own kernel |
2713
+ | `daemon` | `child` | boxd's agent runs the commands; init is a detached command it starts |
2714
+ | `groups` | `exec`, `files`, `processes`, and on a desktop `screen`, `input.pointer`, `input.keys`, `apps` | checked against hello on every connect |
2715
+ | `maxLifetimeMs` | 24 h, up to 30 days | `options.maxLifetimeMs`; boxd sets no cap of its own |
2716
+ | `release` | `delete` | `machines.delete` |
2717
+ | `mount` | none | the run's folder on an Archil disk needs box/Dockerfile's tools in the machine; not built for boxd yet |
2718
+ | `vendorAgentPorts` | `[57073]` | boxd's in-machine agent |
2719
+
2720
+ ### Conformance on boxd
2721
+
2722
+ ```sh
2723
+ AGENTRUN_COMPUTER_LIVE_BOXD=1 COMPUTER_BOXD_API_KEY=... npm run conformance -w @parcha/agentrun-computer -- --provider boxd
2724
+ AGENTRUN_COMPUTER_LIVE_BOXD=1 COMPUTER_BOXD_API_KEY=... npm run test:boxd -w @parcha/agentrun-computer
2725
+ node packages/computer/dist/conformance/sweep.js --provider boxd --before /tmp/boxd-before.json # then --after
2726
+ ```
2727
+
2728
+ The conformance module, `dist/conformance/boxd.js`, checks `AGENTRUN_COMPUTER_LIVE_BOXD=1` before it reads anything
2729
+ else, then reads `COMPUTER_BOXD_API_KEY` (`apiKey`, required), `COMPUTER_BOXD_ORG` (`org`), `COMPUTER_BOXD_REGION`
2730
+ (`region`), `COMPUTER_BOXD_DAEMON` (`daemonPath`), `COMPUTER_BOXD_KIND` (`kind`) and `COMPUTER_BOXD_USER`
2731
+ (`daemonUser`), never `BOXD_API_KEY`, and caps every computer of a run at 30 minutes. `conformanceImage()` is
2732
+ `COMPUTER_BOXD_IMAGE`, else `"default"` for a sandbox and for a desktop the desktop snapshot, which it finds or builds
2733
+ first through the provider's `prepareImage()` (so a desktop run may build it, and leaves it in the org on purpose), and `createDriftedProvider()` uploads a daemon built with Go as
2734
+ `<version>-drift`. `createHost()` is the generic sweep's host, and `sweepScope()` names where it lists (the org, the
2735
+ region and the key by its sha256 prefix), so `--after` refuses a before file listed with another. `test/boxd/conformance.boxd.test.mjs` runs the suite
2736
+ with `computerd-fixture` built for linux/amd64, and skips unless the switch and `COMPUTER_BOXD_API_KEY` are both set.
2737
+
2738
+ ### Live runs
2739
+
2740
+ On 2026-11-12, against boxd with an org key, the provider as first written (before it moved onto the shared adapter)
2741
+ passed Core on both kinds: `kind linux` 62/62, `kind desktop` 68/68, and the CLI's run of `--provider boxd` 63/63.
2742
+ Every run left no computer behind. On 2026-11-14, the host on the shared adapter passed Core on `kind linux`, 63/63
2743
+ (Full 5/36, the rest not declared), in 179 s, and the sweep after it read `{"swept":0,"gone":0,"stillThere":[],"leftAlone":0}`.
2744
+ On 2026-11-16, `kind linux` passed Core again and `kind desktop` did not: 0 cases failed, but six Core cases were
2745
+ skipped, five because the run passed no `--fixture`, and `apps.launch-terminate` because boxd's own image lists none
2746
+ of the stock apps. The desktop snapshot above is the fix for the last; it has not run live yet.
2747
+
2505
2748
  ## Conformance
2506
2749
 
2507
2750
  A provider for another vendor passes the same suite as Docker's, with one command. The suite is data: each case in
@@ -2631,10 +2874,6 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
2631
2874
  path on a read-only mount is closed (BusyBox's `test -w` reads the mode bits alone, so the case reads the mount's
2632
2875
  options too). It checks write access alone and changes nothing.
2633
2876
  `mount.archil-isolated-durable` runs the same check on its Archil computer.
2634
- - **The label file** (`isolation.label-file`, Core wherever files runs): a host whose vendor keeps no labels
2635
- (`facts.labels: "machine"`) has the adapter write them to `/var/lib/agentrun/labels.json`, root's, 0600 in a 0700
2636
- directory. The case reads that path with `files.read`, as the computer's user, and passes on `not_found` (no such
2637
- file: a host that keeps labels at the vendor) or `denied`; it fails if the read succeeds.
2638
2877
  - **Core by kind.** `coreGroups(kind, daemon)` is what a computer of its kind must declare (the table in
2639
2878
  [The protocol extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)): exec, files,
2640
2879
  processes and network `none` wherever computerd runs, screen and keyboard and pointer on a desktop, screen and touch
@@ -2841,6 +3080,7 @@ AGENTRUN_COMPUTER_LIVE_DOCKER=1 npm run test:docker -w @parcha/agentrun-computer
2841
3080
  AGENTRUN_COMPUTER_LIVE_DAYTONA=1 COMPUTER_DAYTONA_API_KEY=... [COMPUTER_DAYTONA_SNAPSHOT=<snapshot>] npm run test:daytona -w @parcha/agentrun-computer
2842
3081
  AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal -w @parcha/agentrun-computer # also needs COMPUTER_MODAL_TOKEN_ID/SECRET, for an account you can bill
2843
3082
  AGENTRUN_COMPUTER_LIVE_E2B=1 npm run test:e2b -w @parcha/agentrun-computer # also needs COMPUTER_E2B_API_KEY, for an account you can bill, and the e2b package
3083
+ AGENTRUN_COMPUTER_LIVE_BOXD=1 npm run test:boxd -w @parcha/agentrun-computer # also needs COMPUTER_BOXD_API_KEY, for an account you can bill, and the @boxd-sh/sdk package
2844
3084
  ```
2845
3085
 
2846
3086
  `npm test` also runs `test/local-chrome-live.test.mjs` on a real Chrome where one is on PATH (or `CHROME_PATH` names
package/box/README.md CHANGED
@@ -22,6 +22,6 @@ Its tag is the recipe's hash: the first 12 hex of the sha256 of `Dockerfile`, `i
22
22
  files it copies (`recipe.mjs`). A changed recipe is a new image, and the same recipe is the one built before.
23
23
 
24
24
  Each release publishes it (`.github/workflows/release.yml`, the `box` job) as `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
25
- and `:<release tag>`, for linux/amd64, and builds the public E2B template `agentrun-archil-<recipe hash>` from it (the
26
- `box-e2b` job), which E2B's provider starts in any account as `boxE2bTemplate()` (`src/box-image.ts`). The build-*
25
+ and `:<release tag>`, for linux/amd64, and builds the public E2B template `agentrun-archil-<recipe hash>` from it in the
26
+ same job, which E2B's provider starts in any account as `boxE2bTemplate()` (`src/box-image.ts`). The build-*
27
27
  scripts here say how to build it for each provider.
package/box/build-e2b.mjs CHANGED
@@ -10,7 +10,7 @@
10
10
  // it install.sh's checked step runs again, and the Dockerfile's USER and CMD are the template's (recipe.mjs onImage).
11
11
  //
12
12
  // --public makes the template public once it is built (E2B's v2 PATCH /v2/templates/{id}, public: true), so another
13
- // team's sandbox starts from it, and prints the names E2B gives it. release.yml's box-e2b job runs both.
13
+ // team's sandbox starts from it, and prints the names E2B gives it. release.yml's box job runs both.
14
14
  import { dirname, join } from "node:path";
15
15
  import { fileURLToPath } from "node:url";
16
16
  import { parseArgs } from "node:util";
@@ -5,12 +5,10 @@ export declare function boxRecipeHash(): string;
5
5
  /** The published box image this package's recipe names: ghcr.io/parcha-ai/agentrun-box:<recipe hash>. */
6
6
  export declare const boxImageRef: () => string;
7
7
  /**
8
- * The E2B team that publishes the box template: release.yml's box-e2b job builds the box image as the E2B template
8
+ * The E2B team that publishes the box template: release.yml's box job builds the box image as the E2B template
9
9
  * agentrun-archil-<recipe hash> (box/build-e2b.mjs --image --public) in this team, and makes it public, so any E2B
10
10
  * account starts it as <team slug>/<template>. The slug is E2B's name for the publishing team.
11
11
  */
12
12
  export declare const BOX_E2B_PUBLISHER = "agentrun-oss";
13
13
  /** The public E2B template of the box image this package's recipe names: <publisher>/agentrun-archil-<recipe hash>. */
14
14
  export declare const boxE2bTemplate: () => string;
15
- /** Whether an image is a box image by its name: this release's or an older one's, whatever the recipe hash. */
16
- export declare const isBoxImage: (image: string) => boolean;
package/dist/box-image.js CHANGED
@@ -15,20 +15,10 @@ export function boxRecipeHash() {
15
15
  /** The published box image this package's recipe names: ghcr.io/parcha-ai/agentrun-box:<recipe hash>. */
16
16
  export const boxImageRef = () => `${BOX_IMAGE_REPOSITORY}:${boxRecipeHash()}`;
17
17
  /**
18
- * The E2B team that publishes the box template: release.yml's box-e2b job builds the box image as the E2B template
18
+ * The E2B team that publishes the box template: release.yml's box job builds the box image as the E2B template
19
19
  * agentrun-archil-<recipe hash> (box/build-e2b.mjs --image --public) in this team, and makes it public, so any E2B
20
20
  * account starts it as <team slug>/<template>. The slug is E2B's name for the publishing team.
21
21
  */
22
22
  export const BOX_E2B_PUBLISHER = "agentrun-oss";
23
23
  /** The public E2B template of the box image this package's recipe names: <publisher>/agentrun-archil-<recipe hash>. */
24
24
  export const boxE2bTemplate = () => `${BOX_E2B_PUBLISHER}/agentrun-archil-${boxRecipeHash()}`;
25
- const literal = (text) => text.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
26
- /**
27
- * Every name a box image goes by, a prefix and a recipe hash (12 hex): the published image
28
- * (ghcr.io/parcha-ai/agentrun-box:<hash>), Agent37's workspace template (agentrun-box-<hash>), the E2B template and the
29
- * Daytona snapshot (agentrun-archil-<hash>, the public E2B one under its publisher), and Daytona's GPU snapshots
30
- * (agentrun-archil-gpu-<type>-<hash>).
31
- */
32
- const BOX_IMAGE_NAME = new RegExp(`^(?:${literal(BOX_IMAGE_REPOSITORY)}:|agentrun-box-|(?:${literal(BOX_E2B_PUBLISHER)}/)?agentrun-archil-(?:gpu-[a-z0-9]+-)?)[0-9a-f]{12}$`);
33
- /** Whether an image is a box image by its name: this release's or an older one's, whatever the recipe hash. */
34
- export const isBoxImage = (image) => BOX_IMAGE_NAME.test(image);
package/dist/boxd.d.ts ADDED
@@ -0,0 +1,126 @@
1
+ import { HostedProvider, type HostedOptions } from "./hosted/provider.js";
2
+ import type { CallContext } from "./provider.js";
3
+ import { type Result } from "./result.js";
4
+ /** A machine as the SDK reports it (Machine, models.d.ts), as far as this host reads it. */
5
+ export interface BoxdMachine {
6
+ id: string;
7
+ name: string;
8
+ status: string;
9
+ labels: Record<string, string>;
10
+ org: {
11
+ id: string;
12
+ name: string;
13
+ } | null;
14
+ createdAt: Date | null;
15
+ }
16
+ /** A streamed exec (ExecStream, exec.d.ts): stdout is the stream itself. */
17
+ export interface BoxdExecStream extends AsyncIterable<Uint8Array> {
18
+ readonly stderr: AsyncIterable<Uint8Array>;
19
+ write(data: Uint8Array): void;
20
+ end(): void;
21
+ wait(): Promise<number>;
22
+ close(): void;
23
+ }
24
+ /** The SDK's machines namespace, as far as this host calls it (Machines, machines.d.ts). */
25
+ export interface BoxdMachines {
26
+ /** deleteAfter: seconds from now until boxd deletes the machine, whatever it is doing. */
27
+ create(params: {
28
+ name: string;
29
+ org?: string;
30
+ labels?: Record<string, string>;
31
+ isolated: true;
32
+ config: {
33
+ autoSuspendTimeout: 0;
34
+ vcpu?: number;
35
+ memory?: string;
36
+ };
37
+ fromSnapshot?: string;
38
+ deleteAfter?: number;
39
+ }): Promise<BoxdMachine>;
40
+ get(id: string): Promise<BoxdMachine>;
41
+ list(params: {
42
+ org?: string;
43
+ labels: Record<string, string>;
44
+ }): Promise<Iterable<BoxdMachine>>;
45
+ delete(id: string): Promise<void>;
46
+ streamExec(id: string, params: {
47
+ command: string;
48
+ }): BoxdExecStream;
49
+ readonly files: {
50
+ upload(id: string, path: string, data: Uint8Array): Promise<number>;
51
+ };
52
+ waitUntilReady(id: string, params: {
53
+ timeout: number;
54
+ }): Promise<BoxdMachine>;
55
+ setEgressAllow(id: string, entries: string[]): Promise<string[]>;
56
+ setAutoHibernateTimeout(id: string, seconds: number): Promise<void>;
57
+ updateLabels(id: string, params: {
58
+ set: Record<string, string>;
59
+ }): Promise<Record<string, string>>;
60
+ }
61
+ /** A snapshot as the SDK reads one (Snapshot, models.d.ts), as far as this host reads it. */
62
+ export interface BoxdSnapshot {
63
+ name: string;
64
+ /** "pending" until the capture lands, then "ready" or "failed" (ArtifactStatus). */
65
+ status: string;
66
+ /** True unless its bytes are on a worker's disk: boxd makes no machine from it until boxd's operator unarchives it. */
67
+ archived: boolean;
68
+ storage: string;
69
+ }
70
+ /** The SDK's snapshots namespace, as far as this host calls it (Snapshots, snapshots.d.ts). */
71
+ export interface BoxdSnapshots {
72
+ /** Captures a running machine (memory and disk) under the name; answers before the capture lands. */
73
+ create(machine: string, name: string): Promise<unknown>;
74
+ get(name: string, params: {
75
+ org?: string;
76
+ }): Promise<BoxdSnapshot>;
77
+ }
78
+ /** The SDK's Boxd class: given the key, the address and the region ("" is home) so it reads none from the environment. */
79
+ export type BoxdClientClass = new (options: {
80
+ apiKey: string;
81
+ baseURL: string;
82
+ region: string;
83
+ timeout: number;
84
+ maxRetries?: number;
85
+ }) => {
86
+ readonly machines: BoxdMachines;
87
+ readonly snapshots: BoxdSnapshots;
88
+ };
89
+ export interface BoxdProviderOptions extends HostedOptions {
90
+ /** The boxd API key: the caller passes it; the provider never reads it from the environment or puts it in a computer. */
91
+ apiKey: string;
92
+ Boxd: BoxdClientClass;
93
+ /** The org (name or id) machines are made in and listed from. Unset: the key's own. */
94
+ org?: string;
95
+ /** "fra", "nyc", ... Unset: the API's home region. */
96
+ region?: string;
97
+ /** Default https://boxd.sh:9443, the SDK's own. */
98
+ baseUrl?: string;
99
+ /** A boxd size, both or neither: 1 and 4G, 2 and 8G, 4 and 16G, 8 and 32G. Unset: the org's default. */
100
+ vcpu?: number;
101
+ memory?: string;
102
+ }
103
+ export type BoxdOptions = Omit<BoxdProviderOptions, "Boxd"> & {
104
+ Boxd?: BoxdClientClass;
105
+ };
106
+ /** A BoxdProvider from its options alone; throws in words when the key is missing, never echoing one. */
107
+ export declare function create(options: BoxdOptions): Promise<BoxdProvider>;
108
+ /** The conformance CLI's module for boxd. */
109
+ export declare const conformance: () => Promise<typeof import("./conformance/boxd.js")>;
110
+ /** The desktop snapshot this package's recipe names: agentrun-desktop-<12 hex of the recipe's sha256>. */
111
+ export declare const boxdDesktopSnapshot: () => string;
112
+ /**
113
+ * Computers that are boxd machines, on the shared adapter. A spec's image is "default" or a boxd snapshot's name. A
114
+ * server starts a sandbox from boxd's own image, and a desktop from the snapshot prepareImage() answers.
115
+ */
116
+ export declare class BoxdProvider extends HostedProvider {
117
+ /**
118
+ * The provider contract's prepareImage (its descriptor declares it). A sandbox: boxd's own image, with no call. A
119
+ * desktop: the desktop snapshot (boxdDesktopSnapshot) in the key's org, found or built once (BoxdHost.desktopSnapshot),
120
+ * so a new recipe is a new snapshot; onWait is told "build" once, before a build, never when the org has it.
121
+ */
122
+ prepareImage(context?: CallContext & {
123
+ onWait?: (making: "build" | "pull", tag: string) => void;
124
+ }): Promise<Result<string>>;
125
+ constructor(options: BoxdProviderOptions);
126
+ }