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