@parcha/agentrun-computer 0.1.0-beta.40 → 0.1.0-beta.42
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 +285 -28
- package/box/Dockerfile +6 -4
- package/box/README.md +10 -2
- package/box/build-daytona.py +3 -1
- package/box/build-e2b.mjs +1 -1
- package/box/install.sh +68 -7
- package/dist/attach.d.ts +46 -1
- package/dist/attach.js +48 -4
- package/dist/box-image.d.ts +1 -1
- package/dist/box-image.js +1 -1
- package/dist/boxd.d.ts +126 -0
- package/dist/boxd.js +418 -0
- package/dist/cloudflare.d.ts +32 -0
- package/dist/cloudflare.js +179 -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/cases/provider.js +42 -26
- package/dist/conformance/cli.js +4 -1
- package/dist/conformance/cloudflare.d.ts +42 -0
- package/dist/conformance/cloudflare.js +54 -0
- package/dist/conformance/daytona.d.ts +25 -0
- package/dist/conformance/daytona.js +26 -1
- 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/exec-stream.js +14 -6
- 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 +5 -1
- package/dist/conformance/sweep.d.ts +1 -1
- package/dist/conformance/sweep.js +1 -1
- package/dist/conformance/types.d.ts +21 -0
- package/dist/daytona.d.ts +8 -1
- package/dist/daytona.js +124 -101
- package/dist/descriptor.d.ts +22 -1
- package/dist/descriptor.js +18 -0
- 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/daytona.d.ts +12 -3
- package/dist/descriptors/daytona.js +15 -7
- 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 +121 -2
- 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 +52 -48
- package/dist/hosted/framed-exec.d.ts +8 -19
- package/dist/hosted/framed-exec.js +21 -87
- package/dist/hosted/process.d.ts +21 -0
- package/dist/hosted/process.js +37 -2
- package/dist/hosted/provider.d.ts +32 -6
- package/dist/hosted/provider.js +239 -236
- package/dist/hosted/rest.d.ts +19 -0
- package/dist/hosted/rest.js +76 -0
- package/dist/hosted/scripts.d.ts +52 -8
- package/dist/hosted/scripts.js +118 -23
- package/dist/hosted/ssh-exec.d.ts +9 -7
- package/dist/hosted/ssh-exec.js +93 -54
- package/dist/hosted/values.d.ts +5 -0
- package/dist/hosted/values.js +9 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/kinds.d.ts +2 -0
- package/dist/modal.d.ts +6 -0
- package/dist/modal.js +40 -17
- 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/providers.d.ts +4 -2
- package/dist/screen-watch.js +2 -2
- package/package.json +20 -2
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
// Daytona's descriptor: a sandbox on Daytona's cloud, with GPUs when asked;
|
|
1
|
+
// Daytona's descriptor: a sandbox on Daytona's cloud, with GPUs when asked; the run's folder on an Archil disk only where
|
|
2
|
+
// the operator gives an Archil egress relay (a self-hosted Daytona target), never on Daytona's hosted cloud.
|
|
2
3
|
import { defineProvider } from "../descriptor.js";
|
|
3
4
|
import { SANDBOX } from "./shared.js";
|
|
4
|
-
/**
|
|
5
|
-
export const
|
|
5
|
+
/** The key that turns on a Daytona computer's Archil mount: the operator's Archil egress relay (archilEgress). */
|
|
6
|
+
export const DAYTONA_ARCHIL_EGRESS = "DAYTONA_ARCHIL_EGRESS";
|
|
7
|
+
/** Why a Daytona computer made with no Archil egress takes no Archil mount: check() refuses one in these words. */
|
|
8
|
+
export const DAYTONA_NO_ARCHIL = `Archil mounts don't work on Daytona's hosted cloud, where Archil's client hangs on its sandboxes; a self-hosted Daytona target takes one once its operator sets ${DAYTONA_ARCHIL_EGRESS}`;
|
|
6
9
|
/** The image a Daytona computer starts from when its spec names "default": Daytona's own default snapshot. */
|
|
7
10
|
export const DAYTONA_DEFAULT_SNAPSHOT = "default";
|
|
8
11
|
/** The one region Daytona runs a GPU sandbox in, whatever the provider's target. */
|
|
@@ -67,13 +70,17 @@ export const DAYTONA = defineProvider({
|
|
|
67
70
|
{ name: "DAYTONA_API_KEY", option: "apiKey", required: true },
|
|
68
71
|
{ name: "DAYTONA_API_URL", option: "apiUrl", required: false },
|
|
69
72
|
{ name: "DAYTONA_TARGET", option: "target", required: false },
|
|
73
|
+
{ name: DAYTONA_ARCHIL_EGRESS, option: "archilEgress", required: false },
|
|
70
74
|
],
|
|
71
75
|
metered: true,
|
|
72
|
-
// No mount: Archil's client (0.10.1) mounts on
|
|
73
|
-
// so the first statx of the folder hangs, on every kernel and mount shape tried
|
|
74
|
-
//
|
|
76
|
+
// No mount by default: on Daytona's hosted cloud, Archil's client (0.10.1) mounts on its container sandboxes, but
|
|
77
|
+
// nothing reads its /dev/fuse after, so the first statx of the folder hangs, on every kernel and mount shape tried
|
|
78
|
+
// (live, 11-14). An Archil mount is refused in these words, before any request. A self-hosted Daytona target whose
|
|
79
|
+
// sandboxes reach Archil through the operator's egress relay mounts it (live, 11-14): the operator sets
|
|
80
|
+
// DAYTONA_ARCHIL_EGRESS, and a provider made with it takes an Archil mount (mountsOf).
|
|
75
81
|
mounts: [],
|
|
76
82
|
unmounted: { archil: DAYTONA_NO_ARCHIL },
|
|
83
|
+
mountsWith: { archil: DAYTONA_ARCHIL_EGRESS },
|
|
77
84
|
// None: its programs run in a network of their own, their loopback alone (isolation.ts), and the sandbox is made with
|
|
78
85
|
// networkBlockAll. Open and a list: the sandbox is not blocked (the account's tier may still limit where it goes), and
|
|
79
86
|
// its programs' one way out is init's egress proxy, which reaches the public internet alone, and with a list its hosts
|
|
@@ -82,7 +89,8 @@ export const DAYTONA = defineProvider({
|
|
|
82
89
|
// A linux computer, with GPUs when asked.
|
|
83
90
|
capabilities: [{ ...SANDBOX, gpu: DAYTONA_GPU }],
|
|
84
91
|
defaultImage: { sandbox: DAYTONA_DEFAULT_SNAPSHOT },
|
|
85
|
-
// The operator's own snapshot for every Daytona computer, named here; the default snapshot stands while unset.
|
|
92
|
+
// The operator's own snapshot for every Daytona computer, named here; the default snapshot stands while unset. A
|
|
93
|
+
// computer with an Archil mount needs a snapshot of box/Dockerfile (box/build-daytona.py prints its name).
|
|
86
94
|
imageEnv: "AGENTRUN_DAYTONA_SNAPSHOT",
|
|
87
95
|
load: () => import("../daytona.js"),
|
|
88
96
|
});
|
|
@@ -6,6 +6,10 @@ export declare const E2B: {
|
|
|
6
6
|
readonly option: "apiKey";
|
|
7
7
|
readonly required: true;
|
|
8
8
|
}];
|
|
9
|
+
readonly settings: readonly [{
|
|
10
|
+
readonly name: "e2bConnect";
|
|
11
|
+
readonly option: "connect";
|
|
12
|
+
}];
|
|
9
13
|
readonly metered: true;
|
|
10
14
|
readonly mounts: readonly ["archil"];
|
|
11
15
|
readonly network: readonly ["none", "open", "allow"];
|
package/dist/descriptors/e2b.js
CHANGED
|
@@ -6,6 +6,9 @@ export const E2B = defineProvider({
|
|
|
6
6
|
id: "e2b",
|
|
7
7
|
label: "E2B",
|
|
8
8
|
keys: [{ name: "E2B_API_KEY", option: "apiKey", required: true }],
|
|
9
|
+
// How the server reaches its machines: exec (the provider's default, when the server's settings name none), a bridge
|
|
10
|
+
// through envd per connection, or dial, the machine dials the server (a sandbox only).
|
|
11
|
+
settings: [{ name: "e2bConnect", option: "connect" }],
|
|
9
12
|
metered: true,
|
|
10
13
|
mounts: ["archil"],
|
|
11
14
|
// None: its programs run in a network of their own, their loopback alone (isolation.ts), and the sandbox is made with
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const FLY: {
|
|
2
|
+
readonly id: "fly";
|
|
3
|
+
readonly label: "Fly Machines";
|
|
4
|
+
readonly keys: readonly [{
|
|
5
|
+
readonly name: "FLY_API_TOKEN";
|
|
6
|
+
readonly option: "apiToken";
|
|
7
|
+
readonly required: true;
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "FLY_APP";
|
|
10
|
+
readonly option: "app";
|
|
11
|
+
readonly required: true;
|
|
12
|
+
}];
|
|
13
|
+
readonly metered: true;
|
|
14
|
+
readonly mounts: readonly [];
|
|
15
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
16
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
17
|
+
readonly prepareImage: true;
|
|
18
|
+
readonly load: () => Promise<typeof import("../fly.js")>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Fly Machines' descriptor: a Linux sandbox on a Fly Machine (a Firecracker microVM) in the operator's Fly app, started
|
|
2
|
+
// from our box image, the public registry tag its prepareImage() answers (box-image.ts), which Fly pulls at each create.
|
|
3
|
+
// Its machines dial the server (MachineHost facts.connect "dial"): Fly's exec answers only once the command ends, so
|
|
4
|
+
// nothing reaches into a machine from outside, and its computerd dials the server's attach route instead.
|
|
5
|
+
import { defineProvider } from "../descriptor.js";
|
|
6
|
+
import { SANDBOX } from "./shared.js";
|
|
7
|
+
export const FLY = defineProvider({
|
|
8
|
+
id: "fly",
|
|
9
|
+
label: "Fly Machines",
|
|
10
|
+
keys: [
|
|
11
|
+
{ name: "FLY_API_TOKEN", option: "apiToken", required: true },
|
|
12
|
+
// The Fly app its machines live in: one the operator made (fly apps create), as Fly's app names are global, so there
|
|
13
|
+
// is no default. Saved beside the token in Settings → Computers, as Orgo's workspace and Daytona's URL are.
|
|
14
|
+
{ name: "FLY_APP", option: "app", required: true },
|
|
15
|
+
],
|
|
16
|
+
metered: true,
|
|
17
|
+
// None: a machine that dials takes no Archil mount yet (its helper's root steps run through exec, which it has none of).
|
|
18
|
+
mounts: [],
|
|
19
|
+
// None: its programs run in init's network of their own, their loopback alone (isolation.ts). Open and a list: their
|
|
20
|
+
// one way out is init's egress proxy, which reaches the public internet alone, and with a list its hosts alone
|
|
21
|
+
// (hosted/network.ts). The machine itself always reaches out: it fetches its daemon from the server and dials it.
|
|
22
|
+
network: ["none", "open", "allow"],
|
|
23
|
+
// A linux computer alone: agentrun-dial starts init with no display.
|
|
24
|
+
capabilities: [SANDBOX],
|
|
25
|
+
// No default image: every computer starts from the box image its prepareImage() answers.
|
|
26
|
+
prepareImage: true,
|
|
27
|
+
load: () => import("../fly.js"),
|
|
28
|
+
});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { AGENT37 } from "./agent37.js";
|
|
2
|
+
import { BOXD } from "./boxd.js";
|
|
2
3
|
import { BROWSERBASE } from "./browserbase.js";
|
|
4
|
+
import { CLOUDFLARE } from "./cloudflare.js";
|
|
3
5
|
import { DAYTONA } from "./daytona.js";
|
|
4
6
|
import { DOCKER } from "./docker.js";
|
|
5
7
|
import { E2B } from "./e2b.js";
|
|
8
|
+
import { FLY } from "./fly.js";
|
|
6
9
|
import { KERNEL } from "./kernel.js";
|
|
7
10
|
import { LOCAL } from "./local-chrome.js";
|
|
8
11
|
import { MODAL } from "./modal.js";
|
|
12
|
+
import { MORPH } from "./morph.js";
|
|
9
13
|
import { ORGO } from "./orgo.js";
|
|
10
14
|
import { PHONE_HARNESS } from "./phone-harness.js";
|
|
11
15
|
export declare const DESCRIPTORS: readonly [{
|
|
@@ -46,11 +50,18 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
46
50
|
readonly name: "DAYTONA_TARGET";
|
|
47
51
|
readonly option: "target";
|
|
48
52
|
readonly required: false;
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "DAYTONA_ARCHIL_EGRESS";
|
|
55
|
+
readonly option: "archilEgress";
|
|
56
|
+
readonly required: false;
|
|
49
57
|
}];
|
|
50
58
|
readonly metered: true;
|
|
51
59
|
readonly mounts: readonly [];
|
|
52
60
|
readonly unmounted: {
|
|
53
|
-
readonly archil: "Archil mounts don't work on Daytona
|
|
61
|
+
readonly archil: "Archil mounts don't work on Daytona's hosted cloud, where Archil's client hangs on its sandboxes; a self-hosted Daytona target takes one once its operator sets DAYTONA_ARCHIL_EGRESS";
|
|
62
|
+
};
|
|
63
|
+
readonly mountsWith: {
|
|
64
|
+
readonly archil: "DAYTONA_ARCHIL_EGRESS";
|
|
54
65
|
};
|
|
55
66
|
readonly network: readonly ["none", "open", "allow"];
|
|
56
67
|
readonly capabilities: readonly [{
|
|
@@ -85,6 +96,9 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
85
96
|
readonly name: "modalApp";
|
|
86
97
|
readonly option: "app";
|
|
87
98
|
readonly default: "agentrun";
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "modalConnect";
|
|
101
|
+
readonly option: "connect";
|
|
88
102
|
}];
|
|
89
103
|
readonly metered: true;
|
|
90
104
|
readonly mounts: readonly ["archil"];
|
|
@@ -110,6 +124,10 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
110
124
|
readonly option: "apiKey";
|
|
111
125
|
readonly required: true;
|
|
112
126
|
}];
|
|
127
|
+
readonly settings: readonly [{
|
|
128
|
+
readonly name: "e2bConnect";
|
|
129
|
+
readonly option: "connect";
|
|
130
|
+
}];
|
|
113
131
|
readonly metered: true;
|
|
114
132
|
readonly mounts: readonly ["archil"];
|
|
115
133
|
readonly network: readonly ["none", "open", "allow"];
|
|
@@ -146,6 +164,56 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
146
164
|
}];
|
|
147
165
|
readonly prepareImage: true;
|
|
148
166
|
readonly load: () => Promise<typeof import("../agent37.js")>;
|
|
167
|
+
}, {
|
|
168
|
+
readonly id: "morph";
|
|
169
|
+
readonly label: "Morph";
|
|
170
|
+
readonly keys: readonly [{
|
|
171
|
+
readonly name: "MORPH_API_KEY";
|
|
172
|
+
readonly option: "apiKey";
|
|
173
|
+
readonly required: true;
|
|
174
|
+
}];
|
|
175
|
+
readonly metered: true;
|
|
176
|
+
readonly mounts: readonly [];
|
|
177
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
178
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
179
|
+
readonly prepareImage: true;
|
|
180
|
+
readonly load: () => Promise<typeof import("../morph.js")>;
|
|
181
|
+
}, {
|
|
182
|
+
readonly id: "cloudflare";
|
|
183
|
+
readonly label: "Cloudflare";
|
|
184
|
+
readonly keys: readonly [{
|
|
185
|
+
readonly name: "CLOUDFLARE_RELAY_URL";
|
|
186
|
+
readonly option: "relayUrl";
|
|
187
|
+
readonly required: true;
|
|
188
|
+
}, {
|
|
189
|
+
readonly name: "CLOUDFLARE_RELAY_TOKEN";
|
|
190
|
+
readonly option: "relayToken";
|
|
191
|
+
readonly required: true;
|
|
192
|
+
}];
|
|
193
|
+
readonly metered: true;
|
|
194
|
+
readonly mounts: readonly [];
|
|
195
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
196
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
197
|
+
readonly prepareImage: true;
|
|
198
|
+
readonly load: () => Promise<typeof import("../cloudflare.js")>;
|
|
199
|
+
}, {
|
|
200
|
+
readonly id: "fly";
|
|
201
|
+
readonly label: "Fly Machines";
|
|
202
|
+
readonly keys: readonly [{
|
|
203
|
+
readonly name: "FLY_API_TOKEN";
|
|
204
|
+
readonly option: "apiToken";
|
|
205
|
+
readonly required: true;
|
|
206
|
+
}, {
|
|
207
|
+
readonly name: "FLY_APP";
|
|
208
|
+
readonly option: "app";
|
|
209
|
+
readonly required: true;
|
|
210
|
+
}];
|
|
211
|
+
readonly metered: true;
|
|
212
|
+
readonly mounts: readonly [];
|
|
213
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
214
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
215
|
+
readonly prepareImage: true;
|
|
216
|
+
readonly load: () => Promise<typeof import("../fly.js")>;
|
|
149
217
|
}, {
|
|
150
218
|
readonly id: "orgo";
|
|
151
219
|
readonly label: "Orgo";
|
|
@@ -223,6 +291,7 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
223
291
|
readonly from: "Android platform-tools";
|
|
224
292
|
readonly builds: readonly ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"];
|
|
225
293
|
};
|
|
294
|
+
readonly hostEnv: readonly ["PHONE_HARNESS_APKS"];
|
|
226
295
|
readonly load: () => Promise<typeof import("../phone-harness.js")>;
|
|
227
296
|
}, {
|
|
228
297
|
readonly id: "browserbase";
|
|
@@ -284,9 +353,59 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
284
353
|
};
|
|
285
354
|
readonly hostEnv: readonly ["PI_BROWSER_CHROME", "CHROME_PATH", "PATH"];
|
|
286
355
|
readonly load: () => Promise<typeof import("../local-chrome.js")>;
|
|
356
|
+
}, {
|
|
357
|
+
readonly id: "boxd";
|
|
358
|
+
readonly label: "boxd";
|
|
359
|
+
readonly keys: readonly [{
|
|
360
|
+
readonly name: "BOXD_API_KEY";
|
|
361
|
+
readonly option: "apiKey";
|
|
362
|
+
readonly required: true;
|
|
363
|
+
}, {
|
|
364
|
+
readonly name: "BOXD_ORG";
|
|
365
|
+
readonly option: "org";
|
|
366
|
+
readonly required: false;
|
|
367
|
+
}, {
|
|
368
|
+
readonly name: "BOXD_REGION";
|
|
369
|
+
readonly option: "region";
|
|
370
|
+
readonly required: false;
|
|
371
|
+
}];
|
|
372
|
+
readonly metered: true;
|
|
373
|
+
readonly mounts: readonly [];
|
|
374
|
+
readonly network: readonly ["none"];
|
|
375
|
+
readonly capabilities: readonly [{
|
|
376
|
+
readonly options: {
|
|
377
|
+
readonly kind: "linux";
|
|
378
|
+
};
|
|
379
|
+
readonly kind: import("../protocol.js").ComputerKind;
|
|
380
|
+
readonly groups: import("../protocol.js").Group[];
|
|
381
|
+
readonly gpu?: import("../provider.js").GpuCapability;
|
|
382
|
+
readonly persistence?: {
|
|
383
|
+
keepsState: true;
|
|
384
|
+
resume: boolean;
|
|
385
|
+
};
|
|
386
|
+
readonly image?: string;
|
|
387
|
+
}, {
|
|
388
|
+
readonly options: {
|
|
389
|
+
readonly kind: "desktop";
|
|
390
|
+
};
|
|
391
|
+
readonly kind: import("../protocol.js").ComputerKind;
|
|
392
|
+
readonly groups: import("../protocol.js").Group[];
|
|
393
|
+
readonly gpu?: import("../provider.js").GpuCapability;
|
|
394
|
+
readonly persistence?: {
|
|
395
|
+
keepsState: true;
|
|
396
|
+
resume: boolean;
|
|
397
|
+
};
|
|
398
|
+
readonly image?: string;
|
|
399
|
+
}];
|
|
400
|
+
readonly defaultImage: {
|
|
401
|
+
readonly sandbox: "default";
|
|
402
|
+
};
|
|
403
|
+
readonly prepareImage: true;
|
|
404
|
+
readonly load: () => Promise<typeof import("../boxd.js")>;
|
|
287
405
|
}];
|
|
288
|
-
export { AGENT37, BROWSERBASE, DAYTONA, DOCKER, E2B, KERNEL, LOCAL, MODAL, ORGO, PHONE_HARNESS };
|
|
406
|
+
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS };
|
|
289
407
|
export { AGENT37_BASE_TEMPLATE } from "./agent37.js";
|
|
408
|
+
export { BOXD_DEFAULT_IMAGE } from "./boxd.js";
|
|
290
409
|
export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, type DaytonaGpuSnapshot, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
|
|
291
410
|
export { ORGO_BASE_IMAGE } from "./orgo.js";
|
|
292
411
|
export { PHONE_GROUPS, PHONE_IMAGE } from "./phone-harness.js";
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
// Every built-in provider's descriptor, in the order Settings shows them. Importing this loads descriptors (data) alone:
|
|
2
2
|
// each provider module loads only when its descriptor's load() is called.
|
|
3
3
|
import { AGENT37 } from "./agent37.js";
|
|
4
|
+
import { BOXD } from "./boxd.js";
|
|
4
5
|
import { BROWSERBASE } from "./browserbase.js";
|
|
6
|
+
import { CLOUDFLARE } from "./cloudflare.js";
|
|
5
7
|
import { DAYTONA } from "./daytona.js";
|
|
6
8
|
import { DOCKER } from "./docker.js";
|
|
7
9
|
import { E2B } from "./e2b.js";
|
|
10
|
+
import { FLY } from "./fly.js";
|
|
8
11
|
import { KERNEL } from "./kernel.js";
|
|
9
12
|
import { LOCAL } from "./local-chrome.js";
|
|
10
13
|
import { MODAL } from "./modal.js";
|
|
14
|
+
import { MORPH } from "./morph.js";
|
|
11
15
|
import { ORGO } from "./orgo.js";
|
|
12
16
|
import { PHONE_HARNESS } from "./phone-harness.js";
|
|
13
|
-
export const DESCRIPTORS = [DOCKER, DAYTONA, MODAL, E2B, AGENT37, ORGO, PHONE_HARNESS, BROWSERBASE, KERNEL, LOCAL];
|
|
14
|
-
export { AGENT37, BROWSERBASE, DAYTONA, DOCKER, E2B, KERNEL, LOCAL, MODAL, ORGO, PHONE_HARNESS };
|
|
17
|
+
export const DESCRIPTORS = [DOCKER, DAYTONA, MODAL, E2B, AGENT37, MORPH, CLOUDFLARE, FLY, ORGO, PHONE_HARNESS, BROWSERBASE, KERNEL, LOCAL, BOXD];
|
|
18
|
+
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS };
|
|
15
19
|
export { AGENT37_BASE_TEMPLATE } from "./agent37.js";
|
|
20
|
+
export { BOXD_DEFAULT_IMAGE } from "./boxd.js";
|
|
16
21
|
export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
|
|
17
22
|
export { ORGO_BASE_IMAGE } from "./orgo.js";
|
|
18
23
|
export { PHONE_GROUPS, PHONE_IMAGE } from "./phone-harness.js";
|
|
@@ -30,6 +30,9 @@ export declare const MODAL: {
|
|
|
30
30
|
readonly name: "modalApp";
|
|
31
31
|
readonly option: "app";
|
|
32
32
|
readonly default: "agentrun";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "modalConnect";
|
|
35
|
+
readonly option: "connect";
|
|
33
36
|
}];
|
|
34
37
|
readonly metered: true;
|
|
35
38
|
readonly mounts: readonly ["archil"];
|
|
@@ -34,8 +34,13 @@ export const MODAL = defineProvider({
|
|
|
34
34
|
{ name: "MODAL_TOKEN_ID", option: "tokenId", required: true },
|
|
35
35
|
{ name: "MODAL_TOKEN_SECRET", option: "tokenSecret", required: true },
|
|
36
36
|
],
|
|
37
|
-
// The Modal app its computers live in: the server's own when its settings name none.
|
|
38
|
-
|
|
37
|
+
// The Modal app its computers live in: the server's own when its settings name none. How the server reaches its
|
|
38
|
+
// machines: exec (the provider's default, when the settings name none), a bridge through Modal's exec per
|
|
39
|
+
// connection, or dial, the machine dials the server.
|
|
40
|
+
settings: [
|
|
41
|
+
{ name: "modalApp", option: "app", default: "agentrun" },
|
|
42
|
+
{ name: "modalConnect", option: "connect" },
|
|
43
|
+
],
|
|
39
44
|
metered: true,
|
|
40
45
|
mounts: ["archil"],
|
|
41
46
|
// None: its programs run in a network of their own, their loopback alone (isolation.ts), and the sandbox is made with
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const MORPH: {
|
|
2
|
+
readonly id: "morph";
|
|
3
|
+
readonly label: "Morph";
|
|
4
|
+
readonly keys: readonly [{
|
|
5
|
+
readonly name: "MORPH_API_KEY";
|
|
6
|
+
readonly option: "apiKey";
|
|
7
|
+
readonly required: true;
|
|
8
|
+
}];
|
|
9
|
+
readonly metered: true;
|
|
10
|
+
readonly mounts: readonly [];
|
|
11
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
12
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
13
|
+
readonly prepareImage: true;
|
|
14
|
+
readonly load: () => Promise<typeof import("../morph.js")>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Morph Cloud's descriptor: a Linux sandbox on a Morph instance (a VM started from a snapshot). Every computer starts
|
|
2
|
+
// from the box image built in the key's own account as a Morph snapshot, which its prepareImage() makes once per recipe.
|
|
3
|
+
import { defineProvider } from "../descriptor.js";
|
|
4
|
+
import { SANDBOX } from "./shared.js";
|
|
5
|
+
export const MORPH = defineProvider({
|
|
6
|
+
id: "morph",
|
|
7
|
+
label: "Morph",
|
|
8
|
+
keys: [{ name: "MORPH_API_KEY", option: "apiKey", required: true }],
|
|
9
|
+
metered: true,
|
|
10
|
+
// None yet: Morph's guests have /dev/fuse (docs: documentation/instances/fuse), and Archil's client there is unproven.
|
|
11
|
+
mounts: [],
|
|
12
|
+
// Morph has no egress control at all (no network field in its OpenAPI): all three are ours. None: its programs run in
|
|
13
|
+
// a network of their own, their loopback alone (isolation.ts). Open and a list: their one way out is init's egress
|
|
14
|
+
// proxy, which reaches the public internet alone, and with a list its hosts alone (hosted/network.ts).
|
|
15
|
+
network: ["none", "open", "allow"],
|
|
16
|
+
capabilities: [SANDBOX],
|
|
17
|
+
// No default image: a Morph image is an account's own snapshot id, so every computer starts from the box snapshot
|
|
18
|
+
// its prepareImage() finds or builds in the key's account.
|
|
19
|
+
prepareImage: true,
|
|
20
|
+
load: () => import("../morph.js"),
|
|
21
|
+
});
|
|
@@ -29,5 +29,6 @@ export declare const PHONE_HARNESS: {
|
|
|
29
29
|
readonly from: "Android platform-tools";
|
|
30
30
|
readonly builds: readonly ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"];
|
|
31
31
|
};
|
|
32
|
+
readonly hostEnv: readonly ["PHONE_HARNESS_APKS"];
|
|
32
33
|
readonly load: () => Promise<typeof import("../phone-harness.js")>;
|
|
33
34
|
};
|
|
@@ -19,5 +19,7 @@ export const PHONE_HARNESS = defineProvider({
|
|
|
19
19
|
// The phone is driven by adb from the server's machine (the module's adb option, adb on PATH by default). Google
|
|
20
20
|
// builds platform-tools for x86-64 Linux, macOS and x86-64 Windows alone.
|
|
21
21
|
hostCommand: { command: "adb", from: "Android platform-tools", builds: ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"] },
|
|
22
|
+
// The APKs every phone installs, files on this machine each pinned by its sha256: the operator's setting alone.
|
|
23
|
+
hostEnv: ["PHONE_HARNESS_APKS"],
|
|
22
24
|
load: () => import("../phone-harness.js"),
|
|
23
25
|
});
|
package/dist/e2b.d.ts
CHANGED
|
@@ -23,11 +23,17 @@ export interface E2BProviderOptions extends Omit<HostedOptions, "maxLifetimeMs">
|
|
|
23
23
|
Sandbox: E2BSandboxClass;
|
|
24
24
|
/** E2B's domain: the API is https://api.<domain>. Default e2b.app. */
|
|
25
25
|
domain?: string;
|
|
26
|
-
/** desktop (default): a template with an X server, started through the daemon; linux: no screen. */
|
|
26
|
+
/** desktop (default; linux on connect "dial"): a template with an X server, started through the daemon; linux: no screen. */
|
|
27
27
|
kind?: "desktop" | "linux";
|
|
28
28
|
/** The longest lifetime check takes: E2B Hobby's 1 h by default, Pro's 24 h at most. */
|
|
29
29
|
maxLifetimeMs?: number;
|
|
30
30
|
timeouts?: Partial<HostedTimeouts>;
|
|
31
|
+
/**
|
|
32
|
+
* exec (default): the daemon goes in through envd's file API and each connection is a bridge through envd's process
|
|
33
|
+
* stream. dial: create starts the box template's agentrun-dial once, and the machine dials the server (options.dial),
|
|
34
|
+
* which every connection goes over; kind linux alone.
|
|
35
|
+
*/
|
|
36
|
+
connect?: "exec" | "dial";
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
33
39
|
* What create() takes: the provider's options, the SDK's Sandbox class optional (default the host's e2b package's).
|
package/dist/e2b.js
CHANGED
|
@@ -3,7 +3,8 @@ import { E2B } from "./descriptors/e2b.js";
|
|
|
3
3
|
import { DEADLINE_LABEL, show } from "./drift.js";
|
|
4
4
|
import { HostError } from "./host.js";
|
|
5
5
|
import { deadlineOf, HostedProvider, isoOf, MAX_LABEL, timeoutsOf } from "./hosted/provider.js";
|
|
6
|
-
import {
|
|
6
|
+
import { AGENTRUN_DIAL, hostedCommands, shellLine } from "./hosted/scripts.js";
|
|
7
|
+
import { connectOf, dateOf, DOMAIN, isWhole, sizeRefusals } from "./hosted/values.js";
|
|
7
8
|
import { PassThrough } from "node:stream";
|
|
8
9
|
import { ok } from "./result.js";
|
|
9
10
|
/** Not a literal, so no type checker or bundler resolves the SDK from this package. */
|
|
@@ -66,6 +67,21 @@ const ROOT_SHELL = "/bin/sh";
|
|
|
66
67
|
const ROOT_SHELL_ARGS = ["-c", 'exec "$@"', "sh"];
|
|
67
68
|
/** The PATH root's command runs with: the system's directories alone, none of /usr/local. */
|
|
68
69
|
const ROOT_PATH = "/usr/sbin:/usr/bin:/sbin:/bin";
|
|
70
|
+
/** Where a dial machine's launch leaves what it and agentrun-dial write, root's alone: no exec reads it back. */
|
|
71
|
+
const DIAL_LOG = "/run/agentrun-dial.log";
|
|
72
|
+
/**
|
|
73
|
+
* A dial machine's launch, root's command with boot env: E2B runs a template's start command once, at the template's
|
|
74
|
+
* build, and snapshots it running, so it never sees a create's env (docs.e2b.dev/template/start-ready-command). So
|
|
75
|
+
* create starts agentrun-dial itself, after the steps the exec path runs before init: ROOT_ONLY made root's alone, the
|
|
76
|
+
* session buses in /tmp closed. A step that fails starts nothing, and the machine never dials.
|
|
77
|
+
*/
|
|
78
|
+
const DIAL_LAUNCH = [
|
|
79
|
+
"-c",
|
|
80
|
+
[
|
|
81
|
+
`umask 077; exec >>${DIAL_LOG} 2>&1 </dev/null`,
|
|
82
|
+
`${shellLine(hostedCommands({ rootOnly: ROOT_ONLY }).rootOnly)} && ${shellLine(hostedCommands().sockets)} && exec ${AGENTRUN_DIAL}`,
|
|
83
|
+
].join("\n"),
|
|
84
|
+
];
|
|
69
85
|
/** The SDK names its errors (index.mjs:86-360); Connect's carry a code. */
|
|
70
86
|
function codeOf(error) {
|
|
71
87
|
const name = error?.name;
|
|
@@ -115,27 +131,37 @@ const push = (stream, data) => void (stream.writableEnded || stream.write(data))
|
|
|
115
131
|
/** E2B's sandboxes as a MachineHost (../host.ts). */
|
|
116
132
|
class E2BHost {
|
|
117
133
|
descriptor = E2B;
|
|
118
|
-
facts
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
maxLifetimeMs: PRO_MAX_MS,
|
|
123
|
-
arch: "amd64",
|
|
124
|
-
vendorAgentPorts: [ENVD_PORT],
|
|
125
|
-
// The box template has xfwm4 (box/Dockerfile), as E2B Desktop's has: the apps an agent opens are framed and focused.
|
|
126
|
-
windowManager: true,
|
|
127
|
-
// System paths whose permissions E2B's template build sets wider than root's, on its templates and ours alike.
|
|
128
|
-
rootOnly: ROOT_ONLY,
|
|
129
|
-
};
|
|
134
|
+
facts;
|
|
135
|
+
/** connect exec alone: a dial host has neither (HostFacts.connect). */
|
|
136
|
+
exec;
|
|
137
|
+
upload;
|
|
130
138
|
#Sandbox;
|
|
131
139
|
#connection;
|
|
132
140
|
#requestMs;
|
|
133
141
|
/** Each sandbox create or connect gave, by id, for envd's commands and files: let go of at its delete. */
|
|
134
142
|
#sandboxes = new Map();
|
|
135
|
-
constructor(Sandbox, connection, requestMs) {
|
|
143
|
+
constructor(Sandbox, connection, requestMs, connect) {
|
|
136
144
|
this.#Sandbox = Sandbox;
|
|
137
145
|
this.#connection = connection;
|
|
138
146
|
this.#requestMs = requestMs;
|
|
147
|
+
this.facts = {
|
|
148
|
+
daemon: "child",
|
|
149
|
+
isolation: "microvm",
|
|
150
|
+
lifetime: "vendor",
|
|
151
|
+
maxLifetimeMs: PRO_MAX_MS,
|
|
152
|
+
arch: "amd64",
|
|
153
|
+
vendorAgentPorts: [ENVD_PORT],
|
|
154
|
+
// The box template has xfwm4 (box/install.sh's desktop step), as E2B Desktop's has: the apps an agent opens are framed and focused.
|
|
155
|
+
windowManager: true,
|
|
156
|
+
// System paths whose permissions E2B's template build sets wider than root's, on its templates and ours alike: the
|
|
157
|
+
// adapter's step on exec, the launch's on dial (DIAL_LAUNCH).
|
|
158
|
+
rootOnly: ROOT_ONLY,
|
|
159
|
+
...(connect === "dial" ? { connect } : {}),
|
|
160
|
+
};
|
|
161
|
+
if (connect === "exec") {
|
|
162
|
+
this.exec = (id, argv, ctx) => this.#exec(id, argv, ctx);
|
|
163
|
+
this.upload = (id, path, bytes, ctx) => this.#upload(id, path, bytes, ctx);
|
|
164
|
+
}
|
|
139
165
|
}
|
|
140
166
|
errorCode(error) {
|
|
141
167
|
return codeOf(error);
|
|
@@ -172,6 +198,11 @@ class E2BHost {
|
|
|
172
198
|
};
|
|
173
199
|
const sandbox = await this.#Sandbox.create(req.image, options);
|
|
174
200
|
this.#sandboxes.set(sandbox.sandboxId, sandbox);
|
|
201
|
+
// A dial machine's launch: the boot env goes to agentrun-dial's process alone, never to the sandbox's envs, which
|
|
202
|
+
// envd gives every process it starts. The stream is let go of once envd started it: the process runs on
|
|
203
|
+
// (docs.e2b.dev/commands/background; the SDK's CommandHandle.disconnect, index.mjs:2760-2774).
|
|
204
|
+
if (req.boot !== undefined)
|
|
205
|
+
(await this.#process(sandbox, DIAL_LAUNCH, req.boot.env, false, ctx)).stream.abort();
|
|
175
206
|
return { id: sandbox.sandboxId };
|
|
176
207
|
}
|
|
177
208
|
/** getInfo; a sandbox E2B does not have (SandboxNotFoundError, index.mjs:5431) is not_found, which the adapter reads as none. */
|
|
@@ -220,8 +251,8 @@ class E2BHost {
|
|
|
220
251
|
this.#sandboxes.set(id, sandbox);
|
|
221
252
|
return sandbox;
|
|
222
253
|
}
|
|
223
|
-
/** files.write as root (index.mjs:2332-2435). */
|
|
224
|
-
async upload(id, path, bytes, ctx) {
|
|
254
|
+
/** files.write as root (index.mjs:2332-2435); connect exec alone. */
|
|
255
|
+
async #upload(id, path, bytes, ctx) {
|
|
225
256
|
const sandbox = await this.#sandbox(id, ctx);
|
|
226
257
|
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
227
258
|
await sandbox.files.write(path, buffer, { user: "root", requestTimeoutMs: ctx.timeoutMs, ...(ctx.signal ? { signal: ctx.signal } : {}) });
|
|
@@ -234,36 +265,12 @@ class E2BHost {
|
|
|
234
265
|
* connect-web connect-transport.js:145-150), so envd never ends it (start.go:39-44); the start alone is bounded by
|
|
235
266
|
* ctx. Writes go one sendStdin at a time, in order; end is closeStdin; kill SIGKILLs it and lets go of its stream.
|
|
236
267
|
*/
|
|
237
|
-
async exec(id, argv, ctx) {
|
|
268
|
+
async #exec(id, argv, ctx) {
|
|
238
269
|
const sandbox = await this.#sandbox(id, ctx);
|
|
239
270
|
const out = new PassThrough();
|
|
240
271
|
const err = new PassThrough();
|
|
241
272
|
const requestTimeoutMs = this.#requestMs;
|
|
242
|
-
const stream =
|
|
243
|
-
const events = sandbox.commands.rpc.start({ process: { cmd: ROOT_SHELL, args: [...ROOT_SHELL_ARGS, ...argv], envs: { PATH: ROOT_PATH } }, stdin: true }, { headers: { Authorization: ROOT, [KEEPALIVE_HEADER]: KEEPALIVE_S }, signal: stream.signal, timeoutMs: 0 })[Symbol.asyncIterator]();
|
|
244
|
-
// The start, within ctx: a stream that gives no start event in time, or the caller's abort, is let go of.
|
|
245
|
-
const startAbort = () => stream.abort(ctx.signal?.reason);
|
|
246
|
-
ctx.signal?.addEventListener("abort", startAbort, { once: true });
|
|
247
|
-
const startTimer = setTimeout(() => stream.abort(), ctx.timeoutMs);
|
|
248
|
-
let pid;
|
|
249
|
-
try {
|
|
250
|
-
const first = await events.next();
|
|
251
|
-
const event = first.done ? undefined : first.value.event?.event;
|
|
252
|
-
if (event?.case !== "start")
|
|
253
|
-
throw new Error(`envd's process stream began with ${event?.case ?? "nothing"}, not its start`);
|
|
254
|
-
pid = event.value.pid;
|
|
255
|
-
}
|
|
256
|
-
catch (error) {
|
|
257
|
-
const why = stream.signal.aborted ? (ctx.signal?.aborted ? "AbortError" : "TimeoutError") : undefined;
|
|
258
|
-
stream.abort();
|
|
259
|
-
if (why === undefined)
|
|
260
|
-
throw error;
|
|
261
|
-
throw Object.assign(new Error(why === "AbortError" ? "the exec was aborted before envd started it" : `envd did not start the process within ${ctx.timeoutMs / 1000} s`), { name: why });
|
|
262
|
-
}
|
|
263
|
-
finally {
|
|
264
|
-
clearTimeout(startTimer);
|
|
265
|
-
ctx.signal?.removeEventListener("abort", startAbort);
|
|
266
|
-
}
|
|
273
|
+
const { pid, events, stream } = await this.#process(sandbox, [...ROOT_SHELL_ARGS, ...argv], {}, true, ctx);
|
|
267
274
|
const exited = (async () => {
|
|
268
275
|
let code = -1;
|
|
269
276
|
try {
|
|
@@ -307,6 +314,38 @@ class E2BHost {
|
|
|
307
314
|
},
|
|
308
315
|
};
|
|
309
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Root's /bin/sh with args, started through envd's Process.Start stream, with PATH the system's directories and env
|
|
319
|
+
* over it: its pid once envd started it within ctx, its events after the start, and the stream's abort.
|
|
320
|
+
*/
|
|
321
|
+
async #process(sandbox, args, env, stdin, ctx) {
|
|
322
|
+
const stream = new AbortController();
|
|
323
|
+
const events = sandbox.commands.rpc.start({ process: { cmd: ROOT_SHELL, args: [...args], envs: { PATH: ROOT_PATH, ...env } }, stdin }, { headers: { Authorization: ROOT, [KEEPALIVE_HEADER]: KEEPALIVE_S }, signal: stream.signal, timeoutMs: 0 })[Symbol.asyncIterator]();
|
|
324
|
+
// The start, within ctx: a stream that gives no start event in time, or the caller's abort, is let go of.
|
|
325
|
+
const startAbort = () => stream.abort(ctx.signal?.reason);
|
|
326
|
+
ctx.signal?.addEventListener("abort", startAbort, { once: true });
|
|
327
|
+
const startTimer = setTimeout(() => stream.abort(), ctx.timeoutMs);
|
|
328
|
+
let pid;
|
|
329
|
+
try {
|
|
330
|
+
const first = await events.next();
|
|
331
|
+
const event = first.done ? undefined : first.value.event?.event;
|
|
332
|
+
if (event?.case !== "start")
|
|
333
|
+
throw new Error(`envd's process stream began with ${event?.case ?? "nothing"}, not its start`);
|
|
334
|
+
pid = event.value.pid;
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
const why = stream.signal.aborted ? (ctx.signal?.aborted ? "AbortError" : "TimeoutError") : undefined;
|
|
338
|
+
stream.abort();
|
|
339
|
+
if (why === undefined)
|
|
340
|
+
throw error;
|
|
341
|
+
throw Object.assign(new Error(why === "AbortError" ? "the exec was aborted before envd started it" : `envd did not start the process within ${ctx.timeoutMs / 1000} s`), { name: why });
|
|
342
|
+
}
|
|
343
|
+
finally {
|
|
344
|
+
clearTimeout(startTimer);
|
|
345
|
+
ctx.signal?.removeEventListener("abort", startAbort);
|
|
346
|
+
}
|
|
347
|
+
return { pid, events, stream };
|
|
348
|
+
}
|
|
310
349
|
/**
|
|
311
350
|
* Moves E2B's timer (setTimeout, index.mjs:5529-5541) in the whole seconds E2B takes: up to clear create's end, so
|
|
312
351
|
* the end reads as moved (deadlineOf), and down at the most the computer may live (its max-deadline label), so E2B's
|
|
@@ -357,7 +396,11 @@ export class E2BProvider extends HostedProvider {
|
|
|
357
396
|
// A caller who still names the option is told it is gone, whatever its value: it once let public traffic in.
|
|
358
397
|
if (typeof options === "object" && options !== null && Object.hasOwn(options, "publicStream"))
|
|
359
398
|
throw new Error(PUBLIC);
|
|
360
|
-
const { apiKey, Sandbox, domain = DEFAULT_DOMAIN, kind
|
|
399
|
+
const { apiKey, Sandbox, domain = DEFAULT_DOMAIN, kind: named, maxLifetimeMs = HOBBY_MAX_MS, connect, ...rest } = options;
|
|
400
|
+
const via = connectOf(connect, "E2B");
|
|
401
|
+
// A server names connect alone (its e2bConnect setting): on dial the kind is linux unless named, since agentrun-dial
|
|
402
|
+
// starts init with no display; a desktop named on dial is the adapter's refusal.
|
|
403
|
+
const kind = named ?? (via === "dial" ? "linux" : "desktop");
|
|
361
404
|
if (typeof apiKey !== "string" || apiKey === "")
|
|
362
405
|
throw new Error("options.apiKey, the E2B API key, is required: the provider reads no environment, so the caller passes it");
|
|
363
406
|
const lacks = ["create", "connect", "getInfo", "setTimeout", "kill", "list"].filter((name) => typeof Sandbox?.[name] !== "function");
|
|
@@ -368,6 +411,6 @@ export class E2BProvider extends HostedProvider {
|
|
|
368
411
|
throw new Error(ambient);
|
|
369
412
|
if (typeof domain !== "string" || !DOMAIN.test(domain))
|
|
370
413
|
throw new Error(`the E2B domain must be a host name such as ${DEFAULT_DOMAIN}, not ${JSON.stringify(domain)}`);
|
|
371
|
-
super(new E2BHost(Sandbox, connectionOptions({ apiKey, domain }), timeoutsOf(rest.timeouts).requestMs), { ...rest, kind, maxLifetimeMs });
|
|
414
|
+
super(new E2BHost(Sandbox, connectionOptions({ apiKey, domain }), timeoutsOf(rest.timeouts).requestMs, via), { ...rest, kind, maxLifetimeMs });
|
|
372
415
|
}
|
|
373
416
|
}
|