auto-heal

This commit is contained in:
opus
2026-04-16 22:40:54 +02:00
parent f19eed8f06
commit b7d9fb3321
10 changed files with 181 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
{
"ts": "2026-04-16T20:39:57+00:00",
"ts": "2026-04-16T20:40:52+00:00",
"hostname": "blade",
"cpu": "?",
"ram": "?",

View File

@@ -1,5 +1,5 @@
{
"timestamp": "2026-04-16 22:35:05",
"timestamp": "2026-04-16 22:40:05",
"healthy": true,
"issues": [],
"fixes": [],

View File

@@ -1,5 +1,5 @@
{
"timestamp": "2026-04-16 20:35:08",
"timestamp": "2026-04-16 20:40:08",
"healthy": false,
"checks": {
"outpost": "DOWN",
@@ -30,62 +30,62 @@
{
"level": "critical",
"msg": "Outpost DOWN 9090",
"ts": "2026-04-16T20:35:01+00:00"
"ts": "2026-04-16T20:40:01+00:00"
},
{
"level": "critical",
"msg": "Outpost STILL DOWN",
"ts": "2026-04-16T20:35:06+00:00"
"ts": "2026-04-16T20:40:06+00:00"
},
{
"level": "warning",
"msg": "Auth flow wevads.weval-consulting.com: 200",
"ts": "2026-04-16T20:35:06+00:00"
"ts": "2026-04-16T20:40:07+00:00"
},
{
"level": "warning",
"msg": "Auth flow ethica.weval-consulting.com: 200",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:07+00:00"
},
{
"level": "warning",
"msg": "Auth flow n8n.weval-consulting.com: 200",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:07+00:00"
},
{
"level": "warning",
"msg": "Auth flow crm.weval-consulting.com: 200",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:07+00:00"
},
{
"level": "warning",
"msg": "Auth flow mm.weval-consulting.com: 200",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:07+00:00"
},
{
"level": "warning",
"msg": "Auth flow analytics.weval-consulting.com: 200",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:08+00:00"
},
{
"level": "warning",
"msg": "Auth flow deerflow.weval-consulting.com: 200",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:08+00:00"
},
{
"level": "warning",
"msg": "Callback location missing in nginx",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:08+00:00"
}
],
"fixes": [
{
"title": "Restart authentik",
"ts": "2026-04-16T20:35:01+00:00"
"ts": "2026-04-16T20:40:01+00:00"
},
{
"title": "Callback location auto-added",
"ts": "2026-04-16T20:35:07+00:00"
"ts": "2026-04-16T20:40:08+00:00"
}
]
}

View File

@@ -1,10 +1,10 @@
{
"timestamp": "2026-04-16 20:35:01",
"timestamp": "2026-04-16 20:40:01",
"version": "1.0",
"disk": 84,
"ram": 16,
"docker": 19,
"ssl_days": 354,
"ssl_days": 353,
"ollama_models": 5,
"arch_score": 100,
"fixes_count": 0,
@@ -14,26 +14,26 @@
{
"level": "critical",
"msg": "S204:authentik DOWN (:9090)",
"time": "20:35:01"
"time": "20:40:01"
},
{
"level": "warning",
"msg": "Token : expired",
"time": "20:35:02"
"time": "20:40:03"
},
{
"level": "warning",
"msg": "Token : expired",
"time": "20:35:02"
"time": "20:40:03"
}
],
"log": [
"20:35:01 Disk: 84%",
"20:35:01 SSL: 354d remaining",
"20:35:01 Docker: 19 containers",
"20:35:01 Ollama: 5 models, 5.2GB",
"20:35:01 RAM: 16%",
"20:35:02 Arch score: 100\/100"
"20:40:01 Disk: 84%",
"20:40:01 SSL: 353d remaining",
"20:40:02 Docker: 19 containers",
"20:40:02 Ollama: 5 models, 5.2GB",
"20:40:02 RAM: 16%",
"20:40:03 Arch score: 100\/100"
],
"s204_services": 8,
"s95_mta": 5

View File

@@ -1 +1 @@
{"ts":"22:38","status":"offline"}
{"ts":"22:40","status":"offline"}

View File

@@ -78,6 +78,12 @@ if ($_mam) {
// OPUS_CONTENT_BYPASS_FP
if (!($_is_content_req ?? false)) {
// OPUS WIRED INTENTS — fired BEFORE fast-path-v3 (priority for: audit_6sigma, brains_status, debug_fix, send_test, new_pages)
// OPUS46 ADVANCED EXECUTION INTENTS (16AVR)
@require_once __DIR__ . "/wevia-opus46-intents.php";
if (function_exists("wevia_opus46_exec")) {
$_o46 = wevia_opus46_exec(json_decode(file_get_contents("php://input"),true)["message"] ?? $_POST["message"] ?? $_GET["message"] ?? "");
if ($_o46) { header("Content-Type:application/json"); echo json_encode($_o46); exit; }
}
@require_once __DIR__ . "/wevia-opus-intents.php";
if (function_exists("wevia_opus_intents")) {
$_oi = wevia_opus_intents(json_decode(file_get_contents("php://input"),true)["message"] ?? $_POST["message"] ?? $_GET["message"] ?? "");

View File

@@ -0,0 +1,139 @@
<?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");
return ["provider"=>"opus46","content"=>"GIT FULL: $d files committed+pushed","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"];
}
return null;
}

View File

@@ -1,2 +1,2 @@
{"ts":"22:30","disk":"84%","swap":"39%","docker_dead":"none","http":"200","ssl":"Certificate will not expire
{"ts":"22:40","disk":"84%","swap":"39%","docker_dead":"none","http":"200","ssl":"Certificate will not expire
ok","alerts":"none","crons":64}

View File

@@ -1,5 +1,5 @@
{
"timestamp": "2026-04-16 20:30:03",
"timestamp": "2026-04-16 20:40:03",
"healthy": false,
"global_pass": 286,
"global_fail": 8,
@@ -34,8 +34,8 @@
"total": 93
},
"chat_monitor": {
"pass": 2,
"fail": 1,
"pass": 3,
"fail": 0,
"total": 3,
"caps": {
"Lean Six Sigma": {
@@ -49,9 +49,9 @@
"json": true
},
"SearXNG": {
"ok": false,
"code": 429,
"json": false
"ok": true,
"code": 200,
"json": true
}
}
},
@@ -84,9 +84,8 @@
"issues": [
"Full NonReg: 6\/28 failures (79%)",
"L99 Command: 2 failures",
"Chat Monitor: 1 capabilities returning non-JSON",
"Auth Agent: unhealthy",
"L99 Mission: 2 failures (QUALITY, ssl)"
],
"issues_count": 5
"issues_count": 4
}

View File

@@ -1 +1 @@
{"ts": "22:35", "status": "ok"}
{"ts": "22:40", "status": "ok"}