@parcha/agentrun-computer 0.1.0-beta.46 → 0.1.0-beta.48
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 +96 -21
- package/dist/attach.d.ts +23 -5
- package/dist/attach.js +83 -20
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/agent37.js +2 -2
- package/dist/conformance/boxd.js +2 -3
- package/dist/conformance/cli.js +1 -1
- package/dist/conformance/cloudflare.d.ts +2 -0
- package/dist/conformance/cloudflare.js +4 -0
- package/dist/conformance/daytona.d.ts +4 -0
- package/dist/conformance/daytona.js +5 -0
- package/dist/conformance/e2b.js +2 -3
- package/dist/conformance/fixture.js +1 -1
- package/dist/conformance/fly.d.ts +4 -0
- package/dist/conformance/fly.js +4 -0
- package/dist/conformance/kind.d.ts +8 -1
- package/dist/conformance/kind.js +6 -1
- package/dist/conformance/modal.d.ts +4 -0
- package/dist/conformance/modal.js +5 -1
- package/dist/conformance/report.js +1 -1
- package/dist/conformance/runner.js +1 -1
- package/dist/conformance/smolcloud.d.ts +47 -0
- package/dist/conformance/smolcloud.js +73 -0
- package/dist/conformance/sweep.js +1 -1
- package/dist/conformance/types.d.ts +8 -3
- package/dist/daytona.d.ts +1 -1
- package/dist/daytona.js +8 -5
- package/dist/descriptor.d.ts +22 -3
- package/dist/descriptor.js +31 -2
- package/dist/descriptors/cloudflare.js +1 -1
- package/dist/descriptors/daytona.d.ts +7 -0
- package/dist/descriptors/daytona.js +11 -3
- package/dist/descriptors/fly.js +1 -1
- package/dist/descriptors/index.d.ts +19 -1
- package/dist/descriptors/index.js +3 -2
- package/dist/descriptors/smolcloud.d.ts +18 -0
- package/dist/descriptors/smolcloud.js +21 -0
- package/dist/desktop.d.ts +18 -11
- package/dist/desktop.js +53 -15
- package/dist/hosted/provider.js +16 -29
- package/dist/hosted/rest.d.ts +2 -0
- package/dist/hosted/rest.js +1 -1
- package/dist/hosted/scripts.d.ts +7 -5
- package/dist/hosted/scripts.js +29 -16
- package/dist/hosted/values.d.ts +0 -2
- package/dist/hosted/values.js +0 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -3
- package/dist/kinds.d.ts +11 -71
- package/dist/kinds.js +2 -9
- package/dist/modal.js +5 -4
- package/dist/protocol.d.ts +14 -0
- package/dist/setting-kinds.d.ts +19 -0
- package/dist/setting-kinds.js +9 -0
- package/dist/smolcloud.d.ts +21 -0
- package/dist/smolcloud.js +254 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ import { checkMount, readBackOf, WORKSPACE, type MountSpec } from "@parcha/agent
|
|
|
16
16
|
|
|
17
17
|
The package root holds the protocol, the registry and the descriptors, and loads no provider: a provider loads by its
|
|
18
18
|
id (`providerFor(id, options)`, which imports that one provider's file), or from its subpath (`/docker`, `/daytona`,
|
|
19
|
-
`/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`). A provider's
|
|
19
|
+
`/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`, `/smolcloud`). A provider's
|
|
20
20
|
option types (`DockerProviderOptions`, `ModalProviderOptions` and the like) come from its subpath too, not the root.
|
|
21
21
|
|
|
22
22
|
The package carries the daemon for Linux amd64 and arm64 in `dist/`, so a provider runs it with no Go on the host. A
|
|
@@ -444,6 +444,7 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
444
444
|
| daytona | sandbox: `DAYTONA_DEFAULT_SNAPSHOT` ("default") |
|
|
445
445
|
| modal | none: `prepareImage()` answers the box image (`boxImageRef()`) |
|
|
446
446
|
| e2b | none: `prepareImage()` answers the box template (`boxE2bTemplate()`), for a sandbox and a desktop alike |
|
|
447
|
+
| smolcloud | none: `prepareImage()` answers the box image (`boxImageRef()`) |
|
|
447
448
|
| orgo | desktop: `ORGO_BASE_IMAGE` ("linux") |
|
|
448
449
|
| phone-harness | phone: `PHONE_IMAGE` ("android") |
|
|
449
450
|
| browserbase, kernel, local | browser: `BROWSER_IMAGE` ("chromium") |
|
|
@@ -669,6 +670,7 @@ live under:
|
|
|
669
670
|
| `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID` | Browserbase's `apiKey`, `projectId`: the names pi-browser reads today |
|
|
670
671
|
| `KERNEL_API_KEY` | Kernel's `apiKey`: the name pi-browser reads today |
|
|
671
672
|
| `BOXD_API_KEY`, `BOXD_ORG`, `BOXD_REGION` | boxd's `apiKey`, `org` and `region` (unset: the key's own org, the API's home region) |
|
|
673
|
+
| `SMOLCLOUD_API_KEY` | smol cloud's `apiKey` |
|
|
672
674
|
|
|
673
675
|
- **the conformance CLI and the live harness** (`src/conformance/`: the CLI, each provider's conformance module and the
|
|
674
676
|
sweeps) read their own `COMPUTER_<ID>_*` names, the ones the live scripts set, through each module's
|
|
@@ -1374,7 +1376,7 @@ The conformance module, `dist/conformance/modal.js` (`--provider modal`), reads
|
|
|
1374
1376
|
(`settingsFromEnv`) and passes each to `create()` as its option: `COMPUTER_MODAL_TOKEN_ID` and
|
|
1375
1377
|
`COMPUTER_MODAL_TOKEN_SECRET` (never `MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET`: a host may hold a production token under
|
|
1376
1378
|
those names, and with only them set it refuses, naming the `COMPUTER_MODAL_` pair), `COMPUTER_MODAL_APP`, and, if set,
|
|
1377
|
-
`COMPUTER_MODAL_SERVER_URL` and `COMPUTER_MODAL_CONNECT` (`connect`). It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
|
|
1379
|
+
`COMPUTER_MODAL_SERVER_URL` and `COMPUTER_MODAL_CONNECT` (`connect`); `createProvider()` alone also reads `COMPUTER_MODAL_KIND` (`kind`, `desktop` on dial only). It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
|
|
1378
1380
|
anything else. Its `createDriftedProvider()` uploads a daemon it builds with Go as version `<version>-drift`, so Go must
|
|
1379
1381
|
be on PATH. Every computer of a run gets `maxLifetimeMs` 30 minutes. Core `provider.stop` expects Modal's refusal (it
|
|
1380
1382
|
declares no stop), and the Full `provider.janitor` case is skipped (`lifetime:janitor`, `release:stop`).
|
|
@@ -1403,8 +1405,8 @@ conformance module's `dialKit()` refuses, as E2B's does: the Core run happens in
|
|
|
1403
1405
|
run image with `COMPUTER_MODAL_CONNECT=dial` is the box image, the one that holds `agentrun-dial` (debian:bookworm-slim
|
|
1404
1406
|
on exec, as before).
|
|
1405
1407
|
|
|
1406
|
-
A dial sandbox may be a desktop (`kind: "desktop"`): the box image's X server
|
|
1407
|
-
|
|
1408
|
+
A dial sandbox may be a desktop (`kind: "desktop"`): the box image's X server, started over the socket it dialed, and
|
|
1409
|
+
xfwm4, which computerd starts, 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
1410
|
constructor refuses `kind: "desktop"` in words. The descriptor's desktop configuration selects `connect: "dial"` itself,
|
|
1409
1411
|
so a server whose `modalConnect` is exec still makes its desktop over dial (it needs the dial's public address). In
|
|
1410
1412
|
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
|
|
@@ -1559,7 +1561,7 @@ the TTL.
|
|
|
1559
1561
|
|
|
1560
1562
|
| Capability | Declared | Why |
|
|
1561
1563
|
| --- | --- | --- |
|
|
1562
|
-
| `kind` | `linux` | a Linux shell with computerd: exec, files and processes |
|
|
1564
|
+
| `kind` | `linux`; `desktop` on dial | a Linux shell with computerd: exec, files and processes; on dial, `kind: "desktop"` adds the box snapshot's display ([Daytona on dial](#daytona-on-dial)) |
|
|
1563
1565
|
| `lifetime` | `vendor` | `ttlMinutes` destroys the sandbox in any state once it elapses; set to the lifetime in whole minutes, rounded up. Init also ends every process at the deadline itself. |
|
|
1564
1566
|
| `network` | `none`, `open`, `allow` | none: `networkBlockAll` at create, and the daemon's own network namespace; open and a list: not blocked (the account's tier may still limit where it goes), and the daemon's own namespace whose one way out is init's egress proxy (public internet only; a list's hosts alone) |
|
|
1565
1567
|
| `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 |
|
|
@@ -1642,7 +1644,7 @@ when it runs (`settingsFromEnv`) and passes each to `create()` as the option in
|
|
|
1642
1644
|
(`apiKey`, required), `COMPUTER_DAYTONA_API_URL` (`apiUrl`), `COMPUTER_DAYTONA_DAEMON` (`daemonPath`),
|
|
1643
1645
|
`COMPUTER_DAYTONA_ARCH` (`arch`), `COMPUTER_DAYTONA_TARGET` (`target`), `COMPUTER_DAYTONA_CLASS` (`sandboxClass`),
|
|
1644
1646
|
`COMPUTER_DAYTONA_USER` (`daemonUser`), `COMPUTER_DAYTONA_GPU_SNAPSHOT` (`gpuSnapshot`) and `COMPUTER_DAYTONA_CONNECT`
|
|
1645
|
-
(`connect`). It exports `createProvider()` and `createDriftedProvider()` (which builds a
|
|
1647
|
+
(`connect`); the providers it makes also read `COMPUTER_DAYTONA_KIND` (`kind`, `desktop` on dial only). It exports `createProvider()` and `createDriftedProvider()` (which builds a
|
|
1646
1648
|
daemon of another version with Go), and reads `COMPUTER_DAYTONA_SNAPSHOT` (the run's image; unset, `"default"`,
|
|
1647
1649
|
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
|
|
1648
1650
|
fallback: on a host that runs other Daytona work they may hold another organization's key. Those are serve's names,
|
|
@@ -1680,10 +1682,11 @@ no exec and no upload, and nothing goes through the toolbox: create sends the bo
|
|
|
1680
1682
|
`networkBlockAll: false` (the machine's root reaches the server; network none is init's, inside), and the snapshot's
|
|
1681
1683
|
entrypoint runs `agentrun-dial`. No Archil mount, no GPU, and not `image: "default"` (Daytona's default snapshot holds
|
|
1682
1684
|
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
|
|
1684
|
-
and 4
|
|
1685
|
-
|
|
1686
|
-
|
|
1685
|
+
(`kind: "desktop"`): the box snapshot's X server, started over the socket it dialed, and xfwm4, which computerd starts
|
|
1686
|
+
(init's `--window-manager`), at the snapshot's 2 CPUs and 4 GiB, with no GPU. On exec a Daytona computer is kind
|
|
1687
|
+
`linux` alone, and the constructor refuses `kind: "desktop"` in words; the descriptor's desktop configuration selects
|
|
1688
|
+
`connect: "dial"` itself. Why computerd, not the client, starts the manager here: [PROVIDERS.md](PROVIDERS.md#machines-that-dial-in).
|
|
1689
|
+
What each part of a dial sandbox rests on:
|
|
1687
1690
|
|
|
1688
1691
|
- **A snapshot, never an image.** A create names a snapshot; a snapshot is made from "any publicly accessible image"
|
|
1689
1692
|
whose tag is not `latest`, `lts` or `stable` ([docs: create snapshots](https://www.daytona.io/docs/en/snapshots.md#create-snapshots)).
|
|
@@ -1894,12 +1897,16 @@ E2B's envd is the sandbox's first process, a systemd service with `Restart=alway
|
|
|
1894
1897
|
whose start answers after the call gave up on it (its bound passed, or the caller aborted) is killed as it lands.
|
|
1895
1898
|
6. A desktop's X server, `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp`, starts through the daemon with
|
|
1896
1899
|
`process.start`, as the computer's user, and create waits until hello declares the display (`src/desktop.ts`,
|
|
1897
|
-
shared with Docker). Then xfwm4, which the template has, starts
|
|
1898
|
-
--sm-client-disable
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1900
|
+
shared with Docker). Then xfwm4, which the template has, starts on it (`xfwm4 --compositor=off
|
|
1901
|
+
--sm-client-disable`), so the apps an agent opens are framed and focused: computerd starts it itself, asked by
|
|
1902
|
+
init's `--window-manager` (the host's facts say `windowManager`), once the display answers, and hello's
|
|
1903
|
+
`windowManager` says it runs, which create waits on. xfwm4 reads its settings over a session bus and exits without
|
|
1904
|
+
one. So it runs under `dbus-run-session`, as the computer's user, in a network namespace of its own that init makes
|
|
1905
|
+
as root before it drops to that user (no user namespace is needed), and its bus listens on an abstract name there,
|
|
1906
|
+
which a program of the computer's user cannot connect to. One that joins that namespace (nsenter) can, as the same
|
|
1907
|
+
uid can ptrace xfwm4. xfwm4 reaches the display by its path. An older computerd, whose hello has no
|
|
1908
|
+
`windowManager`, gets the manager through `process.start`, as before (`WINDOW_MANAGER`, under `unshare --user
|
|
1909
|
+
--map-current-user --net`). It and every app `apps.launch` opens get `NO_AT_BRIDGE=1`: the template has at-spi2-core, so GTK's
|
|
1903
1910
|
accessibility bridge would start an at-spi bus, a socket of the user's at `/work/.cache/at-spi/bus_0` that nothing
|
|
1904
1911
|
of ours uses. An app also gets no session bus (`DBUS_SESSION_BUS_ADDRESS=disabled:`). Given none, it would start
|
|
1905
1912
|
one with the template's dbus-launch, and that bus starts gnome-keyring-daemon, a socket of the user's at
|
|
@@ -2061,8 +2068,8 @@ provider does in `process.env`. `COMPUTER_E2B_PUBLIC_STREAM` is no longer read.
|
|
|
2061
2068
|
With `connect: "dial"` (a server's `e2bConnect` setting; `exec` by default) an E2B sandbox dials the server instead
|
|
2062
2069
|
([PROVIDERS.md](PROVIDERS.md#machines-that-dial-in)): a desktop by default, as on exec, since the box template has
|
|
2063
2070
|
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
|
|
2065
|
-
socket the sandbox dialed, through `process.start
|
|
2071
|
+
exec and no upload. A desktop's launch adds `DISPLAY` and init's `--window-manager` to the boot env; its X server
|
|
2072
|
+
starts over the socket the sandbox dialed, through `process.start`, and computerd starts xfwm4 once it answers. A dial desktop whose X server has gone is not refused at `connect()`
|
|
2066
2073
|
as on exec: it reads back kind `linux`, and its screen, input, apps and ui calls are refused in words, never sent, until
|
|
2067
2074
|
its hello says `desktop` again. E2B runs a template's start command once, at the template's build, and snapshots it running, so
|
|
2068
2075
|
it never sees a create's env ([docs.e2b.dev/template/start-ready-command](https://docs.e2b.dev/template/start-ready-command)).
|
|
@@ -2219,8 +2226,8 @@ kernel `4.19.0-gvisor`): root has no `CAP_SYS_ADMIN`, and init made its namespac
|
|
|
2219
2226
|
`create({ kind: "desktop", ... })` (serve builds the descriptor's desktop configuration so) makes a desktop: the
|
|
2220
2227
|
adapter gives init `DISPLAY` and starts `Xvfb :0 -screen 0 1280x800x24 -nolisten tcp` through the daemon as the tool
|
|
2221
2228
|
user (`src/desktop.ts`), as on E2B, so the X server is one process in init's table, in its own network namespace, and
|
|
2222
|
-
ends with the computer;
|
|
2223
|
-
on E2B. It starts from the box image the release publishes, `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
|
|
2229
|
+
ends with the computer; computerd starts xfwm4 itself once the display answers (init's `--window-manager`), its
|
|
2230
|
+
session bus out of the user's reach, as on E2B. It starts from the box image the release publishes, `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
|
|
2224
2231
|
(`box/Dockerfile`: the archil client, the helper, the tool user, FUSE, no sudo, plus Xvfb, xfwm4, and the apps E2B
|
|
2225
2232
|
Desktop has that are cheap to carry, which the `apps` group lists and opens), as a template of the key's own workspace
|
|
2226
2233
|
named `agentrun-box-<recipe hash>`. A sandbox that mounts an Archil disk starts from the same template.
|
|
@@ -2827,6 +2834,74 @@ On 2026-11-16, `kind linux` passed Core again and `kind desktop` did not: 0 case
|
|
|
2827
2834
|
skipped, five because the run passed no `--fixture`, and `apps.launch-terminate` because boxd's own image lists none
|
|
2828
2835
|
of the stock apps. The desktop snapshot above is the fix for the last; it has not run live yet.
|
|
2829
2836
|
|
|
2837
|
+
## smol cloud
|
|
2838
|
+
|
|
2839
|
+
```ts
|
|
2840
|
+
import { providerFor } from "@parcha/agentrun-computer";
|
|
2841
|
+
|
|
2842
|
+
// The key is the caller's to pass (serve's SMOLCLOUD_API_KEY).
|
|
2843
|
+
const smol = await providerFor("smolcloud", { apiKey });
|
|
2844
|
+
const made = await smol.create({ image: "alpine:3.20", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
2845
|
+
```
|
|
2846
|
+
|
|
2847
|
+
A smol cloud computer is kind `linux`, a [smol cloud](https://smolmachines.com) machine: a microVM booted from any OCI
|
|
2848
|
+
image, with its own kernel. With no image named, it starts from the box image, the public registry tag
|
|
2849
|
+
`prepareImage()` answers (`boxImageRef()`), which smol cloud pulls at create. smol cloud runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)):
|
|
2850
|
+
`src/smolcloud.ts` is its `MachineHost`, over smol cloud's REST API (`https://api.smolmachines.com`,
|
|
2851
|
+
`Authorization: Bearer <key>`) with `fetch` and the shared REST client.
|
|
2852
|
+
|
|
2853
|
+
| MachineHost | smol cloud |
|
|
2854
|
+
| --- | --- |
|
|
2855
|
+
| `create` | `POST /v1/machines` named `agr-<computer name>`, the image on an amd64 node, the labels, the spec's size (2 CPUs and 4 GiB unless it names one), `autoStopSeconds: 0` (the idle stop off), `ttlSeconds` to the request's backstop, `start: true`; a 409 is `exists` |
|
|
2856
|
+
| `get` | `GET /v1/machines/{id}`: `started` is running, `creating` starting, `created`, `stopped`, `pausing` and `paused` stopped, `error` and `deleting` gone (with smol cloud's `error` as why), `deleted` none |
|
|
2857
|
+
| `list` | `GET /v1/machines?label=k=v`, one `label` per label |
|
|
2858
|
+
| `delete` | `DELETE /v1/machines/{id}`; a 404 is done |
|
|
2859
|
+
| `exec` | a resumable exec started interactive (`POST /v1/machines/{id}/execs`), through `framedExec`: output read by offset with a 25 s long poll (`GET .../execs/{execId}?after=&wait=25`), stdin as numbered base64 frames of 48 KiB (`POST .../stdin`, safe to resend), `eof` to end it, `DELETE` to kill it |
|
|
2860
|
+
| `upload` | `PUT /v1/machines/{id}/files/{path}`, the bytes as they are |
|
|
2861
|
+
| `extend` | `PATCH /v1/machines/{id}/labels` with the deadline label alone |
|
|
2862
|
+
|
|
2863
|
+
What smol cloud refuses or this host works around:
|
|
2864
|
+
|
|
2865
|
+
- An argv with an empty word is refused (400 `command arguments cannot be empty`), and the adapter's scripts pass one
|
|
2866
|
+
for an unset option. Such an argv runs as one quoted line, `/bin/sh -c 'exec <argv>'`; any other runs as given. The
|
|
2867
|
+
API's own shell form (`command` as a string) is not used: it runs `sh -lc`, a login shell.
|
|
2868
|
+
- An account without a card runs 4 machines at once, so a run takes `--concurrency 4`. The cap answers 422 with the
|
|
2869
|
+
status's own code; its words (`concurrency limit reached: ...`) are read as `limit`.
|
|
2870
|
+
- Labels: at most 32, keys of `[a-z0-9._/-]`, values up to 255 characters (`facts.labels.count` is 32).
|
|
2871
|
+
- Machines are placed on amd64 nodes (`source.arch`), so the daemon uploaded is `computerd-linux-amd64`; smol cloud
|
|
2872
|
+
has arm64 nodes too, unused here.
|
|
2873
|
+
- No mount of the run's folder yet, and no desktop. smol cloud binds each machine's own storage disk at `/workspace`
|
|
2874
|
+
(an ext4 mount of `/dev/vda`), and a synced folder can be held only where nothing is mounted there, so the
|
|
2875
|
+
descriptor says so in `unmounted.sync` and serve's Mode 2 refuses a smol cloud sandbox in those words. An Archil
|
|
2876
|
+
mount is untried (`/dev/fuse` opens in the guest).
|
|
2877
|
+
|
|
2878
|
+
### Conformance on smol cloud
|
|
2879
|
+
|
|
2880
|
+
```sh
|
|
2881
|
+
AGENTRUN_COMPUTER_LIVE_SMOLCLOUD=1 COMPUTER_SMOLCLOUD_API_KEY=... \
|
|
2882
|
+
npm run conformance -w @parcha/agentrun-computer -- --provider smolcloud --long --concurrency 4
|
|
2883
|
+
node packages/computer/dist/conformance/sweep.js --provider smolcloud --before /tmp/smolcloud-before.json # then --after
|
|
2884
|
+
```
|
|
2885
|
+
|
|
2886
|
+
The conformance module, `dist/conformance/smolcloud.js`, checks `AGENTRUN_COMPUTER_LIVE_SMOLCLOUD=1` first, then reads
|
|
2887
|
+
`COMPUTER_SMOLCLOUD_API_KEY` (`apiKey`, required), `COMPUTER_SMOLCLOUD_API_URL` (`apiUrl`) and
|
|
2888
|
+
`COMPUTER_SMOLCLOUD_IMAGE` (the run's image, default the box image), never `SMOLCLOUD_API_KEY`. Every computer of a run
|
|
2889
|
+
lives at most 30 minutes. The live sweep is the shared one; its scope is the key's account.
|
|
2890
|
+
|
|
2891
|
+
### Live runs
|
|
2892
|
+
|
|
2893
|
+
On 2026-11-17, against smol cloud with an account key: the exec pre-check passed every check (8 MiB through `cat` in
|
|
2894
|
+
40 s, the stdin frames one after another; the daemon goes in through `upload` instead). The `--long` run at
|
|
2895
|
+
`--concurrency 4` passed Core 67/67 and Full 9/37 (the rest not declared) in 40 minutes; Full's `lifetime.idle` timed
|
|
2896
|
+
out while the test host lost DNS, and passed when run again on its own. An account without a card runs at most 4
|
|
2897
|
+
machines at once, and a create past that answers `422`, read as `limit`.
|
|
2898
|
+
|
|
2899
|
+
On 2026-11-18, from the box image: the exec pre-check passed every check (8 MiB through `cat` in 33 s), and the
|
|
2900
|
+
`--long` run at `--concurrency 4` passed Core 67/67 and Full 10/41 (the rest not declared, `mount:sync` among them) in
|
|
2901
|
+
18 minutes. An earlier run that day, before the descriptor said `unmounted.sync`, had every `mount.sync` case refused
|
|
2902
|
+
at create: the read back found an ext4 mount of `/dev/vda` at `/workspace`. The sweep after the last run read
|
|
2903
|
+
`{"swept":0,"gone":0,"stillThere":[],"leftAlone":0}`.
|
|
2904
|
+
|
|
2830
2905
|
## Conformance
|
|
2831
2906
|
|
|
2832
2907
|
A provider for another vendor passes the same suite as Docker's, with one command. The suite is data: each case in
|
|
@@ -2869,7 +2944,7 @@ pass, facts: [{ id, value, means }], factsProblem? }`.
|
|
|
2869
2944
|
An id is resolved through the provider registry, and only there; the usage lists every id it holds. A module path is
|
|
2870
2945
|
resolved from the directory npm was run in. It exits 0 when Core passes, 1 when it fails, 2 on a
|
|
2871
2946
|
usage error, and 3 on a partial run; `--json` prints the report object (`{ provider, providerVersion, kind,
|
|
2872
|
-
daemonMode, image, daemons: [{ computer, role, version, os, arch, fence? }], only?, coreNotRun?, results: [{ id, level,
|
|
2947
|
+
daemonMode, image, daemons: [{ computer, role, version, os, arch, fence?, windowManager? }], only?, coreNotRun?, results: [{ id, level,
|
|
2873
2948
|
group, status, reason?, undeclared? }], core, undeclared, cleanup, computers: { peak, cap? }, notes?, computerNotes? }`).
|
|
2874
2949
|
`computers.peak` is the most computers the run had alive at once, each counted from its create's call until its release
|
|
2875
2950
|
(the text report's `computers alive at once: <peak> at most` line). `--concurrency <n>` (`concurrency` in
|
package/dist/attach.d.ts
CHANGED
|
@@ -99,10 +99,17 @@ export interface MachineMint {
|
|
|
99
99
|
* name. Absent for a computer of no run. */
|
|
100
100
|
run?: string;
|
|
101
101
|
}
|
|
102
|
+
/** A machine token's shape, as a RegExp source without anchors or flags: `art_` and 43 base64url characters (32 bytes).
|
|
103
|
+
* computerd takes this alone (daemon/internal/attach/attach.go tokenPattern, the same source anchored); a scrub
|
|
104
|
+
* builds its global RegExp from it. */
|
|
105
|
+
export declare const MACHINE_TOKEN_SOURCE = "art_[A-Za-z0-9_-]{43}";
|
|
106
|
+
/** A new machine token, a paired computer's or a hosted machine's: `art_` and 32 random bytes in base64url
|
|
107
|
+
* (MACHINE_TOKEN_SOURCE). */
|
|
108
|
+
export declare const newMachineToken: () => string;
|
|
102
109
|
/**
|
|
103
110
|
* The tokens of hosted machines that dial (spec/computer/attach.md, Hosted machines that dial), as the server's store
|
|
104
|
-
* keeps them: HostedProvider mints one at each dial create and revokes it at the delete. A token is
|
|
105
|
-
*
|
|
111
|
+
* keeps them: HostedProvider mints one at each dial create and revokes it at the delete. A token is newMachineToken's;
|
|
112
|
+
* the store keeps only its sha256, bound to the machine and its mint, and never logs it. The
|
|
106
113
|
* server's attach upgrade and its daemon route take it while it is neither revoked nor past expiresAt, and hand its
|
|
107
114
|
* socket to the AttachHub as mintedComputer(machine, mint). machine is the computer's name, computer-<12 hex digits>,
|
|
108
115
|
* from its create's request id (computerNameFor): what the provider's connect and release are given.
|
|
@@ -184,10 +191,21 @@ export declare class AttachHub {
|
|
|
184
191
|
/** The deadline of the run that holds the computer, or undefined (no hold, or an agent's). */
|
|
185
192
|
deadline(id: string): Date | undefined;
|
|
186
193
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
194
|
+
* `answer`, a call that changes the computer (a create's files.remove or KILL), kept until it ends: computerd ends
|
|
195
|
+
* what a cancelled call started, so it has ended only when the computer answers it or its connection closes. No hold
|
|
196
|
+
* on the computer ends before that (unclaim).
|
|
189
197
|
*/
|
|
190
|
-
|
|
198
|
+
changing(id: string, answer: Promise<unknown>): void;
|
|
199
|
+
/** Resolves once no call that changes the computer runs (changing), one sent after another's answer too: at once
|
|
200
|
+
* while none does. */
|
|
201
|
+
unchanged(id: string): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Ends the hold named by its token, and closes the connections it was given: at once, or while a call that changes
|
|
204
|
+
* the computer still runs (changing), once it has ended, so no next run is given a computer an earlier call still
|
|
205
|
+
* changes. A token of a hold already ended (a late release, after the deadline gave the computer to another run), or
|
|
206
|
+
* ended by another unclaim while this one waited, ends nothing: false.
|
|
207
|
+
*/
|
|
208
|
+
unclaim(id: string, hold: string): Promise<boolean>;
|
|
191
209
|
/** Ends a computer's attachment: its token was revoked, or the computer was removed. */
|
|
192
210
|
revoke(id: string, why: string): void;
|
|
193
211
|
}
|
package/dist/attach.js
CHANGED
|
@@ -93,6 +93,13 @@ export function socketStreams(socket) {
|
|
|
93
93
|
});
|
|
94
94
|
return { readable, writable };
|
|
95
95
|
}
|
|
96
|
+
/** A machine token's shape, as a RegExp source without anchors or flags: `art_` and 43 base64url characters (32 bytes).
|
|
97
|
+
* computerd takes this alone (daemon/internal/attach/attach.go tokenPattern, the same source anchored); a scrub
|
|
98
|
+
* builds its global RegExp from it. */
|
|
99
|
+
export const MACHINE_TOKEN_SOURCE = "art_[A-Za-z0-9_-]{43}";
|
|
100
|
+
/** A new machine token, a paired computer's or a hosted machine's: `art_` and 32 random bytes in base64url
|
|
101
|
+
* (MACHINE_TOKEN_SOURCE). */
|
|
102
|
+
export const newMachineToken = () => `art_${randomBytes(32).toString("base64url")}`;
|
|
96
103
|
const sha256 = (token) => createHash("sha256").update(token).digest("hex");
|
|
97
104
|
/**
|
|
98
105
|
* MachineTokens in one process's memory, as serve's store keeps them (the sha256 alone): for tests and a conformance
|
|
@@ -104,7 +111,7 @@ export class MemoryMachineTokens {
|
|
|
104
111
|
// No await in either: a mint replaces the machine's token at once, so two of one machine leave one token, not two.
|
|
105
112
|
async mint(machine, mint) {
|
|
106
113
|
this.#drop(machine);
|
|
107
|
-
const token =
|
|
114
|
+
const token = newMachineToken();
|
|
108
115
|
this.#held.set(sha256(token), { machine, mint: { ...mint } });
|
|
109
116
|
this.#hashOf.set(machine, sha256(token));
|
|
110
117
|
return token;
|
|
@@ -197,6 +204,9 @@ export class AttachHub {
|
|
|
197
204
|
#live = new Map();
|
|
198
205
|
/** The run holding each computer: the hold's own token, its labels, and its deadline with the timer that ends it. */
|
|
199
206
|
#claims = new Map();
|
|
207
|
+
/** The call still running on each computer that changes it (changing): no hold on it ends before it has ended. A
|
|
208
|
+
* create sends them one at a time, and none after its abort. */
|
|
209
|
+
#changing = new Map();
|
|
200
210
|
/** The sockets still saying hello, by computer: a revoke closes them too, so none comes back after it. */
|
|
201
211
|
#pending = new Map();
|
|
202
212
|
/** Each computer's connections given out, by the function that closes one. */
|
|
@@ -332,7 +342,7 @@ export class AttachHub {
|
|
|
332
342
|
if (this.#claims.has(id))
|
|
333
343
|
return undefined;
|
|
334
344
|
const hold = randomUUID().replaceAll("-", "").slice(0, 16);
|
|
335
|
-
const timer = deadline === undefined ? undefined : setTimeout(() => this.unclaim(id, hold), Math.max(0, deadline.getTime() - Date.now()));
|
|
345
|
+
const timer = deadline === undefined ? undefined : setTimeout(() => void this.unclaim(id, hold), Math.max(0, deadline.getTime() - Date.now()));
|
|
336
346
|
timer?.unref?.();
|
|
337
347
|
this.#claims.set(id, { hold, labels: { ...labels }, ...(deadline === undefined ? {} : { deadline, timer }) });
|
|
338
348
|
return hold;
|
|
@@ -353,23 +363,49 @@ export class AttachHub {
|
|
|
353
363
|
return this.#claims.get(id)?.deadline;
|
|
354
364
|
}
|
|
355
365
|
/**
|
|
356
|
-
*
|
|
357
|
-
*
|
|
366
|
+
* `answer`, a call that changes the computer (a create's files.remove or KILL), kept until it ends: computerd ends
|
|
367
|
+
* what a cancelled call started, so it has ended only when the computer answers it or its connection closes. No hold
|
|
368
|
+
* on the computer ends before that (unclaim).
|
|
358
369
|
*/
|
|
359
|
-
|
|
370
|
+
changing(id, answer) {
|
|
371
|
+
this.#changing.set(id, answer);
|
|
372
|
+
void answer.finally(() => {
|
|
373
|
+
if (this.#changing.get(id) === answer)
|
|
374
|
+
this.#changing.delete(id);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** Resolves once no call that changes the computer runs (changing), one sent after another's answer too: at once
|
|
378
|
+
* while none does. */
|
|
379
|
+
async unchanged(id) {
|
|
380
|
+
for (let running = this.#changing.get(id); running !== undefined; running = this.#changing.get(id))
|
|
381
|
+
await Promise.allSettled([running]);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Ends the hold named by its token, and closes the connections it was given: at once, or while a call that changes
|
|
385
|
+
* the computer still runs (changing), once it has ended, so no next run is given a computer an earlier call still
|
|
386
|
+
* changes. A token of a hold already ended (a late release, after the deadline gave the computer to another run), or
|
|
387
|
+
* ended by another unclaim while this one waited, ends nothing: false.
|
|
388
|
+
*/
|
|
389
|
+
async unclaim(id, hold) {
|
|
360
390
|
const held = this.#claims.get(id);
|
|
361
391
|
if (held === undefined || held.hold !== hold)
|
|
362
392
|
return false;
|
|
393
|
+
// Checked again after each wait: a create still running sends its next remove once the last one answers.
|
|
394
|
+
while (this.#changing.has(id)) {
|
|
395
|
+
await this.unchanged(id);
|
|
396
|
+
if (this.#claims.get(id) !== held)
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
363
399
|
clearTimeout(held.timer);
|
|
364
400
|
this.#claims.delete(id);
|
|
365
401
|
this.#closeGiven(id);
|
|
366
402
|
return true;
|
|
367
403
|
}
|
|
368
|
-
/** A hold past its deadline ends at once, whether or not its timer has run yet. */
|
|
404
|
+
/** A hold past its deadline ends at once, whether or not its timer has run yet (once its changing calls end). */
|
|
369
405
|
#expire(id) {
|
|
370
406
|
const held = this.#claims.get(id);
|
|
371
407
|
if (held?.deadline !== undefined && held.deadline.getTime() <= Date.now())
|
|
372
|
-
this.unclaim(id, held.hold);
|
|
408
|
+
void this.unclaim(id, held.hold);
|
|
373
409
|
}
|
|
374
410
|
/** Ends a computer's attachment: its token was revoked, or the computer was removed. */
|
|
375
411
|
revoke(id, why) {
|
|
@@ -416,11 +452,31 @@ async function pairedWorkspaceWhy(client, name, signal) {
|
|
|
416
452
|
return ok(`${WORKSPACE} on ${name} is open to its group or others (mode ${(mode & 0o7777).toString(8).padStart(4, "0")}): ${WORKSPACE_FIX}`);
|
|
417
453
|
return ok(undefined);
|
|
418
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* A call that changes the box (files.remove, process.signal), sent with no abort of its own: computerd still ends what a
|
|
457
|
+
* cancelled call started, so the call has ended only when the box answers it or its connection closes. Its answer goes
|
|
458
|
+
* to `changing` (AttachHub.changing), which keeps the box's hold until then. The caller's own wait still ends at
|
|
459
|
+
* `signal`, and none is sent once that has aborted.
|
|
460
|
+
*/
|
|
461
|
+
function changeBox(client, changing, method, params, signal) {
|
|
462
|
+
if (signal?.aborted)
|
|
463
|
+
return Promise.resolve(fail("aborted", `${method} was aborted before it was sent`));
|
|
464
|
+
const answer = client.call(method, params);
|
|
465
|
+
changing(answer);
|
|
466
|
+
if (signal === undefined)
|
|
467
|
+
return answer;
|
|
468
|
+
const aborted = new Promise((resolve) => {
|
|
469
|
+
const onAbort = () => resolve(fail("aborted", `${method} was aborted`));
|
|
470
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
471
|
+
void answer.finally(() => signal.removeEventListener("abort", onAbort));
|
|
472
|
+
});
|
|
473
|
+
return Promise.race([answer, aborted]);
|
|
474
|
+
}
|
|
419
475
|
/** Every program computerd still runs on `name` ended, waited for up to 5 s each: the box outlives its runs, and one
|
|
420
476
|
* run holds it at a time, so a program running at a claim is an earlier run's (a background program left when its hold
|
|
421
477
|
* ended at its deadline, or its runner was lost), which could read or write the next run's folder. KILL goes to its
|
|
422
|
-
* process group; init kills what left that group once its guard is gone. */
|
|
423
|
-
async function endPrograms(client, name, signal) {
|
|
478
|
+
* process group; init kills what left that group once its guard is gone. Each KILL goes to `changing` (changeBox). */
|
|
479
|
+
async function endPrograms(client, name, changing, signal) {
|
|
424
480
|
const options = signal ? { signal } : {};
|
|
425
481
|
const words = (message) => `ending an earlier run's programs on ${name}: ${message}`;
|
|
426
482
|
for (let from = 0;;) {
|
|
@@ -428,7 +484,7 @@ async function endPrograms(client, name, signal) {
|
|
|
428
484
|
if (!listed.ok)
|
|
429
485
|
return fail(listed.error.code, words(listed.error.message));
|
|
430
486
|
for (const program of listed.value.processes.filter((one) => one.running)) {
|
|
431
|
-
const killed = await client
|
|
487
|
+
const killed = await changeBox(client, changing, "process.signal", { id: program.id, signal: "KILL" }, signal);
|
|
432
488
|
if (!killed.ok && killed.error.code !== "not_found")
|
|
433
489
|
return fail(killed.error.code, words(killed.error.message));
|
|
434
490
|
const waited = await client.call("process.wait", { id: program.id, timeoutMs: 5_000 }, options);
|
|
@@ -443,8 +499,9 @@ async function endPrograms(client, name, signal) {
|
|
|
443
499
|
/** Everything in `name`'s /workspace removed, the folder itself kept (only root makes one): each entry of its first
|
|
444
500
|
* level, a directory with what it holds, a link removed and never followed (files.remove). An entry a remove can't
|
|
445
501
|
* find (a name that is not UTF-8 reaches the wire changed) is left: a whole listing with one left, or a truncated one
|
|
446
|
-
* that a pass removes nothing of, refuses the box in words naming what was left.
|
|
447
|
-
|
|
502
|
+
* that a pass removes nothing of, refuses the box in words naming what was left. Each remove goes to `changing`
|
|
503
|
+
* (changeBox): a cancelled one's RemoveAll still deletes on the box. */
|
|
504
|
+
async function emptyWorkspace(client, name, changing, signal) {
|
|
448
505
|
const options = signal ? { signal } : {};
|
|
449
506
|
const words = (message) => `emptying ${WORKSPACE} on ${name} of an earlier run's folder: ${message}`;
|
|
450
507
|
for (;;) {
|
|
@@ -453,7 +510,7 @@ async function emptyWorkspace(client, name, signal) {
|
|
|
453
510
|
return fail(listed.error.code, words(listed.error.message));
|
|
454
511
|
const left = [];
|
|
455
512
|
for (const entry of listed.value.entries) {
|
|
456
|
-
const removed = await client
|
|
513
|
+
const removed = await changeBox(client, changing, "files.remove", { path: entry.path, recursive: true }, signal);
|
|
457
514
|
if (removed.ok)
|
|
458
515
|
continue;
|
|
459
516
|
if (removed.error.code !== "not_found")
|
|
@@ -531,11 +588,13 @@ export function attachedProvider(paired, hub) {
|
|
|
531
588
|
/** The synced folder read back from inside the box: its /workspace as pairedWorkspaceWhy holds it, else in words.
|
|
532
589
|
* `fresh`: what an earlier run left is ended and removed first, its programs (endPrograms) and then each entry of the
|
|
533
590
|
* folder (a link removed and never followed), so the run's push goes into an empty folder no other run's program
|
|
534
|
-
* reaches, as into a hosted computer's new one.
|
|
591
|
+
* reaches, as into a hosted computer's new one. Each of those calls that changes the box is the hub's (changing)
|
|
592
|
+
* until it has ended, and the connection is closed only then, as a close would drop their answers. */
|
|
535
593
|
const folder = async (signal, fresh = false) => {
|
|
536
594
|
const connection = hub.connection(paired.id);
|
|
537
595
|
if (connection === undefined)
|
|
538
596
|
return offline();
|
|
597
|
+
const changing = (answer) => hub.changing(paired.id, answer);
|
|
539
598
|
try {
|
|
540
599
|
const why = await pairedWorkspaceWhy(connection.client, paired.name, signal);
|
|
541
600
|
if (!why.ok)
|
|
@@ -543,17 +602,17 @@ export function attachedProvider(paired, hub) {
|
|
|
543
602
|
if (why.value !== undefined)
|
|
544
603
|
return ok({ other: why.value });
|
|
545
604
|
if (fresh) {
|
|
546
|
-
const stopped = await endPrograms(connection.client, paired.name, signal);
|
|
605
|
+
const stopped = await endPrograms(connection.client, paired.name, changing, signal);
|
|
547
606
|
if (!stopped.ok)
|
|
548
607
|
return stopped;
|
|
549
|
-
const emptied = await emptyWorkspace(connection.client, paired.name, signal);
|
|
608
|
+
const emptied = await emptyWorkspace(connection.client, paired.name, changing, signal);
|
|
550
609
|
if (!emptied.ok)
|
|
551
610
|
return emptied;
|
|
552
611
|
}
|
|
553
612
|
return ok(recorded());
|
|
554
613
|
}
|
|
555
614
|
finally {
|
|
556
|
-
|
|
615
|
+
void hub.unchanged(paired.id).then(() => connection.close());
|
|
557
616
|
}
|
|
558
617
|
};
|
|
559
618
|
return {
|
|
@@ -612,7 +671,10 @@ export function attachedProvider(paired, hub) {
|
|
|
612
671
|
const answer = (async () => {
|
|
613
672
|
const read = await folder(context.signal, true);
|
|
614
673
|
if (!read.ok || "other" in read.value) {
|
|
615
|
-
|
|
674
|
+
// A cancelled create answers at once, but the box may still run a remove or KILL it stopped waiting for: the
|
|
675
|
+
// hold is let go once each has answered or its connection closed (unclaim), so no next run's folder lands
|
|
676
|
+
// under it.
|
|
677
|
+
void hub.unclaim(paired.id, hold);
|
|
616
678
|
return read.ok ? fail("refused", read.value.other) : read;
|
|
617
679
|
}
|
|
618
680
|
syncedHold = hold;
|
|
@@ -672,8 +734,9 @@ export function attachedProvider(paired, hub) {
|
|
|
672
734
|
return fail("unsupported", `${paired.name} is a person's own machine: a run releases its hold, and never stops it`);
|
|
673
735
|
if (which.hold === undefined)
|
|
674
736
|
return fail("invalid", `release names the run's hold on ${paired.name}, the ref create gave (${paired.id}.<hold>), never the computer itself`);
|
|
675
|
-
// A hold already ended is released already: the hold on the computer now, if any, is another run's and stays.
|
|
676
|
-
|
|
737
|
+
// A hold already ended is released already: the hold on the computer now, if any, is another run's and stays. A
|
|
738
|
+
// release while a create's remove or KILL still runs on the box answers once the hold has ended, after it.
|
|
739
|
+
await hub.unclaim(paired.id, which.hold);
|
|
677
740
|
return ok(undefined);
|
|
678
741
|
},
|
|
679
742
|
};
|
|
Binary file
|
|
Binary file
|
package/dist/computerd.json
CHANGED
|
@@ -22,6 +22,7 @@ import { create, workspaceOf } from "../agent37.js";
|
|
|
22
22
|
import { AGENT37_BASE_TEMPLATE } from "../descriptors/agent37.js";
|
|
23
23
|
import { archilRunFolder, archilSettings } from "./archil.js";
|
|
24
24
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
25
|
+
import { kindFrom } from "./kind.js";
|
|
25
26
|
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
26
27
|
export { ARCHIL_ENV } from "./archil.js";
|
|
27
28
|
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's template. */
|
|
@@ -69,14 +70,13 @@ export function settingsFromEnv(env = process.env) {
|
|
|
69
70
|
const apiUrl = env[AGENT37_ENV.apiUrl] || undefined;
|
|
70
71
|
const daemonPath = env[AGENT37_ENV.daemon] || undefined;
|
|
71
72
|
const daemonUser = env[AGENT37_ENV.user] || undefined;
|
|
72
|
-
const kind = env[AGENT37_ENV.kind] || undefined;
|
|
73
73
|
return {
|
|
74
74
|
apiKey,
|
|
75
75
|
sshKey,
|
|
76
76
|
// create() refuses any other type or region in words.
|
|
77
77
|
...(type === undefined ? {} : { type: type }),
|
|
78
78
|
...(region === undefined ? {} : { region: region }),
|
|
79
|
-
...(
|
|
79
|
+
...kindFrom(env, AGENT37_ENV.kind),
|
|
80
80
|
...(apiUrl === undefined ? {} : { apiUrl }),
|
|
81
81
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
82
82
|
...(lifetime === undefined ? {} : { maxLifetimeMs: Number(lifetime) }),
|
package/dist/conformance/boxd.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createHash } from "node:crypto";
|
|
|
13
13
|
import { BOXD_DEFAULT_IMAGE } from "../descriptors/boxd.js";
|
|
14
14
|
import { create } from "../boxd.js";
|
|
15
15
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
16
|
+
import { kindFrom } from "./kind.js";
|
|
16
17
|
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
|
|
17
18
|
export const BOXD_ENV = {
|
|
18
19
|
live: "AGENTRUN_COMPUTER_LIVE_BOXD",
|
|
@@ -44,15 +45,13 @@ export function settingsFromEnv(env = process.env) {
|
|
|
44
45
|
const org = env[BOXD_ENV.org] || undefined;
|
|
45
46
|
const region = env[BOXD_ENV.region] || undefined;
|
|
46
47
|
const daemonPath = env[BOXD_ENV.daemon] || undefined;
|
|
47
|
-
const kind = env[BOXD_ENV.kind] || undefined;
|
|
48
48
|
const daemonUser = env[BOXD_ENV.user] || undefined;
|
|
49
49
|
return {
|
|
50
50
|
apiKey,
|
|
51
51
|
...(org === undefined ? {} : { org }),
|
|
52
52
|
...(region === undefined ? {} : { region }),
|
|
53
53
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
54
|
-
|
|
55
|
-
...(kind === undefined ? {} : { kind: kind }),
|
|
54
|
+
...kindFrom(env, BOXD_ENV.kind),
|
|
56
55
|
...(daemonUser === undefined ? {} : { daemonUser }),
|
|
57
56
|
};
|
|
58
57
|
}
|
package/dist/conformance/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { resolve } from "node:path";
|
|
|
10
10
|
import { pathToFileURL } from "node:url";
|
|
11
11
|
import { isCommand } from "../entry.js";
|
|
12
12
|
import { descriptorOf, isProviderId, providerIds, providerModule } from "../providers.js";
|
|
13
|
-
import { SETTING_KIND_NAMES } from "../kinds.js";
|
|
13
|
+
import { SETTING_KIND_NAMES } from "../setting-kinds.js";
|
|
14
14
|
import { browserCases, casesFor, conformanceCases } from "./cases/index.js";
|
|
15
15
|
import { checkExecStream, DEFAULT_LONG_MS, formatExecStream, QUICK_LONG_MS } from "./exec-stream.js";
|
|
16
16
|
import { kindRunProblem } from "./kind.js";
|
|
@@ -8,6 +8,8 @@ export declare const ENV: {
|
|
|
8
8
|
readonly url: "COMPUTER_CLOUDFLARE_RELAY_URL";
|
|
9
9
|
/** relayToken, required: the relay's RELAY_TOKEN. */
|
|
10
10
|
readonly token: "COMPUTER_CLOUDFLARE_RELAY_TOKEN";
|
|
11
|
+
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
12
|
+
readonly kind: "COMPUTER_CLOUDFLARE_KIND";
|
|
11
13
|
};
|
|
12
14
|
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each container by then. */
|
|
13
15
|
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
@@ -7,12 +7,15 @@
|
|
|
7
7
|
// as its option. The live sweep (sweep.ts, --provider cloudflare) reads the same names through createHost.
|
|
8
8
|
import { create } from "../cloudflare.js";
|
|
9
9
|
import { dialOnlyFromServer } from "./dial-only.js";
|
|
10
|
+
import { kindFrom } from "./kind.js";
|
|
10
11
|
/** The environment this module reads, by name, each for the option its comment names. */
|
|
11
12
|
export const ENV = {
|
|
12
13
|
/** relayUrl, required: the relay Worker's https address. */
|
|
13
14
|
url: "COMPUTER_CLOUDFLARE_RELAY_URL",
|
|
14
15
|
/** relayToken, required: the relay's RELAY_TOKEN. */
|
|
15
16
|
token: "COMPUTER_CLOUDFLARE_RELAY_TOKEN",
|
|
17
|
+
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
18
|
+
kind: "COMPUTER_CLOUDFLARE_KIND",
|
|
16
19
|
};
|
|
17
20
|
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each container by then. */
|
|
18
21
|
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
@@ -28,6 +31,7 @@ export function settingsFromEnv(env = process.env) {
|
|
|
28
31
|
export function createProvider({ env = process.env, dial, daemonPath, fetch, onNote } = {}) {
|
|
29
32
|
return create({
|
|
30
33
|
...settingsFromEnv(env),
|
|
34
|
+
...kindFrom(env, ENV.kind),
|
|
31
35
|
...(dial ? { dial } : {}),
|
|
32
36
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
33
37
|
...(fetch ? { fetch } : {}),
|
|
@@ -32,6 +32,8 @@ export declare const DAYTONA_ENV: {
|
|
|
32
32
|
readonly archilEgress: "COMPUTER_DAYTONA_ARCHIL_EGRESS";
|
|
33
33
|
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
34
34
|
readonly connect: "COMPUTER_DAYTONA_CONNECT";
|
|
35
|
+
/** kind: linux (default) or desktop, which create() takes on dial alone. */
|
|
36
|
+
readonly kind: "COMPUTER_DAYTONA_KIND";
|
|
35
37
|
};
|
|
36
38
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
37
39
|
export declare const ENV: {
|
|
@@ -60,6 +62,8 @@ export declare const ENV: {
|
|
|
60
62
|
readonly archilEgress: "COMPUTER_DAYTONA_ARCHIL_EGRESS";
|
|
61
63
|
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
62
64
|
readonly connect: "COMPUTER_DAYTONA_CONNECT";
|
|
65
|
+
/** kind: linux (default) or desktop, which create() takes on dial alone. */
|
|
66
|
+
readonly kind: "COMPUTER_DAYTONA_KIND";
|
|
63
67
|
};
|
|
64
68
|
/**
|
|
65
69
|
* The provider's options this module reads from env, each only when its name is set; throws in words without the key,
|