@langchain/modal 0.0.1

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/dist/index.js ADDED
@@ -0,0 +1,633 @@
1
+ import { ModalClient } from "modal";
2
+ import { BaseSandbox } from "deepagents";
3
+
4
+ //#region src/auth.ts
5
+ /**
6
+ * Get authentication credentials for Modal API.
7
+ *
8
+ * Credentials are resolved in the following priority order:
9
+ *
10
+ * 1. **Explicit options**: If `options.tokenId` and/or `options.tokenSecret` are provided,
11
+ * they are used directly.
12
+ * 2. **Environment variables**: `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET` are used as fallbacks.
13
+ *
14
+ * ## Environment Variable Setup
15
+ *
16
+ * ```bash
17
+ * # Go to https://modal.com/settings/tokens
18
+ * # Create a new token and set the environment variables
19
+ * export MODAL_TOKEN_ID=your_token_id
20
+ * export MODAL_TOKEN_SECRET=your_token_secret
21
+ * ```
22
+ *
23
+ * @param options - Optional authentication configuration from ModalSandboxOptions
24
+ * @returns Complete authentication credentials
25
+ * @throws {Error} If any credentials are missing
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * // With explicit credentials
30
+ * const creds = getAuthCredentials({ tokenId: "...", tokenSecret: "..." });
31
+ *
32
+ * // Using environment variables (auto-detected)
33
+ * const creds = getAuthCredentials();
34
+ *
35
+ * // From ModalSandboxOptions
36
+ * const options: ModalSandboxOptions = {
37
+ * auth: { tokenId: "...", tokenSecret: "..." }
38
+ * };
39
+ * const creds = getAuthCredentials(options.auth);
40
+ * ```
41
+ */
42
+ function getAuthCredentials(options) {
43
+ const tokenId = options?.tokenId || process.env.MODAL_TOKEN_ID;
44
+ const tokenSecret = options?.tokenSecret || process.env.MODAL_TOKEN_SECRET;
45
+ const missingTokenId = !tokenId;
46
+ const missingTokenSecret = !tokenSecret;
47
+ if (missingTokenId || missingTokenSecret) {
48
+ const missing = [];
49
+ if (missingTokenId) missing.push("MODAL_TOKEN_ID");
50
+ if (missingTokenSecret) missing.push("MODAL_TOKEN_SECRET");
51
+ throw new Error(`Modal authentication required. Missing: ${missing.join(", ")}.\n\nProvide credentials using one of these methods:
52
+
53
+ 1. Set environment variables:
54
+ Go to https://modal.com/settings/tokens
55
+ Create a new token and run:
56
+ export MODAL_TOKEN_ID=your_token_id
57
+ export MODAL_TOKEN_SECRET=your_token_secret
58
+
59
+ 2. Pass credentials directly in options:
60
+ new ModalSandbox({ auth: { tokenId: '...', tokenSecret: '...' } })`);
61
+ }
62
+ return {
63
+ tokenId,
64
+ tokenSecret
65
+ };
66
+ }
67
+
68
+ //#endregion
69
+ //#region src/types.ts
70
+ const MODAL_SANDBOX_ERROR_SYMBOL = Symbol.for("modal.sandbox.error");
71
+ /**
72
+ * Custom error class for Modal Sandbox operations.
73
+ *
74
+ * Provides structured error information including:
75
+ * - Human-readable message
76
+ * - Error code for programmatic handling
77
+ * - Original cause for debugging
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * try {
82
+ * await sandbox.execute("some command");
83
+ * } catch (error) {
84
+ * if (error instanceof ModalSandboxError) {
85
+ * switch (error.code) {
86
+ * case "NOT_INITIALIZED":
87
+ * await sandbox.initialize();
88
+ * break;
89
+ * case "COMMAND_TIMEOUT":
90
+ * console.error("Command took too long");
91
+ * break;
92
+ * default:
93
+ * throw error;
94
+ * }
95
+ * }
96
+ * }
97
+ * ```
98
+ */
99
+ var ModalSandboxError = class ModalSandboxError extends Error {
100
+ [MODAL_SANDBOX_ERROR_SYMBOL];
101
+ /** Error name for instanceof checks and logging */
102
+ name = "ModalSandboxError";
103
+ /**
104
+ * Creates a new ModalSandboxError.
105
+ *
106
+ * @param message - Human-readable error description
107
+ * @param code - Structured error code for programmatic handling
108
+ * @param cause - Original error that caused this error (for debugging)
109
+ */
110
+ constructor(message, code, cause) {
111
+ super(message);
112
+ this.code = code;
113
+ this.cause = cause;
114
+ Object.setPrototypeOf(this, ModalSandboxError.prototype);
115
+ }
116
+ /**
117
+ * Checks if the error is an instance of ModalSandboxError.
118
+ *
119
+ * @param error - The error to check
120
+ * @returns True if the error is an instance of ModalSandboxError, false otherwise
121
+ */
122
+ static isInstance(error) {
123
+ return typeof error === "object" && error !== null && error[MODAL_SANDBOX_ERROR_SYMBOL] === true;
124
+ }
125
+ };
126
+
127
+ //#endregion
128
+ //#region src/sandbox.ts
129
+ /**
130
+ * Modal Sandbox implementation of the SandboxBackendProtocol.
131
+ *
132
+ * This module provides a Modal Sandbox backend for deepagents, enabling agents
133
+ * to execute commands, read/write files, and manage isolated container
134
+ * environments using Modal's serverless infrastructure.
135
+ *
136
+ * @packageDocumentation
137
+ */
138
+ /**
139
+ * Modal Sandbox backend for deepagents.
140
+ *
141
+ * Extends `BaseSandbox` to provide command execution, file operations, and
142
+ * sandbox lifecycle management using Modal's serverless infrastructure.
143
+ *
144
+ * ## Basic Usage
145
+ *
146
+ * ```typescript
147
+ * import { ModalSandbox } from "@langchain/modal";
148
+ *
149
+ * // Create and initialize a sandbox
150
+ * const sandbox = await ModalSandbox.create({
151
+ * imageName: "python:3.12-slim",
152
+ * timeout: 600,
153
+ * });
154
+ *
155
+ * try {
156
+ * // Execute commands
157
+ * const result = await sandbox.execute("python --version");
158
+ * console.log(result.output);
159
+ * } finally {
160
+ * // Always cleanup
161
+ * await sandbox.close();
162
+ * }
163
+ * ```
164
+ *
165
+ * ## Using with DeepAgent
166
+ *
167
+ * ```typescript
168
+ * import { createDeepAgent } from "deepagents";
169
+ * import { ModalSandbox } from "@langchain/modal";
170
+ *
171
+ * const sandbox = await ModalSandbox.create();
172
+ *
173
+ * const agent = createDeepAgent({
174
+ * model: new ChatAnthropic({ model: "claude-sonnet-4-20250514" }),
175
+ * systemPrompt: "You are a coding assistant with sandbox access.",
176
+ * backend: sandbox,
177
+ * });
178
+ * ```
179
+ */
180
+ var ModalSandbox = class ModalSandbox extends BaseSandbox {
181
+ /** Private reference to the Modal client */
182
+ #client = null;
183
+ /** Private reference to the Modal App */
184
+ #app = null;
185
+ /** Private reference to the underlying Modal Sandbox instance */
186
+ #sandbox = null;
187
+ /** Configuration options for this sandbox */
188
+ #options;
189
+ /** Unique identifier for this sandbox instance */
190
+ #id;
191
+ /**
192
+ * Get the unique identifier for this sandbox.
193
+ *
194
+ * Before initialization, returns a temporary ID.
195
+ * After initialization, returns the actual Modal sandbox ID.
196
+ */
197
+ get id() {
198
+ return this.#id;
199
+ }
200
+ /**
201
+ * Get the underlying Modal Sandbox instance.
202
+ *
203
+ * @throws {ModalSandboxError} If the sandbox is not initialized
204
+ *
205
+ * @example
206
+ * ```typescript
207
+ * const sandbox = await ModalSandbox.create();
208
+ * const modalInstance = sandbox.instance; // Access the raw Modal Sandbox
209
+ * ```
210
+ */
211
+ get instance() {
212
+ if (!this.#sandbox) throw new ModalSandboxError("Sandbox not initialized. Call initialize() or use ModalSandbox.create()", "NOT_INITIALIZED");
213
+ return this.#sandbox;
214
+ }
215
+ /**
216
+ * Get the underlying Modal client instance.
217
+ *
218
+ * @throws {ModalSandboxError} If the sandbox is not initialized
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * const sandbox = await ModalSandbox.create();
223
+ * const modalClient = sandbox.client; // Access the raw Modal client
224
+ * ```
225
+ */
226
+ get client() {
227
+ if (!this.#client) throw new ModalSandboxError("Sandbox not initialized. Call initialize() or use ModalSandbox.create()", "NOT_INITIALIZED");
228
+ return this.#client;
229
+ }
230
+ /**
231
+ * Check if the sandbox is initialized and running.
232
+ */
233
+ get isRunning() {
234
+ return this.#sandbox !== null;
235
+ }
236
+ /**
237
+ * Create a new ModalSandbox instance.
238
+ *
239
+ * Note: This only creates the instance. Call `initialize()` to actually
240
+ * create the Modal Sandbox, or use the static `ModalSandbox.create()` method.
241
+ *
242
+ * @param options - Configuration options for the sandbox
243
+ *
244
+ * @example
245
+ * ```typescript
246
+ * // Two-step initialization
247
+ * const sandbox = new ModalSandbox({ imageName: "python:3.12-slim" });
248
+ * await sandbox.initialize();
249
+ *
250
+ * // Or use the factory method
251
+ * const sandbox = await ModalSandbox.create({ imageName: "python:3.12-slim" });
252
+ * ```
253
+ */
254
+ constructor(options = {}) {
255
+ super();
256
+ this.#options = {
257
+ appName: "deepagents-sandbox",
258
+ imageName: "alpine:3.21",
259
+ ...options
260
+ };
261
+ this.#id = `modal-sandbox-${Date.now()}`;
262
+ }
263
+ /**
264
+ * Initialize the sandbox by creating a new Modal Sandbox instance.
265
+ *
266
+ * This method authenticates with Modal and provisions a new sandbox container.
267
+ * After initialization, the `id` property will reflect the actual Modal sandbox ID.
268
+ *
269
+ * @throws {ModalSandboxError} If already initialized (`ALREADY_INITIALIZED`)
270
+ * @throws {ModalSandboxError} If authentication fails (`AUTHENTICATION_FAILED`)
271
+ * @throws {ModalSandboxError} If sandbox creation fails (`SANDBOX_CREATION_FAILED`)
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * const sandbox = new ModalSandbox();
276
+ * await sandbox.initialize();
277
+ * console.log(`Sandbox ID: ${sandbox.id}`);
278
+ * ```
279
+ */
280
+ async initialize() {
281
+ if (this.#sandbox) throw new ModalSandboxError("Sandbox is already initialized. Each ModalSandbox instance can only be initialized once.", "ALREADY_INITIALIZED");
282
+ try {
283
+ getAuthCredentials(this.#options.auth);
284
+ } catch (error) {
285
+ throw new ModalSandboxError("Failed to authenticate with Modal. Check your token configuration.", "AUTHENTICATION_FAILED", error instanceof Error ? error : void 0);
286
+ }
287
+ try {
288
+ this.#client = new ModalClient();
289
+ this.#app = await this.#client.apps.fromName(this.#options.appName ?? "deepagents-sandbox", { createIfMissing: true });
290
+ const image = this.#client.images.fromRegistry(this.#options.imageName ?? "alpine:3.21");
291
+ const { appName: _appName, imageName: _imageName, initialFiles: _initialFiles, auth: _auth, volumes: volumeNames, secrets: secretNames, ...sdkOptions } = this.#options;
292
+ const createOptions = { ...sdkOptions };
293
+ if (volumeNames !== void 0) {
294
+ const volumeObjects = {};
295
+ for (const [mountPath, volumeName] of Object.entries(volumeNames)) volumeObjects[mountPath] = await this.#client.volumes.fromName(volumeName, { createIfMissing: false });
296
+ createOptions.volumes = volumeObjects;
297
+ }
298
+ if (secretNames !== void 0 && secretNames.length > 0) {
299
+ const secretObjects = [];
300
+ for (const secretName of secretNames) {
301
+ const secret = await this.#client.secrets.fromName(secretName);
302
+ secretObjects.push(secret);
303
+ }
304
+ createOptions.secrets = secretObjects;
305
+ }
306
+ this.#sandbox = await this.#client.sandboxes.create(this.#app, image, createOptions);
307
+ this.#id = this.#sandbox.sandboxId;
308
+ if (this.#options.initialFiles) await this.#uploadInitialFiles(this.#options.initialFiles);
309
+ } catch (error) {
310
+ if (ModalSandboxError.isInstance(error)) throw error;
311
+ throw new ModalSandboxError(`Failed to create Modal Sandbox: ${error instanceof Error ? error.message : String(error)}`, "SANDBOX_CREATION_FAILED", error instanceof Error ? error : void 0);
312
+ }
313
+ }
314
+ /**
315
+ * Upload initial files to the sandbox during initialization.
316
+ * This is a private helper method used by initialize().
317
+ *
318
+ * @param files - Record of file paths to contents
319
+ */
320
+ async #uploadInitialFiles(files) {
321
+ const encoder = new TextEncoder();
322
+ const filesToUpload = [];
323
+ for (const [filePath, content] of Object.entries(files)) {
324
+ const normalizedPath = filePath.startsWith("/") ? filePath.slice(1) : filePath;
325
+ const data = typeof content === "string" ? encoder.encode(content) : content;
326
+ filesToUpload.push([normalizedPath, data]);
327
+ }
328
+ const errors = (await this.uploadFiles(filesToUpload)).filter((r) => r.error !== null);
329
+ if (errors.length > 0) throw new ModalSandboxError(`Failed to upload initial files: ${errors.map((e) => e.path).join(", ")}`, "FILE_OPERATION_FAILED");
330
+ }
331
+ /**
332
+ * Execute a command in the sandbox.
333
+ *
334
+ * Commands are run using bash -c to execute the command string.
335
+ *
336
+ * @param command - The shell command to execute
337
+ * @returns Execution result with output, exit code, and truncation flag
338
+ * @throws {ModalSandboxError} If the sandbox is not initialized
339
+ *
340
+ * @example
341
+ * ```typescript
342
+ * const result = await sandbox.execute("echo 'Hello World'");
343
+ * console.log(result.output); // "Hello World\n"
344
+ * console.log(result.exitCode); // 0
345
+ * ```
346
+ */
347
+ async execute(command) {
348
+ const sandbox = this.instance;
349
+ try {
350
+ const process = await sandbox.exec([
351
+ "bash",
352
+ "-c",
353
+ command
354
+ ], {
355
+ stdout: "pipe",
356
+ stderr: "pipe"
357
+ });
358
+ const [stdout, stderr] = await Promise.all([process.stdout.readText(), process.stderr.readText()]);
359
+ const exitCode = await process.wait();
360
+ return {
361
+ output: stdout + stderr,
362
+ exitCode: exitCode ?? 0,
363
+ truncated: false
364
+ };
365
+ } catch (error) {
366
+ if (error instanceof Error && error.message.includes("timeout")) throw new ModalSandboxError(`Command timed out: ${command}`, "COMMAND_TIMEOUT", error);
367
+ throw new ModalSandboxError(`Command execution failed: ${error instanceof Error ? error.message : String(error)}`, "COMMAND_FAILED", error instanceof Error ? error : void 0);
368
+ }
369
+ }
370
+ /**
371
+ * Upload files to the sandbox.
372
+ *
373
+ * Files are written to the sandbox filesystem using Modal's file API.
374
+ * Parent directories are created automatically if they don't exist.
375
+ *
376
+ * @param files - Array of [path, content] tuples to upload
377
+ * @returns Upload result for each file, with success or error status
378
+ *
379
+ * @example
380
+ * ```typescript
381
+ * const encoder = new TextEncoder();
382
+ * const results = await sandbox.uploadFiles([
383
+ * ["src/index.js", encoder.encode("console.log('Hello')")],
384
+ * ["package.json", encoder.encode('{"name": "test"}')],
385
+ * ]);
386
+ * ```
387
+ */
388
+ async uploadFiles(files) {
389
+ const sandbox = this.instance;
390
+ const results = [];
391
+ for (const [path, content] of files) try {
392
+ const parentDir = path.substring(0, path.lastIndexOf("/"));
393
+ if (parentDir) await sandbox.exec([
394
+ "mkdir",
395
+ "-p",
396
+ parentDir
397
+ ], {
398
+ stdout: "pipe",
399
+ stderr: "pipe"
400
+ }).then((p) => p.wait());
401
+ const writeHandle = await sandbox.open(path, "w");
402
+ await writeHandle.write(content);
403
+ await writeHandle.close();
404
+ results.push({
405
+ path,
406
+ error: null
407
+ });
408
+ } catch (error) {
409
+ results.push({
410
+ path,
411
+ error: this.#mapError(error)
412
+ });
413
+ }
414
+ return results;
415
+ }
416
+ /**
417
+ * Download files from the sandbox.
418
+ *
419
+ * Each file is read individually using Modal's file API, allowing
420
+ * partial success when some files exist and others don't.
421
+ *
422
+ * @param paths - Array of file paths to download
423
+ * @returns Download result for each file, with content or error
424
+ *
425
+ * @example
426
+ * ```typescript
427
+ * const results = await sandbox.downloadFiles(["src/index.js", "missing.txt"]);
428
+ * for (const result of results) {
429
+ * if (result.content) {
430
+ * console.log(new TextDecoder().decode(result.content));
431
+ * } else {
432
+ * console.error(`Error: ${result.error}`);
433
+ * }
434
+ * }
435
+ * ```
436
+ */
437
+ async downloadFiles(paths) {
438
+ const sandbox = this.instance;
439
+ const results = [];
440
+ for (const path of paths) try {
441
+ const readHandle = await sandbox.open(path, "r");
442
+ const content = await readHandle.read();
443
+ await readHandle.close();
444
+ results.push({
445
+ path,
446
+ content: new Uint8Array(content),
447
+ error: null
448
+ });
449
+ } catch (error) {
450
+ results.push({
451
+ path,
452
+ content: null,
453
+ error: this.#mapError(error)
454
+ });
455
+ }
456
+ return results;
457
+ }
458
+ /**
459
+ * Close the sandbox and release all resources.
460
+ *
461
+ * After closing, the sandbox cannot be used again. This terminates
462
+ * the sandbox container on Modal.
463
+ *
464
+ * @example
465
+ * ```typescript
466
+ * try {
467
+ * await sandbox.execute("npm run build");
468
+ * } finally {
469
+ * await sandbox.close();
470
+ * }
471
+ * ```
472
+ */
473
+ async close() {
474
+ if (this.#sandbox) try {
475
+ await this.#sandbox.terminate();
476
+ } finally {
477
+ this.#sandbox = null;
478
+ this.#app = null;
479
+ this.#client = null;
480
+ }
481
+ }
482
+ /**
483
+ * Terminate the sandbox.
484
+ *
485
+ * Alias for close() for Modal SDK compatibility.
486
+ *
487
+ * @example
488
+ * ```typescript
489
+ * await sandbox.terminate();
490
+ * ```
491
+ */
492
+ async terminate() {
493
+ await this.close();
494
+ }
495
+ /**
496
+ * Alias for close() to maintain compatibility with other sandbox implementations.
497
+ */
498
+ async stop() {
499
+ await this.close();
500
+ }
501
+ /**
502
+ * Poll the sandbox status to check if it has finished running.
503
+ *
504
+ * @returns The exit code if the sandbox has finished, or null if still running
505
+ */
506
+ async poll() {
507
+ if (!this.#sandbox) return null;
508
+ return this.#sandbox.poll();
509
+ }
510
+ /**
511
+ * Wait for the sandbox to finish running.
512
+ *
513
+ * @returns The exit code of the sandbox
514
+ * @throws {ModalSandboxError} If the sandbox is not initialized
515
+ */
516
+ async wait() {
517
+ return this.instance.wait();
518
+ }
519
+ /**
520
+ * Set the sandbox from an existing Modal Sandbox instance.
521
+ * Used internally by the static `fromId()` and `fromName()` methods.
522
+ */
523
+ #setFromExisting(client, existingSandbox, sandboxId) {
524
+ this.#client = client;
525
+ this.#sandbox = existingSandbox;
526
+ this.#id = sandboxId;
527
+ }
528
+ /**
529
+ * Map Modal SDK errors to standardized FileOperationError codes.
530
+ *
531
+ * @param error - The error from the Modal SDK
532
+ * @returns A standardized error code
533
+ */
534
+ #mapError(error) {
535
+ if (error instanceof Error) {
536
+ const msg = error.message.toLowerCase();
537
+ if (msg.includes("not found") || msg.includes("enoent")) return "file_not_found";
538
+ if (msg.includes("permission") || msg.includes("eacces")) return "permission_denied";
539
+ if (msg.includes("directory") || msg.includes("eisdir")) return "is_directory";
540
+ }
541
+ return "invalid_path";
542
+ }
543
+ /**
544
+ * Create and initialize a new ModalSandbox in one step.
545
+ *
546
+ * This is the recommended way to create a sandbox. It combines
547
+ * construction and initialization into a single async operation.
548
+ *
549
+ * @param options - Configuration options for the sandbox
550
+ * @returns An initialized and ready-to-use sandbox
551
+ *
552
+ * @example
553
+ * ```typescript
554
+ * const sandbox = await ModalSandbox.create({
555
+ * imageName: "python:3.12-slim",
556
+ * timeout: 600,
557
+ * memory: 2048,
558
+ * });
559
+ * ```
560
+ */
561
+ static async create(options) {
562
+ const sandbox = new ModalSandbox(options);
563
+ await sandbox.initialize();
564
+ return sandbox;
565
+ }
566
+ /**
567
+ * Reconnect to an existing sandbox by ID.
568
+ *
569
+ * This allows you to resume working with a sandbox that was created
570
+ * earlier and is still running.
571
+ *
572
+ * @param sandboxId - The ID of the sandbox to reconnect to
573
+ * @param options - Optional auth configuration
574
+ * @returns A connected sandbox instance
575
+ *
576
+ * @example
577
+ * ```typescript
578
+ * // Resume a sandbox from a stored ID
579
+ * const sandbox = await ModalSandbox.fromId("sb-abc123");
580
+ * const result = await sandbox.execute("ls -la");
581
+ * ```
582
+ */
583
+ static async fromId(sandboxId, options) {
584
+ try {
585
+ getAuthCredentials(options?.auth);
586
+ } catch (error) {
587
+ throw new ModalSandboxError("Failed to authenticate with Modal. Check your token configuration.", "AUTHENTICATION_FAILED", error instanceof Error ? error : void 0);
588
+ }
589
+ try {
590
+ const client = new ModalClient();
591
+ const existingSandbox = await client.sandboxes.fromId(sandboxId);
592
+ const modalSandbox = new ModalSandbox(options);
593
+ modalSandbox.#setFromExisting(client, existingSandbox, sandboxId);
594
+ return modalSandbox;
595
+ } catch (error) {
596
+ throw new ModalSandboxError(`Sandbox not found: ${sandboxId}`, "SANDBOX_NOT_FOUND", error instanceof Error ? error : void 0);
597
+ }
598
+ }
599
+ /**
600
+ * Get a running sandbox by name from a deployed app.
601
+ *
602
+ * @param appName - The name of the Modal app
603
+ * @param sandboxName - The name of the sandbox
604
+ * @param options - Optional auth configuration
605
+ * @returns A connected sandbox instance
606
+ *
607
+ * @example
608
+ * ```typescript
609
+ * const sandbox = await ModalSandbox.fromName("my-app", "my-sandbox");
610
+ * const result = await sandbox.execute("ls -la");
611
+ * ```
612
+ */
613
+ static async fromName(appName, sandboxName, options) {
614
+ try {
615
+ getAuthCredentials(options?.auth);
616
+ } catch (error) {
617
+ throw new ModalSandboxError("Failed to authenticate with Modal. Check your token configuration.", "AUTHENTICATION_FAILED", error instanceof Error ? error : void 0);
618
+ }
619
+ try {
620
+ const client = new ModalClient();
621
+ const existingSandbox = await client.sandboxes.fromName(appName, sandboxName);
622
+ const modalSandbox = new ModalSandbox(options);
623
+ modalSandbox.#setFromExisting(client, existingSandbox, existingSandbox.sandboxId);
624
+ return modalSandbox;
625
+ } catch (error) {
626
+ throw new ModalSandboxError(`Sandbox not found: ${appName}/${sandboxName}`, "SANDBOX_NOT_FOUND", error instanceof Error ? error : void 0);
627
+ }
628
+ }
629
+ };
630
+
631
+ //#endregion
632
+ export { ModalSandbox, ModalSandboxError, getAuthCredentials };
633
+ //# sourceMappingURL=index.js.map