agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
45 lines (44 loc) • 2.18 kB
TypeScript
/**
* plainLine — the ONE rule for "one visible line of plain text" that a
* person will read in a report.
*
* Pattern: One predicate, no imports, no state.
* Role: Leaf. Asked by the three doors that take a short declared label:
* `semantics/coverage/items.ts` (a coverage item's `short`, at the
* `absent()` / `coverage()` mint AND at the dispatch reader) and
* `injection-engine/factories/defineSkill.ts` (a skill's
* `title`). One rule, so the three cannot disagree.
* Emits: N/A.
*
* ## Why more than CR/LF
*
* A report exists to be honest about what a run did, and these labels are
* printed in it verbatim. "One line" checked as `/[\r\n]/` let through the
* characters that break a line or a reading WITHOUT being CR or LF:
*
* - other controls (`\p{Cc}`) — VT, FF, NEL (U+0085), TAB;
* - line and paragraph separators (`\p{Zl}`, `\p{Zp}`) — U+2028 / U+2029;
* - format characters (`\p{Cf}`) — bidi overrides such as U+202E, which
* reverse what a reader sees (the "Trojan source" trick), and zero-width
* characters, which pad a 5-character label past any length limit while
* looking like 5 characters.
*
* The rule refuses all four classes, and it runs BEFORE the length is
* measured, so a length limit is a limit on what a person sees.
*
* ## Deliberately strict for v1
*
* `\p{Cf}` also refuses marks that legitimate text uses: U+200E / U+200F
* (LEFT-TO-RIGHT / RIGHT-TO-LEFT MARK, in right-to-left labels) and U+200D
* (ZERO WIDTH JOINER, in emoji sequences). The report's surfaces are
* English-only in v1, so nothing honest is lost today. A later locale packet
* that admits right-to-left labels must allow those three explicitly — and
* keep refusing the bidi OVERRIDES and isolates (U+202A–U+202E,
* U+2066–U+2069), which reorder what a reader sees.
*/
/**
* Why `text` is not one plain visible line, or `undefined` when it is. The
* sentence names the field (`label`) and the offending code point, so a
* refusal can be acted on without a hex editor.
*/
export declare function plainLineProblem(label: string, text: string): string | undefined;