import { z } from "zod"; export { writeFact } from "../orchestrator/memory/reconcile.js"; export type { ReconcileAction } from "../orchestrator/memory/reconcile.js"; /** * Zod schema for a fact input — mirrors LessonEntrySchema in memory.ts. * All timestamps are ISO 8601 strings; the store never reads the clock. */ export declare const FactSchema: z.ZodObject<{ scope: z.ZodString; subject: z.ZodString; predicate: z.ZodString; value: z.ZodString; confidence: z.ZodDefault; sourceRunId: z.ZodDefault>; tValid: z.ZodString; tCreated: z.ZodString; }, "strip", z.ZodTypeAny, { value: string; scope: string; subject: string; predicate: string; confidence: number; sourceRunId: string | null; tValid: string; tCreated: string; }, { value: string; scope: string; subject: string; predicate: string; tValid: string; tCreated: string; confidence?: number | undefined; sourceRunId?: string | null | undefined; }>; export type FactInput = z.infer; export interface FactRecord { id: string; scope: string; subject: string; predicate: string; value: string; confidence: number; sourceRunId: string | null; tValid: string; tInvalid: string | null; tCreated: string; tInvalidated: string | null; } /** * Derive a deterministic 16-char hex fact id from the fact signature. * Mirrors lessonIdFromSignature in src/orchestrator/memory/distill.ts:88-99. * Identical inputs always produce the same id — no wall-clock dependency. */ export declare function factId(scope: string, subject: string, predicate: string, value: string, tCreated: string): string; /** * Resolve the absolute path to facts.db for the given project root and namespace. * Uses the same memoryDir mapping rule as memory.ts (no duplication). */ export declare function factsDbPath(projectRoot: string, namespace?: string): string; /** * Ensure the directory that will hold the DB file exists. * Must be called by the CLI handler before constructing a file-backed FactStore. * Not needed for ':memory:' paths. */ export declare function ensureFactsDir(projectRoot: string, namespace?: string): Promise; /** * Bi-temporal SQLite-backed fact store. * * PURE: Never calls Date.now() or new Date() — every timestamp is a parameter. * Hidden behind this interface so the driver (better-sqlite3) is swappable. * * bober: in-memory or file-backed via better-sqlite3 (synchronous); swap for * node:sqlite when engines.node is raised to >=22.5. */ export declare class FactStore { private db; constructor(dbPath: string, opts?: { journalModeWal?: boolean; busyTimeoutMs?: number; readonly?: boolean; }); /** * Insert a new fact. Validates input with FactSchema and derives the * deterministic id. Returns the persisted FactRecord. */ insertFact(input: FactInput): FactRecord; /** * Return all active (non-invalidated) facts matching the given scope. * Optionally filtered by subject and/or predicate. * Active = t_invalidated IS NULL. */ getActiveFacts(scope: string, subject?: string, predicate?: string): FactRecord[]; /** * Return a single fact by its id regardless of invalidation status. * Returns null if not found. */ getFact(id: string): FactRecord | null; /** * Soft-delete a fact by setting t_invalidated. * Returns true if the fact was invalidated, false if it was already invalidated or not found. * Never deletes rows. */ invalidateFact(id: string, tInvalidated: string): boolean; /** * Supersede a fact: set BOTH t_invalidated (record-time) AND t_invalid (world-time end). * Used by reconcile on UPDATE to carry both bi-temporal closure fields. * Returns true if the row was updated; false if not found or already invalidated. */ supersedeFact(id: string, tInvalidated: string, tInvalid: string): boolean; /** Close the underlying database connection. */ close(): void; } //# sourceMappingURL=facts.d.ts.map