/** * Memory Knowledge Graph — graph maintenance reads and moves: kgPromote * (org-owned → project-shared, explicit), consolidation candidates, and * kgStats. Split out of memory-kg.ts, which re-exports the public symbols. */ import type { KgScope } from './memory-kg-model.js'; export interface KgPromoteResult { success: boolean; nodes: number; edges: number; rules: number; /** Origin the shared copy carries, so the promotion can be withdrawn on its * own and the shared graph records who shared the claim. */ promotedAs: string; failures?: string[]; error?: string; } /** Copy one origin's claims out of an org's scope into project-shared * knowledge. * * Sharing is deliberate, never a side effect of learning: `kgIngest` under a * scope only ever writes that org's namespaces, and this is the one path a * claim takes across the boundary. The org keeps its own copy untouched — the * shared copy is an INDEPENDENT assertion under `promoted:`, so * rolling back either side leaves the other standing, and a shared claim * always names the org that vouched for it. * * Like ingest, NOT atomic: the counters report what actually landed. */ export declare function kgPromote(options: { /** The org-side ref to promote, unqualified (e.g. `run:m4x2`). */ originRef: string; /** Owner the claims are promoted FROM. Promoting from the shared scope is a * no-op and is refused rather than silently duplicating. */ from: KgScope; dbPath?: string; }): Promise; export interface ConsolidationCandidate { name: string; type: string; description: string; edgeCount: number; /** Neighborhood facts to merge into one canonical description. */ neighborhood: string[]; } /** Entities whose descriptions are stale relative to their connectivity — * the LLM half runs in the LIVE agent: it rewrites each candidate's * description from the neighborhood facts and resubmits via memory_kg_ingest. * A resubmission is a NEW contribution and therefore the current one, so a * shorter but better-supported summary now wins; under "longest description * wins" a consolidation that tightened the prose was silently discarded. * No LLM here (fully local constraint). */ export declare function kgConsolidateCandidates(options?: { dbPath?: string; /** Minimum edges for a node to qualify (default 3). */ minEdges?: number; limit?: number; scope?: KgScope; }): Promise; /** Real counts, not page lengths. `bridgeListEntries.total` reports how many * rows that one call returned, so the old capped list made a 10,001-node graph * report exactly 10,000 forever. * * Tries a real indexed `SELECT COUNT(*) WHERE namespace = ?` first * (`bridgeCountEntries`, K7) — cheap and exact, since every row in a KG * namespace is exactly one node/edge/rule (the name index lives in its own * namespace). Falls back to the paginated scan — one query per 1,000 rows, * still exact — when the loaded bridge predates `bridgeCountEntries`, or a * test double doesn't stub it. */ export declare function kgStats(options?: { dbPath?: string; /** Whose graph to measure. Counting every org's facts under one org's name * is what made `org memory stats` a fiction. */ scope?: KgScope; }): Promise<{ nodes: number; edges: number; rules: number; }>; //# sourceMappingURL=memory-kg-promote.d.ts.map