/** * Knowledge engine facade — opens the YAML store and SQLite index together * and wires up the standard recovery paths: * * - Index whose recorded source fingerprint disagrees with the sources on disk * → auto-rebuild from sources. This covers the missing index, the empty one, * and — the case it was added for — sources that arrived by `git pull`, merge * or branch switch rather than through this CLI. * - Outdated index schema → delete and rebuild (the index is a disposable * cache; YAML is the source of truth — design DD2). * * Requirements: KG 3.2, 3.3, 11.4; knowledge-index-misses-merged-yaml/AC-1, AC-2, * AC-6, AC-11, AC-13 * * @module */ import { YamlSourceStore } from './yaml-source.js'; import { SqliteIndex } from './index/sqlite-index.js'; import { KnowledgeWriter } from './writer.js'; import { KnowledgeReader } from './reader.js'; import { ContextGenerator } from './context-generator.js'; import { StalenessDetector } from './staleness.js'; import { KNOWLEDGE_DIR } from './types.js'; import type { Entity } from './types.js'; /** * Relative path of the knowledge directory within a project. * * Re-exported for the importers that already reach for it here; the declaration * moved to `types.ts` so a reader that must not pull `SqliteIndex` into its * import graph can have the constant without it (stale-graph-entries/AC-17). */ export { KNOWLEDGE_DIR }; export interface KnowledgeEngine { source: YamlSourceStore; index: SqliteIndex; writer: KnowledgeWriter; reader: KnowledgeReader; context: ContextGenerator; staleness: StalenessDetector; /** Parse warnings emitted by an auto-rebuild, if one ran. */ warnings: string[]; /** * The entities the open-time rebuild replaced, or `null` when the cache was served. * * `knowledge sync` exists to report what a merge did (KG Req 12.4), and it does that * by diffing the pre-pull index against the post-pull YAML. Now that opening the * engine rebuilds a stale index, that diff would always be empty — the "before" it * read from the index would already be the "after". So the one thing that can still * see the pre-pull state keeps it: it is captured here, on the rebuild branch only, * where the whole YAML was about to be re-read anyway. A cache hit pays nothing * (knowledge-index-misses-merged-yaml/AC-8, design DD7). */ replaced: Entity[] | null; close(): void; } /** * Open the knowledge engine for a project. * * @param projectRoot - Absolute project root (knowledge lives in `.aidlc/knowledge/`). */ export declare function openKnowledge(projectRoot: string): KnowledgeEngine; /** True when a project has any knowledge graph content. */ export declare function knowledgeExists(projectRoot: string): boolean; //# sourceMappingURL=engine.d.ts.map