import { type MemoryEntry } from './memory.js';
export interface FactCluster {
    label: string;
    members: MemoryEntry[];
    entityTags: string[];
}
export declare function clusterFacts(facts: MemoryEntry[]): FactCluster[];
export interface DagSummaryOptions {
    apiKey: string;
    model?: string;
    fetcher?: typeof fetch;
}
export declare function generateDagSummary(label: string, factContents: string[], opts: DagSummaryOptions): Promise<string | null>;
export interface DagBuildResult {
    candidateClusters: number;
    summariesCreated: number;
    factsLinked: number;
}
export declare function buildDag(hippoRoot: string, facts: MemoryEntry[], opts: DagSummaryOptions): Promise<DagBuildResult>;
export interface DagRebuildResult {
    attempted: number;
    rebuilt: number;
    zeroChildSkipped: number;
    failed: number;
    capped: boolean;
}
/**
 * v0.30 / E3 — sleep-cycle phase that drains the dirty L2 summary queue.
 * Thin orchestrator; the heavy lifting lives in store.ts (load + apply)
 * and dag.ts:generateDagSummary (LLM call).
 *
 * Per-summary try/catch isolation (plan-eng-r1 MED must-fix) — one
 * throwing rebuild does NOT abort the rest of the queue.
 *
 * Race-loser handling: applyRebuildResult's UPDATE WHERE includes
 * AND summary_dirty=1, so concurrent sleep's second writer returns
 * changed=false. Silent skip (neither rebuilt++ nor failed++).
 */
export declare function rebuildDirtySummaries(hippoRoot: string, opts: DagSummaryOptions & {
    cap?: number;
}): Promise<DagRebuildResult>;
export interface EntityProfilesBuildResult {
    candidateClusters: number;
    profilesCreated: number;
    l2sLinked: number;
    failed: number;
}
/**
 * v0.30 / E5 — build L3 entity profiles by clustering L2 summaries with
 * shared entity tags. Threshold 2+ L2s per entity. Mirrors buildDag L1->L2
 * pattern, one level up.
 *
 * Born-dirty cancellation (E3 lesson): after linking L2 children to the new
 * L3 (each link write fires E2 hook on L3 via widened markSummaryDirtyInTx),
 * call clearSummaryDirtyAfterBuild with source='buildEntityProfiles-clean'
 * so E3 sleep-cycle rebuild doesn't re-rebuild the freshly-built L3 this
 * same cycle.
 */
export declare function buildEntityProfiles(hippoRoot: string, l2Summaries: MemoryEntry[], opts: DagSummaryOptions): Promise<EntityProfilesBuildResult>;
//# sourceMappingURL=dag.d.ts.map