/**
 * KnowledgeManager — Manages a structured knowledge base for Instar agents.
 *
 * Handles ingestion of external content (URLs, documents) into the
 * MemoryIndex-backed knowledge base. Provides catalog tracking,
 * YAML frontmatter generation, and source lifecycle management.
 *
 * The knowledge base is NOT a separate search engine — it's a set of
 * well-organized markdown files that MemoryIndex indexes via FTS5.
 *
 * Born from: Matthew Berman OpenClaw analysis (2026-02-25)
 */
export interface KnowledgeSource {
    id: string;
    title: string;
    url: string | null;
    type: 'article' | 'transcript' | 'doc';
    ingestedAt: string;
    filePath: string;
    tags: string[];
    summary: string;
    wordCount: number;
}
/**
 * WS2.4 (multi-machine-replicated-store-foundation) — the knowledge-record replication
 * emitter seam. server.ts injects a journal-backed emitter (built from the
 * CoherenceJournal clock + the `knowledge-record` kind) ONLY when
 * `multiMachine.stateSync.knowledge.enabled` is true (default false ⇒ NOT injected ⇒ a
 * strict no-op, byte-identical single-machine behavior). The emitter NEVER throws out of
 * a knowledge write — a replication failure must never break a local write (the emitter
 * swallows + counts internally), so the manager calls it best-effort.
 *
 * CRITICAL: emitDelete MUST fire for every source REMOVED (the remove() path) — else a
 * peer re-replicates the locally-removed source forever (resurrection). The emitter keys
 * the tombstone on the SAME content-fingerprint recordKey the put used, so the delete
 * reaches the same source on every machine even though the local ids differ.
 *
 * fork #2: emitPut carries the catalog METADATA only — never the markdown file body and
 * never the local `id`/`filePath` (the projection in KnowledgeReplicatedStore strips them).
 */
export interface KnowledgeReplicationEmitter {
    /** Emit a `put` for an ingested knowledge source (called from the ingest funnel). */
    emitPut(record: KnowledgeSource): void;
    /** Emit a `delete` tombstone for a removed source, keyed on its content fingerprint
     *  (title/url/type). */
    emitDelete(title: string, url: string | null, type: 'article' | 'transcript' | 'doc', deletedAt: string): void;
}
export interface KnowledgeCatalog {
    sources: KnowledgeSource[];
}
export interface IngestOptions {
    title: string;
    url?: string;
    type?: 'article' | 'transcript' | 'doc';
    tags?: string[];
    summary?: string;
}
export interface IngestResult {
    sourceId: string;
    filePath: string;
    wordCount: number;
}
export declare class KnowledgeManager {
    private readonly knowledgeDir;
    private readonly catalogPath;
    /**
     * WS2.4 knowledge-record replication emitter (injected, dark by default). Absent ⇒
     * strict no-op (single-machine, byte-identical). server.ts late-binds a journal-backed
     * emitter ONLY when `multiMachine.stateSync.knowledge.enabled` is true.
     */
    private knowledgeReplication;
    constructor(stateDir: string);
    /**
     * Late-bind the WS2.4 knowledge-record replication emitter (server.ts constructs the
     * journal/clock AFTER the manager). Idempotent; passing undefined/null detaches (back
     * to single-machine no-op). The emit funnel checks `this.knowledgeReplication` per
     * write, so attaching mid-life takes effect on the next ingest/remove.
     */
    setKnowledgeReplicationEmitter(emitter: KnowledgeReplicationEmitter | null | undefined): void;
    /**
     * Ingest content into the knowledge base.
     * Creates a markdown file with YAML frontmatter and updates the catalog.
     */
    ingest(content: string, options: IngestOptions): IngestResult;
    /**
     * Remove a source from the knowledge base.
     * Deletes the file and catalog entry.
     */
    remove(sourceId: string): boolean;
    /**
     * Get the catalog of all ingested sources.
     */
    getCatalog(tag?: string): KnowledgeSource[];
    /**
     * Get a single source by ID.
     */
    getSource(sourceId: string): KnowledgeSource | null;
    /**
     * Get all unique tags across all sources.
     */
    getAllTags(): string[];
    /**
     * Get the knowledge directory path (for MemoryIndex source configuration).
     */
    getKnowledgeDir(): string;
    /**
     * Get the MemoryIndex source entries for knowledge base directories.
     * Use these to extend the agent's memory config.
     */
    getMemorySourceEntries(): Array<{
        path: string;
        type: string;
        evergreen: boolean;
    }>;
    private ensureDirectories;
    private loadCatalog;
    private saveCatalog;
    private generateId;
    private slugify;
    private subdirForType;
}
//# sourceMappingURL=KnowledgeManager.d.ts.map