/** * Shared ranking core for solution matching. * * Extracted from solution-matcher.ts — the ranking pipeline used by both * production (matchSolutions) and the bootstrap evaluator * (evaluateSolutionMatcher). Single source of truth for ranking behaviour. */ /** * Narrow input shape for the shared ranking pipeline. `matchSolutions` and the * bootstrap evaluator both reduce to this contract — `LoadedSolution` is * structurally compatible (it has more fields), and `EvalSolution` mirrors it * exactly. Keeping the input narrow prevents the evaluator from leaking onto * prod types and vice versa. */ export interface RankableSolution { name: string; tags: string[]; identifiers?: string[]; confidence: number; } /** * Intermediate ranked candidate. Generic over the source solution type so the * caller can get back the exact object they passed in. */ export interface RankedCandidate { solution: T; relevance: number; matchedTags: string[]; matchedIdentifiers: string[]; } /** * Shared ranking core: tag-based relevance + identifier boost + top-5 sort. * * Contract: * - identifier boost requires `id.length >= 4` and substring presence in * the prompt (case-insensitive). * - candidates with zero matched tags AND zero matched identifiers are dropped. * - top-5 by `relevance` descending. * - duplicate names are NOT deduplicated. */ export declare function rankCandidates(promptTags: string[], promptLower: string, solutions: readonly T[], ensembleWeights?: { tfidf: number; bm25: number; bigram: number; }): RankedCandidate[];