@parcha/agentrun-computer 0.1.0-beta.37 → 0.1.0-beta.39
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/README.md +341 -260
- package/box/Dockerfile +18 -1
- package/box/README.md +14 -0
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +41 -18
- package/box/recipe.d.mts +5 -0
- package/box/recipe.mjs +43 -0
- package/dist/agent37.d.ts +18 -66
- package/dist/agent37.js +187 -464
- package/dist/box-image.d.ts +14 -0
- package/dist/box-image.js +24 -0
- package/dist/browserbase.d.ts +0 -6
- package/dist/browserbase.js +1 -5
- package/dist/client.d.ts +12 -3
- package/dist/client.js +39 -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 +9 -4
- package/dist/conformance/agent37.js +23 -11
- package/dist/conformance/browserbase.js +3 -3
- package/dist/conformance/cases/apps.d.ts +6 -0
- package/dist/conformance/cases/apps.js +18 -5
- package/dist/conformance/cases/isolation.d.ts +22 -5
- package/dist/conformance/cases/isolation.js +97 -16
- package/dist/conformance/cases/mount.js +5 -3
- package/dist/conformance/cases/provider.js +41 -0
- package/dist/conformance/cli.js +72 -11
- package/dist/conformance/daytona.d.ts +9 -20
- package/dist/conformance/daytona.js +12 -21
- package/dist/conformance/e2b.js +9 -4
- package/dist/conformance/exec-stream.d.ts +52 -0
- package/dist/conformance/exec-stream.js +493 -0
- package/dist/conformance/kernel.js +2 -2
- package/dist/conformance/modal.js +1 -1
- package/dist/conformance/orgo.js +2 -2
- package/dist/conformance/sweep.js +8 -8
- package/dist/conformance/types.d.ts +2 -2
- package/dist/create-requests.d.ts +1 -1
- package/dist/daytona.d.ts +17 -133
- package/dist/daytona.js +396 -1452
- package/dist/descriptor.d.ts +11 -4
- package/dist/descriptor.js +7 -0
- package/dist/descriptors/agent37.d.ts +3 -11
- package/dist/descriptors/agent37.js +9 -10
- package/dist/descriptors/daytona.d.ts +7 -6
- package/dist/descriptors/daytona.js +14 -7
- package/dist/descriptors/docker.d.ts +13 -1
- package/dist/descriptors/docker.js +3 -1
- package/dist/descriptors/e2b.d.ts +2 -9
- package/dist/descriptors/e2b.js +8 -8
- package/dist/descriptors/index.d.ts +25 -24
- package/dist/descriptors/index.js +1 -3
- package/dist/descriptors/modal.d.ts +2 -6
- package/dist/descriptors/modal.js +8 -6
- package/dist/descriptors/orgo.js +2 -1
- 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/egress-main.js +23 -15
- package/dist/docker/egress.d.ts +6 -4
- package/dist/docker/egress.js +24 -16
- package/dist/docker/inspect.d.ts +2 -2
- package/dist/docker/inspect.js +5 -5
- package/dist/docker.d.ts +6 -11
- package/dist/docker.js +13 -16
- package/dist/drift.js +4 -4
- package/dist/e2b.d.ts +22 -130
- package/dist/e2b.js +163 -243
- package/dist/host.d.ts +136 -104
- package/dist/host.js +8 -1
- package/dist/hosted/network.d.ts +23 -0
- package/dist/hosted/network.js +77 -0
- package/dist/hosted/process.d.ts +24 -8
- package/dist/hosted/process.js +80 -44
- package/dist/hosted/provider.d.ts +38 -22
- package/dist/hosted/provider.js +500 -341
- package/dist/hosted/rest.d.ts +74 -0
- package/dist/hosted/rest.js +126 -0
- package/dist/hosted/scripts.d.ts +21 -3
- package/dist/hosted/scripts.js +76 -14
- package/dist/hosted/ssh-exec.d.ts +99 -0
- package/dist/hosted/ssh-exec.js +464 -0
- package/dist/hosted/values.d.ts +26 -0
- package/dist/hosted/values.js +63 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/isolation.d.ts +0 -2
- package/dist/isolation.js +3 -4
- package/dist/kernel.d.ts +0 -6
- package/dist/kernel.js +1 -5
- package/dist/kinds.d.ts +3 -1
- package/dist/local-chrome.d.ts +0 -6
- package/dist/local-chrome.js +1 -5
- package/dist/modal.d.ts +15 -86
- package/dist/modal.js +67 -185
- package/dist/mount-archil.d.ts +13 -8
- package/dist/mount-archil.js +27 -17
- package/dist/mount.d.ts +10 -4
- package/dist/mount.js +8 -4
- package/dist/orgo.d.ts +0 -9
- package/dist/orgo.js +8 -13
- package/dist/phone-harness.d.ts +0 -6
- package/dist/phone-harness.js +0 -4
- package/dist/protocol.d.ts +4 -1
- package/dist/protocol.js +1 -0
- package/dist/provider.d.ts +2 -2
- package/dist/providers.d.ts +15 -13
- package/dist/screen-watch.js +34 -6
- package/dist/surface/api.d.ts +14 -11
- package/dist/surface/core.d.ts +23 -5
- package/dist/surface/core.js +105 -15
- package/dist/surface/index.d.ts +1 -1
- package/dist/surface/index.js +1 -1
- package/dist/surface/outline.d.ts +2 -0
- package/dist/surface/outline.js +2 -1
- package/dist/surface/script.d.ts +4 -0
- package/dist/surface/script.js +11 -3
- package/dist/ui-engine.js +19 -3
- package/package.json +2 -3
- package/box/build-agent37.mjs +0 -177
- package/dist/conformance/daytona-sweep.d.ts +0 -18
- package/dist/conformance/daytona-sweep.js +0 -126
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.
|
|
@@ -49,8 +49,8 @@ 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"}}
|
|
@@ -74,7 +74,7 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
74
74
|
- `stdout` and `stderr` come back apart, in base64. Each keeps at most 360 KiB (`maxOutput`, the default and the most):
|
|
75
75
|
both, in base64, fit one 1 MiB line. The rest is read and dropped, and `truncated` is true.
|
|
76
76
|
- The environment is PATH (the daemon's), HOME, USER and LOGNAME for the user, then, when init relays to an egress
|
|
77
|
-
proxy (`init --egress`, [below](#an-allowlist-the-egress-proxy)), `HTTP_PROXY`, `HTTPS_PROXY`, their lowercase forms
|
|
77
|
+
proxy (`init --egress`, [below](#open-and-an-allowlist-the-egress-proxy)), `HTTP_PROXY`, `HTTPS_PROXY`, their lowercase forms
|
|
78
78
|
and `NO_PROXY`, then `env` over them. Nothing else of the daemon's environment is passed on.
|
|
79
79
|
- `user` is a name or `uid[:gid]`. A daemon without CAP_SETUID and CAP_SETGID cannot switch users and answers `denied`.
|
|
80
80
|
Init leaves itself no capability (below), so a command runs as the daemon's own user.
|
|
@@ -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
|
|
@@ -119,8 +121,12 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
119
121
|
`computerd stdio` stays outside and still reaches init's socket: a unix socket with a path is not in a network
|
|
120
122
|
namespace. It needs root with CAP_SYS_ADMIN and CAP_NET_ADMIN (a VM's root, a privileged container); without them, or
|
|
121
123
|
with any read-back short, init refuses to start in words and the computer fails closed. `--own-network` takes no
|
|
122
|
-
`--egress
|
|
123
|
-
|
|
124
|
+
`--egress`; for a spec whose network is `open` or a list it takes `--network open|allow:<list>`, and init, still
|
|
125
|
+
root and in the machine's own network, first starts the egress proxy (`daemon/internal/egress`): as nobody, on a
|
|
126
|
+
Unix socket root's and the tool user's group's alone (`/opt/agentrun/egress/egress.sock`), to the public internet
|
|
127
|
+
only (Docker's egress table, plus the machine's own addresses), and with a list to its hosts alone, refused before
|
|
128
|
+
any lookup. Init relays its loopback port 3128 to that socket and gives its programs the proxy env; their namespace
|
|
129
|
+
stays their loopback alone. The code is `daemon/internal/isolate`; `test/docker/loopback-block.docker.test.mjs` runs each
|
|
124
130
|
provider's start in a root container beside a stand-in agent on 2280 and 49983.
|
|
125
131
|
- **Where root may not make the network namespace, init makes it inside a user namespace.** Root holds no
|
|
126
132
|
CAP_SYS_ADMIN on gVisor (Modal's GPU runtime), so `unshare(CLONE_NEWNET)` is EPERM. It may make a user namespace with
|
|
@@ -176,11 +182,17 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
176
182
|
as root in a container by hand: `internal/isolate`'s and the isolated `TestBecome...` need CAP_SYS_ADMIN and
|
|
177
183
|
CAP_NET_ADMIN (`docker run --cap-add SYS_ADMIN --cap-add NET_ADMIN`), and the refusal without them a container
|
|
178
184
|
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.
|
|
185
|
+
- `computerd probe [--sockets] [--connect <host:port>[/udp]]...` prints one JSON line: the uid and gid it runs as, the
|
|
186
|
+
kernel's release, `interfaces` (the network interfaces its network namespace holds: `["lo"]` alone under
|
|
187
|
+
`--own-network`), `reached` (the targets that answered), `accepted` (the targets that accepted a TCP connection and
|
|
188
|
+
sent nothing back) and `results`, each target's `protocol`, `outcome` (`refused`, `accepted` or `answered`), `bytes`
|
|
189
|
+
and `detail` in words. With `--sockets` it adds the isolation case's two listings: `sockets`, the unix sockets it can
|
|
190
|
+
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
|
|
191
|
+
LISTEN and UDP bound with no peer, read from `/proc/net/tcp`, `tcp6`, `udp` and `udp6`), each with its `protocol`,
|
|
192
|
+
`address`, `port`, `uid`, the `owner` that holds it (`pid N (command)`, where `/proc` shows that process's
|
|
193
|
+
descriptors) and `computerd` (that owner runs computerd's own program); each listing names in `incomplete` what it
|
|
194
|
+
could not search or read. `isolation.vendor-agent` fails on a listener that is not computerd's; under `--own-network`
|
|
195
|
+
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
196
|
[Network none, read from inside](#network-none-read-from-inside-nothing-answers). `computerd probe --diagnose` asks
|
|
185
197
|
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
198
|
80/tcp and 53/udp it reports `refused` (no TCP accept, no UDP answer), `accepted` (an accept, no answer) or
|
|
@@ -422,8 +434,8 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
422
434
|
| --- | --- |
|
|
423
435
|
| docker | none |
|
|
424
436
|
| daytona | sandbox: `DAYTONA_DEFAULT_SNAPSHOT` ("default") |
|
|
425
|
-
| modal |
|
|
426
|
-
| e2b |
|
|
437
|
+
| modal | none: `prepareImage()` answers the box image (`boxImageRef()`) |
|
|
438
|
+
| e2b | none: `prepareImage()` answers the box template (`boxE2bTemplate()`), for a sandbox and a desktop alike |
|
|
427
439
|
| orgo | desktop: `ORGO_BASE_IMAGE` ("linux") |
|
|
428
440
|
| phone-harness | phone: `PHONE_IMAGE` ("android") |
|
|
429
441
|
| browserbase, kernel, local | browser: `BROWSER_IMAGE` ("chromium") |
|
|
@@ -431,7 +443,7 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
431
443
|
| id | label | kinds | keys (required unless marked) | mounts | metered |
|
|
432
444
|
| --- | --- | --- | --- | --- | --- |
|
|
433
445
|
| docker | Docker | sandbox, desktop | none | bind | no |
|
|
434
|
-
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET
|
|
446
|
+
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET` (optional) | none (`unmounted`: archil) | yes |
|
|
435
447
|
| modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
|
|
436
448
|
| e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
|
|
437
449
|
| orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
|
|
@@ -440,9 +452,8 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
440
452
|
| kernel | Kernel | browser | `KERNEL_API_KEY` | none | yes |
|
|
441
453
|
| local | Local Chrome | browser | none | none | no |
|
|
442
454
|
|
|
443
|
-
-
|
|
444
|
-
|
|
445
|
-
in each configuration, to its entry's capabilities. browserbase and kernel are data until their provider file joins
|
|
455
|
+
- A provider's capabilities and mounts are its descriptor's, and nowhere else. A unit test holds each provider built
|
|
456
|
+
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
457
|
the registry; that test then holds each to its file.
|
|
447
458
|
- `testConnection()` (optional on `ComputerProvider`) is Settings' test of a provider's keys: ONE account-level read
|
|
448
459
|
that never creates a computer, so it never spends. Docker (one `docker ps`), Daytona and E2B (one listing page) count
|
|
@@ -480,7 +491,7 @@ the screen (`provider.stream()`), the files a browser saved. A computerd hello n
|
|
|
480
491
|
|
|
481
492
|
**Daemon mode.** `capabilities().daemon` says who answers the methods. `pid1`: computerd init is the computer's main
|
|
482
493
|
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
|
|
494
|
+
boot; init's exit does not end the computer (Daytona, whose toolbox daemon starts init detached), and it
|
|
484
495
|
must not run under a supervisor that restarts it. `none`: no computerd runs, and the provider answers the same methods
|
|
485
496
|
itself, from our server (adb, a vendor API). Either way a connection's `client` is a `ComputerClient` (`call(method,
|
|
486
497
|
params, { signal })` and `close()`): `DaemonClient` over a stream, or a provider's in-process client.
|
|
@@ -492,7 +503,7 @@ provider declares, either way.
|
|
|
492
503
|
|
|
493
504
|
| group | methods |
|
|
494
505
|
| --- | --- |
|
|
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. |
|
|
506
|
+
| `screen` | `screen.shot({ region? })`: a PNG (8-bit, non-interlaced), its first `MAX_CHUNK_BYTES` in `data`, with `width`, `height` (the image's pixels, the input coordinate space, never downscaled), `scale` and `cursor?`; `screen.read({ id, offset })` for the rest. One shot is held, until its eof or the next shot. `screen.watch({ after, waitMs?, maxWidth?, quality? })`: the live view's frames, paced by the caller's ack (`after`, the seq of the last frame it has whole; an older one gets the newest frame at once; on a computer whose hello lists `screen.ahead`, one past the newest waits as the newest does, so two asks can be in flight): the next frame once the screen or the pointer changed, else `changed: false` when `waitMs` (default 2000, at most 10000) is over. Computerd on a desktop learns what changed from the X server's DAMAGE extension and gives at most 15 frames a second; on an X server without DAMAGE, `screen.watch` is refused, `unsupported`, in words. A frame is `{ seq, changed, format, frameWidth, frameHeight, width, height, cursor? }` and its bytes as a shot's (`data`, `id` and `screen.read`); `format` is `jpeg` from computerd (scaled to `maxWidth`, default 1280, at `quality`, default 60) and `png` from the phone client. One watch per connection. |
|
|
496
507
|
| `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
508
|
| `input.keys` | `input.actions`: `key` (one key pressed, or a combo released in reverse; `repeat`), `hold` (`ms`), `type` |
|
|
498
509
|
| `input.touch` | `input.actions`: `tap`, `long_press`, `swipe`, `pinch` (`scale` above 1 apart, below together), `button` (back, home, app_switch) |
|
|
@@ -512,7 +523,9 @@ provider declares, either way.
|
|
|
512
523
|
`daemonWatch` is the one implementation behind every provider's `watch()` (Docker, Daytona, Modal, E2B, Orgo, the
|
|
513
524
|
phone harness): a computer whose hello has no `screen` is refused as `unsupported`. It adapts the internal seam,
|
|
514
525
|
`watchScreen(connection, options)`: pull-paced `frames` (each `next()` the ack), `act(actions)` and `close()`, whose
|
|
515
|
-
failures are `ScreenWatchError`s.
|
|
526
|
+
failures are `ScreenWatchError`s. On a computer that lists `screen.ahead` it keeps a second ask in flight, one frame
|
|
527
|
+
ahead, so frames come at the screen's pace and not one each round trip; a frame bettered before `next()` asked for it
|
|
528
|
+
is dropped. `toAction(event, kind)` maps the viewer's `ViewerEvent`s, in the screen's upright
|
|
516
529
|
pixels, to input actions, or to a `Refusal` (`{ field, message }`) for what a kind cannot take:
|
|
517
530
|
- 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
531
|
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 +596,26 @@ by its rectangle), so a longer one ends the connection before anything is alloca
|
|
|
583
596
|
`aborted`.
|
|
584
597
|
|
|
585
598
|
- 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.
|
|
599
|
+
`input.pointer`, `input.keys` and `apps`, and kind `desktop`, only while the display answers with XTEST. So a
|
|
600
|
+
provider may start its X server through `process.start` after init is up. With no display (`DISPLAY` unset, nothing
|
|
601
|
+
answering, no XTEST) nothing is declared, and each method is `unsupported`, saying why.
|
|
589
602
|
- 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`.
|
|
603
|
+
display is given it in `env`. An app the `apps` group opens is given it.
|
|
604
|
+
- `apps` (`daemon/internal/apps`) answers as a Mac's does, the same methods and the same answers. `apps.list` reads the
|
|
605
|
+
desktop files of `$XDG_DATA_HOME/applications` and each of `$XDG_DATA_DIRS` (default `~/.local/share`, then
|
|
606
|
+
`/usr/local/share` and `/usr/share`), as the Desktop Entry spec says: the apps there are, by their desktop file ids
|
|
607
|
+
(`org.xfce.mousepad`), with their names; hidden and `NoDisplay` entries, and a `TryExec` that is not there, are left
|
|
608
|
+
out. Its `foreground` is the app of the window manager's active window, else of the top window. `apps.launch({ id,
|
|
609
|
+
url? })` takes an id, a name (`Mousepad`) or a program (`mousepad`), starts the entry's `Exec` (`url` in its `%u`/`%f`
|
|
610
|
+
field; an entry with none refuses a `url` as `invalid`) as `process.start` does with orphans `keep`, with `DISPLAY`,
|
|
611
|
+
and answers `{}` once a new window of the app shows, raised and focused (through the window manager's
|
|
612
|
+
`_NET_ACTIVE_WINDOW` when one runs, waiting up to 2 s for it to be the active window), so keys typed right after
|
|
613
|
+
reach it; none within 10 s is `timeout`, "no window within 10 s", and the app runs on. An
|
|
614
|
+
app already running with a window is brought to the front and answers at once, unless a `url` is given. A
|
|
615
|
+
window is the app's by the launch that made it (`_NET_WM_PID` and the process's parents), else by its `WM_CLASS`
|
|
616
|
+
(the entry's `StartupWMClass`, its id's last part or its program). `background` is `unsupported`: a Linux desktop
|
|
617
|
+
opens an app in front. `apps.terminate` sends TERM, then KILL, to the app's launches and its windows' processes, and
|
|
618
|
+
answers once none of its windows shows and none of its launches runs, a launch that never showed a window included.
|
|
591
619
|
- `screen.shot` is a PNG of the root window or a region inside it (one outside is `invalid`), with `scale` 1 and
|
|
592
620
|
`cursor` from `QueryPointer`. A connection holds one shot, until it is read to its end or the next shot; a
|
|
593
621
|
`screen.read` of another id is `not_found`.
|
|
@@ -682,31 +710,31 @@ was deleted.
|
|
|
682
710
|
|
|
683
711
|
- `capabilities()` declares kind `linux`, daemon `pid1`, groups `exec`, `files` and `processes`, `maxLifetimeMs`
|
|
684
712
|
of 30 days, and `mount: ["bind"]` (below); there is no `extend()` or `stream()`, and init gets no `--max-deadline`.
|
|
685
|
-
- `new DockerProvider({ daemonPath, desktop: {} })` makes desktops: kind `desktop`, with `screen`, `input.pointer
|
|
686
|
-
`input.keys` too, on an image with an X server (`test/fixtures/desktop/Dockerfile` is Alpine and
|
|
713
|
+
- `new DockerProvider({ daemonPath, desktop: {} })` makes desktops: kind `desktop`, with `screen`, `input.pointer`,
|
|
714
|
+
`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).
|
|
687
715
|
`create` gives the daemon `DISPLAY` (`display`, default `:0`), then starts the X server through it with
|
|
688
716
|
`process.start` (`server`, default `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp`), as the computer's user and as any
|
|
689
717
|
program: computerd stays PID 1 and starts nothing itself, and the server is one process in its table that ends with
|
|
690
|
-
the computer. `create` waits (`timeoutMs`, default 30 s) until hello declares the display, then runs the drift check;
|
|
718
|
+
the computer. It runs no window manager. `create` waits (`timeoutMs`, default 30 s) until hello declares the display, then runs the drift check;
|
|
691
719
|
a server that ends first, with its last words on stderr, or a display that is not up in time deletes the computer in
|
|
692
720
|
words.
|
|
693
721
|
- `check(spec)` refuses in words, with no Docker call: no image, no or a bad `lifetimeMs` (`checkLifetime`: at most
|
|
694
722
|
30 days), a network that is not `none`, `open` or an allowlist the egress proxy takes
|
|
695
|
-
([below](#an-allowlist-the-egress-proxy)), a NUL byte in any string, and any field Docker does not support. Once the host has been read (below), it also refuses with `field: "host"` for each enforcement
|
|
723
|
+
([below](#open-and-an-allowlist-the-egress-proxy)), a NUL byte in any string, and any field Docker does not support. Once the host has been read (below), it also refuses with `field: "host"` for each enforcement
|
|
696
724
|
the host lacks. `create` never throws on a spec `check` passes.
|
|
697
725
|
- Before `docker run`, `create` reads the host's enforcement once per provider (`host()`, from `docker info`; see
|
|
698
726
|
below), and refuses a host that lacks any of it in words, having made nothing.
|
|
699
727
|
- `create` runs `docker run` as a non-root user (`--user`, below), with every capability dropped (`--cap-drop ALL`),
|
|
700
728
|
`--security-opt no-new-privileges`, `--ipc private --cgroupns private` (never the daemon's defaults, which a host can
|
|
701
|
-
set to `shareable` or, on cgroup v1, the host's cgroup namespace), `--network
|
|
702
|
-
|
|
729
|
+
set to `shareable` or, on cgroup v1, the host's cgroup namespace), `--network none` for every network (`open` and an
|
|
730
|
+
allowlist go through the computer's egress proxy, below), serve's sizes unless the spec gives its own (2
|
|
703
731
|
CPUs as a quota, `--cpu-period 100000 --cpu-quota 200000`, so a host with fewer CPUs still runs one; 4 GiB with swap
|
|
704
732
|
the same; 1024 pids), and the daemon (its copy, next) bind-mounted read-only at `/opt/agentrun/computerd` as
|
|
705
733
|
the entrypoint, `computerd init --deadline <time>`, which is PID 1, holds every process and reaps orphans. The label
|
|
706
734
|
`agentrun.computer.deadline` holds the time `lifetimeMs` ends, and init gets the same time: then it ends every
|
|
707
735
|
process as on SIGTERM (below) and exits 0, which stops the container. Init refuses to start with no deadline.
|
|
708
736
|
Deleting a stopped computer is the janitor's (`lifetime: "janitor"`). A container that is not running after its
|
|
709
|
-
start is removed. The lifetime counts from just before the proxy (for an allowlist) and `docker run`, so a Docker host
|
|
737
|
+
start is removed. The lifetime counts from just before the proxy (for open or an allowlist) and `docker run`, so a Docker host
|
|
710
738
|
that holds the start eats into it: a computer whose init exited 0 because its deadline passed before `docker run`
|
|
711
739
|
finished fails `create` as `timeout`, with the lifetime and how long the start took ("its lifetime of 45 s ended
|
|
712
740
|
before docker run finished (it took 101.2 s)").
|
|
@@ -754,7 +782,8 @@ was deleted.
|
|
|
754
782
|
the ISO time the provider writes), `state` (`running` or `stopped`), `network` as read back, and `mount` when
|
|
755
783
|
something is mounted at `/workspace`.
|
|
756
784
|
- `network(ref)` reads the network back: `none` (network mode none, on no network but Docker's own `none`), `open`
|
|
757
|
-
(
|
|
785
|
+
(network mode none, and an egress proxy serving `--open public`, below), `{ allow: [...] }` (below), or
|
|
786
|
+
`{ other: "<words>" }` for anything else, Docker's bridge included, which is never
|
|
758
787
|
reported as a policy. `network(ref, policy)` returns the policy when it is the computer's (an allowlist with the same
|
|
759
788
|
entries, normalized, in any order); any change is refused: a Docker computer's network is fixed at create, since
|
|
760
789
|
Docker cannot move a container with no network onto one, and an allowlist needs its volume mounted at create.
|
|
@@ -768,18 +797,21 @@ was deleted.
|
|
|
768
797
|
Expected failures are results (`{ ok: false, error: { code, message } }`), not throws.
|
|
769
798
|
|
|
770
799
|
What a Docker computer cannot do: run as root or in root's group unless its spec asks, switch users, gain a capability, reach any network
|
|
771
|
-
when asked for `none`, reach anything but its list, through its own proxy, when asked for an allowlist,
|
|
772
|
-
daemon, or run past its deadline.
|
|
800
|
+
when asked for `none`, reach anything but its list, through its own proxy, when asked for an allowlist, reach a
|
|
801
|
+
private, loopback, link-local or metadata address when asked for `open`, write the daemon, or run past its deadline.
|
|
773
802
|
|
|
774
|
-
###
|
|
803
|
+
### Open and an allowlist: the egress proxy
|
|
775
804
|
|
|
776
805
|
```ts
|
|
777
806
|
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" });
|
|
778
807
|
// In the computer, HTTP_PROXY and HTTPS_PROXY name port 3128 on its own loopback for every program computerd starts.
|
|
779
808
|
```
|
|
780
809
|
|
|
781
|
-
A computer whose network is an allowlist stays `--network none`: its own loopback, no route, no resolver.
|
|
782
|
-
out is its own egress proxy, in a second container the provider makes, reads back and removes with it.
|
|
810
|
+
A computer whose network is `open` or an allowlist stays `--network none`: its own loopback, no route, no resolver.
|
|
811
|
+
Its one way out is its own egress proxy, in a second container the provider makes, reads back and removes with it.
|
|
812
|
+
Under `open` the proxy runs with `--open public` and no list: every public host, and the same refusals of private,
|
|
813
|
+
loopback, link-local, metadata and this host's own addresses as under a list. A Docker computer is never on Docker's
|
|
814
|
+
bridge itself. The proxy is
|
|
783
815
|
serve's (`src/docker/egress-proxy.ts`, with its address table in `src/docker/egress-table.ts`), moved here; it holds no
|
|
784
816
|
key.
|
|
785
817
|
|
|
@@ -789,7 +821,7 @@ key.
|
|
|
789
821
|
digest; `new DockerProvider({ daemonPath, egress: { image } })` replaces it) runs `dist/docker/egress-main.js`, this
|
|
790
822
|
package's own build, bound read-only with its `package.json`. It is on Docker's default bridge alone, publishes no
|
|
791
823
|
port, and runs as the computer's uid:gid with a read-only root, `--cap-drop ALL`, `no-new-privileges`, 256 MiB, 64
|
|
792
|
-
pids, half a CPU (a fixed quota, not the computer's own cpus), 1024 open files and a bounded log. Its argv holds the list, the computer's deadline (it ends itself then), this machine's own
|
|
824
|
+
pids, half a CPU (a fixed quota, not the computer's own cpus), 1024 open files and a bounded log. Its argv holds the list (or `--open public`), the computer's deadline (it ends itself then), this machine's own
|
|
793
825
|
public addresses (refused as `this-host`), and `egress.hint`, the words a refusal adds (printable ASCII).
|
|
794
826
|
`EGRESS_IMAGE` is the one place its digest is written. `create` pulls it at the first allow computer when the host
|
|
795
827
|
lacks it (see Lifetime), so a host with no registry access pulls it ahead, reading the name from this package:
|
|
@@ -802,15 +834,15 @@ key.
|
|
|
802
834
|
- **What a list holds** (`capabilities().allow`): names, exact or `*.suffix` (two labels or more), and CIDRs, IPv4 or
|
|
803
835
|
IPv6, with host bits zero and over no range the address rule refuses; both in one list, at most 256 of each, each on
|
|
804
836
|
ports 80 and 443. `check` refuses anything else in words: an empty list (ask for `none`), an address with no prefix, a
|
|
805
|
-
port, a URL, a private range. On a Docker host that remaps user ids (userns-remap or rootless Docker), an
|
|
806
|
-
|
|
837
|
+
port, a URL, a private range. On a Docker host that remaps user ids (userns-remap or rootless Docker), open and an
|
|
838
|
+
allowlist are refused before anything is made, as a bind is: the volume's owner and the proxy's code are host ids the computer's
|
|
807
839
|
user does not map to, and the provider does not guess the mapping.
|
|
808
840
|
- **The Docker host's own addresses.** The proxy refuses them as `this-host`, so it must know them. Docker does not
|
|
809
841
|
report them; the provider passes this machine's public interface addresses, which are the Docker host's only when
|
|
810
842
|
the provider runs on it. When it runs in a container (`/.dockerenv`, `/run/.containerenv`, or a container's cgroup in
|
|
811
843
|
`/proc/self/cgroup`), or its docker CLI talks to a daemon that is not a local unix socket (`docker context inspect`,
|
|
812
|
-
which resolves the context and `DOCKER_HOST` as the CLI does), an allowlist
|
|
813
|
-
made, and `check` says so once it knows, unless `egress.hostAddresses` names the host's addresses (IP addresses),
|
|
844
|
+
which resolves the context and `DOCKER_HOST` as the CLI does), open and an allowlist are refused in words before
|
|
845
|
+
anything is made, and `check` says so once it knows, unless `egress.hostAddresses` names the host's addresses (IP addresses),
|
|
814
846
|
which then go to the proxy beside this machine's own. A plain local host is as before. `egress.hostRoot` (default
|
|
815
847
|
`/`) is the root those container signs are read under, for tests and embedders. An address that is not on any
|
|
816
848
|
interface is never seen: a cloud machine's NAT'd or elastic public IP. Put those in `egress.hostAddresses` too. The
|
|
@@ -838,12 +870,13 @@ key.
|
|
|
838
870
|
sweep's labels, whose deadline label has passed, or whose computer is gone and that is older than a create could
|
|
839
871
|
take (its ready wait and two minutes), removed by what the label found. The volume carries the computer's deadline
|
|
840
872
|
and the spec's labels for this. Until then the proxy stops forwarding at its deadline.
|
|
841
|
-
- **Read-back.** `network`, `list` and `attach` read the allowlist from Docker: network mode none, the egress volume
|
|
873
|
+
- **Read-back.** `network`, `list` and `attach` read open or the allowlist from Docker: network mode none, the egress volume
|
|
842
874
|
read-only at its path, init's relay in its command, and a proxy container that carries the computer's label and
|
|
843
875
|
deadline, runs while the computer runs, is hardened and bounded as above (its memory and swap, pids limit, private
|
|
844
876
|
IPC and cgroup namespaces, and json-file log of 1m and 2 files included) with exactly its volume and code, and whose
|
|
845
|
-
argv holds the list and refuses every one of the Docker host's own addresses the provider
|
|
846
|
-
fine). Anything less is `{ other: "network allow, but its egress proxy ... <why>" }
|
|
877
|
+
argv holds the list (or `--open public`) and refuses every one of the Docker host's own addresses the provider
|
|
878
|
+
requires now (more is fine). Anything less is `{ other: "network allow, but its egress proxy ... <why>" }` (or
|
|
879
|
+
`network open, ...`). **A crashed proxy** is not
|
|
847
880
|
restarted: the computer then reaches nothing, its network reads back `other` ("is not running"), and `attach` refuses
|
|
848
881
|
it, so a caller makes a new computer. `list` reads every listed computer's proxy in one more inspect.
|
|
849
882
|
|
|
@@ -866,9 +899,9 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
|
|
|
866
899
|
- `ComputerSpec.mount` is `{ kind: "bind", path }`, a folder on the provider's host bound in (the local Docker
|
|
867
900
|
computer), or `{ kind: "archil", disk, region, folder, token }`, the run's folder (such as
|
|
868
901
|
`agents/<a>/runs/<r>/work`) inside an Archil disk in its region, mounted in a remote computer.
|
|
869
|
-
`capabilities().mount` lists the kinds a provider takes; absent, it takes none. Each provider
|
|
870
|
-
|
|
871
|
-
provider binds a local folder from
|
|
902
|
+
`capabilities().mount` lists the kinds a provider takes; absent, it takes none. Each provider's descriptor declares
|
|
903
|
+
the same kinds as `mounts` (Docker `["bind"]`; Modal and E2B `["archil"]`; Daytona `[]` for now), so a caller tells
|
|
904
|
+
which provider binds a local folder from its descriptor (`descriptorOf(id)`) without building one.
|
|
872
905
|
- `checkMount(mount, declared)` (`src/mount.ts`) is the one rule every provider's `check` runs, with no vendor call: a
|
|
873
906
|
kind the provider does not declare is refused in words (`this provider does not take a mount of kind archil; it takes
|
|
874
907
|
bind`); a bind's `path` is absolute, canonical (its own realpath, so what is read back is what is bound: Docker
|
|
@@ -881,7 +914,7 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
|
|
|
881
914
|
`{ other: "<words>" }` for a mount at `/workspace` the provider never makes. An Archil mount's `epoch` is the
|
|
882
915
|
computer's `agentrun.epoch` label (Archil's hold on a folder carries none); an Archil mount with no epoch reads back
|
|
883
916
|
as `{ other }`, in words. The token is never in a label, a read-back or an error.
|
|
884
|
-
- **An Archil egress gateway (
|
|
917
|
+
- **An Archil egress gateway (`HostedOptions.archilEgress`).** For a target whose runners reach
|
|
885
918
|
Archil only through a gateway, `<IPv4 gateway>:<mount lane>:<data lane>` (such as `10.60.0.40:18100:42050`, parcha-proxy's
|
|
886
919
|
archil-egress). The helper's mount then starts `computerd archil-relay` on the computer's loopback (127.0.0.1:3129) and
|
|
887
920
|
an nftables table of its own (`inet agentrun_archil`) that redirects root's TCP to 8100 (the mount endpoint) and 32050
|
|
@@ -1033,7 +1066,7 @@ From `docker inspect`, what create asks for:
|
|
|
1033
1066
|
|
|
1034
1067
|
| Field | Must be |
|
|
1035
1068
|
| --- | --- |
|
|
1036
|
-
| network (`HostConfig.NetworkMode`, `NetworkSettings.Networks`, and for an allowlist the egress volume, init's relay and the proxy container) | `none`, `open` or the allowlist as declared, read back as `network(ref)` does |
|
|
1069
|
+
| network (`HostConfig.NetworkMode`, `NetworkSettings.Networks`, and for open or an allowlist the egress volume, init's relay and the proxy container) | `none`, `open` or the allowlist as declared, read back as `network(ref)` does |
|
|
1037
1070
|
| `HostConfig.CapDrop`, `CapAdd`, `Privileged` | `["ALL"]`, nothing added, false |
|
|
1038
1071
|
| `HostConfig.SecurityOpt` | exactly `["no-new-privileges"]`: `seccomp=unconfined`, `apparmor=unconfined`, `label=disable`, `systempaths=unconfined` or any other option is drift |
|
|
1039
1072
|
| `HostConfig.IpcMode`, `CgroupnsMode` | `private`, `private` |
|
|
@@ -1047,7 +1080,7 @@ From `docker inspect`, what create asks for:
|
|
|
1047
1080
|
| `Config.User` | the uid:gid asked for: the spec's, the provider's, or the default |
|
|
1048
1081
|
| `Config.Image`, `WorkingDir` | the spec's image; its `workdir`, or `/work` |
|
|
1049
1082
|
| `Config.Env` | one `HOME`, `HOME=/work`; the image's other variables are its own |
|
|
1050
|
-
| `Config.Entrypoint`, `Cmd` | `["/opt/agentrun/computerd"]`, `["init", "--deadline", <the deadline label's value>]`, and for an allowlist `"--egress", "/opt/agentrun/egress/egress.sock"` after it |
|
|
1083
|
+
| `Config.Entrypoint`, `Cmd` | `["/opt/agentrun/computerd"]`, `["init", "--deadline", <the deadline label's value>]`, and for open or an allowlist `"--egress", "/opt/agentrun/egress/egress.sock"` after it |
|
|
1051
1084
|
| `Config.Labels` | `agentrun.computer=1`, the deadline as written, and every label the spec asked for; others are the image's |
|
|
1052
1085
|
| `AppArmorProfile` | `docker-default` when the host has AppArmor, else empty |
|
|
1053
1086
|
| `ProcessLabel` | of type `container_t` when the host has SELinux, else empty |
|
|
@@ -1172,9 +1205,8 @@ reads at once, then after pauses that double from `minMs` (250 ms) to `maxMs` (5
|
|
|
1172
1205
|
returns the first state `done` accepts. Each read gets a signal that aborts at the bound or on the caller's abort; a
|
|
1173
1206
|
read still pending then is not waited for, and one that throws is not done. Past the bound it returns a `timeout`, on
|
|
1174
1207
|
the caller's abort an `aborted`, each naming `what` was waited for and the last state read (`describe`). It has no
|
|
1175
|
-
vendor's types: the shared adapter's release and the one live sweep wait through it
|
|
1176
|
-
|
|
1177
|
-
it too.
|
|
1208
|
+
vendor's types: the shared adapter's release, a create that deletes its machine, and the one live sweep wait through it
|
|
1209
|
+
(`settle`, until get answers none for a machine twice running; one read `gone` is still going), for every hosted vendor.
|
|
1178
1210
|
|
|
1179
1211
|
## Modal
|
|
1180
1212
|
|
|
@@ -1191,7 +1223,7 @@ const made = await modal.create({ image: "debian:bookworm-slim", lifetimeMs: 600
|
|
|
1191
1223
|
```
|
|
1192
1224
|
|
|
1193
1225
|
Modal runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/modal.ts` is Modal's `MachineHost`,
|
|
1194
|
-
|
|
1226
|
+
the SDK's types (`import type`, erased at build) and the client it is made with, and
|
|
1195
1227
|
`src/hosted/provider.ts` does everything below that is not Modal's own. `create` takes the caller's request id
|
|
1196
1228
|
(`{ requestId }`, serve's is the run's claim): the computer's name is `computer-` and the first 12 hex digits of its
|
|
1197
1229
|
sha256, and a retry of the same request finds the computer the first made instead of making a second. A Modal sandbox
|
|
@@ -1239,27 +1271,26 @@ runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests
|
|
|
1239
1271
|
- **Sizes are limits**, as in Docker: `cpus` (at least 0.25) becomes `cpuLimit` in physical cores (2 CPUs each) and
|
|
1240
1272
|
`memoryMb` becomes `memoryLimitMiB`, each with Modal's default request (0.125 cores, 128 MiB) or less. `pids` and
|
|
1241
1273
|
`workdir` are refused: Modal has no pids limit, and a computer works in `/work`, its home.
|
|
1242
|
-
- **Tags.** A sandbox's tags are the adapter's labels (`agentrun.computer`, its name, deadline
|
|
1243
|
-
deadline
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
`list` is `sandboxes.list({ appId, tags })` over the provider's app: running sandboxes only, and one Modal still
|
|
1274
|
+
- **Tags.** A sandbox's tags are the adapter's labels (`agentrun.computer`, its name, deadline and image, and a GPU
|
|
1275
|
+
computer's GPUs; no max-deadline, which only `extend` reads) and the caller's. Modal takes 10 tags, 512 bytes of them, names and
|
|
1276
|
+
values together (the host's `labels`): the adapter's `check()` counts them as create gives them, its own at their
|
|
1277
|
+
longest, and refuses past either in words with no call; create refuses the same words first. An Archil computer's mount label records the
|
|
1278
|
+
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
|
|
1248
1279
|
lists after its terminate is polled and left out once `poll()` reads it finished.
|
|
1249
|
-
- **release** `delete` is `terminate()`, and the adapter waits until
|
|
1280
|
+
- **release** `delete` is `terminate()`, and the adapter waits until get answers none (`poll()` reads it finished).
|
|
1250
1281
|
`stop` is refused as `unsupported`: terminate is a sandbox's only end.
|
|
1251
1282
|
- **GPU.** `capabilities().gpu` declares Modal's GPU types by its own names (guide/gpu): `T4`, `L4`, `A10`, `L40S`,
|
|
1252
1283
|
`A100` (40 GB), `A100-40GB`, `A100-80GB`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B300`, at most 8 to a computer.
|
|
1253
1284
|
`spec.gpu: { type, count }` becomes the SDK's `gpu` (`"T4"`, `"A100-80GB:2"`), and since Modal offers GPUs on gVisor
|
|
1254
1285
|
only, such a sandbox runs with `runtime: "gvisor"`; every other computer stays on the VM runtime. The probe's kernel
|
|
1255
|
-
is held to it at create: gVisor's on a GPU computer, a VM's on any other. Modal reads no GPU back
|
|
1256
|
-
|
|
1286
|
+
is held to it at create: gVisor's on a GPU computer, a VM's on any other. Modal reads no GPU back: the adapter's
|
|
1287
|
+
`agentrun.computer.gpu` label records them, and attach and a retry read them there. `gpu.mounts` is `[]`: a GPU with an Archil mount is refused (checkGpu).
|
|
1257
1288
|
- **The loopback fence on gVisor.** Modal's gVisor gives root no CAP_SYS_ADMIN, so init, given the same
|
|
1258
1289
|
`--own-network`, makes its programs' network namespace inside a user namespace (the daemon's fallback, any vendor).
|
|
1259
1290
|
Declared: `gpu.fence: "userns-netns"`; read back: hello's `fence`, and create notes it. Proven in Docker
|
|
1260
1291
|
(`test/docker/pid1-commands.docker.test.mjs` and `loopback-block.docker.test.mjs`), not yet live on Modal.
|
|
1261
|
-
- **Settings' test
|
|
1262
|
-
connection all the same.
|
|
1292
|
+
- **The app.** `list` (and so Settings' test, one listing) reads the app with `createIfMissing: false`, which makes
|
|
1293
|
+
nothing: an app not made yet lists no sandboxes and is a connection all the same. Only `create` makes the app.
|
|
1263
1294
|
|
|
1264
1295
|
### What every Modal fact rests on
|
|
1265
1296
|
|
|
@@ -1354,19 +1385,25 @@ const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, n
|
|
|
1354
1385
|
```
|
|
1355
1386
|
|
|
1356
1387
|
A Daytona computer is a sandbox made through Daytona's v0 REST API with `fetch`: no SDK, and no package beyond this
|
|
1357
|
-
one. `fetch` and the WebSocket factory are options, so the tests
|
|
1388
|
+
one. `fetch` and the WebSocket factory are options, so the tests hand them a recorder. The provider is a `MachineHost`
|
|
1389
|
+
on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): Daytona's own calls are here, and the lifecycle
|
|
1390
|
+
around them (the computer's name from the create's request id, the daemon's install and start, the probe, the listing
|
|
1391
|
+
wait, release's wait for gone) is the adapter's, the same for every hosted vendor.
|
|
1358
1392
|
The key is the caller's to pass: the provider never reads the environment, never sends the key over a redirect or to a
|
|
1359
1393
|
toolbox URL that is not https, and never puts it in a computer. `image` is a Daytona snapshot, by id or name: the
|
|
1360
1394
|
snapshot gives the sandbox its class and its size. `image: "default"` sends no snapshot field at all, and Daytona makes
|
|
1361
1395
|
the sandbox from its default snapshot; the provider never guesses a snapshot's name. (A snapshot that is itself named
|
|
1362
|
-
`default` is reached by its id.)
|
|
1363
|
-
|
|
1364
|
-
|
|
1396
|
+
`default` is reached by its id.) Create records the image it was asked for in the label `agentrun.computer.image`,
|
|
1397
|
+
beside the deadline's in the provider's own namespace, and attach reports that as `image`.
|
|
1398
|
+
|
|
1399
|
+
Daytona takes no mount of the run's folder: Archil's client hangs on its sandboxes (its FUSE session never answers a
|
|
1400
|
+
`statx` of the mountpoint), so `capabilities().mount` is `[]` and `check()` refuses an Archil mount up front, code
|
|
1401
|
+
`refused`, in the descriptor's `unmounted.archil` words, before anything is asked of Daytona.
|
|
1365
1402
|
|
|
1366
1403
|
### Lifetimes
|
|
1367
1404
|
|
|
1368
|
-
Every sandbox ends at its TTL (`ttlMinutes`, from `lifetimeMs`). Two options bound it further, each sent on every
|
|
1369
|
-
|
|
1405
|
+
Every sandbox ends at its TTL (`ttlMinutes`, from `lifetimeMs`). Two options bound it further, each sent on every
|
|
1406
|
+
create:
|
|
1370
1407
|
|
|
1371
1408
|
| Option | Daytona field | Meaning | Unset |
|
|
1372
1409
|
| --- | --- | --- | --- |
|
|
@@ -1375,20 +1412,21 @@ and read back by the drift check:
|
|
|
1375
1412
|
|
|
1376
1413
|
Each is a whole number, 0 or more; the constructor refuses anything else in words. Daytona's idle timer counts toolbox
|
|
1377
1414
|
calls (the daemon's connections are toolbox calls) but not the daemon's own work, so a computer left with no connection
|
|
1378
|
-
for `autoStopMinutes` stops.
|
|
1379
|
-
|
|
1380
|
-
stopped one.
|
|
1415
|
+
for `autoStopMinutes` stops. A stopped sandbox is still listed, as `stopped`, until Daytona deletes it or the janitor
|
|
1416
|
+
does. The provider itself never stops one: `release` takes `delete` alone and refuses `stop` as `unsupported`.
|
|
1381
1417
|
|
|
1382
1418
|
### How the daemon gets in, and how it is reached
|
|
1383
1419
|
|
|
1384
1420
|
Daytona runs its own toolbox daemon as the sandbox's first process, and a snapshot we do not build has no `computerd`.
|
|
1385
|
-
So the provider pushes it in at create and starts it
|
|
1421
|
+
So the provider pushes it in at create and starts it, and reaches it the same way. Every command is a session command
|
|
1422
|
+
of its own (`runAsync`, `suppressInputEcho`), its argv one shell line, its output read from the command's log stream,
|
|
1423
|
+
its exit code from the session; the session is deleted once the command ends, or when the provider ends it:
|
|
1386
1424
|
|
|
1387
1425
|
1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random>`:
|
|
1388
1426
|
`/files/upload-v2`, or `/files/upload` when the toolbox answers 404 for it. An older toolbox, as a self-hosted
|
|
1389
1427
|
Daytona's runners may run, serves only `/files/upload`, which takes the same form; any other refusal is not retried
|
|
1390
1428
|
on the older route.
|
|
1391
|
-
2. Install it with
|
|
1429
|
+
2. Install it with the shared install script: root-owned, mode 755, at
|
|
1392
1430
|
`/opt/agentrun/computerd`, and make `/work` (its home) and `/run/agentrun` (its socket's directory). As root, or
|
|
1393
1431
|
through passwordless `sudo`; a sandbox with neither is refused in the script's words. The script prints the
|
|
1394
1432
|
installed binary's sha256 (`sha256sum`, BusyBox's or coreutils'), which must be the uploaded one's. It makes
|
|
@@ -1397,15 +1435,16 @@ So the provider pushes it in at create and starts it as a long-lived command, an
|
|
|
1397
1435
|
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).
|
|
1398
1436
|
A path that fails is refused in words, with nothing installed. Only root can change an owner or a mode, so the
|
|
1399
1437
|
rule, once it holds, holds until root changes it.
|
|
1400
|
-
3. Start `computerd init --deadline <time> --user 2510:2510 --own-network` (`--user` is the `daemonUser` option)
|
|
1401
|
-
session
|
|
1402
|
-
is not root), in a clean environment and with `/work` as its directory.
|
|
1438
|
+
3. Start `computerd init --deadline <time> --user 2510:2510 --own-network` (`--user` is the `daemonUser` option)
|
|
1439
|
+
detached, in a session of its own (`setsid`), its output to `/run/agentrun-init.log`, as root (through `sudo -n`
|
|
1440
|
+
when the session's user is not root), in a clean environment and with `/work` as its directory. The command that
|
|
1441
|
+
starts it ends at once, and deleting its session leaves init running; a daemon that never answers is reported with
|
|
1442
|
+
the last words of that log. Init cuts itself and its programs off from
|
|
1403
1443
|
the toolbox (below), then drops itself: it gives `/work` and `/run/agentrun` to the daemon's user (mode 700, never
|
|
1404
1444
|
through a symbolic link), sets `no_new_privs` and empties the capability bounding set on every thread, so a setuid
|
|
1405
1445
|
program such as `sudo` cannot raise it, then becomes uid and gid 2510 with no supplementary groups and empties the
|
|
1406
1446
|
inheritable set. The provider relies on no privilege tool of the
|
|
1407
|
-
snapshot's: the first live start failed on the snapshot's `setpriv`, and the daemon's own drop replaced it.
|
|
1408
|
-
that session: deleting it ends init.
|
|
1447
|
+
snapshot's: the first live start failed on the snapshot's `setpriv`, and the daemon's own drop replaced it.
|
|
1409
1448
|
4. `connect()` starts `computerd stdio` as root the same way, in a session of its own, to reach a socket in a
|
|
1410
1449
|
directory that is the daemon's user's alone; it only carries bytes. Init and the bridge each check the daemon's
|
|
1411
1450
|
path against the same rule before they run it as root, and refuse in words when it fails, so a binary a user
|
|
@@ -1413,8 +1452,14 @@ So the provider pushes it in at create and starts it as a long-lived command, an
|
|
|
1413
1452
|
(`POST .../input`, whole lines, one call after another), and its stdout is the command's log stream, a WebSocket
|
|
1414
1453
|
with `follow=true`, in which Daytona prefixes each stdout line with `01 01 01` and each stderr line with `02 02 02`
|
|
1415
1454
|
(split output, asked for with `X-Daytona-Split-Output: true`). Input is sent with `suppressInputEcho`; a line that
|
|
1416
|
-
is a request or a notification, never a reply, is dropped in case a toolbox echoes input anyway.
|
|
1417
|
-
|
|
1455
|
+
is a request or a notification, never a reply, is dropped in case a toolbox echoes input anyway. An input call
|
|
1456
|
+
Daytona answers with its own 500 (its error body, `"statusCode":500`) is sent again, up to three tries with a
|
|
1457
|
+
doubling pause: that answer comes from an error before the call is passed on, or from the toolbox's input route
|
|
1458
|
+
when it could not open the command's input pipe or its reader is gone (`daytonaio/daytona@b5a5d9e7
|
|
1459
|
+
apps/daemon/pkg/session/input.go`), so the line reached no reader. Nothing else is sent again: a call passed on
|
|
1460
|
+
that then fails is a 502 (`libs/common-go/pkg/proxy/proxy.go`), and after a 502, 503, 504, a timeout or no answer
|
|
1461
|
+
the line may have been read, and a line read twice is a request the daemon runs twice. `close()` deletes the
|
|
1462
|
+
session, which ends the bridge and nothing else.
|
|
1418
1463
|
|
|
1419
1464
|
This is the protocol's first binding, stdio over the vendor's exec stream, assembled from two halves: the session
|
|
1420
1465
|
command's input and its log stream are each one-way, and together they are the duplex byte stream `DaemonClient`
|
|
@@ -1437,7 +1482,11 @@ from (the loopback block):
|
|
|
1437
1482
|
neither port 2280 on the loopback nor the sandbox's own address; vsock and io_uring are refused to them; and init
|
|
1438
1483
|
refuses to start while another process holds their uid, so a toolbox (or a session shell of its) that runs as the
|
|
1439
1484
|
daemon's user is refused, not shared. `capabilities().vendorAgentPorts` declares 2280, and the Core case
|
|
1440
|
-
isolation.vendor-agent probes it from a program of the computer's user, on both loopbacks.
|
|
1485
|
+
isolation.vendor-agent probes it from a program of the computer's user, on both loopbacks. Init takes others' access
|
|
1486
|
+
off every socket under `/run`; Daytona's D-Bus session bus sits in `/tmp` (`/tmp/dbus-<10 characters>`, which a
|
|
1487
|
+
program of the computer's user could connect to in the live baseline), so create, as root and before init starts,
|
|
1488
|
+
takes others' access off each socket `/tmp/dbus-*` names (as on every child host), and its notes name the ones it
|
|
1489
|
+
closed. A runner whose root may
|
|
1441
1490
|
not make a network namespace (no CAP_SYS_ADMIN: a container class on a runner that is not privileged) fails closed:
|
|
1442
1491
|
init refuses to start, in words, and create deletes the sandbox.
|
|
1443
1492
|
- The provider still installs and starts the daemon through that toolbox, as root or through passwordless `sudo`, and
|
|
@@ -1448,8 +1497,8 @@ from (the loopback block):
|
|
|
1448
1497
|
- Network `none` is `networkBlockAll` (Daytona drops what leaves the sandbox on the host) and, beside it, the
|
|
1449
1498
|
daemon's own namespace. Known gap: `open` and allowlists are refused in words until a proxy carries them out of the
|
|
1450
1499
|
daemon's own network, the next feature after this one; a computer that needs pip, npm or git from the internet
|
|
1451
|
-
cannot be made on Daytona until then. `network()` refuses
|
|
1452
|
-
|
|
1500
|
+
cannot be made on Daytona until then. A computer's network is fixed at create: `network()` refuses every change, with
|
|
1501
|
+
`refused`, and asks Daytona nothing.
|
|
1453
1502
|
- From outside, anyone with the API key can run a command as root in the sandbox through the same toolbox.
|
|
1454
1503
|
|
|
1455
1504
|
Daytona's container class runs code as root, and the open runner runs it privileged.
|
|
@@ -1463,88 +1512,76 @@ the TTL.
|
|
|
1463
1512
|
| --- | --- | --- |
|
|
1464
1513
|
| `kind` | `linux` | a Linux shell with computerd: exec, files and processes |
|
|
1465
1514
|
| `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. |
|
|
1466
|
-
| `network` | `none` | `networkBlockAll
|
|
1515
|
+
| `network` | `none`, `open`, `allow` | none: `networkBlockAll` at create, and the daemon's own network namespace; open and a list: not blocked (the account's tier may still limit where it goes), and the daemon's own namespace whose one way out is init's egress proxy (public internet only; a list's hosts alone) |
|
|
1467
1516
|
| `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 |
|
|
1468
|
-
| `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot
|
|
1517
|
+
| `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot |
|
|
1469
1518
|
| `os` | `linux` | Linux classes only; Windows and macOS are not offered here |
|
|
1470
|
-
| `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is a session command it
|
|
1519
|
+
| `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is started detached through a session command of it (above) |
|
|
1520
|
+
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
1471
1521
|
| `groups` | `exec`, `files`, `processes` | the daemon's own, checked against its hello's `groups`, as is its `kind` |
|
|
1472
1522
|
| `maxLifetimeMs` | 30 days | the cap `check` gives, through the shared `checkLifetime`; Daytona's TTL is whole minutes and documents no cap of its own |
|
|
1473
1523
|
| `user` | none | the daemon runs as the provider's `daemonUser`; a spec cannot name a user |
|
|
1474
|
-
| `release` | `
|
|
1475
|
-
| `
|
|
1476
|
-
| `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 |
|
|
1524
|
+
| `release` | `delete` | `DELETE /sandbox/{id}`; a stop is refused as `unsupported` |
|
|
1525
|
+
| `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"). 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 |
|
|
1477
1526
|
|
|
1478
1527
|
### What the provider does
|
|
1479
1528
|
|
|
1480
|
-
- `check(spec)` refuses in words, with no request: no snapshot
|
|
1481
|
-
that is not `none` (open and every allowlist alike), a label in the provider's
|
|
1482
|
-
namespace (`agentrun.computer`), `cpus`, `memoryMb` or `pids` (a snapshot's size is its own), `user`, `workdir`
|
|
1483
|
-
(the daemon works in `/work`), and any other
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
the
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
`
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1529
|
+
- `check(spec)` refuses in words, with no request: no snapshot (or one of blanks or control characters), a lifetime
|
|
1530
|
+
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
|
|
1531
|
+
own namespace (`agentrun.computer`), `cpus`, `memoryMb` or `pids` (a snapshot's size is its own), `user`, `workdir`
|
|
1532
|
+
(the daemon works in `/work`), a GPU computer's snapshot other than the GPU snapshot or `"default"`, and any other
|
|
1533
|
+
field.
|
|
1534
|
+
- `create(spec, { requestId })` names the computer `computer-<12 hex digits of sha256(requestId)>` and lists that name
|
|
1535
|
+
first: a retry of the same request finds the computer the first one made (the adapter's idempotent create,
|
|
1536
|
+
[PROVIDERS.md](PROVIDERS.md)). It sends `POST /sandbox` with that name, the snapshot (none for `"default"`), the
|
|
1537
|
+
labels (`agentrun.computer=1`, `agentrun.computer.name`, the deadline, the image, and the most an extend could move
|
|
1538
|
+
the deadline to), `public: false`, `networkBlockAll`, `ttlMinutes`, `autoStopInterval` (`autoStopMinutes`; unset, 0,
|
|
1539
|
+
since Daytona's idle timer counts only outside traffic and a daemon at work would be stopped), and
|
|
1540
|
+
`autoDeleteInterval` (`autoDeleteMinutes`; unset, -1: a stop keeps the sandbox, which the TTL then ends). `POST
|
|
1541
|
+
/sandbox` is never retried; a name Daytona already holds (409) is `exists`, and the adapter adopts the sandbox the
|
|
1542
|
+
name lists, as a retry does (or answers `exists` when none lists). A create that fails without a 4xx
|
|
1543
|
+
answer, or is aborted, may still have made the sandbox, so the adapter deletes the name it chose. Then it waits for
|
|
1544
|
+
`started` (polling `GET /sandbox/{id}`), pushes in and starts the daemon, checks the daemon and probes its network
|
|
1545
|
+
none from inside, and waits until the label listing shows the new computer twice running (Daytona's listing trails
|
|
1546
|
+
a create). A sandbox that reads `error` or `build_failed` is gone, and create fails `vendor` with Daytona's
|
|
1547
|
+
`errorReason`. Any failure or abort after the sandbox exists deletes it, and create never returns ok once its signal
|
|
1548
|
+
has aborted.
|
|
1549
|
+
- `attach({ id })` takes a sandbox id (or a computer's name, which Daytona answers to as well); `attach({ labels })`
|
|
1550
|
+
must match exactly one computer. Only a sandbox with `agentrun.computer=1` and a computer's name label counts.
|
|
1551
|
+
Attach holds the daemon to the provider's, when the computer is started. It returns `spec`: `image`, the image
|
|
1552
|
+
create was asked for (`"default"` stays `"default"`), from its label; the daemon's user, the network, `/work`, the
|
|
1553
|
+
deadline and, with one, the GPU.
|
|
1554
|
+
- `list(labels)` asks Daytona for `agentrun.computer=1` alone, every page, for the ids; the adapter keeps those whose
|
|
1555
|
+
`GET /sandbox/{id}` carries the other labels. A sandbox that is `destroying`, `destroyed`, `error` or `build_failed`,
|
|
1556
|
+
or whose desired state is `destroyed`, is gone and left out: none of them starts again. `started` is `running`; the
|
|
1557
|
+
states on the way to it are starting, and left out; every other state (`stopping`, `pausing`, `stopped`, `archived`,
|
|
1558
|
+
`paused`) is `stopped`.
|
|
1559
|
+
- `network(ref)` is the adapter's probe from inside; `network(ref, policy)` refuses any policy but the one the
|
|
1560
|
+
computer has, with `refused` and no request.
|
|
1511
1561
|
- `release(ref, "delete")` deletes: retried on a 5xx, checked against the sandbox, with a forced stop before the last
|
|
1512
|
-
attempt.
|
|
1513
|
-
|
|
1514
|
-
- Daytona is asynchronous: it answers a delete by setting the sandbox's desired state to `destroyed
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
the sandbox it made (a failure, a mismatch, an abort) waits the same way before it returns.
|
|
1525
|
-
- `connect(ref)` refuses a computer that is not `started`, and a daemon whose hello is not the provider's.
|
|
1562
|
+
attempt. It is idempotent, and refuses a sandbox that is not this provider's. `release(ref, "stop")` is refused as
|
|
1563
|
+
`unsupported`, with no request: a Daytona computer is deleted, never stopped and kept.
|
|
1564
|
+
- Daytona is asynchronous: it answers a delete by setting the sandbox's desired state to `destroyed`, and the sandbox
|
|
1565
|
+
gets there later, through `destroying`. Its listing trails it. So release waits until `GET /sandbox/{id}` no longer
|
|
1566
|
+
finds the computer, twice running: a 404 or `destroyed`. A sandbox still `destroying`, or with the desired state
|
|
1567
|
+
alone, reads gone to every other caller but holds this wait. It polls with pauses that double from `pollMs` up to
|
|
1568
|
+
5 s, bounded by the `goneMs` timeout (120 s unset)
|
|
1569
|
+
and by the signal `release(ref, how, { signal })` takes. When the bound runs out, release fails in words naming the
|
|
1570
|
+
last state Daytona read: it never reports a release it has not seen done. A create that deletes the sandbox it made
|
|
1571
|
+
(a failure, an abort) waits the same way before it returns.
|
|
1572
|
+
- `connect(ref)` answers `gone` for a sandbox that is going (destroying, or asked to destroy), refuses one that is
|
|
1573
|
+
not `started`, and a daemon whose hello is not the provider's.
|
|
1526
1574
|
- Every call has its own timeout and takes the caller's signal; reads, the upload and deletes are retried (three tries,
|
|
1527
|
-
backoff); creates, session commands
|
|
1528
|
-
|
|
1529
|
-
### The drift check
|
|
1575
|
+
backoff from `timeouts.retryMs`, 500 ms unset); creates, session commands and input are not.
|
|
1530
1576
|
|
|
1531
|
-
|
|
1577
|
+
### The daemon check
|
|
1532
1578
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
| `snapshot` | the spec's image; for `"default"`, whatever Daytona names, unchecked |
|
|
1536
|
-
| `networkBlockAll`, `networkAllowList`, `domainAllowList`, `outboundProxyUrl` | the network declared; an outbound proxy, both lists, or block-all with a list is drift |
|
|
1537
|
-
| `labels` | `agentrun.computer=1`, the deadline and the image as written, every label the spec asked for |
|
|
1538
|
-
| `autoStopInterval`, `autoDeleteInterval` | `autoStopMinutes` (0 unset), `autoDeleteMinutes` (-1 unset), exactly |
|
|
1539
|
-
| `autoDestroyAt` | set, and no later than the deadline plus the TTL's minute and 2 minutes of clock skew |
|
|
1540
|
-
| `sandboxClass` | the provider's class |
|
|
1541
|
-
| `gpu`, `gpuType` | `spec.gpu`'s count (0 with none) and, with one, its type |
|
|
1542
|
-
| `public`, `kvm`, `volumes`, `linkedSandboxId` | false, not true, none, none |
|
|
1543
|
-
|
|
1544
|
-
From the daemon, over one connection: hello (the provider's version, `linux`, the `arch` option, every daemon
|
|
1579
|
+
Daytona's create options are not read back: what create sent is what the sandbox has. A GPU computer's GPUs are the
|
|
1580
|
+
adapter's `agentrun.computer.gpu` label, as on every host. From the daemon, over one connection: hello (the provider's version, `linux`, the `arch` option, every daemon
|
|
1545
1581
|
capability), `/proc/self/status` (Uid and Gid the daemon user's four times, no groups, `NoNewPrivs: 1`, `CapInh`,
|
|
1546
1582
|
`CapPrm`, `CapEff`, `CapBnd` and `CapAmb` all zero), `/proc/self/cwd` (`/work`) and `/proc/self/exe`
|
|
1547
|
-
(`/opt/agentrun/computerd`); and the
|
|
1583
|
+
(`/opt/agentrun/computerd`); its own network (loopback alone), and the probe: no target answers a computer with
|
|
1584
|
+
network none; and the installed binary's sha256 from the install.
|
|
1548
1585
|
|
|
1549
1586
|
### Conformance on Daytona
|
|
1550
1587
|
|
|
@@ -1562,10 +1599,9 @@ fallback: on a host that runs other Daytona work they may hold another organizat
|
|
|
1562
1599
|
which serve passes in itself.
|
|
1563
1600
|
|
|
1564
1601
|
Every sandbox of a run has a bounded life besides its TTL: the module always sets `autoStopMinutes: 30` and
|
|
1565
|
-
`autoDeleteMinutes: 0`, whatever the environment says.
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
`vendor`, and a stop keeps none). The module exports `conformanceImage()` and `conformanceNotes`; the CLI takes the
|
|
1602
|
+
`autoDeleteMinutes: 0`, whatever the environment says. The provider never stops a computer: Core `provider.stop`
|
|
1603
|
+
expects its refusal. Full `provider.janitor`, which needs a stopped computer kept, is skipped (the lifetime is
|
|
1604
|
+
`vendor`, and release keeps none). The module exports `conformanceImage()` and `conformanceNotes`; the CLI takes the
|
|
1569
1605
|
image from it when `--image` names none, and prints the note above the verdict (`notes` in `--json`).
|
|
1570
1606
|
|
|
1571
1607
|
```sh
|
|
@@ -1574,25 +1610,17 @@ npm run conformance -w @parcha/agentrun-computer -- --provider daytona [--image
|
|
|
1574
1610
|
|
|
1575
1611
|
### The sweep around a live run
|
|
1576
1612
|
|
|
1577
|
-
`dist/conformance/
|
|
1578
|
-
the
|
|
1613
|
+
The live sweep is the shared one, `dist/conformance/sweep.js --provider daytona --before <file>` and `--after <file>`
|
|
1614
|
+
([PROVIDERS.md](PROVIDERS.md), "The live sweep"); it reads the same `COMPUTER_DAYTONA_API_KEY` and
|
|
1615
|
+
`COMPUTER_DAYTONA_API_URL` through the conformance module's `createHost`, with no live switch:
|
|
1579
1616
|
|
|
1580
1617
|
```sh
|
|
1581
|
-
node packages/computer/dist/conformance/
|
|
1582
|
-
node packages/computer/dist/conformance/
|
|
1618
|
+
node packages/computer/dist/conformance/sweep.js --provider daytona --before /tmp/daytona-before.json # before the run
|
|
1619
|
+
node packages/computer/dist/conformance/sweep.js --provider daytona --after /tmp/daytona-before.json # after it
|
|
1583
1620
|
```
|
|
1584
1621
|
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
and that carries a conformance run's label (`agentrun.conformance`, which every computer of a run carries), then reads
|
|
1588
|
-
each with `GET /sandbox/{id}` until Daytona answers 404, up to 60 s each, and prints one JSON line,
|
|
1589
|
-
`{"swept":n,"notFound":m,"stillThere":[ids],"leftAlone":k}`, where `swept` counts the conformance sandboxes not there
|
|
1590
|
-
before, `notFound` plus `stillThere`'s length is `swept`, and `leftAlone` counts the new labelled sandboxes with no
|
|
1591
|
-
conformance label: another user of the account (a server's computers) made them during the run, and no call names
|
|
1592
|
-
them. A sandbox in the file is never named by any call. A new conformance sandbox without a computer's name is not this
|
|
1593
|
-
provider's: release refuses it, and it is reported still there. Exit 0 when every swept sandbox reads 404, 1 when one
|
|
1594
|
-
is still there, 2 on a usage error, a before file it cannot read, no key, or a listing Daytona refused (nothing is
|
|
1595
|
-
deleted then).
|
|
1622
|
+
It prints `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}` (`gone` was `notFound`). A conformance run of
|
|
1623
|
+
Daytona also sweeps its own label through the host at its end (the report's `cleanup.sweep`).
|
|
1596
1624
|
|
|
1597
1625
|
### Not yet known
|
|
1598
1626
|
|
|
@@ -1683,17 +1711,22 @@ const made = await e2b.create({ image: "desktop", lifetimeMs: 600_000, network:
|
|
|
1683
1711
|
```
|
|
1684
1712
|
|
|
1685
1713
|
E2B runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/e2b.ts` is E2B's `MachineHost`, its
|
|
1686
|
-
SDK
|
|
1714
|
+
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
|
|
1687
1715
|
E2B's own. `create` takes the caller's request id (`{ requestId }`, serve's is the run's claim): the computer's name is
|
|
1688
1716
|
`computer-` and the first 12 hex digits of its sha256, and a retry of the same request finds the computer the first
|
|
1689
1717
|
made instead of making a second.
|
|
1690
1718
|
|
|
1691
|
-
An E2B computer is a sandbox made from an E2B template
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1719
|
+
An E2B computer is a sandbox made from an E2B template. The descriptor names no default: it says `prepareImage`, and
|
|
1720
|
+
`prepareImage()` answers the box template, `boxE2bTemplate()` (`src/box-image.ts`), with no call and no wait. That is
|
|
1721
|
+
`<BOX_E2B_PUBLISHER>/agentrun-archil-<recipe hash>`, the box image (`box/Dockerfile`: the archil client and helper,
|
|
1722
|
+
the tool user, FUSE, Xvfb, xfwm4 and the apps) that the release's `box-e2b` job builds as a template in the publishing
|
|
1723
|
+
team and makes public, so any E2B account starts it by that name. A sandbox and a desktop both start from it, in either
|
|
1724
|
+
mode. It is kind `desktop`: computerd starts the X server and xfwm4 itself (`src/desktop.ts`), as on a Docker desktop,
|
|
1725
|
+
and its X11 shim drives it. With `kind: "linux"` it is kind `linux` on any template, with no display: the same
|
|
1726
|
+
provider, minus the X server, so it costs nothing to offer. A caller that names a template (`create({ image })`) gets
|
|
1727
|
+
that one: E2B Desktop's own, `desktop`, still works for kind `desktop`, since computerd needs only Xvfb and xfwm4 from
|
|
1728
|
+
it. Every call goes through the host's E2B JS SDK, the `e2b` package's `Sandbox` class, whose types `src/e2b.ts` imports
|
|
1729
|
+
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
|
|
1697
1730
|
Modal's is. `@e2b/desktop` is not used: it starts Xvfb and Xfce with `commands.run`, outside computerd's process table
|
|
1698
1731
|
and with no bound or abort (`@e2b/desktop@2.5.0` `dist/index.mjs:387-415`), and the provider needs none of its other
|
|
1699
1732
|
calls.
|
|
@@ -1725,26 +1758,47 @@ E2B's envd is the sandbox's first process, a systemd service with `Restart=alway
|
|
|
1725
1758
|
cancelled: one that lands after create gave up is killed by its id, one whose answer never comes by its name label.
|
|
1726
1759
|
The listing shows a new sandbox a moment late, so the name is listed again until it shows or `listedMs` (15 s)
|
|
1727
1760
|
passes, and the sandbox found is killed and read back gone, as release waits for one.
|
|
1728
|
-
2. `getInfo` reads the sandbox
|
|
1729
|
-
3.
|
|
1761
|
+
2. `getInfo` reads the sandbox's state until it runs.
|
|
1762
|
+
3. A command as root makes the system paths whose permissions E2B's template build sets wider than root's root's alone
|
|
1763
|
+
(`HostFacts.rootOnly`, `ROOT_ONLY` in `src/e2b.ts`), and everything under a directory: root the owner, and write
|
|
1764
|
+
taken off group and other users. It fails create if any entry is still not root's alone. It runs before anything of create's is in the
|
|
1765
|
+
sandbox, so the daemon's install and the Archil helper's sha256 check read what only root can change. Then
|
|
1766
|
+
`files.write` uploads the daemon as root to `/tmp/agentrun-computerd-<random>` (`index.mjs:2332-2435`), and the
|
|
1730
1767
|
same install command as Daytona's (`src/hosted/scripts.ts`) moves it to `/opt/agentrun/computerd`, root-owned, and
|
|
1731
1768
|
prints its sha256, which must be the uploaded one's, and who installed it (a create note).
|
|
1732
1769
|
4. The adapter's start command, a background command as root, starts `computerd init --deadline <time> --user
|
|
1733
1770
|
2510:2510 --own-network --max-deadline <create's time plus the cap>` with `DISPLAY=:0`, in a clean environment,
|
|
1734
1771
|
detached: in a session of its own (`setsid`), its output to `/run/agentrun-init.log`, so the command ends at once
|
|
1735
|
-
and a daemon that never answers is reported with init's own words.
|
|
1736
|
-
|
|
1737
|
-
`
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1772
|
+
and a daemon that never answers is reported with init's own words. Every command goes through envd's
|
|
1773
|
+
`Process.Start` stream, called on the SDK's own Connect client (`commands.rpc`, `index.mjs:4972-4985`) as
|
|
1774
|
+
`commands.run` calls it (`index.mjs:5123-5146`), without its login shell: `/bin/sh` by its path runs the argv as its
|
|
1775
|
+
own words (`-c 'exec "$@"' sh <argv>`), with `PATH` the system's directories alone, root by the Basic header
|
|
1776
|
+
(`index.mjs:1896-1900`), envd's keepalive every 50 s, and no deadline on the stream (timeout 0, which the Connect
|
|
1777
|
+
transport reads as none), because envd kills a command whose timeout passes (envd `process/start.go:39-44`); the
|
|
1778
|
+
SDK's default would end it after 60 s (`index.mjs:4978`). Only the start is bounded.
|
|
1779
|
+
5. `connect()` starts `computerd stdio` the same way, as root; every exec has stdin open (`stdin: true`), and `end()`
|
|
1780
|
+
is `closeStdin`. Its stdout is the bytes each data
|
|
1781
|
+
event carries, passed on as they come: `commands.run` would hand them to `onStdout` as text, decoded as UTF-8
|
|
1782
|
+
(`index.mjs:2702`, `2860`), which turns every byte that is not UTF-8 into U+FFFD, so `exec` reads the stream
|
|
1783
|
+
itself. Requests go in with `sendStdin`, one call after another. `close()` kills the bridge (SIGKILL,
|
|
1784
|
+
`index.mjs:5092-5095`), which ends nothing else, and lets go of its stream. The bridge has no command timeout, so one
|
|
1785
|
+
whose start answers after the call gave up on it (its bound passed, or the caller aborted) is killed as it lands.
|
|
1744
1786
|
6. A desktop's X server, `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp`, starts through the daemon with
|
|
1745
1787
|
`process.start`, as the computer's user, and create waits until hello declares the display (`src/desktop.ts`,
|
|
1746
|
-
shared with Docker).
|
|
1747
|
-
|
|
1788
|
+
shared with Docker). Then xfwm4, which the template has, starts the same way on it (`xfwm4 --compositor=off
|
|
1789
|
+
--sm-client-disable`, `WINDOW_MANAGER`), so the apps an agent opens are framed and focused. xfwm4 reads its
|
|
1790
|
+
settings over a session bus and exits without one. So it runs under `dbus-run-session`, in a user namespace (the
|
|
1791
|
+
same uid) and a network namespace of its own (`unshare --user --map-current-user --net`), and its bus listens on an
|
|
1792
|
+
abstract name there, which a program of the computer's user cannot connect to. One that joins those namespaces
|
|
1793
|
+
(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
|
|
1794
|
+
accessibility bridge would start an at-spi bus, a socket of the user's at `/work/.cache/at-spi/bus_0` that nothing
|
|
1795
|
+
of ours uses. An app also gets no session bus (`DBUS_SESSION_BUS_ADDRESS=disabled:`). Given none, it would start
|
|
1796
|
+
one with the template's dbus-launch, and that bus starts gnome-keyring-daemon, a socket of the user's at
|
|
1797
|
+
`/work/.cache/keyring-*/control`. The template has no passwd entry
|
|
1798
|
+
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
|
|
1799
|
+
user `agentrun-tool` (home the computer's, shell `/bin/sh`), as the box image does (`daemon.NameUser`). A window
|
|
1800
|
+
manager that ends within a second of its start fails create with its last words. Hello re-checks the
|
|
1801
|
+
display on every call, so `connect()` refuses a desktop whose X server has gone (it reads back kind `linux`).
|
|
1748
1802
|
|
|
1749
1803
|
envd runs as root and obeys anyone with the API key, as Daytona's toolbox does, and answers on 49983 (`e2b@2.63.0`
|
|
1750
1804
|
`dist/index.mjs:1213`, `envdPort`) inside the sandbox; the computer's daemon runs as 2510:2510 with no capability in
|
|
@@ -1761,9 +1815,9 @@ would hold an empty process table).
|
|
|
1761
1815
|
| --- | --- | --- |
|
|
1762
1816
|
| `kind` | `desktop` (default) or `linux` | `options.kind`; a desktop's X server is computerd's own |
|
|
1763
1817
|
| `lifetime` | `vendor` | E2B kills the sandbox at its timeout, set to the lifetime; init ends every process at the deadline too |
|
|
1764
|
-
| `network` | `none` | `allowInternetAccess` false
|
|
1818
|
+
| `network` | `none`, `open`, `allow` | none: `allowInternetAccess` false and `allowPublicTraffic` false at create, and the daemon's own network namespace; open and a list: `allowInternetAccess` true (`allowPublicTraffic` stays false), and the daemon's own namespace whose one way out is init's egress proxy (public internet only; a list's hosts alone) |
|
|
1765
1819
|
| `vendorAgentPorts` | `[49983]` | envd's port; isolation.vendor-agent checks a program of the computer's user reaches it on neither loopback |
|
|
1766
|
-
| `networkReadBack` | `
|
|
1820
|
+
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
1767
1821
|
| `isolation` | `microvm` | Firecracker |
|
|
1768
1822
|
| `daemon` | `child` | envd is the first process; init is a background command it runs |
|
|
1769
1823
|
| `groups` | `exec`, `files`, `processes`, and on a desktop `screen`, `input.pointer`, `input.keys` | checked against hello on every connect |
|
|
@@ -1783,9 +1837,9 @@ Modal) also tries IPv4 and IPv6 addresses from inside at create and attach, the
|
|
|
1783
1837
|
`[2606:4700:4700::1111]:53/udp`, or the `probeTargets` option), and refuses the computer if one answers within the 10 s
|
|
1784
1838
|
window (the rule every provider shares: [Network none, read from inside](#network-none-read-from-inside-nothing-answers)).
|
|
1785
1839
|
The probe's `exec.run` is bounded at 30 s (`timeouts.probeMs`), above its longest run, 20 s. Open and an allowlist
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1840
|
+
go through the egress proxy init starts outside the daemon's programs' network (the shared hosted adapter's, below):
|
|
1841
|
+
the sandbox is made with internet access, and the programs reach the public internet, or the list's hosts, through
|
|
1842
|
+
`127.0.0.1:3128` alone. The network is fixed at create: `network(ref, policy)` refuses a change. Since the probe runs inside the
|
|
1789
1843
|
daemon's own network, every target reads `refused` there, whatever E2B's firewall would have done; the firewall facts
|
|
1790
1844
|
below are what a program outside that namespace meets.
|
|
1791
1845
|
|
|
@@ -1826,10 +1880,12 @@ timer is never pulled under it. When init's move fails after E2B's, the error sa
|
|
|
1826
1880
|
and init's did not: the programs end at the old deadline, earlier than asked, never later. A provider runs one extend
|
|
1827
1881
|
of a computer at a time, each reading the deadline the one before it left, so a slow, shorter extend never pulls E2B's
|
|
1828
1882
|
timer under a longer one's (two providers extending one computer at once are not ordered). E2B has no call that
|
|
1829
|
-
changes metadata, so the deadline label stays as create wrote it, and
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
so
|
|
1883
|
+
changes metadata, so the deadline label stays as create wrote it, and the host reads E2B's own end in its place, up to
|
|
1884
|
+
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
|
|
1885
|
+
the second E2B rounds to). `getInfo` reads the moved end; `Sandbox.list` may still show create's (read live 11-14),
|
|
1886
|
+
so `list()` and `attach()` report the end from `get`, as the adapter reads every listed machine.
|
|
1887
|
+
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
|
|
1888
|
+
reads back.
|
|
1833
1889
|
|
|
1834
1890
|
There is no `stream()`: a screen is streamed through agentrun, never through a vendor URL. A URL into an E2B sandbox
|
|
1835
1891
|
that a browser could open needs public traffic, since a private sandbox's URL needs the `e2b-traffic-access-token`
|
|
@@ -1842,27 +1898,23 @@ words, whatever its value, and every sandbox is made with public traffic off.
|
|
|
1842
1898
|
- `check(spec)` refuses in words, with no call: no template, a lifetime past the cap (the shared `checkLifetime`), a
|
|
1843
1899
|
network that is not none (open and an allowlist alike), a label in the provider's namespace,
|
|
1844
1900
|
`cpus`, `memoryMb` or `pids` (a template's size is its own), `user`, `workdir` and any other field.
|
|
1845
|
-
- `create`
|
|
1846
|
-
reports one), every label, the network (above), `lifecycle.onTimeout` other than `kill`, `autoResume`, a state that
|
|
1847
|
-
is not `running`, and an end that is not E2B's start plus the timeout create gave. Then the daemon: hello (version,
|
|
1901
|
+
- `create` waits for the sandbox to run; E2B's create options are not read back. Then the daemon: hello (version,
|
|
1848
1902
|
`linux`, `amd64`, kind and groups), `/proc/self/status` (uid and gid 1000, no groups, `NoNewPrivs` 1, every
|
|
1849
1903
|
capability set zero), `/proc/self/cwd` (`/work`), `/proc/self/exe`; and for none, the probe. It waits until the label
|
|
1850
1904
|
listing shows the new computer. A failure, mismatch or abort at any step kills the sandbox and waits for it to go;
|
|
1851
1905
|
create never returns ok once its signal has aborted.
|
|
1852
|
-
- `attach({ id })` or `attach({ labels })` reads the
|
|
1853
|
-
create
|
|
1854
|
-
and `snapshot` the id E2B reports.
|
|
1906
|
+
- `attach({ id })` or `attach({ labels })` reads the computer from E2B and, for a running computer, the daemon, as at
|
|
1907
|
+
create. `image` is the template create was asked for, from its label.
|
|
1855
1908
|
- `list(labels)` asks E2B for the labels with `agentrun.computer=1` (`Sandbox.list`, running and paused sandboxes,
|
|
1856
|
-
`index.d.mts:10289`), every page,
|
|
1857
|
-
|
|
1858
|
-
|
|
1909
|
+
`index.d.mts:10289`), every page, for the ids: the adapter reads each one by `getInfo`, since the listing may still
|
|
1910
|
+
show a killed sandbox or an end from before a timer moved; paused is `stopped`. One deadline, `listMs` (60 s) from
|
|
1911
|
+
the call, bounds every page; past it, `list()` is a timeout in words.
|
|
1859
1912
|
- `connect(ref)` refuses a paused computer without connecting, since E2B's connect resumes one; it gives E2B a timeout
|
|
1860
1913
|
a little under what is left, and E2B moves a running sandbox's timer only to a longer one (`index.d.mts:10250`), so
|
|
1861
1914
|
connecting never moves the end.
|
|
1862
1915
|
- `release(ref, "delete")` reads the sandbox back to check it is this provider's, then kills it (`index.mjs:5398-5410`;
|
|
1863
1916
|
a sandbox E2B no longer has is done), both never signalled, so a release whose signal aborted first still kills;
|
|
1864
|
-
then it waits through `waitUntil` until `getInfo` answers not found (`index.mjs:5431`) and the
|
|
1865
|
-
longer shows it, twice running, with pauses doubling from `pollMs` to 5 s, within `goneMs` (120 s) and the caller's
|
|
1917
|
+
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
|
|
1866
1918
|
signal, which ends only this wait.
|
|
1867
1919
|
`release(ref, "stop")` is refused in words.
|
|
1868
1920
|
- Every SDK call has its own bound and takes the caller's signal; the paginator takes it per page (`Sandbox.list`
|
|
@@ -1878,7 +1930,8 @@ The conformance module, `dist/conformance/e2b.js`, checks `AGENTRUN_COMPUTER_LIV
|
|
|
1878
1930
|
else, then reads the run's settings (`settingsFromEnv`, below) and builds the provider through `create()` with every
|
|
1879
1931
|
computer capped at 30 minutes, Hobby's plan for conformance
|
|
1880
1932
|
(Hobby caps a sandbox at 1 h; a run that needs more moves to Pro). `conformanceImage()` is `COMPUTER_E2B_TEMPLATE`, else
|
|
1881
|
-
`desktop` (`base` for kind linux),
|
|
1933
|
+
`desktop` (`base` for kind linux), E2B's stock templates, which conformance keeps since it proves the provider rather
|
|
1934
|
+
than the box (a run against the box template passes it as `COMPUTER_E2B_TEMPLATE`), and `createDriftedProvider()` uploads a daemon built with Go as `<version>-drift`.
|
|
1882
1935
|
`test/e2b/conformance.e2b.test.mjs` runs the suite with `computerd-fixture` built for linux/amd64, and skips unless the
|
|
1883
1936
|
switch and `COMPUTER_E2B_API_KEY` are both set; `E2B_API_KEY` never counts.
|
|
1884
1937
|
|
|
@@ -1900,10 +1953,6 @@ One live E2B run has been made, the network diagnostic of 2026-11-07 (one sandbo
|
|
|
1900
1953
|
other fact above is read from the SDK, envd and the desktop template's source, and the unit tests run against a fake.
|
|
1901
1954
|
A live run must show:
|
|
1902
1955
|
|
|
1903
|
-
- that `getInfo` reports `allowInternetAccess` or `denyOut`, and `network.allowPublicTraffic: false`, for a sandbox
|
|
1904
|
-
made with them: the provider refuses a computer whose read-back lacks them, so a missing field fails every create;
|
|
1905
|
-
- that `getInfo` reports a template asked for by alias with that alias, or its id (the drift check skips an alias E2B
|
|
1906
|
-
does not report);
|
|
1907
1956
|
- that a sandbox with no internet access gets no answer from any probe target, IPv6 included (the one diagnostic read
|
|
1908
1957
|
the IPv6 target refused and every IPv4 one accepted with 0 bytes), and what else `denyOut 0.0.0.0/0` lets through;
|
|
1909
1958
|
- that envd keeps init running once create disconnects, and how long `getInfo` takes to answer not found after a kill;
|
|
@@ -1933,8 +1982,8 @@ Agent37 runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)):
|
|
|
1933
1982
|
start, the stdio bridge, the probe, the janitor's extend, idempotent create by the request's name label). An Agent37
|
|
1934
1983
|
computer is an instance made from a workspace template, by default `agent37-base`, Agent37's plain Debian 12. It is
|
|
1935
1984
|
kind `linux`, on type `vm` (a VM with its own kernel, the default) or `default` (Agent37's gVisor sandbox). With
|
|
1936
|
-
`kind: "desktop"` it is a Linux desktop on `agentrun-box
|
|
1937
|
-
([below](#the-desktop-agentrun-box)).
|
|
1985
|
+
`kind: "desktop"` it is a Linux desktop on `agentrun-box-<recipe hash>`, our public box image registered as a template
|
|
1986
|
+
of the key's workspace on its first run ([below](#the-desktop-agentrun-box)).
|
|
1938
1987
|
|
|
1939
1988
|
### Two keys
|
|
1940
1989
|
|
|
@@ -1954,10 +2003,10 @@ names the API key by its sha256 prefix alone.
|
|
|
1954
2003
|
| `get` | `GET /v1/instances/{id}`; 404 is none |
|
|
1955
2004
|
| `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 |
|
|
1956
2005
|
| `delete` | `DELETE /v1/instances/{id}`, never signalled; a repeat's 404 is done |
|
|
1957
|
-
| `
|
|
1958
|
-
| `exec` | SSH as root over a binary WebSocket to `wss://{id}-22022.agent37.app/`, one
|
|
2006
|
+
| `extend` | `GET`, then `PATCH` of the whole `metadata` with the new deadline label, since a PATCH replaces it |
|
|
2007
|
+
| `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) |
|
|
1959
2008
|
| `errorCode` | the envelope's `error.code` (or a flat `error` string), then the HTTP status; ssh2's `client-authentication` is `denied` |
|
|
1960
|
-
| `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 |
|
|
2009
|
+
| `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 (the host's `labels.bytes`; create holds the JSON, quotes and commas too, to it) |
|
|
1961
2010
|
|
|
1962
2011
|
Agent37 has no request id and no unique name, so a retried POST makes a second instance: the adapter lists the name
|
|
1963
2012
|
label and keeps the oldest by `created` (whole seconds; ties go to the lowest id), as it does for every vendor.
|
|
@@ -1967,13 +2016,25 @@ label and keeps the oldest by `created` (whole seconds; ties go to the lowest id
|
|
|
1967
2016
|
Agent37 has no SSH port on the internet: the instance's sshd answers on 22022 inside it, and the edge carries the SSH
|
|
1968
2017
|
stream as binary WebSocket frames. `exec` opens a WebSocket (Node's global one takes `headers`), wraps it as a Duplex
|
|
1969
2018
|
for ssh2's `Client.connect({ sock })`, and runs argv as `sh -c` under a wrapper that writes the shell's pid to
|
|
1970
|
-
`/tmp/.agentrun-exec-<random>` and removes it when the command ends. stdout and stderr are the channel's, piped;
|
|
1971
|
-
|
|
2019
|
+
`/tmp/.agentrun-exec-<random>` and removes it when the command ends. stdout and stderr are the channel's, piped; stdin
|
|
2020
|
+
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
|
|
1972
2021
|
signal or none; its listeners go on inside ssh2's callback, since one read off the tunnel can hold the open, the exit
|
|
1973
2022
|
and the close together (seen live: a listener added after an `await` missed the exit). `kill()` runs a second command
|
|
1974
2023
|
on the same connection that kills the pid's process group (the sshd starts each command as a session and group leader,
|
|
1975
|
-
seen live), then closes the channel
|
|
1976
|
-
stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one process, not its children.
|
|
2024
|
+
seen live), then closes the exec's channel, never a connection. An SSH signal request is not used: ssh2 sends one only
|
|
2025
|
+
while stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one process, not its children.
|
|
2026
|
+
|
|
2027
|
+
Every exec on an instance is a channel on one SSH connection that the provider shares: the daemon's upload, its install,
|
|
2028
|
+
init's start, the stdio bridge and the live view's watch take one WebSocket and one handshake between them (a tunnel and
|
|
2029
|
+
its handshake take about 0.35 s over Agent37's edge, seen live). Execs that start together wait for one handshake, each
|
|
2030
|
+
within its own bound: one with time left when a shared handshake runs out of its opener's opens its own. The connection
|
|
2031
|
+
opens at the first exec (the four tries below), and a connection that closed or failed is never handed out again; a
|
|
2032
|
+
channel that fails to open (the connection died under it, or its sshd took no more sessions) is opened once more on a
|
|
2033
|
+
fresh connection. One connection carries at most 10 channels at once, execs and kills alike, and the next opens a second:
|
|
2034
|
+
OpenSSH's sshd takes 10 sessions on a connection (`MaxSessions`). A kill's channel goes on any connection with room, since
|
|
2035
|
+
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
|
|
2036
|
+
keeps the process alive (ssh2's keepalive timer and the WebSocket's socket), so a process done with its computers exits
|
|
2037
|
+
at most that late. `delete` ends every connection to the instance at once, a retired one still carrying channels too.
|
|
1977
2038
|
|
|
1978
2039
|
### Capabilities
|
|
1979
2040
|
|
|
@@ -1984,15 +2045,15 @@ stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one proce
|
|
|
1984
2045
|
| `isolation` | `vm` or `gvisor` | `options.type`: `vm` (default) or `default` |
|
|
1985
2046
|
| `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 |
|
|
1986
2047
|
| `maxLifetimeMs` | 24 h | the janitor's cap; `options.maxLifetimeMs` sets less |
|
|
1987
|
-
| `network` | `none` | `deny-all
|
|
1988
|
-
| `networkReadBack` | `
|
|
2048
|
+
| `network` | `none`, `open`, `allow` | none: `deny-all` at create, and the daemon's own network namespace; open and a list: `allow-all`, and the daemon's own namespace whose one way out is init's egress proxy (public internet only; a list's hosts alone) |
|
|
2049
|
+
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
1989
2050
|
| `vendorAgentPorts` | `[22022, 7681]` | the platform's sshd (root for whoever holds the key) and its web terminal (ttyd), both seen listening on every VM |
|
|
1990
2051
|
| `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 |
|
|
1991
2052
|
| `release` | `delete` | `DELETE`; no release maps to Agent37's stop here |
|
|
1992
|
-
|
|
|
2053
|
+
| sizes | `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 |
|
|
1993
2054
|
|
|
1994
|
-
Every instance is made with `auto_sleep: false`: a VM that sleeps wakes cold, its daemon gone.
|
|
1995
|
-
|
|
2055
|
+
Every instance is made with `auto_sleep: false`: a VM that sleeps wakes cold, its daemon gone. What create sent is not
|
|
2056
|
+
read back.
|
|
1996
2057
|
|
|
1997
2058
|
### Conformance on Agent37
|
|
1998
2059
|
|
|
@@ -2004,7 +2065,7 @@ AGENTRUN_COMPUTER_LIVE_AGENT37=1 COMPUTER_AGENT37_API_KEY=... COMPUTER_AGENT37_S
|
|
|
2004
2065
|
The conformance module, `dist/conformance/agent37.js`, checks `AGENTRUN_COMPUTER_LIVE_AGENT37=1` first, then reads
|
|
2005
2066
|
`COMPUTER_AGENT37_API_KEY` (`apiKey`, required), `COMPUTER_AGENT37_SSH_KEY` (`sshKey`, required, the key's contents),
|
|
2006
2067
|
`COMPUTER_AGENT37_KIND` (`linux`, the default, or `desktop`), `COMPUTER_AGENT37_TEMPLATE` (the run's image, default
|
|
2007
|
-
`agent37-base`, or
|
|
2068
|
+
`agent37-base`, or for kind `desktop` the box template `prepareImage()` registers), `COMPUTER_AGENT37_TYPE`, `COMPUTER_AGENT37_REGION`,
|
|
2008
2069
|
`COMPUTER_AGENT37_API_URL`, `COMPUTER_AGENT37_DAEMON` (`daemonPath`), `COMPUTER_AGENT37_MAX_LIFETIME_MS` and
|
|
2009
2070
|
`COMPUTER_AGENT37_USER` (`daemonUser`), never `AGENT37_API_KEY`. Every computer of a run lives at most 30 minutes.
|
|
2010
2071
|
`createDriftedProvider()` uploads a daemon built as `<version>-drift`. The live sweep is the shared one,
|
|
@@ -2027,22 +2088,22 @@ kernel `4.19.0-gvisor`): root has no `CAP_SYS_ADMIN`, and init made its namespac
|
|
|
2027
2088
|
`create({ kind: "desktop", ... })` (serve builds the descriptor's desktop configuration so) makes a desktop: the
|
|
2028
2089
|
adapter gives init `DISPLAY` and starts `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp` through the daemon as the tool
|
|
2029
2090
|
user (`src/desktop.ts`), as on E2B, so the X server is one process in init's table, in its own network namespace, and
|
|
2030
|
-
ends with the computer
|
|
2031
|
-
|
|
2032
|
-
`box/
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2091
|
+
ends with the computer; xfwm4 starts the same way once the display answers, its session bus out of the user's reach, as
|
|
2092
|
+
on E2B. It starts from the box image the release publishes, `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
|
|
2093
|
+
(`box/Dockerfile`: the archil client, the helper, the tool user, FUSE, no sudo, plus Xvfb, xfwm4, and the apps E2B
|
|
2094
|
+
Desktop has that are cheap to carry, which the `apps` group lists and opens), as a template of the key's own workspace
|
|
2095
|
+
named `agentrun-box-<recipe hash>`. A sandbox that mounts an Archil disk starts from the same template.
|
|
2096
|
+
|
|
2097
|
+
The descriptor says `prepareImage`, so the provider makes that template itself: `prepareImage()` reads
|
|
2098
|
+
`GET /v1/templates/agentrun-box-<hash>`, and on a 404 registers the public image under that name
|
|
2099
|
+
(`POST /v1/templates` with `name` and `image_ref`, no build), reporting the wait to `onWait` as a pull. Agent37's POST
|
|
2100
|
+
answers once the template is usable, which for an image this size takes minutes, so it is bounded at 15 minutes. A 409
|
|
2101
|
+
is another registration of the same name in flight, and the provider reads the template until it is there. A template
|
|
2102
|
+
the workspace already has is used as it is, so only a workspace's first run waits. The name carries the recipe's hash
|
|
2103
|
+
because Agent37 keeps a template's revisions under one name: a changed recipe is a new template, never a new revision
|
|
2104
|
+
under a run's feet. A refusal (an image Agent37 can't pull, a key it refuses) is the run's error, in Agent37's words.
|
|
2105
|
+
The hash is `box/recipe.mjs`'s, read from the `box/` folder this package ships, so a server asks for the image its own
|
|
2106
|
+
release published.
|
|
2046
2107
|
|
|
2047
2108
|
Why not Agent37's own `agent37-ubuntu`, which ships a desktop: its image (`ghcr.io/agent37-platform/ubuntu:2026.10.13c`,
|
|
2048
2109
|
entrypoint `images/vm/ubuntu/entrypoint.sh` of agent37-platform/templates) runs `Xtigervnc :1 ... -ac` as root, with
|
|
@@ -2172,7 +2233,7 @@ and are never in a ref, a list, an error's words or a report. `client` stays a `
|
|
|
2172
2233
|
| a computer is | a session (`POST /v1/sessions`, `keepAlive: true`) | a browser (`POST /browsers`) |
|
|
2173
2234
|
| 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` |
|
|
2174
2235
|
| 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 |
|
|
2175
|
-
| groups (`
|
|
2236
|
+
| groups (the descriptor's `capabilities`) | `cdp`, `stream` | `cdp`, `stream` |
|
|
2176
2237
|
| test connection | one `GET /v1/sessions?status=RUNNING` | one `GET /browsers?status=active` page |
|
|
2177
2238
|
| release | `REQUEST_RELEASE`, then read back until it is no longer `RUNNING` or `PENDING` | `DELETE`, then read back until 404 or `deleted_at` |
|
|
2178
2239
|
| options | `apiKey`, `projectId`, `apiUrl`, `fetch` | `apiKey`, `apiUrl`, `fetch` |
|
|
@@ -2451,6 +2512,12 @@ optional screen screenshot-size - 1
|
|
|
2451
2512
|
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
|
|
2452
2513
|
```
|
|
2453
2514
|
|
|
2515
|
+
A hosted vendor runs the exec pre-check first, with `--exec-stream --machine <id> [--quick]`: the module's
|
|
2516
|
+
`createHost(options)` and `host.exec` alone, on a machine made by hand, checked for a live, two-way, byte-exact stream
|
|
2517
|
+
with no timeout (`src/conformance/exec-stream.ts`; [the contract](../../spec/computer/provider.md#a-hosted-vendors-exec)).
|
|
2518
|
+
It exits 0 when every check passes and 1 when one fails, and `--json` prints `{ host, machine, checks: [{ id, status,
|
|
2519
|
+
words, ms }], pass }`.
|
|
2520
|
+
|
|
2454
2521
|
An id is resolved through the provider registry, and only there; the usage lists every id it holds. A module path is
|
|
2455
2522
|
resolved from the directory npm was run in. It exits 0 when Core passes, 1 when it fails, 2 on a
|
|
2456
2523
|
usage error, and 3 on a partial run; `--json` prints the report object (`{ provider, providerVersion, kind,
|
|
@@ -2529,6 +2596,12 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2529
2596
|
DNS name): every target must read `refused`, and the probe's `interfaces` must be `["lo"]`. So it proves, per
|
|
2530
2597
|
provider, that a tool reaches neither the vendor's agent nor any address. A provider that declares nothing (Docker:
|
|
2531
2598
|
no agent inside) skips it in words.
|
|
2599
|
+
- **What root runs** (`isolation.root-runs`, Core wherever exec runs): through `exec.run`, as the computer's user, the
|
|
2600
|
+
case reads `test -w` on root's `PATH` directories, the daemon, the Archil helper and client, the vendor's agent and
|
|
2601
|
+
init's table where an image has them, and every directory above each (`ROOT_RUNS`), and fails on any it may write. A
|
|
2602
|
+
path on a read-only mount is closed (BusyBox's `test -w` reads the mode bits alone, so the case reads the mount's
|
|
2603
|
+
options too). It checks write access alone and changes nothing.
|
|
2604
|
+
`mount.archil-isolated-durable` runs the same check on its Archil computer.
|
|
2532
2605
|
- **Core by kind.** `coreGroups(kind, daemon)` is what a computer of its kind must declare (the table in
|
|
2533
2606
|
[The protocol extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)): exec, files,
|
|
2534
2607
|
processes and network `none` wherever computerd runs, screen and keyboard and pointer on a desktop, screen and touch
|
|
@@ -2680,7 +2753,7 @@ it is declared (`descriptorProblems`), in words. Its fields: `id`, `label`, `key
|
|
|
2680
2753
|
fills, and whether it is required), `settings` (a setting that is no key but fills an option, with its default),
|
|
2681
2754
|
`metered`, `mounts`, `network` (the network forms its computers make, at least one of none, open and allow),
|
|
2682
2755
|
`capabilities` (the kind and groups of each configuration), `defaultImage` (by setting kind),
|
|
2683
|
-
`prepareImage` (a provider
|
|
2756
|
+
`prepareImage` (a provider whose `prepareImage()` answers its image before a run: it builds, pulls or names it), `imageEnv` (the server's environment variable
|
|
2684
2757
|
that, when set, names the image of every computer of the provider, as Daytona's `AGENTRUN_DAYTONA_SNAPSHOT`), `local`
|
|
2685
2758
|
(a computer on this host), and
|
|
2686
2759
|
`ledger` (the option a provider's ledger fills). `providerFor(id, options)` builds a provider by id from its options and
|
|
@@ -2688,7 +2761,6 @@ refuses an id it does not hold, naming the ones it does. The provider file, `src
|
|
|
2688
2761
|
`ProviderModule` is:
|
|
2689
2762
|
|
|
2690
2763
|
- the provider class, which implements `ComputerProvider` and reports the registry id as its `id`;
|
|
2691
|
-
- `MOUNT`, the mount kinds its computers take;
|
|
2692
2764
|
- `create(options)`, the provider built from its options alone, its key included, and refused in words when one is
|
|
2693
2765
|
missing or wrong, never echoing a key. It reads no environment (see [Settings](#settings)), and exports no names of
|
|
2694
2766
|
variables;
|
|
@@ -2716,9 +2788,15 @@ npm run conformance -w @parcha/agentrun-computer -- --provider fly
|
|
|
2716
2788
|
|
|
2717
2789
|
```sh
|
|
2718
2790
|
npm run build -w @parcha/agentrun-computer # the TypeScript, into dist/
|
|
2719
|
-
npm run build:daemon -w @parcha/agentrun-computer # dist/computerd-linux-amd64 and -arm64
|
|
2791
|
+
npm run build:daemon -w @parcha/agentrun-computer # dist/computerd-linux-amd64 and -arm64, and dist/computerd.json
|
|
2720
2792
|
```
|
|
2721
2793
|
|
|
2794
|
+
`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
|
|
2795
|
+
`dist/computerd.json`. Without Go, it takes both binaries from this version's package on npm, but only when that
|
|
2796
|
+
package's `computerd.json` names the same daemon source as the checkout (`scripts/daemon-source.mjs`); otherwise it
|
|
2797
|
+
stops and says to install Go. Each release carries the record, so a checkout of a released version needs no Go until
|
|
2798
|
+
its daemon changes.
|
|
2799
|
+
|
|
2722
2800
|
## Tests
|
|
2723
2801
|
|
|
2724
2802
|
```sh
|
|
@@ -2726,8 +2804,8 @@ npm test -w @parcha/agentrun-computer # unit tests: no Go, no Dock
|
|
|
2726
2804
|
cd packages/computer/daemon && go vet ./... && go test ./...
|
|
2727
2805
|
AGENTRUN_COMPUTER_LIVE_DOCKER=1 npm run test:docker -w @parcha/agentrun-computer
|
|
2728
2806
|
AGENTRUN_COMPUTER_LIVE_DAYTONA=1 COMPUTER_DAYTONA_API_KEY=... [COMPUTER_DAYTONA_SNAPSHOT=<snapshot>] npm run test:daytona -w @parcha/agentrun-computer
|
|
2729
|
-
AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal -w @parcha/agentrun-computer # also needs COMPUTER_MODAL_TOKEN_ID/SECRET,
|
|
2730
|
-
AGENTRUN_COMPUTER_LIVE_E2B=1 npm run test:e2b -w @parcha/agentrun-computer # also needs COMPUTER_E2B_API_KEY,
|
|
2807
|
+
AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal -w @parcha/agentrun-computer # also needs COMPUTER_MODAL_TOKEN_ID/SECRET, for an account you can bill
|
|
2808
|
+
AGENTRUN_COMPUTER_LIVE_E2B=1 npm run test:e2b -w @parcha/agentrun-computer # also needs COMPUTER_E2B_API_KEY, for an account you can bill, and the e2b package
|
|
2731
2809
|
```
|
|
2732
2810
|
|
|
2733
2811
|
`npm test` also runs `test/local-chrome-live.test.mjs` on a real Chrome where one is on PATH (or `CHROME_PATH` names
|
|
@@ -2766,7 +2844,10 @@ capabilities.
|
|
|
2766
2844
|
container of the desktop fixture's image, starts Xvfb through the daemon on the display init was given and waits for
|
|
2767
2845
|
hello to declare the screen, and checks that `deadline.extend` moves up to `--max-deadline` and no further. The
|
|
2768
2846
|
programs the daemon starts get no `DISPLAY` of init's (it passes on only PATH, HOME, USER and LOGNAME): a caller that
|
|
2769
|
-
starts a GUI program gives it `DISPLAY` in the request's `env`, on E2B as on Docker.
|
|
2847
|
+
starts a GUI program gives it `DISPLAY` in the request's `env`, on E2B as on Docker. The surface is that caller for an
|
|
2848
|
+
agent: on a desktop whose hello names a display, `shell.run` and `processes.start` add it under the call's own `env`.
|
|
2849
|
+
`processes.start` is `process.start` with `orphans: "keep"`, so an app (or the app a launcher forks) stays open after
|
|
2850
|
+
the call, where `exec.run`'s guard ends everything its command started.
|
|
2770
2851
|
|
|
2771
2852
|
## Acknowledgements
|
|
2772
2853
|
|