@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,1051 @@
1
+ import {
2
+ makeApp,
3
+ makeProgramRunnerKernel,
4
+ provide
5
+ } from "./chunk-EGK3KN7B.js";
6
+ import {
7
+ evidenceCollectorLayer,
8
+ makeEvidenceCollector
9
+ } from "./chunk-PAYXCY6A.js";
10
+ import {
11
+ RuntimeServicesInstanceOverridesTag,
12
+ getKernelImplementationRef,
13
+ getRuntimeServicesEvidence
14
+ } from "./chunk-ZGDVUPTM.js";
15
+ import {
16
+ isActionToken
17
+ } from "./chunk-YS3AZQ2G.js";
18
+ import {
19
+ exportStaticIr
20
+ } from "./chunk-ZFY7U2FR.js";
21
+ import {
22
+ appendConvergeStaticIrCollectors
23
+ } from "./chunk-M3BFQ7HK.js";
24
+ import {
25
+ getModuleTraitsProgram
26
+ } from "./chunk-3RMKLXHX.js";
27
+ import {
28
+ appendSinks,
29
+ diagnosticsLevel,
30
+ toSerializableErrorSummary
31
+ } from "./chunk-DMBALCE2.js";
32
+ import {
33
+ fnv1a32,
34
+ stableStringify
35
+ } from "./chunk-GMPEOUP2.js";
36
+ import {
37
+ makeRunSession,
38
+ runSessionLayer
39
+ } from "./chunk-OFADUJWJ.js";
40
+ import {
41
+ isJsonValue
42
+ } from "./chunk-JWOYLO27.js";
43
+ import {
44
+ __export
45
+ } from "./chunk-PZ5AY32C.js";
46
+
47
+ // src/internal/reflection/staticIr.ts
48
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
49
+ var isModuleImpl = (value) => isRecord(value) && value._tag === "ModuleImpl" && isRecord(value.module);
50
+ var resolveModuleId = (input) => {
51
+ if (isModuleImpl(input)) {
52
+ const id = input.module.id;
53
+ return typeof id === "string" && id.length > 0 ? id : "unknown";
54
+ }
55
+ if (isRecord(input)) {
56
+ const id = input.id;
57
+ if (typeof id === "string" && id.length > 0) return id;
58
+ const tag = input.tag;
59
+ if (tag && (typeof tag === "object" || typeof tag === "function")) {
60
+ const tagId = tag.id;
61
+ if (typeof tagId === "string" && tagId.length > 0) return tagId;
62
+ }
63
+ }
64
+ return "unknown";
65
+ };
66
+ var resolveModuleTag = (input) => {
67
+ if (isModuleImpl(input)) return input.module;
68
+ if (isRecord(input) && input.tag) return input.tag;
69
+ return void 0;
70
+ };
71
+ var exportStaticIr2 = (module) => {
72
+ const tag = resolveModuleTag(module);
73
+ if (!tag) return void 0;
74
+ const program = getModuleTraitsProgram(tag);
75
+ if (!program) return void 0;
76
+ return exportStaticIr({
77
+ program,
78
+ moduleId: resolveModuleId(module)
79
+ });
80
+ };
81
+
82
+ // src/internal/reflection/manifest.ts
83
+ import { Schema } from "effect";
84
+ var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
85
+ var isModuleImpl2 = (value) => isRecord2(value) && value._tag === "ModuleImpl" && isRecord2(value.module);
86
+ var resolveModuleId2 = (input) => {
87
+ if (isModuleImpl2(input)) {
88
+ const id = input.module.id;
89
+ return typeof id === "string" && id.length > 0 ? id : "unknown";
90
+ }
91
+ if (isRecord2(input)) {
92
+ const id = input.id;
93
+ if (typeof id === "string" && id.length > 0) return id;
94
+ const tag = input.tag;
95
+ if (tag && (typeof tag === "object" || typeof tag === "function")) {
96
+ const tagId = tag.id;
97
+ if (typeof tagId === "string" && tagId.length > 0) return tagId;
98
+ }
99
+ }
100
+ return "unknown";
101
+ };
102
+ var resolveActionKeys = (input) => {
103
+ const tag = isModuleImpl2(input) ? input.module : input?.tag;
104
+ const actionMap = tag?.shape?.actionMap;
105
+ if (!isRecord2(actionMap)) return [];
106
+ return Object.keys(actionMap).sort();
107
+ };
108
+ var resolveDevSource = (input) => {
109
+ if (!isRecord2(input)) return void 0;
110
+ const file = input.file;
111
+ const line = input.line;
112
+ const column = input.column;
113
+ if (typeof file !== "string" || file.length === 0) return void 0;
114
+ if (typeof line !== "number" || !Number.isInteger(line) || line < 1) return void 0;
115
+ if (typeof column !== "number" || !Number.isInteger(column) || column < 1) return void 0;
116
+ return { file, line, column };
117
+ };
118
+ var resolveTokenSource = (token) => {
119
+ if (!token || typeof token !== "object" && typeof token !== "function") return void 0;
120
+ return resolveDevSource(token.source);
121
+ };
122
+ var resolveActions = (input) => {
123
+ const tag = isModuleImpl2(input) ? input.module : input?.tag;
124
+ const actionMap = tag?.shape?.actionMap;
125
+ if (!isRecord2(actionMap)) return [];
126
+ const moduleSource = resolveSource(input);
127
+ const reducers = isRecord2(tag?.reducers) ? tag.reducers : void 0;
128
+ const actionTags = Object.keys(actionMap).sort();
129
+ const out = [];
130
+ for (const actionTag of actionTags) {
131
+ const token = actionMap[actionTag];
132
+ const source = resolveTokenSource(token) ?? moduleSource;
133
+ const payloadKind = isActionToken(token) && Schema.isSchema(token.schema) ? token.schema === Schema.Void ? "void" : "nonVoid" : "unknown";
134
+ const primaryReducer = reducers && typeof reducers[actionTag] === "function" ? { kind: "declared" } : void 0;
135
+ out.push({
136
+ actionTag,
137
+ payload: { kind: payloadKind },
138
+ ...primaryReducer ? { primaryReducer } : {},
139
+ ...source ? { source } : {}
140
+ });
141
+ }
142
+ return out;
143
+ };
144
+ var MODULE_DECLARED_EFFECTS = /* @__PURE__ */ Symbol.for("logix.module.effects.declared");
145
+ var resolveEffects = (input) => {
146
+ const tag = isModuleImpl2(input) ? input.module : input?.tag;
147
+ const actionMap = tag?.shape?.actionMap;
148
+ if (!isRecord2(actionMap)) return void 0;
149
+ const effectsRaw = tag?.[MODULE_DECLARED_EFFECTS];
150
+ if (!isRecord2(effectsRaw)) return void 0;
151
+ const source = resolveSource(input);
152
+ const logicUnitId = "__logix_internal:effects:declared";
153
+ const handlerIds = /* @__PURE__ */ new WeakMap();
154
+ let nextHandlerSeq = 0;
155
+ const out = [];
156
+ for (const actionTag of Object.keys(effectsRaw).sort()) {
157
+ if (!(actionTag in actionMap)) continue;
158
+ const handlers = effectsRaw[actionTag];
159
+ if (!Array.isArray(handlers)) continue;
160
+ for (const handler of handlers) {
161
+ if (typeof handler !== "function") continue;
162
+ let handlerId = handlerIds.get(handler);
163
+ if (!handlerId) {
164
+ nextHandlerSeq += 1;
165
+ handlerId = `h${nextHandlerSeq}`;
166
+ handlerIds.set(handler, handlerId);
167
+ }
168
+ const sourceKey = `${logicUnitId}::${handlerId}`;
169
+ out.push({
170
+ actionTag,
171
+ sourceKey,
172
+ kind: "declared",
173
+ ...source ? { source } : {}
174
+ });
175
+ }
176
+ }
177
+ const seen = /* @__PURE__ */ new Set();
178
+ const deduped = [];
179
+ for (const item of out) {
180
+ const key = `${item.actionTag}\0${item.sourceKey}`;
181
+ if (seen.has(key)) continue;
182
+ seen.add(key);
183
+ deduped.push(item);
184
+ }
185
+ deduped.sort(
186
+ (a, b) => a.actionTag < b.actionTag ? -1 : a.actionTag > b.actionTag ? 1 : a.sourceKey.localeCompare(b.sourceKey)
187
+ );
188
+ return deduped.length > 0 ? deduped : void 0;
189
+ };
190
+ var resolveSchemaKeys = (input) => {
191
+ if (!isRecord2(input)) return void 0;
192
+ const schemas = input.schemas;
193
+ if (!isRecord2(schemas)) return void 0;
194
+ return Object.keys(schemas).sort();
195
+ };
196
+ var resolveSource = (input) => {
197
+ if (!isRecord2(input)) return void 0;
198
+ const dev = input.dev;
199
+ return resolveDevSource(dev?.source);
200
+ };
201
+ var resolveMeta = (input) => {
202
+ if (!isRecord2(input)) return void 0;
203
+ const meta = input.meta;
204
+ if (!isRecord2(meta)) return void 0;
205
+ const out = {};
206
+ for (const key of Object.keys(meta).sort()) {
207
+ const value = meta[key];
208
+ if (isJsonValue(value)) {
209
+ out[key] = value;
210
+ }
211
+ }
212
+ return Object.keys(out).length > 0 ? out : void 0;
213
+ };
214
+ var MODULE_INTERNAL = /* @__PURE__ */ Symbol.for("logix.module.internal");
215
+ var resolveLogicUnits = (input) => {
216
+ if (!isRecord2(input)) return void 0;
217
+ const internal = input[MODULE_INTERNAL];
218
+ const mounted = internal?.mounted;
219
+ if (!Array.isArray(mounted)) return void 0;
220
+ const out = [];
221
+ for (const unit of mounted) {
222
+ if (!isRecord2(unit)) continue;
223
+ const kind = unit.kind;
224
+ const id = unit.id;
225
+ if (typeof kind !== "string" || kind.length === 0) continue;
226
+ if (typeof id !== "string" || id.length === 0) continue;
227
+ const derived = unit.derived === true ? true : void 0;
228
+ const name = typeof unit.name === "string" ? unit.name : void 0;
229
+ out.push({ kind, id, derived, name });
230
+ }
231
+ out.sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : a.kind.localeCompare(b.kind));
232
+ return out.length > 0 ? out : void 0;
233
+ };
234
+ var digestOf = (base) => `manifest:067:${fnv1a32(stableStringify(base))}`;
235
+ var utf8ByteLength = (value) => {
236
+ const json = JSON.stringify(value);
237
+ if (typeof TextEncoder !== "undefined") {
238
+ return new TextEncoder().encode(json).length;
239
+ }
240
+ return json.length;
241
+ };
242
+ var applyMaxBytes = (manifest, maxBytes) => {
243
+ const originalBytes = utf8ByteLength(manifest);
244
+ if (originalBytes <= maxBytes) return manifest;
245
+ const dropped = [];
246
+ const truncatedArrays = [];
247
+ const baseMarker = () => ({
248
+ truncated: true,
249
+ maxBytes,
250
+ originalBytes,
251
+ dropped,
252
+ truncatedArrays
253
+ });
254
+ const withMarker = (next2) => {
255
+ const meta = {
256
+ __logix: baseMarker()
257
+ };
258
+ return { ...next2, meta };
259
+ };
260
+ let next = withMarker(manifest);
261
+ const markTruncatedArray = (name) => {
262
+ if (!truncatedArrays.includes(name)) {
263
+ truncatedArrays.push(name);
264
+ }
265
+ };
266
+ const dropField = (field) => {
267
+ if (next[field] !== void 0) {
268
+ dropped.push(String(field));
269
+ next = withMarker({ ...next, [field]: void 0 });
270
+ }
271
+ };
272
+ dropField("meta");
273
+ if (utf8ByteLength(next) <= maxBytes) return next;
274
+ dropField("source");
275
+ if (utf8ByteLength(next) <= maxBytes) return next;
276
+ dropField("staticIr");
277
+ if (utf8ByteLength(next) <= maxBytes) return next;
278
+ dropField("logicUnits");
279
+ if (utf8ByteLength(next) <= maxBytes) return next;
280
+ dropField("schemaKeys");
281
+ if (utf8ByteLength(next) <= maxBytes) return next;
282
+ dropField("effects");
283
+ if (utf8ByteLength(next) <= maxBytes) return next;
284
+ const truncateActionsToFit = () => {
285
+ const total = next.actions.length;
286
+ if (total <= 1) return;
287
+ let lo = 1;
288
+ let hi = total;
289
+ let best = 1;
290
+ while (lo <= hi) {
291
+ const mid = Math.floor((lo + hi) / 2);
292
+ const candidate = withMarker({
293
+ ...next,
294
+ actions: next.actions.slice(0, mid),
295
+ actionKeys: next.actionKeys.slice(0, mid)
296
+ });
297
+ if (utf8ByteLength(candidate) <= maxBytes) {
298
+ best = mid;
299
+ lo = mid + 1;
300
+ } else {
301
+ hi = mid - 1;
302
+ }
303
+ }
304
+ if (best < total) {
305
+ markTruncatedArray("actions");
306
+ markTruncatedArray("actionKeys");
307
+ next = withMarker({
308
+ ...next,
309
+ actions: next.actions.slice(0, best),
310
+ actionKeys: next.actionKeys.slice(0, best)
311
+ });
312
+ }
313
+ };
314
+ while (utf8ByteLength(next) > maxBytes) {
315
+ const beforeLen = next.actions.length;
316
+ truncateActionsToFit();
317
+ if (next.actions.length === beforeLen) {
318
+ break;
319
+ }
320
+ }
321
+ return next;
322
+ };
323
+ var extractManifest = (module, options) => {
324
+ const manifestVersion = "067";
325
+ const moduleId = resolveModuleId2(module);
326
+ const actionKeys = resolveActionKeys(module);
327
+ const actions = resolveActions(module);
328
+ const effects = resolveEffects(module);
329
+ const schemaKeys = resolveSchemaKeys(module);
330
+ const logicUnits = resolveLogicUnits(module);
331
+ const source = resolveSource(module);
332
+ const meta = resolveMeta(module);
333
+ const staticIr = options?.includeStaticIr ? exportStaticIr2(module) : void 0;
334
+ const digestBase = {
335
+ manifestVersion,
336
+ moduleId,
337
+ actionKeys,
338
+ actions,
339
+ effects,
340
+ schemaKeys,
341
+ logicUnits,
342
+ staticIrDigest: staticIr?.digest
343
+ };
344
+ const digest = digestOf(digestBase);
345
+ const manifest = {
346
+ manifestVersion,
347
+ moduleId,
348
+ actionKeys,
349
+ actions,
350
+ effects,
351
+ schemaKeys,
352
+ logicUnits,
353
+ source,
354
+ meta,
355
+ staticIr,
356
+ digest
357
+ };
358
+ const maxBytes = options?.budgets?.maxBytes;
359
+ if (typeof maxBytes === "number" && Number.isFinite(maxBytes) && maxBytes > 0) {
360
+ return applyMaxBytes(manifest, maxBytes);
361
+ }
362
+ return manifest;
363
+ };
364
+
365
+ // src/internal/observability/artifacts/registry.ts
366
+ var ARTIFACT_EXPORTERS = /* @__PURE__ */ Symbol.for("logix.module.trialRunArtifactExporters");
367
+ var registerTrialRunArtifactExporter = (tag, exporter) => {
368
+ if (!tag || typeof tag !== "object" && typeof tag !== "function") {
369
+ throw new Error("[Logix] registerTrialRunArtifactExporter: invalid module tag");
370
+ }
371
+ const current = tag[ARTIFACT_EXPORTERS] ?? [];
372
+ const next = Array.isArray(current) ? [...current, exporter] : [exporter];
373
+ tag[ARTIFACT_EXPORTERS] = next;
374
+ };
375
+ var getTrialRunArtifactExporters = (tag) => {
376
+ if (!tag || typeof tag !== "object" && typeof tag !== "function") {
377
+ return [];
378
+ }
379
+ const current = tag[ARTIFACT_EXPORTERS];
380
+ if (!Array.isArray(current)) return [];
381
+ return current.filter((x) => x && typeof x === "object");
382
+ };
383
+
384
+ // src/internal/observability/trialRunModule.ts
385
+ import { Cause as Cause2, Effect as Effect4, Exit, Fiber, Layer as Layer4, Option } from "effect";
386
+
387
+ // src/internal/platform/BuildEnv.ts
388
+ var BuildEnv_exports = {};
389
+ __export(BuildEnv_exports, {
390
+ layer: () => layer2,
391
+ run: () => run
392
+ });
393
+ import { ConfigProvider, Effect as Effect2, Layer as Layer2 } from "effect";
394
+
395
+ // src/internal/platform/ConstructionGuard.ts
396
+ var ConstructionGuard_exports = {};
397
+ __export(ConstructionGuard_exports, {
398
+ guardBuildTime: () => guardBuildTime,
399
+ makeConstructionGuardError: () => makeConstructionGuardError
400
+ });
401
+ import { Cause, Effect } from "effect";
402
+ var makeConstructionGuardError = (options) => Object.assign(new Error(options.message), {
403
+ _tag: "ConstructionGuardError",
404
+ kind: options.kind,
405
+ missingService: options.missingService,
406
+ hint: options.hint
407
+ });
408
+ var extractMissingService = (cause) => {
409
+ const candidates = [...Array.from(Cause.defects(cause)), ...Array.from(Cause.failures(cause))];
410
+ for (const candidate of candidates) {
411
+ const message = candidate instanceof Error ? candidate.message : typeof candidate === "string" ? candidate : void 0;
412
+ if (!message) continue;
413
+ const match = /Service not found: ([^\s(]+)/.exec(message);
414
+ if (match?.[1]) return match[1];
415
+ }
416
+ return void 0;
417
+ };
418
+ var guardBuildTime = (self) => self.pipe(
419
+ Effect.catchAllCause((cause) => {
420
+ const missing = extractMissingService(cause);
421
+ if (missing) {
422
+ return Effect.fail(
423
+ makeConstructionGuardError({
424
+ kind: "missing_service",
425
+ missingService: missing,
426
+ message: `[ConstructionGuardError] Build-time dependency violation: service "${missing}" is not available in Build Env.`,
427
+ hint: "Build-time (Reflection) can only depend on a small set of mockable primitives (e.g. Config/RuntimeHost). Move business service access to runtime (e.g. Trait handler / Logic run section) or isolate it via explicit injection."
428
+ })
429
+ );
430
+ }
431
+ return Effect.failCause(cause);
432
+ })
433
+ );
434
+
435
+ // src/internal/platform/RuntimeHost.ts
436
+ var RuntimeHost_exports = {};
437
+ __export(RuntimeHost_exports, {
438
+ RuntimeHost: () => RuntimeHost,
439
+ defaultLayer: () => defaultLayer,
440
+ layer: () => layer,
441
+ make: () => make,
442
+ mock: () => mock
443
+ });
444
+ import { Context, Layer } from "effect";
445
+ var detectKind = () => {
446
+ const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
447
+ if (isBrowser) return "browser";
448
+ const isNode = typeof process !== "undefined" && typeof process?.versions?.node === "string";
449
+ if (isNode) return "node";
450
+ return "unknown";
451
+ };
452
+ var make = (kind) => ({
453
+ kind,
454
+ isNode: kind === "node",
455
+ isBrowser: kind === "browser"
456
+ });
457
+ var RuntimeHost = class extends Context.Tag("@logixjs/RuntimeHost")() {
458
+ };
459
+ var layer = (service) => Layer.succeed(RuntimeHost, service);
460
+ var mock = (kind) => layer(make(kind));
461
+ var defaultLayer = layer(make(detectKind()));
462
+
463
+ // src/internal/platform/BuildEnv.ts
464
+ var toConfigProviderFromRecord = (record) => {
465
+ const map = /* @__PURE__ */ new Map();
466
+ for (const [k, v] of Object.entries(record ?? {})) {
467
+ if (!k) continue;
468
+ if (v === void 0) continue;
469
+ map.set(k, String(v));
470
+ }
471
+ return ConfigProvider.fromMap(map);
472
+ };
473
+ var layer2 = (options = {}) => {
474
+ const runtimeHost = options.runtimeHost ? layer(options.runtimeHost) : options.runtimeHostKind ? layer(make(options.runtimeHostKind)) : defaultLayer;
475
+ const configProvider = options.configProvider ? options.configProvider : toConfigProviderFromRecord(options.config);
476
+ const config = Layer2.setConfigProvider(configProvider);
477
+ return Layer2.mergeAll(runtimeHost, config);
478
+ };
479
+ var run = (builder, options = {}) => builder.pipe(Effect2.provide(layer2(options)), guardBuildTime);
480
+
481
+ // src/internal/runtime/Runtime.ts
482
+ import { Layer as Layer3 } from "effect";
483
+ var make2 = (rootImpl, options) => {
484
+ const appConfig = {
485
+ layer: options?.layer ?? Layer3.empty,
486
+ modules: [provide(rootImpl.module, rootImpl.layer)],
487
+ processes: rootImpl.processes ?? [],
488
+ onError: options?.onError
489
+ };
490
+ const app = makeApp(appConfig);
491
+ return app.makeRuntime();
492
+ };
493
+
494
+ // src/internal/observability/artifacts/model.ts
495
+ var isArtifactKey = (input) => typeof input === "string" && /^@[^\s/]+\/[^\s@]+@v\d+$/.test(input);
496
+
497
+ // src/internal/observability/artifacts/digest.ts
498
+ var utf8ByteLengthString = (text) => {
499
+ if (typeof TextEncoder !== "undefined") {
500
+ return new TextEncoder().encode(text).length;
501
+ }
502
+ return text.length;
503
+ };
504
+ var digestJsonValue = (value) => {
505
+ const stableJson = stableStringify(value);
506
+ const bytes = utf8ByteLengthString(stableJson);
507
+ return {
508
+ stableJson,
509
+ bytes,
510
+ digest: `artifact:031:${fnv1a32(stableJson)}`
511
+ };
512
+ };
513
+
514
+ // src/internal/observability/artifacts/collect.ts
515
+ var toErrorSummaryWithCode = (cause, code, hint) => {
516
+ const base = toSerializableErrorSummary(cause).errorSummary;
517
+ return {
518
+ name: base.name,
519
+ message: base.message,
520
+ code,
521
+ hint: hint ?? base.hint
522
+ };
523
+ };
524
+ var defaultArtifactBudgetBytes = 50 * 1024;
525
+ var budgetOf = (budgets) => typeof budgets?.maxBytes === "number" && Number.isFinite(budgets.maxBytes) && budgets.maxBytes > 0 ? budgets.maxBytes : defaultArtifactBudgetBytes;
526
+ var makeConflictEnvelope = (artifactKey, exporterIds) => {
527
+ const ids = Array.from(new Set(exporterIds.map((s) => String(s)).filter((s) => s.length > 0))).sort(
528
+ (a, b) => a.localeCompare(b)
529
+ );
530
+ return {
531
+ artifactKey,
532
+ envelope: {
533
+ artifactKey,
534
+ ok: false,
535
+ error: {
536
+ name: "ArtifactKeyConflictError",
537
+ message: `[Logix] TrialRun artifact key conflict: ${artifactKey}`,
538
+ code: "ArtifactKeyConflict",
539
+ hint: ids.length > 0 ? `conflictingExporters=${ids.join(",")}` : void 0
540
+ }
541
+ }
542
+ };
543
+ };
544
+ var truncateJsonValue = (value, maxBytes) => {
545
+ const analyzed = digestJsonValue(value);
546
+ const json = analyzed.stableJson;
547
+ const bytes = analyzed.bytes;
548
+ if (bytes <= maxBytes) {
549
+ return { value, actualBytes: bytes, digest: analyzed.digest };
550
+ }
551
+ const previewChars = Math.min(json.length, Math.max(0, Math.min(256, maxBytes)));
552
+ const preview = json.slice(0, previewChars);
553
+ return {
554
+ value: {
555
+ _tag: "oversized",
556
+ bytes,
557
+ preview
558
+ },
559
+ actualBytes: bytes,
560
+ digest: analyzed.digest
561
+ };
562
+ };
563
+ var collectTrialRunArtifacts = (options) => {
564
+ const exportersSorted = Array.from(options.exporters).sort((a, b) => {
565
+ const ka = String(a?.artifactKey ?? "");
566
+ const kb = String(b?.artifactKey ?? "");
567
+ if (ka < kb) return -1;
568
+ if (ka > kb) return 1;
569
+ const ia = String(a?.exporterId ?? "");
570
+ const ib = String(b?.exporterId ?? "");
571
+ return ia.localeCompare(ib);
572
+ });
573
+ const conflicts = /* @__PURE__ */ new Map();
574
+ for (const ex of exportersSorted) {
575
+ const key = ex?.artifactKey;
576
+ const id = String(ex?.exporterId ?? "");
577
+ if (!isArtifactKey(key)) {
578
+ continue;
579
+ }
580
+ const current = conflicts.get(key);
581
+ if (current) current.push(id);
582
+ else conflicts.set(key, [id]);
583
+ }
584
+ const conflictKeys = /* @__PURE__ */ new Set();
585
+ for (const [k, ids] of conflicts) {
586
+ const unique = Array.from(new Set(ids));
587
+ if (unique.length > 1) {
588
+ conflictKeys.add(k);
589
+ }
590
+ }
591
+ const maxBytes = budgetOf(options.budgets);
592
+ const collected = [];
593
+ for (const exporter of exportersSorted) {
594
+ const artifactKey = exporter?.artifactKey;
595
+ if (!isArtifactKey(artifactKey)) {
596
+ continue;
597
+ }
598
+ if (conflictKeys.has(artifactKey)) {
599
+ continue;
600
+ }
601
+ try {
602
+ const value = exporter.export(options.ctx);
603
+ if (value === void 0) continue;
604
+ if (!isJsonValue(value)) {
605
+ collected.push({
606
+ artifactKey,
607
+ envelope: {
608
+ artifactKey,
609
+ ok: false,
610
+ error: toErrorSummaryWithCode(
611
+ new Error(`[Logix] Artifact exporter returned non-JsonValue: ${exporter.exporterId}`),
612
+ "ArtifactNonSerializable",
613
+ `artifactKey=${artifactKey} exporterId=${exporter.exporterId}`
614
+ )
615
+ }
616
+ });
617
+ continue;
618
+ }
619
+ const truncated = truncateJsonValue(value, maxBytes);
620
+ const envelope = {
621
+ artifactKey,
622
+ ok: true,
623
+ value: truncated.value,
624
+ digest: truncated.digest,
625
+ ...truncated.actualBytes > maxBytes ? {
626
+ truncated: true,
627
+ budgetBytes: maxBytes,
628
+ actualBytes: truncated.actualBytes
629
+ } : {
630
+ budgetBytes: maxBytes,
631
+ actualBytes: truncated.actualBytes
632
+ }
633
+ };
634
+ collected.push({ artifactKey, envelope });
635
+ } catch (e) {
636
+ collected.push({
637
+ artifactKey,
638
+ envelope: {
639
+ artifactKey,
640
+ ok: false,
641
+ error: toErrorSummaryWithCode(
642
+ e,
643
+ "ArtifactExportFailed",
644
+ `artifactKey=${artifactKey} exporterId=${exporter.exporterId}`
645
+ )
646
+ }
647
+ });
648
+ }
649
+ }
650
+ for (const conflictKey of Array.from(conflictKeys).sort((a, b) => a.localeCompare(b))) {
651
+ collected.push(makeConflictEnvelope(conflictKey, conflicts.get(conflictKey) ?? []));
652
+ }
653
+ if (collected.length === 0) return void 0;
654
+ collected.sort((a, b) => a.artifactKey.localeCompare(b.artifactKey));
655
+ return Object.fromEntries(collected.map((c) => [c.artifactKey, c.envelope]));
656
+ };
657
+
658
+ // src/internal/observability/trialRunModule.ts
659
+ var defaultHost = () => {
660
+ if (typeof window !== "undefined" && typeof document !== "undefined") return "browser";
661
+ return "node";
662
+ };
663
+ var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
664
+ var resolveRootImpl = (root) => root?._tag === "ModuleImpl" ? root : root?.impl;
665
+ var utf8ByteLength2 = (value) => {
666
+ const json = JSON.stringify(value);
667
+ if (typeof TextEncoder !== "undefined") {
668
+ return new TextEncoder().encode(json).length;
669
+ }
670
+ return json.length;
671
+ };
672
+ var parseMissingConfigKeys = (message) => {
673
+ const out = [];
674
+ const patterns = [
675
+ /\bMissing (?:data|value) for (?:key|path) "?([A-Z0-9_./:-]+)"?/g,
676
+ /\bMissing (?:data|value) at ([A-Z0-9_./:-]+)\b/g,
677
+ /\bMissing configuration:? "?([A-Z0-9_./:-]+)"?/g,
678
+ /\bConfig\b.*\bmissing\b.*"?([A-Z0-9_./:-]+)"?/gi
679
+ ];
680
+ for (const re of patterns) {
681
+ let match;
682
+ while (match = re.exec(message)) {
683
+ const key = match[1];
684
+ if (typeof key === "string" && key.length > 0) out.push(key);
685
+ }
686
+ }
687
+ return Array.from(new Set(out)).sort((a, b) => a.localeCompare(b));
688
+ };
689
+ var parseMissingServiceIds = (message) => {
690
+ const out = [];
691
+ const re = /Service not found: ([^\s(]+)/g;
692
+ let match;
693
+ while (match = re.exec(message)) {
694
+ const id = match[1]?.replace(/[,:.;]+$/, "");
695
+ if (typeof id === "string" && id.length > 0) out.push(id);
696
+ }
697
+ return Array.from(new Set(out)).sort((a, b) => a.localeCompare(b));
698
+ };
699
+ var parseMissingDependencyFromCause = (cause) => {
700
+ const missingServices = [];
701
+ const missingConfigKeys = [];
702
+ const candidates = [...Array.from(Cause2.failures(cause)), ...Array.from(Cause2.defects(cause))];
703
+ for (const candidate of candidates) {
704
+ if (isRecord3(candidate) && candidate._tag === "ConstructionGuardError") {
705
+ const missingService = candidate.missingService;
706
+ if (typeof missingService === "string" && missingService.length > 0) {
707
+ missingServices.push(missingService);
708
+ }
709
+ }
710
+ if (isRecord3(candidate) && candidate._tag === "ConfigError" && candidate._op === "MissingData" && Array.isArray(candidate.path) && candidate.path.every((k) => typeof k === "string" && k.length > 0)) {
711
+ const key = candidate.path.join(".");
712
+ if (key.length > 0) missingConfigKeys.push(key);
713
+ }
714
+ }
715
+ const messages = [];
716
+ for (const candidate of candidates) {
717
+ if (candidate instanceof Error) {
718
+ messages.push(candidate.message);
719
+ continue;
720
+ }
721
+ if (typeof candidate === "string") {
722
+ messages.push(candidate);
723
+ continue;
724
+ }
725
+ if (isRecord3(candidate) && typeof candidate.message === "string") {
726
+ messages.push(String(candidate.message));
727
+ }
728
+ }
729
+ try {
730
+ messages.push(Cause2.pretty(cause, { renderErrorCause: true }));
731
+ } catch {
732
+ }
733
+ const merged = messages.filter((s) => s.length > 0).join("\n");
734
+ if (merged) {
735
+ missingServices.push(...parseMissingServiceIds(merged));
736
+ missingConfigKeys.push(...parseMissingConfigKeys(merged));
737
+ }
738
+ return {
739
+ missingServices: Array.from(new Set(missingServices)).sort((a, b) => a.localeCompare(b)),
740
+ missingConfigKeys: Array.from(new Set(missingConfigKeys)).sort((a, b) => a.localeCompare(b))
741
+ };
742
+ };
743
+ var buildEnvironmentIr = (params) => {
744
+ const providedConfigKeys = Object.keys(params.buildEnvConfig ?? {}).filter((k) => k.length > 0 && params.buildEnvConfig[k] !== void 0).sort((a, b) => a.localeCompare(b));
745
+ const missingServices = Array.from(new Set(params.missingServices ?? [])).sort((a, b) => a.localeCompare(b));
746
+ const missingConfigKeys = Array.from(new Set(params.missingConfigKeys ?? [])).sort((a, b) => a.localeCompare(b));
747
+ const runtimeServiceIds = params.runtimeServicesEvidence?.bindings?.map((b) => b.serviceId).filter((s) => typeof s === "string") ?? [];
748
+ const tagIds = Array.from(/* @__PURE__ */ new Set([...runtimeServiceIds, ...missingServices])).sort((a, b) => a.localeCompare(b));
749
+ const configKeys = Array.from(/* @__PURE__ */ new Set([...providedConfigKeys, ...missingConfigKeys])).sort(
750
+ (a, b) => a.localeCompare(b)
751
+ );
752
+ return {
753
+ tagIds,
754
+ configKeys,
755
+ missingServices,
756
+ missingConfigKeys,
757
+ kernelImplementationRef: params.kernelImplementationRef,
758
+ runtimeServicesEvidence: params.runtimeServicesEvidence
759
+ };
760
+ };
761
+ var toErrorSummaryWithCode2 = (cause, code, hint) => {
762
+ const base = toSerializableErrorSummary(cause).errorSummary;
763
+ return {
764
+ name: base.name,
765
+ message: base.message,
766
+ code,
767
+ hint: hint ?? base.hint
768
+ };
769
+ };
770
+ var makeTrialRunTimeoutError = () => Object.assign(new Error("[Logix] trialRunModule timed out"), {
771
+ name: "TrialRunTimeoutError"
772
+ });
773
+ var awaitFiberExitWithTimeout = (fiber, timeoutMs) => Effect4.gen(function* () {
774
+ const hasTimeout = typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0;
775
+ const start = hasTimeout ? Date.now() : 0;
776
+ while (true) {
777
+ const exitOpt = yield* Fiber.poll(fiber);
778
+ if (Option.isSome(exitOpt)) {
779
+ return exitOpt.value;
780
+ }
781
+ if (hasTimeout) {
782
+ const elapsedMs = Date.now() - start;
783
+ if (elapsedMs >= timeoutMs) {
784
+ yield* Fiber.interruptFork(fiber);
785
+ return Exit.fail(makeTrialRunTimeoutError());
786
+ }
787
+ }
788
+ yield* Effect4.promise(() => new Promise((r) => setTimeout(r, 1)));
789
+ }
790
+ });
791
+ var trialRunModule = (root, options) => Effect4.gen(function* () {
792
+ const rootImpl = resolveRootImpl(root);
793
+ const session = makeRunSession({
794
+ runId: options?.runId,
795
+ source: options?.source ?? { host: defaultHost(), label: "trial-run-module" },
796
+ startedAt: options?.startedAt
797
+ });
798
+ const collector = makeEvidenceCollector(session);
799
+ const convergeCollector = {
800
+ register: (ir) => {
801
+ collector.registerConvergeStaticIr(ir);
802
+ }
803
+ };
804
+ const sinksLayer = appendSinks([collector.debugSink]);
805
+ const resolvedDiagnosticsLevel = options?.diagnosticsLevel ?? "light";
806
+ const diagnosticsLayer = diagnosticsLevel(resolvedDiagnosticsLevel);
807
+ const convergeLayer = appendConvergeStaticIrCollectors([convergeCollector]);
808
+ const collectorLayer = evidenceCollectorLayer(collector);
809
+ const sessionLayer = runSessionLayer(session);
810
+ const buildEnvConfig = options?.buildEnv?.config;
811
+ const buildEnvLayer = layer2({
812
+ runtimeHostKind: options?.buildEnv?.hostKind,
813
+ config: buildEnvConfig,
814
+ configProvider: options?.buildEnv?.configProvider
815
+ });
816
+ const trialLayer = Layer4.mergeAll(
817
+ buildEnvLayer,
818
+ options?.layer ?? Layer4.empty,
819
+ sessionLayer,
820
+ collectorLayer,
821
+ diagnosticsLayer,
822
+ sinksLayer,
823
+ convergeLayer
824
+ );
825
+ const kernel = yield* makeProgramRunnerKernel(
826
+ (impl) => make2(impl, {
827
+ layer: trialLayer
828
+ // trial-run does not enable devtools by default; diagnostics is controlled by diagnosticsLevel.
829
+ }),
830
+ rootImpl
831
+ );
832
+ const identity = kernel.identity;
833
+ const bootFiber = kernel.runtime.runFork(rootImpl.module);
834
+ const bootExit = yield* awaitFiberExitWithTimeout(bootFiber, options?.trialRunTimeoutMs);
835
+ let kernelImplementationRef;
836
+ let runtimeServicesEvidence;
837
+ let instanceId;
838
+ if (Exit.isSuccess(bootExit)) {
839
+ const moduleRuntime = bootExit.value;
840
+ instanceId = typeof moduleRuntime?.instanceId === "string" && moduleRuntime.instanceId.length > 0 ? moduleRuntime.instanceId : void 0;
841
+ kernel.setInstanceId(instanceId);
842
+ try {
843
+ kernelImplementationRef = getKernelImplementationRef(moduleRuntime);
844
+ } catch {
845
+ kernelImplementationRef = void 0;
846
+ }
847
+ if (resolvedDiagnosticsLevel !== "off") {
848
+ try {
849
+ runtimeServicesEvidence = getRuntimeServicesEvidence(moduleRuntime);
850
+ } catch {
851
+ runtimeServicesEvidence = void 0;
852
+ }
853
+ }
854
+ } else {
855
+ const failure = Cause2.failureOption(bootExit.cause);
856
+ if (Option.isSome(failure)) {
857
+ const err = failure.value;
858
+ const instanceIdFromErr = typeof err?.instanceId === "string" ? err.instanceId : void 0;
859
+ if (instanceIdFromErr && instanceIdFromErr.length > 0) {
860
+ kernel.setInstanceId(instanceIdFromErr);
861
+ }
862
+ }
863
+ }
864
+ const closeExit = yield* Effect4.exit(
865
+ kernel.close({
866
+ timeoutMs: typeof options?.closeScopeTimeout === "number" && Number.isFinite(options.closeScopeTimeout) && options.closeScopeTimeout > 0 ? options.closeScopeTimeout : 1e3
867
+ })
868
+ );
869
+ const evidence = collector.exportEvidencePackage({
870
+ maxEvents: options?.maxEvents ?? 1e3
871
+ });
872
+ const manifest = (() => {
873
+ try {
874
+ return extractManifest(root, {
875
+ includeStaticIr: true,
876
+ budgets: { maxBytes: 2e5 }
877
+ });
878
+ } catch {
879
+ return void 0;
880
+ }
881
+ })();
882
+ const staticIr = (() => {
883
+ try {
884
+ return exportStaticIr2(root);
885
+ } catch {
886
+ return void 0;
887
+ }
888
+ })();
889
+ let ok = Exit.isSuccess(bootExit) && Exit.isSuccess(closeExit);
890
+ let error;
891
+ let summary;
892
+ const depsFromBootFailure = Exit.isFailure(bootExit) ? parseMissingDependencyFromCause(bootExit.cause) : { missingServices: [], missingConfigKeys: [] };
893
+ const missingServices = depsFromBootFailure.missingServices;
894
+ const missingConfigKeys = depsFromBootFailure.missingConfigKeys;
895
+ const closeError = Exit.isFailure(closeExit) ? Option.getOrUndefined(Cause2.dieOption(closeExit.cause)) : void 0;
896
+ if (!Exit.isSuccess(bootExit)) {
897
+ const failure = Option.getOrUndefined(Cause2.failureOption(bootExit.cause));
898
+ const defect = Option.getOrUndefined(Cause2.dieOption(bootExit.cause));
899
+ const base = failure ?? defect ?? bootExit.cause;
900
+ if (missingServices.length > 0 || missingConfigKeys.length > 0) {
901
+ ok = false;
902
+ error = toErrorSummaryWithCode2(
903
+ base,
904
+ "MissingDependency",
905
+ missingServices.length > 0 ? "Build-time missing service: provide a Layer mock/implementation via options.layer, or move the dependency access to runtime." : "Build-time missing config: provide the missing key(s) in buildEnv.config, or add a default value to Config."
906
+ );
907
+ } else if (isRecord3(base) && (base.name === "TrialRunTimeoutError" || base._tag === "TrialRunTimeout")) {
908
+ ok = false;
909
+ error = toErrorSummaryWithCode2(
910
+ base,
911
+ "TrialRunTimeout",
912
+ "Trial run timed out: check for Layer/assembly phase blocking (Effect.never / unfinished acquire)."
913
+ );
914
+ } else {
915
+ ok = false;
916
+ error = toErrorSummaryWithCode2(base, "RuntimeFailure");
917
+ }
918
+ }
919
+ if (Exit.isFailure(closeExit)) {
920
+ const died = Option.getOrUndefined(Cause2.dieOption(closeExit.cause));
921
+ const failure = Option.getOrUndefined(Cause2.failureOption(closeExit.cause));
922
+ const base = died ?? failure ?? closeExit.cause;
923
+ const closeErrorSummary = (() => {
924
+ const tag = isRecord3(base) ? base._tag : void 0;
925
+ if (tag === "DisposeTimeout") {
926
+ return toErrorSummaryWithCode2(
927
+ base,
928
+ "DisposeTimeout",
929
+ "Dispose timed out: check for unclosed resource handles, fibers not interrupted, or event listeners not unregistered."
930
+ );
931
+ }
932
+ return toErrorSummaryWithCode2(base, "RuntimeFailure");
933
+ })();
934
+ ok = false;
935
+ if (!error) {
936
+ error = closeErrorSummary;
937
+ } else {
938
+ summary = { __logix: { closeError: closeErrorSummary } };
939
+ }
940
+ }
941
+ const environment = buildEnvironmentIr({
942
+ kernelImplementationRef,
943
+ runtimeServicesEvidence,
944
+ buildEnvConfig,
945
+ missingServices,
946
+ missingConfigKeys
947
+ });
948
+ const moduleId = typeof rootImpl.module?.id === "string" && rootImpl.module.id.length > 0 ? String(rootImpl.module.id) : manifest?.moduleId ?? "unknown";
949
+ const artifacts = collectTrialRunArtifacts({
950
+ exporters: getTrialRunArtifactExporters(rootImpl.module),
951
+ ctx: {
952
+ moduleId,
953
+ manifest,
954
+ staticIr,
955
+ environment
956
+ }
957
+ });
958
+ let report = {
959
+ runId: session.runId,
960
+ ok,
961
+ manifest,
962
+ staticIr,
963
+ artifacts,
964
+ environment,
965
+ evidence,
966
+ summary,
967
+ error
968
+ };
969
+ const maxBytes = options?.budgets?.maxBytes;
970
+ if (typeof maxBytes === "number" && Number.isFinite(maxBytes) && maxBytes > 0) {
971
+ const originalBytes = utf8ByteLength2(report);
972
+ if (originalBytes > maxBytes) {
973
+ report = {
974
+ runId: session.runId,
975
+ ok: false,
976
+ environment,
977
+ error: {
978
+ message: `[Logix] TrialRunReport exceeded maxBytes (${originalBytes} > ${maxBytes})`,
979
+ code: "Oversized",
980
+ hint: "Reduce maxEvents or budgets.maxBytes, or split manifest/evidence artifacts in CI."
981
+ },
982
+ summary: {
983
+ __logix: {
984
+ truncated: true,
985
+ maxBytes,
986
+ originalBytes,
987
+ dropped: ["manifest", "staticIr", "artifacts", "evidence"]
988
+ }
989
+ }
990
+ };
991
+ }
992
+ }
993
+ return report;
994
+ });
995
+
996
+ // src/internal/observability/trialRun.ts
997
+ import { Effect as Effect5, Layer as Layer5, Scope } from "effect";
998
+ var defaultHost2 = () => {
999
+ if (typeof window !== "undefined" && typeof document !== "undefined") return "browser";
1000
+ return "node";
1001
+ };
1002
+ var trialRun = (program, options) => Effect5.gen(function* () {
1003
+ const session = makeRunSession({
1004
+ runId: options?.runId,
1005
+ source: options?.source ?? { host: defaultHost2(), label: "trial-run" },
1006
+ startedAt: options?.startedAt
1007
+ });
1008
+ const collector = makeEvidenceCollector(session);
1009
+ const convergeCollector = {
1010
+ register: (ir) => {
1011
+ collector.registerConvergeStaticIr(ir);
1012
+ }
1013
+ };
1014
+ const sinksLayer = appendSinks([collector.debugSink]);
1015
+ const diagnosticsLayer = diagnosticsLevel(options?.diagnosticsLevel ?? "light");
1016
+ const convergeLayer = appendConvergeStaticIrCollectors([convergeCollector]);
1017
+ const collectorLayer = evidenceCollectorLayer(collector);
1018
+ const sessionLayer = runSessionLayer(session);
1019
+ const overridesLayer = options?.runtimeServicesInstanceOverrides != null ? Layer5.succeed(
1020
+ RuntimeServicesInstanceOverridesTag,
1021
+ options.runtimeServicesInstanceOverrides
1022
+ ) : Layer5.empty;
1023
+ const trialLayer = Layer5.mergeAll(
1024
+ options?.layer ?? Layer5.empty,
1025
+ sessionLayer,
1026
+ collectorLayer,
1027
+ overridesLayer,
1028
+ diagnosticsLayer,
1029
+ sinksLayer,
1030
+ convergeLayer
1031
+ );
1032
+ const scope = yield* Scope.make();
1033
+ const exit = yield* Effect5.exit(program).pipe(Effect5.provideService(Scope.Scope, scope), Effect5.provide(trialLayer));
1034
+ yield* Scope.close(scope, exit);
1035
+ const evidence = collector.exportEvidencePackage({
1036
+ maxEvents: options?.maxEvents
1037
+ });
1038
+ return { session, exit, evidence };
1039
+ });
1040
+
1041
+ export {
1042
+ ConstructionGuard_exports,
1043
+ RuntimeHost_exports,
1044
+ BuildEnv_exports,
1045
+ exportStaticIr2 as exportStaticIr,
1046
+ extractManifest,
1047
+ registerTrialRunArtifactExporter,
1048
+ trialRunModule,
1049
+ trialRun
1050
+ };
1051
+ //# sourceMappingURL=chunk-M3WTHJHJ.js.map