agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
23 lines • 961 B
JavaScript
import { armDeadline, awaitUnder, linkedController } from '../lib/abort.js';
/** Module loading spends the same deadline; a late chunk can never start a query. */
export async function loadCauseReader(deadline, signal) {
const { controller, unlink } = linkedController(signal);
const disarm = armDeadline(controller, deadline - performance.now(), () => undefined);
try {
return { reader: await awaitUnder(controller.signal, () => import('./causeReader.js')) };
}
catch (error) {
if (signal?.aborted)
return { gap: 'cancelled' };
// Timers can fire a fractional millisecond before the clock reaches the deadline.
// Record which boundary actually fired rather than reclassifying it from the clock.
if (controller.signal.aborted)
return { gap: 'timeout' };
throw error;
}
finally {
disarm();
unlink();
}
}
//# sourceMappingURL=causeLoad.js.map