import { execFileSync } from 'node:child_process'; /** * 🚨 GLOBAL FLEET SELF-HEALING PROTOCOL (PRIORITY 0000) 🚨 * NO-SILO MANDATE: This module catches critical errors, dumps extensive logs, * and blasts them to the fleet self-healing webhook. * Hermes and SIN-GitHub-Issues will automatically take over from there. */ export function triggerFleetSelfHealing(error: Error, extensiveContext: Record) { console.error('\n🚨 CRITICAL FAILURE DETECTED. INITIATING NO-SILO SELF-HEALING PROTOCOL 🚨'); const payload = { agentId: 'sin-code-devops', timestamp: new Date().toISOString(), errorLogs: `Error: ${error.message}\nStack: ${error.stack}\nContext: ${JSON.stringify(extensiveContext, null, 2)}`, team: 'Team Coding' }; try { const webhookUrl = process.env.FLEET_SELF_HEALING_WEBHOOK || 'http://92.5.60.87:5678/webhook/self-healing'; // Blast to the N8N foundation webhook const curlCmd = `curl -X POST "${webhookUrl}" -H "Content-Type: application/json" -d '${JSON.stringify(payload).replace(/'/g, "'\\''")}'`; execFileSync('bash', ['-c', curlCmd], { encoding: 'utf8' }); console.log('āœ… Extensive logs successfully transmitted to Fleet Self-Healing pipeline.'); console.log('šŸ‘· The Elite Coder Fleet has been notified and will resolve this architecture flaw autonomously.'); } catch (transmitError: any) { console.error('āŒ FATAL: Could not transmit logs to Fleet Self-Healing pipeline.', transmitError.message); } }