/**
 * Graph Memory Bridge — connects brain.db memory nodes to nexus.db code nodes.
 *
 * Scans brain observations, decisions, patterns, and learnings for entity
 * references (file paths, function names, symbol names) and matches them
 * against nexus_nodes in the global nexus.db. Matching pairs are linked via
 * `code_reference` edges written to brain_page_edges in brain.db.
 *
 * Design constraints:
 * - brain.db is read-write (edges written here).
 * - nexus.db is READ-ONLY from this module — never mutated.
 * - All operations are BEST-EFFORT; failures never surface to callers.
 * - Cross-DB join is handled in-process: read nexus nodes, then write brain edges.
 * - Entity matching: exact match on filePath or symbol name; fuzzy match on
 *   symbol name (case-insensitive substring, minimum 4 chars).
 *
 * @task graph-memory-bridge
 * @epic T523
 */
/** A single code-reference link created or found by the bridge. */
export interface CodeReferenceLink {
    /** Brain memory node ID (format: '<type>:<source-id>'). */
    brainNodeId: string;
    /** Nexus node ID (format: '<filePath>::<name>' or '<filePath>'). */
    nexusNodeId: string;
    /** Human-readable nexus node label. */
    nexusLabel: string;
    /** Match strategy used: 'exact-file', 'exact-symbol', or 'fuzzy-symbol'. */
    matchStrategy: 'exact-file' | 'exact-symbol' | 'fuzzy-symbol';
    /** Edge weight (exact matches = 1.0, fuzzy = 0.6). */
    weight: number;
}
/** Summary result from autoLinkMemories. */
export interface AutoLinkResult {
    /** Total brain entries scanned for entity references. */
    scanned: number;
    /** Number of new code_reference edges created. */
    linked: number;
    /** Number of links that already existed (skipped). */
    alreadyLinked: number;
    /** Individual links created in this run. */
    links: CodeReferenceLink[];
}
/** Result from queryMemoriesForCode. */
export interface MemoriesForCodeResult {
    /** The nexus node ID that was queried. */
    nexusNodeId: string;
    /** Brain memory nodes reachable from this code node. */
    memories: Array<{
        nodeId: string;
        nodeType: string;
        label: string;
        qualityScore: number;
        edgeWeight: number;
        matchStrategy: string;
    }>;
}
/** Result from queryCodeForMemory. */
export interface CodeForMemoryResult {
    /** The brain memory node ID that was queried. */
    brainNodeId: string;
    /** Nexus code nodes reachable from this memory node. */
    codeNodes: Array<{
        nexusNodeId: string;
        label: string;
        filePath: string | null;
        kind: string;
        edgeWeight: number;
        matchStrategy: string;
    }>;
}
/**
 * Create a `code_reference` edge from a brain memory node to a nexus code node.
 *
 * Writes to brain_page_edges (brain.db). The nexus node must already exist in
 * nexus.db but is never mutated. The brain node is upserted as a stub if it
 * does not yet exist in brain_page_nodes.
 *
 * This function is idempotent — calling it multiple times with the same
 * (memoryId, codeSymbol) pair is safe (the composite PK prevents duplicates).
 *
 * @param projectRoot - Absolute path to project root (locates brain.db)
 * @param memoryId - Brain memory node ID (format: '<type>:<source-id>')
 * @param codeSymbol - Nexus node ID (format: '<filePath>::<name>' or '<filePath>')
 * @returns True if the edge was created or already existed; false on error
 */
export declare function linkMemoryToCode(projectRoot: string, memoryId: string, codeSymbol: string): Promise<boolean>;
/**
 * Scan brain memory nodes for entity references and match them against nexus.
 *
 * For each brain node, extracts:
 * - File path references → matched against nexus_nodes.file_path (exact)
 * - Symbol name references → matched against nexus_nodes.name (exact, then fuzzy)
 *
 * Matching edges are written to brain_page_edges with edgeType='code_reference'.
 * This function is idempotent — existing edges are skipped.
 *
 * Should be called from runConsolidation() as a best-effort step. All errors
 * are caught and logged; never throws.
 *
 * @param projectRoot - Absolute path to project root (locates brain.db)
 * @returns Summary of scanned entries and created links
 */
export declare function autoLinkMemories(projectRoot: string): Promise<AutoLinkResult>;
/**
 * Given a code symbol (nexus node ID), find related brain memory nodes.
 *
 * Traverses `code_reference` edges in brain_page_edges where the target is
 * the given nexus node ID. Returns the brain memory nodes with edge metadata.
 *
 * @param projectRoot - Absolute path to project root (locates brain.db)
 * @param symbol - Nexus node ID (format: '<filePath>::<name>' or '<filePath>')
 * @returns Memory nodes that reference the given code symbol
 */
export declare function queryMemoriesForCode(projectRoot: string, symbol: string): Promise<MemoriesForCodeResult>;
/**
 * Given a brain memory node ID, find related nexus code nodes.
 *
 * Traverses `code_reference` edges in brain_page_edges from the given memory
 * node ID, then fetches the corresponding nexus node metadata.
 *
 * @param projectRoot - Absolute path to project root (locates brain.db)
 * @param memoryId - Brain memory node ID (format: '<type>:<source-id>')
 * @returns Nexus code nodes referenced by the given memory entry
 */
export declare function queryCodeForMemory(projectRoot: string, memoryId: string): Promise<CodeForMemoryResult>;
/** A single code-memory link for display. */
export interface CodeLinkEntry {
    /** Brain memory node ID. */
    brainNodeId: string;
    /** Brain node type. */
    brainNodeType: string;
    /** Brain node label. */
    brainNodeLabel: string;
    /** Nexus code node ID. */
    nexusNodeId: string;
    /** Nexus node label. */
    nexusNodeLabel: string;
    /** File path in the nexus node (relative to project root). */
    filePath: string | null;
    /** Code kind (function, class, file, etc.). */
    kind: string;
    /** Edge weight. */
    weight: number;
    /** When the edge was created. */
    createdAt: string;
}
/**
 * Return all `code_reference` edges from brain.db enriched with nexus metadata.
 *
 * Used by `cleo memory code-links` CLI command.
 *
 * @param projectRoot - Absolute path to project root (locates brain.db)
 * @param limit - Maximum number of entries to return (default 100)
 * @returns Array of code link entries sorted by weight descending
 */
export declare function listCodeLinks(projectRoot: string, limit?: number): Promise<CodeLinkEntry[]>;
//# sourceMappingURL=graph-memory-bridge.d.ts.map