import type { DatabaseSync } from "node:sqlite"; import { FSWatcher } from "chokidar"; import { ResolvedMemorySearchConfig } from "../agents/memory-search.js"; import { type OpenClawConfig } from "../config/config.js"; import { type EmbeddingProvider, type GeminiEmbeddingClient, type MistralEmbeddingClient, type OllamaEmbeddingClient, type OpenAiEmbeddingClient, type VoyageEmbeddingClient } from "./embeddings.js"; import type { HistoryFileEntry } from "./history-files.js"; import { type MemoryFileEntry } from "./internal.js"; import type { SessionFileEntry } from "./session-files.js"; import type { MemoryProviderStatus, MemorySource, MemorySyncProgressUpdate } from "./types.js"; type MemoryIndexMeta = { model: string; provider: string; providerKey?: string; sources?: MemorySource[]; chunkTokens: number; chunkOverlap: number; vectorDims?: number; }; export declare abstract class MemoryManagerSyncOps { protected abstract readonly cfg: OpenClawConfig; protected abstract readonly agentId: string; protected abstract readonly managerInstanceId: string; protected abstract readonly workspaceDir: string; protected abstract readonly settings: ResolvedMemorySearchConfig; protected provider: EmbeddingProvider | null; protected fallbackFrom?: "openai" | "local" | "gemini" | "voyage" | "mistral" | "ollama"; protected openAi?: OpenAiEmbeddingClient; protected gemini?: GeminiEmbeddingClient; protected voyage?: VoyageEmbeddingClient; protected mistral?: MistralEmbeddingClient; protected ollama?: OllamaEmbeddingClient; protected abstract batch: { enabled: boolean; wait: boolean; concurrency: number; pollIntervalMs: number; timeoutMs: number; }; protected readonly sources: Set; protected providerKey: string | null; protected abstract 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 historyWatcher: FSWatcher | null; protected watchTimer: NodeJS.Timeout | null; protected sessionWatchTimer: NodeJS.Timeout | null; protected sessionUnsubscribe: (() => void) | null; protected fallbackReason?: string; protected intervalTimer: NodeJS.Timeout | null; protected historyMaintenanceTimer: NodeJS.Timeout | null; protected closed: boolean; protected dirty: boolean; protected historyDirty: boolean; protected sessionsDirty: boolean; protected sessionsDirtyFiles: Set; protected sessionPendingFiles: Set; protected sessionDeltas: Map; protected providerUnavailableReason?: string; private lastMetaSerialized; private historyRetentionSweepInFlight; protected abstract readonly cache: { enabled: boolean; maxEntries?: number; }; protected abstract db: DatabaseSync; protected abstract computeProviderKey(): string; protected abstract sync(params?: { reason?: string; force?: boolean; progress?: (update: MemorySyncProgressUpdate) => void; }): Promise; protected abstract status(): MemoryProviderStatus; protected abstract withTimeout(promise: Promise, timeoutMs: number, message: string): Promise; protected abstract getIndexConcurrency(): number; protected abstract pruneEmbeddingCacheIfNeeded(): void; protected abstract indexFile(entry: MemoryFileEntry | SessionFileEntry | HistoryFileEntry, options: { source: MemorySource; content?: string; }): Promise; protected onSafeReindexBuildStart(_params: { originalDb: DatabaseSync; originalProvider: EmbeddingProvider | null; originalProviderUnavailableReason?: string; originalFtsAvailable: boolean; originalVectorAvailable: boolean | null; originalVectorDims?: number; originalVectorReady: Promise | null; }): void; protected onSafeReindexPromoteStart(): Promise | void; protected onSafeReindexFinished(): void; protected buildMemoryLogMeta(extra?: Record): Record; protected buildMemoryDiagnostics(extra?: Record): Record; protected deleteIndexedPathRows(pathValue: string, source: MemorySource, options?: { deleteFile?: boolean; }): void; protected ensureVectorReady(dimensions?: number): Promise; private loadVectorExtension; private ensureVectorTable; private dropVectorTable; protected buildSourceFilter(alias?: string): { sql: string; params: MemorySource[]; }; protected openDatabase(): DatabaseSync; private openDatabaseAtPath; private seedEmbeddingCache; private swapIndexFiles; private moveIndexFiles; private removeIndexFiles; protected ensureSchema(): void; protected ensureWatcher(): void; protected ensureHistoryWatcher(): void; protected ensureSessionListener(): void; private scheduleSessionDirty; private processSessionDeltaBatch; private updateSessionDelta; private countNewlines; private resetSessionDelta; private isSessionFileForAgent; protected ensureIntervalSync(): void; protected ensureHistoryMaintenance(): void; protected runHistoryRetentionSweep(): Promise; private scheduleWatchSync; private shouldSyncSessions; private syncMemoryFiles; private syncSessionFiles; private syncHistoryFiles; private createSyncProgress; protected runSync(params?: { reason?: string; force?: boolean; progress?: (update: MemorySyncProgressUpdate) => void; }): Promise; private shouldFallbackOnError; protected resolveBatchConfig(): { enabled: boolean; wait: boolean; concurrency: number; pollIntervalMs: number; timeoutMs: number; }; private activateFallbackProvider; private runSafeReindex; private runUnsafeReindex; private resetIndex; protected readMeta(): MemoryIndexMeta | null; protected writeMeta(meta: MemoryIndexMeta): void; private resolveConfiguredSourcesForMeta; } export {};