@moldea.ai/core 5.0.0 → 6.0.0

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 (72) hide show
  1. package/README.md +11 -4
  2. package/dist/adapter/index.d.ts +16 -4
  3. package/dist/adapter/index.d.ts.map +1 -1
  4. package/dist/adapter-execution/index.d.ts +12 -9
  5. package/dist/adapter-execution/index.d.ts.map +1 -1
  6. package/dist/adapter-result-collection/collection.d.ts +13 -0
  7. package/dist/adapter-result-collection/collection.d.ts.map +1 -0
  8. package/dist/adapter-result-collection/index.d.ts +3 -0
  9. package/dist/adapter-result-collection/index.d.ts.map +1 -0
  10. package/dist/adapter-result-collection/types.d.ts +31 -0
  11. package/dist/adapter-result-collection/types.d.ts.map +1 -0
  12. package/dist/adapter.js +3 -2
  13. package/dist/adapter.js.map +1 -1
  14. package/dist/analysis-worker.js +190 -0
  15. package/dist/analysis-worker.js.map +1 -0
  16. package/dist/chunks/collection-CvbjjLf2.js +73 -0
  17. package/dist/chunks/collection-CvbjjLf2.js.map +1 -0
  18. package/dist/chunks/core-DchheNDz.js +5305 -0
  19. package/dist/chunks/core-DchheNDz.js.map +1 -0
  20. package/dist/chunks/errors-BQI1DEqf.js +446 -0
  21. package/dist/chunks/errors-BQI1DEqf.js.map +1 -0
  22. package/dist/chunks/{exceptions-HS9ofVy2.js → exceptions-lzD3buFw.js} +26 -15
  23. package/dist/chunks/exceptions-lzD3buFw.js.map +1 -0
  24. package/dist/chunks/lifecycle-4EkWgEHm.js +67 -0
  25. package/dist/chunks/lifecycle-4EkWgEHm.js.map +1 -0
  26. package/dist/chunks/options-CxCT3dZU.js +617 -0
  27. package/dist/chunks/options-CxCT3dZU.js.map +1 -0
  28. package/dist/chunks/repository-rpc-BWi6X1la.js +124 -0
  29. package/dist/chunks/repository-rpc-BWi6X1la.js.map +1 -0
  30. package/dist/contracts/index.d.ts +28 -18
  31. package/dist/contracts/index.d.ts.map +1 -1
  32. package/dist/custom-runtime-inspection/index.d.ts +2 -0
  33. package/dist/custom-runtime-inspection/index.d.ts.map +1 -0
  34. package/dist/custom-runtime-inspection/inspection.d.ts +11 -0
  35. package/dist/custom-runtime-inspection/inspection.d.ts.map +1 -0
  36. package/dist/exceptions/index.d.ts +23 -4
  37. package/dist/exceptions/index.d.ts.map +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +3 -5775
  41. package/dist/node/index.d.ts +4 -0
  42. package/dist/node/index.d.ts.map +1 -0
  43. package/dist/node-inspection/analysis-worker.d.ts +2 -0
  44. package/dist/node-inspection/analysis-worker.d.ts.map +1 -0
  45. package/dist/node-inspection/client.d.ts +32 -0
  46. package/dist/node-inspection/client.d.ts.map +1 -0
  47. package/dist/node-inspection/constants.d.ts +21 -0
  48. package/dist/node-inspection/constants.d.ts.map +1 -0
  49. package/dist/node-inspection/errors.d.ts +11 -0
  50. package/dist/node-inspection/errors.d.ts.map +1 -0
  51. package/dist/node-inspection/lifecycle.d.ts +15 -0
  52. package/dist/node-inspection/lifecycle.d.ts.map +1 -0
  53. package/dist/node-inspection/protocol.d.ts +20 -0
  54. package/dist/node-inspection/protocol.d.ts.map +1 -0
  55. package/dist/node-inspection/repository-rpc.d.ts +28 -0
  56. package/dist/node-inspection/repository-rpc.d.ts.map +1 -0
  57. package/dist/node-inspection/runner.d.ts +2 -0
  58. package/dist/node-inspection/runner.d.ts.map +1 -0
  59. package/dist/node-inspection/types.d.ts +99 -0
  60. package/dist/node-inspection/types.d.ts.map +1 -0
  61. package/dist/node-runner.js +149 -0
  62. package/dist/node-runner.js.map +1 -0
  63. package/dist/node.js +325 -0
  64. package/dist/node.js.map +1 -0
  65. package/dist/project-inspection/index.d.ts +22 -1
  66. package/dist/project-inspection/index.d.ts.map +1 -1
  67. package/dist/project-metadata/index.d.ts.map +1 -1
  68. package/dist/project-validation/index.d.ts +34 -10
  69. package/dist/project-validation/index.d.ts.map +1 -1
  70. package/package.json +9 -1
  71. package/dist/chunks/exceptions-HS9ofVy2.js.map +0 -1
  72. package/dist/index.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ import { a as encodeInspectionMessage, r as createInspectionProcessFailure, u as NODE_INSPECTION_TERMINATION_GRACE_MS } from "./errors-BQI1DEqf.js";
2
+ import process from "node:process";
3
+ //#region src/node-inspection/lifecycle.ts
4
+ /** Serializes bounded IPC sends and waits for Node's send callback before admitting the next. */
5
+ var createInspectionSender = (send) => {
6
+ let queued = 0;
7
+ let tail = Promise.resolve();
8
+ return async (message) => {
9
+ if (queued >= 4) throw createInspectionProcessFailure();
10
+ queued++;
11
+ const operation = tail.then(() => new Promise((resolve, reject) => {
12
+ try {
13
+ send(encodeInspectionMessage(message), (error) => {
14
+ if (error !== null) reject(createInspectionProcessFailure(error));
15
+ else resolve();
16
+ });
17
+ } catch (cause) {
18
+ reject(cause instanceof Error ? cause : createInspectionProcessFailure(cause));
19
+ }
20
+ }));
21
+ tail = operation.catch(() => {});
22
+ try {
23
+ await operation;
24
+ } finally {
25
+ queued--;
26
+ }
27
+ };
28
+ };
29
+ /** Keeps only operating-system bootstrap variables; no credentials or Node overrides cross. */
30
+ var createInspectionEnvironment = () => {
31
+ const names = /* @__PURE__ */ new Set([
32
+ "systemroot",
33
+ "windir",
34
+ "temp",
35
+ "tmp",
36
+ "tmpdir"
37
+ ]);
38
+ return Object.fromEntries(Object.entries(process.env).filter(([name]) => names.has(name.toLowerCase())));
39
+ };
40
+ /**
41
+ * Supervises one owned child without PID polling, shell commands, or process-group killing.
42
+ * @returns Idempotent termination and actual close notification.
43
+ */
44
+ var superviseInspectionChild = (child, requestStop) => {
45
+ let hasClosed = false;
46
+ let forceTimer;
47
+ return {
48
+ closed: new Promise((resolve) => {
49
+ child.once("close", () => {
50
+ hasClosed = true;
51
+ clearTimeout(forceTimer);
52
+ resolve();
53
+ });
54
+ }),
55
+ terminate: () => {
56
+ if (hasClosed || forceTimer !== void 0) return;
57
+ forceTimer = setTimeout(() => {
58
+ if (!hasClosed) child.kill("SIGKILL");
59
+ }, NODE_INSPECTION_TERMINATION_GRACE_MS);
60
+ requestStop();
61
+ }
62
+ };
63
+ };
64
+ //#endregion
65
+ export { createInspectionSender as n, superviseInspectionChild as r, createInspectionEnvironment as t };
66
+
67
+ //# sourceMappingURL=lifecycle-4EkWgEHm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-4EkWgEHm.js","names":[],"sources":["../../src/node-inspection/lifecycle.ts"],"sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport process from 'node:process';\n\nimport { NODE_INSPECTION_TERMINATION_GRACE_MS } from './constants.js';\nimport { NODE_INSPECTION_MAX_REQUESTS } from './constants.js';\nimport { createInspectionProcessFailure, encodeInspectionMessage } from './protocol.js';\nimport type { INodeInspectionMessage } from './types.js';\n\n/** Serializes bounded IPC sends and waits for Node's send callback before admitting the next. */\nexport const createInspectionSender = (\n send: (frame: string, callback: (error: Error | null) => void) => void,\n): ((message: INodeInspectionMessage) => Promise<void>) => {\n let queued = 0;\n let tail = Promise.resolve();\n return async (message) => {\n if (queued >= NODE_INSPECTION_MAX_REQUESTS) throw createInspectionProcessFailure();\n queued++;\n const operation = tail.then(\n () =>\n new Promise<void>((resolve, reject) => {\n try {\n send(encodeInspectionMessage(message), (error) => {\n if (error !== null) reject(createInspectionProcessFailure(error));\n else resolve();\n });\n } catch (cause) {\n reject(cause instanceof Error ? cause : createInspectionProcessFailure(cause));\n }\n }),\n );\n tail = operation.catch(() => {});\n try {\n await operation;\n } finally {\n queued--;\n }\n };\n};\n\n/** Keeps only operating-system bootstrap variables; no credentials or Node overrides cross. */\nexport const createInspectionEnvironment = (): NodeJS.ProcessEnv => {\n const names = new Set(['systemroot', 'windir', 'temp', 'tmp', 'tmpdir']);\n return Object.fromEntries(\n Object.entries(process.env).filter(([name]) => names.has(name.toLowerCase())),\n );\n};\n\n/**\n * Supervises one owned child without PID polling, shell commands, or process-group killing.\n * @returns Idempotent termination and actual close notification.\n */\nexport const superviseInspectionChild = (\n child: ChildProcess,\n requestStop: () => void,\n): {\n closed: Promise<void>;\n terminate: () => void;\n} => {\n let hasClosed = false;\n let forceTimer: NodeJS.Timeout | undefined;\n const closed = new Promise<void>((resolve) => {\n child.once('close', () => {\n hasClosed = true;\n clearTimeout(forceTimer);\n resolve();\n });\n });\n return {\n closed,\n terminate: (): void => {\n if (hasClosed || forceTimer !== undefined) return;\n // Let the child close IPC. Local disconnect can suppress ChildProcess's close event.\n forceTimer = setTimeout(() => {\n if (!hasClosed) child.kill('SIGKILL');\n }, NODE_INSPECTION_TERMINATION_GRACE_MS);\n requestStop();\n },\n };\n};\n"],"mappings":";;;;AASA,IAAa,0BACX,SACyD;CACzD,IAAI,SAAS;CACb,IAAI,OAAO,QAAQ,QAAQ;CAC3B,OAAO,OAAO,YAAY;EACxB,IAAI,UAAA,GAAwC,MAAM,+BAA+B;EACjF;EACA,MAAM,YAAY,KAAK,WAEnB,IAAI,SAAe,SAAS,WAAW;GACrC,IAAI;IACF,KAAK,wBAAwB,OAAO,IAAI,UAAU;KAChD,IAAI,UAAU,MAAM,OAAO,+BAA+B,KAAK,CAAC;UAC3D,QAAQ;IACf,CAAC;GACH,SAAS,OAAO;IACd,OAAO,iBAAiB,QAAQ,QAAQ,+BAA+B,KAAK,CAAC;GAC/E;EACF,CAAC,CACL;EACA,OAAO,UAAU,YAAY,CAAC,CAAC;EAC/B,IAAI;GACF,MAAM;EACR,UAAU;GACR;EACF;CACF;AACF;;AAGA,IAAa,oCAAuD;CAClE,MAAM,wBAAQ,IAAI,IAAI;EAAC;EAAc;EAAU;EAAQ;EAAO;CAAQ,CAAC;CACvE,OAAO,OAAO,YACZ,OAAO,QAAQ,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,UAAU,MAAM,IAAI,KAAK,YAAY,CAAC,CAAC,CAC9E;AACF;;;;;AAMA,IAAa,4BACX,OACA,gBAIG;CACH,IAAI,YAAY;CAChB,IAAI;CAQJ,OAAO;EACL,QAAA,IARiB,SAAe,YAAY;GAC5C,MAAM,KAAK,eAAe;IACxB,YAAY;IACZ,aAAa,UAAU;IACvB,QAAQ;GACV,CAAC;EACH,CAEE;EACA,iBAAuB;GACrB,IAAI,aAAa,eAAe,KAAA,GAAW;GAE3C,aAAa,iBAAiB;IAC5B,IAAI,CAAC,WAAW,MAAM,KAAK,SAAS;GACtC,GAAG,oCAAoC;GACvC,YAAY;EACd;CACF;AACF"}