@tangle-network/sandbox 1.0.235 → 1.0.237

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 (49) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +5 -5
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +1 -1
  5. package/dist/{agent-run-outcome-CEf6hJYp.d.ts → agent-run-outcome-DkEeNhH6.d.ts} +2 -2
  6. package/dist/{api-request-DY_5Hnyl.js → api-request-Cm1H_xsv.js} +1 -1
  7. package/dist/{browser-interactive-control-controller-DJGhiJCm.js → browser-interactive-control-controller-CrBx8ETe.js} +1 -1
  8. package/dist/{browser-interactive-control-controller-CcUjQEfa.d.ts → browser-interactive-control-controller-JSGfFeNB.d.ts} +1 -1
  9. package/dist/{chunked-upload-BlvgxPWx.js → chunked-upload-B1kuuezC.js} +1 -1
  10. package/dist/{chunked-upload-file-DOeLpMO0.js → chunked-upload-file-JfRw6PRf.js} +1 -1
  11. package/dist/{client-DN1BxvDF.js → client-Crwo3vqo.js} +5 -5
  12. package/dist/{client-OYkwBKG2.d.ts → client-Cy6Zlb3W.d.ts} +5 -5
  13. package/dist/collaboration/index.js +1 -1
  14. package/dist/{collaboration-CdPAEN0W.js → collaboration-k3yUVGgP.js} +2 -2
  15. package/dist/core.d.ts +7 -7
  16. package/dist/core.js +6 -6
  17. package/dist/{errors-nXGKGVFe.js → errors-DQEu-Q7s.js} +20 -21
  18. package/dist/{file-download-BjkrYzy_.js → file-download-DXgIe-CV.js} +1 -1
  19. package/dist/{index-C8YpXh5N.d.ts → index-DYxmMGbU.d.ts} +12 -87
  20. package/dist/index.d.ts +10 -10
  21. package/dist/index.js +12 -12
  22. package/dist/intelligence/index.js +3 -3
  23. package/dist/interactive-control.d.ts +1 -1
  24. package/dist/interactive-control.js +1 -1
  25. package/dist/{interactive-controller-CJ7BBRpv.d.ts → interactive-controller-DaBe9oR5.d.ts} +3 -3
  26. package/dist/{interactive-controller-D4aEHlv_.js → interactive-controller-mqraKMkh.js} +4 -4
  27. package/dist/{lines-CSGBHEjR.js → lines-Bsp1TFBM.js} +1 -1
  28. package/dist/{lines-CCJZUrBP.d.ts → lines-DfKFyMTA.d.ts} +1 -1
  29. package/dist/lines.d.ts +1 -1
  30. package/dist/lines.js +1 -1
  31. package/dist/{mcp-local-X2JhwaO9.js → mcp-local-DV-BvoUI.js} +2 -2
  32. package/dist/{preview-zpWYtsDJ.d.ts → preview-BqicYuSJ.d.ts} +3 -3
  33. package/dist/{public-templates-DCFFPDEB.d.ts → public-templates-Bk843Kqc.d.ts} +2 -2
  34. package/dist/public-templates.d.ts +1 -1
  35. package/dist/public-templates.js +1 -1
  36. package/dist/{raw-evidence-archive-Cz4j8VMw.js → raw-evidence-archive-XEDh0VUj.js} +1 -1
  37. package/dist/runtime.d.ts +5 -5
  38. package/dist/runtime.js +5 -5
  39. package/dist/{sandbox-hH0ULBcR.js → sandbox-DnuEGRn4.js} +44 -90
  40. package/dist/{select-seat-B4Y-7vIq.js → select-seat-CntQ4bko.js} +1 -1
  41. package/dist/select-seat-command.d.ts +2 -2
  42. package/dist/select-seat-command.js +2 -2
  43. package/dist/session-gateway/index.js +1 -1
  44. package/dist/tangle/index.d.ts +1 -1
  45. package/dist/tangle/index.js +1 -1
  46. package/dist/{tangle-CGi0LnU1.js → tangle-DjcPKCqo.js} +3 -3
  47. package/dist/{terminal-stream-types-eE97lZ-5.d.ts → terminal-stream-types-DBQuAsmB.d.ts} +13 -7
  48. package/dist/{types-B5GAxo6l.d.ts → types-C8aazs-y.d.ts} +297 -1178
  49. package/package.json +6 -6
@@ -1,4 +1,4 @@
1
- import { Ct as InteractionRequest, Dt as AgentProfileConfidential, Et as AgentProfileCapabilities, It as ProxySecretReceipt, Nt as AgentProfileValidationResult, Pt as ReasoningEffort, Rt as PlanContinuation, Tt as AgentProfile, Z as BatchBackendInput, a as TerminalStreamOptions, g as TerminalReadyInfo, i as TerminalStreamHandlers, nt as SandboxSizePreset, q as SandboxCreateReceipt, rt as AgentRuntimeAttachments, s as TerminalStreamToken, t as TerminalAttachTimings, yt as AgentExactRunControlRef } from "./terminal-stream-types-eE97lZ-5.js";
1
+ import { $ as BatchBackendInput, B as SandboxErrorMetadata, Bt as PlanContinuation, Dt as AgentProfile, Ft as AgentProfileValidationResult, It as ReasoningEffort, Ot as AgentProfileCapabilities, Rt as ProxySecretReceipt, Tt as InteractionRequest, Y as SandboxCreateReceipt, a as TerminalStreamOptions, at as AgentRuntimeAttachments, g as TerminalReadyInfo, i as TerminalStreamHandlers, it as SandboxSizePreset, kt as AgentProfileConfidential, s as TerminalStreamToken, t as TerminalAttachTimings, xt as AgentExactRunControlRef } from "./terminal-stream-types-DBQuAsmB.js";
2
2
  import { t as CliAuthReference } from "./cli-auth-bundle-B91fSxkR.js";
3
3
  import { z } from "zod";
4
4
  //#region ../../../packages/runtime-contracts/dist/backend-types.d.ts
@@ -2607,9 +2607,7 @@ interface JsonRecord {
2607
2607
  }
2608
2608
  //#endregion
2609
2609
  //#region src/types/client.d.ts
2610
- /**
2611
- * HTTP client interface for making requests.
2612
- */
2610
+ /** HTTP request transport; SDK_TIMEOUTS owns default deadlines. */
2613
2611
  interface HttpClient {
2614
2612
  fetch(path: string, options?: RequestInit, fetchOptions?: {
2615
2613
  timeoutMs?: number;
@@ -3139,33 +3137,23 @@ interface SearchMatch {
3139
3137
  }
3140
3138
  //#endregion
3141
3139
  //#region src/types/files.d.ts
3142
- /**
3143
- * Detailed file/directory information.
3144
- */
3145
3140
  type FileInfo = Omit<FsEntryInfo, "modTime" | "accessTime"> & {
3146
- /** Last modification time. */modTime: Date; /** Last access time. */
3141
+ modTime: Date;
3147
3142
  accessTime: Date;
3148
3143
  };
3149
- /** File metadata returned by the recursive workspace tree endpoint. */
3150
3144
  type FileTreeFile = FileTreeResponse["data"]["files"][number];
3151
- /** Options for recursively scanning a workspace tree. */
3152
3145
  interface FileTreeOptions {
3153
3146
  sessionId?: string;
3154
3147
  maxDepth?: number;
3155
3148
  }
3156
- /** Recursive workspace tree with scan statistics. */
3157
3149
  type FileTreeResult = FileTreeResponse["data"];
3158
- /** Options for measuring aggregate workspace storage usage. */
3159
3150
  interface FileUsageOptions {
3160
3151
  /** Task session id for session-specific workspace isolation. */
3161
3152
  sessionId?: string;
3162
3153
  }
3163
3154
  /**
3164
- * Aggregate apparent storage usage for a customer workspace.
3165
- *
3166
- * Hidden files, dependency trees, caches, and build output are included.
3167
- * Runtime-owned `.sidecar` directories are excluded, and symlinks are counted
3168
- * by their own metadata without following their targets.
3155
+ * Apparent workspace bytes include hidden files, dependencies, caches and build
3156
+ * output. Excludes runtime .sidecar roots; counts symlinks without following them.
3169
3157
  */
3170
3158
  interface FileUsageResult {
3171
3159
  /** Observational snapshot only; never a quota or billing authority. */
@@ -3178,15 +3166,12 @@ interface FileUsageResult {
3178
3166
  };
3179
3167
  /** Scanned root, relative to the workspace when applicable. */
3180
3168
  root: string;
3181
- /** Sum of regular-file and symlink apparent sizes. */
3182
3169
  sizeBytes: number;
3183
- /** Number of regular files and symlinks. */
3184
3170
  fileCount: number;
3185
3171
  /** Number of customer-owned directories, excluding the root. */
3186
3172
  directoryCount: number;
3187
3173
  /** Latest observed modification time as Unix milliseconds. */
3188
3174
  lastModifiedMs: number;
3189
- /** Time spent scanning the workspace. */
3190
3175
  scanDurationMs: number;
3191
3176
  /** False when limits or unreadable entries prevented a complete result. */
3192
3177
  complete: boolean;
@@ -3232,20 +3217,16 @@ interface FileUsageResult {
3232
3217
  availableBytes: number;
3233
3218
  };
3234
3219
  }
3235
- /** File content and metadata returned by a batch read. */
3236
3220
  type FileReadResult = FileReadResult$1;
3237
- /** One file that could not be read during a partial-success batch. */
3238
3221
  interface FileReadError {
3239
3222
  path: string;
3240
3223
  error: string;
3241
3224
  code?: string;
3242
3225
  }
3243
- /** Options for reading files in a batch. */
3244
3226
  interface FileReadBatchOptions {
3245
3227
  encoding?: "utf8" | "base64";
3246
3228
  sessionId?: string;
3247
3229
  }
3248
- /** Partial-success result from a batch file read. */
3249
3230
  interface FileReadBatchResult {
3250
3231
  files: FileReadResult[];
3251
3232
  errors: FileReadError[];
@@ -3255,109 +3236,84 @@ interface FileReadBatchResult {
3255
3236
  failed: number;
3256
3237
  };
3257
3238
  }
3258
- /** Metadata returned after a successful file write. */
3259
3239
  type FileWriteResult = FileWriteResult$1 & {
3260
3240
  encoding?: "utf8" | "base64";
3261
3241
  };
3262
- /** Metadata returned after a successful file or directory rename. */
3263
3242
  type FileRenameResult = FileRenameResult$1;
3264
- /**
3265
- * Options for uploading files.
3266
- */
3267
3243
  interface UploadOptions {
3268
3244
  /** Overwrite if file exists (default: true) */
3269
3245
  overwrite?: boolean;
3270
3246
  /** Set file permissions (Unix mode, e.g., 0o644) */
3271
3247
  permissions?: number;
3272
- /** Progress callback for large files */
3273
3248
  onProgress?: (progress: UploadProgress) => void;
3274
3249
  }
3275
- /**
3276
- * Upload progress information.
3277
- */
3278
3250
  interface UploadProgress {
3279
- /** Bytes uploaded so far */
3280
3251
  bytesUploaded: number;
3281
- /** Total bytes to upload */
3282
3252
  totalBytes: number;
3283
- /** Percentage complete (0-100) */
3284
3253
  percentage: number;
3285
3254
  }
3286
- /** A caller-supplied part codec. The SDK ships gzip (Web-standard
3287
- * CompressionStream, zero deps, every runtime); zstd beats it on ratio and
3288
- * speed but needs native/WASM support, so Node consumers inject
3289
- * `node:zlib`'s zstd and browsers stay gzip. Returning null degrades the
3290
- * part to the next codec in the preference chain. */
3291
- type ChunkCodec = (bytes: Uint8Array<ArrayBuffer>) => Promise<Uint8Array<ArrayBuffer> | null>;
3292
3255
  /**
3293
- * Options for {@link FileSystem.uploadData}.
3256
+ * Optional part codec; null tries the next preference. Gzip is built in via
3257
+ * CompressionStream; native/WASM zstd may be supplied where negotiated.
3294
3258
  */
3259
+ type ChunkCodec = (bytes: Uint8Array<ArrayBuffer>) => Promise<Uint8Array<ArrayBuffer> | null>;
3295
3260
  interface ChunkedUploadOptions {
3296
3261
  /** Unix mode bits applied to the file after upload, e.g. 0o644. */
3297
3262
  mode?: number;
3298
- /** Progress callback fired after each part completes. On the rare
3299
- * checksum-mismatch recovery (one automatic full re-upload),
3300
- * `bytesUploaded` restarts from 0 for the second pass. */
3263
+ /**
3264
+ * Reports completed parts; one full checksum-mismatch recovery restarts
3265
+ * bytesUploaded at zero.
3266
+ */
3301
3267
  onProgress?: (progress: UploadProgress) => void;
3302
- /** Cancel the upload. A pending upload session is best-effort deleted
3303
- * server-side when the signal fires mid-flow. */
3268
+ /** Cancel and best-effort delete its pending server upload session. */
3304
3269
  signal?: AbortSignal;
3305
3270
  /** Delay between part PUTs (ms) to pace bursts. 0 disables pacing (default). */
3306
3271
  paceMs?: number;
3307
- /** Concurrent part uploads. Parts are indexed and verified at commit, so
3308
- * out-of-order completion is safe; the default 4 (max 8) keeps one session
3309
- * polite to the server's staging budget. */
3272
+ /**
3273
+ * Concurrent parts; indexed commit verifies out-of-order completion. Chunked-upload
3274
+ * transport owns default/maximum concurrency.
3275
+ */
3310
3276
  concurrency?: number;
3311
- /** Per-part compression on the wire (staged bytes and the commit SHA stay
3312
- * raw). `"auto"` (default) probes part 0 and skips compression when the
3313
- * payload is incompressible; `true` always compresses; `false` never.
3314
- * gzip (Web-standard CompressionStream) is the universal floor; supply a
3315
- * zstd codec via {@link codecs} when the runtime negotiated it.
3316
- * Runtimes without `CompressionStream` degrade to raw parts. */
3277
+ /**
3278
+ * Compress wire parts, leaving staged bytes/commit SHA raw. Auto (default) probes
3279
+ * part zero; true always compresses; false sends raw. Gzip is built in; negotiated
3280
+ * zstd uses codecs. Without CompressionStream, falls back to raw.
3281
+ */
3317
3282
  compression?: boolean | "auto";
3318
- /** Optional extra part codecs, keyed by wire encoding. The SDK ships gzip
3319
- * everywhere; zstd beats it on ratio and speed but needs native/WASM
3320
- * support — Node consumers wire `node:zlib`'s zstd, browsers stay gzip.
3321
- * A codec is used only when the runtime's init response negotiated it. */
3283
+ /** Inject zstd only when runtime init negotiates it; see ChunkCodec. */
3322
3284
  codecs?: {
3323
3285
  zstd?: ChunkCodec;
3324
3286
  };
3325
- /** Fires once, immediately after the session is initialized — persist the
3326
- * uploadId to make an interrupted upload resumable
3327
- * (`keepSessionOnFailure` + `resumeChunkedUpload`). */
3287
+ /**
3288
+ * Called once after init; persist uploadId to resume with
3289
+ * keepSessionOnFailure/resumeChunkedUpload.
3290
+ */
3328
3291
  onSession?: (session: {
3329
3292
  uploadId: string;
3330
3293
  partSize: number;
3331
3294
  totalParts: number;
3332
3295
  expiresAt?: string;
3333
3296
  }) => void;
3334
- /** On failure, KEEP the session and its staged parts (the idle GC reclaims
3335
- * them eventually) and throw {@link ChunkedUploadInterruptedError}
3336
- * carrying the uploadId, instead of deleting the session. Default false
3337
- * (a failed upload cleans up after itself). */
3297
+ /**
3298
+ * Preserve staged parts and throw ChunkedUploadInterruptedError with uploadId. Idle
3299
+ * GC still applies; default false deletes failed sessions.
3300
+ */
3338
3301
  keepSessionOnFailure?: boolean;
3339
3302
  /** Max retries per part on a transient error before failing loud. Default 6. */
3340
3303
  maxRetries?: number;
3341
3304
  }
3342
- /**
3343
- * Result of a successful {@link FileSystem.uploadData} call — the
3344
- * upload-session commit response.
3345
- */
3305
+ /** Committed upload-session result. */
3346
3306
  interface ChunkedUploadResult {
3347
- /** The path the runtime wrote the assembled payload to. */
3348
3307
  path: string;
3349
- /** Total assembled size in bytes. */
3350
3308
  size: number;
3351
3309
  /** Server-computed content hash of the assembled payload. */
3352
3310
  hash: string;
3353
- /** Bytes actually sent on the wire across every part attempt — with
3354
- * compression on, `wireBytes < size` is the savings; on the rare
3355
- * checksum-mismatch retry it includes both passes. */
3311
+ /**
3312
+ * Wire bytes include retries and checksum-recovery passes; compare size for
3313
+ * compression savings.
3314
+ */
3356
3315
  wireBytes?: number;
3357
3316
  }
3358
- /**
3359
- * Options for downloading files.
3360
- */
3361
3317
  interface DownloadOptions {
3362
3318
  /** Overwrite local file if exists (default: true) */
3363
3319
  overwrite?: boolean;
@@ -3369,11 +3325,11 @@ interface DownloadOptions {
3369
3325
  expectedSha256?: string;
3370
3326
  /** Cancel the request and remove its incomplete local file. */
3371
3327
  signal?: AbortSignal;
3372
- /** Progress callback for large files */
3373
3328
  onProgress?: (progress: DownloadProgress) => void;
3374
- /** Concurrent range requests for large downloads. Engages only when the
3375
- * path answers a Range probe with 206 (the sidecar does); otherwise the
3376
- * single streaming path serves the download unchanged. Default 1. */
3329
+ /**
3330
+ * Parallel ranges only after a 206 probe; otherwise streams once. Default one
3331
+ * request.
3332
+ */
3377
3333
  parallel?: number;
3378
3334
  }
3379
3335
  /** Exact bytes retained by a completed download. */
@@ -3381,20 +3337,11 @@ interface DownloadResult {
3381
3337
  sizeBytes: number;
3382
3338
  sha256: string;
3383
3339
  }
3384
- /**
3385
- * Download progress information.
3386
- */
3387
3340
  interface DownloadProgress {
3388
- /** Bytes downloaded so far */
3389
3341
  bytesDownloaded: number;
3390
- /** Total bytes to download */
3391
3342
  totalBytes: number;
3392
- /** Percentage complete (0-100) */
3393
3343
  percentage: number;
3394
3344
  }
3395
- /**
3396
- * Options for listing directories.
3397
- */
3398
3345
  interface ListOptions {
3399
3346
  /** Include hidden files (starting with .) */
3400
3347
  all?: boolean;
@@ -3403,80 +3350,22 @@ interface ListOptions {
3403
3350
  /** Task session id for session-specific workspace isolation. */
3404
3351
  sessionId?: string;
3405
3352
  }
3406
- /**
3407
- * Options for creating directories.
3408
- */
3409
3353
  interface MkdirOptions {
3410
3354
  /** Create parent directories as needed (like mkdir -p) */
3411
3355
  recursive?: boolean;
3412
3356
  /** Set directory permissions (Unix mode, e.g., 0o755) */
3413
3357
  mode?: number;
3414
3358
  }
3415
- /**
3416
- * Options for deleting files/directories.
3417
- */
3418
3359
  interface DeleteOptions {
3419
3360
  /** Recursively delete directories (like rm -rf) */
3420
3361
  recursive?: boolean;
3421
3362
  /** Agent session whose workspace and change history receive the deletion. */
3422
3363
  sessionId?: string;
3423
3364
  }
3424
- /** Options for {@link FileSystem.rename}. */
3425
3365
  interface RenameOptions {
3426
3366
  /** Agent session whose workspace and change history receive the rename. */
3427
3367
  sessionId?: string;
3428
3368
  }
3429
- /**
3430
- * File system operations for sandboxes. Access via `sandbox.fs`.
3431
- *
3432
- * Beyond basic read/write: binary upload/download, directory operations,
3433
- * progress reporting for large files.
3434
- *
3435
- * @example Upload and download files
3436
- * ```typescript
3437
- * // Upload a local file
3438
- * await box.fs.upload("./model.bin", "/workspace/models/model.bin");
3439
- *
3440
- * // Download a file
3441
- * await box.fs.download("/workspace/results.zip", "./local/results.zip");
3442
- *
3443
- * // With progress reporting
3444
- * await box.fs.upload("./large-file.bin", "/workspace/data.bin", {
3445
- * onProgress: (p) => console.log(`${p.percentage}%`),
3446
- * });
3447
- * ```
3448
- *
3449
- * @example Directory operations
3450
- * ```typescript
3451
- * // Upload entire directory
3452
- * await box.fs.uploadDir("./local/project", "/workspace/project");
3453
- *
3454
- * // Download entire directory
3455
- * await box.fs.downloadDir("/workspace/output", "./local/output");
3456
- *
3457
- * // List directory contents
3458
- * const files = await box.fs.list("/workspace");
3459
- * for (const f of files) {
3460
- * console.log(`${f.name} - ${f.size} bytes`);
3461
- * }
3462
- * ```
3463
- *
3464
- * @example File management
3465
- * ```typescript
3466
- * // Check if file exists
3467
- * if (await box.fs.exists("/workspace/config.json")) {
3468
- * const info = await box.fs.stat("/workspace/config.json");
3469
- * console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
3470
- * }
3471
- *
3472
- * // Create directory
3473
- * await box.fs.mkdir("/workspace/output/images", { recursive: true });
3474
- *
3475
- * // Delete file or directory
3476
- * await box.fs.delete("/workspace/temp", { recursive: true });
3477
- * ```
3478
- */
3479
- /** One file in a {@link FileSystem.writeMany} batch. */
3480
3369
  interface WriteManyFile {
3481
3370
  /** Destination path. Relative paths resolve from the workspace root. */
3482
3371
  path: string;
@@ -3484,51 +3373,37 @@ interface WriteManyFile {
3484
3373
  content: string;
3485
3374
  /** Unix mode bits applied after write, e.g. 0o755. */
3486
3375
  mode?: number;
3487
- /** Encoding of `content` on the wire. */
3488
3376
  encoding?: "utf8" | "base64";
3489
3377
  /**
3490
- * Only write when the current content SHA-256 matches this value.
3491
- * Use the hash returned by a prior {@link FileWriteResult} or
3492
- * {@link FileReadResult}. The SDK detects an old sidecar only after the write
3493
- * if it does not echo this precondition in `preconditionsApplied`, so the
3494
- * write may already have occurred before `CapabilityError` is thrown.
3378
+ * Require current SHA-256 from FileReadResult/FileWriteResult. Old sidecars may
3379
+ * write before CapabilityError if preconditionsApplied fails to echo this guard.
3495
3380
  */
3496
3381
  ifHash?: string;
3497
3382
  /**
3498
- * Only write when the path does not exist.
3499
- * The SDK detects an old sidecar only after the write if it does not echo
3500
- * this precondition in `preconditionsApplied`, so the write may already have
3501
- * occurred before `CapabilityError` is thrown.
3383
+ * Require absence. Old sidecars may write before CapabilityError if
3384
+ * preconditionsApplied fails to echo this guard.
3502
3385
  */
3503
3386
  ifAbsent?: boolean;
3504
3387
  }
3505
- /** Options for {@link FileSystem.write}. */
3506
3388
  interface WriteFileOptions {
3507
3389
  /** Unix mode bits applied after write, e.g. 0o755. */
3508
3390
  mode?: number;
3509
- /** Encoding of `content` on the wire. */
3510
3391
  encoding?: "utf8" | "base64";
3511
3392
  /** Agent session whose workspace and change history receive the write. */
3512
3393
  sessionId?: string;
3513
3394
  /** Trace id of the turn this call belongs to; see {@link ExecOptions.traceId}. */
3514
3395
  traceId?: string;
3515
3396
  /**
3516
- * Only write when the current content SHA-256 matches this value.
3517
- * Use the hash returned by a prior {@link FileWriteResult} or
3518
- * {@link FileReadResult}. The SDK detects an old sidecar only after the write
3519
- * if it does not echo this precondition in `preconditionsApplied`, so the
3520
- * write may already have occurred before `CapabilityError` is thrown.
3397
+ * Require current SHA-256 from FileReadResult/FileWriteResult. Old sidecars may
3398
+ * write before CapabilityError if preconditionsApplied fails to echo this guard.
3521
3399
  */
3522
3400
  ifHash?: string;
3523
3401
  /**
3524
- * Only write when the path does not exist.
3525
- * The SDK detects an old sidecar only after the write if it does not echo
3526
- * this precondition in `preconditionsApplied`, so the write may already have
3527
- * occurred before `CapabilityError` is thrown.
3402
+ * Require absence. Old sidecars may write before CapabilityError if
3403
+ * preconditionsApplied fails to echo this guard.
3528
3404
  */
3529
3405
  ifAbsent?: boolean;
3530
3406
  }
3531
- /** Options for {@link FileSystem.writeMany}. */
3532
3407
  interface WriteManyOptions {
3533
3408
  /** Delay between batch requests or sequential writes. Default 0. */
3534
3409
  paceMs?: number;
@@ -3540,45 +3415,23 @@ interface FileSystem {
3540
3415
  supportsWriteMode?: true;
3541
3416
  /** True when download enforces bounds and cancellation and returns a digest receipt. */
3542
3417
  supportsBoundedDownload?: true;
3543
- /**
3544
- * Read a file's contents as a string.
3545
- * For binary files, use download() instead.
3546
- *
3547
- * @param path - Path to file (relative to workspace)
3548
- * @returns File contents as UTF-8 string
3549
- * @throws NotFoundError if file doesn't exist
3550
- */
3418
+ /** Read UTF-8; use download for binary data. Missing paths throw NotFoundError. */
3551
3419
  read(path: string): Promise<string>;
3552
3420
  /** Read up to any number of files with content metadata and per-file errors. */
3553
3421
  readBatch(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
3554
3422
  /** Recursively scan the workspace and return file metadata. */
3555
3423
  tree(path: string, options?: FileTreeOptions): Promise<FileTreeResult>;
3556
3424
  /**
3557
- * Measure complete aggregate workspace usage without returning a file list.
3558
- * Unlike {@link FileSystem.tree}, this includes hidden files, dependencies,
3559
- * caches, and build output. Check `complete` before using the result for
3560
- * accounting or quota decisions.
3425
+ * Aggregate usage includes hidden files/dependencies/caches/build output. Check
3426
+ * complete before accounting or quota decisions.
3561
3427
  */
3562
3428
  usage(path: string, options?: FileUsageOptions): Promise<FileUsageResult>;
3563
- /**
3564
- * Write string content to a file.
3565
- * For binary files, use upload() instead.
3566
- * Creates parent directories as needed.
3567
- *
3568
- * @param path - Path to file (relative to workspace)
3569
- * @param content - Content to write
3570
- */
3429
+ /** Write text, creating parents; use upload for binary content. */
3571
3430
  write(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
3572
3431
  /**
3573
- * Write many files through bounded runtime batch requests.
3574
- *
3575
- * For materializing a large file corpus (skills, tool scripts, config) into
3576
- * the sandbox without one network round trip per file. The SDK splits large
3577
- * corpora by runtime count and gateway wire limits. Batch writes are not
3578
- * atomic. A per-file failure throws after the runtime reports all
3579
- * results for that request, so sibling files can already be written. Relative
3580
- * paths resolve from the workspace root. Pass `mode: 0o755` on executable
3581
- * files.
3432
+ * Bounded batches respect runtime count/gateway wire limits and are not atomic:
3433
+ * sibling writes may finish before a per-file failure throws. Relative paths use
3434
+ * workspace root; mode sets executable permissions.
3582
3435
  *
3583
3436
  * @example
3584
3437
  * ```typescript
@@ -3589,21 +3442,11 @@ interface FileSystem {
3589
3442
  * ```
3590
3443
  */
3591
3444
  writeMany(files: WriteManyFile[], options?: WriteManyOptions): Promise<void>;
3592
- /**
3593
- * Search for text patterns in files using ripgrep.
3594
- * @see SearchOptions for available options
3595
- */
3445
+ /** Ripgrep search; see SearchOptions. */
3596
3446
  search(query: string, options?: SearchOptions): AsyncIterable<SearchMatch>;
3597
3447
  /**
3598
- * Upload a local file to the sandbox.
3599
- * Uses checksum-verified chunked upload through gateway or direct connections.
3600
- * Creates parent directories as needed.
3601
- * The upload session limit also applies to local files.
3602
- *
3603
- * @param localPath - Path to local file
3604
- * @param remotePath - Destination path in sandbox
3605
- * @param options - Upload options (overwrite, permissions, progress)
3606
- * @throws Error if local file doesn't exist
3448
+ * Checksum-verified chunked upload via gateway/direct transport, creating parents
3449
+ * and enforcing session limits. Missing local files throw.
3607
3450
  *
3608
3451
  * @example
3609
3452
  * ```typescript
@@ -3617,24 +3460,10 @@ interface FileSystem {
3617
3460
  */
3618
3461
  upload(localPath: string, remotePath: string, options?: UploadOptions): Promise<void>;
3619
3462
  /**
3620
- * Upload in-memory binary or text data to the sandbox over the chunked
3621
- * upload-session protocol, without touching the local filesystem.
3622
- *
3623
- * Browser/Worker-safe (no `node:` APIs) — this is the sanctioned path for
3624
- * delivering payloads over ~1 MiB from a browser tab, a Worker, or any
3625
- * runtime without `node:fs`, where {@link FileSystem.upload}'s local-file
3626
- * read isn't available. Binary-safe: accepts a `Blob`, `ArrayBuffer`,
3627
- * `ArrayBufferView`, or UTF-8 `string`. The upload is chunked into
3628
- * server-sized parts transparently — callers see one call and one
3629
- * awaited result — and verified end-to-end with a whole-payload SHA-256
3630
- * at commit. Works identically whether the sandbox is reached through
3631
- * the gateway proxy or a direct sidecar connection.
3632
- *
3633
- * @param remotePath - Destination path in the sandbox.
3634
- * @param data - Payload to upload. Strings encode as UTF-8.
3635
- * @param options - Chunking, retry, progress, and cancellation options.
3636
- * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately, before any
3637
- * request, if the payload exceeds the chunked-upload session cap.
3463
+ * Browser/Worker-safe chunked upload without local filesystem access, over
3464
+ * gateway/direct transport. Strings use UTF-8; commit verifies whole-payload
3465
+ * SHA-256. Exceeding the session cap throws SandboxError PAYLOAD_TOO_LARGE before
3466
+ * any request.
3638
3467
  *
3639
3468
  * @example
3640
3469
  * ```typescript
@@ -3646,14 +3475,8 @@ interface FileSystem {
3646
3475
  */
3647
3476
  uploadData(remotePath: string, data: Blob | ArrayBuffer | ArrayBufferView | string, options?: ChunkedUploadOptions): Promise<ChunkedUploadResult>;
3648
3477
  /**
3649
- * Download a file from the sandbox.
3650
- * Handles binary files correctly.
3651
- * Creates local parent directories as needed.
3652
- *
3653
- * @param remotePath - Path to file in sandbox
3654
- * @param localPath - Local destination path
3655
- * @param options - Download options (overwrite, progress)
3656
- * @throws NotFoundError if remote file doesn't exist
3478
+ * Binary-safe download creating local parents. Missing remote files throw
3479
+ * NotFoundError.
3657
3480
  *
3658
3481
  * @example
3659
3482
  * ```typescript
@@ -3662,13 +3485,7 @@ interface FileSystem {
3662
3485
  */
3663
3486
  download(remotePath: string, localPath: string, options?: DownloadOptions): Promise<DownloadResult>;
3664
3487
  /**
3665
- * Upload a local directory to the sandbox.
3666
- * Uses tar for efficient transfer.
3667
- * Preserves directory structure and file permissions.
3668
- *
3669
- * @param localDir - Path to local directory
3670
- * @param remoteDir - Destination directory in sandbox
3671
- * @throws Error if local directory doesn't exist
3488
+ * Tar upload preserves structure/permissions; missing local directories throw.
3672
3489
  *
3673
3490
  * @example
3674
3491
  * ```typescript
@@ -3677,18 +3494,15 @@ interface FileSystem {
3677
3494
  */
3678
3495
  uploadDir(localDir: string, remoteDir: string): Promise<void>;
3679
3496
  /**
3680
- * Stream a directory's tar.gz bytes to a local file without extracting it.
3681
- * Includes hidden files. Uses the same bounded, cancellable transport and
3682
- * SHA-256 receipt as download(). Bounds apply to compressed bytes only.
3683
- * The caller must validate members and expanded size before extraction.
3684
- * This reads a live directory, not a transactional filesystem snapshot.
3497
+ * Stream live-directory tar.gz, including hidden files, with download
3498
+ * bounds/cancellation/SHA receipt. Bounds cover compressed bytes only; validate
3499
+ * members and expanded size before extraction.
3685
3500
  */
3686
3501
  downloadArchive(remoteDir: string, localPath: string, options?: DownloadOptions): Promise<DownloadResult>;
3687
3502
  /**
3688
- * Open a directory's tar.gz bytes as a stream, for runtimes without a local
3689
- * filesystem such as Cloudflare Workers and browsers. Includes hidden files.
3690
- * The caller owns the stream: read it to the end or cancel it. Like
3691
- * downloadArchive(), this reads a live directory, not a snapshot.
3503
+ * Browser/Worker tar.gz stream includes hidden files from a live directory, not a
3504
+ * snapshot. Read to completion or cancel.
3505
+ *
3692
3506
  * @example
3693
3507
  * ```typescript
3694
3508
  * const archive = await box.fs.openArchive("/home/agent");
@@ -3699,15 +3513,9 @@ interface FileSystem {
3699
3513
  signal?: AbortSignal;
3700
3514
  }): Promise<ReadableStream<Uint8Array>>;
3701
3515
  /**
3702
- * Download a directory from the sandbox.
3703
- * Uses streaming tar transfer and the host tar program for extraction.
3704
- * Download options bound compressed bytes only. Use downloadArchive() for
3705
- * member validation, expanded-size bounds, or atomic directory publication.
3706
- * Preserves directory structure and file permissions.
3707
- *
3708
- * @param remoteDir - Directory path in sandbox
3709
- * @param localDir - Local destination directory
3710
- * @throws NotFoundError if remote directory doesn't exist
3516
+ * Streaming tar and host extraction preserve structure/permissions. Bounds cover
3517
+ * compressed bytes only; use downloadArchive for member validation, expanded limits
3518
+ * or atomic publication. Missing remote directories throw NotFoundError.
3711
3519
  *
3712
3520
  * @example
3713
3521
  * ```typescript
@@ -3716,12 +3524,7 @@ interface FileSystem {
3716
3524
  */
3717
3525
  downloadDir(remoteDir: string, localDir: string, options?: Omit<DownloadOptions, "overwrite">): Promise<void>;
3718
3526
  /**
3719
- * List directory contents with metadata.
3720
- *
3721
- * @param path - Directory path (relative to workspace)
3722
- * @param options - List options (all, long)
3723
- * @returns Array of file/directory info
3724
- * @throws NotFoundError if directory doesn't exist
3527
+ * List metadata; missing directories throw NotFoundError.
3725
3528
  *
3726
3529
  * @example
3727
3530
  * ```typescript
@@ -3734,11 +3537,7 @@ interface FileSystem {
3734
3537
  */
3735
3538
  list(path: string, options?: ListOptions): Promise<FileInfo[]>;
3736
3539
  /**
3737
- * Get detailed information about a file or directory.
3738
- *
3739
- * @param path - Path to file/directory
3740
- * @returns File/directory metadata
3741
- * @throws NotFoundError if path doesn't exist
3540
+ * Read metadata; missing paths throw NotFoundError.
3742
3541
  *
3743
3542
  * @example
3744
3543
  * ```typescript
@@ -3748,12 +3547,8 @@ interface FileSystem {
3748
3547
  */
3749
3548
  stat(path: string): Promise<FileInfo>;
3750
3549
  /**
3751
- * Delete a file or directory.
3752
- *
3753
- * @param path - Path to delete
3754
- * @param options - Delete options (recursive for directories)
3755
- * @throws NotFoundError if path doesn't exist
3756
- * @throws Error if deleting non-empty directory without recursive
3550
+ * Delete a path; missing paths throw NotFoundError, nonempty directories require
3551
+ * recursive.
3757
3552
  *
3758
3553
  * @example
3759
3554
  * ```typescript
@@ -3766,16 +3561,9 @@ interface FileSystem {
3766
3561
  */
3767
3562
  delete(path: string, options?: DeleteOptions): Promise<void>;
3768
3563
  /**
3769
- * Rename a file or directory inside the sandbox without transferring its contents.
3770
- * An existing regular file or symbolic link at the destination is replaced atomically.
3771
- * Replacing a non-empty directory fails, as does moving across filesystems.
3772
- *
3773
- * @param sourcePath - Current path
3774
- * @param destinationPath - New path
3775
- * @param options - Session workspace options
3776
- * @returns The resolved source and destination paths
3777
- * @throws NotFoundError if the source or destination parent does not exist
3778
- * @throws Error if the destination is a non-empty directory or the paths span filesystems
3564
+ * Rename in place; regular-file/symlink destinations replace atomically. Missing
3565
+ * source/parent throws NotFoundError; nonempty-directory replacement and
3566
+ * cross-filesystem moves fail.
3779
3567
  *
3780
3568
  * @example
3781
3569
  * ```typescript
@@ -3787,10 +3575,7 @@ interface FileSystem {
3787
3575
  */
3788
3576
  rename(sourcePath: string, destinationPath: string, options?: RenameOptions): Promise<FileRenameResult>;
3789
3577
  /**
3790
- * Create a directory.
3791
- *
3792
- * @param path - Directory path to create
3793
- * @param options - Options (recursive to create parents)
3578
+ * Create directories; recursive creates missing parents.
3794
3579
  *
3795
3580
  * @example
3796
3581
  * ```typescript
@@ -3800,10 +3585,7 @@ interface FileSystem {
3800
3585
  */
3801
3586
  mkdir(path: string, options?: MkdirOptions): Promise<void>;
3802
3587
  /**
3803
- * Check if a path exists.
3804
- *
3805
- * @param path - Path to check
3806
- * @returns true if path exists, false otherwise
3588
+ * Test existence.
3807
3589
  *
3808
3590
  * @example
3809
3591
  * ```typescript
@@ -4200,59 +3982,24 @@ interface NetworkManager {
4200
3982
  //#endregion
4201
3983
  //#region src/types/storage.d.ts
4202
3984
  /**
4203
- * S3-compatible storage provider configuration (BYOS3 - Bring Your Own S3).
4204
- *
4205
- * Allows customers to store snapshots in their own S3-compatible storage.
4206
- * Supports AWS S3, Google Cloud Storage (GCS), and Cloudflare R2.
4207
- *
4208
- * @example AWS S3
4209
- * ```typescript
4210
- * const storage: StorageConfig = {
4211
- * type: "s3",
4212
- * bucket: "my-snapshots",
4213
- * region: "us-east-1",
4214
- * credentials: {
4215
- * accessKeyId: "AKIA...",
4216
- * secretAccessKey: "...",
4217
- * },
4218
- * };
4219
- * ```
4220
- *
4221
- * @example Cloudflare R2
3985
+ * Customer S3-compatible snapshot storage (AWS S3, GCS HMAC or R2).
3986
+ * @example
4222
3987
  * ```typescript
4223
3988
  * const storage: StorageConfig = {
4224
3989
  * type: "r2",
4225
3990
  * bucket: "my-snapshots",
4226
3991
  * endpoint: "https://<account>.r2.cloudflarestorage.com",
4227
- * credentials: {
4228
- * accessKeyId: "...",
4229
- * secretAccessKey: "...",
4230
- * },
4231
- * };
4232
- * ```
4233
- *
4234
- * @example Google Cloud Storage
4235
- * ```typescript
4236
- * const storage: StorageConfig = {
4237
- * type: "gcs",
4238
- * bucket: "my-snapshots",
4239
- * credentials: {
4240
- * accessKeyId: "...", // HMAC key
4241
- * secretAccessKey: "...",
4242
- * },
3992
+ * credentials: { accessKeyId: "...", secretAccessKey: "..." },
4243
3993
  * };
4244
3994
  * ```
4245
3995
  */
4246
3996
  interface StorageConfig {
4247
- /** Storage provider type */
4248
3997
  type: "s3" | "gcs" | "r2";
4249
- /** Bucket name */
4250
3998
  bucket: string;
4251
3999
  /** Custom endpoint URL (required for R2, optional for S3/GCS) */
4252
4000
  endpoint?: string;
4253
4001
  /** Region (e.g., us-east-1) */
4254
4002
  region?: string;
4255
- /** Access credentials */
4256
4003
  credentials: {
4257
4004
  accessKeyId: string;
4258
4005
  secretAccessKey: string;
@@ -4261,14 +4008,10 @@ interface StorageConfig {
4261
4008
  prefix?: string;
4262
4009
  }
4263
4010
  /**
4264
- * Live whole-sandbox resource usage, read from the container cgroup.
4265
- *
4266
- * Memory is point-in-time (`memoryCurrentMb`) plus a high-water mark
4267
- * (`memoryPeakMb`). CPU is a cumulative counter in microseconds; compute
4268
- * utilization from two samples: `cpu% = Δcpu_usec / (Δwall_ms * 10)`.
4011
+ * Live cgroup usage. CPU utilization from samples: ΔcpuUsageUsec / (Δwall_ms * 10).
4012
+ * Memory current/peak are instantaneous/high-water values.
4269
4013
  */
4270
4014
  interface SandboxResourceUsage {
4271
- /** Cgroup version (1 or 2). */
4272
4015
  cgroupVersion: number;
4273
4016
  /** Current resident memory, MB. */
4274
4017
  memoryCurrentMb: number;
@@ -4282,14 +4025,9 @@ interface SandboxResourceUsage {
4282
4025
  sampledAtMs: number;
4283
4026
  }
4284
4027
  /**
4285
- * Returned by `box.capabilities()` — what the DEPLOYED sidecar image can do,
4286
- * as compiled capability facts, not SDK method presence. A newer SDK against
4287
- * an older deployment reads this before relying on a feature; a missing
4288
- * optional flag means "unknown to this image", never "false".
4289
- *
4290
- * Every field is sourced from the plain-JSON response body of
4291
- * `GET /capabilities`. Nothing here is header-derived, so the platform
4292
- * proxy's SSE header-stripping cannot affect this document.
4028
+ * Capabilities compiled into the deployed image, read from GET /capabilities JSON,
4029
+ * independent of SDK method presence or proxy headers. Missing optional flags mean
4030
+ * unknown, not false.
4293
4031
  */
4294
4032
  interface SandboxRuntimeCapabilities {
4295
4033
  /** Named native subscription references supported by the deployed Sidecar. */
@@ -4302,7 +4040,6 @@ interface SandboxRuntimeCapabilities {
4302
4040
  nativeSessionCaptureVersion?: number;
4303
4041
  /** Dispatch providers covered by the serving Sidecar capture boundary. */
4304
4042
  nativeSessionCaptureHarnesses?: BackendType[];
4305
- /** Version of the capability-document shape. This SDK understands 1. */
4306
4043
  schema: 1;
4307
4044
  /** `@tangle-network/agent-interface` contract compiled into the image. */
4308
4045
  agentInterface: string;
@@ -4324,26 +4061,23 @@ interface SandboxRuntimeCapabilities {
4324
4061
  eventReplay: boolean;
4325
4062
  };
4326
4063
  interactions: {
4327
- /** This sidecar image contains the OpenCode native before-tool approval
4328
- * hook. Require OpenCode and permission interactions before using it. */
4329
- exactBeforeToolApproval?: boolean;
4330
- /** Every acknowledged interaction resolution is recorded: repeating a
4331
- * response replays the recorded resolution, and a different answer for
4332
- * a recorded resolution raises a 409 `StateError`. The deployment
4333
- * refuses with 503 rather than acknowledge a resolution it cannot
4334
- * record. */
4064
+ /** Native OpenCode before-tool approval; require OpenCode and permission interactions. */exactBeforeToolApproval?: boolean;
4065
+ /**
4066
+ * Recorded resolutions replay on repetition, conflict on changed answers (409
4067
+ * StateError), and fail closed (503) if recording fails.
4068
+ */
4335
4069
  responseDedupe: boolean;
4336
4070
  };
4337
4071
  /** Native TUI lifecycle and control operations exposed by the deployment. */
4338
4072
  interactiveAgent?: {
4339
- /** Start one native TUI for the requested session. */start: boolean; /** Read durable TUI state. */
4340
- status: boolean; /** Attach to the existing native TUI. */
4073
+ start: boolean;
4074
+ status: boolean;
4341
4075
  attach: boolean; /** Fence concurrent TUI writers with an exact control claim. */
4342
- control: boolean; /** Reattach after a client disconnect. */
4343
- reattach: boolean; /** Send a prompt to the existing TUI. */
4344
- sendPrompt: boolean; /** Send terminal input to the existing TUI. */
4345
- input: boolean; /** Resize the existing TUI. */
4346
- resize: boolean; /** Stop the exact TUI session. */
4076
+ control: boolean;
4077
+ reattach: boolean;
4078
+ sendPrompt: boolean;
4079
+ input: boolean;
4080
+ resize: boolean;
4347
4081
  stop: boolean; /** Start Claude Code with the CLI's subscription login in its private HOME. */
4348
4082
  claudeSubscription?: boolean;
4349
4083
  };
@@ -4375,136 +4109,66 @@ interface SandboxShapePreset {
4375
4109
  }
4376
4110
  //#endregion
4377
4111
  //#region src/types/lifecycle.d.ts
4378
- /**
4379
- * Configuration for initializing the Sandbox client.
4380
- *
4381
- * @example
4382
- * ```typescript
4383
- * const client = new Sandbox({
4384
- * apiKey: "sk-tan-...",
4385
- * baseUrl: "https://your-sandbox-api.example.com",
4386
- * timeoutMs: 60000,
4387
- * });
4388
- * ```
4389
- */
4112
+ /** Configure the HTTP client; runnable setup examples are in the SDK README. */
4390
4113
  interface SandboxConfig {
4391
- /** API key for authentication */
4392
4114
  apiKey: string;
4393
- /**
4394
- * Platform API base URL, for the agent-profile catalog that fleets resolve
4395
- * saved profiles from. Defaults to `https://id.tangle.tools`.
4396
- */
4115
+ /** Platform profile-catalog URL; defaults to https://id.tangle.tools. */
4397
4116
  platformUrl?: string;
4398
- /** Base URL for the Sandbox API */
4399
4117
  baseUrl: string;
4400
4118
  /**
4401
- * Every call's deadline in ms (default `SDK_TIMEOUTS.default`, 30 s), direct runtime calls
4402
- * included, unless `SDK_TIMEOUTS` names the call. A JSON or error body is bounded until read;
4403
- * a successful SSE or binary stream until its headers arrive.
4119
+ * Request deadline in ms, including direct calls, unless SDK_TIMEOUTS names the
4120
+ * operation. JSON/error bodies remain bounded through consumption; successful SSE/binary
4121
+ * streams through headers.
4404
4122
  */
4405
4123
  timeoutMs?: number;
4406
4124
  /** Client lifetime cancellation, composed with each request's own signal. */
4407
4125
  signal?: AbortSignal;
4408
4126
  /**
4409
- * Permit the SDK to read CLI auth files from the host home directory
4410
- * (`~/.codex/auth.json`, `~/.claude/.credentials.json`,
4411
- * `~/.claude/settings.json`) and ship them to a `localhost` /
4412
- * `127.0.0.1` / `::1` `baseUrl` when creating a `codex` or
4413
- * `claude-code` backend without explicit credentials.
4414
- *
4415
- * Default `false`. Without this flag, any process bound to a
4416
- * localhost port (your sandbox-api or anything else) can impersonate
4417
- * the API and silently harvest those credentials. Set this to `true`
4418
- * only when the localhost endpoint is one you control. For non-local
4419
- * `baseUrl`s the flag is ignored — the SDK never reads home-dir auth
4420
- * files for remote endpoints.
4127
+ * Default false. True permits reading ~/.codex/auth.json, ~/.claude/.credentials.json
4128
+ * and ~/.claude/settings.json for credential-free Codex/Claude creates against
4129
+ * localhost, 127.0.0.1 or ::1. Enable only for a trusted local endpoint: any listener
4130
+ * could otherwise harvest those credentials. Remote endpoints never read host auth
4131
+ * files.
4421
4132
  */
4422
4133
  trustLocalCliAuth?: boolean;
4423
4134
  /**
4424
- * Receives the SDK's own timing spans, so a call's wall time can be split
4425
- * into what the SDK, the network and the server each spent:
4426
- *
4427
- * - `sdk.ensureRunning`: the status check before a runtime call; `desc` is
4428
- * `cached` when no status read was needed.
4429
- * - `sdk.refresh`: one status read; `desc` is why it was sent, the value of
4430
- * the `x-tangle-refresh-reason` request header.
4431
- * - `sdk.request`: one HTTP request, with `socket` (`new` or `reused`) and
4432
- * `phases` (dns, connect, tls, ttfb, body) where the runtime exposes them
4433
- * (Node).
4434
- *
4435
- * A hook that throws is ignored. With no hook the SDK measures nothing.
4135
+ * SDK timing spans: sdk.ensureRunning (cached status), sdk.refresh (refresh reason),
4136
+ * sdk.request (new/reused socket and available dns/connect/tls/ttfb/body phases).
4137
+ * Throwing hooks are ignored; absent hooks incur no measurement.
4436
4138
  */
4437
4139
  onTiming?: SdkTimingHook;
4438
4140
  /**
4439
- * Send runtime calls straight to the sandbox's cell edge instead of through
4440
- * the API and the orchestrator. Default `true` on servers and `false` in a
4441
- * browser (a `document` or `WorkerGlobalScope` global, so Node tests under
4442
- * jsdom count too): box hosts carry no CORS contract, so a browser reads the
4443
- * runtime, event streams included, through the Sandbox API proxy.
4444
- * Exec-family calls (spawn,
4445
- * exec, terminal commands) go to `connection.execHost` on its exec grant;
4446
- * files, processes, agent reads and event streams, and terminal sockets go
4447
- * to `connection.runtimeUrl` on `connection.authToken`. Agent calls that
4448
- * write (a prompt, a session message, a session create) stay on the API,
4449
- * which prepares them. A call the cell provably never received goes to the
4450
- * API, which resumes a stopped sandbox; after a failure that may follow
4451
- * delivery, only a call safe to apply twice (a read, a `PUT`, a `DELETE`)
4452
- * goes again. `false` sends every runtime call through the API.
4141
+ * Direct cell runtime calls; default true on servers, false in browsers (document or
4142
+ * WorkerGlobalScope, including jsdom), which use the API CORS proxy. Exec uses
4143
+ * execHost/execToken; reads, files, processes, events and terminal sockets use
4144
+ * runtimeUrl/authToken. Agent writes stay on the API for preparation. Undelivered calls
4145
+ * fall back to the API for resume; after possible delivery only replay-safe
4146
+ * reads/PUT/DELETE retry. False routes every call through the API.
4453
4147
  */
4454
4148
  directExec?: boolean;
4455
4149
  }
4456
- /**
4457
- * Status of a sandbox instance.
4458
- *
4459
- * Lifecycle: `pending` -> `provisioning` -> `running` -> `stopped` -> (deleted)
4460
- *
4461
- * - `pending` - Sandbox created but not yet provisioning
4462
- * - `provisioning` - Container and resources being allocated
4463
- * - `running` - Sandbox is active and accepting commands
4464
- * - `stopped` - Sandbox is paused (can be resumed)
4465
- * - `failed` - Sandbox encountered an error
4466
- * - `expired` - Sandbox exceeded its lifetime limit
4467
- * - `deleted` - Sandbox has been deleted
4468
- */
4469
4150
  type SandboxStatus = "pending" | "provisioning" | "running" | "stopped" | "failed" | "expired" | "deleted";
4470
- /**
4471
- * Resource limits for a sandbox.
4472
- */
4473
4151
  interface SandboxResources {
4474
- /** Number of CPU cores */
4475
4152
  cpuCores?: number;
4476
- /** Memory in megabytes */
4477
4153
  memoryMB?: number;
4478
- /** Disk space in gigabytes */
4479
4154
  diskGB?: number;
4480
4155
  /** Accelerator request for GPU-class workloads. */
4481
4156
  accelerator?: SandboxAccelerator;
4482
4157
  /**
4483
- * These numbers are a RECOMMENDATION chosen on the end user's behalf (a
4484
- * workflow profile's tier, a capability default), not a size the caller
4485
- * asked for. Over-ceiling advisory resources are CLAMPED to the account's
4486
- * ceiling; over-ceiling explicit resources are REFUSED with
4487
- * `RESOURCES_EXCEED_LIMIT`.
4488
- *
4489
- * Leave unset for anything a user actually requested — the default is
4490
- * honour-or-refuse, so you are told when a size cannot be served instead of
4491
- * silently receiving a fraction of it.
4158
+ * Advisory resources are chosen for the user and clamped to account ceilings. Explicit
4159
+ * requests (default) are honored or refused with RESOURCES_EXCEED_LIMIT; leave unset for
4160
+ * user-requested sizes.
4492
4161
  */
4493
4162
  advisory?: boolean;
4494
4163
  /**
4495
- * The subset of fields that are advisory while the rest stay explicit. Use
4496
- * it when only SOME of these numbers were chosen on the user's behalf — a
4497
- * CLI whose size flags carry defaults sends all three on every create, and
4498
- * without this one typed flag would turn the two untouched defaults into
4499
- * explicit requests and refuse a size the user never named.
4164
+ * Mark only defaulted resource fields advisory; other fields remain explicit, so a user
4165
+ * override does not turn unrelated defaults into explicit requests.
4500
4166
  */
4501
4167
  advisoryFields?: ReadonlyArray<"cpuCores" | "memoryMB" | "diskGB">;
4502
4168
  }
4503
4169
  /**
4504
- * `GET /v1/shapes`: the named sizes, which one is the platform's default, and
4505
- * the largest shape this account can be granted on the serving deployment.
4506
- * The ceiling is the one the create path refuses above, so a request sized
4507
- * at or below it is never refused with `RESOURCES_EXCEED_LIMIT`.
4170
+ * GET /v1/shapes returns available presets, the default and the serving account ceiling
4171
+ * enforced by create.
4508
4172
  */
4509
4173
  interface SandboxShapesInfo {
4510
4174
  presets: SandboxShapePreset[];
@@ -4515,19 +4179,15 @@ interface SandboxShapesInfo {
4515
4179
  diskGB: number;
4516
4180
  };
4517
4181
  }
4518
- /** @deprecated Use CreateSandboxOptions.proxySecrets for authored proxy policy. */
4519
4182
  /**
4520
- * Create a managed sandbox, or use bare for exec/lifecycle without the runtime.
4521
- * Git seeds a repository; environment selects an image. Storage and fromSnapshot
4522
- * restore a durable workspace. Field docs below own each option's semantics;
4523
- * the exported quickstart examples provide complete runnable create flows.
4183
+ * Create a managed sandbox, or bare exec/lifecycle sandbox. Runnable flows live in the
4184
+ * exported quickstart examples.
4524
4185
  */
4525
4186
  interface CreateSandboxOptions {
4526
4187
  /**
4527
- * How this create retries. With `capacity: false`, a 503 `CAPACITY_EXHAUSTED` ends the create at once with that
4528
- * error instead of being asked again on the deploy-window budget (up to 150 s, see client-create-retry.ts). For a
4529
- * caller that defers the work itself when no host has room: each refused re-POST also counts toward the cell's
4530
- * create failure streak. Omitted, a create retries as before.
4188
+ * capacity:false returns CAPACITY_EXHAUSTED immediately for caller-managed deferral;
4189
+ * omitted preserves client-create-retry.ts policy. Re-POSTs count toward the serving
4190
+ * cell failure streak.
4531
4191
  */
4532
4192
  retry?: {
4533
4193
  capacity?: boolean;
@@ -4539,230 +4199,96 @@ interface CreateSandboxOptions {
4539
4199
  /** Internal-owned ephemeral workspaces only; incompatible with capture or retained paths. */
4540
4200
  sessionCapture?: "discard";
4541
4201
  /**
4542
- * Optional environment or container image override.
4543
- * Omit this field to use the server's default image.
4544
- *
4545
- * Pass a named environment returned by `client.environments.list()`, a
4546
- * container image reference such as `"python:3.12-slim"`, or an image ID
4547
- * returned by the SDK image builder.
4548
- *
4549
- * Firecracker custom images require an immutable `repository@sha256:...`
4550
- * reference whose verified rootfs artifact the platform operator has installed.
4551
- * Use `driver: { type: "docker", runtimeBackend: "firecracker" }` on the
4552
- * public routing pool. Missing artifacts return `FIRECRACKER_IMAGE_UNAVAILABLE`;
4553
- * mutable image tags and `fromSnapshot` remain unsupported on Firecracker.
4554
- *
4555
- * @example
4556
- * ```typescript
4557
- * environment: "python:3.12-slim"
4558
- * ```
4202
+ * Omit for the server image, or use a catalog environment, container reference or built
4203
+ * image ID. Firecracker requires an operator-installed verified rootfs addressed by
4204
+ * immutable repository@sha256 and driver {type:"docker",runtimeBackend:"firecracker"}.
4205
+ * Missing artifacts return FIRECRACKER_IMAGE_UNAVAILABLE; mutable tags/fromSnapshot are
4206
+ * unsupported there.
4559
4207
  */
4560
4208
  environment?: string;
4561
- /**
4562
- * Create a bare sandbox without the managed runtime.
4563
- *
4564
- * Bare sandboxes only have:
4565
- * - `exec()` - Execute commands
4566
- * - `stop()` / `resume()` - Lifecycle control
4567
- * - `delete()` - Cleanup
4568
- *
4569
- * Use bare mode when you need a clean container without the managed
4570
- * runtime integration.
4571
- *
4572
- * @default false
4573
- */
4209
+ /** Bare exec/stop/resume/delete without the managed runtime. Default false. */
4574
4210
  bare?: boolean;
4575
4211
  /**
4576
- * Start the managed sandbox runtime without configuring an AI agent.
4577
- *
4578
- * Files, exact process execution, lifecycle controls, and telemetry remain
4579
- * available. No model credentials or default backend are provisioned.
4580
- * Use this for CI jobs, evaluators, and other process-driven workloads.
4581
- *
4582
- * @default true
4212
+ * Default true. False keeps files, exact process execution, lifecycle and telemetry but
4213
+ * provisions no model credentials or backend.
4583
4214
  */
4584
4215
  agent?: boolean;
4585
- /**
4586
- * Infrastructure driver selection.
4587
- * Controls how the sandbox is provisioned and isolated.
4588
- *
4589
- * @example Firecracker with CRIU
4590
- * ```typescript
4591
- * driver: { type: "firecracker", enableCriu: true }
4592
- * ```
4593
- */
4216
+ /** Infrastructure driver and isolation selection; see DriverConfig. */
4594
4217
  driver?: DriverConfig;
4595
- /**
4596
- * AI coding agent backend configuration.
4597
- * Determines which agent runs inside the sandbox.
4598
- *
4599
- * @example OpenCode with profile
4600
- * ```typescript
4601
- * backend: {
4602
- * type: "opencode",
4603
- * profile: { name: "with-web-search" },
4604
- * }
4605
- * ```
4606
- */
4218
+ /** Coding agent and profile configuration; see BackendConfig. */
4607
4219
  backend?: BackendConfig;
4608
4220
  /**
4609
- * Confidential execution requirements for this sandbox.
4610
- *
4611
- * This is equivalent to setting `backend.profile.confidential` on an inline
4612
- * AgentProfile. Tangle-backed creation translates it into blueprint TEE
4613
- * fields; operators that cannot satisfy the requested TEE fail closed.
4221
+ * Equivalent to inline backend.profile.confidential. Tangle maps requirements to
4222
+ * blueprint TEE fields; an unsatisfied requirement fails closed.
4614
4223
  */
4615
4224
  confidential?: AgentProfileConfidential;
4616
4225
  /**
4617
- * Egress firewall policy for controlling outbound internet access.
4618
- *
4619
- * When omitted on a team sandbox, the team's default egress policy is
4620
- * inherited. When omitted on a personal sandbox, the platform default
4621
- * (`{ mode: "open" }`) is used.
4622
- *
4623
- * @see {@link EgressPolicy}
4226
+ * Outbound policy; omitted inherits the team policy for team sandboxes, otherwise the
4227
+ * platform default. See EgressPolicy.
4624
4228
  */
4625
4229
  egressPolicy?: EgressPolicy;
4626
- /**
4627
- * Git repository to clone at sandbox creation.
4628
- *
4629
- * The repository is cloned during provisioning, before the sandbox
4630
- * becomes ready. This is more efficient than cloning after start.
4631
- *
4632
- * @example { url: "https://github.com/user/repo.git", ref: "main" }
4633
- */
4230
+ /** Clone during provisioning before readiness; see GitConfig. */
4634
4231
  git?: GitConfig;
4635
4232
  /**
4636
- * Initial working directory below the realized workspace root.
4637
- *
4638
- * Use a relative POSIX path. When `git` is set, `.` means the repository
4639
- * root. Otherwise, `.` means the sandbox workspace root.
4233
+ * Relative POSIX path below the realized workspace; . selects the cloned repo root, or
4234
+ * workspace root without git.
4640
4235
  */
4641
4236
  cwd?: string;
4642
- /** Human-readable name for the sandbox */
4643
4237
  name?: string;
4644
- /** Resource limits (CPU cores, memory, disk) */
4645
4238
  resources?: SandboxResources;
4646
4239
  /**
4647
- * Attach an on-demand GPU worker during sandbox creation.
4648
- *
4649
- * Requires `resources.accelerator` so the workload shape and the lease
4650
- * spend caps are both explicit. Docker and Firecracker sandboxes use the
4651
- * same lease path; the GPU is a temporary external worker, not host
4652
- * placement.
4240
+ * Temporary external GPU worker, independent of Docker/Firecracker placement. Requires
4241
+ * resources.accelerator and explicit lease spend caps.
4653
4242
  */
4654
4243
  gpuLease?: CreateGpuLeaseOptions;
4655
- /** Environment variables injected into the sandbox */
4656
4244
  env?: Record<string, string>;
4657
4245
  /**
4658
- * Opt named withheld public env keys into cold reclamation after the platform's
4659
- * idle bound and uploaded snapshot. The caller must keep a separate source and
4660
- * supply their values to resume({ env }); no automatic credential recovery is
4661
- * promised. Omit to retain the existing conservative policy. Hub/model keys
4662
- * retain their separate recovery rules.
4246
+ * Permit cold reclamation for named withheld env keys after the platform idle bound and
4247
+ * uploaded snapshot. Keep a separate credential source and supply values to
4248
+ * resume({env}); Hub/model recovery remains separate. Omitted retains conservative
4249
+ * policy.
4663
4250
  */
4664
4251
  envRecovery?: SandboxEnvRecovery;
4665
4252
  /**
4666
- * Maximum continuous runtime in seconds for each create or resume interval.
4667
- *
4668
- * On expiry the sandbox is SUSPENDED, not deleted: the container stops and
4669
- * the workspace is preserved, with a best-effort pre-suspend snapshot when
4670
- * the platform has snapshots enabled. It can be resumed for as long as it
4671
- * stays suspended. Resume starts a new runtime interval with the same limit;
4672
- * reads, connections, and activity do not extend that interval.
4673
- * Once the cold window also elapses (6 hours by default)
4674
- * the container is reclaimed, and bringing the preserved workspace back is
4675
- * a re-provision against the same ref rather than a resume. Drivers with a
4676
- * create/delete-only lifecycle (`driver: "tangle"`) skip the suspend
4677
- * entirely and keep running.
4678
- *
4679
- * `create()` substitutes no default: omit the field and it is not sent, so
4680
- * the sandbox falls back to the platform's global hard TTL — 365 days
4681
- * unless an operator changed it. Omitting this therefore leaves the sandbox
4682
- * effectively uncapped on age; it does not impose a short cap. Other entry
4683
- * points do supply a value of their own — the `tangle sandbox create` CLI
4684
- * and fleet machines both default to 3600 — so those paths never reach the
4685
- * global fallback.
4253
+ * Runtime interval in seconds; create/resume starts a new interval, activity does not
4254
+ * extend it. Expiry suspends and preserves the workspace, with a best-effort snapshot
4255
+ * when enabled. After the platform cold window, resume re-provisions the same ref.
4256
+ * Create/delete-only Tangle drivers keep running. Omitted sends no value: Platform
4257
+ * lifecycle policy owns the fallback; CLI/fleet defaults are independent.
4686
4258
  */
4687
4259
  maxLifetimeSeconds?: number;
4688
4260
  /**
4689
- * Idle timeout in seconds.
4690
- *
4691
- * After this much inactivity the sandbox is suspended, with the same
4692
- * suspend semantics and the same driver caveat as `maxLifetimeSeconds`.
4693
- *
4694
- * `create()` substitutes no default: omit the field and it is not sent, so
4695
- * the sandbox falls back to the platform's global idle timeout — 30 minutes
4696
- * unless an operator changed it. The `tangle sandbox create` CLI supplies
4697
- * its own default of 900.
4261
+ * Inactivity before suspension, with maxLifetimeSeconds semantics and driver caveat.
4262
+ * Omitted sends no value: Platform owns the fallback; CLI defaults are independent.
4698
4263
  */
4699
4264
  idleTimeoutSeconds?: number;
4700
4265
  /**
4701
- * Stopped-container grace in seconds before durable cold reclamation.
4702
- * Must be an integer from 1 through 9007199254740. Omit to use the
4703
- * platform cold window (6 hours by default). The lifecycle sweep removes
4704
- * compute only after the grace and a confirmed, uploaded workspace snapshot;
4705
- * the sandbox record and snapshot remain available to resume().
4706
- *
4707
- * Withheld credentials still require a recovery source. Use envRecovery for
4708
- * keys the caller can supply again on cold resume. This does not shorten
4709
- * idle suspension or the separate deleteAfterStoppedSeconds retention.
4266
+ * Positive integer seconds, representable as milliseconds, before cold compute
4267
+ * reclamation. Platform owns the default window. Reclamation requires an uploaded
4268
+ * snapshot; record/snapshot remain resumable. Withheld credentials still need
4269
+ * envRecovery or a separate recovery source. Independent of idle suspension and parked
4270
+ * deletion retention.
4710
4271
  */
4711
4272
  coldTimeoutSeconds?: number;
4712
4273
  /**
4713
- * Retention after stop, in seconds. After the sandbox has sat
4714
- * stopped/suspended continuously for this long, the platform deletes it —
4715
- * the same full teardown `delete()` performs (records, volumes, billing
4716
- * settlement, quota release).
4717
- *
4718
- * `create()` substitutes no default: omit the field and it is not sent, and
4719
- * the platform's own default retention of 30 days parked applies: the
4720
- * sandbox is kept at least that long, and the platform may reclaim it once
4721
- * it has stayed parked past that point. Set this field to hold a sandbox
4722
- * longer than the default, or to release it sooner — an explicit value is
4723
- * the only way to pin the outcome. The parked-retention sweeps do not remove
4724
- * a sandbox before the retention that applies to it has elapsed, and a resume
4725
- * restarts the clock. This bounds those sweeps only: an explicit `delete()`,
4726
- * and platform policy such as billing enforcement, are unaffected.
4727
- *
4728
- * Minimum 300 and maximum 9007199254740; the server rejects a smaller,
4729
- * larger, or non-integer value. The maximum is the largest whole number
4730
- * of seconds the platform can store as milliseconds without losing
4731
- * precision, so it is a bound on the storage, not a policy limit.
4274
+ * Continuous parked retention before full delete, including records, volumes, settlement
4275
+ * and quota release. Resume restarts the clock; explicit delete and billing enforcement
4276
+ * remain independent. Omitted uses Platform lifecycle policy; explicit values pin
4277
+ * retention and must meet its bounds and safe millisecond precision.
4732
4278
  */
4733
4279
  deleteAfterStoppedSeconds?: number;
4734
- /**
4735
- * Enable SSH access to the sandbox.
4736
- * Use `sandbox.ssh()` to get connection credentials.
4737
- * @default false
4738
- */
4280
+ /** Enable SSH; obtain credentials with sandbox.ssh(). Default false. */
4739
4281
  sshEnabled?: boolean;
4740
- /** Custom SSH public keys for access (optional) */
4741
4282
  sshPublicKeys?: string[];
4742
4283
  /** Stored SSH key IDs or names to authorize at creation time */
4743
4284
  sshKeyIds?: string[];
4744
- /**
4745
- * Enable web terminal access.
4746
- * Provides a browser-based terminal via websocket.
4747
- * @default false
4748
- */
4285
+ /** Enable the browser WebSocket terminal. Default false. */
4749
4286
  webTerminalEnabled?: boolean;
4750
- /**
4751
- * Customer-provided S3-compatible storage for snapshots (BYOS3).
4752
- *
4753
- * When configured, snapshots are stored in your own bucket
4754
- * instead of Tangle's managed storage.
4755
- */
4287
+ /** Customer snapshot bucket instead of managed storage; see StorageConfig. */
4756
4288
  storage?: StorageConfig;
4757
4289
  /**
4758
- * Run as a throwaway sandbox: the home directory is NOT persisted across restarts.
4759
- *
4760
- * By default an egress-enabled sandbox is provisioned a persistent home
4761
- * volume (so a stop/resume workspace keeps its state). Set `ephemeral: true` for
4762
- * a one-shot run — a benchmark case, a CI job, any box that produces output and
4763
- * is deleted — to skip that volume and run on a writable scratch home. Egress
4764
- * still works; you only lose the home directory on restart, which a throwaway box
4765
- * never relies on. Independent of `storage`/snapshots (durability stays opt-in).
4290
+ * Use writable scratch home instead of the persistent egress home volume; home state is
4291
+ * lost across restarts. Egress still works. Independent of storage/snapshots.
4766
4292
  */
4767
4293
  ephemeral?: boolean;
4768
4294
  /** Snapshot ID to restore from when creating the sandbox */
@@ -4770,261 +4296,110 @@ interface CreateSandboxOptions {
4770
4296
  /** Source sandbox ID that owns the snapshot (required when fromSnapshot is set) */
4771
4297
  fromSandboxId?: string;
4772
4298
  /**
4773
- * Apply a saved template at create time. Templates seed the
4774
- * sandbox with a snapshot, default environment, and config defaults
4775
- * so a team can publish a golden-path starting point once and have
4776
- * every member spin up the same baseline.
4777
- *
4778
- * The template must either be personal (owned by the caller) or
4779
- * belong to a team the caller is an active member of. Explicit
4780
- * fields on this call win over template defaults — so you can layer
4781
- * a one-off override on top of the golden path without forking the
4782
- * template itself.
4783
- *
4784
- * @example
4785
- * ```typescript
4786
- * const box = await client.create({
4787
- * templateId: "tpl_abc123",
4788
- * teamId: "team_...", // optional; sandbox is shared with the team
4789
- * });
4790
- * ```
4299
+ * Personal or active-team template seeds snapshot, image and config; explicit call
4300
+ * fields override defaults. Explicit templateId/teamId select the saved template and sharing scope.
4791
4301
  */
4792
4302
  templateId?: string;
4793
- /**
4794
- * Create from a published public template by id or slug.
4795
- * The API resolves the latest published version unless
4796
- * `publicTemplateVersionId` is also provided.
4797
- */
4303
+ /** Published template ID/slug; latest version unless publicTemplateVersionId pins one. */
4798
4304
  publicTemplateId?: string;
4799
4305
  /** Pin sandbox creation to a specific published public-template version. */
4800
4306
  publicTemplateVersionId?: string;
4801
4307
  /**
4802
- * Stored names or `"all"`: a bare name selects box delivery (value in the
4803
- * box env under the name) unless the store's saved policy binds it to the
4804
- * proxy. Proxy custody declarations are `proxySecrets`.
4308
+ * Stored names or all: bare names deliver box env unless saved policy selects proxy
4309
+ * custody; author proxy declarations with proxySecrets.
4805
4310
  */
4806
4311
  secrets?: Array<string> | "all";
4807
4312
  /** Canonical profile declaration, forwarded unchanged to the trusted lifecycle owner. */
4808
4313
  proxySecrets?: AgentProfile["proxySecrets"];
4809
4314
  /**
4810
- * Confidential environment variables for the **Tangle (on-chain) driver**,
4811
- * delivered OFF-chain via the operator's 2-phase secret provisioning
4812
- * endpoint after the create job completes. Requires the client to be
4813
- * configured with `operatorApiUrl`.
4814
- *
4815
- * Unlike {@link CreateSandboxOptions.env}, these values never appear in the
4816
- * job calldata: the client mints an EIP-191-authenticated operator session
4817
- * signed by the same key that submitted the job, and the operator injects
4818
- * the secrets only after verifying that key owns the sandbox.
4819
- *
4820
- * @example
4821
- * ```typescript
4822
- * const box = await client.create({
4823
- * tangleSecrets: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY },
4824
- * });
4825
- * ```
4315
+ * On-chain Tangle driver secrets, delivered off-chain after create via operatorApiUrl.
4316
+ * Never job calldata: an EIP-191 operator session signed by the submitting key proves
4317
+ * sandbox ownership before injection.
4826
4318
  */
4827
4319
  tangleSecrets?: Record<string, string>;
4828
- /** Custom metadata to store with the sandbox */
4829
4320
  /** Relative workspace paths retained by the platform with the run sessions. */
4830
4321
  retain?: {
4831
4322
  paths: string[];
4832
4323
  };
4833
4324
  metadata?: Record<string, unknown>;
4834
4325
  /**
4835
- * Share this sandbox with a team. The caller must be an active
4836
- * member of the team — the API rejects requests from non-members
4837
- * before provisioning. When omitted the sandbox is personal
4838
- * (accessible only to the creator).
4326
+ * Require active team membership, checked before provisioning; omitted creates a
4327
+ * personal sandbox.
4839
4328
  */
4840
4329
  teamId?: string;
4841
4330
  /**
4842
- * Sidecar capabilities to enable at boot. Each capability boots an
4843
- * additional subsystem inside the sandbox; absent capabilities incur
4844
- * zero startup cost.
4845
- *
4846
- * Currently supported:
4847
- * - `"computer_use"` — boots Xvfb, dbus, AT-SPI, and an MCP server
4848
- * exposing mouse/keyboard/screenshot via the Anthropic + OpenAI
4849
- * Responses computer-use surface. Required if you plan to call
4850
- * {@link SandboxInstance.getMcpAccessToken | `getMcpAccessToken`}
4851
- * with `capabilities: ["computer_use"]`.
4852
- *
4853
- * The capability is enforced at two layers:
4854
- * 1. The sidecar refuses to start if a capability's binaries are
4855
- * missing (`computer_use` needs the mounted Nix profile with
4856
- * Xvfb, dbus, xdotool, and scrot available at runtime).
4857
- * 2. The MCP token endpoint refuses to mint a `cap: ["computer_use"]`
4858
- * JWT for a sandbox that wasn't created with that capability.
4859
- *
4860
- * **Sizing note:** `computer_use` boots an always-on Xvfb + dbus
4861
- * stack costing roughly **~100 MB resident memory** inside the
4862
- * container. Billing is by reserved capacity (not measured RSS), so
4863
- * this comes out of your sandbox's RAM envelope rather than adding
4864
- * a separate line item. On a 1 GB sandbox that is ~10% of your
4865
- * workload's headroom; bump `resources.memoryMB` to 1.5–2 GB if
4866
- * the agent will run anything memory-hungry alongside it.
4867
- *
4868
- * @example
4869
- * ```typescript
4870
- * const box = await client.create({
4871
- * capabilities: ["computer_use"],
4872
- * });
4873
- * const { token } = await box.getMcpAccessToken({
4874
- * capabilities: ["computer_use"],
4875
- * });
4876
- * ```
4331
+ * Boot selected subsystems; omitted capabilities incur no startup cost. computer_use
4332
+ * requires its installed Xvfb/dbus/AT-SPI/MCP binaries and a matching getMcpAccessToken
4333
+ * capability; both sidecar startup and token mint fail closed otherwise. Desktop
4334
+ * services share reserved sandbox memory; size resources.memoryMB for the workload. See
4335
+ * SDK README computer-use example.
4877
4336
  */
4878
4337
  capabilities?: ReadonlyArray<"computer_use">;
4879
4338
  /**
4880
- * Privacy controls for the sandbox. Two independent layers:
4881
- *
4882
- * - **`egress`** — what happens when the sandbox sends a request to a
4883
- * model vendor (Anthropic, OpenAI, your own router, etc.):
4884
- * - `"redact"` — PII spans are masked before the request leaves
4885
- * the sandbox. Emails, JWTs, API keys, credit cards (Luhn-
4886
- * validated), SSNs, phone numbers, IPv4 addresses are caught
4887
- * today; names / postal addresses / DOBs land when the OPF
4888
- * model service is enabled. The agent receives normal
4889
- * responses; the vendor sees masked input.
4890
- * - `"block"` — PII presence fails the egress request closed.
4891
- * For high-compliance flows that prefer fail-closed to leak.
4892
- * - `"off"` — no egress filtering. Default for free tier; opt-in
4893
- * for tasks that genuinely need raw PII (form-filling,
4894
- * customer-support agents reading customer details).
4895
- *
4896
- * - **`logs`** — whether infrastructure logs / telemetry / Sentry
4897
- * redact PII before recording. This is OUR side, not the model
4898
- * vendor's, and there's basically never a reason to leak PII into
4899
- * our own logs. Default `"on"`.
4900
- *
4901
- * Note: privacy controls operate at the boundary between the
4902
- * sandbox and external systems. They do NOT redact contents inside
4903
- * the sandbox workspace itself — files / code / database fixtures
4904
- * the customer puts there are the customer's data and stay
4905
- * unmodified. Snapshots preserve those contents verbatim.
4906
- *
4907
- * @example
4908
- * ```typescript
4909
- * const box = await client.create({
4910
- * privacy: { egress: "redact", logs: "on" },
4911
- * });
4912
- * ```
4339
+ * Independent external-boundary controls. Egress redact masks recognized PII before
4340
+ * model-vendor requests; block refuses requests containing it; off allows raw content.
4341
+ * The serving privacy policy owns defaults and detector coverage. Logs controls
4342
+ * infrastructure telemetry/Sentry redaction (default on). Workspace files and snapshots
4343
+ * retain customer contents unchanged.
4913
4344
  */
4914
4345
  privacy?: {
4915
4346
  egress?: "redact" | "block" | "off";
4916
4347
  logs?: "on" | "off";
4917
4348
  };
4918
4349
  /**
4919
- * Require HIPAA placement: the sandbox is created only in a
4920
- * HIPAA-designated cell. It can only narrow what the platform decides
4921
- * from your verified credential. A team or app with an accepted BAA in
4922
- * Platform is always placed in a HIPAA cell, with or without this; a
4923
- * credential without that entitlement is refused with
4924
- * {@link CompliancePlacementError} (`COMPLIANCE_NOT_ENTITLED`, 403). A
4925
- * HIPAA create that no designated cell can take now is refused with
4926
- * the same class (`COMPLIANCE_CELL_UNAVAILABLE`, 503) and is never
4927
- * placed in another cell. The created sandbox's `compliance` echo stays
4928
- * server-derived.
4350
+ * Narrow placement to HIPAA cells; accepted Platform BAA credentials already require
4351
+ * this. Unentitled credentials fail COMPLIANCE_NOT_ENTITLED (403); unavailable HIPAA
4352
+ * capacity fails COMPLIANCE_CELL_UNAVAILABLE (503), never another cell.
4353
+ * CompliancePlacementError reports either; compliance echoes remain server-derived.
4929
4354
  */
4930
4355
  compliance?: {
4931
4356
  hipaa: true;
4932
4357
  } | ["hipaa"];
4933
4358
  /**
4934
- * Stable idempotency key for this logical create. Sent as the
4935
- * `Idempotency-Key` header so the API derives a deterministic sandbox
4936
- * identity from (owner, key): a retried create resolves to the SAME
4937
- * provisioning sandbox and joins the in-flight provision instead of
4938
- * starting a fresh cold start per retry. When omitted, the SDK
4939
- * generates one per `create()` call and reuses it across its own
4940
- * timeout-driven retries.
4359
+ * Owner/key identifies one create, joins in-flight provisioning and replays the same
4360
+ * sandbox. Omitted generates one key per create call, reused across its timeout retries.
4941
4361
  */
4942
4362
  idempotencyKey?: string;
4943
4363
  /**
4944
- * Platform user id whose wallet funds managed model usage for this sandbox.
4945
- *
4946
- * Use only from a trusted first-party service acting for an authenticated
4947
- * user. The Sandbox API honors this field only when the caller's exact
4948
- * verified API key ID is allow-listed; otherwise strict deployments reject
4949
- * the create.
4950
- * It never grants the caller permission to charge arbitrary users.
4951
- *
4952
- * This option applies to the HTTP Sandbox API client. Direct Tangle job
4953
- * creation does not support delegated billing.
4364
+ * Managed-model payer for trusted first-party delegation only. API requires the exact
4365
+ * verified key ID allowlist; strict deployments reject other callers. Grants no
4366
+ * arbitrary-user billing authority. HTTP client only; direct Tangle jobs do not delegate
4367
+ * billing.
4954
4368
  */
4955
4369
  billingOwnerId?: string;
4956
4370
  /**
4957
- * What pays this sandbox's compute. `"referral_credit"` spends the
4958
- * account's referral Sandbox-compute credit only: it runs on spare capacity,
4959
- * never falls back to the wallet, and stops with `scoped_credit_exhausted`
4960
- * when the credit runs out or `scoped_credit_held` while its campaign is on
4961
- * hold. Fixed for the sandbox's life. Personal sandboxes only. Defaults to
4962
- * the wallet.
4371
+ * Lifetime-fixed compute funding, default wallet. referral_credit is personal-only spare
4372
+ * capacity, never wallet fallback; exhaustion stops with scoped_credit_exhausted and
4373
+ * campaign hold with scoped_credit_held.
4963
4374
  */
4964
4375
  funding?: "wallet" | "referral_credit";
4965
4376
  /**
4966
- * Place this sandbox only on spare capacity.
4967
- *
4968
- * For first-party delegated creates only: the Sandbox API accepts it only
4969
- * together with `billingOwnerId` from an allow-listed first-party service
4970
- * key, and refuses every other create with 403 `CAPACITY_CLASS_FORBIDDEN`.
4971
- * It restricts placement and is not a priority: no host outside the spare
4972
- * pool takes the sandbox, and the create is refused with 503
4973
- * `SPARE_CAPACITY_UNAVAILABLE` when no spare pool admits it. It also skips
4974
- * the warm pool. The class is fixed at create; resume keeps it.
4377
+ * Lifetime-fixed spare placement, retained on resume, without warm-pool use or priority
4378
+ * promotion. Requires an allowlisted delegated billingOwnerId create; others fail
4379
+ * CAPACITY_CLASS_FORBIDDEN (403). No admitted spare capacity fails
4380
+ * SPARE_CAPACITY_UNAVAILABLE (503), never general placement.
4975
4381
  */
4976
4382
  capacityClass?: "spare_only";
4977
4383
  /**
4978
- * Auto-split inline file mounts out of an inline `backend.profile` object
4979
- * at create time, send the lean profile (mount refs stripped) in the
4980
- * create request, then write the deferred files back once the sandbox is
4981
- * running.
4982
- *
4983
- * When `true` (the default), a profile with sizeable inline mounts (e.g.
4984
- * skills, tool scripts) does not bloat the create POST; the SDK
4985
- * materializes those files via {@link FileSystem.writeMany} /
4986
- * {@link FileSystem.uploadData} after the sandbox reaches `running`. A batch
4987
- * write answered 502, 503 or 504, or lost with its connection, is sent again
4988
- * for up to 10 seconds before create() raises `PartialFailureError`. Only
4989
- * applies to an inline `AgentProfile` object on `backend.profile`; a
4990
- * named-profile string is never split. Set `false` to send the full profile
4991
- * in the create request without a post-create materialization step.
4992
- *
4993
- * @default true
4384
+ * Default true: strip large inline backend.profile mount refs from create, then
4385
+ * materialize files after running via writeMany/uploadData. Transient 502/503/504 or
4386
+ * connection loss follows shared write retry policy before PartialFailureError. Named
4387
+ * profiles are unchanged. False sends all mounts in create.
4994
4388
  */
4995
4389
  autoMaterializeProfileFiles?: boolean;
4996
4390
  /**
4997
- * Auto-defer an inline `backend.profile`'s static corpus so it is delivered
4998
- * once instead of on every turn. At create time the SDK strips inline
4999
- * `resources.skills` from the create request (keeping the create body under
5000
- * its wire cap), then primes the running sandbox with the full profile and
5001
- * references it by hash (`backend.profileSha256`) on subsequent turns. The
5002
- * handle still holds the full profile, so a cache miss transparently resends
5003
- * it.
5004
- *
5005
- * When `false`, the full profile, including skills, travels with the create
5006
- * request and every turn. This applies only to an inline `AgentProfile`
5007
- * object on `backend.profile` and is independent of
5008
- * {@link autoMaterializeProfileFiles}.
5009
- *
5010
- * A turn only substitutes the hash reference when the outgoing profile's
5011
- * content still matches what was primed: mutate the profile (or pass a
5012
- * changed per-turn `backend.profile`) and that turn sends the full profile
5013
- * inline again, so the runtime always runs the profile you passed.
5014
- *
5015
- * @default true
4391
+ * Default true: prime inline backend.profile skills once and use profileSha256 on later
4392
+ * turns; a cache miss resends the full retained profile. Mutated profiles or per-turn
4393
+ * overrides send their actual content. False sends all skills on create/every turn.
4394
+ * Independent of autoMaterializeProfileFiles.
5016
4395
  */
5017
4396
  autoDeferProfile?: boolean;
5018
4397
  }
5019
- /**
5020
- * Per-call overrides for {@link Sandbox.create}.
5021
- */
4398
+ /** Per-create request controls. */
5022
4399
  interface CreateRequestOptions {
5023
4400
  /**
5024
- * Time budget for the whole create-and-reach-running flow, in
5025
- * milliseconds. Cold provisions routinely take ~25–40s, so this
5026
- * defaults high (120000). If the initial POST rides the deadline the
5027
- * SDK polls the sandbox to `running` rather than re-POSTing.
4401
+ * Whole create-to-running budget in ms; SDK_TIMEOUTS.create owns the default. A POST
4402
+ * reaching the deadline is reconciled by polling, not a new create.
5028
4403
  */
5029
4404
  timeoutMs?: number;
5030
4405
  /** Abort the create + poll early. */
@@ -5121,13 +4496,8 @@ declare class TerminalStream {
5121
4496
  }
5122
4497
  //#endregion
5123
4498
  //#region src/types/sandbox-info.d.ts
5124
- /**
5125
- * SSH connection credentials.
5126
- */
5127
4499
  interface SSHCredentials {
5128
- /** Username for SSH authentication */
5129
4500
  username: string;
5130
- /** SSH server port */
5131
4501
  port: number;
5132
4502
  /** ProxyCommand for sandbox API tunnel-based SSH. */
5133
4503
  proxyCommand: string;
@@ -5140,7 +4510,6 @@ interface SSHCommandDescriptor {
5140
4510
  interface SandboxConnection {
5141
4511
  /** Owning host runtime origin; distinct from the regional controller URL. */
5142
4512
  hostUrl?: string;
5143
- /** Sandbox runtime API URL for programmatic access */
5144
4513
  runtimeUrl?: string;
5145
4514
  /** Cell exec origin. Direct requests select this sandbox by header. */
5146
4515
  execHost?: string;
@@ -5153,47 +4522,38 @@ interface SandboxConnection {
5153
4522
  authTokenExpiresAt?: string;
5154
4523
  /** Public inbound edge attachment state for `runtimeUrl`. */
5155
4524
  edgeStatus?: "pending" | "ready" | "failed" | "skipped";
5156
- /** Timestamp when the public edge reached this sandbox. */
5157
4525
  edgeReadyAt?: string;
5158
- /** Last public edge attachment error message. */
5159
4526
  edgeError?: string;
5160
- /** SSH connection info if `sshEnabled` was true during creation */
4527
+ /** Present when creation enabled SSH. */
5161
4528
  ssh?: SSHCredentials;
5162
- /** Web terminal URL if `webTerminalEnabled` was true during creation */
4529
+ /** Present when creation enabled the web terminal. */
5163
4530
  webTerminalUrl?: string;
5164
4531
  }
5165
- /** One server-attributed startup operation. Nested operations overlap; use parent links
5166
- * rather than summing every duration. */
4532
+ /**
4533
+ * Server-attributed startup steps may overlap; follow parent links instead of summing
4534
+ * durations.
4535
+ */
5167
4536
  interface StartupOperation {
5168
4537
  /** `<service>.<phase>` operation name. */
5169
4538
  operation: string;
5170
- /** Service that performed the step, when attributed. */
5171
4539
  service?: string;
5172
4540
  /** Terminal status of the step (e.g. `completed`, `skipped`, `error`). */
5173
4541
  status?: string;
5174
- /** Wall-clock duration of the step in milliseconds, when measured. */
5175
4542
  durationMs?: number;
5176
4543
  /** Containing operation name; absent for a top-level operation. */
5177
4544
  parent?: string;
5178
4545
  /** PII-scrubbed step detail (counts, ids, error codes). */
5179
4546
  metadata?: Record<string, unknown>;
5180
4547
  }
5181
- /** Server startup operations and their operation-name → duration map, exposed by
5182
- * SandboxInstance.startupDiagnostics. */
4548
+ /** Startup steps and operation-name duration map from SandboxInstance.startupDiagnostics. */
5183
4549
  interface StartupDiagnostics {
5184
- /** Ordered startup steps exactly as the platform emitted them. */
5185
4550
  operations: StartupOperation[];
5186
4551
  /** Derived map of operation name → measured duration in milliseconds. */
5187
4552
  phases: Record<string, number>;
5188
4553
  }
5189
- /**
5190
- * Full sandbox information returned from the API.
5191
- */
5192
4554
  interface SandboxInfo {
5193
4555
  readonly proxySecretReceipt?: ProxySecretReceipt;
5194
- /** Unique sandbox identifier */
5195
4556
  id: string;
5196
- /** Human-readable name */
5197
4557
  name?: string;
5198
4558
  /** Control-plane identity of the currently published filesystem contents. */
5199
4559
  filesystemIncarnationId?: string;
@@ -5201,66 +4561,52 @@ interface SandboxInfo {
5201
4561
  filesystemIncarnationProvenance?: "fresh" | "restored" | "unknown";
5202
4562
  /** Whether this incarnation is safe for consumers to treat as authoritative. */
5203
4563
  filesystemIncarnationReadiness?: "transitioning" | "ready";
5204
- /** Current status */
5205
4564
  status: SandboxStatus;
5206
- /** Connection information */
5207
4565
  connection?: SandboxConnection;
5208
- /** Custom metadata */
5209
4566
  metadata?: Record<string, unknown>;
5210
4567
  /** Verified current container identity, available on create and get. */
5211
4568
  captureProof?: SandboxCreateReceipt["captureProof"];
5212
- /** Verified Platform compliance attribution, read-only. Only {hipaa:true} is emitted;
5213
- * create options may narrow placement but cannot grant compliance. */
4569
+ /** Server-derived compliance; create can narrow placement, never grant it. */
5214
4570
  readonly compliance?: {
5215
4571
  readonly hipaa: true;
5216
4572
  };
5217
- /** When the sandbox was created */
5218
4573
  createdAt: Date;
5219
- /** When the sandbox started running */
5220
4574
  startedAt?: Date;
5221
- /** Last activity timestamp */
5222
4575
  lastActivityAt?: Date;
5223
4576
  /**
5224
- * Under `status: "stopped"`: `suspending` while the stop's final snapshot is
5225
- * still being committed, `suspended` once it is. Absent otherwise.
4577
+ * While stopped, suspending commits the final snapshot; suspended confirms it. Absent
4578
+ * otherwise.
5226
4579
  */
5227
4580
  lifecycleState?: "suspending" | "suspended";
5228
4581
  /** When the sandbox entered its current stop. */
5229
4582
  suspendedAt?: Date;
5230
- /** When the sandbox will expire */
5231
4583
  expiresAt?: Date;
5232
- /** Error message if status is 'failed' */
5233
4584
  error?: string;
5234
- /** GPU lease attached during sandbox creation, when requested. */
5235
4585
  gpuLease?: GpuLease;
5236
- /** Actual granted cgroup/volume shape, read from billing. Omitted means unknown, not a
5237
- * default allocation; older rows report their ledger repair value. */
4586
+ /**
4587
+ * Billing-derived granted shape; absent means unknown, older rows report ledger repair
4588
+ * values.
4589
+ */
5238
4590
  resources?: SandboxShape;
5239
4591
  /** Create-only startup details; see SandboxInstance.startupDiagnostics. */
5240
4592
  startupDiagnostics?: StartupDiagnostics;
5241
- /** Create-only platform verdict; absence means unknown, never created. See
5242
- * SandboxInstance.createReceipt. */
4593
+ /**
4594
+ * Create-only verdict; absence is unknown, never created. See
4595
+ * SandboxInstance.createReceipt.
4596
+ */
5243
4597
  createReceipt?: SandboxCreateReceipt;
5244
- /** Resolved egress policy */
5245
4598
  egressPolicy?: EgressPolicy;
5246
- /** Source of the egress policy */
5247
4599
  egressPolicySource?: "sandbox" | "team" | "platform";
5248
4600
  }
5249
- /** Basic health reported by the runtime inside a sandbox. */
5250
4601
  interface SandboxRuntimeHealth extends SandboxRuntimeHealthFields {}
5251
- /** Public preview link associated with a listening runtime port. */
5252
4602
  interface SandboxPortPreviewLink extends SandboxPortPreviewLinkFields {}
5253
- /** One process listening on a port inside a sandbox. */
5254
4603
  interface SandboxPortBinding extends SandboxPortBindingFields {
5255
4604
  previewLink?: SandboxPortPreviewLink;
5256
4605
  }
5257
- /** Options for creating an interactive terminal. */
5258
4606
  interface SandboxTerminalCreateOptions extends TerminalCreateRequestSdk {}
5259
4607
  /** Runtime request context used to attribute terminal events to an agent session. */
5260
4608
  interface SandboxTerminalRequestOptions extends TerminalInputQuerySdk {}
5261
- /** Interactive terminal metadata returned by the runtime. */
5262
4609
  interface SandboxTerminalInfo extends SandboxTerminalInfoWireSdk {
5263
- /** WebSocket path for terminal input/output. */
5264
4610
  streamUrl?: NonNullable<SandboxTerminalInfoWireSdk["streamUrl"]>;
5265
4611
  }
5266
4612
  /** Interactive terminal operations. Input/output flows over `streamUrl`. */
@@ -5271,9 +4617,7 @@ interface SandboxTerminalManager {
5271
4617
  list(): Promise<SandboxTerminalInfo[]>;
5272
4618
  get(sessionId: string): Promise<SandboxTerminalInfo | null>;
5273
4619
  }
5274
- /** Options for `box.terminals.attach()`. */
5275
4620
  interface SandboxTerminalAttachOptions {
5276
- /** Initial PTY geometry reported in the attach init frame. */
5277
4621
  cols?: number;
5278
4622
  rows?: number;
5279
4623
  /** Command to run when the connection id has no live PTY (default: shell). */
@@ -5284,8 +4628,10 @@ interface SandboxTerminalAttachOptions {
5284
4628
  * immediately after acknowledgement. */
5285
4629
  handlers?: TerminalStreamHandlers;
5286
4630
  }
5287
- /** REST terminals plus secured WebSocket attach (API key in Node, scoped token in
5288
- * browsers). Reused IDs reattach and replay history; new IDs start a shell or command. */
4631
+ /**
4632
+ * REST terminals and WebSocket attach: API key in Node, scoped token in browsers. Reused
4633
+ * IDs replay the existing PTY; new IDs start a shell/command.
4634
+ */
5289
4635
  interface SandboxTerminals extends SandboxTerminalManager {
5290
4636
  attach(connectionId: string, options?: SandboxTerminalAttachOptions): Promise<TerminalStream>;
5291
4637
  }
@@ -5301,64 +4647,37 @@ interface TeeAttestationReport {
5301
4647
  /** Unix timestamp when the report was generated. */
5302
4648
  timestamp: number;
5303
4649
  }
5304
- /**
5305
- * Response from a sandbox TEE attestation request.
5306
- */
5307
4650
  interface TeeAttestationResponse {
5308
- /** Sandbox identifier the attestation belongs to. */
5309
4651
  sandbox_id: string;
5310
- /** Raw TEE attestation report. */
5311
4652
  attestation: TeeAttestationReport;
5312
4653
  /** Caller nonce used for this report, when supplied. */
5313
4654
  attestationNonce?: string;
5314
4655
  }
5315
- /**
5316
- * TEE-bound public key used for sealed-secret encryption.
5317
- */
5318
4656
  interface TeePublicKey {
5319
4657
  /** Key agreement/encryption algorithm, e.g. `x25519-hkdf-sha256`. */
5320
4658
  algorithm: string;
5321
- /** Raw public key bytes. */
5322
4659
  public_key_bytes: number[];
5323
4660
  /** Attestation report binding this key to the enclave. */
5324
4661
  attestation: TeeAttestationReport;
5325
4662
  }
5326
- /**
5327
- * Response from a sandbox TEE public-key request.
5328
- */
5329
4663
  interface TeePublicKeyResponse {
5330
- /** Sandbox identifier the public key belongs to. */
5331
4664
  sandbox_id: string;
5332
- /** TEE-bound public key and its attestation proof. */
5333
4665
  public_key: TeePublicKey;
5334
4666
  }
5335
- /**
5336
- * Options for requesting fresh TEE attestation evidence.
5337
- */
5338
4667
  interface TeeAttestationOptions {
5339
4668
  /** Hex-encoded 32–64 byte caller nonce; supported backends bind it into report data to
5340
4669
  * prevent replay. */
5341
4670
  attestationNonce?: string;
5342
4671
  }
5343
- /**
5344
- * Options for listing sandboxes.
5345
- */
5346
4672
  interface ListSandboxOptions {
5347
- /** Filter by status */
5348
4673
  status?: SandboxStatus | SandboxStatus[];
5349
- /** Filter personal/team visibility scope */
5350
4674
  scope?: "personal" | "team" | "all" | `team:${string}`;
5351
- /** Maximum number of results */
5352
4675
  limit?: number;
5353
- /** Offset for pagination */
5354
4676
  offset?: number;
5355
4677
  /** Only sandboxes created with this `metadata.run` (the caller's run id). */
5356
4678
  run?: string;
5357
4679
  }
5358
- /**
5359
- * One compute generation of a sandbox created for a caller run
5360
- * (`metadata.run`). Deleted sandboxes keep theirs.
5361
- */
4680
+ /** Compute generation for metadata.run; retained after deletion. */
5362
4681
  interface SandboxRunGeneration {
5363
4682
  sandboxId: string;
5364
4683
  /** The sandbox's own compute generation id, not the caller run. */
@@ -6436,42 +5755,28 @@ interface ProcessManager {
6436
5755
  }
6437
5756
  //#endregion
6438
5757
  //#region src/types/provisioning.d.ts
6439
- /**
6440
- * Provisioning step identifier for progress reporting.
6441
- */
5758
+ /** Provisioning progress step. */
6442
5759
  type ProvisionStep = "match" | "networking" | "git" | "host-select" | "storage" | "image-check" | "image-pull" | "image-build" | "container-create" | "container-start" | "health-check" | "runtime-ready" | "workspace";
6443
5760
  /**
6444
- * Provisioning progress event emitted during sandbox creation.
6445
- *
6446
- * Subscribe via `box.watchProvisioning()` or pass `onProgress` to `box.waitFor()`.
6447
- *
5761
+ * Progress from watchProvisioning() or waitFor({onProgress}).
6448
5762
  * @example
6449
5763
  * ```typescript
6450
5764
  * for await (const event of box.watchProvisioning()) {
6451
- * console.log(`[${event.step}] ${event.status} — ${event.message}`);
6452
- * if (event.percent !== undefined) {
6453
- * updateProgressBar(event.percent);
6454
- * }
5765
+ * console.log(event.step, event.status, event.message);
6455
5766
  * }
6456
5767
  * ```
6457
5768
  */
6458
5769
  interface ProvisionEvent {
6459
- /** The provisioning step (e.g., "image-pull", "container-start") */
6460
5770
  step: ProvisionStep;
6461
- /** Status of this step */
6462
5771
  status: ProvisionStatus;
6463
- /** Human-readable progress message */
6464
5772
  message?: string;
6465
5773
  /** Overall progress percentage (0-100) */
6466
5774
  percent?: number;
6467
- /** Additional detail for the step */
6468
5775
  detail?: Record<string, unknown>;
6469
5776
  /** ISO timestamp */
6470
5777
  timestamp: string;
6471
5778
  }
6472
- /**
6473
- * Terminal provisioning event indicating success or failure.
6474
- */
5779
+ /** Terminal provisioning result. */
6475
5780
  type ProvisionResult = {
6476
5781
  type: "complete";
6477
5782
  containerId: string;
@@ -6481,43 +5786,26 @@ type ProvisionResult = {
6481
5786
  error: string;
6482
5787
  timestamp: string;
6483
5788
  };
6484
- /**
6485
- * Options for `waitFor()`.
6486
- */
6487
5789
  interface WaitForOptions {
6488
5790
  /** Timeout in milliseconds (default: 120000) */
6489
5791
  timeoutMs?: number;
6490
5792
  /** Poll interval in milliseconds when SSE is unavailable (default: 2000) */
6491
5793
  pollIntervalMs?: number;
6492
- /** AbortSignal for cancellation */
6493
5794
  signal?: AbortSignal;
6494
- /**
6495
- * Callback invoked with real-time provisioning progress events.
6496
- * When provided and the sandbox is provisioning, `waitFor()` uses SSE
6497
- * instead of polling for faster, more granular updates.
6498
- */
5795
+ /** Uses SSE provisioning progress rather than polling while provisioning. */
6499
5796
  onProgress?: (event: ProvisionEvent) => void;
6500
5797
  }
6501
- /**
6502
- * Options for resuming a stopped sandbox.
6503
- */
6504
5798
  interface ResumeOptions {
6505
5799
  /** Timeout in milliseconds for the resume request */
6506
5800
  timeoutMs?: number;
6507
- /** AbortSignal for cancellation */
6508
5801
  signal?: AbortSignal;
6509
5802
  /**
6510
- * Public env values the platform does not store at rest, such as a per-run
6511
- * coordination token or a secret passed at create. Pass the keys a
6512
- * `ResumeEnvRequiredError` named. They are used only when the resume
6513
- * builds a new runtime; a sandbox whose stopped runtime still exists keeps
6514
- * its own values.
5803
+ * Values the platform does not persist at rest, for ResumeEnvRequiredError keys;
5804
+ * used only when rebuilding a runtime. A
5805
+ * retained stopped runtime keeps its existing env.
6515
5806
  */
6516
5807
  env?: Record<string, string>;
6517
5808
  }
6518
- /**
6519
- * Usage information for the account.
6520
- */
6521
5809
  interface UsageInfo {
6522
5810
  /** Total compute minutes used today */
6523
5811
  computeMinutes: number;
@@ -6527,9 +5815,7 @@ interface UsageInfo {
6527
5815
  gpuCostUsd: number;
6528
5816
  /** Provider GPU lease cost basis today in USD */
6529
5817
  gpuProviderCostUsd: number;
6530
- /** Number of currently active sandboxes */
6531
5818
  activeSandboxes: number;
6532
- /** Total sandboxes created (lifetime) */
6533
5819
  totalSandboxes: number;
6534
5820
  /** Period start date (current day UTC) */
6535
5821
  periodStart: Date;
@@ -6547,40 +5833,20 @@ interface SandboxIdentity {
6547
5833
  /** Whether this key may select a funded platform payer on sandbox create. */
6548
5834
  billingDelegationAuthorized: boolean;
6549
5835
  }
6550
- /**
6551
- * Subscription and billing information for the account.
6552
- */
6553
5836
  interface SubscriptionInfo {
6554
- /** Current plan tier */
6555
5837
  plan: "free" | "pro" | "enterprise";
6556
- /** Subscription status */
6557
5838
  status: "active" | "canceled" | "past_due";
6558
5839
  /**
6559
- * Available credit balance in USD.
6560
- *
6561
- * **May be negative** for overage-enabled plans (pro/enterprise):
6562
- * overage charges can push the stored balance below zero. Free-tier
6563
- * plans floor at 0 at the charge path — free users top up their
6564
- * prepaid balance via Stripe Checkout (`POST /v1/billing/topup`,
6565
- * issue #874) when they hit zero rather than going into the red.
6566
- *
6567
- * Freshness semantics differ by deployment backend: the
6568
- * Cloudflare/D1 backend includes real-time projected cost of
6569
- * currently-running sandboxes; the Node/Redis backend returns the
6570
- * last-deducted stored balance and reflects running sandboxes only
6571
- * once their usage is recorded. Consumers should not assume this
6572
- * value is non-negative — use `>= 0` checks rather than truthiness.
5840
+ * USD balance may be negative on overage-enabled plans; free plans floor spending at
5841
+ * zero and require top-up. D1 includes projected running cost; Node/Redis reflects
5842
+ * running usage when recorded. Do not assume nonnegative values or use truthiness.
6573
5843
  */
6574
5844
  creditsAvailableUsd: number;
6575
- /** Credits used in USD */
6576
5845
  creditsUsedUsd: number;
6577
- /** Monthly included balance in USD */
6578
5846
  monthlyBalanceUsd: number;
6579
5847
  /** Max concurrent sandboxes (0 = unlimited) */
6580
5848
  maxConcurrentSandboxes: number;
6581
- /** Whether overage billing is allowed */
6582
5849
  overageAllowed: boolean;
6583
- /** Resource limits */
6584
5850
  limits: {
6585
5851
  maxCpuCores: number;
6586
5852
  maxRamGB: number;
@@ -6622,11 +5888,7 @@ interface SecretsManager {
6622
5888
  }
6623
5889
  //#endregion
6624
5890
  //#region src/types/snapshots.d.ts
6625
- /**
6626
- * Options for creating a snapshot.
6627
- */
6628
5891
  interface SnapshotOptions {
6629
- /** Tags to apply to the snapshot */
6630
5892
  tags?: string[];
6631
5893
  /**
6632
5894
  * Path-scoped capture is unsupported and rejected. Create a whole-workspace
@@ -6635,78 +5897,32 @@ interface SnapshotOptions {
6635
5897
  paths?: never;
6636
5898
  /** Customer-provided storage for BYOS3 (calls the runtime directly) */
6637
5899
  storage?: StorageConfig;
6638
- /**
6639
- * Retry identity for this snapshot. A retry with the same key and the same
6640
- * options replays the stored result instead of taking a second snapshot; the
6641
- * same key with different options is refused.
6642
- *
6643
- * Rejected together with `storage`: the BYOS3 path calls the runtime
6644
- * directly and keeps no operation ledger, so the key would guard nothing.
6645
- */
5900
+ /** Same key and options replay; changed options are refused. Unsupported with customer storage. */
6646
5901
  idempotencyKey?: string;
6647
- /**
6648
- * `false` answers as soon as the capture is durably accepted and returns a
6649
- * {@link SandboxOperation} whose result names the snapshot. Writes made
6650
- * before the call are in it; writes made after it returns may or may not
6651
- * be — wait for the operation when nothing later may land in it. Default
6652
- * `true`. Not supported with `storage`.
6653
- */
5902
+ /** `false` returns a durably accepted operation; pre-call writes are included, later writes may land until capture finishes. Default true; unsupported with storage. */
6654
5903
  wait?: boolean;
6655
5904
  }
6656
- /**
6657
- * How a keyed snapshot resolved.
6658
- *
6659
- * `created` ran this snapshot. `replayed` returned the acknowledgement an
6660
- * earlier request under the same key and options already stored. Absent when
6661
- * the request carried no key.
6662
- */
5905
+ /** `created` captured; `replayed` reused the same keyed request. Absent without a key. */
6663
5906
  interface SnapshotIdempotency {
6664
5907
  outcome: "created" | "replayed";
6665
5908
  requestDigest: string;
6666
5909
  }
6667
- /**
6668
- * Where a managed snapshot's copy stands.
6669
- *
6670
- * - `pending`: written to its sandbox's host and uploading to object storage.
6671
- * A restore on another host waits for the upload, and is refused if the
6672
- * upload cannot complete.
6673
- * - `synced`: in object storage; any host can restore it.
6674
- * - `failed`: the last upload attempt failed. The host still holds the
6675
- * snapshot and the next sync retries the upload.
6676
- */
5910
+ /** pending: host copy uploading; remote restores wait or fail. synced: remotely restorable. failed: host copy retained for retry. */
6677
5911
  type SnapshotRemoteSync = "pending" | "synced" | "failed";
6678
- /**
6679
- * Result of a snapshot operation.
6680
- */
6681
5912
  interface SnapshotResult {
6682
- /** Unique snapshot identifier */
6683
5913
  snapshotId: string;
6684
- /** When the snapshot was created */
6685
5914
  createdAt: Date;
6686
- /** Size in bytes */
6687
5915
  sizeBytes?: number;
6688
- /** Tags applied to the snapshot */
6689
5916
  tags: string[];
6690
- /**
6691
- * Upload state when the create answered. Absent for a replayed keyed
6692
- * create or a customer-storage snapshot. `listSnapshots()` reports the
6693
- * current state.
6694
- */
5917
+ /** Upload state at creation; absent for keyed replays and customer storage. listSnapshots reads current state. */
6695
5918
  remoteSync?: SnapshotRemoteSync;
6696
- /** Present only for a keyed snapshot. */
6697
5919
  idempotency?: SnapshotIdempotency;
6698
- /**
6699
- * Provenance receipt: which agent profile was materialized into the sandbox
6700
- * when this snapshot was taken. Answers "what configuration produced this
6701
- * state?" - the reproducibility, auditing, and self-improvement primitive.
6702
- * Absent when the sandbox ran without a profile (bare sandbox).
6703
- */
5920
+ /** Materialized agent profile at capture; absent for bare sandboxes. */
6704
5921
  provenance?: SnapshotProvenance;
6705
5922
  }
6706
5923
  interface SnapshotProvenance {
6707
- /** The profile the sandbox was created with. */
6708
5924
  base: {
6709
- /** Profile name (e.g. "gtm", "code-reviewer") or null if inline. */name: string | null; /** Content hash of the profile the SDK materialized. */
5925
+ /** Profile name (e.g. "gtm", "code-reviewer") or null if inline. */name: string | null;
6710
5926
  sha256: string;
6711
5927
  };
6712
5928
  /** The profile active at snapshot time (same as base unless updated). */
@@ -6714,14 +5930,12 @@ interface SnapshotProvenance {
6714
5930
  name: string | null;
6715
5931
  sha256: string;
6716
5932
  };
6717
- /** When the profile was materialized into the sandbox. */
6718
5933
  materializedAt: string;
6719
5934
  }
6720
5935
  /** A verb that can finish in the background (`wait: false`). */
6721
5936
  type SandboxOperationKind = "stop" | "snapshot" | "delete";
6722
5937
  /** `accepted` and `running` are open; `succeeded` and `failed` are terminal. */
6723
5938
  type SandboxOperationState = "accepted" | "running" | "succeeded" | "failed";
6724
- /** An operation as last read from the API. */
6725
5939
  interface SandboxOperationInfo {
6726
5940
  /** Empty for a verb the API finished synchronously. */
6727
5941
  id: string;
@@ -6734,16 +5948,14 @@ interface SandboxOperationInfo {
6734
5948
  completedAt?: Date;
6735
5949
  /** Where to poll it; empty for a verb that finished synchronously. */
6736
5950
  statusUrl: string;
6737
- /** Present once succeeded. */
6738
5951
  result?: {
6739
- /** stop: where the final workspace generation was durable when it finished. */durability?: "local" | "remote"; /** snapshot: the snapshot it took. */
6740
- snapshot?: SnapshotResult; /** stop: the sandbox record when it finished, in the API's shape. */
5952
+ /** stop: where the final workspace generation was durable when it finished. */durability?: "local" | "remote";
5953
+ snapshot?: SnapshotResult;
6741
5954
  sandbox?: Record<string, unknown>; /** delete: the delete and its product cleanup finished. */
6742
5955
  deleted?: true; /** delete: the authoritative physical-removal read when requested. */
6743
5956
  removal?: SandboxRemovalState; /** delete the API served synchronously: what that delete attested. */
6744
5957
  outcome?: SandboxDeleteOutcome;
6745
5958
  };
6746
- /** Present once failed. */
6747
5959
  error?: {
6748
5960
  code: string;
6749
5961
  message: string;
@@ -6751,12 +5963,7 @@ interface SandboxOperationInfo {
6751
5963
  }
6752
5964
  /** Options for a stop. */
6753
5965
  interface StopOptions {
6754
- /**
6755
- * `false` answers as soon as the stop is durably accepted and returns a
6756
- * {@link SandboxOperation}; the stop finishes in the background, billing
6757
- * runs until the runtime actually stops, and a resume issued meanwhile
6758
- * waits for it. Default `true`: resolve once the sandbox is stopped.
6759
- */
5966
+ /** `false` returns durable acceptance; billing continues until stopped and resume waits. Default true waits for stop. */
6760
5967
  wait?: boolean;
6761
5968
  /** Seal native sessions and retained workspace paths from the confirmed stopped generation before answering. Requires wait=true. */
6762
5969
  retain?: {
@@ -6767,63 +5974,34 @@ interface StopOptions {
6767
5974
  /** Retry identity: a retry with the same key answers the same operation. */
6768
5975
  idempotencyKey?: string;
6769
5976
  }
6770
- /**
6771
- * Outcome of deleting a snapshot.
6772
- *
6773
- * - `deleted`: this call removed the snapshot.
6774
- * - `already_absent`: it was not there; the caller's intent already holds.
6775
- * - `unknown`: the API did not report which, so neither is claimed. An API
6776
- * deployed before this field existed answers `unknown` rather than throwing.
6777
- */
5977
+ /** deleted: removed now; already_absent: already gone; unknown: no recognized attestation, including older APIs. */
6778
5978
  type SnapshotDeleteOutcome = "deleted" | "already_absent" | "unknown";
6779
5979
  interface SnapshotDeleteAcknowledgement {
6780
5980
  snapshotId: string;
6781
5981
  outcome: SnapshotDeleteOutcome;
6782
- /**
6783
- * How long the platform held this delete while the snapshot's resume
6784
- * generation finished copying to remote storage, in milliseconds: from the
6785
- * first request to the start of the one that succeeded, so the final
6786
- * request's own time is not counted. Absent when the delete was not held.
6787
- */
5982
+ /** HTTP receipt, separate from whether its body attests deletion. */
5983
+ response?: Pick<SandboxErrorMetadata, "requestId" | "traceId" | "method" | "endpoint"> & {
5984
+ status: number;
5985
+ receivedAt: string;
5986
+ parseState: "object" | "array" | "primitive" | "null" | "invalid-json" | "body-read-failed";
5987
+ attestation: {
5988
+ outcome: SnapshotDeleteOutcome | "missing" | "unrecognized";
5989
+ deleted?: boolean;
5990
+ success?: boolean;
5991
+ };
5992
+ };
5993
+ /** Retention wait in ms, from the first request to the final request start; absent when unheld. */
6788
5994
  retainedMs?: number;
6789
5995
  }
6790
- /**
6791
- * Outcome of deleting a sandbox, which is how a forked child is destroyed.
6792
- *
6793
- * - `destroyed`: this call removed the sandbox.
6794
- * - `already_absent`: the runtime had already lost it; the caller's intent
6795
- * already holds and the product-plane rows were finalized.
6796
- * - `unknown`: the API did not report which, so neither is claimed. An API
6797
- * deployed before this field existed answers `unknown` rather than throwing.
6798
- */
5996
+ /** destroyed: removed now; already_absent: runtime absent and product rows finalized; unknown: unattested, including older APIs. */
6799
5997
  type SandboxDeleteOutcome = "destroyed" | "already_absent" | "unknown";
6800
- /**
6801
- * Where the runtime's removal stands after a delete.
6802
- *
6803
- * - `pending`: the sandbox is dead and billed and will not come back; its
6804
- * container, volume and network are reclaimed behind the answer.
6805
- * - `complete`: the caller asked for `until: "removed"` and the reclaim
6806
- * finished inside the wait.
6807
- */
5998
+ /** pending: dead and billed, reclaim asynchronous. complete: requested removal proof finished. */
6808
5999
  type SandboxRemovalState = "pending" | "complete";
6809
6000
  interface SandboxDeleteOptions {
6810
- /** AbortSignal for cancellation */
6811
6001
  signal?: AbortSignal;
6812
- /**
6813
- * Wait for the runtime's removal proof instead of the acknowledgement. The
6814
- * default answers as soon as the sandbox is dead and billed; `"removed"`
6815
- * polls the accepted operation until the container and its volume are
6816
- * reclaimed. A synchronous API can report `removal: "pending"`.
6817
- */
6002
+ /** Default acknowledges death and billing; removed waits for container/volume reclaim. Synchronous APIs may still report pending. */
6818
6003
  until?: "removed";
6819
- /**
6820
- * `false` answers as soon as the delete is durably accepted and returns a
6821
- * {@link SandboxOperation}; the runtime keeps running and billing until
6822
- * the delete kills it, and `await op.wait()` resolves only once the delete
6823
- * and its product cleanup have finished. Not combinable with `until`.
6824
- * An API that serves the delete synchronously returns an operation that is
6825
- * already `succeeded`. Default `true`: the acknowledgement above.
6826
- */
6004
+ /** `false` returns durable acceptance; billing continues until killed, op.wait includes product cleanup. Synchronous replies yield succeeded operations. Default true; incompatible with until. */
6827
6005
  wait?: boolean;
6828
6006
  /** Retry identity for `wait: false`: a retry with the same key answers the same operation. */
6829
6007
  idempotencyKey?: string;
@@ -6831,23 +6009,12 @@ interface SandboxDeleteOptions {
6831
6009
  interface SandboxDeleteAcknowledgement {
6832
6010
  sandboxId: string;
6833
6011
  outcome: SandboxDeleteOutcome;
6834
- /**
6835
- * Present when the API answered on a tombstone. Absent for an API deployed
6836
- * before the field existed, or when the runtime was removed inline.
6837
- */
6012
+ /** Tombstone removal state; absent on older APIs or inline removal. */
6838
6013
  removal?: SandboxRemovalState;
6839
6014
  }
6840
- /**
6841
- * Which sandboxes {@link Sandbox.deleteMatching} removes: the caller's own
6842
- * sandboxes whose metadata matches every entry.
6843
- */
6015
+ /** Delete caller-owned sandboxes matching every metadata prefix. */
6844
6016
  interface DeleteMatchingSandboxesFilter {
6845
- /**
6846
- * Metadata key to required value prefix, 1 to 8 entries. A sandbox matches
6847
- * when each named key holds a string that starts with its prefix, for
6848
- * example `{ retainedIdempotencyKey: "runtime:<runId>:" }` for every
6849
- * sandbox one Agent Runtime run created.
6850
- */
6017
+ /** Required metadata prefixes, 1–8 entries; every value must start with its prefix. */
6851
6018
  metadataPrefix: Record<string, string>;
6852
6019
  }
6853
6020
  interface DeleteMatchingSandboxesOptions {
@@ -6855,30 +6022,15 @@ interface DeleteMatchingSandboxesOptions {
6855
6022
  cascade?: boolean;
6856
6023
  /** Hold each delete until the runtime's removal proof, as {@link SandboxDeleteOptions.until}. */
6857
6024
  until?: "removed";
6858
- /** AbortSignal for cancellation */
6859
6025
  signal?: AbortSignal;
6860
- /**
6861
- * Timeout for each request. The API deletes a bounded batch per request,
6862
- * so the default is 120 s, or 300 s with `until: "removed"`.
6863
- */
6026
+ /** Per-request timeout: default 120 s, or 300 s with removed. */
6864
6027
  timeoutMs?: number;
6865
6028
  }
6866
- /**
6867
- * What happened to one matched sandbox.
6868
- *
6869
- * - `destroyed`: this call removed it.
6870
- * - `already_absent`: it was gone when the delete reached it.
6871
- * - `failed`: the delete was refused; `status`, `code` and `error` say why,
6872
- * and the sandbox may still exist.
6873
- */
6029
+ /** destroyed: removed; already_absent: already gone; failed: refused, with status/code/error. */
6874
6030
  type DeleteMatchingSandboxOutcome = "destroyed" | "already_absent" | "failed";
6875
6031
  interface DeleteMatchingSandboxResult {
6876
6032
  id: string;
6877
- /**
6878
- * True when the sandbox is confirmed gone: `destroyed` or `already_absent`.
6879
- * With `until: "removed"`, a destroyed sandbox also needs its removal proof:
6880
- * one whose wait ran out reports `removal: "pending"` and `confirmed: false`.
6881
- */
6033
+ /** True for confirmed destroyed/absent; removed additionally requires completed physical-removal proof. */
6882
6034
  confirmed: boolean;
6883
6035
  outcome: DeleteMatchingSandboxOutcome;
6884
6036
  removal?: SandboxRemovalState;
@@ -6894,44 +6046,20 @@ interface DeleteMatchingSandboxResult {
6894
6046
  children?: string[];
6895
6047
  }
6896
6048
  interface DeleteMatchingSandboxesResult {
6897
- /**
6898
- * True only when every orchestrator was listed and every matching sandbox
6899
- * is confirmed gone. This is the teardown verdict; read `sandboxes` for
6900
- * the per-sandbox evidence.
6901
- *
6902
- * It covers the sandboxes the call listed. Stop creating matching sandboxes
6903
- * before calling, and call again once in-flight creates have settled: a
6904
- * create that registers after the listing, or retries with the same
6905
- * idempotency key, can leave a match behind a `true`.
6906
- */
6049
+ /** True only after complete listing and confirmed removal of every listed match. Stop concurrent creates first; this does not cover later registrations. */
6907
6050
  complete: boolean;
6908
6051
  /** False when an orchestrator could not be listed, so a match may be missing. */
6909
6052
  listingComplete: boolean;
6910
- /**
6911
- * Matching sandboxes not yet attempted when the call stopped. Nonzero only
6912
- * when the call reached its request bound; call again for them.
6913
- */
6053
+ /** Matches not attempted before the request bound; retry to finish them. */
6914
6054
  remaining: number;
6915
- /** The latest result for each sandbox this call attempted. */
6916
6055
  sandboxes: DeleteMatchingSandboxResult[];
6917
6056
  }
6918
- /**
6919
- * Whether the operation bound to an idempotency key is decided.
6920
- *
6921
- * - `found`: the key is decided; `state` says how.
6922
- * - `not_found`: nothing claimed this key.
6923
- * - `conflict`: an exact-body lookup found a different request body.
6924
- * - `unknown`: a request claimed the key and its result is still undecided, or
6925
- * the API is too old to answer. Reconcile against real state before retrying.
6926
- */
6057
+ /** found: decided; not_found: unclaimed; conflict: body differs; unknown: claimed but undecided or unsupported. Reconcile before retrying. */
6927
6058
  interface WorkspaceOperationLookup {
6928
6059
  outcome: "found" | "not_found" | "conflict" | "unknown";
6929
6060
  kind: "checkpoint" | "fork";
6930
6061
  state?: "pending" | "succeeded" | "failed";
6931
- /**
6932
- * Digest used for the lookup. Exact conflicts use `existingRequestDigest`
6933
- * for the stored digest. Absent only when key-only lookup finds no record.
6934
- */
6062
+ /** Lookup digest; absent only on an empty key-only lookup. Conflicts expose the stored digest separately. */
6935
6063
  requestDigest?: string;
6936
6064
  existingRequestDigest?: string;
6937
6065
  result?: Record<string, unknown>;
@@ -6946,21 +6074,12 @@ interface RestoreSnapshotOptions {
6946
6074
  destinationPath?: string;
6947
6075
  snapshotId?: string;
6948
6076
  }
6949
- /**
6950
- * Metadata about an existing snapshot.
6951
- */
6952
6077
  interface SnapshotInfo {
6953
- /** Unique snapshot identifier */
6954
6078
  snapshotId: string;
6955
- /** Sandbox this snapshot belongs to */
6956
6079
  sandboxId: string;
6957
- /** When the snapshot was created */
6958
6080
  createdAt: Date;
6959
- /** Tags applied to the snapshot */
6960
6081
  tags: string[];
6961
- /** Paths included in the snapshot */
6962
6082
  paths: string[];
6963
- /** Size in bytes */
6964
6083
  sizeBytes?: number;
6965
6084
  /** Upload state, when the API reports it. */
6966
6085
  remoteSync?: SnapshotRemoteSync;