@tangle-network/sandbox 0.60.69 → 0.60.77-develop.20261016230332.7f22d61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +46 -0
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +4 -4
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/{agent-run-outcome-BBk2-5vp.d.ts → agent-run-outcome-CTEpjCEZ.d.ts} +1 -1
  6. package/dist/auth/index.d.ts +1 -1
  7. package/dist/auth/index.js +1 -1
  8. package/dist/backend-types-D6bYbvMB.js +42 -0
  9. package/dist/{browser-interactive-control-controller-JUW3gOGH.d.ts → browser-interactive-control-controller-rpTbyvAS.d.ts} +1 -1
  10. package/dist/{chunked-upload-BklCn3Li.js → chunked-upload-DtIvkKNo.js} +1 -1
  11. package/dist/{chunked-upload-file-Cp-iWsWN.js → chunked-upload-file-DnsHEjg0.js} +1 -1
  12. package/dist/{cli-auth-bundle-D61iX68d.js → cli-auth-bundle-cSJjPeFF.js} +2 -2
  13. package/dist/{client-DUDqUYDG.js → client-CRkHfByN.js} +21 -9
  14. package/dist/{client-DVouBFPR.d.ts → client-Lhxo82x1.d.ts} +10 -6
  15. package/dist/collaboration/index.d.ts +1 -1
  16. package/dist/collaboration/index.js +1 -1
  17. package/dist/{collaboration-B2g1j2ey.js → collaboration-DaJU5O0E.js} +1 -1
  18. package/dist/core.d.ts +6 -6
  19. package/dist/core.js +3 -3
  20. package/dist/{errors-iWIsey1D.js → errors-DSJBKmGZ.js} +60 -1
  21. package/dist/{errors-5j_Hlkm-.d.ts → errors-mPL-qvgF.d.ts} +79 -2
  22. package/dist/{index-DaJrtipt.d.ts → index-DRto9Ijb.d.ts} +2 -2
  23. package/dist/index.d.ts +19 -17
  24. package/dist/index.js +9 -9
  25. package/dist/intelligence/index.js +1 -1
  26. package/dist/interactive-control.d.ts +1 -1
  27. package/dist/{interactive-controller-DaYmUCO_.js → interactive-controller-CJ24g8Va.js} +237 -25
  28. package/dist/{lines-D07bn-mu.d.ts → lines-DodQslsf.d.ts} +1 -1
  29. package/dist/lines.d.ts +1 -1
  30. package/dist/lines.js +1 -1
  31. package/dist/{local-cli-auth-t8KUbrfI.js → local-cli-auth-CBV7Vjk5.js} +1 -1
  32. package/dist/{managed-process-RMyVq_du.d.ts → managed-process-B7WfqKmi.d.ts} +1 -1
  33. package/dist/{preview-dIOd13_U.d.ts → preview-wpGGk0bu.d.ts} +3 -3
  34. package/dist/runtime.d.ts +5 -6
  35. package/dist/runtime.js +3 -3
  36. package/dist/{sandbox-C7wOeFZB.d.ts → sandbox-CoIGxzm_.d.ts} +78 -24
  37. package/dist/{sandbox-Dg0WI1ZF.js → sandbox-DzSEprto.js} +732 -79
  38. package/dist/tangle/index.d.ts +1 -1
  39. package/dist/tangle/index.js +1 -1
  40. package/dist/{tangle-CaY9_VGA.js → tangle-DHFKq9sn.js} +2 -2
  41. package/dist/{terminal-stream-CV1pMSKC.d.ts → terminal-stream-jdYomM1m.d.ts} +123 -4
  42. package/dist/{types-BLCY5T4s.d.ts → types-B_QF-iHm.d.ts} +242 -28
  43. package/package.json +5 -5
  44. package/dist/backend-types-C7b_Gpa0.js +0 -59
  45. package/dist/interactive-controller-DNbLzamS.d.ts +0 -40
  46. /package/dist/{index-BgmgfYZZ.d.ts → index-DO7GVpk_.d.ts} +0 -0
  47. /package/dist/{index-DHuHjNie.d.ts → index-DZ27pdB8.d.ts} +0 -0
package/README.md CHANGED
@@ -991,3 +991,49 @@ limited to 64 MiB, individual records to 16 MiB, and event reconstruction retain
991
991
  most 64 MiB of cumulative part text. Limits and incomplete snapshots never become
992
992
  complete coverage. The dedicated Sidecar archive route is required; an older deployment
993
993
  returns an error without falling back to the aggregate `rawEvidence()` API.
994
+
995
+
996
+ ### Prepared durable-plan follow-ups
997
+
998
+ The authenticated `session.plan()` result exposes `sourceTurnId` from that exact
999
+ plan revision, so callers can resolve immutable profile context before deciding.
1000
+ For an isolated secret profile, decide without automatic redispatch:
1001
+
1002
+ ```ts
1003
+ const decision = await session.approvePlan(plan.id, {
1004
+ followUp: { mode: "caller" },
1005
+ });
1006
+ // Reject uses session.rejectPlan(feedback, plan.id, theSameOptions).
1007
+ const resume = decision.followUp.resume;
1008
+ if (resume) {
1009
+ // Resolve your immutable source profile using resume.sourceTurnId, then obtain
1010
+ // a new runtime grant. Neither grants nor preparation receipts are persisted
1011
+ // in the durable plan. Reuse the original isolated session creation identity.
1012
+ const backend = {
1013
+ ...freshSecretBackend,
1014
+ planContinuation: resume.continuation,
1015
+ interactions: { ...freshSecretBackend.interactions,
1016
+ plan: decision.plan.status === "rejected" },
1017
+ };
1018
+ const pins = await box.prepareSecretProfileRevision({ sessionId: session.id, backend });
1019
+ await session.sendMessage({
1020
+ parts: [{ type: "text", text: "Continue the decided plan." }],
1021
+ turnId: decision.followUp.turnId,
1022
+ ttlMs: modelTurnExecutionTtlMs, // Retain the application's normal execution policy.
1023
+ backend,
1024
+ expectedPublicProfileRequestDigest: pins.expectedPublicProfileRequestDigest,
1025
+ expectedSecretProfileReceipt: pins.expectedSecretProfileReceipt,
1026
+ }, { planFollowUp: resume });
1027
+ }
1028
+ ```
1029
+
1030
+ The continuation and interaction controls must be present before preparation;
1031
+ changing them invalidates the public request digest. Admission remains bound to
1032
+ one existing plan, turn, lease, and execution. The returned credential is
1033
+ transient: never persist or log it. An expired or contested lease requires another
1034
+ matching decision request followed by a new grant and preparation. A completed
1035
+ replay returns its execution ID without new admission authority. Caller-mode
1036
+ rows remain outside automatic dispatch after expiry and retry. Older Workers
1037
+ reject the strict decision option before recording a decision; deploy the D1
1038
+ caller-state migration before enabling the option. Ordinary decisions retain
1039
+ automatic dispatch.
@@ -1,7 +1,7 @@
1
- import { _ as SandboxSession, h as SandboxTaskSession, r as SandboxInstance } from "../sandbox-C7wOeFZB.js";
2
- import { D as CodeExecutionResult, E as CodeExecutionOptions, O as CodeLanguage, Qi as SessionInfo, Qr as SandboxFleetParent, d as BackendConfig, ea as SessionListOptions, k as CodeResultPart, so as BackendType } from "../types-BLCY5T4s.js";
3
- import { i as Sandbox } from "../client-DVouBFPR.js";
4
- import { u as PreviewAuthorizer } from "../preview-dIOd13_U.js";
1
+ import { g as SandboxSession, m as SandboxTaskSession, n as SandboxInstance } from "../sandbox-CoIGxzm_.js";
2
+ import { D as CodeExecutionResult, E as CodeExecutionOptions, O as CodeLanguage, ai as SandboxFleetParent, bo as BackendType, ca as SessionInfo, d as BackendConfig, k as CodeResultPart, ua as SessionListOptions } from "../types-B_QF-iHm.js";
3
+ import { i as Sandbox } from "../client-Lhxo82x1.js";
4
+ import { u as PreviewAuthorizer } from "../preview-wpGGk0bu.js";
5
5
  import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
6
6
  import { JSONSchema } from "zod/v4/core";
7
7
  import { ToolSet } from "ai";
@@ -1,8 +1,8 @@
1
1
  import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-DjryqUiY.js";
2
- import { E as assertCurrentBackendType } from "../interactive-controller-DaYmUCO_.js";
3
- import { h as StateError, l as NotFoundError, v as ValidationError } from "../errors-iWIsey1D.js";
4
- import { n as Sandbox } from "../client-DUDqUYDG.js";
5
- import { t as SandboxInstance } from "../sandbox-Dg0WI1ZF.js";
2
+ import { D as assertCurrentBackendType } from "../interactive-controller-CJ24g8Va.js";
3
+ import { _ as StateError, b as ValidationError, d as NotFoundError } from "../errors-DSJBKmGZ.js";
4
+ import { n as Sandbox } from "../client-CRkHfByN.js";
5
+ import { t as SandboxInstance } from "../sandbox-DzSEprto.js";
6
6
  import { z } from "zod";
7
7
  //#region src/agent/instances.ts
8
8
  const managers = /* @__PURE__ */ new WeakMap();
@@ -1,2 +1,2 @@
1
- import { _ as publishAgentPreview, a as previewOperationTool, c as AgentPreviewOptions, d as PreviewExecutionContext, f as PublishAgentPreviewOptions, g as listAgentPreviews, h as getAgentPreview, i as PreviewTool, l as PreviewAuthorizationRequest, m as ensureAgentPreview, n as PREVIEW_MCP_ALIAS, o as previewToolsForProfile, p as assertPreviewId, r as PREVIEW_TOOLS, s as AgentPreviewError, t as servePreviewMcp, u as PreviewAuthorizer, v as removeAgentPreview, y as resolveSelfSandbox } from "../preview-dIOd13_U.js";
1
+ import { _ as publishAgentPreview, a as previewOperationTool, c as AgentPreviewOptions, d as PreviewExecutionContext, f as PublishAgentPreviewOptions, g as listAgentPreviews, h as getAgentPreview, i as PreviewTool, l as PreviewAuthorizationRequest, m as ensureAgentPreview, n as PREVIEW_MCP_ALIAS, o as previewToolsForProfile, p as assertPreviewId, r as PREVIEW_TOOLS, s as AgentPreviewError, t as servePreviewMcp, u as PreviewAuthorizer, v as removeAgentPreview, y as resolveSelfSandbox } from "../preview-wpGGk0bu.js";
2
2
  export { AgentPreviewError, AgentPreviewOptions, PREVIEW_MCP_ALIAS, PREVIEW_TOOLS, PreviewAuthorizationRequest, PreviewAuthorizer, PreviewExecutionContext, PreviewTool, PublishAgentPreviewOptions, assertPreviewId, ensureAgentPreview, getAgentPreview, listAgentPreviews, previewOperationTool, previewToolsForProfile, publishAgentPreview, removeAgentPreview, resolveSelfSandbox, servePreviewMcp };
@@ -1,4 +1,4 @@
1
- import { Nr as SandboxEvent, a as AgentQuestionRequest, ct as DurablePlanSnapshot, i as AgentApprovalRequirement, o as AgentRunStatus, s as AgentToolInvocation } from "./types-BLCY5T4s.js";
1
+ import { Br as SandboxEvent, a as AgentQuestionRequest, i as AgentApprovalRequirement, o as AgentRunStatus, s as AgentToolInvocation, ut as DurablePlanSnapshot } from "./types-B_QF-iHm.js";
2
2
  import { InteractionRequest } from "@tangle-network/agent-interface";
3
3
 
4
4
  //#region src/agent-run-outcome.d.ts
@@ -1,3 +1,3 @@
1
1
  import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema, t as CliAuthReference } from "../cli-auth-bundle-ODe06Ts7.js";
2
- import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-BgmgfYZZ.js";
2
+ import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-DO7GVpk_.js";
3
3
  export { AnyTokenPayload, BatchScopedTokenPayload, CliAuthReference, CollaborationAccess, CollaborationTokenPayload, IssueCollaborationTokenOptions, ProductTokenIssuer, ProjectScopedTokenPayload, ReadTokenPayload, SessionScopedTokenPayload, TokenScope, assertCliAuthReferenceSupported, cliAuthReferenceSchema, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, materializeCliAuthBundle, unsafeDecodeToken, verifyToken };
@@ -1,4 +1,4 @@
1
- import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-D61iX68d.js";
1
+ import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-cSJjPeFF.js";
2
2
  //#region src/auth/tokens.ts
3
3
  const textEncoder = new TextEncoder();
4
4
  const textDecoder = new TextDecoder();
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ //#region ../../../packages/runtime-contracts/dist/backend-types.js
3
+ /**
4
+ * This distribution's backend vocabulary, declared positively. The shared
5
+ * Interface vocabulary also contains historical and differently hosted harnesses;
6
+ * knowing one upstream must not require installing it here or make this module
7
+ * throw at import time. Keep old wire identities readable when retiring execution.
8
+ *
9
+ * Gemini is not a direct Sandbox backend; it is available only through a backing
10
+ * transport. Adding it upstream never implicitly makes it dispatchable here.
11
+ * The spec/adapter composition must still prove every backend it actually enables.
12
+ */
13
+ const BACKEND_TYPE = {
14
+ OPENCODE: "opencode",
15
+ CLAUDE_CODE: "claude-code",
16
+ KIMI_CODE: "kimi-code",
17
+ CODEX: "codex",
18
+ AMP: "amp",
19
+ FACTORY_DROIDS: "factory-droids",
20
+ PI: "pi",
21
+ PRIME: "prime",
22
+ HERMES: "hermes",
23
+ FORGE: "forge",
24
+ OPENCLAW: "openclaw",
25
+ NANOCLAW: "nanoclaw",
26
+ ACP: "acp",
27
+ CURSOR: "cursor",
28
+ CLI_BASE: "cli-base"
29
+ };
30
+ /** Stable declaration order; registry tests check the shipped spec composition. */
31
+ const ALL_BACKEND_TYPES = Object.values(BACKEND_TYPE);
32
+ const backendTypeSchema = z.enum(ALL_BACKEND_TYPES);
33
+ const BACKEND_TYPE_SET = new Set(ALL_BACKEND_TYPES);
34
+ function isBackendType(value) {
35
+ return BACKEND_TYPE_SET.has(value);
36
+ }
37
+ function parseBackendType(value) {
38
+ if (!isBackendType(value)) throw new Error(`Unknown backend type "${value}". Expected one of: ${ALL_BACKEND_TYPES.join(", ")}`);
39
+ return value;
40
+ }
41
+ //#endregion
42
+ export { parseBackendType as i, BACKEND_TYPE as n, backendTypeSchema as r, ALL_BACKEND_TYPES as t };
@@ -1,4 +1,4 @@
1
- import { r as TerminalStreamHandlers } from "./terminal-stream-CV1pMSKC.js";
1
+ import { o as TerminalStreamHandlers } from "./terminal-stream-jdYomM1m.js";
2
2
  import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionStatus } from "@tangle-network/agent-interface";
3
3
  import { AgentInteractiveSessionControlClaim as AgentInteractiveSessionControlClaim$1, AgentInteractiveSessionControlClaimRequest as AgentInteractiveSessionControlClaimRequest$1, AgentInteractiveSessionRef as AgentInteractiveSessionRef$1 } from "@tangle-network/agent-interface/environment-interactive-control";
4
4
 
@@ -1,4 +1,4 @@
1
- import { _ as TimeoutError, c as NetworkError, d as QuotaError, m as ServerError, p as SandboxError, y as parseErrorResponse } from "./errors-iWIsey1D.js";
1
+ import { g as ServerError, h as SandboxError, p as QuotaError, u as NetworkError, x as parseErrorResponse, y as TimeoutError } from "./errors-DSJBKmGZ.js";
2
2
  //#region ../../../packages/runtime-contracts/dist/file-limits.js
3
3
  const MEBIBYTE$1 = 1024 * 1024;
4
4
  10 * MEBIBYTE$1;
@@ -1,4 +1,4 @@
1
- import { a as planCompression, c as FILE_UPLOAD_SESSION_MAX_BYTES, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-BklCn3Li.js";
1
+ import { a as planCompression, c as FILE_UPLOAD_SESSION_MAX_BYTES, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-DtIvkKNo.js";
2
2
  import { createHash } from "node:crypto";
3
3
  import { open } from "node:fs/promises";
4
4
  //#region src/lib/chunked-upload-file.ts
@@ -1,6 +1,6 @@
1
- import { n as BACKEND_TYPE } from "./backend-types-C7b_Gpa0.js";
2
- import { agentProfileJsonSchema, agentProfileSchema as agentProfileSchema$1 } from "@tangle-network/agent-interface";
1
+ import { n as BACKEND_TYPE } from "./backend-types-D6bYbvMB.js";
3
2
  import { z } from "zod";
3
+ import { agentProfileJsonSchema, agentProfileSchema as agentProfileSchema$1 } from "@tangle-network/agent-interface";
4
4
  import "@tangle-network/agent-interface/harness-capabilities";
5
5
  //#region ../../../packages/cli-agent-registry/dist/native-session-contracts-BgDTDx5F.mjs
6
6
  /** The CLI version infra/nix ships for each registered harness. */
@@ -1,11 +1,11 @@
1
- import { r as backendTypeSchema } from "./backend-types-C7b_Gpa0.js";
2
- import { D as foldModelRoutingFields, E as assertCurrentBackendType, M as withProfileHarness, S as encodePromptForWire, T as applyRequestedModel, k as normalizeRuntimeBackendConfig, s as requestInteractiveSessionToken, w as parseSSEStream } from "./interactive-controller-DaYmUCO_.js";
3
- import { _ as TimeoutError, b as parseResponseError, c as NetworkError, d as QuotaError, l as NotFoundError, m as ServerError, p as SandboxError, s as NON_RETRYABLE_CREATE_QUOTA_REASONS, t as AuthError, u as PartialFailureError, v as ValidationError, x as readResponseJson, y as parseErrorResponse } from "./errors-iWIsey1D.js";
1
+ import { r as backendTypeSchema } from "./backend-types-D6bYbvMB.js";
2
+ import { A as normalizeRuntimeBackendConfig, C as encodePromptForWire, D as assertCurrentBackendType, E as applyRequestedModel, N as withProfileHarness, O as foldModelRoutingFields, T as parseSSEStream, c as requestInteractiveSessionToken } from "./interactive-controller-CJ24g8Va.js";
3
+ import { C as readResponseJson, S as parseResponseError, b as ValidationError, d as NotFoundError, f as PartialFailureError, g as ServerError, h as SandboxError, l as NON_RETRYABLE_CREATE_QUOTA_REASONS, p as QuotaError, s as GpuProviderNotConfiguredError, t as AuthError, u as NetworkError, x as parseErrorResponse, y as TimeoutError } from "./errors-DSJBKmGZ.js";
4
4
  import { f as combineAbortSignals } from "./browser-interactive-control-controller-BJf0P_J4.js";
5
- import { A as exportTraceBundle, C as splitInlineProfileFileMounts, D as normalizeSandboxShape, E as normalizeConnection, O as rewrapResponse, T as validateDeferredProfileFileMounts, a as normalizeStartupDiagnostics, i as normalizeSandboxCreateReceipt, n as createSandboxInstanceFromResponse, r as normalizeCaptureProof, w as splitInlineProfileSkills } from "./sandbox-Dg0WI1ZF.js";
5
+ import { A as rewrapResponse, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, N as exportTraceBundle, O as normalizeConnection, T as splitInlineProfileFileMounts, a as normalizeStartupDiagnostics, i as normalizeSandboxCreateReceipt, j as fetchWithKeepAlive, k as normalizeSandboxShape, n as createSandboxInstanceFromResponse, r as normalizeCaptureProof } from "./sandbox-DzSEprto.js";
6
6
  import { LinesClient } from "./lines.js";
7
- import { agentProfileSchema } from "@tangle-network/agent-interface";
8
7
  import { z } from "zod";
8
+ import { agentProfileSchema } from "@tangle-network/agent-interface";
9
9
  //#region src/backend-registry.ts
10
10
  /** Interaction kinds a backend can originate when the caller enables them. */
11
11
  const backendRegistryInteractionKindSchema = z.enum([
@@ -3290,6 +3290,7 @@ function isDeployWindowCreateError(cause) {
3290
3290
  }
3291
3291
  function isRetryableCreateError(cause) {
3292
3292
  if (cause instanceof NetworkError) return true;
3293
+ if (cause instanceof GpuProviderNotConfiguredError) return false;
3293
3294
  if (cause instanceof QuotaError && NON_RETRYABLE_CREATE_QUOTA_REASONS.has(cause.quotaType.toUpperCase())) return false;
3294
3295
  return cause instanceof SandboxError && cause.status !== void 0 && RETRYABLE_CREATE_STATUS_CODES.has(cause.status);
3295
3296
  }
@@ -3336,11 +3337,11 @@ function withRequestContextHeaders(response, path, method, body = response.body)
3336
3337
  return rewrapResponse(response, headers, body);
3337
3338
  }
3338
3339
  async function resolveLocalCliAuthFiles(backendType) {
3339
- const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-t8KUbrfI.js");
3340
+ const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-CBV7Vjk5.js");
3340
3341
  return discoverLocalCliAuthFiles(backendType);
3341
3342
  }
3342
3343
  async function describeLocalCliAuthExpectation(backendType) {
3343
- const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-t8KUbrfI.js");
3344
+ const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-CBV7Vjk5.js");
3344
3345
  return describe(backendType);
3345
3346
  }
3346
3347
  /**
@@ -3411,6 +3412,8 @@ var Sandbox = class Sandbox {
3411
3412
  apiKey;
3412
3413
  timeoutMs;
3413
3414
  trustLocalCliAuth;
3415
+ /** Receives the SDK's timing spans; see `SandboxConfig.onTiming`. */
3416
+ onTiming;
3414
3417
  _secrets = null;
3415
3418
  _sshKeys = null;
3416
3419
  _fleets = null;
@@ -3427,6 +3430,7 @@ var Sandbox = class Sandbox {
3427
3430
  this.apiKey = config.apiKey;
3428
3431
  this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
3429
3432
  this.trustLocalCliAuth = config.trustLocalCliAuth === true;
3433
+ this.onTiming = config.onTiming;
3430
3434
  }
3431
3435
  /**
3432
3436
  * Fleet operations for agent-managed groups of sandboxes.
@@ -3488,6 +3492,10 @@ var Sandbox = class Sandbox {
3488
3492
  getApiKey() {
3489
3493
  return this.apiKey;
3490
3494
  }
3495
+ /** The Sandbox API this client talks to, without a trailing slash. */
3496
+ getBaseUrl() {
3497
+ return this.baseUrl;
3498
+ }
3491
3499
  /** A client with this one's settings that authenticates with `apiKey`. */
3492
3500
  withApiKey(apiKey) {
3493
3501
  return new Sandbox({
@@ -3495,7 +3503,8 @@ var Sandbox = class Sandbox {
3495
3503
  baseUrl: this.baseUrl,
3496
3504
  platformUrl: this.platformUrl,
3497
3505
  timeoutMs: this.timeoutMs,
3498
- trustLocalCliAuth: this.trustLocalCliAuth
3506
+ trustLocalCliAuth: this.trustLocalCliAuth,
3507
+ onTiming: this.onTiming
3499
3508
  });
3500
3509
  }
3501
3510
  /** Fetch a Platform API path (e.g. the agent-profile catalog) with this key. */
@@ -4283,10 +4292,13 @@ var Sandbox = class Sandbox {
4283
4292
  headers.set("Authorization", `Bearer ${this.apiKey}`);
4284
4293
  const isFormDataBody = typeof FormData !== "undefined" && options?.body instanceof FormData;
4285
4294
  if (!headers.has("Content-Type") && !isFormDataBody) headers.set("Content-Type", "application/json");
4286
- const response = await globalThis.fetch(url, {
4295
+ const response = await fetchWithKeepAlive(url, {
4287
4296
  ...options,
4288
4297
  headers,
4289
4298
  signal: requestSignal
4299
+ }, {
4300
+ onTiming: this.onTiming,
4301
+ path
4290
4302
  });
4291
4303
  const mediaType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase();
4292
4304
  if (response.body !== null && (!response.ok || mediaType === "application/json" || mediaType?.endsWith("+json") === true)) {
@@ -1,10 +1,10 @@
1
- import { l as TraceExportResult, n as HttpClient, r as SandboxInstance, u as TraceExportSink } from "./sandbox-C7wOeFZB.js";
2
- import { $n as PromptOptions, B as CreateSandboxOptions, Br as SandboxFleetDispatchResponse, Bt as FleetDispatchStreamOptions, Ei as SandboxShapesInfo, En as ListSandboxOptions, Er as SandboxConfig, F as CreateIntelligenceReportOptions, Fa as UsageInfo, Ft as FleetAgentResult, G as DeleteMatchingSandboxesFilter, Gt as FleetMachineId, Hi as SecretsManager, Ht as FleetDriveTurnRequest, I as CreateRequestOptions, Ir as SandboxFleetArtifact, Jr as SandboxFleetMachineSpec, Jt as FleetRunEvent, K as DeleteMatchingSandboxesOptions, Kt as FleetPromptDispatchOptions, L as CreateSandboxFleetOptions, Lr as SandboxFleetArtifactSpec, Lt as FleetDispatchCancelResult, M as ConversationTurnOptions, Mr as SandboxEnvironment, N as ConversationTurnResult, Nt as FleetAgentId, Pr as SandboxFleetAgent, Qn as PromptInputPart, Qr as SandboxFleetParent, R as CreateSandboxFleetTokenOptions, Rr as SandboxFleetCostEstimate, Rt as FleetDispatchResultBuffer, Tn as ListSandboxFleetOptions, Ur as SandboxFleetInfo, Ut as FleetExecDispatchOptions, Vr as SandboxFleetDriverCapability, Vt as FleetDriveTurnOutcome, Wt as FleetExecDispatchResult, Yr as SandboxFleetManifest, Yt as FleetRunOptions, Zr as SandboxFleetOperationsSummary, _n as IntelligenceReport, b as BatchRunRequest, ci as SandboxFleetUsage, cr as PublishPublicTemplateOptions, d as BackendConfig, di as SandboxFleetWorkspaceRestoreResult, dr as ReapExpiredSandboxFleetsResult, ei as SandboxFleetPolicy, er as PromptResult, fi as SandboxFleetWorkspaceSnapshotResult, fr as ReconcileSandboxFleetsOptions, ii as SandboxFleetTraceBundle, ka as TokenRefreshHandler, l as AttachSandboxFleetMachineOptions, lr as PublishPublicTemplateVersionOptions, ma as SshKeysManager, mi as SandboxInfo, ni as SandboxFleetSpend, no as BatchEvent, or as PublicTemplateInfo, pi as SandboxIdentity, pr as ReconcileSandboxFleetsResult, q as DeleteMatchingSandboxesResult, qr as SandboxFleetMachineRecord, qt as FleetPromptDispatchResult, ri as SandboxFleetToken, si as SandboxFleetTraceOptions, sr as PublicTemplateVersionInfo, ui as SandboxFleetWorkspaceReconcileResult, ur as ReapExpiredSandboxFleetsOptions, v as BatchResult, va as SubscriptionInfo, vn as IntelligenceReportBudget, vt as ExecOptions, xi as SandboxRunGeneration, xn as IntelligenceReportWindow, y as BatchRunOptions, yn as IntelligenceReportCompareTo, yt as ExecResult, z as CreateSandboxFleetWithCoordinatorOptions, zt as FleetDispatchResultBufferOptions } from "./types-BLCY5T4s.js";
3
- import { l as ScopedToken, s as MintInteractiveSessionTokenOptions } from "./terminal-stream-CV1pMSKC.js";
4
- import { L as LinesClient } from "./lines-D07bn-mu.js";
5
- import { f as SandboxError } from "./errors-5j_Hlkm-.js";
6
- import { AgentInteractiveSessionRef, AgentProfile } from "@tangle-network/agent-interface";
1
+ import { c as TraceExportResult, l as TraceExportSink, n as SandboxInstance } from "./sandbox-CoIGxzm_.js";
2
+ import { B as CreateSandboxOptions, Ba as TokenRefreshHandler, Bt as FleetDispatchResultBuffer, En as IntelligenceReportCompareTo, F as CreateIntelligenceReportOptions, Ft as FleetAgentId, G as DeleteMatchingSandboxesFilter, Gr as SandboxFleetCostEstimate, Gt as FleetExecDispatchOptions, Ht as FleetDispatchStreamOptions, I as CreateRequestOptions, Ii as SandboxShapesInfo, Jr as SandboxFleetDriverCapability, Jt as FleetPromptDispatchOptions, K as DeleteMatchingSandboxesOptions, Kt as FleetExecDispatchResult, L as CreateSandboxFleetOptions, Lt as FleetAgentResult, M as ConversationTurnOptions, Mn as ListSandboxFleetOptions, N as ConversationTurnResult, Nn as ListSandboxOptions, Nr as SandboxConfig, On as IntelligenceReportWindow, Qi as SecretsManager, R as CreateSandboxFleetTokenOptions, Sn as HttpClient, Tn as IntelligenceReportBudget, Ur as SandboxFleetArtifact, Ut as FleetDriveTurnOutcome, Vr as SandboxFleetAgent, Vt as FleetDispatchResultBufferOptions, Wr as SandboxFleetArtifactSpec, Wt as FleetDriveTurnRequest, Xr as SandboxFleetInfo, Xt as FleetRunEvent, Yt as FleetPromptDispatchResult, Zt as FleetRunOptions, _i as SandboxFleetWorkspaceReconcileResult, _r as ReapExpiredSandboxFleetsOptions, ai as SandboxFleetParent, ar as PromptInputPart, b as BatchRunRequest, bi as SandboxIdentity, br as ReconcileSandboxFleetsResult, bt as ExecOptions, d as BackendConfig, di as SandboxFleetTraceBundle, ei as SandboxFleetMachineRecord, eo as SdkTimingHook, gr as PublishPublicTemplateVersionOptions, hi as SandboxFleetUsage, ho as BatchEvent, hr as PublishPublicTemplateOptions, ii as SandboxFleetOperationsSummary, ji as SandboxRunGeneration, ka as SubscriptionInfo, l as AttachSandboxFleetMachineOptions, li as SandboxFleetSpend, mi as SandboxFleetTraceOptions, mr as PublicTemplateVersionInfo, ni as SandboxFleetManifest, or as PromptOptions, pr as PublicTemplateInfo, q as DeleteMatchingSandboxesResult, qa as UsageInfo, qr as SandboxFleetDispatchResponse, qt as FleetMachineId, si as SandboxFleetPolicy, sr as PromptResult, ti as SandboxFleetMachineSpec, ui as SandboxFleetToken, v as BatchResult, vi as SandboxFleetWorkspaceRestoreResult, vr as ReapExpiredSandboxFleetsResult, wa as SshKeysManager, wn as IntelligenceReport, xi as SandboxInfo, xt as ExecResult, y as BatchRunOptions, yi as SandboxFleetWorkspaceSnapshotResult, yr as ReconcileSandboxFleetsOptions, z as CreateSandboxFleetWithCoordinatorOptions, zr as SandboxEnvironment, zt as FleetDispatchCancelResult } from "./types-B_QF-iHm.js";
3
+ import { d as MintInteractiveSessionTokenOptions, p as ScopedToken } from "./terminal-stream-jdYomM1m.js";
4
+ import { h as SandboxError } from "./errors-mPL-qvgF.js";
5
+ import { L as LinesClient } from "./lines-DodQslsf.js";
7
6
  import { z } from "zod";
7
+ import { AgentInteractiveSessionRef, AgentProfile } from "@tangle-network/agent-interface";
8
8
 
9
9
  //#region src/backend-registry.d.ts
10
10
  /** Interaction kinds a backend can originate when the caller enables them. */
@@ -665,6 +665,8 @@ declare class Sandbox implements HttpClient, ScopedTokenHttpClient {
665
665
  private readonly apiKey;
666
666
  private readonly timeoutMs;
667
667
  private readonly trustLocalCliAuth;
668
+ /** Receives the SDK's timing spans; see `SandboxConfig.onTiming`. */
669
+ readonly onTiming: SdkTimingHook | undefined;
668
670
  private _secrets;
669
671
  private _sshKeys;
670
672
  private _fleets;
@@ -714,6 +716,8 @@ declare class Sandbox implements HttpClient, ScopedTokenHttpClient {
714
716
  run(options: RunOptions, wait?: RunWaitOptions): Promise<RunRecord>;
715
717
  get intelligence(): IntelligenceClient;
716
718
  getApiKey(): string;
719
+ /** The Sandbox API this client talks to, without a trailing slash. */
720
+ getBaseUrl(): string;
717
721
  /** A client with this one's settings that authenticates with `apiKey`. */
718
722
  withApiKey(apiKey: string): Sandbox;
719
723
  /** Fetch a Platform API path (e.g. the agent-profile catalog) with this key. */
@@ -1,2 +1,2 @@
1
- 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-DHuHjNie.js";
1
+ 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-DZ27pdB8.js";
2
2
  export { CollaborationBootstrapRequest, CollaborationBootstrapResponse, CollaborationClient, CollaborationClientConfig, CollaborationDocumentAdapter, CollaborationDocumentChange, CollaborationDocumentRef, CollaborationFileBridge, CollaborationFileBridgeOptions, CollaborationFileEvent, CollaborationPermissions, CollaborationTokenRefreshRequest, CollaborationTokenRefreshResponse, CollaborationTransportConfig, SaveCollaborationSnapshotRequest, SaveCollaborationSnapshotResponse, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
@@ -1,2 +1,2 @@
1
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-B2g1j2ey.js";
1
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-DaJU5O0E.js";
2
2
  export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
@@ -1,4 +1,4 @@
1
- import { _ as TimeoutError, c as NetworkError, y as parseErrorResponse } from "./errors-iWIsey1D.js";
1
+ import { u as NetworkError, x as parseErrorResponse, y as TimeoutError } from "./errors-DSJBKmGZ.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,9 +1,9 @@
1
- import { a as WorkspaceImagePublishRequestOptions, i as WorkspaceImagePublishInput, o as WorkspaceImagePublishResult, r as SandboxInstance, s as WorkspaceImages, v as ProfileFileDeliveryReport } from "./sandbox-C7wOeFZB.js";
2
- import { An as ManagedProcessRecord, B as CreateSandboxOptions, Di as SandboxStatus, Er as SandboxConfig, Ga as SandboxEnvRecoveryView, Hn as PreviewLinkManager, In as NetworkConfig, M as ConversationTurnOptions, Mn as ManagedProcessSpec, N as ConversationTurnResult, Nn as ManagedProcessState, On as ManagedProcessJobs, Qn as PromptInputPart, Un as PreviewLinkWaitOptions, Vn as PreviewLinkInfo, Wa as SandboxEnvRecovery, jn as ManagedProcessResumeOptions, kn as ManagedProcessOptions, mi as SandboxInfo, na as SessionMessageAdmission, vt as ExecOptions, yt as ExecResult } from "./types-BLCY5T4s.js";
3
- import { A as LineSendReceipt, B as lineInstanceKey, C as LineReplyCode, G as LineApplicationRequest, H as LINE_APPLICATION_REPLY_MAX_CHARS, J as LineApplicationView, K as LineApplicationResult, L as LinesClient, M as LineSenderVerificationStart, S as LineReminderPreferences, U as LINE_APPLICATION_REQUEST_MAX_BYTES, V as profileChannelReference, W as LineApplication, X as parseLineApplicationResult, Y as parseLineApplicationRequest, a as LineApplicationAttachOptions, b as LineNumberInventory, c as LineAttachmentReauthorization, d as LineImage, f as LineInstanceAttachOptions, g as LineMemberInstance, h as LineMember, j as LineSenderVerification, k as LineSendInput, l as LineExecutionKey, n as LineAgentRolePolicy, p as LineInstanceCreate, q as LineApplicationState, s as LineAttachment, t as Line, w as LineReplyCodeInput, x as LineProvider } from "./lines-D07bn-mu.js";
4
- import { A as BackendRegistryEntry, C as InstancesClient, F as backendRegistryInteractionKindSchema, I as backendRegistryResponseSchema, L as isBackendRegistryInteractionKind, M as BackendRegistryResponse, N as backendRegistryCapabilitiesSchema, P as backendRegistryEntrySchema, R as parseBackendRegistryResponse, _ as EnsureInstanceOptions, b as InstanceRecord, i as Sandbox, j as BackendRegistryInteractionKind, k as BackendRegistryCapabilities, v as HostedInstance, x as InstanceRestartingError, y as InstanceProfile, z as parseBackendRegistryResponseBody } from "./client-DVouBFPR.js";
5
- import { a as FileWriteConflictError, b as ValidationError, c as NotFoundError, f as SandboxError, g as StateError, h as ServerError, l as PartialFailureError, m as SandboxFailureDetail, n as CapabilityError, p as SandboxErrorJson, s as NetworkError, t as AuthError, u as QuotaError, y as TimeoutError } from "./errors-5j_Hlkm-.js";
6
- import { t as ManagedProcessClient } from "./managed-process-RMyVq_du.js";
1
+ import { _ as ProfileFileDeliveryReport, a as WorkspaceImagePublishResult, i as WorkspaceImagePublishRequestOptions, n as SandboxInstance, o as WorkspaceImages, r as WorkspaceImagePublishInput } from "./sandbox-CoIGxzm_.js";
2
+ import { B as CreateSandboxOptions, Bn as ManagedProcessState, Fn as ManagedProcessJobs, In as ManagedProcessOptions, Jn as PreviewLinkInfo, Li as SandboxStatus, Ln as ManagedProcessRecord, M as ConversationTurnOptions, N as ConversationTurnResult, Nr as SandboxConfig, Rn as ManagedProcessResumeOptions, Un as NetworkConfig, Xn as PreviewLinkWaitOptions, Yn as PreviewLinkManager, ar as PromptInputPart, bt as ExecOptions, fa as SessionMessageAdmission, io as SandboxEnvRecoveryView, ro as SandboxEnvRecovery, xi as SandboxInfo, xt as ExecResult, zn as ManagedProcessSpec } from "./types-B_QF-iHm.js";
3
+ import { C as ValidationError, S as TimeoutError, _ as SandboxFailureDetail, d as NotFoundError, f as PartialFailureError, g as SandboxErrorJson, h as SandboxError, o as FileWriteConflictError, p as QuotaError, r as CapabilityError, t as AuthError, u as NetworkError, v as ServerError, y as StateError } from "./errors-mPL-qvgF.js";
4
+ import { A as LineSendReceipt, B as lineInstanceKey, C as LineReplyCode, G as LineApplicationRequest, H as LINE_APPLICATION_REPLY_MAX_CHARS, J as LineApplicationView, K as LineApplicationResult, L as LinesClient, M as LineSenderVerificationStart, S as LineReminderPreferences, U as LINE_APPLICATION_REQUEST_MAX_BYTES, V as profileChannelReference, W as LineApplication, X as parseLineApplicationResult, Y as parseLineApplicationRequest, a as LineApplicationAttachOptions, b as LineNumberInventory, c as LineAttachmentReauthorization, d as LineImage, f as LineInstanceAttachOptions, g as LineMemberInstance, h as LineMember, j as LineSenderVerification, k as LineSendInput, l as LineExecutionKey, n as LineAgentRolePolicy, p as LineInstanceCreate, q as LineApplicationState, s as LineAttachment, t as Line, w as LineReplyCodeInput, x as LineProvider } from "./lines-DodQslsf.js";
5
+ import { A as BackendRegistryEntry, C as InstancesClient, F as backendRegistryInteractionKindSchema, I as backendRegistryResponseSchema, L as isBackendRegistryInteractionKind, M as BackendRegistryResponse, N as backendRegistryCapabilitiesSchema, P as backendRegistryEntrySchema, R as parseBackendRegistryResponse, _ as EnsureInstanceOptions, b as InstanceRecord, i as Sandbox, j as BackendRegistryInteractionKind, k as BackendRegistryCapabilities, v as HostedInstance, x as InstanceRestartingError, y as InstanceProfile, z as parseBackendRegistryResponseBody } from "./client-Lhxo82x1.js";
6
+ import { t as ManagedProcessClient } from "./managed-process-B7WfqKmi.js";
7
7
 
8
8
  //#region src/core.d.ts
9
9
  /** Local SDK protocol support only, not a deployed-host readiness assertion.
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as TimeoutError, a as FileWriteConflictError, c as NetworkError, d as QuotaError, h as StateError, l as NotFoundError, m as ServerError, n as CapabilityError, p as SandboxError, t as AuthError, u as PartialFailureError, v as ValidationError } from "./errors-iWIsey1D.js";
2
- import { _ as parseBackendRegistryResponse, a as InstanceRestartingError, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as HostedInstance, m as backendRegistryInteractionKindSchema, n as Sandbox, o as InstancesClient, p as backendRegistryEntrySchema, v as parseBackendRegistryResponseBody } from "./client-DUDqUYDG.js";
3
- import { o as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-Dg0WI1ZF.js";
1
+ import { _ as StateError, b as ValidationError, d as NotFoundError, f as PartialFailureError, g as ServerError, h as SandboxError, o as FileWriteConflictError, p as QuotaError, r as CapabilityError, t as AuthError, u as NetworkError, y as TimeoutError } from "./errors-DSJBKmGZ.js";
2
+ import { _ as parseBackendRegistryResponse, a as InstanceRestartingError, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as HostedInstance, m as backendRegistryInteractionKindSchema, n as Sandbox, o as InstancesClient, p as backendRegistryEntrySchema, v as parseBackendRegistryResponseBody } from "./client-CRkHfByN.js";
3
+ import { C as ManagedProcessClient, o as WorkspaceImages, t as SandboxInstance } from "./sandbox-DzSEprto.js";
4
4
  import { LinesClient, lineInstanceKey, profileChannelReference } from "./lines.js";
5
5
  import { i as parseLineApplicationResult, n as LINE_APPLICATION_REQUEST_MAX_BYTES, r as parseLineApplicationRequest, t as LINE_APPLICATION_REPLY_MAX_CHARS } from "./line-application-Cq6dJLBD.js";
6
6
  //#region src/core.ts
@@ -117,6 +117,34 @@ var CapabilityError = class extends SandboxError {
117
117
  }
118
118
  };
119
119
  /**
120
+ * No configured GPU provider can take the lease: none is configured, the
121
+ * named one is not, or the provider refused its credential. Status 503, code
122
+ * `GPU_PROVIDER_NOT_CONFIGURED`. The message names every supported provider
123
+ * and the orchestrator variables it needs; `providers` carries the same.
124
+ */
125
+ var GpuProviderNotConfiguredError = class extends CapabilityError {
126
+ providers;
127
+ constructor(message, providers = [], status = 503, metadata) {
128
+ super(message, "GPU_PROVIDER_NOT_CONFIGURED", status, metadata, "gpu");
129
+ this.name = "GpuProviderNotConfiguredError";
130
+ this.providers = providers;
131
+ }
132
+ };
133
+ function readGpuProviderRequirements(data) {
134
+ return (Array.isArray(data.providers) ? data.providers : []).flatMap((entry) => {
135
+ if (!isFailureDetail(entry)) return [];
136
+ const provider = asString(entry.provider);
137
+ const state = asString(entry.state);
138
+ const envVars = Array.isArray(entry.envVars) ? entry.envVars : [];
139
+ if (!provider || !state) return [];
140
+ return [{
141
+ provider,
142
+ state,
143
+ envVars: envVars.filter((name) => typeof name === "string")
144
+ }];
145
+ });
146
+ }
147
+ /**
120
148
  * A multi-resource operation failed for one or more branches.
121
149
  */
122
150
  var PartialFailureError = class extends SandboxError {
@@ -245,6 +273,29 @@ var ResumeEnvRequiredError = class extends SandboxError {
245
273
  }
246
274
  };
247
275
  /**
276
+ * A branch asked for more children than the parent's host has memory for.
277
+ * Children can only live on the parent's host (their clone is local to its
278
+ * volume), so no other host can take the rest. `maxChildren` is how many
279
+ * children that host admits now; branch that many or fewer, or wait for the
280
+ * host to free memory. Nothing was created and nothing is held.
281
+ *
282
+ * A retry under the same idempotency key replays this refusal unchanged,
283
+ * `maxChildren` included, so the count is the host's room when the key was
284
+ * first used. To branch fewer children, use a new key.
285
+ */
286
+ var BranchFanoutExceedsHostError = class extends SandboxError {
287
+ /** Children the parent's host admitted when it refused (0 when none). */
288
+ maxChildren;
289
+ /** The fan-out width this request asked for. */
290
+ requestedChildren;
291
+ constructor(message, counts, metadata) {
292
+ super(message, "BRANCH_FANOUT_EXCEEDS_HOST", 409, metadata);
293
+ this.name = "BranchFanoutExceedsHostError";
294
+ this.maxChildren = counts.maxChildren;
295
+ this.requestedChildren = counts.requestedChildren;
296
+ }
297
+ };
298
+ /**
248
299
  * The request timed out.
249
300
  */
250
301
  var TimeoutError = class extends SandboxError {
@@ -465,6 +516,7 @@ function parseErrorResponse(status, body, context, headers) {
465
516
  createFailureDisposition: context?.allPreviousCreateAttemptsRefused === true && (context.method ?? headers?.get("x-tangle-request-method")) === "POST" && (context.path ?? headers?.get("x-tangle-request-path")) === "/v1/sandboxes" && status === 429 && (code === "RATE_LIMIT_EXCEEDED" || code === "QUOTA_EXCEEDED" || code === "PLATFORM_RATE_LIMITED") ? "not-admitted" : void 0
466
517
  };
467
518
  if (isQuotaCode(code)) return new QuotaError(quotaTypeFromResponse(data, reason), message, data.current, data.limit, metadata, status);
519
+ if (code === "GPU_PROVIDER_NOT_CONFIGURED" || code === "GPU_PROVIDERS_NOT_CONFIGURED") return new GpuProviderNotConfiguredError(message, readGpuProviderRequirements(data), status, metadata);
468
520
  if (isCapabilityCode(code)) return new CapabilityError(message, code, status, metadata, readCapability(data, errorObj));
469
521
  if (isPartialFailureCode(code)) return new PartialFailureError(message, code, status, metadata, readFailures(data, errorObj));
470
522
  if (code === "EGRESS_PROXY_RECOVERY_REQUIRED") return new EgressProxyRecoveryError(message, metadata);
@@ -472,6 +524,13 @@ function parseErrorResponse(status, body, context, headers) {
472
524
  const keys = data.missingEnvKeys;
473
525
  return new ResumeEnvRequiredError(message, Array.isArray(keys) ? keys.filter((key) => typeof key === "string") : [], metadata);
474
526
  }
527
+ if (code === "BRANCH_FANOUT_EXCEEDS_HOST") {
528
+ const count = (raw) => typeof raw === "number" && Number.isSafeInteger(raw) && raw >= 0 ? raw : void 0;
529
+ return new BranchFanoutExceedsHostError(message, {
530
+ maxChildren: count(data.maxChildren),
531
+ requestedChildren: count(data.requestedChildren)
532
+ }, metadata);
533
+ }
475
534
  if (code === "KEY_BUDGET_EXHAUSTED") return new KeyBudgetExhaustedError(message, readKeyBudgetDetails(data.details), metadata);
476
535
  if (code === "FILE_WRITE_CONFLICT") {
477
536
  const conflict = readFileWriteConflictDetails(errorObj);
@@ -504,4 +563,4 @@ function readResponseJson(response) {
504
563
  });
505
564
  }
506
565
  //#endregion
507
- export { TimeoutError as _, FileWriteConflictError as a, parseResponseError as b, NetworkError as c, QuotaError as d, ResumeEnvRequiredError as f, StreamInterruptedError as g, StateError as h, EgressProxyRecoveryError as i, NotFoundError as l, ServerError as m, CapabilityError as n, KeyBudgetExhaustedError as o, SandboxError as p, EdgeNotReadyError as r, NON_RETRYABLE_CREATE_QUOTA_REASONS as s, AuthError as t, PartialFailureError as u, ValidationError as v, readResponseJson as x, parseErrorResponse as y };
566
+ export { readResponseJson as C, parseResponseError as S, StateError as _, EgressProxyRecoveryError as a, ValidationError as b, KeyBudgetExhaustedError as c, NotFoundError as d, PartialFailureError as f, ServerError as g, SandboxError as h, EdgeNotReadyError as i, NON_RETRYABLE_CREATE_QUOTA_REASONS as l, ResumeEnvRequiredError as m, BranchFanoutExceedsHostError as n, FileWriteConflictError as o, QuotaError as p, CapabilityError as r, GpuProviderNotConfiguredError as s, AuthError as t, NetworkError as u, StreamInterruptedError as v, parseErrorResponse as x, TimeoutError as y };
@@ -1,5 +1,43 @@
1
- import { Ua as SandboxCreateReceipt } from "./types-BLCY5T4s.js";
1
+ import { no as SandboxCreateReceipt } from "./types-B_QF-iHm.js";
2
+ import { c as TerminalStreamReconnectAuthority, n as TerminalStream, p as ScopedToken } from "./terminal-stream-jdYomM1m.js";
3
+ import { a as InteractiveSessionControlController, c as InteractiveSessionIdentity, f as InteractiveAttachOptions, h as InteractiveRequestOptions, n as BrowserInteractiveSessionControlControllerOptions, o as InteractiveSessionControlControllerOptions, s as InteractiveSessionControlTransport } from "./browser-interactive-control-controller-rpTbyvAS.js";
4
+ import { AgentInteractiveSessionRef } from "@tangle-network/agent-interface";
2
5
 
6
+ //#region src/interactive-controller.d.ts
7
+ /** The request fields supplied by an attach caller before control is claimed. */
8
+ type InteractiveAttachRequest = Omit<InteractiveAttachOptions, "control">;
9
+ /** Transport used by the status → claim → WebSocket controller. */
10
+ interface InteractiveSessionControllerTransport extends InteractiveSessionControlTransport {
11
+ attach(sessionId: string, ref: AgentInteractiveSessionRef, request: InteractiveAttachOptions, options?: InteractiveRequestOptions, reconnectAuthority?: TerminalStreamReconnectAuthority): Promise<TerminalStream>;
12
+ }
13
+ interface InteractiveSessionControllerOptions extends InteractiveSessionControlControllerOptions {}
14
+ /**
15
+ * Attach-capable controller for one exact interactive process.
16
+ *
17
+ * Control ownership lives in the dependency-light base controller. This layer
18
+ * adds only the terminal attach operation after that ownership is resolved.
19
+ */
20
+ declare class InteractiveSessionController extends InteractiveSessionControlController {
21
+ private readonly attachTransport;
22
+ private attachInFlight?;
23
+ constructor(attachTransport: InteractiveSessionControllerTransport, options: InteractiveSessionControllerOptions);
24
+ attach(request: InteractiveAttachRequest, requestOptions?: InteractiveRequestOptions): Promise<TerminalStream>;
25
+ /**
26
+ * Open a stream for a claim returned by this controller's `resolve()`.
27
+ * The controller releases that claim when the stream cannot be opened.
28
+ */
29
+ attachWithIdentity(identity: InteractiveSessionIdentity, request: InteractiveAttachRequest, requestOptions?: InteractiveRequestOptions): Promise<TerminalStream>;
30
+ }
31
+ /** Browser transport options for the attach-capable controller. */
32
+ interface BrowserInteractiveSessionControllerOptions extends InteractiveSessionControllerOptions, BrowserInteractiveSessionControlControllerOptions {
33
+ /** Mint a future session-runtime token for every browser terminal dial. */
34
+ terminalTokenProvider?: (signal?: AbortSignal) => Promise<ScopedToken>;
35
+ }
36
+ /** Concrete controller for browser deep links and terminal attachment. */
37
+ declare class BrowserInteractiveSessionController extends InteractiveSessionController {
38
+ constructor(options: BrowserInteractiveSessionControllerOptions);
39
+ }
40
+ //#endregion
3
41
  //#region src/errors.d.ts
4
42
  /**
5
43
  * Base error class for all Sandbox SDK errors.
@@ -93,6 +131,24 @@ declare class CapabilityError extends SandboxError {
93
131
  readonly capability?: string;
94
132
  constructor(message: string, code?: string, status?: number, metadata?: SandboxErrorMetadata, capability?: string);
95
133
  }
134
+ /** What one supported GPU provider needs, as a refusal reports it. */
135
+ interface GpuProviderRequirement {
136
+ provider: string;
137
+ /** `ready`, `credential-invalid`, `unverified`, `not-configured`, `disabled`. */
138
+ state: string;
139
+ /** Orchestrator environment variables it needs (`A|B`: either). */
140
+ envVars: string[];
141
+ }
142
+ /**
143
+ * No configured GPU provider can take the lease: none is configured, the
144
+ * named one is not, or the provider refused its credential. Status 503, code
145
+ * `GPU_PROVIDER_NOT_CONFIGURED`. The message names every supported provider
146
+ * and the orchestrator variables it needs; `providers` carries the same.
147
+ */
148
+ declare class GpuProviderNotConfiguredError extends CapabilityError {
149
+ readonly providers: GpuProviderRequirement[];
150
+ constructor(message: string, providers?: GpuProviderRequirement[], status?: number, metadata?: SandboxErrorMetadata);
151
+ }
96
152
  /**
97
153
  * A multi-resource operation failed for one or more branches.
98
154
  */
@@ -190,6 +246,27 @@ declare class ResumeEnvRequiredError extends SandboxError {
190
246
  readonly missingEnvKeys: readonly string[];
191
247
  constructor(message: string, missingEnvKeys: readonly string[], metadata?: SandboxErrorMetadata);
192
248
  }
249
+ /**
250
+ * A branch asked for more children than the parent's host has memory for.
251
+ * Children can only live on the parent's host (their clone is local to its
252
+ * volume), so no other host can take the rest. `maxChildren` is how many
253
+ * children that host admits now; branch that many or fewer, or wait for the
254
+ * host to free memory. Nothing was created and nothing is held.
255
+ *
256
+ * A retry under the same idempotency key replays this refusal unchanged,
257
+ * `maxChildren` included, so the count is the host's room when the key was
258
+ * first used. To branch fewer children, use a new key.
259
+ */
260
+ declare class BranchFanoutExceedsHostError extends SandboxError {
261
+ /** Children the parent's host admitted when it refused (0 when none). */
262
+ readonly maxChildren?: number;
263
+ /** The fan-out width this request asked for. */
264
+ readonly requestedChildren?: number;
265
+ constructor(message: string, counts: {
266
+ maxChildren?: number;
267
+ requestedChildren?: number;
268
+ }, metadata?: SandboxErrorMetadata);
269
+ }
193
270
  /**
194
271
  * The request timed out.
195
272
  */
@@ -267,4 +344,4 @@ declare class ServerError extends SandboxError {
267
344
  constructor(message: string, status?: number, metadata?: SandboxErrorMetadata, code?: string);
268
345
  }
269
346
  //#endregion
270
- export { StreamInterruptedError as _, FileWriteConflictError as a, ValidationError as b, NotFoundError as c, ResumeEnvRequiredError as d, SandboxError as f, StateError as g, ServerError as h, EgressProxyRecoveryError as i, PartialFailureError as l, SandboxFailureDetail as m, CapabilityError as n, KeyBudgetExhaustedError as o, SandboxErrorJson as p, EdgeNotReadyError as r, NetworkError as s, AuthError as t, QuotaError as u, StreamInterruptionReason as v, TimeoutError as y };
347
+ export { ValidationError as C, InteractiveSessionController as D, InteractiveAttachRequest as E, InteractiveSessionControllerOptions as O, TimeoutError as S, BrowserInteractiveSessionControllerOptions as T, SandboxFailureDetail as _, EgressProxyRecoveryError as a, StreamInterruptedError as b, GpuProviderRequirement as c, NotFoundError as d, PartialFailureError as f, SandboxErrorJson as g, SandboxError as h, EdgeNotReadyError as i, InteractiveSessionControllerTransport as k, KeyBudgetExhaustedError as l, ResumeEnvRequiredError as m, BranchFanoutExceedsHostError as n, FileWriteConflictError as o, QuotaError as p, CapabilityError as r, GpuProviderNotConfiguredError as s, AuthError as t, NetworkError as u, ServerError as v, BrowserInteractiveSessionController as w, StreamInterruptionReason as x, StateError as y };
@@ -1,5 +1,5 @@
1
- import { n as HttpClient, r as SandboxInstance } from "./sandbox-C7wOeFZB.js";
2
- import { B as CreateSandboxOptions } from "./types-BLCY5T4s.js";
1
+ import { n as SandboxInstance } from "./sandbox-CoIGxzm_.js";
2
+ import { B as CreateSandboxOptions, Sn as HttpClient } from "./types-B_QF-iHm.js";
3
3
 
4
4
  //#region src/tangle/abi.d.ts
5
5
  /**