@logixjs/core 0.0.1

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 (345) hide show
  1. package/dist/Action-BkRHy2vg.d.cts +10 -0
  2. package/dist/Action-mqVvtEHt.d.ts +10 -0
  3. package/dist/Action.cjs +57 -0
  4. package/dist/Action.cjs.map +1 -0
  5. package/dist/Action.d.cts +2 -0
  6. package/dist/Action.d.ts +2 -0
  7. package/dist/Action.js +9 -0
  8. package/dist/Action.js.map +1 -0
  9. package/dist/Actions-AsQ07yTP.d.cts +22 -0
  10. package/dist/Actions-AsQ07yTP.d.ts +22 -0
  11. package/dist/Actions.cjs +19 -0
  12. package/dist/Actions.cjs.map +1 -0
  13. package/dist/Actions.d.cts +2 -0
  14. package/dist/Actions.d.ts +2 -0
  15. package/dist/Actions.js +2 -0
  16. package/dist/Actions.js.map +1 -0
  17. package/dist/Bound-BN1DQ_lM.d.ts +23 -0
  18. package/dist/Bound-BPIfH9SS.d.cts +23 -0
  19. package/dist/Bound.cjs +1532 -0
  20. package/dist/Bound.cjs.map +1 -0
  21. package/dist/Bound.d.cts +7 -0
  22. package/dist/Bound.d.ts +7 -0
  23. package/dist/Bound.js +25 -0
  24. package/dist/Bound.js.map +1 -0
  25. package/dist/Debug-B5q5Bkzx.d.ts +320 -0
  26. package/dist/Debug-Bq8Sqjcr.d.cts +320 -0
  27. package/dist/Debug.cjs +1821 -0
  28. package/dist/Debug.cjs.map +1 -0
  29. package/dist/Debug.d.cts +13 -0
  30. package/dist/Debug.d.ts +13 -0
  31. package/dist/Debug.js +76 -0
  32. package/dist/Debug.js.map +1 -0
  33. package/dist/EffectOp.cjs +169 -0
  34. package/dist/EffectOp.cjs.map +1 -0
  35. package/dist/EffectOp.d.cts +118 -0
  36. package/dist/EffectOp.d.ts +118 -0
  37. package/dist/EffectOp.js +28 -0
  38. package/dist/EffectOp.js.map +1 -0
  39. package/dist/Env-DuJ6JrU2.d.cts +10 -0
  40. package/dist/Env-DuJ6JrU2.d.ts +10 -0
  41. package/dist/Env.cjs +60 -0
  42. package/dist/Env.cjs.map +1 -0
  43. package/dist/Env.d.cts +1 -0
  44. package/dist/Env.d.ts +1 -0
  45. package/dist/Env.js +11 -0
  46. package/dist/Env.js.map +1 -0
  47. package/dist/Flow-1fZT8MpX.d.cts +152 -0
  48. package/dist/Flow-BhpjE22E.d.ts +152 -0
  49. package/dist/Flow.cjs +504 -0
  50. package/dist/Flow.cjs.map +1 -0
  51. package/dist/Flow.d.cts +8 -0
  52. package/dist/Flow.d.ts +8 -0
  53. package/dist/Flow.js +15 -0
  54. package/dist/Flow.js.map +1 -0
  55. package/dist/Handle-D8D1zPb_.d.cts +30 -0
  56. package/dist/Handle-D_cLW1Z3.d.ts +30 -0
  57. package/dist/Handle.cjs +42 -0
  58. package/dist/Handle.cjs.map +1 -0
  59. package/dist/Handle.d.cts +7 -0
  60. package/dist/Handle.d.ts +7 -0
  61. package/dist/Handle.js +10 -0
  62. package/dist/Handle.js.map +1 -0
  63. package/dist/Kernel-8kC-jOda.d.cts +171 -0
  64. package/dist/Kernel-CnGE1Fyk.d.ts +171 -0
  65. package/dist/Kernel.cjs +284 -0
  66. package/dist/Kernel.cjs.map +1 -0
  67. package/dist/Kernel.d.cts +14 -0
  68. package/dist/Kernel.d.ts +14 -0
  69. package/dist/Kernel.js +36 -0
  70. package/dist/Kernel.js.map +1 -0
  71. package/dist/Link-Db7975nU.d.ts +45 -0
  72. package/dist/Link-fX8x1eCK.d.cts +45 -0
  73. package/dist/Link.cjs +542 -0
  74. package/dist/Link.cjs.map +1 -0
  75. package/dist/Link.d.cts +7 -0
  76. package/dist/Link.d.ts +7 -0
  77. package/dist/Link.js +35 -0
  78. package/dist/Link.js.map +1 -0
  79. package/dist/Logic-BRjEMr-W.d.ts +38 -0
  80. package/dist/Logic-DRh4sDZj.d.cts +38 -0
  81. package/dist/Logic.cjs +37 -0
  82. package/dist/Logic.cjs.map +1 -0
  83. package/dist/Logic.d.cts +7 -0
  84. package/dist/Logic.d.ts +7 -0
  85. package/dist/Logic.js +10 -0
  86. package/dist/Logic.js.map +1 -0
  87. package/dist/MatchBuilder-0QOc-nlU.d.ts +14 -0
  88. package/dist/MatchBuilder-CJk5oCkR.d.cts +14 -0
  89. package/dist/MatchBuilder.cjs +85 -0
  90. package/dist/MatchBuilder.cjs.map +1 -0
  91. package/dist/MatchBuilder.d.cts +8 -0
  92. package/dist/MatchBuilder.d.ts +8 -0
  93. package/dist/MatchBuilder.js +11 -0
  94. package/dist/MatchBuilder.js.map +1 -0
  95. package/dist/Middleware.cjs +411 -0
  96. package/dist/Middleware.cjs.map +1 -0
  97. package/dist/Middleware.d.cts +88 -0
  98. package/dist/Middleware.d.ts +88 -0
  99. package/dist/Middleware.js +27 -0
  100. package/dist/Middleware.js.map +1 -0
  101. package/dist/Module-B_0xRDMR.d.cts +203 -0
  102. package/dist/Module-DnzluX2J.d.ts +203 -0
  103. package/dist/Module.cjs +13512 -0
  104. package/dist/Module.cjs.map +1 -0
  105. package/dist/Module.d.cts +8 -0
  106. package/dist/Module.d.ts +8 -0
  107. package/dist/Module.js +53 -0
  108. package/dist/Module.js.map +1 -0
  109. package/dist/ModuleTag-C8FHY_sY.d.ts +93 -0
  110. package/dist/ModuleTag-EGbgBMpZ.d.cts +93 -0
  111. package/dist/ModuleTag.cjs +12231 -0
  112. package/dist/ModuleTag.cjs.map +1 -0
  113. package/dist/ModuleTag.d.cts +8 -0
  114. package/dist/ModuleTag.d.ts +8 -0
  115. package/dist/ModuleTag.js +39 -0
  116. package/dist/ModuleTag.js.map +1 -0
  117. package/dist/Observability-COqEvp2C.d.cts +713 -0
  118. package/dist/Observability-cY4kLn0S.d.ts +713 -0
  119. package/dist/Observability.cjs +5865 -0
  120. package/dist/Observability.cjs.map +1 -0
  121. package/dist/Observability.d.cts +9 -0
  122. package/dist/Observability.d.ts +9 -0
  123. package/dist/Observability.js +41 -0
  124. package/dist/Observability.js.map +1 -0
  125. package/dist/Platform-C49Pv956.d.cts +21 -0
  126. package/dist/Platform-C49Pv956.d.ts +21 -0
  127. package/dist/Platform-CHX8o-U4.d.ts +51 -0
  128. package/dist/Platform-CVlv0xLQ.d.cts +51 -0
  129. package/dist/Platform.cjs +58 -0
  130. package/dist/Platform.cjs.map +1 -0
  131. package/dist/Platform.d.cts +4 -0
  132. package/dist/Platform.d.ts +4 -0
  133. package/dist/Platform.js +15 -0
  134. package/dist/Platform.js.map +1 -0
  135. package/dist/Process-CM9xbMdP.d.ts +92 -0
  136. package/dist/Process-mL8fHDSB.d.cts +92 -0
  137. package/dist/Process.cjs +575 -0
  138. package/dist/Process.cjs.map +1 -0
  139. package/dist/Process.d.cts +8 -0
  140. package/dist/Process.d.ts +8 -0
  141. package/dist/Process.js +42 -0
  142. package/dist/Process.js.map +1 -0
  143. package/dist/ReadQuery-BlMwhe-F.d.ts +30 -0
  144. package/dist/ReadQuery-CL5XlXts.d.cts +30 -0
  145. package/dist/ReadQuery-SinbStGF.d.cts +38 -0
  146. package/dist/ReadQuery-SinbStGF.d.ts +38 -0
  147. package/dist/ReadQuery.cjs +377 -0
  148. package/dist/ReadQuery.cjs.map +1 -0
  149. package/dist/ReadQuery.d.cts +2 -0
  150. package/dist/ReadQuery.d.ts +2 -0
  151. package/dist/ReadQuery.js +14 -0
  152. package/dist/ReadQuery.js.map +1 -0
  153. package/dist/Reflection-CQnKwPXj.d.ts +182 -0
  154. package/dist/Reflection-Kabo1mlU.d.cts +182 -0
  155. package/dist/Reflection.cjs +2954 -0
  156. package/dist/Reflection.cjs.map +1 -0
  157. package/dist/Reflection.d.cts +17 -0
  158. package/dist/Reflection.d.ts +17 -0
  159. package/dist/Reflection.js +40 -0
  160. package/dist/Reflection.js.map +1 -0
  161. package/dist/Resource-Dy1xD_DG.d.cts +75 -0
  162. package/dist/Resource-Dy1xD_DG.d.ts +75 -0
  163. package/dist/Resource.cjs +166 -0
  164. package/dist/Resource.cjs.map +1 -0
  165. package/dist/Resource.d.cts +3 -0
  166. package/dist/Resource.d.ts +3 -0
  167. package/dist/Resource.js +21 -0
  168. package/dist/Resource.js.map +1 -0
  169. package/dist/Root-7ADUMk4t.d.cts +29 -0
  170. package/dist/Root-7ADUMk4t.d.ts +29 -0
  171. package/dist/Root.cjs +125 -0
  172. package/dist/Root.cjs.map +1 -0
  173. package/dist/Root.d.cts +4 -0
  174. package/dist/Root.d.ts +4 -0
  175. package/dist/Root.js +12 -0
  176. package/dist/Root.js.map +1 -0
  177. package/dist/Runtime-B-aL-f29.d.cts +274 -0
  178. package/dist/Runtime-CtyzZG4i.d.ts +274 -0
  179. package/dist/Runtime.cjs +5740 -0
  180. package/dist/Runtime.cjs.map +1 -0
  181. package/dist/Runtime.d.cts +19 -0
  182. package/dist/Runtime.d.ts +19 -0
  183. package/dist/Runtime.js +62 -0
  184. package/dist/Runtime.js.map +1 -0
  185. package/dist/ScopeRegistry-D1owDNSm.d.cts +61 -0
  186. package/dist/ScopeRegistry-D1owDNSm.d.ts +61 -0
  187. package/dist/ScopeRegistry.cjs +152 -0
  188. package/dist/ScopeRegistry.cjs.map +1 -0
  189. package/dist/ScopeRegistry.d.cts +2 -0
  190. package/dist/ScopeRegistry.d.ts +2 -0
  191. package/dist/ScopeRegistry.js +16 -0
  192. package/dist/ScopeRegistry.js.map +1 -0
  193. package/dist/State-CU50R26M.d.cts +19 -0
  194. package/dist/State-CU50R26M.d.ts +19 -0
  195. package/dist/State.cjs +19 -0
  196. package/dist/State.cjs.map +1 -0
  197. package/dist/State.d.cts +2 -0
  198. package/dist/State.d.ts +2 -0
  199. package/dist/State.js +2 -0
  200. package/dist/State.js.map +1 -0
  201. package/dist/StateTrait-BGsZghTz.d.ts +122 -0
  202. package/dist/StateTrait-OWhbj12c.d.cts +122 -0
  203. package/dist/StateTrait.cjs +2737 -0
  204. package/dist/StateTrait.cjs.map +1 -0
  205. package/dist/StateTrait.d.cts +9 -0
  206. package/dist/StateTrait.d.ts +9 -0
  207. package/dist/StateTrait.js +39 -0
  208. package/dist/StateTrait.js.map +1 -0
  209. package/dist/TraitLifecycle-CwV5WPFX.d.cts +88 -0
  210. package/dist/TraitLifecycle-LdIWmKlg.d.ts +88 -0
  211. package/dist/TraitLifecycle.cjs +581 -0
  212. package/dist/TraitLifecycle.cjs.map +1 -0
  213. package/dist/TraitLifecycle.d.cts +8 -0
  214. package/dist/TraitLifecycle.d.ts +8 -0
  215. package/dist/TraitLifecycle.js +24 -0
  216. package/dist/TraitLifecycle.js.map +1 -0
  217. package/dist/action-DiMDD_0v.d.cts +35 -0
  218. package/dist/action-DiMDD_0v.d.ts +35 -0
  219. package/dist/chunk-24VULZ7A.js +76 -0
  220. package/dist/chunk-24VULZ7A.js.map +1 -0
  221. package/dist/chunk-3IYZ5IGG.js +17 -0
  222. package/dist/chunk-3IYZ5IGG.js.map +1 -0
  223. package/dist/chunk-3QMIVH35.js +43 -0
  224. package/dist/chunk-3QMIVH35.js.map +1 -0
  225. package/dist/chunk-3RMKLXHX.js +83 -0
  226. package/dist/chunk-3RMKLXHX.js.map +1 -0
  227. package/dist/chunk-3TMODYZV.js +111 -0
  228. package/dist/chunk-3TMODYZV.js.map +1 -0
  229. package/dist/chunk-3VG5TWQR.js +27 -0
  230. package/dist/chunk-3VG5TWQR.js.map +1 -0
  231. package/dist/chunk-4CQAV7YB.js +37 -0
  232. package/dist/chunk-4CQAV7YB.js.map +1 -0
  233. package/dist/chunk-4SO6JMZL.js +7 -0
  234. package/dist/chunk-4SO6JMZL.js.map +1 -0
  235. package/dist/chunk-66ALHVEX.js +40 -0
  236. package/dist/chunk-66ALHVEX.js.map +1 -0
  237. package/dist/chunk-76WT3HOR.js +397 -0
  238. package/dist/chunk-76WT3HOR.js.map +1 -0
  239. package/dist/chunk-ANLBCBDC.js +285 -0
  240. package/dist/chunk-ANLBCBDC.js.map +1 -0
  241. package/dist/chunk-AUIR5O6W.js +75 -0
  242. package/dist/chunk-AUIR5O6W.js.map +1 -0
  243. package/dist/chunk-BABLDP24.js +445 -0
  244. package/dist/chunk-BABLDP24.js.map +1 -0
  245. package/dist/chunk-BE3HW4FY.js +1099 -0
  246. package/dist/chunk-BE3HW4FY.js.map +1 -0
  247. package/dist/chunk-BZ2SHDN2.js +54 -0
  248. package/dist/chunk-BZ2SHDN2.js.map +1 -0
  249. package/dist/chunk-CW6T36TN.js +393 -0
  250. package/dist/chunk-CW6T36TN.js.map +1 -0
  251. package/dist/chunk-DFNM3WX2.js +632 -0
  252. package/dist/chunk-DFNM3WX2.js.map +1 -0
  253. package/dist/chunk-DMBALCE2.js +1034 -0
  254. package/dist/chunk-DMBALCE2.js.map +1 -0
  255. package/dist/chunk-EGK3KN7B.js +406 -0
  256. package/dist/chunk-EGK3KN7B.js.map +1 -0
  257. package/dist/chunk-EY4NZKDR.js +19 -0
  258. package/dist/chunk-EY4NZKDR.js.map +1 -0
  259. package/dist/chunk-G5ZBFPNU.js +23 -0
  260. package/dist/chunk-G5ZBFPNU.js.map +1 -0
  261. package/dist/chunk-GMPEOUP2.js +31 -0
  262. package/dist/chunk-GMPEOUP2.js.map +1 -0
  263. package/dist/chunk-IHVBV5C2.js +279 -0
  264. package/dist/chunk-IHVBV5C2.js.map +1 -0
  265. package/dist/chunk-IPF7E66P.js +23 -0
  266. package/dist/chunk-IPF7E66P.js.map +1 -0
  267. package/dist/chunk-JCXGZRMU.js +204 -0
  268. package/dist/chunk-JCXGZRMU.js.map +1 -0
  269. package/dist/chunk-JGIWG6SR.js +6359 -0
  270. package/dist/chunk-JGIWG6SR.js.map +1 -0
  271. package/dist/chunk-JWOYLO27.js +241 -0
  272. package/dist/chunk-JWOYLO27.js.map +1 -0
  273. package/dist/chunk-KIXAU3GM.js +137 -0
  274. package/dist/chunk-KIXAU3GM.js.map +1 -0
  275. package/dist/chunk-KL5ACTCT.js +8 -0
  276. package/dist/chunk-KL5ACTCT.js.map +1 -0
  277. package/dist/chunk-KP7MUZNX.js +83 -0
  278. package/dist/chunk-KP7MUZNX.js.map +1 -0
  279. package/dist/chunk-LEU6UA5J.js +1 -0
  280. package/dist/chunk-LEU6UA5J.js.map +1 -0
  281. package/dist/chunk-M2RGJPXX.js +35 -0
  282. package/dist/chunk-M2RGJPXX.js.map +1 -0
  283. package/dist/chunk-M3BFQ7HK.js +13 -0
  284. package/dist/chunk-M3BFQ7HK.js.map +1 -0
  285. package/dist/chunk-M3WTHJHJ.js +1051 -0
  286. package/dist/chunk-M3WTHJHJ.js.map +1 -0
  287. package/dist/chunk-M7IYCTJV.js +79 -0
  288. package/dist/chunk-M7IYCTJV.js.map +1 -0
  289. package/dist/chunk-NBD3KUOZ.js +838 -0
  290. package/dist/chunk-NBD3KUOZ.js.map +1 -0
  291. package/dist/chunk-NQZ2OSGR.js +151 -0
  292. package/dist/chunk-NQZ2OSGR.js.map +1 -0
  293. package/dist/chunk-NZJKFF45.js +106 -0
  294. package/dist/chunk-NZJKFF45.js.map +1 -0
  295. package/dist/chunk-OFADUJWJ.js +175 -0
  296. package/dist/chunk-OFADUJWJ.js.map +1 -0
  297. package/dist/chunk-OGWBVHB3.js +461 -0
  298. package/dist/chunk-OGWBVHB3.js.map +1 -0
  299. package/dist/chunk-PAYXCY6A.js +1696 -0
  300. package/dist/chunk-PAYXCY6A.js.map +1 -0
  301. package/dist/chunk-PYOE4VSI.js +1924 -0
  302. package/dist/chunk-PYOE4VSI.js.map +1 -0
  303. package/dist/chunk-PZ5AY32C.js +10 -0
  304. package/dist/chunk-PZ5AY32C.js.map +1 -0
  305. package/dist/chunk-QCHIQWAJ.js +21 -0
  306. package/dist/chunk-QCHIQWAJ.js.map +1 -0
  307. package/dist/chunk-QMM6O4CD.js +71 -0
  308. package/dist/chunk-QMM6O4CD.js.map +1 -0
  309. package/dist/chunk-RNFE3ML2.js +22 -0
  310. package/dist/chunk-RNFE3ML2.js.map +1 -0
  311. package/dist/chunk-TAAPQVZN.js +23 -0
  312. package/dist/chunk-TAAPQVZN.js.map +1 -0
  313. package/dist/chunk-THATMZXD.js +21 -0
  314. package/dist/chunk-THATMZXD.js.map +1 -0
  315. package/dist/chunk-TKZ7MEIA.js +27 -0
  316. package/dist/chunk-TKZ7MEIA.js.map +1 -0
  317. package/dist/chunk-TQOBJYDP.js +7 -0
  318. package/dist/chunk-TQOBJYDP.js.map +1 -0
  319. package/dist/chunk-VZB726PE.js +93 -0
  320. package/dist/chunk-VZB726PE.js.map +1 -0
  321. package/dist/chunk-W3TEWHLO.js +568 -0
  322. package/dist/chunk-W3TEWHLO.js.map +1 -0
  323. package/dist/chunk-YS3AZQ2G.js +52 -0
  324. package/dist/chunk-YS3AZQ2G.js.map +1 -0
  325. package/dist/chunk-ZDTRWK5F.js +40 -0
  326. package/dist/chunk-ZDTRWK5F.js.map +1 -0
  327. package/dist/chunk-ZFLHVFUC.js +192 -0
  328. package/dist/chunk-ZFLHVFUC.js.map +1 -0
  329. package/dist/chunk-ZFY7U2FR.js +133 -0
  330. package/dist/chunk-ZFY7U2FR.js.map +1 -0
  331. package/dist/chunk-ZGDVUPTM.js +270 -0
  332. package/dist/chunk-ZGDVUPTM.js.map +1 -0
  333. package/dist/index.cjs +19700 -0
  334. package/dist/index.cjs.map +1 -0
  335. package/dist/index.d.cts +195 -0
  336. package/dist/index.d.ts +195 -0
  337. package/dist/index.js +286 -0
  338. package/dist/index.js.map +1 -0
  339. package/dist/ir-BMP7yxJJ.d.cts +39 -0
  340. package/dist/ir-DUOz6H-5.d.ts +39 -0
  341. package/dist/module-B8CBqIZ_.d.cts +1191 -0
  342. package/dist/module-k7m3txak.d.ts +1191 -0
  343. package/dist/protocol-g_1897M2.d.cts +127 -0
  344. package/dist/protocol-g_1897M2.d.ts +127 -0
  345. package/package.json +162 -0
@@ -0,0 +1,838 @@
1
+ import {
2
+ layer as layer2
3
+ } from "./chunk-3TMODYZV.js";
4
+ import {
5
+ withDebug
6
+ } from "./chunk-QMM6O4CD.js";
7
+ import {
8
+ getRuntimeByModuleAndInstance,
9
+ normalizeBoolean,
10
+ normalizeNonNegativeNumber,
11
+ normalizePositiveInt,
12
+ normalizePositiveNumber
13
+ } from "./chunk-JGIWG6SR.js";
14
+ import {
15
+ BootError,
16
+ DisposeError,
17
+ DisposeTimeoutError,
18
+ MainError,
19
+ closeProgramScope,
20
+ installGracefulShutdownHandlers,
21
+ makeApp,
22
+ makeProgramRunnerKernel,
23
+ provide
24
+ } from "./chunk-EGK3KN7B.js";
25
+ import {
26
+ make
27
+ } from "./chunk-BE3HW4FY.js";
28
+ import {
29
+ inSyncTransactionFiber,
30
+ isInSyncTransaction
31
+ } from "./chunk-ZFLHVFUC.js";
32
+ import {
33
+ devtoolsHubLayer,
34
+ layer,
35
+ runtimeLabel
36
+ } from "./chunk-W3TEWHLO.js";
37
+ import {
38
+ getRuntimeInternals
39
+ } from "./chunk-3RMKLXHX.js";
40
+ import {
41
+ ConcurrencyPolicyOverridesTag,
42
+ ConcurrencyPolicyTag,
43
+ StateTransactionConfigTag,
44
+ StateTransactionOverridesTag,
45
+ isDevEnv
46
+ } from "./chunk-3QMIVH35.js";
47
+ import {
48
+ runSessionLayer
49
+ } from "./chunk-OFADUJWJ.js";
50
+ import {
51
+ EffectOpMiddlewareTag
52
+ } from "./chunk-JWOYLO27.js";
53
+ import {
54
+ __export
55
+ } from "./chunk-PZ5AY32C.js";
56
+
57
+ // src/Runtime.ts
58
+ var Runtime_exports = {};
59
+ __export(Runtime_exports, {
60
+ BootError: () => BootError,
61
+ DisposeError: () => DisposeError,
62
+ DisposeTimeoutError: () => DisposeTimeoutError,
63
+ MainError: () => MainError,
64
+ applyTransactionSnapshot: () => applyTransactionSnapshot,
65
+ concurrencyPolicyOverridesLayer: () => concurrencyPolicyOverridesLayer,
66
+ make: () => make2,
67
+ openProgram: () => openProgram2,
68
+ runProgram: () => runProgram2,
69
+ setConcurrencyPolicyOverride: () => setConcurrencyPolicyOverride,
70
+ setTraitConvergeOverride: () => setTraitConvergeOverride,
71
+ stateTransactionOverridesLayer: () => stateTransactionOverridesLayer
72
+ });
73
+ import { Effect as Effect2, Layer, Option as Option2 } from "effect";
74
+
75
+ // src/internal/runtime/core/configValidation.ts
76
+ import { Schema } from "effect";
77
+ var PositiveIntSchema = Schema.Int.pipe(Schema.positive());
78
+ var PositiveNumberSchema = Schema.Number.pipe(Schema.positive());
79
+ var ConvergeModeSchema = Schema.Union(Schema.Literal("auto"), Schema.Literal("full"), Schema.Literal("dirty"));
80
+ var InstrumentationSchema = Schema.Union(Schema.Literal("full"), Schema.Literal("light"));
81
+ var ConcurrencyLimitSchema = Schema.Union(Schema.Literal("unbounded"), PositiveIntSchema);
82
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
83
+ var warnDevOnly = (label, issues) => {
84
+ if (!isDevEnv()) return;
85
+ if (issues.length === 0) return;
86
+ console.warn(
87
+ ["[Logix] Invalid runtime config detected.", `context: ${label}`, "issues:"].concat(issues.map((i) => `- ${i}`)).join("\n")
88
+ );
89
+ };
90
+ var collectUnknownKeys = (obj, allowed, prefix) => {
91
+ const issues = [];
92
+ for (const key of Object.keys(obj)) {
93
+ if (!allowed.has(key)) {
94
+ issues.push(`${prefix}${key}: unknown key`);
95
+ }
96
+ }
97
+ return issues;
98
+ };
99
+ var validateConcurrencyPolicyPatch = (obj, prefix) => {
100
+ const issues = [];
101
+ if ("concurrencyLimit" in obj && obj.concurrencyLimit != null) {
102
+ if (!Schema.is(ConcurrencyLimitSchema)(obj.concurrencyLimit)) {
103
+ issues.push(`${prefix}concurrencyLimit: expected positive int | "unbounded"`);
104
+ }
105
+ }
106
+ if ("losslessBackpressureCapacity" in obj && obj.losslessBackpressureCapacity != null) {
107
+ if (normalizePositiveInt(obj.losslessBackpressureCapacity) == null) {
108
+ issues.push(`${prefix}losslessBackpressureCapacity: expected positive int`);
109
+ }
110
+ }
111
+ if ("allowUnbounded" in obj && obj.allowUnbounded != null) {
112
+ if (normalizeBoolean(obj.allowUnbounded) == null) {
113
+ issues.push(`${prefix}allowUnbounded: expected boolean`);
114
+ }
115
+ }
116
+ if ("pressureWarningThreshold" in obj && obj.pressureWarningThreshold != null) {
117
+ const threshold = obj.pressureWarningThreshold;
118
+ if (!isRecord(threshold)) {
119
+ issues.push(`${prefix}pressureWarningThreshold: expected object`);
120
+ } else {
121
+ const backlogCount = threshold["backlogCount"];
122
+ if (backlogCount != null) {
123
+ if (normalizePositiveInt(backlogCount) == null) {
124
+ issues.push(`${prefix}pressureWarningThreshold.backlogCount: expected positive int`);
125
+ }
126
+ }
127
+ const backlogDurationMs = threshold["backlogDurationMs"];
128
+ if (backlogDurationMs != null) {
129
+ if (normalizePositiveNumber(backlogDurationMs) == null) {
130
+ issues.push(`${prefix}pressureWarningThreshold.backlogDurationMs: expected positive number`);
131
+ }
132
+ }
133
+ }
134
+ }
135
+ if ("warningCooldownMs" in obj && obj.warningCooldownMs != null) {
136
+ if (normalizePositiveNumber(obj.warningCooldownMs) == null) {
137
+ issues.push(`${prefix}warningCooldownMs: expected positive number`);
138
+ }
139
+ }
140
+ return issues;
141
+ };
142
+ var warnInvalidConcurrencyPolicyDevOnly = (value, label) => {
143
+ if (!isDevEnv()) return;
144
+ if (value == null) return;
145
+ if (!isRecord(value)) {
146
+ warnDevOnly(label, ["expected object"]);
147
+ return;
148
+ }
149
+ const policy = value;
150
+ const issues = [];
151
+ issues.push(
152
+ ...collectUnknownKeys(
153
+ policy,
154
+ /* @__PURE__ */ new Set([
155
+ "concurrencyLimit",
156
+ "losslessBackpressureCapacity",
157
+ "allowUnbounded",
158
+ "pressureWarningThreshold",
159
+ "warningCooldownMs",
160
+ "overridesByModuleId"
161
+ ]),
162
+ ""
163
+ )
164
+ );
165
+ issues.push(...validateConcurrencyPolicyPatch(policy, ""));
166
+ const overridesByModuleId = policy.overridesByModuleId;
167
+ if (overridesByModuleId != null) {
168
+ if (!isRecord(overridesByModuleId)) {
169
+ issues.push(`overridesByModuleId: expected record`);
170
+ } else {
171
+ for (const [moduleId, patch] of Object.entries(overridesByModuleId)) {
172
+ const prefix = `overridesByModuleId.${moduleId}.`;
173
+ if (patch == null) continue;
174
+ if (!isRecord(patch)) {
175
+ issues.push(`${prefix}<value>: expected object`);
176
+ continue;
177
+ }
178
+ issues.push(
179
+ ...collectUnknownKeys(
180
+ patch,
181
+ /* @__PURE__ */ new Set([
182
+ "concurrencyLimit",
183
+ "losslessBackpressureCapacity",
184
+ "allowUnbounded",
185
+ "pressureWarningThreshold",
186
+ "warningCooldownMs"
187
+ ]),
188
+ prefix
189
+ )
190
+ );
191
+ issues.push(...validateConcurrencyPolicyPatch(patch, prefix));
192
+ }
193
+ }
194
+ }
195
+ warnDevOnly(label, issues);
196
+ };
197
+ var warnInvalidConcurrencyPolicyPatchDevOnly = (value, label) => {
198
+ if (!isDevEnv()) return;
199
+ if (value == null) return;
200
+ if (!isRecord(value)) {
201
+ warnDevOnly(label, ["expected object"]);
202
+ return;
203
+ }
204
+ const issues = [];
205
+ issues.push(
206
+ ...collectUnknownKeys(
207
+ value,
208
+ /* @__PURE__ */ new Set([
209
+ "concurrencyLimit",
210
+ "losslessBackpressureCapacity",
211
+ "allowUnbounded",
212
+ "pressureWarningThreshold",
213
+ "warningCooldownMs"
214
+ ]),
215
+ ""
216
+ )
217
+ );
218
+ issues.push(...validateConcurrencyPolicyPatch(value, ""));
219
+ warnDevOnly(label, issues);
220
+ };
221
+ var validateStateTransactionTraitOverrides = (obj, prefix) => {
222
+ const issues = [];
223
+ if ("traitConvergeMode" in obj && obj.traitConvergeMode != null) {
224
+ if (!Schema.is(ConvergeModeSchema)(obj.traitConvergeMode)) {
225
+ issues.push(`${prefix}traitConvergeMode: expected "auto" | "full" | "dirty"`);
226
+ }
227
+ }
228
+ if ("traitConvergeBudgetMs" in obj && obj.traitConvergeBudgetMs != null) {
229
+ if (normalizePositiveNumber(obj.traitConvergeBudgetMs) == null) {
230
+ issues.push(`${prefix}traitConvergeBudgetMs: expected positive number`);
231
+ }
232
+ }
233
+ if ("traitConvergeDecisionBudgetMs" in obj && obj.traitConvergeDecisionBudgetMs != null) {
234
+ if (normalizePositiveNumber(obj.traitConvergeDecisionBudgetMs) == null) {
235
+ issues.push(`${prefix}traitConvergeDecisionBudgetMs: expected positive number`);
236
+ }
237
+ }
238
+ if ("traitConvergeTimeSlicing" in obj && obj.traitConvergeTimeSlicing != null) {
239
+ const timeSlicing = obj.traitConvergeTimeSlicing;
240
+ if (!isRecord(timeSlicing)) {
241
+ issues.push(`${prefix}traitConvergeTimeSlicing: expected object`);
242
+ } else {
243
+ const tsPrefix = `${prefix}traitConvergeTimeSlicing.`;
244
+ issues.push(...collectUnknownKeys(timeSlicing, /* @__PURE__ */ new Set(["enabled", "debounceMs", "maxLagMs"]), tsPrefix));
245
+ if ("enabled" in timeSlicing && timeSlicing.enabled != null) {
246
+ if (typeof timeSlicing.enabled !== "boolean") {
247
+ issues.push(`${tsPrefix}enabled: expected boolean`);
248
+ }
249
+ }
250
+ if ("debounceMs" in timeSlicing && timeSlicing.debounceMs != null) {
251
+ if (normalizePositiveNumber(timeSlicing.debounceMs) == null) {
252
+ issues.push(`${tsPrefix}debounceMs: expected positive number`);
253
+ }
254
+ }
255
+ if ("maxLagMs" in timeSlicing && timeSlicing.maxLagMs != null) {
256
+ if (normalizePositiveNumber(timeSlicing.maxLagMs) == null) {
257
+ issues.push(`${tsPrefix}maxLagMs: expected positive number`);
258
+ }
259
+ }
260
+ }
261
+ }
262
+ return issues;
263
+ };
264
+ var validateTxnLanesPatch = (obj, prefix) => {
265
+ const issues = [];
266
+ if ("enabled" in obj && obj.enabled != null) {
267
+ if (normalizeBoolean(obj.enabled) == null) {
268
+ issues.push(`${prefix}enabled: expected boolean`);
269
+ }
270
+ }
271
+ if ("overrideMode" in obj && obj.overrideMode != null) {
272
+ const raw = obj.overrideMode;
273
+ if (typeof raw !== "string" || raw !== "forced_off" && raw !== "forced_sync") {
274
+ issues.push(`${prefix}overrideMode: expected "forced_off" | "forced_sync"`);
275
+ }
276
+ }
277
+ if ("budgetMs" in obj && obj.budgetMs != null) {
278
+ if (normalizeNonNegativeNumber(obj.budgetMs) == null) {
279
+ issues.push(`${prefix}budgetMs: expected non-negative number`);
280
+ }
281
+ }
282
+ if ("debounceMs" in obj && obj.debounceMs != null) {
283
+ if (normalizeNonNegativeNumber(obj.debounceMs) == null) {
284
+ issues.push(`${prefix}debounceMs: expected non-negative number`);
285
+ }
286
+ }
287
+ if ("maxLagMs" in obj && obj.maxLagMs != null) {
288
+ if (normalizeNonNegativeNumber(obj.maxLagMs) == null) {
289
+ issues.push(`${prefix}maxLagMs: expected non-negative number`);
290
+ }
291
+ }
292
+ if ("allowCoalesce" in obj && obj.allowCoalesce != null) {
293
+ if (normalizeBoolean(obj.allowCoalesce) == null) {
294
+ issues.push(`${prefix}allowCoalesce: expected boolean`);
295
+ }
296
+ }
297
+ if ("yieldStrategy" in obj && obj.yieldStrategy != null) {
298
+ const raw = obj.yieldStrategy;
299
+ if (typeof raw !== "string" || raw !== "baseline" && raw !== "inputPending") {
300
+ issues.push(`${prefix}yieldStrategy: expected "baseline" | "inputPending"`);
301
+ }
302
+ }
303
+ return issues;
304
+ };
305
+ var warnInvalidStateTransactionTraitConvergeOverridesDevOnly = (value, label) => {
306
+ if (!isDevEnv()) return;
307
+ if (value == null) return;
308
+ if (!isRecord(value)) {
309
+ warnDevOnly(label, ["expected object"]);
310
+ return;
311
+ }
312
+ const issues = [];
313
+ issues.push(
314
+ ...collectUnknownKeys(
315
+ value,
316
+ /* @__PURE__ */ new Set([
317
+ "traitConvergeBudgetMs",
318
+ "traitConvergeDecisionBudgetMs",
319
+ "traitConvergeMode",
320
+ "traitConvergeTimeSlicing"
321
+ ]),
322
+ ""
323
+ )
324
+ );
325
+ issues.push(...validateStateTransactionTraitOverrides(value, ""));
326
+ warnDevOnly(label, issues);
327
+ };
328
+ var warnInvalidStateTransactionRuntimeConfigDevOnly = (value, label) => {
329
+ if (!isDevEnv()) return;
330
+ if (value == null) return;
331
+ if (!isRecord(value)) {
332
+ warnDevOnly(label, ["expected object"]);
333
+ return;
334
+ }
335
+ const issues = [];
336
+ issues.push(
337
+ ...collectUnknownKeys(
338
+ value,
339
+ /* @__PURE__ */ new Set([
340
+ "instrumentation",
341
+ "traitConvergeBudgetMs",
342
+ "traitConvergeDecisionBudgetMs",
343
+ "traitConvergeMode",
344
+ "traitConvergeTimeSlicing",
345
+ "traitConvergeOverridesByModuleId",
346
+ "txnLanes",
347
+ "txnLanesOverridesByModuleId"
348
+ ]),
349
+ ""
350
+ )
351
+ );
352
+ if ("instrumentation" in value && value.instrumentation != null) {
353
+ if (!Schema.is(InstrumentationSchema)(value.instrumentation)) {
354
+ issues.push(`instrumentation: expected "full" | "light"`);
355
+ }
356
+ }
357
+ issues.push(...validateStateTransactionTraitOverrides(value, ""));
358
+ const txnLanes = value.txnLanes;
359
+ if (txnLanes != null) {
360
+ if (!isRecord(txnLanes)) {
361
+ issues.push(`txnLanes: expected object`);
362
+ } else {
363
+ const prefix = "txnLanes.";
364
+ issues.push(
365
+ ...collectUnknownKeys(
366
+ txnLanes,
367
+ /* @__PURE__ */ new Set(["enabled", "overrideMode", "budgetMs", "debounceMs", "maxLagMs", "allowCoalesce", "yieldStrategy"]),
368
+ prefix
369
+ )
370
+ );
371
+ issues.push(...validateTxnLanesPatch(txnLanes, prefix));
372
+ }
373
+ }
374
+ const overridesByModuleId = value.traitConvergeOverridesByModuleId;
375
+ if (overridesByModuleId != null) {
376
+ if (!isRecord(overridesByModuleId)) {
377
+ issues.push(`traitConvergeOverridesByModuleId: expected record`);
378
+ } else {
379
+ for (const [moduleId, patch] of Object.entries(overridesByModuleId)) {
380
+ const prefix = `traitConvergeOverridesByModuleId.${moduleId}.`;
381
+ if (patch == null) continue;
382
+ if (!isRecord(patch)) {
383
+ issues.push(`${prefix}<value>: expected object`);
384
+ continue;
385
+ }
386
+ issues.push(
387
+ ...collectUnknownKeys(
388
+ patch,
389
+ /* @__PURE__ */ new Set([
390
+ "traitConvergeMode",
391
+ "traitConvergeBudgetMs",
392
+ "traitConvergeDecisionBudgetMs",
393
+ "traitConvergeTimeSlicing"
394
+ ]),
395
+ prefix
396
+ )
397
+ );
398
+ issues.push(...validateStateTransactionTraitOverrides(patch, prefix));
399
+ }
400
+ }
401
+ }
402
+ const lanesOverridesByModuleId = value.txnLanesOverridesByModuleId;
403
+ if (lanesOverridesByModuleId != null) {
404
+ if (!isRecord(lanesOverridesByModuleId)) {
405
+ issues.push(`txnLanesOverridesByModuleId: expected record`);
406
+ } else {
407
+ for (const [moduleId, patch] of Object.entries(lanesOverridesByModuleId)) {
408
+ const prefix = `txnLanesOverridesByModuleId.${moduleId}.`;
409
+ if (patch == null) continue;
410
+ if (!isRecord(patch)) {
411
+ issues.push(`${prefix}<value>: expected object`);
412
+ continue;
413
+ }
414
+ issues.push(
415
+ ...collectUnknownKeys(
416
+ patch,
417
+ /* @__PURE__ */ new Set([
418
+ "enabled",
419
+ "overrideMode",
420
+ "budgetMs",
421
+ "debounceMs",
422
+ "maxLagMs",
423
+ "allowCoalesce",
424
+ "yieldStrategy"
425
+ ]),
426
+ prefix
427
+ )
428
+ );
429
+ issues.push(...validateTxnLanesPatch(patch, prefix));
430
+ }
431
+ }
432
+ }
433
+ warnDevOnly(label, issues);
434
+ };
435
+ var warnInvalidStateTransactionOverridesDevOnly = (value, label) => {
436
+ if (!isDevEnv()) return;
437
+ if (value == null) return;
438
+ if (!isRecord(value)) {
439
+ warnDevOnly(label, ["expected object"]);
440
+ return;
441
+ }
442
+ const issues = [];
443
+ issues.push(
444
+ ...collectUnknownKeys(
445
+ value,
446
+ /* @__PURE__ */ new Set([
447
+ "traitConvergeBudgetMs",
448
+ "traitConvergeDecisionBudgetMs",
449
+ "traitConvergeMode",
450
+ "traitConvergeTimeSlicing",
451
+ "traitConvergeOverridesByModuleId",
452
+ "txnLanes",
453
+ "txnLanesOverridesByModuleId"
454
+ ]),
455
+ ""
456
+ )
457
+ );
458
+ issues.push(...validateStateTransactionTraitOverrides(value, ""));
459
+ const txnLanes = value.txnLanes;
460
+ if (txnLanes != null) {
461
+ if (!isRecord(txnLanes)) {
462
+ issues.push(`txnLanes: expected object`);
463
+ } else {
464
+ const prefix = "txnLanes.";
465
+ issues.push(
466
+ ...collectUnknownKeys(
467
+ txnLanes,
468
+ /* @__PURE__ */ new Set(["enabled", "overrideMode", "budgetMs", "debounceMs", "maxLagMs", "allowCoalesce"]),
469
+ prefix
470
+ )
471
+ );
472
+ issues.push(...validateTxnLanesPatch(txnLanes, prefix));
473
+ }
474
+ }
475
+ const overridesByModuleId = value.traitConvergeOverridesByModuleId;
476
+ if (overridesByModuleId != null) {
477
+ if (!isRecord(overridesByModuleId)) {
478
+ issues.push(`traitConvergeOverridesByModuleId: expected record`);
479
+ } else {
480
+ for (const [moduleId, patch] of Object.entries(overridesByModuleId)) {
481
+ const prefix = `traitConvergeOverridesByModuleId.${moduleId}.`;
482
+ if (patch == null) continue;
483
+ if (!isRecord(patch)) {
484
+ issues.push(`${prefix}<value>: expected object`);
485
+ continue;
486
+ }
487
+ issues.push(
488
+ ...collectUnknownKeys(
489
+ patch,
490
+ /* @__PURE__ */ new Set([
491
+ "traitConvergeMode",
492
+ "traitConvergeBudgetMs",
493
+ "traitConvergeDecisionBudgetMs",
494
+ "traitConvergeTimeSlicing"
495
+ ]),
496
+ prefix
497
+ )
498
+ );
499
+ issues.push(...validateStateTransactionTraitOverrides(patch, prefix));
500
+ }
501
+ }
502
+ }
503
+ const lanesOverridesByModuleId = value.txnLanesOverridesByModuleId;
504
+ if (lanesOverridesByModuleId != null) {
505
+ if (!isRecord(lanesOverridesByModuleId)) {
506
+ issues.push(`txnLanesOverridesByModuleId: expected record`);
507
+ } else {
508
+ for (const [moduleId, patch] of Object.entries(lanesOverridesByModuleId)) {
509
+ const prefix = `txnLanesOverridesByModuleId.${moduleId}.`;
510
+ if (patch == null) continue;
511
+ if (!isRecord(patch)) {
512
+ issues.push(`${prefix}<value>: expected object`);
513
+ continue;
514
+ }
515
+ issues.push(
516
+ ...collectUnknownKeys(
517
+ patch,
518
+ /* @__PURE__ */ new Set(["enabled", "overrideMode", "budgetMs", "debounceMs", "maxLagMs", "allowCoalesce"]),
519
+ prefix
520
+ )
521
+ );
522
+ issues.push(...validateTxnLanesPatch(patch, prefix));
523
+ }
524
+ }
525
+ }
526
+ warnDevOnly(label, issues);
527
+ };
528
+
529
+ // src/internal/runtime/core/runner/ProgramRunner.ts
530
+ import { Cause, Effect, FiberRef, Option, Scope } from "effect";
531
+
532
+ // src/internal/runtime/core/runner/ProgramRunner.exitCode.ts
533
+ var isRecord2 = (value) => typeof value === "object" && value !== null;
534
+ var getProcess = () => globalThis.process;
535
+ var setExitCodeIfEnabled = (enabled, value) => {
536
+ if (!enabled) return;
537
+ const proc = getProcess();
538
+ if (!isRecord2(proc)) return;
539
+ const next = typeof value === "number" && Number.isInteger(value) ? value : 0;
540
+ proc.exitCode = next;
541
+ };
542
+ var setFailureExitCodeIfEnabled = (enabled) => {
543
+ if (!enabled) return;
544
+ const proc = getProcess();
545
+ if (!isRecord2(proc)) return;
546
+ proc.exitCode = 1;
547
+ };
548
+ var reportErrorIfEnabled = (enabled, error) => {
549
+ if (!enabled) return;
550
+ console.error(error);
551
+ };
552
+
553
+ // src/internal/runtime/core/runner/ProgramRunner.options.ts
554
+ var isRecord3 = (value) => typeof value === "object" && value !== null;
555
+ var resolveProgramRunnerOptions = (options) => {
556
+ const record = isRecord3(options) ? options : void 0;
557
+ const closeScopeTimeout = typeof record?.closeScopeTimeout === "number" ? record.closeScopeTimeout : 1e3;
558
+ const handleSignals = typeof record?.handleSignals === "boolean" ? record.handleSignals : true;
559
+ const exitCode = typeof record?.exitCode === "boolean" ? record.exitCode : false;
560
+ const reportError = typeof record?.reportError === "boolean" ? record.reportError : true;
561
+ const args = record?.args ?? void 0;
562
+ return {
563
+ closeScopeTimeout,
564
+ handleSignals,
565
+ args,
566
+ exitCode,
567
+ reportError
568
+ };
569
+ };
570
+
571
+ // src/internal/runtime/core/runner/ProgramRunner.ts
572
+ var openProgram = (makeRuntime, rootImpl, options) => Effect.gen(function* () {
573
+ const inTxn = yield* FiberRef.get(inSyncTransactionFiber);
574
+ if (inTxn) {
575
+ return yield* Effect.dieMessage(
576
+ "[Logix] Runtime.openProgram/runProgram is not allowed inside a synchronous StateTransaction body"
577
+ );
578
+ }
579
+ const runnerOptions = resolveProgramRunnerOptions(options);
580
+ const kernel = yield* makeProgramRunnerKernel(makeRuntime, rootImpl, options);
581
+ yield* Effect.addFinalizer(
582
+ () => kernel.close({
583
+ timeoutMs: runnerOptions.closeScopeTimeout,
584
+ onError: options?.onError
585
+ })
586
+ );
587
+ yield* kernel.installSignals(runnerOptions.handleSignals);
588
+ const moduleRuntime = yield* Effect.tryPromise({
589
+ try: () => kernel.runtime.runPromise(rootImpl.module),
590
+ catch: (error) => new BootError(kernel.identity, error)
591
+ });
592
+ kernel.setInstanceId(moduleRuntime.instanceId);
593
+ return kernel.toContext(moduleRuntime);
594
+ });
595
+ var runProgram = async (makeRuntime, rootImpl, main, options) => {
596
+ if (isInSyncTransaction()) {
597
+ throw new Error("[Logix] Runtime.openProgram/runProgram is not allowed inside a synchronous StateTransaction body");
598
+ }
599
+ const runnerOptions = resolveProgramRunnerOptions(options);
600
+ const identity = {
601
+ moduleId: String(rootImpl.module.id),
602
+ instanceId: "unknown"
603
+ };
604
+ const scope = Effect.runSync(Scope.make());
605
+ const runtime = makeRuntime(rootImpl, options);
606
+ let ctx;
607
+ let mainError;
608
+ let closeError;
609
+ let result;
610
+ try {
611
+ Effect.runSync(Scope.addFinalizer(scope, Effect.promise(() => runtime.dispose()).pipe(Effect.asVoid)));
612
+ if (runnerOptions.handleSignals) {
613
+ Effect.runSync(
614
+ installGracefulShutdownHandlers({
615
+ scope,
616
+ enabled: true
617
+ })
618
+ );
619
+ }
620
+ let moduleRuntime;
621
+ try {
622
+ moduleRuntime = await runtime.runPromise(rootImpl.module);
623
+ } catch (error) {
624
+ setFailureExitCodeIfEnabled(runnerOptions.exitCode);
625
+ reportErrorIfEnabled(runnerOptions.exitCode && runnerOptions.reportError, error);
626
+ result = {
627
+ _tag: "failure",
628
+ error: new BootError(identity, error)
629
+ };
630
+ }
631
+ if (result?._tag !== "failure") {
632
+ identity.instanceId = String(moduleRuntime.instanceId ?? "unknown");
633
+ ctx = {
634
+ scope,
635
+ runtime,
636
+ module: moduleRuntime,
637
+ $: make(rootImpl.module.shape, moduleRuntime)
638
+ };
639
+ }
640
+ if (ctx) {
641
+ try {
642
+ const value = await ctx.runtime.runPromise(main(ctx, runnerOptions.args));
643
+ setExitCodeIfEnabled(runnerOptions.exitCode, value);
644
+ result = { _tag: "success", value };
645
+ } catch (error) {
646
+ mainError = error;
647
+ setFailureExitCodeIfEnabled(runnerOptions.exitCode);
648
+ reportErrorIfEnabled(runnerOptions.exitCode && runnerOptions.reportError, error);
649
+ result = { _tag: "failure", error: new MainError(identity, error) };
650
+ }
651
+ }
652
+ } finally {
653
+ const exit = await Effect.runPromiseExit(
654
+ closeProgramScope({
655
+ scope,
656
+ timeoutMs: runnerOptions.closeScopeTimeout,
657
+ identity,
658
+ onError: options?.onError
659
+ })
660
+ );
661
+ if (exit._tag === "Failure") {
662
+ const failureOpt = Cause.failureOption(exit.cause);
663
+ if (Option.isSome(failureOpt)) {
664
+ const error = failureOpt.value;
665
+ if (mainError !== void 0 && error && typeof error === "object") {
666
+ error.mainError = mainError;
667
+ }
668
+ closeError = error;
669
+ } else {
670
+ const defectOpt = Cause.dieOption(exit.cause);
671
+ if (Option.isSome(defectOpt) && defectOpt.value instanceof Error) {
672
+ const error = defectOpt.value;
673
+ if (mainError !== void 0 && error && typeof error === "object") {
674
+ error.mainError = mainError;
675
+ }
676
+ closeError = error;
677
+ } else {
678
+ closeError = new Error(String(exit.cause));
679
+ }
680
+ }
681
+ }
682
+ }
683
+ if (closeError !== void 0) {
684
+ setFailureExitCodeIfEnabled(runnerOptions.exitCode);
685
+ reportErrorIfEnabled(runnerOptions.exitCode && runnerOptions.reportError, closeError);
686
+ throw closeError;
687
+ }
688
+ if (!result) {
689
+ setFailureExitCodeIfEnabled(runnerOptions.exitCode);
690
+ throw new Error("[Logix] ProgramRunner.runProgram: missing result");
691
+ }
692
+ if (result._tag === "failure") {
693
+ throw result.error;
694
+ }
695
+ return result.value;
696
+ };
697
+
698
+ // src/Runtime.ts
699
+ var resolveRootImpl = (root) => root?._tag === "ModuleImpl" ? root : root?.impl;
700
+ var make2 = (root, options) => {
701
+ const rootImpl = resolveRootImpl(root);
702
+ warnInvalidConcurrencyPolicyDevOnly(options?.concurrencyPolicy, "Runtime.make options.concurrencyPolicy");
703
+ warnInvalidStateTransactionRuntimeConfigDevOnly(options?.stateTransaction, "Runtime.make options.stateTransaction");
704
+ const debugLayer = options?.debug === true ? layer() : options?.debug ? layer(options.debug) : Layer.empty;
705
+ const userLayer = options?.layer ?? Layer.empty;
706
+ const userWithDebug = options?.debug ? Layer.mergeAll(userLayer, debugLayer) : userLayer;
707
+ let middlewareStack = options?.middleware ?? [];
708
+ const devtoolsOptions = options?.devtools === true ? {} : options?.devtools;
709
+ if (options?.devtools) {
710
+ const observerConfig = devtoolsOptions?.observer === false ? false : devtoolsOptions?.observer;
711
+ middlewareStack = withDebug(middlewareStack, {
712
+ logger: false,
713
+ observer: observerConfig
714
+ });
715
+ }
716
+ const effectOpLayer = middlewareStack.length > 0 ? Layer.succeed(EffectOpMiddlewareTag, {
717
+ stack: middlewareStack
718
+ }) : Layer.empty;
719
+ const baseLayer = options?.label != null ? Layer.mergeAll(runtimeLabel(options.label), userWithDebug) : userWithDebug;
720
+ const baseWithDevtools = options?.devtools ? devtoolsHubLayer(baseLayer, {
721
+ bufferSize: devtoolsOptions?.bufferSize,
722
+ diagnosticsLevel: devtoolsOptions?.diagnosticsLevel,
723
+ traitConvergeDiagnosticsSampling: devtoolsOptions?.traitConvergeDiagnosticsSampling
724
+ }) : baseLayer;
725
+ const appLayer = Layer.mergeAll(
726
+ runSessionLayer(),
727
+ layer2(),
728
+ baseWithDevtools,
729
+ effectOpLayer
730
+ );
731
+ const readQueryStrictGate = (() => {
732
+ const strictGate = options?.readQuery?.strictGate;
733
+ if (!strictGate) return void 0;
734
+ const mode = strictGate.mode ?? "off";
735
+ if (mode === "off") return void 0;
736
+ return {
737
+ mode,
738
+ requireStatic: strictGate.requireStatic,
739
+ denyFallbackReasons: strictGate.denyFallbackReasons
740
+ };
741
+ })();
742
+ const appConfig = {
743
+ layer: appLayer,
744
+ modules: [provide(rootImpl.module, rootImpl.layer)],
745
+ processes: rootImpl.processes ?? [],
746
+ onError: options?.onError,
747
+ stateTransaction: options?.stateTransaction,
748
+ concurrencyPolicy: options?.concurrencyPolicy,
749
+ readQueryStrictGate
750
+ };
751
+ const app = makeApp(appConfig);
752
+ return app.makeRuntime();
753
+ };
754
+ var openProgram2 = (root, options) => openProgram(
755
+ (rootImpl, runtimeOptions) => make2(rootImpl, runtimeOptions),
756
+ resolveRootImpl(root),
757
+ options
758
+ );
759
+ var runProgram2 = async (root, main, options) => runProgram(
760
+ (rootImpl, runtimeOptions) => make2(rootImpl, runtimeOptions),
761
+ resolveRootImpl(root),
762
+ main,
763
+ options
764
+ );
765
+ var stateTransactionOverridesLayer = (overrides) => {
766
+ warnInvalidStateTransactionOverridesDevOnly(overrides, "Runtime.stateTransactionOverridesLayer");
767
+ return Layer.succeed(StateTransactionOverridesTag, overrides);
768
+ };
769
+ var concurrencyPolicyOverridesLayer = (overrides) => {
770
+ warnInvalidConcurrencyPolicyDevOnly(overrides, "Runtime.concurrencyPolicyOverridesLayer");
771
+ return Layer.succeed(ConcurrencyPolicyOverridesTag, overrides);
772
+ };
773
+ var setTraitConvergeOverride = (runtime, moduleId, overrides) => {
774
+ warnInvalidStateTransactionTraitConvergeOverridesDevOnly(overrides, `Runtime.setTraitConvergeOverride(${moduleId})`);
775
+ runtime.runSync(
776
+ Effect2.gen(function* () {
777
+ const runtimeConfigOpt = yield* Effect2.serviceOption(StateTransactionConfigTag);
778
+ if (Option2.isNone(runtimeConfigOpt)) {
779
+ return;
780
+ }
781
+ const runtimeConfig = runtimeConfigOpt.value;
782
+ const next = {
783
+ ...runtimeConfig.traitConvergeOverridesByModuleId ?? {}
784
+ };
785
+ if (overrides) {
786
+ next[moduleId] = overrides;
787
+ } else {
788
+ delete next[moduleId];
789
+ }
790
+ runtimeConfig.traitConvergeOverridesByModuleId = next;
791
+ })
792
+ );
793
+ };
794
+ var setConcurrencyPolicyOverride = (runtime, moduleId, patch) => {
795
+ warnInvalidConcurrencyPolicyPatchDevOnly(patch, `Runtime.setConcurrencyPolicyOverride(${moduleId})`);
796
+ runtime.runSync(
797
+ Effect2.gen(function* () {
798
+ const runtimeConfigOpt = yield* Effect2.serviceOption(ConcurrencyPolicyTag);
799
+ if (Option2.isNone(runtimeConfigOpt)) {
800
+ return;
801
+ }
802
+ const runtimeConfig = runtimeConfigOpt.value;
803
+ const next = {
804
+ ...runtimeConfig.overridesByModuleId ?? {}
805
+ };
806
+ if (patch) {
807
+ next[moduleId] = patch;
808
+ } else {
809
+ delete next[moduleId];
810
+ }
811
+ runtimeConfig.overridesByModuleId = next;
812
+ })
813
+ );
814
+ };
815
+ var applyTransactionSnapshot = (moduleId, instanceId, txnId, mode) => Effect2.gen(function* () {
816
+ const runtime = getRuntimeByModuleAndInstance(moduleId, instanceId);
817
+ if (!runtime) {
818
+ return;
819
+ }
820
+ try {
821
+ yield* getRuntimeInternals(runtime).txn.applyTransactionSnapshot(txnId, mode);
822
+ } catch {
823
+ return;
824
+ }
825
+ });
826
+
827
+ export {
828
+ make2 as make,
829
+ openProgram2 as openProgram,
830
+ runProgram2 as runProgram,
831
+ stateTransactionOverridesLayer,
832
+ concurrencyPolicyOverridesLayer,
833
+ setTraitConvergeOverride,
834
+ setConcurrencyPolicyOverride,
835
+ applyTransactionSnapshot,
836
+ Runtime_exports
837
+ };
838
+ //# sourceMappingURL=chunk-NBD3KUOZ.js.map