agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
24 lines (23 loc) • 1.26 kB
TypeScript
/**
* textLoader — plain text, decoded and left alone.
*
* Pattern: Adapter behind `DocumentLoader`.
* Role: rag/ layer. The simplest possible loader, and the one that defines
* what "leaving positions alone" means for the others: it decodes
* UTF-8, normalises line endings, and does nothing else. No trimming,
* no collapsing of blank lines, no smart quotes — every one of those
* would shift every offset after it, and an offset that does not
* index the original is worse than no offset at all.
* Emits: N/A.
*
* Line-ending normalisation is the one exception, and it is a deliberate one:
* `\r\n` → `\n` happens BEFORE any offset is computed, so offsets index the
* normalised text, which is also the text that is stored and shown. The
* alternative — keeping `\r` — makes every paragraph boundary two characters
* on Windows and one everywhere else, so the same document chunks differently
* depending on who checked it out.
*/
import type { DocumentLoader } from '../types.js';
/** Decode UTF-8 and normalise line endings. Shared by every text-shaped loader. */
export declare function decodeText(bytes: Uint8Array): string;
export declare function textLoader(): DocumentLoader;