@parcha/agentrun-computer 0.1.0-beta.43 → 0.1.0-beta.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +98 -12
  2. package/box/Dockerfile +2 -1
  3. package/box/build-daytona.py +12 -2
  4. package/box/install.sh +19 -5
  5. package/box/recipe.mjs +1 -1
  6. package/dist/attach.d.ts +13 -3
  7. package/dist/attach.js +182 -15
  8. package/dist/cloudflare.d.ts +4 -2
  9. package/dist/cloudflare.js +7 -3
  10. package/dist/computerd-linux-amd64 +0 -0
  11. package/dist/computerd-linux-arm64 +0 -0
  12. package/dist/computerd.json +2 -2
  13. package/dist/conformance/cases/files.js +7 -1
  14. package/dist/conformance/cases/isolation.js +4 -0
  15. package/dist/conformance/cases/mount.js +155 -2
  16. package/dist/conformance/cases/provider.js +3 -1
  17. package/dist/conformance/daytona.d.ts +15 -1
  18. package/dist/conformance/daytona.js +19 -4
  19. package/dist/conformance/types.d.ts +1 -1
  20. package/dist/daytona.d.ts +11 -2
  21. package/dist/daytona.js +47 -15
  22. package/dist/descriptor.d.ts +34 -4
  23. package/dist/descriptor.js +40 -6
  24. package/dist/descriptors/cloudflare.d.ts +14 -1
  25. package/dist/descriptors/cloudflare.js +7 -3
  26. package/dist/descriptors/daytona.d.ts +21 -3
  27. package/dist/descriptors/daytona.js +15 -8
  28. package/dist/descriptors/e2b.d.ts +1 -0
  29. package/dist/descriptors/e2b.js +2 -1
  30. package/dist/descriptors/fly.d.ts +14 -1
  31. package/dist/descriptors/fly.js +6 -3
  32. package/dist/descriptors/index.d.ts +64 -2
  33. package/dist/descriptors/modal.d.ts +16 -2
  34. package/dist/descriptors/modal.js +10 -6
  35. package/dist/descriptors/orgo.d.ts +3 -0
  36. package/dist/descriptors/orgo.js +3 -1
  37. package/dist/e2b.d.ts +9 -4
  38. package/dist/e2b.js +8 -8
  39. package/dist/env-proxy.d.ts +26 -0
  40. package/dist/env-proxy.js +97 -0
  41. package/dist/fly.d.ts +4 -3
  42. package/dist/fly.js +7 -4
  43. package/dist/hosted/provider.d.ts +2 -1
  44. package/dist/hosted/provider.js +133 -54
  45. package/dist/hosted/scripts.d.ts +3 -2
  46. package/dist/hosted/scripts.js +12 -7
  47. package/dist/hosted/values.d.ts +2 -5
  48. package/dist/hosted/values.js +2 -9
  49. package/dist/index.d.ts +4 -2
  50. package/dist/index.js +4 -2
  51. package/dist/kinds.d.ts +4 -2
  52. package/dist/kinds.js +10 -1
  53. package/dist/modal.d.ts +5 -2
  54. package/dist/modal.js +8 -2
  55. package/dist/morph.js +15 -7
  56. package/dist/mount-archil.d.ts +33 -17
  57. package/dist/mount-archil.js +83 -36
  58. package/dist/mount.d.ts +16 -7
  59. package/dist/mount.js +13 -8
  60. package/dist/orgo.js +1 -1
  61. package/dist/provider.d.ts +1 -1
  62. package/dist/sync-folder.d.ts +82 -0
  63. package/dist/sync-folder.js +494 -0
  64. package/dist/tar.d.ts +34 -0
  65. package/dist/tar.js +203 -0
  66. package/package.json +1 -1
  67. package/dist/conformance/tar.d.ts +0 -13
  68. package/dist/conformance/tar.js +0 -105
package/README.md CHANGED
@@ -181,8 +181,8 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
181
181
  `--own-network` needs, or `--cap-add ALL`, as 1000:1000, the refusal of 0:0 and the refusal without CAP_SETPCAP), and
182
182
  computerd's end at its deadline with the Docker live tests. The test binaries (`CGO_ENABLED=0 go test -c`) also run
183
183
  as root in a container by hand: `internal/isolate`'s and the isolated `TestBecome...` need CAP_SYS_ADMIN and
184
- CAP_NET_ADMIN (`docker run --cap-add SYS_ADMIN --cap-add NET_ADMIN`), and the refusal without them a container
185
- with Docker's defaults.
184
+ CAP_NET_ADMIN (`docker run --cap-add SYS_ADMIN --cap-add NET_ADMIN`), and the refusal without them needs a
185
+ container with Docker's defaults.
186
186
  - `computerd probe [--sockets] [--connect <host:port>[/udp]]...` prints one JSON line: the uid and gid it runs as, the
187
187
  kernel's release, `interfaces` (the network interfaces its network namespace holds: `["lo"]` alone under
188
188
  `--own-network`), `reached` (the targets that answered), `accepted` (the targets that accepted a TCP connection and
@@ -197,12 +197,19 @@ extension](#the-protocol-extension-kind-daemon-modes-screen-input-apps-lifetime)
197
197
  [Network none, read from inside](#network-none-read-from-inside-nothing-answers). `computerd probe --diagnose` asks
198
198
  more: for 1.1.1.1, 8.8.8.8, 9.9.9.9 and 151.101.1.57 (Fastly's anycast edge, which is no resolver) on 443/tcp,
199
199
  80/tcp and 53/udp it reports `refused` (no TCP accept, no UDP answer), `accepted` (an accept, no answer) or
200
- `answered` (a TLS ServerHello, an `HTTP/1.` status line, a DNS response with the query's id), with 3 s to connect and
200
+ `answered` (a TLS ServerHello, an `HTTP/1.x` status line, a DNS response with the query's id), with 3 s to connect and
201
201
  3 s to answer, 15 s in all and at most 4 KiB read per check, and a `verdict`: `egress`, `accepted-only` or `none`.
202
202
  It sends nothing of the computer's: a ClientHello with a random nonce, `HEAD / HTTP/1.0`, a query for `example.com`.
203
203
  - `computerd stdio` is a thin bridge: it connects to the socket (waiting up to 3 s for a computer that has just
204
204
  started) and copies bytes both ways until either side ends. With no daemon to reach it says so on stderr and exits 1;
205
205
  it never serves on its own.
206
+ - `computerd pair <server URL> [--name <name>]`, `computerd attach` and `computerd unpair` make a Linux box of your own
207
+ a paired computer: pair reads the console's code from stdin and keeps the token in a file only its user can read,
208
+ attach dials with it, unpair deletes it ([attach.md, A Linux box](../../spec/computer/attach.md#a-linux-box)). A box
209
+ with a display pairs as a desktop; one with none (a `linux` hello) pairs as a sandbox that holds a run's folder as a
210
+ synced folder in its `/workspace`, a directory of init's user's own, mode 0700, never a link, made once as root with
211
+ a tmpfiles.d line. A run's shell can read and write everything that user can, so make it a user of its own
212
+ (`useradd --system --create-home agentrun`, no lingering, no crontab), never a person's login user.
206
213
  - Init is a child subreaper (PID 1 in Docker is one anyway) and reaps every orphan. It also sweeps, on each SIGCHLD and
207
214
  once a second: a child of its own that is not one of its guards can only be an orphan whose guard died (a program can
208
215
  kill its own guard, since both run as the same user), so it is killed with everything under it. A process orphaned by
@@ -681,6 +688,11 @@ setting:
681
688
  - **E2B, `E2B_SANDBOX_URL`** (`ambientProblem` in `src/e2b.ts`). The SDK sends every sandbox call to it when it is set,
682
689
  and no option clears it, so the provider refuses to start while it is set. It only reads.
683
690
 
691
+ A proxy isn't read from the environment either. E2B's SDK and Morph's SSH gateway, the two clients Node's own proxy
692
+ doesn't reach, follow the one the process installed into Node (`--use-env-proxy`, `NODE_USE_ENV_PROXY` or
693
+ `http.setGlobalProxyFromEnv`, which serve calls at start), as `fetch` does: `src/env-proxy.ts` reads it from Node's
694
+ `https.globalAgent`. A process that installed none has them go direct.
695
+
684
696
  `scripts/check-env.mjs` holds the library to this: it reads every file under `src/` outside `src/conformance/`, those
685
697
  in its directories (`src/docker/`) included, with TypeScript's parser and fails on any use of `process.env` (dotted,
686
698
  bracketed, destructured, aliased, through `globalThis` or an import of `node:process`) but these two, each by its
@@ -1391,6 +1403,13 @@ conformance module's `dialKit()` refuses, as E2B's does: the Core run happens in
1391
1403
  run image with `COMPUTER_MODAL_CONNECT=dial` is the box image, the one that holds `agentrun-dial` (debian:bookworm-slim
1392
1404
  on exec, as before).
1393
1405
 
1406
+ A dial sandbox may be a desktop (`kind: "desktop"`): the box image's X server and xfwm4, started over the socket it
1407
+ dialed, at 2 CPUs and 4 GiB on the VM runtime, with no GPU. On exec a Modal computer is kind `linux` alone, and the
1408
+ constructor refuses `kind: "desktop"` in words. The descriptor's desktop configuration selects `connect: "dial"` itself,
1409
+ so a server whose `modalConnect` is exec still makes its desktop over dial (it needs the dial's public address). In
1410
+ serve's Mode 2 the run's folder is an Archil mount, which a dial machine takes none of yet, so a Modal desktop there is
1411
+ refused at `check()` in those words. **Unverified**: Xvfb and the window manager on Modal (no live run yet).
1412
+
1394
1413
  ## Daytona
1395
1414
 
1396
1415
  ```ts
@@ -1546,13 +1565,13 @@ the TTL.
1546
1565
  | `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 |
1547
1566
  | `isolation` | `container`, or `vm` with `sandboxClass: "linux-vm"` | the class comes from the snapshot |
1548
1567
  | `os` | `linux` | Linux classes only; Windows and macOS are not offered here |
1549
- | `daemon` | `child` | Daytona's toolbox daemon is the sandbox's first process, and init is started detached through a session command of it (above) |
1568
+ | `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)) |
1550
1569
  | `networkReadBack` | `false` | the network is probed from inside, the same for every hosted vendor |
1551
1570
  | `groups` | `exec`, `files`, `processes` | the daemon's own, checked against its hello's `groups`, as is its `kind` |
1552
1571
  | `maxLifetimeMs` | 30 days | the cap `check` gives, through the shared `checkLifetime`; Daytona's TTL is whole minutes and documents no cap of its own |
1553
1572
  | `user` | none | the daemon runs as the provider's `daemonUser`; a spec cannot name a user |
1554
1573
  | `release` | `delete` | `DELETE /sandbox/{id}`; a stop is refused as `unsupported` |
1555
- | `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 |
1574
+ | `gpu` | `H100`; at most 1; none on dial | 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 |
1556
1575
 
1557
1576
  ### What the provider does
1558
1577
 
@@ -1622,9 +1641,10 @@ The conformance module, `dist/conformance/daytona.js` (`--provider daytona`), re
1622
1641
  when it runs (`settingsFromEnv`) and passes each to `create()` as the option in brackets: `COMPUTER_DAYTONA_API_KEY`
1623
1642
  (`apiKey`, required), `COMPUTER_DAYTONA_API_URL` (`apiUrl`), `COMPUTER_DAYTONA_DAEMON` (`daemonPath`),
1624
1643
  `COMPUTER_DAYTONA_ARCH` (`arch`), `COMPUTER_DAYTONA_TARGET` (`target`), `COMPUTER_DAYTONA_CLASS` (`sandboxClass`),
1625
- `COMPUTER_DAYTONA_USER` (`daemonUser`) and `COMPUTER_DAYTONA_GPU_SNAPSHOT` (`gpuSnapshot`). It exports `createProvider()` and `createDriftedProvider()` (which builds a
1644
+ `COMPUTER_DAYTONA_USER` (`daemonUser`), `COMPUTER_DAYTONA_GPU_SNAPSHOT` (`gpuSnapshot`) and `COMPUTER_DAYTONA_CONNECT`
1645
+ (`connect`). It exports `createProvider()` and `createDriftedProvider()` (which builds a
1626
1646
  daemon of another version with Go), and reads `COMPUTER_DAYTONA_SNAPSHOT` (the run's image; unset, `"default"`,
1627
- Daytona's default snapshot). It never reads `DAYTONA_API_KEY`, `DAYTONA_API_URL` or `DAYTONA_TARGET`, not even as a
1647
+ Daytona's default snapshot, or on dial the box image's snapshot, `agentrun-box-<recipe hash>`). It never reads `DAYTONA_API_KEY`, `DAYTONA_API_URL` or `DAYTONA_TARGET`, not even as a
1628
1648
  fallback: on a host that runs other Daytona work they may hold another organization's key. Those are serve's names,
1629
1649
  which serve passes in itself.
1630
1650
 
@@ -1652,6 +1672,65 @@ node packages/computer/dist/conformance/sweep.js --provider daytona --after /tmp
1652
1672
  It prints `{"swept":n,"gone":m,"stillThere":[ids],"leftAlone":k}` (`gone` was `notFound`). A conformance run of
1653
1673
  Daytona also sweeps its own label through the host at its end (the report's `cleanup.sweep`).
1654
1674
 
1675
+ ### Daytona on dial
1676
+
1677
+ With `connect: "dial"` (a server's `daytonaConnect` setting, `COMPUTER_DAYTONA_CONNECT` for conformance; `exec` by
1678
+ default) a Daytona sandbox dials the server instead ([PROVIDERS.md](PROVIDERS.md#machines-that-dial-in)). The host has
1679
+ no exec and no upload, and nothing goes through the toolbox: create sends the boot env as `CreateSandbox.env` and
1680
+ `networkBlockAll: false` (the machine's root reaches the server; network none is init's, inside), and the snapshot's
1681
+ entrypoint runs `agentrun-dial`. No Archil mount, no GPU, and not `image: "default"` (Daytona's default snapshot holds
1682
+ no `agentrun-dial`): `check()` refuses each in words. Labels as on exec. A dial sandbox may be a desktop
1683
+ (`kind: "desktop"`): the box snapshot's X server and xfwm4, started over the socket it dialed, with the snapshot's 2 CPUs
1684
+ and 4 GB. On exec a Daytona computer is kind `linux` alone, and the constructor refuses `kind: "desktop"` in words. The
1685
+ descriptor's desktop configuration selects `connect: "dial"` itself, so a server whose `daytonaConnect` is exec still
1686
+ makes its desktop over dial. **Unverified**: Xvfb and the window manager on Daytona (no live run yet). What each part rests on:
1687
+
1688
+ - **A snapshot, never an image.** A create names a snapshot; a snapshot is made from "any publicly accessible image"
1689
+ whose tag is not `latest`, `lts` or `stable` ([docs: create snapshots](https://www.daytona.io/docs/en/snapshots.md#create-snapshots)).
1690
+ The one that holds `agentrun-dial` is the box image's, `agentrun-box-<recipe hash>`: `box/build-daytona.py`
1691
+ builds it from `box/Dockerfile`, or `POST /snapshots` makes it from the published
1692
+ `ghcr.io/parcha-ai/agentrun-box:<recipe hash>` with the same `entrypoint`. The conformance module's run image on
1693
+ dial is that name. A snapshot carries its own resources: a create that names one sends none (400 "Cannot specify
1694
+ Sandbox resources when using a snapshot", live 11-11).
1695
+ - **The boot env reaches `agentrun-dial`.** The runner puts `env` in the container's env
1696
+ ([runner container_configs.go:87](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/runner/pkg/docker/container_configs.go#L87)),
1697
+ and the toolbox's session shell takes the toolbox's env (`cmd.Env = os.Environ()`,
1698
+ [daemon session/create.go:23-24](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/pkg/session/create.go#L23-L24)).
1699
+ - **The image's CMD never runs; the snapshot's entrypoint does.** The container's entrypoint is the toolbox daemon, and
1700
+ its arguments are the snapshot's entrypoint, else the image's ENTRYPOINT, never its CMD
1701
+ ([runner container_configs.go:143-173](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/runner/pkg/docker/container_configs.go#L143-L173));
1702
+ the daemon runs them as a command of its entrypoint session, and the sandbox stays up when it exits
1703
+ ([daemon main.go:129-164](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/daemon/cmd/daemon/main.go#L129-L164)).
1704
+ A snapshot built from a Dockerfile with no ENTRYPOINT gets `sleep infinity`
1705
+ ([api snapshot.service.ts:883-901](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/api/src/sandbox/services/snapshot.service.ts#L883-L901)),
1706
+ so `box/build-daytona.py` names the Dockerfile's CMD as the snapshot's `entrypoint`. The box snapshots it built
1707
+ before, `agentrun-archil-<recipe hash>`, have none and never dial, so the snapshot it builds now has a name of its
1708
+ own, `agentrun-box-<recipe hash>`, which no snapshot without the entrypoint holds. (The Dockerfile's comment that Daytona runs its
1709
+ CMD is wrong; it stays until the recipe next changes, since editing it changes the hash.)
1710
+ - **Outbound https, by tier.** Tier 1 and 2 organizations reach "essential services" alone, and those leave out shared
1711
+ hosting domains; Tier 3 and 4 have full access
1712
+ ([docs: tier-based network restrictions](https://www.daytona.io/docs/en/network-limits.md#tier-based-network-restrictions)).
1713
+ A server on such a domain (`*.onrender.com`) is out of a Tier 1 or 2 sandbox's reach unless Daytona adds that exact
1714
+ host to the list ([docs: essential services](https://www.daytona.io/docs/en/network-limits.md#essential-services)).
1715
+ **Unverified**: our organization's tier, and a dial from it.
1716
+ - **No GPU on dial**, refused in words: `daytona-gpu` holds no `agentrun-dial`, and Daytona runs a GPU sandbox
1717
+ unprivileged (`Privileged: gpuIndex == nil`,
1718
+ [runner container_configs.go:205](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/runner/pkg/docker/container_configs.go#L205)),
1719
+ where no dial has run. A server whose Daytona connect is exec makes GPU computers. A GPU host still gives no
1720
+ `/dev/fuse` (live 11-11), and the REST API has no `ephemeral` field: a GPU sandbox is made with
1721
+ `autoDeleteInterval: 0` ([Capabilities](#capabilities)).
1722
+ - **The idle timer.** Processes inside a sandbox never reset it, toolbox calls do
1723
+ ([docs: auto-stop interval](https://www.daytona.io/docs/en/sandboxes.md#auto-stop-interval)). On dial no connection is
1724
+ a toolbox call, so with `autoStopMinutes` set a sandbox stops that long after it starts, whatever runs on it; unset
1725
+ (0) it never stops on its own. The conformance module sets 30, so a dial run's computers each live under 30 minutes.
1726
+ - **The token is readable from the API.** `GET /sandbox/{id}` returns `env`
1727
+ ([api sandbox.dto.ts:84](https://github.com/daytonaio/daytona/blob/b5a5d9e7/apps/api/src/sandbox/dto/sandbox.dto.ts#L84)),
1728
+ so whoever holds the API key reads the machine's token; that key already runs root in the sandbox through the
1729
+ toolbox. The token is the machine's alone, and revoked at its delete.
1730
+ - **Unverified**: whether a box-image sandbox has a D-Bus session bus in `/tmp` (on exec, create closes `/tmp/dbus-*`
1731
+ to the computer's user through the toolbox; on dial there is no exec, so nothing does), and the `linux-vm` class on
1732
+ dial.
1733
+
1655
1734
  ### Not yet known
1656
1735
 
1657
1736
  Four live runs reached the default snapshot. The first failed at the start, in the privilege tool init's own drop now
@@ -1980,9 +2059,12 @@ provider does in `process.env`. `COMPUTER_E2B_PUBLIC_STREAM` is no longer read.
1980
2059
  ### E2B on dial
1981
2060
 
1982
2061
  With `connect: "dial"` (a server's `e2bConnect` setting; `exec` by default) an E2B sandbox dials the server instead
1983
- ([PROVIDERS.md](PROVIDERS.md#machines-that-dial-in)): kind linux alone (its default on dial; a desktop named
1984
- there is refused), no Archil mount, and the host has no
1985
- exec and no upload. E2B runs a template's start command once, at the template's build, and snapshots it running, so
2062
+ ([PROVIDERS.md](PROVIDERS.md#machines-that-dial-in)): a desktop by default, as on exec, since the box template has
2063
+ the desktop (`box/install.sh`'s `desktop` step), or kind linux; no Archil mount, and the host has no
2064
+ exec and no upload. A desktop's launch adds `DISPLAY` to the boot env, and its X server and xfwm4 start over the
2065
+ socket the sandbox dialed, through `process.start`. A dial desktop whose X server has gone is not refused at `connect()`
2066
+ as on exec: it reads back kind `linux`, and its screen, input, apps and ui calls are refused in words, never sent, until
2067
+ its hello says `desktop` again. E2B runs a template's start command once, at the template's build, and snapshots it running, so
1986
2068
  it never sees a create's env ([docs.e2b.dev/template/start-ready-command](https://docs.e2b.dev/template/start-ready-command)).
1987
2069
  So create starts the box template's `agentrun-dial` itself, once, right after `Sandbox.create`: one envd process as
1988
2070
  root with the boot env as that process's env alone (never the sandbox's `envs`, which envd gives every process), after
@@ -3028,9 +3110,13 @@ fills, and whether it is required), `settings` (a setting that is no key but fil
3028
3110
  `metered`, `mounts`, `network` (the network forms its computers make, at least one of none, open and allow),
3029
3111
  `capabilities` (the kind and groups of each configuration), `defaultImage` (by setting kind),
3030
3112
  `prepareImage` (a provider whose `prepareImage()` answers its image before a run: it builds, pulls or names it), `imageEnv` (the server's environment variable
3031
- that, when set, names the image of every computer of the provider, as Daytona's `AGENTRUN_DAYTONA_SNAPSHOT`), `local`
3113
+ that, when set, names the image of every computer of the provider, as Daytona's `AGENTRUN_DAYTONA_SNAPSHOT`), `connect`
3114
+ (whether its machines dial the server: `dial` always, as Fly Machines' and Cloudflare's; `either`, as its `connect`
3115
+ option says, which one of its settings fills, as E2B's, Daytona's and Modal's; absent, never), `local`
3032
3116
  (a computer on this host), and
3033
- `ledger` (the option a provider's ledger fills). `providerFor(id, options)` builds a provider by id from its options and
3117
+ `ledger` (the option a provider's ledger fills). `connectOf(descriptor, options)` answers `dial` or `exec` for a provider
3118
+ made with those options, without building it; its built host's `facts.connect` is the same answer, and a server reads
3119
+ it to say where its runs can't take a dial (a runner in a process of its own). `providerFor(id, options)` builds a provider by id from its options and
3034
3120
  refuses an id it does not hold, naming the ones it does. The provider file, `src/<vendor>.ts`, exports what a
3035
3121
  `ProviderModule` is:
3036
3122
 
package/box/Dockerfile CHANGED
@@ -10,7 +10,8 @@
10
10
  # the computer's, which reaches Archil;
11
11
  # - nftables, for the helper's mount with an egress gateway alone: it redirects root's TCP to Archil's 8100 and 32050
12
12
  # to computerd's archil relay on the computer's loopback;
13
- # - /workspace, empty and root's, where the helper mounts the run's folder;
13
+ # - /workspace, empty and root's, where the helper mounts the run's folder; a synced folder's computer has it made the
14
+ # computer user's, 0700, before init (by the provider's install, or by agentrun-dial on a machine that dials);
14
15
  # - a desktop, with nothing started: Xvfb and xfwm4 (with dbus-run-session, which xfconf's packages bring) and
15
16
  # xsetroot (x11-xserver-utils, the desktop's background), which the provider starts through computerd as the tool
16
17
  # user on :0 (src/desktop.ts), and the apps E2B Desktop has that are cheap to carry: Xfce's terminal and text editor,
@@ -4,15 +4,23 @@
4
4
  # starts from it (on Daytona's hosted cloud Archil's client hangs, so no computer there takes the mount). The name is
5
5
  # the recipe's hash (the Dockerfile and the files it copies, install.sh among them), so a changed recipe is
6
6
  # a new snapshot, and the same recipe is the one built before: Daytona then refuses the name, and the printed name is
7
- # the one to use. Its size is 2 CPUs, 4 GB of memory and a 10 GB disk.
7
+ # the one to use. Its name is agentrun-box-<the recipe's hash>, and its size is 2 CPUs, 4 GB of memory and a 10 GB disk.
8
8
  #
9
9
  # With --gpu H100, the same image as a GPU snapshot: a snapshot carries its own resources, the GPU among them, so its
10
10
  # sandboxes have one H100 (and daytona-gpu's 16 CPUs, 100 GB of memory and a 400 GB disk), in region earth, Daytona's
11
11
  # GPU region. Its name is agentrun-archil-gpu-h100-<the recipe's hash>: the provider's gpuSnapshot option takes it, and
12
12
  # reads the GPU from it. Another type is another snapshot.
13
13
  #
14
+ # The snapshot's entrypoint is the Dockerfile's CMD, named: Daytona's toolbox runs a snapshot's entrypoint as its first
15
+ # command, and a snapshot built from a Dockerfile with no ENTRYPOINT gets `sleep infinity` instead, never the CMD
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.
20
+ #
14
21
  # python3 packages/computer/box/build-daytona.py [--gpu H100]
15
22
  import hashlib
23
+ import json
16
24
  import os
17
25
  import sys
18
26
 
@@ -30,12 +38,14 @@ if args:
30
38
  here = os.path.dirname(os.path.abspath(__file__))
31
39
  recipe = b"".join(open(os.path.join(here, name), "rb").read() for name in ("Dockerfile", "install.sh", "agentrun-archil"))
32
40
  digest = hashlib.sha256(recipe).hexdigest()[:12]
33
- name = f"agentrun-archil-gpu-{gpu.lower()}-{digest}" if gpu else f"agentrun-archil-{digest}"
41
+ name = f"agentrun-archil-gpu-{gpu.lower()}-{digest}" if gpu else f"agentrun-box-{digest}"
42
+ cmd = [json.loads(line[4:]) for line in open(os.path.join(here, "Dockerfile")).read().splitlines() if line.startswith("CMD ")][-1]
34
43
  print(f"build-daytona: snapshot {name}", file=sys.stderr)
35
44
  Daytona().snapshot.create(
36
45
  CreateSnapshotParams(
37
46
  name=name,
38
47
  image=Image.from_dockerfile(os.path.join(here, "Dockerfile")),
48
+ entrypoint=cmd,
39
49
  resources=Resources(cpu=16, memory=100, disk=400, gpu=1, gpu_type=GPUS[gpu]) if gpu else Resources(cpu=2, memory=4, disk=10),
40
50
  **({"region_id": "earth"} if gpu else {}),
41
51
  ),
package/box/install.sh CHANGED
@@ -73,19 +73,32 @@ dial() {
73
73
  # agentrun-dial (written by the box image's install.sh): a machine that dials the server. From the env the provider's
74
74
  # create gave it, it fetches the server's computerd with the machine's token, checks its sha256, installs it root's alone
75
75
  # where the provider's exec install puts it, starts `computerd init` as that start does, in a clean environment without
76
- # the token, and becomes `computerd attach` with the attach URL and the token alone in its environment. A daemon whose
77
- # sha256 is not AGENTRUN_DAEMON_SHA256 is removed, and nothing runs. Exits 2 for env missing, 3 when the fetch failed,
78
- # 4 for a sha256 mismatch, 5 when init never listened; else it is `computerd attach` and exits as it does.
76
+ # the token (with DISPLAY, for a desktop), and becomes `computerd attach` with the attach URL and the token alone in its environment. Before init, it
77
+ # gives /workspace to init's user (its --user), 0700, where a synced folder's runner pushes the run's folder. A daemon
78
+ # whose sha256 is not AGENTRUN_DAEMON_SHA256 is removed, and nothing runs. Exits 2 for env missing, 3 when the fetch
79
+ # failed, 4 for a sha256 mismatch, 5 when init never listened, 6 when /workspace was not made init's user's; else it is
80
+ # `computerd attach` and exits as it does.
79
81
  set -euf
80
82
  DAEMON=/opt/agentrun/computerd
81
83
  HOME_DIR=/work
82
84
  SOCKET_DIR=/run/agentrun
83
85
  INIT_LOG=/run/agentrun-init.log
86
+ WORKSPACE=/workspace
84
87
  OWNER=0:0
85
88
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
86
89
  for v in AGENTRUN_ATTACH_URL AGENTRUN_ATTACH_TOKEN AGENTRUN_DAEMON_URL AGENTRUN_DAEMON_SHA256 AGENTRUN_INIT_ARGS; do
87
90
  eval "[ -n \"\${$v-}\" ]" || { echo "agentrun-dial: $v is not set; the provider's create sets it" >&2; exit 2; }
88
91
  done
92
+ # init's user, uid:gid, from its --user: /workspace is that user's alone, never a link.
93
+ user=
94
+ set -- $AGENTRUN_INIT_ARGS
95
+ while [ $# -gt 1 ]; do
96
+ [ "$1" != --user ] || user=$2
97
+ shift
98
+ done
99
+ [ -n "$user" ] || { echo "agentrun-dial: AGENTRUN_INIT_ARGS names no --user; the provider's create sets it" >&2; exit 2; }
100
+ { [ ! -L "$WORKSPACE" ] && mkdir -p "$WORKSPACE" && chown "$user" "$WORKSPACE" && chmod 0700 "$WORKSPACE"; } ||
101
+ { echo "agentrun-dial: $WORKSPACE was not made $user's" >&2; exit 6; }
89
102
  mkdir -p "${DAEMON%/*}" "$HOME_DIR" "$SOCKET_DIR"
90
103
  chown "$OWNER" "${DAEMON%/*}" "$SOCKET_DIR"
91
104
  chmod 0755 "${DAEMON%/*}"
@@ -105,8 +118,9 @@ fi
105
118
  chown "$OWNER" "$DAEMON.part"
106
119
  chmod 0755 "$DAEMON.part"
107
120
  mv -f "$DAEMON.part" "$DAEMON"
108
- # init's arguments are words with no space and no pattern (set -f): split, never globbed.
109
- env -i PATH="$PATH" HOME="$HOME_DIR" AGENTRUN_COMPUTERD_SOCKET="$SOCKET_DIR/computerd.sock" \
121
+ # init's arguments are words with no space and no pattern (set -f): split, never globbed. A desktop's create sets
122
+ # DISPLAY, the display init's screen and input methods drive, as the provider's exec start gives it.
123
+ env -i PATH="$PATH" HOME="$HOME_DIR" AGENTRUN_COMPUTERD_SOCKET="$SOCKET_DIR/computerd.sock" ${DISPLAY:+DISPLAY="$DISPLAY"} \
110
124
  setsid sh -c 'cd "$HOME" && exec "$@"' sh "$DAEMON" init $AGENTRUN_INIT_ARGS >"$INIT_LOG" 2>&1 </dev/null &
111
125
  i=0
112
126
  until [ -S "$SOCKET_DIR/computerd.sock" ]; do
package/box/recipe.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // The box image's recipe: the files it is made of (this folder's Dockerfile and what it copies: install.sh, the build,
2
2
  // and the helper) and their hash, the first 12 hex of their sha256. Every build names what it makes by that hash, so a
3
3
  // changed recipe is a new image and the same recipe is the one built before: the E2B template agentrun-archil-<hash>
4
- // (build-e2b.mjs), the Daytona snapshot of the same name (build-daytona.py hashes the same files), the published image
4
+ // (build-e2b.mjs), the Daytona snapshot agentrun-box-<hash> (build-daytona.py hashes the same files), the published image
5
5
  // ghcr.io/parcha-ai/agentrun-box:<hash> (release.yml's box job reads recipeHash()), and what a provider's prepareImage
6
6
  // builds or registers in a vendor's account.
7
7
  //
package/dist/attach.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare const ATTACH_CLOSE: {
28
28
  readonly binary: 1003;
29
29
  /** A frame over maxLineBytes. */
30
30
  readonly tooBig: 1009;
31
- /** The computer's hello is not what it paired as (another kind or os): pair again. */
31
+ /** The computer's hello is not what it paired as (another kind, os or arch): pair again. */
32
32
  readonly mismatch: 4400;
33
33
  /** The token is unknown or was revoked: pair again. */
34
34
  readonly unauthorized: 4401;
@@ -81,7 +81,7 @@ export declare function socketStreams(socket: AttachSocket): {
81
81
  export interface PairedComputer {
82
82
  id: string;
83
83
  name: string;
84
- /** What it paired as: its hello at pairing. A later hello of another kind or os is refused (ATTACH_CLOSE.mismatch). */
84
+ /** What it paired as: its hello at pairing. A later hello of another kind, os or arch is refused (ATTACH_CLOSE.mismatch). */
85
85
  hello: HelloResult;
86
86
  labels: Record<string, string>;
87
87
  /** A hosted machine that dials with a minted token (mintedComputer), not a person's: its hello keeps its arch too. */
@@ -95,6 +95,9 @@ export interface MachineMint {
95
95
  arch: string;
96
96
  /** The machine's backstopAt: past it the token is refused, whatever else holds. */
97
97
  expiresAt: Date;
98
+ /** The run the machine works for, as its create's labels name it (RUN_LABEL): what a server's words about its dial
99
+ * name. Absent for a computer of no run. */
100
+ run?: string;
98
101
  }
99
102
  /**
100
103
  * The tokens of hosted machines that dial (spec/computer/attach.md, Hosted machines that dial), as the server's store
@@ -109,6 +112,10 @@ export interface MachineTokens {
109
112
  mint(machine: string, mint: MachineMint): Promise<string>;
110
113
  /** The machine's token refused from now on; a machine with none is done. */
111
114
  revoke(machine: string): Promise<void>;
115
+ /** Why the server refused the machine's dial, in its words (a relay to the runner that minted the token, serve's
116
+ * dial-relay.ts, that it could not make): they name the machine's run, then the machine, and never its token.
117
+ * Undefined while none was refused. A create waiting for the machine's socket ends in these words. */
118
+ refused(machine: string): Promise<string | undefined>;
112
119
  }
113
120
  /**
114
121
  * MachineTokens in one process's memory, as serve's store keeps them (the sha256 alone): for tests and a conformance
@@ -118,6 +125,7 @@ export declare class MemoryMachineTokens implements MachineTokens {
118
125
  #private;
119
126
  mint(machine: string, mint: MachineMint): Promise<string>;
120
127
  revoke(machine: string): Promise<void>;
128
+ refused(_machine: string): Promise<string | undefined>;
121
129
  /** The machine and mint a token is good for at `at`: undefined for one unknown, revoked, or past its expiresAt. */
122
130
  check(token: string, at?: Date): {
123
131
  machine: string;
@@ -186,6 +194,8 @@ export declare class AttachHub {
186
194
  /**
187
195
  * One paired computer as a provider, id "attached": its capabilities are what it paired as. create claims it for a
188
196
  * run (refused while it is offline or another run holds it) and release ends the claim; a person's machine is never
189
- * made, stopped or deleted by a run. It has no init of ours, so its daemon mode is none.
197
+ * made, stopped or deleted by a run. A desktop or a phone has no init of ours, so its daemon mode is none; a Linux box
198
+ * (kind linux, a sandbox) runs computerd init, a child of its service manager, and takes the run's folder as a synced
199
+ * folder in its /workspace (pairedWorkspaceWhy), read back under the run's claim epoch.
190
200
  */
191
201
  export declare function attachedProvider(paired: PairedComputer, hub: AttachHub): ComputerProvider;