/** * ComponentIndex — the in-memory component registry, read side. * * This is the half of the old 1,766-line class that the hosted MCP actually * uses: it holds `ComponentEntry` values and answers questions about them. It * deliberately has NO source-parsing code and NO `typescript` import. * * That separation is load-bearing, not tidiness (#1736). The serverless MCP * bundle is produced by walking the STATIC import graph, so when parsing lived * in this class every consumer of `getComponent()` dragged the entire * TypeScript compiler into the deployed function — 12.26 MB of it, which is * how #1732 took the hosted Brain down for a whole release. Building an index * from source now lives in `component-index-builder.ts`, which nothing on the * MCP path imports. * * Keep it that way: if you need to parse something here, put it in the builder. */ import type { AtomicLevel, ComponentEntry } from '../types.js'; import { type TermWeights } from '../text/term-weights.js'; export declare class ComponentIndex { private components; private weights?; /** * How much each word of an ask should count, by how rare it is across this * index (#2080). Built on first use and kept: an index is never mutated after * it is built, and a graph reload builds a new one, so the weights cannot go * stale. `eddie_compose_recipe` borrows them so both tools weigh an ask alike. */ termWeights(): TermWeights; /** * Get a component by tag name */ getComponent(tagName: string): ComponentEntry | undefined; /** * Get all components */ getAll(): ComponentEntry[]; /** * Search components by query string */ /** * Search components by natural-language query. * * Historic bug (#610): used naive `.includes()` substring matching against * only tagName / displayName / intent. A multi-word query like "marketing * homepage" never matched `ed-p-marketing-homepage` because the literal * substring "marketing homepage" (with a space) is not anywhere in the * tagName, displayName, or single-sentence intent. Pages were effectively * invisible to any query an agent would actually type. * * Fix: tokenize the query, drop stopwords and very short terms, and score * each candidate against the full set of fields that carry meaning — * tagName, displayName, intent, guidelines.use, property names and * descriptions, slot names and descriptions. Pages get a ranking boost * when the query contains page-intent keywords ("page", "template", * "dashboard", "homepage", "login", "article", etc.) because in that * case the agent is looking for a full composition starting point, not * a primitive. */ search(query: string): ComponentEntry[]; /** * Get components by atomic level */ getByAtomicLevel(level: AtomicLevel): ComponentEntry[]; /** * Serialize to JSON */ toJSON(): Record; /** * Deserialize from JSON */ static fromJSON(obj: Record): ComponentIndex; /** * Adopt a set of already-parsed entries. * * The seam `ComponentIndexBuilder` hands its results across. Kept internal to * the package — see FEATURE-SPEC #1736 Q2. */ static fromEntries(entries: Map): ComponentIndex; } //# sourceMappingURL=component-index.d.ts.map