@parcha/agentrun-computer 0.1.0-beta.36 → 0.1.0-beta.38
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 +547 -478
- package/box/Dockerfile +18 -1
- package/box/README.md +13 -0
- package/box/build-agent37.mjs +158 -0
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +41 -18
- package/box/recipe.mjs +43 -0
- package/dist/agent37-ssh.d.ts +89 -0
- package/dist/agent37-ssh.js +445 -0
- package/dist/agent37.d.ts +104 -0
- package/dist/agent37.js +402 -0
- package/dist/attach.d.ts +146 -0
- package/dist/attach.js +469 -0
- package/dist/browserbase.d.ts +2 -10
- package/dist/browserbase.js +3 -6
- package/dist/client.d.ts +45 -4
- package/dist/client.js +92 -4
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +4 -0
- package/dist/conformance/agent37.d.ts +96 -0
- package/dist/conformance/agent37.js +154 -0
- package/dist/conformance/cases/apps.d.ts +11 -0
- package/dist/conformance/cases/apps.js +173 -73
- package/dist/conformance/cases/health.js +14 -0
- package/dist/conformance/cases/index.js +2 -0
- package/dist/conformance/cases/isolation.d.ts +7 -5
- package/dist/conformance/cases/isolation.js +44 -14
- package/dist/conformance/cases/mount.js +1 -1
- package/dist/conformance/cases/provider.js +27 -1
- package/dist/conformance/cases/screen.d.ts +3 -0
- package/dist/conformance/cases/screen.js +18 -0
- package/dist/conformance/cases/settings.d.ts +29 -23
- package/dist/conformance/cases/settings.js +76 -58
- package/dist/conformance/cases/touch.js +19 -17
- package/dist/conformance/cases/ui.d.ts +2 -0
- package/dist/conformance/cases/ui.js +475 -0
- package/dist/conformance/cli.d.ts +9 -0
- package/dist/conformance/cli.js +94 -9
- package/dist/conformance/daytona.d.ts +9 -20
- package/dist/conformance/daytona.js +12 -21
- package/dist/conformance/e2b.d.ts +6 -0
- package/dist/conformance/e2b.js +9 -2
- package/dist/conformance/exec-stream.d.ts +45 -0
- package/dist/conformance/exec-stream.js +486 -0
- package/dist/conformance/fixture.d.ts +1 -1
- package/dist/conformance/fixture.js +25 -1
- package/dist/conformance/modal.d.ts +17 -13
- package/dist/conformance/modal.js +18 -9
- package/dist/conformance/orgo.d.ts +3 -3
- package/dist/conformance/orgo.js +6 -8
- package/dist/conformance/phone-harness.d.ts +6 -2
- package/dist/conformance/phone-harness.js +21 -4
- package/dist/conformance/report.js +1 -1
- package/dist/conformance/runner.js +23 -4
- package/dist/conformance/sweep.d.ts +50 -0
- package/dist/conformance/sweep.js +187 -0
- package/dist/conformance/types.d.ts +13 -5
- package/dist/conformance/ui-fixture.d.ts +56 -0
- package/dist/conformance/ui-fixture.js +43 -0
- package/dist/create-requests.d.ts +51 -0
- package/dist/create-requests.js +121 -0
- package/dist/daytona.d.ts +20 -133
- package/dist/daytona.js +405 -1449
- package/dist/descriptor.d.ts +11 -1
- package/dist/descriptor.js +9 -0
- package/dist/descriptors/agent37.d.ts +41 -0
- package/dist/descriptors/agent37.js +28 -0
- package/dist/descriptors/daytona.d.ts +6 -5
- package/dist/descriptors/daytona.js +9 -5
- package/dist/descriptors/index.d.ts +42 -7
- package/dist/descriptors/index.js +4 -2
- package/dist/descriptors/orgo.d.ts +2 -1
- package/dist/descriptors/orgo.js +3 -2
- package/dist/descriptors/phone-harness.d.ts +1 -1
- package/dist/descriptors/phone-harness.js +2 -2
- package/dist/descriptors/shared.d.ts +1 -1
- package/dist/descriptors/shared.js +2 -2
- package/dist/desktop.d.ts +18 -4
- package/dist/desktop.js +89 -9
- package/dist/docker.d.ts +7 -10
- package/dist/docker.js +272 -34
- package/dist/drift.js +4 -4
- package/dist/e2b.d.ts +16 -290
- package/dist/e2b.js +230 -1393
- package/dist/fake-ui-driver.d.ts +97 -0
- package/dist/fake-ui-driver.js +717 -0
- package/dist/host.d.ts +201 -0
- package/dist/host.js +8 -0
- package/dist/hosted/process.d.ts +81 -0
- package/dist/hosted/process.js +259 -0
- package/dist/hosted/provider.d.ts +160 -0
- package/dist/hosted/provider.js +1415 -0
- package/dist/hosted/rest.d.ts +66 -0
- package/dist/hosted/rest.js +121 -0
- package/dist/hosted/scripts.d.ts +82 -0
- package/dist/{child.js → hosted/scripts.js} +118 -12
- package/dist/hosted/values.d.ts +5 -0
- package/dist/hosted/values.js +8 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -4
- package/dist/kernel.d.ts +2 -10
- package/dist/kernel.js +3 -6
- package/dist/kinds.d.ts +11 -2
- package/dist/kinds.js +20 -4
- package/dist/local-chrome.d.ts +2 -10
- package/dist/local-chrome.js +3 -6
- package/dist/modal.d.ts +22 -257
- package/dist/modal.js +183 -1280
- package/dist/mount-archil.d.ts +8 -4
- package/dist/mount-archil.js +22 -11
- package/dist/mount.d.ts +10 -4
- package/dist/mount.js +8 -4
- package/dist/orgo-channel.d.ts +3 -2
- package/dist/orgo-channel.js +5 -2
- package/dist/orgo-desktop.d.ts +9 -4
- package/dist/orgo-desktop.js +33 -13
- package/dist/orgo-workspaces.d.ts +47 -0
- package/dist/orgo-workspaces.js +94 -0
- package/dist/orgo.d.ts +10 -13
- package/dist/orgo.js +32 -21
- package/dist/phone-harness.d.ts +31 -28
- package/dist/phone-harness.js +510 -702
- package/dist/png.d.ts +4 -0
- package/dist/png.js +27 -0
- package/dist/protocol.d.ts +339 -33
- package/dist/protocol.js +97 -3
- package/dist/provider.d.ts +36 -8
- package/dist/provider.js +16 -0
- package/dist/providers.d.ts +11 -12
- package/dist/result.d.ts +1 -1
- package/dist/screen-watch.js +34 -6
- package/dist/surface/api.d.ts +260 -0
- package/dist/surface/api.js +1 -0
- package/dist/surface/core.d.ts +55 -0
- package/dist/surface/core.js +475 -0
- package/dist/surface/index.d.ts +5 -0
- package/dist/surface/index.js +3 -0
- package/dist/surface/outline.d.ts +10 -0
- package/dist/surface/outline.js +51 -0
- package/dist/surface/script.d.ts +10 -0
- package/dist/surface/script.js +94 -0
- package/dist/ui-engine.d.ts +114 -0
- package/dist/ui-engine.js +814 -0
- package/package.json +18 -3
- package/dist/child.d.ts +0 -42
- package/dist/conformance/daytona-sweep.d.ts +0 -18
- package/dist/conformance/daytona-sweep.js +0 -126
- package/dist/conformance/e2b-diagnose.d.ts +0 -16
- package/dist/conformance/e2b-diagnose.js +0 -61
- package/dist/conformance/e2b-sweep.d.ts +0 -18
- package/dist/conformance/e2b-sweep.js +0 -132
- package/dist/conformance/modal-sweep.d.ts +0 -22
- package/dist/conformance/modal-sweep.js +0 -213
package/README.md
CHANGED
|
@@ -21,12 +21,12 @@ option types (`DockerProviderOptions`, `ModalProviderOptions` and the like) come
|
|
|
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
|
|
23
23
|
vendor's SDK is the host's: Modal's `modal` package is imported only when the Modal provider is built, and the package
|
|
24
|
-
depends on nothing. A provider's mount kinds are its
|
|
25
|
-
which loads
|
|
24
|
+
depends on nothing. A provider's mount kinds are its descriptor's `mounts`, read with `descriptorOf(id).mounts`,
|
|
25
|
+
which loads no provider file at all.
|
|
26
26
|
|
|
27
27
|
Every install carries all of `dist/`, whatever the host's architecture and whichever provider it uses: both daemons
|
|
28
28
|
(a Docker host on either architecture and every remote provider use one of them, and the archive does not know which),
|
|
29
|
-
every provider's module, and the conformance CLI and suite with the
|
|
29
|
+
every provider's module, and the conformance CLI and suite with the live sweep. At 0.1.0-beta.31 (`npm pack
|
|
30
30
|
--dry-run --json`) that is 122 files, 3,688,167 bytes packed and 9,234,731 unpacked; the two daemons are 8,216,900 of
|
|
31
31
|
the unpacked bytes (4,219,042 amd64, 3,997,858 arm64) and the conformance code 238,421. The trade: no Go, no download
|
|
32
32
|
and no install script on the host, for one daemon more than the host runs: about 4 MB unpacked and 1.6 MB compressed.
|
|
@@ -40,7 +40,7 @@ full VM, a machine. The protocol has two layers:
|
|
|
40
40
|
inside. It never runs commands itself: the daemon does. This package has four: Docker, Modal's VM runtime, Daytona
|
|
41
41
|
and E2B (desktops), each one line of the provider registry (see [Adding a computer](#adding-a-computer)).
|
|
42
42
|
|
|
43
|
-
The protocol is published as a spec, [`spec/computer/`](../../spec/computer/README.md), at protocol version 0.
|
|
43
|
+
The protocol is published as a spec, [`spec/computer/`](../../spec/computer/README.md), at protocol version 0.2
|
|
44
44
|
(`PROTOCOL_VERSION`, which `hello` carries as `protocol`). Its JSON Schema and constants are generated from
|
|
45
45
|
`src/protocol.ts` by `node scripts/generate-computer-spec.mjs`, and a test fails when they drift.
|
|
46
46
|
|
|
@@ -49,12 +49,12 @@ The protocol is published as a spec, [`spec/computer/`](../../spec/computer/READ
|
|
|
49
49
|
The daemon answers `hello`, `ping`, `exec.run`, the `files.*` methods, `tar.*`, the `process.*` methods and
|
|
50
50
|
`deadline.extend`; hello reports kind `linux` and groups `["exec", "files", "processes"]` (see [The protocol
|
|
51
51
|
extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)). With an X display it also answers
|
|
52
|
-
`screen.shot`, `screen.read
|
|
53
|
-
`input.keys` (see [The X11 shim](#the-x11-shim)).
|
|
52
|
+
`screen.shot`, `screen.read`, `input.actions` and the `apps.*` methods, and reports kind `desktop` with `screen`,
|
|
53
|
+
`input.pointer`, `input.keys` and `apps` (see [The X11 shim](#the-x11-shim)).
|
|
54
54
|
|
|
55
55
|
```text
|
|
56
56
|
→ {"jsonrpc":"2.0","id":1,"method":"hello","params":{"client":"me"}}
|
|
57
|
-
← {"jsonrpc":"2.0","id":1,"result":{"protocol":"0.
|
|
57
|
+
← {"jsonrpc":"2.0","id":1,"result":{"protocol":"0.2","version":"0.1.0-beta.30","os":"linux","kind":"linux","arch":"arm64","groups":["exec","files","processes"]}}
|
|
58
58
|
→ {"jsonrpc":"2.0","id":2,"method":"exec.run","params":{"argv":["uname","-m"],"timeoutMs":5000}}
|
|
59
59
|
← {"jsonrpc":"2.0","id":2,"result":{"exitCode":0,"stdout":"YWFyY2g2NAo=","stderr":"","timedOut":false,"truncated":false}}
|
|
60
60
|
```
|
|
@@ -96,7 +96,9 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
96
96
|
of its own to give (Modal), or whose images' privilege tools cannot be relied on (Daytona). Init starts as root,
|
|
97
97
|
makes `$HOME` and the socket's directory that user's alone (0700, never through a symbolic link), and becomes uid:gid
|
|
98
98
|
with no supplementary groups, dropping its privileges on the way as below: from there it is the daemon a Docker
|
|
99
|
-
computer runs.
|
|
99
|
+
computer runs. With `DISPLAY` set (a desktop), init first gives a uid and gid with no entry in `/etc/passwd` and
|
|
100
|
+
`/etc/group` one, named `agentrun-tool` (or `agentrun-<id>` when that name is taken), home `$HOME`, shell `/bin/sh`:
|
|
101
|
+
a desktop's programs look their user up (D-Bus's session bus, a terminal's shell). `--user 0:0` is root with no capability. Without
|
|
100
102
|
root, init refuses `--user` in words; a Docker computer is given its user by `docker run --user` and never passes it.
|
|
101
103
|
- `computerd init ... --user <uid:gid> --own-network` is how every remote provider starts init (Daytona, E2B, Modal).
|
|
102
104
|
A remote vendor runs its own agent in the computer beside the daemon's programs (Daytona's toolbox on 2280, E2B's
|
|
@@ -169,18 +171,24 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
169
171
|
environment, and exits with its code; a binary without cgo runs its tests itself, and a `-race` build (which needs
|
|
170
172
|
cgo) skips the tests of the drop. On a host as another user the refusal for EPERM and both deadline tests run (init
|
|
171
173
|
takes its deadline and refuses for the bounding set). The root path (`TestBecome...`, `TestUnprivilegedLeavesRoot...`)
|
|
172
|
-
needs root with capabilities and skips there; CI's `computer-docker` job covers it with the
|
|
173
|
-
(`test/docker/
|
|
174
|
+
needs root with capabilities and skips there; CI's `computer-docker` job covers it with the pid1 commands matrix
|
|
175
|
+
(`test/docker/pid1-commands.docker.test.mjs`: root containers with Docker's default capabilities and the two
|
|
174
176
|
`--own-network` needs, or `--cap-add ALL`, as 1000:1000, the refusal of 0:0 and the refusal without CAP_SETPCAP), and
|
|
175
177
|
computerd's end at its deadline with the Docker live tests. The test binaries (`CGO_ENABLED=0 go test -c`) also run
|
|
176
178
|
as root in a container by hand: `internal/isolate`'s and the isolated `TestBecome...` need CAP_SYS_ADMIN and
|
|
177
179
|
CAP_NET_ADMIN (`docker run --cap-add SYS_ADMIN --cap-add NET_ADMIN`), and the refusal without them a container
|
|
178
180
|
with Docker's defaults.
|
|
179
|
-
- `computerd probe [--connect <host:port>[/udp]]...` prints one JSON line: the uid and gid it runs as, the
|
|
180
|
-
release, `interfaces` (the network interfaces its network namespace holds: `["lo"]` alone under
|
|
181
|
-
`reached` (the targets that answered), `accepted` (the targets that accepted a TCP connection and
|
|
182
|
-
and `results`, each target's `protocol`, `outcome` (`refused`, `accepted` or `answered`), `bytes`
|
|
183
|
-
words.
|
|
181
|
+
- `computerd probe [--sockets] [--connect <host:port>[/udp]]...` prints one JSON line: the uid and gid it runs as, the
|
|
182
|
+
kernel's release, `interfaces` (the network interfaces its network namespace holds: `["lo"]` alone under
|
|
183
|
+
`--own-network`), `reached` (the targets that answered), `accepted` (the targets that accepted a TCP connection and
|
|
184
|
+
sent nothing back) and `results`, each target's `protocol`, `outcome` (`refused`, `accepted` or `answered`), `bytes`
|
|
185
|
+
and `detail` in words. With `--sockets` it adds the isolation case's two listings: `sockets`, the unix sockets it can
|
|
186
|
+
connect to, by path or by abstract name (`@...`, which its network namespace holds), and `listeners`, the TCP and UDP sockets that listen in its own network namespace (TCP in
|
|
187
|
+
LISTEN and UDP bound with no peer, read from `/proc/net/tcp`, `tcp6`, `udp` and `udp6`), each with its `protocol`,
|
|
188
|
+
`address`, `port`, `uid`, the `owner` that holds it (`pid N (command)`, where `/proc` shows that process's
|
|
189
|
+
descriptors) and `computerd` (that owner runs computerd's own program); each listing names in `incomplete` what it
|
|
190
|
+
could not search or read. `isolation.vendor-agent` fails on a listener that is not computerd's; under `--own-network`
|
|
191
|
+
computerd listens on nothing there, so on any listener. A provider whose vendor reads nothing back runs it through `exec.run` (below, Modal), under the rule in
|
|
184
192
|
[Network none, read from inside](#network-none-read-from-inside-nothing-answers). `computerd probe --diagnose` asks
|
|
185
193
|
more: for 1.1.1.1, 8.8.8.8, 9.9.9.9 and 151.101.1.57 (Fastly's anycast edge, which is no resolver) on 443/tcp,
|
|
186
194
|
80/tcp and 53/udp it reports `refused` (no TCP accept, no UDP answer), `accepted` (an accept, no answer) or
|
|
@@ -251,7 +259,7 @@ provider.
|
|
|
251
259
|
- **What it changes.** Only a provider that probes, on a vendor whose firewall accepts first, reads differently: E2B
|
|
252
260
|
([below](#network)), whose computers with network none the accept-counts rule refused, and are now kept with notes.
|
|
253
261
|
Docker reads its network back from `docker inspect` (`--network none` leaves no interface but `lo`, so a TCP
|
|
254
|
-
connection is refused outright and a UDP datagram has no route, which `test/docker/
|
|
262
|
+
connection is refused outright and a UDP datagram has no route, which `test/docker/pid1-commands.docker.test.mjs`
|
|
255
263
|
pins with the probe itself, every default target refused); Daytona reads `networkBlockAll` back from its API and runs
|
|
256
264
|
no probe; Modal's live run with `blockNetwork` read back no TCP accept at any target under the earlier accept-counts
|
|
257
265
|
rule, so nothing it accepted is newly let through. The UDP targets have not yet run live on Modal.
|
|
@@ -403,8 +411,8 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
403
411
|
| --- | --- | --- | --- |
|
|
404
412
|
| `none` | | | (the run's folder only: no computer) |
|
|
405
413
|
| `sandbox` | `linux` | `exec`, `files`, `processes` | |
|
|
406
|
-
| `desktop` | `desktop` | `screen`, `input.pointer`, `input.keys` | `exec`, `files`, `processes`, `apps`, `stream` |
|
|
407
|
-
| `phone` | `android`, `ios` | `screen`, `input.touch`, `apps` | `input.keys`, `apps.install`, `
|
|
414
|
+
| `desktop` | `desktop` | `screen`, `input.pointer`, `input.keys` | `exec`, `files`, `processes`, `apps`, `ui`, `stream` |
|
|
415
|
+
| `phone` | `android`, `ios` | `screen`, `input.touch`, `apps` | `input.keys`, `apps.install`, `ui`, `stream` |
|
|
408
416
|
| `browser` | `browser` | `cdp` | `stream`, `downloads` |
|
|
409
417
|
|
|
410
418
|
- `serves(capabilities, kind)` is true when `capabilities().kind` is one of the kind's machine kinds and every required
|
|
@@ -431,7 +439,7 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
431
439
|
| id | label | kinds | keys (required unless marked) | mounts | metered |
|
|
432
440
|
| --- | --- | --- | --- | --- | --- |
|
|
433
441
|
| docker | Docker | sandbox, desktop | none | bind | no |
|
|
434
|
-
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET
|
|
442
|
+
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET` (optional) | none (`unmounted`: archil) | yes |
|
|
435
443
|
| modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
|
|
436
444
|
| e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
|
|
437
445
|
| orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
|
|
@@ -440,9 +448,8 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
440
448
|
| kernel | Kernel | browser | `KERNEL_API_KEY` | none | yes |
|
|
441
449
|
| local | Local Chrome | browser | none | none | no |
|
|
442
450
|
|
|
443
|
-
-
|
|
444
|
-
|
|
445
|
-
in each configuration, to its entry's capabilities. browserbase and kernel are data until their provider file joins
|
|
451
|
+
- A provider's capabilities and mounts are its descriptor's, and nowhere else. A unit test holds each provider built
|
|
452
|
+
from the test fakes, in each configuration, to its entry's capabilities and mounts. browserbase and kernel are data until their provider file joins
|
|
446
453
|
the registry; that test then holds each to its file.
|
|
447
454
|
- `testConnection()` (optional on `ComputerProvider`) is Settings' test of a provider's keys: ONE account-level read
|
|
448
455
|
that never creates a computer, so it never spends. Docker (one `docker ps`), Daytona and E2B (one listing page) count
|
|
@@ -480,24 +487,24 @@ the screen (`provider.stream()`), the files a browser saved. A computerd hello n
|
|
|
480
487
|
|
|
481
488
|
**Daemon mode.** `capabilities().daemon` says who answers the methods. `pid1`: computerd init is the computer's main
|
|
482
489
|
process, so its exit ends the computer (Docker). `child`: the vendor's own agent is the main process and starts init at
|
|
483
|
-
boot; init's exit does not end the computer (Daytona, whose toolbox daemon
|
|
490
|
+
boot; init's exit does not end the computer (Daytona, whose toolbox daemon starts init detached), and it
|
|
484
491
|
must not run under a supervisor that restarts it. `none`: no computerd runs, and the provider answers the same methods
|
|
485
492
|
itself, from our server (adb, a vendor API). Either way a connection's `client` is a `ComputerClient` (`call(method,
|
|
486
493
|
params, { signal })` and `close()`): `DaemonClient` over a stream, or a provider's in-process client.
|
|
487
494
|
|
|
488
495
|
**Groups.** `capabilities().groups` is one flat list, repeated in hello's `groups`: `exec`, `files`, `processes`,
|
|
489
|
-
`screen`, `input.pointer`, `input.keys`, `input.touch`, `apps`, `apps.install`, `
|
|
496
|
+
`screen`, `input.pointer`, `input.keys`, `input.touch`, `apps`, `apps.install`, `ui`, and the provider's
|
|
490
497
|
`cdp`, `stream`, `downloads`. Each is optional unless kind makes it Core. The drift check and Docker's `connect` refuse a hello whose kind or groups differ from what the
|
|
491
498
|
provider declares, either way.
|
|
492
499
|
|
|
493
500
|
| group | methods |
|
|
494
501
|
| --- | --- |
|
|
495
|
-
| `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): the next frame once the screen or the pointer changed, else `changed: false` when `waitMs` (default 2000, at most 10000) is over. 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. |
|
|
502
|
+
| `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. |
|
|
496
503
|
| `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) |
|
|
497
504
|
| `input.keys` | `input.actions`: `key` (one key pressed, or a combo released in reverse; `repeat`), `hold` (`ms`), `type` |
|
|
498
505
|
| `input.touch` | `input.actions`: `tap`, `long_press`, `swipe`, `pinch` (`scale` above 1 apart, below together), `button` (back, home, app_switch) |
|
|
499
|
-
| `apps`, `apps.install` | `apps.list` (`{ apps, foreground }`), `apps.launch`, `apps.terminate`; `apps.install({ path })` of a file already in the computer |
|
|
500
|
-
| `
|
|
506
|
+
| `apps`, `apps.install` | `apps.list` (`{ apps, foreground }`), `apps.launch({ id, url?, background? })`, `apps.terminate`; `apps.install({ path })` of a file already in the computer |
|
|
507
|
+
| `ui` | `ui.observe({ target?, full?, image?, since? })`: `{ state, app, window, nodes, diff?, image?, truncated }`, at most 5000 flat nodes, each `{ ref, role, name?, value?, id?, bounds, parent?, flags?, actions? }` with an ARIA role and bounds in window points. `ui.act({ target?, state?, steps, expect?, foreground? })`: `{ steps, state?, window?, changed, expect? }`, each step's `route` and `verified`, or its refusal (`stale`, `denied`, ...) as the last; `window: "closed"` in place of `state` when the app has no window left. `expect` is `{ text?, ref?, gone?, timeoutMs? }`, or `{ window: { title?, role? } }` to wait for a window. The rules are in [`wire.md`](../../spec/computer/wire.md#the-ui-group); `UiEngine` (`src/ui-engine.ts`) keeps them over a `UiSource`, `UiSession` (`src/client.ts`) is the typed caller, and `@parcha/agentrun-computer/fake-ui-driver` answers them from scripted apps for tests |
|
|
501
508
|
|
|
502
509
|
**The live view's seam** (`src/screen-watch.ts`). The runner's viewer reads a computer through
|
|
503
510
|
`provider.watch?(ref, handlers, { signal?, maxWidth?, quality? })`:
|
|
@@ -512,7 +519,9 @@ provider declares, either way.
|
|
|
512
519
|
`daemonWatch` is the one implementation behind every provider's `watch()` (Docker, Daytona, Modal, E2B, Orgo, the
|
|
513
520
|
phone harness): a computer whose hello has no `screen` is refused as `unsupported`. It adapts the internal seam,
|
|
514
521
|
`watchScreen(connection, options)`: pull-paced `frames` (each `next()` the ack), `act(actions)` and `close()`, whose
|
|
515
|
-
failures are `ScreenWatchError`s.
|
|
522
|
+
failures are `ScreenWatchError`s. On a computer that lists `screen.ahead` it keeps a second ask in flight, one frame
|
|
523
|
+
ahead, so frames come at the screen's pace and not one each round trip; a frame bettered before `next()` asked for it
|
|
524
|
+
is dropped. `toAction(event, kind)` maps the viewer's `ViewerEvent`s, in the screen's upright
|
|
516
525
|
pixels, to input actions, or to a `Refusal` (`{ field, message }`) for what a kind cannot take:
|
|
517
526
|
- a desktop takes the mouse (a move, and a button down or up at a point; with a modifier held, the up is one click
|
|
518
527
|
with its keys and the down only moves; each up is one click, so a double-click is two and never a `count`), the
|
|
@@ -583,11 +592,26 @@ by its rectangle), so a longer one ends the connection before anything is alloca
|
|
|
583
592
|
`aborted`.
|
|
584
593
|
|
|
585
594
|
- The display is reached when it is first asked for, and again after it goes: hello declares `screen`,
|
|
586
|
-
`input.pointer` and `
|
|
587
|
-
start its X server through `process.start` after init is up. With no display (`DISPLAY` unset, nothing
|
|
588
|
-
XTEST) nothing is declared, and each method is `unsupported`, saying why.
|
|
595
|
+
`input.pointer`, `input.keys` and `apps`, and kind `desktop`, only while the display answers with XTEST. So a
|
|
596
|
+
provider may start its X server through `process.start` after init is up. With no display (`DISPLAY` unset, nothing
|
|
597
|
+
answering, no XTEST) nothing is declared, and each method is `unsupported`, saying why.
|
|
589
598
|
- Programs get no `DISPLAY` from the daemon (exec and process environments stay minimal): one that should show on the
|
|
590
|
-
display is given it in `env`.
|
|
599
|
+
display is given it in `env`. An app the `apps` group opens is given it.
|
|
600
|
+
- `apps` (`daemon/internal/apps`) answers as a Mac's does, the same methods and the same answers. `apps.list` reads the
|
|
601
|
+
desktop files of `$XDG_DATA_HOME/applications` and each of `$XDG_DATA_DIRS` (default `~/.local/share`, then
|
|
602
|
+
`/usr/local/share` and `/usr/share`), as the Desktop Entry spec says: the apps there are, by their desktop file ids
|
|
603
|
+
(`org.xfce.mousepad`), with their names; hidden and `NoDisplay` entries, and a `TryExec` that is not there, are left
|
|
604
|
+
out. Its `foreground` is the app of the window manager's active window, else of the top window. `apps.launch({ id,
|
|
605
|
+
url? })` takes an id, a name (`Mousepad`) or a program (`mousepad`), starts the entry's `Exec` (`url` in its `%u`/`%f`
|
|
606
|
+
field; an entry with none refuses a `url` as `invalid`) as `process.start` does with orphans `keep`, with `DISPLAY`,
|
|
607
|
+
and answers `{}` once a new window of the app shows, raised and focused (through the window manager's
|
|
608
|
+
`_NET_ACTIVE_WINDOW` when one runs, waiting up to 2 s for it to be the active window), so keys typed right after
|
|
609
|
+
reach it; none within 10 s is `timeout`, "no window within 10 s", and the app runs on. An
|
|
610
|
+
app already running with a window is brought to the front and answers at once, unless a `url` is given. A
|
|
611
|
+
window is the app's by the launch that made it (`_NET_WM_PID` and the process's parents), else by its `WM_CLASS`
|
|
612
|
+
(the entry's `StartupWMClass`, its id's last part or its program). `background` is `unsupported`: a Linux desktop
|
|
613
|
+
opens an app in front. `apps.terminate` sends TERM, then KILL, to the app's launches and its windows' processes, and
|
|
614
|
+
answers once none of its windows shows and none of its launches runs, a launch that never showed a window included.
|
|
591
615
|
- `screen.shot` is a PNG of the root window or a region inside it (one outside is `invalid`), with `scale` 1 and
|
|
592
616
|
`cursor` from `QueryPointer`. A connection holds one shot, until it is read to its end or the next shot; a
|
|
593
617
|
`screen.read` of another id is `not_found`.
|
|
@@ -663,7 +687,7 @@ fixtures of every evasion it catches.
|
|
|
663
687
|
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
664
688
|
|
|
665
689
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
666
|
-
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" });
|
|
690
|
+
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
667
691
|
if (!made.ok) throw new Error(made.error.message);
|
|
668
692
|
const connected = await docker.connect(made.value);
|
|
669
693
|
if (connected.ok) {
|
|
@@ -673,14 +697,21 @@ if (connected.ok) {
|
|
|
673
697
|
await docker.release(made.value, "delete");
|
|
674
698
|
```
|
|
675
699
|
|
|
700
|
+
Every `create` takes a request id (`CreateContext.requestId`, required): the request, not the computer, so a retry of
|
|
701
|
+
the same request passes the same id. The contract makes one computer per id, named `computer-<12 hex of sha256(id)>`
|
|
702
|
+
(`computerNameFor`), answers it again while it starts or runs, and refuses `exists` once it has ended
|
|
703
|
+
([`spec/computer/provider.md`](../../spec/computer/provider.md#idempotent-create)). Docker names the container for the
|
|
704
|
+
request: a retry finds the name taken and answers that container, or `exists` when it is stopped, of another spec, or
|
|
705
|
+
was deleted.
|
|
706
|
+
|
|
676
707
|
- `capabilities()` declares kind `linux`, daemon `pid1`, groups `exec`, `files` and `processes`, `maxLifetimeMs`
|
|
677
708
|
of 30 days, and `mount: ["bind"]` (below); there is no `extend()` or `stream()`, and init gets no `--max-deadline`.
|
|
678
|
-
- `new DockerProvider({ daemonPath, desktop: {} })` makes desktops: kind `desktop`, with `screen`, `input.pointer
|
|
679
|
-
`input.keys` too, on an image with an X server (`test/fixtures/desktop/Dockerfile` is Alpine and
|
|
709
|
+
- `new DockerProvider({ daemonPath, desktop: {} })` makes desktops: kind `desktop`, with `screen`, `input.pointer`,
|
|
710
|
+
`input.keys` and `apps` too, on an image with an X server (`test/fixtures/desktop/Dockerfile` is Alpine, Xvfb and xterm, the stock app `apps.launch-terminate` opens, about 50 MB).
|
|
680
711
|
`create` gives the daemon `DISPLAY` (`display`, default `:0`), then starts the X server through it with
|
|
681
712
|
`process.start` (`server`, default `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp`), as the computer's user and as any
|
|
682
713
|
program: computerd stays PID 1 and starts nothing itself, and the server is one process in its table that ends with
|
|
683
|
-
the computer. `create` waits (`timeoutMs`, default 30 s) until hello declares the display, then runs the drift check;
|
|
714
|
+
the computer. It runs no window manager. `create` waits (`timeoutMs`, default 30 s) until hello declares the display, then runs the drift check;
|
|
684
715
|
a server that ends first, with its last words on stderr, or a display that is not up in time deletes the computer in
|
|
685
716
|
words.
|
|
686
717
|
- `check(spec)` refuses in words, with no Docker call: no image, no or a bad `lifetimeMs` (`checkLifetime`: at most
|
|
@@ -724,7 +755,7 @@ await docker.release(made.value, "delete");
|
|
|
724
755
|
PID 1 included. What lasts is the run's folder, bound at `/workspace` when the spec asks (below).
|
|
725
756
|
- `create` ends with the drift check (below): a computer that is not what was declared is deleted, and `create`
|
|
726
757
|
refuses with every mismatch in words.
|
|
727
|
-
- `create(spec, { signal })` passes the signal to every step: `docker info` before `docker run` (an abort there makes
|
|
758
|
+
- `create(spec, { requestId, signal })` passes the signal to every step: `docker info` before `docker run` (an abort there makes
|
|
728
759
|
nothing), `docker run`, and after it inspect and hello (hello also has its own 30 s limit). An abort at any step after `docker run` deletes the computer and returns
|
|
729
760
|
`aborted`; `create` never returns ok once its signal has aborted.
|
|
730
761
|
- `connect` runs `docker exec -i <name> /opt/agentrun/computerd stdio`, the bridge to init's socket, and says hello.
|
|
@@ -767,7 +798,7 @@ daemon, or run past its deadline.
|
|
|
767
798
|
### An allowlist: the egress proxy
|
|
768
799
|
|
|
769
800
|
```ts
|
|
770
|
-
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: { allow: ["pypi.org", "*.pythonhosted.org", "93.184.215.0/24"] } });
|
|
801
|
+
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: { allow: ["pypi.org", "*.pythonhosted.org", "93.184.215.0/24"] } }, { requestId: "r1#3" });
|
|
771
802
|
// In the computer, HTTP_PROXY and HTTPS_PROXY name port 3128 on its own loopback for every program computerd starts.
|
|
772
803
|
```
|
|
773
804
|
|
|
@@ -852,16 +883,16 @@ import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
|
852
883
|
|
|
853
884
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
854
885
|
// The run folder must exist, by its canonical path, and be writable by docker.user (below).
|
|
855
|
-
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/runs/r1/work" } });
|
|
886
|
+
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/runs/r1/work" } }, { requestId: "r1#3" });
|
|
856
887
|
// In the computer: files.read({ path: `${WORKSPACE}/notes.md` }), exec.run({ argv: ["make"], cwd: WORKSPACE, ... })
|
|
857
888
|
```
|
|
858
889
|
|
|
859
890
|
- `ComputerSpec.mount` is `{ kind: "bind", path }`, a folder on the provider's host bound in (the local Docker
|
|
860
891
|
computer), or `{ kind: "archil", disk, region, folder, token }`, the run's folder (such as
|
|
861
892
|
`agents/<a>/runs/<r>/work`) inside an Archil disk in its region, mounted in a remote computer.
|
|
862
|
-
`capabilities().mount` lists the kinds a provider takes; absent, it takes none. Each provider
|
|
863
|
-
|
|
864
|
-
provider binds a local folder from
|
|
893
|
+
`capabilities().mount` lists the kinds a provider takes; absent, it takes none. Each provider's descriptor declares
|
|
894
|
+
the same kinds as `mounts` (Docker `["bind"]`; Modal and E2B `["archil"]`; Daytona `[]` for now), so a caller tells
|
|
895
|
+
which provider binds a local folder from its descriptor (`descriptorOf(id)`) without building one.
|
|
865
896
|
- `checkMount(mount, declared)` (`src/mount.ts`) is the one rule every provider's `check` runs, with no vendor call: a
|
|
866
897
|
kind the provider does not declare is refused in words (`this provider does not take a mount of kind archil; it takes
|
|
867
898
|
bind`); a bind's `path` is absolute, canonical (its own realpath, so what is read back is what is bound: Docker
|
|
@@ -874,7 +905,7 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
|
|
|
874
905
|
`{ other: "<words>" }` for a mount at `/workspace` the provider never makes. An Archil mount's `epoch` is the
|
|
875
906
|
computer's `agentrun.epoch` label (Archil's hold on a folder carries none); an Archil mount with no epoch reads back
|
|
876
907
|
as `{ other }`, in words. The token is never in a label, a read-back or an error.
|
|
877
|
-
- **An Archil egress gateway (
|
|
908
|
+
- **An Archil egress gateway (`HostedOptions.archilEgress`).** For a target whose runners reach
|
|
878
909
|
Archil only through a gateway, `<IPv4 gateway>:<mount lane>:<data lane>` (such as `10.60.0.40:18100:42050`, parcha-proxy's
|
|
879
910
|
archil-egress). The helper's mount then starts `computerd archil-relay` on the computer's loopback (127.0.0.1:3129) and
|
|
880
911
|
an nftables table of its own (`inet agentrun_archil`) that redirects root's TCP to 8100 (the mount endpoint) and 32050
|
|
@@ -920,7 +951,7 @@ const docker = new DockerProvider({
|
|
|
920
951
|
daemonCache: "/data/computer-cache", // at or below volume.root
|
|
921
952
|
volume: { name: "agentrun_agentrun-data", root: "/data" },
|
|
922
953
|
});
|
|
923
|
-
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/disk/agents/a1/runs/r1/work" } });
|
|
954
|
+
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/disk/agents/a1/runs/r1/work" } }, { requestId: "r1#3" });
|
|
924
955
|
```
|
|
925
956
|
|
|
926
957
|
- `volume: { name, root }`: `name` is the named volume, as `docker volume ls` names it; `root` is where this process
|
|
@@ -972,7 +1003,7 @@ import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
|
972
1003
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" }); // image: the default recipe
|
|
973
1004
|
const image = await docker.image({ signal }); // built once; one inspect when Docker has it
|
|
974
1005
|
if (!image.ok) throw new Error(image.error.message);
|
|
975
|
-
const made = await docker.create({ image: image.value, lifetimeMs: 600_000, network: "none" });
|
|
1006
|
+
const made = await docker.create({ image: image.value, lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
976
1007
|
```
|
|
977
1008
|
|
|
978
1009
|
- `ensureImage(source, { docker?, signal?, timeoutMs?, onWait? })` (`src/docker/image.ts`) gives the tag. `source` is
|
|
@@ -1154,7 +1185,7 @@ const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
|
1154
1185
|
// A claim at epoch 3 takes the run over: the computers of epochs 1 and 2 go first.
|
|
1155
1186
|
const older = await releaseOlder(docker, "r1", 3);
|
|
1156
1187
|
if (!older.ok) throw new Error(older.error.message); // fenced, or a computer that could not be released
|
|
1157
|
-
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", labels: runLabels("r1", 3) });
|
|
1188
|
+
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", labels: runLabels("r1", 3) }, { requestId: "r1#3" });
|
|
1158
1189
|
```
|
|
1159
1190
|
|
|
1160
1191
|
### Waiting for a vendor: `waitUntil`
|
|
@@ -1165,9 +1196,8 @@ reads at once, then after pauses that double from `minMs` (250 ms) to `maxMs` (5
|
|
|
1165
1196
|
returns the first state `done` accepts. Each read gets a signal that aborts at the bound or on the caller's abort; a
|
|
1166
1197
|
read still pending then is not waited for, and one that throws is not done. Past the bound it returns a `timeout`, on
|
|
1167
1198
|
the caller's abort an `aborted`, each naming `what` was waited for and the last state read (`describe`). It has no
|
|
1168
|
-
vendor's types:
|
|
1169
|
-
|
|
1170
|
-
sandbox, and the Daytona sweep wait through it too.
|
|
1199
|
+
vendor's types: the shared adapter's release, a create that deletes its machine, and the one live sweep wait through it
|
|
1200
|
+
(`settle`, until get answers none for a machine twice running; one read `gone` is still going), for every hosted vendor.
|
|
1171
1201
|
|
|
1172
1202
|
## Modal
|
|
1173
1203
|
|
|
@@ -1180,168 +1210,78 @@ const modal = new ModalProvider({
|
|
|
1180
1210
|
app: "computers",
|
|
1181
1211
|
// daemonPath: the daemon to upload; default this package's dist/computerd-linux-amd64 (npm run build:daemon)
|
|
1182
1212
|
});
|
|
1183
|
-
const made = await modal.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" });
|
|
1213
|
+
const made = await modal.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1184
1214
|
```
|
|
1185
1215
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1216
|
+
Modal runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/modal.ts` is Modal's `MachineHost`,
|
|
1217
|
+
the SDK's types (`import type`, erased at build) and the client it is made with, and
|
|
1218
|
+
`src/hosted/provider.ts` does everything below that is not Modal's own. `create` takes the caller's request id
|
|
1219
|
+
(`{ requestId }`, serve's is the run's claim): the computer's name is `computer-` and the first 12 hex digits of its
|
|
1220
|
+
sha256, and a retry of the same request finds the computer the first made instead of making a second. A Modal sandbox
|
|
1221
|
+
runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests read what the provider hands the SDK
|
|
1222
|
+
(a recorder of the slice), never how Modal behaves; Modal's own lifecycle is proven by the live conformance kit.
|
|
1189
1223
|
|
|
1190
1224
|
- **Capabilities.** Kind `linux`, daemon `pid1`, groups `exec`, `files` and `processes`, `maxLifetimeMs` the
|
|
1191
1225
|
instance's cap (24 hours, or less with the `maxLifetimeMs` option), and user `uid` only, never `root` (below). Daemon
|
|
1192
1226
|
`pid1` because init is the sandbox's main process and its exit ends the computer (next item); no `extend` or
|
|
1193
1227
|
`stream`. Network `none` alone, and `vendorAgentPorts` empty: no listener of Modal's inside a sandbox is documented,
|
|
1194
1228
|
and isolation.vendor-agent checks the interfaces alone.
|
|
1195
|
-
- **The
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
one call, 360 s by default): if no daemon arrives by then, the entrypoint says so on stderr and exits 3, which ends
|
|
1209
|
-
the sandbox.
|
|
1210
|
-
|
|
1211
|
-
Right after create the provider runs `sh -c '<upload>' sh /opt/agentrun/computerd <sha256>` through
|
|
1212
|
-
`sandbox.exec([...], { mode: "binary" })` and streams `dist/computerd-linux-amd64` into its stdin, in the SDK's own
|
|
1213
|
-
256 KiB stdin chunks, then closes it. The script `cat`s stdin to `/opt/agentrun/.computerd.part`, makes it 0755,
|
|
1214
|
-
prints `sha256 <hex>` (`sha256sum`, BusyBox's is fine), and only when that is the sha256 it was given moves the part
|
|
1215
|
-
into place with `mv -f`. The rename is what the entrypoint waits for, so it never starts a half-written daemon or the
|
|
1216
|
-
wrong one. The provider compares the printed sha256 with its own, as the Daytona provider does. A failed, aborted,
|
|
1217
|
-
nonzero or mismatched upload, or one past `uploadMs` (5 min), terminates the sandbox and refuses in words. Then the
|
|
1218
|
-
drift check connects as below, trying the bridge again until init listens, within `helloMs`. Exec's stdin goes
|
|
1219
|
-
through Modal's command router, not the sandbox's network, so network none still works. The binary cannot go as an
|
|
1220
|
-
argument: the SDK refuses more than 64 KiB of argv. `modalCommands()` (in `dist/modal.js`) returns the entrypoint,
|
|
1221
|
-
upload and bridge exactly as sent. A Docker-gated test runs them in a root container with no network.
|
|
1222
|
-
- **Or as an image layer**, with `daemonImage`: `create` gives the spec's image `COPY --from=<daemonImage> /computerd
|
|
1223
|
-
/opt/agentrun/computerd`, and the command is `computerd init` itself. The JS SDK refuses a COPY from local files but
|
|
1224
|
-
takes `COPY --from` an image, so `daemonImage` is a registry image holding this version's daemon for linux/amd64 at
|
|
1225
|
-
`/computerd`, pinned by digest (the constructor refuses a tag, and `daemonImage` with `daemonPath`). One is two
|
|
1226
|
-
lines:
|
|
1227
|
-
|
|
1228
|
-
```dockerfile
|
|
1229
|
-
FROM scratch
|
|
1230
|
-
COPY dist/computerd-linux-amd64 /computerd
|
|
1231
|
-
```
|
|
1232
|
-
|
|
1233
|
-
Either way the image also gets `ENV HOME=/work` and `WORKDIR <workdir>`, and the computer needs no network to get
|
|
1234
|
-
its daemon.
|
|
1229
|
+
- **The daemon goes in through exec.** The sandbox's command is the adapter's pid1 entrypoint (`src/hosted/scripts.ts`,
|
|
1230
|
+
POSIX sh, BusyBox and coreutils alike): it waits, bounded, for `/opt/agentrun/computerd` to be there and executable,
|
|
1231
|
+
then `exec`s `computerd init --deadline <iso> --user <uid:gid> --own-network --max-deadline <iso>` with `HOME=/work`.
|
|
1232
|
+
Modal runs the command as the sandbox's main process and finishes the sandbox when it exits, so after the `exec`
|
|
1233
|
+
init is that process and the sandbox lives as long as init does. Whether that process is PID 1 is not documented;
|
|
1234
|
+
init reaps as a subreaper either way. If no daemon arrives within the wait, the entrypoint says so on stderr and
|
|
1235
|
+
exits 3, which ends the sandbox. Modal has no file API, so the adapter streams the daemon into `cat` as root through
|
|
1236
|
+
`sandbox.exec([...], { mode: "binary" })` (stdin in 256 KiB writes, the SDK's own chunk), then runs the shared install:
|
|
1237
|
+
it puts the daemon beside its path, `/opt/agentrun/computerd.part`, and moves it into place only once it reads the
|
|
1238
|
+
sha256 uploaded, so the entrypoint never starts a half-written daemon or another one. Exec's stdin goes through
|
|
1239
|
+
Modal's command router, not the sandbox's network, so network none still works. A Docker-gated test
|
|
1240
|
+
(`test/docker/pid1-commands.docker.test.mjs`) runs the entrypoint, the install and the bridge in a root container with
|
|
1241
|
+
no network.
|
|
1235
1242
|
- **The daemon becomes the computer's user.** Modal containers always run as root and ignore an image's `USER`, so
|
|
1236
|
-
`--user` is how a Modal computer gets the non-root default the protocol asks for (
|
|
1237
|
-
or the uid its spec asks for. Init leaves itself and every program
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
`/opt/agentrun` and the daemon owned by root (COPY's default; the daemon keeps its mode from the daemon image), not
|
|
1248
|
-
yet read back on Modal. Root with no capability still owns every one of them, so it could rename another program over
|
|
1249
|
-
the daemon and the next connection would run it with Modal's capabilities; no file mode closes that for the owner
|
|
1250
|
-
of every directory above the path. The Docker-gated `modal-commands` test shows uid 1000 cannot write the daemon,
|
|
1251
|
-
`/opt/agentrun`, `/opt` or `/`, and that init `--own-network` refuses uid 0 for its programs outright.
|
|
1252
|
-
- **The stream** is `computerd stdio` through `sandbox.exec([...], { mode: "binary" })`: its stdin and stdout are the
|
|
1253
|
-
`DaemonClient`'s stream. Modal has no kill for an exec, so `close()` ends the bridge's stdin and waits up to 5 s for
|
|
1254
|
-
it to exit. One deadline, `helloMs`, covers the exec's start (at most `callMs` of it) and the hello after it, so a
|
|
1255
|
-
connection fails at `helloMs` in all. An exec given up on (past its bound, or on the caller's abort) goes on at
|
|
1256
|
-
Modal; a bridge that lands after that has its stdin closed as it lands, so it ends.
|
|
1243
|
+
`--user` is how a Modal computer gets the non-root default the protocol asks for (2510:2510, or the `daemonUser`
|
|
1244
|
+
option), or the uid its spec asks for (`spec.user`, a uid or uid:gid in numbers). Init leaves itself and every program
|
|
1245
|
+
no capability in any set (see Init, above).
|
|
1246
|
+
- **A Modal computer never runs as root.** `check()` and `create()` refuse a spec whose `user` is root, in words, before
|
|
1247
|
+
any Modal call. Every connection is Modal's own exec of the adapter's stdio command, outside the daemon, with Modal's
|
|
1248
|
+
root capabilities; after the install `/opt/agentrun/computerd` and `/opt/agentrun` are `0:0 755`, and `/` and `/opt`
|
|
1249
|
+
are the image's, `0:0 755` in Debian and Alpine, so a computer user that is not root cannot touch that path, and the
|
|
1250
|
+
stdio command runs the daemon only while its path is root's alone. Root with no capability would still own every one
|
|
1251
|
+
of them. attach reads the user back from inside and refuses root.
|
|
1252
|
+
- **The stream** is the adapter's stdio command through `sandbox.exec`: its stdin and stdout are the `DaemonClient`'s
|
|
1253
|
+
stream. Modal has no kill for an exec, so the host's `kill` ends the bridge's stdin, which ends it.
|
|
1257
1254
|
- **Lifetime is Modal's.** Every sandbox's `timeoutMs` is its lifetime, rounded up to whole seconds, so Modal ends it
|
|
1258
|
-
then whatever runs in it. The longest is 24 hours, or less with the `maxLifetimeMs` option
|
|
1259
|
-
|
|
1260
|
-
- **Network.** `none` is `blockNetwork: true`, and the daemon's programs have their own loopback alone besides
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
`
|
|
1265
|
-
`8.8.8.8:443`, `[2606:4700:4700::1111]:443`, and DNS over UDP to `1.1.1.1:53/udp` and
|
|
1266
|
-
`[2606:4700:4700::1111]:53/udp`, or the `probeTargets` option). A computer with network none that any of
|
|
1267
|
-
them answers is terminated at create, refused by attach, and reads back as another network in words; one that only
|
|
1268
|
-
accepted, sending nothing back, is kept, the targets named in `notes` (see
|
|
1269
|
-
[Network none, read from inside](#network-none-read-from-inside-nothing-answers)). This shows those addresses are
|
|
1270
|
-
blocked, not every one. An allowlist is refused: Modal's CIDR allowlist (any protocol,
|
|
1271
|
-
every port) and its domain allowlist (beta, TLS on 443 by SNI only) cannot be read back, so per ruling 9 an
|
|
1272
|
-
allowlist counts only once the live bypass cases pass. A change of network is refused: blockNetwork cannot be
|
|
1273
|
-
updated, and an allowlist only if one was set at create.
|
|
1274
|
-
- **The drift check** after create: `poll()` is null (it runs), `getTags()` reads back exactly the tags given, hello's
|
|
1275
|
-
version, os, arch (`amd64`), kind (`linux`) and exact groups match, and the probe's uid:gid is the computer's user, its kernel is
|
|
1276
|
-
not gVisor's (`4.19.0-gvisor`), and with network none none of its targets answered. A mismatch, an abort or a timeout
|
|
1277
|
-
terminates the sandbox and refuses in words. The SDK reads back no runtime, image or size: the probe's kernel is the
|
|
1278
|
-
only runtime read-back, and image and sizes are what create recorded in a tag only the host's token writes.
|
|
1255
|
+
then whatever runs in it. The longest is 24 hours, or less with the `maxLifetimeMs` option; `check` refuses a longer
|
|
1256
|
+
one with `checkLifetime`, the rule every provider shares. `sweep` refuses a Modal provider.
|
|
1257
|
+
- **Network.** `none` is `blockNetwork: true`, and the daemon's programs have their own loopback alone besides; an
|
|
1258
|
+
Archil computer's sandbox keeps Modal's network on for root to reach Archil, and its tools' none is init's own. Modal
|
|
1259
|
+
has no read-back of a sandbox's policy, so `networkReadBack` is false and the probe from inside stands for one, at
|
|
1260
|
+
create, attach and `network(ref)` (see [Network none, read from inside](#network-none-read-from-inside-nothing-answers)).
|
|
1261
|
+
`open` and an allowlist are refused in words, and a change of network after create is refused.
|
|
1279
1262
|
- **Sizes are limits**, as in Docker: `cpus` (at least 0.25) becomes `cpuLimit` in physical cores (2 CPUs each) and
|
|
1280
|
-
`memoryMb` becomes `memoryLimitMiB`, each with Modal's default request (0.125 cores, 128 MiB) or less. `pids`
|
|
1281
|
-
refused: Modal has no pids limit.
|
|
1282
|
-
- **Tags.** A sandbox
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
Modal ends a sandbox asynchronously, so after the terminate `release` polls (`untilFinished`, on `waitUntil` above) until `poll()` reads
|
|
1291
|
-
an exit code or Modal no longer knows the sandbox, with pauses that double from `releasePollMs` (500 ms) to 5 s,
|
|
1292
|
-
within `releaseMs` (120 s) and the caller's signal. Past the bound it is a `timeout` that says what `poll()` last
|
|
1293
|
-
read; it never reports a delete done that it did not read back. A caller that bounds release (the conformance
|
|
1294
|
-
runner's `cleanupTimeoutMs`) gives it more than 120 s: the live suite passes 150 s.
|
|
1295
|
-
`capabilities().release` is `["delete"]`, so `stop` is refused as `unsupported`, in words, and the sandbox runs on:
|
|
1296
|
-
terminate is a sandbox's only end, and Modal has no stopped state. `release`, `connect` and
|
|
1297
|
-
`network` act only on a sandbox whose tags name it as this provider's, with the ref's name.
|
|
1298
|
-
- **Every call is bounded** (`timeouts`: create 10 min, which covers the layer's build and scheduling; the upload 5
|
|
1299
|
-
min; other calls 60 s; a connection, from the bridge's exec to hello, and the probe 30 s; a whole list 120 s; release's wait 120 s) and takes the caller's
|
|
1300
|
-
signal. A create that gives up has its
|
|
1301
|
-
sandbox terminated if one lands later. A create that refuses its sandbox (drift, an abort, a failed upload)
|
|
1302
|
-
terminates it and waits as release does, within `releaseMs`, so nothing is left listed when it returns. The terminate
|
|
1303
|
-
is sent whatever the caller's signal; the wait takes it, so an aborted create returns at once, and a wait past the
|
|
1304
|
-
bound or cut short by an abort says the sandbox may still be ending and what `poll()` last read. Before that
|
|
1305
|
-
terminate, a create whose sandbox's own command had ended says so: its exit code and the tail of its output. When
|
|
1306
|
-
Modal refuses an exec with FAILED_PRECONDITION ("Modal Sandbox is shutting down", code `gone`), the command, init, has
|
|
1307
|
-
just exited and Modal ends the sandbox asynchronously, so create first waits up to `endedMs` (30 s) for `poll()` to
|
|
1308
|
-
read it finished, then reads init's words. The first GPU live run on gVisor ended this way, with no words.
|
|
1263
|
+
`memoryMb` becomes `memoryLimitMiB`, each with Modal's default request (0.125 cores, 128 MiB) or less. `pids` and
|
|
1264
|
+
`workdir` are refused: Modal has no pids limit, and a computer works in `/work`, its home.
|
|
1265
|
+
- **Tags.** A sandbox's tags are the adapter's labels (`agentrun.computer`, its name, deadline, image and the most its
|
|
1266
|
+
deadline may reach) and the caller's, so a computer takes at most 5 labels of its caller's (Modal's 10 tags). Modal
|
|
1267
|
+
holds a sandbox's tags to 512 bytes, names and values together (`labelRules.maxBytes`): the adapter's `check()`
|
|
1268
|
+
counts them, its own at their longest, and refuses past it in words. An Archil computer's mount label records the
|
|
1269
|
+
folder's agent alone, as on every host: the folder's run is the `agentrun.run` label's. `list` is `sandboxes.list({ appId, tags })` over the provider's app: running sandboxes only, and one Modal still
|
|
1270
|
+
lists after its terminate is polled and left out once `poll()` reads it finished.
|
|
1271
|
+
- **release** `delete` is `terminate()`, and the adapter waits until get answers none (`poll()` reads it finished).
|
|
1272
|
+
`stop` is refused as `unsupported`: terminate is a sandbox's only end.
|
|
1309
1273
|
- **GPU.** `capabilities().gpu` declares Modal's GPU types by its own names (guide/gpu): `T4`, `L4`, `A10`, `L40S`,
|
|
1310
|
-
`A100` (40 GB), `A100-40GB`, `A100-80GB`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B300`, at most 8 to a computer
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
mode, as a serve sandbox always mounts the run's folder; the library takes one without a mount.
|
|
1322
|
-
- **The loopback fence on gVisor.** A GPU computer's init gets the same network namespace of its own, loopback alone,
|
|
1323
|
-
made another way.
|
|
1324
|
-
- Modal's gVisor gives root no CAP_SYS_ADMIN, so `unshare(CLONE_NEWNET)` is EPERM. With `--own-network`, init refused
|
|
1325
|
-
to start there (live on a T4, 11-10).
|
|
1326
|
-
- It does let root make a user namespace with a network namespace inside it (`unshare -Urn`, live on a T4, 11-11, as
|
|
1327
|
-
root and as nobody; nothing of Modal's runs or listens inside a gVisor sandbox, and every loopback port answered
|
|
1328
|
-
nothing).
|
|
1329
|
-
- So init, given the same `--own-network` on every runtime, makes the namespace inside a user namespace when root's
|
|
1330
|
-
own attempt is EPERM (the daemon's fallback, any vendor: see "Where root may not make the network namespace").
|
|
1331
|
-
- The first init stays PID 1 with no capability and no_new_privs set. It passes SIGTERM and SIGINT on and ends with
|
|
1332
|
-
the init that serves, so the sandbox lives as long as that one does.
|
|
1333
|
-
- Declared: `gpu.fence: "userns-netns"`. Read back: hello's `fence` on every connect, which the drift check requires
|
|
1334
|
-
to be one of the two. Create notes it when it is `userns-netns`, and the conformance report records it under the GPU
|
|
1335
|
-
computer's own name and role (`daemons[].fence`).
|
|
1336
|
-
- Proven in Docker. In `test/docker/modal-commands.docker.test.mjs`, a root container with Docker's default
|
|
1337
|
-
capabilities and no seccomp profile stands in for gVisor:
|
|
1338
|
-
- `--own-network` falls back and serves;
|
|
1339
|
-
- hello says `userns-netns`;
|
|
1340
|
-
- the programs run as 1000 with no capability, in another network and user namespace than PID 1's, on the loopback
|
|
1341
|
-
alone;
|
|
1342
|
-
- what they write in HOME is 1000's from outside;
|
|
1343
|
-
- with Docker's default seccomp profile (no user namespace either), init refuses in words that name both ways.
|
|
1344
|
-
- Not yet proven live on Modal.
|
|
1274
|
+
`A100` (40 GB), `A100-40GB`, `A100-80GB`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B300`, at most 8 to a computer.
|
|
1275
|
+
`spec.gpu: { type, count }` becomes the SDK's `gpu` (`"T4"`, `"A100-80GB:2"`), and since Modal offers GPUs on gVisor
|
|
1276
|
+
only, such a sandbox runs with `runtime: "gvisor"`; every other computer stays on the VM runtime. The probe's kernel
|
|
1277
|
+
is held to it at create: gVisor's on a GPU computer, a VM's on any other. Modal reads no GPU back, so attach reports
|
|
1278
|
+
none. `gpu.mounts` is `[]`: a GPU with an Archil mount is refused (checkGpu).
|
|
1279
|
+
- **The loopback fence on gVisor.** Modal's gVisor gives root no CAP_SYS_ADMIN, so init, given the same
|
|
1280
|
+
`--own-network`, makes its programs' network namespace inside a user namespace (the daemon's fallback, any vendor).
|
|
1281
|
+
Declared: `gpu.fence: "userns-netns"`; read back: hello's `fence`, and create notes it. Proven in Docker
|
|
1282
|
+
(`test/docker/pid1-commands.docker.test.mjs` and `loopback-block.docker.test.mjs`), not yet live on Modal.
|
|
1283
|
+
- **The app.** `list` (and so Settings' test, one listing) reads the app with `createIfMissing: false`, which makes
|
|
1284
|
+
nothing: an app not made yet lists no sandboxes and is a connection all the same. Only `create` makes the app.
|
|
1345
1285
|
|
|
1346
1286
|
### What every Modal fact rests on
|
|
1347
1287
|
|
|
@@ -1363,7 +1303,7 @@ unless they start with `modal_proto/`. Docs: modal.com, read 2026-11-05.
|
|
|
1363
1303
|
| Whether the main process is PID 1 | not documented (searched `modal-docs`, `js/src`, `modal-libmodal`: none) |
|
|
1364
1304
|
| Modal containers always run as root; `USER` is ignored | [guide/existing-images#user](https://modal.com/docs/guide/existing-images#user) |
|
|
1365
1305
|
| Images must be `linux/amd64` | [guide/existing-images](https://modal.com/docs/guide/existing-images) |
|
|
1366
|
-
| `images.fromRegistry(tag)`; `dockerfileCommands(commands)` adds a layer
|
|
1306
|
+
| `images.fromRegistry(tag)`; `dockerfileCommands(commands)` adds a layer | `image.ts:196-210`, `351-401` |
|
|
1367
1307
|
| Modal's Dockerfile lacks only `EXPOSE`, `HEALTHCHECK`, `LABEL`, `ONBUILD`, `STOPSIGNAL`, `VOLUME` | [guide/existing-images](https://modal.com/docs/guide/existing-images) |
|
|
1368
1308
|
| `sandbox.exec(argv, { mode: "binary" })` gives `stdin` (`writeBytes`, `close`), `stdout`, `stderr` and `wait()` | `sandbox.ts:1272-1290`, `1881-1949`, `2774-2914`; `streams.ts:13-39`, `114-140` |
|
|
1369
1309
|
| exec starts through the task command router; each stdin write is one `TaskExecStdinWrite` at the running offset, and close sends EOF | `sandbox.ts:1915-1926`, `3126-3154`; `modal_proto/task_command_router.proto:420-421` |
|
|
@@ -1376,7 +1316,6 @@ unless they start with `modal_proto/`. Docs: modal.com, read 2026-11-05.
|
|
|
1376
1316
|
| `getTags()`, `poll()` (null while running, else the exit code), `terminate()` | `sandbox.ts:1813-1838`, `2761-2772`, `2238-2252` |
|
|
1377
1317
|
| `terminate()` returns once the request is sent; it waits for the sandbox to finish only with `{ wait: true }` | `sandbox.ts:1292-1296`, `2238-2251` |
|
|
1378
1318
|
| `poll()` is `SandboxWait` with timeout 0: null until the server reports a result, then its exit code (137 when terminated) | `sandbox.ts:1491-1511`, `1974-1980`, `2761-2771` |
|
|
1379
|
-
| `sandboxes.fromId(id)` makes a handle with no call | `sandbox.ts:960-962` |
|
|
1380
1319
|
| terminate sends SIGKILL: a terminated sandbox's code is 137 | [guide/sandboxes#return-codes](https://modal.com/docs/guide/sandboxes#return-codes) |
|
|
1381
1320
|
| A sandbox carries up to 10 tags | [guide/sandboxes#tagging](https://modal.com/docs/guide/sandboxes#tagging) |
|
|
1382
1321
|
| `apps.fromName(name, { createIfMissing })` | `app.ts:32-61` |
|
|
@@ -1395,25 +1334,7 @@ unless they start with `modal_proto/`. Docs: modal.com, read 2026-11-05.
|
|
|
1395
1334
|
| `ModalClient` declares `endpoint` and never reads it; `getProfile` runs once, at construction, and the control-plane client is made then | `client.ts:51`, `123`, `175`, `281` |
|
|
1396
1335
|
| With a profile's `sandboxV2`, create and list go to the V2 backend, and list then covers both | `sandbox.ts:808-815`, `884-889`, `1116-1122`, `1161-1175` |
|
|
1397
1336
|
|
|
1398
|
-
###
|
|
1399
|
-
|
|
1400
|
-
Nothing here has run against Modal. Once the lead OKs a key by name, `AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal
|
|
1401
|
-
-w @parcha/agentrun-computer` runs the conformance suite (`test/modal/`), and should settle:
|
|
1402
|
-
|
|
1403
|
-
- that the image's `sh` runs the entrypoint as the main process, and the upload streams in through exec's stdin with
|
|
1404
|
-
network none, within `uploadMs`, and its sha256 reads back;
|
|
1405
|
-
- with `COMPUTER_MODAL_DAEMON_IMAGE` only: that Modal's builder takes `COPY --from=<registry image>@sha256:...` and
|
|
1406
|
-
keeps the file's mode 0755;
|
|
1407
|
-
- that `computerd init` starts as root and `--user` drops as it does under Docker; whether it is PID 1 on the VM runtime
|
|
1408
|
-
(init says so on stderr when it is not, and still reaps as a subreaper);
|
|
1409
|
-
- that a workdir other than `/work` exists before the command starts, and `/run` is writable there;
|
|
1410
|
-
- the tag value's longest length (the spec tag is JSON) and whether `getTags` answers for a terminated sandbox;
|
|
1411
|
-
- that `terminate` of a finished sandbox does not throw; a live run saw `list` still yield a sandbox right after its
|
|
1412
|
-
terminate, which `release` and `list` now wait out and leave out (above);
|
|
1413
|
-
- the probe's view of `blockNetwork`, and the bypass cases before any allowlist is declared.
|
|
1414
|
-
|
|
1415
|
-
Core `provider.stop` expects Modal's refusal (it declares no stop), and the Full `provider.janitor` case is skipped
|
|
1416
|
-
(`lifetime:janitor`, `release:stop`).
|
|
1337
|
+
### The token, the server and the live run
|
|
1417
1338
|
|
|
1418
1339
|
`create(options)` in `dist/modal.js` builds a real client from `options.tokenId` and `options.tokenSecret`, and the
|
|
1419
1340
|
provider in `options.app` (required: without it, it refuses in words naming the option, before any client). It reads no
|
|
@@ -1421,45 +1342,29 @@ setting from the environment (see [Settings](#settings)) and passes the token to
|
|
|
1421
1342
|
`MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET` on the host is never used. The key goes only to `options.serverUrl`, else the
|
|
1422
1343
|
SDK's default `https://api.modal.com:443`: since the client cannot take a server, it refuses while `MODAL_SERVER_URL`
|
|
1423
1344
|
is set, and sets it to its choice only while it constructs the client, one construction at a time and put back after
|
|
1424
|
-
each, so neither `MODAL_PROFILE` nor a profile in `MODAL_CONFIG_PATH` or `~/.modal.toml` can redirect the key.
|
|
1425
|
-
|
|
1426
|
-
is uploaded); without it, it is uploaded from `options.daemonPath`, else `dist/computerd-linux-amd64`, so a run
|
|
1427
|
-
publishes nothing.
|
|
1345
|
+
each, so neither `MODAL_PROFILE` nor a profile in `MODAL_CONFIG_PATH` or `~/.modal.toml` can redirect the key. The
|
|
1346
|
+
daemon is uploaded from `options.daemonPath`, else `dist/computerd-linux-amd64`, so a run publishes nothing.
|
|
1428
1347
|
|
|
1429
1348
|
The conformance module, `dist/conformance/modal.js` (`--provider modal`), reads the run's settings from its own names
|
|
1430
1349
|
(`settingsFromEnv`) and passes each to `create()` as its option: `COMPUTER_MODAL_TOKEN_ID` and
|
|
1431
1350
|
`COMPUTER_MODAL_TOKEN_SECRET` (never `MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET`: a host may hold a production token under
|
|
1432
1351
|
those names, and with only them set it refuses, naming the `COMPUTER_MODAL_` pair), `COMPUTER_MODAL_APP`, and, if set,
|
|
1433
|
-
`COMPUTER_MODAL_SERVER_URL
|
|
1434
|
-
`
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
is its lifetime, and a longer one is refused in words. The modal package is the host's; it is imported only when a
|
|
1438
|
-
provider is made.
|
|
1352
|
+
`COMPUTER_MODAL_SERVER_URL`. It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
|
|
1353
|
+
anything else. Its `createDriftedProvider()` uploads a daemon it builds with Go as version `<version>-drift`, so Go must
|
|
1354
|
+
be on PATH. Every computer of a run gets `maxLifetimeMs` 30 minutes. Core `provider.stop` expects Modal's refusal (it
|
|
1355
|
+
declares no stop), and the Full `provider.janitor` case is skipped (`lifetime:janitor`, `release:stop`).
|
|
1439
1356
|
|
|
1440
|
-
A live run is wrapped in the sweep,
|
|
1441
|
-
`COMPUTER_MODAL_TOKEN_SECRET`, `COMPUTER_MODAL_APP` and `COMPUTER_MODAL_SERVER_URL`, through the conformance module's
|
|
1442
|
-
`settingsFromEnv`, and makes its client the same pinned way (an ambient `MODAL_SERVER_URL` is refused; it needs no live switch, since it makes nothing):
|
|
1357
|
+
A live run is wrapped in the one sweep, with the same settings (it needs no live switch, since it makes nothing):
|
|
1443
1358
|
|
|
1444
1359
|
```sh
|
|
1445
|
-
node packages/computer/dist/conformance/
|
|
1360
|
+
node packages/computer/dist/conformance/sweep.js --provider modal --before /tmp/modal-before.json
|
|
1446
1361
|
AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal -w @parcha/agentrun-computer
|
|
1447
|
-
node packages/computer/dist/conformance/
|
|
1362
|
+
node packages/computer/dist/conformance/sweep.js --provider modal --after /tmp/modal-before.json
|
|
1448
1363
|
```
|
|
1449
1364
|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
server is not the one the environment names now, or that names none: every computer of another app would read as
|
|
1454
|
-
new. Otherwise it reads the tags (`getTags()`) of every such sandbox not in that file and terminates each that carries
|
|
1455
|
-
a conformance run's label (`agentrun.conformance`, which every computer of a run carries): one another user of the app
|
|
1456
|
-
made during the run, with no such label, is left alone, and so is one whose tags it cannot read (said on stderr). It
|
|
1457
|
-
reads each terminated sandbox back through `sandboxes.fromId` and `poll()` until it reports an exit code or Modal no
|
|
1458
|
-
longer knows it (up to 60 s each), and prints one line, `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`, where
|
|
1459
|
-
`leftAlone` counts the new sandboxes it did not terminate. It exits 0 when
|
|
1460
|
-
every swept sandbox has finished, 1 when one still runs, and 2 on a usage error, an unreadable before file or one of
|
|
1461
|
-
another app or server, a missing token or app, or a listing Modal refused, having terminated nothing. A sandbox in the before file is never
|
|
1462
|
-
named by any call.
|
|
1365
|
+
Its output is `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`, as for every provider on the adapter. The before
|
|
1366
|
+
file records where it listed, the app and the server (`sweepScope`), and `--after` refuses, exit 2, before it lists
|
|
1367
|
+
anything, a file of another app or server, or one that names none: every computer there would read as new.
|
|
1463
1368
|
|
|
1464
1369
|
## Daytona
|
|
1465
1370
|
|
|
@@ -1467,23 +1372,29 @@ named by any call.
|
|
|
1467
1372
|
import { DaytonaProvider } from "@parcha/agentrun-computer/daytona";
|
|
1468
1373
|
|
|
1469
1374
|
const daytona = new DaytonaProvider({ apiKey, daemonPath: "dist/computerd-linux-amd64" });
|
|
1470
|
-
const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, network: "none" });
|
|
1375
|
+
const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1471
1376
|
```
|
|
1472
1377
|
|
|
1473
|
-
A Daytona computer is a sandbox made through Daytona's v0 REST API with `fetch
|
|
1474
|
-
|
|
1378
|
+
A Daytona computer is a sandbox made through Daytona's v0 REST API with `fetch`: no SDK, and no package beyond this
|
|
1379
|
+
one. `fetch` and the WebSocket factory are options, so the tests hand them a recorder. The provider is a `MachineHost`
|
|
1380
|
+
on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): Daytona's own calls are here, and the lifecycle
|
|
1381
|
+
around them (the computer's name from the create's request id, the daemon's install and start, the probe, the listing
|
|
1382
|
+
wait, release's wait for gone) is the adapter's, the same for every hosted vendor.
|
|
1475
1383
|
The key is the caller's to pass: the provider never reads the environment, never sends the key over a redirect or to a
|
|
1476
1384
|
toolbox URL that is not https, and never puts it in a computer. `image` is a Daytona snapshot, by id or name: the
|
|
1477
1385
|
snapshot gives the sandbox its class and its size. `image: "default"` sends no snapshot field at all, and Daytona makes
|
|
1478
1386
|
the sandbox from its default snapshot; the provider never guesses a snapshot's name. (A snapshot that is itself named
|
|
1479
|
-
`default` is reached by its id.)
|
|
1480
|
-
|
|
1481
|
-
|
|
1387
|
+
`default` is reached by its id.) Create records the image it was asked for in the label `agentrun.computer.image`,
|
|
1388
|
+
beside the deadline's in the provider's own namespace, and attach reports that as `image`.
|
|
1389
|
+
|
|
1390
|
+
Daytona takes no mount of the run's folder: Archil's client hangs on its sandboxes (its FUSE session never answers a
|
|
1391
|
+
`statx` of the mountpoint), so `capabilities().mount` is `[]` and `check()` refuses an Archil mount up front, code
|
|
1392
|
+
`refused`, in the descriptor's `unmounted.archil` words, before anything is asked of Daytona.
|
|
1482
1393
|
|
|
1483
1394
|
### Lifetimes
|
|
1484
1395
|
|
|
1485
|
-
Every sandbox ends at its TTL (`ttlMinutes`, from `lifetimeMs`). Two options bound it further, each sent on every
|
|
1486
|
-
|
|
1396
|
+
Every sandbox ends at its TTL (`ttlMinutes`, from `lifetimeMs`). Two options bound it further, each sent on every
|
|
1397
|
+
create:
|
|
1487
1398
|
|
|
1488
1399
|
| Option | Daytona field | Meaning | Unset |
|
|
1489
1400
|
| --- | --- | --- | --- |
|
|
@@ -1492,20 +1403,21 @@ and read back by the drift check:
|
|
|
1492
1403
|
|
|
1493
1404
|
Each is a whole number, 0 or more; the constructor refuses anything else in words. Daytona's idle timer counts toolbox
|
|
1494
1405
|
calls (the daemon's connections are toolbox calls) but not the daemon's own work, so a computer left with no connection
|
|
1495
|
-
for `autoStopMinutes` stops.
|
|
1496
|
-
|
|
1497
|
-
stopped one.
|
|
1406
|
+
for `autoStopMinutes` stops. A stopped sandbox is still listed, as `stopped`, until Daytona deletes it or the janitor
|
|
1407
|
+
does. The provider itself never stops one: `release` takes `delete` alone and refuses `stop` as `unsupported`.
|
|
1498
1408
|
|
|
1499
1409
|
### How the daemon gets in, and how it is reached
|
|
1500
1410
|
|
|
1501
1411
|
Daytona runs its own toolbox daemon as the sandbox's first process, and a snapshot we do not build has no `computerd`.
|
|
1502
|
-
So the provider pushes it in at create and starts it
|
|
1412
|
+
So the provider pushes it in at create and starts it, and reaches it the same way. Every command is a session command
|
|
1413
|
+
of its own (`runAsync`, `suppressInputEcho`), its argv one shell line, its output read from the command's log stream,
|
|
1414
|
+
its exit code from the session; the session is deleted once the command ends, or when the provider ends it:
|
|
1503
1415
|
|
|
1504
1416
|
1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random>`:
|
|
1505
1417
|
`/files/upload-v2`, or `/files/upload` when the toolbox answers 404 for it. An older toolbox, as a self-hosted
|
|
1506
1418
|
Daytona's runners may run, serves only `/files/upload`, which takes the same form; any other refusal is not retried
|
|
1507
1419
|
on the older route.
|
|
1508
|
-
2. Install it with
|
|
1420
|
+
2. Install it with the shared install script: root-owned, mode 755, at
|
|
1509
1421
|
`/opt/agentrun/computerd`, and make `/work` (its home) and `/run/agentrun` (its socket's directory). As root, or
|
|
1510
1422
|
through passwordless `sudo`; a sandbox with neither is refused in the script's words. The script prints the
|
|
1511
1423
|
installed binary's sha256 (`sha256sum`, BusyBox's or coreutils'), which must be the uploaded one's. It makes
|
|
@@ -1514,15 +1426,16 @@ So the provider pushes it in at create and starts it as a long-lived command, an
|
|
|
1514
1426
|
and writable by no group and no other user (read with `ls -ldn`, so a symbolic link or an ACL on the way fails it).
|
|
1515
1427
|
A path that fails is refused in words, with nothing installed. Only root can change an owner or a mode, so the
|
|
1516
1428
|
rule, once it holds, holds until root changes it.
|
|
1517
|
-
3. Start `computerd init --deadline <time> --user 2510:2510 --own-network` (`--user` is the `daemonUser` option)
|
|
1518
|
-
session
|
|
1519
|
-
is not root), in a clean environment and with `/work` as its directory.
|
|
1429
|
+
3. Start `computerd init --deadline <time> --user 2510:2510 --own-network` (`--user` is the `daemonUser` option)
|
|
1430
|
+
detached, in a session of its own (`setsid`), its output to `/run/agentrun-init.log`, as root (through `sudo -n`
|
|
1431
|
+
when the session's user is not root), in a clean environment and with `/work` as its directory. The command that
|
|
1432
|
+
starts it ends at once, and deleting its session leaves init running; a daemon that never answers is reported with
|
|
1433
|
+
the last words of that log. Init cuts itself and its programs off from
|
|
1520
1434
|
the toolbox (below), then drops itself: it gives `/work` and `/run/agentrun` to the daemon's user (mode 700, never
|
|
1521
1435
|
through a symbolic link), sets `no_new_privs` and empties the capability bounding set on every thread, so a setuid
|
|
1522
1436
|
program such as `sudo` cannot raise it, then becomes uid and gid 2510 with no supplementary groups and empties the
|
|
1523
1437
|
inheritable set. The provider relies on no privilege tool of the
|
|
1524
|
-
snapshot's: the first live start failed on the snapshot's `setpriv`, and the daemon's own drop replaced it.
|
|
1525
|
-
that session: deleting it ends init.
|
|
1438
|
+
snapshot's: the first live start failed on the snapshot's `setpriv`, and the daemon's own drop replaced it.
|
|
1526
1439
|
4. `connect()` starts `computerd stdio` as root the same way, in a session of its own, to reach a socket in a
|
|
1527
1440
|
directory that is the daemon's user's alone; it only carries bytes. Init and the bridge each check the daemon's
|
|
1528
1441
|
path against the same rule before they run it as root, and refuse in words when it fails, so a binary a user
|
|
@@ -1530,8 +1443,14 @@ So the provider pushes it in at create and starts it as a long-lived command, an
|
|
|
1530
1443
|
(`POST .../input`, whole lines, one call after another), and its stdout is the command's log stream, a WebSocket
|
|
1531
1444
|
with `follow=true`, in which Daytona prefixes each stdout line with `01 01 01` and each stderr line with `02 02 02`
|
|
1532
1445
|
(split output, asked for with `X-Daytona-Split-Output: true`). Input is sent with `suppressInputEcho`; a line that
|
|
1533
|
-
is a request or a notification, never a reply, is dropped in case a toolbox echoes input anyway.
|
|
1534
|
-
|
|
1446
|
+
is a request or a notification, never a reply, is dropped in case a toolbox echoes input anyway. An input call
|
|
1447
|
+
Daytona answers with its own 500 (its error body, `"statusCode":500`) is sent again, up to three tries with a
|
|
1448
|
+
doubling pause: that answer comes from an error before the call is passed on, or from the toolbox's input route
|
|
1449
|
+
when it could not open the command's input pipe or its reader is gone (`daytonaio/daytona@b5a5d9e7
|
|
1450
|
+
apps/daemon/pkg/session/input.go`), so the line reached no reader. Nothing else is sent again: a call passed on
|
|
1451
|
+
that then fails is a 502 (`libs/common-go/pkg/proxy/proxy.go`), and after a 502, 503, 504, a timeout or no answer
|
|
1452
|
+
the line may have been read, and a line read twice is a request the daemon runs twice. `close()` deletes the
|
|
1453
|
+
session, which ends the bridge and nothing else.
|
|
1535
1454
|
|
|
1536
1455
|
This is the protocol's first binding, stdio over the vendor's exec stream, assembled from two halves: the session
|
|
1537
1456
|
command's input and its log stream are each one-way, and together they are the duplex byte stream `DaemonClient`
|
|
@@ -1554,7 +1473,11 @@ from (the loopback block):
|
|
|
1554
1473
|
neither port 2280 on the loopback nor the sandbox's own address; vsock and io_uring are refused to them; and init
|
|
1555
1474
|
refuses to start while another process holds their uid, so a toolbox (or a session shell of its) that runs as the
|
|
1556
1475
|
daemon's user is refused, not shared. `capabilities().vendorAgentPorts` declares 2280, and the Core case
|
|
1557
|
-
isolation.vendor-agent probes it from a program of the computer's user, on both loopbacks.
|
|
1476
|
+
isolation.vendor-agent probes it from a program of the computer's user, on both loopbacks. Init takes others' access
|
|
1477
|
+
off every socket under `/run`; Daytona's D-Bus session bus sits in `/tmp` (`/tmp/dbus-<10 characters>`, which a
|
|
1478
|
+
program of the computer's user could connect to in the live baseline), so create, as root and before init starts,
|
|
1479
|
+
takes others' access off each socket `/tmp/dbus-*` names (the host's `vendorSockets`), and its notes name the ones
|
|
1480
|
+
it closed. A runner whose root may
|
|
1558
1481
|
not make a network namespace (no CAP_SYS_ADMIN: a container class on a runner that is not privileged) fails closed:
|
|
1559
1482
|
init refuses to start, in words, and create deletes the sandbox.
|
|
1560
1483
|
- The provider still installs and starts the daemon through that toolbox, as root or through passwordless `sudo`, and
|
|
@@ -1565,8 +1488,8 @@ from (the loopback block):
|
|
|
1565
1488
|
- Network `none` is `networkBlockAll` (Daytona drops what leaves the sandbox on the host) and, beside it, the
|
|
1566
1489
|
daemon's own namespace. Known gap: `open` and allowlists are refused in words until a proxy carries them out of the
|
|
1567
1490
|
daemon's own network, the next feature after this one; a computer that needs pip, npm or git from the internet
|
|
1568
|
-
cannot be made on Daytona until then. `network()` refuses
|
|
1569
|
-
|
|
1491
|
+
cannot be made on Daytona until then. A computer's network is fixed at create: `network()` refuses every change, with
|
|
1492
|
+
`refused`, and asks Daytona nothing.
|
|
1570
1493
|
- From outside, anyone with the API key can run a command as root in the sandbox through the same toolbox.
|
|
1571
1494
|
|
|
1572
1495
|
Daytona's container class runs code as root, and the open runner runs it privileged.
|
|
@@ -1580,88 +1503,75 @@ the TTL.
|
|
|
1580
1503
|
| --- | --- | --- |
|
|
1581
1504
|
| `kind` | `linux` | a Linux shell with computerd: exec, files and processes |
|
|
1582
1505
|
| `lifetime` | `vendor` | `ttlMinutes` destroys the sandbox in any state once it elapses; set to the lifetime in whole minutes, rounded up. Init also ends every process at the deadline itself. |
|
|
1583
|
-
| `network` | `none` | `networkBlockAll
|
|
1506
|
+
| `network` | `none` | `networkBlockAll` at create, and the daemon's own network namespace; open and allowlists wait for a proxy out of it (known gap) |
|
|
1584
1507
|
| `vendorAgentPorts` | `[2280]` | the toolbox's port, on every interface; isolation.vendor-agent checks a program of the computer's user reaches it on neither loopback |
|
|
1585
|
-
| `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot
|
|
1508
|
+
| `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot |
|
|
1586
1509
|
| `os` | `linux` | Linux classes only; Windows and macOS are not offered here |
|
|
1587
|
-
| `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is a session command it
|
|
1510
|
+
| `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is started detached through a session command of it (above) |
|
|
1511
|
+
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
1588
1512
|
| `groups` | `exec`, `files`, `processes` | the daemon's own, checked against its hello's `groups`, as is its `kind` |
|
|
1589
1513
|
| `maxLifetimeMs` | 30 days | the cap `check` gives, through the shared `checkLifetime`; Daytona's TTL is whole minutes and documents no cap of its own |
|
|
1590
1514
|
| `user` | none | the daemon runs as the provider's `daemonUser`; a spec cannot name a user |
|
|
1591
|
-
| `release` | `
|
|
1592
|
-
| `
|
|
1593
|
-
| `gpu` | `H100`; at most 1 | daytona-gpu's own GPU (`DAYTONA_GPU_SNAPSHOT_GPU`, from GET /snapshots/daytona-gpu). A GPU computer is made from Daytona's GPU snapshot `daytona-gpu` (`DAYTONA_GPU_SNAPSHOT`: its default sandbox image, user `daytona` with passwordless sudo, plus the CUDA toolkit), sent as `snapshot`: its spec's image is `"daytona-gpu"` or `"default"`, and `check` refuses any other (a snapshot of box/Dockerfile among them) in words. A Daytona snapshot carries its own resources, so the create sends none (no `cpu`, `gpu`, `gpuType`, `memory` or `disk`: Daytona refuses them beside a snapshot, 400 "Cannot specify Sandbox resources when using a snapshot"), and the read-back's `snapshot`, `gpu` and `gpuType` must be the snapshot's. Another type or count needs a snapshot of its own, so `check` refuses it. A GPU computer's limits, declared on `capabilities().gpu`: `preemptible: true` (daytona.io/pricing lists its GPUs as "Preemptible GPU prices": a run on one can be cut short); `stopDeletes: true` (it is made with `autoDeleteInterval: 0`, whatever `autoDeleteMinutes` says. That is Daytona's ephemeral: its SDK's `ephemeral` sets it, and `CreateSandbox` has no `ephemeral` field, so none is sent. A GPU sandbox has no pause and no snapshot, so stopping it deletes it and nothing on it persists); `region: "earth"` (Daytona's one GPU region, sent as `target` in place of the provider's); `perGpu` 16 vCPU, 100 GiB memory and 400 GiB disk, the snapshot's; `mounts: []`, so a GPU computer with any mount is refused in words: Daytona's GPU host gives no `/dev/fuse`, even to root (live 11-11), and the archil client mounts through FUSE. In serve's Mode 2 the run's folder is an Archil mount, so a Daytona GPU sandbox is refused there, and Settings' `gpu.why` says so. The org needs GPU credits, or the create is refused in Daytona's words. Create notes who installed the daemon: daytona-gpu's `daytona` user through passwordless sudo, or root on a snapshot of box/Dockerfile. The `gpuSnapshot` option names our own GPU snapshot instead: box/Dockerfile as it is, built with one GPU by `box/build-daytona.py --gpu H100` (resources gpu 1 and gpuType H100, named `agentrun-archil-gpu-h100-<recipe hash>`, in region earth). Its user is root, its GPU is the one its name says, and its GPU computers take no mount either. It carries no CUDA toolkit: pip install torch brings its own CUDA runtime; the host gives the driver. A GPU spec's image is then `"default"` or that name. An Archil computer's preflight reads `/dev/fuse`, and one without it is refused in those words ("this computer has no /dev/fuse, so the Archil folder can't be mounted") before anything else |
|
|
1515
|
+
| `release` | `delete` | `DELETE /sandbox/{id}`; a stop is refused as `unsupported` |
|
|
1516
|
+
| `gpu` | `H100`; at most 1 | daytona-gpu's own GPU (`DAYTONA_GPU_SNAPSHOT_GPU`, from GET /snapshots/daytona-gpu). A GPU computer is made from Daytona's GPU snapshot `daytona-gpu` (`DAYTONA_GPU_SNAPSHOT`: its default sandbox image, user `daytona` with passwordless sudo, plus the CUDA toolkit), sent as `snapshot`: its spec's image is `"daytona-gpu"` or `"default"`, and `check` refuses any other (a snapshot of box/Dockerfile among them) in words. A Daytona snapshot carries its own resources, so the create sends none (no `cpu`, `gpu`, `gpuType`, `memory` or `disk`: Daytona refuses them beside a snapshot, 400 "Cannot specify Sandbox resources when using a snapshot"), and the read-back's `gpu` and `gpuType` must be the snapshot's. Another type or count needs a snapshot of its own, so `check` refuses it. A GPU computer's limits, declared on `capabilities().gpu`: `preemptible: true` (daytona.io/pricing lists its GPUs as "Preemptible GPU prices": a run on one can be cut short); `stopDeletes: true` (it is made with `autoDeleteInterval: 0`, whatever `autoDeleteMinutes` says. That is Daytona's ephemeral: its SDK's `ephemeral` sets it, and `CreateSandbox` has no `ephemeral` field, so none is sent. A GPU sandbox has no pause and no snapshot, so stopping it deletes it and nothing on it persists); `region: "earth"` (Daytona's one GPU region, sent as `target` in place of the provider's); `perGpu` 16 vCPU, 100 GiB memory and 400 GiB disk, the snapshot's; `mounts: []`, so a GPU computer with any mount is refused in words: Daytona's GPU host gives no `/dev/fuse`, even to root (live 11-11), and the archil client mounts through FUSE. In serve's Mode 2 the run's folder is an Archil mount, so a Daytona GPU sandbox is refused there, and Settings' `gpu.why` says so. The org needs GPU credits, or the create is refused in Daytona's words. Create notes who installed the daemon: daytona-gpu's `daytona` user through passwordless sudo, or root on a snapshot of box/Dockerfile. The `gpuSnapshot` option names our own GPU snapshot instead: box/Dockerfile as it is, built with one GPU by `box/build-daytona.py --gpu H100` (resources gpu 1 and gpuType H100, named `agentrun-archil-gpu-h100-<recipe hash>`, in region earth). Its user is root, its GPU is the one its name says, and its GPU computers take no mount either. It carries no CUDA toolkit: pip install torch brings its own CUDA runtime; the host gives the driver. A GPU spec's image is then `"default"` or that name. An Archil computer's preflight reads `/dev/fuse`, and one without it is refused in those words ("this computer has no /dev/fuse, so the Archil folder can't be mounted") before anything else |
|
|
1594
1517
|
|
|
1595
1518
|
### What the provider does
|
|
1596
1519
|
|
|
1597
|
-
- `check(spec)` refuses in words, with no request: no snapshot
|
|
1598
|
-
that is not `none` (open and every allowlist alike), a label in the provider's
|
|
1599
|
-
namespace (`agentrun.computer`), `cpus`, `memoryMb` or `pids` (a snapshot's size is its own), `user`, `workdir`
|
|
1600
|
-
(the daemon works in `/work`), and any other
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
the
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
`
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
- `release(ref, "delete")` deletes
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
- Daytona is asynchronous: it answers a delete by setting the sandbox's desired state to `destroyed
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
the sandbox it made (a failure, a mismatch, an abort) waits the same way before it returns.
|
|
1642
|
-
- `connect(ref)` refuses a computer that is not `started`, and a daemon whose hello is not the provider's.
|
|
1520
|
+
- `check(spec)` refuses in words, with no request: no snapshot (or one of blanks or control characters), a lifetime
|
|
1521
|
+
that is not 1 ms to 30 days, a network that is not `none` (open and every allowlist alike), a label in the provider's
|
|
1522
|
+
own namespace (`agentrun.computer`), `cpus`, `memoryMb` or `pids` (a snapshot's size is its own), `user`, `workdir`
|
|
1523
|
+
(the daemon works in `/work`), a GPU computer's snapshot other than the GPU snapshot or `"default"`, and any other
|
|
1524
|
+
field.
|
|
1525
|
+
- `create(spec, { requestId })` names the computer `computer-<12 hex digits of sha256(requestId)>` and lists that name
|
|
1526
|
+
first: a retry of the same request finds the computer the first one made (the adapter's idempotent create,
|
|
1527
|
+
[PROVIDERS.md](PROVIDERS.md)). It sends `POST /sandbox` with that name, the snapshot (none for `"default"`), the
|
|
1528
|
+
labels (`agentrun.computer=1`, `agentrun.computer.name`, the deadline, the image, and the most an extend could move
|
|
1529
|
+
the deadline to), `public: false`, `networkBlockAll`, `ttlMinutes`, `autoStopInterval` (`autoStopMinutes`; unset, 0,
|
|
1530
|
+
since Daytona's idle timer counts only outside traffic and a daemon at work would be stopped), and
|
|
1531
|
+
`autoDeleteInterval` (`autoDeleteMinutes`; unset, -1: a stop keeps the sandbox, which the TTL then ends). `POST
|
|
1532
|
+
/sandbox` is never retried; a name Daytona already holds (409) is `exists`. A create that fails without a 4xx
|
|
1533
|
+
answer, or is aborted, may still have made the sandbox, so the adapter deletes the name it chose. Then it waits for
|
|
1534
|
+
`started` (polling `GET /sandbox/{id}`), pushes in and starts the daemon, checks the daemon and probes its network
|
|
1535
|
+
none from inside, and waits until the label listing shows the new computer twice running (Daytona's listing trails
|
|
1536
|
+
a create). A sandbox that reads `error` or `build_failed` is gone, and create fails `vendor` with Daytona's
|
|
1537
|
+
`errorReason`. Any failure or abort after the sandbox exists deletes it, and create never returns ok once its signal
|
|
1538
|
+
has aborted.
|
|
1539
|
+
- `attach({ id })` takes a sandbox id (or a computer's name, which Daytona answers to as well); `attach({ labels })`
|
|
1540
|
+
must match exactly one computer. Only a sandbox with `agentrun.computer=1` and a computer's name label counts.
|
|
1541
|
+
Attach holds the daemon to the provider's, when the computer is started. It returns `spec`: `image`, the image
|
|
1542
|
+
create was asked for (`"default"` stays `"default"`), from its label; the daemon's user, the network, `/work`, the
|
|
1543
|
+
deadline and, with one, the GPU.
|
|
1544
|
+
- `list(labels)` asks Daytona for `agentrun.computer=1` alone, every page, for the ids; the adapter keeps those whose
|
|
1545
|
+
`GET /sandbox/{id}` carries the other labels. A sandbox that is `destroying`, `destroyed`, `error` or `build_failed`,
|
|
1546
|
+
or whose desired state is `destroyed`, is gone and left out: none of them starts again. `started` is `running`; the
|
|
1547
|
+
states on the way to it are starting, and left out; every other state (`stopping`, `pausing`, `stopped`, `archived`,
|
|
1548
|
+
`paused`) is `stopped`.
|
|
1549
|
+
- `network(ref)` is the adapter's probe from inside; `network(ref, policy)` refuses any policy but the one the
|
|
1550
|
+
computer has, with `refused` and no request.
|
|
1551
|
+
- `release(ref, "delete")` deletes: retried on a 5xx, checked against the sandbox, with a forced stop before the last
|
|
1552
|
+
attempt. It is idempotent, and refuses a sandbox that is not this provider's. `release(ref, "stop")` is refused as
|
|
1553
|
+
`unsupported`, with no request: a Daytona computer is deleted, never stopped and kept.
|
|
1554
|
+
- Daytona is asynchronous: it answers a delete by setting the sandbox's desired state to `destroyed`, and the sandbox
|
|
1555
|
+
gets there later, through `destroying`. Its listing trails it. So release waits until `GET /sandbox/{id}` no longer
|
|
1556
|
+
finds the computer, twice running: a 404 or `destroyed`. A sandbox still `destroying`, or with the desired state
|
|
1557
|
+
alone, reads gone to every other caller but holds this wait. It polls with pauses that double from `pollMs` up to
|
|
1558
|
+
5 s, bounded by the `goneMs` timeout (120 s unset)
|
|
1559
|
+
and by the signal `release(ref, how, { signal })` takes. When the bound runs out, release fails in words naming the
|
|
1560
|
+
last state Daytona read: it never reports a release it has not seen done. A create that deletes the sandbox it made
|
|
1561
|
+
(a failure, an abort) waits the same way before it returns.
|
|
1562
|
+
- `connect(ref)` answers `gone` for a sandbox that is going (destroying, or asked to destroy), refuses one that is
|
|
1563
|
+
not `started`, and a daemon whose hello is not the provider's.
|
|
1643
1564
|
- Every call has its own timeout and takes the caller's signal; reads, the upload and deletes are retried (three tries,
|
|
1644
|
-
backoff
|
|
1565
|
+
backoff from `timeouts.retryMs`, 500 ms unset); creates, session commands and input are not.
|
|
1645
1566
|
|
|
1646
|
-
### The
|
|
1647
|
-
|
|
1648
|
-
From Daytona's read of the sandbox:
|
|
1567
|
+
### The daemon check
|
|
1649
1568
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
| `snapshot` | the spec's image; for `"default"`, whatever Daytona names, unchecked |
|
|
1653
|
-
| `networkBlockAll`, `networkAllowList`, `domainAllowList`, `outboundProxyUrl` | the network declared; an outbound proxy, both lists, or block-all with a list is drift |
|
|
1654
|
-
| `labels` | `agentrun.computer=1`, the deadline and the image as written, every label the spec asked for |
|
|
1655
|
-
| `autoStopInterval`, `autoDeleteInterval` | `autoStopMinutes` (0 unset), `autoDeleteMinutes` (-1 unset), exactly |
|
|
1656
|
-
| `autoDestroyAt` | set, and no later than the deadline plus the TTL's minute and 2 minutes of clock skew |
|
|
1657
|
-
| `sandboxClass` | the provider's class |
|
|
1658
|
-
| `gpu`, `gpuType` | `spec.gpu`'s count (0 with none) and, with one, its type |
|
|
1659
|
-
| `public`, `kvm`, `volumes`, `linkedSandboxId` | false, not true, none, none |
|
|
1660
|
-
|
|
1661
|
-
From the daemon, over one connection: hello (the provider's version, `linux`, the `arch` option, every daemon
|
|
1569
|
+
Daytona's create options are not read back: what create sent is what the sandbox has. The GPU is the one read-back
|
|
1570
|
+
(`gpu`, `gpuType`: `spec.gpu`'s count and type). From the daemon, over one connection: hello (the provider's version, `linux`, the `arch` option, every daemon
|
|
1662
1571
|
capability), `/proc/self/status` (Uid and Gid the daemon user's four times, no groups, `NoNewPrivs: 1`, `CapInh`,
|
|
1663
1572
|
`CapPrm`, `CapEff`, `CapBnd` and `CapAmb` all zero), `/proc/self/cwd` (`/work`) and `/proc/self/exe`
|
|
1664
|
-
(`/opt/agentrun/computerd`); and the
|
|
1573
|
+
(`/opt/agentrun/computerd`); its own network (loopback alone), and the probe: no target answers a computer with
|
|
1574
|
+
network none; and the installed binary's sha256 from the install.
|
|
1665
1575
|
|
|
1666
1576
|
### Conformance on Daytona
|
|
1667
1577
|
|
|
@@ -1679,10 +1589,9 @@ fallback: on a host that runs other Daytona work they may hold another organizat
|
|
|
1679
1589
|
which serve passes in itself.
|
|
1680
1590
|
|
|
1681
1591
|
Every sandbox of a run has a bounded life besides its TTL: the module always sets `autoStopMinutes: 30` and
|
|
1682
|
-
`autoDeleteMinutes: 0`, whatever the environment says.
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
`vendor`, and a stop keeps none). The module exports `conformanceImage()` and `conformanceNotes`; the CLI takes the
|
|
1592
|
+
`autoDeleteMinutes: 0`, whatever the environment says. The provider never stops a computer: Core `provider.stop`
|
|
1593
|
+
expects its refusal. Full `provider.janitor`, which needs a stopped computer kept, is skipped (the lifetime is
|
|
1594
|
+
`vendor`, and release keeps none). The module exports `conformanceImage()` and `conformanceNotes`; the CLI takes the
|
|
1686
1595
|
image from it when `--image` names none, and prints the note above the verdict (`notes` in `--json`).
|
|
1687
1596
|
|
|
1688
1597
|
```sh
|
|
@@ -1691,25 +1600,17 @@ npm run conformance -w @parcha/agentrun-computer -- --provider daytona [--image
|
|
|
1691
1600
|
|
|
1692
1601
|
### The sweep around a live run
|
|
1693
1602
|
|
|
1694
|
-
`dist/conformance/
|
|
1695
|
-
the
|
|
1603
|
+
The live sweep is the shared one, `dist/conformance/sweep.js --provider daytona --before <file>` and `--after <file>`
|
|
1604
|
+
([PROVIDERS.md](PROVIDERS.md), "The live sweep"); it reads the same `COMPUTER_DAYTONA_API_KEY` and
|
|
1605
|
+
`COMPUTER_DAYTONA_API_URL` through the conformance module's `createHost`, with no live switch:
|
|
1696
1606
|
|
|
1697
1607
|
```sh
|
|
1698
|
-
node packages/computer/dist/conformance/
|
|
1699
|
-
node packages/computer/dist/conformance/
|
|
1608
|
+
node packages/computer/dist/conformance/sweep.js --provider daytona --before /tmp/daytona-before.json # before the run
|
|
1609
|
+
node packages/computer/dist/conformance/sweep.js --provider daytona --after /tmp/daytona-before.json # after it
|
|
1700
1610
|
```
|
|
1701
1611
|
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
and that carries a conformance run's label (`agentrun.conformance`, which every computer of a run carries), then reads
|
|
1705
|
-
each with `GET /sandbox/{id}` until Daytona answers 404, up to 60 s each, and prints one JSON line,
|
|
1706
|
-
`{"swept":n,"notFound":m,"stillThere":[ids],"leftAlone":k}`, where `swept` counts the conformance sandboxes not there
|
|
1707
|
-
before, `notFound` plus `stillThere`'s length is `swept`, and `leftAlone` counts the new labelled sandboxes with no
|
|
1708
|
-
conformance label: another user of the account (a server's computers) made them during the run, and no call names
|
|
1709
|
-
them. A sandbox in the file is never named by any call. A new conformance sandbox without a computer's name is not this
|
|
1710
|
-
provider's: release refuses it, and it is reported still there. Exit 0 when every swept sandbox reads 404, 1 when one
|
|
1711
|
-
is still there, 2 on a usage error, a before file it cannot read, no key, or a listing Daytona refused (nothing is
|
|
1712
|
-
deleted then).
|
|
1612
|
+
It prints `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}` (`gone` was `notFound`). A conformance run of
|
|
1613
|
+
Daytona also sweeps its own label through the host at its end (the report's `cleanup.sweep`).
|
|
1713
1614
|
|
|
1714
1615
|
### Not yet known
|
|
1715
1616
|
|
|
@@ -1796,15 +1697,21 @@ import { providerFor } from "@parcha/agentrun-computer";
|
|
|
1796
1697
|
|
|
1797
1698
|
// The key is the caller's to pass (serve's E2B_API_KEY), and the e2b package is the host's own (npm e2b 2.63.0).
|
|
1798
1699
|
const e2b = await providerFor("e2b", { apiKey });
|
|
1799
|
-
const made = await e2b.create({ image: "desktop", lifetimeMs: 600_000, network: "none" });
|
|
1700
|
+
const made = await e2b.create({ image: "desktop", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1800
1701
|
```
|
|
1801
1702
|
|
|
1703
|
+
E2B runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/e2b.ts` is E2B's `MachineHost`, its
|
|
1704
|
+
SDK types (`import type`, erased at build) and the mapping of a sandbox to a machine, and `src/hosted/provider.ts` does everything below that is not
|
|
1705
|
+
E2B's own. `create` takes the caller's request id (`{ requestId }`, serve's is the run's claim): the computer's name is
|
|
1706
|
+
`computer-` and the first 12 hex digits of its sha256, and a retry of the same request finds the computer the first
|
|
1707
|
+
made instead of making a second.
|
|
1708
|
+
|
|
1802
1709
|
An E2B computer is a sandbox made from an E2B template, by default `desktop`, E2B Desktop's (Ubuntu 22.04 with Xvfb,
|
|
1803
1710
|
Xfce, x11vnc and noVNC, e2b-dev/desktop `template/template.py:3-65`). It is kind `desktop`: computerd starts the X
|
|
1804
1711
|
server itself, as on a Docker desktop, and its X11 shim drives it. With `kind: "linux"` it is kind `linux`
|
|
1805
1712
|
on any template, `base` by default, with no display: the same provider, minus the X server, so it costs nothing to
|
|
1806
|
-
offer. Every call goes through the host's E2B JS SDK, the `e2b` package's `Sandbox` class,
|
|
1807
|
-
only
|
|
1713
|
+
offer. Every call goes through the host's E2B JS SDK, the `e2b` package's `Sandbox` class, whose types `src/e2b.ts` imports
|
|
1714
|
+
as types only (held as `typeof Sandbox` inside, `object` in the published types), so nothing loads from it at import; the package is the host's to install, as
|
|
1808
1715
|
Modal's is. `@e2b/desktop` is not used: it starts Xvfb and Xfce with `commands.run`, outside computerd's process table
|
|
1809
1716
|
and with no bound or abort (`@e2b/desktop@2.5.0` `dist/index.mjs:387-415`), and the provider needs none of its other
|
|
1810
1717
|
calls.
|
|
@@ -1836,26 +1743,42 @@ E2B's envd is the sandbox's first process, a systemd service with `Restart=alway
|
|
|
1836
1743
|
cancelled: one that lands after create gave up is killed by its id, one whose answer never comes by its name label.
|
|
1837
1744
|
The listing shows a new sandbox a moment late, so the name is listed again until it shows or `listedMs` (15 s)
|
|
1838
1745
|
passes, and the sandbox found is killed and read back gone, as release waits for one.
|
|
1839
|
-
2. `getInfo` reads the sandbox
|
|
1746
|
+
2. `getInfo` reads the sandbox's state until it runs.
|
|
1840
1747
|
3. `files.write` uploads the daemon as root to `/tmp/agentrun-computerd-<random>` (`index.mjs:2332-2435`), and the
|
|
1841
|
-
same install command as Daytona's (`src/
|
|
1842
|
-
sha256, which must be the uploaded one's.
|
|
1843
|
-
4.
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1748
|
+
same install command as Daytona's (`src/hosted/scripts.ts`) moves it to `/opt/agentrun/computerd`, root-owned, and
|
|
1749
|
+
prints its sha256, which must be the uploaded one's, and who installed it (a create note).
|
|
1750
|
+
4. The adapter's start command, a background command as root, starts `computerd init --deadline <time> --user
|
|
1751
|
+
2510:2510 --own-network --max-deadline <create's time plus the cap>` with `DISPLAY=:0`, in a clean environment,
|
|
1752
|
+
detached: in a session of its own (`setsid`), its output to `/run/agentrun-init.log`, so the command ends at once
|
|
1753
|
+
and a daemon that never answers is reported with init's own words. Every command goes through envd's
|
|
1754
|
+
`Process.Start` stream, called on the SDK's own Connect client (`commands.rpc`, `index.mjs:4972-4985`) as
|
|
1755
|
+
`commands.run` calls it (`index.mjs:5123-5146`): `/bin/bash -l -c` and the argv quoted, root by the Basic header
|
|
1756
|
+
(`index.mjs:1896-1900`), envd's keepalive every 50 s, and no deadline on the stream (timeout 0, which the Connect
|
|
1757
|
+
transport reads as none), because envd kills a command whose timeout passes (envd `process/start.go:39-44`); the
|
|
1758
|
+
SDK's default would end it after 60 s (`index.mjs:4978`). Only the start is bounded.
|
|
1759
|
+
5. `connect()` starts `computerd stdio` the same way, as root; every exec has stdin open (`stdin: true`), and `end()`
|
|
1760
|
+
is `closeStdin`. Its stdout is the bytes each data
|
|
1761
|
+
event carries, passed on as they come: `commands.run` would hand them to `onStdout` as text, decoded as UTF-8
|
|
1762
|
+
(`index.mjs:2702`, `2860`), which turns every byte that is not UTF-8 into U+FFFD, so `exec` reads the stream
|
|
1763
|
+
itself. Requests go in with `sendStdin`, one call after another. `close()` kills the bridge (SIGKILL,
|
|
1764
|
+
`index.mjs:5092-5095`), which ends nothing else, and lets go of its stream. The bridge has no command timeout, so one
|
|
1765
|
+
whose start answers after the call gave up on it (its bound passed, or the caller aborted) is killed as it lands.
|
|
1855
1766
|
6. A desktop's X server, `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp`, starts through the daemon with
|
|
1856
1767
|
`process.start`, as the computer's user, and create waits until hello declares the display (`src/desktop.ts`,
|
|
1857
|
-
shared with Docker).
|
|
1858
|
-
|
|
1768
|
+
shared with Docker). Then xfwm4, which the template has, starts the same way on it (`xfwm4 --compositor=off
|
|
1769
|
+
--sm-client-disable`, `WINDOW_MANAGER`), so the apps an agent opens are framed and focused. xfwm4 reads its
|
|
1770
|
+
settings over a session bus and exits without one. So it runs under `dbus-run-session`, in a user namespace (the
|
|
1771
|
+
same uid) and a network namespace of its own (`unshare --user --map-current-user --net`), and its bus listens on an
|
|
1772
|
+
abstract name there, which a program of the computer's user cannot connect to. One that joins those namespaces
|
|
1773
|
+
(nsenter) can, as the same uid can ptrace xfwm4. xfwm4 reaches the display by its path. It and every app `apps.launch` opens get `NO_AT_BRIDGE=1`: the template has at-spi2-core, so GTK's
|
|
1774
|
+
accessibility bridge would start an at-spi bus, a socket of the user's at `/work/.cache/at-spi/bus_0` that nothing
|
|
1775
|
+
of ours uses. An app also gets no session bus (`DBUS_SESSION_BUS_ADDRESS=disabled:`). Given none, it would start
|
|
1776
|
+
one with the template's dbus-launch, and that bus starts gnome-keyring-daemon, a socket of the user's at
|
|
1777
|
+
`/work/.cache/keyring-*/control`. The template has no passwd entry
|
|
1778
|
+
for 2510, and a session bus closes every connection of a uid it cannot look up, so a desktop's init, still root, first names the
|
|
1779
|
+
user `agentrun-tool` (home the computer's, shell `/bin/sh`), as the box image does (`daemon.NameUser`). A window
|
|
1780
|
+
manager that ends within a second of its start fails create with its last words. Hello re-checks the
|
|
1781
|
+
display on every call, so `connect()` refuses a desktop whose X server has gone (it reads back kind `linux`).
|
|
1859
1782
|
|
|
1860
1783
|
envd runs as root and obeys anyone with the API key, as Daytona's toolbox does, and answers on 49983 (`e2b@2.63.0`
|
|
1861
1784
|
`dist/index.mjs:1213`, `envdPort`) inside the sandbox; the computer's daemon runs as 2510:2510 with no capability in
|
|
@@ -1872,9 +1795,9 @@ would hold an empty process table).
|
|
|
1872
1795
|
| --- | --- | --- |
|
|
1873
1796
|
| `kind` | `desktop` (default) or `linux` | `options.kind`; a desktop's X server is computerd's own |
|
|
1874
1797
|
| `lifetime` | `vendor` | E2B kills the sandbox at its timeout, set to the lifetime; init ends every process at the deadline too |
|
|
1875
|
-
| `network` | `none` | `allowInternetAccess` false
|
|
1798
|
+
| `network` | `none` | `allowInternetAccess` false and `allowPublicTraffic` false at create, and the daemon's own network namespace; `open` waits for a proxy out of it (known gap) |
|
|
1876
1799
|
| `vendorAgentPorts` | `[49983]` | envd's port; isolation.vendor-agent checks a program of the computer's user reaches it on neither loopback |
|
|
1877
|
-
| `networkReadBack` | `
|
|
1800
|
+
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
1878
1801
|
| `isolation` | `microvm` | Firecracker |
|
|
1879
1802
|
| `daemon` | `child` | envd is the first process; init is a background command it runs |
|
|
1880
1803
|
| `groups` | `exec`, `files`, `processes`, and on a desktop `screen`, `input.pointer`, `input.keys` | checked against hello on every connect |
|
|
@@ -1911,7 +1834,7 @@ hostname from the connection's first bytes, decides, and closes a denied connect
|
|
|
1911
1834
|
E2B documents no stricter setting: `allowInternetAccess: false` is `denyOut 0.0.0.0/0`, and `dnsServers` matters only
|
|
1912
1835
|
with a domain in `allowOut`. Under the shared rule only an answer refuses network none, so such a sandbox is kept, and
|
|
1913
1836
|
create's and attach's `notes` name the accepted targets: `network: none; accepted with no answer (no bytes came back):
|
|
1914
|
-
1.1.1.1:443, 8.8.8.8:443`. The one live diagnostic (
|
|
1837
|
+
1.1.1.1:443, 8.8.8.8:443`. The one live diagnostic (2026-11-07, a tool since removed) read that: every IPv4 target on 443/tcp and 80/tcp accepted
|
|
1915
1838
|
and closed with 0 bytes, no answer on 53/udp, and, in the provider's own probe, no accept from the IPv6 target. UDP
|
|
1916
1839
|
is not proxied: the same firewall drops non-TCP to the user deny set, which `denyOut` fills, in nftables
|
|
1917
1840
|
(`e2b-dev/infra@ff3922213` `packages/orchestrator/pkg/sandbox/network/firewall.go`, `installRules`, rule 5), so the probe's UDP targets get no reply within the 10 s window
|
|
@@ -1925,14 +1848,6 @@ both ways, since the first byte back refuses network none; it does not catch a o
|
|
|
1925
1848
|
inside can. That is the rule for every provider, confirmed on 11-07, and why every
|
|
1926
1849
|
accept is recorded in words rather than dropped.
|
|
1927
1850
|
|
|
1928
|
-
`dist/conformance/e2b-diagnose.js` (live switch
|
|
1929
|
-
`AGENTRUN_COMPUTER_LIVE_E2B=1`) makes one sandbox exactly as create does for network none, with a 10-minute E2B
|
|
1930
|
-
timeout, records the read-back and the provider's own check (`passed` with its `notes`, or its refusal), runs
|
|
1931
|
-
`computerd probe --diagnose` in it (each check judged as `--connect` judges a target: any byte back is answered),
|
|
1932
|
-
prints one JSON line, and kills the sandbox and reads it back gone, after an error or an abort too (SIGINT, SIGTERM,
|
|
1933
|
-
or its own 8-minute bound). Exit 0 when a diagnosis came back and the sandbox reads gone, 1 otherwise, 2 with no live
|
|
1934
|
-
switch or a refused setting.
|
|
1935
|
-
|
|
1936
1851
|
### Extend and stream
|
|
1937
1852
|
|
|
1938
1853
|
`extend(ref, ttlMs)` sets E2B's timer to now + `ttlMs` (`Sandbox.setTimeout`, `index.mjs:5529-5541`), reads the end
|
|
@@ -1945,10 +1860,12 @@ timer is never pulled under it. When init's move fails after E2B's, the error sa
|
|
|
1945
1860
|
and init's did not: the programs end at the old deadline, earlier than asked, never later. A provider runs one extend
|
|
1946
1861
|
of a computer at a time, each reading the deadline the one before it left, so a slow, shorter extend never pulls E2B's
|
|
1947
1862
|
timer under a longer one's (two providers extending one computer at once are not ordered). E2B has no call that
|
|
1948
|
-
changes metadata, so the deadline label stays as create wrote it, and
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
so
|
|
1863
|
+
changes metadata, so the deadline label stays as create wrote it, and the host reads E2B's own end in its place, up to
|
|
1864
|
+
the cap, once it is more than 2 s past where create set it (its start plus the timeout create gave, by E2B's clock, to
|
|
1865
|
+
the second E2B rounds to). `getInfo` reads the moved end; `Sandbox.list` may still show create's (read live 11-14),
|
|
1866
|
+
so `list()` and `attach()` report the end from `get`, as the adapter reads every listed machine.
|
|
1867
|
+
Extend never leaves E2B's end inside those 2 s, moving it at least 3 s past create's end, so an extend however short
|
|
1868
|
+
reads back.
|
|
1952
1869
|
|
|
1953
1870
|
There is no `stream()`: a screen is streamed through agentrun, never through a vendor URL. A URL into an E2B sandbox
|
|
1954
1871
|
that a browser could open needs public traffic, since a private sandbox's URL needs the `e2b-traffic-access-token`
|
|
@@ -1961,27 +1878,23 @@ words, whatever its value, and every sandbox is made with public traffic off.
|
|
|
1961
1878
|
- `check(spec)` refuses in words, with no call: no template, a lifetime past the cap (the shared `checkLifetime`), a
|
|
1962
1879
|
network that is not none (open and an allowlist alike), a label in the provider's namespace,
|
|
1963
1880
|
`cpus`, `memoryMb` or `pids` (a template's size is its own), `user`, `workdir` and any other field.
|
|
1964
|
-
- `create`
|
|
1965
|
-
reports one), every label, the network (above), `lifecycle.onTimeout` other than `kill`, `autoResume`, a state that
|
|
1966
|
-
is not `running`, and an end that is not E2B's start plus the timeout create gave. Then the daemon: hello (version,
|
|
1881
|
+
- `create` waits for the sandbox to run; E2B's create options are not read back. Then the daemon: hello (version,
|
|
1967
1882
|
`linux`, `amd64`, kind and groups), `/proc/self/status` (uid and gid 1000, no groups, `NoNewPrivs` 1, every
|
|
1968
1883
|
capability set zero), `/proc/self/cwd` (`/work`), `/proc/self/exe`; and for none, the probe. It waits until the label
|
|
1969
1884
|
listing shows the new computer. A failure, mismatch or abort at any step kills the sandbox and waits for it to go;
|
|
1970
1885
|
create never returns ok once its signal has aborted.
|
|
1971
|
-
- `attach({ id })` or `attach({ labels })` reads the
|
|
1972
|
-
create
|
|
1973
|
-
and `snapshot` the id E2B reports.
|
|
1886
|
+
- `attach({ id })` or `attach({ labels })` reads the computer from E2B and, for a running computer, the daemon, as at
|
|
1887
|
+
create. `image` is the template create was asked for, from its label.
|
|
1974
1888
|
- `list(labels)` asks E2B for the labels with `agentrun.computer=1` (`Sandbox.list`, running and paused sandboxes,
|
|
1975
|
-
`index.d.mts:10289`), every page,
|
|
1976
|
-
|
|
1977
|
-
|
|
1889
|
+
`index.d.mts:10289`), every page, for the ids: the adapter reads each one by `getInfo`, since the listing may still
|
|
1890
|
+
show a killed sandbox or an end from before a timer moved; paused is `stopped`. One deadline, `listMs` (60 s) from
|
|
1891
|
+
the call, bounds every page; past it, `list()` is a timeout in words.
|
|
1978
1892
|
- `connect(ref)` refuses a paused computer without connecting, since E2B's connect resumes one; it gives E2B a timeout
|
|
1979
1893
|
a little under what is left, and E2B moves a running sandbox's timer only to a longer one (`index.d.mts:10250`), so
|
|
1980
1894
|
connecting never moves the end.
|
|
1981
1895
|
- `release(ref, "delete")` reads the sandbox back to check it is this provider's, then kills it (`index.mjs:5398-5410`;
|
|
1982
1896
|
a sandbox E2B no longer has is done), both never signalled, so a release whose signal aborted first still kills;
|
|
1983
|
-
then it waits through `waitUntil` until `getInfo` answers not found (`index.mjs:5431`) and the
|
|
1984
|
-
longer shows it, twice running, with pauses doubling from `pollMs` to 5 s, within `goneMs` (120 s) and the caller's
|
|
1897
|
+
then it waits through `waitUntil` until `getInfo` answers not found (`index.mjs:5431`), twice running, with pauses doubling from `pollMs` to 5 s, within `goneMs` (120 s) and the caller's
|
|
1985
1898
|
signal, which ends only this wait.
|
|
1986
1899
|
`release(ref, "stop")` is refused in words.
|
|
1987
1900
|
- Every SDK call has its own bound and takes the caller's signal; the paginator takes it per page (`Sandbox.list`
|
|
@@ -2001,17 +1914,12 @@ computer capped at 30 minutes, Hobby's plan for conformance
|
|
|
2001
1914
|
`test/e2b/conformance.e2b.test.mjs` runs the suite with `computerd-fixture` built for linux/amd64, and skips unless the
|
|
2002
1915
|
switch and `COMPUTER_E2B_API_KEY` are both set; `E2B_API_KEY` never counts.
|
|
2003
1916
|
|
|
2004
|
-
`dist/conformance/
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
gone, 1 when one is still there, 2 on a usage error, an unreadable before file, no key, or a refused listing (nothing is
|
|
2011
|
-
killed then). It reads `COMPUTER_E2B_API_KEY` and `COMPUTER_E2B_DOMAIN` as the conformance module does, and needs no
|
|
2012
|
-
live switch.
|
|
2013
|
-
|
|
2014
|
-
The conformance module's `settingsFromEnv` reads these names, and the sweep and `e2b-diagnose.js` read them through it,
|
|
1917
|
+
The live sweep is the shared one, `dist/conformance/sweep.js --provider e2b --before <file>` and `--after <file>`
|
|
1918
|
+
([PROVIDERS.md](PROVIDERS.md), "The live sweep"): it prints `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`
|
|
1919
|
+
and reads its settings through the conformance module's `createHost`, with no live switch. A conformance run of E2B
|
|
1920
|
+
also sweeps its own label through the host at its end (the report's `cleanup.sweep`).
|
|
1921
|
+
|
|
1922
|
+
The conformance module's `settingsFromEnv` reads these names, and the sweep reads them through it (`createHost`),
|
|
2015
1923
|
each passed to `create()` as the option in brackets: `COMPUTER_E2B_API_KEY` (`apiKey`, required),
|
|
2016
1924
|
`COMPUTER_E2B_DOMAIN` (`domain`), `COMPUTER_E2B_DAEMON` (`daemonPath`), `COMPUTER_E2B_KIND` (`kind`),
|
|
2017
1925
|
`COMPUTER_E2B_MAX_LIFETIME_MS` (`maxLifetimeMs`, a whole number of ms) and `COMPUTER_E2B_USER` (`daemonUser`). It
|
|
@@ -2024,10 +1932,6 @@ One live E2B run has been made, the network diagnostic of 2026-11-07 (one sandbo
|
|
|
2024
1932
|
other fact above is read from the SDK, envd and the desktop template's source, and the unit tests run against a fake.
|
|
2025
1933
|
A live run must show:
|
|
2026
1934
|
|
|
2027
|
-
- that `getInfo` reports `allowInternetAccess` or `denyOut`, and `network.allowPublicTraffic: false`, for a sandbox
|
|
2028
|
-
made with them: the provider refuses a computer whose read-back lacks them, so a missing field fails every create;
|
|
2029
|
-
- that `getInfo` reports a template asked for by alias with that alias, or its id (the drift check skips an alias E2B
|
|
2030
|
-
does not report);
|
|
2031
1935
|
- that a sandbox with no internet access gets no answer from any probe target, IPv6 included (the one diagnostic read
|
|
2032
1936
|
the IPv6 target refused and every IPv4 one accepted with 0 bytes), and what else `denyOut 0.0.0.0/0` lets through;
|
|
2033
1937
|
- that envd keeps init running once create disconnects, and how long `getInfo` takes to answer not found after a kill;
|
|
@@ -2042,6 +1946,160 @@ A live run must show:
|
|
|
2042
1946
|
`packages/envd/internal/services/process/start.go`, `.../process/handler/handler.go:395-420`), and E2B's docs
|
|
2043
1947
|
(network/restrict-public-access and network/internet-access, read 2026-11-07). Each is cited where it is used above and in `src/e2b.ts`.
|
|
2044
1948
|
|
|
1949
|
+
## Agent37
|
|
1950
|
+
|
|
1951
|
+
```ts
|
|
1952
|
+
import { providerFor } from "@parcha/agentrun-computer";
|
|
1953
|
+
|
|
1954
|
+
// Both keys are the caller's to pass (serve's AGENT37_API_KEY and AGENT37_SSH_KEY), and ssh2 is the host's own (npm ssh2 1.17.0).
|
|
1955
|
+
const agent37 = await providerFor("agent37", { apiKey, sshKey });
|
|
1956
|
+
const made = await agent37.create({ image: "agent37-base", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1957
|
+
```
|
|
1958
|
+
|
|
1959
|
+
Agent37 runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/agent37.ts` is Agent37's
|
|
1960
|
+
`MachineHost`, and `src/hosted/provider.ts` does everything that is not Agent37's own (the upload, the install, init's
|
|
1961
|
+
start, the stdio bridge, the probe, the janitor's extend, idempotent create by the request's name label). An Agent37
|
|
1962
|
+
computer is an instance made from a workspace template, by default `agent37-base`, Agent37's plain Debian 12. It is
|
|
1963
|
+
kind `linux`, on type `vm` (a VM with its own kernel, the default) or `default` (Agent37's gVisor sandbox). With
|
|
1964
|
+
`kind: "desktop"` it is a Linux desktop on `agentrun-box`, our box image as a template of the key's workspace
|
|
1965
|
+
([below](#the-desktop-agentrun-box)).
|
|
1966
|
+
|
|
1967
|
+
### Two keys
|
|
1968
|
+
|
|
1969
|
+
`create(options)` takes the workspace's API key as `options.apiKey` and the private half of an SSH key registered on
|
|
1970
|
+
the same workspace (`POST /v1/ssh-keys`, or `agent37 ssh-keys add`) as `options.sshKey`, its contents, never a path:
|
|
1971
|
+
the provider reads no file and no environment. A key pasted into Settings comes back on one line (a password field
|
|
1972
|
+
drops line breaks), so the provider wraps a one-line key's body again before ssh2 reads it. REST takes the API key as
|
|
1973
|
+
`Authorization: Bearer <key>`; the SSH tunnel's edge takes the same key in `X-Agent37-Key` (npm `agent37@0.4.1`
|
|
1974
|
+
`src/cli.js`, `wsHandshake` and `runTunnel`). Neither key appears in an error, a note or a label: the sweep's scope
|
|
1975
|
+
names the API key by its sha256 prefix alone.
|
|
1976
|
+
|
|
1977
|
+
### The mapping
|
|
1978
|
+
|
|
1979
|
+
| MachineHost | Agent37 |
|
|
1980
|
+
| --- | --- |
|
|
1981
|
+
| `create` | `POST /v1/instances` with the template, `type`, `region`, the size when the spec asks one, `name` (the adapter's name label), the labels as `metadata`, `network: "deny-all"` (`"allow-all"` for an Archil computer's root, whose own namespace is still loopback-only), `auto_sleep: false` and `public_ports: []`. It answers 201 once the instance runs |
|
|
1982
|
+
| `get` | `GET /v1/instances/{id}`; 404 is none |
|
|
1983
|
+
| `list` | `GET /v1/instances`, the whole workspace in one answer (`{ data }`, no paging keys, seen live), matched on the labels here. An answer that says it has more is refused, never read as all |
|
|
1984
|
+
| `delete` | `DELETE /v1/instances/{id}`, never signalled; a repeat's 404 is done |
|
|
1985
|
+
| `extend` | `GET`, then `PATCH` of the whole `metadata` with the new deadline label, since a PATCH replaces it |
|
|
1986
|
+
| `exec` | SSH as root over a binary WebSocket to `wss://{id}-22022.agent37.app/`, one channel per process on the instance's shared connection (below) |
|
|
1987
|
+
| `errorCode` | the envelope's `error.code` (or a flat `error` string), then the HTTP status; ssh2's `client-authentication` is `denied` |
|
|
1988
|
+
| `check` | a template name with an optional `@version`; one of Agent37's four shapes; at most 4 CPUs; metadata within 4096 bytes with the provider's own labels |
|
|
1989
|
+
|
|
1990
|
+
Agent37 has no request id and no unique name, so a retried POST makes a second instance: the adapter lists the name
|
|
1991
|
+
label and keeps the oldest by `created` (whole seconds; ties go to the lowest id), as it does for every vendor.
|
|
1992
|
+
|
|
1993
|
+
### Exec over SSH
|
|
1994
|
+
|
|
1995
|
+
Agent37 has no SSH port on the internet: the instance's sshd answers on 22022 inside it, and the edge carries the SSH
|
|
1996
|
+
stream as binary WebSocket frames. `exec` opens a WebSocket (Node's global one takes `headers`), wraps it as a Duplex
|
|
1997
|
+
for ssh2's `Client.connect({ sock })`, and runs argv as `sh -c` under a wrapper that writes the shell's pid to
|
|
1998
|
+
`/tmp/.agentrun-exec-<random>` and removes it when the command ends. stdout and stderr are the channel's, piped; stdin
|
|
1999
|
+
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
|
|
2000
|
+
signal or none; its listeners go on inside ssh2's callback, since one read off the tunnel can hold the open, the exit
|
|
2001
|
+
and the close together (seen live: a listener added after an `await` missed the exit). `kill()` runs a second command
|
|
2002
|
+
on the same connection that kills the pid's process group (the sshd starts each command as a session and group leader,
|
|
2003
|
+
seen live), then closes the exec's channel, never a connection. An SSH signal request is not used: ssh2 sends one only
|
|
2004
|
+
while stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one process, not its children.
|
|
2005
|
+
|
|
2006
|
+
Every exec on an instance is a channel on one SSH connection that the provider shares: the daemon's upload, its install,
|
|
2007
|
+
init's start, the stdio bridge and the live view's watch take one WebSocket and one handshake between them (a tunnel and
|
|
2008
|
+
its handshake take about 0.35 s over Agent37's edge, seen live). Execs that start together wait for one handshake, each
|
|
2009
|
+
within its own bound: one with time left when a shared handshake runs out of its opener's opens its own. The connection
|
|
2010
|
+
opens at the first exec (the four tries below), and a connection that closed or failed is never handed out again; a
|
|
2011
|
+
channel that fails to open (the connection died under it, or its sshd took no more sessions) is opened once more on a
|
|
2012
|
+
fresh connection. One connection carries at most 10 channels at once, execs and kills alike, and the next opens a second:
|
|
2013
|
+
OpenSSH's sshd takes 10 sessions on a connection (`MaxSessions`). A kill's channel goes on any connection with room, since
|
|
2014
|
+
the pid file is the instance's. With no channel left, a connection waits 2 s for the next exec, then ends: an open one
|
|
2015
|
+
keeps the process alive (ssh2's keepalive timer and the WebSocket's socket), so a process done with its computers exits
|
|
2016
|
+
at most that late. `delete` ends every connection to the instance at once, a retired one still carrying channels too.
|
|
2017
|
+
|
|
2018
|
+
### Capabilities
|
|
2019
|
+
|
|
2020
|
+
| Capability | Declared | Why |
|
|
2021
|
+
| --- | --- | --- |
|
|
2022
|
+
| `kind` | `linux` or `desktop` | `options.kind`: `linux` (default), or `desktop` with `screen`, `input.pointer` and `input.keys`, on the box template (below) |
|
|
2023
|
+
| `daemon` | `child` | the image's entrypoint is a template field, not a create field; init is a detached command over SSH |
|
|
2024
|
+
| `isolation` | `vm` or `gvisor` | `options.type`: `vm` (default) or `default` |
|
|
2025
|
+
| `lifetime` | `janitor` | Agent37 never ends an instance on its own; init's deadline and the deadline label do, and the run's sweep is the backstop |
|
|
2026
|
+
| `maxLifetimeMs` | 24 h | the janitor's cap; `options.maxLifetimeMs` sets less |
|
|
2027
|
+
| `network` | `none` | `deny-all` at create, and the daemon's own network namespace |
|
|
2028
|
+
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
2029
|
+
| `vendorAgentPorts` | `[22022, 7681]` | the platform's sshd (root for whoever holds the key) and its web terminal (ttyd), both seen listening on every VM |
|
|
2030
|
+
| `mount` | `archil` | the run's folder on an Archil disk; `/dev/fuse` is there on both types (live), and the mount needs the box template |
|
|
2031
|
+
| `release` | `delete` | `DELETE`; no release maps to Agent37's stop here |
|
|
2032
|
+
| `specFields` | `cpus`, `memoryMb` | 2/4, 4/8, 4/16 or 4/32 (CPUs/GB); more than 4 CPUs is refused, since Agent37 gives 4 without saying so |
|
|
2033
|
+
|
|
2034
|
+
Every instance is made with `auto_sleep: false`: a VM that sleeps wakes cold, its daemon gone. What create sent is not
|
|
2035
|
+
read back.
|
|
2036
|
+
|
|
2037
|
+
### Conformance on Agent37
|
|
2038
|
+
|
|
2039
|
+
```sh
|
|
2040
|
+
AGENTRUN_COMPUTER_LIVE_AGENT37=1 COMPUTER_AGENT37_API_KEY=... COMPUTER_AGENT37_SSH_KEY="$(cat key)" \
|
|
2041
|
+
npm run conformance -w @parcha/agentrun-computer -- --provider agent37
|
|
2042
|
+
```
|
|
2043
|
+
|
|
2044
|
+
The conformance module, `dist/conformance/agent37.js`, checks `AGENTRUN_COMPUTER_LIVE_AGENT37=1` first, then reads
|
|
2045
|
+
`COMPUTER_AGENT37_API_KEY` (`apiKey`, required), `COMPUTER_AGENT37_SSH_KEY` (`sshKey`, required, the key's contents),
|
|
2046
|
+
`COMPUTER_AGENT37_KIND` (`linux`, the default, or `desktop`), `COMPUTER_AGENT37_TEMPLATE` (the run's image, default
|
|
2047
|
+
`agent37-base`, or `agentrun-box` for kind `desktop`), `COMPUTER_AGENT37_TYPE`, `COMPUTER_AGENT37_REGION`,
|
|
2048
|
+
`COMPUTER_AGENT37_API_URL`, `COMPUTER_AGENT37_DAEMON` (`daemonPath`), `COMPUTER_AGENT37_MAX_LIFETIME_MS` and
|
|
2049
|
+
`COMPUTER_AGENT37_USER` (`daemonUser`), never `AGENT37_API_KEY`. Every computer of a run lives at most 30 minutes.
|
|
2050
|
+
`createDriftedProvider()` uploads a daemon built as `<version>-drift`. The live sweep is the shared one,
|
|
2051
|
+
`dist/conformance/sweep.js --provider agent37 --before <file>` and `--after <file>`; its scope is the key's workspace.
|
|
2052
|
+
|
|
2053
|
+
### Seen live (2026-11-13)
|
|
2054
|
+
|
|
2055
|
+
Twelve instances, at most two at once, every one labelled for the sweep and deleted; the workspace listed no instance
|
|
2056
|
+
after. One fresh VM's tunnel failed to open for the daemon's upload, so a tunnel that fails before its SSH handshake is
|
|
2057
|
+
opened again (four tries in all, within the call's bound). On type `vm` with `agent37-base`: the POST answered `running` in about 1 s (the provider's whole create,
|
|
2058
|
+
daemon included, 4 to 8 s); the read-back held `deny-all`, no public port, `auto_sleep: false`, 2 CPUs and 4 GB,
|
|
2059
|
+
dotted metadata keys and odd values; metadata's cap is 4096 bytes serialized, exactly; commands run as uid 0 on
|
|
2060
|
+
Debian 12 under the platform's own init; 3 MiB of stdin took half a second over the tunnel; the daemon started, hello
|
|
2061
|
+
answered with fence `netns`, and its programs ran as 2510 with no capability and no DNS. On type `default` (gVisor,
|
|
2062
|
+
kernel `4.19.0-gvisor`): root has no `CAP_SYS_ADMIN`, and init made its namespace inside a user namespace of its own
|
|
2063
|
+
(fence `userns-netns`); the rest as on `vm`. The Archil mount itself is the conformance run's to show, on the box template.
|
|
2064
|
+
|
|
2065
|
+
### The desktop: agentrun-box
|
|
2066
|
+
|
|
2067
|
+
`create({ kind: "desktop", ... })` (serve builds the descriptor's desktop configuration so) makes a desktop: the
|
|
2068
|
+
adapter gives init `DISPLAY` and starts `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp` through the daemon as the tool
|
|
2069
|
+
user (`src/desktop.ts`), as on E2B, so the X server is one process in init's table, in its own network namespace, and
|
|
2070
|
+
ends with the computer; xfwm4 starts the same way once the display answers, its session bus out of the user's reach, as
|
|
2071
|
+
on E2B. Its default image is `agentrun-box`
|
|
2072
|
+
(`AGENT37_BOX_TEMPLATE`): `box/Dockerfile` (the archil client, the helper, the tool user, FUSE, no sudo, and its
|
|
2073
|
+
desktop: Xvfb, xfwm4, and the apps E2B Desktop has that are cheap to carry, Xfce's terminal and Mousepad, Firefox ESR,
|
|
2074
|
+
xdotool), which the `apps` group lists and opens, built as a template of the key's own workspace by `box/build-agent37.mjs`:
|
|
2075
|
+
|
|
2076
|
+
```sh
|
|
2077
|
+
AGENT37_API_KEY=... node packages/computer/box/build-agent37.mjs # prints template=agentrun-box
|
|
2078
|
+
```
|
|
2079
|
+
|
|
2080
|
+
Agent37 keeps a template's revisions under one name, so the name is fixed and the recipe's hash (`box/recipe.mjs`: the
|
|
2081
|
+
Dockerfile and the helper, the published image's hash too) is in the template's description: a workspace whose template names the
|
|
2082
|
+
hash already is built nothing, and a changed recipe publishes a new revision, which every instance made after it starts
|
|
2083
|
+
from. The script's calls: `GET /v1/templates/agentrun-box`, then `POST /v1/template-builds` (`name`, `size_bytes`,
|
|
2084
|
+
`description`), a `PUT` of the gzipped context (the Dockerfile and the helper at its root) to the presigned
|
|
2085
|
+
`upload_url` with no Agent37 key, `POST .../{id}/start`, and `GET .../{id}/logs?offset=N` until `succeeded` or `failed`.
|
|
2086
|
+
Builds are free, at most three at once per workspace and 45 minutes each (docs: templates, "Build an image in the
|
|
2087
|
+
cloud"). A workspace template is the workspace's own, so each workspace that runs desktops builds it once first.
|
|
2088
|
+
|
|
2089
|
+
Why not Agent37's own `agent37-ubuntu`, which ships a desktop: its image (`ghcr.io/agent37-platform/ubuntu:2026.10.13c`,
|
|
2090
|
+
entrypoint `images/vm/ubuntu/entrypoint.sh` of agent37-platform/templates) runs `Xtigervnc :1 ... -ac` as root, with
|
|
2091
|
+
access control off, and an XFCE session as root on it. Any process in the machine can open that display, so a tool
|
|
2092
|
+
driving it, or merely connecting to `/tmp/.X11-unix/X1`, could type into root's terminal: the tool user would have a way
|
|
2093
|
+
to root. It has no Xvfb, no archil client and no helper either, and it is Ubuntu with `sudo` installed. The box image is
|
|
2094
|
+
also the one an Archil computer needs, so one template serves both.
|
|
2095
|
+
|
|
2096
|
+
### Sources
|
|
2097
|
+
|
|
2098
|
+
Agent37's docs under `https://www.agent37.com/docs/agents-api/` (instances create, get, list, edit, delete and object;
|
|
2099
|
+
errors; instance-sizing; vm-instances; instance-network; ssh; templates; custom-image), read 2026-11-13; npm
|
|
2100
|
+
`agent37@0.4.1` `src/cli.js` (the tunnel); `ssh2@1.17.0` (`lib/client.js`, `lib/Channel.js`, `lib/utils.js`); and
|
|
2101
|
+
the live runs above.
|
|
2102
|
+
|
|
2045
2103
|
## Orgo: Windows and macOS desktops (parked)
|
|
2046
2104
|
|
|
2047
2105
|
Orgo offers its Linux desktop alone, which runs computerd (`src/orgo.ts`). Its Windows and macOS desktops are parked:
|
|
@@ -2156,10 +2214,10 @@ and are never in a ref, a list, an error's words or a report. `client` stays a `
|
|
|
2156
2214
|
| a computer is | a session (`POST /v1/sessions`, `keepAlive: true`) | a browser (`POST /browsers`) |
|
|
2157
2215
|
| labels ride | the session's `userMetadata`, each key's dots written as `_` (Browserbase refuses a dot in a metadata key), so a label key is letters, digits and dots | the browser's `tags` |
|
|
2158
2216
|
| lifetime | the session's `timeout`, 60 s to 6 h, wall clock | `timeout_seconds`, 10 s to 72 h, an idle timeout: no wall clock, so list reads no deadline |
|
|
2159
|
-
| groups (`
|
|
2217
|
+
| groups (the descriptor's `capabilities`) | `cdp`, `stream` | `cdp`, `stream` |
|
|
2160
2218
|
| test connection | one `GET /v1/sessions?status=RUNNING` | one `GET /browsers?status=active` page |
|
|
2161
2219
|
| release | `REQUEST_RELEASE`, then read back until it is no longer `RUNNING` or `PENDING` | `DELETE`, then read back until 404 or `deleted_at` |
|
|
2162
|
-
| options | `apiKey
|
|
2220
|
+
| options | `apiKey`, `projectId`, `apiUrl`, `fetch` | `apiKey`, `apiUrl`, `fetch` |
|
|
2163
2221
|
| conformance reads | `COMPUTER_BROWSERBASE_API_KEY`, `COMPUTER_BROWSERBASE_PROJECT_ID`, `COMPUTER_BROWSERBASE_API_URL` | `COMPUTER_KERNEL_API_KEY`, `COMPUTER_KERNEL_API_URL` |
|
|
2164
2222
|
|
|
2165
2223
|
Both declare `lifetime: "vendor"`, `network: ["open"]`, `isolation: "vm"`, `release: ["delete"]`, and no `extend`
|
|
@@ -2194,10 +2252,9 @@ kind browser that declares them.
|
|
|
2194
2252
|
A pointer is a capability: whoever holds it opens the profile, so no error's words carry one.
|
|
2195
2253
|
|
|
2196
2254
|
A vendor call is one request, never retried where a retry could open a second paid browser, and a failure names the
|
|
2197
|
-
call and the HTTP status alone, never the vendor's words.
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
cause (`causeOf(result)`), not enumerable, so it is in no JSON.
|
|
2255
|
+
call and the HTTP status alone, never the vendor's words. The calls are the provider's own, over `fetch` (a test passes
|
|
2256
|
+
its own `fetch`). A thrown error rides the failure as a hidden cause (`causeOf(result)`), not enumerable, so it is in no
|
|
2257
|
+
JSON.
|
|
2201
2258
|
|
|
2202
2259
|
Each create writes one more label beside the spec's, `agentrun.create` (`CREATE_LABEL`), with a value of its own. A
|
|
2203
2260
|
create whose outcome is unknown (its reply lost, cut short, answered 5xx or with no browser, or the caller's signal
|
|
@@ -2226,7 +2283,7 @@ on the machine AgentRun runs on. No vendor, no key, nothing billed.
|
|
|
2226
2283
|
import { LocalBrowserProvider } from "@parcha/agentrun-computer/local-chrome";
|
|
2227
2284
|
|
|
2228
2285
|
const local = new LocalBrowserProvider({ env: { PATH: process.env.PATH } }); // or { executablePath: "/usr/bin/chromium" }
|
|
2229
|
-
const made = await local.create({ image: "chromium", lifetimeMs: 30 * 60_000, network: "open" });
|
|
2286
|
+
const made = await local.create({ image: "chromium", lifetimeMs: 30 * 60_000, network: "open" }, { requestId: "r1#3" });
|
|
2230
2287
|
const connected = await local.connect(made.value); // connected.value.cdp.url: ws://127.0.0.1:<port>/devtools/browser/<id>
|
|
2231
2288
|
await local.release(made.value, "delete");
|
|
2232
2289
|
```
|
|
@@ -2300,17 +2357,30 @@ AGENTRUN_COMPUTER_LIVE_LOCAL_CHROME=1 [COMPUTER_LOCAL_CHROME_PATH=/usr/bin/chrom
|
|
|
2300
2357
|
import { providerFor } from "@parcha/agentrun-computer";
|
|
2301
2358
|
|
|
2302
2359
|
const phones = await providerFor("phone-harness", { apiKey }); // serve passes PHONE_HARNESS_API_KEY
|
|
2303
|
-
const made = await phones.create({ image: "android", lifetimeMs: 10 * 60_000, network: "open", labels: { run } });
|
|
2360
|
+
const made = await phones.create({ image: "android", lifetimeMs: 10 * 60_000, network: "open", labels: { run } }, { requestId: "r1#3" });
|
|
2304
2361
|
```
|
|
2305
2362
|
|
|
2306
2363
|
`src/phone-harness.ts`, provider id `phone-harness`, rents a temporary cloud Android emulator from the phone harness
|
|
2307
2364
|
(phone-harness.com). The phone harness bills it at 5 cents a minute from the account's credit. A cloud iPhone (driven by
|
|
2308
2365
|
the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
2309
2366
|
|
|
2310
|
-
- **
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2367
|
+
- **phoned, the phone's driver.** `connect()` asks the phone harness for the session's adb link, connects to it,
|
|
2368
|
+
unlocks the phone with the session's code (never in a result or an error) and probes it. Then it starts phoned
|
|
2369
|
+
(`daemon-android/`, one dex jar built by `npm run build:phoned` into `dist/phoned.jar`) and speaks the protocol to it:
|
|
2370
|
+
- The jar goes to `/data/local/tmp/phoned-<sha256 prefix>.jar` only when the phone lacks it: pushed beside that name,
|
|
2371
|
+
moved there and its sha256 checked, so a jar of that name is always whole.
|
|
2372
|
+
- phoned runs as the shell user through `app_process`, scrcpy's way in, on adb's `exec:` service, whose socket
|
|
2373
|
+
carries its stdin and stdout raw; its stderr goes to a log beside the jar, which a failed hello names.
|
|
2374
|
+
- The hello is phoned's own, checked for this provider's version and protocol (`drift.version`'s words).
|
|
2375
|
+
- UiAutomation is one per phone, so one phoned answers every connection to a phone. Closing a connection cancels
|
|
2376
|
+
its own calls; the last close ends phoned (its stdin closes), then drops the adb transport. A phoned that ends on
|
|
2377
|
+
its own fails its connections' calls with `gone`, and the next connect starts another.
|
|
2378
|
+
- A phoned holds the phone's UiAutomation until it exits, a moment after its stdin closes, so the next phoned on a
|
|
2379
|
+
phone starts only once the last is gone: the provider keeps each phoned's pid and start time (its shell writes them
|
|
2380
|
+
before `app_process` takes its place, so a pid another process took later is not it) and waits on the phone up to
|
|
2381
|
+
10 s for that process to end, kills it then, and fails
|
|
2382
|
+
the connect in words if a kill leaves it running. A UiAutomation held by something else (`uiautomator dump`, an
|
|
2383
|
+
instrumentation test, Appium) is not waited for: the first ui call is `unsupported` in words that name them.
|
|
2314
2384
|
- Neither the endpoint nor the code is ever in a spawned adb's argv, which `/proc` shows to every user of the host.
|
|
2315
2385
|
The endpoint goes to the local adb server over its socket protocol (`host:connect`, `host:devices-l`,
|
|
2316
2386
|
`host:disconnect`). The unlock is the vendor's shell command `unlock <code>`, once per connection; every shell
|
|
@@ -2319,34 +2389,15 @@ the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
|
2319
2389
|
spawned adb names the phone by the adb server's transport id (`-t <id>`). A shell's stdin cannot carry the unlock:
|
|
2320
2390
|
a shell with no command string is answered `locked` (live run 3); the socket path unlocked a phone live (probe 1).
|
|
2321
2391
|
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
- tap and long press;
|
|
2332
|
-
- swipe: `input swipe`, or `input motionevent` for a path of three points or more. Its `ms` is shared between the
|
|
2333
|
-
moves as `sleep`s, by each segment's length, so it lasts `ms` at least;
|
|
2334
|
-
- the back, home and app switch buttons;
|
|
2335
|
-
- `type`, by `input text`: ASCII and line breaks. A literal `%s` is split across two calls, so it is not read as
|
|
2336
|
-
a space;
|
|
2337
|
-
- one key at a time (`input keyevent`), and `wait`.
|
|
2338
|
-
|
|
2339
|
-
A cancelled batch stops at the action it is on, a `wait` included, and answers failed, kind `aborted`, there;
|
|
2340
|
-
- `apps.list` (`pm list packages`, and the app in front from `dumpsys activity activities`), `apps.launch` (its
|
|
2341
|
-
launcher activity, `am start -W --activity-clear-task`, so the app named is in front and not what its task last
|
|
2342
|
-
held: on Android 15 Settings' task keeps search, another package, on top) and `apps.terminate` (`am force-stop`);
|
|
2343
|
-
- `apps.ui_tree`: `uiautomator dump`.
|
|
2344
|
-
|
|
2345
|
-
exec, files, processes and tar are refused in words: a phone has no shell in the computer protocol. So are pinch
|
|
2346
|
-
(adb's `input` has one finger), hold, a combo of keys, `apps.install` and `deadline.extend`.
|
|
2347
|
-
- **Capabilities.** Kind and os `android`, daemon `none`, lifetime `vendor`, network `open`, release `delete` only.
|
|
2348
|
-
Groups `screen`, `input.touch`, `input.keys`, `apps` and `apps.ui_tree`. `maxLifetimeMs` is 30 min by default. No
|
|
2349
|
-
mount, no extend.
|
|
2392
|
+
phoned answers on the phone itself (`daemon-android/README.md` has each method): `exec.run` as the shell user,
|
|
2393
|
+
`screen.shot`/`screen.read`/`screen.watch` scaled on the phone, `input.actions` through InputManager (taps, swipes,
|
|
2394
|
+
a pinch, key combos and holds, Unicode text through the clipboard), `apps.list`/`apps.launch`/`apps.terminate`, and
|
|
2395
|
+
the `ui` group (`ui.observe`, `ui.act`) from UiAutomation. files, processes and tar are refused in words, as are `apps.install` and
|
|
2396
|
+
`deadline.extend`.
|
|
2397
|
+
- **Capabilities.** Kind and os `android`, daemon `none` (nothing is installed: phoned lives as long as the phone's
|
|
2398
|
+
connections), lifetime `vendor`, network `open`, release `delete` only.
|
|
2399
|
+
Groups `exec`, `screen`, `input.touch`, `input.keys`, `apps` and `ui`. `maxLifetimeMs` is 30 min by default.
|
|
2400
|
+
No mount, no extend.
|
|
2350
2401
|
- **create** asks for `timeout_seconds` = the lifetime, and the phone harness ends the session then, whatever happens.
|
|
2351
2402
|
The lifetime includes the boot, so a phone ready past its deadline fails `timeout`.
|
|
2352
2403
|
- Each POST carries an Idempotency-Key, and a create whose answer is uncertain is found by it, never sent twice.
|
|
@@ -2399,17 +2450,19 @@ Conformance (`src/conformance/phone-harness.ts`) reads `COMPUTER_PHONE_HARNESS_A
|
|
|
2399
2450
|
`maxLifetimeMs`.
|
|
2400
2451
|
|
|
2401
2452
|
With no fixture app (it takes no files), the touch, keys and apps cases drive the stock Settings app and read back
|
|
2402
|
-
through `
|
|
2453
|
+
through `ui.observe` (`src/conformance/cases/settings.ts`):
|
|
2403
2454
|
- `touch.tap`: a tap on a row opens its page: the row's title shows, as a text or a label (Android 15's page has it
|
|
2404
2455
|
only as its toolbar's content-desc), and the next row is gone. Back comes back. When the page does not
|
|
2405
2456
|
come, its words say what it saw: the screen in px and dp, what is in front, the tap point and the row's bounds,
|
|
2406
2457
|
whether the title shows outside the list, and whether the next row is still shown;
|
|
2407
2458
|
- `touch.swipe`: a swipe up moves the list up;
|
|
2408
2459
|
- `input.type-text` and `input.key-table-refuses-unknown`: the text read back from the search field;
|
|
2409
|
-
- `apps.launch-terminate`, which needs the apps group alone:
|
|
2410
|
-
shown, in `
|
|
2411
|
-
is not in front;
|
|
2412
|
-
- `apps.
|
|
2460
|
+
- `apps.launch-terminate`, which needs the apps group alone: the ui fixture where it is installed, else Settings, is
|
|
2461
|
+
listed; once launched it is in front, and shown, in `ui.observe` when the phone reads its elements, else in a
|
|
2462
|
+
screenshot (or `ui.observe`'s image) other than the one before; once terminated it is not in front;
|
|
2463
|
+
- `apps.launch-window`: once `apps.launch` answers, a `ui.observe` sent at once finds the app's window (launch waits
|
|
2464
|
+
for it, at most 10 s), on the ui fixture where it is installed, else on Settings;
|
|
2465
|
+
- `ui.observe-shape`: the observation's shape, on the ui fixture where it is installed, else on Settings.
|
|
2413
2466
|
|
|
2414
2467
|
`touch.pinch` skips in the provider's own refusal.
|
|
2415
2468
|
|
|
@@ -2427,7 +2480,8 @@ npm run conformance -w @parcha/agentrun-computer -- --provider ./my-provider.js
|
|
|
2427
2480
|
|
|
2428
2481
|
```text
|
|
2429
2482
|
computer conformance · docker · linux, daemon pid1 · computerd 0.1.0-beta.30 linux/amd64
|
|
2430
|
-
core health hello ping unknown-method kind-consistent ✓
|
|
2483
|
+
core health hello ping unknown-method kind-consistent ✓ 5
|
|
2484
|
+
kind-served
|
|
2431
2485
|
core exec argv streams exit-code cwd env timeout abort ✓ 11
|
|
2432
2486
|
truncation setsid-escapee unprivileged user
|
|
2433
2487
|
...
|
|
@@ -2436,9 +2490,15 @@ full lifetime extend - 1
|
|
|
2436
2490
|
optional screen screenshot-size - 1
|
|
2437
2491
|
- screen.screenshot-size: the provider does not declare screen
|
|
2438
2492
|
...
|
|
2439
|
-
core PASS
|
|
2493
|
+
core PASS 55/55 · 10 optional cases skipped, not declared · full 10/13 · mount:archil screen input.pointer input.keys input.touch apps.install apps ui extend not declared
|
|
2440
2494
|
```
|
|
2441
2495
|
|
|
2496
|
+
A hosted vendor runs the exec pre-check first, with `--exec-stream --machine <id> [--quick]`: the module's
|
|
2497
|
+
`createHost(options)` and `host.exec` alone, on a machine made by hand, checked for a live, two-way, byte-exact stream
|
|
2498
|
+
with no timeout (`src/conformance/exec-stream.ts`; [the contract](../../spec/computer/provider.md#a-hosted-vendors-exec)).
|
|
2499
|
+
It exits 0 when every check passes and 1 when one fails, and `--json` prints `{ host, machine, checks: [{ id, status,
|
|
2500
|
+
words, ms }], pass }`.
|
|
2501
|
+
|
|
2442
2502
|
An id is resolved through the provider registry, and only there; the usage lists every id it holds. A module path is
|
|
2443
2503
|
resolved from the directory npm was run in. It exits 0 when Core passes, 1 when it fails, 2 on a
|
|
2444
2504
|
usage error, and 3 on a partial run; `--json` prints the report object (`{ provider, providerVersion, kind,
|
|
@@ -2521,7 +2581,8 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2521
2581
|
[The protocol extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)): exec, files,
|
|
2522
2582
|
processes and network `none` wherever computerd runs, screen and keyboard and pointer on a desktop, screen and touch
|
|
2523
2583
|
on a phone. `health.kind-consistent` checks the kind, os and daemon pair, that hello's kind and groups are the
|
|
2524
|
-
provider's, and that kind's Core groups are declared; `
|
|
2584
|
+
provider's, and that kind's Core groups are declared; `health.kind-served` that hello declares every group its
|
|
2585
|
+
setting kind needs to be given to an agent (`kindServed`); `provider.check-refuses` also asks `check` for
|
|
2525
2586
|
`maxLifetimeMs + 1`. Where the kind makes them Core: `screen.screenshot-size` (every pixel of the PNG decodes, its
|
|
2526
2587
|
IHDR size is `width` x `height`, `scale` is above 0, a region shot decodes and has the region's size, and on a
|
|
2527
2588
|
desktop the fixture's four colors are where it paints them; the suite reads 8-bit, non-interlaced PNGs of at most
|
|
@@ -2531,8 +2592,8 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2531
2592
|
kind `invalid`, and runs nothing), `input.actions-stops-at-first-failure` (move, left button down, move off the screen,
|
|
2532
2593
|
click: `done` 2, the press released where it was, no click, and a later click lands, so nothing was left held), `touch.tap` and `touch.swipe` (the
|
|
2533
2594
|
fixture app logs the tap at its point, and the swipe's start and end), `apps.install-launch` (installed, listed, in
|
|
2534
|
-
front when launched and not when terminated) and `
|
|
2535
|
-
|
|
2595
|
+
front when launched and not when terminated) and `ui.observe-shape` (every node typed as the protocol says, inside
|
|
2596
|
+
its window, with the fixture's button found by its id and text).
|
|
2536
2597
|
- **Full** is each optional capability a provider declares: network `open` (`network:open`), a network allowlist
|
|
2537
2598
|
(`network:allow`), each with a change of a computer's network to it and back to `none`, refused or applied
|
|
2538
2599
|
truthfully, on a computer of the case's own (`provider.network-switch`, `provider.network-switch-allow`), the janitor for a provider whose lifetime is `"janitor"` and that stops computers and keeps them
|
|
@@ -2577,8 +2638,8 @@ installed with `apps.install` and launched, logging to its files directory, with
|
|
|
2577
2638
|
`ai.agentrun.fixture:id/button` that reads `agentrun fixture`). Each event is one JSON line (`ready`, `down`/`up` with
|
|
2578
2639
|
button and point, `wheel`, `key`, `text`, `touch` with finger and phase); `src/conformance/fixture.ts` is the
|
|
2579
2640
|
contract. A case that needs it and was given none skips, so Core cannot pass on a desktop or phone without it. The
|
|
2580
|
-
fixture is stopped when its case ends, once launched, even when it never logged ready. A phone that declares neither files nor `
|
|
2581
|
-
`no way to observe the effect: declare files or
|
|
2641
|
+
fixture is stopped when its case ends, once launched, even when it never logged ready. A phone that declares neither files nor `ui` skips the touch cases:
|
|
2642
|
+
`no way to observe the effect: declare files or ui`.
|
|
2582
2643
|
|
|
2583
2644
|
The suite makes every computer with the label `agentrun.conformance=<run id>`, image `--image`, a 30-minute lifetime
|
|
2584
2645
|
and network `none` (`open` for a phone that declares no `none`, since its kind does not require it). It deletes each computer a case made when the case ends, and the shared one at the end; for a
|
|
@@ -2590,8 +2651,8 @@ its case ended is deleted or closed as it arrives and named in `cleanup.late`; t
|
|
|
2590
2651
|
create a case started, a refused one included, so a late computer is deleted before the report returns. A call still
|
|
2591
2652
|
pending when that bound (a minute) runs out is named in `cleanup.errors`, since what it makes may be left, and Core
|
|
2592
2653
|
fails, as it does for a computer left behind. A case calls
|
|
2593
|
-
`t.create(extra)` for a computer it needs, or `t.attempt(spec, by?)` for create's result as it is (a refusal it
|
|
2594
|
-
expects, or the drifted provider's computer). With `--provider docker` and no
|
|
2654
|
+
`t.create(extra)` for a computer it needs, or `t.attempt(spec, by?, requestId?)` for create's result as it is (a refusal it
|
|
2655
|
+
expects, or the drifted provider's computer; each attempt is a new request unless `requestId` retries one). With `--provider docker` and no
|
|
2595
2656
|
`COMPUTER_DOCKER_DAEMON`, a `docker version` that does not answer within 30 s is killed and the run fails, naming the call. The CLI exits once the report
|
|
2596
2657
|
is out. Cases do not assume root: the suite assumes only that the
|
|
2597
2658
|
computer's `HOME`, which the provider sets, is a directory its user can write, and works under
|
|
@@ -2675,7 +2736,6 @@ refuses an id it does not hold, naming the ones it does. The provider file, `src
|
|
|
2675
2736
|
`ProviderModule` is:
|
|
2676
2737
|
|
|
2677
2738
|
- the provider class, which implements `ComputerProvider` and reports the registry id as its `id`;
|
|
2678
|
-
- `MOUNT`, the mount kinds its computers take;
|
|
2679
2739
|
- `create(options)`, the provider built from its options alone, its key included, and refused in words when one is
|
|
2680
2740
|
missing or wrong, never echoing a key. It reads no environment (see [Settings](#settings)), and exports no names of
|
|
2681
2741
|
variables;
|
|
@@ -2703,9 +2763,15 @@ npm run conformance -w @parcha/agentrun-computer -- --provider fly
|
|
|
2703
2763
|
|
|
2704
2764
|
```sh
|
|
2705
2765
|
npm run build -w @parcha/agentrun-computer # the TypeScript, into dist/
|
|
2706
|
-
npm run build:daemon -w @parcha/agentrun-computer # dist/computerd-linux-amd64 and -arm64
|
|
2766
|
+
npm run build:daemon -w @parcha/agentrun-computer # dist/computerd-linux-amd64 and -arm64, and dist/computerd.json
|
|
2707
2767
|
```
|
|
2708
2768
|
|
|
2769
|
+
`build:daemon` builds the daemon with Go 1.24 or newer when Go is on PATH, and records the daemon source it came from in
|
|
2770
|
+
`dist/computerd.json`. Without Go, it takes both binaries from this version's package on npm, but only when that
|
|
2771
|
+
package's `computerd.json` names the same daemon source as the checkout (`scripts/daemon-source.mjs`); otherwise it
|
|
2772
|
+
stops and says to install Go. Each release carries the record, so a checkout of a released version needs no Go until
|
|
2773
|
+
its daemon changes.
|
|
2774
|
+
|
|
2709
2775
|
## Tests
|
|
2710
2776
|
|
|
2711
2777
|
```sh
|
|
@@ -2735,7 +2801,7 @@ and `alpine:3.20` pulled, both builds, and Go on PATH (the drift case builds a d
|
|
|
2735
2801
|
the daemon for Docker's own architecture, and remove every container they make by its exact name, pass or fail.
|
|
2736
2802
|
`test/docker/image.docker.test.mjs` builds fresh `alpine:3.20` recipes: once for three concurrent callers, reused on
|
|
2737
2803
|
the next call, from three processes at once, and a broken one refused in words; it removes each tag it made. Another,
|
|
2738
|
-
`test/docker/
|
|
2804
|
+
`test/docker/pid1-commands.docker.test.mjs`, runs the adapter's pid1 entrypoint and install (Modal's) exactly as sent, in
|
|
2739
2805
|
a Debian and an Alpine root container with no network, and checks that init comes up as uid 1000 with no capabilities
|
|
2740
2806
|
and `no_new_privs`, and answers hello over `computerd stdio`. Those root containers keep Docker's default
|
|
2741
2807
|
capabilities and add CAP_SYS_ADMIN and CAP_NET_ADMIN (init `--own-network` needs both, and Modal's root holds every
|
|
@@ -2753,7 +2819,10 @@ capabilities.
|
|
|
2753
2819
|
container of the desktop fixture's image, starts Xvfb through the daemon on the display init was given and waits for
|
|
2754
2820
|
hello to declare the screen, and checks that `deadline.extend` moves up to `--max-deadline` and no further. The
|
|
2755
2821
|
programs the daemon starts get no `DISPLAY` of init's (it passes on only PATH, HOME, USER and LOGNAME): a caller that
|
|
2756
|
-
starts a GUI program gives it `DISPLAY` in the request's `env`, on E2B as on Docker.
|
|
2822
|
+
starts a GUI program gives it `DISPLAY` in the request's `env`, on E2B as on Docker. The surface is that caller for an
|
|
2823
|
+
agent: on a desktop whose hello names a display, `shell.run` and `processes.start` add it under the call's own `env`.
|
|
2824
|
+
`processes.start` is `process.start` with `orphans: "keep"`, so an app (or the app a launcher forks) stays open after
|
|
2825
|
+
the call, where `exec.run`'s guard ends everything its command started.
|
|
2757
2826
|
|
|
2758
2827
|
## Acknowledgements
|
|
2759
2828
|
|