@graphrefly/graphrefly 0.45.0 → 0.47.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 (714) hide show
  1. package/README.md +1 -2
  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 +865 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +468 -0
  17. package/dist/base/composition/index.d.ts +468 -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 +6390 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +21 -0
  23. package/dist/base/index.d.ts +21 -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/base/render/index.d.cts +227 -0
  47. package/dist/base/render/index.d.ts +227 -0
  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/base/sources/index.d.cts +357 -0
  65. package/dist/base/sources/index.d.ts +357 -0
  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/base/sources/node/index.d.cts +185 -0
  71. package/dist/base/sources/node/index.d.ts +185 -0
  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-CSSbKGrJ.d.ts +199 -0
  89. package/dist/cascading-baGkiihI.d.cts +199 -0
  90. package/dist/chunk-22SG74BD.js +207 -0
  91. package/dist/chunk-22SG74BD.js.map +1 -0
  92. package/dist/chunk-255UCBG4.js +58 -0
  93. package/dist/chunk-255UCBG4.js.map +1 -0
  94. package/dist/chunk-2LO3EL4W.js +1 -0
  95. package/dist/chunk-2LO3EL4W.js.map +1 -0
  96. package/dist/chunk-2OB3CEJS.js +1065 -0
  97. package/dist/chunk-2OB3CEJS.js.map +1 -0
  98. package/dist/chunk-36NMM65U.js +144 -0
  99. package/dist/chunk-36NMM65U.js.map +1 -0
  100. package/dist/chunk-3CEXCBN6.js +1 -0
  101. package/dist/chunk-3CEXCBN6.js.map +1 -0
  102. package/dist/chunk-3MUSLI6E.js +105 -0
  103. package/dist/chunk-3MUSLI6E.js.map +1 -0
  104. package/dist/chunk-3PSLNJDU.js +884 -0
  105. package/dist/chunk-3PSLNJDU.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-5IMMNARC.js +1153 -0
  115. package/dist/chunk-5IMMNARC.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-EHRRQ4IC.js +211 -0
  145. package/dist/chunk-EHRRQ4IC.js.map +1 -0
  146. package/dist/chunk-EVYY4X5A.js +509 -0
  147. package/dist/chunk-EVYY4X5A.js.map +1 -0
  148. package/dist/chunk-FDFD67UO.js +1 -0
  149. package/dist/chunk-FDFD67UO.js.map +1 -0
  150. package/dist/chunk-FMPF42Q4.js +13 -0
  151. package/dist/chunk-FMPF42Q4.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-GWRNLJNW.js +2508 -0
  155. package/dist/chunk-GWRNLJNW.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-IHTWQEDR.js +169 -0
  159. package/dist/chunk-IHTWQEDR.js.map +1 -0
  160. package/dist/chunk-IJRR6YAI.js +128 -0
  161. package/dist/chunk-IJRR6YAI.js.map +1 -0
  162. package/dist/chunk-JGFRAFDL.js +221 -0
  163. package/dist/chunk-JGFRAFDL.js.map +1 -0
  164. package/dist/chunk-JKTC747G.js +725 -0
  165. package/dist/chunk-JKTC747G.js.map +1 -0
  166. package/dist/chunk-KN3H5CNT.js +11 -0
  167. package/dist/chunk-KN3H5CNT.js.map +1 -0
  168. package/dist/chunk-KPG3DGLA.js +1 -0
  169. package/dist/chunk-KPG3DGLA.js.map +1 -0
  170. package/dist/chunk-KRNQ6RGQ.js +1 -0
  171. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  172. package/dist/chunk-MLTPJMH6.js +417 -0
  173. package/dist/chunk-MLTPJMH6.js.map +1 -0
  174. package/dist/chunk-N3SZ7BMH.js +95 -0
  175. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  176. package/dist/chunk-NDUD3IMO.js +540 -0
  177. package/dist/chunk-NDUD3IMO.js.map +1 -0
  178. package/dist/chunk-NY2PYHNC.js +873 -0
  179. package/dist/chunk-NY2PYHNC.js.map +1 -0
  180. package/dist/chunk-O3MT7DYI.js +225 -0
  181. package/dist/chunk-O3MT7DYI.js.map +1 -0
  182. package/dist/chunk-OCUDSN63.js +2386 -0
  183. package/dist/chunk-OCUDSN63.js.map +1 -0
  184. package/dist/chunk-OIWU3NYV.js +199 -0
  185. package/dist/chunk-OIWU3NYV.js.map +1 -0
  186. package/dist/chunk-OQUIJT7A.js +1 -0
  187. package/dist/chunk-OQUIJT7A.js.map +1 -0
  188. package/dist/chunk-P5LBT622.js +105 -0
  189. package/dist/chunk-P5LBT622.js.map +1 -0
  190. package/dist/chunk-PKGQG5QQ.js +519 -0
  191. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  192. package/dist/chunk-PKPO3JTZ.js +561 -0
  193. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  194. package/dist/chunk-PL5UDIQ5.js +118 -0
  195. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  196. package/dist/chunk-PZWISPIQ.js +432 -0
  197. package/dist/chunk-PZWISPIQ.js.map +1 -0
  198. package/dist/chunk-Q3EYOCZB.js +510 -0
  199. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  200. package/dist/chunk-QMBYUVRL.js +15 -0
  201. package/dist/chunk-QMBYUVRL.js.map +1 -0
  202. package/dist/chunk-RAGGHLCV.js +200 -0
  203. package/dist/chunk-RAGGHLCV.js.map +1 -0
  204. package/dist/chunk-RJOG4IJU.js +1039 -0
  205. package/dist/chunk-RJOG4IJU.js.map +1 -0
  206. package/dist/chunk-SOOKUYVM.js +403 -0
  207. package/dist/chunk-SOOKUYVM.js.map +1 -0
  208. package/dist/chunk-T5BN5KG7.js +1 -0
  209. package/dist/chunk-T5BN5KG7.js.map +1 -0
  210. package/dist/chunk-TNX5ZGDJ.js +574 -0
  211. package/dist/chunk-TNX5ZGDJ.js.map +1 -0
  212. package/dist/chunk-TP7244Y6.js +207 -0
  213. package/dist/chunk-TP7244Y6.js.map +1 -0
  214. package/dist/chunk-TSBFTJKM.js +57 -0
  215. package/dist/chunk-TSBFTJKM.js.map +1 -0
  216. package/dist/chunk-URQ2CBBF.js +143 -0
  217. package/dist/chunk-URQ2CBBF.js.map +1 -0
  218. package/dist/chunk-VLAGJZSL.js +1079 -0
  219. package/dist/chunk-VLAGJZSL.js.map +1 -0
  220. package/dist/chunk-W2BOPXTI.js +1 -0
  221. package/dist/chunk-W2BOPXTI.js.map +1 -0
  222. package/dist/chunk-Y52CS6YA.js +88 -0
  223. package/dist/chunk-Y52CS6YA.js.map +1 -0
  224. package/dist/chunk-YCBUWK77.js +92 -0
  225. package/dist/chunk-YCBUWK77.js.map +1 -0
  226. package/dist/chunk-YJ4U2D2C.js +314 -0
  227. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  228. package/dist/chunk-Z4YXAUDN.js +239 -0
  229. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  230. package/dist/chunk-Z65DVDEQ.js +146 -0
  231. package/dist/chunk-Z65DVDEQ.js.map +1 -0
  232. package/dist/chunk-Z6EGP5D7.js +92 -0
  233. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  234. package/dist/chunk-ZT4WMQW4.js +1575 -0
  235. package/dist/chunk-ZT4WMQW4.js.map +1 -0
  236. package/dist/chunk-ZVXXDWIB.js +1282 -0
  237. package/dist/chunk-ZVXXDWIB.js.map +1 -0
  238. package/dist/compat/index.cjs +3150 -6
  239. package/dist/compat/index.cjs.map +1 -1
  240. package/dist/compat/index.d.cts +116 -1
  241. package/dist/compat/index.d.ts +116 -1
  242. package/dist/compat/index.js +175 -2
  243. package/dist/compat/index.js.map +1 -1
  244. package/dist/compat/jotai/index.cjs +130 -2
  245. package/dist/compat/jotai/index.cjs.map +1 -1
  246. package/dist/compat/jotai/index.d.cts +2 -1
  247. package/dist/compat/jotai/index.d.ts +2 -1
  248. package/dist/compat/jotai/index.js +7 -2
  249. package/dist/compat/jotai/index.js.map +1 -1
  250. package/dist/compat/nanostores/index.cjs +186 -2
  251. package/dist/compat/nanostores/index.cjs.map +1 -1
  252. package/dist/compat/nanostores/index.d.cts +2 -1
  253. package/dist/compat/nanostores/index.d.ts +2 -1
  254. package/dist/compat/nanostores/index.js +21 -2
  255. package/dist/compat/nanostores/index.js.map +1 -1
  256. package/dist/compat/nestjs/index.cjs +2291 -6
  257. package/dist/compat/nestjs/index.cjs.map +1 -1
  258. package/dist/compat/nestjs/index.d.cts +10 -1
  259. package/dist/compat/nestjs/index.d.ts +10 -1
  260. package/dist/compat/nestjs/index.js +76 -2
  261. package/dist/compat/nestjs/index.js.map +1 -1
  262. package/dist/compat/react/index.cjs +95 -2
  263. package/dist/compat/react/index.cjs.map +1 -1
  264. package/dist/compat/react/index.d.cts +2 -1
  265. package/dist/compat/react/index.d.ts +2 -1
  266. package/dist/compat/react/index.js +11 -2
  267. package/dist/compat/react/index.js.map +1 -1
  268. package/dist/compat/solid/index.cjs +82 -2
  269. package/dist/compat/solid/index.cjs.map +1 -1
  270. package/dist/compat/solid/index.d.cts +2 -1
  271. package/dist/compat/solid/index.d.ts +2 -1
  272. package/dist/compat/solid/index.js +11 -2
  273. package/dist/compat/solid/index.js.map +1 -1
  274. package/dist/compat/svelte/index.cjs +85 -2
  275. package/dist/compat/svelte/index.cjs.map +1 -1
  276. package/dist/compat/svelte/index.d.cts +2 -1
  277. package/dist/compat/svelte/index.d.ts +2 -1
  278. package/dist/compat/svelte/index.js +11 -2
  279. package/dist/compat/svelte/index.js.map +1 -1
  280. package/dist/compat/vue/index.cjs +100 -2
  281. package/dist/compat/vue/index.cjs.map +1 -1
  282. package/dist/compat/vue/index.d.cts +3 -1
  283. package/dist/compat/vue/index.d.ts +3 -1
  284. package/dist/compat/vue/index.js +11 -2
  285. package/dist/compat/vue/index.js.map +1 -1
  286. package/dist/compat/zustand/index.cjs +50 -2
  287. package/dist/compat/zustand/index.cjs.map +1 -1
  288. package/dist/compat/zustand/index.d.cts +2 -1
  289. package/dist/compat/zustand/index.d.ts +2 -1
  290. package/dist/compat/zustand/index.js +7 -2
  291. package/dist/compat/zustand/index.js.map +1 -1
  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-Bx46zqky.d.cts +243 -0
  297. package/dist/fallback-pIWW8A2d.d.ts +243 -0
  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-B6pxYJzO.d.cts +36 -0
  301. package/dist/index-B6pxYJzO.d.ts +36 -0
  302. package/dist/index-BFsng6v1.d.cts +44 -0
  303. package/dist/index-BFsng6v1.d.ts +44 -0
  304. package/dist/index-B_p8tnvf.d.cts +770 -0
  305. package/dist/index-Bg-LwEt-.d.cts +45 -0
  306. package/dist/index-Bg-LwEt-.d.ts +45 -0
  307. package/dist/index-Brp888t0.d.cts +127 -0
  308. package/dist/index-Brp888t0.d.ts +127 -0
  309. package/dist/index-CDfk6jHN.d.cts +37 -0
  310. package/dist/index-CDfk6jHN.d.ts +37 -0
  311. package/dist/index-DLAxYaN5.d.cts +169 -0
  312. package/dist/index-DLAxYaN5.d.ts +169 -0
  313. package/dist/index-DeWbQzMe.d.cts +34 -0
  314. package/dist/index-DeWbQzMe.d.ts +34 -0
  315. package/dist/index-_HDSmPyp.d.ts +770 -0
  316. package/dist/index-dX9IzPqj.d.cts +86 -0
  317. package/dist/index-dX9IzPqj.d.ts +86 -0
  318. package/dist/index.cjs +26009 -0
  319. package/dist/index.cjs.map +1 -1
  320. package/dist/index.d.cts +55 -42
  321. package/dist/index.d.ts +55 -42
  322. package/dist/index.js +849 -0
  323. package/dist/index.js.map +1 -1
  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-B25XqCbZ.d.cts +59 -0
  329. package/dist/observable-B25XqCbZ.d.ts +59 -0
  330. package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
  331. package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
  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-fswlBUvX.d.cts +195 -0
  365. package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
  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-BB5Lw-pB.d.cts +442 -0
  381. package/dist/types-BB5Lw-pB.d.ts +442 -0
  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/utils/ai/browser.d.cts +129 -0
  387. package/dist/utils/ai/browser.d.ts +129 -0
  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/utils/ai/index.d.cts +1777 -0
  393. package/dist/utils/ai/index.d.ts +1777 -0
  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/utils/ai/node.d.cts +57 -0
  399. package/dist/utils/ai/node.d.ts +57 -0
  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/utils/cqrs/index.d.cts +438 -0
  405. package/dist/utils/cqrs/index.d.ts +438 -0
  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/utils/demo-shell/index.d.cts +90 -0
  411. package/dist/utils/demo-shell/index.d.ts +90 -0
  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/utils/domain-templates/index.d.cts +214 -0
  417. package/dist/utils/domain-templates/index.d.ts +214 -0
  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/utils/graphspec/index.d.cts +449 -0
  423. package/dist/utils/graphspec/index.d.ts +449 -0
  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 +17614 -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/utils/job-queue/index.d.cts +200 -0
  447. package/dist/utils/job-queue/index.d.ts +200 -0
  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 +1456 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/utils/memory/index.d.cts +660 -0
  453. package/dist/utils/memory/index.d.ts +660 -0
  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/utils/process/index.d.cts +411 -0
  471. package/dist/utils/process/index.d.ts +411 -0
  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/utils/reactive-layout/index.d.cts +492 -0
  477. package/dist/utils/reactive-layout/index.d.ts +492 -0
  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/utils/reduction/index.d.cts +102 -0
  483. package/dist/utils/reduction/index.d.ts +102 -0
  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/utils/surface/index.d.cts +240 -0
  495. package/dist/utils/surface/index.d.ts +240 -0
  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 +293 -241
  505. package/dist/core/index.cjs +0 -21
  506. package/dist/core/index.cjs.map +0 -1
  507. package/dist/core/index.d.cts +0 -1
  508. package/dist/core/index.d.ts +0 -1
  509. package/dist/core/index.js +0 -3
  510. package/dist/core/index.js.map +0 -1
  511. package/dist/extra/browser.cjs +0 -21
  512. package/dist/extra/browser.cjs.map +0 -1
  513. package/dist/extra/browser.d.cts +0 -1
  514. package/dist/extra/browser.d.ts +0 -1
  515. package/dist/extra/browser.js +0 -3
  516. package/dist/extra/browser.js.map +0 -1
  517. package/dist/extra/index.cjs +0 -21
  518. package/dist/extra/index.cjs.map +0 -1
  519. package/dist/extra/index.d.cts +0 -1
  520. package/dist/extra/index.d.ts +0 -1
  521. package/dist/extra/index.js +0 -3
  522. package/dist/extra/index.js.map +0 -1
  523. package/dist/extra/node.cjs +0 -21
  524. package/dist/extra/node.cjs.map +0 -1
  525. package/dist/extra/node.d.cts +0 -1
  526. package/dist/extra/node.d.ts +0 -1
  527. package/dist/extra/node.js +0 -3
  528. package/dist/extra/node.js.map +0 -1
  529. package/dist/extra/operators.cjs +0 -21
  530. package/dist/extra/operators.cjs.map +0 -1
  531. package/dist/extra/operators.d.cts +0 -1
  532. package/dist/extra/operators.d.ts +0 -1
  533. package/dist/extra/operators.js +0 -3
  534. package/dist/extra/operators.js.map +0 -1
  535. package/dist/extra/reactive.cjs +0 -21
  536. package/dist/extra/reactive.cjs.map +0 -1
  537. package/dist/extra/reactive.d.cts +0 -1
  538. package/dist/extra/reactive.d.ts +0 -1
  539. package/dist/extra/reactive.js +0 -3
  540. package/dist/extra/reactive.js.map +0 -1
  541. package/dist/extra/render/index.cjs +0 -21
  542. package/dist/extra/render/index.cjs.map +0 -1
  543. package/dist/extra/render/index.d.cts +0 -1
  544. package/dist/extra/render/index.d.ts +0 -1
  545. package/dist/extra/render/index.js +0 -3
  546. package/dist/extra/render/index.js.map +0 -1
  547. package/dist/extra/sources.cjs +0 -21
  548. package/dist/extra/sources.cjs.map +0 -1
  549. package/dist/extra/sources.d.cts +0 -1
  550. package/dist/extra/sources.d.ts +0 -1
  551. package/dist/extra/sources.js +0 -3
  552. package/dist/extra/sources.js.map +0 -1
  553. package/dist/extra/storage-browser.cjs +0 -21
  554. package/dist/extra/storage-browser.cjs.map +0 -1
  555. package/dist/extra/storage-browser.d.cts +0 -1
  556. package/dist/extra/storage-browser.d.ts +0 -1
  557. package/dist/extra/storage-browser.js +0 -3
  558. package/dist/extra/storage-browser.js.map +0 -1
  559. package/dist/extra/storage-core.cjs +0 -21
  560. package/dist/extra/storage-core.cjs.map +0 -1
  561. package/dist/extra/storage-core.d.cts +0 -1
  562. package/dist/extra/storage-core.d.ts +0 -1
  563. package/dist/extra/storage-core.js +0 -3
  564. package/dist/extra/storage-core.js.map +0 -1
  565. package/dist/extra/storage-node.cjs +0 -21
  566. package/dist/extra/storage-node.cjs.map +0 -1
  567. package/dist/extra/storage-node.d.cts +0 -1
  568. package/dist/extra/storage-node.d.ts +0 -1
  569. package/dist/extra/storage-node.js +0 -3
  570. package/dist/extra/storage-node.js.map +0 -1
  571. package/dist/extra/storage-tiers-browser.cjs +0 -21
  572. package/dist/extra/storage-tiers-browser.cjs.map +0 -1
  573. package/dist/extra/storage-tiers-browser.d.cts +0 -1
  574. package/dist/extra/storage-tiers-browser.d.ts +0 -1
  575. package/dist/extra/storage-tiers-browser.js +0 -3
  576. package/dist/extra/storage-tiers-browser.js.map +0 -1
  577. package/dist/extra/storage-tiers-node.cjs +0 -21
  578. package/dist/extra/storage-tiers-node.cjs.map +0 -1
  579. package/dist/extra/storage-tiers-node.d.cts +0 -1
  580. package/dist/extra/storage-tiers-node.d.ts +0 -1
  581. package/dist/extra/storage-tiers-node.js +0 -3
  582. package/dist/extra/storage-tiers-node.js.map +0 -1
  583. package/dist/extra/storage-tiers.cjs +0 -21
  584. package/dist/extra/storage-tiers.cjs.map +0 -1
  585. package/dist/extra/storage-tiers.d.cts +0 -1
  586. package/dist/extra/storage-tiers.d.ts +0 -1
  587. package/dist/extra/storage-tiers.js +0 -3
  588. package/dist/extra/storage-tiers.js.map +0 -1
  589. package/dist/extra/storage-wal.cjs +0 -21
  590. package/dist/extra/storage-wal.cjs.map +0 -1
  591. package/dist/extra/storage-wal.d.cts +0 -1
  592. package/dist/extra/storage-wal.d.ts +0 -1
  593. package/dist/extra/storage-wal.js +0 -3
  594. package/dist/extra/storage-wal.js.map +0 -1
  595. package/dist/graph/index.cjs +0 -21
  596. package/dist/graph/index.cjs.map +0 -1
  597. package/dist/graph/index.d.cts +0 -1
  598. package/dist/graph/index.d.ts +0 -1
  599. package/dist/graph/index.js +0 -3
  600. package/dist/graph/index.js.map +0 -1
  601. package/dist/patterns/ai/browser.cjs +0 -21
  602. package/dist/patterns/ai/browser.cjs.map +0 -1
  603. package/dist/patterns/ai/browser.d.cts +0 -1
  604. package/dist/patterns/ai/browser.d.ts +0 -1
  605. package/dist/patterns/ai/browser.js +0 -3
  606. package/dist/patterns/ai/browser.js.map +0 -1
  607. package/dist/patterns/ai/index.cjs +0 -21
  608. package/dist/patterns/ai/index.cjs.map +0 -1
  609. package/dist/patterns/ai/index.d.cts +0 -1
  610. package/dist/patterns/ai/index.d.ts +0 -1
  611. package/dist/patterns/ai/index.js +0 -3
  612. package/dist/patterns/ai/index.js.map +0 -1
  613. package/dist/patterns/ai/node.cjs +0 -21
  614. package/dist/patterns/ai/node.cjs.map +0 -1
  615. package/dist/patterns/ai/node.d.cts +0 -1
  616. package/dist/patterns/ai/node.d.ts +0 -1
  617. package/dist/patterns/ai/node.js +0 -3
  618. package/dist/patterns/ai/node.js.map +0 -1
  619. package/dist/patterns/cqrs/index.cjs +0 -21
  620. package/dist/patterns/cqrs/index.cjs.map +0 -1
  621. package/dist/patterns/cqrs/index.d.cts +0 -1
  622. package/dist/patterns/cqrs/index.d.ts +0 -1
  623. package/dist/patterns/cqrs/index.js +0 -3
  624. package/dist/patterns/cqrs/index.js.map +0 -1
  625. package/dist/patterns/demo-shell/index.cjs +0 -21
  626. package/dist/patterns/demo-shell/index.cjs.map +0 -1
  627. package/dist/patterns/demo-shell/index.d.cts +0 -1
  628. package/dist/patterns/demo-shell/index.d.ts +0 -1
  629. package/dist/patterns/demo-shell/index.js +0 -3
  630. package/dist/patterns/demo-shell/index.js.map +0 -1
  631. package/dist/patterns/domain-templates/index.cjs +0 -21
  632. package/dist/patterns/domain-templates/index.cjs.map +0 -1
  633. package/dist/patterns/domain-templates/index.d.cts +0 -1
  634. package/dist/patterns/domain-templates/index.d.ts +0 -1
  635. package/dist/patterns/domain-templates/index.js +0 -3
  636. package/dist/patterns/domain-templates/index.js.map +0 -1
  637. package/dist/patterns/graphspec/index.cjs +0 -21
  638. package/dist/patterns/graphspec/index.cjs.map +0 -1
  639. package/dist/patterns/graphspec/index.d.cts +0 -1
  640. package/dist/patterns/graphspec/index.d.ts +0 -1
  641. package/dist/patterns/graphspec/index.js +0 -3
  642. package/dist/patterns/graphspec/index.js.map +0 -1
  643. package/dist/patterns/harness/index.cjs +0 -21
  644. package/dist/patterns/harness/index.cjs.map +0 -1
  645. package/dist/patterns/harness/index.d.cts +0 -1
  646. package/dist/patterns/harness/index.d.ts +0 -1
  647. package/dist/patterns/harness/index.js +0 -3
  648. package/dist/patterns/harness/index.js.map +0 -1
  649. package/dist/patterns/inspect/index.cjs +0 -21
  650. package/dist/patterns/inspect/index.cjs.map +0 -1
  651. package/dist/patterns/inspect/index.d.cts +0 -1
  652. package/dist/patterns/inspect/index.d.ts +0 -1
  653. package/dist/patterns/inspect/index.js +0 -3
  654. package/dist/patterns/inspect/index.js.map +0 -1
  655. package/dist/patterns/job-queue/index.cjs +0 -21
  656. package/dist/patterns/job-queue/index.cjs.map +0 -1
  657. package/dist/patterns/job-queue/index.d.cts +0 -1
  658. package/dist/patterns/job-queue/index.d.ts +0 -1
  659. package/dist/patterns/job-queue/index.js +0 -3
  660. package/dist/patterns/job-queue/index.js.map +0 -1
  661. package/dist/patterns/memory/index.cjs +0 -21
  662. package/dist/patterns/memory/index.cjs.map +0 -1
  663. package/dist/patterns/memory/index.d.cts +0 -1
  664. package/dist/patterns/memory/index.d.ts +0 -1
  665. package/dist/patterns/memory/index.js +0 -3
  666. package/dist/patterns/memory/index.js.map +0 -1
  667. package/dist/patterns/messaging/index.cjs +0 -21
  668. package/dist/patterns/messaging/index.cjs.map +0 -1
  669. package/dist/patterns/messaging/index.d.cts +0 -1
  670. package/dist/patterns/messaging/index.d.ts +0 -1
  671. package/dist/patterns/messaging/index.js +0 -3
  672. package/dist/patterns/messaging/index.js.map +0 -1
  673. package/dist/patterns/orchestration/index.cjs +0 -21
  674. package/dist/patterns/orchestration/index.cjs.map +0 -1
  675. package/dist/patterns/orchestration/index.d.cts +0 -1
  676. package/dist/patterns/orchestration/index.d.ts +0 -1
  677. package/dist/patterns/orchestration/index.js +0 -3
  678. package/dist/patterns/orchestration/index.js.map +0 -1
  679. package/dist/patterns/process/index.cjs +0 -21
  680. package/dist/patterns/process/index.cjs.map +0 -1
  681. package/dist/patterns/process/index.d.cts +0 -1
  682. package/dist/patterns/process/index.d.ts +0 -1
  683. package/dist/patterns/process/index.js +0 -3
  684. package/dist/patterns/process/index.js.map +0 -1
  685. package/dist/patterns/reactive-layout/index.cjs +0 -21
  686. package/dist/patterns/reactive-layout/index.cjs.map +0 -1
  687. package/dist/patterns/reactive-layout/index.d.cts +0 -1
  688. package/dist/patterns/reactive-layout/index.d.ts +0 -1
  689. package/dist/patterns/reactive-layout/index.js +0 -3
  690. package/dist/patterns/reactive-layout/index.js.map +0 -1
  691. package/dist/patterns/reduction/index.cjs +0 -21
  692. package/dist/patterns/reduction/index.cjs.map +0 -1
  693. package/dist/patterns/reduction/index.d.cts +0 -1
  694. package/dist/patterns/reduction/index.d.ts +0 -1
  695. package/dist/patterns/reduction/index.js +0 -3
  696. package/dist/patterns/reduction/index.js.map +0 -1
  697. package/dist/patterns/surface/index.cjs +0 -21
  698. package/dist/patterns/surface/index.cjs.map +0 -1
  699. package/dist/patterns/surface/index.d.cts +0 -1
  700. package/dist/patterns/surface/index.d.ts +0 -1
  701. package/dist/patterns/surface/index.js +0 -3
  702. package/dist/patterns/surface/index.js.map +0 -1
  703. package/dist/patterns/topology-view/index.cjs +0 -21
  704. package/dist/patterns/topology-view/index.cjs.map +0 -1
  705. package/dist/patterns/topology-view/index.d.cts +0 -1
  706. package/dist/patterns/topology-view/index.d.ts +0 -1
  707. package/dist/patterns/topology-view/index.js +0 -3
  708. package/dist/patterns/topology-view/index.js.map +0 -1
  709. package/dist/testing/index.cjs +0 -21
  710. package/dist/testing/index.cjs.map +0 -1
  711. package/dist/testing/index.d.cts +0 -1
  712. package/dist/testing/index.d.ts +0 -1
  713. package/dist/testing/index.js +0 -3
  714. package/dist/testing/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/harness/actuator-executor.ts","../src/utils/harness/auto-solidify.ts","../src/utils/harness/bridge.ts"],"sourcesContent":["/**\n * actuatorExecutor — bridge a side-effecting actuator into the harness\n * EXECUTE work fn.\n *\n * `refineExecutor` covers the artifact-typed case (refine a candidate\n * `T` against an evaluator); `actuatorExecutor` covers the side-effecting\n * case (write a catalog entry, mutate a template registry, edit a doc on\n * disk). The user's `apply` callback owns the side effect; the executor\n * wraps it in the per-claim lifecycle:\n *\n * 1. **One DATA per claim.** The producer captures the first DATA from\n * the bridged `apply` result, emits a {@link HarnessJobPayload} with\n * `execution` filled in, and completes. Subsequent inner DATAs are\n * ignored.\n * 2. **Cancel-on-teardown.** When the JobFlow pump unsubscribes (after\n * capturing first DATA, or on graph teardown), the producer's cleanup\n * fires `ac.abort()` which propagates into `apply`'s `signal`.\n * 3. **Errors surfaced as failure payload.** A thrown / ERROR result is\n * mapped via `onError` into a `failure`-outcome `ExecuteOutput` so the\n * dispatch effect can route the item rather than silently dropping it.\n *\n * **What `apply` may return.** Anything `fromAny` accepts: `Promise<R>`,\n * `Node<R>`, `AsyncIterable<R>`, `Iterable<R>`, or a synchronous `R`.\n * `Promise<R>` is the typical shape (`writeFile`, `fetch`, `db.execute`).\n *\n * **Pairing with `evalVerifier`.** `ExecuteOutput.artifact` is set to\n * the actuation record; an `evalVerifier<R>` whose `extractArtifact`\n * returns the record (or the post-apply world state) closes EXECUTE →\n * VERIFY with consistent typing end-to-end.\n *\n * @module\n */\n\nimport { COMPLETE, DATA, ERROR, type Messages, type Node, node } from \"@graphrefly/pure-ts/core\";\nimport { fromAny, type NodeInput } from \"@graphrefly/pure-ts/extra\";\nimport type { JobEnvelope } from \"../job-queue/index.js\";\n\nimport type { ExecuteOutput, HarnessExecutor, HarnessJobPayload, TriagedItem } from \"./types.js\";\n\n/**\n * What an actuator's `apply` may return. Mirrors `NodeInput<R>` plus a\n * raw `R` for synchronous side effects.\n */\nexport type ActuatorResult<R> = NodeInput<R>;\n\n/** Configuration for {@link actuatorExecutor}. */\nexport interface ActuatorExecutorConfig<R> {\n\t/**\n\t * Apply the side effect for this triaged item. Receives the abort\n\t * signal — actuators that own real I/O should thread `signal` into\n\t * `fetch`, `fs.writeFile`, child-process kills, etc. so that the\n\t * pump's teardown actually cancels in-flight work.\n\t *\n\t * The first DATA emitted by the bridged result wins; later DATAs are\n\t * discarded. ERROR (or a synchronous throw) is mapped via `onError`.\n\t */\n\tapply: (item: TriagedItem, opts: { signal: AbortSignal }) => ActuatorResult<R>;\n\n\t/**\n\t * Optional gate — when provided and returning `false`, the actuator\n\t * is skipped and the executor emits an `ExecuteOutput` with\n\t * `outcome: \"failure\"`. Use to route interventions the actuator can't\n\t * handle into the failure path.\n\t */\n\tshouldApply?: (item: TriagedItem) => boolean;\n\n\t/** Detail string for the skip path. Default: includes intervention name. */\n\tskipDetail?: (item: TriagedItem) => string;\n\n\t/**\n\t * Map a successfully-applied actuation record into an `ExecuteOutput<R>`.\n\t */\n\ttoOutput?: (record: R, item: TriagedItem) => ExecuteOutput<R>;\n\n\t/**\n\t * Map a thrown / ERROR result into an `ExecuteOutput<R>`.\n\t */\n\tonError?: (err: unknown, item: TriagedItem) => ExecuteOutput<R>;\n\n\t/** Node name prefix for `describe()` introspection. */\n\tname?: string;\n}\n\nfunction defaultToOutput<R>(record: R, item: TriagedItem): ExecuteOutput<R> {\n\treturn {\n\t\toutcome: \"success\",\n\t\tdetail: `actuator applied ${item.intervention} for ${truncate(item.summary)}`,\n\t\tartifact: record,\n\t};\n}\n\nfunction defaultOnError<R>(err: unknown, item: TriagedItem): ExecuteOutput<R> {\n\tconst message = err instanceof Error ? err.message : String(err);\n\treturn {\n\t\toutcome: \"failure\",\n\t\tdetail: `actuator threw on ${item.intervention}: ${message}`,\n\t};\n}\n\nfunction defaultSkipDetail(item: TriagedItem): string {\n\treturn `actuator skipped ${item.intervention} (shouldApply returned false)`;\n}\n\nfunction truncate(s: string, max = 80): string {\n\treturn s.length <= max ? s : `${s.slice(0, max - 1)}…`;\n}\n\n/**\n * Build a {@link HarnessExecutor} backed by a side-effecting actuator.\n *\n * @example File-system actuator that writes a catalog entry and emits the diff.\n * ```ts\n * const harness = harnessLoop(\"repair\", {\n * adapter,\n * executor: actuatorExecutor<CatalogPatch>({\n * async apply(item, { signal }) {\n * const patch = patchFromItem(item);\n * await fs.writeFile(patch.path, patch.contents, { signal });\n * return patch;\n * },\n * shouldApply: (item) => item.intervention === \"catalog-fn\",\n * }),\n * verifier: evalVerifier<CatalogPatch>({ ... }),\n * });\n * ```\n */\nexport function actuatorExecutor<R>(config: ActuatorExecutorConfig<R>): HarnessExecutor<R> {\n\tconst name = config.name ?? \"actuator-executor\";\n\tconst toOutput = config.toOutput ?? defaultToOutput<R>;\n\tconst onError = config.onError ?? defaultOnError<R>;\n\tconst skipDetail = config.skipDetail ?? defaultSkipDetail;\n\n\treturn (job: JobEnvelope<HarnessJobPayload<R>>, opts) => {\n\t\tconst item = job.payload.item;\n\n\t\tif (config.shouldApply && !config.shouldApply(item)) {\n\t\t\t// Synchronous failure payload — return as a plain object;\n\t\t\t// `fromAny` accepts the bare value and emits one DATA.\n\t\t\treturn {\n\t\t\t\t...job.payload,\n\t\t\t\texecution: { item, outcome: \"failure\", detail: skipDetail(item) },\n\t\t\t} satisfies HarnessJobPayload<R>;\n\t\t}\n\n\t\treturn node<HarnessJobPayload<R>>(\n\t\t\t[],\n\t\t\t(_data, actions) => {\n\t\t\t\tconst ac = new AbortController();\n\t\t\t\t// Link pump-supplied signal (Tier 6.5 2.5b): parent abort\n\t\t\t\t// (e.g. `harness.destroy()`) cascades into the inner AC and\n\t\t\t\t// thus into `apply(item, { signal })` + `fromAny({ signal })`.\n\t\t\t\tconst parentSignal = opts?.signal;\n\t\t\t\tlet unlinkParent: () => void = () => undefined;\n\t\t\t\tif (parentSignal) {\n\t\t\t\t\tif (parentSignal.aborted) {\n\t\t\t\t\t\tac.abort();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst onParentAbort = (): void => ac.abort();\n\t\t\t\t\t\tparentSignal.addEventListener(\"abort\", onParentAbort, { once: true });\n\t\t\t\t\t\tunlinkParent = () => parentSignal.removeEventListener(\"abort\", onParentAbort);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlet captured = false;\n\t\t\t\tlet unsub: (() => void) | null = null;\n\t\t\t\tconst emitOnce = (out: ExecuteOutput<R>): void => {\n\t\t\t\t\tif (captured) return;\n\t\t\t\t\tcaptured = true;\n\t\t\t\t\tactions.down([\n\t\t\t\t\t\t[DATA, { ...job.payload, execution: { item, ...out } }],\n\t\t\t\t\t\t[COMPLETE],\n\t\t\t\t\t] satisfies Messages);\n\t\t\t\t\tunsub?.();\n\t\t\t\t\tunsub = null;\n\t\t\t\t};\n\t\t\t\tlet inner: Node<R>;\n\t\t\t\ttry {\n\t\t\t\t\tconst rawResult = config.apply(item, { signal: ac.signal });\n\t\t\t\t\tinner = fromAny<R>(rawResult, { signal: ac.signal });\n\t\t\t\t} catch (err) {\n\t\t\t\t\temitOnce(onError(err, item));\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tunlinkParent();\n\t\t\t\t\t\tac.abort();\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tunsub = inner.subscribe((batch) => {\n\t\t\t\t\tfor (const m of batch) {\n\t\t\t\t\t\tif (captured) return;\n\t\t\t\t\t\tif (m[0] === DATA) {\n\t\t\t\t\t\t\temitOnce(toOutput(m[1] as R, item));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (m[0] === ERROR) {\n\t\t\t\t\t\t\temitOnce(onError(m[1], item));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (m[0] === COMPLETE) {\n\t\t\t\t\t\t\temitOnce(onError(new Error(\"actuator inner completed without emitting DATA\"), item));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t// Sync DATA delivery (cached state / `fromAny` over a sync value):\n\t\t\t\t// the callback ran reentrantly before `unsub` was assigned, so\n\t\t\t\t// `emitOnce`'s `unsub?.()` was a no-op. Drop the upstream subscription\n\t\t\t\t// now that we have the handle. Without this, the inner stays\n\t\t\t\t// subscribed until producer teardown — leaks at high volume.\n\t\t\t\tif (captured && unsub) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tunsub = null;\n\t\t\t\t}\n\t\t\t\treturn () => {\n\t\t\t\t\tunlinkParent();\n\t\t\t\t\tac.abort();\n\t\t\t\t\tunsub?.();\n\t\t\t\t\tunsub = null;\n\t\t\t\t};\n\t\t\t},\n\t\t\t{ name: `${name}/inner`, describeKind: \"producer\" },\n\t\t);\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// dispatchActuator\n// ---------------------------------------------------------------------------\n\n/**\n * Apply callback shape consumed by {@link dispatchActuator}. Same shape as\n * {@link ActuatorExecutorConfig.apply}.\n */\nexport type ActuatorApplyFn<R> = (\n\titem: TriagedItem,\n\topts: { signal: AbortSignal },\n) => ActuatorResult<R>;\n\n/** Configuration for {@link dispatchActuator}. */\nexport interface DispatchActuatorConfig<R> {\n\t/**\n\t * Per-intervention apply callbacks. Keyed by `TriagedItem.intervention`.\n\t * Items whose intervention is not in `routes` fall through to `default`\n\t * (when set) or emit a skip-failure `ExecuteOutput`.\n\t */\n\troutes: Readonly<Partial<Record<TriagedItem[\"intervention\"], ActuatorApplyFn<R>>>>;\n\t/** Fallback apply callback for items whose intervention is not in `routes`. */\n\tdefault?: ActuatorApplyFn<R>;\n\t/** Node name prefix for `describe()` introspection. */\n\tname?: string;\n}\n\n/**\n * Multi-intervention actuator — dispatches each `TriagedItem` to one of\n * several `apply` callbacks based on `item.intervention`.\n *\n * Internally builds a single `actuatorExecutor` whose `apply` resolves the\n * intervention → callback at call-time. Items with no matching route and no\n * `default` emit a skip-failure with detail\n * `\"no route for intervention 'X'\"`.\n */\nexport function dispatchActuator<R>(config: DispatchActuatorConfig<R>): HarnessExecutor<R> {\n\tconst name = config.name ?? \"dispatch-actuator\";\n\tconst defaultFn = config.default ?? null;\n\tconst hasDefault = defaultFn != null;\n\treturn actuatorExecutor<R>({\n\t\tapply: (item, opts) => {\n\t\t\tconst fn = Object.hasOwn(config.routes, item.intervention)\n\t\t\t\t? config.routes[item.intervention]!\n\t\t\t\t: defaultFn;\n\t\t\tif (!fn) {\n\t\t\t\tthrow new Error(`dispatchActuator: no route for intervention '${item.intervention}'`);\n\t\t\t}\n\t\t\treturn fn(item, opts);\n\t\t},\n\t\tshouldApply: (item) => Object.hasOwn(config.routes, item.intervention) || hasDefault,\n\t\tskipDetail: (item) => `no route for intervention '${item.intervention}'`,\n\t\tname,\n\t});\n}\n","/**\n * autoSolidify — promote successful VERIFY runs into a durable artifact\n * (catalog entry, skill, template, doc edit, …).\n *\n * Closes the dogfood retrospective loop: when the harness's VERIFY\n * stage reports `verified: true`, the validated intervention should\n * become an authoring artifact the next loop run can rely on. This\n * primitive is the generic substrate — pass a `write` callback that\n * does the actual promotion (e.g. `overlay.upsertTemplate` for the\n * dogfood catalog overlay; `fs.writeFile` for a doc edit; `ctx.skill`\n * for a Hermes-style skill registry).\n *\n * @example Wire the catalog overlay as the solidify target.\n * ```ts\n * const solidified = autoSolidify({\n * verifyResults: harness.verifyResults.latest,\n * extract: (vr) => vr.execution.artifact ?? null,\n * write: (entry, vr) => overlay.upsertFn(`learned-${vr.item.summary}`, entry),\n * });\n * solidified.subscribe(() => {}); // keep alive for log\n * ```\n *\n * **Why a node and not just an effect.** The returned `Node<R>` emits\n * each promoted artifact, so callers can pipe solidifications through\n * the standard reactive surface (`describe()`, `observe()`, replay\n * buffers) instead of side-channel logging. An audit / dashboard that\n * wants \"what was learned this run?\" subscribes to the returned node;\n * the `write` callback owns the durable side effect.\n *\n * **Idempotency is the caller's responsibility.** The primitive\n * promotes every `verified: true` wave that passes the predicate. If\n * the harness re-verifies the same item (e.g. via reingestion), the\n * `write` callback is invoked again. Wrap your write fn with a\n * dedup-by-key guard if your target store would otherwise bloat. The\n * inner `seen` set inside this factory is intentionally absent — the\n * harness already retains via topic logs and the user may want\n * re-promotion semantics that are domain-specific.\n *\n * @module\n */\n\nimport { COMPLETE, DATA, ERROR, type Messages, type Node, node } from \"@graphrefly/pure-ts/core\";\n\nimport type { VerifyResult } from \"./types.js\";\n\n/**\n * Configuration for {@link autoSolidify}.\n *\n * `R` is the artifact type the upstream EXECUTE stage produced (and\n * `evalVerifier` carries through `execution.artifact`). `T` is the\n * promotion shape — what `write` consumes and what the returned node\n * emits. Often `T = R`, but they diverge when the actuator's raw\n * artifact needs a transform before storing (e.g. wrap a `CatalogPatch`\n * into a `CatalogEntry` with effectiveness metadata).\n */\nexport interface AutoSolidifyConfig<R, T = R> {\n\t/** Reactive verify-result stream. Typically `harness.verifyResults.latest`. */\n\tverifyResults: Node<VerifyResult<R> | null>;\n\t/**\n\t * Pull the value-to-promote out of a verified VerifyResult.\n\t * Default: `(vr) => vr.execution.artifact as T | null`. Return `null`\n\t * to skip a particular VerifyResult even when `verified: true` (e.g.\n\t * an LLM-default executor produces no artifact and there's nothing to\n\t * solidify).\n\t */\n\textract?: (vr: VerifyResult<R>) => T | null;\n\t/**\n\t * Optional gate beyond `verified === true`. When provided, the\n\t * primitive only promotes when this returns `true`. Default: pass\n\t * everything verified.\n\t *\n\t * Useful predicates:\n\t * - `(vr) => vr.item.intervention === \"catalog-fn\"` — only catalog work.\n\t * - `(vr) => (vr.findings ?? []).every(f => !/regression/i.test(f))` —\n\t * skip even-passes that mention regressions.\n\t */\n\tpredicate?: (vr: VerifyResult<R>) => boolean;\n\t/**\n\t * Promote — usually a side effect (write to overlay, fs, KG, etc.).\n\t * Receives the extracted artifact AND the originating VerifyResult so\n\t * the writer can use any context it needs (item summary, eval task\n\t * IDs, finding text, …) when shaping the durable record.\n\t */\n\twrite: (artifact: T, vr: VerifyResult<R>) => void;\n\t/** Node name for `describe()` introspection. Default `\"auto-solidify\"`. */\n\tname?: string;\n}\n\n/**\n * Build a `Node<T>` that subscribes to `verifyResults`, filters to\n * verified passes that produced an extractable artifact, runs `write`,\n * and emits the artifact. Use the returned node as a subscription\n * point for audit / dashboard / log pipelines.\n *\n * **Terminal-on-error semantics.** A throw from `predicate`, `extract`,\n * or `write` surfaces as `[[ERROR]]` on the returned node and\n * **terminates** it — the upstream subscription tears down and no\n * further DATA is emitted. This matches the spec's terminal-frame\n * contract for ERROR. If you want the solidify node to stay live\n * across user-callback throws, wrap your callbacks with try/catch\n * internally and emit a sentinel value or no-op on failure. A future\n * non-terminal `errors: Node<unknown>` companion may surface failures\n * without terminating the success stream — flagged as a follow-up.\n *\n * @returns A `Node<T>` that emits one DATA per promoted artifact.\n * Stays live as long as `verifyResults` is live AND no user callback\n * has thrown.\n */\nexport function autoSolidify<R, T = R>(config: AutoSolidifyConfig<R, T>): Node<T> {\n\tconst name = config.name ?? \"auto-solidify\";\n\tconst extract =\n\t\tconfig.extract ?? ((vr: VerifyResult<R>) => (vr.execution.artifact ?? null) as T | null);\n\tconst predicate = config.predicate ?? (() => true);\n\n\treturn node<T>(\n\t\t[],\n\t\t(_data, actions) => {\n\t\t\tlet unsub: (() => void) | null = null;\n\t\t\tlet terminated = false;\n\t\t\tconst tearDown = (): void => {\n\t\t\t\tif (terminated) return;\n\t\t\t\tterminated = true;\n\t\t\t\tunsub?.();\n\t\t\t\tunsub = null;\n\t\t\t};\n\t\t\tconst emitTerminalError = (err: unknown): void => {\n\t\t\t\tif (terminated) return;\n\t\t\t\tactions.down([[ERROR, err]] satisfies Messages);\n\t\t\t\ttearDown();\n\t\t\t};\n\t\t\tunsub = config.verifyResults.subscribe((batch) => {\n\t\t\t\tif (terminated) return;\n\t\t\t\tfor (const m of batch) {\n\t\t\t\t\tif (terminated) return;\n\t\t\t\t\tif (m[0] !== DATA) {\n\t\t\t\t\t\tif (m[0] === COMPLETE) {\n\t\t\t\t\t\t\t// Upstream verifyResults completed (rare; harness destroy).\n\t\t\t\t\t\t\t// Forward COMPLETE and tear down — solidify is terminal too.\n\t\t\t\t\t\t\tactions.down([[COMPLETE]] satisfies Messages);\n\t\t\t\t\t\t\ttearDown();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst vr = m[1] as VerifyResult<R> | null;\n\t\t\t\t\tif (vr == null) continue;\n\t\t\t\t\tif (!vr.verified) continue;\n\t\t\t\t\t// User callbacks (predicate / extract / write) are isolated\n\t\t\t\t\t// in try/catch so a throw lands as a single terminal ERROR\n\t\t\t\t\t// rather than propagating into the upstream emitter where\n\t\t\t\t\t// it would skip later messages in the same batch and leave\n\t\t\t\t\t// the solidify node un-terminated.\n\t\t\t\t\tlet pass: boolean;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpass = predicate(vr);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\temitTerminalError(err);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (!pass) continue;\n\t\t\t\t\tlet artifact: T | null;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tartifact = extract(vr);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\temitTerminalError(err);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (artifact == null) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconfig.write(artifact, vr);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\temitTerminalError(err);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tactions.down([[DATA, artifact]] satisfies Messages);\n\t\t\t\t}\n\t\t\t});\n\t\t\t// If `subscribe` fired terminally during the call (push-on-subscribe\n\t\t\t// of an already-COMPLETE upstream), `tearDown()` ran inside the\n\t\t\t// callback before `unsub` was assigned, so the unsub is still\n\t\t\t// dangling. Drop it now if we're already terminated.\n\t\t\tif (terminated && unsub) {\n\t\t\t\tunsub();\n\t\t\t\tunsub = null;\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\ttearDown();\n\t\t\t};\n\t\t},\n\t\t{ name, describeKind: \"producer\" },\n\t);\n}\n","/**\n * Harness bridge factories (roadmap §9.0).\n *\n * Intake bridges, eval source wrapper, before/after comparison,\n * affected-task filter, code-change bridge, and notification effect.\n * All are compositions of existing primitives — no new abstractions.\n *\n * @module\n */\n\nimport { type Node, node } from \"@graphrefly/pure-ts/core\";\nimport { fromAny, switchMap } from \"@graphrefly/pure-ts/extra\";\nimport type { Graph } from \"@graphrefly/pure-ts/graph\";\nimport type { TopicGraph } from \"../messaging/index.js\";\n\nimport type { IntakeItem, Severity, TriagedItem } from \"./types.js\";\n\n// ---------------------------------------------------------------------------\n// Generic intake bridge\n// ---------------------------------------------------------------------------\n\n/** Options for {@link createIntakeBridge}. */\nexport interface CreateIntakeBridgeOptions<T> {\n\t/** Graph to register the effect node on (B.1 narrow-waist visibility). */\n\tgraph: Graph;\n\t/** Reactive node emitting domain-specific data. */\n\tsource: Node<T>;\n\t/** TopicGraph to publish IntakeItem entries to. */\n\tintakeTopic: TopicGraph<IntakeItem>;\n\t/** Converts source data into IntakeItem[]. Return empty array to skip. */\n\tparser: (value: T) => IntakeItem[];\n\t/** Effect-node name (default `\"intake-bridge\"`). */\n\tname?: string;\n}\n\n/**\n * Generic source→intake bridge factory.\n *\n * Watches a source node for new values, passes each through a user-supplied\n * `parser` that produces zero or more `IntakeItem`s, and publishes them to\n * the given intake topic.\n *\n * This is the generalized pattern behind {@link evalIntakeBridge}. Use it for\n * CI results, test failures, Slack messages, monitoring alerts, or any domain\n * where structured results should flow into a harness loop.\n *\n * The effect node is registered on the supplied `graph` so it appears in\n * `describe()` and is owned by the graph's lifecycle.\n *\n * @returns The effect node (for lifecycle management).\n */\nexport function createIntakeBridge<T>(opts: CreateIntakeBridgeOptions<T>): Node<unknown> {\n\tconst { graph, source, intakeTopic, parser, name = \"intake-bridge\" } = opts;\n\tconst eff = node(\n\t\t[source as Node<unknown>],\n\t\t(batchData, _actions, ctx) => {\n\t\t\tconst data = batchData.map((batch, i) =>\n\t\t\t\tbatch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i],\n\t\t\t);\n\t\t\tconst value = data[0];\n\t\t\tif (value === undefined) return;\n\t\t\tconst items = parser(value as T);\n\t\t\tfor (const item of items) {\n\t\t\t\tintakeTopic.publish(item);\n\t\t\t}\n\t\t},\n\t\t{ describeKind: \"effect\" },\n\t);\n\tgraph.add(eff, { name });\n\treturn eff;\n}\n\n// ---------------------------------------------------------------------------\n// Generic eval result shape\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal eval result shape accepted by the bridge.\n *\n * TS eval runner uses `EvalRun` from `evals/lib/types.ts` which is a superset\n * of this shape. The bridge only reads what it needs.\n */\nexport interface EvalRunResult {\n\trun_id: string;\n\tmodel: string;\n\ttasks: EvalTaskResult[];\n}\n\nexport interface EvalTaskResult {\n\ttask_id: string;\n\tvalid: boolean;\n\tjudge_scores?: EvalJudgeScore[];\n}\n\nexport interface EvalJudgeScore {\n\tclaim: string;\n\tpass: boolean;\n\treasoning: string;\n}\n\n// ---------------------------------------------------------------------------\n// Bridge factory\n// ---------------------------------------------------------------------------\n\nexport interface EvalIntakeBridgeOptions {\n\t/** Graph to register the effect node on (B.1 narrow-waist visibility). */\n\tgraph: Graph;\n\t/** Node emitting EvalRunResult (or EvalRunResult[]). */\n\tsource: Node<EvalRunResult | EvalRunResult[]>;\n\t/** TopicGraph to publish IntakeItem entries to. */\n\tintakeTopic: TopicGraph<IntakeItem>;\n\t/** Effect-node name (default `\"eval-intake-bridge\"`). */\n\tname?: string;\n\t/** Minimum severity for eval-sourced items (default `\"medium\"`). */\n\tdefaultSeverity?: Severity;\n}\n\n/**\n * Create an effect node that watches an eval results source and publishes\n * per-criterion findings to an intake topic.\n *\n * Each failing judge criterion produces a separate IntakeItem — not one\n * item per task. This gives the triage stage granular findings to classify.\n *\n * The effect node is registered on the supplied `graph` so it appears in\n * `describe()` and is owned by the graph's lifecycle.\n *\n * @returns The effect node (for lifecycle management).\n */\nexport function evalIntakeBridge(opts: EvalIntakeBridgeOptions): Node<unknown> {\n\tconst {\n\t\tgraph,\n\t\tsource,\n\t\tintakeTopic,\n\t\tname = \"eval-intake-bridge\",\n\t\tdefaultSeverity = \"medium\",\n\t} = opts;\n\n\tconst eff = node(\n\t\t[source as Node<unknown>],\n\t\t(batchData, _actions, ctx) => {\n\t\t\tconst data = batchData.map((batch, i) =>\n\t\t\t\tbatch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i],\n\t\t\t);\n\t\t\tconst results = data[0];\n\t\t\tif (results === undefined) return;\n\t\t\tconst runs = Array.isArray(results)\n\t\t\t\t? (results as EvalRunResult[])\n\t\t\t\t: [results as EvalRunResult];\n\n\t\t\tfor (const run of runs) {\n\t\t\t\tfor (const task of run.tasks) {\n\t\t\t\t\t// Only process tasks with failures\n\t\t\t\t\tif (task.valid && task.judge_scores?.every((s) => s.pass)) continue;\n\n\t\t\t\t\t// Task-level validity failure (no judge scores or overall invalid)\n\t\t\t\t\tif (!task.valid && (!task.judge_scores || task.judge_scores.length === 0)) {\n\t\t\t\t\t\tintakeTopic.publish({\n\t\t\t\t\t\t\tsource: \"eval\",\n\t\t\t\t\t\t\tsummary: `Task ${task.task_id} invalid (model: ${run.model})`,\n\t\t\t\t\t\t\tevidence: `Run ${run.run_id}: task produced invalid output`,\n\t\t\t\t\t\t\taffectsAreas: [\"graphspec\"],\n\t\t\t\t\t\t\taffectsEvalTasks: [task.task_id],\n\t\t\t\t\t\t\tseverity: defaultSeverity,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Per-criterion findings\n\t\t\t\t\tif (task.judge_scores) {\n\t\t\t\t\t\tfor (const score of task.judge_scores) {\n\t\t\t\t\t\t\tif (score.pass) continue;\n\t\t\t\t\t\t\tintakeTopic.publish({\n\t\t\t\t\t\t\t\tsource: \"eval\",\n\t\t\t\t\t\t\t\tsummary: `${task.task_id}: ${score.claim} (model: ${run.model})`,\n\t\t\t\t\t\t\t\tevidence: score.reasoning,\n\t\t\t\t\t\t\t\taffectsAreas: [\"graphspec\"],\n\t\t\t\t\t\t\t\taffectsEvalTasks: [task.task_id],\n\t\t\t\t\t\t\t\tseverity: defaultSeverity,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{ describeKind: \"effect\" },\n\t);\n\tgraph.add(eff, { name });\n\treturn eff;\n}\n\n// ---------------------------------------------------------------------------\n// Composition A: Eval-driven improvement loop\n// ---------------------------------------------------------------------------\n\n/**\n * Wrap any eval runner as a reactive producer node.\n *\n * When `trigger` emits, calls `runner()` and emits the result downstream.\n * Uses `switchMap` + `fromAny` — the async boundary stays in the source\n * layer (spec §5.10). A new trigger cancels any in-flight run.\n *\n * Pure transform via operator composition — does not construct an\n * effect/derived node, so no `graph` parameter is needed.\n *\n * ```ts\n * const trigger = state(0); // bump to trigger a new run\n * const results = evalSource(trigger, () => runEvals(config));\n * results.subscribe(msgs => { ... });\n * trigger.emit(1); // fires the runner\n * ```\n *\n * @param trigger - Any node; each new DATA emission fires the runner.\n * @param runner - Returns an EvalRunResult (or promise of one).\n */\nexport function evalSource<T extends EvalRunResult>(\n\ttrigger: Node<unknown>,\n\trunner: () => T | Promise<T>,\n): Node<T> {\n\treturn switchMap(trigger, () => fromAny(runner()) as Node<T>);\n}\n\n// ---------------------------------------------------------------------------\n\n/** Per-task delta produced by {@link beforeAfterCompare}. */\nexport interface EvalTaskDelta {\n\ttaskId: string;\n\tbefore: boolean;\n\tafter: boolean;\n\t/** Score-level diff (after − before), undefined if no scores present. */\n\tscoreDiff?: number;\n}\n\n/** Output of {@link beforeAfterCompare}. */\nexport interface EvalDelta {\n\t/** Task IDs that newly fail in `after` (were passing in `before`). */\n\tnewFailures: string[];\n\t/** Task IDs that now pass in `after` (were failing in `before`). */\n\tresolved: string[];\n\t/** Full per-task breakdown. */\n\ttaskDeltas: EvalTaskDelta[];\n\t/** True when net resolutions > net failures. */\n\toverallImproved: boolean;\n}\n\n/** Options for {@link beforeAfterCompare}. */\nexport interface BeforeAfterCompareOptions {\n\t/** Graph to register the derived node on (B.1 narrow-waist visibility). */\n\tgraph: Graph;\n\t/** Node holding the baseline eval result. */\n\tbefore: Node<EvalRunResult>;\n\t/** Node holding the new eval result. */\n\tafter: Node<EvalRunResult>;\n\t/** Derived-node name (default `\"eval-delta\"`). */\n\tname?: string;\n}\n\n/**\n * Derived node that computes before/after eval deltas.\n *\n * Pure computation: no LLM, no async. Compares per-task validity and\n * pass counts between two `EvalRunResult` snapshots.\n *\n * The derived node is registered on the supplied `graph` so it appears in\n * `describe()` and is owned by the graph's lifecycle.\n */\nexport function beforeAfterCompare(opts: BeforeAfterCompareOptions): Node<EvalDelta> {\n\tconst { graph, before, after, name = \"eval-delta\" } = opts;\n\tconst der = node<EvalDelta>(\n\t\t[before as Node<unknown>, after as Node<unknown>],\n\t\t(batchData, actions, ctx) => {\n\t\t\tconst data = batchData.map((batch, i) =>\n\t\t\t\tbatch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i],\n\t\t\t);\n\t\t\tconst bRes = data[0] as EvalRunResult;\n\t\t\tconst aRes = data[1] as EvalRunResult;\n\n\t\t\tconst beforeMap = new Map<string, EvalTaskResult>(bRes.tasks.map((t) => [t.task_id, t]));\n\t\t\tconst afterMap = new Map<string, EvalTaskResult>(aRes.tasks.map((t) => [t.task_id, t]));\n\n\t\t\tconst allIds = new Set([...beforeMap.keys(), ...afterMap.keys()]);\n\t\t\tconst taskDeltas: EvalTaskDelta[] = [];\n\t\t\tconst newFailures: string[] = [];\n\t\t\tconst resolved: string[] = [];\n\n\t\t\tfor (const id of allIds) {\n\t\t\t\tconst bt = beforeMap.get(id);\n\t\t\t\tconst at = afterMap.get(id);\n\t\t\t\tconst beforeValid = bt?.valid ?? false;\n\t\t\t\tconst afterValid = at?.valid ?? false;\n\n\t\t\t\tconst beforeScore = bt?.judge_scores\n\t\t\t\t\t? bt.judge_scores.filter((s) => s.pass).length\n\t\t\t\t\t: undefined;\n\t\t\t\tconst afterScore = at?.judge_scores\n\t\t\t\t\t? at.judge_scores.filter((s) => s.pass).length\n\t\t\t\t\t: undefined;\n\t\t\t\tconst scoreDiff =\n\t\t\t\t\tbeforeScore !== undefined && afterScore !== undefined\n\t\t\t\t\t\t? afterScore - beforeScore\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\ttaskDeltas.push({ taskId: id, before: beforeValid, after: afterValid, scoreDiff });\n\t\t\t\tif (beforeValid && !afterValid) newFailures.push(id);\n\t\t\t\tif (!beforeValid && afterValid) resolved.push(id);\n\t\t\t}\n\n\t\t\tactions.emit({\n\t\t\t\tnewFailures,\n\t\t\t\tresolved,\n\t\t\t\ttaskDeltas,\n\t\t\t\toverallImproved: resolved.length > newFailures.length,\n\t\t\t});\n\t\t},\n\t\t{ describeKind: \"derived\" },\n\t);\n\tgraph.add(der as Node<unknown>, { name });\n\treturn der;\n}\n\n// ---------------------------------------------------------------------------\n\n/** Options for {@link affectedTaskFilter}. */\nexport interface AffectedTaskFilterOptions {\n\t/** Graph to register the derived node on (B.1 narrow-waist visibility). */\n\tgraph: Graph;\n\t/** Node holding the current list of triaged items. */\n\tissues: Node<readonly TriagedItem[]>;\n\t/**\n\t * Optional node (or plain array) of all known task IDs.\n\t * When provided, output is the intersection.\n\t */\n\tfullTaskSet?: Node<readonly string[]> | readonly string[];\n\t/** Derived-node name (default `\"affected-task-filter\"`). */\n\tname?: string;\n}\n\n/**\n * Derived node that selects which eval task IDs to re-run.\n *\n * Collects `affectsEvalTasks` from all triaged items, deduplicates, then\n * optionally intersects with `fullTaskSet`. Returns a sorted array of IDs.\n *\n * Use this to avoid re-running the full eval suite after each fix: only the\n * tasks that the triaged items claim to affect are returned.\n *\n * The derived node is registered on the supplied `graph` so it appears in\n * `describe()` and is owned by the graph's lifecycle.\n */\nexport function affectedTaskFilter(opts: AffectedTaskFilterOptions): Node<string[]> {\n\tconst { graph, issues, fullTaskSet, name = \"affected-task-filter\" } = opts;\n\n\tlet taskSetNode: Node<unknown> | null = null;\n\tif (fullTaskSet != null) {\n\t\tif (Array.isArray(fullTaskSet)) {\n\t\t\t// Static-array form: register the inline state node so it appears\n\t\t\t// in `describe()`/`explain()` walks (EC8 — qa 2026-04-30).\n\t\t\tconst inlineSet = node([], { initial: fullTaskSet as readonly string[] });\n\t\t\tgraph.add(inlineSet, { name: `${name}/fullTaskSet` });\n\t\t\ttaskSetNode = inlineSet as Node<unknown>;\n\t\t} else {\n\t\t\t// User-supplied Node — owned by the caller's graph; don't re-add.\n\t\t\ttaskSetNode = fullTaskSet as Node<unknown>;\n\t\t}\n\t}\n\n\tconst deps: Node<unknown>[] = [issues as Node<unknown>];\n\tif (taskSetNode) deps.push(taskSetNode);\n\n\tconst der = node<string[]>(\n\t\tdeps,\n\t\t(batchData, actions, ctx) => {\n\t\t\tconst data = batchData.map((batch, i) =>\n\t\t\t\tbatch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i],\n\t\t\t);\n\t\t\tconst items = data[0] as readonly TriagedItem[];\n\t\t\tconst all = taskSetNode ? new Set(data[1] as readonly string[]) : null;\n\n\t\t\tconst affected = new Set<string>();\n\t\t\tfor (const item of items) {\n\t\t\t\tfor (const id of item.affectsEvalTasks ?? []) {\n\t\t\t\t\tif (all == null || all.has(id)) affected.add(id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tactions.emit([...affected].sort());\n\t\t},\n\t\t{ describeKind: \"derived\" },\n\t);\n\tgraph.add(der as Node<unknown>, { name });\n\treturn der;\n}\n\n// ---------------------------------------------------------------------------\n// Composition D: Quality gate (CI/CD)\n// ---------------------------------------------------------------------------\n\n/** A single lint error emitted by a CI tool. */\nexport interface LintError {\n\tfile: string;\n\tline: number;\n\tcol: number;\n\trule: string;\n\tmessage: string;\n}\n\n/** A single test failure emitted by a test runner. */\nexport interface TestFailure {\n\ttestId: string;\n\tfile: string;\n\tmessage: string;\n}\n\n/** Structured code-change / CI event. */\nexport interface CodeChange {\n\t/** Files touched by the change. */\n\tfiles: string[];\n\tlintErrors?: LintError[];\n\ttestFailures?: TestFailure[];\n}\n\n/** Options for {@link codeChangeBridge}. */\nexport interface CodeChangeBridgeOptions {\n\t/** Graph to register the effect node on (B.1 narrow-waist visibility). */\n\tgraph: Graph;\n\t/** Node emitting CodeChange events. */\n\tsource: Node<CodeChange>;\n\t/** TopicGraph to publish IntakeItem entries to. */\n\tintakeTopic: TopicGraph<IntakeItem>;\n\t/** Optional custom parser (overrides default). */\n\tparser?: (change: CodeChange) => IntakeItem[];\n\t/** Effect-node name (default `\"code-change-bridge\"`). */\n\tname?: string;\n\t/** Default severity for generated IntakeItems (default `\"high\"`). */\n\tdefaultSeverity?: Severity;\n}\n\n/**\n * Intake bridge for code-change / CI events.\n *\n * Watches a source node for `CodeChange` events and publishes one\n * `IntakeItem` per lint error and per test failure to the intake topic.\n * Pass a custom `parser` to override the default mapping.\n *\n * The effect node is registered on the supplied `graph` so it appears in\n * `describe()` and is owned by the graph's lifecycle.\n */\nexport function codeChangeBridge(opts: CodeChangeBridgeOptions): Node<unknown> {\n\tconst {\n\t\tgraph,\n\t\tsource,\n\t\tintakeTopic,\n\t\tparser,\n\t\tname = \"code-change-bridge\",\n\t\tdefaultSeverity = \"high\",\n\t} = opts;\n\n\tfunction defaultParser(change: CodeChange): IntakeItem[] {\n\t\tconst items: IntakeItem[] = [];\n\t\tfor (const err of change.lintErrors ?? []) {\n\t\t\titems.push({\n\t\t\t\tsource: \"code-change\",\n\t\t\t\tsummary: `Lint: ${err.rule} in ${err.file}:${err.line}`,\n\t\t\t\tevidence: err.message,\n\t\t\t\taffectsAreas: [err.file],\n\t\t\t\tseverity: defaultSeverity,\n\t\t\t});\n\t\t}\n\t\tfor (const fail of change.testFailures ?? []) {\n\t\t\titems.push({\n\t\t\t\tsource: \"test\",\n\t\t\t\tsummary: `Test failure: ${fail.testId}`,\n\t\t\t\tevidence: fail.message,\n\t\t\t\taffectsAreas: [fail.file],\n\t\t\t\taffectsEvalTasks: [fail.testId],\n\t\t\t\tseverity: defaultSeverity,\n\t\t\t});\n\t\t}\n\t\treturn items;\n\t}\n\n\tconst resolve = parser ?? defaultParser;\n\n\tconst eff = node(\n\t\t[source as Node<unknown>],\n\t\t(batchData, _actions, ctx) => {\n\t\t\tconst data = batchData.map((batch, i) =>\n\t\t\t\tbatch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i],\n\t\t\t);\n\t\t\tconst change = data[0];\n\t\t\tif (change === undefined) return;\n\t\t\tfor (const item of resolve(change as CodeChange)) {\n\t\t\t\tintakeTopic.publish(item);\n\t\t\t}\n\t\t},\n\t\t{ describeKind: \"effect\" },\n\t);\n\tgraph.add(eff, { name });\n\treturn eff;\n}\n\n// ---------------------------------------------------------------------------\n\n/** Transport function for {@link notifyEffect}. Sync or async. */\nexport type NotifyTransport<T> = (item: T) => void | Promise<void>;\n\n/** Options for {@link notifyEffect}. */\nexport interface NotifyEffectOptions<T> {\n\t/** Graph to register the effect node on (B.1 narrow-waist visibility). */\n\tgraph: Graph;\n\t/** TopicGraph whose latest entry triggers the notification. */\n\ttopic: TopicGraph<T>;\n\t/** Called with each new item. May return a Promise. */\n\ttransport: NotifyTransport<T>;\n\t/** Effect-node name (default `\"notify-effect\"`). */\n\tname?: string;\n}\n\n/**\n * Effect node that sends each new topic entry to an external channel.\n *\n * The `transport` function is called for every item published to `topic`.\n * Async transports are bridged via `fromAny` (spec §5.10 compliant).\n *\n * Typical use: Slack webhook, GitHub PR comment, email notification, etc.\n * The factory provides reactive wiring; the transport supplies domain logic.\n *\n * The effect node is registered on the supplied `graph` so it appears in\n * `describe()` and is owned by the graph's lifecycle.\n *\n * ```ts\n * notifyEffect({ graph, topic: alertQueue, transport: async (item) => {\n * await fetch(SLACK_WEBHOOK, { method: 'POST', body: JSON.stringify({ text: item.summary }) });\n * }});\n * ```\n */\nexport function notifyEffect<T>(opts: NotifyEffectOptions<T>): Node<unknown> {\n\tconst { graph, topic, transport, name = \"notify-effect\" } = opts;\n\t// SENTINEL contract on `topic.latest` (COMPOSITION-GUIDE §1a + spec §5.12):\n\t// - `topic.publish(undefined)` is rejected at the publish boundary, so\n\t// `undefined` is exclusively the protocol SENTINEL on the read side.\n\t// - `topic.latest` stays SENTINEL on empty (no eager DATA emission), so\n\t// the partial-false first-run gate holds this fn until the first publish.\n\t// - Legit `null` DATA (when `T` includes `null`) reaches `transport`;\n\t// user transports must handle `null` themselves per v5.\n\t// The `=== undefined` guard below is defense-in-depth for any future\n\t// empty-batch wave where `prevData[0]` is still SENTINEL — in normal flow\n\t// the first-run gate has already filtered the empty case.\n\tconst eff = node(\n\t\t[topic.latest as Node<unknown>],\n\t\t(batchData, _actions, ctx) => {\n\t\t\tconst data = batchData.map((batch, i) =>\n\t\t\t\tbatch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i],\n\t\t\t);\n\t\t\tconst item = data[0];\n\t\t\tif (item === undefined) return;\n\t\t\t// transport is a side effect (webhook, Slack, email). Async transports\n\t\t\t// are fire-and-forget — the Promise result does not feed back into the\n\t\t\t// graph. Suppress unhandled-rejection noise by voiding the return.\n\t\t\tvoid transport(item as T);\n\t\t},\n\t\t{ describeKind: \"effect\" },\n\t);\n\tgraph.add(eff, { name });\n\treturn eff;\n}\n"],"mappings":";AAiCA,SAAS,UAAU,MAAM,OAAiC,YAAY;AACtE,SAAS,eAA+B;AAiDxC,SAAS,gBAAmB,QAAW,MAAqC;AAC3E,SAAO;AAAA,IACN,SAAS;AAAA,IACT,QAAQ,oBAAoB,KAAK,YAAY,QAAQ,SAAS,KAAK,OAAO,CAAC;AAAA,IAC3E,UAAU;AAAA,EACX;AACD;AAEA,SAAS,eAAkB,KAAc,MAAqC;AAC7E,QAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,SAAO;AAAA,IACN,SAAS;AAAA,IACT,QAAQ,qBAAqB,KAAK,YAAY,KAAK,OAAO;AAAA,EAC3D;AACD;AAEA,SAAS,kBAAkB,MAA2B;AACrD,SAAO,oBAAoB,KAAK,YAAY;AAC7C;AAEA,SA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AAC,OAAO,MAClC,SAAS,QAAQ,MAAM,SAAS,IAAI,MAAM,GAAG,EAAE,IAAI,IAAI,SAAS,CAAC;AAAA,MAClE;AACA,YAAM,SAAS,KAAK,CAAC;AACrB,UAAI,WAAW,OAAW;AAC1B,iBAAW,QAAQ,QAAQ,MAAoB,GAAG;AACjD,oBAAY,QAAQ,IAAI;AAAA,MACzB;AAAA,IACD;AAAA,IACA,EAAE,cAAc,SAAS;AAAA,EAC1B;AACA,QAAM,IAAI,KAAK,EAAE,KAAK,CAAC;AACvB,SAAO;AACR;AAqCO,SAAS,aAAgB,MAA6C;AAC5E,QAAM,EAAE,OAAO,OAAO,WAAW,OAAO,gBAAgB,IAAI;AAW5D,QAAM,MAAMA;AAAA,IACX,CAAC,MAAM,MAAuB;AAAA,IAC9B,CAAC,WAAW,UAAU,QAAQ;AAC7B,YAAM,OAAO,UAAU;AAAA,QAAI,CAAC,OAAO,MAClC,SAAS,QAAQ,MAAM,SAAS,IAAI,MAAM,GAAG,EAAE,IAAI,IAAI,SAAS,CAAC;AAAA,MAClE;AACA,YAAM,OAAO,KAAK,CAAC;AACnB,UAAI,SAAS,OAAW;AAIxB,WAAK,UAAU,IAAS;AAAA,IACzB;AAAA,IACA,EAAE,cAAc,SAAS;AAAA,EAC1B;AACA,QAAM,IAAI,KAAK,EAAE,KAAK,CAAC;AACvB,SAAO;AACR;","names":["COMPLETE","DATA","ERROR","node","node","fromAny"]}
@@ -0,0 +1,510 @@
1
+ import {
2
+ domainMeta
3
+ } from "./chunk-FMPF42Q4.js";
4
+ import {
5
+ mutate
6
+ } from "./chunk-BXGZFGZ4.js";
7
+
8
+ // src/utils/messaging/audit-records.ts
9
+ var topicPublishKeyOf = (r) => `${r.topicName}::${r.itemKey}`;
10
+ var subscriptionAckKeyOf = (r) => `${r.subscriptionId}::${r.cursor}`;
11
+ var subscriptionPullAndAckKeyOf = (r) => `${r.subscriptionId}::${r.cursor}`;
12
+ var hubRemoveTopicKeyOf = (r) => r.topicName;
13
+
14
+ // src/utils/messaging/message.ts
15
+ var PROMPTS_TOPIC = "prompts";
16
+ var RESPONSES_TOPIC = "responses";
17
+ var INJECTIONS_TOPIC = "injections";
18
+ var DEFERRED_TOPIC = "deferred";
19
+ var SPAWNS_TOPIC = "spawns";
20
+ var CONTEXT_TOPIC = "context";
21
+ var TODOS_TOPIC = "todos";
22
+ var STANDARD_TOPICS = [
23
+ PROMPTS_TOPIC,
24
+ RESPONSES_TOPIC,
25
+ INJECTIONS_TOPIC,
26
+ DEFERRED_TOPIC,
27
+ SPAWNS_TOPIC,
28
+ CONTEXT_TOPIC,
29
+ TODOS_TOPIC
30
+ ];
31
+
32
+ // src/utils/messaging/index.ts
33
+ import { batch, COMPLETE, DATA, node } from "@graphrefly/pure-ts/core";
34
+ import { keepalive, reactiveLog } from "@graphrefly/pure-ts/extra";
35
+ import { Graph } from "@graphrefly/pure-ts/graph";
36
+ var DEFAULT_MAX_PER_PUMP = 256;
37
+ function requireNonNegativeInt(value, label) {
38
+ if (!Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
39
+ throw new Error(`${label} must be a non-negative integer`);
40
+ }
41
+ return value;
42
+ }
43
+ function messagingMeta(kind, extra) {
44
+ return domainMeta("messaging", kind, extra);
45
+ }
46
+ var DEFAULT_TOPIC_RETAINED_LIMIT = 1024;
47
+ var TopicGraph = class extends Graph {
48
+ _log;
49
+ _publishImpl;
50
+ events;
51
+ /**
52
+ * Most recently published value. Stays in the protocol SENTINEL state
53
+ * (`cache === undefined`, no DATA emitted) until the first publish, then
54
+ * tracks the latest entry. Spec §5.12 reserves `undefined` as the
55
+ * "never sent DATA" sentinel — and `TopicGraph.publish(undefined)` is
56
+ * rejected — so `cache === undefined` unambiguously signals "empty topic"
57
+ * even when `T` itself includes `null` (i.e., `topic<number | null>`).
58
+ *
59
+ * **Within a reactive fn:** detect the empty-topic case via
60
+ * `ctx.prevData[i] === undefined` for the dep slot holding `topic.latest`,
61
+ * or check `latest.cache === undefined` outside reactive code. No
62
+ * separate `hasLatest` companion needed — the SENTINEL is the answer.
63
+ */
64
+ latest;
65
+ constructor(name, opts = {}) {
66
+ super(name, opts.graph);
67
+ this._log = reactiveLog([], {
68
+ name: "events",
69
+ maxSize: opts.retainedLimit ?? DEFAULT_TOPIC_RETAINED_LIMIT
70
+ });
71
+ this.events = this._log.entries;
72
+ this.add(this.events, { name: "events" });
73
+ this.latest = this.derived(
74
+ "latest",
75
+ ["events"],
76
+ (batchData, ctx) => {
77
+ const data = batchData.map(
78
+ (batch2, i) => batch2 != null && batch2.length > 0 ? batch2.at(-1) : ctx.prevData[i]
79
+ );
80
+ const entries = data[0];
81
+ return entries.length === 0 ? [] : [entries[entries.length - 1]];
82
+ },
83
+ { meta: messagingMeta("topic_latest") }
84
+ );
85
+ this.addDisposer(keepalive(this.latest));
86
+ this.addDisposer(() => {
87
+ this.events.down([[COMPLETE]]);
88
+ });
89
+ this.addDisposer(() => this._log.disposeAllViews());
90
+ this._publishImpl = mutate(
91
+ (value) => {
92
+ this._log.append(value);
93
+ },
94
+ { frame: "inline", freeze: false }
95
+ );
96
+ }
97
+ publish(value) {
98
+ if (value === void 0) {
99
+ throw new TypeError(
100
+ `TopicGraph "${this.name}": publish(undefined) is not allowed (spec \xA75.12 SENTINEL).`
101
+ );
102
+ }
103
+ this._publishImpl(value);
104
+ }
105
+ /**
106
+ * Wire one or more append-log storage tiers (Audit 4). Each tier receives
107
+ * appended events per wave; rollback honors the wave-as-transaction model.
108
+ *
109
+ * Named `attachEventStorage` (not `attachStorage`) to avoid colliding with
110
+ * the inherited {@link Graph.attachSnapshotStorage} which takes the
111
+ * paired `AttachSnapshotTierPair[]` shape (Phase 14.6) — distinct
112
+ * concerns, distinct surfaces.
113
+ *
114
+ * @returns Disposer.
115
+ */
116
+ attachEventStorage(tiers) {
117
+ return this._log.attachStorage(tiers);
118
+ }
119
+ retained() {
120
+ return this.events.cache;
121
+ }
122
+ /** Internal log bundle — used by TopicBridgeGraph for `attach`. */
123
+ get _logBundle() {
124
+ return this._log;
125
+ }
126
+ };
127
+ var SubscriptionGraph = class extends Graph {
128
+ cursor;
129
+ available;
130
+ /**
131
+ * Reference to the upstream topic graph. Intentionally NOT mounted
132
+ * under this subscription: a subscription is a VIEW over an
133
+ * externally-owned topic. Double-mounting (e.g. hub-owned topic +
134
+ * sub-mount here) would make either-side teardown leave the other
135
+ * holding a dead reference. Node-level `derived([topicEvents], …)`
136
+ * still wires the data dependency across graph boundaries. D1(e).
137
+ */
138
+ topic;
139
+ _disposed = false;
140
+ _ackImpl;
141
+ _pullAndAckImpl;
142
+ constructor(name, topicGraph, opts = {}) {
143
+ super(name, opts.graph);
144
+ this.topic = topicGraph;
145
+ let initialCursor;
146
+ if (opts.from !== void 0) {
147
+ if (opts.from === "retained") {
148
+ initialCursor = 0;
149
+ } else if (opts.from === "now") {
150
+ initialCursor = topicGraph.events.cache.length;
151
+ } else {
152
+ initialCursor = requireNonNegativeInt(opts.from, "subscription from");
153
+ }
154
+ } else {
155
+ initialCursor = requireNonNegativeInt(opts.cursor ?? 0, "subscription cursor");
156
+ }
157
+ this.cursor = this.state("cursor", initialCursor, {
158
+ meta: messagingMeta("subscription_cursor")
159
+ });
160
+ this.available = topicGraph._logBundle.view({ kind: "fromCursor", cursor: this.cursor });
161
+ this.add(this.available, { name: "available" });
162
+ this.addDisposer(keepalive(this.available));
163
+ if (opts.advanceOn !== void 0) {
164
+ const advanceOn = opts.advanceOn;
165
+ let advanceInitialized = false;
166
+ const advancePump = node(
167
+ [advanceOn],
168
+ () => {
169
+ if (!advanceInitialized) {
170
+ advanceInitialized = true;
171
+ return;
172
+ }
173
+ if (this._disposed) return;
174
+ const avail = this.available.cache;
175
+ if (avail.length === 0) return;
176
+ const next = this.cursor.cache + avail.length;
177
+ this.cursor.emit(next);
178
+ },
179
+ {
180
+ name: "advancePump",
181
+ describeKind: "effect",
182
+ meta: messagingMeta("subscription_advance_pump")
183
+ }
184
+ );
185
+ this.add(advancePump, { name: "advancePump" });
186
+ this.addDisposer(keepalive(advancePump));
187
+ }
188
+ this._ackImpl = mutate(
189
+ (count) => {
190
+ const available = this.available.cache;
191
+ const requested = count === void 0 ? available.length : requireNonNegativeInt(count, "subscription ack count");
192
+ const step = Math.min(requested, available.length);
193
+ if (step <= 0) return this.cursor.cache;
194
+ const next = this.cursor.cache + step;
195
+ this.cursor.emit(next);
196
+ return next;
197
+ },
198
+ { frame: "inline", freeze: false }
199
+ );
200
+ this._pullAndAckImpl = mutate(
201
+ (limit) => {
202
+ const available = this.available.cache;
203
+ const max = limit === void 0 ? available.length : requireNonNegativeInt(limit, "subscription pullAndAck limit");
204
+ const items = available.slice(0, max);
205
+ if (items.length === 0) return { items, cursor: this.cursor.cache };
206
+ const next = this.cursor.cache + items.length;
207
+ this.cursor.emit(next);
208
+ return { items, cursor: next };
209
+ },
210
+ { frame: "inline", freeze: false }
211
+ );
212
+ }
213
+ ack(count) {
214
+ if (this._disposed) return this.cursor.cache;
215
+ return this._ackImpl(count);
216
+ }
217
+ pull(limit) {
218
+ if (this._disposed) return [];
219
+ const available = this.available.cache;
220
+ const max = limit === void 0 ? available.length : requireNonNegativeInt(limit, "subscription pull limit");
221
+ return available.slice(0, max);
222
+ }
223
+ /**
224
+ * Atomic pull-and-acknowledge. Returns `{ items, cursor }` where `cursor`
225
+ * is the new cursor position after advancing. Under single-threaded JS the
226
+ * snapshot and advance are atomic; PY callers use a per-subscription Lock.
227
+ *
228
+ * Replaces `pull(limit, { ack: true })`.
229
+ */
230
+ pullAndAck(limit) {
231
+ if (this._disposed) return { items: [], cursor: this.cursor.cache };
232
+ return this._pullAndAckImpl(limit);
233
+ }
234
+ /**
235
+ * Release internal subscriptions and mark the subscription torn-down.
236
+ * Subsequent `pull`, `pullAndAck`, `ack` return empty / current cursor.
237
+ * Emits COMPLETE on `cursor` so derived consumers (e.g. `available`) see
238
+ * the termination signal. Also drains `addDisposer` callbacks (including
239
+ * the `keepalive(advancePump)` subscription) so no keepalive leak occurs.
240
+ */
241
+ dispose() {
242
+ if (this._disposed) return;
243
+ this._disposed = true;
244
+ this.cursor.down([[COMPLETE]]);
245
+ this.destroy();
246
+ }
247
+ };
248
+ var TopicBridgeGraph = class extends Graph {
249
+ _sourceSub;
250
+ bridgedCount;
251
+ /**
252
+ * Emits each mapped batch as DATA — gives downstream observers a reactive
253
+ * stream of bridged values. Also the link target for `target._log.attach`.
254
+ */
255
+ output;
256
+ constructor(name, sourceTopic, targetTopic, opts = {}) {
257
+ super(name, opts.graph);
258
+ this._sourceSub = subscription(`${name}-subscription`, sourceTopic, {
259
+ cursor: opts.cursor
260
+ });
261
+ this.mount("subscription", this._sourceSub);
262
+ const maxPerPump = Math.max(
263
+ 1,
264
+ requireNonNegativeInt(opts.maxPerPump ?? DEFAULT_MAX_PER_PUMP, "topic bridge maxPerPump")
265
+ );
266
+ const mapValue = opts.map ?? ((value) => value);
267
+ this.output = node(
268
+ [this._sourceSub.available],
269
+ (batchData, actions, ctx) => {
270
+ const data = batchData.map(
271
+ (batch2, i) => batch2 != null && batch2.length > 0 ? batch2.at(-1) : ctx.prevData[i]
272
+ );
273
+ const arr = data[0];
274
+ const outBatch = [];
275
+ const take = Math.min(arr.length, maxPerPump);
276
+ for (let i = 0; i < take; i++) {
277
+ const mapped = mapValue(arr[i]);
278
+ if (mapped !== void 0) outBatch.push(mapped);
279
+ }
280
+ actions.emit(outBatch);
281
+ },
282
+ {
283
+ name: "output",
284
+ describeKind: "derived",
285
+ meta: messagingMeta("topic_bridge_output", { targetRef: targetTopic.name }),
286
+ initial: []
287
+ }
288
+ );
289
+ this.add(this.output, { name: "output" });
290
+ this.addDisposer(keepalive(this.output));
291
+ this.bridgedCount = this.state("bridgedCount", 0, {
292
+ meta: messagingMeta("topic_bridge_count")
293
+ });
294
+ this.addDisposer(keepalive(this.bridgedCount));
295
+ const outputRef = this.output;
296
+ const subRef = this._sourceSub;
297
+ const countRef = this.bridgedCount;
298
+ const ackPump = this.effect(
299
+ "ackPump",
300
+ ["output"],
301
+ () => {
302
+ const outBatch = outputRef.cache;
303
+ if (outBatch.length === 0) return;
304
+ const availLen = subRef.available.cache.length;
305
+ const toAck = Math.min(availLen, maxPerPump);
306
+ if (toAck > 0) {
307
+ subRef.ack(toAck);
308
+ const prev = countRef.cache ?? 0;
309
+ countRef.emit(prev + outBatch.length);
310
+ }
311
+ },
312
+ {
313
+ meta: messagingMeta("topic_bridge_ack_pump")
314
+ }
315
+ );
316
+ this.addDisposer(keepalive(ackPump));
317
+ const detach = _attachArrayToLog(this.output, targetTopic);
318
+ this.addDisposer(detach);
319
+ }
320
+ };
321
+ function _attachArrayToLog(source, targetTopic) {
322
+ return source.subscribe((msgs) => {
323
+ for (const m of msgs) {
324
+ if (m[0] !== DATA) continue;
325
+ const arr = m[1];
326
+ if (arr.length === 0) continue;
327
+ batch(() => {
328
+ for (const v of arr) targetTopic.publish(v);
329
+ });
330
+ }
331
+ });
332
+ }
333
+ var TopicRegistry = class {
334
+ _map = /* @__PURE__ */ new Map();
335
+ /** Reactive monotonic version counter. Advances on topic create/remove. */
336
+ version;
337
+ constructor(versionNode) {
338
+ this.version = versionNode;
339
+ }
340
+ get size() {
341
+ return this._map.size;
342
+ }
343
+ has(name) {
344
+ return this._map.has(name);
345
+ }
346
+ get(name) {
347
+ return this._map.get(name);
348
+ }
349
+ set(name, t) {
350
+ this._map.set(name, t);
351
+ }
352
+ delete(name) {
353
+ return this._map.delete(name);
354
+ }
355
+ keys() {
356
+ return this._map.keys();
357
+ }
358
+ };
359
+ var MessagingHubGraph = class extends Graph {
360
+ _registry;
361
+ /** Reactive monotonic version counter — advances on topic create/remove. */
362
+ version;
363
+ _defaultTopicOptions;
364
+ _removeTopicImpl;
365
+ constructor(name, opts = {}) {
366
+ super(name, opts.graph);
367
+ const versionNode = this.state("version", 0, {
368
+ meta: messagingMeta("hub_version")
369
+ });
370
+ this.version = versionNode;
371
+ this._registry = new TopicRegistry(versionNode);
372
+ this._defaultTopicOptions = { ...opts.defaultTopicOptions ?? {} };
373
+ this._removeTopicImpl = mutate(
374
+ (topicName) => {
375
+ try {
376
+ this.remove(topicName);
377
+ } finally {
378
+ this._registry.delete(topicName);
379
+ const cur = this.version.cache ?? 0;
380
+ this.version.emit(cur + 1);
381
+ }
382
+ },
383
+ { frame: "inline", freeze: false }
384
+ );
385
+ }
386
+ /** Number of topics currently in the hub. */
387
+ get size() {
388
+ return this._registry.size;
389
+ }
390
+ /** Checks topic existence without creating. */
391
+ has(name) {
392
+ return this._registry.has(name);
393
+ }
394
+ /** Iterator over topic names. */
395
+ topicNames() {
396
+ return this._registry.keys();
397
+ }
398
+ /**
399
+ * Returns the {@link TopicGraph} for `name`, creating lazily on first call.
400
+ * Subsequent calls with the same name return the same instance (options on
401
+ * repeat calls are ignored — the topic is already configured).
402
+ */
403
+ topic(name, opts) {
404
+ let t = this._registry.get(name);
405
+ if (t === void 0) {
406
+ const effective = { ...this._defaultTopicOptions, ...opts ?? {} };
407
+ t = new TopicGraph(name, effective);
408
+ this._registry.set(name, t);
409
+ this.mount(name, t);
410
+ const cur = this.version.cache ?? 0;
411
+ this.version.emit(cur + 1);
412
+ }
413
+ return t;
414
+ }
415
+ /**
416
+ * Publishes a value to the topic, lazily creating it on first publish.
417
+ *
418
+ * **Late-subscriber caveat:** the topic is created lazily, so subscribers
419
+ * that attach AFTER a publish only see the retained window (governed by
420
+ * `retainedLimit` on `TopicOptions` / `defaultTopicOptions`). If
421
+ * `retainedLimit === 0` is set explicitly, early publishes are
422
+ * effectively dropped — prefer an unset `retainedLimit` (unbounded
423
+ * retention) or subscribe before publishing when late-subscribers matter.
424
+ */
425
+ publish(name, value) {
426
+ this.topic(name).publish(value);
427
+ }
428
+ /**
429
+ * Bulk publish — issues all publishes inside one outer batch. New topics
430
+ * are created on demand. No-op if `entries` yields nothing.
431
+ *
432
+ * **Iterable consumption (F6):** `entries` is consumed once (single-pass)
433
+ * INSIDE the batch frame. If the iterator throws mid-way, the batch is
434
+ * discarded and NO publishes are visible to subscribers (all-or-nothing).
435
+ * Pass an array or `Set` for multi-shot callers.
436
+ */
437
+ publishMany(entries) {
438
+ batch(() => {
439
+ for (const [name, value] of entries) {
440
+ this.topic(name).publish(value);
441
+ }
442
+ });
443
+ }
444
+ /**
445
+ * Creates a {@link SubscriptionGraph} over a named topic. The topic is
446
+ * lazily created if missing. Subscription lifecycle is owned by the caller —
447
+ * the hub does NOT mount the subscription.
448
+ *
449
+ * @param subName - Local name for the subscription graph.
450
+ * @param topicName - Hub topic to subscribe to.
451
+ * @param opts - `SubscriptionOptions` (initial cursor, etc.).
452
+ */
453
+ subscribe(subName, topicName, opts) {
454
+ const t = this.topic(topicName);
455
+ return new SubscriptionGraph(subName, t, opts);
456
+ }
457
+ /**
458
+ * Unmounts and tears down the topic's graph. Returns `true` if the topic
459
+ * existed. Subscribers receive `TEARDOWN` via {@link Graph.remove}.
460
+ *
461
+ * **Closure-state caveat:** the registry mutation (`_registry.delete`) and
462
+ * version bump happen in a `try/finally`, so registry/version converge to
463
+ * a consistent state even when {@link Graph.remove} throws. `mutate`
464
+ * does not roll back this mutation on throw — `Map.delete` on closure
465
+ * state is invisible to any batch frame. The pre-existing try/finally is
466
+ * load-bearing for that invariant.
467
+ */
468
+ removeTopic(name) {
469
+ if (!this._registry.has(name)) return false;
470
+ this._removeTopicImpl(name);
471
+ return true;
472
+ }
473
+ };
474
+ function topic(name, opts) {
475
+ return new TopicGraph(name, opts);
476
+ }
477
+ function messagingHub(name, opts) {
478
+ return new MessagingHubGraph(name, opts);
479
+ }
480
+ function subscription(name, topicGraph, opts) {
481
+ return new SubscriptionGraph(name, topicGraph, opts);
482
+ }
483
+ function topicBridge(name, sourceTopic, targetTopic, opts) {
484
+ return new TopicBridgeGraph(name, sourceTopic, targetTopic, opts);
485
+ }
486
+
487
+ export {
488
+ topicPublishKeyOf,
489
+ subscriptionAckKeyOf,
490
+ subscriptionPullAndAckKeyOf,
491
+ hubRemoveTopicKeyOf,
492
+ PROMPTS_TOPIC,
493
+ RESPONSES_TOPIC,
494
+ INJECTIONS_TOPIC,
495
+ DEFERRED_TOPIC,
496
+ SPAWNS_TOPIC,
497
+ CONTEXT_TOPIC,
498
+ TODOS_TOPIC,
499
+ STANDARD_TOPICS,
500
+ TopicGraph,
501
+ SubscriptionGraph,
502
+ TopicBridgeGraph,
503
+ TopicRegistry,
504
+ MessagingHubGraph,
505
+ topic,
506
+ messagingHub,
507
+ subscription,
508
+ topicBridge
509
+ };
510
+ //# sourceMappingURL=chunk-Q3EYOCZB.js.map