@parcha/agentrun-computer 0.1.0-beta.37 → 0.1.0-beta.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +259 -203
  2. package/box/Dockerfile +18 -1
  3. package/box/README.md +13 -0
  4. package/box/build-agent37.mjs +8 -27
  5. package/box/build-daytona.py +2 -2
  6. package/box/build-e2b.mjs +41 -18
  7. package/box/recipe.mjs +43 -0
  8. package/dist/agent37-ssh.d.ts +89 -0
  9. package/dist/agent37-ssh.js +445 -0
  10. package/dist/agent37.d.ts +2 -63
  11. package/dist/agent37.js +104 -461
  12. package/dist/browserbase.d.ts +0 -6
  13. package/dist/browserbase.js +1 -5
  14. package/dist/client.d.ts +12 -3
  15. package/dist/client.js +39 -4
  16. package/dist/computerd-linux-amd64 +0 -0
  17. package/dist/computerd-linux-arm64 +0 -0
  18. package/dist/computerd.json +4 -0
  19. package/dist/conformance/cases/apps.d.ts +6 -0
  20. package/dist/conformance/cases/apps.js +18 -5
  21. package/dist/conformance/cases/isolation.d.ts +7 -5
  22. package/dist/conformance/cases/isolation.js +44 -14
  23. package/dist/conformance/cases/mount.js +1 -1
  24. package/dist/conformance/cli.js +66 -6
  25. package/dist/conformance/daytona.d.ts +9 -20
  26. package/dist/conformance/daytona.js +12 -21
  27. package/dist/conformance/exec-stream.d.ts +45 -0
  28. package/dist/conformance/exec-stream.js +486 -0
  29. package/dist/conformance/sweep.js +8 -8
  30. package/dist/conformance/types.d.ts +2 -2
  31. package/dist/create-requests.d.ts +1 -1
  32. package/dist/daytona.d.ts +20 -131
  33. package/dist/daytona.js +405 -1450
  34. package/dist/descriptor.d.ts +6 -1
  35. package/dist/descriptor.js +7 -0
  36. package/dist/descriptors/agent37.d.ts +1 -1
  37. package/dist/descriptors/agent37.js +1 -1
  38. package/dist/descriptors/daytona.d.ts +6 -5
  39. package/dist/descriptors/daytona.js +9 -5
  40. package/dist/descriptors/index.d.ts +4 -5
  41. package/dist/descriptors/shared.d.ts +1 -1
  42. package/dist/descriptors/shared.js +2 -2
  43. package/dist/desktop.d.ts +18 -4
  44. package/dist/desktop.js +89 -9
  45. package/dist/docker.d.ts +0 -6
  46. package/dist/docker.js +1 -5
  47. package/dist/drift.js +4 -4
  48. package/dist/e2b.d.ts +10 -128
  49. package/dist/e2b.js +130 -233
  50. package/dist/host.d.ts +106 -87
  51. package/dist/host.js +8 -1
  52. package/dist/hosted/process.d.ts +22 -8
  53. package/dist/hosted/process.js +75 -44
  54. package/dist/hosted/provider.d.ts +35 -21
  55. package/dist/hosted/provider.js +312 -261
  56. package/dist/hosted/rest.d.ts +66 -0
  57. package/dist/hosted/rest.js +121 -0
  58. package/dist/hosted/scripts.d.ts +8 -2
  59. package/dist/hosted/scripts.js +27 -2
  60. package/dist/hosted/values.d.ts +5 -0
  61. package/dist/hosted/values.js +8 -0
  62. package/dist/index.d.ts +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/kernel.d.ts +0 -6
  65. package/dist/kernel.js +1 -5
  66. package/dist/kinds.d.ts +3 -1
  67. package/dist/local-chrome.d.ts +0 -6
  68. package/dist/local-chrome.js +1 -5
  69. package/dist/modal.d.ts +7 -84
  70. package/dist/modal.js +50 -174
  71. package/dist/mount-archil.d.ts +8 -4
  72. package/dist/mount-archil.js +22 -11
  73. package/dist/mount.d.ts +10 -4
  74. package/dist/mount.js +8 -4
  75. package/dist/orgo.d.ts +0 -9
  76. package/dist/orgo.js +2 -9
  77. package/dist/phone-harness.d.ts +0 -6
  78. package/dist/phone-harness.js +0 -4
  79. package/dist/protocol.d.ts +4 -1
  80. package/dist/protocol.js +1 -0
  81. package/dist/provider.d.ts +2 -2
  82. package/dist/providers.d.ts +11 -12
  83. package/dist/screen-watch.js +34 -6
  84. package/dist/surface/api.d.ts +14 -2
  85. package/dist/surface/core.d.ts +16 -3
  86. package/dist/surface/core.js +95 -13
  87. package/dist/surface/outline.d.ts +2 -0
  88. package/dist/surface/outline.js +2 -1
  89. package/dist/surface/script.js +2 -0
  90. package/dist/ui-engine.js +19 -3
  91. package/package.json +2 -3
  92. package/dist/conformance/daytona-sweep.d.ts +0 -18
  93. 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 file's `MOUNT`, read with `(await providerModule(id)).MOUNT`,
25
- which loads that one provider's file and the protocol modules it uses, and no other provider.
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 Daytona sweep. At 0.1.0-beta.31 (`npm pack
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` and `input.actions`, and reports kind `desktop` with `screen`, `input.pointer` and
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"}}
@@ -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. `--user 0:0` is root with no capability. Without
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
@@ -176,11 +178,17 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
176
178
  as root in a container by hand: `internal/isolate`'s and the isolated `TestBecome...` need CAP_SYS_ADMIN and
177
179
  CAP_NET_ADMIN (`docker run --cap-add SYS_ADMIN --cap-add NET_ADMIN`), and the refusal without them a container
178
180
  with Docker's defaults.
179
- - `computerd probe [--connect <host:port>[/udp]]...` prints one JSON line: the uid and gid it runs as, the kernel's
180
- release, `interfaces` (the network interfaces its network namespace holds: `["lo"]` alone under `--own-network`),
181
- `reached` (the targets that answered), `accepted` (the targets that accepted a TCP connection and sent nothing back)
182
- and `results`, each target's `protocol`, `outcome` (`refused`, `accepted` or `answered`), `bytes` and `detail` in
183
- words. A provider whose vendor reads nothing back runs it through `exec.run` (below, Modal), under the rule in
181
+ - `computerd probe [--sockets] [--connect <host:port>[/udp]]...` prints one JSON line: the uid and gid it runs as, the
182
+ kernel's release, `interfaces` (the network interfaces its network namespace holds: `["lo"]` alone under
183
+ `--own-network`), `reached` (the targets that answered), `accepted` (the targets that accepted a TCP connection and
184
+ sent nothing back) and `results`, each target's `protocol`, `outcome` (`refused`, `accepted` or `answered`), `bytes`
185
+ and `detail` in words. With `--sockets` it adds the isolation case's two listings: `sockets`, the unix sockets it can
186
+ connect to, by path or by abstract name (`@...`, which its network namespace holds), and `listeners`, the TCP and UDP sockets that listen in its own network namespace (TCP in
187
+ LISTEN and UDP bound with no peer, read from `/proc/net/tcp`, `tcp6`, `udp` and `udp6`), each with its `protocol`,
188
+ `address`, `port`, `uid`, the `owner` that holds it (`pid N (command)`, where `/proc` shows that process's
189
+ descriptors) and `computerd` (that owner runs computerd's own program); each listing names in `incomplete` what it
190
+ could not search or read. `isolation.vendor-agent` fails on a listener that is not computerd's; under `--own-network`
191
+ computerd listens on nothing there, so on any listener. A provider whose vendor reads nothing back runs it through `exec.run` (below, Modal), under the rule in
184
192
  [Network none, read from inside](#network-none-read-from-inside-nothing-answers). `computerd probe --diagnose` asks
185
193
  more: for 1.1.1.1, 8.8.8.8, 9.9.9.9 and 151.101.1.57 (Fastly's anycast edge, which is no resolver) on 443/tcp,
186
194
  80/tcp and 53/udp it reports `refused` (no TCP accept, no UDP answer), `accepted` (an accept, no answer) or
@@ -431,7 +439,7 @@ in the kernel's tool registry, keyed by these groups.
431
439
  | id | label | kinds | keys (required unless marked) | mounts | metered |
432
440
  | --- | --- | --- | --- | --- | --- |
433
441
  | docker | Docker | sandbox, desktop | none | bind | no |
434
- | daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET`, `DAYTONA_ARCHIL_EGRESS` (optional) | archil | yes |
442
+ | daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET` (optional) | none (`unmounted`: archil) | yes |
435
443
  | modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
436
444
  | e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
437
445
  | orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
@@ -440,9 +448,8 @@ in the kernel's tool registry, keyed by these groups.
440
448
  | kernel | Kernel | browser | `KERNEL_API_KEY` | none | yes |
441
449
  | local | Local Chrome | browser | none | none | no |
442
450
 
443
- - Each provider module exports `CAPABILITIES` beside `MOUNT` (the registry's contract, `ProviderModule`). A unit test
444
- holds every registry provider's `CAPABILITIES` and `MOUNT` to its entry, and each provider built from the test fakes,
445
- in each configuration, to its entry's capabilities. browserbase and kernel are data until their provider file joins
451
+ - A provider's capabilities and mounts are its descriptor's, and nowhere else. A unit test holds each provider built
452
+ from the test fakes, in each configuration, to its entry's capabilities and mounts. browserbase and kernel are data until their provider file joins
446
453
  the registry; that test then holds each to its file.
447
454
  - `testConnection()` (optional on `ComputerProvider`) is Settings' test of a provider's keys: ONE account-level read
448
455
  that never creates a computer, so it never spends. Docker (one `docker ps`), Daytona and E2B (one listing page) count
@@ -480,7 +487,7 @@ the screen (`provider.stream()`), the files a browser saved. A computerd hello n
480
487
 
481
488
  **Daemon mode.** `capabilities().daemon` says who answers the methods. `pid1`: computerd init is the computer's main
482
489
  process, so its exit ends the computer (Docker). `child`: the vendor's own agent is the main process and starts init at
483
- boot; init's exit does not end the computer (Daytona, whose toolbox daemon runs init as a session command), and it
490
+ boot; init's exit does not end the computer (Daytona, whose toolbox daemon starts init detached), and it
484
491
  must not run under a supervisor that restarts it. `none`: no computerd runs, and the provider answers the same methods
485
492
  itself, from our server (adb, a vendor API). Either way a connection's `client` is a `ComputerClient` (`call(method,
486
493
  params, { signal })` and `close()`): `DaemonClient` over a stream, or a provider's in-process client.
@@ -492,7 +499,7 @@ provider declares, either way.
492
499
 
493
500
  | group | methods |
494
501
  | --- | --- |
495
- | `screen` | `screen.shot({ region? })`: a PNG (8-bit, non-interlaced), its first `MAX_CHUNK_BYTES` in `data`, with `width`, `height` (the image's pixels, the input coordinate space, never downscaled), `scale` and `cursor?`; `screen.read({ id, offset })` for the rest. One shot is held, until its eof or the next shot. `screen.watch({ after, waitMs?, maxWidth?, quality? })`: the live view's frames, paced by the caller's ack (`after`, the seq of the last frame it has whole; an older one gets the newest frame at once): the next frame once the screen or the pointer changed, else `changed: false` when `waitMs` (default 2000, at most 10000) is over. A frame is `{ seq, changed, format, frameWidth, frameHeight, width, height, cursor? }` and its bytes as a shot's (`data`, `id` and `screen.read`); `format` is `jpeg` from computerd (scaled to `maxWidth`, default 1280, at `quality`, default 60) and `png` from the phone client. One watch per connection. |
502
+ | `screen` | `screen.shot({ region? })`: a PNG (8-bit, non-interlaced), its first `MAX_CHUNK_BYTES` in `data`, with `width`, `height` (the image's pixels, the input coordinate space, never downscaled), `scale` and `cursor?`; `screen.read({ id, offset })` for the rest. One shot is held, until its eof or the next shot. `screen.watch({ after, waitMs?, maxWidth?, quality? })`: the live view's frames, paced by the caller's ack (`after`, the seq of the last frame it has whole; an older one gets the newest frame at once; on a computer whose hello lists `screen.ahead`, one past the newest waits as the newest does, so two asks can be in flight): the next frame once the screen or the pointer changed, else `changed: false` when `waitMs` (default 2000, at most 10000) is over. Computerd on a desktop learns what changed from the X server's DAMAGE extension and gives at most 15 frames a second; on an X server without DAMAGE, `screen.watch` is refused, `unsupported`, in words. A frame is `{ seq, changed, format, frameWidth, frameHeight, width, height, cursor? }` and its bytes as a shot's (`data`, `id` and `screen.read`); `format` is `jpeg` from computerd (scaled to `maxWidth`, default 1280, at `quality`, default 60) and `png` from the phone client. One watch per connection. |
496
503
  | `input.pointer` | `input.actions`: `move`, `down`, `up`, `click` (`count` 1-3, held `keys`), `drag` (a path of 2 or more points), `scroll` (`unit` clicks or px) |
497
504
  | `input.keys` | `input.actions`: `key` (one key pressed, or a combo released in reverse; `repeat`), `hold` (`ms`), `type` |
498
505
  | `input.touch` | `input.actions`: `tap`, `long_press`, `swipe`, `pinch` (`scale` above 1 apart, below together), `button` (back, home, app_switch) |
@@ -512,7 +519,9 @@ provider declares, either way.
512
519
  `daemonWatch` is the one implementation behind every provider's `watch()` (Docker, Daytona, Modal, E2B, Orgo, the
513
520
  phone harness): a computer whose hello has no `screen` is refused as `unsupported`. It adapts the internal seam,
514
521
  `watchScreen(connection, options)`: pull-paced `frames` (each `next()` the ack), `act(actions)` and `close()`, whose
515
- failures are `ScreenWatchError`s. `toAction(event, kind)` maps the viewer's `ViewerEvent`s, in the screen's upright
522
+ failures are `ScreenWatchError`s. On a computer that lists `screen.ahead` it keeps a second ask in flight, one frame
523
+ ahead, so frames come at the screen's pace and not one each round trip; a frame bettered before `next()` asked for it
524
+ is dropped. `toAction(event, kind)` maps the viewer's `ViewerEvent`s, in the screen's upright
516
525
  pixels, to input actions, or to a `Refusal` (`{ field, message }`) for what a kind cannot take:
517
526
  - a desktop takes the mouse (a move, and a button down or up at a point; with a modifier held, the up is one click
518
527
  with its keys and the down only moves; each up is one click, so a double-click is two and never a `count`), the
@@ -583,11 +592,26 @@ by its rectangle), so a longer one ends the connection before anything is alloca
583
592
  `aborted`.
584
593
 
585
594
  - The display is reached when it is first asked for, and again after it goes: hello declares `screen`,
586
- `input.pointer` and `input.keys`, and kind `desktop`, only while the display answers with XTEST. So a provider may
587
- start its X server through `process.start` after init is up. With no display (`DISPLAY` unset, nothing answering, no
588
- XTEST) nothing is declared, and each method is `unsupported`, saying why.
595
+ `input.pointer`, `input.keys` and `apps`, and kind `desktop`, only while the display answers with XTEST. So a
596
+ provider may start its X server through `process.start` after init is up. With no display (`DISPLAY` unset, nothing
597
+ answering, no XTEST) nothing is declared, and each method is `unsupported`, saying why.
589
598
  - Programs get no `DISPLAY` from the daemon (exec and process environments stay minimal): one that should show on the
590
- display is given it in `env`.
599
+ display is given it in `env`. An app the `apps` group opens is given it.
600
+ - `apps` (`daemon/internal/apps`) answers as a Mac's does, the same methods and the same answers. `apps.list` reads the
601
+ desktop files of `$XDG_DATA_HOME/applications` and each of `$XDG_DATA_DIRS` (default `~/.local/share`, then
602
+ `/usr/local/share` and `/usr/share`), as the Desktop Entry spec says: the apps there are, by their desktop file ids
603
+ (`org.xfce.mousepad`), with their names; hidden and `NoDisplay` entries, and a `TryExec` that is not there, are left
604
+ out. Its `foreground` is the app of the window manager's active window, else of the top window. `apps.launch({ id,
605
+ url? })` takes an id, a name (`Mousepad`) or a program (`mousepad`), starts the entry's `Exec` (`url` in its `%u`/`%f`
606
+ field; an entry with none refuses a `url` as `invalid`) as `process.start` does with orphans `keep`, with `DISPLAY`,
607
+ and answers `{}` once a new window of the app shows, raised and focused (through the window manager's
608
+ `_NET_ACTIVE_WINDOW` when one runs, waiting up to 2 s for it to be the active window), so keys typed right after
609
+ reach it; none within 10 s is `timeout`, "no window within 10 s", and the app runs on. An
610
+ app already running with a window is brought to the front and answers at once, unless a `url` is given. A
611
+ window is the app's by the launch that made it (`_NET_WM_PID` and the process's parents), else by its `WM_CLASS`
612
+ (the entry's `StartupWMClass`, its id's last part or its program). `background` is `unsupported`: a Linux desktop
613
+ opens an app in front. `apps.terminate` sends TERM, then KILL, to the app's launches and its windows' processes, and
614
+ answers once none of its windows shows and none of its launches runs, a launch that never showed a window included.
591
615
  - `screen.shot` is a PNG of the root window or a region inside it (one outside is `invalid`), with `scale` 1 and
592
616
  `cursor` from `QueryPointer`. A connection holds one shot, until it is read to its end or the next shot; a
593
617
  `screen.read` of another id is `not_found`.
@@ -682,12 +706,12 @@ was deleted.
682
706
 
683
707
  - `capabilities()` declares kind `linux`, daemon `pid1`, groups `exec`, `files` and `processes`, `maxLifetimeMs`
684
708
  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` and
686
- `input.keys` too, on an image with an X server (`test/fixtures/desktop/Dockerfile` is Alpine and Xvfb, 48 MB).
709
+ - `new DockerProvider({ daemonPath, desktop: {} })` makes desktops: kind `desktop`, with `screen`, `input.pointer`,
710
+ `input.keys` and `apps` too, on an image with an X server (`test/fixtures/desktop/Dockerfile` is Alpine, Xvfb and xterm, the stock app `apps.launch-terminate` opens, about 50 MB).
687
711
  `create` gives the daemon `DISPLAY` (`display`, default `:0`), then starts the X server through it with
688
712
  `process.start` (`server`, default `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp`), as the computer's user and as any
689
713
  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;
714
+ the computer. It runs no window manager. `create` waits (`timeoutMs`, default 30 s) until hello declares the display, then runs the drift check;
691
715
  a server that ends first, with its last words on stderr, or a display that is not up in time deletes the computer in
692
716
  words.
693
717
  - `check(spec)` refuses in words, with no Docker call: no image, no or a bad `lifetimeMs` (`checkLifetime`: at most
@@ -866,9 +890,9 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
866
890
  - `ComputerSpec.mount` is `{ kind: "bind", path }`, a folder on the provider's host bound in (the local Docker
867
891
  computer), or `{ kind: "archil", disk, region, folder, token }`, the run's folder (such as
868
892
  `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 file also exports
870
- `MOUNT` beside its `create`, the same kinds (Docker `["bind"]`; Modal and Daytona `[]` for now), so a caller tells which
871
- provider binds a local folder from the registry (`providerModule(id)`) without building one.
893
+ `capabilities().mount` lists the kinds a provider takes; absent, it takes none. Each provider's descriptor declares
894
+ the same kinds as `mounts` (Docker `["bind"]`; Modal and E2B `["archil"]`; Daytona `[]` for now), so a caller tells
895
+ which provider binds a local folder from its descriptor (`descriptorOf(id)`) without building one.
872
896
  - `checkMount(mount, declared)` (`src/mount.ts`) is the one rule every provider's `check` runs, with no vendor call: a
873
897
  kind the provider does not declare is refused in words (`this provider does not take a mount of kind archil; it takes
874
898
  bind`); a bind's `path` is absolute, canonical (its own realpath, so what is read back is what is bound: Docker
@@ -881,7 +905,7 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
881
905
  `{ other: "<words>" }` for a mount at `/workspace` the provider never makes. An Archil mount's `epoch` is the
882
906
  computer's `agentrun.epoch` label (Archil's hold on a folder carries none); an Archil mount with no epoch reads back
883
907
  as `{ other }`, in words. The token is never in a label, a read-back or an error.
884
- - **An Archil egress gateway (Daytona, `archilEgress` / `DAYTONA_ARCHIL_EGRESS`).** For a target whose runners reach
908
+ - **An Archil egress gateway (`HostedOptions.archilEgress`).** For a target whose runners reach
885
909
  Archil only through a gateway, `<IPv4 gateway>:<mount lane>:<data lane>` (such as `10.60.0.40:18100:42050`, parcha-proxy's
886
910
  archil-egress). The helper's mount then starts `computerd archil-relay` on the computer's loopback (127.0.0.1:3129) and
887
911
  an nftables table of its own (`inet agentrun_archil`) that redirects root's TCP to 8100 (the mount endpoint) and 32050
@@ -1172,9 +1196,8 @@ reads at once, then after pauses that double from `minMs` (250 ms) to `maxMs` (5
1172
1196
  returns the first state `done` accepts. Each read gets a signal that aborts at the bound or on the caller's abort; a
1173
1197
  read still pending then is not waited for, and one that throws is not done. Past the bound it returns a `timeout`, on
1174
1198
  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 (`settleGone`, until a machine reads
1176
- gone and is no longer listed); Daytona's release, a create that deletes its sandbox, and the Daytona sweep wait through
1177
- it too.
1199
+ vendor's types: the shared adapter's release, a create that deletes its machine, and the one live sweep wait through it
1200
+ (`settle`, until get answers none for a machine twice running; one read `gone` is still going), for every hosted vendor.
1178
1201
 
1179
1202
  ## Modal
1180
1203
 
@@ -1191,7 +1214,7 @@ const made = await modal.create({ image: "debian:bookworm-slim", lifetimeMs: 600
1191
1214
  ```
1192
1215
 
1193
1216
  Modal runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/modal.ts` is Modal's `MachineHost`,
1194
- its SDK slice (`ModalSdk`: apps, images, sandboxes and five methods of a sandbox) and the client it is made with, and
1217
+ the SDK's types (`import type`, erased at build) and the client it is made with, and
1195
1218
  `src/hosted/provider.ts` does everything below that is not Modal's own. `create` takes the caller's request id
1196
1219
  (`{ requestId }`, serve's is the run's claim): the computer's name is `computer-` and the first 12 hex digits of its
1197
1220
  sha256, and a retry of the same request finds the computer the first made instead of making a second. A Modal sandbox
@@ -1241,12 +1264,11 @@ runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests
1241
1264
  `workdir` are refused: Modal has no pids limit, and a computer works in `/work`, its home.
1242
1265
  - **Tags.** A sandbox's tags are the adapter's labels (`agentrun.computer`, its name, deadline, image and the most its
1243
1266
  deadline may reach) and the caller's, so a computer takes at most 5 labels of its caller's (Modal's 10 tags). Modal
1244
- holds a sandbox's tags to 512 bytes, names and values together: `check()` counts them and refuses past it in words.
1245
- An Archil computer's mount label names its folder, `agents/<agent>/runs/<run>/work`, whose run is the `agentrun.run`
1246
- label's, so the tag records the agent alone and the host reads the folder back from it (`tagsOf`, `labelsOf`).
1247
- `list` is `sandboxes.list({ appId, tags })` over the provider's app: running sandboxes only, and one Modal still
1267
+ holds a sandbox's tags to 512 bytes, names and values together (`labelRules.maxBytes`): the adapter's `check()`
1268
+ counts them, its own at their longest, and refuses past it in words. An Archil computer's mount label records the
1269
+ folder's agent alone, as on every host: the folder's run is the `agentrun.run` label's. `list` is `sandboxes.list({ appId, tags })` over the provider's app: running sandboxes only, and one Modal still
1248
1270
  lists after its terminate is polled and left out once `poll()` reads it finished.
1249
- - **release** `delete` is `terminate()`, and the adapter waits until the sandbox reads gone and is no longer listed.
1271
+ - **release** `delete` is `terminate()`, and the adapter waits until get answers none (`poll()` reads it finished).
1250
1272
  `stop` is refused as `unsupported`: terminate is a sandbox's only end.
1251
1273
  - **GPU.** `capabilities().gpu` declares Modal's GPU types by its own names (guide/gpu): `T4`, `L4`, `A10`, `L40S`,
1252
1274
  `A100` (40 GB), `A100-40GB`, `A100-80GB`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B300`, at most 8 to a computer.
@@ -1258,8 +1280,8 @@ runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests
1258
1280
  `--own-network`, makes its programs' network namespace inside a user namespace (the daemon's fallback, any vendor).
1259
1281
  Declared: `gpu.fence: "userns-netns"`; read back: hello's `fence`, and create notes it. Proven in Docker
1260
1282
  (`test/docker/pid1-commands.docker.test.mjs` and `loopback-block.docker.test.mjs`), not yet live on Modal.
1261
- - **Settings' test** reads the app with `createIfMissing: false`, which makes nothing; an app not made yet is a
1262
- connection all the same.
1283
+ - **The app.** `list` (and so Settings' test, one listing) reads the app with `createIfMissing: false`, which makes
1284
+ nothing: an app not made yet lists no sandboxes and is a connection all the same. Only `create` makes the app.
1263
1285
 
1264
1286
  ### What every Modal fact rests on
1265
1287
 
@@ -1354,19 +1376,25 @@ const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, n
1354
1376
  ```
1355
1377
 
1356
1378
  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 run against a fake.
1379
+ one. `fetch` and the WebSocket factory are options, so the tests hand them a recorder. The provider is a `MachineHost`
1380
+ on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): Daytona's own calls are here, and the lifecycle
1381
+ around them (the computer's name from the create's request id, the daemon's install and start, the probe, the listing
1382
+ wait, release's wait for gone) is the adapter's, the same for every hosted vendor.
1358
1383
  The key is the caller's to pass: the provider never reads the environment, never sends the key over a redirect or to a
1359
1384
  toolbox URL that is not https, and never puts it in a computer. `image` is a Daytona snapshot, by id or name: the
1360
1385
  snapshot gives the sandbox its class and its size. `image: "default"` sends no snapshot field at all, and Daytona makes
1361
1386
  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.) Daytona reports only the snapshot it resolved, by its own name, so create records the
1363
- image it was asked for in the label `agentrun.computer.image`, beside the deadline's in the provider's own namespace,
1364
- and attach reports that as `image` and the resolved snapshot apart, as `snapshot`.
1387
+ `default` is reached by its id.) Create records the image it was asked for in the label `agentrun.computer.image`,
1388
+ beside the deadline's in the provider's own namespace, and attach reports that as `image`.
1389
+
1390
+ Daytona takes no mount of the run's folder: Archil's client hangs on its sandboxes (its FUSE session never answers a
1391
+ `statx` of the mountpoint), so `capabilities().mount` is `[]` and `check()` refuses an Archil mount up front, code
1392
+ `refused`, in the descriptor's `unmounted.archil` words, before anything is asked of Daytona.
1365
1393
 
1366
1394
  ### Lifetimes
1367
1395
 
1368
- Every sandbox ends at its TTL (`ttlMinutes`, from `lifetimeMs`). Two options bound it further, each sent on every create
1369
- and read back by the drift check:
1396
+ Every sandbox ends at its TTL (`ttlMinutes`, from `lifetimeMs`). Two options bound it further, each sent on every
1397
+ create:
1370
1398
 
1371
1399
  | Option | Daytona field | Meaning | Unset |
1372
1400
  | --- | --- | --- | --- |
@@ -1375,20 +1403,21 @@ and read back by the drift check:
1375
1403
 
1376
1404
  Each is a whole number, 0 or more; the constructor refuses anything else in words. Daytona's idle timer counts toolbox
1377
1405
  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. With `autoDeleteMinutes: 0` a stop deletes: the provider then keeps no stopped computer,
1379
- declares `stopDeletes: true`, `release(ref, "stop")` returns once the sandbox is gone, and `list()` never shows a
1380
- stopped one.
1406
+ for `autoStopMinutes` stops. A stopped sandbox is still listed, as `stopped`, until Daytona deletes it or the janitor
1407
+ does. The provider itself never stops one: `release` takes `delete` alone and refuses `stop` as `unsupported`.
1381
1408
 
1382
1409
  ### How the daemon gets in, and how it is reached
1383
1410
 
1384
1411
  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 as a long-lived command, and reaches it the same way:
1412
+ So the provider pushes it in at create and starts it, and reaches it the same way. Every command is a session command
1413
+ of its own (`runAsync`, `suppressInputEcho`), its argv one shell line, its output read from the command's log stream,
1414
+ its exit code from the session; the session is deleted once the command ends, or when the provider ends it:
1386
1415
 
1387
1416
  1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random>`:
1388
1417
  `/files/upload-v2`, or `/files/upload` when the toolbox answers 404 for it. An older toolbox, as a self-hosted
1389
1418
  Daytona's runners may run, serves only `/files/upload`, which takes the same form; any other refusal is not retried
1390
1419
  on the older route.
1391
- 2. Install it with `/process/execute` (the command is piped to the sandbox's shell): root-owned, mode 755, at
1420
+ 2. Install it with the shared install script: root-owned, mode 755, at
1392
1421
  `/opt/agentrun/computerd`, and make `/work` (its home) and `/run/agentrun` (its socket's directory). As root, or
1393
1422
  through passwordless `sudo`; a sandbox with neither is refused in the script's words. The script prints the
1394
1423
  installed binary's sha256 (`sha256sum`, BusyBox's or coreutils'), which must be the uploaded one's. It makes
@@ -1397,15 +1426,16 @@ So the provider pushes it in at create and starts it as a long-lived command, an
1397
1426
  and writable by no group and no other user (read with `ls -ldn`, so a symbolic link or an ACL on the way fails it).
1398
1427
  A path that fails is refused in words, with nothing installed. Only root can change an owner or a mode, so the
1399
1428
  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) as a
1401
- session command (`runAsync`) in the session `agentrun-computerd`, as root (through `sudo -n` when the session's user
1402
- is not root), in a clean environment and with `/work` as its directory. Init cuts itself and its programs off from
1429
+ 3. Start `computerd init --deadline <time> --user 2510:2510 --own-network` (`--user` is the `daemonUser` option)
1430
+ detached, in a session of its own (`setsid`), its output to `/run/agentrun-init.log`, as root (through `sudo -n`
1431
+ when the session's user is not root), in a clean environment and with `/work` as its directory. The command that
1432
+ starts it ends at once, and deleting its session leaves init running; a daemon that never answers is reported with
1433
+ the last words of that log. Init cuts itself and its programs off from
1403
1434
  the toolbox (below), then drops itself: it gives `/work` and `/run/agentrun` to the daemon's user (mode 700, never
1404
1435
  through a symbolic link), sets `no_new_privs` and empties the capability bounding set on every thread, so a setuid
1405
1436
  program such as `sudo` cannot raise it, then becomes uid and gid 2510 with no supplementary groups and empties the
1406
1437
  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. The provider never deletes
1408
- that session: deleting it ends init.
1438
+ snapshot's: the first live start failed on the snapshot's `setpriv`, and the daemon's own drop replaced it.
1409
1439
  4. `connect()` starts `computerd stdio` as root the same way, in a session of its own, to reach a socket in a
1410
1440
  directory that is the daemon's user's alone; it only carries bytes. Init and the bridge each check the daemon's
1411
1441
  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 +1443,14 @@ So the provider pushes it in at create and starts it as a long-lived command, an
1413
1443
  (`POST .../input`, whole lines, one call after another), and its stdout is the command's log stream, a WebSocket
1414
1444
  with `follow=true`, in which Daytona prefixes each stdout line with `01 01 01` and each stderr line with `02 02 02`
1415
1445
  (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. `close()` deletes
1417
- the session, which ends the bridge and nothing else.
1446
+ is a request or a notification, never a reply, is dropped in case a toolbox echoes input anyway. An input call
1447
+ Daytona answers with its own 500 (its error body, `"statusCode":500`) is sent again, up to three tries with a
1448
+ doubling pause: that answer comes from an error before the call is passed on, or from the toolbox's input route
1449
+ when it could not open the command's input pipe or its reader is gone (`daytonaio/daytona@b5a5d9e7
1450
+ apps/daemon/pkg/session/input.go`), so the line reached no reader. Nothing else is sent again: a call passed on
1451
+ that then fails is a 502 (`libs/common-go/pkg/proxy/proxy.go`), and after a 502, 503, 504, a timeout or no answer
1452
+ the line may have been read, and a line read twice is a request the daemon runs twice. `close()` deletes the
1453
+ session, which ends the bridge and nothing else.
1418
1454
 
1419
1455
  This is the protocol's first binding, stdio over the vendor's exec stream, assembled from two halves: the session
1420
1456
  command's input and its log stream are each one-way, and together they are the duplex byte stream `DaemonClient`
@@ -1437,7 +1473,11 @@ from (the loopback block):
1437
1473
  neither port 2280 on the loopback nor the sandbox's own address; vsock and io_uring are refused to them; and init
1438
1474
  refuses to start while another process holds their uid, so a toolbox (or a session shell of its) that runs as the
1439
1475
  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. A runner whose root may
1476
+ isolation.vendor-agent probes it from a program of the computer's user, on both loopbacks. Init takes others' access
1477
+ off every socket under `/run`; Daytona's D-Bus session bus sits in `/tmp` (`/tmp/dbus-<10 characters>`, which a
1478
+ program of the computer's user could connect to in the live baseline), so create, as root and before init starts,
1479
+ takes others' access off each socket `/tmp/dbus-*` names (the host's `vendorSockets`), and its notes name the ones
1480
+ it closed. A runner whose root may
1441
1481
  not make a network namespace (no CAP_SYS_ADMIN: a container class on a runner that is not privileged) fails closed:
1442
1482
  init refuses to start, in words, and create deletes the sandbox.
1443
1483
  - The provider still installs and starts the daemon through that toolbox, as root or through passwordless `sudo`, and
@@ -1448,8 +1488,8 @@ from (the loopback block):
1448
1488
  - Network `none` is `networkBlockAll` (Daytona drops what leaves the sandbox on the host) and, beside it, the
1449
1489
  daemon's own namespace. Known gap: `open` and allowlists are refused in words until a proxy carries them out of the
1450
1490
  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 a change to them, and still narrows a computer made
1452
- before (open or a list) to none.
1491
+ cannot be made on Daytona until then. A computer's network is fixed at create: `network()` refuses every change, with
1492
+ `refused`, and asks Daytona nothing.
1453
1493
  - From outside, anyone with the API key can run a command as root in the sandbox through the same toolbox.
1454
1494
 
1455
1495
  Daytona's container class runs code as root, and the open runner runs it privileged.
@@ -1463,88 +1503,75 @@ the TTL.
1463
1503
  | --- | --- | --- |
1464
1504
  | `kind` | `linux` | a Linux shell with computerd: exec, files and processes |
1465
1505
  | `lifetime` | `vendor` | `ttlMinutes` destroys the sandbox in any state once it elapses; set to the lifetime in whole minutes, rounded up. Init also ends every process at the deadline itself. |
1466
- | `network` | `none` | `networkBlockAll`, read back from the sandbox, and the daemon's own network namespace; open and allowlists wait for a proxy out of it (known gap) |
1506
+ | `network` | `none` | `networkBlockAll` at create, and the daemon's own network namespace; open and allowlists wait for a proxy out of it (known gap) |
1467
1507
  | `vendorAgentPorts` | `[2280]` | the toolbox's port, on every interface; isolation.vendor-agent checks a program of the computer's user reaches it on neither loopback |
1468
- | `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot, and is read back |
1508
+ | `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot |
1469
1509
  | `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 runs (below): deleting the session ends init, not the sandbox |
1510
+ | `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is started detached through a session command of it (above) |
1511
+ | `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
1471
1512
  | `groups` | `exec`, `files`, `processes` | the daemon's own, checked against its hello's `groups`, as is its `kind` |
1472
1513
  | `maxLifetimeMs` | 30 days | the cap `check` gives, through the shared `checkLifetime`; Daytona's TTL is whole minutes and documents no cap of its own |
1473
1514
  | `user` | none | the daemon runs as the provider's `daemonUser`; a spec cannot name a user |
1474
- | `release` | `stop`, `delete` | `POST /sandbox/{id}/stop` and `DELETE /sandbox/{id}` |
1475
- | `stopDeletes` | `true` with `autoDeleteMinutes: 0`, else `false` | `autoDeleteInterval` 0 deletes a sandbox as soon as it stops |
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 |
1515
+ | `release` | `delete` | `DELETE /sandbox/{id}`; a stop is refused as `unsupported` |
1516
+ | `gpu` | `H100`; at most 1 | daytona-gpu's own GPU (`DAYTONA_GPU_SNAPSHOT_GPU`, from GET /snapshots/daytona-gpu). A GPU computer is made from Daytona's GPU snapshot `daytona-gpu` (`DAYTONA_GPU_SNAPSHOT`: its default sandbox image, user `daytona` with passwordless sudo, plus the CUDA toolkit), sent as `snapshot`: its spec's image is `"daytona-gpu"` or `"default"`, and `check` refuses any other (a snapshot of box/Dockerfile among them) in words. A Daytona snapshot carries its own resources, so the create sends none (no `cpu`, `gpu`, `gpuType`, `memory` or `disk`: Daytona refuses them beside a snapshot, 400 "Cannot specify Sandbox resources when using a snapshot"), and the read-back's `gpu` and `gpuType` must be the snapshot's. Another type or count needs a snapshot of its own, so `check` refuses it. A GPU computer's limits, declared on `capabilities().gpu`: `preemptible: true` (daytona.io/pricing lists its GPUs as "Preemptible GPU prices": a run on one can be cut short); `stopDeletes: true` (it is made with `autoDeleteInterval: 0`, whatever `autoDeleteMinutes` says. That is Daytona's ephemeral: its SDK's `ephemeral` sets it, and `CreateSandbox` has no `ephemeral` field, so none is sent. A GPU sandbox has no pause and no snapshot, so stopping it deletes it and nothing on it persists); `region: "earth"` (Daytona's one GPU region, sent as `target` in place of the provider's); `perGpu` 16 vCPU, 100 GiB memory and 400 GiB disk, the snapshot's; `mounts: []`, so a GPU computer with any mount is refused in words: Daytona's GPU host gives no `/dev/fuse`, even to root (live 11-11), and the archil client mounts through FUSE. In serve's Mode 2 the run's folder is an Archil mount, so a Daytona GPU sandbox is refused there, and Settings' `gpu.why` says so. The org needs GPU credits, or the create is refused in Daytona's words. Create notes who installed the daemon: daytona-gpu's `daytona` user through passwordless sudo, or root on a snapshot of box/Dockerfile. The `gpuSnapshot` option names our own GPU snapshot instead: box/Dockerfile as it is, built with one GPU by `box/build-daytona.py --gpu H100` (resources gpu 1 and gpuType H100, named `agentrun-archil-gpu-h100-<recipe hash>`, in region earth). Its user is root, its GPU is the one its name says, and its GPU computers take no mount either. It carries no CUDA toolkit: pip install torch brings its own CUDA runtime; the host gives the driver. A GPU spec's image is then `"default"` or that name. An Archil computer's preflight reads `/dev/fuse`, and one without it is refused in those words ("this computer has no /dev/fuse, so the Archil folder can't be mounted") before anything else |
1477
1517
 
1478
1518
  ### What the provider does
1479
1519
 
1480
- - `check(spec)` refuses in words, with no request: no snapshot, a lifetime that is not 1 ms to 30 days, a network
1481
- that is not `none` (open and every allowlist alike), a label in the provider's own
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 field.
1484
- - `create` sends `POST /sandbox` with the name `computer-<12 hex digits>`, the snapshot (none for `"default"`), the
1485
- labels with `agentrun.computer=1`, `agentrun.computer.deadline=<ISO time>` and `agentrun.computer.image=<the image>`, `public: false`, `ttlMinutes`,
1486
- `autoStopInterval` (`autoStopMinutes`; unset, 0, since Daytona's idle timer counts only outside traffic and a daemon
1487
- at work would be stopped), and `autoDeleteInterval` (`autoDeleteMinutes`; unset, -1: a stop keeps the sandbox, which
1488
- the TTL then ends). `POST /sandbox` is never retried. A
1489
- create that fails without a 4xx answer, or is aborted, may still have made the sandbox, so the provider deletes the
1490
- name it chose. Then it waits for `started` (polling `GET /sandbox/{id}`), runs the drift check on that read, pushes
1491
- in and starts the daemon, checks the daemon, and waits until the label listing shows the new computer steadily
1492
- (Daytona's listing trails a create). Any failure, mismatch or abort after the sandbox exists deletes it, and create
1493
- never returns ok once its signal has aborted.
1494
- - `attach({ id })` takes a sandbox id or a computer's name; `attach({ labels })` must match exactly one computer. Only
1495
- a sandbox with `agentrun.computer=1` and a computer's name counts. Attach runs the same drift check, with the spec
1496
- read back from the sandbox, and, when it is started, the daemon's; a computer that drifts is refused and left as it
1497
- is. It returns `spec`: `image`, the image create was asked for (`"default"` stays `"default"`), from its label;
1498
- `snapshot`, the snapshot Daytona reports; the daemon's user, the network, `cpus`, `memoryMb` (Daytona's GiB times
1499
- 1024), `/work` when the daemon was checked, and the deadline. A computer with no image label (made before create
1500
- wrote it) reports its snapshot as `image`, and is not refused for the missing label.
1501
- - `list(labels)` asks Daytona for `agentrun.computer=1` alone, every page, and filters the other labels itself. A
1502
- sandbox that is `destroying` or `destroyed`, or whose desired state is `destroyed`, is going and left out.
1503
- `started`, the states on the way to it, and `stopping` and `pausing` (on the way from it) are `running`: a stopping
1504
- computer is reported stopped only once Daytona reads it `stopped`. The rest (`stopped`, `archived`, `paused`,
1505
- `error`, ...) are `stopped`. A listed sandbox with no network fields is read on its own.
1506
- - `network(ref)` reads the network back. `network(ref, policy)` refuses open and an allowlist in words, with no
1507
- request; a change to none (of a computer made open or with a list before the loopback block) sends `POST
1508
- /sandbox/{id}/network-settings` and reads it back whatever the answer: as asked, it is returned; unchanged, the
1509
- change is refused in Daytona's words; anything else is put back, or, if that fails, the network is blocked, and the
1510
- change is refused. A network is never left wider than asked.
1520
+ - `check(spec)` refuses in words, with no request: no snapshot (or one of blanks or control characters), a lifetime
1521
+ that is not 1 ms to 30 days, a network that is not `none` (open and every allowlist alike), a label in the provider's
1522
+ own namespace (`agentrun.computer`), `cpus`, `memoryMb` or `pids` (a snapshot's size is its own), `user`, `workdir`
1523
+ (the daemon works in `/work`), a GPU computer's snapshot other than the GPU snapshot or `"default"`, and any other
1524
+ field.
1525
+ - `create(spec, { requestId })` names the computer `computer-<12 hex digits of sha256(requestId)>` and lists that name
1526
+ first: a retry of the same request finds the computer the first one made (the adapter's idempotent create,
1527
+ [PROVIDERS.md](PROVIDERS.md)). It sends `POST /sandbox` with that name, the snapshot (none for `"default"`), the
1528
+ labels (`agentrun.computer=1`, `agentrun.computer.name`, the deadline, the image, and the most an extend could move
1529
+ the deadline to), `public: false`, `networkBlockAll`, `ttlMinutes`, `autoStopInterval` (`autoStopMinutes`; unset, 0,
1530
+ since Daytona's idle timer counts only outside traffic and a daemon at work would be stopped), and
1531
+ `autoDeleteInterval` (`autoDeleteMinutes`; unset, -1: a stop keeps the sandbox, which the TTL then ends). `POST
1532
+ /sandbox` is never retried; a name Daytona already holds (409) is `exists`. A create that fails without a 4xx
1533
+ answer, or is aborted, may still have made the sandbox, so the adapter deletes the name it chose. Then it waits for
1534
+ `started` (polling `GET /sandbox/{id}`), pushes in and starts the daemon, checks the daemon and probes its network
1535
+ none from inside, and waits until the label listing shows the new computer twice running (Daytona's listing trails
1536
+ a create). A sandbox that reads `error` or `build_failed` is gone, and create fails `vendor` with Daytona's
1537
+ `errorReason`. Any failure or abort after the sandbox exists deletes it, and create never returns ok once its signal
1538
+ has aborted.
1539
+ - `attach({ id })` takes a sandbox id (or a computer's name, which Daytona answers to as well); `attach({ labels })`
1540
+ must match exactly one computer. Only a sandbox with `agentrun.computer=1` and a computer's name label counts.
1541
+ Attach holds the daemon to the provider's, when the computer is started. It returns `spec`: `image`, the image
1542
+ create was asked for (`"default"` stays `"default"`), from its label; the daemon's user, the network, `/work`, the
1543
+ deadline and, with one, the GPU.
1544
+ - `list(labels)` asks Daytona for `agentrun.computer=1` alone, every page, for the ids; the adapter keeps those whose
1545
+ `GET /sandbox/{id}` carries the other labels. A sandbox that is `destroying`, `destroyed`, `error` or `build_failed`,
1546
+ or whose desired state is `destroyed`, is gone and left out: none of them starts again. `started` is `running`; the
1547
+ states on the way to it are starting, and left out; every other state (`stopping`, `pausing`, `stopped`, `archived`,
1548
+ `paused`) is `stopped`.
1549
+ - `network(ref)` is the adapter's probe from inside; `network(ref, policy)` refuses any policy but the one the
1550
+ computer has, with `refused` and no request.
1511
1551
  - `release(ref, "delete")` deletes: retried on a 5xx, checked against the sandbox, with a forced stop before the last
1512
- attempt. `release(ref, "stop")` stops. Both are idempotent, and both refuse a sandbox that is
1513
- not this provider's.
1514
- - Daytona is asynchronous: it answers a delete by setting the sandbox's desired state to `destroyed` and a stop by
1515
- setting it to `stopped`, and the sandbox gets there later, through `destroying` or `stopping`. Its listing trails
1516
- both: in the first live run, `list()` still showed a computer right after its delete returned, and showed a stopped
1517
- one `running`. So release waits until Daytona reads the computer as release left it, twice running, by
1518
- `GET /sandbox/{id}` and by the label listing alike: after a delete, a 404 and no listed computer; after a stop, a
1519
- `stopped` read and a computer listed `stopped`, or, when the stop deletes (`autoDeleteMinutes: 0`), a 404 and no
1520
- listed computer. A stop that is not under way is asked for again. It polls through `waitUntil`, with pauses that
1521
- double from `pollMs` up to 5 s, bounded by the `goneMs` timeout for a delete and `stopMs` for a stop (120 s each, unset), and by the signal
1522
- `release(ref, how, { signal })` takes. When the bound runs out, or the sandbox goes to `error`, release fails in
1523
- words naming the last state Daytona read: it never reports a release it has not seen done. A create that deletes
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.
1552
+ attempt. It is idempotent, and refuses a sandbox that is not this provider's. `release(ref, "stop")` is refused as
1553
+ `unsupported`, with no request: a Daytona computer is deleted, never stopped and kept.
1554
+ - Daytona is asynchronous: it answers a delete by setting the sandbox's desired state to `destroyed`, and the sandbox
1555
+ gets there later, through `destroying`. Its listing trails it. So release waits until `GET /sandbox/{id}` no longer
1556
+ finds the computer, twice running: a 404 or `destroyed`. A sandbox still `destroying`, or with the desired state
1557
+ alone, reads gone to every other caller but holds this wait. It polls with pauses that double from `pollMs` up to
1558
+ 5 s, bounded by the `goneMs` timeout (120 s unset)
1559
+ and by the signal `release(ref, how, { signal })` takes. When the bound runs out, release fails in words naming the
1560
+ last state Daytona read: it never reports a release it has not seen done. A create that deletes the sandbox it made
1561
+ (a failure, an abort) waits the same way before it returns.
1562
+ - `connect(ref)` answers `gone` for a sandbox that is going (destroying, or asked to destroy), refuses one that is
1563
+ not `started`, and a daemon whose hello is not the provider's.
1526
1564
  - 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, input and network changes are not.
1528
-
1529
- ### The drift check
1565
+ backoff from `timeouts.retryMs`, 500 ms unset); creates, session commands and input are not.
1530
1566
 
1531
- From Daytona's read of the sandbox:
1567
+ ### The daemon check
1532
1568
 
1533
- | Field | Must be |
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
1569
+ Daytona's create options are not read back: what create sent is what the sandbox has. The GPU is the one read-back
1570
+ (`gpu`, `gpuType`: `spec.gpu`'s count and type). From the daemon, over one connection: hello (the provider's version, `linux`, the `arch` option, every daemon
1545
1571
  capability), `/proc/self/status` (Uid and Gid the daemon user's four times, no groups, `NoNewPrivs: 1`, `CapInh`,
1546
1572
  `CapPrm`, `CapEff`, `CapBnd` and `CapAmb` all zero), `/proc/self/cwd` (`/work`) and `/proc/self/exe`
1547
- (`/opt/agentrun/computerd`); and the installed binary's sha256 from the install.
1573
+ (`/opt/agentrun/computerd`); its own network (loopback alone), and the probe: no target answers a computer with
1574
+ network none; and the installed binary's sha256 from the install.
1548
1575
 
1549
1576
  ### Conformance on Daytona
1550
1577
 
@@ -1562,10 +1589,9 @@ fallback: on a host that runs other Daytona work they may hold another organizat
1562
1589
  which serve passes in itself.
1563
1590
 
1564
1591
  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. A stop therefore deletes, and the provider declares it
1566
- (`stopDeletes: true`): Core `provider.stop` holds it to that and passes when the stopped computer is gone, neither
1567
- listed nor attachable. Full `provider.janitor`, which needs a stopped computer kept, is skipped (the lifetime is
1568
- `vendor`, and a stop keeps none). The module exports `conformanceImage()` and `conformanceNotes`; the CLI takes the
1592
+ `autoDeleteMinutes: 0`, whatever the environment says. The provider never stops a computer: Core `provider.stop`
1593
+ expects its refusal. Full `provider.janitor`, which needs a stopped computer kept, is skipped (the lifetime is
1594
+ `vendor`, and release keeps none). The module exports `conformanceImage()` and `conformanceNotes`; the CLI takes the
1569
1595
  image from it when `--image` names none, and prints the note above the verdict (`notes` in `--json`).
1570
1596
 
1571
1597
  ```sh
@@ -1574,25 +1600,17 @@ npm run conformance -w @parcha/agentrun-computer -- --provider daytona [--image
1574
1600
 
1575
1601
  ### The sweep around a live run
1576
1602
 
1577
- `dist/conformance/daytona-sweep.js` reads the same `COMPUTER_DAYTONA_API_KEY` and `COMPUTER_DAYTONA_API_URL`, through
1578
- the conformance module:
1603
+ The live sweep is the shared one, `dist/conformance/sweep.js --provider daytona --before <file>` and `--after <file>`
1604
+ ([PROVIDERS.md](PROVIDERS.md), "The live sweep"); it reads the same `COMPUTER_DAYTONA_API_KEY` and
1605
+ `COMPUTER_DAYTONA_API_URL` through the conformance module's `createHost`, with no live switch:
1579
1606
 
1580
1607
  ```sh
1581
- node packages/computer/dist/conformance/daytona-sweep.js --before /tmp/daytona-before.json # before the run
1582
- node packages/computer/dist/conformance/daytona-sweep.js --after /tmp/daytona-before.json # after it
1608
+ node packages/computer/dist/conformance/sweep.js --provider daytona --before /tmp/daytona-before.json # before the run
1609
+ node packages/computer/dist/conformance/sweep.js --provider daytona --after /tmp/daytona-before.json # after it
1583
1610
  ```
1584
1611
 
1585
- `--before <file>` writes the id of every sandbox carrying `agentrun.computer=1`, whatever its name or state, into the
1586
- file. `--after <file>` lists them again and deletes (`release(ref, "delete")`) every one whose id is not in the file
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).
1612
+ It prints `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}` (`gone` was `notFound`). A conformance run of
1613
+ Daytona also sweeps its own label through the host at its end (the report's `cleanup.sweep`).
1596
1614
 
1597
1615
  ### Not yet known
1598
1616
 
@@ -1683,7 +1701,7 @@ const made = await e2b.create({ image: "desktop", lifetimeMs: 600_000, network:
1683
1701
  ```
1684
1702
 
1685
1703
  E2B runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/e2b.ts` is E2B's `MachineHost`, its
1686
- SDK slice and the mapping of a sandbox to a machine, and `src/hosted/provider.ts` does everything below that is not
1704
+ SDK types (`import type`, erased at build) and the mapping of a sandbox to a machine, and `src/hosted/provider.ts` does everything below that is not
1687
1705
  E2B's own. `create` takes the caller's request id (`{ requestId }`, serve's is the run's claim): the computer's name is
1688
1706
  `computer-` and the first 12 hex digits of its sha256, and a retry of the same request finds the computer the first
1689
1707
  made instead of making a second.
@@ -1692,8 +1710,8 @@ An E2B computer is a sandbox made from an E2B template, by default `desktop`, E2
1692
1710
  Xfce, x11vnc and noVNC, e2b-dev/desktop `template/template.py:3-65`). It is kind `desktop`: computerd starts the X
1693
1711
  server itself, as on a Docker desktop, and its X11 shim drives it. With `kind: "linux"` it is kind `linux`
1694
1712
  on any template, `base` by default, with no display: the same provider, minus the X server, so it costs nothing to
1695
- offer. Every call goes through the host's E2B JS SDK, the `e2b` package's `Sandbox` class, of which `src/e2b.ts` names
1696
- only the slice it calls (`E2BSandboxClass`) and imports nothing at load; the package is the host's to install, as
1713
+ offer. Every call goes through the host's E2B JS SDK, the `e2b` package's `Sandbox` class, whose types `src/e2b.ts` imports
1714
+ as types only (held as `typeof Sandbox` inside, `object` in the published types), so nothing loads from it at import; the package is the host's to install, as
1697
1715
  Modal's is. `@e2b/desktop` is not used: it starts Xvfb and Xfce with `commands.run`, outside computerd's process table
1698
1716
  and with no bound or abort (`@e2b/desktop@2.5.0` `dist/index.mjs:387-415`), and the provider needs none of its other
1699
1717
  calls.
@@ -1725,26 +1743,42 @@ E2B's envd is the sandbox's first process, a systemd service with `Restart=alway
1725
1743
  cancelled: one that lands after create gave up is killed by its id, one whose answer never comes by its name label.
1726
1744
  The listing shows a new sandbox a moment late, so the name is listed again until it shows or `listedMs` (15 s)
1727
1745
  passes, and the sandbox found is killed and read back gone, as release waits for one.
1728
- 2. `getInfo` reads the sandbox back (below).
1746
+ 2. `getInfo` reads the sandbox's state until it runs.
1729
1747
  3. `files.write` uploads the daemon as root to `/tmp/agentrun-computerd-<random>` (`index.mjs:2332-2435`), and the
1730
1748
  same install command as Daytona's (`src/hosted/scripts.ts`) moves it to `/opt/agentrun/computerd`, root-owned, and
1731
1749
  prints its sha256, which must be the uploaded one's, and who installed it (a create note).
1732
1750
  4. The adapter's start command, a background command as root, starts `computerd init --deadline <time> --user
1733
1751
  2510:2510 --own-network --max-deadline <create's time plus the cap>` with `DISPLAY=:0`, in a clean environment,
1734
1752
  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. envd runs every command under `bash -l -c`
1736
- (`index.mjs:5123-5146`), each with timeout 0, because envd kills a command whose timeout passes (envd
1737
- `process/start.go:39-44`); the SDK's default would end it after 60 s (`index.mjs:4978`).
1738
- 5. `connect()` starts `computerd stdio` the same way, as root, with `stdin: true` and `retainOutput: false` (so a long
1739
- connection keeps no copy of its output, `index.mjs:2708-2711`, `5150-5153`): its stdout comes through `onStdout`
1740
- (decoded as a stream, `index.mjs:2860`), and requests go in with `sendStdin`, one call after another.
1741
- `close()` kills the bridge (SIGKILL, `index.mjs:5092-5095`), which ends nothing else, and disconnects from it. The
1742
- bridge has no command timeout, so one whose start answers after the call gave up on it (its bound passed, or the
1743
- caller aborted) is killed and disconnected as it lands.
1753
+ and a daemon that never answers is reported with init's own words. Every command goes through envd's
1754
+ `Process.Start` stream, called on the SDK's own Connect client (`commands.rpc`, `index.mjs:4972-4985`) as
1755
+ `commands.run` calls it (`index.mjs:5123-5146`): `/bin/bash -l -c` and the argv quoted, root by the Basic header
1756
+ (`index.mjs:1896-1900`), envd's keepalive every 50 s, and no deadline on the stream (timeout 0, which the Connect
1757
+ transport reads as none), because envd kills a command whose timeout passes (envd `process/start.go:39-44`); the
1758
+ SDK's default would end it after 60 s (`index.mjs:4978`). Only the start is bounded.
1759
+ 5. `connect()` starts `computerd stdio` the same way, as root; every exec has stdin open (`stdin: true`), and `end()`
1760
+ is `closeStdin`. Its stdout is the bytes each data
1761
+ event carries, passed on as they come: `commands.run` would hand them to `onStdout` as text, decoded as UTF-8
1762
+ (`index.mjs:2702`, `2860`), which turns every byte that is not UTF-8 into U+FFFD, so `exec` reads the stream
1763
+ itself. Requests go in with `sendStdin`, one call after another. `close()` kills the bridge (SIGKILL,
1764
+ `index.mjs:5092-5095`), which ends nothing else, and lets go of its stream. The bridge has no command timeout, so one
1765
+ whose start answers after the call gave up on it (its bound passed, or the caller aborted) is killed as it lands.
1744
1766
  6. A desktop's X server, `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp`, starts through the daemon with
1745
1767
  `process.start`, as the computer's user, and create waits until hello declares the display (`src/desktop.ts`,
1746
- shared with Docker). Hello re-checks the display on every call, so `connect()` refuses a desktop whose X server has
1747
- gone (it reads back kind `linux`).
1768
+ shared with Docker). Then xfwm4, which the template has, starts the same way on it (`xfwm4 --compositor=off
1769
+ --sm-client-disable`, `WINDOW_MANAGER`), so the apps an agent opens are framed and focused. xfwm4 reads its
1770
+ settings over a session bus and exits without one. So it runs under `dbus-run-session`, in a user namespace (the
1771
+ same uid) and a network namespace of its own (`unshare --user --map-current-user --net`), and its bus listens on an
1772
+ abstract name there, which a program of the computer's user cannot connect to. One that joins those namespaces
1773
+ (nsenter) can, as the same uid can ptrace xfwm4. xfwm4 reaches the display by its path. It and every app `apps.launch` opens get `NO_AT_BRIDGE=1`: the template has at-spi2-core, so GTK's
1774
+ accessibility bridge would start an at-spi bus, a socket of the user's at `/work/.cache/at-spi/bus_0` that nothing
1775
+ of ours uses. An app also gets no session bus (`DBUS_SESSION_BUS_ADDRESS=disabled:`). Given none, it would start
1776
+ one with the template's dbus-launch, and that bus starts gnome-keyring-daemon, a socket of the user's at
1777
+ `/work/.cache/keyring-*/control`. The template has no passwd entry
1778
+ for 2510, and a session bus closes every connection of a uid it cannot look up, so a desktop's init, still root, first names the
1779
+ user `agentrun-tool` (home the computer's, shell `/bin/sh`), as the box image does (`daemon.NameUser`). A window
1780
+ manager that ends within a second of its start fails create with its last words. Hello re-checks the
1781
+ display on every call, so `connect()` refuses a desktop whose X server has gone (it reads back kind `linux`).
1748
1782
 
1749
1783
  envd runs as root and obeys anyone with the API key, as Daytona's toolbox does, and answers on 49983 (`e2b@2.63.0`
1750
1784
  `dist/index.mjs:1213`, `envdPort`) inside the sandbox; the computer's daemon runs as 2510:2510 with no capability in
@@ -1761,9 +1795,9 @@ would hold an empty process table).
1761
1795
  | --- | --- | --- |
1762
1796
  | `kind` | `desktop` (default) or `linux` | `options.kind`; a desktop's X server is computerd's own |
1763
1797
  | `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, read back by `getInfo` with `network.denyOut` and `allowPublicTraffic`, and the daemon's own network namespace; `open` waits for a proxy out of it (known gap) |
1798
+ | `network` | `none` | `allowInternetAccess` false and `allowPublicTraffic` false at create, and the daemon's own network namespace; `open` waits for a proxy out of it (known gap) |
1765
1799
  | `vendorAgentPorts` | `[49983]` | envd's port; isolation.vendor-agent checks a program of the computer's user reaches it on neither loopback |
1766
- | `networkReadBack` | `true` | `getInfo` reports `allowInternetAccess` and `network` (`index.mjs:5432-5458`) |
1800
+ | `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
1767
1801
  | `isolation` | `microvm` | Firecracker |
1768
1802
  | `daemon` | `child` | envd is the first process; init is a background command it runs |
1769
1803
  | `groups` | `exec`, `files`, `processes`, and on a desktop `screen`, `input.pointer`, `input.keys` | checked against hello on every connect |
@@ -1826,10 +1860,12 @@ timer is never pulled under it. When init's move fails after E2B's, the error sa
1826
1860
  and init's did not: the programs end at the old deadline, earlier than asked, never later. A provider runs one extend
1827
1861
  of a computer at a time, each reading the deadline the one before it left, so a slow, shorter extend never pulls E2B's
1828
1862
  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 `list()` and `attach()` report E2B's own end, up
1830
- to 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,
1831
- to the second E2B rounds to); extend never leaves E2B's end inside those 2 s, moving it at least 3 s past create's end,
1832
- so an extend however short reads back.
1863
+ changes metadata, so the deadline label stays as create wrote it, and the host reads E2B's own end in its place, up to
1864
+ the cap, once it is more than 2 s past where create set it (its start plus the timeout create gave, by E2B's clock, to
1865
+ the second E2B rounds to). `getInfo` reads the moved end; `Sandbox.list` may still show create's (read live 11-14),
1866
+ so `list()` and `attach()` report the end from `get`, as the adapter reads every listed machine.
1867
+ Extend never leaves E2B's end inside those 2 s, moving it at least 3 s past create's end, so an extend however short
1868
+ reads back.
1833
1869
 
1834
1870
  There is no `stream()`: a screen is streamed through agentrun, never through a vendor URL. A URL into an E2B sandbox
1835
1871
  that a browser could open needs public traffic, since a private sandbox's URL needs the `e2b-traffic-access-token`
@@ -1842,27 +1878,23 @@ words, whatever its value, and every sandbox is made with public traffic off.
1842
1878
  - `check(spec)` refuses in words, with no call: no template, a lifetime past the cap (the shared `checkLifetime`), a
1843
1879
  network that is not none (open and an allowlist alike), a label in the provider's namespace,
1844
1880
  `cpus`, `memoryMb` or `pids` (a template's size is its own), `user`, `workdir` and any other field.
1845
- - `create` reads the sandbox back with `getInfo` and refuses any drift: the template (its id, or its alias when E2B
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,
1881
+ - `create` waits for the sandbox to run; E2B's create options are not read back. Then the daemon: hello (version,
1848
1882
  `linux`, `amd64`, kind and groups), `/proc/self/status` (uid and gid 1000, no groups, `NoNewPrivs` 1, every
1849
1883
  capability set zero), `/proc/self/cwd` (`/work`), `/proc/self/exe`; and for none, the probe. It waits until the label
1850
1884
  listing shows the new computer. A failure, mismatch or abort at any step kills the sandbox and waits for it to go;
1851
1885
  create never returns ok once its signal has aborted.
1852
- - `attach({ id })` or `attach({ labels })` reads the spec back from E2B and, for a running computer, the daemon, as at
1853
- create; one that drifts is refused and left as it is. `image` is the template create was asked for, from its label,
1854
- and `snapshot` the id E2B reports.
1886
+ - `attach({ id })` or `attach({ labels })` reads the computer from E2B and, for a running computer, the daemon, as at
1887
+ create. `image` is the template create was asked for, from its label.
1855
1888
  - `list(labels)` asks E2B for the labels with `agentrun.computer=1` (`Sandbox.list`, running and paused sandboxes,
1856
- `index.d.mts:10289`), every page, and reads each one back with `getInfo` for its network; paused is `stopped`. One
1857
- deadline, `listMs` (60 s) from the call, bounds every page and every read-back, each read's own request bound
1858
- included; past it, `list()` is a timeout in words.
1889
+ `index.d.mts:10289`), every page, for the ids: the adapter reads each one by `getInfo`, since the listing may still
1890
+ show a killed sandbox or an end from before a timer moved; paused is `stopped`. One deadline, `listMs` (60 s) from
1891
+ the call, bounds every page; past it, `list()` is a timeout in words.
1859
1892
  - `connect(ref)` refuses a paused computer without connecting, since E2B's connect resumes one; it gives E2B a timeout
1860
1893
  a little under what is left, and E2B moves a running sandbox's timer only to a longer one (`index.d.mts:10250`), so
1861
1894
  connecting never moves the end.
1862
1895
  - `release(ref, "delete")` reads the sandbox back to check it is this provider's, then kills it (`index.mjs:5398-5410`;
1863
1896
  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 label listing no
1865
- longer shows it, twice running, with pauses doubling from `pollMs` to 5 s, within `goneMs` (120 s) and the caller's
1897
+ then it waits through `waitUntil` until `getInfo` answers not found (`index.mjs:5431`), twice running, with pauses doubling from `pollMs` to 5 s, within `goneMs` (120 s) and the caller's
1866
1898
  signal, which ends only this wait.
1867
1899
  `release(ref, "stop")` is refused in words.
1868
1900
  - Every SDK call has its own bound and takes the caller's signal; the paginator takes it per page (`Sandbox.list`
@@ -1900,10 +1932,6 @@ One live E2B run has been made, the network diagnostic of 2026-11-07 (one sandbo
1900
1932
  other fact above is read from the SDK, envd and the desktop template's source, and the unit tests run against a fake.
1901
1933
  A live run must show:
1902
1934
 
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
1935
  - that a sandbox with no internet access gets no answer from any probe target, IPv6 included (the one diagnostic read
1908
1936
  the IPv6 target refused and every IPv4 one accepted with 0 bytes), and what else `denyOut 0.0.0.0/0` lets through;
1909
1937
  - that envd keeps init running once create disconnects, and how long `getInfo` takes to answer not found after a kill;
@@ -1954,8 +1982,8 @@ names the API key by its sha256 prefix alone.
1954
1982
  | `get` | `GET /v1/instances/{id}`; 404 is none |
1955
1983
  | `list` | `GET /v1/instances`, the whole workspace in one answer (`{ data }`, no paging keys, seen live), matched on the labels here. An answer that says it has more is refused, never read as all |
1956
1984
  | `delete` | `DELETE /v1/instances/{id}`, never signalled; a repeat's 404 is done |
1957
- | `setLabels` | `GET`, then `PATCH` of the whole `metadata`, which a PATCH replaces |
1958
- | `exec` | SSH as root over a binary WebSocket to `wss://{id}-22022.agent37.app/`, one connection per process (below) |
1985
+ | `extend` | `GET`, then `PATCH` of the whole `metadata` with the new deadline label, since a PATCH replaces it |
1986
+ | `exec` | SSH as root over a binary WebSocket to `wss://{id}-22022.agent37.app/`, one channel per process on the instance's shared connection (below) |
1959
1987
  | `errorCode` | the envelope's `error.code` (or a flat `error` string), then the HTTP status; ssh2's `client-authentication` is `denied` |
1960
1988
  | `check` | a template name with an optional `@version`; one of Agent37's four shapes; at most 4 CPUs; metadata within 4096 bytes with the provider's own labels |
1961
1989
 
@@ -1967,13 +1995,25 @@ label and keeps the oldest by `created` (whole seconds; ties go to the lowest id
1967
1995
  Agent37 has no SSH port on the internet: the instance's sshd answers on 22022 inside it, and the edge carries the SSH
1968
1996
  stream as binary WebSocket frames. `exec` opens a WebSocket (Node's global one takes `headers`), wraps it as a Duplex
1969
1997
  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; with no
1971
- stdin, end of file is sent at once. `wait()` answers at the channel's close with the exit-status, or -1 for an exit by
1998
+ `/tmp/.agentrun-exec-<random>` and removes it when the command ends. stdout and stderr are the channel's, piped; stdin
1999
+ is open until `end()`, which the adapter calls at once for a command it gives no input. `wait()` answers at the channel's close with the exit-status, or -1 for an exit by
1972
2000
  signal or none; its listeners go on inside ssh2's callback, since one read off the tunnel can hold the open, the exit
1973
2001
  and the close together (seen live: a listener added after an `await` missed the exit). `kill()` runs a second command
1974
2002
  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 and the connection. An SSH signal request is not used: ssh2 sends one only while
1976
- stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one process, not its children.
2003
+ seen live), then closes the exec's channel, never a connection. An SSH signal request is not used: ssh2 sends one only
2004
+ while stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one process, not its children.
2005
+
2006
+ Every exec on an instance is a channel on one SSH connection that the provider shares: the daemon's upload, its install,
2007
+ init's start, the stdio bridge and the live view's watch take one WebSocket and one handshake between them (a tunnel and
2008
+ its handshake take about 0.35 s over Agent37's edge, seen live). Execs that start together wait for one handshake, each
2009
+ within its own bound: one with time left when a shared handshake runs out of its opener's opens its own. The connection
2010
+ opens at the first exec (the four tries below), and a connection that closed or failed is never handed out again; a
2011
+ channel that fails to open (the connection died under it, or its sshd took no more sessions) is opened once more on a
2012
+ fresh connection. One connection carries at most 10 channels at once, execs and kills alike, and the next opens a second:
2013
+ OpenSSH's sshd takes 10 sessions on a connection (`MaxSessions`). A kill's channel goes on any connection with room, since
2014
+ the pid file is the instance's. With no channel left, a connection waits 2 s for the next exec, then ends: an open one
2015
+ keeps the process alive (ssh2's keepalive timer and the WebSocket's socket), so a process done with its computers exits
2016
+ at most that late. `delete` ends every connection to the instance at once, a retired one still carrying channels too.
1977
2017
 
1978
2018
  ### Capabilities
1979
2019
 
@@ -1984,15 +2024,15 @@ stdin is open (`ssh2@1.17.0` `lib/Channel.js:237-246`), and it reaches one proce
1984
2024
  | `isolation` | `vm` or `gvisor` | `options.type`: `vm` (default) or `default` |
1985
2025
  | `lifetime` | `janitor` | Agent37 never ends an instance on its own; init's deadline and the deadline label do, and the run's sweep is the backstop |
1986
2026
  | `maxLifetimeMs` | 24 h | the janitor's cap; `options.maxLifetimeMs` sets less |
1987
- | `network` | `none` | `deny-all`, read back, and the daemon's own network namespace |
1988
- | `networkReadBack` | `true` | `GET` reports `network` and `public_ports`; any public port reads `other` |
2027
+ | `network` | `none` | `deny-all` at create, and the daemon's own network namespace |
2028
+ | `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
1989
2029
  | `vendorAgentPorts` | `[22022, 7681]` | the platform's sshd (root for whoever holds the key) and its web terminal (ttyd), both seen listening on every VM |
1990
2030
  | `mount` | `archil` | the run's folder on an Archil disk; `/dev/fuse` is there on both types (live), and the mount needs the box template |
1991
2031
  | `release` | `delete` | `DELETE`; no release maps to Agent37's stop here |
1992
2032
  | `specFields` | `cpus`, `memoryMb` | 2/4, 4/8, 4/16 or 4/32 (CPUs/GB); more than 4 CPUs is refused, since Agent37 gives 4 without saying so |
1993
2033
 
1994
- Every instance is made with `auto_sleep: false`: a VM that sleeps wakes cold, its daemon gone. A read-back with
1995
- `auto_sleep` on, another type, region or template is drift, and the adapter refuses the computer.
2034
+ Every instance is made with `auto_sleep: false`: a VM that sleeps wakes cold, its daemon gone. What create sent is not
2035
+ read back.
1996
2036
 
1997
2037
  ### Conformance on Agent37
1998
2038
 
@@ -2027,16 +2067,18 @@ kernel `4.19.0-gvisor`): root has no `CAP_SYS_ADMIN`, and init made its namespac
2027
2067
  `create({ kind: "desktop", ... })` (serve builds the descriptor's desktop configuration so) makes a desktop: the
2028
2068
  adapter gives init `DISPLAY` and starts `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp` through the daemon as the tool
2029
2069
  user (`src/desktop.ts`), as on E2B, so the X server is one process in init's table, in its own network namespace, and
2030
- ends with the computer. Its default image is `agentrun-box` (`AGENT37_BOX_TEMPLATE`): `box/Dockerfile` (the archil
2031
- client, the helper, the tool user, FUSE, no sudo) plus Xvfb, built as a template of the key's own workspace by
2032
- `box/build-agent37.mjs`:
2070
+ ends with the computer; xfwm4 starts the same way once the display answers, its session bus out of the user's reach, as
2071
+ on E2B. Its default image is `agentrun-box`
2072
+ (`AGENT37_BOX_TEMPLATE`): `box/Dockerfile` (the archil client, the helper, the tool user, FUSE, no sudo, and its
2073
+ desktop: Xvfb, xfwm4, and the apps E2B Desktop has that are cheap to carry, Xfce's terminal and Mousepad, Firefox ESR,
2074
+ xdotool), which the `apps` group lists and opens, built as a template of the key's own workspace by `box/build-agent37.mjs`:
2033
2075
 
2034
2076
  ```sh
2035
2077
  AGENT37_API_KEY=... node packages/computer/box/build-agent37.mjs # prints template=agentrun-box
2036
2078
  ```
2037
2079
 
2038
- Agent37 keeps a template's revisions under one name, so the name is fixed and the recipe's hash (the Dockerfile, the
2039
- helper and the desktop's lines in the script) is in the template's description: a workspace whose template names the
2080
+ Agent37 keeps a template's revisions under one name, so the name is fixed and the recipe's hash (`box/recipe.mjs`: the
2081
+ Dockerfile and the helper, the published image's hash too) is in the template's description: a workspace whose template names the
2040
2082
  hash already is built nothing, and a changed recipe publishes a new revision, which every instance made after it starts
2041
2083
  from. The script's calls: `GET /v1/templates/agentrun-box`, then `POST /v1/template-builds` (`name`, `size_bytes`,
2042
2084
  `description`), a `PUT` of the gzipped context (the Dockerfile and the helper at its root) to the presigned
@@ -2172,7 +2214,7 @@ and are never in a ref, a list, an error's words or a report. `client` stays a `
2172
2214
  | a computer is | a session (`POST /v1/sessions`, `keepAlive: true`) | a browser (`POST /browsers`) |
2173
2215
  | labels ride | the session's `userMetadata`, each key's dots written as `_` (Browserbase refuses a dot in a metadata key), so a label key is letters, digits and dots | the browser's `tags` |
2174
2216
  | lifetime | the session's `timeout`, 60 s to 6 h, wall clock | `timeout_seconds`, 10 s to 72 h, an idle timeout: no wall clock, so list reads no deadline |
2175
- | groups (`CAPABILITIES`) | `cdp`, `stream` | `cdp`, `stream` |
2217
+ | groups (the descriptor's `capabilities`) | `cdp`, `stream` | `cdp`, `stream` |
2176
2218
  | test connection | one `GET /v1/sessions?status=RUNNING` | one `GET /browsers?status=active` page |
2177
2219
  | release | `REQUEST_RELEASE`, then read back until it is no longer `RUNNING` or `PENDING` | `DELETE`, then read back until 404 or `deleted_at` |
2178
2220
  | options | `apiKey`, `projectId`, `apiUrl`, `fetch` | `apiKey`, `apiUrl`, `fetch` |
@@ -2451,6 +2493,12 @@ optional screen screenshot-size - 1
2451
2493
  core PASS 55/55 · 10 optional cases skipped, not declared · full 10/13 · mount:archil screen input.pointer input.keys input.touch apps.install apps ui extend not declared
2452
2494
  ```
2453
2495
 
2496
+ A hosted vendor runs the exec pre-check first, with `--exec-stream --machine <id> [--quick]`: the module's
2497
+ `createHost(options)` and `host.exec` alone, on a machine made by hand, checked for a live, two-way, byte-exact stream
2498
+ with no timeout (`src/conformance/exec-stream.ts`; [the contract](../../spec/computer/provider.md#a-hosted-vendors-exec)).
2499
+ It exits 0 when every check passes and 1 when one fails, and `--json` prints `{ host, machine, checks: [{ id, status,
2500
+ words, ms }], pass }`.
2501
+
2454
2502
  An id is resolved through the provider registry, and only there; the usage lists every id it holds. A module path is
2455
2503
  resolved from the directory npm was run in. It exits 0 when Core passes, 1 when it fails, 2 on a
2456
2504
  usage error, and 3 on a partial run; `--json` prints the report object (`{ provider, providerVersion, kind,
@@ -2688,7 +2736,6 @@ refuses an id it does not hold, naming the ones it does. The provider file, `src
2688
2736
  `ProviderModule` is:
2689
2737
 
2690
2738
  - the provider class, which implements `ComputerProvider` and reports the registry id as its `id`;
2691
- - `MOUNT`, the mount kinds its computers take;
2692
2739
  - `create(options)`, the provider built from its options alone, its key included, and refused in words when one is
2693
2740
  missing or wrong, never echoing a key. It reads no environment (see [Settings](#settings)), and exports no names of
2694
2741
  variables;
@@ -2716,9 +2763,15 @@ npm run conformance -w @parcha/agentrun-computer -- --provider fly
2716
2763
 
2717
2764
  ```sh
2718
2765
  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; needs Go 1.24 or newer on PATH
2766
+ npm run build:daemon -w @parcha/agentrun-computer # dist/computerd-linux-amd64 and -arm64, and dist/computerd.json
2720
2767
  ```
2721
2768
 
2769
+ `build:daemon` builds the daemon with Go 1.24 or newer when Go is on PATH, and records the daemon source it came from in
2770
+ `dist/computerd.json`. Without Go, it takes both binaries from this version's package on npm, but only when that
2771
+ package's `computerd.json` names the same daemon source as the checkout (`scripts/daemon-source.mjs`); otherwise it
2772
+ stops and says to install Go. Each release carries the record, so a checkout of a released version needs no Go until
2773
+ its daemon changes.
2774
+
2722
2775
  ## Tests
2723
2776
 
2724
2777
  ```sh
@@ -2766,7 +2819,10 @@ capabilities.
2766
2819
  container of the desktop fixture's image, starts Xvfb through the daemon on the display init was given and waits for
2767
2820
  hello to declare the screen, and checks that `deadline.extend` moves up to `--max-deadline` and no further. The
2768
2821
  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.
2822
+ starts a GUI program gives it `DISPLAY` in the request's `env`, on E2B as on Docker. The surface is that caller for an
2823
+ agent: on a desktop whose hello names a display, `shell.run` and `processes.start` add it under the call's own `env`.
2824
+ `processes.start` is `process.start` with `orphans: "keep"`, so an app (or the app a launcher forks) stays open after
2825
+ the call, where `exec.run`'s guard ends everything its command started.
2770
2826
 
2771
2827
  ## Acknowledgements
2772
2828