/** * GitMem MCP Startup Service * * Initializes local vector search at server startup. * Loads all scars once from Supabase, builds in-memory index. * Provides cache management (status, flush, health check). * * Solves: * - Cache consistency (no file-based cache race conditions) * - 500-employees-at-8AM (no Supabase contention during session_start) * - Cross-container consistency (same data = same results) * * */ import type { Project } from "../types/index.js"; /** * Initialize GitMem MCP server * * Call this at server startup to pre-load the scar index. * Subsequent session_start calls will use the in-memory index. */ export declare function initializeGitMem(_project?: Project): Promise<{ success: boolean; scar_count: number; elapsed_ms: number; search_mode: "local" | "remote"; error?: string; }>; /** * Ensure GitMem is initialized (idempotent) * * Safe to call multiple times - only initializes once. */ export declare function ensureInitialized(_project?: Project): Promise; /** * Check if local search is available */ export declare function isLocalSearchAvailable(_project?: Project): boolean; /** * Get initialization status */ export declare function getInitStatus(): { complete: boolean; search_mode: "local" | "remote"; default_ready: boolean; }; export interface CacheStatus { search_mode: "local" | "remote"; initialized: boolean; scar_count: number; loaded_at: string | null; age_minutes: number; ttl_minutes: number; is_stale: boolean; latest_scar_updated_at: string | null; } export interface CacheHealth { status: "healthy" | "stale" | "out_of_sync" | "unavailable"; local_scar_count: number; remote_scar_count: number; local_latest_updated_at: string | null; remote_latest_updated_at: string | null; needs_refresh: boolean; details: string; } export interface CacheFlushResult { success: boolean; previous_scar_count: number; new_scar_count: number; elapsed_ms: number; error?: string; } /** * Get cache status for a project */ export declare function getCacheStatus(_project?: Project): CacheStatus; /** * Check cache health against remote Supabase */ export declare function checkCacheHealth(_project?: Project): Promise; /** * Flush and reload the cache */ export declare function flushCache(_project?: Project): Promise; /** * Check if cache needs refresh based on TTL or staleness * Returns true if a refresh is recommended */ export declare function shouldRefreshCache(_project?: Project): Promise; /** * Auto-refresh cache if stale (call periodically or before critical operations) */ export declare function autoRefreshIfStale(_project?: Project): Promise; /** * Start background initialization of local vector search * * This allows the server to start immediately while scars load in the background. * First few queries will use Supabase fallback until cache is ready. */ export declare function startBackgroundInit(_project?: Project): void; /** * Start periodic cache refresh * * Refreshes the unified local cache every TTL period to keep it fresh. */ export declare function startPeriodicRefresh(intervalMinutes: number): void; /** * Stop periodic refresh (for cleanup) */ export declare function stopPeriodicRefresh(): void; //# sourceMappingURL=startup.d.ts.map