UNPKG

cortexweaver

Version:

CortexWeaver is a command-line interface (CLI) tool that orchestrates a swarm of specialized AI agents, powered by Claude Code and Gemini CLI, to assist in software development. It transforms a high-level project plan (plan.md) into a series of coordinate

65 lines 2.13 kB
"use strict"; /** * Performance Monitoring and Analytics for Cognitive Canvas Navigator */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PerformanceMonitor = void 0; class PerformanceMonitor { constructor() { this.metrics = { averageQueryTime: 0, cacheHitRatio: 0, queryCount: 0, totalExecutionTime: 0, slowQueries: [], memoryUsage: 0, optimizationCount: 0 }; this.queryTimes = []; } startPerformanceMonitoring() { this.monitoringInterval = setInterval(() => { this.updatePerformanceMetrics(); this.cleanupOldMetrics(); }, 30000); } stopPerformanceMonitoring() { if (this.monitoringInterval) { clearInterval(this.monitoringInterval); this.monitoringInterval = undefined; } } updateMetrics(queryTime, cacheHit) { this.queryTimes.push(queryTime); this.metrics.queryCount++; this.metrics.totalExecutionTime += queryTime; if (queryTime > 1000) { this.metrics.slowQueries.push({ query: `query-${this.metrics.queryCount}`, time: queryTime }); this.metrics.slowQueries = this.metrics.slowQueries.slice(-10); } } updatePerformanceMetrics() { this.metrics.averageQueryTime = this.queryTimes.length > 0 ? this.queryTimes.reduce((a, b) => a + b, 0) / this.queryTimes.length : 0; } updateMemoryUsage(cacheSize) { this.metrics.memoryUsage = cacheSize * 1024; } updateCacheHitRatio(ratio) { this.metrics.cacheHitRatio = ratio; } updateOptimizationCount(count) { this.metrics.optimizationCount = count; } getPerformanceMetrics() { this.updatePerformanceMetrics(); return { ...this.metrics }; } cleanupOldMetrics() { if (this.queryTimes.length > 1000) { this.queryTimes = this.queryTimes.slice(-1000); } } } exports.PerformanceMonitor = PerformanceMonitor; //# sourceMappingURL=performance-monitor.js.map