feat(ql3): establish 3.0 incubation baseline

This commit is contained in:
whyour
2026-08-12 00:25:26 +08:00
parent 4bf92dcfeb
commit c699c32461
2817 changed files with 779642 additions and 653 deletions
@@ -0,0 +1,42 @@
import type { ChildProcess } from 'child_process';
import type { LegacyExecutionObservation } from '../ports/legacyExecutionObserver';
export interface LegacyProcessObservationOptions {
now?: () => number;
logArtifactId?: string;
}
export function observeLegacyChildProcess(
child: ChildProcess,
observation: LegacyExecutionObservation,
options: LegacyProcessObservationOptions = {},
): void {
const now = options.now ?? Date.now;
child.once('spawn', () => {
const atMs = now();
observation.spawned({
atMs,
...(child.pid === undefined ? {} : { pid: child.pid }),
...(child.pid === undefined
? {}
: { executorHandle: `legacy-local:${child.pid}` }),
...(options.logArtifactId === undefined
? {}
: { logArtifactId: options.logArtifactId }),
});
observation.running({ atMs });
});
child.on('error', () => {
observation.startFailed({
atMs: now(),
errorCode: 'LEGACY_PROCESS_ERROR',
});
});
child.once('exit', (exitCode, signal) => {
observation.exited({
atMs: now(),
exitCode,
...(signal === null ? {} : { signal }),
});
});
}