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; export interface DagBuildResult { candidateClusters: number; summariesCreated: number; factsLinked: number; /** AT1: clusters skipped because the LLM-synthesized summary landed on a * rejected value (plan §3 containment — per-cluster catch, not a whole- * phase abort). Member re-parenting writes are unaffected by construction * (same id + same content = guard-exempt), so this only ever counts * summary-creation refusals. */ rejected: number; } export declare function buildDag(hippoRoot: string, facts: MemoryEntry[], opts: DagSummaryOptions): Promise; export interface DagRebuildResult { attempted: number; rebuilt: number; refused: 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 refused++ nor failed++). * * T4: applyRebuildResult returns { changed, refused } — a tombstone hit * (rebuild content matches a previously-rejected value) increments * `refused`, not `rebuilt`. Dirty still clears either way; only the stat * split changed (docs/plans/2026-08-15-hardening-at1-followups.md T4). */ export declare function rebuildDirtySummaries(hippoRoot: string, opts: DagSummaryOptions & { cap?: number; }): Promise; export interface EntityProfilesBuildResult { candidateClusters: number; profilesCreated: number; l2sLinked: number; failed: number; /** AT1: clusters skipped because the profile summary landed on a rejected * value (plan §3 containment). Kept distinct from `failed` (LLM null / * rate-limit) — a tombstone hit is a deliberate refusal, not an error. */ rejected: 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; //# sourceMappingURL=dag.d.ts.map