@moldea.ai/cli 13.0.4 → 14.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.
- package/README.md +5 -9
- package/dist/chunks/{composition-DfXcSF44.js → composition-D1OYuZ5d.js} +1 -1
- package/dist/chunks/{composition-DxVb23Ru.js → composition-_3bygS_a.js} +21 -23
- package/dist/chunks/composition-_3bygS_a.js.map +1 -0
- package/dist/chunks/{core-composition-D3haS6M3.js → core-composition-BKcJ--NX.js} +2 -2
- package/dist/chunks/{core-composition-D3haS6M3.js.map → core-composition-BKcJ--NX.js.map} +1 -1
- package/dist/moldea.js +7 -12
- package/dist/moldea.js.map +1 -1
- package/dist/portable/LICENSES.md +506 -0
- package/dist/portable/SHA256SUMS +17 -0
- package/dist/portable/analysis-worker.mjs +193 -0
- package/dist/portable/chunk-131f8005.mjs +115 -0
- package/dist/portable/chunk-2ba7e89e.mjs +26 -0
- package/dist/portable/chunk-459da9cf.mjs +4138 -0
- package/dist/portable/chunk-728df961.mjs +544 -0
- package/dist/portable/chunk-8d6114d2.mjs +588 -0
- package/dist/portable/chunk-90403e67.mjs +2 -0
- package/dist/portable/chunk-94b5ac22.mjs +59 -0
- package/dist/portable/chunk-a5514957.mjs +5870 -0
- package/dist/portable/chunk-b98ca669.mjs +2 -0
- package/dist/portable/chunk-c13db66a.mjs +380 -0
- package/dist/portable/chunk-d5af3eda.mjs +2926 -0
- package/dist/portable/chunk-ec3f49d3.mjs +367 -0
- package/dist/portable/chunk-fcbcf4e3.mjs +147458 -0
- package/dist/portable/moldea.mjs +3529 -0
- package/dist/portable/node-runner.mjs +146 -0
- package/package.json +3 -3
- package/dist/chunks/composition-DxVb23Ru.js.map +0 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { n as CoreOperationException } from "./chunk-728df961.mjs";
|
|
2
|
+
import { a as createInspectionProcessFailure, c as encodeInspectionMessage, l as serializeInspectionFailure, n as NODE_INSPECTION_LIFETIME_MS, o as decodeInspectionMessage } from "./chunk-ec3f49d3.mjs";
|
|
3
|
+
import { n as createInspectionSender } from "./chunk-94b5ac22.mjs";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { Worker } from "node:worker_threads";
|
|
6
|
+
//#region ../core/dist/node-runner.js
|
|
7
|
+
var worker;
|
|
8
|
+
var attemptId;
|
|
9
|
+
var heapMaximum;
|
|
10
|
+
var deadlineTimer;
|
|
11
|
+
var isClosing = false;
|
|
12
|
+
var hasRun = false;
|
|
13
|
+
var readerRequests = new Set();
|
|
14
|
+
var send = createInspectionSender((frame, callback) => {
|
|
15
|
+
if (process.send === void 0 || !process.connected) throw createInspectionProcessFailure();
|
|
16
|
+
process.send(frame, callback);
|
|
17
|
+
});
|
|
18
|
+
var close = async (failure) => {
|
|
19
|
+
if (isClosing) return;
|
|
20
|
+
isClosing = true;
|
|
21
|
+
clearTimeout(deadlineTimer);
|
|
22
|
+
const termination = worker?.terminate();
|
|
23
|
+
if (failure !== void 0 && attemptId !== void 0 && process.connected) try {
|
|
24
|
+
await send({
|
|
25
|
+
attemptId,
|
|
26
|
+
kind: "failure",
|
|
27
|
+
failure: serializeInspectionFailure(failure)
|
|
28
|
+
});
|
|
29
|
+
} catch {}
|
|
30
|
+
await termination;
|
|
31
|
+
readerRequests.clear();
|
|
32
|
+
process.removeListener("message", handleParentMessage);
|
|
33
|
+
process.removeListener("disconnect", handleDisconnect);
|
|
34
|
+
if (process.connected) process.disconnect();
|
|
35
|
+
};
|
|
36
|
+
var handleDisconnect = () => {
|
|
37
|
+
close();
|
|
38
|
+
};
|
|
39
|
+
var handleWorkerMessage = (frame) => {
|
|
40
|
+
try {
|
|
41
|
+
const message = decodeInspectionMessage(frame);
|
|
42
|
+
if (isClosing) return;
|
|
43
|
+
if (message.attemptId !== attemptId) throw createInspectionProcessFailure();
|
|
44
|
+
if (message.kind === "ready") {
|
|
45
|
+
if (heapMaximum !== void 0 || hasRun) throw createInspectionProcessFailure();
|
|
46
|
+
heapMaximum = message.maxAnalysisHeapBytes;
|
|
47
|
+
} else if (message.kind === "reader-request") {
|
|
48
|
+
if (!hasRun || readerRequests.has(message.requestId) || readerRequests.size >= 4) throw createInspectionProcessFailure();
|
|
49
|
+
readerRequests.add(message.requestId);
|
|
50
|
+
} else if (message.kind === "failure" && message.failure.options["limit"] === "maxAnalysisHeapBytes") throw createInspectionProcessFailure();
|
|
51
|
+
else if (![
|
|
52
|
+
"prepared",
|
|
53
|
+
"page",
|
|
54
|
+
"failure"
|
|
55
|
+
].includes(message.kind)) throw createInspectionProcessFailure();
|
|
56
|
+
send(message).catch((cause) => close(cause));
|
|
57
|
+
} catch (cause) {
|
|
58
|
+
close(cause);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var start = (message) => {
|
|
62
|
+
if (attemptId !== void 0 || isClosing) throw createInspectionProcessFailure();
|
|
63
|
+
attemptId = message.attemptId;
|
|
64
|
+
clearTimeout(deadlineTimer);
|
|
65
|
+
const remaining = Math.min(NODE_INSPECTION_LIFETIME_MS, message.deadline - Date.now());
|
|
66
|
+
if (remaining <= 0) {
|
|
67
|
+
close(new CoreOperationException({
|
|
68
|
+
code: "INSPECTION_TIMEOUT",
|
|
69
|
+
operation: "create-project-inspection"
|
|
70
|
+
}));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
deadlineTimer = setTimeout(() => {
|
|
74
|
+
close(new CoreOperationException({
|
|
75
|
+
code: "INSPECTION_TIMEOUT",
|
|
76
|
+
operation: "create-project-inspection"
|
|
77
|
+
}));
|
|
78
|
+
}, remaining);
|
|
79
|
+
worker = new Worker(new URL(new URL("./analysis-worker.mjs", import.meta.url).href), {
|
|
80
|
+
execArgv: [],
|
|
81
|
+
env: process.env,
|
|
82
|
+
stdout: true,
|
|
83
|
+
stderr: true,
|
|
84
|
+
resourceLimits: {
|
|
85
|
+
maxOldGenerationSizeMb: 512,
|
|
86
|
+
maxYoungGenerationSizeMb: 24
|
|
87
|
+
},
|
|
88
|
+
workerData: encodeInspectionMessage(message)
|
|
89
|
+
});
|
|
90
|
+
let stdioBytes = 0;
|
|
91
|
+
const consumeStdio = (chunk) => {
|
|
92
|
+
stdioBytes += chunk.byteLength;
|
|
93
|
+
if (stdioBytes > 32768) close(createInspectionProcessFailure());
|
|
94
|
+
};
|
|
95
|
+
worker.stdout.on("data", consumeStdio);
|
|
96
|
+
worker.stderr.on("data", consumeStdio);
|
|
97
|
+
worker.on("message", handleWorkerMessage);
|
|
98
|
+
worker.on("messageerror", (cause) => {
|
|
99
|
+
close(createInspectionProcessFailure(cause));
|
|
100
|
+
});
|
|
101
|
+
worker.once("error", (error) => {
|
|
102
|
+
close(error.code === "ERR_WORKER_OUT_OF_MEMORY" && heapMaximum !== void 0 ? new CoreOperationException({
|
|
103
|
+
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
104
|
+
operation: "create-project-inspection",
|
|
105
|
+
limit: "maxAnalysisHeapBytes",
|
|
106
|
+
limitMaximum: heapMaximum,
|
|
107
|
+
observedUsage: null,
|
|
108
|
+
nextAction: "review-inspection-capacity"
|
|
109
|
+
}) : createInspectionProcessFailure(error));
|
|
110
|
+
});
|
|
111
|
+
worker.once("exit", () => {
|
|
112
|
+
if (!isClosing) close(createInspectionProcessFailure());
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
var handleParentMessage = (frame) => {
|
|
116
|
+
try {
|
|
117
|
+
const message = decodeInspectionMessage(frame);
|
|
118
|
+
if (isClosing) return;
|
|
119
|
+
if (message.kind === "start") {
|
|
120
|
+
start(message);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (message.attemptId !== attemptId || worker === void 0) throw createInspectionProcessFailure();
|
|
124
|
+
if (message.kind === "dispose") {
|
|
125
|
+
close();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (message.kind === "run") {
|
|
129
|
+
if (heapMaximum === void 0 || hasRun) throw createInspectionProcessFailure();
|
|
130
|
+
hasRun = true;
|
|
131
|
+
} else if (message.kind === "reader-response" || message.kind === "reader-failure") {
|
|
132
|
+
if (!readerRequests.delete(message.requestId)) throw createInspectionProcessFailure();
|
|
133
|
+
} else if (message.kind !== "read-page" || !hasRun) throw createInspectionProcessFailure();
|
|
134
|
+
worker.postMessage(encodeInspectionMessage(message));
|
|
135
|
+
} catch (cause) {
|
|
136
|
+
close(cause);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
process.on("disconnect", handleDisconnect);
|
|
140
|
+
process.on("message", handleParentMessage);
|
|
141
|
+
deadlineTimer = setTimeout(() => {
|
|
142
|
+
close();
|
|
143
|
+
}, NODE_INSPECTION_LIFETIME_MS);
|
|
144
|
+
if (process.send === void 0 || !process.connected) close();
|
|
145
|
+
//#endregion
|
|
146
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moldea.ai/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "The canonical read-only local command-line composition for moldea repositories.",
|
|
5
5
|
"homepage": "https://github.com/moldea-ai/packages/tree/main/projects/cli#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"node": ">=22.17.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@moldea.ai/core": "^
|
|
32
|
+
"@moldea.ai/core": "^10.0.0",
|
|
33
33
|
"@moldea.ai/repository": "^4.0.0",
|
|
34
34
|
"@moldea.ai/repository-fs": "^4.0.0",
|
|
35
35
|
"jg-crypto": "0.3.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
|
-
"build": "vite build --emptyOutDir",
|
|
53
|
+
"build": "vite build --emptyOutDir && vite build --config portable.config.ts",
|
|
54
54
|
"dev": "vite build --watch",
|
|
55
55
|
"lint": "eslint .",
|
|
56
56
|
"test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:e2e",
|