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