@logixjs/core 0.0.1 → 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 (300) hide show
  1. package/LICENSE +201 -0
  2. package/dist/{Bound-BN1DQ_lM.d.ts → Bound-CEa1ihvH.d.ts} +2 -2
  3. package/dist/{Bound-BPIfH9SS.d.cts → Bound-CNLNkC7c.d.cts} +2 -2
  4. package/dist/Bound.cjs +620 -163
  5. package/dist/Bound.cjs.map +1 -1
  6. package/dist/Bound.d.cts +3 -3
  7. package/dist/Bound.d.ts +3 -3
  8. package/dist/Bound.js +14 -14
  9. package/dist/{Debug-Bq8Sqjcr.d.cts → Debug-BhMYr-1i.d.cts} +3 -3
  10. package/dist/{Debug-B5q5Bkzx.d.ts → Debug-ByM7m4Ft.d.ts} +3 -3
  11. package/dist/Debug.cjs +553 -32
  12. package/dist/Debug.cjs.map +1 -1
  13. package/dist/Debug.d.cts +10 -8
  14. package/dist/Debug.d.ts +10 -8
  15. package/dist/Debug.js +12 -10
  16. package/dist/EffectOp.cjs.map +1 -1
  17. package/dist/EffectOp.js +2 -3
  18. package/dist/EffectOp.js.map +1 -1
  19. package/dist/Env.cjs +664 -6
  20. package/dist/Env.cjs.map +1 -1
  21. package/dist/Env.js +5 -2
  22. package/dist/ExternalStore-BAz83PVq.d.cts +60 -0
  23. package/dist/ExternalStore-BYWPbYs8.d.ts +60 -0
  24. package/dist/ExternalStore.cjs +746 -0
  25. package/dist/ExternalStore.cjs.map +1 -0
  26. package/dist/ExternalStore.d.cts +4 -0
  27. package/dist/ExternalStore.d.ts +4 -0
  28. package/dist/ExternalStore.js +19 -0
  29. package/dist/ExternalStore.js.map +1 -0
  30. package/dist/{Flow-1fZT8MpX.d.cts → Flow-BlSoMmhV.d.cts} +2 -2
  31. package/dist/{Flow-BhpjE22E.d.ts → Flow-CQSGve5c.d.ts} +2 -2
  32. package/dist/Flow.cjs +2 -2
  33. package/dist/Flow.cjs.map +1 -1
  34. package/dist/Flow.d.cts +4 -4
  35. package/dist/Flow.d.ts +4 -4
  36. package/dist/Flow.js +7 -8
  37. package/dist/{Handle-D_cLW1Z3.d.ts → Handle-B7PSmsrY.d.ts} +1 -1
  38. package/dist/{Handle-D8D1zPb_.d.cts → Handle-ByovhL-c.d.cts} +1 -1
  39. package/dist/Handle.d.cts +3 -3
  40. package/dist/Handle.d.ts +3 -3
  41. package/dist/{Kernel-CnGE1Fyk.d.ts → Kernel-DGSpS4GM.d.ts} +2 -2
  42. package/dist/{Kernel-8kC-jOda.d.cts → Kernel-DZAk-Mrn.d.cts} +2 -2
  43. package/dist/Kernel.cjs +680 -22
  44. package/dist/Kernel.cjs.map +1 -1
  45. package/dist/Kernel.d.cts +10 -8
  46. package/dist/Kernel.d.ts +10 -8
  47. package/dist/Kernel.js +7 -4
  48. package/dist/{Link-Db7975nU.d.ts → Link-Cm4eR9n0.d.ts} +10 -3
  49. package/dist/{Link-fX8x1eCK.d.cts → Link-DF8i8iWR.d.cts} +10 -3
  50. package/dist/Link.cjs +1128 -86
  51. package/dist/Link.cjs.map +1 -1
  52. package/dist/Link.d.cts +3 -3
  53. package/dist/Link.d.ts +3 -3
  54. package/dist/Link.js +30 -25
  55. package/dist/{Logic-DRh4sDZj.d.cts → Logic-BcQA0AvE.d.cts} +1 -1
  56. package/dist/{Logic-BRjEMr-W.d.ts → Logic-OotSE1xw.d.ts} +1 -1
  57. package/dist/Logic.d.cts +3 -3
  58. package/dist/Logic.d.ts +3 -3
  59. package/dist/{MatchBuilder-CJk5oCkR.d.cts → MatchBuilder-BNDJ8waF.d.ts} +1 -1
  60. package/dist/{MatchBuilder-0QOc-nlU.d.ts → MatchBuilder-CvZ5WY1B.d.cts} +1 -1
  61. package/dist/MatchBuilder.d.cts +4 -4
  62. package/dist/MatchBuilder.d.ts +4 -4
  63. package/dist/Middleware-D8tUDLv_.d.cts +100 -0
  64. package/dist/Middleware-DS7CbTTN.d.ts +100 -0
  65. package/dist/Middleware.cjs +461 -13
  66. package/dist/Middleware.cjs.map +1 -1
  67. package/dist/Middleware.d.cts +2 -86
  68. package/dist/Middleware.d.ts +2 -86
  69. package/dist/Middleware.js +13 -11
  70. package/dist/{Module-DnzluX2J.d.ts → Module-CFj0I2yE.d.ts} +45 -18
  71. package/dist/{Module-B_0xRDMR.d.cts → Module-DpXPW9EQ.d.cts} +45 -18
  72. package/dist/Module.cjs +8583 -5741
  73. package/dist/Module.cjs.map +1 -1
  74. package/dist/Module.d.cts +5 -4
  75. package/dist/Module.d.ts +5 -4
  76. package/dist/Module.js +32 -27
  77. package/dist/ModuleTag-BcVF6z7B.d.ts +113 -0
  78. package/dist/ModuleTag-DuZXo_NS.d.cts +113 -0
  79. package/dist/ModuleTag.cjs +2609 -1232
  80. package/dist/ModuleTag.cjs.map +1 -1
  81. package/dist/ModuleTag.d.cts +4 -4
  82. package/dist/ModuleTag.d.ts +4 -4
  83. package/dist/ModuleTag.js +28 -25
  84. package/dist/{Observability-cY4kLn0S.d.ts → Observability-D-ZWeEVb.d.ts} +22 -15
  85. package/dist/{Observability-COqEvp2C.d.cts → Observability-V7sRMYTh.d.cts} +22 -15
  86. package/dist/Observability.cjs +1938 -640
  87. package/dist/Observability.cjs.map +1 -1
  88. package/dist/Observability.d.cts +4 -4
  89. package/dist/Observability.d.ts +4 -4
  90. package/dist/Observability.js +21 -19
  91. package/dist/{Process-mL8fHDSB.d.cts → Process-B55aJMFk.d.cts} +29 -4
  92. package/dist/{Process-CM9xbMdP.d.ts → Process-DvhFEwUS.d.ts} +29 -4
  93. package/dist/Process.cjs +1122 -85
  94. package/dist/Process.cjs.map +1 -1
  95. package/dist/Process.d.cts +4 -3
  96. package/dist/Process.d.ts +4 -3
  97. package/dist/Process.js +27 -22
  98. package/dist/{ReadQuery-BlMwhe-F.d.ts → ReadQuery-C4vZ8Prc.d.ts} +2 -2
  99. package/dist/{ReadQuery-SinbStGF.d.ts → ReadQuery-CafjlJQo.d.cts} +1 -1
  100. package/dist/{ReadQuery-SinbStGF.d.cts → ReadQuery-CafjlJQo.d.ts} +1 -1
  101. package/dist/{ReadQuery-CL5XlXts.d.cts → ReadQuery-mc0NgrFV.d.cts} +2 -2
  102. package/dist/ReadQuery.cjs +3 -3
  103. package/dist/ReadQuery.cjs.map +1 -1
  104. package/dist/ReadQuery.d.cts +2 -2
  105. package/dist/ReadQuery.d.ts +2 -2
  106. package/dist/ReadQuery.js +3 -3
  107. package/dist/{Reflection-CQnKwPXj.d.ts → Reflection-C8xZ267q.d.ts} +88 -7
  108. package/dist/{Reflection-Kabo1mlU.d.cts → Reflection-DP7Vsv3f.d.cts} +88 -7
  109. package/dist/Reflection.cjs +2934 -1553
  110. package/dist/Reflection.cjs.map +1 -1
  111. package/dist/Reflection.d.cts +14 -11
  112. package/dist/Reflection.d.ts +14 -11
  113. package/dist/Reflection.js +26 -21
  114. package/dist/Resource.cjs +670 -12
  115. package/dist/Resource.cjs.map +1 -1
  116. package/dist/Resource.js +6 -3
  117. package/dist/Root.cjs +675 -17
  118. package/dist/Root.cjs.map +1 -1
  119. package/dist/Root.js +7 -3
  120. package/dist/{Runtime-CtyzZG4i.d.ts → Runtime-BWc9YfUB.d.ts} +37 -7
  121. package/dist/{Runtime-B-aL-f29.d.cts → Runtime-PShIC4DW.d.cts} +37 -7
  122. package/dist/Runtime.cjs +1899 -809
  123. package/dist/Runtime.cjs.map +1 -1
  124. package/dist/Runtime.d.cts +14 -11
  125. package/dist/Runtime.d.ts +14 -11
  126. package/dist/Runtime.js +33 -28
  127. package/dist/ScopeRegistry.cjs +668 -10
  128. package/dist/ScopeRegistry.cjs.map +1 -1
  129. package/dist/ScopeRegistry.js +6 -3
  130. package/dist/{StateTrait-OWhbj12c.d.cts → StateTrait-CQsDlXJm.d.cts} +23 -6
  131. package/dist/{StateTrait-BGsZghTz.d.ts → StateTrait-YvJzVDKl.d.ts} +23 -6
  132. package/dist/StateTrait.cjs +1475 -370
  133. package/dist/StateTrait.cjs.map +1 -1
  134. package/dist/StateTrait.d.cts +7 -5
  135. package/dist/StateTrait.d.ts +7 -5
  136. package/dist/StateTrait.js +17 -14
  137. package/dist/{TraitLifecycle-LdIWmKlg.d.ts → TraitLifecycle-CjIBICAA.d.ts} +2 -2
  138. package/dist/{TraitLifecycle-CwV5WPFX.d.cts → TraitLifecycle-NmqGiXPC.d.cts} +2 -2
  139. package/dist/TraitLifecycle.cjs +489 -32
  140. package/dist/TraitLifecycle.cjs.map +1 -1
  141. package/dist/TraitLifecycle.d.cts +4 -4
  142. package/dist/TraitLifecycle.d.ts +4 -4
  143. package/dist/TraitLifecycle.js +7 -7
  144. package/dist/Workflow-BlFG_20_.d.cts +414 -0
  145. package/dist/Workflow-CW9S_aAP.d.ts +414 -0
  146. package/dist/Workflow.cjs +2977 -0
  147. package/dist/Workflow.cjs.map +1 -0
  148. package/dist/Workflow.d.cts +7 -0
  149. package/dist/Workflow.d.ts +7 -0
  150. package/dist/Workflow.js +55 -0
  151. package/dist/Workflow.js.map +1 -0
  152. package/dist/{chunk-G5ZBFPNU.js → chunk-2A4UKO2D.js} +2 -2
  153. package/dist/chunk-2DE6D42I.js +248 -0
  154. package/dist/chunk-2DE6D42I.js.map +1 -0
  155. package/dist/{chunk-ANLBCBDC.js → chunk-2DVLMSOE.js} +6 -6
  156. package/dist/{chunk-BE3HW4FY.js → chunk-34CF6OGE.js} +14 -16
  157. package/dist/chunk-34CF6OGE.js.map +1 -0
  158. package/dist/{chunk-ZFY7U2FR.js → chunk-3LPIXG56.js} +43 -3
  159. package/dist/chunk-3LPIXG56.js.map +1 -0
  160. package/dist/chunk-3VZYDNXZ.js +10 -0
  161. package/dist/chunk-3VZYDNXZ.js.map +1 -0
  162. package/dist/{chunk-3TMODYZV.js → chunk-3XO4HR6V.js} +2 -2
  163. package/dist/chunk-46FGVWRF.js +817 -0
  164. package/dist/chunk-46FGVWRF.js.map +1 -0
  165. package/dist/chunk-4LODUXFI.js +288 -0
  166. package/dist/chunk-4LODUXFI.js.map +1 -0
  167. package/dist/{chunk-GMPEOUP2.js → chunk-4MZ7BT3R.js} +2 -2
  168. package/dist/chunk-4MZ7BT3R.js.map +1 -0
  169. package/dist/{chunk-TKZ7MEIA.js → chunk-53GVPGSM.js} +2 -2
  170. package/dist/{chunk-KP7MUZNX.js → chunk-5W2V2NVJ.js} +2 -2
  171. package/dist/chunk-5W2V2NVJ.js.map +1 -0
  172. package/dist/chunk-6DACKW3D.js +613 -0
  173. package/dist/chunk-6DACKW3D.js.map +1 -0
  174. package/dist/chunk-AQ7L2QZ5.js +1395 -0
  175. package/dist/chunk-AQ7L2QZ5.js.map +1 -0
  176. package/dist/{chunk-NZJKFF45.js → chunk-C2UZZQ76.js} +2 -2
  177. package/dist/chunk-CCKP5Z6F.js +701 -0
  178. package/dist/chunk-CCKP5Z6F.js.map +1 -0
  179. package/dist/chunk-CUKM2XUW.js +27 -0
  180. package/dist/{chunk-QCHIQWAJ.js.map → chunk-CUKM2XUW.js.map} +1 -1
  181. package/dist/{chunk-M2RGJPXX.js → chunk-DBD6Q6JH.js} +3 -3
  182. package/dist/{chunk-ZGDVUPTM.js → chunk-EB4RGQO3.js} +2 -2
  183. package/dist/{chunk-PAYXCY6A.js → chunk-G7ESIQTI.js} +12 -14
  184. package/dist/chunk-G7ESIQTI.js.map +1 -0
  185. package/dist/chunk-GPBAZQ23.js +348 -0
  186. package/dist/chunk-GPBAZQ23.js.map +1 -0
  187. package/dist/{chunk-OFADUJWJ.js → chunk-I4LCE5OY.js} +3 -5
  188. package/dist/{chunk-OFADUJWJ.js.map → chunk-I4LCE5OY.js.map} +1 -1
  189. package/dist/{chunk-DFNM3WX2.js → chunk-IMCC6TBN.js} +158 -39
  190. package/dist/chunk-IMCC6TBN.js.map +1 -0
  191. package/dist/{chunk-76WT3HOR.js → chunk-IROZNQAF.js} +22 -21
  192. package/dist/chunk-IROZNQAF.js.map +1 -0
  193. package/dist/{chunk-TAAPQVZN.js → chunk-ISKNULNH.js} +2 -2
  194. package/dist/chunk-J3CWXIPV.js +242 -0
  195. package/dist/chunk-J3CWXIPV.js.map +1 -0
  196. package/dist/{chunk-PYOE4VSI.js → chunk-JBKYRTCS.js} +224 -161
  197. package/dist/chunk-JBKYRTCS.js.map +1 -0
  198. package/dist/{chunk-66ALHVEX.js → chunk-KKIAYH4X.js} +3 -3
  199. package/dist/{chunk-3RMKLXHX.js → chunk-KLDVG3SY.js} +2 -2
  200. package/dist/{chunk-BABLDP24.js → chunk-KSZQYSEH.js} +3 -3
  201. package/dist/chunk-KSZQYSEH.js.map +1 -0
  202. package/dist/{chunk-CW6T36TN.js → chunk-M3M7JFAH.js} +4 -4
  203. package/dist/chunk-M3M7JFAH.js.map +1 -0
  204. package/dist/{chunk-THATMZXD.js → chunk-MLB253V2.js} +2 -2
  205. package/dist/{chunk-THATMZXD.js.map → chunk-MLB253V2.js.map} +1 -1
  206. package/dist/{chunk-JGIWG6SR.js → chunk-MS77U77X.js} +664 -550
  207. package/dist/chunk-MS77U77X.js.map +1 -0
  208. package/dist/chunk-MW4FA3MW.js +23 -0
  209. package/dist/chunk-MW4FA3MW.js.map +1 -0
  210. package/dist/chunk-MYKNINNN.js +228 -0
  211. package/dist/chunk-MYKNINNN.js.map +1 -0
  212. package/dist/{chunk-4CQAV7YB.js → chunk-O6TTQXTY.js} +2 -2
  213. package/dist/{chunk-NBD3KUOZ.js → chunk-OJDJ4VDQ.js} +35 -24
  214. package/dist/chunk-OJDJ4VDQ.js.map +1 -0
  215. package/dist/{chunk-NQZ2OSGR.js → chunk-PVZEMNJY.js} +9 -9
  216. package/dist/chunk-PVZEMNJY.js.map +1 -0
  217. package/dist/chunk-RN26DV2M.js +271 -0
  218. package/dist/chunk-RN26DV2M.js.map +1 -0
  219. package/dist/{chunk-JCXGZRMU.js → chunk-RQQW3IQC.js} +3 -3
  220. package/dist/chunk-RQQW3IQC.js.map +1 -0
  221. package/dist/{chunk-24VULZ7A.js → chunk-TKOGZDD6.js} +3 -3
  222. package/dist/{chunk-EGK3KN7B.js → chunk-TQYLVXGY.js} +70 -39
  223. package/dist/chunk-TQYLVXGY.js.map +1 -0
  224. package/dist/{chunk-QMM6O4CD.js → chunk-UACD2CL2.js} +15 -3
  225. package/dist/{chunk-QMM6O4CD.js.map → chunk-UACD2CL2.js.map} +1 -1
  226. package/dist/{chunk-M3WTHJHJ.js → chunk-VH575UTV.js} +30 -34
  227. package/dist/chunk-VH575UTV.js.map +1 -0
  228. package/dist/{chunk-AUIR5O6W.js → chunk-WWBMC24F.js} +9 -15
  229. package/dist/chunk-WWBMC24F.js.map +1 -0
  230. package/dist/{chunk-JWOYLO27.js → chunk-WYJUJV4L.js} +80 -7
  231. package/dist/chunk-WYJUJV4L.js.map +1 -0
  232. package/dist/{chunk-EY4NZKDR.js → chunk-XFMMPYNU.js} +2 -2
  233. package/dist/chunk-Y4VRBIS6.js +35 -0
  234. package/dist/chunk-Y4VRBIS6.js.map +1 -0
  235. package/dist/{chunk-DMBALCE2.js → chunk-ZC7MSQ5U.js} +77 -4
  236. package/dist/chunk-ZC7MSQ5U.js.map +1 -0
  237. package/dist/{chunk-OGWBVHB3.js → chunk-ZCK6SCOE.js} +67 -8
  238. package/dist/chunk-ZCK6SCOE.js.map +1 -0
  239. package/dist/{chunk-IHVBV5C2.js → chunk-ZTFTABXV.js} +2 -1
  240. package/dist/chunk-ZTFTABXV.js.map +1 -0
  241. package/dist/index.cjs +9532 -5017
  242. package/dist/index.cjs.map +1 -1
  243. package/dist/index.d.cts +163 -27
  244. package/dist/index.d.ts +163 -27
  245. package/dist/index.js +119 -56
  246. package/dist/index.js.map +1 -1
  247. package/dist/{ir-BMP7yxJJ.d.cts → ir-C-Zm_GlZ.d.cts} +1 -1
  248. package/dist/{ir-DUOz6H-5.d.ts → ir-DGyGiwVe.d.ts} +1 -1
  249. package/dist/{module-k7m3txak.d.ts → module-DqQ1U-Me.d.ts} +129 -100
  250. package/dist/{module-B8CBqIZ_.d.cts → module-doenaCsZ.d.cts} +129 -100
  251. package/package.json +12 -1
  252. package/dist/ModuleTag-C8FHY_sY.d.ts +0 -93
  253. package/dist/ModuleTag-EGbgBMpZ.d.cts +0 -93
  254. package/dist/chunk-3QMIVH35.js +0 -43
  255. package/dist/chunk-3QMIVH35.js.map +0 -1
  256. package/dist/chunk-76WT3HOR.js.map +0 -1
  257. package/dist/chunk-AUIR5O6W.js.map +0 -1
  258. package/dist/chunk-BABLDP24.js.map +0 -1
  259. package/dist/chunk-BE3HW4FY.js.map +0 -1
  260. package/dist/chunk-CW6T36TN.js.map +0 -1
  261. package/dist/chunk-DFNM3WX2.js.map +0 -1
  262. package/dist/chunk-DMBALCE2.js.map +0 -1
  263. package/dist/chunk-EGK3KN7B.js.map +0 -1
  264. package/dist/chunk-GMPEOUP2.js.map +0 -1
  265. package/dist/chunk-IHVBV5C2.js.map +0 -1
  266. package/dist/chunk-JCXGZRMU.js.map +0 -1
  267. package/dist/chunk-JGIWG6SR.js.map +0 -1
  268. package/dist/chunk-JWOYLO27.js.map +0 -1
  269. package/dist/chunk-KIXAU3GM.js +0 -137
  270. package/dist/chunk-KIXAU3GM.js.map +0 -1
  271. package/dist/chunk-KP7MUZNX.js.map +0 -1
  272. package/dist/chunk-M3WTHJHJ.js.map +0 -1
  273. package/dist/chunk-M7IYCTJV.js +0 -79
  274. package/dist/chunk-M7IYCTJV.js.map +0 -1
  275. package/dist/chunk-NBD3KUOZ.js.map +0 -1
  276. package/dist/chunk-NQZ2OSGR.js.map +0 -1
  277. package/dist/chunk-OGWBVHB3.js.map +0 -1
  278. package/dist/chunk-PAYXCY6A.js.map +0 -1
  279. package/dist/chunk-PYOE4VSI.js.map +0 -1
  280. package/dist/chunk-QCHIQWAJ.js +0 -21
  281. package/dist/chunk-VZB726PE.js +0 -93
  282. package/dist/chunk-VZB726PE.js.map +0 -1
  283. package/dist/chunk-W3TEWHLO.js +0 -568
  284. package/dist/chunk-W3TEWHLO.js.map +0 -1
  285. package/dist/chunk-ZFLHVFUC.js +0 -192
  286. package/dist/chunk-ZFLHVFUC.js.map +0 -1
  287. package/dist/chunk-ZFY7U2FR.js.map +0 -1
  288. /package/dist/{chunk-G5ZBFPNU.js.map → chunk-2A4UKO2D.js.map} +0 -0
  289. /package/dist/{chunk-ANLBCBDC.js.map → chunk-2DVLMSOE.js.map} +0 -0
  290. /package/dist/{chunk-3TMODYZV.js.map → chunk-3XO4HR6V.js.map} +0 -0
  291. /package/dist/{chunk-TKZ7MEIA.js.map → chunk-53GVPGSM.js.map} +0 -0
  292. /package/dist/{chunk-NZJKFF45.js.map → chunk-C2UZZQ76.js.map} +0 -0
  293. /package/dist/{chunk-M2RGJPXX.js.map → chunk-DBD6Q6JH.js.map} +0 -0
  294. /package/dist/{chunk-ZGDVUPTM.js.map → chunk-EB4RGQO3.js.map} +0 -0
  295. /package/dist/{chunk-TAAPQVZN.js.map → chunk-ISKNULNH.js.map} +0 -0
  296. /package/dist/{chunk-66ALHVEX.js.map → chunk-KKIAYH4X.js.map} +0 -0
  297. /package/dist/{chunk-3RMKLXHX.js.map → chunk-KLDVG3SY.js.map} +0 -0
  298. /package/dist/{chunk-4CQAV7YB.js.map → chunk-O6TTQXTY.js.map} +0 -0
  299. /package/dist/{chunk-24VULZ7A.js.map → chunk-TKOGZDD6.js.map} +0 -0
  300. /package/dist/{chunk-EY4NZKDR.js.map → chunk-XFMMPYNU.js.map} +0 -0
package/dist/Link.cjs CHANGED
@@ -30,15 +30,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/Link.ts
31
31
  var Link_exports = {};
32
32
  __export(Link_exports, {
33
- make: () => make7
33
+ make: () => make8,
34
+ makeDeclarative: () => makeDeclarative
34
35
  });
35
36
  module.exports = __toCommonJS(Link_exports);
36
37
 
38
+ // src/Process.ts
39
+ var import_effect53 = require("effect");
40
+
37
41
  // src/internal/runtime/ModuleFactory.ts
38
- var import_effect48 = require("effect");
42
+ var import_effect52 = require("effect");
39
43
 
40
- // src/internal/runtime/core/ModuleRuntime.ts
41
- var import_effect42 = require("effect");
44
+ // src/internal/runtime/core/ModuleRuntime.impl.ts
45
+ var import_effect46 = require("effect");
42
46
 
43
47
  // src/internal/runtime/core/Lifecycle.ts
44
48
  var import_effect4 = require("effect");
@@ -46,7 +50,7 @@ var import_effect4 = require("effect");
46
50
  // src/internal/runtime/core/errorSummary.ts
47
51
  var import_effect = require("effect");
48
52
 
49
- // src/internal/runtime/core/DebugSink.ts
53
+ // src/internal/runtime/core/DebugSink.record.ts
50
54
  var import_effect3 = require("effect");
51
55
 
52
56
  // src/internal/observability/jsonValue.ts
@@ -65,7 +69,7 @@ var currentLinkId = import_effect2.FiberRef.unsafeMake(void 0);
65
69
  var EffectOpMiddlewareTag = class extends import_effect2.Context.Tag("Logix/EffectOpMiddleware")() {
66
70
  };
67
71
 
68
- // src/internal/runtime/core/DebugSink.ts
72
+ // src/internal/runtime/core/DebugSink.record.ts
69
73
  var currentDebugSinks = import_effect3.FiberRef.unsafeMake([]);
70
74
  var currentRuntimeLabel = import_effect3.FiberRef.unsafeMake(void 0);
71
75
  var currentTxnId = import_effect3.FiberRef.unsafeMake(void 0);
@@ -129,6 +133,7 @@ var errorOnlySink = {
129
133
  record: (event) => event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" && event.severity !== "info" ? diagnosticLog(event) : import_effect3.Effect.void
130
134
  };
131
135
  var errorOnlyLayer = import_effect3.Layer.locallyScoped(currentDebugSinks, [errorOnlySink]);
136
+ var isErrorOnlyOnlySinks = (sinks) => sinks.length === 1 && sinks[0] === errorOnlySink;
132
137
  var consoleSink = {
133
138
  record: (event) => event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" ? diagnosticLog(event) : import_effect3.Effect.logDebug({ debugEvent: event })
134
139
  };
@@ -238,6 +243,82 @@ var browserPrettyLoggerLayer = import_effect3.Logger.replace(
238
243
  import_effect3.Logger.defaultLogger,
239
244
  import_effect3.Logger.prettyLogger({ mode: "browser", colors: true })
240
245
  );
246
+ var record = (event) => import_effect3.Effect.gen(function* () {
247
+ const sinks = yield* import_effect3.FiberRef.get(currentDebugSinks);
248
+ if (isErrorOnlyOnlySinks(sinks)) {
249
+ if (event.type === "lifecycle:error") {
250
+ yield* lifecycleErrorLog(event);
251
+ return;
252
+ }
253
+ if (event.type === "diagnostic") {
254
+ if (event.severity !== "info") {
255
+ yield* diagnosticLog(event);
256
+ } else {
257
+ yield* import_effect3.Effect.void;
258
+ }
259
+ return;
260
+ }
261
+ yield* import_effect3.Effect.void;
262
+ return;
263
+ }
264
+ if (sinks.length === 0) {
265
+ if (isBrowser) {
266
+ if (event.type === "lifecycle:error" || event.type === "diagnostic") {
267
+ yield* renderBrowserConsoleEvent(event);
268
+ return;
269
+ }
270
+ yield* import_effect3.Effect.void;
271
+ return;
272
+ }
273
+ if (event.type === "lifecycle:error") {
274
+ yield* lifecycleErrorLog(event);
275
+ return;
276
+ }
277
+ if (event.type === "diagnostic") {
278
+ yield* diagnosticLog(event);
279
+ return;
280
+ }
281
+ yield* import_effect3.Effect.void;
282
+ return;
283
+ }
284
+ const enriched = event;
285
+ const diagnosticsLevel = yield* import_effect3.FiberRef.get(currentDiagnosticsLevel);
286
+ let now;
287
+ const getNow = () => {
288
+ if (now === void 0) now = Date.now();
289
+ return now;
290
+ };
291
+ if (enriched.timestamp === void 0 && (diagnosticsLevel !== "off" || enriched.type === "lifecycle:error" || enriched.type === "diagnostic")) {
292
+ ;
293
+ enriched.timestamp = getNow();
294
+ }
295
+ if (diagnosticsLevel !== "off" && enriched.runtimeLabel === void 0) {
296
+ const runtimeLabel = yield* import_effect3.FiberRef.get(currentRuntimeLabel);
297
+ if (runtimeLabel) {
298
+ ;
299
+ enriched.runtimeLabel = runtimeLabel;
300
+ }
301
+ }
302
+ if (enriched.type === "diagnostic" && enriched.txnId === void 0) {
303
+ const txnId = yield* import_effect3.FiberRef.get(currentTxnId);
304
+ if (txnId) {
305
+ ;
306
+ enriched.txnId = txnId;
307
+ }
308
+ }
309
+ if (diagnosticsLevel !== "off" && enriched.type === "trace:effectop" && enriched.linkId === void 0) {
310
+ const linkId = yield* import_effect3.FiberRef.get(currentLinkId);
311
+ if (linkId) {
312
+ ;
313
+ enriched.linkId = linkId;
314
+ }
315
+ }
316
+ if (sinks.length === 1) {
317
+ yield* sinks[0].record(enriched);
318
+ return;
319
+ }
320
+ yield* import_effect3.Effect.forEach(sinks, (sink) => sink.record(enriched), { discard: true });
321
+ });
241
322
 
242
323
  // src/internal/runtime/core/Lifecycle.ts
243
324
  var LifecycleContext = import_effect4.Context.GenericTag("@logixjs/LifecycleManager");
@@ -250,96 +331,583 @@ var currentConvergeStaticIrCollectors = import_effect5.FiberRef.unsafeMake([]);
250
331
  var import_effect6 = require("effect");
251
332
 
252
333
  // src/internal/runtime/core/RuntimeKernel.ts
253
- var import_effect8 = require("effect");
334
+ var import_effect12 = require("effect");
254
335
 
255
336
  // src/internal/runtime/core/env.ts
337
+ var import_effect11 = require("effect");
338
+
339
+ // src/internal/runtime/core/HostScheduler.ts
340
+ var noopCancel = () => {
341
+ };
342
+ var safeNowMs = () => {
343
+ const perf = globalThis.performance;
344
+ if (perf && typeof perf.now === "function") {
345
+ try {
346
+ const v = perf.now();
347
+ if (typeof v === "number" && Number.isFinite(v)) return v;
348
+ } catch {
349
+ }
350
+ }
351
+ return Date.now();
352
+ };
353
+ var safeQueueMicrotask = (cb) => {
354
+ const qm = globalThis.queueMicrotask;
355
+ if (typeof qm === "function") {
356
+ try {
357
+ qm(cb);
358
+ return;
359
+ } catch {
360
+ }
361
+ }
362
+ try {
363
+ Promise.resolve().then(cb);
364
+ } catch {
365
+ setTimeout(cb, 0);
366
+ }
367
+ };
368
+ var safeSetTimeout = (ms, cb) => {
369
+ const id = setTimeout(cb, ms);
370
+ return () => {
371
+ try {
372
+ clearTimeout(id);
373
+ } catch {
374
+ }
375
+ };
376
+ };
377
+ var makeMessageChannelMacrotask = () => {
378
+ const MC = globalThis.MessageChannel;
379
+ if (typeof MC !== "function") return void 0;
380
+ let channel;
381
+ try {
382
+ channel = new MC();
383
+ } catch {
384
+ return void 0;
385
+ }
386
+ const queue = [];
387
+ let scheduled = false;
388
+ const flush = () => {
389
+ scheduled = false;
390
+ const tasks = queue.splice(0, queue.length);
391
+ for (const t of tasks) {
392
+ if (t.canceled) continue;
393
+ try {
394
+ t.cb();
395
+ } catch {
396
+ }
397
+ }
398
+ };
399
+ try {
400
+ channel.port1.onmessage = flush;
401
+ } catch {
402
+ return void 0;
403
+ }
404
+ const schedule = (cb) => {
405
+ const task = { canceled: false, cb };
406
+ queue.push(task);
407
+ if (!scheduled) {
408
+ scheduled = true;
409
+ try {
410
+ channel.port2.postMessage(void 0);
411
+ } catch {
412
+ scheduled = false;
413
+ return safeSetTimeout(0, cb);
414
+ }
415
+ }
416
+ return () => {
417
+ task.canceled = true;
418
+ };
419
+ };
420
+ return schedule;
421
+ };
422
+ var makeSetImmediateMacrotask = () => {
423
+ const si = globalThis.setImmediate;
424
+ const ci = globalThis.clearImmediate;
425
+ if (typeof si !== "function") return void 0;
426
+ return (cb) => {
427
+ let id;
428
+ try {
429
+ id = si(cb);
430
+ } catch {
431
+ return safeSetTimeout(0, cb);
432
+ }
433
+ return () => {
434
+ if (typeof ci !== "function") return;
435
+ try {
436
+ ci(id);
437
+ } catch {
438
+ }
439
+ };
440
+ };
441
+ };
442
+ var makeRaf = () => {
443
+ const raf = globalThis.requestAnimationFrame;
444
+ const cancel = globalThis.cancelAnimationFrame;
445
+ if (typeof raf !== "function") return void 0;
446
+ return (cb) => {
447
+ let id;
448
+ try {
449
+ id = raf(cb);
450
+ } catch {
451
+ return noopCancel;
452
+ }
453
+ return () => {
454
+ if (typeof cancel !== "function") return;
455
+ try {
456
+ cancel(id);
457
+ } catch {
458
+ }
459
+ };
460
+ };
461
+ };
462
+ var makeDefaultHostScheduler = () => {
463
+ const macrotask = makeSetImmediateMacrotask() ?? makeMessageChannelMacrotask() ?? ((cb) => safeSetTimeout(0, cb));
464
+ const raf = makeRaf();
465
+ return {
466
+ nowMs: safeNowMs,
467
+ scheduleMicrotask: safeQueueMicrotask,
468
+ scheduleMacrotask: macrotask,
469
+ scheduleAnimationFrame: (cb) => raf?.(cb) ?? macrotask(cb),
470
+ scheduleTimeout: safeSetTimeout
471
+ };
472
+ };
473
+ var globalHostScheduler;
474
+ var getGlobalHostScheduler = () => {
475
+ globalHostScheduler ?? (globalHostScheduler = makeDefaultHostScheduler());
476
+ return globalHostScheduler;
477
+ };
478
+
479
+ // src/internal/runtime/core/RuntimeStore.ts
480
+ var parseTopicKey = (topicKey) => {
481
+ const idx = topicKey.indexOf("::");
482
+ if (idx <= 0) return void 0;
483
+ const moduleId = topicKey.slice(0, idx);
484
+ const rest = topicKey.slice(idx + 2);
485
+ if (rest.length === 0) return void 0;
486
+ const idx2 = rest.indexOf("::");
487
+ if (idx2 < 0) {
488
+ return { kind: "module", moduleInstanceKey: `${moduleId}::${rest}` };
489
+ }
490
+ const instanceId = rest.slice(0, idx2);
491
+ const suffix = rest.slice(idx2 + 2);
492
+ if (suffix.startsWith("rq:")) {
493
+ const selectorId = suffix.slice("rq:".length);
494
+ if (selectorId.length === 0) return void 0;
495
+ return {
496
+ kind: "readQuery",
497
+ moduleInstanceKey: `${moduleId}::${instanceId}`,
498
+ selectorId
499
+ };
500
+ }
501
+ return { kind: "module", moduleInstanceKey: `${moduleId}::${instanceId}` };
502
+ };
503
+ var makeRuntimeStore = () => {
504
+ let tickSeq = 0;
505
+ const moduleStates = /* @__PURE__ */ new Map();
506
+ const topicVersions = /* @__PURE__ */ new Map();
507
+ const topicPriorities = /* @__PURE__ */ new Map();
508
+ const listenersByTopic = /* @__PURE__ */ new Map();
509
+ const subscriberCountByModule = /* @__PURE__ */ new Map();
510
+ const getTopicVersion = (topicKey) => topicVersions.get(topicKey) ?? 0;
511
+ const getTopicPriority = (topicKey) => topicPriorities.get(topicKey) ?? "normal";
512
+ const commitTopicBump = (topicKey, priority) => {
513
+ const prev = topicVersions.get(topicKey) ?? 0;
514
+ topicVersions.set(topicKey, prev + 1);
515
+ topicPriorities.set(topicKey, priority);
516
+ };
517
+ const subscribeTopic = (topicKey, listener) => {
518
+ const info = parseTopicKey(topicKey);
519
+ const existing = listenersByTopic.get(topicKey);
520
+ const set = existing ?? /* @__PURE__ */ new Set();
521
+ const alreadyHas = set.has(listener);
522
+ if (!alreadyHas) {
523
+ set.add(listener);
524
+ }
525
+ if (!existing) {
526
+ listenersByTopic.set(topicKey, set);
527
+ }
528
+ if (!alreadyHas && info) {
529
+ const prev = subscriberCountByModule.get(info.moduleInstanceKey) ?? 0;
530
+ subscriberCountByModule.set(info.moduleInstanceKey, prev + 1);
531
+ }
532
+ return () => {
533
+ const current = listenersByTopic.get(topicKey);
534
+ if (!current) return;
535
+ const deleted = current.delete(listener);
536
+ if (deleted && info) {
537
+ const prev = subscriberCountByModule.get(info.moduleInstanceKey) ?? 0;
538
+ const next = prev - 1;
539
+ if (next <= 0) {
540
+ subscriberCountByModule.delete(info.moduleInstanceKey);
541
+ } else {
542
+ subscriberCountByModule.set(info.moduleInstanceKey, next);
543
+ }
544
+ }
545
+ if (current.size === 0) {
546
+ listenersByTopic.delete(topicKey);
547
+ }
548
+ };
549
+ };
550
+ const getTopicSubscriberCount = (topicKey) => listenersByTopic.get(topicKey)?.size ?? 0;
551
+ const getModuleSubscriberCount = (moduleInstanceKey) => subscriberCountByModule.get(moduleInstanceKey) ?? 0;
552
+ const registerModuleInstance = (args) => {
553
+ moduleStates.set(args.moduleInstanceKey, args.initialState);
554
+ if (!topicVersions.has(args.moduleInstanceKey)) {
555
+ topicVersions.set(args.moduleInstanceKey, 0);
556
+ topicPriorities.set(args.moduleInstanceKey, "normal");
557
+ }
558
+ };
559
+ const unregisterModuleInstance = (moduleInstanceKey) => {
560
+ moduleStates.delete(moduleInstanceKey);
561
+ };
562
+ const commitTick = (args) => {
563
+ tickSeq = args.tickSeq;
564
+ for (const [key, commit2] of args.accepted.modules) {
565
+ moduleStates.set(key, commit2.state);
566
+ }
567
+ const changedTopics = /* @__PURE__ */ new Map();
568
+ for (const [topicKey, priority] of args.accepted.dirtyTopics) {
569
+ commitTopicBump(topicKey, priority);
570
+ const listeners = Array.from(listenersByTopic.get(topicKey) ?? []);
571
+ if (listeners.length > 0) {
572
+ changedTopics.set(topicKey, { priority, listeners });
573
+ }
574
+ }
575
+ return { changedTopics };
576
+ };
577
+ const getModuleState = (moduleInstanceKey) => moduleStates.get(moduleInstanceKey);
578
+ const dispose = () => {
579
+ moduleStates.clear();
580
+ topicVersions.clear();
581
+ topicPriorities.clear();
582
+ listenersByTopic.clear();
583
+ subscriberCountByModule.clear();
584
+ };
585
+ return {
586
+ getTickSeq: () => tickSeq,
587
+ getModuleState,
588
+ getTopicVersion,
589
+ getTopicPriority,
590
+ subscribeTopic,
591
+ getTopicSubscriberCount,
592
+ getModuleSubscriberCount,
593
+ registerModuleInstance,
594
+ unregisterModuleInstance,
595
+ commitTick,
596
+ dispose
597
+ };
598
+ };
599
+
600
+ // src/internal/runtime/core/TickScheduler.ts
601
+ var import_effect9 = require("effect");
602
+
603
+ // src/internal/runtime/core/DevtoolsHub.ts
256
604
  var import_effect7 = require("effect");
257
- var StateTransactionConfigTagImpl = class extends import_effect7.Context.Tag("@logixjs/core/StateTransactionRuntimeConfig")() {
605
+ var lastRunTs = 0;
606
+ var lastRunTsSeq = 0;
607
+ var nextRunId = () => {
608
+ const ts = Date.now();
609
+ if (ts === lastRunTs) {
610
+ lastRunTsSeq += 1;
611
+ } else {
612
+ lastRunTs = ts;
613
+ lastRunTsSeq = 0;
614
+ }
615
+ return lastRunTsSeq === 0 ? `run-${ts}` : `run-${ts}.${lastRunTsSeq}`;
258
616
  };
259
- var ReadQueryStrictGateConfigTagImpl = class extends import_effect7.Context.Tag("@logixjs/core/ReadQueryStrictGateRuntimeConfig")() {
617
+ var currentRunId = nextRunId();
618
+
619
+ // src/internal/runtime/core/TaskRunner.ts
620
+ var import_effect8 = require("effect");
621
+ var inSyncTransactionFiber = import_effect8.FiberRef.unsafeMake(false);
622
+ var forceSourceRefresh = import_effect8.FiberRef.unsafeMake(false);
623
+
624
+ // src/internal/runtime/core/DeclarativeLinkRuntime.ts
625
+ var import_effect10 = require("effect");
626
+ var makeDeclarativeLinkRuntime = () => {
627
+ const moduleAsSourceById = /* @__PURE__ */ new Map();
628
+ const moduleAsSourceIdsBySource = /* @__PURE__ */ new Map();
629
+ const declarativeById = /* @__PURE__ */ new Map();
630
+ const declarativeReadNodesBySource = /* @__PURE__ */ new Map();
631
+ const registerModuleAsSourceLink = (link2) => {
632
+ const stored = {
633
+ ...link2,
634
+ hasValue: false,
635
+ lastValue: void 0
636
+ };
637
+ moduleAsSourceById.set(link2.id, stored);
638
+ const set = moduleAsSourceIdsBySource.get(link2.sourceModuleInstanceKey) ?? /* @__PURE__ */ new Set();
639
+ set.add(link2.id);
640
+ moduleAsSourceIdsBySource.set(link2.sourceModuleInstanceKey, set);
641
+ return () => {
642
+ moduleAsSourceById.delete(link2.id);
643
+ const current = moduleAsSourceIdsBySource.get(link2.sourceModuleInstanceKey);
644
+ if (!current) return;
645
+ current.delete(link2.id);
646
+ if (current.size === 0) {
647
+ moduleAsSourceIdsBySource.delete(link2.sourceModuleInstanceKey);
648
+ }
649
+ };
650
+ };
651
+ const registerDeclarativeLink = (link2) => {
652
+ const readNodeById = /* @__PURE__ */ new Map();
653
+ for (const n of link2.readNodes) {
654
+ readNodeById.set(n.nodeId, n);
655
+ }
656
+ const dispatchNodeById = /* @__PURE__ */ new Map();
657
+ for (const n of link2.dispatchNodes) {
658
+ dispatchNodeById.set(n.nodeId, n);
659
+ }
660
+ const incomingByDispatch = /* @__PURE__ */ new Map();
661
+ for (const e of link2.ir.edges) {
662
+ const to = e.to;
663
+ const isDispatch = dispatchNodeById.has(to);
664
+ if (!isDispatch) continue;
665
+ incomingByDispatch.set(to, (incomingByDispatch.get(to) ?? 0) + 1);
666
+ const count = incomingByDispatch.get(to) ?? 0;
667
+ if (count > 1) {
668
+ throw new Error(
669
+ `[DeclarativeLinkRuntime] Invalid DeclarativeLinkIR: dispatch node has multiple incoming edges (linkId=${link2.linkId}, nodeId=${to}).`
670
+ );
671
+ }
672
+ }
673
+ const dispatchTargetsByReadNode = /* @__PURE__ */ new Map();
674
+ for (const e of link2.ir.edges) {
675
+ const from = e.from;
676
+ const to = e.to;
677
+ if (!readNodeById.has(from)) continue;
678
+ if (!dispatchNodeById.has(to)) continue;
679
+ const list = dispatchTargetsByReadNode.get(from) ?? [];
680
+ list.push(to);
681
+ dispatchTargetsByReadNode.set(from, list);
682
+ }
683
+ const stored = {
684
+ ...link2,
685
+ readNodeById,
686
+ dispatchNodeById,
687
+ dispatchTargetsByReadNode,
688
+ readNodeState: /* @__PURE__ */ new Map()
689
+ };
690
+ declarativeById.set(link2.linkId, stored);
691
+ for (const n of link2.readNodes) {
692
+ const list = declarativeReadNodesBySource.get(n.moduleInstanceKey) ?? [];
693
+ list.push({ linkId: link2.linkId, nodeId: n.nodeId });
694
+ declarativeReadNodesBySource.set(n.moduleInstanceKey, list);
695
+ }
696
+ return () => {
697
+ declarativeById.delete(link2.linkId);
698
+ for (const n of link2.readNodes) {
699
+ const list = declarativeReadNodesBySource.get(n.moduleInstanceKey);
700
+ if (!list) continue;
701
+ const next = list.filter((x) => !(x.linkId === link2.linkId && x.nodeId === n.nodeId));
702
+ if (next.length === 0) {
703
+ declarativeReadNodesBySource.delete(n.moduleInstanceKey);
704
+ } else {
705
+ declarativeReadNodesBySource.set(n.moduleInstanceKey, next);
706
+ }
707
+ }
708
+ };
709
+ };
710
+ const applyForSources = (args) => import_effect10.Effect.gen(function* () {
711
+ let scheduled = false;
712
+ for (const sourceKey of args.changedModuleInstanceKeys) {
713
+ const ids = moduleAsSourceIdsBySource.get(sourceKey);
714
+ if (!ids || ids.size === 0) continue;
715
+ const commit2 = args.acceptedModules.get(sourceKey);
716
+ if (!commit2) continue;
717
+ for (const id of ids) {
718
+ const link2 = moduleAsSourceById.get(id);
719
+ if (!link2) continue;
720
+ let selected;
721
+ try {
722
+ selected = link2.readQuery.select(commit2.state);
723
+ } catch {
724
+ continue;
725
+ }
726
+ const nextValue = link2.computeValue(selected);
727
+ if (link2.hasValue && link2.equalsValue(link2.lastValue, nextValue)) {
728
+ continue;
729
+ }
730
+ link2.hasValue = true;
731
+ link2.lastValue = nextValue;
732
+ scheduled = true;
733
+ yield* link2.applyValue(nextValue);
734
+ }
735
+ }
736
+ for (const sourceKey of args.changedModuleInstanceKeys) {
737
+ const refs = declarativeReadNodesBySource.get(sourceKey);
738
+ if (!refs || refs.length === 0) continue;
739
+ const commit2 = args.acceptedModules.get(sourceKey);
740
+ if (!commit2) continue;
741
+ for (const ref of refs) {
742
+ const link2 = declarativeById.get(ref.linkId);
743
+ if (!link2) continue;
744
+ const readNode = link2.readNodeById.get(ref.nodeId);
745
+ if (!readNode) continue;
746
+ let value;
747
+ try {
748
+ value = readNode.readQuery.select(commit2.state);
749
+ } catch {
750
+ continue;
751
+ }
752
+ const state = link2.readNodeState.get(ref.nodeId) ?? { hasValue: false, lastValue: void 0 };
753
+ const changed = !state.hasValue || !Object.is(state.lastValue, value);
754
+ if (!changed) continue;
755
+ state.hasValue = true;
756
+ state.lastValue = value;
757
+ link2.readNodeState.set(ref.nodeId, state);
758
+ const targets = link2.dispatchTargetsByReadNode.get(ref.nodeId) ?? [];
759
+ for (const dispatchNodeId of targets) {
760
+ const node = link2.dispatchNodeById.get(dispatchNodeId);
761
+ if (!node) continue;
762
+ scheduled = true;
763
+ yield* node.dispatch(value);
764
+ }
765
+ }
766
+ }
767
+ return { scheduled };
768
+ });
769
+ return {
770
+ registerModuleAsSourceLink,
771
+ registerDeclarativeLink,
772
+ applyForSources
773
+ };
774
+ };
775
+
776
+ // src/internal/runtime/core/env.ts
777
+ var StateTransactionConfigTagImpl = class extends import_effect11.Context.Tag("@logixjs/core/StateTransactionRuntimeConfig")() {
778
+ };
779
+ var ReadQueryStrictGateConfigTagImpl = class extends import_effect11.Context.Tag("@logixjs/core/ReadQueryStrictGateRuntimeConfig")() {
780
+ };
781
+ var ReplayModeConfigTagImpl = class extends import_effect11.Context.Tag("@logixjs/core/ReplayModeConfig")() {
782
+ };
783
+ var StateTransactionOverridesTagImpl = class extends import_effect11.Context.Tag("@logixjs/core/StateTransactionOverrides")() {
260
784
  };
261
- var ReplayModeConfigTagImpl = class extends import_effect7.Context.Tag("@logixjs/core/ReplayModeConfig")() {
785
+ var ConcurrencyPolicyTagImpl = class extends import_effect11.Context.Tag("@logixjs/core/ConcurrencyPolicy")() {
262
786
  };
263
- var StateTransactionOverridesTagImpl = class extends import_effect7.Context.Tag("@logixjs/core/StateTransactionOverrides")() {
787
+ var ConcurrencyPolicyOverridesTagImpl = class extends import_effect11.Context.Tag("@logixjs/core/ConcurrencyPolicyOverrides")() {
264
788
  };
265
- var ConcurrencyPolicyTagImpl = class extends import_effect7.Context.Tag("@logixjs/core/ConcurrencyPolicy")() {
789
+ var RuntimeStoreTag = class extends import_effect11.Context.Tag("@logixjs/core/RuntimeStore")() {
266
790
  };
267
- var ConcurrencyPolicyOverridesTagImpl = class extends import_effect7.Context.Tag("@logixjs/core/ConcurrencyPolicyOverrides")() {
791
+ var runtimeStoreLayer = import_effect11.Layer.scoped(
792
+ RuntimeStoreTag,
793
+ import_effect11.Effect.acquireRelease(
794
+ import_effect11.Effect.sync(() => makeRuntimeStore()),
795
+ (store) => import_effect11.Effect.sync(() => store.dispose())
796
+ )
797
+ );
798
+ var HostSchedulerTag = class extends import_effect11.Context.Tag("@logixjs/core/HostScheduler")() {
799
+ };
800
+ var hostSchedulerLayer = import_effect11.Layer.succeed(
801
+ HostSchedulerTag,
802
+ getGlobalHostScheduler()
803
+ );
804
+ var DeclarativeLinkRuntimeTag = class extends import_effect11.Context.Tag("@logixjs/core/DeclarativeLinkRuntime")() {
805
+ };
806
+ var declarativeLinkRuntimeLayer = import_effect11.Layer.succeed(
807
+ DeclarativeLinkRuntimeTag,
808
+ makeDeclarativeLinkRuntime()
809
+ );
810
+ var TickSchedulerTag = class extends import_effect11.Context.Tag("@logixjs/core/TickScheduler")() {
268
811
  };
269
812
 
270
813
  // src/internal/runtime/core/RuntimeKernel.ts
271
- var RuntimeServicesRuntimeConfigTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/RuntimeServicesRuntimeConfig")() {
814
+ var RuntimeServicesRuntimeConfigTagImpl = class extends import_effect12.Context.Tag("@logixjs/core/RuntimeServicesRuntimeConfig")() {
272
815
  };
273
- var RuntimeServicesProviderOverridesTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/RuntimeServicesProviderOverrides")() {
816
+ var RuntimeServicesProviderOverridesTagImpl = class extends import_effect12.Context.Tag("@logixjs/core/RuntimeServicesProviderOverrides")() {
274
817
  };
275
- var RuntimeServicesInstanceOverridesTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/RuntimeServicesInstanceOverrides")() {
818
+ var RuntimeServicesInstanceOverridesTagImpl = class extends import_effect12.Context.Tag("@logixjs/core/RuntimeServicesInstanceOverrides")() {
276
819
  };
277
- var FullCutoverGateModeTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/FullCutoverGateMode")() {
820
+ var FullCutoverGateModeTagImpl = class extends import_effect12.Context.Tag("@logixjs/core/FullCutoverGateMode")() {
278
821
  };
279
- var RuntimeServicesRegistryTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/RuntimeServicesRegistry")() {
822
+ var RuntimeServicesRegistryTagImpl = class extends import_effect12.Context.Tag("@logixjs/core/RuntimeServicesRegistry")() {
280
823
  };
281
824
 
282
825
  // src/internal/runtime/core/KernelRef.ts
283
- var import_effect9 = require("effect");
284
- var KernelImplementationRefTagImpl = class extends import_effect9.Context.Tag("@logixjs/core/KernelImplementationRef")() {
826
+ var import_effect13 = require("effect");
827
+ var KernelImplementationRefTagImpl = class extends import_effect13.Context.Tag("@logixjs/core/KernelImplementationRef")() {
285
828
  };
286
829
 
287
830
  // src/internal/runtime/core/RuntimeServiceBuiltins.ts
288
- var import_effect10 = require("effect");
289
- var RuntimeServiceBuiltinsTag = class extends import_effect10.Context.Tag("@logixjs/core/RuntimeServiceBuiltins")() {
831
+ var import_effect14 = require("effect");
832
+ var RuntimeServiceBuiltinsTag = class extends import_effect14.Context.Tag("@logixjs/core/RuntimeServiceBuiltins")() {
290
833
  };
291
834
 
292
835
  // src/internal/observability/evidenceCollector.ts
293
- var import_effect12 = require("effect");
836
+ var import_effect16 = require("effect");
294
837
 
295
838
  // src/internal/observability/runSession.ts
296
- var import_effect11 = require("effect");
297
- var RunSessionTagImpl = class extends import_effect11.Context.Tag("@logixjs/core/RunSession")() {
839
+ var import_effect15 = require("effect");
840
+ var RunSessionTagImpl = class extends import_effect15.Context.Tag("@logixjs/core/RunSession")() {
298
841
  };
299
842
 
300
843
  // src/internal/observability/evidenceCollector.ts
301
- var EvidenceCollectorTagImpl = class extends import_effect12.Context.Tag("@logixjs/core/EvidenceCollector")() {
844
+ var EvidenceCollectorTagImpl = class extends import_effect16.Context.Tag("@logixjs/core/EvidenceCollector")() {
302
845
  };
303
846
 
304
847
  // src/internal/runtime/core/ModuleRuntime.operation.ts
305
- var import_effect14 = require("effect");
848
+ var import_effect18 = require("effect");
306
849
 
307
850
  // src/internal/effect-op.ts
308
- var import_effect13 = require("effect");
851
+ var import_effect17 = require("effect");
309
852
 
310
853
  // src/internal/runtime/core/ModuleRuntime.dispatch.ts
311
- var import_effect16 = require("effect");
854
+ var import_effect21 = require("effect");
312
855
 
313
856
  // src/internal/runtime/core/ReducerDiagnostics.ts
314
- var import_effect15 = require("effect");
857
+ var import_effect19 = require("effect");
858
+
859
+ // src/internal/runtime/core/TxnOriginOverride.ts
860
+ var import_effect20 = require("effect");
861
+ var currentTxnOriginOverride = import_effect20.FiberRef.unsafeMake(void 0);
315
862
 
316
863
  // src/internal/runtime/core/ModuleRuntime.effects.ts
317
- var import_effect17 = require("effect");
864
+ var import_effect22 = require("effect");
318
865
 
319
866
  // src/internal/runtime/core/ModuleRuntime.transaction.ts
320
- var import_effect27 = require("effect");
867
+ var import_effect31 = require("effect");
321
868
 
322
- // src/internal/runtime/core/TaskRunner.ts
323
- var import_effect18 = require("effect");
324
- var inSyncTransactionFiber = import_effect18.FiberRef.unsafeMake(false);
325
- var forceSourceRefresh = import_effect18.FiberRef.unsafeMake(false);
869
+ // src/internal/state-trait/converge-in-transaction.impl.ts
870
+ var import_effect26 = require("effect");
326
871
 
327
- // src/internal/state-trait/converge-in-transaction.ts
328
- var import_effect22 = require("effect");
872
+ // src/internal/digest.ts
873
+ var stableStringify = (value) => {
874
+ if (value === null) return "null";
875
+ const t = typeof value;
876
+ if (t === "string") return JSON.stringify(value);
877
+ if (t === "number") return Number.isFinite(value) ? String(value) : "null";
878
+ if (t === "boolean") return value ? "true" : "false";
879
+ if (Array.isArray(value)) {
880
+ return `[${value.map(stableStringify).join(",")}]`;
881
+ }
882
+ if (t === "object") {
883
+ const record2 = value;
884
+ const keys = Object.keys(record2).sort();
885
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${stableStringify(record2[k])}`).join(",")}}`;
886
+ }
887
+ return "null";
888
+ };
889
+ var fnv1a32 = (input) => {
890
+ let hash = 2166136261;
891
+ for (let i = 0; i < input.length; i++) {
892
+ hash ^= input.charCodeAt(i);
893
+ hash = hash * 16777619 >>> 0;
894
+ }
895
+ return hash.toString(16).padStart(8, "0");
896
+ };
329
897
 
330
898
  // src/internal/state-trait/converge-diagnostics.ts
331
- var import_effect19 = require("effect");
899
+ var import_effect23 = require("effect");
332
900
  var SchemaAST = __toESM(require("effect/SchemaAST"), 1);
333
901
 
334
902
  // src/internal/state-trait/exec-vm-mode.ts
335
- var import_effect20 = require("effect");
336
- var currentExecVmMode = import_effect20.FiberRef.unsafeMake(false);
903
+ var import_effect24 = require("effect");
904
+ var currentExecVmMode = import_effect24.FiberRef.unsafeMake(false);
337
905
 
338
906
  // src/internal/state-trait/converge-step.ts
339
- var import_effect21 = require("effect");
907
+ var import_effect25 = require("effect");
340
908
 
341
- // src/internal/state-trait/validate.ts
342
- var import_effect23 = require("effect");
909
+ // src/internal/state-trait/validate.impl.ts
910
+ var import_effect27 = require("effect");
343
911
  var import_mutative = require("mutative");
344
912
  var nowMs = (() => {
345
913
  const perf = globalThis.performance;
@@ -349,53 +917,53 @@ var nowMs = (() => {
349
917
  return () => Date.now();
350
918
  })();
351
919
 
352
- // src/internal/state-trait/source.ts
353
- var import_effect26 = require("effect");
920
+ // src/internal/state-trait/source.impl.ts
921
+ var import_effect30 = require("effect");
354
922
  var import_mutative2 = require("mutative");
355
923
 
356
924
  // src/internal/resource.ts
357
- var import_effect24 = require("effect");
358
- var ResourceRegistryTag = class extends import_effect24.Context.Tag("@logixjs/core/ResourceRegistry")() {
925
+ var import_effect28 = require("effect");
926
+ var ResourceRegistryTag = class extends import_effect28.Context.Tag("@logixjs/core/ResourceRegistry")() {
359
927
  };
360
928
 
361
929
  // src/internal/runtime/core/ReplayLog.ts
362
- var import_effect25 = require("effect");
363
- var ReplayLog = class extends import_effect25.Context.Tag("@logixjs/core/ReplayLog")() {
930
+ var import_effect29 = require("effect");
931
+ var ReplayLog = class extends import_effect29.Context.Tag("@logixjs/core/ReplayLog")() {
364
932
  };
365
- var snapshot = import_effect25.Effect.gen(function* () {
933
+ var snapshot = import_effect29.Effect.gen(function* () {
366
934
  const log = yield* ReplayLog;
367
935
  return yield* log.snapshot;
368
936
  });
369
- var resetCursor = import_effect25.Effect.gen(function* () {
937
+ var resetCursor = import_effect29.Effect.gen(function* () {
370
938
  const log = yield* ReplayLog;
371
939
  yield* log.resetCursor;
372
940
  });
373
941
 
374
942
  // src/internal/runtime/core/ModuleRuntime.concurrencyPolicy.ts
375
- var import_effect28 = require("effect");
943
+ var import_effect32 = require("effect");
376
944
 
377
945
  // src/internal/runtime/core/ModuleRuntime.txnLanePolicy.ts
378
- var import_effect29 = require("effect");
946
+ var import_effect33 = require("effect");
379
947
 
380
948
  // src/internal/runtime/core/ModuleRuntime.traitConvergeConfig.ts
381
- var import_effect30 = require("effect");
949
+ var import_effect34 = require("effect");
382
950
 
383
951
  // src/internal/state-trait/build.ts
384
952
  var SchemaAST2 = __toESM(require("effect/SchemaAST"), 1);
385
953
 
386
954
  // src/internal/runtime/core/ModuleRuntime.internalHooks.ts
387
- var import_effect31 = require("effect");
955
+ var import_effect35 = require("effect");
388
956
 
389
957
  // src/internal/runtime/core/RootContext.ts
390
- var import_effect32 = require("effect");
391
- var RootContextTagImpl = class extends import_effect32.Context.Tag("@logixjs/core/RootContext")() {
958
+ var import_effect36 = require("effect");
959
+ var RootContextTagImpl = class extends import_effect36.Context.Tag("@logixjs/core/RootContext")() {
392
960
  };
393
961
 
394
- // src/internal/runtime/core/process/ProcessRuntime.ts
395
- var import_effect34 = require("effect");
962
+ // src/internal/runtime/core/process/ProcessRuntime.make.ts
963
+ var import_effect38 = require("effect");
396
964
 
397
965
  // src/internal/runtime/core/process/concurrency.ts
398
- var import_effect33 = require("effect");
966
+ var import_effect37 = require("effect");
399
967
 
400
968
  // src/internal/runtime/core/process/events.ts
401
969
  var PROCESS_EVENT_MAX_BYTES = 4 * 1024;
@@ -418,66 +986,377 @@ var attachMeta = (effect, meta) => {
418
986
  // src/internal/runtime/core/process/selectorSchema.ts
419
987
  var SchemaAST3 = __toESM(require("effect/SchemaAST"), 1);
420
988
 
421
- // src/internal/runtime/core/process/ProcessRuntime.ts
422
- var ProcessRuntimeTag = class extends import_effect34.Context.Tag("@logixjs/core/ProcessRuntime")() {
989
+ // src/internal/runtime/core/process/ProcessRuntime.make.ts
990
+ var ProcessRuntimeTag = class extends import_effect38.Context.Tag("@logixjs/core/ProcessRuntime")() {
423
991
  };
424
- var currentProcessTrigger = import_effect34.FiberRef.unsafeMake(void 0);
425
- var currentProcessEventBudget = import_effect34.FiberRef.unsafeMake(
992
+ var currentProcessTrigger = import_effect38.FiberRef.unsafeMake(void 0);
993
+ var currentProcessEventBudget = import_effect38.FiberRef.unsafeMake(
426
994
  void 0
427
995
  );
428
996
 
997
+ // src/internal/runtime/core/ReadQuery.ts
998
+ function isReadQuery(input) {
999
+ if (!input || typeof input !== "object" && typeof input !== "function") return false;
1000
+ const maybe = input;
1001
+ return typeof maybe.selectorId === "string" && typeof maybe.select === "function" && Array.isArray(maybe.reads);
1002
+ }
1003
+ var normalizeReads = (reads) => {
1004
+ const unique = [];
1005
+ const seen = /* @__PURE__ */ new Set();
1006
+ for (const r of reads) {
1007
+ const key = typeof r === "number" ? `n:${r}` : `s:${r}`;
1008
+ if (seen.has(key)) continue;
1009
+ seen.add(key);
1010
+ unique.push(r);
1011
+ }
1012
+ return unique.slice().sort();
1013
+ };
1014
+ var toHash32Number = (hex) => Number.parseInt(hex, 16);
1015
+ var makeReadsDigest = (reads) => {
1016
+ const normalized = normalizeReads(reads);
1017
+ return {
1018
+ count: normalized.length,
1019
+ hash: toHash32Number(fnv1a32(stableStringify(normalized)))
1020
+ };
1021
+ };
1022
+ var computeSelectorId = (value) => `rq_${fnv1a32(stableStringify(value))}`;
1023
+ var nextUnstableSelectorSeq = 0;
1024
+ var unstableSelectorIdByFn = /* @__PURE__ */ new WeakMap();
1025
+ var computeUnstableSelectorId = (selector) => {
1026
+ const existing = unstableSelectorIdByFn.get(selector);
1027
+ if (existing) return existing;
1028
+ nextUnstableSelectorSeq += 1;
1029
+ const selectorId = `rq_u${nextUnstableSelectorSeq}`;
1030
+ unstableSelectorIdByFn.set(selector, selectorId);
1031
+ return selectorId;
1032
+ };
1033
+ var unwrapParens = (input) => {
1034
+ const trimmed = input.trim();
1035
+ if (trimmed.startsWith("(") && trimmed.endsWith(")")) {
1036
+ const inner = trimmed.slice(1, -1).trim();
1037
+ if (!inner.startsWith("(") || !inner.endsWith(")")) {
1038
+ return inner;
1039
+ }
1040
+ }
1041
+ return trimmed;
1042
+ };
1043
+ var extractArrow = (source) => {
1044
+ const idx = source.indexOf("=>");
1045
+ if (idx < 0) return void 0;
1046
+ const left = source.slice(0, idx).trim();
1047
+ const right = source.slice(idx + 2).trim();
1048
+ const paramRaw = unwrapParens(left);
1049
+ if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(paramRaw)) return void 0;
1050
+ if (right.startsWith("{")) {
1051
+ const m = right.match(/^\{\s*return\s+(.+?);?\s*\}\s*$/s);
1052
+ if (!m) return void 0;
1053
+ return { param: paramRaw, body: m[1]?.trim() ?? "" };
1054
+ }
1055
+ return { param: paramRaw, body: right };
1056
+ };
1057
+ var extractFunctionReturn = (source) => {
1058
+ const trimmed = source.trim();
1059
+ const m = trimmed.match(
1060
+ /^function\s*(?:[A-Za-z_$][A-Za-z0-9_$]*\s*)?\(\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*\)\s*\{\s*return\s+(.+?);?\s*\}\s*$/s
1061
+ );
1062
+ if (!m) return void 0;
1063
+ const param = m[1]?.trim() ?? "";
1064
+ if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(param)) return void 0;
1065
+ const body = m[2]?.trim() ?? "";
1066
+ if (body.length === 0) return void 0;
1067
+ return { param, body };
1068
+ };
1069
+ var tryParseSelectorSource = (source) => {
1070
+ const arrowOrFn = extractArrow(source) ?? extractFunctionReturn(source);
1071
+ if (!arrowOrFn) return void 0;
1072
+ const expr = unwrapParens(arrowOrFn.body).trim().replace(/;$/, "").trim();
1073
+ {
1074
+ const re = new RegExp(`^${arrowOrFn.param}\\.([A-Za-z0-9_$]+(?:\\.[A-Za-z0-9_$]+)*)$`);
1075
+ const m = expr.match(re);
1076
+ if (m) {
1077
+ return { kind: "path", path: m[1] };
1078
+ }
1079
+ }
1080
+ if (expr.startsWith("{") && expr.endsWith("}")) {
1081
+ const inner = expr.slice(1, -1).trim();
1082
+ if (inner.length === 0) return { kind: "struct", entries: [] };
1083
+ const parts = inner.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
1084
+ const entries = [];
1085
+ for (const part of parts) {
1086
+ const idx = part.indexOf(":");
1087
+ if (idx < 0) return void 0;
1088
+ const key = part.slice(0, idx).trim();
1089
+ const value = part.slice(idx + 1).trim();
1090
+ if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)) return void 0;
1091
+ const re = new RegExp(`^${arrowOrFn.param}\\.([A-Za-z0-9_$]+(?:\\.[A-Za-z0-9_$]+)*)$`);
1092
+ const m = value.match(re);
1093
+ if (!m) return void 0;
1094
+ entries.push([key, m[1]]);
1095
+ }
1096
+ entries.sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
1097
+ return { kind: "struct", entries };
1098
+ }
1099
+ return void 0;
1100
+ };
1101
+ var READ_QUERY_TEMPLATE_CACHE_MAX = 2048;
1102
+ var readQueryTemplateByFn = /* @__PURE__ */ new WeakMap();
1103
+ var readQueryTemplateBySource = /* @__PURE__ */ new Map();
1104
+ var lruGet = (map, key) => {
1105
+ const value = map.get(key);
1106
+ if (value === void 0) return void 0;
1107
+ map.delete(key);
1108
+ map.set(key, value);
1109
+ return value;
1110
+ };
1111
+ var lruSet = (map, key, value, maxSize) => {
1112
+ if (map.has(key)) map.delete(key);
1113
+ map.set(key, value);
1114
+ if (map.size <= maxSize) return;
1115
+ const oldestKey = map.keys().next().value;
1116
+ if (oldestKey !== void 0) {
1117
+ map.delete(oldestKey);
1118
+ }
1119
+ };
1120
+ var safeToString = (fn) => {
1121
+ try {
1122
+ return fn.toString();
1123
+ } catch {
1124
+ return "";
1125
+ }
1126
+ };
1127
+ var compile = (input) => {
1128
+ if (isReadQuery(input)) {
1129
+ const reads = normalizeReads(input.reads);
1130
+ const readsDigest = reads.length > 0 ? makeReadsDigest(reads) : void 0;
1131
+ const equalsKind = input.equalsKind;
1132
+ const staticIr2 = {
1133
+ selectorId: input.selectorId,
1134
+ debugKey: input.debugKey,
1135
+ lane: "static",
1136
+ producer: "manual",
1137
+ reads,
1138
+ readsDigest,
1139
+ equalsKind
1140
+ };
1141
+ return {
1142
+ ...input,
1143
+ reads,
1144
+ lane: "static",
1145
+ producer: "manual",
1146
+ readsDigest,
1147
+ staticIr: staticIr2
1148
+ };
1149
+ }
1150
+ const selector = input;
1151
+ const debugKey = (typeof selector?.debugKey === "string" && selector.debugKey.length > 0 ? selector.debugKey : void 0) ?? (typeof selector.name === "string" && selector.name.length > 0 ? selector.name : void 0);
1152
+ const declaredReads = Array.isArray(selector?.fieldPaths) ? selector.fieldPaths.filter((x) => typeof x === "string") : void 0;
1153
+ if (declaredReads && declaredReads.length > 0) {
1154
+ const reads = normalizeReads(declaredReads);
1155
+ const readsDigest = makeReadsDigest(reads);
1156
+ const selectorId2 = computeSelectorId({ kind: "reads", reads });
1157
+ const staticIr2 = {
1158
+ selectorId: selectorId2,
1159
+ debugKey,
1160
+ lane: "static",
1161
+ producer: "jit",
1162
+ reads,
1163
+ readsDigest,
1164
+ equalsKind: "objectIs"
1165
+ };
1166
+ return {
1167
+ selectorId: selectorId2,
1168
+ debugKey,
1169
+ reads,
1170
+ select: selector,
1171
+ equalsKind: "objectIs",
1172
+ lane: "static",
1173
+ producer: "jit",
1174
+ readsDigest,
1175
+ staticIr: staticIr2
1176
+ };
1177
+ }
1178
+ const cachedByFn = readQueryTemplateByFn.get(selector);
1179
+ if (cachedByFn) {
1180
+ const staticIr2 = {
1181
+ selectorId: cachedByFn.selectorId,
1182
+ debugKey,
1183
+ lane: "static",
1184
+ producer: "jit",
1185
+ reads: cachedByFn.reads,
1186
+ readsDigest: cachedByFn.readsDigest,
1187
+ equalsKind: cachedByFn.equalsKind
1188
+ };
1189
+ return {
1190
+ selectorId: cachedByFn.selectorId,
1191
+ debugKey,
1192
+ reads: cachedByFn.reads,
1193
+ select: selector,
1194
+ equalsKind: cachedByFn.equalsKind,
1195
+ lane: "static",
1196
+ producer: "jit",
1197
+ readsDigest: cachedByFn.readsDigest,
1198
+ staticIr: staticIr2
1199
+ };
1200
+ }
1201
+ const srcTrimmed = safeToString(selector).trim();
1202
+ const cachedBySource = srcTrimmed.length > 0 ? lruGet(readQueryTemplateBySource, srcTrimmed) : void 0;
1203
+ if (cachedBySource) {
1204
+ readQueryTemplateByFn.set(selector, cachedBySource);
1205
+ const staticIr2 = {
1206
+ selectorId: cachedBySource.selectorId,
1207
+ debugKey,
1208
+ lane: "static",
1209
+ producer: "jit",
1210
+ reads: cachedBySource.reads,
1211
+ readsDigest: cachedBySource.readsDigest,
1212
+ equalsKind: cachedBySource.equalsKind
1213
+ };
1214
+ return {
1215
+ selectorId: cachedBySource.selectorId,
1216
+ debugKey,
1217
+ reads: cachedBySource.reads,
1218
+ select: selector,
1219
+ equalsKind: cachedBySource.equalsKind,
1220
+ lane: "static",
1221
+ producer: "jit",
1222
+ readsDigest: cachedBySource.readsDigest,
1223
+ staticIr: staticIr2
1224
+ };
1225
+ }
1226
+ const parsed = srcTrimmed.length > 0 ? tryParseSelectorSource(srcTrimmed) : void 0;
1227
+ if (parsed?.kind === "path") {
1228
+ const reads = [parsed.path];
1229
+ const readsDigest = makeReadsDigest(reads);
1230
+ const selectorId2 = computeSelectorId({ kind: "path", path: parsed.path });
1231
+ const template = { selectorId: selectorId2, reads, readsDigest, equalsKind: "objectIs" };
1232
+ readQueryTemplateByFn.set(selector, template);
1233
+ lruSet(readQueryTemplateBySource, srcTrimmed, template, READ_QUERY_TEMPLATE_CACHE_MAX);
1234
+ const staticIr2 = {
1235
+ selectorId: selectorId2,
1236
+ debugKey,
1237
+ lane: "static",
1238
+ producer: "jit",
1239
+ reads,
1240
+ readsDigest,
1241
+ equalsKind: "objectIs"
1242
+ };
1243
+ return {
1244
+ selectorId: selectorId2,
1245
+ debugKey,
1246
+ reads,
1247
+ select: selector,
1248
+ equalsKind: "objectIs",
1249
+ lane: "static",
1250
+ producer: "jit",
1251
+ readsDigest,
1252
+ staticIr: staticIr2
1253
+ };
1254
+ }
1255
+ if (parsed?.kind === "struct") {
1256
+ const reads = normalizeReads(parsed.entries.map(([, path]) => path));
1257
+ const readsDigest = makeReadsDigest(reads);
1258
+ const selectorId2 = computeSelectorId({ kind: "struct", entries: parsed.entries });
1259
+ const template = { selectorId: selectorId2, reads, readsDigest, equalsKind: "shallowStruct" };
1260
+ readQueryTemplateByFn.set(selector, template);
1261
+ lruSet(readQueryTemplateBySource, srcTrimmed, template, READ_QUERY_TEMPLATE_CACHE_MAX);
1262
+ const staticIr2 = {
1263
+ selectorId: selectorId2,
1264
+ debugKey,
1265
+ lane: "static",
1266
+ producer: "jit",
1267
+ reads,
1268
+ readsDigest,
1269
+ equalsKind: "shallowStruct"
1270
+ };
1271
+ return {
1272
+ selectorId: selectorId2,
1273
+ debugKey,
1274
+ reads,
1275
+ select: selector,
1276
+ equalsKind: "shallowStruct",
1277
+ lane: "static",
1278
+ producer: "jit",
1279
+ readsDigest,
1280
+ staticIr: staticIr2
1281
+ };
1282
+ }
1283
+ const baseFallbackReason = srcTrimmed.includes("=>") || srcTrimmed.startsWith("function") ? "unsupportedSyntax" : "missingDeps";
1284
+ const lowDiscriminabilitySource = srcTrimmed.length === 0 || srcTrimmed.includes("[native code]");
1285
+ const fallbackReason = !debugKey || lowDiscriminabilitySource ? "unstableSelectorId" : baseFallbackReason;
1286
+ const selectorId = fallbackReason === "unstableSelectorId" ? computeUnstableSelectorId(selector) : computeSelectorId({ kind: "dynamic", debugKey, src: srcTrimmed });
1287
+ const staticIr = {
1288
+ selectorId,
1289
+ debugKey,
1290
+ lane: "dynamic",
1291
+ producer: "dynamic",
1292
+ fallbackReason,
1293
+ equalsKind: "objectIs"
1294
+ };
1295
+ return {
1296
+ selectorId,
1297
+ debugKey,
1298
+ reads: [],
1299
+ select: selector,
1300
+ equalsKind: "objectIs",
1301
+ lane: "dynamic",
1302
+ producer: "dynamic",
1303
+ fallbackReason,
1304
+ staticIr
1305
+ };
1306
+ };
1307
+
429
1308
  // src/internal/runtime/core/SelectorGraph.ts
430
- var import_effect35 = require("effect");
1309
+ var import_effect39 = require("effect");
431
1310
 
432
1311
  // src/internal/runtime/core/ModuleRuntime.txnQueue.ts
433
- var import_effect36 = require("effect");
1312
+ var import_effect40 = require("effect");
434
1313
 
435
1314
  // src/internal/runtime/core/ModuleRuntime.logics.ts
436
- var import_effect40 = require("effect");
1315
+ var import_effect44 = require("effect");
437
1316
 
438
1317
  // src/internal/runtime/core/LifecycleDiagnostics.ts
439
- var import_effect37 = require("effect");
1318
+ var import_effect41 = require("effect");
440
1319
 
441
1320
  // src/internal/runtime/core/LogicDiagnostics.ts
442
- var import_effect38 = require("effect");
443
- var LogicPhaseServiceTag = import_effect38.Context.GenericTag("@logixjs/LogicPhaseService");
444
- var LogicUnitServiceTag = class extends import_effect38.Context.Tag("@logixjs/LogicUnitService")() {
1321
+ var import_effect42 = require("effect");
1322
+ var LogicPhaseServiceTag = import_effect42.Context.GenericTag("@logixjs/LogicPhaseService");
1323
+ var LogicUnitServiceTag = class extends import_effect42.Context.Tag("@logixjs/LogicUnitService")() {
445
1324
  };
446
1325
 
447
1326
  // src/internal/runtime/core/Platform.ts
448
- var import_effect39 = require("effect");
449
- var Tag = import_effect39.Context.GenericTag("@logixjs/Platform");
1327
+ var import_effect43 = require("effect");
1328
+ var Tag = import_effect43.Context.GenericTag("@logixjs/Platform");
450
1329
 
451
1330
  // src/internal/runtime/core/ConcurrencyDiagnostics.ts
452
- var import_effect41 = require("effect");
453
- var nowMs2 = import_effect41.Effect.clockWith((clock) => clock.currentTimeMillis);
1331
+ var import_effect45 = require("effect");
1332
+ var nowMs2 = import_effect45.Effect.clockWith((clock) => clock.currentTimeMillis);
454
1333
 
455
1334
  // src/internal/runtime/core/BoundApiRuntime.ts
456
- var import_effect47 = require("effect");
1335
+ var import_effect51 = require("effect");
457
1336
 
458
1337
  // src/internal/action.ts
459
- var import_effect43 = require("effect");
1338
+ var import_effect47 = require("effect");
460
1339
 
461
1340
  // src/internal/runtime/core/mutativePatches.ts
462
1341
  var import_mutative3 = require("mutative");
463
1342
 
464
1343
  // src/internal/runtime/core/FlowRuntime.ts
465
- var import_effect44 = require("effect");
1344
+ var import_effect48 = require("effect");
466
1345
 
467
1346
  // src/internal/runtime/core/MatchBuilder.ts
468
- var import_effect45 = require("effect");
1347
+ var import_effect49 = require("effect");
469
1348
 
470
1349
  // src/internal/root.ts
471
- var import_effect46 = require("effect");
1350
+ var import_effect50 = require("effect");
472
1351
 
473
1352
  // src/internal/runtime/ModuleFactory.ts
474
1353
  function Link(modules, logic) {
475
- return import_effect48.Effect.gen(function* () {
1354
+ return import_effect52.Effect.gen(function* () {
476
1355
  const handles = {};
477
1356
  for (const [key, module2] of Object.entries(modules)) {
478
1357
  const runtime = yield* module2;
479
1358
  handles[key] = {
480
- read: (selector) => import_effect48.Effect.map(runtime.getState, selector),
1359
+ read: (selector) => import_effect52.Effect.map(runtime.getState, selector),
481
1360
  changes: runtime.changes,
482
1361
  dispatch: runtime.dispatch,
483
1362
  actions$: runtime.actions$,
@@ -495,6 +1374,19 @@ function Link(modules, logic) {
495
1374
  });
496
1375
  }
497
1376
 
1377
+ // src/internal/runtime/core/DeclarativeLinkIR.ts
1378
+ var getDeclarativeLinkIrDigest = (ir) => `dlink_ir_v1:${fnv1a32(stableStringify(ir))}`;
1379
+ var exportDeclarativeLinkIr = (args) => ({
1380
+ staticIrDigest: getDeclarativeLinkIrDigest(args.ir),
1381
+ moduleId: `link:${args.linkId}`,
1382
+ instanceId: "runtime",
1383
+ kind: "declarativeLinkIr",
1384
+ ir: args.ir
1385
+ });
1386
+
1387
+ // src/ReadQuery.ts
1388
+ var compile2 = compile;
1389
+
498
1390
  // src/Process.ts
499
1391
  var DEFAULT_TRIGGERS = [{ kind: "platformEvent", platformEvent: "runtime:boot" }];
500
1392
  var isModuleLike = (value) => Boolean(value) && typeof value === "object" && (value._kind === "ModuleDef" || value._kind === "Module") && "tag" in value;
@@ -517,6 +1409,21 @@ function link(config, logic) {
517
1409
  modulesRecord,
518
1410
  logic
519
1411
  );
1412
+ const wrapped = import_effect53.Effect.gen(function* () {
1413
+ const level = yield* import_effect53.FiberRef.get(currentDiagnosticsLevel);
1414
+ if (level !== "off") {
1415
+ yield* record({
1416
+ type: "diagnostic",
1417
+ moduleId: `link:${linkId}`,
1418
+ code: "process_link::blackbox_best_effort",
1419
+ severity: "info",
1420
+ message: "[Process.link] Blackbox link is best-effort and is NOT stabilized within the same tick. Strong consistency applies only to declarative IR.",
1421
+ hint: "If you need same-tick strong consistency, migrate to Process.linkDeclarative(...) (073).",
1422
+ kind: "blackbox_link_boundary"
1423
+ });
1424
+ }
1425
+ return yield* effect;
1426
+ });
520
1427
  const definition = {
521
1428
  processId: linkId,
522
1429
  requires: Array.from(requires),
@@ -525,18 +1432,153 @@ function link(config, logic) {
525
1432
  errorPolicy: { mode: "failStop" },
526
1433
  diagnosticsLevel: "off"
527
1434
  };
528
- return attachMeta(effect, {
1435
+ return attachMeta(wrapped, {
529
1436
  definition,
530
1437
  kind: "link"
531
1438
  });
532
1439
  }
1440
+ function linkDeclarative(config, build2) {
1441
+ const linkId = config.id ?? [...config.modules].map((m) => m.id).sort().join("~");
1442
+ const modulesRecord = /* @__PURE__ */ Object.create(null);
1443
+ const requires = /* @__PURE__ */ new Set();
1444
+ for (const module2 of config.modules) {
1445
+ const tag = unwrapModuleTag(module2);
1446
+ requires.add(String(tag.id));
1447
+ modulesRecord[tag.id] = tag;
1448
+ }
1449
+ const handles = /* @__PURE__ */ Object.create(null);
1450
+ for (const id of Object.keys(modulesRecord)) {
1451
+ const tag = modulesRecord[id];
1452
+ handles[id] = {
1453
+ read: (selector) => {
1454
+ const compiled = compile2(selector);
1455
+ const staticIr = compiled.staticIr;
1456
+ const ok = staticIr.lane === "static" && staticIr.readsDigest != null && staticIr.fallbackReason == null;
1457
+ if (!ok) {
1458
+ throw new Error(
1459
+ `[Process.linkDeclarative] ReadQuery must be static with readsDigest (moduleId=${id}, selectorId=${staticIr.selectorId}, lane=${staticIr.lane}, fallbackReason=${staticIr.fallbackReason}). Fix: use ReadQuery.make(...) or annotate selector.fieldPaths.`
1460
+ );
1461
+ }
1462
+ return { _tag: "readNode", moduleId: id, tag, readQuery: compiled };
1463
+ },
1464
+ dispatch: (actionTag) => {
1465
+ if (typeof actionTag !== "string" || actionTag.length === 0) {
1466
+ throw new Error("[Process.linkDeclarative] actionTag must be a non-empty string");
1467
+ }
1468
+ return { _tag: "dispatchNode", moduleId: id, tag, actionTag };
1469
+ }
1470
+ };
1471
+ }
1472
+ const edges = build2(handles);
1473
+ if (!Array.isArray(edges)) {
1474
+ throw new Error("[Process.linkDeclarative] build(...) must return an array of edges");
1475
+ }
1476
+ const normalized = edges.filter((e) => Boolean(e && e.from && e.to)).map((e) => {
1477
+ if (e.from._tag !== "readNode" || e.to._tag !== "dispatchNode") {
1478
+ throw new Error("[Process.linkDeclarative] Invalid edge spec returned from build(...)");
1479
+ }
1480
+ return e;
1481
+ }).slice().sort((a, b) => {
1482
+ const ak = `${a.from.moduleId}:${a.from.readQuery.staticIr.selectorId}->${a.to.moduleId}:${a.to.actionTag}`;
1483
+ const bk = `${b.from.moduleId}:${b.from.readQuery.staticIr.selectorId}->${b.to.moduleId}:${b.to.actionTag}`;
1484
+ return ak < bk ? -1 : ak > bk ? 1 : 0;
1485
+ });
1486
+ const program = import_effect53.Effect.gen(function* () {
1487
+ const runtime = yield* DeclarativeLinkRuntimeTag;
1488
+ const collectors = yield* import_effect53.FiberRef.get(currentConvergeStaticIrCollectors);
1489
+ const runtimeByTag = /* @__PURE__ */ new Map();
1490
+ const resolveRuntime = (tag) => import_effect53.Effect.suspend(() => {
1491
+ const cached = runtimeByTag.get(tag);
1492
+ if (cached) return import_effect53.Effect.succeed(cached);
1493
+ return tag.pipe(
1494
+ import_effect53.Effect.tap(
1495
+ (rt) => import_effect53.Effect.sync(() => {
1496
+ runtimeByTag.set(tag, rt);
1497
+ })
1498
+ )
1499
+ );
1500
+ });
1501
+ const nodes = [];
1502
+ const irEdges = [];
1503
+ const readNodes = [];
1504
+ const dispatchNodes = [];
1505
+ for (let i = 0; i < normalized.length; i += 1) {
1506
+ const edge = normalized[i];
1507
+ const fromRuntime = yield* resolveRuntime(edge.from.tag);
1508
+ const toRuntime = yield* resolveRuntime(edge.to.tag);
1509
+ const fromKey = `${fromRuntime.moduleId}::${fromRuntime.instanceId}`;
1510
+ const readNodeId = `r${i}`;
1511
+ const dispatchNodeId = `d${i}`;
1512
+ nodes.push({
1513
+ id: readNodeId,
1514
+ kind: "readQuery",
1515
+ moduleId: fromRuntime.moduleId,
1516
+ instanceKey: fromRuntime.instanceId,
1517
+ readQuery: edge.from.readQuery.staticIr
1518
+ });
1519
+ nodes.push({
1520
+ id: dispatchNodeId,
1521
+ kind: "dispatch",
1522
+ moduleId: toRuntime.moduleId,
1523
+ instanceKey: toRuntime.instanceId,
1524
+ actionTag: edge.to.actionTag
1525
+ });
1526
+ irEdges.push({ from: readNodeId, to: dispatchNodeId });
1527
+ readNodes.push({ nodeId: readNodeId, moduleInstanceKey: fromKey, readQuery: edge.from.readQuery });
1528
+ dispatchNodes.push({
1529
+ nodeId: dispatchNodeId,
1530
+ dispatch: (payload) => toRuntime.dispatch({ _tag: edge.to.actionTag, payload }).pipe(import_effect53.Effect.asVoid)
1531
+ });
1532
+ }
1533
+ const ir = {
1534
+ version: 1,
1535
+ nodes,
1536
+ edges: irEdges
1537
+ };
1538
+ const registration = {
1539
+ linkId,
1540
+ ir,
1541
+ readNodes,
1542
+ dispatchNodes
1543
+ };
1544
+ const unregister = runtime.registerDeclarativeLink(registration);
1545
+ if (collectors.length > 0) {
1546
+ const exported = exportDeclarativeLinkIr({ linkId, ir });
1547
+ for (const collector of collectors) {
1548
+ collector.register(exported);
1549
+ }
1550
+ }
1551
+ yield* import_effect53.Effect.addFinalizer(
1552
+ () => import_effect53.Effect.sync(() => {
1553
+ unregister();
1554
+ })
1555
+ );
1556
+ yield* import_effect53.Effect.never;
1557
+ });
1558
+ const definition = {
1559
+ processId: `dlink:${linkId}`,
1560
+ requires: Array.from(requires),
1561
+ triggers: DEFAULT_TRIGGERS,
1562
+ concurrency: { mode: "latest" },
1563
+ errorPolicy: { mode: "failStop" },
1564
+ diagnosticsLevel: "off"
1565
+ };
1566
+ return attachMeta(program, {
1567
+ definition,
1568
+ kind: "declarativeLink"
1569
+ });
1570
+ }
533
1571
 
534
1572
  // src/Link.ts
535
- function make7(config, logic) {
1573
+ function make8(config, logic) {
536
1574
  return link(config, logic);
537
1575
  }
1576
+ function makeDeclarative(config, build2) {
1577
+ return linkDeclarative(config, build2);
1578
+ }
538
1579
  // Annotate the CommonJS export names for ESM import in node:
539
1580
  0 && (module.exports = {
540
- make
1581
+ make,
1582
+ makeDeclarative
541
1583
  });
542
1584
  //# sourceMappingURL=Link.cjs.map