@tangle-network/sandbox 1.0.227 → 1.0.229
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/dist/agent/index.js +3 -3
- package/dist/agent/preview.js +1 -1
- package/dist/{api-request-DAMolfQm.js → api-request-R5BPlCWF.js} +3 -11
- package/dist/{client-N_8CWdqL.js → client-B8uFdQlc.js} +2 -2
- package/dist/{core-DsNYbjSI.js → core-BFz8ZTMJ.js} +1 -1
- package/dist/core.js +3 -3
- package/dist/index.js +4 -4
- package/dist/intelligence/index.js +1 -1
- package/dist/lib/prepared-process.js +1 -1
- package/dist/{mcp-local-BX4gcjCi.js → mcp-local-B6lqJ8Kn.js} +2 -2
- package/dist/{prepared-process-CWf84BFt.js → prepared-process-u1B0b94R.js} +16 -14
- package/dist/runtime.js +1 -1
- package/dist/{sandbox-6obDW_Le.js → sandbox-D2UN9qAM.js} +2 -2
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-COq1ajA9.js → tangle-D406f8ne.js} +1 -1
- package/package.json +6 -6
package/dist/agent/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-
|
|
1
|
+
import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-B6lqJ8Kn.js";
|
|
2
2
|
import { O as assertCurrentBackendType } from "../interactive-controller-BjIkU_xj.js";
|
|
3
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
3
|
+
import { t as SandboxInstance } from "../sandbox-D2UN9qAM.js";
|
|
4
4
|
import { D as ValidationError, _ as NotFoundError, w as StateError } from "../errors-A-bhwwsE.js";
|
|
5
|
-
import { t as Sandbox } from "../client-
|
|
5
|
+
import { t as Sandbox } from "../client-B8uFdQlc.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/agent/instances.ts
|
|
8
8
|
const managers = /* @__PURE__ */ new WeakMap();
|
package/dist/agent/preview.js
CHANGED
|
@@ -66,7 +66,7 @@ async function servePreviewMcp(request, config) {
|
|
|
66
66
|
if (typeof config.authorize !== "function") throw new Error("Preview MCP requires a host authorization callback");
|
|
67
67
|
const tools = config.tools ?? PREVIEW_TOOLS;
|
|
68
68
|
if (!tools.length || tools.some((tool) => !PREVIEW_TOOLS.includes(tool))) throw new Error("Preview MCP requires an explicit nonempty preview-only tool grant");
|
|
69
|
-
const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-
|
|
69
|
+
const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-B6lqJ8Kn.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
|
|
70
70
|
const handle = await createMcpServer(config.box, {
|
|
71
71
|
name: "tangle-previews",
|
|
72
72
|
sessionId: config.sessionId,
|
|
@@ -29,7 +29,7 @@ function rewrapResponse(original, headers, body = original.body) {
|
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/lib/api-request.mjs
|
|
31
31
|
/** The package version tsdown.config.ts defines; unbuilt source reports 0.0.0. */
|
|
32
|
-
const SDK_VERSION = "1.0.
|
|
32
|
+
const SDK_VERSION = "1.0.229";
|
|
33
33
|
function withRequestContextHeaders(response, path, method, body = response.body) {
|
|
34
34
|
const headers = new Headers(response.headers);
|
|
35
35
|
headers.set("x-tangle-request-path", path);
|
|
@@ -61,16 +61,8 @@ function retryDelayMs(response, attempt, deadline) {
|
|
|
61
61
|
capMs: 4e3
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* the one place a transient failure is resent. A request safe to send twice
|
|
67
|
-
* (an idempotent method or an `Idempotency-Key`, a replayable body, no
|
|
68
|
-
* `x-no-retry`) goes again after a connection lost before any response, a
|
|
69
|
-
* 502-504, or a 429 with `Retry-After`: four attempts at most, inside the
|
|
70
|
-
* caller's one timeout. A dial whose connect phase failed reached nothing, so
|
|
71
|
-
* any replayable request without `x-no-retry` dials again on the same terms.
|
|
72
|
-
* A response is final once its headers arrive.
|
|
73
|
-
*/
|
|
64
|
+
/** SDK/probe transport retries replayable idempotent/keyed calls, or any verb after a proven failed dial.
|
|
65
|
+
* x-no-retry forbids replay; the caller deadline bounds attempts, and headers finalize an answer. */
|
|
74
66
|
async function fetchSandboxApi({ baseUrl, apiKey, timeoutMs = 3e4, signal, fetchImpl = fetch, networkError = (error) => error, timeoutError = () => new DOMException("The operation was aborted due to timeout", "TimeoutError") }, path, options, fetchOptions) {
|
|
75
67
|
const url = `${baseUrl.replace(/\/+$/, "")}${path}`;
|
|
76
68
|
const requestTimeoutMs = typeof fetchOptions?.timeoutMs === "number" && fetchOptions.timeoutMs > 0 ? fetchOptions.timeoutMs : timeoutMs;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { A as normalizeRuntimeBackendConfig, D as applyRequestedModel, E as isBrowserRuntime, H as backendTypeSchema, N as withProfileHarness, O as assertCurrentBackendType, P as withoutCreateOnlyModelFields, S as encodePromptForWire, o as requestInteractiveSessionToken } from "./interactive-controller-BjIkU_xj.js";
|
|
2
2
|
import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
3
|
-
import { $ as isCapacityShortageCreateError, B as normalizeConnection, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as normalizeSandboxCreateReceipt, G as CAPACITY_ETA_WAIT_MAX_MS, H as normalizeProxySecretReceipt, I as normalizeStartupDiagnostics, J as DEPLOY_WINDOW_RETRY_MS, O as isRetryableProfileFileMaterializeFailure, P as normalizeCaptureProof, Q as generateIdempotencyKey, R as dateOf, T as splitInlineProfileFileMounts, U as normalizeSandboxShape, V as normalizeEgressPolicyFields, W as CAPACITY_ETA_MARGIN_MS, X as createRetryDelayMs, Y as awaitCreateResend, Z as extendableDeadline, d as sandboxLedgerUsd, et as isDeployWindowCreateError, n as createSandboxInstanceFromResponse, nt as isRetryableCreateError, o as exportTraceBundle, tt as isRateLimitCreateError, z as parseLifecycleTimes } from "./sandbox-
|
|
3
|
+
import { $ as isCapacityShortageCreateError, B as normalizeConnection, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as normalizeSandboxCreateReceipt, G as CAPACITY_ETA_WAIT_MAX_MS, H as normalizeProxySecretReceipt, I as normalizeStartupDiagnostics, J as DEPLOY_WINDOW_RETRY_MS, O as isRetryableProfileFileMaterializeFailure, P as normalizeCaptureProof, Q as generateIdempotencyKey, R as dateOf, T as splitInlineProfileFileMounts, U as normalizeSandboxShape, V as normalizeEgressPolicyFields, W as CAPACITY_ETA_MARGIN_MS, X as createRetryDelayMs, Y as awaitCreateResend, Z as extendableDeadline, d as sandboxLedgerUsd, et as isDeployWindowCreateError, n as createSandboxInstanceFromResponse, nt as isRetryableCreateError, o as exportTraceBundle, tt as isRateLimitCreateError, z as parseLifecycleTimes } from "./sandbox-D2UN9qAM.js";
|
|
4
4
|
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, a as readResponseJson, g as NetworkError, i as parseResponseError, r as parseErrorResponse, s as AuthError, v as PartialFailureError } from "./errors-A-bhwwsE.js";
|
|
5
5
|
import { n as combineAbortSignals } from "./abort-signal-BbJTt2QJ.js";
|
|
6
6
|
import { r as abortableSleep, t as RETRY_POLICY } from "./retry-policy-Dh-VezcE.js";
|
|
7
7
|
import { l as SANDBOX_AGENT_HOME, t as isInsideReservedDir } from "./file-transfer-BSe4ayU9.js";
|
|
8
|
-
import { r as fetchSandboxApi } from "./api-request-
|
|
8
|
+
import { r as fetchSandboxApi } from "./api-request-R5BPlCWF.js";
|
|
9
9
|
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-BIaDMUtu.js";
|
|
10
10
|
import { t as parseSSEStream } from "./sse-parser-DOCszo1K.js";
|
|
11
11
|
import { t as LinesClient } from "./lines-7VecgiGd.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
2
|
-
import { rt as canonicalAgentProfileDigest } from "./sandbox-
|
|
2
|
+
import { rt as canonicalAgentProfileDigest } from "./sandbox-D2UN9qAM.js";
|
|
3
3
|
import { D as ValidationError, S as SandboxError, l as CapabilityError } from "./errors-A-bhwwsE.js";
|
|
4
4
|
import { t as awaitWithAbort } from "./abort-signal-BbJTt2QJ.js";
|
|
5
5
|
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-C6DtK7GX-BbbiAn-Z.js";
|
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-
|
|
1
|
+
import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-D2UN9qAM.js";
|
|
2
2
|
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, b as QuotaError, g as NetworkError, l as CapabilityError, p as FileWriteConflictError, r as parseErrorResponse, s as AuthError, v as PartialFailureError, w as StateError, y as ProfileFileMountPathError } from "./errors-A-bhwwsE.js";
|
|
3
|
-
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-
|
|
3
|
+
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-B8uFdQlc.js";
|
|
4
4
|
import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-7VecgiGd.js";
|
|
5
5
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
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-
|
|
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-BFz8ZTMJ.js";
|
|
7
7
|
export { AuthError, CapabilityError, FileWriteConflictError, HostedInstance, ISOLATED_CREATION_ATTESTATION_VERSION, InstanceRestartingError, InstancesClient, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, ProfileFileMountPathError, PublicTemplatePublishError, PublicTemplatesClient, QuotaError, Sandbox, SandboxError, SandboxInstance, SeatSelectionError, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, createSelectSeat, gatewaySeatTransport, isBackendRegistryInteractionKind, lineInstanceKey, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseErrorResponse, parseLineApplicationRequest, parseLineApplicationResult, profileChannelReference, sandboxFailureKind };
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { A as normalizeRuntimeBackendConfig, B as TERMINAL_WS_ECHO_SUBPROTOCOL, G as parseBackendType, H as backendTypeSchema, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, U as isolationPrincipalSchema, V as ALL_BACKEND_TYPES, i as terminalUpgradeHeadersSupported, j as requestedPublicProfileDigest, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as projectAgentTerminalRecord } from "./interactive-controller-BjIkU_xj.js";
|
|
2
2
|
import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, k as agentInteractiveSessionPromptRequestDigest, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-BiP6TJFP.js";
|
|
3
3
|
import { i as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-C1KpT-wS.js";
|
|
4
|
-
import { A as ProfileUnsupportedError, C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, M as isMaterializerHarness, N as materializeProfile, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, f as InteractiveSessionHandle, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, j as enforceWorkspacePlanSupport, k as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, 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-
|
|
4
|
+
import { A as ProfileUnsupportedError, C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, M as isMaterializerHarness, N as materializeProfile, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, f as InteractiveSessionHandle, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, j as enforceWorkspacePlanSupport, k as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, 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-D2UN9qAM.js";
|
|
5
5
|
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, T as StreamInterruptedError, _ as NotFoundError, b as QuotaError, c as BranchFanoutExceedsHostError, d as EdgeNotReadyError, f as EgressProxyRecoveryError, g as NetworkError, h as KeyBudgetExhaustedError, l as CapabilityError, m as GpuProviderNotConfiguredError, p as FileWriteConflictError, r as parseErrorResponse, s as AuthError, t as TerminalStreamError, u as CompliancePlacementError, v as PartialFailureError, w as StateError, x as ResumeEnvRequiredError, y as ProfileFileMountPathError } from "./errors-A-bhwwsE.js";
|
|
6
|
-
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-
|
|
6
|
+
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-B8uFdQlc.js";
|
|
7
7
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DZ8ptALs.js";
|
|
8
8
|
import "./file-transfer-BSe4ayU9.js";
|
|
9
9
|
import { t as parseSSEStream } from "./sse-parser-DOCszo1K.js";
|
|
10
10
|
import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-7VecgiGd.js";
|
|
11
11
|
import { t as downloadFile } from "./file-download-UhMKbMbD.js";
|
|
12
12
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
13
|
-
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-
|
|
14
|
-
import { s as BlueprintSandboxClient } from "./tangle-
|
|
13
|
+
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-BFz8ZTMJ.js";
|
|
14
|
+
import { s as BlueprintSandboxClient } from "./tangle-D406f8ne.js";
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
//#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
|
|
17
17
|
const MANAGED_MODEL_KEY_SENTINEL = "proxy-managed-per-request";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as TimeoutError, g as NetworkError, r as parseErrorResponse } from "../errors-A-bhwwsE.js";
|
|
2
|
-
import { r as fetchSandboxApi } from "../api-request-
|
|
2
|
+
import { r as fetchSandboxApi } from "../api-request-R5BPlCWF.js";
|
|
3
3
|
import { n as verifyDownload } from "../file-download-UhMKbMbD.js";
|
|
4
4
|
//#region src/intelligence/index.ts
|
|
5
5
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as withPreparedProcessCalls, t as runPreparedProcess } from "../prepared-process-
|
|
1
|
+
import { n as withPreparedProcessCalls, t as runPreparedProcess } from "../prepared-process-u1B0b94R.js";
|
|
2
2
|
export { runPreparedProcess, withPreparedProcessCalls };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-BSe4ayU9.js";
|
|
2
|
-
import "./api-request-
|
|
2
|
+
import "./api-request-R5BPlCWF.js";
|
|
3
3
|
import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-B3TTvqlm.js";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -396,7 +396,7 @@ async function createMcpServer(box, options = {}) {
|
|
|
396
396
|
const { bindings, handlers } = bindToolSpecs(box, options);
|
|
397
397
|
const server = new serverModule.Server({
|
|
398
398
|
name: options.name ?? "tangle-sandbox",
|
|
399
|
-
version: options.version ?? "1.0.
|
|
399
|
+
version: options.version ?? "1.0.229"
|
|
400
400
|
}, { capabilities: { tools: {} } });
|
|
401
401
|
server.setRequestHandler(typesModule.ListToolsRequestSchema, async () => ({ tools: bindings.map(({ spec: s }) => ({
|
|
402
402
|
name: s.name,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as parseSandboxRetryAfterHeader } from "./retry-after-header-DUdCC0KJ.js";
|
|
2
|
-
import { r as abortableSleep } from "./retry-policy-Dh-VezcE.js";
|
|
2
|
+
import { n as SANDBOX_API_RETRY_SCOPE, r as abortableSleep, s as planResend } from "./retry-policy-Dh-VezcE.js";
|
|
3
3
|
//#region src/lib/prepared-process.mjs
|
|
4
4
|
/** Request and pause share one deadline, including independent cancellation cleanup. */
|
|
5
5
|
function processRequests(request, deadline, signal) {
|
|
6
|
-
const remaining = (ceiling =
|
|
6
|
+
const remaining = (ceiling = Number.POSITIVE_INFINITY) => {
|
|
7
7
|
signal?.throwIfAborted();
|
|
8
8
|
const left = Math.floor(deadline - performance.now());
|
|
9
9
|
if (left <= 0) throw new Error("Process result timed out");
|
|
@@ -22,29 +22,33 @@ function processRequests(request, deadline, signal) {
|
|
|
22
22
|
}, Number.isFinite(left) ? left : 0);
|
|
23
23
|
};
|
|
24
24
|
const pause = (ms = POLL_DELAY_MIN_MS) => abortableSleep(Math.min(ms, remaining()), signal);
|
|
25
|
+
const retry = (response, attempt) => planResend(SANDBOX_API_RETRY_SCOPE, attempt, {
|
|
26
|
+
retryAfterMs: parseSandboxRetryAfterHeader(response.headers?.get?.("retry-after")),
|
|
27
|
+
deadlineAt: Date.now() + remaining()
|
|
28
|
+
});
|
|
25
29
|
return {
|
|
26
30
|
ask,
|
|
27
|
-
pause
|
|
31
|
+
pause,
|
|
32
|
+
retry,
|
|
33
|
+
remaining
|
|
28
34
|
};
|
|
29
35
|
}
|
|
30
36
|
const POLL_DELAY_MIN_MS = 250;
|
|
31
37
|
const POLL_DELAY_MAX_MS = 2e3;
|
|
32
|
-
/**
|
|
33
|
-
* Only the small pending receipt is parsed; terminal output stays streamed.
|
|
34
|
-
* Every poll spends the caller's runtime request budget (60 a minute on the
|
|
35
|
-
* smallest plan), so polls back off from 250 ms to 2 s, and a 429 is waited
|
|
36
|
-
* out: the process keeps running while the budget refills, and its result
|
|
37
|
-
* stays readable.
|
|
38
|
-
*/
|
|
39
38
|
async function pollPreparedProcess(transport, target, pid, headers, read) {
|
|
40
39
|
for (let poll = 0;; poll++) {
|
|
41
40
|
const response = await transport.ask(target, {
|
|
42
41
|
method: "GET",
|
|
43
42
|
headers
|
|
44
43
|
});
|
|
45
|
-
|
|
44
|
+
const failure = response.status === 503 ? await Promise.resolve(read(response)).catch(() => void 0) : void 0;
|
|
45
|
+
transport.remaining();
|
|
46
|
+
const restarting = (failure?.error?.code ?? failure?.code) === "HOST_AGENT_RESTARTING";
|
|
47
|
+
if (response.status === 429 || restarting) {
|
|
48
|
+
const delay = restarting ? transport.retry(response, poll + 1) : parseSandboxRetryAfterHeader(response.headers?.get?.("retry-after")) ?? pollDelayMs(poll);
|
|
49
|
+
if (delay === void 0) return response;
|
|
46
50
|
await response.body?.cancel?.();
|
|
47
|
-
await transport.pause(
|
|
51
|
+
await transport.pause(delay);
|
|
48
52
|
continue;
|
|
49
53
|
}
|
|
50
54
|
if (response.status !== 202) return response;
|
|
@@ -56,7 +60,6 @@ async function pollPreparedProcess(transport, target, pid, headers, read) {
|
|
|
56
60
|
function pollDelayMs(poll) {
|
|
57
61
|
return Math.min(POLL_DELAY_MIN_MS * 2 ** poll, POLL_DELAY_MAX_MS);
|
|
58
62
|
}
|
|
59
|
-
/** One prepare/PID/result transport for SDK, Worker adapters and Node probes. */
|
|
60
63
|
async function runPreparedProcess(request, path, init, timeoutMs = 75e3, read = (response) => response.clone().json()) {
|
|
61
64
|
const deadline = timeoutMs === 0 ? Number.POSITIVE_INFINITY : performance.now() + timeoutMs;
|
|
62
65
|
const transport = processRequests(request, deadline, init.signal);
|
|
@@ -94,7 +97,6 @@ async function runPreparedProcess(request, path, init, timeoutMs = 75e3, read =
|
|
|
94
97
|
throw error;
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
|
-
/** `promise`, or the caller's abort reason as soon as the caller aborts. */
|
|
98
100
|
function abortable(promise, signal) {
|
|
99
101
|
if (!signal) return promise;
|
|
100
102
|
let abort;
|
package/dist/runtime.js
CHANGED
|
@@ -2,7 +2,7 @@ import { I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as
|
|
|
2
2
|
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BiP6TJFP.js";
|
|
3
3
|
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, b as QuotaError, g as NetworkError, l as CapabilityError, p as FileWriteConflictError, s as AuthError, v as PartialFailureError, w as StateError, y as ProfileFileMountPathError } from "./errors-A-bhwwsE.js";
|
|
4
4
|
import { s as uploadChunked } from "./chunked-upload-BjkxykZD.js";
|
|
5
|
-
import { r as fetchSandboxApi } from "./api-request-
|
|
5
|
+
import { r as fetchSandboxApi } from "./api-request-R5BPlCWF.js";
|
|
6
6
|
//#region src/runtime-client.ts
|
|
7
7
|
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
8
8
|
function requireToken(token) {
|
|
@@ -8,11 +8,11 @@ import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-Bb
|
|
|
8
8
|
import { a as backoffDelayMs, o as isUndelivered, r as abortableSleep } from "./retry-policy-Dh-VezcE.js";
|
|
9
9
|
import { a as SANDBOX_PROXY_REQUEST_MAX_BYTES, c as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, d as isProfileFileMountOutsideRoots, f as profileFileMountOutsideRootsMessage, l as SANDBOX_AGENT_HOME, o as FILE_OPERATION_LIMITS, u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-BSe4ayU9.js";
|
|
10
10
|
import { c as awaitSdkResend, l as countSdkRequest, s as uploadChunked, u as takeSdkTurn } from "./chunked-upload-BjkxykZD.js";
|
|
11
|
-
import { a as rewrapResponse, i as isReplayableBody, t as IDEMPOTENT_METHODS } from "./api-request-
|
|
11
|
+
import { a as rewrapResponse, i as isReplayableBody, t as IDEMPOTENT_METHODS } from "./api-request-R5BPlCWF.js";
|
|
12
12
|
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-BIaDMUtu.js";
|
|
13
13
|
import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-DpBLxIof.js";
|
|
14
14
|
import { t as parseSSEStream } from "./sse-parser-DOCszo1K.js";
|
|
15
|
-
import { t as runPreparedProcess } from "./prepared-process-
|
|
15
|
+
import { t as runPreparedProcess } from "./prepared-process-u1B0b94R.js";
|
|
16
16
|
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-C6DtK7GX-BbbiAn-Z.js";
|
|
17
17
|
import "./cli-auth-bundle-CMJWI99l.js";
|
|
18
18
|
import { n as SandboxLines } from "./lines-7VecgiGd.js";
|
package/dist/tangle/index.js
CHANGED
|
@@ -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 BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-
|
|
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 BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-D406f8ne.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, BlueprintSandboxClient, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { L as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-D2UN9qAM.js";
|
|
2
2
|
import { a as readResponseJson } from "./errors-A-bhwwsE.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-CK-x8vXj.js";
|
|
4
4
|
//#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.229",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -154,14 +154,14 @@
|
|
|
154
154
|
"ws": "^8.22.0",
|
|
155
155
|
"yjs": "13.6.33",
|
|
156
156
|
"@products/sandbox-test-utils": "0.0.0",
|
|
157
|
-
"@repo/shared": "0.0.0",
|
|
158
157
|
"@tangle-network/agent-profile-materialize": "0.27.1",
|
|
159
|
-
"@tangle-network/
|
|
160
|
-
"@
|
|
158
|
+
"@tangle-network/runtime-contracts": "0.20.0",
|
|
159
|
+
"@repo/shared": "0.0.0",
|
|
160
|
+
"@tangle-network/cli-agent-registry": "0.15.0"
|
|
161
161
|
},
|
|
162
162
|
"tangleRelease": {
|
|
163
|
-
"sourceSha": "
|
|
164
|
-
"mergedAt": "2026-11-04T13:
|
|
163
|
+
"sourceSha": "0b7463e05b071a5ca5bcf0bde0a0600f5b07a5ef",
|
|
164
|
+
"mergedAt": "2026-11-04T13:50:35-08:00"
|
|
165
165
|
},
|
|
166
166
|
"scripts": {
|
|
167
167
|
"build": "node scripts/build-dist.mjs",
|