@tangle-network/sandbox 0.10.5-develop.20260713235503.8f2cefc → 0.10.5-develop.20260715115519.fee3d86

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.
@@ -1,4 +1,5 @@
1
- import { f as ValidationError, l as ServerError, p as parseErrorResponse } from "./errors-wd266B9Q.js";
1
+ import { c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, p as parseErrorResponse, s as QuotaError } from "./errors-wd266B9Q.js";
2
+ import { FILE_UPLOAD_SESSION_MAX_BYTES, isFileTooLargeErrorBody, isPayloadTooLargeErrorBody } from "@tangle-network/runtime-contracts";
2
3
  //#region src/backend-config.ts
3
4
  const LEGACY_QUESTION_ALIAS_KEY = ["question", "Channel"].join("");
4
5
  function parseModelString(model) {
@@ -153,6 +154,238 @@ function serializeForSidecar(profile) {
153
154
  return toBackendProfile(profile);
154
155
  }
155
156
  //#endregion
157
+ //#region src/lib/chunked-upload.ts
158
+ /**
159
+ * Chunked upload — the sanctioned SDK path for delivering payloads larger
160
+ * than the sandbox API's single-request body caps. Splits the payload into
161
+ * server-sized parts against a `/fs/upload-session` session, PUTs each part
162
+ * with transient retry, then commits with a whole-payload SHA-256 so the
163
+ * runtime can verify nothing was dropped or reordered in transit.
164
+ *
165
+ * Browser/Worker-safe: no `node:` imports, no `Buffer`. Input normalizes to
166
+ * a `Uint8Array` and hashes via Web Crypto (`crypto.subtle`), available in
167
+ * browsers, Workers, and Node 18+ — the same environments this module must
168
+ * run in unmodified.
169
+ */
170
+ const DEFAULT_MAX_RETRIES = 4;
171
+ const RETRY_BASE_MS = 250;
172
+ const RETRY_MAX_MS = 2e3;
173
+ const delay = (ms, signal) => new Promise((resolve, reject) => {
174
+ if (signal?.aborted) {
175
+ reject(signal.reason ?? /* @__PURE__ */ new Error("aborted"));
176
+ return;
177
+ }
178
+ const timer = setTimeout(() => {
179
+ signal?.removeEventListener("abort", onAbort);
180
+ resolve();
181
+ }, ms);
182
+ function onAbort() {
183
+ clearTimeout(timer);
184
+ reject(signal?.reason ?? /* @__PURE__ */ new Error("aborted"));
185
+ }
186
+ signal?.addEventListener("abort", onAbort, { once: true });
187
+ });
188
+ /** Transient part-upload failures worth retrying: rate-limit/budget (429),
189
+ * 5xx, transport (network), and request timeouts — mirrors
190
+ * `isTransientWriteError` in `sandbox.ts`. A non-transient error (bad path,
191
+ * auth, checksum, containment) fails loud immediately. */
192
+ function isTransientUploadError(err) {
193
+ return err instanceof QuotaError || err instanceof ServerError || err instanceof NetworkError || err instanceof TimeoutError;
194
+ }
195
+ function isChecksumMismatch(err) {
196
+ return err instanceof SandboxError && err.code === "CHECKSUM_MISMATCH";
197
+ }
198
+ /** Cheap size probe used for the pre-flight cap check, read directly off
199
+ * the input shape (`Blob.size` / `ArrayBuffer.byteLength` / view
200
+ * `byteLength`) so an oversized `Blob` never has its bytes materialized
201
+ * just to be rejected. Strings have no cheap length in UTF-8, so they're
202
+ * encoded once here (and once more in {@link normalizeToBytes} — an
203
+ * acceptable cost given strings are never the multi-MB case this path
204
+ * exists for). */
205
+ function sizeOfInput(data) {
206
+ if (typeof data === "string") return new TextEncoder().encode(data).byteLength;
207
+ if (data instanceof ArrayBuffer) return data.byteLength;
208
+ if (ArrayBuffer.isView(data)) return data.byteLength;
209
+ return data.size;
210
+ }
211
+ /**
212
+ * Normalizes to a `Uint8Array` backed by a plain (never shared)
213
+ * `ArrayBuffer`. A caller-supplied view may be backed by a
214
+ * `SharedArrayBuffer`, which `crypto.subtle.digest` and `fetch`'s
215
+ * `BodyInit` both reject at the type level (and some engines reject at
216
+ * runtime) — copying here keeps every downstream call on one concrete,
217
+ * always-accepted buffer type.
218
+ */
219
+ async function normalizeToBytes(data) {
220
+ if (typeof data === "string") return new TextEncoder().encode(data);
221
+ if (data instanceof ArrayBuffer) return new Uint8Array(data.slice(0));
222
+ if (ArrayBuffer.isView(data)) {
223
+ const copy = new Uint8Array(data.byteLength);
224
+ copy.set(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
225
+ return copy;
226
+ }
227
+ return new Uint8Array(await data.arrayBuffer());
228
+ }
229
+ function webCryptoSubtle() {
230
+ const subtle = globalThis.crypto?.subtle;
231
+ if (!subtle) throw new Error("chunked upload requires Web Crypto (crypto.subtle) for SHA-256 hashing — available in browsers, Workers, and Node 18+");
232
+ return subtle;
233
+ }
234
+ async function sha256Hex(bytes) {
235
+ const digest = await webCryptoSubtle().digest("SHA-256", bytes);
236
+ return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
237
+ }
238
+ /**
239
+ * Canonical size-cap bodies (413 `PAYLOAD_TOO_LARGE` / `FILE_TOO_LARGE`)
240
+ * carry `surface`/`limitBytes`/`actualBytes` that the generic error parser
241
+ * drops; fold them into the message before delegating to
242
+ * `parseErrorResponse` for the rest (status→class mapping, retryAfterMs,
243
+ * origin).
244
+ */
245
+ async function parseUploadError(response) {
246
+ const bodyText = await response.text();
247
+ let parsedBody;
248
+ try {
249
+ parsedBody = JSON.parse(bodyText);
250
+ } catch {
251
+ parsedBody = void 0;
252
+ }
253
+ if (isPayloadTooLargeErrorBody(parsedBody) || isFileTooLargeErrorBody(parsedBody)) {
254
+ const { code, message, surface, limitBytes, actualBytes } = parsedBody.error;
255
+ const detail = typeof actualBytes === "number" ? `${message} (${surface}: ${actualBytes} of ${limitBytes} bytes)` : `${message} (${surface}: limit ${limitBytes} bytes)`;
256
+ return parseErrorResponse(response.status, JSON.stringify({
257
+ code,
258
+ message: detail
259
+ }), void 0, response.headers);
260
+ }
261
+ return parseErrorResponse(response.status, bodyText, void 0, response.headers);
262
+ }
263
+ async function initUploadSession(transport, remotePath, totalBytes, sha256, mode, signal) {
264
+ signal?.throwIfAborted();
265
+ const response = await transport.fetch("/fs/upload-session", {
266
+ method: "POST",
267
+ headers: { "Content-Type": "application/json" },
268
+ body: JSON.stringify({
269
+ path: remotePath,
270
+ mode,
271
+ totalBytes,
272
+ sha256
273
+ }),
274
+ signal
275
+ });
276
+ if (!response.ok) throw await parseUploadError(response);
277
+ return (await response.json()).data;
278
+ }
279
+ async function putPart(transport, uploadId, index, chunk, options) {
280
+ const maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
281
+ for (let attempt = 0;; attempt++) {
282
+ options.signal?.throwIfAborted();
283
+ try {
284
+ const response = await transport.fetch(`/fs/upload-session/${encodeURIComponent(uploadId)}/parts/${index}`, {
285
+ method: "PUT",
286
+ headers: { "Content-Type": "application/octet-stream" },
287
+ body: chunk,
288
+ signal: options.signal
289
+ });
290
+ if (!response.ok) throw await parseUploadError(response);
291
+ return;
292
+ } catch (err) {
293
+ if (isTransientUploadError(err) && attempt < maxRetries) {
294
+ const retryAfterMs = err instanceof SandboxError ? err.retryAfterMs : void 0;
295
+ const backoff = Math.min(RETRY_BASE_MS * 2 ** attempt, RETRY_MAX_MS);
296
+ await delay(retryAfterMs ?? backoff, options.signal);
297
+ continue;
298
+ }
299
+ throw err;
300
+ }
301
+ }
302
+ }
303
+ function partCount(totalBytes, partSize) {
304
+ return Math.ceil(totalBytes / partSize);
305
+ }
306
+ async function uploadAllParts(transport, uploadId, bytes, partSize, totalParts, options) {
307
+ const totalBytes = bytes.byteLength;
308
+ const paceMs = options.paceMs ?? 0;
309
+ let uploadedBytes = 0;
310
+ let started = false;
311
+ for (let index = 0; index < totalParts; index++) {
312
+ if (started && paceMs > 0) await delay(paceMs, options.signal);
313
+ started = true;
314
+ const start = index * partSize;
315
+ const end = Math.min(start + partSize, totalBytes);
316
+ await putPart(transport, uploadId, index, bytes.subarray(start, end), options);
317
+ uploadedBytes += end - start;
318
+ options.onProgress?.({
319
+ bytesUploaded: uploadedBytes,
320
+ totalBytes,
321
+ percentage: totalBytes === 0 ? 100 : Math.round(uploadedBytes / totalBytes * 100)
322
+ });
323
+ }
324
+ }
325
+ async function commitSession(transport, uploadId, totalParts, sha256, signal) {
326
+ signal?.throwIfAborted();
327
+ const response = await transport.fetch(`/fs/upload-session/${encodeURIComponent(uploadId)}/commit`, {
328
+ method: "POST",
329
+ headers: { "Content-Type": "application/json" },
330
+ body: JSON.stringify({
331
+ totalParts,
332
+ sha256
333
+ }),
334
+ signal
335
+ });
336
+ if (!response.ok) throw await parseUploadError(response);
337
+ return (await response.json()).data;
338
+ }
339
+ /** Best-effort abort of an in-progress session — never masks the real
340
+ * failure that triggered it, and never itself throws. An orphaned session
341
+ * also self-expires server-side (`expiresAt`), so a failed DELETE here is
342
+ * not a leak, just deferred cleanup. */
343
+ async function abortSession(transport, uploadId) {
344
+ try {
345
+ await transport.fetch(`/fs/upload-session/${encodeURIComponent(uploadId)}`, { method: "DELETE" });
346
+ } catch {}
347
+ }
348
+ /**
349
+ * Upload arbitrary binary or text data to the sandbox via the chunked
350
+ * upload-session protocol, verifying integrity with a whole-payload
351
+ * SHA-256 at commit. Browser/Worker-safe and works identically over the
352
+ * gateway proxy or a direct sidecar connection — see
353
+ * {@link FileSystem.uploadData}.
354
+ *
355
+ * @param transport - Fetch-shaped adapter scoped to the sandbox runtime
356
+ * (paths are relative to it, e.g. `/fs/upload-session`).
357
+ * @param remotePath - Destination path in the sandbox.
358
+ * @param data - Payload to upload. Strings encode as UTF-8.
359
+ * @param options - See {@link ChunkedUploadOptions}.
360
+ * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately (zero requests) if
361
+ * the payload exceeds {@link FILE_UPLOAD_SESSION_MAX_BYTES}; otherwise the
362
+ * typed error from whichever step (init/part/commit) failed after retries
363
+ * are exhausted.
364
+ */
365
+ async function uploadChunked(transport, remotePath, data, options = {}) {
366
+ const estimatedSize = sizeOfInput(data);
367
+ if (estimatedSize > FILE_UPLOAD_SESSION_MAX_BYTES) throw new SandboxError(`Payload for ${remotePath} is ${estimatedSize} bytes, over the ${FILE_UPLOAD_SESSION_MAX_BYTES} byte chunked-upload session cap`, "PAYLOAD_TOO_LARGE", 413);
368
+ options.signal?.throwIfAborted();
369
+ const bytes = await normalizeToBytes(data);
370
+ options.signal?.throwIfAborted();
371
+ const sha256 = await sha256Hex(bytes);
372
+ const init = await initUploadSession(transport, remotePath, bytes.byteLength, sha256, options.mode, options.signal);
373
+ const totalParts = partCount(bytes.byteLength, init.partSize);
374
+ try {
375
+ await uploadAllParts(transport, init.uploadId, bytes, init.partSize, totalParts, options);
376
+ try {
377
+ return await commitSession(transport, init.uploadId, totalParts, sha256, options.signal);
378
+ } catch (err) {
379
+ if (!isChecksumMismatch(err)) throw err;
380
+ await uploadAllParts(transport, init.uploadId, bytes, init.partSize, totalParts, options);
381
+ return await commitSession(transport, init.uploadId, totalParts, sha256, options.signal);
382
+ }
383
+ } catch (err) {
384
+ await abortSession(transport, init.uploadId);
385
+ throw err;
386
+ }
387
+ }
388
+ //#endregion
156
389
  //#region src/runtime-api.ts
157
390
  /** Internal typed client for routes served by a sandbox runtime. */
158
391
  var SandboxRuntimeApi = class {
@@ -249,6 +482,25 @@ var SandboxRuntimeApi = class {
249
482
  })
250
483
  })).data;
251
484
  }
485
+ /**
486
+ * Upload in-memory binary or text data to the sandbox over the chunked
487
+ * upload-session protocol — the browser/Worker-safe sanctioned path for
488
+ * payloads over ~1 MiB, sized to clear the gateway proxy's per-request cap
489
+ * (parts stay under {@link FILE_UPLOAD_PART_MAX_BYTES}). Binary-safe:
490
+ * accepts a `Blob`, `ArrayBuffer`, `ArrayBufferView`, or UTF-8 `string`.
491
+ * Delegates to the shared `uploadChunked` engine in `lib/chunked-upload.js`,
492
+ * wired to this client's `transport.fetch` so requests carry the same
493
+ * scoped-token `Authorization` header and base URL as every other method
494
+ * on this class (e.g. {@link SandboxRuntimeApi.writeFile}) — works
495
+ * identically over the gateway proxy or a direct sidecar connection.
496
+ *
497
+ * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately, before any
498
+ * request, if the payload exceeds the chunked-upload session cap.
499
+ */
500
+ async uploadData(remotePath, data, options) {
501
+ await this.transport.ensureRunning();
502
+ return uploadChunked({ fetch: (path, init) => this.transport.fetch(path, init) }, remotePath, data, options);
503
+ }
252
504
  async deleteFile(path, options = {}) {
253
505
  await this.transport.ensureRunning();
254
506
  const params = new URLSearchParams();
@@ -445,4 +697,4 @@ function normalizeSessionInfo(raw) {
445
697
  };
446
698
  }
447
699
  //#endregion
448
- export { serializeForSidecar as i, normalizeSessionInfo as n, normalizeRuntimeBackendConfig as r, SandboxRuntimeApi as t };
700
+ export { serializeForSidecar as a, normalizeRuntimeBackendConfig as i, normalizeSessionInfo as n, uploadChunked as r, SandboxRuntimeApi as t };
package/dist/runtime.d.ts CHANGED
@@ -1,6 +1,31 @@
1
- import { A as CommitTaskSessionOptions, B as CreateTaskSessionOptions, Dr as SandboxRuntimeHealth, Jr as SentSessionMessage, Kr as SendSessionMessageOptions, Mi as WriteFileOptions, Mr as SandboxTerminalInfo, Nr as SandboxTerminalManager, Pr as SandboxTerminalRequestOptions, Qr as SessionInfo, Sr as SandboxPortBinding, dt as FileTreeResult, ei as SessionMessage, ft as FileWriteResult, gi as TaskSessionInfo, it as FileReadBatchResult, jr as SandboxTerminalCreateOptions, kn as RenameOptions, kr as SandboxRuntimeProfileList, mi as TaskSessionCommitResult, pi as TaskSessionChanges, qr as SendSessionMessageRequest, qt as ListMessagesOptions, rt as FileReadBatchOptions, st as FileRenameResult, ut as FileTreeOptions, z as CreateSessionOptions } from "./types-yNRVRww-.js";
1
+ import { Ai as UploadProgress, E as ChunkedUploadResult, Fr as SandboxTerminalManager, H as CreateTaskSessionOptions, Ir as SandboxTerminalRequestOptions, Jr as SendSessionMessageOptions, M as CommitTaskSessionOptions, Nr as SandboxTerminalCreateOptions, Pi as WriteFileOptions, Pr as SandboxTerminalInfo, T as ChunkedUploadOptions, V as CreateSessionOptions, Xr as SentSessionMessage, Yr as SendSessionMessageRequest, Yt as ListMessagesOptions, at as FileReadBatchOptions, ei as SessionInfo, ft as FileTreeOptions, gi as TaskSessionCommitResult, hi as TaskSessionChanges, jn as RenameOptions, jr as SandboxRuntimeProfileList, kr as SandboxRuntimeHealth, lt as FileRenameResult, mt as FileWriteResult, ni as SessionMessage, ot as FileReadBatchResult, pt as FileTreeResult, vi as TaskSessionInfo, wr as SandboxPortBinding } from "./types-LNLeU9Ub.js";
2
2
  import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-CNCz3Ms9.js";
3
3
 
4
+ //#region src/lib/chunked-upload.d.ts
5
+ /** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
6
+ * in the SDK, or any fetch-shaped adapter in a standalone consumer. */
7
+ interface ChunkedUploadTransport {
8
+ fetch(path: string, init?: RequestInit): Promise<Response>;
9
+ }
10
+ /**
11
+ * Upload arbitrary binary or text data to the sandbox via the chunked
12
+ * upload-session protocol, verifying integrity with a whole-payload
13
+ * SHA-256 at commit. Browser/Worker-safe and works identically over the
14
+ * gateway proxy or a direct sidecar connection — see
15
+ * {@link FileSystem.uploadData}.
16
+ *
17
+ * @param transport - Fetch-shaped adapter scoped to the sandbox runtime
18
+ * (paths are relative to it, e.g. `/fs/upload-session`).
19
+ * @param remotePath - Destination path in the sandbox.
20
+ * @param data - Payload to upload. Strings encode as UTF-8.
21
+ * @param options - See {@link ChunkedUploadOptions}.
22
+ * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately (zero requests) if
23
+ * the payload exceeds {@link FILE_UPLOAD_SESSION_MAX_BYTES}; otherwise the
24
+ * typed error from whichever step (init/part/commit) failed after retries
25
+ * are exhausted.
26
+ */
27
+ declare function uploadChunked(transport: ChunkedUploadTransport, remotePath: string, data: Blob | ArrayBuffer | ArrayBufferView | string, options?: ChunkedUploadOptions): Promise<ChunkedUploadResult>;
28
+ //#endregion
4
29
  //#region src/runtime-api.d.ts
5
30
  interface RuntimeTransport {
6
31
  ensureRunning(): Promise<void>;
@@ -16,6 +41,22 @@ declare class SandboxRuntimeApi {
16
41
  profiles(): Promise<SandboxRuntimeProfileList>;
17
42
  readFiles(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
18
43
  writeFile(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
44
+ /**
45
+ * Upload in-memory binary or text data to the sandbox over the chunked
46
+ * upload-session protocol — the browser/Worker-safe sanctioned path for
47
+ * payloads over ~1 MiB, sized to clear the gateway proxy's per-request cap
48
+ * (parts stay under {@link FILE_UPLOAD_PART_MAX_BYTES}). Binary-safe:
49
+ * accepts a `Blob`, `ArrayBuffer`, `ArrayBufferView`, or UTF-8 `string`.
50
+ * Delegates to the shared `uploadChunked` engine in `lib/chunked-upload.js`,
51
+ * wired to this client's `transport.fetch` so requests carry the same
52
+ * scoped-token `Authorization` header and base URL as every other method
53
+ * on this class (e.g. {@link SandboxRuntimeApi.writeFile}) — works
54
+ * identically over the gateway proxy or a direct sidecar connection.
55
+ *
56
+ * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately, before any
57
+ * request, if the payload exceeds the chunked-upload session cap.
58
+ */
59
+ uploadData(remotePath: string, data: Blob | ArrayBuffer | ArrayBufferView | string, options?: ChunkedUploadOptions): Promise<ChunkedUploadResult>;
19
60
  deleteFile(path: string, options?: Pick<WriteFileOptions, "sessionId">): Promise<void>;
20
61
  renameFile(sourcePath: string, destinationPath: string, options?: RenameOptions): Promise<FileRenameResult>;
21
62
  fileTree(path: string, options?: FileTreeOptions): Promise<FileTreeResult>;
@@ -62,4 +103,4 @@ declare class SandboxRuntimeClient extends SandboxRuntimeApi {
62
103
  }
63
104
  declare function createSandboxRuntimeClient(config: SandboxRuntimeClientConfig): SandboxRuntimeClient;
64
105
  //#endregion
65
- export { AuthError, CapabilityError, type FileReadBatchOptions, type FileReadBatchResult, type FileRenameResult, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, type RenameOptions, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionMessage, StateError, TimeoutError, ValidationError, type WriteFileOptions, createSandboxRuntimeClient };
106
+ export { AuthError, CapabilityError, type ChunkedUploadOptions, type ChunkedUploadResult, type ChunkedUploadTransport, type FileReadBatchOptions, type FileReadBatchResult, type FileRenameResult, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, type RenameOptions, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionMessage, StateError, TimeoutError, type UploadProgress, ValidationError, type WriteFileOptions, createSandboxRuntimeClient, uploadChunked };
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as SandboxRuntimeApi } from "./runtime-api-CaXI7Kl2.js";
1
+ import { r as uploadChunked, t as SandboxRuntimeApi } from "./runtime-api-BWq4XSrb.js";
2
2
  import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
3
3
  //#region src/runtime-client.ts
4
4
  const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
@@ -80,4 +80,4 @@ function createSandboxRuntimeClient(config) {
80
80
  return new SandboxRuntimeClient(config);
81
81
  }
82
82
  //#endregion
83
- export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxError, SandboxRuntimeClient, ServerError, StateError, TimeoutError, ValidationError, createSandboxRuntimeClient };
83
+ export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxError, SandboxRuntimeClient, ServerError, StateError, TimeoutError, ValidationError, createSandboxRuntimeClient, uploadChunked };
@@ -1,4 +1,4 @@
1
- import { $ as EventStreamOptions, $r as SessionListOptions, A as CommitTaskSessionOptions, Ai as WaitForOptions, An as RestoreSnapshotOptions, Ar as SandboxStatus, B as CreateTaskSessionOptions, Bn as SSHCommandDescriptor, Br as ScopedToken, Bt as InstalledTool, D as CodeLanguage, Dr as SandboxRuntimeHealth, Dt as GitDiff, E as CodeExecutionResult, Fr as SandboxTraceBundle, Gn as SandboxEvent, Gt as IntelligenceReportWindow, Hr as SearchMatch, Ht as IntelligenceReportBudget, In as RolloutStartResult, Jr as SentSessionMessage, Kr as SendSessionMessageOptions, Kt as JsonValue, Mi as WriteFileOptions, Mn as Rollout, Ni as WriteManyFile, Nr as SandboxTerminalManager, Ot as GitStatus, Pi as WriteManyOptions, Pn as RolloutOptions, Pt as GpuLeaseManager, Qr as SessionInfo, Qt as MintScopedTokenOptions, Rr as SandboxTraceOptions, Si as TeePublicKeyResponse, Sr as SandboxPortBinding, T as CodeExecutionOptions, Ti as TurnDriveResult, Tr as SandboxResourceUsage, Tt as GitCommit, U as DispatchPromptOptions, Un as SandboxConnection, Ur as SearchOptions, Ut as IntelligenceReportCompareTo, Vn as SSHCredentials, Vt as IntelligenceReport, W as DispatchedSession, Xr as SessionEventStreamOptions, Y as DriverInfo, Z as EgressManager, Zr as SessionForkOptions, _n as ProvisionEvent, ai as SnapshotResult, bi as TeeAttestationResponse, ct as FileSystem, di as TaskOptions, ei as SessionMessage, et as ExecOptions, fi as TaskResult, ft as FileWriteResult, gi as TaskSessionInfo, gn as PromptResult, hn as PromptOptions, ii as SnapshotOptions, in as PermissionsManager, j as CompletedTurnResult, ji as WaitForRolloutOptions, jn as ResumeOptions, kr as SandboxRuntimeProfileList, kt as GpuLease, l as BackendManager, mi as TaskSessionCommitResult, mn as PromptInputPart, on as PreviewLinkManager, pi as TaskSessionChanges, q as DriveTurnOptions, qr as SendSessionMessageRequest, qt as ListMessagesOptions, ri as SnapshotInfo, s as BackendConfig, si as StartupDiagnostics, tn as NetworkManager, tt as ExecResult, un as ProcessManager, ur as SandboxFleetTraceBundle, vi as TeeAttestationOptions, vn as ProvisionResult, w as BranchOptions, wt as GitBranch, yr as SandboxInfo, z as CreateSessionOptions } from "./types-yNRVRww-.js";
1
+ import { $ as EgressManager, $r as SessionForkOptions, At as GitStatus, Br as SandboxTraceOptions, D as CodeExecutionOptions, Di as TurnDriveResult, Dr as SandboxResourceUsage, Dt as GitCommit, Et as GitBranch, Fi as WriteManyFile, Fr as SandboxTerminalManager, G as DispatchPromptOptions, Gn as SandboxConnection, Gr as SearchOptions, Gt as IntelligenceReportCompareTo, H as CreateTaskSessionOptions, Hn as SSHCommandDescriptor, Hr as ScopedToken, Ht as InstalledTool, Ii as WriteManyOptions, In as RolloutOptions, It as GpuLeaseManager, Jr as SendSessionMessageOptions, Jt as JsonValue, K as DispatchedSession, Lr as SandboxTraceBundle, M as CommitTaskSessionOptions, Mi as WaitForOptions, Mn as RestoreSnapshotOptions, Mr as SandboxStatus, N as CompletedTurnResult, Ni as WaitForRolloutOptions, Nn as ResumeOptions, O as CodeExecutionResult, Pi as WriteFileOptions, Pn as Rollout, Qr as SessionEventStreamOptions, Rn as RolloutStartResult, Si as TeeAttestationResponse, Un as SSHCredentials, Ut as IntelligenceReport, V as CreateSessionOptions, Wr as SearchMatch, Wt as IntelligenceReportBudget, Xr as SentSessionMessage, Y as DriveTurnOptions, Yr as SendSessionMessageRequest, Yt as ListMessagesOptions, Z as DriverInfo, _n as PromptOptions, ai as SnapshotInfo, bi as TeeAttestationOptions, bn as ProvisionResult, cn as PreviewLinkManager, ei as SessionInfo, en as MintScopedTokenOptions, fn as ProcessManager, fr as SandboxFleetTraceBundle, gi as TaskSessionCommitResult, gn as PromptInputPart, hi as TaskSessionChanges, jr as SandboxRuntimeProfileList, jt as GpuLease, k as CodeLanguage, kr as SandboxRuntimeHealth, kt as GitDiff, l as BackendManager, li as StartupDiagnostics, mi as TaskResult, mt as FileWriteResult, ni as SessionMessage, nt as ExecOptions, oi as SnapshotOptions, on as PermissionsManager, pi as TaskOptions, qn as SandboxEvent, qt as IntelligenceReportWindow, rn as NetworkManager, rt as ExecResult, s as BackendConfig, si as SnapshotResult, ti as SessionListOptions, tt as EventStreamOptions, ut as FileSystem, vi as TaskSessionInfo, vn as PromptResult, w as BranchOptions, wi as TeePublicKeyResponse, wr as SandboxPortBinding, xr as SandboxInfo, yn as ProvisionEvent } from "./types-LNLeU9Ub.js";
2
2
 
3
3
  //#region src/mcp.d.ts
4
4
  /**
@@ -894,6 +894,11 @@ declare class SandboxInstance {
894
894
  private fsReadBatch;
895
895
  private fsTree;
896
896
  private fsUpload;
897
+ /** See {@link FileSystem.uploadData}. Delegates to the shared, browser-safe
898
+ * chunked-upload flow in `lib/chunked-upload.ts`, wired to this sandbox's
899
+ * runtime endpoint (works over the gateway proxy or a direct connection —
900
+ * both are transparent through `runtimeFetch`). */
901
+ private fsUploadData;
897
902
  private fsDownload;
898
903
  private fsUploadDir;
899
904
  private fsDownloadDir;
@@ -1,4 +1,4 @@
1
- import { n as normalizeSessionInfo, r as normalizeRuntimeBackendConfig, t as SandboxRuntimeApi } from "./runtime-api-CaXI7Kl2.js";
1
+ import { i as normalizeRuntimeBackendConfig, n as normalizeSessionInfo, r as uploadChunked, t as SandboxRuntimeApi } from "./runtime-api-BWq4XSrb.js";
2
2
  import { c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, p as parseErrorResponse, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
3
3
  import { addTokenUsage, readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
4
4
  //#region src/lib/sse-parser.ts
@@ -1411,7 +1411,10 @@ var SandboxInstance = class SandboxInstance {
1411
1411
  if (started && paceMs > 0) await delay(paceMs);
1412
1412
  started = true;
1413
1413
  try {
1414
- await this.write(file.path, file.content, { mode: file.mode });
1414
+ await this.write(file.path, file.content, {
1415
+ mode: file.mode,
1416
+ encoding: file.encoding
1417
+ });
1415
1418
  break;
1416
1419
  } catch (err) {
1417
1420
  if (isTransientWriteError(err) && attempt < maxRetries) {
@@ -2363,6 +2366,7 @@ var SandboxInstance = class SandboxInstance {
2363
2366
  writeMany: (files, options) => this.writeMany(files, options),
2364
2367
  search: (query, options) => this.search(query, options),
2365
2368
  upload: (localPath, remotePath, options) => this.fsUpload(localPath, remotePath, options),
2369
+ uploadData: (remotePath, data, options) => this.fsUploadData(remotePath, data, options),
2366
2370
  download: (remotePath, localPath, options) => this.fsDownload(remotePath, localPath, options),
2367
2371
  uploadDir: (localDir, remoteDir) => this.fsUploadDir(localDir, remoteDir),
2368
2372
  downloadDir: (remoteDir, localDir) => this.fsDownloadDir(remoteDir, localDir),
@@ -2410,6 +2414,14 @@ var SandboxInstance = class SandboxInstance {
2410
2414
  percentage: 100
2411
2415
  });
2412
2416
  }
2417
+ /** See {@link FileSystem.uploadData}. Delegates to the shared, browser-safe
2418
+ * chunked-upload flow in `lib/chunked-upload.ts`, wired to this sandbox's
2419
+ * runtime endpoint (works over the gateway proxy or a direct connection —
2420
+ * both are transparent through `runtimeFetch`). */
2421
+ async fsUploadData(remotePath, data, options) {
2422
+ await this.ensureRunning();
2423
+ return uploadChunked({ fetch: (path, init) => this.runtimeFetch(path, init) }, remotePath, data, options);
2424
+ }
2413
2425
  async fsDownload(remotePath, localPath, options) {
2414
2426
  await this.ensureRunning();
2415
2427
  const fs = await import("node:fs/promises");
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-DFJiN98I.js";
1
+ import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-CEZaPvfX.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient, TangleSandboxClientConfig };
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-C-5OvIj8.js";
1
+ import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-Os9sH-ms.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient };
@@ -1,5 +1,5 @@
1
1
  import { p as parseErrorResponse } from "./errors-wd266B9Q.js";
2
- import { t as SandboxInstance } from "./sandbox-CIHssZCH.js";
2
+ import { t as SandboxInstance } from "./sandbox-KiKLRbR_.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
5
5
  * Tangle Contract ABI Definitions
@@ -662,6 +662,25 @@ interface CreateSandboxOptions {
662
662
  * timeout-driven retries.
663
663
  */
664
664
  idempotencyKey?: string;
665
+ /**
666
+ * Auto-split inline file mounts out of an inline `backend.profile` object
667
+ * at create time, send the lean profile (mount refs stripped) in the
668
+ * create request, then write the deferred files back once the sandbox is
669
+ * running.
670
+ *
671
+ * When `true` (the default), a profile with sizeable inline mounts (e.g.
672
+ * skills, tool scripts) does not bloat the create POST; the SDK
673
+ * materializes those files via {@link FileSystem.writeMany} /
674
+ * {@link FileSystem.uploadData} after the sandbox reaches `running`. Only
675
+ * applies to an inline `AgentProfile` object on `backend.profile` — a
676
+ * named-profile string is never split, and the deprecated untyped
677
+ * `backend.inlineProfile` passthrough is not split either. Set `false`
678
+ * to send the full profile inline in the create request (no post-create
679
+ * materialization step).
680
+ *
681
+ * @default true
682
+ */
683
+ autoMaterializeProfileFiles?: boolean;
665
684
  }
666
685
  /**
667
686
  * Per-call overrides for {@link SandboxClient.create}.
@@ -4452,6 +4471,36 @@ interface UploadProgress {
4452
4471
  /** Percentage complete (0-100) */
4453
4472
  percentage: number;
4454
4473
  }
4474
+ /**
4475
+ * Options for {@link FileSystem.uploadData}.
4476
+ */
4477
+ interface ChunkedUploadOptions {
4478
+ /** Unix mode bits applied to the file after upload, e.g. 0o644. */
4479
+ mode?: number;
4480
+ /** Progress callback fired after each part completes. On the rare
4481
+ * checksum-mismatch recovery (one automatic full re-upload),
4482
+ * `bytesUploaded` restarts from 0 for the second pass. */
4483
+ onProgress?: (progress: UploadProgress) => void;
4484
+ /** Cancel the upload. A pending upload session is best-effort deleted
4485
+ * server-side when the signal fires mid-flow. */
4486
+ signal?: AbortSignal;
4487
+ /** Delay between part PUTs (ms) to pace bursts. 0 disables pacing (default). */
4488
+ paceMs?: number;
4489
+ /** Max retries per part on a transient error before failing loud. Default 4. */
4490
+ maxRetries?: number;
4491
+ }
4492
+ /**
4493
+ * Result of a successful {@link FileSystem.uploadData} call — the
4494
+ * upload-session commit response.
4495
+ */
4496
+ interface ChunkedUploadResult {
4497
+ /** The path the runtime wrote the assembled payload to. */
4498
+ path: string;
4499
+ /** Total assembled size in bytes. */
4500
+ size: number;
4501
+ /** Server-computed content hash of the assembled payload. */
4502
+ hash: string;
4503
+ }
4455
4504
  /**
4456
4505
  * Options for downloading files.
4457
4506
  */
@@ -4560,10 +4609,12 @@ interface RenameOptions {
4560
4609
  interface WriteManyFile {
4561
4610
  /** Destination path. Relative paths resolve from the workspace root. */
4562
4611
  path: string;
4563
- /** File content (UTF-8). */
4612
+ /** File content: UTF-8 by default, or base64 when `encoding: "base64"` (for binary payloads). */
4564
4613
  content: string;
4565
4614
  /** Unix mode bits applied after write, e.g. 0o755. */
4566
4615
  mode?: number;
4616
+ /** Encoding of `content` on the wire. */
4617
+ encoding?: "utf8" | "base64";
4567
4618
  }
4568
4619
  /** Options for {@link FileSystem.write}. */
4569
4620
  interface WriteFileOptions {
@@ -4654,6 +4705,35 @@ interface FileSystem {
4654
4705
  * ```
4655
4706
  */
4656
4707
  upload(localPath: string, remotePath: string, options?: UploadOptions): Promise<void>;
4708
+ /**
4709
+ * Upload in-memory binary or text data to the sandbox over the chunked
4710
+ * upload-session protocol, without touching the local filesystem.
4711
+ *
4712
+ * Browser/Worker-safe (no `node:` APIs) — this is the sanctioned path for
4713
+ * delivering payloads over ~1 MiB from a browser tab, a Worker, or any
4714
+ * runtime without `node:fs`, where {@link FileSystem.upload}'s local-file
4715
+ * read isn't available. Binary-safe: accepts a `Blob`, `ArrayBuffer`,
4716
+ * `ArrayBufferView`, or UTF-8 `string`. The upload is chunked into
4717
+ * server-sized parts transparently — callers see one call and one
4718
+ * awaited result — and verified end-to-end with a whole-payload SHA-256
4719
+ * at commit. Works identically whether the sandbox is reached through
4720
+ * the gateway proxy or a direct sidecar connection.
4721
+ *
4722
+ * @param remotePath - Destination path in the sandbox.
4723
+ * @param data - Payload to upload. Strings encode as UTF-8.
4724
+ * @param options - Chunking, retry, progress, and cancellation options.
4725
+ * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately, before any
4726
+ * request, if the payload exceeds the chunked-upload session cap.
4727
+ *
4728
+ * @example
4729
+ * ```typescript
4730
+ * const blob = await fetch("https://example.com/model.bin").then((r) => r.blob());
4731
+ * await box.fs.uploadData("/workspace/models/model.bin", blob, {
4732
+ * onProgress: (p) => console.log(`${p.percentage.toFixed(1)}%`),
4733
+ * });
4734
+ * ```
4735
+ */
4736
+ uploadData(remotePath: string, data: Blob | ArrayBuffer | ArrayBufferView | string, options?: ChunkedUploadOptions): Promise<ChunkedUploadResult>;
4657
4737
  /**
4658
4738
  * Download a file from the sandbox.
4659
4739
  * Handles binary files correctly.
@@ -4880,4 +4960,4 @@ interface CodeExecutionOptions {
4880
4960
  idempotencyKey?: string;
4881
4961
  }
4882
4962
  //#endregion
4883
- export { EventStreamOptions as $, SandboxFleetInfo as $n, SessionListOptions as $r, MkdirOptions as $t, CommitTaskSessionOptions as A, WaitForOptions as Ai, RestoreSnapshotOptions as An, SandboxStatus as Ar, GpuLeaseBilling as At, CreateTaskSessionOptions as B, AgentProfileMcpServer as Bi, SSHCommandDescriptor as Bn, ScopedToken as Br, InstalledTool as Bt, BatchTaskUsage as C, TokenRefreshHandler as Ci, PublishPublicTemplateOptions as Cn, SandboxPortPreviewLink as Cr, GitAuth as Ct, CodeLanguage as D, UploadOptions as Di, ReconcileSandboxFleetsOptions as Dn, SandboxRuntimeHealth as Dr, GitDiff as Dt, CodeExecutionResult as E, UpdateUserOptions as Ei, ReapExpiredSandboxFleetsResult as En, SandboxResources as Er, GitConfig as Et, CreateSandboxFleetOptions as F, AgentProfile as Fi, RolloutScorer as Fn, SandboxTraceBundle as Fr, GpuLeaseProviderName as Ft, DownloadOptions as G, AgentProfileResources as Gi, SandboxEvent as Gn, SecretsManager as Gr, IntelligenceReportWindow as Gt, DirectoryPermission as H, AgentProfilePermissionValue as Hi, SandboxClientConfig as Hn, SearchMatch as Hr, IntelligenceReportBudget as Ht, CreateSandboxFleetTokenOptions as I, AgentProfileCapabilities as Ii, RolloutStartResult as In, SandboxTraceEvent as Ir, GpuLeaseStatus as It, DriverConfig as J, AgentSubagentProfile as Ji, SandboxFleetCostEstimate as Jn, SentSessionMessage as Jr, ListOptions as Jt, DownloadProgress as K, AgentProfileValidationIssue as Ki, SandboxFleetArtifact as Kn, SendSessionMessageOptions as Kr, JsonValue as Kt, CreateSandboxFleetWithCoordinatorOptions as L, AgentProfileConfidential as Li, RolloutStatus as Ln, SandboxTraceExport as Lr, GpuType as Lt, CreateGpuLeaseOptions as M, WriteFileOptions as Mi, Rollout as Mn, SandboxTerminalInfo as Mr, GpuLeaseExecOptions as Mt, CreateIntelligenceReportOptions as N, WriteManyFile as Ni, RolloutChildResult as Nn, SandboxTerminalManager as Nr, GpuLeaseExecResult as Nt, CodeResult as O, UploadProgress as Oi, ReconcileSandboxFleetsResult as On, SandboxRuntimeProfile as Or, GitStatus as Ot, CreateRequestOptions as P, WriteManyOptions as Pi, RolloutOptions as Pn, SandboxTerminalRequestOptions as Pr, GpuLeaseManager as Pt, EgressPolicy as Q, mergeAgentProfiles as Qi, SandboxFleetDriverTimings as Qn, SessionInfo as Qr, MintScopedTokenOptions as Qt, CreateSandboxOptions as R, AgentProfileConnection as Ri, RolloutTurnPart as Rn, SandboxTraceOptions as Rr, HostAgentDriverConfig as Rt, BatchTaskResult as S, TeePublicKeyResponse as Si, PublicTemplateVersionInfo as Sn, SandboxPortBinding as Sr, GPU_LEASE_PROVIDER_NAMES as St, CodeExecutionOptions as T, TurnDriveResult as Ti, ReapExpiredSandboxFleetsOptions as Tn, SandboxResourceUsage as Tr, GitCommit as Tt, DispatchPromptOptions as U, AgentProfilePrompt as Ui, SandboxConnection as Un, SearchOptions as Ur, IntelligenceReportCompareTo as Ut, DeleteOptions as V, AgentProfileModelHints as Vi, SSHCredentials as Vn, ScopedTokenScope as Vr, IntelligenceReport as Vt, DispatchedSession as W, AgentProfileResourceRef as Wi, SandboxEnvironment as Wn, SecretInfo as Wr, IntelligenceReportSubjectType as Wt, DriverType as X, defineGitHubResource as Xi, SandboxFleetDispatchResponse as Xn, SessionEventStreamOptions as Xr, ListSandboxOptions as Xt, DriverInfo as Y, defineAgentProfile as Yi, SandboxFleetDispatchFailureClass as Yn, SessionBackendCredentials as Yr, ListSandboxFleetOptions as Yt, EgressManager as Z, defineInlineResource as Zi, SandboxFleetDriverCapability as Zn, SessionForkOptions as Zr, McpServerConfig as Zt, BatchResult as _, TaskSessionProfile as _i, ProvisionEvent as _n, SandboxFleetWorkspaceRestoreResult as _r, FleetExecDispatchOptions as _t, AttachSandboxFleetMachineOptions as a, SnapshotResult as ai, PreviewLinkInfo as an, SandboxFleetManifest as ar, FileReadError as at, BatchSidecarGroup as b, TeeAttestationResponse as bi, ProvisionStep as bn, SandboxIntelligenceEnvelope as br, FleetPromptDispatchOptions as bt, BackendInfo as c, StartupOperation as ci, ProcessInfo as cn, SandboxFleetPolicy as cr, FileSystem as ct, BackendType as d, TaskOptions as di, ProcessSignal as dn, SandboxFleetTraceEvent as dr, FileTreeResult as dt, SessionMessage as ei, NetworkConfig as en, SandboxFleetIntelligenceEnvelope as er, ExecOptions as et, BatchBackend as f, TaskResult as fi, ProcessSpawnOptions as fn, SandboxFleetTraceExport as fr, FileWriteResult as ft, BatchOptions as g, TaskSessionInfo as gi, PromptResult as gn, SandboxFleetWorkspaceReconcileResult as gr, FleetDispatchStreamOptions as gt, BatchEventDataMap as h, TaskSessionFileChange as hi, PromptOptions as hn, SandboxFleetWorkspace as hr, FleetDispatchResultBufferOptions as ht, AttachGpuLeaseOptions as i, SnapshotOptions as ii, PermissionsManager as in, SandboxFleetMachineSpec as ir, FileReadBatchResult as it, CompletedTurnResult as j, WaitForRolloutOptions as ji, ResumeOptions as jn, SandboxTerminalCreateOptions as jr, GpuLeaseCommandResult as jt, CodeResultPart as k, UsageInfo as ki, RenameOptions as kn, SandboxRuntimeProfileList as kr, GpuLease as kt, BackendManager as l, StorageConfig as li, ProcessLogEntry as ln, SandboxFleetToken as lr, FileTreeFile as lt, BatchEvent as m, TaskSessionCommitResult as mi, PromptInputPart as mn, SandboxFleetUsage as mr, FleetDispatchResultBuffer as mt, AccessPolicyRule as n, SessionStatus as ni, NonHostAgentDriverConfig as nn, SandboxFleetMachineMeteredUsage as nr, FileInfo as nt, BackendCapabilities as o, SshKeysManager as oi, PreviewLinkManager as on, SandboxFleetManifestMachine as or, FileReadResult as ot, BatchBackendStats as p, TaskSessionChanges as pi, ProcessStatus as pn, SandboxFleetTraceOptions as pr, FleetDispatchCancelResult as pt, DriveTurnOptions as q, AgentProfileValidationResult as qi, SandboxFleetArtifactSpec as qn, SendSessionMessageRequest as qr, ListMessagesOptions as qt, AddUserOptions as r, SnapshotInfo as ri, PermissionLevel as rn, SandboxFleetMachineRecord as rr, FileReadBatchOptions as rt, BackendConfig as s, StartupDiagnostics as si, Process as sn, SandboxFleetOperationsSummary as sr, FileRenameResult as st, AcceleratorKind as t, SessionMessageInputPart as ti, NetworkManager as tn, SandboxFleetMachine as tr, ExecResult as tt, BackendStatus as u, SubscriptionInfo as ui, ProcessManager as un, SandboxFleetTraceBundle as ur, FileTreeOptions as ut, BatchRunOptions as v, TeeAttestationOptions as vi, ProvisionResult as vn, SandboxFleetWorkspaceSnapshotResult as vr, FleetExecDispatchResult as vt, BranchOptions as w, ToolsConfig as wi, PublishPublicTemplateVersionOptions as wn, SandboxProfileSummary as wr, GitBranch as wt, BatchTask as x, TeePublicKey as xi, PublicTemplateInfo as xn, SandboxPermissionsConfig as xr, FleetPromptDispatchResult as xt, BatchRunRequest as y, TeeAttestationReport as yi, ProvisionStatus as yn, SandboxInfo as yr, FleetMachineId as yt, CreateSessionOptions as z, AgentProfileFileMount as zi, RunCodeOptions as zn, SandboxUser as zr, HostAgentRuntimeBackend as zt };
4963
+ export { EgressManager as $, defineInlineResource as $i, SandboxFleetDriverCapability as $n, SessionForkOptions as $r, McpServerConfig as $t, CodeResult as A, UploadProgress as Ai, ReconcileSandboxFleetsResult as An, SandboxRuntimeProfile as Ar, GitStatus as At, CreateSandboxOptions as B, AgentProfileConnection as Bi, RolloutTurnPart as Bn, SandboxTraceOptions as Br, HostAgentDriverConfig as Bt, BatchTaskUsage as C, TeePublicKey as Ci, PublicTemplateInfo as Cn, SandboxPermissionsConfig as Cr, FleetPromptDispatchResult as Ct, CodeExecutionOptions as D, TurnDriveResult as Di, ReapExpiredSandboxFleetsOptions as Dn, SandboxResourceUsage as Dr, GitCommit as Dt, ChunkedUploadResult as E, ToolsConfig as Ei, PublishPublicTemplateVersionOptions as En, SandboxProfileSummary as Er, GitBranch as Et, CreateIntelligenceReportOptions as F, WriteManyFile as Fi, RolloutChildResult as Fn, SandboxTerminalManager as Fr, GpuLeaseExecResult as Ft, DispatchPromptOptions as G, AgentProfilePrompt as Gi, SandboxConnection as Gn, SearchOptions as Gr, IntelligenceReportCompareTo as Gt, CreateTaskSessionOptions as H, AgentProfileMcpServer as Hi, SSHCommandDescriptor as Hn, ScopedToken as Hr, InstalledTool as Ht, CreateRequestOptions as I, WriteManyOptions as Ii, RolloutOptions as In, SandboxTerminalRequestOptions as Ir, GpuLeaseManager as It, DownloadProgress as J, AgentProfileValidationIssue as Ji, SandboxFleetArtifact as Jn, SendSessionMessageOptions as Jr, JsonValue as Jt, DispatchedSession as K, AgentProfileResourceRef as Ki, SandboxEnvironment as Kn, SecretInfo as Kr, IntelligenceReportSubjectType as Kt, CreateSandboxFleetOptions as L, AgentProfile as Li, RolloutScorer as Ln, SandboxTraceBundle as Lr, GpuLeaseProviderName as Lt, CommitTaskSessionOptions as M, WaitForOptions as Mi, RestoreSnapshotOptions as Mn, SandboxStatus as Mr, GpuLeaseBilling as Mt, CompletedTurnResult as N, WaitForRolloutOptions as Ni, ResumeOptions as Nn, SandboxTerminalCreateOptions as Nr, GpuLeaseCommandResult as Nt, CodeExecutionResult as O, UpdateUserOptions as Oi, ReapExpiredSandboxFleetsResult as On, SandboxResources as Or, GitConfig as Ot, CreateGpuLeaseOptions as P, WriteFileOptions as Pi, Rollout as Pn, SandboxTerminalInfo as Pr, GpuLeaseExecOptions as Pt, DriverType as Q, defineGitHubResource as Qi, SandboxFleetDispatchResponse as Qn, SessionEventStreamOptions as Qr, ListSandboxOptions as Qt, CreateSandboxFleetTokenOptions as R, AgentProfileCapabilities as Ri, RolloutStartResult as Rn, SandboxTraceEvent as Rr, GpuLeaseStatus as Rt, BatchTaskResult as S, TeeAttestationResponse as Si, ProvisionStep as Sn, SandboxIntelligenceEnvelope as Sr, FleetPromptDispatchOptions as St, ChunkedUploadOptions as T, TokenRefreshHandler as Ti, PublishPublicTemplateOptions as Tn, SandboxPortPreviewLink as Tr, GitAuth as Tt, DeleteOptions as U, AgentProfileModelHints as Ui, SSHCredentials as Un, ScopedTokenScope as Ur, IntelligenceReport as Ut, CreateSessionOptions as V, AgentProfileFileMount as Vi, RunCodeOptions as Vn, SandboxUser as Vr, HostAgentRuntimeBackend as Vt, DirectoryPermission as W, AgentProfilePermissionValue as Wi, SandboxClientConfig as Wn, SearchMatch as Wr, IntelligenceReportBudget as Wt, DriverConfig as X, AgentSubagentProfile as Xi, SandboxFleetCostEstimate as Xn, SentSessionMessage as Xr, ListOptions as Xt, DriveTurnOptions as Y, AgentProfileValidationResult as Yi, SandboxFleetArtifactSpec as Yn, SendSessionMessageRequest as Yr, ListMessagesOptions as Yt, DriverInfo as Z, defineAgentProfile as Zi, SandboxFleetDispatchFailureClass as Zn, SessionBackendCredentials as Zr, ListSandboxFleetOptions as Zt, BatchResult as _, TaskSessionFileChange as _i, PromptOptions as _n, SandboxFleetWorkspace as _r, FleetDispatchResultBufferOptions as _t, AttachSandboxFleetMachineOptions as a, SnapshotInfo as ai, PermissionLevel as an, SandboxFleetMachineRecord as ar, FileReadBatchOptions as at, BatchSidecarGroup as b, TeeAttestationOptions as bi, ProvisionResult as bn, SandboxFleetWorkspaceSnapshotResult as br, FleetExecDispatchResult as bt, BackendInfo as c, SshKeysManager as ci, PreviewLinkManager as cn, SandboxFleetManifestMachine as cr, FileReadResult as ct, BackendType as d, StorageConfig as di, ProcessLogEntry as dn, SandboxFleetToken as dr, FileTreeFile as dt, mergeAgentProfiles as ea, SessionInfo as ei, MintScopedTokenOptions as en, SandboxFleetDriverTimings as er, EgressPolicy as et, BatchBackend as f, SubscriptionInfo as fi, ProcessManager as fn, SandboxFleetTraceBundle as fr, FileTreeOptions as ft, BatchOptions as g, TaskSessionCommitResult as gi, PromptInputPart as gn, SandboxFleetUsage as gr, FleetDispatchResultBuffer as gt, BatchEventDataMap as h, TaskSessionChanges as hi, ProcessStatus as hn, SandboxFleetTraceOptions as hr, FleetDispatchCancelResult as ht, AttachGpuLeaseOptions as i, SessionStatus as ii, NonHostAgentDriverConfig as in, SandboxFleetMachineMeteredUsage as ir, FileInfo as it, CodeResultPart as j, UsageInfo as ji, RenameOptions as jn, SandboxRuntimeProfileList as jr, GpuLease as jt, CodeLanguage as k, UploadOptions as ki, ReconcileSandboxFleetsOptions as kn, SandboxRuntimeHealth as kr, GitDiff as kt, BackendManager as l, StartupDiagnostics as li, Process as ln, SandboxFleetOperationsSummary as lr, FileRenameResult as lt, BatchEvent as m, TaskResult as mi, ProcessSpawnOptions as mn, SandboxFleetTraceExport as mr, FileWriteResult as mt, AccessPolicyRule as n, SessionMessage as ni, NetworkConfig as nn, SandboxFleetIntelligenceEnvelope as nr, ExecOptions as nt, BackendCapabilities as o, SnapshotOptions as oi, PermissionsManager as on, SandboxFleetMachineSpec as or, FileReadBatchResult as ot, BatchBackendStats as p, TaskOptions as pi, ProcessSignal as pn, SandboxFleetTraceEvent as pr, FileTreeResult as pt, DownloadOptions as q, AgentProfileResources as qi, SandboxEvent as qn, SecretsManager as qr, IntelligenceReportWindow as qt, AddUserOptions as r, SessionMessageInputPart as ri, NetworkManager as rn, SandboxFleetMachine as rr, ExecResult as rt, BackendConfig as s, SnapshotResult as si, PreviewLinkInfo as sn, SandboxFleetManifest as sr, FileReadError as st, AcceleratorKind as t, SessionListOptions as ti, MkdirOptions as tn, SandboxFleetInfo as tr, EventStreamOptions as tt, BackendStatus as u, StartupOperation as ui, ProcessInfo as un, SandboxFleetPolicy as ur, FileSystem as ut, BatchRunOptions as v, TaskSessionInfo as vi, PromptResult as vn, SandboxFleetWorkspaceReconcileResult as vr, FleetDispatchStreamOptions as vt, BranchOptions as w, TeePublicKeyResponse as wi, PublicTemplateVersionInfo as wn, SandboxPortBinding as wr, GPU_LEASE_PROVIDER_NAMES as wt, BatchTask as x, TeeAttestationReport as xi, ProvisionStatus as xn, SandboxInfo as xr, FleetMachineId as xt, BatchRunRequest as y, TaskSessionProfile as yi, ProvisionEvent as yn, SandboxFleetWorkspaceRestoreResult as yr, FleetExecDispatchOptions as yt, CreateSandboxFleetWithCoordinatorOptions as z, AgentProfileConfidential as zi, RolloutStatus as zn, SandboxTraceExport as zr, GpuType as zt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.10.5-develop.20260713235503.8f2cefc",
3
+ "version": "0.10.5-develop.20260715115519.fee3d86",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -88,7 +88,8 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@tangle-network/agent-core": "^0.4.0",
91
- "@tangle-network/agent-interface": "^0.21.0"
91
+ "@tangle-network/agent-interface": "^0.21.0",
92
+ "@tangle-network/runtime-contracts": "0.1.0"
92
93
  },
93
94
  "peerDependencies": {
94
95
  "@mastra/core": "^1.36.0",