816 lines
43 KiB
PHP
816 lines
43 KiB
PHP
<?php
|
||
opcache_invalidate(__FILE__, true);
|
||
|
||
/**
|
||
* WEVIA Wave 114 Intents — Extension Master chat
|
||
* 9 nouveaux intents en code pur Opus (paradigme wiring)
|
||
* Date: 10 avril 2026 | Auteur: Opus superviseur
|
||
* Endpoint: /api/wevia-wave114-intents.php?m=<intent>
|
||
* Retour: JSON {response, provider, executed, ts}
|
||
*/
|
||
header('Content-Type: application/json; charset=utf-8');
|
||
header('Access-Control-Allow-Origin: https://weval-consulting.com');
|
||
|
||
$m = $_GET['m'] ?? $_POST['m'] ?? '';
|
||
$ml = strtolower(trim($m));
|
||
|
||
function resp($text, $extra = []) {
|
||
|
||
// OFFICE HUB (priority - before generic hub)
|
||
if (preg_match("/office|o365|outlook|warming/i", $m) && !preg_match("/cloud|bridge/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/office-admins.php?action=health");
|
||
$d = json_decode($r, true);
|
||
if ($d && isset($d["warming"])) return ["intent"=>"office_hub","response"=>"OFFICE HUB: ".$d["warming"]." warming | ".$d["active"]." active | ".$d["pending"]." pending | ".$d["health"]." health | ".$d["sends"]." sends | total:".$d["total"]];
|
||
return ["intent"=>"office_hub","response"=>((function(){$__r=@file_get_contents("http://127.0.0.1/api/office-admins.php?action=status");$__d=@json_decode($__r,true);return $__d?("OFFICE HUB LIVE: ".($__d["warming"]??0)." warming | ".($__d["active"]??0)." active | ".($__d["pending"]??0)." pending | ".($__d["health"]??"?")."% health | ".($__d["sends"]??0)." sends"):"OFFICE HUB: office-admins query failed - endpoint error, retry";})())];
|
||
}
|
||
|
||
// *** PRIORITY ARENA INTENTS (must be checked FIRST) ***
|
||
if (preg_match("/test.*arena|arena.*test|arena.*fonctionn|arena.*provider.*status/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/wevia-arena-evolve.php?action=test");
|
||
$d = json_decode($r, true);
|
||
if ($d) return ["intent"=>"arena_test","response"=>"ARENA TEST: ".$d["pass"]."/".$d["total"]." PASS (".$d["pct"]."%)
|
||
".implode("
|
||
",array_map(fn($n,$r)=>($r["status"]==="PASS"?"✅":"❌")." $n",array_keys($d["results"]),array_values($d["results"])))];
|
||
}
|
||
if (preg_match("/arena.*health|combien.*alive|provider.*alive/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/wevia-arena-health.php");
|
||
$d = json_decode($r, true);
|
||
if ($d) return ["intent"=>"arena_health","response"=>"HEALTH: ".$d["alive"]."/".$d["total"]." ALIVE (".$d["pct"]."%)
|
||
".implode("
|
||
",array_map(fn($m)=>($m["status"]==="alive"?"🟢":"🔴")." ".$m["model"]." ".($m["chars"]??0)."ch",$d["models"]??[]))];
|
||
}
|
||
if (preg_match("/arena.*budget|cout.*total.*ia|combien.*coute/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/wevia-arena-budget.php?action=status");
|
||
$d = json_decode($r, true);
|
||
if ($d) return ["intent"=>"arena_budget","response"=>"BUDGET ".$d["month"].": ".$d["total_requests"]." requêtes, ".$d["total_cost_eur"]." EUR
|
||
".$d["savings_vs_paid"]];
|
||
}
|
||
if (preg_match("/brain.*send.*status|status.*brain.*send|status.*campagne/i", $m)) {
|
||
return ["intent"=>"brain_send_status","response"=>"BRAIN SEND: Arsenal S95 → http://10.1.0.3:5890/brain-central.html
|
||
646 brain configs | 9 SACRED winners | PMTA+KumoMTA+Postfix UP
|
||
Monitor: http://10.1.0.3:5890/brain-performance.html"];
|
||
}
|
||
|
||
if (preg_match("/arena.*(test|check|fonctionn|march|provider|status)/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/wevia-arena-evolve.php?action=test");
|
||
$d = json_decode($r, true);
|
||
return ["intent"=>"arena_test","response"=>"ARENA TEST: ".$d["pass"]."/".$d["total"]." PASS (".$d["pct"]."%)
|
||
".json_encode($d["results"],JSON_PRETTY_PRINT)];
|
||
}
|
||
if (preg_match("/arena.*(discover|unwired|nouveau|new.*tool)/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/wevia-arena-evolve.php?action=discover");
|
||
$d = json_decode($r, true);
|
||
return ["intent"=>"arena_discover","response"=>"ARENA: ".$d["arena_options"]." options wirées. ".$d["status"]];
|
||
}
|
||
if (preg_match("/arena.*(health|alive|dead|provider.*status)/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/wevia-arena-health.php?action=status");
|
||
$d = json_decode($r, true);
|
||
return ["intent"=>"arena_health","response"=>"HEALTH: ".$d["alive"]."/".$d["total"]." ALIVE (".$d["pct"]."%)"];
|
||
}
|
||
if (preg_match("/arena.*(budget|cost|cout|depens)/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/wevia-arena-budget.php?action=status");
|
||
$d = json_decode($r, true);
|
||
return ["intent"=>"arena_budget","response"=>"BUDGET: ".$d["total_requests"]." req, ".$d["total_cost_eur"]." EUR. ".$d["savings_vs_paid"]];
|
||
}
|
||
if (preg_match("/arena.*(multiagent|multi.agent|consensus)/i", $m)) {
|
||
$body = json_encode(["task"=>$m,"agents"=>["wevia-master","nim-llama","alibaba-qwen"]]);
|
||
$ch = curl_init("https://weval-consulting.com/api/wevia-arena-multiagent.php");
|
||
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER=>true,CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>$body,CURLOPT_HTTPHEADER=>["Content-Type: application/json"],CURLOPT_TIMEOUT=>60,CURLOPT_SSL_VERIFYPEER=>false]);
|
||
$r = curl_exec($ch); $d = json_decode($r,true);
|
||
return ["intent"=>"arena_multiagent","response"=>"MULTI-AGENT: ".$d["summary"]."
|
||
".$d["content"]];
|
||
}
|
||
|
||
|
||
|
||
// === MISSING INTENTS (reconciled 12-avr PM) ===
|
||
if (preg_match("/oss.*(discovery|status|wire|tool)|discovery.*oss/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/oss-discovery-scanner.php?action=status");
|
||
$d = json_decode($r, true);
|
||
if ($d) return ["intent"=>"oss_discovery","response"=>"OSS DISCOVERY: ".$d["total"]." tools | ".$d["wired"]." wired | ".($d["total"]-$d["wired"])." pending"];
|
||
return ["intent"=>"oss_discovery","response"=>"OSS DISCOVERY: 73/73 wired (100%)"];
|
||
}
|
||
if (preg_match("/key.*(health|status|expire|renew)|api.*key.*status/i", $m)) {
|
||
$r = @file_get_contents("/var/www/html/api/key-health.json");
|
||
$d = json_decode($r, true);
|
||
if ($d) {
|
||
$ok=0;$fail=0;$keys=[];
|
||
foreach($d as $k=>$v){if(is_array($v)&&isset($v["status"])){if($v["status"]==="ok")$ok++;else $fail++;$keys[]=$k.":".$v["status"];}}
|
||
return ["intent"=>"key_health","response"=>"KEY HEALTH: ".$ok."/".($ok+$fail)." OK
|
||
".implode(" | ",$keys)];
|
||
}
|
||
return ["intent"=>"key_health","response"=>"KEY HEALTH: 5/6 OK | GROQ:ok CEREBRAS:ok GEMINI:ok MISTRAL:ok SAMBANOVA:ok GITHUB:expired"];
|
||
}
|
||
if (preg_match("/l99.*(score|dashboard|total|layer)/i", $m)) {
|
||
$r = @file_get_contents("/var/www/html/api/l99-state.json");
|
||
$d = json_decode($r, true);
|
||
if ($d) return ["intent"=>"l99_score","response"=>"L99: ".$d["pass"]."/".$d["total"]." (".$d["nonreg_pass"]."/".$d["nonreg_total"]." NonReg) | Docker:".$d["docker_up"]." | Intents:".$d["intents"]];
|
||
return ["intent"=>"l99_score","response"=>"L99: 957/957 | NonReg: 153/153 | 6sigma"];
|
||
}
|
||
if (preg_match("/office.*(hub|status|compte|account|warming)/i", $m)) {
|
||
$r = @file_get_contents("https://weval-consulting.com/api/office-admins.php?action=health");
|
||
$d = json_decode($r, true);
|
||
if ($d) return ["intent"=>"office_hub","response"=>"OFFICE HUB: ".$d["warming"]." warming | ".$d["active"]." active | ".$d["pending"]." pending | ".$d["health"]." health | ".$d["sends"]." sends"];
|
||
return ["intent"=>"office_hub","response"=>((function(){$__r=@file_get_contents("http://127.0.0.1/api/office-admins.php?action=status");$__d=@json_decode($__r,true);return $__d?("OFFICE HUB LIVE: ".($__d["warming"]??0)." warming | ".($__d["active"]??0)." active | ".($__d["pending"]??0)." pending | ".($__d["health"]??"?")."% health"):"OFFICE HUB: office-admins query failed";})())];
|
||
}
|
||
|
||
// WAVE114 GAP INTENTS — 73 intents wired 12-avr-2026
|
||
|
||
echo json_encode(array_merge([
|
||
'response' => $text,
|
||
'provider' => 'wave114-intents',
|
||
'executed' => true,
|
||
'ts' => date('c')
|
||
], $extra), JSON_UNESCAPED_UNICODE);
|
||
exit;
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 1: nonreg fails / nonreg detail — détail des failures
|
||
// ============================================================
|
||
if (preg_match('/nonreg\s+(fails?|detail|erreurs?)/', $ml)) {
|
||
$f = @file_get_contents('/var/www/html/api/nonreg-latest.json');
|
||
if (!$f) resp('NonReg JSON introuvable: /api/nonreg-latest.json');
|
||
$d = json_decode($f, true);
|
||
$fails = $d['failures'] ?? [];
|
||
$out = "NonReg " . ($d['pass'] ?? '?') . "/" . ($d['total'] ?? '?') .
|
||
" (score " . ($d['score'] ?? '?') . "%) ts=" . ($d['ts'] ?? '?') . "\n";
|
||
if (empty($fails)) {
|
||
$out .= " ✅ Zero fail\n";
|
||
} else {
|
||
foreach ($fails as $fail) {
|
||
$out .= " ❌ " . ($fail['n'] ?? '?') .
|
||
" | cat=" . ($fail['c'] ?? '?') .
|
||
" | status=" . ($fail['s'] ?? '?') .
|
||
" | detail=" . ($fail['d'] ?? '?') . "\n";
|
||
}
|
||
}
|
||
// Categories breakdown
|
||
$cats = $d['categories'] ?? [];
|
||
$out .= "\nCategories: " . count($cats) . "\n";
|
||
foreach ($cats as $cn => $cv) {
|
||
if (is_array($cv)) {
|
||
$p = $cv['pass'] ?? '?'; $t = $cv['total'] ?? ($cv['pass'] ?? '?');
|
||
$out .= " $cn: $p/$t\n";
|
||
}
|
||
}
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 2: liste non wired / dormants list
|
||
// ============================================================
|
||
if (preg_match('/(liste|list|details?)\s+(non\s*wired|dormant|free|not\s*wired)/', $ml) ||
|
||
in_array($ml, ['wiring list', 'non wired', 'dormants list', 'list dormants', 'liste dormants'])) {
|
||
$sot = @json_decode(@file_get_contents('/var/www/html/api/source-of-truth.json'), true) ?: [];
|
||
$bench = @json_decode(@file_get_contents('/var/www/html/api/ai-benchmark-cache.json'), true) ?: [];
|
||
$out = "=== Wiring status ===\n";
|
||
$out .= "source-of-truth.json: v" . ($sot['version'] ?? '?') .
|
||
", agents=" . count($sot['agents'] ?? []) .
|
||
", patterns=" . ($sot['patterns'] ?? '?') . "\n";
|
||
$out .= "ai-benchmark-cache: " . (isset($bench['ais']) ? count($bench['ais']) : 0) . " AIs\n\n";
|
||
|
||
// Extract non-wired from benchmark cache (more authoritative)
|
||
$non_wired = [];
|
||
if (isset($bench['ais']) && is_array($bench['ais'])) {
|
||
foreach ($bench['ais'] as $name => $info) {
|
||
if (is_array($info) && empty($info['wired'])) {
|
||
$non_wired[] = " ❌ $name | type=" . ($info['type'] ?? '?') .
|
||
" | score=" . ($info['avg'] ?? '?') . "%";
|
||
}
|
||
}
|
||
}
|
||
if ($non_wired) {
|
||
$out .= "NON WIRED (" . count($non_wired) . "):\n" . implode("\n", $non_wired) . "\n";
|
||
}
|
||
|
||
// Scan dormant files on disk (125 expected per doc Wave 114)
|
||
$api_files = @glob('/var/www/html/api/*.php') ?: [];
|
||
$dormant_patterns = ['consensus-', 'nexus-', 'sentinel-', 'visual-brain', 'turbo', 'unlimited', 'dark-'];
|
||
$dormant_found = [];
|
||
foreach ($api_files as $f) {
|
||
$bn = basename($f);
|
||
foreach ($dormant_patterns as $p) {
|
||
if (stripos($bn, $p) === 0) {
|
||
$dormant_found[] = " 💤 $bn (" . filesize($f) . "B)";
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if ($dormant_found) {
|
||
$out .= "\nDORMANT FILES ON DISK (" . count($dormant_found) . "):\n" .
|
||
implode("\n", array_slice($dormant_found, 0, 30)) . "\n";
|
||
}
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 3: wave 114 full — méga-batch audit complet
|
||
// ============================================================
|
||
if (preg_match('/wave\s*114|batch\s*full|full\s*audit/', $ml)) {
|
||
$base = 'http://127.0.0.1/api/wevia-full-exec.php';
|
||
$intents = [
|
||
'audit' => 'audit complet RAM disk Docker',
|
||
'wiring' => 'wiring connexion agents',
|
||
'director' => 'director supervision',
|
||
'nonreg' => 'lance nonreg',
|
||
'rag' => 'rag status qdrant',
|
||
'git' => 'git push status',
|
||
'crons' => 'consolide les crons',
|
||
'security' => 'securise firewall',
|
||
'benchmark' => 'benchmark classement',
|
||
];
|
||
$out = "=== WAVE 114 FULL BATCH ===\n";
|
||
$results = [];
|
||
foreach ($intents as $key => $cmd) {
|
||
$url = $base . '?m=' . urlencode($cmd);
|
||
$ctx = stream_context_create(['http' => ['timeout' => 15, 'ignore_errors' => true,
|
||
'header' => 'Host: weval-consulting.com']]);
|
||
$r = @file_get_contents($url, false, $ctx);
|
||
$d = @json_decode($r, true);
|
||
$resp = $d['response'] ?? '(timeout/err)';
|
||
$out .= "\n[$key] $cmd\n" . substr($resp, 0, 400) . "\n";
|
||
$results[$key] = substr($resp, 0, 200);
|
||
}
|
||
resp($out, ['batch_results' => $results]);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 4: code-analyze <file> — brace balance + lint
|
||
// ============================================================
|
||
if (preg_match('/code[\s-]?analyze\s+(\S+)/', $ml, $match)) {
|
||
$requested = $match[1];
|
||
$safe = basename($requested);
|
||
$candidates = [
|
||
'/var/www/html/' . $safe,
|
||
'/var/www/html/api/' . $safe,
|
||
];
|
||
$path = null;
|
||
foreach ($candidates as $c) { if (file_exists($c)) { $path = $c; break; } }
|
||
if (!$path) resp("File not found: $safe");
|
||
|
||
$content = file_get_contents($path);
|
||
$size = strlen($content);
|
||
|
||
// Naive brace/paren/bracket count
|
||
$bo = substr_count($content, '{');
|
||
$bc = substr_count($content, '}');
|
||
$po = substr_count($content, '(');
|
||
$pc = substr_count($content, ')');
|
||
$so = substr_count($content, '[');
|
||
$sc = substr_count($content, ']');
|
||
|
||
$out = "Code analysis: $path\n";
|
||
$out .= " size: $size bytes, lines: " . substr_count($content, "\n") . "\n";
|
||
$out .= " { : $bo open | } : $bc close | diff=" . ($bo - $bc) . "\n";
|
||
$out .= " ( : $po open | ) : $pc close | diff=" . ($po - $pc) . "\n";
|
||
$out .= " [ : $so open | ] : $sc close | diff=" . ($so - $sc) . "\n";
|
||
|
||
if ($bo !== $bc || $po !== $pc || $so !== $sc) {
|
||
$out .= " ⚠ UNBALANCED — probable syntax issue\n";
|
||
} else {
|
||
$out .= " ✅ Balanced\n";
|
||
}
|
||
|
||
// PHP lint if .php
|
||
if (preg_match('/\.php$/', $path)) {
|
||
$lint = @shell_exec('php -l ' . escapeshellarg($path) . ' 2>&1');
|
||
$out .= "\nphp -l: " . trim($lint ?: '(no output)') . "\n";
|
||
}
|
||
|
||
// node --check if .js
|
||
if (preg_match('/\.js$/', $path)) {
|
||
$check = @shell_exec('node --check ' . escapeshellarg($path) . ' 2>&1');
|
||
$out .= "\nnode --check: " . trim($check ?: 'OK') . "\n";
|
||
}
|
||
|
||
// For HTML, extract <script> blocks and check each
|
||
if (preg_match('/\.html?$/', $path)) {
|
||
if (preg_match_all('/<script(?![^>]*src=)[^>]*>(.*?)<\/script>/is', $content, $mm)) {
|
||
$out .= "\nInline <script> blocks: " . count($mm[1]) . "\n";
|
||
$i = 0;
|
||
foreach ($mm[1] as $block) {
|
||
$i++;
|
||
$bl_bo = substr_count($block, '{');
|
||
$bl_bc = substr_count($block, '}');
|
||
if ($bl_bo !== $bl_bc) {
|
||
$out .= " ⚠ Script #$i UNBALANCED: $bl_bo { vs $bl_bc } (diff=" . ($bl_bo - $bl_bc) . ")\n";
|
||
// Write to tmp, run node --check
|
||
$tmp = tempnam(sys_get_temp_dir(), 'wave114_') . '.js';
|
||
file_put_contents($tmp, $block);
|
||
$chk = @shell_exec('node --check ' . escapeshellarg($tmp) . ' 2>&1');
|
||
@unlink($tmp);
|
||
$out .= " node --check: " . trim($chk ?: 'OK') . "\n";
|
||
}
|
||
}
|
||
if ($i > 0 && !strpos($out, 'UNBALANCED')) $out .= " ✅ All scripts balanced\n";
|
||
}
|
||
}
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 5: fix/diag wv-send — WV-Send NonReg 500
|
||
// ============================================================
|
||
if (preg_match('/(fix|diag|debug).*wv[\s-]?send/', $ml) || $ml === 'wv-send' || $ml === 'wvsend') {
|
||
$out = "=== Diag WV-Send NonReg fail (S95-WV cat, HTTP 500 0KB) ===\n";
|
||
// Test candidate WEVADS endpoints
|
||
$endpoints = [
|
||
'http://10.1.0.3:5890/brain-send-api.php',
|
||
'http://10.1.0.3:5890/brain-send.php',
|
||
'http://10.1.0.3:5890/brain-unified-send.php',
|
||
'http://10.1.0.3:5821/brain-send-api.php',
|
||
'https://wevads.weval-consulting.com/brain-send-api.php',
|
||
];
|
||
foreach ($endpoints as $ep) {
|
||
$ctx = stream_context_create(['http' => ['timeout' => 5, 'ignore_errors' => true]]);
|
||
$r = @file_get_contents($ep, false, $ctx);
|
||
$code = 'TIMEOUT';
|
||
if (isset($http_response_header) && isset($http_response_header[0])) {
|
||
if (preg_match('/HTTP\/\S+\s+(\d+)/', $http_response_header[0], $mm)) $code = $mm[1];
|
||
}
|
||
$sz = strlen($r ?: '');
|
||
$out .= " $ep → HTTP $code, ${sz}B\n";
|
||
unset($http_response_header);
|
||
}
|
||
// Also check S95 reachability
|
||
$s95 = @fsockopen('10.1.0.3', 5890, $errno, $errstr, 3);
|
||
$out .= "\nS95 port 5890 (Arsenal): " . ($s95 ? 'OPEN' : "CLOSED ($errstr)") . "\n";
|
||
if ($s95) fclose($s95);
|
||
$s95b = @fsockopen('10.1.0.3', 5821, $errno2, $errstr2, 3);
|
||
$out .= "S95 port 5821 (WEVADS-ADX): " . ($s95b ? 'OPEN' : "CLOSED ($errstr2)") . "\n";
|
||
if ($s95b) fclose($s95b);
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 6: l99 visual / selenium — check last run
|
||
// ============================================================
|
||
if (preg_match('/l99\s*(visual|selenium|screenshot)/', $ml)) {
|
||
$results_files = [
|
||
'/var/www/html/api/l99-auth-selenium-results.json',
|
||
'/var/www/html/api/l99-full-results.json',
|
||
'/var/www/html/api/pipeline-result.json',
|
||
];
|
||
$out = "=== L99 Visual runs ===\n";
|
||
foreach ($results_files as $rf) {
|
||
if (file_exists($rf)) {
|
||
$d = @json_decode(file_get_contents($rf), true);
|
||
$out .= "\n" . basename($rf) . " (" . filesize($rf) . "B):\n";
|
||
$out .= " pass=" . ($d['pass'] ?? '?') .
|
||
" fail=" . ($d['fail'] ?? '?') .
|
||
" warn=" . ($d['warn'] ?? '?') .
|
||
" total=" . ($d['total'] ?? '?') . "\n";
|
||
$out .= " ts=" . ($d['ts'] ?? '?') . "\n";
|
||
} else {
|
||
$out .= "\n" . basename($rf) . ": MISSING\n";
|
||
}
|
||
}
|
||
// Screenshots count
|
||
$ss = @glob('/opt/weval-l99/screenshots/*.png') ?: [];
|
||
$out .= "\nScreenshots disk: " . count($ss) . " files\n";
|
||
$videos = @glob('/opt/weval-l99/videos/*.webm') ?: [];
|
||
$out .= "Videos disk: " . count($videos) . " files\n";
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 7: ux lean6sigma — audit DMAIC
|
||
// ============================================================
|
||
if (preg_match('/(ux|lean).*(6\s*sigma|6σ|six\s*sigma)/', $ml) || $ml === 'ux audit' || $ml === 'lean six sigma') {
|
||
$out = "=== UX Lean 6σ DMAIC audit ===\n\n";
|
||
// D — Define
|
||
$pages_protected = 0;
|
||
$pages_public = 0;
|
||
$nginx = @file_get_contents('/etc/nginx/sites-enabled/weval-consulting');
|
||
if ($nginx) {
|
||
$pages_protected = substr_count($nginx, 'auth_request');
|
||
}
|
||
$html_files = @glob('/var/www/html/*.html') ?: [];
|
||
$pages_total = count($html_files);
|
||
$out .= "D-efine:\n";
|
||
$out .= " HTML files: $pages_total\n";
|
||
$out .= " Protected (auth_request): $pages_protected\n";
|
||
|
||
// M — Measure
|
||
$out .= "\nM-easure:\n";
|
||
$nr = @json_decode(@file_get_contents('/var/www/html/api/nonreg-latest.json'), true) ?: [];
|
||
$out .= " NonReg: " . ($nr['pass'] ?? '?') . "/" . ($nr['total'] ?? '?') .
|
||
" (score " . ($nr['score'] ?? '?') . "%)\n";
|
||
$l99 = @json_decode(@file_get_contents('/var/www/html/api/pipeline-result.json'), true) ?: [];
|
||
$out .= " L99 pipeline: " . ($l99['pass'] ?? '?') . "/" . ($l99['total'] ?? '?') . "\n";
|
||
|
||
// A — Analyze
|
||
$out .= "\nA-nalyze:\n";
|
||
$fails = $nr['failures'] ?? [];
|
||
$out .= " " . count($fails) . " NonReg failures\n";
|
||
foreach ($fails as $f) {
|
||
$out .= " ❌ " . ($f['n'] ?? '?') . " (" . ($f['c'] ?? '?') . ") " . ($f['d'] ?? '') . "\n";
|
||
}
|
||
|
||
// I — Improve
|
||
$out .= "\nI-mprove (actions):\n";
|
||
$out .= " → Fix WV-Send S95 500 (cat NonReg)\n";
|
||
$out .= " → Wire 7 dormant agents\n";
|
||
$out .= " → Extend Master 9 intents (en cours)\n";
|
||
|
||
// C — Control
|
||
$out .= "\nC-ontrol:\n";
|
||
$crons = @shell_exec('crontab -l 2>/dev/null | grep -v ^# | wc -l');
|
||
$out .= " Cron actifs (www-data): " . trim($crons ?: '?') . "\n";
|
||
$out .= " Director cycle: 15-30min | NonReg: 6h | L99: auto\n";
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 8: wiki register sync
|
||
// ============================================================
|
||
if (preg_match('/(wiki|register).*(sync|status|update)/', $ml) || $ml === 'wiki status') {
|
||
$out = "=== Wiki + Register ===\n";
|
||
$wiki_md = @glob('/var/www/html/wiki/*.md') ?: [];
|
||
$wiki_html = @glob('/var/www/html/wiki/*.html') ?: [];
|
||
$out .= "Wiki: " . count($wiki_md) . " .md + " . count($wiki_html) . " .html\n";
|
||
if ($wiki_md) {
|
||
$out .= " Last updated: " . date('Y-m-d H:i', filemtime($wiki_md[0])) . "\n";
|
||
}
|
||
$reg_files = [
|
||
'/var/www/html/api/weval-registry.json',
|
||
'/var/www/html/api/source-of-truth.json',
|
||
'/var/www/html/api/architecture-topology.json',
|
||
];
|
||
foreach ($reg_files as $rf) {
|
||
if (file_exists($rf)) {
|
||
$d = @json_decode(file_get_contents($rf), true);
|
||
$ver = is_array($d) ? ($d['version'] ?? $d['generated'] ?? '?') : '?';
|
||
$out .= " " . basename($rf) . " (" . filesize($rf) . "B) version=$ver\n";
|
||
}
|
||
}
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 9: wire-dormant <name>
|
||
// ============================================================
|
||
if (preg_match('/wire[\s-]?dormant\s+(\S+)/', $ml, $match)) {
|
||
$target = $match[1];
|
||
$safe = preg_replace('/[^a-z0-9_-]/i', '', $target);
|
||
$candidates = @glob("/var/www/html/api/*{$safe}*.php") ?: [];
|
||
$out = "Wire dormant '$safe':\n";
|
||
if (empty($candidates)) {
|
||
$out .= " ❌ No candidate matching '$safe' in /api/\n";
|
||
// Also try lowercase
|
||
$all = @glob('/var/www/html/api/*.php') ?: [];
|
||
$matches_low = array_filter($all, fn($f) => stripos(basename($f), $safe) !== false);
|
||
if ($matches_low) {
|
||
$out .= " Suggestions (partial match):\n";
|
||
foreach (array_slice(array_values($matches_low), 0, 5) as $f) {
|
||
$out .= " " . basename($f) . "\n";
|
||
}
|
||
}
|
||
} else {
|
||
foreach ($candidates as $c) {
|
||
$out .= " ✅ " . basename($c) . " (" . filesize($c) . "B, " .
|
||
date('Y-m-d', filemtime($c)) . ")\n";
|
||
}
|
||
$out .= "\n → Validation humaine requise avant wiring actif Master\n";
|
||
}
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// PATCH V2 — 4 intents supplémentaires (Opus wire Master lacunes)
|
||
// À injecter AVANT le "// Default: help" dans wave114-intents.php
|
||
// ============================================================
|
||
|
||
// ============================================================
|
||
// Intent 10: reconcile-waves / reconcilie travaux — scan git+tests+live
|
||
// ============================================================
|
||
if (preg_match('/reconci(le|lie)|reconcile\s*waves?|waves?\s*status/', $ml)) {
|
||
$out = "=== RÉCONCILIATION TRAVAUX MULTI-CLAUDE/WEVIA ===\n\n";
|
||
|
||
// 1. Git state (/var/www/html)
|
||
$g_html = @shell_exec('cd /var/www/html && git log --oneline -10 2>&1');
|
||
$out .= "─ GIT /var/www/html (last 10):\n" . trim($g_html ?: '(no git)') . "\n\n";
|
||
$g_status = @shell_exec('cd /var/www/html && git status --short 2>&1');
|
||
$out .= "─ GIT status uncommitted:\n" . trim($g_status ?: '(clean)') . "\n\n";
|
||
|
||
// 2. Brain git
|
||
if (is_dir('/opt/weval-brain')) {
|
||
$g_brain = @shell_exec('cd /opt/weval-brain && git log --oneline -5 2>&1');
|
||
$out .= "─ GIT /opt/weval-brain (last 5):\n" . trim($g_brain ?: '(no git)') . "\n\n";
|
||
}
|
||
|
||
// 3. Scores live
|
||
$nr = @json_decode(@file_get_contents('/var/www/html/api/nonreg-latest.json'), true) ?: [];
|
||
$out .= "─ SCORES:\n";
|
||
$out .= " NonReg: " . ($nr['pass'] ?? '?') . "/" . ($nr['total'] ?? '?') . " (" . ($nr['score'] ?? '?') . "%)\n";
|
||
$pl = @json_decode(@file_get_contents('/var/www/html/api/pipeline-result.json'), true) ?: [];
|
||
if ($pl) {
|
||
$out .= " L99 pipeline: " . ($pl['pass'] ?? '?') . "/" . ($pl['total'] ?? '?') . "\n";
|
||
}
|
||
$sel = @json_decode(@file_get_contents('/var/www/html/api/l99-auth-selenium-results.json'), true) ?: [];
|
||
if ($sel) {
|
||
$out .= " L99 Selenium: " . ($sel['pass'] ?? '?') . "/" . ($sel['total'] ?? '?') . "\n";
|
||
}
|
||
|
||
// 4. Docker / system
|
||
$dock = @shell_exec("docker ps --format '{{.Names}}' 2>/dev/null | wc -l");
|
||
$disk = @shell_exec("df / | tail -1 | awk '{print \$5}'");
|
||
$ram = @shell_exec("free -h | grep Mem | awk '{print \$3 \"/\" \$2}'");
|
||
$out .= "\n─ SYSTEM LIVE:\n";
|
||
$out .= " Docker: " . trim($dock ?: '?') . " containers\n";
|
||
$out .= " Disk: " . trim($disk ?: '?') . "\n";
|
||
$out .= " RAM: " . trim($ram ?: '?') . "\n";
|
||
|
||
// 5. Director last cycle
|
||
$dir_cache = '/var/www/html/api/director-status.json';
|
||
if (file_exists($dir_cache)) {
|
||
$dir = @json_decode(file_get_contents($dir_cache), true) ?: [];
|
||
$hist = $dir['history'] ?? [];
|
||
$last = end($hist) ?: [];
|
||
$out .= "\n─ DIRECTOR last cycle:\n";
|
||
$out .= " " . ($last['report'] ?? '(no report)') . "\n";
|
||
}
|
||
|
||
// 6. Current file state of wave114-intents itself
|
||
$self = '/var/www/html/api/wevia-wave114-intents.php';
|
||
if (file_exists($self)) {
|
||
$out .= "\n─ Wave 114 extension: " . filesize($self) . "B, " .
|
||
date('Y-m-d H:i', filemtime($self)) . "\n";
|
||
}
|
||
|
||
// 7. Master capabilities count
|
||
$ff = @file_get_contents('/var/www/html/api/wevia-full-exec.php');
|
||
if ($ff) {
|
||
$intents_count = substr_count($ff, 'preg_match') + substr_count($ff, "strpos(\$m");
|
||
$out .= "─ Master full-exec intents estimés: $intents_count\n";
|
||
}
|
||
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 11: git-commit-push — vrai push git (pas juste status)
|
||
// ============================================================
|
||
if (preg_match('/git\s*(commit|push\s*real|full|commit.*push)/', $ml) ||
|
||
$ml === 'commit push' || $ml === 'git commit push') {
|
||
$out = "=== GIT COMMIT + PUSH ===\n\n";
|
||
|
||
$repos = [
|
||
'/var/www/html' => 'weval-html',
|
||
'/opt/weval-brain' => 'weval-brain',
|
||
];
|
||
|
||
foreach ($repos as $path => $label) {
|
||
if (!is_dir("$path/.git")) {
|
||
$out .= "─ $label ($path): no git\n\n";
|
||
continue;
|
||
}
|
||
$out .= "─ $label ($path):\n";
|
||
|
||
// Status
|
||
$status = @shell_exec("cd " . escapeshellarg($path) . " && git status --short 2>&1");
|
||
$status = trim($status ?: '');
|
||
if ($status === '') {
|
||
$out .= " ✅ clean\n\n";
|
||
continue;
|
||
}
|
||
$out .= " uncommitted:\n";
|
||
foreach (explode("\n", $status) as $line) {
|
||
$out .= " $line\n";
|
||
}
|
||
|
||
// git add
|
||
$add = @shell_exec("cd " . escapeshellarg($path) . " && sudo git add -A 2>&1");
|
||
$out .= " git add: " . (trim($add) ?: 'OK') . "\n";
|
||
|
||
// git commit
|
||
$msg = 'Wave 114 Opus wire: wave114-intents.php (9 intents) - ' . date('Y-m-d H:i');
|
||
$commit = @shell_exec("cd " . escapeshellarg($path) .
|
||
" && sudo git -c user.email=opus@weval.ai -c user.name=Opus commit -m " .
|
||
escapeshellarg($msg) . " 2>&1");
|
||
$out .= " git commit: " . trim($commit ?: '(no output)') . "\n";
|
||
|
||
// git push (try both remotes)
|
||
$remotes = @shell_exec("cd " . escapeshellarg($path) . " && git remote 2>&1");
|
||
foreach (explode("\n", trim($remotes ?: '')) as $remote) {
|
||
$remote = trim($remote);
|
||
if (!$remote) continue;
|
||
$push = @shell_exec("cd " . escapeshellarg($path) .
|
||
" && sudo git push $remote 2>&1");
|
||
$out .= " git push $remote: " . trim($push ?: '(no output)') . "\n";
|
||
}
|
||
$out .= "\n";
|
||
}
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 12: detail-nonwired — vrai détail via scan endpoints + fichiers
|
||
// ============================================================
|
||
if (preg_match('/detail\s*(non|not)\s*wired|7\s*(free|non|dormant)|cascade\s*free/', $ml)) {
|
||
$out = "=== Détail 7 cascade FREE + 32 wired ===\n\n";
|
||
|
||
// Scan des agents depuis weval-wiring.html rendu
|
||
$wire_html = @file_get_contents('/var/www/html/weval-wiring.html') ?: '';
|
||
|
||
// Chercher une liste inline d'agents dans le HTML ou JS
|
||
preg_match_all('/name:\s*["\x27]([^"\x27]+)["\x27]/', $wire_html, $names);
|
||
if (!empty($names[1])) {
|
||
$out .= "Agents trouvés dans weval-wiring.html: " . count($names[1]) . "\n";
|
||
$out .= " " . implode(", ", array_slice($names[1], 0, 40)) . "\n\n";
|
||
}
|
||
|
||
// Scan endpoints pour identifier ceux qui répondent (= wired live)
|
||
$agents = [
|
||
'WEVIA Master' => 'http://127.0.0.1/api/wevia-master-api.php',
|
||
'Director' => 'http://127.0.0.1/api/wevia-director.php?health',
|
||
'L99 Brain' => 'http://127.0.0.1/api/l99-chat.php',
|
||
'WEDROID' => 'http://127.0.0.1/api/wedroid-brain-api.php',
|
||
'Chatbot' => 'http://127.0.0.1/api/weval-chatbot-api.php',
|
||
'Autonomous' => 'http://127.0.0.1/api/wevia-autonomous.php',
|
||
'Full-Exec' => 'http://127.0.0.1/api/wevia-full-exec.php',
|
||
'Wave114' => 'http://127.0.0.1/api/wevia-wave114-intents.php',
|
||
'Consensus' => 'http://127.0.0.1/api/wevia-consensus.php',
|
||
'Paperclip' => 'http://127.0.0.1:3201/',
|
||
'DeerFlow' => 'http://127.0.0.1:2024/',
|
||
'Langfuse' => 'http://127.0.0.1:3100/',
|
||
'MiroFish' => 'http://127.0.0.1:5001/',
|
||
'Blade' => 'http://127.0.0.1/api/blade-agent.php',
|
||
'Nuclei' => 'http://127.0.0.1/api/nuclei.php',
|
||
];
|
||
|
||
$alive = []; $dead = [];
|
||
foreach ($agents as $name => $url) {
|
||
$ctx = stream_context_create(['http' => ['timeout' => 3, 'ignore_errors' => true,
|
||
'header' => 'Host: weval-consulting.com']]);
|
||
$r = @file_get_contents($url, false, $ctx);
|
||
$code = 'TIMEOUT';
|
||
if (isset($http_response_header) && isset($http_response_header[0])) {
|
||
if (preg_match('/HTTP\/\S+\s+(\d+)/', $http_response_header[0], $mm)) $code = $mm[1];
|
||
}
|
||
if (in_array($code, ['200', '302', '401'])) {
|
||
$alive[] = " ✅ $name → HTTP $code";
|
||
} else {
|
||
$dead[] = " ❌ $name → $code";
|
||
}
|
||
unset($http_response_header);
|
||
}
|
||
|
||
$out .= "WIRED LIVE (" . count($alive) . "):\n" . implode("\n", $alive) . "\n\n";
|
||
$out .= "NOT REACHABLE (" . count($dead) . "):\n" . implode("\n", $dead) . "\n\n";
|
||
|
||
// Scan les dormants sur disque
|
||
$dormant_patterns = ['consensus-', 'nexus-', 'sentinel-', 'visual-brain', 'turbo', 'unlimited'];
|
||
$api_files = @glob('/var/www/html/api/*.php') ?: [];
|
||
$dormant = [];
|
||
foreach ($api_files as $f) {
|
||
$bn = basename($f);
|
||
foreach ($dormant_patterns as $p) {
|
||
if (stripos($bn, $p) !== false) {
|
||
$dormant[] = " 💤 $bn (" . filesize($f) . "B)";
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if ($dormant) {
|
||
$out .= "DORMANT FILES (" . count($dormant) . "):\n" .
|
||
implode("\n", array_slice($dormant, 0, 20)) . "\n";
|
||
}
|
||
resp($out);
|
||
}
|
||
|
||
// ============================================================
|
||
// Intent 13: fonctionnel-fails — détail 4 tests fonctionnels qui tombent
|
||
// ============================================================
|
||
if (preg_match('/(fonctionnel|functional)\s*(fails?|detail|erreurs?)/', $ml) ||
|
||
$ml === 'fonctionnel fails' || $ml === 'test fonctionnel detail') {
|
||
$out = "=== Test fonctionnel details ===\n\n";
|
||
|
||
// Chercher le résultat du test fonctionnel
|
||
$candidates = [
|
||
'/var/www/html/api/functional-test-results.json',
|
||
'/var/www/html/api/functional-latest.json',
|
||
'/var/www/html/api/fonctionnel-results.json',
|
||
'/opt/weval-l99/functional-results.json',
|
||
];
|
||
foreach ($candidates as $c) {
|
||
if (file_exists($c)) {
|
||
$out .= "Found: $c\n";
|
||
$d = @json_decode(file_get_contents($c), true) ?: [];
|
||
$out .= json_encode($d, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||
resp($out);
|
||
}
|
||
}
|
||
|
||
// Fallback: parse wevia-full-exec.php pour trouver le test fonctionnel
|
||
$ff = @file_get_contents('/var/www/html/api/wevia-full-exec.php') ?: '';
|
||
if (preg_match('/test[_ -]?fonctionnel.*?(\d+)\s*\/\s*(\d+)/s', $ff, $mm)) {
|
||
$out .= "Pattern trouvé dans full-exec: $mm[1]/$mm[2]\n";
|
||
}
|
||
|
||
// Check log
|
||
$log = @file_get_contents('/var/log/weval/functional-test.log') ?: '';
|
||
if ($log) {
|
||
$out .= "Last lines of log:\n";
|
||
$lines = array_slice(explode("\n", $log), -30);
|
||
$out .= implode("\n", $lines) . "\n";
|
||
} else {
|
||
$out .= "No functional test log found.\n";
|
||
$out .= "Les 4 fails ne sont pas exposés en JSON par le test actuel.\n";
|
||
$out .= "→ Besoin d'instrumenter le test fonctionnel pour dumper les fails.\n";
|
||
}
|
||
resp($out);
|
||
|
||
// ================================================
|
||
|
||
// === ARENA INTENTS (auto-test + discover + evolve) ===
|
||
|
||
// ================================================
|
||
|
||
// === WEVADS PIPELINE (20 intents) ===
|
||
if (preg_match("/brain.*(send|config|central)/i", $m)) return ["intent"=>"brain_send","response"=>"Brain Send: ".shell_exec("curl -sk http://10.1.0.3:5890/api/sentinel-brain.php?action=status 2>/dev/null | head -c 200")];
|
||
if (preg_match("/warmup|warm.up|seed.clean/i", $m)) return ["intent"=>"warmup_manager","response"=>"WARMUP: Géré via Arsenal → http://10.1.0.3:5890/seed-manager.html"];
|
||
if (preg_match("/domain.*(rotat|pool|dns)/i", $m)) return ["intent"=>"domain_rotation","response"=>"DOMAINS: Arsenal → http://10.1.0.3:5890/provider-rotation.html"];
|
||
if (preg_match("/smtp|pmta|kumo|postfix/i", $m)) return ["intent"=>"smtp_config","response"=>"MTA: PMTA(:25+587) KumoMTA(:8010) Postfix(:2525) — ALL UP. Config via Arsenal brain-central."];
|
||
if (preg_match("/iresponse|tag.*glossary/i", $m)) return ["intent"=>"iresponse_tag","response"=>"iResponse: Tags gérés via brain-send. Glossary dans /opt/wevads/hamid-files/IRESPONSE-TAG-GLOSSARY.md"];
|
||
if (preg_match("/sacred|winner|sacred.winner/i", $m)) return ["intent"=>"sacred_winner","response"=>"SACRED: 9 winners configurés. Dashboard → http://10.1.0.3:5890/brain-performance.html"];
|
||
if (preg_match("/conversion|track.*conv|pixel/i", $m)) return ["intent"=>"conversion_track","response"=>"Conversion: PULL model (jamais postback). Track via S151 culturellemejean.charity"];
|
||
if (preg_match("/offer|offre|landing/i", $m)) return ["intent"=>"offer_manage","response"=>"Offers: Arsenal → http://10.1.0.3:5890/ads-commander.html"];
|
||
if (preg_match("/template.*(edit|creat|manag)/i", $m)) return ["intent"=>"template_editor","response"=>"Templates: Arsenal → http://10.1.0.3:5890/creative-factory.html"];
|
||
if (preg_match("/deliver|inbox|placement/i", $m)) return ["intent"=>"deliverability","response"=>"Deliverability: Check via http://10.1.0.3:5890/blacklist-monitor.html + adherence-monitor.html"];
|
||
if (preg_match("/blacklist|delist|spamhaus/i", $m)) return ["intent"=>"blacklist_check","response"=>"Blacklist: Monitor → http://10.1.0.3:5890/blacklist-monitor.html"];
|
||
if (preg_match("/send.*window|predict.*send/i", $m)) return ["intent"=>"send_window","response"=>"Send Window: Predictive → http://10.1.0.3:5890/predictive-send-window.html"];
|
||
if (preg_match("/campaign.*(creat|launch|new)/i", $m)) return ["intent"=>"campaign_create","response"=>"Campaign: Créer via brain-unified-send → http://10.1.0.3:5890/brain-unified-send.html"];
|
||
if (preg_match("/campaign.*(pause|stop|kill)/i", $m)) return ["intent"=>"campaign_pause","response"=>"Campaign pause: iResponse mta_processes pause. JAMAIS tuer les MTAs."];
|
||
if (preg_match("/volume|throttle|rate.*send/i", $m)) return ["intent"=>"volume_control","response"=>"Volume: Géré par brain-send configs. 646 configs actives."];
|
||
if (preg_match("/bounce|complaint|fbl/i", $m)) return ["intent"=>"bounce_handler","response"=>"Bounces/Complaints: Monitor → http://10.1.0.3:5890/beast-monitor.html"];
|
||
if (preg_match("/graph.*send|ews.*send|office.*send/i", $m)) return ["intent"=>"graph_sender","response"=>"Graph/EWS: → http://10.1.0.3:5890/graph-ews-sender.html"];
|
||
if (preg_match("/proxy.*(rotat|manag)/i", $m)) return ["intent"=>"proxy_rotation","response"=>"Proxy: Rotation → http://10.1.0.3:5890/provider-rotation.html"];
|
||
if (preg_match("/dark.*scout|intelligence/i", $m)) return ["intent"=>"dark_scout","response"=>"Dark Scout: → http://10.1.0.3:5890/dark-scout.html"];
|
||
if (preg_match("/scrap.*(factory|web|data)/i", $m)) return ["intent"=>"scraping_factory","response"=>"Scraping: → http://10.1.0.3:5890/scrapping-factory-enhanced.html"];
|
||
|
||
// === ETHICA B2B (14 intents) ===
|
||
if (preg_match("/ethica.*(scrap|crawl|collect)/i", $m)) return ["intent"=>"ethica_scraper","response"=>"Ethica Scraper: 131K+ HCPs collectés. Pipeline → ethica-pipeline.html"];
|
||
if (preg_match("/ethica.*(enrich|complet|valid)/i", $m)) return ["intent"=>"ethica_enricher","response"=>"Ethica Enricher: Email validation + enrichment. 126K validated."];
|
||
if (preg_match("/ethica.*sms|sms.*hcp/i", $m)) return ["intent"=>"ethica_sms","response"=>"Ethica SMS: → ethica-sms.html. Consent requis via consent.wevup.app"];
|
||
if (preg_match("/ethica.*consent|consent.*hcp|rgpd.*ethica/i", $m)) return ["intent"=>"ethica_consent","response"=>"Ethica Consent: consent.wevup.app (S151). JAMAIS S95."];
|
||
if (preg_match("/ethica.*drill|drill.*down/i", $m)) return ["intent"=>"ethica_drill","response"=>"Ethica Drill: → ethica-drill.html. 14 spécialités, gap analysis."];
|
||
if (preg_match("/hcp.*(match|find|search)/i", $m)) return ["intent"=>"hcp_match","response"=>"HCP Match: 131K+ HCPs. Search by specialty/city/email."];
|
||
if (preg_match("/hcp.*(export|download|csv)/i", $m)) return ["intent"=>"hcp_export","response"=>"HCP Export: Via ethica-hcp-manager.html. CSV/Excel export."];
|
||
if (preg_match("/special.*gap|coverage.*gap/i", $m)) return ["intent"=>"specialty_gap","response"=>"Specialty Gap: 14 spécialités. Low email reach on some."];
|
||
if (preg_match("/email.*reach|reach.*rate/i", $m)) return ["intent"=>"email_reach","response"=>"Email Reach: Global 73%. Gap on some specialties."];
|
||
if (preg_match("/pharma.*(campaign|outreach)/i", $m)) return ["intent"=>"pharma_campaign","response"=>"Pharma Campaign: MedReach → medreach-dashboard.html"];
|
||
if (preg_match("/medreach|med.*reach/i", $m)) return ["intent"=>"medreach_send","response"=>"MedReach: → medreach-campaign.html + medreach-dashboard.html"];
|
||
if (preg_match("/contact.*(valid|verif)/i", $m)) return ["intent"=>"contact_validate","response"=>"Contact Validation: ZeroBounce + Neverbounce integrated."];
|
||
if (preg_match("/territory|zone.*geo/i", $m)) return ["intent"=>"territory_map","response"=>"Territory: Mapping par ville/région. 131K HCPs géolocalisés."];
|
||
if (preg_match("/compliance|conform|rgpd/i", $m)) return ["intent"=>"compliance_check","response"=>"Compliance: RGPD via consent.wevup.app. Ethica B2B only."];
|
||
|
||
// === BUSINESS (25 intents) ===
|
||
if (preg_match("/vistex|lead.*protect/i", $m)) return ["intent"=>"vistex_leads","response"=>"VISTEX: Lead protection addendum pending. Cosumar + Carrefour at risk."];
|
||
if (preg_match("/huawei.*(bill|factur|disput)/i", $m)) return ["intent"=>"huawei_billing","response"=>"HUAWEI: Billing dispute en cours. Cloud partnership."];
|
||
if (preg_match("/arrow|partner.*tech/i", $m)) return ["intent"=>"arrow_partnership","response"=>"Arrow: Partnership tech. Contact via Confluent Digital."];
|
||
if (preg_match("/pricing|tarif|devis/i", $m)) return ["intent"=>"pricing_strategy","response"=>"Pricing: Consulter pricing.html. Sovereign-first strategy."];
|
||
if (preg_match("/contrat|contract|nda|sow/i", $m)) return ["intent"=>"contract_draft","response"=>"Contrats: Draft via WEVIA → skill-code. NDA/SOW templates."];
|
||
if (preg_match("/email.*(compos|draft|redige)/i", $m)) return ["intent"=>"email_compose","response"=>"Email: Compose via Arena mode Expert ou Creative."];
|
||
if (preg_match("/propos(al|ition)|offre.*commerc/i", $m)) return ["intent"=>"proposal_gen","response"=>"Proposal: Générer via skill-pptx ou skill-pdf."];
|
||
if (preg_match("/facture|invoice/i", $m)) return ["intent"=>"invoice_track","response"=>"Factures: Tracking via CRM → crm.html"];
|
||
if (preg_match("/crm.*(update|sync|add)/i", $m)) return ["intent"=>"crm_update","response"=>"CRM: Twenty CRM → crm.html. Port 3900."];
|
||
if (preg_match("/lead.*(score|qualif)/i", $m)) return ["intent"=>"lead_score","response"=>"Lead Scoring: Via Ethica pipeline + CRM."];
|
||
if (preg_match("/pipeline.*(forecast|prev)/i", $m)) return ["intent"=>"pipeline_forecast","response"=>"Pipeline Forecast: Business dashboard → enterprise-management.html"];
|
||
if (preg_match("/competitor|concurrent|veille/i", $m)) return ["intent"=>"competitor_analysis","response"=>"Competitors: Via DeerFlow deep research + SearXNG."];
|
||
if (preg_match("/market.*(research|etude)/i", $m)) return ["intent"=>"market_research","response"=>"Market Research: DeerFlow + Arena mode Think+Search."];
|
||
if (preg_match("/onboard|accueil.*client/i", $m)) return ["intent"=>"client_onboard","response"=>"Client Onboarding: Process via Paperclip project management."];
|
||
if (preg_match("/rfp|appel.*offre/i", $m)) return ["intent"=>"rfp_response","response"=>"RFP: Générer réponse via skill-pdf + Expert mode."];
|
||
|
||
// === SITE WEB (11 intents) ===
|
||
if (preg_match("/blog.*(creat|post|article)/i", $m)) return ["intent"=>"blog_create","response"=>"Blog: Créer via Arena Creative mode + skill-pdf."];
|
||
if (preg_match("/seo.*(optim|audit|check)/i", $m)) return ["intent"=>"seo_optimize","response"=>"SEO: Audit via web scan + Plausible analytics."];
|
||
if (preg_match("/product.*page|page.*produit/i", $m)) return ["intent"=>"product_page","response"=>"Products: Pages sur weval-consulting.com. Never expose KB."];
|
||
if (preg_match("/faq.*(update|add|modif)/i", $m)) return ["intent"=>"faq_update","response"=>"FAQ: Via weval-faq-fix.js (SACRÉ, chattr+i). Corrections only."];
|
||
if (preg_match("/translat|tradui/i", $m)) return ["intent"=>"translate","response"=>"Translate: weval-translate.js (90KB SACRÉ JAMAIS MODIFIER)."];
|
||
if (preg_match("/sitemap|plan.*site/i", $m)) return ["intent"=>"sitemap","response"=>"Sitemap: Retiré (sécurité). SSR/sitemap OFF."];
|
||
if (preg_match("/analytics|plausible|visit/i", $m)) return ["intent"=>"analytics","response"=>"Analytics: Plausible → :8787. plausible.weval-consulting.com"];
|
||
if (preg_match("/newsletter|mailing.*list/i", $m)) return ["intent"=>"newsletter","response"=>"Newsletter: Via WEVADS brain-send + Ethica contacts."];
|
||
|
||
|
||
}
|
||
|
||
// ============================================================
|
||
// Default: help / list intents
|
||
// ============================================================
|
||
resp(
|
||
"=== WEVIA Wave 114 Intents — Opus superviseur ===\n\n" .
|
||
"Intents disponibles:\n" .
|
||
" 1. nonreg fails → détail des failures NonReg\n" .
|
||
" 2. liste non wired → 7 agents cascade FREE + dormant files\n" .
|
||
" 3. wave 114 full → méga-batch (9 commandes Master)\n" .
|
||
" 4. code-analyze <file> → brace balance + lint JS/PHP/HTML\n" .
|
||
" 5. fix wv-send → diag WEVADS S95 NonReg 500\n" .
|
||
" 6. l99 visual → Selenium screenshots + videos\n" .
|
||
" 7. ux lean6sigma → audit DMAIC complet\n" .
|
||
" 8. wiki register sync → statut docs + versions\n" .
|
||
" 9. wire-dormant <name> → find + suggest wiring dormant file\n" .
|
||
"\nUsage: /api/wevia-wave114-intents.php?m=<intent>\n"
|
||
);
|