@ultrst-armada/krnl 0.0.0-stage → 1.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 (236) hide show
  1. package/README.md +95 -2
  2. package/package.json +75 -4
  3. package/packages/cli/dist/K_ENT_Entity-PQ5MURQY-ZG6FZXXX.js +13 -0
  4. package/packages/cli/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-K4CRQYA5.js +8 -0
  5. package/packages/cli/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-LNPXZYOE.js +110 -0
  6. package/packages/cli/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-3ALZPNX4.js +11 -0
  7. package/packages/cli/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-PJTICYSW.js +11 -0
  8. package/packages/cli/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-M5TYU55O.js +8 -0
  9. package/packages/cli/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-H6STOXRK.js +20 -0
  10. package/packages/cli/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-XPJXSF7D.js +19 -0
  11. package/packages/cli/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-CUYGTWOW.js +7 -0
  12. package/packages/cli/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-VR6T4N6J.js +17 -0
  13. package/packages/cli/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-RLJ4QWDP.js +58 -0
  14. package/packages/cli/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-BOQGUASC.js +22 -0
  15. package/packages/cli/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-XJI7KIT5.js +8 -0
  16. package/packages/cli/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-K5VCWAFW.js +9 -0
  17. package/packages/cli/dist/bin/krnl.cjs +9758 -0
  18. package/packages/cli/dist/bin/krnl.d.cts +1 -0
  19. package/packages/cli/dist/bin/krnl.d.ts +1 -0
  20. package/packages/cli/dist/bin/krnl.js +2006 -0
  21. package/packages/cli/dist/chunk-3TRM6CYL.js +152 -0
  22. package/packages/cli/dist/chunk-5JDK35TG.js +3872 -0
  23. package/packages/cli/dist/chunk-63PTK33I.js +997 -0
  24. package/packages/cli/dist/chunk-6NIKAMUZ.js +82 -0
  25. package/packages/cli/dist/chunk-BOXWWXQG.js +400 -0
  26. package/packages/cli/dist/chunk-EEKLK7QJ.js +565 -0
  27. package/packages/cli/dist/chunk-EG7T2IAD.js +107 -0
  28. package/packages/cli/dist/chunk-F5EHXE2O.js +1036 -0
  29. package/packages/cli/dist/chunk-F65ANSQG.js +269 -0
  30. package/packages/cli/dist/chunk-FDNCADFE.js +71 -0
  31. package/packages/cli/dist/chunk-GDLRMDAN.js +127 -0
  32. package/packages/cli/dist/chunk-HWMTCMOS.js +656 -0
  33. package/packages/cli/dist/chunk-I74QIQOD.js +5536 -0
  34. package/packages/cli/dist/chunk-JTLSTO25.js +71 -0
  35. package/packages/cli/dist/chunk-JULBBJ27.js +1033 -0
  36. package/packages/cli/dist/chunk-OHVMVRBP.js +117 -0
  37. package/packages/cli/dist/chunk-P2PCLEKX.js +666 -0
  38. package/packages/cli/dist/chunk-PJQIUOX2.js +7767 -0
  39. package/packages/cli/dist/chunk-PPOF3DJW.js +471 -0
  40. package/packages/cli/dist/chunk-Q45257P6.js +173 -0
  41. package/packages/cli/dist/chunk-QNROWGBI.js +1036 -0
  42. package/packages/cli/dist/chunk-RJNYUXZD.js +977 -0
  43. package/packages/cli/dist/chunk-SRTOPJ5W.js +104 -0
  44. package/packages/cli/dist/chunk-TCEX3MPS.js +702 -0
  45. package/packages/cli/dist/chunk-TNOAJO2J.js +675 -0
  46. package/packages/cli/dist/chunk-UR2SUCSF.js +701 -0
  47. package/packages/cli/dist/chunk-X5LOIFM7.js +68 -0
  48. package/packages/cli/dist/chunk-XIRFOO3H.js +589 -0
  49. package/packages/cli/dist/chunk-ZAAV3JXQ.js +809 -0
  50. package/packages/cli/dist/index.cjs +7798 -0
  51. package/packages/cli/dist/index.d.cts +7 -0
  52. package/packages/cli/dist/index.d.ts +7 -0
  53. package/packages/cli/dist/index.js +29 -0
  54. package/packages/cli/package.json +34 -0
  55. package/packages/core/dist/K_ENT_Entity-4MB7CU4A.js +12 -0
  56. package/packages/core/dist/K_ENT_Entity-DEJGIDGH.js +12 -0
  57. package/packages/core/dist/K_ENT_Entity-FXZO5UZ2.js +12 -0
  58. package/packages/core/dist/K_ENT_Entity-HDSCXC5F.js +12 -0
  59. package/packages/core/dist/K_ENT_Entity-JILABHLW.js +12 -0
  60. package/packages/core/dist/K_ENT_Entity-PQ5MURQY.js +13 -0
  61. package/packages/core/dist/K_ENT_Entity-ROAKDIHW.js +12 -0
  62. package/packages/core/dist/K_ENT_Entity-TBVFSKDV.js +12 -0
  63. package/packages/core/dist/K_ENT_Entity-ZFLKG3JO.js +12 -0
  64. package/packages/core/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW.js +8 -0
  65. package/packages/core/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF.js +110 -0
  66. package/packages/core/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF.js +9 -0
  67. package/packages/core/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X.js +9 -0
  68. package/packages/core/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW.js +8 -0
  69. package/packages/core/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2.js +20 -0
  70. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-4C6GBQAG.js +18 -0
  71. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-6V23A6F6.js +18 -0
  72. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK.js +19 -0
  73. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-DYLLC5G2.js +18 -0
  74. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-F4FOFAUP.js +18 -0
  75. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-FBOXXMI3.js +18 -0
  76. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-Q73BWLNP.js +18 -0
  77. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QM2C4MVA.js +18 -0
  78. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QUGI6SMP.js +18 -0
  79. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RGMTBHNP.js +18 -0
  80. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RWR7UNDW.js +18 -0
  81. package/packages/core/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js +7 -0
  82. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-32MFJJ5Z.js +17 -0
  83. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-4J4CEWRY.js +17 -0
  84. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-A366YHF2.js +17 -0
  85. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-LK4LYJHI.js +17 -0
  86. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js +17 -0
  87. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-NW3K63II.js +17 -0
  88. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-QDHTI5ZV.js +17 -0
  89. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-VHCT6VIW.js +17 -0
  90. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-WBRKF24R.js +17 -0
  91. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-XKYQYT6Q.js +17 -0
  92. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-Z2PWZYDZ.js +17 -0
  93. package/packages/core/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5.js +58 -0
  94. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-2EZU7QF4.js +21 -0
  95. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-6G3AQNAV.js +21 -0
  96. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-B2NZMQUG.js +21 -0
  97. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-C2RABMZP.js +21 -0
  98. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-HHE3NZ4F.js +21 -0
  99. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-LHFGR6WK.js +21 -0
  100. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-M74BLM3N.js +21 -0
  101. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-PT6ZA6EA.js +21 -0
  102. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-SP52V3CX.js +21 -0
  103. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF.js +22 -0
  104. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-YNSEUHJJ.js +21 -0
  105. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-M6SBHIVA.js +8 -0
  106. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG.js +8 -0
  107. package/packages/core/dist/K_LIB_Krnl_Telemetry-77FRZ3KV.js +9 -0
  108. package/packages/core/dist/chunk-33L2J7V7.js +82 -0
  109. package/packages/core/dist/chunk-3ES4K2ZP.js +817 -0
  110. package/packages/core/dist/chunk-3SMHVVLL.js +82 -0
  111. package/packages/core/dist/chunk-3UEZ7JQA.js +4877 -0
  112. package/packages/core/dist/chunk-3XIE6KBD.js +4877 -0
  113. package/packages/core/dist/chunk-46ZLCML6.js +107 -0
  114. package/packages/core/dist/chunk-4UEL3DWJ.js +107 -0
  115. package/packages/core/dist/chunk-54GWZ5PC.js +82 -0
  116. package/packages/core/dist/chunk-6QCYRS5L.js +127 -0
  117. package/packages/core/dist/chunk-6ULMHNXR.js +104 -0
  118. package/packages/core/dist/chunk-7WUETJEV.js +117 -0
  119. package/packages/core/dist/chunk-A5KRAYDB.js +107 -0
  120. package/packages/core/dist/chunk-ANEAZ3PO.js +107 -0
  121. package/packages/core/dist/chunk-BE76RL6F.js +82 -0
  122. package/packages/core/dist/chunk-CIARVYDO.js +107 -0
  123. package/packages/core/dist/chunk-CR2ANE62.js +107 -0
  124. package/packages/core/dist/chunk-DI27MOR7.js +173 -0
  125. package/packages/core/dist/chunk-E6RLFHM5.js +596 -0
  126. package/packages/core/dist/chunk-EELAPMNV.js +4877 -0
  127. package/packages/core/dist/chunk-ENZ2RQVJ.js +107 -0
  128. package/packages/core/dist/chunk-F2U6CX4F.js +4877 -0
  129. package/packages/core/dist/chunk-FKG64OHL.js +82 -0
  130. package/packages/core/dist/chunk-FYAZJYM5.js +772 -0
  131. package/packages/core/dist/chunk-G4NP4RDQ.js +82 -0
  132. package/packages/core/dist/chunk-GADIRLRS.js +473 -0
  133. package/packages/core/dist/chunk-GR6CSLQJ.js +772 -0
  134. package/packages/core/dist/chunk-HDS7AT6O.js +772 -0
  135. package/packages/core/dist/chunk-HIMEZUU2.js +71 -0
  136. package/packages/core/dist/chunk-IB4UHG5I.js +596 -0
  137. package/packages/core/dist/chunk-J7ZYNVRS.js +772 -0
  138. package/packages/core/dist/chunk-JVLZU4K7.js +604 -0
  139. package/packages/core/dist/chunk-JYXXI7Q3.js +82 -0
  140. package/packages/core/dist/chunk-K54K2KZW.js +192 -0
  141. package/packages/core/dist/chunk-K6VHLBNH.js +3316 -0
  142. package/packages/core/dist/chunk-KCBP7ZYA.js +596 -0
  143. package/packages/core/dist/chunk-KFQGP6VL.js +33 -0
  144. package/packages/core/dist/chunk-KIUEUI7K.js +82 -0
  145. package/packages/core/dist/chunk-LB67NIZP.js +949 -0
  146. package/packages/core/dist/chunk-LDTYFUNW.js +596 -0
  147. package/packages/core/dist/chunk-MLVWARD4.js +596 -0
  148. package/packages/core/dist/chunk-MPYVXHKO.js +2777 -0
  149. package/packages/core/dist/chunk-MRQ3MITU.js +772 -0
  150. package/packages/core/dist/chunk-MVUN7I7O.js +107 -0
  151. package/packages/core/dist/chunk-NDDOIRW7.js +596 -0
  152. package/packages/core/dist/chunk-O3KDB5MH.js +3330 -0
  153. package/packages/core/dist/chunk-OEINUDSE.js +400 -0
  154. package/packages/core/dist/chunk-OPDENPT4.js +4877 -0
  155. package/packages/core/dist/chunk-P6XEM2LA.js +429 -0
  156. package/packages/core/dist/chunk-QKMRSQV4.js +82 -0
  157. package/packages/core/dist/chunk-R6CCWALL.js +4877 -0
  158. package/packages/core/dist/chunk-RAMMOO73.js +774 -0
  159. package/packages/core/dist/chunk-S3FTZFG6.js +772 -0
  160. package/packages/core/dist/chunk-T2ZVN434.js +4877 -0
  161. package/packages/core/dist/chunk-TFHLDMIA.js +107 -0
  162. package/packages/core/dist/chunk-TI3QUCIJ.js +107 -0
  163. package/packages/core/dist/chunk-TR2BAIGI.js +107 -0
  164. package/packages/core/dist/chunk-UGVVJKC6.js +4877 -0
  165. package/packages/core/dist/chunk-V2DX7YIU.js +984 -0
  166. package/packages/core/dist/chunk-W4IHYUYD.js +772 -0
  167. package/packages/core/dist/chunk-W6WBG5OY.js +4877 -0
  168. package/packages/core/dist/chunk-WN3M7O7H.js +3312 -0
  169. package/packages/core/dist/chunk-WR3NCU7U.js +4877 -0
  170. package/packages/core/dist/chunk-XC6B6L27.js +82 -0
  171. package/packages/core/dist/chunk-XNSE64ZY.js +3316 -0
  172. package/packages/core/dist/chunk-XROES2WN.js +634 -0
  173. package/packages/core/dist/chunk-XSCKNRCZ.js +5020 -0
  174. package/packages/core/dist/chunk-XVABPAUZ.js +82 -0
  175. package/packages/core/dist/chunk-YOBCB5C5.js +596 -0
  176. package/packages/core/dist/chunk-YUK6Q563.js +666 -0
  177. package/packages/core/dist/chunk-YXGL3ZEU.js +1030 -0
  178. package/packages/core/dist/chunk-ZINJ5OUX.js +596 -0
  179. package/packages/core/dist/chunk-ZPFD4BIQ.js +604 -0
  180. package/packages/core/dist/chunk-ZQZBFG6F.js +4826 -0
  181. package/packages/core/dist/chunk-ZZFRJGXM.js +4877 -0
  182. package/packages/core/dist/index.cjs +760 -0
  183. package/packages/core/dist/index.d.cts +360 -0
  184. package/packages/core/dist/index.d.ts +360 -0
  185. package/packages/core/dist/index.js +707 -0
  186. package/packages/core/package.json +34 -0
  187. package/packages/create-krnl/dist/K_ENT_Entity-PQ5MURQY-R2OH4VXE.js +14 -0
  188. package/packages/create-krnl/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-AZM5HF4M.js +9 -0
  189. package/packages/create-krnl/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-X5N6SV2S.js +111 -0
  190. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-5PFHF4JU.js +12 -0
  191. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-ED33OQPH.js +12 -0
  192. package/packages/create-krnl/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-YGQLVR4P.js +9 -0
  193. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-VM7CTU2L.js +21 -0
  194. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-Y2GQFJ7I.js +21 -0
  195. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-L3JQWO54.js +8 -0
  196. package/packages/create-krnl/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-KQARASPR.js +19 -0
  197. package/packages/create-krnl/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-OF3IGLVL.js +59 -0
  198. package/packages/create-krnl/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-JOLHKOEX.js +24 -0
  199. package/packages/create-krnl/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-L46LSHKQ.js +10 -0
  200. package/packages/create-krnl/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-4JUPRR3X.js +10 -0
  201. package/packages/create-krnl/dist/chunk-3TRM6CYL.js +152 -0
  202. package/packages/create-krnl/dist/chunk-3URCB3QS.js +127 -0
  203. package/packages/create-krnl/dist/chunk-5JDK35TG.js +3872 -0
  204. package/packages/create-krnl/dist/chunk-A2XAXDOW.js +812 -0
  205. package/packages/create-krnl/dist/chunk-AN6TMQHG.js +1033 -0
  206. package/packages/create-krnl/dist/chunk-BOXWWXQG.js +400 -0
  207. package/packages/create-krnl/dist/chunk-BPTBREBG.js +38 -0
  208. package/packages/create-krnl/dist/chunk-FDNCADFE.js +71 -0
  209. package/packages/create-krnl/dist/chunk-JTLSTO25.js +71 -0
  210. package/packages/create-krnl/dist/chunk-M3NCUIPL.js +107 -0
  211. package/packages/create-krnl/dist/chunk-N2EONSOC.js +7769 -0
  212. package/packages/create-krnl/dist/chunk-OHVMVRBP.js +117 -0
  213. package/packages/create-krnl/dist/chunk-Q45257P6.js +173 -0
  214. package/packages/create-krnl/dist/chunk-QGM4M3NI.js +37 -0
  215. package/packages/create-krnl/dist/chunk-RJNYUXZD.js +977 -0
  216. package/packages/create-krnl/dist/chunk-SRTOPJ5W.js +104 -0
  217. package/packages/create-krnl/dist/chunk-UPBIGEC3.js +666 -0
  218. package/packages/create-krnl/dist/chunk-V2DB7UD7.js +82 -0
  219. package/packages/create-krnl/dist/chunk-WMHLIUI6.js +3644 -0
  220. package/packages/create-krnl/dist/chunk-XIRFOO3H.js +589 -0
  221. package/packages/create-krnl/dist/chunk-Y2CEEVZP.js +5536 -0
  222. package/packages/create-krnl/dist/index.cjs +395 -0
  223. package/packages/create-krnl/dist/index.js +372 -0
  224. package/packages/create-krnl/dist/main-DXUMPBND.js +2217 -0
  225. package/packages/create-krnl/dist/wrapper-SDF2VKX3.js +31 -0
  226. package/packages/create-krnl/package.json +23 -0
  227. package/packages/eslint-plugin/dist/index.cjs +439 -0
  228. package/packages/eslint-plugin/dist/index.d.cts +336 -0
  229. package/packages/eslint-plugin/dist/index.d.ts +336 -0
  230. package/packages/eslint-plugin/dist/index.js +416 -0
  231. package/packages/eslint-plugin/package.json +24 -0
  232. package/packages/validate/dist/index.cjs +499 -0
  233. package/packages/validate/dist/index.d.cts +49 -0
  234. package/packages/validate/dist/index.d.ts +49 -0
  235. package/packages/validate/dist/index.js +462 -0
  236. package/packages/validate/package.json +27 -0
@@ -0,0 +1,107 @@
1
+ import {
2
+ krnlSystemEntityBase
3
+ } from "./chunk-T2ZVN434.js";
4
+ import {
5
+ KrnlShell
6
+ } from "./chunk-GADIRLRS.js";
7
+
8
+ // src/core/K_LIB_Krnl_System_App_Adapter.ts
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import http from "http";
12
+ import net from "net";
13
+ var KrnlNonKrnlAppAdapter = class extends krnlSystemEntityBase {
14
+ childProcess = null;
15
+ appPort = -1;
16
+ appPath;
17
+ constructor(name, appPath) {
18
+ super(name, null, -1, "127.0.0.1", { Singleton: true, _skipMagneticLoading: true });
19
+ this.appPath = appPath;
20
+ this._isIngressNetworkMember = true;
21
+ this.unifiedHttpAdapter._handleRequest = async (req, res) => {
22
+ await this.proxyRequest(req, res, req.url || "/");
23
+ };
24
+ }
25
+ async startApp() {
26
+ this.appPort = await this._probeAvailablePort(11e3, "127.0.0.1");
27
+ let command = "node";
28
+ let args = ["."];
29
+ try {
30
+ const pkgPath = path.join(this.appPath, "package.json");
31
+ if (fs.existsSync(pkgPath)) {
32
+ const packageJson = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
33
+ if (packageJson.scripts?.start) {
34
+ command = "npm";
35
+ args = ["run", "start"];
36
+ } else if (packageJson.main) {
37
+ args = [packageJson.main];
38
+ }
39
+ }
40
+ } catch (_) {
41
+ }
42
+ const env = {
43
+ ...process.env,
44
+ PORT: this.appPort.toString()
45
+ };
46
+ console.log(`[AppAdapter] Spawning non-Krnl app '${this.entityName}' in background (Port: ${this.appPort})...`);
47
+ this.childProcess = KrnlShell.spawn(command, args, {
48
+ cwd: this.appPath,
49
+ env,
50
+ stdio: "inherit"
51
+ });
52
+ let ready = false;
53
+ const timeout = 15e3;
54
+ const start = Date.now();
55
+ while (Date.now() - start < timeout) {
56
+ ready = await new Promise((resolve) => {
57
+ const socket = net.connect(this.appPort, "127.0.0.1");
58
+ socket.on("connect", () => {
59
+ socket.destroy();
60
+ resolve(true);
61
+ });
62
+ socket.on("error", () => resolve(false));
63
+ });
64
+ if (ready) break;
65
+ await new Promise((r) => setTimeout(r, 200));
66
+ }
67
+ if (!ready) {
68
+ throw new Error(`[AppAdapter] Non-Krnl app '${this.entityName}' failed to boot on port ${this.appPort} within 15s.`);
69
+ }
70
+ console.log(`[AppAdapter] Non-Krnl app '${this.entityName}' successfully booted.`);
71
+ }
72
+ async proxyRequest(req, res, subPath) {
73
+ if (this.appPort === -1) {
74
+ res.writeHead(503, { "Content-Type": "application/json" });
75
+ res.end(JSON.stringify({ status: "error", message: "Service Temporarily Unavailable: Sub-app not running." }));
76
+ return;
77
+ }
78
+ const options = {
79
+ hostname: "127.0.0.1",
80
+ port: this.appPort,
81
+ path: subPath,
82
+ method: req.method,
83
+ headers: req.headers
84
+ };
85
+ const proxyReq = http.request(options, (proxyRes) => {
86
+ res.writeHead(proxyRes.statusCode || 500, proxyRes.headers);
87
+ proxyRes.pipe(res);
88
+ });
89
+ proxyReq.on("error", (err) => {
90
+ res.writeHead(502, { "Content-Type": "application/json" });
91
+ res.end(JSON.stringify({ status: "error", message: `Bad Gateway: ${err.message}` }));
92
+ });
93
+ req.pipe(proxyReq);
94
+ }
95
+ dispose() {
96
+ if (this.childProcess) {
97
+ console.log(`[AppAdapter] Killing child process (PID: ${this.childProcess.pid}) for '${this.entityName}'`);
98
+ this.childProcess.kill("SIGTERM");
99
+ this.childProcess = null;
100
+ }
101
+ super.dispose();
102
+ }
103
+ };
104
+
105
+ export {
106
+ KrnlNonKrnlAppAdapter
107
+ };
@@ -0,0 +1,107 @@
1
+ import {
2
+ krnlSystemEntityBase
3
+ } from "./chunk-3UEZ7JQA.js";
4
+ import {
5
+ KrnlShell
6
+ } from "./chunk-GADIRLRS.js";
7
+
8
+ // src/core/K_LIB_Krnl_System_App_Adapter.ts
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import http from "http";
12
+ import net from "net";
13
+ var KrnlNonKrnlAppAdapter = class extends krnlSystemEntityBase {
14
+ childProcess = null;
15
+ appPort = -1;
16
+ appPath;
17
+ constructor(name, appPath) {
18
+ super(name, null, -1, "127.0.0.1", { Singleton: true, _skipMagneticLoading: true });
19
+ this.appPath = appPath;
20
+ this._isIngressNetworkMember = true;
21
+ this.unifiedHttpAdapter._handleRequest = async (req, res) => {
22
+ await this.proxyRequest(req, res, req.url || "/");
23
+ };
24
+ }
25
+ async startApp() {
26
+ this.appPort = await this._probeAvailablePort(11e3, "127.0.0.1");
27
+ let command = "node";
28
+ let args = ["."];
29
+ try {
30
+ const pkgPath = path.join(this.appPath, "package.json");
31
+ if (fs.existsSync(pkgPath)) {
32
+ const packageJson = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
33
+ if (packageJson.scripts?.start) {
34
+ command = "npm";
35
+ args = ["run", "start"];
36
+ } else if (packageJson.main) {
37
+ args = [packageJson.main];
38
+ }
39
+ }
40
+ } catch (_) {
41
+ }
42
+ const env = {
43
+ ...process.env,
44
+ PORT: this.appPort.toString()
45
+ };
46
+ console.log(`[AppAdapter] Spawning non-Krnl app '${this.entityName}' in background (Port: ${this.appPort})...`);
47
+ this.childProcess = KrnlShell.spawn(command, args, {
48
+ cwd: this.appPath,
49
+ env,
50
+ stdio: "inherit"
51
+ });
52
+ let ready = false;
53
+ const timeout = 15e3;
54
+ const start = Date.now();
55
+ while (Date.now() - start < timeout) {
56
+ ready = await new Promise((resolve) => {
57
+ const socket = net.connect(this.appPort, "127.0.0.1");
58
+ socket.on("connect", () => {
59
+ socket.destroy();
60
+ resolve(true);
61
+ });
62
+ socket.on("error", () => resolve(false));
63
+ });
64
+ if (ready) break;
65
+ await new Promise((r) => setTimeout(r, 200));
66
+ }
67
+ if (!ready) {
68
+ throw new Error(`[AppAdapter] Non-Krnl app '${this.entityName}' failed to boot on port ${this.appPort} within 15s.`);
69
+ }
70
+ console.log(`[AppAdapter] Non-Krnl app '${this.entityName}' successfully booted.`);
71
+ }
72
+ async proxyRequest(req, res, subPath) {
73
+ if (this.appPort === -1) {
74
+ res.writeHead(503, { "Content-Type": "application/json" });
75
+ res.end(JSON.stringify({ status: "error", message: "Service Temporarily Unavailable: Sub-app not running." }));
76
+ return;
77
+ }
78
+ const options = {
79
+ hostname: "127.0.0.1",
80
+ port: this.appPort,
81
+ path: subPath,
82
+ method: req.method,
83
+ headers: req.headers
84
+ };
85
+ const proxyReq = http.request(options, (proxyRes) => {
86
+ res.writeHead(proxyRes.statusCode || 500, proxyRes.headers);
87
+ proxyRes.pipe(res);
88
+ });
89
+ proxyReq.on("error", (err) => {
90
+ res.writeHead(502, { "Content-Type": "application/json" });
91
+ res.end(JSON.stringify({ status: "error", message: `Bad Gateway: ${err.message}` }));
92
+ });
93
+ req.pipe(proxyReq);
94
+ }
95
+ dispose() {
96
+ if (this.childProcess) {
97
+ console.log(`[AppAdapter] Killing child process (PID: ${this.childProcess.pid}) for '${this.entityName}'`);
98
+ this.childProcess.kill("SIGTERM");
99
+ this.childProcess = null;
100
+ }
101
+ super.dispose();
102
+ }
103
+ };
104
+
105
+ export {
106
+ KrnlNonKrnlAppAdapter
107
+ };
@@ -0,0 +1,82 @@
1
+ import {
2
+ subappLocalStorage
3
+ } from "./chunk-YUK6Q563.js";
4
+
5
+ // src/core/K_LIB_Krnl_SubApp_Registry.ts
6
+ import path from "path";
7
+ import { pathToFileURL } from "url";
8
+ var KrnlSubAppLoader = class {
9
+ /**
10
+ * Loads a single sub-app into the parent entity's _subAppRegistry.
11
+ *
12
+ * For 'local' mode the sub-app class is instantiated directly in the parent process.
13
+ * Networking is suppressed automatically because the entity is constructed inside the
14
+ * subappLocalStorage async context (sets _isSubApp = true) and _startSharedServer()
15
+ * returns early for sub-app entities.
16
+ *
17
+ * For 'worker' mode a worker_thread is spawned and a KrnlSubAppWorkerHost proxy is
18
+ * registered in its place. All calls transit via MessagePort — no TCP/HTTP involved.
19
+ */
20
+ static async load(parent, config) {
21
+ const mode = config.executionMode ?? "local";
22
+ const prefix = config.prefix.toLowerCase();
23
+ if (parent._subAppRegistry.has(prefix)) {
24
+ console.log(`[SubAppRegistry] Sub-app '${prefix}' already registered. Skipping.`);
25
+ return;
26
+ }
27
+ let entry;
28
+ if (mode === "local") {
29
+ const appDir = config.entryPath ? path.dirname(config.entryPath) : "";
30
+ let entity;
31
+ if (config.isKrnl === false || !config.ServiceClass) {
32
+ const { KrnlNonKrnlAppAdapter } = await import("./K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js");
33
+ const adapter = new KrnlNonKrnlAppAdapter(config.prefix, config.entryPath || "");
34
+ await adapter.startApp();
35
+ entity = adapter;
36
+ } else {
37
+ const options = { host: "0.0.0.0" };
38
+ if (config.entryPath) options.sourcePath = pathToFileURL(config.entryPath).href;
39
+ entity = await subappLocalStorage.run({ appPath: appDir }, async () => {
40
+ const inst = new config.ServiceClass(-1, options, ...config.constructorArgs ?? []);
41
+ if (typeof inst.boot === "function") {
42
+ try {
43
+ await inst.boot();
44
+ } catch (bootErr) {
45
+ console.warn(`[SubAppRegistry] Auto-boot warning on sub-app '${prefix}':`, bootErr.message || bootErr);
46
+ }
47
+ }
48
+ if (inst._magneticLoadPromise) {
49
+ await inst._magneticLoadPromise;
50
+ }
51
+ return inst;
52
+ });
53
+ }
54
+ if (typeof entity._resolveReady === "function") {
55
+ entity._resolveReady();
56
+ }
57
+ parent.hierarchyManager.addComponentEntityInstance(entity);
58
+ entry = {
59
+ prefix,
60
+ executionMode: "local",
61
+ entity,
62
+ addedAt: Date.now()
63
+ };
64
+ console.log(`[SubAppRegistry] Loaded sub-app '${prefix}' in LOCAL mode (in-process).`);
65
+ } else {
66
+ const { KrnlSubAppWorkerHost } = await import("./K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js");
67
+ const host = await KrnlSubAppWorkerHost.create(config);
68
+ entry = {
69
+ prefix,
70
+ executionMode: "worker",
71
+ entity: host,
72
+ addedAt: Date.now()
73
+ };
74
+ console.log(`[SubAppRegistry] Loaded sub-app '${prefix}' in WORKER mode (isolated thread).`);
75
+ }
76
+ parent._subAppRegistry.set(prefix, entry);
77
+ }
78
+ };
79
+
80
+ export {
81
+ KrnlSubAppLoader
82
+ };
@@ -0,0 +1,107 @@
1
+ import {
2
+ krnlSystemEntityBase
3
+ } from "./chunk-UGVVJKC6.js";
4
+ import {
5
+ KrnlShell
6
+ } from "./chunk-GADIRLRS.js";
7
+
8
+ // src/core/K_LIB_Krnl_System_App_Adapter.ts
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import http from "http";
12
+ import net from "net";
13
+ var KrnlNonKrnlAppAdapter = class extends krnlSystemEntityBase {
14
+ childProcess = null;
15
+ appPort = -1;
16
+ appPath;
17
+ constructor(name, appPath) {
18
+ super(name, null, -1, "127.0.0.1", { Singleton: true, _skipMagneticLoading: true });
19
+ this.appPath = appPath;
20
+ this._isIngressNetworkMember = true;
21
+ this.unifiedHttpAdapter._handleRequest = async (req, res) => {
22
+ await this.proxyRequest(req, res, req.url || "/");
23
+ };
24
+ }
25
+ async startApp() {
26
+ this.appPort = await this._probeAvailablePort(11e3, "127.0.0.1");
27
+ let command = "node";
28
+ let args = ["."];
29
+ try {
30
+ const pkgPath = path.join(this.appPath, "package.json");
31
+ if (fs.existsSync(pkgPath)) {
32
+ const packageJson = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
33
+ if (packageJson.scripts?.start) {
34
+ command = "npm";
35
+ args = ["run", "start"];
36
+ } else if (packageJson.main) {
37
+ args = [packageJson.main];
38
+ }
39
+ }
40
+ } catch (_) {
41
+ }
42
+ const env = {
43
+ ...process.env,
44
+ PORT: this.appPort.toString()
45
+ };
46
+ console.log(`[AppAdapter] Spawning non-Krnl app '${this.entityName}' in background (Port: ${this.appPort})...`);
47
+ this.childProcess = KrnlShell.spawn(command, args, {
48
+ cwd: this.appPath,
49
+ env,
50
+ stdio: "inherit"
51
+ });
52
+ let ready = false;
53
+ const timeout = 15e3;
54
+ const start = Date.now();
55
+ while (Date.now() - start < timeout) {
56
+ ready = await new Promise((resolve) => {
57
+ const socket = net.connect(this.appPort, "127.0.0.1");
58
+ socket.on("connect", () => {
59
+ socket.destroy();
60
+ resolve(true);
61
+ });
62
+ socket.on("error", () => resolve(false));
63
+ });
64
+ if (ready) break;
65
+ await new Promise((r) => setTimeout(r, 200));
66
+ }
67
+ if (!ready) {
68
+ throw new Error(`[AppAdapter] Non-Krnl app '${this.entityName}' failed to boot on port ${this.appPort} within 15s.`);
69
+ }
70
+ console.log(`[AppAdapter] Non-Krnl app '${this.entityName}' successfully booted.`);
71
+ }
72
+ async proxyRequest(req, res, subPath) {
73
+ if (this.appPort === -1) {
74
+ res.writeHead(503, { "Content-Type": "application/json" });
75
+ res.end(JSON.stringify({ status: "error", message: "Service Temporarily Unavailable: Sub-app not running." }));
76
+ return;
77
+ }
78
+ const options = {
79
+ hostname: "127.0.0.1",
80
+ port: this.appPort,
81
+ path: subPath,
82
+ method: req.method,
83
+ headers: req.headers
84
+ };
85
+ const proxyReq = http.request(options, (proxyRes) => {
86
+ res.writeHead(proxyRes.statusCode || 500, proxyRes.headers);
87
+ proxyRes.pipe(res);
88
+ });
89
+ proxyReq.on("error", (err) => {
90
+ res.writeHead(502, { "Content-Type": "application/json" });
91
+ res.end(JSON.stringify({ status: "error", message: `Bad Gateway: ${err.message}` }));
92
+ });
93
+ req.pipe(proxyReq);
94
+ }
95
+ dispose() {
96
+ if (this.childProcess) {
97
+ console.log(`[AppAdapter] Killing child process (PID: ${this.childProcess.pid}) for '${this.entityName}'`);
98
+ this.childProcess.kill("SIGTERM");
99
+ this.childProcess = null;
100
+ }
101
+ super.dispose();
102
+ }
103
+ };
104
+
105
+ export {
106
+ KrnlNonKrnlAppAdapter
107
+ };
@@ -0,0 +1,107 @@
1
+ import {
2
+ krnlSystemEntityBase
3
+ } from "./chunk-ZZFRJGXM.js";
4
+ import {
5
+ KrnlShell
6
+ } from "./chunk-GADIRLRS.js";
7
+
8
+ // src/core/K_LIB_Krnl_System_App_Adapter.ts
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import http from "http";
12
+ import net from "net";
13
+ var KrnlNonKrnlAppAdapter = class extends krnlSystemEntityBase {
14
+ childProcess = null;
15
+ appPort = -1;
16
+ appPath;
17
+ constructor(name, appPath) {
18
+ super(name, null, -1, "127.0.0.1", { Singleton: true, _skipMagneticLoading: true });
19
+ this.appPath = appPath;
20
+ this._isIngressNetworkMember = true;
21
+ this.unifiedHttpAdapter._handleRequest = async (req, res) => {
22
+ await this.proxyRequest(req, res, req.url || "/");
23
+ };
24
+ }
25
+ async startApp() {
26
+ this.appPort = await this._probeAvailablePort(11e3, "127.0.0.1");
27
+ let command = "node";
28
+ let args = ["."];
29
+ try {
30
+ const pkgPath = path.join(this.appPath, "package.json");
31
+ if (fs.existsSync(pkgPath)) {
32
+ const packageJson = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
33
+ if (packageJson.scripts?.start) {
34
+ command = "npm";
35
+ args = ["run", "start"];
36
+ } else if (packageJson.main) {
37
+ args = [packageJson.main];
38
+ }
39
+ }
40
+ } catch (_) {
41
+ }
42
+ const env = {
43
+ ...process.env,
44
+ PORT: this.appPort.toString()
45
+ };
46
+ console.log(`[AppAdapter] Spawning non-Krnl app '${this.entityName}' in background (Port: ${this.appPort})...`);
47
+ this.childProcess = KrnlShell.spawn(command, args, {
48
+ cwd: this.appPath,
49
+ env,
50
+ stdio: "inherit"
51
+ });
52
+ let ready = false;
53
+ const timeout = 15e3;
54
+ const start = Date.now();
55
+ while (Date.now() - start < timeout) {
56
+ ready = await new Promise((resolve) => {
57
+ const socket = net.connect(this.appPort, "127.0.0.1");
58
+ socket.on("connect", () => {
59
+ socket.destroy();
60
+ resolve(true);
61
+ });
62
+ socket.on("error", () => resolve(false));
63
+ });
64
+ if (ready) break;
65
+ await new Promise((r) => setTimeout(r, 200));
66
+ }
67
+ if (!ready) {
68
+ throw new Error(`[AppAdapter] Non-Krnl app '${this.entityName}' failed to boot on port ${this.appPort} within 15s.`);
69
+ }
70
+ console.log(`[AppAdapter] Non-Krnl app '${this.entityName}' successfully booted.`);
71
+ }
72
+ async proxyRequest(req, res, subPath) {
73
+ if (this.appPort === -1) {
74
+ res.writeHead(503, { "Content-Type": "application/json" });
75
+ res.end(JSON.stringify({ status: "error", message: "Service Temporarily Unavailable: Sub-app not running." }));
76
+ return;
77
+ }
78
+ const options = {
79
+ hostname: "127.0.0.1",
80
+ port: this.appPort,
81
+ path: subPath,
82
+ method: req.method,
83
+ headers: req.headers
84
+ };
85
+ const proxyReq = http.request(options, (proxyRes) => {
86
+ res.writeHead(proxyRes.statusCode || 500, proxyRes.headers);
87
+ proxyRes.pipe(res);
88
+ });
89
+ proxyReq.on("error", (err) => {
90
+ res.writeHead(502, { "Content-Type": "application/json" });
91
+ res.end(JSON.stringify({ status: "error", message: `Bad Gateway: ${err.message}` }));
92
+ });
93
+ req.pipe(proxyReq);
94
+ }
95
+ dispose() {
96
+ if (this.childProcess) {
97
+ console.log(`[AppAdapter] Killing child process (PID: ${this.childProcess.pid}) for '${this.entityName}'`);
98
+ this.childProcess.kill("SIGTERM");
99
+ this.childProcess = null;
100
+ }
101
+ super.dispose();
102
+ }
103
+ };
104
+
105
+ export {
106
+ KrnlNonKrnlAppAdapter
107
+ };
@@ -0,0 +1,173 @@
1
+ // src/core/K_LIB_Krnl_Telemetry.ts
2
+ var KrnlTelemetry = class {
3
+ metrics;
4
+ callLogs;
5
+ libraryUsage;
6
+ dataUsage;
7
+ enabled;
8
+ ringBufferSize;
9
+ aiTraces;
10
+ totalAiCalls;
11
+ totalAiRetries;
12
+ avgAiLatencyMs;
13
+ runtimeStore = null;
14
+ constructor() {
15
+ this.metrics = /* @__PURE__ */ new Map();
16
+ this.callLogs = /* @__PURE__ */ new Map();
17
+ this.libraryUsage = /* @__PURE__ */ new Map();
18
+ this.dataUsage = /* @__PURE__ */ new Map();
19
+ this.enabled = false;
20
+ this.ringBufferSize = 100;
21
+ this.aiTraces = [];
22
+ this.totalAiCalls = 0;
23
+ this.totalAiRetries = 0;
24
+ this.avgAiLatencyMs = 0;
25
+ }
26
+ setRuntimeStore(store) {
27
+ this.runtimeStore = store;
28
+ }
29
+ recordAiTrace(trace) {
30
+ if (this.aiTraces.length >= this.ringBufferSize) {
31
+ this.aiTraces.shift();
32
+ }
33
+ this.aiTraces.push(trace);
34
+ this.totalAiCalls++;
35
+ this.totalAiRetries += trace.retryCount || 0;
36
+ this.avgAiLatencyMs = (this.avgAiLatencyMs * (this.totalAiCalls - 1) + trace.latencyMs) / this.totalAiCalls;
37
+ if (this.runtimeStore) {
38
+ this.runtimeStore.appendTelemetry({
39
+ type: "ai_trace",
40
+ endpointId: trace.endpointId,
41
+ timestamp: trace.timestamp,
42
+ latencyMs: trace.latencyMs,
43
+ retryCount: trace.retryCount,
44
+ success: !trace.failureReason,
45
+ failures: trace.validationFailures
46
+ }).catch(() => {
47
+ });
48
+ }
49
+ }
50
+ /**
51
+ * Starts a telemetry trace for a specific functionality.
52
+ * @param fid
53
+ * @returns Trace data
54
+ */
55
+ startTrace(fid) {
56
+ return {
57
+ startTime: process.hrtime.bigint(),
58
+ startMemory: process.memoryUsage ? process.memoryUsage().heapUsed : 0
59
+ };
60
+ }
61
+ /**
62
+ * Ends a telemetry trace and updates aggregated metrics.
63
+ * @param fid
64
+ * @param trace
65
+ */
66
+ endTrace(fid, trace, success = true) {
67
+ const endTime = process.hrtime.bigint();
68
+ const endMemory = process.memoryUsage ? process.memoryUsage().heapUsed : 0;
69
+ const latencyNs = Number(endTime - trace.startTime);
70
+ const memoryDelta = endMemory - trace.startMemory;
71
+ const latencyMs = latencyNs / 1e6;
72
+ let stats = this.metrics.get(fid);
73
+ if (!stats) {
74
+ stats = {
75
+ calls: 0,
76
+ errors: 0,
77
+ totalLatencyNs: 0,
78
+ avgLatencyMs: 0,
79
+ peakLatencyMs: 0,
80
+ totalMemoryDelta: 0,
81
+ avgMemoryDelta: 0,
82
+ lastUpdated: 0
83
+ };
84
+ this.metrics.set(fid, stats);
85
+ }
86
+ stats.calls++;
87
+ if (!success) stats.errors++;
88
+ stats.totalLatencyNs += latencyNs;
89
+ stats.totalMemoryDelta += memoryDelta;
90
+ stats.avgLatencyMs = stats.totalLatencyNs / stats.calls / 1e6;
91
+ stats.avgMemoryDelta = stats.totalMemoryDelta / stats.calls;
92
+ if (latencyMs > stats.peakLatencyMs) stats.peakLatencyMs = latencyMs;
93
+ stats.lastUpdated = Date.now();
94
+ if (this.enabled) {
95
+ let logs = this.callLogs.get(fid);
96
+ if (!logs) {
97
+ logs = [];
98
+ this.callLogs.set(fid, logs);
99
+ }
100
+ logs.push({
101
+ timestamp: Date.now(),
102
+ durationMs: latencyMs,
103
+ success
104
+ });
105
+ if (logs.length > this.ringBufferSize) {
106
+ logs.shift();
107
+ }
108
+ }
109
+ if (this.runtimeStore) {
110
+ this.runtimeStore.appendTelemetry({
111
+ type: "standard_call",
112
+ endpointId: fid,
113
+ timestamp: Date.now(),
114
+ durationMs: latencyMs,
115
+ success
116
+ }).catch(() => {
117
+ });
118
+ }
119
+ }
120
+ /**
121
+ * Record library usage (functions/helpers).
122
+ */
123
+ recordLibraryCall(libraryId, durationMs) {
124
+ if (!this.enabled) return;
125
+ let stats = this.libraryUsage.get(libraryId);
126
+ if (!stats) {
127
+ stats = { calls: 0, totalDurationMs: 0, avgDurationMs: 0 };
128
+ this.libraryUsage.set(libraryId, stats);
129
+ }
130
+ stats.calls++;
131
+ stats.totalDurationMs += durationMs;
132
+ stats.avgDurationMs = stats.totalDurationMs / stats.calls;
133
+ }
134
+ /**
135
+ * Record library data access.
136
+ */
137
+ recordDataAccess(dataKey, type = "read") {
138
+ if (!this.enabled) return;
139
+ let stats = this.dataUsage.get(dataKey);
140
+ if (!stats) {
141
+ stats = { reads: 0, writes: 0 };
142
+ this.dataUsage.set(dataKey, stats);
143
+ }
144
+ if (type === "read") stats.reads++;
145
+ else stats.writes++;
146
+ }
147
+ /**
148
+ * Returns a snapshot of all metrics.
149
+ */
150
+ getSummary() {
151
+ return {
152
+ metrics: Object.fromEntries(this.metrics),
153
+ callLogs: Object.fromEntries(this.callLogs),
154
+ libraryUsage: Object.fromEntries(this.libraryUsage),
155
+ dataUsage: Object.fromEntries(this.dataUsage)
156
+ };
157
+ }
158
+ /**
159
+ * Clears all collected metrics.
160
+ */
161
+ reset() {
162
+ this.metrics.clear();
163
+ this.callLogs.clear();
164
+ this.libraryUsage.clear();
165
+ this.dataUsage.clear();
166
+ }
167
+ };
168
+ var telemetry = new KrnlTelemetry();
169
+
170
+ export {
171
+ KrnlTelemetry,
172
+ telemetry
173
+ };