export type MemorySource = "memory" | "sessions" | "pageindex"; export type MemorySearchResult = { path: string; startLine: number; endLine: number; score: number; snippet: string; source: MemorySource; citation?: string; /** PageIndex-specific: hierarchical path in the semantic tree */ semanticPath?: string[]; /** PageIndex-specific: confidence score from LLM navigation */ navigationConfidence?: number; }; /** PageIndex configuration options */ export type PageIndexConfig = { enabled: boolean; /** Token threshold for using PageIndex (default: 4000) */ tokenThreshold: number; /** Maximum tree depth (default: 6) */ maxDepth: number; /** Minimum section size in words (default: 50) */ minSectionWords: number; /** Model configuration for PageIndex operations */ models: { structure: string; summary: string; navigation: string; }; }; export type MemoryEmbeddingProbeResult = { ok: boolean; error?: string; }; export type MemorySyncProgressUpdate = { completed: number; total: number; label?: string; }; export type MemoryProviderStatus = { backend: "builtin" | "qmd"; provider: string; model?: string; requestedProvider?: string; files?: number; chunks?: number; dirty?: boolean; workspaceDir?: string; dbPath?: string; extraPaths?: string[]; sources?: MemorySource[]; sourceCounts?: Array<{ source: MemorySource; files: number; chunks: number; }>; cache?: { enabled: boolean; entries?: number; maxEntries?: number; }; fts?: { enabled: boolean; available: boolean; error?: string; }; fallback?: { from: string; reason?: string; }; vector?: { enabled: boolean; available?: boolean; extensionPath?: string; loadError?: string; dims?: number; }; batch?: { enabled: boolean; failures: number; limit: number; wait: boolean; concurrency: number; pollIntervalMs: number; timeoutMs: number; lastError?: string; lastProvider?: string; }; custom?: { searchMode?: string; providerUnavailableReason?: string; pageindex?: { enabled: boolean; entries?: number; tokenThreshold?: number; }; qmd?: { collections?: number; lastUpdateAt?: number | null; }; [key: string]: unknown; }; }; export interface MemorySearchManager { search(query: string, opts?: { maxResults?: number; minScore?: number; sessionKey?: string; }): Promise; readFile(params: { relPath: string; from?: number; lines?: number; }): Promise<{ text: string; path: string; }>; status(): MemoryProviderStatus; sync?(params?: { reason?: string; force?: boolean; progress?: (update: MemorySyncProgressUpdate) => void; }): Promise; probeEmbeddingAvailability(): Promise; probeVectorAvailability(): Promise; close?(): Promise; }