/** Characters of surrounding input carried on either side of a quote. */ export declare const SOURCE_ANCHOR_CONTEXT_CHARS = 32; /** * A verified reference from an ingested entity back into the text the * pipeline was given. * * `quote` is authoritative: it is the input's own text for the range, * so a consumer that stores a differently-normalized copy of the * document can re-locate it there rather than trusting these offsets. * `prefix` / `suffix` disambiguate a quote that occurs more than once. * * Offsets are **JS string indices (UTF-16 code units)** into the * pipeline input, which is why they say so in their names — a consumer * counting code points must convert. */ export type TIngestionSourceAnchor = { quote: string; startUtf16: number; endUtf16: number; prefix: string; suffix: string; }; /** * The occurrence of `needle` at or after `fromUtf16` whose start sits * nearest `hintUtf16`, or `undefined` when there is none. * * The same rule the anchor locator applies, exposed because the offsets * the model reports for segments and mentions need it too: take the * verifiable positions as the candidates and let the model's number pick * between them, never the reverse. */ export declare function nearestOccurrence(haystack: string, needle: string, hintUtf16: number, fromUtf16?: number): number | undefined; /** * A located anchor together with how many candidates it was chosen from. * * `occurrences > 1` means the quote is not unique in the input and the * hint broke the tie. Callers surface that as a note rather than * swallowing it: a silent tie-break is indistinguishable from a certain * match, and the two deserve different trust. */ export type TSourceAnchorMatch = { anchor: TIngestionSourceAnchor; occurrences: number; }; /** * Locate `quote` in `input`, returning a verified match or `undefined`. * * `hintUtf16` selects among repeated occurrences — the occurrence whose * start sits nearest the hint wins. It never affects *whether* a quote * matches, so a wrong hint degrades to "picked another occurrence of the * same text", never to a wrong span. * * The ladder is exact match, then whitespace-insensitive match, then * both again with the quote's first character re-cased. Nothing * approximate: a quote that still does not match yields `undefined`. */ export declare function locateSourceAnchor(input: string, quote: string, hintUtf16: number): TSourceAnchorMatch | undefined; //# sourceMappingURL=source-anchors.d.ts.map