agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
27 lines • 1.13 kB
JavaScript
/**
* An enforcing validation refused delivery; diagnostic metadata only, never
* content. Served by a hosting door, it is a refusal, not a failure: HTTP 422
* with code `ERR_ANSWER_VALIDATION` (on a stream, the closing error frame
* carries the same code). It withholds the answer only — tools the turn
* already called have run, and nothing undoes them.
*/
export class AnswerValidationError extends Error {
code = 'ERR_ANSWER_VALIDATION';
report;
constructor(report) {
super(`The answer was withheld: answer validation '${report.validatorId}' did not pass ` +
`(${report.status}).`);
this.name = 'AnswerValidationError';
this.report = Object.freeze({
...report,
checks: Object.freeze(report.checks.map((check) => Object.freeze({
...check,
...(check.evidenceRefs !== undefined && {
evidenceRefs: Object.freeze([...check.evidenceRefs]),
}),
}))),
resolvedRefs: Object.freeze([...report.resolvedRefs]),
});
}
}
//# sourceMappingURL=types.js.map