@tangle-network/sandbox 0.68.4 → 0.68.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.
@@ -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-ClJ5TD-m.js";
2
2
  import { D as assertCurrentBackendType } from "../interactive-controller-ThIeP_oZ.js";
3
3
  import { C as StateError, E as ValidationError, g as NotFoundError } from "../errors-Bs5G7JdV.js";
4
- import { t as Sandbox } from "../client-Dl8XOOyt.js";
5
- import { t as SandboxInstance } from "../sandbox-DB-j-O2G.js";
4
+ import { t as Sandbox } from "../client-CsMDiL9n.js";
5
+ import { t as SandboxInstance } from "../sandbox-CYRnJ0bP.js";
6
6
  import { z } from "zod";
7
7
  //#region src/agent/instances.ts
8
8
  const managers = /* @__PURE__ */ new WeakMap();
@@ -4,7 +4,7 @@ import { E as ValidationError, S as ServerError, T as TimeoutError, _ as Partial
4
4
  import { f as combineAbortSignals } from "./browser-interactive-control-controller-k1KkqDGF.js";
5
5
  import { t as fetchSandboxApi } from "./api-request-D8Mni27A.js";
6
6
  import { n as fetchWithKeepAlive } from "./keep-alive-fetch-C92u8Kce.js";
7
- import { A as normalizeSandboxCreateReceipt, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as normalizeSandboxShape, M as parseStopPhase, N as normalizeConnection, O as isRetryableProfileFileMaterializeFailure, P as normalizeEgressPolicyFields, T as splitInlineProfileFileMounts, j as normalizeStartupDiagnostics, k as normalizeCaptureProof, n as createSandboxInstanceFromResponse, o as exportTraceBundle } from "./sandbox-DB-j-O2G.js";
7
+ import { A as normalizeSandboxCreateReceipt, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as normalizeSandboxShape, M as parseStopPhase, N as normalizeConnection, O as isRetryableProfileFileMaterializeFailure, P as normalizeEgressPolicyFields, T as splitInlineProfileFileMounts, j as normalizeStartupDiagnostics, k as normalizeCaptureProof, n as createSandboxInstanceFromResponse, o as exportTraceBundle } from "./sandbox-CYRnJ0bP.js";
8
8
  import { t as LinesClient } from "./lines-DgRXUg5y.js";
9
9
  import { PublicTemplatesClient } from "./public-templates.js";
10
10
  import { z } from "zod";
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, d as FileWriteConflictError, g as NotFoundError, h as NetworkError, s as CapabilityError, v as ProfileFileMountPathError, x as SandboxError, y as QuotaError } from "./errors-Bs5G7JdV.js";
2
- import { a as InstancesClient, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, p as isBackendRegistryInteractionKind, r as HostedInstance, t as Sandbox, u as backendRegistryEntrySchema } from "./client-Dl8XOOyt.js";
3
- import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-DB-j-O2G.js";
2
+ import { a as InstancesClient, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, p as isBackendRegistryInteractionKind, r as HostedInstance, t as Sandbox, u as backendRegistryEntrySchema } from "./client-CsMDiL9n.js";
3
+ import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-CYRnJ0bP.js";
4
4
  import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-DgRXUg5y.js";
5
5
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
6
6
  import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-DgUywLjg.js";
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { i as isolationPrincipalSchema, o as parseBackendType, r as backendTypeSchema, t as ALL_BACKEND_TYPES } from "./backend-types-CLvdSX8V.js";
2
2
  import { A as normalizeRuntimeBackendConfig, B as TERMINAL_WS_ECHO_SUBPROTOCOL, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, b as parseSSEStream, i as terminalUpgradeHeadersSupported, j as requestedPublicProfileDigest, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as projectAgentTerminalRecord } from "./interactive-controller-ThIeP_oZ.js";
3
3
  import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, b as ResumeEnvRequiredError, c as CompliancePlacementError, d as FileWriteConflictError, f as GpuProviderNotConfiguredError, g as NotFoundError, h as NetworkError, l as EdgeNotReadyError, o as BranchFanoutExceedsHostError, p as KeyBudgetExhaustedError, s as CapabilityError, t as TerminalStreamError, u as EgressProxyRecoveryError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-Bs5G7JdV.js";
4
- import { _ as createBatchResultAccumulator, a as InstancesClient, c as runtimeWorkspaceCwdSchema, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, g as IntelligenceClient, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, n as RunsClient, o as SandboxFleetClient, p as isBackendRegistryInteractionKind, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryEntrySchema, v as validateBatchRunRequest } from "./client-Dl8XOOyt.js";
4
+ import { _ as createBatchResultAccumulator, a as InstancesClient, c as runtimeWorkspaceCwdSchema, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, g as IntelligenceClient, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, n as RunsClient, o as SandboxFleetClient, p as isBackendRegistryInteractionKind, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryEntrySchema, v as validateBatchRunRequest } from "./client-CsMDiL9n.js";
5
5
  import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-k1KkqDGF.js";
6
6
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-Ox7K-TN6.js";
7
- import { C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, d as InteractiveSessionHandle, f as agentInteractiveSessionPromptRequestDigest, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as materializeProfileFileMounts, x as ManagedProcessClient, y as getSandboxEventText } from "./sandbox-DB-j-O2G.js";
7
+ import { C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, d as InteractiveSessionHandle, f as agentInteractiveSessionPromptRequestDigest, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as materializeProfileFileMounts, x as ManagedProcessClient, y as getSandboxEventText } from "./sandbox-CYRnJ0bP.js";
8
8
  import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-DgRXUg5y.js";
9
9
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
10
10
  import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-DgUywLjg.js";
11
- import { s as TangleSandboxClient } from "./tangle-BO2p4BNH.js";
11
+ import { s as TangleSandboxClient } from "./tangle-DTk-DEwj.js";
12
12
  import { z } from "zod";
13
13
  import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
14
14
  //#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
@@ -1,2 +1,2 @@
1
- import { n as withPreparedProcessCalls, t as runPreparedProcess } from "../prepared-process-DuWP6Kb7.js";
1
+ import { n as withPreparedProcessCalls, t as runPreparedProcess } from "../prepared-process-DKgEUodb.js";
2
2
  export { runPreparedProcess, withPreparedProcessCalls };
@@ -16,7 +16,7 @@ function processRequests(request, deadline, signal) {
16
16
  ...requestSignal ? { signal: requestSignal } : {}
17
17
  }, Number.isFinite(left) ? left : 0);
18
18
  };
19
- const pause = () => {
19
+ const pause = (ms = POLL_DELAY_MIN_MS) => {
20
20
  return new Promise((resolve, reject) => {
21
21
  const abort = () => {
22
22
  clearTimeout(timer);
@@ -25,7 +25,7 @@ function processRequests(request, deadline, signal) {
25
25
  const timer = setTimeout(() => {
26
26
  signal?.removeEventListener("abort", abort);
27
27
  resolve();
28
- }, Math.min(250, remaining()));
28
+ }, Math.min(ms, remaining()));
29
29
  signal?.addEventListener("abort", abort, { once: true });
30
30
  if (signal?.aborted) abort();
31
31
  });
@@ -35,19 +35,44 @@ function processRequests(request, deadline, signal) {
35
35
  pause
36
36
  };
37
37
  }
38
- /** Only the small pending receipt is parsed; terminal output stays streamed. */
38
+ const POLL_DELAY_MIN_MS = 250;
39
+ const POLL_DELAY_MAX_MS = 2e3;
40
+ /**
41
+ * Only the small pending receipt is parsed; terminal output stays streamed.
42
+ * Every poll spends the caller's runtime request budget (60 a minute on the
43
+ * smallest plan), so polls back off from 250 ms to 2 s, and a 429 is waited
44
+ * out: the process keeps running while the budget refills, and its result
45
+ * stays readable.
46
+ */
39
47
  async function pollPreparedProcess(transport, target, pid, headers, read) {
40
- while (true) {
48
+ for (let poll = 0;; poll++) {
41
49
  const response = await transport.ask(target, {
42
50
  method: "GET",
43
51
  headers
44
52
  });
53
+ if (response.status === 429) {
54
+ await response.body?.cancel?.();
55
+ await transport.pause(retryAfterMs(response) ?? pollDelayMs(poll));
56
+ continue;
57
+ }
45
58
  if (response.status !== 202) return response;
46
59
  const pending = await read(response);
47
60
  if (pending.state !== "running" || pending.pid !== pid) throw new Error("Malformed process result receipt");
48
- await transport.pause();
61
+ await transport.pause(pollDelayMs(poll));
49
62
  }
50
63
  }
64
+ function pollDelayMs(poll) {
65
+ return Math.min(POLL_DELAY_MIN_MS * 2 ** poll, POLL_DELAY_MAX_MS);
66
+ }
67
+ /** `Retry-After` as delay-seconds or an HTTP date; undefined when absent or unreadable. */
68
+ function retryAfterMs(response) {
69
+ const value = response.headers?.get?.("retry-after");
70
+ if (!value) return void 0;
71
+ const seconds = Number(value);
72
+ if (Number.isFinite(seconds) && seconds >= 0) return seconds * 1e3;
73
+ const date = Date.parse(value);
74
+ return Number.isFinite(date) ? Math.max(0, date - Date.now()) : void 0;
75
+ }
51
76
  /** One prepare/PID/result transport for SDK, Worker adapters and Node probes. */
52
77
  async function runPreparedProcess(request, path, init, timeoutMs = 75e3, read = (response) => response.clone().json()) {
53
78
  const transport = processRequests(request, timeoutMs === 0 ? Number.POSITIVE_INFINITY : performance.now() + timeoutMs, init.signal);
@@ -5,7 +5,7 @@ import { _ as interactiveSessionStatusResponseSchema, d as awaitWithAbort, f as
5
5
  import { t as rewrapResponse } from "./response-rewrap-Bsj87BIq.js";
6
6
  import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-C92u8Kce.js";
7
7
  import { s as uploadChunked } from "./chunked-upload-CbtLVV6-.js";
8
- import { t as runPreparedProcess } from "./prepared-process-DuWP6Kb7.js";
8
+ import { t as runPreparedProcess } from "./prepared-process-DKgEUodb.js";
9
9
  import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-yr4ZESxY.js";
10
10
  import { n as SandboxLines } from "./lines-DgRXUg5y.js";
11
11
  import { z } from "zod";
@@ -1,2 +1,2 @@
1
- import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-BO2p4BNH.js";
1
+ import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-DTk-DEwj.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
@@ -1,5 +1,5 @@
1
1
  import { i as readResponseJson } from "./errors-Bs5G7JdV.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-DB-j-O2G.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-CYRnJ0bP.js";
3
3
  import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-C86i6t3C.js";
4
4
  //#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.68.4",
3
+ "version": "0.68.5",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -152,16 +152,16 @@
152
152
  "vitest": "^4.1.12",
153
153
  "ws": "^8.22.0",
154
154
  "yjs": "13.6.30",
155
- "@repo/shared": "0.0.0",
155
+ "@products/sandbox-test-utils": "0.0.0",
156
+ "@tangle-network/runtime-contracts": "0.19.0",
156
157
  "@tangle-network/agent-profile-materialize": "0.26.0",
158
+ "@repo/shared": "0.0.0",
157
159
  "@tangle-network/cli-agent-registry": "0.10.2",
158
- "@products/sandbox-test-utils": "0.0.0",
159
- "@tangle-network/sse-core": "0.0.0",
160
- "@tangle-network/runtime-contracts": "0.19.0"
160
+ "@tangle-network/sse-core": "0.0.0"
161
161
  },
162
162
  "tangleRelease": {
163
- "sourceSha": "7847faeb5e370d10a46adc3834f070932fa452a3",
164
- "mergedAt": "2026-10-26T03:23:00-06:00"
163
+ "sourceSha": "1bf4c19dc87aa2081d5cca1b9cd3305e5c109ba9",
164
+ "mergedAt": "2026-10-26T03:57:09-06:00"
165
165
  },
166
166
  "scripts": {
167
167
  "build": "node scripts/build-dist.mjs",