@logixjs/core 0.0.1 → 1.0.0

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 (398) hide show
  1. package/LICENSE +201 -0
  2. package/dist/{Action-mqVvtEHt.d.ts → Action-DYl88bwj.d.ts} +1 -1
  3. package/dist/{Action-BkRHy2vg.d.cts → Action-DkxsI_DK.d.cts} +1 -1
  4. package/dist/Action.cjs.map +1 -1
  5. package/dist/Action.d.cts +1 -1
  6. package/dist/Action.d.ts +1 -1
  7. package/dist/Action.js +2 -2
  8. package/dist/{Actions-AsQ07yTP.d.cts → Actions-Dicm7jdc.d.cts} +2 -2
  9. package/dist/{Actions-AsQ07yTP.d.ts → Actions-Dicm7jdc.d.ts} +2 -2
  10. package/dist/Actions.cjs.map +1 -1
  11. package/dist/Actions.d.cts +1 -1
  12. package/dist/Actions.d.ts +1 -1
  13. package/dist/Actions.js +1 -1
  14. package/dist/{Bound-BN1DQ_lM.d.ts → Bound-1OJLzVIS.d.ts} +2 -2
  15. package/dist/{Bound-BPIfH9SS.d.cts → Bound-BMLrtQ1V.d.cts} +2 -2
  16. package/dist/Bound.cjs +1737 -399
  17. package/dist/Bound.cjs.map +1 -1
  18. package/dist/Bound.d.cts +5 -5
  19. package/dist/Bound.d.ts +5 -5
  20. package/dist/Bound.js +19 -17
  21. package/dist/{Debug-B5q5Bkzx.d.ts → Debug-DKrWP5H1.d.ts} +40 -22
  22. package/dist/{Debug-Bq8Sqjcr.d.cts → Debug-hIT44XsY.d.cts} +40 -22
  23. package/dist/Debug.cjs +1348 -318
  24. package/dist/Debug.cjs.map +1 -1
  25. package/dist/Debug.d.cts +12 -11
  26. package/dist/Debug.d.ts +12 -11
  27. package/dist/Debug.js +20 -11
  28. package/dist/EffectOp.cjs +15 -6
  29. package/dist/EffectOp.cjs.map +1 -1
  30. package/dist/EffectOp.js +3 -3
  31. package/dist/Env.cjs +772 -6
  32. package/dist/Env.cjs.map +1 -1
  33. package/dist/Env.js +5 -2
  34. package/dist/ExternalStore-DqJKKRJ4.d.ts +61 -0
  35. package/dist/ExternalStore-JC-gAgEI.d.cts +61 -0
  36. package/dist/ExternalStore.cjs +774 -0
  37. package/dist/ExternalStore.cjs.map +1 -0
  38. package/dist/ExternalStore.d.cts +8 -0
  39. package/dist/ExternalStore.d.ts +8 -0
  40. package/dist/ExternalStore.js +19 -0
  41. package/dist/ExternalStore.js.map +1 -0
  42. package/dist/{Flow-BhpjE22E.d.ts → Flow-CZmXRDqp.d.cts} +13 -4
  43. package/dist/{Flow-1fZT8MpX.d.cts → Flow-DIVDxz7R.d.ts} +13 -4
  44. package/dist/Flow.cjs +765 -148
  45. package/dist/Flow.cjs.map +1 -1
  46. package/dist/Flow.d.cts +6 -6
  47. package/dist/Flow.d.ts +6 -6
  48. package/dist/Flow.js +9 -8
  49. package/dist/{Handle-D_cLW1Z3.d.ts → Handle-Bo6cAFut.d.ts} +1 -1
  50. package/dist/{Handle-D8D1zPb_.d.cts → Handle-CfDvSqN7.d.cts} +1 -1
  51. package/dist/Handle.d.cts +5 -5
  52. package/dist/Handle.d.ts +5 -5
  53. package/dist/{Kernel-8kC-jOda.d.cts → Kernel-CuXBF9S_.d.cts} +16 -7
  54. package/dist/{Kernel-CnGE1Fyk.d.ts → Kernel-D9guNwRL.d.ts} +16 -7
  55. package/dist/Kernel.cjs +814 -26
  56. package/dist/Kernel.cjs.map +1 -1
  57. package/dist/Kernel.d.cts +13 -12
  58. package/dist/Kernel.d.ts +13 -12
  59. package/dist/Kernel.js +7 -4
  60. package/dist/{Link-Db7975nU.d.ts → Link-CUM0yUCH.d.ts} +10 -3
  61. package/dist/{Link-fX8x1eCK.d.cts → Link-NAfR6uGD.d.cts} +10 -3
  62. package/dist/Link.cjs +1294 -121
  63. package/dist/Link.cjs.map +1 -1
  64. package/dist/Link.d.cts +5 -5
  65. package/dist/Link.d.ts +5 -5
  66. package/dist/Link.js +37 -29
  67. package/dist/{Logic-DRh4sDZj.d.cts → Logic-09VQpIj3.d.cts} +7 -4
  68. package/dist/{Logic-BRjEMr-W.d.ts → Logic-DKg7ghGy.d.ts} +7 -4
  69. package/dist/Logic.cjs +2 -1
  70. package/dist/Logic.cjs.map +1 -1
  71. package/dist/Logic.d.cts +5 -5
  72. package/dist/Logic.d.ts +5 -5
  73. package/dist/Logic.js +1 -1
  74. package/dist/{MatchBuilder-CJk5oCkR.d.cts → MatchBuilder-CsW5jgrL.d.ts} +1 -1
  75. package/dist/{MatchBuilder-0QOc-nlU.d.ts → MatchBuilder-Dksk07F4.d.cts} +1 -1
  76. package/dist/MatchBuilder.cjs +2 -2
  77. package/dist/MatchBuilder.cjs.map +1 -1
  78. package/dist/MatchBuilder.d.cts +6 -6
  79. package/dist/MatchBuilder.d.ts +6 -6
  80. package/dist/MatchBuilder.js +2 -2
  81. package/dist/Middleware-D8tUDLv_.d.cts +100 -0
  82. package/dist/Middleware-DS7CbTTN.d.ts +100 -0
  83. package/dist/Middleware.cjs +678 -58
  84. package/dist/Middleware.cjs.map +1 -1
  85. package/dist/Middleware.d.cts +2 -86
  86. package/dist/Middleware.d.ts +2 -86
  87. package/dist/Middleware.js +15 -12
  88. package/dist/{Module-DnzluX2J.d.ts → Module-B_Cntyms.d.ts} +54 -25
  89. package/dist/{Module-B_0xRDMR.d.cts → Module-CmNOVXzf.d.cts} +54 -25
  90. package/dist/Module.cjs +9331 -3317
  91. package/dist/Module.cjs.map +1 -1
  92. package/dist/Module.d.cts +7 -6
  93. package/dist/Module.d.ts +7 -6
  94. package/dist/Module.js +39 -31
  95. package/dist/ModuleTag-CGho_InD.d.ts +113 -0
  96. package/dist/ModuleTag-CITb8L_G.d.cts +113 -0
  97. package/dist/ModuleTag.cjs +7248 -2847
  98. package/dist/ModuleTag.cjs.map +1 -1
  99. package/dist/ModuleTag.d.cts +6 -6
  100. package/dist/ModuleTag.d.ts +6 -6
  101. package/dist/ModuleTag.js +35 -29
  102. package/dist/Observability-Bdhnx2Dv.d.ts +385 -0
  103. package/dist/Observability-DXGAFBIT.d.cts +385 -0
  104. package/dist/Observability.cjs +5093 -1556
  105. package/dist/Observability.cjs.map +1 -1
  106. package/dist/Observability.d.cts +6 -7
  107. package/dist/Observability.d.ts +6 -7
  108. package/dist/Observability.js +28 -23
  109. package/dist/{Platform-CHX8o-U4.d.ts → Platform-B4s8tg6C.d.cts} +4 -5
  110. package/dist/{Platform-C49Pv956.d.cts → Platform-BV_0MW7g.d.cts} +5 -2
  111. package/dist/{Platform-C49Pv956.d.ts → Platform-BV_0MW7g.d.ts} +5 -2
  112. package/dist/{Platform-CVlv0xLQ.d.cts → Platform-W0Mefy_e.d.ts} +4 -5
  113. package/dist/Platform.cjs +2 -1
  114. package/dist/Platform.cjs.map +1 -1
  115. package/dist/Platform.d.cts +2 -3
  116. package/dist/Platform.d.ts +2 -3
  117. package/dist/Platform.js +2 -2
  118. package/dist/{Process-CM9xbMdP.d.ts → Process-CO8G7HO9.d.cts} +30 -5
  119. package/dist/{Process-mL8fHDSB.d.cts → Process-Cyf6VNDR.d.ts} +30 -5
  120. package/dist/Process.cjs +1288 -120
  121. package/dist/Process.cjs.map +1 -1
  122. package/dist/Process.d.cts +6 -6
  123. package/dist/Process.d.ts +6 -6
  124. package/dist/Process.js +34 -26
  125. package/dist/ReadQuery-C_or5nLC.d.ts +128 -0
  126. package/dist/ReadQuery-DXLzCE0E.d.cts +614 -0
  127. package/dist/ReadQuery-DXLzCE0E.d.ts +614 -0
  128. package/dist/ReadQuery-Yve1lmUo.d.cts +128 -0
  129. package/dist/ReadQuery.cjs +290 -5
  130. package/dist/ReadQuery.cjs.map +1 -1
  131. package/dist/ReadQuery.d.cts +3 -2
  132. package/dist/ReadQuery.d.ts +3 -2
  133. package/dist/ReadQuery.js +23 -5
  134. package/dist/{Reflection-CQnKwPXj.d.ts → Reflection-B2Xi1e4Q.d.ts} +89 -7
  135. package/dist/{Reflection-Kabo1mlU.d.cts → Reflection-DNB4V4_e.d.cts} +89 -7
  136. package/dist/Reflection.cjs +3227 -1617
  137. package/dist/Reflection.cjs.map +1 -1
  138. package/dist/Reflection.d.cts +17 -15
  139. package/dist/Reflection.d.ts +17 -15
  140. package/dist/Reflection.js +33 -25
  141. package/dist/{Resource-Dy1xD_DG.d.cts → Resource-pKvQQ4x5.d.cts} +3 -3
  142. package/dist/{Resource-Dy1xD_DG.d.ts → Resource-pKvQQ4x5.d.ts} +3 -3
  143. package/dist/Resource.cjs +781 -15
  144. package/dist/Resource.cjs.map +1 -1
  145. package/dist/Resource.d.cts +1 -1
  146. package/dist/Resource.d.ts +1 -1
  147. package/dist/Resource.js +6 -3
  148. package/dist/{Root-7ADUMk4t.d.cts → Root-CCVuFHB6.d.cts} +3 -3
  149. package/dist/{Root-7ADUMk4t.d.ts → Root-CCVuFHB6.d.ts} +3 -3
  150. package/dist/Root.cjs +786 -20
  151. package/dist/Root.cjs.map +1 -1
  152. package/dist/Root.d.cts +2 -2
  153. package/dist/Root.d.ts +2 -2
  154. package/dist/Root.js +7 -3
  155. package/dist/{Runtime-CtyzZG4i.d.ts → Runtime-CRmvwK4I.d.ts} +70 -14
  156. package/dist/{Runtime-B-aL-f29.d.cts → Runtime-C_wJM9mN.d.cts} +70 -14
  157. package/dist/Runtime.cjs +4942 -1601
  158. package/dist/Runtime.cjs.map +1 -1
  159. package/dist/Runtime.d.cts +17 -15
  160. package/dist/Runtime.d.ts +17 -15
  161. package/dist/Runtime.js +44 -32
  162. package/dist/{ScopeRegistry-D1owDNSm.d.cts → ScopeRegistry-BhYzqWri.d.cts} +6 -6
  163. package/dist/{ScopeRegistry-D1owDNSm.d.ts → ScopeRegistry-BhYzqWri.d.ts} +6 -6
  164. package/dist/ScopeRegistry.cjs +776 -10
  165. package/dist/ScopeRegistry.cjs.map +1 -1
  166. package/dist/ScopeRegistry.d.cts +1 -1
  167. package/dist/ScopeRegistry.d.ts +1 -1
  168. package/dist/ScopeRegistry.js +6 -3
  169. package/dist/{State-CU50R26M.d.cts → State-rNFsFPTl.d.cts} +2 -2
  170. package/dist/{State-CU50R26M.d.ts → State-rNFsFPTl.d.ts} +2 -2
  171. package/dist/State.cjs.map +1 -1
  172. package/dist/State.d.cts +1 -1
  173. package/dist/State.d.ts +1 -1
  174. package/dist/State.js +1 -1
  175. package/dist/{StateTrait-BGsZghTz.d.ts → StateTrait-CijdwNb6.d.ts} +25 -8
  176. package/dist/{StateTrait-OWhbj12c.d.cts → StateTrait-Dltto6PU.d.cts} +25 -8
  177. package/dist/StateTrait.cjs +1890 -528
  178. package/dist/StateTrait.cjs.map +1 -1
  179. package/dist/StateTrait.d.cts +9 -7
  180. package/dist/StateTrait.d.ts +9 -7
  181. package/dist/StateTrait.js +18 -14
  182. package/dist/{TraitLifecycle-CwV5WPFX.d.cts → TraitLifecycle-BKzDqzLu.d.cts} +2 -2
  183. package/dist/{TraitLifecycle-LdIWmKlg.d.ts → TraitLifecycle-Cvo94uDB.d.ts} +2 -2
  184. package/dist/TraitLifecycle.cjs +630 -67
  185. package/dist/TraitLifecycle.cjs.map +1 -1
  186. package/dist/TraitLifecycle.d.cts +6 -6
  187. package/dist/TraitLifecycle.d.ts +6 -6
  188. package/dist/TraitLifecycle.js +8 -7
  189. package/dist/Workflow-C_OWr4dV.d.ts +415 -0
  190. package/dist/Workflow-DmydkHO8.d.cts +415 -0
  191. package/dist/Workflow.cjs +3150 -0
  192. package/dist/Workflow.cjs.map +1 -0
  193. package/dist/Workflow.d.cts +7 -0
  194. package/dist/Workflow.d.ts +7 -0
  195. package/dist/Workflow.js +58 -0
  196. package/dist/Workflow.js.map +1 -0
  197. package/dist/{action-DiMDD_0v.d.cts → action-BQxjPFEw.d.cts} +5 -5
  198. package/dist/{action-DiMDD_0v.d.ts → action-BQxjPFEw.d.ts} +5 -5
  199. package/dist/chunk-2XRLXDWR.js +276 -0
  200. package/dist/chunk-2XRLXDWR.js.map +1 -0
  201. package/dist/chunk-3L6QGFMM.js +701 -0
  202. package/dist/chunk-3L6QGFMM.js.map +1 -0
  203. package/dist/{chunk-GMPEOUP2.js → chunk-4MZ7BT3R.js} +2 -2
  204. package/dist/chunk-4MZ7BT3R.js.map +1 -0
  205. package/dist/{chunk-3IYZ5IGG.js → chunk-5WKUGEBY.js} +2 -2
  206. package/dist/{chunk-3RMKLXHX.js → chunk-63ZQ5RIN.js} +2 -2
  207. package/dist/{chunk-M3WTHJHJ.js → chunk-67DIEA53.js} +385 -148
  208. package/dist/chunk-67DIEA53.js.map +1 -0
  209. package/dist/{chunk-YS3AZQ2G.js → chunk-6HFAW2MH.js} +1 -1
  210. package/dist/chunk-6HFAW2MH.js.map +1 -0
  211. package/dist/{chunk-EY4NZKDR.js → chunk-6Y2TKCNY.js} +2 -2
  212. package/dist/{chunk-76WT3HOR.js → chunk-6YZOXFPQ.js} +25 -24
  213. package/dist/chunk-6YZOXFPQ.js.map +1 -0
  214. package/dist/{chunk-G5ZBFPNU.js → chunk-A2RQOJC7.js} +2 -2
  215. package/dist/{chunk-AUIR5O6W.js → chunk-AFSB6NKM.js} +13 -19
  216. package/dist/chunk-AFSB6NKM.js.map +1 -0
  217. package/dist/{chunk-JCXGZRMU.js → chunk-AO4JEOKD.js} +22 -23
  218. package/dist/chunk-AO4JEOKD.js.map +1 -0
  219. package/dist/{chunk-TAAPQVZN.js → chunk-AYELIQXR.js} +2 -2
  220. package/dist/{chunk-QMM6O4CD.js → chunk-BLHZW7DG.js} +15 -3
  221. package/dist/{chunk-QMM6O4CD.js.map → chunk-BLHZW7DG.js.map} +1 -1
  222. package/dist/{chunk-TQOBJYDP.js → chunk-CD4N74YC.js} +1 -1
  223. package/dist/chunk-CD4N74YC.js.map +1 -0
  224. package/dist/{chunk-ANLBCBDC.js → chunk-CGE2HBTH.js} +11 -11
  225. package/dist/chunk-CGE2HBTH.js.map +1 -0
  226. package/dist/{chunk-OFADUJWJ.js → chunk-CYYSQMLO.js} +5 -5
  227. package/dist/chunk-CYYSQMLO.js.map +1 -0
  228. package/dist/{chunk-66ALHVEX.js → chunk-EB46EYI7.js} +3 -3
  229. package/dist/{chunk-NZJKFF45.js → chunk-EKCDHWRK.js} +4 -4
  230. package/dist/chunk-EKCDHWRK.js.map +1 -0
  231. package/dist/{chunk-BABLDP24.js → chunk-EPQFNJU3.js} +152 -7
  232. package/dist/chunk-EPQFNJU3.js.map +1 -0
  233. package/dist/{chunk-OGWBVHB3.js → chunk-ESR6HGOY.js} +73 -14
  234. package/dist/chunk-ESR6HGOY.js.map +1 -0
  235. package/dist/{chunk-NBD3KUOZ.js → chunk-F6RP62H3.js} +150 -98
  236. package/dist/chunk-F6RP62H3.js.map +1 -0
  237. package/dist/chunk-FBYW3QDI.js +252 -0
  238. package/dist/chunk-FBYW3QDI.js.map +1 -0
  239. package/dist/{chunk-IPF7E66P.js → chunk-FYAODKVP.js} +2 -2
  240. package/dist/chunk-GNEN7NKO.js +908 -0
  241. package/dist/chunk-GNEN7NKO.js.map +1 -0
  242. package/dist/chunk-GWSM4KLB.js +763 -0
  243. package/dist/chunk-GWSM4KLB.js.map +1 -0
  244. package/dist/{chunk-4SO6JMZL.js → chunk-HDMXCUZL.js} +1 -1
  245. package/dist/chunk-HDMXCUZL.js.map +1 -0
  246. package/dist/{chunk-ZFY7U2FR.js → chunk-HJM5Y5NU.js} +43 -3
  247. package/dist/chunk-HJM5Y5NU.js.map +1 -0
  248. package/dist/{chunk-ZGDVUPTM.js → chunk-IOZ3VKPK.js} +129 -68
  249. package/dist/chunk-IOZ3VKPK.js.map +1 -0
  250. package/dist/{chunk-PYOE4VSI.js → chunk-IVXSVHO4.js} +303 -247
  251. package/dist/chunk-IVXSVHO4.js.map +1 -0
  252. package/dist/chunk-J3CWXIPV.js +242 -0
  253. package/dist/chunk-J3CWXIPV.js.map +1 -0
  254. package/dist/chunk-K6JQW266.js +42 -0
  255. package/dist/chunk-K6JQW266.js.map +1 -0
  256. package/dist/chunk-KMZYQF6Q.js +202 -0
  257. package/dist/chunk-KMZYQF6Q.js.map +1 -0
  258. package/dist/{chunk-JWOYLO27.js → chunk-LPPZDFTD.js} +22 -12
  259. package/dist/chunk-LPPZDFTD.js.map +1 -0
  260. package/dist/{chunk-PAYXCY6A.js → chunk-MYB2B5WX.js} +997 -576
  261. package/dist/chunk-MYB2B5WX.js.map +1 -0
  262. package/dist/chunk-MYKNINNN.js +228 -0
  263. package/dist/chunk-MYKNINNN.js.map +1 -0
  264. package/dist/chunk-NSQIRMVF.js +27 -0
  265. package/dist/{chunk-QCHIQWAJ.js.map → chunk-NSQIRMVF.js.map} +1 -1
  266. package/dist/chunk-NUDBM4MM.js +30 -0
  267. package/dist/chunk-NUDBM4MM.js.map +1 -0
  268. package/dist/chunk-NZMWWDAY.js +23 -0
  269. package/dist/chunk-NZMWWDAY.js.map +1 -0
  270. package/dist/{chunk-RNFE3ML2.js → chunk-OCUV2Y25.js} +4 -3
  271. package/dist/chunk-OCUV2Y25.js.map +1 -0
  272. package/dist/chunk-P4ZJOQA7.js +271 -0
  273. package/dist/chunk-P4ZJOQA7.js.map +1 -0
  274. package/dist/chunk-P6C5EZ3D.js +342 -0
  275. package/dist/chunk-P6C5EZ3D.js.map +1 -0
  276. package/dist/{chunk-CW6T36TN.js → chunk-PBD7BJUN.js} +62 -4
  277. package/dist/chunk-PBD7BJUN.js.map +1 -0
  278. package/dist/chunk-PBIUCQY3.js +696 -0
  279. package/dist/chunk-PBIUCQY3.js.map +1 -0
  280. package/dist/chunk-PD6YECQH.js +845 -0
  281. package/dist/chunk-PD6YECQH.js.map +1 -0
  282. package/dist/{chunk-M7IYCTJV.js → chunk-R4LFQGP3.js} +2 -2
  283. package/dist/chunk-RHJIGDUE.js +21 -0
  284. package/dist/chunk-RHJIGDUE.js.map +1 -0
  285. package/dist/{chunk-KP7MUZNX.js → chunk-RLXO27MW.js} +30 -8
  286. package/dist/chunk-RLXO27MW.js.map +1 -0
  287. package/dist/{chunk-DFNM3WX2.js → chunk-S44BEV4B.js} +168 -45
  288. package/dist/chunk-S44BEV4B.js.map +1 -0
  289. package/dist/chunk-S4S5N4BJ.js +1461 -0
  290. package/dist/chunk-S4S5N4BJ.js.map +1 -0
  291. package/dist/{chunk-BZ2SHDN2.js → chunk-SGTRAXXX.js} +3 -3
  292. package/dist/chunk-SGTRAXXX.js.map +1 -0
  293. package/dist/{chunk-M2RGJPXX.js → chunk-SJAE5PB5.js} +3 -3
  294. package/dist/{chunk-JGIWG6SR.js → chunk-SNPNHU3H.js} +3937 -1776
  295. package/dist/chunk-SNPNHU3H.js.map +1 -0
  296. package/dist/{chunk-IHVBV5C2.js → chunk-SOOBFXRR.js} +94 -71
  297. package/dist/chunk-SOOBFXRR.js.map +1 -0
  298. package/dist/{chunk-ZDTRWK5F.js → chunk-TAHFWKS6.js} +2 -2
  299. package/dist/chunk-UEFFTVPY.js +9 -0
  300. package/dist/chunk-UEFFTVPY.js.map +1 -0
  301. package/dist/{chunk-24VULZ7A.js → chunk-UR5BXLBP.js} +3 -3
  302. package/dist/chunk-UR5BXLBP.js.map +1 -0
  303. package/dist/{chunk-DMBALCE2.js → chunk-V2SBGVDO.js} +471 -186
  304. package/dist/chunk-V2SBGVDO.js.map +1 -0
  305. package/dist/chunk-VJLWD47W.js +23 -0
  306. package/dist/chunk-VJLWD47W.js.map +1 -0
  307. package/dist/{chunk-4CQAV7YB.js → chunk-W647DX5Z.js} +2 -2
  308. package/dist/{chunk-THATMZXD.js → chunk-WFIIU3YZ.js} +2 -2
  309. package/dist/{chunk-THATMZXD.js.map → chunk-WFIIU3YZ.js.map} +1 -1
  310. package/dist/chunk-YZDJMAKL.js +82 -0
  311. package/dist/chunk-YZDJMAKL.js.map +1 -0
  312. package/dist/{chunk-3TMODYZV.js → chunk-Z5XH6VHY.js} +5 -5
  313. package/dist/chunk-Z5XH6VHY.js.map +1 -0
  314. package/dist/{chunk-BE3HW4FY.js → chunk-ZBBMZMA6.js} +377 -170
  315. package/dist/chunk-ZBBMZMA6.js.map +1 -0
  316. package/dist/index.cjs +21224 -11714
  317. package/dist/index.cjs.map +1 -1
  318. package/dist/index.d.cts +195 -49
  319. package/dist/index.d.ts +195 -49
  320. package/dist/index.js +150 -74
  321. package/dist/index.js.map +1 -1
  322. package/dist/{ir-BMP7yxJJ.d.cts → ir-BSosEwc8.d.cts} +1 -1
  323. package/dist/{ir-DUOz6H-5.d.ts → ir-D-uqwL_4.d.ts} +1 -1
  324. package/dist/{module-B8CBqIZ_.d.cts → module-Ds4tarcI.d.cts} +230 -140
  325. package/dist/{module-k7m3txak.d.ts → module-Zd1Gn-Nj.d.ts} +230 -140
  326. package/package.json +20 -4
  327. package/dist/ModuleTag-C8FHY_sY.d.ts +0 -93
  328. package/dist/ModuleTag-EGbgBMpZ.d.cts +0 -93
  329. package/dist/Observability-COqEvp2C.d.cts +0 -713
  330. package/dist/Observability-cY4kLn0S.d.ts +0 -713
  331. package/dist/ReadQuery-BlMwhe-F.d.ts +0 -30
  332. package/dist/ReadQuery-CL5XlXts.d.cts +0 -30
  333. package/dist/ReadQuery-SinbStGF.d.cts +0 -38
  334. package/dist/ReadQuery-SinbStGF.d.ts +0 -38
  335. package/dist/chunk-24VULZ7A.js.map +0 -1
  336. package/dist/chunk-3QMIVH35.js +0 -43
  337. package/dist/chunk-3QMIVH35.js.map +0 -1
  338. package/dist/chunk-3TMODYZV.js.map +0 -1
  339. package/dist/chunk-4SO6JMZL.js.map +0 -1
  340. package/dist/chunk-76WT3HOR.js.map +0 -1
  341. package/dist/chunk-ANLBCBDC.js.map +0 -1
  342. package/dist/chunk-AUIR5O6W.js.map +0 -1
  343. package/dist/chunk-BABLDP24.js.map +0 -1
  344. package/dist/chunk-BE3HW4FY.js.map +0 -1
  345. package/dist/chunk-BZ2SHDN2.js.map +0 -1
  346. package/dist/chunk-CW6T36TN.js.map +0 -1
  347. package/dist/chunk-DFNM3WX2.js.map +0 -1
  348. package/dist/chunk-DMBALCE2.js.map +0 -1
  349. package/dist/chunk-EGK3KN7B.js +0 -406
  350. package/dist/chunk-EGK3KN7B.js.map +0 -1
  351. package/dist/chunk-GMPEOUP2.js.map +0 -1
  352. package/dist/chunk-IHVBV5C2.js.map +0 -1
  353. package/dist/chunk-JCXGZRMU.js.map +0 -1
  354. package/dist/chunk-JGIWG6SR.js.map +0 -1
  355. package/dist/chunk-JWOYLO27.js.map +0 -1
  356. package/dist/chunk-KIXAU3GM.js +0 -137
  357. package/dist/chunk-KIXAU3GM.js.map +0 -1
  358. package/dist/chunk-KL5ACTCT.js +0 -8
  359. package/dist/chunk-KL5ACTCT.js.map +0 -1
  360. package/dist/chunk-KP7MUZNX.js.map +0 -1
  361. package/dist/chunk-M3BFQ7HK.js +0 -13
  362. package/dist/chunk-M3BFQ7HK.js.map +0 -1
  363. package/dist/chunk-M3WTHJHJ.js.map +0 -1
  364. package/dist/chunk-NBD3KUOZ.js.map +0 -1
  365. package/dist/chunk-NQZ2OSGR.js +0 -151
  366. package/dist/chunk-NQZ2OSGR.js.map +0 -1
  367. package/dist/chunk-NZJKFF45.js.map +0 -1
  368. package/dist/chunk-OFADUJWJ.js.map +0 -1
  369. package/dist/chunk-OGWBVHB3.js.map +0 -1
  370. package/dist/chunk-PAYXCY6A.js.map +0 -1
  371. package/dist/chunk-PYOE4VSI.js.map +0 -1
  372. package/dist/chunk-QCHIQWAJ.js +0 -21
  373. package/dist/chunk-RNFE3ML2.js.map +0 -1
  374. package/dist/chunk-TKZ7MEIA.js +0 -27
  375. package/dist/chunk-TKZ7MEIA.js.map +0 -1
  376. package/dist/chunk-TQOBJYDP.js.map +0 -1
  377. package/dist/chunk-VZB726PE.js +0 -93
  378. package/dist/chunk-VZB726PE.js.map +0 -1
  379. package/dist/chunk-W3TEWHLO.js +0 -568
  380. package/dist/chunk-W3TEWHLO.js.map +0 -1
  381. package/dist/chunk-YS3AZQ2G.js.map +0 -1
  382. package/dist/chunk-ZFLHVFUC.js +0 -192
  383. package/dist/chunk-ZFLHVFUC.js.map +0 -1
  384. package/dist/chunk-ZFY7U2FR.js.map +0 -1
  385. package/dist/chunk-ZGDVUPTM.js.map +0 -1
  386. package/dist/protocol-g_1897M2.d.cts +0 -127
  387. package/dist/protocol-g_1897M2.d.ts +0 -127
  388. /package/dist/{chunk-3IYZ5IGG.js.map → chunk-5WKUGEBY.js.map} +0 -0
  389. /package/dist/{chunk-3RMKLXHX.js.map → chunk-63ZQ5RIN.js.map} +0 -0
  390. /package/dist/{chunk-EY4NZKDR.js.map → chunk-6Y2TKCNY.js.map} +0 -0
  391. /package/dist/{chunk-G5ZBFPNU.js.map → chunk-A2RQOJC7.js.map} +0 -0
  392. /package/dist/{chunk-TAAPQVZN.js.map → chunk-AYELIQXR.js.map} +0 -0
  393. /package/dist/{chunk-66ALHVEX.js.map → chunk-EB46EYI7.js.map} +0 -0
  394. /package/dist/{chunk-IPF7E66P.js.map → chunk-FYAODKVP.js.map} +0 -0
  395. /package/dist/{chunk-M7IYCTJV.js.map → chunk-R4LFQGP3.js.map} +0 -0
  396. /package/dist/{chunk-M2RGJPXX.js.map → chunk-SJAE5PB5.js.map} +0 -0
  397. /package/dist/{chunk-ZDTRWK5F.js.map → chunk-TAHFWKS6.js.map} +0 -0
  398. /package/dist/{chunk-4CQAV7YB.js.map → chunk-W647DX5Z.js.map} +0 -0
@@ -1,16 +1,9 @@
1
1
  import * as effect from 'effect';
2
- import { Schema, Cause, Effect, Stream, Context, SubscriptionRef, Layer } from 'effect';
2
+ import { Schema, Cause, Effect, Stream, ServiceMap, Layer } from 'effect';
3
+ import { v as SerializableErrorSummary, J as JsonValue, K as ReadQuery, z as ReadQueryInput } from './ReadQuery-DXLzCE0E.js';
3
4
  import { Draft as Draft$1 } from 'mutative';
4
- import { S as Service } from './Platform-C49Pv956.js';
5
- import { c as AnyActionToken, a as ActionToken } from './action-DiMDD_0v.js';
6
- import { d as ReadQuery, f as ReadQueryInput } from './ReadQuery-SinbStGF.js';
7
-
8
- interface SerializableErrorSummary {
9
- readonly message: string;
10
- readonly name?: string;
11
- readonly code?: string;
12
- readonly hint?: string;
13
- }
5
+ import { S as Service } from './Platform-BV_0MW7g.js';
6
+ import { c as AnyActionToken, a as ActionToken } from './action-BQxjPFEw.js';
14
7
 
15
8
  type Phase = 'init' | 'run' | 'destroy' | 'platform';
16
9
  type Hook = 'initRequired' | 'start' | 'destroy' | 'suspend' | 'resume' | 'reset' | 'unknown';
@@ -58,7 +51,7 @@ interface LifecycleStatus {
58
51
  type FieldPath = ReadonlyArray<string>;
59
52
  type FieldPathId = number;
60
53
  type DirtyAllReason = 'unknownWrite' | 'customMutation' | 'nonTrackablePatch' | 'fallbackPolicy';
61
- type PatchReason = 'reducer' | 'trait-computed' | 'trait-link' | 'source-refresh' | 'devtools' | 'perf' | 'unknown';
54
+ type PatchReason = 'reducer' | 'trait-computed' | 'trait-link' | 'trait-external-store' | 'source-refresh' | 'devtools' | 'perf' | 'unknown';
62
55
  interface DirtySet {
63
56
  readonly dirtyAll: boolean;
64
57
  /**
@@ -150,10 +143,6 @@ type TraitMetaConflict = Readonly<{
150
143
  readonly origin: string;
151
144
  readonly meta: TraitMeta;
152
145
  }>;
153
- type JsonPrimitive = string | number | boolean | null;
154
- type JsonValue = JsonPrimitive | ReadonlyArray<JsonValue> | {
155
- readonly [key: string]: JsonValue;
156
- };
157
146
 
158
147
  type ConvergeStepId = number;
159
148
  /**
@@ -176,6 +165,12 @@ interface ConvergeStaticIrRegistry {
176
165
  * - Precomputed at build time to avoid repeatedly stringifying large tables at runtime.
177
166
  */
178
167
  readonly fieldPathsKey: string;
168
+ /**
169
+ * staticIrDigest:
170
+ * - Stable digest for this converge IR shape;
171
+ * - Computed on cold build/register paths and reused by hot runtime paths.
172
+ */
173
+ readonly staticIrDigest: string;
179
174
  readonly fieldPaths: ReadonlyArray<FieldPath>;
180
175
  readonly fieldPathIdRegistry: FieldPathIdRegistry;
181
176
  readonly configError?: {
@@ -195,17 +190,6 @@ interface ConvergeStaticIrRegistry {
195
190
  readonly topoOrder: ReadonlyArray<ConvergeStepId>;
196
191
  readonly buildDurationMs: number;
197
192
  }
198
- interface ConvergeStaticIrExport {
199
- readonly staticIrDigest: string;
200
- readonly moduleId: string;
201
- readonly instanceId: string;
202
- readonly generation: number;
203
- readonly fieldPaths: ReadonlyArray<FieldPath>;
204
- readonly stepOutFieldPathIdByStepId: ReadonlyArray<number>;
205
- readonly stepSchedulingByStepId: ReadonlyArray<TraitConvergeScheduling>;
206
- readonly topoOrder?: ReadonlyArray<number>;
207
- readonly buildDurationMs?: number;
208
- }
209
193
 
210
194
  declare class DenseIdBitSet {
211
195
  readonly size: number;
@@ -234,6 +218,13 @@ interface ConvergeExecIr {
234
218
  readonly triggerStepIdsByFieldPathId: Int32Array;
235
219
  readonly triggerStepOffsetsByFieldPathId: Int32Array;
236
220
  readonly topoOrderInt32: Int32Array;
221
+ /**
222
+ * stepId -> topo index in {@link topoOrderInt32}.
223
+ *
224
+ * Used by auto-plan computation to sort small reachable sets without scanning
225
+ * the entire topo slice every time (avoids O(totalSteps) tail cost).
226
+ */
227
+ readonly topoIndexByStepId: Int32Array;
237
228
  readonly topoOrderImmediateInt32: Int32Array;
238
229
  readonly topoOrderDeferredInt32: Int32Array;
239
230
  /**
@@ -246,10 +237,51 @@ interface ConvergeExecIr {
246
237
  readonly allOutPathsShallow: boolean;
247
238
  readonly stepDepsFieldPathIds: Int32Array;
248
239
  readonly stepDepsOffsetsByStepId: Int32Array;
240
+ /**
241
+ * Perf hints collected at runtime (per module instance, per generation).
242
+ * Mutated only in hot paths and must remain O(1).
243
+ */
244
+ readonly perf: {
245
+ /**
246
+ * EWMA of full converge execution duration (ms) under the "off-fast-path"
247
+ * (diagnostics=off, middleware stack empty).
248
+ *
249
+ * Used by auto mode to short-circuit planning when full is already cheap.
250
+ */
251
+ fullCommitEwmaOffMs?: number;
252
+ /**
253
+ * Last txnSeq (stable anchor) where we executed a full converge under off-fast-path.
254
+ * Used to periodically re-calibrate fullCommitEwmaOffMs after warmup/JIT effects.
255
+ */
256
+ fullCommitLastTxnSeqOff?: number;
257
+ /**
258
+ * Minimum observed full converge duration (ms) under off-fast-path.
259
+ * Helps auto mode quickly detect "full is already cheap" after warmup/JIT without getting stuck on cold-start outliers.
260
+ */
261
+ fullCommitMinOffMs?: number;
262
+ /**
263
+ * Number of full converge samples recorded under off-fast-path (best-effort; for tuning/debug only).
264
+ */
265
+ fullCommitSampleCountOff?: number;
266
+ /**
267
+ * "2-hit" admission control for plan computation under auto mode:
268
+ * - On cache miss, we only pay the cost to compute a plan after the same key repeats.
269
+ * - Prevents high-cardinality dirty patterns from turning auto into a negative optimization.
270
+ */
271
+ recentPlanMissHash1?: number;
272
+ recentPlanMissHash2?: number;
273
+ };
249
274
  readonly scratch: {
250
275
  readonly dirtyPrefixBitSet: DenseIdBitSet;
251
276
  readonly reachableStepBitSet: DenseIdBitSet;
252
277
  readonly dirtyPrefixQueue: Int32Array;
278
+ /**
279
+ * Scratch buffer for building canonical (sorted+deduped) dirty root ids in hot paths
280
+ * without allocating JS arrays on every txn window.
281
+ *
282
+ * Note: callers must treat it as ephemeral and must copy before storing into caches.
283
+ */
284
+ readonly dirtyRootIds: Int32Array;
253
285
  readonly planStepIds: Int32Array;
254
286
  };
255
287
  }
@@ -262,7 +294,8 @@ interface ConvergeExecIr {
262
294
  type StateTraitSpec<S> = S extends object ? {
263
295
  [Path in StateFieldPath<S> | '$root']?: StateTraitSpecValue<S, Path>;
264
296
  } : never;
265
- type StateTraitKind = 'computed' | 'source' | 'link' | 'check';
297
+ type StateTraitKind = 'computed' | 'source' | 'link' | 'externalStore' | 'check';
298
+ type TraitLane = 'urgent' | 'nonUrgent';
266
299
  /**
267
300
  * TraitConvergeScheduling:
268
301
  * - Scheduling semantics for converge/dirty-check (043): decides whether a step must converge within each transaction window.
@@ -333,6 +366,20 @@ interface LinkMeta<S> {
333
366
  */
334
367
  readonly scheduling?: TraitConvergeScheduling;
335
368
  }
369
+ interface ExternalStoreLike<T> {
370
+ readonly getSnapshot: () => T;
371
+ readonly getServerSnapshot?: () => T;
372
+ readonly subscribe: (listener: () => void) => () => void;
373
+ }
374
+ interface ExternalStoreMeta<S, P, T = unknown> {
375
+ readonly store: ExternalStoreLike<T>;
376
+ readonly select?: (snapshot: T) => StateAtPath<S, P>;
377
+ readonly equals?: (prev: StateAtPath<S, P>, next: StateAtPath<S, P>) => boolean;
378
+ readonly coalesceWindowMs?: number;
379
+ readonly priority?: TraitLane;
380
+ readonly meta?: TraitMeta;
381
+ readonly _fieldPath?: P;
382
+ }
336
383
  type CheckRule<Input = unknown, Ctx = unknown> = {
337
384
  readonly deps: ReadonlyArray<string>;
338
385
  /**
@@ -374,6 +421,10 @@ type StateTraitEntry<S = unknown, P extends string = StateFieldPath<S>> = {
374
421
  readonly fieldPath: P;
375
422
  readonly kind: 'link';
376
423
  readonly meta: LinkMeta<S>;
424
+ } | {
425
+ readonly fieldPath: P;
426
+ readonly kind: 'externalStore';
427
+ readonly meta: ExternalStoreMeta<S, P>;
377
428
  } | {
378
429
  readonly fieldPath: P;
379
430
  readonly kind: 'check';
@@ -384,6 +435,7 @@ interface StateTraitNode<Input = unknown, Ctx = unknown> {
384
435
  readonly computed?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
385
436
  readonly source?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
386
437
  readonly link?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
438
+ readonly externalStore?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
387
439
  readonly check?: Readonly<Record<string, CheckRule<Input, Ctx>>>;
388
440
  readonly meta?: TraitMeta;
389
441
  }
@@ -416,7 +468,7 @@ interface StateTraitField {
416
468
  interface StateTraitFieldTrait {
417
469
  readonly fieldId: string;
418
470
  readonly kind: StateTraitKind;
419
- readonly meta: ComputedMeta<unknown, string> | SourceMeta<unknown, string> | LinkMeta<unknown> | CheckMeta<unknown, unknown>;
471
+ readonly meta: ComputedMeta<unknown, string> | SourceMeta<unknown, string> | LinkMeta<unknown> | ExternalStoreMeta<unknown, string> | CheckMeta<unknown, unknown>;
420
472
  readonly deps: ReadonlyArray<string>;
421
473
  }
422
474
  /**
@@ -472,7 +524,7 @@ interface StateTraitGraph {
472
524
  */
473
525
  interface StateTraitPlanStep {
474
526
  readonly id: string;
475
- readonly kind: 'computed-update' | 'link-propagate' | 'source-refresh' | 'check-validate';
527
+ readonly kind: 'computed-update' | 'link-propagate' | 'source-refresh' | 'external-store-sync' | 'check-validate';
476
528
  readonly targetFieldPath?: string;
477
529
  readonly sourceFieldPaths?: ReadonlyArray<string>;
478
530
  readonly resourceId?: string;
@@ -507,7 +559,7 @@ interface StateTraitSchemaPathRef {
507
559
  * - stateSchema and spec preserve original inputs; graph/plan are internal IR.
508
560
  */
509
561
  interface StateTraitProgram<S> {
510
- readonly stateSchema: Schema.Schema<S, any>;
562
+ readonly stateSchema: Schema.Schema<S>;
511
563
  readonly spec: StateTraitSpec<S>;
512
564
  /**
513
565
  * Program.entries:
@@ -600,9 +652,10 @@ interface StateTransactionOverrides {
600
652
  /** 060: Txn Lanes provider_module overrides (by moduleId). */
601
653
  readonly txnLanesOverridesByModuleId?: Readonly<Record<string, TxnLanesPatch>>;
602
654
  }
603
- type ConcurrencyLimit = number | 'unbounded';
604
- interface ConcurrencyPolicyPatch {
605
- readonly concurrencyLimit?: ConcurrencyLimit;
655
+ type SchedulingPolicyLimit = number | 'unbounded';
656
+ type ConcurrencyLimit = SchedulingPolicyLimit;
657
+ interface SchedulingPolicySurfacePatch {
658
+ readonly concurrencyLimit?: SchedulingPolicyLimit;
606
659
  readonly losslessBackpressureCapacity?: number;
607
660
  readonly allowUnbounded?: boolean;
608
661
  readonly pressureWarningThreshold?: {
@@ -612,24 +665,32 @@ interface ConcurrencyPolicyPatch {
612
665
  readonly warningCooldownMs?: number;
613
666
  }
614
667
  /**
615
- * Runtime-level ConcurrencyPolicy:
668
+ * Runtime-level unified scheduling policy surface:
616
669
  * - Provided at the app layer by Logix.Runtime.make / AppRuntime.makeApp.
617
670
  * - ModuleRuntime merges sources via a resolver (builtin/runtime_module/provider, etc.).
618
671
  *
619
672
  * Notes:
620
673
  * - overridesByModuleId is used for runtime_module hot-switching (hotfix / gradual tuning) and is lower priority than provider overrides.
621
674
  */
622
- interface ConcurrencyPolicy extends ConcurrencyPolicyPatch {
623
- readonly overridesByModuleId?: Readonly<Record<string, ConcurrencyPolicyPatch>>;
675
+ interface SchedulingPolicySurface extends SchedulingPolicySurfacePatch {
676
+ readonly overridesByModuleId?: Readonly<Record<string, SchedulingPolicySurfacePatch>>;
624
677
  }
625
678
  /**
626
- * Provider-scoped ConcurrencyPolicyOverrides (delta overrides):
679
+ * Provider-scoped SchedulingPolicySurfaceOverrides (delta overrides):
627
680
  * - Used to inject more local overrides into a Provider subtree on top of inherited global runtime config.
628
681
  * - Override precedence: provider > runtime_module > runtime_default > builtin.
629
682
  */
630
- interface ConcurrencyPolicyOverrides extends ConcurrencyPolicyPatch {
631
- readonly overridesByModuleId?: Readonly<Record<string, ConcurrencyPolicyPatch>>;
683
+ interface SchedulingPolicySurfaceOverrides extends SchedulingPolicySurfacePatch {
684
+ readonly overridesByModuleId?: Readonly<Record<string, SchedulingPolicySurfacePatch>>;
632
685
  }
686
+ /**
687
+ * Legacy aliases:
688
+ * - Keep old names as pure aliases to support migration without behavior drift.
689
+ * - Canonical naming for new code should use SchedulingPolicySurface*.
690
+ */
691
+ type ConcurrencyPolicyPatch = SchedulingPolicySurfacePatch;
692
+ type ConcurrencyPolicy = SchedulingPolicySurface;
693
+ type ConcurrencyPolicyOverrides = SchedulingPolicySurfaceOverrides;
633
694
 
634
695
  type TraitId = string;
635
696
  type TraitOriginType = 'module' | 'logicUnit';
@@ -671,13 +732,15 @@ interface ModuleTraitsSnapshot {
671
732
  readonly provenanceIndex: Record<TraitId, TraitProvenance>;
672
733
  }
673
734
 
735
+ type ModeRunnerMode = 'task' | 'parallel' | 'latest' | 'exhaust';
736
+
674
737
  interface TaskRunnerOrigins {
675
738
  readonly pending?: StateTxnOrigin;
676
739
  readonly success?: StateTxnOrigin;
677
740
  readonly failure?: StateTxnOrigin;
678
741
  }
679
- type TaskHandler<Payload, Sh extends AnyModuleShape, R> = Of<Sh, R, void, never> | ((payload: Payload) => Of<Sh, R, void, never>);
680
- type TaskEffect<Payload, Sh extends AnyModuleShape, R, A, E> = Of<Sh, R, A, E> | ((payload: Payload) => Of<Sh, R, A, E>);
742
+ type TaskHandler<Payload, Sh extends AnyModuleShape, R> = LogicEffect<Sh, R, void, never> | ((payload: Payload) => LogicEffect<Sh, R, void, never>);
743
+ type TaskEffect<Payload, Sh extends AnyModuleShape, R, A, E> = LogicEffect<Sh, R, A, E> | ((payload: Payload) => LogicEffect<Sh, R, A, E>);
681
744
  interface TaskRunnerConfig<Payload, Sh extends AnyModuleShape, R, A = void, E = never> {
682
745
  /**
683
746
  * Optional: trigger source name (e.g. actionTag / fieldPath), used as the default pending origin.name.
@@ -697,13 +760,13 @@ interface TaskRunnerConfig<Payload, Sh extends AnyModuleShape, R, A = void, E =
697
760
  /**
698
761
  * success: success writeback (separate transaction entry).
699
762
  */
700
- readonly success?: (result: A, payload: Payload) => Of<Sh, R, void, never>;
763
+ readonly success?: (result: A, payload: Payload) => LogicEffect<Sh, R, void, never>;
701
764
  /**
702
765
  * failure: failure writeback (separate transaction entry).
703
766
  *
704
767
  * Note: takes a Cause to preserve defect/interrupt semantics; interrupts do not trigger failure writeback by default.
705
768
  */
706
- readonly failure?: (cause: Cause.Cause<E>, payload: Payload) => Of<Sh, R, void, never>;
769
+ readonly failure?: (cause: Cause.Cause<E>, payload: Payload) => LogicEffect<Sh, R, void, never>;
707
770
  /**
708
771
  * origin: optional override for the three transaction origins.
709
772
  * - Default: pending.kind="task:pending"; success/failure.kind="service-callback".
@@ -797,10 +860,18 @@ interface Api<Sh extends ModuleShape<any, any>, R = never> {
797
860
  readonly debounce: <V>(ms: number) => (stream: Stream.Stream<V>) => Stream.Stream<V>;
798
861
  readonly throttle: <V>(ms: number) => (stream: Stream.Stream<V>) => Stream.Stream<V>;
799
862
  readonly filter: <V>(predicate: (value: V) => boolean) => (stream: Stream.Stream<V>) => Stream.Stream<V>;
800
- readonly run: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
801
- readonly runParallel: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
802
- readonly runLatest: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
803
- readonly runExhaust: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
863
+ readonly run: {
864
+ <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions): (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
865
+ <V, A = void, E = never, R2 = unknown>(config: RunConfig<Sh, R & R2, V, A, E>): (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
866
+ };
867
+ readonly runParallel: <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
868
+ readonly runLatest: <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
869
+ readonly runExhaust: <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
870
+ }
871
+ interface RunConfig<Sh extends AnyModuleShape, R, V, A = void, E = never> {
872
+ readonly effect: LogicEffect<Sh, R, A, E> | ((payload: V) => LogicEffect<Sh, R, A, E>);
873
+ readonly mode?: ModeRunnerMode;
874
+ readonly options?: OperationOptions;
804
875
  }
805
876
 
806
877
  /**
@@ -809,14 +880,19 @@ interface Api<Sh extends ModuleShape<any, any>, R = never> {
809
880
  * ModuleShape<SpecificSchema> can extend AnyModuleShape.
810
881
  */
811
882
  type AnySchema = any;
883
+ type NormalizeSchema<S> = S extends Schema.Schema<infer A> ? Schema.Schema<A> : S;
884
+ type NormalizeActionToken<T> = T extends ActionToken<infer Tag, infer Payload, any> ? ActionToken<Tag, Payload, Schema.Schema<any>> : T;
885
+ type NormalizeActionMap<AMap extends Record<string, AnyActionToken>> = {
886
+ readonly [K in keyof AMap]: NormalizeActionToken<AMap[K]>;
887
+ };
812
888
  /**
813
889
  * The "schema shape" of a Module: only cares about stateSchema / actionSchema,
814
890
  * not runtime configuration details (initialState / services / logic, etc.).
815
891
  */
816
892
  interface ModuleShape<SSchema extends AnySchema, ASchema extends AnySchema, AMap extends Record<string, AnyActionToken> = Record<string, never>> {
817
- readonly stateSchema: SSchema;
818
- readonly actionSchema: ASchema;
819
- readonly actionMap: AMap;
893
+ readonly stateSchema: NormalizeSchema<SSchema>;
894
+ readonly actionSchema: NormalizeSchema<ASchema>;
895
+ readonly actionMap: NormalizeActionMap<AMap>;
820
896
  }
821
897
  /**
822
898
  * Convenience constraint: any ModuleShape.
@@ -824,9 +900,14 @@ interface ModuleShape<SSchema extends AnySchema, ASchema extends AnySchema, AMap
824
900
  type AnyModuleShape = ModuleShape<any, any, any>;
825
901
  type StateOf<Sh extends AnyModuleShape> = Schema.Schema.Type<Sh['stateSchema']>;
826
902
  type ActionOf<Sh extends AnyModuleShape> = Schema.Schema.Type<Sh['actionSchema']>;
903
+ type ModuleRuntimeOfShape<Sh extends AnyModuleShape> = ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>;
827
904
  type ActionArgs<P> = [P] extends [void] ? [] | [P] : [P];
828
- type ActionFn<P, Out> = (...args: ActionArgs<P>) => Out;
829
- type ActionPayload<T> = T extends ActionToken<any, infer P, any> ? P : never;
905
+ type ActionPayloadOfToken<T> = T extends ActionToken<any, infer P, any> ? P : never;
906
+ type ActionCallable<P, Out> = {
907
+ (payload: P): Out;
908
+ } & ([P] extends [void] ? {
909
+ (): Out;
910
+ } : {});
830
911
  interface ModuleImplementStateTransactionOptions {
831
912
  readonly instrumentation?: StateTransactionInstrumentation;
832
913
  /** 060: Txn Lanes (instance-level opt-in / tuning). */
@@ -846,6 +927,17 @@ interface StateChangeWithMeta<V> {
846
927
  readonly value: V;
847
928
  readonly meta: StateCommitMeta;
848
929
  }
930
+ /**
931
+ * Read-only state ref exposed to business/logic code.
932
+ *
933
+ * - Provides pure snapshot read (`get`) and change stream (`changes`) only.
934
+ * - Does not expose write methods (`set`/`modify`/`update`); writes must go through controlled APIs
935
+ * such as `runtime.setState` / `$.state.update` / `$.state.mutate`.
936
+ */
937
+ interface ReadonlySubscriptionRef<V> {
938
+ readonly get: Effect.Effect<V, never, never>;
939
+ readonly changes: Stream.Stream<V, never, never>;
940
+ }
849
941
  /**
850
942
  * The runtime interface of a Module (similar to "Store as Context" in docs),
851
943
  * exposing read/write, subscription, and dispatch capabilities to Logic / Flow.
@@ -876,6 +968,12 @@ interface ModuleRuntime<S, A> {
876
968
  readonly dispatchBatch: (actions: ReadonlyArray<A>) => Effect.Effect<void>;
877
969
  readonly dispatchLowPriority: (action: A) => Effect.Effect<void>;
878
970
  readonly actions$: Stream.Stream<A>;
971
+ /**
972
+ * Optional action-tag topic stream (hot-path optimization):
973
+ * - When provided, `$.onAction("tag")` can subscribe to a pre-routed stream instead of filtering `actions$`.
974
+ * - Missing tags may still fall back to `actions$` filtering at call sites.
975
+ */
976
+ readonly actionsByTag$?: (tag: string) => Stream.Stream<A>;
879
977
  readonly actionsWithMeta$: Stream.Stream<StateChangeWithMeta<A>>;
880
978
  /**
881
979
  * Subscribe to changes of a selector.
@@ -894,11 +992,11 @@ interface ModuleRuntime<S, A> {
894
992
  */
895
993
  readonly changesReadQueryWithMeta: <V>(readQuery: ReadQueryInput<S, V>) => Stream.Stream<StateChangeWithMeta<V>>;
896
994
  /**
897
- * Provide a SubscriptionRef for long-running / fine-grained logic to borrow state directly.
898
- * The current implementation only exposes a ref for the whole state; selector views are up to the caller to wrap.
995
+ * Provide a read-only state ref for long-running / fine-grained logic.
996
+ * Write access is intentionally blocked at this boundary; all writes must use controlled runtime APIs.
899
997
  */
900
998
  readonly ref: {
901
- <V = S>(selector?: (s: S) => V): SubscriptionRef.SubscriptionRef<V>;
999
+ <V = S>(selector?: (s: S) => V): ReadonlySubscriptionRef<V>;
902
1000
  };
903
1001
  }
904
1002
  /**
@@ -908,7 +1006,7 @@ interface ModuleRuntime<S, A> {
908
1006
  * - The Id type is not important for this PoC, so we use `any`.
909
1007
  * - The Service type is fixed to the Runtime for the current Shape.
910
1008
  */
911
- type ModuleRuntimeTag<Sh extends AnyModuleShape> = Context.Tag<any, ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>>;
1009
+ type ModuleRuntimeTag<Sh extends AnyModuleShape> = ServiceMap.Key<any, ModuleRuntimeOfShape<Sh>>;
912
1010
  /**
913
1011
  * Module handle union:
914
1012
  * - Used by the React adapter / higher-level integrations to accept either a tag or a runtime instance.
@@ -917,7 +1015,7 @@ type ModuleRuntimeTag<Sh extends AnyModuleShape> = Context.Tag<any, ModuleRuntim
917
1015
  *
918
1016
  * Higher-level APIs may accept ModuleHandle<Sh> and branch internally on tag vs instance.
919
1017
  */
920
- type ModuleHandleUnion<Sh extends AnyModuleShape> = ModuleRuntime<StateOf<Sh>, ActionOf<Sh>> | ModuleRuntimeTag<Sh>;
1018
+ type ModuleHandleUnion<Sh extends AnyModuleShape> = ModuleRuntimeOfShape<Sh> | ModuleRuntimeTag<Sh>;
921
1019
  /**
922
1020
  * v3: a read-only handle view exposed to Logic for cross-module access.
923
1021
  *
@@ -932,7 +1030,7 @@ interface ModuleHandle<Sh extends AnyModuleShape> {
932
1030
  readonly changes: <V>(selector: (s: StateOf<Sh>) => V) => Stream.Stream<V, never, never>;
933
1031
  readonly dispatch: (action: ActionOf<Sh>) => Effect.Effect<void, never, never>;
934
1032
  readonly actions: {
935
- [K in keyof Sh['actionMap']]: ActionFn<ActionPayload<Sh['actionMap'][K]>, Effect.Effect<void, never, never>>;
1033
+ [K in keyof Sh['actionMap']]: ActionCallable<ActionPayloadOfToken<Sh['actionMap'][K]>, Effect.Effect<void, never, never>>;
936
1034
  };
937
1035
  readonly actions$: Stream.Stream<ActionOf<Sh>, never, never>;
938
1036
  }
@@ -971,15 +1069,64 @@ type ModuleExtOf<M> = M extends ModuleLike<any, any, infer Ext> ? Ext : never;
971
1069
  * - setup: runs during Module instance startup, used to register reducers / lifecycle / Debug and other structural behavior.
972
1070
  * - run: the main logic program, running as a long-lived fiber after Env is fully ready.
973
1071
  *
974
- * Notes:
975
- * - In the current implementation, Runtime still treats Logic as a single-phase program, equivalent to
976
- * `setup = Effect.void` and `run = Logic`.
977
- * - After the runtime-logix L4 drafts converge, we will gradually adopt a real two-phase execution model.
1072
+ * Runtime canonicalization rule:
1073
+ * - raw Logic inputs (single-phase / plan / marked plan effect) are normalized into LogicPlan before execution.
1074
+ * - single-phase Logic is equivalent to `setup = Effect.void` and `run = Logic`.
978
1075
  */
979
1076
  interface LogicPlan<Sh extends AnyModuleShape, R = unknown, E = unknown> {
980
- readonly setup: Of<Sh, R, void, never>;
981
- readonly run: Of<Sh, R, unknown, E>;
1077
+ readonly setup: DispatchEffect<Sh, R>;
1078
+ readonly run: LogicEffect<Sh, R, unknown, E>;
982
1079
  }
1080
+ type LogicEffect<Sh extends AnyModuleShape, R = never, A = void, E = never> = Of<Sh, R, A, E>;
1081
+ type DispatchEffect<Sh extends AnyModuleShape, R = never> = LogicEffect<Sh, R, void, never>;
1082
+ type ActionForTag<Sh extends AnyModuleShape, K extends keyof Sh['actionMap']> = Extract<ActionOf<Sh>, {
1083
+ _tag: K;
1084
+ } | {
1085
+ type: K;
1086
+ }>;
1087
+ type BoundApiRootApi<Sh extends AnyModuleShape, R = never> = {
1088
+ readonly resolve: <Svc, Id = unknown>(tag: ServiceMap.Key<Id, Svc>) => LogicEffect<Sh, R, Svc, never>;
1089
+ };
1090
+ type BoundApiStateApi<Sh extends AnyModuleShape, R = never> = {
1091
+ readonly read: LogicEffect<Sh, R, StateOf<Sh>, never>;
1092
+ readonly update: (f: (prev: StateOf<Sh>) => StateOf<Sh>) => DispatchEffect<Sh, R>;
1093
+ readonly mutate: (f: (draft: Draft<StateOf<Sh>>) => void) => DispatchEffect<Sh, R>;
1094
+ readonly ref: {
1095
+ <V = StateOf<Sh>>(selector?: (s: StateOf<Sh>) => V): ReadonlySubscriptionRef<V>;
1096
+ };
1097
+ };
1098
+ type BoundApiDispatchersApi<Sh extends AnyModuleShape, R = never> = {
1099
+ readonly [K in keyof Sh['actionMap']]: ActionCallable<ActionPayloadOfToken<Sh['actionMap'][K]>, DispatchEffect<Sh, R>>;
1100
+ };
1101
+ type BoundApiDispatchApi<Sh extends AnyModuleShape, R = never> = {
1102
+ (action: ActionOf<Sh>): DispatchEffect<Sh, R>;
1103
+ <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], ...args: ActionArgs<ActionPayloadOfToken<Sh['actionMap'][K]>>): DispatchEffect<Sh, R>;
1104
+ <K extends keyof Sh['actionMap']>(tag: K, ...args: ActionArgs<ActionPayloadOfToken<Sh['actionMap'][K]>>): DispatchEffect<Sh, R>;
1105
+ };
1106
+ type BoundApiLifecycleApi<Sh extends AnyModuleShape, R = never> = {
1107
+ readonly onInitRequired: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1108
+ readonly onStart: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1109
+ readonly onInit: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1110
+ readonly onDestroy: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1111
+ readonly onError: (handler: (cause: effect.Cause.Cause<unknown>, context: ErrorContext) => Effect.Effect<void, never, R>) => DispatchEffect<Sh, R>;
1112
+ readonly onSuspend: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1113
+ readonly onResume: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1114
+ readonly onReset: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1115
+ };
1116
+ type BoundApiUseApi<Sh extends AnyModuleShape, R = never> = {
1117
+ <M extends ModuleLike<string, AnyModuleShape, any>>(module: M): LogicEffect<Sh, R, ModuleHandle<ModuleShapeOf<M>> & ModuleExtOf<M>, never>;
1118
+ <Sh2 extends AnyModuleShape>(module: ModuleTag<string, Sh2>): LogicEffect<Sh, R, ModuleHandle<Sh2>, never>;
1119
+ <Svc, Id = unknown>(tag: ServiceMap.Key<Id, Svc>): LogicEffect<Sh, R, Svc, never>;
1120
+ };
1121
+ type BoundApiTraitsApi<Sh extends AnyModuleShape, R = never> = {
1122
+ readonly declare: (traits: TraitSpec) => void;
1123
+ readonly source: {
1124
+ readonly refresh: (fieldPath: string, options?: {
1125
+ readonly force?: boolean;
1126
+ }) => DispatchEffect<Sh, R>;
1127
+ };
1128
+ };
1129
+ type BoundApiReducerApi<Sh extends AnyModuleShape, R = never> = <K extends keyof Sh['actionMap']>(tag: K, reducer: (state: StateOf<Sh>, action: ActionForTag<Sh, K>) => StateOf<Sh>) => DispatchEffect<Sh, R>;
983
1130
  /**
984
1131
  * Bound API: creates pre-bound accessors for a given Store shape + Env.
985
1132
  *
@@ -987,26 +1134,11 @@ interface LogicPlan<Sh extends AnyModuleShape, R = unknown, E = unknown> {
987
1134
  * - The public Bound.ts exports a same-named type alias to keep the public API consistent.
988
1135
  */
989
1136
  interface BoundApi<Sh extends AnyModuleShape, R = never> {
990
- readonly root: {
991
- readonly resolve: <Svc, Id = unknown>(tag: Context.Tag<Id, Svc>) => Of<Sh, R, Svc, never>;
992
- };
993
- readonly state: {
994
- readonly read: Of<Sh, R, StateOf<Sh>, never>;
995
- readonly update: (f: (prev: StateOf<Sh>) => StateOf<Sh>) => Of<Sh, R, void, never>;
996
- readonly mutate: (f: (draft: Draft<StateOf<Sh>>) => void) => Of<Sh, R, void, never>;
997
- readonly ref: {
998
- <V = StateOf<Sh>>(selector?: (s: StateOf<Sh>) => V): SubscriptionRef.SubscriptionRef<V>;
999
- };
1000
- };
1137
+ readonly root: BoundApiRootApi<Sh, R>;
1138
+ readonly state: BoundApiStateApi<Sh, R>;
1001
1139
  readonly actions: Sh['actionMap'];
1002
- readonly dispatchers: {
1003
- readonly [K in keyof Sh['actionMap']]: ActionFn<ActionPayload<Sh['actionMap'][K]>, Of<Sh, R, void, never>>;
1004
- };
1005
- readonly dispatch: {
1006
- (action: ActionOf<Sh>): Of<Sh, R, void, never>;
1007
- <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], ...args: ActionArgs<ActionPayload<Sh['actionMap'][K]>>): Of<Sh, R, void, never>;
1008
- <K extends keyof Sh['actionMap']>(tag: K, ...args: ActionArgs<ActionPayload<Sh['actionMap'][K]>>): Of<Sh, R, void, never>;
1009
- };
1140
+ readonly dispatchers: BoundApiDispatchersApi<Sh, R>;
1141
+ readonly dispatch: BoundApiDispatchApi<Sh, R>;
1010
1142
  /**
1011
1143
  * effect:
1012
1144
  * - Register a side-effect handler for a specific Action token.
@@ -1016,47 +1148,26 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1016
1148
  * - Handlers must run outside the transaction window (FR-012); never perform IO inside reducers/transactions.
1017
1149
  * - The runtime de-duplicates by `(actionTag, sourceKey)` (sourceKey is derived automatically).
1018
1150
  */
1019
- readonly effect: <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], handler: (payload: ActionPayload<Sh['actionMap'][K]>) => Of<Sh, R, void, any>) => Of<Sh, R, void, never>;
1151
+ readonly effect: <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], handler: (payload: ActionPayloadOfToken<Sh['actionMap'][K]>) => LogicEffect<Sh, R, void, any>) => DispatchEffect<Sh, R>;
1020
1152
  readonly flow: Api<Sh, R>;
1021
1153
  readonly match: <V>(value: V) => FluentMatch<V>;
1022
1154
  readonly matchTag: <V extends {
1023
1155
  _tag: string;
1024
1156
  }>(value: V) => FluentMatchTag<V>;
1025
- readonly lifecycle: {
1026
- readonly onInitRequired: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1027
- readonly onStart: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1028
- readonly onInit: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1029
- readonly onDestroy: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1030
- readonly onError: (handler: (cause: effect.Cause.Cause<unknown>, context: ErrorContext) => Effect.Effect<void, never, R>) => Of<Sh, R, void, never>;
1031
- readonly onSuspend: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1032
- readonly onResume: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1033
- readonly onReset: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1034
- };
1035
- readonly use: {
1036
- <M extends ModuleLike<string, AnyModuleShape, any>>(module: M): Of<Sh, R, ModuleHandle<ModuleShapeOf<M>> & ModuleExtOf<M>, never>;
1037
- <Sh2 extends AnyModuleShape>(module: ModuleTag<string, Sh2>): Of<Sh, R, ModuleHandle<Sh2>, never>;
1038
- <Svc, Id = unknown>(tag: Context.Tag<Id, Svc>): Of<Sh, R, Svc, never>;
1039
- };
1157
+ readonly lifecycle: BoundApiLifecycleApi<Sh, R>;
1158
+ readonly use: BoundApiUseApi<Sh, R>;
1040
1159
  readonly onAction: {
1041
1160
  <T extends ActionOf<Sh>>(predicate: (a: ActionOf<Sh>) => a is T): IntentBuilder<T, Sh, R>;
1042
- <K extends keyof Sh['actionMap']>(tag: K): IntentBuilder<Extract<ActionOf<Sh>, {
1043
- _tag: K;
1044
- } | {
1045
- type: K;
1046
- }>, Sh, R>;
1161
+ <K extends keyof Sh['actionMap']>(tag: K): IntentBuilder<ActionForTag<Sh, K>, Sh, R>;
1047
1162
  <A extends ActionOf<Sh> & ({
1048
1163
  _tag: string;
1049
1164
  } | {
1050
1165
  type: string;
1051
1166
  })>(value: A): IntentBuilder<A, Sh, R>;
1052
1167
  <Sc extends AnySchema>(schema: Sc): IntentBuilder<Extract<ActionOf<Sh>, Schema.Schema.Type<Sc>>, Sh, R>;
1053
- <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K]): IntentBuilder<ActionPayload<Sh['actionMap'][K]>, Sh, R>;
1168
+ <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K]): IntentBuilder<ActionPayloadOfToken<Sh['actionMap'][K]>, Sh, R>;
1054
1169
  } & {
1055
- [K in keyof Sh['actionMap']]: IntentBuilder<Extract<ActionOf<Sh>, {
1056
- _tag: K;
1057
- } | {
1058
- type: K;
1059
- }>, Sh, R>;
1170
+ [K in keyof Sh['actionMap']]: IntentBuilder<ActionForTag<Sh, K>, Sh, R>;
1060
1171
  };
1061
1172
  readonly onState: <V>(selector: (s: StateOf<Sh>) => V) => IntentBuilder<V, Sh, R>;
1062
1173
  readonly on: <V>(source: Stream.Stream<V>) => IntentBuilder<V, Sh, R>;
@@ -1066,24 +1177,7 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1066
1177
  * - source.refresh(fieldPath): trigger an explicit refresh of a source field.
1067
1178
  * - Concrete behavior is mounted at runtime by StateTrait.install.
1068
1179
  */
1069
- readonly traits: {
1070
- /**
1071
- * declare:
1072
- * - setup-only: contributes trait declarations during the Logic setup phase (pure data/declarative).
1073
- * - Final merge / conflict detection / freezing is done during Runtime initialization (023).
1074
- */
1075
- readonly declare: (traits: TraitSpec) => void;
1076
- readonly source: {
1077
- readonly refresh: (fieldPath: string, options?: {
1078
- /**
1079
- * Forced refresh: re-fetch even if keyHash is unchanged and a non-idle snapshot already exists.
1080
- * - Used for explicit refresh / invalidate where "same key still re-fetch" is desired.
1081
- * - Auto-trigger chains SHOULD keep the default (false/undefined) to avoid duplicate IO and meaningless writebacks.
1082
- */
1083
- readonly force?: boolean;
1084
- }) => Of<Sh, R, void, never>;
1085
- };
1086
- };
1180
+ readonly traits: BoundApiTraitsApi<Sh, R>;
1087
1181
  /**
1088
1182
  * Primary reducer definition entrypoint:
1089
1183
  * - Semantics: register a synchronous, pure state transform reducer for an Action tag.
@@ -1093,11 +1187,7 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1093
1187
  * - At most one primary reducer per Action tag; duplicate registration is an error.
1094
1188
  * - The reducer must be pure: no Env, no Effect.
1095
1189
  */
1096
- readonly reducer: <K extends keyof Sh['actionMap'], A extends Extract<ActionOf<Sh>, {
1097
- _tag: K;
1098
- } | {
1099
- type: K;
1100
- }>>(tag: K, reducer: (state: StateOf<Sh>, action: A) => StateOf<Sh>) => Of<Sh, R, void, never>;
1190
+ readonly reducer: BoundApiReducerApi<Sh, R>;
1101
1191
  }
1102
1192
  /**
1103
1193
  * ModuleTag: identity anchor (Context.Tag).
@@ -1105,7 +1195,7 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1105
1195
  * - Also acts as a Context.Tag; usable as an argument to `$.use(Module)`.
1106
1196
  * - Exposes `logic` and `live` factories for mounting logic programs and building the live Layer.
1107
1197
  */
1108
- interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends Context.Tag<any, ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>> {
1198
+ interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends ServiceMap.Key<any, ModuleRuntimeOfShape<Sh>> {
1109
1199
  readonly _kind: 'ModuleTag';
1110
1200
  readonly id: Id;
1111
1201
  readonly shape: Sh;
@@ -1122,7 +1212,7 @@ interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends Contex
1122
1212
  */
1123
1213
  readonly reducers?: ReducersFromMap<Sh['stateSchema'], Sh['actionMap']>;
1124
1214
  readonly logic: <R = never, E = unknown>(build: (api: BoundApi<Sh, R>) => ModuleLogic<Sh, R, E>) => ModuleLogic<Sh, R, E>;
1125
- readonly live: <R = never, E = never>(initial: StateOf<Sh>, ...logics: Array<ModuleLogic<Sh, R, E>>) => Layer.Layer<ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>, E, R>;
1215
+ readonly live: <R = never, E = never>(initial: StateOf<Sh>, ...logics: Array<ModuleLogic<Sh, R, E>>) => Layer.Layer<ModuleRuntimeOfShape<Sh>, E, R>;
1126
1216
  /**
1127
1217
  * implement: build a ModuleImpl blueprint from Module definition + initial state + a set of logics.
1128
1218
  *
@@ -1147,7 +1237,7 @@ interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends Contex
1147
1237
  interface ModuleImpl<Id extends string, Sh extends AnyModuleShape, REnv = any> {
1148
1238
  readonly _tag: 'ModuleImpl';
1149
1239
  readonly module: ModuleTag<Id, Sh>;
1150
- readonly layer: Layer.Layer<ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>, never, REnv>;
1240
+ readonly layer: Layer.Layer<ModuleRuntimeOfShape<Sh>, never, REnv>;
1151
1241
  readonly processes?: ReadonlyArray<Effect.Effect<void, any, any>>;
1152
1242
  readonly stateTransaction?: ModuleImplementStateTransactionOptions;
1153
1243
  readonly withLayer: (layer: Layer.Layer<any, never, any>) => ModuleImpl<Id, Sh, REnv>;
@@ -1156,9 +1246,9 @@ interface ModuleImpl<Id extends string, Sh extends AnyModuleShape, REnv = any> {
1156
1246
  /**
1157
1247
  * Helper type: convert an Action Map into a union type.
1158
1248
  */
1159
- type PayloadOfActionDef<V> = V extends Schema.Schema<any, any, any> ? Schema.Schema.Type<V> : V extends ActionToken<any, infer P, any> ? P : never;
1249
+ type PayloadOfActionDef<V> = V extends Schema.Schema<any> ? Schema.Schema.Type<V> : V extends ActionToken<any, infer P, any> ? P : never;
1160
1250
  type ActionsFromMap<M extends Record<string, AnySchema>> = {
1161
- [K in keyof M]: M[K] extends Schema.Schema<any, any, any> ? PayloadOfActionDef<M[K]> extends void ? {
1251
+ [K in keyof M]: M[K] extends Schema.Schema<any> ? PayloadOfActionDef<M[K]> extends void ? {
1162
1252
  readonly _tag: K;
1163
1253
  readonly payload?: PayloadOfActionDef<M[K]>;
1164
1254
  } : {
@@ -1188,4 +1278,4 @@ type ReducersFromMap<SSchema extends AnySchema, AMap extends Record<string, AnyS
1188
1278
  }, sink?: (path: string | FieldPath) => void) => Schema.Schema.Type<SSchema>;
1189
1279
  };
1190
1280
 
1191
- export { type OperationOptions as $, type AnySchema as A, type BoundApi as B, type ConcurrencyLimit as C, type DirtyAllReason as D, type ErrorContext as E, type FieldPath as F, type ModuleHandleUnion as G, type TraitConvergeTimeSlicingPatch as H, type TxnLanesPatch as I, type StateTransactionTraitConvergeOverrides as J, type StateTransactionOverrides as K, type ConvergeStaticIrExport as L, type ModuleTag as M, type TraitProvenance as N, type ModuleImplementStateTransactionOptions as O, type PatchReason as P, type Env as Q, type ReducersFromMap as R, type StateTransactionInstrumentation as S, type TraitContribution as T, type Of as U, type Draft as V, type IntentBuilder as W, type FluentMatch as X, type FluentMatchTag as Y, type LogicMeta as Z, type Middleware as _, type StatePatchPath as a, type SerializableErrorSummary as a0, type StateTraitProgram as a1, type StateTraitGraph as a2, type StateTraitPlan as a3, type StateTraitSpec as a4, type StateTraitEntry as a5, type StateTraitNode as a6, type StateTraitList as a7, type CheckRule as a8, type StateFieldPath as a9, type StateAtPath as aa, type TraitConvergeScheduling as ab, type DirtySet as b, type FieldPathId as c, type ModuleRuntimeTag as d, type ConcurrencyPolicy as e, type ConcurrencyPolicyOverrides as f, type ConcurrencyPolicyPatch as g, type AnyModuleShape as h, type ModuleShape as i, type ModuleLogic as j, type ModuleImpl as k, type ModuleRuntime as l, type ModuleHandle as m, normalizeFieldPath as n, type StateOf as o, type ActionOf as p, type ActionsFromMap as q, type MutatorsFromMap as r, type StateCommitMode as s, type StateCommitPriority as t, type StateCommitMeta as u, type StateChangeWithMeta as v, type StateTxnOrigin as w, type ModuleTraitsSnapshot as x, type Api as y, type ModuleLike as z };
1281
+ export { type ModuleLike as $, type AnySchema as A, type BoundApi as B, type ConcurrencyLimit as C, type DirtyAllReason as D, type ActionForTag as E, type FieldPath as F, type BoundApiRootApi as G, type BoundApiStateApi as H, type BoundApiDispatchersApi as I, type BoundApiDispatchApi as J, type BoundApiLifecycleApi as K, type LogicEffect as L, type ModuleTag as M, type BoundApiUseApi as N, type BoundApiTraitsApi as O, type PatchReason as P, type BoundApiReducerApi as Q, type ReducersFromMap as R, type StateCommitPriority as S, type StateCommitMode as T, type StateChangeWithMeta as U, type ReadonlySubscriptionRef as V, type ErrorContext as W, type StateTxnOrigin as X, type TraitContribution as Y, type ModuleTraitsSnapshot as Z, type Api as _, type StateCommitMeta as a, type ModuleHandleUnion as a0, type TraitConvergeTimeSlicingPatch as a1, type TxnLanesPatch as a2, type StateTransactionTraitConvergeOverrides as a3, type StateTransactionOverrides as a4, type TraitProvenance as a5, type ModuleImplementStateTransactionOptions as a6, type Env as a7, type Of as a8, type Draft as a9, type IntentBuilder as aa, type FluentMatch as ab, type FluentMatchTag as ac, type LogicMeta as ad, type Middleware as ae, type OperationOptions as af, type StateTraitProgram as ag, type StateTraitGraph as ah, type StateTraitPlan as ai, type StateTraitSpec as aj, type StateTraitEntry as ak, type StateTraitNode as al, type StateTraitList as am, type CheckRule as an, type TraitMeta as ao, type StateFieldPath as ap, type StateAtPath as aq, type TraitConvergeScheduling as ar, type TraitLane as as, type SchedulingPolicyLimit as b, type StateTransactionInstrumentation as c, type StatePatchPath as d, type DirtySet as e, type FieldPathId as f, type ModuleRuntimeTag as g, type SchedulingPolicySurface as h, type SchedulingPolicySurfaceOverrides as i, type SchedulingPolicySurfacePatch as j, type ConcurrencyPolicy as k, type ConcurrencyPolicyOverrides as l, type ConcurrencyPolicyPatch as m, normalizeFieldPath as n, type AnyModuleShape as o, type ModuleShape as p, type ModuleLogic as q, type ModuleImpl as r, type ModuleRuntime as s, type ModuleRuntimeOfShape as t, type ModuleHandle as u, type StateOf as v, type ActionOf as w, type ActionsFromMap as x, type MutatorsFromMap as y, type DispatchEffect as z };