@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/Bound.cjs CHANGED
@@ -25,16 +25,16 @@ __export(Bound_exports, {
25
25
  module.exports = __toCommonJS(Bound_exports);
26
26
 
27
27
  // src/internal/runtime/core/BoundApiRuntime.ts
28
- var import_effect16 = require("effect");
28
+ var import_effect19 = require("effect");
29
29
 
30
30
  // src/internal/action.ts
31
31
  var import_effect = require("effect");
32
32
  var isActionToken = (value) => typeof value === "function" && value._kind === "ActionToken" && typeof value.tag === "string" && import_effect.Schema.isSchema(value.schema);
33
33
 
34
34
  // src/internal/runtime/core/TaskRunner.ts
35
- var import_effect6 = require("effect");
35
+ var import_effect9 = require("effect");
36
36
 
37
- // src/internal/runtime/core/DebugSink.ts
37
+ // src/internal/runtime/core/DebugSink.record.ts
38
38
  var import_effect4 = require("effect");
39
39
 
40
40
  // src/internal/observability/jsonValue.ts
@@ -78,7 +78,7 @@ var runWithMiddleware = (op, stack) => {
78
78
  });
79
79
  };
80
80
 
81
- // src/internal/runtime/core/DebugSink.ts
81
+ // src/internal/runtime/core/DebugSink.record.ts
82
82
  var currentDebugSinks = import_effect4.FiberRef.unsafeMake([]);
83
83
  var currentRuntimeLabel = import_effect4.FiberRef.unsafeMake(void 0);
84
84
  var currentTxnId = import_effect4.FiberRef.unsafeMake(void 0);
@@ -330,7 +330,441 @@ var record = (event) => import_effect4.Effect.gen(function* () {
330
330
  });
331
331
 
332
332
  // src/internal/runtime/core/env.ts
333
+ var import_effect8 = require("effect");
334
+
335
+ // src/internal/runtime/core/HostScheduler.ts
336
+ var noopCancel = () => {
337
+ };
338
+ var safeNowMs = () => {
339
+ const perf = globalThis.performance;
340
+ if (perf && typeof perf.now === "function") {
341
+ try {
342
+ const v = perf.now();
343
+ if (typeof v === "number" && Number.isFinite(v)) return v;
344
+ } catch {
345
+ }
346
+ }
347
+ return Date.now();
348
+ };
349
+ var safeQueueMicrotask = (cb) => {
350
+ const qm = globalThis.queueMicrotask;
351
+ if (typeof qm === "function") {
352
+ try {
353
+ qm(cb);
354
+ return;
355
+ } catch {
356
+ }
357
+ }
358
+ try {
359
+ Promise.resolve().then(cb);
360
+ } catch {
361
+ setTimeout(cb, 0);
362
+ }
363
+ };
364
+ var safeSetTimeout = (ms, cb) => {
365
+ const id = setTimeout(cb, ms);
366
+ return () => {
367
+ try {
368
+ clearTimeout(id);
369
+ } catch {
370
+ }
371
+ };
372
+ };
373
+ var makeMessageChannelMacrotask = () => {
374
+ const MC = globalThis.MessageChannel;
375
+ if (typeof MC !== "function") return void 0;
376
+ let channel;
377
+ try {
378
+ channel = new MC();
379
+ } catch {
380
+ return void 0;
381
+ }
382
+ const queue = [];
383
+ let scheduled = false;
384
+ const flush = () => {
385
+ scheduled = false;
386
+ const tasks = queue.splice(0, queue.length);
387
+ for (const t of tasks) {
388
+ if (t.canceled) continue;
389
+ try {
390
+ t.cb();
391
+ } catch {
392
+ }
393
+ }
394
+ };
395
+ try {
396
+ channel.port1.onmessage = flush;
397
+ } catch {
398
+ return void 0;
399
+ }
400
+ const schedule = (cb) => {
401
+ const task = { canceled: false, cb };
402
+ queue.push(task);
403
+ if (!scheduled) {
404
+ scheduled = true;
405
+ try {
406
+ channel.port2.postMessage(void 0);
407
+ } catch {
408
+ scheduled = false;
409
+ return safeSetTimeout(0, cb);
410
+ }
411
+ }
412
+ return () => {
413
+ task.canceled = true;
414
+ };
415
+ };
416
+ return schedule;
417
+ };
418
+ var makeSetImmediateMacrotask = () => {
419
+ const si = globalThis.setImmediate;
420
+ const ci = globalThis.clearImmediate;
421
+ if (typeof si !== "function") return void 0;
422
+ return (cb) => {
423
+ let id;
424
+ try {
425
+ id = si(cb);
426
+ } catch {
427
+ return safeSetTimeout(0, cb);
428
+ }
429
+ return () => {
430
+ if (typeof ci !== "function") return;
431
+ try {
432
+ ci(id);
433
+ } catch {
434
+ }
435
+ };
436
+ };
437
+ };
438
+ var makeRaf = () => {
439
+ const raf = globalThis.requestAnimationFrame;
440
+ const cancel = globalThis.cancelAnimationFrame;
441
+ if (typeof raf !== "function") return void 0;
442
+ return (cb) => {
443
+ let id;
444
+ try {
445
+ id = raf(cb);
446
+ } catch {
447
+ return noopCancel;
448
+ }
449
+ return () => {
450
+ if (typeof cancel !== "function") return;
451
+ try {
452
+ cancel(id);
453
+ } catch {
454
+ }
455
+ };
456
+ };
457
+ };
458
+ var makeDefaultHostScheduler = () => {
459
+ const macrotask = makeSetImmediateMacrotask() ?? makeMessageChannelMacrotask() ?? ((cb) => safeSetTimeout(0, cb));
460
+ const raf = makeRaf();
461
+ return {
462
+ nowMs: safeNowMs,
463
+ scheduleMicrotask: safeQueueMicrotask,
464
+ scheduleMacrotask: macrotask,
465
+ scheduleAnimationFrame: (cb) => raf?.(cb) ?? macrotask(cb),
466
+ scheduleTimeout: safeSetTimeout
467
+ };
468
+ };
469
+ var globalHostScheduler;
470
+ var getGlobalHostScheduler = () => {
471
+ globalHostScheduler ?? (globalHostScheduler = makeDefaultHostScheduler());
472
+ return globalHostScheduler;
473
+ };
474
+
475
+ // src/internal/runtime/core/RuntimeStore.ts
476
+ var parseTopicKey = (topicKey) => {
477
+ const idx = topicKey.indexOf("::");
478
+ if (idx <= 0) return void 0;
479
+ const moduleId = topicKey.slice(0, idx);
480
+ const rest = topicKey.slice(idx + 2);
481
+ if (rest.length === 0) return void 0;
482
+ const idx2 = rest.indexOf("::");
483
+ if (idx2 < 0) {
484
+ return { kind: "module", moduleInstanceKey: `${moduleId}::${rest}` };
485
+ }
486
+ const instanceId = rest.slice(0, idx2);
487
+ const suffix = rest.slice(idx2 + 2);
488
+ if (suffix.startsWith("rq:")) {
489
+ const selectorId = suffix.slice("rq:".length);
490
+ if (selectorId.length === 0) return void 0;
491
+ return {
492
+ kind: "readQuery",
493
+ moduleInstanceKey: `${moduleId}::${instanceId}`,
494
+ selectorId
495
+ };
496
+ }
497
+ return { kind: "module", moduleInstanceKey: `${moduleId}::${instanceId}` };
498
+ };
499
+ var makeRuntimeStore = () => {
500
+ let tickSeq = 0;
501
+ const moduleStates = /* @__PURE__ */ new Map();
502
+ const topicVersions = /* @__PURE__ */ new Map();
503
+ const topicPriorities = /* @__PURE__ */ new Map();
504
+ const listenersByTopic = /* @__PURE__ */ new Map();
505
+ const subscriberCountByModule = /* @__PURE__ */ new Map();
506
+ const getTopicVersion = (topicKey) => topicVersions.get(topicKey) ?? 0;
507
+ const getTopicPriority = (topicKey) => topicPriorities.get(topicKey) ?? "normal";
508
+ const commitTopicBump = (topicKey, priority) => {
509
+ const prev = topicVersions.get(topicKey) ?? 0;
510
+ topicVersions.set(topicKey, prev + 1);
511
+ topicPriorities.set(topicKey, priority);
512
+ };
513
+ const subscribeTopic = (topicKey, listener) => {
514
+ const info = parseTopicKey(topicKey);
515
+ const existing = listenersByTopic.get(topicKey);
516
+ const set = existing ?? /* @__PURE__ */ new Set();
517
+ const alreadyHas = set.has(listener);
518
+ if (!alreadyHas) {
519
+ set.add(listener);
520
+ }
521
+ if (!existing) {
522
+ listenersByTopic.set(topicKey, set);
523
+ }
524
+ if (!alreadyHas && info) {
525
+ const prev = subscriberCountByModule.get(info.moduleInstanceKey) ?? 0;
526
+ subscriberCountByModule.set(info.moduleInstanceKey, prev + 1);
527
+ }
528
+ return () => {
529
+ const current = listenersByTopic.get(topicKey);
530
+ if (!current) return;
531
+ const deleted = current.delete(listener);
532
+ if (deleted && info) {
533
+ const prev = subscriberCountByModule.get(info.moduleInstanceKey) ?? 0;
534
+ const next = prev - 1;
535
+ if (next <= 0) {
536
+ subscriberCountByModule.delete(info.moduleInstanceKey);
537
+ } else {
538
+ subscriberCountByModule.set(info.moduleInstanceKey, next);
539
+ }
540
+ }
541
+ if (current.size === 0) {
542
+ listenersByTopic.delete(topicKey);
543
+ }
544
+ };
545
+ };
546
+ const getTopicSubscriberCount = (topicKey) => listenersByTopic.get(topicKey)?.size ?? 0;
547
+ const getModuleSubscriberCount = (moduleInstanceKey) => subscriberCountByModule.get(moduleInstanceKey) ?? 0;
548
+ const registerModuleInstance = (args) => {
549
+ moduleStates.set(args.moduleInstanceKey, args.initialState);
550
+ if (!topicVersions.has(args.moduleInstanceKey)) {
551
+ topicVersions.set(args.moduleInstanceKey, 0);
552
+ topicPriorities.set(args.moduleInstanceKey, "normal");
553
+ }
554
+ };
555
+ const unregisterModuleInstance = (moduleInstanceKey) => {
556
+ moduleStates.delete(moduleInstanceKey);
557
+ };
558
+ const commitTick = (args) => {
559
+ tickSeq = args.tickSeq;
560
+ for (const [key, commit] of args.accepted.modules) {
561
+ moduleStates.set(key, commit.state);
562
+ }
563
+ const changedTopics = /* @__PURE__ */ new Map();
564
+ for (const [topicKey, priority] of args.accepted.dirtyTopics) {
565
+ commitTopicBump(topicKey, priority);
566
+ const listeners = Array.from(listenersByTopic.get(topicKey) ?? []);
567
+ if (listeners.length > 0) {
568
+ changedTopics.set(topicKey, { priority, listeners });
569
+ }
570
+ }
571
+ return { changedTopics };
572
+ };
573
+ const getModuleState = (moduleInstanceKey) => moduleStates.get(moduleInstanceKey);
574
+ const dispose = () => {
575
+ moduleStates.clear();
576
+ topicVersions.clear();
577
+ topicPriorities.clear();
578
+ listenersByTopic.clear();
579
+ subscriberCountByModule.clear();
580
+ };
581
+ return {
582
+ getTickSeq: () => tickSeq,
583
+ getModuleState,
584
+ getTopicVersion,
585
+ getTopicPriority,
586
+ subscribeTopic,
587
+ getTopicSubscriberCount,
588
+ getModuleSubscriberCount,
589
+ registerModuleInstance,
590
+ unregisterModuleInstance,
591
+ commitTick,
592
+ dispose
593
+ };
594
+ };
595
+
596
+ // src/internal/runtime/core/TickScheduler.ts
597
+ var import_effect6 = require("effect");
598
+
599
+ // src/internal/runtime/core/DevtoolsHub.ts
333
600
  var import_effect5 = require("effect");
601
+ var lastRunTs = 0;
602
+ var lastRunTsSeq = 0;
603
+ var nextRunId = () => {
604
+ const ts = Date.now();
605
+ if (ts === lastRunTs) {
606
+ lastRunTsSeq += 1;
607
+ } else {
608
+ lastRunTs = ts;
609
+ lastRunTsSeq = 0;
610
+ }
611
+ return lastRunTsSeq === 0 ? `run-${ts}` : `run-${ts}.${lastRunTsSeq}`;
612
+ };
613
+ var currentRunId = nextRunId();
614
+
615
+ // src/internal/runtime/core/DeclarativeLinkRuntime.ts
616
+ var import_effect7 = require("effect");
617
+ var makeDeclarativeLinkRuntime = () => {
618
+ const moduleAsSourceById = /* @__PURE__ */ new Map();
619
+ const moduleAsSourceIdsBySource = /* @__PURE__ */ new Map();
620
+ const declarativeById = /* @__PURE__ */ new Map();
621
+ const declarativeReadNodesBySource = /* @__PURE__ */ new Map();
622
+ const registerModuleAsSourceLink = (link) => {
623
+ const stored = {
624
+ ...link,
625
+ hasValue: false,
626
+ lastValue: void 0
627
+ };
628
+ moduleAsSourceById.set(link.id, stored);
629
+ const set = moduleAsSourceIdsBySource.get(link.sourceModuleInstanceKey) ?? /* @__PURE__ */ new Set();
630
+ set.add(link.id);
631
+ moduleAsSourceIdsBySource.set(link.sourceModuleInstanceKey, set);
632
+ return () => {
633
+ moduleAsSourceById.delete(link.id);
634
+ const current = moduleAsSourceIdsBySource.get(link.sourceModuleInstanceKey);
635
+ if (!current) return;
636
+ current.delete(link.id);
637
+ if (current.size === 0) {
638
+ moduleAsSourceIdsBySource.delete(link.sourceModuleInstanceKey);
639
+ }
640
+ };
641
+ };
642
+ const registerDeclarativeLink = (link) => {
643
+ const readNodeById = /* @__PURE__ */ new Map();
644
+ for (const n of link.readNodes) {
645
+ readNodeById.set(n.nodeId, n);
646
+ }
647
+ const dispatchNodeById = /* @__PURE__ */ new Map();
648
+ for (const n of link.dispatchNodes) {
649
+ dispatchNodeById.set(n.nodeId, n);
650
+ }
651
+ const incomingByDispatch = /* @__PURE__ */ new Map();
652
+ for (const e of link.ir.edges) {
653
+ const to = e.to;
654
+ const isDispatch = dispatchNodeById.has(to);
655
+ if (!isDispatch) continue;
656
+ incomingByDispatch.set(to, (incomingByDispatch.get(to) ?? 0) + 1);
657
+ const count = incomingByDispatch.get(to) ?? 0;
658
+ if (count > 1) {
659
+ throw new Error(
660
+ `[DeclarativeLinkRuntime] Invalid DeclarativeLinkIR: dispatch node has multiple incoming edges (linkId=${link.linkId}, nodeId=${to}).`
661
+ );
662
+ }
663
+ }
664
+ const dispatchTargetsByReadNode = /* @__PURE__ */ new Map();
665
+ for (const e of link.ir.edges) {
666
+ const from = e.from;
667
+ const to = e.to;
668
+ if (!readNodeById.has(from)) continue;
669
+ if (!dispatchNodeById.has(to)) continue;
670
+ const list = dispatchTargetsByReadNode.get(from) ?? [];
671
+ list.push(to);
672
+ dispatchTargetsByReadNode.set(from, list);
673
+ }
674
+ const stored = {
675
+ ...link,
676
+ readNodeById,
677
+ dispatchNodeById,
678
+ dispatchTargetsByReadNode,
679
+ readNodeState: /* @__PURE__ */ new Map()
680
+ };
681
+ declarativeById.set(link.linkId, stored);
682
+ for (const n of link.readNodes) {
683
+ const list = declarativeReadNodesBySource.get(n.moduleInstanceKey) ?? [];
684
+ list.push({ linkId: link.linkId, nodeId: n.nodeId });
685
+ declarativeReadNodesBySource.set(n.moduleInstanceKey, list);
686
+ }
687
+ return () => {
688
+ declarativeById.delete(link.linkId);
689
+ for (const n of link.readNodes) {
690
+ const list = declarativeReadNodesBySource.get(n.moduleInstanceKey);
691
+ if (!list) continue;
692
+ const next = list.filter((x) => !(x.linkId === link.linkId && x.nodeId === n.nodeId));
693
+ if (next.length === 0) {
694
+ declarativeReadNodesBySource.delete(n.moduleInstanceKey);
695
+ } else {
696
+ declarativeReadNodesBySource.set(n.moduleInstanceKey, next);
697
+ }
698
+ }
699
+ };
700
+ };
701
+ const applyForSources = (args) => import_effect7.Effect.gen(function* () {
702
+ let scheduled = false;
703
+ for (const sourceKey of args.changedModuleInstanceKeys) {
704
+ const ids = moduleAsSourceIdsBySource.get(sourceKey);
705
+ if (!ids || ids.size === 0) continue;
706
+ const commit = args.acceptedModules.get(sourceKey);
707
+ if (!commit) continue;
708
+ for (const id of ids) {
709
+ const link = moduleAsSourceById.get(id);
710
+ if (!link) continue;
711
+ let selected;
712
+ try {
713
+ selected = link.readQuery.select(commit.state);
714
+ } catch {
715
+ continue;
716
+ }
717
+ const nextValue = link.computeValue(selected);
718
+ if (link.hasValue && link.equalsValue(link.lastValue, nextValue)) {
719
+ continue;
720
+ }
721
+ link.hasValue = true;
722
+ link.lastValue = nextValue;
723
+ scheduled = true;
724
+ yield* link.applyValue(nextValue);
725
+ }
726
+ }
727
+ for (const sourceKey of args.changedModuleInstanceKeys) {
728
+ const refs = declarativeReadNodesBySource.get(sourceKey);
729
+ if (!refs || refs.length === 0) continue;
730
+ const commit = args.acceptedModules.get(sourceKey);
731
+ if (!commit) continue;
732
+ for (const ref of refs) {
733
+ const link = declarativeById.get(ref.linkId);
734
+ if (!link) continue;
735
+ const readNode = link.readNodeById.get(ref.nodeId);
736
+ if (!readNode) continue;
737
+ let value;
738
+ try {
739
+ value = readNode.readQuery.select(commit.state);
740
+ } catch {
741
+ continue;
742
+ }
743
+ const state = link.readNodeState.get(ref.nodeId) ?? { hasValue: false, lastValue: void 0 };
744
+ const changed = !state.hasValue || !Object.is(state.lastValue, value);
745
+ if (!changed) continue;
746
+ state.hasValue = true;
747
+ state.lastValue = value;
748
+ link.readNodeState.set(ref.nodeId, state);
749
+ const targets = link.dispatchTargetsByReadNode.get(ref.nodeId) ?? [];
750
+ for (const dispatchNodeId of targets) {
751
+ const node = link.dispatchNodeById.get(dispatchNodeId);
752
+ if (!node) continue;
753
+ scheduled = true;
754
+ yield* node.dispatch(value);
755
+ }
756
+ }
757
+ }
758
+ return { scheduled };
759
+ });
760
+ return {
761
+ registerModuleAsSourceLink,
762
+ registerDeclarativeLink,
763
+ applyForSources
764
+ };
765
+ };
766
+
767
+ // src/internal/runtime/core/env.ts
334
768
  var getNodeEnv = () => {
335
769
  try {
336
770
  const env = globalThis?.process?.env;
@@ -340,22 +774,45 @@ var getNodeEnv = () => {
340
774
  }
341
775
  };
342
776
  var isDevEnv = () => getNodeEnv() !== "production";
343
- var StateTransactionConfigTagImpl = class extends import_effect5.Context.Tag("@logixjs/core/StateTransactionRuntimeConfig")() {
777
+ var StateTransactionConfigTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/StateTransactionRuntimeConfig")() {
778
+ };
779
+ var ReadQueryStrictGateConfigTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ReadQueryStrictGateRuntimeConfig")() {
344
780
  };
345
- var ReadQueryStrictGateConfigTagImpl = class extends import_effect5.Context.Tag("@logixjs/core/ReadQueryStrictGateRuntimeConfig")() {
781
+ var ReplayModeConfigTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ReplayModeConfig")() {
346
782
  };
347
- var ReplayModeConfigTagImpl = class extends import_effect5.Context.Tag("@logixjs/core/ReplayModeConfig")() {
783
+ var StateTransactionOverridesTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/StateTransactionOverrides")() {
348
784
  };
349
- var StateTransactionOverridesTagImpl = class extends import_effect5.Context.Tag("@logixjs/core/StateTransactionOverrides")() {
785
+ var ConcurrencyPolicyTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ConcurrencyPolicy")() {
350
786
  };
351
- var ConcurrencyPolicyTagImpl = class extends import_effect5.Context.Tag("@logixjs/core/ConcurrencyPolicy")() {
787
+ var ConcurrencyPolicyOverridesTagImpl = class extends import_effect8.Context.Tag("@logixjs/core/ConcurrencyPolicyOverrides")() {
352
788
  };
353
- var ConcurrencyPolicyOverridesTagImpl = class extends import_effect5.Context.Tag("@logixjs/core/ConcurrencyPolicyOverrides")() {
789
+ var RuntimeStoreTag = class extends import_effect8.Context.Tag("@logixjs/core/RuntimeStore")() {
790
+ };
791
+ var runtimeStoreLayer = import_effect8.Layer.scoped(
792
+ RuntimeStoreTag,
793
+ import_effect8.Effect.acquireRelease(
794
+ import_effect8.Effect.sync(() => makeRuntimeStore()),
795
+ (store) => import_effect8.Effect.sync(() => store.dispose())
796
+ )
797
+ );
798
+ var HostSchedulerTag = class extends import_effect8.Context.Tag("@logixjs/core/HostScheduler")() {
799
+ };
800
+ var hostSchedulerLayer = import_effect8.Layer.succeed(
801
+ HostSchedulerTag,
802
+ getGlobalHostScheduler()
803
+ );
804
+ var DeclarativeLinkRuntimeTag = class extends import_effect8.Context.Tag("@logixjs/core/DeclarativeLinkRuntime")() {
805
+ };
806
+ var declarativeLinkRuntimeLayer = import_effect8.Layer.succeed(
807
+ DeclarativeLinkRuntimeTag,
808
+ makeDeclarativeLinkRuntime()
809
+ );
810
+ var TickSchedulerTag = class extends import_effect8.Context.Tag("@logixjs/core/TickScheduler")() {
354
811
  };
355
812
 
356
813
  // src/internal/runtime/core/TaskRunner.ts
357
- var inSyncTransactionFiber = import_effect6.FiberRef.unsafeMake(false);
358
- var forceSourceRefresh = import_effect6.FiberRef.unsafeMake(false);
814
+ var inSyncTransactionFiber = import_effect9.FiberRef.unsafeMake(false);
815
+ var forceSourceRefresh = import_effect9.FiberRef.unsafeMake(false);
359
816
  var resolve = (eff, payload) => typeof eff === "function" ? eff(payload) : eff;
360
817
  var defaultOrigins = (triggerName) => ({
361
818
  pending: {
@@ -371,8 +828,8 @@ var defaultOrigins = (triggerName) => ({
371
828
  name: "task:failure"
372
829
  }
373
830
  });
374
- var shouldNoopInSyncTransactionFiber = (options) => import_effect6.Effect.gen(function* () {
375
- const inTxn = yield* import_effect6.FiberRef.get(inSyncTransactionFiber);
831
+ var shouldNoopInSyncTransactionFiber = (options) => import_effect9.Effect.gen(function* () {
832
+ const inTxn = yield* import_effect9.FiberRef.get(inSyncTransactionFiber);
376
833
  if (!inTxn) {
377
834
  return false;
378
835
  }
@@ -391,8 +848,8 @@ var shouldNoopInSyncTransactionFiber = (options) => import_effect6.Effect.gen(fu
391
848
  }
392
849
  return true;
393
850
  });
394
- var resolveConcurrencyLimit = (runtime) => runtime.resolveConcurrencyPolicy ? runtime.resolveConcurrencyPolicy().pipe(import_effect6.Effect.map((p) => p.concurrencyLimit)) : import_effect6.Effect.succeed(16);
395
- var runTaskLifecycle = (payload, runtime, config, getCanWriteBack) => import_effect6.Effect.gen(function* () {
851
+ var resolveConcurrencyLimit = (runtime) => runtime.resolveConcurrencyPolicy ? runtime.resolveConcurrencyPolicy().pipe(import_effect9.Effect.map((p) => p.concurrencyLimit)) : import_effect9.Effect.succeed(16);
852
+ var runTaskLifecycle = (payload, runtime, config, getCanWriteBack) => import_effect9.Effect.gen(function* () {
396
853
  const noop = yield* shouldNoopInSyncTransactionFiber({
397
854
  moduleId: runtime.moduleId,
398
855
  instanceId: runtime.instanceId,
@@ -413,12 +870,12 @@ var runTaskLifecycle = (payload, runtime, config, getCanWriteBack) => import_eff
413
870
  };
414
871
  const pending = config.pending;
415
872
  if (pending) {
416
- yield* import_effect6.Effect.uninterruptible(
417
- runtime.runWithStateTransaction(origins.pending, () => import_effect6.Effect.asVoid(resolve(pending, payload)))
873
+ yield* import_effect9.Effect.uninterruptible(
874
+ runtime.runWithStateTransaction(origins.pending, () => import_effect9.Effect.asVoid(resolve(pending, payload)))
418
875
  );
419
876
  }
420
877
  const io = resolve(config.effect, payload);
421
- const exit = yield* import_effect6.Effect.exit(io);
878
+ const exit = yield* import_effect9.Effect.exit(io);
422
879
  if (getCanWriteBack) {
423
880
  const ok = yield* getCanWriteBack;
424
881
  if (!ok) {
@@ -428,21 +885,21 @@ var runTaskLifecycle = (payload, runtime, config, getCanWriteBack) => import_eff
428
885
  if (exit._tag === "Success") {
429
886
  const success = config.success;
430
887
  if (success) {
431
- yield* runtime.runWithStateTransaction(origins.success, () => import_effect6.Effect.asVoid(success(exit.value, payload)));
888
+ yield* runtime.runWithStateTransaction(origins.success, () => import_effect9.Effect.asVoid(success(exit.value, payload)));
432
889
  }
433
890
  return;
434
891
  }
435
892
  const cause = exit.cause;
436
- if (import_effect6.Cause.isInterrupted(cause)) {
893
+ if (import_effect9.Cause.isInterrupted(cause)) {
437
894
  return;
438
895
  }
439
896
  const failure = config.failure;
440
897
  if (failure) {
441
- yield* runtime.runWithStateTransaction(origins.failure, () => import_effect6.Effect.asVoid(failure(cause, payload)));
898
+ yield* runtime.runWithStateTransaction(origins.failure, () => import_effect9.Effect.asVoid(failure(cause, payload)));
442
899
  }
443
900
  }).pipe(
444
901
  // Watchers must not crash as a whole due to a single task failure: swallow errors, but keep them diagnosable.
445
- import_effect6.Effect.catchAllCause(
902
+ import_effect9.Effect.catchAllCause(
446
903
  (cause) => record({
447
904
  type: "diagnostic",
448
905
  moduleId: runtime.moduleId,
@@ -457,35 +914,35 @@ var runTaskLifecycle = (payload, runtime, config, getCanWriteBack) => import_eff
457
914
  kind: "task",
458
915
  name: config.triggerName
459
916
  }
460
- }).pipe(import_effect6.Effect.zipRight(import_effect6.Effect.logError("TaskRunner error", cause)))
917
+ }).pipe(import_effect9.Effect.zipRight(import_effect9.Effect.logError("TaskRunner error", cause)))
461
918
  )
462
919
  );
463
920
  var makeTaskRunner = (stream, mode, runtime, config) => {
464
921
  if (mode === "latest") {
465
- return import_effect6.Effect.gen(function* () {
466
- const taskIdRef = yield* import_effect6.Ref.make(0);
467
- const currentFiberRef = yield* import_effect6.Ref.make(void 0);
468
- const start = (payload) => import_effect6.Effect.gen(function* () {
469
- const taskId = yield* import_effect6.Ref.updateAndGet(taskIdRef, (n) => n + 1);
470
- const prev = yield* import_effect6.Ref.get(currentFiberRef);
922
+ return import_effect9.Effect.gen(function* () {
923
+ const taskIdRef = yield* import_effect9.Ref.make(0);
924
+ const currentFiberRef = yield* import_effect9.Ref.make(void 0);
925
+ const start = (payload) => import_effect9.Effect.gen(function* () {
926
+ const taskId = yield* import_effect9.Ref.updateAndGet(taskIdRef, (n) => n + 1);
927
+ const prev = yield* import_effect9.Ref.get(currentFiberRef);
471
928
  if (prev) {
472
- yield* import_effect6.Fiber.interruptFork(prev);
929
+ yield* import_effect9.Fiber.interruptFork(prev);
473
930
  }
474
- const canWriteBack = import_effect6.Ref.get(taskIdRef).pipe(import_effect6.Effect.map((current) => current === taskId));
475
- const fiber = yield* import_effect6.Effect.fork(
931
+ const canWriteBack = import_effect9.Ref.get(taskIdRef).pipe(import_effect9.Effect.map((current) => current === taskId));
932
+ const fiber = yield* import_effect9.Effect.fork(
476
933
  runTaskLifecycle(payload, runtime, config, canWriteBack)
477
934
  );
478
- yield* import_effect6.Ref.set(currentFiberRef, fiber);
935
+ yield* import_effect9.Ref.set(currentFiberRef, fiber);
479
936
  });
480
- return yield* import_effect6.Stream.runForEach(stream, start);
937
+ return yield* import_effect9.Stream.runForEach(stream, start);
481
938
  });
482
939
  }
483
940
  if (mode === "exhaust") {
484
- return import_effect6.Effect.gen(function* () {
941
+ return import_effect9.Effect.gen(function* () {
485
942
  const concurrency = yield* resolveConcurrencyLimit(runtime);
486
- const busyRef = yield* import_effect6.Ref.make(false);
487
- const mapper = (payload) => import_effect6.Effect.gen(function* () {
488
- const acquired = yield* import_effect6.Ref.modify(
943
+ const busyRef = yield* import_effect9.Ref.make(false);
944
+ const mapper = (payload) => import_effect9.Effect.gen(function* () {
945
+ const acquired = yield* import_effect9.Ref.modify(
489
946
  busyRef,
490
947
  (busy) => busy ? [false, busy] : [true, true]
491
948
  );
@@ -495,25 +952,25 @@ var makeTaskRunner = (stream, mode, runtime, config) => {
495
952
  try {
496
953
  yield* runTaskLifecycle(payload, runtime, config);
497
954
  } finally {
498
- yield* import_effect6.Ref.set(busyRef, false);
955
+ yield* import_effect9.Ref.set(busyRef, false);
499
956
  }
500
957
  });
501
- return yield* import_effect6.Stream.runDrain(stream.pipe(import_effect6.Stream.mapEffect(mapper, { concurrency })));
958
+ return yield* import_effect9.Stream.runDrain(stream.pipe(import_effect9.Stream.mapEffect(mapper, { concurrency })));
502
959
  });
503
960
  }
504
961
  if (mode === "parallel") {
505
- return import_effect6.Effect.gen(function* () {
962
+ return import_effect9.Effect.gen(function* () {
506
963
  const concurrency = yield* resolveConcurrencyLimit(runtime);
507
- return yield* import_effect6.Stream.runDrain(
964
+ return yield* import_effect9.Stream.runDrain(
508
965
  stream.pipe(
509
- import_effect6.Stream.mapEffect((payload) => runTaskLifecycle(payload, runtime, config), {
966
+ import_effect9.Stream.mapEffect((payload) => runTaskLifecycle(payload, runtime, config), {
510
967
  concurrency
511
968
  })
512
969
  )
513
970
  );
514
971
  });
515
972
  }
516
- return import_effect6.Stream.runForEach(
973
+ return import_effect9.Stream.runForEach(
517
974
  stream,
518
975
  (payload) => runTaskLifecycle(payload, runtime, config)
519
976
  );
@@ -574,14 +1031,14 @@ var mutateWithPatchPaths = (base, mutator) => {
574
1031
  };
575
1032
 
576
1033
  // src/internal/runtime/core/FlowRuntime.ts
577
- var import_effect9 = require("effect");
1034
+ var import_effect12 = require("effect");
578
1035
 
579
1036
  // src/internal/effect-op.ts
580
- var import_effect8 = require("effect");
1037
+ var import_effect11 = require("effect");
581
1038
 
582
1039
  // src/internal/observability/runSession.ts
583
- var import_effect7 = require("effect");
584
- var RunSessionTagImpl = class extends import_effect7.Context.Tag("@logixjs/core/RunSession")() {
1040
+ var import_effect10 = require("effect");
1041
+ var RunSessionTagImpl = class extends import_effect10.Context.Tag("@logixjs/core/RunSession")() {
585
1042
  };
586
1043
  var RunSessionTag = RunSessionTagImpl;
587
1044
 
@@ -617,8 +1074,8 @@ function isReadQuery(input) {
617
1074
  }
618
1075
 
619
1076
  // src/internal/runtime/core/FlowRuntime.ts
620
- var getMiddlewareStack = () => import_effect9.Effect.serviceOption(EffectOpMiddlewareTag).pipe(
621
- import_effect9.Effect.map((maybe) => import_effect9.Option.isSome(maybe) ? maybe.value.stack : [])
1077
+ var getMiddlewareStack = () => import_effect12.Effect.serviceOption(EffectOpMiddlewareTag).pipe(
1078
+ import_effect12.Effect.map((maybe) => import_effect12.Option.isSome(maybe) ? maybe.value.stack : [])
622
1079
  );
623
1080
  var getRuntimeScope = (runtime) => {
624
1081
  if (!runtime) return {};
@@ -632,8 +1089,8 @@ var getRuntimeScope = (runtime) => {
632
1089
  var resolveEffect = (eff, payload) => typeof eff === "function" ? eff(payload) : eff;
633
1090
  var make2 = (runtime, runtimeInternals) => {
634
1091
  const scope = getRuntimeScope(runtime);
635
- const resolveConcurrencyLimit2 = () => runtimeInternals ? runtimeInternals.concurrency.resolveConcurrencyPolicy().pipe(import_effect9.Effect.map((p) => p.concurrencyLimit)) : import_effect9.Effect.succeed(16);
636
- const runAsFlowOp = (name, payload, eff, options) => import_effect9.Effect.gen(function* () {
1092
+ const resolveConcurrencyLimit2 = () => runtimeInternals ? runtimeInternals.concurrency.resolveConcurrencyPolicy().pipe(import_effect12.Effect.map((p) => p.concurrencyLimit)) : import_effect12.Effect.succeed(16);
1093
+ const runAsFlowOp = (name, payload, eff, options) => import_effect12.Effect.gen(function* () {
637
1094
  const stack = yield* getMiddlewareStack();
638
1095
  const meta = {
639
1096
  ...options?.meta ?? {},
@@ -644,8 +1101,8 @@ var make2 = (runtime, runtimeInternals) => {
644
1101
  instanceId: scope.instanceId
645
1102
  };
646
1103
  if (!(typeof meta.opSeq === "number" && Number.isFinite(meta.opSeq))) {
647
- const sessionOpt = yield* import_effect9.Effect.serviceOption(RunSessionTag);
648
- if (import_effect9.Option.isSome(sessionOpt)) {
1104
+ const sessionOpt = yield* import_effect12.Effect.serviceOption(RunSessionTag);
1105
+ if (import_effect12.Option.isSome(sessionOpt)) {
649
1106
  const key = meta.instanceId ?? "global";
650
1107
  meta.opSeq = sessionOpt.value.local.nextSeq("opSeq", key);
651
1108
  }
@@ -660,21 +1117,21 @@ var make2 = (runtime, runtimeInternals) => {
660
1117
  return yield* run(op, stack);
661
1118
  });
662
1119
  const runEffect = (eff) => (payload) => resolveEffect(eff, payload);
663
- const runStreamSequential = (eff, options) => (stream) => import_effect9.Stream.runForEach(
1120
+ const runStreamSequential = (eff, options) => (stream) => import_effect12.Stream.runForEach(
664
1121
  stream,
665
1122
  (payload) => runAsFlowOp("flow.run", payload, runEffect(eff)(payload), options)
666
1123
  );
667
- const runStreamParallel = (eff, options) => (stream) => import_effect9.Effect.gen(function* () {
1124
+ const runStreamParallel = (eff, options) => (stream) => import_effect12.Effect.gen(function* () {
668
1125
  const concurrency = yield* resolveConcurrencyLimit2();
669
- return yield* import_effect9.Stream.runDrain(
1126
+ return yield* import_effect12.Stream.runDrain(
670
1127
  stream.pipe(
671
- import_effect9.Stream.mapEffect(
1128
+ import_effect12.Stream.mapEffect(
672
1129
  (payload) => runAsFlowOp("flow.runParallel", payload, runEffect(eff)(payload), options),
673
1130
  { concurrency }
674
1131
  )
675
1132
  )
676
1133
  ).pipe(
677
- import_effect9.Effect.catchAllCause(
1134
+ import_effect12.Effect.catchAllCause(
678
1135
  (cause) => record({
679
1136
  type: "diagnostic",
680
1137
  moduleId: scope.moduleId,
@@ -688,25 +1145,25 @@ var make2 = (runtime, runtimeInternals) => {
688
1145
  kind: "flow",
689
1146
  name: "runParallel"
690
1147
  }
691
- }).pipe(import_effect9.Effect.zipRight(import_effect9.Effect.failCause(cause)))
1148
+ }).pipe(import_effect12.Effect.zipRight(import_effect12.Effect.failCause(cause)))
692
1149
  )
693
1150
  );
694
1151
  });
695
1152
  return {
696
- fromAction: (predicate) => runtime.actions$.pipe(import_effect9.Stream.filter(predicate)),
1153
+ fromAction: (predicate) => runtime.actions$.pipe(import_effect12.Stream.filter(predicate)),
697
1154
  fromState: (selectorOrQuery) => runtime.changes(isReadQuery(selectorOrQuery) ? selectorOrQuery.select : selectorOrQuery),
698
- debounce: (ms) => (stream) => import_effect9.Stream.debounce(stream, ms),
699
- throttle: (ms) => (stream) => import_effect9.Stream.throttle(stream, {
1155
+ debounce: (ms) => (stream) => import_effect12.Stream.debounce(stream, ms),
1156
+ throttle: (ms) => (stream) => import_effect12.Stream.throttle(stream, {
700
1157
  cost: () => 1,
701
1158
  units: 1,
702
1159
  duration: ms,
703
1160
  strategy: "enforce"
704
1161
  }),
705
- filter: (predicate) => (stream) => import_effect9.Stream.filter(stream, predicate),
1162
+ filter: (predicate) => (stream) => import_effect12.Stream.filter(stream, predicate),
706
1163
  run: (eff, options) => (stream) => runStreamSequential(eff, options)(stream),
707
1164
  runParallel: (eff, options) => (stream) => runStreamParallel(eff, options)(stream),
708
- runLatest: (eff, options) => (stream) => import_effect9.Stream.runDrain(
709
- import_effect9.Stream.map(
1165
+ runLatest: (eff, options) => (stream) => import_effect12.Stream.runDrain(
1166
+ import_effect12.Stream.map(
710
1167
  stream,
711
1168
  (payload) => runAsFlowOp(
712
1169
  "flow.runLatest",
@@ -715,16 +1172,16 @@ var make2 = (runtime, runtimeInternals) => {
715
1172
  options
716
1173
  )
717
1174
  ).pipe(
718
- import_effect9.Stream.flatMap((effect) => import_effect9.Stream.fromEffect(effect), {
1175
+ import_effect12.Stream.flatMap((effect) => import_effect12.Stream.fromEffect(effect), {
719
1176
  switch: true
720
1177
  })
721
1178
  )
722
1179
  ),
723
- runExhaust: (eff, options) => (stream) => import_effect9.Effect.gen(function* () {
1180
+ runExhaust: (eff, options) => (stream) => import_effect12.Effect.gen(function* () {
724
1181
  const concurrency = yield* resolveConcurrencyLimit2();
725
- const busyRef = yield* import_effect9.Ref.make(false);
726
- const mapper = (payload) => import_effect9.Effect.gen(function* () {
727
- const acquired = yield* import_effect9.Ref.modify(
1182
+ const busyRef = yield* import_effect12.Ref.make(false);
1183
+ const mapper = (payload) => import_effect12.Effect.gen(function* () {
1184
+ const acquired = yield* import_effect12.Ref.modify(
728
1185
  busyRef,
729
1186
  (busy) => busy ? [false, busy] : [true, true]
730
1187
  );
@@ -739,16 +1196,16 @@ var make2 = (runtime, runtimeInternals) => {
739
1196
  options
740
1197
  );
741
1198
  } finally {
742
- yield* import_effect9.Ref.set(busyRef, false);
1199
+ yield* import_effect12.Ref.set(busyRef, false);
743
1200
  }
744
1201
  });
745
- return yield* import_effect9.Stream.runDrain(stream.pipe(import_effect9.Stream.mapEffect(mapper, { concurrency })));
1202
+ return yield* import_effect12.Stream.runDrain(stream.pipe(import_effect12.Stream.mapEffect(mapper, { concurrency })));
746
1203
  })
747
1204
  };
748
1205
  };
749
1206
 
750
1207
  // src/internal/runtime/core/MatchBuilder.ts
751
- var import_effect10 = require("effect");
1208
+ var import_effect13 = require("effect");
752
1209
  var makeMatch = (value) => {
753
1210
  let result;
754
1211
  const chain = {
@@ -767,7 +1224,7 @@ var makeMatch = (value) => {
767
1224
  if (result) {
768
1225
  return result;
769
1226
  }
770
- return import_effect10.Effect.dieMessage("[FluentMatch] Non-exhaustive match: no pattern matched value");
1227
+ return import_effect13.Effect.dieMessage("[FluentMatch] Non-exhaustive match: no pattern matched value");
771
1228
  }
772
1229
  };
773
1230
  return chain;
@@ -790,24 +1247,24 @@ var makeMatchTag = (value) => {
790
1247
  if (result) {
791
1248
  return result;
792
1249
  }
793
- return import_effect10.Effect.dieMessage("[FluentMatchTag] Non-exhaustive match: no tag handler matched value");
1250
+ return import_effect13.Effect.dieMessage("[FluentMatchTag] Non-exhaustive match: no tag handler matched value");
794
1251
  }
795
1252
  };
796
1253
  return chain;
797
1254
  };
798
1255
 
799
1256
  // src/internal/runtime/core/Platform.ts
800
- var import_effect11 = require("effect");
801
- var Tag = import_effect11.Context.GenericTag("@logixjs/Platform");
1257
+ var import_effect14 = require("effect");
1258
+ var Tag = import_effect14.Context.GenericTag("@logixjs/Platform");
802
1259
 
803
1260
  // src/internal/runtime/core/Lifecycle.ts
804
- var import_effect12 = require("effect");
805
- var LifecycleContext = import_effect12.Context.GenericTag("@logixjs/LifecycleManager");
1261
+ var import_effect15 = require("effect");
1262
+ var LifecycleContext = import_effect15.Context.GenericTag("@logixjs/LifecycleManager");
806
1263
 
807
1264
  // src/internal/runtime/core/LogicDiagnostics.ts
808
- var import_effect13 = require("effect");
809
- var LogicPhaseServiceTag = import_effect13.Context.GenericTag("@logixjs/LogicPhaseService");
810
- var LogicUnitServiceTag = class extends import_effect13.Context.Tag("@logixjs/LogicUnitService")() {
1265
+ var import_effect16 = require("effect");
1266
+ var LogicPhaseServiceTag = import_effect16.Context.GenericTag("@logixjs/LogicPhaseService");
1267
+ var LogicUnitServiceTag = class extends import_effect16.Context.Tag("@logixjs/LogicUnitService")() {
811
1268
  };
812
1269
  var makeLogicPhaseError = (kind, api, phase, moduleId) => Object.assign(new Error(`[LogicPhaseError] ${api} is not allowed in ${phase} phase (kind=${kind}).`), {
813
1270
  _tag: "LogicPhaseError",
@@ -818,11 +1275,11 @@ var makeLogicPhaseError = (kind, api, phase, moduleId) => Object.assign(new Erro
818
1275
  });
819
1276
 
820
1277
  // src/internal/root.ts
821
- var import_effect15 = require("effect");
1278
+ var import_effect18 = require("effect");
822
1279
 
823
1280
  // src/internal/runtime/core/RootContext.ts
824
- var import_effect14 = require("effect");
825
- var RootContextTagImpl = class extends import_effect14.Context.Tag("@logixjs/core/RootContext")() {
1281
+ var import_effect17 = require("effect");
1282
+ var RootContextTagImpl = class extends import_effect17.Context.Tag("@logixjs/core/RootContext")() {
826
1283
  };
827
1284
  var RootContextTag = RootContextTagImpl;
828
1285
 
@@ -857,19 +1314,19 @@ ${extra}` : "",
857
1314
  err.fix = fix;
858
1315
  return err;
859
1316
  };
860
- var resolve2 = (tag, options) => import_effect15.Effect.gen(function* () {
1317
+ var resolve2 = (tag, options) => import_effect18.Effect.gen(function* () {
861
1318
  const entrypoint = options?.entrypoint ?? "logic.root.resolve";
862
1319
  const root = yield* RootContextTag;
863
1320
  const rootContext = root.context ?? (options?.waitForReady ? yield* root.ready : void 0);
864
1321
  if (!rootContext) {
865
- return yield* import_effect15.Effect.die(
1322
+ return yield* import_effect18.Effect.die(
866
1323
  makeMissingRootProviderError(tag, entrypoint, "reason: rootContextNotReady")
867
1324
  );
868
1325
  }
869
1326
  try {
870
- return import_effect15.Context.get(rootContext, tag);
1327
+ return import_effect18.Context.get(rootContext, tag);
871
1328
  } catch {
872
- return yield* import_effect15.Effect.die(makeMissingRootProviderError(tag, entrypoint));
1329
+ return yield* import_effect18.Effect.die(makeMissingRootProviderError(tag, entrypoint));
873
1330
  }
874
1331
  });
875
1332
 
@@ -933,7 +1390,7 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
933
1390
  debounce: (ms) => LogicBuilderFactory(runtime, runtimeInternals)(flowApi.debounce(ms)(stream), triggerName),
934
1391
  throttle: (ms) => LogicBuilderFactory(runtime, runtimeInternals)(flowApi.throttle(ms)(stream), triggerName),
935
1392
  filter: (predicate) => LogicBuilderFactory(runtime, runtimeInternals)(flowApi.filter(predicate)(stream), triggerName),
936
- map: (f) => LogicBuilderFactory(runtime, runtimeInternals)(stream.pipe(import_effect16.Stream.map(f)), triggerName),
1393
+ map: (f) => LogicBuilderFactory(runtime, runtimeInternals)(stream.pipe(import_effect19.Stream.map(f)), triggerName),
937
1394
  run(eff, options) {
938
1395
  return flowApi.run(eff, options)(stream);
939
1396
  },
@@ -946,8 +1403,8 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
946
1403
  runParallel(eff, options) {
947
1404
  return flowApi.runParallel(eff, options)(stream);
948
1405
  },
949
- runFork: (eff) => import_effect16.Effect.forkScoped(flowApi.run(eff)(stream)).pipe(import_effect16.Effect.asVoid),
950
- runParallelFork: (eff) => import_effect16.Effect.forkScoped(flowApi.runParallel(eff)(stream)).pipe(import_effect16.Effect.asVoid),
1406
+ runFork: (eff) => import_effect19.Effect.forkScoped(flowApi.run(eff)(stream)).pipe(import_effect19.Effect.asVoid),
1407
+ runParallelFork: (eff) => import_effect19.Effect.forkScoped(flowApi.runParallel(eff)(stream)).pipe(import_effect19.Effect.asVoid),
951
1408
  runTask: (config) => makeTaskRunner(stream, "task", taskRunnerRuntime, {
952
1409
  ...config,
953
1410
  triggerName: config.triggerName ?? triggerName
@@ -965,20 +1422,20 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
965
1422
  triggerName: config.triggerName ?? triggerName
966
1423
  }),
967
1424
  toStream: () => stream,
968
- update: (reducer) => import_effect16.Stream.runForEach(
1425
+ update: (reducer) => import_effect19.Stream.runForEach(
969
1426
  stream,
970
1427
  (payload) => taskRunnerRuntime.runWithStateTransaction(
971
1428
  {
972
1429
  kind: "watcher:update",
973
1430
  name: triggerName
974
1431
  },
975
- () => import_effect16.Effect.gen(function* () {
1432
+ () => import_effect19.Effect.gen(function* () {
976
1433
  const prev = yield* runtime.getState;
977
1434
  const next = reducer(prev, payload);
978
- if (import_effect16.Effect.isEffect(next)) {
979
- const exit = yield* import_effect16.Effect.exit(next);
1435
+ if (import_effect19.Effect.isEffect(next)) {
1436
+ const exit = yield* import_effect19.Effect.exit(next);
980
1437
  if (exit._tag === "Failure") {
981
- yield* import_effect16.Effect.logError("Flow error", exit.cause);
1438
+ yield* import_effect19.Effect.logError("Flow error", exit.cause);
982
1439
  return;
983
1440
  }
984
1441
  yield* runtime.setState(exit.value);
@@ -987,15 +1444,15 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
987
1444
  yield* runtime.setState(next);
988
1445
  })
989
1446
  )
990
- ).pipe(import_effect16.Effect.catchAllCause((cause) => import_effect16.Effect.logError("Flow error", cause))),
991
- mutate: (reducer) => import_effect16.Stream.runForEach(
1447
+ ).pipe(import_effect19.Effect.catchAllCause((cause) => import_effect19.Effect.logError("Flow error", cause))),
1448
+ mutate: (reducer) => import_effect19.Stream.runForEach(
992
1449
  stream,
993
1450
  (payload) => taskRunnerRuntime.runWithStateTransaction(
994
1451
  {
995
1452
  kind: "watcher:mutate",
996
1453
  name: triggerName
997
1454
  },
998
- () => import_effect16.Effect.gen(function* () {
1455
+ () => import_effect19.Effect.gen(function* () {
999
1456
  const prev = yield* runtime.getState;
1000
1457
  const recordPatch = runtimeInternals.txn.recordStatePatch;
1001
1458
  const updateDraft = runtimeInternals.txn.updateDraft;
@@ -1008,7 +1465,7 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
1008
1465
  updateDraft(nextState);
1009
1466
  })
1010
1467
  )
1011
- ).pipe(import_effect16.Effect.catchAllCause((cause) => import_effect16.Effect.logError("Flow error", cause)))
1468
+ ).pipe(import_effect19.Effect.catchAllCause((cause) => import_effect19.Effect.logError("Flow error", cause)))
1012
1469
  };
1013
1470
  const pipe = function() {
1014
1471
  const fns = arguments;
@@ -1038,19 +1495,19 @@ function make3(shape, runtime, options) {
1038
1495
  };
1039
1496
  const flowApi = make2(runtime, runtimeInternals);
1040
1497
  const makeIntentBuilder = (runtime_) => LogicBuilderFactory(runtime_, runtimeInternals);
1041
- const withLifecycle = (available, missing) => import_effect16.Effect.serviceOption(LifecycleContext).pipe(
1042
- import_effect16.Effect.flatMap(
1043
- (maybe) => import_effect16.Option.match(maybe, {
1498
+ const withLifecycle = (available, missing) => import_effect19.Effect.serviceOption(LifecycleContext).pipe(
1499
+ import_effect19.Effect.flatMap(
1500
+ (maybe) => import_effect19.Option.match(maybe, {
1044
1501
  onSome: available,
1045
1502
  onNone: missing
1046
1503
  })
1047
1504
  )
1048
1505
  );
1049
- const withPlatform = (invoke) => import_effect16.Effect.serviceOption(Tag).pipe(
1050
- import_effect16.Effect.flatMap(
1051
- (maybe) => import_effect16.Option.match(maybe, {
1506
+ const withPlatform = (invoke) => import_effect19.Effect.serviceOption(Tag).pipe(
1507
+ import_effect19.Effect.flatMap(
1508
+ (maybe) => import_effect19.Option.match(maybe, {
1052
1509
  onSome: invoke,
1053
- onNone: () => import_effect16.Effect.void
1510
+ onNone: () => import_effect19.Effect.void
1054
1511
  })
1055
1512
  )
1056
1513
  );
@@ -1065,12 +1522,12 @@ function make3(shape, runtime, options) {
1065
1522
  kind: "lifecycle_in_run"
1066
1523
  });
1067
1524
  const createIntentBuilder = (stream, triggerName) => makeIntentBuilder(runtime)(stream, triggerName);
1068
- const onceInRunSession = (key) => import_effect16.Effect.serviceOption(RunSessionTag).pipe(
1069
- import_effect16.Effect.map((maybe) => import_effect16.Option.isSome(maybe) ? maybe.value.local.once(key) : true)
1525
+ const onceInRunSession = (key) => import_effect19.Effect.serviceOption(RunSessionTag).pipe(
1526
+ import_effect19.Effect.map((maybe) => import_effect19.Option.isSome(maybe) ? maybe.value.local.once(key) : true)
1070
1527
  );
1071
1528
  let cachedDiagnosticsLevel;
1072
1529
  const isModuleLike = (value) => Boolean(
1073
- value && typeof value === "object" && (value._kind === "ModuleDef" || value._kind === "Module") && "tag" in value && import_effect16.Context.isTag(value.tag)
1530
+ value && typeof value === "object" && (value._kind === "ModuleDef" || value._kind === "Module") && "tag" in value && import_effect19.Context.isTag(value.tag)
1074
1531
  );
1075
1532
  const buildModuleHandle = (tag, rt) => {
1076
1533
  const actionsProxy = new Proxy(
@@ -1083,7 +1540,7 @@ function make3(shape, runtime, options) {
1083
1540
  }
1084
1541
  );
1085
1542
  const handle = {
1086
- read: (selector) => import_effect16.Effect.map(rt.getState, selector),
1543
+ read: (selector) => import_effect19.Effect.map(rt.getState, selector),
1087
1544
  changes: rt.changes,
1088
1545
  dispatch: rt.dispatch,
1089
1546
  actions$: rt.actions$,
@@ -1093,7 +1550,7 @@ function make3(shape, runtime, options) {
1093
1550
  const extend = tag?.[EXTEND_HANDLE];
1094
1551
  return typeof extend === "function" ? extend(rt, handle) ?? handle : handle;
1095
1552
  };
1096
- const emitModuleDescriptorOnce = (module2, rt) => import_effect16.Effect.gen(function* () {
1553
+ const emitModuleDescriptorOnce = (module2, rt) => import_effect19.Effect.gen(function* () {
1097
1554
  if (cachedDiagnosticsLevel === "off") return;
1098
1555
  const key = `module_descriptor:${String(rt.instanceId ?? "unknown")}`;
1099
1556
  const shouldEmit = yield* onceInRunSession(key);
@@ -1133,7 +1590,7 @@ function make3(shape, runtime, options) {
1133
1590
  data
1134
1591
  });
1135
1592
  });
1136
- const resolveModuleRuntime = (tag) => import_effect16.Effect.gen(function* () {
1593
+ const resolveModuleRuntime = (tag) => import_effect19.Effect.gen(function* () {
1137
1594
  const requestedModuleId = typeof tag?.id === "string" ? tag.id : void 0;
1138
1595
  const fromModuleId = typeof options?.moduleId === "string" ? options.moduleId : runtime.moduleId;
1139
1596
  if (requestedModuleId && requestedModuleId === runtime.moduleId) {
@@ -1144,8 +1601,8 @@ function make3(shape, runtime, options) {
1144
1601
  return fromImports;
1145
1602
  }
1146
1603
  if (typeof options?.moduleId !== "string") {
1147
- const fromEnv = yield* import_effect16.Effect.serviceOption(tag);
1148
- if (import_effect16.Option.isSome(fromEnv)) {
1604
+ const fromEnv = yield* import_effect19.Effect.serviceOption(tag);
1605
+ if (import_effect19.Option.isSome(fromEnv)) {
1149
1606
  return fromEnv.value;
1150
1607
  }
1151
1608
  }
@@ -1180,23 +1637,23 @@ function make3(shape, runtime, options) {
1180
1637
  };
1181
1638
  err.fix = fix;
1182
1639
  err.name = "MissingModuleRuntimeError";
1183
- return yield* import_effect16.Effect.die(err);
1640
+ return yield* import_effect19.Effect.die(err);
1184
1641
  });
1185
1642
  const stateApi = {
1186
1643
  read: runtime.getState,
1187
- update: (f) => import_effect16.Effect.gen(function* () {
1188
- const inTxn = yield* import_effect16.FiberRef.get(inSyncTransactionFiber);
1644
+ update: (f) => import_effect19.Effect.gen(function* () {
1645
+ const inTxn = yield* import_effect19.FiberRef.get(inSyncTransactionFiber);
1189
1646
  if (inTxn) {
1190
1647
  const prev = yield* runtime.getState;
1191
1648
  return yield* runtime.setState(f(prev));
1192
1649
  }
1193
- const body = () => import_effect16.Effect.flatMap(runtime.getState, (prev) => runtime.setState(f(prev)));
1650
+ const body = () => import_effect19.Effect.flatMap(runtime.getState, (prev) => runtime.setState(f(prev)));
1194
1651
  return yield* runtimeInternals ? runtimeInternals.txn.runWithStateTransaction({ kind: "state", name: "update" }, body) : body();
1195
1652
  }),
1196
- mutate: (f) => import_effect16.Effect.gen(function* () {
1653
+ mutate: (f) => import_effect19.Effect.gen(function* () {
1197
1654
  const recordPatch = runtimeInternals?.txn.recordStatePatch;
1198
1655
  const updateDraft = runtimeInternals?.txn.updateDraft;
1199
- const inTxn = yield* import_effect16.FiberRef.get(inSyncTransactionFiber);
1656
+ const inTxn = yield* import_effect19.FiberRef.get(inSyncTransactionFiber);
1200
1657
  if (inTxn) {
1201
1658
  const prev = yield* runtime.getState;
1202
1659
  const { nextState, patchPaths } = mutateWithPatchPaths(prev, (draft) => {
@@ -1208,7 +1665,7 @@ function make3(shape, runtime, options) {
1208
1665
  updateDraft?.(nextState);
1209
1666
  return;
1210
1667
  }
1211
- const body = () => import_effect16.Effect.gen(function* () {
1668
+ const body = () => import_effect19.Effect.gen(function* () {
1212
1669
  const prev = yield* runtime.getState;
1213
1670
  const { nextState, patchPaths } = mutateWithPatchPaths(prev, (draft) => {
1214
1671
  f(draft);
@@ -1257,13 +1714,13 @@ function make3(shape, runtime, options) {
1257
1714
  const matchApi = (value) => makeMatch(value);
1258
1715
  const matchTagApi = (value) => makeMatchTag(value);
1259
1716
  const reducer = (tag, fn) => {
1260
- return import_effect16.Effect.sync(() => {
1717
+ return import_effect19.Effect.sync(() => {
1261
1718
  runtimeInternals.txn.registerReducer(String(tag), fn);
1262
1719
  });
1263
1720
  };
1264
- const effect = (token, handler) => import_effect16.Effect.gen(function* () {
1721
+ const effect = (token, handler) => import_effect19.Effect.gen(function* () {
1265
1722
  if (!isActionToken(token)) {
1266
- return yield* import_effect16.Effect.dieMessage("[BoundApi.effect] token must be an ActionToken");
1723
+ return yield* import_effect19.Effect.dieMessage("[BoundApi.effect] token must be an ActionToken");
1267
1724
  }
1268
1725
  const phase = getCurrentPhase();
1269
1726
  const logicUnit = options?.logicUnit;
@@ -1303,56 +1760,56 @@ function make3(shape, runtime, options) {
1303
1760
  return emitSetupOnlyViolation("$.lifecycle.onInitRequired");
1304
1761
  }
1305
1762
  runtimeInternals.lifecycle.registerInitRequired(eff);
1306
- return import_effect16.Effect.void;
1763
+ return import_effect19.Effect.void;
1307
1764
  },
1308
1765
  onStart: (eff) => {
1309
1766
  if (getCurrentPhase() === "run") {
1310
1767
  return emitSetupOnlyViolation("$.lifecycle.onStart");
1311
1768
  }
1312
1769
  runtimeInternals.lifecycle.registerStart(eff);
1313
- return import_effect16.Effect.void;
1770
+ return import_effect19.Effect.void;
1314
1771
  },
1315
1772
  onInit: (eff) => {
1316
1773
  if (getCurrentPhase() === "run") {
1317
1774
  return emitSetupOnlyViolation("$.lifecycle.onInit");
1318
1775
  }
1319
1776
  runtimeInternals.lifecycle.registerInitRequired(eff);
1320
- return import_effect16.Effect.void;
1777
+ return import_effect19.Effect.void;
1321
1778
  },
1322
1779
  onDestroy: (eff) => {
1323
1780
  if (getCurrentPhase() === "run") {
1324
1781
  return emitSetupOnlyViolation("$.lifecycle.onDestroy");
1325
1782
  }
1326
1783
  runtimeInternals.lifecycle.registerDestroy(eff);
1327
- return import_effect16.Effect.void;
1784
+ return import_effect19.Effect.void;
1328
1785
  },
1329
1786
  onError: (handler) => {
1330
1787
  if (getCurrentPhase() === "run") {
1331
1788
  return emitSetupOnlyViolation("$.lifecycle.onError");
1332
1789
  }
1333
1790
  runtimeInternals.lifecycle.registerOnError(handler);
1334
- return import_effect16.Effect.void;
1791
+ return import_effect19.Effect.void;
1335
1792
  },
1336
1793
  onSuspend: (eff) => {
1337
1794
  if (getCurrentPhase() === "run") {
1338
1795
  return emitSetupOnlyViolation("$.lifecycle.onSuspend");
1339
1796
  }
1340
- runtimeInternals.lifecycle.registerPlatformSuspend(import_effect16.Effect.asVoid(eff));
1341
- return import_effect16.Effect.void;
1797
+ runtimeInternals.lifecycle.registerPlatformSuspend(import_effect19.Effect.asVoid(eff));
1798
+ return import_effect19.Effect.void;
1342
1799
  },
1343
1800
  onResume: (eff) => {
1344
1801
  if (getCurrentPhase() === "run") {
1345
1802
  return emitSetupOnlyViolation("$.lifecycle.onResume");
1346
1803
  }
1347
- runtimeInternals.lifecycle.registerPlatformResume(import_effect16.Effect.asVoid(eff));
1348
- return import_effect16.Effect.void;
1804
+ runtimeInternals.lifecycle.registerPlatformResume(import_effect19.Effect.asVoid(eff));
1805
+ return import_effect19.Effect.void;
1349
1806
  },
1350
1807
  onReset: (eff) => {
1351
1808
  if (getCurrentPhase() === "run") {
1352
1809
  return emitSetupOnlyViolation("$.lifecycle.onReset");
1353
1810
  }
1354
- runtimeInternals.lifecycle.registerPlatformReset(import_effect16.Effect.asVoid(eff));
1355
- return import_effect16.Effect.void;
1811
+ runtimeInternals.lifecycle.registerPlatformReset(import_effect19.Effect.asVoid(eff));
1812
+ return import_effect19.Effect.void;
1356
1813
  }
1357
1814
  },
1358
1815
  traits: {
@@ -1386,14 +1843,14 @@ function make3(shape, runtime, options) {
1386
1843
  });
1387
1844
  },
1388
1845
  source: {
1389
- refresh: (fieldPath, options2) => import_effect16.Effect.gen(function* () {
1846
+ refresh: (fieldPath, options2) => import_effect19.Effect.gen(function* () {
1390
1847
  const handler = runtimeInternals.traits.getSourceRefreshHandler(fieldPath);
1391
1848
  if (!handler) {
1392
- return yield* import_effect16.Effect.void;
1849
+ return yield* import_effect19.Effect.void;
1393
1850
  }
1394
1851
  const force = options2?.force === true;
1395
- const runHandler = (state) => force ? import_effect16.Effect.locally(forceSourceRefresh, true)(handler(state)) : handler(state);
1396
- const inTxn = yield* import_effect16.FiberRef.get(inSyncTransactionFiber);
1852
+ const runHandler = (state) => force ? import_effect19.Effect.locally(forceSourceRefresh, true)(handler(state)) : handler(state);
1853
+ const inTxn = yield* import_effect19.FiberRef.get(inSyncTransactionFiber);
1397
1854
  if (inTxn) {
1398
1855
  const state = yield* runtime.getState;
1399
1856
  return yield* runHandler(state);
@@ -1403,7 +1860,7 @@ function make3(shape, runtime, options) {
1403
1860
  kind: "source-refresh",
1404
1861
  name: fieldPath
1405
1862
  },
1406
- () => import_effect16.Effect.gen(function* () {
1863
+ () => import_effect19.Effect.gen(function* () {
1407
1864
  const state = yield* runtime.getState;
1408
1865
  return yield* runHandler(state);
1409
1866
  })
@@ -1420,18 +1877,18 @@ function make3(shape, runtime, options) {
1420
1877
  if (isModuleLike(arg)) {
1421
1878
  const domain = arg;
1422
1879
  const tag = domain.tag;
1423
- const resolveAndBuild = resolveModuleRuntime(tag).pipe(import_effect16.Effect.map((rt) => buildModuleHandle(tag, rt)));
1880
+ const resolveAndBuild = resolveModuleRuntime(tag).pipe(import_effect19.Effect.map((rt) => buildModuleHandle(tag, rt)));
1424
1881
  const resolveWithDescriptor = resolveModuleRuntime(tag).pipe(
1425
- import_effect16.Effect.tap((rt) => emitModuleDescriptorOnce(domain, rt)),
1426
- import_effect16.Effect.map((rt) => buildModuleHandle(tag, rt))
1882
+ import_effect19.Effect.tap((rt) => emitModuleDescriptorOnce(domain, rt)),
1883
+ import_effect19.Effect.map((rt) => buildModuleHandle(tag, rt))
1427
1884
  );
1428
- const detectAndSelect = import_effect16.FiberRef.get(currentDiagnosticsLevel).pipe(
1429
- import_effect16.Effect.tap((level) => {
1885
+ const detectAndSelect = import_effect19.FiberRef.get(currentDiagnosticsLevel).pipe(
1886
+ import_effect19.Effect.tap((level) => {
1430
1887
  cachedDiagnosticsLevel = level;
1431
1888
  }),
1432
- import_effect16.Effect.flatMap((level) => level === "off" ? resolveAndBuild : resolveWithDescriptor)
1889
+ import_effect19.Effect.flatMap((level) => level === "off" ? resolveAndBuild : resolveWithDescriptor)
1433
1890
  );
1434
- return import_effect16.Effect.suspend(() => {
1891
+ return import_effect19.Effect.suspend(() => {
1435
1892
  if (cachedDiagnosticsLevel === "off") {
1436
1893
  return resolveAndBuild;
1437
1894
  }
@@ -1441,16 +1898,16 @@ function make3(shape, runtime, options) {
1441
1898
  return detectAndSelect;
1442
1899
  });
1443
1900
  }
1444
- if (import_effect16.Context.isTag(arg)) {
1901
+ if (import_effect19.Context.isTag(arg)) {
1445
1902
  const candidate = arg;
1446
1903
  if (candidate._kind === "ModuleTag") {
1447
1904
  return resolveModuleRuntime(arg).pipe(
1448
- import_effect16.Effect.map((rt) => buildModuleHandle(arg, rt))
1905
+ import_effect19.Effect.map((rt) => buildModuleHandle(arg, rt))
1449
1906
  );
1450
1907
  }
1451
1908
  return arg;
1452
1909
  }
1453
- return import_effect16.Effect.die("BoundApi.use: unsupported argument");
1910
+ return import_effect19.Effect.die("BoundApi.use: unsupported argument");
1454
1911
  }
1455
1912
  }),
1456
1913
  onAction: new Proxy(() => {
@@ -1462,33 +1919,33 @@ function make3(shape, runtime, options) {
1462
1919
  const tag = arg.tag;
1463
1920
  return createIntentBuilder(
1464
1921
  runtime.actions$.pipe(
1465
- import_effect16.Stream.filter((a) => a._tag === tag || a.type === tag),
1466
- import_effect16.Stream.map((a) => a.payload)
1922
+ import_effect19.Stream.filter((a) => a._tag === tag || a.type === tag),
1923
+ import_effect19.Stream.map((a) => a.payload)
1467
1924
  ),
1468
1925
  tag
1469
1926
  );
1470
1927
  }
1471
1928
  if (typeof arg === "function") {
1472
- return createIntentBuilder(runtime.actions$.pipe(import_effect16.Stream.filter(arg)));
1929
+ return createIntentBuilder(runtime.actions$.pipe(import_effect19.Stream.filter(arg)));
1473
1930
  }
1474
1931
  if (typeof arg === "string") {
1475
1932
  return createIntentBuilder(
1476
- runtime.actions$.pipe(import_effect16.Stream.filter((a) => a._tag === arg || a.type === arg)),
1933
+ runtime.actions$.pipe(import_effect19.Stream.filter((a) => a._tag === arg || a.type === arg)),
1477
1934
  arg
1478
1935
  );
1479
1936
  }
1480
1937
  if (typeof arg === "object" && arg !== null) {
1481
1938
  if ("_tag" in arg) {
1482
1939
  return createIntentBuilder(
1483
- runtime.actions$.pipe(import_effect16.Stream.filter((a) => a._tag === arg._tag)),
1940
+ runtime.actions$.pipe(import_effect19.Stream.filter((a) => a._tag === arg._tag)),
1484
1941
  String(arg._tag)
1485
1942
  );
1486
1943
  }
1487
- if (import_effect16.Schema.isSchema(arg)) {
1944
+ if (import_effect19.Schema.isSchema(arg)) {
1488
1945
  return createIntentBuilder(
1489
1946
  runtime.actions$.pipe(
1490
- import_effect16.Stream.filter((a) => {
1491
- const result = import_effect16.Schema.decodeUnknownSync(arg)(a);
1947
+ import_effect19.Stream.filter((a) => {
1948
+ const result = import_effect19.Schema.decodeUnknownSync(arg)(a);
1492
1949
  return !!result;
1493
1950
  })
1494
1951
  )
@@ -1501,7 +1958,7 @@ function make3(shape, runtime, options) {
1501
1958
  guardRunOnly("use_in_setup", "$.onAction");
1502
1959
  if (typeof prop === "string") {
1503
1960
  return createIntentBuilder(
1504
- runtime.actions$.pipe(import_effect16.Stream.filter((a) => a._tag === prop || a.type === prop)),
1961
+ runtime.actions$.pipe(import_effect19.Stream.filter((a) => a._tag === prop || a.type === prop)),
1505
1962
  prop
1506
1963
  );
1507
1964
  }