/** * Knowledge ingestion pipeline (KNOWLEDGEBASE_DESIGN.md). * * Drop docs into the `knowledge/` inbox → they're classified, (chunked and) * summarized into typed claims → queued as proposals (source `knowledge:`, * pin-on-approve) → a plain-text summary is written and the original is backed up * to .aidimag/knowledge/processed/ before the inbox copy is removed. * PDF and DOCX files have their text extracted (pdf-parse / mammoth) first. * * Trust gate: claims become PINNED memories only after `dim review` (unless the * repo opts out with knowledge.requireReview = false). Nothing is ever deleted — * unsupported files move to .aidimag/knowledge/skipped/ with a reason. */ import type { MemoryStore } from "../db/store.js"; import type { ResolvedKnowledgeConfig } from "../config.js"; import type { ExtractedClaim } from "./extract.js"; export interface PendingDoc { file: string; abs: string; content: string; hash: string; bytes: number; } export interface SkipCandidate { file: string; reason: string; } export interface DocResult { file: string; hash: string; claimCount: number; proposalIds: string[]; memoryIds: string[]; pinned: boolean; } export interface IngestReport { processed: DocResult[]; pendingNoSummarizer: string[]; duplicates: string[]; skipped: SkipCandidate[]; summarizer: string | null; } interface ManifestEntry { file: string; hash: string; date: string; via: string; claimCount: number; proposalIds: string[]; memoryIds: string[]; } interface Manifest { version: number; docs: ManifestEntry[]; } export declare function readManifest(root: string): Manifest; export declare function classifyInbox(root: string, cfg: ResolvedKnowledgeConfig): Promise<{ pending: PendingDoc[]; toSkip: SkipCandidate[]; }>; /** * Turn extracted claims into proposals and retire the inbox file safely. * Used by both the LLM path and the MCP agent path (which supplies its own claims). */ export declare function finalizeDoc(store: MemoryStore, root: string, cfg: ResolvedKnowledgeConfig, doc: { file: string; hash: string; abs?: string; }, claims: ExtractedClaim[], via: string): DocResult; export declare function ingestAll(store: MemoryStore, root: string, cfg: ResolvedKnowledgeConfig): Promise; export interface KnowledgeStatus { folder: string; pending: PendingDoc[]; unsupported: SkipCandidate[]; skippedOnDisk: string[]; processed: ManifestEntry[]; } export declare function knowledgeStatus(root: string, cfg: ResolvedKnowledgeConfig): Promise; export {};