@tangle-network/sandbox 1.0.508 → 1.0.510
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 +1 -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-run-outcome-IWbQgIbt.d.ts → agent-run-outcome-hucdyrR6.d.ts} +1 -1
- package/dist/{api-request-Dz9fsbDw.js → api-request-Da3Gy5v5.js} +13 -4
- package/dist/auth/index.js +2 -2
- package/dist/{browser-interactive-control-controller-CNqYrsK-.d.ts → browser-interactive-control-controller-CD8b8KFn.d.ts} +1 -1
- package/dist/{browser-interactive-control-controller-DluNYMOk.js → browser-interactive-control-controller-CT6ThlkW.js} +1 -1
- package/dist/{chunked-upload-6M8Y9Sry.js → chunked-upload-ClIgZBWm.js} +3 -3
- package/dist/{chunked-upload-file-BAqjjSIN.js → chunked-upload-file-rgkPRmQb.js} +2 -2
- package/dist/cli-auth-bundle-ECDHagkC.js +2 -0
- package/dist/{client-BIU51NAv.js → client-4msWs7Tt.js} +48 -36
- package/dist/{client-Bb4VO8Tv.d.ts → client-DFaxpuf9.d.ts} +6 -5
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-BQfKi4eH.js → collaboration-BD6TvBWe.js} +2 -2
- package/dist/core.d.ts +6 -6
- package/dist/core.js +6 -6
- package/dist/{direct-http2-Dm88_AQC.js → direct-http2-Drov3Qp5.js} +2 -2
- package/dist/{error-catalog-DMNep7Y3.js → error-catalog-DwxHMZQZ.js} +3 -0
- package/dist/{errors-CgHRBUnE.js → errors-BuEDuIrs.js} +1 -1
- package/dist/{file-download-CeikrxZL.js → file-download-BEPpLHi7.js} +1 -1
- package/dist/gpu-lease/index.js +2 -2
- package/dist/{index-D7dMz_US.d.ts → index-CtrSdLo2.d.ts} +9 -8
- package/dist/index.d.ts +9 -9
- package/dist/index.js +14 -14
- package/dist/intelligence/index.js +4 -4
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-C4vZMkDP.js → interactive-controller-D1FTM_Uc.js} +6 -6
- package/dist/{interactive-controller-RKI6dXBi.d.ts → interactive-controller-DJpf6ofh.d.ts} +3 -3
- package/dist/{keep-alive-fetch-DjzdPAP3.js → keep-alive-fetch-xLyOpHAc.js} +1 -1
- package/dist/lib/prepared-evidence.js +1 -1
- package/dist/lib/prepared-process.js +1 -1
- package/dist/lifecycle-trace-CDGgSOVP.js +36 -0
- package/dist/{lines-DkfkbLSV.d.ts → lines-Ce4UmKfm.d.ts} +1 -1
- package/dist/{lines-CdfEanMh.js → lines-D3DKzzQT.js} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-CueE1l0F.js → local-cli-auth-BVXWKaty.js} +1 -1
- package/dist/{mcp-local-BrQ0Mm_C.js → mcp-local-DHtlG49d.js} +4 -4
- package/dist/{prepared-evidence-BMADfSad.js → prepared-evidence-BKtdRWT7.js} +1 -1
- package/dist/{prepared-process-B4DuLmEg.js → prepared-process-ZCv_G1q4.js} +1 -1
- package/dist/{preview-tqaVk0Af.d.ts → preview-C4nOdGvR.d.ts} +3 -3
- package/dist/{public-templates-maL22HQt.d.ts → public-templates-GebzRZgV.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/public-templates.js +1 -1
- package/dist/{raw-evidence-archive-GuIfCwo8.js → raw-evidence-archive-_aeJodxs.js} +3 -3
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +5 -5
- package/dist/{sandbox-C4eUiLBB.js → sandbox-CmeidNvi.js} +91 -45
- package/dist/{secp256k1-DIwypP5B.js → secp256k1-B2arMxku.js} +1 -1
- package/dist/{select-seat-Cq1LrUG-.js → select-seat-D_L4pss9.js} +3 -3
- package/dist/select-seat-command.d.ts +2 -2
- package/dist/select-seat-command.js +2 -2
- package/dist/session-gateway/index.js +2 -2
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +2 -2
- package/dist/{tangle-DnJNGLRM.js → tangle-CCpUk8qc.js} +6 -6
- package/dist/{terminal-stream-types-RAsy75gD.d.ts → terminal-stream-types-BMLdhwUQ.d.ts} +3 -0
- package/dist/{trace-id-8KPKajMl.js → trace-id-DX218plN.js} +8 -2
- package/dist/{types-5by8R76_.d.ts → types-DOngB_Rs.d.ts} +4 -1
- package/package.json +3 -3
- package/dist/cli-auth-bundle-DqIHmlbG.js +0 -2
- /package/dist/{abi-pcDt2Adp.js → abi-CQYNCS4F.js} +0 -0
- /package/dist/{cli-auth-bundle-CXI4ysvr-DMV1Pos7.js → cli-auth-bundle-CXI4ysvr-CGgx1JDO.js} +0 -0
- /package/dist/{core-CBWUEURz.js → core-BWiEs9yv.js} +0 -0
- /package/dist/{file-transfer-DOSTbUSR.js → file-transfer-CnCWFYua.js} +0 -0
- /package/dist/{preview-operations-BTHZR1w2.js → preview-operations-DYH3y0cn.js} +0 -0
- /package/dist/{raw-evidence-export-Dog7W5zP.js → raw-evidence-export-gCbAD5ZV.js} +0 -0
- /package/dist/{retry-policy-oW3_ljoc.js → retry-policy-BlkQJ7_e.js} +0 -0
- /package/dist/{sse-parser-BCG3iL9j.js → sse-parser-DTgSRcZC.js} +0 -0
- /package/dist/{utils-BvN0Mk3j.js → utils-fYi8g-M-.js} +0 -0
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { A as deriveAgentResultOutcome, C as normalizeRuntimeBackendConfig, O as withoutRuntimeSecrets, P as AgentRuntimeAttachmentsSchema, R as normalizeEffectiveBackend, S as mergeRuntimeBackendConfig, T as requestedSecretProfilePublicDigest, _ as encodePromptForWire, a as assertScopedTokenActive, b as applyRequestedModel, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as validateAcceptedDispatchRunRef, h as resolveDispatchRunIdentity, i as terminalUpgradeHeadersSupported, k as createAgentRunOutcomeTracker, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as encodeTextForWire, w as requestedPublicProfileDigest, x as assertCurrentBackendType, y as runtimeFilesystemPath } from "./interactive-controller-
|
|
1
|
+
import { A as deriveAgentResultOutcome, C as normalizeRuntimeBackendConfig, O as withoutRuntimeSecrets, P as AgentRuntimeAttachmentsSchema, R as normalizeEffectiveBackend, S as mergeRuntimeBackendConfig, T as requestedSecretProfilePublicDigest, _ as encodePromptForWire, a as assertScopedTokenActive, b as applyRequestedModel, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as validateAcceptedDispatchRunRef, h as resolveDispatchRunIdentity, i as terminalUpgradeHeadersSupported, k as createAgentRunOutcomeTracker, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as encodeTextForWire, w as requestedPublicProfileDigest, x as assertCurrentBackendType, y as runtimeFilesystemPath } from "./interactive-controller-D1FTM_Uc.js";
|
|
2
2
|
import { O as boundedStringSchema, T as boundedIdentifierSchema, c as canonicalCandidateJson, s as canonicalCandidateDigest, v as sha256DigestSchema } from "./harness-QlDF8rzb.js";
|
|
3
3
|
import { o as ProxySecretReceiptSchema, r as agentProfileSchema } from "./profile-schema-BHeC7cOf.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-CT6ThlkW.js";
|
|
5
5
|
import { t as canonicalAgentProfileDigest } from "./agent-execution-preparation-B8PJuIsN.js";
|
|
6
|
-
import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, T as StateError, _ as NetworkError, a as readResponseJson, b as ProfileFileMountPathError, c as AuthError, f as EdgeNotReadyError, i as parseResponseError, k as SANDBOX_CREATE_DEADLINE_HEADER, n as isTransientWrite, o as responseMetadata, r as parseErrorResponse, s as retryWhen, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-
|
|
6
|
+
import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, T as StateError, _ as NetworkError, a as readResponseJson, b as ProfileFileMountPathError, c as AuthError, f as EdgeNotReadyError, i as parseResponseError, k as SANDBOX_CREATE_DEADLINE_HEADER, n as isTransientWrite, o as responseMetadata, r as parseErrorResponse, s as retryWhen, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-BuEDuIrs.js";
|
|
7
7
|
import { n as plannedRestartDeadline, r as SIDECAR_PROXY_ERROR_HEADER, t as parseSandboxRetryAfterHeader } from "./retry-after-header-DyAWSQ4m.js";
|
|
8
8
|
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
11
|
-
import { a as
|
|
12
|
-
import { c as
|
|
13
|
-
import {
|
|
14
|
-
import { n as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import {
|
|
18
|
-
import "./cli-auth-bundle-
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
9
|
+
import { n as childTraceparent, r as parseTraceparent, t as TRACEPARENT_HEADER } from "./lifecycle-trace-CDGgSOVP.js";
|
|
10
|
+
import { a as backoffDelayMs, o as isUndelivered, r as abortableSleep } from "./retry-policy-BlkQJ7_e.js";
|
|
11
|
+
import { a as isReplayableBody, i as fetchSandboxApi, n as SDK_TIMEOUTS, o as rewrapResponse, t as IDEMPOTENT_METHODS } from "./api-request-Da3Gy5v5.js";
|
|
12
|
+
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, t as isInsideReservedDir$1, u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-CnCWFYua.js";
|
|
13
|
+
import { c as uploadChunked, l as awaitSdkResend, u as takeSdkTurn } from "./chunked-upload-ClIgZBWm.js";
|
|
14
|
+
import { a as resolveTraceId, c as canUseNodeHttp2, i as mintTraceId, n as isTraceId, r as lifecycleTraceHeaders, t as TRACE_ID_HEADER } from "./trace-id-DX218plN.js";
|
|
15
|
+
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-xLyOpHAc.js";
|
|
16
|
+
import { t as parseSSEStream } from "./sse-parser-DTgSRcZC.js";
|
|
17
|
+
import { t as runPreparedProcess } from "./prepared-process-ZCv_G1q4.js";
|
|
18
|
+
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-CXI4ysvr-CGgx1JDO.js";
|
|
19
|
+
import "./cli-auth-bundle-ECDHagkC.js";
|
|
20
|
+
import { n as SandboxLines } from "./lines-D3DKzzQT.js";
|
|
21
|
+
import { t as downloadFile } from "./file-download-BEPpLHi7.js";
|
|
21
22
|
import { z } from "zod";
|
|
23
|
+
import { OTLP_SPAN_KIND, OTLP_STATUS_CODE, msToUnixNano, otlpTraceExport, toOtlpAttributes, toW3CSpanId, toW3CTraceId } from "@tangle-network/agent-trace-contract/otlp";
|
|
22
24
|
import { createHash } from "node:crypto";
|
|
23
25
|
import { constants } from "node:fs";
|
|
24
26
|
import { isAbsolute, win32 } from "node:path";
|
|
@@ -26,7 +28,6 @@ import "node:fs/promises";
|
|
|
26
28
|
import { PART_TEXT, PART_TEXT_SUFFIX, locatePart } from "@tangle-network/agent-core/sse";
|
|
27
29
|
import { readTokenUsage } from "@tangle-network/agent-core";
|
|
28
30
|
import "@tangle-network/agent-interface/environment-provider";
|
|
29
|
-
import { OTLP_SPAN_KIND, OTLP_STATUS_CODE, msToUnixNano, otlpTraceExport, toOtlpAttributes, toW3CSpanId, toW3CTraceId } from "@tangle-network/agent-trace-contract/otlp";
|
|
30
31
|
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.28/node_modules/@tangle-network/agent-interface/dist/provider-config.js
|
|
31
32
|
const nativeWebSearchKeys = new Set(["websearch"]);
|
|
32
33
|
const nativeWebFetchKeys = new Set(["webfetch", "fetch"]);
|
|
@@ -718,7 +719,7 @@ var DirectReadRoute = class {
|
|
|
718
719
|
* `fallback` both mean "read through the API"; only `fallback` is a
|
|
719
720
|
* degradation, and only `fallback` is declared on that request.
|
|
720
721
|
*/
|
|
721
|
-
async read(signal) {
|
|
722
|
+
async read(signal, traceparent) {
|
|
722
723
|
signal?.throwIfAborted();
|
|
723
724
|
this.stats.attempts += 1;
|
|
724
725
|
const now = this.now();
|
|
@@ -746,7 +747,10 @@ var DirectReadRoute = class {
|
|
|
746
747
|
try {
|
|
747
748
|
response = await this.fetchImpl(grant.url, {
|
|
748
749
|
method: "GET",
|
|
749
|
-
headers: {
|
|
750
|
+
headers: {
|
|
751
|
+
Authorization: `Bearer ${grant.token}`,
|
|
752
|
+
...traceparent ? { [TRACEPARENT_HEADER]: childTraceparent(traceparent) } : {}
|
|
753
|
+
},
|
|
750
754
|
signal: signal ? AbortSignal.any([controller.signal, signal]) : controller.signal
|
|
751
755
|
});
|
|
752
756
|
} catch {
|
|
@@ -893,6 +897,8 @@ var SandboxInstanceState = class {
|
|
|
893
897
|
filesystemOperations;
|
|
894
898
|
info;
|
|
895
899
|
refreshInFlight;
|
|
900
|
+
/** Only set while the create that owns this instance awaits readiness. */
|
|
901
|
+
createWaitTraceparent;
|
|
896
902
|
defaultRuntimeBackend;
|
|
897
903
|
runtime;
|
|
898
904
|
workspaceImages;
|
|
@@ -1117,13 +1123,14 @@ var SandboxInfoCapabilities = class {
|
|
|
1117
1123
|
async readStatus(reason) {
|
|
1118
1124
|
const local = state(this);
|
|
1119
1125
|
local.client.signal?.throwIfAborted();
|
|
1120
|
-
const direct = local.directRead.engaged() && DIRECT_READ_POLLABLE_STATUSES.has(local.info.status) ? await local.directRead.read(local.client.signal) : null;
|
|
1126
|
+
const direct = local.directRead.engaged() && DIRECT_READ_POLLABLE_STATUSES.has(local.info.status) ? await local.directRead.read(local.client.signal, local.createWaitTraceparent) : null;
|
|
1121
1127
|
local.client.signal?.throwIfAborted();
|
|
1122
1128
|
if (direct?.kind === "unchanged") {
|
|
1123
1129
|
sandboxStatusObservedAt.set(this, Date.now());
|
|
1124
1130
|
return;
|
|
1125
1131
|
}
|
|
1126
1132
|
const headers = direct?.kind === "fallback" ? { ...local.directRead.fallbackHeaders(direct.reason) } : {};
|
|
1133
|
+
if (local.createWaitTraceparent) headers[TRACEPARENT_HEADER] = local.createWaitTraceparent;
|
|
1127
1134
|
if (sendsRefreshReason()) headers[REFRESH_REASON_HEADER] = reason;
|
|
1128
1135
|
const data = await readResponseJson(await local.client.fetch(`/v1/sandboxes/${this.id}`, ...Object.keys(headers).length > 0 ? [{ headers }] : []));
|
|
1129
1136
|
local.directRead.adopt(data);
|
|
@@ -2977,6 +2984,9 @@ var DirectRuntimeHttpClient = class {
|
|
|
2977
2984
|
get onDirectRuntimeResponse() {
|
|
2978
2985
|
return this.baseClient.onDirectRuntimeResponse;
|
|
2979
2986
|
}
|
|
2987
|
+
get lifecycleTraceContext() {
|
|
2988
|
+
return this.baseClient.lifecycleTraceContext ?? true;
|
|
2989
|
+
}
|
|
2980
2990
|
get directExec() {
|
|
2981
2991
|
return this.baseClient.directExec;
|
|
2982
2992
|
}
|
|
@@ -3023,7 +3033,7 @@ var DirectRuntimeHttpClient = class {
|
|
|
3023
3033
|
const connection = this.getConnection();
|
|
3024
3034
|
const origin = connection?.authToken ? connection.hostUrl : void 0;
|
|
3025
3035
|
if (!origin || !canUseNodeHttp2()) return;
|
|
3026
|
-
import("./direct-http2-
|
|
3036
|
+
import("./direct-http2-Drov3Qp5.js").then(({ preconnectDirectHttp2 }) => preconnectDirectHttp2(origin)).catch(() => {});
|
|
3027
3037
|
}
|
|
3028
3038
|
async fetch(path, options, fetchOptions) {
|
|
3029
3039
|
const throughApi = () => this.baseClient.fetch(path, options, fetchOptions);
|
|
@@ -3108,12 +3118,13 @@ var DirectRuntimeHttpClient = class {
|
|
|
3108
3118
|
};
|
|
3109
3119
|
const observe = this.onDirectRuntimeResponse;
|
|
3110
3120
|
if (!route) throw new NetworkError("Direct runtime route was withdrawn");
|
|
3111
|
-
const { fetchDirectHttp2: transport } = (route.useHost || route.useExec) && canUseNodeHttp2() ? await import("./direct-http2-
|
|
3121
|
+
const { fetchDirectHttp2: transport } = (route.useHost || route.useExec) && canUseNodeHttp2() ? await import("./direct-http2-Drov3Qp5.js") : { fetchDirectHttp2: fetchWithKeepAlive };
|
|
3112
3122
|
return fetchSandboxApi({
|
|
3113
3123
|
baseUrl: route.origin,
|
|
3114
3124
|
timeoutMs: this.baseClient.timeoutMs,
|
|
3125
|
+
lifecycleTraceContext: this.lifecycleTraceContext,
|
|
3115
3126
|
timeoutError: (ms, phase) => {
|
|
3116
|
-
if (this.edgeFirst && phase === "body") this.edgeCooldownUntil = Date.now() + EDGE_COOLDOWN_MS;
|
|
3127
|
+
if (this.edgeFirst && (phase === "body" || method === "GET")) this.edgeCooldownUntil = Date.now() + EDGE_COOLDOWN_MS;
|
|
3117
3128
|
return new TimeoutError(`Request timed out after ${ms}ms`, {
|
|
3118
3129
|
timeoutMs: ms,
|
|
3119
3130
|
origin: "runtime",
|
|
@@ -3134,6 +3145,8 @@ var DirectRuntimeHttpClient = class {
|
|
|
3134
3145
|
const value = response.headers.get(name);
|
|
3135
3146
|
if (value !== null) headers.set(name, value);
|
|
3136
3147
|
}
|
|
3148
|
+
const parent = parseTraceparent(response.headers.get(TRACEPARENT_HEADER));
|
|
3149
|
+
if (parent) headers.set(TRACEPARENT_HEADER, `00-${parent.traceId}-${parent.spanId}-${parent.flags}`);
|
|
3137
3150
|
observe(path, {
|
|
3138
3151
|
status: response.status,
|
|
3139
3152
|
headers
|
|
@@ -3297,12 +3310,14 @@ function isTerminalOperation(info) {
|
|
|
3297
3310
|
var SandboxOperation = class SandboxOperation {
|
|
3298
3311
|
#info;
|
|
3299
3312
|
#client;
|
|
3313
|
+
#traceHeaders;
|
|
3300
3314
|
#onSettled;
|
|
3301
3315
|
#settled = false;
|
|
3302
|
-
constructor(info, client, onSettled) {
|
|
3316
|
+
constructor(info, client, onSettled, traceHeaders) {
|
|
3303
3317
|
this.#info = info;
|
|
3304
3318
|
this.#client = client;
|
|
3305
3319
|
this.#onSettled = onSettled;
|
|
3320
|
+
this.#traceHeaders = traceHeaders;
|
|
3306
3321
|
}
|
|
3307
3322
|
static completed(kind, sandboxId, result) {
|
|
3308
3323
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3343,7 +3358,10 @@ var SandboxOperation = class SandboxOperation {
|
|
|
3343
3358
|
if (until) params.set("until", "removed");
|
|
3344
3359
|
if (waitMs) params.set("waitMs", String(waitMs));
|
|
3345
3360
|
const query = params.size ? `?${params}` : "";
|
|
3346
|
-
const response = await this.#client.fetch(`/v1/sandboxes/${encodeURIComponent(this.#info.sandboxId)}/operations/${encodeURIComponent(this.#info.id)}${query}`, {
|
|
3361
|
+
const response = await this.#client.fetch(`/v1/sandboxes/${encodeURIComponent(this.#info.sandboxId)}/operations/${encodeURIComponent(this.#info.id)}${query}`, {
|
|
3362
|
+
signal,
|
|
3363
|
+
headers: this.#traceHeaders
|
|
3364
|
+
}, { timeoutMs });
|
|
3347
3365
|
if (!response.ok) throw await parseResponseError(response);
|
|
3348
3366
|
this.#info = parseSandboxOperation(await response.json(), {
|
|
3349
3367
|
kind: this.#info.kind,
|
|
@@ -3733,6 +3751,7 @@ const ERROR_CATALOG = {
|
|
|
3733
3751
|
UPSTREAM_ERROR: "502 retry | An upstream service failed or answered outside its contract. | Retry with backoff; report the request id if it persists.",
|
|
3734
3752
|
UNAVAILABLE: "503 retry | A dependency or capacity is temporarily unavailable. | Retry after the Retry-After interval.",
|
|
3735
3753
|
UPSTREAM_UNAVAILABLE: "503 retry | The sandbox controller did not answer, or answered without a code the catalog knows. | Retry after the Retry-After interval.",
|
|
3754
|
+
CONTROLLER_RESTARTING: "503 retry | The controller is restarting. | Retry reads or repeat with the same operation key. Check unkeyed writes before repeating them.",
|
|
3736
3755
|
NOT_READY: "503 retry | The target is starting, restarting, recovering or draining. | Retry after the Retry-After interval.",
|
|
3737
3756
|
BACKEND_UNAVAILABLE: "503 retry | The agent backend did not answer. | Retry after the Retry-After interval.",
|
|
3738
3757
|
MESSAGE_RETRIEVAL_UNAVAILABLE: "503 retry | Message storage did not answer. | Retry after the Retry-After interval.",
|
|
@@ -3754,6 +3773,7 @@ const ERROR_CATALOG = {
|
|
|
3754
3773
|
BRANCH_PARENT_NOT_RUNNING: "409 final | The branch parent is not running. | Resume the parent sandbox, then branch again.",
|
|
3755
3774
|
BRANCH_NOT_MATERIALIZED: "409 final | The branch parent was removed before any child materialized. | Branch a live sandbox with a new idempotency key.",
|
|
3756
3775
|
CONTAINER_RESERVATION_CONFLICT: "409 retry | Another lifecycle operation holds this sandbox. | Wait for that operation to finish, then retry.",
|
|
3776
|
+
CONTAINER_GENERATION_MISMATCH: "409 final | The stopped Docker generation differs from the sandbox checkpoint. | Resume the sandbox from its confirmed checkpoint.",
|
|
3757
3777
|
CONTAINER_NETWORK_MISSING: "409 final | The stopped sandbox lost its network, so it cannot start in place; its files remain. | Resume the sandbox so the platform recreates it.",
|
|
3758
3778
|
EGRESS_DISABLED: "409 final | Egress is not enabled on this host. | Place the sandbox on a host with egress enabled.",
|
|
3759
3779
|
NATIVE_CAPTURE_UNAVAILABLE: "409 final | The host cannot prove the native capture image this create requires. | Retry on another host, or create without native capture.",
|
|
@@ -3762,6 +3782,7 @@ const ERROR_CATALOG = {
|
|
|
3762
3782
|
SNAPSHOT_LIMIT_REACHED: "409 final | The sandbox holds as many snapshots as its plan allows. | Delete a snapshot of this sandbox, or move to a plan with a higher snapshot limit.",
|
|
3763
3783
|
SNAPSHOT_NOT_SYNCED: "409 retry | The snapshot has not finished uploading. | Retry after the upload completes.",
|
|
3764
3784
|
WARM_CLAIM_REMOVED: "409 final | Another lifecycle operation removed the claimed warm sandbox. | Create the sandbox again.",
|
|
3785
|
+
GOLDEN_SEED_SPENT: "503 final | This warm-pool seed captured the golden snapshot and was retired, since its identity is in that memory. | Nothing to do; the pool's next seed restores from that snapshot.",
|
|
3765
3786
|
WORKSPACE_STORAGE_MISSING: "409 final | The stopped sandbox storage is gone or replaced, so the host refused to start it. | Restore the sandbox from a snapshot.",
|
|
3766
3787
|
RESTORE_QUOTA_EXCEEDED: "413 final | The snapshot is larger than the workspace quota. | Create with a larger disk, or restore a smaller snapshot.",
|
|
3767
3788
|
GIT_CLONE_REFUSED: "422 final | The repository refused the clone credential, or the credential cannot see it. | Fix the git credential or repository URL, then create again.",
|
|
@@ -12442,6 +12463,7 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
|
|
|
12442
12463
|
async stop(options) {
|
|
12443
12464
|
options?.signal?.throwIfAborted();
|
|
12444
12465
|
const local = state(this);
|
|
12466
|
+
const trace = lifecycleTraceHeaders(local.client);
|
|
12445
12467
|
const noWait = options?.wait === false;
|
|
12446
12468
|
const sourceCreatedAt = options?.retain?.publication ? local.info.createdAt.toISOString() : void 0;
|
|
12447
12469
|
const sourceIncarnation = local.info.filesystemIncarnationId;
|
|
@@ -12450,17 +12472,18 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
|
|
|
12450
12472
|
...options?.signal ? { signal: options.signal } : {},
|
|
12451
12473
|
method: "POST",
|
|
12452
12474
|
...options?.retain ? { body: JSON.stringify({ retain: options.retain }) } : {},
|
|
12453
|
-
|
|
12454
|
-
...
|
|
12455
|
-
...options
|
|
12456
|
-
|
|
12475
|
+
headers: {
|
|
12476
|
+
...trace,
|
|
12477
|
+
...options?.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {},
|
|
12478
|
+
...options?.retain?.publication ? { "x-no-retry": "1" } : {}
|
|
12479
|
+
}
|
|
12457
12480
|
}, options?.retain ? { timeoutMs: SDK_TIMEOUTS.snapshot } : void 0), options?.signal ? { signal: options.signal } : {}, options?.retain?.publication ? () => false : isLifecycleConflict);
|
|
12458
12481
|
if (noWait && response.status === 202) return new SandboxOperation(parseSandboxOperation((await readResponseJson(response)).operation, {
|
|
12459
12482
|
kind: "stop",
|
|
12460
12483
|
sandboxId: this.id
|
|
12461
12484
|
}), local.client, async (done) => {
|
|
12462
12485
|
if (!this.applyLifecycleResponse(done.result?.sandbox ?? null)) await this.refresh();
|
|
12463
|
-
});
|
|
12486
|
+
}, trace);
|
|
12464
12487
|
const data = await this.readLifecycleResponse(response);
|
|
12465
12488
|
const diagnostics = normalizeStartupDiagnostics(data.startupDiagnostics);
|
|
12466
12489
|
if (diagnostics) local.info.startupDiagnostics = diagnostics;
|
|
@@ -12504,12 +12527,16 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
|
|
|
12504
12527
|
async resumeRuntime(operation, options) {
|
|
12505
12528
|
const local = state(this);
|
|
12506
12529
|
if (options.timeoutMs !== void 0 && (!Number.isFinite(options.timeoutMs) || options.timeoutMs <= 0)) throw new ValidationError("resume timeoutMs must be a positive number");
|
|
12530
|
+
const trace = lifecycleTraceHeaders(local.client);
|
|
12507
12531
|
const timeoutSignal = options.timeoutMs ? AbortSignal.timeout(options.timeoutMs) : void 0;
|
|
12508
12532
|
const signal = combineAbortSignals([options.signal, timeoutSignal]);
|
|
12509
12533
|
const response = await withLifecycleConflictRetry(async () => {
|
|
12510
12534
|
const requestOptions = {
|
|
12511
12535
|
method: "POST",
|
|
12512
|
-
headers: {
|
|
12536
|
+
headers: {
|
|
12537
|
+
...trace,
|
|
12538
|
+
[SANDBOX_CREATE_DEADLINE_HEADER]: String(Date.now() + (options.timeoutMs ?? SDK_TIMEOUTS.default))
|
|
12539
|
+
},
|
|
12513
12540
|
...options.env ? { body: JSON.stringify({ env: options.env }) } : {},
|
|
12514
12541
|
...signal ? { signal } : {}
|
|
12515
12542
|
};
|
|
@@ -12535,6 +12562,7 @@ async function deleteSandbox(client, id, options, observe) {
|
|
|
12535
12562
|
});
|
|
12536
12563
|
options?.signal?.throwIfAborted();
|
|
12537
12564
|
const path = `/v1/sandboxes/${encodeURIComponent(id)}?wait=false${options?.until === "removed" ? "&until=removed" : ""}`;
|
|
12565
|
+
const trace = lifecycleTraceHeaders(client);
|
|
12538
12566
|
let retried = false;
|
|
12539
12567
|
let response;
|
|
12540
12568
|
try {
|
|
@@ -12542,6 +12570,7 @@ async function deleteSandbox(client, id, options, observe) {
|
|
|
12542
12570
|
method: "DELETE",
|
|
12543
12571
|
...options?.signal ? { signal: options.signal } : {},
|
|
12544
12572
|
headers: {
|
|
12573
|
+
...trace,
|
|
12545
12574
|
"x-no-retry": "1",
|
|
12546
12575
|
...options?.wait === false && options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}
|
|
12547
12576
|
}
|
|
@@ -12564,7 +12593,7 @@ async function deleteSandbox(client, id, options, observe) {
|
|
|
12564
12593
|
sandboxId: id
|
|
12565
12594
|
}), client, () => {
|
|
12566
12595
|
observe?.();
|
|
12567
|
-
});
|
|
12596
|
+
}, trace);
|
|
12568
12597
|
if (options?.wait === false) return operation;
|
|
12569
12598
|
const done = await operation.wait(options?.signal ? { signal: options.signal } : {});
|
|
12570
12599
|
return {
|
|
@@ -15821,7 +15850,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
15821
15850
|
var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabilities {
|
|
15822
15851
|
/** @internal — invoked before the sandbox is deleted. */
|
|
15823
15852
|
async _sessionExportRawEvidence(id, destination, options) {
|
|
15824
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
15853
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-_aeJodxs.js");
|
|
15825
15854
|
await this.ensureRunning();
|
|
15826
15855
|
await this.refresh();
|
|
15827
15856
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
|
|
@@ -15852,7 +15881,7 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
15852
15881
|
* and the byte and file bounds are verified before the directory appears.
|
|
15853
15882
|
*/
|
|
15854
15883
|
async exportRawEvidence(destination, options) {
|
|
15855
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
15884
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-_aeJodxs.js");
|
|
15856
15885
|
await this.ensureRunning();
|
|
15857
15886
|
await this.refresh();
|
|
15858
15887
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
|
|
@@ -16890,6 +16919,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
16890
16919
|
await this.ensureRunning();
|
|
16891
16920
|
const data = await readResponseJson(await this.runtimeFetch("/snapshots", {
|
|
16892
16921
|
method: "POST",
|
|
16922
|
+
headers: lifecycleTraceHeaders(state(this).client),
|
|
16893
16923
|
body: JSON.stringify({
|
|
16894
16924
|
projectId: this.id,
|
|
16895
16925
|
storage: options.storage,
|
|
@@ -16919,10 +16949,14 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
16919
16949
|
}
|
|
16920
16950
|
/** Asynchronous acceptance returns an operation; synchronous capture returns a succeeded operation. */
|
|
16921
16951
|
async #requestSnapshotOperation(options) {
|
|
16952
|
+
const trace = lifecycleTraceHeaders(state(this).client);
|
|
16922
16953
|
const query = options.wait === false ? "wait=false" : `wait=false&waitMs=${SNAPSHOT_HOLD_MS}`;
|
|
16923
16954
|
const response = await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots?${query}`, {
|
|
16924
16955
|
method: "POST",
|
|
16925
|
-
|
|
16956
|
+
headers: {
|
|
16957
|
+
...trace,
|
|
16958
|
+
...options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}
|
|
16959
|
+
},
|
|
16926
16960
|
body: JSON.stringify({ tags: options.tags })
|
|
16927
16961
|
}, { timeoutMs: SDK_TIMEOUTS.snapshot });
|
|
16928
16962
|
const body = await readResponseJson(response);
|
|
@@ -16930,7 +16964,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
16930
16964
|
if (response.status === 202) return [new SandboxOperation(parseSandboxOperation(body.operation, {
|
|
16931
16965
|
kind: "snapshot",
|
|
16932
16966
|
sandboxId: this.id
|
|
16933
|
-
}), state(this).client), idempotency];
|
|
16967
|
+
}), state(this).client, void 0, trace), idempotency];
|
|
16934
16968
|
const snapshotId = body.snapshotId ?? body.id;
|
|
16935
16969
|
if (typeof snapshotId !== "string" || snapshotId.length === 0) throw new ServerError(`Snapshot create returned ${response.status} but body had no snapshot ID: ${JSON.stringify(body).slice(0, 200)}`, { status: response.status });
|
|
16936
16970
|
const snapshot = toSnapshotResult({
|
|
@@ -16945,6 +16979,9 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
16945
16979
|
}
|
|
16946
16980
|
/** List snapshots; storage selects the direct customer-S3 path. */
|
|
16947
16981
|
async listSnapshots(storage) {
|
|
16982
|
+
return this.readSnapshotList(storage);
|
|
16983
|
+
}
|
|
16984
|
+
async readSnapshotList(storage, trace) {
|
|
16948
16985
|
if (storage) await this.ensureRunning();
|
|
16949
16986
|
const data = await readResponseJson(storage ? await this.runtimeFetch("/snapshots/list", {
|
|
16950
16987
|
method: "POST",
|
|
@@ -16952,7 +16989,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
16952
16989
|
projectId: this.id,
|
|
16953
16990
|
storage
|
|
16954
16991
|
})
|
|
16955
|
-
}) : await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots
|
|
16992
|
+
}) : await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots`, { headers: trace }));
|
|
16956
16993
|
return (Array.isArray(data) ? data : data.snapshots ?? []).map((s) => {
|
|
16957
16994
|
const remoteSync = toSnapshotRemoteSync(s.remoteSync);
|
|
16958
16995
|
return {
|
|
@@ -17045,18 +17082,22 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
17045
17082
|
}
|
|
17046
17083
|
/** One keyed restore: a transport re-send joins its job; a 202 settles from that job. */
|
|
17047
17084
|
async restoreSnapshot(snapshotId, init) {
|
|
17048
|
-
const
|
|
17085
|
+
const trace = lifecycleTraceHeaders(state(this).client);
|
|
17086
|
+
const headers = {
|
|
17087
|
+
...trace,
|
|
17088
|
+
"Idempotency-Key": generateIdempotencyKey()
|
|
17089
|
+
};
|
|
17049
17090
|
const response = await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots/${encodeURIComponent(snapshotId)}/restore?waitMs=${SNAPSHOT_HOLD_MS}`, {
|
|
17050
17091
|
method: "POST",
|
|
17051
17092
|
headers,
|
|
17052
17093
|
...init
|
|
17053
17094
|
}, { timeoutMs: SDK_TIMEOUTS.snapshot });
|
|
17054
17095
|
const data = await readResponseJson(response);
|
|
17055
|
-
if (response.status === 202) return this.waitForSnapshotRestore(snapshotId, data);
|
|
17096
|
+
if (response.status === 202) return this.waitForSnapshotRestore(snapshotId, data, trace);
|
|
17056
17097
|
return toSnapshotResult(data, state(this).profileProvenance);
|
|
17057
17098
|
}
|
|
17058
17099
|
/** Read the accepted restore job first; poll only while unfinished. */
|
|
17059
|
-
async waitForSnapshotRestore(snapshotId, accepted) {
|
|
17100
|
+
async waitForSnapshotRestore(snapshotId, accepted, trace) {
|
|
17060
17101
|
const deadline = Date.now() + SDK_TIMEOUTS.snapshot;
|
|
17061
17102
|
let status = accepted;
|
|
17062
17103
|
let polledAt = 0;
|
|
@@ -17071,21 +17112,21 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
17071
17112
|
...restored.sizeBytes === void 0 ? {} : { sizeBytes: restored.sizeBytes },
|
|
17072
17113
|
tags: restored.tags
|
|
17073
17114
|
};
|
|
17074
|
-
return await this.waitForSnapshotVisible(snapshotId, status.completedAt ? { createdAt: new Date(status.completedAt) } : void 0);
|
|
17115
|
+
return await this.waitForSnapshotVisible(snapshotId, status.completedAt ? { createdAt: new Date(status.completedAt) } : void 0, trace);
|
|
17075
17116
|
}
|
|
17076
17117
|
const heldMs = Date.now() - polledAt;
|
|
17077
17118
|
if (heldMs < SNAPSHOT_RESTORE_POLL_FLOOR_MS) await abortableSleep(SNAPSHOT_RESTORE_POLL_FLOOR_MS - heldMs);
|
|
17078
17119
|
polledAt = Date.now();
|
|
17079
|
-
status = await readResponseJson(await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots/jobs/${encodeURIComponent(accepted.jobId)}?waitMs=${SNAPSHOT_HOLD_MS}
|
|
17120
|
+
status = await readResponseJson(await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots/jobs/${encodeURIComponent(accepted.jobId)}?waitMs=${SNAPSHOT_HOLD_MS}`, { headers: trace }));
|
|
17080
17121
|
}
|
|
17081
17122
|
throw new TimeoutError(`Request timed out after ${SDK_TIMEOUTS.snapshot}ms`, { timeoutMs: SDK_TIMEOUTS.snapshot });
|
|
17082
17123
|
}
|
|
17083
|
-
async waitForSnapshotVisible(snapshotId, fallback) {
|
|
17124
|
+
async waitForSnapshotVisible(snapshotId, fallback, trace) {
|
|
17084
17125
|
const deadline = Date.now() + SNAPSHOT_VISIBILITY_TIMEOUT_MS;
|
|
17085
17126
|
let lastError;
|
|
17086
17127
|
while (Date.now() < deadline) {
|
|
17087
17128
|
try {
|
|
17088
|
-
const snapshot = (await this.
|
|
17129
|
+
const snapshot = (await this.readSnapshotList(void 0, trace)).find((item) => item.snapshotId === snapshotId);
|
|
17089
17130
|
if (snapshot) return {
|
|
17090
17131
|
snapshotId: snapshot.snapshotId,
|
|
17091
17132
|
createdAt: snapshot.createdAt,
|
|
@@ -17113,6 +17154,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
|
|
|
17113
17154
|
await this.ensureRunning();
|
|
17114
17155
|
const response = await this.runtimeFetch("/snapshots/restore", {
|
|
17115
17156
|
method: "POST",
|
|
17157
|
+
headers: lifecycleTraceHeaders(state(this).client),
|
|
17116
17158
|
body: JSON.stringify({
|
|
17117
17159
|
projectId: this.id,
|
|
17118
17160
|
storage,
|
|
@@ -17966,7 +18008,7 @@ var SandboxFilesystemOperations = class extends DeclaredFilesystemOperations {
|
|
|
17966
18008
|
totalBytes: size,
|
|
17967
18009
|
percentage: 0
|
|
17968
18010
|
});
|
|
17969
|
-
const { uploadChunkedFromFile } = await import("./chunked-upload-file-
|
|
18011
|
+
const { uploadChunkedFromFile } = await import("./chunked-upload-file-rgkPRmQb.js");
|
|
17970
18012
|
await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
|
|
17971
18013
|
mode: options?.permissions,
|
|
17972
18014
|
onProgress: options?.onProgress ? (progress) => {
|
|
@@ -18807,9 +18849,13 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
|
|
|
18807
18849
|
env: options?.env,
|
|
18808
18850
|
metadata: options?.metadata
|
|
18809
18851
|
});
|
|
18852
|
+
const trace = lifecycleTraceHeaders(local.client);
|
|
18810
18853
|
const data = await retryForkRefusal(async () => readResponseJson(await local.client.fetch(`/v1/sandboxes/${this.id}/branch`, {
|
|
18811
18854
|
method: "POST",
|
|
18812
|
-
headers: {
|
|
18855
|
+
headers: {
|
|
18856
|
+
...trace,
|
|
18857
|
+
"Idempotency-Key": idempotencyKey
|
|
18858
|
+
},
|
|
18813
18859
|
body
|
|
18814
18860
|
})));
|
|
18815
18861
|
const children = (data.children ?? []).map((child) => createSandboxInstanceFromResponse(local.client, this.parseInfo(child), local.defaultRuntimeBackend));
|
|
@@ -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-fYi8g-M-.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.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as agentProfileSchema } from "./profile-schema-BHeC7cOf.js";
|
|
2
2
|
import { t as canonicalAgentProfileDigest } from "./agent-execution-preparation-B8PJuIsN.js";
|
|
3
|
-
import { C as SandboxError, O as ValidationError, u as CapabilityError } from "./errors-
|
|
3
|
+
import { C as SandboxError, O as ValidationError, u as CapabilityError } from "./errors-BuEDuIrs.js";
|
|
4
4
|
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
|
|
5
|
-
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-CXI4ysvr-
|
|
6
|
-
import "./cli-auth-bundle-
|
|
5
|
+
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-CXI4ysvr-CGgx1JDO.js";
|
|
6
|
+
import "./cli-auth-bundle-ECDHagkC.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region ../../../packages/runtime-contracts/dist/seat-selection.js
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as SandboxError } from "./terminal-stream-types-
|
|
2
|
-
import { _t as SeatOwnerTransport, bt as SeatSelectionRequest, ft as SEAT_COMMAND_TIMEOUT_MS } from "./client-
|
|
1
|
+
import { R as SandboxError } from "./terminal-stream-types-BMLdhwUQ.js";
|
|
2
|
+
import { _t as SeatOwnerTransport, bt as SeatSelectionRequest, ft as SEAT_COMMAND_TIMEOUT_MS } from "./client-DFaxpuf9.js";
|
|
3
3
|
|
|
4
4
|
//#region src/select-seat-command.d.ts
|
|
5
5
|
/** Public reply bound; the owner prints one metadata object. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as SandboxError, O as ValidationError } from "./errors-
|
|
2
|
-
import { r as SEAT_OWNER_MAX_RESPONSE_BYTES, s as seatOwnerTimeoutMs, t as SEAT_COMMAND_TIMEOUT_MS } from "./select-seat-
|
|
1
|
+
import { C as SandboxError, O as ValidationError } from "./errors-BuEDuIrs.js";
|
|
2
|
+
import { r as SEAT_OWNER_MAX_RESPONSE_BYTES, s as seatOwnerTimeoutMs, t as SEAT_COMMAND_TIMEOUT_MS } from "./select-seat-D_L4pss9.js";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
//#region src/select-seat-command.ts
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../retry-after-header-DyAWSQ4m.js";
|
|
2
2
|
import { n as combineAbortSignals } from "../abort-signal-BsriwJ8L.js";
|
|
3
|
-
import { i as fetchSandboxApi } from "../api-request-
|
|
4
|
-
import { t as parseSSEStream } from "../sse-parser-
|
|
3
|
+
import { i as fetchSandboxApi } from "../api-request-Da3Gy5v5.js";
|
|
4
|
+
import { t as parseSSEStream } from "../sse-parser-DTgSRcZC.js";
|
|
5
5
|
import { PART_TEXT, PART_TEXT_SUFFIX } from "@tangle-network/agent-core/sse";
|
|
6
6
|
//#region ../../../packages/runtime-contracts/dist/session-gateway.js
|
|
7
7
|
/**
|
package/dist/tangle/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as JOB_SANDBOX_DELETE, T as SandboxCreateResponseParamTypes, _ as TANGLE_CHAIN_ID, a as fetchQuote, b as AgentSandboxBlueprintAbi, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as BlueprintSandboxClientConfig, h as BlueprintSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TANGLE_JOBS_CONTRACT, w as SandboxCreateParamTypes, x as JOB_SANDBOX_CREATE, y as ITangleJobsAbi } from "../index-
|
|
1
|
+
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as JOB_SANDBOX_DELETE, T as SandboxCreateResponseParamTypes, _ as TANGLE_CHAIN_ID, a as fetchQuote, b as AgentSandboxBlueprintAbi, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as BlueprintSandboxClientConfig, h as BlueprintSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TANGLE_JOBS_CONTRACT, w as SandboxCreateParamTypes, x as JOB_SANDBOX_CREATE, y as ITangleJobsAbi } from "../index-CtrSdLo2.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, BlueprintSandboxClient, BlueprintSandboxClientConfig, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JobQuoteDetails, JsonResponseParamTypes, OperatorChallenge, OperatorSession, OperatorSessionError, OperatorSessionToken, QuoteDomain, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, SignMessage, SignedQuote, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as SandboxCreateResponseParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as AgentSandboxBlueprintAbi, g as SandboxCreateParamTypes, h as JsonResponseParamTypes, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_DELETE, n as fetchQuote, o as validateQuote, p as JOB_SANDBOX_CREATE, r as inputsHashOf, s as BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxIdParamTypes } from "../tangle-
|
|
2
|
-
import { t as ITangleJobsAbi } from "../abi-
|
|
1
|
+
import { _ as SandboxCreateResponseParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as AgentSandboxBlueprintAbi, g as SandboxCreateParamTypes, h as JsonResponseParamTypes, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_DELETE, n as fetchQuote, o as validateQuote, p as JOB_SANDBOX_CREATE, r as inputsHashOf, s as BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxIdParamTypes } from "../tangle-CCpUk8qc.js";
|
|
2
|
+
import { t as ITangleJobsAbi } from "../abi-CQYNCS4F.js";
|
|
3
3
|
export { AgentSandboxBlueprintAbi, BlueprintSandboxClient, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
2
|
-
import { a as readResponseJson } from "./errors-
|
|
3
|
-
import { i as fetchSandboxApi } from "./api-request-
|
|
4
|
-
import { t as ITangleJobsAbi } from "./abi-
|
|
5
|
-
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-
|
|
1
|
+
import { R as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-CmeidNvi.js";
|
|
2
|
+
import { a as readResponseJson } from "./errors-BuEDuIrs.js";
|
|
3
|
+
import { i as fetchSandboxApi } from "./api-request-Da3Gy5v5.js";
|
|
4
|
+
import { t as ITangleJobsAbi } from "./abi-CQYNCS4F.js";
|
|
5
|
+
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-fYi8g-M-.js";
|
|
6
6
|
//#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
|
|
7
7
|
/**
|
|
8
8
|
* Tangle blueprint wire contract shared by the orchestrator's Tangle driver and
|
|
@@ -2586,7 +2586,7 @@ function isAddressEqual(a, b) {
|
|
|
2586
2586
|
//#region ../../../node_modules/.pnpm/viem@2.57.16_bufferutil@4.1.0_typescript@6.0.3_utf-8-validate@5.0.10_zod@4.6.7/node_modules/viem/_esm/utils/signature/recoverPublicKey.js
|
|
2587
2587
|
async function recoverPublicKey({ hash, signature }) {
|
|
2588
2588
|
const hashHex = isHex(hash) ? hash : toHex(hash);
|
|
2589
|
-
const { secp256k1 } = await import("./secp256k1-
|
|
2589
|
+
const { secp256k1 } = await import("./secp256k1-B2arMxku.js");
|
|
2590
2590
|
return `0x${(() => {
|
|
2591
2591
|
if (typeof signature === "object" && "r" in signature && "s" in signature) {
|
|
2592
2592
|
const { r, s, v, yParity } = signature;
|
|
@@ -1224,6 +1224,7 @@ declare const ERROR_CATALOG: {
|
|
|
1224
1224
|
readonly UPSTREAM_ERROR: "502 retry | An upstream service failed or answered outside its contract. | Retry with backoff; report the request id if it persists.";
|
|
1225
1225
|
readonly UNAVAILABLE: "503 retry | A dependency or capacity is temporarily unavailable. | Retry after the Retry-After interval.";
|
|
1226
1226
|
readonly UPSTREAM_UNAVAILABLE: "503 retry | The sandbox controller did not answer, or answered without a code the catalog knows. | Retry after the Retry-After interval.";
|
|
1227
|
+
readonly CONTROLLER_RESTARTING: "503 retry | The controller is restarting. | Retry reads or repeat with the same operation key. Check unkeyed writes before repeating them.";
|
|
1227
1228
|
readonly NOT_READY: "503 retry | The target is starting, restarting, recovering or draining. | Retry after the Retry-After interval.";
|
|
1228
1229
|
readonly BACKEND_UNAVAILABLE: "503 retry | The agent backend did not answer. | Retry after the Retry-After interval.";
|
|
1229
1230
|
readonly MESSAGE_RETRIEVAL_UNAVAILABLE: "503 retry | Message storage did not answer. | Retry after the Retry-After interval.";
|
|
@@ -1245,6 +1246,7 @@ declare const ERROR_CATALOG: {
|
|
|
1245
1246
|
readonly BRANCH_PARENT_NOT_RUNNING: "409 final | The branch parent is not running. | Resume the parent sandbox, then branch again.";
|
|
1246
1247
|
readonly BRANCH_NOT_MATERIALIZED: "409 final | The branch parent was removed before any child materialized. | Branch a live sandbox with a new idempotency key.";
|
|
1247
1248
|
readonly CONTAINER_RESERVATION_CONFLICT: "409 retry | Another lifecycle operation holds this sandbox. | Wait for that operation to finish, then retry.";
|
|
1249
|
+
readonly CONTAINER_GENERATION_MISMATCH: "409 final | The stopped Docker generation differs from the sandbox checkpoint. | Resume the sandbox from its confirmed checkpoint.";
|
|
1248
1250
|
readonly CONTAINER_NETWORK_MISSING: "409 final | The stopped sandbox lost its network, so it cannot start in place; its files remain. | Resume the sandbox so the platform recreates it.";
|
|
1249
1251
|
readonly EGRESS_DISABLED: "409 final | Egress is not enabled on this host. | Place the sandbox on a host with egress enabled.";
|
|
1250
1252
|
readonly NATIVE_CAPTURE_UNAVAILABLE: "409 final | The host cannot prove the native capture image this create requires. | Retry on another host, or create without native capture.";
|
|
@@ -1253,6 +1255,7 @@ declare const ERROR_CATALOG: {
|
|
|
1253
1255
|
readonly SNAPSHOT_LIMIT_REACHED: "409 final | The sandbox holds as many snapshots as its plan allows. | Delete a snapshot of this sandbox, or move to a plan with a higher snapshot limit.";
|
|
1254
1256
|
readonly SNAPSHOT_NOT_SYNCED: "409 retry | The snapshot has not finished uploading. | Retry after the upload completes.";
|
|
1255
1257
|
readonly WARM_CLAIM_REMOVED: "409 final | Another lifecycle operation removed the claimed warm sandbox. | Create the sandbox again.";
|
|
1258
|
+
readonly GOLDEN_SEED_SPENT: "503 final | This warm-pool seed captured the golden snapshot and was retired, since its identity is in that memory. | Nothing to do; the pool's next seed restores from that snapshot.";
|
|
1256
1259
|
readonly WORKSPACE_STORAGE_MISSING: "409 final | The stopped sandbox storage is gone or replaced, so the host refused to start it. | Restore the sandbox from a snapshot.";
|
|
1257
1260
|
readonly RESTORE_QUOTA_EXCEEDED: "413 final | The snapshot is larger than the workspace quota. | Create with a larger disk, or restore a smaller snapshot.";
|
|
1258
1261
|
readonly GIT_CLONE_REFUSED: "422 final | The repository refused the clone credential, or the credential cannot see it. | Fix the git credential or repository URL, then create again.";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { O as ValidationError } from "./errors-
|
|
1
|
+
import { O as ValidationError } from "./errors-BuEDuIrs.js";
|
|
2
|
+
import { n as childTraceparent, t as TRACEPARENT_HEADER } from "./lifecycle-trace-CDGgSOVP.js";
|
|
3
|
+
import { toW3CTraceId } from "@tangle-network/agent-trace-contract/otlp";
|
|
2
4
|
//#region src/lib/runtime-env.ts
|
|
3
5
|
/**
|
|
4
6
|
* True inside a Cloudflare Worker. Under `nodejs_compat` workerd sets
|
|
@@ -80,5 +82,9 @@ function traceHeaders(traceId) {
|
|
|
80
82
|
if (traceId === void 0) return void 0;
|
|
81
83
|
return { [TRACE_ID_HEADER]: resolveTraceId(traceId) };
|
|
82
84
|
}
|
|
85
|
+
/** The SDK operation owns the context through its outer retries and polls. */
|
|
86
|
+
function lifecycleTraceHeaders(client, traceId) {
|
|
87
|
+
return client.lifecycleTraceContext !== false && typeof globalThis.crypto?.getRandomValues === "function" ? { [TRACEPARENT_HEADER]: childTraceparent(void 0, traceId ? toW3CTraceId(traceId) : void 0) } : {};
|
|
88
|
+
}
|
|
83
89
|
//#endregion
|
|
84
|
-
export {
|
|
90
|
+
export { resolveTraceId as a, canUseNodeHttp2 as c, mintTraceId as i, isBrowserRuntime as l, isTraceId as n, responseTraceId as o, lifecycleTraceHeaders as r, traceHeaders as s, TRACE_ID_HEADER as t, isCloudflareWorker as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as BatchBackendInput, B as SandboxErrorMetadata, Y as SandboxCreateReceipt, a as TerminalStreamOptions, g as TerminalReadyInfo, i as TerminalStreamHandlers, s as TerminalStreamToken, t as TerminalAttachTimings } from "./terminal-stream-types-
|
|
1
|
+
import { $ as BatchBackendInput, B as SandboxErrorMetadata, Y as SandboxCreateReceipt, a as TerminalStreamOptions, g as TerminalReadyInfo, i as TerminalStreamHandlers, s as TerminalStreamToken, t as TerminalAttachTimings } from "./terminal-stream-types-BMLdhwUQ.js";
|
|
2
2
|
import { C as InteractionRequest, D as AgentProfileConfidential, E as AgentProfileCapabilities, F as ProxySecretReceipt, N as AgentProfileValidationResult, P as ReasoningEffort, R as PlanContinuation, T as AgentProfile, n as SandboxSizePreset, v as AgentExactRunControlRef, x as AgentRuntimeAttachments } from "./index-V_pXOH3B.js";
|
|
3
3
|
import { r as CliAuthReference } from "./cli-auth-bundle-Dx3AAWdJ.js";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -2758,6 +2758,7 @@ interface HttpClient {
|
|
|
2758
2758
|
readonly onDirectRuntimeResponse?: DirectRuntimeResponseObserver | undefined;
|
|
2759
2759
|
/** False keeps exec on the API; see `SandboxConfig.directExec`. */
|
|
2760
2760
|
readonly directExec?: boolean;
|
|
2761
|
+
readonly lifecycleTraceContext?: boolean;
|
|
2761
2762
|
/** Cancels this client's requests, including direct runtime transports. */
|
|
2762
2763
|
readonly signal?: AbortSignal | undefined;
|
|
2763
2764
|
/** Default request deadline in ms, direct runtime calls included (`SDK_TIMEOUTS`). */
|
|
@@ -4000,6 +4001,8 @@ interface SandboxShapePreset {
|
|
|
4000
4001
|
/** Configure the HTTP client; runnable setup examples are in the SDK README. */
|
|
4001
4002
|
interface SandboxConfig {
|
|
4002
4003
|
apiKey: string;
|
|
4004
|
+
/** Send W3C trace context on Sandbox requests. Defaults to true. */
|
|
4005
|
+
lifecycleTraceContext?: boolean;
|
|
4003
4006
|
/** Platform profile-catalog URL; defaults to https://id.tangle.tools. */
|
|
4004
4007
|
platformUrl?: string;
|
|
4005
4008
|
baseUrl: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.510",
|
|
4
4
|
"description": "TypeScript SDK for Tangle Sandbox: create cloud sandboxes and run commands and coding agents in them",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"@tangle-network/runtime-contracts": "0.20.0"
|
|
164
164
|
},
|
|
165
165
|
"tangleRelease": {
|
|
166
|
-
"sourceSha": "
|
|
167
|
-
"mergedAt": "2026-11-20T12:
|
|
166
|
+
"sourceSha": "b5fe3ac40755e92bab425dcbece9e4e124a842b5",
|
|
167
|
+
"mergedAt": "2026-11-20T12:30:57-08:00"
|
|
168
168
|
},
|
|
169
169
|
"scripts": {
|
|
170
170
|
"build": "node scripts/build-dist.mjs && bash scripts/verify-dist.sh",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|