auto-sync-1550

This commit is contained in:
opus
2026-04-20 15:50:02 +02:00
parent 367dcda23b
commit e74592f680
12 changed files with 371 additions and 1361 deletions

View File

@@ -1,30 +1,70 @@
<?php
// V38 Opus - automation autonomy status (honest fix + enriched)
header("Content-Type: application/json");
header("Access-Control-Allow-Origin: *");
$out = ['ok' => true, 'ts' => date('c'), 'doctrine' => '64-ZERO-MANUAL-TASK'];
$out = ["ok" => true, "ts" => date("c"), "doctrine" => "64-ZERO-MANUAL-TASK"];
// Automations wired
$out['automations'] = [
'crm_pipeline_sync' => ['status' => file_exists('/usr/local/bin/deliverads-guard.sh check via sentinel') ? 'active' : 'missing'],
'crm_observation_daily' => ['status' => file_exists('/etc/cron.d/crm-observation') ? 'active' : 'missing'],
'blade_selfheal' => ['status' => file_exists('/etc/cron.d/automation-blade-selfheal') ? 'active' : 'missing'],
'ovh_cancel' => ['status' => file_exists('/etc/cron.d/automation-ovh-daily') ? 'active' : 'missing'],
'azure_rotation' => ['status' => file_exists('/var/www/html/api/azure-reregister-api.php') ? 'active' : 'missing'],
'nonreg_guard' => ['status' => 'active'], // always via systemd elsewhere
'l99_auto_update' => ['status' => 'active'],
'ethica_enrich' => ['status' => 'active'],
];
// Pending (read from automation-pending.json)
$pending_file = '/var/www/html/api/automation-pending.json';
$out['pending'] = [];
if (is_readable($pending_file)) {
$out['pending'] = json_decode(@file_get_contents($pending_file), true) ?: [];
function check_cron($pattern) {
foreach (glob("/etc/cron.d/*") as $f) {
$c = @file_get_contents($f);
if ($c && preg_match($pattern, $c)) return true;
}
return false;
}
// Counts
$out['crons_count'] = count(glob('/etc/cron.d/*'));
$out['scripts_count'] = count(glob('/opt/weval-l99/*.py')) + count(glob('/opt/weval-l99/*.sh'));
function check_any($paths) {
foreach ((array)$paths as $p) {
if (strpos($p, "*") !== false) { if (glob($p)) return true; }
elseif (file_exists($p)) return true;
}
return false;
}
$auto = [
"crm_pipeline_sync" => check_any(["/opt/weval-l99/crm-pipeline-sync.py","/etc/cron.d/crm-pipeline-sync"]) || check_cron("/crm.*sync|sync.*crm/i"),
"crm_observation_daily" => check_any(["/etc/cron.d/crm-observation","/opt/weval-l99/crm-observation.py"]) || check_cron("/crm-observation/"),
"blade_selfheal" => check_any(["/etc/cron.d/blade-autoheal","/etc/cron.d/automation-blade-selfheal","/opt/weval-l99/blade-selfheal.py"]) || check_cron("/blade.*heal|heal.*blade/"),
"blade_tasks_cleanup" => check_any(["/etc/cron.d/blade-autoheal","/var/www/html/api/blade-tasks-cleanup.php"]),
"ovh_cancel" => check_any(["/etc/cron.d/automation-ovh-daily","/opt/weval-l99/ovh-s151-cancel.py"]) || check_cron("/ovh/"),
"azure_rotation" => check_any(["/var/www/html/api/azure-reregister-api.php"]),
"nonreg_guard" => check_any(["/var/www/html/api/nonreg-master.php"]),
"l99_auto_update" => check_any(["/var/www/html/api/l99-honest.php","/var/www/html/api/handlers/l99-honest-refresh.sh"]),
"ethica_enrich" => check_any(["/opt/weval-l99/ethica-sync-to-send_contacts.py"]) || check_cron("/ethica/"),
"wevia_master_autoheal" => check_any(["/var/www/html/api/wevia-master-autoheal.php"]) || check_cron("/wevia-master-autoheal/"),
"wevia_agent_chef" => check_cron("/wevia-agent-chef/"),
"wevia_agent_evolution" => check_cron("/wevia-agent-evolution/"),
"wevia_autowire_agent" => check_cron("/wevia-autowire-agent/"),
"wevia_cortex" => check_cron("/wevia-cortex/"),
"wevia_daily_standup" => check_cron("/wevia-daily-standup/"),
"health_monitor" => check_cron("/health-monitor/"),
"sso_guardian" => check_cron("/sso-guardian|sso-systemic/"),
"weval_watchdog" => check_any(["/var/www/html/api/weval-watchdog.php","/var/www/html/api/fpm-watchdog.php","/var/www/html/api/opus5-sovereign-watchdog.php","/var/www/html/api/qdrant-watchdog.php"]),
"biz_scenario_cron" => check_cron("/biz-scenario|v94/"),
];
$out["automations"] = [];
$active = 0;
$total = count($auto);
foreach ($auto as $k => $v) {
$out["automations"][$k] = ["status" => $v ? "active" : "missing"];
if ($v) $active++;
}
$out["autonomy_score"] = round(100 * $active / $total, 1);
$out["autonomy_active"] = $active;
$out["autonomy_total"] = $total;
$out["autonomy_sigma"] = ($active === $total) ? "6sigma" : "not-6sigma";
// Pending items
$pending_file = "/var/www/html/api/automation-pending.json";
$out["pending"] = [];
if (is_readable($pending_file)) {
$out["pending"] = json_decode(@file_get_contents($pending_file), true) ?: [];
}
// Global counts
$out["crons_count"] = count(glob("/etc/cron.d/*"));
$out["scripts_count"] = count(glob("/opt/weval-l99/*.py")) + count(glob("/opt/weval-l99/*.sh"));
$out["watchdogs_count"] = count(glob("/var/www/html/api/*watchdog*.php"));
echo json_encode($out, JSON_PRETTY_PRINT);

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 KiB

After

Width:  |  Height:  |  Size: 673 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@@ -1,281 +0,0 @@
{
"ts": "2026-04-20T13:45:01+00:00",
"server": "s204",
"s204": {
"load": 0.79,
"uptime": "2026-04-14 11:51:24",
"ram_total_mb": 31335,
"ram_used_mb": 12433,
"ram_free_mb": 18902,
"disk_total": "150G",
"disk_used": "112G",
"disk_free": "33G",
"disk_pct": "78%",
"fpm_workers": 121,
"docker_containers": 19,
"cpu_cores": 8
},
"s95": {
"load": 0.82,
"disk_pct": "82%",
"status": "UP",
"ram_total_mb": 15610,
"ram_free_mb": 11802
},
"pmta": [
{
"name": "SER6",
"ip": "110.239.84.121",
"status": "DOWN"
},
{
"name": "SER7",
"ip": "110.239.65.64",
"status": "DOWN"
},
{
"name": "SER8",
"ip": "182.160.55.107",
"status": "DOWN"
},
{
"name": "SER9",
"ip": "110.239.86.68",
"status": "DOWN"
}
],
"assets": {
"html_pages": 288,
"php_apis": 751,
"wiki_entries": 1798,
"vault_doctrines": 59,
"vault_sessions": 90,
"vault_decisions": 12
},
"tools": {
"total": 626,
"registry_version": "?"
},
"sovereign": {
"status": "UP",
"providers": [
"Cerebras-fast",
"Cerebras-think",
"Groq",
"Cloudflare-AI",
"Gemini",
"SambaNova",
"NVIDIA-NIM",
"Mistral",
"Groq-OSS",
"HF-Space",
"HF-Router",
"OpenRouter",
"GitHub-Models"
],
"active": 13,
"total": 13,
"primary": "Cerebras-fast",
"cost": "0€"
},
"ethica": {
"total_hcps": 161730,
"with_email": 110444,
"with_phone": 155145,
"gap_email": 51286,
"pct_email": 68.3,
"pct_phone": 95.9,
"by_country": [
{
"country": "DZ",
"hcps": 122337,
"with_email": 78360,
"with_tel": 119394,
"pct_email": 64.1,
"pct_tel": 97.6
},
{
"country": "MA",
"hcps": 19720,
"with_email": 15067,
"with_tel": 18733,
"pct_email": 76.4,
"pct_tel": 95
},
{
"country": "TN",
"hcps": 17794,
"with_email": 15138,
"with_tel": 17018,
"pct_email": 85.1,
"pct_tel": 95.6
},
{
"country": "INTL",
"hcps": 1879,
"with_email": 1879,
"with_tel": 0,
"pct_email": 100,
"pct_tel": 0
}
]
},
"docker": [
{
"name": "loki",
"status": "Up 4 days",
"ports": ""
},
{
"name": "listmonk",
"status": "Up 4 days",
"ports": ""
},
{
"name": "plausible-plausible-1",
"status": "Up 2 days",
"ports": ""
},
{
"name": "plausible-plausible-db-1",
"status": "Up 2 days",
"ports": ""
},
{
"name": "plausible-plausible-events-db-1",
"status": "Up 2 days",
"ports": ""
},
{
"name": "n8n-docker-n8n-1",
"status": "Up 4 days",
"ports": ""
},
{
"name": "mattermost-docker-mm-db-1",
"status": "Up 4 days",
"ports": ""
},
{
"name": "mattermost-docker-mattermost-1",
"status": "Up 4 days (healthy)",
"ports": ""
},
{
"name": "twenty",
"status": "Up 4 days",
"ports": ""
},
{
"name": "twenty-redis",
"status": "Up 4 days",
"ports": ""
},
{
"name": "langfuse",
"status": "Up 4 days",
"ports": ""
},
{
"name": "redis-weval",
"status": "Up 5 days",
"ports": ""
},
{
"name": "gitea",
"status": "Up 5 days",
"ports": ""
},
{
"name": "node-exporter",
"status": "Up 5 days",
"ports": ""
},
{
"name": "prometheus",
"status": "Up 5 days",
"ports": ""
},
{
"name": "searxng",
"status": "Up 5 days",
"ports": ""
},
{
"name": "uptime-kuma",
"status": "Up 14 hours (healthy)",
"ports": ""
},
{
"name": "vaultwarden",
"status": "Up 5 days (healthy)",
"ports": ""
},
{
"name": "qdrant",
"status": "Up 5 days",
"ports": ""
}
],
"crons": {
"active": 35
},
"git": {
"head": "cd651f6c1 auto-sync-1545",
"dirty": 3,
"status": "DIRTY"
},
"nonreg": {
"total": 153,
"passed": 153,
"score": "100%"
},
"services": [
{
"name": "DeerFlow",
"port": 3002,
"status": "UP"
},
{
"name": "DeerFlow API",
"port": 8001,
"status": "UP"
},
{
"name": "Qdrant",
"port": 6333,
"status": "UP"
},
{
"name": "Ollama",
"port": 11434,
"status": "UP"
},
{
"name": "Redis",
"port": 6379,
"status": "UP"
},
{
"name": "Sovereign",
"port": 4000,
"status": "UP"
},
{
"name": "SearXNG",
"port": 8080,
"status": "UP"
}
],
"whisper": {
"binary": "COMPILED",
"model": "142MB"
},
"grand_total": 3541,
"health": {
"score": 5,
"max": 6,
"pct": 83
},
"elapsed_ms": 10918
}

View File

@@ -0,0 +1,105 @@
[
{
"page": "weval-technology-platform",
"diag": {
"url": "https://weval-consulting.com/weval-technology-platform.html",
"title": "WEVAL Technology Platform — All-in-One ERP Portal",
"body_len": 13397,
"is_login": false,
"canvas_count": 0,
"svg_count": 11,
"has_AG": false,
"AG_length": 0,
"has_DP": false,
"DP_length": 0,
"AG_dead": 0,
"AG_no_actions": 0,
"AG_anonymous": 0,
"data_arrays": {}
},
"errs": []
},
{
"page": "enterprise-model",
"diag": {
"url": "https://weval-consulting.com/enterprise-model.html",
"title": "WEVAL Enterprise Model",
"body_len": 433,
"is_login": false,
"canvas_count": 1,
"svg_count": 0,
"has_AG": true,
"AG_length": 572,
"has_DP": true,
"DP_length": 26,
"AG_dead": 0,
"AG_no_actions": 17,
"AG_anonymous": 0,
"data_arrays": {
"MULTI_AGENTS": 22,
"_lk": 27
}
},
"errs": []
},
{
"page": "wevia-em-big4",
"diag": {
"url": "https://weval-consulting.com/login?r=/wevia-em-big4.html",
"title": "WEVAL — Login",
"body_len": 89,
"is_login": true,
"canvas_count": 0,
"svg_count": 0,
"has_AG": false,
"AG_length": 0,
"has_DP": false,
"DP_length": 0,
"AG_dead": 0,
"AG_no_actions": 0,
"AG_anonymous": 0,
"data_arrays": {}
},
"errs": []
},
{
"page": "agents-archi",
"diag": {
"url": "https://weval-consulting.com/login?r=/agents-archi.html",
"title": "WEVAL — Login",
"body_len": 89,
"is_login": true,
"canvas_count": 0,
"svg_count": 0,
"has_AG": false,
"AG_length": 0,
"has_DP": false,
"DP_length": 0,
"AG_dead": 0,
"AG_no_actions": 0,
"AG_anonymous": 0,
"data_arrays": {}
},
"errs": []
},
{
"page": "value-streaming",
"diag": {
"url": "https://weval-consulting.com/login?r=/value-streaming.html",
"title": "WEVAL — Login",
"body_len": 89,
"is_login": true,
"canvas_count": 0,
"svg_count": 0,
"has_AG": false,
"AG_length": 0,
"has_DP": false,
"DP_length": 0,
"AG_dead": 0,
"AG_no_actions": 0,
"AG_anonymous": 0,
"data_arrays": {}
},
"errs": []
}
]

View File

@@ -1,7 +1,7 @@
{
"ok": true,
"version": "V83-business-kpi",
"ts": "2026-04-20T13:48:27+00:00",
"ts": "2026-04-20T13:49:55+00:00",
"summary": {
"total_categories": 7,
"total_kpis": 56,

View File

@@ -0,0 +1,98 @@
const { chromium } = require('playwright');
const fs = require('fs');
(async () => {
// Read creds from file (doctrine: never echo password)
const passFile = '/var/www/html/api/weval-passwords.json';
if (!fs.existsSync(passFile)) { console.error('no creds'); process.exit(1); }
const users = JSON.parse(fs.readFileSync(passFile, 'utf8'));
const USER = 'yacine';
const PASS = users[USER].password;
const browser = await chromium.launch({ headless: true });
const ctx = await browser.newContext({
viewport: { width: 1920, height: 1080 },
recordVideo: { dir: '/tmp/v94-videos/', size: { width: 1920, height: 1080 } }
});
const page = await ctx.newPage();
const results = [];
const errs = {};
// 1. LOGIN via API
const loginResp = await page.request.post('https://weval-consulting.com/api/weval-auth-session.php', {
form: { action: 'login', user: USER, pass: PASS, redirect: '/weval-technology-platform.html' }
});
const loginData = await loginResp.json();
console.log('LOGIN:', loginData.ok ? 'SUCCESS' : 'FAIL');
if (!loginData.ok) { process.exit(1); }
// Cookie is now in the context
// 2. Scenario business: navigate each critical page + screenshot + diagnose
const pages = [
{ name: 'weval-technology-platform', url: 'https://weval-consulting.com/weval-technology-platform.html' },
{ name: 'enterprise-model', url: 'https://weval-consulting.com/enterprise-model.html' },
{ name: 'wevia-em-big4', url: 'https://weval-consulting.com/wevia-em-big4.html' },
{ name: 'agents-archi', url: 'https://weval-consulting.com/agents-archi.html' },
{ name: 'value-streaming', url: 'https://weval-consulting.com/value-streaming.html' }
];
for (const p of pages) {
const localErrs = [];
const pagerr = e => localErrs.push('pageerr: ' + e.message.substring(0, 200));
const conerr = m => { if (m.type() === 'error') localErrs.push('con: ' + m.text().substring(0, 200)); };
page.on('pageerror', pagerr);
page.on('console', conerr);
try {
await page.goto(p.url, { waitUntil: 'load', timeout: 30000 });
await page.waitForTimeout(7000);
const diag = await page.evaluate(() => {
const diag = {
url: location.href,
title: document.title,
body_len: document.body.innerText.length,
is_login: location.href.includes('login'),
canvas_count: document.querySelectorAll('canvas').length,
svg_count: document.querySelectorAll('svg').length,
// Check AG/DP exposure for agents-viewing pages
has_AG: typeof AG !== 'undefined',
AG_length: typeof AG !== 'undefined' ? AG.length : 0,
has_DP: typeof DP !== 'undefined',
DP_length: typeof DP !== 'undefined' ? DP.length : 0,
// Dead / empty stats
AG_dead: typeof AG !== 'undefined' ? AG.filter(a => a && a.rm === 'dead').length : 0,
AG_no_actions: typeof AG !== 'undefined' ? AG.filter(a => a && (!a.act || a.act.length === 0 || (a.act[0] === 'Sync' && a.act.length === 4))) .length : 0,
AG_anonymous: typeof AG !== 'undefined' ? AG.filter(a => !a || !a.n || !a.n.trim()).length : 0,
// Generic data arrays
data_arrays: (() => {
const res = {};
for (const k of Object.keys(window)) {
const v = window[k];
if (Array.isArray(v) && v.length > 5 && v.length < 2000 && typeof v[0] === 'object') {
res[k] = v.length;
}
}
return res;
})()
};
return diag;
});
await page.screenshot({ path: `/tmp/v94-${p.name}.png`, fullPage: true });
results.push({ page: p.name, diag, errs: localErrs.slice(0, 3) });
} catch (e) {
results.push({ page: p.name, err: e.message.substring(0, 200) });
}
page.off('pageerror', pagerr);
page.off('console', conerr);
}
await ctx.close();
await browser.close();
fs.writeFileSync('/var/www/html/api/playwright-v94-selenium-authed.json', JSON.stringify(results, null, 2));
console.log(JSON.stringify(results, null, 2));
})();

View File

@@ -251,6 +251,13 @@ case 'browser_inject_session':
echo json_encode($data ?: ['raw' => substr($out, 0, 300)], JSON_PRETTY_PRINT);
break;
case 'v99_auto_login':
$out = shell_exec("cd /tmp && timeout 60 python3 /opt/weval-l99/v99-linkedin-auto-login.py 2>&1");
$data = @json_decode(trim($out), true);
echo json_encode($data ?: ['raw'=>substr($out,0,400)], JSON_PRETTY_PRINT);
break;
default:
echo json_encode(['err'=>'unknown_action','available'=>['overview','approve','schedule','publish_now','reject','auto_publish_due','log','all_queues','browser_publish_id','browser_publish_due','browser_session_status','browser_inject_session']]);
}

View File

@@ -0,0 +1,98 @@
<?php
header("Content-Type: application/json");
header("Access-Control-Allow-Origin: *");
/**
* V9.31 Unified Orchestrator
* Fusion WEVIA Master + S204 + S95 + GPUs Free + Blade
* Single source of truth for all workers
*/
$started = microtime(true);
function fetch_json($url, $timeout=3) {
$ctx = stream_context_create(["http"=>["timeout"=>$timeout,"ignore_errors"=>true],
"ssl"=>["verify_peer"=>false,"verify_peer_name"=>false]]);
$raw = @file_get_contents($url, false, $ctx);
return $raw ? json_decode($raw, true) : null;
}
// 1. WEVIA Master (S204)
$wevia_ok = true;
$wevia_intents = fetch_json("http://127.0.0.1/api/wevia-master-api.php?health=1", 2);
// 2. S204 (self)
$load = sys_getloadavg();
$s204 = [
"alive" => true,
"host" => "204.168.152.13",
"load_1m" => round($load[0], 2),
"load_5m" => round($load[1], 2),
"uptime_s" => (int)shell_exec("cat /proc/uptime | awk "{print int(\$1)}"")
];
// 3. S95 via sentinel
$s95_raw = fetch_json("http://10.1.0.3:5890/api/sentinel-brain.php?action=ping", 3);
$s95 = [
"alive" => !!$s95_raw,
"host" => "10.1.0.3",
"sentinel_response" => $s95_raw ? "ok" : "timeout",
"ts" => date("c")
];
// 4. Blade heartbeat
$blade_file = "/var/www/html/api/blade-heartbeat.json";
$blade_hb = file_exists($blade_file) ? json_decode(file_get_contents($blade_file), true) : null;
$blade_age_s = 999999;
if ($blade_hb && isset($blade_hb["last_heartbeat_ts_epoch"])) {
$blade_age_s = time() - (int)$blade_hb["last_heartbeat_ts_epoch"];
}
$blade = [
"alive" => $blade_age_s < 300,
"last_heartbeat_age_s" => $blade_age_s,
"tasks_today" => $blade_hb["tasks_today"] ?? 0,
"tasks_week" => $blade_hb["tasks_week"] ?? 0
];
// 5. Blade queue
$q_file = "/var/www/html/api/blade-queue.json";
$queue = file_exists($q_file) ? json_decode(file_get_contents($q_file), true) : [];
$queue_stats = ["total" => count($queue), "recent" => 0, "stale" => 0];
$now_ts = time();
foreach ($queue as $t) {
$ts = $t["created_at"] ?? $t["ts"] ?? "";
if ($ts) {
$age = $now_ts - strtotime($ts);
if ($age < 7200) $queue_stats["recent"]++;
else $queue_stats["stale"]++;
}
}
// 6. GPU Free providers
$gpu_providers = ["cerebras","groq","sambanova","nvidia","gemini","together","huggingface","replicate","cohere","openrouter","zhipu"];
$gpu_status = ["total" => count($gpu_providers), "sovereign_cost_eur" => 0];
// 7. Unified status
$all_ok = $wevia_ok && $s204["alive"] && $s95["alive"] && $blade["alive"];
$out = [
"ok" => $all_ok,
"v" => "V9.31-unified-orchestrator",
"ts" => date("c"),
"duration_ms" => round((microtime(true)-$started)*1000, 1),
"nodes" => [
"wevia_master" => ["alive" => $wevia_ok, "host" => "localhost"],
"s204" => $s204,
"s95" => $s95,
"blade" => $blade,
"gpu_free" => $gpu_status
],
"queue" => $queue_stats,
"orchestration" => [
"doctrine" => "#12 WEVIA-FIRST + #7 autonomous",
"unified_since" => "V9.31",
"workers_online" => count(array_filter([$wevia_ok, $s204["alive"], $s95["alive"], $blade["alive"]])),
"workers_total" => 4
]
];
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);