@graphrefly/graphrefly 0.44.0 → 0.46.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 (720) hide show
  1. package/README.md +22 -19
  2. package/dist/_internal-B23BagFd.d.cts +33 -0
  3. package/dist/_internal-B23BagFd.d.ts +33 -0
  4. package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
  5. package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
  6. package/dist/agents-C0Ji9ldU.d.cts +629 -0
  7. package/dist/agents-C9zexT7I.d.ts +629 -0
  8. package/dist/audit-BAXb3VOg.d.ts +246 -0
  9. package/dist/audit-C_bPfkqS.d.cts +246 -0
  10. package/dist/backoff-7KIK3WQW.js +24 -0
  11. package/dist/backoff-7KIK3WQW.js.map +1 -0
  12. package/dist/backoff-Bnb9OoPh.d.cts +6 -0
  13. package/dist/backoff-Bnb9OoPh.d.ts +6 -0
  14. package/dist/base/composition/index.cjs +811 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +469 -0
  17. package/dist/base/composition/index.d.ts +469 -0
  18. package/dist/base/composition/index.js +40 -0
  19. package/dist/base/composition/index.js.map +1 -0
  20. package/dist/base/index.cjs +6336 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +22 -0
  23. package/dist/base/index.d.ts +22 -0
  24. package/dist/base/index.js +259 -0
  25. package/dist/base/index.js.map +1 -0
  26. package/dist/base/io/index.cjs +3270 -0
  27. package/dist/base/io/index.cjs.map +1 -0
  28. package/dist/base/io/index.d.cts +2245 -0
  29. package/dist/base/io/index.d.ts +2245 -0
  30. package/dist/base/io/index.js +117 -0
  31. package/dist/base/io/index.js.map +1 -0
  32. package/dist/base/meta/index.cjs +43 -0
  33. package/dist/base/meta/index.cjs.map +1 -0
  34. package/dist/base/meta/index.d.cts +45 -0
  35. package/dist/base/meta/index.d.ts +45 -0
  36. package/dist/base/meta/index.js +13 -0
  37. package/dist/base/meta/index.js.map +1 -0
  38. package/dist/base/mutation/index.cjs +200 -0
  39. package/dist/base/mutation/index.cjs.map +1 -0
  40. package/dist/base/mutation/index.d.cts +177 -0
  41. package/dist/base/mutation/index.d.ts +177 -0
  42. package/dist/base/mutation/index.js +22 -0
  43. package/dist/base/mutation/index.js.map +1 -0
  44. package/dist/base/render/index.cjs +1120 -0
  45. package/dist/base/render/index.cjs.map +1 -0
  46. package/dist/{extra/render/index.d.ts → base/render/index.d.cts} +75 -31
  47. package/dist/{extra/render/index.d.cts → base/render/index.d.ts} +75 -31
  48. package/dist/base/render/index.js +24 -0
  49. package/dist/base/render/index.js.map +1 -0
  50. package/dist/base/sources/browser/index.cjs +172 -0
  51. package/dist/base/sources/browser/index.cjs.map +1 -0
  52. package/dist/base/sources/browser/index.d.cts +84 -0
  53. package/dist/base/sources/browser/index.d.ts +84 -0
  54. package/dist/base/sources/browser/index.js +151 -0
  55. package/dist/base/sources/browser/index.js.map +1 -0
  56. package/dist/base/sources/event/index.cjs +98 -0
  57. package/dist/base/sources/event/index.cjs.map +1 -0
  58. package/dist/base/sources/event/index.d.cts +91 -0
  59. package/dist/base/sources/event/index.d.ts +91 -0
  60. package/dist/base/sources/event/index.js +13 -0
  61. package/dist/base/sources/event/index.js.map +1 -0
  62. package/dist/base/sources/index.cjs +755 -0
  63. package/dist/base/sources/index.cjs.map +1 -0
  64. package/dist/{extra/sources.d.ts → base/sources/index.d.cts} +74 -301
  65. package/dist/{extra/sources.d.cts → base/sources/index.d.ts} +74 -301
  66. package/dist/base/sources/index.js +42 -0
  67. package/dist/base/sources/index.js.map +1 -0
  68. package/dist/base/sources/node/index.cjs +320 -0
  69. package/dist/base/sources/node/index.cjs.map +1 -0
  70. package/dist/{extra/node.d.ts → base/sources/node/index.d.cts} +35 -37
  71. package/dist/{extra/node.d.cts → base/sources/node/index.d.ts} +35 -37
  72. package/dist/base/sources/node/index.js +306 -0
  73. package/dist/base/sources/node/index.js.map +1 -0
  74. package/dist/base/utils/index.cjs +37 -0
  75. package/dist/base/utils/index.cjs.map +1 -0
  76. package/dist/base/utils/index.d.cts +37 -0
  77. package/dist/base/utils/index.d.ts +37 -0
  78. package/dist/base/utils/index.js +11 -0
  79. package/dist/base/utils/index.js.map +1 -0
  80. package/dist/base/worker/index.cjs +548 -0
  81. package/dist/base/worker/index.cjs.map +1 -0
  82. package/dist/base/worker/index.d.cts +207 -0
  83. package/dist/base/worker/index.d.ts +207 -0
  84. package/dist/base/worker/index.js +20 -0
  85. package/dist/base/worker/index.js.map +1 -0
  86. package/dist/breaker-C9skL3d8.d.ts +175 -0
  87. package/dist/breaker-ugSdq54q.d.cts +175 -0
  88. package/dist/{cascading-BglDkMdX.d.cts → cascading-CSSbKGrJ.d.ts} +3 -3
  89. package/dist/{cascading-MFgxu7Yo.d.ts → cascading-baGkiihI.d.cts} +3 -3
  90. package/dist/chunk-255UCBG4.js +58 -0
  91. package/dist/chunk-255UCBG4.js.map +1 -0
  92. package/dist/chunk-2LO3EL4W.js +1 -0
  93. package/dist/chunk-2LO3EL4W.js.map +1 -0
  94. package/dist/chunk-2OB3CEJS.js +1065 -0
  95. package/dist/chunk-2OB3CEJS.js.map +1 -0
  96. package/dist/chunk-36NMM65U.js +144 -0
  97. package/dist/chunk-36NMM65U.js.map +1 -0
  98. package/dist/chunk-3CEXCBN6.js +1 -0
  99. package/dist/chunk-3CEXCBN6.js.map +1 -0
  100. package/dist/chunk-3MUSLI6E.js +105 -0
  101. package/dist/chunk-3MUSLI6E.js.map +1 -0
  102. package/dist/chunk-3PSLNJDU.js +884 -0
  103. package/dist/chunk-3PSLNJDU.js.map +1 -0
  104. package/dist/chunk-3QZY5BI7.js +92 -0
  105. package/dist/chunk-3QZY5BI7.js.map +1 -0
  106. package/dist/chunk-42FQ27MQ.js +594 -0
  107. package/dist/chunk-42FQ27MQ.js.map +1 -0
  108. package/dist/chunk-4GYMCUDZ.js +1085 -0
  109. package/dist/chunk-4GYMCUDZ.js.map +1 -0
  110. package/dist/chunk-4S53H2KR.js +382 -0
  111. package/dist/chunk-4S53H2KR.js.map +1 -0
  112. package/dist/chunk-4XCHZRUJ.js +128 -0
  113. package/dist/chunk-4XCHZRUJ.js.map +1 -0
  114. package/dist/chunk-5THCXDWY.js +725 -0
  115. package/dist/chunk-5THCXDWY.js.map +1 -0
  116. package/dist/chunk-6XZYT4SW.js +256 -0
  117. package/dist/chunk-6XZYT4SW.js.map +1 -0
  118. package/dist/chunk-7EGRP2VX.js +76 -0
  119. package/dist/chunk-7EGRP2VX.js.map +1 -0
  120. package/dist/chunk-A7KV5UK4.js +150 -0
  121. package/dist/chunk-A7KV5UK4.js.map +1 -0
  122. package/dist/chunk-APY2SS5X.js +156 -0
  123. package/dist/chunk-APY2SS5X.js.map +1 -0
  124. package/dist/chunk-AZDQPQ3V.js +66 -0
  125. package/dist/chunk-AZDQPQ3V.js.map +1 -0
  126. package/dist/chunk-BU3SEFA5.js +90 -0
  127. package/dist/chunk-BU3SEFA5.js.map +1 -0
  128. package/dist/chunk-BXGZFGZ4.js +189 -0
  129. package/dist/chunk-BXGZFGZ4.js.map +1 -0
  130. package/dist/chunk-CGHORL6G.js +579 -0
  131. package/dist/chunk-CGHORL6G.js.map +1 -0
  132. package/dist/chunk-CXANAIZU.js +530 -0
  133. package/dist/chunk-CXANAIZU.js.map +1 -0
  134. package/dist/chunk-CZQHCKKG.js +1 -0
  135. package/dist/chunk-CZQHCKKG.js.map +1 -0
  136. package/dist/chunk-DKNHAICT.js +133 -0
  137. package/dist/chunk-DKNHAICT.js.map +1 -0
  138. package/dist/chunk-DM4OMPWK.js +584 -0
  139. package/dist/chunk-DM4OMPWK.js.map +1 -0
  140. package/dist/chunk-DMSNO6ZB.js +452 -0
  141. package/dist/chunk-DMSNO6ZB.js.map +1 -0
  142. package/dist/chunk-E5OZPDIW.js +229 -0
  143. package/dist/chunk-E5OZPDIW.js.map +1 -0
  144. package/dist/chunk-EVYY4X5A.js +509 -0
  145. package/dist/chunk-EVYY4X5A.js.map +1 -0
  146. package/dist/chunk-FDFD67UO.js +1 -0
  147. package/dist/chunk-FDFD67UO.js.map +1 -0
  148. package/dist/chunk-FMPF42Q4.js +13 -0
  149. package/dist/chunk-FMPF42Q4.js.map +1 -0
  150. package/dist/chunk-FR6RGA3B.js +1277 -0
  151. package/dist/chunk-FR6RGA3B.js.map +1 -0
  152. package/dist/chunk-FW23JYNQ.js +454 -0
  153. package/dist/chunk-FW23JYNQ.js.map +1 -0
  154. package/dist/chunk-GBCENOLN.js +1575 -0
  155. package/dist/chunk-GBCENOLN.js.map +1 -0
  156. package/dist/chunk-HL7HUJIX.js +1 -0
  157. package/dist/chunk-HL7HUJIX.js.map +1 -0
  158. package/dist/chunk-HULCUY35.js +2508 -0
  159. package/dist/chunk-HULCUY35.js.map +1 -0
  160. package/dist/chunk-IHTWQEDR.js +169 -0
  161. package/dist/chunk-IHTWQEDR.js.map +1 -0
  162. package/dist/chunk-IJRR6YAI.js +128 -0
  163. package/dist/chunk-IJRR6YAI.js.map +1 -0
  164. package/dist/chunk-JGFRAFDL.js +221 -0
  165. package/dist/chunk-JGFRAFDL.js.map +1 -0
  166. package/dist/chunk-KIIXR252.js +211 -0
  167. package/dist/chunk-KIIXR252.js.map +1 -0
  168. package/dist/chunk-KN3H5CNT.js +11 -0
  169. package/dist/chunk-KN3H5CNT.js.map +1 -0
  170. package/dist/chunk-KPG3DGLA.js +1 -0
  171. package/dist/chunk-KPG3DGLA.js.map +1 -0
  172. package/dist/chunk-KRNQ6RGQ.js +1 -0
  173. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  174. package/dist/chunk-LBAJK24K.js +1071 -0
  175. package/dist/chunk-LBAJK24K.js.map +1 -0
  176. package/dist/chunk-MLTPJMH6.js +417 -0
  177. package/dist/chunk-MLTPJMH6.js.map +1 -0
  178. package/dist/chunk-N3SZ7BMH.js +95 -0
  179. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  180. package/dist/chunk-NDUD3IMO.js +540 -0
  181. package/dist/chunk-NDUD3IMO.js.map +1 -0
  182. package/dist/chunk-NY2PYHNC.js +873 -0
  183. package/dist/chunk-NY2PYHNC.js.map +1 -0
  184. package/dist/chunk-O3MT7DYI.js +225 -0
  185. package/dist/chunk-O3MT7DYI.js.map +1 -0
  186. package/dist/chunk-OCUDSN63.js +2386 -0
  187. package/dist/chunk-OCUDSN63.js.map +1 -0
  188. package/dist/chunk-OIWU3NYV.js +199 -0
  189. package/dist/chunk-OIWU3NYV.js.map +1 -0
  190. package/dist/chunk-OO5BM6CJ.js +1153 -0
  191. package/dist/chunk-OO5BM6CJ.js.map +1 -0
  192. package/dist/chunk-OQUIJT7A.js +1 -0
  193. package/dist/chunk-OQUIJT7A.js.map +1 -0
  194. package/dist/chunk-P5LBT622.js +105 -0
  195. package/dist/chunk-P5LBT622.js.map +1 -0
  196. package/dist/chunk-PKGQG5QQ.js +519 -0
  197. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  198. package/dist/chunk-PKPO3JTZ.js +561 -0
  199. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  200. package/dist/chunk-PL5UDIQ5.js +118 -0
  201. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  202. package/dist/chunk-PZWISPIQ.js +432 -0
  203. package/dist/chunk-PZWISPIQ.js.map +1 -0
  204. package/dist/chunk-Q3EYOCZB.js +510 -0
  205. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  206. package/dist/chunk-QMBYUVRL.js +15 -0
  207. package/dist/chunk-QMBYUVRL.js.map +1 -0
  208. package/dist/chunk-RAGGHLCV.js +200 -0
  209. package/dist/chunk-RAGGHLCV.js.map +1 -0
  210. package/dist/chunk-RGL53X5G.js +574 -0
  211. package/dist/chunk-RGL53X5G.js.map +1 -0
  212. package/dist/chunk-RJOG4IJU.js +1039 -0
  213. package/dist/chunk-RJOG4IJU.js.map +1 -0
  214. package/dist/chunk-SOOKUYVM.js +403 -0
  215. package/dist/chunk-SOOKUYVM.js.map +1 -0
  216. package/dist/chunk-T5BN5KG7.js +1 -0
  217. package/dist/chunk-T5BN5KG7.js.map +1 -0
  218. package/dist/chunk-TP7244Y6.js +207 -0
  219. package/dist/chunk-TP7244Y6.js.map +1 -0
  220. package/dist/chunk-TSBFTJKM.js +57 -0
  221. package/dist/chunk-TSBFTJKM.js.map +1 -0
  222. package/dist/chunk-URQ2CBBF.js +143 -0
  223. package/dist/chunk-URQ2CBBF.js.map +1 -0
  224. package/dist/chunk-W2BOPXTI.js +1 -0
  225. package/dist/chunk-W2BOPXTI.js.map +1 -0
  226. package/dist/chunk-WKSWLSCX.js +207 -0
  227. package/dist/chunk-WKSWLSCX.js.map +1 -0
  228. package/dist/chunk-Y52CS6YA.js +88 -0
  229. package/dist/chunk-Y52CS6YA.js.map +1 -0
  230. package/dist/chunk-YCBUWK77.js +92 -0
  231. package/dist/chunk-YCBUWK77.js.map +1 -0
  232. package/dist/chunk-YJ4U2D2C.js +314 -0
  233. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  234. package/dist/chunk-Z4YXAUDN.js +239 -0
  235. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  236. package/dist/chunk-Z6EGP5D7.js +92 -0
  237. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  238. package/dist/compat/index.cjs +3100 -9
  239. package/dist/compat/index.cjs.map +1 -0
  240. package/dist/compat/index.d.cts +112 -18
  241. package/dist/compat/index.d.ts +112 -18
  242. package/dist/compat/index.js +176 -1
  243. package/dist/compat/index.js.map +1 -0
  244. package/dist/compat/jotai/index.cjs +149 -1
  245. package/dist/compat/jotai/index.cjs.map +1 -0
  246. package/dist/compat/jotai/index.d.cts +2 -2
  247. package/dist/compat/jotai/index.d.ts +2 -2
  248. package/dist/compat/jotai/index.js +8 -1
  249. package/dist/compat/jotai/index.js.map +1 -0
  250. package/dist/compat/nanostores/index.cjs +205 -1
  251. package/dist/compat/nanostores/index.cjs.map +1 -0
  252. package/dist/compat/nanostores/index.d.cts +2 -2
  253. package/dist/compat/nanostores/index.d.ts +2 -2
  254. package/dist/compat/nanostores/index.js +22 -1
  255. package/dist/compat/nanostores/index.js.map +1 -0
  256. package/dist/compat/nestjs/index.cjs +2241 -9
  257. package/dist/compat/nestjs/index.cjs.map +1 -0
  258. package/dist/compat/nestjs/index.d.cts +7 -10
  259. package/dist/compat/nestjs/index.d.ts +7 -10
  260. package/dist/compat/nestjs/index.js +78 -1
  261. package/dist/compat/nestjs/index.js.map +1 -0
  262. package/dist/compat/react/index.cjs +114 -1
  263. package/dist/compat/react/index.cjs.map +1 -0
  264. package/dist/compat/react/index.d.cts +2 -2
  265. package/dist/compat/react/index.d.ts +2 -2
  266. package/dist/compat/react/index.js +12 -1
  267. package/dist/compat/react/index.js.map +1 -0
  268. package/dist/compat/solid/index.cjs +101 -1
  269. package/dist/compat/solid/index.cjs.map +1 -0
  270. package/dist/compat/solid/index.d.cts +2 -2
  271. package/dist/compat/solid/index.d.ts +2 -2
  272. package/dist/compat/solid/index.js +12 -1
  273. package/dist/compat/solid/index.js.map +1 -0
  274. package/dist/compat/svelte/index.cjs +104 -1
  275. package/dist/compat/svelte/index.cjs.map +1 -0
  276. package/dist/compat/svelte/index.d.cts +2 -2
  277. package/dist/compat/svelte/index.d.ts +2 -2
  278. package/dist/compat/svelte/index.js +12 -1
  279. package/dist/compat/svelte/index.js.map +1 -0
  280. package/dist/compat/vue/index.cjs +119 -1
  281. package/dist/compat/vue/index.cjs.map +1 -0
  282. package/dist/compat/vue/index.d.cts +2 -2
  283. package/dist/compat/vue/index.d.ts +2 -2
  284. package/dist/compat/vue/index.js +12 -1
  285. package/dist/compat/vue/index.js.map +1 -0
  286. package/dist/compat/zustand/index.cjs +69 -3
  287. package/dist/compat/zustand/index.cjs.map +1 -0
  288. package/dist/compat/zustand/index.d.cts +2 -6
  289. package/dist/compat/zustand/index.d.ts +2 -6
  290. package/dist/compat/zustand/index.js +8 -1
  291. package/dist/compat/zustand/index.js.map +1 -0
  292. package/dist/distill-De6Rnn15.d.cts +48 -0
  293. package/dist/distill-De6Rnn15.d.ts +48 -0
  294. package/dist/external-register-CWyroXb_.d.cts +138 -0
  295. package/dist/external-register-CWyroXb_.d.ts +138 -0
  296. package/dist/{fallback-74oxi34l.d.cts → fallback-Bx46zqky.d.cts} +3 -10
  297. package/dist/{fallback-DUyyBTBK.d.ts → fallback-pIWW8A2d.d.ts} +3 -10
  298. package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
  299. package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
  300. package/dist/{index-CBGUK09R.d.ts → index-5SU_O78r.d.cts} +5 -5
  301. package/dist/{index-BmZXHqkE.d.ts → index-B6pxYJzO.d.cts} +1 -1
  302. package/dist/{index-hcDJ8PSI.d.cts → index-B6pxYJzO.d.ts} +1 -1
  303. package/dist/{index-C5stwKcw.d.cts → index-BFsng6v1.d.cts} +1 -1
  304. package/dist/{index-CdAlHFEt.d.ts → index-BFsng6v1.d.ts} +1 -1
  305. package/dist/{index-_6ODbuOu.d.cts → index-Bg-LwEt-.d.cts} +1 -1
  306. package/dist/{index-CviRnE4K.d.ts → index-Bg-LwEt-.d.ts} +1 -1
  307. package/dist/{index-CBBLl_rc.d.ts → index-Brp888t0.d.cts} +1 -1
  308. package/dist/{index-BQSKmbuG.d.cts → index-Brp888t0.d.ts} +1 -1
  309. package/dist/{index-sqkqlb1p.d.ts → index-CDfk6jHN.d.cts} +1 -1
  310. package/dist/{index-ZVQhLa2i.d.cts → index-CDfk6jHN.d.ts} +1 -1
  311. package/dist/{index-Climxqsu.d.cts → index-CEXCtYYJ.d.ts} +5 -5
  312. package/dist/index-DLAxYaN5.d.cts +169 -0
  313. package/dist/index-DLAxYaN5.d.ts +169 -0
  314. package/dist/{index-CK29LV56.d.cts → index-DeWbQzMe.d.cts} +1 -1
  315. package/dist/{index-CPQlGA29.d.ts → index-DeWbQzMe.d.ts} +1 -1
  316. package/dist/{index-BrPrLl4e.d.cts → index-dX9IzPqj.d.cts} +1 -1
  317. package/dist/{index-Dgl1HpPn.d.ts → index-dX9IzPqj.d.ts} +1 -1
  318. package/dist/index.cjs +25934 -191
  319. package/dist/index.cjs.map +1 -0
  320. package/dist/index.d.cts +58 -94
  321. package/dist/index.d.ts +58 -94
  322. package/dist/index.js +852 -1
  323. package/dist/index.js.map +1 -0
  324. package/dist/layout-types-B5aiHYgk.d.cts +72 -0
  325. package/dist/layout-types-B5aiHYgk.d.ts +72 -0
  326. package/dist/memory-composers-BryDrRBX.d.cts +529 -0
  327. package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
  328. package/dist/{observable-DWjNfLvC.d.ts → observable-BXQoW1P-.d.cts} +1 -1
  329. package/dist/{observable-e3eiPPFy.d.cts → observable-BXQoW1P-.d.ts} +1 -1
  330. package/dist/{pipeline-graph-Sgj0gCwn.d.ts → pipeline-graph-Ce47CB6Y.d.cts} +13 -10
  331. package/dist/{pipeline-graph-CIKhynsF.d.cts → pipeline-graph-DXCwY9vG.d.ts} +13 -10
  332. package/dist/presets/ai/index.cjs +4377 -0
  333. package/dist/presets/ai/index.cjs.map +1 -0
  334. package/dist/presets/ai/index.d.cts +98 -0
  335. package/dist/presets/ai/index.d.ts +98 -0
  336. package/dist/presets/ai/index.js +54 -0
  337. package/dist/presets/ai/index.js.map +1 -0
  338. package/dist/presets/harness/index.cjs +5929 -0
  339. package/dist/presets/harness/index.cjs.map +1 -0
  340. package/dist/presets/harness/index.d.cts +566 -0
  341. package/dist/presets/harness/index.d.ts +566 -0
  342. package/dist/presets/harness/index.js +71 -0
  343. package/dist/presets/harness/index.js.map +1 -0
  344. package/dist/presets/index.cjs +9782 -0
  345. package/dist/presets/index.cjs.map +1 -0
  346. package/dist/presets/index.d.cts +28 -0
  347. package/dist/presets/index.d.ts +28 -0
  348. package/dist/presets/index.js +129 -0
  349. package/dist/presets/index.js.map +1 -0
  350. package/dist/presets/inspect/index.cjs +1087 -0
  351. package/dist/presets/inspect/index.cjs.map +1 -0
  352. package/dist/presets/inspect/index.d.cts +172 -0
  353. package/dist/presets/inspect/index.d.ts +172 -0
  354. package/dist/presets/inspect/index.js +21 -0
  355. package/dist/presets/inspect/index.js.map +1 -0
  356. package/dist/presets/resilience/index.cjs +1593 -0
  357. package/dist/presets/resilience/index.cjs.map +1 -0
  358. package/dist/presets/resilience/index.d.cts +205 -0
  359. package/dist/presets/resilience/index.d.ts +205 -0
  360. package/dist/presets/resilience/index.js +18 -0
  361. package/dist/presets/resilience/index.js.map +1 -0
  362. package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
  363. package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
  364. package/dist/{reactive-layout-DOTs9P3X.d.ts → reactive-layout-fswlBUvX.d.cts} +19 -7
  365. package/dist/{reactive-layout-DgctbqZo.d.cts → reactive-layout-fswlBUvX.d.ts} +19 -7
  366. package/dist/retry-BDbRZ_gx.d.ts +125 -0
  367. package/dist/retry-DWuhjvsA.d.cts +125 -0
  368. package/dist/solutions/index.cjs +8200 -0
  369. package/dist/solutions/index.cjs.map +1 -0
  370. package/dist/solutions/index.d.cts +23 -0
  371. package/dist/solutions/index.d.ts +23 -0
  372. package/dist/solutions/index.js +55 -0
  373. package/dist/solutions/index.js.map +1 -0
  374. package/dist/spawnable-5mDY501F.d.cts +746 -0
  375. package/dist/spawnable-D3lR0oQu.d.ts +746 -0
  376. package/dist/status-U-rUI79b.d.cts +84 -0
  377. package/dist/status-U-rUI79b.d.ts +84 -0
  378. package/dist/timeout-U5O4ESK3.js +12 -0
  379. package/dist/timeout-U5O4ESK3.js.map +1 -0
  380. package/dist/{types-CWFysE9E.d.ts → types-BB5Lw-pB.d.cts} +3 -3
  381. package/dist/{types-C0_yquda.d.cts → types-BB5Lw-pB.d.ts} +3 -3
  382. package/dist/types-CJWIMJiZ.d.ts +548 -0
  383. package/dist/types-vCq7ShIm.d.cts +548 -0
  384. package/dist/utils/ai/browser.cjs +2169 -0
  385. package/dist/utils/ai/browser.cjs.map +1 -0
  386. package/dist/{patterns → utils}/ai/browser.d.cts +7 -5
  387. package/dist/{patterns → utils}/ai/browser.d.ts +7 -5
  388. package/dist/utils/ai/browser.js +255 -0
  389. package/dist/utils/ai/browser.js.map +1 -0
  390. package/dist/utils/ai/index.cjs +8468 -0
  391. package/dist/utils/ai/index.cjs.map +1 -0
  392. package/dist/{index-CR8QpwX8.d.ts → utils/ai/index.d.cts} +73 -976
  393. package/dist/{index-UPSiS-X7.d.cts → utils/ai/index.d.ts} +73 -976
  394. package/dist/utils/ai/index.js +173 -0
  395. package/dist/utils/ai/index.js.map +1 -0
  396. package/dist/utils/ai/node.cjs +648 -0
  397. package/dist/utils/ai/node.cjs.map +1 -0
  398. package/dist/{patterns → utils}/ai/node.d.cts +5 -7
  399. package/dist/{patterns → utils}/ai/node.d.ts +5 -7
  400. package/dist/utils/ai/node.js +84 -0
  401. package/dist/utils/ai/node.js.map +1 -0
  402. package/dist/utils/cqrs/index.cjs +1036 -0
  403. package/dist/utils/cqrs/index.cjs.map +1 -0
  404. package/dist/{index-CeFiHtAg.d.ts → utils/cqrs/index.d.cts} +7 -37
  405. package/dist/{index-B-_tFaqV.d.cts → utils/cqrs/index.d.ts} +7 -37
  406. package/dist/utils/cqrs/index.js +18 -0
  407. package/dist/utils/cqrs/index.js.map +1 -0
  408. package/dist/utils/demo-shell/index.cjs +865 -0
  409. package/dist/utils/demo-shell/index.cjs.map +1 -0
  410. package/dist/{index-B8YnZpIR.d.ts → utils/demo-shell/index.d.cts} +4 -16
  411. package/dist/{index-Cwv0KWcU.d.cts → utils/demo-shell/index.d.ts} +4 -16
  412. package/dist/utils/demo-shell/index.js +13 -0
  413. package/dist/utils/demo-shell/index.js.map +1 -0
  414. package/dist/utils/domain-templates/index.cjs +732 -0
  415. package/dist/utils/domain-templates/index.cjs.map +1 -0
  416. package/dist/{index-CzLVrjxn.d.ts → utils/domain-templates/index.d.cts} +3 -20
  417. package/dist/{index-BaQaY_IQ.d.cts → utils/domain-templates/index.d.ts} +3 -20
  418. package/dist/utils/domain-templates/index.js +17 -0
  419. package/dist/utils/domain-templates/index.js.map +1 -0
  420. package/dist/utils/graphspec/index.cjs +1174 -0
  421. package/dist/utils/graphspec/index.cjs.map +1 -0
  422. package/dist/{index-CMh5Rz1y.d.ts → utils/graphspec/index.d.cts} +106 -42
  423. package/dist/{index-CS0LTlB8.d.cts → utils/graphspec/index.d.ts} +106 -42
  424. package/dist/utils/graphspec/index.js +35 -0
  425. package/dist/utils/graphspec/index.js.map +1 -0
  426. package/dist/utils/harness/index.cjs +656 -0
  427. package/dist/utils/harness/index.cjs.map +1 -0
  428. package/dist/utils/harness/index.d.cts +542 -0
  429. package/dist/utils/harness/index.d.ts +542 -0
  430. package/dist/utils/harness/index.js +56 -0
  431. package/dist/utils/harness/index.js.map +1 -0
  432. package/dist/utils/index.cjs +17609 -0
  433. package/dist/utils/index.cjs.map +1 -0
  434. package/dist/utils/index.d.cts +96 -0
  435. package/dist/utils/index.d.ts +96 -0
  436. package/dist/utils/index.js +514 -0
  437. package/dist/utils/index.js.map +1 -0
  438. package/dist/utils/inspect/index.cjs +807 -0
  439. package/dist/utils/inspect/index.cjs.map +1 -0
  440. package/dist/utils/inspect/index.d.cts +123 -0
  441. package/dist/utils/inspect/index.d.ts +123 -0
  442. package/dist/utils/inspect/index.js +30 -0
  443. package/dist/utils/inspect/index.js.map +1 -0
  444. package/dist/utils/job-queue/index.cjs +717 -0
  445. package/dist/utils/job-queue/index.cjs.map +1 -0
  446. package/dist/{index-DisjX8a-.d.ts → utils/job-queue/index.d.cts} +5 -26
  447. package/dist/{index-DV_1YuVk.d.cts → utils/job-queue/index.d.ts} +5 -26
  448. package/dist/utils/job-queue/index.js +18 -0
  449. package/dist/utils/job-queue/index.js.map +1 -0
  450. package/dist/utils/memory/index.cjs +1451 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/{index-CZ3r5Rxp.d.ts → utils/memory/index.d.cts} +242 -34
  453. package/dist/{index-B17QddL1.d.cts → utils/memory/index.d.ts} +242 -34
  454. package/dist/utils/memory/index.js +19 -0
  455. package/dist/utils/memory/index.js.map +1 -0
  456. package/dist/utils/messaging/index.cjs +666 -0
  457. package/dist/utils/messaging/index.cjs.map +1 -0
  458. package/dist/utils/messaging/index.d.cts +562 -0
  459. package/dist/utils/messaging/index.d.ts +562 -0
  460. package/dist/utils/messaging/index.js +50 -0
  461. package/dist/utils/messaging/index.js.map +1 -0
  462. package/dist/utils/orchestration/index.cjs +876 -0
  463. package/dist/utils/orchestration/index.cjs.map +1 -0
  464. package/dist/utils/orchestration/index.d.cts +233 -0
  465. package/dist/utils/orchestration/index.d.ts +233 -0
  466. package/dist/utils/orchestration/index.js +19 -0
  467. package/dist/utils/orchestration/index.js.map +1 -0
  468. package/dist/utils/process/index.cjs +743 -0
  469. package/dist/utils/process/index.cjs.map +1 -0
  470. package/dist/{index-p09KSrTN.d.ts → utils/process/index.d.cts} +97 -44
  471. package/dist/{index-CasX6Pfq.d.cts → utils/process/index.d.ts} +97 -44
  472. package/dist/utils/process/index.js +14 -0
  473. package/dist/utils/process/index.js.map +1 -0
  474. package/dist/utils/reactive-layout/index.cjs +1607 -0
  475. package/dist/utils/reactive-layout/index.cjs.map +1 -0
  476. package/dist/{index-B5S8ULbU.d.ts → utils/reactive-layout/index.d.cts} +58 -81
  477. package/dist/{index-Dc4AYqrJ.d.cts → utils/reactive-layout/index.d.ts} +58 -81
  478. package/dist/utils/reactive-layout/index.js +52 -0
  479. package/dist/utils/reactive-layout/index.js.map +1 -0
  480. package/dist/utils/reduction/index.cjs +203 -0
  481. package/dist/utils/reduction/index.cjs.map +1 -0
  482. package/dist/{index-Byu-OpX_.d.ts → utils/reduction/index.d.cts} +6 -17
  483. package/dist/{index-tRCxuAXF.d.cts → utils/reduction/index.d.ts} +6 -17
  484. package/dist/utils/reduction/index.js +14 -0
  485. package/dist/utils/reduction/index.js.map +1 -0
  486. package/dist/utils/resilience/index.cjs +1617 -0
  487. package/dist/utils/resilience/index.cjs.map +1 -0
  488. package/dist/utils/resilience/index.d.cts +9 -0
  489. package/dist/utils/resilience/index.d.ts +9 -0
  490. package/dist/utils/resilience/index.js +44 -0
  491. package/dist/utils/resilience/index.js.map +1 -0
  492. package/dist/utils/surface/index.cjs +1070 -0
  493. package/dist/utils/surface/index.cjs.map +1 -0
  494. package/dist/{index-CYq8vAyV.d.ts → utils/surface/index.d.cts} +7 -58
  495. package/dist/{index-CSOmP7xT.d.cts → utils/surface/index.d.ts} +7 -58
  496. package/dist/utils/surface/index.js +30 -0
  497. package/dist/utils/surface/index.js.map +1 -0
  498. package/dist/utils/topology-view/index.cjs +620 -0
  499. package/dist/utils/topology-view/index.cjs.map +1 -0
  500. package/dist/utils/topology-view/index.d.cts +68 -0
  501. package/dist/utils/topology-view/index.d.ts +68 -0
  502. package/dist/utils/topology-view/index.js +11 -0
  503. package/dist/utils/topology-view/index.js.map +1 -0
  504. package/package.json +664 -584
  505. package/dist/backoff-HPZMEZNF.js +0 -1
  506. package/dist/chunk-2T7U5EU6.js +0 -1
  507. package/dist/chunk-3G5U5QNE.js +0 -5
  508. package/dist/chunk-4VVTGLXJ.js +0 -1
  509. package/dist/chunk-5M4CCMMD.js +0 -45
  510. package/dist/chunk-5QDBSZBV.js +0 -1
  511. package/dist/chunk-5XJ6B66J.js +0 -1
  512. package/dist/chunk-6QZNQS5B.js +0 -1
  513. package/dist/chunk-6X7AFUJV.js +0 -9
  514. package/dist/chunk-7K6PWTDQ.js +0 -1
  515. package/dist/chunk-7LIAPXJB.js +0 -1
  516. package/dist/chunk-7WPU3UHQ.js +0 -1
  517. package/dist/chunk-A5WCQ5NO.js +0 -1
  518. package/dist/chunk-APPIWSGD.js +0 -84
  519. package/dist/chunk-BEZWM2SY.js +0 -1
  520. package/dist/chunk-C72GO4IZ.js +0 -1
  521. package/dist/chunk-CB676TKJ.js +0 -1
  522. package/dist/chunk-CE6TI2TL.js +0 -1
  523. package/dist/chunk-CE72X3WO.js +0 -1
  524. package/dist/chunk-CK2E7BTU.js +0 -1
  525. package/dist/chunk-CLVB32RD.js +0 -1
  526. package/dist/chunk-CRVT7D2P.js +0 -1
  527. package/dist/chunk-D5RFJOZ2.js +0 -1
  528. package/dist/chunk-D7GPHKFH.js +0 -1
  529. package/dist/chunk-DHRX7JX4.js +0 -2
  530. package/dist/chunk-ESMPEKEV.js +0 -1
  531. package/dist/chunk-F672GV32.js +0 -1
  532. package/dist/chunk-FZMYDOWV.js +0 -1
  533. package/dist/chunk-GHBWHMRZ.js +0 -1
  534. package/dist/chunk-GLERH466.js +0 -1
  535. package/dist/chunk-GPW2V3RE.js +0 -1
  536. package/dist/chunk-HIDYF36O.js +0 -1
  537. package/dist/chunk-HITNVN6B.js +0 -3
  538. package/dist/chunk-HY4DJBA7.js +0 -5
  539. package/dist/chunk-KZIEYVXN.js +0 -1
  540. package/dist/chunk-L6NSJVJZ.js +0 -1
  541. package/dist/chunk-N4MQX6JU.js +0 -18
  542. package/dist/chunk-N7FHEL4D.js +0 -1
  543. package/dist/chunk-NTEURFZH.js +0 -1
  544. package/dist/chunk-OIVP6KFV.js +0 -1
  545. package/dist/chunk-OPHBU3LG.js +0 -1
  546. package/dist/chunk-OYQOZP2F.js +0 -5
  547. package/dist/chunk-PTZK576G.js +0 -1
  548. package/dist/chunk-QYADASLV.js +0 -1
  549. package/dist/chunk-ST7UXLWR.js +0 -1
  550. package/dist/chunk-SVY7VUYU.js +0 -1
  551. package/dist/chunk-TK3NWWD4.js +0 -1
  552. package/dist/chunk-TSOYJ743.js +0 -1
  553. package/dist/chunk-UNGSTR4X.js +0 -61
  554. package/dist/chunk-VIMF6LGM.js +0 -1
  555. package/dist/chunk-VJLMUKOI.js +0 -1
  556. package/dist/chunk-VN6RDSK2.js +0 -1
  557. package/dist/chunk-VV4N5P64.js +0 -1
  558. package/dist/chunk-W3I423PS.js +0 -1
  559. package/dist/chunk-WJR24TAG.js +0 -1
  560. package/dist/chunk-XTGKMHSW.js +0 -1
  561. package/dist/chunk-YBB7ZGTY.js +0 -1
  562. package/dist/chunk-Z4NPUARF.js +0 -1
  563. package/dist/chunk-ZGNQRPDT.js +0 -1
  564. package/dist/chunk-ZKPSFFKU.js +0 -1
  565. package/dist/chunk-ZLV5SQSX.js +0 -1
  566. package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
  567. package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
  568. package/dist/core/index.cjs +0 -1
  569. package/dist/core/index.d.cts +0 -3
  570. package/dist/core/index.d.ts +0 -3
  571. package/dist/core/index.js +0 -1
  572. package/dist/decay-BvOWTZ00.d.ts +0 -112
  573. package/dist/decay-CFlLvXUT.d.cts +0 -112
  574. package/dist/extra/browser.cjs +0 -1
  575. package/dist/extra/browser.d.cts +0 -4
  576. package/dist/extra/browser.d.ts +0 -4
  577. package/dist/extra/browser.js +0 -1
  578. package/dist/extra/index.cjs +0 -20
  579. package/dist/extra/index.d.cts +0 -17
  580. package/dist/extra/index.d.ts +0 -17
  581. package/dist/extra/index.js +0 -1
  582. package/dist/extra/node.cjs +0 -2
  583. package/dist/extra/node.js +0 -2
  584. package/dist/extra/operators.cjs +0 -1
  585. package/dist/extra/operators.d.cts +0 -958
  586. package/dist/extra/operators.d.ts +0 -958
  587. package/dist/extra/operators.js +0 -1
  588. package/dist/extra/reactive.cjs +0 -1
  589. package/dist/extra/reactive.d.cts +0 -353
  590. package/dist/extra/reactive.d.ts +0 -353
  591. package/dist/extra/reactive.js +0 -1
  592. package/dist/extra/render/index.cjs +0 -5
  593. package/dist/extra/render/index.js +0 -1
  594. package/dist/extra/sources.cjs +0 -3
  595. package/dist/extra/sources.js +0 -1
  596. package/dist/extra/storage-browser.cjs +0 -1
  597. package/dist/extra/storage-browser.d.cts +0 -37
  598. package/dist/extra/storage-browser.d.ts +0 -37
  599. package/dist/extra/storage-browser.js +0 -1
  600. package/dist/extra/storage-core.cjs +0 -1
  601. package/dist/extra/storage-core.d.cts +0 -28
  602. package/dist/extra/storage-core.d.ts +0 -28
  603. package/dist/extra/storage-core.js +0 -1
  604. package/dist/extra/storage-node.cjs +0 -1
  605. package/dist/extra/storage-node.d.cts +0 -2
  606. package/dist/extra/storage-node.d.ts +0 -2
  607. package/dist/extra/storage-node.js +0 -0
  608. package/dist/extra/storage-tiers-browser.cjs +0 -1
  609. package/dist/extra/storage-tiers-browser.d.cts +0 -120
  610. package/dist/extra/storage-tiers-browser.d.ts +0 -120
  611. package/dist/extra/storage-tiers-browser.js +0 -1
  612. package/dist/extra/storage-tiers-node.cjs +0 -1
  613. package/dist/extra/storage-tiers-node.d.cts +0 -210
  614. package/dist/extra/storage-tiers-node.d.ts +0 -210
  615. package/dist/extra/storage-tiers-node.js +0 -1
  616. package/dist/extra/storage-tiers.cjs +0 -1
  617. package/dist/extra/storage-tiers.d.cts +0 -412
  618. package/dist/extra/storage-tiers.d.ts +0 -412
  619. package/dist/extra/storage-tiers.js +0 -1
  620. package/dist/graph/index.cjs +0 -7
  621. package/dist/graph/index.d.cts +0 -7
  622. package/dist/graph/index.d.ts +0 -7
  623. package/dist/graph/index.js +0 -1
  624. package/dist/graph-CWvEUQAq.d.cts +0 -1861
  625. package/dist/graph-D9LFnda9.d.ts +0 -1861
  626. package/dist/index-5k1T6jl0.d.cts +0 -121
  627. package/dist/index-9770hRuQ.d.cts +0 -779
  628. package/dist/index-B1F8Enjf.d.ts +0 -704
  629. package/dist/index-BHskSB8v.d.ts +0 -3413
  630. package/dist/index-BIYAkbAi.d.cts +0 -26
  631. package/dist/index-BoJ5JHxI.d.ts +0 -557
  632. package/dist/index-BocU7pqs.d.ts +0 -779
  633. package/dist/index-BxNs2HB9.d.cts +0 -1858
  634. package/dist/index-C1T3d7V-.d.cts +0 -704
  635. package/dist/index-C5ri2Axc.d.cts +0 -301
  636. package/dist/index-C9l6OEBL.d.ts +0 -26
  637. package/dist/index-CC-AvFTy.d.cts +0 -557
  638. package/dist/index-CJF1URuX.d.ts +0 -121
  639. package/dist/index-CdTelp1M.d.ts +0 -202
  640. package/dist/index-Cj3WohTd.d.cts +0 -202
  641. package/dist/index-Co7uli2l.d.cts +0 -3413
  642. package/dist/index-D0aciIex.d.cts +0 -209
  643. package/dist/index-DHen9Klo.d.ts +0 -1858
  644. package/dist/index-Yq60JP3s.d.ts +0 -209
  645. package/dist/index-nozs3fFC.d.ts +0 -301
  646. package/dist/node-kK3CvTrR.d.cts +0 -1347
  647. package/dist/node-kK3CvTrR.d.ts +0 -1347
  648. package/dist/patterns/ai/browser.cjs +0 -8
  649. package/dist/patterns/ai/browser.js +0 -3
  650. package/dist/patterns/ai/index.cjs +0 -74
  651. package/dist/patterns/ai/index.d.cts +0 -20
  652. package/dist/patterns/ai/index.d.ts +0 -20
  653. package/dist/patterns/ai/index.js +0 -1
  654. package/dist/patterns/ai/node.cjs +0 -1
  655. package/dist/patterns/ai/node.js +0 -1
  656. package/dist/patterns/cqrs/index.cjs +0 -3
  657. package/dist/patterns/cqrs/index.d.cts +0 -8
  658. package/dist/patterns/cqrs/index.d.ts +0 -8
  659. package/dist/patterns/cqrs/index.js +0 -1
  660. package/dist/patterns/demo-shell/index.cjs +0 -5
  661. package/dist/patterns/demo-shell/index.d.cts +0 -7
  662. package/dist/patterns/demo-shell/index.d.ts +0 -7
  663. package/dist/patterns/demo-shell/index.js +0 -1
  664. package/dist/patterns/domain-templates/index.cjs +0 -3
  665. package/dist/patterns/domain-templates/index.d.cts +0 -6
  666. package/dist/patterns/domain-templates/index.d.ts +0 -6
  667. package/dist/patterns/domain-templates/index.js +0 -1
  668. package/dist/patterns/graphspec/index.cjs +0 -86
  669. package/dist/patterns/graphspec/index.d.cts +0 -8
  670. package/dist/patterns/graphspec/index.d.ts +0 -8
  671. package/dist/patterns/graphspec/index.js +0 -1
  672. package/dist/patterns/harness/index.cjs +0 -48
  673. package/dist/patterns/harness/index.d.cts +0 -13
  674. package/dist/patterns/harness/index.d.ts +0 -13
  675. package/dist/patterns/harness/index.js +0 -1
  676. package/dist/patterns/inspect/index.cjs +0 -3
  677. package/dist/patterns/inspect/index.d.cts +0 -9
  678. package/dist/patterns/inspect/index.d.ts +0 -9
  679. package/dist/patterns/inspect/index.js +0 -1
  680. package/dist/patterns/job-queue/index.cjs +0 -3
  681. package/dist/patterns/job-queue/index.d.cts +0 -9
  682. package/dist/patterns/job-queue/index.d.ts +0 -9
  683. package/dist/patterns/job-queue/index.js +0 -1
  684. package/dist/patterns/memory/index.cjs +0 -3
  685. package/dist/patterns/memory/index.d.cts +0 -8
  686. package/dist/patterns/memory/index.d.ts +0 -8
  687. package/dist/patterns/memory/index.js +0 -1
  688. package/dist/patterns/messaging/index.cjs +0 -3
  689. package/dist/patterns/messaging/index.d.cts +0 -7
  690. package/dist/patterns/messaging/index.d.ts +0 -7
  691. package/dist/patterns/messaging/index.js +0 -1
  692. package/dist/patterns/orchestration/index.cjs +0 -3
  693. package/dist/patterns/orchestration/index.d.cts +0 -8
  694. package/dist/patterns/orchestration/index.d.ts +0 -8
  695. package/dist/patterns/orchestration/index.js +0 -1
  696. package/dist/patterns/process/index.cjs +0 -3
  697. package/dist/patterns/process/index.d.cts +0 -10
  698. package/dist/patterns/process/index.d.ts +0 -10
  699. package/dist/patterns/process/index.js +0 -1
  700. package/dist/patterns/reactive-layout/index.cjs +0 -4
  701. package/dist/patterns/reactive-layout/index.d.cts +0 -7
  702. package/dist/patterns/reactive-layout/index.d.ts +0 -7
  703. package/dist/patterns/reactive-layout/index.js +0 -1
  704. package/dist/patterns/reduction/index.cjs +0 -3
  705. package/dist/patterns/reduction/index.d.cts +0 -6
  706. package/dist/patterns/reduction/index.d.ts +0 -6
  707. package/dist/patterns/reduction/index.js +0 -1
  708. package/dist/patterns/surface/index.cjs +0 -13
  709. package/dist/patterns/surface/index.d.cts +0 -9
  710. package/dist/patterns/surface/index.d.ts +0 -9
  711. package/dist/patterns/surface/index.js +0 -1
  712. package/dist/reactive-log-BKALbfal.d.ts +0 -223
  713. package/dist/reactive-log-DIGdYqQ6.d.cts +0 -223
  714. package/dist/reactive-map-CEFGp8TK.d.cts +0 -296
  715. package/dist/reactive-map-DS_SIAxv.d.ts +0 -296
  716. package/dist/resilience-6LYQJAC5.js +0 -1
  717. package/dist/sugar-DQjFmVqb.d.cts +0 -399
  718. package/dist/sugar-fhLIE7TT.d.ts +0 -399
  719. package/dist/topology-tree-Bcz27hpF.d.cts +0 -25
  720. package/dist/topology-tree-xvaD0fOX.d.ts +0 -25
@@ -0,0 +1,1085 @@
1
+ import {
2
+ circuitBreaker
3
+ } from "./chunk-RJOG4IJU.js";
4
+ import {
5
+ dryRunAdapter,
6
+ fallbackAdapter,
7
+ withLayer
8
+ } from "./chunk-CXANAIZU.js";
9
+ import {
10
+ firstValueFrom
11
+ } from "./chunk-O3MT7DYI.js";
12
+ import {
13
+ parseSSEStream
14
+ } from "./chunk-SOOKUYVM.js";
15
+
16
+ // src/utils/ai/adapters/providers/anthropic.ts
17
+ import { monotonicNs } from "@graphrefly/pure-ts/core";
18
+
19
+ // src/base/io/http-error.ts
20
+ async function makeHttpError(resp, provider) {
21
+ let body;
22
+ try {
23
+ body = await resp.text();
24
+ } catch {
25
+ body = "";
26
+ }
27
+ const prefix = provider ?? "HTTP";
28
+ const err = new Error(
29
+ `${prefix} API ${resp.status}: ${resp.statusText}${body ? ` \u2014 ${body}` : ""}`
30
+ );
31
+ err.status = resp.status;
32
+ err.headers = resp.headers;
33
+ return err;
34
+ }
35
+
36
+ // src/utils/ai/adapters/providers/anthropic.ts
37
+ function anthropicAdapter(opts = {}) {
38
+ if (opts.sdk) return sdkBackedAnthropic(opts);
39
+ return fetchBackedAnthropic(opts);
40
+ }
41
+ function toAnthropicRequest(messages, invokeOpts, defaultModel, stream) {
42
+ const model = invokeOpts?.model ?? defaultModel;
43
+ if (!model)
44
+ throw new Error("anthropicAdapter: model must be set via options.model or invokeOpts.model");
45
+ const { system, chat } = partitionSystem(messages, invokeOpts?.systemPrompt);
46
+ const body = {
47
+ model,
48
+ messages: chat.map(toAnthropicMessage),
49
+ max_tokens: invokeOpts?.maxTokens ?? 4096
50
+ };
51
+ if (system) body.system = system;
52
+ if (invokeOpts?.temperature != null) body.temperature = invokeOpts.temperature;
53
+ if (invokeOpts?.tools && invokeOpts.tools.length > 0)
54
+ body.tools = invokeOpts.tools.map(toAnthropicTool);
55
+ if (invokeOpts?.maxReasoningTokens != null) {
56
+ body.thinking = { type: "enabled", budget_tokens: invokeOpts.maxReasoningTokens };
57
+ }
58
+ if (invokeOpts?.cacheHint) {
59
+ }
60
+ if (stream) body.stream = true;
61
+ if (invokeOpts?.providerExtras) Object.assign(body, invokeOpts.providerExtras);
62
+ return body;
63
+ }
64
+ function partitionSystem(messages, systemPrompt) {
65
+ const systemParts = [];
66
+ if (systemPrompt) systemParts.push(systemPrompt);
67
+ const chat = [];
68
+ for (const m of messages) {
69
+ if (m.role === "system") systemParts.push(m.content);
70
+ else chat.push(m);
71
+ }
72
+ return { system: systemParts.length > 0 ? systemParts.join("\n\n") : void 0, chat };
73
+ }
74
+ function toAnthropicMessage(m) {
75
+ if (m.role === "tool") {
76
+ return {
77
+ role: "user",
78
+ content: [
79
+ {
80
+ type: "tool_result",
81
+ tool_use_id: m.toolCallId,
82
+ content: m.content
83
+ }
84
+ ]
85
+ };
86
+ }
87
+ if (m.role === "assistant" && m.toolCalls && m.toolCalls.length > 0) {
88
+ const blocks = [];
89
+ if (m.content) blocks.push({ type: "text", text: m.content });
90
+ for (const tc of m.toolCalls) {
91
+ blocks.push({ type: "tool_use", id: tc.id, name: tc.name, input: tc.arguments });
92
+ }
93
+ return { role: "assistant", content: blocks };
94
+ }
95
+ return { role: m.role, content: m.content };
96
+ }
97
+ function toAnthropicTool(t) {
98
+ return {
99
+ name: t.name,
100
+ description: t.description,
101
+ input_schema: t.parameters
102
+ };
103
+ }
104
+ function mergeAnthropicUsage(prev, next) {
105
+ if (!prev) return { ...next };
106
+ const merged = { ...prev };
107
+ if (next.input_tokens != null) merged.input_tokens = next.input_tokens;
108
+ if (next.output_tokens != null) merged.output_tokens = next.output_tokens;
109
+ if (next.cache_read_input_tokens != null)
110
+ merged.cache_read_input_tokens = next.cache_read_input_tokens;
111
+ if (next.cache_creation_input_tokens != null)
112
+ merged.cache_creation_input_tokens = next.cache_creation_input_tokens;
113
+ if (next.cache_creation) {
114
+ merged.cache_creation = {
115
+ ...prev.cache_creation ?? {},
116
+ ...next.cache_creation
117
+ };
118
+ }
119
+ if (next.server_tool_use) {
120
+ merged.server_tool_use = {
121
+ ...prev.server_tool_use ?? {},
122
+ ...next.server_tool_use
123
+ };
124
+ }
125
+ return merged;
126
+ }
127
+ function mapUsage(u) {
128
+ const usage = {
129
+ input: { regular: u?.input_tokens ?? 0 },
130
+ output: { regular: u?.output_tokens ?? 0 },
131
+ raw: u
132
+ };
133
+ if (u?.cache_read_input_tokens) usage.input.cacheRead = u.cache_read_input_tokens;
134
+ if (u?.cache_creation) {
135
+ if (u.cache_creation.ephemeral_5m_input_tokens)
136
+ usage.input.cacheWrite5m = u.cache_creation.ephemeral_5m_input_tokens;
137
+ if (u.cache_creation.ephemeral_1h_input_tokens)
138
+ usage.input.cacheWrite1h = u.cache_creation.ephemeral_1h_input_tokens;
139
+ } else if (u?.cache_creation_input_tokens) {
140
+ usage.input.cacheWrite5m = u.cache_creation_input_tokens;
141
+ }
142
+ if (u?.server_tool_use?.web_search_requests) {
143
+ usage.auxiliary = { webSearchRequests: u.server_tool_use.web_search_requests };
144
+ }
145
+ return usage;
146
+ }
147
+ function toLLMResponse(msg, latencyMs) {
148
+ const textParts = [];
149
+ const toolCalls = [];
150
+ for (const block of msg.content) {
151
+ if (block.type === "text" && typeof block.text === "string") {
152
+ textParts.push(block.text);
153
+ } else if (block.type === "tool_use") {
154
+ const tb = block;
155
+ toolCalls.push({ id: tb.id, name: tb.name, arguments: tb.input ?? {} });
156
+ }
157
+ }
158
+ return {
159
+ content: textParts.join(""),
160
+ toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
161
+ usage: mapUsage(msg.usage),
162
+ finishReason: msg.stop_reason,
163
+ latencyMs,
164
+ model: msg.model,
165
+ provider: "anthropic"
166
+ };
167
+ }
168
+ function fetchBackedAnthropic(opts) {
169
+ const apiKey = opts.apiKey ?? globalThis.process?.env?.ANTHROPIC_API_KEY;
170
+ if (!apiKey) {
171
+ }
172
+ const baseURL = opts.baseURL ?? "https://api.anthropic.com";
173
+ const anthropicVersion = opts.anthropicVersion ?? "2023-06-01";
174
+ const fetchImpl = opts.fetchImpl ?? fetch;
175
+ const commonHeaders = () => {
176
+ if (!apiKey)
177
+ throw new Error("anthropicAdapter: apiKey required for invoke/stream (or provide opts.sdk)");
178
+ return {
179
+ "x-api-key": apiKey,
180
+ "anthropic-version": anthropicVersion,
181
+ "content-type": "application/json",
182
+ ...opts.headers ?? {}
183
+ };
184
+ };
185
+ return {
186
+ provider: "anthropic",
187
+ model: opts.model,
188
+ async invoke(messages, invokeOpts) {
189
+ const body = toAnthropicRequest(messages, invokeOpts, opts.model, false);
190
+ const start = monotonicNs();
191
+ const resp = await fetchImpl(`${baseURL}/v1/messages`, {
192
+ method: "POST",
193
+ headers: commonHeaders(),
194
+ body: JSON.stringify(body),
195
+ signal: invokeOpts?.signal
196
+ });
197
+ if (!resp.ok) throw await makeHttpError(resp, "Anthropic");
198
+ const json = await resp.json();
199
+ const latencyMs = Math.max(0, (monotonicNs() - start) / 1e6);
200
+ return toLLMResponse(json, latencyMs);
201
+ },
202
+ async *stream(messages, invokeOpts) {
203
+ const body = toAnthropicRequest(messages, invokeOpts, opts.model, true);
204
+ const resp = await fetchImpl(`${baseURL}/v1/messages`, {
205
+ method: "POST",
206
+ headers: { ...commonHeaders(), accept: "text/event-stream" },
207
+ body: JSON.stringify(body),
208
+ signal: invokeOpts?.signal
209
+ });
210
+ if (!resp.ok) throw await makeHttpError(resp, "Anthropic");
211
+ if (!resp.body) throw new Error("anthropicAdapter: streaming response has no body");
212
+ let finalUsage;
213
+ let finishReason;
214
+ const toolCallsByIndex = /* @__PURE__ */ new Map();
215
+ for await (const event of parseSSEStream(resp.body, { signal: invokeOpts?.signal })) {
216
+ const data = event.data;
217
+ if (!data) continue;
218
+ let parsed;
219
+ try {
220
+ parsed = JSON.parse(data);
221
+ } catch {
222
+ continue;
223
+ }
224
+ switch (parsed.type) {
225
+ case "message_start": {
226
+ const ms = parsed;
227
+ finalUsage = mergeAnthropicUsage(finalUsage, ms.message.usage);
228
+ break;
229
+ }
230
+ case "content_block_start": {
231
+ const cb = parsed;
232
+ const b = cb.content_block;
233
+ if (b.type === "tool_use") {
234
+ toolCallsByIndex.set(cb.index, {
235
+ id: String(b.id ?? ""),
236
+ name: String(b.name ?? ""),
237
+ argBuf: ""
238
+ });
239
+ yield {
240
+ type: "tool-call-delta",
241
+ delta: { id: String(b.id ?? ""), name: String(b.name ?? "") }
242
+ };
243
+ }
244
+ break;
245
+ }
246
+ case "content_block_delta": {
247
+ const cbd = parsed;
248
+ const d = cbd.delta;
249
+ if (d.type === "text_delta" && typeof d.text === "string") {
250
+ yield { type: "token", delta: d.text };
251
+ } else if (d.type === "input_json_delta" && typeof d.partial_json === "string") {
252
+ const existing = toolCallsByIndex.get(cbd.index);
253
+ if (existing) existing.argBuf += d.partial_json;
254
+ yield {
255
+ type: "tool-call-delta",
256
+ delta: { argumentsDelta: d.partial_json }
257
+ };
258
+ } else if (d.type === "thinking_delta" && typeof d.thinking === "string") {
259
+ yield { type: "thinking", delta: d.thinking };
260
+ }
261
+ break;
262
+ }
263
+ case "message_delta": {
264
+ const md = parsed;
265
+ if (md.delta.stop_reason) finishReason = md.delta.stop_reason;
266
+ if (md.delta.usage) {
267
+ finalUsage = mergeAnthropicUsage(finalUsage, md.delta.usage);
268
+ }
269
+ break;
270
+ }
271
+ case "message_stop":
272
+ break;
273
+ }
274
+ }
275
+ if (finalUsage) yield { type: "usage", usage: mapUsage(finalUsage) };
276
+ yield { type: "finish", reason: finishReason ?? "stop" };
277
+ }
278
+ };
279
+ }
280
+ function sdkBackedAnthropic(opts) {
281
+ const sdk = opts.sdk;
282
+ if (!sdk) throw new Error("sdkBackedAnthropic: sdk instance required");
283
+ return {
284
+ provider: "anthropic",
285
+ model: opts.model,
286
+ async invoke(messages, invokeOpts) {
287
+ const body = toAnthropicRequest(messages, invokeOpts, opts.model, false);
288
+ const start = monotonicNs();
289
+ const resp = await sdk.messages.create(body, {
290
+ signal: invokeOpts?.signal
291
+ });
292
+ const latencyMs = Math.max(0, (monotonicNs() - start) / 1e6);
293
+ return toLLMResponse(resp, latencyMs);
294
+ },
295
+ async *stream(messages, invokeOpts) {
296
+ if (!sdk.messages.stream) {
297
+ throw new Error("sdkBackedAnthropic: SDK instance does not expose .messages.stream");
298
+ }
299
+ const body = toAnthropicRequest(messages, invokeOpts, opts.model, true);
300
+ let finalUsage;
301
+ let finishReason;
302
+ for await (const event of sdk.messages.stream(body, { signal: invokeOpts?.signal })) {
303
+ switch (event.type) {
304
+ case "message_start":
305
+ finalUsage = mergeAnthropicUsage(
306
+ finalUsage,
307
+ event.message.usage
308
+ );
309
+ break;
310
+ case "content_block_delta": {
311
+ const d = event.delta;
312
+ if (d?.type === "text_delta" && typeof d.text === "string") {
313
+ yield { type: "token", delta: d.text };
314
+ } else if (d?.type === "input_json_delta" && typeof d.partial_json === "string") {
315
+ yield { type: "tool-call-delta", delta: { argumentsDelta: d.partial_json } };
316
+ } else if (d?.type === "thinking_delta" && typeof d.thinking === "string") {
317
+ yield { type: "thinking", delta: d.thinking };
318
+ }
319
+ break;
320
+ }
321
+ case "message_delta": {
322
+ const md = event;
323
+ if (md.delta.stop_reason) finishReason = md.delta.stop_reason;
324
+ if (md.delta.usage) finalUsage = mergeAnthropicUsage(finalUsage, md.delta.usage);
325
+ break;
326
+ }
327
+ }
328
+ }
329
+ if (finalUsage) yield { type: "usage", usage: mapUsage(finalUsage) };
330
+ yield { type: "finish", reason: finishReason ?? "stop" };
331
+ }
332
+ };
333
+ }
334
+
335
+ // src/utils/ai/adapters/providers/google.ts
336
+ import { monotonicNs as monotonicNs2 } from "@graphrefly/pure-ts/core";
337
+ function googleAdapter(opts = {}) {
338
+ if (opts.sdk) return sdkBackedGoogle(opts);
339
+ return fetchBackedGoogle(opts);
340
+ }
341
+ function toGeminiRequest(messages, invokeOpts) {
342
+ const systemParts = [];
343
+ const contents = [];
344
+ if (invokeOpts?.systemPrompt) systemParts.push(invokeOpts.systemPrompt);
345
+ for (const m of messages) {
346
+ if (m.role === "system") {
347
+ systemParts.push(m.content);
348
+ continue;
349
+ }
350
+ if (m.role === "tool") {
351
+ contents.push({
352
+ role: "user",
353
+ parts: [
354
+ {
355
+ functionResponse: {
356
+ name: m.name ?? m.toolCallId ?? "tool",
357
+ response: { result: m.content }
358
+ }
359
+ }
360
+ ]
361
+ });
362
+ continue;
363
+ }
364
+ if (m.role === "assistant" && m.toolCalls && m.toolCalls.length > 0) {
365
+ const parts = [];
366
+ if (m.content) parts.push({ text: m.content });
367
+ for (const tc of m.toolCalls) {
368
+ parts.push({ functionCall: { name: tc.name, args: tc.arguments } });
369
+ }
370
+ contents.push({ role: "model", parts });
371
+ continue;
372
+ }
373
+ contents.push({
374
+ role: m.role === "assistant" ? "model" : "user",
375
+ parts: [{ text: m.content }]
376
+ });
377
+ }
378
+ const body = { contents };
379
+ if (systemParts.length > 0) {
380
+ body.systemInstruction = { role: "system", parts: [{ text: systemParts.join("\n\n") }] };
381
+ }
382
+ const genConfig = {};
383
+ if (invokeOpts?.maxTokens != null) genConfig.maxOutputTokens = invokeOpts.maxTokens;
384
+ if (invokeOpts?.temperature != null) genConfig.temperature = invokeOpts.temperature;
385
+ if (invokeOpts?.maxReasoningTokens != null) {
386
+ genConfig.thinkingConfig = { thinkingBudget: invokeOpts.maxReasoningTokens };
387
+ }
388
+ if (Object.keys(genConfig).length > 0) body.generationConfig = genConfig;
389
+ if (invokeOpts?.tools && invokeOpts.tools.length > 0) {
390
+ body.tools = [{ functionDeclarations: invokeOpts.tools.map(toGeminiTool) }];
391
+ }
392
+ if (invokeOpts?.providerExtras) Object.assign(body, invokeOpts.providerExtras);
393
+ return body;
394
+ }
395
+ function toGeminiTool(t) {
396
+ return {
397
+ name: t.name,
398
+ description: t.description,
399
+ parameters: t.parameters
400
+ };
401
+ }
402
+ function toSdkParams(body, model, signal) {
403
+ const config = {};
404
+ const gen = body.generationConfig;
405
+ if (gen) {
406
+ if (typeof gen.maxOutputTokens === "number") config.maxOutputTokens = gen.maxOutputTokens;
407
+ if (typeof gen.temperature === "number") config.temperature = gen.temperature;
408
+ if (gen.thinkingConfig) config.thinkingConfig = gen.thinkingConfig;
409
+ }
410
+ if (body.systemInstruction) config.systemInstruction = body.systemInstruction;
411
+ if (body.tools) config.tools = body.tools;
412
+ for (const [k, v] of Object.entries(body)) {
413
+ if (k === "contents" || k === "generationConfig" || k === "systemInstruction" || k === "tools" || // Skip `abortSignal` so a caller-supplied entry in `providerExtras`
414
+ // can't briefly land in `config.abortSignal` before being
415
+ // overwritten — the canonical signal channel is the second
416
+ // `signal` argument (set on `config.abortSignal` below).
417
+ k === "abortSignal" || // Skip `model` so a stray `body.model` (not produced by
418
+ // `toGeminiRequest` today, but defensively guarded) doesn't
419
+ // duplicate the top-level `model` field on the SDK request.
420
+ k === "model") {
421
+ continue;
422
+ }
423
+ config[k] = v;
424
+ }
425
+ if (signal) config.abortSignal = signal;
426
+ return {
427
+ model,
428
+ contents: body.contents,
429
+ config: Object.keys(config).length > 0 ? config : void 0
430
+ };
431
+ }
432
+ function mapUsage2(u) {
433
+ const usage = {
434
+ input: { regular: 0 },
435
+ output: { regular: 0 },
436
+ raw: u
437
+ };
438
+ if (!u) return usage;
439
+ const promptTotal = u.promptTokenCount ?? 0;
440
+ const cached = u.cachedContentTokenCount ?? 0;
441
+ usage.input.regular = Math.max(0, promptTotal - cached);
442
+ if (cached > 0) usage.input.cacheRead = cached;
443
+ if (u.toolUsePromptTokenCount) usage.input.toolUse = u.toolUsePromptTokenCount;
444
+ if (u.promptTokensDetails) {
445
+ for (const d of u.promptTokensDetails) {
446
+ const modality = d.modality?.toLowerCase();
447
+ if (modality === "image") usage.input.image = (usage.input.image ?? 0) + d.tokenCount;
448
+ else if (modality === "audio") usage.input.audio = (usage.input.audio ?? 0) + d.tokenCount;
449
+ else if (modality === "video") usage.input.video = (usage.input.video ?? 0) + d.tokenCount;
450
+ }
451
+ }
452
+ usage.output.regular = u.candidatesTokenCount ?? 0;
453
+ if (u.thoughtsTokenCount) usage.output.reasoning = u.thoughtsTokenCount;
454
+ return usage;
455
+ }
456
+ function toLLMResponse2(json, latencyMs) {
457
+ const cand = json.candidates?.[0];
458
+ const parts = cand?.content?.parts ?? [];
459
+ const textParts = [];
460
+ const toolCalls = [];
461
+ let i = 0;
462
+ for (const p of parts) {
463
+ if (typeof p.text === "string") textParts.push(p.text);
464
+ if (p.functionCall) {
465
+ toolCalls.push({
466
+ id: `${p.functionCall.name}-${i++}`,
467
+ name: p.functionCall.name,
468
+ arguments: p.functionCall.args ?? {}
469
+ });
470
+ }
471
+ }
472
+ return {
473
+ content: textParts.join(""),
474
+ toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
475
+ usage: mapUsage2(json.usageMetadata),
476
+ finishReason: cand?.finishReason,
477
+ latencyMs,
478
+ model: json.modelVersion,
479
+ provider: "google"
480
+ };
481
+ }
482
+ function resolveApiKey(opts) {
483
+ if (opts.apiKey) return opts.apiKey;
484
+ const env = globalThis.process?.env;
485
+ return env?.GOOGLE_API_KEY ?? env?.GEMINI_API_KEY;
486
+ }
487
+ function fetchBackedGoogle(opts) {
488
+ const baseURL = opts.baseURL ?? "https://generativelanguage.googleapis.com/v1beta";
489
+ const fetchImpl = opts.fetchImpl ?? fetch;
490
+ const pickModel = (invokeOpts) => {
491
+ const model = invokeOpts?.model ?? opts.model;
492
+ if (!model)
493
+ throw new Error("googleAdapter: model must be set via options.model or invokeOpts.model");
494
+ return model;
495
+ };
496
+ const keyParam = () => {
497
+ const key = resolveApiKey(opts);
498
+ if (!key) throw new Error("googleAdapter: apiKey required for invoke/stream");
499
+ return `key=${encodeURIComponent(key)}`;
500
+ };
501
+ return {
502
+ provider: "google",
503
+ model: opts.model,
504
+ async invoke(messages, invokeOpts) {
505
+ const model = pickModel(invokeOpts);
506
+ const body = toGeminiRequest(messages, invokeOpts);
507
+ const start = monotonicNs2();
508
+ const url = `${baseURL}/models/${encodeURIComponent(model)}:generateContent?${keyParam()}`;
509
+ const resp = await fetchImpl(url, {
510
+ method: "POST",
511
+ headers: { "content-type": "application/json", ...opts.headers ?? {} },
512
+ body: JSON.stringify(body),
513
+ signal: invokeOpts?.signal
514
+ });
515
+ if (!resp.ok) throw await makeHttpError(resp, "Google");
516
+ const json = await resp.json();
517
+ const latencyMs = Math.max(0, (monotonicNs2() - start) / 1e6);
518
+ return toLLMResponse2(json, latencyMs);
519
+ },
520
+ async *stream(messages, invokeOpts) {
521
+ const model = pickModel(invokeOpts);
522
+ const body = toGeminiRequest(messages, invokeOpts);
523
+ const url = `${baseURL}/models/${encodeURIComponent(model)}:streamGenerateContent?alt=sse&${keyParam()}`;
524
+ const resp = await fetchImpl(url, {
525
+ method: "POST",
526
+ headers: {
527
+ "content-type": "application/json",
528
+ accept: "text/event-stream",
529
+ ...opts.headers ?? {}
530
+ },
531
+ body: JSON.stringify(body),
532
+ signal: invokeOpts?.signal
533
+ });
534
+ if (!resp.ok) throw await makeHttpError(resp, "Google");
535
+ if (!resp.body) throw new Error("googleAdapter: streaming response has no body");
536
+ let finalUsage;
537
+ let finishReason;
538
+ for await (const event of parseSSEStream(resp.body, { signal: invokeOpts?.signal })) {
539
+ if (!event.data) continue;
540
+ let parsed;
541
+ try {
542
+ parsed = JSON.parse(event.data);
543
+ } catch {
544
+ continue;
545
+ }
546
+ const cand = parsed.candidates?.[0];
547
+ for (const p of cand?.content?.parts ?? []) {
548
+ if (typeof p.text === "string") {
549
+ if (p.thought) yield { type: "thinking", delta: p.text };
550
+ else yield { type: "token", delta: p.text };
551
+ }
552
+ if (p.functionCall) {
553
+ yield {
554
+ type: "tool-call-delta",
555
+ delta: {
556
+ name: p.functionCall.name,
557
+ argumentsDelta: JSON.stringify(p.functionCall.args ?? {})
558
+ }
559
+ };
560
+ }
561
+ }
562
+ if (cand?.finishReason) finishReason = cand.finishReason;
563
+ if (parsed.usageMetadata) finalUsage = parsed.usageMetadata;
564
+ }
565
+ if (finalUsage) yield { type: "usage", usage: mapUsage2(finalUsage) };
566
+ yield { type: "finish", reason: finishReason ?? "stop" };
567
+ }
568
+ };
569
+ }
570
+ function sdkBackedGoogle(opts) {
571
+ const sdk = opts.sdk;
572
+ if (!sdk) throw new Error("sdkBackedGoogle: sdk instance required");
573
+ return {
574
+ provider: "google",
575
+ model: opts.model,
576
+ async invoke(messages, invokeOpts) {
577
+ const body = toGeminiRequest(messages, invokeOpts);
578
+ const model = invokeOpts?.model ?? opts.model;
579
+ if (!model) throw new Error("googleAdapter: model required");
580
+ const params = toSdkParams(body, model, invokeOpts?.signal);
581
+ const start = monotonicNs2();
582
+ const resp = await sdk.models.generateContent(params);
583
+ const latencyMs = Math.max(0, (monotonicNs2() - start) / 1e6);
584
+ return toLLMResponse2(resp, latencyMs);
585
+ },
586
+ async *stream(messages, invokeOpts) {
587
+ if (!sdk.models.generateContentStream) {
588
+ throw new Error("sdkBackedGoogle: SDK instance does not expose generateContentStream");
589
+ }
590
+ const body = toGeminiRequest(messages, invokeOpts);
591
+ const model = invokeOpts?.model ?? opts.model;
592
+ if (!model) throw new Error("googleAdapter: model required");
593
+ const params = toSdkParams(body, model, invokeOpts?.signal);
594
+ let finalUsage;
595
+ let finishReason;
596
+ const stream = await sdk.models.generateContentStream(params);
597
+ for await (const chunk of stream) {
598
+ const cand = chunk.candidates?.[0];
599
+ for (const p of cand?.content?.parts ?? []) {
600
+ if (typeof p.text === "string") {
601
+ if (p.thought) yield { type: "thinking", delta: p.text };
602
+ else yield { type: "token", delta: p.text };
603
+ }
604
+ if (p.functionCall) {
605
+ yield {
606
+ type: "tool-call-delta",
607
+ delta: {
608
+ name: p.functionCall.name,
609
+ argumentsDelta: JSON.stringify(p.functionCall.args ?? {})
610
+ }
611
+ };
612
+ }
613
+ }
614
+ if (cand?.finishReason) finishReason = cand.finishReason;
615
+ if (chunk.usageMetadata) finalUsage = chunk.usageMetadata;
616
+ }
617
+ if (finalUsage) yield { type: "usage", usage: mapUsage2(finalUsage) };
618
+ yield { type: "finish", reason: finishReason ?? "stop" };
619
+ }
620
+ };
621
+ }
622
+
623
+ // src/utils/ai/adapters/providers/openai-compat.ts
624
+ import { monotonicNs as monotonicNs3 } from "@graphrefly/pure-ts/core";
625
+ var PRESETS = {
626
+ openai: { baseURL: "https://api.openai.com/v1", apiKeyEnv: "OPENAI_API_KEY", provider: "openai" },
627
+ openrouter: {
628
+ baseURL: "https://openrouter.ai/api/v1",
629
+ apiKeyEnv: "OPENROUTER_API_KEY",
630
+ provider: "openrouter"
631
+ },
632
+ groq: { baseURL: "https://api.groq.com/openai/v1", apiKeyEnv: "GROQ_API_KEY", provider: "groq" },
633
+ ollama: { baseURL: "http://localhost:11434/v1", provider: "ollama" },
634
+ deepseek: {
635
+ baseURL: "https://api.deepseek.com/v1",
636
+ apiKeyEnv: "DEEPSEEK_API_KEY",
637
+ provider: "deepseek"
638
+ },
639
+ xai: { baseURL: "https://api.x.ai/v1", apiKeyEnv: "XAI_API_KEY", provider: "xai" }
640
+ };
641
+ function openAICompatAdapter(opts = {}) {
642
+ if (opts.sdk) return sdkBackedOpenAI(opts);
643
+ return fetchBackedOpenAI(opts);
644
+ }
645
+ function toOpenAIRequest(messages, invokeOpts, defaultModel, stream, bodyExtras) {
646
+ const model = invokeOpts?.model ?? defaultModel;
647
+ if (!model)
648
+ throw new Error("openAICompatAdapter: model must be set via options.model or invokeOpts.model");
649
+ const mapped = messages.map(toOpenAIMessage);
650
+ if (invokeOpts?.systemPrompt && !messages.some((m) => m.role === "system")) {
651
+ mapped.unshift({ role: "system", content: invokeOpts.systemPrompt });
652
+ }
653
+ const body = { model, messages: mapped };
654
+ if (invokeOpts?.maxTokens != null) body.max_tokens = invokeOpts.maxTokens;
655
+ if (invokeOpts?.temperature != null) body.temperature = invokeOpts.temperature;
656
+ if (invokeOpts?.tools && invokeOpts.tools.length > 0) {
657
+ body.tools = invokeOpts.tools.map(toOpenAITool);
658
+ }
659
+ if (invokeOpts?.maxReasoningTokens != null) {
660
+ body.reasoning = { max_tokens: invokeOpts.maxReasoningTokens };
661
+ }
662
+ if (stream) {
663
+ body.stream = true;
664
+ body.stream_options = { include_usage: true };
665
+ }
666
+ if (bodyExtras) Object.assign(body, bodyExtras);
667
+ if (invokeOpts?.providerExtras) Object.assign(body, invokeOpts.providerExtras);
668
+ return body;
669
+ }
670
+ function toOpenAIMessage(m) {
671
+ if (m.role === "tool") {
672
+ return { role: "tool", tool_call_id: m.toolCallId, content: m.content };
673
+ }
674
+ if (m.role === "assistant" && m.toolCalls && m.toolCalls.length > 0) {
675
+ return {
676
+ role: "assistant",
677
+ content: m.content || null,
678
+ tool_calls: m.toolCalls.map((tc) => ({
679
+ id: tc.id,
680
+ type: "function",
681
+ function: { name: tc.name, arguments: JSON.stringify(tc.arguments) }
682
+ }))
683
+ };
684
+ }
685
+ return { role: m.role, content: m.content };
686
+ }
687
+ function toOpenAITool(t) {
688
+ return {
689
+ type: "function",
690
+ function: {
691
+ name: t.name,
692
+ description: t.description,
693
+ parameters: t.parameters
694
+ }
695
+ };
696
+ }
697
+ function mapUsage3(u) {
698
+ const usage = {
699
+ input: { regular: 0 },
700
+ output: { regular: 0 },
701
+ raw: u
702
+ };
703
+ if (!u) return usage;
704
+ const inputTotal = u.prompt_tokens ?? 0;
705
+ let cacheRead = u.prompt_tokens_details?.cached_tokens ?? 0;
706
+ if (u.prompt_cache_hit_tokens != null) {
707
+ cacheRead = u.prompt_cache_hit_tokens;
708
+ usage.input.regular = u.prompt_cache_miss_tokens ?? Math.max(0, inputTotal - cacheRead);
709
+ } else {
710
+ usage.input.regular = Math.max(0, inputTotal - cacheRead);
711
+ }
712
+ if (cacheRead > 0) usage.input.cacheRead = cacheRead;
713
+ if (u.prompt_tokens_details?.audio_tokens)
714
+ usage.input.audio = u.prompt_tokens_details.audio_tokens;
715
+ const outputTotal = u.completion_tokens ?? 0;
716
+ const reasoning = u.completion_tokens_details?.reasoning_tokens ?? 0;
717
+ usage.output.regular = Math.max(0, outputTotal - reasoning);
718
+ if (reasoning > 0) usage.output.reasoning = reasoning;
719
+ if (u.completion_tokens_details?.audio_tokens)
720
+ usage.output.audio = u.completion_tokens_details.audio_tokens;
721
+ if (u.completion_tokens_details?.accepted_prediction_tokens) {
722
+ usage.output.predictionAccepted = u.completion_tokens_details.accepted_prediction_tokens;
723
+ }
724
+ if (u.completion_tokens_details?.rejected_prediction_tokens) {
725
+ usage.output.predictionRejected = u.completion_tokens_details.rejected_prediction_tokens;
726
+ }
727
+ return usage;
728
+ }
729
+ function toLLMResponse3(json, latencyMs, provider) {
730
+ const choice = json.choices[0];
731
+ const msg = choice?.message;
732
+ const content = msg?.content ?? "";
733
+ const toolCalls = (msg?.tool_calls ?? []).map((tc) => ({
734
+ id: tc.id,
735
+ name: tc.function.name,
736
+ arguments: safeJsonParse(tc.function.arguments)
737
+ }));
738
+ return {
739
+ content,
740
+ toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
741
+ usage: mapUsage3(json.usage),
742
+ finishReason: choice?.finish_reason,
743
+ latencyMs,
744
+ model: json.model,
745
+ provider
746
+ };
747
+ }
748
+ function safeJsonParse(s) {
749
+ try {
750
+ const parsed = JSON.parse(s);
751
+ return typeof parsed === "object" && parsed != null ? parsed : { _raw: s };
752
+ } catch {
753
+ return { _raw: s };
754
+ }
755
+ }
756
+ function resolveConfig(opts) {
757
+ const preset = opts.preset ?? "openai";
758
+ const base = PRESETS[preset];
759
+ const baseURL = opts.baseURL ?? base.baseURL;
760
+ const provider = opts.provider ?? base.provider;
761
+ const envKey = base.apiKeyEnv;
762
+ const apiKey = opts.apiKey ?? (envKey ? globalThis.process?.env?.[envKey] : void 0);
763
+ return { provider, baseURL, apiKey };
764
+ }
765
+ function fetchBackedOpenAI(opts) {
766
+ const { provider, baseURL, apiKey } = resolveConfig(opts);
767
+ const fetchImpl = opts.fetchImpl ?? fetch;
768
+ const needsKey = provider !== "ollama";
769
+ const commonHeaders = () => {
770
+ const h = {
771
+ "content-type": "application/json",
772
+ ...opts.headers ?? {}
773
+ };
774
+ if (needsKey) {
775
+ if (!apiKey)
776
+ throw new Error(`openAICompatAdapter[${provider}]: apiKey required for invoke/stream`);
777
+ h.authorization = `Bearer ${apiKey}`;
778
+ }
779
+ return h;
780
+ };
781
+ return {
782
+ provider,
783
+ model: opts.model,
784
+ async invoke(messages, invokeOpts) {
785
+ const body = toOpenAIRequest(messages, invokeOpts, opts.model, false, opts.bodyExtras);
786
+ const start = monotonicNs3();
787
+ const resp = await fetchImpl(`${baseURL}/chat/completions`, {
788
+ method: "POST",
789
+ headers: commonHeaders(),
790
+ body: JSON.stringify(body),
791
+ signal: invokeOpts?.signal
792
+ });
793
+ if (!resp.ok) throw await makeHttpError(resp, provider);
794
+ const json = await resp.json();
795
+ const latencyMs = Math.max(0, (monotonicNs3() - start) / 1e6);
796
+ return toLLMResponse3(json, latencyMs, provider);
797
+ },
798
+ async *stream(messages, invokeOpts) {
799
+ const body = toOpenAIRequest(messages, invokeOpts, opts.model, true, opts.bodyExtras);
800
+ const resp = await fetchImpl(`${baseURL}/chat/completions`, {
801
+ method: "POST",
802
+ headers: { ...commonHeaders(), accept: "text/event-stream" },
803
+ body: JSON.stringify(body),
804
+ signal: invokeOpts?.signal
805
+ });
806
+ if (!resp.ok) throw await makeHttpError(resp, provider);
807
+ if (!resp.body)
808
+ throw new Error(`openAICompatAdapter[${provider}]: streaming response has no body`);
809
+ let finalUsage;
810
+ let finishReason;
811
+ for await (const event of parseSSEStream(resp.body, { signal: invokeOpts?.signal })) {
812
+ if (!event.data || event.data === "[DONE]") continue;
813
+ let parsed;
814
+ try {
815
+ parsed = JSON.parse(event.data);
816
+ } catch {
817
+ continue;
818
+ }
819
+ const choices = parsed.choices;
820
+ if (choices) {
821
+ const c = choices[0];
822
+ if (c?.delta?.content) yield { type: "token", delta: c.delta.content };
823
+ if (c?.delta?.reasoning_content) {
824
+ yield { type: "thinking", delta: c.delta.reasoning_content };
825
+ }
826
+ if (c?.delta?.tool_calls) {
827
+ for (const tc of c.delta.tool_calls) {
828
+ yield {
829
+ type: "tool-call-delta",
830
+ delta: {
831
+ id: tc.id,
832
+ name: tc.function?.name,
833
+ argumentsDelta: tc.function?.arguments
834
+ }
835
+ };
836
+ }
837
+ }
838
+ if (c?.finish_reason) finishReason = c.finish_reason;
839
+ }
840
+ if (parsed.usage) {
841
+ finalUsage = parsed.usage;
842
+ yield { type: "usage", usage: mapUsage3(finalUsage) };
843
+ }
844
+ }
845
+ yield { type: "finish", reason: finishReason ?? "stop" };
846
+ }
847
+ };
848
+ }
849
+ function sdkBackedOpenAI(opts) {
850
+ const sdk = opts.sdk;
851
+ if (!sdk) throw new Error("sdkBackedOpenAI: sdk instance required");
852
+ const { provider } = resolveConfig(opts);
853
+ return {
854
+ provider,
855
+ model: opts.model,
856
+ async invoke(messages, invokeOpts) {
857
+ const body = toOpenAIRequest(messages, invokeOpts, opts.model, false, opts.bodyExtras);
858
+ const start = monotonicNs3();
859
+ const resp = await sdk.chat.completions.create(body, { signal: invokeOpts?.signal });
860
+ const latencyMs = Math.max(0, (monotonicNs3() - start) / 1e6);
861
+ return toLLMResponse3(resp, latencyMs, provider);
862
+ },
863
+ async *stream(messages, invokeOpts) {
864
+ const body = toOpenAIRequest(messages, invokeOpts, opts.model, true, opts.bodyExtras);
865
+ const stream = await sdk.chat.completions.create(body, {
866
+ signal: invokeOpts?.signal
867
+ });
868
+ let finalUsage;
869
+ let finishReason;
870
+ for await (const chunk of stream) {
871
+ const choices = chunk.choices;
872
+ if (choices) {
873
+ const c = choices[0];
874
+ if (c?.delta?.content) yield { type: "token", delta: c.delta.content };
875
+ if (c?.delta?.reasoning_content)
876
+ yield { type: "thinking", delta: c.delta.reasoning_content };
877
+ if (c?.delta?.tool_calls) {
878
+ for (const tc of c.delta.tool_calls) {
879
+ yield {
880
+ type: "tool-call-delta",
881
+ delta: {
882
+ id: tc.id,
883
+ name: tc.function?.name,
884
+ argumentsDelta: tc.function?.arguments
885
+ }
886
+ };
887
+ }
888
+ }
889
+ if (c?.finish_reason) finishReason = c.finish_reason;
890
+ }
891
+ const u = chunk.usage;
892
+ if (u) {
893
+ finalUsage = u;
894
+ yield { type: "usage", usage: mapUsage3(u) };
895
+ }
896
+ }
897
+ if (!finalUsage) {
898
+ }
899
+ yield { type: "finish", reason: finishReason ?? "stop" };
900
+ }
901
+ };
902
+ }
903
+
904
+ // src/utils/ai/adapters/core/factory.ts
905
+ function createAdapter(opts) {
906
+ switch (opts.provider) {
907
+ case "anthropic": {
908
+ const a = {
909
+ apiKey: opts.apiKey,
910
+ model: opts.model,
911
+ baseURL: opts.baseURL,
912
+ headers: opts.headers,
913
+ sdk: opts.sdk,
914
+ fetchImpl: opts.fetchImpl,
915
+ ...opts.extras
916
+ };
917
+ return anthropicAdapter(a);
918
+ }
919
+ case "google": {
920
+ const g = {
921
+ apiKey: opts.apiKey,
922
+ model: opts.model,
923
+ baseURL: opts.baseURL,
924
+ headers: opts.headers,
925
+ sdk: opts.sdk,
926
+ fetchImpl: opts.fetchImpl,
927
+ ...opts.extras
928
+ };
929
+ return googleAdapter(g);
930
+ }
931
+ case "dry-run": {
932
+ const d = {
933
+ model: opts.model,
934
+ ...opts.extras
935
+ };
936
+ return dryRunAdapter(d);
937
+ }
938
+ case "fallback": {
939
+ const f = {
940
+ provider: opts.provider,
941
+ model: opts.model,
942
+ ...opts.extras
943
+ };
944
+ return fallbackAdapter(f);
945
+ }
946
+ // OpenAI-compat presets
947
+ case "openai":
948
+ case "openrouter":
949
+ case "groq":
950
+ case "ollama":
951
+ case "deepseek":
952
+ case "xai": {
953
+ const c = {
954
+ preset: opts.provider,
955
+ apiKey: opts.apiKey,
956
+ model: opts.model,
957
+ baseURL: opts.baseURL,
958
+ headers: opts.headers,
959
+ bodyExtras: opts.bodyExtras,
960
+ sdk: opts.sdk,
961
+ fetchImpl: opts.fetchImpl,
962
+ ...opts.extras
963
+ };
964
+ return openAICompatAdapter(c);
965
+ }
966
+ default: {
967
+ const never = opts.provider;
968
+ throw new Error(`createAdapter: unknown provider: ${String(never)}`);
969
+ }
970
+ }
971
+ }
972
+
973
+ // src/utils/ai/adapters/routing/cascading.ts
974
+ import { fromAny } from "@graphrefly/pure-ts/extra";
975
+ var AllTiersExhaustedError = class extends Error {
976
+ name = "AllTiersExhaustedError";
977
+ skipped;
978
+ failed;
979
+ constructor(report) {
980
+ const parts = [];
981
+ if (report.failed.size > 0) parts.push(`failed=[${[...report.failed.keys()].join(",")}]`);
982
+ if (report.skipped.length > 0) {
983
+ parts.push(`skipped=[${report.skipped.map((s) => `${s.name}(${s.reason})`).join(",")}]`);
984
+ }
985
+ super(`All LLM adapter tiers exhausted: ${parts.join(" ")}`);
986
+ this.skipped = report.skipped;
987
+ this.failed = report.failed;
988
+ }
989
+ };
990
+ function cascadingLlmAdapter(tiers, opts = {}) {
991
+ if (tiers.length === 0) throw new RangeError("cascadingLlmAdapter: tiers must be non-empty");
992
+ const resolved = tiers.map((t) => ({
993
+ name: t.name,
994
+ adapter: t.adapter,
995
+ filter: t.filter,
996
+ breaker: t.breaker ? "canExecute" in t.breaker ? t.breaker : circuitBreaker(t.breaker) : void 0
997
+ }));
998
+ const streamRetryBeforeFirstChunk = opts.streamRetryBeforeFirstChunk ?? true;
999
+ const cascade = {
1000
+ provider: "cascading",
1001
+ model: void 0,
1002
+ async invoke(messages, invokeOpts) {
1003
+ const skipped = [];
1004
+ const failed = /* @__PURE__ */ new Map();
1005
+ for (let i = 0; i < resolved.length; i++) {
1006
+ const t = resolved[i];
1007
+ if (t.filter && !t.filter(messages, invokeOpts)) {
1008
+ skipped.push({ name: t.name, reason: "filter" });
1009
+ continue;
1010
+ }
1011
+ if (t.breaker && !t.breaker.canExecute()) {
1012
+ skipped.push({ name: t.name, reason: "breaker" });
1013
+ continue;
1014
+ }
1015
+ try {
1016
+ const resp = await firstValueFrom(fromAny(t.adapter.invoke(messages, invokeOpts)));
1017
+ t.breaker?.recordSuccess();
1018
+ return { ...resp, metadata: { ...resp.metadata ?? {}, tier: t.name } };
1019
+ } catch (err) {
1020
+ failed.set(t.name, err);
1021
+ t.breaker?.recordFailure(err);
1022
+ const next = resolved[i + 1];
1023
+ if (next) opts.onFallback?.(t.name, next.name, err);
1024
+ }
1025
+ }
1026
+ const report = { skipped, failed };
1027
+ opts.onExhausted?.(report);
1028
+ throw new AllTiersExhaustedError(report);
1029
+ },
1030
+ async *stream(messages, invokeOpts) {
1031
+ const skipped = [];
1032
+ const failed = /* @__PURE__ */ new Map();
1033
+ for (let i = 0; i < resolved.length; i++) {
1034
+ const t = resolved[i];
1035
+ if (t.filter && !t.filter(messages, invokeOpts)) {
1036
+ skipped.push({ name: t.name, reason: "filter" });
1037
+ continue;
1038
+ }
1039
+ if (t.breaker && !t.breaker.canExecute()) {
1040
+ skipped.push({ name: t.name, reason: "breaker" });
1041
+ continue;
1042
+ }
1043
+ let yieldedAny = false;
1044
+ try {
1045
+ for await (const delta of t.adapter.stream(messages, invokeOpts)) {
1046
+ yieldedAny = true;
1047
+ yield delta;
1048
+ }
1049
+ t.breaker?.recordSuccess();
1050
+ return;
1051
+ } catch (err) {
1052
+ failed.set(t.name, err);
1053
+ t.breaker?.recordFailure(err);
1054
+ if (yieldedAny || !streamRetryBeforeFirstChunk) {
1055
+ throw err;
1056
+ }
1057
+ const next = resolved[i + 1];
1058
+ if (next) opts.onFallback?.(t.name, next.name, err);
1059
+ }
1060
+ }
1061
+ const report = { skipped, failed };
1062
+ opts.onExhausted?.(report);
1063
+ throw new AllTiersExhaustedError(report);
1064
+ }
1065
+ };
1066
+ withLayer(cascade, `cascade[${resolved.map((t) => t.name).join(",")}]`);
1067
+ return cascade;
1068
+ }
1069
+ function tier(name, adapter, opts) {
1070
+ const out = { name, adapter };
1071
+ if (opts?.breaker) out.breaker = opts.breaker;
1072
+ if (opts?.filter) out.filter = opts.filter;
1073
+ return out;
1074
+ }
1075
+
1076
+ export {
1077
+ anthropicAdapter,
1078
+ googleAdapter,
1079
+ openAICompatAdapter,
1080
+ createAdapter,
1081
+ AllTiersExhaustedError,
1082
+ cascadingLlmAdapter,
1083
+ tier
1084
+ };
1085
+ //# sourceMappingURL=chunk-4GYMCUDZ.js.map