feat: P2 operator, preprocessing state/service, and runtime config lease

This commit is contained in:
2026-08-11 18:40:11 +02:00
parent ca391ba59c
commit f7c2b69837
10 changed files with 2501 additions and 31 deletions
+16 -12
View File
@@ -10,18 +10,22 @@ import { ThtRunner } from "../src/tht/tht-runner.js";
// Spy on child_process.spawn so we can capture the resolved argv (incl. -c config)
// that ThtRunner.run() builds, without launching a real process.
vi.mock("node:child_process", () => ({
spawn: vi.fn(() => {
const ch: any = new EventEmitter();
ch.stdout = new EventEmitter();
ch.stderr = new EventEmitter();
queueMicrotask(() => {
ch.stdout.emit("data", Buffer.from('{"id":"x"}'));
ch.emit("close", 0);
});
return ch;
}),
}));
vi.mock("node:child_process", async (importOriginal) => {
const actual = await importOriginal<typeof import("node:child_process")>();
return {
...actual,
spawn: vi.fn(() => {
const ch: any = new EventEmitter();
ch.stdout = new EventEmitter();
ch.stderr = new EventEmitter();
queueMicrotask(() => {
ch.stdout.emit("data", Buffer.from('{"id":"x"}'));
ch.emit("close", 0);
});
return ch;
}),
};
});
import { spawn } from "node:child_process";
test("sessionNew parses id from JSON", async () => {