/** * CSV-based incremental cache for NCP * Enables resumable indexing by appending each MCP as it's indexed */ export interface CachedTool { mcpName: string; toolId: string; toolName: string; description: string; hash: string; timestamp: string; } export interface CachedMCP { name: string; hash: string; toolCount: number; timestamp: string; tools: CachedTool[]; } export interface FailedMCP { name: string; lastAttempt: string; errorType: string; errorMessage: string; attemptCount: number; nextRetry: string; } export interface CacheMetadata { version: string; profileName: string; profileHash: string; ncpVersion: string; createdAt: string; lastUpdated: string; totalMCPs: number; totalTools: number; indexedMCPs: Map; failedMCPs: Map; } export declare class CSVCache { private cacheDir; private profileName; private csvPath; private metaPath; private writeStream; private metadata; constructor(cacheDir: string, profileName: string); /** * Initialize cache - create files if needed */ initialize(): Promise; /** * Get NCP version from package.json (async) */ private getNcpVersion; /** * Validate cache against current profile configuration (async) */ validateCache(currentProfileHash: string): Promise; /** * Get list of already-indexed MCPs with their hashes */ getIndexedMCPs(): Map; /** * Check if an MCP is already indexed and up-to-date */ isMCPIndexed(mcpName: string, currentHash: string): boolean; /** * Remove MCP from index (forces re-indexing) */ removeMCPFromIndex(mcpName: string): void; /** * Load all cached tools from CSV (async) */ loadCachedTools(): Promise; /** * Load cached tools for a specific MCP (async) */ loadMCPTools(mcpName: string): Promise; /** * Start incremental writing (append mode) */ startIncrementalWrite(profileHash: string): Promise; /** * Append tools from an MCP to cache */ appendMCP(mcpName: string, tools: CachedTool[], mcpHash: string): Promise; /** * Finalize cache writing */ finalize(): Promise; /** * Clear cache completely */ clear(): Promise; /** * Save metadata to disk with fsync for crash safety (async) */ private saveMetadata; /** * Force flush write stream to disk */ private flushWriteStream; /** * Format CSV line with proper escaping */ private formatCSVLine; /** * Parse CSV line handling quoted fields */ private parseCSVLine; /** * Mark an MCP as failed with retry scheduling */ markFailed(mcpName: string, error: Error): void; /** * Check if we should retry a failed MCP */ shouldRetryFailed(mcpName: string, forceRetry?: boolean): boolean; /** * Clear all failed MCPs (for force retry) */ clearFailedMCPs(): void; /** * Get failed MCPs count */ getFailedMCPsCount(): number; /** * Get failed MCPs that are ready for retry */ getRetryReadyFailedMCPs(): string[]; /** * Check if an MCP is in the failed list */ isMCPFailed(mcpName: string): boolean; /** * Hash profile configuration for change detection */ static hashProfile(profile: any): string; /** * Hash tool configuration for change detection */ static hashTools(tools: any[]): string; } //# sourceMappingURL=csv-cache.d.ts.map