/** * Cache Service * * Unified cache management for the orchestrator. Wraps CSVCache and CachePatcher * to provide a single interface for: * - Loading cached tools and metadata * - Saving/updating cache * - Cache validation and integrity checks * - Incremental cache updates */ import type { MCPDefinition, MCPConfig, Profile } from '../types/connection.js'; import type { ToolInfo } from '../types/discovery.js'; import type { OrchestratorContext } from '../interfaces/orchestrator-context.js'; import type { OrchestratorService } from '../interfaces/service-container.js'; /** * Cached MCP data with tools and metadata */ export interface CachedMCPData { name: string; tools: Array<{ name: string; description: string; inputSchema?: Record; }>; serverInfo?: { name: string; title?: string; version: string; description?: string; websiteUrl?: string; }; } /** * Result of loading from cache */ export interface CacheLoadResult { success: boolean; mcpCount: number; toolCount: number; definitions: Map; tools: ToolInfo[]; toolToMCP: Map; } /** * Cache validation result */ export interface CacheValidationResult { valid: boolean; profileHashMatches: boolean; integrityValid: boolean; reason?: string; } /** * Cache Service implementation */ export declare class CacheService implements OrchestratorService { private context; private profileName; private csvCache; private cachePatcher; private initialized; constructor(context: OrchestratorContext, profileName?: string); /** * Initialize the cache service */ initialize(): Promise; /** * Validate cache integrity and profile hash */ validateCache(profile: Profile): Promise; /** * Load cached tools for given MCP configs * * @param mcpConfigs - MCP configurations to load * @returns Cache load result with definitions and tools */ loadFromCache(mcpConfigs: MCPConfig[]): Promise; /** * Save MCP data to cache */ saveMCP(mcpName: string, config: MCPConfig, tools: Array<{ name: string; description: string; inputSchema?: any; }>, serverInfo?: any, mcpHash?: string): Promise; /** * Mark MCP as failed in cache */ markMCPFailed(mcpName: string, error: Error): void; /** * Check if MCP is indexed in cache */ isMCPIndexed(mcpName: string, hash?: string): boolean; /** * Check if failed MCP should be retried */ shouldRetryFailed(mcpName: string, forceRetry: boolean): boolean; /** * Check if MCP previously failed */ isMCPFailed(mcpName: string): boolean; /** * Get map of indexed MCPs (name -> hash) */ getIndexedMCPs(): Map; /** * Get count of failed MCPs */ getFailedMCPsCount(): number; /** * Start incremental write mode */ startIncrementalWrite(profileHash: string): Promise; /** * Finalize cache writes */ finalize(): Promise; /** * Clear cache */ clear(): Promise; /** * Generate profile hash */ generateProfileHash(profile: Profile): string; /** * Update profile hash in cache */ updateProfileHash(hash: string): Promise; /** * Remove MCP from cache index */ removeMCPFromIndex(mcpName: string): void; /** * Load tool metadata cache directly */ loadToolMetadataCache(): Promise; /** * Cleanup */ cleanup(): Promise; } /** * Create a cache service instance */ export declare function createCacheService(context: OrchestratorContext, profileName?: string): CacheService; //# sourceMappingURL=cache-service.d.ts.map