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

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,19 +206,6 @@ 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
-
222
209
  See `examples/cf-worker-chat.ts`, `examples/browser-streaming-resume.ts`, and
223
210
  `examples/reconnect-from-last-event-id.ts` for end-to-end patterns.
224
211
 
@@ -1,6 +1,6 @@
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";
1
+ import { D as CodeLanguage, E as CodeExecutionResult, T as CodeExecutionOptions, k as CodeResultPart } from "../types-BGGfKALh.js";
2
+ import { n as SandboxInstance } from "../sandbox-tksuLdrT.js";
3
+ import { i as SandboxClient } from "../client-CtdFU_nx.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 { $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";
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-BGGfKALh.js";
2
+ import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-tksuLdrT.js";
3
3
 
4
4
  //#region src/lib/sse-parser.d.ts
5
5
  /**
@@ -194,11 +194,7 @@ interface SessionBroadcastEvent {
194
194
  data?: unknown;
195
195
  channel?: string;
196
196
  }
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
- */
197
+ /** Result returned after Sandbox accepts or rejects a session event. */
202
198
  interface SessionBroadcastResult {
203
199
  success: boolean;
204
200
  sessionId: string;
@@ -1,5 +1,5 @@
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";
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-Vh7Aog8b.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 = 10 * 1024 * 1024;
103
+ const DEFAULT_MAX_ARTIFACT_BYTES = 25 * 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,41 +997,6 @@ 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
- }
1035
1000
  /**
1036
1001
  * Extra grace the SDK's client-side batch deadline gets on top of
1037
1002
  * the server-side `timeoutMs`. The server's clock starts when the
@@ -1329,77 +1294,60 @@ var SandboxClient = class {
1329
1294
  const resources = normalizeSandboxResources(options?.resources, options?.driver);
1330
1295
  const postDeadline = AbortSignal.timeout(timeoutMs);
1331
1296
  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
- };
1379
1297
  let response;
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;
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) {
1396
1348
  const body = await response.text();
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;
1349
+ throw parseErrorResponse(response.status, body, void 0, response.headers);
1401
1350
  }
1402
- if (!response) throw createTimeoutError();
1403
1351
  const data = await response.json();
1404
1352
  const instance = new SandboxInstance(this, this.parseInfo(data), resolvedBackend);
1405
1353
  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-CcZE2xMl.js";
1
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-QZXrXdIb.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-wd266B9Q.js";
1
+ import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "./errors-DSz87Rkk.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 { 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";
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-BGGfKALh.js";
2
+ import { n as SandboxInstance } from "./sandbox-tksuLdrT.js";
3
+ import { i as SandboxClient } from "./client-CtdFU_nx.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";
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-wd266B9Q.js";
2
- import { t as SandboxInstance } from "./sandbox-CIHssZCH.js";
3
- import { n as SandboxClient } from "./client-CL_cbjU4.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-DSz87Rkk.js";
2
+ import { t as SandboxInstance } from "./sandbox-Vh7Aog8b.js";
3
+ import { n as SandboxClient } from "./client-Dv93EI90.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, code?: string);
93
+ constructor(message: string, fields?: Record<string, string>, metadata?: SandboxErrorMetadata);
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, code = "VALIDATION_ERROR") {
113
- super(message, code, 400, metadata);
112
+ constructor(message, fields, metadata) {
113
+ super(message, "VALIDATION_ERROR", 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, code);
258
+ case 400: return new ValidationError(message, data.fields, metadata);
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-yNRVRww-.js";
2
- import { n as SandboxInstance, t as HttpClient } from "./sandbox-BvNEOnIl.js";
1
+ import { R as CreateSandboxOptions } from "./types-BGGfKALh.js";
2
+ import { n as SandboxInstance, t as HttpClient } from "./sandbox-tksuLdrT.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 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";
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-BGGfKALh.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-tksuLdrT.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-CtdFU_nx.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-CNCz3Ms9.js";
7
- import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-DFJiN98I.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-DF36P3Ew.js";
8
8
 
9
9
  //#region src/attestation-heartbeat.d.ts
10
10
  interface TeeAttestationHeartbeatSample {
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
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";
1
+ import { i as serializeForSidecar, r as normalizeRuntimeBackendConfig } from "./runtime-api-CvAUrnHc.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-Vh7Aog8b.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-Dv93EI90.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-Bqbf3dA8.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-wd266B9Q.js";
1
+ import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "../errors-DSz87Rkk.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-wd266B9Q.js";
1
+ import { f as ValidationError, l as ServerError, p as parseErrorResponse } from "./errors-DSz87Rkk.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
- encoding: options.encoding ?? "utf8"
206
+ ...options.encoding ? { encoding: options.encoding } : {}
207
207
  })
208
208
  });
209
209
  for (const [path, result] of Object.entries(payload.data.files)) if (result.success) files.push({
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
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";
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-BGGfKALh.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";
3
3
 
4
4
  //#region src/runtime-api.d.ts
5
5
  interface RuntimeTransport {
@@ -37,9 +37,9 @@ declare class SandboxRuntimeApi {
37
37
  //#endregion
38
38
  //#region src/runtime-client.d.ts
39
39
  interface SandboxRuntimeClientConfig {
40
- /** Browser-safe proxy base returned by a runtime-scoped token mint. */
40
+ /** Browser-safe proxy base returned by `box.mintScopedToken()`. */
41
41
  baseUrl: string;
42
- /** Short-lived `session-runtime` or `read-only` token. */
42
+ /** Short-lived scoped token returned by `box.mintScopedToken()`. */
43
43
  token: string;
44
44
  /** Request timeout in milliseconds. Defaults to 30 seconds. */
45
45
  timeoutMs?: number;
@@ -50,9 +50,7 @@ interface SandboxRuntimeClientConfig {
50
50
  * Browser- and Worker-safe client for one sandbox runtime.
51
51
  *
52
52
  * Construct it from the scoped token response returned by
53
- * `box.mintScopedToken({ scope: "session-runtime", sessionId })` or
54
- * `box.mintScopedToken({ scope: "read-only" })`. The full Sandbox API key
55
- * remains server-side.
53
+ * `box.mintScopedToken()`. The full Sandbox API key remains server-side.
56
54
  */
57
55
  declare class SandboxRuntimeClient extends SandboxRuntimeApi {
58
56
  private readonly auth;
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
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";
1
+ import { t as SandboxRuntimeApi } from "./runtime-api-CvAUrnHc.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";
3
3
  //#region src/runtime-client.ts
4
4
  const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
5
5
  function requireToken(token) {
@@ -28,9 +28,7 @@ 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({ scope: "session-runtime", sessionId })` or
32
- * `box.mintScopedToken({ scope: "read-only" })`. The full Sandbox API key
33
- * remains server-side.
31
+ * `box.mintScopedToken()`. The full Sandbox API key remains server-side.
34
32
  */
35
33
  var SandboxRuntimeClient = class extends SandboxRuntimeApi {
36
34
  auth;
@@ -1,5 +1,5 @@
1
- import { n as normalizeSessionInfo, r as normalizeRuntimeBackendConfig, t as SandboxRuntimeApi } from "./runtime-api-CaXI7Kl2.js";
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";
1
+ import { n as normalizeSessionInfo, r as normalizeRuntimeBackendConfig, t as SandboxRuntimeApi } from "./runtime-api-CvAUrnHc.js";
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-DSz87Rkk.js";
3
3
  import { addTokenUsage, readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
4
4
  //#region src/lib/sse-parser.ts
5
5
  /**
@@ -920,22 +920,6 @@ const WRITE_MANY_DEFAULT_PACE_MS = 150;
920
920
  const WRITE_MANY_DEFAULT_MAX_RETRIES = 4;
921
921
  const WRITE_MANY_RETRY_BASE_MS = 250;
922
922
  const WRITE_MANY_RETRY_MAX_MS = 2e3;
923
- function parseTextFileReadResponse(body) {
924
- let payload;
925
- try {
926
- payload = JSON.parse(body);
927
- } catch {
928
- throw new ServerError("Runtime returned invalid JSON for file read", 502, {
929
- origin: "runtime",
930
- endpoint: "/files/read"
931
- });
932
- }
933
- if (typeof payload !== "object" || payload === null || !("success" in payload) || payload.success !== true || !("data" in payload) || typeof payload.data !== "object" || payload.data === null || !("content" in payload.data) || typeof payload.data.content !== "string" || !("encoding" in payload.data) || payload.data.encoding !== "utf8") throw new ServerError("Runtime returned a malformed text file response", 502, {
934
- origin: "runtime",
935
- endpoint: "/files/read"
936
- });
937
- return payload.data.content;
938
- }
939
923
  const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
940
924
  /** Transient file-write failures worth retrying: rate-limit (quota), 5xx,
941
925
  * transport (network), and request timeouts. A non-transient error (bad path,
@@ -1347,20 +1331,18 @@ var SandboxInstance = class SandboxInstance {
1347
1331
  */
1348
1332
  async read(path, options) {
1349
1333
  await this.ensureRunning();
1350
- const headers = options?.sessionId ? { "X-Session-Id": options.sessionId } : void 0;
1334
+ const headers = {};
1335
+ if (options?.sessionId) headers["X-Session-Id"] = options.sessionId;
1351
1336
  const response = await this.runtimeFetch("/files/read", {
1352
1337
  method: "POST",
1353
1338
  headers,
1354
- body: JSON.stringify({
1355
- path,
1356
- encoding: "utf8"
1357
- })
1339
+ body: JSON.stringify({ path })
1358
1340
  });
1359
1341
  if (!response.ok) {
1360
1342
  const body = await response.text();
1361
1343
  throw parseErrorResponse(response.status, body, void 0, response.headers);
1362
1344
  }
1363
- return parseTextFileReadResponse(await response.text());
1345
+ return (await response.json()).data?.content ?? "";
1364
1346
  }
1365
1347
  /**
1366
1348
  * Write content to a file in the sandbox.
@@ -1562,8 +1544,8 @@ var SandboxInstance = class SandboxInstance {
1562
1544
  * `error` + `done` so callers never see a thrown generator.
1563
1545
  */
1564
1546
  async *streamPromptInner(message, options) {
1565
- if (options?.lastEventId && !options.executionId) throw new ValidationError("lastEventId requires executionId so the SDK can replay the correct execution", { executionId: "Required when lastEventId is set" });
1566
1547
  await this.ensureRunning();
1548
+ const parts = encodePromptForWire(message);
1567
1549
  const timeoutMs = typeof options?.timeoutMs === "number" && options.timeoutMs > 0 ? options.timeoutMs : void 0;
1568
1550
  const timeoutSignal = timeoutMs ? AbortSignal.timeout(timeoutMs) : void 0;
1569
1551
  const streamSignal = timeoutSignal ? options?.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal : options?.signal;
@@ -1581,47 +1563,26 @@ var SandboxInstance = class SandboxInstance {
1581
1563
  ...data
1582
1564
  });
1583
1565
  };
1584
- const explicitReplay = Boolean(options?.executionId && options.lastEventId);
1585
- const requestEndpoint = explicitReplay ? `/agents/run/${encodeURIComponent(options?.executionId ?? "")}/events?lastEventId=${encodeURIComponent(options?.lastEventId ?? "")}&format=sse` : "/agents/run/stream";
1586
- let lastEventId = options?.lastEventId;
1587
- let executionId = options?.executionId;
1588
- let sessionId = options?.sessionId;
1589
- let receivedTerminal = false;
1590
- const RECONNECT_BACKOFF_MS = [
1591
- 2e3,
1592
- 4e3,
1593
- 8e3,
1594
- 16e3,
1595
- 3e4,
1596
- 3e4
1597
- ];
1598
- const MAX_RECONNECT_ATTEMPTS = RECONNECT_BACKOFF_MS.length;
1599
- let lastReplayStatus;
1600
- let lastExecutionStatus;
1601
- let firstSseEventSeen = false;
1602
1566
  let response;
1603
1567
  try {
1604
1568
  logStreamCheckpoint("runtime_post_start", {
1605
- endpoint: requestEndpoint,
1569
+ endpoint: "/agents/run/stream",
1606
1570
  sessionId: options?.sessionId,
1607
1571
  executionId: options?.executionId,
1608
1572
  hasLastEventId: Boolean(options?.lastEventId),
1609
- detach: options?.detach === true,
1610
- replayOnly: explicitReplay
1573
+ detach: options?.detach === true
1611
1574
  });
1612
- const request = explicitReplay ? {
1613
- method: "GET",
1614
- signal: streamSignal
1615
- } : {
1575
+ response = await this.runtimeFetch("/agents/run/stream", {
1616
1576
  method: "POST",
1617
1577
  signal: streamSignal,
1618
1578
  headers: {
1619
1579
  ...options?.executionId ? { "X-Execution-ID": options.executionId } : {},
1580
+ ...options?.lastEventId ? { "Last-Event-ID": options.lastEventId } : {},
1620
1581
  ...options?.detach ? { "x-agent-detach": "true" } : {}
1621
1582
  },
1622
1583
  body: JSON.stringify({
1623
1584
  identifier: "default",
1624
- parts: encodePromptForWire(message),
1585
+ parts,
1625
1586
  sessionId: options?.sessionId,
1626
1587
  turnId: options?.turnId,
1627
1588
  metadata: options?.context,
@@ -1630,8 +1591,7 @@ var SandboxInstance = class SandboxInstance {
1630
1591
  ...options?.detach ? { detach: true } : {},
1631
1592
  backend: normalizeRuntimeBackendConfig(options?.backend ?? this.defaultRuntimeBackend, { model: options?.model })
1632
1593
  })
1633
- };
1634
- response = await this.runtimeFetch(requestEndpoint, request);
1594
+ });
1635
1595
  logStreamCheckpoint("runtime_response_headers", {
1636
1596
  status: response.status,
1637
1597
  ok: response.ok
@@ -1641,20 +1601,27 @@ var SandboxInstance = class SandboxInstance {
1641
1601
  throwIfTimedOut();
1642
1602
  throw err;
1643
1603
  }
1644
- if (!response.ok && !explicitReplay) {
1604
+ if (!response.ok) {
1645
1605
  const body = await response.text();
1646
1606
  throw parseErrorResponse(response.status, body, void 0, response.headers);
1647
1607
  }
1648
- if (!response.ok) {
1649
- lastReplayStatus = response.status;
1650
- await response.text();
1651
- logStreamCheckpoint("replay_response_status", {
1652
- attempt: 0,
1653
- status: response.status,
1654
- ok: false
1655
- });
1656
- } else for await (const event of this.parseSSEStream(response, streamSignal)) {
1657
- if (event.type === "history.replay.start" || event.type === "history.replay.end") continue;
1608
+ let lastEventId = options?.lastEventId;
1609
+ let executionId = options?.executionId;
1610
+ let sessionId = options?.sessionId;
1611
+ let receivedTerminal = false;
1612
+ const RECONNECT_BACKOFF_MS = [
1613
+ 2e3,
1614
+ 4e3,
1615
+ 8e3,
1616
+ 16e3,
1617
+ 3e4,
1618
+ 3e4
1619
+ ];
1620
+ const MAX_RECONNECT_ATTEMPTS = RECONNECT_BACKOFF_MS.length;
1621
+ let lastReplayStatus;
1622
+ let lastExecutionStatus;
1623
+ let firstSseEventSeen = false;
1624
+ for await (const event of this.parseSSEStream(response, streamSignal)) {
1658
1625
  if (!firstSseEventSeen) {
1659
1626
  firstSseEventSeen = true;
1660
1627
  logStreamCheckpoint("first_sse_event", {
@@ -2132,19 +2099,11 @@ var SandboxInstance = class SandboxInstance {
2132
2099
  async resourceUsage() {
2133
2100
  await this.ensureRunning();
2134
2101
  const response = await this.runtimeFetch("/health/detailed", { method: "GET" });
2135
- const body = await response.text();
2136
- let data;
2137
- try {
2138
- data = JSON.parse(body);
2139
- } catch (error) {
2140
- if (response.ok) throw new NetworkError("Detailed health returned a non-JSON response", error instanceof Error ? error : void 0, {
2141
- endpoint: "/health/detailed",
2142
- origin: "runtime"
2143
- });
2102
+ if (!response.ok) {
2103
+ const body = await response.text();
2104
+ throw parseErrorResponse(response.status, body, void 0, response.headers);
2144
2105
  }
2145
- if (data?.resources) return data.resources;
2146
- if (!response.ok) throw parseErrorResponse(response.status, body, void 0, response.headers);
2147
- return null;
2106
+ return (await response.json()).resources ?? null;
2148
2107
  }
2149
2108
  /**
2150
2109
  * Git capability object for repository operations.
@@ -2971,11 +2930,32 @@ var SandboxInstance = class SandboxInstance {
2971
2930
  get process() {
2972
2931
  return {
2973
2932
  spawn: (command, options) => this.processSpawn(command, options),
2933
+ spawnExact: (executable, args, options) => this.processSpawnExact(executable, args, options),
2974
2934
  runCode: (code, options) => this.processRunCode(code, options),
2975
2935
  list: () => this.processList(),
2976
2936
  get: (pid) => this.processGet(pid)
2977
2937
  };
2978
2938
  }
2939
+ async processSpawnExact(executable, args, options) {
2940
+ await this.ensureRunning();
2941
+ const response = await this.runtimeFetch("/process/spawn-exact", {
2942
+ method: "POST",
2943
+ body: JSON.stringify({
2944
+ executable,
2945
+ args,
2946
+ cwd: options?.cwd,
2947
+ env: options?.env ?? {},
2948
+ stdin: options?.stdin,
2949
+ timeoutMs: options?.timeoutMs
2950
+ })
2951
+ });
2952
+ if (!response.ok) {
2953
+ const body = await response.text();
2954
+ throw parseErrorResponse(response.status, body, void 0, response.headers);
2955
+ }
2956
+ const data = await response.json();
2957
+ return this.createProcessHandle(data.data.pid, executable);
2958
+ }
2979
2959
  async processSpawn(command, options) {
2980
2960
  await this.ensureRunning();
2981
2961
  const response = await this.runtimeFetch("/process/spawn", {
@@ -4488,10 +4468,15 @@ var SandboxInstance = class SandboxInstance {
4488
4468
  return { state: "running" };
4489
4469
  }
4490
4470
  /**
4491
- * Mint a scoped, time-bounded JWT for browser access (Issue #913 Gap 1).
4492
- * Authority is the caller's `TANGLE_API_KEY` (sk-tan-*); signing secrets
4493
- * stay server-side. Session/project scopes work with SessionGatewayClient,
4494
- * while session-runtime/read-only scopes work with SandboxRuntimeClient.
4471
+ * Mint a scoped, time-bounded JWT for direct browser access to this
4472
+ * sandbox (Issue #913 Gap 1). Authority is the caller's
4473
+ * `TANGLE_API_KEY` (sk-tan-*) the Sandbox API mints the token;
4474
+ * signing secrets stay server-side.
4475
+ *
4476
+ * Use this to give a browser direct read access to the sandbox without
4477
+ * leaking the full bearer (`box.connection.authToken`). The returned
4478
+ * token verifies against the same sidecar middleware that already
4479
+ * gates ProductTokenIssuer-issued JWTs — no new sidecar surface.
4495
4480
  */
4496
4481
  async mintScopedToken(opts) {
4497
4482
  if ((opts.scope === "session" || opts.scope === "session-runtime") && !opts.sessionId) throw new ValidationError(`${opts.scope} scope requires a sessionId`);
@@ -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 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-BGGfKALh.js";
2
2
 
3
3
  //#region src/mcp.d.ts
4
4
  /**
@@ -1015,6 +1015,7 @@ declare class SandboxInstance {
1015
1015
  * ```
1016
1016
  */
1017
1017
  get process(): ProcessManager;
1018
+ private processSpawnExact;
1018
1019
  private processSpawn;
1019
1020
  private processRunCode;
1020
1021
  private processList;
@@ -1499,10 +1500,15 @@ declare class SandboxInstance {
1499
1500
  */
1500
1501
  driveTurn(message: string | PromptInputPart[], opts: DriveTurnOptions): Promise<TurnDriveResult>;
1501
1502
  /**
1502
- * Mint a scoped, time-bounded JWT for browser access (Issue #913 Gap 1).
1503
- * Authority is the caller's `TANGLE_API_KEY` (sk-tan-*); signing secrets
1504
- * stay server-side. Session/project scopes work with SessionGatewayClient,
1505
- * while session-runtime/read-only scopes work with SandboxRuntimeClient.
1503
+ * Mint a scoped, time-bounded JWT for direct browser access to this
1504
+ * sandbox (Issue #913 Gap 1). Authority is the caller's
1505
+ * `TANGLE_API_KEY` (sk-tan-*) the Sandbox API mints the token;
1506
+ * signing secrets stay server-side.
1507
+ *
1508
+ * Use this to give a browser direct read access to the sandbox without
1509
+ * leaking the full bearer (`box.connection.authToken`). The returned
1510
+ * token verifies against the same sidecar middleware that already
1511
+ * gates ProductTokenIssuer-issued JWTs — no new sidecar surface.
1506
1512
  */
1507
1513
  mintScopedToken(opts: MintScopedTokenOptions): Promise<ScopedToken>;
1508
1514
  /** @internal — invoked by SandboxSession.status(). */
@@ -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-DF36P3Ew.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-Bqbf3dA8.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
- import { p as parseErrorResponse } from "./errors-wd266B9Q.js";
2
- import { t as SandboxInstance } from "./sandbox-CIHssZCH.js";
1
+ import { p as parseErrorResponse } from "./errors-DSz87Rkk.js";
2
+ import { t as SandboxInstance } from "./sandbox-Vh7Aog8b.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
5
5
  * Tangle Contract ABI Definitions
@@ -1254,19 +1254,18 @@ interface PromptOptions {
1254
1254
  /** AbortSignal for cancellation */
1255
1255
  signal?: AbortSignal;
1256
1256
  /**
1257
- * Stable execution id for tracing a first dispatch or selecting an existing
1258
- * execution for replay. Forwarded as `X-Execution-ID` on a first dispatch.
1259
- * When combined with `lastEventId`, the SDK replays the existing execution
1260
- * without sending the prompt again. An execution ID alone does not make a
1261
- * repeated POST idempotent; use `turnId` for application-level retries.
1262
- * Omit to let the SDK read the id from `execution.started` for in-call
1263
- * reconnects.
1257
+ * Stable execution id for cross-process reconnect. When passed, the same
1258
+ * id on a retry lands on the same substrate execution — the platform
1259
+ * replays its buffered event stream instead of spawning a duplicate run.
1260
+ * Forwarded as the `X-Execution-ID` header. Omit to let the SDK extract
1261
+ * one from the response stream's `execution.started` event (in-call
1262
+ * reconnect only).
1264
1263
  */
1265
1264
  executionId?: string;
1266
1265
  /**
1267
- * Last event id the caller has already acknowledged. Requires `executionId`;
1268
- * the SDK replays strictly after this id without dispatching a new prompt.
1269
- * Omit on the first attempt.
1266
+ * Last event id the caller has already acknowledged. The substrate
1267
+ * replays strictly after this id on reconnect. Forwarded as the
1268
+ * `Last-Event-ID` header. Omit on first attempt.
1270
1269
  */
1271
1270
  lastEventId?: string;
1272
1271
  /**
@@ -2023,18 +2022,18 @@ type TurnDriveResult = {
2023
2022
  error: string;
2024
2023
  };
2025
2024
  /**
2026
- * Scope of a `box.mintScopedToken()` request. `session` and `project` mint
2027
- * SessionGateway read tokens. `session-runtime` and `read-only` mint sidecar
2028
- * capability tokens for browser-safe runtime access.
2025
+ * Scope of a `box.mintScopedToken()` request. Each value narrows the token's
2026
+ * authority compared to the full sandbox bearer. `session-runtime` permits
2027
+ * only typed message, workspace-file, and terminal operations for one session.
2029
2028
  */
2030
2029
  type ScopedTokenScope = "session" | "session-runtime" | "project" | "read-only";
2031
2030
  /**
2032
2031
  * Options for `box.mintScopedToken()`.
2033
2032
  */
2034
2033
  interface MintScopedTokenOptions {
2035
- /** Scope to mint. `session` and `project` are for SessionGateway streams;
2036
- * `session-runtime` permits typed files, messages, and terminals for one
2037
- * session; `read-only` permits read-only runtime requests. */
2034
+ /** Scope to mint. `session` narrows to a single session id; `project`
2035
+ * grants read access to the whole sandbox; `read-only` is a project
2036
+ * scope without prompt-dispatch capabilities. */
2038
2037
  scope: ScopedTokenScope;
2039
2038
  /** Required when `scope` is `session` or `session-runtime`. */
2040
2039
  sessionId?: string;
@@ -2044,17 +2043,18 @@ interface MintScopedTokenOptions {
2044
2043
  ttlMinutes?: number;
2045
2044
  }
2046
2045
  /**
2047
- * Returned by `box.mintScopedToken()`. Use session/project tokens with
2048
- * `SessionGatewayClient`; use session-runtime/read-only tokens with
2049
- * `SandboxRuntimeClient`.
2046
+ * Returned by `box.mintScopedToken()`. The token verifies against the
2047
+ * same sidecar middleware that already gates ProductTokenIssuer-issued
2048
+ * JWTs — no new sidecar surface.
2050
2049
  */
2051
2050
  interface ScopedToken {
2052
- /** Bearer token (JWT) for the consumer selected by `scope`. */
2051
+ /** Bearer token (JWT). Send as `Authorization: Bearer <token>` or
2052
+ * via the `EventSource` URL with token query param. */
2053
2053
  token: string;
2054
2054
  /** When the token expires. */
2055
2055
  expiresAt: Date;
2056
- /** The runtime's direct edge URL. Use with runtime scopes; session/project
2057
- * tokens instead connect to the Sandbox API's `/session` WebSocket. */
2056
+ /** The runtime's direct edge URL. Matches `SandboxConnection.runtimeUrl`
2057
+ * (the SDK's canonical public name for this URL). */
2058
2058
  runtimeUrl: string;
2059
2059
  /** Browser-safe Sandbox API proxy base for terminal and runtime requests. */
2060
2060
  sidecarProxyUrl: string;
@@ -2586,7 +2586,7 @@ interface SandboxFleetArtifactSpec {
2586
2586
  */
2587
2587
  path: string;
2588
2588
  label?: string;
2589
- /** Maximum allowed artifact content size in bytes. Defaults to 10 MiB. */
2589
+ /** Maximum allowed artifact content size in bytes. Defaults to 5 MiB. */
2590
2590
  maxBytes?: number;
2591
2591
  }
2592
2592
  interface SandboxFleetArtifact extends SandboxFleetArtifactSpec {
@@ -3585,6 +3585,8 @@ interface EgressPolicy {
3585
3585
  * Ignored in `open` and `blocked` modes.
3586
3586
  */
3587
3587
  allowDomains?: string[];
3588
+ /** Include platform-default and secret-derived domains. Defaults to true. */
3589
+ includeImplicitDomains?: boolean;
3588
3590
  /**
3589
3591
  * Denied domains. Only enforced when the proxy supports denylist transforms.
3590
3592
  * @deprecated Deferred — not supported by iron-proxy v0.41.
@@ -3972,6 +3974,16 @@ interface ProcessSpawnOptions {
3972
3974
  /** Timeout in milliseconds (0 = no timeout) */
3973
3975
  timeoutMs?: number;
3974
3976
  }
3977
+ interface ExactProcessSpawnOptions {
3978
+ /** Working directory for the process. */
3979
+ cwd?: string;
3980
+ /** The complete process environment. Host variables are not inherited. */
3981
+ env?: Record<string, string>;
3982
+ /** Optional UTF-8 stdin. The stream is always closed after spawn. */
3983
+ stdin?: string;
3984
+ /** Timeout in milliseconds. */
3985
+ timeoutMs?: number;
3986
+ }
3975
3987
  /**
3976
3988
  * Options for running Python code.
3977
3989
  *
@@ -4174,6 +4186,8 @@ interface ProcessManager {
4174
4186
  * @returns Process handle for control and monitoring
4175
4187
  */
4176
4188
  spawn(command: string, options?: ProcessSpawnOptions): Promise<Process>;
4189
+ /** Spawn without shell parsing or inherited environment variables. */
4190
+ spawnExact(executable: string, args: readonly string[], options?: ExactProcessSpawnOptions): Promise<Process>;
4177
4191
  /**
4178
4192
  * Run Python code directly.
4179
4193
  * Blocks until completion and returns result.
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",
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",