@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/Env.cjs CHANGED
@@ -26,7 +26,642 @@ __export(Env_exports, {
26
26
  module.exports = __toCommonJS(Env_exports);
27
27
 
28
28
  // src/internal/runtime/core/env.ts
29
+ var import_effect8 = require("effect");
30
+
31
+ // src/internal/runtime/core/HostScheduler.ts
32
+ var noopCancel = () => {
33
+ };
34
+ var safeNowMs = () => {
35
+ const perf = globalThis.performance;
36
+ if (perf && typeof perf.now === "function") {
37
+ try {
38
+ const v = perf.now();
39
+ if (typeof v === "number" && Number.isFinite(v)) return v;
40
+ } catch {
41
+ }
42
+ }
43
+ return Date.now();
44
+ };
45
+ var safeQueueMicrotask = (cb) => {
46
+ const qm = globalThis.queueMicrotask;
47
+ if (typeof qm === "function") {
48
+ try {
49
+ qm(cb);
50
+ return;
51
+ } catch {
52
+ }
53
+ }
54
+ try {
55
+ Promise.resolve().then(cb);
56
+ } catch {
57
+ setTimeout(cb, 0);
58
+ }
59
+ };
60
+ var safeSetTimeout = (ms, cb) => {
61
+ const id = setTimeout(cb, ms);
62
+ return () => {
63
+ try {
64
+ clearTimeout(id);
65
+ } catch {
66
+ }
67
+ };
68
+ };
69
+ var makeMessageChannelMacrotask = () => {
70
+ const MC = globalThis.MessageChannel;
71
+ if (typeof MC !== "function") return void 0;
72
+ let channel;
73
+ try {
74
+ channel = new MC();
75
+ } catch {
76
+ return void 0;
77
+ }
78
+ const queue = [];
79
+ let scheduled = false;
80
+ const flush = () => {
81
+ scheduled = false;
82
+ const tasks = queue.splice(0, queue.length);
83
+ for (const t of tasks) {
84
+ if (t.canceled) continue;
85
+ try {
86
+ t.cb();
87
+ } catch {
88
+ }
89
+ }
90
+ };
91
+ try {
92
+ channel.port1.onmessage = flush;
93
+ } catch {
94
+ return void 0;
95
+ }
96
+ const schedule = (cb) => {
97
+ const task = { canceled: false, cb };
98
+ queue.push(task);
99
+ if (!scheduled) {
100
+ scheduled = true;
101
+ try {
102
+ channel.port2.postMessage(void 0);
103
+ } catch {
104
+ scheduled = false;
105
+ return safeSetTimeout(0, cb);
106
+ }
107
+ }
108
+ return () => {
109
+ task.canceled = true;
110
+ };
111
+ };
112
+ return schedule;
113
+ };
114
+ var makeSetImmediateMacrotask = () => {
115
+ const si = globalThis.setImmediate;
116
+ const ci = globalThis.clearImmediate;
117
+ if (typeof si !== "function") return void 0;
118
+ return (cb) => {
119
+ let id;
120
+ try {
121
+ id = si(cb);
122
+ } catch {
123
+ return safeSetTimeout(0, cb);
124
+ }
125
+ return () => {
126
+ if (typeof ci !== "function") return;
127
+ try {
128
+ ci(id);
129
+ } catch {
130
+ }
131
+ };
132
+ };
133
+ };
134
+ var makeRaf = () => {
135
+ const raf = globalThis.requestAnimationFrame;
136
+ const cancel = globalThis.cancelAnimationFrame;
137
+ if (typeof raf !== "function") return void 0;
138
+ return (cb) => {
139
+ let id;
140
+ try {
141
+ id = raf(cb);
142
+ } catch {
143
+ return noopCancel;
144
+ }
145
+ return () => {
146
+ if (typeof cancel !== "function") return;
147
+ try {
148
+ cancel(id);
149
+ } catch {
150
+ }
151
+ };
152
+ };
153
+ };
154
+ var makeDefaultHostScheduler = () => {
155
+ const macrotask = makeSetImmediateMacrotask() ?? makeMessageChannelMacrotask() ?? ((cb) => safeSetTimeout(0, cb));
156
+ const raf = makeRaf();
157
+ return {
158
+ nowMs: safeNowMs,
159
+ scheduleMicrotask: safeQueueMicrotask,
160
+ scheduleMacrotask: macrotask,
161
+ scheduleAnimationFrame: (cb) => raf?.(cb) ?? macrotask(cb),
162
+ scheduleTimeout: safeSetTimeout
163
+ };
164
+ };
165
+ var globalHostScheduler;
166
+ var getGlobalHostScheduler = () => {
167
+ globalHostScheduler ?? (globalHostScheduler = makeDefaultHostScheduler());
168
+ return globalHostScheduler;
169
+ };
170
+
171
+ // src/internal/runtime/core/RuntimeStore.ts
172
+ var parseTopicKey = (topicKey) => {
173
+ const idx = topicKey.indexOf("::");
174
+ if (idx <= 0) return void 0;
175
+ const moduleId = topicKey.slice(0, idx);
176
+ const rest = topicKey.slice(idx + 2);
177
+ if (rest.length === 0) return void 0;
178
+ const idx2 = rest.indexOf("::");
179
+ if (idx2 < 0) {
180
+ return { kind: "module", moduleInstanceKey: `${moduleId}::${rest}` };
181
+ }
182
+ const instanceId = rest.slice(0, idx2);
183
+ const suffix = rest.slice(idx2 + 2);
184
+ if (suffix.startsWith("rq:")) {
185
+ const selectorId = suffix.slice("rq:".length);
186
+ if (selectorId.length === 0) return void 0;
187
+ return {
188
+ kind: "readQuery",
189
+ moduleInstanceKey: `${moduleId}::${instanceId}`,
190
+ selectorId
191
+ };
192
+ }
193
+ return { kind: "module", moduleInstanceKey: `${moduleId}::${instanceId}` };
194
+ };
195
+ var makeRuntimeStore = () => {
196
+ let tickSeq = 0;
197
+ const moduleStates = /* @__PURE__ */ new Map();
198
+ const topicVersions = /* @__PURE__ */ new Map();
199
+ const topicPriorities = /* @__PURE__ */ new Map();
200
+ const listenersByTopic = /* @__PURE__ */ new Map();
201
+ const subscriberCountByModule = /* @__PURE__ */ new Map();
202
+ const getTopicVersion = (topicKey) => topicVersions.get(topicKey) ?? 0;
203
+ const getTopicPriority = (topicKey) => topicPriorities.get(topicKey) ?? "normal";
204
+ const commitTopicBump = (topicKey, priority) => {
205
+ const prev = topicVersions.get(topicKey) ?? 0;
206
+ topicVersions.set(topicKey, prev + 1);
207
+ topicPriorities.set(topicKey, priority);
208
+ };
209
+ const subscribeTopic = (topicKey, listener) => {
210
+ const info = parseTopicKey(topicKey);
211
+ const existing = listenersByTopic.get(topicKey);
212
+ const set = existing ?? /* @__PURE__ */ new Set();
213
+ const alreadyHas = set.has(listener);
214
+ if (!alreadyHas) {
215
+ set.add(listener);
216
+ }
217
+ if (!existing) {
218
+ listenersByTopic.set(topicKey, set);
219
+ }
220
+ if (!alreadyHas && info) {
221
+ const prev = subscriberCountByModule.get(info.moduleInstanceKey) ?? 0;
222
+ subscriberCountByModule.set(info.moduleInstanceKey, prev + 1);
223
+ }
224
+ return () => {
225
+ const current = listenersByTopic.get(topicKey);
226
+ if (!current) return;
227
+ const deleted = current.delete(listener);
228
+ if (deleted && info) {
229
+ const prev = subscriberCountByModule.get(info.moduleInstanceKey) ?? 0;
230
+ const next = prev - 1;
231
+ if (next <= 0) {
232
+ subscriberCountByModule.delete(info.moduleInstanceKey);
233
+ } else {
234
+ subscriberCountByModule.set(info.moduleInstanceKey, next);
235
+ }
236
+ }
237
+ if (current.size === 0) {
238
+ listenersByTopic.delete(topicKey);
239
+ }
240
+ };
241
+ };
242
+ const getTopicSubscriberCount = (topicKey) => listenersByTopic.get(topicKey)?.size ?? 0;
243
+ const getModuleSubscriberCount = (moduleInstanceKey) => subscriberCountByModule.get(moduleInstanceKey) ?? 0;
244
+ const registerModuleInstance = (args) => {
245
+ moduleStates.set(args.moduleInstanceKey, args.initialState);
246
+ if (!topicVersions.has(args.moduleInstanceKey)) {
247
+ topicVersions.set(args.moduleInstanceKey, 0);
248
+ topicPriorities.set(args.moduleInstanceKey, "normal");
249
+ }
250
+ };
251
+ const unregisterModuleInstance = (moduleInstanceKey) => {
252
+ moduleStates.delete(moduleInstanceKey);
253
+ };
254
+ const commitTick = (args) => {
255
+ tickSeq = args.tickSeq;
256
+ for (const [key, commit] of args.accepted.modules) {
257
+ moduleStates.set(key, commit.state);
258
+ }
259
+ const changedTopics = /* @__PURE__ */ new Map();
260
+ for (const [topicKey, priority] of args.accepted.dirtyTopics) {
261
+ commitTopicBump(topicKey, priority);
262
+ const listeners = Array.from(listenersByTopic.get(topicKey) ?? []);
263
+ if (listeners.length > 0) {
264
+ changedTopics.set(topicKey, { priority, listeners });
265
+ }
266
+ }
267
+ return { changedTopics };
268
+ };
269
+ const getModuleState = (moduleInstanceKey) => moduleStates.get(moduleInstanceKey);
270
+ const dispose = () => {
271
+ moduleStates.clear();
272
+ topicVersions.clear();
273
+ topicPriorities.clear();
274
+ listenersByTopic.clear();
275
+ subscriberCountByModule.clear();
276
+ };
277
+ return {
278
+ getTickSeq: () => tickSeq,
279
+ getModuleState,
280
+ getTopicVersion,
281
+ getTopicPriority,
282
+ subscribeTopic,
283
+ getTopicSubscriberCount,
284
+ getModuleSubscriberCount,
285
+ registerModuleInstance,
286
+ unregisterModuleInstance,
287
+ commitTick,
288
+ dispose
289
+ };
290
+ };
291
+
292
+ // src/internal/runtime/core/TickScheduler.ts
293
+ var import_effect6 = require("effect");
294
+
295
+ // src/internal/runtime/core/DebugSink.record.ts
296
+ var import_effect3 = require("effect");
297
+
298
+ // src/internal/observability/jsonValue.ts
299
+ var defaultOptions = {
300
+ maxDepth: 6,
301
+ maxObjectKeys: 32,
302
+ maxArrayLength: 32,
303
+ maxStringLength: 256,
304
+ maxJsonBytes: 4 * 1024,
305
+ oversizedPreviewBytes: 256
306
+ };
307
+
308
+ // src/internal/runtime/core/errorSummary.ts
29
309
  var import_effect = require("effect");
310
+
311
+ // src/internal/runtime/core/EffectOpCore.ts
312
+ var import_effect2 = require("effect");
313
+ var currentLinkId = import_effect2.FiberRef.unsafeMake(void 0);
314
+ var EffectOpMiddlewareTag = class extends import_effect2.Context.Tag("Logix/EffectOpMiddleware")() {
315
+ };
316
+
317
+ // src/internal/runtime/core/DebugSink.record.ts
318
+ var currentDebugSinks = import_effect3.FiberRef.unsafeMake([]);
319
+ var currentRuntimeLabel = import_effect3.FiberRef.unsafeMake(void 0);
320
+ var currentTxnId = import_effect3.FiberRef.unsafeMake(void 0);
321
+ var currentOpSeq = import_effect3.FiberRef.unsafeMake(void 0);
322
+ var currentDiagnosticsLevel = import_effect3.FiberRef.unsafeMake("off");
323
+ var currentTraitConvergeDiagnosticsSampling = import_effect3.FiberRef.unsafeMake({
324
+ sampleEveryN: 32,
325
+ topK: 3
326
+ });
327
+ var browserLifecycleSeen = /* @__PURE__ */ new Set();
328
+ var browserDiagnosticSeen = /* @__PURE__ */ new Set();
329
+ var lifecycleErrorLog = (event) => {
330
+ const moduleId = event.moduleId ?? "unknown";
331
+ const causePretty = (() => {
332
+ try {
333
+ return import_effect3.Cause.pretty(event.cause, {
334
+ renderErrorCause: true
335
+ });
336
+ } catch {
337
+ try {
338
+ return JSON.stringify(event.cause, null, 2);
339
+ } catch {
340
+ return String(event.cause);
341
+ }
342
+ }
343
+ })();
344
+ const message = `[Logix][module=${moduleId}] lifecycle:error
345
+ ${causePretty}`;
346
+ return import_effect3.Effect.logError(message).pipe(
347
+ import_effect3.Effect.annotateLogs({
348
+ "logix.moduleId": moduleId,
349
+ "logix.event": "lifecycle:error",
350
+ "logix.cause": causePretty
351
+ })
352
+ );
353
+ };
354
+ var diagnosticLog = (event) => {
355
+ const moduleId = event.moduleId ?? "unknown";
356
+ const header = `[Logix][module=${moduleId}] diagnostic(${event.severity})`;
357
+ const detail = `code=${event.code} message=${event.message}${event.actionTag ? ` action=${event.actionTag}` : ""}${event.hint ? `
358
+ hint: ${event.hint}` : ""}`;
359
+ const msg = `${header}
360
+ ${detail}`;
361
+ const base = event.severity === "warning" ? import_effect3.Effect.logWarning(msg) : event.severity === "info" ? import_effect3.Effect.logInfo(msg) : import_effect3.Effect.logError(msg);
362
+ const annotations = {
363
+ "logix.moduleId": moduleId,
364
+ "logix.event": `diagnostic(${event.severity})`,
365
+ "logix.diagnostic.code": event.code,
366
+ "logix.diagnostic.message": event.message
367
+ };
368
+ if (event.hint) {
369
+ annotations["logix.diagnostic.hint"] = event.hint;
370
+ }
371
+ if (event.actionTag) {
372
+ annotations["logix.diagnostic.actionTag"] = event.actionTag;
373
+ }
374
+ return base.pipe(import_effect3.Effect.annotateLogs(annotations));
375
+ };
376
+ var noopLayer = import_effect3.Layer.locallyScoped(currentDebugSinks, []);
377
+ var errorOnlySink = {
378
+ record: (event) => event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" && event.severity !== "info" ? diagnosticLog(event) : import_effect3.Effect.void
379
+ };
380
+ var errorOnlyLayer = import_effect3.Layer.locallyScoped(currentDebugSinks, [errorOnlySink]);
381
+ var consoleSink = {
382
+ record: (event) => event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" ? diagnosticLog(event) : import_effect3.Effect.logDebug({ debugEvent: event })
383
+ };
384
+ var consoleLayer = import_effect3.Layer.locallyScoped(currentDebugSinks, [consoleSink]);
385
+ var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
386
+ var renderBrowserConsoleEvent = (event) => {
387
+ if (typeof event.type === "string" && event.type.startsWith("trace:")) {
388
+ const moduleId = event.moduleId ?? "unknown";
389
+ const type = event.type;
390
+ return import_effect3.Effect.sync(() => {
391
+ console.groupCollapsed(
392
+ "%c[Logix]%c trace %c" + moduleId + "%c " + String(type),
393
+ "color:#6b7280;font-weight:bold",
394
+ // tag
395
+ "color:#3b82f6",
396
+ // label
397
+ "color:#9ca3af",
398
+ // module id
399
+ "color:#6b7280"
400
+ // type
401
+ );
402
+ console.log(event);
403
+ console.groupEnd();
404
+ });
405
+ }
406
+ if (event.type === "lifecycle:error") {
407
+ const moduleId = event.moduleId ?? "unknown";
408
+ const causePretty = (() => {
409
+ try {
410
+ return import_effect3.Cause.pretty(event.cause, { renderErrorCause: true });
411
+ } catch {
412
+ try {
413
+ return JSON.stringify(event.cause, null, 2);
414
+ } catch {
415
+ return String(event.cause);
416
+ }
417
+ }
418
+ })();
419
+ const key = `${moduleId}|${causePretty}`;
420
+ if (browserLifecycleSeen.has(key)) {
421
+ return import_effect3.Effect.void;
422
+ }
423
+ browserLifecycleSeen.add(key);
424
+ return import_effect3.Effect.sync(() => {
425
+ console.groupCollapsed(
426
+ "%c[Logix]%c lifecycle:error %c" + moduleId,
427
+ "color:#ef4444;font-weight:bold",
428
+ // tag
429
+ "color:#ef4444",
430
+ // label
431
+ "color:#9ca3af"
432
+ // module id
433
+ );
434
+ console.error(causePretty);
435
+ console.groupEnd();
436
+ });
437
+ }
438
+ if (event.type === "diagnostic") {
439
+ const moduleId = event.moduleId ?? "unknown";
440
+ const detail = `code=${event.code} message=${event.message}${event.actionTag ? ` action=${event.actionTag}` : ""}${event.hint ? `
441
+ hint: ${event.hint}` : ""}`;
442
+ const color = event.severity === "warning" ? "color:#d97706" : event.severity === "info" ? "color:#3b82f6" : "color:#ef4444";
443
+ const label = event.severity === "warning" ? "diagnostic(warning)" : event.severity === "info" ? "diagnostic(info)" : "diagnostic(error)";
444
+ const key = `${moduleId}|${event.code}|${event.message}`;
445
+ if (browserDiagnosticSeen.has(key)) {
446
+ return import_effect3.Effect.void;
447
+ }
448
+ browserDiagnosticSeen.add(key);
449
+ return import_effect3.Effect.sync(() => {
450
+ console.groupCollapsed(
451
+ "%c[Logix]%c " + label + "%c module=" + moduleId,
452
+ "color:#6b7280;font-weight:bold",
453
+ color,
454
+ "color:#9ca3af"
455
+ );
456
+ if (event.severity === "warning") {
457
+ console.warn(detail);
458
+ } else if (event.severity === "info") {
459
+ console.info(detail);
460
+ } else {
461
+ console.error(detail);
462
+ }
463
+ console.groupEnd();
464
+ });
465
+ }
466
+ return import_effect3.Effect.void;
467
+ };
468
+ var browserConsoleSink = {
469
+ record: (event) => {
470
+ if (!isBrowser) {
471
+ return event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" ? diagnosticLog(event) : import_effect3.Effect.logDebug({ debugEvent: event });
472
+ }
473
+ return renderBrowserConsoleEvent(event);
474
+ }
475
+ };
476
+ var browserConsoleLayer = import_effect3.Layer.locallyScoped(currentDebugSinks, [browserConsoleSink]);
477
+ var browserDiagnosticConsoleSink = {
478
+ record: (event) => {
479
+ if (!isBrowser) {
480
+ return event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" && event.severity !== "info" ? diagnosticLog(event) : import_effect3.Effect.void;
481
+ }
482
+ return event.type === "lifecycle:error" || event.type === "diagnostic" && event.severity !== "info" ? renderBrowserConsoleEvent(event) : import_effect3.Effect.void;
483
+ }
484
+ };
485
+ var browserDiagnosticConsoleLayer = import_effect3.Layer.locallyScoped(currentDebugSinks, [browserDiagnosticConsoleSink]);
486
+ var browserPrettyLoggerLayer = import_effect3.Logger.replace(
487
+ import_effect3.Logger.defaultLogger,
488
+ import_effect3.Logger.prettyLogger({ mode: "browser", colors: true })
489
+ );
490
+
491
+ // src/internal/runtime/core/DevtoolsHub.ts
492
+ var import_effect4 = require("effect");
493
+ var lastRunTs = 0;
494
+ var lastRunTsSeq = 0;
495
+ var nextRunId = () => {
496
+ const ts = Date.now();
497
+ if (ts === lastRunTs) {
498
+ lastRunTsSeq += 1;
499
+ } else {
500
+ lastRunTs = ts;
501
+ lastRunTsSeq = 0;
502
+ }
503
+ return lastRunTsSeq === 0 ? `run-${ts}` : `run-${ts}.${lastRunTsSeq}`;
504
+ };
505
+ var currentRunId = nextRunId();
506
+
507
+ // src/internal/runtime/core/TaskRunner.ts
508
+ var import_effect5 = require("effect");
509
+ var inSyncTransactionFiber = import_effect5.FiberRef.unsafeMake(false);
510
+ var forceSourceRefresh = import_effect5.FiberRef.unsafeMake(false);
511
+
512
+ // src/internal/runtime/core/DeclarativeLinkRuntime.ts
513
+ var import_effect7 = require("effect");
514
+ var makeDeclarativeLinkRuntime = () => {
515
+ const moduleAsSourceById = /* @__PURE__ */ new Map();
516
+ const moduleAsSourceIdsBySource = /* @__PURE__ */ new Map();
517
+ const declarativeById = /* @__PURE__ */ new Map();
518
+ const declarativeReadNodesBySource = /* @__PURE__ */ new Map();
519
+ const registerModuleAsSourceLink = (link) => {
520
+ const stored = {
521
+ ...link,
522
+ hasValue: false,
523
+ lastValue: void 0
524
+ };
525
+ moduleAsSourceById.set(link.id, stored);
526
+ const set = moduleAsSourceIdsBySource.get(link.sourceModuleInstanceKey) ?? /* @__PURE__ */ new Set();
527
+ set.add(link.id);
528
+ moduleAsSourceIdsBySource.set(link.sourceModuleInstanceKey, set);
529
+ return () => {
530
+ moduleAsSourceById.delete(link.id);
531
+ const current = moduleAsSourceIdsBySource.get(link.sourceModuleInstanceKey);
532
+ if (!current) return;
533
+ current.delete(link.id);
534
+ if (current.size === 0) {
535
+ moduleAsSourceIdsBySource.delete(link.sourceModuleInstanceKey);
536
+ }
537
+ };
538
+ };
539
+ const registerDeclarativeLink = (link) => {
540
+ const readNodeById = /* @__PURE__ */ new Map();
541
+ for (const n of link.readNodes) {
542
+ readNodeById.set(n.nodeId, n);
543
+ }
544
+ const dispatchNodeById = /* @__PURE__ */ new Map();
545
+ for (const n of link.dispatchNodes) {
546
+ dispatchNodeById.set(n.nodeId, n);
547
+ }
548
+ const incomingByDispatch = /* @__PURE__ */ new Map();
549
+ for (const e of link.ir.edges) {
550
+ const to = e.to;
551
+ const isDispatch = dispatchNodeById.has(to);
552
+ if (!isDispatch) continue;
553
+ incomingByDispatch.set(to, (incomingByDispatch.get(to) ?? 0) + 1);
554
+ const count = incomingByDispatch.get(to) ?? 0;
555
+ if (count > 1) {
556
+ throw new Error(
557
+ `[DeclarativeLinkRuntime] Invalid DeclarativeLinkIR: dispatch node has multiple incoming edges (linkId=${link.linkId}, nodeId=${to}).`
558
+ );
559
+ }
560
+ }
561
+ const dispatchTargetsByReadNode = /* @__PURE__ */ new Map();
562
+ for (const e of link.ir.edges) {
563
+ const from = e.from;
564
+ const to = e.to;
565
+ if (!readNodeById.has(from)) continue;
566
+ if (!dispatchNodeById.has(to)) continue;
567
+ const list = dispatchTargetsByReadNode.get(from) ?? [];
568
+ list.push(to);
569
+ dispatchTargetsByReadNode.set(from, list);
570
+ }
571
+ const stored = {
572
+ ...link,
573
+ readNodeById,
574
+ dispatchNodeById,
575
+ dispatchTargetsByReadNode,
576
+ readNodeState: /* @__PURE__ */ new Map()
577
+ };
578
+ declarativeById.set(link.linkId, stored);
579
+ for (const n of link.readNodes) {
580
+ const list = declarativeReadNodesBySource.get(n.moduleInstanceKey) ?? [];
581
+ list.push({ linkId: link.linkId, nodeId: n.nodeId });
582
+ declarativeReadNodesBySource.set(n.moduleInstanceKey, list);
583
+ }
584
+ return () => {
585
+ declarativeById.delete(link.linkId);
586
+ for (const n of link.readNodes) {
587
+ const list = declarativeReadNodesBySource.get(n.moduleInstanceKey);
588
+ if (!list) continue;
589
+ const next = list.filter((x) => !(x.linkId === link.linkId && x.nodeId === n.nodeId));
590
+ if (next.length === 0) {
591
+ declarativeReadNodesBySource.delete(n.moduleInstanceKey);
592
+ } else {
593
+ declarativeReadNodesBySource.set(n.moduleInstanceKey, next);
594
+ }
595
+ }
596
+ };
597
+ };
598
+ const applyForSources = (args) => import_effect7.Effect.gen(function* () {
599
+ let scheduled = false;
600
+ for (const sourceKey of args.changedModuleInstanceKeys) {
601
+ const ids = moduleAsSourceIdsBySource.get(sourceKey);
602
+ if (!ids || ids.size === 0) continue;
603
+ const commit = args.acceptedModules.get(sourceKey);
604
+ if (!commit) continue;
605
+ for (const id of ids) {
606
+ const link = moduleAsSourceById.get(id);
607
+ if (!link) continue;
608
+ let selected;
609
+ try {
610
+ selected = link.readQuery.select(commit.state);
611
+ } catch {
612
+ continue;
613
+ }
614
+ const nextValue = link.computeValue(selected);
615
+ if (link.hasValue && link.equalsValue(link.lastValue, nextValue)) {
616
+ continue;
617
+ }
618
+ link.hasValue = true;
619
+ link.lastValue = nextValue;
620
+ scheduled = true;
621
+ yield* link.applyValue(nextValue);
622
+ }
623
+ }
624
+ for (const sourceKey of args.changedModuleInstanceKeys) {
625
+ const refs = declarativeReadNodesBySource.get(sourceKey);
626
+ if (!refs || refs.length === 0) continue;
627
+ const commit = args.acceptedModules.get(sourceKey);
628
+ if (!commit) continue;
629
+ for (const ref of refs) {
630
+ const link = declarativeById.get(ref.linkId);
631
+ if (!link) continue;
632
+ const readNode = link.readNodeById.get(ref.nodeId);
633
+ if (!readNode) continue;
634
+ let value;
635
+ try {
636
+ value = readNode.readQuery.select(commit.state);
637
+ } catch {
638
+ continue;
639
+ }
640
+ const state = link.readNodeState.get(ref.nodeId) ?? { hasValue: false, lastValue: void 0 };
641
+ const changed = !state.hasValue || !Object.is(state.lastValue, value);
642
+ if (!changed) continue;
643
+ state.hasValue = true;
644
+ state.lastValue = value;
645
+ link.readNodeState.set(ref.nodeId, state);
646
+ const targets = link.dispatchTargetsByReadNode.get(ref.nodeId) ?? [];
647
+ for (const dispatchNodeId of targets) {
648
+ const node = link.dispatchNodeById.get(dispatchNodeId);
649
+ if (!node) continue;
650
+ scheduled = true;
651
+ yield* node.dispatch(value);
652
+ }
653
+ }
654
+ }
655
+ return { scheduled };
656
+ });
657
+ return {
658
+ registerModuleAsSourceLink,
659
+ registerDeclarativeLink,
660
+ applyForSources
661
+ };
662
+ };
663
+
664
+ // src/internal/runtime/core/env.ts
30
665
  var getNodeEnv = () => {
31
666
  try {
32
667
  const env = globalThis?.process?.env;
@@ -36,17 +671,40 @@ var getNodeEnv = () => {
36
671
  }
37
672
  };
38
673
  var isDevEnv = () => getNodeEnv() !== "production";
39
- var StateTransactionConfigTagImpl = class extends import_effect.Context.Tag("@logixjs/core/StateTransactionRuntimeConfig")() {
674
+ var StateTransactionConfigTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/StateTransactionRuntimeConfig")() {
675
+ };
676
+ var ReadQueryStrictGateConfigTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ReadQueryStrictGateRuntimeConfig")() {
677
+ };
678
+ var ReplayModeConfigTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ReplayModeConfig")() {
679
+ };
680
+ var StateTransactionOverridesTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/StateTransactionOverrides")() {
681
+ };
682
+ var ConcurrencyPolicyTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ConcurrencyPolicy")() {
40
683
  };
41
- var ReadQueryStrictGateConfigTagImpl = class extends import_effect.Context.Tag("@logixjs/core/ReadQueryStrictGateRuntimeConfig")() {
684
+ var ConcurrencyPolicyOverridesTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ConcurrencyPolicyOverrides")() {
42
685
  };
43
- var ReplayModeConfigTagImpl = class extends import_effect.Context.Tag("@logixjs/core/ReplayModeConfig")() {
686
+ var RuntimeStoreTag = class extends import_effect8.Context.Tag("@logixjs/core/RuntimeStore")() {
44
687
  };
45
- var StateTransactionOverridesTagImpl = class extends import_effect.Context.Tag("@logixjs/core/StateTransactionOverrides")() {
688
+ var runtimeStoreLayer = import_effect8.Layer.scoped(
689
+ RuntimeStoreTag,
690
+ import_effect8.Effect.acquireRelease(
691
+ import_effect8.Effect.sync(() => makeRuntimeStore()),
692
+ (store) => import_effect8.Effect.sync(() => store.dispose())
693
+ )
694
+ );
695
+ var HostSchedulerTag = class extends import_effect8.Context.Tag("@logixjs/core/HostScheduler")() {
46
696
  };
47
- var ConcurrencyPolicyTagImpl = class extends import_effect.Context.Tag("@logixjs/core/ConcurrencyPolicy")() {
697
+ var hostSchedulerLayer = import_effect8.Layer.succeed(
698
+ HostSchedulerTag,
699
+ getGlobalHostScheduler()
700
+ );
701
+ var DeclarativeLinkRuntimeTag = class extends import_effect8.Context.Tag("@logixjs/core/DeclarativeLinkRuntime")() {
48
702
  };
49
- var ConcurrencyPolicyOverridesTagImpl = class extends import_effect.Context.Tag("@logixjs/core/ConcurrencyPolicyOverrides")() {
703
+ var declarativeLinkRuntimeLayer = import_effect8.Layer.succeed(
704
+ DeclarativeLinkRuntimeTag,
705
+ makeDeclarativeLinkRuntime()
706
+ );
707
+ var TickSchedulerTag = class extends import_effect8.Context.Tag("@logixjs/core/TickScheduler")() {
50
708
  };
51
709
 
52
710
  // src/Env.ts