agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
41 lines • 1.92 kB
JavaScript
;
/**
* scripts/judge — the evidence gate's ONE judge, with the script match in
* front of it.
*
* Pattern: Decorator over the judge closure `stages/route.ts` ·
* `judgeEvidence` builds (the gate bound to this run's evidence).
* Role: core/ layer. Built only under `.namesAndNumbersFromEvidence({
* code: 'match' })`, on a prose answer (a typed answer is read as
* today — design § 12). The same decorated closure judges the draft
* and, for `.answerValidation()`, the delivered candidate.
* Emits: N/A — the Route decider emits `evidence_checked`, now carrying
* `scripts` and each unsupported value's `region`.
*
* What it adds, and nothing else: the matched blocks are cut out of the text
* the gate reads (`match.ts`), the verdict carries `scripts`, and each
* unsupported value says where it sat — `'code'` when every occurrence of it
* is inside an unmatched block, `'prose'` otherwise. The corpus and the
* exempt corpus are untouched: a matched script grounds nothing.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.scriptJudge = void 0;
const match_js_1 = require("./match.js");
/** The gate's judge with the script match in front of it. */
function scriptJudge(input) {
return (text) => {
const shown = (0, match_js_1.readShownScripts)(text, input.turn, input.scriptsDropped);
const verdict = input.judgeProse(shown.prose);
const inProse = verdict.unsupported.length > 0 ? input.valuesIn(shown.outsideCode) : new Set();
return {
...verdict,
unsupported: verdict.unsupported.map((value) => ({
...value,
region: inProse.has(value.value) ? 'prose' : 'code',
})),
scripts: shown.verdict,
};
};
}
exports.scriptJudge = scriptJudge;
//# sourceMappingURL=judge.js.map