@parcha/agentrun-computer 0.1.0-beta.40 → 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.
- package/NOTICE +2 -0
- package/README.md +285 -28
- package/box/Dockerfile +6 -4
- package/box/README.md +10 -2
- package/box/build-daytona.py +3 -1
- package/box/build-e2b.mjs +1 -1
- package/box/install.sh +68 -7
- package/dist/attach.d.ts +46 -1
- package/dist/attach.js +48 -4
- package/dist/box-image.d.ts +1 -1
- package/dist/box-image.js +1 -1
- package/dist/boxd.d.ts +126 -0
- package/dist/boxd.js +418 -0
- package/dist/cloudflare.d.ts +32 -0
- package/dist/cloudflare.js +179 -0
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/boxd.d.ts +77 -0
- package/dist/conformance/boxd.js +113 -0
- package/dist/conformance/cases/isolation.js +1 -17
- package/dist/conformance/cases/provider.js +42 -26
- package/dist/conformance/cli.js +4 -1
- package/dist/conformance/cloudflare.d.ts +42 -0
- package/dist/conformance/cloudflare.js +54 -0
- package/dist/conformance/daytona.d.ts +25 -0
- package/dist/conformance/daytona.js +26 -1
- package/dist/conformance/dial-only.d.ts +6 -0
- package/dist/conformance/dial-only.js +9 -0
- package/dist/conformance/e2b.d.ts +12 -3
- package/dist/conformance/e2b.js +21 -4
- package/dist/conformance/exec-stream.js +14 -6
- package/dist/conformance/fly.d.ts +52 -0
- package/dist/conformance/fly.js +52 -0
- package/dist/conformance/modal.d.ts +15 -2
- package/dist/conformance/modal.js +36 -3
- package/dist/conformance/morph.d.ts +59 -0
- package/dist/conformance/morph.js +95 -0
- package/dist/conformance/phone-harness.js +2 -2
- package/dist/conformance/runner.js +5 -1
- package/dist/conformance/sweep.d.ts +1 -1
- package/dist/conformance/sweep.js +1 -1
- package/dist/conformance/types.d.ts +21 -0
- package/dist/daytona.d.ts +8 -1
- package/dist/daytona.js +124 -101
- package/dist/descriptor.d.ts +22 -1
- package/dist/descriptor.js +18 -0
- package/dist/descriptors/boxd.d.ts +52 -0
- package/dist/descriptors/boxd.js +29 -0
- package/dist/descriptors/cloudflare.d.ts +21 -0
- package/dist/descriptors/cloudflare.js +29 -0
- package/dist/descriptors/daytona.d.ts +12 -3
- package/dist/descriptors/daytona.js +15 -7
- package/dist/descriptors/e2b.d.ts +4 -0
- package/dist/descriptors/e2b.js +3 -0
- package/dist/descriptors/fly.d.ts +19 -0
- package/dist/descriptors/fly.js +28 -0
- package/dist/descriptors/index.d.ts +121 -2
- package/dist/descriptors/index.js +7 -2
- package/dist/descriptors/modal.d.ts +3 -0
- package/dist/descriptors/modal.js +7 -2
- package/dist/descriptors/morph.d.ts +15 -0
- package/dist/descriptors/morph.js +21 -0
- package/dist/descriptors/phone-harness.d.ts +1 -0
- package/dist/descriptors/phone-harness.js +2 -0
- package/dist/e2b.d.ts +7 -1
- package/dist/e2b.js +87 -44
- package/dist/fly.d.ts +43 -0
- package/dist/fly.js +245 -0
- package/dist/host.d.ts +52 -48
- package/dist/hosted/framed-exec.d.ts +8 -19
- package/dist/hosted/framed-exec.js +21 -87
- package/dist/hosted/process.d.ts +21 -0
- package/dist/hosted/process.js +37 -2
- package/dist/hosted/provider.d.ts +32 -6
- package/dist/hosted/provider.js +239 -236
- package/dist/hosted/rest.d.ts +19 -0
- package/dist/hosted/rest.js +76 -0
- package/dist/hosted/scripts.d.ts +52 -8
- package/dist/hosted/scripts.js +118 -23
- package/dist/hosted/ssh-exec.d.ts +9 -7
- package/dist/hosted/ssh-exec.js +93 -54
- package/dist/hosted/values.d.ts +5 -0
- package/dist/hosted/values.js +9 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/kinds.d.ts +2 -0
- package/dist/modal.d.ts +6 -0
- package/dist/modal.js +40 -17
- package/dist/morph.d.ts +65 -0
- package/dist/morph.js +495 -0
- package/dist/phone-harness.d.ts +15 -5
- package/dist/phone-harness.js +50 -15
- package/dist/providers.d.ts +4 -2
- package/dist/screen-watch.js +2 -2
- 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
|
|
41
|
-
|
|
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
|
|
@@ -443,7 +444,7 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
443
444
|
| id | label | kinds | keys (required unless marked) | mounts | metered |
|
|
444
445
|
| --- | --- | --- | --- | --- | --- |
|
|
445
446
|
| docker | Docker | sandbox, desktop | none | bind | no |
|
|
446
|
-
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET` (optional) | none (`unmounted`: archil) | yes |
|
|
447
|
+
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET`, `DAYTONA_ARCHIL_EGRESS` (optional) | none (`unmounted`: archil); archil with `DAYTONA_ARCHIL_EGRESS` (`mountsWith`) | yes |
|
|
447
448
|
| modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
|
|
448
449
|
| e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
|
|
449
450
|
| orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
|
|
@@ -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
|
|
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
|
|
@@ -914,9 +916,9 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
|
|
|
914
916
|
`{ other: "<words>" }` for a mount at `/workspace` the provider never makes. An Archil mount's `epoch` is the
|
|
915
917
|
computer's `agentrun.epoch` label (Archil's hold on a folder carries none); an Archil mount with no epoch reads back
|
|
916
918
|
as `{ other }`, in words. The token is never in a label, a read-back or an error.
|
|
917
|
-
- **An Archil egress gateway (`HostedOptions.archilEgress`).** For a target whose
|
|
918
|
-
Archil only through a gateway, `<IPv4 gateway>:<mount lane>:<data lane>` (such as
|
|
919
|
-
|
|
919
|
+
- **An Archil egress gateway (`HostedOptions.archilEgress`; Daytona's `DAYTONA_ARCHIL_EGRESS`).** For a target whose
|
|
920
|
+
runners reach Archil only through a gateway, `<IPv4 gateway>:<mount lane>:<data lane>` (such as
|
|
921
|
+
`192.0.2.40:18100:42050`), an Archil egress relay the operator runs. The helper's mount then starts `computerd archil-relay` on the computer's loopback (127.0.0.1:3129) and
|
|
920
922
|
an nftables table of its own (`inet agentrun_archil`) that redirects root's TCP to 8100 (the mount endpoint) and 32050
|
|
921
923
|
(the file servers, at the raw addresses the mount endpoint returns) to the relay and resets every other TCP to those
|
|
922
924
|
ports. The relay sends each connection to the gateway's lane for its port with a PROXY v2 header naming the original
|
|
@@ -1259,7 +1261,9 @@ runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests
|
|
|
1259
1261
|
stdio command runs the daemon only while its path is root's alone. Root with no capability would still own every one
|
|
1260
1262
|
of them. attach reads the user back from inside and refuses root.
|
|
1261
1263
|
- **The stream** is the adapter's stdio command through `sandbox.exec`: its stdin and stdout are the `DaemonClient`'s
|
|
1262
|
-
stream. Modal has no kill for an exec, so
|
|
1264
|
+
stream. Modal has no kill for an exec, so every exec starts under the shared pid wrapper (`PID_WRAPPER`,
|
|
1265
|
+
`src/hosted/scripts.ts`), and the host's `kill` runs a second exec that kills that pid and every process under it,
|
|
1266
|
+
while it has the start time the wrapper read, then ends the exec's stdin.
|
|
1263
1267
|
- **Lifetime is Modal's.** Every sandbox's `timeoutMs` is its lifetime, rounded up to whole seconds, so Modal ends it
|
|
1264
1268
|
then whatever runs in it. The longest is 24 hours, or less with the `maxLifetimeMs` option; `check` refuses a longer
|
|
1265
1269
|
one with `checkLifetime`, the rule every provider shares. `sweep` refuses a Modal provider.
|
|
@@ -1358,7 +1362,7 @@ The conformance module, `dist/conformance/modal.js` (`--provider modal`), reads
|
|
|
1358
1362
|
(`settingsFromEnv`) and passes each to `create()` as its option: `COMPUTER_MODAL_TOKEN_ID` and
|
|
1359
1363
|
`COMPUTER_MODAL_TOKEN_SECRET` (never `MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET`: a host may hold a production token under
|
|
1360
1364
|
those names, and with only them set it refuses, naming the `COMPUTER_MODAL_` pair), `COMPUTER_MODAL_APP`, and, if set,
|
|
1361
|
-
`COMPUTER_MODAL_SERVER_URL
|
|
1365
|
+
`COMPUTER_MODAL_SERVER_URL` and `COMPUTER_MODAL_CONNECT` (`connect`). It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
|
|
1362
1366
|
anything else. Its `createDriftedProvider()` uploads a daemon it builds with Go as version `<version>-drift`, so Go must
|
|
1363
1367
|
be on PATH. Every computer of a run gets `maxLifetimeMs` 30 minutes. Core `provider.stop` expects Modal's refusal (it
|
|
1364
1368
|
declares no stop), and the Full `provider.janitor` case is skipped (`lifetime:janitor`, `release:stop`).
|
|
@@ -1375,6 +1379,18 @@ Its output is `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`, as for ev
|
|
|
1375
1379
|
file records where it listed, the app and the server (`sweepScope`), and `--after` refuses, exit 2, before it lists
|
|
1376
1380
|
anything, a file of another app or server, or one that names none: every computer there would read as new.
|
|
1377
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
|
+
|
|
1378
1394
|
## Daytona
|
|
1379
1395
|
|
|
1380
1396
|
```ts
|
|
@@ -1396,9 +1412,20 @@ the sandbox from its default snapshot; the provider never guesses a snapshot's n
|
|
|
1396
1412
|
`default` is reached by its id.) Create records the image it was asked for in the label `agentrun.computer.image`,
|
|
1397
1413
|
beside the deadline's in the provider's own namespace, and attach reports that as `image`.
|
|
1398
1414
|
|
|
1399
|
-
Daytona takes no mount of the run's folder: Archil's client hangs on its
|
|
1400
|
-
`statx` of the mountpoint), so
|
|
1401
|
-
`
|
|
1415
|
+
On Daytona's hosted cloud, a Daytona computer takes no mount of the run's folder: Archil's client hangs on its
|
|
1416
|
+
sandboxes (its FUSE session never answers a `statx` of the mountpoint), so a provider made without `archilEgress`
|
|
1417
|
+
declares `capabilities().mount` `[]`, and `check()` refuses an Archil mount up front, code `refused`, in the
|
|
1418
|
+
descriptor's `unmounted.archil` words, before anything is asked of Daytona.
|
|
1419
|
+
|
|
1420
|
+
A self-hosted Daytona target whose sandboxes reach Archil through an Archil egress relay does mount it (a run there
|
|
1421
|
+
completed in Mode 2 on 11-14). Give that relay as `archilEgress` (`DAYTONA_ARCHIL_EGRESS` in Settings,
|
|
1422
|
+
`COMPUTER_DAYTONA_ARCHIL_EGRESS` for conformance), `<IPv4 gateway>:<mount lane>:<data lane>`, checked at construction
|
|
1423
|
+
as the adapter checks it. The provider then declares `capabilities().mount` `["archil"]` (the descriptor's
|
|
1424
|
+
`mountsWith`, through `mountsOf`), `check()` takes an Archil mount, the sandbox is made with network for the mount's
|
|
1425
|
+
root steps (`networkBlockAll` false), and the helper's mount and revoke go through the relay. The computer starts from a
|
|
1426
|
+
snapshot of `box/Dockerfile` (`box/build-daytona.py` prints its name), with the daemon user `2510:2510`. A GPU
|
|
1427
|
+
computer still takes no mount: Daytona's GPU host gives no `/dev/fuse`. Set `archilEgress` only for such a target: on
|
|
1428
|
+
the hosted cloud the mount would hang until its bound.
|
|
1402
1429
|
|
|
1403
1430
|
### Lifetimes
|
|
1404
1431
|
|
|
@@ -1420,7 +1447,10 @@ does. The provider itself never stops one: `release` takes `delete` alone and re
|
|
|
1420
1447
|
Daytona runs its own toolbox daemon as the sandbox's first process, and a snapshot we do not build has no `computerd`.
|
|
1421
1448
|
So the provider pushes it in at create and starts it, and reaches it the same way. Every command is a session command
|
|
1422
1449
|
of its own (`runAsync`, `suppressInputEcho`), its argv one shell line, its output read from the command's log stream,
|
|
1423
|
-
its exit code from the session
|
|
1450
|
+
its exit code from the session once that stream ends (the toolbox ends it once the command's exit code is written,
|
|
1451
|
+
`apps/daemon/internal/util/log_reader.go`), so a command that runs for hours costs no call while it runs. These are
|
|
1452
|
+
`framedExec`'s pieces (`src/hosted/framed-exec.ts`). The session is deleted once the command ends, or when the
|
|
1453
|
+
provider ends it:
|
|
1424
1454
|
|
|
1425
1455
|
1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random>`:
|
|
1426
1456
|
`/files/upload-v2`, or `/files/upload` when the toolbox answers 404 for it. An older toolbox, as a self-hosted
|
|
@@ -1719,7 +1749,7 @@ made instead of making a second.
|
|
|
1719
1749
|
An E2B computer is a sandbox made from an E2B template. The descriptor names no default: it says `prepareImage`, and
|
|
1720
1750
|
`prepareImage()` answers the box template, `boxE2bTemplate()` (`src/box-image.ts`), with no call and no wait. That is
|
|
1721
1751
|
`<BOX_E2B_PUBLISHER>/agentrun-archil-<recipe hash>`, the box image (`box/Dockerfile`: the archil client and helper,
|
|
1722
|
-
the tool user, FUSE, Xvfb, xfwm4 and the apps) that the release's `box
|
|
1752
|
+
the tool user, FUSE, Xvfb, xfwm4 and the apps) that the release's `box` job builds as a template in the publishing
|
|
1723
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
|
|
1724
1754
|
mode. It is kind `desktop`: computerd starts the X server and xfwm4 itself (`src/desktop.ts`), as on a Docker desktop,
|
|
1725
1755
|
and its X11 shim drives it. With `kind: "linux"` it is kind `linux` on any template, with no display: the same
|
|
@@ -1943,9 +1973,26 @@ also sweeps its own label through the host at its end (the report's `cleanup.swe
|
|
|
1943
1973
|
The conformance module's `settingsFromEnv` reads these names, and the sweep reads them through it (`createHost`),
|
|
1944
1974
|
each passed to `create()` as the option in brackets: `COMPUTER_E2B_API_KEY` (`apiKey`, required),
|
|
1945
1975
|
`COMPUTER_E2B_DOMAIN` (`domain`), `COMPUTER_E2B_DAEMON` (`daemonPath`), `COMPUTER_E2B_KIND` (`kind`),
|
|
1946
|
-
`COMPUTER_E2B_MAX_LIFETIME_MS` (`maxLifetimeMs`, a whole number of ms)
|
|
1947
|
-
refuses while `E2B_SANDBOX_URL` is set in the environment it reads, as the
|
|
1948
|
-
`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`.
|
|
1949
1996
|
|
|
1950
1997
|
### What waits for a live run
|
|
1951
1998
|
|
|
@@ -1990,7 +2037,8 @@ of the key's workspace on its first run ([below](#the-desktop-agentrun-box)).
|
|
|
1990
2037
|
`create(options)` takes the workspace's API key as `options.apiKey` and the private half of an SSH key registered on
|
|
1991
2038
|
the same workspace (`POST /v1/ssh-keys`, or `agent37 ssh-keys add`) as `options.sshKey`, its contents, never a path:
|
|
1992
2039
|
the provider reads no file and no environment. A key pasted into Settings comes back on one line (a password field
|
|
1993
|
-
drops line breaks), so the provider wraps a one-line key's body again before ssh2 reads it.
|
|
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
|
|
1994
2042
|
`Authorization: Bearer <key>`; the SSH tunnel's edge takes the same key in `X-Agent37-Key` (npm `agent37@0.4.1`
|
|
1995
2043
|
`src/cli.js`, `wsHandshake` and `runTunnel`). Neither key appears in an error, a note or a label: the sweep's scope
|
|
1996
2044
|
names the API key by its sha256 prefix alone.
|
|
@@ -2015,13 +2063,14 @@ label and keeps the oldest by `created` (whole seconds; ties go to the lowest id
|
|
|
2015
2063
|
|
|
2016
2064
|
Agent37 has no SSH port on the internet: the instance's sshd answers on 22022 inside it, and the edge carries the SSH
|
|
2017
2065
|
stream as binary WebSocket frames. `exec` opens a WebSocket (Node's global one takes `headers`), wraps it as a Duplex
|
|
2018
|
-
for ssh2's `Client.connect({ sock })`, and runs argv
|
|
2019
|
-
|
|
2066
|
+
for ssh2's `Client.connect({ sock })`, and runs argv under the shared pid wrapper (`PID_WRAPPER`,
|
|
2067
|
+
`src/hosted/scripts.ts`), which puts the process's pid and start time first on stderr; the provider takes that line
|
|
2068
|
+
off. stdout and stderr are the channel's, piped; stdin
|
|
2020
2069
|
is open until `end()`, which the adapter calls at once for a command it gives no input. `wait()` answers at the channel's close with the exit-status, or -1 for an exit by
|
|
2021
2070
|
signal or none; its listeners go on inside ssh2's callback, since one read off the tunnel can hold the open, the exit
|
|
2022
2071
|
and the close together (seen live: a listener added after an `await` missed the exit). `kill()` runs a second command
|
|
2023
|
-
on the same connection that kills the pid
|
|
2024
|
-
|
|
2072
|
+
on the same connection, `pidKill`, that kills the pid and every process under it while it has that start time (a child
|
|
2073
|
+
that left the process group too), then closes the exec's channel, never a connection. An SSH signal request is not used: ssh2 sends one only
|
|
2025
2074
|
while stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one process, not its children.
|
|
2026
2075
|
|
|
2027
2076
|
Every exec on an instance is a channel on one SSH connection that the provider shares: the daemon's upload, its install,
|
|
@@ -2032,7 +2081,7 @@ opens at the first exec (the four tries below), and a connection that closed or
|
|
|
2032
2081
|
channel that fails to open (the connection died under it, or its sshd took no more sessions) is opened once more on a
|
|
2033
2082
|
fresh connection. One connection carries at most 10 channels at once, execs and kills alike, and the next opens a second:
|
|
2034
2083
|
OpenSSH's sshd takes 10 sessions on a connection (`MaxSessions`). A kill's channel goes on any connection with room, since
|
|
2035
|
-
the pid
|
|
2084
|
+
the pid is the instance's. With no channel left, a connection waits 2 s for the next exec, then ends: an open one
|
|
2036
2085
|
keeps the process alive (ssh2's keepalive timer and the WebSocket's socket), so a process done with its computers exits
|
|
2037
2086
|
at most that late. `delete` ends every connection to the instance at once, a retired one still carrying channels too.
|
|
2038
2087
|
|
|
@@ -2119,6 +2168,76 @@ errors; instance-sizing; vm-instances; instance-network; ssh; templates; custom-
|
|
|
2119
2168
|
`agent37@0.4.1` `src/cli.js` (the tunnel); `ssh2@1.17.0` (`lib/client.js`, `lib/Channel.js`, `lib/utils.js`); and
|
|
2120
2169
|
the live runs above.
|
|
2121
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
|
+
|
|
2122
2241
|
## Orgo: Windows and macOS desktops (parked)
|
|
2123
2242
|
|
|
2124
2243
|
Orgo offers its Linux desktop alone, which runs computerd (`src/orgo.ts`). Its Windows and macOS desktops are parked:
|
|
@@ -2383,6 +2502,10 @@ const made = await phones.create({ image: "android", lifetimeMs: 10 * 60_000, ne
|
|
|
2383
2502
|
(phone-harness.com). The phone harness bills it at 5 cents a minute from the account's credit. A cloud iPhone (driven by
|
|
2384
2503
|
the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
2385
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()`.
|
|
2386
2509
|
- **phoned, the phone's driver.** `connect()` asks the phone harness for the session's adb link, connects to it,
|
|
2387
2510
|
unlocks the phone with the session's code (never in a result or an error) and probes it. Then it starts phoned
|
|
2388
2511
|
(`daemon-android/`, one dex jar built by `npm run build:phoned` into `dist/phoned.jar`) and speaks the protocol to it:
|
|
@@ -2485,6 +2608,143 @@ through `ui.observe` (`src/conformance/cases/settings.ts`):
|
|
|
2485
2608
|
|
|
2486
2609
|
`touch.pinch` skips in the provider's own refusal.
|
|
2487
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
|
+
|
|
2488
2748
|
## Conformance
|
|
2489
2749
|
|
|
2490
2750
|
A provider for another vendor passes the same suite as Docker's, with one command. The suite is data: each case in
|
|
@@ -2614,10 +2874,6 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2614
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
|
|
2615
2875
|
options too). It checks write access alone and changes nothing.
|
|
2616
2876
|
`mount.archil-isolated-durable` runs the same check on its Archil computer.
|
|
2617
|
-
- **The label file** (`isolation.label-file`, Core wherever files runs): a host whose vendor keeps no labels
|
|
2618
|
-
(`facts.labels: "machine"`) has the adapter write them to `/var/lib/agentrun/labels.json`, root's, 0600 in a 0700
|
|
2619
|
-
directory. The case reads that path with `files.read`, as the computer's user, and passes on `not_found` (no such
|
|
2620
|
-
file: a host that keeps labels at the vendor) or `denied`; it fails if the read succeeds.
|
|
2621
2877
|
- **Core by kind.** `coreGroups(kind, daemon)` is what a computer of its kind must declare (the table in
|
|
2622
2878
|
[The protocol extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)): exec, files,
|
|
2623
2879
|
processes and network `none` wherever computerd runs, screen and keyboard and pointer on a desktop, screen and touch
|
|
@@ -2824,6 +3080,7 @@ AGENTRUN_COMPUTER_LIVE_DOCKER=1 npm run test:docker -w @parcha/agentrun-computer
|
|
|
2824
3080
|
AGENTRUN_COMPUTER_LIVE_DAYTONA=1 COMPUTER_DAYTONA_API_KEY=... [COMPUTER_DAYTONA_SNAPSHOT=<snapshot>] npm run test:daytona -w @parcha/agentrun-computer
|
|
2825
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
|
|
2826
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
|
|
2827
3084
|
```
|
|
2828
3085
|
|
|
2829
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/Dockerfile
CHANGED
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
#
|
|
20
20
|
# No sudo and no sudoers file: the image's user is root, so the provider's own exec (Daytona's toolbox, Modal's exec,
|
|
21
21
|
# E2B's commands as root) runs the helper as root, and the tool user has no way to root. The build fails if the base
|
|
22
|
-
# brings either. computerd is not part of the image: the provider uploads and installs it, root's alone, at create,
|
|
23
|
-
# the
|
|
22
|
+
# brings either. computerd is not part of the image: the provider uploads and installs it, root's alone, at create (or,
|
|
23
|
+
# on a machine that dials the server, agentrun-dial fetches it from the server, checked by sha256), and the helper's
|
|
24
|
+
# serve runs that one.
|
|
24
25
|
#
|
|
25
26
|
# /proc with hidepid=2 is not part of an image: the helper remounts /proc so before each mount, as root, and refuses the
|
|
26
27
|
# mount in a computer where that fails.
|
|
@@ -35,5 +36,6 @@ RUN sh /tmp/agentrun-box/install.sh && rm -rf /tmp/agentrun-box
|
|
|
35
36
|
|
|
36
37
|
USER root
|
|
37
38
|
# A computer's first process is its provider's own (Daytona's runs this when a snapshot names no entrypoint; Modal's and
|
|
38
|
-
# E2B's are their own): never the base image's python.
|
|
39
|
-
|
|
39
|
+
# E2B's are their own): never the base image's python. A machine whose create set AGENTRUN_ATTACH_URL dials the server
|
|
40
|
+
# instead (install.sh's agentrun-dial).
|
|
41
|
+
CMD ["sh", "-c", "[ -z \"${AGENTRUN_ATTACH_URL-}\" ] || exec agentrun-dial; exec sleep infinity"]
|
package/box/README.md
CHANGED
|
@@ -10,10 +10,18 @@ Every step of the build is `install.sh`, POSIX shell run as root on the Dockerfi
|
|
|
10
10
|
account from a running machine (a snapshot, a blueprint, a template) boots that base, copies both files into one folder,
|
|
11
11
|
runs `sh install.sh` as root and snapshots the result. A second run on the same machine ends the same.
|
|
12
12
|
|
|
13
|
+
The image also serves a vendor that boots it with env but has no exec stream into it: the machine dials the server
|
|
14
|
+
(`spec/computer/attach.md`). `install.sh` writes `agentrun-dial` to `/usr/local/bin`, root's, 0755, and the
|
|
15
|
+
Dockerfile's `CMD` runs it when the provider's create set `AGENTRUN_ATTACH_URL`, and `sleep infinity` otherwise, so
|
|
16
|
+
one image serves both. It fetches the server's `computerd` with the machine's token (`AGENTRUN_DAEMON_URL`), checks it
|
|
17
|
+
against `AGENTRUN_DAEMON_SHA256` before anything runs, starts `computerd init $AGENTRUN_INIT_ARGS` in a clean
|
|
18
|
+
environment, and becomes `computerd attach` with `AGENTRUN_ATTACH_URL` and `AGENTRUN_ATTACH_TOKEN` alone in its
|
|
19
|
+
environment. A vendor whose own entrypoint must stay the machine's first process runs `agentrun-dial` from it.
|
|
20
|
+
|
|
13
21
|
Its tag is the recipe's hash: the first 12 hex of the sha256 of `Dockerfile`, `install.sh` and `agentrun-archil`, the
|
|
14
22
|
files it copies (`recipe.mjs`). A changed recipe is a new image, and the same recipe is the one built before.
|
|
15
23
|
|
|
16
24
|
Each release publishes it (`.github/workflows/release.yml`, the `box` job) as `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
|
|
17
|
-
and `:<release tag>`, for linux/amd64, and builds the public E2B template `agentrun-archil-<recipe hash>` from it
|
|
18
|
-
|
|
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-*
|
|
19
27
|
scripts here say how to build it for each provider.
|
package/box/build-daytona.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Build the Archil image (this folder's Dockerfile) as a Daytona snapshot, with Daytona's Python SDK (`pip install
|
|
2
2
|
# daytona`) and its key in DAYTONA_API_KEY, and print the snapshot's name, which a Daytona computer's spec names as its
|
|
3
|
-
# image
|
|
3
|
+
# image: a Daytona computer with an Archil mount, on a self-hosted target with an Archil egress relay (archilEgress),
|
|
4
|
+
# starts from it (on Daytona's hosted cloud Archil's client hangs, so no computer there takes the mount). The name is
|
|
5
|
+
# the recipe's hash (the Dockerfile and the files it copies, install.sh among them), so a changed recipe is
|
|
4
6
|
# a new snapshot, and the same recipe is the one built before: Daytona then refuses the name, and the printed name is
|
|
5
7
|
# the one to use. Its size is 2 CPUs, 4 GB of memory and a 10 GB disk.
|
|
6
8
|
#
|
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
|
|
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";
|