@parcha/agentrun-computer 0.1.0-beta.37 → 0.1.0-beta.39
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 +341 -260
- package/box/Dockerfile +18 -1
- package/box/README.md +14 -0
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +41 -18
- package/box/recipe.d.mts +5 -0
- package/box/recipe.mjs +43 -0
- package/dist/agent37.d.ts +18 -66
- package/dist/agent37.js +187 -464
- package/dist/box-image.d.ts +14 -0
- package/dist/box-image.js +24 -0
- package/dist/browserbase.d.ts +0 -6
- package/dist/browserbase.js +1 -5
- package/dist/client.d.ts +12 -3
- package/dist/client.js +39 -4
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +4 -0
- package/dist/conformance/agent37.d.ts +9 -4
- package/dist/conformance/agent37.js +23 -11
- package/dist/conformance/browserbase.js +3 -3
- package/dist/conformance/cases/apps.d.ts +6 -0
- package/dist/conformance/cases/apps.js +18 -5
- package/dist/conformance/cases/isolation.d.ts +22 -5
- package/dist/conformance/cases/isolation.js +97 -16
- package/dist/conformance/cases/mount.js +5 -3
- package/dist/conformance/cases/provider.js +41 -0
- package/dist/conformance/cli.js +72 -11
- package/dist/conformance/daytona.d.ts +9 -20
- package/dist/conformance/daytona.js +12 -21
- package/dist/conformance/e2b.js +9 -4
- package/dist/conformance/exec-stream.d.ts +52 -0
- package/dist/conformance/exec-stream.js +493 -0
- package/dist/conformance/kernel.js +2 -2
- package/dist/conformance/modal.js +1 -1
- package/dist/conformance/orgo.js +2 -2
- package/dist/conformance/sweep.js +8 -8
- package/dist/conformance/types.d.ts +2 -2
- package/dist/create-requests.d.ts +1 -1
- package/dist/daytona.d.ts +17 -133
- package/dist/daytona.js +396 -1452
- package/dist/descriptor.d.ts +11 -4
- package/dist/descriptor.js +7 -0
- package/dist/descriptors/agent37.d.ts +3 -11
- package/dist/descriptors/agent37.js +9 -10
- package/dist/descriptors/daytona.d.ts +7 -6
- package/dist/descriptors/daytona.js +14 -7
- package/dist/descriptors/docker.d.ts +13 -1
- package/dist/descriptors/docker.js +3 -1
- package/dist/descriptors/e2b.d.ts +2 -9
- package/dist/descriptors/e2b.js +8 -8
- package/dist/descriptors/index.d.ts +25 -24
- package/dist/descriptors/index.js +1 -3
- package/dist/descriptors/modal.d.ts +2 -6
- package/dist/descriptors/modal.js +8 -6
- package/dist/descriptors/orgo.js +2 -1
- package/dist/descriptors/shared.d.ts +1 -1
- package/dist/descriptors/shared.js +2 -2
- package/dist/desktop.d.ts +18 -4
- package/dist/desktop.js +89 -9
- package/dist/docker/egress-main.js +23 -15
- package/dist/docker/egress.d.ts +6 -4
- package/dist/docker/egress.js +24 -16
- package/dist/docker/inspect.d.ts +2 -2
- package/dist/docker/inspect.js +5 -5
- package/dist/docker.d.ts +6 -11
- package/dist/docker.js +13 -16
- package/dist/drift.js +4 -4
- package/dist/e2b.d.ts +22 -130
- package/dist/e2b.js +163 -243
- package/dist/host.d.ts +136 -104
- package/dist/host.js +8 -1
- package/dist/hosted/network.d.ts +23 -0
- package/dist/hosted/network.js +77 -0
- package/dist/hosted/process.d.ts +24 -8
- package/dist/hosted/process.js +80 -44
- package/dist/hosted/provider.d.ts +38 -22
- package/dist/hosted/provider.js +500 -341
- package/dist/hosted/rest.d.ts +74 -0
- package/dist/hosted/rest.js +126 -0
- package/dist/hosted/scripts.d.ts +21 -3
- package/dist/hosted/scripts.js +76 -14
- package/dist/hosted/ssh-exec.d.ts +99 -0
- package/dist/hosted/ssh-exec.js +464 -0
- package/dist/hosted/values.d.ts +26 -0
- package/dist/hosted/values.js +63 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/isolation.d.ts +0 -2
- package/dist/isolation.js +3 -4
- package/dist/kernel.d.ts +0 -6
- package/dist/kernel.js +1 -5
- package/dist/kinds.d.ts +3 -1
- package/dist/local-chrome.d.ts +0 -6
- package/dist/local-chrome.js +1 -5
- package/dist/modal.d.ts +15 -86
- package/dist/modal.js +67 -185
- package/dist/mount-archil.d.ts +13 -8
- package/dist/mount-archil.js +27 -17
- package/dist/mount.d.ts +10 -4
- package/dist/mount.js +8 -4
- package/dist/orgo.d.ts +0 -9
- package/dist/orgo.js +8 -13
- package/dist/phone-harness.d.ts +0 -6
- package/dist/phone-harness.js +0 -4
- package/dist/protocol.d.ts +4 -1
- package/dist/protocol.js +1 -0
- package/dist/provider.d.ts +2 -2
- package/dist/providers.d.ts +15 -13
- package/dist/screen-watch.js +34 -6
- package/dist/surface/api.d.ts +14 -11
- package/dist/surface/core.d.ts +23 -5
- package/dist/surface/core.js +105 -15
- package/dist/surface/index.d.ts +1 -1
- package/dist/surface/index.js +1 -1
- package/dist/surface/outline.d.ts +2 -0
- package/dist/surface/outline.js +2 -1
- package/dist/surface/script.d.ts +4 -0
- package/dist/surface/script.js +11 -3
- package/dist/ui-engine.js +19 -3
- package/package.json +2 -3
- package/box/build-agent37.mjs +0 -177
- package/dist/conformance/daytona-sweep.d.ts +0 -18
- package/dist/conformance/daytona-sweep.js +0 -126
package/box/Dockerfile
CHANGED
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
# the computer's, which reaches Archil;
|
|
11
11
|
# - nftables, for the helper's mount with an egress gateway alone: it redirects root's TCP to Archil's 8100 and 32050
|
|
12
12
|
# to computerd's archil relay on the computer's loopback;
|
|
13
|
-
# - /workspace, empty and root's, where the helper mounts the run's folder
|
|
13
|
+
# - /workspace, empty and root's, where the helper mounts the run's folder;
|
|
14
|
+
# - a desktop, with nothing started: Xvfb and xfwm4 (with dbus-run-session, which xfconf's packages bring) and
|
|
15
|
+
# xsetroot (x11-xserver-utils, the desktop's background), which the provider starts through computerd as the tool
|
|
16
|
+
# user on :0 (src/desktop.ts), and the apps E2B Desktop has that are cheap to carry: Xfce's terminal and text editor,
|
|
17
|
+
# Firefox ESR, and xdotool. computerd's apps group lists and opens them by their desktop files. No VNC server comes
|
|
18
|
+
# with it. One image serves a sandbox and a desktop (an Agent37 desktop starts from it too).
|
|
14
19
|
#
|
|
15
20
|
# No sudo and no sudoers file: the image's user is root, so the provider's own exec (Daytona's toolbox, Modal's exec,
|
|
16
21
|
# E2B's commands as root) runs the helper as root, and the tool user has no way to root. The build fails if the base
|
|
@@ -46,6 +51,18 @@ RUN set -eu; \
|
|
|
46
51
|
useradd --uid 2510 --gid 2510 --no-create-home --home-dir /tmp --shell /bin/sh agentrun-tool; \
|
|
47
52
|
install -d -o root -g root -m 0755 /workspace
|
|
48
53
|
|
|
54
|
+
# The desktop: Xvfb and xfwm4, which the provider starts through computerd as the tool user on :0, and the apps an agent
|
|
55
|
+
# opens. Each program and each app's desktop file is checked here. It comes before the sudo guard below, so a package
|
|
56
|
+
# that brought sudo would be taken away and checked gone there (a check here would refuse E2B's build, whose builder adds
|
|
57
|
+
# sudo before these steps).
|
|
58
|
+
RUN set -eu; \
|
|
59
|
+
apt-get update -qq; \
|
|
60
|
+
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
|
|
61
|
+
xvfb xfwm4 x11-xserver-utils xfce4-terminal mousepad firefox-esr xdotool fonts-dejavu-core adwaita-icon-theme >/dev/null; \
|
|
62
|
+
rm -rf /var/lib/apt/lists/*; \
|
|
63
|
+
for x in Xvfb xfwm4 dbus-run-session xsetroot xfce4-terminal mousepad firefox-esr xdotool; do command -v "$x" >/dev/null || { echo "the image has no $x" >&2; exit 1; }; done; \
|
|
64
|
+
for app in org.xfce.mousepad xfce4-terminal firefox-esr; do [ -f "/usr/share/applications/$app.desktop" ] || { echo "the image has no desktop file $app.desktop" >&2; exit 1; }; done
|
|
65
|
+
|
|
49
66
|
COPY agentrun-archil /usr/local/sbin/agentrun-archil
|
|
50
67
|
|
|
51
68
|
# What the helper runs, where it runs it from: an image that lacks one fails here, not at a run's first mount. And no
|
package/box/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# The box image
|
|
2
|
+
|
|
3
|
+
The image a remote computer with an Archil mount starts from: a small Debian with a coding agent's tools, the archil
|
|
4
|
+
client pinned by version and sha256, the root helper `agentrun-archil`, the tool user `agentrun-tool` (uid and gid
|
|
5
|
+
2510), FUSE and nftables, a desktop with nothing started (Xvfb, xfwm4 and the apps an agent opens), and no sudo. One
|
|
6
|
+
image serves a sandbox and a desktop. The Dockerfile's comment says what each part is for.
|
|
7
|
+
|
|
8
|
+
Its tag is the recipe's hash: the first 12 hex of the sha256 of `Dockerfile` and `agentrun-archil`, the one file it
|
|
9
|
+
copies (`recipe.mjs`). A changed recipe is a new image, and the same recipe is the one built before.
|
|
10
|
+
|
|
11
|
+
Each release publishes it (`.github/workflows/release.yml`, the `box` job) as `ghcr.io/parcha-ai/agentrun-box:<recipe hash>`
|
|
12
|
+
and `:<release tag>`, for linux/amd64, and builds the public E2B template `agentrun-archil-<recipe hash>` from it (the
|
|
13
|
+
`box-e2b` job), which E2B's provider starts in any account as `boxE2bTemplate()` (`src/box-image.ts`). The build-*
|
|
14
|
+
scripts here say how to build it for each provider.
|
package/box/build-daytona.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Build the Archil image (this folder's Dockerfile) as a Daytona snapshot, with Daytona's Python SDK (`pip install
|
|
2
|
-
# daytona`) and its key in DAYTONA_API_KEY, and print the snapshot's name
|
|
3
|
-
#
|
|
2
|
+
# daytona`) and its key in DAYTONA_API_KEY, and print the snapshot's name, which a Daytona computer's spec names as its
|
|
3
|
+
# image (no Daytona computer takes an Archil mount: Archil's client hangs on its sandboxes). The name is the recipe's hash (the Dockerfile and the files it copies), so a changed recipe is
|
|
4
4
|
# a new snapshot, and the same recipe is the one built before: Daytona then refuses the name, and the printed name is
|
|
5
5
|
# the one to use. Its size is 2 CPUs, 4 GB of memory and a 10 GB disk.
|
|
6
6
|
#
|
package/box/build-e2b.mjs
CHANGED
|
@@ -1,32 +1,55 @@
|
|
|
1
|
-
// Build the Archil image
|
|
2
|
-
// the
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// and 4 GB of memory.
|
|
1
|
+
// Build the Archil image as an E2B template, with the host's own e2b SDK (in this repository, the root devDependency
|
|
2
|
+
// the lock pins) and its key in E2B_API_KEY, and print the template's name: an E2B computer with an Archil mount names it
|
|
3
|
+
// as its spec's image. The name is agentrun-archil-<the recipe's hash> (recipe.mjs), so a changed recipe is a new
|
|
4
|
+
// template, and the same recipe is the one built before (E2B's cache). Its size is 2 CPUs and 4 GB of memory.
|
|
6
5
|
//
|
|
7
|
-
// E2B_API_KEY=... node packages/computer/box/build-e2b.mjs
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
// E2B_API_KEY=... node packages/computer/box/build-e2b.mjs [--image <ref>] [--public]
|
|
7
|
+
//
|
|
8
|
+
// With no --image it builds this folder's Dockerfile. --image builds from the published box image instead
|
|
9
|
+
// (ghcr.io/parcha-ai/agentrun-box:<the recipe's hash>, release.yml's box job), whose tag must be this recipe's hash; on
|
|
10
|
+
// it the Dockerfile's sudo guard runs again, and its USER and CMD are the template's (recipe.mjs onImage).
|
|
11
|
+
//
|
|
12
|
+
// --public makes the template public once it is built (E2B's v2 PATCH /v2/templates/{id}, public: true), so another
|
|
13
|
+
// team's sandbox starts from it, and prints the names E2B gives it. release.yml's box-e2b job runs both.
|
|
10
14
|
import { dirname, join } from "node:path";
|
|
11
15
|
import { fileURLToPath } from "node:url";
|
|
16
|
+
import { parseArgs } from "node:util";
|
|
17
|
+
import { onImage, recipeHash } from "./recipe.mjs";
|
|
18
|
+
|
|
19
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const hash = recipeHash(here);
|
|
21
|
+
const name = "agentrun-archil-" + hash;
|
|
12
22
|
|
|
23
|
+
const { values } = parseArgs({ options: { image: { type: "string" }, public: { type: "boolean", default: false } } });
|
|
24
|
+
if (values.image !== undefined && !values.image.endsWith(`:${hash}`)) {
|
|
25
|
+
console.error(`build-e2b: ${values.image} is not this recipe's image: its tag must be the recipe's hash, ${hash}`);
|
|
26
|
+
process.exit(2);
|
|
27
|
+
}
|
|
28
|
+
if (!process.env.E2B_API_KEY) {
|
|
29
|
+
console.error("build-e2b: set E2B_API_KEY to the key of the E2B team the template is built in");
|
|
30
|
+
process.exit(2);
|
|
31
|
+
}
|
|
13
32
|
/** The host's own SDK, as the E2B provider takes it: by a name that is not a literal, never this package's dependency. */
|
|
14
33
|
const E2B_PACKAGE = "e2b";
|
|
15
|
-
const { Template } = await import(E2B_PACKAGE).catch(() => {
|
|
34
|
+
const { Template, ApiClient, ConnectionConfig } = await import(E2B_PACKAGE).catch(() => {
|
|
16
35
|
console.error(`build-e2b: the ${E2B_PACKAGE} package is not installed: run npm ci at the repository root (it is a root devDependency there), or install ${E2B_PACKAGE} beside this script`);
|
|
17
36
|
process.exit(2);
|
|
18
37
|
});
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const RECIPE = ["Dockerfile", "agentrun-archil"];
|
|
23
|
-
const recipe = Buffer.concat(RECIPE.map((name) => readFileSync(join(here, name))));
|
|
24
|
-
const name = "agentrun-archil-" + createHash("sha256").update(recipe).digest("hex").slice(0, 12);
|
|
25
|
-
console.error(`build-e2b: template ${name}`);
|
|
26
|
-
const template = Template({ fileContextPath: here }).fromDockerfile(join(here, "Dockerfile"));
|
|
27
|
-
await Template.build(template, name, {
|
|
38
|
+
console.error(`build-e2b: template ${name}${values.image ? ` from ${values.image}` : ""}`);
|
|
39
|
+
const template = Template({ fileContextPath: here }).fromDockerfile(values.image ? onImage(values.image) : join(here, "Dockerfile"));
|
|
40
|
+
const built = await Template.build(template, name, {
|
|
28
41
|
cpuCount: 2,
|
|
29
42
|
memoryMB: 4096,
|
|
30
43
|
onBuildLogs: (entry) => console.error(String(entry?.message ?? entry)),
|
|
31
44
|
});
|
|
45
|
+
if (values.public) {
|
|
46
|
+
const client = new ApiClient(new ConnectionConfig({ apiKey: process.env.E2B_API_KEY }));
|
|
47
|
+
const { data, error, response } = await client.api.PATCH("/v2/templates/{templateID}", { params: { path: { templateID: built.templateId } }, body: { public: true } });
|
|
48
|
+
if (error) {
|
|
49
|
+
console.error(`build-e2b: making ${name} public failed: ${response.status} ${error.message ?? JSON.stringify(error)}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
console.error(`build-e2b: ${name} is public as ${data.names.join(", ")}`);
|
|
53
|
+
console.log(`public=${data.names.join(",")}`);
|
|
54
|
+
}
|
|
32
55
|
console.log(`template=${name}`);
|
package/box/recipe.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// recipe.mjs's types, for src/box-image.ts, which names the published image by the recipe's hash.
|
|
2
|
+
export declare const RECIPE: readonly string[];
|
|
3
|
+
export declare function recipeHash(dir?: string): string;
|
|
4
|
+
export declare function instructionMatching(dockerfile: string, pattern: RegExp): string;
|
|
5
|
+
export declare function onImage(image: string, dockerfile?: string): string;
|
package/box/recipe.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// The box image's recipe: the files it is made of (this folder's Dockerfile and what it copies) and their hash, the
|
|
2
|
+
// first 12 hex of their sha256. Every build names what it makes by that hash, so a changed recipe is a new image and the
|
|
3
|
+
// same recipe is the one built before: the E2B template agentrun-archil-<hash> (build-e2b.mjs), the Daytona snapshot
|
|
4
|
+
// of the same name (build-daytona.py hashes the same files), and the published image ghcr.io/parcha-ai/agentrun-box:<hash>
|
|
5
|
+
// (release.yml's box job reads recipeHash()).
|
|
6
|
+
//
|
|
7
|
+
// And the E2B template's Dockerfile on that published image (build-e2b.mjs --image): E2B's builder provisions a base
|
|
8
|
+
// before a template's steps, sudo among what it adds (the Dockerfile says so), so on the image the Dockerfile's sudo
|
|
9
|
+
// guard runs again, as root, and its USER and CMD are the template's.
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
12
|
+
import { dirname, join } from "node:path";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
|
|
15
|
+
/** Every file the image is made of: the Dockerfile and what it copies. */
|
|
16
|
+
export const RECIPE = ["Dockerfile", "agentrun-archil"];
|
|
17
|
+
|
|
18
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
|
|
20
|
+
/** The recipe's hash, read from dir: 12 hex. */
|
|
21
|
+
export function recipeHash(dir = here) {
|
|
22
|
+
const recipe = Buffer.concat(RECIPE.map((name) => readFileSync(join(dir, name))));
|
|
23
|
+
return createHash("sha256").update(recipe).digest("hex").slice(0, 12);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The Dockerfile's first instruction that pattern matches, its continuation lines kept. */
|
|
27
|
+
export function instructionMatching(dockerfile, pattern) {
|
|
28
|
+
const lines = dockerfile.split("\n");
|
|
29
|
+
for (let start = 0; start < lines.length; start++) {
|
|
30
|
+
if (!/^[A-Z]+ /.test(lines[start])) continue;
|
|
31
|
+
let end = start;
|
|
32
|
+
while (lines[end].endsWith("\\") && end + 1 < lines.length) end++;
|
|
33
|
+
const instruction = lines.slice(start, end + 1).join("\n");
|
|
34
|
+
if (pattern.test(instruction)) return instruction;
|
|
35
|
+
start = end;
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`the box Dockerfile has no instruction matching ${pattern}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The template's Dockerfile on the published image: the image, the Dockerfile's sudo guard again, its USER and CMD. */
|
|
41
|
+
export function onImage(image, dockerfile = readFileSync(join(here, "Dockerfile"), "utf8")) {
|
|
42
|
+
return [`FROM ${image}`, ...[/^RUN [^]*dpkg -s sudo/, /^USER /, /^CMD /].map((pattern) => instructionMatching(dockerfile, pattern))].join("\n") + "\n";
|
|
43
|
+
}
|
package/dist/agent37.d.ts
CHANGED
|
@@ -1,51 +1,7 @@
|
|
|
1
|
-
import { Duplex } from "node:stream";
|
|
2
1
|
import { HostedProvider, type HostedOptions, type HostedTimeouts } from "./hosted/provider.js";
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
export interface Ssh2Readable {
|
|
7
|
-
pipe(destination: NodeJS.WritableStream): unknown;
|
|
8
|
-
resume(): unknown;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* The slice of an ssh2 channel this provider uses (ssh2@1.17.0 lib/Channel.js): the channel is stdout. No signal
|
|
12
|
-
* request: ssh2 sends one only while stdin is open (Channel.js:237-246), so a kill goes by the process group instead.
|
|
13
|
-
*/
|
|
14
|
-
export interface Ssh2Channel extends Ssh2Readable {
|
|
15
|
-
readonly stderr: Ssh2Readable;
|
|
16
|
-
write(data: Uint8Array, callback?: (error?: Error | null) => void): boolean;
|
|
17
|
-
/** Sends end of file on stdin and keeps the channel open (Channel.js:200-205). */
|
|
18
|
-
eof(): void;
|
|
19
|
-
close(): void;
|
|
20
|
-
/** exit-status, or exit-signal with a null code (client.js:666-678). */
|
|
21
|
-
on(event: "exit", listener: (code: number | null, signal?: string) => void): unknown;
|
|
22
|
-
on(event: "close", listener: () => void): unknown;
|
|
23
|
-
on(event: "error", listener: (error: Error) => void): unknown;
|
|
24
|
-
}
|
|
25
|
-
/** The options of ssh2's Client.connect this provider gives (ssh2@1.17.0 lib/client.js). */
|
|
26
|
-
export interface Ssh2ConnectConfig {
|
|
27
|
-
sock: Duplex;
|
|
28
|
-
username: "root";
|
|
29
|
-
privateKey: string;
|
|
30
|
-
readyTimeout: number;
|
|
31
|
-
keepaliveInterval: number;
|
|
32
|
-
}
|
|
33
|
-
/** The slice of an ssh2 Client this provider uses. */
|
|
34
|
-
export interface Ssh2Client {
|
|
35
|
-
connect(config: Ssh2ConnectConfig): unknown;
|
|
36
|
-
exec(command: string, callback: (error: Error | undefined, channel: Ssh2Channel) => void): unknown;
|
|
37
|
-
end(): unknown;
|
|
38
|
-
destroy(): unknown;
|
|
39
|
-
once(event: "ready", listener: () => void): unknown;
|
|
40
|
-
once(event: "error", listener: (error: Error) => void): unknown;
|
|
41
|
-
on(event: "error", listener: (error: Error) => void): unknown;
|
|
42
|
-
on(event: "close", listener: () => void): unknown;
|
|
43
|
-
removeListener(event: "error", listener: (error: Error) => void): unknown;
|
|
44
|
-
}
|
|
45
|
-
/** The ssh2 package as this provider uses it: its Client class. The host's own, or anything with the same slice. */
|
|
46
|
-
export interface Ssh2Module {
|
|
47
|
-
Client: new () => Ssh2Client;
|
|
48
|
-
}
|
|
2
|
+
import { type Ssh2Module } from "./hosted/ssh-exec.js";
|
|
3
|
+
import type { CallContext } from "./provider.js";
|
|
4
|
+
import { type Result } from "./result.js";
|
|
49
5
|
/** A WebSocket as this provider uses one: Node's global WebSocket (undici), which takes headers, or the same slice. */
|
|
50
6
|
export interface WebSocketLike {
|
|
51
7
|
binaryType: string;
|
|
@@ -94,7 +50,7 @@ export type Agent37Type = "vm" | "default";
|
|
|
94
50
|
/** Where an instance runs (docs: agents-api/instances/create, region). */
|
|
95
51
|
export type Agent37Region = "us" | "eu" | "ap-south";
|
|
96
52
|
/** The Agent37 provider's options: the key, the SSH key and ssh2, then the shared adapter's (HostedOptions). */
|
|
97
|
-
export interface Agent37ProviderOptions extends Omit<HostedOptions, "
|
|
53
|
+
export interface Agent37ProviderOptions extends Omit<HostedOptions, "maxLifetimeMs"> {
|
|
98
54
|
/** The workspace's API key (sk_live_...). The caller passes it; this provider never reads it from the environment. */
|
|
99
55
|
apiKey: string;
|
|
100
56
|
/**
|
|
@@ -118,7 +74,7 @@ export interface Agent37ProviderOptions extends Omit<HostedOptions, "label" | "m
|
|
|
118
74
|
region?: Agent37Region;
|
|
119
75
|
/**
|
|
120
76
|
* linux (default): no screen; desktop: an X server started through the daemon (Xvfb on :0 unless options.desktop says
|
|
121
|
-
* otherwise), so the spec's image is a template that has one: our box template,
|
|
77
|
+
* otherwise), so the spec's image is a template that has one: our box template, which prepareImage() registers.
|
|
122
78
|
*/
|
|
123
79
|
kind?: "desktop" | "linux";
|
|
124
80
|
/** The longest lifetime check takes: 24 h by default, the janitor's cap; Agent37 itself never ends an instance. */
|
|
@@ -131,21 +87,6 @@ export interface Agent37Options extends Omit<Agent37ProviderOptions, "ssh2"> {
|
|
|
131
87
|
}
|
|
132
88
|
/** The port the platform's sshd answers on inside every instance, reached as {id}-22022.<domain> (cli.js:21, 720). */
|
|
133
89
|
export declare const AGENT37_SSH_PORT = 22022;
|
|
134
|
-
/** The mount kinds an Agent37 computer takes, as capabilities().mount declares them: the run's folder on an Archil disk. */
|
|
135
|
-
export declare const MOUNT: readonly MountKind[];
|
|
136
|
-
/** The machine kind and groups of each configuration: kind linux (the default), and kind desktop on the box template. */
|
|
137
|
-
export declare const CAPABILITIES: readonly KindCapabilities[];
|
|
138
|
-
/** An answer of Agent37's REST API that is not a success: its HTTP status and the envelope's stable code (docs: errors). */
|
|
139
|
-
export declare class Agent37Error extends Error {
|
|
140
|
-
name: string;
|
|
141
|
-
readonly status: number;
|
|
142
|
-
readonly code: string | undefined;
|
|
143
|
-
constructor(status: number, code: string | undefined, message: string);
|
|
144
|
-
}
|
|
145
|
-
/** The SSH tunnel's WebSocket closed or failed before it opened, or while it carried the stream. */
|
|
146
|
-
export declare class Agent37TunnelError extends Error {
|
|
147
|
-
name: string;
|
|
148
|
-
}
|
|
149
90
|
/**
|
|
150
91
|
* An Agent37Provider from its options alone; it reads no environment. The key is options.apiKey and the SSH key
|
|
151
92
|
* options.sshKey, nowhere else (serve passes its AGENT37_API_KEY and AGENT37_SSH_KEY, the conformance module what it
|
|
@@ -155,10 +96,21 @@ export declare function create(options: Agent37Options): Promise<Agent37Provider
|
|
|
155
96
|
/** The conformance CLI's module for Agent37: its live switch, the run's cap, its template and the drifted twin. */
|
|
156
97
|
export declare const conformance: () => Promise<typeof import("./conformance/agent37.js")>;
|
|
157
98
|
/**
|
|
158
|
-
* Computers that are Agent37 instances, on the shared adapter. A spec's image is an Agent37 template's name
|
|
159
|
-
* "agent37-base", Agent37's plain Linux
|
|
99
|
+
* Computers that are Agent37 instances, on the shared adapter. A spec's image is an Agent37 template's name, such as
|
|
100
|
+
* "agent37-base", Agent37's plain Linux. A server starts every one from the template prepareImage() answers: our box
|
|
101
|
+
* image, registered in the key's own workspace.
|
|
160
102
|
*/
|
|
161
103
|
export declare class Agent37Provider extends HostedProvider {
|
|
104
|
+
/**
|
|
105
|
+
* The provider contract's prepareImage (its descriptor declares it): the box image the release publishes
|
|
106
|
+
* (box-image.ts), as the workspace template agentrun-box-<recipe hash>, registered from the public image the first
|
|
107
|
+
* time the workspace needs it, so a new recipe is a new template and the one before is left as it is. ok with the
|
|
108
|
+
* template's name; onWait is told "pull" once, before a registration it waits on, never when the workspace has it.
|
|
109
|
+
* A sandbox and a desktop start from the same image.
|
|
110
|
+
*/
|
|
111
|
+
prepareImage(context?: CallContext & {
|
|
112
|
+
onWait?: (making: "build" | "pull", tag: string) => void;
|
|
113
|
+
}): Promise<Result<string>>;
|
|
162
114
|
constructor(options: Agent37ProviderOptions);
|
|
163
115
|
}
|
|
164
116
|
/** The workspace a key reaches, in words, for the sweep's scope: the key's sha256 prefix, never the key. */
|