@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,117 @@
|
|
|
1
|
+
// ../core/dist/chunk-7WUETJEV.js
|
|
2
|
+
import { Worker } from "worker_threads";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import path from "path";
|
|
5
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = path.dirname(__filename);
|
|
7
|
+
var _rpcSeq = 0;
|
|
8
|
+
var KrnlSubAppWorkerHost = class _KrnlSubAppWorkerHost {
|
|
9
|
+
prefix;
|
|
10
|
+
_worker;
|
|
11
|
+
_manifest;
|
|
12
|
+
_pending;
|
|
13
|
+
_ready;
|
|
14
|
+
_resolveReady;
|
|
15
|
+
_rejectReady;
|
|
16
|
+
constructor(prefix, worker) {
|
|
17
|
+
this.prefix = prefix;
|
|
18
|
+
this._worker = worker;
|
|
19
|
+
this._manifest = null;
|
|
20
|
+
this._pending = /* @__PURE__ */ new Map();
|
|
21
|
+
this._ready = new Promise((resolve, reject) => {
|
|
22
|
+
this._resolveReady = resolve;
|
|
23
|
+
this._rejectReady = reject;
|
|
24
|
+
});
|
|
25
|
+
this._worker.on("message", (msg) => {
|
|
26
|
+
if (msg.type === "manifest") {
|
|
27
|
+
this._manifest = msg.manifest;
|
|
28
|
+
this._resolveReady();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (msg.type === "result") {
|
|
32
|
+
const pending = this._pending.get(msg.requestId);
|
|
33
|
+
if (!pending) return;
|
|
34
|
+
clearTimeout(pending.timeoutId);
|
|
35
|
+
this._pending.delete(msg.requestId);
|
|
36
|
+
if (msg.ok) pending.resolve(msg.result);
|
|
37
|
+
else pending.reject(new Error(msg.error || "Worker sub-app error"));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
this._worker.on("error", (err) => {
|
|
41
|
+
console.error(`[SubAppWorkerHost:${prefix}] Worker error:`, err.message || err);
|
|
42
|
+
this._rejectReady(err instanceof Error ? err : new Error(String(err)));
|
|
43
|
+
for (const [id, p] of this._pending) {
|
|
44
|
+
clearTimeout(p.timeoutId);
|
|
45
|
+
p.reject(err);
|
|
46
|
+
this._pending.delete(id);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
this._worker.on("exit", (code) => {
|
|
50
|
+
if (code !== 0) {
|
|
51
|
+
console.error(`[SubAppWorkerHost:${prefix}] Worker exited with code ${code}`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Spawn a worker_thread for the given sub-app config and wait for the manifest.
|
|
57
|
+
*/
|
|
58
|
+
static async create(config, timeoutMs = 3e4) {
|
|
59
|
+
const runtimePath = path.resolve(__dirname, "K_LIB_Krnl_SubApp_Worker_Runtime.js");
|
|
60
|
+
const worker = new Worker(runtimePath, {
|
|
61
|
+
workerData: {
|
|
62
|
+
entryPath: config.entryPath ?? "",
|
|
63
|
+
prefix: config.prefix,
|
|
64
|
+
constructorArgs: config.constructorArgs ?? []
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const host = new _KrnlSubAppWorkerHost(config.prefix, worker);
|
|
68
|
+
const timeout = new Promise(
|
|
69
|
+
(_, reject) => setTimeout(() => reject(new Error(`[SubAppWorkerHost:${config.prefix}] Timed out waiting for worker ready signal.`)), timeoutMs)
|
|
70
|
+
);
|
|
71
|
+
await Promise.race([host._ready, timeout]);
|
|
72
|
+
return host;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Call a functionality on the worker-hosted sub-app.
|
|
76
|
+
* This is the primary dispatch path for worker-mode sub-apps.
|
|
77
|
+
* Uses MessagePort IPC — no networking.
|
|
78
|
+
*/
|
|
79
|
+
async callInternal(fid, input = {}, timeoutMs = 3e4) {
|
|
80
|
+
const requestId = `wkr_${Date.now()}_${(_rpcSeq++).toString(36)}`;
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
const timeoutId = setTimeout(() => {
|
|
83
|
+
this._pending.delete(requestId);
|
|
84
|
+
reject(new Error(`[SubAppWorkerHost:${this.prefix}] Call '${fid}' timed out after ${timeoutMs}ms`));
|
|
85
|
+
}, timeoutMs);
|
|
86
|
+
this._pending.set(requestId, { resolve, reject, timeoutId });
|
|
87
|
+
this._worker.postMessage({ type: "call", requestId, fid, input });
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Alias so both local entities and worker hosts expose the same dispatch surface.
|
|
92
|
+
*/
|
|
93
|
+
async call(fid, input = {}) {
|
|
94
|
+
return this.callInternal(fid, input);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns the sub-app manifest obtained from the worker at startup.
|
|
98
|
+
*/
|
|
99
|
+
getManifest() {
|
|
100
|
+
return this._manifest;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Terminate the worker thread gracefully.
|
|
104
|
+
*/
|
|
105
|
+
async gracefulShutdown() {
|
|
106
|
+
try {
|
|
107
|
+
this._worker.postMessage({ type: "shutdown" });
|
|
108
|
+
await new Promise((resolve) => setTimeout(resolve, 5e3));
|
|
109
|
+
} finally {
|
|
110
|
+
await this._worker.terminate();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
KrnlSubAppWorkerHost
|
|
117
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// ../core/dist/chunk-DI27MOR7.js
|
|
2
|
+
var KrnlTelemetry = class {
|
|
3
|
+
metrics;
|
|
4
|
+
callLogs;
|
|
5
|
+
libraryUsage;
|
|
6
|
+
dataUsage;
|
|
7
|
+
enabled;
|
|
8
|
+
ringBufferSize;
|
|
9
|
+
aiTraces;
|
|
10
|
+
totalAiCalls;
|
|
11
|
+
totalAiRetries;
|
|
12
|
+
avgAiLatencyMs;
|
|
13
|
+
runtimeStore = null;
|
|
14
|
+
constructor() {
|
|
15
|
+
this.metrics = /* @__PURE__ */ new Map();
|
|
16
|
+
this.callLogs = /* @__PURE__ */ new Map();
|
|
17
|
+
this.libraryUsage = /* @__PURE__ */ new Map();
|
|
18
|
+
this.dataUsage = /* @__PURE__ */ new Map();
|
|
19
|
+
this.enabled = false;
|
|
20
|
+
this.ringBufferSize = 100;
|
|
21
|
+
this.aiTraces = [];
|
|
22
|
+
this.totalAiCalls = 0;
|
|
23
|
+
this.totalAiRetries = 0;
|
|
24
|
+
this.avgAiLatencyMs = 0;
|
|
25
|
+
}
|
|
26
|
+
setRuntimeStore(store) {
|
|
27
|
+
this.runtimeStore = store;
|
|
28
|
+
}
|
|
29
|
+
recordAiTrace(trace) {
|
|
30
|
+
if (this.aiTraces.length >= this.ringBufferSize) {
|
|
31
|
+
this.aiTraces.shift();
|
|
32
|
+
}
|
|
33
|
+
this.aiTraces.push(trace);
|
|
34
|
+
this.totalAiCalls++;
|
|
35
|
+
this.totalAiRetries += trace.retryCount || 0;
|
|
36
|
+
this.avgAiLatencyMs = (this.avgAiLatencyMs * (this.totalAiCalls - 1) + trace.latencyMs) / this.totalAiCalls;
|
|
37
|
+
if (this.runtimeStore) {
|
|
38
|
+
this.runtimeStore.appendTelemetry({
|
|
39
|
+
type: "ai_trace",
|
|
40
|
+
endpointId: trace.endpointId,
|
|
41
|
+
timestamp: trace.timestamp,
|
|
42
|
+
latencyMs: trace.latencyMs,
|
|
43
|
+
retryCount: trace.retryCount,
|
|
44
|
+
success: !trace.failureReason,
|
|
45
|
+
failures: trace.validationFailures
|
|
46
|
+
}).catch(() => {
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Starts a telemetry trace for a specific functionality.
|
|
52
|
+
* @param fid
|
|
53
|
+
* @returns Trace data
|
|
54
|
+
*/
|
|
55
|
+
startTrace(fid) {
|
|
56
|
+
return {
|
|
57
|
+
startTime: process.hrtime.bigint(),
|
|
58
|
+
startMemory: process.memoryUsage ? process.memoryUsage().heapUsed : 0
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Ends a telemetry trace and updates aggregated metrics.
|
|
63
|
+
* @param fid
|
|
64
|
+
* @param trace
|
|
65
|
+
*/
|
|
66
|
+
endTrace(fid, trace, success = true) {
|
|
67
|
+
const endTime = process.hrtime.bigint();
|
|
68
|
+
const endMemory = process.memoryUsage ? process.memoryUsage().heapUsed : 0;
|
|
69
|
+
const latencyNs = Number(endTime - trace.startTime);
|
|
70
|
+
const memoryDelta = endMemory - trace.startMemory;
|
|
71
|
+
const latencyMs = latencyNs / 1e6;
|
|
72
|
+
let stats = this.metrics.get(fid);
|
|
73
|
+
if (!stats) {
|
|
74
|
+
stats = {
|
|
75
|
+
calls: 0,
|
|
76
|
+
errors: 0,
|
|
77
|
+
totalLatencyNs: 0,
|
|
78
|
+
avgLatencyMs: 0,
|
|
79
|
+
peakLatencyMs: 0,
|
|
80
|
+
totalMemoryDelta: 0,
|
|
81
|
+
avgMemoryDelta: 0,
|
|
82
|
+
lastUpdated: 0
|
|
83
|
+
};
|
|
84
|
+
this.metrics.set(fid, stats);
|
|
85
|
+
}
|
|
86
|
+
stats.calls++;
|
|
87
|
+
if (!success) stats.errors++;
|
|
88
|
+
stats.totalLatencyNs += latencyNs;
|
|
89
|
+
stats.totalMemoryDelta += memoryDelta;
|
|
90
|
+
stats.avgLatencyMs = stats.totalLatencyNs / stats.calls / 1e6;
|
|
91
|
+
stats.avgMemoryDelta = stats.totalMemoryDelta / stats.calls;
|
|
92
|
+
if (latencyMs > stats.peakLatencyMs) stats.peakLatencyMs = latencyMs;
|
|
93
|
+
stats.lastUpdated = Date.now();
|
|
94
|
+
if (this.enabled) {
|
|
95
|
+
let logs = this.callLogs.get(fid);
|
|
96
|
+
if (!logs) {
|
|
97
|
+
logs = [];
|
|
98
|
+
this.callLogs.set(fid, logs);
|
|
99
|
+
}
|
|
100
|
+
logs.push({
|
|
101
|
+
timestamp: Date.now(),
|
|
102
|
+
durationMs: latencyMs,
|
|
103
|
+
success
|
|
104
|
+
});
|
|
105
|
+
if (logs.length > this.ringBufferSize) {
|
|
106
|
+
logs.shift();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (this.runtimeStore) {
|
|
110
|
+
this.runtimeStore.appendTelemetry({
|
|
111
|
+
type: "standard_call",
|
|
112
|
+
endpointId: fid,
|
|
113
|
+
timestamp: Date.now(),
|
|
114
|
+
durationMs: latencyMs,
|
|
115
|
+
success
|
|
116
|
+
}).catch(() => {
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Record library usage (functions/helpers).
|
|
122
|
+
*/
|
|
123
|
+
recordLibraryCall(libraryId, durationMs) {
|
|
124
|
+
if (!this.enabled) return;
|
|
125
|
+
let stats = this.libraryUsage.get(libraryId);
|
|
126
|
+
if (!stats) {
|
|
127
|
+
stats = { calls: 0, totalDurationMs: 0, avgDurationMs: 0 };
|
|
128
|
+
this.libraryUsage.set(libraryId, stats);
|
|
129
|
+
}
|
|
130
|
+
stats.calls++;
|
|
131
|
+
stats.totalDurationMs += durationMs;
|
|
132
|
+
stats.avgDurationMs = stats.totalDurationMs / stats.calls;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Record library data access.
|
|
136
|
+
*/
|
|
137
|
+
recordDataAccess(dataKey, type = "read") {
|
|
138
|
+
if (!this.enabled) return;
|
|
139
|
+
let stats = this.dataUsage.get(dataKey);
|
|
140
|
+
if (!stats) {
|
|
141
|
+
stats = { reads: 0, writes: 0 };
|
|
142
|
+
this.dataUsage.set(dataKey, stats);
|
|
143
|
+
}
|
|
144
|
+
if (type === "read") stats.reads++;
|
|
145
|
+
else stats.writes++;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Returns a snapshot of all metrics.
|
|
149
|
+
*/
|
|
150
|
+
getSummary() {
|
|
151
|
+
return {
|
|
152
|
+
metrics: Object.fromEntries(this.metrics),
|
|
153
|
+
callLogs: Object.fromEntries(this.callLogs),
|
|
154
|
+
libraryUsage: Object.fromEntries(this.libraryUsage),
|
|
155
|
+
dataUsage: Object.fromEntries(this.dataUsage)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Clears all collected metrics.
|
|
160
|
+
*/
|
|
161
|
+
reset() {
|
|
162
|
+
this.metrics.clear();
|
|
163
|
+
this.callLogs.clear();
|
|
164
|
+
this.libraryUsage.clear();
|
|
165
|
+
this.dataUsage.clear();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
var telemetry = new KrnlTelemetry();
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
KrnlTelemetry,
|
|
172
|
+
telemetry
|
|
173
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
__require,
|
|
35
|
+
__commonJS,
|
|
36
|
+
__toESM
|
|
37
|
+
};
|