@tangle-network/sandbox 1.0.231 → 1.0.233
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 +22 -1
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +5 -5
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +2 -2
- package/dist/agent-execution-preparation-BJChICex.js +18 -0
- package/dist/agent-execution-preparation-receipt-BIFxqyr5.js +250 -0
- package/dist/{agent-run-outcome-DMaHbXAk.d.ts → agent-run-outcome-B0nURFpG.d.ts} +3 -2
- package/dist/{api-request-_SFFNVqY.js → api-request-dyabkosT.js} +34 -9
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +2 -2
- package/dist/{browser-interactive-control-controller-BiP6TJFP.js → browser-interactive-control-controller-BM2p1dBp.js} +16 -252
- package/dist/{browser-interactive-control-controller-qv26Bpfx.d.ts → browser-interactive-control-controller-CcUjQEfa.d.ts} +1 -1
- package/dist/{chunked-upload-BjkxykZD.js → chunked-upload-BlvgxPWx.js} +4 -5
- package/dist/{chunked-upload-file-B2KFimpz.js → chunked-upload-file-DOeLpMO0.js} +2 -2
- package/dist/cli-auth-bundle-BLAtE6Dc.js +2 -0
- package/dist/{client-OlxlnLwV.js → client-BS-PR_-j.js} +38 -47
- package/dist/{client-DvvRMxKx.d.ts → client-DlTDphmI.d.ts} +38 -32
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-DZ8ptALs.js → collaboration-Dz20mN9a.js} +20 -27
- package/dist/core-CUZyz-U8.js +161 -0
- package/dist/core.d.ts +6 -6
- package/dist/core.js +6 -5
- package/dist/{direct-http2-DU2SK2Wo.js → direct-http2-Bgb2lHte.js} +1 -1
- package/dist/{errors-A-bhwwsE.js → error-catalog-CAbzw67O.js} +1 -382
- package/dist/errors-nXGKGVFe.js +382 -0
- package/dist/{file-download-UhMKbMbD.js → file-download-BjkrYzy_.js} +1 -1
- package/dist/{index-Cip3q_xe.d.ts → index-DE5n6mot.d.ts} +13 -23
- package/dist/index.d.ts +12 -12
- package/dist/index.js +29 -25
- package/dist/intelligence/index.d.ts +41 -109
- package/dist/intelligence/index.js +60 -73
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-D4gZ4f2I.js → interactive-controller-DDPdZa2H.js} +20 -54
- package/dist/{interactive-controller-P0yy6sGl.d.ts → interactive-controller-sEU_J6Bc.d.ts} +3 -3
- package/dist/lib/prepared-evidence.js +1 -1
- package/dist/lib/prepared-process.js +1 -1
- package/dist/{lines-7VecgiGd.js → lines-CSGBHEjR.js} +1 -1
- package/dist/{lines-DNXdVbGO.d.ts → lines-qvpmwN_2.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-CPS9yuTc.js → local-cli-auth-CO0byocv.js} +1 -1
- package/dist/{mcp-local-CIXZFqF4.js → mcp-local-Dz_Sehz0.js} +4 -4
- package/dist/{prepared-evidence-Byty5p51.js → prepared-evidence-ibAysmX8.js} +2 -2
- package/dist/{prepared-process-u1B0b94R.js → prepared-process-DQ_68Ofg.js} +2 -2
- package/dist/{preview-CNfYklE6.d.ts → preview-BC_wLaA2.d.ts} +3 -3
- package/dist/{public-templates-CPvDf8CH.d.ts → public-templates-WuvmbvzY.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/public-templates.js +1 -1
- package/dist/{raw-evidence-archive-BgWqaQcM.js → raw-evidence-archive-Cz4j8VMw.js} +2 -2
- package/dist/{retry-policy-Dh-VezcE.js → retry-policy-oW3_ljoc.js} +2 -24
- package/dist/runtime.d.ts +7 -7
- package/dist/runtime.js +9 -9
- package/dist/{sandbox-Dvk2PYnL.js → sandbox-OyCRplrI.js} +65 -91
- package/dist/{secp256k1-Cbp9tbkX.js → secp256k1-ZiYFbGjz.js} +1 -1
- package/dist/{core-D7czAW25.js → select-seat-B4Y-7vIq.js} +40 -171
- package/dist/select-seat-command.d.ts +9 -3
- package/dist/select-seat-command.js +69 -57
- package/dist/session-gateway/index.js +11 -20
- package/dist/sidecar-proxy-error-DTdbCbUM.js +4 -0
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-DWzUnb1Y.js → tangle-Crxw_6V-.js} +22 -17
- package/dist/{terminal-stream-types-DB8V0hiG.d.ts → terminal-stream-types-eE97lZ-5.d.ts} +0 -1
- package/dist/{types-Cmv31xBh.d.ts → types-Cs5eJzOK.d.ts} +17 -57
- package/package.json +5 -5
- package/dist/cli-auth-bundle-CMJWI99l.js +0 -2
- package/dist/sidecar-proxy-error-DpBLxIof.js +0 -24
- /package/dist/{abort-signal-BbJTt2QJ.js → abort-signal-CRxC2dlT.js} +0 -0
- /package/dist/{cli-auth-bundle-C6DtK7GX-BbbiAn-Z.js → cli-auth-bundle-C6DtK7GX-mBUPER0R.js} +0 -0
- /package/dist/{cli-auth-bundle-Wg3x2hd2.d.ts → cli-auth-bundle-CjSu4D9W.d.ts} +0 -0
- /package/dist/{file-transfer-BSe4ayU9.js → file-transfer-DOSTbUSR.js} +0 -0
- /package/dist/{index-CDtEPygc.d.ts → index-C-_HY5NY.d.ts} +0 -0
- /package/dist/{index-YbAo-so_.d.ts → index-o31uwAkX.d.ts} +0 -0
- /package/dist/{keep-alive-fetch-BIaDMUtu.js → keep-alive-fetch-sGVP8skk.js} +0 -0
- /package/dist/{preview-operations-B3TTvqlm.js → preview-operations-DWL78boI.js} +0 -0
- /package/dist/{retry-after-header-DUdCC0KJ.js → retry-after-header-BZbs5rig.js} +0 -0
- /package/dist/{sse-parser-DOCszo1K.js → sse-parser-BCG3iL9j.js} +0 -0
- /package/dist/{utils-CK-x8vXj.js → utils-BT2q9nkO.js} +0 -0
package/dist/runtime.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController } from "./interactive-controller-
|
|
2
|
-
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-
|
|
3
|
-
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, b as QuotaError, g as NetworkError, l as CapabilityError, p as FileWriteConflictError, s as AuthError, v as PartialFailureError, w as StateError, y as ProfileFileMountPathError } from "./errors-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController } from "./interactive-controller-DDPdZa2H.js";
|
|
2
|
+
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BM2p1dBp.js";
|
|
3
|
+
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, b as QuotaError, g as NetworkError, l as CapabilityError, p as FileWriteConflictError, s as AuthError, v as PartialFailureError, w as StateError, y as ProfileFileMountPathError } from "./errors-nXGKGVFe.js";
|
|
4
|
+
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-dyabkosT.js";
|
|
5
|
+
import { s as uploadChunked } from "./chunked-upload-BlvgxPWx.js";
|
|
6
6
|
//#region src/runtime-client.ts
|
|
7
|
-
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
8
7
|
function requireToken(token) {
|
|
9
8
|
const value = token.trim();
|
|
10
9
|
if (!value) throw new ValidationError("Scoped runtime token is required");
|
|
@@ -23,7 +22,7 @@ function requireBaseUrl(baseUrl) {
|
|
|
23
22
|
return url.toString().replace(/\/+$/, "");
|
|
24
23
|
}
|
|
25
24
|
function requireTimeout(timeoutMs) {
|
|
26
|
-
const value = timeoutMs ??
|
|
25
|
+
const value = timeoutMs ?? SDK_TIMEOUTS.default;
|
|
27
26
|
if (!Number.isFinite(value) || value <= 0) throw new ValidationError("Scoped runtime timeout must be positive");
|
|
28
27
|
return value;
|
|
29
28
|
}
|
|
@@ -45,7 +44,8 @@ var SandboxRuntimeClient = class extends SandboxRuntimeApi {
|
|
|
45
44
|
if (typeof fetchImpl !== "function") throw new ValidationError("Scoped runtime client requires a fetch implementation");
|
|
46
45
|
super({
|
|
47
46
|
ensureRunning: async () => void 0,
|
|
48
|
-
fetch: async (path,
|
|
47
|
+
fetch: async (path, requestInit, fetchOptions) => {
|
|
48
|
+
const init = requestInit ?? {};
|
|
49
49
|
if (!path.startsWith("/") || path.startsWith("//")) throw new ValidationError("Scoped runtime request paths must start with one slash");
|
|
50
50
|
return fetchSandboxApi({
|
|
51
51
|
baseUrl,
|
|
@@ -62,7 +62,7 @@ var SandboxRuntimeClient = class extends SandboxRuntimeApi {
|
|
|
62
62
|
origin: "runtime",
|
|
63
63
|
endpoint: path
|
|
64
64
|
})
|
|
65
|
-
}, path, init,
|
|
65
|
+
}, path, init, fetchOptions);
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
this.#auth = auth;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { A as requestedPublicProfileDigest, C as runtimeFilesystemPath, D as assertCurrentBackendType, E as applyRequestedModel, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodeTextForWire, U as normalizeEffectiveBackend, _ as mintTraceId, a as assertScopedTokenActive, b as validateAcceptedDispatchRunRef, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as canUseNodeHttp2, x as encodePromptForWire, y as resolveDispatchRunIdentity } from "./interactive-controller-
|
|
2
|
-
import { C as boundedIdentifierSchema$1, E as boundedStringSchema$1, g as sha256DigestSchema$1, o as canonicalCandidateDigest$1, s as canonicalCandidateJson$1
|
|
1
|
+
import { A as requestedPublicProfileDigest, C as runtimeFilesystemPath, D as assertCurrentBackendType, E as applyRequestedModel, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodeTextForWire, U as normalizeEffectiveBackend, _ as mintTraceId, a as assertScopedTokenActive, b as validateAcceptedDispatchRunRef, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as canUseNodeHttp2, x as encodePromptForWire, y as resolveDispatchRunIdentity } from "./interactive-controller-DDPdZa2H.js";
|
|
2
|
+
import { C as boundedIdentifierSchema$1, E as boundedStringSchema$1, g as sha256DigestSchema$1, o as canonicalCandidateDigest$1, s as canonicalCandidateJson$1 } from "./harness-DMaNgn0S.js";
|
|
3
3
|
import { t as sha256$1 } 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-
|
|
5
|
-
import { a as ProxySecretReceiptSchema$1,
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import { a as
|
|
10
|
-
import {
|
|
11
|
-
import { a as
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import {
|
|
17
|
-
import "./cli-auth-bundle-
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
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-BM2p1dBp.js";
|
|
5
|
+
import { a as ProxySecretReceiptSchema$1, r as agentProfileSchema$1 } from "./profile-schema-C1KpT-wS.js";
|
|
6
|
+
import { t as canonicalAgentProfileDigest } from "./agent-execution-preparation-BJChICex.js";
|
|
7
|
+
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, T as StreamInterruptedError, _ as NotFoundError, a as readResponseJson, d as EdgeNotReadyError, g as NetworkError, i as parseResponseError, l as CapabilityError, n as isTransientWrite, o as retryWhen, r as parseErrorResponse, s as AuthError, t as TerminalStreamError, w as StateError, y as ProfileFileMountPathError } from "./errors-nXGKGVFe.js";
|
|
8
|
+
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-CRxC2dlT.js";
|
|
9
|
+
import { a as backoffDelayMs, o as isUndelivered, r as abortableSleep } from "./retry-policy-oW3_ljoc.js";
|
|
10
|
+
import { a as isReplayableBody, i as fetchSandboxApi, n as SDK_TIMEOUTS, o as rewrapResponse, t as IDEMPOTENT_METHODS } from "./api-request-dyabkosT.js";
|
|
11
|
+
import { a as SANDBOX_PROXY_REQUEST_MAX_BYTES, c as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, d as isProfileFileMountOutsideRoots, f as profileFileMountOutsideRootsMessage, l as SANDBOX_AGENT_HOME, o as FILE_OPERATION_LIMITS, u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-DOSTbUSR.js";
|
|
12
|
+
import { c as awaitSdkResend, l as takeSdkTurn, s as uploadChunked } from "./chunked-upload-BlvgxPWx.js";
|
|
13
|
+
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-sGVP8skk.js";
|
|
14
|
+
import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-DTdbCbUM.js";
|
|
15
|
+
import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
|
|
16
|
+
import { t as runPreparedProcess } from "./prepared-process-DQ_68Ofg.js";
|
|
17
|
+
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-C6DtK7GX-mBUPER0R.js";
|
|
18
|
+
import "./cli-auth-bundle-BLAtE6Dc.js";
|
|
19
|
+
import { n as SandboxLines } from "./lines-CSGBHEjR.js";
|
|
20
|
+
import { t as downloadFile } from "./file-download-BjkrYzy_.js";
|
|
20
21
|
import { z } from "zod";
|
|
21
22
|
import { createHash } from "node:crypto";
|
|
22
23
|
import { constants } from "node:fs";
|
|
@@ -26,21 +27,6 @@ import { PART_TEXT, PART_TEXT_SUFFIX, locatePart } from "@tangle-network/agent-c
|
|
|
26
27
|
import { readTokenUsage } from "@tangle-network/agent-core";
|
|
27
28
|
import "@tangle-network/agent-interface/environment-provider";
|
|
28
29
|
import { OTLP_SPAN_KIND, OTLP_STATUS_CODE, msToUnixNano, otlpTraceExport, toOtlpAttributes, toW3CSpanId, toW3CTraceId } from "@tangle-network/agent-trace-contract/otlp";
|
|
29
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation.js
|
|
30
|
-
/**
|
|
31
|
-
* Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
|
|
32
|
-
* Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
|
|
33
|
-
* and tool text is ordinary public profile data: it may legitimately discuss
|
|
34
|
-
* credentials, security incidents, or examples that resemble credentials, so
|
|
35
|
-
* pattern matching cannot decide whether it is secret. Resolve opaque secret
|
|
36
|
-
* references only after this public identity is fixed.
|
|
37
|
-
*/
|
|
38
|
-
function canonicalAgentProfileDigest(profile) {
|
|
39
|
-
const material = canonicalAgentProfileValue$1(agentProfileSchema$1.parse(profile));
|
|
40
|
-
if (material === void 0 || !isCanonicalJsonValue$1(material)) throw new Error("AgentProfile must contain finite, acyclic RFC 8785 JSON values");
|
|
41
|
-
return canonicalCandidateDigest$1(material);
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
30
|
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/environment-interactive-start.js
|
|
45
31
|
const AgentInteractiveSessionRunCoordinatesSchema = z.strictObject({
|
|
46
32
|
provider: boundedIdentifierSchema$1,
|
|
@@ -258,8 +244,6 @@ const TerminalReplayWindowSchema = z.strictObject({
|
|
|
258
244
|
});
|
|
259
245
|
//#endregion
|
|
260
246
|
//#region src/client-create-retry.ts
|
|
261
|
-
const DEFAULT_CREATE_TIMEOUT_MS = 12e4;
|
|
262
|
-
const DEFAULT_GPU_CREATE_TIMEOUT_MS = 900 * 1e3;
|
|
263
247
|
const CREATE_RETRY_MAX_DELAY_MS = 4e3;
|
|
264
248
|
/** 503s meaning "cannot place now, ask again"; the key joins any provision that started. `SANDBOX_CREATE_RECONCILING` is absent: it outlasts any budget. */
|
|
265
249
|
const DEPLOY_WINDOW_RETRY_CODES = new Set([
|
|
@@ -292,7 +276,7 @@ function extendableDeadline(atMs) {
|
|
|
292
276
|
};
|
|
293
277
|
}
|
|
294
278
|
function isDeployWindowCreateError(cause) {
|
|
295
|
-
return cause
|
|
279
|
+
return retryWhen(cause) && cause.status === 503 && DEPLOY_WINDOW_RETRY_CODES.has(cause.code);
|
|
296
280
|
}
|
|
297
281
|
/** A no-room refusal allocated nothing, so a create giving up on one reports this typed 503. */
|
|
298
282
|
const isCapacityShortageCreateError = (cause) => isDeployWindowCreateError(cause) && (cause.code === "CAPACITY_EXHAUSTED" || cause.code === "HOST_PRESSURE");
|
|
@@ -1161,7 +1145,7 @@ var SandboxInfoCapabilities = class {
|
|
|
1161
1145
|
return response;
|
|
1162
1146
|
} catch (err) {
|
|
1163
1147
|
options?.signal?.throwIfAborted();
|
|
1164
|
-
if (err instanceof StateError) throw err;
|
|
1148
|
+
if (err instanceof StateError || err instanceof TimeoutError) throw err;
|
|
1165
1149
|
throw new NetworkError(`Failed to connect to sandbox: ${err instanceof Error ? err.message : String(err)}`, {
|
|
1166
1150
|
cause: err instanceof Error ? err : void 0,
|
|
1167
1151
|
endpoint: path,
|
|
@@ -2829,15 +2813,8 @@ async function edgeVerdict(response) {
|
|
|
2829
2813
|
//#endregion
|
|
2830
2814
|
//#region src/direct-runtime-client.ts
|
|
2831
2815
|
/**
|
|
2832
|
-
*
|
|
2833
|
-
* first
|
|
2834
|
-
* host (`connection.hostUrl`), every runtime call goes straight to that host's
|
|
2835
|
-
* runtime door at the API's own path on the runtime bearer, over one HTTP/2
|
|
2836
|
-
* connection per host. Otherwise exec-family calls go to the cell exec host on
|
|
2837
|
-
* the short exec grant and the rest to the cell edge at `connection.runtimeUrl`.
|
|
2838
|
-
* A call the host or edge does not serve is sent through the API
|
|
2839
|
-
* (runtime-route-policy.ts). `SandboxInstance.direct()` uses it for every
|
|
2840
|
-
* runtime call, with no API fallback.
|
|
2816
|
+
* Direct runtime bearer transport: owning host, else cell exec/edge routes.
|
|
2817
|
+
* Edge-first mode falls back to the API by route policy; direct() never does.
|
|
2841
2818
|
*/
|
|
2842
2819
|
/** Renew a bearer this close to its expiry before sending it. */
|
|
2843
2820
|
const BEARER_RENEW_BEFORE_MS = 5e3;
|
|
@@ -2946,7 +2923,8 @@ var DirectRuntimeHttpClient = class {
|
|
|
2946
2923
|
if (connection?.hostUrl && connection.authToken) return {
|
|
2947
2924
|
useExec: false,
|
|
2948
2925
|
useHost: true,
|
|
2949
|
-
|
|
2926
|
+
origin: connection.hostUrl,
|
|
2927
|
+
path,
|
|
2950
2928
|
bearer: connection.authToken,
|
|
2951
2929
|
expiresAt: connection.authTokenExpiresAt
|
|
2952
2930
|
};
|
|
@@ -2958,7 +2936,8 @@ var DirectRuntimeHttpClient = class {
|
|
|
2958
2936
|
return {
|
|
2959
2937
|
useExec,
|
|
2960
2938
|
useHost: false,
|
|
2961
|
-
|
|
2939
|
+
origin,
|
|
2940
|
+
path: runtimePath,
|
|
2962
2941
|
bearer,
|
|
2963
2942
|
expiresAt: useExec ? connection?.execTokenExpiresAt : connection?.authTokenExpiresAt
|
|
2964
2943
|
};
|
|
@@ -2989,15 +2968,11 @@ var DirectRuntimeHttpClient = class {
|
|
|
2989
2968
|
this.edgeCooldownUntil = Date.now() + EDGE_COOLDOWN_MS;
|
|
2990
2969
|
return throughApi();
|
|
2991
2970
|
};
|
|
2992
|
-
const isFormDataBody = typeof FormData !== "undefined" && options?.body instanceof FormData;
|
|
2993
|
-
if (!headers.has("Content-Type") && !isFormDataBody) headers.set("Content-Type", "application/json");
|
|
2994
2971
|
const init = {
|
|
2995
2972
|
...options,
|
|
2996
2973
|
headers
|
|
2997
2974
|
};
|
|
2998
|
-
if (options?.body && typeof options.body === "object" && !
|
|
2999
|
-
const directTimeoutMs = fetchOptions?.timeoutMs;
|
|
3000
|
-
if (!init.signal && typeof directTimeoutMs === "number" && directTimeoutMs > 0) init.signal = AbortSignal.timeout(directTimeoutMs);
|
|
2975
|
+
if (options?.body && typeof options.body === "object" && !(typeof FormData !== "undefined" && options.body instanceof FormData)) init.duplex = "half";
|
|
3001
2976
|
if (this.signal) {
|
|
3002
2977
|
this.signal.throwIfAborted();
|
|
3003
2978
|
init.signal = init.signal ? combineAbortSignals([init.signal, this.signal]) : this.signal;
|
|
@@ -3008,18 +2983,23 @@ var DirectRuntimeHttpClient = class {
|
|
|
3008
2983
|
path
|
|
3009
2984
|
};
|
|
3010
2985
|
if (!route) throw new NetworkError("Direct runtime route was withdrawn");
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
2986
|
+
const { fetchDirectHttp2: transport } = (route.useHost || route.useExec) && canUseNodeHttp2() ? await import("./direct-http2-Bgb2lHte.js") : { fetchDirectHttp2: fetchWithKeepAlive };
|
|
2987
|
+
return fetchSandboxApi({
|
|
2988
|
+
baseUrl: route.origin,
|
|
2989
|
+
timeoutMs: this.baseClient.timeoutMs,
|
|
2990
|
+
timeoutError: (ms) => new TimeoutError(`Request timed out after ${ms}ms`, {
|
|
2991
|
+
timeoutMs: ms,
|
|
2992
|
+
origin: "runtime",
|
|
2993
|
+
endpoint: path
|
|
2994
|
+
}),
|
|
2995
|
+
fetchImpl: (url, init) => transport(url, init, timing)
|
|
2996
|
+
}, route.path, request, fetchOptions);
|
|
3017
2997
|
};
|
|
3018
2998
|
const sendOrResend = async (request) => {
|
|
3019
2999
|
try {
|
|
3020
3000
|
return { sent: await send(request) };
|
|
3021
3001
|
} catch (error) {
|
|
3022
|
-
if (canResendThroughApi && !init.signal?.aborted && !headers.has("x-no-retry") && (replaySafe || isUndelivered(error))) return { resent: await resendThroughApi() };
|
|
3002
|
+
if (canResendThroughApi && !init.signal?.aborted && !(error instanceof TimeoutError) && !headers.has("x-no-retry") && (replaySafe || isUndelivered(error))) return { resent: await resendThroughApi() };
|
|
3023
3003
|
throw error;
|
|
3024
3004
|
}
|
|
3025
3005
|
};
|
|
@@ -3051,7 +3031,7 @@ var DirectRuntimeHttpClient = class {
|
|
|
3051
3031
|
}
|
|
3052
3032
|
if (canResendThroughApi && !headers.has("x-no-retry")) {
|
|
3053
3033
|
const verdict = await edgeVerdict(response);
|
|
3054
|
-
if (verdict === "undelivered" || verdict === "unknown" && replaySafe) return resendThroughApi(response);
|
|
3034
|
+
if (verdict === "undelivered" || verdict === "unknown" && replaySafe && (await parseResponseError(response.clone())).retryable) return resendThroughApi(response);
|
|
3055
3035
|
}
|
|
3056
3036
|
if (this.onUnreachable && await isRuntimeUnreachable(response)) await this.onUnreachable();
|
|
3057
3037
|
const responseHeaders = new Headers(response.headers);
|
|
@@ -5168,10 +5148,6 @@ function catalogEntry(code) {
|
|
|
5168
5148
|
docs: `https://sandbox.tangle.tools/docs/errors#${code.toLowerCase()}`
|
|
5169
5149
|
};
|
|
5170
5150
|
}
|
|
5171
|
-
/**
|
|
5172
|
-
* The one error class. The catalog gives the status, retryability and next
|
|
5173
|
-
* step; the message names this occurrence's cause.
|
|
5174
|
-
*/
|
|
5175
5151
|
var CatalogError = class extends Error {
|
|
5176
5152
|
code;
|
|
5177
5153
|
details;
|
|
@@ -5188,7 +5164,6 @@ var CatalogError = class extends Error {
|
|
|
5188
5164
|
this.nextStep = entry.nextStep;
|
|
5189
5165
|
this.name = this.constructor.name;
|
|
5190
5166
|
}
|
|
5191
|
-
/** The `{ success: false, error }` response envelope. */
|
|
5192
5167
|
toJSON() {
|
|
5193
5168
|
return {
|
|
5194
5169
|
success: false,
|
|
@@ -6691,6 +6666,7 @@ function isTransientExecError(err, seen = /* @__PURE__ */ new Set()) {
|
|
|
6691
6666
|
if (!err || typeof err !== "object") return false;
|
|
6692
6667
|
if (seen.has(err)) return false;
|
|
6693
6668
|
seen.add(err);
|
|
6669
|
+
if (err instanceof SandboxError && !err.retryable) return false;
|
|
6694
6670
|
const e = err;
|
|
6695
6671
|
const status = errorStatus(e);
|
|
6696
6672
|
if (status !== void 0 && TRANSIENT_EXEC_STATUS_CODES.has(status)) return true;
|
|
@@ -7452,7 +7428,6 @@ var ProfileFileDelivery = class {
|
|
|
7452
7428
|
*/
|
|
7453
7429
|
const FIRST_POLL_MS = 250;
|
|
7454
7430
|
const MAX_POLL_MS = 2e3;
|
|
7455
|
-
const DEFAULT_WAIT_TIMEOUT_MS = 10 * 6e4;
|
|
7456
7431
|
/** An accepted operation ended in failure. `code` names why. */
|
|
7457
7432
|
var SandboxOperationFailedError = class extends SandboxError {
|
|
7458
7433
|
operation;
|
|
@@ -7603,7 +7578,7 @@ var SandboxOperation = class SandboxOperation {
|
|
|
7603
7578
|
* (the server's Retry-After, else full jitter, and the client's retry budget).
|
|
7604
7579
|
*/
|
|
7605
7580
|
async wait(options = {}) {
|
|
7606
|
-
const timeoutMs = options.timeoutMs ??
|
|
7581
|
+
const timeoutMs = options.timeoutMs ?? SDK_TIMEOUTS.operationWait;
|
|
7607
7582
|
const startedAt = Date.now();
|
|
7608
7583
|
const { signal } = options;
|
|
7609
7584
|
let [delayMs, capMs, failedReads] = [
|
|
@@ -8330,7 +8305,6 @@ function normalizePreviewLink(raw) {
|
|
|
8330
8305
|
metadata: raw.metadata
|
|
8331
8306
|
};
|
|
8332
8307
|
}
|
|
8333
|
-
const PREVIEW_LINK_READY_TIMEOUT_MS = 12e4;
|
|
8334
8308
|
const PREVIEW_LINK_READY_POLL_INTERVAL_MS = 2e3;
|
|
8335
8309
|
var SandboxPreviewCapabilities = class extends SandboxGpuCapabilities {
|
|
8336
8310
|
/**
|
|
@@ -8380,7 +8354,7 @@ var SandboxPreviewCapabilities = class extends SandboxGpuCapabilities {
|
|
|
8380
8354
|
return normalizePreviewLink((await readResponseJson(await this.runtimeFetch(`/preview-links/${encodeURIComponent(previewId)}`, signal ? { signal } : void 0))).previewLink);
|
|
8381
8355
|
}
|
|
8382
8356
|
async previewLinkWaitUntilReady(previewId, options) {
|
|
8383
|
-
const timeoutMs = options?.timeoutMs ??
|
|
8357
|
+
const timeoutMs = options?.timeoutMs ?? SDK_TIMEOUTS.previewReady;
|
|
8384
8358
|
const pollIntervalMs = options?.pollIntervalMs ?? PREVIEW_LINK_READY_POLL_INTERVAL_MS;
|
|
8385
8359
|
if (!Number.isFinite(timeoutMs) || timeoutMs < 1) throw new ValidationError("timeoutMs must be at least 1");
|
|
8386
8360
|
if (!Number.isFinite(pollIntervalMs) || pollIntervalMs < 1) throw new ValidationError("pollIntervalMs must be at least 1");
|
|
@@ -8702,8 +8676,6 @@ var SandboxLifecycleEventsCapabilities = class extends SandboxPreviewCapabilitie
|
|
|
8702
8676
|
};
|
|
8703
8677
|
//#endregion
|
|
8704
8678
|
//#region src/sandbox-lifecycle.ts
|
|
8705
|
-
/** Snapshot and retained-stop requests wait for the same bounded source capture. */
|
|
8706
|
-
const SNAPSHOT_CREATE_REQUEST_TIMEOUT_MS = 600 * 1e3;
|
|
8707
8679
|
var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilities {
|
|
8708
8680
|
async stop(options) {
|
|
8709
8681
|
options?.signal?.throwIfAborted();
|
|
@@ -8715,7 +8687,7 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
|
|
|
8715
8687
|
method: "POST",
|
|
8716
8688
|
...options?.retain ? { body: JSON.stringify({ retain: options.retain }) } : {},
|
|
8717
8689
|
...options?.idempotencyKey ? { headers: { "Idempotency-Key": options.idempotencyKey } } : {}
|
|
8718
|
-
}, options?.retain ? { timeoutMs:
|
|
8690
|
+
}, options?.retain ? { timeoutMs: SDK_TIMEOUTS.snapshot } : void 0), options?.signal ? { signal: options.signal } : {});
|
|
8719
8691
|
if (noWait && response.status === 202) return new SandboxOperation(parseSandboxOperation((await readResponseJson(response)).operation, {
|
|
8720
8692
|
kind: "stop",
|
|
8721
8693
|
sandboxId: this.id
|
|
@@ -8841,11 +8813,11 @@ const LIFECYCLE_CONFLICT_WINDOW_MS = 15e3;
|
|
|
8841
8813
|
/** A lease-store or storage outage the API answers 503 before or after its effect: a retry is safe. */
|
|
8842
8814
|
const LIFECYCLE_OUTAGE_CODES = new Set(["SANDBOX_LIFECYCLE_COORDINATION_UNAVAILABLE", "STORAGE_UNAVAILABLE"]);
|
|
8843
8815
|
function isLifecycleConflict(cause) {
|
|
8844
|
-
return cause
|
|
8816
|
+
return retryWhen(cause) && (cause.status === 409 && cause.code === "SANDBOX_LIFECYCLE_IN_PROGRESS" || cause.status === 503 && LIFECYCLE_OUTAGE_CODES.has(cause.code));
|
|
8845
8817
|
}
|
|
8846
8818
|
/** A DELETE a gateway or release roll dropped (502, 503, no response) is safe to resend. */
|
|
8847
8819
|
function isDeleteRetry(cause) {
|
|
8848
|
-
return isLifecycleConflict(cause) || cause instanceof NetworkError || cause
|
|
8820
|
+
return isLifecycleConflict(cause) || cause instanceof NetworkError || retryWhen(cause) && [502, 503].includes(cause.status);
|
|
8849
8821
|
}
|
|
8850
8822
|
/**
|
|
8851
8823
|
* Run one lifecycle mutation, re-attempting only the failures `retry` names
|
|
@@ -10047,10 +10019,11 @@ var SandboxCodeOperations = class extends SandboxRuntimeOperations {
|
|
|
10047
10019
|
env: options?.env,
|
|
10048
10020
|
cwd: options?.cwd
|
|
10049
10021
|
})
|
|
10050
|
-
}));
|
|
10022
|
+
}, { timeoutMs: (options?.timeoutMs || SDK_TIMEOUTS.runCode) + SDK_TIMEOUTS.margin }));
|
|
10051
10023
|
if (!payload.success || !payload.data) throw new Error(payload.error?.message ?? "runCode failed without a typed error");
|
|
10052
10024
|
return payload.data;
|
|
10053
10025
|
}
|
|
10026
|
+
/** Timeout: `options.timeoutMs` (default 30000 ms) plus `SDK_TIMEOUTS.margin`. */
|
|
10054
10027
|
async exec(command, options) {
|
|
10055
10028
|
const headers = callHeaders(options);
|
|
10056
10029
|
await this.ensureRunning(options?.signal);
|
|
@@ -10068,7 +10041,7 @@ var SandboxCodeOperations = class extends SandboxRuntimeOperations {
|
|
|
10068
10041
|
timeoutMs,
|
|
10069
10042
|
blocking: true
|
|
10070
10043
|
})
|
|
10071
|
-
}, timeoutMs +
|
|
10044
|
+
}, timeoutMs + SDK_TIMEOUTS.margin))).data;
|
|
10072
10045
|
if (!result || typeof result.exitCode !== "number" || typeof result.stdout !== "string" || typeof result.stderr !== "string") throw new ServerError("Sandbox process response was malformed", { status: 502 });
|
|
10073
10046
|
return {
|
|
10074
10047
|
exitCode: result.exitCode,
|
|
@@ -11676,6 +11649,7 @@ var SandboxPromptCapabilities = class extends SandboxPromptTransportCapabilities
|
|
|
11676
11649
|
response: responseText,
|
|
11677
11650
|
error: outcome.error,
|
|
11678
11651
|
errorCode: outcome.errorCode,
|
|
11652
|
+
...outcome.failure ? { failure: outcome.failure } : {},
|
|
11679
11653
|
...outcome.statusCode === void 0 ? {} : { statusCode: outcome.statusCode },
|
|
11680
11654
|
...outcome.resetAt ? { resetAt: outcome.resetAt } : {},
|
|
11681
11655
|
toolInvocations: outcome.toolInvocations,
|
|
@@ -12027,7 +12001,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
12027
12001
|
var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabilities {
|
|
12028
12002
|
/** @internal — invoked before the sandbox is deleted. */
|
|
12029
12003
|
async _sessionExportRawEvidence(id, destination, options) {
|
|
12030
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
12004
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-Cz4j8VMw.js");
|
|
12031
12005
|
await this.ensureRunning();
|
|
12032
12006
|
await this.refresh();
|
|
12033
12007
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
|
|
@@ -12058,7 +12032,7 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
12058
12032
|
* and the byte and file bounds are verified before the directory appears.
|
|
12059
12033
|
*/
|
|
12060
12034
|
async exportRawEvidence(destination, options) {
|
|
12061
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
12035
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-Cz4j8VMw.js");
|
|
12062
12036
|
await this.ensureRunning();
|
|
12063
12037
|
await this.refresh();
|
|
12064
12038
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
|
|
@@ -12219,6 +12193,8 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
12219
12193
|
response,
|
|
12220
12194
|
error: outcome.error,
|
|
12221
12195
|
errorCode: outcome.errorCode,
|
|
12196
|
+
...outcome.failure ? { failure: outcome.failure } : {},
|
|
12197
|
+
...outcome.resetAt ? { resetAt: outcome.resetAt } : {},
|
|
12222
12198
|
...outcome.statusCode === void 0 ? {} : { statusCode: outcome.statusCode },
|
|
12223
12199
|
toolInvocations: outcome.toolInvocations,
|
|
12224
12200
|
approval: outcome.approval,
|
|
@@ -13054,7 +13030,6 @@ function interpretWorkspaceOperationLookup(body, kind) {
|
|
|
13054
13030
|
}
|
|
13055
13031
|
const SNAPSHOT_RESTORE_HOLD_MS = 1e4;
|
|
13056
13032
|
const SNAPSHOT_RESTORE_POLL_FLOOR_MS = 500;
|
|
13057
|
-
const SNAPSHOT_RESTORE_TIMEOUT_MS = 600 * 1e3;
|
|
13058
13033
|
const SNAPSHOT_VISIBILITY_POLL_INTERVAL_MS = 1e3;
|
|
13059
13034
|
const SNAPSHOT_VISIBILITY_TIMEOUT_MS = 120 * 1e3;
|
|
13060
13035
|
function toSnapshotResult(data, provenance) {
|
|
@@ -13099,7 +13074,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
13099
13074
|
method: "POST",
|
|
13100
13075
|
...options?.idempotencyKey ? { headers: { "Idempotency-Key": options.idempotencyKey } } : {},
|
|
13101
13076
|
body: JSON.stringify({ tags: options?.tags })
|
|
13102
|
-
}, { timeoutMs:
|
|
13077
|
+
}, { timeoutMs: SDK_TIMEOUTS.snapshot });
|
|
13103
13078
|
const data = await readResponseJson(response);
|
|
13104
13079
|
const snapshotId = data.snapshotId ?? data.id;
|
|
13105
13080
|
if (typeof snapshotId !== "string" || snapshotId.length === 0) throw new ServerError(`Snapshot create returned 200 but body had no snapshot ID: ${JSON.stringify(data).slice(0, 200)}`, { status: response.status });
|
|
@@ -13132,7 +13107,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
13132
13107
|
method: "POST",
|
|
13133
13108
|
...options.idempotencyKey ? { headers: { "Idempotency-Key": options.idempotencyKey } } : {},
|
|
13134
13109
|
body: JSON.stringify({ tags: options.tags })
|
|
13135
|
-
}, { timeoutMs:
|
|
13110
|
+
}, { timeoutMs: SDK_TIMEOUTS.snapshot });
|
|
13136
13111
|
const body = await readResponseJson(response);
|
|
13137
13112
|
if (response.status === 202) return new SandboxOperation(parseSandboxOperation(body.operation, {
|
|
13138
13113
|
kind: "snapshot",
|
|
@@ -13275,7 +13250,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
13275
13250
|
method: "POST",
|
|
13276
13251
|
headers,
|
|
13277
13252
|
...init
|
|
13278
|
-
}, { timeoutMs:
|
|
13253
|
+
}, { timeoutMs: SDK_TIMEOUTS.snapshot });
|
|
13279
13254
|
const data = await readResponseJson(response);
|
|
13280
13255
|
if (response.status === 202) return this.waitForSnapshotRestore(snapshotId, data);
|
|
13281
13256
|
return toSnapshotResult(data, state(this).profileProvenance);
|
|
@@ -13285,7 +13260,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
13285
13260
|
* the job's end, is the first status read; only an unfinished one polls.
|
|
13286
13261
|
*/
|
|
13287
13262
|
async waitForSnapshotRestore(snapshotId, accepted) {
|
|
13288
|
-
const deadline = Date.now() +
|
|
13263
|
+
const deadline = Date.now() + SDK_TIMEOUTS.snapshot;
|
|
13289
13264
|
let status = accepted;
|
|
13290
13265
|
let polledAt = 0;
|
|
13291
13266
|
while (Date.now() < deadline) {
|
|
@@ -13306,7 +13281,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
13306
13281
|
polledAt = Date.now();
|
|
13307
13282
|
status = await readResponseJson(await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots/jobs/${encodeURIComponent(accepted.jobId)}?waitMs=${SNAPSHOT_RESTORE_HOLD_MS}`));
|
|
13308
13283
|
}
|
|
13309
|
-
throw new TimeoutError(`Request timed out after ${
|
|
13284
|
+
throw new TimeoutError(`Request timed out after ${SDK_TIMEOUTS.snapshot}ms`, { timeoutMs: SDK_TIMEOUTS.snapshot });
|
|
13310
13285
|
}
|
|
13311
13286
|
async waitForSnapshotVisible(snapshotId, fallback) {
|
|
13312
13287
|
const deadline = Date.now() + SNAPSHOT_VISIBILITY_TIMEOUT_MS;
|
|
@@ -13680,7 +13655,7 @@ async function exportTraceBundle(bundle, sink) {
|
|
|
13680
13655
|
const fetchImpl = sink.fetch ?? globalThis.fetch;
|
|
13681
13656
|
if (!fetchImpl) throw new Error("Trace export requires fetch");
|
|
13682
13657
|
const controller = new AbortController();
|
|
13683
|
-
const timeout = setTimeout(() => controller.abort(), sink.timeoutMs ??
|
|
13658
|
+
const timeout = setTimeout(() => controller.abort(), sink.timeoutMs ?? SDK_TIMEOUTS.default);
|
|
13684
13659
|
try {
|
|
13685
13660
|
const response = await fetchImpl(sink.url, {
|
|
13686
13661
|
method: "POST",
|
|
@@ -14192,7 +14167,7 @@ var SandboxFilesystemOperations = class extends DeclaredFilesystemOperations {
|
|
|
14192
14167
|
totalBytes: size,
|
|
14193
14168
|
percentage: 0
|
|
14194
14169
|
});
|
|
14195
|
-
const { uploadChunkedFromFile } = await import("./chunked-upload-file-
|
|
14170
|
+
const { uploadChunkedFromFile } = await import("./chunked-upload-file-DOeLpMO0.js");
|
|
14196
14171
|
await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
|
|
14197
14172
|
mode: options?.permissions,
|
|
14198
14173
|
onProgress: options?.onProgress ? (progress) => {
|
|
@@ -14735,7 +14710,6 @@ function parseWorkspaceImagePublishResultForRepository(value, repository) {
|
|
|
14735
14710
|
}
|
|
14736
14711
|
//#endregion
|
|
14737
14712
|
//#region src/workspace-images.ts
|
|
14738
|
-
const DEFAULT_WORKSPACE_IMAGE_CLIENT_TIMEOUT_MS = 99e4;
|
|
14739
14713
|
const WORKSPACE_IMAGE_REQUEST_ATTEMPTS = 2;
|
|
14740
14714
|
const MAX_WORKSPACE_IMAGE_RESPONSE_BYTES = 64 * 1024;
|
|
14741
14715
|
const MAX_TIMER_DELAY_MS = 2147483647;
|
|
@@ -14819,7 +14793,7 @@ var WorkspaceImages = class {
|
|
|
14819
14793
|
if (options.timeoutMs !== void 0 && (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs <= 0 || options.timeoutMs > MAX_TIMER_DELAY_MS)) throw new TypeError(`workspace image timeoutMs must be a positive safe integer no greater than ${MAX_TIMER_DELAY_MS}`);
|
|
14820
14794
|
if (options.idempotencyKey !== void 0 && !IDEMPOTENCY_KEY_PATTERN.test(options.idempotencyKey)) throw new TypeError("workspace image idempotencyKey must be 16-128 letters, numbers, underscores, or dashes");
|
|
14821
14795
|
const path = `/v1/sandboxes/${encodeURIComponent(this.sandboxId)}/images`;
|
|
14822
|
-
const timeoutMs = options.timeoutMs ??
|
|
14796
|
+
const timeoutMs = options.timeoutMs ?? SDK_TIMEOUTS.workspaceImage;
|
|
14823
14797
|
const deadline = Date.now() + timeoutMs;
|
|
14824
14798
|
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
14825
14799
|
const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
|
|
@@ -14887,7 +14861,7 @@ var WorkspaceImages = class {
|
|
|
14887
14861
|
method: "POST",
|
|
14888
14862
|
path
|
|
14889
14863
|
}, response.headers);
|
|
14890
|
-
if (error.code === "IMAGE_PUBLISH_OUTCOME_UNKNOWN" && attempt < WORKSPACE_IMAGE_REQUEST_ATTEMPTS && Date.now() < deadline) continue;
|
|
14864
|
+
if (error.retryable && error.code === "IMAGE_PUBLISH_OUTCOME_UNKNOWN" && attempt < WORKSPACE_IMAGE_REQUEST_ATTEMPTS && Date.now() < deadline) continue;
|
|
14891
14865
|
throw error;
|
|
14892
14866
|
}
|
|
14893
14867
|
const parsed = parseWorkspaceImagePublishResultForRepository((() => {
|
|
@@ -15100,4 +15074,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
|
|
|
15100
15074
|
}
|
|
15101
15075
|
};
|
|
15102
15076
|
//#endregion
|
|
15103
|
-
export {
|
|
15077
|
+
export { isRateLimitCreateError as $, ProfileUnsupportedError as A, normalizeConnection as B, SandboxOperationFailedError as C, validateDeferredProfileFileMounts as D, splitInlineProfileSkills as E, normalizeSandboxCreateReceipt as F, CAPACITY_ETA_WAIT_MAX_MS as G, normalizeProxySecretReceipt as H, normalizeStartupDiagnostics as I, createRetryDelayMs as J, DEPLOY_WINDOW_RETRY_MS as K, readFilesystemIncarnationTuple as L, isMaterializerHarness as M, materializeProfile as N, isRetryableProfileFileMaterializeFailure as O, normalizeCaptureProof as P, isDeployWindowCreateError as Q, dateOf as R, SandboxOperation as S, splitInlineProfileFileMounts as T, normalizeSandboxShape as U, normalizeEgressPolicyFields as V, CAPACITY_ETA_MARGIN_MS as W, generateIdempotencyKey as X, extendableDeadline as Y, isCapacityShortageCreateError as Z, collectAgentFinalMessageText as _, buildTraceExportPayload as a, isToolBearingEvent as b, toOtelJson as c, sandboxLedgerUsd as d, isRetryableCreateError as et, InteractiveSessionHandle as f, applySandboxEventText as g, createInteractiveTerminalSession as h, MAX_EGRESS_DENIALS_LIMIT as i, enforceWorkspacePlanSupport as j, HARNESS_LAUNCH_MATERIALIZE_OPTIONS as k, SandboxTaskSession as l, createInteractiveTerminalCapture as m, createSandboxInstanceFromResponse as n, exportTraceBundle as o, InteractiveTerminalFrameLog as p, awaitCreateResend 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, parseLifecycleTimes as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as anumber, c as concatBytes$1, f as randomBytes, h as toBytes, i as ahash, l as createHasher$1, n as abytes$1, o as aoutput, p as rotr, r as aexists, s as clean, t as Hash, u as createView, x as split } from "./utils-
|
|
1
|
+
import { a as anumber, c as concatBytes$1, f as randomBytes, h as toBytes, i as ahash, l as createHasher$1, n as abytes$1, o as aoutput, p as rotr, r as aexists, s as clean, t as Hash, u as createView, x as split } from "./utils-BT2q9nkO.js";
|
|
2
2
|
//#region ../../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
|
|
3
3
|
/**
|
|
4
4
|
* Internal Merkle-Damgard hash utils.
|