/** * @fileoverview String similarity utilities for fuzzy matching. * * Extracted from DirectClient for reuse in lazy-loading discovery tools. */ /** * Longest requested name (in UTF-16 code units) that `findSimilarTools` will * fuzzy-match. Longer names get no suggestions: Levenshtein costs * O(requested × candidate) per command, and the requested name is untrusted. * Also the default length for {@link truncateName}. */ export declare const MAX_SIMILARITY_INPUT_LENGTH = 128; /** * Calculate similarity between two strings using Levenshtein distance. * Returns a value between 0 (completely different) and 1 (identical). */ export declare function calculateSimilarity(a: string, b: string): number; /** * Find similar tool/command names for suggestions. * Returns tools with similarity >= 0.4, sorted by similarity. * * Returns no suggestions when `requestedTool` is longer than * {@link MAX_SIMILARITY_INPUT_LENGTH}. */ export declare function findSimilarTools(requestedTool: string, availableTools: string[], maxSuggestions?: number): string[]; /** * Shorten an untrusted name before echoing it in an error message. * Names longer than `maxLength` are cut to `maxLength` code units plus `…`. */ export declare function truncateName(name: string, maxLength?: number): string; //# sourceMappingURL=similarity.d.ts.map