Spaces:
Sleeping
Sleeping
| 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-datascience', | |
| 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); | |
| } | |
| } | |