@parcha/agentrun-computer 0.1.0-beta.41 → 0.1.0-beta.43
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/NOTICE +2 -0
- package/README.md +254 -14
- package/box/README.md +2 -2
- package/box/build-e2b.mjs +1 -1
- package/dist/box-image.d.ts +1 -3
- package/dist/box-image.js +1 -11
- package/dist/boxd.d.ts +126 -0
- package/dist/boxd.js +418 -0
- package/dist/cloudflare.d.ts +32 -0
- package/dist/cloudflare.js +181 -0
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/boxd.d.ts +77 -0
- package/dist/conformance/boxd.js +113 -0
- package/dist/conformance/cases/isolation.js +1 -17
- package/dist/conformance/cloudflare.d.ts +42 -0
- package/dist/conformance/cloudflare.js +54 -0
- package/dist/conformance/dial-only.d.ts +6 -0
- package/dist/conformance/dial-only.js +9 -0
- package/dist/conformance/e2b.d.ts +12 -3
- package/dist/conformance/e2b.js +21 -4
- package/dist/conformance/fly.d.ts +52 -0
- package/dist/conformance/fly.js +52 -0
- package/dist/conformance/modal.d.ts +15 -2
- package/dist/conformance/modal.js +36 -3
- package/dist/conformance/morph.d.ts +59 -0
- package/dist/conformance/morph.js +95 -0
- package/dist/conformance/phone-harness.js +2 -2
- package/dist/conformance/runner.js +3 -3
- package/dist/conformance/sweep.d.ts +1 -6
- package/dist/conformance/sweep.js +8 -18
- package/dist/descriptors/boxd.d.ts +52 -0
- package/dist/descriptors/boxd.js +29 -0
- package/dist/descriptors/cloudflare.d.ts +21 -0
- package/dist/descriptors/cloudflare.js +29 -0
- package/dist/descriptors/e2b.d.ts +4 -0
- package/dist/descriptors/e2b.js +3 -0
- package/dist/descriptors/fly.d.ts +19 -0
- package/dist/descriptors/fly.js +28 -0
- package/dist/descriptors/index.d.ts +113 -1
- package/dist/descriptors/index.js +7 -2
- package/dist/descriptors/modal.d.ts +3 -0
- package/dist/descriptors/modal.js +7 -2
- package/dist/descriptors/morph.d.ts +15 -0
- package/dist/descriptors/morph.js +21 -0
- package/dist/descriptors/phone-harness.d.ts +1 -0
- package/dist/descriptors/phone-harness.js +2 -0
- package/dist/e2b.d.ts +7 -1
- package/dist/e2b.js +87 -44
- package/dist/fly.d.ts +43 -0
- package/dist/fly.js +245 -0
- package/dist/host.d.ts +8 -28
- package/dist/hosted/process.d.ts +19 -0
- package/dist/hosted/process.js +28 -0
- package/dist/hosted/provider.d.ts +11 -22
- package/dist/hosted/provider.js +30 -201
- package/dist/hosted/scripts.d.ts +2 -8
- package/dist/hosted/scripts.js +2 -22
- package/dist/hosted/ssh-exec.d.ts +2 -1
- package/dist/hosted/ssh-exec.js +58 -2
- package/dist/hosted/values.d.ts +5 -0
- package/dist/hosted/values.js +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/modal.d.ts +6 -0
- package/dist/modal.js +20 -10
- package/dist/morph.d.ts +65 -0
- package/dist/morph.js +495 -0
- package/dist/phone-harness.d.ts +15 -5
- package/dist/phone-harness.js +50 -15
- package/dist/screen-watch.js +2 -2
- package/package.json +20 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type BoxdOptions, type BoxdProvider } from "../boxd.js";
|
|
2
|
+
import type { MachineHost } from "../host.js";
|
|
3
|
+
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
|
|
4
|
+
export declare const BOXD_ENV: {
|
|
5
|
+
readonly live: "AGENTRUN_COMPUTER_LIVE_BOXD";
|
|
6
|
+
/** The image every computer of the run starts from: "default" (boxd's own), or a snapshot's name; unset, a desktop's is the desktop snapshot. */
|
|
7
|
+
readonly image: "COMPUTER_BOXD_IMAGE";
|
|
8
|
+
/** apiKey, required: the boxd API key. */
|
|
9
|
+
readonly key: "COMPUTER_BOXD_API_KEY";
|
|
10
|
+
/** org: the org machines are made in; default the key's own. */
|
|
11
|
+
readonly org: "COMPUTER_BOXD_ORG";
|
|
12
|
+
/** region: fra, nyc, ...; default the API's home region. */
|
|
13
|
+
readonly region: "COMPUTER_BOXD_REGION";
|
|
14
|
+
/** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
|
|
15
|
+
readonly daemon: "COMPUTER_BOXD_DAEMON";
|
|
16
|
+
/** kind: linux (default) or desktop. */
|
|
17
|
+
readonly kind: "COMPUTER_BOXD_KIND";
|
|
18
|
+
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
19
|
+
readonly user: "COMPUTER_BOXD_USER";
|
|
20
|
+
};
|
|
21
|
+
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
22
|
+
export declare const ENV: {
|
|
23
|
+
readonly live: "AGENTRUN_COMPUTER_LIVE_BOXD";
|
|
24
|
+
/** The image every computer of the run starts from: "default" (boxd's own), or a snapshot's name; unset, a desktop's is the desktop snapshot. */
|
|
25
|
+
readonly image: "COMPUTER_BOXD_IMAGE";
|
|
26
|
+
/** apiKey, required: the boxd API key. */
|
|
27
|
+
readonly key: "COMPUTER_BOXD_API_KEY";
|
|
28
|
+
/** org: the org machines are made in; default the key's own. */
|
|
29
|
+
readonly org: "COMPUTER_BOXD_ORG";
|
|
30
|
+
/** region: fra, nyc, ...; default the API's home region. */
|
|
31
|
+
readonly region: "COMPUTER_BOXD_REGION";
|
|
32
|
+
/** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
|
|
33
|
+
readonly daemon: "COMPUTER_BOXD_DAEMON";
|
|
34
|
+
/** kind: linux (default) or desktop. */
|
|
35
|
+
readonly kind: "COMPUTER_BOXD_KIND";
|
|
36
|
+
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
37
|
+
readonly user: "COMPUTER_BOXD_USER";
|
|
38
|
+
};
|
|
39
|
+
/** What this module reads from the environment: the key, and each other option whose name is set. */
|
|
40
|
+
export type BoxdSettings = Pick<BoxdOptions, "apiKey" | "org" | "region" | "daemonPath" | "kind" | "daemonUser">;
|
|
41
|
+
/**
|
|
42
|
+
* The provider's options this module reads from env, each only when its name is set; throws in words without the key,
|
|
43
|
+
* never echoing it. create() checks the rest.
|
|
44
|
+
*/
|
|
45
|
+
export declare function settingsFromEnv(env?: Record<string, string | undefined>): BoxdSettings;
|
|
46
|
+
/** The longest lifetime a computer of a run may ask for. */
|
|
47
|
+
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
48
|
+
/** For the run's report: what this configuration means for the suite. */
|
|
49
|
+
export declare const conformanceNotes: string[];
|
|
50
|
+
export interface BoxdModuleOptions extends Pick<BoxdOptions, "Boxd" | "daemonPath" | "timeouts"> {
|
|
51
|
+
/** Where the settings are read; default process.env. */
|
|
52
|
+
env?: Record<string, string | undefined>;
|
|
53
|
+
/** Builds this package's daemon for linux/amd64 stamped with version, and gives its path; default go build. */
|
|
54
|
+
buildDaemon?: (version: string) => Promise<string>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The image every computer of the run starts from: COMPUTER_BOXD_IMAGE, else boxd's own, else for kind desktop the
|
|
58
|
+
* desktop snapshot, which the run's provider finds or builds in the key's org first (prepareImage, live).
|
|
59
|
+
*/
|
|
60
|
+
export declare function conformanceImage(options?: BoxdModuleOptions, { signal }?: {
|
|
61
|
+
signal?: AbortSignal;
|
|
62
|
+
}): Promise<string>;
|
|
63
|
+
/** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
|
|
64
|
+
export declare function createProvider({ env, Boxd, daemonPath, timeouts }?: BoxdModuleOptions): Promise<BoxdProvider>;
|
|
65
|
+
/**
|
|
66
|
+
* The boxd host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
|
|
67
|
+
* since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createHost({ env, Boxd }?: Pick<BoxdModuleOptions, "env" | "Boxd">): Promise<MachineHost>;
|
|
70
|
+
/**
|
|
71
|
+
* Where the sweep lists, in words: the org and region the settings name, under the key named by its sha256 prefix alone.
|
|
72
|
+
* A before file listed with another key, org or region would make every computer there read as new, so the sweep
|
|
73
|
+
* refuses it.
|
|
74
|
+
*/
|
|
75
|
+
export declare function sweepScope({ env }?: Pick<BoxdModuleOptions, "env">): string;
|
|
76
|
+
/** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
|
|
77
|
+
export declare function createDriftedProvider({ env, Boxd, timeouts, buildDaemon }?: BoxdModuleOptions): Promise<BoxdProvider>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// boxd for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider boxd [--image <snapshot>]`.
|
|
2
|
+
// It makes real machines, so it runs only with AGENTRUN_COMPUTER_LIVE_BOXD=1 and your own key, under
|
|
3
|
+
// COMPUTER_BOXD_API_KEY. The provider reads no environment: this module reads its own COMPUTER_BOXD_* names (never
|
|
4
|
+
// BOXD_API_KEY, which may hold another account's key) and passes each to create() as its option. The live switch is
|
|
5
|
+
// checked first, before any other setting is read. The live sweep (sweep.ts, --provider boxd) reads the same names
|
|
6
|
+
// through createHost, which needs no live switch: it makes nothing; sweepScope names the key, org and region a before
|
|
7
|
+
// file must have been listed from.
|
|
8
|
+
//
|
|
9
|
+
// The daemon is uploaded into each machine (dist/computerd-linux-amd64, `npm run build:daemon`), so a run publishes
|
|
10
|
+
// nothing. The drifted provider uploads a daemon built with Go as version <version>-drift. Every computer of a run has
|
|
11
|
+
// a deadline of at most 30 minutes, and the runner sweeps the run's computers by its label when it ends.
|
|
12
|
+
import { createHash } from "node:crypto";
|
|
13
|
+
import { BOXD_DEFAULT_IMAGE } from "../descriptors/boxd.js";
|
|
14
|
+
import { create } from "../boxd.js";
|
|
15
|
+
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
16
|
+
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
|
|
17
|
+
export const BOXD_ENV = {
|
|
18
|
+
live: "AGENTRUN_COMPUTER_LIVE_BOXD",
|
|
19
|
+
/** The image every computer of the run starts from: "default" (boxd's own), or a snapshot's name; unset, a desktop's is the desktop snapshot. */
|
|
20
|
+
image: "COMPUTER_BOXD_IMAGE",
|
|
21
|
+
/** apiKey, required: the boxd API key. */
|
|
22
|
+
key: "COMPUTER_BOXD_API_KEY",
|
|
23
|
+
/** org: the org machines are made in; default the key's own. */
|
|
24
|
+
org: "COMPUTER_BOXD_ORG",
|
|
25
|
+
/** region: fra, nyc, ...; default the API's home region. */
|
|
26
|
+
region: "COMPUTER_BOXD_REGION",
|
|
27
|
+
/** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
|
|
28
|
+
daemon: "COMPUTER_BOXD_DAEMON",
|
|
29
|
+
/** kind: linux (default) or desktop. */
|
|
30
|
+
kind: "COMPUTER_BOXD_KIND",
|
|
31
|
+
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
32
|
+
user: "COMPUTER_BOXD_USER",
|
|
33
|
+
};
|
|
34
|
+
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
35
|
+
export const ENV = BOXD_ENV;
|
|
36
|
+
/**
|
|
37
|
+
* The provider's options this module reads from env, each only when its name is set; throws in words without the key,
|
|
38
|
+
* never echoing it. create() checks the rest.
|
|
39
|
+
*/
|
|
40
|
+
export function settingsFromEnv(env = process.env) {
|
|
41
|
+
const apiKey = env[BOXD_ENV.key];
|
|
42
|
+
if (apiKey === undefined || apiKey === "")
|
|
43
|
+
throw new Error(`set ${BOXD_ENV.key} to a boxd API key: the conformance module reads it there and nowhere else, never from BOXD_API_KEY`);
|
|
44
|
+
const org = env[BOXD_ENV.org] || undefined;
|
|
45
|
+
const region = env[BOXD_ENV.region] || undefined;
|
|
46
|
+
const daemonPath = env[BOXD_ENV.daemon] || undefined;
|
|
47
|
+
const kind = env[BOXD_ENV.kind] || undefined;
|
|
48
|
+
const daemonUser = env[BOXD_ENV.user] || undefined;
|
|
49
|
+
return {
|
|
50
|
+
apiKey,
|
|
51
|
+
...(org === undefined ? {} : { org }),
|
|
52
|
+
...(region === undefined ? {} : { region }),
|
|
53
|
+
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
54
|
+
// create() refuses any other kind in words.
|
|
55
|
+
...(kind === undefined ? {} : { kind: kind }),
|
|
56
|
+
...(daemonUser === undefined ? {} : { daemonUser }),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** The longest lifetime a computer of a run may ask for. */
|
|
60
|
+
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
61
|
+
/** For the run's report: what this configuration means for the suite. */
|
|
62
|
+
export const conformanceNotes = [
|
|
63
|
+
"boxd: every computer is an isolated boxd machine with the egress allowlist none, no standby and no hibernation; the daemon is a child of boxd's own agent, started as a detached root command; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run; no stream() (a screen is streamed through agentrun), so screen.stream is skipped. Kind desktop (COMPUTER_BOXD_KIND=desktop) starts from agentrun-desktop-<recipe hash>, boxd's own image with Xfce's text editor added, a snapshot the run's provider finds or builds in the key's org first (prepareImage), with Xvfb on :0 started through the daemon as the tool user.",
|
|
64
|
+
];
|
|
65
|
+
function live(env) {
|
|
66
|
+
if (env[BOXD_ENV.live] !== "1")
|
|
67
|
+
throw new Error(`the boxd conformance module makes real machines: set ${BOXD_ENV.live}=1, with your own key, to run it`);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The image every computer of the run starts from: COMPUTER_BOXD_IMAGE, else boxd's own, else for kind desktop the
|
|
71
|
+
* desktop snapshot, which the run's provider finds or builds in the key's org first (prepareImage, live).
|
|
72
|
+
*/
|
|
73
|
+
export async function conformanceImage(options = {}, { signal } = {}) {
|
|
74
|
+
const { env = process.env } = options;
|
|
75
|
+
const named = env[BOXD_ENV.image];
|
|
76
|
+
if (named)
|
|
77
|
+
return named;
|
|
78
|
+
if (env[BOXD_ENV.kind] !== "desktop")
|
|
79
|
+
return BOXD_DEFAULT_IMAGE;
|
|
80
|
+
const ready = await (await createProvider(options)).prepareImage(signal ? { signal } : {});
|
|
81
|
+
if (!ready.ok)
|
|
82
|
+
throw new Error(ready.error.message);
|
|
83
|
+
return ready.value;
|
|
84
|
+
}
|
|
85
|
+
/** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
|
|
86
|
+
export async function createProvider({ env = process.env, Boxd, daemonPath, timeouts } = {}) {
|
|
87
|
+
live(env);
|
|
88
|
+
return create({ ...settingsFromEnv(env), ...(Boxd ? { Boxd } : {}), ...(daemonPath === undefined ? {} : { daemonPath }), ...(timeouts ? { timeouts } : {}), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The boxd host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
|
|
92
|
+
* since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
93
|
+
*/
|
|
94
|
+
export async function createHost({ env = process.env, Boxd } = {}) {
|
|
95
|
+
return (await create({ ...settingsFromEnv(env), ...(Boxd ? { Boxd } : {}) })).host;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Where the sweep lists, in words: the org and region the settings name, under the key named by its sha256 prefix alone.
|
|
99
|
+
* A before file listed with another key, org or region would make every computer there read as new, so the sweep
|
|
100
|
+
* refuses it.
|
|
101
|
+
*/
|
|
102
|
+
export function sweepScope({ env = process.env } = {}) {
|
|
103
|
+
const { apiKey, org, region } = settingsFromEnv(env);
|
|
104
|
+
const key = createHash("sha256").update(apiKey, "utf8").digest("hex").slice(0, 12);
|
|
105
|
+
return `the boxd org ${org ?? "of the key"} in the region ${region ?? "home"}, with the key sha256:${key}`;
|
|
106
|
+
}
|
|
107
|
+
/** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
|
|
108
|
+
export async function createDriftedProvider({ env = process.env, Boxd, timeouts, buildDaemon = (version) => buildDriftDaemon("amd64", version) } = {}) {
|
|
109
|
+
live(env);
|
|
110
|
+
const settings = settingsFromEnv(env);
|
|
111
|
+
const daemonPath = await buildDaemon(DRIFT_VERSION);
|
|
112
|
+
return create({ ...settings, ...(Boxd ? { Boxd } : {}), ...(timeouts ? { timeouts } : {}), daemonPath, maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
113
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// A program the computer's user runs reaches none of the vendor's own agent, whose ports each provider declares
|
|
2
2
|
// (capabilities().vendorAgentPorts), and no outside address, sees its own loopback alone, and finds nothing listening in
|
|
3
|
-
// its own network but computerd: computerd init --own-network at work. And it can write nothing root runs
|
|
4
|
-
// labels a provider keeps in the machine.
|
|
3
|
+
// its own network but computerd: computerd init --own-network at work. And it can write nothing root runs.
|
|
5
4
|
import { DAEMON_IN_COMPUTER, SOCKET_DIR } from "../../drift.js";
|
|
6
5
|
import { EGRESS_PROXY_SOCKET } from "../../hosted/network.js";
|
|
7
|
-
import { LABEL_FILE } from "../../hosted/scripts.js";
|
|
8
6
|
import { ARCHIL_HELPER, ARCHIL_SYNC_SOCKET } from "../../mount-archil.js";
|
|
9
7
|
/**
|
|
10
8
|
* The unix sockets a program of the computer's user may connect to: the computer's own, computerd's, the Archil sync
|
|
@@ -178,18 +176,4 @@ export const isolationCases = [
|
|
|
178
176
|
await assertRootRunsClosed(t);
|
|
179
177
|
},
|
|
180
178
|
},
|
|
181
|
-
{
|
|
182
|
-
// The label file of a host that keeps no labels is root's alone: absent or unreadable passes, readable fails.
|
|
183
|
-
id: "isolation.label-file",
|
|
184
|
-
level: "core",
|
|
185
|
-
group: "isolation",
|
|
186
|
-
needs: ["files"],
|
|
187
|
-
async run(t) {
|
|
188
|
-
const read = await t.client.call("files.read", { path: LABEL_FILE });
|
|
189
|
-
if (read.ok)
|
|
190
|
-
return t.assert(false, `the computer's user reads ${LABEL_FILE}, the labels the provider keeps in the machine`);
|
|
191
|
-
t.observe(`${LABEL_FILE}, as the computer's user: ${read.error.code}`);
|
|
192
|
-
t.refused(read, `files.read of ${LABEL_FILE} as the computer's user`, ["not_found", "denied"]);
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
179
|
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type CloudflareProvider } from "../cloudflare.js";
|
|
2
|
+
import type { MachineHost } from "../host.js";
|
|
3
|
+
import type { HostedDial } from "../hosted/provider.js";
|
|
4
|
+
import type { ProviderNote } from "../mount-archil.js";
|
|
5
|
+
/** The environment this module reads, by name, each for the option its comment names. */
|
|
6
|
+
export declare const ENV: {
|
|
7
|
+
/** relayUrl, required: the relay Worker's https address. */
|
|
8
|
+
readonly url: "COMPUTER_CLOUDFLARE_RELAY_URL";
|
|
9
|
+
/** relayToken, required: the relay's RELAY_TOKEN. */
|
|
10
|
+
readonly token: "COMPUTER_CLOUDFLARE_RELAY_TOKEN";
|
|
11
|
+
};
|
|
12
|
+
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each container by then. */
|
|
13
|
+
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
14
|
+
/** The provider's options this module reads from env; throws in words without either, never echoing the token. */
|
|
15
|
+
export declare function settingsFromEnv(env?: Record<string, string | undefined>): {
|
|
16
|
+
relayUrl: string;
|
|
17
|
+
relayToken: string;
|
|
18
|
+
};
|
|
19
|
+
export interface CloudflareModuleOptions {
|
|
20
|
+
/** The environment to read; process.env by default. */
|
|
21
|
+
env?: Record<string, string | undefined>;
|
|
22
|
+
/** The server the containers dial: dial-conformance.mjs gives its own. Without it every create is refused in words. */
|
|
23
|
+
dial?: HostedDial;
|
|
24
|
+
/** The daemon the server serves (its sha256 is what a container checks); default this package's dist/computerd-linux-amd64. */
|
|
25
|
+
daemonPath?: string;
|
|
26
|
+
/** The fetch the relay's calls go through; default the global one. */
|
|
27
|
+
fetch?: typeof fetch;
|
|
28
|
+
/** What the provider says that is no failure: the CLI gives it and puts it in the report. */
|
|
29
|
+
onNote?: ProviderNote;
|
|
30
|
+
}
|
|
31
|
+
/** The provider the run makes computers with, dialing the server options.dial names. */
|
|
32
|
+
export declare function createProvider({ env, dial, daemonPath, fetch, onNote }?: CloudflareModuleOptions): CloudflareProvider;
|
|
33
|
+
/** The run's image: the box image the relay was deployed FROM, as its /v1/health names it. */
|
|
34
|
+
export declare function conformanceImage(options?: Pick<CloudflareModuleOptions, "env" | "fetch">, context?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}): Promise<string>;
|
|
37
|
+
/** The server the run's containers dial, as the CLI asks for it: refused in words (dial-only.ts). */
|
|
38
|
+
export declare const dialKit: () => import("./types.js").DialKit;
|
|
39
|
+
/** The Cloudflare host the live sweep lists and deletes through, from the same settings; it makes nothing. */
|
|
40
|
+
export declare function createHost({ env, fetch }?: Pick<CloudflareModuleOptions, "env" | "fetch">): MachineHost;
|
|
41
|
+
/** Where the sweep lists, in words: the relay the settings name. */
|
|
42
|
+
export declare function sweepScope({ env }?: Pick<CloudflareModuleOptions, "env">): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Cloudflare for the conformance run. Its containers dial the server that minted their tokens (facts.connect "dial"), so
|
|
2
|
+
// a Core run happens inside that server's own process, behind its public address: serve's
|
|
3
|
+
// packages/serve/scripts/dial-conformance.mjs --provider cloudflare gives createProvider() its dial and the run a DialKit.
|
|
4
|
+
// From a laptop's CLI, dialKit() refuses in words, and the provider refuses every create before the relay is called.
|
|
5
|
+
//
|
|
6
|
+
// The provider reads no environment: this module reads its own COMPUTER_CLOUDFLARE_* names and passes each to create()
|
|
7
|
+
// as its option. The live sweep (sweep.ts, --provider cloudflare) reads the same names through createHost.
|
|
8
|
+
import { create } from "../cloudflare.js";
|
|
9
|
+
import { dialOnlyFromServer } from "./dial-only.js";
|
|
10
|
+
/** The environment this module reads, by name, each for the option its comment names. */
|
|
11
|
+
export const ENV = {
|
|
12
|
+
/** relayUrl, required: the relay Worker's https address. */
|
|
13
|
+
url: "COMPUTER_CLOUDFLARE_RELAY_URL",
|
|
14
|
+
/** relayToken, required: the relay's RELAY_TOKEN. */
|
|
15
|
+
token: "COMPUTER_CLOUDFLARE_RELAY_TOKEN",
|
|
16
|
+
};
|
|
17
|
+
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each container by then. */
|
|
18
|
+
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
19
|
+
/** The provider's options this module reads from env; throws in words without either, never echoing the token. */
|
|
20
|
+
export function settingsFromEnv(env = process.env) {
|
|
21
|
+
const relayUrl = env[ENV.url];
|
|
22
|
+
const relayToken = env[ENV.token];
|
|
23
|
+
if (!relayUrl || !relayToken)
|
|
24
|
+
throw new Error(`the Cloudflare conformance module needs ${ENV.url} and ${ENV.token}`);
|
|
25
|
+
return { relayUrl, relayToken };
|
|
26
|
+
}
|
|
27
|
+
/** The provider the run makes computers with, dialing the server options.dial names. */
|
|
28
|
+
export function createProvider({ env = process.env, dial, daemonPath, fetch, onNote } = {}) {
|
|
29
|
+
return create({
|
|
30
|
+
...settingsFromEnv(env),
|
|
31
|
+
...(dial ? { dial } : {}),
|
|
32
|
+
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
33
|
+
...(fetch ? { fetch } : {}),
|
|
34
|
+
...(onNote ? { onNote } : {}),
|
|
35
|
+
maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** The run's image: the box image the relay was deployed FROM, as its /v1/health names it. */
|
|
39
|
+
export async function conformanceImage(options = {}, context = {}) {
|
|
40
|
+
const image = await createProvider(options).prepareImage(context);
|
|
41
|
+
if (!image.ok)
|
|
42
|
+
throw new Error(image.error.message);
|
|
43
|
+
return image.value;
|
|
44
|
+
}
|
|
45
|
+
/** The server the run's containers dial, as the CLI asks for it: refused in words (dial-only.ts). */
|
|
46
|
+
export const dialKit = dialOnlyFromServer("cloudflare", "Cloudflare");
|
|
47
|
+
/** The Cloudflare host the live sweep lists and deletes through, from the same settings; it makes nothing. */
|
|
48
|
+
export function createHost({ env = process.env, fetch } = {}) {
|
|
49
|
+
return create({ ...settingsFromEnv(env), ...(fetch ? { fetch } : {}) }).host;
|
|
50
|
+
}
|
|
51
|
+
/** Where the sweep lists, in words: the relay the settings name. */
|
|
52
|
+
export function sweepScope({ env = process.env } = {}) {
|
|
53
|
+
return `the Cloudflare relay at ${settingsFromEnv(env).relayUrl}`;
|
|
54
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DialKit } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The dialKit() of a dial host's module, by its provider id and label: it always refuses, naming the script to run, and
|
|
4
|
+
* the setting that makes the provider dial when dialing is not its only way (E2B's and Modal's COMPUTER_<ID>_CONNECT=dial).
|
|
5
|
+
*/
|
|
6
|
+
export declare function dialOnlyFromServer(id: string, label: string, setting?: string): () => DialKit;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dialKit() of a dial host's module, by its provider id and label: it always refuses, naming the script to run, and
|
|
3
|
+
* the setting that makes the provider dial when dialing is not its only way (E2B's and Modal's COMPUTER_<ID>_CONNECT=dial).
|
|
4
|
+
*/
|
|
5
|
+
export function dialOnlyFromServer(id, label, setting) {
|
|
6
|
+
return () => {
|
|
7
|
+
throw new Error(`${label}'s machines dial the server that minted their tokens, and this run has no public server: run its Core with packages/serve/scripts/dial-conformance.mjs --provider ${id}${setting ? ` with ${setting}` : ""} inside a server the internet reaches at AGENTRUN_PUBLIC_URL`);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -22,6 +22,8 @@ export declare const E2B_ENV: {
|
|
|
22
22
|
readonly maxLifetimeMs: "COMPUTER_E2B_MAX_LIFETIME_MS";
|
|
23
23
|
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
24
24
|
readonly user: "COMPUTER_E2B_USER";
|
|
25
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
26
|
+
readonly connect: "COMPUTER_E2B_CONNECT";
|
|
25
27
|
};
|
|
26
28
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
27
29
|
export declare const ENV: {
|
|
@@ -40,6 +42,8 @@ export declare const ENV: {
|
|
|
40
42
|
readonly maxLifetimeMs: "COMPUTER_E2B_MAX_LIFETIME_MS";
|
|
41
43
|
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
42
44
|
readonly user: "COMPUTER_E2B_USER";
|
|
45
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
46
|
+
readonly connect: "COMPUTER_E2B_CONNECT";
|
|
43
47
|
};
|
|
44
48
|
/** What this module reads from the environment: the key, and each other option whose name is set. */
|
|
45
49
|
export type E2BSettings = Omit<E2BOptions, "Sandbox" | "desktop" | "timeouts" | "probeTargets">;
|
|
@@ -53,7 +57,7 @@ export declare function settingsFromEnv(env?: Record<string, string | undefined>
|
|
|
53
57
|
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
54
58
|
/** For the run's report: what this configuration means for the suite. */
|
|
55
59
|
export declare const conformanceNotes: string[];
|
|
56
|
-
export interface E2BModuleOptions extends Pick<E2BOptions, "Sandbox" | "daemonPath" | "timeouts" | "onNote"> {
|
|
60
|
+
export interface E2BModuleOptions extends Pick<E2BOptions, "Sandbox" | "daemonPath" | "timeouts" | "onNote" | "dial"> {
|
|
57
61
|
/** Where the settings are read; default process.env. */
|
|
58
62
|
env?: Record<string, string | undefined>;
|
|
59
63
|
/** Builds this package's daemon for linux/amd64 stamped with version, and gives its path; default go build. */
|
|
@@ -61,10 +65,15 @@ export interface E2BModuleOptions extends Pick<E2BOptions, "Sandbox" | "daemonPa
|
|
|
61
65
|
/** For mountFor("archil"): the disk's object API, or the SDK's Archil client, in place of the host's disk package. */
|
|
62
66
|
archil?: Pick<ArchilRunFolderOptions, "objects" | "Archil" | "baseUrl">;
|
|
63
67
|
}
|
|
64
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* The template every computer of the run starts from: COMPUTER_E2B_TEMPLATE; else on dial the box template, since only the
|
|
70
|
+
* box image holds agentrun-dial; else E2B Desktop's (the plain one for kind linux).
|
|
71
|
+
*/
|
|
65
72
|
export declare function conformanceImage({ env }?: Pick<E2BModuleOptions, "env">): string;
|
|
66
73
|
/** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
|
|
67
|
-
export declare function createProvider({ env, Sandbox, daemonPath, timeouts, onNote }?: E2BModuleOptions): Promise<E2BProvider>;
|
|
74
|
+
export declare function createProvider({ env, Sandbox, daemonPath, timeouts, onNote, dial }?: E2BModuleOptions): Promise<E2BProvider>;
|
|
75
|
+
/** A dial machine (COMPUTER_E2B_CONNECT=dial) runs its Core inside the public server's process: refused here (dial-only.ts). */
|
|
76
|
+
export declare const dialKit: () => import("./types.js").DialKit;
|
|
68
77
|
/**
|
|
69
78
|
* A run folder for an Archil mount, and none for any other kind (an E2B computer takes no bind): a fresh folder on the
|
|
70
79
|
* disk the COMPUTER_ARCHIL_* names name (archilSettings), none when they name none (archilRunFolder, ./archil.ts).
|
package/dist/conformance/e2b.js
CHANGED
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
// disk's object API (the shared archilRunFolder, ./archil.ts: the host's disk SDK with COMPUTER_ARCHIL_API_KEY and
|
|
16
16
|
// COMPUTER_ARCHIL_S3_URL, or an object API given as archil.objects); with no disk named it makes none, and the cases
|
|
17
17
|
// are skipped. An Archil computer needs a provider whose daemon user is the tool user: COMPUTER_E2B_USER=2510:2510.
|
|
18
|
+
import { boxE2bTemplate } from "../box-image.js";
|
|
18
19
|
import { create } from "../e2b.js";
|
|
19
20
|
import { archilRunFolder, archilSettings } from "./archil.js";
|
|
21
|
+
import { dialOnlyFromServer } from "./dial-only.js";
|
|
20
22
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
21
23
|
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
22
24
|
export { ARCHIL_ENV } from "./archil.js";
|
|
@@ -37,6 +39,8 @@ export const E2B_ENV = {
|
|
|
37
39
|
maxLifetimeMs: "COMPUTER_E2B_MAX_LIFETIME_MS",
|
|
38
40
|
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
39
41
|
user: "COMPUTER_E2B_USER",
|
|
42
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
43
|
+
connect: "COMPUTER_E2B_CONNECT",
|
|
40
44
|
};
|
|
41
45
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
42
46
|
export const ENV = E2B_ENV;
|
|
@@ -58,8 +62,11 @@ export function settingsFromEnv(env = process.env) {
|
|
|
58
62
|
const daemonPath = env[E2B_ENV.daemon] || undefined;
|
|
59
63
|
const kind = env[E2B_ENV.kind] || undefined;
|
|
60
64
|
const daemonUser = env[E2B_ENV.user] || undefined;
|
|
65
|
+
const connect = env[E2B_ENV.connect] || undefined;
|
|
61
66
|
return {
|
|
62
67
|
apiKey,
|
|
68
|
+
// create() refuses any other value in words.
|
|
69
|
+
...(connect === undefined ? {} : { connect: connect }),
|
|
63
70
|
...(domain === undefined ? {} : { domain }),
|
|
64
71
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
65
72
|
// create() refuses any other kind in words.
|
|
@@ -85,15 +92,25 @@ function live(env) {
|
|
|
85
92
|
*/
|
|
86
93
|
const DESKTOP_TEMPLATE = "desktop";
|
|
87
94
|
const BASE_TEMPLATE = "base";
|
|
88
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* The template every computer of the run starts from: COMPUTER_E2B_TEMPLATE; else on dial the box template, since only the
|
|
97
|
+
* box image holds agentrun-dial; else E2B Desktop's (the plain one for kind linux).
|
|
98
|
+
*/
|
|
89
99
|
export function conformanceImage({ env = process.env } = {}) {
|
|
90
|
-
|
|
100
|
+
const named = env[E2B_ENV.template];
|
|
101
|
+
if (named)
|
|
102
|
+
return named;
|
|
103
|
+
if (env[E2B_ENV.connect] === "dial")
|
|
104
|
+
return boxE2bTemplate();
|
|
105
|
+
return env[E2B_ENV.kind] === "linux" ? BASE_TEMPLATE : DESKTOP_TEMPLATE;
|
|
91
106
|
}
|
|
92
107
|
/** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
|
|
93
|
-
export async function createProvider({ env = process.env, Sandbox, daemonPath, timeouts, onNote } = {}) {
|
|
108
|
+
export async function createProvider({ env = process.env, Sandbox, daemonPath, timeouts, onNote, dial } = {}) {
|
|
94
109
|
live(env);
|
|
95
|
-
return create({ ...settingsFromEnv(env), ...(Sandbox ? { Sandbox } : {}), ...(daemonPath === undefined ? {} : { daemonPath }), ...(timeouts ? { timeouts } : {}), ...(onNote ? { onNote } : {}), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
110
|
+
return create({ ...settingsFromEnv(env), ...(Sandbox ? { Sandbox } : {}), ...(daemonPath === undefined ? {} : { daemonPath }), ...(timeouts ? { timeouts } : {}), ...(onNote ? { onNote } : {}), ...(dial ? { dial } : {}), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
96
111
|
}
|
|
112
|
+
/** A dial machine (COMPUTER_E2B_CONNECT=dial) runs its Core inside the public server's process: refused here (dial-only.ts). */
|
|
113
|
+
export const dialKit = dialOnlyFromServer("e2b", "E2B", `${E2B_ENV.connect}=dial`);
|
|
97
114
|
/**
|
|
98
115
|
* A run folder for an Archil mount, and none for any other kind (an E2B computer takes no bind): a fresh folder on the
|
|
99
116
|
* disk the COMPUTER_ARCHIL_* names name (archilSettings), none when they name none (archilRunFolder, ./archil.ts).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { HostedDial } from "../hosted/provider.js";
|
|
2
|
+
import { type FlyProvider } from "../fly.js";
|
|
3
|
+
import type { MachineHost } from "../host.js";
|
|
4
|
+
import type { ProviderNote } from "../mount-archil.js";
|
|
5
|
+
import type { DialKit } from "./types.js";
|
|
6
|
+
/** The environment this module reads, by name, each for the option its comment names. */
|
|
7
|
+
export declare const FLY_ENV: {
|
|
8
|
+
/** apiToken, required: a Fly API token that may make machines in the app. */
|
|
9
|
+
readonly token: "COMPUTER_FLY_API_TOKEN";
|
|
10
|
+
/** app, required: the Fly app the run's machines live in. */
|
|
11
|
+
readonly app: "COMPUTER_FLY_APP";
|
|
12
|
+
};
|
|
13
|
+
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
14
|
+
export declare const ENV: {
|
|
15
|
+
/** apiToken, required: a Fly API token that may make machines in the app. */
|
|
16
|
+
readonly token: "COMPUTER_FLY_API_TOKEN";
|
|
17
|
+
/** app, required: the Fly app the run's machines live in. */
|
|
18
|
+
readonly app: "COMPUTER_FLY_APP";
|
|
19
|
+
};
|
|
20
|
+
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each machine by then. */
|
|
21
|
+
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
22
|
+
/** The provider's options this module reads from env; throws in words without the token or the app, never echoing one. */
|
|
23
|
+
export declare function settingsFromEnv(env?: Record<string, string | undefined>): {
|
|
24
|
+
apiToken: string;
|
|
25
|
+
app: string;
|
|
26
|
+
};
|
|
27
|
+
export interface FlyModuleOptions {
|
|
28
|
+
/** The environment to read; process.env by default. */
|
|
29
|
+
env?: Record<string, string | undefined>;
|
|
30
|
+
/** The server the machines dial: dial-conformance.mjs gives its own. Without it every create is refused in words. */
|
|
31
|
+
dial?: HostedDial;
|
|
32
|
+
/** The daemon the server serves (its sha256 is what a machine checks); default this package's dist/computerd-linux-amd64. */
|
|
33
|
+
daemonPath?: string;
|
|
34
|
+
/** The fetch Fly's calls go through; default the global one. */
|
|
35
|
+
fetch?: typeof fetch;
|
|
36
|
+
/** What the provider says that is no failure: the CLI gives it and puts it in the report. */
|
|
37
|
+
onNote?: ProviderNote;
|
|
38
|
+
}
|
|
39
|
+
/** The provider the run makes computers with, dialing the server options.dial names. */
|
|
40
|
+
export declare function createProvider({ env, dial, daemonPath, fetch, onNote }?: FlyModuleOptions): FlyProvider;
|
|
41
|
+
/** The run's image: the box image the release publishes, whose CMD runs agentrun-dial (box-image.ts). */
|
|
42
|
+
export declare function conformanceImage(): string;
|
|
43
|
+
/**
|
|
44
|
+
* The server the run's machines dial, for provider.dial-token, as the CLI asks for it: refused in words. A Fly machine
|
|
45
|
+
* dials the server that minted its token, so the run can't happen from a CLI whose server the internet doesn't reach;
|
|
46
|
+
* dial-conformance.mjs stands that server up and gives the run its DialKit itself.
|
|
47
|
+
*/
|
|
48
|
+
export declare function dialKit(): DialKit;
|
|
49
|
+
/** The Fly host the live sweep lists and deletes through, from the same settings; it makes nothing. */
|
|
50
|
+
export declare function createHost({ env, fetch }?: Pick<FlyModuleOptions, "env" | "fetch">): MachineHost;
|
|
51
|
+
/** Where the sweep lists, in words: the app the settings name. */
|
|
52
|
+
export declare function sweepScope({ env }?: Pick<FlyModuleOptions, "env">): string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { boxImageRef } from "../box-image.js";
|
|
2
|
+
import { create } from "../fly.js";
|
|
3
|
+
/** The environment this module reads, by name, each for the option its comment names. */
|
|
4
|
+
export const FLY_ENV = {
|
|
5
|
+
/** apiToken, required: a Fly API token that may make machines in the app. */
|
|
6
|
+
token: "COMPUTER_FLY_API_TOKEN",
|
|
7
|
+
/** app, required: the Fly app the run's machines live in. */
|
|
8
|
+
app: "COMPUTER_FLY_APP",
|
|
9
|
+
};
|
|
10
|
+
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
11
|
+
export const ENV = FLY_ENV;
|
|
12
|
+
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each machine by then. */
|
|
13
|
+
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
14
|
+
/** The provider's options this module reads from env; throws in words without the token or the app, never echoing one. */
|
|
15
|
+
export function settingsFromEnv(env = process.env) {
|
|
16
|
+
const apiToken = env[FLY_ENV.token];
|
|
17
|
+
const app = env[FLY_ENV.app];
|
|
18
|
+
if (!apiToken || !app)
|
|
19
|
+
throw new Error(`the Fly conformance module needs ${FLY_ENV.token} and ${FLY_ENV.app}: it takes a token from that name only, never FLY_API_TOKEN`);
|
|
20
|
+
return { apiToken, app };
|
|
21
|
+
}
|
|
22
|
+
/** The provider the run makes computers with, dialing the server options.dial names. */
|
|
23
|
+
export function createProvider({ env = process.env, dial, daemonPath, fetch, onNote } = {}) {
|
|
24
|
+
return create({
|
|
25
|
+
...settingsFromEnv(env),
|
|
26
|
+
...(dial ? { dial } : {}),
|
|
27
|
+
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
28
|
+
...(fetch ? { fetch } : {}),
|
|
29
|
+
...(onNote ? { onNote } : {}),
|
|
30
|
+
maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** The run's image: the box image the release publishes, whose CMD runs agentrun-dial (box-image.ts). */
|
|
34
|
+
export function conformanceImage() {
|
|
35
|
+
return boxImageRef();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The server the run's machines dial, for provider.dial-token, as the CLI asks for it: refused in words. A Fly machine
|
|
39
|
+
* dials the server that minted its token, so the run can't happen from a CLI whose server the internet doesn't reach;
|
|
40
|
+
* dial-conformance.mjs stands that server up and gives the run its DialKit itself.
|
|
41
|
+
*/
|
|
42
|
+
export function dialKit() {
|
|
43
|
+
throw new Error("a Fly machine dials the server that minted its token, and this run has no public server: run Fly's Core with packages/serve/scripts/dial-conformance.mjs --provider fly inside a server the internet reaches at AGENTRUN_PUBLIC_URL");
|
|
44
|
+
}
|
|
45
|
+
/** The Fly host the live sweep lists and deletes through, from the same settings; it makes nothing. */
|
|
46
|
+
export function createHost({ env = process.env, fetch } = {}) {
|
|
47
|
+
return create({ ...settingsFromEnv(env), ...(fetch ? { fetch } : {}) }).host;
|
|
48
|
+
}
|
|
49
|
+
/** Where the sweep lists, in words: the app the settings name. */
|
|
50
|
+
export function sweepScope({ env = process.env } = {}) {
|
|
51
|
+
return `the Fly app ${settingsFromEnv(env).app}`;
|
|
52
|
+
}
|
|
@@ -16,6 +16,8 @@ export declare const MODAL_ENV: {
|
|
|
16
16
|
readonly app: "COMPUTER_MODAL_APP";
|
|
17
17
|
/** serverUrl: the server the token goes to; the SDK's default when unset. */
|
|
18
18
|
readonly serverUrl: "COMPUTER_MODAL_SERVER_URL";
|
|
19
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
20
|
+
readonly connect: "COMPUTER_MODAL_CONNECT";
|
|
19
21
|
};
|
|
20
22
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
21
23
|
export declare const ENV: {
|
|
@@ -27,9 +29,11 @@ export declare const ENV: {
|
|
|
27
29
|
readonly app: "COMPUTER_MODAL_APP";
|
|
28
30
|
/** serverUrl: the server the token goes to; the SDK's default when unset. */
|
|
29
31
|
readonly serverUrl: "COMPUTER_MODAL_SERVER_URL";
|
|
32
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
33
|
+
readonly connect: "COMPUTER_MODAL_CONNECT";
|
|
30
34
|
};
|
|
31
35
|
/** What this module reads from the environment: the token, the app, and the server when set. */
|
|
32
|
-
export type ModalSettings = Pick<ModalCreateOptions, "tokenId" | "tokenSecret" | "app" | "serverUrl">;
|
|
36
|
+
export type ModalSettings = Pick<ModalCreateOptions, "tokenId" | "tokenSecret" | "app" | "serverUrl" | "connect">;
|
|
33
37
|
/**
|
|
34
38
|
* The provider's options this module reads from env; throws in words without the token or the app, or while
|
|
35
39
|
* MODAL_SERVER_URL is set there (the SDK would send the token to it), never echoing a token.
|
|
@@ -50,9 +54,18 @@ export interface ModalModuleOptions {
|
|
|
50
54
|
archil?: Pick<ArchilRunFolderOptions, "objects" | "Archil" | "baseUrl">;
|
|
51
55
|
/** What the provider says that is no failure: the CLI gives it and puts it in the report. */
|
|
52
56
|
onNote?: ProviderNote;
|
|
57
|
+
/** The public server a dial machine dials (COMPUTER_MODAL_CONNECT=dial): its process alone gives it (dialKit). */
|
|
58
|
+
dial?: ModalCreateOptions["dial"];
|
|
53
59
|
}
|
|
54
60
|
/** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
|
|
55
|
-
export declare function createProvider({ env, ModalClient, daemonPath, onNote }?: ModalModuleOptions): Promise<ModalProvider>;
|
|
61
|
+
export declare function createProvider({ env, ModalClient, daemonPath, onNote, dial }?: ModalModuleOptions): Promise<ModalProvider>;
|
|
62
|
+
/**
|
|
63
|
+
* The image every computer of the run starts from: on dial the box image, since only it holds agentrun-dial; on exec
|
|
64
|
+
* debian:bookworm-slim, the CLI's own default.
|
|
65
|
+
*/
|
|
66
|
+
export declare function conformanceImage({ env }?: Pick<ModalModuleOptions, "env">): string;
|
|
67
|
+
/** A dial machine (COMPUTER_MODAL_CONNECT=dial) runs its Core inside the public server's process: refused here (dial-only.ts). */
|
|
68
|
+
export declare const dialKit: () => import("./types.js").DialKit;
|
|
56
69
|
/**
|
|
57
70
|
* A run folder for an Archil mount, and none for any other kind (a Modal computer takes no bind): a fresh folder on the
|
|
58
71
|
* disk the COMPUTER_ARCHIL_* names name (archilSettings), none when they name none (archilRunFolder, ./archil.ts).
|