@alchemy.run/e2b 0.0.0-stage → 2.0.0-beta.86
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/LICENSE +201 -0
- package/README.md +60 -2
- package/lib/ApiKey.d.ts +53 -0
- package/lib/ApiKey.d.ts.map +1 -0
- package/lib/ApiKey.js +107 -0
- package/lib/ApiKey.js.map +1 -0
- package/lib/AuthProvider.d.ts +60 -0
- package/lib/AuthProvider.d.ts.map +1 -0
- package/lib/AuthProvider.js +293 -0
- package/lib/AuthProvider.js.map +1 -0
- package/lib/Bootstrap.d.ts +7 -0
- package/lib/Bootstrap.d.ts.map +1 -0
- package/lib/Bootstrap.js +25 -0
- package/lib/Bootstrap.js.map +1 -0
- package/lib/ConnectSandbox.d.ts +67 -0
- package/lib/ConnectSandbox.d.ts.map +1 -0
- package/lib/ConnectSandbox.js +3 -0
- package/lib/ConnectSandbox.js.map +1 -0
- package/lib/ConnectSandboxHttp.d.ts +22 -0
- package/lib/ConnectSandboxHttp.d.ts.map +1 -0
- package/lib/ConnectSandboxHttp.js +30 -0
- package/lib/ConnectSandboxHttp.js.map +1 -0
- package/lib/Contributions.d.ts +7 -0
- package/lib/Contributions.d.ts.map +1 -0
- package/lib/Contributions.js +6 -0
- package/lib/Contributions.js.map +1 -0
- package/lib/CreateSandbox.d.ts +139 -0
- package/lib/CreateSandbox.d.ts.map +1 -0
- package/lib/CreateSandbox.js +3 -0
- package/lib/CreateSandbox.js.map +1 -0
- package/lib/CreateSandboxHttp.d.ts +22 -0
- package/lib/CreateSandboxHttp.d.ts.map +1 -0
- package/lib/CreateSandboxHttp.js +99 -0
- package/lib/CreateSandboxHttp.js.map +1 -0
- package/lib/CreateSecret.d.ts +57 -0
- package/lib/CreateSecret.d.ts.map +1 -0
- package/lib/CreateSecret.js +3 -0
- package/lib/CreateSecret.js.map +1 -0
- package/lib/CreateSecretHttp.d.ts +20 -0
- package/lib/CreateSecretHttp.d.ts.map +1 -0
- package/lib/CreateSecretHttp.js +64 -0
- package/lib/CreateSecretHttp.js.map +1 -0
- package/lib/CreateSnapshot.d.ts +53 -0
- package/lib/CreateSnapshot.d.ts.map +1 -0
- package/lib/CreateSnapshot.js +3 -0
- package/lib/CreateSnapshot.js.map +1 -0
- package/lib/CreateSnapshotHttp.d.ts +20 -0
- package/lib/CreateSnapshotHttp.d.ts.map +1 -0
- package/lib/CreateSnapshotHttp.js +41 -0
- package/lib/CreateSnapshotHttp.js.map +1 -0
- package/lib/CreateTemplate.d.ts +96 -0
- package/lib/CreateTemplate.d.ts.map +1 -0
- package/lib/CreateTemplate.js +3 -0
- package/lib/CreateTemplate.js.map +1 -0
- package/lib/CreateTemplateHttp.d.ts +20 -0
- package/lib/CreateTemplateHttp.d.ts.map +1 -0
- package/lib/CreateTemplateHttp.js +99 -0
- package/lib/CreateTemplateHttp.js.map +1 -0
- package/lib/CreateVolume.d.ts +58 -0
- package/lib/CreateVolume.d.ts.map +1 -0
- package/lib/CreateVolume.js +3 -0
- package/lib/CreateVolume.js.map +1 -0
- package/lib/CreateVolumeHttp.d.ts +20 -0
- package/lib/CreateVolumeHttp.d.ts.map +1 -0
- package/lib/CreateVolumeHttp.js +51 -0
- package/lib/CreateVolumeHttp.js.map +1 -0
- package/lib/Credentials.d.ts +18 -0
- package/lib/Credentials.d.ts.map +1 -0
- package/lib/Credentials.js +55 -0
- package/lib/Credentials.js.map +1 -0
- package/lib/E2BBindings.d.ts +35 -0
- package/lib/E2BBindings.d.ts.map +1 -0
- package/lib/E2BBindings.js +127 -0
- package/lib/E2BBindings.js.map +1 -0
- package/lib/Errors.d.ts +61 -0
- package/lib/Errors.d.ts.map +1 -0
- package/lib/Errors.js +23 -0
- package/lib/Errors.js.map +1 -0
- package/lib/InferEnv.d.ts +26 -0
- package/lib/InferEnv.d.ts.map +1 -0
- package/lib/InferEnv.js +1 -0
- package/lib/InferEnv.js.map +1 -0
- package/lib/MountVolume.d.ts +86 -0
- package/lib/MountVolume.d.ts.map +1 -0
- package/lib/MountVolume.js +3 -0
- package/lib/MountVolume.js.map +1 -0
- package/lib/MountVolumeLive.d.ts +23 -0
- package/lib/MountVolumeLive.d.ts.map +1 -0
- package/lib/MountVolumeLive.js +41 -0
- package/lib/MountVolumeLive.js.map +1 -0
- package/lib/Providers.d.ts +14 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +23 -0
- package/lib/Providers.js.map +1 -0
- package/lib/ReadTeam.d.ts +41 -0
- package/lib/ReadTeam.d.ts.map +1 -0
- package/lib/ReadTeam.js +3 -0
- package/lib/ReadTeam.js.map +1 -0
- package/lib/ReadTeamHttp.d.ts +20 -0
- package/lib/ReadTeamHttp.d.ts.map +1 -0
- package/lib/ReadTeamHttp.js +40 -0
- package/lib/ReadTeamHttp.js.map +1 -0
- package/lib/ReadVolume.d.ts +25 -0
- package/lib/ReadVolume.d.ts.map +1 -0
- package/lib/ReadVolume.js +3 -0
- package/lib/ReadVolume.js.map +1 -0
- package/lib/ReadVolumeHttp.d.ts +20 -0
- package/lib/ReadVolumeHttp.d.ts.map +1 -0
- package/lib/ReadVolumeHttp.js +27 -0
- package/lib/ReadVolumeHttp.js.map +1 -0
- package/lib/ReadWebhook.d.ts +32 -0
- package/lib/ReadWebhook.d.ts.map +1 -0
- package/lib/ReadWebhook.js +3 -0
- package/lib/ReadWebhook.js.map +1 -0
- package/lib/ReadWebhookHttp.d.ts +20 -0
- package/lib/ReadWebhookHttp.d.ts.map +1 -0
- package/lib/ReadWebhookHttp.js +31 -0
- package/lib/ReadWebhookHttp.js.map +1 -0
- package/lib/ReadWriteVolume.d.ts +26 -0
- package/lib/ReadWriteVolume.d.ts.map +1 -0
- package/lib/ReadWriteVolume.js +3 -0
- package/lib/ReadWriteVolume.js.map +1 -0
- package/lib/ReadWriteVolumeHttp.d.ts +20 -0
- package/lib/ReadWriteVolumeHttp.d.ts.map +1 -0
- package/lib/ReadWriteVolumeHttp.js +27 -0
- package/lib/ReadWriteVolumeHttp.js.map +1 -0
- package/lib/Sandbox.d.ts +295 -0
- package/lib/Sandbox.d.ts.map +1 -0
- package/lib/Sandbox.js +351 -0
- package/lib/Sandbox.js.map +1 -0
- package/lib/SandboxClient.d.ts +226 -0
- package/lib/SandboxClient.d.ts.map +1 -0
- package/lib/SandboxClient.js +1 -0
- package/lib/SandboxClient.js.map +1 -0
- package/lib/SandboxEvents.d.ts +87 -0
- package/lib/SandboxEvents.d.ts.map +1 -0
- package/lib/SandboxEvents.js +39 -0
- package/lib/SandboxEvents.js.map +1 -0
- package/lib/SandboxEventsLive.d.ts +13 -0
- package/lib/SandboxEventsLive.d.ts.map +1 -0
- package/lib/SandboxEventsLive.js +80 -0
- package/lib/SandboxEventsLive.js.map +1 -0
- package/lib/Secret.d.ts +105 -0
- package/lib/Secret.d.ts.map +1 -0
- package/lib/Secret.js +161 -0
- package/lib/Secret.js.map +1 -0
- package/lib/Snapshot.d.ts +118 -0
- package/lib/Snapshot.d.ts.map +1 -0
- package/lib/Snapshot.js +158 -0
- package/lib/Snapshot.js.map +1 -0
- package/lib/Template.d.ts +313 -0
- package/lib/Template.d.ts.map +1 -0
- package/lib/Template.js +421 -0
- package/lib/Template.js.map +1 -0
- package/lib/Volume.d.ts +88 -0
- package/lib/Volume.d.ts.map +1 -0
- package/lib/Volume.js +136 -0
- package/lib/Volume.js.map +1 -0
- package/lib/VolumeFiles.d.ts +39 -0
- package/lib/VolumeFiles.d.ts.map +1 -0
- package/lib/VolumeFiles.js +1 -0
- package/lib/VolumeFiles.js.map +1 -0
- package/lib/Webhook.d.ts +83 -0
- package/lib/Webhook.d.ts.map +1 -0
- package/lib/Webhook.js +138 -0
- package/lib/Webhook.js.map +1 -0
- package/lib/WriteSecret.d.ts +34 -0
- package/lib/WriteSecret.d.ts.map +1 -0
- package/lib/WriteSecret.js +3 -0
- package/lib/WriteSecret.js.map +1 -0
- package/lib/WriteSecretHttp.d.ts +20 -0
- package/lib/WriteSecretHttp.d.ts.map +1 -0
- package/lib/WriteSecretHttp.js +37 -0
- package/lib/WriteSecretHttp.js.map +1 -0
- package/lib/WriteVolume.d.ts +25 -0
- package/lib/WriteVolume.d.ts.map +1 -0
- package/lib/WriteVolume.js +3 -0
- package/lib/WriteVolume.js.map +1 -0
- package/lib/WriteVolumeHttp.d.ts +20 -0
- package/lib/WriteVolumeHttp.d.ts.map +1 -0
- package/lib/WriteVolumeHttp.js +27 -0
- package/lib/WriteVolumeHttp.js.map +1 -0
- package/lib/index.d.ts +43 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +43 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/Declared.d.ts +29 -0
- package/lib/internal/Declared.d.ts.map +1 -0
- package/lib/internal/Declared.js +31 -0
- package/lib/internal/Declared.js.map +1 -0
- package/lib/internal/Login.d.ts +45 -0
- package/lib/internal/Login.d.ts.map +1 -0
- package/lib/internal/Login.js +157 -0
- package/lib/internal/Login.js.map +1 -0
- package/lib/internal/Ownership.d.ts +29 -0
- package/lib/internal/Ownership.d.ts.map +1 -0
- package/lib/internal/Ownership.js +49 -0
- package/lib/internal/Ownership.js.map +1 -0
- package/lib/internal/Program.d.ts +31 -0
- package/lib/internal/Program.d.ts.map +1 -0
- package/lib/internal/Program.js +60 -0
- package/lib/internal/Program.js.map +1 -0
- package/lib/internal/SandboxHandle.d.ts +25 -0
- package/lib/internal/SandboxHandle.d.ts.map +1 -0
- package/lib/internal/SandboxHandle.js +316 -0
- package/lib/internal/SandboxHandle.js.map +1 -0
- package/lib/internal/SnapshotBuild.d.ts +19 -0
- package/lib/internal/SnapshotBuild.d.ts.map +1 -0
- package/lib/internal/SnapshotBuild.js +49 -0
- package/lib/internal/SnapshotBuild.js.map +1 -0
- package/lib/internal/Tar.d.ts +10 -0
- package/lib/internal/Tar.d.ts.map +1 -0
- package/lib/internal/Tar.js +61 -0
- package/lib/internal/Tar.js.map +1 -0
- package/lib/internal/TemplateBuild.d.ts +142 -0
- package/lib/internal/TemplateBuild.d.ts.map +1 -0
- package/lib/internal/TemplateBuild.js +220 -0
- package/lib/internal/TemplateBuild.js.map +1 -0
- package/lib/internal/TemplatePlan.d.ts +57 -0
- package/lib/internal/TemplatePlan.d.ts.map +1 -0
- package/lib/internal/TemplatePlan.js +185 -0
- package/lib/internal/TemplatePlan.js.map +1 -0
- package/lib/internal/VolumeHttp.d.ts +5 -0
- package/lib/internal/VolumeHttp.d.ts.map +1 -0
- package/lib/internal/VolumeHttp.js +46 -0
- package/lib/internal/VolumeHttp.js.map +1 -0
- package/package.json +78 -3
- package/src/ApiKey.ts +148 -0
- package/src/AuthProvider.ts +437 -0
- package/src/Bootstrap.ts +51 -0
- package/src/ConnectSandbox.ts +71 -0
- package/src/ConnectSandboxHttp.ts +38 -0
- package/src/Contributions.ts +9 -0
- package/src/CreateSandbox.ts +157 -0
- package/src/CreateSandboxHttp.ts +131 -0
- package/src/CreateSecret.ts +65 -0
- package/src/CreateSecretHttp.ts +94 -0
- package/src/CreateSnapshot.ts +64 -0
- package/src/CreateSnapshotHttp.ts +55 -0
- package/src/CreateTemplate.ts +135 -0
- package/src/CreateTemplateHttp.ts +152 -0
- package/src/CreateVolume.ts +65 -0
- package/src/CreateVolumeHttp.ts +80 -0
- package/src/Credentials.ts +81 -0
- package/src/E2BBindings.ts +160 -0
- package/src/Errors.ts +47 -0
- package/src/InferEnv.ts +27 -0
- package/src/MountVolume.ts +92 -0
- package/src/MountVolumeLive.ts +49 -0
- package/src/Providers.ts +48 -0
- package/src/ReadTeam.ts +55 -0
- package/src/ReadTeamHttp.ts +44 -0
- package/src/ReadVolume.ts +29 -0
- package/src/ReadVolumeHttp.ts +32 -0
- package/src/ReadWebhook.ts +41 -0
- package/src/ReadWebhookHttp.ts +42 -0
- package/src/ReadWriteVolume.ts +30 -0
- package/src/ReadWriteVolumeHttp.ts +32 -0
- package/src/Sandbox.ts +581 -0
- package/src/SandboxClient.ts +268 -0
- package/src/SandboxEvents.ts +101 -0
- package/src/SandboxEventsLive.ts +118 -0
- package/src/Secret.ts +229 -0
- package/src/Snapshot.ts +234 -0
- package/src/Template.ts +636 -0
- package/src/Volume.ts +173 -0
- package/src/VolumeFiles.ts +53 -0
- package/src/Webhook.ts +215 -0
- package/src/WriteSecret.ts +39 -0
- package/src/WriteSecretHttp.ts +43 -0
- package/src/WriteVolume.ts +29 -0
- package/src/WriteVolumeHttp.ts +32 -0
- package/src/globals.d.ts +2 -0
- package/src/index.ts +42 -0
- package/src/internal/Declared.ts +80 -0
- package/src/internal/Login.ts +210 -0
- package/src/internal/Ownership.ts +67 -0
- package/src/internal/Program.ts +75 -0
- package/src/internal/SandboxHandle.ts +534 -0
- package/src/internal/SnapshotBuild.ts +74 -0
- package/src/internal/Tar.ts +74 -0
- package/src/internal/TemplateBuild.ts +383 -0
- package/src/internal/TemplatePlan.ts +230 -0
- package/src/internal/VolumeHttp.ts +88 -0
package/lib/Sandbox.js
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { Credentials } from "@distilled.cloud/e2b/Credentials";
|
|
2
|
+
import * as sandboxes from "@distilled.cloud/e2b/sandboxes";
|
|
3
|
+
import { Unowned } from "alchemy/AdoptPolicy";
|
|
4
|
+
import { isResolved } from "alchemy/Diff";
|
|
5
|
+
import * as Provider from "alchemy/Provider";
|
|
6
|
+
import { Resource } from "alchemy/Resource";
|
|
7
|
+
import * as Duration from "effect/Duration";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Redacted from "effect/Redacted";
|
|
10
|
+
import * as Stream from "effect/Stream";
|
|
11
|
+
import { E2BUnexpectedResponse } from "./Errors.js";
|
|
12
|
+
import { declarable } from "./internal/Declared.js";
|
|
13
|
+
import { hasOwnershipMetadata, ownershipMetadata, userMetadata } from "./internal/Ownership.js";
|
|
14
|
+
import { denyUnlisted } from "./internal/SandboxHandle.js";
|
|
15
|
+
/**
|
|
16
|
+
* An E2B sandbox the stack owns: one long-lived sandbox that pauses when it
|
|
17
|
+
* is idle and resumes when it is used, instead of one per request.
|
|
18
|
+
*
|
|
19
|
+
* Use it for a workspace that outlives requests (an agent's home, a dev
|
|
20
|
+
* box) or to serve a template program at a stable URL. The sandbox runs for
|
|
21
|
+
* `timeout` after it starts or resumes, then E2B pauses it with its memory
|
|
22
|
+
* and files. A request to one of its URLs resumes it (`autoResume`), and so
|
|
23
|
+
* does `resume()` on `E2B.ConnectSandbox`.
|
|
24
|
+
*
|
|
25
|
+
* Alchemy stamps its stack, stage and logical ID into the sandbox's
|
|
26
|
+
* metadata to recognise the sandboxes it owns.
|
|
27
|
+
*
|
|
28
|
+
* :::caution
|
|
29
|
+
* Replacing the sandbox (a new or rebuilt `template`, or new `env`,
|
|
30
|
+
* `metadata`, `mounts`, `memory`, `autoResume`, `allowPublicTraffic`,
|
|
31
|
+
* `maskRequestHost` or `httpsPorts`) starts a
|
|
32
|
+
* fresh sandbox and kills the old one with its files. If E2B no longer has
|
|
33
|
+
* the sandbox, the next deploy that updates it (or `alchemy drift`) creates
|
|
34
|
+
* a new one.
|
|
35
|
+
* :::
|
|
36
|
+
*
|
|
37
|
+
* ### Creating a Sandbox
|
|
38
|
+
* **Example:** A dev box from a template
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import * as E2B from "@alchemy.run/e2b";
|
|
41
|
+
* import * as Effect from "effect/Effect";
|
|
42
|
+
*
|
|
43
|
+
* export const Node = E2B.Template("Node", { image: "node:22" });
|
|
44
|
+
*
|
|
45
|
+
* export const DevBox = E2B.Sandbox("DevBox", {
|
|
46
|
+
* template: Node,
|
|
47
|
+
* timeout: "10 minutes",
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* ### Serving a template program
|
|
52
|
+
* A template program starts when its sandbox boots. Declare one sandbox for
|
|
53
|
+
* it: each new build of the program replaces the sandbox, so it always runs
|
|
54
|
+
* the current one.
|
|
55
|
+
*
|
|
56
|
+
* **Example:** The program at a stable URL
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import * as E2B from "@alchemy.run/e2b";
|
|
59
|
+
* import * as Output from "alchemy/Output";
|
|
60
|
+
* import * as Effect from "effect/Effect";
|
|
61
|
+
* import Api from "./src/api.ts";
|
|
62
|
+
*
|
|
63
|
+
* export const ApiSandbox = Effect.gen(function* () {
|
|
64
|
+
* const sandbox = yield* E2B.Sandbox("Api", { template: Api });
|
|
65
|
+
* return { url: Output.interpolate`https://3000-${sandbox.sandboxId}.${sandbox.domain}` };
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* ### Private URLs
|
|
70
|
+
* **Example:** Require the traffic token
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const sandbox = yield* E2B.Sandbox("Private", {
|
|
73
|
+
* template: Node,
|
|
74
|
+
* network: { allowPublicTraffic: false },
|
|
75
|
+
* });
|
|
76
|
+
* // send sandbox.trafficAccessToken in the `e2b-traffic-access-token` header
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* ### Egress through your own proxy
|
|
80
|
+
* E2B sends the sandbox's outbound TCP through a SOCKS5 proxy you run,
|
|
81
|
+
* after its allow and deny rules. Code in the sandbox can't tell, and
|
|
82
|
+
* can't go around it.
|
|
83
|
+
*
|
|
84
|
+
* **Example:** A proxy over TLS, with a password
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import * as E2B from "@alchemy.run/e2b";
|
|
87
|
+
* import * as Config from "effect/Config";
|
|
88
|
+
* import { Node } from "./Node.ts";
|
|
89
|
+
*
|
|
90
|
+
* export const Proxied = E2B.Sandbox("Proxied", {
|
|
91
|
+
* template: Node,
|
|
92
|
+
* network: {
|
|
93
|
+
* egressProxy: {
|
|
94
|
+
* address: "proxy.example.com:1080",
|
|
95
|
+
* username: "sandbox",
|
|
96
|
+
* password: Config.Redacted("PROXY_PASSWORD"),
|
|
97
|
+
* tls: { enabled: true },
|
|
98
|
+
* },
|
|
99
|
+
* },
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* ### Using it at runtime
|
|
104
|
+
* **Example:** Run a command in it from a Worker
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const devBox = yield* E2B.ConnectSandbox(DevBox);
|
|
107
|
+
* // in fetch:
|
|
108
|
+
* yield* devBox.resume();
|
|
109
|
+
* const result = yield* devBox.exec("git pull && npm test", { cwd: "/home/user/repo" });
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* ### Mounting volumes
|
|
113
|
+
* **Example:** A shared cache volume
|
|
114
|
+
* ```typescript
|
|
115
|
+
* export const Cache = E2B.Volume("Cache", {});
|
|
116
|
+
*
|
|
117
|
+
* export const Builder = E2B.Sandbox("Builder", {
|
|
118
|
+
* template: Node,
|
|
119
|
+
* mounts: [{ volume: Cache, path: "/cache" }],
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* ### Referencing a sandbox the stack doesn't manage
|
|
124
|
+
* **Example:** Look one up by id
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const shared = E2B.Sandbox.lookup({ sandboxId: "i1a2b3c4d5e6f7g8h9" });
|
|
127
|
+
* const box = yield* E2B.ConnectSandbox(shared);
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @resource
|
|
131
|
+
* @product Sandbox
|
|
132
|
+
*/
|
|
133
|
+
export const Sandbox = declarable()(Resource("E2B.Sandbox"));
|
|
134
|
+
const DEFAULT_TIMEOUT_SECONDS = 300;
|
|
135
|
+
const secondsOf = (timeout) => timeout === undefined
|
|
136
|
+
? DEFAULT_TIMEOUT_SECONDS
|
|
137
|
+
: Math.max(1, Math.round(Duration.toMillis(Duration.fromInputUnsafe(timeout)) / 1000));
|
|
138
|
+
const redact = (token) => token === undefined || token === null
|
|
139
|
+
? undefined
|
|
140
|
+
: Redacted.isRedacted(token)
|
|
141
|
+
? token
|
|
142
|
+
: Redacted.make(token);
|
|
143
|
+
/** The E2B domain the credentials address; sandboxes on it report no domain of their own. */
|
|
144
|
+
const configuredDomain = Effect.gen(function* () {
|
|
145
|
+
const credentials = yield* Credentials;
|
|
146
|
+
return (yield* credentials).domain;
|
|
147
|
+
});
|
|
148
|
+
/** A sandbox's details, or `undefined` when E2B no longer has it. */
|
|
149
|
+
const observeSandbox = (sandboxId) => sandboxes.getSandbox({ sandboxID: sandboxId }).pipe(Effect.map((detail) => detail), Effect.catchTag("NotFound", () => Effect.undefined));
|
|
150
|
+
const toAttributes = (detail, stored, fallbackDomain) => ({
|
|
151
|
+
sandboxId: detail.sandboxID,
|
|
152
|
+
templateId: detail.templateID,
|
|
153
|
+
templateBuild: stored.templateBuild,
|
|
154
|
+
mounts: stored.mounts,
|
|
155
|
+
domain: detail.domain ?? fallbackDomain,
|
|
156
|
+
trafficAccessToken: stored.trafficAccessToken,
|
|
157
|
+
metadata: userMetadata(detail.metadata),
|
|
158
|
+
cpuCount: detail.cpuCount,
|
|
159
|
+
memoryMB: detail.memoryMB,
|
|
160
|
+
});
|
|
161
|
+
/** The network fields `updateSandboxNetwork` can change, as E2B stores them. */
|
|
162
|
+
const mutableNetwork = (network) => {
|
|
163
|
+
const desired = network === undefined ? {} : denyUnlisted(network);
|
|
164
|
+
return {
|
|
165
|
+
allowOut: [...(desired.allowOut ?? [])].sort(),
|
|
166
|
+
denyOut: [...(desired.denyOut ?? [])].sort(),
|
|
167
|
+
dnsServers: desired.dnsServers === undefined ? undefined : [...desired.dnsServers].sort(),
|
|
168
|
+
rules: desired.rules ?? {},
|
|
169
|
+
egressProxy: proxyIdentity(desired.egressProxy),
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const plain = (value) => Redacted.isRedacted(value) ? Redacted.value(value) : value;
|
|
173
|
+
/** An egress proxy without its password, which E2B never returns. */
|
|
174
|
+
const proxyIdentity = (proxy) => proxy === undefined || proxy === null
|
|
175
|
+
? undefined
|
|
176
|
+
: {
|
|
177
|
+
address: proxy.address,
|
|
178
|
+
username: proxy.username ?? undefined,
|
|
179
|
+
tls: proxy.tls?.enabled
|
|
180
|
+
? {
|
|
181
|
+
serverName: proxy.tls.serverName ?? undefined,
|
|
182
|
+
caCert: proxy.tls.caCert ?? undefined,
|
|
183
|
+
}
|
|
184
|
+
: undefined,
|
|
185
|
+
};
|
|
186
|
+
const sameJson = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
187
|
+
/** The template's mounts and the sandbox's own, by path (the sandbox's win). */
|
|
188
|
+
const mountsOf = (props) => [
|
|
189
|
+
...new Map([...(props.template.mounts ?? []), ...(props.mounts ?? [])].map((mount) => [mount.path, { volume: { name: mount.volume.name }, path: mount.path }])).values(),
|
|
190
|
+
].sort((a, b) => a.path.localeCompare(b.path));
|
|
191
|
+
const templateBuildOf = (props) => props.template.buildId ?? props.template.setupHash;
|
|
192
|
+
/** Props whose change means a new sandbox (E2B can't change them on a live one). */
|
|
193
|
+
const replacingProps = (props) => ({
|
|
194
|
+
template: props.template.templateId,
|
|
195
|
+
build: templateBuildOf(props),
|
|
196
|
+
autoResume: props.autoResume ?? true,
|
|
197
|
+
memory: props.memory ?? true,
|
|
198
|
+
env: props.env ?? {},
|
|
199
|
+
metadata: props.metadata ?? {},
|
|
200
|
+
mounts: mountsOf(props),
|
|
201
|
+
allowPublicTraffic: props.network?.allowPublicTraffic ?? true,
|
|
202
|
+
maskRequestHost: props.network?.maskRequestHost,
|
|
203
|
+
httpsPorts: [...(props.network?.httpsPorts ?? [])].sort((a, b) => a - b),
|
|
204
|
+
});
|
|
205
|
+
export const SandboxProvider = () => Provider.effect(Sandbox, Effect.gen(function* () {
|
|
206
|
+
return {
|
|
207
|
+
stables: ["sandboxId", "templateId", "domain"],
|
|
208
|
+
diff: Effect.fn(function* ({ news, olds }) {
|
|
209
|
+
if (!isResolved(news) || olds === undefined)
|
|
210
|
+
return undefined;
|
|
211
|
+
if (!sameJson(replacingProps(olds), replacingProps(news))) {
|
|
212
|
+
return { action: "replace" };
|
|
213
|
+
}
|
|
214
|
+
return undefined;
|
|
215
|
+
}),
|
|
216
|
+
read: Effect.fn(function* ({ id, output }) {
|
|
217
|
+
if (output === undefined)
|
|
218
|
+
return undefined;
|
|
219
|
+
const detail = yield* observeSandbox(output.sandboxId);
|
|
220
|
+
if (detail === undefined)
|
|
221
|
+
return undefined;
|
|
222
|
+
const attrs = toAttributes(detail, output, yield* configuredDomain);
|
|
223
|
+
const ours = yield* hasOwnershipMetadata(id, detail.metadata);
|
|
224
|
+
return ours ? attrs : Unowned(attrs);
|
|
225
|
+
}),
|
|
226
|
+
lookup: Effect.fn(function* ({ sandboxId }) {
|
|
227
|
+
const detail = yield* observeSandbox(sandboxId);
|
|
228
|
+
if (detail === undefined)
|
|
229
|
+
return undefined;
|
|
230
|
+
return toAttributes(detail, { templateBuild: undefined, trafficAccessToken: undefined, mounts: [] }, yield* configuredDomain);
|
|
231
|
+
}),
|
|
232
|
+
reconcile: Effect.fn(function* ({ id, news, olds, output, session }) {
|
|
233
|
+
const timeout = secondsOf(news.timeout);
|
|
234
|
+
const memory = news.memory ?? true;
|
|
235
|
+
const autoResume = news.autoResume ?? true;
|
|
236
|
+
const mounts = mountsOf(news);
|
|
237
|
+
const templateBuild = templateBuildOf(news);
|
|
238
|
+
// Observe — `output` caches the id; the sandbox may be gone.
|
|
239
|
+
let detail = output === undefined ? undefined : yield* observeSandbox(output.sandboxId);
|
|
240
|
+
let trafficAccessToken = output?.trafficAccessToken;
|
|
241
|
+
// Ensure
|
|
242
|
+
if (detail === undefined) {
|
|
243
|
+
yield* session.note(`Creating sandbox from ${news.template.templateId}...`);
|
|
244
|
+
const created = yield* sandboxes.createSandbox({
|
|
245
|
+
templateID: news.template.templateId,
|
|
246
|
+
timeout,
|
|
247
|
+
autoPause: true,
|
|
248
|
+
autoPauseMemory: memory,
|
|
249
|
+
autoResume: { enabled: autoResume },
|
|
250
|
+
metadata: { ...news.metadata, ...(yield* ownershipMetadata(id)) },
|
|
251
|
+
...(news.env === undefined ? {} : { envVars: news.env }),
|
|
252
|
+
...(news.network === undefined ? {} : { network: denyUnlisted(news.network) }),
|
|
253
|
+
...(mounts.length === 0
|
|
254
|
+
? {}
|
|
255
|
+
: {
|
|
256
|
+
volumeMounts: mounts.map((mount) => ({
|
|
257
|
+
name: mount.volume.name,
|
|
258
|
+
path: mount.path,
|
|
259
|
+
})),
|
|
260
|
+
}),
|
|
261
|
+
});
|
|
262
|
+
trafficAccessToken = redact(created.trafficAccessToken);
|
|
263
|
+
detail = yield* observeSandbox(created.sandboxID);
|
|
264
|
+
if (detail === undefined) {
|
|
265
|
+
return yield* new E2BUnexpectedResponse({
|
|
266
|
+
message: `E2B sandbox ${created.sandboxID} vanished after create`,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
return toAttributes(detail, { templateBuild, trafficAccessToken, mounts }, created.domain ?? (yield* configuredDomain));
|
|
270
|
+
}
|
|
271
|
+
// Sync — egress rules, observed against what E2B stores.
|
|
272
|
+
const desiredNetwork = mutableNetwork(news.network);
|
|
273
|
+
const observedNetwork = mutableNetwork(detail.network);
|
|
274
|
+
const dnsMatches = desiredNetwork.dnsServers === undefined ||
|
|
275
|
+
sameJson(desiredNetwork.dnsServers, observedNetwork.dnsServers);
|
|
276
|
+
if (!sameJson(desiredNetwork.allowOut, observedNetwork.allowOut) ||
|
|
277
|
+
!sameJson(desiredNetwork.denyOut, observedNetwork.denyOut) ||
|
|
278
|
+
!sameJson(desiredNetwork.rules, observedNetwork.rules) ||
|
|
279
|
+
!sameJson(desiredNetwork.egressProxy, observedNetwork.egressProxy) ||
|
|
280
|
+
// The proxy's password can't be observed, so `olds` is the only
|
|
281
|
+
// signal it changed.
|
|
282
|
+
(olds !== undefined &&
|
|
283
|
+
plain(olds.network?.egressProxy?.password) !==
|
|
284
|
+
plain(news.network?.egressProxy?.password)) ||
|
|
285
|
+
!dnsMatches) {
|
|
286
|
+
yield* session.note(`Updating sandbox ${detail.sandboxID} network...`);
|
|
287
|
+
yield* sandboxes.updateSandboxNetwork({
|
|
288
|
+
sandboxID: detail.sandboxID,
|
|
289
|
+
allowOut: desiredNetwork.allowOut,
|
|
290
|
+
denyOut: desiredNetwork.denyOut,
|
|
291
|
+
rules: desiredNetwork.rules,
|
|
292
|
+
// An update replaces the whole configuration: a field left
|
|
293
|
+
// out is cleared.
|
|
294
|
+
...(news.network?.egressProxy === undefined
|
|
295
|
+
? {}
|
|
296
|
+
: { egressProxy: news.network.egressProxy }),
|
|
297
|
+
...(desiredNetwork.dnsServers === undefined
|
|
298
|
+
? {}
|
|
299
|
+
: { dnsServers: desiredNetwork.dnsServers }),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
// Sync — the run's timeout. E2B doesn't report the configured
|
|
303
|
+
// timeout, so `olds` is the only signal it changed.
|
|
304
|
+
if (olds !== undefined && secondsOf(olds.timeout) !== timeout) {
|
|
305
|
+
if (detail.state === "paused") {
|
|
306
|
+
// Resuming takes the new timeout; the sandbox pauses again after it.
|
|
307
|
+
const resumed = yield* sandboxes.connectSandbox({
|
|
308
|
+
sandboxID: detail.sandboxID,
|
|
309
|
+
timeout,
|
|
310
|
+
});
|
|
311
|
+
trafficAccessToken = redact(resumed.trafficAccessToken) ?? trafficAccessToken;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
yield* sandboxes.setSandboxTimeout({ sandboxID: detail.sandboxID, timeout });
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return toAttributes(detail, { templateBuild, trafficAccessToken, mounts }, yield* configuredDomain);
|
|
318
|
+
}),
|
|
319
|
+
delete: Effect.fn(function* ({ output }) {
|
|
320
|
+
yield* sandboxes
|
|
321
|
+
.deleteSandbox({ sandboxID: output.sandboxId })
|
|
322
|
+
.pipe(Effect.catchTag("NotFound", () => Effect.void));
|
|
323
|
+
}),
|
|
324
|
+
list: Effect.fn(function* () {
|
|
325
|
+
const domain = yield* configuredDomain;
|
|
326
|
+
const all = Array.from(yield* Stream.runCollect(sandboxes.listSandboxes.items({
|
|
327
|
+
state: ["running", "paused"],
|
|
328
|
+
limit: 100,
|
|
329
|
+
})));
|
|
330
|
+
return (all
|
|
331
|
+
// Declared sandboxes and the ones bindings create at run time
|
|
332
|
+
// both carry `alchemy::stack`, so `nuke` finds both.
|
|
333
|
+
.filter((sandbox) => sandbox.metadata?.["alchemy::stack"] !== undefined)
|
|
334
|
+
.map((sandbox) => ({
|
|
335
|
+
sandboxId: sandbox.sandboxID,
|
|
336
|
+
templateId: sandbox.templateID,
|
|
337
|
+
templateBuild: undefined,
|
|
338
|
+
mounts: (sandbox.volumeMounts ?? []).map((mount) => ({
|
|
339
|
+
volume: { name: mount.name },
|
|
340
|
+
path: mount.path,
|
|
341
|
+
})),
|
|
342
|
+
domain,
|
|
343
|
+
trafficAccessToken: undefined,
|
|
344
|
+
metadata: userMetadata(sandbox.metadata),
|
|
345
|
+
cpuCount: sandbox.cpuCount,
|
|
346
|
+
memoryMB: sandbox.memoryMB,
|
|
347
|
+
})));
|
|
348
|
+
}),
|
|
349
|
+
};
|
|
350
|
+
}));
|
|
351
|
+
//# sourceMappingURL=Sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sandbox.js","sources":["../src/Sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO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AAC;gBAClE,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B,CAAC,CAAC,CACN,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type * as E2B from "@distilled.cloud/e2b";
|
|
2
|
+
import type * as envd from "@distilled.cloud/e2b/envd";
|
|
3
|
+
import type * as filesystem from "@distilled.cloud/e2b/filesystem";
|
|
4
|
+
import type * as process from "@distilled.cloud/e2b/process";
|
|
5
|
+
import type * as sandboxes from "@distilled.cloud/e2b/sandboxes";
|
|
6
|
+
import type * as templates from "@distilled.cloud/e2b/templates";
|
|
7
|
+
import type * as volumes from "@distilled.cloud/e2b/volumes";
|
|
8
|
+
import type { RuntimeContext } from "alchemy/RuntimeContext";
|
|
9
|
+
import type * as Sandbox from "alchemy/Sandbox";
|
|
10
|
+
import type * as Duration from "effect/Duration";
|
|
11
|
+
import type * as Effect from "effect/Effect";
|
|
12
|
+
import type * as Scope from "effect/Scope";
|
|
13
|
+
import type * as Stream from "effect/Stream";
|
|
14
|
+
import type { E2BUnexpectedResponse, ExecTimedOut, SandboxBaseMissing } from "./Errors.ts";
|
|
15
|
+
/** Errors an E2B call can fail with. */
|
|
16
|
+
export type E2BError = E2B.E2BOpError | templates.TemplateInUse | volumes.VolumesNotEnabled | process.ConnectStreamError | process.SandboxNotRunning | filesystem.SandboxNotRunning | envd.SandboxNotRunning | SandboxBaseMissing | ExecTimedOut | E2BUnexpectedResponse;
|
|
17
|
+
/** A process inside a sandbox, by pid or by the tag it was started with. */
|
|
18
|
+
export type ProcessSelector = process.ConnectProcessRequest["process"];
|
|
19
|
+
/** An event from a watched directory. */
|
|
20
|
+
export type WatchEvent = filesystem.WatchDirEvent;
|
|
21
|
+
/** A file or directory inside a sandbox. */
|
|
22
|
+
export type EntryInfo = filesystem.EntryInfo;
|
|
23
|
+
/** A running process inside a sandbox, as `processes.list()` reports it. */
|
|
24
|
+
export type ProcessInfo = process.ProcessInfo;
|
|
25
|
+
/**
|
|
26
|
+
* A command: a shell command line (run with `bash -l -c`), or an argument
|
|
27
|
+
* vector run directly.
|
|
28
|
+
*/
|
|
29
|
+
export type Command = Sandbox.Command;
|
|
30
|
+
/**
|
|
31
|
+
* `cwd` defaults to the sandbox user's home; `timeout` kills the command and
|
|
32
|
+
* fails with `ExecTimedOut`.
|
|
33
|
+
*/
|
|
34
|
+
export type ExecOptions = Sandbox.ExecOptions;
|
|
35
|
+
/** What a finished command printed, and its exit code. A non-zero exit code is returned, not failed. */
|
|
36
|
+
export interface ExecResult extends Sandbox.ExecResult {
|
|
37
|
+
readonly pid: number;
|
|
38
|
+
/** envd's error for a process that could not run (e.g. the executable is missing). */
|
|
39
|
+
readonly error: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
export interface StartOptions {
|
|
42
|
+
/** Working directory. @default the sandbox user's home */
|
|
43
|
+
readonly cwd?: string;
|
|
44
|
+
/** Environment variables for the command. */
|
|
45
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
46
|
+
/** A tag to find the process by with `processes.attach({ tag })`. */
|
|
47
|
+
readonly tag?: string;
|
|
48
|
+
/** Keep stdin open for `write`. @default false */
|
|
49
|
+
readonly stdin?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** A chunk of a process's output. */
|
|
52
|
+
export type ProcessOutput = Sandbox.ProcessOutput;
|
|
53
|
+
/**
|
|
54
|
+
* A process started (or attached to) in the current scope. Closing the
|
|
55
|
+
* scope detaches: the process keeps running until it exits or is killed.
|
|
56
|
+
* `id` is its pid as a string.
|
|
57
|
+
*/
|
|
58
|
+
export interface Process extends Sandbox.Process<E2BError> {
|
|
59
|
+
readonly pid: number;
|
|
60
|
+
/** stdout and stderr, from now until the process exits. Read it once. */
|
|
61
|
+
readonly output: Stream.Stream<ProcessOutput, E2BError>;
|
|
62
|
+
/** Writes to stdin (the process must have been started with `stdin: true`). */
|
|
63
|
+
write(data: string | Uint8Array): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
64
|
+
/** Closes stdin. */
|
|
65
|
+
closeStdin(): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
66
|
+
/** Signals the process. @default "SIGKILL" */
|
|
67
|
+
kill(signal?: "SIGTERM" | "SIGKILL"): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
68
|
+
/** Waits for the process to exit, with everything it printed since it was started or attached. */
|
|
69
|
+
readonly wait: Effect.Effect<ExecResult, E2BError>;
|
|
70
|
+
}
|
|
71
|
+
/** The processes running in the sandbox. */
|
|
72
|
+
export interface Processes {
|
|
73
|
+
list(): Effect.Effect<ReadonlyArray<ProcessInfo>, E2BError, RuntimeContext>;
|
|
74
|
+
/** Re-attaches to a running process, by pid or tag; output streams from now on. */
|
|
75
|
+
attach(process: ProcessSelector): Effect.Effect<Process, E2BError, RuntimeContext | Scope.Scope>;
|
|
76
|
+
}
|
|
77
|
+
export interface PtyOptions extends Sandbox.PtyOptions {
|
|
78
|
+
/** A tag to find the terminal's process by. */
|
|
79
|
+
readonly tag?: string;
|
|
80
|
+
}
|
|
81
|
+
/** A pseudo-terminal opened in the current scope. Closing the scope detaches. `id` is its pid as a string. */
|
|
82
|
+
export interface PtyConnection extends Sandbox.PtyConnection<E2BError> {
|
|
83
|
+
readonly pid: number;
|
|
84
|
+
/** The terminal's output. Read it once. */
|
|
85
|
+
readonly output: Stream.Stream<Uint8Array, E2BError>;
|
|
86
|
+
/** Types into the terminal. */
|
|
87
|
+
write(data: string | Uint8Array): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
88
|
+
resize(size: {
|
|
89
|
+
readonly cols: number;
|
|
90
|
+
readonly rows: number;
|
|
91
|
+
}): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
92
|
+
/** Kills the terminal's process. */
|
|
93
|
+
kill(): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
94
|
+
/** Waits for the terminal's process to exit. */
|
|
95
|
+
readonly wait: Effect.Effect<{
|
|
96
|
+
readonly exitCode: number;
|
|
97
|
+
}, E2BError>;
|
|
98
|
+
}
|
|
99
|
+
/** Pseudo-terminals inside the sandbox. */
|
|
100
|
+
export interface Pty extends Sandbox.Pty<E2BError, PtyOptions> {
|
|
101
|
+
open(options: PtyOptions): Effect.Effect<PtyConnection, E2BError, RuntimeContext | Scope.Scope>;
|
|
102
|
+
}
|
|
103
|
+
/** The sandbox's filesystem, through envd. Relative paths resolve in the user's home. */
|
|
104
|
+
export interface Files extends Sandbox.Files<E2BError, EntryInfo> {
|
|
105
|
+
read(path: string): Effect.Effect<Uint8Array, E2BError, RuntimeContext>;
|
|
106
|
+
readText(path: string): Effect.Effect<string, E2BError, RuntimeContext>;
|
|
107
|
+
/** Writes a file, creating parent directories. */
|
|
108
|
+
write(path: string, data: string | Uint8Array): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
109
|
+
list(path: string, options?: {
|
|
110
|
+
readonly depth?: number;
|
|
111
|
+
}): Effect.Effect<ReadonlyArray<EntryInfo>, E2BError, RuntimeContext>;
|
|
112
|
+
stat(path: string): Effect.Effect<EntryInfo, E2BError, RuntimeContext>;
|
|
113
|
+
remove(path: string): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
114
|
+
/** Creates the directory and its parents. */
|
|
115
|
+
makeDir(path: string): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
116
|
+
exists(path: string): Effect.Effect<boolean, E2BError, RuntimeContext>;
|
|
117
|
+
move(source: string, destination: string): Effect.Effect<EntryInfo, E2BError, RuntimeContext>;
|
|
118
|
+
/** Concatenates files into `destination`. */
|
|
119
|
+
compose(sources: ReadonlyArray<string>, destination: string): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
120
|
+
/** Streams changes under a directory until interrupted. */
|
|
121
|
+
watch(path: string, options?: {
|
|
122
|
+
readonly recursive?: boolean;
|
|
123
|
+
readonly includeEntry?: boolean;
|
|
124
|
+
}): Stream.Stream<WatchEvent, E2BError, RuntimeContext>;
|
|
125
|
+
}
|
|
126
|
+
/** One fork's outcome: the new sandbox, or why it could not start. */
|
|
127
|
+
export type ForkResult = {
|
|
128
|
+
readonly _tag: "Forked";
|
|
129
|
+
readonly sandbox: E2BSandbox;
|
|
130
|
+
} | {
|
|
131
|
+
readonly _tag: "ForkFailed";
|
|
132
|
+
readonly code: number | undefined;
|
|
133
|
+
readonly message: string;
|
|
134
|
+
};
|
|
135
|
+
/** Network rules for a running sandbox (`updateSandboxNetwork`), in E2B's shape. */
|
|
136
|
+
export type SandboxNetworkUpdate = Omit<sandboxes.UpdateSandboxNetworkRequest, "sandboxID">;
|
|
137
|
+
/**
|
|
138
|
+
* A port inside an E2B sandbox, served at `https://<port>-<sandboxId>.<domain>`.
|
|
139
|
+
* `fetch` sends a client request to it, or proxies a server request there.
|
|
140
|
+
*/
|
|
141
|
+
export interface Port extends Sandbox.SandboxPort<E2BError> {
|
|
142
|
+
/** The host E2B serves the port on: `<port>-<sandboxId>.<domain>`. */
|
|
143
|
+
readonly host: string;
|
|
144
|
+
/** `https://<host>`. Public unless the sandbox requires its traffic token. */
|
|
145
|
+
readonly url: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* What you can do with a sandbox, however you got it. Calls that reach
|
|
149
|
+
* inside a paused sandbox (`exec`, `start`, `files`, `pty`) fail with
|
|
150
|
+
* `SandboxNotRunning`: `resume()` it first. A sandbox created with
|
|
151
|
+
* `autoResume` is the exception: E2B resumes it on any request.
|
|
152
|
+
*/
|
|
153
|
+
export interface SandboxOperations extends Sandbox.SandboxExec<E2BError, ExecResult, ExecOptions>, Sandbox.SandboxProcesses<E2BError, StartOptions>, Sandbox.SandboxFiles<E2BError, EntryInfo>, Sandbox.SandboxPty<E2BError, PtyOptions>, Sandbox.SandboxPorts<E2BError, Port> {
|
|
154
|
+
/** Runs a command to completion. */
|
|
155
|
+
exec(command: Command, options?: ExecOptions): Effect.Effect<ExecResult, E2BError, RuntimeContext>;
|
|
156
|
+
/** Starts a command in the current scope. */
|
|
157
|
+
start(command: Command, options?: StartOptions): Effect.Effect<Process, E2BError, RuntimeContext | Scope.Scope>;
|
|
158
|
+
readonly processes: Processes;
|
|
159
|
+
readonly files: Files;
|
|
160
|
+
readonly pty: Pty;
|
|
161
|
+
/**
|
|
162
|
+
* A port inside the sandbox. Its `fetch` adds the sandbox's traffic token
|
|
163
|
+
* when the sandbox's URLs are not public.
|
|
164
|
+
*/
|
|
165
|
+
getTcpPort(port: number): Effect.Effect<Port, E2BError, RuntimeContext>;
|
|
166
|
+
/** Live details: state, resources, network, metadata. */
|
|
167
|
+
describe(): Effect.Effect<sandboxes.SandboxDetail, E2BError, RuntimeContext>;
|
|
168
|
+
/** Pauses the sandbox, keeping its memory and files. */
|
|
169
|
+
pause(): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
170
|
+
/**
|
|
171
|
+
* Resumes a paused sandbox (a no-op on a running one). `timeout` sets how
|
|
172
|
+
* long it runs before it is paused or killed again.
|
|
173
|
+
*/
|
|
174
|
+
resume(options?: {
|
|
175
|
+
readonly timeout?: Duration.Input;
|
|
176
|
+
}): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
177
|
+
/** Kills the sandbox. Killing one that is gone succeeds. */
|
|
178
|
+
kill(): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
179
|
+
/** Sets the time left before the sandbox is killed (or paused, with `autoPause`). */
|
|
180
|
+
setTimeout(timeout: Duration.Input): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
181
|
+
/** Extends the sandbox's lifetime by `duration`. */
|
|
182
|
+
refresh(duration?: Duration.Input): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
183
|
+
/** Replaces the sandbox's egress rules (E2B's `updateSandboxNetwork`). */
|
|
184
|
+
updateNetwork(network: SandboxNetworkUpdate): Effect.Effect<void, E2BError, RuntimeContext>;
|
|
185
|
+
/**
|
|
186
|
+
* Snapshots the sandbox into a named template (memory and disk by
|
|
187
|
+
* default). Sandboxes created from it start where this one is now.
|
|
188
|
+
*/
|
|
189
|
+
snapshot(options?: {
|
|
190
|
+
readonly name?: string;
|
|
191
|
+
readonly memory?: boolean;
|
|
192
|
+
}): Effect.Effect<sandboxes.SnapshotInfo, E2BError, RuntimeContext>;
|
|
193
|
+
/**
|
|
194
|
+
* Checkpoints the sandbox (it keeps running) and starts `count` copies of
|
|
195
|
+
* it. Each fork succeeds or fails on its own.
|
|
196
|
+
*/
|
|
197
|
+
fork(options?: {
|
|
198
|
+
readonly count?: number;
|
|
199
|
+
readonly timeout?: Duration.Input;
|
|
200
|
+
}): Effect.Effect<ReadonlyArray<ForkResult>, E2BError, RuntimeContext>;
|
|
201
|
+
/** CPU, memory and disk metrics. */
|
|
202
|
+
metrics(): Effect.Effect<ReadonlyArray<sandboxes.SandboxMetric>, E2BError, RuntimeContext>;
|
|
203
|
+
/** The sandbox's logs. */
|
|
204
|
+
logs(options?: Omit<sandboxes.ListSandboxLogsRequest, "sandboxID">): Effect.Effect<sandboxes.SandboxLogsV2Response, E2BError, RuntimeContext>;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A sandbox created or connected at runtime (`CreateSandbox`). Holds only
|
|
208
|
+
* ids and tokens, so it can be rebuilt from its id with `connect(id)` in
|
|
209
|
+
* any request.
|
|
210
|
+
*/
|
|
211
|
+
export interface E2BSandbox extends SandboxOperations {
|
|
212
|
+
readonly sandboxId: string;
|
|
213
|
+
readonly templateId: string;
|
|
214
|
+
/** The domain the sandbox's ports are served under (`<port>-<sandboxId>.<domain>`). */
|
|
215
|
+
readonly domain: string;
|
|
216
|
+
/** What E2B returned for the sandbox when it was created or connected. */
|
|
217
|
+
readonly info: sandboxes.Sandbox;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A sandbox declared in the stack (`ConnectSandbox`). The same operations
|
|
221
|
+
* as {@link E2BSandbox}; its id is read at runtime.
|
|
222
|
+
*/
|
|
223
|
+
export interface ConnectedSandbox extends SandboxOperations {
|
|
224
|
+
readonly sandboxId: Effect.Effect<string, never, RuntimeContext>;
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=SandboxClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxClient.d.ts","sources":["../src/SandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,KAAK,IAAI,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,KAAK,OAAO,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,KAAK,SAAS,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,KAAK,SAAS,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,KAAK,OAAO,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3F,wCAAwC;AACxC,MAAM,MAAM,QAAQ,GAChB,GAAG,CAAC,UAAU,GACd,SAAS,CAAC,aAAa,GACvB,OAAO,CAAC,iBAAiB,GACzB,OAAO,CAAC,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,GACzB,UAAU,CAAC,iBAAiB,GAC5B,IAAI,CAAC,iBAAiB,GACtB,kBAAkB,GAClB,YAAY,GACZ,qBAAqB,CAAC;AAE1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