/** A retrievable documentation chunk. */ export interface GroundingDoc { /** Stable identifier, e.g. `deployment.md#in-cluster-alertmanager`. */ id: string; /** The chunk text (heading + body) that gets searched and shown to the model. */ text: string; /** Human-readable section title, for source attribution. */ title?: string; /** Deep-link the answer can cite (dashboard path or docs URL). */ url?: string; } /** A scored retrieval result. */ export interface GroundingHit { doc: GroundingDoc; score: number; } /** A built, queryable index. */ export interface GroundingIndex { search(query: string, k?: number): GroundingHit[]; readonly size: number; } /** Lowercase, split on non-alphanumerics, drop stopwords and 1-char tokens. */ export declare function tokenize(text: string): string[]; /** * Split a Markdown document into heading-scoped chunks. Content before the first * heading becomes an intro chunk; each subsequent chunk spans a heading and its body * up to the next heading of any level. Front-matter (`--- ... ---`) is stripped. * * @param markdown - Raw Markdown source * @param meta - `id` prefix (e.g. the file's base name) and optional base `url` * @returns One GroundingDoc per section (empty sections skipped) */ export declare function chunkMarkdown(markdown: string, meta: { id: string; url?: string; }): GroundingDoc[]; /** A source documentation file to be chunked and indexed. */ export interface DocFile { /** Id prefix for the file's chunks, e.g. `deployment.md`. */ id: string; /** Raw Markdown contents. */ content: string; /** Optional base deep-link the chunks can cite. */ url?: string; } /** * Convenience: chunk a set of Markdown files and build one combined index. The HTTP * service reads `docs/*.md` from disk and passes the contents here — the fs access * stays in the service so this module remains pure and testable. * * @param files - Markdown files to index * @returns A queryable index over every file's chunks */ export declare function buildDocsIndexFromFiles(files: DocFile[]): GroundingIndex; /** * Build a BM25 index over the given chunks. BM25 params are the standard * k1=1.5, b=0.75. Search is case-insensitive and stopword-filtered. * * @param docs - Chunks to index * @returns A queryable {@link GroundingIndex} */ export declare function buildGroundingIndex(docs: GroundingDoc[]): GroundingIndex;