refactor!: simplify runtime tools and remove replay engines (#572)
* fix(hopper): report unavailable procedure body coverage * refactor!: simplify runtime tools and remove replay engines Keep direct inspection, capture, and comparison tools. Bind handlers to named contracts and let agents compose experiments with commands and local fixture servers. BREAKING CHANGE: Remove controlled replay, Node characterization, finite replay-machine, managed runtime planning, and redundant string-tracing tools. Retire process replay, shims, reactive scenarios, custom checkpoints, and active browser replay and origin-scope inputs.
This commit is contained in:
@@ -17,63 +17,20 @@ import { scheduleProcessDelay, type ProcessTimer } from "./ProcessTimer.js";
|
||||
export interface ProcessCaptureJournal {
|
||||
readonly entries: readonly ProcessCaptureEventJournalEntry[];
|
||||
readonly recordEvent: RecordProcessCaptureEvent;
|
||||
readonly record: (
|
||||
collection: ProcessCaptureEventJournalEntry["collection"],
|
||||
index: number,
|
||||
) => ProcessCaptureEventJournalEntry;
|
||||
readonly subscribe: (
|
||||
listener: (entry: ProcessCaptureEventJournalEntry) => void,
|
||||
) => () => void;
|
||||
}
|
||||
|
||||
/** Create one monotonic event journal for a process capture. */
|
||||
export const createProcessCaptureJournal = (): ProcessCaptureJournal => {
|
||||
const entries: ProcessCaptureEventJournalEntry[] = [];
|
||||
const listeners = new Set<(entry: ProcessCaptureEventJournalEntry) => void>();
|
||||
const notifications: ProcessCaptureEventJournalEntry[] = [];
|
||||
let delivering = false;
|
||||
const deliverNotifications = (): void => {
|
||||
if (delivering) return;
|
||||
delivering = true;
|
||||
const failures: unknown[] = [];
|
||||
try {
|
||||
for (;;) {
|
||||
const notification = notifications.shift();
|
||||
if (notification === undefined) break;
|
||||
for (const listener of Array.from(listeners))
|
||||
try {
|
||||
listener(notification);
|
||||
} catch (cause: unknown) {
|
||||
failures.push(cause);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
delivering = false;
|
||||
}
|
||||
if (failures.length > 0)
|
||||
throw new AggregateError(
|
||||
failures,
|
||||
"process capture journal subscriber failed",
|
||||
);
|
||||
};
|
||||
const record = (
|
||||
const recordEvent: RecordProcessCaptureEvent = (
|
||||
collection: ProcessCaptureEventJournalEntry["collection"],
|
||||
index: number,
|
||||
): ProcessCaptureEventJournalEntry => {
|
||||
const entry = { capture_order: entries.length, collection, index };
|
||||
entries.push(entry);
|
||||
notifications.push(entry);
|
||||
deliverNotifications();
|
||||
return entry;
|
||||
): void => {
|
||||
entries.push({ capture_order: entries.length, collection, index });
|
||||
};
|
||||
return {
|
||||
entries,
|
||||
record,
|
||||
recordEvent: (collection, index) => void record(collection, index),
|
||||
subscribe: (listener) => {
|
||||
listeners.add(listener);
|
||||
return () => listeners.delete(listener);
|
||||
},
|
||||
recordEvent,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user