import type { DatabaseSync } from "node:sqlite"; import { type FSWatcher } from "chokidar"; import type { ResolvedMemorySearchConfig } from "../agents/memory-search.js"; import type { BotConfig } from "../config/config.js"; import type { MemoryEmbeddingProbeResult, MemoryProviderStatus, MemorySearchManager, MemorySearchResult, MemorySource, MemorySyncProgressUpdate } from "./types.js"; import { type EmbeddingProvider, type GeminiEmbeddingClient, type MistralEmbeddingClient, type OllamaEmbeddingClient, type OpenAiEmbeddingClient, type VoyageEmbeddingClient } from "./embeddings.js"; import { MemoryManagerEmbeddingOps } from "./manager-embedding-ops.js"; export declare class MemoryIndexManager extends MemoryManagerEmbeddingOps implements MemorySearchManager { private readonly cacheKey; protected readonly cfg: BotConfig; protected readonly agentId: string; protected readonly workspaceDir: string; protected readonly settings: ResolvedMemorySearchConfig; protected provider: EmbeddingProvider | null; private readonly requestedProvider; protected fallbackFrom?: "openai" | "local" | "gemini" | "voyage" | "mistral" | "ollama"; protected fallbackReason?: string; private readonly providerUnavailableReason?; protected openAi?: OpenAiEmbeddingClient; protected gemini?: GeminiEmbeddingClient; protected voyage?: VoyageEmbeddingClient; protected mistral?: MistralEmbeddingClient; protected ollama?: OllamaEmbeddingClient; protected batch: { enabled: boolean; wait: boolean; concurrency: number; pollIntervalMs: number; timeoutMs: number; }; protected batchFailureCount: number; protected batchFailureLastError?: string; protected batchFailureLastProvider?: string; protected batchFailureLock: Promise; protected db: DatabaseSync; protected readonly sources: Set; protected providerKey: string; protected readonly cache: { enabled: boolean; maxEntries?: number; }; protected readonly vector: { enabled: boolean; available: boolean | null; extensionPath?: string; loadError?: string; dims?: number; }; protected readonly fts: { enabled: boolean; available: boolean; loadError?: string; }; protected vectorReady: Promise | null; protected watcher: FSWatcher | null; protected watchTimer: NodeJS.Timeout | null; protected sessionWatchTimer: NodeJS.Timeout | null; protected sessionUnsubscribe: (() => void) | null; protected intervalTimer: NodeJS.Timeout | null; protected closed: boolean; protected dirty: boolean; protected sessionsDirty: boolean; protected sessionsDirtyFiles: Set; protected sessionPendingFiles: Set; protected sessionDeltas: Map; private sessionWarm; private syncing; private readonlyRecoveryAttempts; private readonlyRecoverySuccesses; private readonlyRecoveryFailures; private readonlyRecoveryLastError?; static get(params: { cfg: BotConfig; agentId: string; purpose?: "default" | "status"; }): Promise; private constructor(); warmSession(sessionKey?: string): Promise; search(query: string, opts?: { maxResults?: number; minScore?: number; sessionKey?: string; }): Promise; private searchVector; private buildFtsQuery; private searchKeyword; private mergeHybridResults; sync(params?: { reason?: string; force?: boolean; progress?: (update: MemorySyncProgressUpdate) => void; }): Promise; private isReadonlyDbError; private extractErrorReason; private runSyncWithReadonlyRecovery; readFile(params: { relPath: string; from?: number; lines?: number; }): Promise<{ text: string; path: string; }>; status(): MemoryProviderStatus; probeVectorAvailability(): Promise; probeEmbeddingAvailability(): Promise; close(): Promise; }