@cloudflare/sandbox 0.4.18 → 0.5.2

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 (40) hide show
  1. package/.turbo/turbo-build.log +17 -9
  2. package/CHANGELOG.md +64 -0
  3. package/Dockerfile +5 -1
  4. package/LICENSE +176 -0
  5. package/README.md +1 -1
  6. package/dist/dist-gVyG2H2h.js +612 -0
  7. package/dist/dist-gVyG2H2h.js.map +1 -0
  8. package/dist/index.d.ts +94 -1834
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +489 -678
  11. package/dist/index.js.map +1 -1
  12. package/dist/openai/index.d.ts +67 -0
  13. package/dist/openai/index.d.ts.map +1 -0
  14. package/dist/openai/index.js +362 -0
  15. package/dist/openai/index.js.map +1 -0
  16. package/dist/sandbox-B3vJ541e.d.ts +1729 -0
  17. package/dist/sandbox-B3vJ541e.d.ts.map +1 -0
  18. package/package.json +16 -2
  19. package/src/clients/base-client.ts +107 -46
  20. package/src/index.ts +19 -2
  21. package/src/openai/index.ts +465 -0
  22. package/src/request-handler.ts +2 -1
  23. package/src/sandbox.ts +684 -62
  24. package/src/storage-mount/credential-detection.ts +41 -0
  25. package/src/storage-mount/errors.ts +51 -0
  26. package/src/storage-mount/index.ts +17 -0
  27. package/src/storage-mount/provider-detection.ts +93 -0
  28. package/src/storage-mount/types.ts +17 -0
  29. package/src/version.ts +1 -1
  30. package/tests/base-client.test.ts +218 -0
  31. package/tests/get-sandbox.test.ts +24 -1
  32. package/tests/git-client.test.ts +7 -39
  33. package/tests/openai-shell-editor.test.ts +434 -0
  34. package/tests/port-client.test.ts +25 -35
  35. package/tests/process-client.test.ts +73 -107
  36. package/tests/sandbox.test.ts +128 -1
  37. package/tests/storage-mount/credential-detection.test.ts +119 -0
  38. package/tests/storage-mount/provider-detection.test.ts +77 -0
  39. package/tsconfig.json +2 -2
  40. package/tsdown.config.ts +3 -2
package/dist/index.d.ts CHANGED
@@ -1,1843 +1,20 @@
1
- import { Container } from "@cloudflare/containers";
1
+ import { $ as ProcessCleanupResult, A as HttpClientOptions, B as ExecutionSession, C as WriteFileRequest, D as BaseApiResponse, E as ExecuteResponse, F as BucketCredentials, G as ISandbox, H as FileMetadata, I as BucketProvider, J as MountBucketOptions, K as ListFilesOptions, L as ExecEvent, M as ResponseHandler, N as SessionRequest, O as ContainerStub, P as BaseExecOptions, Q as Process, R as ExecOptions, S as ReadFileRequest, T as ExecuteRequest, U as FileStreamEvent, V as FileChunk, W as GitCheckoutResult, X as PortExposeResult, Y as PortCloseResult, Z as PortListResult, _ as GitCheckoutRequest, _t as RunCodeOptions, a as CreateSessionRequest, at as ProcessStartResult, b as FileOperationRequest, c as DeleteSessionResponse, ct as SessionOptions, d as ProcessClient, dt as isProcess, et as ProcessInfoResult, f as ExposePortRequest, ft as isProcessStatus, g as InterpreterClient, gt as ExecutionResult, h as ExecutionCallbacks, ht as Execution, i as CommandsResponse, it as ProcessOptions, j as RequestConfig, k as ErrorResponse, l as PingResponse, lt as StreamOptions, m as UnexposePortRequest, mt as CreateContextOptions, n as getSandbox, nt as ProcessListResult, o as CreateSessionResponse, ot as ProcessStatus, p as PortClient, pt as CodeContext, q as LogEvent, r as SandboxClient, rt as ProcessLogsResult, s as DeleteSessionRequest, st as SandboxOptions, t as Sandbox, tt as ProcessKillResult, u as UtilityClient, ut as isExecResult, v as GitClient, w as CommandClient, x as MkdirRequest, y as FileClient, z as ExecResult } from "./sandbox-B3vJ541e.js";
2
+
3
+ //#region ../shared/dist/request-types.d.ts
2
4
 
3
- //#region ../shared/dist/logger/types.d.ts
4
-
5
- /**
6
- * Logger types for Cloudflare Sandbox SDK
7
- *
8
- * Provides structured, trace-aware logging across Worker, Durable Object, and Container.
9
- */
10
- /**
11
- * Log levels (from most to least verbose)
12
- */
13
- declare enum LogLevel {
14
- DEBUG = 0,
15
- INFO = 1,
16
- WARN = 2,
17
- ERROR = 3,
18
- }
19
- type LogComponent = 'container' | 'sandbox-do' | 'executor';
20
- /**
21
- * Context metadata included in every log entry
22
- */
23
- interface LogContext {
24
- /**
25
- * Unique trace ID for request correlation across distributed components
26
- * Format: "tr_" + 16 hex chars (e.g., "tr_7f3a9b2c4e5d6f1a")
27
- */
28
- traceId: string;
29
- /**
30
- * Component that generated the log
31
- */
32
- component: LogComponent;
33
- /**
34
- * Sandbox identifier (which sandbox instance)
35
- */
36
- sandboxId?: string;
37
- /**
38
- * Session identifier (which session within sandbox)
39
- */
40
- sessionId?: string;
41
- /**
42
- * Process identifier (which background process)
43
- */
44
- processId?: string;
45
- /**
46
- * Command identifier (which command execution)
47
- */
48
- commandId?: string;
49
- /**
50
- * Operation name (e.g., 'exec', 'startProcess', 'writeFile')
51
- */
52
- operation?: string;
53
- /**
54
- * Duration in milliseconds
55
- */
56
- duration?: number;
57
- /**
58
- * Extensible for additional metadata
59
- */
60
- [key: string]: unknown;
61
- }
62
- /**
63
- * Logger interface for structured logging
64
- *
65
- * All methods accept optional context that gets merged with the logger's base context.
66
- */
67
- interface Logger {
68
- /**
69
- * Log debug-level message (most verbose, typically disabled in production)
70
- *
71
- * @param message Human-readable message
72
- * @param context Optional additional context
73
- */
74
- debug(message: string, context?: Partial<LogContext>): void;
75
- /**
76
- * Log info-level message (normal operational events)
77
- *
78
- * @param message Human-readable message
79
- * @param context Optional additional context
80
- */
81
- info(message: string, context?: Partial<LogContext>): void;
82
- /**
83
- * Log warning-level message (recoverable issues, degraded state)
84
- *
85
- * @param message Human-readable message
86
- * @param context Optional additional context
87
- */
88
- warn(message: string, context?: Partial<LogContext>): void;
89
- /**
90
- * Log error-level message (failures, exceptions)
91
- *
92
- * @param message Human-readable message
93
- * @param error Optional Error object to include
94
- * @param context Optional additional context
95
- */
96
- error(message: string, error?: Error, context?: Partial<LogContext>): void;
97
- /**
98
- * Create a child logger with additional context
99
- *
100
- * The child logger inherits all context from the parent and adds new context.
101
- * This is useful for adding operation-specific context without passing through parameters.
102
- *
103
- * @param context Additional context to merge
104
- * @returns New logger instance with merged context
105
- *
106
- * @example
107
- * const logger = createLogger({ component: 'sandbox-do', traceId: 'tr_abc123' });
108
- * const execLogger = logger.child({ operation: 'exec', commandId: 'cmd-456' });
109
- * execLogger.info('Command started'); // Includes all context: component, traceId, operation, commandId
110
- */
111
- child(context: Partial<LogContext>): Logger;
112
- }
113
- //#endregion
114
- //#region ../shared/dist/logger/trace-context.d.ts
115
- /**
116
- * Trace context utilities for request correlation
117
- *
118
- * Trace IDs enable correlating logs across distributed components:
119
- * Worker → Durable Object → Container → back
120
- *
121
- * The trace ID is propagated via the X-Trace-Id HTTP header.
122
- */
123
- /**
124
- * Utility for managing trace context across distributed components
125
- */
126
- declare class TraceContext {
127
- /**
128
- * HTTP header name for trace ID propagation
129
- */
130
- private static readonly TRACE_HEADER;
131
- /**
132
- * Generate a new trace ID
133
- *
134
- * Format: "tr_" + 16 random hex characters
135
- * Example: "tr_7f3a9b2c4e5d6f1a"
136
- *
137
- * @returns Newly generated trace ID
138
- */
139
- static generate(): string;
140
- /**
141
- * Extract trace ID from HTTP request headers
142
- *
143
- * @param headers Request headers
144
- * @returns Trace ID if present, null otherwise
145
- */
146
- static fromHeaders(headers: Headers): string | null;
147
- /**
148
- * Create headers object with trace ID for outgoing requests
149
- *
150
- * @param traceId Trace ID to include
151
- * @returns Headers object with X-Trace-Id set
152
- */
153
- static toHeaders(traceId: string): Record<string, string>;
154
- /**
155
- * Get the header name used for trace ID propagation
156
- *
157
- * @returns Header name ("X-Trace-Id")
158
- */
159
- static getHeaderName(): string;
160
- }
161
- //#endregion
162
- //#region ../shared/dist/logger/index.d.ts
163
-
164
- /**
165
- * Create a no-op logger for testing
166
- *
167
- * Returns a logger that implements the Logger interface but does nothing.
168
- * Useful for tests that don't need actual logging output.
169
- *
170
- * @returns No-op logger instance
171
- *
172
- * @example
173
- * ```typescript
174
- * // In tests
175
- * const client = new HttpClient({
176
- * baseUrl: 'http://test.com',
177
- * logger: createNoOpLogger() // Optional - tests can enable real logging if needed
178
- * });
179
- * ```
180
- */
181
- declare function createNoOpLogger(): Logger;
182
- /**
183
- * Get the current logger from AsyncLocalStorage
184
- *
185
- * @throws Error if no logger is initialized in the current async context
186
- * @returns Current logger instance
187
- *
188
- * @example
189
- * ```typescript
190
- * function someHelperFunction() {
191
- * const logger = getLogger(); // Automatically has all context!
192
- * logger.info('Helper called');
193
- * }
194
- * ```
195
- */
196
- declare function getLogger(): Logger;
197
- /**
198
- * Run a function with a logger stored in AsyncLocalStorage
199
- *
200
- * The logger is available to all code within the function via getLogger().
201
- * This is typically called at request entry points (fetch handler) and when
202
- * creating child loggers with additional context.
203
- *
204
- * @param logger Logger instance to store in context
205
- * @param fn Function to execute with logger context
206
- * @returns Result of the function
207
- *
208
- * @example
209
- * ```typescript
210
- * // At request entry point
211
- * async fetch(request: Request): Promise<Response> {
212
- * const logger = createLogger({ component: 'sandbox-do', traceId: 'tr_abc' });
213
- * return runWithLogger(logger, async () => {
214
- * return await this.handleRequest(request);
215
- * });
216
- * }
217
- *
218
- * // When adding operation context
219
- * async exec(command: string) {
220
- * const logger = getLogger().child({ operation: 'exec', commandId: 'cmd-123' });
221
- * return runWithLogger(logger, async () => {
222
- * logger.info('Command started');
223
- * await this.executeCommand(command); // Nested calls get the child logger
224
- * logger.info('Command completed');
225
- * });
226
- * }
227
- * ```
228
- */
229
- declare function runWithLogger<T>(logger: Logger, fn: () => T | Promise<T>): T | Promise<T>;
230
- /**
231
- * Create a new logger instance
232
- *
233
- * @param context Base context for the logger. Must include 'component'.
234
- * TraceId will be auto-generated if not provided.
235
- * @returns New logger instance
236
- *
237
- * @example
238
- * ```typescript
239
- * // In Durable Object
240
- * const logger = createLogger({
241
- * component: 'sandbox-do',
242
- * traceId: TraceContext.fromHeaders(request.headers) || TraceContext.generate(),
243
- * sandboxId: this.id
244
- * });
245
- *
246
- * // In Container
247
- * const logger = createLogger({
248
- * component: 'container',
249
- * traceId: TraceContext.fromHeaders(request.headers)!,
250
- * sessionId: this.id
251
- * });
252
- * ```
253
- */
254
- declare function createLogger(context: Partial<LogContext> & {
255
- component: LogComponent;
256
- }): Logger;
257
- //#endregion
258
- //#region ../shared/dist/git.d.ts
259
- /**
260
- * Redact credentials from URLs for secure logging
261
- *
262
- * Replaces any credentials (username:password, tokens, etc.) embedded
263
- * in URLs with ****** to prevent sensitive data exposure in logs.
264
- * Works with URLs embedded in text (e.g., "Error: https://token@github.com/repo.git failed")
265
- *
266
- * @param text - String that may contain URLs with credentials
267
- * @returns String with credentials redacted from any URLs
268
- */
269
- declare function redactCredentials(text: string): string;
270
- /**
271
- * Sanitize data by redacting credentials from any strings
272
- * Recursively processes objects and arrays to ensure credentials are never leaked
273
- */
274
- declare function sanitizeGitData<T>(data: T): T;
275
- /**
276
- * Logger wrapper that automatically sanitizes git credentials
277
- */
278
- declare class GitLogger implements Logger {
279
- private readonly baseLogger;
280
- constructor(baseLogger: Logger);
281
- private sanitizeContext;
282
- private sanitizeError;
283
- debug(message: string, context?: Partial<LogContext>): void;
284
- info(message: string, context?: Partial<LogContext>): void;
285
- warn(message: string, context?: Partial<LogContext>): void;
286
- error(message: string, error?: Error, context?: Partial<LogContext>): void;
287
- child(context: Partial<LogContext>): Logger;
288
- }
289
- //#endregion
290
- //#region ../shared/dist/interpreter-types.d.ts
291
- interface CreateContextOptions {
292
- /**
293
- * Programming language for the context
294
- * @default 'python'
295
- */
296
- language?: 'python' | 'javascript' | 'typescript';
297
- /**
298
- * Working directory for the context
299
- * @default '/workspace'
300
- */
301
- cwd?: string;
302
- /**
303
- * Environment variables for the context
304
- */
305
- envVars?: Record<string, string>;
306
- /**
307
- * Request timeout in milliseconds
308
- * @default 30000
309
- */
310
- timeout?: number;
311
- }
312
- interface CodeContext {
313
- /**
314
- * Unique identifier for the context
315
- */
316
- readonly id: string;
317
- /**
318
- * Programming language of the context
319
- */
320
- readonly language: string;
321
- /**
322
- * Current working directory
323
- */
324
- readonly cwd: string;
325
- /**
326
- * When the context was created
327
- */
328
- readonly createdAt: Date;
329
- /**
330
- * When the context was last used
331
- */
332
- readonly lastUsed: Date;
333
- }
334
- interface RunCodeOptions {
335
- /**
336
- * Context to run the code in. If not provided, uses default context for the language
337
- */
338
- context?: CodeContext;
339
- /**
340
- * Language to use if context is not provided
341
- * @default 'python'
342
- */
343
- language?: 'python' | 'javascript' | 'typescript';
344
- /**
345
- * Environment variables for this execution
346
- */
347
- envVars?: Record<string, string>;
348
- /**
349
- * Execution timeout in milliseconds
350
- * @default 60000
351
- */
352
- timeout?: number;
353
- /**
354
- * AbortSignal for cancelling execution
355
- */
356
- signal?: AbortSignal;
357
- /**
358
- * Callback for stdout output
359
- */
360
- onStdout?: (output: OutputMessage) => void | Promise<void>;
361
- /**
362
- * Callback for stderr output
363
- */
364
- onStderr?: (output: OutputMessage) => void | Promise<void>;
365
- /**
366
- * Callback for execution results (charts, tables, etc)
367
- */
368
- onResult?: (result: Result) => void | Promise<void>;
369
- /**
370
- * Callback for execution errors
371
- */
372
- onError?: (error: ExecutionError) => void | Promise<void>;
373
- }
374
- interface OutputMessage {
375
- /**
376
- * The output text
377
- */
378
- text: string;
379
- /**
380
- * Timestamp of the output
381
- */
382
- timestamp: number;
383
- }
384
- interface Result {
385
- /**
386
- * Plain text representation
387
- */
388
- text?: string;
389
- /**
390
- * HTML representation (tables, formatted output)
391
- */
392
- html?: string;
393
- /**
394
- * PNG image data (base64 encoded)
395
- */
396
- png?: string;
397
- /**
398
- * JPEG image data (base64 encoded)
399
- */
400
- jpeg?: string;
401
- /**
402
- * SVG image data
403
- */
404
- svg?: string;
405
- /**
406
- * LaTeX representation
407
- */
408
- latex?: string;
409
- /**
410
- * Markdown representation
411
- */
412
- markdown?: string;
413
- /**
414
- * JavaScript code to execute
415
- */
416
- javascript?: string;
417
- /**
418
- * JSON data
419
- */
420
- json?: any;
421
- /**
422
- * Chart data if the result is a visualization
423
- */
424
- chart?: ChartData;
425
- /**
426
- * Raw data object
427
- */
428
- data?: any;
429
- /**
430
- * Available output formats
431
- */
432
- formats(): string[];
433
- }
434
- interface ChartData {
435
- /**
436
- * Type of chart
437
- */
438
- type: 'line' | 'bar' | 'scatter' | 'pie' | 'histogram' | 'heatmap' | 'unknown';
439
- /**
440
- * Chart title
441
- */
442
- title?: string;
443
- /**
444
- * Chart data (format depends on library)
445
- */
446
- data: any;
447
- /**
448
- * Chart layout/configuration
449
- */
450
- layout?: any;
451
- /**
452
- * Additional configuration
453
- */
454
- config?: any;
455
- /**
456
- * Library that generated the chart
457
- */
458
- library?: 'matplotlib' | 'plotly' | 'altair' | 'seaborn' | 'unknown';
459
- /**
460
- * Base64 encoded image if available
461
- */
462
- image?: string;
463
- }
464
- interface ExecutionError {
465
- /**
466
- * Error name/type (e.g., 'NameError', 'SyntaxError')
467
- */
468
- name: string;
469
- /**
470
- * Error message
471
- */
472
- message: string;
473
- /**
474
- * Stack trace
475
- */
476
- traceback: string[];
477
- /**
478
- * Line number where error occurred
479
- */
480
- lineNumber?: number;
481
- }
482
- interface ExecutionResult {
483
- code: string;
484
- logs: {
485
- stdout: string[];
486
- stderr: string[];
487
- };
488
- error?: ExecutionError;
489
- executionCount?: number;
490
- results: Array<{
491
- text?: string;
492
- html?: string;
493
- png?: string;
494
- jpeg?: string;
495
- svg?: string;
496
- latex?: string;
497
- markdown?: string;
498
- javascript?: string;
499
- json?: any;
500
- chart?: ChartData;
501
- data?: any;
502
- }>;
503
- }
504
- declare class Execution {
505
- readonly code: string;
506
- readonly context: CodeContext;
507
- /**
508
- * All results from the execution
509
- */
510
- results: Result[];
511
- /**
512
- * Accumulated stdout and stderr
513
- */
514
- logs: {
515
- stdout: string[];
516
- stderr: string[];
517
- };
518
- /**
519
- * Execution error if any
520
- */
521
- error?: ExecutionError;
522
- /**
523
- * Execution count (for interpreter)
524
- */
525
- executionCount?: number;
526
- constructor(code: string, context: CodeContext);
527
- /**
528
- * Convert to a plain object for serialization
529
- */
530
- toJSON(): ExecutionResult;
531
- }
532
- declare class ResultImpl implements Result {
533
- private raw;
534
- constructor(raw: any);
535
- get text(): string | undefined;
536
- get html(): string | undefined;
537
- get png(): string | undefined;
538
- get jpeg(): string | undefined;
539
- get svg(): string | undefined;
540
- get latex(): string | undefined;
541
- get markdown(): string | undefined;
542
- get javascript(): string | undefined;
543
- get json(): any;
544
- get chart(): ChartData | undefined;
545
- get data(): any;
546
- formats(): string[];
547
- }
548
- //#endregion
549
- //#region ../shared/dist/request-types.d.ts
550
- /**
551
- * Request to start a background process
552
- * Uses flat structure consistent with other endpoints
553
- */
554
- interface StartProcessRequest {
555
- command: string;
556
- sessionId?: string;
557
- processId?: string;
558
- timeoutMs?: number;
559
- env?: Record<string, string>;
560
- cwd?: string;
561
- encoding?: string;
562
- autoCleanup?: boolean;
563
- }
564
- /**
565
- * Request to delete a file
566
- */
567
- interface DeleteFileRequest {
568
- path: string;
569
- sessionId?: string;
570
- }
571
- /**
572
- * Request to rename a file
573
- */
574
- interface RenameFileRequest {
575
- oldPath: string;
576
- newPath: string;
577
- sessionId?: string;
578
- }
579
- /**
580
- * Request to move a file
581
- */
582
- interface MoveFileRequest {
583
- sourcePath: string;
584
- destinationPath: string;
585
- sessionId?: string;
586
- }
587
- /**
588
- * Request to check if a file or directory exists
589
- */
590
- interface FileExistsRequest {
591
- path: string;
592
- sessionId?: string;
593
- }
594
- /**
595
- * Request to create a session
596
- */
597
- interface SessionCreateRequest {
598
- id?: string;
599
- name?: string;
600
- env?: Record<string, string>;
601
- cwd?: string;
602
- }
603
- /**
604
- * Request to delete a session
605
- */
606
- interface SessionDeleteRequest {
607
- sessionId: string;
608
- }
609
- //#endregion
610
- //#region ../shared/dist/types.d.ts
611
- interface BaseExecOptions {
612
- /**
613
- * Maximum execution time in milliseconds
614
- */
615
- timeout?: number;
616
- /**
617
- * Environment variables for the command
618
- */
619
- env?: Record<string, string>;
620
- /**
621
- * Working directory for command execution
622
- */
623
- cwd?: string;
624
- /**
625
- * Text encoding for output (default: 'utf8')
626
- */
627
- encoding?: string;
628
- }
629
- interface ExecOptions extends BaseExecOptions {
630
- /**
631
- * Enable real-time output streaming via callbacks
632
- */
633
- stream?: boolean;
634
- /**
635
- * Callback for real-time output data
636
- */
637
- onOutput?: (stream: 'stdout' | 'stderr', data: string) => void;
638
- /**
639
- * Callback when command completes (only when stream: true)
640
- */
641
- onComplete?: (result: ExecResult) => void;
642
- /**
643
- * Callback for execution errors
644
- */
645
- onError?: (error: Error) => void;
646
- /**
647
- * AbortSignal for cancelling execution
648
- */
649
- signal?: AbortSignal;
650
- }
651
- interface ExecResult {
652
- /**
653
- * Whether the command succeeded (exitCode === 0)
654
- */
655
- success: boolean;
656
- /**
657
- * Process exit code
658
- */
659
- exitCode: number;
660
- /**
661
- * Standard output content
662
- */
663
- stdout: string;
664
- /**
665
- * Standard error content
666
- */
667
- stderr: string;
668
- /**
669
- * Command that was executed
670
- */
671
- command: string;
672
- /**
673
- * Execution duration in milliseconds
674
- */
675
- duration: number;
676
- /**
677
- * ISO timestamp when command started
678
- */
679
- timestamp: string;
680
- /**
681
- * Session ID if provided
682
- */
683
- sessionId?: string;
684
- }
685
- interface ProcessOptions extends BaseExecOptions {
686
- /**
687
- * Custom process ID for later reference
688
- * If not provided, a UUID will be generated
689
- */
690
- processId?: string;
691
- /**
692
- * Automatically cleanup process record after exit (default: true)
693
- */
694
- autoCleanup?: boolean;
695
- /**
696
- * Callback when process exits
697
- */
698
- onExit?: (code: number | null) => void;
699
- /**
700
- * Callback for real-time output (background processes)
701
- */
702
- onOutput?: (stream: 'stdout' | 'stderr', data: string) => void;
703
- /**
704
- * Callback when process starts successfully
705
- */
706
- onStart?: (process: Process) => void;
707
- /**
708
- * Callback for process errors
709
- */
710
- onError?: (error: Error) => void;
711
- }
712
- type ProcessStatus = 'starting' | 'running' | 'completed' | 'failed' | 'killed' | 'error';
713
- interface Process {
714
- /**
715
- * Unique process identifier
716
- */
717
- readonly id: string;
718
- /**
719
- * System process ID (if available and running)
720
- */
721
- readonly pid?: number;
722
- /**
723
- * Command that was executed
724
- */
725
- readonly command: string;
726
- /**
727
- * Current process status
728
- */
729
- readonly status: ProcessStatus;
730
- /**
731
- * When the process was started
732
- */
733
- readonly startTime: Date;
734
- /**
735
- * When the process ended (if completed)
736
- */
737
- readonly endTime?: Date;
738
- /**
739
- * Process exit code (if completed)
740
- */
741
- readonly exitCode?: number;
742
- /**
743
- * Session ID if provided
744
- */
745
- readonly sessionId?: string;
746
- /**
747
- * Kill the process
748
- */
749
- kill(signal?: string): Promise<void>;
750
- /**
751
- * Get current process status (refreshed)
752
- */
753
- getStatus(): Promise<ProcessStatus>;
754
- /**
755
- * Get accumulated logs
756
- */
757
- getLogs(): Promise<{
758
- stdout: string;
759
- stderr: string;
760
- }>;
761
- }
762
- interface ExecEvent {
763
- type: 'start' | 'stdout' | 'stderr' | 'complete' | 'error';
764
- timestamp: string;
765
- data?: string;
766
- command?: string;
767
- exitCode?: number;
768
- result?: ExecResult;
769
- error?: string;
770
- sessionId?: string;
771
- }
772
- interface LogEvent {
773
- type: 'stdout' | 'stderr' | 'exit' | 'error';
774
- timestamp: string;
775
- data: string;
776
- processId: string;
777
- sessionId?: string;
778
- exitCode?: number;
779
- }
780
- interface StreamOptions extends BaseExecOptions {
781
- /**
782
- * Buffer size for streaming output
783
- */
784
- bufferSize?: number;
785
- /**
786
- * AbortSignal for cancelling stream
787
- */
788
- signal?: AbortSignal;
789
- }
790
- interface SessionOptions {
791
- /**
792
- * Optional session ID (auto-generated if not provided)
793
- */
794
- id?: string;
795
- /**
796
- * Session name for identification
797
- */
798
- name?: string;
799
- /**
800
- * Environment variables for this session
801
- */
802
- env?: Record<string, string>;
803
- /**
804
- * Working directory
805
- */
806
- cwd?: string;
807
- /**
808
- * Enable PID namespace isolation (requires CAP_SYS_ADMIN)
809
- */
810
- isolation?: boolean;
811
- }
812
- interface SandboxOptions {
813
- /**
814
- * Duration after which the sandbox instance will sleep if no requests are received
815
- * Can be:
816
- * - A string like "30s", "3m", "5m", "1h" (seconds, minutes, or hours)
817
- * - A number representing seconds (e.g., 180 for 3 minutes)
818
- * Default: "10m" (10 minutes)
819
- *
820
- * Note: Ignored when keepAlive is true
821
- */
822
- sleepAfter?: string | number;
823
- /**
824
- * Base URL for the sandbox API
825
- */
826
- baseUrl?: string;
827
- /**
828
- * Keep the container alive indefinitely by preventing automatic shutdown
829
- * When true, the container will never auto-timeout and must be explicitly destroyed
830
- * - Any scenario where activity can't be automatically detected
831
- *
832
- * Important: You MUST call sandbox.destroy() when done to avoid resource leaks
833
- *
834
- * Default: false
835
- */
836
- keepAlive?: boolean;
837
- }
838
- /**
839
- * Execution session - isolated execution context within a sandbox
840
- * Returned by sandbox.createSession()
841
- * Provides the same API as ISandbox but bound to a specific session
842
- */
843
- interface MkdirResult {
844
- success: boolean;
845
- path: string;
846
- recursive: boolean;
847
- timestamp: string;
848
- exitCode?: number;
849
- }
850
- interface WriteFileResult {
851
- success: boolean;
852
- path: string;
853
- timestamp: string;
854
- exitCode?: number;
855
- }
856
- interface ReadFileResult {
857
- success: boolean;
858
- path: string;
859
- content: string;
860
- timestamp: string;
861
- exitCode?: number;
862
- /**
863
- * Encoding used for content (utf-8 for text, base64 for binary)
864
- */
865
- encoding?: 'utf-8' | 'base64';
866
- /**
867
- * Whether the file is detected as binary
868
- */
869
- isBinary?: boolean;
870
- /**
871
- * MIME type of the file (e.g., 'image/png', 'text/plain')
872
- */
873
- mimeType?: string;
874
- /**
875
- * File size in bytes
876
- */
877
- size?: number;
878
- }
879
- interface DeleteFileResult {
880
- success: boolean;
881
- path: string;
882
- timestamp: string;
883
- exitCode?: number;
884
- }
885
- interface RenameFileResult {
886
- success: boolean;
887
- path: string;
888
- newPath: string;
889
- timestamp: string;
890
- exitCode?: number;
891
- }
892
- interface MoveFileResult {
893
- success: boolean;
894
- path: string;
895
- newPath: string;
896
- timestamp: string;
897
- exitCode?: number;
898
- }
899
- interface FileExistsResult {
900
- success: boolean;
901
- path: string;
902
- exists: boolean;
903
- timestamp: string;
904
- }
905
- interface FileInfo {
906
- name: string;
907
- absolutePath: string;
908
- relativePath: string;
909
- type: 'file' | 'directory' | 'symlink' | 'other';
910
- size: number;
911
- modifiedAt: string;
912
- mode: string;
913
- permissions: {
914
- readable: boolean;
915
- writable: boolean;
916
- executable: boolean;
917
- };
918
- }
919
- interface ListFilesOptions {
920
- recursive?: boolean;
921
- includeHidden?: boolean;
922
- }
923
- interface ListFilesResult {
924
- success: boolean;
925
- path: string;
926
- files: FileInfo[];
927
- count: number;
928
- timestamp: string;
929
- exitCode?: number;
930
- }
931
- interface GitCheckoutResult {
932
- success: boolean;
933
- repoUrl: string;
934
- branch: string;
935
- targetDir: string;
936
- timestamp: string;
937
- exitCode?: number;
938
- }
939
- /**
940
- * SSE events for file streaming
941
- */
942
- type FileStreamEvent = {
943
- type: 'metadata';
944
- mimeType: string;
945
- size: number;
946
- isBinary: boolean;
947
- encoding: 'utf-8' | 'base64';
948
- } | {
949
- type: 'chunk';
950
- data: string;
951
- } | {
952
- type: 'complete';
953
- bytesRead: number;
954
- } | {
955
- type: 'error';
956
- error: string;
957
- };
958
- /**
959
- * File metadata from streaming
960
- */
961
- interface FileMetadata {
962
- mimeType: string;
963
- size: number;
964
- isBinary: boolean;
965
- encoding: 'utf-8' | 'base64';
966
- }
967
- /**
968
- * File stream chunk - either string (text) or Uint8Array (binary, auto-decoded)
969
- */
970
- type FileChunk = string | Uint8Array;
971
- interface ProcessStartResult {
972
- success: boolean;
973
- processId: string;
974
- pid?: number;
975
- command: string;
976
- timestamp: string;
977
- }
978
- interface ProcessListResult {
979
- success: boolean;
980
- processes: Array<{
981
- id: string;
982
- pid?: number;
983
- command: string;
984
- status: ProcessStatus;
985
- startTime: string;
986
- endTime?: string;
987
- exitCode?: number;
988
- }>;
989
- timestamp: string;
990
- }
991
- interface ProcessInfoResult {
992
- success: boolean;
993
- process: {
994
- id: string;
995
- pid?: number;
996
- command: string;
997
- status: ProcessStatus;
998
- startTime: string;
999
- endTime?: string;
1000
- exitCode?: number;
1001
- };
1002
- timestamp: string;
1003
- }
1004
- interface ProcessKillResult {
1005
- success: boolean;
1006
- processId: string;
1007
- signal?: string;
1008
- timestamp: string;
1009
- }
1010
- interface ProcessLogsResult {
1011
- success: boolean;
1012
- processId: string;
1013
- stdout: string;
1014
- stderr: string;
1015
- timestamp: string;
1016
- }
1017
- interface ProcessCleanupResult {
1018
- success: boolean;
1019
- cleanedCount: number;
1020
- timestamp: string;
1021
- }
1022
- interface SessionCreateResult {
1023
- success: boolean;
1024
- sessionId: string;
1025
- name?: string;
1026
- cwd?: string;
1027
- timestamp: string;
1028
- }
1029
- interface SessionDeleteResult {
1030
- success: boolean;
1031
- sessionId: string;
1032
- timestamp: string;
1033
- }
1034
- interface EnvSetResult {
1035
- success: boolean;
1036
- timestamp: string;
1037
- }
1038
- interface PortExposeResult {
1039
- success: boolean;
1040
- port: number;
1041
- url: string;
1042
- timestamp: string;
1043
- }
1044
- interface PortStatusResult {
1045
- success: boolean;
1046
- port: number;
1047
- status: 'active' | 'inactive';
1048
- url?: string;
1049
- timestamp: string;
1050
- }
1051
- interface PortListResult {
1052
- success: boolean;
1053
- ports: Array<{
1054
- port: number;
1055
- url: string;
1056
- status: 'active' | 'inactive';
1057
- }>;
1058
- timestamp: string;
1059
- }
1060
- interface PortCloseResult {
1061
- success: boolean;
1062
- port: number;
1063
- timestamp: string;
1064
- }
1065
- interface InterpreterHealthResult {
1066
- success: boolean;
1067
- status: 'healthy' | 'unhealthy';
1068
- timestamp: string;
1069
- }
1070
- interface ContextCreateResult {
1071
- success: boolean;
1072
- contextId: string;
1073
- language: string;
1074
- cwd?: string;
1075
- timestamp: string;
1076
- }
1077
- interface ContextListResult {
1078
- success: boolean;
1079
- contexts: Array<{
1080
- id: string;
1081
- language: string;
1082
- cwd?: string;
1083
- }>;
1084
- timestamp: string;
1085
- }
1086
- interface ContextDeleteResult {
1087
- success: boolean;
1088
- contextId: string;
1089
- timestamp: string;
1090
- }
1091
- interface HealthCheckResult {
1092
- success: boolean;
1093
- status: 'healthy' | 'unhealthy';
1094
- timestamp: string;
1095
- }
1096
- interface ShutdownResult {
1097
- success: boolean;
1098
- message: string;
1099
- timestamp: string;
1100
- }
1101
- interface ExecutionSession {
1102
- /** Unique session identifier */
1103
- readonly id: string;
1104
- exec(command: string, options?: ExecOptions): Promise<ExecResult>;
1105
- execStream(command: string, options?: StreamOptions): Promise<ReadableStream<Uint8Array>>;
1106
- startProcess(command: string, options?: ProcessOptions): Promise<Process>;
1107
- listProcesses(): Promise<Process[]>;
1108
- getProcess(id: string): Promise<Process | null>;
1109
- killProcess(id: string, signal?: string): Promise<void>;
1110
- killAllProcesses(): Promise<number>;
1111
- cleanupCompletedProcesses(): Promise<number>;
1112
- getProcessLogs(id: string): Promise<{
1113
- stdout: string;
1114
- stderr: string;
1115
- processId: string;
1116
- }>;
1117
- streamProcessLogs(processId: string, options?: {
1118
- signal?: AbortSignal;
1119
- }): Promise<ReadableStream<Uint8Array>>;
1120
- writeFile(path: string, content: string, options?: {
1121
- encoding?: string;
1122
- }): Promise<WriteFileResult>;
1123
- readFile(path: string, options?: {
1124
- encoding?: string;
1125
- }): Promise<ReadFileResult>;
1126
- readFileStream(path: string): Promise<ReadableStream<Uint8Array>>;
1127
- mkdir(path: string, options?: {
1128
- recursive?: boolean;
1129
- }): Promise<MkdirResult>;
1130
- deleteFile(path: string): Promise<DeleteFileResult>;
1131
- renameFile(oldPath: string, newPath: string): Promise<RenameFileResult>;
1132
- moveFile(sourcePath: string, destinationPath: string): Promise<MoveFileResult>;
1133
- listFiles(path: string, options?: ListFilesOptions): Promise<ListFilesResult>;
1134
- exists(path: string): Promise<FileExistsResult>;
1135
- gitCheckout(repoUrl: string, options?: {
1136
- branch?: string;
1137
- targetDir?: string;
1138
- }): Promise<GitCheckoutResult>;
1139
- setEnvVars(envVars: Record<string, string>): Promise<void>;
1140
- createCodeContext(options?: CreateContextOptions): Promise<CodeContext>;
1141
- runCode(code: string, options?: RunCodeOptions): Promise<ExecutionResult>;
1142
- runCodeStream(code: string, options?: RunCodeOptions): Promise<ReadableStream<Uint8Array>>;
1143
- listCodeContexts(): Promise<CodeContext[]>;
1144
- deleteCodeContext(contextId: string): Promise<void>;
1145
- }
1146
- interface ISandbox {
1147
- exec(command: string, options?: ExecOptions): Promise<ExecResult>;
1148
- startProcess(command: string, options?: ProcessOptions): Promise<Process>;
1149
- listProcesses(): Promise<Process[]>;
1150
- getProcess(id: string): Promise<Process | null>;
1151
- killProcess(id: string, signal?: string): Promise<void>;
1152
- killAllProcesses(): Promise<number>;
1153
- execStream(command: string, options?: StreamOptions): Promise<ReadableStream<Uint8Array>>;
1154
- streamProcessLogs(processId: string, options?: {
1155
- signal?: AbortSignal;
1156
- }): Promise<ReadableStream<Uint8Array>>;
1157
- cleanupCompletedProcesses(): Promise<number>;
1158
- getProcessLogs(id: string): Promise<{
1159
- stdout: string;
1160
- stderr: string;
1161
- processId: string;
1162
- }>;
1163
- writeFile(path: string, content: string, options?: {
1164
- encoding?: string;
1165
- }): Promise<WriteFileResult>;
1166
- readFile(path: string, options?: {
1167
- encoding?: string;
1168
- }): Promise<ReadFileResult>;
1169
- readFileStream(path: string): Promise<ReadableStream<Uint8Array>>;
1170
- mkdir(path: string, options?: {
1171
- recursive?: boolean;
1172
- }): Promise<MkdirResult>;
1173
- deleteFile(path: string): Promise<DeleteFileResult>;
1174
- renameFile(oldPath: string, newPath: string): Promise<RenameFileResult>;
1175
- moveFile(sourcePath: string, destinationPath: string): Promise<MoveFileResult>;
1176
- listFiles(path: string, options?: ListFilesOptions): Promise<ListFilesResult>;
1177
- exists(path: string, sessionId?: string): Promise<FileExistsResult>;
1178
- gitCheckout(repoUrl: string, options?: {
1179
- branch?: string;
1180
- targetDir?: string;
1181
- }): Promise<GitCheckoutResult>;
1182
- createSession(options?: SessionOptions): Promise<ExecutionSession>;
1183
- deleteSession(sessionId: string): Promise<SessionDeleteResult>;
1184
- createCodeContext(options?: CreateContextOptions): Promise<CodeContext>;
1185
- runCode(code: string, options?: RunCodeOptions): Promise<ExecutionResult>;
1186
- runCodeStream(code: string, options?: RunCodeOptions): Promise<ReadableStream>;
1187
- listCodeContexts(): Promise<CodeContext[]>;
1188
- deleteCodeContext(contextId: string): Promise<void>;
1189
- wsConnect(request: Request, port: number): Promise<Response>;
1190
- }
1191
- declare function isExecResult(value: any): value is ExecResult;
1192
- declare function isProcess(value: any): value is Process;
1193
- declare function isProcessStatus(value: string): value is ProcessStatus;
1194
- //#endregion
1195
- //#region src/clients/types.d.ts
1196
- /**
1197
- * Minimal interface for container fetch functionality
1198
- */
1199
- interface ContainerStub {
1200
- containerFetch(url: string, options: RequestInit, port?: number): Promise<Response>;
1201
- }
1202
- /**
1203
- * Shared HTTP client configuration options
1204
- */
1205
- interface HttpClientOptions {
1206
- logger?: Logger;
1207
- baseUrl?: string;
1208
- port?: number;
1209
- stub?: ContainerStub;
1210
- onCommandComplete?: (success: boolean, exitCode: number, stdout: string, stderr: string, command: string) => void;
1211
- onError?: (error: string, command?: string) => void;
1212
- }
1213
- /**
1214
- * Base response interface for all API responses
1215
- */
1216
- interface BaseApiResponse {
1217
- success: boolean;
1218
- timestamp: string;
1219
- }
1220
- /**
1221
- * Legacy error response interface - deprecated, use ApiErrorResponse
1222
- */
1223
- interface ErrorResponse {
1224
- error: string;
1225
- details?: string;
1226
- code?: string;
1227
- }
1228
- /**
1229
- * HTTP request configuration
1230
- */
1231
- interface RequestConfig extends RequestInit {
1232
- endpoint: string;
1233
- data?: Record<string, any>;
1234
- }
1235
- /**
1236
- * Typed response handler
1237
- */
1238
- type ResponseHandler<T> = (response: Response) => Promise<T>;
1239
- /**
1240
- * Common session-aware request interface
1241
- */
1242
- interface SessionRequest {
1243
- sessionId?: string;
1244
- }
1245
- //#endregion
1246
- //#region src/clients/base-client.d.ts
1247
- /**
1248
- * Abstract base class providing common HTTP functionality for all domain clients
1249
- */
1250
- declare abstract class BaseHttpClient {
1251
- protected baseUrl: string;
1252
- protected options: HttpClientOptions;
1253
- protected logger: Logger;
1254
- constructor(options?: HttpClientOptions);
1255
- /**
1256
- * Core HTTP request method with automatic retry for container provisioning delays
1257
- */
1258
- protected doFetch(path: string, options?: RequestInit): Promise<Response>;
1259
- /**
1260
- * Make a POST request with JSON body
1261
- */
1262
- protected post<T>(endpoint: string, data: Record<string, any>, responseHandler?: ResponseHandler<T>): Promise<T>;
1263
- /**
1264
- * Make a GET request
1265
- */
1266
- protected get<T>(endpoint: string, responseHandler?: ResponseHandler<T>): Promise<T>;
1267
- /**
1268
- * Make a DELETE request
1269
- */
1270
- protected delete<T>(endpoint: string, responseHandler?: ResponseHandler<T>): Promise<T>;
1271
- /**
1272
- * Handle HTTP response with error checking and parsing
1273
- */
1274
- protected handleResponse<T>(response: Response, customHandler?: ResponseHandler<T>): Promise<T>;
1275
- /**
1276
- * Handle error responses with consistent error throwing
1277
- */
1278
- protected handleErrorResponse(response: Response): Promise<never>;
1279
- /**
1280
- * Create a streaming response handler for Server-Sent Events
1281
- */
1282
- protected handleStreamResponse(response: Response): Promise<ReadableStream<Uint8Array>>;
1283
- /**
1284
- * Utility method to log successful operations
1285
- */
1286
- protected logSuccess(operation: string, details?: string): void;
1287
- /**
1288
- * Utility method to log errors intelligently
1289
- * Only logs unexpected errors (5xx), not expected errors (4xx)
1290
- *
1291
- * - 4xx errors (validation, not found, conflicts): Don't log (expected client errors)
1292
- * - 5xx errors (server failures, internal errors): DO log (unexpected server errors)
1293
- */
1294
- protected logError(operation: string, error: unknown): void;
1295
- /**
1296
- * Check if 503 response is from container provisioning (retryable)
1297
- * vs user application (not retryable)
1298
- */
1299
- private isContainerProvisioningError;
1300
- private executeFetch;
1301
- }
1302
- //#endregion
1303
- //#region src/clients/command-client.d.ts
1304
5
  /**
1305
- * Request interface for command execution
6
+ * Request to start a background process
7
+ * Uses flat structure consistent with other endpoints
1306
8
  */
1307
- interface ExecuteRequest extends SessionRequest {
9
+ interface StartProcessRequest {
1308
10
  command: string;
11
+ sessionId?: string;
12
+ processId?: string;
1309
13
  timeoutMs?: number;
1310
- }
1311
- /**
1312
- * Response interface for command execution
1313
- */
1314
- interface ExecuteResponse extends BaseApiResponse {
1315
- stdout: string;
1316
- stderr: string;
1317
- exitCode: number;
1318
- command: string;
1319
- }
1320
- /**
1321
- * Client for command execution operations
1322
- */
1323
- declare class CommandClient extends BaseHttpClient {
1324
- /**
1325
- * Execute a command and return the complete result
1326
- * @param command - The command to execute
1327
- * @param sessionId - The session ID for this command execution
1328
- * @param timeoutMs - Optional timeout in milliseconds (unlimited by default)
1329
- */
1330
- execute(command: string, sessionId: string, timeoutMs?: number): Promise<ExecuteResponse>;
1331
- /**
1332
- * Execute a command and return a stream of events
1333
- * @param command - The command to execute
1334
- * @param sessionId - The session ID for this command execution
1335
- */
1336
- executeStream(command: string, sessionId: string): Promise<ReadableStream<Uint8Array>>;
1337
- }
1338
- //#endregion
1339
- //#region src/clients/file-client.d.ts
1340
- /**
1341
- * Request interface for creating directories
1342
- */
1343
- interface MkdirRequest extends SessionRequest {
1344
- path: string;
1345
- recursive?: boolean;
1346
- }
1347
- /**
1348
- * Request interface for writing files
1349
- */
1350
- interface WriteFileRequest extends SessionRequest {
1351
- path: string;
1352
- content: string;
1353
- encoding?: string;
1354
- }
1355
- /**
1356
- * Request interface for reading files
1357
- */
1358
- interface ReadFileRequest extends SessionRequest {
1359
- path: string;
1360
- encoding?: string;
1361
- }
1362
- /**
1363
- * Request interface for file operations (delete, rename, move)
1364
- */
1365
- interface FileOperationRequest extends SessionRequest {
1366
- path: string;
1367
- newPath?: string;
1368
- }
1369
- /**
1370
- * Client for file system operations
1371
- */
1372
- declare class FileClient extends BaseHttpClient {
1373
- /**
1374
- * Create a directory
1375
- * @param path - Directory path to create
1376
- * @param sessionId - The session ID for this operation
1377
- * @param options - Optional settings (recursive)
1378
- */
1379
- mkdir(path: string, sessionId: string, options?: {
1380
- recursive?: boolean;
1381
- }): Promise<MkdirResult>;
1382
- /**
1383
- * Write content to a file
1384
- * @param path - File path to write to
1385
- * @param content - Content to write
1386
- * @param sessionId - The session ID for this operation
1387
- * @param options - Optional settings (encoding)
1388
- */
1389
- writeFile(path: string, content: string, sessionId: string, options?: {
1390
- encoding?: string;
1391
- }): Promise<WriteFileResult>;
1392
- /**
1393
- * Read content from a file
1394
- * @param path - File path to read from
1395
- * @param sessionId - The session ID for this operation
1396
- * @param options - Optional settings (encoding)
1397
- */
1398
- readFile(path: string, sessionId: string, options?: {
1399
- encoding?: string;
1400
- }): Promise<ReadFileResult>;
1401
- /**
1402
- * Stream a file using Server-Sent Events
1403
- * Returns a ReadableStream of SSE events containing metadata, chunks, and completion
1404
- * @param path - File path to stream
1405
- * @param sessionId - The session ID for this operation
1406
- */
1407
- readFileStream(path: string, sessionId: string): Promise<ReadableStream<Uint8Array>>;
1408
- /**
1409
- * Delete a file
1410
- * @param path - File path to delete
1411
- * @param sessionId - The session ID for this operation
1412
- */
1413
- deleteFile(path: string, sessionId: string): Promise<DeleteFileResult>;
1414
- /**
1415
- * Rename a file
1416
- * @param path - Current file path
1417
- * @param newPath - New file path
1418
- * @param sessionId - The session ID for this operation
1419
- */
1420
- renameFile(path: string, newPath: string, sessionId: string): Promise<RenameFileResult>;
1421
- /**
1422
- * Move a file
1423
- * @param path - Current file path
1424
- * @param newPath - Destination file path
1425
- * @param sessionId - The session ID for this operation
1426
- */
1427
- moveFile(path: string, newPath: string, sessionId: string): Promise<MoveFileResult>;
1428
- /**
1429
- * List files in a directory
1430
- * @param path - Directory path to list
1431
- * @param sessionId - The session ID for this operation
1432
- * @param options - Optional settings (recursive, includeHidden)
1433
- */
1434
- listFiles(path: string, sessionId: string, options?: ListFilesOptions): Promise<ListFilesResult>;
1435
- /**
1436
- * Check if a file or directory exists
1437
- * @param path - Path to check
1438
- * @param sessionId - The session ID for this operation
1439
- */
1440
- exists(path: string, sessionId: string): Promise<FileExistsResult>;
1441
- }
1442
- //#endregion
1443
- //#region src/clients/git-client.d.ts
1444
- /**
1445
- * Request interface for Git checkout operations
1446
- */
1447
- interface GitCheckoutRequest extends SessionRequest {
1448
- repoUrl: string;
1449
- branch?: string;
1450
- targetDir?: string;
1451
- }
1452
- /**
1453
- * Client for Git repository operations
1454
- */
1455
- declare class GitClient extends BaseHttpClient {
1456
- constructor(options?: HttpClientOptions);
1457
- /**
1458
- * Clone a Git repository
1459
- * @param repoUrl - URL of the Git repository to clone
1460
- * @param sessionId - The session ID for this operation
1461
- * @param options - Optional settings (branch, targetDir)
1462
- */
1463
- checkout(repoUrl: string, sessionId: string, options?: {
1464
- branch?: string;
1465
- targetDir?: string;
1466
- }): Promise<GitCheckoutResult>;
1467
- /**
1468
- * Extract repository name from URL for default directory name
1469
- */
1470
- private extractRepoName;
1471
- }
1472
- //#endregion
1473
- //#region src/clients/interpreter-client.d.ts
1474
- interface ExecutionCallbacks {
1475
- onStdout?: (output: OutputMessage) => void | Promise<void>;
1476
- onStderr?: (output: OutputMessage) => void | Promise<void>;
1477
- onResult?: (result: Result) => void | Promise<void>;
1478
- onError?: (error: ExecutionError) => void | Promise<void>;
1479
- }
1480
- declare class InterpreterClient extends BaseHttpClient {
1481
- private readonly maxRetries;
1482
- private readonly retryDelayMs;
1483
- createCodeContext(options?: CreateContextOptions): Promise<CodeContext>;
1484
- runCodeStream(contextId: string | undefined, code: string, language: string | undefined, callbacks: ExecutionCallbacks, timeoutMs?: number): Promise<void>;
1485
- listCodeContexts(): Promise<CodeContext[]>;
1486
- deleteCodeContext(contextId: string): Promise<void>;
1487
- /**
1488
- * Execute an operation with automatic retry for transient errors
1489
- */
1490
- private executeWithRetry;
1491
- private isRetryableError;
1492
- private parseErrorResponse;
1493
- private readLines;
1494
- private parseExecutionResult;
1495
- }
1496
- //#endregion
1497
- //#region src/clients/port-client.d.ts
1498
- /**
1499
- * Request interface for exposing ports
1500
- */
1501
- interface ExposePortRequest {
1502
- port: number;
1503
- name?: string;
1504
- }
1505
- /**
1506
- * Request interface for unexposing ports
1507
- */
1508
- interface UnexposePortRequest {
1509
- port: number;
1510
- }
1511
- /**
1512
- * Client for port management and preview URL operations
1513
- */
1514
- declare class PortClient extends BaseHttpClient {
1515
- /**
1516
- * Expose a port and get a preview URL
1517
- * @param port - Port number to expose
1518
- * @param sessionId - The session ID for this operation
1519
- * @param name - Optional name for the port
1520
- */
1521
- exposePort(port: number, sessionId: string, name?: string): Promise<PortExposeResult>;
1522
- /**
1523
- * Unexpose a port and remove its preview URL
1524
- * @param port - Port number to unexpose
1525
- * @param sessionId - The session ID for this operation
1526
- */
1527
- unexposePort(port: number, sessionId: string): Promise<PortCloseResult>;
1528
- /**
1529
- * Get all currently exposed ports
1530
- * @param sessionId - The session ID for this operation
1531
- */
1532
- getExposedPorts(sessionId: string): Promise<PortListResult>;
1533
- }
1534
- //#endregion
1535
- //#region src/clients/process-client.d.ts
1536
- /**
1537
- * Client for background process management
1538
- */
1539
- declare class ProcessClient extends BaseHttpClient {
1540
- /**
1541
- * Start a background process
1542
- * @param command - Command to execute as a background process
1543
- * @param sessionId - The session ID for this operation
1544
- * @param options - Optional settings (processId)
1545
- */
1546
- startProcess(command: string, sessionId: string, options?: {
1547
- processId?: string;
1548
- }): Promise<ProcessStartResult>;
1549
- /**
1550
- * List all processes (sandbox-scoped, not session-scoped)
1551
- */
1552
- listProcesses(): Promise<ProcessListResult>;
1553
- /**
1554
- * Get information about a specific process (sandbox-scoped, not session-scoped)
1555
- * @param processId - ID of the process to retrieve
1556
- */
1557
- getProcess(processId: string): Promise<ProcessInfoResult>;
1558
- /**
1559
- * Kill a specific process (sandbox-scoped, not session-scoped)
1560
- * @param processId - ID of the process to kill
1561
- */
1562
- killProcess(processId: string): Promise<ProcessKillResult>;
1563
- /**
1564
- * Kill all running processes (sandbox-scoped, not session-scoped)
1565
- */
1566
- killAllProcesses(): Promise<ProcessCleanupResult>;
1567
- /**
1568
- * Get logs from a specific process (sandbox-scoped, not session-scoped)
1569
- * @param processId - ID of the process to get logs from
1570
- */
1571
- getProcessLogs(processId: string): Promise<ProcessLogsResult>;
1572
- /**
1573
- * Stream logs from a specific process (sandbox-scoped, not session-scoped)
1574
- * @param processId - ID of the process to stream logs from
1575
- */
1576
- streamProcessLogs(processId: string): Promise<ReadableStream<Uint8Array>>;
1577
- }
1578
- //#endregion
1579
- //#region src/clients/utility-client.d.ts
1580
- /**
1581
- * Response interface for ping operations
1582
- */
1583
- interface PingResponse extends BaseApiResponse {
1584
- message: string;
1585
- uptime?: number;
1586
- }
1587
- /**
1588
- * Response interface for getting available commands
1589
- */
1590
- interface CommandsResponse extends BaseApiResponse {
1591
- availableCommands: string[];
1592
- count: number;
1593
- }
1594
- /**
1595
- * Request interface for creating sessions
1596
- */
1597
- interface CreateSessionRequest {
1598
- id: string;
1599
14
  env?: Record<string, string>;
1600
15
  cwd?: string;
1601
- }
1602
- /**
1603
- * Response interface for creating sessions
1604
- */
1605
- interface CreateSessionResponse extends BaseApiResponse {
1606
- id: string;
1607
- message: string;
1608
- }
1609
- /**
1610
- * Request interface for deleting sessions
1611
- */
1612
- interface DeleteSessionRequest {
1613
- sessionId: string;
1614
- }
1615
- /**
1616
- * Response interface for deleting sessions
1617
- */
1618
- interface DeleteSessionResponse extends BaseApiResponse {
1619
- sessionId: string;
1620
- }
1621
- /**
1622
- * Client for health checks and utility operations
1623
- */
1624
- declare class UtilityClient extends BaseHttpClient {
1625
- /**
1626
- * Ping the sandbox to check if it's responsive
1627
- */
1628
- ping(): Promise<string>;
1629
- /**
1630
- * Get list of available commands in the sandbox environment
1631
- */
1632
- getCommands(): Promise<string[]>;
1633
- /**
1634
- * Create a new execution session
1635
- * @param options - Session configuration (id, env, cwd)
1636
- */
1637
- createSession(options: CreateSessionRequest): Promise<CreateSessionResponse>;
1638
- /**
1639
- * Delete an execution session
1640
- * @param sessionId - Session ID to delete
1641
- */
1642
- deleteSession(sessionId: string): Promise<DeleteSessionResponse>;
1643
- /**
1644
- * Get the container version
1645
- * Returns the version embedded in the Docker image during build
1646
- */
1647
- getVersion(): Promise<string>;
1648
- }
1649
- //#endregion
1650
- //#region src/clients/sandbox-client.d.ts
1651
- /**
1652
- * Main sandbox client that composes all domain-specific clients
1653
- * Provides organized access to all sandbox functionality
1654
- */
1655
- declare class SandboxClient {
1656
- readonly commands: CommandClient;
1657
- readonly files: FileClient;
1658
- readonly processes: ProcessClient;
1659
- readonly ports: PortClient;
1660
- readonly git: GitClient;
1661
- readonly interpreter: InterpreterClient;
1662
- readonly utils: UtilityClient;
1663
- constructor(options: HttpClientOptions);
1664
- }
1665
- //#endregion
1666
- //#region src/sandbox.d.ts
1667
- declare function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string, options?: SandboxOptions): Sandbox;
1668
- declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
1669
- defaultPort: number;
1670
- sleepAfter: string | number;
1671
- client: SandboxClient;
1672
- private codeInterpreter;
1673
- private sandboxName;
1674
- private baseUrl;
1675
- private portTokens;
1676
- private defaultSession;
1677
- envVars: Record<string, string>;
1678
- private logger;
1679
- private keepAliveEnabled;
1680
- constructor(ctx: DurableObjectState<{}>, env: Env);
1681
- setSandboxName(name: string): Promise<void>;
1682
- setBaseUrl(baseUrl: string): Promise<void>;
1683
- setSleepAfter(sleepAfter: string | number): Promise<void>;
1684
- setKeepAlive(keepAlive: boolean): Promise<void>;
1685
- setEnvVars(envVars: Record<string, string>): Promise<void>;
1686
- /**
1687
- * Cleanup and destroy the sandbox container
1688
- */
1689
- destroy(): Promise<void>;
1690
- onStart(): void;
1691
- /**
1692
- * Check if the container version matches the SDK version
1693
- * Logs a warning if there's a mismatch
1694
- */
1695
- private checkVersionCompatibility;
1696
- onStop(): void;
1697
- onError(error: unknown): void;
1698
- /**
1699
- * Override onActivityExpired to prevent automatic shutdown when keepAlive is enabled
1700
- * When keepAlive is disabled, calls parent implementation which stops the container
1701
- */
1702
- onActivityExpired(): Promise<void>;
1703
- fetch(request: Request): Promise<Response>;
1704
- wsConnect(request: Request, port: number): Promise<Response>;
1705
- private determinePort;
1706
- /**
1707
- * Ensure default session exists - lazy initialization
1708
- * This is called automatically by all public methods that need a session
1709
- *
1710
- * The session is persisted to Durable Object storage to survive hot reloads
1711
- * during development. If a session already exists in the container after reload,
1712
- * we reuse it instead of trying to create a new one.
1713
- */
1714
- private ensureDefaultSession;
1715
- exec(command: string, options?: ExecOptions): Promise<ExecResult>;
1716
- /**
1717
- * Internal session-aware exec implementation
1718
- * Used by both public exec() and session wrappers
1719
- */
1720
- private execWithSession;
1721
- private executeWithStreaming;
1722
- private mapExecuteResponseToExecResult;
1723
- /**
1724
- * Create a Process domain object from HTTP client DTO
1725
- * Centralizes process object creation with bound methods
1726
- * This eliminates duplication across startProcess, listProcesses, getProcess, and session wrappers
1727
- */
1728
- private createProcessFromDTO;
1729
- startProcess(command: string, options?: ProcessOptions, sessionId?: string): Promise<Process>;
1730
- listProcesses(sessionId?: string): Promise<Process[]>;
1731
- getProcess(id: string, sessionId?: string): Promise<Process | null>;
1732
- killProcess(id: string, signal?: string, sessionId?: string): Promise<void>;
1733
- killAllProcesses(sessionId?: string): Promise<number>;
1734
- cleanupCompletedProcesses(sessionId?: string): Promise<number>;
1735
- getProcessLogs(id: string, sessionId?: string): Promise<{
1736
- stdout: string;
1737
- stderr: string;
1738
- processId: string;
1739
- }>;
1740
- execStream(command: string, options?: StreamOptions): Promise<ReadableStream<Uint8Array>>;
1741
- /**
1742
- * Internal session-aware execStream implementation
1743
- */
1744
- private execStreamWithSession;
1745
- /**
1746
- * Stream logs from a background process as a ReadableStream.
1747
- */
1748
- streamProcessLogs(processId: string, options?: {
1749
- signal?: AbortSignal;
1750
- }): Promise<ReadableStream<Uint8Array>>;
1751
- gitCheckout(repoUrl: string, options: {
1752
- branch?: string;
1753
- targetDir?: string;
1754
- sessionId?: string;
1755
- }): Promise<GitCheckoutResult>;
1756
- mkdir(path: string, options?: {
1757
- recursive?: boolean;
1758
- sessionId?: string;
1759
- }): Promise<MkdirResult>;
1760
- writeFile(path: string, content: string, options?: {
1761
- encoding?: string;
1762
- sessionId?: string;
1763
- }): Promise<WriteFileResult>;
1764
- deleteFile(path: string, sessionId?: string): Promise<DeleteFileResult>;
1765
- renameFile(oldPath: string, newPath: string, sessionId?: string): Promise<RenameFileResult>;
1766
- moveFile(sourcePath: string, destinationPath: string, sessionId?: string): Promise<MoveFileResult>;
1767
- readFile(path: string, options?: {
1768
- encoding?: string;
1769
- sessionId?: string;
1770
- }): Promise<ReadFileResult>;
1771
- /**
1772
- * Stream a file from the sandbox using Server-Sent Events
1773
- * Returns a ReadableStream that can be consumed with streamFile() or collectFile() utilities
1774
- * @param path - Path to the file to stream
1775
- * @param options - Optional session ID
1776
- */
1777
- readFileStream(path: string, options?: {
1778
- sessionId?: string;
1779
- }): Promise<ReadableStream<Uint8Array>>;
1780
- listFiles(path: string, options?: {
1781
- recursive?: boolean;
1782
- includeHidden?: boolean;
1783
- }): Promise<ListFilesResult>;
1784
- exists(path: string, sessionId?: string): Promise<FileExistsResult>;
1785
- exposePort(port: number, options: {
1786
- name?: string;
1787
- hostname: string;
1788
- }): Promise<{
1789
- url: string;
1790
- port: number;
1791
- name: string | undefined;
1792
- }>;
1793
- unexposePort(port: number): Promise<void>;
1794
- getExposedPorts(hostname: string): Promise<{
1795
- url: string;
1796
- port: number;
1797
- status: "active" | "inactive";
1798
- }[]>;
1799
- isPortExposed(port: number): Promise<boolean>;
1800
- validatePortToken(port: number, token: string): Promise<boolean>;
1801
- private generatePortToken;
1802
- private persistPortTokens;
1803
- private constructPreviewUrl;
1804
- /**
1805
- * Create isolated execution session for advanced use cases
1806
- * Returns ExecutionSession with full sandbox API bound to specific session
1807
- */
1808
- createSession(options?: SessionOptions): Promise<ExecutionSession>;
1809
- /**
1810
- * Get an existing session by ID
1811
- * Returns ExecutionSession wrapper bound to the specified session
1812
- *
1813
- * This is useful for retrieving sessions across different requests/contexts
1814
- * without storing the ExecutionSession object (which has RPC lifecycle limitations)
1815
- *
1816
- * @param sessionId - The ID of an existing session
1817
- * @returns ExecutionSession wrapper bound to the session
1818
- */
1819
- getSession(sessionId: string): Promise<ExecutionSession>;
1820
- /**
1821
- * Delete an execution session
1822
- * Cleans up session resources and removes it from the container
1823
- * Note: Cannot delete the default session. To reset the default session,
1824
- * use sandbox.destroy() to terminate the entire sandbox.
1825
- *
1826
- * @param sessionId - The ID of the session to delete
1827
- * @returns Result with success status, sessionId, and timestamp
1828
- * @throws Error if attempting to delete the default session
1829
- */
1830
- deleteSession(sessionId: string): Promise<SessionDeleteResult>;
1831
- /**
1832
- * Internal helper to create ExecutionSession wrapper for a given sessionId
1833
- * Used by both createSession and getSession
1834
- */
1835
- private getSessionWrapper;
1836
- createCodeContext(options?: CreateContextOptions): Promise<CodeContext>;
1837
- runCode(code: string, options?: RunCodeOptions): Promise<ExecutionResult>;
1838
- runCodeStream(code: string, options?: RunCodeOptions): Promise<ReadableStream>;
1839
- listCodeContexts(): Promise<CodeContext[]>;
1840
- deleteCodeContext(contextId: string): Promise<void>;
16
+ encoding?: string;
17
+ autoCleanup?: boolean;
1841
18
  }
1842
19
  //#endregion
1843
20
  //#region src/file-stream.d.ts
@@ -1949,5 +126,88 @@ declare function asyncIterableToSSEStream<T>(events: AsyncIterable<T>, options?:
1949
126
  serialize?: (event: T) => string;
1950
127
  }): ReadableStream<Uint8Array>;
1951
128
  //#endregion
1952
- export { type BaseApiResponse, type BaseExecOptions, type ChartData, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, type ContainerStub, ContextCreateResult, ContextDeleteResult, ContextListResult, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, DeleteFileRequest, DeleteFileResult, type DeleteSessionRequest, type DeleteSessionResponse, EnvSetResult, type ErrorResponse, type ExecEvent, type ExecOptions, type ExecResult, type ExecuteRequest, Execution, type ExecutionCallbacks, type ExecutionError, type ExecutionResult, ExecutionSession, type ExposePortRequest, type FileChunk, FileClient, FileExistsRequest, FileExistsResult, FileInfo, type FileMetadata, type FileOperationRequest, type FileStreamEvent, type GitCheckoutRequest, type GitCheckoutResult, GitClient, GitLogger, HealthCheckResult, type ISandbox, type InterpreterClient, InterpreterHealthResult, ListFilesOptions, ListFilesResult, type LogContext, type LogEvent, type LogLevel, LogLevel as LogLevelEnum, type Logger, type MkdirRequest, MkdirResult, MoveFileRequest, MoveFileResult, type OutputMessage, type PingResponse, PortClient, type PortCloseResult, type PortExposeResult, type PortListResult, PortStatusResult, type Process, type ProcessCleanupResult, ProcessClient, type ProcessInfoResult, type ProcessKillResult, type ProcessListResult, type ProcessLogsResult, type ProcessOptions, type ProcessStartResult, type ProcessStatus, type ReadFileRequest, ReadFileResult, RenameFileRequest, RenameFileResult, type RequestConfig, type ResponseHandler, type Result, ResultImpl, type RouteInfo, type RunCodeOptions, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, SandboxOptions, SessionCreateRequest, SessionCreateResult, SessionDeleteRequest, SessionDeleteResult, SessionOptions, type SessionRequest, ShutdownResult, type StartProcessRequest, type StreamOptions, TraceContext, type UnexposePortRequest, UtilityClient, type WriteFileRequest, WriteFileResult, asyncIterableToSSEStream, collectFile, createLogger, createNoOpLogger, getLogger, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyToSandbox, redactCredentials, responseToAsyncIterable, runWithLogger, sanitizeGitData, streamFile };
129
+ //#region ../shared/dist/errors/codes.d.ts
130
+ /**
131
+ * Centralized error code registry
132
+ * Each code maps to a specific error type with consistent semantics
133
+ */
134
+ declare const ErrorCode: {
135
+ readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
136
+ readonly PERMISSION_DENIED: "PERMISSION_DENIED";
137
+ readonly FILE_EXISTS: "FILE_EXISTS";
138
+ readonly IS_DIRECTORY: "IS_DIRECTORY";
139
+ readonly NOT_DIRECTORY: "NOT_DIRECTORY";
140
+ readonly NO_SPACE: "NO_SPACE";
141
+ readonly TOO_MANY_FILES: "TOO_MANY_FILES";
142
+ readonly RESOURCE_BUSY: "RESOURCE_BUSY";
143
+ readonly READ_ONLY: "READ_ONLY";
144
+ readonly NAME_TOO_LONG: "NAME_TOO_LONG";
145
+ readonly TOO_MANY_LINKS: "TOO_MANY_LINKS";
146
+ readonly FILESYSTEM_ERROR: "FILESYSTEM_ERROR";
147
+ readonly COMMAND_NOT_FOUND: "COMMAND_NOT_FOUND";
148
+ readonly COMMAND_PERMISSION_DENIED: "COMMAND_PERMISSION_DENIED";
149
+ readonly INVALID_COMMAND: "INVALID_COMMAND";
150
+ readonly COMMAND_EXECUTION_ERROR: "COMMAND_EXECUTION_ERROR";
151
+ readonly STREAM_START_ERROR: "STREAM_START_ERROR";
152
+ readonly PROCESS_NOT_FOUND: "PROCESS_NOT_FOUND";
153
+ readonly PROCESS_PERMISSION_DENIED: "PROCESS_PERMISSION_DENIED";
154
+ readonly PROCESS_ERROR: "PROCESS_ERROR";
155
+ readonly PORT_ALREADY_EXPOSED: "PORT_ALREADY_EXPOSED";
156
+ readonly PORT_IN_USE: "PORT_IN_USE";
157
+ readonly PORT_NOT_EXPOSED: "PORT_NOT_EXPOSED";
158
+ readonly INVALID_PORT_NUMBER: "INVALID_PORT_NUMBER";
159
+ readonly INVALID_PORT: "INVALID_PORT";
160
+ readonly SERVICE_NOT_RESPONDING: "SERVICE_NOT_RESPONDING";
161
+ readonly PORT_OPERATION_ERROR: "PORT_OPERATION_ERROR";
162
+ readonly CUSTOM_DOMAIN_REQUIRED: "CUSTOM_DOMAIN_REQUIRED";
163
+ readonly GIT_REPOSITORY_NOT_FOUND: "GIT_REPOSITORY_NOT_FOUND";
164
+ readonly GIT_BRANCH_NOT_FOUND: "GIT_BRANCH_NOT_FOUND";
165
+ readonly GIT_AUTH_FAILED: "GIT_AUTH_FAILED";
166
+ readonly GIT_NETWORK_ERROR: "GIT_NETWORK_ERROR";
167
+ readonly INVALID_GIT_URL: "INVALID_GIT_URL";
168
+ readonly GIT_CLONE_FAILED: "GIT_CLONE_FAILED";
169
+ readonly GIT_CHECKOUT_FAILED: "GIT_CHECKOUT_FAILED";
170
+ readonly GIT_OPERATION_FAILED: "GIT_OPERATION_FAILED";
171
+ readonly BUCKET_MOUNT_ERROR: "BUCKET_MOUNT_ERROR";
172
+ readonly S3FS_MOUNT_ERROR: "S3FS_MOUNT_ERROR";
173
+ readonly MISSING_CREDENTIALS: "MISSING_CREDENTIALS";
174
+ readonly INVALID_MOUNT_CONFIG: "INVALID_MOUNT_CONFIG";
175
+ readonly INTERPRETER_NOT_READY: "INTERPRETER_NOT_READY";
176
+ readonly CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND";
177
+ readonly CODE_EXECUTION_ERROR: "CODE_EXECUTION_ERROR";
178
+ readonly VALIDATION_FAILED: "VALIDATION_FAILED";
179
+ readonly INVALID_JSON_RESPONSE: "INVALID_JSON_RESPONSE";
180
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
181
+ readonly INTERNAL_ERROR: "INTERNAL_ERROR";
182
+ };
183
+ type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
184
+ //#endregion
185
+ //#region src/storage-mount/errors.d.ts
186
+ /**
187
+ * Base error for bucket mounting operations
188
+ */
189
+ declare class BucketMountError extends Error {
190
+ readonly code: ErrorCode;
191
+ constructor(message: string, code?: ErrorCode);
192
+ }
193
+ /**
194
+ * Thrown when S3FS mount command fails
195
+ */
196
+ declare class S3FSMountError extends BucketMountError {
197
+ constructor(message: string);
198
+ }
199
+ /**
200
+ * Thrown when no credentials found in environment
201
+ */
202
+ declare class MissingCredentialsError extends BucketMountError {
203
+ constructor(message: string);
204
+ }
205
+ /**
206
+ * Thrown when bucket name, mount path, or options are invalid
207
+ */
208
+ declare class InvalidMountConfigError extends BucketMountError {
209
+ constructor(message: string);
210
+ }
211
+ //#endregion
212
+ export { type BaseApiResponse, type BaseExecOptions, type BucketCredentials, BucketMountError, type BucketProvider, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, type ContainerStub, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, type DeleteSessionRequest, type DeleteSessionResponse, type ErrorResponse, type ExecEvent, type ExecOptions, type ExecResult, type ExecuteRequest, type ExecutionCallbacks, type ExecutionResult, type ExecutionSession, type ExposePortRequest, type FileChunk, FileClient, type FileMetadata, type FileOperationRequest, type FileStreamEvent, type GitCheckoutRequest, type GitCheckoutResult, GitClient, type ISandbox, type InterpreterClient, InvalidMountConfigError, type ListFilesOptions, type LogEvent, MissingCredentialsError, type MkdirRequest, type MountBucketOptions, type PingResponse, PortClient, type PortCloseResult, type PortExposeResult, type PortListResult, type Process, type ProcessCleanupResult, ProcessClient, type ProcessInfoResult, type ProcessKillResult, type ProcessListResult, type ProcessLogsResult, type ProcessOptions, type ProcessStartResult, type ProcessStatus, type ReadFileRequest, type RequestConfig, type ResponseHandler, type RouteInfo, type RunCodeOptions, S3FSMountError, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, type SandboxOptions, type SessionOptions, type SessionRequest, type StartProcessRequest, type StreamOptions, type UnexposePortRequest, UtilityClient, type WriteFileRequest, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyToSandbox, responseToAsyncIterable, streamFile };
1953
213
  //# sourceMappingURL=index.d.ts.map