@parcha/agentrun-computer 0.1.0-beta.67 → 0.1.0-beta.68
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 +189 -7
- package/box/install.sh +22 -6
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +1 -1
- package/dist/conformance/instabox.d.ts +36 -0
- package/dist/conformance/instabox.js +43 -0
- package/dist/conformance/sprites.d.ts +32 -0
- package/dist/conformance/sprites.js +40 -0
- package/dist/conformance/vercel.d.ts +35 -0
- package/dist/conformance/vercel.js +43 -0
- package/dist/descriptors/e2b.d.ts +13 -0
- package/dist/descriptors/e2b.js +18 -3
- package/dist/descriptors/index.d.ts +73 -1
- package/dist/descriptors/index.js +7 -2
- package/dist/descriptors/instabox.d.ts +19 -0
- package/dist/descriptors/instabox.js +20 -0
- package/dist/descriptors/sprites.d.ts +19 -0
- package/dist/descriptors/sprites.js +19 -0
- package/dist/descriptors/vercel.d.ts +23 -0
- package/dist/descriptors/vercel.js +24 -0
- package/dist/docker/egress-main.js +17 -10
- package/dist/docker/egress-proxy.d.ts +7 -0
- package/dist/docker/egress-proxy.js +12 -0
- package/dist/docker/egress.d.ts +3 -1
- package/dist/docker/egress.js +11 -4
- package/dist/docker/image.d.ts +8 -2
- package/dist/docker/image.js +24 -3
- package/dist/docker.d.ts +6 -0
- package/dist/docker.js +15 -5
- package/dist/e2b.d.ts +25 -10
- package/dist/e2b.js +36 -16
- package/dist/hosted/provider.js +14 -8
- package/dist/hosted/rest.js +23 -1
- package/dist/hosted/ssh-exec.d.ts +17 -2
- package/dist/hosted/ssh-exec.js +17 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/instabox.d.ts +30 -0
- package/dist/instabox.js +424 -0
- package/dist/render.js +4 -3
- package/dist/sprites.d.ts +37 -0
- package/dist/sprites.js +309 -0
- package/dist/vercel.d.ts +26 -0
- package/dist/vercel.js +262 -0
- package/package.json +17 -2
|
@@ -5,6 +5,18 @@ export declare const E2B: {
|
|
|
5
5
|
readonly name: "E2B_API_KEY";
|
|
6
6
|
readonly option: "apiKey";
|
|
7
7
|
readonly required: true;
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "AGENTRUN_E2B_DOMAIN";
|
|
10
|
+
readonly option: "domain";
|
|
11
|
+
readonly required: false;
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "AGENTRUN_E2B_API_URL";
|
|
14
|
+
readonly option: "apiUrl";
|
|
15
|
+
readonly required: false;
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "AGENTRUN_E2B_TEMPLATE";
|
|
18
|
+
readonly option: "template";
|
|
19
|
+
readonly required: false;
|
|
8
20
|
}];
|
|
9
21
|
readonly settings: readonly [{
|
|
10
22
|
readonly name: "e2bConnect";
|
|
@@ -16,5 +28,6 @@ export declare const E2B: {
|
|
|
16
28
|
readonly network: readonly ["none", "open", "allow"];
|
|
17
29
|
readonly capabilities: readonly [import("../kinds.js").KindCapabilities, import("../kinds.js").KindCapabilities];
|
|
18
30
|
readonly prepareImage: true;
|
|
31
|
+
readonly imageEnv: "AGENTRUN_E2B_TEMPLATE";
|
|
19
32
|
readonly load: () => Promise<typeof import("../e2b.js")>;
|
|
20
33
|
};
|
package/dist/descriptors/e2b.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
// E2B's descriptor: a sandbox or a desktop, the run's folder on an Archil disk. Both start from our box template, the
|
|
2
|
-
// public E2B template its prepareImage() answers (box-image.ts boxE2bTemplate), which has Archil's client and a desktop
|
|
2
|
+
// public E2B template its prepareImage() answers (box-image.ts boxE2bTemplate), which has Archil's client and a desktop,
|
|
3
|
+
// unless the operator names another (AGENTRUN_E2B_TEMPLATE).
|
|
3
4
|
import { defineProvider } from "../descriptor.js";
|
|
4
5
|
import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
|
|
6
|
+
/** The operator's template for every E2B computer, in place of the box template: a key, and the descriptor's imageEnv. */
|
|
7
|
+
const E2B_TEMPLATE_ENV = "AGENTRUN_E2B_TEMPLATE";
|
|
5
8
|
export const E2B = defineProvider({
|
|
6
9
|
id: "e2b",
|
|
7
10
|
label: "E2B",
|
|
8
|
-
|
|
11
|
+
// The key, then three operator settings, none a secret: the domain of a cloud that speaks E2B's API (its API is
|
|
12
|
+
// https://api.<domain> unless AGENTRUN_E2B_API_URL names another), and the template every computer starts from. The key
|
|
13
|
+
// is whichever cloud's the domain names.
|
|
14
|
+
keys: [
|
|
15
|
+
{ name: "E2B_API_KEY", option: "apiKey", required: true },
|
|
16
|
+
{ name: "AGENTRUN_E2B_DOMAIN", option: "domain", required: false },
|
|
17
|
+
{ name: "AGENTRUN_E2B_API_URL", option: "apiUrl", required: false },
|
|
18
|
+
{ name: E2B_TEMPLATE_ENV, option: "template", required: false },
|
|
19
|
+
],
|
|
9
20
|
// How the server reaches its machines: exec (the provider's default, when the server's settings name none), a bridge
|
|
10
21
|
// through envd per connection, or dial, the machine dials the server (a sandbox or a desktop, as on exec).
|
|
11
22
|
settings: [{ name: "e2bConnect", option: "connect" }],
|
|
@@ -17,7 +28,11 @@ export const E2B = defineProvider({
|
|
|
17
28
|
// proxy, which reaches the public internet alone, and with a list its hosts alone (hosted/network.ts).
|
|
18
29
|
network: ["none", "open", "allow"],
|
|
19
30
|
capabilities: [SANDBOX, LINUX_DESKTOP],
|
|
20
|
-
// No default image: every computer, sandbox or desktop, starts from the
|
|
31
|
+
// No default image: every computer, sandbox or desktop, starts from the template its prepareImage() answers, the box
|
|
32
|
+
// one or the operator's.
|
|
21
33
|
prepareImage: true,
|
|
34
|
+
// The operator's template, as Daytona's AGENTRUN_DAYTONA_SNAPSHOT: serve reads it as the image of every E2B computer,
|
|
35
|
+
// and takes a computer.image that names it. A Mode 2 folder mounts Archil in it, so it needs box/Dockerfile's client.
|
|
36
|
+
imageEnv: E2B_TEMPLATE_ENV,
|
|
22
37
|
load: () => import("../e2b.js"),
|
|
23
38
|
});
|
|
@@ -7,6 +7,7 @@ import { DOCKER } from "./docker.js";
|
|
|
7
7
|
import { E2B } from "./e2b.js";
|
|
8
8
|
import { FLY } from "./fly.js";
|
|
9
9
|
import { GROUNDBOX } from "./groundbox.js";
|
|
10
|
+
import { INSTABOX } from "./instabox.js";
|
|
10
11
|
import { KERNEL } from "./kernel.js";
|
|
11
12
|
import { LOCAL } from "./local-chrome.js";
|
|
12
13
|
import { MODAL } from "./modal.js";
|
|
@@ -15,6 +16,8 @@ import { ORGO } from "./orgo.js";
|
|
|
15
16
|
import { PHONE_HARNESS } from "./phone-harness.js";
|
|
16
17
|
import { RENDER } from "./render.js";
|
|
17
18
|
import { SMOLCLOUD } from "./smolcloud.js";
|
|
19
|
+
import { SPRITES } from "./sprites.js";
|
|
20
|
+
import { VERCEL } from "./vercel.js";
|
|
18
21
|
export declare const DESCRIPTORS: readonly [{
|
|
19
22
|
readonly id: "docker";
|
|
20
23
|
readonly label: "Docker";
|
|
@@ -168,6 +171,18 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
168
171
|
readonly name: "E2B_API_KEY";
|
|
169
172
|
readonly option: "apiKey";
|
|
170
173
|
readonly required: true;
|
|
174
|
+
}, {
|
|
175
|
+
readonly name: "AGENTRUN_E2B_DOMAIN";
|
|
176
|
+
readonly option: "domain";
|
|
177
|
+
readonly required: false;
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "AGENTRUN_E2B_API_URL";
|
|
180
|
+
readonly option: "apiUrl";
|
|
181
|
+
readonly required: false;
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "AGENTRUN_E2B_TEMPLATE";
|
|
184
|
+
readonly option: "template";
|
|
185
|
+
readonly required: false;
|
|
171
186
|
}];
|
|
172
187
|
readonly settings: readonly [{
|
|
173
188
|
readonly name: "e2bConnect";
|
|
@@ -179,6 +194,7 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
179
194
|
readonly network: readonly ["none", "open", "allow"];
|
|
180
195
|
readonly capabilities: readonly [import("../kinds.js").KindCapabilities, import("../kinds.js").KindCapabilities];
|
|
181
196
|
readonly prepareImage: true;
|
|
197
|
+
readonly imageEnv: "AGENTRUN_E2B_TEMPLATE";
|
|
182
198
|
readonly load: () => Promise<typeof import("../e2b.js")>;
|
|
183
199
|
}, {
|
|
184
200
|
readonly id: "agent37";
|
|
@@ -548,11 +564,67 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
548
564
|
}];
|
|
549
565
|
readonly prepareImage: true;
|
|
550
566
|
readonly load: () => Promise<typeof import("../groundbox.js")>;
|
|
567
|
+
}, {
|
|
568
|
+
readonly id: "vercel";
|
|
569
|
+
readonly label: "Vercel Sandbox";
|
|
570
|
+
readonly keys: readonly [{
|
|
571
|
+
readonly name: "VERCEL_TOKEN";
|
|
572
|
+
readonly option: "token";
|
|
573
|
+
readonly required: true;
|
|
574
|
+
}, {
|
|
575
|
+
readonly name: "VERCEL_TEAM_ID";
|
|
576
|
+
readonly option: "teamId";
|
|
577
|
+
readonly required: true;
|
|
578
|
+
}, {
|
|
579
|
+
readonly name: "VERCEL_PROJECT_ID";
|
|
580
|
+
readonly option: "projectId";
|
|
581
|
+
readonly required: true;
|
|
582
|
+
}];
|
|
583
|
+
readonly metered: true;
|
|
584
|
+
readonly mounts: readonly [];
|
|
585
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
586
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
587
|
+
readonly prepareImage: true;
|
|
588
|
+
readonly load: () => Promise<typeof import("../vercel.js")>;
|
|
589
|
+
}, {
|
|
590
|
+
readonly id: "sprites";
|
|
591
|
+
readonly label: "Fly Sprites";
|
|
592
|
+
readonly keys: readonly [{
|
|
593
|
+
readonly name: "SPRITES_TOKEN";
|
|
594
|
+
readonly option: "token";
|
|
595
|
+
readonly required: true;
|
|
596
|
+
}];
|
|
597
|
+
readonly metered: true;
|
|
598
|
+
readonly mounts: readonly [];
|
|
599
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
600
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
601
|
+
readonly defaultImage: {
|
|
602
|
+
readonly sandbox: "default";
|
|
603
|
+
};
|
|
604
|
+
readonly load: () => Promise<typeof import("../sprites.js")>;
|
|
605
|
+
}, {
|
|
606
|
+
readonly id: "instabox";
|
|
607
|
+
readonly label: "InstaBox";
|
|
608
|
+
readonly keys: readonly [{
|
|
609
|
+
readonly name: "INSTABOX_API_KEY";
|
|
610
|
+
readonly option: "apiKey";
|
|
611
|
+
readonly required: true;
|
|
612
|
+
}];
|
|
613
|
+
readonly metered: true;
|
|
614
|
+
readonly mounts: readonly [];
|
|
615
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
616
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
617
|
+
readonly defaultImage: {
|
|
618
|
+
readonly sandbox: "minimal";
|
|
619
|
+
};
|
|
620
|
+
readonly load: () => Promise<typeof import("../instabox.js")>;
|
|
551
621
|
}];
|
|
552
|
-
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, GROUNDBOX, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS, RENDER, SMOLCLOUD };
|
|
622
|
+
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, GROUNDBOX, INSTABOX, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS, RENDER, SMOLCLOUD, SPRITES, VERCEL };
|
|
553
623
|
export { AGENT37_BASE_TEMPLATE } from "./agent37.js";
|
|
554
624
|
export { BOXD_DEFAULT_IMAGE } from "./boxd.js";
|
|
555
625
|
export { GROUNDBOX_OWN_IMAGE } from "./groundbox.js";
|
|
626
|
+
export { INSTABOX_IMAGE } from "./instabox.js";
|
|
627
|
+
export { SPRITES_IMAGE } from "./sprites.js";
|
|
556
628
|
export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, type DaytonaGpuSnapshot, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
|
|
557
629
|
export { ORGO_BASE_IMAGE } from "./orgo.js";
|
|
558
630
|
export { PHONE_GROUPS, PHONE_IMAGE } from "./phone-harness.js";
|
|
@@ -9,6 +9,7 @@ import { DOCKER } from "./docker.js";
|
|
|
9
9
|
import { E2B } from "./e2b.js";
|
|
10
10
|
import { FLY } from "./fly.js";
|
|
11
11
|
import { GROUNDBOX } from "./groundbox.js";
|
|
12
|
+
import { INSTABOX } from "./instabox.js";
|
|
12
13
|
import { KERNEL } from "./kernel.js";
|
|
13
14
|
import { LOCAL } from "./local-chrome.js";
|
|
14
15
|
import { MODAL } from "./modal.js";
|
|
@@ -17,11 +18,15 @@ import { ORGO } from "./orgo.js";
|
|
|
17
18
|
import { PHONE_HARNESS } from "./phone-harness.js";
|
|
18
19
|
import { RENDER } from "./render.js";
|
|
19
20
|
import { SMOLCLOUD } from "./smolcloud.js";
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
import { SPRITES } from "./sprites.js";
|
|
22
|
+
import { VERCEL } from "./vercel.js";
|
|
23
|
+
export const DESCRIPTORS = [DOCKER, DAYTONA, MODAL, E2B, AGENT37, MORPH, CLOUDFLARE, FLY, RENDER, ORGO, PHONE_HARNESS, BROWSERBASE, KERNEL, LOCAL, BOXD, SMOLCLOUD, GROUNDBOX, VERCEL, SPRITES, INSTABOX];
|
|
24
|
+
export { AGENT37, BOXD, BROWSERBASE, CLOUDFLARE, DAYTONA, DOCKER, E2B, FLY, GROUNDBOX, INSTABOX, KERNEL, LOCAL, MODAL, MORPH, ORGO, PHONE_HARNESS, RENDER, SMOLCLOUD, SPRITES, VERCEL };
|
|
22
25
|
export { AGENT37_BASE_TEMPLATE } from "./agent37.js";
|
|
23
26
|
export { BOXD_DEFAULT_IMAGE } from "./boxd.js";
|
|
24
27
|
export { GROUNDBOX_OWN_IMAGE } from "./groundbox.js";
|
|
28
|
+
export { INSTABOX_IMAGE } from "./instabox.js";
|
|
29
|
+
export { SPRITES_IMAGE } from "./sprites.js";
|
|
25
30
|
export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
|
|
26
31
|
export { ORGO_BASE_IMAGE } from "./orgo.js";
|
|
27
32
|
export { PHONE_GROUPS, PHONE_IMAGE } from "./phone-harness.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** InstaBox's smallest template (unverified until the live run: on every paid plan). */
|
|
2
|
+
export declare const INSTABOX_IMAGE = "minimal";
|
|
3
|
+
export declare const INSTABOX: {
|
|
4
|
+
readonly id: "instabox";
|
|
5
|
+
readonly label: "InstaBox";
|
|
6
|
+
readonly keys: readonly [{
|
|
7
|
+
readonly name: "INSTABOX_API_KEY";
|
|
8
|
+
readonly option: "apiKey";
|
|
9
|
+
readonly required: true;
|
|
10
|
+
}];
|
|
11
|
+
readonly metered: true;
|
|
12
|
+
readonly mounts: readonly [];
|
|
13
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
14
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
15
|
+
readonly defaultImage: {
|
|
16
|
+
readonly sandbox: "minimal";
|
|
17
|
+
};
|
|
18
|
+
readonly load: () => Promise<typeof import("../instabox.js")>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// InstaBox's descriptor: a Linux sandbox on an InstaBox machine (a Firecracker microVM), started from one of InstaBox's
|
|
2
|
+
// templates, the minimal one by default, or a snapshot of the key's workspace. One key, the workspace's API key, under the
|
|
3
|
+
// name InstaBox's own CLI and SDK read. No desktop and no Archil mount: both need our box image, and a machine takes
|
|
4
|
+
// InstaBox's templates alone.
|
|
5
|
+
import { defineProvider } from "../descriptor.js";
|
|
6
|
+
import { SANDBOX } from "./shared.js";
|
|
7
|
+
/** InstaBox's smallest template (unverified until the live run: on every paid plan). */
|
|
8
|
+
export const INSTABOX_IMAGE = "minimal";
|
|
9
|
+
export const INSTABOX = defineProvider({
|
|
10
|
+
id: "instabox",
|
|
11
|
+
label: "InstaBox",
|
|
12
|
+
keys: [{ name: "INSTABOX_API_KEY", option: "apiKey", required: true }],
|
|
13
|
+
metered: true,
|
|
14
|
+
mounts: [],
|
|
15
|
+
// All three are init's, through root in the microVM (the machine user's passwordless sudo).
|
|
16
|
+
network: ["none", "open", "allow"],
|
|
17
|
+
capabilities: [SANDBOX],
|
|
18
|
+
defaultImage: { sandbox: INSTABOX_IMAGE },
|
|
19
|
+
load: () => import("../instabox.js"),
|
|
20
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Fly's own image, the only one a sprite starts from. */
|
|
2
|
+
export declare const SPRITES_IMAGE = "default";
|
|
3
|
+
export declare const SPRITES: {
|
|
4
|
+
readonly id: "sprites";
|
|
5
|
+
readonly label: "Fly Sprites";
|
|
6
|
+
readonly keys: readonly [{
|
|
7
|
+
readonly name: "SPRITES_TOKEN";
|
|
8
|
+
readonly option: "token";
|
|
9
|
+
readonly required: true;
|
|
10
|
+
}];
|
|
11
|
+
readonly metered: true;
|
|
12
|
+
readonly mounts: readonly [];
|
|
13
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
14
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
15
|
+
readonly defaultImage: {
|
|
16
|
+
readonly sandbox: "default";
|
|
17
|
+
};
|
|
18
|
+
readonly load: () => Promise<typeof import("../sprites.js")>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Fly Sprites' descriptor: a Linux sandbox on a sprite (a Firecracker microVM Fly keeps by name), started from Fly's own
|
|
2
|
+
// Ubuntu image, the one image Sprites has. One key, the API token, under the name Fly's own CLI and SDK test client read.
|
|
3
|
+
// No desktop and no Archil mount: both need our box image, and a sprite takes no image.
|
|
4
|
+
import { defineProvider } from "../descriptor.js";
|
|
5
|
+
import { SANDBOX } from "./shared.js";
|
|
6
|
+
/** Fly's own image, the only one a sprite starts from. */
|
|
7
|
+
export const SPRITES_IMAGE = "default";
|
|
8
|
+
export const SPRITES = defineProvider({
|
|
9
|
+
id: "sprites",
|
|
10
|
+
label: "Fly Sprites",
|
|
11
|
+
keys: [{ name: "SPRITES_TOKEN", option: "token", required: true }],
|
|
12
|
+
metered: true,
|
|
13
|
+
mounts: [],
|
|
14
|
+
// All three are init's, through root in the microVM (unverified until the live run: the exec user's passwordless sudo).
|
|
15
|
+
network: ["none", "open", "allow"],
|
|
16
|
+
capabilities: [SANDBOX],
|
|
17
|
+
defaultImage: { sandbox: SPRITES_IMAGE },
|
|
18
|
+
load: () => import("../sprites.js"),
|
|
19
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const VERCEL: {
|
|
2
|
+
readonly id: "vercel";
|
|
3
|
+
readonly label: "Vercel Sandbox";
|
|
4
|
+
readonly keys: readonly [{
|
|
5
|
+
readonly name: "VERCEL_TOKEN";
|
|
6
|
+
readonly option: "token";
|
|
7
|
+
readonly required: true;
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "VERCEL_TEAM_ID";
|
|
10
|
+
readonly option: "teamId";
|
|
11
|
+
readonly required: true;
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "VERCEL_PROJECT_ID";
|
|
14
|
+
readonly option: "projectId";
|
|
15
|
+
readonly required: true;
|
|
16
|
+
}];
|
|
17
|
+
readonly metered: true;
|
|
18
|
+
readonly mounts: readonly [];
|
|
19
|
+
readonly network: readonly ["none", "open", "allow"];
|
|
20
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities];
|
|
21
|
+
readonly prepareImage: true;
|
|
22
|
+
readonly load: () => Promise<typeof import("../vercel.js")>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Vercel Sandbox's descriptor: a Linux sandbox on a Vercel Sandbox (a Firecracker microVM), started from our box image
|
|
2
|
+
// as the project's registry holds it, the tag its prepareImage() answers (agentrun-box:<recipe hash>). Three keys: the
|
|
3
|
+
// access token, a secret, and the team and project ids, which aren't secrets but have no default, so Settings asks for
|
|
4
|
+
// them. No Archil mount yet: whether its client mounts in the microVM is unverified until a live run.
|
|
5
|
+
import { defineProvider } from "../descriptor.js";
|
|
6
|
+
import { SANDBOX } from "./shared.js";
|
|
7
|
+
export const VERCEL = defineProvider({
|
|
8
|
+
id: "vercel",
|
|
9
|
+
label: "Vercel Sandbox",
|
|
10
|
+
keys: [
|
|
11
|
+
{ name: "VERCEL_TOKEN", option: "token", required: true },
|
|
12
|
+
{ name: "VERCEL_TEAM_ID", option: "teamId", required: true },
|
|
13
|
+
{ name: "VERCEL_PROJECT_ID", option: "projectId", required: true },
|
|
14
|
+
],
|
|
15
|
+
metered: true,
|
|
16
|
+
mounts: [],
|
|
17
|
+
// All three are ours: root in the microVM makes a network namespace (unverified until the live run), so init's fence
|
|
18
|
+
// holds none and its egress proxy open and a list (hosted/network.ts).
|
|
19
|
+
network: ["none", "open", "allow"],
|
|
20
|
+
capabilities: [SANDBOX],
|
|
21
|
+
// No default image: every computer starts from the box image its prepareImage() answers, unless its spec names one.
|
|
22
|
+
prepareImage: true,
|
|
23
|
+
load: () => import("../vercel.js"),
|
|
24
|
+
});
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// The entry a Docker computer's egress proxy container runs (egress.ts makes the container):
|
|
2
2
|
//
|
|
3
|
-
// node egress-main.js --socket <path> --deadline <ISO time> (--allow <entries,...> | --open public) [--local <addresses,...>] [--hint <words>]
|
|
3
|
+
// node egress-main.js --socket <path> --deadline <ISO time> (--allow <entries,...> | --open public) [--local <addresses,...>] [--hint <words>] [--max-tunnels <n>]
|
|
4
4
|
//
|
|
5
5
|
// `--open public` is every public host (a computer whose network is open); `--allow` a list. It refuses to start, exit 2
|
|
6
6
|
// and why on stdout, with neither or both, an empty list or a bad entry (no list never means open: only `--open public`
|
|
7
|
-
// does), with no socket, or with no deadline it can read. Started, it logs "egress
|
|
8
|
-
// open") once its socket listens, then one line per decision. It ends, exit 0 and its socket removed, on SIGTERM or SIGINT and at
|
|
7
|
+
// does), with no socket, or with no deadline it can read. Started, it logs "egress cap tunnels=<n>", the cap in force, and
|
|
8
|
+
// "egress ready allow=<list>" (or "egress ready open") once its socket listens, then one line per decision. It ends, exit 0 and its socket removed, on SIGTERM or SIGINT and at
|
|
9
9
|
// the deadline, the computer's own: an orphaned proxy forwards nothing past its computer's end. `--local` is the Docker
|
|
10
|
-
// host's own addresses, refused as this host's.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
// host's own addresses, refused as this host's. `--max-tunnels` is the operator's cap on connections open at once, 1 to
|
|
11
|
+
// MAX_TUNNELS_CEILING, default DEFAULT_MAX_TUNNELS; any other value refuses the start. It imports only node: modules and
|
|
12
|
+
// the proxy: it runs in a bare Node image.
|
|
13
|
+
import { DEFAULT_MAX_TUNNELS, EGRESS_READY, MAX_TUNNELS_CEILING, maxTunnelsOf, parseAllow, startEgressProxy } from "./egress-proxy.js";
|
|
14
|
+
/** Connections in all through one computer's proxy, for its life: serve's, for one run's box. */
|
|
14
15
|
const MAX_CONNECTIONS = 20_000;
|
|
15
16
|
/** The longest a Node timer holds; a later deadline is waited for in steps of it. */
|
|
16
17
|
const MAX_TIMER_MS = 2_147_483_647;
|
|
17
|
-
const FLAGS = new Set(["--socket", "--deadline", "--allow", "--open", "--local", "--hint"]);
|
|
18
|
+
const FLAGS = new Set(["--socket", "--deadline", "--allow", "--open", "--local", "--hint", "--max-tunnels"]);
|
|
18
19
|
const say = (line) => process.stdout.write(`${line}\n`);
|
|
19
20
|
const refuse = (why) => {
|
|
20
21
|
say(`egress: ${why}, so the proxy does not start`);
|
|
@@ -51,22 +52,28 @@ const deadline = Date.parse(given.get("--deadline") ?? "");
|
|
|
51
52
|
if (Number.isNaN(deadline))
|
|
52
53
|
refuse("no deadline was given as an ISO time");
|
|
53
54
|
const local = (given.get("--local") ?? "").split(",").filter(Boolean);
|
|
55
|
+
const capped = given.get("--max-tunnels");
|
|
56
|
+
const maxTunnels = capped === undefined ? DEFAULT_MAX_TUNNELS : maxTunnelsOf(capped);
|
|
57
|
+
if (maxTunnels === undefined)
|
|
58
|
+
refuse(`--max-tunnels takes a whole number from 1 to ${MAX_TUNNELS_CEILING}, not ${JSON.stringify(capped)}`);
|
|
54
59
|
const proxy = await startEgressProxy({
|
|
55
60
|
socketPath,
|
|
56
|
-
maxTunnels:
|
|
61
|
+
maxTunnels: maxTunnels,
|
|
57
62
|
maxConnections: MAX_CONNECTIONS,
|
|
58
63
|
log: say,
|
|
59
64
|
...(allow === undefined ? {} : { allow }),
|
|
60
65
|
alsoLocal: () => local,
|
|
61
66
|
...(given.has("--hint") ? { allowHint: given.get("--hint") } : {}),
|
|
62
67
|
});
|
|
63
|
-
say(allow === undefined ? `${EGRESS_READY} open` : `${EGRESS_READY} allow=${allow.join(",")}`);
|
|
64
68
|
const end = (why) => {
|
|
65
69
|
say(`egress: ${why}, the proxy ends`);
|
|
66
70
|
void proxy.close().finally(() => process.exit(0));
|
|
67
71
|
};
|
|
72
|
+
// The stop handlers come before the ready line: a caller that stops the proxy as soon as it reads ready gets exit 0.
|
|
68
73
|
for (const signal of ["SIGTERM", "SIGINT"])
|
|
69
74
|
process.once(signal, () => end(`${signal} came`));
|
|
75
|
+
say(`egress cap tunnels=${maxTunnels}`);
|
|
76
|
+
say(allow === undefined ? `${EGRESS_READY} open` : `${EGRESS_READY} allow=${allow.join(",")}`);
|
|
70
77
|
const wait = () => {
|
|
71
78
|
const left = deadline - Date.now();
|
|
72
79
|
if (left <= 0)
|
|
@@ -44,6 +44,13 @@ export interface EgressProxyOptions {
|
|
|
44
44
|
export declare function parseAllow(entries: string | readonly string[]): string[];
|
|
45
45
|
/** The ports a list opens: plain HTTP and HTTPS. */
|
|
46
46
|
export declare const LISTED_PORTS: readonly number[];
|
|
47
|
+
/** Connections open at once through one computer's proxy when its operator sets no cap (`maxTunnels`). */
|
|
48
|
+
export declare const DEFAULT_MAX_TUNNELS = 64;
|
|
49
|
+
/** The highest cap an operator may set: a tunnel holds two open files (the computer's side and the host's), and the
|
|
50
|
+
* proxy container is held to 1024, with room left for its own. */
|
|
51
|
+
export declare const MAX_TUNNELS_CEILING = 256;
|
|
52
|
+
/** `text` as a tunnel cap, a whole number from 1 to MAX_TUNNELS_CEILING written in digits alone, else undefined. */
|
|
53
|
+
export declare function maxTunnelsOf(text: string): number | undefined;
|
|
47
54
|
/** What the proxy container's entry (egress-main.ts) logs once its socket listens: the provider waits for it. */
|
|
48
55
|
export declare const EGRESS_READY = "egress ready";
|
|
49
56
|
export interface EgressProxy {
|
|
@@ -67,6 +67,18 @@ const listedHost = (names, host) => {
|
|
|
67
67
|
};
|
|
68
68
|
/** The ports a list opens: plain HTTP and HTTPS. */
|
|
69
69
|
export const LISTED_PORTS = [80, 443];
|
|
70
|
+
/** Connections open at once through one computer's proxy when its operator sets no cap (`maxTunnels`). */
|
|
71
|
+
export const DEFAULT_MAX_TUNNELS = 64;
|
|
72
|
+
/** The highest cap an operator may set: a tunnel holds two open files (the computer's side and the host's), and the
|
|
73
|
+
* proxy container is held to 1024, with room left for its own. */
|
|
74
|
+
export const MAX_TUNNELS_CEILING = 256;
|
|
75
|
+
/** `text` as a tunnel cap, a whole number from 1 to MAX_TUNNELS_CEILING written in digits alone, else undefined. */
|
|
76
|
+
export function maxTunnelsOf(text) {
|
|
77
|
+
if (!/^[1-9][0-9]{0,2}$/.test(text))
|
|
78
|
+
return undefined;
|
|
79
|
+
const value = Number(text);
|
|
80
|
+
return value <= MAX_TUNNELS_CEILING ? value : undefined;
|
|
81
|
+
}
|
|
70
82
|
/** What the proxy container's entry (egress-main.ts) logs once its socket listens: the provider waits for it. */
|
|
71
83
|
export const EGRESS_READY = "egress ready";
|
|
72
84
|
const HOP = new Set(["connection", "proxy-connection", "keep-alive", "proxy-authorization", "proxy-authenticate", "te", "trailer", "upgrade", "transfer-encoding"]);
|
package/dist/docker/egress.d.ts
CHANGED
|
@@ -101,11 +101,13 @@ export interface EgressRun {
|
|
|
101
101
|
deadline: string;
|
|
102
102
|
code: EgressCode;
|
|
103
103
|
hint?: string;
|
|
104
|
+
/** The operator's cap on the proxy's connections open at once (`--max-tunnels`); the proxy's default without one. */
|
|
105
|
+
maxTunnels?: number;
|
|
104
106
|
/** The spec's labels, which the proxy container carries too. */
|
|
105
107
|
labels?: Record<string, string>;
|
|
106
108
|
}
|
|
107
109
|
/** `docker run` of a computer's proxy container (see the head of this file). Pinned by a golden test. */
|
|
108
|
-
export declare function egressRunArgs({ name, user, image, allow, local, deadline, code, hint, labels }: EgressRun): string[];
|
|
110
|
+
export declare function egressRunArgs({ name, user, image, allow, local, deadline, code, hint, maxTunnels, labels }: EgressRun): string[];
|
|
109
111
|
/** What a computer's read-back needs of the computer itself. */
|
|
110
112
|
export interface EgressOwner {
|
|
111
113
|
name: string;
|
package/dist/docker/egress.js
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
// bound read-only from dist/docker with the package's package.json), in a pinned Node image, on the provider's own
|
|
12
12
|
// bridge alone (EGRESS_NETWORK), publishing no port, as the computer's uid:gid, with a read-only root, no capability,
|
|
13
13
|
// no privilege to gain, and bounded memory, pids and log. Its argv holds the list (or `--open public`), the computer's deadline (it ends itself then), the
|
|
14
|
-
// Docker host's own public addresses (refused as this host's) and the
|
|
14
|
+
// Docker host's own public addresses (refused as this host's), the hint, and the operator's cap on its connections open
|
|
15
|
+
// at once when one is set. It holds no key.
|
|
15
16
|
// - The network EGRESS_NETWORK: one user-defined bridge every proxy of every provider on this Docker host shares, made
|
|
16
17
|
// by the first create that needs it and never removed. Inter-container traffic on it is off (enable_icc=false), and
|
|
17
18
|
// no other workload's container is on it: on Docker's default bridge, one with NET_RAW could ARP-spoof the gateway
|
|
@@ -23,7 +24,7 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
|
|
23
24
|
import { networkInterfaces } from "node:os";
|
|
24
25
|
import { fileURLToPath } from "node:url";
|
|
25
26
|
import { DEADLINE_LABEL } from "../drift.js";
|
|
26
|
-
import { LISTED_PORTS, parseAllow } from "./egress-proxy.js";
|
|
27
|
+
import { LISTED_PORTS, maxTunnelsOf, parseAllow } from "./egress-proxy.js";
|
|
27
28
|
import { checkAddress } from "./egress-table.js";
|
|
28
29
|
/** The proxy container's image: node:22.23.5-trixie-slim (Node 22's November 2026 security release), pinned to its
|
|
29
30
|
* multi-arch index digest (amd64 and arm64 both listed), so every host runs the same Node. serve's macOS proxy pins the
|
|
@@ -196,7 +197,7 @@ const PROXY_CPU_QUOTA_US = 50_000;
|
|
|
196
197
|
const PROXY_NOFILE = 1024;
|
|
197
198
|
const PROXY_LOG = { driver: "json-file", options: { "max-size": "1m", "max-file": "2" } };
|
|
198
199
|
/** `docker run` of a computer's proxy container (see the head of this file). Pinned by a golden test. */
|
|
199
|
-
export function egressRunArgs({ name, user, image, allow, local, deadline, code, hint, labels = {} }) {
|
|
200
|
+
export function egressRunArgs({ name, user, image, allow, local, deadline, code, hint, maxTunnels, labels = {} }) {
|
|
200
201
|
const proxy = egressNameOf(name);
|
|
201
202
|
const args = ["run", "--detach", "--name", proxy, "--label", `${EGRESS_LABEL}=${name}`, "--label", `${DEADLINE_LABEL}=${deadline}`];
|
|
202
203
|
for (const [key, value] of Object.entries(labels))
|
|
@@ -226,6 +227,8 @@ export function egressRunArgs({ name, user, image, allow, local, deadline, code,
|
|
|
226
227
|
args.push("--local", local.join(","));
|
|
227
228
|
if (hint !== undefined)
|
|
228
229
|
args.push("--hint", hint);
|
|
230
|
+
if (maxTunnels !== undefined)
|
|
231
|
+
args.push("--max-tunnels", String(maxTunnels));
|
|
229
232
|
return args;
|
|
230
233
|
}
|
|
231
234
|
const show = (value) => (value === undefined ? "nothing" : JSON.stringify(value));
|
|
@@ -349,9 +352,13 @@ export function egressOf(proxy, owner, code, local = []) {
|
|
|
349
352
|
return other(`listens on ${show(flags.get("--socket"))}, not ${PROXY_SOCKET}`);
|
|
350
353
|
if (flags.get("--deadline") !== owner.deadline)
|
|
351
354
|
return other(`ends at ${show(flags.get("--deadline"))}, not the computer's deadline ${show(owner.deadline)}`);
|
|
352
|
-
const unknown = [...flags.keys()].filter((flag) => !["--socket", "--deadline", "--allow", "--open", "--local", "--hint"].includes(flag));
|
|
355
|
+
const unknown = [...flags.keys()].filter((flag) => !["--socket", "--deadline", "--allow", "--open", "--local", "--hint", "--max-tunnels"].includes(flag));
|
|
353
356
|
if (unknown.length > 0)
|
|
354
357
|
return other(`runs with flags ${unknown.join(", ")}, which create never gives`);
|
|
358
|
+
// A cap the operator set when the proxy was made holds for its life: any the proxy would start with is the
|
|
359
|
+
// provider's, whatever the setting reads now.
|
|
360
|
+
if (flags.has("--max-tunnels") && maxTunnelsOf(flags.get("--max-tunnels")) === undefined)
|
|
361
|
+
return other(`runs with --max-tunnels ${show(flags.get("--max-tunnels"))}, a cap create never gives`);
|
|
355
362
|
const read = form === "open" ? undefined : allowOf((flags.get("--allow") ?? "").split(","));
|
|
356
363
|
if (read !== undefined && "problem" in read)
|
|
357
364
|
return other(`holds a list this provider never makes: ${read.problem}`);
|
package/dist/docker/image.d.ts
CHANGED
|
@@ -14,8 +14,14 @@ export declare const DOCKER_RECIPE_HAS = "python, git, curl, node, npm, rg";
|
|
|
14
14
|
* registry-1.docker.io/v2/library/python/manifests/3.12-slim accepting an OCI index or a manifest list: its
|
|
15
15
|
* `docker-content-digest`), and put it here. The recipe's hash changes with it, and so does DEFAULT_DOCKER_IMAGE. */
|
|
16
16
|
export declare const DOCKER_BASE = "python:3.12-slim@sha256:b18b261e1b4974b4f321451ad5251ded85abb22c2b8b262da527dda1d031ab30";
|
|
17
|
-
/** The
|
|
18
|
-
*
|
|
17
|
+
/** The Node release the default image runs, the server image's (packages/serve/docker/Dockerfile): Debian's nodejs
|
|
18
|
+
* comes with npm 9, older than the npm current packages are published for. */
|
|
19
|
+
export declare const DOCKER_NODE_VERSION = "24.22.3";
|
|
20
|
+
/** The sha256 of that release's Linux tarball for each Debian architecture, from its signed SHASUMS256.txt. */
|
|
21
|
+
export declare const DOCKER_NODE_SHA256: Readonly<Record<"amd64" | "arm64", string>>;
|
|
22
|
+
/** The default image's recipe: python with git, curl and rg for a model's tools, Node (node, npm and npx) from
|
|
23
|
+
* nodejs.org checked against its sha256 before it is unpacked, and socat, the relay to a computer's egress proxy when it
|
|
24
|
+
* has one. */
|
|
19
25
|
export declare const DOCKER_RECIPE: string;
|
|
20
26
|
/** Where an image comes from: a recipe, built here, or an image by name, pulled when Docker has none. */
|
|
21
27
|
export type ImageSource = {
|
package/dist/docker/image.js
CHANGED
|
@@ -36,13 +36,34 @@ export const DOCKER_RECIPE_HAS = "python, git, curl, node, npm, rg";
|
|
|
36
36
|
* registry-1.docker.io/v2/library/python/manifests/3.12-slim accepting an OCI index or a manifest list: its
|
|
37
37
|
* `docker-content-digest`), and put it here. The recipe's hash changes with it, and so does DEFAULT_DOCKER_IMAGE. */
|
|
38
38
|
export const DOCKER_BASE = "python:3.12-slim@sha256:b18b261e1b4974b4f321451ad5251ded85abb22c2b8b262da527dda1d031ab30";
|
|
39
|
-
/** The
|
|
40
|
-
*
|
|
39
|
+
/** The Node release the default image runs, the server image's (packages/serve/docker/Dockerfile): Debian's nodejs
|
|
40
|
+
* comes with npm 9, older than the npm current packages are published for. */
|
|
41
|
+
export const DOCKER_NODE_VERSION = "24.22.3";
|
|
42
|
+
/** The sha256 of that release's Linux tarball for each Debian architecture, from its signed SHASUMS256.txt. */
|
|
43
|
+
export const DOCKER_NODE_SHA256 = {
|
|
44
|
+
amd64: "4f2b175a6d53a5c617a80dba2676238a0688cef28c6da4eba35c7d844e66fcfb",
|
|
45
|
+
arm64: "6e51a2ada00f0011cc266f65d98922b403d7ad88f809ca2aa615a5fe1ce6e86c",
|
|
46
|
+
};
|
|
47
|
+
/** The default image's recipe: python with git, curl and rg for a model's tools, Node (node, npm and npx) from
|
|
48
|
+
* nodejs.org checked against its sha256 before it is unpacked, and socat, the relay to a computer's egress proxy when it
|
|
49
|
+
* has one. */
|
|
41
50
|
export const DOCKER_RECIPE = [
|
|
42
51
|
`FROM ${DOCKER_BASE}`,
|
|
43
52
|
"RUN apt-get update \\",
|
|
44
|
-
" && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git curl ca-certificates
|
|
53
|
+
" && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git curl ca-certificates xz-utils ripgrep socat \\",
|
|
45
54
|
" && rm -rf /var/lib/apt/lists/*",
|
|
55
|
+
"RUN set -eu; \\",
|
|
56
|
+
' case "$(dpkg --print-architecture)" in \\',
|
|
57
|
+
` amd64) arch=x64; sum=${DOCKER_NODE_SHA256.amd64} ;; \\`,
|
|
58
|
+
` arm64) arch=arm64; sum=${DOCKER_NODE_SHA256.arm64} ;; \\`,
|
|
59
|
+
' *) echo "no Node build for $(dpkg --print-architecture)" >&2; exit 1 ;; \\',
|
|
60
|
+
" esac; \\",
|
|
61
|
+
` file="node-v${DOCKER_NODE_VERSION}-linux-$arch.tar.xz"; \\`,
|
|
62
|
+
` curl -fsSLo "/tmp/$file" "https://nodejs.org/dist/v${DOCKER_NODE_VERSION}/$file"; \\`,
|
|
63
|
+
' echo "$sum /tmp/$file" | sha256sum -c -; \\',
|
|
64
|
+
' tar -xJf "/tmp/$file" -C /usr/local --strip-components=1 --no-same-owner; \\',
|
|
65
|
+
' rm -f "/tmp/$file" /usr/local/CHANGELOG.md /usr/local/README.md /usr/local/LICENSE; \\',
|
|
66
|
+
" node --version; npm --version",
|
|
46
67
|
"",
|
|
47
68
|
].join("\n");
|
|
48
69
|
export const recipeHash = (recipe) => createHash("sha256").update(recipe).digest("hex");
|
package/dist/docker.d.ts
CHANGED
|
@@ -31,6 +31,12 @@ export interface DockerEgressOptions {
|
|
|
31
31
|
* better; it never makes the refusal weaker than what that root shows.
|
|
32
32
|
*/
|
|
33
33
|
hostRoot?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The most connections one computer's proxy holds open at once (its tunnels and forwarded requests), past which a new
|
|
36
|
+
* one is refused with 429: a whole number from 1 to MAX_TUNNELS_CEILING (256). Default the proxy's, 64. A proxy keeps
|
|
37
|
+
* the cap it was made with.
|
|
38
|
+
*/
|
|
39
|
+
maxTunnels?: number;
|
|
34
40
|
}
|
|
35
41
|
export interface DockerProviderOptions {
|
|
36
42
|
/** The daemon binary on this machine, for the computer's architecture (dist/computerd-linux-<arch>). Any mode this
|
package/dist/docker.js
CHANGED
|
@@ -15,7 +15,7 @@ import { dockerEnv } from "./child-env.js";
|
|
|
15
15
|
import { DOCKER_RECIPE, ensureImage, imageSourceProblem } from "./docker/image.js";
|
|
16
16
|
import { ALLOW_PORTS, allowOf, containerSigns, EGRESS_IMAGE, EGRESS_LABEL, EGRESS_MOUNT, EGRESS_NETWORK, EGRESS_READY_MS, EGRESS_SOCKET, egressCode, egressCodeProblem, egressNameOf, egressNetworkArgs, egressNetworkProblem, egressRunArgs, egressVolumeArgs, hostAddresses, MAX_ALLOW, NO_CONFIG_PROXY, policyWords, RELAY_FLAG, } from "./docker/egress.js";
|
|
17
17
|
import { daemonStage, daemonVerified, egressStage, egressStaged } from "./docker/stage.js";
|
|
18
|
-
import { EGRESS_READY } from "./docker/egress-proxy.js";
|
|
18
|
+
import { EGRESS_READY, MAX_TUNNELS_CEILING } from "./docker/egress-proxy.js";
|
|
19
19
|
import { OLD_ENGINE, outsideWords, subpathOf, VOLUME_SUBPATH_ENGINE, volumeMount, volumeOf } from "./docker/volume.js";
|
|
20
20
|
import { addressBytes } from "./docker/egress-table.js";
|
|
21
21
|
import { checkMount, WORKSPACE } from "./mount.js";
|
|
@@ -733,8 +733,8 @@ export class DockerProvider {
|
|
|
733
733
|
return volume;
|
|
734
734
|
if (volume.value.exitCode !== 0)
|
|
735
735
|
return vendorFail("docker", `docker volume create ${proxy} failed: ${volume.value.stderr.trim()}`);
|
|
736
|
-
const { image, hint, readyMs } = this.#egress;
|
|
737
|
-
const args = egressRunArgs({ name, user, image, allow, local: this.#hostLocal(), deadline, code: this.#code, labels, ...(hint === undefined ? {} : { hint }) });
|
|
736
|
+
const { image, hint, readyMs, maxTunnels } = this.#egress;
|
|
737
|
+
const args = egressRunArgs({ name, user, image, allow, local: this.#hostLocal(), deadline, code: this.#code, labels, ...(hint === undefined ? {} : { hint }), ...(maxTunnels === undefined ? {} : { maxTunnels }) });
|
|
738
738
|
const ran = await this.#run(args, signal);
|
|
739
739
|
if (!ran.ok) {
|
|
740
740
|
// Cut off before its own exit: the daemon may still make the proxy after the caller's cleanup looked (#settle).
|
|
@@ -1594,7 +1594,7 @@ export function settleBoundsOf({ settleMs = SETTLE_MS, settleQuietMs = SETTLE_QU
|
|
|
1594
1594
|
return { settleMs, quietMs: settleQuietMs };
|
|
1595
1595
|
}
|
|
1596
1596
|
/** The egress options with their defaults, or a throw in words. */
|
|
1597
|
-
function egressOptionsOf({ image = EGRESS_IMAGE, hint, readyMs = EGRESS_READY_MS, hostAddresses: given, hostRoot = "/" }) {
|
|
1597
|
+
function egressOptionsOf({ image = EGRESS_IMAGE, hint, readyMs = EGRESS_READY_MS, hostAddresses: given, hostRoot = "/", maxTunnels }) {
|
|
1598
1598
|
if (typeof hostRoot !== "string" || !hostRoot.startsWith("/"))
|
|
1599
1599
|
throw new Error(`the egress proxy's hostRoot must be an absolute path, not ${JSON.stringify(hostRoot)}`);
|
|
1600
1600
|
if (typeof image !== "string" || image.trim() === "" || image.startsWith("-") || image.includes("\0")) {
|
|
@@ -1609,7 +1609,17 @@ function egressOptionsOf({ image = EGRESS_IMAGE, hint, readyMs = EGRESS_READY_MS
|
|
|
1609
1609
|
if (given !== undefined && !(Array.isArray(given) && given.every((address) => typeof address === "string" && addressBytes(address) !== undefined && !address.includes(",")))) {
|
|
1610
1610
|
throw new Error(`the egress proxy's hostAddresses must be a list of IP addresses, such as ["93.184.215.20"], not ${JSON.stringify(given)}`);
|
|
1611
1611
|
}
|
|
1612
|
-
|
|
1612
|
+
if (maxTunnels !== undefined && (!Number.isSafeInteger(maxTunnels) || maxTunnels < 1 || maxTunnels > MAX_TUNNELS_CEILING)) {
|
|
1613
|
+
throw new Error(`the egress proxy's maxTunnels must be a whole number from 1 to ${MAX_TUNNELS_CEILING}, not ${JSON.stringify(maxTunnels)}`);
|
|
1614
|
+
}
|
|
1615
|
+
return {
|
|
1616
|
+
image,
|
|
1617
|
+
readyMs,
|
|
1618
|
+
hostRoot,
|
|
1619
|
+
...(hint === undefined ? {} : { hint }),
|
|
1620
|
+
...(given === undefined ? {} : { hostAddresses: [...given] }),
|
|
1621
|
+
...(maxTunnels === undefined ? {} : { maxTunnels }),
|
|
1622
|
+
};
|
|
1613
1623
|
}
|
|
1614
1624
|
/**
|
|
1615
1625
|
* Why an allowlist is refused when this provider's own interfaces are not the Docker host's: the proxy refuses the host's
|