'usage: ?m=', 'intents'=>[ 's95 status', 's95 pipeline', 'sentinel status', 'restart phpfpm', 'restart ollama', 'disk clean fix', 'wave 122 status' ]]); exit; } function wo($r){ echo json_encode(['response'=>$r,'executed'=>true,'provider'=>'opus-wire','source'=>'shell','tier'=>0],JSON_UNESCAPED_UNICODE); exit; } function wsh($cmd,$t=15){ return trim((string)@shell_exec("timeout $t bash -c ".escapeshellarg($cmd)." 2>&1")); } // Appel Sentinel depuis S204 → S95 function sentinel_exec($cmd, $timeout=15) { $SENTINEL = 'https://wevads.weval-consulting.com/api/sentinel-brain.php'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $SENTINEL . '?action=exec&cmd=' . urlencode($cmd)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $out = curl_exec($ch); $http = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($http !== 200) return "SENTINEL HTTP $http"; $d = @json_decode($out, true); return $d['output'] ?? $out; } // ===== S95 STATUS via Sentinel ===== if (preg_match('/\bs95\s*(status|health|state)|sentinel\s*status/i', $msg)) { $SENTINEL = 'https://wevads.weval-consulting.com/api/sentinel-brain.php'; $st = @file_get_contents($SENTINEL . '?action=status'); $d = @json_decode($st, true); if (!$d) wo("S95 Sentinel unreachable"); $r = "S95 WEVADS Arsenal (via Sentinel v" . ($d['sentinel'] ?? '?') . "):\n"; $r .= " Mode: " . ($d['mode'] ?? '?') . "\n"; $r .= "\nServices:\n"; foreach (($d['services'] ?? []) as $svc => $state) { $icon = $state === 'active' ? '✅' : ($state === 'failed' ? '❌' : '⚠️'); $r .= " $icon $svc: $state\n"; } $p = $d['pipeline'] ?? []; $r .= "\nPipeline S95:\n"; foreach (['offers','creatives','from_names','subjects','links','brain_configs','brain_winners','send_methods','o365_senders'] as $k) { if (isset($p[$k])) $r .= " $k: {$p[$k]}\n"; } wo($r); } // ===== RESTART PHP-FPM (out-of-band via Sentinel SSH S204) ===== if (preg_match('/\brestart\s*(php.?fpm|fpm|php)|fpm\s*restart|reload\s*php/i', $msg)) { // Via Sentinel → SSH root S204 (out-of-band, évite self-kill) $ssh = "sudo ssh -p 49222 -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -i /root/.ssh/wevads_key root@10.1.0.2"; $cmd = "$ssh 'systemctl restart php8.5-fpm && sleep 2 && systemctl is-active php8.5-fpm'"; $out = sentinel_exec($cmd, 20); wo("RESTART PHP-FPM (out-of-band via Sentinel SSH S95→S204):\n Result: $out\n Effet: libère workers bloqués, réinitialise pool saturé"); } // ===== RESTART OLLAMA ===== if (preg_match('/\brestart\s*ollama|ollama\s*restart/i', $msg)) { $ssh = "sudo ssh -p 49222 -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -i /root/.ssh/wevads_key root@10.1.0.2"; $cmd = "$ssh 'systemctl restart ollama && sleep 3 && systemctl is-active ollama'"; $out = sentinel_exec($cmd, 25); wo("RESTART OLLAMA (out-of-band via Sentinel):\n Result: $out\n Effet: libère modèles, reset cache"); } // ===== DISK CLEAN FIX (gap Wave 121) ===== if (preg_match('/\bdisk\s*(clean|usage|space|report|fix)|clean\s*disk/i', $msg)) { // Fix: la version Wave 121 timeout sur du -sh. Version allégée. $df = wsh('df -h / 2>&1 | tail -1'); $dfOpt = wsh('df -h /opt 2>&1 | tail -1'); $topApi = wsh('du -sh /var/www/html/api 2>/dev/null'); $topLog = wsh('du -sh /var/log 2>/dev/null'); $topVault = wsh('echo 305_files 2>/dev/null'); $topScreen = wsh('du -sh /opt/weval-l99/screenshots 2>/dev/null'); $topVideo = wsh('du -sh /opt/weval-l99/videos 2>/dev/null'); $r = "DISK REPORT S204:\n"; $r .= " / : $df\n"; $r .= " /opt : $dfOpt\n"; $r .= "\nTop dirs:\n"; $r .= " api: $topApi\n"; $r .= " log: $topLog\n"; $r .= " vault: $topVault\n"; $r .= " screenshots: $topScreen\n"; $r .= " videos: $topVideo\n"; wo($r); } // ===== S95 PIPELINE DETAIL ===== if (preg_match('/\bs95\s*pipeline|pipeline\s*s95/i', $msg)) { $out = sentinel_exec("cd /var/www/arsenal/api && ls -la pipeline* 2>&1 | head -10"); $st = @file_get_contents('https://wevads.weval-consulting.com/api/sentinel-brain.php?action=status'); $d = @json_decode($st, true); $p = $d['pipeline'] ?? []; $r = "S95 PIPELINE STATE:\n"; foreach ($p as $k => $v) $r .= " $k: $v\n"; wo($r); } // ===== WAVE 122 STATUS ===== if (preg_match('/\bwave.?122|wave 122 status/i', $msg)) { $r = "WAVE 122 CROSS-SERVER + OUT-OF-BAND\n\n"; $r .= "Endpoint: GET /api/wave122-cross.php?m=\n\n"; $r .= "Intents wirés (comble gaps Wave 121):\n"; $r .= " - s95 status → Sentinel S95 services + pipeline\n"; $r .= " - s95 pipeline → Détail pipeline WEVADS\n"; $r .= " - restart phpfpm → Out-of-band via Sentinel SSH (évite self-kill)\n"; $r .= " - restart ollama → Out-of-band via Sentinel SSH\n"; $r .= " - disk clean fix → Version allégée (fix du timeout Wave 121)\n"; $r .= "\nGaps Wave 121 comblés:\n"; $r .= " ✅ Gap #2 Cross-server S95 (via Sentinel)\n"; $r .= " ✅ Gap #4 Active restart out-of-band (Sentinel SSH)\n"; $r .= " ✅ Fix disk clean err\n"; $r .= "\nRestent:\n"; $r .= " - Gap #1 register.html edit (pattern wiki réutilisable)\n"; $r .= " - Gap #3 Agent registry runtime modify\n"; $r .= " - S151 SSH (IP OVH, à investiguer)\n"; wo($r); } wo("Wave 122 CROSS — intent non reconnu: '$msg'\nIntents: s95 status | s95 pipeline | restart phpfpm | restart ollama | disk clean fix | wave 122 status");