UNPKG

@hivetechs/hive-ai

Version:

Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API

169 lines 4.64 kB
/** * SQLite Backup Manager - Local Privacy-Preserving Backup System * * Features: * - Automated local backups with rotation * - Timestamp-based restoration * - Incremental and full backup strategies * - Backup verification and integrity checks * - Disaster recovery utilities * - Zero cloud storage - 100% local and private */ import { SQLiteMemorySystem } from './sqlite-memory.js'; export interface BackupMetadata { timestamp: string; type: 'full' | 'incremental' | 'emergency'; size_bytes: number; conversation_count: number; checksum: string; schema_version: string; backup_duration_ms: number; integrity_verified: boolean; mcp_config_included: boolean; mcp_transport_type?: string; mcp_server_port?: number; configured_ides?: string[]; } export interface BackupConfig { enabled: boolean; backup_directory: string; max_backups: { daily: number; weekly: number; monthly: number; emergency: number; }; auto_backup_schedule: { daily_hour: number; weekly_day: number; monthly_date: number; }; compression_enabled: boolean; verification_enabled: boolean; encryption_enabled: boolean; } export declare class SQLiteBackupManager { private backupDir; private dbPath; private config; private memorySystem; private locationManager; constructor(memorySystem: SQLiteMemorySystem); /** * Initialize async operations */ private initialize; /** * Load backup configuration or create default */ private loadConfig; /** * Default backup configuration */ private getDefaultConfig; /** * Save backup configuration */ private saveConfig; /** * Capture MCP configuration information for backup metadata */ private captureMCPConfigInfo; /** * Create standalone MCP configuration backup */ createMCPConfigBackup(): Promise<{ success: boolean; backup_path?: string; error?: string; }>; /** * Restore MCP configuration from backup */ restoreMCPConfig(configBackupPath: string): Promise<{ success: boolean; error?: string; restored_settings?: string[]; }>; /** * Post-restoration MCP server setup */ setupMCPAfterRestore(): Promise<{ success: boolean; actions_taken?: string[]; error?: string; }>; /** * Ensure backup directory structure exists */ private ensureBackupDirectory; /** * Create a full backup of the SQLite database */ createBackup(type?: 'full' | 'incremental' | 'emergency', label?: string): Promise<{ success: boolean; backup_path?: string; metadata?: BackupMetadata; error?: string; }>; /** * Perform SQLite backup using file copy (reliable and consistent) */ private performSQLiteBackup; /** * Restore database from a specific backup */ restoreFromBackup(backupPath: string, options?: { verify_integrity?: boolean; create_emergency_backup?: boolean; timestamp_verification?: boolean; }): Promise<{ success: boolean; error?: string; emergency_backup_path?: string; }>; /** * List all available backups with metadata */ listBackups(): Promise<{ daily: BackupMetadata[]; weekly: BackupMetadata[]; monthly: BackupMetadata[]; emergency: BackupMetadata[]; manual: BackupMetadata[]; }>; /** * Get backup statistics and health */ getBackupHealth(): Promise<{ total_backups: number; total_size_bytes: number; latest_backup: string | null; oldest_backup: string | null; backup_frequency_days: number; integrity_issues: string[]; disk_usage_percentage: number; recommendations: string[]; }>; /** * Emergency disaster recovery - restore from most recent valid backup */ emergencyRestore(): Promise<{ success: boolean; restored_from?: string; error?: string; steps_taken: string[]; }>; private getBackupSubdir; private getConversationCount; private calculateChecksum; private getSchemaVersion; private verifyBackupIntegrity; private compressBackup; private decompressBackup; private cleanupOldBackups; private verifyRestoredDatabase; private calculateDiskUsage; private scheduleAutomaticBackups; } //# sourceMappingURL=sqlite-backup-manager.d.ts.map