@tangle-network/sandbox 0.40.0 → 0.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/agent/index.js +4 -4
- package/dist/{client-BcIFgcPD.js → client-Cms_WYuk.js} +14 -4
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-CDvc5Hxk.js → collaboration-g2l-dEXt.js} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +3 -3
- package/dist/{errors-Cv3Td7LB.d.ts → errors-A7Quee1Y.d.ts} +24 -1
- package/dist/{errors-V6uPkjfJ.js → errors-yyl3f2Fc.js} +35 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/intelligence/index.js +1 -1
- package/dist/{runtime-api-CphOtyu8.js → runtime-api-BWVLRX-H.js} +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -2
- package/dist/{sandbox-ag2J5VWe.js → sandbox-CYpk0k3s.js} +3 -2
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CihgWU1K.js → tangle-azrClJHf.js} +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -299,6 +299,15 @@ This evidence does not exclude a sandbox from an earlier call with that key.
|
|
|
299
299
|
Cleanup may skip same-key recovery after `"not-admitted"` only when the key was fresh for this call.
|
|
300
300
|
Transport failures and unclassified responses remain uncertain; keep their recovery path.
|
|
301
301
|
|
|
302
|
+
Read `SandboxError.etaSeconds` when the control plane publishes one.
|
|
303
|
+
A capacity refusal can carry the cell's own estimate of when it expects to place a create again, measured from the host add already in flight.
|
|
304
|
+
Use it to schedule your next attempt.
|
|
305
|
+
It says nothing about whether this call admitted a sandbox, and it is not a retry hint: `retryAfterMs` alone paces the SDK's own attempts.
|
|
306
|
+
An absent value means the cell published no estimate, not that the wait is short.
|
|
307
|
+
|
|
308
|
+
`TimeoutError.timeoutMs` is the budget you set, not how long the call ran.
|
|
309
|
+
Read `TimeoutError.elapsedMs` for the duration: `create()` ends before its budget when a server-supplied `Retry-After` outlasts the remainder, because no attempt can follow that sleep.
|
|
310
|
+
|
|
302
311
|
## Commands and files
|
|
303
312
|
|
|
304
313
|
`exec()` returns the exit code, standard output, standard error, and timing data.
|
package/dist/agent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as assertCurrentBackendType } from "../runtime-api-
|
|
2
|
-
import { f as StateError, m as ValidationError, s as NotFoundError } from "../errors-
|
|
3
|
-
import { n as Sandbox } from "../client-
|
|
4
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
1
|
+
import { f as assertCurrentBackendType } from "../runtime-api-BWVLRX-H.js";
|
|
2
|
+
import { f as StateError, m as ValidationError, s as NotFoundError } from "../errors-yyl3f2Fc.js";
|
|
3
|
+
import { n as Sandbox } from "../client-Cms_WYuk.js";
|
|
4
|
+
import { t as SandboxInstance } from "../sandbox-CYpk0k3s.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
|
-
import { c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, l as encodeTextForWire, m as normalizeRuntimeBackendConfig, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, u as parseSSEStream, y as backendTypeSchema } from "./runtime-api-
|
|
2
|
-
import { c as PartialFailureError, d as ServerError, h as parseErrorResponse, m as ValidationError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
1
|
+
import { c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, l as encodeTextForWire, m as normalizeRuntimeBackendConfig, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, u as parseSSEStream, y as backendTypeSchema } from "./runtime-api-BWVLRX-H.js";
|
|
2
|
+
import { c as PartialFailureError, d as ServerError, h as parseErrorResponse, m as ValidationError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-yyl3f2Fc.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-CYpk0k3s.js";
|
|
5
5
|
import { agentProfileSchema } from "@tangle-network/agent-interface";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/backend-registry.ts
|
|
@@ -2820,7 +2820,17 @@ var Sandbox = class {
|
|
|
2820
2820
|
});
|
|
2821
2821
|
let lastServerError;
|
|
2822
2822
|
let allPreviousCreateAttemptsRefused = true;
|
|
2823
|
-
const createTimeoutError = () =>
|
|
2823
|
+
const createTimeoutError = () => {
|
|
2824
|
+
const etaSeconds = lastServerError?.etaSeconds;
|
|
2825
|
+
const elapsedMs = Date.now() - startedAt;
|
|
2826
|
+
const metadata = { elapsedMs };
|
|
2827
|
+
if (allPreviousCreateAttemptsRefused && lastServerError?.createFailureDisposition === "not-admitted") metadata.createFailureDisposition = "not-admitted";
|
|
2828
|
+
if (etaSeconds !== void 0) metadata.etaSeconds = etaSeconds;
|
|
2829
|
+
const spentBudget = elapsedMs >= timeoutMs;
|
|
2830
|
+
const preamble = spentBudget ? `Sandbox create did not complete within ${timeoutMs}ms. ` : `Sandbox create ended after ${elapsedMs}ms of its ${timeoutMs}ms budget. `;
|
|
2831
|
+
const earlyExit = spentBudget || lastServerError?.retryAfterMs === void 0 ? "" : `The server asked for a ${Math.ceil(lastServerError.retryAfterMs / 1e3)}s wait, which the remaining budget cannot cover. `;
|
|
2832
|
+
return new TimeoutError(timeoutMs, preamble + (lastServerError ? `The last attempt failed with ${lastServerError.code}${lastServerError.status === void 0 ? "" : ` (HTTP ${lastServerError.status})`}: ${lastServerError.message}. ` : "") + earlyExit + `The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it.` + (etaSeconds === void 0 ? "" : ` The cell expects capacity in about ${etaSeconds}s.`), metadata, lastServerError);
|
|
2833
|
+
};
|
|
2824
2834
|
const sleepBeforeRetry = async (delayMs) => {
|
|
2825
2835
|
try {
|
|
2826
2836
|
await waitForCreateRetry(delayMs, postSignal);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-
|
|
1
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-g2l-dEXt.js";
|
|
2
2
|
export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as parseErrorResponse, o as NetworkError, p as TimeoutError } from "./errors-
|
|
1
|
+
import { h as parseErrorResponse, o as NetworkError, p as TimeoutError } from "./errors-yyl3f2Fc.js";
|
|
2
2
|
//#region src/collaboration/client.ts
|
|
3
3
|
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
4
4
|
function normalizeBaseUrl(url) {
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as WorkspaceImagePublishRequestOptions, i as WorkspaceImagePublishInput, o as WorkspaceImagePublishResult, r as SandboxInstance, s as WorkspaceImages } from "./sandbox-D0AkGWdW.js";
|
|
2
2
|
import { Cn as PreviewLinkWaitOptions, Mn as PromptInputPart, R as CreateSandboxOptions, Sn as PreviewLinkManager, Vr as SandboxInfo, Yr as SandboxStatus, ar as SandboxConfig, dt as ExecResult, gn as NetworkConfig, ut as ExecOptions, xn as PreviewLinkInfo } from "./types-BzoZ0J0y.js";
|
|
3
3
|
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, b as backendRegistryEntrySchema, g as BackendRegistryEntry, h as BackendRegistryCapabilities, i as Sandbox, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-DrnwHShd.js";
|
|
4
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
4
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-A7Quee1Y.js";
|
|
5
5
|
export { AuthError, type BackendRegistryCapabilities, type BackendRegistryEntry, type BackendRegistryInteractionKind, type BackendRegistryResponse, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, FileWriteConflictError, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, type PreviewLinkWaitOptions, type PromptInputPart, QuotaError, Sandbox, type SandboxConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError, type WorkspaceImagePublishInput, type WorkspaceImagePublishRequestOptions, type WorkspaceImagePublishResult, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, isBackendRegistryInteractionKind, parseBackendRegistryResponse, parseBackendRegistryResponseBody };
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
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-
|
|
1
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-yyl3f2Fc.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-Cms_WYuk.js";
|
|
3
|
+
import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-CYpk0k3s.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 };
|
|
@@ -22,6 +22,15 @@ declare class SandboxError extends Error {
|
|
|
22
22
|
readonly sidecarVersion?: string;
|
|
23
23
|
/** Sidecar image/tag/sha when the runtime emitted it */
|
|
24
24
|
readonly containerImage?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Seconds the control plane expects to need before it can serve this
|
|
27
|
+
* request, when it published one. Today only a capacity refusal on create
|
|
28
|
+
* carries it: the cell sizes it from the host add already in flight plus
|
|
29
|
+
* the measured p95 host-birth time, so it is a real wait, not a backoff
|
|
30
|
+
* hint. `retryAfterMs` paces the SDK's own retry; this is the number to
|
|
31
|
+
* show a human or feed to a scheduler.
|
|
32
|
+
*/
|
|
33
|
+
readonly etaSeconds?: number;
|
|
25
34
|
/**
|
|
26
35
|
* On create's top-level error, proves this call's attempts admitted no
|
|
27
36
|
* sandbox. Absence is unknown. Earlier errors in `cause` describe only
|
|
@@ -38,6 +47,9 @@ interface SandboxErrorMetadata {
|
|
|
38
47
|
retryAfterMs?: number;
|
|
39
48
|
sidecarVersion?: string;
|
|
40
49
|
containerImage?: string;
|
|
50
|
+
etaSeconds?: number;
|
|
51
|
+
/** How long the operation ran, for a TimeoutError that measured it. */
|
|
52
|
+
elapsedMs?: number;
|
|
41
53
|
createFailureDisposition?: "not-admitted";
|
|
42
54
|
}
|
|
43
55
|
type SandboxErrorJson = string | number | boolean | null | {
|
|
@@ -134,8 +146,19 @@ declare class EgressProxyRecoveryError extends SandboxError {
|
|
|
134
146
|
* The request timed out.
|
|
135
147
|
*/
|
|
136
148
|
declare class TimeoutError extends SandboxError {
|
|
137
|
-
/**
|
|
149
|
+
/** The operation's configured budget, in milliseconds. NOT how long it ran. */
|
|
138
150
|
readonly timeoutMs: number;
|
|
151
|
+
/**
|
|
152
|
+
* How long the operation actually ran before this error, in milliseconds,
|
|
153
|
+
* when the thrower measured it.
|
|
154
|
+
*
|
|
155
|
+
* `create()` can end before its budget: when a server-supplied `Retry-After`
|
|
156
|
+
* outlasts the remaining budget, no further attempt can follow that sleep,
|
|
157
|
+
* so the create ends there rather than idling. Reading `timeoutMs` as the
|
|
158
|
+
* duration would record a two-minute timeout for a three-second refusal.
|
|
159
|
+
* Absent means the thrower did not measure it; it never means `timeoutMs`.
|
|
160
|
+
*/
|
|
161
|
+
readonly elapsedMs?: number;
|
|
139
162
|
/**
|
|
140
163
|
* The last typed failure the operation had already received when the
|
|
141
164
|
* deadline fired, when there was one.
|
|
@@ -23,6 +23,15 @@ var SandboxError = class extends Error {
|
|
|
23
23
|
/** Sidecar image/tag/sha when the runtime emitted it */
|
|
24
24
|
containerImage;
|
|
25
25
|
/**
|
|
26
|
+
* Seconds the control plane expects to need before it can serve this
|
|
27
|
+
* request, when it published one. Today only a capacity refusal on create
|
|
28
|
+
* carries it: the cell sizes it from the host add already in flight plus
|
|
29
|
+
* the measured p95 host-birth time, so it is a real wait, not a backoff
|
|
30
|
+
* hint. `retryAfterMs` paces the SDK's own retry; this is the number to
|
|
31
|
+
* show a human or feed to a scheduler.
|
|
32
|
+
*/
|
|
33
|
+
etaSeconds;
|
|
34
|
+
/**
|
|
26
35
|
* On create's top-level error, proves this call's attempts admitted no
|
|
27
36
|
* sandbox. Absence is unknown. Earlier errors in `cause` describe only
|
|
28
37
|
* their attempt prefix, not subsequent attempts or earlier calls using
|
|
@@ -39,6 +48,7 @@ var SandboxError = class extends Error {
|
|
|
39
48
|
this.retryAfterMs = metadata?.retryAfterMs;
|
|
40
49
|
this.sidecarVersion = metadata?.sidecarVersion;
|
|
41
50
|
this.containerImage = metadata?.containerImage;
|
|
51
|
+
this.etaSeconds = metadata?.etaSeconds;
|
|
42
52
|
this.createFailureDisposition = metadata?.createFailureDisposition;
|
|
43
53
|
}
|
|
44
54
|
};
|
|
@@ -174,9 +184,20 @@ var EgressProxyRecoveryError = class extends SandboxError {
|
|
|
174
184
|
* The request timed out.
|
|
175
185
|
*/
|
|
176
186
|
var TimeoutError = class extends SandboxError {
|
|
177
|
-
/**
|
|
187
|
+
/** The operation's configured budget, in milliseconds. NOT how long it ran. */
|
|
178
188
|
timeoutMs;
|
|
179
189
|
/**
|
|
190
|
+
* How long the operation actually ran before this error, in milliseconds,
|
|
191
|
+
* when the thrower measured it.
|
|
192
|
+
*
|
|
193
|
+
* `create()` can end before its budget: when a server-supplied `Retry-After`
|
|
194
|
+
* outlasts the remaining budget, no further attempt can follow that sleep,
|
|
195
|
+
* so the create ends there rather than idling. Reading `timeoutMs` as the
|
|
196
|
+
* duration would record a two-minute timeout for a three-second refusal.
|
|
197
|
+
* Absent means the thrower did not measure it; it never means `timeoutMs`.
|
|
198
|
+
*/
|
|
199
|
+
elapsedMs;
|
|
200
|
+
/**
|
|
180
201
|
* The last typed failure the operation had already received when the
|
|
181
202
|
* deadline fired, when there was one.
|
|
182
203
|
*
|
|
@@ -192,6 +213,7 @@ var TimeoutError = class extends SandboxError {
|
|
|
192
213
|
super(message ?? `Request timed out after ${timeoutMs}ms`, "TIMEOUT", 408, metadata);
|
|
193
214
|
this.name = "TimeoutError";
|
|
194
215
|
this.timeoutMs = timeoutMs;
|
|
216
|
+
this.elapsedMs = metadata?.elapsedMs;
|
|
195
217
|
this.cause = cause;
|
|
196
218
|
}
|
|
197
219
|
};
|
|
@@ -228,6 +250,17 @@ function parseRetryAfterMs(rawValue, data) {
|
|
|
228
250
|
const targetTs = Date.parse(trimmed);
|
|
229
251
|
if (!Number.isNaN(targetTs)) return Math.max(0, targetTs - Date.now());
|
|
230
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* The server's published wait, in seconds. Only a positive finite number is
|
|
255
|
+
* a wait; anything else is absent. Never derived from `Retry-After` — that
|
|
256
|
+
* header is a pacing hint every refusal carries, while `etaSeconds` is a
|
|
257
|
+
* measurement the cell only publishes when it has one.
|
|
258
|
+
*/
|
|
259
|
+
function parseEtaSeconds(data) {
|
|
260
|
+
const raw = data.etaSeconds;
|
|
261
|
+
if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return;
|
|
262
|
+
return raw;
|
|
263
|
+
}
|
|
231
264
|
function inferOrigin(headers, context) {
|
|
232
265
|
const derivedPath = context?.path ?? headers?.get("x-tangle-request-path") ?? void 0;
|
|
233
266
|
if (!headers) return context?.path ? "sandbox-api" : void 0;
|
|
@@ -317,6 +350,7 @@ function parseErrorResponse(status, body, context, headers) {
|
|
|
317
350
|
origin: inferOrigin(headers, context),
|
|
318
351
|
endpoint: context?.path ?? headers?.get("x-tangle-request-path") ?? void 0,
|
|
319
352
|
retryAfterMs: parseRetryAfterMs(headers?.get("retry-after") ?? void 0, data),
|
|
353
|
+
etaSeconds: parseEtaSeconds(data),
|
|
320
354
|
sidecarVersion: headers?.get("x-sidecar-version") ?? void 0,
|
|
321
355
|
containerImage: headers?.get("x-sidecar-image") ?? headers?.get("x-sidecar-image-tag") ?? void 0,
|
|
322
356
|
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
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { $ as DurablePlanDecisionResult, $i as UploadProgress, $n as RolloutScor
|
|
|
5
5
|
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, a as Team, b as backendRegistryEntrySchema, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, g as BackendRegistryEntry, h as BackendRegistryCapabilities, i as Sandbox, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-DrnwHShd.js";
|
|
6
6
|
import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-CS-t6tPU.js";
|
|
7
7
|
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-BzAxTiqF.js";
|
|
8
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, i as EgressProxyRecoveryError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, r as EdgeNotReadyError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
8
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, i as EgressProxyRecoveryError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, r as EdgeNotReadyError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-A7Quee1Y.js";
|
|
9
9
|
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-BurKaZq4.js";
|
|
10
10
|
import { o as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-BpaR6oyX.js";
|
|
11
11
|
import * as _$_tangle_network_agent_interface0 from "@tangle-network/agent-interface";
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { _ as deriveAgentRunOutcome, b as parseBackendType, g as deriveAgentResultOutcome, h as createAgentRunOutcomeTracker, m as normalizeRuntimeBackendConfig, u as parseSSEStream, v as ALL_BACKEND_TYPES, y as backendTypeSchema } from "./runtime-api-
|
|
2
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, i as EgressProxyRecoveryError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, r as EdgeNotReadyError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
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-
|
|
1
|
+
import { _ as deriveAgentRunOutcome, b as parseBackendType, g as deriveAgentResultOutcome, h as createAgentRunOutcomeTracker, m as normalizeRuntimeBackendConfig, u as parseSSEStream, v as ALL_BACKEND_TYPES, y as backendTypeSchema } from "./runtime-api-BWVLRX-H.js";
|
|
2
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, i as EgressProxyRecoveryError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, r as EdgeNotReadyError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-yyl3f2Fc.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-Cms_WYuk.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-
|
|
6
|
-
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-
|
|
7
|
-
import { t as TangleSandboxClient } from "./tangle-
|
|
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-CYpk0k3s.js";
|
|
6
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-g2l-dEXt.js";
|
|
7
|
+
import { t as TangleSandboxClient } from "./tangle-azrClJHf.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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as parseErrorResponse, o as NetworkError, p as TimeoutError } from "../errors-
|
|
1
|
+
import { h as parseErrorResponse, o as NetworkError, p as TimeoutError } from "../errors-yyl3f2Fc.js";
|
|
2
2
|
//#region src/intelligence/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as ServerError, h as parseErrorResponse, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, u as SandboxError } from "./errors-
|
|
1
|
+
import { d as ServerError, h as parseErrorResponse, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, u as SandboxError } from "./errors-yyl3f2Fc.js";
|
|
2
2
|
import { n as combineAbortSignals } from "./abort-signal-si1WMfJb.js";
|
|
3
3
|
import { AgentExactRunControlRefSchema, AgentExecutionOutcomeSchema, AgentRuntimeAttachmentsSchema, DurablePlanSchema, InteractionRequestSchema, agentProfileSchema, harnessTypeSchema } from "@tangle-network/agent-interface";
|
|
4
4
|
import { z } from "zod";
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $i as UploadProgress, $r as SandboxTerminalManager, A as CommitTaskSessionOptions, B as CreateTaskSessionOptions, Ci as SessionMessage, Ct as FileUsageResult, Jr as SandboxRuntimeHealth, Qr as SandboxTerminalInfo, Ri as TaskSessionChanges, St as FileUsageOptions, T as ChunkedUploadResult, Ur as SandboxPortBinding, Vi as TaskSessionInfo, Zr as SandboxTerminalCreateOptions, _i as SessionExecutionStatus, _t as FileRenameResult, bi as SessionInfo, bt as FileTreeOptions, di as SendSessionMessageOptions, ei as SandboxTerminalRequestOptions, fi as SendSessionMessageRequest, fr as SandboxEvent, gi as SessionExecutionInfo, hi as SessionEventStreamOptions, ia as WriteFileOptions, ln as ListMessagesOptions, mt as FileReadBatchResult, pi as SentSessionMessage, pt as FileReadBatchOptions, qn as RenameOptions, w as ChunkedUploadOptions, wt as FileWriteResult, xt as FileTreeResult, z as CreateSessionOptions, zi as TaskSessionCommitResult } from "./types-BzoZ0J0y.js";
|
|
2
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
2
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-A7Quee1Y.js";
|
|
3
3
|
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-BurKaZq4.js";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/chunked-upload.d.ts
|
package/dist/runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as deriveAgentRunOutcome, a as uploadChunked, g as deriveAgentResultOutcome, h as createAgentRunOutcomeTracker, t as SandboxRuntimeApi } from "./runtime-api-
|
|
2
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
1
|
+
import { _ as deriveAgentRunOutcome, a as uploadChunked, g as deriveAgentResultOutcome, h as createAgentRunOutcomeTracker, t as SandboxRuntimeApi } from "./runtime-api-BWVLRX-H.js";
|
|
2
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-yyl3f2Fc.js";
|
|
3
3
|
import { n as combineAbortSignals } from "./abort-signal-si1WMfJb.js";
|
|
4
4
|
//#region src/runtime-client.ts
|
|
5
5
|
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as uploadChunked, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, g as deriveAgentResultOutcome, h as createAgentRunOutcomeTracker, i as sessionHeaders, m as normalizeRuntimeBackendConfig, n as normalizeSessionInfo, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as mergeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi, u as parseSSEStream } from "./runtime-api-
|
|
2
|
-
import { d as ServerError, f as StateError, h as parseErrorResponse, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, r as EdgeNotReadyError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
1
|
+
import { a as uploadChunked, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, g as deriveAgentResultOutcome, h as createAgentRunOutcomeTracker, i as sessionHeaders, m as normalizeRuntimeBackendConfig, n as normalizeSessionInfo, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as mergeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi, u as parseSSEStream } from "./runtime-api-BWVLRX-H.js";
|
|
2
|
+
import { d as ServerError, f as StateError, h as parseErrorResponse, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, r as EdgeNotReadyError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-yyl3f2Fc.js";
|
|
3
3
|
import { c as createInteractiveControlHolderId, d as interactiveSessionControlReleaseResponseSchema, f as interactiveSessionControlValidationResponseSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, p as interactiveSessionStatusResponseSchema, r as browserInteractiveTerminalEndpoint, s as assertInteractiveSessionRef, u as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-Dv0gbFMu.js";
|
|
4
4
|
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-si1WMfJb.js";
|
|
5
5
|
import { AgentExactRunControlRefSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, exactAgentInteractiveSessionStart, sha256DigestSchema, terminalSessionUsable } from "@tangle-network/agent-interface";
|
|
@@ -6586,6 +6586,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
6586
6586
|
const status = await response.json();
|
|
6587
6587
|
if (status.status === "failed" || status.result?.success === false) throw new ServerError(status.result?.error ?? `Snapshot restore job ${accepted.jobId} failed`);
|
|
6588
6588
|
if (status.status === "completed") {
|
|
6589
|
+
this.applyLifecycleResponse(status.sandbox ?? null);
|
|
6589
6590
|
const restored = status.result?.snapshot;
|
|
6590
6591
|
if (restored) return {
|
|
6591
6592
|
snapshotId: restored.snapshotId,
|
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-azrClJHf.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
|
-
import { h as parseErrorResponse } from "./errors-
|
|
2
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { h as parseErrorResponse } from "./errors-yyl3f2Fc.js";
|
|
2
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-CYpk0k3s.js";
|
|
3
3
|
//#region src/tangle/abi.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tangle Contract ABI Definitions
|