@sema-agent/core
Version:
Stateless, task-oriented AI agent core
14 lines (13 loc) • 1.03 kB
TypeScript
/**
* The engine's one "did you mean" reading: the nearest name to a misspelled one, within two edits. A leaf (it imports
* nothing), so a low-level door — the options receipt — can name the near miss without depending on the task registry
* that first needed it.
*/
/** CC `gtr` (fable 复审 F1 — 亲核 @16169850: NOT plain Levenshtein but OSA / restricted
* Damerau-Levenshtein, WITH the adjacent-transposition term `o[i][s]=min(o[i][s], o[i-2][s-2]+1)`
* when `e[i-1]===t[s-2] && e[i-2]===t[s-1]`). The transposition matters: a typo like "tset"→"test"
* is distance 1 (CC has a Did-you-mean), plain Levenshtein would call it 2. */
export declare function editDistance(a: string, b: string): number;
/** CC `htr` shape (206:519814-519827): candidates within Levenshtein ≤2 (length-diff ≤2 pre-filter),
* best-first; the single best is the "Did you mean" suggestion (`htr(e, keys, 1)[0]`, 206:575196). */
export declare function closestName(query: string, candidates: Iterable<string>): string | undefined;