@tangle-network/agent-app 0.60.0 → 0.60.2

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.
@@ -42,7 +42,7 @@ import {
42
42
  flattenHistory,
43
43
  readSandboxBinaryBytes,
44
44
  statSandboxFileSize
45
- } from "../chunk-SUIHWGQT.js";
45
+ } from "../chunk-B6HZZ2Z3.js";
46
46
  import "../chunk-MCYJON3F.js";
47
47
  import "../chunk-LWSJK546.js";
48
48
  import "../chunk-ZYK3A2FR.js";
@@ -554,6 +554,17 @@ function isSandboxBoxConfigFailure(diagnostics) {
554
554
  return /has no recorded egress policy|cannot rebuild the proxy config/i.test(cause.message);
555
555
  });
556
556
  }
557
+ function isSandboxApiTransientFailure(diagnostics) {
558
+ if (isSandboxApiSandboxMissingFailure(diagnostics) || isSandboxBoxConfigFailure(diagnostics) || isSandboxHostCapacityFailure(diagnostics)) return false;
559
+ return diagnostics.causes.some((cause) => {
560
+ const status = typeof cause.status === "number" ? cause.status : typeof cause.status === "string" ? Number.parseInt(cause.status, 10) : void 0;
561
+ if (status !== 500 && status !== 502 && status !== 503 && status !== 504) return false;
562
+ if (cause.origin !== "sandbox-api" || typeof cause.endpoint !== "string") return false;
563
+ const endpointPath = sandboxApiEndpointPath(cause.endpoint);
564
+ if (!endpointPath || !/^\/v1(?:[/?#]|$)/.test(endpointPath)) return false;
565
+ return !/^\/v1\/sandboxes\/[^/?#]+\/runtime(?:[/?#]|$)/.test(endpointPath);
566
+ });
567
+ }
557
568
  function sandboxApiEndpointPath(endpoint) {
558
569
  if (endpoint.startsWith("/")) return endpoint;
559
570
  try {
@@ -570,6 +581,9 @@ function formatSandboxProvisioningUserMessage(diagnostics) {
570
581
  if (diagnostics.causes.some((cause) => cause.code === "vault.hydration_incomplete")) {
571
582
  return "I couldn't finish copying your Vault into the sandbox, so I stopped rather than work from a partial copy. The copy resumes where it left off \u2014 try again in a moment.";
572
583
  }
584
+ if (isSandboxApiTransientFailure(diagnostics)) {
585
+ return "The sandbox service didn't answer just now. Send your message again in a moment.";
586
+ }
573
587
  if (isSandboxApiBearerAuthFailure(diagnostics)) {
574
588
  return "I'm unable to reconnect to the sandbox because its sandbox API credential was rejected. Another request may have rotated the bearer used for this operation.";
575
589
  }
@@ -585,7 +599,7 @@ function formatSandboxProvisioningUserMessage(diagnostics) {
585
599
  if (diagnostics.causes.some((cause) => cause.code === "UPLOAD_BUDGET_EXHAUSTED")) {
586
600
  return "Too much attachment data is staged in the sandbox at once. Retry shortly.";
587
601
  }
588
- return "I'm unable to connect to the sandbox right now. This usually means the sandbox service is not configured or is temporarily unavailable.";
602
+ return "I'm unable to connect to the sandbox right now. Send your message again in a moment; if it keeps failing, share the support details with the team.";
589
603
  }
590
604
 
591
605
  // src/sandbox/workspace-sandbox-manager.ts
@@ -2831,6 +2845,7 @@ export {
2831
2845
  SANDBOX_BACKING_CONTAINER_MISSING_CODE,
2832
2846
  isSandboxApiSandboxMissingFailure,
2833
2847
  isSandboxHostCapacityFailure,
2848
+ isSandboxApiTransientFailure,
2834
2849
  formatSandboxProvisioningUserMessage,
2835
2850
  createWorkspaceSandboxManager,
2836
2851
  createSandboxTerminalConnectionRoute,
@@ -2896,4 +2911,4 @@ export {
2896
2911
  isTerminalPromptEvent,
2897
2912
  detectInteractiveQuestion
2898
2913
  };
2899
- //# sourceMappingURL=chunk-SUIHWGQT.js.map
2914
+ //# sourceMappingURL=chunk-B6HZZ2Z3.js.map