@opencoredev/sandbox-sdk 0.1.0

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +33 -0
  4. package/dist/agentos-BOFA_q-a.mjs +389 -0
  5. package/dist/agentos-BOFA_q-a.mjs.map +1 -0
  6. package/dist/ai/harness.d.mts +16 -0
  7. package/dist/ai/harness.mjs +69 -0
  8. package/dist/ai/harness.mjs.map +1 -0
  9. package/dist/ai/index.d.mts +54 -0
  10. package/dist/ai/index.mjs +4 -0
  11. package/dist/ai-DhfwIZdL.mjs +243 -0
  12. package/dist/ai-DhfwIZdL.mjs.map +1 -0
  13. package/dist/capabilities-CEowrzRM.mjs +99 -0
  14. package/dist/capabilities-CEowrzRM.mjs.map +1 -0
  15. package/dist/capabilities-CMnszzpt.d.mts +13 -0
  16. package/dist/capabilities-COKpwoFH.mjs +28 -0
  17. package/dist/capabilities-COKpwoFH.mjs.map +1 -0
  18. package/dist/errors-Ch9PHKTd.mjs +61 -0
  19. package/dist/errors-Ch9PHKTd.mjs.map +1 -0
  20. package/dist/eve/index.d.mts +19 -0
  21. package/dist/eve/index.mjs +155 -0
  22. package/dist/eve/index.mjs.map +1 -0
  23. package/dist/index-B1YT6OQ8.d.mts +25 -0
  24. package/dist/index-BMFkO6Fv.d.mts +31 -0
  25. package/dist/index.d.mts +5 -0
  26. package/dist/index.mjs +38 -0
  27. package/dist/index.mjs.map +1 -0
  28. package/dist/mastra/index.d.mts +118 -0
  29. package/dist/mastra/index.mjs +662 -0
  30. package/dist/mastra/index.mjs.map +1 -0
  31. package/dist/metadata.d.mts +34 -0
  32. package/dist/metadata.mjs +103 -0
  33. package/dist/metadata.mjs.map +1 -0
  34. package/dist/provider-_caCV8kk.d.mts +91 -0
  35. package/dist/provider-utils-DilOYLBO.mjs +201 -0
  36. package/dist/provider-utils-DilOYLBO.mjs.map +1 -0
  37. package/dist/providers/agentos/index.d.mts +7 -0
  38. package/dist/providers/agentos/index.mjs +8 -0
  39. package/dist/providers/daytona/index.d.mts +21 -0
  40. package/dist/providers/daytona/index.mjs +205 -0
  41. package/dist/providers/daytona/index.mjs.map +1 -0
  42. package/dist/providers/e2b/index.d.mts +17 -0
  43. package/dist/providers/e2b/index.mjs +168 -0
  44. package/dist/providers/e2b/index.mjs.map +1 -0
  45. package/dist/providers/local/index.d.mts +22 -0
  46. package/dist/providers/local/index.mjs +21 -0
  47. package/dist/providers/local/index.mjs.map +1 -0
  48. package/dist/providers/upstash/index.d.mts +17 -0
  49. package/dist/providers/upstash/index.mjs +210 -0
  50. package/dist/providers/upstash/index.mjs.map +1 -0
  51. package/dist/providers/vercel/index.d.mts +27 -0
  52. package/dist/providers/vercel/index.mjs +185 -0
  53. package/dist/providers/vercel/index.mjs.map +1 -0
  54. package/dist/sandbox-BUYT-1C9.d.mts +17 -0
  55. package/dist/sandbox-BwyHcB_C.mjs +102 -0
  56. package/dist/sandbox-BwyHcB_C.mjs.map +1 -0
  57. package/dist/testing/index.d.mts +27 -0
  58. package/dist/testing/index.mjs +173 -0
  59. package/dist/testing/index.mjs.map +1 -0
  60. package/dist/types-BTagTtsp.d.mts +100 -0
  61. package/package.json +151 -0
@@ -0,0 +1,205 @@
1
+ import { r as normalizeError } from "../../errors-Ch9PHKTd.mjs";
2
+ import "../../capabilities-COKpwoFH.mjs";
3
+ import "../../sandbox-BwyHcB_C.mjs";
4
+ import { n as daytonaCapabilities } from "../../capabilities-CEowrzRM.mjs";
5
+ import { a as unsupportedSnapshots, n as portResult, o as withManagedSessions, r as toUint8Array, t as commandString } from "../../provider-utils-DilOYLBO.mjs";
6
+ import { randomUUID } from "node:crypto";
7
+ import { Daytona } from "@daytona/sdk";
8
+
9
+ //#region src/providers/daytona/index.ts
10
+ function daytona(options = {}) {
11
+ return withManagedSessions({
12
+ id: "daytona",
13
+ capabilities: daytonaCapabilities,
14
+ async create(createOptions) {
15
+ const client = new Daytona({
16
+ apiKey: options.apiKey,
17
+ apiUrl: options.apiUrl,
18
+ target: options.target
19
+ });
20
+ const raw = await client.create({
21
+ ...options.image ? { image: options.image } : {},
22
+ language: options.language,
23
+ name: options.name,
24
+ public: options.public,
25
+ envVars: { ...createOptions.env }
26
+ }, { timeout: createOptions.timeout ? Math.ceil(createOptions.timeout / 1e3) : void 0 });
27
+ let remoteCwd;
28
+ try {
29
+ remoteCwd = `${(await raw.getWorkDir() ?? createOptions.cwd).replace(/\/$/, "")}/${createOptions.cwd.replace(/^\/+/, "")}`;
30
+ try {
31
+ await raw.fs.getFileDetails(remoteCwd);
32
+ } catch (error) {
33
+ if (!isDaytonaNotFound(error, "sandbox.create.cwd")) throw error;
34
+ await raw.fs.createFolder(remoteCwd, "755");
35
+ }
36
+ } catch (error) {
37
+ await client.delete(raw);
38
+ throw error;
39
+ }
40
+ const toRemotePath = (path) => replacePathPrefix(path, createOptions.cwd, remoteCwd);
41
+ const toVirtualPath = (path) => replacePathPrefix(path, remoteCwd, createOptions.cwd);
42
+ return {
43
+ id: raw.id,
44
+ raw,
45
+ capabilities: daytonaCapabilities,
46
+ files: {
47
+ async write(path, value) {
48
+ await raw.fs.uploadFile(Buffer.from(await toUint8Array(value)), toRemotePath(path));
49
+ },
50
+ async read(path) {
51
+ return new Uint8Array(await raw.fs.downloadFile(toRemotePath(path)));
52
+ },
53
+ async list(path) {
54
+ const remotePath = toRemotePath(path);
55
+ return (await raw.fs.listFiles(remotePath)).map((entry) => ({
56
+ name: entry.name,
57
+ path: toVirtualPath(entry.path ?? `${remotePath.replace(/\/$/, "")}/${entry.name}`),
58
+ type: entry.isDir ? "directory" : "file",
59
+ size: entry.size
60
+ }));
61
+ },
62
+ async mkdir(path) {
63
+ await raw.fs.createFolder(toRemotePath(path), "755");
64
+ },
65
+ async remove(path) {
66
+ await raw.fs.deleteFile(toRemotePath(path), true);
67
+ },
68
+ async exists(path) {
69
+ try {
70
+ await raw.fs.getFileDetails(toRemotePath(path));
71
+ return true;
72
+ } catch (error) {
73
+ if (isDaytonaNotFound(error, "files.exists")) return false;
74
+ throw error;
75
+ }
76
+ }
77
+ },
78
+ async run(command, runOptions) {
79
+ try {
80
+ const started = performance.now();
81
+ const result = await raw.process.executeCommand(commandString(command), toRemotePath(runOptions.cwd), { ...runOptions.env }, runOptions.timeout ? Math.ceil(runOptions.timeout / 1e3) : void 0);
82
+ return {
83
+ stdout: result.result,
84
+ stderr: "",
85
+ exitCode: result.exitCode,
86
+ success: result.exitCode === 0,
87
+ durationMs: Math.round(performance.now() - started)
88
+ };
89
+ } catch (error) {
90
+ throw normalizeError("daytona", "process.run", error);
91
+ }
92
+ },
93
+ async start(command, runOptions) {
94
+ const sessionId = `sandbox-sdk-${randomUUID()}`;
95
+ await raw.process.createSession(sessionId);
96
+ const commandId = (await raw.process.executeSessionCommand(sessionId, {
97
+ command: sessionCommand(commandString(command), toRemotePath(runOptions.cwd), runOptions.env),
98
+ runAsync: true,
99
+ suppressInputEcho: true
100
+ }, runOptions.timeout ? Math.ceil(runOptions.timeout / 1e3) : void 0)).cmdId;
101
+ const events = [];
102
+ const waiters = /* @__PURE__ */ new Set();
103
+ let running = true;
104
+ let killed = false;
105
+ let exitCode = 1;
106
+ let resolveKilled;
107
+ const killedPromise = new Promise((resolve) => {
108
+ resolveKilled = resolve;
109
+ });
110
+ const push = (stream, data) => {
111
+ events.push({
112
+ stream,
113
+ data,
114
+ timestamp: /* @__PURE__ */ new Date()
115
+ });
116
+ for (const wake of waiters) wake();
117
+ waiters.clear();
118
+ };
119
+ const completed = raw.process.getSessionCommandLogs(sessionId, commandId, (data) => push("stdout", data), (data) => push("stderr", data)).then(async () => {
120
+ exitCode = (await raw.process.getSessionCommand(sessionId, commandId)).exitCode ?? 1;
121
+ }).catch((error) => {
122
+ if (!killed) throw error;
123
+ }).finally(() => {
124
+ running = false;
125
+ for (const wake of waiters) wake();
126
+ waiters.clear();
127
+ });
128
+ return {
129
+ id: commandId,
130
+ async status() {
131
+ if (killed) return "killed";
132
+ if (!running) return "exited";
133
+ return (await raw.process.getSessionCommand(sessionId, commandId)).exitCode == null ? "running" : "exited";
134
+ },
135
+ async *output() {
136
+ let index = 0;
137
+ while (running || index < events.length) {
138
+ while (index < events.length) yield events[index++];
139
+ if (!running) break;
140
+ await new Promise((resolve) => waiters.add(resolve));
141
+ }
142
+ },
143
+ write: (value) => raw.process.sendSessionCommandInput(sessionId, commandId, typeof value === "string" ? value : new TextDecoder().decode(value)),
144
+ async wait() {
145
+ await Promise.race([completed, killedPromise]);
146
+ return { exitCode };
147
+ },
148
+ async kill() {
149
+ killed = true;
150
+ try {
151
+ await raw.process.deleteSession(sessionId);
152
+ } catch (error) {
153
+ killed = false;
154
+ throw error;
155
+ }
156
+ exitCode = 137;
157
+ running = false;
158
+ resolveKilled();
159
+ for (const wake of waiters) wake();
160
+ waiters.clear();
161
+ }
162
+ };
163
+ },
164
+ async expose(port) {
165
+ const preview = await raw.getPreviewLink(port);
166
+ return portResult(port, preview.url, raw.public, !raw.public, (path = "/", init = {}) => fetch(new URL(path, preview.url), {
167
+ ...init,
168
+ headers: {
169
+ ...Object.fromEntries(new Headers(init.headers)),
170
+ ...preview.token ? { "x-daytona-preview-token": preview.token } : {}
171
+ }
172
+ }));
173
+ },
174
+ snapshots: unsupportedSnapshots("daytona"),
175
+ async stop() {
176
+ await client.delete(raw);
177
+ }
178
+ };
179
+ }
180
+ }, [], {
181
+ stop: (sandbox) => sandbox.raw.stop(),
182
+ resume: (sandbox) => sandbox.raw.start(),
183
+ destroy: (sandbox) => sandbox.raw.delete()
184
+ });
185
+ }
186
+ function isDaytonaNotFound(error, operation) {
187
+ if (typeof error === "object" && error !== null && "statusCode" in error && error.statusCode === 404) return true;
188
+ return normalizeError("daytona", operation, error).code === "not_found";
189
+ }
190
+ function replacePathPrefix(path, from, to) {
191
+ if (path === from) return to;
192
+ const prefix = `${from.replace(/\/$/, "")}/`;
193
+ return path.startsWith(prefix) ? `${to.replace(/\/$/, "")}/${path.slice(prefix.length)}` : path;
194
+ }
195
+ function sessionCommand(command, cwd, env) {
196
+ const assignments = Object.entries(env ?? {}).map(([key, value]) => shellQuote(`${key}=${value}`));
197
+ return `cd ${shellQuote(cwd)} && ${assignments.length ? `env ${assignments.join(" ")} ` : ""}${command}`;
198
+ }
199
+ function shellQuote(value) {
200
+ return `'${value.replaceAll("'", `'"'"'`)}'`;
201
+ }
202
+
203
+ //#endregion
204
+ export { daytona, daytonaCapabilities };
205
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["remoteCwd: string","events: ProcessOutputEvent[]","resolveKilled!: () => void"],"sources":["../../../src/providers/daytona/index.ts"],"sourcesContent":["import { Daytona, type Sandbox as DaytonaSandbox } from \"@daytona/sdk\";\nimport { randomUUID } from \"node:crypto\";\nimport { normalizeError } from \"../../core/errors\";\nimport type { SandboxProvider } from \"../../core/provider\";\nimport type { ProcessOutputEvent, SandboxProcess } from \"../../core/types\";\nimport {\n commandString,\n portResult,\n toUint8Array,\n unsupportedSnapshots,\n} from \"../../internal/provider-utils\";\nimport { daytonaCapabilities } from \"../capabilities\";\nimport { withManagedSessions } from \"../../internal/managed-provider\";\n\nexport interface DaytonaOptions {\n apiKey?: string;\n apiUrl?: string;\n target?: string;\n image?: string;\n language?: string;\n name?: string;\n public?: boolean;\n}\n\nexport { daytonaCapabilities } from \"../capabilities\";\n\nexport function daytona(options: DaytonaOptions = {}): SandboxProvider<DaytonaSandbox> {\n return withManagedSessions(\n {\n id: \"daytona\",\n capabilities: daytonaCapabilities,\n async create(createOptions) {\n const client = new Daytona({\n apiKey: options.apiKey,\n apiUrl: options.apiUrl,\n target: options.target,\n });\n const raw = await client.create(\n {\n ...(options.image ? { image: options.image } : {}),\n language: options.language,\n name: options.name,\n public: options.public,\n envVars: { ...createOptions.env },\n },\n {\n timeout: createOptions.timeout ? Math.ceil(createOptions.timeout / 1_000) : undefined,\n },\n );\n let remoteCwd: string;\n try {\n const nativeWorkDir = (await raw.getWorkDir()) ?? createOptions.cwd;\n remoteCwd = `${nativeWorkDir.replace(/\\/$/, \"\")}/${createOptions.cwd.replace(/^\\/+/, \"\")}`;\n try {\n await raw.fs.getFileDetails(remoteCwd);\n } catch (error) {\n if (!isDaytonaNotFound(error, \"sandbox.create.cwd\")) throw error;\n await raw.fs.createFolder(remoteCwd, \"755\");\n }\n } catch (error) {\n await client.delete(raw);\n throw error;\n }\n const toRemotePath = (path: string) =>\n replacePathPrefix(path, createOptions.cwd, remoteCwd);\n const toVirtualPath = (path: string) =>\n replacePathPrefix(path, remoteCwd, createOptions.cwd);\n return {\n id: raw.id,\n raw,\n capabilities: daytonaCapabilities,\n files: {\n async write(path, value) {\n await raw.fs.uploadFile(Buffer.from(await toUint8Array(value)), toRemotePath(path));\n },\n async read(path) {\n return new Uint8Array(await raw.fs.downloadFile(toRemotePath(path)));\n },\n async list(path) {\n const remotePath = toRemotePath(path);\n return (await raw.fs.listFiles(remotePath)).map((entry) => ({\n name: entry.name,\n path: toVirtualPath(entry.path ?? `${remotePath.replace(/\\/$/, \"\")}/${entry.name}`),\n type: entry.isDir ? (\"directory\" as const) : (\"file\" as const),\n size: entry.size,\n }));\n },\n async mkdir(path) {\n await raw.fs.createFolder(toRemotePath(path), \"755\");\n },\n async remove(path) {\n await raw.fs.deleteFile(toRemotePath(path), true);\n },\n async exists(path) {\n try {\n await raw.fs.getFileDetails(toRemotePath(path));\n return true;\n } catch (error) {\n if (isDaytonaNotFound(error, \"files.exists\")) return false;\n throw error;\n }\n },\n },\n async run(command, runOptions) {\n try {\n const started = performance.now();\n const result = await raw.process.executeCommand(\n commandString(command),\n toRemotePath(runOptions.cwd!),\n { ...runOptions.env },\n runOptions.timeout ? Math.ceil(runOptions.timeout / 1_000) : undefined,\n );\n return {\n stdout: result.result,\n stderr: \"\",\n exitCode: result.exitCode,\n success: result.exitCode === 0,\n durationMs: Math.round(performance.now() - started),\n };\n } catch (error) {\n throw normalizeError(\"daytona\", \"process.run\", error);\n }\n },\n async start(command, runOptions) {\n const sessionId = `sandbox-sdk-${randomUUID()}`;\n await raw.process.createSession(sessionId);\n const response = await raw.process.executeSessionCommand(\n sessionId,\n {\n command: sessionCommand(\n commandString(command),\n toRemotePath(runOptions.cwd!),\n runOptions.env,\n ),\n runAsync: true,\n suppressInputEcho: true,\n },\n runOptions.timeout ? Math.ceil(runOptions.timeout / 1_000) : undefined,\n );\n const commandId = response.cmdId;\n const events: ProcessOutputEvent[] = [];\n const waiters = new Set<() => void>();\n let running = true;\n let killed = false;\n let exitCode = 1;\n let resolveKilled!: () => void;\n const killedPromise = new Promise<void>((resolve) => {\n resolveKilled = resolve;\n });\n const push = (stream: \"stdout\" | \"stderr\", data: string) => {\n events.push({ stream, data, timestamp: new Date() });\n for (const wake of waiters) wake();\n waiters.clear();\n };\n const completed = raw.process\n .getSessionCommandLogs(\n sessionId,\n commandId,\n (data) => push(\"stdout\", data),\n (data) => push(\"stderr\", data),\n )\n .then(async () => {\n const info = await raw.process.getSessionCommand(sessionId, commandId);\n exitCode = info.exitCode ?? 1;\n })\n .catch((error) => {\n if (!killed) throw error;\n })\n .finally(() => {\n running = false;\n for (const wake of waiters) wake();\n waiters.clear();\n });\n const process: SandboxProcess = {\n id: commandId,\n async status() {\n if (killed) return \"killed\";\n if (!running) return \"exited\";\n const commandInfo = await raw.process.getSessionCommand(sessionId, commandId);\n return commandInfo.exitCode == null ? \"running\" : \"exited\";\n },\n async *output() {\n let index = 0;\n while (running || index < events.length) {\n while (index < events.length) yield events[index++]!;\n if (!running) break;\n await new Promise<void>((resolve) => waiters.add(resolve));\n }\n },\n write: (value) =>\n raw.process.sendSessionCommandInput(\n sessionId,\n commandId,\n typeof value === \"string\" ? value : new TextDecoder().decode(value),\n ),\n async wait() {\n await Promise.race([completed, killedPromise]);\n return { exitCode };\n },\n async kill() {\n killed = true;\n try {\n await raw.process.deleteSession(sessionId);\n } catch (error) {\n killed = false;\n throw error;\n }\n exitCode = 137;\n running = false;\n resolveKilled();\n for (const wake of waiters) wake();\n waiters.clear();\n },\n };\n return process;\n },\n async expose(port) {\n const preview = await raw.getPreviewLink(port);\n return portResult(port, preview.url, raw.public, !raw.public, (path = \"/\", init = {}) =>\n fetch(new URL(path, preview.url), {\n ...init,\n headers: {\n ...Object.fromEntries(new Headers(init.headers)),\n ...(preview.token ? { \"x-daytona-preview-token\": preview.token } : {}),\n },\n }),\n );\n },\n snapshots: unsupportedSnapshots(\"daytona\"),\n async stop() {\n await client.delete(raw);\n },\n };\n },\n },\n [],\n {\n stop: (sandbox) => sandbox.raw.stop(),\n resume: (sandbox) => sandbox.raw.start(),\n destroy: (sandbox) => sandbox.raw.delete(),\n },\n );\n}\n\nexport type { DaytonaSandbox };\n\nfunction isDaytonaNotFound(error: unknown, operation: string): boolean {\n if (\n typeof error === \"object\" &&\n error !== null &&\n \"statusCode\" in error &&\n error.statusCode === 404\n ) {\n return true;\n }\n return normalizeError(\"daytona\", operation, error).code === \"not_found\";\n}\n\nfunction replacePathPrefix(path: string, from: string, to: string): string {\n if (path === from) return to;\n const prefix = `${from.replace(/\\/$/, \"\")}/`;\n return path.startsWith(prefix) ? `${to.replace(/\\/$/, \"\")}/${path.slice(prefix.length)}` : path;\n}\n\nfunction sessionCommand(\n command: string,\n cwd: string,\n env: Readonly<Record<string, string>> | undefined,\n): string {\n const assignments = Object.entries(env ?? {}).map(([key, value]) =>\n shellQuote(`${key}=${value}`),\n );\n return `cd ${shellQuote(cwd)} && ${assignments.length ? `env ${assignments.join(\" \")} ` : \"\"}${command}`;\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", `'\"'\"'`)}'`;\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,QAAQ,UAA0B,EAAE,EAAmC;AACrF,QAAO,oBACL;EACE,IAAI;EACJ,cAAc;EACd,MAAM,OAAO,eAAe;GAC1B,MAAM,SAAS,IAAI,QAAQ;IACzB,QAAQ,QAAQ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G7F,SAAS,eACP,SACA,KACA,KACQ;CACR,MAAM,cAAc,OAAO,QAAQ,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,WACvD,WAAW,GAAG,IAAI,GAAG,QAAQ,CAC9B;AACD,QAAO,MAAM,WAAW,IAAI,CAAC,MAAM,YAAY,SAAS,OAAO,YAAY,KAAK,IAAI,CAAC,KAAK,KAAK;;AAGjG,SAAS,WAAW,OAAuB;AACzC,QAAO,IAAI,MAAM,WAAW,KAAK,QAAQ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import "../../types-BTagTtsp.mjs";
2
+ import { o as SandboxProvider } from "../../provider-_caCV8kk.mjs";
3
+ import "../../index-BMFkO6Fv.mjs";
4
+ import "../../sandbox-BUYT-1C9.mjs";
5
+ import { r as e2bCapabilities } from "../../capabilities-CMnszzpt.mjs";
6
+ import { Sandbox as E2BSandbox } from "e2b";
7
+
8
+ //#region src/providers/e2b/index.d.ts
9
+ interface E2BOptions {
10
+ apiKey?: string;
11
+ template?: string;
12
+ timeout?: number;
13
+ }
14
+ declare function e2b(options?: E2BOptions): SandboxProvider<E2BSandbox>;
15
+ //#endregion
16
+ export { E2BOptions, type E2BSandbox, e2b, e2bCapabilities };
17
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,168 @@
1
+ import { r as normalizeError } from "../../errors-Ch9PHKTd.mjs";
2
+ import "../../capabilities-COKpwoFH.mjs";
3
+ import "../../sandbox-BwyHcB_C.mjs";
4
+ import { r as e2bCapabilities } from "../../capabilities-CEowrzRM.mjs";
5
+ import { i as unsupported, n as portResult, o as withManagedSessions, r as toUint8Array, t as commandString } from "../../provider-utils-DilOYLBO.mjs";
6
+ import { Sandbox } from "e2b";
7
+
8
+ //#region src/providers/e2b/index.ts
9
+ function e2b(options = {}) {
10
+ return withManagedSessions({
11
+ id: "e2b",
12
+ capabilities: e2bCapabilities,
13
+ async create(createOptions) {
14
+ const create = {
15
+ apiKey: options.apiKey,
16
+ timeoutMs: options.timeout ?? createOptions.timeout,
17
+ envs: { ...createOptions.env },
18
+ signal: createOptions.signal
19
+ };
20
+ const raw = options.template ? await Sandbox.create(options.template, create) : await Sandbox.create(create);
21
+ try {
22
+ await raw.files.makeDir(createOptions.cwd);
23
+ } catch (error) {
24
+ await raw.kill().catch(() => void 0);
25
+ throw error;
26
+ }
27
+ return {
28
+ id: raw.sandboxId,
29
+ raw,
30
+ capabilities: e2bCapabilities,
31
+ files: {
32
+ async write(path, value) {
33
+ await raw.files.write(path, Uint8Array.from(await toUint8Array(value)).buffer);
34
+ },
35
+ read: (path) => raw.files.read(path, { format: "bytes" }),
36
+ async list(path) {
37
+ return (await raw.files.list(path)).map((entry) => ({
38
+ name: entry.name,
39
+ path: entry.path,
40
+ type: entry.type === "file" ? "file" : entry.type === "dir" ? "directory" : "unknown",
41
+ size: entry.size
42
+ }));
43
+ },
44
+ async mkdir(path) {
45
+ await raw.files.makeDir(path);
46
+ },
47
+ remove: (path) => raw.files.remove(path),
48
+ exists: (path) => raw.files.exists(path)
49
+ },
50
+ async run(command, runOptions) {
51
+ try {
52
+ const started = performance.now();
53
+ const result = await raw.commands.run(commandString(command), {
54
+ cwd: runOptions.cwd,
55
+ envs: { ...runOptions.env },
56
+ timeoutMs: runOptions.timeout,
57
+ signal: runOptions.signal
58
+ });
59
+ return {
60
+ stdout: result.stdout,
61
+ stderr: result.stderr,
62
+ exitCode: result.exitCode,
63
+ success: result.exitCode === 0,
64
+ durationMs: Math.round(performance.now() - started)
65
+ };
66
+ } catch (error) {
67
+ throw normalizeError("e2b", "process.run", error);
68
+ }
69
+ },
70
+ async start(command, runOptions) {
71
+ const events = [];
72
+ const waiters = /* @__PURE__ */ new Set();
73
+ let running = true;
74
+ const push = (stream, data) => {
75
+ events.push({
76
+ stream,
77
+ data,
78
+ timestamp: /* @__PURE__ */ new Date()
79
+ });
80
+ for (const wake of waiters) wake();
81
+ waiters.clear();
82
+ };
83
+ const handle = await raw.commands.run(commandString(command), {
84
+ cwd: runOptions.cwd,
85
+ envs: { ...runOptions.env },
86
+ timeoutMs: runOptions.timeout,
87
+ signal: runOptions.signal,
88
+ background: true,
89
+ stdin: true,
90
+ onStdout: (data) => push("stdout", data),
91
+ onStderr: (data) => push("stderr", data)
92
+ });
93
+ const completed = handle.wait().then((result) => ({ exitCode: result.exitCode }));
94
+ const finish = () => {
95
+ running = false;
96
+ for (const wake of waiters) wake();
97
+ waiters.clear();
98
+ };
99
+ completed.then(finish, finish);
100
+ return {
101
+ id: String(handle.pid),
102
+ async status() {
103
+ return running ? "running" : "exited";
104
+ },
105
+ async *output() {
106
+ let index = 0;
107
+ while (running || index < events.length) {
108
+ while (index < events.length) yield events[index++];
109
+ if (!running) break;
110
+ await new Promise((resolve) => waiters.add(resolve));
111
+ }
112
+ },
113
+ write: (value) => handle.sendStdin(value),
114
+ wait: () => completed,
115
+ async kill() {
116
+ await handle.kill();
117
+ running = false;
118
+ }
119
+ };
120
+ },
121
+ async expose(port) {
122
+ const url = `https://${raw.getHost(port)}`;
123
+ const token = raw.trafficAccessToken;
124
+ return portResult(port, url, !token, Boolean(token), token ? (path = "/", init = {}) => fetch(new URL(path, url), {
125
+ ...init,
126
+ headers: {
127
+ ...Object.fromEntries(new Headers(init.headers)),
128
+ "x-access-token": token
129
+ }
130
+ }) : void 0);
131
+ },
132
+ snapshots: {
133
+ async create(snapshotOptions) {
134
+ const snapshot = await raw.createSnapshot({ name: snapshotOptions?.name });
135
+ return {
136
+ id: snapshot.snapshotId,
137
+ name: snapshot.names[0],
138
+ mode: "template"
139
+ };
140
+ },
141
+ async delete(snapshot) {
142
+ await Sandbox.deleteSnapshot(typeof snapshot === "string" ? snapshot : snapshot.id, { apiKey: options.apiKey });
143
+ },
144
+ async restore() {
145
+ unsupported("e2b", "snapshot.restore");
146
+ }
147
+ },
148
+ async stop() {
149
+ await raw.kill();
150
+ }
151
+ };
152
+ }
153
+ }, [], {
154
+ stop: async (sandbox) => {
155
+ await sandbox.raw.pause();
156
+ },
157
+ resume: async (sandbox) => {
158
+ await sandbox.raw.connect();
159
+ },
160
+ destroy: async (sandbox) => {
161
+ await sandbox.raw.kill();
162
+ }
163
+ });
164
+ }
165
+
166
+ //#endregion
167
+ export { e2b, e2bCapabilities };
168
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["E2BSandbox","events: ProcessOutputEvent[]"],"sources":["../../../src/providers/e2b/index.ts"],"sourcesContent":["import { Sandbox as E2BSandbox } from \"e2b\";\nimport { normalizeError } from \"../../core/errors\";\nimport type { SandboxProvider } from \"../../core/provider\";\nimport type { ProcessOutputEvent, SandboxProcess, SandboxSnapshot } from \"../../core/types\";\nimport {\n commandString,\n portResult,\n toUint8Array,\n unsupported,\n} from \"../../internal/provider-utils\";\nimport { e2bCapabilities } from \"../capabilities\";\nimport { withManagedSessions } from \"../../internal/managed-provider\";\n\nexport interface E2BOptions {\n apiKey?: string;\n template?: string;\n timeout?: number;\n}\n\nexport { e2bCapabilities } from \"../capabilities\";\n\nexport function e2b(options: E2BOptions = {}): SandboxProvider<E2BSandbox> {\n return withManagedSessions(\n {\n id: \"e2b\",\n capabilities: e2bCapabilities,\n async create(createOptions) {\n const create = {\n apiKey: options.apiKey,\n timeoutMs: options.timeout ?? createOptions.timeout,\n envs: { ...createOptions.env },\n signal: createOptions.signal,\n };\n const raw = options.template\n ? await E2BSandbox.create(options.template, create)\n : await E2BSandbox.create(create);\n try {\n await raw.files.makeDir(createOptions.cwd);\n } catch (error) {\n await raw.kill().catch(() => undefined);\n throw error;\n }\n return {\n id: raw.sandboxId,\n raw,\n capabilities: e2bCapabilities,\n files: {\n async write(path, value) {\n await raw.files.write(path, Uint8Array.from(await toUint8Array(value)).buffer);\n },\n read: (path) => raw.files.read(path, { format: \"bytes\" }),\n async list(path) {\n return (await raw.files.list(path)).map((entry) => ({\n name: entry.name,\n path: entry.path,\n type:\n entry.type === \"file\"\n ? (\"file\" as const)\n : entry.type === \"dir\"\n ? (\"directory\" as const)\n : (\"unknown\" as const),\n size: entry.size,\n }));\n },\n async mkdir(path) {\n await raw.files.makeDir(path);\n },\n remove: (path) => raw.files.remove(path),\n exists: (path) => raw.files.exists(path),\n },\n async run(command, runOptions) {\n try {\n const started = performance.now();\n const result = await raw.commands.run(commandString(command), {\n cwd: runOptions.cwd,\n envs: { ...runOptions.env },\n timeoutMs: runOptions.timeout,\n signal: runOptions.signal,\n });\n return {\n stdout: result.stdout,\n stderr: result.stderr,\n exitCode: result.exitCode,\n success: result.exitCode === 0,\n durationMs: Math.round(performance.now() - started),\n };\n } catch (error) {\n throw normalizeError(\"e2b\", \"process.run\", error);\n }\n },\n async start(command, runOptions) {\n const events: ProcessOutputEvent[] = [];\n const waiters = new Set<() => void>();\n let running = true;\n const push = (stream: \"stdout\" | \"stderr\", data: string) => {\n events.push({ stream, data, timestamp: new Date() });\n for (const wake of waiters) wake();\n waiters.clear();\n };\n const handle = await raw.commands.run(commandString(command), {\n cwd: runOptions.cwd,\n envs: { ...runOptions.env },\n timeoutMs: runOptions.timeout,\n signal: runOptions.signal,\n background: true,\n stdin: true,\n onStdout: (data) => push(\"stdout\", data),\n onStderr: (data) => push(\"stderr\", data),\n });\n const completed = handle.wait().then((result) => ({ exitCode: result.exitCode }));\n const finish = () => {\n running = false;\n for (const wake of waiters) wake();\n waiters.clear();\n };\n void completed.then(finish, finish);\n const process: SandboxProcess = {\n id: String(handle.pid),\n async status() {\n return running ? \"running\" : \"exited\";\n },\n async *output() {\n let index = 0;\n while (running || index < events.length) {\n while (index < events.length) yield events[index++]!;\n if (!running) break;\n await new Promise<void>((resolve) => waiters.add(resolve));\n }\n },\n write: (value) => handle.sendStdin(value),\n wait: () => completed,\n async kill() {\n await handle.kill();\n running = false;\n },\n };\n return process;\n },\n async expose(port) {\n const host = raw.getHost(port);\n const url = `https://${host}`;\n const token = raw.trafficAccessToken;\n return portResult(\n port,\n url,\n !token,\n Boolean(token),\n token\n ? (path = \"/\", init = {}) =>\n fetch(new URL(path, url), {\n ...init,\n headers: {\n ...Object.fromEntries(new Headers(init.headers)),\n \"x-access-token\": token,\n },\n })\n : undefined,\n );\n },\n snapshots: {\n async create(snapshotOptions) {\n const snapshot = await raw.createSnapshot({ name: snapshotOptions?.name });\n return {\n id: snapshot.snapshotId,\n name: snapshot.names[0],\n mode: \"template\",\n } as SandboxSnapshot;\n },\n async delete(snapshot) {\n await E2BSandbox.deleteSnapshot(\n typeof snapshot === \"string\" ? snapshot : snapshot.id,\n {\n apiKey: options.apiKey,\n },\n );\n },\n async restore() {\n unsupported(\"e2b\", \"snapshot.restore\");\n },\n },\n async stop() {\n await raw.kill();\n },\n };\n },\n },\n [],\n {\n stop: async (sandbox) => {\n await sandbox.raw.pause();\n },\n resume: async (sandbox) => {\n await sandbox.raw.connect();\n },\n destroy: async (sandbox) => {\n await sandbox.raw.kill();\n },\n },\n );\n}\n\nexport type { E2BSandbox };\n"],"mappings":";;;;;;;;AAqBA,SAAgB,IAAI,UAAsB,EAAE,EAA+B;AACzE,QAAO,oBACL;EACE,IAAI;EACJ,cAAc;EACd,MAAM,OAAO,eAAe;GAC1B,MAAM,SAAS;IACb,QAAQ,QAAQ;IAChB,WAAW,QAAQ,WAAW,cAAc;IAC5C,MAAM,EAAE,GAAG,cAAc,KAAK;IAC9B,QAAQ,cAAc;IACvB;GACD,MAAM,MAAM,QAAQ,WAChB,MAAMA,QAAW,OAAO,QAAQ,UAAU,OAAO,GACjD,MAAMA,QAAW,OAAO,OAAO;AACnC,OAAI;AACF,UAAM,IAAI,MAAM,QAAQ,cAAc,IAAI;YACnC,OAAO;AACd,UAAM,IAAI,MAAM,CAAC,YAAY,OAAU;AACvC,UAAM;;AAER,UAAO;IACL,IAAI,IAAI;IACR;IACA,cAAc;IACd,OAAO;KACL,MAAM,MAAM,MAAM,OAAO;AACvB,YAAM,IAAI,MAAM,MAAM,MAAM,WAAW,KAAK,MAAM,aAAa,MAAM,CAAC,CAAC,OAAO;;KAEhF,OAAO,SAAS,I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AAM,SAAS,MAAM;OACrB,MAAM;OACP;;KAEH,MAAM,OAAO,UAAU;AACrB,YAAMD,QAAW,eACf,OAAO,aAAa,WAAW,WAAW,SAAS,IACnD,EACE,QAAQ,QAAQ,QACjB,CACF;;KAEH,MAAM,UAAU;AACd,kBAAY,OAAO,mBAAmB;;KAEzC;IACD,MAAM,OAAO;AACX,WAAM,IAAI,MAAM;;IAEnB;;EAEJ,EACD,EAAE,EACF;EACE,MAAM,OAAO,YAAY;AACvB,SAAM,QAAQ,IAAI,OAAO;;EAE3B,QAAQ,OAAO,YAAY;AACzB,SAAM,QAAQ,IAAI,SAAS;;EAE7B,SAAS,OAAO,YAAY;AAC1B,SAAM,QAAQ,IAAI,MAAM;;EAE3B,CACF"}
@@ -0,0 +1,22 @@
1
+ import "../../types-BTagTtsp.mjs";
2
+ import { o as SandboxProvider } from "../../provider-_caCV8kk.mjs";
3
+ import "../../index-BMFkO6Fv.mjs";
4
+ import "../../sandbox-BUYT-1C9.mjs";
5
+ import { i as localCapabilities } from "../../capabilities-CMnszzpt.mjs";
6
+ import { n as AgentOsSandbox, t as AgentOsProviderOptions } from "../../index-B1YT6OQ8.mjs";
7
+
8
+ //#region src/providers/local/index.d.ts
9
+ /** Options passed to the AgentOS VM that powers the Local provider. */
10
+ interface LocalOptions extends AgentOsProviderOptions {}
11
+ /** Native AgentOS access for a Local sandbox. */
12
+ type LocalSandbox = AgentOsSandbox;
13
+ /**
14
+ * Runs an isolated AgentOS VM inside the current Node.js process.
15
+ *
16
+ * AgentOS is an implementation detail of the Local provider. Outbound networking and host bindings
17
+ * are denied by default; pass native options under `agentOs` to configure the VM explicitly.
18
+ */
19
+ declare function local(options?: LocalOptions): SandboxProvider<LocalSandbox>;
20
+ //#endregion
21
+ export { LocalOptions, LocalSandbox, local, localCapabilities };
22
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,21 @@
1
+ import "../../errors-Ch9PHKTd.mjs";
2
+ import "../../capabilities-COKpwoFH.mjs";
3
+ import "../../sandbox-BwyHcB_C.mjs";
4
+ import { i as localCapabilities } from "../../capabilities-CEowrzRM.mjs";
5
+ import "../../provider-utils-DilOYLBO.mjs";
6
+ import { t as agentos } from "../../agentos-BOFA_q-a.mjs";
7
+
8
+ //#region src/providers/local/index.ts
9
+ /**
10
+ * Runs an isolated AgentOS VM inside the current Node.js process.
11
+ *
12
+ * AgentOS is an implementation detail of the Local provider. Outbound networking and host bindings
13
+ * are denied by default; pass native options under `agentOs` to configure the VM explicitly.
14
+ */
15
+ function local(options = {}) {
16
+ return agentos(options);
17
+ }
18
+
19
+ //#endregion
20
+ export { local, localCapabilities };
21
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["createAgentOsRuntime"],"sources":["../../../src/providers/local/index.ts"],"sourcesContent":["import type { SandboxProvider } from \"../../core/provider\";\nimport {\n agentos as createAgentOsRuntime,\n type AgentOsProviderOptions,\n type AgentOsSandbox,\n} from \"../agentos\";\n\n/** Options passed to the AgentOS VM that powers the Local provider. */\nexport interface LocalOptions extends AgentOsProviderOptions {}\n\n/** Native AgentOS access for a Local sandbox. */\nexport type LocalSandbox = AgentOsSandbox;\n\nexport { localCapabilities } from \"../capabilities\";\n\n/**\n * Runs an isolated AgentOS VM inside the current Node.js process.\n *\n * AgentOS is an implementation detail of the Local provider. Outbound networking and host bindings\n * are denied by default; pass native options under `agentOs` to configure the VM explicitly.\n */\nexport function local(options: LocalOptions = {}): SandboxProvider<LocalSandbox> {\n return createAgentOsRuntime(options);\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,MAAM,UAAwB,EAAE,EAAiC;AAC/E,QAAOA,QAAqB,QAAQ"}
@@ -0,0 +1,17 @@
1
+ import "../../types-BTagTtsp.mjs";
2
+ import { o as SandboxProvider } from "../../provider-_caCV8kk.mjs";
3
+ import "../../index-BMFkO6Fv.mjs";
4
+ import "../../sandbox-BUYT-1C9.mjs";
5
+ import { a as upstashCapabilities } from "../../capabilities-CMnszzpt.mjs";
6
+ import { Box, BoxConfig } from "@upstash/box";
7
+
8
+ //#region src/providers/upstash/index.d.ts
9
+ type UpstashOptions = Omit<BoxConfig, "env"> & {
10
+ /** Expose ports publicly. Set to false to return bearer-token URLs. */
11
+ public?: boolean;
12
+ };
13
+ declare function upstash(options?: UpstashOptions): SandboxProvider<Box>;
14
+ type UpstashBox = Box;
15
+ //#endregion
16
+ export { UpstashBox, UpstashOptions, upstash, upstashCapabilities };
17
+ //# sourceMappingURL=index.d.mts.map