UNPKG

github-mcp-auto-git

Version:

GitHub MCP Auto Git v3.0 - メモリ効率化・統合MCP・モジュール化完了の完全自動Git操作システム

131 lines 3.65 kB
/** * Memory Efficient Executor - Optimized parallel agent execution * Implements Constitutional AI principles for efficient resource management */ import EventEmitter from 'events'; export interface ExecutionTask<T = any> { id: string; priority: 'critical' | 'high' | 'medium' | 'low'; timeout: number; retryAttempts: number; memoryLimit: number; executor: () => Promise<T>; cleanup?: () => Promise<void>; } export interface ExecutionResult<T = any> { taskId: string; success: boolean; result?: T; error?: string; executionTime: number; memoryUsed: number; retryCount: number; } export interface MemoryStats { totalAllocated: number; currentUsage: number; peakUsage: number; tasksActive: number; tasksQueued: number; gcCollections: number; } export interface ExecutorConfig { maxConcurrentTasks: number; memoryThreshold: number; gcThreshold: number; priorityQueues: boolean; adaptiveTimeout: boolean; memoryMonitoring: boolean; } export declare class MemoryEfficientExecutor extends EventEmitter { private config; private activeTasks; private taskQueues; private memoryStats; private gcTimer?; private monitoringTimer?; constructor(config?: Partial<ExecutorConfig>); /** * Execute multiple tasks with memory optimization * Fail Fast: Immediate resource validation and task prioritization * Be Lazy: Smart scheduling and memory-aware execution * TypeScript First: Complete type safety for task execution */ executeParallel<T>(tasks: ExecutionTask<T>[]): Promise<ExecutionResult<T>[]>; /** * Execute single task with memory tracking * Fail Fast: Resource validation and timeout handling */ executeSingle<T>(task: ExecutionTask<T>): Promise<ExecutionResult<T>>; /** * Get current memory statistics * Be Lazy: Efficient memory monitoring */ getMemoryStats(): MemoryStats; /** * Force garbage collection and memory cleanup * Fail Fast: Immediate memory recovery */ forceCleanup(): Promise<void>; /** * Shutdown executor and cleanup all resources */ shutdown(): Promise<void>; /** * Initialize priority-based task queues * Be Lazy: Efficient queue management */ private initializeQueues; /** * Start memory monitoring * TypeScript First: Type-safe monitoring implementation */ private startMemoryMonitoring; /** * Optimize task execution order * Be Lazy: Smart scheduling for memory efficiency */ private optimizeTaskOrder; /** * Create memory-aware batches * Fail Fast: Prevent memory overflow with smart batching */ private createMemoryAwareBatches; /** * Execute batch of tasks */ private executeBatch; /** * Execute task with memory monitoring */ private executeWithMemoryMonitoring; /** * Get current memory usage */ private getCurrentMemoryUsage; /** * Trigger garbage collection */ private triggerGarbageCollection; /** * Perform intermediate cleanup between batches */ private performIntermediateCleanup; /** * Cancel low priority tasks to free memory */ private cancelLowPriorityTasks; /** * Clear internal caches */ private clearInternalCaches; /** * Wait for available execution slot */ private waitForSlot; /** * Wait for all active tasks to complete */ private waitForActiveTasks; } //# sourceMappingURL=memory-efficient-executor.d.ts.map