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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -206,6 +206,19 @@ client.connect();
206
206
  detection, replay-on-reconnect, and `lastEventId` persistence. None of this requires a
207
207
  Durable Object.
208
208
 
209
+ Server-originated product events can arrive before the browser connects:
210
+
211
+ ```typescript
212
+ await client.broadcastSessionAgentEvent(sessionId, {
213
+ type: "project.provision_progress",
214
+ properties: { message: "Creating workspace" },
215
+ });
216
+ ```
217
+
218
+ The public API binds that pending queue to the authenticated product and Sandbox account and commits it to Redis before returning `success: true`.
219
+ A later connection by the same owner leases and acknowledges the ordered queue; another owner receives none of it.
220
+ A gateway crash before acknowledgement redelivers the same event IDs, which the default `SessionGatewayClient` deduplicates before invoking handlers.
221
+
209
222
  See `examples/cf-worker-chat.ts`, `examples/browser-streaming-resume.ts`, and
210
223
  `examples/reconnect-from-last-event-id.ts` for end-to-end patterns.
211
224
 
@@ -1,6 +1,6 @@
1
- import { D as CodeLanguage, E as CodeExecutionResult, T as CodeExecutionOptions, k as CodeResultPart } from "../types-Cmpv-ox_.js";
2
- import { n as SandboxInstance } from "../sandbox-BhYmj7L3.js";
3
- import { i as SandboxClient } from "../client-Cr39zlgv.js";
1
+ import { D as CodeLanguage, E as CodeExecutionResult, T as CodeExecutionOptions, k as CodeResultPart } from "../types-yNRVRww-.js";
2
+ import { n as SandboxInstance } from "../sandbox-BvNEOnIl.js";
3
+ import { i as SandboxClient } from "../client-C-4NcZoa.js";
4
4
  import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
5
5
 
6
6
  //#region src/agent/tools/_specs.d.ts
@@ -1,5 +1,5 @@
1
- import { Bt as IntelligenceReport, Cn as PublishPublicTemplateVersionOptions, Dn as ReconcileSandboxFleetsResult, En as ReconcileSandboxFleetsOptions, F as CreateSandboxFleetOptions, Fn as SandboxEnvironment, Hn as SandboxFleetDriverCapability, Ht as IntelligenceReportCompareTo, I as CreateSandboxFleetTokenOptions, Ir as SecretsManager, Jn as SandboxFleetMachineRecord, Jt as ListSandboxFleetOptions, L as CreateSandboxFleetWithCoordinatorOptions, Ln as SandboxFleetArtifact, N as CreateIntelligenceReportOptions, Nn as SandboxClientConfig, P as CreateRequestOptions, Qn as SandboxFleetOperationsSummary, R as CreateSandboxOptions, Rn as SandboxFleetArtifactSpec, Sn as PublishPublicTemplateOptions, Tn as ReapExpiredSandboxFleetsResult, Vn as SandboxFleetDispatchResponse, Vt as IntelligenceReportBudget, Wn as SandboxFleetInfo, Wt as IntelligenceReportWindow, Xn as SandboxFleetManifest, Yt as ListSandboxOptions, Zr as SshKeysManager, _ as BatchResult, _t as FleetExecDispatchResult, a as AttachSandboxFleetMachineOptions, ar as SandboxFleetUsage, bi as UsageInfo, bn as PublicTemplateInfo, bt as FleetPromptDispatchResult, cr as SandboxFleetWorkspaceRestoreResult, er as SandboxFleetToken, et as ExecOptions, ft as FleetDispatchCancelResult, g as BatchOptions, gt as FleetExecDispatchOptions, hn as PromptResult, hr as SandboxProfileSummary, ht as FleetDispatchStreamOptions, ir as SandboxFleetTraceOptions, lr as SandboxFleetWorkspaceSnapshotResult, m as BatchEvent, mi as TokenRefreshHandler, mn as PromptOptions, mt as FleetDispatchResultBufferOptions, pn as PromptInputPart, pt as FleetDispatchResultBuffer, sr as SandboxFleetWorkspaceReconcileResult, ti as SubscriptionInfo, tr as SandboxFleetTraceBundle, tt as ExecResult, ur as SandboxInfo, v as BatchRunOptions, vt as FleetMachineId, wn as ReapExpiredSandboxFleetsOptions, x as BatchTask, xn as PublicTemplateVersionInfo, y as BatchRunRequest, yt as FleetPromptDispatchOptions, zn as SandboxFleetCostEstimate } from "./types-Cmpv-ox_.js";
2
- import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-BhYmj7L3.js";
1
+ import { $n as SandboxFleetInfo, Ci as TokenRefreshHandler, Cn as PublishPublicTemplateOptions, Dn as ReconcileSandboxFleetsOptions, En as ReapExpiredSandboxFleetsResult, F as CreateSandboxFleetOptions, Gr as SecretsManager, Gt as IntelligenceReportWindow, Hn as SandboxClientConfig, Ht as IntelligenceReportBudget, I as CreateSandboxFleetTokenOptions, Jn as SandboxFleetCostEstimate, Kn as SandboxFleetArtifact, L as CreateSandboxFleetWithCoordinatorOptions, N as CreateIntelligenceReportOptions, On as ReconcileSandboxFleetsResult, P as CreateRequestOptions, R as CreateSandboxOptions, Sn as PublicTemplateVersionInfo, Tn as ReapExpiredSandboxFleetsOptions, Ut as IntelligenceReportCompareTo, Vt as IntelligenceReport, Wn as SandboxEnvironment, Xn as SandboxFleetDispatchResponse, Xt as ListSandboxOptions, Yt as ListSandboxFleetOptions, Zn as SandboxFleetDriverCapability, _ as BatchResult, _r as SandboxFleetWorkspaceRestoreResult, _t as FleetExecDispatchOptions, a as AttachSandboxFleetMachineOptions, ar as SandboxFleetManifest, bt as FleetPromptDispatchOptions, et as ExecOptions, g as BatchOptions, gn as PromptResult, gr as SandboxFleetWorkspaceReconcileResult, gt as FleetDispatchStreamOptions, hn as PromptOptions, ht as FleetDispatchResultBufferOptions, ki as UsageInfo, lr as SandboxFleetToken, m as BatchEvent, mn as PromptInputPart, mr as SandboxFleetUsage, mt as FleetDispatchResultBuffer, oi as SshKeysManager, pr as SandboxFleetTraceOptions, pt as FleetDispatchCancelResult, qn as SandboxFleetArtifactSpec, rr as SandboxFleetMachineRecord, sr as SandboxFleetOperationsSummary, tt as ExecResult, ui as SubscriptionInfo, ur as SandboxFleetTraceBundle, v as BatchRunOptions, vr as SandboxFleetWorkspaceSnapshotResult, vt as FleetExecDispatchResult, wn as PublishPublicTemplateVersionOptions, wr as SandboxProfileSummary, x as BatchTask, xn as PublicTemplateInfo, xt as FleetPromptDispatchResult, y as BatchRunRequest, yr as SandboxInfo, yt as FleetMachineId } from "./types-yNRVRww-.js";
2
+ import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-BvNEOnIl.js";
3
3
 
4
4
  //#region src/lib/sse-parser.d.ts
5
5
  /**
@@ -194,7 +194,11 @@ interface SessionBroadcastEvent {
194
194
  data?: unknown;
195
195
  channel?: string;
196
196
  }
197
- /** Result returned after Sandbox accepts or rejects a session event. */
197
+ /**
198
+ * Result returned after Sandbox accepts or rejects a session event.
199
+ * For a session that has not connected yet, `success: true` means the event
200
+ * was durably queued for the authenticated owner.
201
+ */
198
202
  interface SessionBroadcastResult {
199
203
  success: boolean;
200
204
  sessionId: string;
@@ -1,5 +1,5 @@
1
- import { a as NotFoundError, d as TimeoutError, f as ValidationError, i as NetworkError, p as parseErrorResponse, t as AuthError } from "./errors-DSz87Rkk.js";
2
- import { d as exportTraceBundle, g as parseSSEStream, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-CxBHIBV1.js";
1
+ import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, p as parseErrorResponse, t as AuthError } from "./errors-wd266B9Q.js";
2
+ import { d as exportTraceBundle, g as parseSSEStream, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-CIHssZCH.js";
3
3
  //#region src/resources.ts
4
4
  /**
5
5
  * Compute tiers, ordered smallest → largest. Defined HERE (not imported from
@@ -100,7 +100,7 @@ const DEFAULT_MACHINE_LIFETIME_SECONDS = 3600;
100
100
  const DEFAULT_MAX_CONCURRENT_CREATES = 4;
101
101
  const MAX_CONCURRENT_ARTIFACT_READS = 8;
102
102
  const DEFAULT_ARTIFACT_ROOT = "/workspace";
103
- const DEFAULT_MAX_ARTIFACT_BYTES = 25 * 1024 * 1024;
103
+ const DEFAULT_MAX_ARTIFACT_BYTES = 10 * 1024 * 1024;
104
104
  const MAX_MACHINE_ID_LENGTH = 64;
105
105
  const machineIdPattern = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
106
106
  function createFleetId() {
@@ -997,6 +997,41 @@ const DEFAULT_TIMEOUT_MS = 3e4;
997
997
  */
998
998
  const DEFAULT_CREATE_TIMEOUT_MS = 12e4;
999
999
  const DEFAULT_GPU_CREATE_TIMEOUT_MS = 900 * 1e3;
1000
+ const CREATE_POST_MAX_ATTEMPTS = 5;
1001
+ const CREATE_RETRY_BASE_DELAY_MS = 250;
1002
+ const CREATE_RETRY_MAX_DELAY_MS = 4e3;
1003
+ const RETRYABLE_CREATE_STATUS_CODES = new Set([
1004
+ 408,
1005
+ 425,
1006
+ 429,
1007
+ 500,
1008
+ 502,
1009
+ 503,
1010
+ 504
1011
+ ]);
1012
+ function isRetryableCreateError(error) {
1013
+ if (error instanceof NetworkError) return true;
1014
+ return error instanceof SandboxError && error.status !== void 0 && RETRYABLE_CREATE_STATUS_CODES.has(error.status);
1015
+ }
1016
+ function createRetryDelayMs(error, failedAttempt) {
1017
+ if (error instanceof SandboxError && error.retryAfterMs !== void 0) return error.retryAfterMs;
1018
+ return Math.min(CREATE_RETRY_BASE_DELAY_MS * 2 ** Math.max(0, failedAttempt - 1), CREATE_RETRY_MAX_DELAY_MS);
1019
+ }
1020
+ async function waitForCreateRetry(delayMs, signal) {
1021
+ if (signal.aborted) throw signal.reason ?? /* @__PURE__ */ new Error("Sandbox create aborted");
1022
+ if (delayMs <= 0) return;
1023
+ await new Promise((resolve, reject) => {
1024
+ const timeoutId = setTimeout(() => {
1025
+ signal.removeEventListener("abort", onAbort);
1026
+ resolve();
1027
+ }, delayMs);
1028
+ const onAbort = () => {
1029
+ clearTimeout(timeoutId);
1030
+ reject(signal.reason ?? /* @__PURE__ */ new Error("Sandbox create aborted"));
1031
+ };
1032
+ signal.addEventListener("abort", onAbort, { once: true });
1033
+ });
1034
+ }
1000
1035
  /**
1001
1036
  * Extra grace the SDK's client-side batch deadline gets on top of
1002
1037
  * the server-side `timeoutMs`. The server's clock starts when the
@@ -1294,60 +1329,77 @@ var SandboxClient = class {
1294
1329
  const resources = normalizeSandboxResources(options?.resources, options?.driver);
1295
1330
  const postDeadline = AbortSignal.timeout(timeoutMs);
1296
1331
  const postSignal = requestOptions?.signal ? AbortSignal.any([requestOptions.signal, postDeadline]) : postDeadline;
1332
+ const createRequestBody = JSON.stringify({
1333
+ name: options?.name,
1334
+ ...resolvedEnvironment !== void 0 ? {
1335
+ environment: resolvedEnvironment,
1336
+ image: resolvedEnvironment
1337
+ } : {},
1338
+ git,
1339
+ tools: options?.tools,
1340
+ bare: options?.bare,
1341
+ ...options?.publicEdge === false ? { publicEdge: false } : {},
1342
+ driver: options?.driver,
1343
+ backend: resolvedBackend,
1344
+ permissions: options?.permissions,
1345
+ env: options?.env,
1346
+ resources,
1347
+ gpuLease: options?.gpuLease,
1348
+ sshEnabled: options?.sshEnabled,
1349
+ sshPublicKeys: options?.sshPublicKeys ?? (options?.sshPublicKey ? [options.sshPublicKey] : void 0),
1350
+ sshKeyIds: options?.sshKeyIds,
1351
+ webTerminalEnabled: options?.webTerminalEnabled,
1352
+ maxLifetimeSeconds: options?.maxLifetimeSeconds,
1353
+ idleTimeoutSeconds: options?.idleTimeoutSeconds,
1354
+ storage: options?.storage,
1355
+ ephemeral: options?.ephemeral,
1356
+ fromSnapshot: options?.fromSnapshot,
1357
+ fromSandboxId: options?.fromSandboxId,
1358
+ templateId: options?.templateId,
1359
+ publicTemplateId: options?.publicTemplateId,
1360
+ publicTemplateVersionId: options?.publicTemplateVersionId,
1361
+ secrets: options?.secrets,
1362
+ confidential: options?.confidential,
1363
+ metadata: options?.metadata,
1364
+ teamId: options?.teamId,
1365
+ capabilities: options?.capabilities,
1366
+ privacy: options?.privacy,
1367
+ egressPolicy: options?.egressPolicy,
1368
+ idempotencyKey
1369
+ });
1370
+ const createTimeoutError = () => new TimeoutError(timeoutMs, `Sandbox create did not complete within ${timeoutMs}ms. The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it.`);
1371
+ const waitBeforeRetry = async (error, failedAttempt) => {
1372
+ try {
1373
+ await waitForCreateRetry(createRetryDelayMs(error, failedAttempt), postSignal);
1374
+ } catch (waitError) {
1375
+ if (requestOptions?.signal?.aborted) throw waitError;
1376
+ throw createTimeoutError();
1377
+ }
1378
+ };
1297
1379
  let response;
1298
- try {
1299
- response = await this.fetch("/v1/sandboxes", {
1300
- method: "POST",
1301
- headers: { "Idempotency-Key": idempotencyKey },
1302
- signal: postSignal,
1303
- body: JSON.stringify({
1304
- name: options?.name,
1305
- ...resolvedEnvironment !== void 0 ? {
1306
- environment: resolvedEnvironment,
1307
- image: resolvedEnvironment
1308
- } : {},
1309
- git,
1310
- tools: options?.tools,
1311
- bare: options?.bare,
1312
- ...options?.publicEdge === false ? { publicEdge: false } : {},
1313
- driver: options?.driver,
1314
- backend: resolvedBackend,
1315
- permissions: options?.permissions,
1316
- env: options?.env,
1317
- resources,
1318
- gpuLease: options?.gpuLease,
1319
- sshEnabled: options?.sshEnabled,
1320
- sshPublicKeys: options?.sshPublicKeys ?? (options?.sshPublicKey ? [options.sshPublicKey] : void 0),
1321
- sshKeyIds: options?.sshKeyIds,
1322
- webTerminalEnabled: options?.webTerminalEnabled,
1323
- maxLifetimeSeconds: options?.maxLifetimeSeconds,
1324
- idleTimeoutSeconds: options?.idleTimeoutSeconds,
1325
- storage: options?.storage,
1326
- ephemeral: options?.ephemeral,
1327
- fromSnapshot: options?.fromSnapshot,
1328
- fromSandboxId: options?.fromSandboxId,
1329
- templateId: options?.templateId,
1330
- publicTemplateId: options?.publicTemplateId,
1331
- publicTemplateVersionId: options?.publicTemplateVersionId,
1332
- secrets: options?.secrets,
1333
- confidential: options?.confidential,
1334
- metadata: options?.metadata,
1335
- teamId: options?.teamId,
1336
- capabilities: options?.capabilities,
1337
- privacy: options?.privacy,
1338
- egressPolicy: options?.egressPolicy,
1339
- idempotencyKey
1340
- })
1341
- });
1342
- } catch (err) {
1343
- if (requestOptions?.signal?.aborted) throw err;
1344
- if (err instanceof TimeoutError || err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) throw new TimeoutError(timeoutMs, `Sandbox create did not complete within ${timeoutMs}ms. The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it.`);
1345
- throw err;
1346
- }
1347
- if (!response.ok) {
1380
+ for (let attempt = 1; attempt <= CREATE_POST_MAX_ATTEMPTS; attempt++) {
1381
+ try {
1382
+ response = await this.fetch("/v1/sandboxes", {
1383
+ method: "POST",
1384
+ headers: { "Idempotency-Key": idempotencyKey },
1385
+ signal: postSignal,
1386
+ body: createRequestBody
1387
+ });
1388
+ } catch (error) {
1389
+ if (requestOptions?.signal?.aborted) throw error;
1390
+ if (postDeadline.aborted || Date.now() >= deadline || error instanceof TimeoutError || error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) throw createTimeoutError();
1391
+ if (attempt >= CREATE_POST_MAX_ATTEMPTS || !isRetryableCreateError(error)) throw error;
1392
+ await waitBeforeRetry(error, attempt);
1393
+ continue;
1394
+ }
1395
+ if (response.ok) break;
1348
1396
  const body = await response.text();
1349
- throw parseErrorResponse(response.status, body, void 0, response.headers);
1397
+ const error = parseErrorResponse(response.status, body, void 0, response.headers);
1398
+ if (attempt >= CREATE_POST_MAX_ATTEMPTS || !isRetryableCreateError(error)) throw error;
1399
+ await waitBeforeRetry(error, attempt);
1400
+ response = void 0;
1350
1401
  }
1402
+ if (!response) throw createTimeoutError();
1351
1403
  const data = await response.json();
1352
1404
  const instance = new SandboxInstance(this, this.parseInfo(data), resolvedBackend);
1353
1405
  if (instance.status === "provisioning" || instance.status === "pending") {
@@ -1,2 +1,2 @@
1
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-QZXrXdIb.js";
1
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-CcZE2xMl.js";
2
2
  export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
@@ -1,4 +1,4 @@
1
- import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "./errors-DSz87Rkk.js";
1
+ import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "./errors-wd266B9Q.js";
2
2
  //#region src/collaboration/client.ts
3
3
  const DEFAULT_TIMEOUT_MS = 3e4;
4
4
  function normalizeBaseUrl(url) {
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $t as NetworkConfig, Nn as SandboxClientConfig, R as CreateSandboxOptions, an as PreviewLinkManager, et as ExecOptions, in as PreviewLinkInfo, tt as ExecResult, ur as SandboxInfo, xr as SandboxStatus } from "./types-Cmpv-ox_.js";
2
- import { n as SandboxInstance } from "./sandbox-BhYmj7L3.js";
3
- import { i as SandboxClient } from "./client-Cr39zlgv.js";
4
- 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--P_nbLzM.js";
1
+ import { Ar as SandboxStatus, Hn as SandboxClientConfig, R as CreateSandboxOptions, an as PreviewLinkInfo, en as NetworkConfig, et as ExecOptions, on as PreviewLinkManager, tt as ExecResult, yr as SandboxInfo } from "./types-yNRVRww-.js";
2
+ import { n as SandboxInstance } from "./sandbox-BvNEOnIl.js";
3
+ import { i as SandboxClient } from "./client-C-4NcZoa.js";
4
+ 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";
5
5
  export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, QuotaError, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError };
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- 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-DSz87Rkk.js";
2
- import { t as SandboxInstance } from "./sandbox-CxBHIBV1.js";
3
- import { n as SandboxClient } from "./client-Df1K1d_Q.js";
1
+ 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";
2
+ import { t as SandboxInstance } from "./sandbox-CIHssZCH.js";
3
+ import { n as SandboxClient } from "./client-CL_cbjU4.js";
4
4
  export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
@@ -90,7 +90,7 @@ declare class PartialFailureError extends SandboxError {
90
90
  declare class ValidationError extends SandboxError {
91
91
  /** Field-level validation errors */
92
92
  readonly fields?: Record<string, string>;
93
- constructor(message: string, fields?: Record<string, string>, metadata?: SandboxErrorMetadata);
93
+ constructor(message: string, fields?: Record<string, string>, metadata?: SandboxErrorMetadata, code?: string);
94
94
  }
95
95
  /**
96
96
  * The sandbox is not in a valid state for the requested operation.
@@ -109,8 +109,8 @@ var PartialFailureError = class extends SandboxError {
109
109
  var ValidationError = class extends SandboxError {
110
110
  /** Field-level validation errors */
111
111
  fields;
112
- constructor(message, fields, metadata) {
113
- super(message, "VALIDATION_ERROR", 400, metadata);
112
+ constructor(message, fields, metadata, code = "VALIDATION_ERROR") {
113
+ super(message, code, 400, metadata);
114
114
  this.name = "ValidationError";
115
115
  this.fields = fields;
116
116
  }
@@ -255,7 +255,7 @@ function parseErrorResponse(status, body, context, headers) {
255
255
  if (isPartialFailureCode(code)) return new PartialFailureError(message, code, status, metadata, readFailures(data, errorObj));
256
256
  if (code === "EGRESS_PROXY_RECOVERY_REQUIRED") return new EgressProxyRecoveryError(message, metadata);
257
257
  switch (status) {
258
- case 400: return new ValidationError(message, data.fields, metadata);
258
+ case 400: return new ValidationError(message, data.fields, metadata, code);
259
259
  case 401: return new AuthError(message, metadata);
260
260
  case 404: return new NotFoundError(data.resourceType || "Resource", data.resourceId || "unknown", metadata);
261
261
  case 408: return new TimeoutError(data.timeoutMs || 3e4, message, metadata);
@@ -1,5 +1,5 @@
1
- import { R as CreateSandboxOptions } from "./types-Cmpv-ox_.js";
2
- import { n as SandboxInstance, t as HttpClient } from "./sandbox-BhYmj7L3.js";
1
+ import { R as CreateSandboxOptions } from "./types-yNRVRww-.js";
2
+ import { n as SandboxInstance, t as HttpClient } from "./sandbox-BvNEOnIl.js";
3
3
 
4
4
  //#region src/tangle/abi.d.ts
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { $ as EventStreamOptions, $n as SandboxFleetPolicy, $r as StartupOperation, $t as NetworkConfig, A as CommitTaskSessionOptions, Ai as AgentProfileMcpServer, An as RunCodeOptions, Ar as SandboxUser, At as GpuLeaseCommandResult, B as CreateTaskSessionOptions, Bi as defineGitHubResource, Bn as SandboxFleetDispatchFailureClass, Br as SessionBackendCredentials, Bt as IntelligenceReport, C as BatchTaskUsage, Ci as WriteManyFile, Cn as PublishPublicTemplateVersionOptions, Cr as SandboxTerminalInfo, Ct as GitBranch, Di as AgentProfileConfidential, Dn as ReconcileSandboxFleetsResult, Dr as SandboxTraceEvent, Dt as GitStatus, Ei as AgentProfileCapabilities, En as ReconcileSandboxFleetsOptions, Er as SandboxTraceBundle, Et as GitDiff, F as CreateSandboxFleetOptions, Fi as AgentProfileResources, Fn as SandboxEnvironment, Fr as SecretInfo, Ft as GpuLeaseStatus, G as DownloadOptions, Gn as SandboxFleetIntelligenceEnvelope, Gr as SessionMessage, H as DirectoryPermission, Hi as mergeAgentProfiles, Hn as SandboxFleetDriverCapability, Hr as SessionForkOptions, Ht as IntelligenceReportCompareTo, Ii as AgentProfileValidationIssue, In as SandboxEvent, Ir as SecretsManager, It as GpuType, J as DriverConfig, Jn as SandboxFleetMachineRecord, Jr as SnapshotInfo, Jt as ListSandboxFleetOptions, K as DownloadProgress, Kn as SandboxFleetMachine, Kr as SessionMessageInputPart, Kt as ListMessagesOptions, L as CreateSandboxFleetWithCoordinatorOptions, Li as AgentProfileValidationResult, Ln as SandboxFleetArtifact, Lr as SendSessionMessageOptions, Lt as HostAgentDriverConfig, M as CreateGpuLeaseOptions, Mi as AgentProfilePermissionValue, Mn as SSHCredentials, Mr as ScopedTokenScope, Mt as GpuLeaseExecResult, N as CreateIntelligenceReportOptions, Ni as AgentProfilePrompt, Nn as SandboxClientConfig, Nr as SearchMatch, Nt as GpuLeaseManager, O as CodeResult, Oi as AgentProfileConnection, Or as SandboxTraceExport, Ot as GpuLease, Pi as AgentProfileResourceRef, Pn as SandboxConnection, Pr as SearchOptions, Pt as GpuLeaseProviderName, Q as EgressPolicy, Qn as SandboxFleetOperationsSummary, Qr as StartupDiagnostics, Qt as MkdirOptions, R as CreateSandboxOptions, Ri as AgentSubagentProfile, Rn as SandboxFleetArtifactSpec, Rr as SendSessionMessageRequest, Rt as HostAgentRuntimeBackend, S as BatchTaskResult, Si as WriteFileOptions, Sn as PublishPublicTemplateOptions, Sr as SandboxTerminalCreateOptions, St as GitAuth, Ti as AgentProfile, Tn as ReapExpiredSandboxFleetsResult, Tr as SandboxTerminalRequestOptions, Tt as GitConfig, U as DispatchPromptOptions, Un as SandboxFleetDriverTimings, Ur as SessionInfo, Ut as IntelligenceReportSubjectType, V as DeleteOptions, Vi as defineInlineResource, Vn as SandboxFleetDispatchResponse, Vr as SessionEventStreamOptions, Vt as IntelligenceReportBudget, W as DispatchedSession, Wn as SandboxFleetInfo, Wr as SessionListOptions, Wt as IntelligenceReportWindow, X as DriverType, Xn as SandboxFleetManifest, Xr as SnapshotResult, Xt as McpServerConfig, Y as DriverInfo, Yn as SandboxFleetMachineSpec, Yr as SnapshotOptions, Yt as ListSandboxOptions, Z as EgressManager, Zn as SandboxFleetManifestMachine, Zt as MintScopedTokenOptions, _ as BatchResult, _i as UpdateUserOptions, _n as ProvisionResult, _r as SandboxResources, a as AttachSandboxFleetMachineOptions, ai as TaskSessionCommitResult, an as PreviewLinkManager, ar as SandboxFleetUsage, at as FileReadError, b as BatchSidecarGroup, bi as UsageInfo, bn as PublicTemplateInfo, br as SandboxRuntimeProfileList, c as BackendInfo, ci as TaskSessionProfile, cn as ProcessLogEntry, cr as SandboxFleetWorkspaceRestoreResult, ct as FileTreeFile, d as BackendType, di as TeeAttestationResponse, dn as ProcessSpawnOptions, dr as SandboxIntelligenceEnvelope, dt as FileWriteResult, ei as StorageConfig, en as NetworkManager, er as SandboxFleetToken, et as ExecOptions, f as BatchBackend, fi as TeePublicKey, fn as ProcessStatus, fr as SandboxPermissionsConfig, ft as FleetDispatchCancelResult, g as BatchOptions, gi as TurnDriveResult, gn as ProvisionEvent, gr as SandboxResourceUsage, gt as FleetExecDispatchOptions, h as BatchEventDataMap, hi as ToolsConfig, hn as PromptResult, hr as SandboxProfileSummary, ht as FleetDispatchStreamOptions, i as AttachGpuLeaseOptions, ii as TaskSessionChanges, in as PreviewLinkInfo, ir as SandboxFleetTraceOptions, it as FileReadBatchResult, j as CompletedTurnResult, ji as AgentProfileModelHints, jn as SSHCommandDescriptor, jr as ScopedToken, jt as GpuLeaseExecOptions, ki as AgentProfileFileMount, kr as SandboxTraceOptions, kt as GpuLeaseBilling, l as BackendManager, li as TeeAttestationOptions, ln as ProcessManager, lr as SandboxFleetWorkspaceSnapshotResult, lt as FileTreeOptions, m as BatchEvent, mi as TokenRefreshHandler, mn as PromptOptions, mr as SandboxPortPreviewLink, mt as FleetDispatchResultBufferOptions, n as AccessPolicyRule, ni as TaskOptions, nn as PermissionLevel, nr as SandboxFleetTraceEvent, nt as FileInfo, o as BackendCapabilities, oi as TaskSessionFileChange, on as Process, or as SandboxFleetWorkspace, ot as FileReadResult, p as BatchBackendStats, pi as TeePublicKeyResponse, pr as SandboxPortBinding, pt as FleetDispatchResultBuffer, q as DriveTurnOptions, qn as SandboxFleetMachineMeteredUsage, qr as SessionStatus, qt as ListOptions, r as AddUserOptions, ri as TaskResult, rn as PermissionsManager, rr as SandboxFleetTraceExport, rt as FileReadBatchOptions, s as BackendConfig, si as TaskSessionInfo, sn as ProcessInfo, sr as SandboxFleetWorkspaceReconcileResult, st as FileSystem, t as AcceleratorKind, ti as SubscriptionInfo, tn as NonHostAgentDriverConfig, tr as SandboxFleetTraceBundle, tt as ExecResult, u as BackendStatus, ui as TeeAttestationReport, un as ProcessSignal, ur as SandboxInfo, ut as FileTreeResult, v as BatchRunOptions, vi as UploadOptions, vn as ProvisionStatus, vr as SandboxRuntimeHealth, vt as FleetMachineId, w as BranchOptions, wi as WriteManyOptions, wn as ReapExpiredSandboxFleetsOptions, wr as SandboxTerminalManager, wt as GitCommit, x as BatchTask, xi as WaitForOptions, xn as PublicTemplateVersionInfo, xr as SandboxStatus, xt as GPU_LEASE_PROVIDER_NAMES, y as BatchRunRequest, yi as UploadProgress, yn as ProvisionStep, yr as SandboxRuntimeProfile, yt as FleetPromptDispatchOptions, z as CreateSessionOptions, zi as defineAgentProfile, zn as SandboxFleetCostEstimate, zr as SentSessionMessage, zt as InstalledTool } from "./types-Cmpv-ox_.js";
2
- import { C as SandboxMcpConfig, D as buildSandboxMcpConfig, E as buildControlPlaneMcpConfig, S as SANDBOX_MCP_SERVER_NAME, T as SandboxMcpServerEntry, _ as RespondToPermissionOptions, a as TraceExportSink, b as BuildSandboxMcpConfigOptions, c as otelTraceIdForTangleTrace, d as SandboxSession, f as InteractiveAuthFile, g as InterruptResult, h as InteractiveSessionInfo, i as TraceExportResult, l as toOtelJson, m as InteractiveSessionHost, n as SandboxInstance, o as buildTraceExportPayload, p as InteractiveSessionHandle, r as TraceExportFormat, s as exportTraceBundle, u as SandboxTaskSession, v as StartInteractiveOptions, w as SandboxMcpEndpoint, x as CONTROL_PLANE_MCP_SERVER_NAME, y as BuildControlPlaneMcpConfigOptions } from "./sandbox-BhYmj7L3.js";
3
- import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-Cr39zlgv.js";
1
+ import { $ as EventStreamOptions, $n as SandboxFleetInfo, $r as SessionListOptions, $t as MkdirOptions, A as CommitTaskSessionOptions, Ai as WaitForOptions, Ar as SandboxStatus, At as GpuLeaseBilling, B as CreateTaskSessionOptions, Bi as AgentProfileMcpServer, Bn as SSHCommandDescriptor, Br as ScopedToken, Bt as InstalledTool, C as BatchTaskUsage, Ci as TokenRefreshHandler, Cn as PublishPublicTemplateOptions, Cr as SandboxPortPreviewLink, Ct as GitAuth, Di as UploadOptions, Dn as ReconcileSandboxFleetsOptions, Dr as SandboxRuntimeHealth, Dt as GitDiff, Ei as UpdateUserOptions, En as ReapExpiredSandboxFleetsResult, Er as SandboxResources, Et as GitConfig, F as CreateSandboxFleetOptions, Fi as AgentProfile, Fn as RolloutScorer, Fr as SandboxTraceBundle, Ft as GpuLeaseProviderName, G as DownloadOptions, Gi as AgentProfileResources, Gn as SandboxEvent, Gr as SecretsManager, Gt as IntelligenceReportWindow, H as DirectoryPermission, Hi as AgentProfilePermissionValue, Hn as SandboxClientConfig, Hr as SearchMatch, Ht as IntelligenceReportBudget, Ii as AgentProfileCapabilities, In as RolloutStartResult, Ir as SandboxTraceEvent, It as GpuLeaseStatus, J as DriverConfig, Ji as AgentSubagentProfile, Jn as SandboxFleetCostEstimate, Jr as SentSessionMessage, Jt as ListOptions, K as DownloadProgress, Ki as AgentProfileValidationIssue, Kn as SandboxFleetArtifact, Kr as SendSessionMessageOptions, L as CreateSandboxFleetWithCoordinatorOptions, Li as AgentProfileConfidential, Ln as RolloutStatus, Lr as SandboxTraceExport, Lt as GpuType, M as CreateGpuLeaseOptions, Mi as WriteFileOptions, Mn as Rollout, Mr as SandboxTerminalInfo, Mt as GpuLeaseExecOptions, N as CreateIntelligenceReportOptions, Ni as WriteManyFile, Nn as RolloutChildResult, Nr as SandboxTerminalManager, Nt as GpuLeaseExecResult, O as CodeResult, Oi as UploadProgress, On as ReconcileSandboxFleetsResult, Or as SandboxRuntimeProfile, Ot as GitStatus, P as CreateRequestOptions, Pi as WriteManyOptions, Pn as RolloutOptions, Pr as SandboxTerminalRequestOptions, Pt as GpuLeaseManager, Q as EgressPolicy, Qi as mergeAgentProfiles, Qn as SandboxFleetDriverTimings, Qr as SessionInfo, Qt as MintScopedTokenOptions, R as CreateSandboxOptions, Ri as AgentProfileConnection, Rn as RolloutTurnPart, Rr as SandboxTraceOptions, Rt as HostAgentDriverConfig, S as BatchTaskResult, Si as TeePublicKeyResponse, Sn as PublicTemplateVersionInfo, Sr as SandboxPortBinding, St as GPU_LEASE_PROVIDER_NAMES, Ti as TurnDriveResult, Tn as ReapExpiredSandboxFleetsOptions, Tr as SandboxResourceUsage, Tt as GitCommit, U as DispatchPromptOptions, Ui as AgentProfilePrompt, Un as SandboxConnection, Ur as SearchOptions, Ut as IntelligenceReportCompareTo, V as DeleteOptions, Vi as AgentProfileModelHints, Vn as SSHCredentials, Vr as ScopedTokenScope, Vt as IntelligenceReport, W as DispatchedSession, Wi as AgentProfileResourceRef, Wn as SandboxEnvironment, Wr as SecretInfo, Wt as IntelligenceReportSubjectType, X as DriverType, Xi as defineGitHubResource, Xn as SandboxFleetDispatchResponse, Xr as SessionEventStreamOptions, Xt as ListSandboxOptions, Y as DriverInfo, Yi as defineAgentProfile, Yn as SandboxFleetDispatchFailureClass, Yr as SessionBackendCredentials, Yt as ListSandboxFleetOptions, Z as EgressManager, Zi as defineInlineResource, Zn as SandboxFleetDriverCapability, Zr as SessionForkOptions, Zt as McpServerConfig, _ as BatchResult, _i as TaskSessionProfile, _n as ProvisionEvent, _r as SandboxFleetWorkspaceRestoreResult, _t as FleetExecDispatchOptions, a as AttachSandboxFleetMachineOptions, ai as SnapshotResult, an as PreviewLinkInfo, ar as SandboxFleetManifest, at as FileReadError, b as BatchSidecarGroup, bi as TeeAttestationResponse, bn as ProvisionStep, br as SandboxIntelligenceEnvelope, bt as FleetPromptDispatchOptions, c as BackendInfo, ci as StartupOperation, cn as ProcessInfo, cr as SandboxFleetPolicy, ct as FileSystem, d as BackendType, di as TaskOptions, dn as ProcessSignal, dr as SandboxFleetTraceEvent, dt as FileTreeResult, ei as SessionMessage, en as NetworkConfig, er as SandboxFleetIntelligenceEnvelope, et as ExecOptions, f as BatchBackend, fi as TaskResult, fn as ProcessSpawnOptions, fr as SandboxFleetTraceExport, ft as FileWriteResult, g as BatchOptions, gi as TaskSessionInfo, gn as PromptResult, gr as SandboxFleetWorkspaceReconcileResult, gt as FleetDispatchStreamOptions, h as BatchEventDataMap, hi as TaskSessionFileChange, hn as PromptOptions, hr as SandboxFleetWorkspace, ht as FleetDispatchResultBufferOptions, i as AttachGpuLeaseOptions, ii as SnapshotOptions, in as PermissionsManager, ir as SandboxFleetMachineSpec, it as FileReadBatchResult, j as CompletedTurnResult, ji as WaitForRolloutOptions, jr as SandboxTerminalCreateOptions, jt as GpuLeaseCommandResult, ki as UsageInfo, kn as RenameOptions, kr as SandboxRuntimeProfileList, kt as GpuLease, l as BackendManager, li as StorageConfig, ln as ProcessLogEntry, lr as SandboxFleetToken, lt as FileTreeFile, m as BatchEvent, mi as TaskSessionCommitResult, mr as SandboxFleetUsage, mt as FleetDispatchResultBuffer, n as AccessPolicyRule, ni as SessionStatus, nn as NonHostAgentDriverConfig, nr as SandboxFleetMachineMeteredUsage, nt as FileInfo, o as BackendCapabilities, on as PreviewLinkManager, or as SandboxFleetManifestMachine, ot as FileReadResult, p as BatchBackendStats, pi as TaskSessionChanges, pn as ProcessStatus, pr as SandboxFleetTraceOptions, pt as FleetDispatchCancelResult, q as DriveTurnOptions, qi as AgentProfileValidationResult, qn as SandboxFleetArtifactSpec, qr as SendSessionMessageRequest, qt as ListMessagesOptions, r as AddUserOptions, ri as SnapshotInfo, rn as PermissionLevel, rr as SandboxFleetMachineRecord, rt as FileReadBatchOptions, s as BackendConfig, si as StartupDiagnostics, sn as Process, sr as SandboxFleetOperationsSummary, st as FileRenameResult, t as AcceleratorKind, ti as SessionMessageInputPart, tn as NetworkManager, tr as SandboxFleetMachine, tt as ExecResult, u as BackendStatus, ui as SubscriptionInfo, un as ProcessManager, ur as SandboxFleetTraceBundle, ut as FileTreeOptions, v as BatchRunOptions, vi as TeeAttestationOptions, vn as ProvisionResult, vr as SandboxFleetWorkspaceSnapshotResult, w as BranchOptions, wi as ToolsConfig, wn as PublishPublicTemplateVersionOptions, wr as SandboxProfileSummary, wt as GitBranch, x as BatchTask, xi as TeePublicKey, xn as PublicTemplateInfo, xr as SandboxPermissionsConfig, y as BatchRunRequest, yi as TeeAttestationReport, yn as ProvisionStatus, yr as SandboxInfo, yt as FleetMachineId, z as CreateSessionOptions, zi as AgentProfileFileMount, zn as RunCodeOptions, zr as SandboxUser, zt as HostAgentRuntimeBackend } from "./types-yNRVRww-.js";
2
+ import { C as SandboxMcpConfig, D as buildSandboxMcpConfig, E as buildControlPlaneMcpConfig, S as SANDBOX_MCP_SERVER_NAME, T as SandboxMcpServerEntry, _ as RespondToPermissionOptions, a as TraceExportSink, b as BuildSandboxMcpConfigOptions, c as otelTraceIdForTangleTrace, d as SandboxSession, f as InteractiveAuthFile, g as InterruptResult, h as InteractiveSessionInfo, i as TraceExportResult, l as toOtelJson, m as InteractiveSessionHost, n as SandboxInstance, o as buildTraceExportPayload, p as InteractiveSessionHandle, r as TraceExportFormat, s as exportTraceBundle, u as SandboxTaskSession, v as StartInteractiveOptions, w as SandboxMcpEndpoint, x as CONTROL_PLANE_MCP_SERVER_NAME, y as BuildControlPlaneMcpConfigOptions } from "./sandbox-BvNEOnIl.js";
3
+ import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-C-4NcZoa.js";
4
4
  import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-CyHojkuA.js";
5
5
  import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "./index-DKzapw-9.js";
6
- 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, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors--P_nbLzM.js";
7
- import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-DzEUjav-.js";
6
+ 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, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-CNCz3Ms9.js";
7
+ import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-DFJiN98I.js";
8
8
 
9
9
  //#region src/attestation-heartbeat.d.ts
10
10
  interface TeeAttestationHeartbeatSample {
@@ -1371,4 +1371,4 @@ interface RouterEvalMatrixCaseResult {
1371
1371
  }
1372
1372
  declare function runTangleRouterEvalMatrixInSandbox(options: RunTangleRouterEvalMatrixInSandboxOptions): Promise<RunTangleRouterEvalMatrixInSandboxResult>;
1373
1373
  //#endregion
1374
- export { type AcceleratorKind, type AccessPolicyRule, type AddUserOptions, type AgentProfile, type AgentProfileCapabilities, type AgentProfileConnection, type AgentProfileFileMount, type AgentProfileMcpServer, type AgentProfileModelHints, type AgentProfilePermissionValue, type AgentProfilePrompt, type AgentProfileResourceRef, type AgentProfileResources, type AgentProfileValidationIssue, type AgentProfileValidationResult, type AgentSubagentProfile, type AnyTokenPayload, type AttachGpuLeaseOptions, type AttachSandboxFleetMachineOptions, AuthError, type BackendCapabilities, type BackendConfig, type BackendInfo, type BackendManager, type BackendStatus, type BackendType, type BatchBackend, type BatchBackendStats, type BatchEvent, type BatchEventDataMap, type BatchOptions, type BatchResult, type BatchRunOptions, type BatchRunRequest, type BatchSidecarGroup, type BatchTask, type BatchTaskResult, type BatchTaskUsage, type BranchOptions, type BuildControlPlaneMcpConfigOptions, type BuildProgressEvent, type BuildSandboxMcpConfigOptions, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, type CodeResult, type CollaborationAccess, type CollaborationBootstrapRequest, type CollaborationBootstrapResponse, CollaborationClient, type CollaborationClientConfig, type CollaborationDocumentAdapter, type CollaborationDocumentChange, type CollaborationDocumentRef, CollaborationFileBridge, type CollaborationFileBridgeOptions, type CollaborationFileEvent, type CollaborationPermissions, type CollaborationTokenPayload, type CollaborationTokenRefreshRequest, type CollaborationTokenRefreshResponse, type CollaborationTransportConfig, type CommitTaskSessionOptions, type CompletedTurnResult, type ConfidentialSandboxResult, type ConfidentialTeeType, type CreateConfidentialSandboxOptions, type CreateGpuLeaseOptions, type CreateIntelligenceReportOptions, type CreateSandboxFleetOptions, type CreateSandboxFleetWithCoordinatorOptions, type CreateSandboxOptions, type CreateSessionOptions, type CreateTaskSessionOptions, type CreateTeamOptions, DEFAULT_SANDBOX_SIZE, type DeleteOptions, type DirectoryPermission, type DispatchPromptOptions, type DispatchedSession, type DownloadOptions, type DownloadProgress, type DriveTurnOptions, type DriverConfig, type DriverInfo, type DriverType, type EgressManager, type EgressPolicy, EgressProxyRecoveryError, type EventStreamOptions, type ExecOptions, type ExecResult, type FileInfo, type FileReadBatchOptions, type FileReadBatchResult, type FileReadError, type FileReadResult, type FileSystem, type FileTreeFile, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type FleetDispatchCancelResult, type FleetDispatchResultBuffer, type FleetDispatchResultBufferOptions, type FleetDispatchStreamOptions, type FleetExecDispatchOptions, type FleetMachineId, type FleetPromptDispatchOptions, GPU_LEASE_PROVIDER_NAMES, type GitAuth, type GitBranch, type GitCommit, type GitConfig, type GitDiff, type GitStatus, type GpuLease, type GpuLeaseBilling, type GpuLeaseCommandResult, type GpuLeaseExecOptions, type GpuLeaseExecResult, type GpuLeaseManager, type GpuLeaseProviderName, type GpuLeaseStatus, type GpuType, type HostAgentDriverConfig, type HostAgentRuntimeBackend, Image, type ImageBuildClient, type ImageBuildClientConfig, type ImageBuildFetchClient, type ImageBuildOptions, type ImageBuildResult, ImageBuilder, type ImageSpec, type InstalledTool, IntelligenceClient, type IntelligenceReport, type IntelligenceReportBudget, type IntelligenceReportCompareTo, type IntelligenceReportSubjectType, type IntelligenceReportWindow, type InteractiveAuthFile, InteractiveSessionHandle, type InteractiveSessionHost, type InteractiveSessionInfo, type InterruptResult, type InviteTeamMemberOptions, type IssueCollaborationTokenOptions, type ListMessagesOptions, type ListOptions, type ListSandboxFleetOptions, type ListSandboxOptions, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, type ManageSandboxesInput, type ManageSandboxesTool, type ManageSandboxesToolOptions, type MaterializeProfileFileMountsOptions, type MaterializeProfileFileMountsResult, type McpServerConfig, type MintScopedTokenOptions, type MkdirOptions, type NetworkConfig, NetworkError, type NetworkManager, type NonHostAgentDriverConfig, NotFoundError, type ParseSSEStreamOptions, type ParsedSSEEvent, PartialFailureError, type PermissionLevel, type PermissionsManager, type PreviewLinkInfo, type PreviewLinkManager, type Process, type ProcessInfo, type ProcessLogEntry, type ProcessManager, type ProcessSignal, type ProcessSpawnOptions, type ProcessStatus, type PromptOptions, type PromptResult, type ProvisionEvent, type ProvisionResult, type ProvisionStatus, type ProvisionStep, type PublicTemplateInfo, type PublicTemplateVersionInfo, type PublishPublicTemplateOptions, type PublishPublicTemplateVersionOptions, QuotaError, type ReapExpiredSandboxFleetsOptions, type ReapExpiredSandboxFleetsResult, type ReconcileSandboxFleetsOptions, type ReconcileSandboxFleetsResult, type RespondToPermissionOptions, type RouterEvalMatrixAgentProfile, type RouterEvalMatrixCaseResult, type RouterEvalMatrixHarness, type RouterEvalMatrixPayload, type RouterEvalMatrixSandboxBox, type RouterEvalMatrixSandboxClient, type RouterEvalMatrixScenario, type RouterEvalMatrixSuiteResponse, type RouterImportedRunResponse, type RouterSearchConfig, type RouterSearchConfigOptions, type RunCodeOptions, type RunTangleRouterEvalMatrixInSandboxOptions, type RunTangleRouterEvalMatrixInSandboxResult, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, type SSHCommandDescriptor, type SSHCredentials, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, type SandboxConnection, type SandboxEnvironment, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxFleet, type SandboxFleetArtifact, type SandboxFleetArtifactSpec, SandboxFleetClient, type SandboxFleetCostEstimate, type SandboxFleetDispatchFailureClass, type SandboxFleetDispatchResponse, type SandboxFleetDriverCapability, type SandboxFleetDriverTimings, type SandboxFleetInfo, type SandboxFleetIntelligenceEnvelope, type SandboxFleetMachine, type SandboxFleetMachineMeteredUsage, type SandboxFleetMachineRecord, type SandboxFleetMachineSpec, type SandboxFleetManifest, type SandboxFleetManifestMachine, type SandboxFleetOperationsSummary, type SandboxFleetPolicy, type SandboxFleetToken, type SandboxFleetTraceBundle, type SandboxFleetTraceEvent, type SandboxFleetTraceExport, type SandboxFleetTraceOptions, type SandboxFleetUsage, type SandboxFleetWorkspace, type SandboxFleetWorkspaceReconcileResult, type SandboxFleetWorkspaceRestoreResult, type SandboxFleetWorkspaceSnapshotResult, type SandboxInfo, SandboxInstance, type SandboxIntelligenceEnvelope, type SandboxMcpConfig, type SandboxMcpEndpoint, type SandboxMcpServerEntry, type SandboxPermissionsConfig, type SandboxPortBinding, type SandboxPortPreviewLink, type SandboxProfileSummary, type SandboxResourceUsage, type SandboxResources, type SandboxRuntimeHealth, type SandboxRuntimeProfile, type SandboxRuntimeProfileList, SandboxSession, type SandboxSizePreset, type SandboxStatus, SandboxTaskSession, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, type SandboxTraceBundle, type SandboxTraceEvent, type SandboxTraceExport, type SandboxTraceOptions, type SandboxUser, type SaveCollaborationSnapshotRequest, type SaveCollaborationSnapshotResponse, type ScopedToken, type ScopedTokenScope, type SearchMatch, type SearchOptions, type SecretInfo, type SecretsManager, type SendSessionMessageOptions, type SendSessionMessageRequest, type SentSessionMessage, ServerError, type SessionBackendCredentials, type SessionBroadcastEvent, type SessionBroadcastResult, type SessionEventStreamOptions, type SessionForkOptions, type SessionInfo, type SessionListOptions, type SessionMessage, type SessionMessageInputPart, type SessionStatus, type SnapshotInfo, type SnapshotOptions, type SnapshotResult, type SplitInlineProfileFileMountsResult, type StartInteractiveOptions, type StartupDiagnostics, type StartupOperation, StateError, type StorageConfig, type SubscriptionInfo, TangleSandboxClient, type TangleSandboxClientConfig, type TangleSearchProvider, type TaskOptions, type TaskResult, type TaskSessionChanges, type TaskSessionCommitResult, type TaskSessionFileChange, type TaskSessionInfo, type TaskSessionProfile, type Team, type TeamInvitation, type TeamMember, type TeeAttestationHeartbeat, type TeeAttestationHeartbeatOptions, type TeeAttestationHeartbeatSample, type TeeAttestationOptions, type TeeAttestationReport, type TeeAttestationResponse, type TeePublicKey, type TeePublicKeyResponse, TimeoutError, type TokenRefreshHandler, type ToolsConfig, type TraceExportFormat, type TraceExportResult, type TraceExportSink, type TurnDriveResult, type UpdateUserOptions, type UploadOptions, type UploadProgress, type UsageInfo, ValidationError, type WaitForOptions, type WriteFileOptions, type WriteManyFile, type WriteManyOptions, applySandboxEventText, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentResponseText, createConfidentialSandbox, createManageSandboxesTool, defineAgentProfile, defineGitHubResource, defineInlineResource, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, materializeProfileFileMounts, mergeAgentProfiles, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseCollaborationDocumentId, parseSSEStream, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, serializeForSidecar, splitInlineProfileFileMounts, startTeeAttestationHeartbeat, toOtelJson };
1374
+ export { type AcceleratorKind, type AccessPolicyRule, type AddUserOptions, type AgentProfile, type AgentProfileCapabilities, type AgentProfileConnection, type AgentProfileFileMount, type AgentProfileMcpServer, type AgentProfileModelHints, type AgentProfilePermissionValue, type AgentProfilePrompt, type AgentProfileResourceRef, type AgentProfileResources, type AgentProfileValidationIssue, type AgentProfileValidationResult, type AgentSubagentProfile, type AnyTokenPayload, type AttachGpuLeaseOptions, type AttachSandboxFleetMachineOptions, AuthError, type BackendCapabilities, type BackendConfig, type BackendInfo, type BackendManager, type BackendStatus, type BackendType, type BatchBackend, type BatchBackendStats, type BatchEvent, type BatchEventDataMap, type BatchOptions, type BatchResult, type BatchRunOptions, type BatchRunRequest, type BatchSidecarGroup, type BatchTask, type BatchTaskResult, type BatchTaskUsage, type BranchOptions, type BuildControlPlaneMcpConfigOptions, type BuildProgressEvent, type BuildSandboxMcpConfigOptions, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, type CodeResult, type CollaborationAccess, type CollaborationBootstrapRequest, type CollaborationBootstrapResponse, CollaborationClient, type CollaborationClientConfig, type CollaborationDocumentAdapter, type CollaborationDocumentChange, type CollaborationDocumentRef, CollaborationFileBridge, type CollaborationFileBridgeOptions, type CollaborationFileEvent, type CollaborationPermissions, type CollaborationTokenPayload, type CollaborationTokenRefreshRequest, type CollaborationTokenRefreshResponse, type CollaborationTransportConfig, type CommitTaskSessionOptions, type CompletedTurnResult, type ConfidentialSandboxResult, type ConfidentialTeeType, type CreateConfidentialSandboxOptions, type CreateGpuLeaseOptions, type CreateIntelligenceReportOptions, type CreateRequestOptions, type CreateSandboxFleetOptions, type CreateSandboxFleetWithCoordinatorOptions, type CreateSandboxOptions, type CreateSessionOptions, type CreateTaskSessionOptions, type CreateTeamOptions, DEFAULT_SANDBOX_SIZE, type DeleteOptions, type DirectoryPermission, type DispatchPromptOptions, type DispatchedSession, type DownloadOptions, type DownloadProgress, type DriveTurnOptions, type DriverConfig, type DriverInfo, type DriverType, type EgressManager, type EgressPolicy, EgressProxyRecoveryError, type EventStreamOptions, type ExecOptions, type ExecResult, type FileInfo, type FileReadBatchOptions, type FileReadBatchResult, type FileReadError, type FileReadResult, type FileRenameResult, type FileSystem, type FileTreeFile, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type FleetDispatchCancelResult, type FleetDispatchResultBuffer, type FleetDispatchResultBufferOptions, type FleetDispatchStreamOptions, type FleetExecDispatchOptions, type FleetMachineId, type FleetPromptDispatchOptions, GPU_LEASE_PROVIDER_NAMES, type GitAuth, type GitBranch, type GitCommit, type GitConfig, type GitDiff, type GitStatus, type GpuLease, type GpuLeaseBilling, type GpuLeaseCommandResult, type GpuLeaseExecOptions, type GpuLeaseExecResult, type GpuLeaseManager, type GpuLeaseProviderName, type GpuLeaseStatus, type GpuType, type HostAgentDriverConfig, type HostAgentRuntimeBackend, Image, type ImageBuildClient, type ImageBuildClientConfig, type ImageBuildFetchClient, type ImageBuildOptions, type ImageBuildResult, ImageBuilder, type ImageSpec, type InstalledTool, IntelligenceClient, type IntelligenceReport, type IntelligenceReportBudget, type IntelligenceReportCompareTo, type IntelligenceReportSubjectType, type IntelligenceReportWindow, type InteractiveAuthFile, InteractiveSessionHandle, type InteractiveSessionHost, type InteractiveSessionInfo, type InterruptResult, type InviteTeamMemberOptions, type IssueCollaborationTokenOptions, type ListMessagesOptions, type ListOptions, type ListSandboxFleetOptions, type ListSandboxOptions, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, type ManageSandboxesInput, type ManageSandboxesTool, type ManageSandboxesToolOptions, type MaterializeProfileFileMountsOptions, type MaterializeProfileFileMountsResult, type McpServerConfig, type MintScopedTokenOptions, type MkdirOptions, type NetworkConfig, NetworkError, type NetworkManager, type NonHostAgentDriverConfig, NotFoundError, type ParseSSEStreamOptions, type ParsedSSEEvent, PartialFailureError, type PermissionLevel, type PermissionsManager, type PreviewLinkInfo, type PreviewLinkManager, type Process, type ProcessInfo, type ProcessLogEntry, type ProcessManager, type ProcessSignal, type ProcessSpawnOptions, type ProcessStatus, type PromptOptions, type PromptResult, type ProvisionEvent, type ProvisionResult, type ProvisionStatus, type ProvisionStep, type PublicTemplateInfo, type PublicTemplateVersionInfo, type PublishPublicTemplateOptions, type PublishPublicTemplateVersionOptions, QuotaError, type ReapExpiredSandboxFleetsOptions, type ReapExpiredSandboxFleetsResult, type ReconcileSandboxFleetsOptions, type ReconcileSandboxFleetsResult, type RenameOptions, type RespondToPermissionOptions, type Rollout, type RolloutChildResult, type RolloutOptions, type RolloutScorer, type RolloutStartResult, type RolloutStatus, type RolloutTurnPart, type RouterEvalMatrixAgentProfile, type RouterEvalMatrixCaseResult, type RouterEvalMatrixHarness, type RouterEvalMatrixPayload, type RouterEvalMatrixSandboxBox, type RouterEvalMatrixSandboxClient, type RouterEvalMatrixScenario, type RouterEvalMatrixSuiteResponse, type RouterImportedRunResponse, type RouterSearchConfig, type RouterSearchConfigOptions, type RunCodeOptions, type RunTangleRouterEvalMatrixInSandboxOptions, type RunTangleRouterEvalMatrixInSandboxResult, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, type SSHCommandDescriptor, type SSHCredentials, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, type SandboxConnection, type SandboxEnvironment, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxFleet, type SandboxFleetArtifact, type SandboxFleetArtifactSpec, SandboxFleetClient, type SandboxFleetCostEstimate, type SandboxFleetDispatchFailureClass, type SandboxFleetDispatchResponse, type SandboxFleetDriverCapability, type SandboxFleetDriverTimings, type SandboxFleetInfo, type SandboxFleetIntelligenceEnvelope, type SandboxFleetMachine, type SandboxFleetMachineMeteredUsage, type SandboxFleetMachineRecord, type SandboxFleetMachineSpec, type SandboxFleetManifest, type SandboxFleetManifestMachine, type SandboxFleetOperationsSummary, type SandboxFleetPolicy, type SandboxFleetToken, type SandboxFleetTraceBundle, type SandboxFleetTraceEvent, type SandboxFleetTraceExport, type SandboxFleetTraceOptions, type SandboxFleetUsage, type SandboxFleetWorkspace, type SandboxFleetWorkspaceReconcileResult, type SandboxFleetWorkspaceRestoreResult, type SandboxFleetWorkspaceSnapshotResult, type SandboxInfo, SandboxInstance, type SandboxIntelligenceEnvelope, type SandboxMcpConfig, type SandboxMcpEndpoint, type SandboxMcpServerEntry, type SandboxPermissionsConfig, type SandboxPortBinding, type SandboxPortPreviewLink, type SandboxProfileSummary, type SandboxResourceUsage, type SandboxResources, type SandboxRuntimeHealth, type SandboxRuntimeProfile, type SandboxRuntimeProfileList, SandboxSession, type SandboxSizePreset, type SandboxStatus, SandboxTaskSession, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, type SandboxTraceBundle, type SandboxTraceEvent, type SandboxTraceExport, type SandboxTraceOptions, type SandboxUser, type SaveCollaborationSnapshotRequest, type SaveCollaborationSnapshotResponse, type ScopedToken, type ScopedTokenScope, type SearchMatch, type SearchOptions, type SecretInfo, type SecretsManager, type SendSessionMessageOptions, type SendSessionMessageRequest, type SentSessionMessage, ServerError, type SessionBackendCredentials, type SessionBroadcastEvent, type SessionBroadcastResult, type SessionEventStreamOptions, type SessionForkOptions, type SessionInfo, type SessionListOptions, type SessionMessage, type SessionMessageInputPart, type SessionStatus, type SnapshotInfo, type SnapshotOptions, type SnapshotResult, type SplitInlineProfileFileMountsResult, type StartInteractiveOptions, type StartupDiagnostics, type StartupOperation, StateError, type StorageConfig, type SubscriptionInfo, TangleSandboxClient, type TangleSandboxClientConfig, type TangleSearchProvider, type TaskOptions, type TaskResult, type TaskSessionChanges, type TaskSessionCommitResult, type TaskSessionFileChange, type TaskSessionInfo, type TaskSessionProfile, type Team, type TeamInvitation, type TeamMember, type TeeAttestationHeartbeat, type TeeAttestationHeartbeatOptions, type TeeAttestationHeartbeatSample, type TeeAttestationOptions, type TeeAttestationReport, type TeeAttestationResponse, type TeePublicKey, type TeePublicKeyResponse, TimeoutError, type TokenRefreshHandler, type ToolsConfig, type TraceExportFormat, type TraceExportResult, type TraceExportSink, type TurnDriveResult, type UpdateUserOptions, type UploadOptions, type UploadProgress, type UsageInfo, ValidationError, type WaitForOptions, type WaitForRolloutOptions, type WriteFileOptions, type WriteManyFile, type WriteManyOptions, applySandboxEventText, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentResponseText, createConfidentialSandbox, createManageSandboxesTool, defineAgentProfile, defineGitHubResource, defineInlineResource, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, materializeProfileFileMounts, mergeAgentProfiles, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseCollaborationDocumentId, parseSSEStream, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, serializeForSidecar, splitInlineProfileFileMounts, startTeeAttestationHeartbeat, toOtelJson };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { i as serializeForSidecar, r as normalizeRuntimeBackendConfig } from "./runtime-api-CYA2DUQw.js";
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, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as StateError } from "./errors-DSz87Rkk.js";
3
- import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, h as encodeTextForWire, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-CxBHIBV1.js";
4
- import { a as DEFAULT_SANDBOX_SIZE, c as resolveSandboxResources, i as SandboxFleetClient, l as sandboxResourcesForSize, n as SandboxClient, o as SANDBOX_SIZE_PRESETS, r as SandboxFleet, s as SANDBOX_SIZE_PRESET_NAMES, t as IntelligenceClient } from "./client-Df1K1d_Q.js";
5
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-QZXrXdIb.js";
6
- import { t as TangleSandboxClient } from "./tangle-BdRRHMpX.js";
1
+ import { i as serializeForSidecar, r as normalizeRuntimeBackendConfig } from "./runtime-api-CaXI7Kl2.js";
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, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
3
+ import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, h as encodeTextForWire, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-CIHssZCH.js";
4
+ import { a as DEFAULT_SANDBOX_SIZE, c as resolveSandboxResources, i as SandboxFleetClient, l as sandboxResourcesForSize, n as SandboxClient, o as SANDBOX_SIZE_PRESETS, r as SandboxFleet, s as SANDBOX_SIZE_PRESET_NAMES, t as IntelligenceClient } from "./client-CL_cbjU4.js";
5
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CcZE2xMl.js";
6
+ import { t as TangleSandboxClient } from "./tangle-C-5OvIj8.js";
7
7
  import { defineAgentProfile, defineGitHubResource, defineInlineResource, mergeAgentProfiles } from "@tangle-network/agent-interface";
8
8
  //#region src/confidential.ts
9
9
  function generateAttestationNonce(bytes = 32) {
@@ -1,4 +1,4 @@
1
- import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "../errors-DSz87Rkk.js";
1
+ import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "../errors-wd266B9Q.js";
2
2
  //#region src/intelligence/index.ts
3
3
  /**
4
4
  * `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
@@ -1,4 +1,4 @@
1
- import { f as ValidationError, l as ServerError, p as parseErrorResponse } from "./errors-DSz87Rkk.js";
1
+ import { f as ValidationError, l as ServerError, p as parseErrorResponse } from "./errors-wd266B9Q.js";
2
2
  //#region src/backend-config.ts
3
3
  const LEGACY_QUESTION_ALIAS_KEY = ["question", "Channel"].join("");
4
4
  function parseModelString(model) {
@@ -203,7 +203,7 @@ var SandboxRuntimeApi = class {
203
203
  method: "POST",
204
204
  body: JSON.stringify({
205
205
  paths: chunk,
206
- ...options.encoding ? { encoding: options.encoding } : {}
206
+ encoding: options.encoding ?? "utf8"
207
207
  })
208
208
  });
209
209
  for (const [path, result] of Object.entries(payload.data.files)) if (result.success) files.push({
@@ -259,6 +259,19 @@ var SandboxRuntimeApi = class {
259
259
  body: JSON.stringify({ path })
260
260
  });
261
261
  }
262
+ async renameFile(sourcePath, destinationPath, options = {}) {
263
+ await this.transport.ensureRunning();
264
+ const params = new URLSearchParams();
265
+ if (options.sessionId) params.set("sessionId", options.sessionId);
266
+ const query = params.toString();
267
+ return (await this.json(`/files/rename${query ? `?${query}` : ""}`, {
268
+ method: "POST",
269
+ body: JSON.stringify({
270
+ sourcePath,
271
+ destinationPath
272
+ })
273
+ })).data;
274
+ }
262
275
  async fileTree(path, options = {}) {
263
276
  if (options.maxDepth !== void 0 && (!Number.isInteger(options.maxDepth) || options.maxDepth < 1 || options.maxDepth > 20)) throw new ValidationError("maxDepth must be an integer between 1 and 20");
264
277
  await this.transport.ensureRunning();
@@ -272,6 +285,7 @@ var SandboxRuntimeApi = class {
272
285
  const info = normalizeSessionInfo(await this.json("/agents/sessions", {
273
286
  method: "POST",
274
287
  body: JSON.stringify({
288
+ ...options.sessionId !== void 0 ? { sessionId: options.sessionId } : {},
275
289
  ...options.title !== void 0 ? { title: options.title } : {},
276
290
  ...options.parentId !== void 0 ? { parentID: options.parentId } : {},
277
291
  backend: normalizeRuntimeBackendConfig(options.backend)
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as CommitTaskSessionOptions, B as CreateTaskSessionOptions, Cr as SandboxTerminalInfo, Gr as SessionMessage, Kt as ListMessagesOptions, Lr as SendSessionMessageOptions, Rr as SendSessionMessageRequest, Si as WriteFileOptions, Sr as SandboxTerminalCreateOptions, Tr as SandboxTerminalRequestOptions, Ur as SessionInfo, ai as TaskSessionCommitResult, br as SandboxRuntimeProfileList, dt as FileWriteResult, ii as TaskSessionChanges, it as FileReadBatchResult, lt as FileTreeOptions, pr as SandboxPortBinding, rt as FileReadBatchOptions, si as TaskSessionInfo, ut as FileTreeResult, vr as SandboxRuntimeHealth, wr as SandboxTerminalManager, z as CreateSessionOptions, zr as SentSessionMessage } from "./types-Cmpv-ox_.js";
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--P_nbLzM.js";
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";
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
4
  //#region src/runtime-api.d.ts
5
5
  interface RuntimeTransport {
@@ -17,6 +17,7 @@ declare class SandboxRuntimeApi {
17
17
  readFiles(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
18
18
  writeFile(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
19
19
  deleteFile(path: string, options?: Pick<WriteFileOptions, "sessionId">): Promise<void>;
20
+ renameFile(sourcePath: string, destinationPath: string, options?: RenameOptions): Promise<FileRenameResult>;
20
21
  fileTree(path: string, options?: FileTreeOptions): Promise<FileTreeResult>;
21
22
  createSession(options: CreateSessionOptions): Promise<SessionInfo>;
22
23
  messages(id: string, options?: Omit<ListMessagesOptions, "sessionId">): Promise<SessionMessage[]>;
@@ -36,9 +37,9 @@ declare class SandboxRuntimeApi {
36
37
  //#endregion
37
38
  //#region src/runtime-client.d.ts
38
39
  interface SandboxRuntimeClientConfig {
39
- /** Browser-safe proxy base returned by `box.mintScopedToken()`. */
40
+ /** Browser-safe proxy base returned by a runtime-scoped token mint. */
40
41
  baseUrl: string;
41
- /** Short-lived scoped token returned by `box.mintScopedToken()`. */
42
+ /** Short-lived `session-runtime` or `read-only` token. */
42
43
  token: string;
43
44
  /** Request timeout in milliseconds. Defaults to 30 seconds. */
44
45
  timeoutMs?: number;
@@ -49,7 +50,9 @@ interface SandboxRuntimeClientConfig {
49
50
  * Browser- and Worker-safe client for one sandbox runtime.
50
51
  *
51
52
  * Construct it from the scoped token response returned by
52
- * `box.mintScopedToken()`. The full Sandbox API key remains server-side.
53
+ * `box.mintScopedToken({ scope: "session-runtime", sessionId })` or
54
+ * `box.mintScopedToken({ scope: "read-only" })`. The full Sandbox API key
55
+ * remains server-side.
53
56
  */
54
57
  declare class SandboxRuntimeClient extends SandboxRuntimeApi {
55
58
  private readonly auth;
@@ -59,4 +62,4 @@ declare class SandboxRuntimeClient extends SandboxRuntimeApi {
59
62
  }
60
63
  declare function createSandboxRuntimeClient(config: SandboxRuntimeClientConfig): SandboxRuntimeClient;
61
64
  //#endregion
62
- export { AuthError, CapabilityError, type FileReadBatchOptions, type FileReadBatchResult, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, 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 };
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 };
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as SandboxRuntimeApi } from "./runtime-api-CYA2DUQw.js";
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-DSz87Rkk.js";
1
+ import { t as SandboxRuntimeApi } from "./runtime-api-CaXI7Kl2.js";
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;
5
5
  function requireToken(token) {
@@ -28,7 +28,9 @@ function requireTimeout(timeoutMs) {
28
28
  * Browser- and Worker-safe client for one sandbox runtime.
29
29
  *
30
30
  * Construct it from the scoped token response returned by
31
- * `box.mintScopedToken()`. The full Sandbox API key remains server-side.
31
+ * `box.mintScopedToken({ scope: "session-runtime", sessionId })` or
32
+ * `box.mintScopedToken({ scope: "read-only" })`. The full Sandbox API key
33
+ * remains server-side.
32
34
  */
33
35
  var SandboxRuntimeClient = class extends SandboxRuntimeApi {
34
36
  auth;