@parcha/agentrun-computer 0.1.0-beta.52 → 0.1.0-beta.54

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 CHANGED
@@ -16,7 +16,7 @@ import { checkMount, readBackOf, WORKSPACE, type MountSpec } from "@parcha/agent
16
16
 
17
17
  The package root holds the protocol, the registry and the descriptors, and loads no provider: a provider loads by its
18
18
  id (`providerFor(id, options)`, which imports that one provider's file), or from its subpath (`/docker`, `/daytona`,
19
- `/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`, `/smolcloud`). A provider's
19
+ `/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`, `/smolcloud`, `/groundbox`). A provider's
20
20
  option types (`DockerProviderOptions`, `ModalProviderOptions` and the like) come from its subpath too, not the root.
21
21
 
22
22
  The package carries the daemon for Linux amd64 and arm64 in `dist/`, so a provider runs it with no Go on the host. A
@@ -375,7 +375,7 @@ Tar archives move whole trees without holding an archive in memory, and no line
375
375
  - `tar.push.begin {path}` makes the directory if missing and returns `{id}`; `tar.push.write {id, data}` hands it the
376
376
  next bytes (send each after the last one's reply), and extraction runs as they come; `tar.push.end {id}` returns
377
377
  `{entries}`. Files, directories and symlinks are extracted with their modes and never chowned; a file gets its
378
- header's mtime, as tar gives it (a synced folder's push sets `PUSHED_MTIME`, 2000-01-01); a directory keeps
378
+ header's mtime, as tar gives it (`FolderSync.push` into a synced folder sets 2000-01-01); a directory keeps
379
379
  owner access until the archive ends, then gets its mode, deepest first, whether the push made it or found it. An
380
380
  entry that is absolute, has a `..` part, or has a symlink or a file on its way is `denied`, and ends the push;
381
381
  entries before it stay. A symlink at an entry's own name is replaced, never followed. A file is written beside its
@@ -453,7 +453,7 @@ in the kernel's tool registry, keyed by these groups.
453
453
  | id | label | kinds | keys (required unless marked) | mounts | metered |
454
454
  | --- | --- | --- | --- | --- | --- |
455
455
  | docker | Docker | sandbox, desktop | none | bind | no |
456
- | daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET`, `DAYTONA_ARCHIL_EGRESS`, `DAYTONA_ATTACH_EGRESS` (optional) | none (`unmounted`: archil); archil with `DAYTONA_ARCHIL_EGRESS` (`mountsWith`) | yes |
456
+ | daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET`, `DAYTONA_ARCHIL_EGRESS`, `DAYTONA_ATTACH_EGRESS`, `DAYTONA_LISTED_MS` (optional) | none (`unmounted`: archil); archil with `DAYTONA_ARCHIL_EGRESS` (`mountsWith`) | yes |
457
457
  | modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
458
458
  | e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
459
459
  | orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
@@ -672,6 +672,7 @@ live under:
672
672
  | `KERNEL_API_KEY` | Kernel's `apiKey`: the name pi-browser reads today |
673
673
  | `BOXD_API_KEY`, `BOXD_ORG`, `BOXD_REGION` | boxd's `apiKey`, `org` and `region` (unset: the key's own org, the API's home region) |
674
674
  | `SMOLCLOUD_API_KEY` | smol cloud's `apiKey` |
675
+ | `GROUNDBOX_API_KEY` | Groundbox's `apiKey` |
675
676
 
676
677
  - **the conformance CLI and the live harness** (`src/conformance/`: the CLI, each provider's conformance module and the
677
678
  sweeps) read their own `COMPUTER_<ID>_*` names, the ones the live scripts set, through each module's
@@ -1568,7 +1569,7 @@ the TTL.
1568
1569
  | `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 |
1569
1570
  | `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot |
1570
1571
  | `os` | `linux` | Linux classes only; Windows and macOS are not offered here |
1571
- | `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is started detached through a session command of it (above); on dial init is `agentrun-dial`'s child, and `agentrun-dial` the toolbox's entrypoint command ([Daytona on dial](#daytona-on-dial)) |
1572
+ | `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is started detached through a session command of it (above); on dial init is `agentrun-dial`'s child, and `agentrun-dial` a session command create starts ([Daytona on dial](#daytona-on-dial)) |
1572
1573
  | `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
1573
1574
  | `groups` | `exec`, `files`, `processes` | the daemon's own, checked against its hello's `groups`, as is its `kind` |
1574
1575
  | `maxLifetimeMs` | 30 days | the cap `check` gives, through the shared `checkLifetime`; Daytona's TTL is whole minutes and documents no cap of its own |
@@ -1599,8 +1600,13 @@ the TTL.
1599
1600
  name lists, as a retry does (or answers `exists` when none lists). A create that fails without a 4xx
1600
1601
  answer, or is aborted, may still have made the sandbox, so the adapter deletes the name it chose. Then it waits for
1601
1602
  `started` (polling `GET /sandbox/{id}`), pushes in and starts the daemon, checks the daemon and probes its network
1602
- none from inside, and waits until the label listing shows the new computer twice running (Daytona's listing trails
1603
- a create). A sandbox that reads `error` or `build_failed` is gone, and create fails `vendor` with Daytona's
1603
+ none from inside, and waits until the label listing shows the new computer twice running. Daytona's `GET /sandbox`
1604
+ is eventually consistent (`daytonaio/daytona@b5a5d9e7:apps/api/src/sandbox/controllers/sandbox.controller.ts:130-146`:
1605
+ an OpenSearch index the API never writes itself), and on a hosted deployment it left new sandboxes unlisted past
1606
+ 15 s. So a sandbox still unlisted after `listedMs` (15 s unset; `listedMs` or `DAYTONA_LISTED_MS`, in ms) is read by
1607
+ its id: one that reads `started` with its labels is kept, with a note naming the labels, the sandbox and the wait,
1608
+ and `list()` leaves it out until the listing shows it; a retry of its request on the same provider finds it by its
1609
+ id. Any other answer fails create `timeout` in those words. A sandbox that reads `error` or `build_failed` is gone, and create fails `vendor` with Daytona's
1604
1610
  `errorReason`. Any failure or abort after the sandbox exists deletes it, and create never returns ok once its signal
1605
1611
  has aborted.
1606
1612
  - `attach({ id })` takes a sandbox id (or a computer's name, which Daytona answers to as well); `attach({ labels })`
@@ -1684,9 +1690,21 @@ Daytona also sweeps its own label through the host at its end (the report's `cle
1684
1690
 
1685
1691
  With `connect: "dial"` (a server's `daytonaConnect` setting, `COMPUTER_DAYTONA_CONNECT` for conformance; `exec` by
1686
1692
  default) a Daytona sandbox dials the server instead ([PROVIDERS.md](PROVIDERS.md#machines-that-dial-in)). The host has
1687
- no exec and no upload, and nothing goes through the toolbox: create sends the boot env as `CreateSandbox.env` and
1688
- `networkBlockAll: false` (the machine's root reaches the server; network none is init's, inside), and the snapshot's
1689
- entrypoint runs `agentrun-dial`. No Archil mount, no GPU, and not `image: "default"` (Daytona's default snapshot holds
1693
+ no exec and no upload: create sends the boot env as `CreateSandbox.env`, `AGENTRUN_ATTACH_URL` left out, and
1694
+ `networkBlockAll: false` (the machine's root reaches the server; network none is init's, inside). Once the sandbox reads
1695
+ `started` (within the create's time; `error` or `build_failed`, or a sandbox being destroyed, fails create in Daytona's
1696
+ words), create starts `agentrun-dial` itself in a toolbox session of its own, `agentrun-dial`: one async session
1697
+ command, as root, that sets `umask 077` (so init's start log is root's alone whatever the toolbox's umask, and the
1698
+ computer's programs inherit 077),
1699
+ then `&&` takes others' access off each socket `/tmp/dbus-*` names (the sockets step the exec path runs before init),
1700
+ then `&& AGENTRUN_ATTACH_URL='<url>' exec /usr/local/bin/agentrun-dial`, so a step that fails starts nothing. It is the
1701
+ launch line E2B's dial runs (`dialLaunch`), with no rootOnly paths here. The URL is no secret; the token stays in the sandbox's
1702
+ env, which the command inherits, and is on no command line. A session Daytona refuses fails create in its words, and
1703
+ the sandbox is deleted. So the snapshot's entrypoint is not relied on: a box snapshot registered without one (name,
1704
+ image and resources alone) dials too, and one whose entrypoint is the box CMD sleeps, with no `AGENTRUN_ATTACH_URL` in
1705
+ its env, so `agentrun-dial` never runs twice. A machine that does not dial within `createMs` fails with that command's
1706
+ log, read once by the id its start returned, its last 10 lines within 800 characters (`dialLog`; the adapter replaces
1707
+ every machine token in it by `<token>`), or "agentrun-dial never started" when create started none. No Archil mount, no GPU, and not `image: "default"` (Daytona's default snapshot holds
1690
1708
  no `agentrun-dial`): `check()` refuses each in words. Labels as on exec. A dial sandbox may be a desktop
1691
1709
  (`kind: "desktop"`): the box snapshot's X server, started over the socket it dialed, and xfwm4, which computerd starts
1692
1710
  (init's `--window-manager`), at the snapshot's 2 CPUs and 4 GiB, with no GPU. On exec a Daytona computer is kind
@@ -1698,13 +1716,26 @@ What each part of a dial sandbox rests on:
1698
1716
  whose tag is not `latest`, `lts` or `stable` ([docs: create snapshots](https://www.daytona.io/docs/en/snapshots.md#create-snapshots)).
1699
1717
  The one that holds `agentrun-dial` is the box image's, `agentrun-box-<recipe hash>`: `box/build-daytona.py`
1700
1718
  builds it from `box/Dockerfile`, or `POST /snapshots` makes it from the published
1701
- `ghcr.io/parcha-ai/agentrun-box:<recipe hash>` with the same `entrypoint`. The conformance module's run image on
1719
+ `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`, with or without the same `entrypoint`. The conformance module's run image on
1702
1720
  dial is that name. A snapshot carries its own resources: a create that names one sends none (400 "Cannot specify
1703
1721
  Sandbox resources when using a snapshot", live 11-11).
1704
1722
  - **The boot env reaches `agentrun-dial`.** The runner puts `env` in the container's env
1705
1723
  ([runner container_configs.go:87](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/runner/pkg/docker/container_configs.go#L87)),
1706
1724
  and the toolbox's session shell takes the toolbox's env (`cmd.Env = os.Environ()`,
1707
1725
  [daemon session/create.go:23-24](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/pkg/session/create.go#L23-L24)).
1726
+ Live (11-22): a value set in create's `env` was echoed by a session command, which runs as root, and `runAsync` works.
1727
+ `AGENTRUN_ATTACH_URL` comes from the command's own line.
1728
+ - **The dial's log is plain text, framed.** The provider names no SDK version (no `X-Daytona-SDK-Version`), so the
1729
+ toolbox skips its own demux and answers a command's logs as text
1730
+ ([daemon toolbox/process/session/log.go:55-65](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/pkg/toolbox/process/session/log.go#L55-L65),
1731
+ `SkipServerDemux` true for no version,
1732
+ [session/common.go:21-24](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/pkg/session/common.go#L21-L24));
1733
+ with `X-Daytona-Split-Output: true` the output is not combined
1734
+ ([common.go:17-19](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/pkg/session/common.go#L17-L19)),
1735
+ so the text is the log file as written, each write behind its stream's prefix, `\x01\x01\x01` or `\x02\x02\x02`
1736
+ ([session/log.go:121-137](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/pkg/session/log.go#L121-L137)).
1737
+ `dialLog` drops the prefixes, as the daemon does for combined output. Live (11-22): the toolbox's
1738
+ `/process/session/entrypoint/logs` answered plain text, not JSON.
1708
1739
  - **The image's CMD never runs; the snapshot's entrypoint does.** The container's entrypoint is the toolbox daemon, and
1709
1740
  its arguments are the snapshot's entrypoint, else the image's ENTRYPOINT, never its CMD
1710
1741
  ([runner container_configs.go:143-173](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/runner/pkg/docker/container_configs.go#L143-L173));
@@ -1712,9 +1743,11 @@ What each part of a dial sandbox rests on:
1712
1743
  ([daemon main.go:129-164](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/cmd/daemon/main.go#L129-L164)).
1713
1744
  A snapshot built from a Dockerfile with no ENTRYPOINT gets `sleep infinity`
1714
1745
  ([api snapshot.service.ts:883-901](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/api/src/sandbox/services/snapshot.service.ts#L883-L901)),
1715
- so `box/build-daytona.py` names the Dockerfile's CMD as the snapshot's `entrypoint`. The box snapshots it built
1716
- before, `agentrun-archil-<recipe hash>`, have none and never dial, so the snapshot it builds now has a name of its
1717
- own, `agentrun-box-<recipe hash>`, which no snapshot without the entrypoint holds.
1746
+ so `box/build-daytona.py` names the Dockerfile's CMD as the snapshot's `entrypoint`. The provider no longer needs
1747
+ it: a snapshot registered another way (an operator's tooling that sends name, image and resources alone) has no
1748
+ entrypoint, its pid 1 is the bare toolbox daemon and the toolbox has no entrypoint session (404 "session not found",
1749
+ live 11-22), and before create started `agentrun-dial` itself such a sandbox never dialed and failed at
1750
+ `createMs` with no word of why.
1718
1751
  - **Outbound https, by tier.** Tier 1 and 2 organizations reach "essential services" alone, and those leave out shared
1719
1752
  hosting domains; Tier 3 and 4 have full access
1720
1753
  ([docs: tier-based network restrictions](https://www.daytona.io/docs/en/network-limits.md#tier-based-network-restrictions)).
@@ -1741,9 +1774,9 @@ What each part of a dial sandbox rests on:
1741
1774
  ([api sandbox.dto.ts:84](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/api/src/sandbox/dto/sandbox.dto.ts#L84)),
1742
1775
  so whoever holds the API key reads the machine's token; that key already runs root in the sandbox through the
1743
1776
  toolbox. The token is the machine's alone, and revoked at its delete.
1744
- - **Unverified**: whether a box-image sandbox has a D-Bus session bus in `/tmp` (on exec, create closes `/tmp/dbus-*`
1745
- to the computer's user through the toolbox; on dial there is no exec, so nothing does), and the `linux-vm` class on
1746
- dial.
1777
+ - **Unverified**: whether a box-image sandbox has a D-Bus session bus in `/tmp` (create closes `/tmp/dbus-*` to the
1778
+ computer's user either way: on exec through the toolbox before init, on dial in `agentrun-dial`'s launch line), and
1779
+ the `linux-vm` class on dial.
1747
1780
 
1748
1781
  ### Not yet known
1749
1782
 
@@ -1763,7 +1796,8 @@ default snapshot whose `/opt` another user can write would now be refused at cre
1763
1796
  which snapshot Daytona names for a sandbox made with none, and how soon after `autoDestroyAt` Daytona destroys;
1764
1797
  - how long `GET /sandbox/{id}` takes to answer 404 after a delete, and the listing to hide the sandbox (release waits
1765
1798
  for both, up to `goneMs`); how long a stop takes to read `stopped`;
1766
- - how soon the label listing shows a new sandbox;
1799
+ - how soon the label listing shows a new sandbox: 0.7 to 1.6 s in pi-transport's runs, past 15 s on a hosted
1800
+ deployment (create keeps a sandbox the listing trails, above);
1767
1801
  - the ports a CIDR list opens on the production runner, and whether a domain list blocks every port but 80 and 443;
1768
1802
  - `network: none` against the live bypass cases (ruling 9), on each class;
1769
1803
  - the linux-vm class end to end.
@@ -2023,7 +2057,8 @@ words, whatever its value, and every sandbox is made with public traffic off.
2023
2057
  - `create` waits for the sandbox to run; E2B's create options are not read back. Then the daemon: hello (version,
2024
2058
  `linux`, `amd64`, kind and groups), `/proc/self/status` (uid and gid 1000, no groups, `NoNewPrivs` 1, every
2025
2059
  capability set zero), `/proc/self/cwd` (`/work`), `/proc/self/exe`; and for none, the probe. It waits until the label
2026
- listing shows the new computer. A failure, mismatch or abort at any step kills the sandbox and waits for it to go;
2060
+ listing shows the new computer, or, still unlisted after `listedMs`, keeps it when a read by its id finds it running
2061
+ with its labels (the shared adapter's rule, as on Daytona). A failure, mismatch or abort at any step kills the sandbox and waits for it to go;
2027
2062
  create never returns ok once its signal has aborted.
2028
2063
  - `attach({ id })` or `attach({ labels })` reads the computer from E2B and, for a running computer, the daemon, as at
2029
2064
  create. `image` is the template create was asked for, from its label.
@@ -2914,6 +2949,117 @@ On 2026-11-18, from the box image: the exec pre-check passed every check (8 MiB
2914
2949
  at create: the read back found an ext4 mount of `/dev/vda` at `/workspace`. The sweep after the last run read
2915
2950
  `{"swept":0,"gone":0,"stillThere":[],"leftAlone":0}`.
2916
2951
 
2952
+ ## Groundbox
2953
+
2954
+ ```ts
2955
+ import { providerFor } from "@parcha/agentrun-computer";
2956
+
2957
+ // The key is the caller's to pass (serve's GROUNDBOX_API_KEY).
2958
+ const groundbox = await providerFor("groundbox", { apiKey });
2959
+ const made = await groundbox.create({ lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
2960
+ // A desktop: the box image's X server and window manager, started through computerd.
2961
+ const desktop = await providerFor("groundbox", { apiKey, kind: "desktop" });
2962
+ ```
2963
+
2964
+ A Groundbox computer is a [Groundbox](https://groundbox.dev) sandbox: a Firecracker microVM with its own kernel and
2965
+ disk. It is kind `linux` by default, and kind `desktop` with `kind: "desktop"`: computerd starts the box image's Xvfb
2966
+ on `:0` and xfwm4 itself, as on E2B and boxd, and its X11 shim drives it. Groundbox's own desktop (`desktop: true` on
2967
+ create, its own X server, Chrome and live view) is not used. With no image named, it starts from the box image, the public registry tag `prepareImage()` answers
2968
+ (`boxImageRef()`), which Groundbox turns into a disk at the first create from it and keeps for later ones. A spec's
2969
+ `image` may instead be `"default"` (the team's default template, else Groundbox's own Ubuntu 24.04 image), a template
2970
+ of the key's team (`tpl_...`, its name, or `name:version`), or any other public image reference. Groundbox runs on the
2971
+ shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/groundbox.ts` is its `MachineHost`, over Groundbox's
2972
+ REST API (`https://api.groundbox.dev/v1`, `Authorization: Bearer <key>`) with `fetch`, the shared REST client and
2973
+ Node's `WebSocket` (no SDK).
2974
+
2975
+ | MachineHost | Groundbox |
2976
+ | --- | --- |
2977
+ | `create` | `POST /v1/sandboxes` with `image` (a public image), `template` (a template) or neither (`"default"`), the labels as `metadata`, `cpus` and `memory_gb` only when the spec names a size, the provider's `diskGb` when given, `timeout_minutes` at the request's backstop, and an `Idempotency-Key` of the one request, so it is sent again on no answer and Groundbox still starts one sandbox |
2978
+ | `get` | `GET /v1/sandboxes/{id}`: `running` is running, `queued`, `starting` and `resuming` starting, `pausing`, `paused`, `shutting_down` and `shut_down` stopped, `stopping` gone, `stopped` and `failed` none |
2979
+ | `list` | `GET /v1/sandboxes?live=true` with one `metadata[name]=value` per label, every page |
2980
+ | `delete` | `DELETE /v1/sandboxes/{id}` |
2981
+ | `exec` | one resumable command of the command stream (`GET /v1/sandboxes/{id}/exec/stream`, a WebSocket of JSON messages), with `args` (no shell), through `framedExec`; a socket that closes is followed by another that sends `attach` with the command's id and the last output position read; each stdin write is one `POST .../exec` that writes the command's fifo, never sent twice |
2982
+ | `upload` | `PUT /v1/sandboxes/{id}/files?path=`, the bytes as they are |
2983
+ | `extend` | `PATCH /v1/sandboxes/{id}` with the metadata read back and the deadline label changed |
2984
+
2985
+ What Groundbox refuses or this host works around:
2986
+
2987
+ - Every connection to the command stream ends within the hour on Groundbox's side, and any may drop sooner. The command
2988
+ runs on; the host attaches again from the last position read, so no output is lost or read twice. A socket silent
2989
+ past three of Groundbox's 20 s heartbeats is taken as dead and replaced at once, without waiting for a close that a
2990
+ gone peer never sends; anything it says later is ignored. Output Groundbox no longer keeps (`skipped`) fails the
2991
+ stream rather than leave a hole.
2992
+ - Output the reader has not taken is held to 8 MiB: past that the host lets the socket go, and attaches again from the
2993
+ last position queued once the reader is down to 2 MiB. Groundbox keeps the output meanwhile; a reader so slow that
2994
+ Groundbox drops some fails the stream (`skipped`), never silently.
2995
+ - Stdin does not ride the socket: Groundbox delivers a stream's stdin at most once across a dropped connection, with
2996
+ nothing saying what arrived. So each write is a call of up to 256 KiB that writes the command's fifo and answers once
2997
+ it has. The fifo and the record of the command's pid (for its kill) live in a directory of the command's own under
2998
+ `/tmp`, made with mode 0700 under a random name, a path already there refused, and removed when the command ends. A
2999
+ write or a kill first checks the directory is that one (no link, the command user's, 0700) and the fifo or record in
3000
+ it the command user's, and refuses otherwise, so nothing another user leaves in `/tmp` receives stdin (which may hold
3001
+ a disk's token) or picks the pid a kill ends.
3002
+ - A start that is not answered `started` within its call's bound closes its socket with 1000, which ends the command
3003
+ should Groundbox start it after all; every other dropped socket closes with 4000, which leaves it running. A new
3004
+ socket counts as reading on only once Groundbox says something on it, so a peer that takes each attach and stays
3005
+ silent fails the stream after 5 minutes instead of holding `wait()` forever.
3006
+ - The API URL is https; http is taken only to a loopback host (127.0.0.0/8, `::1`, `localhost`), since the key rides
3007
+ every call and the stream's upgrade.
3008
+ - On the box image and any other public image Groundbox runs a command as root. On Groundbox's own image and its
3009
+ templates it runs as the image's user, `runner` (uid 1001), with passwordless sudo, which the adapter's scripts use;
3010
+ `daemonUser` may not be 1001 there.
3011
+ - A desktop needs Xvfb and xfwm4 in its image. Groundbox's own image has Xvfb but not xfwm4, so `check()` refuses
3012
+ `"default"` for kind desktop; the box image has both, and Xfce's terminal and text editor, Firefox ESR and xdotool as
3013
+ its apps.
3014
+ - Groundbox's own image keeps toolchains under `/opt` (corepack's pnpm under
3015
+ `/opt/corepack/v1/pnpm/<version>/dist/node_modules/...`, and `/opt/hostedtoolcache`), deeper than the isolation probe's
3016
+ 8 levels, so `isolation.vendor-agent` can't prove the socket fence on it. That is why the box image is the default.
3017
+ - A refused WebSocket upgrade hides its status from the client, so when a stream does not open the host reads the
3018
+ sandbox to say why (`not_found` for one that is gone).
3019
+ - Sizes are whole CPUs (1 to 16) and whole GB of memory (at most 4 a CPU); `check()` refuses any other. A team's plan
3020
+ may hold it to fewer, which Groundbox refuses in its words. Label names are 1 to 64 characters, values at most 512.
3021
+ - `PATCH` replaces the whole metadata map, so `extend` reads it and sends it back with the deadline label changed.
3022
+ - A computer may live up to 30 days less 6 minutes (Groundbox's longest timer, less the backstop margin), a day unless
3023
+ `maxLifetimeMs` says otherwise.
3024
+ - Sandboxes are amd64. No Archil mount yet (`/dev/fuse` opens in the guest; untried). Groundbox's own
3025
+ egress allowlist is not used: network none, open and a list are init's. Pause, fork and save points are not used.
3026
+
3027
+ ### Conformance on Groundbox
3028
+
3029
+ ```sh
3030
+ AGENTRUN_COMPUTER_LIVE_GROUNDBOX=1 COMPUTER_GROUNDBOX_API_KEY=... \
3031
+ npm run conformance -w @parcha/agentrun-computer -- --provider groundbox --long
3032
+ AGENTRUN_COMPUTER_LIVE_GROUNDBOX=1 COMPUTER_GROUNDBOX_API_KEY=... COMPUTER_GROUNDBOX_KIND=desktop \
3033
+ npm run conformance -w @parcha/agentrun-computer -- --provider groundbox --kind desktop --long --fixture <computerd-fixture for linux/amd64>
3034
+ node packages/computer/dist/conformance/sweep.js --provider groundbox --before /tmp/groundbox-before.json # then --after
3035
+ ```
3036
+
3037
+ The conformance module, `dist/conformance/groundbox.js`, checks `AGENTRUN_COMPUTER_LIVE_GROUNDBOX=1` first, then reads
3038
+ `COMPUTER_GROUNDBOX_API_KEY` (`apiKey`, required), `COMPUTER_GROUNDBOX_API_URL` (`apiUrl`), `COMPUTER_GROUNDBOX_IMAGE`
3039
+ (the run's image, default the box image), `COMPUTER_GROUNDBOX_DAEMON` (`daemonPath`), `COMPUTER_GROUNDBOX_USER`
3040
+ (`daemonUser`) and `COMPUTER_GROUNDBOX_KIND` (`kind`: `linux` by default, or `desktop`), never `GROUNDBOX_API_KEY`. Every computer of a run lives at most 30 minutes. The live sweep is the
3041
+ shared one; its scope is the key's team. `test/groundbox/conformance.groundbox.test.mjs` (`npm run test:groundbox`) runs
3042
+ the suite one test per case (building the fixture with Go), and skips unless the switch and the key are both set.
3043
+
3044
+ ### Live runs
3045
+
3046
+ On 2026-11-19, from the box image at Groundbox's default size (2 CPUs, 4 GB), with a key of a team shared with other
3047
+ work: the exec pre-check passed all ten checks (8 MiB through `cat` in 16 s, `no-timeout` 75 s silent), and the
3048
+ `--long` run passed Core 67/67 and Full 14/41 (the rest not declared) in 17 minutes, with at most 5 computers alive at
3049
+ once. The sweep after it read `{"swept":0,"gone":0,"stillThere":[],"leftAlone":0}`.
3050
+
3051
+ Later that day, with kind desktop and the bounds on the command stream above, from the box image: `--kind desktop
3052
+ --long` with `computerd-fixture` passed the kind, every one of its 74 Core cases (screen, input and
3053
+ `apps.launch-terminate` among them) and Full 14/40, in 19 minutes; `--kind sandbox --long` passed the kind, its 67 Core
3054
+ cases and Full 14/27, in 17 minutes; the exec pre-check passed all ten checks again. The sweep after both read
3055
+ `{"swept":0,"gone":0,"stillThere":[],"leftAlone":0}`.
3056
+
3057
+ On 2026-11-18, on Groundbox's own image, two `--long` runs passed Core 66/67: `isolation.vendor-agent` failed both
3058
+ times on folders under `/opt` deeper than the probe's 8 levels (above). On the same image, a command was held for 65
3059
+ minutes, past the hour any one connection may last: Groundbox closed its socket four times meanwhile (code 1013), the
3060
+ host attached again each time, the command's 1950 lines came back once each and in order, and a write made after the
3061
+ hour reached it. A command read across sockets dropped mid-output (close code 4000) also came back whole.
3062
+
2917
3063
  ## Conformance
2918
3064
 
2919
3065
  A provider for another vendor passes the same suite as Docker's, with one command. The suite is data: each case in
@@ -3254,6 +3400,7 @@ AGENTRUN_COMPUTER_LIVE_DAYTONA=1 COMPUTER_DAYTONA_API_KEY=... [COMPUTER_DAYTONA_
3254
3400
  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
3255
3401
  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
3256
3402
  AGENTRUN_COMPUTER_LIVE_BOXD=1 npm run test:boxd -w @parcha/agentrun-computer # also needs COMPUTER_BOXD_API_KEY, for an account you can bill, and the @boxd-sh/sdk package
3403
+ AGENTRUN_COMPUTER_LIVE_GROUNDBOX=1 npm run test:groundbox -w @parcha/agentrun-computer # also needs COMPUTER_GROUNDBOX_API_KEY, for a team you can bill
3257
3404
  ```
3258
3405
 
3259
3406
  `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/README.md CHANGED
@@ -24,4 +24,7 @@ files it copies (`recipe.mjs`). A changed recipe is a new image, and the same re
24
24
  Each release publishes it (`.github/workflows/release.yml`, the `box` job) as `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
25
25
  and `:<release tag>`, for linux/amd64, and builds the public E2B template `agentrun-archil-<recipe hash>` from it in the
26
26
  same job, which E2B's provider starts in any account as `boxE2bTemplate()` (`src/box-image.ts`). The build-*
27
- scripts here say how to build it for each provider.
27
+ scripts here say how to build it for each provider. `build-daytona.py --documents` builds it with the documents layer
28
+ on top (`../documents/documents.sh`, the libraries that write Office files, which the Docker box's documents image runs
29
+ too) as a snapshot of its own, `agentrun-documents-<hash>`, the hash covering this recipe and that layer: this recipe's
30
+ hash, and the snapshot named by it, stay as they are.
@@ -14,11 +14,19 @@
14
14
  # The snapshot's entrypoint is the Dockerfile's CMD, named: Daytona's toolbox runs a snapshot's entrypoint as its first
15
15
  # command, and a snapshot built from a Dockerfile with no ENTRYPOINT gets `sleep infinity` instead, never the CMD
16
16
  # (daytonaio/daytona@b5a5d9e7 apps/api/src/sandbox/services/snapshot.service.ts:883-901). That CMD starts agentrun-dial
17
- # when the create set AGENTRUN_ATTACH_URL (a Daytona computer on connect "dial"), and sleeps otherwise. The name is
18
- # agentrun-box-<hash>: the agentrun-archil-<hash> snapshots built before this named no entrypoint, so they never dial,
19
- # and a new name keeps a run from landing on one.
17
+ # when AGENTRUN_ATTACH_URL is in the sandbox's env, and sleeps otherwise. The provider no longer needs it: on connect
18
+ # "dial" its create leaves AGENTRUN_ATTACH_URL out of the env and starts agentrun-dial in a toolbox session itself, so a
19
+ # box snapshot registered without this entrypoint dials too, and this one sleeps instead of dialing twice. The name is
20
+ # agentrun-box-<hash>, the recipe's hash alone (this file is not in it).
20
21
  #
21
- # python3 packages/computer/box/build-daytona.py [--gpu H100]
22
+ # With --documents, the box image with the documents layer run on top (../documents/documents.sh, the libraries that
23
+ # write decks, documents and sheets, which the Docker box's documents image runs too), as its own snapshot:
24
+ # agentrun-documents-<hash>, the hash covering the box recipe and documents.sh, so agentrun-box-<hash> stays what it
25
+ # was. AGENTRUN_DAYTONA_SNAPSHOT names it for a server whose agents need those libraries (computer.needs).
26
+ #
27
+ # --documents takes no --gpu: the GPU snapshot is the box image's alone.
28
+ #
29
+ # python3 packages/computer/box/build-daytona.py [--gpu H100 | --documents]
22
30
  import hashlib
23
31
  import json
24
32
  import os
@@ -29,22 +37,37 @@ from daytona import CreateSnapshotParams, Daytona, GpuType, Image, Resources
29
37
  GPUS = {"H100": GpuType.H100}
30
38
 
31
39
  args = sys.argv[1:]
40
+ usage = f"usage: build-daytona.py [--gpu {'|'.join(GPUS)} | --documents]"
41
+ documents = "--documents" in args
42
+ if documents:
43
+ args.remove("--documents")
44
+ # The documents layer is for a CPU box: no GPU snapshot of it, whose name daytonaGpuSnapshot() would not take.
45
+ if args:
46
+ sys.exit("build-daytona.py: --documents builds the CPU box's documents snapshot alone; drop --gpu")
32
47
  gpu = None
33
48
  if args:
34
49
  if len(args) != 2 or args[0] != "--gpu" or args[1] not in GPUS:
35
- sys.exit(f"usage: build-daytona.py [--gpu {'|'.join(GPUS)}]")
50
+ sys.exit(usage)
36
51
  gpu = args[1]
37
52
 
38
53
  here = os.path.dirname(os.path.abspath(__file__))
39
54
  recipe = b"".join(open(os.path.join(here, name), "rb").read() for name in ("Dockerfile", "install.sh", "agentrun-archil"))
55
+ # The documents layer's folder, with a trailing separator: Daytona's SDK then files documents.sh at the top of the
56
+ # build's context as documents.sh, beside the box's install.sh, never over it.
57
+ layer = os.path.join(os.path.dirname(here), "documents", "")
58
+ if documents:
59
+ recipe += open(os.path.join(layer, "documents.sh"), "rb").read()
40
60
  digest = hashlib.sha256(recipe).hexdigest()[:12]
41
- name = f"agentrun-archil-gpu-{gpu.lower()}-{digest}" if gpu else f"agentrun-box-{digest}"
61
+ name = f"agentrun-archil-gpu-{gpu.lower()}-{digest}" if gpu else f"agentrun-documents-{digest}" if documents else f"agentrun-box-{digest}"
62
+ image = Image.from_dockerfile(os.path.join(here, "Dockerfile"))
63
+ if documents:
64
+ image = image.dockerfile_commands(["COPY documents.sh /tmp/agentrun-documents/documents.sh", "RUN sh /tmp/agentrun-documents/documents.sh && rm -rf /tmp/agentrun-documents"], context_dir=layer)
42
65
  cmd = [json.loads(line[4:]) for line in open(os.path.join(here, "Dockerfile")).read().splitlines() if line.startswith("CMD ")][-1]
43
66
  print(f"build-daytona: snapshot {name}", file=sys.stderr)
44
67
  Daytona().snapshot.create(
45
68
  CreateSnapshotParams(
46
69
  name=name,
47
- image=Image.from_dockerfile(os.path.join(here, "Dockerfile")),
70
+ image=image,
48
71
  entrypoint=cmd,
49
72
  resources=Resources(cpu=16, memory=100, disk=400, gpu=1, gpu_type=GPUS[gpu]) if gpu else Resources(cpu=2, memory=4, disk=10),
50
73
  **({"region_id": "earth"} if gpu else {}),
Binary file
Binary file
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "0.1.0-beta.52",
2
+ "version": "0.1.0-beta.54",
3
3
  "source": "sha256:704cb76aa815c7c8e06d6efb4c386314effcdfc1c88b6c1ee55b981abad45d8d"
4
4
  }
@@ -17,14 +17,12 @@
17
17
  // links, a change is on the copy before the call that made it answers, a delete reaches it, and a folder past a cap
18
18
  // fails the call in words.
19
19
  import { randomBytes } from "node:crypto";
20
- import { pushTar } from "../../files.js";
21
20
  import { EPOCH_LABEL, RUN_LABEL, runLabels as claimLabels } from "../../labels.js";
22
21
  import { MOUNT_KINDS, readBackOf, WORKSPACE } from "../../mount.js";
23
22
  import { syncingClient } from "../../mount-archil.js";
24
23
  import { MAX_LIST_DEPTH, MAX_OUTPUT_BYTES } from "../../protocol.js";
25
24
  import { ok } from "../../result.js";
26
- import { FolderSync, PUSHED_MTIME, SYNC_MAX_ENTRIES } from "../../sync-folder.js";
27
- import { tarStream } from "../../tar.js";
25
+ import { FolderSync, SYNC_MAX_ENTRIES } from "../../sync-folder.js";
28
26
  import { assertIsolated, assertRootRunsClosed } from "./isolation.js";
29
27
  import { b64, CASE_LABEL, decode } from "./util.js";
30
28
  /** The claim epoch the run-folder cases make their computers under. */
@@ -264,7 +262,7 @@ class CopySink {
264
262
  }
265
263
  /**
266
264
  * A computer made with a synced folder, its copy `entries` held by the runner and pushed into /workspace as one tar, each
267
- * file at PUSHED_MTIME (none: an empty folder), the computer's listing read as the manifest, and its client under
265
+ * file stamped as FolderSync.push does (none: an empty folder), the computer's listing read as the manifest, and its client under
268
266
  * syncingClient, as a runner hands it to the tools: each call that may change the folder answers once its delta is on
269
267
  * the copy.
270
268
  */
@@ -284,11 +282,8 @@ async function synced(t, name, entries = []) {
284
282
  };
285
283
  const { ref } = await mounted(t, kept, EPOCH, name);
286
284
  const connected = await t.connect(ref);
287
- const pushed = entries.map((entry) => (entry.type === "file" ? { ...entry, mtime: PUSHED_MTIME } : entry));
288
- if (entries.length > 0)
289
- t.ok(await pushTar(connected.client, WORKSPACE, tarStream(pushed)), `tar.push of the run's folder into ${WORKSPACE}`);
290
285
  const folder = new FolderSync(connected.client, copy);
291
- t.ok(await folder.baseline(), `files.list of ${WORKSPACE} pushed in, as the manifest`);
286
+ t.ok(await folder.push(entries), `the run's folder pushed into ${WORKSPACE} (tar.push), its files.list read as the manifest`);
292
287
  const client = syncingClient(connected.client, async () => {
293
288
  const done = await folder.sync();
294
289
  return done.ok ? ok(undefined) : done;
@@ -0,0 +1,61 @@
1
+ import { type GroundboxProvider, type GroundboxProviderOptions } from "../groundbox.js";
2
+ import type { MachineHost } from "../host.js";
3
+ /** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
4
+ export declare const GROUNDBOX_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_GROUNDBOX";
6
+ /** apiKey, required: the Groundbox API key. */
7
+ readonly key: "COMPUTER_GROUNDBOX_API_KEY";
8
+ /** apiUrl: the REST API, ending in /v1; default https://api.groundbox.dev/v1. */
9
+ readonly apiUrl: "COMPUTER_GROUNDBOX_API_URL";
10
+ /** The image every computer of the run starts from: a public image, a template, or "default" (Groundbox's own); default the box image (boxImageRef). */
11
+ readonly image: "COMPUTER_GROUNDBOX_IMAGE";
12
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
13
+ readonly daemon: "COMPUTER_GROUNDBOX_DAEMON";
14
+ /** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
15
+ readonly user: "COMPUTER_GROUNDBOX_USER";
16
+ /** kind: linux (default) or desktop. */
17
+ readonly kind: "COMPUTER_GROUNDBOX_KIND";
18
+ };
19
+ /** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
20
+ export declare const ENV: {
21
+ readonly live: "AGENTRUN_COMPUTER_LIVE_GROUNDBOX";
22
+ /** apiKey, required: the Groundbox API key. */
23
+ readonly key: "COMPUTER_GROUNDBOX_API_KEY";
24
+ /** apiUrl: the REST API, ending in /v1; default https://api.groundbox.dev/v1. */
25
+ readonly apiUrl: "COMPUTER_GROUNDBOX_API_URL";
26
+ /** The image every computer of the run starts from: a public image, a template, or "default" (Groundbox's own); default the box image (boxImageRef). */
27
+ readonly image: "COMPUTER_GROUNDBOX_IMAGE";
28
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
29
+ readonly daemon: "COMPUTER_GROUNDBOX_DAEMON";
30
+ /** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
31
+ readonly user: "COMPUTER_GROUNDBOX_USER";
32
+ /** kind: linux (default) or desktop. */
33
+ readonly kind: "COMPUTER_GROUNDBOX_KIND";
34
+ };
35
+ /** What this module reads from the environment: the key, and each other option whose name is set. */
36
+ export type GroundboxSettings = Pick<GroundboxProviderOptions, "apiKey" | "apiUrl" | "daemonPath" | "daemonUser" | "kind">;
37
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing it. */
38
+ export declare function settingsFromEnv(env?: Record<string, string | undefined>): GroundboxSettings;
39
+ /** The longest lifetime a computer of a run may ask for. */
40
+ export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
41
+ /** For the run's report: what this configuration means for the suite. */
42
+ export declare const conformanceNotes: string[];
43
+ export interface GroundboxModuleOptions extends Pick<GroundboxProviderOptions, "fetch" | "webSocket" | "daemonPath" | "timeouts"> {
44
+ /** Where the settings are read; default process.env. */
45
+ env?: Record<string, string | undefined>;
46
+ /** Builds this package's daemon for linux/amd64 stamped with version, and gives its path; default go build. */
47
+ buildDaemon?: (version: string) => Promise<string>;
48
+ }
49
+ /** The provider the CLI runs; throws in words without the live switch or the key. */
50
+ export declare function createProvider(options?: GroundboxModuleOptions): Promise<GroundboxProvider>;
51
+ /** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
52
+ export declare function createDriftedProvider(options?: GroundboxModuleOptions): Promise<GroundboxProvider>;
53
+ /** The image every computer of the run starts from: COMPUTER_GROUNDBOX_IMAGE, else the box image prepareImage() answers. */
54
+ export declare function conformanceImage({ env }?: Pick<GroundboxModuleOptions, "env">): Promise<string>;
55
+ /**
56
+ * The Groundbox host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live
57
+ * switch, since the sweep makes nothing, and it calls nothing until the sweep does.
58
+ */
59
+ export declare function createHost(options?: Pick<GroundboxModuleOptions, "env" | "fetch" | "webSocket">): Promise<MachineHost>;
60
+ /** Where the sweep lists, in words: the key's team, the key named by its sha256 prefix alone. */
61
+ export declare function sweepScope({ env }?: Pick<GroundboxModuleOptions, "env">): string;
@@ -0,0 +1,87 @@
1
+ // Groundbox for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider groundbox`. It makes
2
+ // real sandboxes, which bill until deleted, so it runs only with AGENTRUN_COMPUTER_LIVE_GROUNDBOX=1 and your own key,
3
+ // under COMPUTER_GROUNDBOX_API_KEY. The provider reads no environment: this module reads its own COMPUTER_GROUNDBOX_*
4
+ // names (never GROUNDBOX_API_KEY, which may hold another team's key) and passes each to create() as its option. The live
5
+ // switch is checked first, before any other setting is read. The live sweep (sweep.ts, --provider groundbox) reads the
6
+ // same names through createHost, which needs no live switch: it makes nothing; sweepScope names the key and API a
7
+ // before file must have been listed from.
8
+ //
9
+ // The daemon is uploaded into each sandbox (dist/computerd-linux-amd64, `npm run build:daemon`), so a run publishes
10
+ // nothing. The drifted provider uploads a daemon built with Go as version <version>-drift. Every computer of a run has
11
+ // a deadline of at most 30 minutes, and Groundbox's own timer ends it 5 minutes past that.
12
+ import { createHash } from "node:crypto";
13
+ import { boxImageRef } from "../box-image.js";
14
+ import { create } from "../groundbox.js";
15
+ import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
16
+ import { kindFrom } from "./kind.js";
17
+ /** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
18
+ export const GROUNDBOX_ENV = {
19
+ live: "AGENTRUN_COMPUTER_LIVE_GROUNDBOX",
20
+ /** apiKey, required: the Groundbox API key. */
21
+ key: "COMPUTER_GROUNDBOX_API_KEY",
22
+ /** apiUrl: the REST API, ending in /v1; default https://api.groundbox.dev/v1. */
23
+ apiUrl: "COMPUTER_GROUNDBOX_API_URL",
24
+ /** The image every computer of the run starts from: a public image, a template, or "default" (Groundbox's own); default the box image (boxImageRef). */
25
+ image: "COMPUTER_GROUNDBOX_IMAGE",
26
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
27
+ daemon: "COMPUTER_GROUNDBOX_DAEMON",
28
+ /** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
29
+ user: "COMPUTER_GROUNDBOX_USER",
30
+ /** kind: linux (default) or desktop. */
31
+ kind: "COMPUTER_GROUNDBOX_KIND",
32
+ };
33
+ /** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
34
+ export const ENV = GROUNDBOX_ENV;
35
+ const DEFAULT_API_URL = "https://api.groundbox.dev/v1";
36
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing it. */
37
+ export function settingsFromEnv(env = process.env) {
38
+ const apiKey = env[GROUNDBOX_ENV.key];
39
+ if (apiKey === undefined || apiKey === "")
40
+ throw new Error(`set ${GROUNDBOX_ENV.key} to a Groundbox API key: the conformance module reads it there and nowhere else, never from GROUNDBOX_API_KEY`);
41
+ const apiUrl = env[GROUNDBOX_ENV.apiUrl] || undefined;
42
+ const daemonPath = env[GROUNDBOX_ENV.daemon] || undefined;
43
+ const daemonUser = env[GROUNDBOX_ENV.user] || undefined;
44
+ return { apiKey, ...(apiUrl === undefined ? {} : { apiUrl }), ...(daemonPath === undefined ? {} : { daemonPath }), ...(daemonUser === undefined ? {} : { daemonUser }), ...kindFrom(env, GROUNDBOX_ENV.kind) };
45
+ }
46
+ /** The longest lifetime a computer of a run may ask for. */
47
+ export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
48
+ /** For the run's report: what this configuration means for the suite. */
49
+ export const conformanceNotes = [
50
+ "groundbox: every computer is a Groundbox sandbox (a Firecracker microVM, amd64) whose own timer is set to the adapter's backstop; the daemon is a child of a resumable command of the WebSocket command stream, installed as root (the box image) or through passwordless sudo (Groundbox's own image), its output read by position across sockets and its stdin written to a fifo one answered call at a time; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run. Network none, open and a list are init's. The run's folder is a synced folder; no Archil mount. Kind desktop (COMPUTER_GROUNDBOX_KIND=desktop) starts from the box image too, with Xvfb on :0 and xfwm4 started through the daemon as the tool user.",
51
+ ];
52
+ function live(env) {
53
+ if (env[GROUNDBOX_ENV.live] !== "1")
54
+ throw new Error(`the Groundbox conformance module makes real sandboxes, which bill until deleted: set ${GROUNDBOX_ENV.live}=1, with your own key, to run it`);
55
+ }
56
+ /** The test doubles a caller hands in, each only when given. */
57
+ const doubles = ({ fetch, webSocket, daemonPath, timeouts }) => ({ ...(fetch ? { fetch } : {}), ...(webSocket ? { webSocket } : {}), ...(daemonPath ? { daemonPath } : {}), ...(timeouts ? { timeouts } : {}) });
58
+ /** The provider the CLI runs; throws in words without the live switch or the key. */
59
+ export async function createProvider(options = {}) {
60
+ const { env = process.env } = options;
61
+ live(env);
62
+ return create({ ...settingsFromEnv(env), ...doubles(options), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
63
+ }
64
+ /** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
65
+ export async function createDriftedProvider(options = {}) {
66
+ const { env = process.env, buildDaemon = (version) => buildDriftDaemon("amd64", version) } = options;
67
+ live(env);
68
+ const settings = settingsFromEnv(env);
69
+ return create({ ...settings, ...doubles(options), daemonPath: await buildDaemon(DRIFT_VERSION), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
70
+ }
71
+ /** The image every computer of the run starts from: COMPUTER_GROUNDBOX_IMAGE, else the box image prepareImage() answers. */
72
+ export async function conformanceImage({ env = process.env } = {}) {
73
+ return env[GROUNDBOX_ENV.image] || boxImageRef();
74
+ }
75
+ /**
76
+ * The Groundbox host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live
77
+ * switch, since the sweep makes nothing, and it calls nothing until the sweep does.
78
+ */
79
+ export async function createHost(options = {}) {
80
+ return (await create({ ...settingsFromEnv(options.env ?? process.env), ...doubles(options) })).host;
81
+ }
82
+ /** Where the sweep lists, in words: the key's team, the key named by its sha256 prefix alone. */
83
+ export function sweepScope({ env = process.env } = {}) {
84
+ const { apiKey, apiUrl } = settingsFromEnv(env);
85
+ const key = createHash("sha256").update(apiKey, "utf8").digest("hex").slice(0, 12);
86
+ return `the Groundbox team of the key sha256:${key} at ${apiUrl ?? DEFAULT_API_URL}`;
87
+ }
@@ -56,7 +56,7 @@ export async function sweepMachines(host, { labels = {}, before = new Set(), wai
56
56
  return ok({ swept: fresh.length, gone: fresh.length - stillThere.length, stillThere, leftAlone });
57
57
  }
58
58
  const USAGE = `usage: node packages/computer/dist/conformance/sweep.js --provider <id> --before <file> | --after <file>
59
- --provider <id> a provider on the shared machine-host adapter (e2b, agent37, morph, daytona, boxd, smolcloud)
59
+ --provider <id> a provider on the shared machine-host adapter (e2b, agent37, morph, daytona, boxd, smolcloud, groundbox)
60
60
  --before <file> record the id of every machine the vendor lists with ${COMPUTER_LABEL}=1 into <file>
61
61
  --after <file> delete every machine listed with ${COMPUTER_LABEL}=1 and ${RUN_LABEL} whose id is not in <file>, read
62
62
  each back until the vendor no longer has it (up to 60 s each), and print
package/dist/daytona.d.ts CHANGED
@@ -46,6 +46,13 @@ export interface DaytonaProviderOptions extends Omit<HostedOptions, "desktop" |
46
46
  * with TLS end to end to the public host. Unset, it dials the public host; a machine on exec never reads it.
47
47
  */
48
48
  attachEgress?: string;
49
+ /**
50
+ * How long create waits for Daytona's label listing to show a new sandbox, in ms (timeouts.listedMs; serve's
51
+ * DAYTONA_LISTED_MS): a whole number above 0, as a number or its digits. Daytona's `GET /sandbox` is eventually
52
+ * consistent (an index, not the database), so a sandbox still unlisted then is read by its id and kept when it reads
53
+ * started. Unset, the adapter's 15 s; timeouts.listedMs, when given, wins.
54
+ */
55
+ listedMs?: number | string;
49
56
  /**
50
57
  * The snapshot GPU computers are made from: one of ours, box/Dockerfile built with a GPU (box/build-daytona.py --gpu
51
58
  * H100 prints its name, agentrun-archil-gpu-h100-<hash>), whose user is root; its GPU is the one its name says.
@@ -65,8 +72,9 @@ export interface DaytonaProviderOptions extends Omit<HostedOptions, "desktop" |
65
72
  autoDeleteMinutes?: number;
66
73
  /**
67
74
  * exec (default): the daemon goes in through the toolbox's file API and each connection is a session command. dial:
68
- * the sandbox gets the boot env as its env, and its snapshot's entrypoint, the box image's CMD, runs agentrun-dial; the
69
- * machine dials the server (options.dial), which every connection goes over. No Archil mount and no GPU on dial.
75
+ * the sandbox gets the boot env as its env but AGENTRUN_ATTACH_URL, and create starts agentrun-dial with the URL in a
76
+ * session command of its own; the machine dials the server (options.dial), which every connection goes over. No
77
+ * Archil mount and no GPU on dial.
70
78
  */
71
79
  connect?: "exec" | "dial";
72
80
  /** For tests: every request goes through it. Default the global fetch. */