@cloudflare/sandbox 0.0.0-0608f1e → 0.0.0-0dad837

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/src/types.ts CHANGED
@@ -342,6 +342,14 @@ export interface GetProcessLogsResponse {
342
342
  processId: string;
343
343
  }
344
344
 
345
+ // Import code interpreter types
346
+ import type {
347
+ CodeContext,
348
+ CreateContextOptions,
349
+ ExecutionResult,
350
+ RunCodeOptions
351
+ } from './interpreter-types';
352
+
345
353
  // Main Sandbox Interface
346
354
 
347
355
  export interface ISandbox {
@@ -362,6 +370,123 @@ export interface ISandbox {
362
370
  // Utility methods
363
371
  cleanupCompletedProcesses(): Promise<number>;
364
372
  getProcessLogs(id: string): Promise<{ stdout: string; stderr: string }>;
373
+
374
+ // File operations
375
+ gitCheckout(repoUrl: string, options: { branch?: string; targetDir?: string }): Promise<GitCheckoutResponse>;
376
+ mkdir(path: string, options?: { recursive?: boolean }): Promise<MkdirResponse>;
377
+ writeFile(path: string, content: string, options?: { encoding?: string }): Promise<WriteFileResponse>;
378
+ deleteFile(path: string): Promise<DeleteFileResponse>;
379
+ renameFile(oldPath: string, newPath: string): Promise<RenameFileResponse>;
380
+ moveFile(sourcePath: string, destinationPath: string): Promise<MoveFileResponse>;
381
+ readFile(path: string, options?: { encoding?: string }): Promise<ReadFileResponse>;
382
+ listFiles(path: string, options?: { recursive?: boolean; includeHidden?: boolean }): Promise<ListFilesResponse>;
383
+
384
+ // Port management
385
+ exposePort(port: number, options: { name?: string; hostname: string }): Promise<{ url: string; port: number; name?: string }>;
386
+ unexposePort(port: number): Promise<void>;
387
+ getExposedPorts(hostname: string): Promise<Array<{ url: string; port: number; name?: string; exposedAt: string }>>;
388
+
389
+ // Environment management
390
+ setEnvVars(envVars: Record<string, string>): Promise<void>;
391
+ setSandboxName(name: string): Promise<void>;
392
+
393
+ // Code Interpreter API
394
+ createCodeContext(options?: CreateContextOptions): Promise<CodeContext>;
395
+ runCode(code: string, options?: RunCodeOptions): Promise<ExecutionResult>;
396
+ runCodeStream(code: string, options?: RunCodeOptions): Promise<ReadableStream>;
397
+ listCodeContexts(): Promise<CodeContext[]>;
398
+ deleteCodeContext(contextId: string): Promise<void>;
399
+ }
400
+
401
+ // API Response Types
402
+
403
+ export interface ExecuteResponse {
404
+ success: boolean;
405
+ stdout: string;
406
+ stderr: string;
407
+ exitCode: number;
408
+ command: string;
409
+ timestamp: string;
410
+ }
411
+
412
+ export interface GitCheckoutResponse {
413
+ success: boolean;
414
+ stdout: string;
415
+ stderr: string;
416
+ exitCode: number;
417
+ repoUrl: string;
418
+ branch: string;
419
+ targetDir: string;
420
+ timestamp: string;
421
+ }
422
+
423
+ export interface MkdirResponse {
424
+ success: boolean;
425
+ stdout: string;
426
+ stderr: string;
427
+ exitCode: number;
428
+ path: string;
429
+ recursive: boolean;
430
+ timestamp: string;
431
+ }
432
+
433
+ export interface WriteFileResponse {
434
+ success: boolean;
435
+ exitCode: number;
436
+ path: string;
437
+ timestamp: string;
438
+ }
439
+
440
+ export interface ReadFileResponse {
441
+ success: boolean;
442
+ exitCode: number;
443
+ path: string;
444
+ content: string;
445
+ timestamp: string;
446
+ }
447
+
448
+ export interface DeleteFileResponse {
449
+ success: boolean;
450
+ exitCode: number;
451
+ path: string;
452
+ timestamp: string;
453
+ }
454
+
455
+ export interface RenameFileResponse {
456
+ success: boolean;
457
+ exitCode: number;
458
+ oldPath: string;
459
+ newPath: string;
460
+ timestamp: string;
461
+ }
462
+
463
+ export interface MoveFileResponse {
464
+ success: boolean;
465
+ exitCode: number;
466
+ sourcePath: string;
467
+ destinationPath: string;
468
+ timestamp: string;
469
+ }
470
+
471
+ export interface ListFilesResponse {
472
+ success: boolean;
473
+ exitCode: number;
474
+ path: string;
475
+ files: Array<{
476
+ name: string;
477
+ absolutePath: string;
478
+ relativePath: string;
479
+ type: 'file' | 'directory' | 'symlink' | 'other';
480
+ size: number;
481
+ modifiedAt: string;
482
+ mode: string;
483
+ permissions: {
484
+ readable: boolean;
485
+ writable: boolean;
486
+ executable: boolean;
487
+ };
488
+ }>;
489
+ timestamp: string;
365
490
  }
366
491
 
367
492
  // Type Guards
package/tsconfig.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "extends": "../../tsconfig.json"
2
+ "extends": "../../tsconfig.base.json"
3
3
  }