@graphrefly/graphrefly 0.44.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (720) hide show
  1. package/README.md +22 -19
  2. package/dist/_internal-B23BagFd.d.cts +33 -0
  3. package/dist/_internal-B23BagFd.d.ts +33 -0
  4. package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
  5. package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
  6. package/dist/agents-C0Ji9ldU.d.cts +629 -0
  7. package/dist/agents-C9zexT7I.d.ts +629 -0
  8. package/dist/audit-BAXb3VOg.d.ts +246 -0
  9. package/dist/audit-C_bPfkqS.d.cts +246 -0
  10. package/dist/backoff-7KIK3WQW.js +24 -0
  11. package/dist/backoff-7KIK3WQW.js.map +1 -0
  12. package/dist/backoff-Bnb9OoPh.d.cts +6 -0
  13. package/dist/backoff-Bnb9OoPh.d.ts +6 -0
  14. package/dist/base/composition/index.cjs +811 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +469 -0
  17. package/dist/base/composition/index.d.ts +469 -0
  18. package/dist/base/composition/index.js +40 -0
  19. package/dist/base/composition/index.js.map +1 -0
  20. package/dist/base/index.cjs +6336 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +22 -0
  23. package/dist/base/index.d.ts +22 -0
  24. package/dist/base/index.js +259 -0
  25. package/dist/base/index.js.map +1 -0
  26. package/dist/base/io/index.cjs +3270 -0
  27. package/dist/base/io/index.cjs.map +1 -0
  28. package/dist/base/io/index.d.cts +2245 -0
  29. package/dist/base/io/index.d.ts +2245 -0
  30. package/dist/base/io/index.js +117 -0
  31. package/dist/base/io/index.js.map +1 -0
  32. package/dist/base/meta/index.cjs +43 -0
  33. package/dist/base/meta/index.cjs.map +1 -0
  34. package/dist/base/meta/index.d.cts +45 -0
  35. package/dist/base/meta/index.d.ts +45 -0
  36. package/dist/base/meta/index.js +13 -0
  37. package/dist/base/meta/index.js.map +1 -0
  38. package/dist/base/mutation/index.cjs +200 -0
  39. package/dist/base/mutation/index.cjs.map +1 -0
  40. package/dist/base/mutation/index.d.cts +177 -0
  41. package/dist/base/mutation/index.d.ts +177 -0
  42. package/dist/base/mutation/index.js +22 -0
  43. package/dist/base/mutation/index.js.map +1 -0
  44. package/dist/base/render/index.cjs +1120 -0
  45. package/dist/base/render/index.cjs.map +1 -0
  46. package/dist/{extra/render/index.d.ts → base/render/index.d.cts} +75 -31
  47. package/dist/{extra/render/index.d.cts → base/render/index.d.ts} +75 -31
  48. package/dist/base/render/index.js +24 -0
  49. package/dist/base/render/index.js.map +1 -0
  50. package/dist/base/sources/browser/index.cjs +172 -0
  51. package/dist/base/sources/browser/index.cjs.map +1 -0
  52. package/dist/base/sources/browser/index.d.cts +84 -0
  53. package/dist/base/sources/browser/index.d.ts +84 -0
  54. package/dist/base/sources/browser/index.js +151 -0
  55. package/dist/base/sources/browser/index.js.map +1 -0
  56. package/dist/base/sources/event/index.cjs +98 -0
  57. package/dist/base/sources/event/index.cjs.map +1 -0
  58. package/dist/base/sources/event/index.d.cts +91 -0
  59. package/dist/base/sources/event/index.d.ts +91 -0
  60. package/dist/base/sources/event/index.js +13 -0
  61. package/dist/base/sources/event/index.js.map +1 -0
  62. package/dist/base/sources/index.cjs +755 -0
  63. package/dist/base/sources/index.cjs.map +1 -0
  64. package/dist/{extra/sources.d.ts → base/sources/index.d.cts} +74 -301
  65. package/dist/{extra/sources.d.cts → base/sources/index.d.ts} +74 -301
  66. package/dist/base/sources/index.js +42 -0
  67. package/dist/base/sources/index.js.map +1 -0
  68. package/dist/base/sources/node/index.cjs +320 -0
  69. package/dist/base/sources/node/index.cjs.map +1 -0
  70. package/dist/{extra/node.d.ts → base/sources/node/index.d.cts} +35 -37
  71. package/dist/{extra/node.d.cts → base/sources/node/index.d.ts} +35 -37
  72. package/dist/base/sources/node/index.js +306 -0
  73. package/dist/base/sources/node/index.js.map +1 -0
  74. package/dist/base/utils/index.cjs +37 -0
  75. package/dist/base/utils/index.cjs.map +1 -0
  76. package/dist/base/utils/index.d.cts +37 -0
  77. package/dist/base/utils/index.d.ts +37 -0
  78. package/dist/base/utils/index.js +11 -0
  79. package/dist/base/utils/index.js.map +1 -0
  80. package/dist/base/worker/index.cjs +548 -0
  81. package/dist/base/worker/index.cjs.map +1 -0
  82. package/dist/base/worker/index.d.cts +207 -0
  83. package/dist/base/worker/index.d.ts +207 -0
  84. package/dist/base/worker/index.js +20 -0
  85. package/dist/base/worker/index.js.map +1 -0
  86. package/dist/breaker-C9skL3d8.d.ts +175 -0
  87. package/dist/breaker-ugSdq54q.d.cts +175 -0
  88. package/dist/{cascading-BglDkMdX.d.cts → cascading-CSSbKGrJ.d.ts} +3 -3
  89. package/dist/{cascading-MFgxu7Yo.d.ts → cascading-baGkiihI.d.cts} +3 -3
  90. package/dist/chunk-255UCBG4.js +58 -0
  91. package/dist/chunk-255UCBG4.js.map +1 -0
  92. package/dist/chunk-2LO3EL4W.js +1 -0
  93. package/dist/chunk-2LO3EL4W.js.map +1 -0
  94. package/dist/chunk-2OB3CEJS.js +1065 -0
  95. package/dist/chunk-2OB3CEJS.js.map +1 -0
  96. package/dist/chunk-36NMM65U.js +144 -0
  97. package/dist/chunk-36NMM65U.js.map +1 -0
  98. package/dist/chunk-3CEXCBN6.js +1 -0
  99. package/dist/chunk-3CEXCBN6.js.map +1 -0
  100. package/dist/chunk-3MUSLI6E.js +105 -0
  101. package/dist/chunk-3MUSLI6E.js.map +1 -0
  102. package/dist/chunk-3PSLNJDU.js +884 -0
  103. package/dist/chunk-3PSLNJDU.js.map +1 -0
  104. package/dist/chunk-3QZY5BI7.js +92 -0
  105. package/dist/chunk-3QZY5BI7.js.map +1 -0
  106. package/dist/chunk-42FQ27MQ.js +594 -0
  107. package/dist/chunk-42FQ27MQ.js.map +1 -0
  108. package/dist/chunk-4GYMCUDZ.js +1085 -0
  109. package/dist/chunk-4GYMCUDZ.js.map +1 -0
  110. package/dist/chunk-4S53H2KR.js +382 -0
  111. package/dist/chunk-4S53H2KR.js.map +1 -0
  112. package/dist/chunk-4XCHZRUJ.js +128 -0
  113. package/dist/chunk-4XCHZRUJ.js.map +1 -0
  114. package/dist/chunk-5THCXDWY.js +725 -0
  115. package/dist/chunk-5THCXDWY.js.map +1 -0
  116. package/dist/chunk-6XZYT4SW.js +256 -0
  117. package/dist/chunk-6XZYT4SW.js.map +1 -0
  118. package/dist/chunk-7EGRP2VX.js +76 -0
  119. package/dist/chunk-7EGRP2VX.js.map +1 -0
  120. package/dist/chunk-A7KV5UK4.js +150 -0
  121. package/dist/chunk-A7KV5UK4.js.map +1 -0
  122. package/dist/chunk-APY2SS5X.js +156 -0
  123. package/dist/chunk-APY2SS5X.js.map +1 -0
  124. package/dist/chunk-AZDQPQ3V.js +66 -0
  125. package/dist/chunk-AZDQPQ3V.js.map +1 -0
  126. package/dist/chunk-BU3SEFA5.js +90 -0
  127. package/dist/chunk-BU3SEFA5.js.map +1 -0
  128. package/dist/chunk-BXGZFGZ4.js +189 -0
  129. package/dist/chunk-BXGZFGZ4.js.map +1 -0
  130. package/dist/chunk-CGHORL6G.js +579 -0
  131. package/dist/chunk-CGHORL6G.js.map +1 -0
  132. package/dist/chunk-CXANAIZU.js +530 -0
  133. package/dist/chunk-CXANAIZU.js.map +1 -0
  134. package/dist/chunk-CZQHCKKG.js +1 -0
  135. package/dist/chunk-CZQHCKKG.js.map +1 -0
  136. package/dist/chunk-DKNHAICT.js +133 -0
  137. package/dist/chunk-DKNHAICT.js.map +1 -0
  138. package/dist/chunk-DM4OMPWK.js +584 -0
  139. package/dist/chunk-DM4OMPWK.js.map +1 -0
  140. package/dist/chunk-DMSNO6ZB.js +452 -0
  141. package/dist/chunk-DMSNO6ZB.js.map +1 -0
  142. package/dist/chunk-E5OZPDIW.js +229 -0
  143. package/dist/chunk-E5OZPDIW.js.map +1 -0
  144. package/dist/chunk-EVYY4X5A.js +509 -0
  145. package/dist/chunk-EVYY4X5A.js.map +1 -0
  146. package/dist/chunk-FDFD67UO.js +1 -0
  147. package/dist/chunk-FDFD67UO.js.map +1 -0
  148. package/dist/chunk-FMPF42Q4.js +13 -0
  149. package/dist/chunk-FMPF42Q4.js.map +1 -0
  150. package/dist/chunk-FR6RGA3B.js +1277 -0
  151. package/dist/chunk-FR6RGA3B.js.map +1 -0
  152. package/dist/chunk-FW23JYNQ.js +454 -0
  153. package/dist/chunk-FW23JYNQ.js.map +1 -0
  154. package/dist/chunk-GBCENOLN.js +1575 -0
  155. package/dist/chunk-GBCENOLN.js.map +1 -0
  156. package/dist/chunk-HL7HUJIX.js +1 -0
  157. package/dist/chunk-HL7HUJIX.js.map +1 -0
  158. package/dist/chunk-HULCUY35.js +2508 -0
  159. package/dist/chunk-HULCUY35.js.map +1 -0
  160. package/dist/chunk-IHTWQEDR.js +169 -0
  161. package/dist/chunk-IHTWQEDR.js.map +1 -0
  162. package/dist/chunk-IJRR6YAI.js +128 -0
  163. package/dist/chunk-IJRR6YAI.js.map +1 -0
  164. package/dist/chunk-JGFRAFDL.js +221 -0
  165. package/dist/chunk-JGFRAFDL.js.map +1 -0
  166. package/dist/chunk-KIIXR252.js +211 -0
  167. package/dist/chunk-KIIXR252.js.map +1 -0
  168. package/dist/chunk-KN3H5CNT.js +11 -0
  169. package/dist/chunk-KN3H5CNT.js.map +1 -0
  170. package/dist/chunk-KPG3DGLA.js +1 -0
  171. package/dist/chunk-KPG3DGLA.js.map +1 -0
  172. package/dist/chunk-KRNQ6RGQ.js +1 -0
  173. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  174. package/dist/chunk-LBAJK24K.js +1071 -0
  175. package/dist/chunk-LBAJK24K.js.map +1 -0
  176. package/dist/chunk-MLTPJMH6.js +417 -0
  177. package/dist/chunk-MLTPJMH6.js.map +1 -0
  178. package/dist/chunk-N3SZ7BMH.js +95 -0
  179. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  180. package/dist/chunk-NDUD3IMO.js +540 -0
  181. package/dist/chunk-NDUD3IMO.js.map +1 -0
  182. package/dist/chunk-NY2PYHNC.js +873 -0
  183. package/dist/chunk-NY2PYHNC.js.map +1 -0
  184. package/dist/chunk-O3MT7DYI.js +225 -0
  185. package/dist/chunk-O3MT7DYI.js.map +1 -0
  186. package/dist/chunk-OCUDSN63.js +2386 -0
  187. package/dist/chunk-OCUDSN63.js.map +1 -0
  188. package/dist/chunk-OIWU3NYV.js +199 -0
  189. package/dist/chunk-OIWU3NYV.js.map +1 -0
  190. package/dist/chunk-OO5BM6CJ.js +1153 -0
  191. package/dist/chunk-OO5BM6CJ.js.map +1 -0
  192. package/dist/chunk-OQUIJT7A.js +1 -0
  193. package/dist/chunk-OQUIJT7A.js.map +1 -0
  194. package/dist/chunk-P5LBT622.js +105 -0
  195. package/dist/chunk-P5LBT622.js.map +1 -0
  196. package/dist/chunk-PKGQG5QQ.js +519 -0
  197. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  198. package/dist/chunk-PKPO3JTZ.js +561 -0
  199. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  200. package/dist/chunk-PL5UDIQ5.js +118 -0
  201. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  202. package/dist/chunk-PZWISPIQ.js +432 -0
  203. package/dist/chunk-PZWISPIQ.js.map +1 -0
  204. package/dist/chunk-Q3EYOCZB.js +510 -0
  205. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  206. package/dist/chunk-QMBYUVRL.js +15 -0
  207. package/dist/chunk-QMBYUVRL.js.map +1 -0
  208. package/dist/chunk-RAGGHLCV.js +200 -0
  209. package/dist/chunk-RAGGHLCV.js.map +1 -0
  210. package/dist/chunk-RGL53X5G.js +574 -0
  211. package/dist/chunk-RGL53X5G.js.map +1 -0
  212. package/dist/chunk-RJOG4IJU.js +1039 -0
  213. package/dist/chunk-RJOG4IJU.js.map +1 -0
  214. package/dist/chunk-SOOKUYVM.js +403 -0
  215. package/dist/chunk-SOOKUYVM.js.map +1 -0
  216. package/dist/chunk-T5BN5KG7.js +1 -0
  217. package/dist/chunk-T5BN5KG7.js.map +1 -0
  218. package/dist/chunk-TP7244Y6.js +207 -0
  219. package/dist/chunk-TP7244Y6.js.map +1 -0
  220. package/dist/chunk-TSBFTJKM.js +57 -0
  221. package/dist/chunk-TSBFTJKM.js.map +1 -0
  222. package/dist/chunk-URQ2CBBF.js +143 -0
  223. package/dist/chunk-URQ2CBBF.js.map +1 -0
  224. package/dist/chunk-W2BOPXTI.js +1 -0
  225. package/dist/chunk-W2BOPXTI.js.map +1 -0
  226. package/dist/chunk-WKSWLSCX.js +207 -0
  227. package/dist/chunk-WKSWLSCX.js.map +1 -0
  228. package/dist/chunk-Y52CS6YA.js +88 -0
  229. package/dist/chunk-Y52CS6YA.js.map +1 -0
  230. package/dist/chunk-YCBUWK77.js +92 -0
  231. package/dist/chunk-YCBUWK77.js.map +1 -0
  232. package/dist/chunk-YJ4U2D2C.js +314 -0
  233. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  234. package/dist/chunk-Z4YXAUDN.js +239 -0
  235. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  236. package/dist/chunk-Z6EGP5D7.js +92 -0
  237. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  238. package/dist/compat/index.cjs +3100 -9
  239. package/dist/compat/index.cjs.map +1 -0
  240. package/dist/compat/index.d.cts +112 -18
  241. package/dist/compat/index.d.ts +112 -18
  242. package/dist/compat/index.js +176 -1
  243. package/dist/compat/index.js.map +1 -0
  244. package/dist/compat/jotai/index.cjs +149 -1
  245. package/dist/compat/jotai/index.cjs.map +1 -0
  246. package/dist/compat/jotai/index.d.cts +2 -2
  247. package/dist/compat/jotai/index.d.ts +2 -2
  248. package/dist/compat/jotai/index.js +8 -1
  249. package/dist/compat/jotai/index.js.map +1 -0
  250. package/dist/compat/nanostores/index.cjs +205 -1
  251. package/dist/compat/nanostores/index.cjs.map +1 -0
  252. package/dist/compat/nanostores/index.d.cts +2 -2
  253. package/dist/compat/nanostores/index.d.ts +2 -2
  254. package/dist/compat/nanostores/index.js +22 -1
  255. package/dist/compat/nanostores/index.js.map +1 -0
  256. package/dist/compat/nestjs/index.cjs +2241 -9
  257. package/dist/compat/nestjs/index.cjs.map +1 -0
  258. package/dist/compat/nestjs/index.d.cts +7 -10
  259. package/dist/compat/nestjs/index.d.ts +7 -10
  260. package/dist/compat/nestjs/index.js +78 -1
  261. package/dist/compat/nestjs/index.js.map +1 -0
  262. package/dist/compat/react/index.cjs +114 -1
  263. package/dist/compat/react/index.cjs.map +1 -0
  264. package/dist/compat/react/index.d.cts +2 -2
  265. package/dist/compat/react/index.d.ts +2 -2
  266. package/dist/compat/react/index.js +12 -1
  267. package/dist/compat/react/index.js.map +1 -0
  268. package/dist/compat/solid/index.cjs +101 -1
  269. package/dist/compat/solid/index.cjs.map +1 -0
  270. package/dist/compat/solid/index.d.cts +2 -2
  271. package/dist/compat/solid/index.d.ts +2 -2
  272. package/dist/compat/solid/index.js +12 -1
  273. package/dist/compat/solid/index.js.map +1 -0
  274. package/dist/compat/svelte/index.cjs +104 -1
  275. package/dist/compat/svelte/index.cjs.map +1 -0
  276. package/dist/compat/svelte/index.d.cts +2 -2
  277. package/dist/compat/svelte/index.d.ts +2 -2
  278. package/dist/compat/svelte/index.js +12 -1
  279. package/dist/compat/svelte/index.js.map +1 -0
  280. package/dist/compat/vue/index.cjs +119 -1
  281. package/dist/compat/vue/index.cjs.map +1 -0
  282. package/dist/compat/vue/index.d.cts +2 -2
  283. package/dist/compat/vue/index.d.ts +2 -2
  284. package/dist/compat/vue/index.js +12 -1
  285. package/dist/compat/vue/index.js.map +1 -0
  286. package/dist/compat/zustand/index.cjs +69 -3
  287. package/dist/compat/zustand/index.cjs.map +1 -0
  288. package/dist/compat/zustand/index.d.cts +2 -6
  289. package/dist/compat/zustand/index.d.ts +2 -6
  290. package/dist/compat/zustand/index.js +8 -1
  291. package/dist/compat/zustand/index.js.map +1 -0
  292. package/dist/distill-De6Rnn15.d.cts +48 -0
  293. package/dist/distill-De6Rnn15.d.ts +48 -0
  294. package/dist/external-register-CWyroXb_.d.cts +138 -0
  295. package/dist/external-register-CWyroXb_.d.ts +138 -0
  296. package/dist/{fallback-74oxi34l.d.cts → fallback-Bx46zqky.d.cts} +3 -10
  297. package/dist/{fallback-DUyyBTBK.d.ts → fallback-pIWW8A2d.d.ts} +3 -10
  298. package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
  299. package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
  300. package/dist/{index-CBGUK09R.d.ts → index-5SU_O78r.d.cts} +5 -5
  301. package/dist/{index-BmZXHqkE.d.ts → index-B6pxYJzO.d.cts} +1 -1
  302. package/dist/{index-hcDJ8PSI.d.cts → index-B6pxYJzO.d.ts} +1 -1
  303. package/dist/{index-C5stwKcw.d.cts → index-BFsng6v1.d.cts} +1 -1
  304. package/dist/{index-CdAlHFEt.d.ts → index-BFsng6v1.d.ts} +1 -1
  305. package/dist/{index-_6ODbuOu.d.cts → index-Bg-LwEt-.d.cts} +1 -1
  306. package/dist/{index-CviRnE4K.d.ts → index-Bg-LwEt-.d.ts} +1 -1
  307. package/dist/{index-CBBLl_rc.d.ts → index-Brp888t0.d.cts} +1 -1
  308. package/dist/{index-BQSKmbuG.d.cts → index-Brp888t0.d.ts} +1 -1
  309. package/dist/{index-sqkqlb1p.d.ts → index-CDfk6jHN.d.cts} +1 -1
  310. package/dist/{index-ZVQhLa2i.d.cts → index-CDfk6jHN.d.ts} +1 -1
  311. package/dist/{index-Climxqsu.d.cts → index-CEXCtYYJ.d.ts} +5 -5
  312. package/dist/index-DLAxYaN5.d.cts +169 -0
  313. package/dist/index-DLAxYaN5.d.ts +169 -0
  314. package/dist/{index-CK29LV56.d.cts → index-DeWbQzMe.d.cts} +1 -1
  315. package/dist/{index-CPQlGA29.d.ts → index-DeWbQzMe.d.ts} +1 -1
  316. package/dist/{index-BrPrLl4e.d.cts → index-dX9IzPqj.d.cts} +1 -1
  317. package/dist/{index-Dgl1HpPn.d.ts → index-dX9IzPqj.d.ts} +1 -1
  318. package/dist/index.cjs +25934 -191
  319. package/dist/index.cjs.map +1 -0
  320. package/dist/index.d.cts +58 -94
  321. package/dist/index.d.ts +58 -94
  322. package/dist/index.js +852 -1
  323. package/dist/index.js.map +1 -0
  324. package/dist/layout-types-B5aiHYgk.d.cts +72 -0
  325. package/dist/layout-types-B5aiHYgk.d.ts +72 -0
  326. package/dist/memory-composers-BryDrRBX.d.cts +529 -0
  327. package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
  328. package/dist/{observable-DWjNfLvC.d.ts → observable-BXQoW1P-.d.cts} +1 -1
  329. package/dist/{observable-e3eiPPFy.d.cts → observable-BXQoW1P-.d.ts} +1 -1
  330. package/dist/{pipeline-graph-Sgj0gCwn.d.ts → pipeline-graph-Ce47CB6Y.d.cts} +13 -10
  331. package/dist/{pipeline-graph-CIKhynsF.d.cts → pipeline-graph-DXCwY9vG.d.ts} +13 -10
  332. package/dist/presets/ai/index.cjs +4377 -0
  333. package/dist/presets/ai/index.cjs.map +1 -0
  334. package/dist/presets/ai/index.d.cts +98 -0
  335. package/dist/presets/ai/index.d.ts +98 -0
  336. package/dist/presets/ai/index.js +54 -0
  337. package/dist/presets/ai/index.js.map +1 -0
  338. package/dist/presets/harness/index.cjs +5929 -0
  339. package/dist/presets/harness/index.cjs.map +1 -0
  340. package/dist/presets/harness/index.d.cts +566 -0
  341. package/dist/presets/harness/index.d.ts +566 -0
  342. package/dist/presets/harness/index.js +71 -0
  343. package/dist/presets/harness/index.js.map +1 -0
  344. package/dist/presets/index.cjs +9782 -0
  345. package/dist/presets/index.cjs.map +1 -0
  346. package/dist/presets/index.d.cts +28 -0
  347. package/dist/presets/index.d.ts +28 -0
  348. package/dist/presets/index.js +129 -0
  349. package/dist/presets/index.js.map +1 -0
  350. package/dist/presets/inspect/index.cjs +1087 -0
  351. package/dist/presets/inspect/index.cjs.map +1 -0
  352. package/dist/presets/inspect/index.d.cts +172 -0
  353. package/dist/presets/inspect/index.d.ts +172 -0
  354. package/dist/presets/inspect/index.js +21 -0
  355. package/dist/presets/inspect/index.js.map +1 -0
  356. package/dist/presets/resilience/index.cjs +1593 -0
  357. package/dist/presets/resilience/index.cjs.map +1 -0
  358. package/dist/presets/resilience/index.d.cts +205 -0
  359. package/dist/presets/resilience/index.d.ts +205 -0
  360. package/dist/presets/resilience/index.js +18 -0
  361. package/dist/presets/resilience/index.js.map +1 -0
  362. package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
  363. package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
  364. package/dist/{reactive-layout-DOTs9P3X.d.ts → reactive-layout-fswlBUvX.d.cts} +19 -7
  365. package/dist/{reactive-layout-DgctbqZo.d.cts → reactive-layout-fswlBUvX.d.ts} +19 -7
  366. package/dist/retry-BDbRZ_gx.d.ts +125 -0
  367. package/dist/retry-DWuhjvsA.d.cts +125 -0
  368. package/dist/solutions/index.cjs +8200 -0
  369. package/dist/solutions/index.cjs.map +1 -0
  370. package/dist/solutions/index.d.cts +23 -0
  371. package/dist/solutions/index.d.ts +23 -0
  372. package/dist/solutions/index.js +55 -0
  373. package/dist/solutions/index.js.map +1 -0
  374. package/dist/spawnable-5mDY501F.d.cts +746 -0
  375. package/dist/spawnable-D3lR0oQu.d.ts +746 -0
  376. package/dist/status-U-rUI79b.d.cts +84 -0
  377. package/dist/status-U-rUI79b.d.ts +84 -0
  378. package/dist/timeout-U5O4ESK3.js +12 -0
  379. package/dist/timeout-U5O4ESK3.js.map +1 -0
  380. package/dist/{types-CWFysE9E.d.ts → types-BB5Lw-pB.d.cts} +3 -3
  381. package/dist/{types-C0_yquda.d.cts → types-BB5Lw-pB.d.ts} +3 -3
  382. package/dist/types-CJWIMJiZ.d.ts +548 -0
  383. package/dist/types-vCq7ShIm.d.cts +548 -0
  384. package/dist/utils/ai/browser.cjs +2169 -0
  385. package/dist/utils/ai/browser.cjs.map +1 -0
  386. package/dist/{patterns → utils}/ai/browser.d.cts +7 -5
  387. package/dist/{patterns → utils}/ai/browser.d.ts +7 -5
  388. package/dist/utils/ai/browser.js +255 -0
  389. package/dist/utils/ai/browser.js.map +1 -0
  390. package/dist/utils/ai/index.cjs +8468 -0
  391. package/dist/utils/ai/index.cjs.map +1 -0
  392. package/dist/{index-CR8QpwX8.d.ts → utils/ai/index.d.cts} +73 -976
  393. package/dist/{index-UPSiS-X7.d.cts → utils/ai/index.d.ts} +73 -976
  394. package/dist/utils/ai/index.js +173 -0
  395. package/dist/utils/ai/index.js.map +1 -0
  396. package/dist/utils/ai/node.cjs +648 -0
  397. package/dist/utils/ai/node.cjs.map +1 -0
  398. package/dist/{patterns → utils}/ai/node.d.cts +5 -7
  399. package/dist/{patterns → utils}/ai/node.d.ts +5 -7
  400. package/dist/utils/ai/node.js +84 -0
  401. package/dist/utils/ai/node.js.map +1 -0
  402. package/dist/utils/cqrs/index.cjs +1036 -0
  403. package/dist/utils/cqrs/index.cjs.map +1 -0
  404. package/dist/{index-CeFiHtAg.d.ts → utils/cqrs/index.d.cts} +7 -37
  405. package/dist/{index-B-_tFaqV.d.cts → utils/cqrs/index.d.ts} +7 -37
  406. package/dist/utils/cqrs/index.js +18 -0
  407. package/dist/utils/cqrs/index.js.map +1 -0
  408. package/dist/utils/demo-shell/index.cjs +865 -0
  409. package/dist/utils/demo-shell/index.cjs.map +1 -0
  410. package/dist/{index-B8YnZpIR.d.ts → utils/demo-shell/index.d.cts} +4 -16
  411. package/dist/{index-Cwv0KWcU.d.cts → utils/demo-shell/index.d.ts} +4 -16
  412. package/dist/utils/demo-shell/index.js +13 -0
  413. package/dist/utils/demo-shell/index.js.map +1 -0
  414. package/dist/utils/domain-templates/index.cjs +732 -0
  415. package/dist/utils/domain-templates/index.cjs.map +1 -0
  416. package/dist/{index-CzLVrjxn.d.ts → utils/domain-templates/index.d.cts} +3 -20
  417. package/dist/{index-BaQaY_IQ.d.cts → utils/domain-templates/index.d.ts} +3 -20
  418. package/dist/utils/domain-templates/index.js +17 -0
  419. package/dist/utils/domain-templates/index.js.map +1 -0
  420. package/dist/utils/graphspec/index.cjs +1174 -0
  421. package/dist/utils/graphspec/index.cjs.map +1 -0
  422. package/dist/{index-CMh5Rz1y.d.ts → utils/graphspec/index.d.cts} +106 -42
  423. package/dist/{index-CS0LTlB8.d.cts → utils/graphspec/index.d.ts} +106 -42
  424. package/dist/utils/graphspec/index.js +35 -0
  425. package/dist/utils/graphspec/index.js.map +1 -0
  426. package/dist/utils/harness/index.cjs +656 -0
  427. package/dist/utils/harness/index.cjs.map +1 -0
  428. package/dist/utils/harness/index.d.cts +542 -0
  429. package/dist/utils/harness/index.d.ts +542 -0
  430. package/dist/utils/harness/index.js +56 -0
  431. package/dist/utils/harness/index.js.map +1 -0
  432. package/dist/utils/index.cjs +17609 -0
  433. package/dist/utils/index.cjs.map +1 -0
  434. package/dist/utils/index.d.cts +96 -0
  435. package/dist/utils/index.d.ts +96 -0
  436. package/dist/utils/index.js +514 -0
  437. package/dist/utils/index.js.map +1 -0
  438. package/dist/utils/inspect/index.cjs +807 -0
  439. package/dist/utils/inspect/index.cjs.map +1 -0
  440. package/dist/utils/inspect/index.d.cts +123 -0
  441. package/dist/utils/inspect/index.d.ts +123 -0
  442. package/dist/utils/inspect/index.js +30 -0
  443. package/dist/utils/inspect/index.js.map +1 -0
  444. package/dist/utils/job-queue/index.cjs +717 -0
  445. package/dist/utils/job-queue/index.cjs.map +1 -0
  446. package/dist/{index-DisjX8a-.d.ts → utils/job-queue/index.d.cts} +5 -26
  447. package/dist/{index-DV_1YuVk.d.cts → utils/job-queue/index.d.ts} +5 -26
  448. package/dist/utils/job-queue/index.js +18 -0
  449. package/dist/utils/job-queue/index.js.map +1 -0
  450. package/dist/utils/memory/index.cjs +1451 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/{index-CZ3r5Rxp.d.ts → utils/memory/index.d.cts} +242 -34
  453. package/dist/{index-B17QddL1.d.cts → utils/memory/index.d.ts} +242 -34
  454. package/dist/utils/memory/index.js +19 -0
  455. package/dist/utils/memory/index.js.map +1 -0
  456. package/dist/utils/messaging/index.cjs +666 -0
  457. package/dist/utils/messaging/index.cjs.map +1 -0
  458. package/dist/utils/messaging/index.d.cts +562 -0
  459. package/dist/utils/messaging/index.d.ts +562 -0
  460. package/dist/utils/messaging/index.js +50 -0
  461. package/dist/utils/messaging/index.js.map +1 -0
  462. package/dist/utils/orchestration/index.cjs +876 -0
  463. package/dist/utils/orchestration/index.cjs.map +1 -0
  464. package/dist/utils/orchestration/index.d.cts +233 -0
  465. package/dist/utils/orchestration/index.d.ts +233 -0
  466. package/dist/utils/orchestration/index.js +19 -0
  467. package/dist/utils/orchestration/index.js.map +1 -0
  468. package/dist/utils/process/index.cjs +743 -0
  469. package/dist/utils/process/index.cjs.map +1 -0
  470. package/dist/{index-p09KSrTN.d.ts → utils/process/index.d.cts} +97 -44
  471. package/dist/{index-CasX6Pfq.d.cts → utils/process/index.d.ts} +97 -44
  472. package/dist/utils/process/index.js +14 -0
  473. package/dist/utils/process/index.js.map +1 -0
  474. package/dist/utils/reactive-layout/index.cjs +1607 -0
  475. package/dist/utils/reactive-layout/index.cjs.map +1 -0
  476. package/dist/{index-B5S8ULbU.d.ts → utils/reactive-layout/index.d.cts} +58 -81
  477. package/dist/{index-Dc4AYqrJ.d.cts → utils/reactive-layout/index.d.ts} +58 -81
  478. package/dist/utils/reactive-layout/index.js +52 -0
  479. package/dist/utils/reactive-layout/index.js.map +1 -0
  480. package/dist/utils/reduction/index.cjs +203 -0
  481. package/dist/utils/reduction/index.cjs.map +1 -0
  482. package/dist/{index-Byu-OpX_.d.ts → utils/reduction/index.d.cts} +6 -17
  483. package/dist/{index-tRCxuAXF.d.cts → utils/reduction/index.d.ts} +6 -17
  484. package/dist/utils/reduction/index.js +14 -0
  485. package/dist/utils/reduction/index.js.map +1 -0
  486. package/dist/utils/resilience/index.cjs +1617 -0
  487. package/dist/utils/resilience/index.cjs.map +1 -0
  488. package/dist/utils/resilience/index.d.cts +9 -0
  489. package/dist/utils/resilience/index.d.ts +9 -0
  490. package/dist/utils/resilience/index.js +44 -0
  491. package/dist/utils/resilience/index.js.map +1 -0
  492. package/dist/utils/surface/index.cjs +1070 -0
  493. package/dist/utils/surface/index.cjs.map +1 -0
  494. package/dist/{index-CYq8vAyV.d.ts → utils/surface/index.d.cts} +7 -58
  495. package/dist/{index-CSOmP7xT.d.cts → utils/surface/index.d.ts} +7 -58
  496. package/dist/utils/surface/index.js +30 -0
  497. package/dist/utils/surface/index.js.map +1 -0
  498. package/dist/utils/topology-view/index.cjs +620 -0
  499. package/dist/utils/topology-view/index.cjs.map +1 -0
  500. package/dist/utils/topology-view/index.d.cts +68 -0
  501. package/dist/utils/topology-view/index.d.ts +68 -0
  502. package/dist/utils/topology-view/index.js +11 -0
  503. package/dist/utils/topology-view/index.js.map +1 -0
  504. package/package.json +664 -584
  505. package/dist/backoff-HPZMEZNF.js +0 -1
  506. package/dist/chunk-2T7U5EU6.js +0 -1
  507. package/dist/chunk-3G5U5QNE.js +0 -5
  508. package/dist/chunk-4VVTGLXJ.js +0 -1
  509. package/dist/chunk-5M4CCMMD.js +0 -45
  510. package/dist/chunk-5QDBSZBV.js +0 -1
  511. package/dist/chunk-5XJ6B66J.js +0 -1
  512. package/dist/chunk-6QZNQS5B.js +0 -1
  513. package/dist/chunk-6X7AFUJV.js +0 -9
  514. package/dist/chunk-7K6PWTDQ.js +0 -1
  515. package/dist/chunk-7LIAPXJB.js +0 -1
  516. package/dist/chunk-7WPU3UHQ.js +0 -1
  517. package/dist/chunk-A5WCQ5NO.js +0 -1
  518. package/dist/chunk-APPIWSGD.js +0 -84
  519. package/dist/chunk-BEZWM2SY.js +0 -1
  520. package/dist/chunk-C72GO4IZ.js +0 -1
  521. package/dist/chunk-CB676TKJ.js +0 -1
  522. package/dist/chunk-CE6TI2TL.js +0 -1
  523. package/dist/chunk-CE72X3WO.js +0 -1
  524. package/dist/chunk-CK2E7BTU.js +0 -1
  525. package/dist/chunk-CLVB32RD.js +0 -1
  526. package/dist/chunk-CRVT7D2P.js +0 -1
  527. package/dist/chunk-D5RFJOZ2.js +0 -1
  528. package/dist/chunk-D7GPHKFH.js +0 -1
  529. package/dist/chunk-DHRX7JX4.js +0 -2
  530. package/dist/chunk-ESMPEKEV.js +0 -1
  531. package/dist/chunk-F672GV32.js +0 -1
  532. package/dist/chunk-FZMYDOWV.js +0 -1
  533. package/dist/chunk-GHBWHMRZ.js +0 -1
  534. package/dist/chunk-GLERH466.js +0 -1
  535. package/dist/chunk-GPW2V3RE.js +0 -1
  536. package/dist/chunk-HIDYF36O.js +0 -1
  537. package/dist/chunk-HITNVN6B.js +0 -3
  538. package/dist/chunk-HY4DJBA7.js +0 -5
  539. package/dist/chunk-KZIEYVXN.js +0 -1
  540. package/dist/chunk-L6NSJVJZ.js +0 -1
  541. package/dist/chunk-N4MQX6JU.js +0 -18
  542. package/dist/chunk-N7FHEL4D.js +0 -1
  543. package/dist/chunk-NTEURFZH.js +0 -1
  544. package/dist/chunk-OIVP6KFV.js +0 -1
  545. package/dist/chunk-OPHBU3LG.js +0 -1
  546. package/dist/chunk-OYQOZP2F.js +0 -5
  547. package/dist/chunk-PTZK576G.js +0 -1
  548. package/dist/chunk-QYADASLV.js +0 -1
  549. package/dist/chunk-ST7UXLWR.js +0 -1
  550. package/dist/chunk-SVY7VUYU.js +0 -1
  551. package/dist/chunk-TK3NWWD4.js +0 -1
  552. package/dist/chunk-TSOYJ743.js +0 -1
  553. package/dist/chunk-UNGSTR4X.js +0 -61
  554. package/dist/chunk-VIMF6LGM.js +0 -1
  555. package/dist/chunk-VJLMUKOI.js +0 -1
  556. package/dist/chunk-VN6RDSK2.js +0 -1
  557. package/dist/chunk-VV4N5P64.js +0 -1
  558. package/dist/chunk-W3I423PS.js +0 -1
  559. package/dist/chunk-WJR24TAG.js +0 -1
  560. package/dist/chunk-XTGKMHSW.js +0 -1
  561. package/dist/chunk-YBB7ZGTY.js +0 -1
  562. package/dist/chunk-Z4NPUARF.js +0 -1
  563. package/dist/chunk-ZGNQRPDT.js +0 -1
  564. package/dist/chunk-ZKPSFFKU.js +0 -1
  565. package/dist/chunk-ZLV5SQSX.js +0 -1
  566. package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
  567. package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
  568. package/dist/core/index.cjs +0 -1
  569. package/dist/core/index.d.cts +0 -3
  570. package/dist/core/index.d.ts +0 -3
  571. package/dist/core/index.js +0 -1
  572. package/dist/decay-BvOWTZ00.d.ts +0 -112
  573. package/dist/decay-CFlLvXUT.d.cts +0 -112
  574. package/dist/extra/browser.cjs +0 -1
  575. package/dist/extra/browser.d.cts +0 -4
  576. package/dist/extra/browser.d.ts +0 -4
  577. package/dist/extra/browser.js +0 -1
  578. package/dist/extra/index.cjs +0 -20
  579. package/dist/extra/index.d.cts +0 -17
  580. package/dist/extra/index.d.ts +0 -17
  581. package/dist/extra/index.js +0 -1
  582. package/dist/extra/node.cjs +0 -2
  583. package/dist/extra/node.js +0 -2
  584. package/dist/extra/operators.cjs +0 -1
  585. package/dist/extra/operators.d.cts +0 -958
  586. package/dist/extra/operators.d.ts +0 -958
  587. package/dist/extra/operators.js +0 -1
  588. package/dist/extra/reactive.cjs +0 -1
  589. package/dist/extra/reactive.d.cts +0 -353
  590. package/dist/extra/reactive.d.ts +0 -353
  591. package/dist/extra/reactive.js +0 -1
  592. package/dist/extra/render/index.cjs +0 -5
  593. package/dist/extra/render/index.js +0 -1
  594. package/dist/extra/sources.cjs +0 -3
  595. package/dist/extra/sources.js +0 -1
  596. package/dist/extra/storage-browser.cjs +0 -1
  597. package/dist/extra/storage-browser.d.cts +0 -37
  598. package/dist/extra/storage-browser.d.ts +0 -37
  599. package/dist/extra/storage-browser.js +0 -1
  600. package/dist/extra/storage-core.cjs +0 -1
  601. package/dist/extra/storage-core.d.cts +0 -28
  602. package/dist/extra/storage-core.d.ts +0 -28
  603. package/dist/extra/storage-core.js +0 -1
  604. package/dist/extra/storage-node.cjs +0 -1
  605. package/dist/extra/storage-node.d.cts +0 -2
  606. package/dist/extra/storage-node.d.ts +0 -2
  607. package/dist/extra/storage-node.js +0 -0
  608. package/dist/extra/storage-tiers-browser.cjs +0 -1
  609. package/dist/extra/storage-tiers-browser.d.cts +0 -120
  610. package/dist/extra/storage-tiers-browser.d.ts +0 -120
  611. package/dist/extra/storage-tiers-browser.js +0 -1
  612. package/dist/extra/storage-tiers-node.cjs +0 -1
  613. package/dist/extra/storage-tiers-node.d.cts +0 -210
  614. package/dist/extra/storage-tiers-node.d.ts +0 -210
  615. package/dist/extra/storage-tiers-node.js +0 -1
  616. package/dist/extra/storage-tiers.cjs +0 -1
  617. package/dist/extra/storage-tiers.d.cts +0 -412
  618. package/dist/extra/storage-tiers.d.ts +0 -412
  619. package/dist/extra/storage-tiers.js +0 -1
  620. package/dist/graph/index.cjs +0 -7
  621. package/dist/graph/index.d.cts +0 -7
  622. package/dist/graph/index.d.ts +0 -7
  623. package/dist/graph/index.js +0 -1
  624. package/dist/graph-CWvEUQAq.d.cts +0 -1861
  625. package/dist/graph-D9LFnda9.d.ts +0 -1861
  626. package/dist/index-5k1T6jl0.d.cts +0 -121
  627. package/dist/index-9770hRuQ.d.cts +0 -779
  628. package/dist/index-B1F8Enjf.d.ts +0 -704
  629. package/dist/index-BHskSB8v.d.ts +0 -3413
  630. package/dist/index-BIYAkbAi.d.cts +0 -26
  631. package/dist/index-BoJ5JHxI.d.ts +0 -557
  632. package/dist/index-BocU7pqs.d.ts +0 -779
  633. package/dist/index-BxNs2HB9.d.cts +0 -1858
  634. package/dist/index-C1T3d7V-.d.cts +0 -704
  635. package/dist/index-C5ri2Axc.d.cts +0 -301
  636. package/dist/index-C9l6OEBL.d.ts +0 -26
  637. package/dist/index-CC-AvFTy.d.cts +0 -557
  638. package/dist/index-CJF1URuX.d.ts +0 -121
  639. package/dist/index-CdTelp1M.d.ts +0 -202
  640. package/dist/index-Cj3WohTd.d.cts +0 -202
  641. package/dist/index-Co7uli2l.d.cts +0 -3413
  642. package/dist/index-D0aciIex.d.cts +0 -209
  643. package/dist/index-DHen9Klo.d.ts +0 -1858
  644. package/dist/index-Yq60JP3s.d.ts +0 -209
  645. package/dist/index-nozs3fFC.d.ts +0 -301
  646. package/dist/node-kK3CvTrR.d.cts +0 -1347
  647. package/dist/node-kK3CvTrR.d.ts +0 -1347
  648. package/dist/patterns/ai/browser.cjs +0 -8
  649. package/dist/patterns/ai/browser.js +0 -3
  650. package/dist/patterns/ai/index.cjs +0 -74
  651. package/dist/patterns/ai/index.d.cts +0 -20
  652. package/dist/patterns/ai/index.d.ts +0 -20
  653. package/dist/patterns/ai/index.js +0 -1
  654. package/dist/patterns/ai/node.cjs +0 -1
  655. package/dist/patterns/ai/node.js +0 -1
  656. package/dist/patterns/cqrs/index.cjs +0 -3
  657. package/dist/patterns/cqrs/index.d.cts +0 -8
  658. package/dist/patterns/cqrs/index.d.ts +0 -8
  659. package/dist/patterns/cqrs/index.js +0 -1
  660. package/dist/patterns/demo-shell/index.cjs +0 -5
  661. package/dist/patterns/demo-shell/index.d.cts +0 -7
  662. package/dist/patterns/demo-shell/index.d.ts +0 -7
  663. package/dist/patterns/demo-shell/index.js +0 -1
  664. package/dist/patterns/domain-templates/index.cjs +0 -3
  665. package/dist/patterns/domain-templates/index.d.cts +0 -6
  666. package/dist/patterns/domain-templates/index.d.ts +0 -6
  667. package/dist/patterns/domain-templates/index.js +0 -1
  668. package/dist/patterns/graphspec/index.cjs +0 -86
  669. package/dist/patterns/graphspec/index.d.cts +0 -8
  670. package/dist/patterns/graphspec/index.d.ts +0 -8
  671. package/dist/patterns/graphspec/index.js +0 -1
  672. package/dist/patterns/harness/index.cjs +0 -48
  673. package/dist/patterns/harness/index.d.cts +0 -13
  674. package/dist/patterns/harness/index.d.ts +0 -13
  675. package/dist/patterns/harness/index.js +0 -1
  676. package/dist/patterns/inspect/index.cjs +0 -3
  677. package/dist/patterns/inspect/index.d.cts +0 -9
  678. package/dist/patterns/inspect/index.d.ts +0 -9
  679. package/dist/patterns/inspect/index.js +0 -1
  680. package/dist/patterns/job-queue/index.cjs +0 -3
  681. package/dist/patterns/job-queue/index.d.cts +0 -9
  682. package/dist/patterns/job-queue/index.d.ts +0 -9
  683. package/dist/patterns/job-queue/index.js +0 -1
  684. package/dist/patterns/memory/index.cjs +0 -3
  685. package/dist/patterns/memory/index.d.cts +0 -8
  686. package/dist/patterns/memory/index.d.ts +0 -8
  687. package/dist/patterns/memory/index.js +0 -1
  688. package/dist/patterns/messaging/index.cjs +0 -3
  689. package/dist/patterns/messaging/index.d.cts +0 -7
  690. package/dist/patterns/messaging/index.d.ts +0 -7
  691. package/dist/patterns/messaging/index.js +0 -1
  692. package/dist/patterns/orchestration/index.cjs +0 -3
  693. package/dist/patterns/orchestration/index.d.cts +0 -8
  694. package/dist/patterns/orchestration/index.d.ts +0 -8
  695. package/dist/patterns/orchestration/index.js +0 -1
  696. package/dist/patterns/process/index.cjs +0 -3
  697. package/dist/patterns/process/index.d.cts +0 -10
  698. package/dist/patterns/process/index.d.ts +0 -10
  699. package/dist/patterns/process/index.js +0 -1
  700. package/dist/patterns/reactive-layout/index.cjs +0 -4
  701. package/dist/patterns/reactive-layout/index.d.cts +0 -7
  702. package/dist/patterns/reactive-layout/index.d.ts +0 -7
  703. package/dist/patterns/reactive-layout/index.js +0 -1
  704. package/dist/patterns/reduction/index.cjs +0 -3
  705. package/dist/patterns/reduction/index.d.cts +0 -6
  706. package/dist/patterns/reduction/index.d.ts +0 -6
  707. package/dist/patterns/reduction/index.js +0 -1
  708. package/dist/patterns/surface/index.cjs +0 -13
  709. package/dist/patterns/surface/index.d.cts +0 -9
  710. package/dist/patterns/surface/index.d.ts +0 -9
  711. package/dist/patterns/surface/index.js +0 -1
  712. package/dist/reactive-log-BKALbfal.d.ts +0 -223
  713. package/dist/reactive-log-DIGdYqQ6.d.cts +0 -223
  714. package/dist/reactive-map-CEFGp8TK.d.cts +0 -296
  715. package/dist/reactive-map-DS_SIAxv.d.ts +0 -296
  716. package/dist/resilience-6LYQJAC5.js +0 -1
  717. package/dist/sugar-DQjFmVqb.d.cts +0 -399
  718. package/dist/sugar-fhLIE7TT.d.ts +0 -399
  719. package/dist/topology-tree-Bcz27hpF.d.cts +0 -25
  720. package/dist/topology-tree-xvaD0fOX.d.ts +0 -25
@@ -1,1861 +0,0 @@
1
- import { A as Actor, l as GraphReFlyConfig, V as VersioningLevel, N as Node, M as Messages, K as NodeSink } from './node-kK3CvTrR.js';
2
- import { D as DescribeNodeOutput, a as DerivedFn, E as EffectFn, c as DescribeDetail, d as DescribeField } from './sugar-fhLIE7TT.js';
3
- import { StorageHandle } from './extra/storage-core.js';
4
- import { SnapshotStorageTier } from './extra/storage-tiers.js';
5
-
6
- /**
7
- * Pure structural diff over `GraphDescribeOutput` snapshots.
8
- *
9
- * Produces a {@link DescribeChangeset} of {@link DescribeEvent}s describing the
10
- * topology delta from `prev` → `next`. Used by `Graph.describe({ reactive:
11
- * "diff" })` internally and re-exported here for static-snapshot diffing
12
- * (e.g. computing the topology delta between two persisted snapshots without
13
- * spinning up a live graph).
14
- *
15
- * Topology-only — no value/state events. The data layer lives in
16
- * `Graph.observe`. Per Tier 1.5.1 (locked Session A.1), `DescribeEvent` and
17
- * {@link ObserveEvent} have disjoint type sets so a consumer can route both
18
- * streams without ambiguity.
19
- *
20
- * `flushedAt_ns` is taken from `core/clock.ts`'s `monotonicNs()` so callers can
21
- * order changesets across the same process without wall-clock skew.
22
- *
23
- * @module
24
- */
25
-
26
- /**
27
- * Meta dictionary attached to a node, as surfaced by
28
- * {@link DescribeNodeOutput.meta}. Aliased here so {@link DescribeEvent}'s
29
- * `node-meta-changed` variant has a stable, narrow type.
30
- */
31
- type Meta = Record<string, unknown>;
32
- /**
33
- * One topology delta between two `describe()` snapshots. Disjoint from
34
- * `ObserveEvent` (the data-layer envelope).
35
- */
36
- type DescribeEvent = {
37
- type: "node-added";
38
- path: string;
39
- node: DescribeNodeOutput;
40
- } | {
41
- type: "node-removed";
42
- path: string;
43
- } | {
44
- type: "node-meta-changed";
45
- path: string;
46
- prevMeta: Meta;
47
- nextMeta: Meta;
48
- } | {
49
- type: "edge-added";
50
- from: string;
51
- to: string;
52
- } | {
53
- type: "edge-removed";
54
- from: string;
55
- to: string;
56
- } | {
57
- type: "subgraph-mounted";
58
- path: string;
59
- } | {
60
- type: "subgraph-unmounted";
61
- path: string;
62
- };
63
- /**
64
- * Coalesced batch of {@link DescribeEvent}s emitted as a single DATA wave by
65
- * `Graph.describe({ reactive: "diff" })` per outermost batch flush.
66
- *
67
- * `flushedAt_ns` is monotonic (from `core/clock.ts`); compare against another
68
- * changeset's `flushedAt_ns` to order them. `events` is empty only when
69
- * `topologyDiff` is called with two structurally identical snapshots; reactive
70
- * variants suppress empty changesets so consumers don't see no-op DATA waves.
71
- */
72
- type DescribeChangeset = {
73
- events: ReadonlyArray<DescribeEvent>;
74
- flushedAt_ns: number;
75
- };
76
- /**
77
- * Pure topology delta from `prev` → `next`. No I/O, no node references — purely
78
- * over the JSON shape `Graph.describe()` returns.
79
- *
80
- * Event ordering within a changeset:
81
- * 1. `subgraph-mounted` (added subgraphs first — their nodes follow)
82
- * 2. `node-added`
83
- * 3. `node-meta-changed`
84
- * 4. `edge-added`
85
- * 5. `edge-removed`
86
- * 6. `node-removed`
87
- * 7. `subgraph-unmounted` (last — node removals already reported)
88
- *
89
- * Each group is emitted in code-point sort order on the path / `${from}->${to}`
90
- * key so the changeset is deterministic across runs (useful for snapshot
91
- * tests and golden-output assertions).
92
- */
93
- declare function topologyDiff(prev: GraphDescribeOutput, next: GraphDescribeOutput): DescribeChangeset;
94
-
95
- /**
96
- * Causal walkback over a {@link Graph.describe} snapshot (roadmap §9.2).
97
- *
98
- * `explainPath` finds the shortest dep-chain from `from` to `to` and returns a
99
- * step-by-step {@link CausalChain} enriched with each node's current value,
100
- * status, last-mutation actor, and any `graph.trace()` reasoning annotation.
101
- *
102
- * Pure function over the snapshot — peer to {@link reachable}. The
103
- * {@link Graph.explain} instance method auto-passes `describe({detail:"standard"})`
104
- * plus runtime annotations and `lastMutation` so callers get rich output by
105
- * default.
106
- *
107
- * @module
108
- */
109
-
110
- /** One node along the causal chain returned by {@link explainPath}. */
111
- interface CausalStep {
112
- /** Qualified node path. */
113
- path: string;
114
- /** Node kind (`state` / `derived` / `producer` / etc.). */
115
- type: DescribeNodeOutput["type"];
116
- /** Status as of the source snapshot. */
117
- status?: DescribeNodeOutput["status"];
118
- /** Cached value at snapshot time (omitted when describe didn't include it). */
119
- value?: unknown;
120
- /** Hop distance from `from` (0 = `from`, N = `to`). */
121
- hop: number;
122
- /** Annotation set via `graph.trace(path, annotation)` or `graph.add(node, { name: path, annotation })`, when present. */
123
- annotation?: string;
124
- /** Most recent guarded mutation, when known. */
125
- lastMutation?: Readonly<{
126
- actor: Actor;
127
- timestamp_ns: number;
128
- }>;
129
- /** V0/V1 versioning info, when present. */
130
- v?: DescribeNodeOutput["v"];
131
- /** Index of this step in the next step's `deps` (i.e. which dep slot fed forward). */
132
- dep_index?: number;
133
- /**
134
- * All dep slots when the same dep appears multiple times in the next
135
- * step's `deps`. Present only for multi-edge connections; `dep_index`
136
- * always equals `dep_indices[0]` when set.
137
- */
138
- dep_indices?: number[];
139
- }
140
- /** Outcome of an {@link explainPath} call. */
141
- interface CausalChain {
142
- from: string;
143
- to: string;
144
- /** True when a path was found. */
145
- found: boolean;
146
- /** Why the chain may be empty/incomplete. `"ok"` when `found` is true.
147
- * `"pending"` is the reactive-explain sentinel emitted while reactive args
148
- * are waiting for their first DATA (qa D5). */
149
- reason: "ok" | "no-such-from" | "no-such-to" | "no-path" | "max-depth-exceeded" | "pending";
150
- /** Ordered steps — first element is `from`, last is `to`. Empty when `!found`. */
151
- steps: readonly CausalStep[];
152
- /** Pretty multi-line rendering. Always present, even on failure (one-line message). */
153
- text: string;
154
- /** JSON-serializable form (drops `text` to keep payloads compact). */
155
- toJSON(): {
156
- from: string;
157
- to: string;
158
- found: boolean;
159
- reason: CausalChain["reason"];
160
- steps: readonly CausalStep[];
161
- };
162
- }
163
- /** Options for {@link explainPath}. */
164
- interface ExplainPathOptions {
165
- /** Maximum hop distance to search. Omit for unbounded. */
166
- maxDepth?: number;
167
- /** Per-path reasoning annotations (typically `graph.trace()` output map). */
168
- annotations?: ReadonlyMap<string, string>;
169
- /** Per-path `lastMutation` map (overrides describe-derived values). */
170
- lastMutations?: ReadonlyMap<string, Readonly<{
171
- actor: Actor;
172
- timestamp_ns: number;
173
- }>>;
174
- /**
175
- * When `true` and `from === to`, search for a non-trivial cycle (path
176
- * back to `from` through ≥1 other node) instead of returning the trivial
177
- * single-step. Use when debugging feedback loops (COMPOSITION-GUIDE §7).
178
- * If no real cycle exists, falls back to the trivial single-step. Default
179
- * `false` — backward-compatible.
180
- */
181
- findCycle?: boolean;
182
- }
183
- /**
184
- * Walks backward from `to` through `deps` to find the shortest path to `from`,
185
- * then assembles an ordered, enriched {@link CausalChain}.
186
- *
187
- * @param described - `graph.describe()` output (any detail level; richer detail → richer steps).
188
- * @param from - Path of the upstream node (the cause).
189
- * @param to - Path of the downstream node (the effect).
190
- * @param opts - Optional `maxDepth` and per-path annotation overlays.
191
- * @returns A {@link CausalChain} — `found:false` with a `reason` when no path exists.
192
- *
193
- * @example
194
- * ```ts
195
- * import { explainPath } from "@graphrefly/graphrefly-ts";
196
- * const chain = explainPath(graph.describe({ detail: "standard" }), "input", "result");
197
- * console.log(chain.text);
198
- * ```
199
- */
200
- declare function explainPath(described: GraphDescribeOutput, from: string, to: string, opts?: ExplainPathOptions): CausalChain;
201
-
202
- /**
203
- * Graph profiling and inspection utilities.
204
- *
205
- * Provides per-node memory estimation, connectivity stats, and hotspot
206
- * detection. Non-invasive — reads from `describe()` and node internals
207
- * without modifying state.
208
- *
209
- * @module
210
- */
211
-
212
- /** Per-node profile entry. */
213
- interface NodeProfile {
214
- /** Qualified path within the graph. */
215
- path: string;
216
- /** Node type (state, derived, producer, effect). */
217
- type: string;
218
- /** Node status (disconnected, dirty, settled, errored, completed). */
219
- status: string;
220
- /** Approximate retained bytes for the node's cached value. */
221
- valueSizeBytes: number;
222
- /** Number of downstream subscribers (sinks). */
223
- subscriberCount: number;
224
- /** Number of upstream dependencies. */
225
- depCount: number;
226
- /**
227
- * True if this is an effect node with no external subscribers — a classic
228
- * leak pattern. See {@link GraphProfileResult.orphans} for the broader
229
- * orphan-node detection across `derived` / `producer` / `effect`.
230
- */
231
- isOrphanEffect: boolean;
232
- /**
233
- * Orphan category (batch 8 Unit 13 D). `null` when the node is healthy.
234
- * - `"orphan-effect"` — effect with zero subscribers (pre-existing class).
235
- * - `"idle-derived"` — derived with zero subscribers (wasted compute path
236
- * if it ever activates; may indicate a factory forgot keepalive).
237
- * - `"idle-producer"` — producer with zero subscribers (no external
238
- * consumer; may be an over-eager factory or forgotten cleanup).
239
- */
240
- orphanKind: "orphan-effect" | "idle-derived" | "idle-producer" | null;
241
- }
242
- /** Aggregate graph profile. */
243
- interface GraphProfileResult {
244
- /** Total node count. */
245
- nodeCount: number;
246
- /** Total edge count. */
247
- edgeCount: number;
248
- /** Subgraph count. */
249
- subgraphCount: number;
250
- /** All node profiles. */
251
- nodes: NodeProfile[];
252
- /** Total approximate value memory across all nodes. */
253
- totalValueSizeBytes: number;
254
- /**
255
- * Top-N hotspots by dimension. Each list is sorted descending. See
256
- * {@link GraphProfileOptions.topN} for the cap (default 10).
257
- */
258
- hotspots: {
259
- byValueSize: NodeProfile[];
260
- bySubscriberCount: NodeProfile[];
261
- byDepCount: NodeProfile[];
262
- };
263
- /**
264
- * Every orphan across types — `effect`, `derived`, `producer` with zero
265
- * subscribers. See {@link NodeProfile.orphanKind} for category.
266
- */
267
- orphans: NodeProfile[];
268
- /** Effect nodes with no external subscribers (legacy; subset of `orphans`). */
269
- orphanEffects: NodeProfile[];
270
- }
271
- /** Options for {@link graphProfile}. */
272
- interface GraphProfileOptions {
273
- /** Limit hotspot list (default 10). */
274
- topN?: number;
275
- }
276
- /**
277
- * Profile a graph's memory and connectivity characteristics.
278
- *
279
- * Uses `describe({ detail: "standard" })` for node metadata and direct
280
- * `NodeImpl` access for subscriber counts and cached values.
281
- *
282
- * @param graph - The graph to profile.
283
- * @param opts - Optional configuration.
284
- * @returns Aggregate profile with per-node details, hotspots (multi-dim), and orphans.
285
- */
286
- declare function graphProfile(graph: Graph, opts?: GraphProfileOptions): GraphProfileResult;
287
-
288
- /**
289
- * Reserved segment for meta companion paths: `nodeName::__meta__::metaKey` (GRAPHREFLY-SPEC §3.6).
290
- * Forbidden as a local node or mount name.
291
- */
292
- declare const GRAPH_META_SEGMENT = "__meta__";
293
- /**
294
- * Options for {@link Graph}. Named fields documented below; the open index
295
- * signature is preserved so callers can stash extension data on the graph
296
- * without losing type discipline on the reserved names.
297
- *
298
- * - `config` — bind this graph to a specific {@link GraphReFlyConfig} for
299
- * tier/metaPassthrough/inspector lookups. Defaults to the singleton
300
- * `defaultConfig` exported from `core/node.ts`.
301
- * - `versioning` — convenience for `graph.setVersioning(level)` at
302
- * construction time. Monotonic bulk-apply; see {@link Graph.setVersioning}.
303
- * - `factories` — reserved for future per-graph factory registration;
304
- * currently factories flow through `Graph.fromSnapshot(data, {factories})`.
305
- */
306
- interface GraphOptions {
307
- config?: GraphReFlyConfig;
308
- versioning?: VersioningLevel;
309
- factories?: Record<string, GraphNodeFactory>;
310
- /**
311
- * Capacity of the reasoning-trace ring buffer. Default: `1000`. Set lower
312
- * to reduce memory; higher for audit-heavy workloads. Set at construction
313
- * time — not mutable afterward (ring buffers can't resize cleanly).
314
- */
315
- traceCapacity?: number;
316
- /**
317
- * Tier 1.5.3 Phase 2.5 (Session A.1 lock + Phase 2.5 design DG1=B, 2026-04-27).
318
- * Top-level factory identifier for Graph-returning factories (`agentMemory`,
319
- * `harnessLoop`, `pipelineGraph`, etc.). When set, `describe()` surfaces
320
- * `factory` + `factoryArgs` at the top of `GraphDescribeOutput` so consumers
321
- * can identify provenance, and `compileSpec` can delegate reconstruction to
322
- * `catalog.graphFactories[factory]` with `factoryArgs`. Prefer the
323
- * post-construction `Graph.prototype.tagFactory(name, args?)` mutator inside
324
- * the factory body over passing here directly.
325
- */
326
- factory?: string;
327
- /**
328
- * JSON-serializable subset of the construction args. For non-JSON fields
329
- * (LLMAdapter, callbacks, embedders), prefer the {@link placeholderArgs}
330
- * helper which substitutes descriptive `"<Node>"` / `"<function>"` strings
331
- * (DG2 = ii). Catalog `graphFactories` recipients receive this back during
332
- * `compileSpec` to recreate the graph with the user-supplied runtime ctx.
333
- */
334
- factoryArgs?: unknown;
335
- [key: string]: unknown;
336
- }
337
- /**
338
- * Options for {@link Graph.derived}. Forwarded to the underlying
339
- * {@link derived} primitive plus graph-level extras.
340
- *
341
- * - `keepAlive: true` — installs an internal subscription so the node
342
- * stays activated and `.cache` stays current for **external consumers**
343
- * (UI render, debug snapshot, audit log) with no real subscriber. The
344
- * subscription self-prunes on the node's terminal (`COMPLETE` / `ERROR`
345
- * / `TEARDOWN`) and is also drained by {@link Graph.destroy}, so
346
- * repeated `graph.remove(name)` cycles do not accumulate stale
347
- * disposers.
348
- *
349
- * **Do not read `node.cache` from inside another reactive fn** (spec
350
- * §5.12) — declare the node as a real dep instead. `keepAlive` is a
351
- * convenience for *external* read patterns, not a shortcut around the
352
- * message protocol.
353
- * - `signal` — when aborted, removes this node from the graph via
354
- * {@link Graph.remove}, which sends `[[TEARDOWN]]` and drains cleanup
355
- * hooks. Already-aborted signals trigger removal synchronously.
356
- * - `equals`, `initial`, `meta` — pass-through to {@link NodeOptions}.
357
- * - `annotation` — forwarded to {@link Graph.add} (see `graph.trace`).
358
- */
359
- interface GraphDerivedOptions<T> {
360
- equals?: (a: T, b: T) => boolean;
361
- initial?: T | null;
362
- keepAlive?: boolean;
363
- signal?: AbortSignal;
364
- meta?: Record<string, unknown>;
365
- annotation?: string;
366
- }
367
- /**
368
- * Options for {@link Graph.effect}.
369
- *
370
- * - `signal` — when aborted, removes this node from the graph via
371
- * {@link Graph.remove} (fires the effect's `deactivate` cleanup).
372
- * - `meta` / `annotation` — same forwarding shape as
373
- * {@link GraphDerivedOptions}.
374
- */
375
- interface GraphEffectOptions {
376
- signal?: AbortSignal;
377
- meta?: Record<string, unknown>;
378
- annotation?: string;
379
- }
380
- /**
381
- * Options for {@link Graph.produce}.
382
- *
383
- * - `signal` — forwarded to the underlying {@link fromAny} for in-flight
384
- * cancellation of `Promise` / `AsyncIterable` sources, AND triggers
385
- * {@link Graph.remove} when aborted so the graph topology reflects the
386
- * cancellation.
387
- * - `equals` / `meta` / `annotation` — same forwarding shape as
388
- * {@link GraphDerivedOptions}.
389
- */
390
- interface GraphProduceOptions<T> {
391
- equals?: (a: T, b: T) => boolean;
392
- signal?: AbortSignal;
393
- meta?: Record<string, unknown>;
394
- annotation?: string;
395
- }
396
- /**
397
- * Source shapes accepted by {@link Graph.produce}. Excludes `Node<T>` —
398
- * Node→Node passthrough is rejected at the boundary because `fromAny`
399
- * passes Nodes through verbatim, which would silently drop `meta`/`equals`
400
- * options and bypass the `add()` registration's name semantics. For
401
- * Node→Node, use {@link Graph.derived} with `keepAlive: true` instead.
402
- */
403
- type GraphProduceInput<T> = PromiseLike<T> | AsyncIterable<T> | Iterable<T> | T;
404
- /** Filter for {@link Graph.describe} — object-style partial match or predicate. */
405
- type DescribeFilter = Partial<Pick<DescribeNodeOutput, "type" | "status">> | {
406
- type?: DescribeNodeOutput["type"];
407
- status?: DescribeNodeOutput["status"];
408
- /** Keep nodes whose `deps` includes this qualified path. */
409
- depsIncludes?: string;
410
- /** Snake-case alias for `depsIncludes` (Python parity). */
411
- deps_includes?: string;
412
- /** Keep nodes whose `meta` contains this key. */
413
- metaHas?: string;
414
- /** Snake-case alias for `metaHas` (Python parity). */
415
- meta_has?: string;
416
- } | ((node: DescribeNodeOutput) => boolean) | ((nodePath: string, node: DescribeNodeOutput) => boolean);
417
- /** Options for {@link Graph.signal} and {@link Graph.set} (actor context, internal lifecycle). */
418
- type GraphActorOptions = {
419
- actor?: Actor;
420
- /**
421
- * When `true`, skips node guards (graph lifecycle TEARDOWN, unmount teardown, etc.).
422
- */
423
- internal?: boolean;
424
- };
425
- /** Options for {@link Graph.describe} (Phase 3.3b progressive disclosure). */
426
- type GraphDescribeOptions = {
427
- /**
428
- * Scope `describe()` to what `actor` is allowed to observe. Accepts a
429
- * static {@link Actor} (resolved at call time) or a `Node<Actor>` — when a
430
- * Node is passed and `reactive: true` is set, the reactive describe handle
431
- * subscribes to the actor node and re-derives whenever the actor changes,
432
- * so harnesses that bind a reactive actor (e.g. per-turn `currentActor`
433
- * state) get a single live describe Node instead of re-calling
434
- * `describe({ actor })` per turn.
435
- *
436
- * **Cache-undefined semantics:** when a `Node<Actor>` is supplied whose
437
- * `cache` is `undefined` (e.g. a `producer` that has not yet emitted),
438
- * describe is treated identically to `actor: undefined` — i.e. **no
439
- * scoping** (full visibility). This matches every other Node-cache read in
440
- * the codebase, but means a not-yet-active actor node degrades to "describe
441
- * everything." Activate the actor node (subscribe + emit, or seed via
442
- * `state(initial)`) before calling `describe` if you rely on guard
443
- * scoping. In `reactive: true` mode the describe re-derives once the
444
- * actor node populates.
445
- *
446
- * **Terminal-type handling:** if the supplied `Node<Actor>` emits
447
- * `COMPLETE`, `ERROR`, or `TEARDOWN`, the reactive describe releases the
448
- * actor subscription and re-derives one last time against the final
449
- * `actor.cache` value. Subsequent describe outputs reflect that frozen
450
- * cache until `handle.dispose()` runs.
451
- */
452
- actor?: Actor | Node<Actor>;
453
- /**
454
- * Node filter. Filters operate on whatever fields the chosen `detail` level
455
- * provides. For `metaHas` and `status` filters, use `detail: "standard"` or
456
- * higher — at `"minimal"` those fields are absent and the filter silently
457
- * excludes all nodes.
458
- */
459
- filter?: DescribeFilter;
460
- /**
461
- * Detail level (Phase 3.3b). Default: `"minimal"`.
462
- * - `"minimal"` — type + deps only
463
- * - `"standard"` — type, status, value, deps, meta, versioning (`v`)
464
- * - `"full"` — standard + guard, lastMutation
465
- */
466
- detail?: DescribeDetail;
467
- /**
468
- * Explicit field selection (GraphQL-style). Overrides `detail` when provided.
469
- * Dotted paths like `"meta.label"` select specific meta keys.
470
- */
471
- fields?: DescribeField[];
472
- /**
473
- * Reactive describe (D2):
474
- * - `true` — return `{ node, dispose }` where `node` emits a fresh
475
- * `GraphDescribeOutput` every time the graph state settles. Same
476
- * coalescing as {@link Graph.explain} with `{ reactive: true }`.
477
- * - `"diff"` — return `{ node, dispose }` where `node` emits a
478
- * {@link DescribeChangeset} per topology change. Empty changesets are
479
- * suppressed; the initial cache is a synthetic full-add diff so a fresh
480
- * subscriber sees the current topology as adds via push-on-subscribe.
481
- * (Tier 1.5.1 — Session A.1 lock).
482
- */
483
- reactive?: boolean | "diff";
484
- /** Reactive-only: name for the backing derived node (default `"describe"`). */
485
- reactiveName?: string;
486
- };
487
- /** Handle returned by {@link Graph.describe} with `{ reactive: true }`. */
488
- interface ReactiveDescribeHandle<T> {
489
- readonly node: Node<T>;
490
- dispose(): void;
491
- }
492
- /** JSON snapshot from {@link Graph.describe} (GRAPHREFLY-SPEC §3.6, Appendix B). */
493
- type GraphDescribeOutput = {
494
- name: string;
495
- nodes: Record<string, DescribeNodeOutput>;
496
- edges: ReadonlyArray<{
497
- from: string;
498
- to: string;
499
- }>;
500
- subgraphs: string[];
501
- /**
502
- * Top-level factory identifier (Tier 1.5.3 Phase 2.5 — DG1=B). Present when
503
- * the graph was constructed by a Graph-returning factory that called
504
- * `Graph.prototype.tagFactory(name, args?)` (or set `GraphOptions.factory`).
505
- * Used by `compileSpec` for catalog-based reconstruction via
506
- * `catalog.graphFactories[factory]`.
507
- */
508
- factory?: string;
509
- /** JSON-serializable construction args paired with `factory`. */
510
- factoryArgs?: unknown;
511
- /**
512
- * Re-read the live graph with higher detail (Phase 3.3b).
513
- * Returns a new `GraphDescribeOutput`; the original remains a snapshot.
514
- * Present on live describe results; absent on deserialized snapshots.
515
- */
516
- expand?: (detailOrFields: DescribeDetail | DescribeField[]) => GraphDescribeOutput;
517
- };
518
- /**
519
- * Persisted graph snapshot: {@link GraphDescribeOutput} plus optional format version
520
- * ({@link Graph.snapshot}, {@link Graph.restore}, {@link Graph.fromSnapshot}, {@link Graph.toObject},
521
- * {@link Graph.toJSONString} — §3.8).
522
- */
523
- type GraphPersistSnapshot = GraphDescribeOutput & {
524
- version?: number;
525
- };
526
- type GraphFactoryContext = {
527
- path: string;
528
- type: DescribeNodeOutput["type"];
529
- value: unknown;
530
- meta: Record<string, unknown>;
531
- deps: readonly string[];
532
- resolvedDeps: readonly Node[];
533
- };
534
- type GraphNodeFactory = (name: string, context: GraphFactoryContext) => Node;
535
- /**
536
- * Checkpoint record shape passed to `SnapshotStorageTier.save`. Written by
537
- * {@link Graph.attachSnapshotStorage} per-tier according to each tier's
538
- * `compactEvery` cadence.
539
- *
540
- * `mode: "full"` → full snapshot. Baseline anchor emitted on the first save
541
- * and every `compactEvery`-th save thereafter. Sufficient to recover state
542
- * on its own without WAL replay.
543
- * `mode: "diff"` → delta payload only, relative to this tier's most recent
544
- * `"full"` baseline. Between compacts. Wire-efficient; requires WAL replay
545
- * over the preceding `"full"` record to reconstruct state.
546
- *
547
- * Every record includes `seq` (per-tier monotonic counter), `timestamp_ns`
548
- * (wall-clock at flush time), and `format_version` (envelope version for
549
- * cross-version WAL replay).
550
- */
551
- type GraphCheckpointRecord = {
552
- name: string;
553
- seq: number;
554
- timestamp_ns: number;
555
- format_version: number;
556
- } & ({
557
- mode: "full";
558
- snapshot: GraphPersistSnapshot;
559
- } | {
560
- mode: "diff";
561
- diff: GraphWALDiff;
562
- });
563
- /** Options for {@link Graph.attachSnapshotStorage}. */
564
- type GraphAttachStorageOptions = {
565
- /**
566
- * Before the first save, attempt to restore from the first tier whose
567
- * `load(graph.name)` hits. Runs asynchronously in the background for
568
- * async tiers; errors surface via `onError`. Default `false`.
569
- */
570
- autoRestore?: boolean;
571
- /**
572
- * Limit the subscription surface (scoped observe). By default
573
- * `attachSnapshotStorage` observes every node in the graph tree; on large graphs
574
- * that's thousands of subscriptions just for tier-gating. Pass a path
575
- * list (or a single glob) to observe only those nodes.
576
- */
577
- paths?: readonly string[] | string;
578
- /** Pre-save path-level filter — skip records triggered by paths that fail this predicate. */
579
- filter?: (name: string, described: DescribeNodeOutput) => boolean;
580
- /** Surfaced on tier save errors and autoRestore failures. */
581
- onError?: (error: unknown, tier: SnapshotStorageTier<GraphCheckpointRecord>) => void;
582
- };
583
- /**
584
- * Event emitted by {@link Graph.topology} on every structural change to the
585
- * graph's own registry. Does NOT include value mutations (use `observe()` for
586
- * those) or transitively nested subgraph events (subscribe to each mounted
587
- * child's `topology` for that).
588
- *
589
- * - `"added"` — `name` is the local key registered via {@link Graph.add}
590
- * (`nodeKind: "node"`) or {@link Graph.mount} (`nodeKind: "mount"`).
591
- * - `"removed"` — emitted AFTER {@link Graph.remove} completes teardown.
592
- * `audit` is the full {@link GraphRemoveAudit} returned to the caller.
593
- */
594
- type TopologyEvent = {
595
- kind: "added";
596
- name: string;
597
- nodeKind: "node" | "mount";
598
- } | {
599
- kind: "removed";
600
- name: string;
601
- nodeKind: "node" | "mount";
602
- audit: GraphRemoveAudit;
603
- };
604
- /**
605
- * Direction options for diagram exports. Mirrors `DiagramDirection` from
606
- * `@graphrefly/graphrefly/extra/render` (the renderers consume their own
607
- * structurally-identical type) — re-exported here so callers building
608
- * options for `Graph` ergonomics don't need a separate import.
609
- */
610
- type GraphDiagramDirection = "TD" | "LR" | "BT" | "RL";
611
- /**
612
- * Snapshot format version (§3.8). Exported so the surface layer's
613
- * `saveSnapshot` writes the same `format_version` as
614
- * `Graph.attachSnapshotStorage` — one source of truth prevents silent wire
615
- * drift between auto-checkpoint and one-shot persistence paths.
616
- */
617
- declare const SNAPSHOT_VERSION = 1;
618
- /**
619
- * Option shapes that trigger structured-mode dispatch in {@link Graph.observe}.
620
- * Presence of any of these fields (truthy) → returns {@link ObserveResult};
621
- * otherwise `observe()` returns the raw-stream variants.
622
- */
623
- type StructuredTriggers = {
624
- structured?: true;
625
- timeline?: true;
626
- causal?: true;
627
- derived?: true;
628
- format?: "pretty" | "json" | "stage-log";
629
- detail?: "minimal" | "full";
630
- };
631
- /** {@link Graph.observe} on a single node or meta path — sink receives plain message batches. */
632
- type GraphObserveOne = {
633
- subscribe(sink: NodeSink): () => void;
634
- /** Send messages upstream toward the observed node's sources (e.g. PAUSE/RESUME). */
635
- up(messages: Messages): void;
636
- };
637
- /**
638
- * {@link Graph.observe} on the whole graph — sink receives each batch with the qualified source path.
639
- * Subscription order follows code-point sort on paths (mounts-first walk, then sorted locals/meta).
640
- */
641
- type GraphObserveAll = {
642
- subscribe(sink: (nodePath: string, messages: Messages) => void): () => void;
643
- /** Send messages upstream toward a specific observed node's sources (e.g. PAUSE/RESUME). */
644
- up(path: string, messages: Messages): void;
645
- };
646
- /**
647
- * Detail level for `observe()` progressive disclosure (Phase 3.3b).
648
- * - `"minimal"` — DATA events only, no timestamps, no causal info.
649
- * - `"standard"` — all message types (DATA, DIRTY, RESOLVED, INVALIDATE,
650
- * PAUSE, RESUME, COMPLETE, ERROR, TEARDOWN).
651
- * - `"full"` — standard + timeline + causal + derived.
652
- */
653
- type ObserveDetail = "minimal" | "standard" | "full";
654
- /**
655
- * Tier name for {@link ObserveEvent} filtering. Aligns with spec §1.2 message
656
- * tier semantics — each `ObserveTier` corresponds to one or more protocol
657
- * message types. Used by {@link ObserveOptions.tiers} to scope observation to
658
- * a subset of event categories (e.g. `tiers: ["error", "complete", "teardown"]`
659
- * for failure-only health monitoring).
660
- */
661
- type ObserveTier = ObserveEvent["type"];
662
- /**
663
- * Coalesced batch of {@link ObserveEvent}s emitted as one DATA wave per
664
- * outermost batch flush by `Graph.observe({ reactive: true })`.
665
- *
666
- * Disjoint from `DescribeChangeset` (the topology-layer envelope). Each event
667
- * carries its own `path` so consumers route per-path without unwrapping the
668
- * envelope first. `flushedAt_ns` is monotonic via `core/clock.ts`.
669
- */
670
- type ObserveChangeset = {
671
- events: ReadonlyArray<ObserveEvent>;
672
- flushedAt_ns: number;
673
- };
674
- /** Options for structured observation modes on {@link Graph.observe}. */
675
- type ObserveOptions = {
676
- actor?: Actor;
677
- /** Return an {@link ObserveResult} accumulator instead of a raw stream. */
678
- structured?: boolean;
679
- /** Include causal trace info (which dep triggered each recomputation). */
680
- causal?: boolean;
681
- /** Include timestamps and batch context on each event. */
682
- timeline?: boolean;
683
- /** Include per-evaluation dep snapshots for compute/derived nodes. */
684
- derived?: boolean;
685
- /**
686
- * Detail level (Phase 3.3b). Individual flags (`causal`, `timeline`, `derived`)
687
- * override. `"full"` implies all three plus structured.
688
- * `"minimal"` filters to DATA-only events.
689
- */
690
- detail?: ObserveDetail;
691
- /**
692
- * Filter observed events to these tiers only. When omitted, all event types
693
- * are delivered. Applies to both the structured callback and the reactive
694
- * variants (`observe({ reactive: true })`).
695
- *
696
- * Example: `tiers: ["error", "complete", "teardown"]` for failure-only
697
- * health monitoring; `tiers: ["data"]` for value-flow tracking.
698
- */
699
- tiers?: readonly ObserveTier[];
700
- /**
701
- * Return a `Node<ObserveChangeset>` that emits one DATA wave per outermost
702
- * batch flush, with all observed events for that flush coalesced into a
703
- * single changeset. Auto-enables structured mode (the reactive variant
704
- * delivers {@link ObserveEvent}s, not raw messages).
705
- *
706
- * Coalescing matches `describe({ reactive: true })`'s `registerBatchFlushHook`
707
- * mechanism — N events in one batch → one changeset DATA wave at flush.
708
- */
709
- reactive?: boolean;
710
- /** Optional name for the reactive changeset node when `reactive: true`. */
711
- reactiveName?: string;
712
- /**
713
- * When set, auto-enables structured mode and attaches a logger.
714
- * - `"pretty"` — colored one-line output per event.
715
- * - `"json"` — one JSON object per event.
716
- * - `"stage-log"` — pipeline-stage-labeled output for multi-node
717
- * observers. Auto-enables `timeline: true` so each line carries an
718
- * elapsed-seconds offset from the subscription. Provide a
719
- * {@link stageLabels} map to label each observed path; paths without a
720
- * mapping fall back to the path string.
721
- */
722
- format?: "pretty" | "json" | "stage-log";
723
- /** Sink for rendered lines (`console.log` by default). Only used when `format` is set. */
724
- logger?: (line: string, event: ObserveEvent) => void;
725
- /** Keep only these event types in formatted output. Only used when `format` is set. */
726
- includeTypes?: ObserveEvent["type"][];
727
- /** Exclude these event types from formatted output. Only used when `format` is set. */
728
- excludeTypes?: ObserveEvent["type"][];
729
- /** Built-in color preset (`ansi` default) or explicit color tokens. Only used when `format` is set. */
730
- theme?: ObserveThemeName | ObserveTheme;
731
- /**
732
- * Stage labels for `format: "stage-log"`. Keys are observe paths; values
733
- * are short stage names (e.g. `{ "intake::latest": "INTAKE" }`). Paths
734
- * without a mapping render under the path string itself. Ignored for
735
- * other formats.
736
- */
737
- stageLabels?: Record<string, string>;
738
- /**
739
- * Cap the `events` buffer. When set, the result uses a {@link RingBuffer}
740
- * under the hood: oldest events are dropped on overflow. Unbounded when
741
- * omitted (default).
742
- */
743
- maxEvents?: number;
744
- };
745
- /** Accumulated observation result (structured mode). */
746
- type ObserveResult<T = unknown> = AsyncIterable<ObserveEvent> & {
747
- /** Latest DATA value by observed path. */
748
- readonly values: Record<string, T>;
749
- /** Number of DIRTY messages received. */
750
- readonly dirtyCount: number;
751
- /** Number of RESOLVED messages received. */
752
- readonly resolvedCount: number;
753
- /** Number of INVALIDATE messages received (tier 1 cache-clear). */
754
- readonly invalidateCount: number;
755
- /** Number of PAUSE messages received (tier 2 backpressure). */
756
- readonly pauseCount: number;
757
- /** Number of RESUME messages received (tier 2 backpressure). */
758
- readonly resumeCount: number;
759
- /** Number of TEARDOWN messages received (tier 5 permanent cleanup). */
760
- readonly teardownCount: number;
761
- /**
762
- * All events in order — ring-buffered when `options.maxEvents` is set,
763
- * unbounded otherwise. Always materialized as an `ObserveEvent[]`
764
- * snapshot on read.
765
- */
766
- readonly events: ObserveEvent[];
767
- /** True if any observed node sent COMPLETE without prior ERROR on that node. */
768
- readonly anyCompletedCleanly: boolean;
769
- /** True if any observed node sent ERROR. */
770
- readonly anyErrored: boolean;
771
- /** True if at least one COMPLETE received and no ERROR from any observed node. */
772
- readonly completedWithoutErrors: boolean;
773
- /**
774
- * Attach a live listener that fires for each event as it arrives.
775
- * Returns an unsubscribe fn. Independent of the `events` buffer.
776
- */
777
- onEvent(listener: (event: ObserveEvent) => void): () => void;
778
- /** Stop observing. */
779
- dispose(): void;
780
- /**
781
- * Resubscribe with higher detail (Phase 3.3b).
782
- * Disposes current observation, returns new `ObserveResult` with merged options.
783
- */
784
- expand(extra: Partial<Pick<ObserveOptions, "causal" | "timeline" | "derived">> | ObserveDetail): ObserveResult<T>;
785
- };
786
- /** Fields common to every {@link ObserveEvent} variant. */
787
- interface ObserveEventBase {
788
- path?: string;
789
- /** Optional `timeline` context — wall-clock when `options.timeline === true`. */
790
- timestamp_ns?: number;
791
- in_batch?: boolean;
792
- /** Monotonically increasing counter per subscribe-callback invocation. All events in one delivery share the same id. */
793
- batch_id?: number;
794
- /**
795
- * Attribution for `data`/`error` events (B9 — actor threading). When
796
- * the originating `node.down(...)` call supplied an `actor` via
797
- * `NodeTransportOptions`, it's forwarded here as read from
798
- * `Node.lastMutation`. Internal / unattributed writes stamp the
799
- * library's `DEFAULT_ACTOR` (`{type: "system", id: ""}`) rather than
800
- * being silently dropped, so downstream policy/audit consumers can
801
- * evaluate policies against a well-formed actor in every case.
802
- *
803
- * Not populated for tier-1/tier-2 protocol events (`dirty`, `resolved`,
804
- * `pause`, `resume`, `invalidate`, `teardown`) — those don't carry
805
- * caller attribution.
806
- */
807
- actor?: Actor;
808
- }
809
- /** Optional `causal` context present on `data`/`resolved`/`derived` events. */
810
- interface ObserveCausalContext {
811
- trigger_dep_index?: number;
812
- trigger_dep_name?: string;
813
- /**
814
- * V0 version of the triggering dep at observation time (§6.0b).
815
- * This is the dep's post-emission version (after its own `advanceVersion`),
816
- * not the pre-emission version that caused this node's recomputation.
817
- */
818
- trigger_version?: {
819
- id: string;
820
- version: number;
821
- };
822
- /**
823
- * One scalar per dep: the last value that arrived in the current wave,
824
- * or the pre-wave cached value for deps that didn't fire. Convenient
825
- * for single-value-wave tooling (the common case).
826
- */
827
- dep_values?: unknown[];
828
- /**
829
- * Full per-dep batches for the wave that fired the fn — `dep_batches[i]`
830
- * is the array of values dep `i` delivered this wave (`undefined` for
831
- * deps that didn't fire). Use this to distinguish a single-value wave
832
- * from a multi-value wave; `dep_values` compresses each batch to its
833
- * last element and hides that difference.
834
- */
835
- dep_batches?: ReadonlyArray<ReadonlyArray<unknown> | undefined>;
836
- }
837
- /** A single event in the structured observation log (discriminated on `type`). */
838
- type ObserveEvent = (ObserveEventBase & ObserveCausalContext & {
839
- type: "data";
840
- data: unknown;
841
- }) | (ObserveEventBase & {
842
- type: "dirty";
843
- }) | (ObserveEventBase & ObserveCausalContext & {
844
- type: "resolved";
845
- }) | (ObserveEventBase & {
846
- type: "invalidate";
847
- }) | (ObserveEventBase & {
848
- type: "pause";
849
- lockId: unknown;
850
- }) | (ObserveEventBase & {
851
- type: "resume";
852
- lockId: unknown;
853
- }) | (ObserveEventBase & {
854
- type: "complete";
855
- }) | (ObserveEventBase & {
856
- type: "error";
857
- data: unknown;
858
- }) | (ObserveEventBase & {
859
- type: "teardown";
860
- }) | (ObserveEventBase & ObserveCausalContext & {
861
- type: "derived";
862
- dep_values: unknown[];
863
- });
864
- /** Built-in color preset names for observe `format` rendering. */
865
- type ObserveThemeName = "none" | "ansi";
866
- /** ANSI/style overrides for observe `format` event rendering. */
867
- type ObserveTheme = Partial<Record<ObserveEvent["type"] | "path" | "reset", string>>;
868
- /**
869
- * Named container for nodes and explicit edges (GRAPHREFLY-SPEC §3.1–§3.7).
870
- *
871
- * Qualified paths use `::` as the segment separator (for example `parent::child::node`).
872
- *
873
- * Edges are pure wires: `connect` only validates wiring — the target must already list the source in
874
- * its dependency array; no transforms run on the edge.
875
- *
876
- * @example
877
- * ```ts
878
- * import { Graph, state } from "@graphrefly/graphrefly-ts";
879
- *
880
- * const g = new Graph("app");
881
- * g.add(state(0, { name: "counter" }));
882
- * ```
883
- *
884
- * @category graph
885
- */
886
- declare class Graph {
887
- readonly name: string;
888
- readonly opts: Readonly<GraphOptions>;
889
- /** Protocol config bound to this graph (defaults to `defaultConfig`). */
890
- readonly config: GraphReFlyConfig;
891
- /** @internal — exposed for {@link teardownMountedGraph} and cross-graph helpers. */
892
- readonly _nodes: Map<string, Node<unknown>>;
893
- /**
894
- * @internal Reverse lookup for duplicate-instance detection in
895
- * {@link Graph.add} — O(1) replacement for an O(n) scan of `_nodes`.
896
- * Weak so nodes can be GC'd after `remove()` even if a caller keeps the
897
- * map alive via some unusual pattern.
898
- */
899
- private readonly _nodeToName;
900
- /** @internal — exposed for {@link teardownMountedGraph}. */
901
- readonly _mounts: Map<string, Graph>;
902
- /**
903
- * @internal Parent graph if this instance is mounted. `undefined` when
904
- * this is the root or when the graph has been unmounted. Used for
905
- * reparenting rejection + O(depth) ancestor walks.
906
- */
907
- _parent: Graph | undefined;
908
- private readonly _storageDisposers;
909
- private readonly _disposers;
910
- /** @internal Set in {@link destroy} / `_destroyClearOnly`; surfaced via {@link destroyed}. */
911
- private _destroyed;
912
- /**
913
- * @internal Lazy `TopologyEvent` producer. Created on first `.topology`
914
- * access. Zero cost until something subscribes — producer fn only runs when
915
- * the first sink attaches, registering one handler into
916
- * {@link Graph._topologyEmitters}.
917
- */
918
- private _topology;
919
- /**
920
- * @internal Active emit handlers for the topology producer. Each entry is
921
- * the closure registered by the producer fn on activation; cleared on
922
- * deactivation. `_emitTopology` broadcasts through every entry (there is at
923
- * most one per activation cycle of the producer).
924
- */
925
- private readonly _topologyEmitters;
926
- /**
927
- * @param name - Non-empty graph id (must not contain `::` and must not
928
- * equal the reserved meta segment `__meta__`).
929
- * @param opts - See {@link GraphOptions}. Stored frozen on the instance.
930
- */
931
- /** Tier 1.5.3 Phase 2.5 — top-level factory tag for Graph-returning factories. */
932
- private _factory?;
933
- private _factoryArgs?;
934
- constructor(name: string, opts?: GraphOptions);
935
- /**
936
- * Tag this graph with its constructing factory's identifier and args.
937
- * Used by Graph-returning factories (`agentMemory`, `harnessLoop`,
938
- * `pipelineGraph`, etc.) so `describe()` exposes provenance and
939
- * `compileSpec` can delegate reconstruction to
940
- * `catalog.graphFactories[factory]`. Tier 1.5.3 Phase 2.5 (DG1=B).
941
- *
942
- * `factoryArgs` should be JSON-serializable. For non-JSON fields
943
- * (LLMAdapter, callbacks, etc.), use {@link placeholderArgs} to
944
- * substitute descriptive strings (DG2=ii).
945
- *
946
- * Returns `this` for fluent chaining inside factory bodies.
947
- */
948
- tagFactory(factory: string, factoryArgs?: unknown): this;
949
- /**
950
- * Walk ancestors up through `_parent`. Returns the chain starting at this
951
- * instance, ending at the root (a graph with no parent). O(depth).
952
- *
953
- * @param includeSelf - Include `this` in the chain (default `true`).
954
- */
955
- ancestors(includeSelf?: boolean): Graph[];
956
- /**
957
- * Reactive stream of structural changes to this graph's own registry
958
- * (add / mount / remove). Value mutations live on `observe()`; this
959
- * companion only fires when the topology shape changes.
960
- *
961
- * Lazy: the underlying node is created on first access and activates when
962
- * something subscribes. No emission replay — late subscribers do not
963
- * receive historical events and should snapshot via {@link Graph.describe}
964
- * before listening for incremental changes. Events that fire while the
965
- * producer has zero subscribers are dropped (no retention).
966
- *
967
- * Own-graph only: a parent's `topology` does NOT emit for structural
968
- * changes inside a mounted child. Transitive consumers subscribe to each
969
- * child's topology separately (recurse through `topology`'s own "added"
970
- * events with `nodeKind: "mount"` to discover new children).
971
- *
972
- * See {@link TopologyEvent} for payload shape.
973
- *
974
- * @category observability
975
- */
976
- get topology(): Node<TopologyEvent>;
977
- /**
978
- * @internal Fire a {@link TopologyEvent} to every active subscriber of
979
- * `this.topology`. No-op when the topology node has never been accessed or
980
- * currently has no sinks — zero cost for graphs nobody observes.
981
- */
982
- private _emitTopology;
983
- /**
984
- * Registers a node under a local name. Fails if the name is already used,
985
- * reserved by a mount, the same node instance is already registered, or
986
- * the node is torn down.
987
- *
988
- * Returns the registered node so callers can chain:
989
- * `const counter = g.add(state(0, { name: "counter" }))`.
990
- *
991
- * **Signature:** `add(node, { name?, annotation? })`. Name lives in opts;
992
- * falls back to `node.name` from the node's own options. Throws if neither
993
- * is a non-empty string.
994
- *
995
- * The optional `opts.annotation` installs an initial
996
- * `graph.trace(name, annotation)` entry — same effect as calling
997
- * `graph.trace` right after, but reads naturally next to the registration.
998
- *
999
- * @param node - Node instance to own.
1000
- * @param opts - `{ name?, annotation? }`.
1001
- */
1002
- /**
1003
- * O(1) reverse lookup — returns the name the given Node was registered
1004
- * under via {@link Graph.add}, or `undefined` if it isn't registered here.
1005
- *
1006
- * Audit 2 (2026-04-24): replaces the orchestration's `findRegisteredNodePath`
1007
- * O(nodes²) describe-scan with direct `WeakMap<Node, string>` lookup.
1008
- */
1009
- nameOf(node: Node): string | undefined;
1010
- add<T extends Node>(node: T, opts?: {
1011
- name?: string;
1012
- annotation?: string;
1013
- }): T;
1014
- /**
1015
- * Bulk-apply a minimum versioning level to every currently-registered node
1016
- * in this graph (roadmap §6.0). `_applyVersioning` is monotonic — nodes
1017
- * already at a higher level are untouched. The method refuses to run
1018
- * mid-wave; invoke at setup time before any external subscribers attach.
1019
- *
1020
- * **Not** a default-for-future-adds mechanism — that's what
1021
- * `config.defaultVersioning` is for. Nodes added after this call do NOT
1022
- * automatically inherit `level`; register new nodes with their own
1023
- * `opts.versioning` or set `config.defaultVersioning` before construction.
1024
- *
1025
- * **Scope:** local only. Does not propagate to mounted subgraphs.
1026
- *
1027
- * @param level - `0` for V0, `1` for V1, or `undefined` to no-op.
1028
- */
1029
- setVersioning(level: VersioningLevel | undefined): void;
1030
- /**
1031
- * Unregisters a node or unmounts a subgraph and sends `[[TEARDOWN]]` to the
1032
- * removed node or recursively through the mounted subtree (§3.2).
1033
- *
1034
- * @param name - Local mount or node name.
1035
- * @returns Audit record of what was removed: `{kind, nodes, mounts}`.
1036
- * `kind: "node"` → `nodes: [name]`, `mounts: []`. `kind: "mount"` →
1037
- * `nodes` lists every primary node torn down across the subtree (sorted
1038
- * qualified paths relative to the unmounted subgraph) and `mounts` lists
1039
- * the mounted subgraphs in depth-first order including `name` itself.
1040
- */
1041
- remove(name: string): GraphRemoveAudit;
1042
- /**
1043
- * Bulk remove — invokes {@link Graph.remove} for every local name matching
1044
- * `filter`. Audit records merge into a single result. Mounted subgraphs
1045
- * are included via `filter` receiving the mount name; internal subtree
1046
- * entries are not walked directly (use describe + scan for tree-level
1047
- * queries).
1048
- *
1049
- * @param filter - Predicate or glob. Glob strings support `*` within a
1050
- * segment and `**` across segments (same grammar as `restore({only})`).
1051
- * @returns Combined audit of all nodes + mounts removed.
1052
- */
1053
- removeAll(filter: ((name: string) => boolean) | string): GraphRemoveAudit;
1054
- /**
1055
- * Iterable over locally-registered `[localName, Node]` pairs (sorted).
1056
- * Does not recurse into mounts.
1057
- */
1058
- [Symbol.iterator](): IterableIterator<[string, Node]>;
1059
- /**
1060
- * Returns a node by local name or `::` qualified path.
1061
- * Local names are looked up directly; paths with `::` delegate to {@link resolve}.
1062
- *
1063
- * @param name - Local name or qualified path.
1064
- */
1065
- node(name: string): Node;
1066
- /**
1067
- * Reads `graph.node(name).get()` — accepts `::` qualified paths (§3.2).
1068
- *
1069
- * @param name - Local name or qualified path.
1070
- * @returns Cached value or `undefined`.
1071
- */
1072
- get(name: string): unknown;
1073
- /**
1074
- * Shorthand for `graph.node(name).down([[DATA, value]], { actor })` — accepts `::` qualified paths (§3.2).
1075
- *
1076
- * @param name - Local name or qualified path.
1077
- * @param value - Next `DATA` payload.
1078
- * @param options - Optional `actor` and `internal` guard bypass.
1079
- */
1080
- set(name: string, value: unknown, options?: GraphActorOptions): void;
1081
- /**
1082
- * Atomic multi-node DATA write. Wraps every {@link Graph.set} call in a
1083
- * single `batch(...)` so downstream dependents see one coalesced wave
1084
- * instead of N cascading ones.
1085
- *
1086
- * @param entries - `{name → value}` map or `[name, value]` pairs.
1087
- * @param options - Passed to each underlying `set` call (same `actor` + `internal` semantics).
1088
- */
1089
- setAll(entries: Record<string, unknown> | Iterable<readonly [string, unknown]>, options?: GraphActorOptions): void;
1090
- /**
1091
- * Emit a single `[[INVALIDATE]]` (tier 1) on a node. Thin wrapper over
1092
- * `node.down([[INVALIDATE]], …)` matching the {@link Graph.set} ergonomics.
1093
- */
1094
- invalidate(name: string, options?: GraphActorOptions): void;
1095
- /**
1096
- * Emit a single `[[ERROR, err]]` (tier 4) on a node.
1097
- */
1098
- error(name: string, err: unknown, options?: GraphActorOptions): void;
1099
- /**
1100
- * Emit a single `[[COMPLETE]]` (tier 4) on a node, declaring the stream
1101
- * cleanly finished. Distinct from {@link Graph.remove} (which emits
1102
- * TEARDOWN and unregisters the node).
1103
- */
1104
- complete(name: string, options?: GraphActorOptions): void;
1105
- /**
1106
- * Internal: register a self-pruning keepalive subscription. The sink
1107
- * watches for terminal messages (`COMPLETE`/`ERROR`/`TEARDOWN`) on `n`
1108
- * and removes the disposer from `_disposers` when one arrives, so
1109
- * repeated `graph.remove(name)` cycles do not accumulate stale
1110
- * disposers (qa B3).
1111
- */
1112
- private _registerSelfPruningKeepalive;
1113
- /**
1114
- * Internal: wire an `AbortSignal` so its abort triggers
1115
- * `graph.remove(name)`. Already-aborted signals trigger removal
1116
- * synchronously. The abort listener is itself registered as a graph
1117
- * disposer so it gets cleaned up if `destroy()` runs first (qa B4).
1118
- */
1119
- private _wireSignalToRemove;
1120
- /**
1121
- * Path-based reactive derivation. Resolves each entry in `depPaths` via
1122
- * {@link Graph.resolve}, builds a {@link derived} node, registers it via
1123
- * {@link Graph.add}, and returns the registered Node.
1124
- *
1125
- * **First-run gate inherited.** fn does not fire until every dep has
1126
- * delivered at least one real DATA — same gate as `derived()` (spec §2.7,
1127
- * `partial: false`). A SENTINEL dep holds activation; `null` is a real
1128
- * DATA value and releases the gate. **Empty `depPaths` is a vacuous
1129
- * gate** — fn fires once synchronously on first activation. Use this
1130
- * for one-shot constants only; for async sources prefer
1131
- * {@link Graph.produce}.
1132
- *
1133
- * **`keepAlive: true`** — installs an internal subscription so the node
1134
- * stays activated and `.cache` stays current for **external consumers**
1135
- * (UI render, debug snapshot, audit log). The subscription self-prunes
1136
- * on the node's terminal and is also drained by {@link Graph.destroy}.
1137
- *
1138
- * **Do not read `node.cache` from inside another reactive fn** — that
1139
- * is a §5.12 boundary violation regardless of `keepAlive`. Declare the
1140
- * node as a real dep instead so the edge appears in `describe()` and
1141
- * the message protocol carries the value.
1142
- *
1143
- * **`signal`** — when aborted, removes this node from the graph.
1144
- *
1145
- * @param name - Local registration name (must be unique on this graph).
1146
- * @param depPaths - `::`-qualified paths resolved at construction time.
1147
- * @param fn - Pure compute receiving sugar-unwrapped scalar dep values.
1148
- * @param opts - {@link GraphDerivedOptions}.
1149
- * @returns The registered `Node<T>`.
1150
- */
1151
- derived<T>(name: string, depPaths: readonly string[], fn: DerivedFn<T>, opts?: GraphDerivedOptions<T>): Node<T>;
1152
- /**
1153
- * Path-based managed side effect. Resolves each entry in `depPaths`,
1154
- * builds an {@link effect} node, registers it, and returns the
1155
- * registered Node. fn does not auto-emit — call `actions.emit(v)` /
1156
- * `actions.down(msgs)` explicitly to produce downstream messages.
1157
- *
1158
- * **Cleanup.** Return a cleanup function (`() => void`) or granular
1159
- * hooks (`{ beforeRun?, deactivate?, invalidate? }`) — fired on the
1160
- * matching transition by the underlying primitive (see
1161
- * {@link NodeFnCleanup}). Graph teardown propagates `[[TEARDOWN]]`
1162
- * which triggers `deactivate`.
1163
- *
1164
- * **`signal`** — when aborted, removes this node from the graph (fires
1165
- * the effect's `deactivate` cleanup).
1166
- *
1167
- * @param name - Local registration name (must be unique on this graph).
1168
- * @param depPaths - `::`-qualified paths resolved at construction time.
1169
- * @param fn - Side-effect receiving sugar-unwrapped scalar dep values.
1170
- * @param opts - {@link GraphEffectOptions}.
1171
- * @returns The registered `Node<unknown>`.
1172
- */
1173
- effect(name: string, depPaths: readonly string[], fn: EffectFn, opts?: GraphEffectOptions): Node<unknown>;
1174
- /**
1175
- * Wraps an external/async source as a named graph node via
1176
- * {@link fromAny}. Accepts {@link GraphProduceInput} shapes:
1177
- * `Promise`, `AsyncIterable`, `Iterable`, or scalar.
1178
- *
1179
- * **Node sources are rejected.** For `Node → Node`, use
1180
- * {@link Graph.derived} with `keepAlive: true` — `fromAny` would
1181
- * passthrough a Node verbatim and silently drop `meta`/`equals`
1182
- * options. The type signature excludes `Node<T>`; a runtime guard
1183
- * catches casts.
1184
- *
1185
- * **`undefined` is rejected.** `undefined` is the global SENTINEL;
1186
- * emitting it as DATA would corrupt downstream first-run gates.
1187
- * `null` (a valid DATA value) is accepted.
1188
- *
1189
- * **`signal`** — forwarded to {@link fromAny} for in-flight cancel of
1190
- * Promise/AsyncIterable sources, AND triggers {@link Graph.remove}
1191
- * when aborted so the topology reflects the cancellation.
1192
- *
1193
- * @param name - Local registration name (must be unique on this graph).
1194
- * @param source - Any {@link GraphProduceInput} shape.
1195
- * @param opts - {@link GraphProduceOptions}.
1196
- * @returns The registered `Node<T>`.
1197
- */
1198
- produce<T>(name: string, source: GraphProduceInput<T>, opts?: GraphProduceOptions<T>): Node<T>;
1199
- /**
1200
- * Atomic multi-mutation. Same semantics as core {@link batch}: DATA and
1201
- * RESOLVED emissions inside `fn` defer, DIRTY propagates immediately, and
1202
- * downstream consumers see one coalesced wave (spec §1.3 invariant 7).
1203
- * Exposed on `Graph` for discoverability and import hygiene — pattern
1204
- * authors can reach for `graph.batch(...)` without importing `batch` from
1205
- * the core entry. Shares one global frame with the core import; nesting
1206
- * either way is supported.
1207
- *
1208
- * **Caveat:** if `fn` throws, deferred DATA is discarded but DIRTY
1209
- * messages already propagated synchronously, leaving downstream nodes
1210
- * in `dirty` status with stale `.cache`. Catch and emit compensating
1211
- * INVALIDATE/RESET if you need to recover.
1212
- */
1213
- batch(fn: () => void): void;
1214
- /**
1215
- * Returns the full edge list for this graph tree, derived on demand from
1216
- * each registered node's `_deps` (no stored registry). Local-only
1217
- * (non-recursive) by default to match the historical `edges()` surface;
1218
- * pass `{recursive: true}` to include mounted subgraphs with qualified
1219
- * paths relative to this graph.
1220
- *
1221
- * Use {@link Graph.describe} for full-tree snapshots with edges already
1222
- * qualified and paired with node metadata.
1223
- */
1224
- edges(opts?: {
1225
- recursive?: boolean;
1226
- }): ReadonlyArray<[string, string]>;
1227
- /**
1228
- * Embed a child graph at a local mount name (§3.4). Child nodes are reachable via
1229
- * {@link Graph.resolve} using `::` delimited paths (§3.5). Lifecycle
1230
- * {@link Graph.signal} visits mounted subgraphs recursively.
1231
- *
1232
- * Rejects: same name as existing node or mount, self-mount, mount cycles,
1233
- * and the same child graph instance mounted twice on one parent.
1234
- *
1235
- * @param name - Local mount point.
1236
- * @param child - Nested `Graph` instance.
1237
- * @returns The mounted `child`, for chaining.
1238
- */
1239
- mount<G extends Graph>(name: string, child: G): G;
1240
- mount(name: string): Graph;
1241
- mount(name: string, builder: (sub: Graph) => void): Graph;
1242
- /**
1243
- * Look up a node by qualified path (§3.5). Segments are separated by `::`.
1244
- *
1245
- * If the first segment equals this graph's {@link Graph.name}, it is stripped
1246
- * (so `root.resolve("app::a")` works when `root.name === "app"`). The strip
1247
- * is applied **recursively** when descending into mounted children, so
1248
- * `child.resolve("child::x")` also works when `child.name === "child"`.
1249
- *
1250
- * @param path - Qualified `::` path or local name.
1251
- * @returns The resolved `Node`.
1252
- */
1253
- resolve(path: string): Node;
1254
- /**
1255
- * Non-throwing {@link Graph.resolve}. Returns `undefined` instead of
1256
- * throwing when the path does not resolve to a node.
1257
- */
1258
- tryResolve(path: string): Node | undefined;
1259
- private _resolveFromSegments;
1260
- /**
1261
- * Resolve `::__meta__::key` segments from a registered primary node (possibly chained).
1262
- */
1263
- private _resolveMetaChainFromNode;
1264
- /**
1265
- * Deliver a message batch to every registered node in this graph and, recursively,
1266
- * in mounted child graphs (§3.7). Recurses into mounts first, then delivers to
1267
- * local nodes (sorted by name). Each {@link Node} receives at most one delivery
1268
- * per call (deduped by reference).
1269
- *
1270
- * **Primary-vs-meta filter asymmetry (intentional):** primary nodes receive the
1271
- * unfiltered `messages` batch — that's the canonical data-plane flow. Companion
1272
- * `meta` nodes receive a filtered subset keyed by the per-type `metaPassthrough`
1273
- * flag on {@link GraphReFlyConfig}. Built-in defaults: PAUSE / RESUME / DATA /
1274
- * RESOLVED pass through to meta; INVALIDATE / COMPLETE / ERROR / TEARDOWN do
1275
- * not.
1276
- *
1277
- * **Where lifecycle terminals reach meta:**
1278
- * - **TEARDOWN** — primary's `_emit` cascades to meta children directly (see
1279
- * `core/node.ts` "Meta TEARDOWN fan-out" block) so meta is torn down with
1280
- * its primary regardless of the signal-level filter.
1281
- * - **COMPLETE / ERROR / INVALIDATE** — scoped to primaries on the broadcast
1282
- * path. Meta companions are an attribution side-channel, not a lifecycle
1283
- * participant; address meta directly via `meta.down(...)` if you need to
1284
- * forward these. Audit confirmed 2026-04-17: no current meta consumer
1285
- * relies on broadcast COMPLETE/ERROR/INVALIDATE delivery.
1286
- *
1287
- * @param messages - Batch to deliver to every registered node (and mounts, recursively).
1288
- * @param options - Optional `actor` / `internal` for transport.
1289
- */
1290
- signal(messages: Messages, options?: GraphActorOptions): void;
1291
- private _signalDeliver;
1292
- private _signalMetaSubtree;
1293
- /**
1294
- * Static structure snapshot: qualified node keys, edges, mount names (GRAPHREFLY-SPEC §3.6, Appendix B).
1295
- *
1296
- * Returns the {@link GraphDescribeOutput} object directly (or a
1297
- * `ReactiveDescribeHandle` when `{ reactive: true | "diff" }` is set).
1298
- *
1299
- * For formatted output (Mermaid / D2 / ASCII / pretty / JSON text), pass
1300
- * the snapshot to one of the pure renderers in
1301
- * `@graphrefly/graphrefly/extra/render`:
1302
- *
1303
- * ```ts
1304
- * import { toMermaid, toAscii } from "@graphrefly/graphrefly/extra/render";
1305
- *
1306
- * const mermaid = toMermaid(graph.describe());
1307
- * const ascii = toAscii(graph.describe(), { direction: "TD" });
1308
- * ```
1309
- *
1310
- * For live formatted output, compose with `derived`:
1311
- *
1312
- * ```ts
1313
- * import { derived } from "@graphrefly/graphrefly";
1314
- * import { toMermaid } from "@graphrefly/graphrefly/extra/render";
1315
- *
1316
- * const live = derived(
1317
- * [graph.describe({ reactive: true }).node],
1318
- * ([g]) => toMermaid(g),
1319
- * );
1320
- * ```
1321
- *
1322
- * For the spec projection (type + deps + meta, strip runtime status/value),
1323
- * pass `detail: "spec"`.
1324
- *
1325
- * @param options - Optional `actor` for guard-scoped visibility, `filter`
1326
- * for selective output, `detail` / `fields` for projection, `reactive`
1327
- * for the live handle.
1328
- *
1329
- * @example
1330
- * ```ts
1331
- * graph.describe() // full snapshot object
1332
- * graph.describe({ filter: { status: "errored" } }) // filtered object
1333
- * graph.describe({ detail: "spec" }) // GraphSpec projection
1334
- * graph.describe({ reactive: true }) // live snapshot Node
1335
- * ```
1336
- */
1337
- describe(options: GraphDescribeOptions & {
1338
- reactive: "diff";
1339
- }): ReactiveDescribeHandle<DescribeChangeset>;
1340
- describe(options: GraphDescribeOptions & {
1341
- reactive: true;
1342
- }): ReactiveDescribeHandle<GraphDescribeOutput>;
1343
- describe(options?: GraphDescribeOptions): GraphDescribeOutput;
1344
- private _collectSubgraphs;
1345
- /**
1346
- * Snapshot-based resource profile: per-node stats, orphan effect detection,
1347
- * memory hotspots. Zero runtime overhead — walks nodes on demand.
1348
- *
1349
- * @param opts - Optional `topN` for hotspot limit (default 10).
1350
- * @returns Aggregate profile with per-node details, hotspots, and orphan effects.
1351
- */
1352
- resourceProfile(opts?: GraphProfileOptions): GraphProfileResult;
1353
- /**
1354
- * Reachability query rooted at `from`. Instance convenience — wraps
1355
- * `reachable(this.describe(), from, direction, opts)`. See
1356
- * {@link reachable} for semantics.
1357
- */
1358
- reachable(from: string, direction: ReachableDirection, opts: ReachableOptions & {
1359
- withDetail: true;
1360
- }): ReachableResult;
1361
- reachable(from: string, direction: ReachableDirection, opts?: ReachableOptions): string[];
1362
- /**
1363
- * Causal walkback: shortest dep-chain from `from` to `to`, enriched with
1364
- * each node's value, status, last-mutation actor, and reasoning annotation
1365
- * from {@link Graph.trace}. Wraps {@link explainPath} (roadmap §9.2).
1366
- *
1367
- * Same question, two answers:
1368
- * - **Static (default)** — `explain(from, to, opts?)` returns a single
1369
- * {@link CausalChain} snapshot of the graph at call time. Reactive
1370
- * args (any `Node<...>`) are resolved to their current cache once.
1371
- * - **Reactive** — `explain(from, to, { reactive: true, ... })` returns
1372
- * `{ node: Node<CausalChain>; dispose: () => void }`. The node
1373
- * recomputes whenever a `data` / `error` / `complete` / `teardown`
1374
- * event fires anywhere on the graph's structured observe stream OR
1375
- * any reactive arg (`Node<string>` for `from`/`to`,
1376
- * `Node<number>` for `maxDepth`, `Node<boolean>` for `findCycle`)
1377
- * emits. Replaces the former `reactiveExplainPath`.
1378
- *
1379
- * Tier 3.5 reactive-opt carve-out (F.9): `from`, `to`, `maxDepth`, and
1380
- * `findCycle` accept `Node<...>` in addition to their plain types. When
1381
- * mixed (some reactive, some static), the reactive variant subscribes only
1382
- * to the Node-typed args; static args pass through unchanged. The static
1383
- * call snapshots all reactive args at call time — for live re-walking, use
1384
- * `{ reactive: true }`.
1385
- *
1386
- * **File path-scoped observe is deferred** — the reactive variant
1387
- * subscribes to whole-graph observe today (a perf gap, not a spec
1388
- * violation). Tracked in `docs/optimizations.md` Tier 10.8 deferred
1389
- * follow-up: "reactiveExplainPath file-path-scoped observe".
1390
- *
1391
- * @param from - Upstream node path (the cause). `string | Node<string>`.
1392
- * @param to - Downstream node path (the effect). `string | Node<string>`.
1393
- * @param opts - Optional `maxDepth` (`number | Node<number>`) and
1394
- * `findCycle` (`boolean | Node<boolean>`). When `findCycle:true`
1395
- * and `from === to`, returns the shortest cycle through other nodes
1396
- * (useful for diagnosing feedback loops, COMPOSITION-GUIDE §7).
1397
- * When `reactive: true`, also accepts `name?`.
1398
- */
1399
- explain(from: string | Node<string>, to: string | Node<string>, opts?: {
1400
- /**
1401
- * DF13 (2026-04-29) — narrow the static overload to forbid
1402
- * `reactive: true`. A caller passing `{ reactive: true, ... }`
1403
- * is steered into the reactive overload instead of falling
1404
- * through to the implementation signature's union return.
1405
- */
1406
- reactive?: false;
1407
- maxDepth?: number | Node<number>;
1408
- findCycle?: boolean | Node<boolean>;
1409
- }): CausalChain;
1410
- explain(from: string | Node<string>, to: string | Node<string>, opts: {
1411
- reactive: true;
1412
- maxDepth?: number | Node<number>;
1413
- findCycle?: boolean | Node<boolean>;
1414
- name?: string;
1415
- }): {
1416
- node: Node<CausalChain>;
1417
- dispose: () => void;
1418
- };
1419
- private _explainStatic;
1420
- private _describeReactive;
1421
- /**
1422
- * Reactive topology-diff variant of `describe()`. Wraps `_describeReactive`'s
1423
- * snapshot stream and emits a `DescribeChangeset` per change, suppressing
1424
- * empty changesets. The initial cache is a synthetic full-add diff so a
1425
- * fresh subscriber sees the current topology as a single `node-added` /
1426
- * `edge-added` / `subgraph-mounted` payload via push-on-subscribe.
1427
- */
1428
- private _describeReactiveDiff;
1429
- private _explainReactive;
1430
- /**
1431
- * @internal Collect all qualified paths in this graph tree matching a
1432
- * glob pattern. Used by scoped autoCheckpoint subscription.
1433
- */
1434
- private _pathsMatching;
1435
- private _collectObserveTargets;
1436
- private _appendMetaObserveTargets;
1437
- /**
1438
- * Live message stream from one node (or meta path), or from the whole graph (§3.6).
1439
- *
1440
- * Two modes dispatched on first argument:
1441
- * - `observe(path, options?)` — one node. Returns {@link GraphObserveOne}
1442
- * (raw stream), or {@link ObserveResult} when `options` requests structured
1443
- * accumulation (`structured`, `timeline`, `causal`, `derived`, `format`,
1444
- * `detail: "minimal"|"full"`).
1445
- * - `observe(options?)` — all nodes. Returns {@link GraphObserveAll} (raw),
1446
- * or {@link ObserveResult} under the same structured trigger conditions.
1447
- *
1448
- * Structured mode subscribes in sorted path order (code-point). Inspector
1449
- * extras (`causal`/`derived`) require `graph.config.inspectorEnabled`;
1450
- * when disabled, those fields silently drop and the rest still works.
1451
- *
1452
- * `ObserveResult` is also an `AsyncIterable<ObserveEvent>` — use
1453
- * `for await (const ev of result)` for pull-based consumption.
1454
- */
1455
- observe(path: string, options: ObserveOptions & {
1456
- reactive: true;
1457
- }): Node<ObserveChangeset>;
1458
- observe(options: ObserveOptions & {
1459
- reactive: true;
1460
- }): Node<ObserveChangeset>;
1461
- observe(path: string, options?: ObserveOptions & StructuredTriggers): ObserveResult;
1462
- observe(path: string, options?: ObserveOptions): GraphObserveOne;
1463
- observe(options: ObserveOptions & StructuredTriggers): ObserveResult;
1464
- observe(options?: ObserveOptions): GraphObserveAll;
1465
- /**
1466
- * Reactive observe variant — wraps the structured observer and emits one
1467
- * `ObserveChangeset` DATA per outermost batch flush, with all observed
1468
- * events for that flush coalesced into a single envelope. Tier filter
1469
- * (`options.tiers`) drops out-of-scope events before accumulation.
1470
- *
1471
- * Cleanup is producer-bound: the structured observer is torn down when the
1472
- * last consumer of the returned node unsubscribes.
1473
- */
1474
- private _observeReactive;
1475
- /** Dispatch helper — builds a unified observer + its expand closure. */
1476
- private _buildStructuredObserver;
1477
- /**
1478
- * Unified observer builder — replaces the four ex-creators
1479
- * (`_createObserveResult` / `...ForAll` / `_createFallback…`). Accepts a
1480
- * list of `[path, node]` targets (single-element for one-node observe,
1481
- * N-element for all-nodes). Inspector hooks attach per-target when
1482
- * `causal`/`derived` requested AND `config.inspectorEnabled`; otherwise
1483
- * those fields gracefully drop.
1484
- *
1485
- * Events flow through a `recordEvent()` helper so the format logger,
1486
- * ring-buffer, and async-iterable hooks all share one push path.
1487
- */
1488
- private _createObserveResult;
1489
- /**
1490
- * Attach format-rendering logger to an ObserveResult by subscribing to its
1491
- * event stream (no monkey-patching). Renders each event per `format` and
1492
- * `theme`, filtered by `includeTypes` / `excludeTypes`.
1493
- */
1494
- private _attachFormatLogger;
1495
- /**
1496
- * Register a cleanup function to be called on {@link Graph.destroy}.
1497
- *
1498
- * Factories use this to attach teardown logic for internal nodes, keepalive
1499
- * subscriptions, or other resources that are not registered on the graph and
1500
- * would otherwise leak on repeated create/destroy cycles.
1501
- *
1502
- * Returns a removal function — call it to unregister the disposer early.
1503
- */
1504
- addDisposer(fn: () => void): () => void;
1505
- /**
1506
- * Drains disposers (registered via {@link addDisposer}), then sends `[[TEARDOWN]]` to all
1507
- * nodes and clears registries on this graph and every mounted subgraph (§3.7).
1508
- * The instance is left empty and may be reused with {@link Graph.add}.
1509
- */
1510
- destroy(): void;
1511
- /**
1512
- * `true` once {@link destroy} has run on this graph. Useful for reactive
1513
- * consumers that hold a Graph reference and want to fail fast / skip
1514
- * work if the graph went away mid-flight (e.g. a `switchMap` over a
1515
- * destroyable graph reference). Set after the destroy cascade completes;
1516
- * stays `true` even if the instance is later reused via {@link add}.
1517
- */
1518
- get destroyed(): boolean;
1519
- /**
1520
- * Clear structure after parent already signaled TEARDOWN through this subtree.
1521
- *
1522
- * Drains both `_disposers` and `_storageDisposers` to mirror the full
1523
- * {@link destroy} path — child mounts that registered disposers via
1524
- * {@link addDisposer} (audit trails, log dispose hooks, off-event
1525
- * callbacks, attached storage) would otherwise leak when destruction
1526
- * reaches the subtree via the parent's TEARDOWN cascade rather than a
1527
- * direct `destroy()` call (EH-2). Disposers run BEFORE structure clear
1528
- * so cleanups can still resolve node paths if needed.
1529
- */
1530
- private _destroyClearOnly;
1531
- /**
1532
- * Serializes structure and current values to JSON-shaped data (§3.8). Same
1533
- * information as {@link Graph.describe} plus a `version` field for format
1534
- * evolution.
1535
- *
1536
- * The overload path supports three outputs:
1537
- * - no arg → `GraphPersistSnapshot` (plain JS object).
1538
- * - `{format: "json-string"}` → deterministic JSON `string`
1539
- * (key-sorted; safe for hashing or file write).
1540
- * - `{format: "bytes", codec: name}` → `Uint8Array` wrapped in the v1
1541
- * envelope from {@link encodeEnvelope}. The codec must be registered
1542
- * on this graph's {@link GraphReFlyConfig} via `config.registerCodec`.
1543
- * Paired with {@link Graph.decode} for auto-dispatch on the read side.
1544
- */
1545
- snapshot(): GraphPersistSnapshot;
1546
- snapshot(opts: {
1547
- format: "json-string";
1548
- }): string;
1549
- snapshot(opts: {
1550
- format: "bytes";
1551
- codec: string;
1552
- }): Uint8Array;
1553
- /**
1554
- * Auto-dispatch a byte buffer produced by {@link Graph.snapshot} with
1555
- * `{format: "bytes", codec: name}`. Reads the v1 envelope, resolves the
1556
- * named codec on `config` (defaults to `defaultConfig`), and returns the
1557
- * decoded snapshot. Combine with {@link Graph.fromSnapshot} to rehydrate
1558
- * a full graph topology from bytes.
1559
- *
1560
- * @throws If the envelope is malformed or the named codec isn't
1561
- * registered on the target config.
1562
- */
1563
- static decode(bytes: Uint8Array, opts?: {
1564
- config?: GraphReFlyConfig;
1565
- }): GraphPersistSnapshot;
1566
- /**
1567
- * Apply persisted values onto an existing graph whose topology matches the snapshot
1568
- * (§3.8). Only {@link DescribeNodeOutput.type} `state` entries with a `value` field
1569
- * are written by default; `derived` / `operator` / `effect` are always skipped so
1570
- * deps drive recomputation. `producer` entries are skipped unless `includeProducers`
1571
- * is set (producers recompute on activation, so restoring is usually a no-op
1572
- * overwritten on the next wave — opt in for audit / forensic round-trip use cases).
1573
- * Unknown paths are ignored.
1574
- *
1575
- * @param data - Snapshot envelope with matching `name` and node slices.
1576
- * @throws If `data.name` does not equal {@link Graph.name}.
1577
- */
1578
- restore(data: GraphPersistSnapshot, options?: {
1579
- only?: string | readonly string[];
1580
- /**
1581
- * Fires per failing write. Default behavior (omitted) is silent —
1582
- * missing paths and guard denials are swallowed to match the
1583
- * historical semantics. Provide a callback to surface failures
1584
- * without aborting the remaining restores.
1585
- */
1586
- onError?: (path: string, err: unknown) => void;
1587
- /**
1588
- * Restore `producer` node values alongside `state`. Default `false`:
1589
- * producers are reactive sources whose value recomputes on
1590
- * activation, so restoring from a snapshot is usually a no-op
1591
- * overwritten on the next wave. Audit / forensic round-trip use
1592
- * cases that need the stored value to survive restoration can
1593
- * opt in. Does not change `derived` / `effect` handling — those
1594
- * are always skipped.
1595
- */
1596
- includeProducers?: boolean;
1597
- }): void;
1598
- /**
1599
- * Creates a graph named from the snapshot, optionally runs `build` to register nodes
1600
- * and mounts, then {@link Graph.restore} values (§3.8).
1601
- *
1602
- * @param data - Snapshot envelope (`version` checked).
1603
- * @param opts - Either a legacy `build(g)` callback, or an options object:
1604
- * - `build?` — topology constructor; skips auto-hydration when present.
1605
- * - `factories?` — map from glob pattern to {@link GraphNodeFactory},
1606
- * used by auto-hydration to reconstruct non-state nodes. Per-call (no
1607
- * process-global registry). First matching pattern wins.
1608
- * @returns Hydrated `Graph` instance.
1609
- */
1610
- static fromSnapshot(data: GraphPersistSnapshot, opts?: ((g: Graph) => void) | {
1611
- build?: (g: Graph) => void;
1612
- factories?: Record<string, GraphNodeFactory>;
1613
- }): Graph;
1614
- /**
1615
- * ECMAScript `JSON.stringify` hook — returns the same object as
1616
- * {@link Graph.snapshot}. Makes `JSON.stringify(graph)` "just work"
1617
- * without double-encoding.
1618
- */
1619
- toJSON(): GraphPersistSnapshot;
1620
- /**
1621
- * Unified persistence surface (§3.8). Cascades snapshot records through
1622
- * one or more {@link SnapshotStorageTier}s, each with its own `debounceMs` /
1623
- * `compactEvery` cadence and independent diff baseline.
1624
- *
1625
- * Subscription gates on {@link messageTier} ≥ 3 (DATA/RESOLVED/terminal),
1626
- * never on tier-0/1/2 control waves (START/DIRTY/INVALIDATE/PAUSE/RESUME)
1627
- * or tier-5 TEARDOWN (graceful shutdown is the caller's responsibility).
1628
- *
1629
- * Per-tier cadence lets the hot tier stay sync while cold tiers absorb
1630
- * async writes without blocking the hot path. Each tier holds its own
1631
- * `{lastSnapshot, lastVersionFingerprint}` so cold-tier diff baselines
1632
- * aren't polluted by hot-tier flushes. Tiers with `debounceMs === 0`
1633
- * share a single snapshot computation per observe event; debounced tiers
1634
- * compute their own snapshot when their timer fires.
1635
- */
1636
- attachSnapshotStorage(tiers: readonly SnapshotStorageTier<GraphCheckpointRecord>[], options?: GraphAttachStorageOptions): StorageHandle;
1637
- /**
1638
- * Try tiers in order (hottest first); apply the first record that hits
1639
- * via {@link Graph.restore}. Returns `true` if any tier produced a
1640
- * restorable snapshot, `false` if all missed.
1641
- *
1642
- * Resilience: a tier that returns data which cannot be restored (load
1643
- * throws, shape unrecognized, or `restore()` itself throws) does not abort
1644
- * the cascade — the error is routed through `onError` (if supplied) and
1645
- * the next colder tier is tried. This mirrors how a multi-tier cache
1646
- * falls through on a corrupt hot entry.
1647
- *
1648
- * Note: `restore()` mutates state incrementally. If a restore throws
1649
- * partway through, the graph may hold a mixed state (some slices from
1650
- * the bad tier, some pre-existing). A subsequent successful tier's
1651
- * `restore()` overwrites the overlapping slices.
1652
- *
1653
- * Internal helper shared by {@link Graph.attachSnapshotStorage}'s `autoRestore`
1654
- * option and the static {@link Graph.fromStorage} factory.
1655
- */
1656
- private _cascadeRestore;
1657
- /**
1658
- * Construct a fresh {@link Graph} pre-hydrated from the first tier that
1659
- * hits. Delegates topology reconstruction to {@link Graph.fromSnapshot}
1660
- * on `"full"` records and direct {@link Graph.restore} on bare snapshots.
1661
- *
1662
- * Always asynchronous — awaits `tier.load()` for async tier support even
1663
- * when all tiers are sync. Callers that know they only pass sync tiers
1664
- * can safely `await` immediately.
1665
- *
1666
- * @throws If no tier holds a restorable record matching `name` *and* no
1667
- * `factories` override is provided for dynamic nodes.
1668
- */
1669
- static fromStorage(name: string, tiers: readonly SnapshotStorageTier<GraphCheckpointRecord>[], opts?: GraphOptions & {
1670
- factories?: Record<string, GraphNodeFactory>;
1671
- /**
1672
- * Called when a tier throws during `load()` or when
1673
- * {@link Graph.fromSnapshot} rejects a tier's record. The cascade
1674
- * falls through to the next colder tier regardless.
1675
- */
1676
- onError?: (err: unknown, tier: SnapshotStorageTier<GraphCheckpointRecord>) => void;
1677
- }): Promise<Graph>;
1678
- private _annotations;
1679
- private readonly _traceRing;
1680
- /**
1681
- * Unified reasoning trace: write annotations or read the ring buffer.
1682
- *
1683
- * - `graph.trace("path", "annotation")` — attaches a reasoning annotation
1684
- * to a node, capturing *why* an AI agent set a value. Overwrites the
1685
- * current annotation (if any) and appends to the chronological ring.
1686
- * Unknown paths are silently dropped (matching `observe` resilience).
1687
- * No-op when `config.inspectorEnabled` is `false`.
1688
- * - `graph.trace("path")` — returns the current annotation for `path`,
1689
- * or `undefined` if none. Precedence: most recent `trace(path, ...)`
1690
- * wins; if no trace call, whatever `graph.add(node, { name: "path", annotation })`
1691
- * installed; otherwise `undefined`.
1692
- * - `graph.trace()` — returns a chronological log of all write entries.
1693
- * Returns `[]` when `config.inspectorEnabled` is `false`.
1694
- */
1695
- trace(path: string, annotation: string, opts?: {
1696
- actor?: Actor;
1697
- }): void;
1698
- trace(path: string): string | undefined;
1699
- trace(): readonly TraceEntry[];
1700
- /**
1701
- * Latest annotation attached to `path` — via {@link Graph.trace} or via
1702
- * {@link Graph.add}'s `{annotation}` option. Returns `undefined` if none.
1703
- * `describe()` surfaces this via the `annotation` field on each node entry
1704
- * (when present). Equivalent to `graph.trace(path)`.
1705
- */
1706
- annotation(path: string): string | undefined;
1707
- /**
1708
- * Clear all reasoning-trace state (both the per-path annotations map and
1709
- * the ring buffer). Useful for long-running processes that want periodic
1710
- * resets, or tests that need a clean slate.
1711
- */
1712
- clearTrace(): void;
1713
- /**
1714
- * Remove trace entries matching `predicate`. Returns the number of
1715
- * entries removed. Does not touch the per-path annotations map — call
1716
- * {@link Graph.clearTrace} for a full reset.
1717
- */
1718
- pruneTrace(predicate: (entry: TraceEntry) => boolean): number;
1719
- /**
1720
- * Computes structural + value diff between two {@link Graph.describe} snapshots.
1721
- *
1722
- * @param a - Earlier describe output.
1723
- * @param b - Later describe output.
1724
- * @returns Added/removed nodes, changed fields, and edge deltas.
1725
- */
1726
- static diff(a: GraphDescribeOutput, b: GraphDescribeOutput): GraphDiffResult;
1727
- }
1728
- /** Entry in the reasoning trace ring buffer (roadmap 3.3). */
1729
- type TraceEntry = {
1730
- path: string;
1731
- annotation: string;
1732
- timestamp_ns: number;
1733
- /**
1734
- * Actor that produced the annotation (optional). Enables multi-agent
1735
- * attribution: distinguish "LLM set this rootCause" from "human approved
1736
- * this intervention" in the trace log.
1737
- */
1738
- actor?: Actor;
1739
- };
1740
- /** Result of {@link Graph.diff}. */
1741
- type GraphDiffResult = {
1742
- nodesAdded: string[];
1743
- nodesRemoved: string[];
1744
- nodesChanged: GraphDiffChange[];
1745
- /**
1746
- * V0 version bumps (same `v.id`, different `v.version`). Surfaced even
1747
- * when values are identical — the bump itself is audit-meaningful.
1748
- */
1749
- versionChanges: GraphVersionChange[];
1750
- edgesAdded: Array<{
1751
- from: string;
1752
- to: string;
1753
- }>;
1754
- edgesRemoved: Array<{
1755
- from: string;
1756
- to: string;
1757
- }>;
1758
- subgraphsAdded: string[];
1759
- subgraphsRemoved: string[];
1760
- };
1761
- /**
1762
- * WAL-oriented diff — extends {@link GraphDiffResult} with the full node
1763
- * slice for each added path so {@link replayWAL} can reconstruct nodes added
1764
- * between full anchors (topology mutations inside a `compactEvery` window).
1765
- *
1766
- * `Graph.diff()` returns the audit shape (no payload); `attachSnapshotStorage` writes
1767
- * this WAL shape. The two shapes stay structurally compatible — `GraphWALDiff`
1768
- * is a superset.
1769
- */
1770
- type GraphWALDiff = GraphDiffResult & {
1771
- /**
1772
- * Full node slices for every path in `nodesAdded`, keyed by path. Applied
1773
- * verbatim to `snapshot.nodes[path]` during replay.
1774
- */
1775
- nodesAddedFull: Record<string, DescribeNodeOutput>;
1776
- };
1777
- /**
1778
- * Build a WAL-ready diff between two snapshots: the structural diff from
1779
- * {@link Graph.diff} plus the full node slice for each added path (pulled
1780
- * from `b.nodes`). Callers that only need the audit shape should use
1781
- * `Graph.diff` directly.
1782
- */
1783
- declare function diffForWAL(a: GraphDescribeOutput, b: GraphDescribeOutput): GraphWALDiff;
1784
- /** A single field change within a diff. */
1785
- type GraphDiffChange = {
1786
- path: string;
1787
- field: string;
1788
- from: unknown;
1789
- to: unknown;
1790
- };
1791
- /** A single V0 version bump within a diff. */
1792
- type GraphVersionChange = {
1793
- path: string;
1794
- id: string;
1795
- from: number;
1796
- to: number;
1797
- };
1798
- /** Audit record returned by {@link Graph.remove}. */
1799
- type GraphRemoveAudit = {
1800
- /** Whether the removed entry was a local node or a mount. */
1801
- kind: "node" | "mount";
1802
- /**
1803
- * Primary nodes torn down by this `remove()`. For `kind: "node"` contains
1804
- * just the removed name; for `kind: "mount"` lists every primary node in
1805
- * the unmounted subtree (qualified paths relative to the mount point,
1806
- * sorted).
1807
- */
1808
- nodes: string[];
1809
- /**
1810
- * Mounted subgraphs that were unmounted. For `kind: "node"` this is empty;
1811
- * for `kind: "mount"` starts with the top-level mount name and lists its
1812
- * descendants in depth-first order.
1813
- */
1814
- mounts: string[];
1815
- };
1816
- /** Direction for {@link reachable} graph traversal. */
1817
- type ReachableDirection = "upstream" | "downstream";
1818
- /** Options for {@link reachable}. */
1819
- type ReachableOptions = {
1820
- /** Maximum hop depth from `from` (0 returns `[]`). Omit for unbounded traversal. */
1821
- maxDepth?: number;
1822
- /**
1823
- * Traverse both directions in one pass (union of upstream + downstream).
1824
- * Ignores the `direction` arg when set.
1825
- */
1826
- both?: boolean;
1827
- /**
1828
- * Return the richer {@link ReachableResult} shape (paths + per-path
1829
- * hop depth + truncation flag) instead of the flat sorted string array.
1830
- */
1831
- withDetail?: boolean;
1832
- };
1833
- /** Rich reachable result (opt-in via `{withDetail: true}`). */
1834
- type ReachableResult = {
1835
- /** Reachable paths, sorted lexicographically. */
1836
- paths: string[];
1837
- /** Hop depth from `from` to each reachable path. */
1838
- depths: Map<string, number>;
1839
- /** True when traversal hit `maxDepth` and some neighbors were not explored. */
1840
- truncated: boolean;
1841
- };
1842
- /**
1843
- * Reachability query over a {@link Graph.describe} snapshot.
1844
- *
1845
- * Traversal follows `deps` (upstream) and reverse-`deps` (downstream). Edges
1846
- * are derived from deps post Unit 7, so `edges[]` in the snapshot is
1847
- * redundant with deps — it's walked defensively in case a caller supplied a
1848
- * pre-Unit-7 snapshot.
1849
- *
1850
- * @param described - `graph.describe()` output to traverse.
1851
- * @param from - Start path (qualified node path).
1852
- * @param direction - Traversal direction (ignored when `opts.both` is `true`).
1853
- * @param options - Optional `maxDepth`, `both`, `withDetail`.
1854
- * @returns Sorted paths (flat) — or {@link ReachableResult} when `withDetail: true`.
1855
- */
1856
- declare function reachable(described: GraphDescribeOutput, from: string, direction: ReachableDirection, options?: ReachableOptions & {
1857
- withDetail: true;
1858
- }): ReachableResult;
1859
- declare function reachable(described: GraphDescribeOutput, from: string, direction: ReachableDirection, options?: ReachableOptions): string[];
1860
-
1861
- export { type ObserveTheme as A, type ObserveThemeName as B, type CausalChain as C, type DescribeChangeset as D, type ExplainPathOptions as E, type ObserveTier as F, Graph as G, type ReachableOptions as H, type TraceEntry as I, diffForWAL as J, explainPath as K, graphProfile as L, type Meta as M, type NodeProfile as N, type ObserveChangeset as O, reachable as P, topologyDiff as Q, type ReachableDirection as R, SNAPSHOT_VERSION as S, type TopologyEvent as T, type GraphOptions as a, type GraphDescribeOutput as b, type CausalStep as c, type DescribeEvent as d, type DescribeFilter as e, GRAPH_META_SEGMENT as f, type GraphActorOptions as g, type GraphAttachStorageOptions as h, type GraphCheckpointRecord as i, type GraphDescribeOptions as j, type GraphDiagramDirection as k, type GraphDiffChange as l, type GraphDiffResult as m, type GraphFactoryContext as n, type GraphNodeFactory as o, type GraphObserveAll as p, type GraphObserveOne as q, type GraphPersistSnapshot as r, type GraphProfileOptions as s, type GraphProfileResult as t, type GraphVersionChange as u, type GraphWALDiff as v, type ObserveDetail as w, type ObserveEvent as x, type ObserveOptions as y, type ObserveResult as z };