- Deploy /widgets/audit-banner.js (non-destructif, 3056 bytes) - Wire architecture-map.html + security-hub.html + security-dashboard.html (GOLD backups) - Deploy /live-status.php + /api/linkedin-alignment-kpi.php - Inject 2 intents WEVIA Master: audit_linkedin + vague1_execute - 10 sections audit embedded in Qdrant wevia_kb_768 - L99 score: 304/304 (zero regression) - chattr +i restored on all modified files
177 lines
12 KiB
Plaintext
177 lines
12 KiB
Plaintext
<?php
|
|
// OPUS46 EXECUTION INTENTS v2 — 16AVR
|
|
// These fire via wevia_opus46_exec() BEFORE fast-path
|
|
|
|
function wevia_opus46_exec($msg) {
|
|
$m = mb_strtolower(trim($msg));
|
|
$r = null;
|
|
|
|
// INTENT: css_overlap_fix
|
|
if (preg_match("/overlap\s*fix|fixe?\s*(les?\s+)?overlap|css\s*overlap|ux\s*overlap/iu", $m)) {
|
|
$pages = ["agents-archi.html","enterprise-model.html","wevia-meeting-rooms.html"];
|
|
$fixed = 0;
|
|
foreach ($pages as $page) {
|
|
$path = "/var/www/html/$page";
|
|
if (!file_exists($path)) continue;
|
|
$html = file_get_contents($path);
|
|
if (strpos($html, "L99-OVERLAP-FIX") === false) {
|
|
$fix = "\n<style>/* L99-OVERLAP-FIX */\n.label,.tag,.badge,.tooltip{pointer-events:none;z-index:0}\ncanvas{z-index:0!important}\n</style>\n";
|
|
@shell_exec("sudo chattr -i $path 2>/dev/null");
|
|
$html = str_replace("</head>", $fix . "</head>", $html);
|
|
file_put_contents($path, $html);
|
|
@shell_exec("sudo chattr +i $path 2>/dev/null");
|
|
$fixed++;
|
|
}
|
|
}
|
|
return ["provider"=>"opus46","content"=>"CSS OVERLAP FIX: $fixed/" . count($pages) . " pages","tool"=>"overlap_fix"];
|
|
}
|
|
|
|
// INTENT: l99_run
|
|
if (preg_match("/lance\w*\s*(le\s+)?l99|run\s+l99|l99\s+run|l99\s+maintenant|playwright\s+run|lance\s+playwright/iu", $m)) {
|
|
@shell_exec("nohup bash -c 'cd /var/www/html && node api/l99-full-test.js > /tmp/l99-run.log 2>&1' &");
|
|
return ["provider"=>"opus46","content"=>"L99 PLAYWRIGHT lance. Log: /tmp/l99-run.log","tool"=>"l99_run"];
|
|
}
|
|
|
|
// INTENT: l99_score
|
|
if (preg_match("/l99\s+score|score\s+l99|l99\s+r.sultat|r.sultat\w*\s+l99|l99\s+dernier|l99\s+status/iu", $m)) {
|
|
$j = @json_decode(@file_get_contents("http://127.0.0.1/api/l99-api.php?action=results"), true);
|
|
$r = "L99: Score=" . ($j["score"] ?? "?") . "% Pass=" . ($j["pass"] ?? "?") . " Warn=" . ($j["warn"] ?? "?") . " Date=" . ($j["date"] ?? "?");
|
|
if (!empty($j["results"])) { foreach ($j["results"] as $t) { if (in_array($t["status"]??"", ["W","F"])) $r .= "\n " . $t["status"] . ":" . ($t["name"]??""); } }
|
|
return ["provider"=>"opus46","content"=>$r,"tool"=>"l99_score"];
|
|
}
|
|
|
|
// INTENT: git_full
|
|
if (preg_match("/git\s+(full|complet|tout)|commit\s+(et\s+)?push|push\s+tout|git\s+sync\s+(all|tout)/iu", $m)) {
|
|
$d = (int)trim(@shell_exec("cd /var/www/html && git status --short 2>&1 | wc -l"));
|
|
if ($d > 0) {
|
|
@shell_exec("cd /var/www/html && git add -A && git commit -m 'auto-sync-opus46' && git push origin main 2>&1");
|
|
@shell_exec("cd /opt/weval-l99 && git add -A && git commit -m 'auto-sync-opus46' && git push 2>&1");
|
|
$hb=trim(@shell_exec("cd /var/www/html && git rev-parse HEAD 2>&1")); $ha=trim(@shell_exec("cd /var/www/html && git rev-parse origin/main 2>&1")); $da=(int)trim(@shell_exec("cd /var/www/html && git status --short 2>&1 | wc -l")); if ($hb===$ha && $da>=$d) return ["provider"=>"opus46","content"=>"GIT FAILED: HEAD=".substr($hb,0,8)." unchanged, dirty=$da","tool"=>"git_full"]; return ["provider"=>"opus46","content"=>"GIT OK: $d files, HEAD=".substr($hb,0,8)." dirty_after=$da","tool"=>"git_full"];
|
|
}
|
|
return ["provider"=>"opus46","content"=>"GIT: 0 dirty","tool"=>"git_full"];
|
|
}
|
|
|
|
// INTENT: wiki_update
|
|
if (preg_match("/wiki\s+update|update\s+wiki|maj\s+wiki|enrichi\w*\s+wiki/iu", $m)) {
|
|
$entry = preg_replace("/^.*wiki\s+\w+\s*/iu", "", $msg);
|
|
if (strlen($entry) < 10) $entry = date("Y-m-d H:i") . " session update";
|
|
$w = "/var/www/html/wiki.html";
|
|
@shell_exec("sudo chattr -i $w 2>/dev/null");
|
|
$wc = file_get_contents($w);
|
|
$tag = "opus46-" . date("YmdHis");
|
|
$card = "<div class=\"card wiki-item\" data-tags=\"$tag\"><h2 style=\"border:0;margin:0;padding:0\">" . htmlspecialchars(substr($entry,0,60)) . "</h2><div style=\"color:#94a3b8;font-size:10px;margin-top:6px\">" . htmlspecialchars($entry) . "<br><span style=\"color:#06b6d4\">[" . date("d/m H:i") . "]</span></div></div>\n";
|
|
$pos = strrpos($wc, "</div>\n<script>");
|
|
if ($pos !== false) { file_put_contents($w, substr($wc, 0, $pos) . $card . substr($wc, $pos)); $r = "WIKI: OK ($tag)"; }
|
|
else { $r = "WIKI: marker fail"; }
|
|
@shell_exec("sudo chattr +i $w 2>/dev/null");
|
|
return ["provider"=>"opus46","content"=>$r,"tool"=>"wiki_update"];
|
|
}
|
|
|
|
// INTENT: provider_test
|
|
if (preg_match("/test\w*\s+(all\s+|tout\w*\s+)?provider|provider\w*\s+test|cascade\s+test/iu", $m)) {
|
|
$ps = @json_decode(@file_get_contents("http://127.0.0.1/api/openclaw-proxy.php"), true);
|
|
$res = [];
|
|
foreach (($ps["providers"] ?? []) as $p) {
|
|
if ($p["tier"] === "sovereign" || empty($p["models"])) continue;
|
|
$ch = curl_init("http://127.0.0.1/api/openclaw-proxy.php");
|
|
curl_setopt_array($ch, [CURLOPT_POST=>1, CURLOPT_RETURNTRANSFER=>1, CURLOPT_TIMEOUT=>8, CURLOPT_HTTPHEADER=>["Content-Type: application/json"], CURLOPT_POSTFIELDS=>json_encode(["provider"=>$p["id"],"model"=>$p["models"][0]["id"],"message"=>"Reply OK"])]);
|
|
$rr = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch);
|
|
$res[] = $p["id"] . ":" . ($code === 200 && strpos($rr, "choices") !== false ? "OK" : "FAIL");
|
|
}
|
|
return ["provider"=>"opus46","content"=>"PROVIDERS: " . implode(" | ", $res),"tool"=>"provider_test"];
|
|
}
|
|
|
|
// INTENT: auto_heal
|
|
if (preg_match("/auto[\s\-]?heal|auto[\s\-]?fix|fixe[rz]?\s+tout|fix\s+all|r.pare\w*\s+tout/iu", $m)) {
|
|
$fx = [];
|
|
$d = (int)trim(@shell_exec("cd /var/www/html && git status --short 2>&1 | wc -l"));
|
|
if ($d > 0) { @shell_exec("cd /var/www/html && git add -A && git commit -m 'auto-heal' 2>&1"); $fx[] = "Git:$d"; }
|
|
@shell_exec("curl -s http://127.0.0.1/api/opcache-reset.php 2>/dev/null"); $fx[] = "OPcache:OK";
|
|
@shell_exec("curl -sX POST 'https://api.cloudflare.com/client/v4/zones/1488bbba251c6fa282999fcc09aac9fe/purge_cache' -H 'X-Auth-Email: ymahboub@weval-consulting.com' -H 'X-Auth-Key: 9eb8d1041e7faeae68d5017376871ba170291' -H 'Content-Type:application/json' -d'{\"purge_everything\":true}' 2>/dev/null"); $fx[] = "CF:purged";
|
|
return ["provider"=>"opus46","content"=>"AUTO-HEAL: " . implode(" | ", $fx),"tool"=>"auto_heal"];
|
|
}
|
|
|
|
// INTENT: 6sigma_full
|
|
if (preg_match("/6[\s\.]?sigma\s+(complet|full)|full\s+6[\s\.]?sigma|lean\s+audit|toc\s+audit/iu", $m)) {
|
|
$nr = @json_decode(@file_get_contents("http://127.0.0.1/api/nonreg-api.php?cat=all"), true);
|
|
$l9 = @json_decode(@file_get_contents("http://127.0.0.1/api/l99-api.php?action=results"), true);
|
|
$pv = @json_decode(@file_get_contents("http://127.0.0.1/api/openclaw-proxy.php"), true);
|
|
$r = "6SIGMA: NR=" . ($nr["pass"]??"?") . "/" . ($nr["total"]??"?") . " L99=" . ($l9["pass"]??"?") . "/" . ($l9["total"]??"?") . "@" . ($l9["score"]??"?") . "% Providers=" . count($pv["providers"]??[]) . "(" . ($pv["total_models"]??"?") . "M) Git=" . trim(@shell_exec("cd /var/www/html && git status --short 2>&1 | wc -l")) . "dirty";
|
|
return ["provider"=>"opus46","content"=>$r,"tool"=>"6sigma"];
|
|
}
|
|
|
|
// INTENT: vault_gold
|
|
if (preg_match("/gold\s+(backup|save)|backup\s+gold|vault\s+gold|sauvegarde\s+gold/iu", $m)) {
|
|
if (preg_match("/gold\s+\w+\s+([\/\w\.\-]+)/iu", $msg, $gm)) {
|
|
$p = $gm[1]; if ($p[0] !== "/") $p = "/var/www/html/$p";
|
|
if (file_exists($p)) { $g = $p . ".GOLD-" . date("Ymd-His"); copy($p, $g); return ["provider"=>"opus46","content"=>"GOLD: $g (" . filesize($g) . "B)","tool"=>"gold"]; }
|
|
return ["provider"=>"opus46","content"=>"ERREUR: $p inexistant","tool"=>"gold"];
|
|
}
|
|
return ["provider"=>"opus46","content"=>"Precise le fichier","tool"=>"gold"];
|
|
}
|
|
|
|
// INTENT: ops_screen_check
|
|
if (preg_match("/screen\w*\s+(check|defect)|ops[\s\-]?screen|ecran\w*\s+defect|defectueux/iu", $m)) {
|
|
$j = @json_decode(@file_get_contents("http://127.0.0.1/api/infra-monitor-api.php"), true);
|
|
return ["provider"=>"opus46","content"=>"OPS: UP=" . ($j["up"]??"?") . " DOWN=" . ($j["down"]??"?") . " 5xx=" . ($j["error_5xx"]??"?"),"tool"=>"ops_check"];
|
|
}
|
|
|
|
// INTENT: reconcile
|
|
if (preg_match("/reconcili|merge\s+session|conflit\s+session|sync\s+session/iu", $m)) {
|
|
return ["provider"=>"opus46","content"=>"RECONCILIATION:\n" . trim(@shell_exec("cd /var/www/html && git log --oneline -15 2>&1")) . "\nDirty:" . trim(@shell_exec("cd /var/www/html && git status --short 2>&1 | wc -l")),"tool"=>"reconcile"];
|
|
}
|
|
|
|
// INTENT: playwright_verify
|
|
if (preg_match("/playwright\s+verif|verif\w*\s+playwright|visual\s+test/iu", $m)) {
|
|
@shell_exec("nohup bash -c 'cd /var/www/html && node api/l99-visual-test.js > /tmp/pw-vis.log 2>&1' &");
|
|
return ["provider"=>"opus46","content"=>"PLAYWRIGHT VISUAL lance","tool"=>"playwright_verify"];
|
|
}
|
|
|
|
// INTENT: intent_registry
|
|
if (preg_match("/wire\s+intent|intent\s+wire|self[\s\-]?wire|nouvel?\s+intent|intent\s+registry/iu", $m)) {
|
|
$ic = trim(@shell_exec("grep -c 'preg_match' /var/www/html/api/wevia-opus-intents.php 2>/dev/null"));
|
|
$fc = trim(@shell_exec("grep -c 'preg_match' /var/www/html/api/wevia-fast-path-v3.php 2>/dev/null"));
|
|
$o4 = trim(@shell_exec("grep -c 'preg_match' /var/www/html/api/wevia-opus46-intents.php 2>/dev/null"));
|
|
return ["provider"=>"opus46","content"=>"INTENTS: opus=$ic fast-path=$fc opus46=$o4","tool"=>"intent_wire"];
|
|
}
|
|
|
|
|
|
if (preg_match("/scan.*skills|skills.*scan|inject.*skills|skills.*inject|refresh.*skills|0.*skills/iu", $m)) {
|
|
$s=[];$d="/var/www/html/skills/";
|
|
foreach(scandir($d) as $e){if($e[0]==".")continue;$full=realpath("$d/$e");if(!$full||!is_dir($full))continue;
|
|
foreach(scandir($full) as $x){if($x[0]==".")continue;$s[]=["slug"=>"$e/$x","name"=>pathinfo($x,4),"source"=>$e];}}
|
|
$c2="/var/www/html/api/oss-cache.json";$j=json_decode(file_get_contents($c2),true);
|
|
$j["skills"]=["total"=>count($s),"injected"=>count($s),"skills"=>$s];
|
|
file_put_contents($c2,json_encode($j,128|256));
|
|
return ["provider"=>"opus46","content"=>"SKILLS:".count($s),"tool"=>"skills_scan"];
|
|
}
|
|
|
|
|
|
if (preg_match("/charge.*(serveur|server)|load.*(average|serveur)|uptime|memoire.*serveur|cpu.*serveur/iu", $m)) {
|
|
$load = trim(@shell_exec("uptime 2>/dev/null"));
|
|
$mem = trim(@shell_exec("free -h 2>/dev/null | grep Mem"));
|
|
$disk = trim(@shell_exec("df -h / 2>/dev/null | tail -1"));
|
|
$fpm = trim(@shell_exec("pgrep -c php-fpm 2>/dev/null"));
|
|
return ["provider"=>"opus46","content"=>"SERVEUR:\n $load\n MEM: $mem\n DISK: $disk\n FPM: $fpm","tool"=>"server_load"];
|
|
}
|
|
|
|
if (preg_match("/crons?\s+(actif|list|quels|detail)|quels?\s+crons?|list\w*\s+crons?/iu", $m)) {
|
|
$s = trim(@shell_exec("crontab -l -u www-data 2>/dev/null | grep -v \"^#\" | grep -v \"^$\" | head -15"));
|
|
$n = (int)trim(@shell_exec("crontab -l -u www-data 2>/dev/null | grep -cv \"^#\""));
|
|
$nr = (int)trim(@shell_exec("sudo crontab -l 2>/dev/null | grep -cv \"^#\""));
|
|
return ["provider"=>"opus46","content"=>"CRONS: www-data=$n root=$nr\n$s","tool"=>"crons_detail"];
|
|
}
|
|
|
|
|
|
// INTENT: nuclei_scan - real execution
|
|
if (preg_match("/nuclei.*scan|scan.*nuclei|lance.*nuclei|vulnerabilit|vuln.*scan|owasp.*scan/iu", $m)) {
|
|
$target = "https://weval-consulting.com";
|
|
if (preg_match("/scan\s+(https?:\/\/\S+)/iu", $msg, $tm)) $target = $tm[1];
|
|
$out = trim(@shell_exec("timeout 30 /usr/local/bin/nuclei -u $target -severity critical,high -silent -nc 2>&1 | head -20"));
|
|
if (!$out) $out = "0 vulnérabilités critical/high détectées";
|
|
return ["provider"=>"opus46","content"=>"NUCLEI SCAN $target:\n$out","tool"=>"nuclei_scan"];
|
|
}
|
|
|
|
return null;
|
|
}
|