/** * Capability retrieval: BM25 and dense, fused by RRF. * * Hybrid rather than dense-only because capability descriptions are short. * Pure dense retrieval over eight-word strings is weak, and — more decisively — * an exact name lookup has to stay exact: `create_pull_request` must find * `mcp_github_create_pull_request` every time, which is a lexical guarantee, not * a nearest-neighbour one. Fusion gets both: the lexical leg answers "the tool * called roughly this", the dense leg "something that does this". * * Reuses the repo search's {@link rrfFuse} rather than reimplementing fusion. * The tie-breaking and duplicate handling there are already worked out, and a * second, subtly different fusion is how two retrieval paths drift apart. */ import { type CapabilityDoc, type CapabilityKind } from "./registry.js"; export interface CapabilityHit { doc: CapabilityDoc; /** Fused score. Comparable within one result set only. */ score: number; /** Which legs found it — useful when explaining a surprising ranking. */ matchedBy: Array<"lexical" | "dense">; } export interface CapabilitySearchOptions { /** Restrict to these kinds. Omit for everything. */ kinds?: readonly CapabilityKind[]; /** Results to return. */ limit?: number; /** Restrict to capabilities whose expensive part is currently withheld. */ deferredOnly?: boolean; } export interface CapabilitySearchResult { hits: CapabilityHit[]; /** How the answer was produced, so a caller can say "lexical only" honestly. */ legs: Array<"lexical" | "dense">; } /** Drop the cached lexical index. Tests, and anything that rewrites the registry wholesale. */ export declare function resetCapabilitySearch(): void; /** * Find capabilities matching `query`. * * Over-fetches from each leg before fusing: RRF works on rank, so a document * ranked 8th by one retriever and absent from the other still deserves to be * considered — truncating each list to the final `limit` first would throw that * away before fusion could use it. */ export declare function searchCapabilities(query: string, options?: CapabilitySearchOptions): Promise; //# sourceMappingURL=search.d.ts.map