/** * Storage backend selection (FOUNDATION-PLAN W2.2; v2 default flip). * * Builds the store set for the configured backend: * - "auto" (v2 default): resolved by legacy detection — sqlite state → * "sqlite", legacy content → "files" plus a migrate nudge, fresh → * "sqlite" (see backend-resolve.ts). Existing projects flip only * through the verify-gated migrate, never implicitly. * - "files": the JSON-file layout under .twining/ * - "sqlite": single database at .twining/twining.db via node:sqlite — * requires Node >= 22.13. When requested but unavailable (older Node, * open failure), falls back to "files" with a warning rather than * refusing to start: a coordination server must not be the reason a * session can't boot. */ import type { TwiningConfig } from "../utils/types.js"; import type { IAgentStore, IBlackboardStore, IDecisionStore, IGraphStore, IHandoffStore, IIndexManager } from "./interfaces.js"; import { type SqliteDatabase } from "./sqlite/db.js"; import { RecordSyncManager } from "./sync/sync-manager.js"; /** How the backend was chosen — surfaced through twining_status so a * session can see WHY it is reading what it reads (2026-08-15 field audit: * no tool response carried the backend, so an amnesia store read "Healthy"). */ export type BackendReason = "sqlite-state" | "legacy-content" | "fresh" | "explicit" | "fallback"; export interface StoreSet { backend: "files" | "sqlite"; reason: BackendReason; /** sqlite selected while a legacy v1 tier has content its matching table * lacks — the silent-amnesia shape (tier-matched, id-precise where the * legacy index is readable). */ legacy_unread: boolean; /** files backend serving via sqlite-unavailable FALLBACK while migrated * state exists in records/ — the session may be reading stale legacy * history (reverse-stranding, review SC-4). */ records_unread: boolean; blackboardStore: IBlackboardStore; decisionStore: IDecisionStore; graphStore: IGraphStore; agentStore: IAgentStore; handoffStore: IHandoffStore; indexManager: IIndexManager; /** * sqlite only: live re-ingest of the export tree when git moves HEAD * mid-session, plus embedding reconciliation (W2.3 phase 2). */ recordSync?: RecordSyncManager; /** sqlite only: the raw handle, for maintenance (WAL checkpoint, clean * close on shutdown — S4-7). */ db?: SqliteDatabase; } export declare function createStores(twiningDir: string, config: TwiningConfig): StoreSet; //# sourceMappingURL=backend-factory.d.ts.map