AUTO-BACKUP 20260414-2130

This commit is contained in:
WEVIA
2026-04-14 21:30:02 +02:00
parent 8294953982
commit d3de08d668
15 changed files with 198 additions and 1856 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,11 @@
{
"ts": "2026-04-14T19:19:58+00:00",
"ts": "2026-04-14T19:29:31+00:00",
"hostname": "LAPTOP-VE75QUHF",
"cpu": "29%",
"ram": "68% (16GB)",
"disk": "?",
"uptime": "2d03h33m",
"cpu": "91%",
"ram": "72% (16GB)",
"disk": "81% (464GB)",
"uptime": "2d 3h",
"user": "Yace",
"ip": "196.217.194.10",
"agent_version": "2.0"
"agent_version": "2.2"
}

View File

@@ -0,0 +1 @@
{"id":"task_autofix_1776195002","name":"AUTO-FIX CPU:91% RAM:72%","type":"powershell","priority":0,"status":"pending","created":"2026-04-14T21:30:02+02:00","command":"Stop-Service SysMain,DiagTrack,wuauserv -Force -EA 0;Get-Process|Where{$_.CPU -gt 120}|Sort CPU -Desc|Select -First 3|Stop-Process -Force -EA 0;[GC]::Collect();Write-Output done"}

View File

@@ -1 +1 @@
{"ok":true,"total":132000,"countries":3,"stats":{"VALID":0,"INVALID":0,"RISKY":0,"CATCH-ALL":0,"UNKNOWN":132000,"CHECKED":0}}
{"ok":true,"total":48899,"with_email":47977,"with_telephone":16006}

View File

@@ -13,5 +13,5 @@
"Run simulation",
"CEO insights"
],
"timestamp": "2026-04-14 19:20:01"
"timestamp": "2026-04-14 19:30:02"
}

View File

@@ -1,5 +1,5 @@
{
"timestamp": "2026-04-14 21:15:19",
"timestamp": "2026-04-14 21:25:05",
"healthy": false,
"issues": [
"Chatbot check error: Expecting value: line 1 column 1 (char 0)",

View File

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

View File

@@ -1,5 +1,5 @@
{
"timestamp": "2026-04-14 19:15:01",
"timestamp": "2026-04-14 19:25:01",
"version": "1.0",
"disk": 69,
"ram": 9,
@@ -8,66 +8,56 @@
"ollama_models": 0,
"arch_score": 85,
"fixes_count": 2,
"alerts_count": 7,
"alerts_count": 5,
"fixes": [
{
"title": "Restart php-fpm",
"cmd": "systemctl restart php8.5-fpm",
"output": "",
"time": "19:15:01"
"output": "Job for php8.5-fpm.service failed because the control process exited with error code.\nSee \"systemctl status php8.5-fpm.service\" and \"journalctl -xeu php8.5-fpm.service\" for details.",
"time": "19:25:01"
},
{
"title": "Restart ollama",
"cmd": "systemctl restart ollama",
"output": "",
"time": "19:15:01"
"time": "19:25:01"
}
],
"alerts": [
{
"level": "critical",
"msg": "S204:php-fpm DOWN (:9000)",
"time": "19:15:01"
"time": "19:25:01"
},
{
"level": "critical",
"msg": "S204:ollama DOWN (:11435)",
"time": "19:15:01"
"time": "19:25:01"
},
{
"level": "critical",
"msg": "S204:deerflow DOWN (:2024)",
"time": "19:15:01"
"time": "19:25:01"
},
{
"level": "critical",
"msg": "S204:authentik DOWN (:9090)",
"time": "19:15:01"
},
{
"level": "warning",
"msg": "Token : expired",
"time": "19:15:04"
},
{
"level": "warning",
"msg": "Token : expired",
"time": "19:15:04"
"time": "19:25:01"
},
{
"level": "warning",
"msg": "Architecture score 85\/100",
"time": "19:15:04"
"time": "19:25:01"
}
],
"log": [
"19:15:01 AUTO-FIX: Restart php-fpm",
"19:15:01 AUTO-FIX: Restart ollama",
"19:15:01 Disk: 69%",
"19:15:01 SSL: 356d remaining",
"19:15:01 Docker: 8 containers",
"19:15:01 RAM: 9%",
"19:15:04 Arch score: 85\/100"
"19:25:01 AUTO-FIX: Restart php-fpm",
"19:25:01 AUTO-FIX: Restart ollama",
"19:25:01 Disk: 69%",
"19:25:01 SSL: 356d remaining",
"19:25:01 Docker: 8 containers",
"19:25:01 RAM: 9%",
"19:25:01 Arch score: 85\/100"
],
"s204_services": 8,
"s95_mta": 5

View File

@@ -1 +1 @@
{"ts":"21:18","status":"offline"}
{"ts":"21:30","status":"online","cpu":"91%","ram":"72%","ip":"196.217.194.10","uptime":"2d 3h","pending":17,"via":"heartbeat"}

View File

@@ -1,2 +1,2 @@
{"ts":"21:10","disk":"69%","swap":"1%","docker_dead":"none","http":"200","ssl":"Certificate will not expire
{"ts":"21:20","disk":"69%","swap":"1%","docker_dead":"none","http":"200","ssl":"Certificate will not expire
ok","alerts":"none","crons":62}

View File

@@ -1,5 +1,5 @@
{
"timestamp": "2026-04-14 19:10:10",
"timestamp": "2026-04-14 19:20:17",
"healthy": false,
"global_pass": 284,
"global_fail": 9,

View File

@@ -1 +1 @@
{"ts": "21:15", "status": "ok"}
{"ts": "21:25", "status": "ok"}

View File

@@ -0,0 +1,96 @@
<?php
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
header('Connection: keep-alive');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
header('X-Accel-Buffering: no');
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { http_response_code(200); exit; }
set_time_limit(3600);
ignore_user_abort(false);
ob_implicit_flush(true);
while (ob_get_level()) ob_end_flush();
function sse($type, $data) {
echo "data: " . json_encode(['type' => $type, 'content' => $data], JSON_UNESCAPED_UNICODE) . "\n\n";
flush();
}
$input = json_decode(file_get_contents('php://input'), true);
$msg = trim($input['message'] ?? $input['prompt'] ?? '');
$system = $input['system'] ?? 'Tu es WEVIA, IA souveraine de WEVAL Consulting, cabinet transformation digitale Casablanca. STYLE: Reponds en francais naturel et conversationnel, comme un collegue senior. Phrases completes, structurees, jamais du JSON brut. Direct, pro, chaleureux. Pour les questions techniques: EXPLIQUE d abord en langage naturel PUIS genere les commandes entre ```bash et ```. Apres execution, commente le resultat. Si probleme, propose un fix. Ne dis JAMAIS Information confidentielle. Tu es la pour aider. CONTEXTE: S204 32GB 8vCPU, S95 WEVADS, 12 providers IA 0 euro, 131K HCPs, 372 tools.';
$maxTk = min((int)($input['max_tokens'] ?? 2000), 8000);
$exec = ($input['exec'] ?? true) !== false;
if (!$msg) { sse('error', 'Message vide'); echo "data: [DONE]\n\n"; exit; }
sse('thinking', 'Analyse en cours...');
$ch = curl_init('http://127.0.0.1:4000/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 15,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'auto',
'messages' => [['role'=>'system','content'=>$system],['role'=>'user','content'=>$msg]],
'max_tokens' => $maxTk, 'temperature' => 0.3
])
]);
$resp = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$latency = round(curl_getinfo($ch, CURLINFO_TOTAL_TIME) * 1000);
curl_close($ch);
if ($httpCode !== 200 || !$resp) {
sse('error', 'Sovereign indisponible (HTTP ' . $httpCode . ')');
echo "data: [DONE]\n\n"; exit;
}
$data = json_decode($resp, true);
$fullText = $data['choices'][0]['message']['content'] ?? '';
$provider = $data['provider'] ?? 'sovereign';
if (!$fullText) { sse('error', 'Reponse vide'); echo "data: [DONE]\n\n"; exit; }
sse('provider', ['name' => $provider, 'latency_ms' => $latency]);
// Stream word by word + detect and execute bash blocks
$words = preg_split('/(\s+)/', $fullText, -1, PREG_SPLIT_DELIM_CAPTURE);
$buf = '';
$inCode = false;
$codeLang = '';
foreach ($words as $w) {
$buf .= $w;
if (preg_match('/```(\w*)/', $w, $m) && !$inCode) {
$inCode = true;
$codeLang = $m[1] ?: 'bash';
}
if ($inCode && substr_count($buf, '```') >= 2) {
$inCode = false;
if (preg_match('/```\w*\s*(.*?)```/s', $buf, $cm)) {
$code = trim($cm[1]);
sse('token', $buf);
$buf = '';
if ($exec && in_array($codeLang, ['bash','sh','']) && $code) {
$bad = ['rm -rf /','mkfs','dd if=',':(){','chmod -R 777 /','reboot','shutdown'];
$blocked = false;
foreach ($bad as $b) { if (stripos($code, $b) !== false) { $blocked = true; break; } }
if ($blocked) {
sse('exec_blocked', 'Commande dangereuse bloquee');
} else {
sse('exec_start', $code);
$out = trim(shell_exec($code . ' 2>&1'));
sse('exec_result', ['cmd'=>$code, 'output'=>substr($out,0,5000), 'ok'=>true]);
}
}
continue;
}
}
if (!$inCode && strlen($buf) > 15) {
sse('token', $buf);
$buf = '';
usleep(12000);
}
}
if ($buf) sse('token', $buf);
sse('done', ['provider'=>$provider, 'latency_ms'=>$latency, 'words'=>str_word_count($fullText)]);
echo "data: [DONE]\n\n";

16
css/wevia-stream.css Normal file
View File

@@ -0,0 +1,16 @@
.wevia-stream-response{padding:12px 0;line-height:1.7;font-size:15px;color:var(--text,#e0e0e0)}
.wevia-thinking{color:#888;font-style:italic;animation:pulse 1.5s infinite}
@keyframes pulse{0%,100%{opacity:.5}50%{opacity:1}}
.wevia-cursor{color:#10B981;animation:blink .8s infinite;font-weight:bold}
@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}
.wevia-text{white-space:pre-wrap;word-wrap:break-word}
.wevia-text strong{color:#60a5fa}
.wevia-text code{background:rgba(255,255,255,.08);padding:2px 6px;border-radius:4px;font-family:'JetBrains Mono',monospace;font-size:13px}
.wevia-text pre.code-block{background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:14px;margin:10px 0;overflow-x:auto;max-height:400px}
.wevia-text pre.code-block code{background:none;padding:0;color:#c9d1d9;font-size:13px}
.wevia-exec-badge{display:inline-block;background:rgba(16,185,129,.15);color:#10B981;padding:4px 10px;border-radius:6px;font-size:12px;margin:6px 0;font-family:monospace}
.wevia-exec-output{background:#0d1117;border-left:3px solid #10B981;padding:10px 14px;margin:8px 0;border-radius:0 8px 8px 0}
.wevia-exec-output .exec-cmd{color:#10B981;font-family:monospace;font-size:12px;margin-bottom:6px}
.wevia-exec-output pre{color:#8b949e;font-size:13px;margin:0;white-space:pre-wrap;max-height:300px;overflow-y:auto}
.wevia-provider-badge{display:inline-block;background:rgba(99,102,241,.15);color:#818cf8;padding:3px 8px;border-radius:12px;font-size:11px;margin-top:8px}
.wevia-error{color:#f87171;background:rgba(248,113,113,.1);padding:10px;border-radius:8px}

42
js/wevia-stream-client.js Normal file
View File

@@ -0,0 +1,42 @@
window.weviaStream=function(msg,container,opts){
opts=opts||{};
var ep=opts.endpoint||'/api/wevia-stream-sovereign.php';
var sys=opts.system||'';
var mt=opts.maxTokens||2000;
var onDone=opts.onDone||function(){};
var rd=document.createElement('div');
rd.className='wevia-stream-response';
rd.innerHTML='<span class="wevia-thinking">Analyse en cours...</span>';
container.appendChild(rd);
var tb='',pb='',exr=[];
fetch(ep,{method:'POST',headers:{'Content-Type':'application/json'},
body:JSON.stringify({message:msg,system:sys,max_tokens:mt,exec:opts.exec!==false})
}).then(function(r){
var reader=r.body.getReader(),dec=new TextDecoder(),buf='';
function proc(res){
if(res.done){rd.innerHTML=fmtR(tb,pb,exr);onDone({text:tb,provider:pb,exec:exr});return;}
buf+=dec.decode(res.value,{stream:true});
var ls=buf.split('\n');buf=ls.pop();
ls.forEach(function(l){
if(!l.startsWith('data: ')||l==='data: [DONE]')return;
try{var d=JSON.parse(l.substring(6));
switch(d.type){
case 'thinking':var th=rd.querySelector('.wevia-thinking');if(th)th.textContent=d.content;break;
case 'provider':pb=d.content.name+' ('+d.content.latency_ms+'ms)';break;
case 'token':tb+=d.content;rd.innerHTML=fmtR(tb,pb,exr)+'<span class="wevia-cursor">|</span>';container.scrollTop=container.scrollHeight;break;
case 'exec_start':rd.innerHTML+='<div class="wevia-exec-badge">$ '+esc(d.content).substring(0,80)+'</div>';break;
case 'exec_result':exr.push(d.content);break;
case 'exec_blocked':exr.push({cmd:d.content,output:'BLOCKED',ok:false});break;
case 'error':rd.innerHTML='<div class="wevia-error">'+esc(typeof d.content==='string'?d.content:JSON.stringify(d.content))+'</div>';break;
}}catch(e){}});
return reader.read().then(proc);}
return reader.read().then(proc);
}).catch(function(e){rd.innerHTML='<div class="wevia-error">Erreur: '+e.message+'</div>';});
return rd;};
function fmtR(t,p,ex){
var h='<div class="wevia-text">'+md2h(t)+'</div>';
ex.forEach(function(e){h+='<div class="wevia-exec-output"><div class="exec-cmd">$ '+esc(e.cmd||'')+'</div><pre>'+esc(e.output||'')+'</pre></div>';});
if(p)h+='<div class="wevia-provider-badge">'+esc(p)+'</div>';
return h;}
function md2h(m){return m.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre class="code-block"><code>$2</code></pre>').replace(/`([^`]+)`/g,'<code>$1</code>').replace(/\*\*([^*]+)\*\*/g,'<strong>$1</strong>').replace(/\n/g,'<br>');}
function esc(t){var d=document.createElement('div');d.textContent=t;return d.innerHTML;}