/** * Blueprint matcher — pure algorithm. * * Given a list of candidate `McpScreenBlueprint` rows (retrieved by the * hosting deployment via an indexed primary-data-tool query) and the * agent's `sourceTools`, return the best matching blueprint. * * I/O-free. The storage query layer lives in the hosting deployment; * its only job is fetching candidates and calling this function. */ import type { BlueprintSource } from "../types/blueprint-source.js"; /** Subset of `McpScreenBlueprintRow` the matcher needs. Keeps tests isolated. */ export interface MatchableBlueprint { blueprintId: string; serverId: string; dataTools: string[]; status: "active" | "stale" | "retired"; /** * Provenance ({@link BlueprintSource}). Required — rows reach the * matcher through a validating narrower at the storage boundary, so * an unlabeled candidate is dropped there, never defaulted here. */ source: BlueprintSource; /** Engagement / selection rate populated by the ranker. Undefined = 0. */ score?: number; } /** * Select the best-matching blueprint from `candidates` given the agent's * `sourceTools`. Returns `null` if no candidate's `dataTools` is a subset * of `sourceTools`. * * Subset match semantics: the agent can bring extra tools. A blueprint * matches if every one of its `dataTools` appears in `sourceTools`. * * Ranking: `overlap × source_weight × (score || 1)`. Overlap is the blueprint's * dataTools count (all must match to be a candidate, so higher counts signal * more-specific blueprints). Ties broken by stable input order. */ export declare function matchBlueprint(candidates: readonly T[], sourceTools: readonly string[]): T | null; //# sourceMappingURL=match.d.ts.map