vibe-coder-mcp
Version:
Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.
93 lines • 2.96 kB
TypeScript
import v8 from 'v8';
import { MemoryCache, MemoryCacheStats } from './memoryCache.js';
import { GrammarManager } from './grammarManager.js';
import { Tree } from '../parser.js';
export interface MemoryManagerOptions {
maxMemoryPercentage?: number;
monitorInterval?: number;
autoManage?: boolean;
pruneThreshold?: number;
prunePercentage?: number;
}
export interface MemoryStats {
formatted: {
totalSystemMemory: string;
freeSystemMemory: string;
usedSystemMemory: string;
memoryUsagePercentage: string;
memoryStatus: 'normal' | 'high' | 'critical';
process: {
rss: string;
heapTotal: string;
heapUsed: string;
external: string;
arrayBuffers: string;
};
v8: {
heapSizeLimit: string;
totalHeapSize: string;
usedHeapSize: string;
heapSizeExecutable: string;
mallocedMemory: string;
peakMallocedMemory: string;
};
cache: {
totalSize: string;
cacheCount: number;
};
thresholds: {
highMemoryThreshold: string;
criticalMemoryThreshold: string;
};
};
raw: {
totalSystemMemory: number;
freeSystemMemory: number;
memoryUsagePercentage: number;
processMemory: NodeJS.MemoryUsage;
heapStats: v8.HeapInfo;
heapSpaceStats: v8.HeapSpaceInfo[];
};
cacheStats: MemoryCacheStats[];
grammarStats: Record<string, unknown>;
timestamp: number;
}
export declare class MemoryManager {
private options;
private caches;
private grammarManager;
private monitorTimer;
private gcTimer;
private maxMemoryBytes;
private static readonly DEFAULT_OPTIONS;
constructor(options?: MemoryManagerOptions);
registerCache<K, V>(cache: MemoryCache<K, V>): void;
unregisterCache(name: string): void;
registerGrammarManager(manager: GrammarManager): void;
private startMonitoring;
stopMonitoring(): void;
startPeriodicGC(interval?: number): void;
stopPeriodicGC(): void;
private checkMemoryUsage;
pruneCaches(): void;
getMemoryStats(): MemoryStats;
formatBytes(bytes: number, decimals?: number): string;
createASTCache(): MemoryCache<string, Tree>;
createSourceCodeCache(): MemoryCache<string, string>;
runGarbageCollection(): void;
detectMemoryPressure(): {
level: 'normal' | 'moderate' | 'high' | 'critical';
heapUsagePercentage: number;
systemMemoryPercentage: number;
recommendations: string[];
};
emergencyCleanup(): Promise<{
success: boolean;
freedMemory: number;
actions: string[];
error?: string;
}>;
checkAndExecuteEmergencyCleanup(): Promise<boolean>;
private createFallbackMemoryStats;
}
//# sourceMappingURL=memoryManager.d.ts.map