@tangle-network/sandbox 1.0.158 → 1.0.159
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/{abort-signal-CDxyloxz.js → abort-signal-Cu4F2VVz.js} +17 -1
- package/dist/agent/index.js +3 -3
- package/dist/{browser-interactive-control-controller-C6GiIQZF.js → browser-interactive-control-controller-BYbNLahH.js} +1 -1
- package/dist/{chunked-upload-B2pkukJb.js → chunked-upload-NjdTMC2n.js} +3 -17
- package/dist/{chunked-upload-file-NX0YqOUT.js → chunked-upload-file-Z-KNaobQ.js} +1 -1
- package/dist/{client-yBaVOUp7.js → client-Cgtoc5Qn.js} +23 -31
- package/dist/{core-Efr8vtcH.js → core-B7oXknE8.js} +2 -2
- package/dist/core.js +3 -3
- package/dist/index.js +6 -6
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-DtCtgN-m.js → interactive-controller-C3DDPykv.js} +5 -22
- package/dist/runtime.js +3 -3
- package/dist/{sandbox-D3A8ot08.js → sandbox-FbGj_5Fa.js} +38 -44
- package/dist/session-gateway/index.js +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-Bl0yNSPg.js → tangle-Dz_ibQVN.js} +1 -1
- package/package.json +5 -5
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
function combineAbortSignals(signals) {
|
|
3
3
|
return AbortSignal.any(signals);
|
|
4
4
|
}
|
|
5
|
+
/** Resolve after `ms`; reject with the signal's reason the moment it aborts. */
|
|
6
|
+
function abortableSleep(ms, signal) {
|
|
7
|
+
if (signal?.aborted) return Promise.reject(signal.reason);
|
|
8
|
+
if (ms <= 0) return Promise.resolve();
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const timer = setTimeout(() => {
|
|
11
|
+
signal?.removeEventListener("abort", onAbort);
|
|
12
|
+
resolve();
|
|
13
|
+
}, ms);
|
|
14
|
+
const onAbort = () => {
|
|
15
|
+
clearTimeout(timer);
|
|
16
|
+
reject(signal?.reason);
|
|
17
|
+
};
|
|
18
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
19
|
+
});
|
|
20
|
+
}
|
|
5
21
|
function awaitWithAbort(work, signal) {
|
|
6
22
|
if (!signal) return work;
|
|
7
23
|
signal.throwIfAborted();
|
|
@@ -43,4 +59,4 @@ const delayUntilAborted = (ms, signal) => new Promise((resolve, reject) => {
|
|
|
43
59
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
44
60
|
});
|
|
45
61
|
//#endregion
|
|
46
|
-
export {
|
|
62
|
+
export { delayUntilAborted as i, awaitWithAbort as n, combineAbortSignals as r, abortableSleep as t };
|
package/dist/agent/index.js
CHANGED
|
@@ -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-tBlLJqTb.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
2
|
+
import { O as assertCurrentBackendType } from "../interactive-controller-C3DDPykv.js";
|
|
3
|
+
import { t as SandboxInstance } from "../sandbox-FbGj_5Fa.js";
|
|
4
4
|
import { C as StateError, E as ValidationError, g as NotFoundError } from "../errors-BUzH7U1D.js";
|
|
5
|
-
import { t as Sandbox } from "../client-
|
|
5
|
+
import { t as Sandbox } from "../client-Cgtoc5Qn.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/agent/instances.ts
|
|
8
8
|
const managers = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as boundedIdentifierSchema, D as isBoundedEventContentJson, E as boundedStringSchema, S as boundedEventContentStringSchema, T as boundedJsonSchema, _ as CONTRACT_MAX_ARRAY_LENGTH, b as boundedEventContentJsonSchema, g as sha256DigestSchema, h as omitTopLevelDigest, m as looksLikeCredential, n as REASONING_EFFORTS, o as canonicalCandidateDigest, p as isWellFormedUnicode, s as canonicalCandidateJson, t as harnessTypeSchema, u as isCanonicalJsonValue, w as boundedJsonRecordSchema, x as boundedEventContentRecordSchema, y as CONTRACT_MAX_STRING_LENGTH } from "./harness-DMaNgn0S.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n as awaitWithAbort } from "./abort-signal-Cu4F2VVz.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/native-session-event.js
|
|
5
5
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { A as FILE_UPLOAD_SESSION_MAX_BYTES, O as isFileTooLargeErrorBody, S as ServerError, T as TimeoutError, h as NetworkError, k as isPayloadTooLargeErrorBody, n as parseErrorResponse, x as SandboxError, y as QuotaError } from "./errors-BUzH7U1D.js";
|
|
2
|
+
import { t as abortableSleep } from "./abort-signal-Cu4F2VVz.js";
|
|
2
3
|
//#region src/generated/sandbox-upload-operations.ts
|
|
3
4
|
function uploadSessionInit(transport, input, init = {}) {
|
|
4
5
|
return transport.fetch(`/fs/upload-session`, {
|
|
@@ -48,21 +49,6 @@ const RETRY_MAX_MS = 2e3;
|
|
|
48
49
|
* staging budget. */
|
|
49
50
|
const DEFAULT_UPLOAD_CONCURRENCY = 4;
|
|
50
51
|
const MAX_UPLOAD_CONCURRENCY = 8;
|
|
51
|
-
const delay = (ms, signal) => new Promise((resolve, reject) => {
|
|
52
|
-
if (signal?.aborted) {
|
|
53
|
-
reject(signal.reason ?? /* @__PURE__ */ new Error("aborted"));
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const timer = setTimeout(() => {
|
|
57
|
-
signal?.removeEventListener("abort", onAbort);
|
|
58
|
-
resolve();
|
|
59
|
-
}, ms);
|
|
60
|
-
function onAbort() {
|
|
61
|
-
clearTimeout(timer);
|
|
62
|
-
reject(signal?.reason ?? /* @__PURE__ */ new Error("aborted"));
|
|
63
|
-
}
|
|
64
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
65
|
-
});
|
|
66
52
|
/** Transient part-upload failures worth retrying: rate-limit/budget (429),
|
|
67
53
|
* 5xx, transport (network), and request timeouts — mirrors
|
|
68
54
|
* `isTransientWriteError` in `sandbox.ts`. A non-transient error (bad path,
|
|
@@ -239,7 +225,7 @@ async function putPart(transport, uploadId, index, options, wire) {
|
|
|
239
225
|
if (isTransientUploadError(err) && attempt < maxRetries) {
|
|
240
226
|
const retryAfterMs = err instanceof SandboxError ? err.retryAfterMs : void 0;
|
|
241
227
|
const backoff = Math.min(RETRY_BASE_MS * 2 ** attempt, RETRY_MAX_MS);
|
|
242
|
-
await
|
|
228
|
+
await abortableSleep(retryAfterMs ?? backoff, options.signal);
|
|
243
229
|
continue;
|
|
244
230
|
}
|
|
245
231
|
throw err;
|
|
@@ -300,7 +286,7 @@ async function uploadAllParts(transport, uploadId, bytes, partSize, totalParts,
|
|
|
300
286
|
const index = nextIndex++;
|
|
301
287
|
if (skip?.has(index)) continue;
|
|
302
288
|
results.set(index, dispatch(index));
|
|
303
|
-
if (paceMs > 0) await
|
|
289
|
+
if (paceMs > 0) await abortableSleep(paceMs, options.signal);
|
|
304
290
|
}
|
|
305
291
|
const [headIndex, head] = results.entries().next().value;
|
|
306
292
|
results.delete(headIndex);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as FILE_UPLOAD_SESSION_MAX_BYTES } from "./errors-BUzH7U1D.js";
|
|
2
|
-
import { a as planCompression, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-
|
|
2
|
+
import { a as planCompression, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-NjdTMC2n.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { open } from "node:fs/promises";
|
|
5
5
|
//#region src/lib/chunked-upload-file.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
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-C3DDPykv.js";
|
|
2
2
|
import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
3
|
-
import { A as normalizeSandboxCreateReceipt,
|
|
3
|
+
import { A as normalizeSandboxCreateReceipt, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as normalizeProxySecretReceipt, G as isCapacityShortageCreateError, H as createRetryDelayMs, I as normalizeSandboxShape, J as isRetryableCreateError, K as isDeployWindowCreateError, L as CAPACITY_ETA_MARGIN_MS, M as parseStopPhase, N as normalizeConnection, O as isRetryableProfileFileMaterializeFailure, P as normalizeEgressPolicyFields, R as CAPACITY_ETA_WAIT_MAX_MS, T as splitInlineProfileFileMounts, U as extendableDeadline, V as DEPLOY_WINDOW_RETRY_MS, W as generateIdempotencyKey, d as sandboxLedgerUsd, j as normalizeStartupDiagnostics, k as normalizeCaptureProof, n as createSandboxInstanceFromResponse, o as exportTraceBundle, q as isRateLimitCreateError } from "./sandbox-FbGj_5Fa.js";
|
|
4
4
|
import { D as isInsideReservedDir, E as ValidationError, F as SANDBOX_AGENT_HOME, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, g as NotFoundError, h as NetworkError, i as readResponseJson, n as parseErrorResponse, r as parseResponseError, x as SandboxError } from "./errors-BUzH7U1D.js";
|
|
5
|
-
import {
|
|
5
|
+
import { r as combineAbortSignals, t as abortableSleep } from "./abort-signal-Cu4F2VVz.js";
|
|
6
6
|
import { t as fetchSandboxApi } from "./api-request-DNrodWdz.js";
|
|
7
7
|
import { n as fetchWithKeepAlive } from "./keep-alive-fetch-BbSFbRCd.js";
|
|
8
8
|
import { t as parseSSEStream } from "./sse-parser-DrI47LyG.js";
|
|
@@ -1806,8 +1806,8 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1806
1806
|
const timeoutMs = requestOptions?.timeoutMs ?? (options?.gpuLease ? 9e5 : 12e4);
|
|
1807
1807
|
const idempotencyKey = options?.idempotencyKey ?? generateIdempotencyKey();
|
|
1808
1808
|
const startedAt = Date.now();
|
|
1809
|
-
|
|
1810
|
-
|
|
1809
|
+
let deadline = startedAt + timeoutMs;
|
|
1810
|
+
let deployWindowDeadline = Math.min(deadline, startedAt + DEPLOY_WINDOW_RETRY_MS);
|
|
1811
1811
|
const git = options?.git ? {
|
|
1812
1812
|
url: options.git.url,
|
|
1813
1813
|
ref: options.git.ref,
|
|
@@ -1859,8 +1859,8 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
const resources = options?.resources;
|
|
1861
1861
|
const workspaceCwd = options?.cwd === void 0 ? void 0 : runtimeWorkspaceCwdSchema.parse(options.cwd);
|
|
1862
|
-
const postDeadline =
|
|
1863
|
-
const postSignal = requestOptions?.signal ? combineAbortSignals([requestOptions.signal, postDeadline]) : postDeadline;
|
|
1862
|
+
const postDeadline = extendableDeadline(deadline);
|
|
1863
|
+
const postSignal = requestOptions?.signal ? combineAbortSignals([requestOptions.signal, postDeadline.signal]) : postDeadline.signal;
|
|
1864
1864
|
const createRequestBody = JSON.stringify({
|
|
1865
1865
|
name: options?.name,
|
|
1866
1866
|
...environment !== void 0 ? { environment } : {},
|
|
@@ -1890,14 +1890,15 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1890
1890
|
const elapsedMs = Date.now() - startedAt;
|
|
1891
1891
|
const metadata = { elapsedMs };
|
|
1892
1892
|
if (allPreviousCreateAttemptsRefused && lastServerError?.createFailureDisposition === "not-admitted") metadata.createFailureDisposition = "not-admitted";
|
|
1893
|
-
const
|
|
1894
|
-
const
|
|
1893
|
+
const budgetMs = deadline - startedAt;
|
|
1894
|
+
const spentBudget = elapsedMs >= budgetMs;
|
|
1895
|
+
const preamble = spentBudget ? `Sandbox create did not complete within ${budgetMs}ms. ` : `Sandbox create ended after ${elapsedMs}ms of its ${budgetMs}ms budget. `;
|
|
1895
1896
|
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. `;
|
|
1896
|
-
return new TimeoutError(
|
|
1897
|
+
return new TimeoutError(budgetMs, 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.`, metadata, lastServerError);
|
|
1897
1898
|
};
|
|
1898
1899
|
const sleepBeforeRetry = async (delayMs) => {
|
|
1899
1900
|
try {
|
|
1900
|
-
await
|
|
1901
|
+
await abortableSleep(delayMs, postSignal);
|
|
1901
1902
|
} catch (waitError) {
|
|
1902
1903
|
if (requestOptions?.signal?.aborted) throw waitError;
|
|
1903
1904
|
throw createTimeoutError();
|
|
@@ -1934,13 +1935,13 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1934
1935
|
headers: { "Idempotency-Key": idempotencyKey },
|
|
1935
1936
|
signal: postSignal,
|
|
1936
1937
|
body: createRequestBody
|
|
1937
|
-
}, { timeoutMs });
|
|
1938
|
+
}, { timeoutMs: Math.max(1, deadline - Date.now()) });
|
|
1938
1939
|
} catch (error) {
|
|
1939
1940
|
allPreviousCreateAttemptsRefused = false;
|
|
1940
1941
|
pacedByServer = false;
|
|
1941
1942
|
if (requestOptions?.signal?.aborted) throw error;
|
|
1942
1943
|
if (error instanceof SandboxError && !(error instanceof TimeoutError)) lastServerError = error;
|
|
1943
|
-
if (postDeadline.aborted || Date.now() >= deadline || error instanceof TimeoutError || error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) throw createTimeoutError();
|
|
1944
|
+
if (postDeadline.signal.aborted || Date.now() >= deadline || error instanceof TimeoutError || error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) throw createTimeoutError();
|
|
1944
1945
|
if (exhaustsRetryBudget(error instanceof Error ? error : new Error(String(error)))) throw error;
|
|
1945
1946
|
await waitBeforeRetry(error, attempt);
|
|
1946
1947
|
continue;
|
|
@@ -1952,6 +1953,14 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1952
1953
|
allPreviousCreateAttemptsRefused = error.createFailureDisposition === "not-admitted";
|
|
1953
1954
|
if (error.code === "SANDBOX_CREATE_RECONCILING" && lastServerError && lastServerError.code !== "SANDBOX_CREATE_RECONCILING") throw lastServerError;
|
|
1954
1955
|
lastServerError = error;
|
|
1956
|
+
if (requestOptions?.timeoutMs === void 0 && isCapacityShortageCreateError(error) && error.etaSeconds) {
|
|
1957
|
+
const until = Math.min(startedAt + CAPACITY_ETA_WAIT_MAX_MS, Date.now() + error.etaSeconds * 1e3 + CAPACITY_ETA_MARGIN_MS);
|
|
1958
|
+
deployWindowDeadline = Math.max(deployWindowDeadline, until);
|
|
1959
|
+
if (until > deadline) {
|
|
1960
|
+
deadline = until;
|
|
1961
|
+
postDeadline.extendTo(until);
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1955
1964
|
if (exhaustsRetryBudget(error)) throw error;
|
|
1956
1965
|
pacedByServer = isPacedCreateError(error);
|
|
1957
1966
|
await waitBeforeRetry(error, attempt);
|
|
@@ -4321,23 +4330,6 @@ async function platformData(response) {
|
|
|
4321
4330
|
if (parsed.success !== true || parsed.data === void 0) throw parseErrorResponse(502, body, void 0, response.headers);
|
|
4322
4331
|
return parsed.data;
|
|
4323
4332
|
}
|
|
4324
|
-
function abortableDelay(ms, signal) {
|
|
4325
|
-
return new Promise((resolve, reject) => {
|
|
4326
|
-
if (signal?.aborted) {
|
|
4327
|
-
reject(signal.reason);
|
|
4328
|
-
return;
|
|
4329
|
-
}
|
|
4330
|
-
const timer = setTimeout(() => {
|
|
4331
|
-
signal?.removeEventListener("abort", onAbort);
|
|
4332
|
-
resolve();
|
|
4333
|
-
}, ms);
|
|
4334
|
-
const onAbort = () => {
|
|
4335
|
-
clearTimeout(timer);
|
|
4336
|
-
reject(signal?.reason);
|
|
4337
|
-
};
|
|
4338
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
4339
|
-
});
|
|
4340
|
-
}
|
|
4341
4333
|
/** `client.runs`: start a run, read it, wait for it. */
|
|
4342
4334
|
var RunsClient = class {
|
|
4343
4335
|
constructor(http) {
|
|
@@ -4371,7 +4363,7 @@ var RunsClient = class {
|
|
|
4371
4363
|
const record = await this.get(id, options.signal ? { signal: options.signal } : {});
|
|
4372
4364
|
if (SETTLED.has(record.status)) return record;
|
|
4373
4365
|
if (Date.now() + interval > deadline) throw new TimeoutError(timeoutMs, `run ${id} did not settle within ${timeoutMs}ms (last status ${record.status}); cancel it with client.runs.cancel("${id}")`);
|
|
4374
|
-
await
|
|
4366
|
+
await abortableSleep(interval, options.signal);
|
|
4375
4367
|
}
|
|
4376
4368
|
}
|
|
4377
4369
|
/** Start a run and wait for it to settle. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Y as canonicalAgentProfileDigest } from "./sandbox-FbGj_5Fa.js";
|
|
3
3
|
import { E as ValidationError, s as CapabilityError, x as SandboxError } from "./errors-BUzH7U1D.js";
|
|
4
|
-
import {
|
|
4
|
+
import { n as awaitWithAbort } from "./abort-signal-Cu4F2VVz.js";
|
|
5
5
|
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-CwJjUmvo-3J2DDPxW.js";
|
|
6
6
|
import "./cli-auth-bundle-Op0k_zIX.js";
|
|
7
7
|
import { z } from "zod";
|
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-FbGj_5Fa.js";
|
|
2
2
|
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, n as parseErrorResponse, s as CapabilityError, v as ProfileFileMountPathError, x as SandboxError, y as QuotaError } from "./errors-BUzH7U1D.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-Cgtoc5Qn.js";
|
|
4
4
|
import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-2fj8i5qd.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-B7oXknE8.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,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
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-C3DDPykv.js";
|
|
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-BYbNLahH.js";
|
|
3
3
|
import { i as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-C1KpT-wS.js";
|
|
4
|
-
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, f as InteractiveSessionHandle, 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-
|
|
4
|
+
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, f as InteractiveSessionHandle, 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-FbGj_5Fa.js";
|
|
5
5
|
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, n as parseErrorResponse, 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-BUzH7U1D.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-Cgtoc5Qn.js";
|
|
7
7
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DIIJHGQY.js";
|
|
8
8
|
import { t as parseSSEStream } from "./sse-parser-DrI47LyG.js";
|
|
9
9
|
import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-2fj8i5qd.js";
|
|
10
10
|
import { t as downloadFile } from "./file-download-Bo3IypMO.js";
|
|
11
11
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
12
|
-
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-
|
|
13
|
-
import { s as TangleSandboxClient } from "./tangle-
|
|
12
|
+
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-B7oXknE8.js";
|
|
13
|
+
import { s as TangleSandboxClient } from "./tangle-Dz_ibQVN.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
//#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
|
|
16
16
|
const MANAGED_MODEL_KEY_SENTINEL = "proxy-managed-per-request";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-
|
|
1
|
+
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-BYbNLahH.js";
|
|
2
2
|
export { BrowserInteractiveSessionControlController, InteractiveSessionNotRunningError, browserInteractiveControlHolderId };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { C as boundedIdentifierSchema, T as boundedJsonSchema, o as canonicalCandidateDigest } from "./harness-DMaNgn0S.js";
|
|
2
|
-
import { B as PlanContinuationSchema, D as agentInteractiveSessionControlClaimMatchesRef, P as AgentExactRunControlRefSchema, R as AgentExecutionOutcomeSchema, U as InteractionRequestSchema, c as assertInteractiveSessionRef, h as AgentInteractiveSessionAttachSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint, v as AgentInteractiveSessionControlClaimSchema, x as AgentInteractiveSessionRefSchema, z as DurablePlanSchema } from "./browser-interactive-control-controller-
|
|
2
|
+
import { B as PlanContinuationSchema, D as agentInteractiveSessionControlClaimMatchesRef, P as AgentExactRunControlRefSchema, R as AgentExecutionOutcomeSchema, U as InteractionRequestSchema, c as assertInteractiveSessionRef, h as AgentInteractiveSessionAttachSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint, v as AgentInteractiveSessionControlClaimSchema, x as AgentInteractiveSessionRefSchema, z as DurablePlanSchema } from "./browser-interactive-control-controller-BYbNLahH.js";
|
|
3
3
|
import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
4
4
|
import { E as ValidationError, S as ServerError, h as NetworkError, r as parseResponseError, s as CapabilityError, t as TerminalStreamError, x as SandboxError } from "./errors-BUzH7U1D.js";
|
|
5
|
-
import { n as combineAbortSignals, t as
|
|
5
|
+
import { n as awaitWithAbort, r as combineAbortSignals, t as abortableSleep } from "./abort-signal-Cu4F2VVz.js";
|
|
6
6
|
import { t as parseSSEStream } from "./sse-parser-DrI47LyG.js";
|
|
7
|
-
import { s as uploadChunked } from "./chunked-upload-
|
|
7
|
+
import { s as uploadChunked } from "./chunked-upload-NjdTMC2n.js";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
/** Stable declaration order; registry tests check the shipped spec composition. */
|
|
10
10
|
const ALL_BACKEND_TYPES = Object.values({
|
|
@@ -1097,23 +1097,6 @@ function traceHeaders(traceId) {
|
|
|
1097
1097
|
function isRetryableCredentialRefusal(error) {
|
|
1098
1098
|
return error instanceof SandboxError && error.status === 503 && (error.code === "MODEL_CREDENTIAL_SUPERSEDED" || error.code === "MODEL_CREDENTIAL_PLATFORM_UNAVAILABLE" || error.code === "HUB_CREDENTIAL_REFRESH_UNAVAILABLE" || error.code === "HUB_CREDENTIAL_REFRESH_FAILED" && Number.isFinite(error.retryAfterMs));
|
|
1099
1099
|
}
|
|
1100
|
-
function waitForRetryAfter(delayMs, signal) {
|
|
1101
|
-
signal?.throwIfAborted();
|
|
1102
|
-
if (delayMs <= 0) return Promise.resolve();
|
|
1103
|
-
return new Promise((resolve, reject) => {
|
|
1104
|
-
let timer;
|
|
1105
|
-
const onAbort = () => {
|
|
1106
|
-
if (timer) clearTimeout(timer);
|
|
1107
|
-
signal?.removeEventListener("abort", onAbort);
|
|
1108
|
-
reject(signal?.reason ?? new DOMException("The operation was aborted", "AbortError"));
|
|
1109
|
-
};
|
|
1110
|
-
timer = setTimeout(() => {
|
|
1111
|
-
signal?.removeEventListener("abort", onAbort);
|
|
1112
|
-
resolve();
|
|
1113
|
-
}, delayMs);
|
|
1114
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
1100
|
//#endregion
|
|
1118
1101
|
//#region src/generated/file-write-preconditions.ts
|
|
1119
1102
|
function assertFileWritePreconditions(result, requested) {
|
|
@@ -1686,7 +1669,7 @@ var SandboxRuntimeApi = class extends RuntimeFiles {
|
|
|
1686
1669
|
receipt = await this.json(path, init);
|
|
1687
1670
|
} catch (error) {
|
|
1688
1671
|
if (options.planFollowUp || !isRetryableCredentialRefusal(error)) throw error;
|
|
1689
|
-
await
|
|
1672
|
+
await abortableSleep(error.retryAfterMs ?? 1e3, signal);
|
|
1690
1673
|
receipt = await this.json(path, init);
|
|
1691
1674
|
}
|
|
1692
1675
|
if (request.runControlRef) validateAcceptedDispatchRunRef(receipt.runControlRef, request.runControlRef, request.runControlRef.environmentId, id, receipt.info.id, path);
|
|
@@ -2587,4 +2570,4 @@ var BrowserInteractiveSessionController = class extends InteractiveSessionContro
|
|
|
2587
2570
|
}
|
|
2588
2571
|
};
|
|
2589
2572
|
//#endregion
|
|
2590
|
-
export {
|
|
2573
|
+
export { normalizeRuntimeBackendConfig as A, TERMINAL_WS_ECHO_SUBPROTOCOL as B, encodeTextForWire as C, applyRequestedModel as D, isBrowserRuntime as E, withoutRuntimeSecrets as F, parseBackendType as G, backendTypeSchema as H, createAgentRunOutcomeTracker as I, deriveAgentResultOutcome as L, requestedSecretProfilePublicDigest as M, withProfileHarness as N, assertCurrentBackendType as O, withoutCreateOnlyModelFields as P, deriveAgentRunOutcome as R, encodePromptForWire as S, canUseNodeHttp2 as T, isolationPrincipalSchema as U, ALL_BACKEND_TYPES as V, normalizeEffectiveBackend as W, isTraceId as _, assertScopedTokenActive as a, resolveDispatchRunIdentity as b, SandboxRuntimeApi as c, appendSessionIdQuery as d, callHeaders as f, TRACE_ID_HEADER as g, isRetryableCredentialRefusal as h, terminalUpgradeHeadersSupported as i, requestedPublicProfileDigest as j, mergeRuntimeBackendConfig as k, normalizeSessionInfo as l, assertFileWritePreconditions as m, InteractiveSessionController as n, requestInteractiveSessionToken as o, sessionHeaders as p, TerminalStream as r, requestScopedToken as s, BrowserInteractiveSessionController as t, sessionMessageRequestBody as u, mintTraceId as v, runtimeFilesystemPath as w, validateAcceptedDispatchRunRef as x, resolveTraceId as y, projectAgentTerminalRecord as z };
|
package/dist/runtime.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-
|
|
1
|
+
import { I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as projectAgentTerminalRecord } from "./interactive-controller-C3DDPykv.js";
|
|
2
|
+
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BYbNLahH.js";
|
|
3
3
|
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-BUzH7U1D.js";
|
|
4
4
|
import { t as fetchSandboxApi } from "./api-request-DNrodWdz.js";
|
|
5
|
-
import { s as uploadChunked } from "./chunked-upload-
|
|
5
|
+
import { s as uploadChunked } from "./chunked-upload-NjdTMC2n.js";
|
|
6
6
|
//#region src/runtime-client.ts
|
|
7
7
|
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
8
8
|
function requireToken(token) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as normalizeRuntimeBackendConfig, C as encodeTextForWire, D as applyRequestedModel, F as withoutRuntimeSecrets, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, M as requestedSecretProfilePublicDigest, O as assertCurrentBackendType, S as encodePromptForWire, T as canUseNodeHttp2, W as normalizeEffectiveBackend, _ as isTraceId, a as assertScopedTokenActive, b as resolveDispatchRunIdentity, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as TRACE_ID_HEADER, h as isRetryableCredentialRefusal, i as terminalUpgradeHeadersSupported, j as requestedPublicProfileDigest, k as mergeRuntimeBackendConfig, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as mintTraceId, w as runtimeFilesystemPath, x as validateAcceptedDispatchRunRef, y as resolveTraceId } from "./interactive-controller-C3DDPykv.js";
|
|
2
2
|
import { C as boundedIdentifierSchema, E as boundedStringSchema, g as sha256DigestSchema$1, o as canonicalCandidateDigest$1, s as canonicalCandidateJson$1, u as isCanonicalJsonValue$1 } from "./harness-DMaNgn0S.js";
|
|
3
3
|
import { t as sha256 } from "./sha2-vu4U-x2L.js";
|
|
4
|
-
import { A as agentInteractiveSessionStatusMatchesRef, B as PlanContinuationSchema, C as AgentInteractiveSessionStopAcknowledgementSchema, D as agentInteractiveSessionControlClaimMatchesRef, E as agentInteractiveSessionControlClaimIsNewer, F as AgentRunCancellationAcknowledgementSchema, G as InteractionResponseSchema, H as InteractionBindingSchema, I as AgentRunCancellationRequestSchema, L as agentRunCancellationAcknowledgementMatchesRequest, M as agentInteractiveDimensionSchema, N as sameAgentExactRun, O as agentInteractiveSessionPromptAcknowledgementMatchesCommand, P as AgentExactRunControlRefSchema, S as AgentInteractiveSessionStatusSchema, T as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, U as InteractionRequestSchema, V as InteractionAcknowledgementSchema, W as InteractionResponseCommandSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveSessionStopAcknowledgementMatchesCommand, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, v as AgentInteractiveSessionControlClaimSchema, w as AgentInteractiveSessionStopCommandSchema, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema } from "./browser-interactive-control-controller-
|
|
4
|
+
import { A as agentInteractiveSessionStatusMatchesRef, B as PlanContinuationSchema, C as AgentInteractiveSessionStopAcknowledgementSchema, D as agentInteractiveSessionControlClaimMatchesRef, E as agentInteractiveSessionControlClaimIsNewer, F as AgentRunCancellationAcknowledgementSchema, G as InteractionResponseSchema, H as InteractionBindingSchema, I as AgentRunCancellationRequestSchema, L as agentRunCancellationAcknowledgementMatchesRequest, M as agentInteractiveDimensionSchema, N as sameAgentExactRun, O as agentInteractiveSessionPromptAcknowledgementMatchesCommand, P as AgentExactRunControlRefSchema, S as AgentInteractiveSessionStatusSchema, T as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, U as InteractionRequestSchema, V as InteractionAcknowledgementSchema, W as InteractionResponseCommandSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveSessionStopAcknowledgementMatchesCommand, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, v as AgentInteractiveSessionControlClaimSchema, w as AgentInteractiveSessionStopCommandSchema, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema } from "./browser-interactive-control-controller-BYbNLahH.js";
|
|
5
5
|
import { a as ProxySecretReceiptSchema, o as canonicalAgentProfileValue, r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
6
6
|
import { C as StateError, E as ValidationError, F as SANDBOX_AGENT_HOME, I as SANDBOX_FILE_API_ABSOLUTE_ROOTS, L as isProfileFileMountOutsideRoots, M as FILE_OPERATION_LIMITS, P as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, R as profileFileMountOutsideRootsMessage, S as ServerError, T as TimeoutError, a as AuthError, c as CompliancePlacementError, f as GpuProviderNotConfiguredError, g as NotFoundError, h as NetworkError, i as readResponseJson, j as SANDBOX_PROXY_REQUEST_MAX_BYTES, l as EdgeNotReadyError, m as NON_RETRYABLE_CREATE_QUOTA_REASONS, n as parseErrorResponse, r as parseResponseError, s as CapabilityError, t as TerminalStreamError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-BUzH7U1D.js";
|
|
7
|
-
import { n as
|
|
7
|
+
import { i as delayUntilAborted, n as awaitWithAbort, r as combineAbortSignals, t as abortableSleep } from "./abort-signal-Cu4F2VVz.js";
|
|
8
8
|
import { t as rewrapResponse } from "./response-rewrap-CpNkboDX.js";
|
|
9
9
|
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-BbSFbRCd.js";
|
|
10
10
|
import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-5DpLmHeN.js";
|
|
11
11
|
import { t as parseSSEStream } from "./sse-parser-DrI47LyG.js";
|
|
12
|
-
import { s as uploadChunked } from "./chunked-upload-
|
|
12
|
+
import { s as uploadChunked } from "./chunked-upload-NjdTMC2n.js";
|
|
13
13
|
import { t as runPreparedProcess } from "./prepared-process-C-rwZPIZ.js";
|
|
14
14
|
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-CwJjUmvo-3J2DDPxW.js";
|
|
15
15
|
import "./cli-auth-bundle-Op0k_zIX.js";
|
|
@@ -272,7 +272,8 @@ const RETRYABLE_CREATE_STATUS_CODES = new Set([
|
|
|
272
272
|
* 503 classes that mean "the cell cannot place a create right now, ask
|
|
273
273
|
* again", not "this create failed". A full fleet answers `CAPACITY_EXHAUSTED`
|
|
274
274
|
* at once with `Retry-After` (nothing queues in the controller; the refusal
|
|
275
|
-
* wakes the autoscaler and this re-POST meets the host it bought
|
|
275
|
+
* wakes the autoscaler and this re-POST meets the host it bought, its
|
|
276
|
+
* `etaSeconds` stretching a default budget: CAPACITY_ETA_WAIT_MAX_MS), and so
|
|
276
277
|
* does a host-agent roll that drains placement on the only host.
|
|
277
278
|
* `HOST_PRESSURE` and `PROVISIONING_PAUSED` are the sibling placement
|
|
278
279
|
* refusals the orchestrator maps to 503, and a keyed create cannot verify its
|
|
@@ -281,26 +282,10 @@ const RETRYABLE_CREATE_STATUS_CODES = new Set([
|
|
|
281
282
|
* the Worker declining to act until it can prove what exists, and the
|
|
282
283
|
* idempotency key joins whichever provision did start.
|
|
283
284
|
*
|
|
284
|
-
* `SANDBOX_CREATE_RECONCILING` is deliberately not in the family
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* Worker releases that journal on the three admission refusals above
|
|
289
|
-
* (sandbox-create-failure.ts, `PRE_PROVISION_REFUSAL_CODES`), so the hold
|
|
290
|
-
* can only follow a retained real failure: a provision that started and
|
|
291
|
-
* failed, or a create whose commit never ran because the Worker or the
|
|
292
|
-
* controller stopped mid-create. The reconciler leaves such a journal alone
|
|
293
|
-
* for RESERVATION_TTL_MS = 5 min and then releases it only after three
|
|
294
|
-
* authoritative misses, one cron tick apart
|
|
295
|
-
* (products/sandbox/api/src/cf/create-reservation-reconciler.ts), which is
|
|
296
|
-
* longer than the 150 s ceiling below and the 120 s default create budget.
|
|
297
|
-
* Retrying it on the time budget could never outlast the hold; it only
|
|
298
|
-
* turned a ~10 s failure into a 120 s TimeoutError. It keeps the
|
|
299
|
-
* five-attempt budget, paced on its Retry-After, like every other 503. The
|
|
300
|
-
* same code also answers a failed read of that recovery state, a transient
|
|
301
|
-
* the short budget already covers. When the hold follows this call's own
|
|
302
|
-
* failed attempt, create() throws that earlier failure instead: it names
|
|
303
|
-
* the cause, and the hold only names the journal it left.
|
|
285
|
+
* `SANDBOX_CREATE_RECONCILING` is deliberately not in the family: it follows
|
|
286
|
+
* only a retained real failure, whose journal the reconciler holds for at
|
|
287
|
+
* least 5 min (products/sandbox/api/src/cf/create-reservation-reconciler.ts),
|
|
288
|
+
* longer than any budget here, so it keeps the five-attempt budget.
|
|
304
289
|
*
|
|
305
290
|
* `SANDBOX_TRANSFER_PENDING` (Retry-After 1) is in the family: a keyed
|
|
306
291
|
* create served from a ready lease answers it on a same-key retry until the
|
|
@@ -323,9 +308,33 @@ const DEPLOY_WINDOW_RETRY_CODES = new Set([
|
|
|
323
308
|
* on the host, swap the agent, restore placement): the last measured roll
|
|
324
309
|
* kept placement drained for 124 s. The caller's create deadline binds
|
|
325
310
|
* first when it is shorter, and the 120 s default is, so a default create
|
|
326
|
-
* waits out its own deadline
|
|
311
|
+
* waits out its own deadline (or CAPACITY_ETA_WAIT_MAX_MS) not this ceiling.
|
|
327
312
|
*/
|
|
328
313
|
const DEPLOY_WINDOW_RETRY_MS = 15e4;
|
|
314
|
+
/**
|
|
315
|
+
* Longest a create with no `timeoutMs` waits, from its start, for the host a
|
|
316
|
+
* capacity refusal's `etaSeconds` says is booting. The cell sizes that wait
|
|
317
|
+
* on its measured p95 birth (eu1 2026-10-31: 230 s; a cold start adds 15% and
|
|
318
|
+
* a 60 s control tick, 325 s). The margin covers registration to placement.
|
|
319
|
+
*/
|
|
320
|
+
const CAPACITY_ETA_WAIT_MAX_MS = 36e4;
|
|
321
|
+
const CAPACITY_ETA_MARGIN_MS = 15e3;
|
|
322
|
+
/** `AbortSignal.timeout` whose deadline may only move later. */
|
|
323
|
+
function extendableDeadline(atMs) {
|
|
324
|
+
const controller = new AbortController();
|
|
325
|
+
let timer;
|
|
326
|
+
const extendTo = (at) => {
|
|
327
|
+
clearTimeout(timer);
|
|
328
|
+
const abort = () => controller.abort(new DOMException("timed out", "TimeoutError"));
|
|
329
|
+
timer = setTimeout(abort, Math.max(0, at - Date.now()));
|
|
330
|
+
timer.unref?.();
|
|
331
|
+
};
|
|
332
|
+
extendTo(atMs);
|
|
333
|
+
return {
|
|
334
|
+
signal: controller.signal,
|
|
335
|
+
extendTo
|
|
336
|
+
};
|
|
337
|
+
}
|
|
329
338
|
function isDeployWindowCreateError(cause) {
|
|
330
339
|
return cause instanceof SandboxError && cause.status === 503 && DEPLOY_WINDOW_RETRY_CODES.has(cause.code);
|
|
331
340
|
}
|
|
@@ -357,21 +366,6 @@ function createRetryDelayMs(cause, failedAttempt) {
|
|
|
357
366
|
if (cause instanceof SandboxError && cause.retryAfterMs !== void 0) return cause.retryAfterMs;
|
|
358
367
|
return Math.min(250 * 2 ** Math.max(0, failedAttempt - 1), CREATE_RETRY_MAX_DELAY_MS);
|
|
359
368
|
}
|
|
360
|
-
async function waitForCreateRetry(delayMs, signal) {
|
|
361
|
-
if (signal.aborted) throw signal.reason ?? /* @__PURE__ */ new Error("Sandbox create aborted");
|
|
362
|
-
if (delayMs <= 0) return;
|
|
363
|
-
await new Promise((resolve, reject) => {
|
|
364
|
-
const timeoutId = setTimeout(() => {
|
|
365
|
-
signal.removeEventListener("abort", onAbort);
|
|
366
|
-
resolve();
|
|
367
|
-
}, delayMs);
|
|
368
|
-
const onAbort = () => {
|
|
369
|
-
clearTimeout(timeoutId);
|
|
370
|
-
reject(signal.reason ?? /* @__PURE__ */ new Error("Sandbox create aborted"));
|
|
371
|
-
};
|
|
372
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
369
|
function generateIdempotencyKey() {
|
|
376
370
|
const c = globalThis.crypto;
|
|
377
371
|
if (c?.randomUUID) return c.randomUUID();
|
|
@@ -8255,7 +8249,7 @@ var SandboxPromptTransportCapabilities = class extends SandboxSessionAdmissionCa
|
|
|
8255
8249
|
path: `/v1/sandboxes/${encodeURIComponent(this.id)}/runtime${state.requestEndpoint}`
|
|
8256
8250
|
}, response.headers);
|
|
8257
8251
|
if (!isRetryableCredentialRefusal(refusal)) break;
|
|
8258
|
-
await
|
|
8252
|
+
await abortableSleep(refusal.retryAfterMs ?? 1e3, state.streamSignal);
|
|
8259
8253
|
response = await this.runtimeFetch(state.requestEndpoint, request, state.internal?.forceFullProfile ? { skipProfileReference: true } : void 0);
|
|
8260
8254
|
}
|
|
8261
8255
|
} catch (err) {
|
|
@@ -10959,7 +10953,7 @@ var SandboxFilesystemOperations = class extends DeclaredFilesystemOperations {
|
|
|
10959
10953
|
totalBytes: size,
|
|
10960
10954
|
percentage: 0
|
|
10961
10955
|
});
|
|
10962
|
-
const { uploadChunkedFromFile } = await import("./chunked-upload-file-
|
|
10956
|
+
const { uploadChunkedFromFile } = await import("./chunked-upload-file-Z-KNaobQ.js");
|
|
10963
10957
|
await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
|
|
10964
10958
|
mode: options?.permissions,
|
|
10965
10959
|
onProgress: options?.onProgress ? (progress) => {
|
|
@@ -11841,4 +11835,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
|
|
|
11841
11835
|
}
|
|
11842
11836
|
};
|
|
11843
11837
|
//#endregion
|
|
11844
|
-
export { normalizeSandboxCreateReceipt as A,
|
|
11838
|
+
export { normalizeSandboxCreateReceipt as A, DEFAULT_GPU_CREATE_TIMEOUT_MS as B, SandboxOperationFailedError as C, validateDeferredProfileFileMounts as D, splitInlineProfileSkills as E, normalizeProxySecretReceipt as F, isCapacityShortageCreateError as G, createRetryDelayMs as H, normalizeSandboxShape as I, isRetryableCreateError as J, isDeployWindowCreateError as K, CAPACITY_ETA_MARGIN_MS as L, parseStopPhase as M, normalizeConnection as N, isRetryableProfileFileMaterializeFailure as O, normalizeEgressPolicyFields as P, CAPACITY_ETA_WAIT_MAX_MS as R, SandboxOperation as S, splitInlineProfileFileMounts as T, extendableDeadline as U, DEPLOY_WINDOW_RETRY_MS as V, generateIdempotencyKey as W, canonicalAgentProfileDigest as Y, collectAgentFinalMessageText as _, buildTraceExportPayload as a, isToolBearingEvent as b, toOtelJson as c, sandboxLedgerUsd as d, InteractiveSessionHandle as f, applySandboxEventText as g, createInteractiveTerminalSession as h, MAX_EGRESS_DENIALS_LIMIT as i, normalizeStartupDiagnostics as j, normalizeCaptureProof as k, SandboxTaskSession as l, createInteractiveTerminalCapture as m, createSandboxInstanceFromResponse as n, exportTraceBundle as o, InteractiveTerminalFrameLog as p, isRateLimitCreateError as q, WorkspaceImages as r, otelTraceIdForTangleTrace as s, SandboxInstance as t, SandboxSession as u, collectAgentResponseText as v, materializeProfileFileMounts as w, ManagedProcessClient as x, getSandboxEventText as y, DEFAULT_CREATE_TIMEOUT_MS as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as combineAbortSignals } from "../abort-signal-Cu4F2VVz.js";
|
|
2
2
|
import "../sidecar-proxy-error-5DpLmHeN.js";
|
|
3
3
|
import { t as parseSSEStream } from "../sse-parser-DrI47LyG.js";
|
|
4
4
|
//#region ../../../packages/runtime-contracts/dist/session-gateway.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 TangleSandboxClient, 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 TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-Dz_ibQVN.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,4 +1,4 @@
|
|
|
1
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-FbGj_5Fa.js";
|
|
2
2
|
import { i as readResponseJson } from "./errors-BUzH7U1D.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-vaFoyyiO.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.159",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -153,15 +153,15 @@
|
|
|
153
153
|
"vitest": "^4.1.12",
|
|
154
154
|
"ws": "^8.22.0",
|
|
155
155
|
"yjs": "13.6.33",
|
|
156
|
-
"@repo/shared": "0.0.0",
|
|
157
156
|
"@products/sandbox-test-utils": "0.0.0",
|
|
158
|
-
"@tangle-network/agent-profile-materialize": "0.27.1",
|
|
159
157
|
"@tangle-network/cli-agent-registry": "0.15.0",
|
|
158
|
+
"@tangle-network/agent-profile-materialize": "0.27.1",
|
|
159
|
+
"@repo/shared": "0.0.0",
|
|
160
160
|
"@tangle-network/runtime-contracts": "0.20.0"
|
|
161
161
|
},
|
|
162
162
|
"tangleRelease": {
|
|
163
|
-
"sourceSha": "
|
|
164
|
-
"mergedAt": "2026-10-
|
|
163
|
+
"sourceSha": "ff81e5820dc6bf72e012681c97ce5390c38b57f3",
|
|
164
|
+
"mergedAt": "2026-10-31T15:49:39-06:00"
|
|
165
165
|
},
|
|
166
166
|
"scripts": {
|
|
167
167
|
"build": "node scripts/build-dist.mjs",
|