import type { Database } from "bun:sqlite";
export interface KgEdge {
    id: string;
    source_id: string;
    source_type: string;
    target_id: string;
    target_type: string;
    relation_type: string;
    weight: number;
    metadata: Record<string, unknown>;
    created_at: string;
}
/**
 * Sync all existing relationships into kg_edges.
 * Idempotent — uses INSERT OR IGNORE with composite unique constraint.
 */
export declare function syncKgEdges(db?: Database): {
    synced: number;
};
/**
 * Get all entities related to a given entity.
 */
export declare function getRelated(entityId: string, opts?: {
    relation_type?: string;
    entity_type?: string;
    direction?: "outgoing" | "incoming" | "both";
    limit?: number;
}, db?: Database): KgEdge[];
/**
 * Find path between two entities using recursive CTE (BFS).
 * Returns the edges forming the shortest path, or empty if no path exists.
 */
export declare function findPath(sourceId: string, targetId: string, opts?: {
    max_depth?: number;
    relation_types?: string[];
}, db?: Database): KgEdge[][];
/**
 * Get impact analysis: what entities are affected if a given entity changes.
 * Traverses outgoing edges recursively.
 */
export declare function getImpactAnalysis(entityId: string, opts?: {
    max_depth?: number;
    relation_types?: string[];
}, db?: Database): {
    entity_id: string;
    entity_type: string;
    depth: number;
    relation: string;
}[];
/**
 * Get critical path: tasks that block the most downstream work.
 * Returns tasks sorted by how many other tasks they transitively block.
 */
export declare function getCriticalPath(opts?: {
    project_id?: string;
    limit?: number;
}, db?: Database): {
    task_id: string;
    blocking_count: number;
    depth: number;
}[];
/**
 * Add a single edge to the knowledge graph.
 */
export declare function addKgEdge(sourceId: string, sourceType: string, targetId: string, targetType: string, relationType: string, weight?: number, metadata?: Record<string, unknown>, db?: Database): KgEdge;
/**
 * Remove edges matching criteria.
 */
export declare function removeKgEdges(sourceId: string, targetId: string, relationType?: string, db?: Database): number;
//# sourceMappingURL=kg.d.ts.map