@parcha/agentrun-computer 0.1.0-beta.67 → 0.1.0-beta.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +189 -7
  2. package/box/install.sh +22 -6
  3. package/dist/computerd-linux-amd64 +0 -0
  4. package/dist/computerd-linux-arm64 +0 -0
  5. package/dist/computerd.json +1 -1
  6. package/dist/conformance/instabox.d.ts +36 -0
  7. package/dist/conformance/instabox.js +43 -0
  8. package/dist/conformance/sprites.d.ts +32 -0
  9. package/dist/conformance/sprites.js +40 -0
  10. package/dist/conformance/vercel.d.ts +35 -0
  11. package/dist/conformance/vercel.js +43 -0
  12. package/dist/descriptors/e2b.d.ts +13 -0
  13. package/dist/descriptors/e2b.js +18 -3
  14. package/dist/descriptors/index.d.ts +73 -1
  15. package/dist/descriptors/index.js +7 -2
  16. package/dist/descriptors/instabox.d.ts +19 -0
  17. package/dist/descriptors/instabox.js +20 -0
  18. package/dist/descriptors/sprites.d.ts +19 -0
  19. package/dist/descriptors/sprites.js +19 -0
  20. package/dist/descriptors/vercel.d.ts +23 -0
  21. package/dist/descriptors/vercel.js +24 -0
  22. package/dist/docker/egress-main.js +17 -10
  23. package/dist/docker/egress-proxy.d.ts +7 -0
  24. package/dist/docker/egress-proxy.js +12 -0
  25. package/dist/docker/egress.d.ts +3 -1
  26. package/dist/docker/egress.js +11 -4
  27. package/dist/docker/image.d.ts +8 -2
  28. package/dist/docker/image.js +24 -3
  29. package/dist/docker.d.ts +6 -0
  30. package/dist/docker.js +15 -5
  31. package/dist/e2b.d.ts +25 -10
  32. package/dist/e2b.js +36 -16
  33. package/dist/hosted/provider.js +14 -8
  34. package/dist/hosted/rest.js +23 -1
  35. package/dist/hosted/ssh-exec.d.ts +17 -2
  36. package/dist/hosted/ssh-exec.js +17 -6
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.js +2 -1
  39. package/dist/instabox.d.ts +30 -0
  40. package/dist/instabox.js +424 -0
  41. package/dist/render.js +4 -3
  42. package/dist/sprites.d.ts +37 -0
  43. package/dist/sprites.js +309 -0
  44. package/dist/vercel.d.ts +26 -0
  45. package/dist/vercel.js +262 -0
  46. package/package.json +17 -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`, `/smolcloud`, `/groundbox`). A provider's
19
+ `/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`, `/smolcloud`, `/groundbox`, `/vercel`, `/sprites`, `/instabox`). 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
@@ -446,6 +446,7 @@ in the kernel's tool registry, keyed by these groups.
446
446
  | modal | none: `prepareImage()` answers the box image (`boxImageRef()`) |
447
447
  | e2b | none: `prepareImage()` answers the box template (`boxE2bTemplate()`), for a sandbox and a desktop alike |
448
448
  | smolcloud | none: `prepareImage()` answers the box image (`boxImageRef()`) |
449
+ | vercel | none: `prepareImage()` answers the box image's tag in the project's registry (`boxVercelImage()`) |
449
450
  | orgo | desktop: `ORGO_BASE_IMAGE` ("linux") |
450
451
  | phone-harness | phone: `PHONE_IMAGE` ("android") |
451
452
  | browserbase, kernel, local | browser: `BROWSER_IMAGE` ("chromium") |
@@ -455,7 +456,7 @@ in the kernel's tool registry, keyed by these groups.
455
456
  | docker | Docker | sandbox, desktop | none | bind | no |
456
457
  | daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET`, `DAYTONA_ARCHIL_EGRESS`, `DAYTONA_ATTACH_EGRESS`, `DAYTONA_LISTED_MS` (optional) | none (`unmounted`: archil); archil with `DAYTONA_ARCHIL_EGRESS` (`mountsWith`) | yes |
457
458
  | modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
458
- | e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
459
+ | e2b | E2B | sandbox, desktop | `E2B_API_KEY`; `AGENTRUN_E2B_DOMAIN`, `AGENTRUN_E2B_API_URL`, `AGENTRUN_E2B_TEMPLATE` (optional) | archil | yes |
459
460
  | orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
460
461
  | phone-harness | Phone harness | phone | `PHONE_HARNESS_API_KEY` | none | yes |
461
462
  | browserbase | Browserbase | browser | `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID` | none | yes |
@@ -680,11 +681,16 @@ live under:
680
681
  | `AGENTRUN_BOX_APP` | Modal's `app` (serve's default, `agentrun`, when unset) |
681
682
  | `AGENTRUN_DOCKER_IMAGE` | Docker's `image` option, `{ image: <name> }` (unset: the provider's own recipe); `docker.image()` makes it ready and gives the tag a computer's spec names |
682
683
  | `E2B_API_KEY` | E2B's `apiKey`: serve's new name for the E2B box |
684
+ | `AGENTRUN_E2B_DOMAIN`, `AGENTRUN_E2B_API_URL` | E2B's `domain` and `apiUrl` (unset: `e2b.app`, and `https://api.<domain>`) |
685
+ | `AGENTRUN_E2B_TEMPLATE` | E2B's `template`, which its `prepareImage()` answers (unset: the box template); E2B's `imageEnv` too |
683
686
  | `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID` | Browserbase's `apiKey`, `projectId`: the names pi-browser reads today |
684
687
  | `KERNEL_API_KEY` | Kernel's `apiKey`: the name pi-browser reads today |
685
688
  | `BOXD_API_KEY`, `BOXD_ORG`, `BOXD_REGION` | boxd's `apiKey`, `org` and `region` (unset: the key's own org, the API's home region) |
686
689
  | `SMOLCLOUD_API_KEY` | smol cloud's `apiKey` |
687
690
  | `GROUNDBOX_API_KEY` | Groundbox's `apiKey` |
691
+ | `VERCEL_TOKEN`, `VERCEL_TEAM_ID`, `VERCEL_PROJECT_ID` | Vercel Sandbox's `token`, `teamId` and `projectId`, all required |
692
+ | `SPRITES_TOKEN` | Fly Sprites' `token`: the name Fly's own CLI reads |
693
+ | `INSTABOX_API_KEY` | InstaBox's `apiKey`: the name InstaBox's own CLI and SDK read |
688
694
 
689
695
  - **the conformance CLI and the live harness** (`src/conformance/`: the CLI, each provider's conformance module and the
690
696
  sweeps) read their own `COMPUTER_<ID>_*` names, the ones the live scripts set, through each module's
@@ -853,7 +859,7 @@ key.
853
859
  package's own build, bound read-only with its `package.json`. It is on the provider's egress bridge alone (below),
854
860
  publishes no port, and runs as the computer's uid:gid with a read-only root, `--cap-drop ALL`, `no-new-privileges`, 256 MiB, 64
855
861
  pids, half a CPU (a fixed quota, not the computer's own cpus), 1024 open files and a bounded log. Its argv holds the list (or `--open public`), the computer's deadline (it ends itself then), this machine's own
856
- public addresses (refused as `this-host`), and `egress.hint`, the words a refusal adds (printable ASCII).
862
+ public addresses (refused as `this-host`), `egress.hint`, the words a refusal adds (printable ASCII), and `--max-tunnels` when `egress.maxTunnels` is set.
857
863
  `EGRESS_IMAGE` is the one place its digest is written. `create` pulls it at the first allow computer when the host
858
864
  lacks it (see Lifetime), so a host with no registry access pulls it ahead, reading the name from this package:
859
865
  `docker pull "$(node --input-type=module -e 'import { EGRESS_IMAGE } from "@parcha/agentrun-computer"; console.log(EGRESS_IMAGE)')"`
@@ -890,7 +896,9 @@ key.
890
896
  leaves the host; an IP literal outside a listed CIDR of its own family; any port but 80 and 443; a listed name or
891
897
  address that is private, loopback, link-local, metadata, multicast or reserved, in any form it is written (decimal,
892
898
  octal, hex, IPv4-mapped, NAT64, 6to4), or one of this machine's own; a Host header that names another host than the
893
- URI; SOCKS5 BIND and UDP ASSOCIATE; an HTTP upgrade; past 64 connections open at once or 20,000 in all. A name is
899
+ URI; SOCKS5 BIND and UDP ASSOCIATE; an HTTP upgrade; past its cap of connections open at once (64 unless
900
+ `egress.maxTunnels` sets a whole number from 1 to 256: the proxy's 1024 open files hold two per connection; anything
901
+ else is refused when the provider is made) or 20,000 in all; past the cap a new one is answered 429. A name is
894
902
  resolved once, every answer is checked, and the checked address is the one dialled, so rebinding a name between the
895
903
  check and the dial reaches nothing new; a redirect reaches the client as sent and is never followed. A log line holds
896
904
  the host, port, address and class, never a path, query or header. A refusal reads `403 <host> is not on this box's
@@ -918,7 +926,8 @@ key.
918
926
  deadline, runs while the computer runs, is hardened and bounded as above (its memory and swap, pids limit, private
919
927
  IPC and cgroup namespaces, and json-file log of 1m and 2 files included) with exactly its volume and code, and whose
920
928
  argv holds the list (or `--open public`) and refuses every one of the Docker host's own addresses the provider
921
- requires now (more is fine). Anything less is `{ other: "network allow, but its egress proxy ... <why>" }` (or
929
+ requires now (more is fine), and whose `--max-tunnels`, if any, is a cap create gives (1 to 256), whatever the cap is
930
+ set to now, so a changed setting leaves running proxies as they are. Anything less is `{ other: "network allow, but its egress proxy ... <why>" }` (or
922
931
  `network open, ...`). **A crashed proxy** is not
923
932
  restarted: the computer then reaches nothing, its network reads back `other` ("is not running"), and `attach` refuses
924
933
  it, so a caller makes a new computer. `list` reads every listed computer's proxy in one more inspect.
@@ -1068,7 +1077,9 @@ const made = await docker.create({ image: image.value, lifetimeMs: 600_000, netw
1068
1077
  built.
1069
1078
  - `DockerProvider`'s `image` option is that source; the default is `{ recipe: DOCKER_RECIPE }`, the provider's own
1070
1079
  image (`DEFAULT_DOCKER_IMAGE`): `python:3.12-slim` pinned by its index digest (`DOCKER_BASE`), with git, curl,
1071
- nodejs, npm, ripgrep and socat from apt. `docker.image({ signal?, timeoutMs?, onWait? })` is `ensureImage` of it with the
1080
+ xz-utils, ripgrep and socat from apt, and Node.js with its npm in `/usr/local` from the release's own tarball
1081
+ (`DOCKER_NODE_VERSION`, checked against `DOCKER_NODE_SHA256` for the host's architecture before it is unpacked), the
1082
+ release the box image and serve's own image run. `docker.image({ signal?, timeoutMs?, onWait? })` is `ensureImage` of it with the
1072
1083
  provider's docker CLI. A source that is neither throws at construction, in words.
1073
1084
  - **The docker CLI gets only what it reads.** The provider reads no environment: its `env` option is the host's (serve
1074
1085
  passes its own values of the docker descriptor's `hostEnv`), and every docker call it makes (`dockerArch`,
@@ -1972,13 +1983,47 @@ option, never the key. It reads no setting from the environment (see [Settings](
1972
1983
  `E2B_API_KEY`, and the conformance module the `COMPUTER_E2B_API_KEY` it reads, never `E2B_API_KEY`, whose value may be
1973
1984
  another team's on a shared host. The SDK reads `E2B_API_KEY`, `E2B_DOMAIN`, `E2B_API_URL` and `E2B_DEBUG` from
1974
1985
  `process.env` whenever it is not given them (`index.mjs:1140-1152`, `1177-1191`), so every call is given the key, the
1975
- domain (`options.domain`, default `e2b.app`), the API URL `https://api.<domain>` and `debug: false` explicitly: with
1986
+ domain (`options.domain`, default `e2b.app`), the API URL (`options.apiUrl`, default `https://api.<domain>`) and
1987
+ `debug: false` explicitly: with
1976
1988
  debug on, the SDK fakes a create and skips a kill (`index.mjs:5402`, `6021-6024`). The SDK also takes
1977
1989
  `E2B_SANDBOX_URL` when it is given no sandbox URL, and no option clears it (`index.mjs:1152`, `1183-1185`): it would
1978
1990
  send every call into a sandbox, the upload and the bridge with it, there. So the provider refuses to start while it is
1979
1991
  set in `process.env`: a read, and the library's one touch of E2B's environment. A unit test hands the provider's options
1980
1992
  to the real SDK's `ConnectionConfig` with all four ambient variables set, and reads back the provider's own.
1981
1993
 
1994
+ Every call is also given `httpVersion: "1.1"`, which wins over `E2B_HTTP_VERSION`: the SDK's undici client opens
1995
+ HTTP/2 otherwise, and when an idle HTTP/2 session times out it throws on a stream with no `error` listener, which ends
1996
+ the whole process. A unit test points the real SDK, given the provider's options, at a local server that prefers HTTP/2
1997
+ and reads HTTP/1.1 arriving.
1998
+
1999
+ ### Other clouds, and the operator's template
2000
+
2001
+ Three options, each filled by serve's setting of the same row (optional keys of E2B's descriptor, none a secret), point
2002
+ the provider at a cloud that speaks E2B's API, with the stock SDK, or at a template of the operator's own:
2003
+
2004
+ | option | serve's setting | what it is | unset |
2005
+ | --- | --- | --- | --- |
2006
+ | `domain` | `AGENTRUN_E2B_DOMAIN` | the cloud's domain: each sandbox's envd is under it, and so is the API unless `apiUrl` names another | `e2b.app` |
2007
+ | `apiUrl` | `AGENTRUN_E2B_API_URL` | the API's URL, for a cloud whose API is not `https://api.<domain>`: https, with no login, query or fragment, since the key goes to it; another is refused, naming the setting, before any call | `https://api.<domain>` |
2008
+ | `template` | `AGENTRUN_E2B_TEMPLATE` | the template `prepareImage()` answers, so every computer, sandbox or desktop, starts from it; E2B's descriptor names it as its `imageEnv` too, so serve takes an agent's `computer.image` that names it | the box template |
2009
+
2010
+ `apiKey` stays `E2B_API_KEY`, the key of whichever cloud the domain names. The SDK sends every call through one proxy,
2011
+ so it is given the process's proxy unless `NO_PROXY` exempts the whole domain and a given API URL's host too. The box
2012
+ template is public on E2B's own cloud alone; on another, a template of `box/Dockerfile` built on that cloud, named in
2013
+ `AGENTRUN_E2B_TEMPLATE`, is the one with Archil's client, which a Mode 2 folder mounts.
2014
+
2015
+ The clouds whose docs say they speak E2B's API, and what each needs. None of them is run live yet:
2016
+
2017
+ | cloud | settings | status |
2018
+ | --- | --- | --- |
2019
+ | Maritime | `AGENTRUN_E2B_DOMAIN=sb.mtm.sh` | not yet run live |
2020
+ | Orble | `AGENTRUN_E2B_DOMAIN=orble.tech`; it can't build templates, so `AGENTRUN_E2B_TEMPLATE` names one it has | not yet run live |
2021
+ | SUFY | `AGENTRUN_E2B_API_URL=https://us-south-1-sandbox.sufyapi.com` | not yet run live |
2022
+ | Alibaba Cloud Agent Sandbox | `AGENTRUN_E2B_DOMAIN=<region>.sandbox.aliyuncs.com` and `AGENTRUN_E2B_API_URL`, the API URL its docs give for the region | not yet run live |
2023
+ | PPIO | `AGENTRUN_E2B_DOMAIN=sandbox.ppio.cn`; its docs set `E2B_VALIDATE_API_KEY=false`, which e2b@2.63.0 never reads (it checks no key's form) | not yet run live |
2024
+ | UCloud | `AGENTRUN_E2B_DOMAIN=cn-wlcb.sandbox.ucloudai.com` | not yet run live |
2025
+ | Tencent Cloud Agent Runtime | `AGENTRUN_E2B_DOMAIN`, the endpoint its docs give | not yet run live |
2026
+
1982
2027
  ### How the daemon gets in, and how it is reached
1983
2028
 
1984
2029
  E2B's envd is the sandbox's first process, a systemd service with `Restart=always` (e2b-dev/infra
@@ -3278,6 +3323,143 @@ minutes, past the hour any one connection may last: Groundbox closed its socket
3278
3323
  host attached again each time, the command's 1950 lines came back once each and in order, and a write made after the
3279
3324
  hour reached it. A command read across sockets dropped mid-output (close code 4000) also came back whole.
3280
3325
 
3326
+ ## Vercel Sandbox
3327
+
3328
+ ```ts
3329
+ import { providerFor } from "@parcha/agentrun-computer";
3330
+
3331
+ // The token is the caller's to pass (serve's VERCEL_TOKEN); the team and project ids are not secrets.
3332
+ const vercel = await providerFor("vercel", { token, teamId: "team_abc123", projectId: "prj_abc123" });
3333
+ const made = await vercel.create({ lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
3334
+ ```
3335
+
3336
+ A Vercel Sandbox computer is kind `linux`, a [Vercel Sandbox](https://vercel.com/docs/sandbox): a Firecracker microVM
3337
+ with its own kernel, root through `sudo`. With no image named, it starts from the box image as the project's Vercel
3338
+ Container Registry holds it, `agentrun-box:<recipe hash>`, the tag `prepareImage()` answers (`boxVercelImage()`). The
3339
+ operator pushes it once, from `box/`: `vercel vcr build docker . agentrun-box:<hash> --push`. A project without it
3340
+ refuses the create in words that give that command. Vercel runs on the shared machine-host adapter
3341
+ ([PROVIDERS.md](PROVIDERS.md)): `src/vercel.ts` is its `MachineHost`, over Vercel's REST API (`https://api.vercel.com`,
3342
+ `Authorization: Bearer <token>`, `?teamId=` on every call) with `fetch` and the shared REST client (no SDK).
3343
+
3344
+ | MachineHost | Vercel Sandbox |
3345
+ | --- | --- |
3346
+ | `create` | `POST /v3/sandboxes` named with the computer's name, the image, `persistent: false`, the lifetime as the session's `timeout`, `resources.vcpus` (2 unless the spec names a size), the packed labels as `tags`, and `networkPolicy: deny-all` where the computer needs no egress; a 409 is `exists` (unverified until the live run) |
3347
+ | `get` | `GET /v2/sandboxes/{name}?resume=false`, which never wakes one: `pending` is starting, `running` running, `stopping`, `stopped`, `snapshotting`, `failed` and `aborted` gone (with the session's `stopReason` as why); a 404 is none |
3348
+ | `list` | `GET /v2/sandboxes?project=&namePrefix=computer-`, with `tags=k:v` when one label is asked, every page |
3349
+ | `delete` | `DELETE /v2/sandboxes/{name}`; a 404 is done |
3350
+ | `exec` | a detached command (`POST /v2/sandboxes/sessions/{session}/cmd`, `sudo`, argv as its words, stdin attached), through `framedExec`: output from its NDJSON log stream (`GET .../cmd/{id}/logs`), stdin as base64 writes of 512 KiB by offset (`POST .../stdin`, safe to resend), `close` to end it, `POST .../kill` with signal 9 to kill it |
3351
+ | `extend` | `POST /v2/sandboxes/sessions/{session}/extend-timeout` by the difference from the end it reads; never earlier |
3352
+
3353
+ What Vercel refuses or this host works around:
3354
+
3355
+ - Tags are 5 at most, a value 256 characters at most, so the labels are packed into them (`facts.labels.packed`).
3356
+ - The log stream answers from the command's start each time it is read, so a stream that drops while the command runs
3357
+ is read again with the characters already given each stream skipped. A stream can also end before the command's
3358
+ last write, so once the command read finds it exited, the stream is read once more. An `error` line is the
3359
+ command's end in Vercel's words; ten failed reads in a row end it too.
3360
+ - Images come from Vercel Container Registry alone (`check()` refuses another registry's path), as `linux/amd64`
3361
+ builds, and Sandbox never runs an image's `ENTRYPOINT`. A create before the image is ready answers
3362
+ `image_not_ready`, read as `timeout`.
3363
+ - Sizes are 1 or an even 2 to 8 vCPUs, each with 2048 MiB; `check()` refuses any other, and any `memoryMb` but that.
3364
+ - A session lives 24 hours at most on Pro (45 minutes on Hobby); `extend` past the plan's cap is `limit`.
3365
+ - No Archil mount yet and no desktop.
3366
+
3367
+ Unverified until the live run: root makes a network namespace in the microVM (the fence for network none, open and a
3368
+ list); the log stream keeps a character written in two pieces whole and stays open through 75 s of silence; a create
3369
+ whose name the project holds answers 409; a sandbox's end is its session's start plus its timeout; no vendor agent
3370
+ listens on TCP in the VM.
3371
+
3372
+ ### Conformance on Vercel Sandbox
3373
+
3374
+ ```sh
3375
+ export COMPUTER_VERCEL_TOKEN=... COMPUTER_VERCEL_TEAM_ID=team_... COMPUTER_VERCEL_PROJECT_ID=prj_...
3376
+ before="$(mktemp -d)/before.json" # each run its own: --before refuses a file that is already there
3377
+ node packages/computer/dist/conformance/sweep.js --provider vercel --before "$before"
3378
+ AGENTRUN_COMPUTER_LIVE_VERCEL=1 npm run conformance -w @parcha/agentrun-computer -- --provider vercel --long \
3379
+ --run "$(node -p 'require(process.argv[1]).run' "$before")"
3380
+ node packages/computer/dist/conformance/sweep.js --provider vercel --after "$before"
3381
+ ```
3382
+
3383
+ The conformance module, `dist/conformance/vercel.js`, checks `AGENTRUN_COMPUTER_LIVE_VERCEL=1` first, then reads
3384
+ `COMPUTER_VERCEL_TOKEN` (`token`), `COMPUTER_VERCEL_TEAM_ID` (`teamId`) and `COMPUTER_VERCEL_PROJECT_ID`
3385
+ (`projectId`), all required, and `COMPUTER_VERCEL_IMAGE` (the run's image, default the box image), never
3386
+ `VERCEL_TOKEN`. Every computer of a run lives at most 30 minutes. The live sweep is the shared one; its scope is the
3387
+ project of the team. `test/vercel-provider.test.mjs` runs the host on a REST fake of the API, the exec pre-check
3388
+ included; no live run has been made yet.
3389
+
3390
+ ## Fly Sprites
3391
+
3392
+ ```ts
3393
+ import { providerFor } from "@parcha/agentrun-computer";
3394
+
3395
+ // The token is the caller's to pass (serve's SPRITES_TOKEN).
3396
+ const sprites = await providerFor("sprites", { token });
3397
+ const made = await sprites.create({ image: "default", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
3398
+ ```
3399
+
3400
+ A Fly Sprites computer is a [sprite](https://docs.sprites.dev): a Firecracker microVM Fly keeps by name until it is
3401
+ deleted, from Fly's own Ubuntu image, the one image a sprite has (`"default"`). It is a sandbox alone: with no image to
3402
+ name, there is no desktop and no Archil mount. Sprites runs on the shared machine-host adapter
3403
+ ([PROVIDERS.md](PROVIDERS.md)): `src/sprites.ts` is its `MachineHost`, over the Sprites API
3404
+ (`https://api.sprites.dev`, `Authorization: Bearer <token>`) with `fetch`, the shared REST client and Node's
3405
+ `WebSocket` (no SDK).
3406
+
3407
+ | MachineHost | Fly Sprites |
3408
+ | --- | --- |
3409
+ | `create` | `POST /v1/sprites` with the request's name and the packed labels as `name=value` strings; the name is the id |
3410
+ | `get` | `GET /v1/sprites/{name}`: `running`, `warm` and `cold` are running (an exec wakes one asleep), any other status stopped; a 404 is none |
3411
+ | `list` | `GET /v1/sprites?prefix=computer-`, every page, then the asked labels kept here (Fly filters by none) |
3412
+ | `delete` | `DELETE /v1/sprites/{name}`, a 404 done |
3413
+ | `exec` | the exec WebSocket (`/v1/sprites/{name}/exec`, argv as its `cmd` words, `stdin=true`, `max_run_after_disconnect=10s`) through `framedExec`: stdin as `0x00` frames and its end as `0x04`, stdout `0x01`, stderr `0x02`, the exit `0x03`; `kill` is `POST .../exec/{session}/kill?signal=SIGKILL`, by the id the socket's `session_info` names |
3414
+
3415
+ No `upload` (the adapter sends the daemon through exec's stdin) and no `extend` (the janitor moves the deadline label).
3416
+ The size and the image are Fly's: `check()` refuses `cpus`, `memoryMb` and any image but `"default"`. A sprite lives
3417
+ until deleted, so its lifetime is the janitor's, 30 days at most. A create rate cap (`sprite_creation_rate_limited`) or
3418
+ a concurrency cap (`concurrent_sprite_limit_exceeded`) is a `limit`.
3419
+
3420
+ Unverified until the live run: the arch (amd64); a label string's room (64 bytes); a taken name answering 409; the exec
3421
+ user being root or having passwordless sudo, and root making a network namespace; no vendor agent on TCP; the exec
3422
+ socket holding 75 s of silence with no ping; and a sprite with an exec running never going to sleep.
3423
+
3424
+ ## InstaBox
3425
+
3426
+ ```ts
3427
+ import { providerFor } from "@parcha/agentrun-computer";
3428
+
3429
+ // The key is the caller's to pass (serve's INSTABOX_API_KEY).
3430
+ const instabox = await providerFor("instabox", { apiKey });
3431
+ const made = await instabox.create({ image: "minimal", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
3432
+ ```
3433
+
3434
+ An InstaBox computer is an [InstaBox](https://instabox.sh/llms-full.txt) machine: a Firecracker microVM from one of
3435
+ InstaBox's templates (`"minimal"` by default, or `agent-browser`, `universal`) or a snapshot of the key's workspace, by
3436
+ name or `sn_` id. It is a sandbox alone: a create names no image of ours, so there is no desktop and no Archil mount.
3437
+ InstaBox runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)): `src/instabox.ts` is its
3438
+ `MachineHost`, over the InstaBox API (`https://api.instabox.sh`, `X-API-Key: <key>`) with `fetch` and the shared REST
3439
+ client, and over SSH with the host's `ssh2` package, as Agent37 and Morph (no SDK). A computer needs a paid plan: it
3440
+ switches off InstaBox's idle pause and maximum run, which the free plan refuses (a 403 `spec_not_allowed`, a `refused`
3441
+ in those words).
3442
+
3443
+ | MachineHost | InstaBox |
3444
+ | --- | --- |
3445
+ | `create` | `POST /v1/machines` under an `Idempotency-Key` of the request, with its name, the template (`templateId`) or snapshot (`snapshotId`), the size, the packed labels as `metadata`, `deleteAfterSeconds` at the backstop, `autoSuspendAfterSeconds: 0`, `maxRunMinutes: -1`, no vault and no secrets; the answer's `machineId` is the id |
3446
+ | `get` | `GET /v1/machines/{id}`: creating, starting and resuming are starting, running is running once `runtime.ready`, stopping, stopped, suspending and suspended are stopped, deleting and error gone (error in its `lastError` words); a 404 or a `deleted` record is none |
3447
+ | `list` | `GET /v1/machines?metadata=<name>:<value>`, every page, then the asked labels kept here and a `deleted` record left out |
3448
+ | `delete` | `DELETE /v1/machines/{id}` with `X-Confirm-Delete: <id>` and a fresh `Idempotency-Key`, a 404 done, a `409 operation_conflict` sent again within the call's bound; then the machine's SSH connections end |
3449
+ | `exec` | SSH through InstaBox's gateway with `SshExec`, logged in as a token from `POST /v1/machines/{id}/ssh-tokens` (the username, SSH's none auth), the gateway's host key pinned to the token's `hostKeyFingerprint`, which is required: a token answer with none, or one not `SHA256:` and 43 characters of unpadded base64, is refused before any connection, so the token never leaves; the machine's user, `user`, with passwordless sudo; a held token the gateway refuses is let go and another minted, once, and execs refused on the same token share its replacement; the mint is shared by the execs that ask at once and stopped by none of them, each waiting on it within its own time and signal |
3450
+
3451
+ No `upload` (InstaBox's file API writes as the machine's user, not root, so the adapter sends the daemon through exec's
3452
+ stdin) and no `extend` (the janitor moves the deadline label). `check()` takes a template id or a snapshot's name or
3453
+ id, and the sizes InstaBox offers: 2, 4, 8, 16 or 32 vCPUs with 2048 MB each, one alone taking the other's match. A
3454
+ rate, quota, concurrency or capacity cap (`rate_limited`, `quota_exceeded`, `concurrency_limit`, `no_capacity`,
3455
+ `machine_cooldown`) is a `limit`; `missing_scope` and `permission_denied` are `denied`. The daemon user can't be uid
3456
+ 1000, the machine user's.
3457
+
3458
+ Unverified until the live run: the gateway taking the token as the username with SSH's none auth; its host key being one
3459
+ ssh2 verifies, whose sha256 is `hostKeyFingerprint`; a taken name answering 409; a deleted machine reading 404 or a
3460
+ `deleted` record; sshd's port 22 being the one vendor listener; `minimal` being on every paid plan; the 8 KiB metadata
3461
+ bound counting compact JSON; a silent SSH channel holding 75 s; and root making a network namespace.
3462
+
3281
3463
  ## Conformance
3282
3464
 
3283
3465
  A provider for another vendor passes the same suite as Docker's, with one command. The suite is data: each case in
package/box/install.sh CHANGED
@@ -9,7 +9,8 @@
9
9
  # sh install.sh checked the last step alone: any sudo taken away, then every check. recipe.mjs's onImage runs it on
10
10
  # the published image, after E2B's template builder has added sudo there.
11
11
  #
12
- # It reads the network only through apt (Debian's mirrors) and for Archil's package. Run twice on one machine it ends the
12
+ # It reads the network only through apt (Debian's mirrors), for Archil's package and for Node's release, the two checked by
13
+ # sha256. Run twice on one machine it ends the
13
14
  # same, for a vendor's snapshot flow may retry it: each step that makes something looks for it first.
14
15
  set -eu
15
16
 
@@ -17,6 +18,12 @@ set -eu
17
18
  ARCHIL_VERSION=0.10.1-1793222256
18
19
  ARCHIL_SHA256_AMD64=f219e70287e8152f3f0c7222e1c3319f4665897235af7c33a8846e56a5a5786a
19
20
  ARCHIL_SHA256_ARM64=10ed430e51c268af095dd9e6c7aa6cdbb951d2430d62a76458719db168f40c0e
21
+ # The Node release the server's image runs (packages/serve/docker/Dockerfile), for the agent's node, npm and npx: Debian's
22
+ # nodejs comes with npm 9, older than the npm current packages are published for. The sums are the release's signed
23
+ # SHASUMS256.txt lines, checked against the signer that Dockerfile pins.
24
+ NODE_VERSION=24.22.3
25
+ NODE_SHA256_AMD64=4f2b175a6d53a5c617a80dba2676238a0688cef28c6da4eba35c7d844e66fcfb
26
+ NODE_SHA256_ARM64=6e51a2ada00f0011cc266f65d98922b403d7ad88f809ca2aa615a5fe1ce6e86c
20
27
  # Where the provider runs the root helper from.
21
28
  HELPER=/usr/local/sbin/agentrun-archil
22
29
  # The entrypoint of a machine that dials the server (dial below).
@@ -24,24 +31,31 @@ DIAL=/usr/local/bin/agentrun-dial
24
31
 
25
32
  here=$(dirname "$0")
26
33
 
27
- # A coding agent's tools, FUSE, nftables and the archil client (checked by sha256), the tool user, and /workspace.
34
+ # A coding agent's tools, Node, FUSE, nftables and the archil client (Node and archil checked by sha256), the tool user,
35
+ # and /workspace.
28
36
  packages() {
29
37
  arch="$(dpkg --print-architecture)"
30
38
  case "$arch" in
31
- amd64) sum="$ARCHIL_SHA256_AMD64" ;;
32
- arm64) sum="$ARCHIL_SHA256_ARM64" ;;
39
+ amd64) sum="$ARCHIL_SHA256_AMD64"; node_arch=x64; node_sum="$NODE_SHA256_AMD64" ;;
40
+ arm64) sum="$ARCHIL_SHA256_ARM64"; node_arch=arm64; node_sum="$NODE_SHA256_ARM64" ;;
33
41
  *) echo "no archil client for $arch" >&2; exit 1 ;;
34
42
  esac
35
43
  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
44
  apt-get update -qq
37
45
  DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
38
- git curl ca-certificates nodejs npm ripgrep fuse3 nftables >/dev/null
46
+ git curl ca-certificates xz-utils ripgrep fuse3 nftables >/dev/null
47
+ if [ "$(/usr/local/bin/node --version 2>/dev/null)" != "v$NODE_VERSION" ]; then
48
+ curl -fsSL -o /tmp/node.tar.xz "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${node_arch}.tar.xz"
49
+ echo "$node_sum /tmp/node.tar.xz" | sha256sum -c -
50
+ tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 --no-same-owner
51
+ rm -f /usr/local/CHANGELOG.md /usr/local/README.md /usr/local/LICENSE
52
+ fi
39
53
  if [ "$(dpkg-query -W -f '${Version}' archil 2>/dev/null)" != "$ARCHIL_VERSION" ]; then
40
54
  curl -fsSL -o /tmp/archil.deb "https://s3.amazonaws.com/archil-client/pkg/archil_${ARCHIL_VERSION}_${arch}.deb"
41
55
  echo "$sum /tmp/archil.deb" | sha256sum -c -
42
56
  DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends /tmp/archil.deb >/dev/null
43
57
  fi
44
- rm -rf /var/lib/apt/lists/* /tmp/archil.deb
58
+ rm -rf /var/lib/apt/lists/* /tmp/archil.deb /tmp/node.tar.xz
45
59
  getent group agentrun-tool >/dev/null || groupadd --gid 2510 agentrun-tool
46
60
  id -u agentrun-tool >/dev/null 2>&1 || useradd --uid 2510 --gid 2510 --no-create-home --home-dir /tmp --shell /bin/sh agentrun-tool
47
61
  install -d -o root -g root -m 0755 /workspace
@@ -211,6 +225,8 @@ checked() {
211
225
  [ ! -e /etc/sudoers ] && [ ! -e /etc/sudoers.d ] || { echo "the image has a sudoers file" >&2; exit 1; }
212
226
  ids="$(id -u agentrun-tool):$(id -g agentrun-tool)"
213
227
  [ "$ids" = "2510:2510" ] || { echo "agentrun-tool is $ids" >&2; exit 1; }
228
+ [ "$(/usr/local/bin/node --version)" = "v$NODE_VERSION" ] || { echo "the image's node is not $NODE_VERSION" >&2; exit 1; }
229
+ for x in npm npx; do [ -x "/usr/local/bin/$x" ] || { echo "the image has no $x beside node" >&2; exit 1; }; done
214
230
  archil --version | head -1
215
231
  }
216
232
 
Binary file
Binary file
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "0.1.0-beta.67",
2
+ "version": "0.1.0-beta.68",
3
3
  "source": "sha256:ca76a29aaa9ab0216cefc6badb124b6ab39a5a0094b984fa8d26537633ccad1e"
4
4
  }
@@ -0,0 +1,36 @@
1
+ import { type InstaboxProvider, type InstaboxProviderOptions } from "../instabox.js";
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
+ export declare const INSTABOX_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_INSTABOX";
6
+ /** apiKey, required: the workspace's API key. */
7
+ readonly key: "COMPUTER_INSTABOX_API_KEY";
8
+ /** The template or snapshot every computer of the run starts from; default minimal. */
9
+ readonly image: "COMPUTER_INSTABOX_IMAGE";
10
+ /** apiUrl: the API's root; default https://api.instabox.sh. */
11
+ readonly apiUrl: "COMPUTER_INSTABOX_API_URL";
12
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
13
+ readonly daemon: "COMPUTER_INSTABOX_DAEMON";
14
+ };
15
+ export declare const ENV: {
16
+ readonly live: "AGENTRUN_COMPUTER_LIVE_INSTABOX";
17
+ /** apiKey, required: the workspace's API key. */
18
+ readonly key: "COMPUTER_INSTABOX_API_KEY";
19
+ /** The template or snapshot every computer of the run starts from; default minimal. */
20
+ readonly image: "COMPUTER_INSTABOX_IMAGE";
21
+ /** apiUrl: the API's root; default https://api.instabox.sh. */
22
+ readonly apiUrl: "COMPUTER_INSTABOX_API_URL";
23
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
24
+ readonly daemon: "COMPUTER_INSTABOX_DAEMON";
25
+ };
26
+ export type InstaboxSettings = Pick<InstaboxProviderOptions, "apiKey" | "apiUrl" | "daemonPath">;
27
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without a key, never echoing it. */
28
+ export declare function settingsFromEnv(env?: Env): InstaboxSettings;
29
+ export declare const conformanceNotes: string[];
30
+ export interface InstaboxModuleOptions extends HostedModuleOptions, Pick<InstaboxProviderOptions, "ssh2" | "fetch" | "daemonPath" | "timeouts" | "onNote"> {
31
+ }
32
+ export declare const createProvider: (options?: InstaboxModuleOptions | undefined) => Promise<InstaboxProvider>, createDriftedProvider: (options?: InstaboxModuleOptions | undefined) => Promise<InstaboxProvider>, createHost: (options?: InstaboxModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
33
+ env?: Env;
34
+ }) => string;
35
+ /** The image every computer of the run starts from: COMPUTER_INSTABOX_IMAGE, else the minimal template. */
36
+ export declare function conformanceImage({ env }?: Pick<InstaboxModuleOptions, "env">): Promise<string>;
@@ -0,0 +1,43 @@
1
+ // InstaBox for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider instabox`. It makes
2
+ // real machines, which bill while they run, so it runs only with AGENTRUN_COMPUTER_LIVE_INSTABOX=1 and a key for a
3
+ // workspace you can bill, on a paid plan (a computer switches off the idle pause, which the free plan refuses), under
4
+ // COMPUTER_INSTABOX_API_KEY (never INSTABOX_API_KEY, which may hold another workspace's key). Every computer of a run
5
+ // has a deadline of at most 30 minutes, which the janitor keeps, and InstaBox's delete timer at its backstop.
6
+ import { INSTABOX_IMAGE } from "../descriptors/instabox.js";
7
+ import { accountOf, create } from "../instabox.js";
8
+ import { hostedModule, requiredSecret, setOptions } from "./module-kit.js";
9
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
10
+ export const INSTABOX_ENV = {
11
+ live: "AGENTRUN_COMPUTER_LIVE_INSTABOX",
12
+ /** apiKey, required: the workspace's API key. */
13
+ key: "COMPUTER_INSTABOX_API_KEY",
14
+ /** The template or snapshot every computer of the run starts from; default minimal. */
15
+ image: "COMPUTER_INSTABOX_IMAGE",
16
+ /** apiUrl: the API's root; default https://api.instabox.sh. */
17
+ apiUrl: "COMPUTER_INSTABOX_API_URL",
18
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
19
+ daemon: "COMPUTER_INSTABOX_DAEMON",
20
+ };
21
+ export const ENV = INSTABOX_ENV;
22
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without a key, never echoing it. */
23
+ export function settingsFromEnv(env = process.env) {
24
+ const apiKey = requiredSecret(env, INSTABOX_ENV.key, "an InstaBox API key");
25
+ return { apiKey, ...setOptions(env, { apiUrl: INSTABOX_ENV.apiUrl, daemonPath: INSTABOX_ENV.daemon }) };
26
+ }
27
+ export const conformanceNotes = [
28
+ "instabox: every computer is an InstaBox machine (a Firecracker microVM) from the minimal template unless COMPUTER_INSTABOX_IMAGE names another or a snapshot, its idle pause and maximum run off, its delete timer at the backstop; the daemon is a child, started over SSH through InstaBox's gateway as a token the API mints per machine, the gateway's host key pinned to the fingerprint the token names, and every command goes over that SSH with the machine user's sudo; labels are packed into the machine's metadata; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run. Network none, open and a list are init's. No Archil mount and no desktop.",
29
+ ];
30
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
31
+ live: { name: INSTABOX_ENV.live, what: "the InstaBox conformance module makes real machines, which bill while they run", whose: "a key for a workspace on a paid plan you can bill" },
32
+ settingsFromEnv,
33
+ create,
34
+ host: ["ssh2", "fetch", "timeouts", "onNote"],
35
+ run: [],
36
+ runDefined: ["daemonPath"],
37
+ // One key is one workspace, and one listing covers all of it.
38
+ scope: ({ apiKey, apiUrl }) => accountOf(apiKey, apiUrl),
39
+ });
40
+ /** The image every computer of the run starts from: COMPUTER_INSTABOX_IMAGE, else the minimal template. */
41
+ export async function conformanceImage({ env = process.env } = {}) {
42
+ return env[INSTABOX_ENV.image] || INSTABOX_IMAGE;
43
+ }
@@ -0,0 +1,32 @@
1
+ import { type SpritesProvider, type SpritesProviderOptions } from "../sprites.js";
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
+ export declare const SPRITES_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_SPRITES";
6
+ /** token, required: a Sprites API token. */
7
+ readonly key: "COMPUTER_SPRITES_TOKEN";
8
+ /** apiUrl: the API's root; default https://api.sprites.dev. */
9
+ readonly apiUrl: "COMPUTER_SPRITES_API_URL";
10
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
11
+ readonly daemon: "COMPUTER_SPRITES_DAEMON";
12
+ };
13
+ export declare const ENV: {
14
+ readonly live: "AGENTRUN_COMPUTER_LIVE_SPRITES";
15
+ /** token, required: a Sprites API token. */
16
+ readonly key: "COMPUTER_SPRITES_TOKEN";
17
+ /** apiUrl: the API's root; default https://api.sprites.dev. */
18
+ readonly apiUrl: "COMPUTER_SPRITES_API_URL";
19
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
20
+ readonly daemon: "COMPUTER_SPRITES_DAEMON";
21
+ };
22
+ export type SpritesSettings = Pick<SpritesProviderOptions, "token" | "apiUrl" | "daemonPath">;
23
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the token, never echoing it. */
24
+ export declare function settingsFromEnv(env?: Env): SpritesSettings;
25
+ export declare const conformanceNotes: string[];
26
+ export interface SpritesModuleOptions extends HostedModuleOptions, Pick<SpritesProviderOptions, "fetch" | "webSocket" | "daemonPath" | "timeouts" | "onNote"> {
27
+ }
28
+ export declare const createProvider: (options?: SpritesModuleOptions | undefined) => Promise<SpritesProvider>, createDriftedProvider: (options?: SpritesModuleOptions | undefined) => Promise<SpritesProvider>, createHost: (options?: SpritesModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
29
+ env?: Env;
30
+ }) => string;
31
+ /** The image every computer of the run starts from: Fly's own, the only one. */
32
+ export declare function conformanceImage(_options?: Pick<SpritesModuleOptions, "env">): Promise<string>;
@@ -0,0 +1,40 @@
1
+ // Fly Sprites for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider sprites`. It makes
2
+ // real sprites, which bill while they run and live until deleted, so it runs only with AGENTRUN_COMPUTER_LIVE_SPRITES=1
3
+ // and your own token, under COMPUTER_SPRITES_TOKEN (never SPRITES_TOKEN, which may hold another org's). Every computer
4
+ // of a run has a deadline of at most 30 minutes, which the janitor keeps.
5
+ import { httpsBase } from "../hosted/rest.js";
6
+ import { SPRITES_IMAGE } from "../descriptors/sprites.js";
7
+ import { create, DEFAULT_API_URL } from "../sprites.js";
8
+ import { hostedModule, keyPrint, requiredSecret, setOptions } from "./module-kit.js";
9
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
10
+ export const SPRITES_ENV = {
11
+ live: "AGENTRUN_COMPUTER_LIVE_SPRITES",
12
+ /** token, required: a Sprites API token. */
13
+ key: "COMPUTER_SPRITES_TOKEN",
14
+ /** apiUrl: the API's root; default https://api.sprites.dev. */
15
+ apiUrl: "COMPUTER_SPRITES_API_URL",
16
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
17
+ daemon: "COMPUTER_SPRITES_DAEMON",
18
+ };
19
+ export const ENV = SPRITES_ENV;
20
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the token, never echoing it. */
21
+ export function settingsFromEnv(env = process.env) {
22
+ const token = requiredSecret(env, SPRITES_ENV.key, "a Sprites API token");
23
+ return { token, ...setOptions(env, { apiUrl: SPRITES_ENV.apiUrl, daemonPath: SPRITES_ENV.daemon }) };
24
+ }
25
+ export const conformanceNotes = [
26
+ "sprites: every computer is a Fly sprite (a Firecracker microVM, amd64 unverified) from Fly's own Ubuntu image; the daemon is a child of a command on the exec WebSocket, its stdio the socket's binary frames, its kill the session's kill call; labels are packed into the sprite's name=value strings; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run. Network none, open and a list are init's. No Archil mount and no desktop.",
27
+ ];
28
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
29
+ live: { name: SPRITES_ENV.live, what: "the Sprites conformance module makes real sprites, which bill while they run", whose: "your own token" },
30
+ settingsFromEnv,
31
+ create,
32
+ host: ["fetch", "webSocket", "daemonPath", "timeouts"],
33
+ run: ["onNote"],
34
+ // The token's org, the token named by its sha256 prefix alone.
35
+ scope: ({ token, apiUrl }) => `the Sprites org of the token ${keyPrint(token)} at ${httpsBase(apiUrl ?? DEFAULT_API_URL, `the Sprites API URL (${SPRITES_ENV.apiUrl})`)}`,
36
+ });
37
+ /** The image every computer of the run starts from: Fly's own, the only one. */
38
+ export async function conformanceImage(_options = {}) {
39
+ return SPRITES_IMAGE;
40
+ }
@@ -0,0 +1,35 @@
1
+ import { type VercelProvider, type VercelProviderOptions } from "../vercel.js";
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
+ export declare const VERCEL_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_VERCEL";
6
+ /** token, required: a Vercel access token of the team. */
7
+ readonly key: "COMPUTER_VERCEL_TOKEN";
8
+ /** teamId, required. */
9
+ readonly team: "COMPUTER_VERCEL_TEAM_ID";
10
+ /** projectId, required: the project whose registry holds the box image. */
11
+ readonly project: "COMPUTER_VERCEL_PROJECT_ID";
12
+ /** The image every computer of the run starts from; default the box image (boxVercelImage). */
13
+ readonly image: "COMPUTER_VERCEL_IMAGE";
14
+ };
15
+ export declare const ENV: {
16
+ readonly live: "AGENTRUN_COMPUTER_LIVE_VERCEL";
17
+ /** token, required: a Vercel access token of the team. */
18
+ readonly key: "COMPUTER_VERCEL_TOKEN";
19
+ /** teamId, required. */
20
+ readonly team: "COMPUTER_VERCEL_TEAM_ID";
21
+ /** projectId, required: the project whose registry holds the box image. */
22
+ readonly project: "COMPUTER_VERCEL_PROJECT_ID";
23
+ /** The image every computer of the run starts from; default the box image (boxVercelImage). */
24
+ readonly image: "COMPUTER_VERCEL_IMAGE";
25
+ };
26
+ /** The provider's options this module reads from env; throws in words without one, never echoing the token. */
27
+ export declare function settingsFromEnv(env?: Env): Pick<VercelProviderOptions, "token" | "teamId" | "projectId">;
28
+ export declare const conformanceNotes: string[];
29
+ export interface VercelModuleOptions extends HostedModuleOptions, Pick<VercelProviderOptions, "fetch" | "daemonPath" | "timeouts" | "onNote"> {
30
+ }
31
+ export declare const createProvider: (options?: VercelModuleOptions | undefined) => Promise<VercelProvider>, createDriftedProvider: (options?: VercelModuleOptions | undefined) => Promise<VercelProvider>, createHost: (options?: VercelModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
32
+ env?: Env;
33
+ }) => string;
34
+ /** The image every computer of the run starts from: COMPUTER_VERCEL_IMAGE, else the box image prepareImage() answers. */
35
+ export declare function conformanceImage({ env }?: Pick<VercelModuleOptions, "env">): Promise<string>;
@@ -0,0 +1,43 @@
1
+ // Vercel Sandbox for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider vercel`. It
2
+ // makes real sandboxes, which bill while they run, so it runs only with AGENTRUN_COMPUTER_LIVE_VERCEL=1 and your own
3
+ // token, under COMPUTER_VERCEL_TOKEN (never VERCEL_TOKEN, which may hold another team's), with the team and project
4
+ // under COMPUTER_VERCEL_TEAM_ID and COMPUTER_VERCEL_PROJECT_ID. Every computer of a run lives at most 30 minutes.
5
+ import { boxVercelImage, create } from "../vercel.js";
6
+ import { hostedModule, keyPrint, requiredSecret } from "./module-kit.js";
7
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
8
+ export const VERCEL_ENV = {
9
+ live: "AGENTRUN_COMPUTER_LIVE_VERCEL",
10
+ /** token, required: a Vercel access token of the team. */
11
+ key: "COMPUTER_VERCEL_TOKEN",
12
+ /** teamId, required. */
13
+ team: "COMPUTER_VERCEL_TEAM_ID",
14
+ /** projectId, required: the project whose registry holds the box image. */
15
+ project: "COMPUTER_VERCEL_PROJECT_ID",
16
+ /** The image every computer of the run starts from; default the box image (boxVercelImage). */
17
+ image: "COMPUTER_VERCEL_IMAGE",
18
+ };
19
+ export const ENV = VERCEL_ENV;
20
+ /** The provider's options this module reads from env; throws in words without one, never echoing the token. */
21
+ export function settingsFromEnv(env = process.env) {
22
+ return {
23
+ token: requiredSecret(env, VERCEL_ENV.key, "a Vercel access token"),
24
+ teamId: requiredSecret(env, VERCEL_ENV.team, "the Vercel team id"),
25
+ projectId: requiredSecret(env, VERCEL_ENV.project, "the Vercel project id"),
26
+ };
27
+ }
28
+ export const conformanceNotes = [
29
+ "vercel: every computer is a Vercel Sandbox (a Firecracker microVM, amd64) made with persistent false and its session timeout at the computer's lifetime; the daemon is a child of a detached command, its stdio the command's log stream and a stdin write per call; labels are packed into its 5 tags; lifetime is Vercel's timer, capped at 30 minutes for the run. Network none, open and a list are init's (vendor deny-all on none). No Archil mount and no desktop.",
30
+ ];
31
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
32
+ live: { name: VERCEL_ENV.live, what: "the Vercel conformance module makes real sandboxes, which bill while they run", whose: "your own token" },
33
+ settingsFromEnv,
34
+ create,
35
+ host: ["fetch", "daemonPath", "timeouts"],
36
+ run: ["onNote"],
37
+ // The project of the team, the token named by its sha256 prefix alone.
38
+ scope: ({ token, teamId, projectId }) => `the Vercel project ${projectId} of team ${teamId}, by the token ${keyPrint(token)}`,
39
+ });
40
+ /** The image every computer of the run starts from: COMPUTER_VERCEL_IMAGE, else the box image prepareImage() answers. */
41
+ export async function conformanceImage({ env = process.env } = {}) {
42
+ return env[VERCEL_ENV.image] || boxVercelImage();
43
+ }