@tangle-network/agent-app 4.0.8 → 4.0.11

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 (63) hide show
  1. package/dist/assistant/index.js +2 -1
  2. package/dist/assistant/index.js.map +1 -1
  3. package/dist/billing/identity-bound.d.ts +7 -0
  4. package/dist/billing/index.d.ts +1 -1
  5. package/dist/billing/index.js +3 -1
  6. package/dist/chat-routes/detached-turn.d.ts +2 -0
  7. package/dist/chat-routes/failure-wording.d.ts +61 -0
  8. package/dist/chat-routes/index.js +30 -22
  9. package/dist/chat-routes/index.js.map +1 -1
  10. package/dist/chat-routes/sandbox-producer.d.ts +6 -14
  11. package/dist/chat-routes/turn-event-stream.d.ts +5 -0
  12. package/dist/chat-routes/turn-route-contracts.d.ts +23 -0
  13. package/dist/chat-routes/turn-routes.d.ts +3 -1
  14. package/dist/{chunk-R5PW3FO4.js → chunk-2IGXFHUO.js} +13 -2
  15. package/dist/chunk-2IGXFHUO.js.map +1 -0
  16. package/dist/{chunk-4OR7NNYB.js → chunk-CD4SJXYC.js} +125 -730
  17. package/dist/chunk-CD4SJXYC.js.map +1 -0
  18. package/dist/{chunk-FTGKXM7O.js → chunk-EK7A5Y7P.js} +12 -4
  19. package/dist/chunk-EK7A5Y7P.js.map +1 -0
  20. package/dist/{chunk-FZOHBYGV.js → chunk-KPCNNFBO.js} +13 -2
  21. package/dist/chunk-KPCNNFBO.js.map +1 -0
  22. package/dist/{chunk-QXPOBDPU.js → chunk-M4LA7JMU.js} +1 -21
  23. package/dist/chunk-M4LA7JMU.js.map +1 -0
  24. package/dist/{chunk-ASWAPIJM.js → chunk-QMQB725F.js} +4 -14
  25. package/dist/chunk-QMQB725F.js.map +1 -0
  26. package/dist/chunk-QUV5M7SZ.js +23 -0
  27. package/dist/chunk-QUV5M7SZ.js.map +1 -0
  28. package/dist/chunk-RNDWCT4O.js +1136 -0
  29. package/dist/chunk-RNDWCT4O.js.map +1 -0
  30. package/dist/{chunk-W2DIPVHW.js → chunk-TMWUWKLU.js} +6 -5
  31. package/dist/chunk-TMWUWKLU.js.map +1 -0
  32. package/dist/{chunk-A2M75YRP.js → chunk-VTMMTQ4P.js} +2 -2
  33. package/dist/chunk-VTMMTQ4P.js.map +1 -0
  34. package/dist/journeys/cli.js +1 -1
  35. package/dist/journeys/index.js +1 -1
  36. package/dist/preset-cloudflare/index.js +8 -5
  37. package/dist/preset-cloudflare/index.js.map +1 -1
  38. package/dist/public-consultation/index.js +6 -5
  39. package/dist/public-consultation/index.js.map +1 -1
  40. package/dist/sandbox/index.js +4 -4
  41. package/dist/turn-health/index.js +2 -1
  42. package/dist/turn-health/index.js.map +1 -1
  43. package/dist/turn-health/sweep.d.ts +1 -1
  44. package/dist/turn-stream/adapters.d.ts +14 -1
  45. package/dist/turn-stream/core.d.ts +2 -0
  46. package/dist/turn-stream/do.d.ts +17 -0
  47. package/dist/turn-stream/index.d.ts +1 -1
  48. package/dist/turn-stream/index.js +11 -2
  49. package/dist/turn-stream/index.js.map +1 -1
  50. package/dist/web-react/index.d.ts +1 -1
  51. package/dist/web-react/index.js +4 -2
  52. package/package.json +1 -1
  53. package/dist/chunk-4OR7NNYB.js.map +0 -1
  54. package/dist/chunk-A2M75YRP.js.map +0 -1
  55. package/dist/chunk-ASWAPIJM.js.map +0 -1
  56. package/dist/chunk-FTGKXM7O.js.map +0 -1
  57. package/dist/chunk-FZOHBYGV.js.map +0 -1
  58. package/dist/chunk-K4YIDNX5.js +0 -263
  59. package/dist/chunk-K4YIDNX5.js.map +0 -1
  60. package/dist/chunk-QXPOBDPU.js.map +0 -1
  61. package/dist/chunk-R5PW3FO4.js.map +0 -1
  62. package/dist/chunk-W2DIPVHW.js.map +0 -1
  63. /package/dist/{web-react → web}/turn-funding-recovery.d.ts +0 -0
@@ -0,0 +1,23 @@
1
+ // src/web/turn-funding-recovery.ts
2
+ function getChatFundingRecovery(failure) {
3
+ const code = typeof failure === "object" && failure ? failure.code : void 0;
4
+ const message = typeof failure === "string" ? failure : failure?.message ?? "";
5
+ let reason;
6
+ if (code === "insufficient_credits") reason = "insufficient_credits";
7
+ else if (code === "paid_access_required" || code === "funding_required") reason = "paid_access_required";
8
+ else if (/\binsufficient credits\b/i.test(message)) reason = "insufficient_credits";
9
+ else if (/\binference requires verified paid access\b/i.test(message)) reason = "paid_access_required";
10
+ if (!reason) return null;
11
+ return {
12
+ reason,
13
+ title: reason === "insufficient_credits" ? "Insufficient credits" : "Paid access required",
14
+ 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.",
15
+ actionLabel: "Open billing",
16
+ retryable: false
17
+ };
18
+ }
19
+
20
+ export {
21
+ getChatFundingRecovery
22
+ };
23
+ //# sourceMappingURL=chunk-QUV5M7SZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/web/turn-funding-recovery.ts"],"sourcesContent":["export interface ChatFundingFailure {\n code?: string\n message?: string\n}\n\n/** Presentation only. The host supplies its authenticated billing destination. */\nexport interface ChatFundingRecovery {\n reason: 'insufficient_credits' | 'paid_access_required'\n title: string\n message: string\n actionLabel: string\n /** Retrying the same request cannot repair a funding prerequisite. */\n retryable: false\n}\n\n/**\n * Recognize a paid-access refusal across HTTP and SDK-wrapped chat failures.\n * Structured codes take precedence; the message fallback covers older sandbox\n * transports that preserve the provider's words but replace its error code.\n * This does not infer funding from a generic HTTP status or authorize a run.\n */\nexport function getChatFundingRecovery(\n failure: ChatFundingFailure | string | null | undefined,\n): ChatFundingRecovery | null {\n const code = typeof failure === 'object' && failure ? failure.code : undefined\n const message = typeof failure === 'string' ? failure : failure?.message ?? ''\n let reason: ChatFundingRecovery['reason'] | undefined\n if (code === 'insufficient_credits') reason = 'insufficient_credits'\n else if (code === 'paid_access_required' || code === 'funding_required') reason = 'paid_access_required'\n else if (/\\binsufficient credits\\b/i.test(message)) reason = 'insufficient_credits'\n else if (/\\binference requires verified paid access\\b/i.test(message)) reason = 'paid_access_required'\n if (!reason) return null\n return {\n reason,\n title: reason === 'insufficient_credits' ? 'Insufficient credits' : 'Paid access required',\n message: reason === 'insufficient_credits'\n ? 'Open billing to add funds before trying again.'\n : 'Open billing to check your funded balance or paid seat before trying again.',\n actionLabel: 'Open billing',\n retryable: false,\n }\n}\n"],"mappings":";AAqBO,SAAS,uBACd,SAC4B;AAC5B,QAAM,OAAO,OAAO,YAAY,YAAY,UAAU,QAAQ,OAAO;AACrE,QAAM,UAAU,OAAO,YAAY,WAAW,UAAU,SAAS,WAAW;AAC5E,MAAI;AACJ,MAAI,SAAS,uBAAwB,UAAS;AAAA,WACrC,SAAS,0BAA0B,SAAS,mBAAoB,UAAS;AAAA,WACzE,4BAA4B,KAAK,OAAO,EAAG,UAAS;AAAA,WACpD,+CAA+C,KAAK,OAAO,EAAG,UAAS;AAChF,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO;AAAA,IACL;AAAA,IACA,OAAO,WAAW,yBAAyB,yBAAyB;AAAA,IACpE,SAAS,WAAW,yBAChB,mDACA;AAAA,IACJ,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AACF;","names":[]}