@tangle-network/sandbox 1.0.509 → 1.0.511

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.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +5 -5
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/agent/preview.js +2 -2
  6. package/dist/{agent-run-outcome-IWbQgIbt.d.ts → agent-run-outcome-hucdyrR6.d.ts} +1 -1
  7. package/dist/{api-request-CJ9M-TN7.js → api-request-C-WGI8Tv.js} +12 -4
  8. package/dist/auth/index.js +2 -2
  9. package/dist/{browser-interactive-control-controller-CNqYrsK-.d.ts → browser-interactive-control-controller-CD8b8KFn.d.ts} +1 -1
  10. package/dist/{browser-interactive-control-controller-cfE_Hhvr.js → browser-interactive-control-controller-ZgflEMgw.js} +1 -1
  11. package/dist/{chunked-upload-6M8Y9Sry.js → chunked-upload-ClIgZBWm.js} +3 -3
  12. package/dist/{chunked-upload-file-BAqjjSIN.js → chunked-upload-file-rgkPRmQb.js} +2 -2
  13. package/dist/cli-auth-bundle-ECDHagkC.js +2 -0
  14. package/dist/{client-DL_Q0ixz.js → client-Bh0fgYe6.js} +50 -36
  15. package/dist/{client-Bb4VO8Tv.d.ts → client-DFaxpuf9.d.ts} +6 -5
  16. package/dist/collaboration/index.js +1 -1
  17. package/dist/{collaboration-ZcNePxyN.js → collaboration-3qrTMyna.js} +2 -2
  18. package/dist/core.d.ts +6 -6
  19. package/dist/core.js +6 -6
  20. package/dist/{direct-http2-Dm88_AQC.js → direct-http2-Drov3Qp5.js} +2 -2
  21. package/dist/{error-catalog-DMNep7Y3.js → error-catalog-DwxHMZQZ.js} +3 -0
  22. package/dist/{errors-CgHRBUnE.js → errors-BuEDuIrs.js} +1 -1
  23. package/dist/{file-download-CeikrxZL.js → file-download-BEPpLHi7.js} +1 -1
  24. package/dist/gpu-lease/index.js +2 -2
  25. package/dist/{index-D7dMz_US.d.ts → index-CtrSdLo2.d.ts} +9 -8
  26. package/dist/index.d.ts +9 -9
  27. package/dist/index.js +14 -14
  28. package/dist/intelligence/index.js +4 -4
  29. package/dist/interactive-control.d.ts +1 -1
  30. package/dist/interactive-control.js +1 -1
  31. package/dist/{interactive-controller-zv5TV56E.js → interactive-controller-BqkP064x.js} +6 -6
  32. package/dist/{interactive-controller-RKI6dXBi.d.ts → interactive-controller-DJpf6ofh.d.ts} +3 -3
  33. package/dist/{keep-alive-fetch-DjzdPAP3.js → keep-alive-fetch-xLyOpHAc.js} +1 -1
  34. package/dist/lib/prepared-evidence.js +1 -1
  35. package/dist/lib/prepared-process.js +1 -1
  36. package/dist/lifecycle-trace-CDGgSOVP.js +36 -0
  37. package/dist/{lines-DkfkbLSV.d.ts → lines-Ce4UmKfm.d.ts} +1 -1
  38. package/dist/{lines-CdfEanMh.js → lines-D3DKzzQT.js} +1 -1
  39. package/dist/lines.d.ts +1 -1
  40. package/dist/lines.js +1 -1
  41. package/dist/{local-cli-auth-CueE1l0F.js → local-cli-auth-BVXWKaty.js} +1 -1
  42. package/dist/{mcp-local-LIZ1E1uA.js → mcp-local-BbtNT6Nh.js} +4 -4
  43. package/dist/{prepared-evidence-BMADfSad.js → prepared-evidence-BKtdRWT7.js} +1 -1
  44. package/dist/{prepared-process-B4DuLmEg.js → prepared-process-ZCv_G1q4.js} +1 -1
  45. package/dist/{preview-tqaVk0Af.d.ts → preview-C4nOdGvR.d.ts} +3 -3
  46. package/dist/{public-templates-maL22HQt.d.ts → public-templates-GebzRZgV.d.ts} +2 -2
  47. package/dist/public-templates.d.ts +1 -1
  48. package/dist/public-templates.js +1 -1
  49. package/dist/{raw-evidence-archive-GuIfCwo8.js → raw-evidence-archive-_aeJodxs.js} +3 -3
  50. package/dist/runtime.d.ts +5 -5
  51. package/dist/runtime.js +5 -5
  52. package/dist/{sandbox-BTTAoCMR.js → sandbox-DRZhN_Vu.js} +91 -44
  53. package/dist/{secp256k1-DIwypP5B.js → secp256k1-B2arMxku.js} +1 -1
  54. package/dist/{select-seat-Cq1LrUG-.js → select-seat-D_L4pss9.js} +3 -3
  55. package/dist/select-seat-command.d.ts +2 -2
  56. package/dist/select-seat-command.js +2 -2
  57. package/dist/session-gateway/index.js +2 -2
  58. package/dist/tangle/index.d.ts +1 -1
  59. package/dist/tangle/index.js +2 -2
  60. package/dist/{tangle-DBx6JdWz.js → tangle-FnB8JXIv.js} +6 -6
  61. package/dist/{terminal-stream-types-RAsy75gD.d.ts → terminal-stream-types-BMLdhwUQ.d.ts} +3 -0
  62. package/dist/{trace-id-8KPKajMl.js → trace-id-DX218plN.js} +8 -2
  63. package/dist/{types-5by8R76_.d.ts → types-DOngB_Rs.d.ts} +4 -1
  64. package/package.json +7 -7
  65. package/dist/cli-auth-bundle-DqIHmlbG.js +0 -2
  66. /package/dist/{abi-pcDt2Adp.js → abi-CQYNCS4F.js} +0 -0
  67. /package/dist/{cli-auth-bundle-CXI4ysvr-DMV1Pos7.js → cli-auth-bundle-CXI4ysvr-CGgx1JDO.js} +0 -0
  68. /package/dist/{core-CBWUEURz.js → core-BWiEs9yv.js} +0 -0
  69. /package/dist/{file-transfer-DOSTbUSR.js → file-transfer-CnCWFYua.js} +0 -0
  70. /package/dist/{preview-operations-BTHZR1w2.js → preview-operations-DYH3y0cn.js} +0 -0
  71. /package/dist/{raw-evidence-export-Dog7W5zP.js → raw-evidence-export-gCbAD5ZV.js} +0 -0
  72. /package/dist/{retry-policy-oW3_ljoc.js → retry-policy-BlkQJ7_e.js} +0 -0
  73. /package/dist/{sse-parser-BCG3iL9j.js → sse-parser-DTgSRcZC.js} +0 -0
  74. /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-zv5TV56E.js";
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-BqkP064x.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-cfE_Hhvr.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-ZgflEMgw.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-CgHRBUnE.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-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 { 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-CJ9M-TN7.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, t as isInsideReservedDir$1, u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-DOSTbUSR.js";
12
- import { c as uploadChunked, l as awaitSdkResend, u as takeSdkTurn } from "./chunked-upload-6M8Y9Sry.js";
13
- import { i as resolveTraceId, n as isTraceId, r as mintTraceId, s as canUseNodeHttp2, t as TRACE_ID_HEADER } from "./trace-id-8KPKajMl.js";
14
- import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-DjzdPAP3.js";
15
- import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
16
- import { t as runPreparedProcess } from "./prepared-process-B4DuLmEg.js";
17
- import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-CXI4ysvr-DMV1Pos7.js";
18
- import "./cli-auth-bundle-DqIHmlbG.js";
19
- import { n as SandboxLines } from "./lines-CdfEanMh.js";
20
- import { t as downloadFile } from "./file-download-CeikrxZL.js";
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-C-WGI8Tv.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: { Authorization: `Bearer ${grant.token}` },
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-Dm88_AQC.js").then(({ preconnectDirectHttp2 }) => preconnectDirectHttp2(origin)).catch(() => {});
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,10 +3118,12 @@ 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-Dm88_AQC.js") : { fetchDirectHttp2: fetchWithKeepAlive };
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,
3126
+ traceIdOf: toW3CTraceId,
3115
3127
  timeoutError: (ms, phase) => {
3116
3128
  if (this.edgeFirst && (phase === "body" || method === "GET")) this.edgeCooldownUntil = Date.now() + EDGE_COOLDOWN_MS;
3117
3129
  return new TimeoutError(`Request timed out after ${ms}ms`, {
@@ -3134,6 +3146,8 @@ var DirectRuntimeHttpClient = class {
3134
3146
  const value = response.headers.get(name);
3135
3147
  if (value !== null) headers.set(name, value);
3136
3148
  }
3149
+ const parent = parseTraceparent(response.headers.get(TRACEPARENT_HEADER));
3150
+ if (parent) headers.set(TRACEPARENT_HEADER, `00-${parent.traceId}-${parent.spanId}-${parent.flags}`);
3137
3151
  observe(path, {
3138
3152
  status: response.status,
3139
3153
  headers
@@ -3297,12 +3311,14 @@ function isTerminalOperation(info) {
3297
3311
  var SandboxOperation = class SandboxOperation {
3298
3312
  #info;
3299
3313
  #client;
3314
+ #traceHeaders;
3300
3315
  #onSettled;
3301
3316
  #settled = false;
3302
- constructor(info, client, onSettled) {
3317
+ constructor(info, client, onSettled, traceHeaders) {
3303
3318
  this.#info = info;
3304
3319
  this.#client = client;
3305
3320
  this.#onSettled = onSettled;
3321
+ this.#traceHeaders = traceHeaders;
3306
3322
  }
3307
3323
  static completed(kind, sandboxId, result) {
3308
3324
  const now = /* @__PURE__ */ new Date();
@@ -3343,7 +3359,10 @@ var SandboxOperation = class SandboxOperation {
3343
3359
  if (until) params.set("until", "removed");
3344
3360
  if (waitMs) params.set("waitMs", String(waitMs));
3345
3361
  const query = params.size ? `?${params}` : "";
3346
- const response = await this.#client.fetch(`/v1/sandboxes/${encodeURIComponent(this.#info.sandboxId)}/operations/${encodeURIComponent(this.#info.id)}${query}`, { signal }, { timeoutMs });
3362
+ const response = await this.#client.fetch(`/v1/sandboxes/${encodeURIComponent(this.#info.sandboxId)}/operations/${encodeURIComponent(this.#info.id)}${query}`, {
3363
+ signal,
3364
+ headers: this.#traceHeaders
3365
+ }, { timeoutMs });
3347
3366
  if (!response.ok) throw await parseResponseError(response);
3348
3367
  this.#info = parseSandboxOperation(await response.json(), {
3349
3368
  kind: this.#info.kind,
@@ -3733,6 +3752,7 @@ const ERROR_CATALOG = {
3733
3752
  UPSTREAM_ERROR: "502 retry | An upstream service failed or answered outside its contract. | Retry with backoff; report the request id if it persists.",
3734
3753
  UNAVAILABLE: "503 retry | A dependency or capacity is temporarily unavailable. | Retry after the Retry-After interval.",
3735
3754
  UPSTREAM_UNAVAILABLE: "503 retry | The sandbox controller did not answer, or answered without a code the catalog knows. | Retry after the Retry-After interval.",
3755
+ CONTROLLER_RESTARTING: "503 retry | The controller is restarting. | Retry reads or repeat with the same operation key. Check unkeyed writes before repeating them.",
3736
3756
  NOT_READY: "503 retry | The target is starting, restarting, recovering or draining. | Retry after the Retry-After interval.",
3737
3757
  BACKEND_UNAVAILABLE: "503 retry | The agent backend did not answer. | Retry after the Retry-After interval.",
3738
3758
  MESSAGE_RETRIEVAL_UNAVAILABLE: "503 retry | Message storage did not answer. | Retry after the Retry-After interval.",
@@ -3754,6 +3774,7 @@ const ERROR_CATALOG = {
3754
3774
  BRANCH_PARENT_NOT_RUNNING: "409 final | The branch parent is not running. | Resume the parent sandbox, then branch again.",
3755
3775
  BRANCH_NOT_MATERIALIZED: "409 final | The branch parent was removed before any child materialized. | Branch a live sandbox with a new idempotency key.",
3756
3776
  CONTAINER_RESERVATION_CONFLICT: "409 retry | Another lifecycle operation holds this sandbox. | Wait for that operation to finish, then retry.",
3777
+ CONTAINER_GENERATION_MISMATCH: "409 final | The stopped Docker generation differs from the sandbox checkpoint. | Resume the sandbox from its confirmed checkpoint.",
3757
3778
  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
3779
  EGRESS_DISABLED: "409 final | Egress is not enabled on this host. | Place the sandbox on a host with egress enabled.",
3759
3780
  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 +3783,7 @@ const ERROR_CATALOG = {
3762
3783
  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
3784
  SNAPSHOT_NOT_SYNCED: "409 retry | The snapshot has not finished uploading. | Retry after the upload completes.",
3764
3785
  WARM_CLAIM_REMOVED: "409 final | Another lifecycle operation removed the claimed warm sandbox. | Create the sandbox again.",
3786
+ 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
3787
  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
3788
  RESTORE_QUOTA_EXCEEDED: "413 final | The snapshot is larger than the workspace quota. | Create with a larger disk, or restore a smaller snapshot.",
3767
3789
  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 +12464,7 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
12442
12464
  async stop(options) {
12443
12465
  options?.signal?.throwIfAborted();
12444
12466
  const local = state(this);
12467
+ const trace = lifecycleTraceHeaders(local.client);
12445
12468
  const noWait = options?.wait === false;
12446
12469
  const sourceCreatedAt = options?.retain?.publication ? local.info.createdAt.toISOString() : void 0;
12447
12470
  const sourceIncarnation = local.info.filesystemIncarnationId;
@@ -12450,17 +12473,18 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
12450
12473
  ...options?.signal ? { signal: options.signal } : {},
12451
12474
  method: "POST",
12452
12475
  ...options?.retain ? { body: JSON.stringify({ retain: options.retain }) } : {},
12453
- ...options?.idempotencyKey || options?.retain?.publication ? { headers: {
12454
- ...options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {},
12455
- ...options.retain?.publication ? { "x-no-retry": "1" } : {}
12456
- } } : {}
12476
+ headers: {
12477
+ ...trace,
12478
+ ...options?.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {},
12479
+ ...options?.retain?.publication ? { "x-no-retry": "1" } : {}
12480
+ }
12457
12481
  }, options?.retain ? { timeoutMs: SDK_TIMEOUTS.snapshot } : void 0), options?.signal ? { signal: options.signal } : {}, options?.retain?.publication ? () => false : isLifecycleConflict);
12458
12482
  if (noWait && response.status === 202) return new SandboxOperation(parseSandboxOperation((await readResponseJson(response)).operation, {
12459
12483
  kind: "stop",
12460
12484
  sandboxId: this.id
12461
12485
  }), local.client, async (done) => {
12462
12486
  if (!this.applyLifecycleResponse(done.result?.sandbox ?? null)) await this.refresh();
12463
- });
12487
+ }, trace);
12464
12488
  const data = await this.readLifecycleResponse(response);
12465
12489
  const diagnostics = normalizeStartupDiagnostics(data.startupDiagnostics);
12466
12490
  if (diagnostics) local.info.startupDiagnostics = diagnostics;
@@ -12504,12 +12528,16 @@ var SandboxLifecycleCapabilities = class extends SandboxLifecycleEventsCapabilit
12504
12528
  async resumeRuntime(operation, options) {
12505
12529
  const local = state(this);
12506
12530
  if (options.timeoutMs !== void 0 && (!Number.isFinite(options.timeoutMs) || options.timeoutMs <= 0)) throw new ValidationError("resume timeoutMs must be a positive number");
12531
+ const trace = lifecycleTraceHeaders(local.client);
12507
12532
  const timeoutSignal = options.timeoutMs ? AbortSignal.timeout(options.timeoutMs) : void 0;
12508
12533
  const signal = combineAbortSignals([options.signal, timeoutSignal]);
12509
12534
  const response = await withLifecycleConflictRetry(async () => {
12510
12535
  const requestOptions = {
12511
12536
  method: "POST",
12512
- headers: { [SANDBOX_CREATE_DEADLINE_HEADER]: String(Date.now() + (options.timeoutMs ?? SDK_TIMEOUTS.default)) },
12537
+ headers: {
12538
+ ...trace,
12539
+ [SANDBOX_CREATE_DEADLINE_HEADER]: String(Date.now() + (options.timeoutMs ?? SDK_TIMEOUTS.default))
12540
+ },
12513
12541
  ...options.env ? { body: JSON.stringify({ env: options.env }) } : {},
12514
12542
  ...signal ? { signal } : {}
12515
12543
  };
@@ -12535,6 +12563,7 @@ async function deleteSandbox(client, id, options, observe) {
12535
12563
  });
12536
12564
  options?.signal?.throwIfAborted();
12537
12565
  const path = `/v1/sandboxes/${encodeURIComponent(id)}?wait=false${options?.until === "removed" ? "&until=removed" : ""}`;
12566
+ const trace = lifecycleTraceHeaders(client);
12538
12567
  let retried = false;
12539
12568
  let response;
12540
12569
  try {
@@ -12542,6 +12571,7 @@ async function deleteSandbox(client, id, options, observe) {
12542
12571
  method: "DELETE",
12543
12572
  ...options?.signal ? { signal: options.signal } : {},
12544
12573
  headers: {
12574
+ ...trace,
12545
12575
  "x-no-retry": "1",
12546
12576
  ...options?.wait === false && options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}
12547
12577
  }
@@ -12564,7 +12594,7 @@ async function deleteSandbox(client, id, options, observe) {
12564
12594
  sandboxId: id
12565
12595
  }), client, () => {
12566
12596
  observe?.();
12567
- });
12597
+ }, trace);
12568
12598
  if (options?.wait === false) return operation;
12569
12599
  const done = await operation.wait(options?.signal ? { signal: options.signal } : {});
12570
12600
  return {
@@ -15821,7 +15851,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
15821
15851
  var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabilities {
15822
15852
  /** @internal — invoked before the sandbox is deleted. */
15823
15853
  async _sessionExportRawEvidence(id, destination, options) {
15824
- const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-GuIfCwo8.js");
15854
+ const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-_aeJodxs.js");
15825
15855
  await this.ensureRunning();
15826
15856
  await this.refresh();
15827
15857
  return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
@@ -15852,7 +15882,7 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
15852
15882
  * and the byte and file bounds are verified before the directory appears.
15853
15883
  */
15854
15884
  async exportRawEvidence(destination, options) {
15855
- const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-GuIfCwo8.js");
15885
+ const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-_aeJodxs.js");
15856
15886
  await this.ensureRunning();
15857
15887
  await this.refresh();
15858
15888
  return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
@@ -16890,6 +16920,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
16890
16920
  await this.ensureRunning();
16891
16921
  const data = await readResponseJson(await this.runtimeFetch("/snapshots", {
16892
16922
  method: "POST",
16923
+ headers: lifecycleTraceHeaders(state(this).client),
16893
16924
  body: JSON.stringify({
16894
16925
  projectId: this.id,
16895
16926
  storage: options.storage,
@@ -16919,10 +16950,14 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
16919
16950
  }
16920
16951
  /** Asynchronous acceptance returns an operation; synchronous capture returns a succeeded operation. */
16921
16952
  async #requestSnapshotOperation(options) {
16953
+ const trace = lifecycleTraceHeaders(state(this).client);
16922
16954
  const query = options.wait === false ? "wait=false" : `wait=false&waitMs=${SNAPSHOT_HOLD_MS}`;
16923
16955
  const response = await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots?${query}`, {
16924
16956
  method: "POST",
16925
- ...options.idempotencyKey ? { headers: { "Idempotency-Key": options.idempotencyKey } } : {},
16957
+ headers: {
16958
+ ...trace,
16959
+ ...options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}
16960
+ },
16926
16961
  body: JSON.stringify({ tags: options.tags })
16927
16962
  }, { timeoutMs: SDK_TIMEOUTS.snapshot });
16928
16963
  const body = await readResponseJson(response);
@@ -16930,7 +16965,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
16930
16965
  if (response.status === 202) return [new SandboxOperation(parseSandboxOperation(body.operation, {
16931
16966
  kind: "snapshot",
16932
16967
  sandboxId: this.id
16933
- }), state(this).client), idempotency];
16968
+ }), state(this).client, void 0, trace), idempotency];
16934
16969
  const snapshotId = body.snapshotId ?? body.id;
16935
16970
  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
16971
  const snapshot = toSnapshotResult({
@@ -16945,6 +16980,9 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
16945
16980
  }
16946
16981
  /** List snapshots; storage selects the direct customer-S3 path. */
16947
16982
  async listSnapshots(storage) {
16983
+ return this.readSnapshotList(storage);
16984
+ }
16985
+ async readSnapshotList(storage, trace) {
16948
16986
  if (storage) await this.ensureRunning();
16949
16987
  const data = await readResponseJson(storage ? await this.runtimeFetch("/snapshots/list", {
16950
16988
  method: "POST",
@@ -16952,7 +16990,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
16952
16990
  projectId: this.id,
16953
16991
  storage
16954
16992
  })
16955
- }) : await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots`));
16993
+ }) : await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots`, { headers: trace }));
16956
16994
  return (Array.isArray(data) ? data : data.snapshots ?? []).map((s) => {
16957
16995
  const remoteSync = toSnapshotRemoteSync(s.remoteSync);
16958
16996
  return {
@@ -17045,18 +17083,22 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
17045
17083
  }
17046
17084
  /** One keyed restore: a transport re-send joins its job; a 202 settles from that job. */
17047
17085
  async restoreSnapshot(snapshotId, init) {
17048
- const headers = { "Idempotency-Key": generateIdempotencyKey() };
17086
+ const trace = lifecycleTraceHeaders(state(this).client);
17087
+ const headers = {
17088
+ ...trace,
17089
+ "Idempotency-Key": generateIdempotencyKey()
17090
+ };
17049
17091
  const response = await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots/${encodeURIComponent(snapshotId)}/restore?waitMs=${SNAPSHOT_HOLD_MS}`, {
17050
17092
  method: "POST",
17051
17093
  headers,
17052
17094
  ...init
17053
17095
  }, { timeoutMs: SDK_TIMEOUTS.snapshot });
17054
17096
  const data = await readResponseJson(response);
17055
- if (response.status === 202) return this.waitForSnapshotRestore(snapshotId, data);
17097
+ if (response.status === 202) return this.waitForSnapshotRestore(snapshotId, data, trace);
17056
17098
  return toSnapshotResult(data, state(this).profileProvenance);
17057
17099
  }
17058
17100
  /** Read the accepted restore job first; poll only while unfinished. */
17059
- async waitForSnapshotRestore(snapshotId, accepted) {
17101
+ async waitForSnapshotRestore(snapshotId, accepted, trace) {
17060
17102
  const deadline = Date.now() + SDK_TIMEOUTS.snapshot;
17061
17103
  let status = accepted;
17062
17104
  let polledAt = 0;
@@ -17071,21 +17113,21 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
17071
17113
  ...restored.sizeBytes === void 0 ? {} : { sizeBytes: restored.sizeBytes },
17072
17114
  tags: restored.tags
17073
17115
  };
17074
- return await this.waitForSnapshotVisible(snapshotId, status.completedAt ? { createdAt: new Date(status.completedAt) } : void 0);
17116
+ return await this.waitForSnapshotVisible(snapshotId, status.completedAt ? { createdAt: new Date(status.completedAt) } : void 0, trace);
17075
17117
  }
17076
17118
  const heldMs = Date.now() - polledAt;
17077
17119
  if (heldMs < SNAPSHOT_RESTORE_POLL_FLOOR_MS) await abortableSleep(SNAPSHOT_RESTORE_POLL_FLOOR_MS - heldMs);
17078
17120
  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}`));
17121
+ status = await readResponseJson(await state(this).client.fetch(`/v1/sandboxes/${this.id}/snapshots/jobs/${encodeURIComponent(accepted.jobId)}?waitMs=${SNAPSHOT_HOLD_MS}`, { headers: trace }));
17080
17122
  }
17081
17123
  throw new TimeoutError(`Request timed out after ${SDK_TIMEOUTS.snapshot}ms`, { timeoutMs: SDK_TIMEOUTS.snapshot });
17082
17124
  }
17083
- async waitForSnapshotVisible(snapshotId, fallback) {
17125
+ async waitForSnapshotVisible(snapshotId, fallback, trace) {
17084
17126
  const deadline = Date.now() + SNAPSHOT_VISIBILITY_TIMEOUT_MS;
17085
17127
  let lastError;
17086
17128
  while (Date.now() < deadline) {
17087
17129
  try {
17088
- const snapshot = (await this.listSnapshots()).find((item) => item.snapshotId === snapshotId);
17130
+ const snapshot = (await this.readSnapshotList(void 0, trace)).find((item) => item.snapshotId === snapshotId);
17089
17131
  if (snapshot) return {
17090
17132
  snapshotId: snapshot.snapshotId,
17091
17133
  createdAt: snapshot.createdAt,
@@ -17113,6 +17155,7 @@ var SandboxSnapshotCapabilities = class extends SandboxTurnCapabilities {
17113
17155
  await this.ensureRunning();
17114
17156
  const response = await this.runtimeFetch("/snapshots/restore", {
17115
17157
  method: "POST",
17158
+ headers: lifecycleTraceHeaders(state(this).client),
17116
17159
  body: JSON.stringify({
17117
17160
  projectId: this.id,
17118
17161
  storage,
@@ -17966,7 +18009,7 @@ var SandboxFilesystemOperations = class extends DeclaredFilesystemOperations {
17966
18009
  totalBytes: size,
17967
18010
  percentage: 0
17968
18011
  });
17969
- const { uploadChunkedFromFile } = await import("./chunked-upload-file-BAqjjSIN.js");
18012
+ const { uploadChunkedFromFile } = await import("./chunked-upload-file-rgkPRmQb.js");
17970
18013
  await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
17971
18014
  mode: options?.permissions,
17972
18015
  onProgress: options?.onProgress ? (progress) => {
@@ -18807,9 +18850,13 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
18807
18850
  env: options?.env,
18808
18851
  metadata: options?.metadata
18809
18852
  });
18853
+ const trace = lifecycleTraceHeaders(local.client);
18810
18854
  const data = await retryForkRefusal(async () => readResponseJson(await local.client.fetch(`/v1/sandboxes/${this.id}/branch`, {
18811
18855
  method: "POST",
18812
- headers: { "Idempotency-Key": idempotencyKey },
18856
+ headers: {
18857
+ ...trace,
18858
+ "Idempotency-Key": idempotencyKey
18859
+ },
18813
18860
  body
18814
18861
  })));
18815
18862
  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-BvN0Mk3j.js";
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-CgHRBUnE.js";
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-DMV1Pos7.js";
6
- import "./cli-auth-bundle-DqIHmlbG.js";
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-RAsy75gD.js";
2
- import { _t as SeatOwnerTransport, bt as SeatSelectionRequest, ft as SEAT_COMMAND_TIMEOUT_MS } from "./client-Bb4VO8Tv.js";
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-CgHRBUnE.js";
2
- import { r as SEAT_OWNER_MAX_RESPONSE_BYTES, s as seatOwnerTimeoutMs, t as SEAT_COMMAND_TIMEOUT_MS } from "./select-seat-Cq1LrUG-.js";
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-CJ9M-TN7.js";
4
- import { t as parseSSEStream } from "../sse-parser-BCG3iL9j.js";
3
+ import { i as fetchSandboxApi } from "../api-request-C-WGI8Tv.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
  /**
@@ -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-D7dMz_US.js";
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 };
@@ -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-DBx6JdWz.js";
2
- import { t as ITangleJobsAbi } from "../abi-pcDt2Adp.js";
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-FnB8JXIv.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-BTTAoCMR.js";
2
- import { a as readResponseJson } from "./errors-CgHRBUnE.js";
3
- import { i as fetchSandboxApi } from "./api-request-CJ9M-TN7.js";
4
- import { t as ITangleJobsAbi } from "./abi-pcDt2Adp.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-BvN0Mk3j.js";
1
+ import { R as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-DRZhN_Vu.js";
2
+ import { a as readResponseJson } from "./errors-BuEDuIrs.js";
3
+ import { i as fetchSandboxApi } from "./api-request-C-WGI8Tv.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-DIwypP5B.js");
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-CgHRBUnE.js";
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 { responseTraceId as a, isBrowserRuntime as c, resolveTraceId as i, isCloudflareWorker as l, isTraceId as n, traceHeaders as o, mintTraceId as r, canUseNodeHttp2 as s, TRACE_ID_HEADER as t };
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-RAsy75gD.js";
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.509",
3
+ "version": "1.0.511",
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": [
@@ -156,15 +156,15 @@
156
156
  "vitest": "^4.1.12",
157
157
  "ws": "^8.22.0",
158
158
  "yjs": "13.6.33",
159
- "@repo/shared": "0.0.0",
160
- "@tangle-network/agent-profile-materialize": "0.27.1",
161
- "@tangle-network/cli-agent-registry": "0.15.0",
162
159
  "@products/sandbox-test-utils": "0.0.0",
163
- "@tangle-network/runtime-contracts": "0.20.0"
160
+ "@tangle-network/cli-agent-registry": "0.15.0",
161
+ "@repo/shared": "0.0.0",
162
+ "@tangle-network/runtime-contracts": "0.20.0",
163
+ "@tangle-network/agent-profile-materialize": "0.27.1"
164
164
  },
165
165
  "tangleRelease": {
166
- "sourceSha": "e942aa55e27f2b7c248eae5ac853cbed6f2d92df",
167
- "mergedAt": "2026-11-20T12:14:42-08:00"
166
+ "sourceSha": "af3c2fb01379fbaac106b41f6c5c3a2b3e22b7aa",
167
+ "mergedAt": "2026-11-20T12:50:31-08:00"
168
168
  },
169
169
  "scripts": {
170
170
  "build": "node scripts/build-dist.mjs && bash scripts/verify-dist.sh",
@@ -1,2 +0,0 @@
1
- import "./cli-auth-bundle-CXI4ysvr-DMV1Pos7.js";
2
- export {};