@graphrefly/ts 0.0.0 → 0.0.2

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 (405) hide show
  1. package/README.md +135 -0
  2. package/dist/actions-types-CSC3NMDl.d.ts +657 -0
  3. package/dist/actions-types-wl9Mgkmr.d.cts +657 -0
  4. package/dist/adapters/index.cjs +5219 -2974
  5. package/dist/adapters/index.cjs.map +1 -1
  6. package/dist/adapters/index.d.cts +204 -192
  7. package/dist/adapters/index.d.ts +204 -192
  8. package/dist/adapters/index.js +3685 -1833
  9. package/dist/adapters/index.js.map +1 -1
  10. package/dist/adapters/nestjs/microservices.cjs +841 -0
  11. package/dist/adapters/nestjs/microservices.cjs.map +1 -0
  12. package/dist/adapters/nestjs/microservices.d.cts +45 -0
  13. package/dist/adapters/nestjs/microservices.d.ts +45 -0
  14. package/dist/adapters/nestjs/microservices.js +206 -0
  15. package/dist/adapters/nestjs/microservices.js.map +1 -0
  16. package/dist/adapters/nestjs/native.cjs +1391 -0
  17. package/dist/adapters/nestjs/native.cjs.map +1 -0
  18. package/dist/adapters/nestjs/native.d.cts +111 -0
  19. package/dist/adapters/nestjs/native.d.ts +111 -0
  20. package/dist/adapters/nestjs/native.js +577 -0
  21. package/dist/adapters/nestjs/native.js.map +1 -0
  22. package/dist/adapters/nestjs/websockets.cjs +924 -0
  23. package/dist/adapters/nestjs/websockets.cjs.map +1 -0
  24. package/dist/adapters/nestjs/websockets.d.cts +47 -0
  25. package/dist/adapters/nestjs/websockets.d.ts +47 -0
  26. package/dist/adapters/nestjs/websockets.js +286 -0
  27. package/dist/adapters/nestjs/websockets.js.map +1 -0
  28. package/dist/adapters/nestjs.cjs +1085 -0
  29. package/dist/adapters/nestjs.cjs.map +1 -0
  30. package/dist/adapters/nestjs.d.cts +385 -0
  31. package/dist/adapters/nestjs.d.ts +385 -0
  32. package/dist/adapters/nestjs.js +112 -0
  33. package/dist/adapters/nestjs.js.map +1 -0
  34. package/dist/adapters/observe-storage.d.cts +4 -4
  35. package/dist/adapters/observe-storage.d.ts +4 -4
  36. package/dist/adapters/observe-storage.js +5 -4
  37. package/dist/adapters/observe-storage.js.map +1 -1
  38. package/dist/adapters/react.cjs +166 -0
  39. package/dist/adapters/react.cjs.map +1 -0
  40. package/dist/adapters/react.d.cts +31 -0
  41. package/dist/adapters/react.d.ts +31 -0
  42. package/dist/adapters/react.js +51 -0
  43. package/dist/adapters/react.js.map +1 -0
  44. package/dist/adapters/solid.cjs +157 -0
  45. package/dist/adapters/solid.cjs.map +1 -0
  46. package/dist/adapters/solid.d.cts +26 -0
  47. package/dist/adapters/solid.d.ts +26 -0
  48. package/dist/adapters/solid.js +48 -0
  49. package/dist/adapters/solid.js.map +1 -0
  50. package/dist/adapters/svelte.cjs +148 -0
  51. package/dist/adapters/svelte.cjs.map +1 -0
  52. package/dist/adapters/svelte.d.cts +31 -0
  53. package/dist/adapters/svelte.d.ts +31 -0
  54. package/dist/adapters/svelte.js +46 -0
  55. package/dist/adapters/svelte.js.map +1 -0
  56. package/dist/adapters/vue.cjs +155 -0
  57. package/dist/adapters/vue.cjs.map +1 -0
  58. package/dist/adapters/vue.d.cts +26 -0
  59. package/dist/adapters/vue.d.ts +26 -0
  60. package/dist/adapters/vue.js +46 -0
  61. package/dist/adapters/vue.js.map +1 -0
  62. package/dist/agent-runtime-types-core-CaXfKNtY.d.cts +406 -0
  63. package/dist/agent-runtime-types-core-hU299uIC.d.ts +406 -0
  64. package/dist/agent-runtime-types-tool-BEpSINol.d.ts +695 -0
  65. package/dist/agent-runtime-types-tool-DninPEzk.d.cts +695 -0
  66. package/dist/agentic-memory-retention-BmGX368S.d.ts +14 -0
  67. package/dist/agentic-memory-retention-Ih1qhX9Z.d.cts +14 -0
  68. package/dist/agentic-memory-types-CVSUS6XR.d.ts +473 -0
  69. package/dist/agentic-memory-types-FnnYlVUs.d.cts +473 -0
  70. package/dist/capability-admission-BW2CziT6.d.ts +102 -0
  71. package/dist/capability-admission-lwSecxXs.d.cts +102 -0
  72. package/dist/chunk-2KUAG2GZ.js +9693 -0
  73. package/dist/chunk-2KUAG2GZ.js.map +1 -0
  74. package/dist/chunk-2NJP6GO4.js +1320 -0
  75. package/dist/chunk-2NJP6GO4.js.map +1 -0
  76. package/dist/{chunk-GDL26N2T.js → chunk-3KN7NJDR.js} +2 -2
  77. package/dist/{chunk-COHO25CZ.js → chunk-4NWSNI4K.js} +2232 -1672
  78. package/dist/chunk-4NWSNI4K.js.map +1 -0
  79. package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
  80. package/dist/chunk-6E76H4OU.js +132 -0
  81. package/dist/chunk-6E76H4OU.js.map +1 -0
  82. package/dist/chunk-7GOTIIQ7.js +819 -0
  83. package/dist/chunk-7GOTIIQ7.js.map +1 -0
  84. package/dist/{chunk-D6BG7U6A.js → chunk-7HZRJMN6.js} +3 -3
  85. package/dist/{chunk-SCRFRCGR.js → chunk-BSQGE5PS.js} +1 -1
  86. package/dist/{chunk-PKVBHGBM.js → chunk-CJIFGJQG.js} +7 -7
  87. package/dist/{chunk-G4M3NHRJ.js → chunk-CX6B6PO2.js} +93 -10
  88. package/dist/chunk-CX6B6PO2.js.map +1 -0
  89. package/dist/chunk-DGUM43GV.js +11 -0
  90. package/dist/chunk-DGUM43GV.js.map +1 -0
  91. package/dist/{chunk-JIMUDQN3.js → chunk-E4QCH32M.js} +449 -447
  92. package/dist/chunk-E4QCH32M.js.map +1 -0
  93. package/dist/{chunk-RIIOUTGM.js → chunk-ECURQ3HD.js} +19 -129
  94. package/dist/chunk-ECURQ3HD.js.map +1 -0
  95. package/dist/{chunk-2ILL7HQI.js → chunk-EOKT4QFF.js} +134 -128
  96. package/dist/chunk-EOKT4QFF.js.map +1 -0
  97. package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
  98. package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
  99. package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
  100. package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
  101. package/dist/chunk-K7FB3JTD.js.map +1 -0
  102. package/dist/chunk-L6LDXRWE.js +219 -0
  103. package/dist/chunk-L6LDXRWE.js.map +1 -0
  104. package/dist/chunk-M7J6Z4IJ.js +1930 -0
  105. package/dist/chunk-M7J6Z4IJ.js.map +1 -0
  106. package/dist/chunk-MQEQMS7B.js +1009 -0
  107. package/dist/chunk-MQEQMS7B.js.map +1 -0
  108. package/dist/chunk-MTELVIYR.js +1421 -0
  109. package/dist/chunk-MTELVIYR.js.map +1 -0
  110. package/dist/chunk-PVC7WDKI.js +885 -0
  111. package/dist/chunk-PVC7WDKI.js.map +1 -0
  112. package/dist/chunk-RAHNUYA5.js +368 -0
  113. package/dist/chunk-RAHNUYA5.js.map +1 -0
  114. package/dist/{chunk-DK554R7P.js → chunk-S6HXABGL.js} +2 -1
  115. package/dist/chunk-S6HXABGL.js.map +1 -0
  116. package/dist/{chunk-I3IHOHCJ.js → chunk-SHZDP2MQ.js} +1181 -1001
  117. package/dist/chunk-SHZDP2MQ.js.map +1 -0
  118. package/dist/{chunk-Y3ZLRGHC.js → chunk-SIDJO2T4.js} +16 -16
  119. package/dist/chunk-STXRMPW4.js +4131 -0
  120. package/dist/chunk-STXRMPW4.js.map +1 -0
  121. package/dist/{chunk-JR4IKCR2.js → chunk-TPND5MJS.js} +5 -5
  122. package/dist/chunk-TQPCAIQI.js +612 -0
  123. package/dist/chunk-TQPCAIQI.js.map +1 -0
  124. package/dist/chunk-UT3MHJCW.js +49 -0
  125. package/dist/chunk-UT3MHJCW.js.map +1 -0
  126. package/dist/{chunk-TEW47IVR.js → chunk-VPEFSDME.js} +2 -2
  127. package/dist/{chunk-SWTLEQL6.js → chunk-WQIA3GFB.js} +2 -2
  128. package/dist/chunk-WQIA3GFB.js.map +1 -0
  129. package/dist/{chunk-DJC4CHLQ.js → chunk-YDWBXXQZ.js} +5 -5
  130. package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
  131. package/dist/composition/index.cjs +1256 -1059
  132. package/dist/composition/index.cjs.map +1 -1
  133. package/dist/composition/index.d.cts +4 -4
  134. package/dist/composition/index.d.ts +4 -4
  135. package/dist/composition/index.js +7 -6
  136. package/dist/core/index.cjs +1218 -1021
  137. package/dist/core/index.cjs.map +1 -1
  138. package/dist/core/index.d.cts +2 -2
  139. package/dist/core/index.d.ts +2 -2
  140. package/dist/core/index.js +5 -4
  141. package/dist/cqrs/index.cjs.map +1 -1
  142. package/dist/cqrs/index.d.cts +4 -4
  143. package/dist/cqrs/index.d.ts +4 -4
  144. package/dist/cqrs/index.js +3 -2
  145. package/dist/cqrs/index.js.map +1 -1
  146. package/dist/cqrs/messaging.cjs +312 -0
  147. package/dist/cqrs/messaging.cjs.map +1 -0
  148. package/dist/cqrs/messaging.d.cts +57 -0
  149. package/dist/cqrs/messaging.d.ts +57 -0
  150. package/dist/cqrs/messaging.js +274 -0
  151. package/dist/cqrs/messaging.js.map +1 -0
  152. package/dist/cqrs/work-queue.cjs +329 -0
  153. package/dist/cqrs/work-queue.cjs.map +1 -0
  154. package/dist/cqrs/work-queue.d.cts +90 -0
  155. package/dist/cqrs/work-queue.d.ts +90 -0
  156. package/dist/cqrs/work-queue.js +292 -0
  157. package/dist/cqrs/work-queue.js.map +1 -0
  158. package/dist/data/index.cjs +19 -0
  159. package/dist/data/index.cjs.map +1 -0
  160. package/dist/data/index.d.cts +36 -0
  161. package/dist/data/index.d.ts +36 -0
  162. package/dist/data/index.js +1 -0
  163. package/dist/data/index.js.map +1 -0
  164. package/dist/data-structures/index.cjs +1252 -1052
  165. package/dist/data-structures/index.cjs.map +1 -1
  166. package/dist/data-structures/index.d.cts +9 -8
  167. package/dist/data-structures/index.d.ts +9 -8
  168. package/dist/data-structures/index.js +9 -7
  169. package/dist/{describe-BZb7AS2y.d.ts → describe-B_A5fbXH.d.ts} +1 -1
  170. package/dist/{describe-Ciu8SUnN.d.cts → describe-CQRrkv-Q.d.cts} +1 -1
  171. package/dist/executors/tool-provider-adapters.cjs +3091 -0
  172. package/dist/executors/tool-provider-adapters.cjs.map +1 -0
  173. package/dist/executors/tool-provider-adapters.d.cts +174 -0
  174. package/dist/executors/tool-provider-adapters.d.ts +174 -0
  175. package/dist/executors/tool-provider-adapters.js +1336 -0
  176. package/dist/executors/tool-provider-adapters.js.map +1 -0
  177. package/dist/executors/tool-provider-runtime.cjs +5178 -0
  178. package/dist/executors/tool-provider-runtime.cjs.map +1 -0
  179. package/dist/executors/tool-provider-runtime.d.cts +17 -0
  180. package/dist/executors/tool-provider-runtime.d.ts +17 -0
  181. package/dist/executors/tool-provider-runtime.js +15 -0
  182. package/dist/executors/tool-provider-runtime.js.map +1 -0
  183. package/dist/executors/tool-provider.cjs +6392 -0
  184. package/dist/executors/tool-provider.cjs.map +1 -0
  185. package/dist/executors/tool-provider.d.cts +60 -0
  186. package/dist/executors/tool-provider.d.ts +60 -0
  187. package/dist/executors/tool-provider.js +89 -0
  188. package/dist/executors/tool-provider.js.map +1 -0
  189. package/dist/executors/work-queue.cjs +342 -0
  190. package/dist/executors/work-queue.cjs.map +1 -0
  191. package/dist/executors/work-queue.d.cts +90 -0
  192. package/dist/executors/work-queue.d.ts +90 -0
  193. package/dist/executors/work-queue.js +306 -0
  194. package/dist/executors/work-queue.js.map +1 -0
  195. package/dist/graph/index.cjs +1536 -1324
  196. package/dist/graph/index.cjs.map +1 -1
  197. package/dist/graph/index.d.cts +10 -9
  198. package/dist/graph/index.d.ts +10 -9
  199. package/dist/graph/index.js +22 -20
  200. package/dist/{graph-s23RbbFO.d.cts → graph-CWK3HLPB.d.cts} +134 -132
  201. package/dist/{graph-DfdF9zy4.d.ts → graph-ho5sotHP.d.ts} +134 -132
  202. package/dist/{index-SnzZu3x7.d.ts → index-CQWcE0Dw.d.ts} +18 -4
  203. package/dist/{index-CAEmLCYF.d.cts → index-DHA1i67c.d.cts} +18 -4
  204. package/dist/index.cjs +3331 -3020
  205. package/dist/index.cjs.map +1 -1
  206. package/dist/index.d.cts +14 -10
  207. package/dist/index.d.ts +14 -10
  208. package/dist/index.js +114 -108
  209. package/dist/inspection/boundary.cjs +98 -0
  210. package/dist/inspection/boundary.cjs.map +1 -0
  211. package/dist/inspection/boundary.d.cts +61 -0
  212. package/dist/inspection/boundary.d.ts +61 -0
  213. package/dist/inspection/boundary.js +75 -0
  214. package/dist/inspection/boundary.js.map +1 -0
  215. package/dist/measurements-C0mAvWU1.d.cts +164 -0
  216. package/dist/measurements-OMpCeBwh.d.ts +164 -0
  217. package/dist/{messages-BZqrGGm1.d.ts → messages-CAzUPPJM.d.cts} +10 -5
  218. package/dist/{messages-BZqrGGm1.d.cts → messages-CAzUPPJM.d.ts} +10 -5
  219. package/dist/messaging/index.cjs +756 -619
  220. package/dist/messaging/index.cjs.map +1 -1
  221. package/dist/messaging/index.d.cts +17 -226
  222. package/dist/messaging/index.d.ts +17 -226
  223. package/dist/messaging/index.js +19 -749
  224. package/dist/messaging/index.js.map +1 -1
  225. package/dist/operators/index.cjs +1256 -1059
  226. package/dist/operators/index.cjs.map +1 -1
  227. package/dist/operators/index.d.cts +6 -6
  228. package/dist/operators/index.d.ts +6 -6
  229. package/dist/operators/index.js +9 -8
  230. package/dist/orchestration/index.cjs +8664 -2617
  231. package/dist/orchestration/index.cjs.map +1 -1
  232. package/dist/orchestration/index.d.cts +171 -221
  233. package/dist/orchestration/index.d.ts +171 -221
  234. package/dist/orchestration/index.js +74 -982
  235. package/dist/orchestration/index.js.map +1 -1
  236. package/dist/orchestration/messaging.cjs +314 -0
  237. package/dist/orchestration/messaging.cjs.map +1 -0
  238. package/dist/orchestration/messaging.d.cts +56 -0
  239. package/dist/orchestration/messaging.d.ts +56 -0
  240. package/dist/orchestration/messaging.js +276 -0
  241. package/dist/orchestration/messaging.js.map +1 -0
  242. package/dist/orchestration/work-queue.cjs +1500 -0
  243. package/dist/orchestration/work-queue.cjs.map +1 -0
  244. package/dist/orchestration/work-queue.d.cts +196 -0
  245. package/dist/orchestration/work-queue.d.ts +196 -0
  246. package/dist/orchestration/work-queue.js +1289 -0
  247. package/dist/orchestration/work-queue.js.map +1 -0
  248. package/dist/patterns/event-flow.cjs +433 -0
  249. package/dist/patterns/event-flow.cjs.map +1 -0
  250. package/dist/patterns/event-flow.d.cts +115 -0
  251. package/dist/patterns/event-flow.d.ts +115 -0
  252. package/dist/patterns/event-flow.js +14 -0
  253. package/dist/patterns/event-flow.js.map +1 -0
  254. package/dist/patterns/index.cjs +748 -355
  255. package/dist/patterns/index.cjs.map +1 -1
  256. package/dist/patterns/index.d.cts +9 -5
  257. package/dist/patterns/index.d.ts +9 -5
  258. package/dist/patterns/index.js +13 -4
  259. package/dist/process-types-C9uMYz3i.d.ts +200 -0
  260. package/dist/process-types-h3uRlzDc.d.cts +200 -0
  261. package/dist/{reactive-collection-BxBqtIOE.d.cts → reactive-collection-B9R0Bl1P.d.cts} +11 -41
  262. package/dist/{reactive-collection-Cb1II1Fi.d.ts → reactive-collection-BXFrH0U2.d.ts} +11 -41
  263. package/dist/{reactive-collection-storage-D-KmjE0J.d.cts → reactive-collection-storage-BLGv8Xp8.d.cts} +5 -5
  264. package/dist/{reactive-collection-storage-BNiEc-Gd.d.ts → reactive-collection-storage-a4zD3665.d.ts} +5 -5
  265. package/dist/{reactive-map-BcB4KsQR.d.ts → reactive-map-C_8sOfdS.d.cts} +7 -6
  266. package/dist/{reactive-map-D-g3dv8I.d.cts → reactive-map-jle5dnok.d.ts} +7 -6
  267. package/dist/render/index.d.cts +3 -3
  268. package/dist/render/index.d.ts +3 -3
  269. package/dist/render/index.js +1 -0
  270. package/dist/scheduled-readiness-5rwQlyjV.d.ts +91 -0
  271. package/dist/scheduled-readiness-DpRY8jI0.d.cts +91 -0
  272. package/dist/semantic-memory-graph-C2ZUwIlq.d.ts +30 -0
  273. package/dist/semantic-memory-graph-DlZBD_Eu.d.cts +30 -0
  274. package/dist/{semantic-memory-graph-BYoIlP35.d.cts → semantic-memory-graph-types-BvzdqmkY.d.cts} +2 -28
  275. package/dist/{semantic-memory-graph-CxyXLms3.d.ts → semantic-memory-graph-types-Ci-OtahO.d.ts} +2 -28
  276. package/dist/solutions/index.cjs +6788 -2128
  277. package/dist/solutions/index.cjs.map +1 -1
  278. package/dist/solutions/index.d.cts +15 -519
  279. package/dist/solutions/index.d.ts +15 -519
  280. package/dist/solutions/index.js +91 -7
  281. package/dist/solutions/reactive-layout/browser/index.cjs +457 -0
  282. package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -0
  283. package/dist/solutions/reactive-layout/browser/index.d.cts +44 -0
  284. package/dist/solutions/reactive-layout/browser/index.d.ts +44 -0
  285. package/dist/solutions/reactive-layout/browser/index.js +69 -0
  286. package/dist/solutions/reactive-layout/browser/index.js.map +1 -0
  287. package/dist/solutions/reactive-layout/index.cjs +4494 -0
  288. package/dist/solutions/reactive-layout/index.cjs.map +1 -0
  289. package/dist/solutions/reactive-layout/index.d.cts +37 -0
  290. package/dist/solutions/reactive-layout/index.d.ts +37 -0
  291. package/dist/solutions/reactive-layout/index.js +146 -0
  292. package/dist/solutions/reactive-layout/index.js.map +1 -0
  293. package/dist/solutions/reactive-layout/node-canvas/index.cjs +555 -0
  294. package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -0
  295. package/dist/solutions/reactive-layout/node-canvas/index.d.cts +54 -0
  296. package/dist/solutions/reactive-layout/node-canvas/index.d.ts +54 -0
  297. package/dist/solutions/reactive-layout/node-canvas/index.js +131 -0
  298. package/dist/solutions/reactive-layout/node-canvas/index.js.map +1 -0
  299. package/dist/solutions/reactive-layout/react-native/index.cjs +504 -0
  300. package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -0
  301. package/dist/solutions/reactive-layout/react-native/index.d.cts +51 -0
  302. package/dist/solutions/reactive-layout/react-native/index.d.ts +51 -0
  303. package/dist/solutions/reactive-layout/react-native/index.js +77 -0
  304. package/dist/solutions/reactive-layout/react-native/index.js.map +1 -0
  305. package/dist/solutions/reactive-layout/skia/index.cjs +557 -0
  306. package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -0
  307. package/dist/solutions/reactive-layout/skia/index.d.cts +64 -0
  308. package/dist/solutions/reactive-layout/skia/index.d.ts +64 -0
  309. package/dist/solutions/reactive-layout/skia/index.js +70 -0
  310. package/dist/solutions/reactive-layout/skia/index.js.map +1 -0
  311. package/dist/solutions/work-item/actions.cjs +2345 -0
  312. package/dist/solutions/work-item/actions.cjs.map +1 -0
  313. package/dist/solutions/work-item/actions.d.cts +40 -0
  314. package/dist/solutions/work-item/actions.d.ts +40 -0
  315. package/dist/solutions/work-item/actions.js +2078 -0
  316. package/dist/solutions/work-item/actions.js.map +1 -0
  317. package/dist/solutions/work-item/scheduling.cjs +9797 -0
  318. package/dist/solutions/work-item/scheduling.cjs.map +1 -0
  319. package/dist/solutions/work-item/scheduling.d.cts +1868 -0
  320. package/dist/solutions/work-item/scheduling.d.ts +1868 -0
  321. package/dist/solutions/work-item/scheduling.js +146 -0
  322. package/dist/solutions/work-item/scheduling.js.map +1 -0
  323. package/dist/solutions/work-item/work-queue.cjs +306 -0
  324. package/dist/solutions/work-item/work-queue.cjs.map +1 -0
  325. package/dist/solutions/work-item/work-queue.d.cts +71 -0
  326. package/dist/solutions/work-item/work-queue.d.ts +71 -0
  327. package/dist/solutions/work-item/work-queue.js +270 -0
  328. package/dist/solutions/work-item/work-queue.js.map +1 -0
  329. package/dist/sources/browser.cjs +1399 -1052
  330. package/dist/sources/browser.cjs.map +1 -1
  331. package/dist/sources/browser.d.cts +33 -6
  332. package/dist/sources/browser.d.ts +33 -6
  333. package/dist/sources/browser.js +73 -6
  334. package/dist/sources/browser.js.map +1 -1
  335. package/dist/sources/index.cjs +1345 -1065
  336. package/dist/sources/index.cjs.map +1 -1
  337. package/dist/sources/index.d.cts +5 -5
  338. package/dist/sources/index.d.ts +5 -5
  339. package/dist/sources/index.js +7 -6
  340. package/dist/sources/node.cjs.map +1 -1
  341. package/dist/sources/node.d.cts +4 -4
  342. package/dist/sources/node.d.ts +4 -4
  343. package/dist/sources/node.js +2 -1
  344. package/dist/sources/node.js.map +1 -1
  345. package/dist/storage/browser.cjs +16 -0
  346. package/dist/storage/browser.cjs.map +1 -1
  347. package/dist/storage/browser.js +4 -3
  348. package/dist/storage/browser.js.map +1 -1
  349. package/dist/storage/index.cjs +16 -0
  350. package/dist/storage/index.cjs.map +1 -1
  351. package/dist/storage/index.d.cts +6 -5
  352. package/dist/storage/index.d.ts +6 -5
  353. package/dist/storage/index.js +10 -9
  354. package/dist/storage/node.cjs +16 -0
  355. package/dist/storage/node.cjs.map +1 -1
  356. package/dist/storage/node.js +4 -3
  357. package/dist/storage/node.js.map +1 -1
  358. package/dist/store-BmtEs9mG.d.ts +123 -0
  359. package/dist/store-PAAsYvML.d.cts +123 -0
  360. package/dist/testing/index.cjs +1 -0
  361. package/dist/testing/index.cjs.map +1 -1
  362. package/dist/testing/index.d.cts +1 -1
  363. package/dist/testing/index.d.ts +1 -1
  364. package/dist/testing/index.js +3 -2
  365. package/dist/types-BRNKoFHj.d.ts +357 -0
  366. package/dist/{types-h12mNYbq.d.ts → types-BS6CyR-x.d.cts} +49 -130
  367. package/dist/types-BWK2ay3e.d.cts +457 -0
  368. package/dist/types-BXKSAoE1.d.cts +357 -0
  369. package/dist/types-BaPpZItj.d.ts +457 -0
  370. package/dist/types-BhveCMg5.d.cts +274 -0
  371. package/dist/{types-bNMSWKqF.d.cts → types-C9NOgNJw.d.ts} +49 -130
  372. package/dist/types-CTsQ8Ww4.d.ts +274 -0
  373. package/dist/types-DL_05n2M.d.ts +34 -0
  374. package/dist/types-XDoqxYO9.d.cts +34 -0
  375. package/dist/work-item-runtime-types-BqtWnSCS.d.ts +138 -0
  376. package/dist/work-item-runtime-types-CHO03AKh.d.cts +138 -0
  377. package/dist/work-queue/index.cjs +1136 -0
  378. package/dist/work-queue/index.cjs.map +1 -0
  379. package/dist/work-queue/index.d.cts +21 -0
  380. package/dist/work-queue/index.d.ts +21 -0
  381. package/dist/work-queue/index.js +1082 -0
  382. package/dist/work-queue/index.js.map +1 -0
  383. package/package.json +603 -249
  384. package/dist/chunk-2ILL7HQI.js.map +0 -1
  385. package/dist/chunk-4VLAQHZI.js.map +0 -1
  386. package/dist/chunk-COHO25CZ.js.map +0 -1
  387. package/dist/chunk-DK554R7P.js.map +0 -1
  388. package/dist/chunk-G4M3NHRJ.js.map +0 -1
  389. package/dist/chunk-I3IHOHCJ.js.map +0 -1
  390. package/dist/chunk-JIMUDQN3.js.map +0 -1
  391. package/dist/chunk-RIIOUTGM.js.map +0 -1
  392. package/dist/chunk-SWTLEQL6.js.map +0 -1
  393. /package/dist/{chunk-GDL26N2T.js.map → chunk-3KN7NJDR.js.map} +0 -0
  394. /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
  395. /package/dist/{chunk-D6BG7U6A.js.map → chunk-7HZRJMN6.js.map} +0 -0
  396. /package/dist/{chunk-SCRFRCGR.js.map → chunk-BSQGE5PS.js.map} +0 -0
  397. /package/dist/{chunk-PKVBHGBM.js.map → chunk-CJIFGJQG.js.map} +0 -0
  398. /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
  399. /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
  400. /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
  401. /package/dist/{chunk-Y3ZLRGHC.js.map → chunk-SIDJO2T4.js.map} +0 -0
  402. /package/dist/{chunk-JR4IKCR2.js.map → chunk-TPND5MJS.js.map} +0 -0
  403. /package/dist/{chunk-TEW47IVR.js.map → chunk-VPEFSDME.js.map} +0 -0
  404. /package/dist/{chunk-DJC4CHLQ.js.map → chunk-YDWBXXQZ.js.map} +0 -0
  405. /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
@@ -1,11 +1,7 @@
1
- import {
2
- strictCanonicalJsonBytes,
3
- strictJsonCodec
4
- } from "./chunk-4VLAQHZI.js";
5
1
  import {
6
2
  CTX_DEP_CACHE,
7
3
  CTX_NODE_BINDING
8
- } from "./chunk-SWTLEQL6.js";
4
+ } from "./chunk-WQIA3GFB.js";
9
5
  import {
10
6
  SENTINEL,
11
7
  errorPayload,
@@ -16,7 +12,11 @@ import {
16
12
  isUpAllowed,
17
13
  isValueTier,
18
14
  messageTier
19
- } from "./chunk-DK554R7P.js";
15
+ } from "./chunk-S6HXABGL.js";
16
+ import {
17
+ strictCanonicalJsonBytes,
18
+ strictJsonCodec
19
+ } from "./chunk-K7FB3JTD.js";
20
20
 
21
21
  // src/batch/boundary.ts
22
22
  var depth = 0;
@@ -731,7 +731,33 @@ function makeDepBookkeeping(depCount) {
731
731
  };
732
732
  }
733
733
 
734
- // src/node/node.ts
734
+ // src/node/protocol-guards.ts
735
+ function terminalView(t) {
736
+ return t === void 0 ? false : t;
737
+ }
738
+ function normalizePullDemand(demand) {
739
+ if (typeof demand !== "object" || demand === null || Array.isArray(demand)) {
740
+ throw new Error("ctx.up: PULL requires { pullId, params? } demand payload (D269)");
741
+ }
742
+ const pullId = demand.pullId;
743
+ if (typeof pullId !== "string" && typeof pullId !== "symbol") {
744
+ throw new Error("ctx.up: PULL demand requires a string or symbol pullId (D269)");
745
+ }
746
+ const params = demand.params;
747
+ return params === void 0 ? { pullId } : { pullId, params };
748
+ }
749
+ function validateDownPayloads(msgs) {
750
+ for (const m of msgs) {
751
+ if (m[0] === "DATA" && m[1] === void 0) {
752
+ throw new Error("down: DATA requires a non-SENTINEL payload (R-data-payload)");
753
+ }
754
+ if (m[0] === "ERROR" && isInvalidErrorPayload(m[1])) {
755
+ throw new Error("down: ERROR requires a non-SENTINEL, non-boolean payload (R-data-payload)");
756
+ }
757
+ }
758
+ }
759
+
760
+ // src/node/runtime-accessors.ts
735
761
  var constructingCore;
736
762
  var constructingEnvironment;
737
763
  var ownerTokens = /* @__PURE__ */ new WeakMap();
@@ -752,6 +778,11 @@ function withNodeCore(core, create) {
752
778
  constructingCore = prev;
753
779
  }
754
780
  }
781
+ function takeConstructingNodeCore() {
782
+ const core = constructingCore;
783
+ constructingCore = void 0;
784
+ return core;
785
+ }
755
786
  function withEnvironmentDrivers(environment, create) {
756
787
  const prev = constructingEnvironment;
757
788
  constructingEnvironment = environment;
@@ -761,6 +792,11 @@ function withEnvironmentDrivers(environment, create) {
761
792
  constructingEnvironment = prev;
762
793
  }
763
794
  }
795
+ function takeConstructingEnvironmentDrivers() {
796
+ const environment = constructingEnvironment;
797
+ constructingEnvironment = void 0;
798
+ return environment;
799
+ }
764
800
  function getNodeOwner(n) {
765
801
  return ownerTokens.get(n);
766
802
  }
@@ -798,20 +834,1016 @@ function isNodeActiveForRelease(n) {
798
834
  function isNodeRuntimeReleased(n) {
799
835
  return releasedNodes.has(n);
800
836
  }
801
- function terminalView(t) {
802
- return t === void 0 ? false : t;
837
+
838
+ // src/node/node-context-runtime.ts
839
+ function nodeBuildCtx(self) {
840
+ const kind = self._slot.handle ? self._slot.dispatcher.poolKind(self._slot.handle.poolId) : "sync";
841
+ if (kind === "sync") {
842
+ if (self._syncCtx === null) self._syncCtx = self._makeCtx();
843
+ self._refreshCtx(self._syncCtx);
844
+ return self._syncCtx;
845
+ }
846
+ return self._makeCtx({
847
+ waveData: self._dep.waveData.map((waves) => waves.map((w) => [...w])),
848
+ terminal: self._dep.terminalInput.map(terminalView),
849
+ latest: [...self._dep.prev]
850
+ });
803
851
  }
804
- function validateDownPayloads(msgs) {
852
+ function nodeMakeCtx(self, snapshot) {
853
+ const ctx = {
854
+ // Wave-owner boundary (D47): a SYNC fn's emit nests under the public entry that drove
855
+ // it (cheap inc/dec, no early drain); an ASYNC-pool fn re-enters here from its stashed
856
+ // ctx at depth 0, so this is the boundary that drains any rewireNext it issued.
857
+ up: (msgs, towardDep) => {
858
+ if (self._released) return;
859
+ enterWave();
860
+ try {
861
+ self._up(msgs, towardDep);
862
+ } finally {
863
+ exitWave();
864
+ }
865
+ },
866
+ down: (msgs) => {
867
+ if (self._released) return;
868
+ enterWave();
869
+ try {
870
+ self._down(msgs);
871
+ } finally {
872
+ exitWave();
873
+ }
874
+ },
875
+ waveData: snapshot?.waveData ?? self._dep.waveData,
876
+ terminal: snapshot?.terminal ?? self._dep.terminalInput.map(terminalView),
877
+ state: self._makeState(),
878
+ onDeactivation: (fn) => {
879
+ if (self._released) return;
880
+ self._hooks.onDeactivation.push(fn);
881
+ },
882
+ onInvalidate: (fn) => {
883
+ if (self._released) return;
884
+ self._hooks.onInvalidate.push(fn);
885
+ },
886
+ environment: () => self._slot.environment,
887
+ // R-rewire-deferred (D47): defer a self-dep-set mutation to the committed boundary.
888
+ rewireNext: {
889
+ subscribeDep: (dep, fn) => self._requestRewireNext({ kind: "add", dep, fn }),
890
+ unsubscribeDep: (dep, fn) => self._requestRewireNext({ kind: "remove", dep, fn }),
891
+ replaceDeps: (deps, fn) => self._requestRewireNext({ kind: "set", deps, fn })
892
+ },
893
+ // R-up-routing / R-pull (D269): deferred up — route a control/demand wave (e.g. PULL)
894
+ // up the declared cone at the committed boundary. The SELF-demand path: an
895
+ // immediate ctx.up whose delivery loops back re-enters this fn (D37 / R-reentrancy).
896
+ upNext: (msgs, towardDep) => self._requestUpNext(msgs, towardDep),
897
+ ...self._control.activePull === void 0 ? {} : { pull: self._control.activePull },
898
+ [CTX_DEP_CACHE]: { latest: snapshot?.latest ?? self._dep.prev },
899
+ [CTX_NODE_BINDING]: {
900
+ dispatcher: self._slot.dispatcher,
901
+ create: (factory) => withEnvironmentDrivers(self._slot.environment, () => withNodeCore(self._core, factory))
902
+ }
903
+ };
904
+ if (self._slot.dynamic) {
905
+ ctx.track = (i) => ctx[CTX_DEP_CACHE]?.latest[i];
906
+ }
907
+ return ctx;
908
+ }
909
+ function nodeRefreshCtx(self, ctx) {
910
+ ctx.waveData = self._dep.waveData;
911
+ ctx.terminal = self._dep.terminalInput.map(terminalView);
912
+ if (self._control.activePull === void 0) {
913
+ delete ctx.pull;
914
+ } else {
915
+ ctx.pull = self._control.activePull;
916
+ }
917
+ ctx[CTX_DEP_CACHE] = { latest: self._dep.prev };
918
+ }
919
+ function nodeMakeState(self) {
920
+ return {
921
+ get: () => self._privateState.value,
922
+ set: (v) => {
923
+ self._privateState.value = v;
924
+ },
925
+ persist: (on = true) => {
926
+ self._privateState.persist = on;
927
+ }
928
+ };
929
+ }
930
+
931
+ // src/node/node-input-runtime.ts
932
+ function nodeRecordDepProjection(self, idx, delivery) {
933
+ const token = delivery?.wave ?? {};
934
+ if (self._dep.waveTokens[idx] !== token) {
935
+ self._dep.waveData[idx].push([]);
936
+ self._dep.waveTokens[idx] = token;
937
+ }
938
+ return self._dep.waveData[idx][self._dep.waveData[idx].length - 1];
939
+ }
940
+ function nodeDepProjectionHasData(self, idx) {
941
+ const projection = self._dep.waveData[idx][self._dep.waveData[idx].length - 1];
942
+ return projection?.some((v) => v !== SENTINEL) ?? false;
943
+ }
944
+ function nodeReceiveFromDep(self, idx, msg, delivery) {
945
+ if (self._released) return;
946
+ const t = msg[0];
947
+ if (t === "START") return;
948
+ const isLastInDeliveredWave = delivery?.last ?? true;
949
+ if (self._value.terminal !== void 0) {
950
+ if (t === "TEARDOWN") self._down([["TEARDOWN"]]);
951
+ return;
952
+ }
953
+ if (t === "INVALIDATE") {
954
+ const projection = self._recordDepProjection(idx, delivery);
955
+ projection.push(SENTINEL);
956
+ if (projection.some((v) => v !== SENTINEL) && isLastInDeliveredWave) self._maybeRun();
957
+ self._dep.prev[idx] = SENTINEL;
958
+ self._dep.hasData[idx] = false;
959
+ self._dep.batch[idx] = null;
960
+ if (self._dep.dirty[idx]) {
961
+ self._dep.dirty[idx] = false;
962
+ self._wave.pending--;
963
+ }
964
+ if (self._control.pausedDepWaveOccurred && self._dep.batch.every((b) => b === null)) {
965
+ self._control.pausedDepWaveOccurred = false;
966
+ }
967
+ const hadData = self._value.hasData;
968
+ self._invalidate();
969
+ if (self._wave.pending === 0 && self._wave.emittedDirtyThisWave) {
970
+ if (!hadData) self._down([["RESOLVED"]]);
971
+ else self._wave.emittedDirtyThisWave = false;
972
+ }
973
+ self._fireOwedDemandIfReady();
974
+ return;
975
+ }
976
+ if (isTerminal(t)) {
977
+ const isError = t === "ERROR";
978
+ const errPayload = isError ? msg[1] : void 0;
979
+ self._dep.terminal[idx] = isError ? errPayload : true;
980
+ self._dep.terminalInput[idx] = isError ? errPayload : true;
981
+ self._releaseDepDirty(idx);
982
+ const ranValueBeforeTerminal = self._depProjectionHasData(idx) && isLastInDeliveredWave;
983
+ if (ranValueBeforeTerminal) self._maybeRun();
984
+ if (isError && self._slot.errorWhenDepsError) {
985
+ self._down([["ERROR", errPayload]]);
986
+ } else if (self._slot.terminalAsRealInput) {
987
+ if (ranValueBeforeTerminal) {
988
+ self._fireOwedDemandIfReady();
989
+ return;
990
+ }
991
+ self._maybeRun();
992
+ } else if (self._slot.completeWhenDepsComplete && self._allDepsTerminal()) {
993
+ self._down([["COMPLETE"]]);
994
+ } else {
995
+ self._settleAfterAbsorbedTerminal();
996
+ }
997
+ self._fireOwedDemandIfReady();
998
+ return;
999
+ }
1000
+ if (t === "TEARDOWN") {
1001
+ self._down([["TEARDOWN"]]);
1002
+ return;
1003
+ }
1004
+ if (t === "DIRTY") {
1005
+ if (!self._dep.dirty[idx]) {
1006
+ self._dep.dirty[idx] = true;
1007
+ self._wave.pending++;
1008
+ self._dep.tier[idx] = 2;
1009
+ self._markDirty();
1010
+ }
1011
+ return;
1012
+ }
1013
+ if (t === "DATA") {
1014
+ const v = msg[1];
1015
+ self._recordDepProjection(idx, delivery).push(v);
1016
+ const b = self._dep.batch[idx];
1017
+ if (b === null) self._dep.batch[idx] = [v];
1018
+ else b.push(v);
1019
+ self._dep.prev[idx] = v;
1020
+ self._dep.hasData[idx] = true;
1021
+ self._dep.tier[idx] = 3;
1022
+ if (self._dep.dirty[idx]) {
1023
+ self._dep.dirty[idx] = false;
1024
+ self._wave.pending--;
1025
+ }
1026
+ if (isLastInDeliveredWave) self._maybeRun();
1027
+ self._fireOwedDemandIfReady();
1028
+ return;
1029
+ }
1030
+ if (t === "RESOLVED") {
1031
+ self._recordDepProjection(idx, delivery);
1032
+ self._dep.tier[idx] = 3;
1033
+ if (self._dep.dirty[idx]) {
1034
+ self._dep.dirty[idx] = false;
1035
+ self._wave.pending--;
1036
+ }
1037
+ if (isLastInDeliveredWave) self._maybeRun();
1038
+ self._fireOwedDemandIfReady();
1039
+ return;
1040
+ }
1041
+ }
1042
+ function nodeReleaseDepDirty(self, idx) {
1043
+ if (self._dep.dirty[idx]) {
1044
+ self._dep.dirty[idx] = false;
1045
+ self._wave.pending--;
1046
+ }
1047
+ }
1048
+ function nodeSettleAfterAbsorbedTerminal(self) {
1049
+ if (self._wave.pending !== 0 || !self._wave.emittedDirtyThisWave) return;
1050
+ const sawData = self._dep.batch.some((b) => b !== null && b.length > 0);
1051
+ if (sawData) self._maybeRun();
1052
+ if (self._wave.emittedDirtyThisWave) self._down([["RESOLVED"]]);
1053
+ }
1054
+ function nodeMarkDirty(self) {
1055
+ self._value.status = "dirty";
1056
+ if (self._isPullQuiet()) return;
1057
+ if (!self._wave.emittedDirtyThisWave) {
1058
+ self._wave.emittedDirtyThisWave = true;
1059
+ self._emitToSubs(["DIRTY"]);
1060
+ }
1061
+ }
1062
+ function nodeMaybeRun(self) {
1063
+ if (self._wave.inDepMutation) {
1064
+ self._wave.rewireRunPending = true;
1065
+ return;
1066
+ }
1067
+ if (self._slot.pausable === true && (self._isPaused() || self._isPullQuiet())) {
1068
+ self._control.pausedDepWaveOccurred = true;
1069
+ return;
1070
+ }
1071
+ self._tryRun();
1072
+ }
1073
+ function nodeSettleRewire(self) {
1074
+ if (self._slot.pausable === true && self._isPaused()) {
1075
+ self._control.pausedDepWaveOccurred = true;
1076
+ return;
1077
+ }
1078
+ if (self._wave.pending > 0) return;
1079
+ if (self._slot.handle === null) {
1080
+ self._passthroughEmit();
1081
+ return;
1082
+ }
1083
+ if (!self._wave.hasCalledFnOnce && !(self._slot.partial || self._allDepsSettled())) return;
1084
+ self._markDirty();
1085
+ self._runWave();
1086
+ }
1087
+ function nodeTryRun(self) {
1088
+ if (self._wave.pending > 0) return;
1089
+ if (self._slot.handle === null) {
1090
+ self._passthroughEmit();
1091
+ return;
1092
+ }
1093
+ if (!self._wave.hasCalledFnOnce) {
1094
+ if (self._slot.partial || self._allDepsSettled()) self._runWave();
1095
+ return;
1096
+ }
1097
+ self._runWave();
1098
+ }
1099
+ function nodeAllDepsSettled(self) {
1100
+ for (let i = 0; i < self._slot.deps.length; i++) {
1101
+ if (self._dep.hasData[i]) continue;
1102
+ if (self._slot.terminalAsRealInput && self._dep.terminal[i] !== void 0) continue;
1103
+ return false;
1104
+ }
1105
+ return true;
1106
+ }
1107
+ function nodePassthroughEmit(self) {
1108
+ const b = self._dep.batch[0];
1109
+ if (b !== null && b.length > 0) {
1110
+ self._down([["DATA", b[b.length - 1]]]);
1111
+ } else if (self._wave.emittedDirtyThisWave) {
1112
+ self._down([["RESOLVED"]]);
1113
+ }
1114
+ self._dep.batch[0] = null;
1115
+ self._wave.emittedDirtyThisWave = false;
1116
+ }
1117
+ function nodeRunWave(self) {
1118
+ if (self._wave.insideRunWave)
1119
+ throw new Error(
1120
+ "synchronous feedback cycle: node fn re-entered its own wave (R-reentrancy / D37)"
1121
+ );
1122
+ self._wave.hasCalledFnOnce = true;
1123
+ self._hooks.onInvalidate = [];
1124
+ self._hooks.onDeactivation = [];
1125
+ const ctx = self._buildCtx();
1126
+ const wasDirty = self._wave.emittedDirtyThisWave;
1127
+ self._wave.emittedSettleThisWave = false;
1128
+ self._wave.insideRunWave = true;
1129
+ try {
1130
+ self._slot.dispatcher.invoke(self._slot.handle, ctx);
1131
+ } finally {
1132
+ self._wave.insideRunWave = false;
1133
+ }
1134
+ if (wasDirty && !self._wave.emittedSettleThisWave && self._value.terminal === void 0 && !self._isAsyncPool()) {
1135
+ self._down([["RESOLVED"]]);
1136
+ }
1137
+ for (let i = 0; i < self._dep.batch.length; i++) {
1138
+ self._dep.batch[i] = null;
1139
+ self._dep.waveData[i] = [];
1140
+ self._dep.waveTokens[i] = void 0;
1141
+ self._dep.terminalInput[i] = void 0;
1142
+ }
1143
+ self._wave.emittedDirtyThisWave = false;
1144
+ }
1145
+
1146
+ // src/node/node-runtime-host.ts
1147
+ function nodeRuntimeHost(node2) {
1148
+ return node2;
1149
+ }
1150
+
1151
+ // src/node/node-lifecycle-runtime.ts
1152
+ function nodeActivate(self) {
1153
+ self._lifecycle.activated = true;
1154
+ const seedRestoredDeps = self._restoredActivationPending;
1155
+ self._restoredActivationPending = false;
1156
+ self._dep.unsubs = new Array(self._slot.deps.length);
1157
+ self._dep.idxBoxes = new Array(self._slot.deps.length);
1158
+ for (const dep of self._slot.deps) self._subscribeDepAt(dep, { seedRestored: seedRestoredDeps });
1159
+ if (self._slot.deps.length === 0 && self._slot.handle !== null && !self._wave.hasCalledFnOnce) {
1160
+ self._runWave();
1161
+ }
1162
+ }
1163
+ function nodeSubscribeDepAt(self, depNode, opts = {}) {
1164
+ const idx0 = self._slot.deps.indexOf(depNode);
1165
+ const box = { v: idx0 };
1166
+ let ignoreInitialPush = opts.seedRestored === true;
1167
+ if (ignoreInitialPush && idx0 !== -1) {
1168
+ self._seedRestoredDepAt(idx0, depNode);
1169
+ const dep = nodeRuntimeHost(depNode);
1170
+ if (dep._value.terminal !== void 0 && !dep._slot.resubscribable) {
1171
+ self._dep.unsubs[idx0] = () => {
1172
+ };
1173
+ self._dep.idxBoxes[idx0] = box;
1174
+ return;
1175
+ }
1176
+ }
1177
+ const unsub = depNode.subscribe((msg, delivery) => {
1178
+ if (ignoreInitialPush && delivery === void 0) return;
1179
+ if (ignoreInitialPush) ignoreInitialPush = false;
1180
+ if (box.v === -1) return;
1181
+ self._receiveFromDep(box.v, msg, delivery);
1182
+ });
1183
+ if (ignoreInitialPush && idx0 !== -1 && box.v !== -1) self._seedRestoredDepAt(idx0, depNode);
1184
+ ignoreInitialPush = false;
1185
+ if (idx0 !== -1) {
1186
+ self._dep.unsubs[idx0] = unsub;
1187
+ self._dep.idxBoxes[idx0] = box;
1188
+ }
1189
+ }
1190
+ function nodeSeedRestoredDepAt(self, idx, depNode) {
1191
+ const dep = nodeRuntimeHost(depNode);
1192
+ const seedData = dep._value.hasData && !dep._slot.pull;
1193
+ self._dep.batch[idx] = null;
1194
+ self._dep.waveData[idx] = [];
1195
+ self._dep.waveTokens[idx] = void 0;
1196
+ self._dep.prev[idx] = seedData ? dep._value.cache : SENTINEL;
1197
+ self._dep.hasData[idx] = seedData;
1198
+ self._dep.dirty[idx] = false;
1199
+ self._dep.tier[idx] = seedData ? 3 : 0;
1200
+ self._dep.terminal[idx] = dep._value.terminal;
1201
+ self._dep.terminalInput[idx] = void 0;
1202
+ }
1203
+ function nodeDeactivate(self) {
1204
+ self._lifecycle.activated = false;
1205
+ for (const u of self._dep.unsubs) if (u) u();
1206
+ self._dep.unsubs = [];
1207
+ self._dep.idxBoxes = [];
1208
+ for (const fn of self._hooks.onDeactivation) fn();
1209
+ self._hooks.onDeactivation = [];
1210
+ self._hooks.onInvalidate = [];
1211
+ const isCompute = self._slot.handle !== null || self._slot.deps.length > 0;
1212
+ if (isCompute) {
1213
+ self._value.cache = SENTINEL;
1214
+ self._value.hasData = false;
1215
+ self._value.status = "sentinel";
1216
+ }
1217
+ self._resetDepState();
1218
+ self._wave.hasCalledFnOnce = false;
1219
+ self._control.pauseLockset.clear();
1220
+ self._control.pauseBuffer = [];
1221
+ self._control.pausedDepWaveOccurred = false;
1222
+ self._control.demandOwed = void 0;
1223
+ self._control.activePull = void 0;
1224
+ self._control.pullDirtyOwed = false;
1225
+ self._value.replayRing = [];
1226
+ if (!self._privateState.persist) self._privateState.value = SENTINEL;
1227
+ }
1228
+ function nodeSubscriberCount(self) {
1229
+ return self._lifecycle.subscribers.size;
1230
+ }
1231
+ function nodeIsRuntimeQuiescentForRelease(self) {
1232
+ return !self._released && self._value.status !== "dirty" && self._value.status !== "pending" && self._wave.pending === 0 && !self._wave.insideRunWave && !self._wave.inDepMutation && !self._wave.rewireRunPending && !self._wave.batchDirtyOwed && self._dep.dirty.every((dirty) => !dirty) && self._control.pauseBuffer.length === 0 && !self._control.pausedDepWaveOccurred && self._control.demandOwed === void 0 && self._control.activePull === void 0 && !self._control.inDeliverDemand && self._control.pauseLockset.size === 0;
1233
+ }
1234
+ function nodeReleaseRuntime(self) {
1235
+ if (self._released) return;
1236
+ self._released = true;
1237
+ const node2 = self;
1238
+ releasedNodes.add(node2);
1239
+ let releaseError;
1240
+ const recordReleaseError = (error) => {
1241
+ if (releaseError === void 0) releaseError = error;
1242
+ };
1243
+ self._lifecycle.activated = false;
1244
+ for (const u of self._dep.unsubs) {
1245
+ try {
1246
+ u();
1247
+ } catch (error) {
1248
+ recordReleaseError(error);
1249
+ }
1250
+ }
1251
+ for (const fn of self._hooks.onDeactivation) {
1252
+ try {
1253
+ fn();
1254
+ } catch (error) {
1255
+ recordReleaseError(error);
1256
+ }
1257
+ }
1258
+ self._dep.unsubs = [];
1259
+ self._dep.idxBoxes = [];
1260
+ self._lifecycle.subscribers.clear();
1261
+ if (self._slot.handle !== null) {
1262
+ self._slot.dispatcher.unregister(self._slot.handle);
1263
+ self._slot.handle = null;
1264
+ }
1265
+ self._slot.deps = [];
1266
+ self._dep.batch = [];
1267
+ self._dep.waveData = [];
1268
+ self._dep.waveTokens = [];
1269
+ self._dep.prev = [];
1270
+ self._dep.hasData = [];
1271
+ self._dep.dirty = [];
1272
+ self._dep.tier = [];
1273
+ self._dep.terminal = [];
1274
+ self._dep.terminalInput = [];
1275
+ self._value.cache = SENTINEL;
1276
+ self._value.hasData = false;
1277
+ self._value.status = "sentinel";
1278
+ self._value.terminal = void 0;
1279
+ self._value.replayRing = [];
1280
+ self._privateState.value = SENTINEL;
1281
+ self._privateState.persist = false;
1282
+ self._syncCtx = null;
1283
+ self._resetDepState();
1284
+ self._hooks.onDeactivation = [];
1285
+ self._hooks.onInvalidate = [];
1286
+ self._control.pauseLockset.clear();
1287
+ self._control.pauseBuffer = [];
1288
+ self._control.pausedDepWaveOccurred = false;
1289
+ self._control.demandOwed = void 0;
1290
+ self._control.activePull = void 0;
1291
+ self._control.pullDirtyOwed = false;
1292
+ self._restoredActivationPending = false;
1293
+ checkpointReaders.delete(node2);
1294
+ restoreWriters.delete(node2);
1295
+ runtimeReleasers.delete(node2);
1296
+ runtimeQuiescenceReaders.delete(node2);
1297
+ subscriberCountReaders.delete(node2);
1298
+ activationReaders.delete(node2);
1299
+ ownerTokens.delete(node2);
1300
+ topologyDepsChangedObservers.delete(node2);
1301
+ self._core.releaseSlot(self._id);
1302
+ if (releaseError !== void 0) throw releaseError;
1303
+ }
1304
+ function nodeResetDepState(self) {
1305
+ const n = self._slot.deps.length;
1306
+ for (let i = 0; i < n; i++) {
1307
+ self._dep.batch[i] = null;
1308
+ self._dep.waveData[i] = [];
1309
+ self._dep.waveTokens[i] = void 0;
1310
+ self._dep.prev[i] = SENTINEL;
1311
+ self._dep.hasData[i] = false;
1312
+ self._dep.dirty[i] = false;
1313
+ self._dep.tier[i] = 0;
1314
+ self._dep.terminal[i] = void 0;
1315
+ self._dep.terminalInput[i] = void 0;
1316
+ }
1317
+ self._wave.pending = 0;
1318
+ self._wave.emittedDirtyThisWave = false;
1319
+ }
1320
+
1321
+ // src/node/node-output-runtime.ts
1322
+ function nodeDown(self, msgs) {
1323
+ if (self._released) return;
1324
+ validateDownPayloads(msgs);
1325
+ const deliveryWave = {};
1326
+ const assertVersionDataCompatible = (wave) => {
1327
+ for (const m of wave) {
1328
+ if (m[0] === "DATA") assertNodeVersionDataCompatible(self._version.policy, m[1]);
1329
+ }
1330
+ };
1331
+ const snapshotVersionData = (wave) => wave.map(
1332
+ (m) => m[0] === "DATA" ? ["DATA", snapshotNodeVersionData(self._version.policy, m[1])] : m
1333
+ );
1334
+ assertVersionDataCompatible(msgs);
1335
+ if (self._value.terminal !== void 0) {
1336
+ if (!msgs.some((m) => m[0] === "TEARDOWN")) return;
1337
+ self._value.hasTorndown = true;
1338
+ if (self._slot.resetOnTeardown) {
1339
+ self._value.cache = SENTINEL;
1340
+ self._value.hasData = false;
1341
+ }
1342
+ self._emitToSubs(["TEARDOWN"], { wave: deliveryWave, last: true });
1343
+ return;
1344
+ }
1345
+ let sorted = [...msgs].sort((a, b) => messageTier(a[0]) - messageTier(b[0]));
1346
+ const firstInvalidate = sorted.findIndex((m) => m[0] === "INVALIDATE");
1347
+ if (firstInvalidate !== -1) {
1348
+ sorted = sorted.filter((m, i) => m[0] !== "INVALIDATE" || i === firstInvalidate);
1349
+ }
1350
+ const hasTeardown = sorted.some((m) => m[0] === "TEARDOWN");
1351
+ const hasTerminal = sorted.some((m) => m[0] === "COMPLETE" || m[0] === "ERROR");
1352
+ if (hasTeardown && !hasTerminal && self._value.terminal === void 0 && !self._value.hasTorndown) {
1353
+ sorted = [["COMPLETE"], ...sorted];
1354
+ }
1355
+ if (!self._wave.insideRunWave && currentBatch()) {
1356
+ const deferred = snapshotVersionData(sorted.filter((m) => isDeferredTier(m[0])));
1357
+ if (deferred.length > 0) {
1358
+ if (!self._wave.emittedDirtyThisWave) {
1359
+ self._wave.emittedDirtyThisWave = true;
1360
+ self._value.status = "dirty";
1361
+ self._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
1362
+ }
1363
+ self._wave.batchDirtyOwed = true;
1364
+ deferToBatch(self, deferred);
1365
+ return;
1366
+ }
1367
+ }
1368
+ if (self._shouldBufferOnPause()) {
1369
+ const buffered = snapshotVersionData(sorted.filter((m) => isPauseBufferedTier(m[0])));
1370
+ if (buffered.length > 0) {
1371
+ self._wave.emittedSettleThisWave = true;
1372
+ self._control.pauseBuffer.push(buffered);
1373
+ }
1374
+ sorted = sorted.filter((m) => !isPauseBufferedTier(m[0]));
1375
+ if (sorted.length === 0) return;
1376
+ }
1377
+ let dataCount = 0;
1378
+ let hasTier3 = false;
1379
+ let hasResolved = false;
1380
+ for (const m of sorted) {
1381
+ if (m[0] === "DATA") dataCount++;
1382
+ if (m[0] === "RESOLVED") hasResolved = true;
1383
+ if (isValueTier(m[0])) hasTier3 = true;
1384
+ }
1385
+ if (dataCount >= 1 && hasResolved) {
1386
+ throw new Error(
1387
+ "down: a wave cannot mix DATA and RESOLVED (tier-3 exclusivity, R-resolved-undirty)"
1388
+ );
1389
+ }
1390
+ const plannedVersions = new Array(sorted.length);
1391
+ if (dataCount > 0) {
1392
+ let plannedVersion = self._version.value;
1393
+ for (let i = 0; i < sorted.length; i++) {
1394
+ const m = sorted[i];
1395
+ if (m[0] !== "DATA") continue;
1396
+ plannedVersion = advanceNodeVersion(plannedVersion, self._version.policy, m[1]);
1397
+ plannedVersions[i] = plannedVersion;
1398
+ }
1399
+ }
1400
+ if (hasTier3 && (!self._wave.insideRunWave || self._control.pullDirtyOwed) && !self._wave.emittedDirtyThisWave) {
1401
+ self._wave.emittedDirtyThisWave = true;
1402
+ self._value.status = "dirty";
1403
+ self._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
1404
+ }
1405
+ for (let i = 0; i < sorted.length; i++) {
1406
+ const m = sorted[i];
1407
+ const delivery = { wave: deliveryWave, last: i === sorted.length - 1 };
1408
+ if (isDeferredTier(m[0])) self._wave.emittedSettleThisWave = true;
1409
+ if (m[0] === "DIRTY") {
1410
+ if (!self._wave.emittedDirtyThisWave) {
1411
+ self._wave.emittedDirtyThisWave = true;
1412
+ self._value.status = "dirty";
1413
+ self._emitToSubs(["DIRTY"], delivery);
1414
+ }
1415
+ continue;
1416
+ }
1417
+ if (m[0] === "DATA") {
1418
+ const v = m[1];
1419
+ self._value.cache = v;
1420
+ self._value.hasData = true;
1421
+ self._value.status = "settled";
1422
+ self._version.value = plannedVersions[i];
1423
+ if (self._slot.replayN > 0) {
1424
+ self._value.replayRing.push(v);
1425
+ if (self._value.replayRing.length > self._slot.replayN) self._value.replayRing.shift();
1426
+ }
1427
+ self._emitToSubs(["DATA", v], delivery);
1428
+ continue;
1429
+ }
1430
+ if (m[0] === "RESOLVED") {
1431
+ self._value.status = self._value.hasData ? "resolved" : "sentinel";
1432
+ self._emitToSubs(["RESOLVED"], delivery);
1433
+ continue;
1434
+ }
1435
+ if (m[0] === "INVALIDATE") {
1436
+ self._invalidate(delivery);
1437
+ continue;
1438
+ }
1439
+ if (m[0] === "COMPLETE") {
1440
+ if (self._value.terminal !== void 0) continue;
1441
+ self._value.terminal = true;
1442
+ self._control.pauseBuffer = [];
1443
+ self._value.status = "completed";
1444
+ self._emitToSubs(["COMPLETE"], delivery);
1445
+ continue;
1446
+ }
1447
+ if (m[0] === "ERROR") {
1448
+ if (self._value.terminal !== void 0) continue;
1449
+ self._value.terminal = m[1];
1450
+ self._control.pauseBuffer = [];
1451
+ self._value.status = "errored";
1452
+ self._emitToSubs(["ERROR", m[1]], delivery);
1453
+ continue;
1454
+ }
1455
+ if (m[0] === "TEARDOWN") {
1456
+ self._value.hasTorndown = true;
1457
+ if (self._slot.resetOnTeardown) {
1458
+ self._value.cache = SENTINEL;
1459
+ self._value.hasData = false;
1460
+ }
1461
+ self._emitToSubs(["TEARDOWN"], delivery);
1462
+ }
1463
+ }
1464
+ if (!self._wave.insideRunWave) self._wave.emittedDirtyThisWave = false;
1465
+ }
1466
+ function nodeUp(self, msgs, towardDep, route) {
1467
+ if (self._released) return;
1468
+ const routeState = route ?? { demandFired: /* @__PURE__ */ new Map() };
805
1469
  for (const m of msgs) {
806
- if (m[0] === "DATA" && m[1] === void 0) {
807
- throw new Error("down: DATA requires a non-SENTINEL payload (R-data-payload)");
1470
+ if (!isUpAllowed(m[0])) {
1471
+ throw new Error(
1472
+ `ctx.up: ${m[0]} is down-only (tier ${messageTier(m[0])}); up carries control tiers only (R-ctx-up)`
1473
+ );
808
1474
  }
809
- if (m[0] === "ERROR" && isInvalidErrorPayload(m[1])) {
810
- throw new Error("down: ERROR requires a non-SENTINEL, non-boolean payload (R-data-payload)");
1475
+ }
1476
+ for (const m of msgs) {
1477
+ if (m[0] === "PAUSE") {
1478
+ self._pauseAcquire(m[1]);
1479
+ } else if (m[0] === "RESUME") {
1480
+ if (self._control.pauseLockset.has(m[1])) {
1481
+ self._pauseRelease(m[1]);
1482
+ } else {
1483
+ self._forwardUp(m, towardDep, routeState);
1484
+ }
1485
+ } else if (m[0] === "PULL") {
1486
+ const demand = normalizePullDemand(m[1]);
1487
+ if (self._slot.pull && demand.pullId === self._slot.pullLock) {
1488
+ if (!self._markDemandRouted(demand.pullId, routeState)) self._onDemand(demand);
1489
+ } else {
1490
+ self._forwardUp(["PULL", demand], towardDep, routeState);
1491
+ }
1492
+ } else if (self._slot.deps.length === 0) {
1493
+ if (m[0] === "INVALIDATE") self._down([["INVALIDATE"]]);
1494
+ } else {
1495
+ self._forwardUp(m, towardDep, routeState);
1496
+ }
1497
+ }
1498
+ }
1499
+ function nodeMarkDemandRouted(self, lockId, route) {
1500
+ let holders = route.demandFired.get(lockId);
1501
+ if (holders === void 0) {
1502
+ holders = /* @__PURE__ */ new Set();
1503
+ route.demandFired.set(lockId, holders);
1504
+ }
1505
+ const node2 = self;
1506
+ if (holders.has(node2)) return true;
1507
+ holders.add(node2);
1508
+ return false;
1509
+ }
1510
+ function nodeForwardUp(self, m, towardDep, route) {
1511
+ if (self._slot.deps.length === 0) return;
1512
+ if (towardDep !== void 0) {
1513
+ const d = self._slot.deps[towardDep];
1514
+ if (d !== void 0) nodeRuntimeHost(d)._up([m], void 0, route);
1515
+ } else {
1516
+ for (const dep of self._slot.deps) nodeRuntimeHost(dep)._up([m], void 0, route);
1517
+ }
1518
+ }
1519
+ function nodeIsPaused(self) {
1520
+ return self._control.pauseLockset.size > 0;
1521
+ }
1522
+ function nodeHasBoundaryPauseLock(self) {
1523
+ if (self._slot.pausable === false) return false;
1524
+ return self._control.pauseLockset.size > 0;
1525
+ }
1526
+ function nodeIsAsyncPool(self) {
1527
+ return self._slot.handle !== null && self._slot.dispatcher.poolKind(self._slot.handle.poolId) === "async";
1528
+ }
1529
+ function nodePauseAcquire(self, lockId) {
1530
+ self._control.pauseLockset.add(lockId);
1531
+ }
1532
+ function nodePauseRelease(self, lockId) {
1533
+ if (!self._control.pauseLockset.has(lockId)) return;
1534
+ self._control.pauseLockset.delete(lockId);
1535
+ if (self._slot.pull && self._control.demandOwed !== void 0) self._fireOwedDemandIfReady();
1536
+ if (self._hasBoundaryPauseLock()) return;
1537
+ scheduleBoundaryDrain(self._core);
1538
+ if (self._slot.pull) return;
1539
+ self._onResume();
1540
+ }
1541
+ function nodeOnResume(self) {
1542
+ if (self._value.terminal !== void 0) {
1543
+ self._control.pauseBuffer = [];
1544
+ self._control.pausedDepWaveOccurred = false;
1545
+ self._control.demandOwed = void 0;
1546
+ self._control.activePull = void 0;
1547
+ self._control.pullDirtyOwed = false;
1548
+ return;
1549
+ }
1550
+ if (self._control.pauseBuffer.length > 0) {
1551
+ const buf = self._control.pauseBuffer;
1552
+ self._control.pauseBuffer = [];
1553
+ for (const wave of buf) self._down(wave);
1554
+ }
1555
+ if (self._control.pausedDepWaveOccurred) {
1556
+ self._control.pausedDepWaveOccurred = false;
1557
+ self._tryRun();
1558
+ }
1559
+ }
1560
+ function nodeCanFireDemand(self) {
1561
+ if (self._value.terminal !== void 0 || self._wave.pending > 0) return false;
1562
+ return self._control.pauseLockset.size === 0;
1563
+ }
1564
+ function nodeDeliverPullDemand(self, demand) {
1565
+ self._control.demandOwed = void 0;
1566
+ self._control.activePull = demand;
1567
+ self._control.inDeliverDemand = true;
1568
+ try {
1569
+ self._firePullDemand();
1570
+ } finally {
1571
+ self._control.activePull = void 0;
1572
+ self._control.inDeliverDemand = false;
1573
+ }
1574
+ }
1575
+ function nodeOnDemand(self, demand) {
1576
+ if (self._control.inDeliverDemand) return;
1577
+ if (self._canFireDemand()) self._deliverPullDemand(demand);
1578
+ else self._control.demandOwed = demand;
1579
+ }
1580
+ function nodeFirePullDemand(self) {
1581
+ let drainedBuffer = false;
1582
+ if (self._control.pauseBuffer.length > 0) {
1583
+ const buf = self._control.pauseBuffer;
1584
+ self._control.pauseBuffer = [];
1585
+ for (const wave of buf) self._down(wave);
1586
+ drainedBuffer = true;
1587
+ }
1588
+ if (drainedBuffer) return;
1589
+ if (self._control.pausedDepWaveOccurred) {
1590
+ const gated = self._slot.handle !== null && !self._wave.hasCalledFnOnce && !(self._slot.partial || self._allDepsSettled());
1591
+ if (self._wave.pending > 0 || gated) return;
1592
+ self._control.pausedDepWaveOccurred = false;
1593
+ self._wave.emittedDirtyThisWave = false;
1594
+ self._control.pullDirtyOwed = true;
1595
+ try {
1596
+ self._tryRun();
1597
+ } finally {
1598
+ self._control.pullDirtyOwed = false;
1599
+ }
1600
+ return;
1601
+ }
1602
+ if (self._slot.handle !== null) {
1603
+ if (!self._wave.hasCalledFnOnce && !(self._slot.partial || self._allDepsSettled())) return;
1604
+ self._wave.emittedDirtyThisWave = false;
1605
+ self._control.pullDirtyOwed = true;
1606
+ try {
1607
+ self._runWave();
1608
+ } finally {
1609
+ self._control.pullDirtyOwed = false;
811
1610
  }
812
1611
  }
813
1612
  }
814
- var Node = class {
1613
+ function nodeFireOwedDemandIfReady(self) {
1614
+ if (self._control.inDeliverDemand) return;
1615
+ if (self._slot.pull && self._control.demandOwed !== void 0 && self._canFireDemand()) {
1616
+ self._deliverPullDemand(self._control.demandOwed);
1617
+ }
1618
+ }
1619
+ function nodeShouldBufferOnPause(self) {
1620
+ if (self._slot.pausable === false) return false;
1621
+ if (!self._isPaused() && !self._isPullQuiet()) return false;
1622
+ if (self._slot.pausable === "resumeAll") return true;
1623
+ if (!self._wave.insideRunWave && self._isAsyncPool() && self._slot.deps.length > 0) return true;
1624
+ return false;
1625
+ }
1626
+ function nodeInvalidate(self, delivery) {
1627
+ if (!self._value.hasData) return;
1628
+ self._value.cache = SENTINEL;
1629
+ self._value.hasData = false;
1630
+ self._value.status = "sentinel";
1631
+ self._value.replayRing = [];
1632
+ for (const fn of self._hooks.onInvalidate) fn();
1633
+ self._emitToSubs(["INVALIDATE"], delivery);
1634
+ }
1635
+ function nodeAllDepsTerminal(self) {
1636
+ if (self._slot.deps.length === 0) return false;
1637
+ for (const tm of self._dep.terminal) if (tm === void 0) return false;
1638
+ return true;
1639
+ }
1640
+ function nodeResetLifecycle(self) {
1641
+ for (const u of self._dep.unsubs) if (u) u();
1642
+ self._dep.unsubs = [];
1643
+ self._dep.idxBoxes = [];
1644
+ self._lifecycle.subscribers.clear();
1645
+ self._lifecycle.activated = false;
1646
+ self._value.terminal = void 0;
1647
+ self._value.hasTorndown = false;
1648
+ self._wave.hasCalledFnOnce = false;
1649
+ self._resetDepState();
1650
+ self._control.pauseLockset.clear();
1651
+ self._control.pauseBuffer = [];
1652
+ self._control.pausedDepWaveOccurred = false;
1653
+ self._control.demandOwed = void 0;
1654
+ self._control.activePull = void 0;
1655
+ self._control.pullDirtyOwed = false;
1656
+ self._value.replayRing = [];
1657
+ const isCompute = self._slot.handle !== null || self._slot.deps.length > 0;
1658
+ if (isCompute) {
1659
+ self._value.cache = SENTINEL;
1660
+ self._value.hasData = false;
1661
+ self._value.status = "sentinel";
1662
+ } else {
1663
+ self._value.status = self._value.hasData ? "settled" : "sentinel";
1664
+ }
1665
+ if (!self._privateState.persist) self._privateState.value = SENTINEL;
1666
+ }
1667
+ function nodeEmitToSubs(self, msg, delivery) {
1668
+ if (self._released) return;
1669
+ const subs = [...self._lifecycle.subscribers];
1670
+ for (const sink of subs) sink(msg, delivery);
1671
+ }
1672
+ function nodeCommitBatchedWave(self, wave) {
1673
+ self._wave.batchDirtyOwed = false;
1674
+ self._down(wave);
1675
+ }
1676
+ function nodeRollbackBatched(self) {
1677
+ if (self._wave.batchDirtyOwed) {
1678
+ self._wave.batchDirtyOwed = false;
1679
+ self._wave.emittedDirtyThisWave = false;
1680
+ self._value.status = self._value.hasData ? "settled" : "sentinel";
1681
+ self._emitToSubs(["RESOLVED"]);
1682
+ }
1683
+ }
1684
+ function nodeDeferBoundary(self, fn, batchToken) {
1685
+ deferRewire(self._core, fn, {
1686
+ batchToken,
1687
+ isReady: () => !self._hasBoundaryPauseLock()
1688
+ });
1689
+ }
1690
+
1691
+ // src/node/node-rewire-runtime.ts
1692
+ function nodeRequestRewireNext(self, op) {
1693
+ deferRewire(self._core, () => self._applyRewireNext(op), {
1694
+ batchToken: currentBoundaryBatchToken(),
1695
+ isReady: () => !self._hasBoundaryPauseLock()
1696
+ });
1697
+ }
1698
+ function nodeRequestUpNext(self, msgs, towardDep) {
1699
+ deferRewire(
1700
+ self._core,
1701
+ () => {
1702
+ if (!self._released) self._up(msgs, towardDep);
1703
+ },
1704
+ {
1705
+ batchToken: currentBoundaryBatchToken(),
1706
+ isReady: () => !self._hasBoundaryPauseLock()
1707
+ }
1708
+ );
1709
+ }
1710
+ function nodeApplyRewireNext(self, op) {
1711
+ if (self._released) return;
1712
+ try {
1713
+ if (op.kind === "add") {
1714
+ const next = self._slot.deps.includes(op.dep) ? [...self._slot.deps] : [...self._slot.deps, op.dep];
1715
+ self._rewire(next, op.fn, { allowTerminalOwner: true });
1716
+ } else if (op.kind === "remove") {
1717
+ self._rewire(
1718
+ self._slot.deps.filter((d) => d !== op.dep),
1719
+ op.fn,
1720
+ { allowTerminalOwner: true }
1721
+ );
1722
+ } else {
1723
+ self._rewire(self._dedupDeps(op.deps), op.fn, { allowTerminalOwner: true });
1724
+ }
1725
+ } catch (e) {
1726
+ self._down([["ERROR", errorPayload(e, "rewireNext op failed")]]);
1727
+ }
1728
+ }
1729
+ function nodeRewire(self, newDeps, fn, opts = {}) {
1730
+ const node2 = self;
1731
+ if (self._value.terminal !== void 0 && !opts.allowTerminalOwner)
1732
+ throw new Error(
1733
+ "rewire: node is terminal (completed/errored) \u2014 cannot rewire (R-rewire / D42)"
1734
+ );
1735
+ if (self._wave.insideRunWave)
1736
+ throw new Error(
1737
+ "rewire: mid-fn topology mutation \u2014 a fn mutating its own deps mid-wave is the feedback cycle (R-rewire / D37)"
1738
+ );
1739
+ if (self._wave.inDepMutation)
1740
+ throw new Error(
1741
+ "rewire: reentrant dep mutation \u2014 another replaceDeps/subscribeDep/unsubscribeDep is in flight (R-rewire)"
1742
+ );
1743
+ if (newDeps.includes(node2)) throw new Error("rewire: self-dependency rejected (R-rewire / D42)");
1744
+ const oldDeps = self._slot.deps;
1745
+ const added = newDeps.filter((d) => !oldDeps.includes(d));
1746
+ for (const d of added) {
1747
+ if (self._reachableUpstream(d, node2))
1748
+ throw new Error(
1749
+ "rewire: would create a cycle \u2014 dep already transitively depends on this node (R-rewire / D42)"
1750
+ );
1751
+ const dep = nodeRuntimeHost(d);
1752
+ if (dep._value.terminal !== void 0 && !dep._slot.resubscribable)
1753
+ throw new Error(
1754
+ "rewire: cannot add a non-resubscribable terminal dep \u2014 would wedge (R-rewire / D42)"
1755
+ );
1756
+ self._assertRewireDepOwner(d);
1757
+ }
1758
+ if (deferAfterBatchForTarget(node2, () => {
1759
+ self._rewire(newDeps, fn, { ...opts, allowTerminalOwner: true });
1760
+ })) {
1761
+ return true;
1762
+ }
1763
+ if (!self._lifecycle.activated) self._restoredActivationPending = false;
1764
+ self._wave.inDepMutation = true;
1765
+ self._wave.rewireRunPending = false;
1766
+ let zeroDepUnDirty = false;
1767
+ try {
1768
+ const oldHandle = self._slot.handle;
1769
+ self._slot.handle = self._slot.dispatcher.register(fn, self._slot.pool);
1770
+ if (oldHandle !== null) self._slot.dispatcher.unregister(oldHandle);
1771
+ const removed = oldDeps.filter((d) => !newDeps.includes(d));
1772
+ let removedDirtyContributor = false;
1773
+ for (const d of removed) {
1774
+ const oldIdx = oldDeps.indexOf(d);
1775
+ if (self._dep.dirty[oldIdx]) {
1776
+ removedDirtyContributor = true;
1777
+ self._wave.pending--;
1778
+ }
1779
+ if (self._lifecycle.activated) {
1780
+ const box = self._dep.idxBoxes[oldIdx];
1781
+ if (box) box.v = -1;
1782
+ const unsub = self._dep.unsubs[oldIdx];
1783
+ if (unsub) unsub();
1784
+ }
1785
+ }
1786
+ const n = newDeps.length;
1787
+ const newBatch = new Array(n).fill(null);
1788
+ const newPrev = new Array(n).fill(SENTINEL);
1789
+ const newHasData = new Array(n).fill(false);
1790
+ const newDirty = new Array(n).fill(false);
1791
+ const newTier = new Array(n).fill(0);
1792
+ const newTerminal = new Array(n).fill(void 0);
1793
+ const newTerminalInput = new Array(n).fill(void 0);
1794
+ const newUnsubs = new Array(n);
1795
+ const newBoxes = new Array(n);
1796
+ for (let j = 0; j < n; j++) {
1797
+ const oldIdx = oldDeps.indexOf(newDeps[j]);
1798
+ if (oldIdx !== -1) {
1799
+ newBatch[j] = self._dep.batch[oldIdx];
1800
+ newPrev[j] = self._dep.prev[oldIdx];
1801
+ newHasData[j] = self._dep.hasData[oldIdx];
1802
+ newDirty[j] = self._dep.dirty[oldIdx];
1803
+ newTier[j] = self._dep.tier[oldIdx];
1804
+ newTerminal[j] = self._dep.terminal[oldIdx];
1805
+ newUnsubs[j] = self._dep.unsubs[oldIdx];
1806
+ const box = self._dep.idxBoxes[oldIdx];
1807
+ if (box) box.v = j;
1808
+ newBoxes[j] = box;
1809
+ }
1810
+ }
1811
+ self._slot.deps = newDeps;
1812
+ self._dep.batch = newBatch;
1813
+ self._dep.prev = newPrev;
1814
+ self._dep.hasData = newHasData;
1815
+ self._dep.dirty = newDirty;
1816
+ self._dep.tier = newTier;
1817
+ self._dep.terminal = newTerminal;
1818
+ self._dep.terminalInput = newTerminalInput;
1819
+ self._dep.unsubs = newUnsubs;
1820
+ self._dep.idxBoxes = newBoxes;
1821
+ self._dep.waveData = newDeps.map(() => []);
1822
+ self._dep.waveTokens = new Array(newDeps.length).fill(void 0);
1823
+ self._syncCtx = null;
1824
+ if (self._lifecycle.activated) {
1825
+ for (const d of added) self._subscribeDepAt(d);
1826
+ }
1827
+ notifyTopologyDepsChanged(node2, oldDeps, newDeps);
1828
+ if (removedDirtyContributor && self._wave.pending === 0 && self._value.status === "dirty") {
1829
+ if (newDeps.length > 0) self._wave.rewireRunPending = true;
1830
+ else zeroDepUnDirty = true;
1831
+ }
1832
+ } finally {
1833
+ self._wave.inDepMutation = false;
1834
+ }
1835
+ if (self._wave.rewireRunPending) {
1836
+ self._wave.rewireRunPending = false;
1837
+ self._settleRewire();
1838
+ } else if (zeroDepUnDirty) {
1839
+ if (self._wave.emittedDirtyThisWave) self._down([["RESOLVED"]]);
1840
+ else self._value.status = self._value.hasData ? "settled" : "sentinel";
1841
+ }
1842
+ return false;
1843
+ }
1844
+
1845
+ // src/node/node.ts
1846
+ var Node = class _Node {
815
1847
  _core;
816
1848
  _id;
817
1849
  _slot;
@@ -832,19 +1864,63 @@ var Node = class {
832
1864
  set _syncCtx(ctx) {
833
1865
  this._syncCtxState.value = ctx;
834
1866
  }
1867
+ static _retainIndirectRuntimeMethods(node2) {
1868
+ void node2._dep;
1869
+ void node2._hooks;
1870
+ void node2._restoredActivationPending;
1871
+ void node2._requestRewireNext;
1872
+ void node2._requestUpNext;
1873
+ void node2._applyRewireNext;
1874
+ void node2._reachableUpstream;
1875
+ void node2._assertRewireDepOwner;
1876
+ void node2._subscribeDepAt;
1877
+ void node2._seedRestoredDepAt;
1878
+ void node2._recordDepProjection;
1879
+ void node2._depProjectionHasData;
1880
+ void node2._receiveFromDep;
1881
+ void node2._releaseDepDirty;
1882
+ void node2._settleAfterAbsorbedTerminal;
1883
+ void node2._markDirty;
1884
+ void node2._maybeRun;
1885
+ void node2._settleRewire;
1886
+ void node2._tryRun;
1887
+ void node2._allDepsSettled;
1888
+ void node2._passthroughEmit;
1889
+ void node2._runWave;
1890
+ void node2._buildCtx;
1891
+ void node2._makeCtx;
1892
+ void node2._refreshCtx;
1893
+ void node2._makeState;
1894
+ void node2._markDemandRouted;
1895
+ void node2._forwardUp;
1896
+ void node2._isPullQuiet;
1897
+ void node2._isPaused;
1898
+ void node2._hasBoundaryPauseLock;
1899
+ void node2._isAsyncPool;
1900
+ void node2._pauseAcquire;
1901
+ void node2._pauseRelease;
1902
+ void node2._onResume;
1903
+ void node2._canFireDemand;
1904
+ void node2._deliverPullDemand;
1905
+ void node2._onDemand;
1906
+ void node2._firePullDemand;
1907
+ void node2._fireOwedDemandIfReady;
1908
+ void node2._shouldBufferOnPause;
1909
+ void node2._invalidate;
1910
+ void node2._allDepsTerminal;
1911
+ void node2._emitToSubs;
1912
+ }
835
1913
  constructor(deps, handleOrFn, opts = {}) {
836
- const core = constructingCore;
837
- constructingCore = void 0;
1914
+ const core = takeConstructingNodeCore();
838
1915
  const dispatcher = opts.dispatcher ?? defaultDispatcher;
839
- const environment = constructingEnvironment ?? EnvironmentDrivers.empty();
840
- constructingEnvironment = void 0;
1916
+ const environment = takeConstructingEnvironmentDrivers() ?? EnvironmentDrivers.empty();
841
1917
  const pool = opts.pool ?? "sync";
842
1918
  const pausable = opts.pausable ?? true;
843
1919
  const pullLock = opts.pullId;
844
1920
  const pull = opts.pullId !== void 0;
845
1921
  if (pull && pausable === false)
846
1922
  throw new Error(
847
- "node: pullId is incompatible with pausable:false \u2014 a pull node is demanded via RESUME, which pausable:false ignores (R-pull / R-pause-modes / D55,D59)"
1923
+ "node: pullId is incompatible with pausable:false \u2014 a pull node uses the pausable delivery-content axis (R-pull / R-pause-modes / D55,D269)"
848
1924
  );
849
1925
  let handle;
850
1926
  if (handleOrFn === null) handle = null;
@@ -867,7 +1943,6 @@ var Node = class {
867
1943
  value.status = "settled";
868
1944
  }
869
1945
  const pauseLockset = /* @__PURE__ */ new Set();
870
- if (pull) pauseLockset.add(pullLock);
871
1946
  this._core = core ?? new NodeCore();
872
1947
  const created = this._core.createSlot(
873
1948
  {
@@ -908,7 +1983,9 @@ var Node = class {
908
1983
  pauseLockset,
909
1984
  pausedDepWaveOccurred: false,
910
1985
  pauseBuffer: [],
911
- demandOwed: false,
1986
+ demandOwed: void 0,
1987
+ activePull: void 0,
1988
+ pullDirtyOwed: false,
912
1989
  inDeliverDemand: false
913
1990
  },
914
1991
  privateState: { value: SENTINEL, persist: false },
@@ -965,10 +2042,11 @@ var Node = class {
965
2042
  this._wave.batchDirtyOwed = false;
966
2043
  this._control.pauseBuffer = [];
967
2044
  this._control.pausedDepWaveOccurred = false;
968
- this._control.demandOwed = false;
2045
+ this._control.demandOwed = void 0;
2046
+ this._control.activePull = void 0;
2047
+ this._control.pullDirtyOwed = false;
969
2048
  this._control.inDeliverDemand = false;
970
2049
  this._control.pauseLockset.clear();
971
- if (this._slot.pull) this._control.pauseLockset.add(this._slot.pullLock);
972
2050
  this._privateState.value = state.ctxState.value;
973
2051
  this._privateState.persist = state.ctxState.persist;
974
2052
  if (state.version === false) {
@@ -1006,18 +2084,18 @@ var Node = class {
1006
2084
  runtimeQuiescenceReaders.set(this, () => this._isRuntimeQuiescentForRelease());
1007
2085
  subscriberCountReaders.set(this, () => this._subscriberCount());
1008
2086
  activationReaders.set(this, () => this._lifecycle.activated);
2087
+ _Node._retainIndirectRuntimeMethods(this);
1009
2088
  }
1010
- /** R-pull (D55): true while a pull node is quiet (holds its own pullId/demand lock). */
2089
+ /** R-pull (D55/D272): true while a pull node is not serving a PULL demand pulse. */
1011
2090
  _isPullQuiet() {
1012
- return this._slot.pull && this._control.pauseLockset.has(this._slot.pullLock);
2091
+ return this._slot.pull && this._control.activePull === void 0;
1013
2092
  }
1014
2093
  /**
1015
- * R-pull (D55/D59): this pull node's pullId (pure data, like {@link cache}/{@link handle} — never
1016
- * triggers computation). A consumer demands one delivery by cone-routing a RESUME of it (no node
1017
- * reference): `ctx.up([["RESUME", pullId]])` (immediate; loops back → D37 for a self-read dep) or
1018
- * `ctx.upNext([["RESUME", pullId]])` (boundary-deferred self-demand, R-up-routing/R-rewire-deferred).
1019
- * Undefined for a non-pull node. The author writes the pullId verbatim, so this getter is mainly
1020
- * for inspection/describe; routing matches by the pullId value carried in the RESUME, by identity.
2094
+ * R-pull (D269/D272): this pull node's pullId (pure data, like {@link cache}/{@link handle} —
2095
+ * never triggers computation). A consumer demands one delivery by cone-routing PULL of it (no
2096
+ * node reference): `ctx.up([["PULL", { pullId }]])` (immediate; loops back → D37 for a self-read
2097
+ * dep) or `ctx.upNext([["PULL", { pullId }]])` (boundary-deferred self-demand). Undefined for a
2098
+ * non-pull node. The author writes the pullId verbatim; routing matches by identity.
1021
2099
  */
1022
2100
  get pullId() {
1023
2101
  return this._slot.pullLock;
@@ -1111,58 +2189,6 @@ var Node = class {
1111
2189
  exitWave();
1112
2190
  }
1113
2191
  }
1114
- // ── deferred self-rewire (R-rewire-deferred / D47): ctx.rewireNext drain support ──
1115
- /**
1116
- * Enqueue a deferred self-rewire op (issued from this node's fn via `ctx.rewireNext`).
1117
- * Applied at the committed wave boundary (boundary.ts drain), never in place — the in-fn
1118
- * immediate path (`subscribeDep`/`replaceDeps`/`unsubscribeDep`) still throws mid-run (D37/R-reentrancy).
1119
- */
1120
- _requestRewireNext(op) {
1121
- deferRewire(this._core, () => this._applyRewireNext(op), {
1122
- batchToken: currentBoundaryBatchToken(),
1123
- isReady: () => !this._hasBoundaryPauseLock()
1124
- });
1125
- }
1126
- /**
1127
- * Enqueue a deferred up-going control wave (R-up-routing / R-pull / D59): at the committed wave
1128
- * boundary, route `msgs` up from THIS node (broadcast, or up the single `towardDep` edge). The
1129
- * deferred form of `ctx.up` — the SELF-demand path: a consumer issues `ctx.upNext([[RESUME,
1130
- * pullId]])` to demand a dep it ALSO reads; the demand applies at the boundary (not mid-fn), so
1131
- * the pull node's delivery loops back as a FRESH wave rather than re-entering the consumer (D37 /
1132
- * R-reentrancy). Rides the same R-rewire-deferred (D47) drain as ctx.rewireNext.
1133
- */
1134
- _requestUpNext(msgs, towardDep) {
1135
- deferRewire(
1136
- this._core,
1137
- () => {
1138
- if (!this._released) this._up(msgs, towardDep);
1139
- },
1140
- {
1141
- batchToken: currentBoundaryBatchToken(),
1142
- isReady: () => !this._hasBoundaryPauseLock()
1143
- }
1144
- );
1145
- }
1146
- /** Apply one queued self-rewire at the boundary (drain thunk). */
1147
- _applyRewireNext(op) {
1148
- if (this._released) return;
1149
- try {
1150
- if (op.kind === "add") {
1151
- const next = this._slot.deps.includes(op.dep) ? [...this._slot.deps] : [...this._slot.deps, op.dep];
1152
- this._rewire(next, op.fn, { allowTerminalOwner: true });
1153
- } else if (op.kind === "remove") {
1154
- this._rewire(
1155
- this._slot.deps.filter((d) => d !== op.dep),
1156
- op.fn,
1157
- { allowTerminalOwner: true }
1158
- );
1159
- } else {
1160
- this._rewire(this._dedupDeps(op.deps), op.fn, { allowTerminalOwner: true });
1161
- }
1162
- } catch (e) {
1163
- this._down([["ERROR", errorPayload(e, "rewireNext op failed")]]);
1164
- }
1165
- }
1166
2192
  // ── rewire (R-rewire / D42): intra-graph runtime topology mutation ──
1167
2193
  /**
1168
2194
  * Replace this node's deps atomically (surgical, Option-C). Requires an explicit
@@ -1190,6 +2216,15 @@ var Node = class {
1190
2216
  fn
1191
2217
  );
1192
2218
  }
2219
+ _requestRewireNext(op) {
2220
+ nodeRequestRewireNext(nodeRuntimeHost(this), op);
2221
+ }
2222
+ _requestUpNext(msgs, towardDep) {
2223
+ nodeRequestUpNext(nodeRuntimeHost(this), msgs, towardDep);
2224
+ }
2225
+ _applyRewireNext(op) {
2226
+ nodeApplyRewireNext(nodeRuntimeHost(this), op);
2227
+ }
1193
2228
  _dedupDeps(deps) {
1194
2229
  const seen = /* @__PURE__ */ new Set();
1195
2230
  const out = [];
@@ -1200,7 +2235,6 @@ var Node = class {
1200
2235
  }
1201
2236
  return out;
1202
2237
  }
1203
- /** Is `target` reachable upstream from `from` (following deps)? Cycle-prevention DFS. */
1204
2238
  _reachableUpstream(from, target) {
1205
2239
  const seen = /* @__PURE__ */ new Set();
1206
2240
  const stack = [from];
@@ -1210,1025 +2244,171 @@ var Node = class {
1210
2244
  if (n === target) return true;
1211
2245
  if (seen.has(n)) continue;
1212
2246
  seen.add(n);
1213
- for (const d of n._slot.deps) stack.push(d);
2247
+ for (const d of nodeRuntimeHost(n)._slot.deps) stack.push(d);
1214
2248
  }
1215
2249
  return false;
1216
2250
  }
1217
2251
  _assertRewireDepOwner(dep) {
1218
2252
  const selfOwner = getNodeOwner(this);
1219
2253
  const depOwner = getNodeOwner(dep);
1220
- if (selfOwner !== void 0 && depOwner !== void 0 && selfOwner !== depOwner) {
2254
+ if (selfOwner !== void 0 && depOwner !== void 0 && selfOwner !== depOwner)
1221
2255
  throw new Error(
1222
2256
  "rewire: dep belongs to a different graph; cross-graph deps require a wire bridge (D22 / R-graph-domain)"
1223
2257
  );
1224
- }
1225
2258
  }
1226
2259
  _rewire(newDeps, fn, opts = {}) {
1227
- if (this._value.terminal !== void 0 && !opts.allowTerminalOwner)
1228
- throw new Error(
1229
- "rewire: node is terminal (completed/errored) \u2014 cannot rewire (R-rewire / D42)"
1230
- );
1231
- if (this._wave.insideRunWave)
1232
- throw new Error(
1233
- "rewire: mid-fn topology mutation \u2014 a fn mutating its own deps mid-wave is the feedback cycle (R-rewire / D37)"
1234
- );
1235
- if (this._wave.inDepMutation)
1236
- throw new Error(
1237
- "rewire: reentrant dep mutation \u2014 another replaceDeps/subscribeDep/unsubscribeDep is in flight (R-rewire)"
1238
- );
1239
- if (newDeps.includes(this))
1240
- throw new Error("rewire: self-dependency rejected (R-rewire / D42)");
1241
- const oldDeps = this._slot.deps;
1242
- const added = newDeps.filter((d) => !oldDeps.includes(d));
1243
- for (const d of added) {
1244
- if (this._reachableUpstream(d, this))
1245
- throw new Error(
1246
- "rewire: would create a cycle \u2014 dep already transitively depends on this node (R-rewire / D42)"
1247
- );
1248
- if (d._value.terminal !== void 0 && !d._slot.resubscribable)
1249
- throw new Error(
1250
- "rewire: cannot add a non-resubscribable terminal dep \u2014 would wedge (R-rewire / D42)"
1251
- );
1252
- this._assertRewireDepOwner(d);
1253
- }
1254
- if (deferAfterBatchForTarget(this, () => {
1255
- this._rewire(newDeps, fn, { ...opts, allowTerminalOwner: true });
1256
- })) {
1257
- return true;
1258
- }
1259
- if (!this._lifecycle.activated) this._restoredActivationPending = false;
1260
- this._wave.inDepMutation = true;
1261
- this._wave.rewireRunPending = false;
1262
- let zeroDepUnDirty = false;
1263
- try {
1264
- const oldHandle = this._slot.handle;
1265
- this._slot.handle = this._slot.dispatcher.register(fn, this._slot.pool);
1266
- if (oldHandle !== null) this._slot.dispatcher.unregister(oldHandle);
1267
- const removed = oldDeps.filter((d) => !newDeps.includes(d));
1268
- let removedDirtyContributor = false;
1269
- for (const d of removed) {
1270
- const oldIdx = oldDeps.indexOf(d);
1271
- if (this._dep.dirty[oldIdx]) {
1272
- removedDirtyContributor = true;
1273
- this._wave.pending--;
1274
- }
1275
- if (this._lifecycle.activated) {
1276
- const box = this._dep.idxBoxes[oldIdx];
1277
- if (box) box.v = -1;
1278
- const unsub = this._dep.unsubs[oldIdx];
1279
- if (unsub) unsub();
1280
- }
1281
- }
1282
- const n = newDeps.length;
1283
- const newBatch = new Array(n).fill(null);
1284
- const newPrev = new Array(n).fill(SENTINEL);
1285
- const newHasData = new Array(n).fill(false);
1286
- const newDirty = new Array(n).fill(false);
1287
- const newTier = new Array(n).fill(0);
1288
- const newTerminal = new Array(n).fill(void 0);
1289
- const newTerminalInput = new Array(n).fill(void 0);
1290
- const newUnsubs = new Array(n);
1291
- const newBoxes = new Array(n);
1292
- for (let j = 0; j < n; j++) {
1293
- const oldIdx = oldDeps.indexOf(newDeps[j]);
1294
- if (oldIdx !== -1) {
1295
- newBatch[j] = this._dep.batch[oldIdx];
1296
- newPrev[j] = this._dep.prev[oldIdx];
1297
- newHasData[j] = this._dep.hasData[oldIdx];
1298
- newDirty[j] = this._dep.dirty[oldIdx];
1299
- newTier[j] = this._dep.tier[oldIdx];
1300
- newTerminal[j] = this._dep.terminal[oldIdx];
1301
- newUnsubs[j] = this._dep.unsubs[oldIdx];
1302
- const box = this._dep.idxBoxes[oldIdx];
1303
- if (box) box.v = j;
1304
- newBoxes[j] = box;
1305
- }
1306
- }
1307
- this._slot.deps = newDeps;
1308
- this._dep.batch = newBatch;
1309
- this._dep.prev = newPrev;
1310
- this._dep.hasData = newHasData;
1311
- this._dep.dirty = newDirty;
1312
- this._dep.tier = newTier;
1313
- this._dep.terminal = newTerminal;
1314
- this._dep.terminalInput = newTerminalInput;
1315
- this._dep.unsubs = newUnsubs;
1316
- this._dep.idxBoxes = newBoxes;
1317
- this._dep.waveData = newDeps.map(() => []);
1318
- this._dep.waveTokens = new Array(newDeps.length).fill(void 0);
1319
- this._syncCtx = null;
1320
- if (this._lifecycle.activated) {
1321
- for (const d of added) this._subscribeDepAt(d);
1322
- }
1323
- notifyTopologyDepsChanged(this, oldDeps, newDeps);
1324
- if (removedDirtyContributor && this._wave.pending === 0 && this._value.status === "dirty") {
1325
- if (newDeps.length > 0) this._wave.rewireRunPending = true;
1326
- else zeroDepUnDirty = true;
1327
- }
1328
- } finally {
1329
- this._wave.inDepMutation = false;
1330
- }
1331
- if (this._wave.rewireRunPending) {
1332
- this._wave.rewireRunPending = false;
1333
- this._settleRewire();
1334
- } else if (zeroDepUnDirty) {
1335
- if (this._wave.emittedDirtyThisWave) this._down([["RESOLVED"]]);
1336
- else this._value.status = this._value.hasData ? "settled" : "sentinel";
1337
- }
1338
- return false;
2260
+ return nodeRewire(nodeRuntimeHost(this), newDeps, fn, opts);
1339
2261
  }
1340
2262
  // ── activation / deactivation (lazy; R-rom-ram) ──
1341
2263
  _activate() {
1342
- this._lifecycle.activated = true;
1343
- const seedRestoredDeps = this._restoredActivationPending;
1344
- this._restoredActivationPending = false;
1345
- if (this._slot.pull) this._control.pauseLockset.add(this._slot.pullLock);
1346
- this._dep.unsubs = new Array(this._slot.deps.length);
1347
- this._dep.idxBoxes = new Array(this._slot.deps.length);
1348
- for (const dep of this._slot.deps)
1349
- this._subscribeDepAt(dep, { seedRestored: seedRestoredDeps });
1350
- if (this._slot.deps.length === 0 && this._slot.handle !== null && !this._wave.hasCalledFnOnce) {
1351
- this._runWave();
1352
- }
1353
- }
1354
- /**
1355
- * Subscribe to a dep. The dispatch callback reads the dep's CURRENT index from a
1356
- * mutable box (O(1)); a surgical rewire that reorders kept deps just updates the box
1357
- * (R-rewire Option-C / D42) — no re-subscribe, no per-message indexOf scan. A removed
1358
- * dep's box is set to -1 so any stale in-flight callback drops (drain).
1359
- */
1360
- _subscribeDepAt(depNode, opts = {}) {
1361
- const idx0 = this._slot.deps.indexOf(depNode);
1362
- const box = { v: idx0 };
1363
- let ignoreInitialPush = opts.seedRestored === true;
1364
- if (ignoreInitialPush && idx0 !== -1) {
1365
- this._seedRestoredDepAt(idx0, depNode);
1366
- if (depNode._value.terminal !== void 0 && !depNode._slot.resubscribable) {
1367
- this._dep.unsubs[idx0] = () => {
1368
- };
1369
- this._dep.idxBoxes[idx0] = box;
1370
- return;
1371
- }
1372
- }
1373
- const unsub = depNode.subscribe((msg, delivery) => {
1374
- if (ignoreInitialPush && delivery === void 0) return;
1375
- if (ignoreInitialPush) ignoreInitialPush = false;
1376
- if (box.v === -1) return;
1377
- this._receiveFromDep(box.v, msg, delivery);
1378
- });
1379
- if (ignoreInitialPush && idx0 !== -1 && box.v !== -1) this._seedRestoredDepAt(idx0, depNode);
1380
- ignoreInitialPush = false;
1381
- if (idx0 !== -1) {
1382
- this._dep.unsubs[idx0] = unsub;
1383
- this._dep.idxBoxes[idx0] = box;
1384
- }
1385
- }
1386
- _seedRestoredDepAt(idx, depNode) {
1387
- const seedData = depNode._value.hasData && !depNode._slot.pull;
1388
- this._dep.batch[idx] = null;
1389
- this._dep.waveData[idx] = [];
1390
- this._dep.waveTokens[idx] = void 0;
1391
- this._dep.prev[idx] = seedData ? depNode._value.cache : SENTINEL;
1392
- this._dep.hasData[idx] = seedData;
1393
- this._dep.dirty[idx] = false;
1394
- this._dep.tier[idx] = seedData ? 3 : 0;
1395
- this._dep.terminal[idx] = depNode._value.terminal;
1396
- this._dep.terminalInput[idx] = void 0;
2264
+ nodeActivate(nodeRuntimeHost(this));
1397
2265
  }
1398
2266
  _deactivate() {
1399
- this._lifecycle.activated = false;
1400
- for (const u of this._dep.unsubs) if (u) u();
1401
- this._dep.unsubs = [];
1402
- this._dep.idxBoxes = [];
1403
- for (const fn of this._hooks.onDeactivation) fn();
1404
- this._hooks.onDeactivation = [];
1405
- this._hooks.onInvalidate = [];
1406
- const isCompute = this._slot.handle !== null || this._slot.deps.length > 0;
1407
- if (isCompute) {
1408
- this._value.cache = SENTINEL;
1409
- this._value.hasData = false;
1410
- this._value.status = "sentinel";
1411
- }
1412
- this._resetDepState();
1413
- this._wave.hasCalledFnOnce = false;
1414
- this._control.pauseLockset.clear();
1415
- this._control.pauseBuffer = [];
1416
- this._control.pausedDepWaveOccurred = false;
1417
- this._control.demandOwed = false;
1418
- this._value.replayRing = [];
1419
- if (!this._privateState.persist) this._privateState.value = SENTINEL;
2267
+ nodeDeactivate(nodeRuntimeHost(this));
1420
2268
  }
1421
2269
  _assertNotReleased(op) {
1422
2270
  if (this._released)
1423
2271
  throw new Error(`${op}: node has been released from its graph lifecycle (D122)`);
1424
2272
  }
1425
2273
  _subscriberCount() {
1426
- return this._lifecycle.subscribers.size;
2274
+ return nodeSubscriberCount(nodeRuntimeHost(this));
1427
2275
  }
1428
2276
  _isRuntimeQuiescentForRelease() {
1429
- const allowedPullQuietLock = this._slot.pull && this._control.pauseLockset.size === 1 && this._control.pauseLockset.has(this._slot.pullLock);
1430
- return !this._released && this._value.status !== "dirty" && this._value.status !== "pending" && this._wave.pending === 0 && !this._wave.insideRunWave && !this._wave.inDepMutation && !this._wave.rewireRunPending && !this._wave.batchDirtyOwed && this._dep.dirty.every((dirty) => !dirty) && this._control.pauseBuffer.length === 0 && !this._control.pausedDepWaveOccurred && !this._control.demandOwed && !this._control.inDeliverDemand && (this._control.pauseLockset.size === 0 || allowedPullQuietLock);
2277
+ return nodeIsRuntimeQuiescentForRelease(nodeRuntimeHost(this));
1431
2278
  }
1432
2279
  _releaseRuntime() {
1433
- if (this._released) return;
1434
- this._released = true;
1435
- releasedNodes.add(this);
1436
- let releaseError;
1437
- const recordReleaseError = (error) => {
1438
- if (releaseError === void 0) releaseError = error;
1439
- };
1440
- this._lifecycle.activated = false;
1441
- for (const u of this._dep.unsubs) {
1442
- try {
1443
- u();
1444
- } catch (error) {
1445
- recordReleaseError(error);
1446
- }
1447
- }
1448
- for (const fn of this._hooks.onDeactivation) {
1449
- try {
1450
- fn();
1451
- } catch (error) {
1452
- recordReleaseError(error);
1453
- }
1454
- }
1455
- this._dep.unsubs = [];
1456
- this._dep.idxBoxes = [];
1457
- this._lifecycle.subscribers.clear();
1458
- if (this._slot.handle !== null) {
1459
- this._slot.dispatcher.unregister(this._slot.handle);
1460
- this._slot.handle = null;
1461
- }
1462
- this._slot.deps = [];
1463
- this._dep.batch = [];
1464
- this._dep.waveData = [];
1465
- this._dep.waveTokens = [];
1466
- this._dep.prev = [];
1467
- this._dep.hasData = [];
1468
- this._dep.dirty = [];
1469
- this._dep.tier = [];
1470
- this._dep.terminal = [];
1471
- this._dep.terminalInput = [];
1472
- this._value.cache = SENTINEL;
1473
- this._value.hasData = false;
1474
- this._value.status = "sentinel";
1475
- this._value.terminal = void 0;
1476
- this._value.replayRing = [];
1477
- this._privateState.value = SENTINEL;
1478
- this._privateState.persist = false;
1479
- this._syncCtx = null;
1480
- this._resetDepState();
1481
- this._hooks.onDeactivation = [];
1482
- this._hooks.onInvalidate = [];
1483
- this._control.pauseLockset.clear();
1484
- this._control.pauseBuffer = [];
1485
- this._control.pausedDepWaveOccurred = false;
1486
- this._control.demandOwed = false;
1487
- this._restoredActivationPending = false;
1488
- checkpointReaders.delete(this);
1489
- restoreWriters.delete(this);
1490
- runtimeReleasers.delete(this);
1491
- runtimeQuiescenceReaders.delete(this);
1492
- subscriberCountReaders.delete(this);
1493
- activationReaders.delete(this);
1494
- ownerTokens.delete(this);
1495
- topologyDepsChangedObservers.delete(this);
1496
- this._core.releaseSlot(this._id);
1497
- if (releaseError !== void 0) throw releaseError;
2280
+ nodeReleaseRuntime(nodeRuntimeHost(this));
1498
2281
  }
1499
2282
  _resetDepState() {
1500
- const n = this._slot.deps.length;
1501
- for (let i = 0; i < n; i++) {
1502
- this._dep.batch[i] = null;
1503
- this._dep.waveData[i] = [];
1504
- this._dep.waveTokens[i] = void 0;
1505
- this._dep.prev[i] = SENTINEL;
1506
- this._dep.hasData[i] = false;
1507
- this._dep.dirty[i] = false;
1508
- this._dep.tier[i] = 0;
1509
- this._dep.terminal[i] = void 0;
1510
- this._dep.terminalInput[i] = void 0;
1511
- }
1512
- this._wave.pending = 0;
1513
- this._wave.emittedDirtyThisWave = false;
2283
+ nodeResetDepState(nodeRuntimeHost(this));
2284
+ }
2285
+ _subscribeDepAt(depNode, opts = {}) {
2286
+ nodeSubscribeDepAt(nodeRuntimeHost(this), depNode, opts);
2287
+ }
2288
+ _seedRestoredDepAt(idx, depNode) {
2289
+ nodeSeedRestoredDepAt(nodeRuntimeHost(this), idx, depNode);
1514
2290
  }
1515
- // ── upstream wave receive (two-phase + diamond) ──
1516
2291
  _recordDepProjection(idx, delivery) {
1517
- const token = delivery?.wave ?? {};
1518
- if (this._dep.waveTokens[idx] !== token) {
1519
- this._dep.waveData[idx].push([]);
1520
- this._dep.waveTokens[idx] = token;
1521
- }
1522
- return this._dep.waveData[idx][this._dep.waveData[idx].length - 1];
2292
+ return nodeRecordDepProjection(nodeRuntimeHost(this), idx, delivery);
1523
2293
  }
1524
2294
  _depProjectionHasData(idx) {
1525
- const projection = this._dep.waveData[idx][this._dep.waveData[idx].length - 1];
1526
- return projection?.some((v) => v !== SENTINEL) ?? false;
2295
+ return nodeDepProjectionHasData(nodeRuntimeHost(this), idx);
1527
2296
  }
1528
2297
  _receiveFromDep(idx, msg, delivery) {
1529
- if (this._released) return;
1530
- const t = msg[0];
1531
- if (t === "START") return;
1532
- const isLastInDeliveredWave = delivery?.last ?? true;
1533
- if (this._value.terminal !== void 0) {
1534
- if (t === "TEARDOWN") this._down([["TEARDOWN"]]);
1535
- return;
1536
- }
1537
- if (t === "INVALIDATE") {
1538
- const projection = this._recordDepProjection(idx, delivery);
1539
- projection.push(SENTINEL);
1540
- if (projection.some((v) => v !== SENTINEL) && isLastInDeliveredWave) this._maybeRun();
1541
- this._dep.prev[idx] = SENTINEL;
1542
- this._dep.hasData[idx] = false;
1543
- this._dep.batch[idx] = null;
1544
- if (this._dep.dirty[idx]) {
1545
- this._dep.dirty[idx] = false;
1546
- this._wave.pending--;
1547
- }
1548
- if (this._control.pausedDepWaveOccurred && this._dep.batch.every((b) => b === null)) {
1549
- this._control.pausedDepWaveOccurred = false;
1550
- }
1551
- const hadData = this._value.hasData;
1552
- this._invalidate();
1553
- if (this._wave.pending === 0 && this._wave.emittedDirtyThisWave) {
1554
- if (!hadData) this._down([["RESOLVED"]]);
1555
- else this._wave.emittedDirtyThisWave = false;
1556
- }
1557
- this._fireOwedDemandIfReady();
1558
- return;
1559
- }
1560
- if (isTerminal(t)) {
1561
- const isError = t === "ERROR";
1562
- const errPayload = isError ? msg[1] : void 0;
1563
- this._dep.terminal[idx] = isError ? errPayload : true;
1564
- this._dep.terminalInput[idx] = isError ? errPayload : true;
1565
- this._releaseDepDirty(idx);
1566
- const ranValueBeforeTerminal = this._depProjectionHasData(idx) && isLastInDeliveredWave;
1567
- if (ranValueBeforeTerminal) this._maybeRun();
1568
- if (isError && this._slot.errorWhenDepsError) {
1569
- this._down([["ERROR", errPayload]]);
1570
- } else if (this._slot.terminalAsRealInput) {
1571
- if (ranValueBeforeTerminal) {
1572
- this._fireOwedDemandIfReady();
1573
- return;
1574
- }
1575
- this._maybeRun();
1576
- } else if (this._slot.completeWhenDepsComplete && this._allDepsTerminal()) {
1577
- this._down([["COMPLETE"]]);
1578
- } else {
1579
- this._settleAfterAbsorbedTerminal();
1580
- }
1581
- this._fireOwedDemandIfReady();
1582
- return;
1583
- }
1584
- if (t === "TEARDOWN") {
1585
- this._down([["TEARDOWN"]]);
1586
- return;
1587
- }
1588
- if (t === "DIRTY") {
1589
- if (!this._dep.dirty[idx]) {
1590
- this._dep.dirty[idx] = true;
1591
- this._wave.pending++;
1592
- this._dep.tier[idx] = 2;
1593
- this._markDirty();
1594
- }
1595
- return;
1596
- }
1597
- if (t === "DATA") {
1598
- const v = msg[1];
1599
- this._recordDepProjection(idx, delivery).push(v);
1600
- const b = this._dep.batch[idx];
1601
- if (b === null) this._dep.batch[idx] = [v];
1602
- else b.push(v);
1603
- this._dep.prev[idx] = v;
1604
- this._dep.hasData[idx] = true;
1605
- this._dep.tier[idx] = 3;
1606
- if (this._dep.dirty[idx]) {
1607
- this._dep.dirty[idx] = false;
1608
- this._wave.pending--;
1609
- }
1610
- if (isLastInDeliveredWave) this._maybeRun();
1611
- this._fireOwedDemandIfReady();
1612
- return;
1613
- }
1614
- if (t === "RESOLVED") {
1615
- this._recordDepProjection(idx, delivery);
1616
- this._dep.tier[idx] = 3;
1617
- if (this._dep.dirty[idx]) {
1618
- this._dep.dirty[idx] = false;
1619
- this._wave.pending--;
1620
- }
1621
- if (isLastInDeliveredWave) this._maybeRun();
1622
- this._fireOwedDemandIfReady();
1623
- return;
1624
- }
2298
+ nodeReceiveFromDep(nodeRuntimeHost(this), idx, msg, delivery);
1625
2299
  }
1626
- /**
1627
- * R-terminal-settles-dirty (B35): release a dep's outstanding in-wave DIRTY contribution.
1628
- * A settle-class event for that dep (DATA/RESOLVED inline above, INVALIDATE, and now
1629
- * COMPLETE/ERROR) clears its dirty flag + decrements _pending. No-op if the dep already
1630
- * settled this wave (DATA/RESOLVED ran first) — so the normal DATA-then-COMPLETE flow is
1631
- * unaffected. This makes the exactly-one-settle invariant a single, shared step.
1632
- */
1633
2300
  _releaseDepDirty(idx) {
1634
- if (this._dep.dirty[idx]) {
1635
- this._dep.dirty[idx] = false;
1636
- this._wave.pending--;
1637
- }
2301
+ nodeReleaseDepDirty(nodeRuntimeHost(this), idx);
1638
2302
  }
1639
- /**
1640
- * R-terminal-settles-dirty (B35): settle a node whose dirtied dep was released by an ABSORBED
1641
- * terminal that is NOT a real input (a plain derived/effect — the common default-node case when
1642
- * one of several deps completes while others stay live). Runs only when the release drained
1643
- * _pending while the node still owes a downstream settle (it broadcast DIRTY this wave):
1644
- * - if some OTHER dep delivered real DATA this wave (a value occurred) → recompute (→ DATA);
1645
- * - else the terminal's signalled change did not materialise (no value) → one undirty RESOLVED
1646
- * (R-resolved-undirty), keeping the cache (a terminal, unlike INVALIDATE, leaves the value).
1647
- * A terminalAsRealInput node instead recomputes unconditionally (its fn reads the terminal).
1648
- */
1649
2303
  _settleAfterAbsorbedTerminal() {
1650
- if (this._wave.pending !== 0 || !this._wave.emittedDirtyThisWave) return;
1651
- const sawData = this._dep.batch.some((b) => b !== null && b.length > 0);
1652
- if (sawData) this._maybeRun();
1653
- if (this._wave.emittedDirtyThisWave) this._down([["RESOLVED"]]);
2304
+ nodeSettleAfterAbsorbedTerminal(nodeRuntimeHost(this));
1654
2305
  }
1655
2306
  _markDirty() {
1656
- this._value.status = "dirty";
1657
- if (this._isPullQuiet()) return;
1658
- if (!this._wave.emittedDirtyThisWave) {
1659
- this._wave.emittedDirtyThisWave = true;
1660
- this._emitToSubs(["DIRTY"]);
1661
- }
2307
+ nodeMarkDirty(nodeRuntimeHost(this));
1662
2308
  }
1663
2309
  _maybeRun() {
1664
- if (this._wave.inDepMutation) {
1665
- this._wave.rewireRunPending = true;
1666
- return;
1667
- }
1668
- if (this._slot.pausable === true && this._isPaused()) {
1669
- this._control.pausedDepWaveOccurred = true;
1670
- return;
1671
- }
1672
- this._tryRun();
2310
+ nodeMaybeRun(nodeRuntimeHost(this));
1673
2311
  }
1674
- /**
1675
- * R-rewire atomic settle (after a rewire that warrants a recompute): emit a proper
1676
- * two-phase DIRTY→DATA wave (R-dirty-before-data — a rewire-triggered settle is a wave),
1677
- * once, with every added dep already wired. Mirrors _maybeRun/_tryRun's pause + gate +
1678
- * pending guards, then injects the phase-1 DIRTY the added dep's [START,DATA] handshake
1679
- * did not carry.
1680
- */
1681
2312
  _settleRewire() {
1682
- if (this._slot.pausable === true && this._isPaused()) {
1683
- this._control.pausedDepWaveOccurred = true;
1684
- return;
1685
- }
1686
- if (this._wave.pending > 0) return;
1687
- if (this._slot.handle === null) {
1688
- this._passthroughEmit();
1689
- return;
1690
- }
1691
- if (!this._wave.hasCalledFnOnce && !(this._slot.partial || this._allDepsSettled())) return;
1692
- this._markDirty();
1693
- this._runWave();
2313
+ nodeSettleRewire(nodeRuntimeHost(this));
1694
2314
  }
1695
2315
  _tryRun() {
1696
- if (this._wave.pending > 0) return;
1697
- if (this._slot.handle === null) {
1698
- this._passthroughEmit();
1699
- return;
1700
- }
1701
- if (!this._wave.hasCalledFnOnce) {
1702
- if (this._slot.partial || this._allDepsSettled()) this._runWave();
1703
- return;
1704
- }
1705
- this._runWave();
2316
+ nodeTryRun(nodeRuntimeHost(this));
1706
2317
  }
1707
2318
  _allDepsSettled() {
1708
- for (let i = 0; i < this._slot.deps.length; i++) {
1709
- if (this._dep.hasData[i]) continue;
1710
- if (this._slot.terminalAsRealInput && this._dep.terminal[i] !== void 0) continue;
1711
- return false;
1712
- }
1713
- return true;
2319
+ return nodeAllDepsSettled(nodeRuntimeHost(this));
1714
2320
  }
1715
2321
  _passthroughEmit() {
1716
- const b = this._dep.batch[0];
1717
- if (b !== null && b.length > 0) {
1718
- this._down([["DATA", b[b.length - 1]]]);
1719
- } else if (this._wave.emittedDirtyThisWave) {
1720
- this._down([["RESOLVED"]]);
1721
- }
1722
- this._dep.batch[0] = null;
1723
- this._wave.emittedDirtyThisWave = false;
2322
+ nodePassthroughEmit(nodeRuntimeHost(this));
1724
2323
  }
1725
2324
  _runWave() {
1726
- if (this._wave.insideRunWave)
1727
- throw new Error(
1728
- "synchronous feedback cycle: node fn re-entered its own wave (R-reentrancy / D37)"
1729
- );
1730
- this._wave.hasCalledFnOnce = true;
1731
- this._hooks.onInvalidate = [];
1732
- this._hooks.onDeactivation = [];
1733
- const ctx = this._buildCtx();
1734
- const wasDirty = this._wave.emittedDirtyThisWave;
1735
- this._wave.emittedSettleThisWave = false;
1736
- this._wave.insideRunWave = true;
1737
- try {
1738
- this._slot.dispatcher.invoke(this._slot.handle, ctx);
1739
- } finally {
1740
- this._wave.insideRunWave = false;
1741
- }
1742
- if (wasDirty && !this._wave.emittedSettleThisWave && this._value.terminal === void 0 && !this._isAsyncPool()) {
1743
- this._down([["RESOLVED"]]);
1744
- }
1745
- for (let i = 0; i < this._dep.batch.length; i++) {
1746
- this._dep.batch[i] = null;
1747
- this._dep.waveData[i] = [];
1748
- this._dep.waveTokens[i] = void 0;
1749
- this._dep.terminalInput[i] = void 0;
1750
- }
1751
- this._wave.emittedDirtyThisWave = false;
2325
+ nodeRunWave(nodeRuntimeHost(this));
1752
2326
  }
1753
- // ── ctx construction (L3-Q5: sync = node-stable reused ctx; async = per-invocation) ──
1754
2327
  _buildCtx() {
1755
- const kind = this._slot.handle ? this._slot.dispatcher.poolKind(this._slot.handle.poolId) : "sync";
1756
- if (kind === "sync") {
1757
- if (this._syncCtx === null) this._syncCtx = this._makeCtx();
1758
- this._refreshCtx(this._syncCtx);
1759
- return this._syncCtx;
1760
- }
1761
- return this._makeCtx({
1762
- waveData: this._dep.waveData.map((waves) => waves.map((w) => [...w])),
1763
- terminal: this._dep.terminalInput.map(terminalView),
1764
- latest: [...this._dep.prev]
1765
- });
2328
+ return nodeBuildCtx(nodeRuntimeHost(this));
1766
2329
  }
1767
2330
  _makeCtx(snapshot) {
1768
- const ctx = {
1769
- // Wave-owner boundary (D47): a SYNC fn's emit nests under the public entry that drove
1770
- // it (cheap inc/dec, no early drain); an ASYNC-pool fn re-enters here from its stashed
1771
- // ctx at depth 0, so this is the boundary that drains any rewireNext it issued.
1772
- up: (msgs, towardDep) => {
1773
- if (this._released) return;
1774
- enterWave();
1775
- try {
1776
- this._up(msgs, towardDep);
1777
- } finally {
1778
- exitWave();
1779
- }
1780
- },
1781
- down: (msgs) => {
1782
- if (this._released) return;
1783
- enterWave();
1784
- try {
1785
- this._down(msgs);
1786
- } finally {
1787
- exitWave();
1788
- }
1789
- },
1790
- waveData: snapshot?.waveData ?? this._dep.waveData,
1791
- terminal: snapshot?.terminal ?? this._dep.terminalInput.map(terminalView),
1792
- state: this._makeState(),
1793
- onDeactivation: (fn) => {
1794
- if (this._released) return;
1795
- this._hooks.onDeactivation.push(fn);
1796
- },
1797
- onInvalidate: (fn) => {
1798
- if (this._released) return;
1799
- this._hooks.onInvalidate.push(fn);
1800
- },
1801
- environment: () => this._slot.environment,
1802
- // R-rewire-deferred (D47): defer a self-dep-set mutation to the committed boundary.
1803
- rewireNext: {
1804
- subscribeDep: (dep, fn) => this._requestRewireNext({ kind: "add", dep, fn }),
1805
- unsubscribeDep: (dep, fn) => this._requestRewireNext({ kind: "remove", dep, fn }),
1806
- replaceDeps: (deps, fn) => this._requestRewireNext({ kind: "set", deps, fn })
1807
- },
1808
- // R-up-routing / R-pull (D59): deferred up — route a control wave (e.g. a RESUME pull
1809
- // DEMAND) up the declared cone at the committed boundary. The SELF-demand path: an
1810
- // immediate ctx.up whose delivery loops back re-enters this fn (D37 / R-reentrancy).
1811
- upNext: (msgs, towardDep) => this._requestUpNext(msgs, towardDep),
1812
- [CTX_DEP_CACHE]: { latest: snapshot?.latest ?? this._dep.prev },
1813
- [CTX_NODE_BINDING]: {
1814
- dispatcher: this._slot.dispatcher,
1815
- create: (factory) => withEnvironmentDrivers(this._slot.environment, () => withNodeCore(this._core, factory))
1816
- }
1817
- };
1818
- if (this._slot.dynamic) {
1819
- ctx.track = (i) => ctx[CTX_DEP_CACHE]?.latest[i];
1820
- }
1821
- return ctx;
2331
+ return nodeMakeCtx(nodeRuntimeHost(this), snapshot);
1822
2332
  }
1823
2333
  _refreshCtx(ctx) {
1824
- ctx.waveData = this._dep.waveData;
1825
- ctx.terminal = this._dep.terminalInput.map(terminalView);
1826
- ctx[CTX_DEP_CACHE] = { latest: this._dep.prev };
2334
+ nodeRefreshCtx(nodeRuntimeHost(this), ctx);
1827
2335
  }
1828
2336
  _makeState() {
1829
- return {
1830
- get: () => this._privateState.value,
1831
- set: (v) => {
1832
- this._privateState.value = v;
1833
- },
1834
- persist: (on = true) => {
1835
- this._privateState.persist = on;
1836
- }
1837
- };
2337
+ return nodeMakeState(nodeRuntimeHost(this));
1838
2338
  }
1839
2339
  // ── downstream emission pipeline (the unified waist) ──
1840
2340
  _down(msgs) {
1841
- if (this._released) return;
1842
- validateDownPayloads(msgs);
1843
- const deliveryWave = {};
1844
- const assertVersionDataCompatible = (wave) => {
1845
- for (const m of wave) {
1846
- if (m[0] === "DATA") assertNodeVersionDataCompatible(this._version.policy, m[1]);
1847
- }
1848
- };
1849
- const snapshotVersionData = (wave) => wave.map(
1850
- (m) => m[0] === "DATA" ? ["DATA", snapshotNodeVersionData(this._version.policy, m[1])] : m
1851
- );
1852
- assertVersionDataCompatible(msgs);
1853
- if (this._value.terminal !== void 0) {
1854
- if (!msgs.some((m) => m[0] === "TEARDOWN")) return;
1855
- this._value.hasTorndown = true;
1856
- if (this._slot.resetOnTeardown) {
1857
- this._value.cache = SENTINEL;
1858
- this._value.hasData = false;
1859
- }
1860
- this._emitToSubs(["TEARDOWN"], { wave: deliveryWave, last: true });
1861
- return;
1862
- }
1863
- let sorted = [...msgs].sort((a, b) => messageTier(a[0]) - messageTier(b[0]));
1864
- const firstInvalidate = sorted.findIndex((m) => m[0] === "INVALIDATE");
1865
- if (firstInvalidate !== -1) {
1866
- sorted = sorted.filter((m, i) => m[0] !== "INVALIDATE" || i === firstInvalidate);
1867
- }
1868
- const hasTeardown = sorted.some((m) => m[0] === "TEARDOWN");
1869
- const hasTerminal = sorted.some((m) => m[0] === "COMPLETE" || m[0] === "ERROR");
1870
- if (hasTeardown && !hasTerminal && this._value.terminal === void 0 && !this._value.hasTorndown) {
1871
- sorted = [["COMPLETE"], ...sorted];
1872
- }
1873
- if (!this._wave.insideRunWave && currentBatch()) {
1874
- const deferred = snapshotVersionData(sorted.filter((m) => isDeferredTier(m[0])));
1875
- if (deferred.length > 0) {
1876
- if (!this._wave.emittedDirtyThisWave) {
1877
- this._wave.emittedDirtyThisWave = true;
1878
- this._value.status = "dirty";
1879
- this._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
1880
- }
1881
- this._wave.batchDirtyOwed = true;
1882
- deferToBatch(this, deferred);
1883
- return;
1884
- }
1885
- }
1886
- if (this._shouldBufferOnPause()) {
1887
- const buffered = snapshotVersionData(sorted.filter((m) => isPauseBufferedTier(m[0])));
1888
- if (buffered.length > 0) {
1889
- this._wave.emittedSettleThisWave = true;
1890
- this._control.pauseBuffer.push(buffered);
1891
- }
1892
- sorted = sorted.filter((m) => !isPauseBufferedTier(m[0]));
1893
- if (sorted.length === 0) return;
1894
- }
1895
- let dataCount = 0;
1896
- let hasTier3 = false;
1897
- let hasResolved = false;
1898
- for (const m of sorted) {
1899
- if (m[0] === "DATA") dataCount++;
1900
- if (m[0] === "RESOLVED") hasResolved = true;
1901
- if (isValueTier(m[0])) hasTier3 = true;
1902
- }
1903
- if (dataCount >= 1 && hasResolved) {
1904
- throw new Error(
1905
- "down: a wave cannot mix DATA and RESOLVED (tier-3 exclusivity, R-resolved-undirty)"
1906
- );
1907
- }
1908
- const plannedVersions = new Array(sorted.length);
1909
- if (dataCount > 0) {
1910
- let plannedVersion = this._version.value;
1911
- for (let i = 0; i < sorted.length; i++) {
1912
- const m = sorted[i];
1913
- if (m[0] !== "DATA") continue;
1914
- plannedVersion = advanceNodeVersion(plannedVersion, this._version.policy, m[1]);
1915
- plannedVersions[i] = plannedVersion;
1916
- }
1917
- }
1918
- if (hasTier3 && !this._wave.insideRunWave && !this._wave.emittedDirtyThisWave) {
1919
- this._wave.emittedDirtyThisWave = true;
1920
- this._value.status = "dirty";
1921
- this._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
1922
- }
1923
- for (let i = 0; i < sorted.length; i++) {
1924
- const m = sorted[i];
1925
- const delivery = { wave: deliveryWave, last: i === sorted.length - 1 };
1926
- if (isDeferredTier(m[0])) this._wave.emittedSettleThisWave = true;
1927
- if (m[0] === "DIRTY") {
1928
- if (!this._wave.emittedDirtyThisWave) {
1929
- this._wave.emittedDirtyThisWave = true;
1930
- this._value.status = "dirty";
1931
- this._emitToSubs(["DIRTY"], delivery);
1932
- }
1933
- continue;
1934
- }
1935
- if (m[0] === "DATA") {
1936
- const v = m[1];
1937
- this._value.cache = v;
1938
- this._value.hasData = true;
1939
- this._value.status = "settled";
1940
- this._version.value = plannedVersions[i];
1941
- if (this._slot.replayN > 0) {
1942
- this._value.replayRing.push(v);
1943
- if (this._value.replayRing.length > this._slot.replayN) this._value.replayRing.shift();
1944
- }
1945
- this._emitToSubs(["DATA", v], delivery);
1946
- continue;
1947
- }
1948
- if (m[0] === "RESOLVED") {
1949
- this._value.status = this._value.hasData ? "resolved" : "sentinel";
1950
- this._emitToSubs(["RESOLVED"], delivery);
1951
- continue;
1952
- }
1953
- if (m[0] === "INVALIDATE") {
1954
- this._invalidate(delivery);
1955
- continue;
1956
- }
1957
- if (m[0] === "COMPLETE") {
1958
- if (this._value.terminal !== void 0) continue;
1959
- this._value.terminal = true;
1960
- this._control.pauseBuffer = [];
1961
- this._value.status = "completed";
1962
- this._emitToSubs(["COMPLETE"], delivery);
1963
- continue;
1964
- }
1965
- if (m[0] === "ERROR") {
1966
- if (this._value.terminal !== void 0) continue;
1967
- this._value.terminal = m[1];
1968
- this._control.pauseBuffer = [];
1969
- this._value.status = "errored";
1970
- this._emitToSubs(["ERROR", m[1]], delivery);
1971
- continue;
1972
- }
1973
- if (m[0] === "TEARDOWN") {
1974
- this._value.hasTorndown = true;
1975
- if (this._slot.resetOnTeardown) {
1976
- this._value.cache = SENTINEL;
1977
- this._value.hasData = false;
1978
- }
1979
- this._emitToSubs(["TEARDOWN"], delivery);
1980
- }
1981
- }
1982
- if (!this._wave.insideRunWave) this._wave.emittedDirtyThisWave = false;
2341
+ nodeDown(nodeRuntimeHost(this), msgs);
1983
2342
  }
1984
2343
  _up(msgs, towardDep, route) {
1985
- if (this._released) return;
1986
- const routeState = route ?? { demandFired: /* @__PURE__ */ new Map() };
1987
- for (const m of msgs) {
1988
- if (!isUpAllowed(m[0])) {
1989
- throw new Error(
1990
- `ctx.up: ${m[0]} is down-only (tier ${messageTier(m[0])}); up carries control tiers only (R-ctx-up)`
1991
- );
1992
- }
1993
- }
1994
- for (const m of msgs) {
1995
- if (m[0] === "PAUSE") {
1996
- this._pauseAcquire(m[1]);
1997
- } else if (m[0] === "RESUME") {
1998
- if (this._slot.pull && m[1] === this._slot.pullLock) {
1999
- if (!this._markDemandRouted(m[1], routeState)) this._onDemand();
2000
- } else if (this._control.pauseLockset.has(m[1])) {
2001
- this._pauseRelease(m[1]);
2002
- } else {
2003
- this._forwardUp(m, towardDep, routeState);
2004
- }
2005
- } else if (this._slot.deps.length === 0) {
2006
- if (m[0] === "INVALIDATE") this._down([["INVALIDATE"]]);
2007
- } else {
2008
- this._forwardUp(m, towardDep, routeState);
2009
- }
2010
- }
2344
+ nodeUp(nodeRuntimeHost(this), msgs, towardDep, route);
2011
2345
  }
2012
2346
  _markDemandRouted(lockId, route) {
2013
- let holders = route.demandFired.get(lockId);
2014
- if (holders === void 0) {
2015
- holders = /* @__PURE__ */ new Set();
2016
- route.demandFired.set(lockId, holders);
2017
- }
2018
- if (holders.has(this)) return true;
2019
- holders.add(this);
2020
- return false;
2347
+ return nodeMarkDemandRouted(nodeRuntimeHost(this), lockId, route);
2021
2348
  }
2022
- /**
2023
- * Forward one up-going control message toward deps (R-up-routing): up the single declared edge
2024
- * `towardDep` (directed — prunes other branches; only meaningful on the issuer's FIRST hop) or
2025
- * broadcast up ALL deps. A depless source has no deps → the message DROPS here (the terminus —
2026
- * e.g. a cone-routed RESUME whose pullId no node up this cone holds, R-up-at-source). Recursive
2027
- * forwarding carries the same per-wave route state and no `towardDep` → broadcast beyond the
2028
- * first hop.
2029
- */
2030
2349
  _forwardUp(m, towardDep, route) {
2031
- if (this._slot.deps.length === 0) return;
2032
- if (towardDep !== void 0) {
2033
- const d = this._slot.deps[towardDep];
2034
- if (d !== void 0) d._up([m], void 0, route);
2035
- } else {
2036
- for (const dep of this._slot.deps) dep._up([m], void 0, route);
2037
- }
2350
+ nodeForwardUp(nodeRuntimeHost(this), m, towardDep, route);
2038
2351
  }
2039
- // ── PAUSE/RESUME lockset (R-pause-lockset) + modes (R-pause-modes) ──
2040
2352
  _isPaused() {
2041
- return this._control.pauseLockset.size > 0;
2353
+ return nodeIsPaused(nodeRuntimeHost(this));
2042
2354
  }
2043
2355
  _hasBoundaryPauseLock() {
2044
- if (this._slot.pausable === false) return false;
2045
- let locks = this._control.pauseLockset.size;
2046
- if (this._slot.pull && this._control.pauseLockset.has(this._slot.pullLock)) locks--;
2047
- return locks > 0;
2356
+ return nodeHasBoundaryPauseLock(nodeRuntimeHost(this));
2048
2357
  }
2049
2358
  _isAsyncPool() {
2050
- return this._slot.handle !== null && this._slot.dispatcher.poolKind(this._slot.handle.poolId) === "async";
2359
+ return nodeIsAsyncPool(nodeRuntimeHost(this));
2051
2360
  }
2052
2361
  _pauseAcquire(lockId) {
2053
- this._control.pauseLockset.add(lockId);
2362
+ nodePauseAcquire(nodeRuntimeHost(this), lockId);
2054
2363
  }
2055
2364
  _pauseRelease(lockId) {
2056
- if (!this._control.pauseLockset.has(lockId)) return;
2057
- this._control.pauseLockset.delete(lockId);
2058
- if (this._slot.pull && this._control.demandOwed) this._fireOwedDemandIfReady();
2059
- if (this._hasBoundaryPauseLock()) return;
2060
- scheduleBoundaryDrain(this._core);
2061
- if (this._control.pauseLockset.size > 0) return;
2062
- this._onResume();
2365
+ nodePauseRelease(nodeRuntimeHost(this), lockId);
2063
2366
  }
2064
2367
  _onResume() {
2065
- if (this._value.terminal !== void 0) {
2066
- this._control.pauseBuffer = [];
2067
- this._control.pausedDepWaveOccurred = false;
2068
- this._control.demandOwed = false;
2069
- return;
2070
- }
2071
- if (this._control.pauseBuffer.length > 0) {
2072
- const buf = this._control.pauseBuffer;
2073
- this._control.pauseBuffer = [];
2074
- for (const wave of buf) this._down(wave);
2075
- }
2076
- if (this._control.pausedDepWaveOccurred) {
2077
- this._control.pausedDepWaveOccurred = false;
2078
- this._tryRun();
2079
- }
2368
+ nodeOnResume(nodeRuntimeHost(this));
2080
2369
  }
2081
- /**
2082
- * R-pull (D59): can this pull node fire a demand NOW? — not terminal, settle-ready (_pending===0),
2083
- * and no OTHER (non-pullId) lock holds it paused. The gate that decides fire-now vs OWE.
2084
- */
2085
2370
  _canFireDemand() {
2086
- if (this._value.terminal !== void 0 || this._wave.pending > 0) return false;
2087
- const own = this._control.pauseLockset.has(this._slot.pullLock) ? 1 : 0;
2088
- return this._control.pauseLockset.size <= own;
2371
+ return nodeCanFireDemand(nodeRuntimeHost(this));
2089
2372
  }
2090
- /**
2091
- * R-pull (D59): deliver ONE demand pulse — release the pullId so the demand wave RELAYS (not
2092
- * absorbed), fire it, then RE-QUIET (1:1). The pullId re-add + the re-entrancy flag are in a
2093
- * `finally` so a throwing pull fn (graph-less node, no D30 catch) cannot leave the node
2094
- * permanently non-quiet (the wedge-fix silently disabled) — QA-found robustness fix.
2095
- */
2096
- _deliverPullDemand() {
2097
- this._control.demandOwed = false;
2098
- this._control.inDeliverDemand = true;
2099
- this._control.pauseLockset.delete(this._slot.pullLock);
2100
- try {
2101
- this._firePullDemand();
2102
- } finally {
2103
- this._control.pauseLockset.add(this._slot.pullLock);
2104
- this._control.inDeliverDemand = false;
2105
- }
2373
+ _deliverPullDemand(demand) {
2374
+ nodeDeliverPullDemand(nodeRuntimeHost(this), demand);
2106
2375
  }
2107
- /**
2108
- * R-pull (D59): a cone-routed RESUME of THIS node's pullId arrived (R-up-routing) = a DEMAND.
2109
- * Fire immediately if able; else OWE it — pin-5 (a dep DIRTY in flight, _pending>0) or F4/F5 (an
2110
- * external PAUSE lock co-holds the node) — and fire when the node next becomes able. A demand
2111
- * arriving WHILE a delivery is in flight (synchronous re-entry) is DROPPED (1:1, QA guard).
2112
- */
2113
- _onDemand() {
2114
- if (this._control.inDeliverDemand) return;
2115
- if (this._canFireDemand()) this._deliverPullDemand();
2116
- else this._control.demandOwed = true;
2376
+ _onDemand(demand) {
2377
+ nodeOnDemand(nodeRuntimeHost(this), demand);
2117
2378
  }
2118
- /**
2119
- * R-pull (D55): service ONE demand. Delivery content = the orthogonal pausable mode:
2120
- * - 'resumeAll' → drain the buffered BACKLOG (each `_down` re-synthesizes a leading DIRTY, so
2121
- * the per-entry replay is DIRTY-before-DATA — R-pause-modes per-entry arrival order);
2122
- * - true → deliver the coalesced LATEST as ONE DIRTY-before-DATA wave (pin 2: the quiet absorb
2123
- * suppressed the dep's original DIRTY, so the demand wave restores it before the value).
2124
- * Neither branch fires when nothing changed since the last demand → the demand is SILENT.
2125
- * Called by `_deliverPullDemand` only when settle-ready; the caller has released the pullId, so
2126
- * `_markDirty` relays the leading DIRTY (not absorbed).
2127
- */
2128
2379
  _firePullDemand() {
2129
- if (this._control.pauseBuffer.length > 0) {
2130
- const buf = this._control.pauseBuffer;
2131
- this._control.pauseBuffer = [];
2132
- for (const wave of buf) this._down(wave);
2133
- }
2134
- if (this._control.pausedDepWaveOccurred) {
2135
- const gated = this._slot.handle !== null && !this._wave.hasCalledFnOnce && !(this._slot.partial || this._allDepsSettled());
2136
- if (this._wave.pending > 0 || gated) return;
2137
- this._control.pausedDepWaveOccurred = false;
2138
- this._markDirty();
2139
- this._tryRun();
2140
- }
2380
+ nodeFirePullDemand(nodeRuntimeHost(this));
2141
2381
  }
2142
- /**
2143
- * R-pull (D55/D59): fire a demand that was OWED (deferred at demand time) once the node becomes
2144
- * able — called from the dep-settle arms (DATA/RESOLVED/INVALIDATE/terminal drain _pending, pin-5
2145
- * + B1/F6) and from `_pauseRelease` (an external PAUSE lock releases, F4/F5).
2146
- */
2147
2382
  _fireOwedDemandIfReady() {
2148
- if (this._control.inDeliverDemand) return;
2149
- if (this._slot.pull && this._control.demandOwed && this._canFireDemand())
2150
- this._deliverPullDemand();
2383
+ nodeFireOwedDemandIfReady(nodeRuntimeHost(this));
2151
2384
  }
2152
- /** Should an outgoing settle slice be deferred into the pause buffer? */
2153
2385
  _shouldBufferOnPause() {
2154
- if (this._slot.pausable === false) return false;
2155
- if (!this._isPaused()) return false;
2156
- if (this._slot.pausable === "resumeAll") return true;
2157
- if (!this._wave.insideRunWave && this._isAsyncPool() && this._slot.deps.length > 0) return true;
2158
- return false;
2386
+ return nodeShouldBufferOnPause(nodeRuntimeHost(this));
2159
2387
  }
2160
- /** R-invalidate-idempotent: clear cache + flush + cascade; no-op if nothing cached. */
2161
2388
  _invalidate(delivery) {
2162
- if (!this._value.hasData) return;
2163
- this._value.cache = SENTINEL;
2164
- this._value.hasData = false;
2165
- this._value.status = "sentinel";
2166
- this._value.replayRing = [];
2167
- for (const fn of this._hooks.onInvalidate) fn();
2168
- this._emitToSubs(["INVALIDATE"], delivery);
2169
- }
2170
- // B42 (R-deps-terminal): ALL deps TERMINAL = every dep has reached COMPLETE *or* an ABSORBED
2171
- // ERROR. Block only on a LIVE dep (_depTerminal[i] === undefined); an errored dep (terminal = the
2172
- // error payload, which R-data-payload guarantees is !== undefined and non-boolean) COUNTS as
2173
- // terminal-done. Was
2174
- // `tm !== true`, which wedged a node whose errorWhenDepsError:false dep ERRORed (it never
2175
- // auto-completed even after every other dep completed). Drives the completeWhenDepsComplete cascade.
2389
+ nodeInvalidate(nodeRuntimeHost(this), delivery);
2390
+ }
2176
2391
  _allDepsTerminal() {
2177
- if (this._slot.deps.length === 0) return false;
2178
- for (const tm of this._dep.terminal) if (tm === void 0) return false;
2179
- return true;
2392
+ return nodeAllDepsTerminal(nodeRuntimeHost(this));
2393
+ }
2394
+ _emitToSubs(msg, delivery) {
2395
+ nodeEmitToSubs(nodeRuntimeHost(this), msg, delivery);
2180
2396
  }
2181
2397
  /** R-terminal: resubscribable reset clears terminal + dep state + re-arms the gate. */
2182
2398
  _resetLifecycle() {
2183
- for (const u of this._dep.unsubs) if (u) u();
2184
- this._dep.unsubs = [];
2185
- this._dep.idxBoxes = [];
2186
- this._lifecycle.subscribers.clear();
2187
- this._lifecycle.activated = false;
2188
- this._value.terminal = void 0;
2189
- this._value.hasTorndown = false;
2190
- this._wave.hasCalledFnOnce = false;
2191
- this._resetDepState();
2192
- this._control.pauseLockset.clear();
2193
- this._control.pauseBuffer = [];
2194
- this._control.pausedDepWaveOccurred = false;
2195
- this._control.demandOwed = false;
2196
- this._value.replayRing = [];
2197
- const isCompute = this._slot.handle !== null || this._slot.deps.length > 0;
2198
- if (isCompute) {
2199
- this._value.cache = SENTINEL;
2200
- this._value.hasData = false;
2201
- this._value.status = "sentinel";
2202
- } else {
2203
- this._value.status = this._value.hasData ? "settled" : "sentinel";
2204
- }
2205
- if (!this._privateState.persist) this._privateState.value = SENTINEL;
2206
- }
2207
- _emitToSubs(msg, delivery) {
2208
- if (this._released) return;
2209
- const subs = [...this._lifecycle.subscribers];
2210
- for (const sink of subs) sink(msg, delivery);
2399
+ nodeResetLifecycle(nodeRuntimeHost(this));
2211
2400
  }
2212
2401
  /** Batch commit (R-batch-coalesce): deliver the deferred tier-3 wave now. */
2213
2402
  __commitBatchedWave(wave) {
2214
- this._wave.batchDirtyOwed = false;
2215
- this._down(wave);
2403
+ nodeCommitBatchedWave(nodeRuntimeHost(this), wave);
2216
2404
  }
2217
2405
  /** Batch rollback: balance the immediate DIRTY with a RESOLVED so downstream un-dirties. */
2218
2406
  __rollbackBatched() {
2219
- if (this._wave.batchDirtyOwed) {
2220
- this._wave.batchDirtyOwed = false;
2221
- this._wave.emittedDirtyThisWave = false;
2222
- this._value.status = this._value.hasData ? "settled" : "sentinel";
2223
- this._emitToSubs(["RESOLVED"]);
2224
- }
2407
+ nodeRollbackBatched(nodeRuntimeHost(this));
2225
2408
  }
2226
2409
  /** B49: enqueue a committed-boundary task on this node's graph-local core. */
2227
2410
  __deferBoundary(fn, batchToken) {
2228
- deferRewire(this._core, fn, {
2229
- batchToken,
2230
- isReady: () => !this._hasBoundaryPauseLock()
2231
- });
2411
+ nodeDeferBoundary(nodeRuntimeHost(this), fn, batchToken);
2232
2412
  }
2233
2413
  };
2234
2414
  function node(deps = [], handleOrFn = null, opts = {}) {
@@ -2246,8 +2426,6 @@ export {
2246
2426
  EnvironmentDrivers,
2247
2427
  fetchHttpDriver,
2248
2428
  domWebSocketDriver,
2249
- defaultNodeVersionHash,
2250
- validateNodeVersionJson,
2251
2429
  withNodeCore,
2252
2430
  withEnvironmentDrivers,
2253
2431
  getNodeOwner,
@@ -2260,8 +2438,10 @@ export {
2260
2438
  subscriberCountOfNode,
2261
2439
  isNodeActiveForRelease,
2262
2440
  isNodeRuntimeReleased,
2441
+ defaultNodeVersionHash,
2442
+ validateNodeVersionJson,
2263
2443
  Node,
2264
2444
  node,
2265
2445
  dynamicNode
2266
2446
  };
2267
- //# sourceMappingURL=chunk-I3IHOHCJ.js.map
2447
+ //# sourceMappingURL=chunk-SHZDP2MQ.js.map