/** * Compiled-truth revision history (Task 391, restored under Task 436). * * Single shared primitive that writes `:CompiledTruthRevision` rows * and `:HAS_REVISION` edges in the same transaction as the caller's * `compiledTruth` / `compiledTruthPublic` SET. Callers concatenate * this fragment into their own write statement so the SET and the * revision CREATEs commit atomically — if either fails, neither * lands. * * `twin` discriminates which property the row is the revision of — * `"compiledTruth"` (private/admin twin) or `"compiledTruthPublic"` * (public twin). Task 391 only had the private twin; Task 424 moved * compiled-truth writes into a specialist that handles both twins, * so the row needs a discriminator for history queries. * * `source` enum: `'rewriter'` (rewriter library wrote the truth) and * `'operator'` (sanctioned operator-edit route — passed by the * specialist when the operator supplied a hint). * * UNWIND-on-empty is a Cypher no-op, but production callers gate on * `revisions.length > 0` anyway so the standard (non-rewriter) * update path emits no extra clauses. * * Pruning is the dream-cycle's job (phase 5). This file never deletes. */ import type { Session } from "neo4j-driver"; export type CompiledTruthRevisionSource = "rewriter" | "operator"; export type CompiledTruthRevisionTwin = "compiledTruth" | "compiledTruthPublic"; export interface CompiledTruthRevisionRow { truth: string; twin: CompiledTruthRevisionTwin; source: CompiledTruthRevisionSource; } /** * Cypher fragment that UNWINDs the caller's `$revisions` array and * creates one `:CompiledTruthRevision` row per element, linked from * the entity bound as `n` in the caller's MATCH. The caller is * responsible for binding `n` (the entity) and providing * `$accountId` and `$revisions` parameters. * * Designed to be concatenated after a `compiledTruth` / * `compiledTruthPublic` SET so both mutations sit in the same * `session.run` call (single TX). */ export declare const REVISION_CYPHER_FRAGMENT_UNWIND = "\nUNWIND $revisions AS rev\nCREATE (r:CompiledTruthRevision {\n revisionId: randomUUID(),\n accountId: $accountId,\n truth: rev.truth,\n twin: rev.twin,\n writtenAt: datetime(),\n source: rev.source\n})\nCREATE (n)-[:HAS_REVISION]->(r)\n"; /** * An entity above the MENTIONS/REFERENCES threshold that qualifies for * inline compiled-truth rewrite (Task 595). Returned in IngestResult when * `inlineRewrite=true`. The calling agent dispatches the * `compiled-truth-rewriter` specialist for each entry. */ export interface InlineRewriteCandidate { /** Neo4j elementId of the target entity. */ elementId: string; /** Primary label, e.g. "Person" or "Organization". */ label: string; /** `name` or `title` property of the entity. */ name: string; /** Number of MENTIONS/REFERENCES edges from the new source to this entity. */ edgeCount: number; } /** * An entity above the threshold that was skipped because its * `compiledTruthUpdatedAt` is within the 7-day cooldown and * `forceRewrite` was not set. Remains a candidate for the next dream-cycle. */ export interface InlineRewriteDeferred { elementId: string; label: string; name: string; edgeCount: number; /** Why this entity was not included in candidates. Currently always "cooldown". */ reason: "cooldown"; /** ISO 8601 datetime when the entity's compiled truth was last rewritten. */ compiledTruthUpdatedAt: string; } /** * Convenience runner for tests and ad-hoc callers that want to write * revisions in isolation (no concurrent `compiledTruth` SET). * Production writers compose `REVISION_CYPHER_FRAGMENT_UNWIND` into * their own statement; this helper exists so test code does not have * to duplicate the fragment. */ export declare function writeRevisionsStandalone(args: { session: Session; nodeId: string; accountId: string; revisions: CompiledTruthRevisionRow[]; }): Promise; //# sourceMappingURL=compiled-truth-revision.d.ts.map