@parcha/agentrun-computer 0.1.0-beta.34 → 0.1.0-beta.35
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 +144 -26
- package/dist/browser.d.ts +12 -13
- package/dist/browser.js +16 -14
- package/dist/browserbase.d.ts +3 -5
- package/dist/browserbase.js +16 -13
- package/dist/chrome.js +1 -1
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/conformance/browserbase.js +1 -1
- package/dist/conformance/cases/provider.js +78 -3
- package/dist/conformance/daytona.js +2 -1
- package/dist/conformance/e2b.js +2 -1
- package/dist/conformance/fixture.js +24 -2
- package/dist/conformance/kernel.js +1 -1
- package/dist/conformance/kind.js +2 -1
- package/dist/conformance/{local.d.ts → local-chrome.d.ts} +7 -7
- package/dist/conformance/{local.js → local-chrome.js} +11 -11
- package/dist/conformance/orgo.d.ts +11 -5
- package/dist/conformance/orgo.js +37 -8
- package/dist/conformance/phone-harness.js +2 -1
- package/dist/conformance/report.js +3 -2
- package/dist/conformance/runner.js +25 -7
- package/dist/conformance/types.d.ts +21 -8
- package/dist/conformance/types.js +10 -0
- package/dist/conformance/windows-fixture.d.ts +1 -0
- package/dist/conformance/windows-fixture.js +37 -0
- package/dist/daytona.d.ts +3 -34
- package/dist/daytona.js +34 -61
- package/dist/descriptor.d.ts +94 -0
- package/dist/descriptor.js +81 -0
- package/dist/descriptors/browserbase.d.ts +24 -0
- package/dist/descriptors/browserbase.js +18 -0
- package/dist/descriptors/daytona.d.ts +62 -0
- package/dist/descriptors/daytona.js +49 -0
- package/dist/descriptors/docker.d.ts +12 -0
- package/dist/descriptors/docker.js +17 -0
- package/dist/descriptors/e2b.d.ts +22 -0
- package/dist/descriptors/e2b.js +19 -0
- package/dist/descriptors/index.d.ts +229 -0
- package/dist/descriptors/index.js +19 -0
- package/dist/descriptors/kernel.d.ts +20 -0
- package/dist/descriptors/kernel.js +15 -0
- package/dist/descriptors/local-chrome.d.ts +17 -0
- package/dist/descriptors/local-chrome.js +21 -0
- package/dist/descriptors/modal.d.ts +50 -0
- package/dist/descriptors/modal.js +38 -0
- package/dist/descriptors/orgo.d.ts +88 -0
- package/dist/descriptors/orgo.js +44 -0
- package/dist/descriptors/phone-harness.d.ts +28 -0
- package/dist/descriptors/phone-harness.js +20 -0
- package/dist/descriptors/shared.d.ts +7 -0
- package/dist/descriptors/shared.js +6 -0
- package/dist/desktop.d.ts +4 -4
- package/dist/desktop.js +4 -4
- package/dist/docker/egress.d.ts +1 -1
- package/dist/docker/image.js +17 -15
- package/dist/docker/inspect.d.ts +147 -0
- package/dist/docker/inspect.js +335 -0
- package/dist/docker.d.ts +6 -6
- package/dist/docker.js +46 -42
- package/dist/drift.d.ts +3 -145
- package/dist/drift.js +5 -334
- package/dist/e2b.d.ts +2 -8
- package/dist/e2b.js +16 -22
- package/dist/index.d.ts +8 -11
- package/dist/index.js +13 -11
- package/dist/isolation.js +2 -2
- package/dist/janitor.d.ts +18 -1
- package/dist/janitor.js +67 -19
- package/dist/kernel.d.ts +3 -5
- package/dist/kernel.js +19 -16
- package/dist/kinds.d.ts +54 -34
- package/dist/kinds.js +19 -117
- package/dist/labels.d.ts +12 -0
- package/dist/labels.js +39 -1
- package/dist/{local.d.ts → local-chrome.d.ts} +5 -8
- package/dist/{local.js → local-chrome.js} +19 -16
- package/dist/local-supervisor.d.ts +3 -3
- package/dist/local-supervisor.js +3 -3
- package/dist/modal.d.ts +3 -22
- package/dist/modal.js +15 -31
- package/dist/mount-archil.js +4 -4
- package/dist/orgo-channel.js +16 -13
- package/dist/orgo-desktop.d.ts +153 -0
- package/dist/orgo-desktop.js +1614 -0
- package/dist/orgo-names.d.ts +52 -0
- package/dist/orgo-names.js +84 -0
- package/dist/orgo.d.ts +18 -15
- package/dist/orgo.js +46 -107
- package/dist/phone-harness.d.ts +4 -10
- package/dist/phone-harness.js +45 -46
- package/dist/provider.d.ts +91 -10
- package/dist/provider.js +42 -0
- package/dist/providers.d.ts +23 -24
- package/dist/providers.js +14 -17
- package/dist/result.d.ts +11 -1
- package/dist/result.js +11 -0
- package/dist/test-connection.js +2 -2
- package/package.json +42 -2
package/README.md
CHANGED
|
@@ -7,11 +7,18 @@ npm install @parcha/agentrun-computer@latest
|
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import {
|
|
10
|
+
import { providerFor, providerModule } from "@parcha/agentrun-computer";
|
|
11
|
+
// One provider's class, from its own subpath: the package root loads no provider.
|
|
12
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
11
13
|
// The mount rule alone: loads no provider, no vendor SDK and no conformance code.
|
|
12
14
|
import { checkMount, readBackOf, WORKSPACE, type MountSpec } from "@parcha/agentrun-computer/mount";
|
|
13
15
|
```
|
|
14
16
|
|
|
17
|
+
The package root holds the protocol, the registry and the descriptors, and loads no provider: a provider loads by its
|
|
18
|
+
id (`providerFor(id, options)`, which imports that one provider's file), or from its subpath (`/docker`, `/daytona`,
|
|
19
|
+
`/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`). A provider's
|
|
20
|
+
option types (`DockerProviderOptions`, `ModalProviderOptions` and the like) come from its subpath too, not the root.
|
|
21
|
+
|
|
15
22
|
The package carries the daemon for Linux amd64 and arm64 in `dist/`, so a provider runs it with no Go on the host. A
|
|
16
23
|
vendor's SDK is the host's: Modal's `modal` package is imported only when the Modal provider is built, and the package
|
|
17
24
|
depends on nothing. A provider's mount kinds are its file's `MOUNT`, read with `(await providerModule(id)).MOUNT`,
|
|
@@ -427,7 +434,7 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
427
434
|
| daytona | Daytona | sandbox | `DAYTONA_API_KEY`; `DAYTONA_API_URL`, `DAYTONA_TARGET` (optional) | archil | yes |
|
|
428
435
|
| modal | Modal | sandbox | `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET` | archil | yes |
|
|
429
436
|
| e2b | E2B | sandbox, desktop | `E2B_API_KEY` | archil | yes |
|
|
430
|
-
| orgo | Orgo | desktop | `ORGO_API_KEY` | none | yes |
|
|
437
|
+
| orgo | Orgo | desktop (Linux; Windows and macOS with `os`) | `ORGO_API_KEY` | none | yes |
|
|
431
438
|
| phone-harness | Phone harness | phone | `PHONE_HARNESS_API_KEY` | none | yes |
|
|
432
439
|
| browserbase | Browserbase | browser | `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID` | none | yes |
|
|
433
440
|
| kernel | Kernel | browser | `KERNEL_API_KEY` | none | yes |
|
|
@@ -653,7 +660,7 @@ fixtures of every evasion it catches.
|
|
|
653
660
|
## Docker
|
|
654
661
|
|
|
655
662
|
```ts
|
|
656
|
-
import { DockerProvider } from "@parcha/agentrun-computer";
|
|
663
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
657
664
|
|
|
658
665
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
659
666
|
const made = await docker.create({ image: "debian:bookworm-slim", lifetimeMs: 600_000, network: "none" });
|
|
@@ -840,7 +847,8 @@ computer has the folder at one path, `/workspace` (`WORKSPACE`). `HOME` stays wh
|
|
|
840
847
|
Docker): `/workspace` is only the mount.
|
|
841
848
|
|
|
842
849
|
```ts
|
|
843
|
-
import {
|
|
850
|
+
import { WORKSPACE } from "@parcha/agentrun-computer";
|
|
851
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
844
852
|
|
|
845
853
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
846
854
|
// The run folder must exist, by its canonical path, and be writable by docker.user (below).
|
|
@@ -951,7 +959,7 @@ The provider owns the image its computers start from and makes it ready in its o
|
|
|
951
959
|
no other process to wait on: Docker's own tag is the shared state.
|
|
952
960
|
|
|
953
961
|
```ts
|
|
954
|
-
import { DockerProvider } from "@parcha/agentrun-computer";
|
|
962
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
955
963
|
|
|
956
964
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" }); // image: the default recipe
|
|
957
965
|
const image = await docker.image({ signal }); // built once; one inspect when Docker has it
|
|
@@ -1096,7 +1104,8 @@ in a long-lived service), with Docker's CLI on its PATH. A computer stops at its
|
|
|
1096
1104
|
its stopped container may stay up to one interval longer.
|
|
1097
1105
|
|
|
1098
1106
|
```ts
|
|
1099
|
-
import {
|
|
1107
|
+
import { sweep } from "@parcha/agentrun-computer";
|
|
1108
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
1100
1109
|
|
|
1101
1110
|
const swept = await sweep(new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" }));
|
|
1102
1111
|
if (swept.ok) console.log(`deleted ${swept.value.deleted.join(", ") || "none"}; kept ${swept.value.kept}`);
|
|
@@ -1130,7 +1139,8 @@ as a caller's labels, with no code of its own: Docker writes them with `--label`
|
|
|
1130
1139
|
the computer through the provider's own exec, and a deleted computer holds no mount.
|
|
1131
1140
|
|
|
1132
1141
|
```ts
|
|
1133
|
-
import {
|
|
1142
|
+
import { releaseOlder, runLabels } from "@parcha/agentrun-computer";
|
|
1143
|
+
import { DockerProvider } from "@parcha/agentrun-computer/docker";
|
|
1134
1144
|
|
|
1135
1145
|
const docker = new DockerProvider({ daemonPath: "dist/computerd-linux-amd64" });
|
|
1136
1146
|
// A claim at epoch 3 takes the run over: the computers of epochs 1 and 2 go first.
|
|
@@ -1155,7 +1165,7 @@ sandbox, and the Daytona sweep wait through it too.
|
|
|
1155
1165
|
|
|
1156
1166
|
```ts
|
|
1157
1167
|
import { ModalClient } from "modal"; // the host's own client: this package imports nothing from the SDK
|
|
1158
|
-
import { ModalProvider } from "@parcha/agentrun-computer";
|
|
1168
|
+
import { ModalProvider } from "@parcha/agentrun-computer/modal";
|
|
1159
1169
|
|
|
1160
1170
|
const modal = new ModalProvider({
|
|
1161
1171
|
sdk: new ModalClient(),
|
|
@@ -1446,7 +1456,7 @@ named by any call.
|
|
|
1446
1456
|
## Daytona
|
|
1447
1457
|
|
|
1448
1458
|
```ts
|
|
1449
|
-
import { DaytonaProvider } from "@parcha/agentrun-computer";
|
|
1459
|
+
import { DaytonaProvider } from "@parcha/agentrun-computer/daytona";
|
|
1450
1460
|
|
|
1451
1461
|
const daytona = new DaytonaProvider({ apiKey, daemonPath: "dist/computerd-linux-amd64" });
|
|
1452
1462
|
const made = await daytona.create({ image: "my-snapshot", lifetimeMs: 600_000, network: "none" });
|
|
@@ -2020,6 +2030,57 @@ A live run must show:
|
|
|
2020
2030
|
`packages/envd/internal/services/process/start.go`, `.../process/handler/handler.go:395-420`), and E2B's docs
|
|
2021
2031
|
(network/restrict-public-access and network/internet-access, read 2026-11-07). Each is cited where it is used above and in `src/e2b.ts`.
|
|
2022
2032
|
|
|
2033
|
+
## Orgo: Windows and macOS desktops (parked)
|
|
2034
|
+
|
|
2035
|
+
Orgo offers its Linux desktop alone, which runs computerd (`src/orgo.ts`). Its Windows and macOS desktops are parked:
|
|
2036
|
+
the descriptor lists them in `parked` (`ORGO_PARKED`), so `PROVIDERS` offers no configuration of either, Settings →
|
|
2037
|
+
Computers lists no Windows or macOS image, and an agent whose computer names `windows` or `macos` is refused at its
|
|
2038
|
+
run's start in words naming the image Orgo offers, `linux`. They do not run computerd either: computerd for Windows and
|
|
2039
|
+
macOS is CP-8, deferred. `create({ os: "windows" | "macos", apiKey, workspaceId })` still builds an
|
|
2040
|
+
`OrgoDesktopProvider` (`src/orgo-desktop.ts`) with daemon `none`, for the conformance suite and the tests. It answers
|
|
2041
|
+
the protocol's methods in process over Orgo's REST API, as the phone harness and Browserbase do. Its spec's image is
|
|
2042
|
+
`"windows"` (`ORGO_WINDOWS_IMAGE`, Orgo's Windows Server 2019) or `"macos"` (`ORGO_MACOS_IMAGE`): the one the provider was
|
|
2043
|
+
built for.
|
|
2044
|
+
|
|
2045
|
+
- **What each offers.** The protocol groups, by Orgo's calls:
|
|
2046
|
+
- `screen`: Orgo's screenshot (`response_format=base64&format=png`). A region is cropped in process. The live view
|
|
2047
|
+
polls it about once a second, scaled by Orgo past `maxWidth`.
|
|
2048
|
+
- `input.pointer` and `input.keys`: Orgo's click, mouse-move, drag, scroll, type and key calls.
|
|
2049
|
+
- `exec`: Orgo's bash call. On Windows that is PowerShell: argv becomes a call operator over single-quoted words,
|
|
2050
|
+
and the exit code is `$LASTEXITCODE`. On macOS it is the shell, every word quoted. argv is never a shell string.
|
|
2051
|
+
- `files`, Windows only: one PowerShell script whose request is base64 JSON. A write over 96 KiB is uploaded first
|
|
2052
|
+
(Orgo's `/files/upload` with `destPath`).
|
|
2053
|
+
- No `processes`: Orgo runs a command and waits for it. No `tar`, and no mount.
|
|
2054
|
+
- Network `open`, never read back from inside: Orgo has no egress control, and no daemon runs in the computer to
|
|
2055
|
+
hold its programs to loopback, so the provider cannot prove `none`.
|
|
2056
|
+
- **What Orgo's API cannot do is refused in words, and a refused batch runs nothing:**
|
|
2057
|
+
- on Windows, a triple click, keys held during a click, a drag of more than two points, a sideways or pixel
|
|
2058
|
+
scroll, and `hold`;
|
|
2059
|
+
- on macOS, a right-button double click or drag;
|
|
2060
|
+
- `+` as a key, since it joins Orgo's combinations.
|
|
2061
|
+
- **down and up.** Orgo has no separate press and release. A `down` is held in the client, across batches as the
|
|
2062
|
+
protocol says. Its `up` becomes one click (the pointer did not move) or one drag (from where it went down). A batch
|
|
2063
|
+
that fails releases a press it holds.
|
|
2064
|
+
- **The cursor.** The live view's frames carry the place the client last moved the pointer to (`cursor`), and a move is
|
|
2065
|
+
a new frame even when Orgo's screenshot leaves the cursor out.
|
|
2066
|
+
- **Lifetime.** The name carries the run, the epoch and the deadline, as the Linux desktop's does (`src/orgo-names.ts`),
|
|
2067
|
+
and the janitor ends a computer by it. On Windows, Orgo's `ends_in_hours` is the backstop. A Mac has no Orgo end.
|
|
2068
|
+
The other labels are a file the provider writes in the computer (`C:\ProgramData\agentrun\labels.json`,
|
|
2069
|
+
`/Users/Shared/agentrun/labels.json`). A program in the computer can change that file, so list, the janitor and
|
|
2070
|
+
the takeover trust the name, which only the key can change.
|
|
2071
|
+
- **attach** reports who the programs run as. On Windows that is `0:0` for a member of the Administrators group,
|
|
2072
|
+
since it can do what a root can, and is said as it is.
|
|
2073
|
+
- **Idle suspension.** Nothing runs in a computer Orgo does not read `running`: any action wakes a suspended one.
|
|
2074
|
+
`list` reads the labels file of a running computer alone, and attach, connect and extend refuse the others in words.
|
|
2075
|
+
- **Release** deletes. A Mac Orgo manages answers 409 to a delete. That is refused in Orgo's words, and the Mac is
|
|
2076
|
+
left.
|
|
2077
|
+
- **Conformance.** `COMPUTER_ORGO_OS=windows` (or `macos`) with `--kind desktop` runs the desktop's cases:
|
|
2078
|
+
- The Windows fixture is a PowerShell script this package carries (`src/conformance/windows-fixture.ts`): the same
|
|
2079
|
+
window as `computerd-fixture`, started with `Start-Process` through exec and files.
|
|
2080
|
+
- The cases written for Linux (exec's and files' POSIX programs and paths) are skipped in words (`caseOs`).
|
|
2081
|
+
- The live run needs Orgo's Scale plan or a Windows computer bought on the plan; the macOS run needs Orgo's Mac
|
|
2082
|
+
access.
|
|
2083
|
+
|
|
2023
2084
|
## Browsers: Browserbase and Kernel
|
|
2024
2085
|
|
|
2025
2086
|
A browser is a computer of kind `browser`: a vendor's browser session that answers CDP. No computerd runs (daemon
|
|
@@ -2077,11 +2138,11 @@ AGENTRUN_COMPUTER_LIVE_KERNEL=1 COMPUTER_KERNEL_API_KEY=... \
|
|
|
2077
2138
|
|
|
2078
2139
|
## A local browser: this machine's Chrome, no keys
|
|
2079
2140
|
|
|
2080
|
-
The `local` provider (`local.ts`) is a computer of kind `browser` that is the Chrome or Chromium
|
|
2081
|
-
AgentRun runs on. No vendor, no key, nothing billed.
|
|
2141
|
+
The `local-chrome` provider (Local Chrome, `local-chrome.ts`) is a computer of kind `browser` that is the Chrome or Chromium
|
|
2142
|
+
on the machine AgentRun runs on. No vendor, no key, nothing billed.
|
|
2082
2143
|
|
|
2083
2144
|
```ts
|
|
2084
|
-
import { LocalBrowserProvider } from "@parcha/agentrun-computer";
|
|
2145
|
+
import { LocalBrowserProvider } from "@parcha/agentrun-computer/local-chrome";
|
|
2085
2146
|
|
|
2086
2147
|
const local = new LocalBrowserProvider({ env: { PATH: process.env.PATH } }); // or { executablePath: "/usr/bin/chromium" }
|
|
2087
2148
|
const made = await local.create({ image: "chromium", lifetimeMs: 30 * 60_000, network: "open" });
|
|
@@ -2147,8 +2208,8 @@ process (a cross-origin iframe). The snapshot names each frame it left out, so a
|
|
|
2147
2208
|
The conformance module starts a real Chrome, so it waits for its switch:
|
|
2148
2209
|
|
|
2149
2210
|
```sh
|
|
2150
|
-
|
|
2151
|
-
npm run conformance -w @parcha/agentrun-computer -- --provider local --kind browser
|
|
2211
|
+
AGENTRUN_COMPUTER_LIVE_LOCAL_CHROME=1 [COMPUTER_LOCAL_CHROME_PATH=/usr/bin/chromium] \
|
|
2212
|
+
npm run conformance -w @parcha/agentrun-computer -- --provider local-chrome --kind browser
|
|
2152
2213
|
```
|
|
2153
2214
|
|
|
2154
2215
|
## Phone harness (the phone kind)
|
|
@@ -2323,6 +2384,10 @@ capabilities), no case of the run failed (a declared optional group that fails w
|
|
|
2323
2384
|
every required group has at least one passing case and no Core case skipped but for an optional group the computer does
|
|
2324
2385
|
not declare, and the run left nothing behind. A Full case that skips is owed by no group: a provider may refuse in
|
|
2325
2386
|
words what its kind does not require, as the phone harness refuses `touch.pinch`, and the report still shows the skip.
|
|
2387
|
+
A case is written for the systems its `os` names (`caseOs`). Without one, a case that needs exec or processes runs
|
|
2388
|
+
POSIX programs (`sh`, `id`, `/proc`) and is Linux's alone, and one that needs files names POSIX paths and is no Windows
|
|
2389
|
+
computer's. A computer of another os skips it in words ("the case is written for linux, and this computer runs
|
|
2390
|
+
windows"), after the check of what it declares.
|
|
2326
2391
|
`none` is no computer, and `--kind` refuses it in words. Given no cases, a run takes `casesFor(machineKind)`: a
|
|
2327
2392
|
browser's own cases (`browserCases`), every other kind the suite's (`conformanceCases`), in the library as in the CLI;
|
|
2328
2393
|
`kindCases` draws from the same by kind. `kindCases`, `kindVerdict` and `casesFor` are exported, so the serve side reads
|
|
@@ -2450,24 +2515,77 @@ computer's `HOME`, which the provider sets, is a directory its user can write, a
|
|
|
2450
2515
|
From code: `runConformance(provider, { image, only?, signal?, drifted?, mountFor?, caseTimeoutMs?, cleanupTimeoutMs?,
|
|
2451
2516
|
fixture?, fetch? })` returns the report, and `formatReport(report)` the text above.
|
|
2452
2517
|
|
|
2518
|
+
## Persistent computers: an agent's own
|
|
2519
|
+
|
|
2520
|
+
A run's computer belongs to its run: it has a deadline (`lifetimeMs`, required), and the janitor or the vendor ends it
|
|
2521
|
+
once the deadline passes. A persistent computer belongs to an agent instead. It outlives the agent's runs, which take
|
|
2522
|
+
it one at a time, and it keeps its files between them. The contract, in `src/provider.ts` and `src/labels.ts`:
|
|
2523
|
+
|
|
2524
|
+
- **Declared.** A provider that keeps computers for agents declares `capabilities().persistence`:
|
|
2525
|
+
`{ keepsState: true, resume }`. `keepsState`: a detached computer keeps its files. `resume`: `true` when it comes back
|
|
2526
|
+
as it was, its processes still running; `false` when it boots again from its kept disk. A provider that declares none
|
|
2527
|
+
refuses `spec.owner` in `check()`, in words, before any vendor call, and refuses `release(ref, "detach")`, the
|
|
2528
|
+
computer left as it was.
|
|
2529
|
+
- **Owned.** `spec.owner: { agent, idleTtlMs? }` makes the computer the agent's. It has no run deadline: the rule that
|
|
2530
|
+
refuses a computer with no deadline is a run's computers' alone, and an owned spec that names `lifetimeMs` is refused
|
|
2531
|
+
(`checkTenure(spec, capabilities)` holds both rules, for every provider's `check()`). The computer carries the owner
|
|
2532
|
+
label, `agentrun.owner=agent:<id>` (`OWNER_LABEL`), and `agentrun.idle-ttl-ms` (`IDLE_TTL_LABEL`) when the owner set
|
|
2533
|
+
an idle TTL; `ownerLabels(owner)` gives both and `ownerOf(labels)` reads them back.
|
|
2534
|
+
- **Detach.** `release(ref, "detach")` stops the computer with its state kept. It stays the agent's, listed `stopped`,
|
|
2535
|
+
with `detachedAt`, when it was detached. Only an owned computer detaches: a run's computer refuses it in words and
|
|
2536
|
+
runs on. `"delete"` deletes an owned computer, and only the agent or its owner asks for that: the caller's rule, not
|
|
2537
|
+
the provider's.
|
|
2538
|
+
- **Attached under a new claim.** A run takes the computer with `attach({ id }, { claim: { run, epoch } })`. The
|
|
2539
|
+
provider brings it back (starts it, when detached) and records the claim, so the computer carries the run's
|
|
2540
|
+
`agentrun.run` and `agentrun.epoch` and `releaseOlder` of that run finds it. A claim of the same run below the epoch
|
|
2541
|
+
the computer carries is refused as fenced, with nothing changed. A claim on a computer with no owner is refused: a
|
|
2542
|
+
run's computer belongs to its run.
|
|
2543
|
+
- **The janitor.** A computer is owned when it carries the owner label or its provider's `list()` marks it `owned: true`
|
|
2544
|
+
(with `owner` when the listing knows it: a vendor whose stopped computer shows no labels). `sweep` never deletes an
|
|
2545
|
+
owned computer by a deadline. It deletes one only when its owner agent is
|
|
2546
|
+
gone (`ownerGone(agent)`, the caller's answer, in `SweepOptions`), or when it has been detached for longer than its
|
|
2547
|
+
owner's idle TTL. An owner label it cannot read keeps the computer: the janitor never deletes an agent's state on a
|
|
2548
|
+
rule it cannot read. On a provider that declares persistence it sweeps owned computers under lifetime `"vendor"`
|
|
2549
|
+
too, since no vendor ends them. `releaseOlder` detaches an owned computer of a lower epoch and never deletes it: the
|
|
2550
|
+
new claim attaches it.
|
|
2551
|
+
- **Conformance.** `provider.owner` and `provider.detach` are Core for every provider: `check()` refuses an owner
|
|
2552
|
+
without persistence, and a lifetime with one; a run's computer refuses detach and runs on. `provider.persistence` is
|
|
2553
|
+
Full, run where persistence is declared: create with an owner, write a file, detach, attach by id under a new claim,
|
|
2554
|
+
read the file back (with `resume`, find the process still running), refuse a fenced claim, then delete.
|
|
2555
|
+
|
|
2556
|
+
`test/fake-computer.mjs`'s `persistence` option is a provider that declares it and passes the cases. Orgo's provider
|
|
2557
|
+
is the first vendor to wire it.
|
|
2558
|
+
|
|
2453
2559
|
## Adding a computer
|
|
2454
2560
|
|
|
2455
|
-
A new computer is one provider file and one
|
|
2456
|
-
|
|
2561
|
+
A new computer is one provider file and one descriptor, `src/descriptors/<id>.ts`, declared once and listed in
|
|
2562
|
+
`DESCRIPTORS` (`src/descriptors/index.ts`). Everything else is derived from the descriptors: the registry
|
|
2563
|
+
(`src/providers.ts`, id to `load()`), the kind registry's `PROVIDERS` (Settings' rows), and the ids. The conformance
|
|
2564
|
+
CLI (and serve) resolve providers through them, so neither needs an edit:
|
|
2457
2565
|
|
|
2458
2566
|
```ts
|
|
2459
|
-
export const
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2567
|
+
export const FLY = defineProvider({
|
|
2568
|
+
id: "fly",
|
|
2569
|
+
label: "Fly",
|
|
2570
|
+
keys: [{ name: "FLY_API_TOKEN", option: "apiToken", required: true }], // each key and the create() option it fills
|
|
2571
|
+
metered: true,
|
|
2572
|
+
mounts: [],
|
|
2573
|
+
network: ["none", "open"], // the network forms its computers make: none, open, allow
|
|
2574
|
+
capabilities: [{ kind: "linux", groups: ["exec", "files", "processes"] }], // one per configuration
|
|
2575
|
+
load: () => import("../fly.js"),
|
|
2576
|
+
});
|
|
2466
2577
|
```
|
|
2467
2578
|
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
`
|
|
2579
|
+
A descriptor is data and a lazy `load()`: it imports `../descriptor.js` and other descriptors alone, so loading the
|
|
2580
|
+
registry, the kind registry or the package root loads no provider and no vendor SDK. `defineProvider` checks it when
|
|
2581
|
+
it is declared (`descriptorProblems`), in words. Its fields: `id`, `label`, `keys` (each key's name, the option it
|
|
2582
|
+
fills, and whether it is required), `settings` (a setting that is no key but fills an option, with its default),
|
|
2583
|
+
`metered`, `mounts`, `network` (the network forms its computers make, at least one of none, open and allow),
|
|
2584
|
+
`capabilities` (the kind and groups of each configuration), `defaultImage` (by setting kind),
|
|
2585
|
+
`prepareImage` (a provider that builds or pulls its image before a run), `local` (a computer on this host), and
|
|
2586
|
+
`ledger` (the option a provider's ledger fills). `providerFor(id, options)` builds a provider by id from its options and
|
|
2587
|
+
refuses an id it does not hold, naming the ones it does. The provider file, `src/<vendor>.ts`, exports what a
|
|
2588
|
+
`ProviderModule` is:
|
|
2471
2589
|
|
|
2472
2590
|
- the provider class, which implements `ComputerProvider` and reports the registry id as its `id`;
|
|
2473
2591
|
- `MOUNT`, the mount kinds its computers take;
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type ComputerClient, type Group, type HelloResult } from "./protocol.js";
|
|
2
2
|
import type { ComputerCapabilities, ComputerSpec, Refusal } from "./provider.js";
|
|
3
|
-
import { type ComputerErrorCode, type Result } from "./result.js";
|
|
4
|
-
/** The one image a browser computer runs: the vendor's own Chromium. */
|
|
5
|
-
export declare const BROWSER_IMAGE = "chromium";
|
|
3
|
+
import { type ComputerError, type ComputerErrorCode, type Result } from "./result.js";
|
|
6
4
|
/**
|
|
7
5
|
* Where a provider keeps the URLs it was handed, by session id, in memory only. Default a Map of its own; a host that
|
|
8
6
|
* builds one provider per call passes one store to all of them (pi-browser's process-wide holdings).
|
|
@@ -33,17 +31,18 @@ export interface ReleaseConfirm {
|
|
|
33
31
|
export declare const DEFAULT_CONFIRM: ReleaseConfirm;
|
|
34
32
|
export declare const defaultSleep: (ms: number) => Promise<void>;
|
|
35
33
|
/** A vendor call's failure as the provider returns it: a code and words, and the error the call threw, for a caller that rethrows it as it was. */
|
|
36
|
-
export type VendorFailure = {
|
|
37
|
-
code: ComputerErrorCode;
|
|
38
|
-
message: string;
|
|
34
|
+
export type VendorFailure = ComputerError & {
|
|
39
35
|
readonly cause?: unknown;
|
|
40
36
|
};
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A failure whose cause rides along out of sight: not enumerable, so it is in no JSON, no log line and no report. With
|
|
39
|
+
* code vendor, vendor (the provider's id) names whose.
|
|
40
|
+
*/
|
|
41
|
+
export declare function causedFail(code: ComputerErrorCode, message: string, cause: unknown, vendor: string): Result<never>;
|
|
42
|
+
/** The error a vendor call threw, behind a failure causedFail made; undefined for any other. */
|
|
44
43
|
export declare const causeOf: (result: Result<unknown>) => unknown;
|
|
45
|
-
/** The code a vendor's HTTP status reads as. */
|
|
46
|
-
export declare function statusCode(status: number | undefined
|
|
44
|
+
/** The code a vendor's HTTP status reads as: one of ours, or vendor. */
|
|
45
|
+
export declare function statusCode(status: number | undefined): ComputerErrorCode;
|
|
47
46
|
/** Why labels are not ones a browser provider writes into a vendor's metadata, in words; undefined when they are. */
|
|
48
47
|
export declare function labelsProblem(labels: unknown): string | undefined;
|
|
49
48
|
/** A label a vendor's query can carry as it is: plain characters, so a quote never ends the query early. */
|
|
@@ -117,9 +116,9 @@ export declare class BrowserVendorError extends Error {
|
|
|
117
116
|
export declare const plainCode: (code: unknown) => string | undefined;
|
|
118
117
|
/**
|
|
119
118
|
* A vendor call's thrown error as a result: aborted, or the code its status reads as, in words that name the call and the
|
|
120
|
-
* status alone. The error itself rides along as the failure's hidden cause (
|
|
119
|
+
* status alone. The error itself rides along as the failure's hidden cause (causedFail). vendor is the provider's id.
|
|
121
120
|
*/
|
|
122
|
-
export declare function vendorFailure(vendor:
|
|
121
|
+
export declare function vendorFailure(vendor: string, name: string, call: string, error: unknown): Result<never>;
|
|
123
122
|
/**
|
|
124
123
|
* Why a vendor's CDP URL is not one to hand a driver, in words that never carry it; undefined when it is. It must be wss:
|
|
125
124
|
* (the session's signing key rides it) on the vendor's own domain or a host under it: a vendor answer that named another
|
package/dist/browser.js
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
import { PROTOCOL_VERSION } from "./protocol.js";
|
|
7
7
|
import { checkGpu, checkLifetime } from "./provider.js";
|
|
8
|
-
import { fail, ok } from "./result.js";
|
|
9
|
-
|
|
10
|
-
export const BROWSER_IMAGE = "chromium";
|
|
8
|
+
import { errorOf, fail, ok } from "./result.js";
|
|
9
|
+
import { BROWSER_IMAGE } from "./descriptors/shared.js";
|
|
11
10
|
/** A key's or a value's longest, in characters: what both vendors keep of a metadata entry. */
|
|
12
11
|
const MAX_LABEL = 256;
|
|
13
12
|
export const memoryUrls = () => {
|
|
@@ -16,24 +15,27 @@ export const memoryUrls = () => {
|
|
|
16
15
|
};
|
|
17
16
|
export const DEFAULT_CONFIRM = { polls: 6, intervalMs: 500 };
|
|
18
17
|
export const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A failure whose cause rides along out of sight: not enumerable, so it is in no JSON, no log line and no report. With
|
|
20
|
+
* code vendor, vendor (the provider's id) names whose.
|
|
21
|
+
*/
|
|
22
|
+
export function causedFail(code, message, cause, vendor) {
|
|
23
|
+
const failed = { ok: false, error: errorOf(code, message, vendor) };
|
|
22
24
|
if (cause !== undefined && !failed.ok)
|
|
23
25
|
Object.defineProperty(failed.error, "cause", { value: cause, enumerable: false });
|
|
24
26
|
return failed;
|
|
25
27
|
}
|
|
26
|
-
/** The error a vendor call threw, behind a failure
|
|
28
|
+
/** The error a vendor call threw, behind a failure causedFail made; undefined for any other. */
|
|
27
29
|
export const causeOf = (result) => (result.ok ? undefined : result.error.cause);
|
|
28
|
-
/** The code a vendor's HTTP status reads as. */
|
|
29
|
-
export function statusCode(status
|
|
30
|
+
/** The code a vendor's HTTP status reads as: one of ours, or vendor. */
|
|
31
|
+
export function statusCode(status) {
|
|
30
32
|
if (status === 401 || status === 403)
|
|
31
33
|
return "denied";
|
|
32
34
|
if (status === 404)
|
|
33
35
|
return "not_found";
|
|
34
36
|
if (status === 429)
|
|
35
37
|
return "limit";
|
|
36
|
-
return vendor;
|
|
38
|
+
return "vendor";
|
|
37
39
|
}
|
|
38
40
|
/** Why labels are not ones a browser provider writes into a vendor's metadata, in words; undefined when they are. */
|
|
39
41
|
export function labelsProblem(labels) {
|
|
@@ -216,15 +218,15 @@ export const plainCode = (code) => (typeof code === "string" && /^[a-z][a-z_.-]{
|
|
|
216
218
|
const isAbort = (error) => error?.name === "AbortError";
|
|
217
219
|
/**
|
|
218
220
|
* A vendor call's thrown error as a result: aborted, or the code its status reads as, in words that name the call and the
|
|
219
|
-
* status alone. The error itself rides along as the failure's hidden cause (
|
|
221
|
+
* status alone. The error itself rides along as the failure's hidden cause (causedFail). vendor is the provider's id.
|
|
220
222
|
*/
|
|
221
223
|
export function vendorFailure(vendor, name, call, error) {
|
|
222
224
|
if (isAbort(error))
|
|
223
|
-
return
|
|
225
|
+
return causedFail("aborted", `${name} ${call} was aborted`, error, vendor);
|
|
224
226
|
const status = error?.status;
|
|
225
|
-
const code = typeof status === "number" ? statusCode(status
|
|
227
|
+
const code = typeof status === "number" ? statusCode(status) : "vendor";
|
|
226
228
|
const words = error instanceof BrowserVendorError ? error.message : typeof status === "number" ? `${name} ${call} answered ${status}` : `${name} ${call} failed`;
|
|
227
|
-
return
|
|
229
|
+
return causedFail(code, words, error, vendor);
|
|
228
230
|
}
|
|
229
231
|
/**
|
|
230
232
|
* Why a vendor's CDP URL is not one to hand a driver, in words that never carry it; undefined when it is. It must be wss:
|
package/dist/browserbase.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BrowserStream, type ReleaseConfirm, type UrlStore } from "./browser.js";
|
|
2
2
|
import type { KindCapabilities } from "./kinds.js";
|
|
3
3
|
import type { MountKind } from "./mount.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
|
|
5
5
|
import { type Result } from "./result.js";
|
|
6
6
|
export declare const BROWSERBASE_API_URL = "https://api.browserbase.com";
|
|
7
7
|
/** The domain a Browserbase CDP URL is on (wss://connect.browserbase.com, read live 11-08): cdpUrlProblem holds it there. */
|
|
@@ -18,9 +18,7 @@ export declare const labelKey: (metadataKey: string) => string;
|
|
|
18
18
|
export declare function browserbaseLabelsProblem(labels: unknown): string | undefined;
|
|
19
19
|
/** A browser takes no mount. */
|
|
20
20
|
export declare const MOUNT: readonly MountKind[];
|
|
21
|
-
/** The
|
|
22
|
-
export declare const NETWORK: readonly NetworkForm[];
|
|
23
|
-
/** The one configuration it offers, the kind registry's entry (kinds.ts): a browser with a CDP target and a live view. */
|
|
21
|
+
/** The one configuration it offers, its descriptor's: a browser with a CDP target and a live view. */
|
|
24
22
|
export declare const CAPABILITIES: readonly KindCapabilities[];
|
|
25
23
|
/** A session as Browserbase answers it; only what the provider reads. */
|
|
26
24
|
export interface BrowserbaseSession {
|
|
@@ -126,7 +124,7 @@ export declare class BrowserbaseProvider implements ComputerProvider {
|
|
|
126
124
|
*/
|
|
127
125
|
connect(ref: ComputerRef): Promise<Result<ComputerConnection>>;
|
|
128
126
|
/** Asks Browserbase to release the session and waits until it reads as ended; one already ended or unknown is released. */
|
|
129
|
-
release(ref: ComputerRef, how:
|
|
127
|
+
release(ref: ComputerRef, how: ReleaseHow, { signal }?: CallContext): Promise<Result<void>>;
|
|
130
128
|
/** The session's live view, which takes input: a view-only one is refused, never handed over as one. */
|
|
131
129
|
stream(ref: ComputerRef, options?: {
|
|
132
130
|
viewOnly?: boolean;
|
package/dist/browserbase.js
CHANGED
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
// label key of letters, digits and dots alone, so no label key holds an "_" and the mapping is one to one; a value with
|
|
16
16
|
// ' or \ is refused too, since list's query quotes it.
|
|
17
17
|
import { readFileSync } from "node:fs";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { BROWSERBASE } from "./descriptors/browserbase.js";
|
|
19
|
+
import { BROWSER_IMAGE } from "./descriptors/shared.js";
|
|
20
|
+
import { cdpUrlProblem, browserClient, browserHello, BrowserVendorError, CREATE_LABEL, carries, causeOf, checkBrowser, createLabelValue, createUncertain, DEFAULT_CONFIRM, defaultSleep, httpsBase, idProblem, labelsOf, labelsProblem, memoryUrls, queryable, recoverCreate, releaseConfirmed, restCall, causedFail, vendorFailure, withoutCreateLabel, } from "./browser.js";
|
|
21
|
+
import { runLifetimeMs, } from "./provider.js";
|
|
22
|
+
import { failFor, ok, vendorFail } from "./result.js";
|
|
20
23
|
import { connectionError } from "./test-connection.js";
|
|
24
|
+
/** This module's failures: one with code vendor names Browserbase. */
|
|
25
|
+
const fail = failFor("browserbase");
|
|
21
26
|
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
22
27
|
const NAME = "Browserbase";
|
|
23
28
|
export const BROWSERBASE_API_URL = "https://api.browserbase.com";
|
|
@@ -56,11 +61,9 @@ export function browserbaseLabelsProblem(labels) {
|
|
|
56
61
|
return undefined;
|
|
57
62
|
}
|
|
58
63
|
/** A browser takes no mount. */
|
|
59
|
-
export const MOUNT =
|
|
60
|
-
/** The
|
|
61
|
-
export const
|
|
62
|
-
/** The one configuration it offers, the kind registry's entry (kinds.ts): a browser with a CDP target and a live view. */
|
|
63
|
-
export const CAPABILITIES = [{ kind: "browser", groups: ["cdp", "stream"] }];
|
|
64
|
+
export const MOUNT = BROWSERBASE.mounts;
|
|
65
|
+
/** The one configuration it offers, its descriptor's: a browser with a CDP target and a live view. */
|
|
66
|
+
export const CAPABILITIES = BROWSERBASE.capabilities;
|
|
64
67
|
/** Browserbase's v1 REST API over fetch: the default api. */
|
|
65
68
|
export function browserbaseRest({ apiKey, apiUrl = BROWSERBASE_API_URL, projectId, fetch: fetcher = fetch }) {
|
|
66
69
|
const o = { vendor: NAME, fetch: fetcher, base: httpsBase(apiUrl, "the Browserbase API URL"), headers: { "X-BB-API-Key": apiKey } };
|
|
@@ -140,7 +143,7 @@ export class BrowserbaseProvider {
|
|
|
140
143
|
return {
|
|
141
144
|
kind: "browser",
|
|
142
145
|
lifetime: "vendor",
|
|
143
|
-
network: [...
|
|
146
|
+
network: [...BROWSERBASE.network],
|
|
144
147
|
isolation: "vm",
|
|
145
148
|
os: "linux",
|
|
146
149
|
daemon: "none",
|
|
@@ -173,7 +176,7 @@ export class BrowserbaseProvider {
|
|
|
173
176
|
const written = { [CREATE_LABEL]: createLabelValue(), ...spec.labels };
|
|
174
177
|
const body = {
|
|
175
178
|
...settings,
|
|
176
|
-
timeout: Math.ceil(spec
|
|
179
|
+
timeout: Math.ceil(runLifetimeMs(spec) / 1000),
|
|
177
180
|
keepAlive: true,
|
|
178
181
|
userMetadata: toMetadata(written),
|
|
179
182
|
...(this.#projectId ? { projectId: this.#projectId } : {}),
|
|
@@ -187,16 +190,16 @@ export class BrowserbaseProvider {
|
|
|
187
190
|
if (failed.ok || !createUncertain(error))
|
|
188
191
|
return failed;
|
|
189
192
|
// The session may have been made though its answer never came: found by its create label, never made again.
|
|
190
|
-
return
|
|
193
|
+
return causedFail(failed.error.code, `${failed.error.message}; ${await this.#recover(written)}`, causeOf(failed), "browserbase");
|
|
191
194
|
}
|
|
192
195
|
if (idProblem(made?.id, NAME) !== undefined) {
|
|
193
|
-
return
|
|
196
|
+
return vendorFail("browserbase", `Browserbase POST /v1/sessions answered with no session id, so there is no session to connect to; ${await this.#recover(written)}`);
|
|
194
197
|
}
|
|
195
198
|
const unusable = cdpUrlProblem(made.connectUrl, NAME, CDP_DOMAIN);
|
|
196
199
|
if (unusable !== undefined) {
|
|
197
200
|
// The session is made and billed (keepAlive, up to its timeout): released here, not left to a later sweep.
|
|
198
201
|
const released = await this.release(refOf(made), "delete");
|
|
199
|
-
return
|
|
202
|
+
return vendorFail("browserbase", `Browserbase POST /v1/sessions made a session with no CDP URL to hand over: ${unusable}; ${released.ok ? "the session was released" : `the session was not released (${released.error.code}), and its labels let a sweep find it`}`);
|
|
200
203
|
}
|
|
201
204
|
this.#urls.set(made.id, made.connectUrl);
|
|
202
205
|
return ok(refOf(made));
|
|
@@ -344,7 +347,7 @@ export class BrowserbaseProvider {
|
|
|
344
347
|
// Whatever held it (create, a read, a host's url store), a URL a driver would dial is wss: on Browserbase's own domain.
|
|
345
348
|
const unusable = cdpUrlProblem(url, NAME, CDP_DOMAIN);
|
|
346
349
|
if (unusable !== undefined)
|
|
347
|
-
return
|
|
350
|
+
return vendorFail("browserbase", `the Browserbase session ${id} is not handed over: ${unusable}`);
|
|
348
351
|
this.#urls.set(id, url);
|
|
349
352
|
const hello = browserHello(VERSION, this.capabilities().groups);
|
|
350
353
|
const client = browserClient(hello, (signal) => this.#alive(id, signal));
|
package/dist/chrome.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Launching a Chrome on this machine, the pieces the local browser (local.ts, local-supervisor.ts) is made of. Moved
|
|
1
|
+
// Launching a Chrome on this machine, the pieces the local browser (local-chrome.ts, local-supervisor.ts) is made of. Moved
|
|
2
2
|
// here from pi-browser, which starts its own local Chrome (packages/pi-browser/src/providers/chrome-args.ts findChrome, and
|
|
3
3
|
// src/providers/cdp.ts alive, leadsOwnGroup, killTree, ownDebugger and singletonDir), so pi-browser can import them back
|
|
4
4
|
// once it depends on this package; and the fence and sandbox check of PR #1718's local Chrome for serve
|
|
Binary file
|
|
Binary file
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// reads no environment: this module reads its own COMPUTER_BROWSERBASE_* names (never BROWSERBASE_API_KEY, which may
|
|
5
5
|
// hold another project's key) and passes each to create() as its option. The live switch is checked first, before any
|
|
6
6
|
// other setting is read. The run makes one session, shared by every case, and releases it.
|
|
7
|
-
import { BROWSER_IMAGE } from "../
|
|
7
|
+
import { BROWSER_IMAGE } from "../descriptors/shared.js";
|
|
8
8
|
import { create } from "../browserbase.js";
|
|
9
9
|
/** The environment this module reads, by name, each for the option its comment names, and the live switch. */
|
|
10
10
|
export const BROWSERBASE_ENV = {
|