oc-pilot 0.89.0 → 0.91.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/CHANGELOG.md +16 -0
- package/README.md +10 -6
- package/README.ru.md +9 -5
- package/dist/cli.js +9 -1
- package/dist/cli.js.map +1 -1
- package/dist/cli.test.js +50 -0
- package/dist/cli.test.js.map +1 -1
- package/dist/commands/alien-dna.js +73 -0
- package/dist/commands/alien-dna.js.map +1 -0
- package/dist/commands/hyper-chamber.js +96 -0
- package/dist/commands/hyper-chamber.js.map +1 -0
- package/dist/core/alien-dna.js +310 -0
- package/dist/core/alien-dna.js.map +1 -0
- package/dist/core/alien-dna.test.js +117 -0
- package/dist/core/alien-dna.test.js.map +1 -0
- package/dist/core/hyper-chamber.js +483 -0
- package/dist/core/hyper-chamber.js.map +1 -0
- package/dist/core/hyper-chamber.test.js +105 -0
- package/dist/core/hyper-chamber.test.js.map +1 -0
- package/dist/mcp-prompts.test.js +2 -0
- package/dist/mcp-prompts.test.js.map +1 -1
- package/dist/mcp.js +100 -0
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.test.js +10 -0
- package/dist/mcp.test.js.map +1 -1
- package/dist/skills.test.js +2 -0
- package/dist/skills.test.js.map +1 -1
- package/dist/version.js +1 -1
- package/docs/integrations.md +5 -5
- package/package.json +1 -1
- package/skills/agent-self-review/SKILL.md +1 -1
- package/skills/commit-discipline/SKILL.md +1 -1
- package/skills/oc-pilot/SKILL.md +4 -0
- package/skills/secure-diff-gate/SKILL.md +1 -1
- package/skills/stack-review-packs/SKILL.md +1 -1
- package/skills/test-failure-triage/SKILL.md +1 -1
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, mkdtempSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { PilotError } from "./errors.js";
|
|
6
|
+
const DEFAULT_DAYS = 365;
|
|
7
|
+
const DEFAULT_BUDGET_MS = 2_000;
|
|
8
|
+
const DEFAULT_MEMORY_MB = 128;
|
|
9
|
+
const MAX_ITERATIONS = 100_000;
|
|
10
|
+
const MAX_FILE_BYTES = 256_000;
|
|
11
|
+
const WORKER = `import { readFileSync } from "node:fs";
|
|
12
|
+
import vm from "node:vm";
|
|
13
|
+
import v8 from "node:v8";
|
|
14
|
+
|
|
15
|
+
const payload = JSON.parse(readFileSync(process.argv[2], "utf8"));
|
|
16
|
+
const output = [];
|
|
17
|
+
const push = (...args) => {
|
|
18
|
+
if (output.length >= 60) return;
|
|
19
|
+
output.push(args.map((value) => String(value)).join(" "));
|
|
20
|
+
};
|
|
21
|
+
const blocked = (label) => {
|
|
22
|
+
throw new Error("ChamberError: " + label + " blocked");
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const DAY_MS = 86400000;
|
|
26
|
+
const simStart = Date.UTC(2026, 0, 1);
|
|
27
|
+
let simulatedNow = simStart;
|
|
28
|
+
let timerId = 0;
|
|
29
|
+
const timers = new Map();
|
|
30
|
+
const schedule = (fn, ms, interval) => {
|
|
31
|
+
const id = ++timerId;
|
|
32
|
+
const delay = Math.max(0, Math.min(1000, Number(ms) || 0));
|
|
33
|
+
const fire = () => {
|
|
34
|
+
try {
|
|
35
|
+
fn();
|
|
36
|
+
} catch (error) {
|
|
37
|
+
push("timer error: " + (error instanceof Error ? error.message : String(error)));
|
|
38
|
+
}
|
|
39
|
+
const current = timers.get(id);
|
|
40
|
+
if (!current) return;
|
|
41
|
+
current.count += 1;
|
|
42
|
+
if (interval && current.count < 5) {
|
|
43
|
+
current.handle = setTimeout(fire, Math.min(delay, 1));
|
|
44
|
+
} else {
|
|
45
|
+
timers.delete(id);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const handle = setTimeout(fire, Math.min(delay, 1));
|
|
49
|
+
timers.set(id, { handle, count: 0 });
|
|
50
|
+
return id;
|
|
51
|
+
};
|
|
52
|
+
const clearTimer = (id) => {
|
|
53
|
+
const record = timers.get(id);
|
|
54
|
+
if (!record) return;
|
|
55
|
+
clearTimeout(record.handle);
|
|
56
|
+
timers.delete(id);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
class FakeDate extends Date {
|
|
60
|
+
constructor(...args) {
|
|
61
|
+
if (args.length === 0) super(simulatedNow);
|
|
62
|
+
else super(...args);
|
|
63
|
+
}
|
|
64
|
+
static now() {
|
|
65
|
+
return simulatedNow;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const context = vm.createContext({
|
|
70
|
+
console: { log: push, info: push, warn: push, error: push, debug: push },
|
|
71
|
+
fetch: () => blocked("fetch"),
|
|
72
|
+
require: (id) => blocked("require(" + id + ")"),
|
|
73
|
+
process: {
|
|
74
|
+
env: {},
|
|
75
|
+
argv: [],
|
|
76
|
+
cwd: () => "/chamber",
|
|
77
|
+
platform: process.platform,
|
|
78
|
+
exit: () => blocked("process.exit"),
|
|
79
|
+
kill: () => blocked("process.kill"),
|
|
80
|
+
memoryUsage: () => process.memoryUsage(),
|
|
81
|
+
hrtime: process.hrtime,
|
|
82
|
+
},
|
|
83
|
+
setTimeout: (fn, ms) => schedule(fn, ms, false),
|
|
84
|
+
setInterval: (fn, ms) => schedule(fn, ms, true),
|
|
85
|
+
clearTimeout: clearTimer,
|
|
86
|
+
clearInterval: clearTimer,
|
|
87
|
+
Date: FakeDate,
|
|
88
|
+
gc: () => {
|
|
89
|
+
if (typeof global.gc === "function") global.gc();
|
|
90
|
+
},
|
|
91
|
+
Buffer: undefined,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const code = readFileSync(payload.file, "utf8");
|
|
95
|
+
const isModule = payload.file.endsWith(".mjs") || /^\\s*(?:import|export)\\b/m.test(code);
|
|
96
|
+
let entry;
|
|
97
|
+
let entryScript;
|
|
98
|
+
let plainScript;
|
|
99
|
+
if (isModule) {
|
|
100
|
+
const module = new vm.SourceTextModule(code, { context, identifier: payload.file });
|
|
101
|
+
await module.link(() => {
|
|
102
|
+
throw new Error("ChamberError: import blocked");
|
|
103
|
+
});
|
|
104
|
+
await module.evaluate();
|
|
105
|
+
const names = ["run", "tick", "main", "default"];
|
|
106
|
+
const name = names.find((candidate) => typeof module.namespace[candidate] === "function");
|
|
107
|
+
if (!name) {
|
|
108
|
+
throw new Error("ChamberError: export a function named run, tick, main or default");
|
|
109
|
+
}
|
|
110
|
+
entry = module.namespace[name];
|
|
111
|
+
entryScript = new vm.Script("__chamberEntry()", { filename: "hyper-chamber-entry" });
|
|
112
|
+
} else {
|
|
113
|
+
plainScript = new vm.Script("(function(){\\n" + code + "\\n})()", { filename: payload.file });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const runOnce = () => {
|
|
117
|
+
if (entry) {
|
|
118
|
+
context.__chamberEntry = entry;
|
|
119
|
+
try {
|
|
120
|
+
return entryScript.runInContext(context);
|
|
121
|
+
} finally {
|
|
122
|
+
context.__chamberEntry = undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return plainScript.runInContext(context);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const realSetTimeout = setTimeout;
|
|
129
|
+
|
|
130
|
+
const memoryLimitBytes = payload.memoryMb * 1024 * 1024;
|
|
131
|
+
const started = performance.now();
|
|
132
|
+
const samples = [];
|
|
133
|
+
let iterations = 0;
|
|
134
|
+
let status = "ok";
|
|
135
|
+
let error;
|
|
136
|
+
let lastSampleAt = 0;
|
|
137
|
+
|
|
138
|
+
const sample = () => {
|
|
139
|
+
if (typeof global.gc === "function") global.gc();
|
|
140
|
+
const heap = v8.getHeapStatistics().used_heap_size;
|
|
141
|
+
const day = Math.max(0, (simulatedNow - simStart) / DAY_MS);
|
|
142
|
+
samples.push({ day, heap });
|
|
143
|
+
if (samples.length > 500) samples.shift();
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
while (iterations < payload.maxIterations) {
|
|
148
|
+
const elapsed = performance.now() - started;
|
|
149
|
+
if (elapsed >= payload.budgetMs) break;
|
|
150
|
+
simulatedNow = simStart + Math.round(payload.days * DAY_MS * (elapsed / payload.budgetMs));
|
|
151
|
+
const result = runOnce();
|
|
152
|
+
if (result && typeof result.then === "function") {
|
|
153
|
+
await result;
|
|
154
|
+
}
|
|
155
|
+
iterations += 1;
|
|
156
|
+
const now = performance.now() - started;
|
|
157
|
+
if (now - lastSampleAt >= 50 || iterations % 1000 === 0) {
|
|
158
|
+
sample();
|
|
159
|
+
lastSampleAt = now;
|
|
160
|
+
}
|
|
161
|
+
if (iterations % 1000 === 0) {
|
|
162
|
+
await new Promise((resolveTick) => realSetTimeout(resolveTick, 0));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
simulatedNow = simStart + Math.round(payload.days * DAY_MS * Math.min(1, (performance.now() - started) / payload.budgetMs));
|
|
166
|
+
sample();
|
|
167
|
+
} catch (caught) {
|
|
168
|
+
const message = caught instanceof Error ? caught.message : String(caught);
|
|
169
|
+
const code = caught && typeof caught === "object" && "code" in caught ? String(caught.code) : "";
|
|
170
|
+
if (message.includes("iteration timeout") || code === "ERR_SCRIPT_EXECUTION_TIMEOUT" || /timed out/i.test(message)) {
|
|
171
|
+
status = "timeout";
|
|
172
|
+
} else {
|
|
173
|
+
status = "error";
|
|
174
|
+
}
|
|
175
|
+
error = message.slice(0, 500);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (const record of timers.values()) clearTimeout(record.handle);
|
|
179
|
+
timers.clear();
|
|
180
|
+
if (samples.length === 0) sample();
|
|
181
|
+
|
|
182
|
+
const simulatedDays = Math.max(0, Math.round((simulatedNow - simStart) / DAY_MS));
|
|
183
|
+
const firstHeap = samples.length > 0 ? samples[0].heap : 0;
|
|
184
|
+
const lastHeap = samples.length > 0 ? samples[samples.length - 1].heap : 0;
|
|
185
|
+
let growth = firstHeap > 0 && lastHeap > 0 ? lastHeap / firstHeap : 0;
|
|
186
|
+
let slopePerDay = 0;
|
|
187
|
+
let crashDay = simulatedDays;
|
|
188
|
+
let summary = "";
|
|
189
|
+
|
|
190
|
+
const warmup = Math.min(Math.max(0, samples.length - 1), Math.max(2, Math.floor(samples.length * 0.2)));
|
|
191
|
+
const usable = samples.slice(warmup);
|
|
192
|
+
if (usable.length >= 4 && status === "ok") {
|
|
193
|
+
const third = Math.max(1, Math.floor(usable.length / 3));
|
|
194
|
+
const median = (values) => {
|
|
195
|
+
const sorted = [...values].sort((left, right) => left - right);
|
|
196
|
+
return sorted[Math.floor(sorted.length / 2)];
|
|
197
|
+
};
|
|
198
|
+
const earlyMedian = median(usable.slice(0, third).map((point) => point.heap));
|
|
199
|
+
const lateMedian = median(usable.slice(-third).map((point) => point.heap));
|
|
200
|
+
growth = earlyMedian > 0 ? lateMedian / earlyMedian : 0;
|
|
201
|
+
const absolute = lateMedian - earlyMedian;
|
|
202
|
+
const count = usable.length;
|
|
203
|
+
const meanX = usable.reduce((sum, point) => sum + point.day, 0) / count;
|
|
204
|
+
const meanY = usable.reduce((sum, point) => sum + point.heap, 0) / count;
|
|
205
|
+
let numerator = 0;
|
|
206
|
+
let denominator = 0;
|
|
207
|
+
let total = 0;
|
|
208
|
+
for (const point of usable) {
|
|
209
|
+
const dx = point.day - meanX;
|
|
210
|
+
numerator += dx * (point.heap - meanY);
|
|
211
|
+
denominator += dx * dx;
|
|
212
|
+
total += (point.heap - meanY) * (point.heap - meanY);
|
|
213
|
+
}
|
|
214
|
+
slopePerDay = denominator > 0 ? numerator / denominator : 0;
|
|
215
|
+
let residual = 0;
|
|
216
|
+
for (const point of usable) {
|
|
217
|
+
const predicted = meanY + slopePerDay * (point.day - meanX);
|
|
218
|
+
residual += (point.heap - predicted) * (point.heap - predicted);
|
|
219
|
+
}
|
|
220
|
+
const r2 = total > 0 ? 1 - residual / total : 0;
|
|
221
|
+
const nearLimit = lateMedian >= memoryLimitBytes * 0.75;
|
|
222
|
+
const leaking = nearLimit || (growth >= 1.2 && absolute >= 512 * 1024 && slopePerDay > 0 && r2 >= 0.35);
|
|
223
|
+
if (leaking) {
|
|
224
|
+
status = "leak";
|
|
225
|
+
const currentDay = usable[usable.length - 1].day;
|
|
226
|
+
if (slopePerDay > 0) {
|
|
227
|
+
crashDay = Math.max(1, Math.min(payload.days, Math.round(currentDay + (memoryLimitBytes - lateMedian) / slopePerDay)));
|
|
228
|
+
} else {
|
|
229
|
+
crashDay = Math.max(1, Math.min(payload.days, Math.round(currentDay)));
|
|
230
|
+
}
|
|
231
|
+
summary = "[MEMORY LEAK DETECTED]: AI code survives Day 1, but crashes on Day " + String(crashDay) + " of simulated uptime.";
|
|
232
|
+
} else {
|
|
233
|
+
summary = "Утечек не обнаружено: heap стабилен на " + String(simulatedDays) + " симулированных суток.";
|
|
234
|
+
}
|
|
235
|
+
} else if (status === "ok") {
|
|
236
|
+
summary = "Недостаточно замеров heap для вывода: " + String(samples.length) + " sample(s).";
|
|
237
|
+
}
|
|
238
|
+
if (status === "timeout") {
|
|
239
|
+
summary = "Симуляция остановлена по таймауту на " + String(simulatedDays) + " сутках.";
|
|
240
|
+
}
|
|
241
|
+
if (status === "error") {
|
|
242
|
+
summary = "Симуляция остановлена ошибкой: " + (error || "unknown");
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
console.log(JSON.stringify({
|
|
246
|
+
status,
|
|
247
|
+
simulatedDays,
|
|
248
|
+
iterations,
|
|
249
|
+
samples: samples.length,
|
|
250
|
+
firstHeap,
|
|
251
|
+
lastHeap,
|
|
252
|
+
growth,
|
|
253
|
+
slopePerDay,
|
|
254
|
+
crashDay,
|
|
255
|
+
output,
|
|
256
|
+
error,
|
|
257
|
+
durationMs: Math.round(performance.now() - started),
|
|
258
|
+
summary,
|
|
259
|
+
}));
|
|
260
|
+
`;
|
|
261
|
+
function inside(cwd, file) {
|
|
262
|
+
const root = resolve(cwd);
|
|
263
|
+
const target = resolve(root, file);
|
|
264
|
+
const rel = relative(root, target);
|
|
265
|
+
if (rel.startsWith("..") || rel.includes(`..${sep}`) || resolve(root, rel) !== target) {
|
|
266
|
+
throw new PilotError("Путь выходит за пределы проекта", { exitCode: 2 });
|
|
267
|
+
}
|
|
268
|
+
return target;
|
|
269
|
+
}
|
|
270
|
+
function runnableFile(cwd, file) {
|
|
271
|
+
if (file.endsWith(".tsx"))
|
|
272
|
+
return { reason: "TSX не исполняется в vm" };
|
|
273
|
+
if (file.endsWith(".ts")) {
|
|
274
|
+
if (file.startsWith("src/")) {
|
|
275
|
+
const built = join(cwd, "dist", file.slice(4).replace(/\.ts$/, ".js"));
|
|
276
|
+
if (existsSync(built))
|
|
277
|
+
return { path: built };
|
|
278
|
+
}
|
|
279
|
+
return { reason: "TypeScript требует собранный JS: hyper-chamber не транспилирует" };
|
|
280
|
+
}
|
|
281
|
+
return { path: inside(cwd, file) };
|
|
282
|
+
}
|
|
283
|
+
function parseWorker(stdout) {
|
|
284
|
+
const line = stdout
|
|
285
|
+
.split(/\r?\n/)
|
|
286
|
+
.map((value) => value.trim())
|
|
287
|
+
.filter((value) => value.startsWith("{"))
|
|
288
|
+
.pop();
|
|
289
|
+
if (!line)
|
|
290
|
+
return undefined;
|
|
291
|
+
try {
|
|
292
|
+
return JSON.parse(line);
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function summaryFor(file, status, days, error) {
|
|
299
|
+
if (status === "leak") {
|
|
300
|
+
return `[MEMORY LEAK DETECTED]: AI code survives Day 1, but crashes on Day ${String(days)} of simulated uptime.`;
|
|
301
|
+
}
|
|
302
|
+
if (status === "timeout")
|
|
303
|
+
return `Симуляция остановлена по таймауту на ${String(days)} сутках.`;
|
|
304
|
+
if (status === "error")
|
|
305
|
+
return `Симуляция остановлена ошибкой: ${error ?? "unknown"}`;
|
|
306
|
+
return `Утечек не обнаружено: ${file}.`;
|
|
307
|
+
}
|
|
308
|
+
/** Ages one self-contained JS/ESM file in a vm and looks for sustained heap growth. */
|
|
309
|
+
export function runHyperChamber(cwd, file, options = {}) {
|
|
310
|
+
const days = Math.max(1, Math.min(3_650, Math.round(options.days ?? DEFAULT_DAYS)));
|
|
311
|
+
const budgetMs = Math.max(100, Math.min(30_000, Math.round(options.budgetMs ?? DEFAULT_BUDGET_MS)));
|
|
312
|
+
const memoryMb = Math.max(16, Math.min(4_096, Math.round(options.memoryMb ?? DEFAULT_MEMORY_MB)));
|
|
313
|
+
const target = runnableFile(cwd, file);
|
|
314
|
+
if (!target.path) {
|
|
315
|
+
return {
|
|
316
|
+
file,
|
|
317
|
+
status: "error",
|
|
318
|
+
simulatedDays: 0,
|
|
319
|
+
iterations: 0,
|
|
320
|
+
samples: 0,
|
|
321
|
+
firstHeap: 0,
|
|
322
|
+
lastHeap: 0,
|
|
323
|
+
growth: 0,
|
|
324
|
+
slopePerDay: 0,
|
|
325
|
+
crashDay: 0,
|
|
326
|
+
output: [],
|
|
327
|
+
error: target.reason,
|
|
328
|
+
durationMs: 0,
|
|
329
|
+
summary: summaryFor(file, "error", 0, target.reason),
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
if (!existsSync(target.path)) {
|
|
333
|
+
return {
|
|
334
|
+
file,
|
|
335
|
+
status: "error",
|
|
336
|
+
simulatedDays: 0,
|
|
337
|
+
iterations: 0,
|
|
338
|
+
samples: 0,
|
|
339
|
+
firstHeap: 0,
|
|
340
|
+
lastHeap: 0,
|
|
341
|
+
growth: 0,
|
|
342
|
+
slopePerDay: 0,
|
|
343
|
+
crashDay: 0,
|
|
344
|
+
output: [],
|
|
345
|
+
error: "файл не найден",
|
|
346
|
+
durationMs: 0,
|
|
347
|
+
summary: summaryFor(file, "error", 0, "файл не найден"),
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
if (statSync(target.path).size > MAX_FILE_BYTES) {
|
|
351
|
+
const error = `файл больше ${String(MAX_FILE_BYTES)} байт`;
|
|
352
|
+
return {
|
|
353
|
+
file,
|
|
354
|
+
status: "error",
|
|
355
|
+
simulatedDays: 0,
|
|
356
|
+
iterations: 0,
|
|
357
|
+
samples: 0,
|
|
358
|
+
firstHeap: 0,
|
|
359
|
+
lastHeap: 0,
|
|
360
|
+
growth: 0,
|
|
361
|
+
slopePerDay: 0,
|
|
362
|
+
crashDay: 0,
|
|
363
|
+
output: [],
|
|
364
|
+
error,
|
|
365
|
+
durationMs: 0,
|
|
366
|
+
summary: summaryFor(file, "error", 0, error),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
const dir = mkdtempSync(join(tmpdir(), "oc-pilot-hyper-chamber-"));
|
|
370
|
+
const started = Date.now();
|
|
371
|
+
try {
|
|
372
|
+
const worker = join(dir, "worker.mjs");
|
|
373
|
+
const payload = join(dir, "payload.json");
|
|
374
|
+
writeFileSync(worker, WORKER, "utf8");
|
|
375
|
+
writeFileSync(payload, JSON.stringify({
|
|
376
|
+
file: target.path,
|
|
377
|
+
days,
|
|
378
|
+
budgetMs,
|
|
379
|
+
memoryMb,
|
|
380
|
+
maxIterations: MAX_ITERATIONS,
|
|
381
|
+
iterationTimeoutMs: 250,
|
|
382
|
+
}), "utf8");
|
|
383
|
+
const result = spawnSync(process.execPath, ["--expose-gc", "--experimental-vm-modules", `--max-old-space-size=${String(memoryMb)}`, worker, payload], { cwd, encoding: "utf8", timeout: budgetMs + 4_000, killSignal: "SIGKILL", maxBuffer: 4 * 1024 * 1024 });
|
|
384
|
+
const durationMs = Date.now() - started;
|
|
385
|
+
if (result.error && result.error.code === "ETIMEDOUT") {
|
|
386
|
+
return {
|
|
387
|
+
file,
|
|
388
|
+
status: "timeout",
|
|
389
|
+
simulatedDays: days,
|
|
390
|
+
iterations: 0,
|
|
391
|
+
samples: 0,
|
|
392
|
+
firstHeap: 0,
|
|
393
|
+
lastHeap: 0,
|
|
394
|
+
growth: 0,
|
|
395
|
+
slopePerDay: 0,
|
|
396
|
+
crashDay: 0,
|
|
397
|
+
output: [],
|
|
398
|
+
error: "worker timeout",
|
|
399
|
+
durationMs,
|
|
400
|
+
summary: summaryFor(file, "timeout", days),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
const parsed = parseWorker(result.stdout ?? "");
|
|
404
|
+
if (!parsed) {
|
|
405
|
+
const stderr = result.stderr ?? "";
|
|
406
|
+
if (/heap out of memory|JavaScript heap out of memory/i.test(stderr)) {
|
|
407
|
+
return {
|
|
408
|
+
file,
|
|
409
|
+
status: "leak",
|
|
410
|
+
simulatedDays: days,
|
|
411
|
+
iterations: 0,
|
|
412
|
+
samples: 0,
|
|
413
|
+
firstHeap: 0,
|
|
414
|
+
lastHeap: 0,
|
|
415
|
+
growth: 0,
|
|
416
|
+
slopePerDay: 0,
|
|
417
|
+
crashDay: days,
|
|
418
|
+
output: [],
|
|
419
|
+
error: "heap exhausted during simulation",
|
|
420
|
+
durationMs,
|
|
421
|
+
summary: summaryFor(file, "leak", days),
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
const error = (stderr || "worker не вернул результат").slice(0, 500);
|
|
425
|
+
return {
|
|
426
|
+
file,
|
|
427
|
+
status: "error",
|
|
428
|
+
simulatedDays: 0,
|
|
429
|
+
iterations: 0,
|
|
430
|
+
samples: 0,
|
|
431
|
+
firstHeap: 0,
|
|
432
|
+
lastHeap: 0,
|
|
433
|
+
growth: 0,
|
|
434
|
+
slopePerDay: 0,
|
|
435
|
+
crashDay: 0,
|
|
436
|
+
output: [],
|
|
437
|
+
error,
|
|
438
|
+
durationMs,
|
|
439
|
+
summary: summaryFor(file, "error", 0, error),
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
const status = parsed.status === "ok" || parsed.status === "leak" || parsed.status === "timeout" || parsed.status === "error"
|
|
443
|
+
? parsed.status
|
|
444
|
+
: "error";
|
|
445
|
+
const summary = typeof parsed.summary === "string" && parsed.summary.trim()
|
|
446
|
+
? parsed.summary
|
|
447
|
+
: summaryFor(file, status, parsed.simulatedDays ?? days, parsed.error);
|
|
448
|
+
return {
|
|
449
|
+
file,
|
|
450
|
+
status,
|
|
451
|
+
simulatedDays: typeof parsed.simulatedDays === "number" ? parsed.simulatedDays : 0,
|
|
452
|
+
iterations: typeof parsed.iterations === "number" ? parsed.iterations : 0,
|
|
453
|
+
samples: typeof parsed.samples === "number" ? parsed.samples : 0,
|
|
454
|
+
firstHeap: typeof parsed.firstHeap === "number" ? parsed.firstHeap : 0,
|
|
455
|
+
lastHeap: typeof parsed.lastHeap === "number" ? parsed.lastHeap : 0,
|
|
456
|
+
growth: typeof parsed.growth === "number" ? parsed.growth : 0,
|
|
457
|
+
slopePerDay: typeof parsed.slopePerDay === "number" ? parsed.slopePerDay : 0,
|
|
458
|
+
crashDay: typeof parsed.crashDay === "number" ? parsed.crashDay : 0,
|
|
459
|
+
output: Array.isArray(parsed.output) ? parsed.output.filter((line) => typeof line === "string") : [],
|
|
460
|
+
error: typeof parsed.error === "string" ? parsed.error : undefined,
|
|
461
|
+
durationMs,
|
|
462
|
+
summary,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
finally {
|
|
466
|
+
rmSync(dir, { recursive: true, force: true });
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
export function renderHyperChamber(result) {
|
|
470
|
+
const mb = (bytes) => `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
471
|
+
const lines = [
|
|
472
|
+
`Hyper chamber: ${result.status} (${(result.durationMs / 1000).toFixed(1)}s, ${String(result.simulatedDays)} simulated days) ${result.file}`,
|
|
473
|
+
` iterations: ${String(result.iterations)}`,
|
|
474
|
+
];
|
|
475
|
+
if (result.samples > 0) {
|
|
476
|
+
lines.push(` heap: ${mb(result.firstHeap)} -> ${mb(result.lastHeap)} (x${result.growth.toFixed(2)})`);
|
|
477
|
+
}
|
|
478
|
+
lines.push(` ${result.summary}`);
|
|
479
|
+
for (const line of result.output)
|
|
480
|
+
lines.push(` ${line}`);
|
|
481
|
+
return `${lines.join("\n")}\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B,CAAC,MAA0B;IAC3D,MAAM,EAAE,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/E,MAAM,KAAK,GAAG;QACZ,kBAAkB,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,oBAAoB,MAAM,CAAC,IAAI,EAAE;QAC5I,iBAAiB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;KAC7C,CAAC;IACF,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzG,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC1D,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import { renderHyperChamber, runHyperChamber } from "./hyper-chamber.js";
|
|
7
|
+
function makeRepo(files) {
|
|
8
|
+
const dir = mkdtempSync(join(tmpdir(), "oc-pilot-hyper-chamber-test-"));
|
|
9
|
+
for (const [path, content] of Object.entries(files))
|
|
10
|
+
writeFileSync(join(dir, path), content, "utf8");
|
|
11
|
+
return dir;
|
|
12
|
+
}
|
|
13
|
+
test("stable exported function survives the simulated year", () => {
|
|
14
|
+
const dir = makeRepo({
|
|
15
|
+
"stable.mjs": [
|
|
16
|
+
"export function run() {",
|
|
17
|
+
" const items = [];",
|
|
18
|
+
" for (let i = 0; i < 20; i += 1) items.push({ i });",
|
|
19
|
+
" return items.length;",
|
|
20
|
+
"}",
|
|
21
|
+
"",
|
|
22
|
+
].join("\n"),
|
|
23
|
+
});
|
|
24
|
+
try {
|
|
25
|
+
const result = runHyperChamber(dir, "stable.mjs", { days: 365, budgetMs: 300, memoryMb: 256 });
|
|
26
|
+
assert.equal(result.status, "ok", result.summary);
|
|
27
|
+
assert.ok(result.iterations > 0, "no iterations");
|
|
28
|
+
assert.match(renderHyperChamber(result), /Hyper chamber: ok/);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
rmSync(dir, { recursive: true, force: true });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
test("a retained cache is reported as a memory leak with a crash day", () => {
|
|
35
|
+
const dir = makeRepo({
|
|
36
|
+
"leak.mjs": [
|
|
37
|
+
"const cache = [];",
|
|
38
|
+
"export function run() {",
|
|
39
|
+
" cache.push({ i: cache.length, payload: 'x'.repeat(512) });",
|
|
40
|
+
" return cache.length;",
|
|
41
|
+
"}",
|
|
42
|
+
"",
|
|
43
|
+
].join("\n"),
|
|
44
|
+
});
|
|
45
|
+
try {
|
|
46
|
+
const result = runHyperChamber(dir, "leak.mjs", { days: 365, budgetMs: 400, memoryMb: 256 });
|
|
47
|
+
assert.equal(result.status, "leak", result.summary);
|
|
48
|
+
assert.match(result.summary, /\[MEMORY LEAK DETECTED\]: AI code survives Day 1, but crashes on Day \d+ of simulated uptime\./);
|
|
49
|
+
assert.ok(result.crashDay >= 1 && result.crashDay <= 365, `crashDay=${String(result.crashDay)}`);
|
|
50
|
+
assert.match(renderHyperChamber(result), /\[MEMORY LEAK DETECTED\]/);
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
rmSync(dir, { recursive: true, force: true });
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
test("static imports are blocked", () => {
|
|
57
|
+
const dir = makeRepo({
|
|
58
|
+
"blocked.mjs": 'import fs from "node:fs";\nexport function run() { return fs; }\n',
|
|
59
|
+
});
|
|
60
|
+
try {
|
|
61
|
+
const result = runHyperChamber(dir, "blocked.mjs", { budgetMs: 200 });
|
|
62
|
+
assert.equal(result.status, "error", result.summary);
|
|
63
|
+
assert.match(result.error ?? "", /import blocked/);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
rmSync(dir, { recursive: true, force: true });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
test("an infinite loop stops as a timeout", () => {
|
|
70
|
+
const dir = makeRepo({ "loop.mjs": "export function run() { while (true) {} }\n" });
|
|
71
|
+
try {
|
|
72
|
+
const result = runHyperChamber(dir, "loop.mjs", { budgetMs: 500 });
|
|
73
|
+
assert.equal(result.status, "timeout", result.summary);
|
|
74
|
+
assert.match(result.summary, /таймауту/);
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
rmSync(dir, { recursive: true, force: true });
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
test("a module without a runnable export is rejected", () => {
|
|
81
|
+
const dir = makeRepo({ "empty.mjs": "export const value = 1;\n" });
|
|
82
|
+
try {
|
|
83
|
+
const result = runHyperChamber(dir, "empty.mjs", { budgetMs: 200 });
|
|
84
|
+
assert.equal(result.status, "error", result.summary);
|
|
85
|
+
assert.match(result.error ?? "", /export a function/);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
rmSync(dir, { recursive: true, force: true });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
test("a plain script is wrapped and executed repeatedly", () => {
|
|
92
|
+
const dir = makeRepo({
|
|
93
|
+
"plain.js": "const items = [];\nfor (let i = 0; i < 10; i += 1) items.push(i);\nconsole.log(items.length);\n",
|
|
94
|
+
});
|
|
95
|
+
try {
|
|
96
|
+
const result = runHyperChamber(dir, "plain.js", { budgetMs: 300, memoryMb: 256 });
|
|
97
|
+
assert.equal(result.status, "ok", result.summary);
|
|
98
|
+
assert.ok(result.iterations > 0, "no iterations");
|
|
99
|
+
assert.ok(result.output.includes("10"), `output=${result.output.join("|")}`);
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
rmSync(dir, { recursive: true, force: true });
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=hyper-chamber.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyper-chamber.test.js","sourceRoot":"","sources":["../../src/core/hyper-chamber.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEzE,SAAS,QAAQ,CAAC,KAA6B;IAC7C,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,8BAA8B,CAAC,CAAC,CAAC;IACxE,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACrG,OAAO,GAAG,C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