import type { MemoryKind, MemoryRecord, MemoryStore } from "./types.js"; export type WritePolicy = { readonly mode: "reconcile"; } | { readonly mode: "append"; }; /** Per-kind write discipline. Semantic facts reconcile (identity match → * update/supersede); episodic events append (a later episode never * contradicts an earlier one); reflection insights append too — distillation * ACCUMULATES insights, and a later insight never contradicts an earlier one * (superseding stale insights is a future concern). Procedural alone is typed * but not yet wired — throwing beats baking in accidental semantics. * Mirrored inline in packages/core/src/capabilities/built-in/memory.ts * remember (core can't import this package) — keep in sync. */ export declare function writePolicyFor(kind: MemoryKind): WritePolicy; export type WriteOp = { op: "add"; } | { op: "update"; targetId: string; } | { op: "supersede"; targetId: string; }; /** Deterministic write classification (no LLM): ADD if no identity match; UPDATE if identity+data equal; SUPERSEDE if identity matches but data differs. */ export declare function classifyWrite(incoming: MemoryRecord, candidates: readonly MemoryRecord[], identityKeys: readonly string[]): WriteOp; export interface ApproveResult { readonly approved: MemoryRecord; readonly action: "activated" | "superseded" | "deduped"; readonly superseded: readonly MemoryRecord[]; readonly identityKeys: readonly string[]; } /** * Approve a candidate WITH supersede reconciliation (fixes the two-actives bug): * same identity + different data → the old active row is superseded; same * identity + identical data → the candidate is dropped (dedupe); no identity * match → plain activation. Used by `dawn memory approve` and the inspector — * the capability's auto-write path keeps its own inline logic by design. * Append-kind candidates (per writePolicyFor, e.g. episodic) bypass * reconciliation entirely — approval is a plain activation, no identity scan. * * NOT transactional: MemoryStore has no CAS primitive, so the read-classify- * write sequence can race a concurrent same-identity auto-write. Worst case is * the pre-existing two-actives state, which self-heals on the next auto-write * or approval of that identity. */ export declare function approveWithReconcile(store: MemoryStore, id: string, opts: { readonly identityKeys: readonly string[]; readonly now: string; }): Promise; //# sourceMappingURL=reconcile.d.ts.map