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

74 lines 2.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrorTracking = void 0; /** * ErrorTracking handles error statistics and tracking functionality */ class ErrorTracking { constructor(canvas) { this.canvas = canvas; this.errorStats = new Map(); this.recoveryStats = new Map(); } /** * Store error context in the cognitive canvas */ async storeErrorContext(errorContext) { try { await this.canvas.storeFailure({ id: errorContext.id, type: errorContext.type, severity: errorContext.severity, message: errorContext.errorMessage, taskId: errorContext.taskId, step: errorContext.step, timestamp: errorContext.timestamp, metadata: errorContext.metadata }); } catch (error) { console.warn('Failed to store error context:', error); } } /** * Track error occurrence for statistics */ trackError(taskId, errorContext) { const errorKey = `${errorContext.type}_${errorContext.severity}`; const current = this.errorStats.get(errorKey) || { count: 0, lastOccurrence: '' }; this.errorStats.set(errorKey, { count: current.count + 1, lastOccurrence: errorContext.timestamp }); console.log(`Error tracked: ${errorKey} (count: ${current.count + 1})`); } /** * Track successful recovery */ trackSuccessfulRecovery(taskId) { const current = this.recoveryStats.get(taskId) || 0; this.recoveryStats.set(taskId, current + 1); console.log(`Recovery tracked for task ${taskId} (count: ${current + 1})`); } /** * Get error statistics */ getErrorStats() { return new Map(this.errorStats); } /** * Get recovery statistics */ getRecoveryStats() { return new Map(this.recoveryStats); } /** * Clear statistics (useful for testing or reset) */ clearStats() { this.errorStats.clear(); this.recoveryStats.clear(); } } exports.ErrorTracking = ErrorTracking; //# sourceMappingURL=error-tracking.js.map