agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
39 lines • 2.1 kB
JavaScript
;
/**
* The run manifest, as a recording carries it — the event it rides on, its
* shape, and the one reader that lifts it out of a run's captured events.
*
* `agentfootprint.agent.run_configured` (9.41.0) names the adapters and
* strategies a run is about to use. Two readers consume it: the recording
* envelope (`recordingEnvelope.ts`) archives it as the run's own
* `configuration`, and context-bisect's strategy arms
* (`context-bisect/arms/manifest.ts`) check a declared arm against it. The
* vocabulary lives here, beside the recording that carries it, so the trace
* channel never imports the analysis built on top of it.
*
* Imports nothing: every shape is structural.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.manifestFromEvents = exports.RUN_CONFIGURED_EVENT = void 0;
// ─── Reading it ──────────────────────────────────────────────────────
/** The event type the run manifest rides on (9.41.0). */
exports.RUN_CONFIGURED_EVENT = 'agentfootprint.agent.run_configured';
/**
* Pull the run manifest out of a run's captured typed events — the same
* `CapturedEventLike[]` bag `localizeContextBug` already accepts, so a consumer
* who collected events with `agent.on('*', …)` needs no second capture.
*
* One manifest per run by design; the FIRST is returned. A bag holding events
* from several runs is the caller's own mixing — filter by `meta.runId` first.
*/
function manifestFromEvents(events) {
const event = events?.find((e) => e.type === exports.RUN_CONFIGURED_EVENT);
if (event === undefined)
return undefined;
const payload = event.payload;
// Structural, not a cast-and-pray: a payload that is not an object at all is
// no manifest, and reporting `undefined` keeps `checked: false` honest.
return payload !== null && typeof payload === 'object' ? payload : undefined;
}
exports.manifestFromEvents = manifestFromEvents;
//# sourceMappingURL=recordedManifest.js.map