@tangle-network/agent-app 0.46.19 → 0.46.20

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.
@@ -112,7 +112,7 @@ import {
112
112
  flattenHistory,
113
113
  readSandboxBinaryBytes,
114
114
  statSandboxFileSize
115
- } from "../chunk-HDQWY5AY.js";
115
+ } from "../chunk-G6A4BEZI.js";
116
116
  import "../chunk-TH7L265V.js";
117
117
  import "../chunk-LWSJK546.js";
118
118
  import "../chunk-P5PIAQVS.js";
@@ -511,7 +511,8 @@ function isSandboxApiBearerAuthFailure(diagnostics) {
511
511
  return /^\/v1\/sandboxes\/[^/?#]+(?:\/(?!runtime(?:[/?#]|$))[^?#]*)?(?:[?#].*)?$/.test(endpointPath);
512
512
  });
513
513
  }
514
- function isSandboxBackingContainerMissingMessage(message) {
514
+ var SANDBOX_BACKING_CONTAINER_MISSING_CODE = "BACKING_CONTAINER_MISSING";
515
+ function isLegacySandboxBackingContainerMissingMessage(message) {
515
516
  return /host-agent startcontainer failed \(404\):/i.test(message) && /container not found/i.test(message) && /"code"\s*:\s*"not_found"/i.test(message);
516
517
  }
517
518
  function isSandboxApiSandboxMissingFailure(diagnostics) {
@@ -527,8 +528,11 @@ function isSandboxApiSandboxMissingFailure(diagnostics) {
527
528
  if (status !== 500 || !/^\/v1\/sandboxes\/[^/?#]+\/resume(?:[?#].*)?$/.test(endpointPath)) {
528
529
  return false;
529
530
  }
531
+ const code = typeof cause.code === "string" ? cause.code.toUpperCase() : void 0;
532
+ if (code === SANDBOX_BACKING_CONTAINER_MISSING_CODE) return true;
533
+ if (code !== void 0 && code !== "SERVER_ERROR") return false;
530
534
  const message = typeof cause.message === "string" ? cause.message : "";
531
- return isSandboxBackingContainerMissingMessage(message);
535
+ return isLegacySandboxBackingContainerMissingMessage(message);
532
536
  });
533
537
  }
534
538
  function isSandboxHostCapacityFailure(diagnostics) {
@@ -1616,10 +1620,12 @@ async function isReusableBox(box, harness, probe) {
1616
1620
  }
1617
1621
  function stoppedBoxResumeError(box, cause) {
1618
1622
  const error = cause instanceof Error ? cause : new Error(String(cause));
1619
- if (!isSandboxBackingContainerMissingMessage(error.message)) return cause;
1623
+ const code = error.code;
1624
+ if (code === SANDBOX_BACKING_CONTAINER_MISSING_CODE) return cause;
1625
+ if (code !== void 0 && code !== "SERVER_ERROR") return cause;
1626
+ if (!isLegacySandboxBackingContainerMissingMessage(error.message)) return cause;
1620
1627
  const status = typeof cause === "object" && cause !== null ? cause.status : void 0;
1621
1628
  if (typeof status !== "number" && typeof status !== "string") return cause;
1622
- const code = error.code;
1623
1629
  const wrapped = new Error(error.message, { cause: error });
1624
1630
  wrapped.name = error.name;
1625
1631
  return Object.assign(wrapped, {
@@ -2412,6 +2418,7 @@ export {
2412
2418
  formatSandboxProvisioningSupportDetails,
2413
2419
  isSandboxAuthFailure,
2414
2420
  isSandboxApiBearerAuthFailure,
2421
+ SANDBOX_BACKING_CONTAINER_MISSING_CODE,
2415
2422
  isSandboxApiSandboxMissingFailure,
2416
2423
  isSandboxHostCapacityFailure,
2417
2424
  formatSandboxProvisioningUserMessage,
@@ -2472,4 +2479,4 @@ export {
2472
2479
  isTerminalPromptEvent,
2473
2480
  detectInteractiveQuestion
2474
2481
  };
2475
- //# sourceMappingURL=chunk-HDQWY5AY.js.map
2482
+ //# sourceMappingURL=chunk-G6A4BEZI.js.map