@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,1575 @@
1
+ import {
2
+ agent
3
+ } from "./chunk-5THCXDWY.js";
4
+ import {
5
+ DEFAULT_EXECUTE_PROMPT,
6
+ DEFAULT_PRESET_ID,
7
+ DEFAULT_QUEUE_CONFIGS,
8
+ DEFAULT_SEVERITY_WEIGHTS,
9
+ DEFAULT_TRIAGE_PROMPT,
10
+ DEFAULT_VERIFY_PROMPT,
11
+ QUEUE_NAMES,
12
+ defaultErrorClassifier,
13
+ resolvePromptFn,
14
+ strategyKey,
15
+ strategyModel
16
+ } from "./chunk-OIWU3NYV.js";
17
+ import {
18
+ jobFlow,
19
+ jobQueue
20
+ } from "./chunk-PKPO3JTZ.js";
21
+ import {
22
+ pipelineGraph
23
+ } from "./chunk-CGHORL6G.js";
24
+ import {
25
+ _oneShotLlmCall,
26
+ aiMeta,
27
+ promptNode,
28
+ stripFences
29
+ } from "./chunk-OO5BM6CJ.js";
30
+ import {
31
+ SPAWNS_TOPIC,
32
+ messagingHub,
33
+ subscription,
34
+ topic,
35
+ topicBridge
36
+ } from "./chunk-Q3EYOCZB.js";
37
+ import {
38
+ DEFAULT_DECAY_RATE
39
+ } from "./chunk-QMBYUVRL.js";
40
+ import {
41
+ tryIncrementBounded
42
+ } from "./chunk-BXGZFGZ4.js";
43
+
44
+ // src/presets/harness/refine-loop.ts
45
+ import {
46
+ batch,
47
+ node as createNode,
48
+ DATA,
49
+ ERROR,
50
+ monotonicNs,
51
+ placeholderArgs,
52
+ RESOLVED
53
+ } from "@graphrefly/pure-ts/core";
54
+ import { switchMap } from "@graphrefly/pure-ts/extra";
55
+ import { Graph } from "@graphrefly/pure-ts/graph";
56
+ var RefineLoopGraph = class extends Graph {
57
+ best;
58
+ /**
59
+ * Best score so far. Pseudo-private (`_score`) to avoid colliding with any
60
+ * future `Graph.prototype.score` method (B5d forward-compat hazard
61
+ * prevention). Typed-public — read via `loop._score.cache` /
62
+ * `loop._score.subscribe(...)` from external code.
63
+ */
64
+ _score;
65
+ status;
66
+ history;
67
+ strategy;
68
+ /**
69
+ * Monotonic iteration counter. Pseudo-private (`_iteration`) to avoid
70
+ * colliding with any future `Graph.prototype.iteration` method (B5d
71
+ * forward-compat hazard prevention). Typed-public — read via
72
+ * `loop._iteration.cache` / `loop._iteration.subscribe(...)`.
73
+ */
74
+ _iteration;
75
+ /** Stage topic — subscribe for per-stage streaming / cursor consumers. */
76
+ generate;
77
+ /** Stage topic — subscribe for per-stage streaming / cursor consumers. */
78
+ evaluate;
79
+ /** Stage topic — subscribe for per-stage streaming / cursor consumers. */
80
+ analyze;
81
+ /** Stage topic — subscribe for per-stage streaming / cursor consumers. */
82
+ decide;
83
+ /** Internal: paused-flag node. Mounted as "paused" in describe(). */
84
+ _pauseState;
85
+ constructor(seed, evaluator, initialStrategy, opts) {
86
+ const name = opts.name ?? "refine-loop";
87
+ super(name, opts.graph);
88
+ this.tagFactory(
89
+ "refineLoop",
90
+ placeholderArgs({ seed, evaluator, initialStrategy, ...opts })
91
+ );
92
+ const datasetNode = isNode(opts.dataset) ? opts.dataset : createNode([], {
93
+ name: "dataset",
94
+ initial: opts.dataset
95
+ });
96
+ this.add(datasetNode, { name: "dataset" });
97
+ const iterationTrigger = createNode([], { name: "iteration", initial: 0 });
98
+ this.add(iterationTrigger, { name: "iteration" });
99
+ const strategyNode = createNode([], {
100
+ name: "strategy",
101
+ initial: initialStrategy,
102
+ equals: () => false
103
+ // always propagate strategy swaps
104
+ });
105
+ this.add(strategyNode, { name: "strategy" });
106
+ const lastFeedbackState = createNode([], {
107
+ name: "lastFeedback",
108
+ initial: null
109
+ });
110
+ this.add(lastFeedbackState, { name: "lastFeedback" });
111
+ const prevCandidatesState = createNode([], {
112
+ name: "prevCandidates",
113
+ initial: []
114
+ });
115
+ this.add(prevCandidatesState, { name: "prevCandidates" });
116
+ const pauseState = createNode([], { name: "paused", initial: false });
117
+ this.add(pauseState, { name: "paused" });
118
+ const statusState = createNode([], { name: "status", initial: "running" });
119
+ this.add(statusState, { name: "status" });
120
+ const historyState = createNode([], {
121
+ name: "history",
122
+ initial: [],
123
+ equals: () => false
124
+ // append-style; reactive consumers want every push
125
+ });
126
+ this.add(historyState, { name: "history" });
127
+ const bestState = createNode([], { name: "best", initial: null });
128
+ this.add(bestState, { name: "best" });
129
+ const scoreState = createNode([], { name: "score", initial: Number.NEGATIVE_INFINITY });
130
+ this.add(scoreState, { name: "score" });
131
+ const budgetState = createNode([], { name: "budget-used", initial: 0 });
132
+ this.add(budgetState, { name: "budget-used" });
133
+ const hub = messagingHub("stages");
134
+ this.mount("stages", hub);
135
+ const hubGenerateTopic = hub.topic("generate");
136
+ const hubEvaluateTopic = hub.topic("evaluate");
137
+ const hubAnalyzeTopic = hub.topic("analyze");
138
+ const hubDecideTopic = hub.topic("decide");
139
+ this.best = bestState;
140
+ this._score = scoreState;
141
+ this.status = statusState;
142
+ this.history = historyState;
143
+ this.strategy = strategyNode;
144
+ this._iteration = iterationTrigger;
145
+ this.generate = hubGenerateTopic;
146
+ this.evaluate = hubEvaluateTopic;
147
+ this.analyze = hubAnalyzeTopic;
148
+ this.decide = hubDecideTopic;
149
+ this._pauseState = pauseState;
150
+ let latestStrategy = initialStrategy;
151
+ let latestFeedback = null;
152
+ let latestPrevCandidates = [];
153
+ this.addDisposer(
154
+ strategyNode.subscribe((msgs) => {
155
+ for (const m of msgs) if (m[0] === DATA) latestStrategy = m[1];
156
+ })
157
+ );
158
+ this.addDisposer(
159
+ lastFeedbackState.subscribe((msgs) => {
160
+ for (const m of msgs) if (m[0] === DATA) latestFeedback = m[1];
161
+ })
162
+ );
163
+ this.addDisposer(
164
+ prevCandidatesState.subscribe((msgs) => {
165
+ for (const m of msgs) if (m[0] === DATA) latestPrevCandidates = m[1];
166
+ })
167
+ );
168
+ const candidatesNode = switchMap(
169
+ iterationTrigger,
170
+ (iter) => {
171
+ const strat = latestStrategy;
172
+ const isSeed = iter === 0 || latestFeedback == null;
173
+ return createNode(
174
+ [],
175
+ (_data, actions) => {
176
+ let cancelled = false;
177
+ try {
178
+ const result = isSeed ? strat.seed(seed) : strat.generate(latestFeedback, latestPrevCandidates);
179
+ if (result instanceof Promise) {
180
+ result.then(
181
+ (v) => {
182
+ if (!cancelled) actions.emit({ iter, items: v });
183
+ },
184
+ (err) => {
185
+ if (!cancelled) actions.down([[ERROR, err]]);
186
+ }
187
+ );
188
+ return () => {
189
+ cancelled = true;
190
+ };
191
+ }
192
+ actions.emit({ iter, items: result });
193
+ } catch (err) {
194
+ cancelled = true;
195
+ actions.down([[ERROR, err]]);
196
+ }
197
+ return void 0;
198
+ },
199
+ { describeKind: "producer" }
200
+ );
201
+ },
202
+ { name: "candidates" }
203
+ );
204
+ this.add(candidatesNode, { name: "candidates" });
205
+ const candidatesItemsNode = createNode(
206
+ [candidatesNode],
207
+ (batchData, actions, ctx) => {
208
+ const data = batchData.map(
209
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
210
+ );
211
+ const env = data[0];
212
+ if (env === void 0) {
213
+ actions.down([[RESOLVED]]);
214
+ return;
215
+ }
216
+ actions.emit(env.items);
217
+ },
218
+ { name: "candidates-items", describeKind: "derived" }
219
+ );
220
+ this.add(candidatesItemsNode, { name: "candidates-items" });
221
+ const errorWatcher = createNode(
222
+ [candidatesNode],
223
+ (_batchData, _actions, ctx) => {
224
+ const terminal = ctx.terminalDeps[0];
225
+ if (terminal !== void 0 && terminal !== true) {
226
+ statusState.emit("errored");
227
+ }
228
+ },
229
+ { name: "error-watcher", describeKind: "effect", errorWhenDepsError: false }
230
+ );
231
+ this.add(errorWatcher, { name: "error-watcher" });
232
+ this.addDisposer(errorWatcher.subscribe(() => void 0));
233
+ const generateEventNode = createNode(
234
+ [candidatesNode],
235
+ (batchData, actions, ctx) => {
236
+ const data = batchData.map(
237
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
238
+ );
239
+ const env = data[0];
240
+ actions.emit({
241
+ iteration: env.iter,
242
+ candidates: env.items,
243
+ timestamp_ns: monotonicNs()
244
+ });
245
+ },
246
+ { name: "generate-event", describeKind: "derived" }
247
+ );
248
+ this.add(generateEventNode, { name: "generate-event" });
249
+ this.addDisposer(generateEventNode.subscribe(() => void 0));
250
+ const generatePublishEffect = createNode(
251
+ [generateEventNode],
252
+ (batchData, _actions, ctx) => {
253
+ const data = batchData.map(
254
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
255
+ );
256
+ hubGenerateTopic.publish(data[0]);
257
+ },
258
+ { name: "generate-publish", describeKind: "effect" }
259
+ );
260
+ this.add(generatePublishEffect, { name: "generate-publish" });
261
+ this.addDisposer(generatePublishEffect.subscribe(() => void 0));
262
+ const generateMirrorEffect = createNode(
263
+ [candidatesNode],
264
+ (batchData, _actions, ctx) => {
265
+ const data = batchData.map(
266
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
267
+ );
268
+ const env = data[0];
269
+ prevCandidatesState.emit(env.items);
270
+ },
271
+ { name: "generate-mirror", describeKind: "effect" }
272
+ );
273
+ this.add(generateMirrorEffect, { name: "generate-mirror" });
274
+ this.addDisposer(generateMirrorEffect.subscribe(() => void 0));
275
+ const scoresNode = evaluator(candidatesItemsNode, datasetNode);
276
+ this.add(scoresNode, { name: "scores" });
277
+ const evaluateEventNode = createNode(
278
+ [scoresNode, candidatesNode],
279
+ (batchData, actions, ctx) => {
280
+ const scoresFired = batchData[0] != null && batchData[0].length > 0;
281
+ if (!scoresFired) {
282
+ actions.down([[RESOLVED]]);
283
+ return;
284
+ }
285
+ const data = batchData.map(
286
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
287
+ );
288
+ const scores = data[0];
289
+ const env = data[1];
290
+ actions.emit({
291
+ iteration: env.iter,
292
+ candidates: env.items,
293
+ scores,
294
+ timestamp_ns: monotonicNs()
295
+ });
296
+ },
297
+ { name: "evaluate-event", describeKind: "derived" }
298
+ );
299
+ this.add(evaluateEventNode, { name: "evaluate-event" });
300
+ this.addDisposer(evaluateEventNode.subscribe(() => void 0));
301
+ const evaluatePublishEffect = createNode(
302
+ [evaluateEventNode],
303
+ (batchData, _actions, ctx) => {
304
+ const data = batchData.map(
305
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
306
+ );
307
+ hubEvaluateTopic.publish(data[0]);
308
+ },
309
+ { name: "evaluate-publish", describeKind: "effect" }
310
+ );
311
+ this.add(evaluatePublishEffect, { name: "evaluate-publish" });
312
+ this.addDisposer(evaluatePublishEffect.subscribe(() => void 0));
313
+ const feedbackEnvelopeNode = createNode(
314
+ [scoresNode, candidatesNode],
315
+ (batchData, actions, ctx) => {
316
+ const scoresFired = batchData[0] != null && batchData[0].length > 0;
317
+ if (!scoresFired) {
318
+ actions.down([[RESOLVED]]);
319
+ return;
320
+ }
321
+ const data = batchData.map(
322
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
323
+ );
324
+ const scores = data[0];
325
+ const env = data[1];
326
+ actions.emit({
327
+ iter: env.iter,
328
+ items: env.items,
329
+ scores,
330
+ feedback: latestStrategy.analyze(scores, env.items)
331
+ });
332
+ },
333
+ { name: "feedback-envelope", describeKind: "derived" }
334
+ );
335
+ this.add(feedbackEnvelopeNode, { name: "feedback-envelope" });
336
+ const feedbackNode = createNode(
337
+ [feedbackEnvelopeNode],
338
+ (batchData, actions, ctx) => {
339
+ const data = batchData.map(
340
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
341
+ );
342
+ const fbEnv = data[0];
343
+ actions.emit(fbEnv.feedback);
344
+ },
345
+ { name: "feedback", describeKind: "derived" }
346
+ );
347
+ this.add(feedbackNode, { name: "feedback" });
348
+ const analyzeEventNode = createNode(
349
+ [feedbackEnvelopeNode],
350
+ (batchData, actions, ctx) => {
351
+ const data = batchData.map(
352
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
353
+ );
354
+ const fbEnv = data[0];
355
+ actions.emit({
356
+ iteration: fbEnv.iter,
357
+ candidates: fbEnv.items,
358
+ feedback: fbEnv.feedback,
359
+ timestamp_ns: monotonicNs()
360
+ });
361
+ },
362
+ { name: "analyze-event", describeKind: "derived" }
363
+ );
364
+ this.add(analyzeEventNode, { name: "analyze-event" });
365
+ this.addDisposer(analyzeEventNode.subscribe(() => void 0));
366
+ const analyzePublishEffect = createNode(
367
+ [analyzeEventNode],
368
+ (batchData, _actions, ctx) => {
369
+ const data = batchData.map(
370
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
371
+ );
372
+ hubAnalyzeTopic.publish(data[0]);
373
+ },
374
+ { name: "analyze-publish", describeKind: "effect" }
375
+ );
376
+ this.add(analyzePublishEffect, { name: "analyze-publish" });
377
+ this.addDisposer(analyzePublishEffect.subscribe(() => void 0));
378
+ const patienceNode = createNode(
379
+ [historyState],
380
+ (batchData, actions, ctx) => {
381
+ const data = batchData.map(
382
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
383
+ );
384
+ const h = data[0];
385
+ if (opts.patience == null || h.length <= opts.patience) {
386
+ actions.emit(false);
387
+ return;
388
+ }
389
+ const lookback = h.slice(-(opts.patience + 1));
390
+ const baseline = lookback[0].bestScore;
391
+ actions.emit(lookback.slice(1).every((i) => i.bestScore <= baseline));
392
+ },
393
+ { name: "patience-check", describeKind: "derived" }
394
+ );
395
+ this.add(patienceNode, { name: "patience-check" });
396
+ const minScoreNode = createNode(
397
+ [scoreState],
398
+ (batchData, actions, ctx) => {
399
+ const data = batchData.map(
400
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
401
+ );
402
+ actions.emit(opts.minScore != null && data[0] >= opts.minScore);
403
+ },
404
+ { name: "min-score-check", describeKind: "derived" }
405
+ );
406
+ this.add(minScoreNode, { name: "min-score-check" });
407
+ const minDeltaNode = createNode(
408
+ [historyState],
409
+ (batchData, actions, ctx) => {
410
+ const data = batchData.map(
411
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
412
+ );
413
+ const h = data[0];
414
+ if (opts.minDelta == null || h.length < 2) {
415
+ actions.emit(false);
416
+ return;
417
+ }
418
+ const prev = h[h.length - 2].bestScore;
419
+ const curr = h[h.length - 1].bestScore;
420
+ actions.emit(Math.abs(curr - prev) < opts.minDelta);
421
+ },
422
+ { name: "min-delta-check", describeKind: "derived" }
423
+ );
424
+ this.add(minDeltaNode, { name: "min-delta-check" });
425
+ const maxEvalsNode = createNode(
426
+ [budgetState],
427
+ (batchData, actions, ctx) => {
428
+ const data = batchData.map(
429
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
430
+ );
431
+ actions.emit(opts.maxEvaluations != null && data[0] >= opts.maxEvaluations);
432
+ },
433
+ { name: "max-evaluations-check", describeKind: "derived" }
434
+ );
435
+ this.add(maxEvalsNode, { name: "max-evaluations-check" });
436
+ const maxIterNode = createNode(
437
+ [iterationTrigger],
438
+ (batchData, actions, ctx) => {
439
+ const data = batchData.map(
440
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
441
+ );
442
+ actions.emit(opts.maxIterations != null && data[0] >= opts.maxIterations);
443
+ },
444
+ { name: "max-iterations-check", describeKind: "derived" }
445
+ );
446
+ this.add(maxIterNode, { name: "max-iterations-check" });
447
+ const budgetExhaustedNode = createNode(
448
+ [budgetState],
449
+ (batchData, actions, ctx) => {
450
+ const data = batchData.map(
451
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
452
+ );
453
+ actions.emit(opts.budget != null && data[0] >= opts.budget);
454
+ },
455
+ { name: "budget-exhausted-check", describeKind: "derived" }
456
+ );
457
+ this.add(budgetExhaustedNode, { name: "budget-exhausted-check" });
458
+ this.addDisposer(patienceNode.subscribe(() => void 0));
459
+ this.addDisposer(minScoreNode.subscribe(() => void 0));
460
+ this.addDisposer(minDeltaNode.subscribe(() => void 0));
461
+ this.addDisposer(maxEvalsNode.subscribe(() => void 0));
462
+ this.addDisposer(maxIterNode.subscribe(() => void 0));
463
+ this.addDisposer(budgetExhaustedNode.subscribe(() => void 0));
464
+ const convergedNode = createNode(
465
+ [patienceNode, minScoreNode, minDeltaNode, maxEvalsNode, maxIterNode],
466
+ (batchData, actions, ctx) => {
467
+ const data = batchData.map(
468
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
469
+ );
470
+ const [p, ms, md, me, mi] = data;
471
+ if (p) {
472
+ actions.emit({ converged: true, reason: "patience" });
473
+ return;
474
+ }
475
+ if (ms) {
476
+ actions.emit({ converged: true, reason: "min-score" });
477
+ return;
478
+ }
479
+ if (md) {
480
+ actions.emit({ converged: true, reason: "min-delta" });
481
+ return;
482
+ }
483
+ if (me) {
484
+ actions.emit({ converged: true, reason: "max-evaluations" });
485
+ return;
486
+ }
487
+ if (mi) {
488
+ actions.emit({ converged: true, reason: "max-iterations" });
489
+ return;
490
+ }
491
+ actions.emit({ converged: false });
492
+ },
493
+ { name: "converged", describeKind: "derived" }
494
+ );
495
+ this.add(convergedNode, { name: "converged" });
496
+ this.addDisposer(convergedNode.subscribe(() => void 0));
497
+ let lastDecidedIteration = -1;
498
+ const decideEffect = createNode(
499
+ [feedbackEnvelopeNode, pauseState],
500
+ (batchData, _actions, ctx) => {
501
+ const feedbackFired = batchData[0] != null && batchData[0].length > 0;
502
+ if (!feedbackFired) return;
503
+ const data = batchData.map(
504
+ (batch3, i2) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i2]
505
+ );
506
+ const fbEnv = data[0];
507
+ const paused = data[1];
508
+ const i = fbEnv.iter;
509
+ const fb = fbEnv.feedback;
510
+ const cs = fbEnv.items;
511
+ const scores = fbEnv.scores;
512
+ if (i <= lastDecidedIteration) return;
513
+ lastDecidedIteration = i;
514
+ const currentHistory = historyState.cache;
515
+ const currentBudget = budgetState.cache;
516
+ const { best, bestScore } = pickBest(cs, scores);
517
+ const iteration = {
518
+ n: i,
519
+ candidates: cs,
520
+ scores,
521
+ feedback: fb,
522
+ best,
523
+ bestScore,
524
+ timestamp_ns: monotonicNs()
525
+ };
526
+ const nextHistory = [...currentHistory, iteration];
527
+ const nextBudget = currentBudget + cs.length;
528
+ let decision = "continue";
529
+ let reason;
530
+ const budgetOut = opts.budget != null && nextBudget >= opts.budget;
531
+ if (budgetOut) {
532
+ decision = "budget";
533
+ reason = "budget";
534
+ } else if (opts.minScore != null && fb.score >= opts.minScore) {
535
+ decision = "converged";
536
+ reason = "min-score";
537
+ } else if (opts.maxIterations != null && i >= opts.maxIterations) {
538
+ decision = "converged";
539
+ reason = "max-iterations";
540
+ } else if (opts.maxEvaluations != null && nextBudget >= opts.maxEvaluations) {
541
+ decision = "converged";
542
+ reason = "max-evaluations";
543
+ } else if (opts.minDelta != null && nextHistory.length >= 2) {
544
+ const prev = nextHistory[nextHistory.length - 2].bestScore;
545
+ const curr = nextHistory[nextHistory.length - 1].bestScore;
546
+ if (Math.abs(curr - prev) < opts.minDelta) {
547
+ decision = "converged";
548
+ reason = "min-delta";
549
+ }
550
+ } else if (opts.patience != null && nextHistory.length > opts.patience) {
551
+ const lookback = nextHistory.slice(-(opts.patience + 1));
552
+ const baseline = lookback[0].bestScore;
553
+ if (lookback.slice(1).every((it) => it.bestScore <= baseline)) {
554
+ decision = "converged";
555
+ reason = "patience";
556
+ }
557
+ }
558
+ if (decision === "continue" && paused) {
559
+ decision = "paused";
560
+ }
561
+ batch(() => {
562
+ bestState.emit(best);
563
+ scoreState.emit(fb.score);
564
+ historyState.emit(nextHistory);
565
+ budgetState.emit(nextBudget);
566
+ lastFeedbackState.emit(fb);
567
+ hubDecideTopic.publish({
568
+ iteration: i,
569
+ decision,
570
+ reason,
571
+ timestamp_ns: monotonicNs()
572
+ });
573
+ if (decision === "continue") {
574
+ iterationTrigger.emit(i + 1);
575
+ } else {
576
+ statusState.emit(
577
+ decision === "converged" ? "converged" : decision === "budget" ? "budget" : "paused"
578
+ );
579
+ }
580
+ });
581
+ },
582
+ { name: "decide-bridge", describeKind: "effect" }
583
+ );
584
+ this.add(decideEffect, { name: "decide-bridge" });
585
+ this.addDisposer(decideEffect.subscribe(() => void 0));
586
+ }
587
+ /** Swap the active strategy mid-run (human-in-the-loop handoff). */
588
+ setStrategy(next) {
589
+ this.strategy.emit(next);
590
+ }
591
+ /** Pause after the current iteration completes. */
592
+ pause() {
593
+ this._pauseState.emit(true);
594
+ }
595
+ /**
596
+ * Resume a paused loop. Idempotent: only un-pauses from the "paused"
597
+ * terminal state. Converged / budget / errored are permanent — a user
598
+ * wanting to start over should construct a fresh refineLoop.
599
+ */
600
+ resume() {
601
+ if (this.status.cache !== "paused") return;
602
+ batch(() => {
603
+ this._pauseState.emit(false);
604
+ this.status.emit("running");
605
+ this._iteration.emit(this._iteration.cache + 1);
606
+ });
607
+ }
608
+ };
609
+ function isNode(x) {
610
+ if (typeof x !== "object" || x === null) return false;
611
+ const obj = x;
612
+ return typeof obj.subscribe === "function" && typeof obj.down === "function" && typeof obj.emit === "function";
613
+ }
614
+ function pickBest(candidates, scores) {
615
+ if (candidates.length === 0) {
616
+ return { best: null, bestScore: Number.NEGATIVE_INFINITY };
617
+ }
618
+ if (candidates.length === 1) {
619
+ const mean = meanScore(scores);
620
+ return { best: candidates[0], bestScore: mean };
621
+ }
622
+ const hasFanOut = scores.some((s) => typeof s.candidateIndex === "number");
623
+ if (hasFanOut) {
624
+ const sums = new Array(candidates.length);
625
+ for (let i = 0; i < candidates.length; i++) sums[i] = { sum: 0, count: 0 };
626
+ for (const s of scores) {
627
+ const idx = s.candidateIndex;
628
+ if (typeof idx === "number" && idx >= 0 && idx < candidates.length) {
629
+ sums[idx].sum += s.score;
630
+ sums[idx].count += 1;
631
+ }
632
+ }
633
+ let best2 = candidates[0];
634
+ let bestScore2 = sums[0].count > 0 ? sums[0].sum / sums[0].count : Number.NEGATIVE_INFINITY;
635
+ for (let i = 1; i < candidates.length; i++) {
636
+ const avg = sums[i].count > 0 ? sums[i].sum / sums[i].count : Number.NEGATIVE_INFINITY;
637
+ if (avg > bestScore2) {
638
+ bestScore2 = avg;
639
+ best2 = candidates[i];
640
+ }
641
+ }
642
+ return { best: best2, bestScore: bestScore2 };
643
+ }
644
+ let best = candidates[0];
645
+ let bestScore = scores[0]?.score ?? Number.NEGATIVE_INFINITY;
646
+ for (let i = 1; i < candidates.length; i++) {
647
+ const s = scores[i]?.score ?? Number.NEGATIVE_INFINITY;
648
+ if (s > bestScore) {
649
+ bestScore = s;
650
+ best = candidates[i];
651
+ }
652
+ }
653
+ return { best, bestScore };
654
+ }
655
+ function meanScore(scores) {
656
+ if (scores.length === 0) return Number.NEGATIVE_INFINITY;
657
+ let sum = 0;
658
+ for (const s of scores) sum += s.score;
659
+ return sum / scores.length;
660
+ }
661
+ function refineLoop(seed, evaluator, initialStrategy, opts) {
662
+ return new RefineLoopGraph(seed, evaluator, initialStrategy, opts);
663
+ }
664
+ function blindVariation(opts) {
665
+ const width = opts.width ?? 4;
666
+ const name = opts.name ?? "blindVariation";
667
+ return {
668
+ name,
669
+ seed(seed) {
670
+ return [seed];
671
+ },
672
+ analyze(scores, _candidates) {
673
+ const score = meanScore(scores);
674
+ let worst = null;
675
+ for (const s of scores) {
676
+ if (!worst || s.score < worst.score) worst = s;
677
+ }
678
+ return {
679
+ summary: `blindVariation iteration: mean=${score.toFixed(3)}, n=${scores.length}`,
680
+ score,
681
+ weakTasks: worst ? [worst.taskId] : []
682
+ };
683
+ },
684
+ async generate(_feedback, candidates) {
685
+ if (candidates.length === 0) {
686
+ throw new Error(
687
+ "blindVariation.generate: empty candidate batch \u2014 cannot derive prior for teacher"
688
+ );
689
+ }
690
+ const prior = candidates[candidates.length - 1];
691
+ let iterCost = 0;
692
+ const reportCost = (n) => {
693
+ iterCost += n;
694
+ };
695
+ const ctx = { prior, reportCost };
696
+ try {
697
+ if (opts.parallel !== false) {
698
+ return await Promise.all(Array.from({ length: width }, () => opts.teacher(ctx)));
699
+ }
700
+ const out = [];
701
+ for (let i = 0; i < width; i++) {
702
+ out.push(await opts.teacher(ctx));
703
+ }
704
+ return out;
705
+ } finally {
706
+ if (opts.tokens != null && iterCost > 0) {
707
+ tryIncrementBounded(opts.tokens, Number.MAX_SAFE_INTEGER, iterCost);
708
+ }
709
+ }
710
+ }
711
+ };
712
+ }
713
+ function isErrorCritiquePrivate(v) {
714
+ return typeof v === "object" && v !== null && v.kind === "errorCritique";
715
+ }
716
+ function defaultFormatCritique(failures, feedback) {
717
+ if (failures.length === 0) {
718
+ return `No task scored below the batch mean (${feedback.score.toFixed(3)}). Reinforce the current direction.`;
719
+ }
720
+ const lines = failures.map((f) => {
721
+ const err = f.error != null ? ` | error: ${f.error}` : "";
722
+ return `- ${f.taskId} (score=${f.score.toFixed(3)})${err}`;
723
+ });
724
+ return `Failures below threshold:
725
+ ${lines.join("\n")}`;
726
+ }
727
+ function errorCritique(opts) {
728
+ const width = opts.width ?? 4;
729
+ const name = opts.name ?? "errorCritique";
730
+ const maxFailureSamples = opts.maxFailureSamples ?? 5;
731
+ const format = opts.formatCritique ?? defaultFormatCritique;
732
+ return {
733
+ name,
734
+ seed(seed) {
735
+ return [seed];
736
+ },
737
+ analyze(scores, candidates) {
738
+ const score = meanScore(scores);
739
+ const userThreshold = typeof opts.failureThreshold === "function" ? opts.failureThreshold(scores) : opts.failureThreshold;
740
+ const thresholdUnresolvable = userThreshold === void 0 && !Number.isFinite(score);
741
+ const threshold = userThreshold ?? score;
742
+ const allFailures = thresholdUnresolvable ? [...scores].sort((a, b) => a.score - b.score) : scores.filter((s) => s.score < threshold).slice().sort((a, b) => a.score - b.score);
743
+ const failures = allFailures.slice(0, maxFailureSamples);
744
+ const { best, bestScore } = pickBest(candidates, scores);
745
+ const feedbackShell = {
746
+ summary: "",
747
+ score,
748
+ weakTasks: failures.map((f) => f.taskId)
749
+ };
750
+ const critiqueText = format(failures, feedbackShell);
751
+ const priv = {
752
+ kind: "errorCritique",
753
+ best,
754
+ failures,
755
+ critiqueText
756
+ };
757
+ const retainedSuffix = allFailures.length > failures.length ? ` (top ${failures.length} retained)` : "";
758
+ return {
759
+ summary: `errorCritique iteration: mean=${score.toFixed(3)}, failures=${allFailures.length}${retainedSuffix}/${scores.length}, bestScore=${bestScore.toFixed(3)}`,
760
+ critique: priv,
761
+ weakTasks: failures.map((f) => f.taskId),
762
+ score
763
+ };
764
+ },
765
+ async generate(feedback, candidates) {
766
+ if (candidates.length === 0) {
767
+ throw new Error(
768
+ "errorCritique.generate: empty candidate batch \u2014 cannot derive prior for teacher"
769
+ );
770
+ }
771
+ const priv = isErrorCritiquePrivate(feedback.critique) ? feedback.critique : void 0;
772
+ const prior = priv !== void 0 ? priv.best : candidates[candidates.length - 1];
773
+ const critique = priv?.critiqueText ?? feedback.summary;
774
+ const failures = priv?.failures ?? [];
775
+ let iterCost = 0;
776
+ const reportCost = (n) => {
777
+ iterCost += n;
778
+ };
779
+ const ctx = { prior, critique, failures, reportCost };
780
+ try {
781
+ if (opts.parallel !== false) {
782
+ return await Promise.all(Array.from({ length: width }, () => opts.teacher(ctx)));
783
+ }
784
+ const out = [];
785
+ for (let i = 0; i < width; i++) {
786
+ out.push(await opts.teacher(ctx));
787
+ }
788
+ return out;
789
+ } finally {
790
+ if (opts.tokens != null && iterCost > 0) {
791
+ tryIncrementBounded(opts.tokens, Number.MAX_SAFE_INTEGER, iterCost);
792
+ }
793
+ }
794
+ }
795
+ };
796
+ }
797
+
798
+ // src/presets/harness/harness-loop.ts
799
+ import { monotonicNs as monotonicNs2, node, placeholderArgs as placeholderArgs2 } from "@graphrefly/pure-ts/core";
800
+ import { merge, withLatestFrom } from "@graphrefly/pure-ts/extra";
801
+ import { Graph as Graph2 } from "@graphrefly/pure-ts/graph";
802
+
803
+ // src/utils/harness/_internal.ts
804
+ function trackingKey(item) {
805
+ return item.relatedTo?.[0] ?? item.summary;
806
+ }
807
+
808
+ // src/presets/harness/harness-loop.ts
809
+ var TOPIC_INTAKE = "intake";
810
+ var TOPIC_TRIAGE_OUTPUT = "triage-output";
811
+ var TOPIC_RETRY = "retry";
812
+ var TOPIC_VERIFY_RESULTS = "verify-results";
813
+ var TOPIC_UNROUTED = "__unrouted";
814
+ function defaultLlmExecutor(adapter, prompt) {
815
+ const promptFn = resolvePromptFn(
816
+ prompt,
817
+ DEFAULT_EXECUTE_PROMPT,
818
+ (tpl, item) => tpl.replace("{{item}}", JSON.stringify(item))
819
+ );
820
+ return (job, opts) => {
821
+ const item = job.payload.item;
822
+ const messages = [{ role: "user", content: promptFn(item) }];
823
+ const failurePayload = (detail) => ({
824
+ ...job.payload,
825
+ execution: { item, outcome: "failure", detail }
826
+ });
827
+ const formatErr = (err) => err instanceof Error ? err.message : String(err);
828
+ return _oneShotLlmCall(adapter, messages, {
829
+ parentSignal: opts?.signal,
830
+ onSuccess: (resp) => {
831
+ let parsed;
832
+ try {
833
+ parsed = JSON.parse(stripFences(String(resp.content)));
834
+ } catch (err) {
835
+ return failurePayload(`execute parse error: ${formatErr(err)}`);
836
+ }
837
+ if (parsed == null || typeof parsed !== "object" || Array.isArray(parsed)) {
838
+ return failurePayload(
839
+ `execute parse error: non-object response: ${JSON.stringify(parsed)}`
840
+ );
841
+ }
842
+ const obj = parsed;
843
+ return {
844
+ ...job.payload,
845
+ execution: {
846
+ item,
847
+ outcome: obj.outcome ?? "failure",
848
+ detail: obj.detail ?? "unknown",
849
+ artifact: obj.artifact
850
+ }
851
+ };
852
+ },
853
+ onFailure: (kind, err) => {
854
+ if (kind === "complete") {
855
+ return failurePayload("adapter completed without emitting DATA");
856
+ }
857
+ return failurePayload(`executor failed: ${formatErr(err)}`);
858
+ }
859
+ });
860
+ };
861
+ }
862
+ function defaultLlmVerifier(adapter, prompt) {
863
+ const promptFn = resolvePromptFn(
864
+ prompt,
865
+ DEFAULT_VERIFY_PROMPT,
866
+ (tpl, pair) => {
867
+ const [execution, item] = pair;
868
+ return tpl.replace("{{execution}}", JSON.stringify(execution)).replace("{{item}}", JSON.stringify(item));
869
+ }
870
+ );
871
+ return (job, opts) => {
872
+ const { item, execution } = job.payload;
873
+ if (execution == null) {
874
+ return {
875
+ ...job.payload,
876
+ verify: {
877
+ verified: false,
878
+ findings: ["verifier: prior execute stage produced no execution"],
879
+ errorClass: "structural"
880
+ }
881
+ };
882
+ }
883
+ const messages = [
884
+ { role: "user", content: promptFn([execution, item]) }
885
+ ];
886
+ const failurePayload = (finding) => ({
887
+ ...job.payload,
888
+ verify: {
889
+ verified: false,
890
+ findings: [finding],
891
+ errorClass: "self-correctable"
892
+ }
893
+ });
894
+ const formatErr = (err) => err instanceof Error ? err.message : String(err);
895
+ return _oneShotLlmCall(adapter, messages, {
896
+ parentSignal: opts?.signal,
897
+ onSuccess: (resp) => {
898
+ let parsed;
899
+ try {
900
+ parsed = JSON.parse(stripFences(String(resp.content)));
901
+ } catch (err) {
902
+ return failurePayload(`verify parse error: ${formatErr(err)}`);
903
+ }
904
+ if (parsed == null || typeof parsed !== "object" || Array.isArray(parsed)) {
905
+ return failurePayload(
906
+ `verify parse error: non-object response: ${JSON.stringify(parsed)}`
907
+ );
908
+ }
909
+ const obj = parsed;
910
+ return {
911
+ ...job.payload,
912
+ verify: {
913
+ verified: obj.verified === true,
914
+ findings: obj.findings ?? [],
915
+ errorClass: obj.errorClass
916
+ }
917
+ };
918
+ },
919
+ onFailure: (kind, err) => {
920
+ if (kind === "complete") {
921
+ return failurePayload("verifier completed without emitting DATA");
922
+ }
923
+ return failurePayload(`verifier failed: ${formatErr(err)}`);
924
+ }
925
+ });
926
+ };
927
+ }
928
+ var HarnessGraph = class extends Graph2 {
929
+ /** Messaging hub — the routing-data plane. Queue topics live here. */
930
+ queues;
931
+ /**
932
+ * EXECUTE → VERIFY JobFlow (Tier 6.5 C2). Pumps own claim/ack/nack
933
+ * lifecycle for each stage. Inspect via:
934
+ * - `harness.executeFlow.queue("execute").pending` — pending depth.
935
+ * - `harness.executeFlow.queue("verify").pending` — items mid-execute.
936
+ * - `harness.executeFlow.completed` — verified items waiting for the
937
+ * dispatch effect's 3-way routing.
938
+ * - `harness.executeFlow.completedCount` — total terminal completions.
939
+ */
940
+ executeFlow;
941
+ /**
942
+ * Per-route JobQueueGraph audit mirrors. Each triaged item that reaches
943
+ * a queue is also enqueued here, giving reactive `depth` + `pending` +
944
+ * `jobs` observables per route. The dispatch effect ack/removeBy-id's
945
+ * the matching job on terminal verdict. The executeFlow JobFlow handles
946
+ * the EXECUTE → VERIFY data flow; this is a parallel audit-side ledger
947
+ * for per-route depth metrics. Inspect via
948
+ * `harness.jobs.get(route).depth.cache` for backpressure metrics.
949
+ */
950
+ jobs;
951
+ /** Per-route gate controllers (only for gated queues). */
952
+ gates;
953
+ /**
954
+ * Per-route queue topics — typed accessor for the four
955
+ * {@link QUEUE_NAMES} entries (`auto-fix`, `needs-decision`,
956
+ * `investigation`, `backlog`). Mirrors the `gates` / `jobs` map
957
+ * shape so callers can iterate `[route, topic]` pairs without
958
+ * hand-rolling `harness.queues.topicNames()` + meta-topic exclusion.
959
+ *
960
+ * Excludes the meta topics that share the hub:
961
+ * `intake` (use {@link intake}), `verify-results` (use
962
+ * {@link verifyResults}), `retry` (use {@link retry}), `__unrouted`
963
+ * (use {@link unrouted}), and the internal `triage-output` fan-in.
964
+ */
965
+ queueTopics;
966
+ /** Strategy model — `auditedSuccessTracker` keyed by `StrategyKey`. */
967
+ strategy;
968
+ /** Global retry count across all items (circuit breaker). Reactive — subscribable. */
969
+ totalRetries;
970
+ /** Global reingestion count across all items (circuit breaker). Reactive — subscribable. */
971
+ totalReingestions;
972
+ /**
973
+ * Per-route priority score nodes, populated only when `opts.priority` is
974
+ * set on {@link harnessLoop}. Each node emits a score combining severity,
975
+ * attention decay, and strategy-model effectiveness for the route's
976
+ * current head-of-queue item. `undefined` means the caller did not opt
977
+ * in to priority scoring.
978
+ */
979
+ priorityScores;
980
+ /**
981
+ * REFLECT-stage tick marker — emits one DATA per terminal verdict observed
982
+ * on `executeFlow.completed`. `equals: () => false` so each completion
983
+ * produces an observable tick (no Object.is collapse on identical
984
+ * `null` payloads). Inspection tools (`harnessTrace`, dashboards) can
985
+ * subscribe directly here instead of resolving by string path
986
+ * (`harness.node("reflect")`) — the field is the lock against rename
987
+ * drift.
988
+ */
989
+ reflect;
990
+ constructor(name, queues, executeFlow, queueTopics, jobs, gates, strategy, totalRetries, totalReingestions, reflect, priorityScores) {
991
+ super(name);
992
+ this.queues = queues;
993
+ this.executeFlow = executeFlow;
994
+ this.queueTopics = queueTopics;
995
+ this.jobs = jobs;
996
+ this.gates = gates;
997
+ this.strategy = strategy;
998
+ this.totalRetries = totalRetries;
999
+ this.totalReingestions = totalReingestions;
1000
+ this.reflect = reflect;
1001
+ this.priorityScores = priorityScores;
1002
+ }
1003
+ /** Intake topic — publish items here to enter the loop. */
1004
+ get intake() {
1005
+ return this.queues.topic(TOPIC_INTAKE);
1006
+ }
1007
+ /** Verify results topic — subscribe to see verification outcomes. */
1008
+ get verifyResults() {
1009
+ return this.queues.topic(TOPIC_VERIFY_RESULTS);
1010
+ }
1011
+ /** Retry feedback topic — fast-retry re-entry point. */
1012
+ get retry() {
1013
+ return this.queues.topic(TOPIC_RETRY);
1014
+ }
1015
+ /** Dead-letter topic for items whose LLM-chosen route is unknown. */
1016
+ get unrouted() {
1017
+ return this.queues.topic(TOPIC_UNROUTED);
1018
+ }
1019
+ /**
1020
+ * Stage-label → observe-path map for the 7 pipeline stages.
1021
+ *
1022
+ * Decouples inspection tools (`harnessTrace`, `harnessProfile`, custom
1023
+ * dashboards) from mount-structure churn: hub migration, future stage
1024
+ * splits, gate remounting, or the Tier 6.5 C2 JobFlow rewire shouldn't
1025
+ * require edits to `trace.ts` as long as this method stays accurate.
1026
+ *
1027
+ * Each stage yields `{ label, paths }`; consumers iterate paths per
1028
+ * stage and attach observers. Tier 6.5: EXECUTE / VERIFY paths now
1029
+ * resolve to the `executeFlow` stage queues + the `verify-dispatch`
1030
+ * effect node.
1031
+ */
1032
+ stageNodes() {
1033
+ const hub = this.queues;
1034
+ const resolveHubPath = (name) => hub.has(name) ? `queues::${name}::latest` : null;
1035
+ const includeIf = (value) => value == null ? [] : [value];
1036
+ const queuePaths = QUEUE_NAMES.flatMap((r) => includeIf(resolveHubPath(r)));
1037
+ const gatePaths = [];
1038
+ for (const [route] of this.gates) {
1039
+ gatePaths.push(`gates::${route}/gate`);
1040
+ }
1041
+ return [
1042
+ { label: "INTAKE", paths: includeIf(resolveHubPath("intake")) },
1043
+ { label: "TRIAGE", paths: ["triage"] },
1044
+ { label: "QUEUE", paths: queuePaths },
1045
+ { label: "GATE", paths: gatePaths },
1046
+ { label: "EXECUTE", paths: ["executeFlow::execute::events"] },
1047
+ { label: "VERIFY", paths: ["executeFlow::verify::events"] },
1048
+ { label: "REFLECT", paths: ["reflect"] },
1049
+ { label: "STRATEGY", paths: ["strategy::entries"] }
1050
+ ];
1051
+ }
1052
+ };
1053
+ function harnessLoop(name, opts) {
1054
+ const adapter = opts.adapter;
1055
+ const maxRetries = opts.maxRetries ?? 2;
1056
+ const retainedLimit = opts.retainedLimit ?? 1e3;
1057
+ const errorClassifier = opts.errorClassifier ?? defaultErrorClassifier;
1058
+ const queueConfigs = /* @__PURE__ */ new Map();
1059
+ for (const route of QUEUE_NAMES) {
1060
+ queueConfigs.set(route, {
1061
+ ...DEFAULT_QUEUE_CONFIGS[route],
1062
+ ...opts.queues?.[route]
1063
+ });
1064
+ }
1065
+ const queuesHub = messagingHub(`${name}/queues`, {
1066
+ defaultTopicOptions: { retainedLimit }
1067
+ });
1068
+ const intake = queuesHub.topic(TOPIC_INTAKE);
1069
+ const triageOutput = queuesHub.topic(TOPIC_TRIAGE_OUTPUT);
1070
+ const retryTopic = queuesHub.topic(TOPIC_RETRY);
1071
+ const verifyResults = queuesHub.topic(TOPIC_VERIFY_RESULTS);
1072
+ const queueTopics = /* @__PURE__ */ new Map();
1073
+ for (const route of QUEUE_NAMES) {
1074
+ queueTopics.set(route, queuesHub.topic(route));
1075
+ }
1076
+ const unroutedTopic = queuesHub.topic(TOPIC_UNROUTED);
1077
+ const strategy = strategyModel();
1078
+ const triageInput = withLatestFrom(
1079
+ intake.latest,
1080
+ strategy.entries
1081
+ );
1082
+ const triagePromptFn = resolvePromptFn(
1083
+ opts.triagePrompt,
1084
+ DEFAULT_TRIAGE_PROMPT,
1085
+ (tpl, pair) => {
1086
+ const [item, strat] = pair;
1087
+ return tpl.replace("{{strategy}}", JSON.stringify(Array.from(strat.entries()))).replace("{{item}}", JSON.stringify(item));
1088
+ }
1089
+ );
1090
+ const triageNode = promptNode(
1091
+ adapter,
1092
+ [triageInput],
1093
+ (pair) => {
1094
+ const asPair = pair;
1095
+ if (asPair === void 0) return "";
1096
+ return triagePromptFn(asPair);
1097
+ },
1098
+ {
1099
+ name: "triage",
1100
+ format: "json"
1101
+ }
1102
+ );
1103
+ const routerInput = withLatestFrom(triageNode, triageInput);
1104
+ const router = node(
1105
+ [routerInput],
1106
+ (batchData, _actions, ctx) => {
1107
+ const data = batchData.map(
1108
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
1109
+ );
1110
+ const pair = data[0];
1111
+ if (pair == null) return;
1112
+ const [classification, triagePair] = pair;
1113
+ if (!classification?.route) return;
1114
+ const intakeItem = triagePair?.[0];
1115
+ const merged = { ...classification, ...intakeItem };
1116
+ triageOutput.publish(merged);
1117
+ },
1118
+ { describeKind: "effect" }
1119
+ );
1120
+ const routerUnsub = router.subscribe(() => {
1121
+ });
1122
+ const knownRoutes = new Set(QUEUE_NAMES);
1123
+ for (const route of QUEUE_NAMES) {
1124
+ topicBridge(`bridge/${route}`, triageOutput, queueTopics.get(route), {
1125
+ map: (item) => item.route === route ? item : void 0
1126
+ });
1127
+ }
1128
+ topicBridge("bridge/__unrouted", triageOutput, unroutedTopic, {
1129
+ map: (item) => knownRoutes.has(item.route) ? void 0 : item
1130
+ });
1131
+ const jobQueues = /* @__PURE__ */ new Map();
1132
+ const routeJobIds = /* @__PURE__ */ new Map();
1133
+ for (const route of QUEUE_NAMES) {
1134
+ jobQueues.set(route, jobQueue(`jobs/${route}`));
1135
+ }
1136
+ const jobMirrorUnsubs = [];
1137
+ for (const route of QUEUE_NAMES) {
1138
+ const topic2 = queueTopics.get(route);
1139
+ const jq = jobQueues.get(route);
1140
+ const seen = /* @__PURE__ */ new WeakSet();
1141
+ const mirror = node(
1142
+ [topic2.events],
1143
+ (batchData, _actions, ctx) => {
1144
+ const data = batchData.map(
1145
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
1146
+ );
1147
+ const events = data[0];
1148
+ const arr = events ?? [];
1149
+ for (const item of arr) {
1150
+ if (seen.has(item)) continue;
1151
+ seen.add(item);
1152
+ const id = jq.enqueue(item);
1153
+ routeJobIds.set(trackingKey(item), { route, id });
1154
+ }
1155
+ },
1156
+ { name: `jobs/${route}-mirror`, describeKind: "effect" }
1157
+ );
1158
+ jobMirrorUnsubs.push(mirror.subscribe(() => {
1159
+ }));
1160
+ }
1161
+ function ackJob(item) {
1162
+ const key = trackingKey(item);
1163
+ const entry = routeJobIds.get(key);
1164
+ if (!entry) return;
1165
+ jobQueues.get(entry.route)?.removeById(entry.id);
1166
+ routeJobIds.delete(key);
1167
+ }
1168
+ const gateGraph = pipelineGraph("gates");
1169
+ const gateControllers = /* @__PURE__ */ new Map();
1170
+ for (const route of QUEUE_NAMES) {
1171
+ const config = queueConfigs.get(route);
1172
+ if (!config.gated) continue;
1173
+ const topic2 = queueTopics.get(route);
1174
+ const ctrl = gateGraph.approvalGate(
1175
+ `${route}/gate`,
1176
+ topic2.latest,
1177
+ {
1178
+ maxPending: config.maxPending,
1179
+ startOpen: config.startOpen
1180
+ }
1181
+ );
1182
+ gateControllers.set(route, ctrl);
1183
+ }
1184
+ const queueOutputs = [];
1185
+ for (const route of QUEUE_NAMES) {
1186
+ const config = queueConfigs.get(route);
1187
+ if (config.gated && gateControllers.has(route)) {
1188
+ queueOutputs.push(gateControllers.get(route).output);
1189
+ } else {
1190
+ queueOutputs.push(queueTopics.get(route).latest);
1191
+ }
1192
+ }
1193
+ queueOutputs.push(retryTopic.latest);
1194
+ const executeInput = merge(...queueOutputs);
1195
+ const executor = opts.executor ?? defaultLlmExecutor(adapter, opts.executePrompt);
1196
+ const verifier = opts.verifier ?? defaultLlmVerifier(adapter, opts.verifyPrompt);
1197
+ const executeMaxPerPump = opts.executeMaxPerPump ?? Number.MAX_SAFE_INTEGER;
1198
+ const verifyMaxPerPump = opts.verifyMaxPerPump ?? Number.MAX_SAFE_INTEGER;
1199
+ const executeFlow = jobFlow(`${name}/executeFlow`, {
1200
+ stages: [
1201
+ { name: "execute", work: (job) => executor(job), maxPerPump: executeMaxPerPump },
1202
+ { name: "verify", work: (job) => verifier(job), maxPerPump: verifyMaxPerPump }
1203
+ ]
1204
+ });
1205
+ const enqueueEffect = node(
1206
+ [executeInput],
1207
+ (batchData, _actions, ctx) => {
1208
+ const data = batchData.map(
1209
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
1210
+ );
1211
+ const item = data[0];
1212
+ if (item === void 0) return;
1213
+ executeFlow.enqueue({ item });
1214
+ },
1215
+ { name: "execute-enqueue", describeKind: "effect" }
1216
+ );
1217
+ const enqueueUnsub = enqueueEffect.subscribe(() => {
1218
+ });
1219
+ const maxReingestions = opts.maxReingestions ?? 1;
1220
+ const maxTotalRetries = Math.min(opts.maxTotalRetries ?? maxRetries * 10, 100);
1221
+ const maxTotalReingestions = Math.min(opts.maxTotalReingestions ?? maxReingestions * 10, 100);
1222
+ const totalRetries = node([], { initial: 0 });
1223
+ const totalReingestions = node([], { initial: 0 });
1224
+ function assembleResult(execution, verify, item) {
1225
+ return {
1226
+ item,
1227
+ execution,
1228
+ verified: verify.verified,
1229
+ findings: verify.findings ?? [],
1230
+ errorClass: verify.errorClass
1231
+ };
1232
+ }
1233
+ function handleVerified(vr, item) {
1234
+ strategy.record(strategyKey(DEFAULT_PRESET_ID, item.rootCause, item.intervention), true, {
1235
+ presetId: DEFAULT_PRESET_ID,
1236
+ rootCause: item.rootCause,
1237
+ intervention: item.intervention
1238
+ });
1239
+ verifyResults.publish(vr);
1240
+ ackJob(item);
1241
+ }
1242
+ function handleRetry(vr, item) {
1243
+ const key = trackingKey(item);
1244
+ const itemRetries = item.$retries ?? 0;
1245
+ const retryItem = {
1246
+ ...item,
1247
+ $retries: itemRetries + 1,
1248
+ summary: `[RETRY ${itemRetries + 1}/${maxRetries}] ${key} \u2014 Previous attempt failed: ${vr.findings.join("; ")}`,
1249
+ relatedTo: [key]
1250
+ };
1251
+ retryTopic.publish(retryItem);
1252
+ }
1253
+ function handleStructural(vr, item) {
1254
+ strategy.record(strategyKey(DEFAULT_PRESET_ID, item.rootCause, item.intervention), false, {
1255
+ presetId: DEFAULT_PRESET_ID,
1256
+ rootCause: item.rootCause,
1257
+ intervention: item.intervention
1258
+ });
1259
+ verifyResults.publish(vr);
1260
+ ackJob(item);
1261
+ const key = trackingKey(item);
1262
+ const itemReingestions = item.$reingestions ?? 0;
1263
+ if (itemReingestions < maxReingestions && tryIncrementBounded(totalReingestions, maxTotalReingestions)) {
1264
+ intake.publish({
1265
+ source: item.source,
1266
+ summary: `Verification failed for: ${key}`,
1267
+ evidence: vr.findings.join("\n"),
1268
+ affectsAreas: item.affectsAreas,
1269
+ affectsEvalTasks: item.affectsEvalTasks,
1270
+ severity: item.severity ?? "high",
1271
+ relatedTo: [key],
1272
+ $reingestions: itemReingestions + 1
1273
+ });
1274
+ }
1275
+ }
1276
+ let dispatchCursor = 0;
1277
+ const dispatchEffect = node(
1278
+ [executeFlow.completed],
1279
+ (batchData, _actions, ctx) => {
1280
+ const data = batchData.map(
1281
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
1282
+ );
1283
+ const log = data[0];
1284
+ const arr = log ?? [];
1285
+ if (dispatchCursor > arr.length) dispatchCursor = arr.length;
1286
+ const start = dispatchCursor;
1287
+ dispatchCursor = arr.length;
1288
+ for (let i = start; i < arr.length; i++) {
1289
+ const job = arr[i];
1290
+ const { item, execution, verify } = job.payload;
1291
+ if (execution == null || verify == null) {
1292
+ ackJob(item);
1293
+ continue;
1294
+ }
1295
+ const vr = assembleResult(execution, verify, item);
1296
+ if (vr.verified) {
1297
+ handleVerified(vr, item);
1298
+ continue;
1299
+ }
1300
+ const errClass = vr.errorClass ?? errorClassifier({
1301
+ item,
1302
+ outcome: execution.outcome,
1303
+ detail: vr.findings.join("; ")
1304
+ });
1305
+ const itemRetries = item.$retries ?? 0;
1306
+ if (errClass === "self-correctable" && itemRetries < maxRetries && tryIncrementBounded(totalRetries, maxTotalRetries)) {
1307
+ handleRetry(vr, item);
1308
+ } else {
1309
+ handleStructural(vr, item);
1310
+ }
1311
+ }
1312
+ },
1313
+ { name: "verify-dispatch", describeKind: "effect" }
1314
+ );
1315
+ const dispatchUnsub = dispatchEffect.subscribe(() => {
1316
+ });
1317
+ const reflectNode = node(
1318
+ [executeFlow.completed],
1319
+ (_batchData, actions) => {
1320
+ actions.emit(null);
1321
+ },
1322
+ {
1323
+ name: "reflect",
1324
+ equals: () => false
1325
+ }
1326
+ );
1327
+ let priorityScores;
1328
+ if (opts.priority) {
1329
+ priorityScores = buildPriorityScores(queueTopics, strategy, opts);
1330
+ }
1331
+ const harness = new HarnessGraph(
1332
+ name,
1333
+ queuesHub,
1334
+ executeFlow,
1335
+ queueTopics,
1336
+ jobQueues,
1337
+ gateControllers,
1338
+ strategy,
1339
+ totalRetries,
1340
+ totalReingestions,
1341
+ reflectNode,
1342
+ priorityScores
1343
+ );
1344
+ harness.addDisposer(routerUnsub);
1345
+ harness.addDisposer(enqueueUnsub);
1346
+ harness.addDisposer(dispatchUnsub);
1347
+ for (const unsub of jobMirrorUnsubs) harness.addDisposer(unsub);
1348
+ harness.add(triageInput, { name: "triage-input" });
1349
+ harness.add(triageNode, { name: "triage" });
1350
+ harness.add(routerInput, { name: "router-input" });
1351
+ harness.add(executeInput, { name: "execute-input" });
1352
+ harness.add(enqueueEffect, { name: "execute-enqueue" });
1353
+ harness.add(dispatchEffect, { name: "verify-dispatch" });
1354
+ harness.add(reflectNode, { name: "reflect" });
1355
+ harness.addDisposer(reflectNode.subscribe(() => void 0));
1356
+ if (priorityScores) {
1357
+ for (const [route, score] of priorityScores) {
1358
+ harness.add(score, { name: `priority/${route}` });
1359
+ harness.addDisposer(score.subscribe(() => {
1360
+ }));
1361
+ }
1362
+ }
1363
+ harness.mount("queues", queuesHub);
1364
+ harness.mount("gates", gateGraph);
1365
+ harness.mount("executeFlow", executeFlow);
1366
+ harness.mount("strategy", strategy);
1367
+ for (const [route, jq] of jobQueues) {
1368
+ harness.mount(`jobs/${route}`, jq);
1369
+ }
1370
+ harness.tagFactory("harnessLoop", placeholderArgs2(opts));
1371
+ return harness;
1372
+ }
1373
+ function buildPriorityScores(queueTopics, strategy, opts) {
1374
+ if (!opts.lastInteractionNs) {
1375
+ throw new Error(
1376
+ "harnessLoop: `opts.priority` requires `opts.lastInteractionNs` \u2014 pass a Node<number> (e.g. `fromTimer(60_000)` or a `state(monotonicNs())` you bump on human interaction). Priority scores only decay when this node settles; an internal default would freeze age at construction time."
1377
+ );
1378
+ }
1379
+ const lastInteractionNs = opts.lastInteractionNs;
1380
+ const signals = opts.priority ?? {};
1381
+ const severityWeights = {
1382
+ ...DEFAULT_SEVERITY_WEIGHTS,
1383
+ ...signals.severityWeights
1384
+ };
1385
+ const decayRate = signals.decayRate ?? DEFAULT_DECAY_RATE;
1386
+ const effectivenessThreshold = signals.effectivenessThreshold ?? 0.7;
1387
+ const effectivenessBoost = signals.effectivenessBoost ?? 15;
1388
+ const scores = /* @__PURE__ */ new Map();
1389
+ for (const [route, topic2] of queueTopics) {
1390
+ const score = node(
1391
+ [
1392
+ topic2.latest,
1393
+ strategy.entries,
1394
+ lastInteractionNs
1395
+ ],
1396
+ (batchData, actions, ctx) => {
1397
+ const vals = batchData.map(
1398
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
1399
+ );
1400
+ const item = vals[0];
1401
+ if (item === void 0) {
1402
+ actions.emit(0);
1403
+ return;
1404
+ }
1405
+ const baseWeight = severityWeights[item.severity ?? "medium"] ?? 40;
1406
+ const ageSeconds = (monotonicNs2() - vals[2]) / 1e9;
1407
+ let s = baseWeight * Math.exp(-decayRate * Math.max(0, ageSeconds));
1408
+ const key = strategyKey(DEFAULT_PRESET_ID, item.rootCause, item.intervention);
1409
+ const strat = vals[1];
1410
+ const entry = strat?.get(key);
1411
+ if (entry && entry.successRate >= effectivenessThreshold) {
1412
+ s += effectivenessBoost;
1413
+ }
1414
+ actions.emit(s);
1415
+ },
1416
+ { name: `priority/${route}`, describeKind: "derived" }
1417
+ );
1418
+ scores.set(route, score);
1419
+ }
1420
+ return scores;
1421
+ }
1422
+
1423
+ // src/presets/harness/spawnable.ts
1424
+ import { batch as batch2, DATA as DATA2, node as node2, wallClockNs } from "@graphrefly/pure-ts/core";
1425
+ import { keepalive } from "@graphrefly/pure-ts/extra";
1426
+ import { Graph as Graph3 } from "@graphrefly/pure-ts/graph";
1427
+ var SpawnableGraph = class extends Graph3 {
1428
+ spawnTopic;
1429
+ rejected;
1430
+ activeSlot;
1431
+ _spawnSub;
1432
+ _registry;
1433
+ _depthCap;
1434
+ _validate;
1435
+ _disposed = false;
1436
+ constructor(opts) {
1437
+ const name = opts.name ?? "spawnable";
1438
+ super(name);
1439
+ this._registry = opts.registry;
1440
+ this._depthCap = opts.depthCap;
1441
+ this._validate = opts.validate;
1442
+ this.spawnTopic = opts.hub.topic(SPAWNS_TOPIC);
1443
+ this.rejected = topic("rejected");
1444
+ this.mount("rejected", this.rejected);
1445
+ const activeSlotNode = node2([], {
1446
+ name: "active-slot",
1447
+ describeKind: "state",
1448
+ meta: aiMeta("spawnable_active_slot"),
1449
+ initial: /* @__PURE__ */ new Map(),
1450
+ equals: () => false
1451
+ });
1452
+ this.add(activeSlotNode, { name: "active-slot" });
1453
+ this.activeSlot = activeSlotNode;
1454
+ this._spawnSub = subscription("spawn-sub", this.spawnTopic, {
1455
+ from: opts.from ?? "now"
1456
+ });
1457
+ this.mount("spawn-sub", this._spawnSub);
1458
+ const subRef = this._spawnSub;
1459
+ const unsub = subRef.available.subscribe((msgs) => {
1460
+ if (this._disposed) return;
1461
+ for (const m of msgs) {
1462
+ if (m[0] !== DATA2) continue;
1463
+ const items = m[1];
1464
+ if (items.length === 0) continue;
1465
+ for (const req of items) {
1466
+ if (this._disposed) return;
1467
+ this._processRequest(req);
1468
+ }
1469
+ subRef.ack(items.length);
1470
+ }
1471
+ });
1472
+ this.addDisposer(unsub);
1473
+ this.addDisposer(() => {
1474
+ this._disposed = true;
1475
+ });
1476
+ this.addDisposer(keepalive(activeSlotNode));
1477
+ }
1478
+ _processRequest(req) {
1479
+ if (this._disposed) return;
1480
+ if (this._validate && !this._validate(req)) {
1481
+ this.rejected.publish({ request: req, reason: "schema validation failed" });
1482
+ return;
1483
+ }
1484
+ if (req.expiresAt != null) {
1485
+ const expiry = Date.parse(req.expiresAt);
1486
+ if (!Number.isFinite(expiry)) {
1487
+ this.rejected.publish({ request: req, reason: "invalid expiresAt" });
1488
+ return;
1489
+ }
1490
+ const nowMs = wallClockNs() / 1e6;
1491
+ if (nowMs >= expiry) {
1492
+ this.rejected.publish({ request: req, reason: "expired" });
1493
+ return;
1494
+ }
1495
+ }
1496
+ const currentMap = this.activeSlot.cache ?? /* @__PURE__ */ new Map();
1497
+ if (this._depthCap != null && currentMap.size >= this._depthCap) {
1498
+ this.rejected.publish({
1499
+ request: req,
1500
+ reason: `depth-cap exceeded (${currentMap.size}/${this._depthCap})`
1501
+ });
1502
+ return;
1503
+ }
1504
+ const spec = this._registry.registry.get(req.payload.presetId);
1505
+ if (!spec) {
1506
+ this.rejected.publish({
1507
+ request: req,
1508
+ reason: `unknown presetId: ${req.payload.presetId}`
1509
+ });
1510
+ return;
1511
+ }
1512
+ const slotName = `spawn-${req.id}`;
1513
+ let bundle;
1514
+ try {
1515
+ bundle = agent(this, { ...spec, name: slotName });
1516
+ } catch (e) {
1517
+ this.rejected.publish({
1518
+ request: req,
1519
+ reason: `agent mint failed: ${e.message ?? "unknown"}`
1520
+ });
1521
+ return;
1522
+ }
1523
+ const updated = new Map(currentMap);
1524
+ updated.set(req.id, bundle);
1525
+ this.activeSlot.emit(updated);
1526
+ let statusUnsub;
1527
+ const onTerminal = (stat) => {
1528
+ if (stat !== "done" && stat !== "error") return;
1529
+ const live = this.activeSlot.cache ?? /* @__PURE__ */ new Map();
1530
+ if (!live.has(req.id)) return;
1531
+ batch2(() => {
1532
+ try {
1533
+ this.remove(slotName);
1534
+ } catch {
1535
+ }
1536
+ const next = new Map(live);
1537
+ next.delete(req.id);
1538
+ this.activeSlot.emit(next);
1539
+ });
1540
+ statusUnsub?.();
1541
+ statusUnsub = void 0;
1542
+ };
1543
+ statusUnsub = bundle.status.subscribe((msgs) => {
1544
+ for (const m of msgs) {
1545
+ if (m[0] === DATA2) onTerminal(m[1]);
1546
+ }
1547
+ });
1548
+ this.addDisposer(() => statusUnsub?.());
1549
+ bundle.in.emit(req.payload.taskInput);
1550
+ }
1551
+ };
1552
+ function spawnable(opts) {
1553
+ const graph = new SpawnableGraph(opts);
1554
+ opts.hub.mount(opts.name ?? "spawnable", graph);
1555
+ return {
1556
+ spawnTopic: graph.spawnTopic,
1557
+ activeSlot: graph.activeSlot,
1558
+ rejected: graph.rejected,
1559
+ graph
1560
+ };
1561
+ }
1562
+
1563
+ export {
1564
+ RefineLoopGraph,
1565
+ refineLoop,
1566
+ blindVariation,
1567
+ errorCritique,
1568
+ defaultLlmExecutor,
1569
+ defaultLlmVerifier,
1570
+ HarnessGraph,
1571
+ harnessLoop,
1572
+ SpawnableGraph,
1573
+ spawnable
1574
+ };
1575
+ //# sourceMappingURL=chunk-GBCENOLN.js.map