@ultrst-armada/krnl 1.0.1 → 1.0.3

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 (235) hide show
  1. package/README.md +67 -65
  2. package/package.json +13 -9
  3. package/packages/cli/dist/bin/krnl.cjs +1535 -9508
  4. package/packages/cli/dist/bin/krnl.js +55 -1915
  5. package/packages/cli/dist/chunk-6SHSECXR.js +1628 -0
  6. package/packages/cli/dist/index.cjs +1244 -7373
  7. package/packages/cli/dist/index.d.cts +45 -2
  8. package/packages/cli/dist/index.d.ts +45 -2
  9. package/packages/cli/dist/index.js +5 -20
  10. package/packages/cli/package.json +17 -10
  11. package/packages/core/dist/index.cjs +3039 -141
  12. package/packages/core/dist/index.d.cts +633 -27
  13. package/packages/core/dist/index.d.ts +633 -27
  14. package/packages/core/dist/index.js +3028 -139
  15. package/packages/core/package.json +15 -7
  16. package/packages/create-krnl/dist/index.cjs +322 -316
  17. package/packages/create-krnl/dist/index.js +322 -316
  18. package/packages/create-krnl/package.json +5 -3
  19. package/packages/eslint-plugin/dist/index.cjs +17 -55
  20. package/packages/eslint-plugin/dist/index.d.cts +8 -43
  21. package/packages/eslint-plugin/dist/index.d.ts +8 -43
  22. package/packages/eslint-plugin/dist/index.js +17 -55
  23. package/packages/eslint-plugin/package.json +5 -4
  24. package/packages/validate/dist/index.cjs +692 -361
  25. package/packages/validate/dist/index.d.cts +12 -14
  26. package/packages/validate/dist/index.d.ts +12 -14
  27. package/packages/validate/dist/index.js +692 -361
  28. package/packages/validate/package.json +14 -7
  29. package/packages/cli/dist/K_ENT_Entity-PQ5MURQY-ZG6FZXXX.js +0 -13
  30. package/packages/cli/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-K4CRQYA5.js +0 -8
  31. package/packages/cli/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-LNPXZYOE.js +0 -110
  32. package/packages/cli/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-3ALZPNX4.js +0 -11
  33. package/packages/cli/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-PJTICYSW.js +0 -11
  34. package/packages/cli/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-M5TYU55O.js +0 -8
  35. package/packages/cli/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-H6STOXRK.js +0 -20
  36. package/packages/cli/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-XPJXSF7D.js +0 -19
  37. package/packages/cli/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-CUYGTWOW.js +0 -7
  38. package/packages/cli/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-VR6T4N6J.js +0 -17
  39. package/packages/cli/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-RLJ4QWDP.js +0 -58
  40. package/packages/cli/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-BOQGUASC.js +0 -22
  41. package/packages/cli/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-XJI7KIT5.js +0 -8
  42. package/packages/cli/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-K5VCWAFW.js +0 -9
  43. package/packages/cli/dist/chunk-3TRM6CYL.js +0 -152
  44. package/packages/cli/dist/chunk-5JDK35TG.js +0 -3872
  45. package/packages/cli/dist/chunk-63PTK33I.js +0 -997
  46. package/packages/cli/dist/chunk-6NIKAMUZ.js +0 -82
  47. package/packages/cli/dist/chunk-BOXWWXQG.js +0 -400
  48. package/packages/cli/dist/chunk-EEKLK7QJ.js +0 -565
  49. package/packages/cli/dist/chunk-EG7T2IAD.js +0 -107
  50. package/packages/cli/dist/chunk-F5EHXE2O.js +0 -1036
  51. package/packages/cli/dist/chunk-F65ANSQG.js +0 -269
  52. package/packages/cli/dist/chunk-FDNCADFE.js +0 -71
  53. package/packages/cli/dist/chunk-GDLRMDAN.js +0 -127
  54. package/packages/cli/dist/chunk-HWMTCMOS.js +0 -656
  55. package/packages/cli/dist/chunk-I74QIQOD.js +0 -5536
  56. package/packages/cli/dist/chunk-JTLSTO25.js +0 -71
  57. package/packages/cli/dist/chunk-JULBBJ27.js +0 -1033
  58. package/packages/cli/dist/chunk-OHVMVRBP.js +0 -117
  59. package/packages/cli/dist/chunk-P2PCLEKX.js +0 -666
  60. package/packages/cli/dist/chunk-PJQIUOX2.js +0 -7767
  61. package/packages/cli/dist/chunk-PPOF3DJW.js +0 -471
  62. package/packages/cli/dist/chunk-Q45257P6.js +0 -173
  63. package/packages/cli/dist/chunk-QNROWGBI.js +0 -1036
  64. package/packages/cli/dist/chunk-RJNYUXZD.js +0 -977
  65. package/packages/cli/dist/chunk-SRTOPJ5W.js +0 -104
  66. package/packages/cli/dist/chunk-TCEX3MPS.js +0 -702
  67. package/packages/cli/dist/chunk-TNOAJO2J.js +0 -675
  68. package/packages/cli/dist/chunk-UR2SUCSF.js +0 -701
  69. package/packages/cli/dist/chunk-X5LOIFM7.js +0 -68
  70. package/packages/cli/dist/chunk-XIRFOO3H.js +0 -589
  71. package/packages/cli/dist/chunk-ZAAV3JXQ.js +0 -809
  72. package/packages/core/dist/K_ENT_Entity-4MB7CU4A.js +0 -12
  73. package/packages/core/dist/K_ENT_Entity-DEJGIDGH.js +0 -12
  74. package/packages/core/dist/K_ENT_Entity-FXZO5UZ2.js +0 -12
  75. package/packages/core/dist/K_ENT_Entity-HDSCXC5F.js +0 -12
  76. package/packages/core/dist/K_ENT_Entity-JILABHLW.js +0 -12
  77. package/packages/core/dist/K_ENT_Entity-PQ5MURQY.js +0 -13
  78. package/packages/core/dist/K_ENT_Entity-ROAKDIHW.js +0 -12
  79. package/packages/core/dist/K_ENT_Entity-TBVFSKDV.js +0 -12
  80. package/packages/core/dist/K_ENT_Entity-ZFLKG3JO.js +0 -12
  81. package/packages/core/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW.js +0 -8
  82. package/packages/core/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF.js +0 -110
  83. package/packages/core/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF.js +0 -9
  84. package/packages/core/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X.js +0 -9
  85. package/packages/core/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW.js +0 -8
  86. package/packages/core/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2.js +0 -20
  87. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-4C6GBQAG.js +0 -18
  88. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-6V23A6F6.js +0 -18
  89. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK.js +0 -19
  90. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-DYLLC5G2.js +0 -18
  91. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-F4FOFAUP.js +0 -18
  92. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-FBOXXMI3.js +0 -18
  93. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-Q73BWLNP.js +0 -18
  94. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QM2C4MVA.js +0 -18
  95. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QUGI6SMP.js +0 -18
  96. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RGMTBHNP.js +0 -18
  97. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RWR7UNDW.js +0 -18
  98. package/packages/core/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js +0 -7
  99. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-32MFJJ5Z.js +0 -17
  100. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-4J4CEWRY.js +0 -17
  101. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-A366YHF2.js +0 -17
  102. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-LK4LYJHI.js +0 -17
  103. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js +0 -17
  104. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-NW3K63II.js +0 -17
  105. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-QDHTI5ZV.js +0 -17
  106. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-VHCT6VIW.js +0 -17
  107. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-WBRKF24R.js +0 -17
  108. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-XKYQYT6Q.js +0 -17
  109. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-Z2PWZYDZ.js +0 -17
  110. package/packages/core/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5.js +0 -58
  111. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-2EZU7QF4.js +0 -21
  112. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-6G3AQNAV.js +0 -21
  113. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-B2NZMQUG.js +0 -21
  114. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-C2RABMZP.js +0 -21
  115. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-HHE3NZ4F.js +0 -21
  116. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-LHFGR6WK.js +0 -21
  117. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-M74BLM3N.js +0 -21
  118. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-PT6ZA6EA.js +0 -21
  119. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-SP52V3CX.js +0 -21
  120. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF.js +0 -22
  121. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-YNSEUHJJ.js +0 -21
  122. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-M6SBHIVA.js +0 -8
  123. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG.js +0 -8
  124. package/packages/core/dist/K_LIB_Krnl_Telemetry-77FRZ3KV.js +0 -9
  125. package/packages/core/dist/chunk-33L2J7V7.js +0 -82
  126. package/packages/core/dist/chunk-3ES4K2ZP.js +0 -817
  127. package/packages/core/dist/chunk-3SMHVVLL.js +0 -82
  128. package/packages/core/dist/chunk-3UEZ7JQA.js +0 -4877
  129. package/packages/core/dist/chunk-3XIE6KBD.js +0 -4877
  130. package/packages/core/dist/chunk-46ZLCML6.js +0 -107
  131. package/packages/core/dist/chunk-4UEL3DWJ.js +0 -107
  132. package/packages/core/dist/chunk-54GWZ5PC.js +0 -82
  133. package/packages/core/dist/chunk-6QCYRS5L.js +0 -127
  134. package/packages/core/dist/chunk-6ULMHNXR.js +0 -104
  135. package/packages/core/dist/chunk-7WUETJEV.js +0 -117
  136. package/packages/core/dist/chunk-A5KRAYDB.js +0 -107
  137. package/packages/core/dist/chunk-ANEAZ3PO.js +0 -107
  138. package/packages/core/dist/chunk-BE76RL6F.js +0 -82
  139. package/packages/core/dist/chunk-CIARVYDO.js +0 -107
  140. package/packages/core/dist/chunk-CR2ANE62.js +0 -107
  141. package/packages/core/dist/chunk-DI27MOR7.js +0 -173
  142. package/packages/core/dist/chunk-E6RLFHM5.js +0 -596
  143. package/packages/core/dist/chunk-EELAPMNV.js +0 -4877
  144. package/packages/core/dist/chunk-ENZ2RQVJ.js +0 -107
  145. package/packages/core/dist/chunk-F2U6CX4F.js +0 -4877
  146. package/packages/core/dist/chunk-FKG64OHL.js +0 -82
  147. package/packages/core/dist/chunk-FYAZJYM5.js +0 -772
  148. package/packages/core/dist/chunk-G4NP4RDQ.js +0 -82
  149. package/packages/core/dist/chunk-GADIRLRS.js +0 -473
  150. package/packages/core/dist/chunk-GR6CSLQJ.js +0 -772
  151. package/packages/core/dist/chunk-HDS7AT6O.js +0 -772
  152. package/packages/core/dist/chunk-HIMEZUU2.js +0 -71
  153. package/packages/core/dist/chunk-IB4UHG5I.js +0 -596
  154. package/packages/core/dist/chunk-J7ZYNVRS.js +0 -772
  155. package/packages/core/dist/chunk-JVLZU4K7.js +0 -604
  156. package/packages/core/dist/chunk-JYXXI7Q3.js +0 -82
  157. package/packages/core/dist/chunk-K54K2KZW.js +0 -192
  158. package/packages/core/dist/chunk-K6VHLBNH.js +0 -3316
  159. package/packages/core/dist/chunk-KCBP7ZYA.js +0 -596
  160. package/packages/core/dist/chunk-KFQGP6VL.js +0 -33
  161. package/packages/core/dist/chunk-KIUEUI7K.js +0 -82
  162. package/packages/core/dist/chunk-LB67NIZP.js +0 -949
  163. package/packages/core/dist/chunk-LDTYFUNW.js +0 -596
  164. package/packages/core/dist/chunk-MLVWARD4.js +0 -596
  165. package/packages/core/dist/chunk-MPYVXHKO.js +0 -2777
  166. package/packages/core/dist/chunk-MRQ3MITU.js +0 -772
  167. package/packages/core/dist/chunk-MVUN7I7O.js +0 -107
  168. package/packages/core/dist/chunk-NDDOIRW7.js +0 -596
  169. package/packages/core/dist/chunk-O3KDB5MH.js +0 -3330
  170. package/packages/core/dist/chunk-OEINUDSE.js +0 -400
  171. package/packages/core/dist/chunk-OPDENPT4.js +0 -4877
  172. package/packages/core/dist/chunk-P6XEM2LA.js +0 -429
  173. package/packages/core/dist/chunk-QKMRSQV4.js +0 -82
  174. package/packages/core/dist/chunk-R6CCWALL.js +0 -4877
  175. package/packages/core/dist/chunk-RAMMOO73.js +0 -774
  176. package/packages/core/dist/chunk-S3FTZFG6.js +0 -772
  177. package/packages/core/dist/chunk-T2ZVN434.js +0 -4877
  178. package/packages/core/dist/chunk-TFHLDMIA.js +0 -107
  179. package/packages/core/dist/chunk-TI3QUCIJ.js +0 -107
  180. package/packages/core/dist/chunk-TR2BAIGI.js +0 -107
  181. package/packages/core/dist/chunk-UGVVJKC6.js +0 -4877
  182. package/packages/core/dist/chunk-V2DX7YIU.js +0 -984
  183. package/packages/core/dist/chunk-W4IHYUYD.js +0 -772
  184. package/packages/core/dist/chunk-W6WBG5OY.js +0 -4877
  185. package/packages/core/dist/chunk-WN3M7O7H.js +0 -3312
  186. package/packages/core/dist/chunk-WR3NCU7U.js +0 -4877
  187. package/packages/core/dist/chunk-XC6B6L27.js +0 -82
  188. package/packages/core/dist/chunk-XNSE64ZY.js +0 -3316
  189. package/packages/core/dist/chunk-XROES2WN.js +0 -634
  190. package/packages/core/dist/chunk-XSCKNRCZ.js +0 -5020
  191. package/packages/core/dist/chunk-XVABPAUZ.js +0 -82
  192. package/packages/core/dist/chunk-YOBCB5C5.js +0 -596
  193. package/packages/core/dist/chunk-YUK6Q563.js +0 -666
  194. package/packages/core/dist/chunk-YXGL3ZEU.js +0 -1030
  195. package/packages/core/dist/chunk-ZINJ5OUX.js +0 -596
  196. package/packages/core/dist/chunk-ZPFD4BIQ.js +0 -604
  197. package/packages/core/dist/chunk-ZQZBFG6F.js +0 -4826
  198. package/packages/core/dist/chunk-ZZFRJGXM.js +0 -4877
  199. package/packages/create-krnl/dist/K_ENT_Entity-PQ5MURQY-R2OH4VXE.js +0 -14
  200. package/packages/create-krnl/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-AZM5HF4M.js +0 -9
  201. package/packages/create-krnl/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-X5N6SV2S.js +0 -111
  202. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-5PFHF4JU.js +0 -12
  203. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-ED33OQPH.js +0 -12
  204. package/packages/create-krnl/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-YGQLVR4P.js +0 -9
  205. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-VM7CTU2L.js +0 -21
  206. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-Y2GQFJ7I.js +0 -21
  207. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-L3JQWO54.js +0 -8
  208. package/packages/create-krnl/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-KQARASPR.js +0 -19
  209. package/packages/create-krnl/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-OF3IGLVL.js +0 -59
  210. package/packages/create-krnl/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-JOLHKOEX.js +0 -24
  211. package/packages/create-krnl/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-L46LSHKQ.js +0 -10
  212. package/packages/create-krnl/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-4JUPRR3X.js +0 -10
  213. package/packages/create-krnl/dist/chunk-3TRM6CYL.js +0 -152
  214. package/packages/create-krnl/dist/chunk-3URCB3QS.js +0 -127
  215. package/packages/create-krnl/dist/chunk-5JDK35TG.js +0 -3872
  216. package/packages/create-krnl/dist/chunk-A2XAXDOW.js +0 -812
  217. package/packages/create-krnl/dist/chunk-AN6TMQHG.js +0 -1033
  218. package/packages/create-krnl/dist/chunk-BOXWWXQG.js +0 -400
  219. package/packages/create-krnl/dist/chunk-BPTBREBG.js +0 -38
  220. package/packages/create-krnl/dist/chunk-FDNCADFE.js +0 -71
  221. package/packages/create-krnl/dist/chunk-JTLSTO25.js +0 -71
  222. package/packages/create-krnl/dist/chunk-M3NCUIPL.js +0 -107
  223. package/packages/create-krnl/dist/chunk-N2EONSOC.js +0 -7769
  224. package/packages/create-krnl/dist/chunk-OHVMVRBP.js +0 -117
  225. package/packages/create-krnl/dist/chunk-Q45257P6.js +0 -173
  226. package/packages/create-krnl/dist/chunk-QGM4M3NI.js +0 -37
  227. package/packages/create-krnl/dist/chunk-RJNYUXZD.js +0 -977
  228. package/packages/create-krnl/dist/chunk-SRTOPJ5W.js +0 -104
  229. package/packages/create-krnl/dist/chunk-UPBIGEC3.js +0 -666
  230. package/packages/create-krnl/dist/chunk-V2DB7UD7.js +0 -82
  231. package/packages/create-krnl/dist/chunk-WMHLIUI6.js +0 -3644
  232. package/packages/create-krnl/dist/chunk-XIRFOO3H.js +0 -589
  233. package/packages/create-krnl/dist/chunk-Y2CEEVZP.js +0 -5536
  234. package/packages/create-krnl/dist/main-DXUMPBND.js +0 -2217
  235. package/packages/create-krnl/dist/wrapper-SDF2VKX3.js +0 -31
@@ -1,82 +0,0 @@
1
- import {
2
- subappLocalStorage
3
- } from "./chunk-ZINJ5OUX.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-32MFJJ5Z.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
- };
@@ -1,473 +0,0 @@
1
- import {
2
- KrnlHTTP
3
- } from "./chunk-MLVWARD4.js";
4
-
5
- // src/tools/StringKit.js
6
- var StringKit = class _StringKit {
7
- static toCamelCase(str) {
8
- return str.replace(/[-_]+/g, " ").replace(/[^\w\s]/g, "").replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => index === 0 ? word.toLowerCase() : word.toUpperCase()).replace(/\s+/g, "");
9
- }
10
- static toPascalCase(str) {
11
- const camel = _StringKit.toCamelCase(str);
12
- return camel.charAt(0).toUpperCase() + camel.slice(1);
13
- }
14
- static toSnakeCase(str) {
15
- return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`).replace(/[-_\s]+/g, "_").replace(/^[_\s]+|[_\s]+$/g, "").toLowerCase();
16
- }
17
- static toKebabCase(str) {
18
- return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`).replace(/[-_\s]+/g, "-").replace(/^[-_\s]+|[-_\s]+$/g, "").toLowerCase();
19
- }
20
- static toScreamingSnake(str) {
21
- return _StringKit.toSnakeCase(str).toUpperCase();
22
- }
23
- static toSlug(str) {
24
- return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9\s-_]/g, "").replace(/[\s-_]+/g, "-").replace(/^-+|-+$/g, "");
25
- }
26
- static generateUUID() {
27
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
28
- return crypto.randomUUID();
29
- }
30
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
31
- const r = Math.random() * 16 | 0;
32
- const v = c === "x" ? r : r & 3 | 8;
33
- return v.toString(16);
34
- });
35
- }
36
- static generateShortId(length = 8) {
37
- const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
38
- let result = "";
39
- for (let i = 0; i < length; i++) {
40
- result += chars.charAt(Math.random() * chars.length | 0);
41
- }
42
- return result;
43
- }
44
- static generatePrefixedId(prefix, length = 8) {
45
- return `${prefix}-${_StringKit.generateShortId(length)}`;
46
- }
47
- static interpolate(tmpl, data) {
48
- return tmpl.replace(/\{\{\s*(\w+)\s*\}\}/g, (_, key) => {
49
- return data[key] !== void 0 ? String(data[key]) : `{{${key}}}`;
50
- });
51
- }
52
- };
53
-
54
- // src/tools/CacheKit.js
55
- import fs from "fs";
56
- import path from "path";
57
- var LRUCache = class {
58
- maxSize;
59
- cache;
60
- constructor(maxSize) {
61
- this.maxSize = maxSize;
62
- this.cache = /* @__PURE__ */ new Map();
63
- }
64
- get(key) {
65
- if (!this.cache.has(key))
66
- return void 0;
67
- const val = this.cache.get(key);
68
- this.cache.delete(key);
69
- this.cache.set(key, val);
70
- return val;
71
- }
72
- set(key, value) {
73
- if (this.cache.has(key)) {
74
- this.cache.delete(key);
75
- } else if (this.cache.size >= this.maxSize) {
76
- const firstKey = this.cache.keys().next().value;
77
- if (firstKey !== void 0)
78
- this.cache.delete(firstKey);
79
- }
80
- this.cache.set(key, value);
81
- }
82
- delete(key) {
83
- return this.cache.delete(key);
84
- }
85
- clear() {
86
- this.cache.clear();
87
- }
88
- size() {
89
- return this.cache.size;
90
- }
91
- };
92
- var TTLCache = class {
93
- ttlMs;
94
- cache;
95
- constructor(ttlMs) {
96
- this.ttlMs = ttlMs;
97
- this.cache = /* @__PURE__ */ new Map();
98
- }
99
- get(key) {
100
- const entry = this.cache.get(key);
101
- if (!entry)
102
- return null;
103
- if (Date.now() > entry.expires) {
104
- this.cache.delete(key);
105
- return null;
106
- }
107
- return entry.value;
108
- }
109
- set(key, value) {
110
- this.cache.set(key, {
111
- value,
112
- expires: Date.now() + this.ttlMs
113
- });
114
- }
115
- delete(key) {
116
- return this.cache.delete(key);
117
- }
118
- clear() {
119
- this.cache.clear();
120
- }
121
- };
122
- var CacheKit = class {
123
- /**
124
- * Stale-While-Revalidate utility.
125
- */
126
- static swr(cache, key, fetchFn) {
127
- const cached = cache.get(key);
128
- if (cached !== null) {
129
- setTimeout(() => {
130
- fetchFn().then((fresh) => cache.set(key, fresh)).catch(() => {
131
- });
132
- }, 0);
133
- return Promise.resolve(cached);
134
- }
135
- return fetchFn().then((fresh) => {
136
- cache.set(key, fresh);
137
- return fresh;
138
- });
139
- }
140
- };
141
- var FileCache = class {
142
- cacheDir;
143
- constructor(cacheDir) {
144
- this.cacheDir = cacheDir;
145
- try {
146
- if (!fs.existsSync(cacheDir)) {
147
- fs.mkdirSync(cacheDir, { recursive: true });
148
- }
149
- } catch (e) {
150
- }
151
- }
152
- getFilePath(key) {
153
- return path.join(this.cacheDir, `${encodeURIComponent(key)}.json`);
154
- }
155
- get(key) {
156
- const file = this.getFilePath(key);
157
- if (!fs.existsSync(file))
158
- return null;
159
- try {
160
- const content = fs.readFileSync(file, "utf8");
161
- return JSON.parse(content);
162
- } catch (e) {
163
- return null;
164
- }
165
- }
166
- set(key, value) {
167
- const file = this.getFilePath(key);
168
- try {
169
- fs.writeFileSync(file, JSON.stringify(value, null, 2), "utf8");
170
- } catch (e) {
171
- }
172
- }
173
- delete(key) {
174
- const file = this.getFilePath(key);
175
- if (fs.existsSync(file)) {
176
- try {
177
- fs.unlinkSync(file);
178
- } catch (e) {
179
- }
180
- }
181
- }
182
- clear() {
183
- try {
184
- const files = fs.readdirSync(this.cacheDir);
185
- for (const file of files) {
186
- fs.unlinkSync(path.join(this.cacheDir, file));
187
- }
188
- } catch (e) {
189
- }
190
- }
191
- };
192
-
193
- // src/tools/KrnlEnv.js
194
- import fs2 from "fs";
195
- import path2 from "path";
196
- var KrnlEnv = class {
197
- /**
198
- * Reads a process environment variable with type coercion and defaults.
199
- */
200
- static get(key, defaultValue) {
201
- const val = process.env[key];
202
- if (val === void 0) {
203
- if (defaultValue !== void 0)
204
- return defaultValue;
205
- throw new Error(`[KrnlEnvError] Missing required environment variable: ${key}`);
206
- }
207
- if (typeof defaultValue === "number") {
208
- const num = Number(val);
209
- if (isNaN(num)) {
210
- throw new Error(`[KrnlEnvError] Expected number for ${key}, received: ${val}`);
211
- }
212
- return num;
213
- }
214
- if (typeof defaultValue === "boolean") {
215
- return val === "true" || val === "1";
216
- }
217
- try {
218
- if (defaultValue && typeof defaultValue === "object") {
219
- return JSON.parse(val);
220
- }
221
- } catch (e) {
222
- }
223
- return val;
224
- }
225
- /**
226
- * Asserts environment variable is set and returns its string value.
227
- */
228
- static require(key) {
229
- const val = process.env[key];
230
- if (val === void 0) {
231
- throw new Error(`[KrnlEnvError] Missing required environment variable: ${key}`);
232
- }
233
- return val;
234
- }
235
- /**
236
- * Loads a .env file and injects variables into process.env.
237
- */
238
- static load(filePath) {
239
- const file = filePath || path2.join(process.cwd(), ".env");
240
- if (!fs2.existsSync(file))
241
- return;
242
- try {
243
- const content = fs2.readFileSync(file, "utf8");
244
- const lines = content.split(/\r?\n/);
245
- for (const line of lines) {
246
- const trimmed = line.trim();
247
- if (!trimmed || trimmed.startsWith("#"))
248
- continue;
249
- const equalsIndex = trimmed.indexOf("=");
250
- if (equalsIndex === -1)
251
- continue;
252
- const key = trimmed.slice(0, equalsIndex).trim();
253
- let value = trimmed.slice(equalsIndex + 1).trim();
254
- if (value.startsWith('"') && value.endsWith('"')) {
255
- value = value.slice(1, -1);
256
- } else if (value.startsWith("'") && value.endsWith("'")) {
257
- value = value.slice(1, -1);
258
- }
259
- if (process.env[key] === void 0) {
260
- process.env[key] = value;
261
- }
262
- }
263
- } catch (e) {
264
- }
265
- }
266
- /**
267
- * Validates the entire config using a Zod schema.
268
- */
269
- static schema(zodSchema) {
270
- try {
271
- return zodSchema.parse(process.env);
272
- } catch (err) {
273
- throw new Error(`[KrnlEnvError] Environment validation failed: ${err.message || String(err)}`);
274
- }
275
- }
276
- };
277
-
278
- // src/tools/KrnlShell.js
279
- import { exec, spawn } from "child_process";
280
- import path3 from "path";
281
- import fs3 from "fs";
282
- var KrnlShell = class {
283
- /**
284
- * Promisified command execution.
285
- */
286
- static exec(cmd, opts = {}) {
287
- const timeout = opts.timeout || 3e4;
288
- return new Promise((resolve, reject) => {
289
- exec(cmd, { ...opts, timeout }, (error, stdout, stderr) => {
290
- if (error) {
291
- reject(new Error(`[KrnlShellError] Command failed: ${cmd}
292
- Exit Code: ${error.code}
293
- Stderr: ${String(stderr)}`));
294
- } else {
295
- resolve({ stdout: String(stdout), stderr: String(stderr) });
296
- }
297
- });
298
- });
299
- }
300
- /**
301
- * Streaming command execution.
302
- */
303
- static spawn(cmd, args, opts = {}) {
304
- const child = spawn(cmd, args, opts);
305
- const promise = new Promise((resolve, reject) => {
306
- child.on("close", (code, signal) => {
307
- resolve({ code, signal });
308
- });
309
- child.on("error", (err) => {
310
- reject(err);
311
- });
312
- });
313
- return {
314
- pid: child.pid,
315
- kill: (signal) => child.kill(signal),
316
- promise
317
- };
318
- }
319
- /**
320
- * Defines posix vs win32 specific commands.
321
- */
322
- static platform(routing) {
323
- return process.platform === "win32" ? routing.win32 : routing.posix;
324
- }
325
- /**
326
- * Resolves the full path of a binary.
327
- */
328
- static which(cmd) {
329
- const envPath = process.env.PATH || "";
330
- const paths = envPath.split(path3.delimiter);
331
- const extensions = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""];
332
- for (const p of paths) {
333
- for (const ext of extensions) {
334
- const fullPath = path3.join(p, `${cmd}${ext}`);
335
- try {
336
- if (fs3.existsSync(fullPath) && fs3.statSync(fullPath).isFile()) {
337
- return fullPath;
338
- }
339
- } catch (e) {
340
- }
341
- }
342
- }
343
- return null;
344
- }
345
- };
346
-
347
- // src/tools/GitManager.js
348
- import fs4 from "fs";
349
- import path4 from "path";
350
- var GitManager = class _GitManager {
351
- static isRepo(dirPath) {
352
- return fs4.existsSync(path4.join(dirPath, ".git"));
353
- }
354
- static async init(dirPath) {
355
- if (_GitManager.isRepo(dirPath))
356
- return;
357
- await KrnlShell.exec("git init", { cwd: dirPath });
358
- }
359
- static async clone(repoUrl, destPath) {
360
- const parentDir = path4.dirname(destPath);
361
- if (!fs4.existsSync(parentDir)) {
362
- fs4.mkdirSync(parentDir, { recursive: true });
363
- }
364
- await KrnlShell.exec(`git clone ${repoUrl} ${path4.basename(destPath)}`, { cwd: parentDir });
365
- }
366
- static async commit(dirPath, message) {
367
- if (!_GitManager.isRepo(dirPath)) {
368
- throw new Error(`[GitManagerError] Directory ${dirPath} is not a git repository.`);
369
- }
370
- const { stdout: status } = await KrnlShell.exec("git status --porcelain", { cwd: dirPath });
371
- if (!status.trim()) {
372
- return false;
373
- }
374
- await KrnlShell.exec("git add -A", { cwd: dirPath });
375
- await KrnlShell.exec(`git commit -m "${message.replace(/"/g, '\\"')}"`, { cwd: dirPath });
376
- return true;
377
- }
378
- static async push(dirPath, remote = "origin", branch = "main") {
379
- if (!_GitManager.isRepo(dirPath)) {
380
- throw new Error(`[GitManagerError] Directory ${dirPath} is not a git repository.`);
381
- }
382
- await KrnlShell.exec(`git push ${remote} ${branch}`, { cwd: dirPath });
383
- }
384
- };
385
-
386
- // src/core/K_LIB_Krnl_Aiko_Client.ts
387
- var KrnlAikoClient = class _KrnlAikoClient {
388
- baseUrl;
389
- lastUsedModelId = null;
390
- constructor(aikoPort, aikoHost = "localhost") {
391
- this.baseUrl = `http://${aikoHost}:${aikoPort}`;
392
- }
393
- static discover(system) {
394
- const aikoPeer = system.peers?.get("Aiko");
395
- if (aikoPeer && aikoPeer.address) {
396
- let addr = aikoPeer.address;
397
- if (!addr.startsWith("http")) {
398
- addr = `http://${addr}`;
399
- }
400
- try {
401
- const url = new URL(addr);
402
- return new _KrnlAikoClient(Number(url.port || 10095), url.hostname);
403
- } catch (e) {
404
- console.error("[KrnlAikoClient] Failed to parse discovered Aiko address:", addr, e);
405
- }
406
- }
407
- return null;
408
- }
409
- async infer(intelligenceSpec, systemPrompt, userPrompt) {
410
- const client = KrnlHTTP.createClient(this.baseUrl);
411
- const result = await client.post("/call/infer", {
412
- intelligenceSpec,
413
- systemPrompt,
414
- userPrompt
415
- });
416
- if (result && result.status === "success" && result.data && result.data.status === "success" && result.data.payload && result.data.payload.status === "success" && result.data.payload.response) {
417
- this.lastUsedModelId = result.data.payload.modelId || null;
418
- return result.data.payload.response;
419
- }
420
- const errMsg = result.status === "success" ? result.data?.payload?.message || result.data?.message : result.message;
421
- throw new Error(errMsg || "Invalid or empty response from Aiko infer endpoint");
422
- }
423
- async downrankModel(modelId) {
424
- try {
425
- const client = KrnlHTTP.createClient(this.baseUrl);
426
- await client.post("/call/downrankModel", { modelId });
427
- } catch (e) {
428
- console.error("[KrnlAikoClient] Failed to send downrank request to Aiko:", e.message);
429
- }
430
- }
431
- async fetchCatalog() {
432
- const client = KrnlHTTP.createClient(this.baseUrl);
433
- const result = await client.post("/call/SessionManager/AgentProfileManager", {
434
- action: "list"
435
- });
436
- if (result && result.status === "success" && result.data && result.data.status === "success" && result.data.profiles) {
437
- return result.data.profiles;
438
- }
439
- return {
440
- "endpoint-grade-1": { description: "Nano \u2014 simple CRUD" },
441
- "endpoint-grade-2": { description: "Mini \u2014 standard ops" },
442
- "endpoint-grade-3": { description: "Standard \u2014 moderate logic" },
443
- "endpoint-grade-4": { description: "Large \u2014 complex reasoning" },
444
- "endpoint-grade-5": { description: "Expert \u2014 escalation handler" },
445
- "orchestrator-standard": { description: "Standard routing" },
446
- "orchestrator-pro": { description: "Complex routing + escalation" }
447
- };
448
- }
449
- async isAlive() {
450
- try {
451
- const client = KrnlHTTP.createClient(this.baseUrl);
452
- const result = await client.post("/call/heartbeat", {});
453
- return result && result.status === "success";
454
- } catch (e) {
455
- return false;
456
- }
457
- }
458
- static getNotRunningMessage() {
459
- return "Aiko is not running. Please start it with: cd ~/Projects/Javascript/Aiko && node src/Aiko.js";
460
- }
461
- };
462
-
463
- export {
464
- StringKit,
465
- LRUCache,
466
- TTLCache,
467
- CacheKit,
468
- FileCache,
469
- KrnlEnv,
470
- KrnlShell,
471
- GitManager,
472
- KrnlAikoClient
473
- };