/** * product-kb — barrel export + singleton corpus loader. * * Boot path * * 1. Server starts. First call to `getKnowledgeBase()` triggers a * one-shot walk + index build. Subsequent calls reuse the cached * handle. * * 2. Corpus path resolution: * a. LOG10X_PRODUCT_KB_PATH env var, if set * b. default: ../../../../config/mksite/docs relative to the * build directory (covers `npm start` from the build dir * AND `node build/index.js` from elsewhere — we resolve * relative to this module's URL, not cwd) * * 3. If the resolved path is missing or empty, the loader returns * an empty corpus. The tool surfaces this as a structured * `not_configured` envelope rather than crashing. */ import { type SearchIndex } from './search.js'; import type { Page } from './types.js'; export type { Chunk, Page, SearchResult } from './types.js'; export { chunkMarkdown } from './chunker.js'; export { loadCorpus, loadPage, type LoadCorpusOptions } from './loader.js'; export { buildIndex, searchIndex, lookupTopic, nearestTopics, tokenize, type SearchIndex, type SearchOptions, } from './search.js'; /** * The cached knowledge-base handle. `pages` is the flat corpus; * `index` is the inverted index used for search. */ export interface KnowledgeBase { pages: Page[]; index: SearchIndex; /** Absolute path the corpus was loaded from (for diagnostics). */ source: string; } /** * Resolve the docs root directory. Honours LOG10X_PRODUCT_KB_PATH when * set, else falls back to a path relative to this module's directory * that points at config/mksite/docs in the sibling repo. The fallback * is a development-time convenience — production deploys should set * LOG10X_PRODUCT_KB_PATH explicitly to a path that travels with the * build artefact. */ export declare function resolveCorpusPath(): string; /** * Load the knowledge base once and cache it for the life of the * process. Subsequent calls reuse the cached handle. */ export declare function getKnowledgeBase(): KnowledgeBase; /** * Reset the cached handle. Test-only — production code should not * need to invalidate the cache because the corpus is shipped with * the build. */ export declare function _resetKnowledgeBaseCache(): void;