/** * runEntityBackfill — FEAT-402 AC-7. One-shot pass that extracts + links * entities for the pre-existing corpus WITHOUT re-distilling memory text: * memories.text/normalized_text/hash are never touched, only entities + * memory_entities rows are written. * * Candidate selection (`memories NOT IN memory_entities`) makes this * idempotent by construction, same shape as the tag-hygiene backfill * (src/tag-hygiene/backfill.ts): a memory that already has at least one * entity link is never re-selected, so re-running on a fully-linked corpus * is a pure no-op scan. A memory whose extraction genuinely found nothing * (or failed/was budget-skipped) stays a candidate for the next run since it * never received a link — no separate "tried and found nothing" state is * needed for slice 1. */ import type { DB } from '../storage/db.js'; import type { LLMProvider } from '../contracts/index.js'; export interface EntityBackfillOptions { dryRun: boolean; limit?: number; capUsd: number; } export interface EntityBackfillResult { scanned: number; linked: number; entitiesLinked: number; skipped: number; dryRun: boolean; } export declare function runEntityBackfill(db: DB, provider: LLMProvider, opts: EntityBackfillOptions): Promise;