@parcha/agentrun-computer 0.1.0-beta.38 → 0.1.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -83
- package/box/Dockerfile +5 -54
- package/box/README.md +9 -3
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +1 -1
- package/box/install.sh +87 -0
- package/box/recipe.d.mts +5 -0
- package/box/recipe.mjs +12 -10
- package/dist/agent37.d.ts +17 -4
- package/dist/agent37.js +98 -17
- package/dist/box-image.d.ts +14 -0
- package/dist/box-image.js +24 -0
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/agent37.d.ts +9 -4
- package/dist/conformance/agent37.js +23 -11
- package/dist/conformance/browserbase.js +3 -3
- package/dist/conformance/cases/apps.d.ts +1 -1
- package/dist/conformance/cases/apps.js +1 -1
- package/dist/conformance/cases/isolation.d.ts +18 -3
- package/dist/conformance/cases/isolation.js +73 -6
- package/dist/conformance/cases/lifetime.js +30 -0
- package/dist/conformance/cases/mount.js +4 -2
- package/dist/conformance/cases/provider.js +88 -1
- package/dist/conformance/cli.js +29 -9
- package/dist/conformance/e2b.js +9 -4
- package/dist/conformance/exec-stream.d.ts +44 -7
- package/dist/conformance/exec-stream.js +347 -88
- package/dist/conformance/kernel.js +2 -2
- package/dist/conformance/modal.js +1 -1
- package/dist/conformance/orgo.js +2 -2
- package/dist/conformance/report.js +3 -0
- package/dist/conformance/runner.js +127 -9
- package/dist/conformance/types.d.ts +21 -0
- package/dist/daytona.d.ts +0 -5
- package/dist/daytona.js +19 -28
- package/dist/descriptor.d.ts +5 -3
- package/dist/descriptors/agent37.d.ts +3 -11
- package/dist/descriptors/agent37.js +9 -10
- package/dist/descriptors/daytona.d.ts +1 -1
- package/dist/descriptors/daytona.js +5 -2
- package/dist/descriptors/docker.d.ts +13 -1
- package/dist/descriptors/docker.js +3 -1
- package/dist/descriptors/e2b.d.ts +2 -9
- package/dist/descriptors/e2b.js +8 -8
- package/dist/descriptors/index.d.ts +21 -19
- package/dist/descriptors/index.js +1 -3
- package/dist/descriptors/modal.d.ts +2 -6
- package/dist/descriptors/modal.js +8 -6
- package/dist/descriptors/orgo.js +2 -1
- package/dist/docker/egress-main.js +23 -15
- package/dist/docker/egress.d.ts +6 -4
- package/dist/docker/egress.js +24 -16
- package/dist/docker/inspect.d.ts +2 -2
- package/dist/docker/inspect.js +5 -5
- package/dist/docker.d.ts +6 -5
- package/dist/docker.js +12 -11
- package/dist/e2b.d.ts +12 -2
- package/dist/e2b.js +42 -19
- package/dist/host.d.ts +113 -59
- package/dist/host.js +5 -0
- package/dist/hosted/framed-exec.d.ts +49 -0
- package/dist/hosted/framed-exec.js +185 -0
- package/dist/hosted/network.d.ts +23 -0
- package/dist/hosted/network.js +77 -0
- package/dist/hosted/process.d.ts +13 -5
- package/dist/hosted/process.js +35 -12
- package/dist/hosted/provider.d.ts +16 -9
- package/dist/hosted/provider.js +475 -170
- package/dist/hosted/rest.d.ts +20 -2
- package/dist/hosted/rest.js +24 -10
- package/dist/hosted/scripts.d.ts +27 -7
- package/dist/hosted/scripts.js +77 -18
- package/dist/{agent37-ssh.d.ts → hosted/ssh-exec.d.ts} +19 -9
- package/dist/{agent37-ssh.js → hosted/ssh-exec.js} +38 -19
- package/dist/hosted/values.d.ts +21 -0
- package/dist/hosted/values.js +55 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/isolation.d.ts +0 -2
- package/dist/isolation.js +3 -4
- package/dist/modal.d.ts +8 -2
- package/dist/modal.js +21 -15
- package/dist/mount-archil.d.ts +5 -4
- package/dist/mount-archil.js +5 -6
- package/dist/orgo.js +6 -4
- package/dist/providers.d.ts +4 -1
- package/dist/surface/api.d.ts +0 -9
- package/dist/surface/core.d.ts +7 -2
- package/dist/surface/core.js +12 -4
- package/dist/surface/index.d.ts +1 -1
- package/dist/surface/index.js +1 -1
- package/dist/surface/script.d.ts +4 -0
- package/dist/surface/script.js +9 -3
- package/package.json +1 -1
- package/box/build-agent37.mjs +0 -158
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
74
74
|
- `stdout` and `stderr` come back apart, in base64. Each keeps at most 360 KiB (`maxOutput`, the default and the most):
|
|
75
75
|
both, in base64, fit one 1 MiB line. The rest is read and dropped, and `truncated` is true.
|
|
76
76
|
- The environment is PATH (the daemon's), HOME, USER and LOGNAME for the user, then, when init relays to an egress
|
|
77
|
-
proxy (`init --egress`, [below](#an-allowlist-the-egress-proxy)), `HTTP_PROXY`, `HTTPS_PROXY`, their lowercase forms
|
|
77
|
+
proxy (`init --egress`, [below](#open-and-an-allowlist-the-egress-proxy)), `HTTP_PROXY`, `HTTPS_PROXY`, their lowercase forms
|
|
78
78
|
and `NO_PROXY`, then `env` over them. Nothing else of the daemon's environment is passed on.
|
|
79
79
|
- `user` is a name or `uid[:gid]`. A daemon without CAP_SETUID and CAP_SETGID cannot switch users and answers `denied`.
|
|
80
80
|
Init leaves itself no capability (below), so a command runs as the daemon's own user.
|
|
@@ -121,8 +121,12 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
|
|
|
121
121
|
`computerd stdio` stays outside and still reaches init's socket: a unix socket with a path is not in a network
|
|
122
122
|
namespace. It needs root with CAP_SYS_ADMIN and CAP_NET_ADMIN (a VM's root, a privileged container); without them, or
|
|
123
123
|
with any read-back short, init refuses to start in words and the computer fails closed. `--own-network` takes no
|
|
124
|
-
`--egress
|
|
125
|
-
|
|
124
|
+
`--egress`; for a spec whose network is `open` or a list it takes `--network open|allow:<list>`, and init, still
|
|
125
|
+
root and in the machine's own network, first starts the egress proxy (`daemon/internal/egress`): as nobody, on a
|
|
126
|
+
Unix socket root's and the tool user's group's alone (`/opt/agentrun/egress/egress.sock`), to the public internet
|
|
127
|
+
only (Docker's egress table, plus the machine's own addresses), and with a list to its hosts alone, refused before
|
|
128
|
+
any lookup. Init relays its loopback port 3128 to that socket and gives its programs the proxy env; their namespace
|
|
129
|
+
stays their loopback alone. The code is `daemon/internal/isolate`; `test/docker/loopback-block.docker.test.mjs` runs each
|
|
126
130
|
provider's start in a root container beside a stand-in agent on 2280 and 49983.
|
|
127
131
|
- **Where root may not make the network namespace, init makes it inside a user namespace.** Root holds no
|
|
128
132
|
CAP_SYS_ADMIN on gVisor (Modal's GPU runtime), so `unshare(CLONE_NEWNET)` is EPERM. It may make a user namespace with
|
|
@@ -430,8 +434,8 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
430
434
|
| --- | --- |
|
|
431
435
|
| docker | none |
|
|
432
436
|
| daytona | sandbox: `DAYTONA_DEFAULT_SNAPSHOT` ("default") |
|
|
433
|
-
| modal |
|
|
434
|
-
| e2b |
|
|
437
|
+
| modal | none: `prepareImage()` answers the box image (`boxImageRef()`) |
|
|
438
|
+
| e2b | none: `prepareImage()` answers the box template (`boxE2bTemplate()`), for a sandbox and a desktop alike |
|
|
435
439
|
| orgo | desktop: `ORGO_BASE_IMAGE` ("linux") |
|
|
436
440
|
| phone-harness | phone: `PHONE_IMAGE` ("android") |
|
|
437
441
|
| browserbase, kernel, local | browser: `BROWSER_IMAGE` ("chromium") |
|
|
@@ -716,21 +720,21 @@ was deleted.
|
|
|
716
720
|
words.
|
|
717
721
|
- `check(spec)` refuses in words, with no Docker call: no image, no or a bad `lifetimeMs` (`checkLifetime`: at most
|
|
718
722
|
30 days), a network that is not `none`, `open` or an allowlist the egress proxy takes
|
|
719
|
-
([below](#an-allowlist-the-egress-proxy)), a NUL byte in any string, and any field Docker does not support. Once the host has been read (below), it also refuses with `field: "host"` for each enforcement
|
|
723
|
+
([below](#open-and-an-allowlist-the-egress-proxy)), a NUL byte in any string, and any field Docker does not support. Once the host has been read (below), it also refuses with `field: "host"` for each enforcement
|
|
720
724
|
the host lacks. `create` never throws on a spec `check` passes.
|
|
721
725
|
- Before `docker run`, `create` reads the host's enforcement once per provider (`host()`, from `docker info`; see
|
|
722
726
|
below), and refuses a host that lacks any of it in words, having made nothing.
|
|
723
727
|
- `create` runs `docker run` as a non-root user (`--user`, below), with every capability dropped (`--cap-drop ALL`),
|
|
724
728
|
`--security-opt no-new-privileges`, `--ipc private --cgroupns private` (never the daemon's defaults, which a host can
|
|
725
|
-
set to `shareable` or, on cgroup v1, the host's cgroup namespace), `--network
|
|
726
|
-
|
|
729
|
+
set to `shareable` or, on cgroup v1, the host's cgroup namespace), `--network none` for every network (`open` and an
|
|
730
|
+
allowlist go through the computer's egress proxy, below), serve's sizes unless the spec gives its own (2
|
|
727
731
|
CPUs as a quota, `--cpu-period 100000 --cpu-quota 200000`, so a host with fewer CPUs still runs one; 4 GiB with swap
|
|
728
732
|
the same; 1024 pids), and the daemon (its copy, next) bind-mounted read-only at `/opt/agentrun/computerd` as
|
|
729
733
|
the entrypoint, `computerd init --deadline <time>`, which is PID 1, holds every process and reaps orphans. The label
|
|
730
734
|
`agentrun.computer.deadline` holds the time `lifetimeMs` ends, and init gets the same time: then it ends every
|
|
731
735
|
process as on SIGTERM (below) and exits 0, which stops the container. Init refuses to start with no deadline.
|
|
732
736
|
Deleting a stopped computer is the janitor's (`lifetime: "janitor"`). A container that is not running after its
|
|
733
|
-
start is removed. The lifetime counts from just before the proxy (for an allowlist) and `docker run`, so a Docker host
|
|
737
|
+
start is removed. The lifetime counts from just before the proxy (for open or an allowlist) and `docker run`, so a Docker host
|
|
734
738
|
that holds the start eats into it: a computer whose init exited 0 because its deadline passed before `docker run`
|
|
735
739
|
finished fails `create` as `timeout`, with the lifetime and how long the start took ("its lifetime of 45 s ended
|
|
736
740
|
before docker run finished (it took 101.2 s)").
|
|
@@ -778,7 +782,8 @@ was deleted.
|
|
|
778
782
|
the ISO time the provider writes), `state` (`running` or `stopped`), `network` as read back, and `mount` when
|
|
779
783
|
something is mounted at `/workspace`.
|
|
780
784
|
- `network(ref)` reads the network back: `none` (network mode none, on no network but Docker's own `none`), `open`
|
|
781
|
-
(
|
|
785
|
+
(network mode none, and an egress proxy serving `--open public`, below), `{ allow: [...] }` (below), or
|
|
786
|
+
`{ other: "<words>" }` for anything else, Docker's bridge included, which is never
|
|
782
787
|
reported as a policy. `network(ref, policy)` returns the policy when it is the computer's (an allowlist with the same
|
|
783
788
|
entries, normalized, in any order); any change is refused: a Docker computer's network is fixed at create, since
|
|
784
789
|
Docker cannot move a container with no network onto one, and an allowlist needs its volume mounted at create.
|
|
@@ -792,18 +797,21 @@ was deleted.
|
|
|
792
797
|
Expected failures are results (`{ ok: false, error: { code, message } }`), not throws.
|
|
793
798
|
|
|
794
799
|
What a Docker computer cannot do: run as root or in root's group unless its spec asks, switch users, gain a capability, reach any network
|
|
795
|
-
when asked for `none`, reach anything but its list, through its own proxy, when asked for an allowlist,
|
|
796
|
-
daemon, or run past its deadline.
|
|
800
|
+
when asked for `none`, reach anything but its list, through its own proxy, when asked for an allowlist, reach a
|
|
801
|
+
private, loopback, link-local or metadata address when asked for `open`, write the daemon, or run past its deadline.
|
|
797
802
|
|
|
798
|
-
###
|
|
803
|
+
### Open and an allowlist: the egress proxy
|
|
799
804
|
|
|
800
805
|
```ts
|
|
801
806
|
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: { allow: ["pypi.org", "*.pythonhosted.org", "93.184.215.0/24"] } }, { requestId: "r1#3" });
|
|
802
807
|
// In the computer, HTTP_PROXY and HTTPS_PROXY name port 3128 on its own loopback for every program computerd starts.
|
|
803
808
|
```
|
|
804
809
|
|
|
805
|
-
A computer whose network is an allowlist stays `--network none`: its own loopback, no route, no resolver.
|
|
806
|
-
out is its own egress proxy, in a second container the provider makes, reads back and removes with it.
|
|
810
|
+
A computer whose network is `open` or an allowlist stays `--network none`: its own loopback, no route, no resolver.
|
|
811
|
+
Its one way out is its own egress proxy, in a second container the provider makes, reads back and removes with it.
|
|
812
|
+
Under `open` the proxy runs with `--open public` and no list: every public host, and the same refusals of private,
|
|
813
|
+
loopback, link-local, metadata and this host's own addresses as under a list. A Docker computer is never on Docker's
|
|
814
|
+
bridge itself. The proxy is
|
|
807
815
|
serve's (`src/docker/egress-proxy.ts`, with its address table in `src/docker/egress-table.ts`), moved here; it holds no
|
|
808
816
|
key.
|
|
809
817
|
|
|
@@ -813,7 +821,7 @@ key.
|
|
|
813
821
|
digest; `new DockerProvider({ daemonPath, egress: { image } })` replaces it) runs `dist/docker/egress-main.js`, this
|
|
814
822
|
package's own build, bound read-only with its `package.json`. It is on Docker's default bridge alone, publishes no
|
|
815
823
|
port, and runs as the computer's uid:gid with a read-only root, `--cap-drop ALL`, `no-new-privileges`, 256 MiB, 64
|
|
816
|
-
pids, half a CPU (a fixed quota, not the computer's own cpus), 1024 open files and a bounded log. Its argv holds the list, the computer's deadline (it ends itself then), this machine's own
|
|
824
|
+
pids, half a CPU (a fixed quota, not the computer's own cpus), 1024 open files and a bounded log. Its argv holds the list (or `--open public`), the computer's deadline (it ends itself then), this machine's own
|
|
817
825
|
public addresses (refused as `this-host`), and `egress.hint`, the words a refusal adds (printable ASCII).
|
|
818
826
|
`EGRESS_IMAGE` is the one place its digest is written. `create` pulls it at the first allow computer when the host
|
|
819
827
|
lacks it (see Lifetime), so a host with no registry access pulls it ahead, reading the name from this package:
|
|
@@ -826,15 +834,15 @@ key.
|
|
|
826
834
|
- **What a list holds** (`capabilities().allow`): names, exact or `*.suffix` (two labels or more), and CIDRs, IPv4 or
|
|
827
835
|
IPv6, with host bits zero and over no range the address rule refuses; both in one list, at most 256 of each, each on
|
|
828
836
|
ports 80 and 443. `check` refuses anything else in words: an empty list (ask for `none`), an address with no prefix, a
|
|
829
|
-
port, a URL, a private range. On a Docker host that remaps user ids (userns-remap or rootless Docker), an
|
|
830
|
-
|
|
837
|
+
port, a URL, a private range. On a Docker host that remaps user ids (userns-remap or rootless Docker), open and an
|
|
838
|
+
allowlist are refused before anything is made, as a bind is: the volume's owner and the proxy's code are host ids the computer's
|
|
831
839
|
user does not map to, and the provider does not guess the mapping.
|
|
832
840
|
- **The Docker host's own addresses.** The proxy refuses them as `this-host`, so it must know them. Docker does not
|
|
833
841
|
report them; the provider passes this machine's public interface addresses, which are the Docker host's only when
|
|
834
842
|
the provider runs on it. When it runs in a container (`/.dockerenv`, `/run/.containerenv`, or a container's cgroup in
|
|
835
843
|
`/proc/self/cgroup`), or its docker CLI talks to a daemon that is not a local unix socket (`docker context inspect`,
|
|
836
|
-
which resolves the context and `DOCKER_HOST` as the CLI does), an allowlist
|
|
837
|
-
made, and `check` says so once it knows, unless `egress.hostAddresses` names the host's addresses (IP addresses),
|
|
844
|
+
which resolves the context and `DOCKER_HOST` as the CLI does), open and an allowlist are refused in words before
|
|
845
|
+
anything is made, and `check` says so once it knows, unless `egress.hostAddresses` names the host's addresses (IP addresses),
|
|
838
846
|
which then go to the proxy beside this machine's own. A plain local host is as before. `egress.hostRoot` (default
|
|
839
847
|
`/`) is the root those container signs are read under, for tests and embedders. An address that is not on any
|
|
840
848
|
interface is never seen: a cloud machine's NAT'd or elastic public IP. Put those in `egress.hostAddresses` too. The
|
|
@@ -862,12 +870,13 @@ key.
|
|
|
862
870
|
sweep's labels, whose deadline label has passed, or whose computer is gone and that is older than a create could
|
|
863
871
|
take (its ready wait and two minutes), removed by what the label found. The volume carries the computer's deadline
|
|
864
872
|
and the spec's labels for this. Until then the proxy stops forwarding at its deadline.
|
|
865
|
-
- **Read-back.** `network`, `list` and `attach` read the allowlist from Docker: network mode none, the egress volume
|
|
873
|
+
- **Read-back.** `network`, `list` and `attach` read open or the allowlist from Docker: network mode none, the egress volume
|
|
866
874
|
read-only at its path, init's relay in its command, and a proxy container that carries the computer's label and
|
|
867
875
|
deadline, runs while the computer runs, is hardened and bounded as above (its memory and swap, pids limit, private
|
|
868
876
|
IPC and cgroup namespaces, and json-file log of 1m and 2 files included) with exactly its volume and code, and whose
|
|
869
|
-
argv holds the list and refuses every one of the Docker host's own addresses the provider
|
|
870
|
-
fine). Anything less is `{ other: "network allow, but its egress proxy ... <why>" }
|
|
877
|
+
argv holds the list (or `--open public`) and refuses every one of the Docker host's own addresses the provider
|
|
878
|
+
requires now (more is fine). Anything less is `{ other: "network allow, but its egress proxy ... <why>" }` (or
|
|
879
|
+
`network open, ...`). **A crashed proxy** is not
|
|
871
880
|
restarted: the computer then reaches nothing, its network reads back `other` ("is not running"), and `attach` refuses
|
|
872
881
|
it, so a caller makes a new computer. `list` reads every listed computer's proxy in one more inspect.
|
|
873
882
|
|
|
@@ -1057,7 +1066,7 @@ From `docker inspect`, what create asks for:
|
|
|
1057
1066
|
|
|
1058
1067
|
| Field | Must be |
|
|
1059
1068
|
| --- | --- |
|
|
1060
|
-
| network (`HostConfig.NetworkMode`, `NetworkSettings.Networks`, and for an allowlist the egress volume, init's relay and the proxy container) | `none`, `open` or the allowlist as declared, read back as `network(ref)` does |
|
|
1069
|
+
| network (`HostConfig.NetworkMode`, `NetworkSettings.Networks`, and for open or an allowlist the egress volume, init's relay and the proxy container) | `none`, `open` or the allowlist as declared, read back as `network(ref)` does |
|
|
1061
1070
|
| `HostConfig.CapDrop`, `CapAdd`, `Privileged` | `["ALL"]`, nothing added, false |
|
|
1062
1071
|
| `HostConfig.SecurityOpt` | exactly `["no-new-privileges"]`: `seccomp=unconfined`, `apparmor=unconfined`, `label=disable`, `systempaths=unconfined` or any other option is drift |
|
|
1063
1072
|
| `HostConfig.IpcMode`, `CgroupnsMode` | `private`, `private` |
|
|
@@ -1071,7 +1080,7 @@ From `docker inspect`, what create asks for:
|
|
|
1071
1080
|
| `Config.User` | the uid:gid asked for: the spec's, the provider's, or the default |
|
|
1072
1081
|
| `Config.Image`, `WorkingDir` | the spec's image; its `workdir`, or `/work` |
|
|
1073
1082
|
| `Config.Env` | one `HOME`, `HOME=/work`; the image's other variables are its own |
|
|
1074
|
-
| `Config.Entrypoint`, `Cmd` | `["/opt/agentrun/computerd"]`, `["init", "--deadline", <the deadline label's value>]`, and for an allowlist `"--egress", "/opt/agentrun/egress/egress.sock"` after it |
|
|
1083
|
+
| `Config.Entrypoint`, `Cmd` | `["/opt/agentrun/computerd"]`, `["init", "--deadline", <the deadline label's value>]`, and for open or an allowlist `"--egress", "/opt/agentrun/egress/egress.sock"` after it |
|
|
1075
1084
|
| `Config.Labels` | `agentrun.computer=1`, the deadline as written, and every label the spec asked for; others are the image's |
|
|
1076
1085
|
| `AppArmorProfile` | `docker-default` when the host has AppArmor, else empty |
|
|
1077
1086
|
| `ProcessLabel` | of type `container_t` when the host has SELinux, else empty |
|
|
@@ -1262,10 +1271,10 @@ runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests
|
|
|
1262
1271
|
- **Sizes are limits**, as in Docker: `cpus` (at least 0.25) becomes `cpuLimit` in physical cores (2 CPUs each) and
|
|
1263
1272
|
`memoryMb` becomes `memoryLimitMiB`, each with Modal's default request (0.125 cores, 128 MiB) or less. `pids` and
|
|
1264
1273
|
`workdir` are refused: Modal has no pids limit, and a computer works in `/work`, its home.
|
|
1265
|
-
- **Tags.** A sandbox's tags are the adapter's labels (`agentrun.computer`, its name, deadline
|
|
1266
|
-
deadline
|
|
1267
|
-
|
|
1268
|
-
|
|
1274
|
+
- **Tags.** A sandbox's tags are the adapter's labels (`agentrun.computer`, its name, deadline and image, and a GPU
|
|
1275
|
+
computer's GPUs; no max-deadline, which only `extend` reads) and the caller's. Modal takes 10 tags, 512 bytes of them, names and
|
|
1276
|
+
values together (the host's `labels`): the adapter's `check()` counts them as create gives them, its own at their
|
|
1277
|
+
longest, and refuses past either in words with no call; create refuses the same words first. An Archil computer's mount label records the
|
|
1269
1278
|
folder's agent alone, as on every host: the folder's run is the `agentrun.run` label's. `list` is `sandboxes.list({ appId, tags })` over the provider's app: running sandboxes only, and one Modal still
|
|
1270
1279
|
lists after its terminate is polled and left out once `poll()` reads it finished.
|
|
1271
1280
|
- **release** `delete` is `terminate()`, and the adapter waits until get answers none (`poll()` reads it finished).
|
|
@@ -1274,8 +1283,8 @@ runs on the VM runtime, or on gVisor for a GPU computer (below). Its unit tests
|
|
|
1274
1283
|
`A100` (40 GB), `A100-40GB`, `A100-80GB`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B300`, at most 8 to a computer.
|
|
1275
1284
|
`spec.gpu: { type, count }` becomes the SDK's `gpu` (`"T4"`, `"A100-80GB:2"`), and since Modal offers GPUs on gVisor
|
|
1276
1285
|
only, such a sandbox runs with `runtime: "gvisor"`; every other computer stays on the VM runtime. The probe's kernel
|
|
1277
|
-
is held to it at create: gVisor's on a GPU computer, a VM's on any other. Modal reads no GPU back
|
|
1278
|
-
|
|
1286
|
+
is held to it at create: gVisor's on a GPU computer, a VM's on any other. Modal reads no GPU back: the adapter's
|
|
1287
|
+
`agentrun.computer.gpu` label records them, and attach and a retry read them there. `gpu.mounts` is `[]`: a GPU with an Archil mount is refused (checkGpu).
|
|
1279
1288
|
- **The loopback fence on gVisor.** Modal's gVisor gives root no CAP_SYS_ADMIN, so init, given the same
|
|
1280
1289
|
`--own-network`, makes its programs' network namespace inside a user namespace (the daemon's fallback, any vendor).
|
|
1281
1290
|
Declared: `gpu.fence: "userns-netns"`; read back: hello's `fence`, and create notes it. Proven in Docker
|
|
@@ -1476,8 +1485,8 @@ from (the loopback block):
|
|
|
1476
1485
|
isolation.vendor-agent probes it from a program of the computer's user, on both loopbacks. Init takes others' access
|
|
1477
1486
|
off every socket under `/run`; Daytona's D-Bus session bus sits in `/tmp` (`/tmp/dbus-<10 characters>`, which a
|
|
1478
1487
|
program of the computer's user could connect to in the live baseline), so create, as root and before init starts,
|
|
1479
|
-
takes others' access off each socket `/tmp/dbus-*` names (
|
|
1480
|
-
|
|
1488
|
+
takes others' access off each socket `/tmp/dbus-*` names (as on every child host), and its notes name the ones it
|
|
1489
|
+
closed. A runner whose root may
|
|
1481
1490
|
not make a network namespace (no CAP_SYS_ADMIN: a container class on a runner that is not privileged) fails closed:
|
|
1482
1491
|
init refuses to start, in words, and create deletes the sandbox.
|
|
1483
1492
|
- The provider still installs and starts the daemon through that toolbox, as root or through passwordless `sudo`, and
|
|
@@ -1503,7 +1512,7 @@ the TTL.
|
|
|
1503
1512
|
| --- | --- | --- |
|
|
1504
1513
|
| `kind` | `linux` | a Linux shell with computerd: exec, files and processes |
|
|
1505
1514
|
| `lifetime` | `vendor` | `ttlMinutes` destroys the sandbox in any state once it elapses; set to the lifetime in whole minutes, rounded up. Init also ends every process at the deadline itself. |
|
|
1506
|
-
| `network` | `none` | `networkBlockAll` at create, and the daemon's own network namespace; open and
|
|
1515
|
+
| `network` | `none`, `open`, `allow` | none: `networkBlockAll` at create, and the daemon's own network namespace; open and a list: not blocked (the account's tier may still limit where it goes), and the daemon's own namespace whose one way out is init's egress proxy (public internet only; a list's hosts alone) |
|
|
1507
1516
|
| `vendorAgentPorts` | `[2280]` | the toolbox's port, on every interface; isolation.vendor-agent checks a program of the computer's user reaches it on neither loopback |
|
|
1508
1517
|
| `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot |
|
|
1509
1518
|
| `os` | `linux` | Linux classes only; Windows and macOS are not offered here |
|
|
@@ -1513,7 +1522,7 @@ the TTL.
|
|
|
1513
1522
|
| `maxLifetimeMs` | 30 days | the cap `check` gives, through the shared `checkLifetime`; Daytona's TTL is whole minutes and documents no cap of its own |
|
|
1514
1523
|
| `user` | none | the daemon runs as the provider's `daemonUser`; a spec cannot name a user |
|
|
1515
1524
|
| `release` | `delete` | `DELETE /sandbox/{id}`; a stop is refused as `unsupported` |
|
|
1516
|
-
| `gpu` | `H100`; at most 1 | daytona-gpu's own GPU (`DAYTONA_GPU_SNAPSHOT_GPU`, from GET /snapshots/daytona-gpu). A GPU computer is made from Daytona's GPU snapshot `daytona-gpu` (`DAYTONA_GPU_SNAPSHOT`: its default sandbox image, user `daytona` with passwordless sudo, plus the CUDA toolkit), sent as `snapshot`: its spec's image is `"daytona-gpu"` or `"default"`, and `check` refuses any other (a snapshot of box/Dockerfile among them) in words. A Daytona snapshot carries its own resources, so the create sends none (no `cpu`, `gpu`, `gpuType`, `memory` or `disk`: Daytona refuses them beside a snapshot, 400 "Cannot specify Sandbox resources when using a snapshot")
|
|
1525
|
+
| `gpu` | `H100`; at most 1 | daytona-gpu's own GPU (`DAYTONA_GPU_SNAPSHOT_GPU`, from GET /snapshots/daytona-gpu). A GPU computer is made from Daytona's GPU snapshot `daytona-gpu` (`DAYTONA_GPU_SNAPSHOT`: its default sandbox image, user `daytona` with passwordless sudo, plus the CUDA toolkit), sent as `snapshot`: its spec's image is `"daytona-gpu"` or `"default"`, and `check` refuses any other (a snapshot of box/Dockerfile among them) in words. A Daytona snapshot carries its own resources, so the create sends none (no `cpu`, `gpu`, `gpuType`, `memory` or `disk`: Daytona refuses them beside a snapshot, 400 "Cannot specify Sandbox resources when using a snapshot"). Another type or count needs a snapshot of its own, so `check` refuses it. A GPU computer's limits, declared on `capabilities().gpu`: `preemptible: true` (daytona.io/pricing lists its GPUs as "Preemptible GPU prices": a run on one can be cut short); `stopDeletes: true` (it is made with `autoDeleteInterval: 0`, whatever `autoDeleteMinutes` says. That is Daytona's ephemeral: its SDK's `ephemeral` sets it, and `CreateSandbox` has no `ephemeral` field, so none is sent. A GPU sandbox has no pause and no snapshot, so stopping it deletes it and nothing on it persists); `region: "earth"` (Daytona's one GPU region, sent as `target` in place of the provider's); `perGpu` 16 vCPU, 100 GiB memory and 400 GiB disk, the snapshot's; `mounts: []`, so a GPU computer with any mount is refused in words: Daytona's GPU host gives no `/dev/fuse`, even to root (live 11-11), and the archil client mounts through FUSE. In serve's Mode 2 the run's folder is an Archil mount, so a Daytona GPU sandbox is refused there, and Settings' `gpu.why` says so. The org needs GPU credits, or the create is refused in Daytona's words. Create notes who installed the daemon: daytona-gpu's `daytona` user through passwordless sudo, or root on a snapshot of box/Dockerfile. The `gpuSnapshot` option names our own GPU snapshot instead: box/Dockerfile as it is, built with one GPU by `box/build-daytona.py --gpu H100` (resources gpu 1 and gpuType H100, named `agentrun-archil-gpu-h100-<recipe hash>`, in region earth). Its user is root, its GPU is the one its name says, and its GPU computers take no mount either. It carries no CUDA toolkit: pip install torch brings its own CUDA runtime; the host gives the driver. A GPU spec's image is then `"default"` or that name. An Archil computer's preflight reads `/dev/fuse`, and one without it is refused in those words ("this computer has no /dev/fuse, so the Archil folder can't be mounted") before anything else |
|
|
1517
1526
|
|
|
1518
1527
|
### What the provider does
|
|
1519
1528
|
|
|
@@ -1529,7 +1538,8 @@ the TTL.
|
|
|
1529
1538
|
the deadline to), `public: false`, `networkBlockAll`, `ttlMinutes`, `autoStopInterval` (`autoStopMinutes`; unset, 0,
|
|
1530
1539
|
since Daytona's idle timer counts only outside traffic and a daemon at work would be stopped), and
|
|
1531
1540
|
`autoDeleteInterval` (`autoDeleteMinutes`; unset, -1: a stop keeps the sandbox, which the TTL then ends). `POST
|
|
1532
|
-
/sandbox` is never retried; a name Daytona already holds (409) is `exists
|
|
1541
|
+
/sandbox` is never retried; a name Daytona already holds (409) is `exists`, and the adapter adopts the sandbox the
|
|
1542
|
+
name lists, as a retry does (or answers `exists` when none lists). A create that fails without a 4xx
|
|
1533
1543
|
answer, or is aborted, may still have made the sandbox, so the adapter deletes the name it chose. Then it waits for
|
|
1534
1544
|
`started` (polling `GET /sandbox/{id}`), pushes in and starts the daemon, checks the daemon and probes its network
|
|
1535
1545
|
none from inside, and waits until the label listing shows the new computer twice running (Daytona's listing trails
|
|
@@ -1566,8 +1576,8 @@ the TTL.
|
|
|
1566
1576
|
|
|
1567
1577
|
### The daemon check
|
|
1568
1578
|
|
|
1569
|
-
Daytona's create options are not read back: what create sent is what the sandbox has.
|
|
1570
|
-
|
|
1579
|
+
Daytona's create options are not read back: what create sent is what the sandbox has. A GPU computer's GPUs are the
|
|
1580
|
+
adapter's `agentrun.computer.gpu` label, as on every host. From the daemon, over one connection: hello (the provider's version, `linux`, the `arch` option, every daemon
|
|
1571
1581
|
capability), `/proc/self/status` (Uid and Gid the daemon user's four times, no groups, `NoNewPrivs: 1`, `CapInh`,
|
|
1572
1582
|
`CapPrm`, `CapEff`, `CapBnd` and `CapAmb` all zero), `/proc/self/cwd` (`/work`) and `/proc/self/exe`
|
|
1573
1583
|
(`/opt/agentrun/computerd`); its own network (loopback alone), and the probe: no target answers a computer with
|
|
@@ -1706,11 +1716,16 @@ E2B's own. `create` takes the caller's request id (`{ requestId }`, serve's is t
|
|
|
1706
1716
|
`computer-` and the first 12 hex digits of its sha256, and a retry of the same request finds the computer the first
|
|
1707
1717
|
made instead of making a second.
|
|
1708
1718
|
|
|
1709
|
-
An E2B computer is a sandbox made from an E2B template
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1719
|
+
An E2B computer is a sandbox made from an E2B template. The descriptor names no default: it says `prepareImage`, and
|
|
1720
|
+
`prepareImage()` answers the box template, `boxE2bTemplate()` (`src/box-image.ts`), with no call and no wait. That is
|
|
1721
|
+
`<BOX_E2B_PUBLISHER>/agentrun-archil-<recipe hash>`, the box image (`box/Dockerfile`: the archil client and helper,
|
|
1722
|
+
the tool user, FUSE, Xvfb, xfwm4 and the apps) that the release's `box-e2b` job builds as a template in the publishing
|
|
1723
|
+
team and makes public, so any E2B account starts it by that name. A sandbox and a desktop both start from it, in either
|
|
1724
|
+
mode. It is kind `desktop`: computerd starts the X server and xfwm4 itself (`src/desktop.ts`), as on a Docker desktop,
|
|
1725
|
+
and its X11 shim drives it. With `kind: "linux"` it is kind `linux` on any template, with no display: the same
|
|
1726
|
+
provider, minus the X server, so it costs nothing to offer. A caller that names a template (`create({ image })`) gets
|
|
1727
|
+
that one: E2B Desktop's own, `desktop`, still works for kind `desktop`, since computerd needs only Xvfb and xfwm4 from
|
|
1728
|
+
it. Every call goes through the host's E2B JS SDK, the `e2b` package's `Sandbox` class, whose types `src/e2b.ts` imports
|
|
1714
1729
|
as types only (held as `typeof Sandbox` inside, `object` in the published types), so nothing loads from it at import; the package is the host's to install, as
|
|
1715
1730
|
Modal's is. `@e2b/desktop` is not used: it starts Xvfb and Xfce with `commands.run`, outside computerd's process table
|
|
1716
1731
|
and with no bound or abort (`@e2b/desktop@2.5.0` `dist/index.mjs:387-415`), and the provider needs none of its other
|
|
@@ -1744,7 +1759,11 @@ E2B's envd is the sandbox's first process, a systemd service with `Restart=alway
|
|
|
1744
1759
|
The listing shows a new sandbox a moment late, so the name is listed again until it shows or `listedMs` (15 s)
|
|
1745
1760
|
passes, and the sandbox found is killed and read back gone, as release waits for one.
|
|
1746
1761
|
2. `getInfo` reads the sandbox's state until it runs.
|
|
1747
|
-
3.
|
|
1762
|
+
3. A command as root makes the system paths whose permissions E2B's template build sets wider than root's root's alone
|
|
1763
|
+
(`HostFacts.rootOnly`, `ROOT_ONLY` in `src/e2b.ts`), and everything under a directory: root the owner, and write
|
|
1764
|
+
taken off group and other users. It fails create if any entry is still not root's alone. It runs before anything of create's is in the
|
|
1765
|
+
sandbox, so the daemon's install and the Archil helper's sha256 check read what only root can change. Then
|
|
1766
|
+
`files.write` uploads the daemon as root to `/tmp/agentrun-computerd-<random>` (`index.mjs:2332-2435`), and the
|
|
1748
1767
|
same install command as Daytona's (`src/hosted/scripts.ts`) moves it to `/opt/agentrun/computerd`, root-owned, and
|
|
1749
1768
|
prints its sha256, which must be the uploaded one's, and who installed it (a create note).
|
|
1750
1769
|
4. The adapter's start command, a background command as root, starts `computerd init --deadline <time> --user
|
|
@@ -1752,7 +1771,8 @@ E2B's envd is the sandbox's first process, a systemd service with `Restart=alway
|
|
|
1752
1771
|
detached: in a session of its own (`setsid`), its output to `/run/agentrun-init.log`, so the command ends at once
|
|
1753
1772
|
and a daemon that never answers is reported with init's own words. Every command goes through envd's
|
|
1754
1773
|
`Process.Start` stream, called on the SDK's own Connect client (`commands.rpc`, `index.mjs:4972-4985`) as
|
|
1755
|
-
`commands.run` calls it (`index.mjs:5123-5146`): `/bin/
|
|
1774
|
+
`commands.run` calls it (`index.mjs:5123-5146`), without its login shell: `/bin/sh` by its path runs the argv as its
|
|
1775
|
+
own words (`-c 'exec "$@"' sh <argv>`), with `PATH` the system's directories alone, root by the Basic header
|
|
1756
1776
|
(`index.mjs:1896-1900`), envd's keepalive every 50 s, and no deadline on the stream (timeout 0, which the Connect
|
|
1757
1777
|
transport reads as none), because envd kills a command whose timeout passes (envd `process/start.go:39-44`); the
|
|
1758
1778
|
SDK's default would end it after 60 s (`index.mjs:4978`). Only the start is bounded.
|
|
@@ -1795,7 +1815,7 @@ would hold an empty process table).
|
|
|
1795
1815
|
| --- | --- | --- |
|
|
1796
1816
|
| `kind` | `desktop` (default) or `linux` | `options.kind`; a desktop's X server is computerd's own |
|
|
1797
1817
|
| `lifetime` | `vendor` | E2B kills the sandbox at its timeout, set to the lifetime; init ends every process at the deadline too |
|
|
1798
|
-
| `network` | `none` | `allowInternetAccess` false and `allowPublicTraffic` false at create, and the daemon's own network namespace;
|
|
1818
|
+
| `network` | `none`, `open`, `allow` | none: `allowInternetAccess` false and `allowPublicTraffic` false at create, and the daemon's own network namespace; open and a list: `allowInternetAccess` true (`allowPublicTraffic` stays false), and the daemon's own namespace whose one way out is init's egress proxy (public internet only; a list's hosts alone) |
|
|
1799
1819
|
| `vendorAgentPorts` | `[49983]` | envd's port; isolation.vendor-agent checks a program of the computer's user reaches it on neither loopback |
|
|
1800
1820
|
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
1801
1821
|
| `isolation` | `microvm` | Firecracker |
|
|
@@ -1817,9 +1837,9 @@ Modal) also tries IPv4 and IPv6 addresses from inside at create and attach, the
|
|
|
1817
1837
|
`[2606:4700:4700::1111]:53/udp`, or the `probeTargets` option), and refuses the computer if one answers within the 10 s
|
|
1818
1838
|
window (the rule every provider shares: [Network none, read from inside](#network-none-read-from-inside-nothing-answers)).
|
|
1819
1839
|
The probe's `exec.run` is bounded at 30 s (`timeouts.probeMs`), above its longest run, 20 s. Open and an allowlist
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1840
|
+
go through the egress proxy init starts outside the daemon's programs' network (the shared hosted adapter's, below):
|
|
1841
|
+
the sandbox is made with internet access, and the programs reach the public internet, or the list's hosts, through
|
|
1842
|
+
`127.0.0.1:3128` alone. The network is fixed at create: `network(ref, policy)` refuses a change. Since the probe runs inside the
|
|
1823
1843
|
daemon's own network, every target reads `refused` there, whatever E2B's firewall would have done; the firewall facts
|
|
1824
1844
|
below are what a program outside that namespace meets.
|
|
1825
1845
|
|
|
@@ -1910,7 +1930,8 @@ The conformance module, `dist/conformance/e2b.js`, checks `AGENTRUN_COMPUTER_LIV
|
|
|
1910
1930
|
else, then reads the run's settings (`settingsFromEnv`, below) and builds the provider through `create()` with every
|
|
1911
1931
|
computer capped at 30 minutes, Hobby's plan for conformance
|
|
1912
1932
|
(Hobby caps a sandbox at 1 h; a run that needs more moves to Pro). `conformanceImage()` is `COMPUTER_E2B_TEMPLATE`, else
|
|
1913
|
-
`desktop` (`base` for kind linux),
|
|
1933
|
+
`desktop` (`base` for kind linux), E2B's stock templates, which conformance keeps since it proves the provider rather
|
|
1934
|
+
than the box (a run against the box template passes it as `COMPUTER_E2B_TEMPLATE`), and `createDriftedProvider()` uploads a daemon built with Go as `<version>-drift`.
|
|
1914
1935
|
`test/e2b/conformance.e2b.test.mjs` runs the suite with `computerd-fixture` built for linux/amd64, and skips unless the
|
|
1915
1936
|
switch and `COMPUTER_E2B_API_KEY` are both set; `E2B_API_KEY` never counts.
|
|
1916
1937
|
|
|
@@ -1961,8 +1982,8 @@ Agent37 runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)):
|
|
|
1961
1982
|
start, the stdio bridge, the probe, the janitor's extend, idempotent create by the request's name label). An Agent37
|
|
1962
1983
|
computer is an instance made from a workspace template, by default `agent37-base`, Agent37's plain Debian 12. It is
|
|
1963
1984
|
kind `linux`, on type `vm` (a VM with its own kernel, the default) or `default` (Agent37's gVisor sandbox). With
|
|
1964
|
-
`kind: "desktop"` it is a Linux desktop on `agentrun-box
|
|
1965
|
-
([below](#the-desktop-agentrun-box)).
|
|
1985
|
+
`kind: "desktop"` it is a Linux desktop on `agentrun-box-<recipe hash>`, our public box image registered as a template
|
|
1986
|
+
of the key's workspace on its first run ([below](#the-desktop-agentrun-box)).
|
|
1966
1987
|
|
|
1967
1988
|
### Two keys
|
|
1968
1989
|
|
|
@@ -1985,7 +2006,7 @@ names the API key by its sha256 prefix alone.
|
|
|
1985
2006
|
| `extend` | `GET`, then `PATCH` of the whole `metadata` with the new deadline label, since a PATCH replaces it |
|
|
1986
2007
|
| `exec` | SSH as root over a binary WebSocket to `wss://{id}-22022.agent37.app/`, one channel per process on the instance's shared connection (below) |
|
|
1987
2008
|
| `errorCode` | the envelope's `error.code` (or a flat `error` string), then the HTTP status; ssh2's `client-authentication` is `denied` |
|
|
1988
|
-
| `check` | a template name with an optional `@version`; one of Agent37's four shapes; at most 4 CPUs; metadata within 4096 bytes with the provider's own labels |
|
|
2009
|
+
| `check` | a template name with an optional `@version`; one of Agent37's four shapes; at most 4 CPUs; metadata within 4096 bytes with the provider's own labels (the host's `labels.bytes`; create holds the JSON, quotes and commas too, to it) |
|
|
1989
2010
|
|
|
1990
2011
|
Agent37 has no request id and no unique name, so a retried POST makes a second instance: the adapter lists the name
|
|
1991
2012
|
label and keeps the oldest by `created` (whole seconds; ties go to the lowest id), as it does for every vendor.
|
|
@@ -2024,12 +2045,12 @@ at most that late. `delete` ends every connection to the instance at once, a ret
|
|
|
2024
2045
|
| `isolation` | `vm` or `gvisor` | `options.type`: `vm` (default) or `default` |
|
|
2025
2046
|
| `lifetime` | `janitor` | Agent37 never ends an instance on its own; init's deadline and the deadline label do, and the run's sweep is the backstop |
|
|
2026
2047
|
| `maxLifetimeMs` | 24 h | the janitor's cap; `options.maxLifetimeMs` sets less |
|
|
2027
|
-
| `network` | `none` | `deny-all` at create, and the daemon's own network namespace |
|
|
2048
|
+
| `network` | `none`, `open`, `allow` | none: `deny-all` at create, and the daemon's own network namespace; open and a list: `allow-all`, and the daemon's own namespace whose one way out is init's egress proxy (public internet only; a list's hosts alone) |
|
|
2028
2049
|
| `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
|
|
2029
2050
|
| `vendorAgentPorts` | `[22022, 7681]` | the platform's sshd (root for whoever holds the key) and its web terminal (ttyd), both seen listening on every VM |
|
|
2030
2051
|
| `mount` | `archil` | the run's folder on an Archil disk; `/dev/fuse` is there on both types (live), and the mount needs the box template |
|
|
2031
2052
|
| `release` | `delete` | `DELETE`; no release maps to Agent37's stop here |
|
|
2032
|
-
|
|
|
2053
|
+
| sizes | `cpus`, `memoryMb` | 2/4, 4/8, 4/16 or 4/32 (CPUs/GB); more than 4 CPUs is refused, since Agent37 gives 4 without saying so |
|
|
2033
2054
|
|
|
2034
2055
|
Every instance is made with `auto_sleep: false`: a VM that sleeps wakes cold, its daemon gone. What create sent is not
|
|
2035
2056
|
read back.
|
|
@@ -2044,7 +2065,7 @@ AGENTRUN_COMPUTER_LIVE_AGENT37=1 COMPUTER_AGENT37_API_KEY=... COMPUTER_AGENT37_S
|
|
|
2044
2065
|
The conformance module, `dist/conformance/agent37.js`, checks `AGENTRUN_COMPUTER_LIVE_AGENT37=1` first, then reads
|
|
2045
2066
|
`COMPUTER_AGENT37_API_KEY` (`apiKey`, required), `COMPUTER_AGENT37_SSH_KEY` (`sshKey`, required, the key's contents),
|
|
2046
2067
|
`COMPUTER_AGENT37_KIND` (`linux`, the default, or `desktop`), `COMPUTER_AGENT37_TEMPLATE` (the run's image, default
|
|
2047
|
-
`agent37-base`, or
|
|
2068
|
+
`agent37-base`, or for kind `desktop` the box template `prepareImage()` registers), `COMPUTER_AGENT37_TYPE`, `COMPUTER_AGENT37_REGION`,
|
|
2048
2069
|
`COMPUTER_AGENT37_API_URL`, `COMPUTER_AGENT37_DAEMON` (`daemonPath`), `COMPUTER_AGENT37_MAX_LIFETIME_MS` and
|
|
2049
2070
|
`COMPUTER_AGENT37_USER` (`daemonUser`), never `AGENT37_API_KEY`. Every computer of a run lives at most 30 minutes.
|
|
2050
2071
|
`createDriftedProvider()` uploads a daemon built as `<version>-drift`. The live sweep is the shared one,
|
|
@@ -2068,23 +2089,21 @@ kernel `4.19.0-gvisor`): root has no `CAP_SYS_ADMIN`, and init made its namespac
|
|
|
2068
2089
|
adapter gives init `DISPLAY` and starts `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp` through the daemon as the tool
|
|
2069
2090
|
user (`src/desktop.ts`), as on E2B, so the X server is one process in init's table, in its own network namespace, and
|
|
2070
2091
|
ends with the computer; xfwm4 starts the same way once the display answers, its session bus out of the user's reach, as
|
|
2071
|
-
on E2B.
|
|
2072
|
-
(`
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
`
|
|
2085
|
-
|
|
2086
|
-
Builds are free, at most three at once per workspace and 45 minutes each (docs: templates, "Build an image in the
|
|
2087
|
-
cloud"). A workspace template is the workspace's own, so each workspace that runs desktops builds it once first.
|
|
2092
|
+
on E2B. It starts from the box image the release publishes, `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
|
|
2093
|
+
(`box/Dockerfile`: the archil client, the helper, the tool user, FUSE, no sudo, plus Xvfb, xfwm4, and the apps E2B
|
|
2094
|
+
Desktop has that are cheap to carry, which the `apps` group lists and opens), as a template of the key's own workspace
|
|
2095
|
+
named `agentrun-box-<recipe hash>`. A sandbox that mounts an Archil disk starts from the same template.
|
|
2096
|
+
|
|
2097
|
+
The descriptor says `prepareImage`, so the provider makes that template itself: `prepareImage()` reads
|
|
2098
|
+
`GET /v1/templates/agentrun-box-<hash>`, and on a 404 registers the public image under that name
|
|
2099
|
+
(`POST /v1/templates` with `name` and `image_ref`, no build), reporting the wait to `onWait` as a pull. Agent37's POST
|
|
2100
|
+
answers once the template is usable, which for an image this size takes minutes, so it is bounded at 15 minutes. A 409
|
|
2101
|
+
is another registration of the same name in flight, and the provider reads the template until it is there. A template
|
|
2102
|
+
the workspace already has is used as it is, so only a workspace's first run waits. The name carries the recipe's hash
|
|
2103
|
+
because Agent37 keeps a template's revisions under one name: a changed recipe is a new template, never a new revision
|
|
2104
|
+
under a run's feet. A refusal (an image Agent37 can't pull, a key it refuses) is the run's error, in Agent37's words.
|
|
2105
|
+
The hash is `box/recipe.mjs`'s, read from the `box/` folder this package ships, so a server asks for the image its own
|
|
2106
|
+
release published.
|
|
2088
2107
|
|
|
2089
2108
|
Why not Agent37's own `agent37-ubuntu`, which ships a desktop: its image (`ghcr.io/agent37-platform/ubuntu:2026.10.13c`,
|
|
2090
2109
|
entrypoint `images/vm/ubuntu/entrypoint.sh` of agent37-platform/templates) runs `Xtigervnc :1 ... -ac` as root, with
|
|
@@ -2475,7 +2494,7 @@ A provider for another vendor passes the same suite as Docker's, with one comman
|
|
|
2475
2494
|
|
|
2476
2495
|
```sh
|
|
2477
2496
|
npm run conformance -w @parcha/agentrun-computer -- --provider docker # or modal, daytona: any registry id
|
|
2478
|
-
npm run conformance -w @parcha/agentrun-computer -- --provider ./my-provider.js [--image debian:bookworm-slim] [--only exec,files] [--fixture <path>] [--json]
|
|
2497
|
+
npm run conformance -w @parcha/agentrun-computer -- --provider ./my-provider.js [--image debian:bookworm-slim] [--only exec,files] [--fixture <path>] [--long] [--concurrency <n>] [--json]
|
|
2479
2498
|
```
|
|
2480
2499
|
|
|
2481
2500
|
```text
|
|
@@ -2494,16 +2513,27 @@ core PASS 55/55 · 10 optional cases skipped, not declared · full 10/13 · moun
|
|
|
2494
2513
|
```
|
|
2495
2514
|
|
|
2496
2515
|
A hosted vendor runs the exec pre-check first, with `--exec-stream --machine <id> [--quick]`: the module's
|
|
2497
|
-
`createHost(options)` and `host.exec` alone, on a machine made by hand, checked for a live, two-way
|
|
2516
|
+
`createHost(options)` and `host.exec` alone, on a machine made by hand, checked for a live, two-way stream that keeps text intact,
|
|
2498
2517
|
with no timeout (`src/conformance/exec-stream.ts`; [the contract](../../spec/computer/provider.md#a-hosted-vendors-exec)).
|
|
2499
|
-
|
|
2500
|
-
|
|
2518
|
+
`stdout-unread` writes 4 MiB to `cat` over 10 s with its stdout left unread, then reads it: a write may wait while
|
|
2519
|
+
nobody reads, but must go on once stdout is read, and every byte comes back in order. After the checks, one more exec
|
|
2520
|
+
prints what the machine offers the rest of the host, each with what it means: whether root's `unshare -n` works (else
|
|
2521
|
+
`unshare -Urn`, the gVisor fence, else no fence for network none, open and allow), whether root can open `/dev/fuse`
|
|
2522
|
+
(Archil), `uname -m` (`facts.arch`), the kernel (gVisor when dmesg says so) and the TCP listeners from
|
|
2523
|
+
`/proc/net/tcp{,6}` (for `facts.vendorAgentPorts`). These are facts, never a pass or a fail of exec. It exits 0 when
|
|
2524
|
+
every check passes and 1 when one fails, and `--json` prints `{ host, machine, checks: [{ id, status, words, ms }],
|
|
2525
|
+
pass, facts: [{ id, value, means }], factsProblem? }`.
|
|
2501
2526
|
|
|
2502
2527
|
An id is resolved through the provider registry, and only there; the usage lists every id it holds. A module path is
|
|
2503
2528
|
resolved from the directory npm was run in. It exits 0 when Core passes, 1 when it fails, 2 on a
|
|
2504
2529
|
usage error, and 3 on a partial run; `--json` prints the report object (`{ provider, providerVersion, kind,
|
|
2505
2530
|
daemonMode, image, daemons: [{ computer, role, version, os, arch, fence? }], only?, coreNotRun?, results: [{ id, level,
|
|
2506
|
-
group, status, reason?, undeclared? }], core, undeclared, cleanup, notes?, computerNotes? }`).
|
|
2531
|
+
group, status, reason?, undeclared? }], core, undeclared, cleanup, computers: { peak, cap? }, notes?, computerNotes? }`).
|
|
2532
|
+
`computers.peak` is the most computers the run had alive at once, each counted from its create's call until its release
|
|
2533
|
+
(the text report's `computers alive at once: <peak> at most` line). `--concurrency <n>` (`concurrency` in
|
|
2534
|
+
`runConformance`'s options, its `cap`) keeps it at `n` or under, for a vendor plan that keeps fewer: a create waits for a
|
|
2535
|
+
computer to be released, the run's computer is deleted while a case that doesn't use it needs room (and made again for
|
|
2536
|
+
the next case that does), and a case that needs more at once than `n` fails in words. A failure is listed under
|
|
2507
2537
|
its line with what the case found. A computer's `role` is `"shared"` for the run's computer, which the cases that need
|
|
2508
2538
|
none of their own share, else the id of the case that made it. `daemons` holds each computer's first `hello`, one entry
|
|
2509
2539
|
per computer in the order they answered (empty when none did), so computers of one run that differ are kept apart: a GPU
|
|
@@ -2562,7 +2592,8 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2562
2592
|
`files.*` and `tar.*` methods, the `process.*` methods, a computer with network `none` (`network:none`: a provider
|
|
2563
2593
|
that cannot make one fails Core, and the suite never asks for a wider network instead), `check`, `create`, `attach`
|
|
2564
2594
|
(with the spec it reads back: the network and image create asked for, and a non-root `user` as `uid:gid`), `list`,
|
|
2565
|
-
`network` read-back and `release
|
|
2595
|
+
`network` read-back and `release` (a deleted computer stays gone: after a refused connect, `attach` by id, a second
|
|
2596
|
+
connect and `list` find nothing, so a vendor that wakes a machine on the next request fails), `release(ref, "stop")` as declared (a provider whose `capabilities().release` holds
|
|
2566
2597
|
`"stop"` lists the computer stopped until it is deleted, or, when it also declares `stopDeletes`, leaves it neither
|
|
2567
2598
|
listed nor attachable; one that does not refuses stop as `unsupported`, in words, and the computer stays listed and
|
|
2568
2599
|
running), a change to a network the provider does not declare refused with the
|
|
@@ -2577,6 +2608,16 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2577
2608
|
DNS name): every target must read `refused`, and the probe's `interfaces` must be `["lo"]`. So it proves, per
|
|
2578
2609
|
provider, that a tool reaches neither the vendor's agent nor any address. A provider that declares nothing (Docker:
|
|
2579
2610
|
no agent inside) skips it in words.
|
|
2611
|
+
- **What root runs** (`isolation.root-runs`, Core wherever exec runs): through `exec.run`, as the computer's user, the
|
|
2612
|
+
case reads `test -w` on root's `PATH` directories, the daemon, the Archil helper and client, the vendor's agent and
|
|
2613
|
+
init's table where an image has them, and every directory above each (`ROOT_RUNS`), and fails on any it may write. A
|
|
2614
|
+
path on a read-only mount is closed (BusyBox's `test -w` reads the mode bits alone, so the case reads the mount's
|
|
2615
|
+
options too). It checks write access alone and changes nothing.
|
|
2616
|
+
`mount.archil-isolated-durable` runs the same check on its Archil computer.
|
|
2617
|
+
- **The label file** (`isolation.label-file`, Core wherever files runs): a host whose vendor keeps no labels
|
|
2618
|
+
(`facts.labels: "machine"`) has the adapter write them to `/var/lib/agentrun/labels.json`, root's, 0600 in a 0700
|
|
2619
|
+
directory. The case reads that path with `files.read`, as the computer's user, and passes on `not_found` (no such
|
|
2620
|
+
file: a host that keeps labels at the vendor) or `denied`; it fails if the read succeeds.
|
|
2580
2621
|
- **Core by kind.** `coreGroups(kind, daemon)` is what a computer of its kind must declare (the table in
|
|
2581
2622
|
[The protocol extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)): exec, files,
|
|
2582
2623
|
processes and network `none` wherever computerd runs, screen and keyboard and pointer on a desktop, screen and touch
|
|
@@ -2606,7 +2647,9 @@ Core and Full follow the Kubernetes agent-sandbox conformance levels (KEP-539.2)
|
|
|
2606
2647
|
moving apart), `lifetime.extend` (`extend`: made with 45 s and extended to 120 s, at 60 s it answers ping with a
|
|
2607
2648
|
process started earlier still running and `list()` shows the new deadline; three extends are refused with the
|
|
2608
2649
|
deadline unchanged: to an earlier deadline, to maxLifetimeMs + 1, and, 60 s after create, to maxLifetimeMs less 30 s,
|
|
2609
|
-
within the cap on its own but past create + maxLifetimeMs; a cap under 3 min skips it).
|
|
2650
|
+
within the cap on its own but past create + maxLifetimeMs; a cap under 3 min skips it), and `lifetime.idle`, a long
|
|
2651
|
+
case that runs only with `--long` (`long` from code; the live sweep gives it): a computer made with 10 min, left with
|
|
2652
|
+
no call and no connection for 6 min, past a vendor's idle timer, is still listed running and answers ping.
|
|
2610
2653
|
- **`screen.watch` is Core in the screen group**: through the provider's `watch()`, the first frame decodes (a PNG
|
|
2611
2654
|
whole; a JPEG walked to its end, as the suite has no JPEG decoder) to the size it says, of the screen `screen.shot`
|
|
2612
2655
|
reads; on a computer with `input.pointer`, a pointer move through `input()` is a new frame with the cursor where it
|
|
@@ -2728,7 +2771,7 @@ it is declared (`descriptorProblems`), in words. Its fields: `id`, `label`, `key
|
|
|
2728
2771
|
fills, and whether it is required), `settings` (a setting that is no key but fills an option, with its default),
|
|
2729
2772
|
`metered`, `mounts`, `network` (the network forms its computers make, at least one of none, open and allow),
|
|
2730
2773
|
`capabilities` (the kind and groups of each configuration), `defaultImage` (by setting kind),
|
|
2731
|
-
`prepareImage` (a provider
|
|
2774
|
+
`prepareImage` (a provider whose `prepareImage()` answers its image before a run: it builds, pulls or names it), `imageEnv` (the server's environment variable
|
|
2732
2775
|
that, when set, names the image of every computer of the provider, as Daytona's `AGENTRUN_DAYTONA_SNAPSHOT`), `local`
|
|
2733
2776
|
(a computer on this host), and
|
|
2734
2777
|
`ledger` (the option a provider's ledger fills). `providerFor(id, options)` builds a provider by id from its options and
|
|
@@ -2779,8 +2822,8 @@ npm test -w @parcha/agentrun-computer # unit tests: no Go, no Dock
|
|
|
2779
2822
|
cd packages/computer/daemon && go vet ./... && go test ./...
|
|
2780
2823
|
AGENTRUN_COMPUTER_LIVE_DOCKER=1 npm run test:docker -w @parcha/agentrun-computer
|
|
2781
2824
|
AGENTRUN_COMPUTER_LIVE_DAYTONA=1 COMPUTER_DAYTONA_API_KEY=... [COMPUTER_DAYTONA_SNAPSHOT=<snapshot>] npm run test:daytona -w @parcha/agentrun-computer
|
|
2782
|
-
AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal -w @parcha/agentrun-computer # also needs COMPUTER_MODAL_TOKEN_ID/SECRET,
|
|
2783
|
-
AGENTRUN_COMPUTER_LIVE_E2B=1 npm run test:e2b -w @parcha/agentrun-computer # also needs COMPUTER_E2B_API_KEY,
|
|
2825
|
+
AGENTRUN_COMPUTER_LIVE_MODAL=1 npm run test:modal -w @parcha/agentrun-computer # also needs COMPUTER_MODAL_TOKEN_ID/SECRET, for an account you can bill
|
|
2826
|
+
AGENTRUN_COMPUTER_LIVE_E2B=1 npm run test:e2b -w @parcha/agentrun-computer # also needs COMPUTER_E2B_API_KEY, for an account you can bill, and the e2b package
|
|
2784
2827
|
```
|
|
2785
2828
|
|
|
2786
2829
|
`npm test` also runs `test/local-chrome-live.test.mjs` on a real Chrome where one is on PATH (or `CHROME_PATH` names
|
package/box/Dockerfile
CHANGED
|
@@ -25,62 +25,13 @@
|
|
|
25
25
|
# /proc with hidepid=2 is not part of an image: the helper remounts /proc so before each mount, as root, and refuses the
|
|
26
26
|
# mount in a computer where that fails.
|
|
27
27
|
#
|
|
28
|
-
#
|
|
28
|
+
# Every step is install.sh's, so a vendor that builds images in its own account from a running machine runs the same
|
|
29
|
+
# build: this file only puts it and the helper in one folder, runs it as root, and removes the folder.
|
|
29
30
|
FROM python:3.12-slim@sha256:b18b261e1b4974b4f321451ad5251ded85abb22c2b8b262da527dda1d031ab30
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
RUN set -eu; \
|
|
36
|
-
arch="$(dpkg --print-architecture)"; \
|
|
37
|
-
case "$arch" in \
|
|
38
|
-
amd64) sum="$ARCHIL_SHA256_AMD64" ;; \
|
|
39
|
-
arm64) sum="$ARCHIL_SHA256_ARM64" ;; \
|
|
40
|
-
*) echo "no archil client for $arch" >&2; exit 1 ;; \
|
|
41
|
-
esac; \
|
|
42
|
-
case "$sum" in unpinned) echo "archil ${ARCHIL_VERSION} for $arch has no pinned sha256 yet: set ARCHIL_SHA256_$(echo "$arch" | tr a-z A-Z) to the package's sum" >&2; exit 1 ;; esac; \
|
|
43
|
-
apt-get update -qq; \
|
|
44
|
-
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
|
|
45
|
-
git curl ca-certificates nodejs npm ripgrep fuse3 nftables >/dev/null; \
|
|
46
|
-
curl -fsSL -o /tmp/archil.deb "https://s3.amazonaws.com/archil-client/pkg/archil_${ARCHIL_VERSION}_${arch}.deb"; \
|
|
47
|
-
echo "$sum /tmp/archil.deb" | sha256sum -c -; \
|
|
48
|
-
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends /tmp/archil.deb >/dev/null; \
|
|
49
|
-
rm -rf /var/lib/apt/lists/* /tmp/archil.deb; \
|
|
50
|
-
groupadd --gid 2510 agentrun-tool; \
|
|
51
|
-
useradd --uid 2510 --gid 2510 --no-create-home --home-dir /tmp --shell /bin/sh agentrun-tool; \
|
|
52
|
-
install -d -o root -g root -m 0755 /workspace
|
|
53
|
-
|
|
54
|
-
# The desktop: Xvfb and xfwm4, which the provider starts through computerd as the tool user on :0, and the apps an agent
|
|
55
|
-
# opens. Each program and each app's desktop file is checked here. It comes before the sudo guard below, so a package
|
|
56
|
-
# that brought sudo would be taken away and checked gone there (a check here would refuse E2B's build, whose builder adds
|
|
57
|
-
# sudo before these steps).
|
|
58
|
-
RUN set -eu; \
|
|
59
|
-
apt-get update -qq; \
|
|
60
|
-
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
|
|
61
|
-
xvfb xfwm4 x11-xserver-utils xfce4-terminal mousepad firefox-esr xdotool fonts-dejavu-core adwaita-icon-theme >/dev/null; \
|
|
62
|
-
rm -rf /var/lib/apt/lists/*; \
|
|
63
|
-
for x in Xvfb xfwm4 dbus-run-session xsetroot xfce4-terminal mousepad firefox-esr xdotool; do command -v "$x" >/dev/null || { echo "the image has no $x" >&2; exit 1; }; done; \
|
|
64
|
-
for app in org.xfce.mousepad xfce4-terminal firefox-esr; do [ -f "/usr/share/applications/$app.desktop" ] || { echo "the image has no desktop file $app.desktop" >&2; exit 1; }; done
|
|
65
|
-
|
|
66
|
-
COPY agentrun-archil /usr/local/sbin/agentrun-archil
|
|
67
|
-
|
|
68
|
-
# What the helper runs, where it runs it from: an image that lacks one fails here, not at a run's first mount. And no
|
|
69
|
-
# way to root for the tool user: no sudo, no sudoers. A provider's builder may add sudo to the base before these steps
|
|
70
|
-
# (E2B's does): it is taken away first, the package where it is installed and every sudoers file, then checked gone.
|
|
71
|
-
RUN set -eu; \
|
|
72
|
-
if dpkg -s sudo >/dev/null 2>&1; then SUDO_FORCE_REMOVE=yes DEBIAN_FRONTEND=noninteractive apt-get purge -y -qq sudo >/dev/null; fi; \
|
|
73
|
-
rm -rf /etc/sudoers /etc/sudoers.d; \
|
|
74
|
-
chown root:root /usr/local/sbin/agentrun-archil; \
|
|
75
|
-
chmod 0755 /usr/local/sbin/agentrun-archil; \
|
|
76
|
-
for x in /usr/bin/archil /usr/bin/awk /usr/bin/realpath /usr/bin/mount /usr/bin/chown /usr/bin/find /usr/bin/id /usr/bin/ls; do \
|
|
77
|
-
[ -x "$x" ] || { echo "the image has no $x" >&2; exit 1; }; \
|
|
78
|
-
done; \
|
|
79
|
-
! command -v sudo >/dev/null 2>&1 || { echo "the image has sudo" >&2; exit 1; }; \
|
|
80
|
-
[ ! -e /etc/sudoers ] && [ ! -e /etc/sudoers.d ] || { echo "the image has a sudoers file" >&2; exit 1; }; \
|
|
81
|
-
ids="$(id -u agentrun-tool):$(id -g agentrun-tool)"; \
|
|
82
|
-
[ "$ids" = "2510:2510" ] || { echo "agentrun-tool is $ids" >&2; exit 1; }; \
|
|
83
|
-
archil --version | head -1
|
|
32
|
+
COPY install.sh /tmp/agentrun-box/install.sh
|
|
33
|
+
COPY agentrun-archil /tmp/agentrun-box/agentrun-archil
|
|
34
|
+
RUN sh /tmp/agentrun-box/install.sh && rm -rf /tmp/agentrun-box
|
|
84
35
|
|
|
85
36
|
USER root
|
|
86
37
|
# A computer's first process is its provider's own (Daytona's runs this when a snapshot names no entrypoint; Modal's and
|