UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

34 lines • 1.55 kB
/** * units — a reply split into the units a claim is read in: Markdown-aware, then by sentence, * then by clause. * * Pattern: one linear pass over lines. A fenced block's lines are CODE units; a table row is one * unit across its cells; a list item and a heading are one unit each; paragraph text is * split into sentences (a `.`/`!`/`?` before a space or the end, so an identifier's * dots never split one). Every unit is then split into clauses at "but", "however", * "except", "although" and `;`, each clause its own unit with its own polarity. * Role: integrity/ layer (L3), read by `detect.ts` only. * * Inline code (a backtick run closed by a run of the same length, CommonMark's rule) is returned * as spans, so a claim entirely inside one is noted, not judged. */ /** A span of the text as given: `[start, end)`. */ export interface TextSpan { readonly start: number; readonly end: number; } /** One unit a claim is read in. */ export interface Unit extends TextSpan { /** Inside a fenced code block. */ readonly fenced: boolean; } /** The units and the inline code spans of a reply. */ export interface Units { readonly units: readonly Unit[]; readonly inlineCode: readonly TextSpan[]; } /** Split a reply into units. */ export declare function unitsOf(text: string): Units; /** Whether a span lies entirely inside one of the code spans. */ export declare function insideAny(span: TextSpan, code: readonly TextSpan[]): boolean; //# sourceMappingURL=units.d.ts.map