@tangle-network/agent-app 0.52.15 → 0.52.17

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ChatEmptyState,
3
3
  ChatMessages
4
- } from "../chunk-IK7JCJQF.js";
4
+ } from "../chunk-JHHNODBT.js";
5
5
  import "../chunk-FRABQIQ4.js";
6
6
  import "../chunk-3HUFJ5LO.js";
7
7
  import "../chunk-FBVLEGEG.js";
@@ -1415,6 +1415,25 @@ async function streamChatTurn(opts) {
1415
1415
  }
1416
1416
  }
1417
1417
 
1418
+ // src/web-react/turn-funding-recovery.ts
1419
+ function getChatFundingRecovery(failure) {
1420
+ const code = typeof failure === "object" && failure ? failure.code : void 0;
1421
+ const message = typeof failure === "string" ? failure : failure?.message ?? "";
1422
+ let reason;
1423
+ if (code === "insufficient_credits") reason = "insufficient_credits";
1424
+ else if (code === "paid_access_required" || code === "funding_required") reason = "paid_access_required";
1425
+ else if (/\binsufficient credits\b/i.test(message)) reason = "insufficient_credits";
1426
+ else if (/\binference requires verified paid access\b/i.test(message)) reason = "paid_access_required";
1427
+ if (!reason) return null;
1428
+ return {
1429
+ reason,
1430
+ title: reason === "insufficient_credits" ? "Insufficient credits" : "Paid access required",
1431
+ message: reason === "insufficient_credits" ? "Open billing to add funds before trying again." : "Open billing to check your funded balance or paid seat before trying again.",
1432
+ actionLabel: "Open billing",
1433
+ retryable: false
1434
+ };
1435
+ }
1436
+
1418
1437
  // src/web-react/agent-profile-editor.tsx
1419
1438
  import { useEffect as useEffect5, useId, useState as useState7 } from "react";
1420
1439
  import { agentProfileSchema } from "@tangle-network/agent-interface/profile-schema";
@@ -7036,6 +7055,7 @@ export {
7036
7055
  dispatchChatStreamLine,
7037
7056
  consumeChatStream,
7038
7057
  streamChatTurn,
7058
+ getChatFundingRecovery,
7039
7059
  AgentProfileEditor,
7040
7060
  AgentProfileViewer,
7041
7061
  DurablePlanClientError,
@@ -7138,4 +7158,4 @@ export {
7138
7158
  useThinkingSeconds,
7139
7159
  ChatMessages
7140
7160
  };
7141
- //# sourceMappingURL=chunk-IK7JCJQF.js.map
7161
+ //# sourceMappingURL=chunk-JHHNODBT.js.map