@graphrefly/graphrefly 0.30.0 → 0.32.0

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 (253) hide show
  1. package/dist/{cascading-dNCtjW8j.d.cts → cascading-BfQmSmjU.d.cts} +21 -2
  2. package/dist/{cascading-BszPheHD.d.ts → cascading-D3sapjue.d.ts} +21 -2
  3. package/dist/chunk-2JNT5NDF.js +61 -0
  4. package/dist/{chunk-DDPYNMGG.js → chunk-2RH4QNDQ.js} +1 -1
  5. package/dist/chunk-4JBKKUCJ.js +7 -0
  6. package/dist/{chunk-SLMYTGTU.js → chunk-4UUDNFYG.js} +1 -1
  7. package/dist/chunk-4VXL3UZK.js +1 -0
  8. package/dist/{chunk-SHYH5SXV.js → chunk-4YGJ7KZ6.js} +1 -1
  9. package/dist/{chunk-GJR3P6JG.js → chunk-5PBXUVHI.js} +1 -1
  10. package/dist/{chunk-W4TSQ6RJ.js → chunk-7AJKUA36.js} +1 -1
  11. package/dist/{chunk-XQAXYVXX.js → chunk-7EMUF2RY.js} +1 -1
  12. package/dist/chunk-7JZ3YORY.js +80 -0
  13. package/dist/chunk-7QMVU3IX.js +1 -0
  14. package/dist/{chunk-WANIEEKV.js → chunk-7QS77X6G.js} +1 -1
  15. package/dist/{chunk-BA5URFYW.js → chunk-A4JT4SAD.js} +1 -1
  16. package/dist/{chunk-Y36UZ5VS.js → chunk-BU4SUZSA.js} +1 -1
  17. package/dist/{chunk-P7JXGKDO.js → chunk-CNXUW2CU.js} +1 -1
  18. package/dist/{chunk-Y32RJO24.js → chunk-CZVYLXFK.js} +1 -1
  19. package/dist/{chunk-567NWZ3T.js → chunk-DWIAG62L.js} +1 -1
  20. package/dist/chunk-EIFHFDFD.js +1 -0
  21. package/dist/chunk-FTA5TB2A.js +1 -0
  22. package/dist/{chunk-T5SHIKJD.js → chunk-JAHAJU4G.js} +1 -1
  23. package/dist/{chunk-AV3PIDFQ.js → chunk-JYMNVEH6.js} +1 -1
  24. package/dist/{chunk-5Z4HDCO6.js → chunk-K54OKWNY.js} +1 -1
  25. package/dist/chunk-KD3IYBTD.js +3 -0
  26. package/dist/{chunk-3NEPQO2E.js → chunk-LG73TUF4.js} +2 -2
  27. package/dist/chunk-LJGPOJHS.js +1 -0
  28. package/dist/chunk-LWGLBCMU.js +1 -0
  29. package/dist/{chunk-BKPLTBL5.js → chunk-M2VFLRPJ.js} +1 -1
  30. package/dist/{chunk-GNCBXARM.js → chunk-MFNOZ5E6.js} +1 -1
  31. package/dist/{chunk-TWMEGG45.js → chunk-N2KKISCE.js} +1 -1
  32. package/dist/chunk-PNTBXOQ6.js +5 -0
  33. package/dist/{chunk-73Z3W2RN.js → chunk-PWKLZ2XU.js} +1 -1
  34. package/dist/{chunk-7TDOES3L.js → chunk-Q2SY7M7K.js} +1 -1
  35. package/dist/{chunk-OL33ZI6R.js → chunk-RWGJQQLT.js} +1 -1
  36. package/dist/chunk-SGS4OJGS.js +1 -0
  37. package/dist/{chunk-4OFIQ66T.js → chunk-TOCCHQI6.js} +1 -1
  38. package/dist/chunk-UMH3HSP7.js +1 -0
  39. package/dist/{chunk-XHVB6G6M.js → chunk-UXEB35L4.js} +1 -1
  40. package/dist/{chunk-33FA6V4B.js → chunk-VXJX3ZZP.js} +1 -1
  41. package/dist/{chunk-BZP5T4X6.js → chunk-W6FQIFVE.js} +1 -1
  42. package/dist/{chunk-RD52SNH2.js → chunk-WE32AFFA.js} +1 -1
  43. package/dist/{chunk-KA6MMXIY.js → chunk-WF3V5X2L.js} +1 -1
  44. package/dist/chunk-WQ7I7JVU.js +1 -0
  45. package/dist/{chunk-4JJCCD5S.js → chunk-X4OOM6QU.js} +1 -1
  46. package/dist/{chunk-AUY2YKCO.js → chunk-XRSHMHEG.js} +1 -1
  47. package/dist/chunk-Y26UN6J5.js +18 -0
  48. package/dist/{chunk-VWPRPPKR.js → chunk-ZWETYYQG.js} +1 -1
  49. package/dist/compat/index.cjs +2 -2
  50. package/dist/compat/index.d.cts +5 -5
  51. package/dist/compat/index.d.ts +5 -5
  52. package/dist/compat/index.js +1 -1
  53. package/dist/compat/jotai/index.cjs +1 -1
  54. package/dist/compat/jotai/index.js +1 -1
  55. package/dist/compat/nanostores/index.cjs +1 -1
  56. package/dist/compat/nanostores/index.js +1 -1
  57. package/dist/compat/nestjs/index.cjs +5 -5
  58. package/dist/compat/nestjs/index.d.cts +3 -3
  59. package/dist/compat/nestjs/index.d.ts +3 -3
  60. package/dist/compat/nestjs/index.js +1 -1
  61. package/dist/compat/zustand/index.cjs +2 -2
  62. package/dist/compat/zustand/index.d.cts +2 -2
  63. package/dist/compat/zustand/index.d.ts +2 -2
  64. package/dist/compat/zustand/index.js +1 -1
  65. package/dist/{composite-DGspwCqk.d.ts → composite-BY9hMxN7.d.ts} +1 -1
  66. package/dist/{composite-nrRumJ7l.d.cts → composite-CH0S8DFn.d.cts} +1 -1
  67. package/dist/content-addressed-storage-BUiREIuj.d.ts +124 -0
  68. package/dist/content-addressed-storage-DqIWCmZG.d.cts +124 -0
  69. package/dist/core/index.cjs +1 -1
  70. package/dist/core/index.js +1 -1
  71. package/dist/extra/browser.cjs +1 -1
  72. package/dist/extra/browser.js +1 -1
  73. package/dist/extra/index.cjs +18 -18
  74. package/dist/extra/index.d.cts +7 -6
  75. package/dist/extra/index.d.ts +7 -6
  76. package/dist/extra/index.js +1 -1
  77. package/dist/extra/node.cjs +2 -2
  78. package/dist/extra/node.js +1 -1
  79. package/dist/extra/operators.cjs +1 -1
  80. package/dist/extra/operators.d.cts +41 -1
  81. package/dist/extra/operators.d.ts +41 -1
  82. package/dist/extra/operators.js +1 -1
  83. package/dist/extra/reactive.cjs +1 -1
  84. package/dist/extra/reactive.d.cts +1 -1
  85. package/dist/extra/reactive.d.ts +1 -1
  86. package/dist/extra/reactive.js +1 -1
  87. package/dist/extra/sources.cjs +1 -1
  88. package/dist/extra/sources.d.cts +62 -2
  89. package/dist/extra/sources.d.ts +62 -2
  90. package/dist/extra/sources.js +1 -1
  91. package/dist/extra/storage-browser.cjs +1 -1
  92. package/dist/extra/storage-browser.js +1 -1
  93. package/dist/{fallback-BaTS7vVY.d.cts → fallback-Cb3GH1O7.d.cts} +6 -14
  94. package/dist/{fallback-eOm3LNxP.d.ts → fallback-DRjJ_ZM8.d.ts} +6 -14
  95. package/dist/graph/index.cjs +4 -4
  96. package/dist/graph/index.d.cts +3 -3
  97. package/dist/graph/index.d.ts +3 -3
  98. package/dist/graph/index.js +1 -1
  99. package/dist/{graph-CWeI0aHd.d.ts → graph-BOhEGJ6E.d.ts} +10 -0
  100. package/dist/{graph-C4Uxwv0T.d.cts → graph-CdJeX7O7.d.cts} +10 -0
  101. package/dist/{index-B-z8WaSd.d.cts → index-BDLy6CQ9.d.cts} +1 -1
  102. package/dist/{index-iBp74eGU.d.cts → index-BJDXj9Wf.d.cts} +2 -2
  103. package/dist/{index-BBINVimG.d.ts → index-BUZPTPSQ.d.ts} +2 -2
  104. package/dist/{index-DnrZghBB.d.ts → index-BbcSZCAG.d.ts} +1 -1
  105. package/dist/{index-lKuLYmHO.d.cts → index-BiGeETJs.d.cts} +1 -1
  106. package/dist/{index-BHu_Wba0.d.cts → index-BmZb8fNF.d.cts} +3 -3
  107. package/dist/{index-Docdiu9a.d.ts → index-Bnmttu35.d.ts} +1 -1
  108. package/dist/{index-D6ajK8Mh.d.cts → index-BuN2wGJs.d.cts} +517 -134
  109. package/dist/{index-Cy7eFeIX.d.cts → index-BwdPDWI4.d.cts} +1 -1
  110. package/dist/{index-DylQCKEL.d.cts → index-BzxU4yhV.d.cts} +11 -2
  111. package/dist/{index-D9Y_u6BG.d.cts → index-C-Gsh-0a.d.cts} +2 -2
  112. package/dist/{index-ybtSyjWB.d.cts → index-C22aTC1X.d.cts} +5 -5
  113. package/dist/{index-yIdWFo2b.d.cts → index-C4QTaDli.d.cts} +2 -2
  114. package/dist/{index-BJHQUCZx.d.ts → index-C7RqYbOZ.d.ts} +82 -7
  115. package/dist/{index-C5Ghnp5B.d.ts → index-C9qCLIN4.d.ts} +2 -2
  116. package/dist/{index-DVNLe3pS.d.cts → index-CCdg0JLX.d.cts} +1 -1
  117. package/dist/{index-B5iVOD7w.d.ts → index-CEoU-r-g.d.ts} +2 -2
  118. package/dist/{index-CfFYyLR8.d.ts → index-CHfBm51k.d.ts} +11 -2
  119. package/dist/{index-Dljd76bC.d.ts → index-CNyiYQWF.d.ts} +5 -5
  120. package/dist/{index-C6NBfXj-.d.ts → index-CVevMZ0n.d.ts} +2 -2
  121. package/dist/{index-DGb1awva.d.ts → index-CZUzi6Dy.d.ts} +2 -2
  122. package/dist/{index-FrYrV-Vf.d.ts → index-Ckl03Q0s.d.ts} +1 -1
  123. package/dist/{index-Bvi5uJxX.d.ts → index-CmSjld-4.d.ts} +1 -1
  124. package/dist/{index-9iguV3bF.d.cts → index-CnjUhRbs.d.cts} +2 -2
  125. package/dist/{index-C98oJsEs.d.cts → index-D3HcdZ4d.d.cts} +1 -1
  126. package/dist/{index-IZ3l_vQ9.d.ts → index-DD1czHj3.d.ts} +1 -1
  127. package/dist/{index-BS220yqj.d.cts → index-DNhTQReY.d.cts} +82 -7
  128. package/dist/{index-UZO988ox.d.cts → index-DSawGt8n.d.cts} +2 -2
  129. package/dist/{index-CcpEvuPl.d.cts → index-DUkuH3jP.d.cts} +1 -1
  130. package/dist/{index-CRAkoq-y.d.cts → index-DY2QbdoP.d.cts} +1 -1
  131. package/dist/{index-CvS9IuTG.d.ts → index-Dbmj0iYR.d.ts} +1 -1
  132. package/dist/{index-ClgKmOHe.d.ts → index-DhlAMlm9.d.ts} +517 -134
  133. package/dist/{index-ClB7TCfL.d.cts → index-DlGaEBW5.d.cts} +2 -2
  134. package/dist/{index-CotRMjtJ.d.ts → index-Dp_pS7Bw.d.ts} +1 -1
  135. package/dist/{index-Cc8VQIgL.d.ts → index-Dxk-pUQI.d.ts} +2 -2
  136. package/dist/{index-DBQUKh59.d.cts → index-EGjF6iSY.d.cts} +3 -3
  137. package/dist/{index-D9HrBx2J.d.ts → index-LGzAYqdR.d.ts} +1 -1
  138. package/dist/{index-DR3gf_DG.d.cts → index-LzCJ0kMT.d.cts} +2 -2
  139. package/dist/{index-RQg6lTrN.d.ts → index-MV2yGIAq.d.ts} +2 -2
  140. package/dist/{index-Bs3-LC83.d.cts → index-_BXz9K7b.d.cts} +1 -1
  141. package/dist/{index-SSGqF8mI.d.cts → index-aBqZUx3B.d.cts} +1 -1
  142. package/dist/{index-CFW32Dy1.d.ts → index-eYHRkoK-.d.ts} +1 -1
  143. package/dist/{index-B2HBxvMb.d.ts → index-gXTVbSax.d.ts} +3 -3
  144. package/dist/{index-B8Aj_z8S.d.cts → index-j33Lfb1G.d.cts} +23 -2
  145. package/dist/{index-BEpRsvhg.d.ts → index-lpGUhTBn.d.ts} +3 -3
  146. package/dist/{index-BXbQUn4n.d.ts → index-zMQIQuDu.d.ts} +23 -2
  147. package/dist/index.cjs +106 -125
  148. package/dist/index.d.cts +34 -33
  149. package/dist/index.d.ts +34 -33
  150. package/dist/index.js +1 -1
  151. package/dist/patterns/ai/browser.cjs +5 -22
  152. package/dist/patterns/ai/browser.d.cts +3 -3
  153. package/dist/patterns/ai/browser.d.ts +3 -3
  154. package/dist/patterns/ai/browser.js +1 -1
  155. package/dist/patterns/ai/index.cjs +30 -44
  156. package/dist/patterns/ai/index.d.cts +13 -11
  157. package/dist/patterns/ai/index.d.ts +13 -11
  158. package/dist/patterns/ai/index.js +1 -1
  159. package/dist/patterns/ai/node.cjs +2 -2
  160. package/dist/patterns/ai/node.d.cts +5 -4
  161. package/dist/patterns/ai/node.d.ts +5 -4
  162. package/dist/patterns/ai/node.js +1 -1
  163. package/dist/patterns/audit/index.cjs +3 -3
  164. package/dist/patterns/audit/index.d.cts +3 -3
  165. package/dist/patterns/audit/index.d.ts +3 -3
  166. package/dist/patterns/audit/index.js +1 -1
  167. package/dist/patterns/cqrs/index.cjs +6 -6
  168. package/dist/patterns/cqrs/index.d.cts +2 -2
  169. package/dist/patterns/cqrs/index.d.ts +2 -2
  170. package/dist/patterns/cqrs/index.js +1 -1
  171. package/dist/patterns/demo-shell/index.cjs +2 -2
  172. package/dist/patterns/demo-shell/index.d.cts +3 -3
  173. package/dist/patterns/demo-shell/index.d.ts +3 -3
  174. package/dist/patterns/demo-shell/index.js +1 -1
  175. package/dist/patterns/domain-templates/index.cjs +6 -6
  176. package/dist/patterns/domain-templates/index.d.cts +2 -2
  177. package/dist/patterns/domain-templates/index.d.ts +2 -2
  178. package/dist/patterns/domain-templates/index.js +1 -1
  179. package/dist/patterns/graphspec/index.cjs +27 -25
  180. package/dist/patterns/graphspec/index.d.cts +3 -3
  181. package/dist/patterns/graphspec/index.d.ts +3 -3
  182. package/dist/patterns/graphspec/index.js +1 -1
  183. package/dist/patterns/guarded-execution/index.cjs +7 -7
  184. package/dist/patterns/guarded-execution/index.d.cts +4 -4
  185. package/dist/patterns/guarded-execution/index.d.ts +4 -4
  186. package/dist/patterns/guarded-execution/index.js +1 -1
  187. package/dist/patterns/harness/index.cjs +12 -11
  188. package/dist/patterns/harness/index.d.cts +6 -6
  189. package/dist/patterns/harness/index.d.ts +6 -6
  190. package/dist/patterns/harness/index.js +1 -1
  191. package/dist/patterns/job-queue/index.cjs +5 -5
  192. package/dist/patterns/job-queue/index.d.cts +2 -2
  193. package/dist/patterns/job-queue/index.d.ts +2 -2
  194. package/dist/patterns/job-queue/index.js +1 -1
  195. package/dist/patterns/lens/index.cjs +5 -5
  196. package/dist/patterns/lens/index.d.cts +4 -4
  197. package/dist/patterns/lens/index.d.ts +4 -4
  198. package/dist/patterns/lens/index.js +1 -1
  199. package/dist/patterns/memory/index.cjs +4 -4
  200. package/dist/patterns/memory/index.d.cts +2 -2
  201. package/dist/patterns/memory/index.d.ts +2 -2
  202. package/dist/patterns/memory/index.js +1 -1
  203. package/dist/patterns/messaging/index.cjs +5 -5
  204. package/dist/patterns/messaging/index.d.cts +2 -2
  205. package/dist/patterns/messaging/index.d.ts +2 -2
  206. package/dist/patterns/messaging/index.js +1 -1
  207. package/dist/patterns/orchestration/index.cjs +7 -7
  208. package/dist/patterns/orchestration/index.d.cts +2 -2
  209. package/dist/patterns/orchestration/index.d.ts +2 -2
  210. package/dist/patterns/orchestration/index.js +1 -1
  211. package/dist/patterns/reactive-layout/index.cjs +2 -2
  212. package/dist/patterns/reactive-layout/index.d.cts +3 -3
  213. package/dist/patterns/reactive-layout/index.d.ts +3 -3
  214. package/dist/patterns/reactive-layout/index.js +1 -1
  215. package/dist/patterns/reduction/index.cjs +5 -5
  216. package/dist/patterns/reduction/index.d.cts +2 -2
  217. package/dist/patterns/reduction/index.d.ts +2 -2
  218. package/dist/patterns/reduction/index.js +1 -1
  219. package/dist/patterns/refine-loop/index.cjs +8 -8
  220. package/dist/patterns/refine-loop/index.d.cts +3 -3
  221. package/dist/patterns/refine-loop/index.d.ts +3 -3
  222. package/dist/patterns/refine-loop/index.js +1 -1
  223. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  224. package/dist/patterns/resilient-pipeline/index.d.cts +3 -3
  225. package/dist/patterns/resilient-pipeline/index.d.ts +3 -3
  226. package/dist/patterns/resilient-pipeline/index.js +1 -1
  227. package/dist/patterns/surface/index.cjs +15 -13
  228. package/dist/patterns/surface/index.d.cts +4 -4
  229. package/dist/patterns/surface/index.d.ts +4 -4
  230. package/dist/patterns/surface/index.js +1 -1
  231. package/dist/{reactive-layout-BAr6-_o5.d.ts → reactive-layout-Bq0rA2Wb.d.ts} +1 -1
  232. package/dist/{reactive-layout-5oEn8lHM.d.cts → reactive-layout-Dhhe54Oj.d.cts} +1 -1
  233. package/dist/{reactive-map-BvDrRuwt.d.ts → reactive-map-CtRaCddO.d.ts} +59 -1
  234. package/dist/{reactive-map-CmlPPKHN.d.cts → reactive-map-IJIfZxoh.d.cts} +59 -1
  235. package/dist/{resilience-XRUF267O.js → resilience-IVNDYORD.js} +1 -1
  236. package/dist/{topology-tree-CVREibAc.d.cts → topology-tree-CpSjvIXp.d.cts} +1 -1
  237. package/dist/{topology-tree-CkjojcB6.d.ts → topology-tree-DAbCV2Yw.d.ts} +1 -1
  238. package/dist/{types-O3GzJY2U.d.cts → types-BgMqbc7N.d.cts} +41 -14
  239. package/dist/{types-u64Ose53.d.ts → types-CdfO2QTt.d.ts} +41 -14
  240. package/package.json +1 -1
  241. package/dist/chunk-2GQREQ6C.js +0 -1
  242. package/dist/chunk-4C2OR2GH.js +0 -18
  243. package/dist/chunk-5JDE5JHE.js +0 -1
  244. package/dist/chunk-7JDLFI6N.js +0 -1
  245. package/dist/chunk-AMBYCIOH.js +0 -3
  246. package/dist/chunk-GLSM33ZM.js +0 -78
  247. package/dist/chunk-ISCENNXS.js +0 -1
  248. package/dist/chunk-IUK4EFCE.js +0 -1
  249. package/dist/chunk-KASHOCF5.js +0 -1
  250. package/dist/chunk-LI3E75VE.js +0 -64
  251. package/dist/chunk-MGKAO4EK.js +0 -7
  252. package/dist/chunk-NSG4C6BF.js +0 -23
  253. package/dist/chunk-VIEUJSTT.js +0 -1
@@ -1,17 +1,19 @@
1
- export { e as CapabilitiesRegistry, C as ChatMessage, L as LLMAdapter, a as LLMInvokeOptions, b as LLMResponse, M as ModelCapabilities, f as ModelFeatures, g as ModelLimits, h as ModelPricing, i as PriceBreakdown, P as PricingFn, j as PricingRegistry, R as Rate, S as StreamDelta, k as TieredRate, T as TokenUsage, c as ToolCall, d as ToolDefinition, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, r as registryPricing, z as zeroPrice } from '../../types-O3GzJY2U.cjs';
2
- export { A as AdapterProvider, b as AdapterTier, d as AllTiersExhaustedError, a as CascadeExhaustionReport, C as CascadingLlmAdapterOptions, e as CreateAdapterOptions, O as OpenAICompatAdapterOptions, f as OpenAICompatPreset, g as OpenAISdkLike, h as cascadingLlmAdapter, c as createAdapter, o as openAICompatAdapter } from '../../cascading-dNCtjW8j.cjs';
3
- export { A as AdapterStats, a as AdmissionScore3DOptions, b as AdmissionScores, c as AgentLoopGraph, d as AgentLoopOptions, e as AgentLoopStatus, f as AgentMemoryGraph, g as AgentMemoryOptions, h as AnthropicAdapterOptions, j as AnthropicSdkLike, B as BudgetCaps, k as BudgetExhaustedError, l as BudgetGateBundle, m as BudgetTotals, C as CallStatsEvent, n as ChatStreamGraph, o as ChatStreamOptions, p as ContentDecision, q as ContentGateOptions, r as CostMeterOptions, s as CostMeterReading, D as DEFAULT_DECAY_RATE, t as DryRunAdapterOptions, E as ExtractedToolCall, F as FromLLMOptions, u as FrozenContextOptions, G as GatedStreamHandle, v as GatedStreamOptions, w as GaugesAsContextOptions, x as GoogleAdapterOptions, y as GoogleSdkLike, z as GraphDefValidation, H as GraphFromSpecOptions, I as HandoffOptions, J as HttpErrorLike, K as KeywordFlag, L as KeywordFlagExtractorOptions, M as KnobsAsToolsResult, N as LLMConsolidatorOptions, O as LLMExtractorOptions, P as LLMTimeoutError, Q as McpToolSchema, R as MemoryTier, S as MemoryTiersBundle, T as MemoryTiersOptions, U as OpenAIToolSchema, V as PromptNodeOptions, W as RedactorOptions, X as ResilientAdapterBundle, Y as ResilientAdapterOptions, Z as RetrievalEntry, _ as RetrievalPipelineOptions, $ as RetrievalQuery, a0 as RetrievalTrace, a1 as StrategyOperation, a2 as StrategyPlan, a3 as StreamChunk, a4 as StreamingPromptNodeHandle, a5 as StreamingPromptNodeOptions, a6 as SuggestStrategyOptions, a7 as SystemPromptHandle, a8 as ToolRegistryGraph, a9 as ToolRegistryOptions, aa as ToolResult, ab as ToolSelectorOptions, ac as WithBreakerOptions, ad as WithBudgetGateOptions, ae as WithDryRunBundle, af as WithDryRunOptions, ag as WithRateLimiterOptions, ah as WithRetryOptions, ai as admissionFilter3D, aj as agentLoop, ak as agentMemory, al as anthropicAdapter, am as chatStream, an as contentGate, ao as costMeterExtractor, ap as dryRunAdapter, aq as dryRunPreset, ar as fromLLM, as as frozenContext, at as gatedStream, au as gaugesAsContext, av as googleAdapter, aw as graphFromSpec, ax as handoff, ay as keywordFlagExtractor, az as knobsAsTools, aA as llmConsolidator, aB as llmExtractor, aC as observableAdapter, aD as parseRateLimitFromError, aE as promptNode, aF as redactor, aG as resilientAdapter, aH as streamExtractor, aI as streamingPromptNode, aJ as suggestStrategy, aK as systemPromptBuilder, aL as toolCallExtractor, aM as toolRegistry, aN as toolSelector, aO as validateGraphDef, aP as withBreaker, aQ as withBudgetGate, aR as withDryRun, aS as withRateLimiter, aT as withRetry, aU as withTimeout } from '../../index-D6ajK8Mh.cjs';
4
- export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, W as WithReplayCacheOptions, f as canonicalJson, g as fallbackAdapter, w as withReplayCache } from '../../fallback-BaTS7vVY.cjs';
1
+ export { e as CapabilitiesRegistry, C as ChatMessage, L as LLMAdapter, a as LLMInvokeOptions, b as LLMResponse, M as ModelCapabilities, f as ModelFeatures, g as ModelLimits, h as ModelPricing, i as PriceBreakdown, P as PricingFn, j as PricingRegistry, R as Rate, S as StreamDelta, k as TieredRate, T as TokenUsage, c as ToolCall, d as ToolDefinition, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, p as pricingFor, r as registryPricing, z as zeroPrice } from '../../types-BgMqbc7N.cjs';
2
+ export { A as AdapterProvider, b as AdapterTier, d as AllTiersExhaustedError, a as CascadeExhaustionReport, C as CascadingLlmAdapterOptions, e as CreateAdapterOptions, O as OpenAICompatAdapterOptions, f as OpenAICompatPreset, g as OpenAISdkLike, h as cascadingLlmAdapter, c as createAdapter, o as openAICompatAdapter, t as tier } from '../../cascading-BfQmSmjU.cjs';
3
+ export { A as AdapterStats, a as AdmissionScore3DOptions, b as AdmissionScoredOptions, c as AdmissionScores, d as AdmissionThresholds, e as AgentLoopGraph, f as AgentLoopOptions, g as AgentLoopStatus, h as AgentMemoryGraph, j as AgentMemoryOptions, k as AnthropicAdapterOptions, l as AnthropicSdkLike, B as BudgetCaps, m as BudgetExhaustedError, n as BudgetGateBundle, o as BudgetTotals, C as CallStatsEvent, p as ChatStreamGraph, q as ChatStreamOptions, r as ContentDecision, s as ContentGateOptions, t as CostMeterOptions, u as CostMeterReading, D as DEFAULT_DECAY_RATE, v as DryRunAdapterOptions, E as ExtractedToolCall, F as FromLLMOptions, w as FrozenContextOptions, G as GatedStreamHandle, x as GatedStreamOptions, y as GaugesAsContextOptions, z as GoogleAdapterOptions, H as GoogleSdkLike, I as GraphDefValidation, J as GraphFromSpecOptions, K as HandoffOptions, L as HttpErrorLike, M as KeywordFlag, N as KeywordFlagExtractorOptions, O as KnobsAsToolsResult, P as LLMConsolidatorOptions, Q as LLMExtractorOptions, R as LLMTimeoutError, S as McpToolSchema, T as MemoryRetrievalBundle, U as MemoryRetrievalOptions, V as MemoryTier, W as MemoryTiersBundle, X as MemoryTiersOptions, Y as MemoryWithKGOptions, Z as MemoryWithTiersOptions, _ as MemoryWithVectorsOptions, $ as OpenAIToolSchema, a0 as PromptNodeOptions, a1 as RedactorOptions, a2 as ResilientAdapterBundle, a3 as ResilientAdapterOptions, a4 as RetrievalEntry, a5 as RetrievalPipelineOptions, a6 as RetrievalQuery, a7 as RetrievalTrace, a8 as StampedDelta, a9 as StrategyOperation, aa as StrategyPlan, ab as StreamingPromptNodeHandle, ac as StreamingPromptNodeOptions, ad as SuggestStrategyOptions, ae as SystemPromptHandle, af as ToolRegistryGraph, ag as ToolRegistryOptions, ah as ToolResult, ai as ToolSelectorOptions, aj as WithBreakerOptions, ak as WithBudgetGateOptions, al as WithDryRunBundle, am as WithDryRunOptions, an as WithRateLimiterOptions, ao as WithRetryOptions, ap as admissionFilter3D, aq as admissionScored, ar as agentLoop, as as agentMemory, at as anthropicAdapter, au as chatStream, av as contentGate, aw as costMeterExtractor, ax as dryRunAdapter, ay as fromLLM, az as frozenContext, aA as gatedStream, aB as gaugesAsContext, aC as googleAdapter, aD as graphFromSpec, aE as graphFromSpecReactive, aF as handoff, aG as keywordFlagExtractor, aH as knobsAsTools, aI as llmConsolidator, aJ as llmExtractor, aK as memoryRetrieval, aL as memoryWithKG, aM as memoryWithTiers, aN as memoryWithVectors, aO as observableAdapter, aP as parseRateLimitFromError, aQ as promptNode, aR as redactor, aS as resilientAdapter, aT as streamExtractor, aU as streamingPromptNode, aV as suggestStrategy, aW as suggestStrategyReactive, aX as systemPromptBuilder, aY as toolCallExtractor, aZ as toolRegistry, a_ as toolSelector, a$ as validateGraphDef, b0 as withBreaker, b1 as withBudgetGate, b2 as withDryRun, b3 as withRateLimiter, b4 as withRetry, b5 as withTimeout } from '../../index-BuN2wGJs.cjs';
4
+ export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, W as WithReplayCacheOptions, f as canonicalJson, g as fallbackAdapter, w as withReplayCache } from '../../fallback-Cb3GH1O7.cjs';
5
5
  export { f as CircuitOpenError } from '../../resilience-Q6Bt_7y0.cjs';
6
- import '../../extra/sources.cjs';
7
6
  import '../../node-BVV7G1bq.cjs';
7
+ import '../../extra/sources.cjs';
8
8
  import '../../reactive-log-5jFeNRmd.cjs';
9
- import '../../graph-C4Uxwv0T.cjs';
9
+ import '../../graph-CdJeX7O7.cjs';
10
10
  import '../../meta-COtmHLwT.cjs';
11
11
  import '../../extra/storage-core.cjs';
12
- import '../../index-B-z8WaSd.cjs';
13
- import '../../index-DVNLe3pS.cjs';
12
+ import '../../index-BDLy6CQ9.cjs';
13
+ import '../../index-CCdg0JLX.cjs';
14
14
  import '../../sugar-CqR6DJ7v.cjs';
15
- import '../../composite-nrRumJ7l.cjs';
16
- import '../../reactive-map-CmlPPKHN.cjs';
17
- import '../../index-lKuLYmHO.cjs';
15
+ import '../../composite-CH0S8DFn.cjs';
16
+ import '../../reactive-map-IJIfZxoh.cjs';
17
+ import '../../index-BiGeETJs.cjs';
18
+ import '../../index-j33Lfb1G.cjs';
19
+ import '../../content-addressed-storage-DqIWCmZG.cjs';
@@ -1,17 +1,19 @@
1
- export { e as CapabilitiesRegistry, C as ChatMessage, L as LLMAdapter, a as LLMInvokeOptions, b as LLMResponse, M as ModelCapabilities, f as ModelFeatures, g as ModelLimits, h as ModelPricing, i as PriceBreakdown, P as PricingFn, j as PricingRegistry, R as Rate, S as StreamDelta, k as TieredRate, T as TokenUsage, c as ToolCall, d as ToolDefinition, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, r as registryPricing, z as zeroPrice } from '../../types-u64Ose53.js';
2
- export { A as AdapterProvider, b as AdapterTier, d as AllTiersExhaustedError, a as CascadeExhaustionReport, C as CascadingLlmAdapterOptions, e as CreateAdapterOptions, O as OpenAICompatAdapterOptions, f as OpenAICompatPreset, g as OpenAISdkLike, h as cascadingLlmAdapter, c as createAdapter, o as openAICompatAdapter } from '../../cascading-BszPheHD.js';
3
- export { A as AdapterStats, a as AdmissionScore3DOptions, b as AdmissionScores, c as AgentLoopGraph, d as AgentLoopOptions, e as AgentLoopStatus, f as AgentMemoryGraph, g as AgentMemoryOptions, h as AnthropicAdapterOptions, j as AnthropicSdkLike, B as BudgetCaps, k as BudgetExhaustedError, l as BudgetGateBundle, m as BudgetTotals, C as CallStatsEvent, n as ChatStreamGraph, o as ChatStreamOptions, p as ContentDecision, q as ContentGateOptions, r as CostMeterOptions, s as CostMeterReading, D as DEFAULT_DECAY_RATE, t as DryRunAdapterOptions, E as ExtractedToolCall, F as FromLLMOptions, u as FrozenContextOptions, G as GatedStreamHandle, v as GatedStreamOptions, w as GaugesAsContextOptions, x as GoogleAdapterOptions, y as GoogleSdkLike, z as GraphDefValidation, H as GraphFromSpecOptions, I as HandoffOptions, J as HttpErrorLike, K as KeywordFlag, L as KeywordFlagExtractorOptions, M as KnobsAsToolsResult, N as LLMConsolidatorOptions, O as LLMExtractorOptions, P as LLMTimeoutError, Q as McpToolSchema, R as MemoryTier, S as MemoryTiersBundle, T as MemoryTiersOptions, U as OpenAIToolSchema, V as PromptNodeOptions, W as RedactorOptions, X as ResilientAdapterBundle, Y as ResilientAdapterOptions, Z as RetrievalEntry, _ as RetrievalPipelineOptions, $ as RetrievalQuery, a0 as RetrievalTrace, a1 as StrategyOperation, a2 as StrategyPlan, a3 as StreamChunk, a4 as StreamingPromptNodeHandle, a5 as StreamingPromptNodeOptions, a6 as SuggestStrategyOptions, a7 as SystemPromptHandle, a8 as ToolRegistryGraph, a9 as ToolRegistryOptions, aa as ToolResult, ab as ToolSelectorOptions, ac as WithBreakerOptions, ad as WithBudgetGateOptions, ae as WithDryRunBundle, af as WithDryRunOptions, ag as WithRateLimiterOptions, ah as WithRetryOptions, ai as admissionFilter3D, aj as agentLoop, ak as agentMemory, al as anthropicAdapter, am as chatStream, an as contentGate, ao as costMeterExtractor, ap as dryRunAdapter, aq as dryRunPreset, ar as fromLLM, as as frozenContext, at as gatedStream, au as gaugesAsContext, av as googleAdapter, aw as graphFromSpec, ax as handoff, ay as keywordFlagExtractor, az as knobsAsTools, aA as llmConsolidator, aB as llmExtractor, aC as observableAdapter, aD as parseRateLimitFromError, aE as promptNode, aF as redactor, aG as resilientAdapter, aH as streamExtractor, aI as streamingPromptNode, aJ as suggestStrategy, aK as systemPromptBuilder, aL as toolCallExtractor, aM as toolRegistry, aN as toolSelector, aO as validateGraphDef, aP as withBreaker, aQ as withBudgetGate, aR as withDryRun, aS as withRateLimiter, aT as withRetry, aU as withTimeout } from '../../index-ClgKmOHe.js';
4
- export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, W as WithReplayCacheOptions, f as canonicalJson, g as fallbackAdapter, w as withReplayCache } from '../../fallback-eOm3LNxP.js';
1
+ export { e as CapabilitiesRegistry, C as ChatMessage, L as LLMAdapter, a as LLMInvokeOptions, b as LLMResponse, M as ModelCapabilities, f as ModelFeatures, g as ModelLimits, h as ModelPricing, i as PriceBreakdown, P as PricingFn, j as PricingRegistry, R as Rate, S as StreamDelta, k as TieredRate, T as TokenUsage, c as ToolCall, d as ToolDefinition, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, p as pricingFor, r as registryPricing, z as zeroPrice } from '../../types-CdfO2QTt.js';
2
+ export { A as AdapterProvider, b as AdapterTier, d as AllTiersExhaustedError, a as CascadeExhaustionReport, C as CascadingLlmAdapterOptions, e as CreateAdapterOptions, O as OpenAICompatAdapterOptions, f as OpenAICompatPreset, g as OpenAISdkLike, h as cascadingLlmAdapter, c as createAdapter, o as openAICompatAdapter, t as tier } from '../../cascading-D3sapjue.js';
3
+ export { A as AdapterStats, a as AdmissionScore3DOptions, b as AdmissionScoredOptions, c as AdmissionScores, d as AdmissionThresholds, e as AgentLoopGraph, f as AgentLoopOptions, g as AgentLoopStatus, h as AgentMemoryGraph, j as AgentMemoryOptions, k as AnthropicAdapterOptions, l as AnthropicSdkLike, B as BudgetCaps, m as BudgetExhaustedError, n as BudgetGateBundle, o as BudgetTotals, C as CallStatsEvent, p as ChatStreamGraph, q as ChatStreamOptions, r as ContentDecision, s as ContentGateOptions, t as CostMeterOptions, u as CostMeterReading, D as DEFAULT_DECAY_RATE, v as DryRunAdapterOptions, E as ExtractedToolCall, F as FromLLMOptions, w as FrozenContextOptions, G as GatedStreamHandle, x as GatedStreamOptions, y as GaugesAsContextOptions, z as GoogleAdapterOptions, H as GoogleSdkLike, I as GraphDefValidation, J as GraphFromSpecOptions, K as HandoffOptions, L as HttpErrorLike, M as KeywordFlag, N as KeywordFlagExtractorOptions, O as KnobsAsToolsResult, P as LLMConsolidatorOptions, Q as LLMExtractorOptions, R as LLMTimeoutError, S as McpToolSchema, T as MemoryRetrievalBundle, U as MemoryRetrievalOptions, V as MemoryTier, W as MemoryTiersBundle, X as MemoryTiersOptions, Y as MemoryWithKGOptions, Z as MemoryWithTiersOptions, _ as MemoryWithVectorsOptions, $ as OpenAIToolSchema, a0 as PromptNodeOptions, a1 as RedactorOptions, a2 as ResilientAdapterBundle, a3 as ResilientAdapterOptions, a4 as RetrievalEntry, a5 as RetrievalPipelineOptions, a6 as RetrievalQuery, a7 as RetrievalTrace, a8 as StampedDelta, a9 as StrategyOperation, aa as StrategyPlan, ab as StreamingPromptNodeHandle, ac as StreamingPromptNodeOptions, ad as SuggestStrategyOptions, ae as SystemPromptHandle, af as ToolRegistryGraph, ag as ToolRegistryOptions, ah as ToolResult, ai as ToolSelectorOptions, aj as WithBreakerOptions, ak as WithBudgetGateOptions, al as WithDryRunBundle, am as WithDryRunOptions, an as WithRateLimiterOptions, ao as WithRetryOptions, ap as admissionFilter3D, aq as admissionScored, ar as agentLoop, as as agentMemory, at as anthropicAdapter, au as chatStream, av as contentGate, aw as costMeterExtractor, ax as dryRunAdapter, ay as fromLLM, az as frozenContext, aA as gatedStream, aB as gaugesAsContext, aC as googleAdapter, aD as graphFromSpec, aE as graphFromSpecReactive, aF as handoff, aG as keywordFlagExtractor, aH as knobsAsTools, aI as llmConsolidator, aJ as llmExtractor, aK as memoryRetrieval, aL as memoryWithKG, aM as memoryWithTiers, aN as memoryWithVectors, aO as observableAdapter, aP as parseRateLimitFromError, aQ as promptNode, aR as redactor, aS as resilientAdapter, aT as streamExtractor, aU as streamingPromptNode, aV as suggestStrategy, aW as suggestStrategyReactive, aX as systemPromptBuilder, aY as toolCallExtractor, aZ as toolRegistry, a_ as toolSelector, a$ as validateGraphDef, b0 as withBreaker, b1 as withBudgetGate, b2 as withDryRun, b3 as withRateLimiter, b4 as withRetry, b5 as withTimeout } from '../../index-DhlAMlm9.js';
4
+ export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, W as WithReplayCacheOptions, f as canonicalJson, g as fallbackAdapter, w as withReplayCache } from '../../fallback-DRjJ_ZM8.js';
5
5
  export { f as CircuitOpenError } from '../../resilience-CludlzcP.js';
6
- import '../../extra/sources.js';
7
6
  import '../../node-BVV7G1bq.js';
7
+ import '../../extra/sources.js';
8
8
  import '../../reactive-log-BOJDCI5x.js';
9
- import '../../graph-CWeI0aHd.js';
9
+ import '../../graph-BOhEGJ6E.js';
10
10
  import '../../meta-BMwx3ExI.js';
11
11
  import '../../extra/storage-core.js';
12
- import '../../index-CvS9IuTG.js';
13
- import '../../index-CFW32Dy1.js';
12
+ import '../../index-Dbmj0iYR.js';
13
+ import '../../index-eYHRkoK-.js';
14
14
  import '../../sugar-BHbAACDG.js';
15
- import '../../composite-DGspwCqk.js';
16
- import '../../reactive-map-BvDrRuwt.js';
17
- import '../../index-DnrZghBB.js';
15
+ import '../../composite-BY9hMxN7.js';
16
+ import '../../reactive-map-CtRaCddO.js';
17
+ import '../../index-BbcSZCAG.js';
18
+ import '../../index-zMQIQuDu.js';
19
+ import '../../content-addressed-storage-BUiREIuj.js';
@@ -1 +1 @@
1
- import{A as N,B as O,C as P,D as Q,E as R,F as S,G as T,H as U,I as V,J as W,K as X,L as Y,M as Z,N as _,O as $,P as aa,Q as ba,R as ca,S as da,T as ea,U as fa,V as ga,a as b,b as m,c as n,d as o,e as p,f as q,g as r,h as s,i as t,j as u,k as v,l as w,m as x,n as A,o as B,p as C,q as D,r as E,s as F,t as G,u as H,v as I,w as J,x as K,y as L,z as M}from"../../chunk-LI3E75VE.js";import"../../chunk-4OFIQ66T.js";import"../../chunk-VWPRPPKR.js";import"../../chunk-33FA6V4B.js";import{a as c,b as j,c as k,d as l,e as y,f as z}from"../../chunk-NSG4C6BF.js";import{a as d,b as e,c as f,d as g,e as h,f as i}from"../../chunk-7JDLFI6N.js";import"../../chunk-5Z4HDCO6.js";import"../../chunk-GNCBXARM.js";import"../../chunk-Y32RJO24.js";import"../../chunk-IUK4EFCE.js";import{c as a}from"../../chunk-OL33ZI6R.js";import"../../chunk-ISCENNXS.js";import"../../chunk-MGKAO4EK.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-TWMEGG45.js";import"../../chunk-I6VIH3VA.js";import"../../chunk-5JDE5JHE.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-2GQREQ6C.js";import"../../chunk-AUY2YKCO.js";import"../../chunk-KASHOCF5.js";import"../../chunk-W4TSQ6RJ.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{V as AgentLoopGraph,y as AllTiersExhaustedError,t as BudgetExhaustedError,R as ChatStreamGraph,a as CircuitOpenError,aa as DEFAULT_DECAY_RATE,h as FallbackMissError,B as LLMTimeoutError,e as ReplayCacheMissError,T as ToolRegistryGraph,Z as admissionFilter3D,W as agentLoop,ba as agentMemory,c as anthropicAdapter,g as canonicalJson,z as cascadingLlmAdapter,S as chatStream,r as composePricing,o as computePrice,P as contentGate,L as costMeterExtractor,l as createAdapter,b as createCapabilitiesRegistry,p as createPricingRegistry,d as dryRunAdapter,E as dryRunPreset,i as fallbackAdapter,F as fromLLM,G as frozenContext,J as gatedStream,ca as gaugesAsContext,j as googleAdapter,ea as graphFromSpec,X as handoff,M as keywordFlagExtractor,fa as knobsAsTools,$ as llmConsolidator,_ as llmExtractor,m as observableAdapter,k as openAICompatAdapter,w as parseRateLimitFromError,H as promptNode,Q as redactor,q as registryPricing,D as resilientAdapter,N as streamExtractor,I as streamingPromptNode,ga as suggestStrategy,K as systemPromptBuilder,O as toolCallExtractor,U as toolRegistry,Y as toolSelector,da as validateGraphDef,s as withBreaker,u as withBudgetGate,v as withDryRun,x as withRateLimiter,f as withReplayCache,A as withRetry,C as withTimeout,n as zeroPrice};
1
+ import{$ as na,A as O,B as P,C as Q,D as R,E as S,F as T,G as U,H as V,I as W,J as X,K as Y,L as Z,M as _,N as $,O as aa,P as ba,Q as ca,R as da,S as ea,T as fa,U as ga,V as ha,W as ia,X as ja,Y as ka,Z as la,_ as ma,a as b,aa as oa,b as m,c as n,d as o,e as p,f as q,g as r,h as s,i as t,j as u,k as v,l as w,m as x,n as y,o as C,p as D,q as E,r as F,s as G,t as H,u as I,v as J,w as K,x as L,y as M,z as N}from"../../chunk-2JNT5NDF.js";import"../../chunk-TOCCHQI6.js";import"../../chunk-ZWETYYQG.js";import"../../chunk-7JZ3YORY.js";import"../../chunk-WF3V5X2L.js";import"../../chunk-VXJX3ZZP.js";import{a as c,b as j,c as k,d as l,e as z,f as A,g as B}from"../../chunk-PNTBXOQ6.js";import{a as d,g as e,h as f,i as g,j as h,k as i}from"../../chunk-FTA5TB2A.js";import"../../chunk-K54OKWNY.js";import"../../chunk-CZVYLXFK.js";import"../../chunk-MFNOZ5E6.js";import"../../chunk-7QMVU3IX.js";import"../../chunk-Y26UN6J5.js";import{c as a}from"../../chunk-RWGJQQLT.js";import"../../chunk-4VXL3UZK.js";import"../../chunk-LWGLBCMU.js";import"../../chunk-XRSHMHEG.js";import"../../chunk-4JBKKUCJ.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-N2KKISCE.js";import"../../chunk-I6VIH3VA.js";import"../../chunk-WQ7I7JVU.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-UMH3HSP7.js";import"../../chunk-7AJKUA36.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{W as AgentLoopGraph,z as AllTiersExhaustedError,u as BudgetExhaustedError,S as ChatStreamGraph,a as CircuitOpenError,ca as DEFAULT_DECAY_RATE,h as FallbackMissError,D as LLMTimeoutError,e as ReplayCacheMissError,U as ToolRegistryGraph,$ as admissionFilter3D,_ as admissionScored,X as agentLoop,da as agentMemory,c as anthropicAdapter,g as canonicalJson,A as cascadingLlmAdapter,T as chatStream,r as composePricing,o as computePrice,Q as contentGate,M as costMeterExtractor,l as createAdapter,b as createCapabilitiesRegistry,p as createPricingRegistry,d as dryRunAdapter,i as fallbackAdapter,G as fromLLM,H as frozenContext,K as gatedStream,ia as gaugesAsContext,j as googleAdapter,ja as graphFromSpec,ka as graphFromSpecReactive,Y as handoff,N as keywordFlagExtractor,la as knobsAsTools,ba as llmConsolidator,aa as llmExtractor,ha as memoryRetrieval,fa as memoryWithKG,ga as memoryWithTiers,ea as memoryWithVectors,m as observableAdapter,k as openAICompatAdapter,x as parseRateLimitFromError,s as pricingFor,I as promptNode,R as redactor,q as registryPricing,F as resilientAdapter,O as streamExtractor,J as streamingPromptNode,ma as suggestStrategy,na as suggestStrategyReactive,L as systemPromptBuilder,B as tier,P as toolCallExtractor,V as toolRegistry,Z as toolSelector,oa as validateGraphDef,t as withBreaker,v as withBudgetGate,w as withDryRun,y as withRateLimiter,f as withReplayCache,C as withRetry,E as withTimeout,n as zeroPrice};
@@ -1,2 +1,2 @@
1
- "use strict";var _=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var N=(e,t)=>()=>(e&&(t=e(e=0)),t);var me=(e,t)=>{for(var r in t)_(e,r,{get:t[r],enumerable:!0})},ge=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pe(t))!ye.call(e,a)&&a!==r&&_(e,a,{get:()=>t[a],enumerable:!(n=fe(t,a))||n.enumerable});return e};var be=e=>ge(_({},"__esModule",{value:!0}),e);function Y(){return Math.trunc(performance.now()*1e6)}function C(){return Date.now()*1e6}var J=N(()=>{"use strict"});var ke,q,X,Z,Te,xe,z,Q,we,ve,Se,Ke,Le,Me,$e,Je,ze,Be,He,ee=N(()=>{"use strict";ke=Symbol.for("graphrefly/START"),q=Symbol.for("graphrefly/DATA"),X=Symbol.for("graphrefly/DIRTY"),Z=Symbol.for("graphrefly/RESOLVED"),Te=Symbol.for("graphrefly/INVALIDATE"),xe=Symbol.for("graphrefly/TEARDOWN"),z=Symbol.for("graphrefly/COMPLETE"),Q=Symbol.for("graphrefly/ERROR"),we=Object.freeze([X]),ve=Object.freeze([Z]),Se=Object.freeze([Te]),Ke=Object.freeze([ke]),Le=Object.freeze([z]),Me=Object.freeze([xe]),$e=Object.freeze([we]),Je=Object.freeze([ve]),ze=Object.freeze([Se]),Be=Object.freeze([Le]),He=Object.freeze([Me])});function te(e){return new Promise((t,r)=>{let n=!1,a=!1,o;o=e.subscribe(i=>{for(let s of i){if(n)return;if(s[0]===q){n=!0,t(s[1]),o?(o(),o=void 0):a=!0;return}if(s[0]===Q){n=!0,r(s[1]),o?(o(),o=void 0):a=!0;return}if(s[0]===z){n=!0,r(new Error("completed without DATA")),o?(o(),o=void 0):a=!0;return}}}),a&&(o?.(),o=void 0)})}var re=N(()=>{"use strict";ee()});var S,B=N(()=>{"use strict";S=class{_timer;_gen=0;start(t,r){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&r()},t)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Ce={};me(Ce,{fallbackAdapter:()=>le});module.exports=be(Ce);var L=require("node:fs"),I=require("node:path");var V=require("node:crypto"),k=require("node:fs"),w=require("node:path"),he=require("node:sqlite");function j(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(j);let t=e,r=Object.keys(t).sort(),n={};for(let a of r)n[a]=j(t[a]);return n}function W(e){return JSON.stringify(j(e),void 0,0)}function K(){let e=new Map;return{save(t,r){e.set(t,JSON.parse(JSON.stringify(r)))},load(t){let r=e.get(t);return r===void 0?null:JSON.parse(JSON.stringify(r))},clear(t){e.delete(t)},list(){return[...e.keys()].sort()}}}function $(e){let t=new TextEncoder,r=new TextDecoder("utf-8",{fatal:!0}),n=o=>{let i="";for(let s of o){if(s.length===1&&/[a-zA-Z0-9_-]/.test(s)){i+=s;continue}for(let c of t.encode(s))i+=`%${c.toString(16).padStart(2,"0")}`}return(0,w.join)(e,`${i}.json`)},a=o=>{if(!o.endsWith(".json"))return null;let i=o.slice(0,-5),s=[],c=u=>{for(let l=0;l<u.length;l++)s.push(u.charCodeAt(l))},d=0;for(;d<i.length;){let u=i[d];if(u==="%"&&d+2<i.length){let l=i.slice(d+1,d+3);if(/^[0-9a-f]{2}$/i.test(l)){s.push(Number.parseInt(l,16)),d+=3;continue}}c(u),d+=1}try{return r.decode(new Uint8Array(s))}catch{return null}};return{save(o,i){(0,k.mkdirSync)(e,{recursive:!0});let s=n(o),c=`${W(i)}
2
- `,d=(0,w.basename)(s),u=(0,w.dirname)(s),l=(0,w.join)(u,`.${d}.${(0,V.randomBytes)(8).toString("hex")}.tmp`);try{(0,k.writeFileSync)(l,c,"utf8"),(0,k.renameSync)(l,s)}catch(m){try{(0,k.unlinkSync)(l)}catch{}throw m}},load(o){try{let i=(0,k.readFileSync)(n(o),"utf8").trim();return i?JSON.parse(i):null}catch{return null}},clear(o){try{(0,k.unlinkSync)(n(o))}catch(i){if(i.code!=="ENOENT")throw i}},list(){try{let o=(0,k.readdirSync)(e),i=[];for(let s of o){if(s.startsWith("."))continue;let c=a(s);c!==null&&i.push(c)}return i.sort()}catch(o){if(o.code==="ENOENT")return[];throw o}}}}J();async function P(e){let t=typeof e=="string"?new TextEncoder().encode(e):e,r=await globalThis.crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r),a="";for(let o=0;o<n.length;o++)a+=G[n[o]];return a}var G=new Array(256);for(let e=0;e<256;e++)G[e]=e.toString(16).padStart(2,"0");J();re();function ne(e,t={}){let r=t.keyFn??(a=>String(a)),n=new Map;return a=>{let o=r(a),i=n.get(o);if(i)return i;let s=e(a),c;s!=null&&typeof s.then=="function"?c=Promise.resolve(s):s!=null&&typeof s=="object"&&"subscribe"in s&&"cache"in s?c=te(s):s!=null&&typeof s=="object"&&Symbol.asyncIterator in s?c=(async()=>{let l=s[Symbol.asyncIterator]();try{let{value:m,done:b}=await l.next();if(b)throw new Error("singleFromAny: factory returned empty async iterable");return m}finally{await l.return?.()}})():s!=null&&typeof s=="object"&&Symbol.iterator in s?c=(async()=>{let l=s[Symbol.iterator]();try{let{value:m,done:b}=l.next();if(b)throw new Error("singleFromAny: factory returned empty iterable");return m}finally{l.return?.()}})():c=Promise.resolve(s);let d,u=()=>{n.get(o)===d&&n.delete(o)};return d=c.then(l=>(u(),l),l=>{throw u(),l}),n.set(o,d),d}}B();var A=class extends Error{constructor(r,n){super(`withReplayCache: no cached response for ${n} (key=${r}, mode=read-strict)`);this.key=r;this.method=n}name="ReplayCacheMissError"};function oe(e,t){let r=t.mode??"read-write",n=t.cacheStreaming??!1,a=t.captureStreamCadence??!1,o=t.replaySpeed??1,i=t.keyPrefix??"llm-replay",s=t.storage,c=r==="read"||r==="read-strict",d=async(p,f)=>{if(t.keyFn){let v=t.keyFn;if(v.length<=1){let E={messages:p,opts:f,context:f?.keyContext},y=await v(E);return`${i}:${y}`}let O=await v(p,f);return`${i}:${O}`}let{signal:g,keyContext:h,...T}=f??{},M=H({messages:p,opts:T}),R=await P(M);return`${i}:${R}`},u=async p=>{if(r==="write-only")return;let f=await s.load(p);if(f!=null)try{return typeof f=="string"?JSON.parse(f):f}catch{return}},l=async p=>(await u(p))?.response,m=async(p,f,g)=>{if(c)return;let h={response:f,storedAtNs:C(),...g?{streamChunks:g.chunks,streamCadenceMs:g.delaysMs}:{}};await s.save(p,h)},b=p=>p<=0?Promise.resolve():new Promise(f=>{new S().start(p,()=>f())}),ue=ne(async({messages:p,invokeOpts:f})=>{let g=e.invoke(p,f);return await Ee(g)},{keyFn:({_precomputedKey:p})=>p});return{provider:e.provider,model:e.model,capabilities:e.capabilities?.bind(e),async invoke(p,f){let g=await d(p,f),h=await l(g);if(h)return{...h,metadata:{...h.metadata??{},replayCache:"hit"}};if(r==="read-strict")throw new A(g,"invoke");let T=await ue({messages:p,invokeOpts:f,_precomputedKey:g});return await m(g,T),T},async*stream(p,f){if(!n){for await(let y of e.stream(p,f))yield y;return}let g=await d(p,f),h=await u(g);if(h){let y=h.response;if(h.streamChunks&&h.streamCadenceMs)for(let x=0;x<h.streamChunks.length;x++){let D=h.streamCadenceMs[x]??0,U=o>0?D/o:0;U>0&&await b(U),yield{type:"token",delta:h.streamChunks[x]?.delta??""}}else y.content&&(yield{type:"token",delta:y.content});y.usage&&(yield{type:"usage",usage:y.usage}),yield{type:"finish",reason:y.finishReason??"stop"};return}if(r==="read-strict")throw new A(g,"stream");let T="",M,R,v=[],O=[],E;for await(let y of e.stream(p,f)){if(y.type==="token"&&(T+=y.delta,a)){let x=Y(),D=E===void 0?0:(x-E)/1e6;O.push(D),E=x,v.push({delta:y.delta})}y.type==="usage"&&(M=y.usage),y.type==="finish"&&(R=y.reason),yield y}if(T||M){let y={content:T,usage:M??{input:{regular:0},output:{regular:0}},finishReason:R,model:e.model??f?.model??"",provider:e.provider};await m(g,y,a?{chunks:v,delaysMs:O}:void 0)}}}}function H(e){let t=new Set,r=n=>{if(n===null||typeof n!="object")return n;let a=n;if(t.has(a))return{__cycle:!0};t.add(a);try{if(Array.isArray(n))return n.map(r);let o={};for(let i of Object.keys(n).sort())o[i]=r(n[i]);return o}finally{t.delete(a)}};return JSON.stringify(r(e))}async function Ee(e){if(e!=null&&typeof e.then=="function")return await e;if(e&&typeof e=="object"&&"content"in e)return e;throw new Error("withReplayCache: adapter.invoke must return Promise or LLMResponse (Node input not supported in cache path)")}B();function F(){let e=new Error("aborted");return e.name="AbortError",e}function se(e,t){return e<=0?Promise.resolve():t?.aborted?Promise.reject(F()):new Promise((r,n)=>{let a=new S,o,i=()=>{a.cancel(),t&&o&&t.removeEventListener("abort",o)};a.start(e,()=>{i(),r()}),t&&(o=()=>{i(),n(F())},t.addEventListener("abort",o,{once:!0}))})}function ae(e={}){let t=e.provider??"dry-run",r=e.model??"dry-run-v1",n=e.latencyMs??0,a=Math.max(1,e.streamChunkSize??16),o=e.respond??(s=>{let c=[...s].reverse().find(d=>d.role==="user");return c?`echo: ${c.content}`:"dry-run: no user message"}),i=e.usage??((s,c)=>{let d=s.reduce((u,l)=>u+l.content.length,0);return{input:{regular:Math.ceil(d/4)},output:{regular:Math.ceil(c.length/4)}}});return{provider:t,model:r,async invoke(s,c){if(await se(n,c?.signal),c?.signal?.aborted)throw F();let d=o(s,c),u=i(s,d);return{content:d,usage:u,finishReason:"stop",model:c?.model??r,provider:t,tier:c?.tier,metadata:{dryRun:!0}}},async*stream(s,c){let d=o(s,c),u=i(s,d),l=Math.ceil(d.length/a)||1,m=n>0?n/l:0;for(let b=0;b<d.length;b+=a){if(c?.signal?.aborted)throw F();await se(m,c?.signal),yield{type:"token",delta:d.slice(b,b+a)}}yield{type:"usage",usage:u},yield{type:"finish",reason:"stop"}}}}function ie(e,t){return{content:"[fallback: no cached response available for this request]",usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:t,provider:e,metadata:{degraded:!0,reason:"no-fixture"}}}function ce(e,t,r){return typeof e=="string"?{content:e,usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:r,provider:t,metadata:{degraded:!0,reason:"respond"}}:e}async function Ae(e,t){if("key"in e)return e.key;let r=H({messages:e.messages,opts:e.invokeOpts??{}}),n=await P(r);return`${t}:${n}`}function Re(e){let t={response:e.response,storedAtNs:C()};if("key"in e&&e.stream){let r=e.stream.chunks.filter(n=>n.type==="token");return{...t,streamChunks:r.map(n=>({delta:n.delta})),streamCadenceMs:e.stream.delaysMs??r.map(()=>0)}}return t}function Oe(e,t){let r=[];if(e.fixtures!=null&&r.push("fixtures"),e.fixturesStorage!=null&&r.push("fixturesStorage"),r.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\` and \`fixturesStorage\` are mutually exclusive; got both ${r.join(" and ")}. Pick one source. For filesystem directories use the node subpath's \`fallbackAdapter\`.`);if(e.fixtures){let n=K(),a=e.fixtures,o=(async()=>{for(let i of a){let s=await Ae(i,t);await n.save(s,Re(i))}})();return o.catch(()=>{}),{tier:n,seedReady:o}}return e.fixturesStorage?{tier:e.fixturesStorage,seedReady:Promise.resolve()}:{tier:void 0,seedReady:Promise.resolve()}}function de(e={}){let t=e.provider??"fallback",r=e.model??"fallback",n=e.onMiss??"respond",a=e.keyPrefix??"fallback",o=e.record?e.record.adapter:n==="throw"?ae({provider:t,model:r,respond:()=>"[unreachable: read-strict mode throws on miss]"}):{provider:t,model:r,async invoke(u,l){let m=e.respond?e.respond(u,l):ie(t,r);return ce(m,t,r)},async*stream(u,l){let m=e.respond?e.respond(u,l):ie(t,r),b=ce(m,t,r);yield{type:"token",delta:b.content},b.usage&&(yield{type:"usage",usage:b.usage}),yield{type:"finish",reason:b.finishReason??"stop"}}},i,s=Promise.resolve();if(e.record){if(!e.record.storage)throw new TypeError("fallbackAdapter: `record.storage` is required in record mode. For filesystem `record.dir` convenience, use the node subpath's `fallbackAdapter`.");i=e.record.storage}else{let u=Oe(e,a);i=u.tier??K(),s=u.seedReady}let c=e.record?"read-write":n==="throw"?"read-strict":"read",d=oe(o,{storage:i,mode:c,keyPrefix:a,cacheStreaming:!0,captureStreamCadence:!0,replaySpeed:e.replaySpeed,...e.keyFn?{keyFn:e.keyFn}:{}});return{provider:t,model:r,capabilities:d.capabilities?.bind(d),async invoke(u,l){return await s,d.invoke(u,l)},async*stream(u,l){await s;for await(let m of d.stream(u,l))yield m}}}function Ne(e){if(!(0,L.existsSync)(e))return;let t=(0,L.readdirSync)(e).filter(c=>c.endsWith(".json"));if(t.length===0)return;let r=t[0],n=(0,I.join)(e,r),a;try{a=JSON.parse((0,L.readFileSync)(n,"utf8"))}catch(c){throw new TypeError(`fallbackAdapter: ${n} is not valid JSON (${c.message}).`)}let o=a,i=o!=null&&"messages"in o,s=o==null||typeof o.response?.content!="string"||typeof o.storedAtNs!="number";if(i||s){let c=i?"`messages` at the top level means this looks hand-authored. ":"";throw new TypeError(`fallbackAdapter: ${n} is not in cache-file format. ${c}Expected \`{ response: { content, usage, ... }, storedAtNs, ... }\` (the shape \`withReplayCache\` and this adapter's \`record\` mode write). For hand-authored fixtures, use the inline \`fixtures: FallbackFixture[]\` option \u2014 the adapter hashes messages for you.`)}}function le(e={}){let t=e.keyPrefix??"fallback",r=[];if(e.fixtures!=null&&r.push("fixtures"),e.fixturesDir!=null&&r.push("fixturesDir"),e.fixturesStorage!=null&&r.push("fixturesStorage"),r.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\`, \`fixturesDir\`, and \`fixturesStorage\` are mutually exclusive; got both ${r.join(" and ")}. Pick one source.`);let n=e.fixturesStorage;if(e.fixturesDir!=null){let d=(0,I.join)(e.fixturesDir,t);Ne(d),n=$(d)}let a;if(e.record){if(e.record.storage&&e.record.dir)throw new TypeError("fallbackAdapter: `record.storage` and `record.dir` are mutually exclusive; pick one.");if(e.record.storage)a={adapter:e.record.adapter,storage:e.record.storage};else{let d=e.record.dir??e.fixturesDir;if(d==null)throw new TypeError("fallbackAdapter: record mode requires either `record.dir`, `record.storage`, or an inherited `fixturesDir`.");a={adapter:e.record.adapter,storage:$((0,I.join)(d,t))}}}let{fixturesDir:o,record:i,...s}=e,c={...s,...n?{fixturesStorage:n}:{},...a?{record:a}:{}};return de(c)}0&&(module.exports={fallbackAdapter});
1
+ "use strict";var ce=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Tt=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(t&&(e=t(t=0)),e);var At=(t,e)=>{for(var n in e)ce(t,n,{get:e[n],enumerable:!0})},Mt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of kt(e))!Tt.call(t,o)&&o!==n&&ce(t,o,{get:()=>e[o],enumerable:!(r=xt(e,o))||r.enumerable});return t};var Nt=t=>Mt(ce({},"__esModule",{value:!0}),t);function Re(){return Math.trunc(performance.now()*1e6)}function I(){return Date.now()*1e6}var q=T(()=>{"use strict"});var B,A,L,R,P,G,z,O,M,y,V,ye,Et,ge,Ct,Lt,me,De,Ie,Pe,be,X=T(()=>{"use strict";B=Symbol.for("graphrefly/START"),A=Symbol.for("graphrefly/DATA"),L=Symbol.for("graphrefly/DIRTY"),R=Symbol.for("graphrefly/RESOLVED"),P=Symbol.for("graphrefly/INVALIDATE"),G=Symbol.for("graphrefly/PAUSE"),z=Symbol.for("graphrefly/RESUME"),O=Symbol.for("graphrefly/TEARDOWN"),M=Symbol.for("graphrefly/COMPLETE"),y=Symbol.for("graphrefly/ERROR"),V=Object.freeze([L]),ye=Object.freeze([R]),Et=Object.freeze([P]),ge=Object.freeze([B]),Ct=Object.freeze([M]),Lt=Object.freeze([O]),me=Object.freeze([V]),De=Object.freeze([ye]),Ie=Object.freeze([Et]),Pe=Object.freeze([Ct]),be=Object.freeze([Lt])});function Ge(t){t.registerCodec(Rt)}var Rt,Ve=T(()=>{"use strict";Rt={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}}});function Z(t){if(t==null)return Ot;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Ot,He=T(()=>{"use strict";Ot={type:"system",id:""}});function $e(){return _e>0||Ft}function Be(){return _e>0}function ze(t){_e>0?Dt.push(t):t()}function Q(t,e,n){if(e.length===0)return;if(e.length===1){let c=n(e[0][0]);if(c<3||!$e()){t(e);return}(c>=5?We:c===4?Ue:je).push(()=>t(e));return}let r=e.length,o=r,i=r,d=r,s=0;for(;s<r&&n(e[s][0])<3;)s++;for(o=s;s<r&&n(e[s][0])===3;)s++;for(i=s;s<r&&n(e[s][0])===4;)s++;d=s;let a=$e();if(o>0){let c=e.slice(0,o);t(c)}if(i>o){let c=e.slice(o,i);a?je.push(()=>t(c)):t(c)}if(d>i){let c=e.slice(i,d);a?Ue.push(()=>t(c)):t(c)}if(r>d){let c=e.slice(d,r);a?We.push(()=>t(c)):t(c)}}var _e,Ft,je,Ue,We,Dt,Ke=T(()=>{"use strict";_e=0,Ft=!1,je=[],Ue=[],We=[],Dt=[]});function Je(t){t.registerMessageType(B,{tier:0,wireCrossing:!1}),t.registerMessageType(L,{tier:1,wireCrossing:!1}),t.registerMessageType(P,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(G,{tier:2,wireCrossing:!1}),t.registerMessageType(z,{tier:2,wireCrossing:!1}),t.registerMessageType(A,{tier:3,wireCrossing:!0}),t.registerMessageType(R,{tier:3,wireCrossing:!0}),t.registerMessageType(M,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(y,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(O,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var ee,qe=T(()=>{"use strict";X();ee=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var H,Ye=T(()=>{"use strict";H=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function ve(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(ve);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=ve(t[n]);return e}return null}function Gt(t){let e=Pt.encode(t),n=e.length,r=n*8,o=n+9+63&-64,i=new Uint8Array(o);i.set(e),i[n]=128;let d=new DataView(i.buffer);d.setUint32(o-4,r>>>0,!1),d.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let s=1779033703,a=3144134277,c=1013904242,l=2773480762,u=1359893119,f=2600822924,p=528734635,v=1541459225,g=new Uint32Array(64),b=(N,x)=>N>>>x|N<<32-x;for(let N=0;N<o;N+=64){for(let _=0;_<16;_++)g[_]=d.getUint32(N+_*4,!1);for(let _=16;_<64;_++){let W=g[_-15],$=g[_-2],J=b(W,7)^b(W,18)^W>>>3,de=b($,17)^b($,19)^$>>>10;g[_]=g[_-16]+J+g[_-7]+de>>>0}let x=s,E=a,S=c,h=l,m=u,C=f,F=p,ae=v;for(let _=0;_<64;_++){let W=b(m,6)^b(m,11)^b(m,25),$=m&C^~m&F,J=ae+W+$+It[_]+g[_]>>>0,de=b(x,2)^b(x,13)^b(x,22),vt=x&E^x&S^E&S,wt=de+vt>>>0;ae=F,F=C,C=m,m=h+J>>>0,h=S,S=E,E=x,x=J+wt>>>0}s=s+x>>>0,a=a+E>>>0,c=c+S>>>0,l=l+h>>>0,u=u+m>>>0,f=f+C>>>0,p=p+F>>>0,v=v+ae>>>0}let w=N=>N.toString(16).padStart(8,"0");return w(s)+w(a)+w(c)+w(l)+w(u)+w(f)+w(p)+w(v)}function we(t){let e=ve(t??null),n=JSON.stringify(e);return Gt(n).slice(0,16)}function Vt(){let t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function xe(t,e,n){let r=n?.id??Vt();if(t===0)return{id:r,version:0};let i=(n?.hash??we)(e);return{id:r,version:0,cid:i,prev:null}}function Xe(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var It,Pt,Ze=T(()=>{"use strict";It=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Pt=new TextEncoder});function tt(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function ke(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function te(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function rt(t,e,n){let r=nt(t)?t:[],o=typeof t=="function"?t:typeof e=="function"?e:void 0,i={};return nt(t)?i=(Te(e)?e:n)??{}:Te(t)?i=t:i=(Te(e)?e:n)??{},new ne(r,o,i)}var Qe,et,Ht,jt,Ae,ne,nt,Te,ot=T(()=>{"use strict";Ve();He();Ke();q();qe();Ye();X();Ze();Qe=()=>{},et=100;Ht=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},jt=(t,e,n,r)=>{let o=t;if(o._status==="completed"||o._status==="errored")return;let i=o._cached,d=i===void 0?[ge]:[ge,[A,i]];o._status==="dirty"&&d.push(V),Q(e,d,o._config.tierOf)},Ae=new ee({onMessage:Ht,onSubscribe:jt});Je(Ae);Ge(Ae);ne=class t{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,r){this._config=r.config??Ae,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=n,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??we;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?xe(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(tt);let i={};for(let[s,a]of Object.entries(r.meta??{})){let c={initial:a,name:`${r.name??"node"}:meta:${s}`,describeKind:"state",config:this._config};r.guard!=null&&(c.guard=r.guard),i[s]=new t([],void 0,c)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let d=this;this._actions={emit(s){d._emit([[A,s]])},down(s){d._emit(te(s))},up(s){d._emitUp(te(s))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let o=n?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let i=this._cached===void 0?void 0:this._cached,d=this._versioning,s=d?.id??n?.id,a=d?.version??0,c=xe(e,i,{id:s,hash:o});c.version=a,this._versioning=c,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=Z(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!n&&!r)return;let o=Z(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,i))throw new H({actor:o,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let d of this._extraGuards)if(!d(o,i))throw new H({actor:o,action:i,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:I()}}down(e,n){let r=te(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[A,e]])}up(e,n){if(this._deps.length===0)return;let r=te(e);if(r.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let o=n(r[0]);if(o===3||o===4)throw new Error(`Node "${this.name}": tier-${o} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let a=Z(n);if(!this._guard(a,"observe"))throw new H({actor:a,action:"observe",nodeName:this.name})}let o=this._isTerminal&&this._resubscribable;if(o){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let a of this._deps)ke(a);if(this._partial===!1){for(let a of this._deps)if(a.prevData!==void 0||a.dataBatch.length!==0||a.terminal!==void 0||a.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:o},this._actions)}catch(a){throw this._sinkCount-=1,a}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let d=this._isTerminal;if(this._sinkCount===1&&!d)try{this._activate()}catch(a){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw a}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let s=!1;return()=>{s||(s=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let r=0;r<e;r++){let o=r,i=this._deps[r];i.unsub=Qe,i.unsub=i.node.subscribe(d=>{if(i.unsub===null)return;let s=this._config.tierOf,a=!1;for(let c of d)s(c[0])>=3&&(a=!0),this._config.onMessage(this,c,{direction:"down-in",depIndex:o},this._actions);a&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let o=0;o<n;o++){let i=this._deps[o];if(i.unsub!=null){let d=i.unsub;i.unsub=null;try{d()}catch{}ke(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let n=this._deps.length,r=tt(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(me),r.unsub=Qe;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let i=this._config.tierOf,d=!1;for(let s of o)i(s[0])>=3&&(d=!0),this._config.onMessage(this,s,{direction:"down-in",depIndex:n},this._actions);d&&this._maybeRunFnOnSettlement()})}catch(o){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[y,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(o){this._emit([[y,this._wrapFnError("cleanup.deactivate threw",o)]])}}for(let r of this._deps){if(r.unsub!=null){let o=r.unsub;r.unsub=null;try{o()}catch{}}ke(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let r=this._deps[e],o=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let d of this._inspectorHooks)d(i)}if(o!==B){if(o===L){this._depDirtied(r);return}if(o===P){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ie);return}if(o===G||o===z){this._emit([n]);return}if(o===O){this._emit(be);return}if(o===A)this._depSettledAsData(r,n[1]);else if(o===R)this._depSettledAsResolved(r);else if(o===M)this._depSettledAsTerminal(r,!0);else if(o===y)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(o===A||o===R)&&this._emit([n]),(o===M||o===y)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(me))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(De),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[y,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Pe)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(d){this._emit([[y,this._wrapFnError("cleanup threw",d)]]);return}}else if(e!=null&&typeof e=="object"){let d=e.beforeRun;if(typeof d=="function"){e.beforeRun=void 0;try{d()}catch(s){this._emit([[y,this._wrapFnError("cleanup.beforeRun threw",s)]]);return}}}let n=this._deps.map(d=>d.involvedThisWave?d.dataBatch.length>0?[...d.dataBatch]:[]:void 0),r=this._deps.map(d=>d.prevData);for(let d=0;d<this._deps.length;d++){let s=n[d];s!=null&&s.length>0&&(this._deps[d].prevData=s[s.length-1])}let o=this._deps.map(d=>d.terminal),i={prevData:r,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let d={kind:"run",batchData:n,prevData:r};for(let s of this._inspectorHooks)s(d)}this._isExecutingFn=!0;try{let d=this._fn(n,this._actions,i);if(typeof d=="function")this._cleanup=d;else if(d!=null&&typeof d=="object"){let s=d;(typeof s.beforeRun=="function"||typeof s.deactivate=="function"||typeof s.invalidate=="function")&&(this._cleanup=d)}}catch(d){this._emit([[y,this._wrapFnError("fn threw",d)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>et?(this._rerunDepth=0,this._emit([[y,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${et} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let r=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[V,e[0]]:e;let r=!0,o=!1,i=!1,d=-1;for(let a of e){let c=n(a[0]);c<d&&(r=!1),c===3&&(o=!0),a[0]===L&&(i=!0),d=c}let s=e;if(!r){let a=e.map((c,l)=>({m:c,i:l,tier:n(c[0])}));a.sort((c,l)=>c.tier-l.tier||c.i-l.i),s=a.map(c=>c.m)}if(o&&!i&&this._status!=="dirty"){let a=0;for(;a<s.length&&n(s[a][0])===0;)a++;return a===0?[V,...s]:[...s.slice(0,a),V,...s.slice(a)]}return s}_emit(e){if(e.length===0)return;for(let s=0;s<e.length;s++){let a=e[s];if(a[0]===y&&a[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let s=e.filter(a=>a[0]===O||a[0]===P);if(s.length===0)return;n=s}n=this._frameBatch(n);let o=null;for(let s=0;s<n.length;s++){let a=n[s],c=a[0];if(c!==G&&c!==z){o?.push(a);continue}if(a.length<2)throw new Error(`Node "${this.name}": [[${c===G?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let u=a[1];if(c===G)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(u),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(u))l=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?o?.push(a):o==null&&(o=n.slice(0,s))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(s=>s[0]===O))for(let s of Object.keys(this.meta))try{this.meta[s]._emit(be)}catch{}let{finalMessages:i,equalsError:d}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let s=this._config.globalInspector;if(s!=null)try{s({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let s=this._config.tierOf,a=[];for(let c of i)s(c[0])===3?this._pauseBuffer.push(c):a.push(c);a.length>0&&this._dispatchOrAccumulate(a)}else this._dispatchOrAccumulate(i);d!=null&&this._emit([[y,d]])}_updateState(e){let n=this._config.tierOf,r,o,i=-1,d=0;for(let l of e)n(l[0])===3&&d++;let s=d<=1,a=-1;if(this._versioning!=null&&d>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===A){a=l;break}}for(let l=0;l<e.length;l++){let u=e[l],f=u[0];if(f===A){if(u.length>=2){let p=!1;if(s&&this._cached!==void 0)try{p=this._equals(this._cached,u[1])}catch(v){o=this._wrapFnError("equals threw",v),i=l;break}if(p){r==null&&(r=e.slice(0,l)),r.push(ye),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(a<0||l===a)&&Xe(this._versioning,u[1],this._hashFn)}this._status="settled",r?.push(u)}else if(r?.push(u),f===L)this._status="dirty";else if(f===R)this._status="resolved";else if(f===M)this._status="completed";else if(f===y)this._status="errored";else if(f===P){this._cached=void 0,this._status="dirty";let p=this._cleanup;if(typeof p=="function"){this._cleanup=void 0;try{p()}catch{}}else if(p!=null&&typeof p=="object"){let v=p.invalidate;if(typeof v=="function")try{v()}catch{}}}else f===O&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let c=i>=0?r??e.slice(0,i):r??e;return o!=null?{finalMessages:c,equalsError:o}:{finalMessages:c}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Be()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],ze(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}Q(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);Q(this._deliverToSinks,n,this._config.tierOf)}},nt=t=>Array.isArray(t),Te=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function re(t,e){return rt((r,o,i)=>t(o,i)??void 0,{describeKind:"producer",...e})}var st=T(()=>{"use strict";ot()});function Me(t){return{describeKind:"producer",...t}}function it(t,e){return re(n=>{let r=!1;try{for(let o of t){if(r)return;n.emit(o)}r||n.down([[M]])}catch(o){r||n.down([[y,o]])}return()=>{r=!0}},Me(e))}function Ut(t){return t!=null&&typeof t.then=="function"}function Wt(t,e){let{signal:n,...r}=e??{};return re(o=>{let i=!1,d=()=>{i||(i=!0,o.down([[y,n.reason]]))};if(n?.aborted){d();return}return n?.addEventListener("abort",d,{once:!0}),Promise.resolve(t).then(s=>{i||(i=!0,n?.removeEventListener("abort",d),o.emit(s),o.down([[M]]))},s=>{i||(i=!0,n?.removeEventListener("abort",d),o.down([[y,s]]))}),()=>{i=!0,n?.removeEventListener("abort",d)}},Me(r))}function $t(t,e){let{signal:n,...r}=e??{};return re(o=>{let i=new AbortController,d=()=>i.abort(n?.reason);n?.aborted?i.abort(n.reason):n?.addEventListener("abort",d,{once:!0});let s=n??i.signal,a=!1,c=t[Symbol.asyncIterator](),l=()=>{a||s.aborted||Promise.resolve(c.next()).then(u=>{if(!(a||s.aborted)){if(u.done){o.down([[M]]);return}o.emit(u.value),l()}},u=>{!a&&!s.aborted&&o.down([[y,u]])})};return l(),()=>{a=!0,n?.removeEventListener("abort",d),i.abort(),Promise.resolve(c.return?.()).catch(()=>{})}},Me(r))}function Bt(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function Ne(t,e){if(Bt(t))return t;if(Ut(t))return Wt(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return $t(t,e);if(typeof n[Symbol.iterator]=="function")return it(t,e)}return zt(t)}function zt(...t){return it(t,void 0)}function oe(t){return new Promise((e,n)=>{let r=!1,o=!1,i;i=t.subscribe(d=>{for(let s of d){if(r)return;if(s[0]===A){r=!0,e(s[1]),i?(i(),i=void 0):o=!0;return}if(s[0]===y){r=!0,n(s[1]),i?(i(),i=void 0):o=!0;return}if(s[0]===M){r=!0,n(new Error("completed without DATA")),i?(i(),i=void 0):o=!0;return}}}),o&&(i?.(),i=void 0)})}var Se=T(()=>{"use strict";X();st()});var j,Ee=T(()=>{"use strict";j=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Zt={};At(Zt,{fallbackAdapter:()=>_t});module.exports=Nt(Zt);var U=require("node:fs"),ie=require("node:path");var Le=require("node:crypto"),k=require("node:fs"),D=require("node:path"),St=require("node:sqlite");function le(t){if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(le);let e=t,n=Object.keys(e).sort(),r={};for(let o of n)r[o]=le(e[o]);return r}function Ce(t){return JSON.stringify(le(t),void 0,0)}function ue(){let t=new Map;return{save(e,n){t.set(e,JSON.parse(JSON.stringify(n)))},load(e){let n=t.get(e);return n===void 0?null:JSON.parse(JSON.stringify(n))},clear(e){t.delete(e)},list(){return[...t.keys()].sort()}}}function fe(t){let e=new TextEncoder,n=new TextDecoder("utf-8",{fatal:!0}),r=i=>{let d="";for(let s of i){if(s.length===1&&/[a-zA-Z0-9_-]/.test(s)){d+=s;continue}for(let a of e.encode(s))d+=`%${a.toString(16).padStart(2,"0")}`}return(0,D.join)(t,`${d}.json`)},o=i=>{if(!i.endsWith(".json"))return null;let d=i.slice(0,-5),s=[],a=l=>{for(let u=0;u<l.length;u++)s.push(l.charCodeAt(u))},c=0;for(;c<d.length;){let l=d[c];if(l==="%"&&c+2<d.length){let u=d.slice(c+1,c+3);if(/^[0-9a-f]{2}$/i.test(u)){s.push(Number.parseInt(u,16)),c+=3;continue}}a(l),c+=1}try{return n.decode(new Uint8Array(s))}catch{return null}};return{save(i,d){(0,k.mkdirSync)(t,{recursive:!0});let s=r(i),a=`${Ce(d)}
2
+ `,c=(0,D.basename)(s),l=(0,D.dirname)(s),u=(0,D.join)(l,`.${c}.${(0,Le.randomBytes)(8).toString("hex")}.tmp`);try{(0,k.writeFileSync)(u,a,"utf8"),(0,k.renameSync)(u,s)}catch(f){try{(0,k.unlinkSync)(u)}catch{}throw f}},load(i){try{let d=(0,k.readFileSync)(r(i),"utf8").trim();return d?JSON.parse(d):null}catch{return null}},clear(i){try{(0,k.unlinkSync)(r(i))}catch(d){if(d.code!=="ENOENT")throw d}},list(){try{let i=(0,k.readdirSync)(t),d=[];for(let s of i){if(s.startsWith("."))continue;let a=o(s);a!==null&&d.push(a)}return d.sort()}catch(i){if(i.code==="ENOENT")return[];throw i}}}}q();async function Y(t){let e=typeof t=="string"?new TextEncoder().encode(t):t,n=await globalThis.crypto.subtle.digest("SHA-256",e),r=new Uint8Array(n),o="";for(let i=0;i<r.length;i++)o+=Oe[r[i]];return o}var Oe=new Array(256);for(let t=0;t<256;t++)Oe[t]=t.toString(16).padStart(2,"0");q();var pe=class extends Error{constructor(n,r){super(`content-addressed lookup miss in read-strict mode: ${n}`);this.key=n;this.context=r;this.name="ContentAddressedMissError"}};function he(t){let e=new Set,n=r=>{if(r===null||typeof r!="object")return r;let o=r;if(e.has(o))return{__cycle:!0};e.add(o);try{if(Array.isArray(r))return r.map(n);let i={};for(let d of Object.keys(r).sort())i[d]=n(r[d]);return i}finally{e.delete(o)}};return JSON.stringify(n(t))}function Fe(t){let{storage:e,keyContext:n,keyPrefix:r,mode:o="read-write"}=t,i=n??(s=>s);async function d(s){let a=he(i(s)),c=await Y(a);return r?`${r}:${c}`:c}return{keyFor:d,async lookup(s){if(o==="write")return;let a=await d(s),c=await e.load(a);if(c==null){if(o==="read-strict")throw new pe(a,s);return}return c},async store(s,a){if(o==="read")return;let c=await d(s);await e.save(c,a)},async forget(s){if(o==="read"||o==="write"||!e.clear)return;let a=await d(s);await e.clear(a)}}}Se();function at(t,e={}){let n=e.keyFn??(o=>String(o)),r=new Map;return o=>{let i=n(o),d=r.get(i);if(d)return d;let s=t(o),a;s!=null&&typeof s.then=="function"?a=Promise.resolve(s):s!=null&&typeof s=="object"&&"subscribe"in s&&"cache"in s?a=oe(s):s!=null&&typeof s=="object"&&Symbol.asyncIterator in s?a=(async()=>{let u=s[Symbol.asyncIterator]();try{let{value:f,done:p}=await u.next();if(p)throw new Error("singleFromAny: factory returned empty async iterable");return f}finally{await u.return?.()}})():s!=null&&typeof s=="object"&&Symbol.iterator in s?a=(async()=>{let u=s[Symbol.iterator]();try{let{value:f,done:p}=u.next();if(p)throw new Error("singleFromAny: factory returned empty iterable");return f}finally{u.return?.()}})():a=Promise.resolve(s);let c,l=()=>{r.get(i)===c&&r.delete(i)};return c=a.then(u=>(l(),u),u=>{throw l(),u}),r.set(i,c),c}}Se();Ee();function dt(t){let{storage:e,mode:n="read-write",keyFn:r,keyPrefix:o="llm-replay"}=t,d=Fe({storage:e,keyPrefix:o,mode:n==="read-strict"?"read":n,keyContext:({messages:a,opts:c})=>{let{signal:l,keyContext:u,...f}=c??{};return{messages:a,opts:f}}});async function s(a,c){if(r){if(r.length<=1){let u={messages:a,opts:c,context:c?.keyContext},f=await r(u);return`${o}:${f}`}let l=await r(a,c);return`${o}:${l}`}return d.keyFor({messages:a,opts:c})}return{keyFor:s,async lookup(a,c){if(n!=="write"){if(r){let l=await s(a,c),u=await e.load(l);return u??void 0}return d.lookup({messages:a,opts:c})}},async store(a,c,l){if(n!=="read"){if(r){let u=await s(a,c);await e.save(u,l);return}await d.store({messages:a,opts:c},l)}},async forget(a,c){if(!(n==="read"||n==="write")&&e.clear){if(r){let l=await s(a,c);await e.clear(l);return}await d.forget({messages:a,opts:c})}}}}function ct(t,e,n){return{provider:n?.provider??t.provider,model:n?.model??t.model,capabilities:n?.capabilities??t.capabilities?.bind(t),invoke:e.invoke,stream:e.stream}}var lt=Symbol.for("graphrefly.adapter.middlewareLayers");function ut(t,e,n){let o=[...n?Kt(n):[],e];return Object.defineProperty(t,lt,{value:Object.freeze(o),enumerable:!1,writable:!1,configurable:!1}),t}function Kt(t){let e=t[lt];return Array.isArray(e)?e:[]}var K=class extends Error{constructor(n,r){super(`withReplayCache: no cached response for ${r} (key=${n}, mode=read-strict)`);this.key=n;this.method=r}name="ReplayCacheMissError"};function ft(t,e){let n=e.mode??"read-write",r=e.cacheStreaming??!1,o=e.captureStreamCadence??!1,i=e.replaySpeed??1,d=e.keyPrefix??"llm-replay",s=n==="read"||n==="read-strict",a=dt({storage:e.storage,mode:n==="write-only"?"write":n,keyFn:e.keyFn,keyPrefix:d}),c=f=>f<=0?Promise.resolve():new Promise(p=>{new j().start(f,()=>p())}),l=at(async({messages:f,invokeOpts:p})=>await oe(Ne(t.invoke(f,p))),{keyFn:({_precomputedKey:f})=>f}),u=ct(t,{async invoke(f,p){let v=await a.keyFor(f,p),g=await a.lookup(f,p);if(g?.response){let w=g.response;return{...w,metadata:{...w.metadata??{},replayCache:"hit"}}}if(n==="read-strict")throw new K(v,"invoke");let b=await l({messages:f,invokeOpts:p,_precomputedKey:v});return s||await a.store(f,p,{response:b,storedAtNs:I()}),b},async*stream(f,p){if(!r){for await(let h of t.stream(f,p))yield h;return}let v=await a.keyFor(f,p),g=await a.lookup(f,p);if(g){let h=g.response;if(g.streamChunks&&g.streamCadenceMs)for(let m=0;m<g.streamChunks.length;m++){let C=g.streamCadenceMs[m]??0,F=i>0?C/i:0;F>0&&await c(F),yield{type:"token",delta:g.streamChunks[m]?.delta??""}}else h.content&&(yield{type:"token",delta:h.content});h.usage&&(yield{type:"usage",usage:h.usage}),yield{type:"finish",reason:h.finishReason??"stop"};return}if(n==="read-strict")throw new K(v,"stream");let b="",w,N,x=[],E=[],S;for await(let h of t.stream(f,p)){if(h.type==="token"&&(b+=h.delta,o)){let m=Re(),C=S===void 0?0:(m-S)/1e6;E.push(C),S=m,x.push({delta:h.delta})}h.type==="usage"&&(w=h.usage),h.type==="finish"&&(N=h.reason),yield h}if((b||w)&&!s){let m={response:{content:b,usage:w??{input:{regular:0},output:{regular:0}},finishReason:N,model:t.model??p?.model??"",provider:t.provider},storedAtNs:I(),...o?{streamChunks:x,streamCadenceMs:E}:{}};await a.store(f,p,m)}}});return ut(u,"withReplayCache",t),u}var pt=he;Ee();function se(){let t=new Error("aborted");return t.name="AbortError",t}function ht(t,e){return t<=0?Promise.resolve():e?.aborted?Promise.reject(se()):new Promise((n,r)=>{let o=new j,i,d=()=>{o.cancel(),e&&i&&e.removeEventListener("abort",i)};o.start(t,()=>{d(),n()}),e&&(i=()=>{d(),r(se())},e.addEventListener("abort",i,{once:!0}))})}function yt(t={}){let e=t.provider??"dry-run",n=t.model??"dry-run-v1",r=t.latencyMs??0,o=Math.max(1,t.streamChunkSize??16),i=t.respond??(s=>{let a=[...s].reverse().find(c=>c.role==="user");return a?`echo: ${a.content}`:"dry-run: no user message"}),d=t.usage??((s,a)=>{let c=s.reduce((l,u)=>l+u.content.length,0);return{input:{regular:Math.ceil(c/4)},output:{regular:Math.ceil(a.length/4)}}});return{provider:e,model:n,async invoke(s,a){if(await ht(r,a?.signal),a?.signal?.aborted)throw se();let c=i(s,a),l=d(s,c);return{content:c,usage:l,finishReason:"stop",model:a?.model??n,provider:e,tier:a?.tier,metadata:{dryRun:!0}}},async*stream(s,a){let c=i(s,a),l=d(s,c),u=Math.ceil(c.length/o)||1,f=r>0?r/u:0;for(let p=0;p<c.length;p+=o){if(a?.signal?.aborted)throw se();await ht(f,a?.signal),yield{type:"token",delta:c.slice(p,p+o)}}yield{type:"usage",usage:l},yield{type:"finish",reason:"stop"}}}}function gt(t,e){return{content:"[fallback: no cached response available for this request]",usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:e,provider:t,metadata:{degraded:!0,reason:"no-fixture"}}}function mt(t,e,n){return typeof t=="string"?{content:t,usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:n,provider:e,metadata:{degraded:!0,reason:"respond"}}:t}async function Jt(t,e){if("key"in t)return t.key;let n=pt({messages:t.messages,opts:t.invokeOpts??{}}),r=await Y(n);return`${e}:${r}`}function qt(t){let e={response:t.response,storedAtNs:I()};if("key"in t&&t.stream){let n=t.stream.chunks.filter(r=>r.type==="token");return{...e,streamChunks:n.map(r=>({delta:r.delta})),streamCadenceMs:t.stream.delaysMs??n.map(()=>0)}}return e}function Yt(t,e){let n=[];if(t.fixtures!=null&&n.push("fixtures"),t.fixturesStorage!=null&&n.push("fixturesStorage"),n.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\` and \`fixturesStorage\` are mutually exclusive; got both ${n.join(" and ")}. Pick one source. For filesystem directories use the node subpath's \`fallbackAdapter\`.`);if(t.fixtures){let r=ue(),o=t.fixtures,i=(async()=>{for(let d of o){let s=await Jt(d,e);await r.save(s,qt(d))}})();return i.catch(()=>{}),{tier:r,seedReady:i}}return t.fixturesStorage?{tier:t.fixturesStorage,seedReady:Promise.resolve()}:{tier:void 0,seedReady:Promise.resolve()}}function bt(t={}){let e=t.provider??"fallback",n=t.model??"fallback",r=t.onMiss??"respond",o=t.keyPrefix??"fallback",i=t.record?t.record.adapter:r==="throw"?yt({provider:e,model:n,respond:()=>"[unreachable: read-strict mode throws on miss]"}):{provider:e,model:n,async invoke(l,u){let f=t.respond?t.respond(l,u):gt(e,n);return mt(f,e,n)},async*stream(l,u){let f=t.respond?t.respond(l,u):gt(e,n),p=mt(f,e,n);yield{type:"token",delta:p.content},p.usage&&(yield{type:"usage",usage:p.usage}),yield{type:"finish",reason:p.finishReason??"stop"}}},d,s=Promise.resolve();if(t.record){if(!t.record.storage)throw new TypeError("fallbackAdapter: `record.storage` is required in record mode. For filesystem `record.dir` convenience, use the node subpath's `fallbackAdapter`.");d=t.record.storage}else{let l=Yt(t,o);d=l.tier??ue(),s=l.seedReady}let a=t.record?"read-write":r==="throw"?"read-strict":"read",c=ft(i,{storage:d,mode:a,keyPrefix:o,cacheStreaming:!0,captureStreamCadence:!0,replaySpeed:t.replaySpeed,...t.keyFn?{keyFn:t.keyFn}:{}});return{provider:e,model:n,capabilities:c.capabilities?.bind(c),async invoke(l,u){return await s,c.invoke(l,u)},async*stream(l,u){await s;for await(let f of c.stream(l,u))yield f}}}function Xt(t){if(!(0,U.existsSync)(t))return;let e=(0,U.readdirSync)(t).filter(a=>a.endsWith(".json"));if(e.length===0)return;let n=e[0],r=(0,ie.join)(t,n),o;try{o=JSON.parse((0,U.readFileSync)(r,"utf8"))}catch(a){throw new TypeError(`fallbackAdapter: ${r} is not valid JSON (${a.message}).`)}let i=o,d=i!=null&&"messages"in i,s=i==null||typeof i.response?.content!="string"||typeof i.storedAtNs!="number";if(d||s){let a=d?"`messages` at the top level means this looks hand-authored. ":"";throw new TypeError(`fallbackAdapter: ${r} is not in cache-file format. ${a}Expected \`{ response: { content, usage, ... }, storedAtNs, ... }\` (the shape \`withReplayCache\` and this adapter's \`record\` mode write). For hand-authored fixtures, use the inline \`fixtures: FallbackFixture[]\` option \u2014 the adapter hashes messages for you.`)}}function _t(t={}){let e=t.keyPrefix??"fallback",n=[];if(t.fixtures!=null&&n.push("fixtures"),t.fixturesDir!=null&&n.push("fixturesDir"),t.fixturesStorage!=null&&n.push("fixturesStorage"),n.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\`, \`fixturesDir\`, and \`fixturesStorage\` are mutually exclusive; got both ${n.join(" and ")}. Pick one source.`);let r=t.fixturesStorage;if(t.fixturesDir!=null){let c=(0,ie.join)(t.fixturesDir,e);Xt(c),r=fe(c)}let o;if(t.record){if(t.record.storage&&t.record.dir)throw new TypeError("fallbackAdapter: `record.storage` and `record.dir` are mutually exclusive; pick one.");if(t.record.storage)o={adapter:t.record.adapter,storage:t.record.storage};else{let c=t.record.dir??t.fixturesDir;if(c==null)throw new TypeError("fallbackAdapter: record mode requires either `record.dir`, `record.storage`, or an inherited `fixturesDir`.");o={adapter:t.record.adapter,storage:fe((0,ie.join)(c,e))}}}let{fixturesDir:i,record:d,...s}=t,a={...s,...r?{fixturesStorage:r}:{},...o?{record:o}:{}};return bt(a)}0&&(module.exports={fallbackAdapter});
@@ -1,9 +1,10 @@
1
1
  import { StorageTier } from '../../extra/storage-core.cjs';
2
- import { L as LLMAdapter } from '../../types-O3GzJY2U.cjs';
3
- import { F as FallbackAdapterOptions } from '../../fallback-BaTS7vVY.cjs';
4
- export { a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy } from '../../fallback-BaTS7vVY.cjs';
5
- import '../../extra/sources.cjs';
2
+ import { L as LLMAdapter } from '../../types-BgMqbc7N.cjs';
3
+ import { F as FallbackAdapterOptions } from '../../fallback-Cb3GH1O7.cjs';
4
+ export { a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy } from '../../fallback-Cb3GH1O7.cjs';
6
5
  import '../../node-BVV7G1bq.cjs';
6
+ import '../../extra/sources.cjs';
7
+ import '../../content-addressed-storage-DqIWCmZG.cjs';
7
8
 
8
9
  /**
9
10
  * Node-subpath extension of {@link fallbackAdapter} — adds filesystem
@@ -1,9 +1,10 @@
1
1
  import { StorageTier } from '../../extra/storage-core.js';
2
- import { L as LLMAdapter } from '../../types-u64Ose53.js';
3
- import { F as FallbackAdapterOptions } from '../../fallback-eOm3LNxP.js';
4
- export { a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy } from '../../fallback-eOm3LNxP.js';
5
- import '../../extra/sources.js';
2
+ import { L as LLMAdapter } from '../../types-CdfO2QTt.js';
3
+ import { F as FallbackAdapterOptions } from '../../fallback-DRjJ_ZM8.js';
4
+ export { a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy } from '../../fallback-DRjJ_ZM8.js';
6
5
  import '../../node-BVV7G1bq.js';
6
+ import '../../extra/sources.js';
7
+ import '../../content-addressed-storage-BUiREIuj.js';
7
8
 
8
9
  /**
9
10
  * Node-subpath extension of {@link fallbackAdapter} — adds filesystem
@@ -1 +1 @@
1
- import{f}from"../../chunk-7JDLFI6N.js";import"../../chunk-ISCENNXS.js";import"../../chunk-ESMPEKEV.js";import{a as c}from"../../chunk-3JXNEPCD.js";import"../../chunk-I6VIH3VA.js";import"../../chunk-KASHOCF5.js";import"../../chunk-W4TSQ6RJ.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";import{existsSync as u,readdirSync as k,readFileSync as h}from"fs";import{join as p}from"path";function b(e){if(!u(e))return;let i=k(e).filter(o=>o.endsWith(".json"));if(i.length===0)return;let r=i[0],a=p(e,r),t;try{t=JSON.parse(h(a,"utf8"))}catch(o){throw new TypeError(`fallbackAdapter: ${a} is not valid JSON (${o.message}).`)}let s=t,l=s!=null&&"messages"in s,d=s==null||typeof s.response?.content!="string"||typeof s.storedAtNs!="number";if(l||d){let o=l?"`messages` at the top level means this looks hand-authored. ":"";throw new TypeError(`fallbackAdapter: ${a} is not in cache-file format. ${o}Expected \`{ response: { content, usage, ... }, storedAtNs, ... }\` (the shape \`withReplayCache\` and this adapter's \`record\` mode write). For hand-authored fixtures, use the inline \`fixtures: FallbackFixture[]\` option \u2014 the adapter hashes messages for you.`)}}function x(e={}){let i=e.keyPrefix??"fallback",r=[];if(e.fixtures!=null&&r.push("fixtures"),e.fixturesDir!=null&&r.push("fixturesDir"),e.fixturesStorage!=null&&r.push("fixturesStorage"),r.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\`, \`fixturesDir\`, and \`fixturesStorage\` are mutually exclusive; got both ${r.join(" and ")}. Pick one source.`);let a=e.fixturesStorage;if(e.fixturesDir!=null){let n=p(e.fixturesDir,i);b(n),a=c(n)}let t;if(e.record){if(e.record.storage&&e.record.dir)throw new TypeError("fallbackAdapter: `record.storage` and `record.dir` are mutually exclusive; pick one.");if(e.record.storage)t={adapter:e.record.adapter,storage:e.record.storage};else{let n=e.record.dir??e.fixturesDir;if(n==null)throw new TypeError("fallbackAdapter: record mode requires either `record.dir`, `record.storage`, or an inherited `fixturesDir`.");t={adapter:e.record.adapter,storage:c(p(n,i))}}}let{fixturesDir:s,record:l,...d}=e,o={...d,...a?{fixturesStorage:a}:{},...t?{record:t}:{}};return f(o)}export{x as fallbackAdapter};
1
+ import{k as f}from"../../chunk-FTA5TB2A.js";import"../../chunk-4VXL3UZK.js";import"../../chunk-ESMPEKEV.js";import{a as c}from"../../chunk-3JXNEPCD.js";import"../../chunk-I6VIH3VA.js";import"../../chunk-WQ7I7JVU.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-UMH3HSP7.js";import"../../chunk-7AJKUA36.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";import{existsSync as u,readdirSync as k,readFileSync as h}from"fs";import{join as p}from"path";function b(e){if(!u(e))return;let i=k(e).filter(o=>o.endsWith(".json"));if(i.length===0)return;let r=i[0],a=p(e,r),t;try{t=JSON.parse(h(a,"utf8"))}catch(o){throw new TypeError(`fallbackAdapter: ${a} is not valid JSON (${o.message}).`)}let s=t,l=s!=null&&"messages"in s,d=s==null||typeof s.response?.content!="string"||typeof s.storedAtNs!="number";if(l||d){let o=l?"`messages` at the top level means this looks hand-authored. ":"";throw new TypeError(`fallbackAdapter: ${a} is not in cache-file format. ${o}Expected \`{ response: { content, usage, ... }, storedAtNs, ... }\` (the shape \`withReplayCache\` and this adapter's \`record\` mode write). For hand-authored fixtures, use the inline \`fixtures: FallbackFixture[]\` option \u2014 the adapter hashes messages for you.`)}}function x(e={}){let i=e.keyPrefix??"fallback",r=[];if(e.fixtures!=null&&r.push("fixtures"),e.fixturesDir!=null&&r.push("fixturesDir"),e.fixturesStorage!=null&&r.push("fixturesStorage"),r.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\`, \`fixturesDir\`, and \`fixturesStorage\` are mutually exclusive; got both ${r.join(" and ")}. Pick one source.`);let a=e.fixturesStorage;if(e.fixturesDir!=null){let n=p(e.fixturesDir,i);b(n),a=c(n)}let t;if(e.record){if(e.record.storage&&e.record.dir)throw new TypeError("fallbackAdapter: `record.storage` and `record.dir` are mutually exclusive; pick one.");if(e.record.storage)t={adapter:e.record.adapter,storage:e.record.storage};else{let n=e.record.dir??e.fixturesDir;if(n==null)throw new TypeError("fallbackAdapter: record mode requires either `record.dir`, `record.storage`, or an inherited `fixturesDir`.");t={adapter:e.record.adapter,storage:c(p(n,i))}}}let{fixturesDir:s,record:l,...d}=e,o={...d,...a?{fixturesStorage:a}:{},...t?{record:t}:{}};return f(o)}export{x as fallbackAdapter};