@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.
- package/README.md +95 -2
- package/package.json +75 -4
- package/packages/cli/dist/K_ENT_Entity-PQ5MURQY-ZG6FZXXX.js +13 -0
- package/packages/cli/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-K4CRQYA5.js +8 -0
- package/packages/cli/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-LNPXZYOE.js +110 -0
- package/packages/cli/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-3ALZPNX4.js +11 -0
- package/packages/cli/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-PJTICYSW.js +11 -0
- package/packages/cli/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-M5TYU55O.js +8 -0
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-H6STOXRK.js +20 -0
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-XPJXSF7D.js +19 -0
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-CUYGTWOW.js +7 -0
- package/packages/cli/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-VR6T4N6J.js +17 -0
- package/packages/cli/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-RLJ4QWDP.js +58 -0
- package/packages/cli/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-BOQGUASC.js +22 -0
- package/packages/cli/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-XJI7KIT5.js +8 -0
- package/packages/cli/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-K5VCWAFW.js +9 -0
- package/packages/cli/dist/bin/krnl.cjs +9758 -0
- package/packages/cli/dist/bin/krnl.d.cts +1 -0
- package/packages/cli/dist/bin/krnl.d.ts +1 -0
- package/packages/cli/dist/bin/krnl.js +2006 -0
- package/packages/cli/dist/chunk-3TRM6CYL.js +152 -0
- package/packages/cli/dist/chunk-5JDK35TG.js +3872 -0
- package/packages/cli/dist/chunk-63PTK33I.js +997 -0
- package/packages/cli/dist/chunk-6NIKAMUZ.js +82 -0
- package/packages/cli/dist/chunk-BOXWWXQG.js +400 -0
- package/packages/cli/dist/chunk-EEKLK7QJ.js +565 -0
- package/packages/cli/dist/chunk-EG7T2IAD.js +107 -0
- package/packages/cli/dist/chunk-F5EHXE2O.js +1036 -0
- package/packages/cli/dist/chunk-F65ANSQG.js +269 -0
- package/packages/cli/dist/chunk-FDNCADFE.js +71 -0
- package/packages/cli/dist/chunk-GDLRMDAN.js +127 -0
- package/packages/cli/dist/chunk-HWMTCMOS.js +656 -0
- package/packages/cli/dist/chunk-I74QIQOD.js +5536 -0
- package/packages/cli/dist/chunk-JTLSTO25.js +71 -0
- package/packages/cli/dist/chunk-JULBBJ27.js +1033 -0
- package/packages/cli/dist/chunk-OHVMVRBP.js +117 -0
- package/packages/cli/dist/chunk-P2PCLEKX.js +666 -0
- package/packages/cli/dist/chunk-PJQIUOX2.js +7767 -0
- package/packages/cli/dist/chunk-PPOF3DJW.js +471 -0
- package/packages/cli/dist/chunk-Q45257P6.js +173 -0
- package/packages/cli/dist/chunk-QNROWGBI.js +1036 -0
- package/packages/cli/dist/chunk-RJNYUXZD.js +977 -0
- package/packages/cli/dist/chunk-SRTOPJ5W.js +104 -0
- package/packages/cli/dist/chunk-TCEX3MPS.js +702 -0
- package/packages/cli/dist/chunk-TNOAJO2J.js +675 -0
- package/packages/cli/dist/chunk-UR2SUCSF.js +701 -0
- package/packages/cli/dist/chunk-X5LOIFM7.js +68 -0
- package/packages/cli/dist/chunk-XIRFOO3H.js +589 -0
- package/packages/cli/dist/chunk-ZAAV3JXQ.js +809 -0
- package/packages/cli/dist/index.cjs +7798 -0
- package/packages/cli/dist/index.d.cts +7 -0
- package/packages/cli/dist/index.d.ts +7 -0
- package/packages/cli/dist/index.js +29 -0
- package/packages/cli/package.json +34 -0
- package/packages/core/dist/K_ENT_Entity-4MB7CU4A.js +12 -0
- package/packages/core/dist/K_ENT_Entity-DEJGIDGH.js +12 -0
- package/packages/core/dist/K_ENT_Entity-FXZO5UZ2.js +12 -0
- package/packages/core/dist/K_ENT_Entity-HDSCXC5F.js +12 -0
- package/packages/core/dist/K_ENT_Entity-JILABHLW.js +12 -0
- package/packages/core/dist/K_ENT_Entity-PQ5MURQY.js +13 -0
- package/packages/core/dist/K_ENT_Entity-ROAKDIHW.js +12 -0
- package/packages/core/dist/K_ENT_Entity-TBVFSKDV.js +12 -0
- package/packages/core/dist/K_ENT_Entity-ZFLKG3JO.js +12 -0
- package/packages/core/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF.js +110 -0
- package/packages/core/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF.js +9 -0
- package/packages/core/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X.js +9 -0
- package/packages/core/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2.js +20 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-4C6GBQAG.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-6V23A6F6.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK.js +19 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-DYLLC5G2.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-F4FOFAUP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-FBOXXMI3.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-Q73BWLNP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QM2C4MVA.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QUGI6SMP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RGMTBHNP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RWR7UNDW.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js +7 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-32MFJJ5Z.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-4J4CEWRY.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-A366YHF2.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-LK4LYJHI.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-NW3K63II.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-QDHTI5ZV.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-VHCT6VIW.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-WBRKF24R.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-XKYQYT6Q.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-Z2PWZYDZ.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5.js +58 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-2EZU7QF4.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-6G3AQNAV.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-B2NZMQUG.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-C2RABMZP.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-HHE3NZ4F.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-LHFGR6WK.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-M74BLM3N.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-PT6ZA6EA.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-SP52V3CX.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF.js +22 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-YNSEUHJJ.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-M6SBHIVA.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_Telemetry-77FRZ3KV.js +9 -0
- package/packages/core/dist/chunk-33L2J7V7.js +82 -0
- package/packages/core/dist/chunk-3ES4K2ZP.js +817 -0
- package/packages/core/dist/chunk-3SMHVVLL.js +82 -0
- package/packages/core/dist/chunk-3UEZ7JQA.js +4877 -0
- package/packages/core/dist/chunk-3XIE6KBD.js +4877 -0
- package/packages/core/dist/chunk-46ZLCML6.js +107 -0
- package/packages/core/dist/chunk-4UEL3DWJ.js +107 -0
- package/packages/core/dist/chunk-54GWZ5PC.js +82 -0
- package/packages/core/dist/chunk-6QCYRS5L.js +127 -0
- package/packages/core/dist/chunk-6ULMHNXR.js +104 -0
- package/packages/core/dist/chunk-7WUETJEV.js +117 -0
- package/packages/core/dist/chunk-A5KRAYDB.js +107 -0
- package/packages/core/dist/chunk-ANEAZ3PO.js +107 -0
- package/packages/core/dist/chunk-BE76RL6F.js +82 -0
- package/packages/core/dist/chunk-CIARVYDO.js +107 -0
- package/packages/core/dist/chunk-CR2ANE62.js +107 -0
- package/packages/core/dist/chunk-DI27MOR7.js +173 -0
- package/packages/core/dist/chunk-E6RLFHM5.js +596 -0
- package/packages/core/dist/chunk-EELAPMNV.js +4877 -0
- package/packages/core/dist/chunk-ENZ2RQVJ.js +107 -0
- package/packages/core/dist/chunk-F2U6CX4F.js +4877 -0
- package/packages/core/dist/chunk-FKG64OHL.js +82 -0
- package/packages/core/dist/chunk-FYAZJYM5.js +772 -0
- package/packages/core/dist/chunk-G4NP4RDQ.js +82 -0
- package/packages/core/dist/chunk-GADIRLRS.js +473 -0
- package/packages/core/dist/chunk-GR6CSLQJ.js +772 -0
- package/packages/core/dist/chunk-HDS7AT6O.js +772 -0
- package/packages/core/dist/chunk-HIMEZUU2.js +71 -0
- package/packages/core/dist/chunk-IB4UHG5I.js +596 -0
- package/packages/core/dist/chunk-J7ZYNVRS.js +772 -0
- package/packages/core/dist/chunk-JVLZU4K7.js +604 -0
- package/packages/core/dist/chunk-JYXXI7Q3.js +82 -0
- package/packages/core/dist/chunk-K54K2KZW.js +192 -0
- package/packages/core/dist/chunk-K6VHLBNH.js +3316 -0
- package/packages/core/dist/chunk-KCBP7ZYA.js +596 -0
- package/packages/core/dist/chunk-KFQGP6VL.js +33 -0
- package/packages/core/dist/chunk-KIUEUI7K.js +82 -0
- package/packages/core/dist/chunk-LB67NIZP.js +949 -0
- package/packages/core/dist/chunk-LDTYFUNW.js +596 -0
- package/packages/core/dist/chunk-MLVWARD4.js +596 -0
- package/packages/core/dist/chunk-MPYVXHKO.js +2777 -0
- package/packages/core/dist/chunk-MRQ3MITU.js +772 -0
- package/packages/core/dist/chunk-MVUN7I7O.js +107 -0
- package/packages/core/dist/chunk-NDDOIRW7.js +596 -0
- package/packages/core/dist/chunk-O3KDB5MH.js +3330 -0
- package/packages/core/dist/chunk-OEINUDSE.js +400 -0
- package/packages/core/dist/chunk-OPDENPT4.js +4877 -0
- package/packages/core/dist/chunk-P6XEM2LA.js +429 -0
- package/packages/core/dist/chunk-QKMRSQV4.js +82 -0
- package/packages/core/dist/chunk-R6CCWALL.js +4877 -0
- package/packages/core/dist/chunk-RAMMOO73.js +774 -0
- package/packages/core/dist/chunk-S3FTZFG6.js +772 -0
- package/packages/core/dist/chunk-T2ZVN434.js +4877 -0
- package/packages/core/dist/chunk-TFHLDMIA.js +107 -0
- package/packages/core/dist/chunk-TI3QUCIJ.js +107 -0
- package/packages/core/dist/chunk-TR2BAIGI.js +107 -0
- package/packages/core/dist/chunk-UGVVJKC6.js +4877 -0
- package/packages/core/dist/chunk-V2DX7YIU.js +984 -0
- package/packages/core/dist/chunk-W4IHYUYD.js +772 -0
- package/packages/core/dist/chunk-W6WBG5OY.js +4877 -0
- package/packages/core/dist/chunk-WN3M7O7H.js +3312 -0
- package/packages/core/dist/chunk-WR3NCU7U.js +4877 -0
- package/packages/core/dist/chunk-XC6B6L27.js +82 -0
- package/packages/core/dist/chunk-XNSE64ZY.js +3316 -0
- package/packages/core/dist/chunk-XROES2WN.js +634 -0
- package/packages/core/dist/chunk-XSCKNRCZ.js +5020 -0
- package/packages/core/dist/chunk-XVABPAUZ.js +82 -0
- package/packages/core/dist/chunk-YOBCB5C5.js +596 -0
- package/packages/core/dist/chunk-YUK6Q563.js +666 -0
- package/packages/core/dist/chunk-YXGL3ZEU.js +1030 -0
- package/packages/core/dist/chunk-ZINJ5OUX.js +596 -0
- package/packages/core/dist/chunk-ZPFD4BIQ.js +604 -0
- package/packages/core/dist/chunk-ZQZBFG6F.js +4826 -0
- package/packages/core/dist/chunk-ZZFRJGXM.js +4877 -0
- package/packages/core/dist/index.cjs +760 -0
- package/packages/core/dist/index.d.cts +360 -0
- package/packages/core/dist/index.d.ts +360 -0
- package/packages/core/dist/index.js +707 -0
- package/packages/core/package.json +34 -0
- package/packages/create-krnl/dist/K_ENT_Entity-PQ5MURQY-R2OH4VXE.js +14 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-AZM5HF4M.js +9 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-X5N6SV2S.js +111 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-5PFHF4JU.js +12 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-ED33OQPH.js +12 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-YGQLVR4P.js +9 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-VM7CTU2L.js +21 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-Y2GQFJ7I.js +21 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-L3JQWO54.js +8 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-KQARASPR.js +19 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-OF3IGLVL.js +59 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-JOLHKOEX.js +24 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-L46LSHKQ.js +10 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-4JUPRR3X.js +10 -0
- package/packages/create-krnl/dist/chunk-3TRM6CYL.js +152 -0
- package/packages/create-krnl/dist/chunk-3URCB3QS.js +127 -0
- package/packages/create-krnl/dist/chunk-5JDK35TG.js +3872 -0
- package/packages/create-krnl/dist/chunk-A2XAXDOW.js +812 -0
- package/packages/create-krnl/dist/chunk-AN6TMQHG.js +1033 -0
- package/packages/create-krnl/dist/chunk-BOXWWXQG.js +400 -0
- package/packages/create-krnl/dist/chunk-BPTBREBG.js +38 -0
- package/packages/create-krnl/dist/chunk-FDNCADFE.js +71 -0
- package/packages/create-krnl/dist/chunk-JTLSTO25.js +71 -0
- package/packages/create-krnl/dist/chunk-M3NCUIPL.js +107 -0
- package/packages/create-krnl/dist/chunk-N2EONSOC.js +7769 -0
- package/packages/create-krnl/dist/chunk-OHVMVRBP.js +117 -0
- package/packages/create-krnl/dist/chunk-Q45257P6.js +173 -0
- package/packages/create-krnl/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/create-krnl/dist/chunk-RJNYUXZD.js +977 -0
- package/packages/create-krnl/dist/chunk-SRTOPJ5W.js +104 -0
- package/packages/create-krnl/dist/chunk-UPBIGEC3.js +666 -0
- package/packages/create-krnl/dist/chunk-V2DB7UD7.js +82 -0
- package/packages/create-krnl/dist/chunk-WMHLIUI6.js +3644 -0
- package/packages/create-krnl/dist/chunk-XIRFOO3H.js +589 -0
- package/packages/create-krnl/dist/chunk-Y2CEEVZP.js +5536 -0
- package/packages/create-krnl/dist/index.cjs +395 -0
- package/packages/create-krnl/dist/index.js +372 -0
- package/packages/create-krnl/dist/main-DXUMPBND.js +2217 -0
- package/packages/create-krnl/dist/wrapper-SDF2VKX3.js +31 -0
- package/packages/create-krnl/package.json +23 -0
- package/packages/eslint-plugin/dist/index.cjs +439 -0
- package/packages/eslint-plugin/dist/index.d.cts +336 -0
- package/packages/eslint-plugin/dist/index.d.ts +336 -0
- package/packages/eslint-plugin/dist/index.js +416 -0
- package/packages/eslint-plugin/package.json +24 -0
- package/packages/validate/dist/index.cjs +499 -0
- package/packages/validate/dist/index.d.cts +49 -0
- package/packages/validate/dist/index.d.ts +49 -0
- package/packages/validate/dist/index.js +462 -0
- package/packages/validate/package.json +27 -0
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,473 @@
|
|
|
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
|
+
};
|