@parcha/agentrun-computer 0.1.0-beta.53 → 0.1.0-beta.54
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 +147 -14
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +1 -1
- package/dist/conformance/cases/mount.js +3 -8
- package/dist/conformance/groundbox.d.ts +61 -0
- package/dist/conformance/groundbox.js +87 -0
- package/dist/conformance/sweep.js +1 -1
- package/dist/daytona.d.ts +7 -0
- package/dist/daytona.js +38 -38
- package/dist/descriptors/daytona.d.ts +4 -0
- package/dist/descriptors/daytona.js +2 -0
- package/dist/descriptors/groundbox.d.ts +34 -0
- package/dist/descriptors/groundbox.js +30 -0
- package/dist/descriptors/index.d.ts +33 -1
- package/dist/descriptors/index.js +4 -2
- package/dist/groundbox.d.ts +61 -0
- package/dist/groundbox.js +663 -0
- package/dist/host.d.ts +2 -2
- package/dist/hosted/provider.d.ts +5 -1
- package/dist/hosted/provider.js +73 -9
- package/dist/hosted/scripts.d.ts +7 -4
- package/dist/hosted/scripts.js +11 -6
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/sync-folder.d.ts +14 -10
- package/dist/sync-folder.js +25 -7
- package/dist/tar.d.ts +0 -2
- package/dist/tar.js +1 -1
- package/package.json +8 -2
package/dist/daytona.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
// The Daytona host: Daytona sandboxes over Daytona's v0 REST API with fetch (no SDK). Daytona's toolbox daemon is the
|
|
2
2
|
// sandbox's first process, so computerd is a child: its upload goes through the toolbox's file API, and every command
|
|
3
3
|
// (install, init's start, the stdio bridge, an Archil computer's root steps) is a session command, its output read from
|
|
4
|
-
// the command's log stream and its stdin sent as the command's input. With connect
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// is never relied on (one registered without the box CMD as its entrypoint has none), and one that runs the box CMD
|
|
8
|
-
// sleeps without the URL, so agentrun-dial never runs twice. The rest of the computer is the shared machine-host
|
|
9
|
-
// adapter's (./hosted/provider.ts). Every Daytona fact used here is cited in the README's Daytona section.
|
|
4
|
+
// the command's log stream and its stdin sent as the command's input. With connect dial, create starts agentrun-dial
|
|
5
|
+
// itself in a toolbox session (README, Daytona on dial). The rest of the computer is the shared machine-host adapter's
|
|
6
|
+
// (./hosted/provider.ts). Every Daytona fact used here is cited in the README's Daytona section.
|
|
10
7
|
import { randomBytes } from "node:crypto";
|
|
11
8
|
import { connectOf, kindRefusal, mountsOf } from "./descriptor.js";
|
|
12
9
|
import { DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU, DAYTONA_GPU_REGION, DAYTONA_GPU_SNAPSHOT, daytonaGpuSnapshot } from "./descriptors/daytona.js";
|
|
@@ -21,6 +18,15 @@ import { dateOf, isWhole, sizeRefusals } from "./hosted/values.js";
|
|
|
21
18
|
import { MAX_LINE_BYTES } from "./protocol.js";
|
|
22
19
|
import { checkGpu } from "./provider.js";
|
|
23
20
|
import { ok, vendorFail } from "./result.js";
|
|
21
|
+
/** options.listedMs as a whole number of ms above 0 (a number, or its digits as DAYTONA_LISTED_MS gives them), or undefined when unset. */
|
|
22
|
+
function listedMsOf(value) {
|
|
23
|
+
if (value === undefined || value === "")
|
|
24
|
+
return undefined;
|
|
25
|
+
const ms = typeof value === "string" && /^\s*\d+\s*$/.test(value) ? Number(value) : value;
|
|
26
|
+
if (!isWhole(ms) || ms <= 0)
|
|
27
|
+
throw new Error(`listedMs (DAYTONA_LISTED_MS) is a whole number of ms above 0, not ${JSON.stringify(value)}`);
|
|
28
|
+
return ms;
|
|
29
|
+
}
|
|
24
30
|
/** A positive finite figure of Daytona's answer, else undefined (absent, zero or not a number: never guessed). */
|
|
25
31
|
const given = (value) => (typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined);
|
|
26
32
|
/** What Daytona says a sandbox was given (Machine.resources): its CPUs, its memory (GiB, as MB), its disk (GiB) and its
|
|
@@ -126,8 +132,8 @@ class DaytonaHost {
|
|
|
126
132
|
upload;
|
|
127
133
|
/** connect dial alone: agentrun-dial's session command's log. */
|
|
128
134
|
dialLog;
|
|
129
|
-
/**
|
|
130
|
-
#
|
|
135
|
+
/** The command that runs agentrun-dial, by sandbox id, from its create: what dialLog reads. Let go of at its delete. */
|
|
136
|
+
#dials = new Map();
|
|
131
137
|
/** Daytona's REST API: the control plane, and the toolbox of each sandbox. */
|
|
132
138
|
#rest;
|
|
133
139
|
#headers;
|
|
@@ -254,28 +260,25 @@ class DaytonaHost {
|
|
|
254
260
|
const id = sb?.id;
|
|
255
261
|
if (typeof id !== "string" || id === "")
|
|
256
262
|
throw new Error("POST /sandbox: no sandbox id in the answer");
|
|
257
|
-
if (req.boot !== undefined)
|
|
258
|
-
const token = req.boot.env.AGENTRUN_ATTACH_TOKEN;
|
|
259
|
-
if (token !== undefined && token !== "")
|
|
260
|
-
this.#dialTokens.set(id, token);
|
|
263
|
+
if (req.boot !== undefined)
|
|
261
264
|
await this.#startDial(sb, attach ?? "", until, ctx.timeoutMs);
|
|
262
|
-
}
|
|
263
265
|
return { id };
|
|
264
266
|
}
|
|
265
267
|
/**
|
|
266
268
|
* A dial sandbox's agentrun-dial, started once the sandbox reads started (by `until`, ms after create began): one
|
|
267
269
|
* toolbox session of its own (DIAL_SESSION), its one command async: dialLaunch's line, as root (the toolbox runs
|
|
268
|
-
* session commands as root), AGENTRUN_ATTACH_URL a quoted assignment on it. The token is never on it: it stays in the
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
270
|
+
* session commands as root), AGENTRUN_ATTACH_URL a quoted assignment on it. The token is never on it: it stays in the
|
|
271
|
+
* sandbox's env, which the command inherits. The session and the command's id are kept, so its log is the dial's last
|
|
272
|
+
* words (dialLog). A sandbox gone as a machine reads (stateOf: failed, destroying or asked to destroy), or a session or
|
|
273
|
+
* command Daytona refuses, throws vendor in Daytona's words, and one not started by `until` throws timeout: either is
|
|
274
|
+
* a create that made a machine to the adapter, which deletes it by its name.
|
|
272
275
|
*/
|
|
273
276
|
async #startDial(posted, attach, until, timeoutMs) {
|
|
274
277
|
const { id } = posted;
|
|
275
278
|
let sb = posted;
|
|
276
|
-
|
|
277
|
-
if (
|
|
278
|
-
throw new HostError("vendor", `Daytona reads the sandbox ${id} ${sb.state}, so agentrun-dial was not started: ${sb.errorReason || "no reason given"}`);
|
|
279
|
+
for (let state = stateOf(sb); state !== "running"; state = stateOf(sb)) {
|
|
280
|
+
if (state === "gone")
|
|
281
|
+
throw new HostError("vendor", `Daytona reads the sandbox ${id} ${sb.state}${sb.desiredState === "destroyed" ? ", to be destroyed" : ""}, so agentrun-dial was not started: ${sb.errorReason || "no reason given"}`);
|
|
279
282
|
if (Date.now() + this.#pollMs >= until)
|
|
280
283
|
throw new HostError("timeout", `the sandbox ${id} did not read started within ${seconds(timeoutMs)} (it reads ${sb.state ?? "no state"}), so agentrun-dial was not started`);
|
|
281
284
|
await sleep(this.#pollMs);
|
|
@@ -288,30 +291,25 @@ class DaytonaHost {
|
|
|
288
291
|
}
|
|
289
292
|
try {
|
|
290
293
|
const toolbox = await this.#toolbox(id);
|
|
291
|
-
await this.#runAsync(toolbox, DIAL_SESSION, dialLaunch({ rootOnly: this.facts.rootOnly, attach }), Math.max(1, until - Date.now()));
|
|
294
|
+
const { commandId } = await this.#runAsync(toolbox, DIAL_SESSION, dialLaunch({ rootOnly: this.facts.rootOnly, attach }), Math.max(1, until - Date.now()));
|
|
295
|
+
this.#dials.set(id, commandId);
|
|
292
296
|
}
|
|
293
297
|
catch (error) {
|
|
294
298
|
throw new HostError("vendor", `starting agentrun-dial in ${id} failed: ${words(error)}`);
|
|
295
299
|
}
|
|
296
300
|
}
|
|
297
301
|
/**
|
|
298
|
-
* What agentrun-dial wrote:
|
|
299
|
-
*
|
|
302
|
+
* What agentrun-dial wrote: one read of the log of the command create started. The toolbox answers a client that names
|
|
303
|
+
* no SDK version with the log as written, each write behind its stream's prefix (README, Daytona on dial), and the
|
|
304
|
+
* prefixes are dropped. undefined when this host started no agentrun-dial there.
|
|
300
305
|
*/
|
|
301
306
|
async #dialLog(id, ctx) {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
if (!read.ok && read.error.code === "not_found")
|
|
307
|
+
const commandId = this.#dials.get(id);
|
|
308
|
+
if (commandId === undefined)
|
|
305
309
|
return undefined;
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const logs = orThrow(await this.#rest.call("GET", `${session}/command/${encodeURIComponent(command.id)}/logs`, { retry: true, timeoutMs: ctx.timeoutMs }, ctx.signal));
|
|
310
|
-
const json = jsonOf(logs.bytes);
|
|
311
|
-
const text = typeof json?.output === "string" ? json.output : typeof json?.stdout === "string" || typeof json?.stderr === "string" ? `${json.stdout ?? ""}${json.stderr ?? ""}` : decoder.decode(logs.bytes);
|
|
312
|
-
const said = text.replaceAll(OUT.toString("latin1"), "").replaceAll(ERR.toString("latin1"), "");
|
|
313
|
-
const token = this.#dialTokens.get(id);
|
|
314
|
-
return token === undefined ? said : said.replaceAll(token, "<token>");
|
|
310
|
+
const session = `${await this.#toolbox(id, ctx.signal)}/process/session/${DIAL_SESSION}`;
|
|
311
|
+
const logs = orThrow(await this.#rest.call("GET", `${session}/command/${encodeURIComponent(commandId)}/logs`, { retry: true, timeoutMs: ctx.timeoutMs }, ctx.signal));
|
|
312
|
+
return decoder.decode(logs.bytes).replaceAll(OUT.toString("latin1"), "").replaceAll(ERR.toString("latin1"), "");
|
|
315
313
|
}
|
|
316
314
|
/** GET /sandbox/{id}; one Daytona answers 404 for, or reads destroyed, is none. */
|
|
317
315
|
async get(id, ctx) {
|
|
@@ -352,7 +350,7 @@ class DaytonaHost {
|
|
|
352
350
|
*/
|
|
353
351
|
async delete(id, ctx) {
|
|
354
352
|
this.#toolboxes.delete(id);
|
|
355
|
-
this.#
|
|
353
|
+
this.#dials.delete(id);
|
|
356
354
|
let failure;
|
|
357
355
|
for (let attempt = 1; attempt <= DELETE_ATTEMPTS; attempt++) {
|
|
358
356
|
const removed = await this.#rest.call("DELETE", sandboxUrl(this.#rest, id), { retry: true, timeoutMs: ctx.timeoutMs });
|
|
@@ -608,7 +606,7 @@ class DaytonaHost {
|
|
|
608
606
|
*/
|
|
609
607
|
export class DaytonaProvider extends HostedProvider {
|
|
610
608
|
constructor(options) {
|
|
611
|
-
const { apiKey, apiUrl = DEFAULT_API_URL, arch = "amd64", sandboxClass = "container", target, gpuSnapshot, autoStopMinutes = 0, autoDeleteMinutes, connect, fetch: fetcher, webSocket, pause, timeouts = {}, ...hosted } = options ?? {};
|
|
609
|
+
const { apiKey, apiUrl = DEFAULT_API_URL, arch = "amd64", sandboxClass = "container", target, gpuSnapshot, autoStopMinutes = 0, autoDeleteMinutes, connect, fetch: fetcher, webSocket, pause, timeouts = {}, listedMs, ...hosted } = options ?? {};
|
|
612
610
|
const via = connectOf(DAYTONA, { connect });
|
|
613
611
|
const refused = kindRefusal(DAYTONA, { kind: hosted.kind, connect: via });
|
|
614
612
|
if (refused !== undefined)
|
|
@@ -629,7 +627,9 @@ export class DaytonaProvider extends HostedProvider {
|
|
|
629
627
|
minutes("autoStopMinutes", autoStopMinutes);
|
|
630
628
|
if (autoDeleteMinutes !== undefined)
|
|
631
629
|
minutes("autoDeleteMinutes", autoDeleteMinutes);
|
|
632
|
-
const
|
|
630
|
+
const listed = listedMsOf(listedMs);
|
|
631
|
+
const { retryMs = DEFAULT_RETRY_MS, ...asked } = timeouts;
|
|
632
|
+
const hostedTimeouts = { ...(listed === undefined ? {} : { listedMs: listed }), ...asked };
|
|
633
633
|
if (!isWhole(retryMs) || retryMs <= 0)
|
|
634
634
|
throw new Error(`timeouts.retryMs must be a whole number of ms above 0, not ${retryMs}`);
|
|
635
635
|
const { requestMs, pollMs } = timeoutsOf(hostedTimeouts);
|
|
@@ -73,6 +73,10 @@ export declare const DAYTONA: {
|
|
|
73
73
|
readonly name: "DAYTONA_ATTACH_EGRESS";
|
|
74
74
|
readonly option: "attachEgress";
|
|
75
75
|
readonly required: false;
|
|
76
|
+
}, {
|
|
77
|
+
readonly name: "DAYTONA_LISTED_MS";
|
|
78
|
+
readonly option: "listedMs";
|
|
79
|
+
readonly required: false;
|
|
76
80
|
}];
|
|
77
81
|
readonly settings: readonly [{
|
|
78
82
|
readonly name: "daytonaConnect";
|
|
@@ -77,6 +77,8 @@ export const DAYTONA = defineProvider({
|
|
|
77
77
|
{ name: "DAYTONA_TARGET", option: "target", required: false },
|
|
78
78
|
{ name: DAYTONA_ARCHIL_EGRESS, option: "archilEgress", required: false },
|
|
79
79
|
{ name: DAYTONA_ATTACH_EGRESS, option: "attachEgress", required: false },
|
|
80
|
+
// How long create waits for the label listing, in ms (DaytonaProviderOptions.listedMs): no secret, a tuning.
|
|
81
|
+
{ name: "DAYTONA_LISTED_MS", option: "listedMs", required: false },
|
|
80
82
|
],
|
|
81
83
|
// How the server reaches its machines: exec (the provider's default, when the server's settings name none), a session
|
|
82
84
|
// command through the toolbox per connection, or dial, the machine dials the server (a snapshot of box/Dockerfile).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The name of Groundbox's own image: no template and no image is sent, so Groundbox starts the team's default template
|
|
3
|
+
* when it has one, else its own image (Ubuntu 24.04 with the usual tools). Groundbox reserves the name, so no template
|
|
4
|
+
* can hold it. Not the provider's default: that image keeps toolchains under /opt deeper than the isolation probe
|
|
5
|
+
* searches, so the socket fence can't be proven on it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const GROUNDBOX_OWN_IMAGE = "default";
|
|
8
|
+
export declare const GROUNDBOX: {
|
|
9
|
+
readonly id: "groundbox";
|
|
10
|
+
readonly label: "Groundbox";
|
|
11
|
+
readonly keys: readonly [{
|
|
12
|
+
readonly name: "GROUNDBOX_API_KEY";
|
|
13
|
+
readonly option: "apiKey";
|
|
14
|
+
readonly required: true;
|
|
15
|
+
}];
|
|
16
|
+
readonly metered: true;
|
|
17
|
+
readonly mounts: readonly [];
|
|
18
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
19
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities, {
|
|
20
|
+
readonly options: {
|
|
21
|
+
readonly kind: "desktop";
|
|
22
|
+
};
|
|
23
|
+
readonly kind: import("../protocol.js").ComputerKind;
|
|
24
|
+
readonly groups: import("../protocol.js").Group[];
|
|
25
|
+
readonly gpu?: import("../provider.js").GpuCapability;
|
|
26
|
+
readonly persistence?: {
|
|
27
|
+
keepsState: true;
|
|
28
|
+
resume: boolean;
|
|
29
|
+
};
|
|
30
|
+
readonly image?: string;
|
|
31
|
+
}];
|
|
32
|
+
readonly prepareImage: true;
|
|
33
|
+
readonly load: () => Promise<typeof import("../groundbox.js")>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Groundbox's descriptor: a Linux sandbox on a Groundbox sandbox (a Firecracker microVM), started from our box image, the
|
|
2
|
+
// public registry tag its prepareImage() answers (box-image.ts), which Groundbox turns into a disk at the first create.
|
|
3
|
+
// A spec may name Groundbox's own image ("default"), a template of the key's team, or another public image instead. Kind
|
|
4
|
+
// linux or desktop; the run's folder is a synced folder (derived); no Archil mount yet.
|
|
5
|
+
import { defineProvider } from "../descriptor.js";
|
|
6
|
+
import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
|
|
7
|
+
/**
|
|
8
|
+
* The name of Groundbox's own image: no template and no image is sent, so Groundbox starts the team's default template
|
|
9
|
+
* when it has one, else its own image (Ubuntu 24.04 with the usual tools). Groundbox reserves the name, so no template
|
|
10
|
+
* can hold it. Not the provider's default: that image keeps toolchains under /opt deeper than the isolation probe
|
|
11
|
+
* searches, so the socket fence can't be proven on it.
|
|
12
|
+
*/
|
|
13
|
+
export const GROUNDBOX_OWN_IMAGE = "default";
|
|
14
|
+
export const GROUNDBOX = defineProvider({
|
|
15
|
+
id: "groundbox",
|
|
16
|
+
label: "Groundbox",
|
|
17
|
+
keys: [{ name: "GROUNDBOX_API_KEY", option: "apiKey", required: true }],
|
|
18
|
+
metered: true,
|
|
19
|
+
// None yet: the guest kernel has FUSE, and Archil's client there is untried.
|
|
20
|
+
mounts: [],
|
|
21
|
+
// All three are ours: root in the guest makes a network namespace, so init's fence holds none and its egress proxy
|
|
22
|
+
// open and a list (hosted/network.ts). Groundbox's own allowlist (allow_hosts) is not used.
|
|
23
|
+
network: ["none", "open", "allow"],
|
|
24
|
+
// A linux computer, or a desktop (create()'s kind: "desktop"): the box image's Xvfb and xfwm4, started through computerd
|
|
25
|
+
// over the exec, as on E2B and boxd. Groundbox's own desktop (desktop: true, its own X server and Chrome) is not used.
|
|
26
|
+
capabilities: [SANDBOX, { ...LINUX_DESKTOP, options: { kind: "desktop" } }],
|
|
27
|
+
// No default image: every computer starts from the box image its prepareImage() answers, unless its spec names one.
|
|
28
|
+
prepareImage: true,
|
|
29
|
+
load: () => import("../groundbox.js"),
|
|
30
|
+
});
|
|
@@ -6,6 +6,7 @@ import { DAYTONA } from "./daytona.js";
|
|
|
6
6
|
import { DOCKER } from "./docker.js";
|
|
7
7
|
import { E2B } from "./e2b.js";
|
|
8
8
|
import { FLY } from "./fly.js";
|
|
9
|
+
import { GROUNDBOX } from "./groundbox.js";
|
|
9
10
|
import { KERNEL } from "./kernel.js";
|
|
10
11
|
import { LOCAL } from "./local-chrome.js";
|
|
11
12
|
import { MODAL } from "./modal.js";
|
|
@@ -59,6 +60,10 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
59
60
|
readonly name: "DAYTONA_ATTACH_EGRESS";
|
|
60
61
|
readonly option: "attachEgress";
|
|
61
62
|
readonly required: false;
|
|
63
|
+
}, {
|
|
64
|
+
readonly name: "DAYTONA_LISTED_MS";
|
|
65
|
+
readonly option: "listedMs";
|
|
66
|
+
readonly required: false;
|
|
62
67
|
}];
|
|
63
68
|
readonly settings: readonly [{
|
|
64
69
|
readonly name: "daytonaConnect";
|
|
@@ -486,10 +491,37 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
486
491
|
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
487
492
|
readonly prepareImage: true;
|
|
488
493
|
readonly load: () => Promise<typeof import("../smolcloud.js")>;
|
|
494
|
+
}, {
|
|
495
|
+
readonly id: "groundbox";
|
|
496
|
+
readonly label: "Groundbox";
|
|
497
|
+
readonly keys: readonly [{
|
|
498
|
+
readonly name: "GROUNDBOX_API_KEY";
|
|
499
|
+
readonly option: "apiKey";
|
|
500
|
+
readonly required: true;
|
|
501
|
+
}];
|
|
502
|
+
readonly metered: true;
|
|
503
|
+
readonly mounts: readonly [];
|
|
504
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
505
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities, {
|
|
506
|
+
readonly options: {
|
|
507
|
+
readonly kind: "desktop";
|
|
508
|
+
};
|
|
509
|
+
readonly kind: import("../protocol.js").ComputerKind;
|
|
510
|
+
readonly groups: import("../protocol.js").Group[];
|
|
511
|
+
readonly gpu?: import("../provider.js").GpuCapability;
|
|
512
|
+
readonly persistence?: {
|
|
513
|
+
keepsState: true;
|
|
514
|
+
resume: boolean;
|
|
515
|
+
};
|
|
516
|
+
readonly image?: string;
|
|
517
|
+
}];
|
|
518
|
+
readonly prepareImage: true;
|
|
519
|
+
readonly load: () => Promise<typeof import("../groundbox.js")>;
|
|
489
520
|
}];
|
|
490
|
-
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS, SMOLCLOUD };
|
|
521
|
+
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, GROUNDBOX, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS, SMOLCLOUD };
|
|
491
522
|
export { AGENT37_BASE_TEMPLATE } from "./agent37.js";
|
|
492
523
|
export { BOXD_DEFAULT_IMAGE } from "./boxd.js";
|
|
524
|
+
export { GROUNDBOX_OWN_IMAGE } from "./groundbox.js";
|
|
493
525
|
export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, type DaytonaGpuSnapshot, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
|
|
494
526
|
export { ORGO_BASE_IMAGE } from "./orgo.js";
|
|
495
527
|
export { PHONE_GROUPS, PHONE_IMAGE } from "./phone-harness.js";
|
|
@@ -8,6 +8,7 @@ import { DAYTONA } from "./daytona.js";
|
|
|
8
8
|
import { DOCKER } from "./docker.js";
|
|
9
9
|
import { E2B } from "./e2b.js";
|
|
10
10
|
import { FLY } from "./fly.js";
|
|
11
|
+
import { GROUNDBOX } from "./groundbox.js";
|
|
11
12
|
import { KERNEL } from "./kernel.js";
|
|
12
13
|
import { LOCAL } from "./local-chrome.js";
|
|
13
14
|
import { MODAL } from "./modal.js";
|
|
@@ -15,10 +16,11 @@ import { MORPH } from "./morph.js";
|
|
|
15
16
|
import { ORGO } from "./orgo.js";
|
|
16
17
|
import { PHONE_HARNESS } from "./phone-harness.js";
|
|
17
18
|
import { SMOLCLOUD } from "./smolcloud.js";
|
|
18
|
-
export const DESCRIPTORS = [DOCKER, DAYTONA, MODAL, E2B, AGENT37, MORPH, CLOUDFLARE, FLY, ORGO, PHONE_HARNESS, BROWSERBASE, KERNEL, LOCAL, BOXD, SMOLCLOUD];
|
|
19
|
-
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS, SMOLCLOUD };
|
|
19
|
+
export const DESCRIPTORS = [DOCKER, DAYTONA, MODAL, E2B, AGENT37, MORPH, CLOUDFLARE, FLY, ORGO, PHONE_HARNESS, BROWSERBASE, KERNEL, LOCAL, BOXD, SMOLCLOUD, GROUNDBOX];
|
|
20
|
+
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, GROUNDBOX, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS, SMOLCLOUD };
|
|
20
21
|
export { AGENT37_BASE_TEMPLATE } from "./agent37.js";
|
|
21
22
|
export { BOXD_DEFAULT_IMAGE } from "./boxd.js";
|
|
23
|
+
export { GROUNDBOX_OWN_IMAGE } from "./groundbox.js";
|
|
22
24
|
export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
|
|
23
25
|
export { ORGO_BASE_IMAGE } from "./orgo.js";
|
|
24
26
|
export { PHONE_GROUPS, PHONE_IMAGE } from "./phone-harness.js";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { HostedProvider, type HostedOptions } from "./hosted/provider.js";
|
|
2
|
+
import { type Result } from "./result.js";
|
|
3
|
+
/** The parts of a WebSocket the host uses: Node's global WebSocket, or a stand-in in tests. */
|
|
4
|
+
export interface GroundboxSocket {
|
|
5
|
+
/** 0 connecting, 1 open, 2 closing, 3 closed. */
|
|
6
|
+
readonly readyState: number;
|
|
7
|
+
/** Bytes sent and not yet on the wire: a write waits while it is high. */
|
|
8
|
+
readonly bufferedAmount: number;
|
|
9
|
+
send(text: string): void;
|
|
10
|
+
close(code?: number): void;
|
|
11
|
+
addEventListener(type: "open" | "message" | "close" | "error", listener: (event: {
|
|
12
|
+
data?: unknown;
|
|
13
|
+
code?: number;
|
|
14
|
+
message?: string;
|
|
15
|
+
}) => void): void;
|
|
16
|
+
}
|
|
17
|
+
export type GroundboxSocketFactory = (url: string, init: {
|
|
18
|
+
headers: Record<string, string>;
|
|
19
|
+
}) => GroundboxSocket;
|
|
20
|
+
/** The Groundbox provider's options: the key and Groundbox's own settings, then the shared adapter's (HostedOptions). */
|
|
21
|
+
export interface GroundboxProviderOptions extends HostedOptions {
|
|
22
|
+
/** The Groundbox API key (gbx_...). The caller passes it; this provider never reads it from the environment. */
|
|
23
|
+
apiKey: string;
|
|
24
|
+
/** The REST API, ending in /v1; default https://api.groundbox.dev/v1. */
|
|
25
|
+
apiUrl?: string;
|
|
26
|
+
/** Every sandbox's disk, in whole GB, 1 to 100; default Groundbox's own (20). A spec names no disk. */
|
|
27
|
+
diskGb?: number;
|
|
28
|
+
/** The fetch every call goes through; default the global one. */
|
|
29
|
+
fetch?: typeof fetch;
|
|
30
|
+
/** For tests: every command stream opens through it. Default Node's global WebSocket. */
|
|
31
|
+
webSocket?: GroundboxSocketFactory;
|
|
32
|
+
/**
|
|
33
|
+
* For tests: the command stream's bounds (the silence after which a socket is taken as dead; the unread output that
|
|
34
|
+
* pauses reading, and the level it resumes at).
|
|
35
|
+
*/
|
|
36
|
+
streamBounds?: Partial<StreamBounds>;
|
|
37
|
+
}
|
|
38
|
+
export declare function create(options: GroundboxProviderOptions): Promise<GroundboxProvider>;
|
|
39
|
+
/** The conformance CLI's module for Groundbox: its live switch, the run's 30-minute cap and its image. */
|
|
40
|
+
export declare const conformance: () => Promise<typeof import("./conformance/groundbox.js")>;
|
|
41
|
+
/** The command stream's bounds: SILENCE_MS, QUEUE_HIGH, QUEUE_LOW and RESUME_GIVE_UP_MS unless a test gives others. */
|
|
42
|
+
export interface StreamBounds {
|
|
43
|
+
silenceMs: number;
|
|
44
|
+
queueHighBytes: number;
|
|
45
|
+
queueLowBytes: number;
|
|
46
|
+
resumeGiveUpMs: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Computers that are Groundbox sandboxes, on the shared adapter. A spec's image is the box image by default
|
|
50
|
+
* (prepareImage), "default" (the team's default template, else Groundbox's own image), a template of the key's team, or
|
|
51
|
+
* a public image.
|
|
52
|
+
*/
|
|
53
|
+
export declare class GroundboxProvider extends HostedProvider {
|
|
54
|
+
/**
|
|
55
|
+
* The provider contract's prepareImage (its descriptor declares it): the box image the release publishes, by its
|
|
56
|
+
* public registry tag (box-image.ts). No call: Groundbox turns it into a disk at the first create from it, and keeps
|
|
57
|
+
* that disk for later ones.
|
|
58
|
+
*/
|
|
59
|
+
prepareImage(): Promise<Result<string>>;
|
|
60
|
+
constructor(options: GroundboxProviderOptions);
|
|
61
|
+
}
|