@graphrefly/graphrefly 0.45.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (714) hide show
  1. package/README.md +1 -2
  2. package/dist/_internal-B23BagFd.d.cts +33 -0
  3. package/dist/_internal-B23BagFd.d.ts +33 -0
  4. package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
  5. package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
  6. package/dist/agents-C0Ji9ldU.d.cts +629 -0
  7. package/dist/agents-C9zexT7I.d.ts +629 -0
  8. package/dist/audit-BAXb3VOg.d.ts +246 -0
  9. package/dist/audit-C_bPfkqS.d.cts +246 -0
  10. package/dist/backoff-7KIK3WQW.js +24 -0
  11. package/dist/backoff-7KIK3WQW.js.map +1 -0
  12. package/dist/backoff-Bnb9OoPh.d.cts +6 -0
  13. package/dist/backoff-Bnb9OoPh.d.ts +6 -0
  14. package/dist/base/composition/index.cjs +865 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +468 -0
  17. package/dist/base/composition/index.d.ts +468 -0
  18. package/dist/base/composition/index.js +40 -0
  19. package/dist/base/composition/index.js.map +1 -0
  20. package/dist/base/index.cjs +6390 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +21 -0
  23. package/dist/base/index.d.ts +21 -0
  24. package/dist/base/index.js +259 -0
  25. package/dist/base/index.js.map +1 -0
  26. package/dist/base/io/index.cjs +3270 -0
  27. package/dist/base/io/index.cjs.map +1 -0
  28. package/dist/base/io/index.d.cts +2245 -0
  29. package/dist/base/io/index.d.ts +2245 -0
  30. package/dist/base/io/index.js +117 -0
  31. package/dist/base/io/index.js.map +1 -0
  32. package/dist/base/meta/index.cjs +43 -0
  33. package/dist/base/meta/index.cjs.map +1 -0
  34. package/dist/base/meta/index.d.cts +45 -0
  35. package/dist/base/meta/index.d.ts +45 -0
  36. package/dist/base/meta/index.js +13 -0
  37. package/dist/base/meta/index.js.map +1 -0
  38. package/dist/base/mutation/index.cjs +200 -0
  39. package/dist/base/mutation/index.cjs.map +1 -0
  40. package/dist/base/mutation/index.d.cts +177 -0
  41. package/dist/base/mutation/index.d.ts +177 -0
  42. package/dist/base/mutation/index.js +22 -0
  43. package/dist/base/mutation/index.js.map +1 -0
  44. package/dist/base/render/index.cjs +1120 -0
  45. package/dist/base/render/index.cjs.map +1 -0
  46. package/dist/base/render/index.d.cts +227 -0
  47. package/dist/base/render/index.d.ts +227 -0
  48. package/dist/base/render/index.js +24 -0
  49. package/dist/base/render/index.js.map +1 -0
  50. package/dist/base/sources/browser/index.cjs +172 -0
  51. package/dist/base/sources/browser/index.cjs.map +1 -0
  52. package/dist/base/sources/browser/index.d.cts +84 -0
  53. package/dist/base/sources/browser/index.d.ts +84 -0
  54. package/dist/base/sources/browser/index.js +151 -0
  55. package/dist/base/sources/browser/index.js.map +1 -0
  56. package/dist/base/sources/event/index.cjs +98 -0
  57. package/dist/base/sources/event/index.cjs.map +1 -0
  58. package/dist/base/sources/event/index.d.cts +91 -0
  59. package/dist/base/sources/event/index.d.ts +91 -0
  60. package/dist/base/sources/event/index.js +13 -0
  61. package/dist/base/sources/event/index.js.map +1 -0
  62. package/dist/base/sources/index.cjs +755 -0
  63. package/dist/base/sources/index.cjs.map +1 -0
  64. package/dist/base/sources/index.d.cts +357 -0
  65. package/dist/base/sources/index.d.ts +357 -0
  66. package/dist/base/sources/index.js +42 -0
  67. package/dist/base/sources/index.js.map +1 -0
  68. package/dist/base/sources/node/index.cjs +320 -0
  69. package/dist/base/sources/node/index.cjs.map +1 -0
  70. package/dist/base/sources/node/index.d.cts +185 -0
  71. package/dist/base/sources/node/index.d.ts +185 -0
  72. package/dist/base/sources/node/index.js +306 -0
  73. package/dist/base/sources/node/index.js.map +1 -0
  74. package/dist/base/utils/index.cjs +37 -0
  75. package/dist/base/utils/index.cjs.map +1 -0
  76. package/dist/base/utils/index.d.cts +37 -0
  77. package/dist/base/utils/index.d.ts +37 -0
  78. package/dist/base/utils/index.js +11 -0
  79. package/dist/base/utils/index.js.map +1 -0
  80. package/dist/base/worker/index.cjs +548 -0
  81. package/dist/base/worker/index.cjs.map +1 -0
  82. package/dist/base/worker/index.d.cts +207 -0
  83. package/dist/base/worker/index.d.ts +207 -0
  84. package/dist/base/worker/index.js +20 -0
  85. package/dist/base/worker/index.js.map +1 -0
  86. package/dist/breaker-C9skL3d8.d.ts +175 -0
  87. package/dist/breaker-ugSdq54q.d.cts +175 -0
  88. package/dist/cascading-CSSbKGrJ.d.ts +199 -0
  89. package/dist/cascading-baGkiihI.d.cts +199 -0
  90. package/dist/chunk-22SG74BD.js +207 -0
  91. package/dist/chunk-22SG74BD.js.map +1 -0
  92. package/dist/chunk-255UCBG4.js +58 -0
  93. package/dist/chunk-255UCBG4.js.map +1 -0
  94. package/dist/chunk-2LO3EL4W.js +1 -0
  95. package/dist/chunk-2LO3EL4W.js.map +1 -0
  96. package/dist/chunk-2OB3CEJS.js +1065 -0
  97. package/dist/chunk-2OB3CEJS.js.map +1 -0
  98. package/dist/chunk-36NMM65U.js +144 -0
  99. package/dist/chunk-36NMM65U.js.map +1 -0
  100. package/dist/chunk-3CEXCBN6.js +1 -0
  101. package/dist/chunk-3CEXCBN6.js.map +1 -0
  102. package/dist/chunk-3MUSLI6E.js +105 -0
  103. package/dist/chunk-3MUSLI6E.js.map +1 -0
  104. package/dist/chunk-3PSLNJDU.js +884 -0
  105. package/dist/chunk-3PSLNJDU.js.map +1 -0
  106. package/dist/chunk-42FQ27MQ.js +594 -0
  107. package/dist/chunk-42FQ27MQ.js.map +1 -0
  108. package/dist/chunk-4GYMCUDZ.js +1085 -0
  109. package/dist/chunk-4GYMCUDZ.js.map +1 -0
  110. package/dist/chunk-4S53H2KR.js +382 -0
  111. package/dist/chunk-4S53H2KR.js.map +1 -0
  112. package/dist/chunk-4XCHZRUJ.js +128 -0
  113. package/dist/chunk-4XCHZRUJ.js.map +1 -0
  114. package/dist/chunk-5IMMNARC.js +1153 -0
  115. package/dist/chunk-5IMMNARC.js.map +1 -0
  116. package/dist/chunk-6XZYT4SW.js +256 -0
  117. package/dist/chunk-6XZYT4SW.js.map +1 -0
  118. package/dist/chunk-7EGRP2VX.js +76 -0
  119. package/dist/chunk-7EGRP2VX.js.map +1 -0
  120. package/dist/chunk-A7KV5UK4.js +150 -0
  121. package/dist/chunk-A7KV5UK4.js.map +1 -0
  122. package/dist/chunk-APY2SS5X.js +156 -0
  123. package/dist/chunk-APY2SS5X.js.map +1 -0
  124. package/dist/chunk-AZDQPQ3V.js +66 -0
  125. package/dist/chunk-AZDQPQ3V.js.map +1 -0
  126. package/dist/chunk-BU3SEFA5.js +90 -0
  127. package/dist/chunk-BU3SEFA5.js.map +1 -0
  128. package/dist/chunk-BXGZFGZ4.js +189 -0
  129. package/dist/chunk-BXGZFGZ4.js.map +1 -0
  130. package/dist/chunk-CGHORL6G.js +579 -0
  131. package/dist/chunk-CGHORL6G.js.map +1 -0
  132. package/dist/chunk-CXANAIZU.js +530 -0
  133. package/dist/chunk-CXANAIZU.js.map +1 -0
  134. package/dist/chunk-CZQHCKKG.js +1 -0
  135. package/dist/chunk-CZQHCKKG.js.map +1 -0
  136. package/dist/chunk-DKNHAICT.js +133 -0
  137. package/dist/chunk-DKNHAICT.js.map +1 -0
  138. package/dist/chunk-DM4OMPWK.js +584 -0
  139. package/dist/chunk-DM4OMPWK.js.map +1 -0
  140. package/dist/chunk-DMSNO6ZB.js +452 -0
  141. package/dist/chunk-DMSNO6ZB.js.map +1 -0
  142. package/dist/chunk-E5OZPDIW.js +229 -0
  143. package/dist/chunk-E5OZPDIW.js.map +1 -0
  144. package/dist/chunk-EHRRQ4IC.js +211 -0
  145. package/dist/chunk-EHRRQ4IC.js.map +1 -0
  146. package/dist/chunk-EVYY4X5A.js +509 -0
  147. package/dist/chunk-EVYY4X5A.js.map +1 -0
  148. package/dist/chunk-FDFD67UO.js +1 -0
  149. package/dist/chunk-FDFD67UO.js.map +1 -0
  150. package/dist/chunk-FMPF42Q4.js +13 -0
  151. package/dist/chunk-FMPF42Q4.js.map +1 -0
  152. package/dist/chunk-FW23JYNQ.js +454 -0
  153. package/dist/chunk-FW23JYNQ.js.map +1 -0
  154. package/dist/chunk-GWRNLJNW.js +2508 -0
  155. package/dist/chunk-GWRNLJNW.js.map +1 -0
  156. package/dist/chunk-HL7HUJIX.js +1 -0
  157. package/dist/chunk-HL7HUJIX.js.map +1 -0
  158. package/dist/chunk-IHTWQEDR.js +169 -0
  159. package/dist/chunk-IHTWQEDR.js.map +1 -0
  160. package/dist/chunk-IJRR6YAI.js +128 -0
  161. package/dist/chunk-IJRR6YAI.js.map +1 -0
  162. package/dist/chunk-JGFRAFDL.js +221 -0
  163. package/dist/chunk-JGFRAFDL.js.map +1 -0
  164. package/dist/chunk-JKTC747G.js +725 -0
  165. package/dist/chunk-JKTC747G.js.map +1 -0
  166. package/dist/chunk-KN3H5CNT.js +11 -0
  167. package/dist/chunk-KN3H5CNT.js.map +1 -0
  168. package/dist/chunk-KPG3DGLA.js +1 -0
  169. package/dist/chunk-KPG3DGLA.js.map +1 -0
  170. package/dist/chunk-KRNQ6RGQ.js +1 -0
  171. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  172. package/dist/chunk-MLTPJMH6.js +417 -0
  173. package/dist/chunk-MLTPJMH6.js.map +1 -0
  174. package/dist/chunk-N3SZ7BMH.js +95 -0
  175. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  176. package/dist/chunk-NDUD3IMO.js +540 -0
  177. package/dist/chunk-NDUD3IMO.js.map +1 -0
  178. package/dist/chunk-NY2PYHNC.js +873 -0
  179. package/dist/chunk-NY2PYHNC.js.map +1 -0
  180. package/dist/chunk-O3MT7DYI.js +225 -0
  181. package/dist/chunk-O3MT7DYI.js.map +1 -0
  182. package/dist/chunk-OCUDSN63.js +2386 -0
  183. package/dist/chunk-OCUDSN63.js.map +1 -0
  184. package/dist/chunk-OIWU3NYV.js +199 -0
  185. package/dist/chunk-OIWU3NYV.js.map +1 -0
  186. package/dist/chunk-OQUIJT7A.js +1 -0
  187. package/dist/chunk-OQUIJT7A.js.map +1 -0
  188. package/dist/chunk-P5LBT622.js +105 -0
  189. package/dist/chunk-P5LBT622.js.map +1 -0
  190. package/dist/chunk-PKGQG5QQ.js +519 -0
  191. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  192. package/dist/chunk-PKPO3JTZ.js +561 -0
  193. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  194. package/dist/chunk-PL5UDIQ5.js +118 -0
  195. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  196. package/dist/chunk-PZWISPIQ.js +432 -0
  197. package/dist/chunk-PZWISPIQ.js.map +1 -0
  198. package/dist/chunk-Q3EYOCZB.js +510 -0
  199. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  200. package/dist/chunk-QMBYUVRL.js +15 -0
  201. package/dist/chunk-QMBYUVRL.js.map +1 -0
  202. package/dist/chunk-RAGGHLCV.js +200 -0
  203. package/dist/chunk-RAGGHLCV.js.map +1 -0
  204. package/dist/chunk-RJOG4IJU.js +1039 -0
  205. package/dist/chunk-RJOG4IJU.js.map +1 -0
  206. package/dist/chunk-SOOKUYVM.js +403 -0
  207. package/dist/chunk-SOOKUYVM.js.map +1 -0
  208. package/dist/chunk-T5BN5KG7.js +1 -0
  209. package/dist/chunk-T5BN5KG7.js.map +1 -0
  210. package/dist/chunk-TNX5ZGDJ.js +574 -0
  211. package/dist/chunk-TNX5ZGDJ.js.map +1 -0
  212. package/dist/chunk-TP7244Y6.js +207 -0
  213. package/dist/chunk-TP7244Y6.js.map +1 -0
  214. package/dist/chunk-TSBFTJKM.js +57 -0
  215. package/dist/chunk-TSBFTJKM.js.map +1 -0
  216. package/dist/chunk-URQ2CBBF.js +143 -0
  217. package/dist/chunk-URQ2CBBF.js.map +1 -0
  218. package/dist/chunk-VLAGJZSL.js +1079 -0
  219. package/dist/chunk-VLAGJZSL.js.map +1 -0
  220. package/dist/chunk-W2BOPXTI.js +1 -0
  221. package/dist/chunk-W2BOPXTI.js.map +1 -0
  222. package/dist/chunk-Y52CS6YA.js +88 -0
  223. package/dist/chunk-Y52CS6YA.js.map +1 -0
  224. package/dist/chunk-YCBUWK77.js +92 -0
  225. package/dist/chunk-YCBUWK77.js.map +1 -0
  226. package/dist/chunk-YJ4U2D2C.js +314 -0
  227. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  228. package/dist/chunk-Z4YXAUDN.js +239 -0
  229. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  230. package/dist/chunk-Z65DVDEQ.js +146 -0
  231. package/dist/chunk-Z65DVDEQ.js.map +1 -0
  232. package/dist/chunk-Z6EGP5D7.js +92 -0
  233. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  234. package/dist/chunk-ZT4WMQW4.js +1575 -0
  235. package/dist/chunk-ZT4WMQW4.js.map +1 -0
  236. package/dist/chunk-ZVXXDWIB.js +1282 -0
  237. package/dist/chunk-ZVXXDWIB.js.map +1 -0
  238. package/dist/compat/index.cjs +3150 -6
  239. package/dist/compat/index.cjs.map +1 -1
  240. package/dist/compat/index.d.cts +116 -1
  241. package/dist/compat/index.d.ts +116 -1
  242. package/dist/compat/index.js +175 -2
  243. package/dist/compat/index.js.map +1 -1
  244. package/dist/compat/jotai/index.cjs +130 -2
  245. package/dist/compat/jotai/index.cjs.map +1 -1
  246. package/dist/compat/jotai/index.d.cts +2 -1
  247. package/dist/compat/jotai/index.d.ts +2 -1
  248. package/dist/compat/jotai/index.js +7 -2
  249. package/dist/compat/jotai/index.js.map +1 -1
  250. package/dist/compat/nanostores/index.cjs +186 -2
  251. package/dist/compat/nanostores/index.cjs.map +1 -1
  252. package/dist/compat/nanostores/index.d.cts +2 -1
  253. package/dist/compat/nanostores/index.d.ts +2 -1
  254. package/dist/compat/nanostores/index.js +21 -2
  255. package/dist/compat/nanostores/index.js.map +1 -1
  256. package/dist/compat/nestjs/index.cjs +2291 -6
  257. package/dist/compat/nestjs/index.cjs.map +1 -1
  258. package/dist/compat/nestjs/index.d.cts +10 -1
  259. package/dist/compat/nestjs/index.d.ts +10 -1
  260. package/dist/compat/nestjs/index.js +76 -2
  261. package/dist/compat/nestjs/index.js.map +1 -1
  262. package/dist/compat/react/index.cjs +95 -2
  263. package/dist/compat/react/index.cjs.map +1 -1
  264. package/dist/compat/react/index.d.cts +2 -1
  265. package/dist/compat/react/index.d.ts +2 -1
  266. package/dist/compat/react/index.js +11 -2
  267. package/dist/compat/react/index.js.map +1 -1
  268. package/dist/compat/solid/index.cjs +82 -2
  269. package/dist/compat/solid/index.cjs.map +1 -1
  270. package/dist/compat/solid/index.d.cts +2 -1
  271. package/dist/compat/solid/index.d.ts +2 -1
  272. package/dist/compat/solid/index.js +11 -2
  273. package/dist/compat/solid/index.js.map +1 -1
  274. package/dist/compat/svelte/index.cjs +85 -2
  275. package/dist/compat/svelte/index.cjs.map +1 -1
  276. package/dist/compat/svelte/index.d.cts +2 -1
  277. package/dist/compat/svelte/index.d.ts +2 -1
  278. package/dist/compat/svelte/index.js +11 -2
  279. package/dist/compat/svelte/index.js.map +1 -1
  280. package/dist/compat/vue/index.cjs +100 -2
  281. package/dist/compat/vue/index.cjs.map +1 -1
  282. package/dist/compat/vue/index.d.cts +3 -1
  283. package/dist/compat/vue/index.d.ts +3 -1
  284. package/dist/compat/vue/index.js +11 -2
  285. package/dist/compat/vue/index.js.map +1 -1
  286. package/dist/compat/zustand/index.cjs +50 -2
  287. package/dist/compat/zustand/index.cjs.map +1 -1
  288. package/dist/compat/zustand/index.d.cts +2 -1
  289. package/dist/compat/zustand/index.d.ts +2 -1
  290. package/dist/compat/zustand/index.js +7 -2
  291. package/dist/compat/zustand/index.js.map +1 -1
  292. package/dist/distill-De6Rnn15.d.cts +48 -0
  293. package/dist/distill-De6Rnn15.d.ts +48 -0
  294. package/dist/external-register-CWyroXb_.d.cts +138 -0
  295. package/dist/external-register-CWyroXb_.d.ts +138 -0
  296. package/dist/fallback-Bx46zqky.d.cts +243 -0
  297. package/dist/fallback-pIWW8A2d.d.ts +243 -0
  298. package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
  299. package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
  300. package/dist/index-B6pxYJzO.d.cts +36 -0
  301. package/dist/index-B6pxYJzO.d.ts +36 -0
  302. package/dist/index-BFsng6v1.d.cts +44 -0
  303. package/dist/index-BFsng6v1.d.ts +44 -0
  304. package/dist/index-B_p8tnvf.d.cts +770 -0
  305. package/dist/index-Bg-LwEt-.d.cts +45 -0
  306. package/dist/index-Bg-LwEt-.d.ts +45 -0
  307. package/dist/index-Brp888t0.d.cts +127 -0
  308. package/dist/index-Brp888t0.d.ts +127 -0
  309. package/dist/index-CDfk6jHN.d.cts +37 -0
  310. package/dist/index-CDfk6jHN.d.ts +37 -0
  311. package/dist/index-DLAxYaN5.d.cts +169 -0
  312. package/dist/index-DLAxYaN5.d.ts +169 -0
  313. package/dist/index-DeWbQzMe.d.cts +34 -0
  314. package/dist/index-DeWbQzMe.d.ts +34 -0
  315. package/dist/index-_HDSmPyp.d.ts +770 -0
  316. package/dist/index-dX9IzPqj.d.cts +86 -0
  317. package/dist/index-dX9IzPqj.d.ts +86 -0
  318. package/dist/index.cjs +26009 -0
  319. package/dist/index.cjs.map +1 -1
  320. package/dist/index.d.cts +55 -42
  321. package/dist/index.d.ts +55 -42
  322. package/dist/index.js +849 -0
  323. package/dist/index.js.map +1 -1
  324. package/dist/layout-types-B5aiHYgk.d.cts +72 -0
  325. package/dist/layout-types-B5aiHYgk.d.ts +72 -0
  326. package/dist/memory-composers-BryDrRBX.d.cts +529 -0
  327. package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
  328. package/dist/observable-B25XqCbZ.d.cts +59 -0
  329. package/dist/observable-B25XqCbZ.d.ts +59 -0
  330. package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
  331. package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
  332. package/dist/presets/ai/index.cjs +4377 -0
  333. package/dist/presets/ai/index.cjs.map +1 -0
  334. package/dist/presets/ai/index.d.cts +98 -0
  335. package/dist/presets/ai/index.d.ts +98 -0
  336. package/dist/presets/ai/index.js +54 -0
  337. package/dist/presets/ai/index.js.map +1 -0
  338. package/dist/presets/harness/index.cjs +5929 -0
  339. package/dist/presets/harness/index.cjs.map +1 -0
  340. package/dist/presets/harness/index.d.cts +566 -0
  341. package/dist/presets/harness/index.d.ts +566 -0
  342. package/dist/presets/harness/index.js +71 -0
  343. package/dist/presets/harness/index.js.map +1 -0
  344. package/dist/presets/index.cjs +9782 -0
  345. package/dist/presets/index.cjs.map +1 -0
  346. package/dist/presets/index.d.cts +28 -0
  347. package/dist/presets/index.d.ts +28 -0
  348. package/dist/presets/index.js +129 -0
  349. package/dist/presets/index.js.map +1 -0
  350. package/dist/presets/inspect/index.cjs +1087 -0
  351. package/dist/presets/inspect/index.cjs.map +1 -0
  352. package/dist/presets/inspect/index.d.cts +172 -0
  353. package/dist/presets/inspect/index.d.ts +172 -0
  354. package/dist/presets/inspect/index.js +21 -0
  355. package/dist/presets/inspect/index.js.map +1 -0
  356. package/dist/presets/resilience/index.cjs +1593 -0
  357. package/dist/presets/resilience/index.cjs.map +1 -0
  358. package/dist/presets/resilience/index.d.cts +205 -0
  359. package/dist/presets/resilience/index.d.ts +205 -0
  360. package/dist/presets/resilience/index.js +18 -0
  361. package/dist/presets/resilience/index.js.map +1 -0
  362. package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
  363. package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
  364. package/dist/reactive-layout-fswlBUvX.d.cts +195 -0
  365. package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
  366. package/dist/retry-BDbRZ_gx.d.ts +125 -0
  367. package/dist/retry-DWuhjvsA.d.cts +125 -0
  368. package/dist/solutions/index.cjs +8200 -0
  369. package/dist/solutions/index.cjs.map +1 -0
  370. package/dist/solutions/index.d.cts +23 -0
  371. package/dist/solutions/index.d.ts +23 -0
  372. package/dist/solutions/index.js +55 -0
  373. package/dist/solutions/index.js.map +1 -0
  374. package/dist/spawnable-5mDY501F.d.cts +746 -0
  375. package/dist/spawnable-D3lR0oQu.d.ts +746 -0
  376. package/dist/status-U-rUI79b.d.cts +84 -0
  377. package/dist/status-U-rUI79b.d.ts +84 -0
  378. package/dist/timeout-U5O4ESK3.js +12 -0
  379. package/dist/timeout-U5O4ESK3.js.map +1 -0
  380. package/dist/types-BB5Lw-pB.d.cts +442 -0
  381. package/dist/types-BB5Lw-pB.d.ts +442 -0
  382. package/dist/types-CJWIMJiZ.d.ts +548 -0
  383. package/dist/types-vCq7ShIm.d.cts +548 -0
  384. package/dist/utils/ai/browser.cjs +2169 -0
  385. package/dist/utils/ai/browser.cjs.map +1 -0
  386. package/dist/utils/ai/browser.d.cts +129 -0
  387. package/dist/utils/ai/browser.d.ts +129 -0
  388. package/dist/utils/ai/browser.js +255 -0
  389. package/dist/utils/ai/browser.js.map +1 -0
  390. package/dist/utils/ai/index.cjs +8468 -0
  391. package/dist/utils/ai/index.cjs.map +1 -0
  392. package/dist/utils/ai/index.d.cts +1777 -0
  393. package/dist/utils/ai/index.d.ts +1777 -0
  394. package/dist/utils/ai/index.js +173 -0
  395. package/dist/utils/ai/index.js.map +1 -0
  396. package/dist/utils/ai/node.cjs +648 -0
  397. package/dist/utils/ai/node.cjs.map +1 -0
  398. package/dist/utils/ai/node.d.cts +57 -0
  399. package/dist/utils/ai/node.d.ts +57 -0
  400. package/dist/utils/ai/node.js +84 -0
  401. package/dist/utils/ai/node.js.map +1 -0
  402. package/dist/utils/cqrs/index.cjs +1036 -0
  403. package/dist/utils/cqrs/index.cjs.map +1 -0
  404. package/dist/utils/cqrs/index.d.cts +438 -0
  405. package/dist/utils/cqrs/index.d.ts +438 -0
  406. package/dist/utils/cqrs/index.js +18 -0
  407. package/dist/utils/cqrs/index.js.map +1 -0
  408. package/dist/utils/demo-shell/index.cjs +865 -0
  409. package/dist/utils/demo-shell/index.cjs.map +1 -0
  410. package/dist/utils/demo-shell/index.d.cts +90 -0
  411. package/dist/utils/demo-shell/index.d.ts +90 -0
  412. package/dist/utils/demo-shell/index.js +13 -0
  413. package/dist/utils/demo-shell/index.js.map +1 -0
  414. package/dist/utils/domain-templates/index.cjs +732 -0
  415. package/dist/utils/domain-templates/index.cjs.map +1 -0
  416. package/dist/utils/domain-templates/index.d.cts +214 -0
  417. package/dist/utils/domain-templates/index.d.ts +214 -0
  418. package/dist/utils/domain-templates/index.js +17 -0
  419. package/dist/utils/domain-templates/index.js.map +1 -0
  420. package/dist/utils/graphspec/index.cjs +1174 -0
  421. package/dist/utils/graphspec/index.cjs.map +1 -0
  422. package/dist/utils/graphspec/index.d.cts +449 -0
  423. package/dist/utils/graphspec/index.d.ts +449 -0
  424. package/dist/utils/graphspec/index.js +35 -0
  425. package/dist/utils/graphspec/index.js.map +1 -0
  426. package/dist/utils/harness/index.cjs +656 -0
  427. package/dist/utils/harness/index.cjs.map +1 -0
  428. package/dist/utils/harness/index.d.cts +542 -0
  429. package/dist/utils/harness/index.d.ts +542 -0
  430. package/dist/utils/harness/index.js +56 -0
  431. package/dist/utils/harness/index.js.map +1 -0
  432. package/dist/utils/index.cjs +17614 -0
  433. package/dist/utils/index.cjs.map +1 -0
  434. package/dist/utils/index.d.cts +96 -0
  435. package/dist/utils/index.d.ts +96 -0
  436. package/dist/utils/index.js +514 -0
  437. package/dist/utils/index.js.map +1 -0
  438. package/dist/utils/inspect/index.cjs +807 -0
  439. package/dist/utils/inspect/index.cjs.map +1 -0
  440. package/dist/utils/inspect/index.d.cts +123 -0
  441. package/dist/utils/inspect/index.d.ts +123 -0
  442. package/dist/utils/inspect/index.js +30 -0
  443. package/dist/utils/inspect/index.js.map +1 -0
  444. package/dist/utils/job-queue/index.cjs +717 -0
  445. package/dist/utils/job-queue/index.cjs.map +1 -0
  446. package/dist/utils/job-queue/index.d.cts +200 -0
  447. package/dist/utils/job-queue/index.d.ts +200 -0
  448. package/dist/utils/job-queue/index.js +18 -0
  449. package/dist/utils/job-queue/index.js.map +1 -0
  450. package/dist/utils/memory/index.cjs +1456 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/utils/memory/index.d.cts +660 -0
  453. package/dist/utils/memory/index.d.ts +660 -0
  454. package/dist/utils/memory/index.js +19 -0
  455. package/dist/utils/memory/index.js.map +1 -0
  456. package/dist/utils/messaging/index.cjs +666 -0
  457. package/dist/utils/messaging/index.cjs.map +1 -0
  458. package/dist/utils/messaging/index.d.cts +562 -0
  459. package/dist/utils/messaging/index.d.ts +562 -0
  460. package/dist/utils/messaging/index.js +50 -0
  461. package/dist/utils/messaging/index.js.map +1 -0
  462. package/dist/utils/orchestration/index.cjs +876 -0
  463. package/dist/utils/orchestration/index.cjs.map +1 -0
  464. package/dist/utils/orchestration/index.d.cts +233 -0
  465. package/dist/utils/orchestration/index.d.ts +233 -0
  466. package/dist/utils/orchestration/index.js +19 -0
  467. package/dist/utils/orchestration/index.js.map +1 -0
  468. package/dist/utils/process/index.cjs +743 -0
  469. package/dist/utils/process/index.cjs.map +1 -0
  470. package/dist/utils/process/index.d.cts +411 -0
  471. package/dist/utils/process/index.d.ts +411 -0
  472. package/dist/utils/process/index.js +14 -0
  473. package/dist/utils/process/index.js.map +1 -0
  474. package/dist/utils/reactive-layout/index.cjs +1607 -0
  475. package/dist/utils/reactive-layout/index.cjs.map +1 -0
  476. package/dist/utils/reactive-layout/index.d.cts +492 -0
  477. package/dist/utils/reactive-layout/index.d.ts +492 -0
  478. package/dist/utils/reactive-layout/index.js +52 -0
  479. package/dist/utils/reactive-layout/index.js.map +1 -0
  480. package/dist/utils/reduction/index.cjs +203 -0
  481. package/dist/utils/reduction/index.cjs.map +1 -0
  482. package/dist/utils/reduction/index.d.cts +102 -0
  483. package/dist/utils/reduction/index.d.ts +102 -0
  484. package/dist/utils/reduction/index.js +14 -0
  485. package/dist/utils/reduction/index.js.map +1 -0
  486. package/dist/utils/resilience/index.cjs +1617 -0
  487. package/dist/utils/resilience/index.cjs.map +1 -0
  488. package/dist/utils/resilience/index.d.cts +9 -0
  489. package/dist/utils/resilience/index.d.ts +9 -0
  490. package/dist/utils/resilience/index.js +44 -0
  491. package/dist/utils/resilience/index.js.map +1 -0
  492. package/dist/utils/surface/index.cjs +1070 -0
  493. package/dist/utils/surface/index.cjs.map +1 -0
  494. package/dist/utils/surface/index.d.cts +240 -0
  495. package/dist/utils/surface/index.d.ts +240 -0
  496. package/dist/utils/surface/index.js +30 -0
  497. package/dist/utils/surface/index.js.map +1 -0
  498. package/dist/utils/topology-view/index.cjs +620 -0
  499. package/dist/utils/topology-view/index.cjs.map +1 -0
  500. package/dist/utils/topology-view/index.d.cts +68 -0
  501. package/dist/utils/topology-view/index.d.ts +68 -0
  502. package/dist/utils/topology-view/index.js +11 -0
  503. package/dist/utils/topology-view/index.js.map +1 -0
  504. package/package.json +293 -241
  505. package/dist/core/index.cjs +0 -21
  506. package/dist/core/index.cjs.map +0 -1
  507. package/dist/core/index.d.cts +0 -1
  508. package/dist/core/index.d.ts +0 -1
  509. package/dist/core/index.js +0 -3
  510. package/dist/core/index.js.map +0 -1
  511. package/dist/extra/browser.cjs +0 -21
  512. package/dist/extra/browser.cjs.map +0 -1
  513. package/dist/extra/browser.d.cts +0 -1
  514. package/dist/extra/browser.d.ts +0 -1
  515. package/dist/extra/browser.js +0 -3
  516. package/dist/extra/browser.js.map +0 -1
  517. package/dist/extra/index.cjs +0 -21
  518. package/dist/extra/index.cjs.map +0 -1
  519. package/dist/extra/index.d.cts +0 -1
  520. package/dist/extra/index.d.ts +0 -1
  521. package/dist/extra/index.js +0 -3
  522. package/dist/extra/index.js.map +0 -1
  523. package/dist/extra/node.cjs +0 -21
  524. package/dist/extra/node.cjs.map +0 -1
  525. package/dist/extra/node.d.cts +0 -1
  526. package/dist/extra/node.d.ts +0 -1
  527. package/dist/extra/node.js +0 -3
  528. package/dist/extra/node.js.map +0 -1
  529. package/dist/extra/operators.cjs +0 -21
  530. package/dist/extra/operators.cjs.map +0 -1
  531. package/dist/extra/operators.d.cts +0 -1
  532. package/dist/extra/operators.d.ts +0 -1
  533. package/dist/extra/operators.js +0 -3
  534. package/dist/extra/operators.js.map +0 -1
  535. package/dist/extra/reactive.cjs +0 -21
  536. package/dist/extra/reactive.cjs.map +0 -1
  537. package/dist/extra/reactive.d.cts +0 -1
  538. package/dist/extra/reactive.d.ts +0 -1
  539. package/dist/extra/reactive.js +0 -3
  540. package/dist/extra/reactive.js.map +0 -1
  541. package/dist/extra/render/index.cjs +0 -21
  542. package/dist/extra/render/index.cjs.map +0 -1
  543. package/dist/extra/render/index.d.cts +0 -1
  544. package/dist/extra/render/index.d.ts +0 -1
  545. package/dist/extra/render/index.js +0 -3
  546. package/dist/extra/render/index.js.map +0 -1
  547. package/dist/extra/sources.cjs +0 -21
  548. package/dist/extra/sources.cjs.map +0 -1
  549. package/dist/extra/sources.d.cts +0 -1
  550. package/dist/extra/sources.d.ts +0 -1
  551. package/dist/extra/sources.js +0 -3
  552. package/dist/extra/sources.js.map +0 -1
  553. package/dist/extra/storage-browser.cjs +0 -21
  554. package/dist/extra/storage-browser.cjs.map +0 -1
  555. package/dist/extra/storage-browser.d.cts +0 -1
  556. package/dist/extra/storage-browser.d.ts +0 -1
  557. package/dist/extra/storage-browser.js +0 -3
  558. package/dist/extra/storage-browser.js.map +0 -1
  559. package/dist/extra/storage-core.cjs +0 -21
  560. package/dist/extra/storage-core.cjs.map +0 -1
  561. package/dist/extra/storage-core.d.cts +0 -1
  562. package/dist/extra/storage-core.d.ts +0 -1
  563. package/dist/extra/storage-core.js +0 -3
  564. package/dist/extra/storage-core.js.map +0 -1
  565. package/dist/extra/storage-node.cjs +0 -21
  566. package/dist/extra/storage-node.cjs.map +0 -1
  567. package/dist/extra/storage-node.d.cts +0 -1
  568. package/dist/extra/storage-node.d.ts +0 -1
  569. package/dist/extra/storage-node.js +0 -3
  570. package/dist/extra/storage-node.js.map +0 -1
  571. package/dist/extra/storage-tiers-browser.cjs +0 -21
  572. package/dist/extra/storage-tiers-browser.cjs.map +0 -1
  573. package/dist/extra/storage-tiers-browser.d.cts +0 -1
  574. package/dist/extra/storage-tiers-browser.d.ts +0 -1
  575. package/dist/extra/storage-tiers-browser.js +0 -3
  576. package/dist/extra/storage-tiers-browser.js.map +0 -1
  577. package/dist/extra/storage-tiers-node.cjs +0 -21
  578. package/dist/extra/storage-tiers-node.cjs.map +0 -1
  579. package/dist/extra/storage-tiers-node.d.cts +0 -1
  580. package/dist/extra/storage-tiers-node.d.ts +0 -1
  581. package/dist/extra/storage-tiers-node.js +0 -3
  582. package/dist/extra/storage-tiers-node.js.map +0 -1
  583. package/dist/extra/storage-tiers.cjs +0 -21
  584. package/dist/extra/storage-tiers.cjs.map +0 -1
  585. package/dist/extra/storage-tiers.d.cts +0 -1
  586. package/dist/extra/storage-tiers.d.ts +0 -1
  587. package/dist/extra/storage-tiers.js +0 -3
  588. package/dist/extra/storage-tiers.js.map +0 -1
  589. package/dist/extra/storage-wal.cjs +0 -21
  590. package/dist/extra/storage-wal.cjs.map +0 -1
  591. package/dist/extra/storage-wal.d.cts +0 -1
  592. package/dist/extra/storage-wal.d.ts +0 -1
  593. package/dist/extra/storage-wal.js +0 -3
  594. package/dist/extra/storage-wal.js.map +0 -1
  595. package/dist/graph/index.cjs +0 -21
  596. package/dist/graph/index.cjs.map +0 -1
  597. package/dist/graph/index.d.cts +0 -1
  598. package/dist/graph/index.d.ts +0 -1
  599. package/dist/graph/index.js +0 -3
  600. package/dist/graph/index.js.map +0 -1
  601. package/dist/patterns/ai/browser.cjs +0 -21
  602. package/dist/patterns/ai/browser.cjs.map +0 -1
  603. package/dist/patterns/ai/browser.d.cts +0 -1
  604. package/dist/patterns/ai/browser.d.ts +0 -1
  605. package/dist/patterns/ai/browser.js +0 -3
  606. package/dist/patterns/ai/browser.js.map +0 -1
  607. package/dist/patterns/ai/index.cjs +0 -21
  608. package/dist/patterns/ai/index.cjs.map +0 -1
  609. package/dist/patterns/ai/index.d.cts +0 -1
  610. package/dist/patterns/ai/index.d.ts +0 -1
  611. package/dist/patterns/ai/index.js +0 -3
  612. package/dist/patterns/ai/index.js.map +0 -1
  613. package/dist/patterns/ai/node.cjs +0 -21
  614. package/dist/patterns/ai/node.cjs.map +0 -1
  615. package/dist/patterns/ai/node.d.cts +0 -1
  616. package/dist/patterns/ai/node.d.ts +0 -1
  617. package/dist/patterns/ai/node.js +0 -3
  618. package/dist/patterns/ai/node.js.map +0 -1
  619. package/dist/patterns/cqrs/index.cjs +0 -21
  620. package/dist/patterns/cqrs/index.cjs.map +0 -1
  621. package/dist/patterns/cqrs/index.d.cts +0 -1
  622. package/dist/patterns/cqrs/index.d.ts +0 -1
  623. package/dist/patterns/cqrs/index.js +0 -3
  624. package/dist/patterns/cqrs/index.js.map +0 -1
  625. package/dist/patterns/demo-shell/index.cjs +0 -21
  626. package/dist/patterns/demo-shell/index.cjs.map +0 -1
  627. package/dist/patterns/demo-shell/index.d.cts +0 -1
  628. package/dist/patterns/demo-shell/index.d.ts +0 -1
  629. package/dist/patterns/demo-shell/index.js +0 -3
  630. package/dist/patterns/demo-shell/index.js.map +0 -1
  631. package/dist/patterns/domain-templates/index.cjs +0 -21
  632. package/dist/patterns/domain-templates/index.cjs.map +0 -1
  633. package/dist/patterns/domain-templates/index.d.cts +0 -1
  634. package/dist/patterns/domain-templates/index.d.ts +0 -1
  635. package/dist/patterns/domain-templates/index.js +0 -3
  636. package/dist/patterns/domain-templates/index.js.map +0 -1
  637. package/dist/patterns/graphspec/index.cjs +0 -21
  638. package/dist/patterns/graphspec/index.cjs.map +0 -1
  639. package/dist/patterns/graphspec/index.d.cts +0 -1
  640. package/dist/patterns/graphspec/index.d.ts +0 -1
  641. package/dist/patterns/graphspec/index.js +0 -3
  642. package/dist/patterns/graphspec/index.js.map +0 -1
  643. package/dist/patterns/harness/index.cjs +0 -21
  644. package/dist/patterns/harness/index.cjs.map +0 -1
  645. package/dist/patterns/harness/index.d.cts +0 -1
  646. package/dist/patterns/harness/index.d.ts +0 -1
  647. package/dist/patterns/harness/index.js +0 -3
  648. package/dist/patterns/harness/index.js.map +0 -1
  649. package/dist/patterns/inspect/index.cjs +0 -21
  650. package/dist/patterns/inspect/index.cjs.map +0 -1
  651. package/dist/patterns/inspect/index.d.cts +0 -1
  652. package/dist/patterns/inspect/index.d.ts +0 -1
  653. package/dist/patterns/inspect/index.js +0 -3
  654. package/dist/patterns/inspect/index.js.map +0 -1
  655. package/dist/patterns/job-queue/index.cjs +0 -21
  656. package/dist/patterns/job-queue/index.cjs.map +0 -1
  657. package/dist/patterns/job-queue/index.d.cts +0 -1
  658. package/dist/patterns/job-queue/index.d.ts +0 -1
  659. package/dist/patterns/job-queue/index.js +0 -3
  660. package/dist/patterns/job-queue/index.js.map +0 -1
  661. package/dist/patterns/memory/index.cjs +0 -21
  662. package/dist/patterns/memory/index.cjs.map +0 -1
  663. package/dist/patterns/memory/index.d.cts +0 -1
  664. package/dist/patterns/memory/index.d.ts +0 -1
  665. package/dist/patterns/memory/index.js +0 -3
  666. package/dist/patterns/memory/index.js.map +0 -1
  667. package/dist/patterns/messaging/index.cjs +0 -21
  668. package/dist/patterns/messaging/index.cjs.map +0 -1
  669. package/dist/patterns/messaging/index.d.cts +0 -1
  670. package/dist/patterns/messaging/index.d.ts +0 -1
  671. package/dist/patterns/messaging/index.js +0 -3
  672. package/dist/patterns/messaging/index.js.map +0 -1
  673. package/dist/patterns/orchestration/index.cjs +0 -21
  674. package/dist/patterns/orchestration/index.cjs.map +0 -1
  675. package/dist/patterns/orchestration/index.d.cts +0 -1
  676. package/dist/patterns/orchestration/index.d.ts +0 -1
  677. package/dist/patterns/orchestration/index.js +0 -3
  678. package/dist/patterns/orchestration/index.js.map +0 -1
  679. package/dist/patterns/process/index.cjs +0 -21
  680. package/dist/patterns/process/index.cjs.map +0 -1
  681. package/dist/patterns/process/index.d.cts +0 -1
  682. package/dist/patterns/process/index.d.ts +0 -1
  683. package/dist/patterns/process/index.js +0 -3
  684. package/dist/patterns/process/index.js.map +0 -1
  685. package/dist/patterns/reactive-layout/index.cjs +0 -21
  686. package/dist/patterns/reactive-layout/index.cjs.map +0 -1
  687. package/dist/patterns/reactive-layout/index.d.cts +0 -1
  688. package/dist/patterns/reactive-layout/index.d.ts +0 -1
  689. package/dist/patterns/reactive-layout/index.js +0 -3
  690. package/dist/patterns/reactive-layout/index.js.map +0 -1
  691. package/dist/patterns/reduction/index.cjs +0 -21
  692. package/dist/patterns/reduction/index.cjs.map +0 -1
  693. package/dist/patterns/reduction/index.d.cts +0 -1
  694. package/dist/patterns/reduction/index.d.ts +0 -1
  695. package/dist/patterns/reduction/index.js +0 -3
  696. package/dist/patterns/reduction/index.js.map +0 -1
  697. package/dist/patterns/surface/index.cjs +0 -21
  698. package/dist/patterns/surface/index.cjs.map +0 -1
  699. package/dist/patterns/surface/index.d.cts +0 -1
  700. package/dist/patterns/surface/index.d.ts +0 -1
  701. package/dist/patterns/surface/index.js +0 -3
  702. package/dist/patterns/surface/index.js.map +0 -1
  703. package/dist/patterns/topology-view/index.cjs +0 -21
  704. package/dist/patterns/topology-view/index.cjs.map +0 -1
  705. package/dist/patterns/topology-view/index.d.cts +0 -1
  706. package/dist/patterns/topology-view/index.d.ts +0 -1
  707. package/dist/patterns/topology-view/index.js +0 -3
  708. package/dist/patterns/topology-view/index.js.map +0 -1
  709. package/dist/testing/index.cjs +0 -21
  710. package/dist/testing/index.cjs.map +0 -1
  711. package/dist/testing/index.d.cts +0 -1
  712. package/dist/testing/index.d.ts +0 -1
  713. package/dist/testing/index.js +0 -3
  714. package/dist/testing/index.js.map +0 -1
@@ -0,0 +1,1070 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/surface/index.ts
21
+ var surface_exports = {};
22
+ __export(surface_exports, {
23
+ SNAPSHOT_WIRE_VERSION: () => SNAPSHOT_WIRE_VERSION,
24
+ SurfaceError: () => SurfaceError,
25
+ asSurfaceError: () => asSurfaceError,
26
+ createGraph: () => createGraph,
27
+ deleteSnapshot: () => deleteSnapshot,
28
+ diffSnapshots: () => diffSnapshots,
29
+ listSnapshots: () => listSnapshots,
30
+ restoreSnapshot: () => restoreSnapshot,
31
+ runReduction: () => runReduction,
32
+ saveSnapshot: () => saveSnapshot
33
+ });
34
+ module.exports = __toCommonJS(surface_exports);
35
+
36
+ // src/utils/graphspec/index.ts
37
+ var import_core3 = require("@graphrefly/pure-ts/core");
38
+ var import_graph3 = require("@graphrefly/pure-ts/graph");
39
+
40
+ // src/utils/reduction/index.ts
41
+ var import_core2 = require("@graphrefly/pure-ts/core");
42
+ var import_extra2 = require("@graphrefly/pure-ts/extra");
43
+ var import_graph2 = require("@graphrefly/pure-ts/graph");
44
+ var import_extra3 = require("@graphrefly/pure-ts/extra");
45
+
46
+ // src/base/meta/domain-meta.ts
47
+ function domainMeta(domain, kind, extra) {
48
+ return {
49
+ [domain]: true,
50
+ [`${domain}_type`]: kind,
51
+ ...extra ?? {}
52
+ };
53
+ }
54
+
55
+ // src/base/mutation/index.ts
56
+ var import_core = require("@graphrefly/pure-ts/core");
57
+ var import_extra = require("@graphrefly/pure-ts/extra");
58
+ var import_graph = require("@graphrefly/pure-ts/graph");
59
+ function tryIncrementBounded(counter, cap, by = 1) {
60
+ const cur = counter.cache ?? 0;
61
+ if (by > cap - cur) return false;
62
+ counter.down([[import_core.DIRTY], [import_core.DATA, cur + by]]);
63
+ return true;
64
+ }
65
+ var DEFAULT_AUDIT_GUARD = (0, import_core.policy)((allow, deny) => {
66
+ allow("observe");
67
+ allow("signal");
68
+ deny("write");
69
+ });
70
+
71
+ // src/utils/reduction/index.ts
72
+ function baseMeta(kind, meta) {
73
+ return domainMeta("reduction", kind, meta);
74
+ }
75
+ function feedback(graph, condition, reentry, opts) {
76
+ const maxIter = opts?.maxIterations ?? 10;
77
+ const counterName = `__feedback_${condition}`;
78
+ const counter = (0, import_core2.node)([], {
79
+ ...{
80
+ meta: baseMeta("feedback_counter", {
81
+ maxIterations: maxIter,
82
+ feedbackFrom: condition,
83
+ feedbackTo: reentry
84
+ })
85
+ },
86
+ initial: 0
87
+ });
88
+ graph.add(counter, { name: counterName });
89
+ const condNode = graph.resolve(condition);
90
+ const reentryNode = graph.resolve(reentry);
91
+ const feedbackEffectName = `__feedback_effect_${condition}`;
92
+ const feedbackEffect = (0, import_core2.node)(
93
+ [],
94
+ (_data, _feedbackActions) => {
95
+ const unsub = condNode.subscribe((msgs) => {
96
+ for (const msg of msgs) {
97
+ const t = msg[0];
98
+ if (t === import_core2.DATA) {
99
+ const condValue = msg[1];
100
+ if (condValue == null) return;
101
+ (0, import_core2.batch)(() => {
102
+ if (tryIncrementBounded(counter, maxIter)) {
103
+ reentryNode.emit(condValue);
104
+ }
105
+ });
106
+ } else if (t === import_core2.COMPLETE || t === import_core2.ERROR) {
107
+ const terminal = t === import_core2.ERROR && msg.length > 1 ? [import_core2.ERROR, msg[1]] : [t];
108
+ counter.down([terminal]);
109
+ }
110
+ }
111
+ });
112
+ return () => unsub();
113
+ },
114
+ {
115
+ name: feedbackEffectName,
116
+ describeKind: "effect",
117
+ meta: {
118
+ ...baseMeta("feedback_effect", {
119
+ feedbackFrom: condition,
120
+ feedbackTo: reentry
121
+ }),
122
+ _internal: true
123
+ }
124
+ }
125
+ );
126
+ graph.add(feedbackEffect, { name: feedbackEffectName });
127
+ graph.addDisposer((0, import_extra3.keepalive)(feedbackEffect));
128
+ return graph;
129
+ }
130
+
131
+ // src/utils/graphspec/index.ts
132
+ function readFactory(node4) {
133
+ const f = node4.meta?.factory;
134
+ return typeof f === "string" ? f : void 0;
135
+ }
136
+ function readFactoryArgs(node4) {
137
+ const a = node4.meta?.factoryArgs;
138
+ return a != null && typeof a === "object" ? a : {};
139
+ }
140
+ function readStateInitial(node4) {
141
+ const args = readFactoryArgs(node4);
142
+ if ("initial" in args) return args.initial;
143
+ return node4.value;
144
+ }
145
+ function isRichFnEntry(entry) {
146
+ return typeof entry === "object" && entry !== null && "factory" in entry;
147
+ }
148
+ function isRichSourceEntry(entry) {
149
+ return typeof entry === "object" && entry !== null && "factory" in entry;
150
+ }
151
+ function extractFnFactory(entry) {
152
+ return isRichFnEntry(entry) ? entry.factory : entry;
153
+ }
154
+ function extractSourceFactory(entry) {
155
+ return isRichSourceEntry(entry) ? entry.factory : entry;
156
+ }
157
+ function validateSpecAgainstCatalog(spec, catalog) {
158
+ const errors = [];
159
+ const fnNames = new Set(Object.keys(catalog.fns ?? {}));
160
+ const sourceNames = new Set(Object.keys(catalog.sources ?? {}));
161
+ for (const [nodeName, nodeRaw] of Object.entries(spec.nodes)) {
162
+ if (nodeRaw.type === "template") continue;
163
+ const node4 = nodeRaw;
164
+ const factoryName = readFactory(node4);
165
+ if (factoryName == null) continue;
166
+ const isProducer = node4.type === "producer";
167
+ if (node4.type === "state" && factoryName === "state") continue;
168
+ if (isProducer) {
169
+ const inSources = sourceNames.has(factoryName);
170
+ const inFns = fnNames.has(factoryName);
171
+ if (!inSources && !inFns && (sourceNames.size > 0 || fnNames.size > 0)) {
172
+ const suggestion = findClosest(factoryName, sourceNames) ?? findClosest(factoryName, fnNames);
173
+ errors.push(
174
+ `Node "${nodeName}": source "${factoryName}" not found in catalog` + (suggestion ? `. Did you mean "${suggestion}"?` : "")
175
+ );
176
+ }
177
+ } else {
178
+ if (fnNames.size > 0 && !fnNames.has(factoryName)) {
179
+ if (sourceNames.has(factoryName)) {
180
+ errors.push(
181
+ `Node "${nodeName}": fn "${factoryName}" is a source, not a function. Use it as a producer source instead, or use a function from: ${[...fnNames].join(", ")}`
182
+ );
183
+ } else {
184
+ const suggestion = findClosest(factoryName, fnNames);
185
+ errors.push(
186
+ `Node "${nodeName}": fn "${factoryName}" not found in catalog` + (suggestion ? `. Did you mean "${suggestion}"?` : "")
187
+ );
188
+ }
189
+ }
190
+ }
191
+ const factoryArgs = readFactoryArgs(node4);
192
+ if (!isProducer && catalog.fns?.[factoryName]) {
193
+ const entry = catalog.fns[factoryName];
194
+ if (isRichFnEntry(entry) && entry.configSchema) {
195
+ for (const [field, schema] of Object.entries(entry.configSchema)) {
196
+ if (schema.required !== false && !(field in factoryArgs)) {
197
+ errors.push(`Node "${nodeName}": config missing required field "${field}"`);
198
+ }
199
+ if (field in factoryArgs && schema.enum) {
200
+ const val = factoryArgs[field];
201
+ if (!schema.enum.includes(val)) {
202
+ errors.push(
203
+ `Node "${nodeName}": config.${field} = ${JSON.stringify(val)}, expected one of: ${schema.enum.join(", ")}`
204
+ );
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
210
+ if (isProducer && catalog.sources?.[factoryName]) {
211
+ const entry = catalog.sources[factoryName];
212
+ if (isRichSourceEntry(entry) && entry.configSchema) {
213
+ for (const [field, schema] of Object.entries(entry.configSchema)) {
214
+ if (schema.required !== false && !(field in factoryArgs)) {
215
+ errors.push(`Node "${nodeName}": config missing required field "${field}"`);
216
+ }
217
+ if (field in factoryArgs && schema.enum) {
218
+ const val = factoryArgs[field];
219
+ if (!schema.enum.includes(val)) {
220
+ errors.push(
221
+ `Node "${nodeName}": config.${field} = ${JSON.stringify(val)}, expected one of: ${schema.enum.join(", ")}`
222
+ );
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ if (spec.templates) {
230
+ for (const [tName, template] of Object.entries(spec.templates)) {
231
+ for (const [nodeName, node4] of Object.entries(template.nodes)) {
232
+ const factoryName = readFactory(node4);
233
+ if (factoryName == null) continue;
234
+ if (node4.type === "state" && factoryName === "state") continue;
235
+ if (node4.type === "producer") continue;
236
+ if (fnNames.size > 0 && !fnNames.has(factoryName)) {
237
+ const suggestion = findClosest(factoryName, fnNames);
238
+ errors.push(
239
+ `Template "${tName}" node "${nodeName}": fn "${factoryName}" not found in catalog` + (suggestion ? `. Did you mean "${suggestion}"?` : "")
240
+ );
241
+ }
242
+ }
243
+ }
244
+ }
245
+ return { valid: errors.length === 0, errors, warnings: [] };
246
+ }
247
+ function findClosest(input, candidates) {
248
+ let best = null;
249
+ let bestDist = Infinity;
250
+ const lower = input.toLowerCase();
251
+ for (const c of candidates) {
252
+ const dist = levenshtein(lower, c.toLowerCase());
253
+ if (dist < bestDist && dist <= Math.max(3, Math.floor(input.length / 2))) {
254
+ bestDist = dist;
255
+ best = c;
256
+ }
257
+ }
258
+ return best;
259
+ }
260
+ function levenshtein(a, b) {
261
+ const m = a.length;
262
+ const n = b.length;
263
+ const dp = Array.from(
264
+ { length: m + 1 },
265
+ (_, i) => Array.from({ length: n + 1 }, (_2, j) => i === 0 ? j : j === 0 ? i : 0)
266
+ );
267
+ for (let i = 1; i <= m; i++) {
268
+ for (let j = 1; j <= n; j++) {
269
+ dp[i][j] = a[i - 1] === b[j - 1] ? dp[i - 1][j - 1] : 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]);
270
+ }
271
+ }
272
+ return dp[m][n];
273
+ }
274
+ var VALID_NODE_TYPES = /* @__PURE__ */ new Set([
275
+ "state",
276
+ "producer",
277
+ "derived",
278
+ "effect",
279
+ "operator",
280
+ "template"
281
+ ]);
282
+ var INNER_NODE_TYPES = /* @__PURE__ */ new Set(["state", "producer", "derived", "effect", "operator"]);
283
+ function validateSpec(spec) {
284
+ const errors = [];
285
+ const warnings = [];
286
+ if (spec == null || typeof spec !== "object") {
287
+ return { valid: false, errors: ["GraphSpec must be a non-null object"], warnings };
288
+ }
289
+ const s = spec;
290
+ if (typeof s.name !== "string" || s.name.length === 0) {
291
+ errors.push("Missing or empty 'name' field");
292
+ }
293
+ if (s.nodes == null || typeof s.nodes !== "object" || Array.isArray(s.nodes)) {
294
+ errors.push("Missing or invalid 'nodes' field (must be an object)");
295
+ return { valid: false, errors, warnings };
296
+ }
297
+ const nodeNames = new Set(Object.keys(s.nodes));
298
+ const nodeTypes = /* @__PURE__ */ new Map();
299
+ const templateDefs = /* @__PURE__ */ new Map();
300
+ if (s.templates != null && typeof s.templates === "object" && !Array.isArray(s.templates)) {
301
+ for (const [tName, tRaw] of Object.entries(s.templates)) {
302
+ if (tRaw != null && typeof tRaw === "object") {
303
+ const t = tRaw;
304
+ templateDefs.set(tName, {
305
+ params: Array.isArray(t.params) ? t.params : []
306
+ });
307
+ }
308
+ }
309
+ }
310
+ if (s.templates != null) {
311
+ if (typeof s.templates !== "object" || Array.isArray(s.templates)) {
312
+ errors.push("'templates' must be an object");
313
+ } else {
314
+ for (const [tName, tRaw] of Object.entries(s.templates)) {
315
+ if (tRaw == null || typeof tRaw !== "object") {
316
+ errors.push(`Template "${tName}": must be an object`);
317
+ continue;
318
+ }
319
+ const t = tRaw;
320
+ if (!Array.isArray(t.params)) {
321
+ errors.push(`Template "${tName}": missing 'params' array`);
322
+ }
323
+ if (t.nodes == null || typeof t.nodes !== "object" || Array.isArray(t.nodes)) {
324
+ errors.push(`Template "${tName}": missing or invalid 'nodes' object`);
325
+ } else {
326
+ const paramSet = new Set(Array.isArray(t.params) ? t.params : []);
327
+ const innerNames = new Set(Object.keys(t.nodes));
328
+ for (const [nName, nRaw] of Object.entries(t.nodes)) {
329
+ if (nRaw == null || typeof nRaw !== "object") {
330
+ errors.push(`Template "${tName}" node "${nName}": must be an object`);
331
+ continue;
332
+ }
333
+ const n = nRaw;
334
+ if (typeof n.type !== "string" || !INNER_NODE_TYPES.has(n.type)) {
335
+ errors.push(`Template "${tName}" node "${nName}": invalid type`);
336
+ }
337
+ if (Array.isArray(n.deps)) {
338
+ for (const dep of n.deps) {
339
+ if (!innerNames.has(dep) && !paramSet.has(dep)) {
340
+ errors.push(
341
+ `Template "${tName}" node "${nName}": dep "${dep}" is not an inner node or param`
342
+ );
343
+ }
344
+ }
345
+ }
346
+ }
347
+ if (typeof t.output !== "string") {
348
+ errors.push(`Template "${tName}": missing 'output' string`);
349
+ } else if (!t.nodes[t.output]) {
350
+ errors.push(`Template "${tName}": output "${t.output}" is not a declared node`);
351
+ }
352
+ }
353
+ }
354
+ }
355
+ }
356
+ for (const [name, raw] of Object.entries(s.nodes)) {
357
+ if (raw == null || typeof raw !== "object") {
358
+ errors.push(`Node "${name}": must be an object`);
359
+ continue;
360
+ }
361
+ const n = raw;
362
+ if (typeof n.type !== "string" || !VALID_NODE_TYPES.has(n.type)) {
363
+ errors.push(
364
+ `Node "${name}": invalid type "${String(n.type)}" (expected: ${[...VALID_NODE_TYPES].join(", ")})`
365
+ );
366
+ continue;
367
+ }
368
+ nodeTypes.set(name, n.type);
369
+ if (n.type === "template") {
370
+ if (typeof n.template !== "string" || !templateDefs.has(n.template)) {
371
+ errors.push(`Node "${name}": template "${String(n.template)}" not found in templates`);
372
+ } else {
373
+ if (n.bind == null || typeof n.bind !== "object" || Array.isArray(n.bind)) {
374
+ errors.push(`Node "${name}": template ref requires 'bind' object`);
375
+ } else {
376
+ const tmpl = templateDefs.get(n.template);
377
+ const bind = n.bind;
378
+ for (const param of tmpl.params) {
379
+ if (!(param in bind)) {
380
+ errors.push(
381
+ `Node "${name}": template param "${param}" is not bound (template "${n.template}")`
382
+ );
383
+ }
384
+ }
385
+ for (const [, target] of Object.entries(bind)) {
386
+ if (typeof target === "string" && !nodeNames.has(target)) {
387
+ errors.push(
388
+ `Node "${name}": bind target "${target}" does not reference an existing node`
389
+ );
390
+ }
391
+ }
392
+ }
393
+ }
394
+ } else {
395
+ if (Array.isArray(n.deps)) {
396
+ for (const dep of n.deps) {
397
+ if (dep === name) {
398
+ errors.push(`Node "${name}": self-referencing dep`);
399
+ } else if (!nodeNames.has(dep)) {
400
+ errors.push(`Node "${name}": dep "${dep}" does not reference an existing node`);
401
+ }
402
+ }
403
+ }
404
+ if ((n.type === "derived" || n.type === "effect" || n.type === "operator") && !Array.isArray(n.deps)) {
405
+ errors.push(`Node "${name}": ${n.type} node should have a 'deps' array`);
406
+ }
407
+ }
408
+ }
409
+ if (s.feedback != null) {
410
+ if (!Array.isArray(s.feedback)) {
411
+ errors.push("'feedback' must be an array");
412
+ } else {
413
+ for (let i = 0; i < s.feedback.length; i++) {
414
+ const edge = s.feedback[i];
415
+ if (edge == null || typeof edge !== "object") {
416
+ errors.push(`Feedback [${i}]: must be an object`);
417
+ continue;
418
+ }
419
+ const e = edge;
420
+ if (typeof e.from !== "string" || !nodeNames.has(e.from)) {
421
+ errors.push(
422
+ `Feedback [${i}]: 'from' "${String(e.from)}" does not reference an existing node`
423
+ );
424
+ } else if (nodeTypes.get(e.from) === "effect") {
425
+ warnings.push(
426
+ `Feedback [${i}]: 'from' "${e.from}" is an effect node \u2014 effects emit no DATA, so the feedback edge will never fire. Did you mean a derived/state node upstream?`
427
+ );
428
+ }
429
+ if (typeof e.from === "string" && e.from === e.to) {
430
+ errors.push(`Feedback [${i}]: 'from' and 'to' must be different nodes`);
431
+ }
432
+ if (typeof e.to !== "string" || !nodeNames.has(e.to)) {
433
+ errors.push(
434
+ `Feedback [${i}]: 'to' "${String(e.to)}" does not reference an existing node`
435
+ );
436
+ } else if (typeof e.to === "string" && nodeTypes.get(e.to) !== "state") {
437
+ errors.push(
438
+ `Feedback [${i}]: 'to' node "${e.to}" must be a state node (got "${nodeTypes.get(e.to) ?? "unknown"}")`
439
+ );
440
+ }
441
+ }
442
+ }
443
+ }
444
+ return {
445
+ valid: errors.length === 0,
446
+ errors,
447
+ warnings
448
+ };
449
+ }
450
+ function compileSpec(spec, opts) {
451
+ const validation = validateSpec(spec);
452
+ if (!validation.valid) {
453
+ throw new Error(`compileSpec: invalid GraphSpec:
454
+ ${validation.errors.join("\n")}`);
455
+ }
456
+ const specFactory = spec.factory;
457
+ const specFactoryArgs = spec.factoryArgs;
458
+ if (typeof specFactory === "string") {
459
+ const graphFactory = opts?.catalog?.graphFactories?.[specFactory];
460
+ if (graphFactory) return graphFactory(specFactoryArgs);
461
+ }
462
+ const catalog = opts?.catalog ?? {};
463
+ const onMissing = opts?.onMissing ?? "placeholder";
464
+ const g = new import_graph3.Graph(spec.name);
465
+ const templates = spec.templates ?? {};
466
+ const catalogValidation = validateSpecAgainstCatalog(spec, catalog);
467
+ if (!catalogValidation.valid) {
468
+ throw new Error(
469
+ `compileSpec: catalog validation errors:
470
+ ${catalogValidation.errors.join("\n")}`
471
+ );
472
+ }
473
+ const missingEntries = [];
474
+ const recordMissing = (nodePath, kind, name) => {
475
+ missingEntries.push({ path: nodePath, kind, name });
476
+ };
477
+ const resolveFn = (fnName) => {
478
+ const entry = catalog.fns?.[fnName];
479
+ return entry ? extractFnFactory(entry) : void 0;
480
+ };
481
+ const resolveSource = (sourceName) => {
482
+ const entry = catalog.sources?.[sourceName];
483
+ return entry ? extractSourceFactory(entry) : void 0;
484
+ };
485
+ const stripFactoryMeta = (meta) => {
486
+ if (!meta) return void 0;
487
+ const out = {};
488
+ for (const [k, v] of Object.entries(meta)) {
489
+ if (k === "factory" || k === "factoryArgs") continue;
490
+ out[k] = v;
491
+ }
492
+ return Object.keys(out).length > 0 ? out : void 0;
493
+ };
494
+ const created = /* @__PURE__ */ new Map();
495
+ const deferred = [];
496
+ for (const [name, raw] of Object.entries(spec.nodes)) {
497
+ if (raw.type === "template") continue;
498
+ const n = raw;
499
+ const factoryName = readFactory(n);
500
+ const factoryArgs = readFactoryArgs(n);
501
+ if (n.type === "state") {
502
+ const initial = readStateInitial(n);
503
+ const nd = (0, import_core3.node)([], {
504
+ name,
505
+ initial,
506
+ meta: stripFactoryMeta(n.meta)
507
+ });
508
+ g.add(nd, { name });
509
+ created.set(name, nd);
510
+ } else if (n.type === "producer") {
511
+ const sourceFactory = factoryName ? resolveSource(factoryName) : void 0;
512
+ const fnFactory = factoryName ? resolveFn(factoryName) : void 0;
513
+ if (sourceFactory) {
514
+ const nd = sourceFactory(factoryArgs);
515
+ g.add(nd, { name });
516
+ created.set(name, nd);
517
+ } else if (fnFactory) {
518
+ const nd = fnFactory([], factoryArgs);
519
+ g.add(nd, { name });
520
+ created.set(name, nd);
521
+ } else {
522
+ if (factoryName) recordMissing(name, "source", factoryName);
523
+ const nd = (0, import_core3.node)([], () => {
524
+ }, {
525
+ name,
526
+ describeKind: "producer",
527
+ meta: { ...stripFactoryMeta(n.meta), _specSource: factoryName }
528
+ });
529
+ g.add(nd, { name });
530
+ created.set(name, nd);
531
+ }
532
+ } else {
533
+ deferred.push([name, n]);
534
+ }
535
+ }
536
+ let progressed = true;
537
+ const pending = new Map(deferred);
538
+ while (pending.size > 0 && progressed) {
539
+ progressed = false;
540
+ for (const [name, n] of [...pending.entries()]) {
541
+ const deps = n.deps ?? [];
542
+ if (!deps.every((dep) => created.has(dep))) continue;
543
+ const resolvedDeps = deps.map((dep) => created.get(dep));
544
+ const factoryName = readFactory(n);
545
+ const factoryArgs = readFactoryArgs(n);
546
+ const fnFactory = factoryName ? resolveFn(factoryName) : void 0;
547
+ let nd;
548
+ if (fnFactory) {
549
+ nd = fnFactory(resolvedDeps, factoryArgs);
550
+ } else if (n.type === "effect") {
551
+ if (factoryName) recordMissing(name, "fn", factoryName);
552
+ nd = (0, import_core3.node)(resolvedDeps, () => {
553
+ }, { describeKind: "effect" });
554
+ } else {
555
+ if (factoryName) recordMissing(name, "fn", factoryName);
556
+ nd = (0, import_core3.node)(
557
+ resolvedDeps,
558
+ (batchData, actions, ctx) => {
559
+ const data = batchData.map(
560
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
561
+ );
562
+ actions.emit(data[0]);
563
+ },
564
+ { describeKind: "derived" }
565
+ );
566
+ }
567
+ g.add(nd, { name });
568
+ created.set(name, nd);
569
+ pending.delete(name);
570
+ progressed = true;
571
+ }
572
+ }
573
+ if (pending.size > 0) {
574
+ const unresolved = [...pending.keys()].sort().join(", ");
575
+ throw new Error(`compileSpec: unresolvable deps for nodes: ${unresolved}`);
576
+ }
577
+ for (const [name, raw] of Object.entries(spec.nodes)) {
578
+ if (raw.type !== "template") continue;
579
+ const ref = raw;
580
+ const tmpl = templates[ref.template];
581
+ const sub = new import_graph3.Graph(name);
582
+ const subCreated = /* @__PURE__ */ new Map();
583
+ const subDeferred = [];
584
+ for (const [nName, nSpec] of Object.entries(tmpl.nodes)) {
585
+ const resolvedDeps = (nSpec.deps ?? []).map((dep) => {
586
+ if (dep.startsWith("$") && ref.bind[dep]) {
587
+ return ref.bind[dep];
588
+ }
589
+ return dep;
590
+ });
591
+ const specWithResolvedDeps = { ...nSpec, deps: resolvedDeps };
592
+ const factoryName = readFactory(nSpec);
593
+ const factoryArgs = readFactoryArgs(nSpec);
594
+ if (nSpec.type === "state") {
595
+ const initial = readStateInitial(nSpec);
596
+ const nd = (0, import_core3.node)([], {
597
+ name: nName,
598
+ initial,
599
+ meta: stripFactoryMeta(nSpec.meta)
600
+ });
601
+ sub.add(nd, { name: nName });
602
+ subCreated.set(nName, nd);
603
+ } else if (nSpec.type === "producer") {
604
+ const sourceFactory = factoryName ? resolveSource(factoryName) : void 0;
605
+ const fnFactory = factoryName ? resolveFn(factoryName) : void 0;
606
+ if (sourceFactory) {
607
+ const nd = sourceFactory(factoryArgs);
608
+ sub.add(nd, { name: nName });
609
+ subCreated.set(nName, nd);
610
+ } else if (fnFactory) {
611
+ const nd = fnFactory([], factoryArgs);
612
+ sub.add(nd, { name: nName });
613
+ subCreated.set(nName, nd);
614
+ } else {
615
+ if (factoryName) recordMissing(`${name}.${nName}`, "source", factoryName);
616
+ const nd = (0, import_core3.node)([], () => {
617
+ }, {
618
+ name: nName,
619
+ describeKind: "producer",
620
+ meta: { ...stripFactoryMeta(nSpec.meta), _specSource: factoryName }
621
+ });
622
+ sub.add(nd, { name: nName });
623
+ subCreated.set(nName, nd);
624
+ }
625
+ } else {
626
+ subDeferred.push([nName, specWithResolvedDeps]);
627
+ }
628
+ }
629
+ let subProgressed = true;
630
+ const subPending = new Map(subDeferred);
631
+ while (subPending.size > 0 && subProgressed) {
632
+ subProgressed = false;
633
+ for (const [nName, nSpec] of [...subPending.entries()]) {
634
+ const deps = nSpec.deps ?? [];
635
+ const allReady = deps.every((dep) => subCreated.has(dep) || created.has(dep));
636
+ if (!allReady) continue;
637
+ const resolvedDeps = deps.map((dep) => subCreated.get(dep) ?? created.get(dep));
638
+ const factoryName = readFactory(nSpec);
639
+ const factoryArgs = readFactoryArgs(nSpec);
640
+ const fnFactory = factoryName ? resolveFn(factoryName) : void 0;
641
+ let nd;
642
+ if (fnFactory) {
643
+ nd = fnFactory(resolvedDeps, factoryArgs);
644
+ } else if (nSpec.type === "effect") {
645
+ if (factoryName) recordMissing(`${name}.${nName}`, "fn", factoryName);
646
+ nd = (0, import_core3.node)(resolvedDeps, () => {
647
+ }, { describeKind: "effect" });
648
+ } else {
649
+ if (factoryName) recordMissing(`${name}.${nName}`, "fn", factoryName);
650
+ nd = (0, import_core3.node)(
651
+ resolvedDeps,
652
+ (batchData, actions, ctx) => {
653
+ const data = batchData.map(
654
+ (batch3, i) => batch3 != null && batch3.length > 0 ? batch3.at(-1) : ctx.prevData[i]
655
+ );
656
+ actions.emit(data[0]);
657
+ },
658
+ { describeKind: "derived" }
659
+ );
660
+ }
661
+ sub.add(nd, { name: nName });
662
+ subCreated.set(nName, nd);
663
+ subPending.delete(nName);
664
+ subProgressed = true;
665
+ }
666
+ }
667
+ if (subPending.size > 0) {
668
+ const unresolved = [...subPending.keys()].sort().join(", ");
669
+ throw new Error(
670
+ `compileSpec: template "${ref.template}" has unresolvable deps: ${unresolved}`
671
+ );
672
+ }
673
+ g.mount(name, sub);
674
+ const outputPath = `${name}::${tmpl.output}`;
675
+ created.set(name, g.resolve(outputPath));
676
+ try {
677
+ const outputNode = g.resolve(outputPath);
678
+ outputNode.meta._templateName?.emit(ref.template);
679
+ outputNode.meta._templateBind?.emit(ref.bind);
680
+ } catch {
681
+ }
682
+ }
683
+ for (const fb of spec.feedback ?? []) {
684
+ feedback(g, fb.from, fb.to, {
685
+ maxIterations: fb.maxIterations
686
+ });
687
+ }
688
+ if (missingEntries.length > 0) {
689
+ if (onMissing === "error") {
690
+ const lines = missingEntries.map((e) => ` - ${e.path}: missing ${e.kind} "${e.name}"`);
691
+ throw new Error(
692
+ `compileSpec: ${missingEntries.length} catalog entr${missingEntries.length === 1 ? "y" : "ies"} missing \u2014 pass them via opts.catalog or set opts.onMissing to "warn"/"placeholder":
693
+ ${lines.join("\n")}`
694
+ );
695
+ }
696
+ if (onMissing === "warn") {
697
+ const warn = opts?.onWarn ?? ((m) => console.warn(m));
698
+ for (const e of missingEntries) {
699
+ warn(
700
+ `compileSpec: ${e.path} references missing ${e.kind} "${e.name}" \u2014 substituted placeholder`
701
+ );
702
+ }
703
+ }
704
+ }
705
+ return g;
706
+ }
707
+
708
+ // src/utils/surface/errors.ts
709
+ var SurfaceError = class extends Error {
710
+ code;
711
+ details;
712
+ constructor(code, message, details) {
713
+ super(message);
714
+ this.name = "SurfaceError";
715
+ this.code = code;
716
+ if (details !== void 0) this.details = details;
717
+ }
718
+ /**
719
+ * JSON-safe payload for wire serialization. Defensively validates
720
+ * `details` — if it can't be round-tripped through `JSON.stringify`
721
+ * (cyclic refs, `BigInt`, `Error` instance not pre-toJSON'd), the
722
+ * payload falls back to `{code, message}` only rather than crashing
723
+ * the MCP/CLI wrapper when it serializes this error onto the wire.
724
+ */
725
+ toJSON() {
726
+ const out = { code: this.code, message: this.message };
727
+ if (this.details !== void 0) {
728
+ const safe = safeDetails(this.details);
729
+ if (safe !== void 0) out.details = safe;
730
+ }
731
+ return out;
732
+ }
733
+ };
734
+ function safeDetails(details) {
735
+ try {
736
+ return JSON.parse(JSON.stringify(details));
737
+ } catch {
738
+ return void 0;
739
+ }
740
+ }
741
+ function asSurfaceError(err, fallbackCode = "internal-error") {
742
+ if (err instanceof SurfaceError) return err;
743
+ const message = err instanceof Error ? err.message : String(err);
744
+ return new SurfaceError(fallbackCode, message);
745
+ }
746
+
747
+ // src/utils/surface/create.ts
748
+ function createGraph(spec, opts) {
749
+ const structural = validateSpec(spec);
750
+ if (!structural.valid) {
751
+ throw new SurfaceError(
752
+ "invalid-spec",
753
+ `GraphSpec validation failed:
754
+ ${structural.errors.join("\n")}`,
755
+ { errors: structural.errors }
756
+ );
757
+ }
758
+ const catalog = opts?.catalog ?? {};
759
+ const catalogValidation = validateSpecAgainstCatalog(spec, catalog);
760
+ if (!catalogValidation.valid) {
761
+ throw new SurfaceError(
762
+ "catalog-error",
763
+ `Catalog validation failed:
764
+ ${catalogValidation.errors.join("\n")}`,
765
+ { errors: catalogValidation.errors }
766
+ );
767
+ }
768
+ try {
769
+ return compileSpec(spec, opts);
770
+ } catch (err) {
771
+ const message = err instanceof Error ? err.message : String(err);
772
+ throw new SurfaceError("catalog-error", message);
773
+ }
774
+ }
775
+
776
+ // src/utils/surface/reduce.ts
777
+ var import_core4 = require("@graphrefly/pure-ts/core");
778
+ var DEFAULT_TIMEOUT_MS = 3e4;
779
+ async function runReduction(spec, input, opts) {
780
+ const inputPath = opts?.inputPath ?? "input";
781
+ const outputPath = opts?.outputPath ?? "output";
782
+ const timeoutMs = opts?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
783
+ const graph = createGraph(spec, { catalog: opts?.catalog });
784
+ let outputNode;
785
+ try {
786
+ outputNode = graph.resolve(outputPath);
787
+ } catch {
788
+ graph.destroy();
789
+ throw new SurfaceError(
790
+ "node-not-found",
791
+ `reduce: output path "${outputPath}" is not registered`,
792
+ { path: outputPath }
793
+ );
794
+ }
795
+ try {
796
+ graph.resolve(inputPath);
797
+ } catch {
798
+ graph.destroy();
799
+ throw new SurfaceError(
800
+ "node-not-found",
801
+ `reduce: input path "${inputPath}" is not registered`,
802
+ { path: inputPath }
803
+ );
804
+ }
805
+ try {
806
+ return await new Promise((resolve, reject) => {
807
+ let primed = false;
808
+ let settled = false;
809
+ let timer;
810
+ let unsub;
811
+ let shouldUnsub = false;
812
+ const finish = (action) => {
813
+ if (settled) return;
814
+ settled = true;
815
+ if (timer !== void 0) clearTimeout(timer);
816
+ if (unsub !== void 0) {
817
+ unsub();
818
+ unsub = void 0;
819
+ } else {
820
+ shouldUnsub = true;
821
+ }
822
+ action();
823
+ };
824
+ unsub = outputNode.subscribe((msgs) => {
825
+ for (const m of msgs) {
826
+ if (settled) return;
827
+ if (!primed) continue;
828
+ if (m[0] === import_core4.DATA) {
829
+ finish(() => resolve(m[1]));
830
+ return;
831
+ }
832
+ if (m[0] === import_core4.RESOLVED) {
833
+ const cached = outputNode.cache;
834
+ finish(() => resolve(cached));
835
+ return;
836
+ }
837
+ if (m[0] === import_core4.ERROR) {
838
+ const payload = m[1];
839
+ const message = payload instanceof Error ? payload.message : String(payload);
840
+ const cause = payload instanceof Error ? payload : void 0;
841
+ finish(
842
+ () => reject(
843
+ new SurfaceError(
844
+ "internal-error",
845
+ `reduce: output emitted ERROR: ${message}`,
846
+ cause != null ? { cause } : void 0
847
+ )
848
+ )
849
+ );
850
+ return;
851
+ }
852
+ if (m[0] === import_core4.COMPLETE) {
853
+ finish(
854
+ () => reject(
855
+ new SurfaceError(
856
+ "internal-error",
857
+ `reduce: output COMPLETEd without a post-push DATA`
858
+ )
859
+ )
860
+ );
861
+ return;
862
+ }
863
+ }
864
+ });
865
+ if (shouldUnsub) {
866
+ unsub?.();
867
+ unsub = void 0;
868
+ }
869
+ primed = true;
870
+ try {
871
+ graph.set(inputPath, input);
872
+ } catch (err) {
873
+ const message = err instanceof Error ? err.message : String(err);
874
+ const cause = err instanceof Error ? err : void 0;
875
+ finish(
876
+ () => reject(
877
+ new SurfaceError(
878
+ "internal-error",
879
+ `reduce: failed to set input on "${inputPath}": ${message}`,
880
+ cause != null ? { path: inputPath, cause } : { path: inputPath }
881
+ )
882
+ )
883
+ );
884
+ return;
885
+ }
886
+ if (!settled && Number.isFinite(timeoutMs) && timeoutMs > 0) {
887
+ timer = setTimeout(() => {
888
+ finish(
889
+ () => reject(
890
+ new SurfaceError(
891
+ "reduce-timeout",
892
+ `reduce: no output emitted within ${timeoutMs}ms`,
893
+ { timeoutMs, outputPath }
894
+ )
895
+ )
896
+ );
897
+ }, timeoutMs);
898
+ timer.unref?.();
899
+ }
900
+ });
901
+ } finally {
902
+ graph.destroy();
903
+ }
904
+ }
905
+
906
+ // src/utils/surface/snapshot.ts
907
+ var import_core5 = require("@graphrefly/pure-ts/core");
908
+ var import_graph4 = require("@graphrefly/pure-ts/graph");
909
+ var SNAPSHOT_WIRE_VERSION = import_graph4.SNAPSHOT_VERSION;
910
+ var SNAPSHOT_KEY_PREFIX = "snapshot:";
911
+ function assertExternalId(snapshotId) {
912
+ if (snapshotId.startsWith(SNAPSHOT_KEY_PREFIX)) {
913
+ throw new SurfaceError(
914
+ "snapshot-failed",
915
+ `snapshot id must not start with "${SNAPSHOT_KEY_PREFIX}" (reserved); got "${snapshotId}"`,
916
+ { snapshotId }
917
+ );
918
+ }
919
+ }
920
+ function encodeKey(snapshotId) {
921
+ return `${SNAPSHOT_KEY_PREFIX}${snapshotId}`;
922
+ }
923
+ function decodeKey(key) {
924
+ return key.startsWith(SNAPSHOT_KEY_PREFIX) ? key.slice(SNAPSHOT_KEY_PREFIX.length) : void 0;
925
+ }
926
+ function unwrapCheckpoint(raw, snapshotId) {
927
+ if (raw == null || typeof raw !== "object") {
928
+ throw new SurfaceError("snapshot-not-found", `snapshot "${snapshotId}" not found in tier`, {
929
+ snapshotId
930
+ });
931
+ }
932
+ const record = raw;
933
+ if ("mode" in record) {
934
+ if (record.mode === "full" && "snapshot" in record) {
935
+ return record.snapshot;
936
+ }
937
+ if (record.mode === "diff") {
938
+ throw new SurfaceError(
939
+ "restore-failed",
940
+ `snapshot "${snapshotId}" is a diff record (legacy/non-paired tier write); under the Phase 14.6 paired-tier shape snapshot tiers hold only baselines. For WAL replay use Graph.restoreSnapshot({ mode: "diff", source: { tier, walTier } }).`,
941
+ { snapshotId, mode: "diff" }
942
+ );
943
+ }
944
+ throw new SurfaceError(
945
+ "restore-failed",
946
+ `snapshot "${snapshotId}" has unknown mode "${String(record.mode)}"`,
947
+ { snapshotId, mode: String(record.mode) }
948
+ );
949
+ }
950
+ if ("nodes" in record && "edges" in record && "subgraphs" in record && "name" in record) {
951
+ return record;
952
+ }
953
+ throw new SurfaceError(
954
+ "restore-failed",
955
+ `snapshot "${snapshotId}" payload is not a GraphCheckpointRecord or GraphPersistSnapshot`,
956
+ { snapshotId }
957
+ );
958
+ }
959
+ async function saveSnapshot(graph, snapshotId, tier) {
960
+ assertExternalId(snapshotId);
961
+ let snapshot;
962
+ try {
963
+ snapshot = graph.snapshot();
964
+ } catch (err) {
965
+ const message = err instanceof Error ? err.message : String(err);
966
+ throw new SurfaceError(
967
+ "snapshot-failed",
968
+ `snapshot "${snapshotId}" serialization failed: ${message}`,
969
+ { snapshotId }
970
+ );
971
+ }
972
+ const record = {
973
+ name: graph.name,
974
+ mode: "full",
975
+ seq: 0,
976
+ timestamp_ns: (0, import_core5.wallClockNs)(),
977
+ format_version: SNAPSHOT_WIRE_VERSION,
978
+ snapshot
979
+ };
980
+ try {
981
+ await tier.save(encodeKey(snapshotId), record);
982
+ } catch (err) {
983
+ const message = err instanceof Error ? err.message : String(err);
984
+ throw new SurfaceError("snapshot-failed", `snapshot "${snapshotId}" save failed: ${message}`, {
985
+ snapshotId
986
+ });
987
+ }
988
+ return { snapshotId, timestamp_ns: record.timestamp_ns };
989
+ }
990
+ async function restoreSnapshot(snapshotId, tier, opts) {
991
+ assertExternalId(snapshotId);
992
+ const key = encodeKey(snapshotId);
993
+ let raw = await tier.load(key);
994
+ if (raw === void 0) {
995
+ raw = await tier.load(snapshotId);
996
+ }
997
+ const snapshot = unwrapCheckpoint(raw, snapshotId);
998
+ try {
999
+ return import_graph4.Graph.fromSnapshot(
1000
+ snapshot,
1001
+ opts?.factories ? { factories: opts.factories } : void 0
1002
+ );
1003
+ } catch (err) {
1004
+ const message = err instanceof Error ? err.message : String(err);
1005
+ throw new SurfaceError(
1006
+ "restore-failed",
1007
+ `snapshot "${snapshotId}" restore failed: ${message}`,
1008
+ {
1009
+ snapshotId
1010
+ }
1011
+ );
1012
+ }
1013
+ }
1014
+ async function diffSnapshots(snapshotIdA, snapshotIdB, tier) {
1015
+ assertExternalId(snapshotIdA);
1016
+ assertExternalId(snapshotIdB);
1017
+ const loadWithFallback = async (id) => {
1018
+ const key = encodeKey(id);
1019
+ let raw = await tier.load(key);
1020
+ if (raw === void 0) raw = await tier.load(id);
1021
+ return raw;
1022
+ };
1023
+ const [rawA, rawB] = await Promise.all([
1024
+ loadWithFallback(snapshotIdA),
1025
+ loadWithFallback(snapshotIdB)
1026
+ ]);
1027
+ const snapshotA = unwrapCheckpoint(rawA, snapshotIdA);
1028
+ const snapshotB = unwrapCheckpoint(rawB, snapshotIdB);
1029
+ return import_graph4.Graph.diff(snapshotA, snapshotB);
1030
+ }
1031
+ async function listSnapshots(tier, opts) {
1032
+ if (typeof tier.list !== "function") {
1033
+ throw new SurfaceError(
1034
+ "tier-no-list",
1035
+ "KvStorageTier does not implement list(); wrap the tier with an enumerator or use a different backend"
1036
+ );
1037
+ }
1038
+ const keys = await tier.list();
1039
+ const result = [];
1040
+ const includeUnprefixed = opts?.includeUnprefixed === true;
1041
+ for (const k of keys) {
1042
+ const decoded = decodeKey(k);
1043
+ if (decoded !== void 0) result.push(decoded);
1044
+ else if (includeUnprefixed) result.push(k);
1045
+ }
1046
+ return result;
1047
+ }
1048
+ async function deleteSnapshot(snapshotId, tier) {
1049
+ assertExternalId(snapshotId);
1050
+ if (typeof tier.delete !== "function") {
1051
+ throw new SurfaceError(
1052
+ "snapshot-failed",
1053
+ `KvStorageTier is append-only (no delete()); cannot delete "${snapshotId}"`,
1054
+ { snapshotId }
1055
+ );
1056
+ }
1057
+ try {
1058
+ await tier.delete(encodeKey(snapshotId));
1059
+ } catch (err) {
1060
+ const message = err instanceof Error ? err.message : String(err);
1061
+ throw new SurfaceError(
1062
+ "snapshot-failed",
1063
+ `snapshot "${snapshotId}" delete failed: ${message}`,
1064
+ {
1065
+ snapshotId
1066
+ }
1067
+ );
1068
+ }
1069
+ }
1070
+ //# sourceMappingURL=index.cjs.map