@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
@@ -0,0 +1,845 @@
1
+ import {
2
+ compileWorkflowRuntimeStepsV1,
3
+ evalInputExpr,
4
+ makeWorkflowError
5
+ } from "./chunk-3L6QGFMM.js";
6
+ import {
7
+ attachLogicUnitMeta
8
+ } from "./chunk-NUDBM4MM.js";
9
+ import {
10
+ tagFromServiceId
11
+ } from "./chunk-VJLWD47W.js";
12
+ import {
13
+ RootContextTag
14
+ } from "./chunk-YZDJMAKL.js";
15
+ import {
16
+ getRuntimeInternals
17
+ } from "./chunk-63ZQ5RIN.js";
18
+ import {
19
+ HostSchedulerTag,
20
+ TickSchedulerTag,
21
+ forceSourceRefresh,
22
+ inSyncTransactionFiber
23
+ } from "./chunk-S4S5N4BJ.js";
24
+ import {
25
+ makeRunBudgetEnvelopeV1,
26
+ makeRunDegradeMarkerV1
27
+ } from "./chunk-K6JQW266.js";
28
+ import {
29
+ makeInRunSession,
30
+ run
31
+ } from "./chunk-CYYSQMLO.js";
32
+ import {
33
+ currentDiagnosticsLevel,
34
+ record,
35
+ toSerializableErrorSummary
36
+ } from "./chunk-V2SBGVDO.js";
37
+ import {
38
+ EffectOpMiddlewareTag
39
+ } from "./chunk-LPPZDFTD.js";
40
+
41
+ // src/internal/runtime/core/WorkflowRuntime.ts
42
+ import { Cause, Deferred, Effect, Exit, Fiber, Option, Semaphore, ServiceMap, Stream } from "effect";
43
+ var WORKFLOW_REGISTRY = /* @__PURE__ */ Symbol.for("@logixjs/core/workflowRegistry");
44
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
45
+ var isObjectLike = (value) => typeof value === "object" && value !== null || typeof value === "function";
46
+ var getRegistry = (runtime) => runtime[WORKFLOW_REGISTRY];
47
+ var resolveActionTag = (action) => {
48
+ const tag = isObjectLike(action) ? action._tag : void 0;
49
+ if (typeof tag === "string" && tag.length > 0) return tag;
50
+ const type = isObjectLike(action) ? action.type : void 0;
51
+ if (typeof type === "string" && type.length > 0) return type;
52
+ if (tag != null) return String(tag);
53
+ if (type != null) return String(type);
54
+ return void 0;
55
+ };
56
+ var asNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
57
+ var KERNEL_PORT_SOURCE_REFRESH = "logix/kernel/sourceRefresh";
58
+ var resolveServicePort = (runtime, env, serviceId, programId, stepKey) => {
59
+ if (serviceId === KERNEL_PORT_SOURCE_REFRESH) {
60
+ return (input) => Effect.gen(function* () {
61
+ const fieldPath = asNonEmptyString(isRecord(input) ? input.fieldPath : void 0);
62
+ if (!fieldPath) {
63
+ throw makeWorkflowError({
64
+ code: "WORKFLOW_INVALID_STEP",
65
+ message: "KernelPort sourceRefresh requires input.fieldPath (non-empty string).",
66
+ programId,
67
+ source: { stepKey },
68
+ detail: { serviceId, input }
69
+ });
70
+ }
71
+ const internals = getRuntimeInternals(runtime);
72
+ const handler = internals.traits.getSourceRefreshHandler(fieldPath);
73
+ if (!handler) {
74
+ return;
75
+ }
76
+ const force = isRecord(input) && input.force === true;
77
+ const runHandler = (state) => force ? Effect.provideService(handler(state), forceSourceRefresh, true) : handler(state);
78
+ const inTxn = yield* Effect.service(inSyncTransactionFiber).pipe(Effect.orDie);
79
+ if (inTxn) {
80
+ const state = yield* runtime.getState;
81
+ yield* runHandler(state);
82
+ return;
83
+ }
84
+ yield* internals.txn.runWithStateTransaction(
85
+ {
86
+ kind: "source-refresh",
87
+ name: fieldPath
88
+ },
89
+ () => Effect.gen(function* () {
90
+ const state = yield* runtime.getState;
91
+ yield* runHandler(state);
92
+ })
93
+ );
94
+ });
95
+ }
96
+ const tag = tagFromServiceId(serviceId);
97
+ const opt = ServiceMap.getOption(env, tag);
98
+ if (Option.isNone(opt)) {
99
+ throw makeWorkflowError({
100
+ code: "WORKFLOW_MISSING_SERVICE",
101
+ message: `Missing service for serviceId="${serviceId}".`,
102
+ programId,
103
+ source: { stepKey },
104
+ detail: { serviceId }
105
+ });
106
+ }
107
+ const value = opt.value;
108
+ if (typeof value === "function") {
109
+ const fn = value;
110
+ return (input) => fn(input);
111
+ }
112
+ const callFn = isObjectLike(value) ? value.call : void 0;
113
+ if (typeof callFn === "function") {
114
+ const call = callFn;
115
+ return (input) => call.call(value, input);
116
+ }
117
+ throw makeWorkflowError({
118
+ code: "WORKFLOW_INVALID_SERVICE_PORT",
119
+ message: `Invalid service port for serviceId="${serviceId}" (expected a function or { call(input): Effect }).`,
120
+ programId,
121
+ source: { stepKey },
122
+ detail: { serviceId, portType: typeof value }
123
+ });
124
+ };
125
+ var compileSteps = (steps, resolvePort) => {
126
+ const visit = (step) => {
127
+ switch (step.kind) {
128
+ case "dispatch":
129
+ return {
130
+ kind: "dispatch",
131
+ key: step.key,
132
+ actionTag: step.actionTag,
133
+ ...step.payload ? { payload: step.payload } : null
134
+ };
135
+ case "delay":
136
+ return { kind: "delay", key: step.key, ms: step.ms };
137
+ case "call":
138
+ return {
139
+ kind: "call",
140
+ key: step.key,
141
+ serviceId: step.serviceId,
142
+ port: resolvePort(step.serviceId, step.key),
143
+ ...step.input ? { input: step.input } : null,
144
+ ...step.timeoutMs !== void 0 ? { timeoutMs: step.timeoutMs } : null,
145
+ ...step.retryTimes !== void 0 ? { retryTimes: step.retryTimes } : null,
146
+ onSuccess: step.onSuccess.map(visit),
147
+ onFailure: step.onFailure.map(visit)
148
+ };
149
+ }
150
+ };
151
+ return steps.map(visit);
152
+ };
153
+ var resolveConcurrency = (def) => def.policy?.concurrency ?? "parallel";
154
+ var resolvePriority = (def) => def.policy?.priority ?? "urgent";
155
+ var makeRunId = (instanceId, programId, runSeq) => `${instanceId}::wf:${programId}::r${runSeq}`;
156
+ var makeWorkflowRunBudgetMeta = (args) => ({
157
+ budgetEnvelope: makeRunBudgetEnvelopeV1({
158
+ domain: "workflow",
159
+ runId: args.runId
160
+ }),
161
+ degrade: makeRunDegradeMarkerV1(
162
+ !args.observed,
163
+ args.observed ? void 0 : args.diagnostics === "sampled" ? "sampled_out" : "observer_disabled"
164
+ )
165
+ });
166
+ var runBoundary = (args) => Effect.gen(function* () {
167
+ const op = yield* makeInRunSession({
168
+ kind: args.kind,
169
+ name: args.name,
170
+ effect: args.effect,
171
+ payload: args.payload,
172
+ meta: args.meta
173
+ });
174
+ const stack = args.middleware?.stack ?? [];
175
+ return yield* run(op, stack);
176
+ });
177
+ var makeWorkflowBoundaryRunner = (args) => {
178
+ const baseMeta = {
179
+ moduleId: args.runtime.moduleId,
180
+ instanceId: args.runtime.instanceId,
181
+ programId: args.programId
182
+ };
183
+ return (boundary) => runBoundary({
184
+ kind: boundary.kind,
185
+ name: boundary.name,
186
+ effect: boundary.effect,
187
+ payload: boundary.payload,
188
+ meta: {
189
+ ...baseMeta,
190
+ ...boundary.meta ?? null
191
+ },
192
+ middleware: args.middleware
193
+ });
194
+ };
195
+ var makeTimer = (args) => Effect.promise(
196
+ (signal) => new Promise((resolve) => {
197
+ let fired = false;
198
+ const cancel = args.ms <= 0 ? args.host.scheduleMacrotask(() => {
199
+ fired = true;
200
+ args.host.scheduleMicrotask(resolve);
201
+ }) : args.host.scheduleTimeout(args.ms, () => {
202
+ fired = true;
203
+ args.host.scheduleMicrotask(resolve);
204
+ });
205
+ const onAbort = () => {
206
+ cancel();
207
+ if (!fired) {
208
+ void Effect.runPromise(args.onCancel);
209
+ }
210
+ };
211
+ signal.addEventListener("abort", onAbort, { once: true });
212
+ })
213
+ );
214
+ var ensureLimiterReady = (registry, runtime) => Effect.gen(function* () {
215
+ if (registry.parallelLimiter !== void 0) return;
216
+ const internals = getRuntimeInternals(runtime);
217
+ const policy = yield* internals.concurrency.resolveConcurrencyPolicy();
218
+ const limit = policy.concurrencyLimit;
219
+ if (limit === "unbounded") {
220
+ registry.parallelLimiter = null;
221
+ return;
222
+ }
223
+ const n = typeof limit === "number" && Number.isFinite(limit) && limit >= 1 ? Math.floor(limit) : 16;
224
+ registry.parallelLimiter = yield* Semaphore.make(n);
225
+ });
226
+ var withRootEnvIfAvailable = (eff) => Effect.gen(function* () {
227
+ const rootOpt = yield* Effect.serviceOption(RootContextTag);
228
+ if (Option.isNone(rootOpt)) {
229
+ return yield* eff;
230
+ }
231
+ const root = rootOpt.value;
232
+ const rootEnv = root.context ?? (yield* Deferred.await(root.ready));
233
+ const currentEnv = yield* Effect.services();
234
+ const mergedEnv = ServiceMap.merge(rootEnv, currentEnv);
235
+ return yield* Effect.provideServices(eff, mergedEnv);
236
+ });
237
+ var ensurePortsResolved = (registry, runtime) => Effect.gen(function* () {
238
+ const done = yield* Deferred.isDone(registry.portsReady);
239
+ if (done) {
240
+ yield* Deferred.await(registry.portsReady);
241
+ return;
242
+ }
243
+ if (registry.portsResolving) {
244
+ yield* Deferred.await(registry.portsReady);
245
+ return;
246
+ }
247
+ registry.portsResolving = true;
248
+ const env = yield* Effect.services();
249
+ yield* Effect.sync(() => {
250
+ const portCache = /* @__PURE__ */ new Map();
251
+ for (const entry of registry.entries) {
252
+ const program = entry.program;
253
+ if (program.steps) continue;
254
+ const resolvePort = (serviceId, stepKey) => {
255
+ const cached = portCache.get(serviceId);
256
+ if (cached) return cached;
257
+ const resolved = resolveServicePort(runtime, env, serviceId, program.programId, stepKey);
258
+ portCache.set(serviceId, resolved);
259
+ return resolved;
260
+ };
261
+ program.steps = compileSteps(program.compiledSteps, resolvePort);
262
+ }
263
+ }).pipe(
264
+ Effect.tap(() => Deferred.succeed(registry.portsReady, void 0)),
265
+ Effect.catchCause((cause) => Deferred.failCause(registry.portsReady, cause).pipe(Effect.flatMap(() => Effect.failCause(cause)))),
266
+ Effect.ensuring(
267
+ Effect.sync(() => {
268
+ registry.portsResolving = false;
269
+ })
270
+ )
271
+ );
272
+ });
273
+ var shouldObserveForRun = (diagnostics, runSeq) => {
274
+ if (diagnostics === "off") return false;
275
+ if (diagnostics === "sampled") {
276
+ return (runSeq & 15) === 0;
277
+ }
278
+ return true;
279
+ };
280
+ var startProgramRun = (args) => Effect.gen(function* () {
281
+ const { entry, runtime, registry } = args;
282
+ const { program, state } = entry;
283
+ const runWorkflowBoundary = makeWorkflowBoundaryRunner({
284
+ runtime,
285
+ programId: program.programId,
286
+ middleware: args.middleware
287
+ });
288
+ const diagnostics = yield* Effect.service(currentDiagnosticsLevel).pipe(Effect.orDie);
289
+ const beginRun = () => {
290
+ if (state.mode === "latest") {
291
+ state.runSeq += 1;
292
+ const runSeq3 = state.runSeq;
293
+ const runId3 = makeRunId(runtime.instanceId, program.programId, runSeq3);
294
+ return {
295
+ runSeq: runSeq3,
296
+ runId: runId3,
297
+ canWriteBack: () => state.runSeq === runSeq3
298
+ };
299
+ }
300
+ state.runSeq += 1;
301
+ const runSeq2 = state.runSeq;
302
+ const runId2 = makeRunId(runtime.instanceId, program.programId, runSeq2);
303
+ return {
304
+ runSeq: runSeq2,
305
+ runId: runId2,
306
+ canWriteBack: () => true
307
+ };
308
+ };
309
+ if (state.mode === "exhaust") {
310
+ if (state.busy) {
311
+ if (diagnostics !== "off") {
312
+ const observe2 = shouldObserveForRun(diagnostics, state.runSeq);
313
+ const tickScheduler = yield* Effect.service(TickSchedulerTag).pipe(Effect.orDie);
314
+ const tickSeq = observe2 ? tickScheduler.getTickSeq() : void 0;
315
+ yield* runWorkflowBoundary({
316
+ kind: "flow",
317
+ name: "workflow.drop",
318
+ payload: { programId: program.programId, trigger: args.trigger },
319
+ meta: {
320
+ ...tickSeq !== void 0 ? { tickSeq } : null,
321
+ policy: { disableObservers: !observe2 },
322
+ reason: "exhaust"
323
+ },
324
+ effect: Effect.void
325
+ });
326
+ }
327
+ return;
328
+ }
329
+ state.busy = true;
330
+ }
331
+ const { runSeq, runId, canWriteBack } = beginRun();
332
+ if (state.mode === "latest") {
333
+ const prev = state.current;
334
+ const prevRunId = state.currentRunId;
335
+ if (prev) {
336
+ yield* Fiber.interrupt(prev);
337
+ if (diagnostics !== "off") {
338
+ const observe2 = shouldObserveForRun(diagnostics, runSeq);
339
+ const tickScheduler = yield* Effect.service(TickSchedulerTag).pipe(Effect.orDie);
340
+ const tickSeq = observe2 ? tickScheduler.getTickSeq() : void 0;
341
+ yield* runWorkflowBoundary({
342
+ kind: "flow",
343
+ name: "workflow.cancel",
344
+ payload: { programId: program.programId, cancelled: prevRunId, by: runId },
345
+ meta: {
346
+ ...makeWorkflowRunBudgetMeta({
347
+ runId,
348
+ diagnostics,
349
+ observed: observe2
350
+ }),
351
+ ...tickSeq !== void 0 ? { tickSeq } : null,
352
+ policy: { disableObservers: !observe2 },
353
+ reason: "latest",
354
+ cancelledByRunId: runId,
355
+ cancelledRunId: prevRunId
356
+ },
357
+ effect: Effect.void
358
+ });
359
+ }
360
+ }
361
+ state.currentRunId = runId;
362
+ }
363
+ const observe = shouldObserveForRun(diagnostics, runSeq);
364
+ const policy = { disableObservers: !observe };
365
+ const runBudgetMeta = makeWorkflowRunBudgetMeta({
366
+ runId,
367
+ diagnostics,
368
+ observed: observe
369
+ });
370
+ const programEffect = Effect.gen(function* () {
371
+ const host = yield* Effect.service(HostSchedulerTag).pipe(Effect.orDie);
372
+ const tick = yield* Effect.service(TickSchedulerTag).pipe(Effect.orDie);
373
+ if (!program.steps) {
374
+ throw makeWorkflowError({
375
+ code: "WORKFLOW_INVALID_DEF",
376
+ message: `Workflow steps were not resolved before run (programId="${program.programId}").`,
377
+ programId: program.programId,
378
+ detail: { programId: program.programId }
379
+ });
380
+ }
381
+ const getTickSeq = () => observe ? tick.getTickSeq() : void 0;
382
+ const emitTimerEvents = observe && diagnostics === "full";
383
+ const evalPayload = (expr) => expr ? evalInputExpr(expr, args.payload) : void 0;
384
+ const defaultInputForCall = () => args.trigger.kind === "action" ? args.payload : void 0;
385
+ let timerTriggered = false;
386
+ const runSteps = (steps) => Effect.gen(function* () {
387
+ for (const step of steps) {
388
+ if (!canWriteBack()) return;
389
+ if (step.kind === "dispatch") {
390
+ const payload = evalPayload(step.payload);
391
+ const action = { _tag: step.actionTag, payload };
392
+ const tickSeq = getTickSeq();
393
+ const timerOriginOverride = timerTriggered ? {
394
+ kind: "workflow.timer",
395
+ name: `timer:${program.programId}:${step.key}`
396
+ } : void 0;
397
+ const internals = timerOriginOverride ? getRuntimeInternals(runtime) : void 0;
398
+ const dispatchEffectBase = program.priority === "nonUrgent" ? timerOriginOverride ? internals.txn.dispatchLowPriorityWithOriginOverride(action, timerOriginOverride) : runtime.dispatchLowPriority(action) : timerOriginOverride ? internals.txn.dispatchWithOriginOverride(action, timerOriginOverride) : runtime.dispatch(action);
399
+ yield* runWorkflowBoundary({
400
+ kind: "flow",
401
+ name: "workflow.dispatch",
402
+ payload: { actionTag: step.actionTag },
403
+ meta: {
404
+ runId,
405
+ ...runBudgetMeta,
406
+ stepKey: step.key,
407
+ ...tickSeq !== void 0 ? { tickSeq } : null,
408
+ policy
409
+ },
410
+ effect: dispatchEffectBase
411
+ }).pipe(Effect.asVoid);
412
+ continue;
413
+ }
414
+ if (step.kind === "delay") {
415
+ const timerId = emitTimerEvents ? `${runId}::timer:${step.key}` : void 0;
416
+ const recordTimerEvent = (name, patchMeta) => Effect.gen(function* () {
417
+ const tickSeq2 = getTickSeq();
418
+ yield* runWorkflowBoundary({
419
+ kind: "flow",
420
+ name,
421
+ payload: { ms: step.ms },
422
+ meta: {
423
+ runId,
424
+ ...runBudgetMeta,
425
+ stepKey: step.key,
426
+ ...timerId ? { timerId } : null,
427
+ ...tickSeq2 !== void 0 ? { tickSeq: tickSeq2 } : null,
428
+ policy,
429
+ ...patchMeta ?? null
430
+ },
431
+ effect: Effect.void
432
+ });
433
+ });
434
+ const schedule = emitTimerEvents ? recordTimerEvent("workflow.timer.schedule") : Effect.void;
435
+ const onCancel = emitTimerEvents ? recordTimerEvent("workflow.timer.cancel", { reason: "interrupt" }) : Effect.void;
436
+ const fired = emitTimerEvents ? recordTimerEvent("workflow.timer.fired") : Effect.void;
437
+ const delayEffect = schedule.pipe(
438
+ Effect.flatMap(() => makeTimer({ host, ms: step.ms, onCancel })),
439
+ Effect.flatMap(() => fired)
440
+ );
441
+ const tickSeq = getTickSeq();
442
+ yield* runWorkflowBoundary({
443
+ kind: "flow",
444
+ name: "workflow.delay",
445
+ payload: { ms: step.ms },
446
+ meta: {
447
+ runId,
448
+ ...runBudgetMeta,
449
+ stepKey: step.key,
450
+ ...tickSeq !== void 0 ? { tickSeq } : null,
451
+ ...timerId ? { timerId } : null,
452
+ policy
453
+ },
454
+ effect: delayEffect
455
+ }).pipe(Effect.asVoid);
456
+ timerTriggered = true;
457
+ continue;
458
+ }
459
+ const input = step.input ? evalInputExpr(step.input, args.payload) : defaultInputForCall();
460
+ const maxRetries = step.retryTimes ?? 0;
461
+ let exit;
462
+ for (let attempt = 1; attempt <= maxRetries + 1; attempt += 1) {
463
+ const tickSeq = getTickSeq();
464
+ const base = runWorkflowBoundary({
465
+ kind: "service",
466
+ name: `workflow.call:${step.serviceId}`,
467
+ payload: { serviceId: step.serviceId },
468
+ meta: {
469
+ runId,
470
+ ...runBudgetMeta,
471
+ stepKey: step.key,
472
+ serviceId: step.serviceId,
473
+ attempt,
474
+ ...tickSeq !== void 0 ? { tickSeq } : null,
475
+ policy
476
+ },
477
+ effect: step.port(input)
478
+ });
479
+ const withTimeout = step.timeoutMs === void 0 ? base : Effect.gen(function* () {
480
+ const timeoutMs = step.timeoutMs;
481
+ if (timeoutMs === void 0) {
482
+ return yield* base;
483
+ }
484
+ const timerId = emitTimerEvents ? `${runId}::timeout:${step.key}:a${attempt}` : void 0;
485
+ const recordTimeoutEvent = (name, patchMeta) => Effect.gen(function* () {
486
+ const tickSeq2 = getTickSeq();
487
+ yield* runWorkflowBoundary({
488
+ kind: "flow",
489
+ name,
490
+ payload: { ms: timeoutMs },
491
+ meta: {
492
+ runId,
493
+ ...runBudgetMeta,
494
+ stepKey: step.key,
495
+ attempt,
496
+ ...timerId ? { timerId } : null,
497
+ ...tickSeq2 !== void 0 ? { tickSeq: tickSeq2 } : null,
498
+ policy,
499
+ ...patchMeta ?? null
500
+ },
501
+ effect: Effect.void
502
+ });
503
+ });
504
+ const schedule = emitTimerEvents ? recordTimeoutEvent("workflow.timeout.schedule") : Effect.void;
505
+ const onCancel = emitTimerEvents ? recordTimeoutEvent("workflow.timeout.cancel", { reason: "interrupt" }) : Effect.void;
506
+ const fired = emitTimerEvents ? recordTimeoutEvent("workflow.timeout.fired") : Effect.void;
507
+ const timeoutError = makeWorkflowError({
508
+ code: "WORKFLOW_CALL_TIMEOUT",
509
+ message: `Workflow call timed out (serviceId="${step.serviceId}", timeoutMs=${timeoutMs}).`,
510
+ programId: program.programId,
511
+ source: { stepKey: step.key },
512
+ detail: { serviceId: step.serviceId, timeoutMs, attempt }
513
+ });
514
+ const timeoutFail = schedule.pipe(
515
+ Effect.flatMap(() => makeTimer({ host, ms: timeoutMs, onCancel })),
516
+ Effect.flatMap(() => fired),
517
+ Effect.flatMap(() => Effect.fail(timeoutError))
518
+ );
519
+ return yield* Effect.raceFirst(base, timeoutFail);
520
+ });
521
+ const attemptExit = yield* Effect.exit(withTimeout);
522
+ exit = attemptExit;
523
+ if (!canWriteBack() || Exit.isSuccess(attemptExit)) {
524
+ break;
525
+ }
526
+ if (Cause.hasInterruptsOnly(attemptExit.cause) || Option.isNone(Cause.findErrorOption(attemptExit.cause))) {
527
+ break;
528
+ }
529
+ if (attempt < maxRetries + 1) {
530
+ continue;
531
+ }
532
+ break;
533
+ }
534
+ if (!exit) {
535
+ exit = Exit.succeed(void 0);
536
+ }
537
+ if (!canWriteBack()) return;
538
+ if (Exit.isSuccess(exit)) {
539
+ yield* runSteps(step.onSuccess);
540
+ } else {
541
+ const failure = Option.getOrUndefined(Cause.findErrorOption(exit.cause));
542
+ const isTimeout = isObjectLike(failure) && failure._tag === "WorkflowError" && failure.code === "WORKFLOW_CALL_TIMEOUT";
543
+ if (isTimeout) timerTriggered = true;
544
+ yield* runSteps(step.onFailure);
545
+ }
546
+ }
547
+ });
548
+ const runTickSeq = getTickSeq();
549
+ yield* runWorkflowBoundary({
550
+ kind: "flow",
551
+ name: "workflow.run",
552
+ payload: { trigger: args.trigger },
553
+ meta: {
554
+ runId,
555
+ ...runBudgetMeta,
556
+ ...runTickSeq !== void 0 ? { tickSeq: runTickSeq } : null,
557
+ policy
558
+ },
559
+ effect: runSteps(program.steps)
560
+ }).pipe(Effect.asVoid);
561
+ });
562
+ const limited = registry.parallelLimiter ? registry.parallelLimiter.withPermits(1)(programEffect) : programEffect;
563
+ const runOutsideTransaction = Effect.provideService(limited.pipe(
564
+ Effect.catchCause((cause) => {
565
+ const { errorSummary, downgrade } = toSerializableErrorSummary(cause);
566
+ const downgradeHint = downgrade ? ` (downgrade=${downgrade})` : "";
567
+ return record({
568
+ type: "diagnostic",
569
+ moduleId: runtime.moduleId,
570
+ instanceId: runtime.instanceId,
571
+ code: "workflow::run_crashed",
572
+ severity: "error",
573
+ message: `Workflow run crashed for programId="${program.programId}" runId="${runId}".${downgradeHint}`,
574
+ hint: `${errorSummary.name ? `${errorSummary.name}: ` : ""}${errorSummary.message}`,
575
+ actionTag: args.trigger.kind === "action" ? args.trigger.actionTag : void 0,
576
+ kind: "workflow_run_crashed",
577
+ trigger: {
578
+ kind: "workflow",
579
+ name: "run",
580
+ details: {
581
+ programId: program.programId,
582
+ runId,
583
+ trigger: args.trigger
584
+ }
585
+ }
586
+ }).pipe(Effect.catchCause(() => Effect.void));
587
+ }),
588
+ Effect.ensuring(
589
+ Effect.sync(() => {
590
+ if (state.mode === "exhaust") {
591
+ state.busy = false;
592
+ }
593
+ })
594
+ )
595
+ ), inSyncTransactionFiber, false);
596
+ const fiber = yield* runOutsideTransaction.pipe(Effect.forkScoped({ startImmediately: true }));
597
+ if (state.mode === "latest") {
598
+ state.current = fiber;
599
+ }
600
+ });
601
+ var ensureRegistry = (runtime) => Effect.gen(function* () {
602
+ const existing = getRegistry(runtime);
603
+ if (existing) {
604
+ return {
605
+ moduleId: runtime.moduleId,
606
+ instanceId: runtime.instanceId,
607
+ registry: existing
608
+ };
609
+ }
610
+ const portsReady = yield* Deferred.make();
611
+ const next = {
612
+ byActionTag: /* @__PURE__ */ new Map(),
613
+ entries: [],
614
+ watcherStarted: false,
615
+ watcherStartCount: 0,
616
+ portsResolving: false,
617
+ portsReady,
618
+ parallelLimiter: void 0
619
+ };
620
+ Object.defineProperty(runtime, WORKFLOW_REGISTRY, {
621
+ value: next,
622
+ enumerable: false,
623
+ configurable: true,
624
+ writable: false
625
+ });
626
+ return { moduleId: runtime.moduleId, instanceId: runtime.instanceId, registry: next };
627
+ });
628
+ var registerPrograms = (args) => Effect.gen(function* () {
629
+ const runtime = yield* Effect.service(args.moduleTag).pipe(Effect.orDie);
630
+ const { moduleId, instanceId, registry } = yield* ensureRegistry(runtime);
631
+ if (registry.parallelLimiter === void 0) {
632
+ yield* ensureLimiterReady(registry, runtime);
633
+ }
634
+ const validateNoIoStepsForOnInit = (steps, programId) => {
635
+ const visit = (step) => {
636
+ if (step.kind === "call" || step.kind === "delay") {
637
+ throw makeWorkflowError({
638
+ code: "WORKFLOW_INVALID_TRIGGER",
639
+ message: "Lifecycle onInit programs must not include call/delay (initRequired must stay sync-only; use onStart for IO/time).",
640
+ programId,
641
+ source: { stepKey: step.key },
642
+ detail: { kind: step.kind }
643
+ });
644
+ }
645
+ };
646
+ for (const s of steps) visit(s);
647
+ };
648
+ const programHasCall = (steps) => steps.some((s) => s.kind === "call");
649
+ const insertEntry = (actionTag, entry) => {
650
+ const prev = registry.byActionTag.get(actionTag);
651
+ registry.byActionTag.set(actionTag, prev ? [...prev, entry] : [entry]);
652
+ };
653
+ const internals = getRuntimeInternals(runtime);
654
+ for (const program of args.programs) {
655
+ const def = program.def;
656
+ const localId = asNonEmptyString(def.localId);
657
+ if (!localId) {
658
+ throw makeWorkflowError({
659
+ code: "WORKFLOW_INVALID_DEF",
660
+ message: "Workflow.install: def.localId must be a non-empty string.",
661
+ detail: { localId: def.localId }
662
+ });
663
+ }
664
+ const programId = `${moduleId}.${localId}`;
665
+ const compiled = compileWorkflowRuntimeStepsV1({ def });
666
+ if (def.trigger.kind === "lifecycle" && def.trigger.phase === "onInit") {
667
+ validateNoIoStepsForOnInit(compiled, programId);
668
+ }
669
+ const compiledProgram = {
670
+ programId,
671
+ localId,
672
+ trigger: def.trigger,
673
+ concurrency: resolveConcurrency(def),
674
+ priority: resolvePriority(def),
675
+ compiledSteps: compiled
676
+ };
677
+ if (!programHasCall(compiled)) {
678
+ compiledProgram.steps = compileSteps(compiled, () => {
679
+ throw makeWorkflowError({
680
+ code: "WORKFLOW_MISSING_SERVICE",
681
+ message: "Internal error: unexpected call step while resolving call-less program.",
682
+ programId,
683
+ detail: { programId }
684
+ });
685
+ });
686
+ }
687
+ const state = compiledProgram.concurrency === "latest" ? { mode: "latest", runSeq: 0, current: void 0, currentRunId: void 0 } : compiledProgram.concurrency === "exhaust" ? { mode: "exhaust", runSeq: 0, busy: false } : { mode: "parallel", runSeq: 0 };
688
+ const entry = { program: compiledProgram, state };
689
+ registry.entries.push(entry);
690
+ if (def.trigger.kind === "action") {
691
+ insertEntry(def.trigger.actionTag, entry);
692
+ } else {
693
+ if (def.trigger.phase === "onStart") {
694
+ internals.lifecycle.registerStart(
695
+ withRootEnvIfAvailable(
696
+ Effect.gen(function* () {
697
+ const middlewareOpt = yield* Effect.serviceOption(EffectOpMiddlewareTag);
698
+ const middleware = Option.isSome(middlewareOpt) ? middlewareOpt.value : void 0;
699
+ yield* ensurePortsResolved(registry, runtime).pipe(Effect.orDie);
700
+ yield* startProgramRun({
701
+ entry,
702
+ runtime,
703
+ registry,
704
+ trigger: { kind: "lifecycle", phase: "onStart" },
705
+ payload: void 0,
706
+ middleware
707
+ });
708
+ })
709
+ ),
710
+ { name: `workflow:${localId}` }
711
+ );
712
+ } else {
713
+ internals.lifecycle.registerInitRequired(
714
+ Effect.gen(function* () {
715
+ const middlewareOpt = yield* Effect.serviceOption(EffectOpMiddlewareTag);
716
+ const middleware = Option.isSome(middlewareOpt) ? middlewareOpt.value : void 0;
717
+ yield* startProgramRun({
718
+ entry,
719
+ runtime,
720
+ registry,
721
+ trigger: { kind: "lifecycle", phase: "onInit" },
722
+ payload: void 0,
723
+ middleware
724
+ });
725
+ }),
726
+ { name: `workflow:${localId}` }
727
+ );
728
+ }
729
+ }
730
+ }
731
+ void instanceId;
732
+ });
733
+ var startWatcherIfNeeded = (args) => Effect.gen(function* () {
734
+ const runtime = yield* Effect.service(args.moduleTag).pipe(Effect.orDie);
735
+ const init = yield* ensureRegistry(runtime);
736
+ const registry = init.registry;
737
+ if (registry.watcherStarted) {
738
+ return;
739
+ }
740
+ registry.watcherStarted = true;
741
+ registry.watcherStartCount += 1;
742
+ const middlewareOpt = yield* Effect.serviceOption(EffectOpMiddlewareTag);
743
+ const middleware = Option.isSome(middlewareOpt) ? middlewareOpt.value : void 0;
744
+ const actions$ = runtime.actions$;
745
+ const portsExit = yield* Effect.exit(ensurePortsResolved(registry, runtime));
746
+ if (Exit.isFailure(portsExit)) {
747
+ const { errorSummary, downgrade } = toSerializableErrorSummary(portsExit.cause);
748
+ const downgradeHint = downgrade ? ` (downgrade=${downgrade})` : "";
749
+ yield* record({
750
+ type: "diagnostic",
751
+ moduleId: runtime.moduleId,
752
+ instanceId: runtime.instanceId,
753
+ code: "workflow::ports_resolution_failed",
754
+ severity: "error",
755
+ message: `Workflow ports resolution failed before starting watcher.${downgradeHint}`,
756
+ hint: `${errorSummary.name ? `${errorSummary.name}: ` : ""}${errorSummary.message}`,
757
+ kind: "workflow_ports_resolution_failed",
758
+ trigger: {
759
+ kind: "workflow",
760
+ name: "portsResolution",
761
+ details: {
762
+ entryLabel: args.entryLabel
763
+ }
764
+ }
765
+ });
766
+ return;
767
+ }
768
+ yield* Stream.runForEach(
769
+ actions$,
770
+ (action) => Effect.gen(function* () {
771
+ const actionTag = resolveActionTag(action);
772
+ if (!actionTag) return;
773
+ const entries = registry.byActionTag.get(actionTag);
774
+ if (!entries || entries.length === 0) return;
775
+ const payload = isRecord(action) ? action.payload : void 0;
776
+ yield* Effect.forEach(
777
+ entries,
778
+ (entry) => startProgramRun({
779
+ entry,
780
+ runtime,
781
+ registry,
782
+ trigger: { kind: "action", actionTag },
783
+ payload,
784
+ middleware
785
+ }),
786
+ { discard: true }
787
+ );
788
+ })
789
+ ).pipe(
790
+ (effect) => Effect.provideService(effect, inSyncTransactionFiber, false),
791
+ Effect.catchCause((cause) => {
792
+ const { errorSummary, downgrade } = toSerializableErrorSummary(cause);
793
+ const downgradeHint = downgrade ? ` (downgrade=${downgrade})` : "";
794
+ return record({
795
+ type: "diagnostic",
796
+ moduleId: runtime.moduleId,
797
+ instanceId: runtime.instanceId,
798
+ code: "workflow::watcher_crashed",
799
+ severity: "error",
800
+ message: `Workflow watcher crashed.${downgradeHint}`,
801
+ hint: `${errorSummary.name ? `${errorSummary.name}: ` : ""}${errorSummary.message}`,
802
+ kind: "workflow_watcher_crashed",
803
+ trigger: {
804
+ kind: "workflow",
805
+ name: "watcher",
806
+ details: {
807
+ entryLabel: args.entryLabel
808
+ }
809
+ }
810
+ });
811
+ })
812
+ );
813
+ void args.entryLabel;
814
+ });
815
+ var mountAll = (args) => {
816
+ const plan = {
817
+ setup: registerPrograms({ moduleTag: args.moduleTag, programs: args.programs, entryLabel: "mountAll" }),
818
+ run: startWatcherIfNeeded({ moduleTag: args.moduleTag, entryLabel: "mountAll" })
819
+ };
820
+ attachLogicUnitMeta(plan, {
821
+ id: "__logix_internal:workflows",
822
+ kind: "internal",
823
+ name: "workflows"
824
+ });
825
+ return plan;
826
+ };
827
+ var installOne = (args) => {
828
+ const localId = asNonEmptyString(args.program.def.localId) ?? "unknown";
829
+ const plan = {
830
+ setup: registerPrograms({ moduleTag: args.moduleTag, programs: [args.program], entryLabel: `install:${localId}` }),
831
+ run: startWatcherIfNeeded({ moduleTag: args.moduleTag, entryLabel: `install:${localId}` })
832
+ };
833
+ attachLogicUnitMeta(plan, {
834
+ id: `workflow:${localId}`,
835
+ kind: "workflow",
836
+ name: localId
837
+ });
838
+ return plan;
839
+ };
840
+
841
+ export {
842
+ mountAll,
843
+ installOne
844
+ };
845
+ //# sourceMappingURL=chunk-PD6YECQH.js.map