agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
61 lines • 3.49 kB
JavaScript
;
/**
* frames — which `role: 'user'` turns the LIBRARY wrote rather than a person.
*
* Pattern: one predicate, two consumers (the message builder and the exempt
* corpus), so the two cannot disagree about what a correction is.
* Role: core/ layer. Tiny on purpose — it exists to break a real bug, not
* to hold a constant.
* Emits: N/A.
*
* ## The bug this file exists to prevent
*
* Values the USER supplied are exempt from the evidence check: the user gave
* them, so the model did not invent them. The corrections this library writes
* are also `role: 'user'` turns — and the evidence correction's whole job is to
* QUOTE the unsupported values back to the model. Index it as user-supplied
* and the gate exempts exactly the values it just flagged: the second check
* comes back clean, `guard` congratulates a repeated fabrication, and `rails`
* never refuses anything. Measured, not imagined — the first end-to-end run of
* the `rails` posture did precisely that.
*
* So a library-authored turn is recognised by its authored frame and excluded
* from the exempt corpus. The frames are stable exported constants for this
* reason as much as for the tests that match on them.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.isLibraryAuthoredTurn = exports.EVIDENCE_CHECK_FRAME_PREFIX = void 0;
const saidByPerson_js_1 = require("../../../lib/saidByPerson.js");
// Both markers live in the authorship registry (9.84.0) — the one list of
// openings this library puts on a user-role message it wrote. The sentences
// that carry them are still `gate.ts`'s and `outputEnforcement.ts`'s.
var saidByPerson_js_2 = require("../../../lib/saidByPerson.js");
Object.defineProperty(exports, "EVIDENCE_CHECK_FRAME_PREFIX", { enumerable: true, get: function () { return saidByPerson_js_2.EVIDENCE_CHECK_FRAME_PREFIX; } });
/**
* True when this message content is a CORRECTION the library wrote.
*
* Both in-loop corrections are listed: the schema re-ask quotes a validator's
* message about the model's own output, and the evidence recheck quotes the
* model's own values. Neither is a person supplying data, and treating either
* as one would exempt the very text it was written to challenge.
*
* DELIBERATELY NARROWER than `isSaidByPerson` (9.84.0), which excludes all
* four authored frames. This one is the exempt corpus's rule, and the exempt
* corpus is about who SUPPLIED a value, not who typed the message: widening it
* to the drop notice and the compaction frame would change which values the
* evidence gate exempts, which is a decision about the gate and not about
* authorship. Read `LIBRARY_AUTHORED_PREFIXES` if you want the whole list.
*
* The compaction frame is the one such decision taken: the exempt corpus
* (`evidenceIndex.ts` · `exemptFromRun`) reads a summary's carried lineage
* (`LLMMessage.foldedExempt`) instead of its model-written text. That rule
* lives beside the corpus, not here — this predicate also draws the turn
* boundary in `evidenceFromHistory`, which the fix did not move.
*/
function isLibraryAuthoredTurn(content) {
return (content.startsWith(saidByPerson_js_1.EVIDENCE_CHECK_FRAME_PREFIX) ||
content.startsWith(saidByPerson_js_1.SCHEMA_CHECK_FRAME_PREFIX) ||
content.startsWith(saidByPerson_js_1.FINDINGS_DATA_FRAME_PREFIX));
}
exports.isLibraryAuthoredTurn = isLibraryAuthoredTurn;
//# sourceMappingURL=frames.js.map