import type { DatabaseSync } from "node:sqlite"; import { FSWatcher } from "chokidar"; import { type OpenClawConfig, type ResolvedMemorySearchConfig } from "openclaw/plugin-sdk/memory-core-host-engine-foundation"; import { type SessionFileEntry } from "openclaw/plugin-sdk/memory-core-host-engine-qmd"; import { type MemoryFileEntry, type MemorySource, type MemorySyncProgressUpdate } from "openclaw/plugin-sdk/memory-core-host-engine-storage"; import { type EmbeddingProvider, type EmbeddingProviderId, type EmbeddingProviderRuntime } from "./embeddings.js"; type MemoryIndexMeta = { model: string; provider: string; providerKey?: string; sources?: MemorySource[]; scopeHash?: string; chunkTokens: number; chunkOverlap: number; vectorDims?: number; ftsTokenizer?: string; }; export declare function openMemoryDatabaseAtPath(dbPath: string, allowExtension: boolean): DatabaseSync; export declare function runDetachedMemorySync(sync: () => Promise, reason: "interval" | "watch"): void; export declare abstract class MemoryManagerSyncOps { protected abstract readonly cfg: OpenClawConfig; protected abstract readonly agentId: string; protected abstract readonly workspaceDir: string; protected abstract readonly settings: ResolvedMemorySearchConfig; protected provider: EmbeddingProvider | null; protected fallbackFrom?: EmbeddingProviderId; protected providerRuntime?: EmbeddingProviderRuntime; 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 watchTimer: NodeJS.Timeout | null; protected sessionWatchTimer: NodeJS.Timeout | null; protected sessionUnsubscribe: (() => void) | null; protected fallbackReason?: string; protected intervalTimer: NodeJS.Timeout | null; protected closed: boolean; protected dirty: boolean; protected sessionsDirty: boolean; protected sessionsDirtyFiles: Set; protected sessionPendingFiles: Set; protected sessionDeltas: Map; private lastMetaSerialized; protected abstract readonly cache: { enabled: boolean; maxEntries?: number; }; protected abstract db: DatabaseSync; protected abstract computeProviderKey(): string; protected abstract sync(params?: { reason?: string; force?: boolean; forceSessions?: boolean; sessionFile?: string; progress?: (update: MemorySyncProgressUpdate) => void; }): Promise; protected abstract withTimeout(promise: Promise, timeoutMs: number, message: string): Promise; protected abstract getIndexConcurrency(): number; protected abstract pruneEmbeddingCacheIfNeeded(): void; protected abstract indexFile(entry: MemoryFileEntry | SessionFileEntry, options: { source: MemorySource; content?: string; }): Promise; protected ensureVectorReady(dimensions?: number): Promise; private loadVectorExtension; private ensureVectorTable; private dropVectorTable; protected buildSourceFilter(alias?: string): { sql: string; params: MemorySource[]; }; protected openDatabase(): DatabaseSync; private seedEmbeddingCache; private swapIndexFiles; private moveIndexFiles; private removeIndexFiles; protected ensureSchema(): void; protected ensureWatcher(): void; protected ensureSessionListener(): void; private scheduleSessionDirty; private processSessionDeltaBatch; private updateSessionDelta; private countNewlines; private resetSessionDelta; private isSessionFileForAgent; private normalizeTargetSessionFiles; private clearSyncedSessionFiles; protected ensureIntervalSync(): void; private scheduleWatchSync; private shouldSyncSessions; private syncMemoryFiles; private syncSessionFiles; private createSyncProgress; protected runSync(params?: { reason?: string; force?: boolean; sessionFiles?: string[]; 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; private normalizeMetaSources; private resolveConfiguredScopeHash; private metaSourcesDiffer; } export {};