mcp-adr-analysis-server
Version:
MCP server for analyzing Architectural Decision Records and project architecture
145 lines • 3.94 kB
TypeScript
/**
* CE-MCP Sandbox Executor
*
* Executes orchestration directives in an isolated sandbox environment.
* Replaces direct OpenRouter calls with local execution of LLM-generated code.
*
* Performance Optimizations (Phase 4.4):
* - Parallel operation execution for independent operations
* - Batched file system operations
* - LRU cache with automatic eviction
* - Lazy dependency resolution
*
* @see ADR-014: CE-MCP Architecture
*/
import { OrchestrationDirective, StateMachineDirective, SandboxExecutionResult, CEMCPConfig } from '../types/ce-mcp.js';
/**
* Default CE-MCP configuration
*/
export declare const DEFAULT_CEMCP_CONFIG: CEMCPConfig;
/**
* Sandbox Executor Class
*
* Executes CE-MCP directives in an isolated environment with:
* - Process isolation (operation-level sandboxing)
* - Filesystem restrictions (project path only)
* - Resource limits (timeout, memory, operations)
* - State management (results persist across operations)
* - LRU cache eviction for memory efficiency (Phase 4.4)
*/
export declare class SandboxExecutor {
private config;
private operationCache;
private promptCache;
private cacheHits;
private cacheMisses;
constructor(config?: Partial<CEMCPConfig>);
/**
* Evict oldest entries when cache exceeds max size (LRU strategy)
*/
private evictOldestEntries;
/**
* Execute an orchestration directive
*/
executeDirective(directive: OrchestrationDirective | StateMachineDirective, projectPath: string): Promise<SandboxExecutionResult>;
/**
* Execute an orchestration directive
*/
private executeOrchestrationDirective;
/**
* Execute a state machine directive
*/
private executeStateMachineDirective;
/**
* Execute a single sandbox operation
*/
private executeOperation;
/**
* Operation: Load domain-specific knowledge
*/
private opLoadKnowledge;
/**
* Operation: Load prompt template (lazy loading)
*/
private opLoadPrompt;
/**
* Operation: Analyze project files
*/
private opAnalyzeFiles;
/**
* Operation: Scan environment configuration
* Optimized with parallel file checks (Phase 4.4)
*/
private opScanEnvironment;
/**
* Operation: Generate context from multiple inputs
*/
private opGenerateContext;
/**
* Operation: Compose final result
*/
private opComposeResult;
/**
* Operation: Validate output against schema
*/
private opValidateOutput;
/**
* Operation: Cache a result
*/
private opCacheResult;
/**
* Operation: Retrieve cached result
*/
private opRetrieveCache;
/**
* Create sandbox context for execution
*/
private createContext;
/**
* Evaluate a condition
*/
private evaluateCondition;
/**
* Generate cache key for an operation
*/
private generateOperationCacheKey;
/**
* Get cached operation result (with LRU tracking)
*/
private getCachedOperation;
/**
* Set cached operation result (with LRU eviction)
*/
private setCachedOperation;
/**
* Compose result from composition directive
*/
private composeResult;
/**
* Clear all caches
*/
clearCaches(): void;
/**
* Get cache statistics (Phase 4.4 enhanced metrics)
*/
getCacheStats(): {
operations: number;
prompts: number;
hits: number;
misses: number;
hitRate: number;
};
/**
* Reset cache statistics (useful for testing)
*/
resetCacheStats(): void;
}
/**
* Get or create the global sandbox executor
*/
export declare function getSandboxExecutor(config?: Partial<CEMCPConfig>): SandboxExecutor;
/**
* Reset the global sandbox executor
*/
export declare function resetSandboxExecutor(): void;
//# sourceMappingURL=sandbox-executor.d.ts.map