code-devops / src /self-healing.ts
delqhi's picture
Deploy code-devops agent
7dbcecf verified
Raw
History Blame Contribute Delete
1.52 kB
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<string, any>) {
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);
}
}