@parcha/agentrun-computer 0.1.0-beta.34 → 0.1.0-beta.36
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 +251 -46
- package/box/Dockerfile +3 -1
- package/box/agentrun-archil +59 -7
- package/box/build-daytona.py +20 -4
- package/dist/browser.d.ts +73 -23
- package/dist/browser.js +141 -17
- package/dist/browserbase.d.ts +48 -25
- package/dist/browserbase.js +176 -29
- package/dist/chrome.d.ts +3 -4
- package/dist/chrome.js +6 -11
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/conformance/browserbase.js +1 -1
- package/dist/conformance/cases/provider.js +78 -3
- package/dist/conformance/daytona.d.ts +4 -0
- package/dist/conformance/daytona.js +7 -1
- package/dist/conformance/e2b.js +2 -1
- package/dist/conformance/fixture.js +24 -2
- package/dist/conformance/kernel.js +1 -1
- package/dist/conformance/kind.js +2 -1
- package/dist/conformance/{local.d.ts → local-chrome.d.ts} +7 -7
- package/dist/conformance/{local.js → local-chrome.js} +11 -11
- package/dist/conformance/orgo.d.ts +11 -5
- package/dist/conformance/orgo.js +37 -8
- package/dist/conformance/phone-harness.js +2 -1
- package/dist/conformance/report.js +3 -2
- package/dist/conformance/runner.js +25 -7
- package/dist/conformance/types.d.ts +21 -8
- package/dist/conformance/types.js +10 -0
- package/dist/conformance/windows-fixture.d.ts +1 -0
- package/dist/conformance/windows-fixture.js +37 -0
- package/dist/daytona.d.ts +16 -35
- package/dist/daytona.js +87 -95
- package/dist/descriptor.d.ts +116 -0
- package/dist/descriptor.js +92 -0
- package/dist/descriptors/browserbase.d.ts +25 -0
- package/dist/descriptors/browserbase.js +20 -0
- package/dist/descriptors/daytona.d.ts +83 -0
- package/dist/descriptors/daytona.js +81 -0
- package/dist/descriptors/docker.d.ts +12 -0
- package/dist/descriptors/docker.js +17 -0
- package/dist/descriptors/e2b.d.ts +22 -0
- package/dist/descriptors/e2b.js +19 -0
- package/dist/descriptors/index.d.ts +256 -0
- package/dist/descriptors/index.js +19 -0
- package/dist/descriptors/kernel.d.ts +21 -0
- package/dist/descriptors/kernel.js +17 -0
- package/dist/descriptors/local-chrome.d.ts +17 -0
- package/dist/descriptors/local-chrome.js +21 -0
- package/dist/descriptors/modal.d.ts +54 -0
- package/dist/descriptors/modal.js +48 -0
- package/dist/descriptors/orgo.d.ts +99 -0
- package/dist/descriptors/orgo.js +49 -0
- package/dist/descriptors/phone-harness.d.ts +33 -0
- package/dist/descriptors/phone-harness.js +23 -0
- package/dist/descriptors/shared.d.ts +7 -0
- package/dist/descriptors/shared.js +6 -0
- package/dist/desktop.d.ts +4 -4
- package/dist/desktop.js +4 -4
- package/dist/docker/egress.d.ts +5 -4
- package/dist/docker/egress.js +7 -6
- package/dist/docker/image.js +17 -15
- package/dist/docker/inspect.d.ts +147 -0
- package/dist/docker/inspect.js +335 -0
- package/dist/docker.d.ts +6 -6
- package/dist/docker.js +53 -47
- package/dist/drift.d.ts +3 -145
- package/dist/drift.js +5 -334
- package/dist/e2b.d.ts +2 -8
- package/dist/e2b.js +17 -23
- package/dist/index.d.ts +9 -12
- package/dist/index.js +14 -12
- package/dist/isolation.js +2 -2
- package/dist/janitor.d.ts +20 -2
- package/dist/janitor.js +67 -19
- package/dist/kernel.d.ts +19 -29
- package/dist/kernel.js +110 -32
- package/dist/kinds.d.ts +59 -34
- package/dist/kinds.js +19 -117
- package/dist/labels.d.ts +20 -0
- package/dist/labels.js +62 -1
- package/dist/{local.d.ts → local-chrome.d.ts} +8 -9
- package/dist/{local.js → local-chrome.js} +26 -19
- package/dist/local-supervisor.d.ts +3 -3
- package/dist/local-supervisor.js +3 -3
- package/dist/modal.d.ts +6 -25
- package/dist/modal.js +86 -88
- package/dist/mount-archil.d.ts +25 -3
- package/dist/mount-archil.js +43 -12
- package/dist/orgo-channel.js +16 -13
- package/dist/orgo-desktop.d.ts +162 -0
- package/dist/orgo-desktop.js +1856 -0
- package/dist/orgo-names.d.ts +178 -0
- package/dist/orgo-names.js +287 -0
- package/dist/orgo.d.ts +34 -20
- package/dist/orgo.js +424 -173
- package/dist/phone-harness.d.ts +7 -12
- package/dist/phone-harness.js +70 -54
- package/dist/protocol.d.ts +5 -0
- package/dist/provider.d.ts +153 -10
- package/dist/provider.js +48 -1
- package/dist/providers.d.ts +23 -24
- package/dist/providers.js +14 -17
- package/dist/result.d.ts +11 -1
- package/dist/result.js +11 -0
- package/dist/test-connection.js +2 -2
- package/package.json +42 -2
package/README.md
CHANGED
|
@@ -7,11 +7,18 @@ npm install @parcha/agentrun-computer@latest
|
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import {
|
|
10
|
+
import { providerFor, providerModule } from "@parcha/agentrun-computer";
|
|
11
|
+
// One provider's class, from its own subpath: the package root loads no provider.
|
|
12
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
11
13
|
// The mount rule alone: loads no provider, no vendor SDK and no conformance code.
|
|
12
14
|
import { checkMount, readBackOf, WORKSPACE, type MountSpec } from "@parcha/agentrun-computer/mount";
|
|
13
15
|
```
|
|
14
16
|
|
|
17
|
+
The package root holds the protocol, the registry and the descriptors, and loads no provider: a provider loads by its
|
|
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`). A provider's
|
|
20
|
+
option types (`DockerProviderOptions`, `ModalProviderOptions` and the like) come from its subpath too, not the root.
|
|
21
|
+
|
|
15
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
|
|
16
23
|
vendor's SDK is the host's: Modal's `modal` package is imported only when the Modal provider is built, and the package
|
|
17
24
|
depends on nothing. A provider's mount kinds are its file's `MOUNT`, read with `(await providerModule(id)).MOUNT`,
|
|
@@ -424,10 +431,10 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
424
431
|
| id | label | kinds | keys (required unless marked) | mounts | metered |
|
|
425
432
|
| --- | --- | --- | --- | --- | --- |
|
|
426
433
|
| docker | Docker | sandbox, desktop | none | bind | no |
|
|
427
|
-
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET` (optional) | archil | yes |
|
|
434
|
+
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET`, `DAYTONA_ARCHIL_EGRESS` (optional) | archil | yes |
|
|
428
435
|
| modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
|
|
429
436
|
| e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
|
|
430
|
-
| orgo | Orgo | desktop | `ORGO_API_KEY` | none | yes |
|
|
437
|
+
| orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
|
|
431
438
|
| phone-harness | Phone harness | phone | `PHONE_HARNESS_API_KEY` | none | yes |
|
|
432
439
|
| browserbase | Browserbase | browser | `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID` | none | yes |
|
|
433
440
|
| kernel | Kernel | browser | `KERNEL_API_KEY` | none | yes |
|
|
@@ -653,7 +660,7 @@ fixtures of every evasion it catches.
|
|
|
653
660
|
## Docker
|
|
654
661
|
|
|
655
662
|
```ts
|
|
656
|
-
import { DockerProvider } from "@parcha/agentrun-computer";
|
|
663
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
657
664
|
|
|
658
665
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
659
666
|
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" });
|
|
@@ -771,7 +778,7 @@ key.
|
|
|
771
778
|
|
|
772
779
|
- **The volume** `computer-<hex>-egress`: a tmpfs of 1 MiB, mode 0700, owned by the computer's uid:gid. The proxy
|
|
773
780
|
makes its Unix socket there (0600); the computer mounts it read-only at `/opt/agentrun/egress` (`EGRESS_MOUNT`).
|
|
774
|
-
- **The proxy container** `computer-<hex>-egress`: `node` in `EGRESS_IMAGE` (node:22.23.
|
|
781
|
+
- **The proxy container** `computer-<hex>-egress`: `node` in `EGRESS_IMAGE` (node:22.23.5-trixie-slim, pinned by
|
|
775
782
|
digest; `new DockerProvider({ daemonPath, egress: { image } })` replaces it) runs `dist/docker/egress-main.js`, this
|
|
776
783
|
package's own build, bound read-only with its `package.json`. It is on Docker's default bridge alone, publishes no
|
|
777
784
|
port, and runs as the computer's uid:gid with a read-only root, `--cap-drop ALL`, `no-new-privileges`, 256 MiB, 64
|
|
@@ -840,7 +847,8 @@ computer has the folder at one path, `/workspace` (`WORKSPACE`). `HOME` stays wh
|
|
|
840
847
|
Docker): `/workspace` is only the mount.
|
|
841
848
|
|
|
842
849
|
```ts
|
|
843
|
-
import {
|
|
850
|
+
import { WORKSPACE } from "@parcha/agentrun-computer";
|
|
851
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
844
852
|
|
|
845
853
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
846
854
|
// The run folder must exist, by its canonical path, and be writable by docker.user (below).
|
|
@@ -866,6 +874,14 @@ const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 60
|
|
|
866
874
|
`{ other: "<words>" }` for a mount at `/workspace` the provider never makes. An Archil mount's `epoch` is the
|
|
867
875
|
computer's `agentrun.epoch` label (Archil's hold on a folder carries none); an Archil mount with no epoch reads back
|
|
868
876
|
as `{ other }`, in words. The token is never in a label, a read-back or an error.
|
|
877
|
+
- **An Archil egress gateway (Daytona, `archilEgress` / `DAYTONA_ARCHIL_EGRESS`).** For a target whose runners reach
|
|
878
|
+
Archil only through a gateway, `<IPv4 gateway>:<mount lane>:<data lane>` (such as `10.60.0.40:18100:42050`, parcha-proxy's
|
|
879
|
+
archil-egress). The helper's mount then starts `computerd archil-relay` on the computer's loopback (127.0.0.1:3129) and
|
|
880
|
+
an nftables table of its own (`inet agentrun_archil`) that redirects root's TCP to 8100 (the mount endpoint) and 32050
|
|
881
|
+
(the file servers, at the raw addresses the mount endpoint returns) to the relay and resets every other TCP to those
|
|
882
|
+
ports. The relay sends each connection to the gateway's lane for its port with a PROXY v2 header naming the original
|
|
883
|
+
destination; the gateway admits only a destination that proves, by certificate, the Archil name the client asked for.
|
|
884
|
+
A relay that cannot reach the gateway closes the connection, so the client reaches nothing. Unset, nothing changes.
|
|
869
885
|
- **Docker takes a bind.** `create` adds `--mount type=bind,src=<path>,dst=/workspace` after the daemon's mount:
|
|
870
886
|
read-write, propagation `rprivate`. A path Docker's `--mount` cannot hold (a comma, a double quote, a line break) is
|
|
871
887
|
refused by `check`.
|
|
@@ -951,7 +967,7 @@ The provider owns the image its computers start from and makes it ready in its o
|
|
|
951
967
|
no other process to wait on: Docker's own tag is the shared state.
|
|
952
968
|
|
|
953
969
|
```ts
|
|
954
|
-
import { DockerProvider } from "@parcha/agentrun-computer";
|
|
970
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
955
971
|
|
|
956
972
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" }); // image: the default recipe
|
|
957
973
|
const image = await docker.image({ signal }); // built once; one inspect when Docker has it
|
|
@@ -1096,7 +1112,8 @@ in a long-lived service), with Docker's CLI on its PATH. A computer stops at its
|
|
|
1096
1112
|
its stopped container may stay up to one interval longer.
|
|
1097
1113
|
|
|
1098
1114
|
```ts
|
|
1099
|
-
import {
|
|
1115
|
+
import { sweep } from "@parcha/agentrun-computer";
|
|
1116
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
1100
1117
|
|
|
1101
1118
|
const swept = await sweep(new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" }));
|
|
1102
1119
|
if (swept.ok) console.log(`deleted ${swept.value.deleted.join(", ") || "none"}; kept ${swept.value.kept}`);
|
|
@@ -1130,7 +1147,8 @@ as a caller's labels, with no code of its own: Docker writes them with `--label`
|
|
|
1130
1147
|
the computer through the provider's own exec, and a deleted computer holds no mount.
|
|
1131
1148
|
|
|
1132
1149
|
```ts
|
|
1133
|
-
import {
|
|
1150
|
+
import { releaseOlder, runLabels } from "@parcha/agentrun-computer";
|
|
1151
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
1134
1152
|
|
|
1135
1153
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
1136
1154
|
// A claim at epoch 3 takes the run over: the computers of epochs 1 and 2 go first.
|
|
@@ -1155,7 +1173,7 @@ sandbox, and the Daytona sweep wait through it too.
|
|
|
1155
1173
|
|
|
1156
1174
|
```ts
|
|
1157
1175
|
import { ModalClient } from "modal"; // the host's own client: this package imports nothing from the SDK
|
|
1158
|
-
import { ModalProvider } from "@parcha/agentrun-computer";
|
|
1176
|
+
import { ModalProvider } from "@parcha/agentrun-computer/modal";
|
|
1159
1177
|
|
|
1160
1178
|
const modal = new ModalProvider({
|
|
1161
1179
|
sdk: new ModalClient(),
|
|
@@ -1446,7 +1464,7 @@ named by any call.
|
|
|
1446
1464
|
## Daytona
|
|
1447
1465
|
|
|
1448
1466
|
```ts
|
|
1449
|
-
import { DaytonaProvider } from "@parcha/agentrun-computer";
|
|
1467
|
+
import { DaytonaProvider } from "@parcha/agentrun-computer/daytona";
|
|
1450
1468
|
|
|
1451
1469
|
const daytona = new DaytonaProvider({ apiKey, daemonPath: "dist/computerd-linux-amd64" });
|
|
1452
1470
|
const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, network: "none" });
|
|
@@ -1483,7 +1501,10 @@ stopped one.
|
|
|
1483
1501
|
Daytona runs its own toolbox daemon as the sandbox's first process, and a snapshot we do not build has no `computerd`.
|
|
1484
1502
|
So the provider pushes it in at create and starts it as a long-lived command, and reaches it the same way:
|
|
1485
1503
|
|
|
1486
|
-
1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random
|
|
1504
|
+
1. Upload the static binary through the toolbox's file upload, to `/tmp/agentrun-computerd-<random>`:
|
|
1505
|
+
`/files/upload-v2`, or `/files/upload` when the toolbox answers 404 for it. An older toolbox, as a self-hosted
|
|
1506
|
+
Daytona's runners may run, serves only `/files/upload`, which takes the same form; any other refusal is not retried
|
|
1507
|
+
on the older route.
|
|
1487
1508
|
2. Install it with `/process/execute` (the command is piped to the sandbox's shell): root-owned, mode 755, at
|
|
1488
1509
|
`/opt/agentrun/computerd`, and make `/work` (its home) and `/run/agentrun` (its socket's directory). As root, or
|
|
1489
1510
|
through passwordless `sudo`; a sandbox with neither is refused in the script's words. The script prints the
|
|
@@ -1569,7 +1590,7 @@ the TTL.
|
|
|
1569
1590
|
| `user` | none | the daemon runs as the provider's `daemonUser`; a spec cannot name a user |
|
|
1570
1591
|
| `release` | `stop`, `delete` | `POST /sandbox/{id}/stop` and `DELETE /sandbox/{id}` |
|
|
1571
1592
|
| `stopDeletes` | `true` with `autoDeleteMinutes: 0`, else `false` | `autoDeleteInterval` 0 deletes a sandbox as soon as it stops |
|
|
1572
|
-
| `gpu` | `H100`; at most 1 | daytona-gpu's own GPU (`DAYTONA_GPU_SNAPSHOT_GPU`, from GET /snapshots/daytona-gpu). A GPU computer is made from Daytona's GPU snapshot `daytona-gpu` (`DAYTONA_GPU_SNAPSHOT`: its default sandbox image, user `daytona` with passwordless sudo, plus the CUDA toolkit), sent as `snapshot`: its spec's image is `"daytona-gpu"` or `"default"`, and `check` refuses any other (a snapshot of box/Dockerfile among them) in words. A Daytona snapshot carries its own resources, so the create sends none (no `cpu`, `gpu`, `gpuType`, `memory` or `disk`: Daytona refuses them beside a snapshot, 400 "Cannot specify Sandbox resources when using a snapshot"), and the read-back's `snapshot`, `gpu` and `gpuType` must be the snapshot's. Another type or count needs a snapshot of its own, so `check` refuses it. A GPU computer's limits, declared on `capabilities().gpu`: `preemptible: true` (daytona.io/pricing lists its GPUs as "Preemptible GPU prices": a run on one can be cut short); `stopDeletes: true` (it is made with `autoDeleteInterval: 0`, whatever `autoDeleteMinutes` says. That is Daytona's ephemeral: its SDK's `ephemeral` sets it, and `CreateSandbox` has no `ephemeral` field, so none is sent. A GPU sandbox has no pause and no snapshot, so stopping it deletes it and nothing on it persists); `region: "earth"` (Daytona's one GPU region, sent as `target` in place of the provider's); `perGpu` 16 vCPU, 100 GiB memory and 400 GiB disk, the snapshot's; `mounts: []`, so a GPU computer with any mount is refused in words:
|
|
1593
|
+
| `gpu` | `H100`; at most 1 | daytona-gpu's own GPU (`DAYTONA_GPU_SNAPSHOT_GPU`, from GET /snapshots/daytona-gpu). A GPU computer is made from Daytona's GPU snapshot `daytona-gpu` (`DAYTONA_GPU_SNAPSHOT`: its default sandbox image, user `daytona` with passwordless sudo, plus the CUDA toolkit), sent as `snapshot`: its spec's image is `"daytona-gpu"` or `"default"`, and `check` refuses any other (a snapshot of box/Dockerfile among them) in words. A Daytona snapshot carries its own resources, so the create sends none (no `cpu`, `gpu`, `gpuType`, `memory` or `disk`: Daytona refuses them beside a snapshot, 400 "Cannot specify Sandbox resources when using a snapshot"), and the read-back's `snapshot`, `gpu` and `gpuType` must be the snapshot's. Another type or count needs a snapshot of its own, so `check` refuses it. A GPU computer's limits, declared on `capabilities().gpu`: `preemptible: true` (daytona.io/pricing lists its GPUs as "Preemptible GPU prices": a run on one can be cut short); `stopDeletes: true` (it is made with `autoDeleteInterval: 0`, whatever `autoDeleteMinutes` says. That is Daytona's ephemeral: its SDK's `ephemeral` sets it, and `CreateSandbox` has no `ephemeral` field, so none is sent. A GPU sandbox has no pause and no snapshot, so stopping it deletes it and nothing on it persists); `region: "earth"` (Daytona's one GPU region, sent as `target` in place of the provider's); `perGpu` 16 vCPU, 100 GiB memory and 400 GiB disk, the snapshot's; `mounts: []`, so a GPU computer with any mount is refused in words: Daytona's GPU host gives no `/dev/fuse`, even to root (live 11-11), and the archil client mounts through FUSE. In serve's Mode 2 the run's folder is an Archil mount, so a Daytona GPU sandbox is refused there, and Settings' `gpu.why` says so. The org needs GPU credits, or the create is refused in Daytona's words. Create notes who installed the daemon: daytona-gpu's `daytona` user through passwordless sudo, or root on a snapshot of box/Dockerfile. The `gpuSnapshot` option names our own GPU snapshot instead: box/Dockerfile as it is, built with one GPU by `box/build-daytona.py --gpu H100` (resources gpu 1 and gpuType H100, named `agentrun-archil-gpu-h100-<recipe hash>`, in region earth). Its user is root, its GPU is the one its name says, and its GPU computers take no mount either. It carries no CUDA toolkit: pip install torch brings its own CUDA runtime; the host gives the driver. A GPU spec's image is then `"default"` or that name. An Archil computer's preflight reads `/dev/fuse`, and one without it is refused in those words ("this computer has no /dev/fuse, so the Archil folder can't be mounted") before anything else |
|
|
1573
1594
|
|
|
1574
1595
|
### What the provider does
|
|
1575
1596
|
|
|
@@ -1650,8 +1671,8 @@ organization's), `daemonPath`, `arch` (`amd64` or `arm64`), `sandboxClass` (`con
|
|
|
1650
1671
|
The conformance module, `dist/conformance/daytona.js` (`--provider daytona`), reads the run's settings by these names
|
|
1651
1672
|
when it runs (`settingsFromEnv`) and passes each to `create()` as the option in brackets: `COMPUTER_DAYTONA_API_KEY`
|
|
1652
1673
|
(`apiKey`, required), `COMPUTER_DAYTONA_API_URL` (`apiUrl`), `COMPUTER_DAYTONA_DAEMON` (`daemonPath`),
|
|
1653
|
-
`COMPUTER_DAYTONA_ARCH` (`arch`), `COMPUTER_DAYTONA_TARGET` (`target`), `COMPUTER_DAYTONA_CLASS` (`sandboxClass`)
|
|
1654
|
-
`COMPUTER_DAYTONA_USER` (`daemonUser`). It exports `createProvider()` and `createDriftedProvider()` (which builds a
|
|
1674
|
+
`COMPUTER_DAYTONA_ARCH` (`arch`), `COMPUTER_DAYTONA_TARGET` (`target`), `COMPUTER_DAYTONA_CLASS` (`sandboxClass`),
|
|
1675
|
+
`COMPUTER_DAYTONA_USER` (`daemonUser`) and `COMPUTER_DAYTONA_GPU_SNAPSHOT` (`gpuSnapshot`). It exports `createProvider()` and `createDriftedProvider()` (which builds a
|
|
1655
1676
|
daemon of another version with Go), and reads `COMPUTER_DAYTONA_SNAPSHOT` (the run's image; unset, `"default"`,
|
|
1656
1677
|
Daytona's default snapshot). It never reads `DAYTONA_API_KEY`, `DAYTONA_API_URL` or `DAYTONA_TARGET`, not even as a
|
|
1657
1678
|
fallback: on a host that runs other Daytona work they may hold another organization's key. Those are serve's names,
|
|
@@ -1733,6 +1754,7 @@ repository's main; the docs were read on 2026-11-05.
|
|
|
1733
1754
|
| `GET /sandbox/{sandboxId}/toolbox-proxy-url`; the toolbox at `toolboxProxyUrl` + `/` + id | `daytona/clients@8006f63e:openapi-specs/api.json:5235`; `daytona/clients@8006f63e:sdk-typescript/src/Sandbox.ts:1566-1573` |
|
|
1734
1755
|
| `Authorization: Bearer <key>` | `daytona/clients@8006f63e:sdk-typescript/src/Daytona.ts:444` |
|
|
1735
1756
|
| `POST /files/upload-v2?path=`, multipart field `file` | `daytona/clients@8006f63e:openapi-specs/toolbox.json:2031` |
|
|
1757
|
+
| `POST /files/upload?path=`, multipart field `file`, on a toolbox with no `/files/upload-v2` | `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/toolbox/server.go:191`, `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/toolbox/fs/upload_file.go:22-35` |
|
|
1736
1758
|
| `POST /process/execute` `{command, timeout}` to `{exitCode, result}`; the command piped to the shell | `daytona/clients@8006f63e:openapi-specs/toolbox.json:3234`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:4679`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:4703`; `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/toolbox/process/execute.go:55-57` |
|
|
1737
1759
|
| `POST /process/session` `{sessionId}`; a session's shell runs as the toolbox's own user | `daytona/clients@8006f63e:openapi-specs/toolbox.json:3636`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:4525`; `daytonaio/daytona@b5a5d9e7:apps/daemon/pkg/session/create.go:20-24` |
|
|
1738
1760
|
| `POST /process/session/{sessionId}/exec` `{command, runAsync, suppressInputEcho}` to `{cmdId}` | `daytona/clients@8006f63e:openapi-specs/toolbox.json:4017`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:5922`, `daytona/clients@8006f63e:openapi-specs/toolbox.json:5935` |
|
|
@@ -2020,6 +2042,105 @@ A live run must show:
|
|
|
2020
2042
|
`packages/envd/internal/services/process/start.go`, `.../process/handler/handler.go:395-420`), and E2B's docs
|
|
2021
2043
|
(network/restrict-public-access and network/internet-access, read 2026-11-07). Each is cited where it is used above and in `src/e2b.ts`.
|
|
2022
2044
|
|
|
2045
|
+
## Orgo: Windows and macOS desktops (parked)
|
|
2046
|
+
|
|
2047
|
+
Orgo offers its Linux desktop alone, which runs computerd (`src/orgo.ts`). Its Windows and macOS desktops are parked:
|
|
2048
|
+
the descriptor lists them in `parked` (`ORGO_PARKED`), so `PROVIDERS` offers no configuration of either, Settings →
|
|
2049
|
+
Computers lists no Windows or macOS image, and an agent whose computer names `windows` or `macos` is refused at its
|
|
2050
|
+
run's start in words naming the image Orgo offers, `linux`. They do not run computerd either: computerd for Windows and
|
|
2051
|
+
macOS is CP-8, deferred. `create({ os: "windows" | "macos", apiKey, workspaceId })` still builds an
|
|
2052
|
+
`OrgoDesktopProvider` (`src/orgo-desktop.ts`) with daemon `none`, for the conformance suite and the tests. It answers
|
|
2053
|
+
the protocol's methods in process over Orgo's REST API, as the phone harness and Browserbase do. Its spec's image is
|
|
2054
|
+
`"windows"` (`ORGO_WINDOWS_IMAGE`, Orgo's Windows Server 2019) or `"macos"` (`ORGO_MACOS_IMAGE`): the one the provider was
|
|
2055
|
+
built for.
|
|
2056
|
+
|
|
2057
|
+
- **What each offers.** The protocol groups, by Orgo's calls:
|
|
2058
|
+
- `screen`: Orgo's screenshot (`response_format=base64&format=png`). A region is cropped in process. The live view
|
|
2059
|
+
polls it about once a second, scaled by Orgo past `maxWidth`.
|
|
2060
|
+
- `input.pointer` and `input.keys`: Orgo's click, mouse-move, drag, scroll, type and key calls.
|
|
2061
|
+
- `exec`: Orgo's bash call. On Windows that is PowerShell: argv becomes a call operator over single-quoted words,
|
|
2062
|
+
and the exit code is `$LASTEXITCODE`. On macOS it is the shell, every word quoted. argv is never a shell string.
|
|
2063
|
+
- `files`, Windows only: one PowerShell script whose request is base64 JSON. A write over 96 KiB is uploaded first
|
|
2064
|
+
(Orgo's `/files/upload` with `destPath`).
|
|
2065
|
+
- No `processes`: Orgo runs a command and waits for it. No `tar`, and no mount.
|
|
2066
|
+
- Network `open`, never read back from inside: Orgo has no egress control, and no daemon runs in the computer to
|
|
2067
|
+
hold its programs to loopback, so the provider cannot prove `none`.
|
|
2068
|
+
- **What Orgo's API cannot do is refused in words, and a refused batch runs nothing:**
|
|
2069
|
+
- on Windows, a triple click, keys held during a click, a drag of more than two points, a sideways or pixel
|
|
2070
|
+
scroll, and `hold`;
|
|
2071
|
+
- on macOS, a right-button double click or drag;
|
|
2072
|
+
- `+` as a key, since it joins Orgo's combinations.
|
|
2073
|
+
- **down and up.** Orgo has no separate press and release. A `down` is held in the client, across batches as the
|
|
2074
|
+
protocol says. Its `up` becomes one click (the pointer did not move) or one drag (from where it went down). A batch
|
|
2075
|
+
that fails releases a press it holds.
|
|
2076
|
+
- **The cursor.** The live view's frames carry the place the client last moved the pointer to (`cursor`), and a move is
|
|
2077
|
+
a new frame even when Orgo's screenshot leaves the cursor out.
|
|
2078
|
+
- **Lifetime.** The name carries the run, the epoch and the deadline, as the Linux desktop's does (`src/orgo-names.ts`),
|
|
2079
|
+
and the janitor ends a computer by it. On Windows, Orgo's `ends_in_hours` is the backstop. A Mac has no Orgo end.
|
|
2080
|
+
The other labels are a file the provider writes in the computer (`C:\ProgramData\agentrun\labels.json`,
|
|
2081
|
+
`/Users/Shared/agentrun/labels.json`). A program in the computer can change that file, so list, the janitor and
|
|
2082
|
+
the takeover trust the name, which only the key can change.
|
|
2083
|
+
- **attach** reports who the programs run as. On Windows that is `0:0` for a member of the Administrators group,
|
|
2084
|
+
since it can do what a root can, and is said as it is.
|
|
2085
|
+
- **Idle suspension.** Nothing runs in a computer Orgo does not read `running`: any action wakes a suspended one.
|
|
2086
|
+
`list` reads the labels file of a running computer alone, and attach, connect and extend refuse the others in words.
|
|
2087
|
+
- **Release** deletes. A Mac Orgo manages answers 409 to a delete. That is refused in Orgo's words, and the Mac is
|
|
2088
|
+
left.
|
|
2089
|
+
- **Conformance.** `COMPUTER_ORGO_OS=windows` (or `macos`) with `--kind desktop` runs the desktop's cases:
|
|
2090
|
+
- The Windows fixture is a PowerShell script this package carries (`src/conformance/windows-fixture.ts`): the same
|
|
2091
|
+
window as `computerd-fixture`, started with `Start-Process` through exec and files.
|
|
2092
|
+
- The cases written for Linux (exec's and files' POSIX programs and paths) are skipped in words (`caseOs`).
|
|
2093
|
+
- The live run needs Orgo's Scale plan or a Windows computer bought on the plan; the macOS run needs Orgo's Mac
|
|
2094
|
+
access.
|
|
2095
|
+
|
|
2096
|
+
### An agent's own computer on Orgo (persistence)
|
|
2097
|
+
|
|
2098
|
+
The Linux desktop declares `capabilities().persistence` (`{ keepsState: true, resume: true }`) and takes
|
|
2099
|
+
`spec.owner: { agent }` with no `lifetimeMs`: a computer that belongs to the agent and outlives the run (see
|
|
2100
|
+
"Persistent computers: an agent's own"). The Windows desktop's code declares it too, without resume; a Mac declares
|
|
2101
|
+
none.
|
|
2102
|
+
|
|
2103
|
+
- **Its name** is `computer-<hex>-o<the owner's hash>`, with no run, epoch or deadline, and it has no Orgo end.
|
|
2104
|
+
- **Its labels live in a ledger.** Orgo holds no labels, and a detached computer is never woken to read its labels
|
|
2105
|
+
file, so the provider keeps an agent's computer's labels (the owner's, the claim's run and epoch) and when it was
|
|
2106
|
+
detached in a ledger: the `ledger` option, which Orgo's descriptor declares, so serve passes its computer ledger and
|
|
2107
|
+
they outlive a restart. Without one it is kept in memory. `list` reads them with nothing run inside, and gives
|
|
2108
|
+
`owned`, `owner`, `detachedAt`, and `deadline` undefined. A ledger has `put`, `get`, `list`, `remove` and `swap`:
|
|
2109
|
+
`swap(was, entry)` writes entry only while the kept entry is still `was` as read (a compare-and-set; serve's is one
|
|
2110
|
+
SQL statement), and says whether it did.
|
|
2111
|
+
- **No entry, no labels.** An agent's computer with no ledger entry is listed `owned` with no labels and no owner, to
|
|
2112
|
+
an unfiltered list alone. The janitor can't read its owner, so it keeps it. Attach and detach refuse it in words,
|
|
2113
|
+
and nothing reads its labels file instead: release it with delete.
|
|
2114
|
+
- **`release(ref, "detach")`** is for an agent's computer alone; a run's computer refuses it and runs on:
|
|
2115
|
+
- Linux: Orgo's suspend saves memory and disk, and computerd init with them. `persistence.resume` is true.
|
|
2116
|
+
- Windows: Orgo's stop archives its disk (files, apps and settings, not memory), and it reads `frozen`. `resume` is
|
|
2117
|
+
false.
|
|
2118
|
+
- macOS declares no persistence: Orgo stops no Mac, so `check()` refuses an owner.
|
|
2119
|
+
- **`attach({ id }, { claim })`** from a later run starts or resumes it first: attaching an agent's computer is asking
|
|
2120
|
+
for it. A run's computer that isn't running is still never woken, and is never taken under a claim. Under a claim
|
|
2121
|
+
the computer carries the claim's run and epoch, in the ledger and its labels file. A claim of the same run below
|
|
2122
|
+
the epoch it carries is refused as fenced, and nothing changes. An attach that started or resumed the computer and
|
|
2123
|
+
then fails a check stops or suspends it again, as it was found. One rule keeps attaches, detaches and deletes apart:
|
|
2124
|
+
each takes the ledger entry with a busy marker (`swap`) before anything is done to the computer, and every other is
|
|
2125
|
+
refused (busy) until it is settled. The holder renews the marker with `swap` right before each step that wakes,
|
|
2126
|
+
stops, suspends or replaces what runs in the computer (a put-back, a daemon's replacement, its labels file written
|
|
2127
|
+
after a wake), and only the holder settles the entry, each write a `swap` from the entry it last wrote. A holder
|
|
2128
|
+
whose `swap` finds the entry changed (its marker went stale past 15 minutes and another took it, or it was removed)
|
|
2129
|
+
does nothing more to the computer, and its attach or detach answers an error, never ok. So of two attaches of one
|
|
2130
|
+
run racing, the lower epoch is refused however they interleave, and an older attach never ends the programs or
|
|
2131
|
+
sleep of a newer one. One provider's attaches and detaches of a computer take turns. Its read-back spec carries
|
|
2132
|
+
`owner`.
|
|
2133
|
+
- **`release(ref, "delete", { claim })`** deletes an agent's computer only while its ledger entry carries exactly that
|
|
2134
|
+
claim's run and epoch and nobody holds it busy; otherwise it is refused in words (fenced, or busy) and runs on. A
|
|
2135
|
+
claim that made a computer and then lost the agent's hold deletes it this way, so a later claim that found and took
|
|
2136
|
+
it keeps it. A run's computer refuses a delete under a claim.
|
|
2137
|
+
- **Init on Linux.** An owned computer's init ends its programs at its deadline, `maxLifetimeMs` out, and has no
|
|
2138
|
+
most in practice: each attach moves the deadline `maxLifetimeMs` out again (`deadline.extend`). A desktop left
|
|
2139
|
+
detached past that, or whose daemon is another version (the package was upgraded meanwhile), gets its daemon
|
|
2140
|
+
installed again at its next attach: the old init is stopped by its process, then every step create takes, the disk
|
|
2141
|
+
kept, and the attach notes say the daemon was replaced and why. A run's computer is refused instead. `extend`
|
|
2142
|
+
refuses an owned computer: it has no janitor's deadline to move.
|
|
2143
|
+
|
|
2023
2144
|
## Browsers: Browserbase and Kernel
|
|
2024
2145
|
|
|
2025
2146
|
A browser is a computer of kind `browser`: a vendor's browser session that answers CDP. No computerd runs (daemon
|
|
@@ -2042,19 +2163,40 @@ and are never in a ref, a list, an error's words or a report. `client` stays a `
|
|
|
2042
2163
|
| conformance reads | `COMPUTER_BROWSERBASE_API_KEY`, `COMPUTER_BROWSERBASE_PROJECT_ID`, `COMPUTER_BROWSERBASE_API_URL` | `COMPUTER_KERNEL_API_KEY`, `COMPUTER_KERNEL_API_URL` |
|
|
2043
2164
|
|
|
2044
2165
|
Both declare `lifetime: "vendor"`, `network: ["open"]`, `isolation: "vm"`, `release: ["delete"]`, and no `extend`
|
|
2045
|
-
(neither vendor moves a running session's timeout). Neither declares `downloads` yet:
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2166
|
+
(neither vendor moves a running session's timeout). Neither declares the `downloads` group yet: the kind registry's
|
|
2167
|
+
entry does not, so Browserbase's downloads are read through its `downloads` member (below). `check()` refuses an image
|
|
2168
|
+
other than `chromium`, a lifetime past the cap, a network other than open, any size, user, workdir or mount, and a
|
|
2169
|
+
browser option the provider does not declare (below), before a vendor call. `list` and attach by
|
|
2049
2170
|
labels take at least one label (a vendor account holds sessions no provider made), ask the vendor by status and by the
|
|
2050
2171
|
first label a query carries as it is, and match every label themselves. They show every browser that has not ended:
|
|
2051
2172
|
Browserbase's `RUNNING` and `PENDING`, Kernel's `status=all` with the deleted dropped (Kernel's filter takes one value,
|
|
2052
2173
|
and `active` may leave out a browser still starting). A release is idempotent: one already ended or
|
|
2053
2174
|
unknown to the vendor is released.
|
|
2054
2175
|
|
|
2176
|
+
A browser session's own options ride the spec, `spec.browser`: `viewport`, `profile: { pointer, save }` (a saved
|
|
2177
|
+
profile the session opens, and whether it writes back to it), `stealth` and `headless`. `capabilities().browser`
|
|
2178
|
+
declares what a provider's sessions offer: `timeout` (`"wall-clock"` or `"inactivity"`), `profiles: { settleMs }` (how
|
|
2179
|
+
long after a saving session ends the vendor may still write the profile back), `stealth`, `headless`, and
|
|
2180
|
+
`downloads: { path }` (the folder a driver points `Browser.setDownloadBehavior` at). An option asks for a declared
|
|
2181
|
+
feature or is refused in words; a flag set `false` asks for nothing; a viewport needs no feature. No browser loads an
|
|
2182
|
+
extension: the driver is raw CDP, with nothing loaded into Chrome. `isBrowserProvider(p)` is true for a provider of
|
|
2183
|
+
kind browser that declares them.
|
|
2184
|
+
|
|
2185
|
+
| | Browserbase | Kernel | Local Chrome |
|
|
2186
|
+
| --- | --- | --- | --- |
|
|
2187
|
+
| `capabilities().browser` | wall-clock, `stealth`, `profiles` (settle 5 s), `downloads` (`downloads/`) | inactivity, `headless`, `profiles` (settle 0) | wall-clock |
|
|
2188
|
+
| `viewport` | `browserSettings.viewport` | `viewport` | the window's size |
|
|
2189
|
+
| `stealth` | `browserSettings.verified` and `solveCaptchas` (the solver is off otherwise: Browserbase's default is on) | not declared (Kernel's stealth brings a proxy nothing prices yet) | not declared |
|
|
2190
|
+
| `profile` | a context: `browserSettings.context { id, persist }` | a profile by name: `profile { name, save_changes }`, made first if Kernel does not know it | not declared |
|
|
2191
|
+
| `profiles { create, remove }` | `POST /v1/contexts`, `DELETE /v1/contexts/{id}` | `POST /profiles` under a random name (the pointer), `DELETE /profiles/{name}` | none |
|
|
2192
|
+
| `downloads { list, read }` | `GET /v1/downloads?sessionId=` (paged), `GET /v1/downloads/{id}`, cut at `maxBytes` | none | none |
|
|
2193
|
+
|
|
2194
|
+
A pointer is a capability: whoever holds it opens the profile, so no error's words carry one.
|
|
2195
|
+
|
|
2055
2196
|
A vendor call is one request, never retried where a retry could open a second paid browser, and a failure names the
|
|
2056
|
-
call and the HTTP status alone, never the vendor's words. A host that already talks to the vendor
|
|
2057
|
-
|
|
2197
|
+
call and the HTTP status alone, never the vendor's words. A host that already talks to the vendor passes its own
|
|
2198
|
+
transport: `BrowserbaseApi` (its optional calls back the features of the same name: one without them declares none of
|
|
2199
|
+
those) or `KernelRequest`. Its thrown error rides the failure as a hidden
|
|
2058
2200
|
cause (`causeOf(result)`), not enumerable, so it is in no JSON.
|
|
2059
2201
|
|
|
2060
2202
|
Each create writes one more label beside the spec's, `agentrun.create` (`CREATE_LABEL`), with a value of its own. A
|
|
@@ -2077,11 +2219,11 @@ AGENTRUN_COMPUTER_LIVE_KERNEL=1 COMPUTER_KERNEL_API_KEY=... \
|
|
|
2077
2219
|
|
|
2078
2220
|
## A local browser: this machine's Chrome, no keys
|
|
2079
2221
|
|
|
2080
|
-
The `local` provider (`local.ts`) is a computer of kind `browser` that is the Chrome or Chromium
|
|
2081
|
-
AgentRun runs on. No vendor, no key, nothing billed.
|
|
2222
|
+
The `local-chrome` provider (Local Chrome, `local-chrome.ts`) is a computer of kind `browser` that is the Chrome or Chromium
|
|
2223
|
+
on the machine AgentRun runs on. No vendor, no key, nothing billed.
|
|
2082
2224
|
|
|
2083
2225
|
```ts
|
|
2084
|
-
import { LocalBrowserProvider } from "@parcha/agentrun-computer";
|
|
2226
|
+
import { LocalBrowserProvider } from "@parcha/agentrun-computer/local-chrome";
|
|
2085
2227
|
|
|
2086
2228
|
const local = new LocalBrowserProvider({ env: { PATH: process.env.PATH } }); // or { executablePath: "/usr/bin/chromium" }
|
|
2087
2229
|
const made = await local.create({ image: "chromium", lifetimeMs: 30 * 60_000, network: "open" });
|
|
@@ -2125,8 +2267,9 @@ The fence and the sandbox are PR #1718's:
|
|
|
2125
2267
|
(`--webrtc-ip-handling-policy=disable_non_proxied_udp`). The proxy and its relay live in the supervisor, so the fence
|
|
2126
2268
|
holds for a browser driven from another process, and a browser whose supervisor is gone reaches nothing.
|
|
2127
2269
|
|
|
2128
|
-
Capabilities: `network: ["open"]` (public addresses), `isolation: "host"`,
|
|
2129
|
-
live view: run it headed to watch), `release: ["delete"]`, no mount
|
|
2270
|
+
Capabilities: `network: ["open", "allow"]` (public addresses, or a list's hosts among them), `isolation: "host"`,
|
|
2271
|
+
`daemon: "none"`, groups `cdp` only (no live view: run it headed to watch), `release: ["delete"]`, no mount, and
|
|
2272
|
+
`browser: { timeout: "wall-clock" }`: `spec.browser.viewport` sizes its window, and it takes no other session option.
|
|
2130
2273
|
|
|
2131
2274
|
Known limits, so it is for local and development use:
|
|
2132
2275
|
|
|
@@ -2139,16 +2282,16 @@ Known limits, so it is for local and development use:
|
|
|
2139
2282
|
processes. Through it they reach public addresses, which they can reach anyway.
|
|
2140
2283
|
- No proxy of your own, no extensions, no saved profiles: each browser starts from an empty profile that goes with it.
|
|
2141
2284
|
|
|
2142
|
-
Driving it: pi-browser's raw-CDP driver (`@parcha/pi-browser/driver/cdp`) drives this browser
|
|
2143
|
-
`snapshot` and `run` actions
|
|
2144
|
-
|
|
2285
|
+
Driving it: pi-browser's raw-CDP driver (`@parcha/pi-browser/driver/cdp`) drives this browser, as it drives the vendor
|
|
2286
|
+
browsers, with the `snapshot` and `run` actions and nothing loaded into Chrome. `run` code is refused; navigation is a
|
|
2287
|
+
`goto` action. Its snapshot does not read a frame another site runs in its own
|
|
2145
2288
|
process (a cross-origin iframe). The snapshot names each frame it left out, so an agent knows the page has more.
|
|
2146
2289
|
|
|
2147
2290
|
The conformance module starts a real Chrome, so it waits for its switch:
|
|
2148
2291
|
|
|
2149
2292
|
```sh
|
|
2150
|
-
|
|
2151
|
-
npm run conformance -w @parcha/agentrun-computer -- --provider local --kind browser
|
|
2293
|
+
AGENTRUN_COMPUTER_LIVE_LOCAL_CHROME=1 [COMPUTER_LOCAL_CHROME_PATH=/usr/bin/chromium] \
|
|
2294
|
+
npm run conformance -w @parcha/agentrun-computer -- --provider local-chrome --kind browser
|
|
2152
2295
|
```
|
|
2153
2296
|
|
|
2154
2297
|
## Phone harness (the phone kind)
|
|
@@ -2165,7 +2308,9 @@ const made = await phones.create({ image: "android", lifetimeMs: 10 * 60_000, ne
|
|
|
2165
2308
|
the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
2166
2309
|
|
|
2167
2310
|
- **No daemon.** Nothing runs on the phone. `connect()` asks the phone harness for the session's adb link, runs
|
|
2168
|
-
connects to it, unlocks the phone with the session's code (never in a result or an error) and probes it.
|
|
2311
|
+
connects to it, unlocks the phone with the session's code (never in a result or an error) and probes it. Its hello
|
|
2312
|
+
carries what the probe read: `arch` from `getprop ro.product.cpu.abi`, and `osVersion`, the Android release from
|
|
2313
|
+
`getprop ro.build.version.release` (such as `"15"`; absent when the phone says none).
|
|
2169
2314
|
- Neither the endpoint nor the code is ever in a spawned adb's argv, which `/proc` shows to every user of the host.
|
|
2170
2315
|
The endpoint goes to the local adb server over its socket protocol (`host:connect`, `host:devices-l`,
|
|
2171
2316
|
`host:disconnect`). The unlock is the vendor's shell command `unlock <code>`, once per connection; every shell
|
|
@@ -2234,8 +2379,9 @@ the API's control URL) is a later change: `platform: "ios"` is refused in words.
|
|
|
2234
2379
|
- `list()` reads the ledger before `GET /sessions`, so it never forgets a phone a create records while it runs. It
|
|
2235
2380
|
forgets a phone the listing leaves out only once that phone's own `GET /sessions/<id>` is a 404.
|
|
2236
2381
|
- **adb** is an option too: a transport, `{ run(args, { input }), server(service) }` (tests give a fake), or the path of
|
|
2237
|
-
the `adb` CLI (Android platform-tools; default `adb` on PATH
|
|
2238
|
-
|
|
2382
|
+
the `adb` CLI (Android platform-tools; default `adb` on PATH, which the phone's descriptor names as its
|
|
2383
|
+
`hostCommand`, so a server says it is missing before any phone is rented), whose server it starts and speaks to on
|
|
2384
|
+
the loopback (port 5037, adb's own, or `adbCli(path, { port })`). Every spawned adb names that port with `-P`, so the CLI and the
|
|
2239
2385
|
socket requests reach one server. `adbCli(path, { env })` spawns adb from the environment given, with every
|
|
2240
2386
|
`ADB_*`, `ANDROID_ADB_*` and `ANDROID_SERIAL` variable dropped, so nothing in it points the CLI at another server or
|
|
2241
2387
|
device. The library reads no environment of its own: the conformance module passes its own, minus its
|
|
@@ -2323,6 +2469,10 @@ capabilities), no case of the run failed (a declared optional group that fails w
|
|
|
2323
2469
|
every required group has at least one passing case and no Core case skipped but for an optional group the computer does
|
|
2324
2470
|
not declare, and the run left nothing behind. A Full case that skips is owed by no group: a provider may refuse in
|
|
2325
2471
|
words what its kind does not require, as the phone harness refuses `touch.pinch`, and the report still shows the skip.
|
|
2472
|
+
A case is written for the systems its `os` names (`caseOs`). Without one, a case that needs exec or processes runs
|
|
2473
|
+
POSIX programs (`sh`, `id`, `/proc`) and is Linux's alone, and one that needs files names POSIX paths and is no Windows
|
|
2474
|
+
computer's. A computer of another os skips it in words ("the case is written for linux, and this computer runs
|
|
2475
|
+
windows"), after the check of what it declares.
|
|
2326
2476
|
`none` is no computer, and `--kind` refuses it in words. Given no cases, a run takes `casesFor(machineKind)`: a
|
|
2327
2477
|
browser's own cases (`browserCases`), every other kind the suite's (`conformanceCases`), in the library as in the CLI;
|
|
2328
2478
|
`kindCases` draws from the same by kind. `kindCases`, `kindVerdict` and `casesFor` are exported, so the serve side reads
|
|
@@ -2450,24 +2600,79 @@ computer's `HOME`, which the provider sets, is a directory its user can write, a
|
|
|
2450
2600
|
From code: `runConformance(provider, { image, only?, signal?, drifted?, mountFor?, caseTimeoutMs?, cleanupTimeoutMs?,
|
|
2451
2601
|
fixture?, fetch? })` returns the report, and `formatReport(report)` the text above.
|
|
2452
2602
|
|
|
2603
|
+
## Persistent computers: an agent's own
|
|
2604
|
+
|
|
2605
|
+
A run's computer belongs to its run: it has a deadline (`lifetimeMs`, required), and the janitor or the vendor ends it
|
|
2606
|
+
once the deadline passes. A persistent computer belongs to an agent instead. It outlives the agent's runs, which take
|
|
2607
|
+
it one at a time, and it keeps its files between them. The contract, in `src/provider.ts` and `src/labels.ts`:
|
|
2608
|
+
|
|
2609
|
+
- **Declared.** A provider that keeps computers for agents declares `capabilities().persistence`:
|
|
2610
|
+
`{ keepsState: true, resume }`. `keepsState`: a detached computer keeps its files. `resume`: `true` when it comes back
|
|
2611
|
+
as it was, its processes still running; `false` when it boots again from its kept disk. A provider that declares none
|
|
2612
|
+
refuses `spec.owner` in `check()`, in words, before any vendor call, and refuses `release(ref, "detach")`, the
|
|
2613
|
+
computer left as it was.
|
|
2614
|
+
- **Owned.** `spec.owner: { agent, idleTtlMs? }` makes the computer the agent's. It has no run deadline: the rule that
|
|
2615
|
+
refuses a computer with no deadline is a run's computers' alone, and an owned spec that names `lifetimeMs` is refused
|
|
2616
|
+
(`checkTenure(spec, capabilities)` holds both rules, for every provider's `check()`). The computer carries the owner
|
|
2617
|
+
label, `agentrun.owner=agent:<id>` (`OWNER_LABEL`), and `agentrun.idle-ttl-ms` (`IDLE_TTL_LABEL`) when the owner set
|
|
2618
|
+
an idle TTL; `ownerLabels(owner)` gives both and `ownerOf(labels)` reads them back.
|
|
2619
|
+
- **Detach.** `release(ref, "detach")` stops the computer with its state kept. It stays the agent's, listed `stopped`,
|
|
2620
|
+
with `detachedAt`, when it was detached. Only an owned computer detaches: a run's computer refuses it in words and
|
|
2621
|
+
runs on. `"delete"` deletes an owned computer, and only the agent or its owner asks for that: the caller's rule, not
|
|
2622
|
+
the provider's.
|
|
2623
|
+
- **Attached under a new claim.** A run takes the computer with `attach({ id }, { claim: { run, epoch } })`. The
|
|
2624
|
+
provider brings it back (starts it, when detached) and records the claim, so the computer carries the run's
|
|
2625
|
+
`agentrun.run` and `agentrun.epoch` and `releaseOlder` of that run finds it. A claim of the same run below the epoch
|
|
2626
|
+
the computer carries is refused as fenced, with nothing changed. A claim on a computer with no owner is refused: a
|
|
2627
|
+
run's computer belongs to its run.
|
|
2628
|
+
- **The janitor.** A computer is owned when it carries the owner label or its provider's `list()` marks it `owned: true`
|
|
2629
|
+
(with `owner` when the listing knows it: a vendor whose stopped computer shows no labels). `sweep` never deletes an
|
|
2630
|
+
owned computer by a deadline. It deletes one only when its owner agent is
|
|
2631
|
+
gone (`ownerGone(agent)`, the caller's answer, in `SweepOptions`), or when it has been detached for longer than its
|
|
2632
|
+
owner's idle TTL. An owner label it cannot read keeps the computer: the janitor never deletes an agent's state on a
|
|
2633
|
+
rule it cannot read. On a provider that declares persistence it sweeps owned computers under lifetime `"vendor"`
|
|
2634
|
+
too, since no vendor ends them. `releaseOlder` detaches an owned computer of a lower epoch and never deletes it: the
|
|
2635
|
+
new claim attaches it.
|
|
2636
|
+
- **Conformance.** `provider.owner` and `provider.detach` are Core for every provider: `check()` refuses an owner
|
|
2637
|
+
without persistence, and a lifetime with one; a run's computer refuses detach and runs on. `provider.persistence` is
|
|
2638
|
+
Full, run where persistence is declared: create with an owner, write a file, detach, attach by id under a new claim,
|
|
2639
|
+
read the file back (with `resume`, find the process still running), refuse a fenced claim, then delete.
|
|
2640
|
+
|
|
2641
|
+
`test/fake-computer.mjs`'s `persistence` option is a provider that declares it and passes the cases. Orgo's provider
|
|
2642
|
+
is the first vendor to wire it.
|
|
2643
|
+
|
|
2453
2644
|
## Adding a computer
|
|
2454
2645
|
|
|
2455
|
-
A new computer is one provider file and one
|
|
2456
|
-
|
|
2646
|
+
A new computer is one provider file and one descriptor, `src/descriptors/<id>.ts`, declared once and listed in
|
|
2647
|
+
`DESCRIPTORS` (`src/descriptors/index.ts`). Everything else is derived from the descriptors: the registry
|
|
2648
|
+
(`src/providers.ts`, id to `load()`), the kind registry's `PROVIDERS` (Settings' rows), and the ids. The conformance
|
|
2649
|
+
CLI (and serve) resolve providers through them, so neither needs an edit:
|
|
2457
2650
|
|
|
2458
2651
|
```ts
|
|
2459
|
-
export const
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2652
|
+
export const FLY = defineProvider({
|
|
2653
|
+
id: "fly",
|
|
2654
|
+
label: "Fly",
|
|
2655
|
+
keys: [{ name: "FLY_API_TOKEN", option: "apiToken", required: true }], // each key and the create() option it fills
|
|
2656
|
+
metered: true,
|
|
2657
|
+
mounts: [],
|
|
2658
|
+
network: ["none", "open"], // the network forms its computers make: none, open, allow
|
|
2659
|
+
capabilities: [{ kind: "linux", groups: ["exec", "files", "processes"] }], // one per configuration
|
|
2660
|
+
load: () => import("../fly.js"),
|
|
2661
|
+
});
|
|
2466
2662
|
```
|
|
2467
2663
|
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
`
|
|
2664
|
+
A descriptor is data and a lazy `load()`: it imports `../descriptor.js` and other descriptors alone, so loading the
|
|
2665
|
+
registry, the kind registry or the package root loads no provider and no vendor SDK. `defineProvider` checks it when
|
|
2666
|
+
it is declared (`descriptorProblems`), in words. Its fields: `id`, `label`, `keys` (each key's name, the option it
|
|
2667
|
+
fills, and whether it is required), `settings` (a setting that is no key but fills an option, with its default),
|
|
2668
|
+
`metered`, `mounts`, `network` (the network forms its computers make, at least one of none, open and allow),
|
|
2669
|
+
`capabilities` (the kind and groups of each configuration), `defaultImage` (by setting kind),
|
|
2670
|
+
`prepareImage` (a provider that builds or pulls its image before a run), `imageEnv` (the server's environment variable
|
|
2671
|
+
that, when set, names the image of every computer of the provider, as Daytona's `AGENTRUN_DAYTONA_SNAPSHOT`), `local`
|
|
2672
|
+
(a computer on this host), and
|
|
2673
|
+
`ledger` (the option a provider's ledger fills). `providerFor(id, options)` builds a provider by id from its options and
|
|
2674
|
+
refuses an id it does not hold, naming the ones it does. The provider file, `src/<vendor>.ts`, exports what a
|
|
2675
|
+
`ProviderModule` is:
|
|
2471
2676
|
|
|
2472
2677
|
- the provider class, which implements `ComputerProvider` and reports the registry id as its `id`;
|
|
2473
2678
|
- `MOUNT`, the mount kinds its computers take;
|
package/box/Dockerfile
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
# - FUSE (fuse3, and the client's own FUSE library). No firewall: init and every tool run in a network namespace of
|
|
9
9
|
# their own with loopback alone (computerd init --own-network), while the archil client and serve, as root, stay in
|
|
10
10
|
# the computer's, which reaches Archil;
|
|
11
|
+
# - nftables, for the helper's mount with an egress gateway alone: it redirects root's TCP to Archil's 8100 and 32050
|
|
12
|
+
# to computerd's archil relay on the computer's loopback;
|
|
11
13
|
# - /workspace, empty and root's, where the helper mounts the run's folder.
|
|
12
14
|
#
|
|
13
15
|
# No sudo and no sudoers file: the image's user is root, so the provider's own exec (Daytona's toolbox, Modal's exec,
|
|
@@ -35,7 +37,7 @@ RUN set -eu; \
|
|
|
35
37
|
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; \
|
|
36
38
|
apt-get update -qq; \
|
|
37
39
|
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
|
|
38
|
-
git curl ca-certificates nodejs npm ripgrep fuse3 >/dev/null; \
|
|
40
|
+
git curl ca-certificates nodejs npm ripgrep fuse3 nftables >/dev/null; \
|
|
39
41
|
curl -fsSL -o /tmp/archil.deb "https://s3.amazonaws.com/archil-client/pkg/archil_${ARCHIL_VERSION}_${arch}.deb"; \
|
|
40
42
|
echo "$sum /tmp/archil.deb" | sha256sum -c -; \
|
|
41
43
|
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends /tmp/archil.deb >/dev/null; \
|