import { type LocalDashboardImportEpisode, type LocalMemoryFragment, type LocalMemoryContextResponse, type LocalMemoryIngestItem, type LocalMemoryMutationOptions, type LocalMemoryStatsResponse } from "./local-memory.js"; import type { DaemonRuntimeConfig } from "./config.js"; import type { DaemonLogger } from "./logger.js"; import type { SyncCoordinator } from "./sync.js"; import type { CachedMemoryEntry, ProjectState, SessionSummary, TaskState } from "./types.js"; import { type LocalMemoryBackendType, type LocalMemoryHealth, type LocalMemoryPlaneState } from "./surreal-memory-plane.js"; /** * Local memory backend contract. * * The `backend` field tells callers which engine is active. * The `health` field tells callers whether the plane is operational. * `kind` is retained as a discriminator for external consumers. */ export interface LocalMemoryBackend { /** "surrealdb" when healthy; "repair-required" when not ready. */ readonly kind: "surrealdb" | "repair-required"; readonly backend: LocalMemoryBackendType; readonly health: LocalMemoryHealth; warm(): Promise; getRetrievalFragments(userId: string): Promise; exportDashboardImportEpisodes(): Promise; inspect(userId: string, options?: { limit?: number; offset?: number; scope?: string; }): Promise; search(userId: string, options: { query: string; limit?: number; scope?: string; }): Promise; stats(userId: string): Promise; ingest(options: LocalMemoryMutationOptions & { userId: string; scope: string; items: LocalMemoryIngestItem[]; }): Promise<{ success: true; inserted: number; episodeIds: string[]; }>; delete(options: LocalMemoryMutationOptions & { userId: string; episodeIds: string[]; fallbackScope: string; }): Promise<{ success: boolean; deleted: number; }>; upsertReplica(entry: CachedMemoryEntry): Promise; deleteReplica(userId: string, episodeId: string, scope: string): Promise; getSessionSummary(userId: string, sessionId: string): Promise; upsertSessionSummary(entry: SessionSummary): Promise; getProject(userId: string, projectKey: string): Promise; upsertProject(entry: ProjectState): Promise; getTask(userId: string, taskKey: string): Promise; upsertTask(entry: TaskState): Promise; } export interface LocalMemoryBackendDependencies { config: DaemonRuntimeConfig; store: import("./types.js").Store; syncCoordinator?: SyncCoordinator; fetchImpl?: typeof fetch; logger?: DaemonLogger; } /** * Returns true when the plane is healthy and SurrealDB is authoritative. * Handles both the new { backend, health } shape and legacy phase-based state. */ export declare function shouldUseSurrealLocalMemory(state: LocalMemoryPlaneState | null): boolean; /** * Returns true when the plane has legacy backend state that should be migrated. */ export declare function needsSurrealMigration(state: LocalMemoryPlaneState | null): boolean; export declare function createLocalMemoryBackend(dependencies: LocalMemoryBackendDependencies): LocalMemoryBackend; //# sourceMappingURL=memory-backend.d.ts.map