import * as sqlite3 from 'sqlite3'; import { VectorDatabase } from './vector-database-interface'; /** * Dimension types for the 5D database system + 6th dimension (V for vectors) */ export type Dimension = 'X' | 'Y' | 'Z' | 'W' | 'T' | 'V'; /** * Manages 5 separate SQLite databases, one for each dimension. * Each database is stored in the workspace-specific .database-plugin directory. */ export declare class MultiDbManager { private databases; private dbDirectory; private workspaceRoot; private pluginId; private vssLoader; private vectorDatabase; /** * Creates a new MultiDbManager instance. * @param workspaceRoot The root directory of the workspace */ constructor(workspaceRoot: string); /** * Computes a stable plugin_id from the workspace root path. * Uses SHA256 hash of normalized path, takes first 16 characters. * * Normalization: POSIX-style (forward slashes), lowercase on Windows (case-insensitive). * This matches WorkspaceResolver.computePluginId() for consistency. * * @param workspaceRoot The workspace root directory * @returns Stable plugin ID (16 hex characters) */ private computePluginId; /** * Ensures the database directory exists. */ private ensureDbDirectory; /** * Checks if existing databases have a different plugin ID (e.g., after workspace move). * Returns true if mismatch is detected, false otherwise. * * IMPORTANT: This method closes all open database connections before checking, * to ensure databases can be deleted if cleanup is needed. * * @returns Promise that resolves to true if plugin ID mismatch detected, false otherwise */ checkPluginIdMismatch(): Promise; /** * Checks if existing databases have a different plugin ID (e.g., after workspace move). * This is informational only and does not block operation. * Note: This is a best-effort check and may not catch all cases. */ private checkPluginIdConsistency; /** * Cleans up old databases with different plugin IDs. * Closes all open database connections, then deletes all database files. * * WARNING: This will permanently delete all existing database data. * Use only when you want to start fresh after workspace move/rename. * * Note: If databases are locked by another process (e.g., VS Code Extension), * deletion will fail with a warning. The new ingestion will overwrite old data anyway. * * @returns Promise that resolves when cleanup is complete */ cleanupOldDatabases(): Promise; /** * Gets the plugin ID for this workspace. */ getPluginId(): string; /** * Gets the database directory path. */ getDbDirectory(): string; /** * Gets the workspace root directory. */ getWorkspaceRoot(): string; /** * Opens a database connection for the specified dimension. * If the database is already open, returns the existing connection. * For V-dimension (vectors.db), loads VSS extension before opening. * * @param dimension The dimension (X, Y, Z, W, T, or V) * @returns Promise that resolves to the SQLite database instance */ getDatabase(dimension: Dimension): Promise; /** * Closes a database connection for the specified dimension. * * @param dimension The dimension to close * @returns Promise that resolves when the database is closed */ closeDatabase(dimension: Dimension): Promise; /** * Closes all database connections. * * @returns Promise that resolves when all databases are closed */ closeAll(): Promise; /** * Gets all open database connections. * * @returns Map of dimension to database instance */ getOpenDatabases(): Map; /** * Gets the Vector Database for vector similarity search. * Only available for V-dimension after initialization. * * @returns Vector Database instance or null if not available */ getVectorDatabase(): VectorDatabase | null; /** * @deprecated Use getVectorDatabase() instead * Gets the VSS Manager for backward compatibility. */ getVssManager(): any | null; } //# sourceMappingURL=multi-db-manager.d.ts.map