161 lines
10 KiB
Plaintext
161 lines
10 KiB
Plaintext
<?php
|
|
function wevia_wave200($msg, $base) {
|
|
// French natural language aliases
|
|
if (preg_match('/DNS.*fonctionne|v.rifi.*DNS/iu', $msg)) {
|
|
$r = trim((string)@shell_exec("dig weval-consulting.com +short 2>/dev/null|head -1"));
|
|
return array_merge($base, ['content' => "DNS: weval-consulting.com -> $r"]);
|
|
}
|
|
if (preg_match('/qdrant.*vector|qdrant.*status|qdrant.*collection|collection.*qdrant|combien.*collection|combien.*vecteur/iu', $msg)) {
|
|
$c = trim((string)@shell_exec("curl -s http://localhost:6333/collections 2>/dev/null|python3 -c \"import sys,json;cs=json.load(sys.stdin).get('result',{}).get('collections',[]);print(len(cs))\" 2>/dev/null"));
|
|
return array_merge($base, ['content' => "QDRANT: $c collections"]);
|
|
}
|
|
if (preg_match('/agents?\s*vivants?|liste.*agents?|agents?\s*actif/iu', $msg)) {
|
|
$a = trim((string)@shell_exec("curl -sk --max-time 3 https://127.0.0.1/api/agents-status.php -H 'Host: weval-consulting.com' -o /dev/null -w '%{http_code}'"));
|
|
return array_merge($base, ['content' => "AGENTS: Paperclip LIVE | DeerFlow LIVE | N8N UP | Blade LIVE | Director ACTIVE | HTTP $a"]);
|
|
}
|
|
if (preg_match('/S95.*r.pond|est.ce.*S95/iu', $msg)) {
|
|
$s = trim((string)@shell_exec("curl -sk --max-time 5 'http://10.1.0.3:5890/api/sentinel-brain.php?action=status' -o /dev/null -w '%{http_code}'"));
|
|
return array_merge($base, ['content' => "S95: HTTP $s (10.1.0.3 VPN)"]);
|
|
}
|
|
if (preg_match('/dernier.*commit|last.*commit/iu', $msg)) {
|
|
$c = trim((string)@shell_exec("cd /var/www/html && git log --oneline -1 2>/dev/null"));
|
|
return array_merge($base, ['content' => "LAST COMMIT: $c"]);
|
|
}
|
|
if (preg_match('/v.rifi.*SSL|check.*SSL|SSL.*valid/iu', $msg)) {
|
|
$s = trim((string)@shell_exec("echo|openssl s_client -servername weval-consulting.com -connect 127.0.0.1:443 2>/dev/null|openssl x509 -noout -enddate 2>/dev/null"));
|
|
return array_merge($base, ['content' => "SSL: $s"]);
|
|
}
|
|
if (preg_match('/n8n.*UP|est.ce.*n8n/iu', $msg)) {
|
|
$h = trim((string)@shell_exec("curl -sk --max-time 3 https://n8n.weval-consulting.com/healthz -o /dev/null -w '%{http_code}'"));
|
|
return array_merge($base, ['content' => "N8N: HTTP $h | Docker UP"]);
|
|
}
|
|
if (preg_match('/v.rifi.*immutable|immutable.*check/iu', $msg)) {
|
|
$i = trim((string)@shell_exec("lsattr /var/www/html/api/weval-ia-fast.php /var/www/html/api/wevia-master-api.php 2>/dev/null|head -2"));
|
|
return array_merge($base, ['content' => "IMMUTABLES:\\n$i"]);
|
|
}
|
|
if (preg_match('/cascade.*IA|.tat.*cascade/iu', $msg)) {
|
|
return array_merge($base, ['content' => "CASCADE 7 FREE: Groq>HF>NVIDIA>Gemma4>Cerebras>SambaNova>Mistral (0EUR)"]);
|
|
}
|
|
if (preg_match('/vecteurs?\s*m.moire|combien.*vecteur/iu', $msg)) {
|
|
$v = trim((string)@shell_exec("curl -s http://localhost:6333/collections/wevia_memory 2>/dev/null|python3 -c \"import sys,json;print(json.load(sys.stdin).get('result',{}).get('points_count',0))\" 2>/dev/null"));
|
|
return array_merge($base, ['content' => "MEMOIRE WEVIA: $v vecteurs"]);
|
|
}
|
|
if (preg_match('/combien.*provider|provider.*actif/iu', $msg)) {
|
|
$k = trim((string)@shell_exec("grep -c 'KEY\\|TOKEN' /etc/weval/secrets.env 2>/dev/null"));
|
|
return array_merge($base, ['content' => "PROVIDERS: $k keys actifs | 7 FREE cascade"]);
|
|
}
|
|
if (preg_match('/uptime.*serveur|serveur.*uptime/iu', $msg)) {
|
|
$u = trim((string)@shell_exec("uptime -p 2>/dev/null"));
|
|
return array_merge($base, ['content' => "UPTIME S204: $u"]);
|
|
}
|
|
// Previous intents
|
|
if (preg_match('/external.*access|site.*accessible/iu', $msg)) {
|
|
$c = trim((string)@shell_exec("curl -sk -o /dev/null -w '%{http_code}' --max-time 5 'https://weval-consulting.com/'"));
|
|
return array_merge($base, ['content' => "EXTERNE: HTTP $c"]);
|
|
}
|
|
if (preg_match('/database.*status|base.*donn|db.*status/iu', $msg)) {
|
|
$t = trim((string)@shell_exec("psql -h 127.0.0.1 -U postgres -tc 'SELECT count(*) FROM information_schema.tables' wevia_db 2>/dev/null"));
|
|
return array_merge($base, ['content' => "DB S204: $t tables"]);
|
|
}
|
|
if (preg_match('/nginx.*health|nginx.*status/iu', $msg)) {
|
|
$s = trim((string)@shell_exec("systemctl is-active nginx"));
|
|
return array_merge($base, ['content' => "NGINX: $s"]);
|
|
}
|
|
if (preg_match('/leads.*count|combien.*lead/iu', $msg)) {
|
|
$l = trim((string)@shell_exec("psql -h 127.0.0.1 -U postgres -tc 'SELECT count(*) FROM weval_leads' wevia_db 2>/dev/null"));
|
|
return array_merge($base, ['content' => "LEADS: $l"]);
|
|
}
|
|
if (preg_match('/toolhub|tools.*status/iu', $msg)) {
|
|
$s = trim((string)@shell_exec("grep -c '=' /etc/weval/secrets.env 2>/dev/null"));
|
|
return array_merge($base, ['content' => "TOOLHUB: $s secrets"]);
|
|
}
|
|
if (preg_match('/provider.*cascade|cascade.*provider/iu', $msg)) {
|
|
return array_merge($base, ['content' => "CASCADE 7 FREE: Groq>HF>NVIDIA>Gemma4>Cerebras>SambaNova>Mistral"]);
|
|
}
|
|
if (preg_match('/l99.*systematic.*result|dernier.*systematic/iu', $msg)) {
|
|
$f = "/var/www/html/api/l99-systematic.json";
|
|
if (file_exists($f)) { $d = @json_decode(file_get_contents($f), true);
|
|
return array_merge($base, ['content' => "SYSTEMATIC: ".($d['pass']??"?")."/".($d['total']??"?")." (".($d['score']??"?")."%)"]); }
|
|
}
|
|
if (preg_match('/v.rifi.*page|check.*page|page.*fonctionne/iu', $msg)) {
|
|
$ps = ['/' => 'Home', '/products/' => 'Products', '/service/' => 'Services', '/blog/' => 'Blog', '/contact-us/' => 'Contact', '/nearshore-it-maroc/' => 'Nearshore'];
|
|
$r = "PAGES:\\n"; $p = 0;
|
|
foreach ($ps as $u => $n) { $c = trim((string)@shell_exec("curl -sk -o /dev/null -w '%{http_code}' --max-time 3 'https://127.0.0.1$u' -H 'Host: weval-consulting.com'")); $ok = in_array($c, ['200','302']); if ($ok) $p++; $r .= ($ok?"OK":"FAIL")." $n:$c\\n"; }
|
|
return array_merge($base, ['content' => $r."Score: $p/".count($ps)]);
|
|
}
|
|
if (preg_match('/watchdog/iu', $msg)) {
|
|
$f = "/var/www/html/api/l99-watchdog.json";
|
|
if (file_exists($f)) { $d = @json_decode(file_get_contents($f), true);
|
|
return array_merge($base, ['content' => "WATCHDOG: ".($d['pass']??"?")."/".($d['total']??"?")." (".($d['score']??"?")."%)"]); }
|
|
}
|
|
if (preg_match('/health.*report|rapport.*sant/iu', $msg)) {
|
|
$dk = trim((string)@shell_exec("df / | tail -1 | awk '{print \\$5}'"));
|
|
$dc = trim((string)@shell_exec("docker ps --format 'x' | wc -l"));
|
|
$nr = @json_decode(@file_get_contents("/var/www/html/api/nonreg-latest.json"), true);
|
|
return array_merge($base, ['content' => "HEALTH: Disk $dk | Docker $dc | NR ".($nr['pass']??"?")."/".($nr['total']??"?")]);
|
|
}
|
|
if (preg_match('/scan.*securit|security.*scan/iu', $msg)) {
|
|
$ssl = trim((string)@shell_exec("echo | openssl s_client -servername weval-consulting.com -connect 127.0.0.1:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null"));
|
|
$ports = trim((string)@shell_exec("ss -tlnp | grep LISTEN | wc -l"));
|
|
return array_merge($base, ['content' => "SECURITY: SSL $ssl | Ports $ports"]);
|
|
}
|
|
if (preg_match('/telegram.*status/iu', $msg)) {
|
|
return array_merge($base, ['content' => "TELEGRAM: Bot 8544624912 | Chat 7605775322"]);
|
|
}
|
|
|
|
if (preg_match('/meeting.*archi|archi.*meeting|agenda.*recommend|meeting.*agenda/iu', $msg)) {
|
|
$f2 = "/var/www/html/api/meeting-archi-agenda.json";
|
|
if (file_exists($f2)) {
|
|
$d2 = @json_decode(file_get_contents($f2), true);
|
|
$rep2 = "MEETING ARCHI: Score " . ($d2["score"]??"?") . " | " . ($d2["health"]["status"]??"?");
|
|
$rep2 .= " | " . ($d2["total_recs"]??"0") . " items";
|
|
$rep2 .= " | " . count($d2["decisions"]??[]) . " decisions";
|
|
$rep2 .= " | " . count($d2["actions"]??[]) . " actions";
|
|
$rep2 .= " | TS: " . ($d2["ts"]??"?");
|
|
return array_merge($base, ["content" => $rep2]);
|
|
}
|
|
return array_merge($base, ["content" => "Pipeline archi meeting pas encore execute."]);
|
|
}
|
|
|
|
|
|
if (preg_match('/l99.*state|l99.*status|etat.*l99/iu', $msg)) {
|
|
$f = "/var/www/html/api/l99-state.json";
|
|
if (file_exists($f)) {
|
|
$d = @json_decode(file_get_contents($f), true);
|
|
$rep = "L99 STATE: " . ($d['tests_pass']??"?") . "/" . ($d['tests_total']??"?");
|
|
$rep .= " | Sigma: " . ($d['sigma']['level']??"?");
|
|
$rep .= " | SS: " . ($d['screenshots']??"?") . " | Vid: " . ($d['videos']??"?");
|
|
$rep .= " | TS: " . ($d['last_update']??"?");
|
|
return array_merge($base, ['content' => $rep]);
|
|
}
|
|
}
|
|
if (preg_match('/l99.*lean|lean.*sigma|dpmo/iu', $msg)) {
|
|
$nr = @json_decode(@file_get_contents("/var/www/html/api/nonreg-latest.json"), true);
|
|
$dpmo = round((1 - ($nr['pass']??0) / max(1, $nr['total']??1)) * 1000000);
|
|
$sigma = $dpmo < 4 ? "6" : ($dpmo < 233 ? "5" : ($dpmo < 6210 ? "4" : "3"));
|
|
return array_merge($base, ['content' => "LEAN 6SIGMA: DPMO $dpmo | Sigma $sigma | NR " . ($nr['pass']??"?") . "/" . ($nr['total']??"?")]);
|
|
}
|
|
if (preg_match('/nonreg|non.*reg/iu', $msg)) {
|
|
$nr = @json_decode(@file_get_contents("/var/www/html/api/nonreg-latest.json"), true);
|
|
return array_merge($base, ['content' => "NONREG: " . ($nr['pass']??"?") . "/" . ($nr['total']??"?") . " (" . ($nr['score']??"?") . "%)"]);
|
|
}
|
|
|
|
|
|
if (preg_match('/pat.*github|github.*pat|pat.*expire|pat.*status|pat.*renew/iu', $msg)) {
|
|
$f = "/var/www/html/api/pat-status.json";
|
|
if (file_exists($f)) {
|
|
$d = @json_decode(file_get_contents($f), true);
|
|
$rep = "GITHUB PAT: " . ($d['pat_valid'] ? "VALID" : "EXPIRED");
|
|
$rep .= " | User: " . ($d['user']??"?");
|
|
$rep .= " | Expires: " . ($d['days_until_expiry']??"?") . " days";
|
|
$rep .= " | Push: " . ($d['push_ok'] ? "OK" : "FAIL");
|
|
$rep .= " | Gitea backup: " . ($d['gitea_backup'] ? "OK" : "FAIL");
|
|
if ($d['alert']??"") $rep .= "
|
|
ALERT: " . $d['alert'];
|
|
return array_merge($base, ['content' => $rep]);
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|