@parcha/agentrun-computer 0.1.0-beta.35 → 0.1.0-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +2 -0
- package/README.md +423 -323
- package/box/Dockerfile +3 -1
- package/box/agentrun-archil +59 -7
- package/box/build-agent37.mjs +177 -0
- package/box/build-daytona.py +20 -4
- package/dist/agent37.d.ts +165 -0
- package/dist/agent37.js +759 -0
- package/dist/attach.d.ts +146 -0
- package/dist/attach.js +469 -0
- package/dist/browser.d.ts +61 -10
- package/dist/browser.js +125 -3
- package/dist/browserbase.d.ts +46 -23
- package/dist/browserbase.js +162 -17
- package/dist/chrome.d.ts +3 -4
- package/dist/chrome.js +6 -11
- package/dist/client.d.ts +33 -1
- package/dist/client.js +53 -0
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/conformance/agent37.d.ts +96 -0
- package/dist/conformance/agent37.js +154 -0
- package/dist/conformance/cases/apps.d.ts +5 -0
- package/dist/conformance/cases/apps.js +160 -73
- package/dist/conformance/cases/health.js +14 -0
- package/dist/conformance/cases/index.js +2 -0
- package/dist/conformance/cases/provider.js +27 -1
- package/dist/conformance/cases/screen.d.ts +3 -0
- package/dist/conformance/cases/screen.js +18 -0
- package/dist/conformance/cases/settings.d.ts +29 -23
- package/dist/conformance/cases/settings.js +76 -58
- package/dist/conformance/cases/touch.js +19 -17
- package/dist/conformance/cases/ui.d.ts +2 -0
- package/dist/conformance/cases/ui.js +475 -0
- package/dist/conformance/cli.d.ts +9 -0
- package/dist/conformance/cli.js +28 -3
- package/dist/conformance/daytona.d.ts +4 -0
- package/dist/conformance/daytona.js +5 -0
- package/dist/conformance/e2b.d.ts +6 -0
- package/dist/conformance/e2b.js +9 -2
- package/dist/conformance/fixture.d.ts +1 -1
- package/dist/conformance/fixture.js +25 -1
- package/dist/conformance/modal.d.ts +17 -13
- package/dist/conformance/modal.js +18 -9
- package/dist/conformance/orgo.d.ts +3 -3
- package/dist/conformance/orgo.js +6 -8
- package/dist/conformance/phone-harness.d.ts +6 -2
- package/dist/conformance/phone-harness.js +21 -4
- package/dist/conformance/report.js +1 -1
- package/dist/conformance/runner.js +23 -4
- package/dist/conformance/sweep.d.ts +50 -0
- package/dist/conformance/sweep.js +187 -0
- package/dist/conformance/types.d.ts +11 -3
- package/dist/conformance/ui-fixture.d.ts +56 -0
- package/dist/conformance/ui-fixture.js +43 -0
- package/dist/create-requests.d.ts +51 -0
- package/dist/create-requests.js +121 -0
- package/dist/daytona.d.ts +15 -5
- package/dist/daytona.js +58 -38
- package/dist/descriptor.d.ts +29 -2
- package/dist/descriptor.js +13 -0
- package/dist/descriptors/agent37.d.ts +41 -0
- package/dist/descriptors/agent37.js +28 -0
- package/dist/descriptors/browserbase.d.ts +1 -0
- package/dist/descriptors/browserbase.js +2 -0
- package/dist/descriptors/daytona.d.ts +23 -2
- package/dist/descriptors/daytona.js +34 -2
- package/dist/descriptors/index.d.ts +66 -3
- package/dist/descriptors/index.js +5 -3
- package/dist/descriptors/kernel.d.ts +1 -0
- package/dist/descriptors/kernel.js +2 -0
- package/dist/descriptors/modal.d.ts +4 -0
- package/dist/descriptors/modal.js +11 -1
- package/dist/descriptors/orgo.d.ts +13 -1
- package/dist/descriptors/orgo.js +9 -3
- package/dist/descriptors/phone-harness.d.ts +6 -1
- package/dist/descriptors/phone-harness.js +5 -2
- package/dist/docker/egress.d.ts +4 -3
- package/dist/docker/egress.js +7 -6
- package/dist/docker.d.ts +7 -4
- package/dist/docker.js +278 -34
- package/dist/e2b.d.ts +9 -165
- package/dist/e2b.js +282 -1342
- package/dist/fake-ui-driver.d.ts +97 -0
- package/dist/fake-ui-driver.js +717 -0
- package/dist/host.d.ts +182 -0
- package/dist/host.js +1 -0
- package/dist/hosted/process.d.ts +67 -0
- package/dist/hosted/process.js +228 -0
- package/dist/hosted/provider.d.ts +146 -0
- package/dist/hosted/provider.js +1364 -0
- package/dist/hosted/scripts.d.ts +76 -0
- package/dist/{child.js → hosted/scripts.js} +93 -12
- package/dist/index.d.ts +11 -7
- package/dist/index.js +10 -7
- package/dist/janitor.d.ts +5 -4
- package/dist/janitor.js +1 -1
- package/dist/kernel.d.ts +17 -27
- package/dist/kernel.js +94 -18
- package/dist/kinds.d.ts +17 -5
- package/dist/kinds.js +20 -4
- package/dist/labels.d.ts +10 -2
- package/dist/labels.js +30 -7
- package/dist/local-chrome.d.ts +5 -5
- package/dist/local-chrome.js +10 -5
- package/dist/modal.d.ts +23 -181
- package/dist/modal.js +273 -1232
- package/dist/mount-archil.d.ts +25 -3
- package/dist/mount-archil.js +39 -8
- package/dist/orgo-channel.d.ts +3 -2
- package/dist/orgo-channel.js +5 -2
- package/dist/orgo-desktop.d.ts +23 -9
- package/dist/orgo-desktop.js +328 -66
- package/dist/orgo-names.d.ts +129 -3
- package/dist/orgo-names.js +211 -8
- package/dist/orgo-workspaces.d.ts +47 -0
- package/dist/orgo-workspaces.js +94 -0
- package/dist/orgo.d.ts +27 -10
- package/dist/orgo.js +411 -81
- package/dist/phone-harness.d.ts +31 -21
- package/dist/phone-harness.js +510 -681
- package/dist/png.d.ts +4 -0
- package/dist/png.js +27 -0
- package/dist/protocol.d.ts +338 -30
- package/dist/protocol.js +96 -3
- package/dist/provider.d.ts +97 -7
- package/dist/provider.js +24 -3
- package/dist/result.d.ts +1 -1
- package/dist/surface/api.d.ts +248 -0
- package/dist/surface/api.js +1 -0
- package/dist/surface/core.d.ts +42 -0
- package/dist/surface/core.js +393 -0
- package/dist/surface/index.d.ts +5 -0
- package/dist/surface/index.js +3 -0
- package/dist/surface/outline.d.ts +8 -0
- package/dist/surface/outline.js +50 -0
- package/dist/surface/script.d.ts +10 -0
- package/dist/surface/script.js +92 -0
- package/dist/ui-engine.d.ts +114 -0
- package/dist/ui-engine.js +798 -0
- package/package.json +17 -1
- package/dist/child.d.ts +0 -42
- package/dist/conformance/e2b-diagnose.d.ts +0 -16
- package/dist/conformance/e2b-diagnose.js +0 -61
- package/dist/conformance/e2b-sweep.d.ts +0 -18
- package/dist/conformance/e2b-sweep.js +0 -132
- package/dist/conformance/modal-sweep.d.ts +0 -22
- package/dist/conformance/modal-sweep.js +0 -213
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ full VM, a machine. The protocol has two layers:
|
|
|
40
40
|
inside. It never runs commands itself: the daemon does. This package has four: Docker, Modal's VM runtime, Daytona
|
|
41
41
|
and E2B (desktops), each one line of the provider registry (see [Adding a computer](#adding-a-computer)).
|
|
42
42
|
|
|
43
|
-
The protocol is published as a spec, [`spec/computer/`](../../spec/computer/README.md), at protocol version 0.
|
|
43
|
+
The protocol is published as a spec, [`spec/computer/`](../../spec/computer/README.md), at protocol version 0.2
|
|
44
44
|
(`PROTOCOL_VERSION`, which `hello` carries as `protocol`). Its JSON Schema and constants are generated from
|
|
45
45
|
`src/protocol.ts` by `node scripts/generate-computer-spec.mjs`, and a test fails when they drift.
|
|
46
46
|
|
|
@@ -54,7 +54,7 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
54
54
|
|
|
55
55
|
```text
|
|
56
56
|
→ {"jsonrpc":"2.0","id":1,"method":"hello","params":{"client":"me"}}
|
|
57
|
-
← {"jsonrpc":"2.0","id":1,"result":{"protocol":"0.
|
|
57
|
+
← {"jsonrpc":"2.0","id":1,"result":{"protocol":"0.2","version":"0.1.0-beta.30","os":"linux","kind":"linux","arch":"arm64","groups":["exec","files","processes"]}}
|
|
58
58
|
→ {"jsonrpc":"2.0","id":2,"method":"exec.run","params":{"argv":["uname","-m"],"timeoutMs":5000}}
|
|
59
59
|
← {"jsonrpc":"2.0","id":2,"result":{"exitCode":0,"stdout":"YWFyY2g2NAo=","stderr":"","timedOut":false,"truncated":false}}
|
|
60
60
|
```
|
|
@@ -169,8 +169,8 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
169
169
|
environment, and exits with its code; a binary without cgo runs its tests itself, and a `-race` build (which needs
|
|
170
170
|
cgo) skips the tests of the drop. On a host as another user the refusal for EPERM and both deadline tests run (init
|
|
171
171
|
takes its deadline and refuses for the bounding set). The root path (`TestBecome...`, `TestUnprivilegedLeavesRoot...`)
|
|
172
|
-
needs root with capabilities and skips there; CI's `computer-docker` job covers it with the
|
|
173
|
-
(`test/docker/
|
|
172
|
+
needs root with capabilities and skips there; CI's `computer-docker` job covers it with the pid1 commands matrix
|
|
173
|
+
(`test/docker/pid1-commands.docker.test.mjs`: root containers with Docker's default capabilities and the two
|
|
174
174
|
`--own-network` needs, or `--cap-add ALL`, as 1000:1000, the refusal of 0:0 and the refusal without CAP_SETPCAP), and
|
|
175
175
|
computerd's end at its deadline with the Docker live tests. The test binaries (`CGO_ENABLED=0 go test -c`) also run
|
|
176
176
|
as root in a container by hand: `internal/isolate`'s and the isolated `TestBecome...` need CAP_SYS_ADMIN and
|
|
@@ -251,7 +251,7 @@ provider.
|
|
|
251
251
|
- **What it changes.** Only a provider that probes, on a vendor whose firewall accepts first, reads differently: E2B
|
|
252
252
|
([below](#network)), whose computers with network none the accept-counts rule refused, and are now kept with notes.
|
|
253
253
|
Docker reads its network back from `docker inspect` (`--network none` leaves no interface but `lo`, so a TCP
|
|
254
|
-
connection is refused outright and a UDP datagram has no route, which `test/docker/
|
|
254
|
+
connection is refused outright and a UDP datagram has no route, which `test/docker/pid1-commands.docker.test.mjs`
|
|
255
255
|
pins with the probe itself, every default target refused); Daytona reads `networkBlockAll` back from its API and runs
|
|
256
256
|
no probe; Modal's live run with `blockNetwork` read back no TCP accept at any target under the earlier accept-counts
|
|
257
257
|
rule, so nothing it accepted is newly let through. The UDP targets have not yet run live on Modal.
|
|
@@ -403,8 +403,8 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
403
403
|
| --- | --- | --- | --- |
|
|
404
404
|
| `none` | | | (the run's folder only: no computer) |
|
|
405
405
|
| `sandbox` | `linux` | `exec`, `files`, `processes` | |
|
|
406
|
-
| `desktop` | `desktop` | `screen`, `input.pointer`, `input.keys` | `exec`, `files`, `processes`, `apps`, `stream` |
|
|
407
|
-
| `phone` | `android`, `ios` | `screen`, `input.touch`, `apps` | `input.keys`, `apps.install`, `
|
|
406
|
+
| `desktop` | `desktop` | `screen`, `input.pointer`, `input.keys` | `exec`, `files`, `processes`, `apps`, `ui`, `stream` |
|
|
407
|
+
| `phone` | `android`, `ios` | `screen`, `input.touch`, `apps` | `input.keys`, `apps.install`, `ui`, `stream` |
|
|
408
408
|
| `browser` | `browser` | `cdp` | `stream`, `downloads` |
|
|
409
409
|
|
|
410
410
|
- `serves(capabilities, kind)` is true when `capabilities().kind` is one of the kind's machine kinds and every required
|
|
@@ -431,7 +431,7 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
431
431
|
| id | label | kinds | keys (required unless marked) | mounts | metered |
|
|
432
432
|
| --- | --- | --- | --- | --- | --- |
|
|
433
433
|
| docker | Docker | sandbox, desktop | none | bind | no |
|
|
434
|
-
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET` (optional) | archil | yes |
|
|
434
|
+
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET`, `DAYTONA_ARCHIL_EGRESS` (optional) | archil | yes |
|
|
435
435
|
| modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
|
|
436
436
|
| e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
|
|
437
437
|
| orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
|
|
@@ -486,7 +486,7 @@ itself, from our server (adb, a vendor API). Either way a connection's `client`
|
|
|
486
486
|
params, { signal })` and `close()`): `DaemonClient` over a stream, or a provider's in-process client.
|
|
487
487
|
|
|
488
488
|
**Groups.** `capabilities().groups` is one flat list, repeated in hello's `groups`: `exec`, `files`, `processes`,
|
|
489
|
-
`screen`, `input.pointer`, `input.keys`, `input.touch`, `apps`, `apps.install`, `
|
|
489
|
+
`screen`, `input.pointer`, `input.keys`, `input.touch`, `apps`, `apps.install`, `ui`, and the provider's
|
|
490
490
|
`cdp`, `stream`, `downloads`. Each is optional unless kind makes it Core. The drift check and Docker's `connect` refuse a hello whose kind or groups differ from what the
|
|
491
491
|
provider declares, either way.
|
|
492
492
|
|
|
@@ -496,8 +496,8 @@ provider declares, either way.
|
|
|
496
496
|
| `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
497
|
| `input.keys` | `input.actions`: `key` (one key pressed, or a combo released in reverse; `repeat`), `hold` (`ms`), `type` |
|
|
498
498
|
| `input.touch` | `input.actions`: `tap`, `long_press`, `swipe`, `pinch` (`scale` above 1 apart, below together), `button` (back, home, app_switch) |
|
|
499
|
-
| `apps`, `apps.install` | `apps.list` (`{ apps, foreground }`), `apps.launch`, `apps.terminate`; `apps.install({ path })` of a file already in the computer |
|
|
500
|
-
| `
|
|
499
|
+
| `apps`, `apps.install` | `apps.list` (`{ apps, foreground }`), `apps.launch({ id, url?, background? })`, `apps.terminate`; `apps.install({ path })` of a file already in the computer |
|
|
500
|
+
| `ui` | `ui.observe({ target?, full?, image?, since? })`: `{ state, app, window, nodes, diff?, image?, truncated }`, at most 5000 flat nodes, each `{ ref, role, name?, value?, id?, bounds, parent?, flags?, actions? }` with an ARIA role and bounds in window points. `ui.act({ target?, state?, steps, expect?, foreground? })`: `{ steps, state?, window?, changed, expect? }`, each step's `route` and `verified`, or its refusal (`stale`, `denied`, ...) as the last; `window: "closed"` in place of `state` when the app has no window left. `expect` is `{ text?, ref?, gone?, timeoutMs? }`, or `{ window: { title?, role? } }` to wait for a window. The rules are in [`wire.md`](../../spec/computer/wire.md#the-ui-group); `UiEngine` (`src/ui-engine.ts`) keeps them over a `UiSource`, `UiSession` (`src/client.ts`) is the typed caller, and `@parcha/agentrun-computer/fake-ui-driver` answers them from scripted apps for tests |
|
|
501
501
|
|
|
502
502
|
**The live view's seam** (`src/screen-watch.ts`). The runner's viewer reads a computer through
|
|
503
503
|
`provider.watch?(ref, handlers, { signal?, maxWidth?, quality? })`:
|
|
@@ -663,7 +663,7 @@ fixtures of every evasion it catches.
|
|
|
663
663
|
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
664
664
|
|
|
665
665
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
666
|
-
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" });
|
|
666
|
+
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
667
667
|
if (!made.ok) throw new Error(made.error.message);
|
|
668
668
|
const connected = await docker.connect(made.value);
|
|
669
669
|
if (connected.ok) {
|
|
@@ -673,6 +673,13 @@ if (connected.ok) {
|
|
|
673
673
|
await docker.release(made.value, "delete");
|
|
674
674
|
```
|
|
675
675
|
|
|
676
|
+
Every `create` takes a request id (`CreateContext.requestId`, required): the request, not the computer, so a retry of
|
|
677
|
+
the same request passes the same id. The contract makes one computer per id, named `computer-<12 hex of sha256(id)>`
|
|
678
|
+
(`computerNameFor`), answers it again while it starts or runs, and refuses `exists` once it has ended
|
|
679
|
+
([`spec/computer/provider.md`](../../spec/computer/provider.md#idempotent-create)). Docker names the container for the
|
|
680
|
+
request: a retry finds the name taken and answers that container, or `exists` when it is stopped, of another spec, or
|
|
681
|
+
was deleted.
|
|
682
|
+
|
|
676
683
|
- `capabilities()` declares kind `linux`, daemon `pid1`, groups `exec`, `files` and `processes`, `maxLifetimeMs`
|
|
677
684
|
of 30 days, and `mount: ["bind"]` (below); there is no `extend()` or `stream()`, and init gets no `--max-deadline`.
|
|
678
685
|
- `new DockerProvider({ daemonPath, desktop: {} })` makes desktops: kind `desktop`, with `screen`, `input.pointer` and
|
|
@@ -724,7 +731,7 @@ await docker.release(made.value, "delete");
|
|
|
724
731
|
PID 1 included. What lasts is the run's folder, bound at `/workspace` when the spec asks (below).
|
|
725
732
|
- `create` ends with the drift check (below): a computer that is not what was declared is deleted, and `create`
|
|
726
733
|
refuses with every mismatch in words.
|
|
727
|
-
- `create(spec, { signal })` passes the signal to every step: `docker info` before `docker run` (an abort there makes
|
|
734
|
+
- `create(spec, { requestId, signal })` passes the signal to every step: `docker info` before `docker run` (an abort there makes
|
|
728
735
|
nothing), `docker run`, and after it inspect and hello (hello also has its own 30 s limit). An abort at any step after `docker run` deletes the computer and returns
|
|
729
736
|
`aborted`; `create` never returns ok once its signal has aborted.
|
|
730
737
|
- `connect` runs `docker exec -i <name> /opt/agentrun/computerd stdio`, the bridge to init's socket, and says hello.
|
|
@@ -767,7 +774,7 @@ daemon, or run past its deadline.
|
|
|
767
774
|
### An allowlist: the egress proxy
|
|
768
775
|
|
|
769
776
|
```ts
|
|
770
|
-
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: { allow: ["pypi.org", "*.pythonhosted.org", "93.184.215.0/24"] } });
|
|
777
|
+
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: { allow: ["pypi.org", "*.pythonhosted.org", "93.184.215.0/24"] } }, { requestId: "r1#3" });
|
|
771
778
|
// In the computer, HTTP_PROXY and HTTPS_PROXY name port 3128 on its own loopback for every program computerd starts.
|
|
772
779
|
```
|
|
773
780
|
|
|
@@ -778,7 +785,7 @@ key.
|
|
|
778
785
|
|
|
779
786
|
- **The volume** `computer-<hex>-egress`: a tmpfs of 1 MiB, mode 0700, owned by the computer's uid:gid. The proxy
|
|
780
787
|
makes its Unix socket there (0600); the computer mounts it read-only at `/opt/agentrun/egress` (`EGRESS_MOUNT`).
|
|
781
|
-
- **The proxy container** `computer-<hex>-egress`: `node` in `EGRESS_IMAGE` (node:22.23.
|
|
788
|
+
- **The proxy container** `computer-<hex>-egress`: `node` in `EGRESS_IMAGE` (node:22.23.5-trixie-slim, pinned by
|
|
782
789
|
digest; `new DockerProvider({ daemonPath, egress: { image } })` replaces it) runs `dist/docker/egress-main.js`, this
|
|
783
790
|
package's own build, bound read-only with its `package.json`. It is on Docker's default bridge alone, publishes no
|
|
784
791
|
port, and runs as the computer's uid:gid with a read-only root, `--cap-drop ALL`, `no-new-privileges`, 256 MiB, 64
|
|
@@ -852,7 +859,7 @@ import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
|
852
859
|
|
|
853
860
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
854
861
|
// The run folder must exist, by its canonical path, and be writable by docker.user (below).
|
|
855
|
-
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/runs/r1/work" } });
|
|
862
|
+
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/runs/r1/work" } }, { requestId: "r1#3" });
|
|
856
863
|
// In the computer: files.read({ path: `${WORKSPACE}/notes.md` }), exec.run({ argv: ["make"], cwd: WORKSPACE, ... })
|
|
857
864
|
```
|
|
858
865
|
|
|
@@ -874,6 +881,14 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
|
|
|
874
881
|
`{ other: "<words>" }` for a mount at `/workspace` the provider never makes. An Archil mount's `epoch` is the
|
|
875
882
|
computer's `agentrun.epoch` label (Archil's hold on a folder carries none); an Archil mount with no epoch reads back
|
|
876
883
|
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
|
|
885
|
+
Archil only through a gateway, `<IPv4 gateway>:<mount lane>:<data lane>` (such as `10.60.0.40:18100:42050`, parcha-proxy's
|
|
886
|
+
archil-egress). The helper's mount then starts `computerd archil-relay` on the computer's loopback (127.0.0.1:3129) and
|
|
887
|
+
an nftables table of its own (`inet agentrun_archil`) that redirects root's TCP to 8100 (the mount endpoint) and 32050
|
|
888
|
+
(the file servers, at the raw addresses the mount endpoint returns) to the relay and resets every other TCP to those
|
|
889
|
+
ports. The relay sends each connection to the gateway's lane for its port with a PROXY v2 header naming the original
|
|
890
|
+
destination; the gateway admits only a destination that proves, by certificate, the Archil name the client asked for.
|
|
891
|
+
A relay that cannot reach the gateway closes the connection, so the client reaches nothing. Unset, nothing changes.
|
|
877
892
|
- **Docker takes a bind.** `create` adds `--mount type=bind,src=<path>,dst=/workspace` after the daemon's mount:
|
|
878
893
|
read-write, propagation `rprivate`. A path Docker's `--mount` cannot hold (a comma, a double quote, a line break) is
|
|
879
894
|
refused by `check`.
|
|
@@ -912,7 +927,7 @@ const docker = new DockerProvider({
|
|
|
912
927
|
daemonCache: "/data/computer-cache", // at or below volume.root
|
|
913
928
|
volume: { name: "agentrun_agentrun-data", root: "/data" },
|
|
914
929
|
});
|
|
915
|
-
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/disk/agents/a1/runs/r1/work" } });
|
|
930
|
+
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", mount: { kind: "bind", path: "/data/disk/agents/a1/runs/r1/work" } }, { requestId: "r1#3" });
|
|
916
931
|
```
|
|
917
932
|
|
|
918
933
|
- `volume: { name, root }`: `name` is the named volume, as `docker volume ls` names it; `root` is where this process
|
|
@@ -964,7 +979,7 @@ import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
|
964
979
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" }); // image: the default recipe
|
|
965
980
|
const image = await docker.image({ signal }); // built once; one inspect when Docker has it
|
|
966
981
|
if (!image.ok) throw new Error(image.error.message);
|
|
967
|
-
const made = await docker.create({ image: image.value, lifetimeMs: 600_000, network: "none" });
|
|
982
|
+
const made = await docker.create({ image: image.value, lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
968
983
|
```
|
|
969
984
|
|
|
970
985
|
- `ensureImage(source, { docker?, signal?, timeoutMs?, onWait? })` (`src/docker/image.ts`) gives the tag. `source` is
|
|
@@ -1146,7 +1161,7 @@ const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
|
1146
1161
|
// A claim at epoch 3 takes the run over: the computers of epochs 1 and 2 go first.
|
|
1147
1162
|
const older = await releaseOlder(docker, "r1", 3);
|
|
1148
1163
|
if (!older.ok) throw new Error(older.error.message); // fenced, or a computer that could not be released
|
|
1149
|
-
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", labels: runLabels("r1", 3) });
|
|
1164
|
+
await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none", labels: runLabels("r1", 3) }, { requestId: "r1#3" });
|
|
1150
1165
|
```
|
|
1151
1166
|
|
|
1152
1167
|
### Waiting for a vendor: `waitUntil`
|
|
@@ -1157,9 +1172,9 @@ reads at once, then after pauses that double from `minMs` (250 ms) to `maxMs` (5
|
|
|
1157
1172
|
returns the first state `done` accepts. Each read gets a signal that aborts at the bound or on the caller's abort; a
|
|
1158
1173
|
read still pending then is not waited for, and one that throws is not done. Past the bound it returns a `timeout`, on
|
|
1159
1174
|
the caller's abort an `aborted`, each naming `what` was waited for and the last state read (`describe`). It has no
|
|
1160
|
-
vendor's types:
|
|
1161
|
-
|
|
1162
|
-
|
|
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.
|
|
1163
1178
|
|
|
1164
1179
|
## Modal
|
|
1165
1180
|
|
|
@@ -1172,168 +1187,79 @@ const modal = new ModalProvider({
|
|
|
1172
1187
|
app: "computers",
|
|
1173
1188
|
// daemonPath: the daemon to upload; default this package's dist/computerd-linux-amd64 (npm run build:daemon)
|
|
1174
1189
|
});
|
|
1175
|
-
const made = await modal.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" });
|
|
1190
|
+
const made = await modal.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1176
1191
|
```
|
|
1177
1192
|
|
|
1178
|
-
|
|
1179
|
-
(apps, images, sandboxes and five methods of a sandbox)
|
|
1180
|
-
|
|
1193
|
+
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
|
|
1195
|
+
`src/hosted/provider.ts` does everything below that is not Modal's own. `create` takes the caller's request id
|
|
1196
|
+
(`{ requestId }`, serve's is the run's claim): the computer's name is `computer-` and the first 12 hex digits of its
|
|
1197
|
+
sha256, and a retry of the same request finds the computer the first made instead of making a second. A Modal sandbox
|
|
1198
|
+
runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests read what the provider hands the SDK
|
|
1199
|
+
(a recorder of the slice), never how Modal behaves; Modal's own lifecycle is proven by the live conformance kit.
|
|
1181
1200
|
|
|
1182
1201
|
- **Capabilities.** Kind `linux`, daemon `pid1`, groups `exec`, `files` and `processes`, `maxLifetimeMs` the
|
|
1183
1202
|
instance's cap (24 hours, or less with the `maxLifetimeMs` option), and user `uid` only, never `root` (below). Daemon
|
|
1184
1203
|
`pid1` because init is the sandbox's main process and its exit ends the computer (next item); no `extend` or
|
|
1185
1204
|
`stream`. Network `none` alone, and `vendorAgentPorts` empty: no listener of Modal's inside a sandbox is documented,
|
|
1186
1205
|
and isolation.vendor-agent checks the interfaces alone.
|
|
1187
|
-
- **The
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
one call, 360 s by default): if no daemon arrives by then, the entrypoint says so on stderr and exits 3, which ends
|
|
1201
|
-
the sandbox.
|
|
1202
|
-
|
|
1203
|
-
Right after create the provider runs `sh -c '<upload>' sh /opt/agentrun/computerd <sha256>` through
|
|
1204
|
-
`sandbox.exec([...], { mode: "binary" })` and streams `dist/computerd-linux-amd64` into its stdin, in the SDK's own
|
|
1205
|
-
256 KiB stdin chunks, then closes it. The script `cat`s stdin to `/opt/agentrun/.computerd.part`, makes it 0755,
|
|
1206
|
-
prints `sha256 <hex>` (`sha256sum`, BusyBox's is fine), and only when that is the sha256 it was given moves the part
|
|
1207
|
-
into place with `mv -f`. The rename is what the entrypoint waits for, so it never starts a half-written daemon or the
|
|
1208
|
-
wrong one. The provider compares the printed sha256 with its own, as the Daytona provider does. A failed, aborted,
|
|
1209
|
-
nonzero or mismatched upload, or one past `uploadMs` (5 min), terminates the sandbox and refuses in words. Then the
|
|
1210
|
-
drift check connects as below, trying the bridge again until init listens, within `helloMs`. Exec's stdin goes
|
|
1211
|
-
through Modal's command router, not the sandbox's network, so network none still works. The binary cannot go as an
|
|
1212
|
-
argument: the SDK refuses more than 64 KiB of argv. `modalCommands()` (in `dist/modal.js`) returns the entrypoint,
|
|
1213
|
-
upload and bridge exactly as sent. A Docker-gated test runs them in a root container with no network.
|
|
1214
|
-
- **Or as an image layer**, with `daemonImage`: `create` gives the spec's image `COPY --from=<daemonImage> /computerd
|
|
1215
|
-
/opt/agentrun/computerd`, and the command is `computerd init` itself. The JS SDK refuses a COPY from local files but
|
|
1216
|
-
takes `COPY --from` an image, so `daemonImage` is a registry image holding this version's daemon for linux/amd64 at
|
|
1217
|
-
`/computerd`, pinned by digest (the constructor refuses a tag, and `daemonImage` with `daemonPath`). One is two
|
|
1218
|
-
lines:
|
|
1219
|
-
|
|
1220
|
-
```dockerfile
|
|
1221
|
-
FROM scratch
|
|
1222
|
-
COPY dist/computerd-linux-amd64 /computerd
|
|
1223
|
-
```
|
|
1224
|
-
|
|
1225
|
-
Either way the image also gets `ENV HOME=/work` and `WORKDIR <workdir>`, and the computer needs no network to get
|
|
1226
|
-
its daemon.
|
|
1206
|
+
- **The daemon goes in through exec.** The sandbox's command is the adapter's pid1 entrypoint (`src/hosted/scripts.ts`,
|
|
1207
|
+
POSIX sh, BusyBox and coreutils alike): it waits, bounded, for `/opt/agentrun/computerd` to be there and executable,
|
|
1208
|
+
then `exec`s `computerd init --deadline <iso> --user <uid:gid> --own-network --max-deadline <iso>` with `HOME=/work`.
|
|
1209
|
+
Modal runs the command as the sandbox's main process and finishes the sandbox when it exits, so after the `exec`
|
|
1210
|
+
init is that process and the sandbox lives as long as init does. Whether that process is PID 1 is not documented;
|
|
1211
|
+
init reaps as a subreaper either way. If no daemon arrives within the wait, the entrypoint says so on stderr and
|
|
1212
|
+
exits 3, which ends the sandbox. Modal has no file API, so the adapter streams the daemon into `cat` as root through
|
|
1213
|
+
`sandbox.exec([...], { mode: "binary" })` (stdin in 256 KiB writes, the SDK's own chunk), then runs the shared install:
|
|
1214
|
+
it puts the daemon beside its path, `/opt/agentrun/computerd.part`, and moves it into place only once it reads the
|
|
1215
|
+
sha256 uploaded, so the entrypoint never starts a half-written daemon or another one. Exec's stdin goes through
|
|
1216
|
+
Modal's command router, not the sandbox's network, so network none still works. A Docker-gated test
|
|
1217
|
+
(`test/docker/pid1-commands.docker.test.mjs`) runs the entrypoint, the install and the bridge in a root container with
|
|
1218
|
+
no network.
|
|
1227
1219
|
- **The daemon becomes the computer's user.** Modal containers always run as root and ignore an image's `USER`, so
|
|
1228
|
-
`--user` is how a Modal computer gets the non-root default the protocol asks for (
|
|
1229
|
-
or the uid its spec asks for. Init leaves itself and every program
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
`/opt/agentrun` and the daemon owned by root (COPY's default; the daemon keeps its mode from the daemon image), not
|
|
1240
|
-
yet read back on Modal. Root with no capability still owns every one of them, so it could rename another program over
|
|
1241
|
-
the daemon and the next connection would run it with Modal's capabilities; no file mode closes that for the owner
|
|
1242
|
-
of every directory above the path. The Docker-gated `modal-commands` test shows uid 1000 cannot write the daemon,
|
|
1243
|
-
`/opt/agentrun`, `/opt` or `/`, and that init `--own-network` refuses uid 0 for its programs outright.
|
|
1244
|
-
- **The stream** is `computerd stdio` through `sandbox.exec([...], { mode: "binary" })`: its stdin and stdout are the
|
|
1245
|
-
`DaemonClient`'s stream. Modal has no kill for an exec, so `close()` ends the bridge's stdin and waits up to 5 s for
|
|
1246
|
-
it to exit. One deadline, `helloMs`, covers the exec's start (at most `callMs` of it) and the hello after it, so a
|
|
1247
|
-
connection fails at `helloMs` in all. An exec given up on (past its bound, or on the caller's abort) goes on at
|
|
1248
|
-
Modal; a bridge that lands after that has its stdin closed as it lands, so it ends.
|
|
1220
|
+
`--user` is how a Modal computer gets the non-root default the protocol asks for (2510:2510, or the `daemonUser`
|
|
1221
|
+
option), or the uid its spec asks for (`spec.user`, a uid or uid:gid in numbers). Init leaves itself and every program
|
|
1222
|
+
no capability in any set (see Init, above).
|
|
1223
|
+
- **A Modal computer never runs as root.** `check()` and `create()` refuse a spec whose `user` is root, in words, before
|
|
1224
|
+
any Modal call. Every connection is Modal's own exec of the adapter's stdio command, outside the daemon, with Modal's
|
|
1225
|
+
root capabilities; after the install `/opt/agentrun/computerd` and `/opt/agentrun` are `0:0 755`, and `/` and `/opt`
|
|
1226
|
+
are the image's, `0:0 755` in Debian and Alpine, so a computer user that is not root cannot touch that path, and the
|
|
1227
|
+
stdio command runs the daemon only while its path is root's alone. Root with no capability would still own every one
|
|
1228
|
+
of them. attach reads the user back from inside and refuses root.
|
|
1229
|
+
- **The stream** is the adapter's stdio command through `sandbox.exec`: its stdin and stdout are the `DaemonClient`'s
|
|
1230
|
+
stream. Modal has no kill for an exec, so the host's `kill` ends the bridge's stdin, which ends it.
|
|
1249
1231
|
- **Lifetime is Modal's.** Every sandbox's `timeoutMs` is its lifetime, rounded up to whole seconds, so Modal ends it
|
|
1250
|
-
then whatever runs in it. The longest is 24 hours, or less with the `maxLifetimeMs` option
|
|
1251
|
-
|
|
1252
|
-
- **Network.** `none` is `blockNetwork: true`, and the daemon's programs have their own loopback alone besides
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
`
|
|
1257
|
-
`8.8.8.8:443`, `[2606:4700:4700::1111]:443`, and DNS over UDP to `1.1.1.1:53/udp` and
|
|
1258
|
-
`[2606:4700:4700::1111]:53/udp`, or the `probeTargets` option). A computer with network none that any of
|
|
1259
|
-
them answers is terminated at create, refused by attach, and reads back as another network in words; one that only
|
|
1260
|
-
accepted, sending nothing back, is kept, the targets named in `notes` (see
|
|
1261
|
-
[Network none, read from inside](#network-none-read-from-inside-nothing-answers)). This shows those addresses are
|
|
1262
|
-
blocked, not every one. An allowlist is refused: Modal's CIDR allowlist (any protocol,
|
|
1263
|
-
every port) and its domain allowlist (beta, TLS on 443 by SNI only) cannot be read back, so per ruling 9 an
|
|
1264
|
-
allowlist counts only once the live bypass cases pass. A change of network is refused: blockNetwork cannot be
|
|
1265
|
-
updated, and an allowlist only if one was set at create.
|
|
1266
|
-
- **The drift check** after create: `poll()` is null (it runs), `getTags()` reads back exactly the tags given, hello's
|
|
1267
|
-
version, os, arch (`amd64`), kind (`linux`) and exact groups match, and the probe's uid:gid is the computer's user, its kernel is
|
|
1268
|
-
not gVisor's (`4.19.0-gvisor`), and with network none none of its targets answered. A mismatch, an abort or a timeout
|
|
1269
|
-
terminates the sandbox and refuses in words. The SDK reads back no runtime, image or size: the probe's kernel is the
|
|
1270
|
-
only runtime read-back, and image and sizes are what create recorded in a tag only the host's token writes.
|
|
1232
|
+
then whatever runs in it. The longest is 24 hours, or less with the `maxLifetimeMs` option; `check` refuses a longer
|
|
1233
|
+
one with `checkLifetime`, the rule every provider shares. `sweep` refuses a Modal provider.
|
|
1234
|
+
- **Network.** `none` is `blockNetwork: true`, and the daemon's programs have their own loopback alone besides; an
|
|
1235
|
+
Archil computer's sandbox keeps Modal's network on for root to reach Archil, and its tools' none is init's own. Modal
|
|
1236
|
+
has no read-back of a sandbox's policy, so `networkReadBack` is false and the probe from inside stands for one, at
|
|
1237
|
+
create, attach and `network(ref)` (see [Network none, read from inside](#network-none-read-from-inside-nothing-answers)).
|
|
1238
|
+
`open` and an allowlist are refused in words, and a change of network after create is refused.
|
|
1271
1239
|
- **Sizes are limits**, as in Docker: `cpus` (at least 0.25) becomes `cpuLimit` in physical cores (2 CPUs each) and
|
|
1272
|
-
`memoryMb` becomes `memoryLimitMiB`, each with Modal's default request (0.125 cores, 128 MiB) or less. `pids`
|
|
1273
|
-
refused: Modal has no pids limit.
|
|
1274
|
-
- **Tags.** A sandbox
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
- **release** `delete` is `terminate()`,
|
|
1282
|
-
|
|
1283
|
-
an exit code or Modal no longer knows the sandbox, with pauses that double from `releasePollMs` (500 ms) to 5 s,
|
|
1284
|
-
within `releaseMs` (120 s) and the caller's signal. Past the bound it is a `timeout` that says what `poll()` last
|
|
1285
|
-
read; it never reports a delete done that it did not read back. A caller that bounds release (the conformance
|
|
1286
|
-
runner's `cleanupTimeoutMs`) gives it more than 120 s: the live suite passes 150 s.
|
|
1287
|
-
`capabilities().release` is `["delete"]`, so `stop` is refused as `unsupported`, in words, and the sandbox runs on:
|
|
1288
|
-
terminate is a sandbox's only end, and Modal has no stopped state. `release`, `connect` and
|
|
1289
|
-
`network` act only on a sandbox whose tags name it as this provider's, with the ref's name.
|
|
1290
|
-
- **Every call is bounded** (`timeouts`: create 10 min, which covers the layer's build and scheduling; the upload 5
|
|
1291
|
-
min; other calls 60 s; a connection, from the bridge's exec to hello, and the probe 30 s; a whole list 120 s; release's wait 120 s) and takes the caller's
|
|
1292
|
-
signal. A create that gives up has its
|
|
1293
|
-
sandbox terminated if one lands later. A create that refuses its sandbox (drift, an abort, a failed upload)
|
|
1294
|
-
terminates it and waits as release does, within `releaseMs`, so nothing is left listed when it returns. The terminate
|
|
1295
|
-
is sent whatever the caller's signal; the wait takes it, so an aborted create returns at once, and a wait past the
|
|
1296
|
-
bound or cut short by an abort says the sandbox may still be ending and what `poll()` last read. Before that
|
|
1297
|
-
terminate, a create whose sandbox's own command had ended says so: its exit code and the tail of its output. When
|
|
1298
|
-
Modal refuses an exec with FAILED_PRECONDITION ("Modal Sandbox is shutting down", code `gone`), the command, init, has
|
|
1299
|
-
just exited and Modal ends the sandbox asynchronously, so create first waits up to `endedMs` (30 s) for `poll()` to
|
|
1300
|
-
read it finished, then reads init's words. The first GPU live run on gVisor ended this way, with no words.
|
|
1240
|
+
`memoryMb` becomes `memoryLimitMiB`, each with Modal's default request (0.125 cores, 128 MiB) or less. `pids` and
|
|
1241
|
+
`workdir` are refused: Modal has no pids limit, and a computer works in `/work`, its home.
|
|
1242
|
+
- **Tags.** A sandbox's tags are the adapter's labels (`agentrun.computer`, its name, deadline, image and the most its
|
|
1243
|
+
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
|
|
1248
|
+
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.
|
|
1250
|
+
`stop` is refused as `unsupported`: terminate is a sandbox's only end.
|
|
1301
1251
|
- **GPU.** `capabilities().gpu` declares Modal's GPU types by its own names (guide/gpu): `T4`, `L4`, `A10`, `L40S`,
|
|
1302
|
-
`A100` (40 GB), `A100-40GB`, `A100-80GB`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B300`, at most 8 to a computer
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
mode, as a serve sandbox always mounts the run's folder; the library takes one without a mount.
|
|
1314
|
-
- **The loopback fence on gVisor.** A GPU computer's init gets the same network namespace of its own, loopback alone,
|
|
1315
|
-
made another way.
|
|
1316
|
-
- Modal's gVisor gives root no CAP_SYS_ADMIN, so `unshare(CLONE_NEWNET)` is EPERM. With `--own-network`, init refused
|
|
1317
|
-
to start there (live on a T4, 11-10).
|
|
1318
|
-
- It does let root make a user namespace with a network namespace inside it (`unshare -Urn`, live on a T4, 11-11, as
|
|
1319
|
-
root and as nobody; nothing of Modal's runs or listens inside a gVisor sandbox, and every loopback port answered
|
|
1320
|
-
nothing).
|
|
1321
|
-
- So init, given the same `--own-network` on every runtime, makes the namespace inside a user namespace when root's
|
|
1322
|
-
own attempt is EPERM (the daemon's fallback, any vendor: see "Where root may not make the network namespace").
|
|
1323
|
-
- The first init stays PID 1 with no capability and no_new_privs set. It passes SIGTERM and SIGINT on and ends with
|
|
1324
|
-
the init that serves, so the sandbox lives as long as that one does.
|
|
1325
|
-
- Declared: `gpu.fence: "userns-netns"`. Read back: hello's `fence` on every connect, which the drift check requires
|
|
1326
|
-
to be one of the two. Create notes it when it is `userns-netns`, and the conformance report records it under the GPU
|
|
1327
|
-
computer's own name and role (`daemons[].fence`).
|
|
1328
|
-
- Proven in Docker. In `test/docker/modal-commands.docker.test.mjs`, a root container with Docker's default
|
|
1329
|
-
capabilities and no seccomp profile stands in for gVisor:
|
|
1330
|
-
- `--own-network` falls back and serves;
|
|
1331
|
-
- hello says `userns-netns`;
|
|
1332
|
-
- the programs run as 1000 with no capability, in another network and user namespace than PID 1's, on the loopback
|
|
1333
|
-
alone;
|
|
1334
|
-
- what they write in HOME is 1000's from outside;
|
|
1335
|
-
- with Docker's default seccomp profile (no user namespace either), init refuses in words that name both ways.
|
|
1336
|
-
- Not yet proven live on Modal.
|
|
1252
|
+
`A100` (40 GB), `A100-40GB`, `A100-80GB`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B300`, at most 8 to a computer.
|
|
1253
|
+
`spec.gpu: { type, count }` becomes the SDK's `gpu` (`"T4"`, `"A100-80GB:2"`), and since Modal offers GPUs on gVisor
|
|
1254
|
+
only, such a sandbox runs with `runtime: "gvisor"`; every other computer stays on the VM runtime. The probe's kernel
|
|
1255
|
+
is held to it at create: gVisor's on a GPU computer, a VM's on any other. Modal reads no GPU back, so attach reports
|
|
1256
|
+
none. `gpu.mounts` is `[]`: a GPU with an Archil mount is refused (checkGpu).
|
|
1257
|
+
- **The loopback fence on gVisor.** Modal's gVisor gives root no CAP_SYS_ADMIN, so init, given the same
|
|
1258
|
+
`--own-network`, makes its programs' network namespace inside a user namespace (the daemon's fallback, any vendor).
|
|
1259
|
+
Declared: `gpu.fence: "userns-netns"`; read back: hello's `fence`, and create notes it. Proven in Docker
|
|
1260
|
+
(`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.
|
|
1337
1263
|
|
|
1338
1264
|
### What every Modal fact rests on
|
|
1339
1265
|
|
|
@@ -1355,7 +1281,7 @@ unless they start with `modal_proto/`. Docs: modal.com, read 2026-11-05.
|
|
|
1355
1281
|
| Whether the main process is PID 1 | not documented (searched `modal-docs`, `js/src`, `modal-libmodal`: none) |
|
|
1356
1282
|
| Modal containers always run as root; `USER` is ignored | [guide/existing-images#user](https://modal.com/docs/guide/existing-images#user) |
|
|
1357
1283
|
| Images must be `linux/amd64` | [guide/existing-images](https://modal.com/docs/guide/existing-images) |
|
|
1358
|
-
| `images.fromRegistry(tag)`; `dockerfileCommands(commands)` adds a layer
|
|
1284
|
+
| `images.fromRegistry(tag)`; `dockerfileCommands(commands)` adds a layer | `image.ts:196-210`, `351-401` |
|
|
1359
1285
|
| Modal's Dockerfile lacks only `EXPOSE`, `HEALTHCHECK`, `LABEL`, `ONBUILD`, `STOPSIGNAL`, `VOLUME` | [guide/existing-images](https://modal.com/docs/guide/existing-images) |
|
|
1360
1286
|
| `sandbox.exec(argv, { mode: "binary" })` gives `stdin` (`writeBytes`, `close`), `stdout`, `stderr` and `wait()` | `sandbox.ts:1272-1290`, `1881-1949`, `2774-2914`; `streams.ts:13-39`, `114-140` |
|
|
1361
1287
|
| exec starts through the task command router; each stdin write is one `TaskExecStdinWrite` at the running offset, and close sends EOF | `sandbox.ts:1915-1926`, `3126-3154`; `modal_proto/task_command_router.proto:420-421` |
|
|
@@ -1368,7 +1294,6 @@ unless they start with `modal_proto/`. Docs: modal.com, read 2026-11-05.
|
|
|
1368
1294
|
| `getTags()`, `poll()` (null while running, else the exit code), `terminate()` | `sandbox.ts:1813-1838`, `2761-2772`, `2238-2252` |
|
|
1369
1295
|
| `terminate()` returns once the request is sent; it waits for the sandbox to finish only with `{ wait: true }` | `sandbox.ts:1292-1296`, `2238-2251` |
|
|
1370
1296
|
| `poll()` is `SandboxWait` with timeout 0: null until the server reports a result, then its exit code (137 when terminated) | `sandbox.ts:1491-1511`, `1974-1980`, `2761-2771` |
|
|
1371
|
-
| `sandboxes.fromId(id)` makes a handle with no call | `sandbox.ts:960-962` |
|
|
1372
1297
|
| terminate sends SIGKILL: a terminated sandbox's code is 137 | [guide/sandboxes#return-codes](https://modal.com/docs/guide/sandboxes#return-codes) |
|
|
1373
1298
|
| A sandbox carries up to 10 tags | [guide/sandboxes#tagging](https://modal.com/docs/guide/sandboxes#tagging) |
|
|
1374
1299
|
| `apps.fromName(name, { createIfMissing })` | `app.ts:32-61` |
|
|
@@ -1387,25 +1312,7 @@ unless they start with `modal_proto/`. Docs: modal.com, read 2026-11-05.
|
|
|
1387
1312
|
| `ModalClient` declares `endpoint` and never reads it; `getProfile` runs once, at construction, and the control-plane client is made then | `client.ts:51`, `123`, `175`, `281` |
|
|
1388
1313
|
| With a profile's `sandboxV2`, create and list go to the V2 backend, and list then covers both | `sandbox.ts:808-815`, `884-889`, `1116-1122`, `1161-1175` |
|
|
1389
1314
|
|
|
1390
|
-
###
|
|
1391
|
-
|
|
1392
|
-
Nothing here has run against Modal. Once the lead OKs a key by name, `AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal
|
|
1393
|
-
-w @parcha/agentrun-computer` runs the conformance suite (`test/modal/`), and should settle:
|
|
1394
|
-
|
|
1395
|
-
- that the image's `sh` runs the entrypoint as the main process, and the upload streams in through exec's stdin with
|
|
1396
|
-
network none, within `uploadMs`, and its sha256 reads back;
|
|
1397
|
-
- with `COMPUTER_MODAL_DAEMON_IMAGE` only: that Modal's builder takes `COPY --from=<registry image>@sha256:...` and
|
|
1398
|
-
keeps the file's mode 0755;
|
|
1399
|
-
- that `computerd init` starts as root and `--user` drops as it does under Docker; whether it is PID 1 on the VM runtime
|
|
1400
|
-
(init says so on stderr when it is not, and still reaps as a subreaper);
|
|
1401
|
-
- that a workdir other than `/work` exists before the command starts, and `/run` is writable there;
|
|
1402
|
-
- the tag value's longest length (the spec tag is JSON) and whether `getTags` answers for a terminated sandbox;
|
|
1403
|
-
- that `terminate` of a finished sandbox does not throw; a live run saw `list` still yield a sandbox right after its
|
|
1404
|
-
terminate, which `release` and `list` now wait out and leave out (above);
|
|
1405
|
-
- the probe's view of `blockNetwork`, and the bypass cases before any allowlist is declared.
|
|
1406
|
-
|
|
1407
|
-
Core `provider.stop` expects Modal's refusal (it declares no stop), and the Full `provider.janitor` case is skipped
|
|
1408
|
-
(`lifetime:janitor`, `release:stop`).
|
|
1315
|
+
### The token, the server and the live run
|
|
1409
1316
|
|
|
1410
1317
|
`create(options)` in `dist/modal.js` builds a real client from `options.tokenId` and `options.tokenSecret`, and the
|
|
1411
1318
|
provider in `options.app` (required: without it, it refuses in words naming the option, before any client). It reads no
|
|
@@ -1413,45 +1320,29 @@ setting from the environment (see [Settings](#settings)) and passes the token to
|
|
|
1413
1320
|
`MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET` on the host is never used. The key goes only to `options.serverUrl`, else the
|
|
1414
1321
|
SDK's default `https://api.modal.com:443`: since the client cannot take a server, it refuses while `MODAL_SERVER_URL`
|
|
1415
1322
|
is set, and sets it to its choice only while it constructs the client, one construction at a time and put back after
|
|
1416
|
-
each, so neither `MODAL_PROFILE` nor a profile in `MODAL_CONFIG_PATH` or `~/.modal.toml` can redirect the key.
|
|
1417
|
-
|
|
1418
|
-
is uploaded); without it, it is uploaded from `options.daemonPath`, else `dist/computerd-linux-amd64`, so a run
|
|
1419
|
-
publishes nothing.
|
|
1323
|
+
each, so neither `MODAL_PROFILE` nor a profile in `MODAL_CONFIG_PATH` or `~/.modal.toml` can redirect the key. The
|
|
1324
|
+
daemon is uploaded from `options.daemonPath`, else `dist/computerd-linux-amd64`, so a run publishes nothing.
|
|
1420
1325
|
|
|
1421
1326
|
The conformance module, `dist/conformance/modal.js` (`--provider modal`), reads the run's settings from its own names
|
|
1422
1327
|
(`settingsFromEnv`) and passes each to `create()` as its option: `COMPUTER_MODAL_TOKEN_ID` and
|
|
1423
1328
|
`COMPUTER_MODAL_TOKEN_SECRET` (never `MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET`: a host may hold a production token under
|
|
1424
1329
|
those names, and with only them set it refuses, naming the `COMPUTER_MODAL_` pair), `COMPUTER_MODAL_APP`, and, if set,
|
|
1425
|
-
`COMPUTER_MODAL_SERVER_URL
|
|
1426
|
-
`
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
is its lifetime, and a longer one is refused in words. The modal package is the host's; it is imported only when a
|
|
1430
|
-
provider is made.
|
|
1330
|
+
`COMPUTER_MODAL_SERVER_URL`. It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
|
|
1331
|
+
anything else. Its `createDriftedProvider()` uploads a daemon it builds with Go as version `<version>-drift`, so Go must
|
|
1332
|
+
be on PATH. Every computer of a run gets `maxLifetimeMs` 30 minutes. Core `provider.stop` expects Modal's refusal (it
|
|
1333
|
+
declares no stop), and the Full `provider.janitor` case is skipped (`lifetime:janitor`, `release:stop`).
|
|
1431
1334
|
|
|
1432
|
-
A live run is wrapped in the sweep,
|
|
1433
|
-
`COMPUTER_MODAL_TOKEN_SECRET`, `COMPUTER_MODAL_APP` and `COMPUTER_MODAL_SERVER_URL`, through the conformance module's
|
|
1434
|
-
`settingsFromEnv`, and makes its client the same pinned way (an ambient `MODAL_SERVER_URL` is refused; it needs no live switch, since it makes nothing):
|
|
1335
|
+
A live run is wrapped in the one sweep, with the same settings (it needs no live switch, since it makes nothing):
|
|
1435
1336
|
|
|
1436
1337
|
```sh
|
|
1437
|
-
node packages/computer/dist/conformance/
|
|
1338
|
+
node packages/computer/dist/conformance/sweep.js --provider modal --before /tmp/modal-before.json
|
|
1438
1339
|
AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal -w @parcha/agentrun-computer
|
|
1439
|
-
node packages/computer/dist/conformance/
|
|
1340
|
+
node packages/computer/dist/conformance/sweep.js --provider modal --after /tmp/modal-before.json
|
|
1440
1341
|
```
|
|
1441
1342
|
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
server is not the one the environment names now, or that names none: every computer of another app would read as
|
|
1446
|
-
new. Otherwise it reads the tags (`getTags()`) of every such sandbox not in that file and terminates each that carries
|
|
1447
|
-
a conformance run's label (`agentrun.conformance`, which every computer of a run carries): one another user of the app
|
|
1448
|
-
made during the run, with no such label, is left alone, and so is one whose tags it cannot read (said on stderr). It
|
|
1449
|
-
reads each terminated sandbox back through `sandboxes.fromId` and `poll()` until it reports an exit code or Modal no
|
|
1450
|
-
longer knows it (up to 60 s each), and prints one line, `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`, where
|
|
1451
|
-
`leftAlone` counts the new sandboxes it did not terminate. It exits 0 when
|
|
1452
|
-
every swept sandbox has finished, 1 when one still runs, and 2 on a usage error, an unreadable before file or one of
|
|
1453
|
-
another app or server, a missing token or app, or a listing Modal refused, having terminated nothing. A sandbox in the before file is never
|
|
1454
|
-
named by any call.
|
|
1343
|
+
Its output is `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`, as for every provider on the adapter. The before
|
|
1344
|
+
file records where it listed, the app and the server (`sweepScope`), and `--after` refuses, exit 2, before it lists
|
|
1345
|
+
anything, a file of another app or server, or one that names none: every computer there would read as new.
|
|
1455
1346
|
|
|
1456
1347
|
## Daytona
|
|
1457
1348
|
|
|
@@ -1459,11 +1350,11 @@ named by any call.
|
|
|
1459
1350
|
import { DaytonaProvider } from "@parcha/agentrun-computer/daytona";
|
|
1460
1351
|
|
|
1461
1352
|
const daytona = new DaytonaProvider({ apiKey, daemonPath: "dist/computerd-linux-amd64" });
|
|
1462
|
-
const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, network: "none" });
|
|
1353
|
+
const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1463
1354
|
```
|
|
1464
1355
|
|
|
1465
|
-
A Daytona computer is a sandbox made through Daytona's v0 REST API with `fetch
|
|
1466
|
-
|
|
1356
|
+
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.
|
|
1467
1358
|
The key is the caller's to pass: the provider never reads the environment, never sends the key over a redirect or to a
|
|
1468
1359
|
toolbox URL that is not https, and never puts it in a computer. `image` is a Daytona snapshot, by id or name: the
|
|
1469
1360
|
snapshot gives the sandbox its class and its size. `image: "default"` sends no snapshot field at all, and Daytona makes
|
|
@@ -1493,7 +1384,10 @@ stopped one.
|
|
|
1493
1384
|
Daytona runs its own toolbox daemon as the sandbox's first process, and a snapshot we do not build has no `computerd`.
|
|
1494
1385
|
So the provider pushes it in at create and starts it as a long-lived command, and reaches it the same way:
|
|
1495
1386
|
|
|
1496
|
-
1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random
|
|
1387
|
+
1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random>`:
|
|
1388
|
+
`/files/upload-v2`, or `/files/upload` when the toolbox answers 404 for it. An older toolbox, as a self-hosted
|
|
1389
|
+
Daytona's runners may run, serves only `/files/upload`, which takes the same form; any other refusal is not retried
|
|
1390
|
+
on the older route.
|
|
1497
1391
|
2. Install it with `/process/execute` (the command is piped to the sandbox's shell): root-owned, mode 755, at
|
|
1498
1392
|
`/opt/agentrun/computerd`, and make `/work` (its home) and `/run/agentrun` (its socket's directory). As root, or
|
|
1499
1393
|
through passwordless `sudo`; a sandbox with neither is refused in the script's words. The script prints the
|
|
@@ -1579,7 +1473,7 @@ the TTL.
|
|
|
1579
1473
|
| `user` | none | the daemon runs as the provider's `daemonUser`; a spec cannot name a user |
|
|
1580
1474
|
| `release` | `stop`, `delete` | `POST /sandbox/{id}/stop` and `DELETE /sandbox/{id}` |
|
|
1581
1475
|
| `stopDeletes` | `true` with `autoDeleteMinutes: 0`, else `false` | `autoDeleteInterval` 0 deletes a sandbox as soon as it stops |
|
|
1582
|
-
| `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:
|
|
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 |
|
|
1583
1477
|
|
|
1584
1478
|
### What the provider does
|
|
1585
1479
|
|
|
@@ -1614,8 +1508,8 @@ the TTL.
|
|
|
1614
1508
|
/sandbox/{id}/network-settings` and reads it back whatever the answer: as asked, it is returned; unchanged, the
|
|
1615
1509
|
change is refused in Daytona's words; anything else is put back, or, if that fails, the network is blocked, and the
|
|
1616
1510
|
change is refused. A network is never left wider than asked.
|
|
1617
|
-
- `release(ref, "delete")` deletes
|
|
1618
|
-
|
|
1511
|
+
- `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
|
|
1619
1513
|
not this provider's.
|
|
1620
1514
|
- Daytona is asynchronous: it answers a delete by setting the sandbox's desired state to `destroyed` and a stop by
|
|
1621
1515
|
setting it to `stopped`, and the sandbox gets there later, through `destroying` or `stopping`. Its listing trails
|
|
@@ -1630,7 +1524,7 @@ the TTL.
|
|
|
1630
1524
|
the sandbox it made (a failure, a mismatch, an abort) waits the same way before it returns.
|
|
1631
1525
|
- `connect(ref)` refuses a computer that is not `started`, and a daemon whose hello is not the provider's.
|
|
1632
1526
|
- Every call has its own timeout and takes the caller's signal; reads, the upload and deletes are retried (three tries,
|
|
1633
|
-
backoff)
|
|
1527
|
+
backoff); creates, session commands, input and network changes are not.
|
|
1634
1528
|
|
|
1635
1529
|
### The drift check
|
|
1636
1530
|
|
|
@@ -1660,8 +1554,8 @@ organization's), `daemonPath`, `arch` (`amd64` or `arm64`), `sandboxClass` (`con
|
|
|
1660
1554
|
The conformance module, `dist/conformance/daytona.js` (`--provider daytona`), reads the run's settings by these names
|
|
1661
1555
|
when it runs (`settingsFromEnv`) and passes each to `create()` as the option in brackets: `COMPUTER_DAYTONA_API_KEY`
|
|
1662
1556
|
(`apiKey`, required), `COMPUTER_DAYTONA_API_URL` (`apiUrl`), `COMPUTER_DAYTONA_DAEMON` (`daemonPath`),
|
|
1663
|
-
`COMPUTER_DAYTONA_ARCH` (`arch`), `COMPUTER_DAYTONA_TARGET` (`target`), `COMPUTER_DAYTONA_CLASS` (`sandboxClass`)
|
|
1664
|
-
`COMPUTER_DAYTONA_USER` (`daemonUser`). It exports `createProvider()` and `createDriftedProvider()` (which builds a
|
|
1557
|
+
`COMPUTER_DAYTONA_ARCH` (`arch`), `COMPUTER_DAYTONA_TARGET` (`target`), `COMPUTER_DAYTONA_CLASS` (`sandboxClass`),
|
|
1558
|
+
`COMPUTER_DAYTONA_USER` (`daemonUser`) and `COMPUTER_DAYTONA_GPU_SNAPSHOT` (`gpuSnapshot`). It exports `createProvider()` and `createDriftedProvider()` (which builds a
|
|
1665
1559
|
daemon of another version with Go), and reads `COMPUTER_DAYTONA_SNAPSHOT` (the run's image; unset, `"default"`,
|
|
1666
1560
|
Daytona's default snapshot). It never reads `DAYTONA_API_KEY`, `DAYTONA_API_URL` or `DAYTONA_TARGET`, not even as a
|
|
1667
1561
|
fallback: on a host that runs other Daytona work they may hold another organization's key. Those are serve's names,
|
|
@@ -1743,6 +1637,7 @@ repository's main; the docs were read on 2026-11-05.
|
|
|
1743
1637
|
| `GET /sandbox/{sandboxId}/toolbox-proxy-url`; the toolbox at `toolboxProxyUrl` + `/` + id | `daytona/clients@8006f63e:openapi-specs/api.json:5235`; `daytona/clients@8006f63e:sdk-typescript/src/Sandbox.ts:1566-1573` |
|
|
1744
1638
|
| `Authorization: Bearer <key>` | `daytona/clients@8006f63e:sdk-typescript/src/Daytona.ts:444` |
|
|
1745
1639
|
| `POST /files/upload-v2?path=`, multipart field `file` | `daytona/clients@8006f63e:openapi-specs/toolbox.json:2031` |
|
|
1640
|
+
| `POST /files/upload?path=`, multipart field `file`, on a toolbox with no `/files/upload-v2` | `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/toolbox/server.go:191`, `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/toolbox/fs/upload_file.go:22-35` |
|
|
1746
1641
|
| `POST /process/execute` `{command, timeout}` to `{exitCode, result}`; the command piped to the shell | `daytona/clients@8006f63e:openapi-specs/toolbox.json:3234`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:4679`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:4703`; `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/toolbox/process/execute.go:55-57` |
|
|
1747
1642
|
| `POST /process/session` `{sessionId}`; a session's shell runs as the toolbox's own user | `daytona/clients@8006f63e:openapi-specs/toolbox.json:3636`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:4525`; `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/session/create.go:20-24` |
|
|
1748
1643
|
| `POST /process/session/{sessionId}/exec` `{command, runAsync, suppressInputEcho}` to `{cmdId}` | `daytona/clients@8006f63e:openapi-specs/toolbox.json:4017`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:5922`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:5935` |
|
|
@@ -1784,9 +1679,15 @@ import { providerFor } from "@parcha/agentrun-computer";
|
|
|
1784
1679
|
|
|
1785
1680
|
// The key is the caller's to pass (serve's E2B_API_KEY), and the e2b package is the host's own (npm e2b 2.63.0).
|
|
1786
1681
|
const e2b = await providerFor("e2b", { apiKey });
|
|
1787
|
-
const made = await e2b.create({ image: "desktop", lifetimeMs: 600_000, network: "none" });
|
|
1682
|
+
const made = await e2b.create({ image: "desktop", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1788
1683
|
```
|
|
1789
1684
|
|
|
1685
|
+
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
|
|
1687
|
+
E2B's own. `create` takes the caller's request id (`{ requestId }`, serve's is the run's claim): the computer's name is
|
|
1688
|
+
`computer-` and the first 12 hex digits of its sha256, and a retry of the same request finds the computer the first
|
|
1689
|
+
made instead of making a second.
|
|
1690
|
+
|
|
1790
1691
|
An E2B computer is a sandbox made from an E2B template, by default `desktop`, E2B Desktop's (Ubuntu 22.04 with Xvfb,
|
|
1791
1692
|
Xfce, x11vnc and noVNC, e2b-dev/desktop `template/template.py:3-65`). It is kind `desktop`: computerd starts the X
|
|
1792
1693
|
server itself, as on a Docker desktop, and its X11 shim drives it. With `kind: "linux"` it is kind `linux`
|
|
@@ -1826,14 +1727,14 @@ E2B's envd is the sandbox's first process, a systemd service with `Restart=alway
|
|
|
1826
1727
|
passes, and the sandbox found is killed and read back gone, as release waits for one.
|
|
1827
1728
|
2. `getInfo` reads the sandbox back (below).
|
|
1828
1729
|
3. `files.write` uploads the daemon as root to `/tmp/agentrun-computerd-<random>` (`index.mjs:2332-2435`), and the
|
|
1829
|
-
same install command as Daytona's (`src/
|
|
1830
|
-
sha256, which must be the uploaded one's.
|
|
1831
|
-
4.
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
timeout
|
|
1836
|
-
would end
|
|
1730
|
+
same install command as Daytona's (`src/hosted/scripts.ts`) moves it to `/opt/agentrun/computerd`, root-owned, and
|
|
1731
|
+
prints its sha256, which must be the uploaded one's, and who installed it (a create note).
|
|
1732
|
+
4. The adapter's start command, a background command as root, starts `computerd init --deadline <time> --user
|
|
1733
|
+
2510:2510 --own-network --max-deadline <create's time plus the cap>` with `DISPLAY=:0`, in a clean environment,
|
|
1734
|
+
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`).
|
|
1837
1738
|
5. `connect()` starts `computerd stdio` the same way, as root, with `stdin: true` and `retainOutput: false` (so a long
|
|
1838
1739
|
connection keeps no copy of its output, `index.mjs:2708-2711`, `5150-5153`): its stdout comes through `onStdout`
|
|
1839
1740
|
(decoded as a stream, `index.mjs:2860`), and requests go in with `sendStdin`, one call after another.
|
|
@@ -1899,7 +1800,7 @@ hostname from the connection's first bytes, decides, and closes a denied connect
|
|
|
1899
1800
|
E2B documents no stricter setting: `allowInternetAccess: false` is `denyOut 0.0.0.0/0`, and `dnsServers` matters only
|
|
1900
1801
|
with a domain in `allowOut`. Under the shared rule only an answer refuses network none, so such a sandbox is kept, and
|
|
1901
1802
|
create's and attach's `notes` name the accepted targets: `network: none; accepted with no answer (no bytes came back):
|
|
1902
|
-
1.1.1.1:443, 8.8.8.8:443`. The one live diagnostic (
|
|
1803
|
+
1.1.1.1:443, 8.8.8.8:443`. The one live diagnostic (2026-11-07, a tool since removed) read that: every IPv4 target on 443/tcp and 80/tcp accepted
|
|
1903
1804
|
and closed with 0 bytes, no answer on 53/udp, and, in the provider's own probe, no accept from the IPv6 target. UDP
|
|
1904
1805
|
is not proxied: the same firewall drops non-TCP to the user deny set, which `denyOut` fills, in nftables
|
|
1905
1806
|
(`e2b-dev/infra@ff3922213` `packages/orchestrator/pkg/sandbox/network/firewall.go`, `installRules`, rule 5), so the probe's UDP targets get no reply within the 10 s window
|
|
@@ -1913,14 +1814,6 @@ both ways, since the first byte back refuses network none; it does not catch a o
|
|
|
1913
1814
|
inside can. That is the rule for every provider, confirmed on 11-07, and why every
|
|
1914
1815
|
accept is recorded in words rather than dropped.
|
|
1915
1816
|
|
|
1916
|
-
`dist/conformance/e2b-diagnose.js` (live switch
|
|
1917
|
-
`AGENTRUN_COMPUTER_LIVE_E2B=1`) makes one sandbox exactly as create does for network none, with a 10-minute E2B
|
|
1918
|
-
timeout, records the read-back and the provider's own check (`passed` with its `notes`, or its refusal), runs
|
|
1919
|
-
`computerd probe --diagnose` in it (each check judged as `--connect` judges a target: any byte back is answered),
|
|
1920
|
-
prints one JSON line, and kills the sandbox and reads it back gone, after an error or an abort too (SIGINT, SIGTERM,
|
|
1921
|
-
or its own 8-minute bound). Exit 0 when a diagnosis came back and the sandbox reads gone, 1 otherwise, 2 with no live
|
|
1922
|
-
switch or a refused setting.
|
|
1923
|
-
|
|
1924
1817
|
### Extend and stream
|
|
1925
1818
|
|
|
1926
1819
|
`extend(ref, ttlMs)` sets E2B's timer to now + `ttlMs` (`Sandbox.setTimeout`, `index.mjs:5529-5541`), reads the end
|
|
@@ -1989,17 +1882,12 @@ computer capped at 30 minutes, Hobby's plan for conformance
|
|
|
1989
1882
|
`test/e2b/conformance.e2b.test.mjs` runs the suite with `computerd-fixture` built for linux/amd64, and skips unless the
|
|
1990
1883
|
switch and `COMPUTER_E2B_API_KEY` are both set; `E2B_API_KEY` never counts.
|
|
1991
1884
|
|
|
1992
|
-
`dist/conformance/
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
gone, 1 when one is still there, 2 on a usage error, an unreadable before file, no key, or a refused listing (nothing is
|
|
1999
|
-
killed then). It reads `COMPUTER_E2B_API_KEY` and `COMPUTER_E2B_DOMAIN` as the conformance module does, and needs no
|
|
2000
|
-
live switch.
|
|
2001
|
-
|
|
2002
|
-
The conformance module's `settingsFromEnv` reads these names, and the sweep and `e2b-diagnose.js` read them through it,
|
|
1885
|
+
The live sweep is the shared one, `dist/conformance/sweep.js --provider e2b --before <file>` and `--after <file>`
|
|
1886
|
+
([PROVIDERS.md](PROVIDERS.md), "The live sweep"): it prints `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}`
|
|
1887
|
+
and reads its settings through the conformance module's `createHost`, with no live switch. A conformance run of E2B
|
|
1888
|
+
also sweeps its own label through the host at its end (the report's `cleanup.sweep`).
|
|
1889
|
+
|
|
1890
|
+
The conformance module's `settingsFromEnv` reads these names, and the sweep reads them through it (`createHost`),
|
|
2003
1891
|
each passed to `create()` as the option in brackets: `COMPUTER_E2B_API_KEY` (`apiKey`, required),
|
|
2004
1892
|
`COMPUTER_E2B_DOMAIN` (`domain`), `COMPUTER_E2B_DAEMON` (`daemonPath`), `COMPUTER_E2B_KIND` (`kind`),
|
|
2005
1893
|
`COMPUTER_E2B_MAX_LIFETIME_MS` (`maxLifetimeMs`, a whole number of ms) and `COMPUTER_E2B_USER` (`daemonUser`). It
|
|
@@ -2030,6 +1918,146 @@ A live run must show:
|
|
|
2030
1918
|
`packages/envd/internal/services/process/start.go`, `.../process/handler/handler.go:395-420`), and E2B's docs
|
|
2031
1919
|
(network/restrict-public-access and network/internet-access, read 2026-11-07). Each is cited where it is used above and in `src/e2b.ts`.
|
|
2032
1920
|
|
|
1921
|
+
## Agent37
|
|
1922
|
+
|
|
1923
|
+
```ts
|
|
1924
|
+
import { providerFor } from "@parcha/agentrun-computer";
|
|
1925
|
+
|
|
1926
|
+
// Both keys are the caller's to pass (serve's AGENT37_API_KEY and AGENT37_SSH_KEY), and ssh2 is the host's own (npm ssh2 1.17.0).
|
|
1927
|
+
const agent37 = await providerFor("agent37", { apiKey, sshKey });
|
|
1928
|
+
const made = await agent37.create({ image: "agent37-base", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
1929
|
+
```
|
|
1930
|
+
|
|
1931
|
+
Agent37 runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/agent37.ts` is Agent37's
|
|
1932
|
+
`MachineHost`, and `src/hosted/provider.ts` does everything that is not Agent37's own (the upload, the install, init's
|
|
1933
|
+
start, the stdio bridge, the probe, the janitor's extend, idempotent create by the request's name label). An Agent37
|
|
1934
|
+
computer is an instance made from a workspace template, by default `agent37-base`, Agent37's plain Debian 12. It is
|
|
1935
|
+
kind `linux`, on type `vm` (a VM with its own kernel, the default) or `default` (Agent37's gVisor sandbox). With
|
|
1936
|
+
`kind: "desktop"` it is a Linux desktop on `agentrun-box`, our box image as a template of the key's workspace
|
|
1937
|
+
([below](#the-desktop-agentrun-box)).
|
|
1938
|
+
|
|
1939
|
+
### Two keys
|
|
1940
|
+
|
|
1941
|
+
`create(options)` takes the workspace's API key as `options.apiKey` and the private half of an SSH key registered on
|
|
1942
|
+
the same workspace (`POST /v1/ssh-keys`, or `agent37 ssh-keys add`) as `options.sshKey`, its contents, never a path:
|
|
1943
|
+
the provider reads no file and no environment. A key pasted into Settings comes back on one line (a password field
|
|
1944
|
+
drops line breaks), so the provider wraps a one-line key's body again before ssh2 reads it. REST takes the API key as
|
|
1945
|
+
`Authorization: Bearer <key>`; the SSH tunnel's edge takes the same key in `X-Agent37-Key` (npm `agent37@0.4.1`
|
|
1946
|
+
`src/cli.js`, `wsHandshake` and `runTunnel`). Neither key appears in an error, a note or a label: the sweep's scope
|
|
1947
|
+
names the API key by its sha256 prefix alone.
|
|
1948
|
+
|
|
1949
|
+
### The mapping
|
|
1950
|
+
|
|
1951
|
+
| MachineHost | Agent37 |
|
|
1952
|
+
| --- | --- |
|
|
1953
|
+
| `create` | `POST /v1/instances` with the template, `type`, `region`, the size when the spec asks one, `name` (the adapter's name label), the labels as `metadata`, `network: "deny-all"` (`"allow-all"` for an Archil computer's root, whose own namespace is still loopback-only), `auto_sleep: false` and `public_ports: []`. It answers 201 once the instance runs |
|
|
1954
|
+
| `get` | `GET /v1/instances/{id}`; 404 is none |
|
|
1955
|
+
| `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
|
+
| `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) |
|
|
1959
|
+
| `errorCode` | the envelope's `error.code` (or a flat `error` string), then the HTTP status; ssh2's `client-authentication` is `denied` |
|
|
1960
|
+
| `check` | a template name with an optional `@version`; one of Agent37's four shapes; at most 4 CPUs; metadata within 4096 bytes with the provider's own labels |
|
|
1961
|
+
|
|
1962
|
+
Agent37 has no request id and no unique name, so a retried POST makes a second instance: the adapter lists the name
|
|
1963
|
+
label and keeps the oldest by `created` (whole seconds; ties go to the lowest id), as it does for every vendor.
|
|
1964
|
+
|
|
1965
|
+
### Exec over SSH
|
|
1966
|
+
|
|
1967
|
+
Agent37 has no SSH port on the internet: the instance's sshd answers on 22022 inside it, and the edge carries the SSH
|
|
1968
|
+
stream as binary WebSocket frames. `exec` opens a WebSocket (Node's global one takes `headers`), wraps it as a Duplex
|
|
1969
|
+
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
|
|
1972
|
+
signal or none; its listeners go on inside ssh2's callback, since one read off the tunnel can hold the open, the exit
|
|
1973
|
+
and the close together (seen live: a listener added after an `await` missed the exit). `kill()` runs a second command
|
|
1974
|
+
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.
|
|
1977
|
+
|
|
1978
|
+
### Capabilities
|
|
1979
|
+
|
|
1980
|
+
| Capability | Declared | Why |
|
|
1981
|
+
| --- | --- | --- |
|
|
1982
|
+
| `kind` | `linux` or `desktop` | `options.kind`: `linux` (default), or `desktop` with `screen`, `input.pointer` and `input.keys`, on the box template (below) |
|
|
1983
|
+
| `daemon` | `child` | the image's entrypoint is a template field, not a create field; init is a detached command over SSH |
|
|
1984
|
+
| `isolation` | `vm` or `gvisor` | `options.type`: `vm` (default) or `default` |
|
|
1985
|
+
| `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
|
+
| `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` |
|
|
1989
|
+
| `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
|
+
| `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
|
+
| `release` | `delete` | `DELETE`; no release maps to Agent37's stop here |
|
|
1992
|
+
| `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
|
+
|
|
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.
|
|
1996
|
+
|
|
1997
|
+
### Conformance on Agent37
|
|
1998
|
+
|
|
1999
|
+
```sh
|
|
2000
|
+
AGENTRUN_COMPUTER_LIVE_AGENT37=1 COMPUTER_AGENT37_API_KEY=... COMPUTER_AGENT37_SSH_KEY="$(cat key)" \
|
|
2001
|
+
npm run conformance -w @parcha/agentrun-computer -- --provider agent37
|
|
2002
|
+
```
|
|
2003
|
+
|
|
2004
|
+
The conformance module, `dist/conformance/agent37.js`, checks `AGENTRUN_COMPUTER_LIVE_AGENT37=1` first, then reads
|
|
2005
|
+
`COMPUTER_AGENT37_API_KEY` (`apiKey`, required), `COMPUTER_AGENT37_SSH_KEY` (`sshKey`, required, the key's contents),
|
|
2006
|
+
`COMPUTER_AGENT37_KIND` (`linux`, the default, or `desktop`), `COMPUTER_AGENT37_TEMPLATE` (the run's image, default
|
|
2007
|
+
`agent37-base`, or `agentrun-box` for kind `desktop`), `COMPUTER_AGENT37_TYPE`, `COMPUTER_AGENT37_REGION`,
|
|
2008
|
+
`COMPUTER_AGENT37_API_URL`, `COMPUTER_AGENT37_DAEMON` (`daemonPath`), `COMPUTER_AGENT37_MAX_LIFETIME_MS` and
|
|
2009
|
+
`COMPUTER_AGENT37_USER` (`daemonUser`), never `AGENT37_API_KEY`. Every computer of a run lives at most 30 minutes.
|
|
2010
|
+
`createDriftedProvider()` uploads a daemon built as `<version>-drift`. The live sweep is the shared one,
|
|
2011
|
+
`dist/conformance/sweep.js --provider agent37 --before <file>` and `--after <file>`; its scope is the key's workspace.
|
|
2012
|
+
|
|
2013
|
+
### Seen live (2026-11-13)
|
|
2014
|
+
|
|
2015
|
+
Twelve instances, at most two at once, every one labelled for the sweep and deleted; the workspace listed no instance
|
|
2016
|
+
after. One fresh VM's tunnel failed to open for the daemon's upload, so a tunnel that fails before its SSH handshake is
|
|
2017
|
+
opened again (four tries in all, within the call's bound). On type `vm` with `agent37-base`: the POST answered `running` in about 1 s (the provider's whole create,
|
|
2018
|
+
daemon included, 4 to 8 s); the read-back held `deny-all`, no public port, `auto_sleep: false`, 2 CPUs and 4 GB,
|
|
2019
|
+
dotted metadata keys and odd values; metadata's cap is 4096 bytes serialized, exactly; commands run as uid 0 on
|
|
2020
|
+
Debian 12 under the platform's own init; 3 MiB of stdin took half a second over the tunnel; the daemon started, hello
|
|
2021
|
+
answered with fence `netns`, and its programs ran as 2510 with no capability and no DNS. On type `default` (gVisor,
|
|
2022
|
+
kernel `4.19.0-gvisor`): root has no `CAP_SYS_ADMIN`, and init made its namespace inside a user namespace of its own
|
|
2023
|
+
(fence `userns-netns`); the rest as on `vm`. The Archil mount itself is the conformance run's to show, on the box template.
|
|
2024
|
+
|
|
2025
|
+
### The desktop: agentrun-box
|
|
2026
|
+
|
|
2027
|
+
`create({ kind: "desktop", ... })` (serve builds the descriptor's desktop configuration so) makes a desktop: the
|
|
2028
|
+
adapter gives init `DISPLAY` and starts `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp` through the daemon as the tool
|
|
2029
|
+
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`:
|
|
2033
|
+
|
|
2034
|
+
```sh
|
|
2035
|
+
AGENT37_API_KEY=... node packages/computer/box/build-agent37.mjs # prints template=agentrun-box
|
|
2036
|
+
```
|
|
2037
|
+
|
|
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
|
|
2040
|
+
hash already is built nothing, and a changed recipe publishes a new revision, which every instance made after it starts
|
|
2041
|
+
from. The script's calls: `GET /v1/templates/agentrun-box`, then `POST /v1/template-builds` (`name`, `size_bytes`,
|
|
2042
|
+
`description`), a `PUT` of the gzipped context (the Dockerfile and the helper at its root) to the presigned
|
|
2043
|
+
`upload_url` with no Agent37 key, `POST .../{id}/start`, and `GET .../{id}/logs?offset=N` until `succeeded` or `failed`.
|
|
2044
|
+
Builds are free, at most three at once per workspace and 45 minutes each (docs: templates, "Build an image in the
|
|
2045
|
+
cloud"). A workspace template is the workspace's own, so each workspace that runs desktops builds it once first.
|
|
2046
|
+
|
|
2047
|
+
Why not Agent37's own `agent37-ubuntu`, which ships a desktop: its image (`ghcr.io/agent37-platform/ubuntu:2026.10.13c`,
|
|
2048
|
+
entrypoint `images/vm/ubuntu/entrypoint.sh` of agent37-platform/templates) runs `Xtigervnc :1 ... -ac` as root, with
|
|
2049
|
+
access control off, and an XFCE session as root on it. Any process in the machine can open that display, so a tool
|
|
2050
|
+
driving it, or merely connecting to `/tmp/.X11-unix/X1`, could type into root's terminal: the tool user would have a way
|
|
2051
|
+
to root. It has no Xvfb, no archil client and no helper either, and it is Ubuntu with `sudo` installed. The box image is
|
|
2052
|
+
also the one an Archil computer needs, so one template serves both.
|
|
2053
|
+
|
|
2054
|
+
### Sources
|
|
2055
|
+
|
|
2056
|
+
Agent37's docs under `https://www.agent37.com/docs/agents-api/` (instances create, get, list, edit, delete and object;
|
|
2057
|
+
errors; instance-sizing; vm-instances; instance-network; ssh; templates; custom-image), read 2026-11-13; npm
|
|
2058
|
+
`agent37@0.4.1` `src/cli.js` (the tunnel); `ssh2@1.17.0` (`lib/client.js`, `lib/Channel.js`, `lib/utils.js`); and
|
|
2059
|
+
the live runs above.
|
|
2060
|
+
|
|
2033
2061
|
## Orgo: Windows and macOS desktops (parked)
|
|
2034
2062
|
|
|
2035
2063
|
Orgo offers its Linux desktop alone, which runs computerd (`src/orgo.ts`). Its Windows and macOS desktops are parked:
|
|
@@ -2081,6 +2109,54 @@ built for.
|
|
|
2081
2109
|
- The live run needs Orgo's Scale plan or a Windows computer bought on the plan; the macOS run needs Orgo's Mac
|
|
2082
2110
|
access.
|
|
2083
2111
|
|
|
2112
|
+
### An agent's own computer on Orgo (persistence)
|
|
2113
|
+
|
|
2114
|
+
The Linux desktop declares `capabilities().persistence` (`{ keepsState: true, resume: true }`) and takes
|
|
2115
|
+
`spec.owner: { agent }` with no `lifetimeMs`: a computer that belongs to the agent and outlives the run (see
|
|
2116
|
+
"Persistent computers: an agent's own"). The Windows desktop's code declares it too, without resume; a Mac declares
|
|
2117
|
+
none.
|
|
2118
|
+
|
|
2119
|
+
- **Its name** is `computer-<hex>-o<the owner's hash>`, with no run, epoch or deadline, and it has no Orgo end.
|
|
2120
|
+
- **Its labels live in a ledger.** Orgo holds no labels, and a detached computer is never woken to read its labels
|
|
2121
|
+
file, so the provider keeps an agent's computer's labels (the owner's, the claim's run and epoch) and when it was
|
|
2122
|
+
detached in a ledger: the `ledger` option, which Orgo's descriptor declares, so serve passes its computer ledger and
|
|
2123
|
+
they outlive a restart. Without one it is kept in memory. `list` reads them with nothing run inside, and gives
|
|
2124
|
+
`owned`, `owner`, `detachedAt`, and `deadline` undefined. A ledger has `put`, `get`, `list`, `remove` and `swap`:
|
|
2125
|
+
`swap(was, entry)` writes entry only while the kept entry is still `was` as read (a compare-and-set; serve's is one
|
|
2126
|
+
SQL statement), and says whether it did.
|
|
2127
|
+
- **No entry, no labels.** An agent's computer with no ledger entry is listed `owned` with no labels and no owner, to
|
|
2128
|
+
an unfiltered list alone. The janitor can't read its owner, so it keeps it. Attach and detach refuse it in words,
|
|
2129
|
+
and nothing reads its labels file instead: release it with delete.
|
|
2130
|
+
- **`release(ref, "detach")`** is for an agent's computer alone; a run's computer refuses it and runs on:
|
|
2131
|
+
- Linux: Orgo's suspend saves memory and disk, and computerd init with them. `persistence.resume` is true.
|
|
2132
|
+
- Windows: Orgo's stop archives its disk (files, apps and settings, not memory), and it reads `frozen`. `resume` is
|
|
2133
|
+
false.
|
|
2134
|
+
- macOS declares no persistence: Orgo stops no Mac, so `check()` refuses an owner.
|
|
2135
|
+
- **`attach({ id }, { claim })`** from a later run starts or resumes it first: attaching an agent's computer is asking
|
|
2136
|
+
for it. A run's computer that isn't running is still never woken, and is never taken under a claim. Under a claim
|
|
2137
|
+
the computer carries the claim's run and epoch, in the ledger and its labels file. A claim of the same run below
|
|
2138
|
+
the epoch it carries is refused as fenced, and nothing changes. An attach that started or resumed the computer and
|
|
2139
|
+
then fails a check stops or suspends it again, as it was found. One rule keeps attaches, detaches and deletes apart:
|
|
2140
|
+
each takes the ledger entry with a busy marker (`swap`) before anything is done to the computer, and every other is
|
|
2141
|
+
refused (busy) until it is settled. The holder renews the marker with `swap` right before each step that wakes,
|
|
2142
|
+
stops, suspends or replaces what runs in the computer (a put-back, a daemon's replacement, its labels file written
|
|
2143
|
+
after a wake), and only the holder settles the entry, each write a `swap` from the entry it last wrote. A holder
|
|
2144
|
+
whose `swap` finds the entry changed (its marker went stale past 15 minutes and another took it, or it was removed)
|
|
2145
|
+
does nothing more to the computer, and its attach or detach answers an error, never ok. So of two attaches of one
|
|
2146
|
+
run racing, the lower epoch is refused however they interleave, and an older attach never ends the programs or
|
|
2147
|
+
sleep of a newer one. One provider's attaches and detaches of a computer take turns. Its read-back spec carries
|
|
2148
|
+
`owner`.
|
|
2149
|
+
- **`release(ref, "delete", { claim })`** deletes an agent's computer only while its ledger entry carries exactly that
|
|
2150
|
+
claim's run and epoch and nobody holds it busy; otherwise it is refused in words (fenced, or busy) and runs on. A
|
|
2151
|
+
claim that made a computer and then lost the agent's hold deletes it this way, so a later claim that found and took
|
|
2152
|
+
it keeps it. A run's computer refuses a delete under a claim.
|
|
2153
|
+
- **Init on Linux.** An owned computer's init ends its programs at its deadline, `maxLifetimeMs` out, and has no
|
|
2154
|
+
most in practice: each attach moves the deadline `maxLifetimeMs` out again (`deadline.extend`). A desktop left
|
|
2155
|
+
detached past that, or whose daemon is another version (the package was upgraded meanwhile), gets its daemon
|
|
2156
|
+
installed again at its next attach: the old init is stopped by its process, then every step create takes, the disk
|
|
2157
|
+
kept, and the attach notes say the daemon was replaced and why. A run's computer is refused instead. `extend`
|
|
2158
|
+
refuses an owned computer: it has no janitor's deadline to move.
|
|
2159
|
+
|
|
2084
2160
|
## Browsers: Browserbase and Kernel
|
|
2085
2161
|
|
|
2086
2162
|
A browser is a computer of kind `browser`: a vendor's browser session that answers CDP. No computerd runs (daemon
|
|
@@ -2099,24 +2175,44 @@ and are never in a ref, a list, an error's words or a report. `client` stays a `
|
|
|
2099
2175
|
| groups (`CAPABILITIES`) | `cdp`, `stream` | `cdp`, `stream` |
|
|
2100
2176
|
| test connection | one `GET /v1/sessions?status=RUNNING` | one `GET /browsers?status=active` page |
|
|
2101
2177
|
| release | `REQUEST_RELEASE`, then read back until it is no longer `RUNNING` or `PENDING` | `DELETE`, then read back until 404 or `deleted_at` |
|
|
2102
|
-
| options | `apiKey
|
|
2178
|
+
| options | `apiKey`, `projectId`, `apiUrl`, `fetch` | `apiKey`, `apiUrl`, `fetch` |
|
|
2103
2179
|
| conformance reads | `COMPUTER_BROWSERBASE_API_KEY`, `COMPUTER_BROWSERBASE_PROJECT_ID`, `COMPUTER_BROWSERBASE_API_URL` | `COMPUTER_KERNEL_API_KEY`, `COMPUTER_KERNEL_API_URL` |
|
|
2104
2180
|
|
|
2105
2181
|
Both declare `lifetime: "vendor"`, `network: ["open"]`, `isolation: "vm"`, `release: ["delete"]`, and no `extend`
|
|
2106
|
-
(neither vendor moves a running session's timeout). Neither declares `downloads` yet:
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2182
|
+
(neither vendor moves a running session's timeout). Neither declares the `downloads` group yet: the kind registry's
|
|
2183
|
+
entry does not, so Browserbase's downloads are read through its `downloads` member (below). `check()` refuses an image
|
|
2184
|
+
other than `chromium`, a lifetime past the cap, a network other than open, any size, user, workdir or mount, and a
|
|
2185
|
+
browser option the provider does not declare (below), before a vendor call. `list` and attach by
|
|
2110
2186
|
labels take at least one label (a vendor account holds sessions no provider made), ask the vendor by status and by the
|
|
2111
2187
|
first label a query carries as it is, and match every label themselves. They show every browser that has not ended:
|
|
2112
2188
|
Browserbase's `RUNNING` and `PENDING`, Kernel's `status=all` with the deleted dropped (Kernel's filter takes one value,
|
|
2113
2189
|
and `active` may leave out a browser still starting). A release is idempotent: one already ended or
|
|
2114
2190
|
unknown to the vendor is released.
|
|
2115
2191
|
|
|
2192
|
+
A browser session's own options ride the spec, `spec.browser`: `viewport`, `profile: { pointer, save }` (a saved
|
|
2193
|
+
profile the session opens, and whether it writes back to it), `stealth` and `headless`. `capabilities().browser`
|
|
2194
|
+
declares what a provider's sessions offer: `timeout` (`"wall-clock"` or `"inactivity"`), `profiles: { settleMs }` (how
|
|
2195
|
+
long after a saving session ends the vendor may still write the profile back), `stealth`, `headless`, and
|
|
2196
|
+
`downloads: { path }` (the folder a driver points `Browser.setDownloadBehavior` at). An option asks for a declared
|
|
2197
|
+
feature or is refused in words; a flag set `false` asks for nothing; a viewport needs no feature. No browser loads an
|
|
2198
|
+
extension: the driver is raw CDP, with nothing loaded into Chrome. `isBrowserProvider(p)` is true for a provider of
|
|
2199
|
+
kind browser that declares them.
|
|
2200
|
+
|
|
2201
|
+
| | Browserbase | Kernel | Local Chrome |
|
|
2202
|
+
| --- | --- | --- | --- |
|
|
2203
|
+
| `capabilities().browser` | wall-clock, `stealth`, `profiles` (settle 5 s), `downloads` (`downloads/`) | inactivity, `headless`, `profiles` (settle 0) | wall-clock |
|
|
2204
|
+
| `viewport` | `browserSettings.viewport` | `viewport` | the window's size |
|
|
2205
|
+
| `stealth` | `browserSettings.verified` and `solveCaptchas` (the solver is off otherwise: Browserbase's default is on) | not declared (Kernel's stealth brings a proxy nothing prices yet) | not declared |
|
|
2206
|
+
| `profile` | a context: `browserSettings.context { id, persist }` | a profile by name: `profile { name, save_changes }`, made first if Kernel does not know it | not declared |
|
|
2207
|
+
| `profiles { create, remove }` | `POST /v1/contexts`, `DELETE /v1/contexts/{id}` | `POST /profiles` under a random name (the pointer), `DELETE /profiles/{name}` | none |
|
|
2208
|
+
| `downloads { list, read }` | `GET /v1/downloads?sessionId=` (paged), `GET /v1/downloads/{id}`, cut at `maxBytes` | none | none |
|
|
2209
|
+
|
|
2210
|
+
A pointer is a capability: whoever holds it opens the profile, so no error's words carry one.
|
|
2211
|
+
|
|
2116
2212
|
A vendor call is one request, never retried where a retry could open a second paid browser, and a failure names the
|
|
2117
|
-
call and the HTTP status alone, never the vendor's words.
|
|
2118
|
-
|
|
2119
|
-
|
|
2213
|
+
call and the HTTP status alone, never the vendor's words. The calls are the provider's own, over `fetch` (a test passes
|
|
2214
|
+
its own `fetch`). A thrown error rides the failure as a hidden cause (`causeOf(result)`), not enumerable, so it is in no
|
|
2215
|
+
JSON.
|
|
2120
2216
|
|
|
2121
2217
|
Each create writes one more label beside the spec's, `agentrun.create` (`CREATE_LABEL`), with a value of its own. A
|
|
2122
2218
|
create whose outcome is unknown (its reply lost, cut short, answered 5xx or with no browser, or the caller's signal
|
|
@@ -2145,7 +2241,7 @@ on the machine AgentRun runs on. No vendor, no key, nothing billed.
|
|
|
2145
2241
|
import { LocalBrowserProvider } from "@parcha/agentrun-computer/local-chrome";
|
|
2146
2242
|
|
|
2147
2243
|
const local = new LocalBrowserProvider({ env: { PATH: process.env.PATH } }); // or { executablePath: "/usr/bin/chromium" }
|
|
2148
|
-
const made = await local.create({ image: "chromium", lifetimeMs: 30 * 60_000, network: "open" });
|
|
2244
|
+
const made = await local.create({ image: "chromium", lifetimeMs: 30 * 60_000, network: "open" }, { requestId: "r1#3" });
|
|
2149
2245
|
const connected = await local.connect(made.value); // connected.value.cdp.url: ws://127.0.0.1:<port>/devtools/browser/<id>
|
|
2150
2246
|
await local.release(made.value, "delete");
|
|
2151
2247
|
```
|
|
@@ -2186,8 +2282,9 @@ The fence and the sandbox are PR #1718's:
|
|
|
2186
2282
|
(`--webrtc-ip-handling-policy=disable_non_proxied_udp`). The proxy and its relay live in the supervisor, so the fence
|
|
2187
2283
|
holds for a browser driven from another process, and a browser whose supervisor is gone reaches nothing.
|
|
2188
2284
|
|
|
2189
|
-
Capabilities: `network: ["open"]` (public addresses), `isolation: "host"`,
|
|
2190
|
-
live view: run it headed to watch), `release: ["delete"]`, no mount
|
|
2285
|
+
Capabilities: `network: ["open", "allow"]` (public addresses, or a list's hosts among them), `isolation: "host"`,
|
|
2286
|
+
`daemon: "none"`, groups `cdp` only (no live view: run it headed to watch), `release: ["delete"]`, no mount, and
|
|
2287
|
+
`browser: { timeout: "wall-clock" }`: `spec.browser.viewport` sizes its window, and it takes no other session option.
|
|
2191
2288
|
|
|
2192
2289
|
Known limits, so it is for local and development use:
|
|
2193
2290
|
|
|
@@ -2200,9 +2297,9 @@ Known limits, so it is for local and development use:
|
|
|
2200
2297
|
processes. Through it they reach public addresses, which they can reach anyway.
|
|
2201
2298
|
- No proxy of your own, no extensions, no saved profiles: each browser starts from an empty profile that goes with it.
|
|
2202
2299
|
|
|
2203
|
-
Driving it: pi-browser's raw-CDP driver (`@parcha/pi-browser/driver/cdp`) drives this browser
|
|
2204
|
-
`snapshot` and `run` actions
|
|
2205
|
-
|
|
2300
|
+
Driving it: pi-browser's raw-CDP driver (`@parcha/pi-browser/driver/cdp`) drives this browser, as it drives the vendor
|
|
2301
|
+
browsers, with the `snapshot` and `run` actions and nothing loaded into Chrome. `run` code is refused; navigation is a
|
|
2302
|
+
`goto` action. Its snapshot does not read a frame another site runs in its own
|
|
2206
2303
|
process (a cross-origin iframe). The snapshot names each frame it left out, so an agent knows the page has more.
|
|
2207
2304
|
|
|
2208
2305
|
The conformance module starts a real Chrome, so it waits for its switch:
|
|
@@ -2218,15 +2315,30 @@ AGENTRUN_COMPUTER_LIVE_LOCAL_CHROME=1 [COMPUTER_LOCAL_CHROME_PATH=/usr/bin/chrom
|
|
|
2218
2315
|
import { providerFor } from "@parcha/agentrun-computer";
|
|
2219
2316
|
|
|
2220
2317
|
const phones = await providerFor("phone-harness", { apiKey }); // serve passes PHONE_HARNESS_API_KEY
|
|
2221
|
-
const made = await phones.create({ image: "android", lifetimeMs: 10 * 60_000, network: "open", labels: { run } });
|
|
2318
|
+
const made = await phones.create({ image: "android", lifetimeMs: 10 * 60_000, network: "open", labels: { run } }, { requestId: "r1#3" });
|
|
2222
2319
|
```
|
|
2223
2320
|
|
|
2224
2321
|
`src/phone-harness.ts`, provider id `phone-harness`, rents a temporary cloud Android emulator from the phone harness
|
|
2225
2322
|
(phone-harness.com). The phone harness bills it at 5 cents a minute from the account's credit. A cloud iPhone (driven by
|
|
2226
2323
|
the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
2227
2324
|
|
|
2228
|
-
- **
|
|
2229
|
-
|
|
2325
|
+
- **phoned, the phone's driver.** `connect()` asks the phone harness for the session's adb link, connects to it,
|
|
2326
|
+
unlocks the phone with the session's code (never in a result or an error) and probes it. Then it starts phoned
|
|
2327
|
+
(`daemon-android/`, one dex jar built by `npm run build:phoned` into `dist/phoned.jar`) and speaks the protocol to it:
|
|
2328
|
+
- The jar goes to `/data/local/tmp/phoned-<sha256 prefix>.jar` only when the phone lacks it: pushed beside that name,
|
|
2329
|
+
moved there and its sha256 checked, so a jar of that name is always whole.
|
|
2330
|
+
- phoned runs as the shell user through `app_process`, scrcpy's way in, on adb's `exec:` service, whose socket
|
|
2331
|
+
carries its stdin and stdout raw; its stderr goes to a log beside the jar, which a failed hello names.
|
|
2332
|
+
- The hello is phoned's own, checked for this provider's version and protocol (`drift.version`'s words).
|
|
2333
|
+
- UiAutomation is one per phone, so one phoned answers every connection to a phone. Closing a connection cancels
|
|
2334
|
+
its own calls; the last close ends phoned (its stdin closes), then drops the adb transport. A phoned that ends on
|
|
2335
|
+
its own fails its connections' calls with `gone`, and the next connect starts another.
|
|
2336
|
+
- A phoned holds the phone's UiAutomation until it exits, a moment after its stdin closes, so the next phoned on a
|
|
2337
|
+
phone starts only once the last is gone: the provider keeps each phoned's pid and start time (its shell writes them
|
|
2338
|
+
before `app_process` takes its place, so a pid another process took later is not it) and waits on the phone up to
|
|
2339
|
+
10 s for that process to end, kills it then, and fails
|
|
2340
|
+
the connect in words if a kill leaves it running. A UiAutomation held by something else (`uiautomator dump`, an
|
|
2341
|
+
instrumentation test, Appium) is not waited for: the first ui call is `unsupported` in words that name them.
|
|
2230
2342
|
- Neither the endpoint nor the code is ever in a spawned adb's argv, which `/proc` shows to every user of the host.
|
|
2231
2343
|
The endpoint goes to the local adb server over its socket protocol (`host:connect`, `host:devices-l`,
|
|
2232
2344
|
`host:disconnect`). The unlock is the vendor's shell command `unlock <code>`, once per connection; every shell
|
|
@@ -2235,34 +2347,15 @@ the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
|
2235
2347
|
spawned adb names the phone by the adb server's transport id (`-t <id>`). A shell's stdin cannot carry the unlock:
|
|
2236
2348
|
a shell with no command string is answered `locked` (live run 3); the socket path unlocked a phone live (probe 1).
|
|
2237
2349
|
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
- tap and long press;
|
|
2248
|
-
- swipe: `input swipe`, or `input motionevent` for a path of three points or more. Its `ms` is shared between the
|
|
2249
|
-
moves as `sleep`s, by each segment's length, so it lasts `ms` at least;
|
|
2250
|
-
- the back, home and app switch buttons;
|
|
2251
|
-
- `type`, by `input text`: ASCII and line breaks. A literal `%s` is split across two calls, so it is not read as
|
|
2252
|
-
a space;
|
|
2253
|
-
- one key at a time (`input keyevent`), and `wait`.
|
|
2254
|
-
|
|
2255
|
-
A cancelled batch stops at the action it is on, a `wait` included, and answers failed, kind `aborted`, there;
|
|
2256
|
-
- `apps.list` (`pm list packages`, and the app in front from `dumpsys activity activities`), `apps.launch` (its
|
|
2257
|
-
launcher activity, `am start -W --activity-clear-task`, so the app named is in front and not what its task last
|
|
2258
|
-
held: on Android 15 Settings' task keeps search, another package, on top) and `apps.terminate` (`am force-stop`);
|
|
2259
|
-
- `apps.ui_tree`: `uiautomator dump`.
|
|
2260
|
-
|
|
2261
|
-
exec, files, processes and tar are refused in words: a phone has no shell in the computer protocol. So are pinch
|
|
2262
|
-
(adb's `input` has one finger), hold, a combo of keys, `apps.install` and `deadline.extend`.
|
|
2263
|
-
- **Capabilities.** Kind and os `android`, daemon `none`, lifetime `vendor`, network `open`, release `delete` only.
|
|
2264
|
-
Groups `screen`, `input.touch`, `input.keys`, `apps` and `apps.ui_tree`. `maxLifetimeMs` is 30 min by default. No
|
|
2265
|
-
mount, no extend.
|
|
2350
|
+
phoned answers on the phone itself (`daemon-android/README.md` has each method): `exec.run` as the shell user,
|
|
2351
|
+
`screen.shot`/`screen.read`/`screen.watch` scaled on the phone, `input.actions` through InputManager (taps, swipes,
|
|
2352
|
+
a pinch, key combos and holds, Unicode text through the clipboard), `apps.list`/`apps.launch`/`apps.terminate`, and
|
|
2353
|
+
the `ui` group (`ui.observe`, `ui.act`) from UiAutomation. files, processes and tar are refused in words, as are `apps.install` and
|
|
2354
|
+
`deadline.extend`.
|
|
2355
|
+
- **Capabilities.** Kind and os `android`, daemon `none` (nothing is installed: phoned lives as long as the phone's
|
|
2356
|
+
connections), lifetime `vendor`, network `open`, release `delete` only.
|
|
2357
|
+
Groups `exec`, `screen`, `input.touch`, `input.keys`, `apps` and `ui`. `maxLifetimeMs` is 30 min by default.
|
|
2358
|
+
No mount, no extend.
|
|
2266
2359
|
- **create** asks for `timeout_seconds` = the lifetime, and the phone harness ends the session then, whatever happens.
|
|
2267
2360
|
The lifetime includes the boot, so a phone ready past its deadline fails `timeout`.
|
|
2268
2361
|
- Each POST carries an Idempotency-Key, and a create whose answer is uncertain is found by it, never sent twice.
|
|
@@ -2295,8 +2388,9 @@ the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
|
2295
2388
|
- `list()` reads the ledger before `GET /sessions`, so it never forgets a phone a create records while it runs. It
|
|
2296
2389
|
forgets a phone the listing leaves out only once that phone's own `GET /sessions/<id>` is a 404.
|
|
2297
2390
|
- **adb** is an option too: a transport, `{ run(args, { input }), server(service) }` (tests give a fake), or the path of
|
|
2298
|
-
the `adb` CLI (Android platform-tools; default `adb` on PATH
|
|
2299
|
-
|
|
2391
|
+
the `adb` CLI (Android platform-tools; default `adb` on PATH, which the phone's descriptor names as its
|
|
2392
|
+
`hostCommand`, so a server says it is missing before any phone is rented), whose server it starts and speaks to on
|
|
2393
|
+
the loopback (port 5037, adb's own, or `adbCli(path, { port })`). Every spawned adb names that port with `-P`, so the CLI and the
|
|
2300
2394
|
socket requests reach one server. `adbCli(path, { env })` spawns adb from the environment given, with every
|
|
2301
2395
|
`ADB_*`, `ANDROID_ADB_*` and `ANDROID_SERIAL` variable dropped, so nothing in it points the CLI at another server or
|
|
2302
2396
|
device. The library reads no environment of its own: the conformance module passes its own, minus its
|
|
@@ -2314,17 +2408,19 @@ Conformance (`src/conformance/phone-harness.ts`) reads `COMPUTER_PHONE_HARNESS_A
|
|
|
2314
2408
|
`maxLifetimeMs`.
|
|
2315
2409
|
|
|
2316
2410
|
With no fixture app (it takes no files), the touch, keys and apps cases drive the stock Settings app and read back
|
|
2317
|
-
through `
|
|
2411
|
+
through `ui.observe` (`src/conformance/cases/settings.ts`):
|
|
2318
2412
|
- `touch.tap`: a tap on a row opens its page: the row's title shows, as a text or a label (Android 15's page has it
|
|
2319
2413
|
only as its toolbar's content-desc), and the next row is gone. Back comes back. When the page does not
|
|
2320
2414
|
come, its words say what it saw: the screen in px and dp, what is in front, the tap point and the row's bounds,
|
|
2321
2415
|
whether the title shows outside the list, and whether the next row is still shown;
|
|
2322
2416
|
- `touch.swipe`: a swipe up moves the list up;
|
|
2323
2417
|
- `input.type-text` and `input.key-table-refuses-unknown`: the text read back from the search field;
|
|
2324
|
-
- `apps.launch-terminate`, which needs the apps group alone:
|
|
2325
|
-
shown, in `
|
|
2326
|
-
is not in front;
|
|
2327
|
-
- `apps.
|
|
2418
|
+
- `apps.launch-terminate`, which needs the apps group alone: the ui fixture where it is installed, else Settings, is
|
|
2419
|
+
listed; once launched it is in front, and shown, in `ui.observe` when the phone reads its elements, else in a
|
|
2420
|
+
screenshot (or `ui.observe`'s image) other than the one before; once terminated it is not in front;
|
|
2421
|
+
- `apps.launch-window`: once `apps.launch` answers, a `ui.observe` sent at once finds the app's window (launch waits
|
|
2422
|
+
for it, at most 10 s), on the ui fixture where it is installed, else on Settings;
|
|
2423
|
+
- `ui.observe-shape`: the observation's shape, on the ui fixture where it is installed, else on Settings.
|
|
2328
2424
|
|
|
2329
2425
|
`touch.pinch` skips in the provider's own refusal.
|
|
2330
2426
|
|
|
@@ -2342,7 +2438,8 @@ npm run conformance -w @parcha/agentrun-computer -- --provider ./my-provider.js
|
|
|
2342
2438
|
|
|
2343
2439
|
```text
|
|
2344
2440
|
computer conformance · docker · linux, daemon pid1 · computerd 0.1.0-beta.30 linux/amd64
|
|
2345
|
-
core health hello ping unknown-method kind-consistent ✓
|
|
2441
|
+
core health hello ping unknown-method kind-consistent ✓ 5
|
|
2442
|
+
kind-served
|
|
2346
2443
|
core exec argv streams exit-code cwd env timeout abort ✓ 11
|
|
2347
2444
|
truncation setsid-escapee unprivileged user
|
|
2348
2445
|
...
|
|
@@ -2351,7 +2448,7 @@ full lifetime extend - 1
|
|
|
2351
2448
|
optional screen screenshot-size - 1
|
|
2352
2449
|
- screen.screenshot-size: the provider does not declare screen
|
|
2353
2450
|
...
|
|
2354
|
-
core PASS
|
|
2451
|
+
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
|
|
2355
2452
|
```
|
|
2356
2453
|
|
|
2357
2454
|
An id is resolved through the provider registry, and only there; the usage lists every id it holds. A module path is
|
|
@@ -2436,7 +2533,8 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2436
2533
|
[The protocol extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)): exec, files,
|
|
2437
2534
|
processes and network `none` wherever computerd runs, screen and keyboard and pointer on a desktop, screen and touch
|
|
2438
2535
|
on a phone. `health.kind-consistent` checks the kind, os and daemon pair, that hello's kind and groups are the
|
|
2439
|
-
provider's, and that kind's Core groups are declared; `
|
|
2536
|
+
provider's, and that kind's Core groups are declared; `health.kind-served` that hello declares every group its
|
|
2537
|
+
setting kind needs to be given to an agent (`kindServed`); `provider.check-refuses` also asks `check` for
|
|
2440
2538
|
`maxLifetimeMs + 1`. Where the kind makes them Core: `screen.screenshot-size` (every pixel of the PNG decodes, its
|
|
2441
2539
|
IHDR size is `width` x `height`, `scale` is above 0, a region shot decodes and has the region's size, and on a
|
|
2442
2540
|
desktop the fixture's four colors are where it paints them; the suite reads 8-bit, non-interlaced PNGs of at most
|
|
@@ -2446,8 +2544,8 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2446
2544
|
kind `invalid`, and runs nothing), `input.actions-stops-at-first-failure` (move, left button down, move off the screen,
|
|
2447
2545
|
click: `done` 2, the press released where it was, no click, and a later click lands, so nothing was left held), `touch.tap` and `touch.swipe` (the
|
|
2448
2546
|
fixture app logs the tap at its point, and the swipe's start and end), `apps.install-launch` (installed, listed, in
|
|
2449
|
-
front when launched and not when terminated) and `
|
|
2450
|
-
|
|
2547
|
+
front when launched and not when terminated) and `ui.observe-shape` (every node typed as the protocol says, inside
|
|
2548
|
+
its window, with the fixture's button found by its id and text).
|
|
2451
2549
|
- **Full** is each optional capability a provider declares: network `open` (`network:open`), a network allowlist
|
|
2452
2550
|
(`network:allow`), each with a change of a computer's network to it and back to `none`, refused or applied
|
|
2453
2551
|
truthfully, on a computer of the case's own (`provider.network-switch`, `provider.network-switch-allow`), the janitor for a provider whose lifetime is `"janitor"` and that stops computers and keeps them
|
|
@@ -2492,8 +2590,8 @@ installed with `apps.install` and launched, logging to its files directory, with
|
|
|
2492
2590
|
`ai.agentrun.fixture:id/button` that reads `agentrun fixture`). Each event is one JSON line (`ready`, `down`/`up` with
|
|
2493
2591
|
button and point, `wheel`, `key`, `text`, `touch` with finger and phase); `src/conformance/fixture.ts` is the
|
|
2494
2592
|
contract. A case that needs it and was given none skips, so Core cannot pass on a desktop or phone without it. The
|
|
2495
|
-
fixture is stopped when its case ends, once launched, even when it never logged ready. A phone that declares neither files nor `
|
|
2496
|
-
`no way to observe the effect: declare files or
|
|
2593
|
+
fixture is stopped when its case ends, once launched, even when it never logged ready. A phone that declares neither files nor `ui` skips the touch cases:
|
|
2594
|
+
`no way to observe the effect: declare files or ui`.
|
|
2497
2595
|
|
|
2498
2596
|
The suite makes every computer with the label `agentrun.conformance=<run id>`, image `--image`, a 30-minute lifetime
|
|
2499
2597
|
and network `none` (`open` for a phone that declares no `none`, since its kind does not require it). It deletes each computer a case made when the case ends, and the shared one at the end; for a
|
|
@@ -2505,8 +2603,8 @@ its case ended is deleted or closed as it arrives and named in `cleanup.late`; t
|
|
|
2505
2603
|
create a case started, a refused one included, so a late computer is deleted before the report returns. A call still
|
|
2506
2604
|
pending when that bound (a minute) runs out is named in `cleanup.errors`, since what it makes may be left, and Core
|
|
2507
2605
|
fails, as it does for a computer left behind. A case calls
|
|
2508
|
-
`t.create(extra)` for a computer it needs, or `t.attempt(spec, by?)` for create's result as it is (a refusal it
|
|
2509
|
-
expects, or the drifted provider's computer). With `--provider docker` and no
|
|
2606
|
+
`t.create(extra)` for a computer it needs, or `t.attempt(spec, by?, requestId?)` for create's result as it is (a refusal it
|
|
2607
|
+
expects, or the drifted provider's computer; each attempt is a new request unless `requestId` retries one). With `--provider docker` and no
|
|
2510
2608
|
`COMPUTER_DOCKER_DAEMON`, a `docker version` that does not answer within 30 s is killed and the run fails, naming the call. The CLI exits once the report
|
|
2511
2609
|
is out. Cases do not assume root: the suite assumes only that the
|
|
2512
2610
|
computer's `HOME`, which the provider sets, is a directory its user can write, and works under
|
|
@@ -2582,7 +2680,9 @@ it is declared (`descriptorProblems`), in words. Its fields: `id`, `label`, `key
|
|
|
2582
2680
|
fills, and whether it is required), `settings` (a setting that is no key but fills an option, with its default),
|
|
2583
2681
|
`metered`, `mounts`, `network` (the network forms its computers make, at least one of none, open and allow),
|
|
2584
2682
|
`capabilities` (the kind and groups of each configuration), `defaultImage` (by setting kind),
|
|
2585
|
-
`prepareImage` (a provider that builds or pulls its image before a run), `
|
|
2683
|
+
`prepareImage` (a provider that builds or pulls its image before a run), `imageEnv` (the server's environment variable
|
|
2684
|
+
that, when set, names the image of every computer of the provider, as Daytona's `AGENTRUN_DAYTONA_SNAPSHOT`), `local`
|
|
2685
|
+
(a computer on this host), and
|
|
2586
2686
|
`ledger` (the option a provider's ledger fills). `providerFor(id, options)` builds a provider by id from its options and
|
|
2587
2687
|
refuses an id it does not hold, naming the ones it does. The provider file, `src/<vendor>.ts`, exports what a
|
|
2588
2688
|
`ProviderModule` is:
|
|
@@ -2648,7 +2748,7 @@ and `alpine:3.20` pulled, both builds, and Go on PATH (the drift case builds a d
|
|
|
2648
2748
|
the daemon for Docker's own architecture, and remove every container they make by its exact name, pass or fail.
|
|
2649
2749
|
`test/docker/image.docker.test.mjs` builds fresh `alpine:3.20` recipes: once for three concurrent callers, reused on
|
|
2650
2750
|
the next call, from three processes at once, and a broken one refused in words; it removes each tag it made. Another,
|
|
2651
|
-
`test/docker/
|
|
2751
|
+
`test/docker/pid1-commands.docker.test.mjs`, runs the adapter's pid1 entrypoint and install (Modal's) exactly as sent, in
|
|
2652
2752
|
a Debian and an Alpine root container with no network, and checks that init comes up as uid 1000 with no capabilities
|
|
2653
2753
|
and `no_new_privs`, and answers hello over `computerd stdio`. Those root containers keep Docker's default
|
|
2654
2754
|
capabilities and add CAP_SYS_ADMIN and CAP_NET_ADMIN (init `--own-network` needs both, and Modal's root holds every
|