/** * Deterministic capability retrieval over the normalized capability catalog. * Given an intent's text, it scores compact catalog entries (id, domain, * keywords, summary — never provider/MCP schemas) and returns a bounded, * relevance-ranked subset plus prompt-flooding metrics so callers can prove * the model context carries only the relevant slice of the catalog. An empty * or non-matching intent yields a designed-empty result, never the full * catalog. */ /** * Normalized, provider-neutral catalog entry. `promptTokenEstimate` is the * producer-measured token cost of rendering this capability into model * context; it powers the flood-reduction metrics. */ export interface CapabilityCatalogEntry { capabilityId: string; domain: string; summary: string; keywords: readonly string[]; operations: readonly string[]; promptTokenEstimate: number; } export interface CapabilityRetrievalMatch { entry: CapabilityCatalogEntry; score: number; rank: number; matchedTokens: readonly string[]; } /** * Ambiguity is reported, never silently resolved: when the top two matches * come from different domains and their score margin is below the threshold, * the caller must disambiguate (clarify or confirm) instead of dispatching. */ export interface CapabilityRetrievalAmbiguity { ambiguous: boolean; margin: number | null; contenders: readonly string[]; } export interface CapabilityRetrievalMetrics { catalogSize: number; retrievedCount: number; catalogPromptTokenEstimate: number; retrievedPromptTokenEstimate: number; /** retrievedTokens / catalogTokens — lower means less prompt flooding. */ floodRatio: number; } export interface CapabilityRetrievalResult { results: readonly CapabilityRetrievalMatch[]; ambiguity: CapabilityRetrievalAmbiguity; metrics: CapabilityRetrievalMetrics; queryTokens: readonly string[]; } export interface RetrieveCapabilitiesInput { catalog: readonly CapabilityCatalogEntry[]; intentText: string; /** Maximum entries returned. Defaults to 5; must be a positive integer. */ limit?: number; /** Score margin (relative to the top score) below which cross-domain ties are ambiguous. Defaults to 0.25. */ ambiguityMargin?: number; } export declare function tokenizeCapabilityIntent(text: string): string[]; /** * Scores and ranks catalog entries against the intent text. Fully * deterministic: identical inputs always produce identical rankings, with * `capabilityId` ascending as the final tie-breaker. */ export declare function retrieveCapabilities(input: RetrieveCapabilitiesInput): CapabilityRetrievalResult;