/** * Memory Knowledge Graph — per-origin rollback: kgRollback withdraws an * origin's support, re-derives the survivors and removes edges left * without endpoints. Split out of memory-kg.ts, which re-exports * kgRollback. */ import type { KgScope } from './memory-kg-model.js'; /** Withdraw `originRef`'s support from the graph: remove it from every * node/edge/rule it backs, and delete the element once no origin remains. * * The withdrawn ref is REWRITTEN out of the surviving elements' origin lists, * not left behind. Retaining it (as this used to) meant a second rollback saw * a two-entry list and retained again — so an element could outlive the * withdrawal of every origin that ever supported it. * * The scan is EXHAUSTIVE: it pages each namespace to the end rather than * reading one capped list. A capped scan let an element past the cap keep a * withdrawn origin while the caller was told the rollback succeeded. * * Collect-then-mutate is deliberate: deleting a row pulls every later row back * one position, so a delete inside the page loop would make an advancing * offset skip whatever slid into the gap. (Rewrites are no longer a hazard — * the bridge's upsert reuses the existing entry id and preserves `createdAt` * rather than re-inserting at the head of the default ordering — but this * function deletes as well as rewrites.) Only origin-carrying entries are * retained during the scan, so memory tracks the rollback's own footprint, not * the namespace size. */ export declare function kgRollback(options: { originRef: string; /** Whose knowledge to withdraw from. A rollback can only reach the named * scope's namespaces — an org's rollback is an ownership boundary, not just * a label on the output. */ scope?: KgScope; dbPath?: string; }): Promise<{ success: boolean; deleted: number; retained: number; failures?: string[]; error?: string; /** Edges deleted because this rollback removed an endpoint they name. A * relation between two things is not a fact once one of them is gone, and * retrieval is node-seeded, so leaving them behind left unreachable rows * claiming a graph that no longer exists. */ danglingEdgesRemoved?: number; }>; //# sourceMappingURL=memory-kg-rollback.d.ts.map