@ultrst-armada/krnl 1.0.2 → 1.0.4

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 (237) hide show
  1. package/README.md +67 -65
  2. package/package.json +15 -8
  3. package/packages/cli/dist/bin/krnl.cjs +808 -331
  4. package/packages/cli/dist/bin/krnl.js +50 -65
  5. package/packages/cli/dist/chunk-GHWYEAPD.js +1642 -0
  6. package/packages/cli/dist/index.cjs +761 -263
  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 -1
  10. package/packages/cli/package.json +17 -10
  11. package/packages/core/dist/index.cjs +2912 -140
  12. package/packages/core/dist/index.d.cts +614 -27
  13. package/packages/core/dist/index.d.ts +614 -27
  14. package/packages/core/dist/index.js +2903 -140
  15. package/packages/core/package.json +15 -6
  16. package/packages/create-krnl/dist/index.cjs +102 -65
  17. package/packages/create-krnl/dist/index.js +102 -65
  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 +378 -85
  25. package/packages/validate/dist/index.d.cts +11 -1
  26. package/packages/validate/dist/index.d.ts +11 -1
  27. package/packages/validate/dist/index.js +375 -82
  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-ESTKOQ7T.js +0 -1146
  51. package/packages/cli/dist/chunk-F5EHXE2O.js +0 -1036
  52. package/packages/cli/dist/chunk-F65ANSQG.js +0 -269
  53. package/packages/cli/dist/chunk-FDNCADFE.js +0 -71
  54. package/packages/cli/dist/chunk-FZ6X7PHR.js +0 -1146
  55. package/packages/cli/dist/chunk-GDLRMDAN.js +0 -127
  56. package/packages/cli/dist/chunk-HWMTCMOS.js +0 -656
  57. package/packages/cli/dist/chunk-I74QIQOD.js +0 -5536
  58. package/packages/cli/dist/chunk-JTLSTO25.js +0 -71
  59. package/packages/cli/dist/chunk-JULBBJ27.js +0 -1033
  60. package/packages/cli/dist/chunk-OHVMVRBP.js +0 -117
  61. package/packages/cli/dist/chunk-P2PCLEKX.js +0 -666
  62. package/packages/cli/dist/chunk-PJQIUOX2.js +0 -7767
  63. package/packages/cli/dist/chunk-PPOF3DJW.js +0 -471
  64. package/packages/cli/dist/chunk-Q45257P6.js +0 -173
  65. package/packages/cli/dist/chunk-QNROWGBI.js +0 -1036
  66. package/packages/cli/dist/chunk-RJNYUXZD.js +0 -977
  67. package/packages/cli/dist/chunk-SRTOPJ5W.js +0 -104
  68. package/packages/cli/dist/chunk-TCEX3MPS.js +0 -702
  69. package/packages/cli/dist/chunk-TNOAJO2J.js +0 -675
  70. package/packages/cli/dist/chunk-UR2SUCSF.js +0 -701
  71. package/packages/cli/dist/chunk-X5LOIFM7.js +0 -68
  72. package/packages/cli/dist/chunk-XIRFOO3H.js +0 -589
  73. package/packages/cli/dist/chunk-ZAAV3JXQ.js +0 -809
  74. package/packages/core/dist/K_ENT_Entity-4MB7CU4A.js +0 -12
  75. package/packages/core/dist/K_ENT_Entity-DEJGIDGH.js +0 -12
  76. package/packages/core/dist/K_ENT_Entity-FXZO5UZ2.js +0 -12
  77. package/packages/core/dist/K_ENT_Entity-HDSCXC5F.js +0 -12
  78. package/packages/core/dist/K_ENT_Entity-JILABHLW.js +0 -12
  79. package/packages/core/dist/K_ENT_Entity-PQ5MURQY.js +0 -13
  80. package/packages/core/dist/K_ENT_Entity-ROAKDIHW.js +0 -12
  81. package/packages/core/dist/K_ENT_Entity-TBVFSKDV.js +0 -12
  82. package/packages/core/dist/K_ENT_Entity-ZFLKG3JO.js +0 -12
  83. package/packages/core/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW.js +0 -8
  84. package/packages/core/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF.js +0 -110
  85. package/packages/core/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF.js +0 -9
  86. package/packages/core/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X.js +0 -9
  87. package/packages/core/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW.js +0 -8
  88. package/packages/core/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2.js +0 -20
  89. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-4C6GBQAG.js +0 -18
  90. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-6V23A6F6.js +0 -18
  91. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK.js +0 -19
  92. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-DYLLC5G2.js +0 -18
  93. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-F4FOFAUP.js +0 -18
  94. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-FBOXXMI3.js +0 -18
  95. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-Q73BWLNP.js +0 -18
  96. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QM2C4MVA.js +0 -18
  97. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QUGI6SMP.js +0 -18
  98. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RGMTBHNP.js +0 -18
  99. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RWR7UNDW.js +0 -18
  100. package/packages/core/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js +0 -7
  101. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-32MFJJ5Z.js +0 -17
  102. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-4J4CEWRY.js +0 -17
  103. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-A366YHF2.js +0 -17
  104. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-LK4LYJHI.js +0 -17
  105. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js +0 -17
  106. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-NW3K63II.js +0 -17
  107. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-QDHTI5ZV.js +0 -17
  108. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-VHCT6VIW.js +0 -17
  109. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-WBRKF24R.js +0 -17
  110. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-XKYQYT6Q.js +0 -17
  111. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-Z2PWZYDZ.js +0 -17
  112. package/packages/core/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5.js +0 -58
  113. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-2EZU7QF4.js +0 -21
  114. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-6G3AQNAV.js +0 -21
  115. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-B2NZMQUG.js +0 -21
  116. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-C2RABMZP.js +0 -21
  117. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-HHE3NZ4F.js +0 -21
  118. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-LHFGR6WK.js +0 -21
  119. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-M74BLM3N.js +0 -21
  120. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-PT6ZA6EA.js +0 -21
  121. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-SP52V3CX.js +0 -21
  122. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF.js +0 -22
  123. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-YNSEUHJJ.js +0 -21
  124. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-M6SBHIVA.js +0 -8
  125. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG.js +0 -8
  126. package/packages/core/dist/K_LIB_Krnl_Telemetry-77FRZ3KV.js +0 -9
  127. package/packages/core/dist/chunk-33L2J7V7.js +0 -82
  128. package/packages/core/dist/chunk-3ES4K2ZP.js +0 -817
  129. package/packages/core/dist/chunk-3SMHVVLL.js +0 -82
  130. package/packages/core/dist/chunk-3UEZ7JQA.js +0 -4877
  131. package/packages/core/dist/chunk-3XIE6KBD.js +0 -4877
  132. package/packages/core/dist/chunk-46ZLCML6.js +0 -107
  133. package/packages/core/dist/chunk-4UEL3DWJ.js +0 -107
  134. package/packages/core/dist/chunk-54GWZ5PC.js +0 -82
  135. package/packages/core/dist/chunk-6QCYRS5L.js +0 -127
  136. package/packages/core/dist/chunk-6ULMHNXR.js +0 -104
  137. package/packages/core/dist/chunk-7WUETJEV.js +0 -117
  138. package/packages/core/dist/chunk-A5KRAYDB.js +0 -107
  139. package/packages/core/dist/chunk-ANEAZ3PO.js +0 -107
  140. package/packages/core/dist/chunk-BE76RL6F.js +0 -82
  141. package/packages/core/dist/chunk-CIARVYDO.js +0 -107
  142. package/packages/core/dist/chunk-CR2ANE62.js +0 -107
  143. package/packages/core/dist/chunk-DI27MOR7.js +0 -173
  144. package/packages/core/dist/chunk-E6RLFHM5.js +0 -596
  145. package/packages/core/dist/chunk-EELAPMNV.js +0 -4877
  146. package/packages/core/dist/chunk-ENZ2RQVJ.js +0 -107
  147. package/packages/core/dist/chunk-F2U6CX4F.js +0 -4877
  148. package/packages/core/dist/chunk-FKG64OHL.js +0 -82
  149. package/packages/core/dist/chunk-FYAZJYM5.js +0 -772
  150. package/packages/core/dist/chunk-G4NP4RDQ.js +0 -82
  151. package/packages/core/dist/chunk-GADIRLRS.js +0 -473
  152. package/packages/core/dist/chunk-GR6CSLQJ.js +0 -772
  153. package/packages/core/dist/chunk-HDS7AT6O.js +0 -772
  154. package/packages/core/dist/chunk-HIMEZUU2.js +0 -71
  155. package/packages/core/dist/chunk-IB4UHG5I.js +0 -596
  156. package/packages/core/dist/chunk-J7ZYNVRS.js +0 -772
  157. package/packages/core/dist/chunk-JVLZU4K7.js +0 -604
  158. package/packages/core/dist/chunk-JYXXI7Q3.js +0 -82
  159. package/packages/core/dist/chunk-K54K2KZW.js +0 -192
  160. package/packages/core/dist/chunk-K6VHLBNH.js +0 -3316
  161. package/packages/core/dist/chunk-KCBP7ZYA.js +0 -596
  162. package/packages/core/dist/chunk-KFQGP6VL.js +0 -33
  163. package/packages/core/dist/chunk-KIUEUI7K.js +0 -82
  164. package/packages/core/dist/chunk-LB67NIZP.js +0 -949
  165. package/packages/core/dist/chunk-LDTYFUNW.js +0 -596
  166. package/packages/core/dist/chunk-MLVWARD4.js +0 -596
  167. package/packages/core/dist/chunk-MPYVXHKO.js +0 -2777
  168. package/packages/core/dist/chunk-MRQ3MITU.js +0 -772
  169. package/packages/core/dist/chunk-MVUN7I7O.js +0 -107
  170. package/packages/core/dist/chunk-NDDOIRW7.js +0 -596
  171. package/packages/core/dist/chunk-O3KDB5MH.js +0 -3330
  172. package/packages/core/dist/chunk-OEINUDSE.js +0 -400
  173. package/packages/core/dist/chunk-OPDENPT4.js +0 -4877
  174. package/packages/core/dist/chunk-P6XEM2LA.js +0 -429
  175. package/packages/core/dist/chunk-QKMRSQV4.js +0 -82
  176. package/packages/core/dist/chunk-R6CCWALL.js +0 -4877
  177. package/packages/core/dist/chunk-RAMMOO73.js +0 -774
  178. package/packages/core/dist/chunk-S3FTZFG6.js +0 -772
  179. package/packages/core/dist/chunk-T2ZVN434.js +0 -4877
  180. package/packages/core/dist/chunk-TFHLDMIA.js +0 -107
  181. package/packages/core/dist/chunk-TI3QUCIJ.js +0 -107
  182. package/packages/core/dist/chunk-TR2BAIGI.js +0 -107
  183. package/packages/core/dist/chunk-UGVVJKC6.js +0 -4877
  184. package/packages/core/dist/chunk-V2DX7YIU.js +0 -984
  185. package/packages/core/dist/chunk-W4IHYUYD.js +0 -772
  186. package/packages/core/dist/chunk-W6WBG5OY.js +0 -4877
  187. package/packages/core/dist/chunk-WN3M7O7H.js +0 -3312
  188. package/packages/core/dist/chunk-WR3NCU7U.js +0 -4877
  189. package/packages/core/dist/chunk-XC6B6L27.js +0 -82
  190. package/packages/core/dist/chunk-XNSE64ZY.js +0 -3316
  191. package/packages/core/dist/chunk-XROES2WN.js +0 -634
  192. package/packages/core/dist/chunk-XSCKNRCZ.js +0 -5020
  193. package/packages/core/dist/chunk-XVABPAUZ.js +0 -82
  194. package/packages/core/dist/chunk-YOBCB5C5.js +0 -596
  195. package/packages/core/dist/chunk-YUK6Q563.js +0 -666
  196. package/packages/core/dist/chunk-YXGL3ZEU.js +0 -1030
  197. package/packages/core/dist/chunk-ZINJ5OUX.js +0 -596
  198. package/packages/core/dist/chunk-ZPFD4BIQ.js +0 -604
  199. package/packages/core/dist/chunk-ZQZBFG6F.js +0 -4826
  200. package/packages/core/dist/chunk-ZZFRJGXM.js +0 -4877
  201. package/packages/create-krnl/dist/K_ENT_Entity-PQ5MURQY-R2OH4VXE.js +0 -14
  202. package/packages/create-krnl/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-AZM5HF4M.js +0 -9
  203. package/packages/create-krnl/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-X5N6SV2S.js +0 -111
  204. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-5PFHF4JU.js +0 -12
  205. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-ED33OQPH.js +0 -12
  206. package/packages/create-krnl/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-YGQLVR4P.js +0 -9
  207. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-VM7CTU2L.js +0 -21
  208. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-Y2GQFJ7I.js +0 -21
  209. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-L3JQWO54.js +0 -8
  210. package/packages/create-krnl/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-KQARASPR.js +0 -19
  211. package/packages/create-krnl/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-OF3IGLVL.js +0 -59
  212. package/packages/create-krnl/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-JOLHKOEX.js +0 -24
  213. package/packages/create-krnl/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-L46LSHKQ.js +0 -10
  214. package/packages/create-krnl/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-4JUPRR3X.js +0 -10
  215. package/packages/create-krnl/dist/chunk-3TRM6CYL.js +0 -152
  216. package/packages/create-krnl/dist/chunk-3URCB3QS.js +0 -127
  217. package/packages/create-krnl/dist/chunk-5JDK35TG.js +0 -3872
  218. package/packages/create-krnl/dist/chunk-A2XAXDOW.js +0 -812
  219. package/packages/create-krnl/dist/chunk-AN6TMQHG.js +0 -1033
  220. package/packages/create-krnl/dist/chunk-BOXWWXQG.js +0 -400
  221. package/packages/create-krnl/dist/chunk-BPTBREBG.js +0 -38
  222. package/packages/create-krnl/dist/chunk-FDNCADFE.js +0 -71
  223. package/packages/create-krnl/dist/chunk-JTLSTO25.js +0 -71
  224. package/packages/create-krnl/dist/chunk-M3NCUIPL.js +0 -107
  225. package/packages/create-krnl/dist/chunk-N2EONSOC.js +0 -7769
  226. package/packages/create-krnl/dist/chunk-OHVMVRBP.js +0 -117
  227. package/packages/create-krnl/dist/chunk-Q45257P6.js +0 -173
  228. package/packages/create-krnl/dist/chunk-QGM4M3NI.js +0 -37
  229. package/packages/create-krnl/dist/chunk-RJNYUXZD.js +0 -977
  230. package/packages/create-krnl/dist/chunk-SRTOPJ5W.js +0 -104
  231. package/packages/create-krnl/dist/chunk-UPBIGEC3.js +0 -666
  232. package/packages/create-krnl/dist/chunk-V2DB7UD7.js +0 -82
  233. package/packages/create-krnl/dist/chunk-WMHLIUI6.js +0 -3644
  234. package/packages/create-krnl/dist/chunk-XIRFOO3H.js +0 -589
  235. package/packages/create-krnl/dist/chunk-Y2CEEVZP.js +0 -5536
  236. package/packages/create-krnl/dist/main-DXUMPBND.js +0 -2217
  237. package/packages/create-krnl/dist/wrapper-SDF2VKX3.js +0 -31
@@ -1,400 +0,0 @@
1
- import {
2
- Logger
3
- } from "./chunk-JTLSTO25.js";
4
-
5
- // ../core/dist/chunk-OEINUDSE.js
6
- import fs from "fs";
7
- import path from "path";
8
- import { pathToFileURL } from "url";
9
- var DefaultServiceContainer = class {
10
- services = /* @__PURE__ */ new Map();
11
- constructor(initialServices = {}) {
12
- for (const [k, v] of Object.entries(initialServices)) {
13
- this.services.set(k, v);
14
- }
15
- }
16
- get(serviceName) {
17
- return this.services.get(serviceName);
18
- }
19
- has(serviceName) {
20
- return this.services.has(serviceName);
21
- }
22
- register(serviceName, serviceInstance) {
23
- this.services.set(serviceName, serviceInstance);
24
- }
25
- list() {
26
- return Array.from(this.services.keys());
27
- }
28
- };
29
- var DefaultOperationRegistrar = class {
30
- ops = /* @__PURE__ */ new Map();
31
- register(op) {
32
- if (!op || !op.name) {
33
- throw new Error(`[OperationRegistrar] Cannot register operation without a valid name.`);
34
- }
35
- this.ops.set(op.name, op);
36
- }
37
- registerBatch(ops) {
38
- if (!Array.isArray(ops)) return;
39
- for (const op of ops) {
40
- this.register(op);
41
- }
42
- }
43
- get(opName) {
44
- return this.ops.get(opName);
45
- }
46
- list() {
47
- return Array.from(this.ops.values());
48
- }
49
- };
50
- var DefaultEventRegistrar = class {
51
- hostEntity;
52
- constructor(hostEntity) {
53
- this.hostEntity = hostEntity;
54
- }
55
- emit(eventName, data) {
56
- if (this.hostEntity && this.hostEntity.interface) {
57
- const emitter = this.hostEntity.interface.getEmitter(eventName);
58
- if (emitter && typeof emitter.pushDataStreamToEmitter === "function") {
59
- emitter.pushDataStreamToEmitter(data);
60
- return;
61
- }
62
- }
63
- }
64
- on(eventName, listener) {
65
- if (this.hostEntity && this.hostEntity.interface) {
66
- const emitter = this.hostEntity.interface.getEmitter(eventName);
67
- if (emitter && typeof emitter.subscribe === "function") {
68
- return emitter.subscribe((msg) => listener(msg.data || msg));
69
- }
70
- }
71
- return () => {
72
- };
73
- }
74
- };
75
- var KrnlSubAppDiscovery = class {
76
- /**
77
- * Deterministically scans searchDir for sub-apps and builds typed SubAppDescriptor instances.
78
- */
79
- static async discoverSubApps(searchDir) {
80
- const descriptors = [];
81
- if (!fs.existsSync(searchDir)) {
82
- return descriptors;
83
- }
84
- const entries = await fs.promises.readdir(searchDir, { withFileTypes: true });
85
- for (const dirent of entries) {
86
- if (dirent.isDirectory()) {
87
- const subAppDir = path.join(searchDir, dirent.name);
88
- const desc = await this.locateDescriptor(subAppDir, dirent.name);
89
- if (desc) {
90
- descriptors.push(desc);
91
- }
92
- }
93
- }
94
- return descriptors;
95
- }
96
- /**
97
- * Inspects a specific directory to see if it represents a valid sub-app.
98
- */
99
- static async locateDescriptor(subAppDir, fallbackId) {
100
- if (!fs.existsSync(subAppDir)) return null;
101
- let id = fallbackId || path.basename(subAppDir);
102
- let manifestPath;
103
- let manifest;
104
- const subappJsonPath = path.join(subAppDir, "subapp.json");
105
- if (fs.existsSync(subappJsonPath)) {
106
- try {
107
- manifest = JSON.parse(fs.readFileSync(subappJsonPath, "utf-8"));
108
- manifestPath = subappJsonPath;
109
- if (manifest?.name) id = manifest.name;
110
- } catch (e) {
111
- console.warn(`[SubAppDiscovery] Failed to parse subapp.json in ${subAppDir}:`, e.message);
112
- }
113
- }
114
- if (!manifest) {
115
- const manifestJsonPath = path.join(subAppDir, "manifest.json");
116
- if (fs.existsSync(manifestJsonPath)) {
117
- try {
118
- manifest = JSON.parse(fs.readFileSync(manifestJsonPath, "utf-8"));
119
- manifestPath = manifestJsonPath;
120
- if (manifest?.name) id = manifest.name;
121
- } catch (_) {
122
- }
123
- }
124
- }
125
- if (!manifest) {
126
- const packageJsonPath = path.join(subAppDir, "package.json");
127
- if (fs.existsSync(packageJsonPath)) {
128
- try {
129
- const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
130
- id = pkg.name || id;
131
- manifest = {
132
- name: pkg.name || id,
133
- version: pkg.version || "1.0.0",
134
- description: pkg.description,
135
- dependencies: pkg.dependencies,
136
- devDependencies: pkg.devDependencies
137
- };
138
- manifestPath = packageJsonPath;
139
- } catch (_) {
140
- }
141
- }
142
- }
143
- const candidateEntries = [
144
- manifest?.registrationEntry,
145
- "register.ts",
146
- "register.js",
147
- "src/register.ts",
148
- "src/register.js",
149
- "subapp.ts",
150
- "subapp.js",
151
- "src/subapp.ts",
152
- "src/subapp.js",
153
- "index.ts",
154
- "index.js",
155
- "src/index.ts",
156
- "src/index.js"
157
- ].filter(Boolean);
158
- let registrationPath = null;
159
- for (const cand of candidateEntries) {
160
- const candPath = path.resolve(subAppDir, cand);
161
- if (fs.existsSync(candPath)) {
162
- registrationPath = candPath;
163
- break;
164
- }
165
- }
166
- if (!registrationPath) {
167
- return null;
168
- }
169
- return {
170
- id,
171
- path: subAppDir,
172
- manifestPath,
173
- registrationPath,
174
- manifest: manifest || { name: id, version: "1.0.0" }
175
- };
176
- }
177
- };
178
- var KrnlSubAppValidator = class {
179
- /**
180
- * Validates a sub-app manifest.
181
- */
182
- static validateManifest(manifest) {
183
- const errors = [];
184
- if (!manifest || typeof manifest !== "object") {
185
- errors.push({ code: "INVALID_MANIFEST", message: "Manifest must be an object" });
186
- return { valid: false, errors };
187
- }
188
- if (!manifest.name || typeof manifest.name !== "string" || manifest.name.trim().length === 0) {
189
- errors.push({ code: "INVALID_NAME", message: "Manifest requires a non-empty name string", field: "name" });
190
- }
191
- if (manifest.version && typeof manifest.version !== "string") {
192
- errors.push({ code: "INVALID_VERSION", message: "Manifest version must be a string", field: "version" });
193
- }
194
- if (manifest.dependencies && typeof manifest.dependencies !== "object") {
195
- errors.push({ code: "INVALID_DEPENDENCIES", message: "dependencies must be a key-value record", field: "dependencies" });
196
- }
197
- return { valid: errors.length === 0, errors };
198
- }
199
- /**
200
- * Validates operation definitions and checks for collisions.
201
- */
202
- static validateRegistration(registration, existingOperations, subAppId) {
203
- const errors = [];
204
- if (!registration || typeof registration !== "object") {
205
- errors.push({ code: "INVALID_REGISTRATION", message: "Registration must return an object with operations", subAppId });
206
- return { valid: false, errors };
207
- }
208
- if (!Array.isArray(registration.operations)) {
209
- errors.push({ code: "INVALID_OPERATIONS_ARRAY", message: "Registration operations must be an array", subAppId });
210
- return { valid: false, errors };
211
- }
212
- const seenInBatch = /* @__PURE__ */ new Set();
213
- for (const op of registration.operations) {
214
- if (!op || typeof op !== "object") {
215
- errors.push({ code: "INVALID_OPERATION", message: "Operation definition must be an object", subAppId });
216
- continue;
217
- }
218
- if (!op.name || typeof op.name !== "string" || op.name.trim().length === 0) {
219
- errors.push({ code: "INVALID_OP_NAME", message: "Operation requires a non-empty name", subAppId });
220
- continue;
221
- }
222
- if (typeof op.handler !== "function") {
223
- errors.push({
224
- code: "INVALID_OP_HANDLER",
225
- message: `Operation '${op.name}' must have a callable handler function`,
226
- subAppId,
227
- operationName: op.name
228
- });
229
- }
230
- if (seenInBatch.has(op.name)) {
231
- errors.push({
232
- code: "DUPLICATE_OP_NAME",
233
- message: `Duplicate operation name '${op.name}' inside sub-app registration`,
234
- subAppId,
235
- operationName: op.name
236
- });
237
- }
238
- seenInBatch.add(op.name);
239
- const qualifiedName = `${subAppId}.${op.name}`;
240
- if (existingOperations.has(op.name) || existingOperations.has(qualifiedName)) {
241
- errors.push({
242
- code: "OPERATION_COLLISION",
243
- message: `Operation '${op.name}' collides with an existing capability on the host Entity`,
244
- subAppId,
245
- operationName: op.name
246
- });
247
- }
248
- }
249
- return { valid: errors.length === 0, errors };
250
- }
251
- };
252
- var KrnlSubAppLifecycle = class {
253
- /**
254
- * Loads, validates, registers, and initializes a sub-app onto an Entity.
255
- */
256
- static async loadAndRegister(entity, descriptor, config = {}) {
257
- const subAppId = descriptor.id;
258
- const instance = {
259
- id: subAppId,
260
- state: "DISCOVERED",
261
- manifest: descriptor.manifest || { name: subAppId, version: "1.0.0" },
262
- descriptor,
263
- operations: /* @__PURE__ */ new Map(),
264
- error: null,
265
- errorDetails: [],
266
- loadedAt: Date.now()
267
- };
268
- try {
269
- instance.state = "VALIDATING";
270
- const manifestCheck = KrnlSubAppValidator.validateManifest(instance.manifest);
271
- if (!manifestCheck.valid) {
272
- instance.state = "ERROR";
273
- instance.errorDetails = manifestCheck.errors;
274
- instance.error = new Error(`[SubApp:${subAppId}] Manifest validation failed: ${manifestCheck.errors.map((e) => e.message).join(", ")}`);
275
- return instance;
276
- }
277
- instance.state = "LOADING";
278
- const fileUrl = pathToFileURL(descriptor.registrationPath).href;
279
- const mod = await import(fileUrl);
280
- const registerFn = typeof mod.register === "function" ? mod.register : typeof mod.default === "function" ? mod.default : typeof mod.default?.register === "function" ? mod.default.register : null;
281
- if (!registerFn) {
282
- instance.state = "ERROR";
283
- const err = { code: "NO_REGISTER_FUNCTION", message: `No callable register() function exported by ${descriptor.registrationPath}`, subAppId };
284
- instance.errorDetails = [err];
285
- instance.error = new Error(`[SubApp:${subAppId}] ${err.message}`);
286
- return instance;
287
- }
288
- const serviceContainer = new DefaultServiceContainer({
289
- runtimeStore: entity._runtimeStore || null,
290
- aiOrchestrator: entity._aiOrchestrator || null
291
- });
292
- const operationRegistrar = new DefaultOperationRegistrar();
293
- const eventRegistrar = new DefaultEventRegistrar(entity);
294
- const regContext = {
295
- entity,
296
- services: serviceContainer,
297
- operations: operationRegistrar,
298
- events: eventRegistrar,
299
- config,
300
- logger: Logger
301
- };
302
- const registrationResult = await registerFn(regContext);
303
- const allOps = [
304
- ...registrationResult?.operations || [],
305
- ...operationRegistrar.list()
306
- ];
307
- const uniqueOpsMap = /* @__PURE__ */ new Map();
308
- for (const op of allOps) {
309
- uniqueOpsMap.set(op.name, op);
310
- }
311
- const uniqueOps = Array.from(uniqueOpsMap.values());
312
- const finalRegistration = {
313
- ...registrationResult,
314
- operations: uniqueOps
315
- };
316
- const existingCaps = /* @__PURE__ */ new Set();
317
- if (entity.localFunctionalities) {
318
- for (const k of entity.localFunctionalities.keys()) existingCaps.add(k);
319
- }
320
- if (entity.remoteFunctionalities) {
321
- for (const k of entity.remoteFunctionalities.keys()) existingCaps.add(k);
322
- }
323
- const opCheck = KrnlSubAppValidator.validateRegistration(finalRegistration, existingCaps, subAppId);
324
- if (!opCheck.valid) {
325
- instance.state = "ERROR";
326
- instance.errorDetails = opCheck.errors;
327
- instance.error = new Error(`[SubApp:${subAppId}] Operations validation failed: ${opCheck.errors.map((e) => e.message).join(", ")}`);
328
- return instance;
329
- }
330
- instance.state = "REGISTERED";
331
- instance.registration = finalRegistration;
332
- for (const op of finalRegistration.operations) {
333
- instance.operations.set(op.name, op);
334
- }
335
- instance.state = "INITIALIZING";
336
- if (typeof finalRegistration.onInitialize === "function") {
337
- await finalRegistration.onInitialize(regContext);
338
- }
339
- instance.state = "READY";
340
- instance.readyAt = Date.now();
341
- return instance;
342
- } catch (err) {
343
- instance.state = "ERROR";
344
- instance.error = err;
345
- instance.errorDetails = [{
346
- code: "LIFECYCLE_ERROR",
347
- message: err.message || String(err),
348
- subAppId
349
- }];
350
- return instance;
351
- }
352
- }
353
- /**
354
- * Gracefully unregisters and disposes of a sub-app instance.
355
- */
356
- static async dispose(instance) {
357
- if (instance.state === "DISPOSED") return;
358
- instance.state = "UNREGISTERING";
359
- try {
360
- if (instance.registration && typeof instance.registration.onDispose === "function") {
361
- await instance.registration.onDispose();
362
- }
363
- } catch (e) {
364
- console.warn(`[SubApp:${instance.id}] Warning during onDispose():`, e.message);
365
- } finally {
366
- instance.operations.clear();
367
- instance.state = "DISPOSED";
368
- }
369
- }
370
- };
371
- function createHttpsAppAdapter(options) {
372
- const operations = options.endpoints.map((ep) => {
373
- const cleanName = ep.path.replace(/^\//, "").replace(/^api\//, "").replace(/\//g, "_").replace(/:/g, "") || "root";
374
- return {
375
- name: cleanName,
376
- description: ep.description || `Mapped HTTPS endpoint: ${ep.method || "POST"} ${ep.path}`,
377
- method: ep.method || "POST",
378
- input: ep.inputSchema,
379
- output: ep.outputSchema,
380
- metadata: { originalPath: ep.path, originalMethod: ep.method || "POST" },
381
- handler: async (input, ctx) => {
382
- return await ep.handler(input, ctx);
383
- }
384
- };
385
- });
386
- return {
387
- name: options.name,
388
- operations
389
- };
390
- }
391
-
392
- export {
393
- DefaultServiceContainer,
394
- DefaultOperationRegistrar,
395
- DefaultEventRegistrar,
396
- KrnlSubAppDiscovery,
397
- KrnlSubAppValidator,
398
- KrnlSubAppLifecycle,
399
- createHttpsAppAdapter
400
- };
@@ -1,38 +0,0 @@
1
- import {
2
- __require
3
- } from "./chunk-QGM4M3NI.js";
4
-
5
- // ../core/dist/chunk-KFQGP6VL.js
6
- var __defProp = Object.defineProperty;
7
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
- var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __require2 = /* @__PURE__ */ ((x) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
- get: (a, b) => (typeof __require !== "undefined" ? __require : a)[b]
12
- }) : x)(function(x) {
13
- if (typeof __require !== "undefined") return __require.apply(this, arguments);
14
- throw Error('Dynamic require of "' + x + '" is not supported');
15
- });
16
- var __esm = (fn, res) => function __init() {
17
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
- };
19
- var __export = (target, all) => {
20
- for (var name in all)
21
- __defProp(target, name, { get: all[name], enumerable: true });
22
- };
23
- var __copyProps = (to, from, except, desc) => {
24
- if (from && typeof from === "object" || typeof from === "function") {
25
- for (let key of __getOwnPropNames(from))
26
- if (!__hasOwnProp.call(to, key) && key !== except)
27
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
- }
29
- return to;
30
- };
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
-
33
- export {
34
- __require2 as __require,
35
- __esm,
36
- __export,
37
- __toCommonJS
38
- };
@@ -1,71 +0,0 @@
1
- // ../core/dist/chunk-HIMEZUU2.js
2
- var KrnlEntityRegistry = class _KrnlEntityRegistry {
3
- static instance = null;
4
- entities = /* @__PURE__ */ new Map();
5
- constructor() {
6
- }
7
- /**
8
- * Get the singleton instance of the entity registry.
9
- */
10
- static getInstance() {
11
- if (!_KrnlEntityRegistry.instance) {
12
- _KrnlEntityRegistry.instance = new _KrnlEntityRegistry();
13
- }
14
- return _KrnlEntityRegistry.instance;
15
- }
16
- /**
17
- * Registers an entity instance into the global registry.
18
- */
19
- static register(entity) {
20
- const reg = _KrnlEntityRegistry.getInstance();
21
- const id = entity.id || entity.entityName;
22
- if (id) {
23
- reg.entities.set(id, entity);
24
- }
25
- if (entity.entityName && entity.entityName !== id) {
26
- reg.entities.set(entity.entityName, entity);
27
- }
28
- }
29
- /**
30
- * Unregisters an entity instance or ID from the registry.
31
- */
32
- static unregister(entityOrId) {
33
- const reg = _KrnlEntityRegistry.getInstance();
34
- if (typeof entityOrId === "string") {
35
- reg.entities.delete(entityOrId);
36
- } else {
37
- const id = entityOrId.id || entityOrId.entityName;
38
- if (id) reg.entities.delete(id);
39
- if (entityOrId.entityName) reg.entities.delete(entityOrId.entityName);
40
- }
41
- }
42
- /**
43
- * Retrieves an entity by its ID or name.
44
- */
45
- static get(idOrName) {
46
- return _KrnlEntityRegistry.getInstance().entities.get(idOrName);
47
- }
48
- /**
49
- * Checks if an entity with the given ID or name is registered.
50
- */
51
- static has(idOrName) {
52
- return _KrnlEntityRegistry.getInstance().entities.has(idOrName);
53
- }
54
- /**
55
- * Returns a list of all currently registered unique entities.
56
- */
57
- static getAll() {
58
- const set = new Set(_KrnlEntityRegistry.getInstance().entities.values());
59
- return Array.from(set);
60
- }
61
- /**
62
- * Clears all registered entities.
63
- */
64
- static clear() {
65
- _KrnlEntityRegistry.getInstance().entities.clear();
66
- }
67
- };
68
-
69
- export {
70
- KrnlEntityRegistry
71
- };
@@ -1,71 +0,0 @@
1
- // ../core/dist/chunk-K54K2KZW.js
2
- import fs from "fs";
3
- var Logger = class {
4
- static log(...args) {
5
- console.log(`[${(/* @__PURE__ */ new Date()).toISOString()}]`, ...args);
6
- }
7
- static error(...args) {
8
- console.error(`[${(/* @__PURE__ */ new Date()).toISOString()}] ERROR:`, ...args);
9
- this.flush();
10
- }
11
- static flush() {
12
- if (typeof process !== "undefined") {
13
- try {
14
- if (process.stdout && typeof process.stdout.fd === "number") fs.fsyncSync(process.stdout.fd);
15
- if (process.stderr && typeof process.stderr.fd === "number") fs.fsyncSync(process.stderr.fd);
16
- } catch (e) {
17
- }
18
- }
19
- }
20
- };
21
- var EnumTemplate = {
22
- types: [],
23
- listTypes() {
24
- return Object.freeze([...this.types]);
25
- },
26
- getTypeID(typeName) {
27
- return this[typeName] !== void 0 ? this[typeName] : -1;
28
- }
29
- };
30
- function createEnum(typeNames) {
31
- const enumObj = Object.create(EnumTemplate);
32
- enumObj.types = typeNames;
33
- typeNames.forEach((name, index) => {
34
- enumObj[name] = index;
35
- });
36
- return Object.freeze(enumObj);
37
- }
38
- var krnlSystemTypes = createEnum(["qwnsr", "brnda", "symba", "mosy"]);
39
- var krnlServiceSuites = createEnum(["UNIFIED_HTTP"]);
40
- var defaultConnectionBehaviour = createEnum([
41
- "allow_unlisted",
42
- "ask_key_unlisted",
43
- "forbid_unlisted"
44
- ]);
45
- var krnlServiceSuitePorts = Object.freeze({
46
- UNIFIED_HTTP: 1
47
- });
48
- var krnlPrimitiveDataTypes = createEnum(["audio", "control-signal", "video", "MIDI", "OSC", "text", "trigger"]);
49
- var KrnlPolicy = class _KrnlPolicy {
50
- maxRetries = 0;
51
- timeoutMs = 5e3;
52
- retryDelayMs = 1e3;
53
- backoffStrategy = "LINEAR";
54
- constructor(opts = {}) {
55
- if (opts.maxRetries !== void 0) this.maxRetries = opts.maxRetries;
56
- if (opts.timeoutMs !== void 0) this.timeoutMs = opts.timeoutMs;
57
- if (opts.retryDelayMs !== void 0) this.retryDelayMs = opts.retryDelayMs;
58
- if (opts.backoffStrategy !== void 0) this.backoffStrategy = opts.backoffStrategy;
59
- }
60
- static default() {
61
- return new _KrnlPolicy();
62
- }
63
- static resilient() {
64
- return new _KrnlPolicy({ maxRetries: 3, timeoutMs: 1e4, retryDelayMs: 1e3, backoffStrategy: "EXPONENTIAL" });
65
- }
66
- };
67
-
68
- export {
69
- Logger,
70
- KrnlPolicy
71
- };
@@ -1,107 +0,0 @@
1
- import {
2
- krnlSystemEntityBase
3
- } from "./chunk-N2EONSOC.js";
4
- import {
5
- KrnlShell
6
- } from "./chunk-3TRM6CYL.js";
7
-
8
- // ../core/dist/chunk-ENZ2RQVJ.js
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
- };