@parcha/agentrun-computer 0.1.0-beta.36 → 0.1.0-beta.38
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 +547 -478
- package/box/Dockerfile +18 -1
- package/box/README.md +13 -0
- package/box/build-agent37.mjs +158 -0
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +41 -18
- package/box/recipe.mjs +43 -0
- package/dist/agent37-ssh.d.ts +89 -0
- package/dist/agent37-ssh.js +445 -0
- package/dist/agent37.d.ts +104 -0
- package/dist/agent37.js +402 -0
- package/dist/attach.d.ts +146 -0
- package/dist/attach.js +469 -0
- package/dist/browserbase.d.ts +2 -10
- package/dist/browserbase.js +3 -6
- package/dist/client.d.ts +45 -4
- package/dist/client.js +92 -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 +96 -0
- package/dist/conformance/agent37.js +154 -0
- package/dist/conformance/cases/apps.d.ts +11 -0
- package/dist/conformance/cases/apps.js +173 -73
- package/dist/conformance/cases/health.js +14 -0
- package/dist/conformance/cases/index.js +2 -0
- package/dist/conformance/cases/isolation.d.ts +7 -5
- package/dist/conformance/cases/isolation.js +44 -14
- package/dist/conformance/cases/mount.js +1 -1
- package/dist/conformance/cases/provider.js +27 -1
- package/dist/conformance/cases/screen.d.ts +3 -0
- package/dist/conformance/cases/screen.js +18 -0
- package/dist/conformance/cases/settings.d.ts +29 -23
- package/dist/conformance/cases/settings.js +76 -58
- package/dist/conformance/cases/touch.js +19 -17
- package/dist/conformance/cases/ui.d.ts +2 -0
- package/dist/conformance/cases/ui.js +475 -0
- package/dist/conformance/cli.d.ts +9 -0
- package/dist/conformance/cli.js +94 -9
- package/dist/conformance/daytona.d.ts +9 -20
- package/dist/conformance/daytona.js +12 -21
- package/dist/conformance/e2b.d.ts +6 -0
- package/dist/conformance/e2b.js +9 -2
- package/dist/conformance/exec-stream.d.ts +45 -0
- package/dist/conformance/exec-stream.js +486 -0
- package/dist/conformance/fixture.d.ts +1 -1
- package/dist/conformance/fixture.js +25 -1
- package/dist/conformance/modal.d.ts +17 -13
- package/dist/conformance/modal.js +18 -9
- package/dist/conformance/orgo.d.ts +3 -3
- package/dist/conformance/orgo.js +6 -8
- package/dist/conformance/phone-harness.d.ts +6 -2
- package/dist/conformance/phone-harness.js +21 -4
- package/dist/conformance/report.js +1 -1
- package/dist/conformance/runner.js +23 -4
- package/dist/conformance/sweep.d.ts +50 -0
- package/dist/conformance/sweep.js +187 -0
- package/dist/conformance/types.d.ts +13 -5
- package/dist/conformance/ui-fixture.d.ts +56 -0
- package/dist/conformance/ui-fixture.js +43 -0
- package/dist/create-requests.d.ts +51 -0
- package/dist/create-requests.js +121 -0
- package/dist/daytona.d.ts +20 -133
- package/dist/daytona.js +405 -1449
- package/dist/descriptor.d.ts +11 -1
- package/dist/descriptor.js +9 -0
- package/dist/descriptors/agent37.d.ts +41 -0
- package/dist/descriptors/agent37.js +28 -0
- package/dist/descriptors/daytona.d.ts +6 -5
- package/dist/descriptors/daytona.js +9 -5
- package/dist/descriptors/index.d.ts +42 -7
- package/dist/descriptors/index.js +4 -2
- package/dist/descriptors/orgo.d.ts +2 -1
- package/dist/descriptors/orgo.js +3 -2
- package/dist/descriptors/phone-harness.d.ts +1 -1
- package/dist/descriptors/phone-harness.js +2 -2
- 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.d.ts +7 -10
- package/dist/docker.js +272 -34
- package/dist/drift.js +4 -4
- package/dist/e2b.d.ts +16 -290
- package/dist/e2b.js +230 -1393
- package/dist/fake-ui-driver.d.ts +97 -0
- package/dist/fake-ui-driver.js +717 -0
- package/dist/host.d.ts +201 -0
- package/dist/host.js +8 -0
- package/dist/hosted/process.d.ts +81 -0
- package/dist/hosted/process.js +259 -0
- package/dist/hosted/provider.d.ts +160 -0
- package/dist/hosted/provider.js +1415 -0
- package/dist/hosted/rest.d.ts +66 -0
- package/dist/hosted/rest.js +121 -0
- package/dist/hosted/scripts.d.ts +82 -0
- package/dist/{child.js → hosted/scripts.js} +118 -12
- package/dist/hosted/values.d.ts +5 -0
- package/dist/hosted/values.js +8 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -4
- package/dist/kernel.d.ts +2 -10
- package/dist/kernel.js +3 -6
- package/dist/kinds.d.ts +11 -2
- package/dist/kinds.js +20 -4
- package/dist/local-chrome.d.ts +2 -10
- package/dist/local-chrome.js +3 -6
- package/dist/modal.d.ts +22 -257
- package/dist/modal.js +183 -1280
- package/dist/mount-archil.d.ts +8 -4
- package/dist/mount-archil.js +22 -11
- package/dist/mount.d.ts +10 -4
- package/dist/mount.js +8 -4
- package/dist/orgo-channel.d.ts +3 -2
- package/dist/orgo-channel.js +5 -2
- package/dist/orgo-desktop.d.ts +9 -4
- package/dist/orgo-desktop.js +33 -13
- package/dist/orgo-workspaces.d.ts +47 -0
- package/dist/orgo-workspaces.js +94 -0
- package/dist/orgo.d.ts +10 -13
- package/dist/orgo.js +32 -21
- package/dist/phone-harness.d.ts +31 -28
- package/dist/phone-harness.js +510 -702
- package/dist/png.d.ts +4 -0
- package/dist/png.js +27 -0
- package/dist/protocol.d.ts +339 -33
- package/dist/protocol.js +97 -3
- package/dist/provider.d.ts +36 -8
- package/dist/provider.js +16 -0
- package/dist/providers.d.ts +11 -12
- package/dist/result.d.ts +1 -1
- package/dist/screen-watch.js +34 -6
- package/dist/surface/api.d.ts +260 -0
- package/dist/surface/api.js +1 -0
- package/dist/surface/core.d.ts +55 -0
- package/dist/surface/core.js +475 -0
- package/dist/surface/index.d.ts +5 -0
- package/dist/surface/index.js +3 -0
- package/dist/surface/outline.d.ts +10 -0
- package/dist/surface/outline.js +51 -0
- package/dist/surface/script.d.ts +10 -0
- package/dist/surface/script.js +94 -0
- package/dist/ui-engine.d.ts +114 -0
- package/dist/ui-engine.js +814 -0
- package/package.json +18 -3
- package/dist/child.d.ts +0 -42
- package/dist/conformance/daytona-sweep.d.ts +0 -18
- package/dist/conformance/daytona-sweep.js +0 -126
- package/dist/conformance/e2b-diagnose.d.ts +0 -16
- package/dist/conformance/e2b-diagnose.js +0 -61
- package/dist/conformance/e2b-sweep.d.ts +0 -18
- package/dist/conformance/e2b-sweep.js +0 -132
- package/dist/conformance/modal-sweep.d.ts +0 -22
- package/dist/conformance/modal-sweep.js +0 -213
package/dist/conformance/cli.js
CHANGED
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
// Exits 0 when Core passes, 1 when it fails, 2 on a usage error, and 3 when --only left Core cases out and every case
|
|
4
4
|
// that ran passed: a partial run is never a Core pass, so no script reads its exit code as one. With --kind it exits on
|
|
5
5
|
// the kind's verdict alone: 0 when the provider passes the kind, 1 when it does not.
|
|
6
|
-
|
|
6
|
+
// `--exec-stream --machine <id> [--quick]` runs the exec pre-check (./exec-stream.ts) alone, on a machine the vendor made
|
|
7
|
+
// by hand, through the module's createHost(): 0 when exec passes every check, 1 when one fails.
|
|
8
|
+
import { generateKeyPairSync, randomBytes } from "node:crypto";
|
|
7
9
|
import { resolve } from "node:path";
|
|
8
10
|
import { pathToFileURL } from "node:url";
|
|
9
11
|
import { isCommand } from "../entry.js";
|
|
10
|
-
import { isProviderId, providerIds, providerModule } from "../providers.js";
|
|
12
|
+
import { descriptorOf, isProviderId, providerIds, providerModule } from "../providers.js";
|
|
11
13
|
import { SETTING_KIND_NAMES } from "../kinds.js";
|
|
12
14
|
import { browserCases, casesFor, conformanceCases } from "./cases/index.js";
|
|
15
|
+
import { checkExecStream, DEFAULT_LONG_MS, formatExecStream, QUICK_LONG_MS } from "./exec-stream.js";
|
|
13
16
|
import { kindRunProblem } from "./kind.js";
|
|
14
17
|
import { formatReport } from "./report.js";
|
|
15
18
|
import { runConformance } from "./runner.js";
|
|
@@ -30,8 +33,12 @@ const USAGE = `usage: npm run conformance -w @parcha/agentrun-computer -- --prov
|
|
|
30
33
|
--gpu the GPU the gpu case's one computer asks for, a type the provider declares and a count (default 1), such
|
|
31
34
|
as T4 or H100:2; it bills by the second, so without it the gpu case skips
|
|
32
35
|
--json print the report as JSON
|
|
36
|
+
--exec-stream --machine <id> [--quick]
|
|
37
|
+
the exec pre-check, alone: the module's createHost() and host.exec, nothing else, on a machine you made
|
|
38
|
+
by hand. Bytes 0-255 both ways, 8 MiB by sha256, output and stdin while the process runs, stderr apart,
|
|
39
|
+
the exit code, kill, and a silent process of ${DEFAULT_LONG_MS / 1000} s (--quick: ${QUICK_LONG_MS / 1000} s) that is not cut off
|
|
33
40
|
exit: 0 Core passes, 1 it fails, 2 usage error, 3 partial (--only) and every case that ran passed; with --kind,
|
|
34
|
-
0 the provider passes the kind, 1 it does not`;
|
|
41
|
+
0 the provider passes the kind, 1 it does not; with --exec-stream, 0 every check passes, 1 one fails`;
|
|
35
42
|
const PROVIDER_METHODS = ["capabilities", "check", "create", "attach", "list", "network", "connect", "release"];
|
|
36
43
|
class Usage extends Error {
|
|
37
44
|
}
|
|
@@ -44,6 +51,9 @@ function gpuOf(text) {
|
|
|
44
51
|
}
|
|
45
52
|
function parse(argv, cases) {
|
|
46
53
|
const args = { json: false, help: false };
|
|
54
|
+
let execStream = false;
|
|
55
|
+
let quick = false;
|
|
56
|
+
let machine;
|
|
47
57
|
for (let i = 0; i < argv.length; i++) {
|
|
48
58
|
const [flag = "", inline] = (argv[i] ?? "").split(/=(.*)/s, 2);
|
|
49
59
|
const value = () => {
|
|
@@ -71,6 +81,12 @@ function parse(argv, cases) {
|
|
|
71
81
|
args.fixture = value();
|
|
72
82
|
else if (flag === "--gpu")
|
|
73
83
|
args.gpu = gpuOf(value());
|
|
84
|
+
else if (flag === "--exec-stream")
|
|
85
|
+
execStream = true;
|
|
86
|
+
else if (flag === "--machine")
|
|
87
|
+
machine = value();
|
|
88
|
+
else if (flag === "--quick")
|
|
89
|
+
quick = true;
|
|
74
90
|
else if (flag === "--json")
|
|
75
91
|
args.json = true;
|
|
76
92
|
else if (flag === "--help" || flag === "-h")
|
|
@@ -82,6 +98,16 @@ function parse(argv, cases) {
|
|
|
82
98
|
return { provider: "", json: false, help: true };
|
|
83
99
|
if (args.provider === undefined)
|
|
84
100
|
throw new Usage("--provider is required");
|
|
101
|
+
if (execStream) {
|
|
102
|
+
if (machine === undefined)
|
|
103
|
+
throw new Usage("--exec-stream needs --machine <id>, a machine you made by hand");
|
|
104
|
+
const others = ["image", "only", "kind", "fixture", "gpu"].filter((name) => args[name] !== undefined);
|
|
105
|
+
if (others.length > 0)
|
|
106
|
+
throw new Usage(`--exec-stream runs alone: drop ${others.map((name) => `--${name}`).join(", ")}`);
|
|
107
|
+
return { provider: args.provider, execStream: { machine, quick }, json: args.json, help: false };
|
|
108
|
+
}
|
|
109
|
+
if (machine !== undefined || quick)
|
|
110
|
+
throw new Usage(`${machine !== undefined ? "--machine" : "--quick"} goes with --exec-stream`);
|
|
85
111
|
if (args.kind !== undefined && args.only !== undefined)
|
|
86
112
|
throw new Usage("--kind and --only go apart: a kind runs its own cases");
|
|
87
113
|
const groups = [...new Set(cases.map((c) => c.group))];
|
|
@@ -112,10 +138,9 @@ const BARE = /^[A-Za-z][A-Za-z0-9-]*$/;
|
|
|
112
138
|
*/
|
|
113
139
|
async function conformanceModule(name, cwd) {
|
|
114
140
|
const found = await moduleFor(name, cwd);
|
|
115
|
-
// What
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return { label: found.label, module: found.module, ...(Array.isArray(declared) ? { declared: declared } : {}) };
|
|
141
|
+
// What a registry provider declares of itself, its descriptor's configurations, for health.declared.
|
|
142
|
+
const declared = isProviderId(name) ? descriptorOf(name)?.capabilities : undefined;
|
|
143
|
+
return { label: found.label, module: found.module, ...(declared === undefined ? {} : { declared }) };
|
|
119
144
|
}
|
|
120
145
|
async function moduleFor(name, cwd) {
|
|
121
146
|
let label = name;
|
|
@@ -154,6 +179,31 @@ async function moduleFor(name, cwd) {
|
|
|
154
179
|
}
|
|
155
180
|
/** A name of a module's ENV that holds a secret: an API key, a token, a token's secret. */
|
|
156
181
|
const SECRET_NAME = /(^|_)(KEY|TOKEN|SECRET)(_|$)/;
|
|
182
|
+
/**
|
|
183
|
+
* A fresh planted value for each secret name, and the text to hunt for in answers. A `*_SSH_KEY` name takes a throwaway
|
|
184
|
+
* ed25519 private key (a provider refuses a non-PEM key at build) and its base64 body line is the secret: the armor is
|
|
185
|
+
* public text that the provider's own errors quote. Every other name takes a random string that is its own secret.
|
|
186
|
+
*/
|
|
187
|
+
export function plantSecrets(names) {
|
|
188
|
+
const values = [];
|
|
189
|
+
const secrets = [];
|
|
190
|
+
for (const name of names) {
|
|
191
|
+
if (name.endsWith("_SSH_KEY")) {
|
|
192
|
+
const { privateKey } = generateKeyPairSync("ed25519", {
|
|
193
|
+
privateKeyEncoding: { type: "pkcs8", format: "pem" },
|
|
194
|
+
publicKeyEncoding: { type: "spki", format: "pem" },
|
|
195
|
+
});
|
|
196
|
+
values.push(privateKey);
|
|
197
|
+
secrets.push(privateKey.split("\n").filter((line) => line !== "" && !line.startsWith("-----")).join(""));
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
const value = `agentrun-planted-${randomBytes(12).toString("hex")}`;
|
|
201
|
+
values.push(value);
|
|
202
|
+
secrets.push(value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return { values, secrets };
|
|
206
|
+
}
|
|
157
207
|
/**
|
|
158
208
|
* The provider a conformance module makes, its drifted twin and its run folders (mountFor) when it offers them, and what
|
|
159
209
|
* it says of its run: conformanceImage(), the image when --image names none, and conformanceNotes, strings for the report.
|
|
@@ -177,9 +227,9 @@ async function load(label, module, options, declared) {
|
|
|
177
227
|
const secretNames = Object.values(module.ENV ?? {}).filter((name) => typeof name === "string" && SECRET_NAME.test(name));
|
|
178
228
|
if (secretNames.length > 0) {
|
|
179
229
|
target.planted = async () => {
|
|
180
|
-
const secrets = secretNames
|
|
230
|
+
const { values, secrets } = plantSecrets(secretNames);
|
|
181
231
|
const given = options.env ?? process.env;
|
|
182
|
-
const env = { ...given, ...Object.fromEntries(secretNames.map((name, i) => [name,
|
|
232
|
+
const env = { ...given, ...Object.fromEntries(secretNames.map((name, i) => [name, values[i]])) };
|
|
183
233
|
return { provider: (await createProvider({ ...options, env })), secrets };
|
|
184
234
|
};
|
|
185
235
|
}
|
|
@@ -199,6 +249,39 @@ async function load(label, module, options, declared) {
|
|
|
199
249
|
}
|
|
200
250
|
return target;
|
|
201
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* The exec pre-check: the host the module's createHost() builds (a conformance module's, else the provider file's own),
|
|
254
|
+
* given the CLI's provider options, and its exec alone on the named machine. Nothing else of the host is called.
|
|
255
|
+
*/
|
|
256
|
+
async function execStreamMain(name, { machine, quick }, json, cwd, io) {
|
|
257
|
+
const { stdout = process.stdout, stderr = process.stderr, signal, progress = false } = io;
|
|
258
|
+
let host;
|
|
259
|
+
try {
|
|
260
|
+
const found = await moduleFor(name, cwd);
|
|
261
|
+
const createHost = found.module.createHost ?? found.file.createHost;
|
|
262
|
+
if (typeof createHost !== "function") {
|
|
263
|
+
throw new Usage(`${found.label} does not export createHost(options): the exec pre-check builds your MachineHost with it, from your conformance module or your provider file`);
|
|
264
|
+
}
|
|
265
|
+
host = (await createHost(io.providerOptions ?? {}));
|
|
266
|
+
if (typeof host?.exec !== "function")
|
|
267
|
+
throw new Error(`${found.label}: createHost() did not return a MachineHost with exec`);
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
await write(stderr, `${error.message}\n`);
|
|
271
|
+
if (error instanceof Usage) {
|
|
272
|
+
await write(stderr, `${USAGE}\n`);
|
|
273
|
+
return 2;
|
|
274
|
+
}
|
|
275
|
+
return 1;
|
|
276
|
+
}
|
|
277
|
+
const report = await checkExecStream(host, machine, {
|
|
278
|
+
longMs: quick ? QUICK_LONG_MS : DEFAULT_LONG_MS,
|
|
279
|
+
...(signal ? { signal } : {}),
|
|
280
|
+
...(progress ? { onCheck: (check) => stderr.write(`${check.status === "pass" ? "✓" : "✗"} ${check.id}\n`) } : {}),
|
|
281
|
+
});
|
|
282
|
+
await write(stdout, json ? `${JSON.stringify(report, null, 2)}\n` : formatExecStream(report));
|
|
283
|
+
return report.pass ? 0 : 1;
|
|
284
|
+
}
|
|
202
285
|
export async function main(argv, io = {}) {
|
|
203
286
|
const { stdout = process.stdout, stderr = process.stderr, signal, progress = false } = io;
|
|
204
287
|
let args;
|
|
@@ -215,6 +298,8 @@ export async function main(argv, io = {}) {
|
|
|
215
298
|
return 0;
|
|
216
299
|
}
|
|
217
300
|
const cwd = io.cwd ?? process.env.INIT_CWD ?? process.cwd();
|
|
301
|
+
if (args.execStream)
|
|
302
|
+
return execStreamMain(args.provider, args.execStream, args.json, cwd, io);
|
|
218
303
|
// What the provider says that is no failure (onNote, as each remote provider takes it) goes in the report.
|
|
219
304
|
const providerNotes = [];
|
|
220
305
|
const options = { ...(io.providerOptions ?? {}), onNote: (note) => providerNotes.push({ computer: note.computer, note: note.note }) };
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
3
|
-
import { type ArchilRunFolderOptions } from "./archil.js";
|
|
4
|
-
import type { RunFolder } from "./types.js";
|
|
5
|
-
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
6
|
-
export { ARCHIL_ENV } from "./archil.js";
|
|
7
|
-
/**
|
|
8
|
-
* A fresh run folder for the mount cases: an Archil one on the disk the COMPUTER_ARCHIL_* settings name (the shared
|
|
9
|
-
* archilRunFolder; the run's snapshot is then one of box/Dockerfile, and COMPUTER_DAYTONA_USER is 2510:2510); none when
|
|
10
|
-
* they name none, and none for a bind, which a remote computer cannot take.
|
|
11
|
-
*/
|
|
12
|
-
export declare function mountFor(kind: MountKind, { env, archil }?: {
|
|
13
|
-
env?: Record<string, string | undefined>;
|
|
14
|
-
archil?: Pick<ArchilRunFolderOptions, "objects" | "Archil" | "baseUrl">;
|
|
15
|
-
}): Promise<RunFolder | undefined>;
|
|
1
|
+
import { type DaytonaProvider, type DaytonaProviderOptions } from "../daytona.js";
|
|
2
|
+
import type { MachineHost } from "../host.js";
|
|
16
3
|
/** The environment this module reads, by name, each for the option its comment names. */
|
|
17
4
|
export declare const DAYTONA_ENV: {
|
|
18
5
|
/** apiKey, required: the Daytona API key. */
|
|
@@ -59,15 +46,12 @@ export declare const ENV: {
|
|
|
59
46
|
* The provider's options this module reads from env, each only when its name is set; throws in words without the key,
|
|
60
47
|
* never echoing one. create() checks the rest.
|
|
61
48
|
*/
|
|
62
|
-
export declare function settingsFromEnv(env?: Record<string, string | undefined>):
|
|
49
|
+
export declare function settingsFromEnv(env?: Record<string, string | undefined>): DaytonaProviderOptions;
|
|
63
50
|
/** Minutes without outside activity before Daytona stops a run's sandbox: at most 30, so none outlives a run for long. */
|
|
64
51
|
export declare const CONFORMANCE_AUTO_STOP_MINUTES = 30;
|
|
65
52
|
/** Minutes a run's sandbox may stay stopped: 0, Daytona deletes it as soon as it stops. */
|
|
66
53
|
export declare const CONFORMANCE_AUTO_DELETE_MINUTES = 0;
|
|
67
|
-
/**
|
|
68
|
-
* For the run's report: what this configuration means for the suite. The provider declares it (stopDeletes), and the
|
|
69
|
-
* note says it in words.
|
|
70
|
-
*/
|
|
54
|
+
/** For the run's report: what this configuration means for the suite, in words. */
|
|
71
55
|
export declare const conformanceNotes: string[];
|
|
72
56
|
export interface DaytonaModuleOptions {
|
|
73
57
|
/** Where the settings are read; default process.env. */
|
|
@@ -83,5 +67,10 @@ export interface DaytonaModuleOptions {
|
|
|
83
67
|
export declare function conformanceImage({ env }?: Pick<DaytonaModuleOptions, "env">): string;
|
|
84
68
|
/** The provider the CLI runs; throws in words when a setting is missing or wrong. */
|
|
85
69
|
export declare function createProvider(options?: DaytonaModuleOptions): DaytonaProvider;
|
|
70
|
+
/**
|
|
71
|
+
* The Daytona host the live sweep (sweep.ts) lists and deletes through, from the same settings (the key and the API
|
|
72
|
+
* URL); it calls nothing until the sweep does.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createHost({ env, fetch }?: Pick<DaytonaModuleOptions, "env" | "fetch">): Promise<MachineHost>;
|
|
86
75
|
/** The same provider with a daemon that reports another version, built with Go for the drift case. */
|
|
87
76
|
export declare function createDriftedProvider(options?: DaytonaModuleOptions): Promise<DaytonaProvider>;
|
|
@@ -2,25 +2,11 @@
|
|
|
2
2
|
// module reads the run's settings from its own COMPUTER_DAYTONA_* names (never a bare DAYTONA_ variable, which may hold
|
|
3
3
|
// another organization's key on a host that runs other Daytona work) and passes each to create() as its option, the key
|
|
4
4
|
// read only when createProvider() runs. Every sandbox of a run has a bounded life besides its TTL: Daytona stops one
|
|
5
|
-
// after 30 minutes with no outside activity and deletes it as soon as it stops
|
|
6
|
-
//
|
|
5
|
+
// after 30 minutes with no outside activity and deletes it as soon as it stops (see conformanceNotes). The live sweep
|
|
6
|
+
// (sweep.ts, --provider daytona) reads the same names through createHost: it makes nothing.
|
|
7
7
|
import { create } from "../daytona.js";
|
|
8
8
|
import { DAYTONA_DEFAULT_SNAPSHOT } from "../descriptors/daytona.js";
|
|
9
|
-
import { archilRunFolder, archilSettings } from "./archil.js";
|
|
10
9
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
11
|
-
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
12
|
-
export { ARCHIL_ENV } from "./archil.js";
|
|
13
|
-
/**
|
|
14
|
-
* A fresh run folder for the mount cases: an Archil one on the disk the COMPUTER_ARCHIL_* settings name (the shared
|
|
15
|
-
* archilRunFolder; the run's snapshot is then one of box/Dockerfile, and COMPUTER_DAYTONA_USER is 2510:2510); none when
|
|
16
|
-
* they name none, and none for a bind, which a remote computer cannot take.
|
|
17
|
-
*/
|
|
18
|
-
export async function mountFor(kind, { env = process.env, archil = {} } = {}) {
|
|
19
|
-
if (kind !== "archil")
|
|
20
|
-
return undefined;
|
|
21
|
-
const settings = archilSettings(env);
|
|
22
|
-
return settings === undefined ? undefined : archilRunFolder({ ...settings, ...archil });
|
|
23
|
-
}
|
|
24
10
|
/** The environment this module reads, by name, each for the option its comment names. */
|
|
25
11
|
export const DAYTONA_ENV = {
|
|
26
12
|
/** apiKey, required: the Daytona API key. */
|
|
@@ -65,6 +51,7 @@ export function settingsFromEnv(env = process.env) {
|
|
|
65
51
|
...(url ? { apiUrl: url.value } : {}),
|
|
66
52
|
...(target ? { target: target.value } : {}),
|
|
67
53
|
...(daemon ? { daemonPath: daemon.value } : {}),
|
|
54
|
+
// create() refuses any other arch in words.
|
|
68
55
|
...(arch ? { arch: arch.value } : {}),
|
|
69
56
|
// create() refuses any other class in words.
|
|
70
57
|
...(sandboxClass ? { sandboxClass: sandboxClass.value } : {}),
|
|
@@ -77,12 +64,9 @@ export function settingsFromEnv(env = process.env) {
|
|
|
77
64
|
export const CONFORMANCE_AUTO_STOP_MINUTES = 30;
|
|
78
65
|
/** Minutes a run's sandbox may stay stopped: 0, Daytona deletes it as soon as it stops. */
|
|
79
66
|
export const CONFORMANCE_AUTO_DELETE_MINUTES = 0;
|
|
80
|
-
/**
|
|
81
|
-
* For the run's report: what this configuration means for the suite. The provider declares it (stopDeletes), and the
|
|
82
|
-
* note says it in words.
|
|
83
|
-
*/
|
|
67
|
+
/** For the run's report: what this configuration means for the suite, in words. */
|
|
84
68
|
export const conformanceNotes = [
|
|
85
|
-
`daytona: every sandbox runs with autoStopMinutes ${CONFORMANCE_AUTO_STOP_MINUTES} and autoDeleteMinutes ${CONFORMANCE_AUTO_DELETE_MINUTES}, besides its TTL: Daytona deletes a sandbox as soon as it stops, so this configuration keeps no stopped computer
|
|
69
|
+
`daytona: every sandbox runs with autoStopMinutes ${CONFORMANCE_AUTO_STOP_MINUTES} and autoDeleteMinutes ${CONFORMANCE_AUTO_DELETE_MINUTES}, besides its TTL: Daytona deletes a sandbox as soon as it stops, so this configuration keeps no stopped computer. A computer here is deleted, never stopped: release stop is refused. Full provider.janitor, which needs a stopped computer kept, is skipped (the lifetime being vendor).`,
|
|
86
70
|
];
|
|
87
71
|
/** The provider's options: what this module reads from the environment (settingsFromEnv), with the run's bounds. */
|
|
88
72
|
function optionsOf({ env = process.env, fetch, webSocket, timeouts, onNote }) {
|
|
@@ -104,6 +88,13 @@ export function conformanceImage({ env = process.env } = {}) {
|
|
|
104
88
|
export function createProvider(options = {}) {
|
|
105
89
|
return create(optionsOf(options));
|
|
106
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* The Daytona host the live sweep (sweep.ts) lists and deletes through, from the same settings (the key and the API
|
|
93
|
+
* URL); it calls nothing until the sweep does.
|
|
94
|
+
*/
|
|
95
|
+
export async function createHost({ env = process.env, fetch } = {}) {
|
|
96
|
+
return create({ ...settingsFromEnv(env), ...(fetch ? { fetch } : {}) }).host;
|
|
97
|
+
}
|
|
107
98
|
/** The same provider with a daemon that reports another version, built with Go for the drift case. */
|
|
108
99
|
export async function createDriftedProvider(options = {}) {
|
|
109
100
|
const settings = optionsOf(options);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type E2BOptions, type E2BProvider } from "../e2b.js";
|
|
2
|
+
import type { MachineHost } from "../host.js";
|
|
2
3
|
import type { MountKind } from "../mount.js";
|
|
3
4
|
import { type ArchilRunFolderOptions } from "./archil.js";
|
|
4
5
|
import type { RunFolder } from "./types.js";
|
|
@@ -70,5 +71,10 @@ export declare function createProvider({ env, Sandbox, daemonPath, timeouts, onN
|
|
|
70
71
|
* Reaching it is a call to Archil, so it needs the live switch.
|
|
71
72
|
*/
|
|
72
73
|
export declare function mountFor(kind: MountKind, { env, archil }?: E2BModuleOptions): Promise<RunFolder | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* The E2B host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
|
|
76
|
+
* since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createHost({ env, Sandbox }?: Pick<E2BModuleOptions, "env" | "Sandbox">): Promise<MachineHost>;
|
|
73
79
|
/** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
|
|
74
80
|
export declare function createDriftedProvider({ env, Sandbox, timeouts, buildDaemon }?: E2BModuleOptions): Promise<E2BProvider>;
|
package/dist/conformance/e2b.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// COMPUTER_E2B_API_KEY. The provider reads no environment: this module reads its own COMPUTER_E2B_* names (never
|
|
4
4
|
// E2B_API_KEY, which may hold another team's key) and passes each to create() as its option; the provider gives the SDK
|
|
5
5
|
// the key, domain and API URL explicitly, and refuses an ambient E2B_SANDBOX_URL (see create in ../e2b.ts). The live
|
|
6
|
-
// switch is checked first, before any other setting is read. The sweep
|
|
7
|
-
//
|
|
6
|
+
// switch is checked first, before any other setting is read. The live sweep (sweep.ts, --provider e2b) reads the same
|
|
7
|
+
// names through createHost, which needs no live switch: it makes nothing.
|
|
8
8
|
//
|
|
9
9
|
// The daemon is uploaded into each sandbox (dist/computerd-linux-amd64, `npm run build:daemon`), so a run publishes
|
|
10
10
|
// nothing. The drifted provider uploads a daemon built with Go as version <version>-drift. Every computer of a run lives
|
|
@@ -103,6 +103,13 @@ export async function mountFor(kind, { env = process.env, archil = {} } = {}) {
|
|
|
103
103
|
live(env);
|
|
104
104
|
return archilRunFolder({ ...settings, ...archil });
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* The E2B host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
|
|
108
|
+
* since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
109
|
+
*/
|
|
110
|
+
export async function createHost({ env = process.env, Sandbox } = {}) {
|
|
111
|
+
return (await create({ ...settingsFromEnv(env), ...(Sandbox ? { Sandbox } : {}) })).host;
|
|
112
|
+
}
|
|
106
113
|
/** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
|
|
107
114
|
export async function createDriftedProvider({ env = process.env, Sandbox, timeouts, buildDaemon = (version) => buildDriftDaemon("amd64", version) } = {}) {
|
|
108
115
|
live(env);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { MachineHost } from "../host.js";
|
|
2
|
+
/** The checks, in the order they run. */
|
|
3
|
+
export declare const EXEC_STREAM_CHECKS: readonly ["stdout-bytes", "stdin-bytes", "large", "stdout-live", "stdin-live", "stderr", "exit-code", "kill", "no-timeout"];
|
|
4
|
+
export type ExecStreamCheckId = (typeof EXEC_STREAM_CHECKS)[number];
|
|
5
|
+
export interface ExecStreamCheck {
|
|
6
|
+
id: ExecStreamCheckId;
|
|
7
|
+
status: "pass" | "fail";
|
|
8
|
+
/** What passed, or what the vendor's exec did wrong, in words a person can act on. */
|
|
9
|
+
words: string;
|
|
10
|
+
ms: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ExecStreamReport {
|
|
13
|
+
host: string;
|
|
14
|
+
machine: string;
|
|
15
|
+
checks: ExecStreamCheck[];
|
|
16
|
+
pass: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface ExecStreamOptions {
|
|
19
|
+
/** How long the no-timeout check's process runs, silent, before it prints and exits; default 75 s. */
|
|
20
|
+
longMs?: number;
|
|
21
|
+
/** How long one step waits: exec's answer, bytes coming back, wait() after the end; default 30 s. */
|
|
22
|
+
stepMs?: number;
|
|
23
|
+
/** The large check's payload, in bytes; default 8 MiB. */
|
|
24
|
+
largeBytes?: number;
|
|
25
|
+
/** How long the large check may take in all; default 180 s. */
|
|
26
|
+
largeMs?: number;
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
/** Told of each check as it ends. */
|
|
29
|
+
onCheck?: (check: ExecStreamCheck) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare const DEFAULT_LONG_MS = 75000;
|
|
32
|
+
/** --quick's no-timeout check: long enough to cross a second, short enough for CI. */
|
|
33
|
+
export declare const QUICK_LONG_MS = 5000;
|
|
34
|
+
/**
|
|
35
|
+
* Why `got` is not `sent`, in words, or undefined when they are the same bytes. `way` is where they went ("on stdout");
|
|
36
|
+
* the first byte that differs is named, and the usual ways an exec mangles bytes are named for what they are.
|
|
37
|
+
*/
|
|
38
|
+
export declare function bytesProblem(sent: Uint8Array, got: Uint8Array, way: string): string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The exec pre-check on one machine: each check in EXEC_STREAM_CHECKS runs in turn, and the report passes when every one
|
|
41
|
+
* does. host.exec is the only member called.
|
|
42
|
+
*/
|
|
43
|
+
export declare function checkExecStream(host: MachineHost, machine: string, options?: ExecStreamOptions): Promise<ExecStreamReport>;
|
|
44
|
+
/** The report as a person reads it: one line per check, what failed in words, the verdict last. */
|
|
45
|
+
export declare function formatExecStream(report: ExecStreamReport): string;
|