@tangle-network/sandbox 0.38.0 → 0.38.1
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 +2 -2
- package/dist/{client-C6FuoHR4.js → client-mqBSqcXd.js} +1 -1
- package/dist/core.js +2 -2
- package/dist/index.js +3 -3
- package/dist/{sandbox-CVj0AN5M.js → sandbox-mTNH1V-j.js} +29 -2
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-3FFO8aMq.js → tangle-DtOSgw8n.js} +1 -1
- package/package.json +1 -1
package/dist/agent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { f as assertCurrentBackendType } from "../runtime-api-BcLo4lBU.js";
|
|
2
2
|
import { d as StateError, o as NotFoundError, p as ValidationError } from "../errors-C6kn-3zt.js";
|
|
3
|
-
import { n as Sandbox } from "../client-
|
|
4
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
3
|
+
import { n as Sandbox } from "../client-mqBSqcXd.js";
|
|
4
|
+
import { t as SandboxInstance } from "../sandbox-mTNH1V-j.js";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
//#region src/agent/instances.ts
|
|
7
7
|
const managers = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as backendTypeSchema, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, l as encodeTextForWire, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, u as parseSSEStream } from "./runtime-api-BcLo4lBU.js";
|
|
2
2
|
import { a as NetworkError, f as TimeoutError, l as SandboxError, m as parseErrorResponse, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
|
|
3
3
|
import { n as combineAbortSignals } from "./abort-signal-si1WMfJb.js";
|
|
4
|
-
import { E as normalizeConnection, O as exportTraceBundle, b as requestInteractiveSessionToken, i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt } from "./sandbox-
|
|
4
|
+
import { E as normalizeConnection, O as exportTraceBundle, b as requestInteractiveSessionToken, i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt } from "./sandbox-mTNH1V-j.js";
|
|
5
5
|
import { agentProfileSchema } from "@tangle-network/agent-interface";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/backend-registry.ts
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
|
|
2
|
-
import { _ as parseBackendRegistryResponse, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, p as backendRegistryEntrySchema, v as parseBackendRegistryResponseBody } from "./client-
|
|
3
|
-
import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-
|
|
2
|
+
import { _ as parseBackendRegistryResponse, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, p as backendRegistryEntrySchema, v as parseBackendRegistryResponseBody } from "./client-mqBSqcXd.js";
|
|
3
|
+
import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-mTNH1V-j.js";
|
|
4
4
|
export { AuthError, CapabilityError, FileWriteConflictError, NetworkError, NotFoundError, PartialFailureError, QuotaError, Sandbox, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, isBackendRegistryInteractionKind, parseBackendRegistryResponse, parseBackendRegistryResponseBody };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _ as backendTypeSchema, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, p as normalizeRuntimeBackendConfig, u as parseSSEStream, v as parseBackendType } from "./runtime-api-BcLo4lBU.js";
|
|
2
2
|
import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, r as EgressProxyRecoveryError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
|
|
3
|
-
import { _ as parseBackendRegistryResponse, a as splitInlineProfileSkills, c as SandboxFleetClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as splitInlineProfileFileMounts, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryEntrySchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-
|
|
3
|
+
import { _ as parseBackendRegistryResponse, a as splitInlineProfileSkills, c as SandboxFleetClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as splitInlineProfileFileMounts, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryEntrySchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-mqBSqcXd.js";
|
|
4
4
|
import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, c as createInteractiveControlHolderId, l as interactiveSessionIdentityDigest, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-Dv0gbFMu.js";
|
|
5
|
-
import { A as toOtelJson, C as collectAgentResponseText, D as buildTraceExportPayload, O as exportTraceBundle, S as collectAgentFinalMessageText, T as isToolBearingEvent, _ as TerminalStream, a as WorkspaceImages, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as InteractiveTerminalFrameLog, g as InteractiveSessionController, h as BrowserInteractiveSessionController, k as otelTraceIdForTangleTrace, l as SandboxSession, m as createInteractiveTerminalSession, o as GPU_LEASE_PROVIDER_NAMES, p as createInteractiveTerminalCapture, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as TerminalStreamError, w as getSandboxEventText, x as applySandboxEventText, y as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./sandbox-
|
|
5
|
+
import { A as toOtelJson, C as collectAgentResponseText, D as buildTraceExportPayload, O as exportTraceBundle, S as collectAgentFinalMessageText, T as isToolBearingEvent, _ as TerminalStream, a as WorkspaceImages, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as InteractiveTerminalFrameLog, g as InteractiveSessionController, h as BrowserInteractiveSessionController, k as otelTraceIdForTangleTrace, l as SandboxSession, m as createInteractiveTerminalSession, o as GPU_LEASE_PROVIDER_NAMES, p as createInteractiveTerminalCapture, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as TerminalStreamError, w as getSandboxEventText, x as applySandboxEventText, y as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./sandbox-mTNH1V-j.js";
|
|
6
6
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DQD9kCdN.js";
|
|
7
|
-
import { t as TangleSandboxClient } from "./tangle-
|
|
7
|
+
import { t as TangleSandboxClient } from "./tangle-DtOSgw8n.js";
|
|
8
8
|
import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
//#region src/confidential.ts
|
|
@@ -3305,7 +3305,24 @@ function normalizePreviewLink(raw) {
|
|
|
3305
3305
|
};
|
|
3306
3306
|
}
|
|
3307
3307
|
const SNAPSHOT_RESTORE_POLL_INTERVAL_MS = 1e3;
|
|
3308
|
+
const SNAPSHOT_RESTORE_FIRST_POLL_INTERVAL_MS = 200;
|
|
3309
|
+
const SNAPSHOT_RESTORE_POLL_GROWTH = 1.6;
|
|
3308
3310
|
const SNAPSHOT_RESTORE_TIMEOUT_MS = 600 * 1e3;
|
|
3311
|
+
/**
|
|
3312
|
+
* How long to wait before the next restore-job status read.
|
|
3313
|
+
*
|
|
3314
|
+
* A flat 1 s cadence holds a finished restore for half a second on average.
|
|
3315
|
+
* A production restore of a small workspace takes ~5 s (measured 2026-09-07:
|
|
3316
|
+
* job `durationMs` 5112 against sandbox.tangle.tools), so that half second is
|
|
3317
|
+
* real time the caller waits after the work is done. Backing off from 200 ms
|
|
3318
|
+
* to the same 1 s ceiling narrows the window near the end of a short restore
|
|
3319
|
+
* while leaving a long cross-host restore at one request per second — the
|
|
3320
|
+
* poll rate is bounded by the ceiling, not by the starting interval.
|
|
3321
|
+
*/
|
|
3322
|
+
function nextRestorePollDelayMs(pollsTaken) {
|
|
3323
|
+
const delay = SNAPSHOT_RESTORE_FIRST_POLL_INTERVAL_MS * SNAPSHOT_RESTORE_POLL_GROWTH ** pollsTaken;
|
|
3324
|
+
return Math.min(Math.round(delay), SNAPSHOT_RESTORE_POLL_INTERVAL_MS);
|
|
3325
|
+
}
|
|
3309
3326
|
const SNAPSHOT_VISIBILITY_POLL_INTERVAL_MS = 1e3;
|
|
3310
3327
|
const SNAPSHOT_VISIBILITY_TIMEOUT_MS = 120 * 1e3;
|
|
3311
3328
|
const EXEC_DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -6553,6 +6570,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
6553
6570
|
}
|
|
6554
6571
|
async waitForSnapshotRestore(snapshotId, accepted) {
|
|
6555
6572
|
const deadline = Date.now() + SNAPSHOT_RESTORE_TIMEOUT_MS;
|
|
6573
|
+
let polls = 0;
|
|
6556
6574
|
while (Date.now() < deadline) {
|
|
6557
6575
|
const response = await this.client.fetch(`/v1/sandboxes/${this.id}/snapshots/jobs/${encodeURIComponent(accepted.jobId)}`);
|
|
6558
6576
|
if (!response.ok) {
|
|
@@ -6561,8 +6579,17 @@ var SandboxInstance = class SandboxInstance {
|
|
|
6561
6579
|
}
|
|
6562
6580
|
const status = await response.json();
|
|
6563
6581
|
if (status.status === "failed" || status.result?.success === false) throw new ServerError(status.result?.error ?? `Snapshot restore job ${accepted.jobId} failed`);
|
|
6564
|
-
if (status.status === "completed")
|
|
6565
|
-
|
|
6582
|
+
if (status.status === "completed") {
|
|
6583
|
+
const restored = status.result?.snapshot;
|
|
6584
|
+
if (restored) return {
|
|
6585
|
+
snapshotId: restored.snapshotId,
|
|
6586
|
+
createdAt: new Date(restored.createdAt),
|
|
6587
|
+
...restored.sizeBytes === void 0 ? {} : { sizeBytes: restored.sizeBytes },
|
|
6588
|
+
tags: restored.tags
|
|
6589
|
+
};
|
|
6590
|
+
return await this.waitForSnapshotVisible(snapshotId, status.completedAt ? { createdAt: new Date(status.completedAt) } : void 0);
|
|
6591
|
+
}
|
|
6592
|
+
await this.sleep(nextRestorePollDelayMs(polls++));
|
|
6566
6593
|
}
|
|
6567
6594
|
throw new TimeoutError(SNAPSHOT_RESTORE_TIMEOUT_MS);
|
|
6568
6595
|
}
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TANGLE_JOBS_CONTRACT, c as JsonResponseParamTypes, d as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as SandboxCreateParamTypes, n as JOB_SANDBOX_CREATE, o as AgentSandboxBlueprintAbi, r as JOB_SANDBOX_DELETE, s as ITangleJobsAbi, t as TangleSandboxClient, u as SandboxCreateResponseParamTypes } from "../tangle-
|
|
1
|
+
import { a as TANGLE_JOBS_CONTRACT, c as JsonResponseParamTypes, d as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as SandboxCreateParamTypes, n as JOB_SANDBOX_CREATE, o as AgentSandboxBlueprintAbi, r as JOB_SANDBOX_DELETE, s as ITangleJobsAbi, t as TangleSandboxClient, u as SandboxCreateResponseParamTypes } from "../tangle-DtOSgw8n.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as parseErrorResponse } from "./errors-C6kn-3zt.js";
|
|
2
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
2
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-mTNH1V-j.js";
|
|
3
3
|
//#region src/tangle/abi.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tangle Contract ABI Definitions
|