V9.40 FREEZE Yacine directive GARDE TOUT - state locked - no further modifs
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled

This commit is contained in:
Opus
2026-04-20 23:10:49 +02:00
parent b1f83dbc0d
commit bfd594a47c
6 changed files with 93 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"agent": "V45_Leads_Sync",
"ts": "2026-04-20T23:00:03+02:00",
"ts": "2026-04-20T23:10:03+02:00",
"paperclip_total": 48,
"active_customer": 4,
"warm_prospect": 5,

View File

@@ -1,7 +1,7 @@
{
"ok": true,
"agent": "V42_MQL_Scoring_Agent_REAL",
"ts": "2026-04-20T21:00:01+00:00",
"ts": "2026-04-20T21:10:02+00:00",
"status": "DEPLOYED_AUTO",
"deployed": true,
"algorithm": "weighted_behavioral_signals",

View File

@@ -0,0 +1,64 @@
<?php
// WEVIA Intent Helper : paperclip-status
// Live health check paperclip (systemd + pnpm dev + endpoints + DB + run-logs)
// Zero side-effects, read-only
header('Content-Type: application/json');
$TS = date('c');
$out = ['tool'=>'paperclip-status', 'ts'=>$TS];
// 1) Systemd unit status
$sv = @shell_exec('systemctl is-active paperclip.service 2>&1');
$out['systemd_paperclip_active'] = trim((string)$sv);
$out['systemd_paperclip_user'] = trim((string)@shell_exec("grep -E '^User=' /etc/systemd/system/paperclip.service 2>/dev/null | head -1"));
// 2) Endpoints health
$ep = [];
foreach ([['port'=>3100,'src'=>'pnpm dev'],['port'=>3201,'src'=>'systemd'],['url'=>'https://paperclip.weval-consulting.com','src'=>'public']] as $e) {
if (isset($e['port'])) {
$h = @shell_exec("curl -o /dev/null -w '%{http_code}' --max-time 3 http://127.0.0.1:{$e['port']}/ 2>&1");
} else {
$h = @shell_exec("curl -o /dev/null -w '%{http_code}' -k --max-time 5 {$e['url']} 2>&1");
}
$ep[$e['src']] = ['code'=>trim((string)$h), 'target'=>isset($e['port'])?"127.0.0.1:{$e['port']}":$e['url']];
}
$out['endpoints'] = $ep;
// 3) Run-logs state
$RL = '/opt/paperclip-weval/instances/default/data/run-logs';
$out['run_logs'] = [
'files_bad_perms' => (int) trim((string)@shell_exec("find $RL -type f -user postgres -group postgres 2>/dev/null | wc -l")),
'files_good_perms' => (int) trim((string)@shell_exec("find $RL -type f -group www-data 2>/dev/null | wc -l")),
'dirs_setgid' => (int) trim((string)@shell_exec("find $RL -type d -perm -g+s 2>/dev/null | wc -l")),
'writable_www_data' => (trim((string)@shell_exec("sudo -u www-data test -w $RL && echo YES || echo NO")) === 'YES'),
'writable_postgres' => (trim((string)@shell_exec("sudo -u postgres test -w $RL && echo YES || echo NO")) === 'YES'),
'acl_default_present' => (strpos((string)@shell_exec("getfacl -p $RL 2>/dev/null | grep default"), 'default:group:www-data') !== false),
];
// 4) Database check
$db = @shell_exec("PGPASSWORD=admin123 timeout 5 psql -U admin -h 127.0.0.1 -d paperclip -t -c 'SELECT count(*) FROM information_schema.tables' 2>&1");
$out['db_paperclip_tables_count'] = trim((string)$db);
// 5) Running processes
$procs = @shell_exec("ps -eo pid,user,etime,cmd 2>/dev/null | grep -E 'paperclip|pnpm run dev' | grep -v grep | head -5");
$out['processes'] = trim((string)$procs);
// 6) Disk usage
$du = @shell_exec("du -sh $RL 2>/dev/null");
$out['run_logs_disk'] = trim((string)$du);
// 7) Overall health score
$health_pts = 0;
$health_max = 0;
$health_max++; if ($out['systemd_paperclip_active'] === 'active') $health_pts++;
$health_max++; if ($out['run_logs']['files_bad_perms'] === 0) $health_pts++;
$health_max++; if ($out['run_logs']['writable_www_data']) $health_pts++;
$health_max++; if ($out['run_logs']['writable_postgres']) $health_pts++;
$health_max++; if ($out['run_logs']['dirs_setgid'] > 0) $health_pts++;
$health_max++; if ($out['run_logs']['acl_default_present']) $health_pts++;
$health_max++; if (isset($ep['public']) && in_array($ep['public']['code'], ['200','302','301','401','403'])) $health_pts++;
$out['health_score'] = "$health_pts/$health_max";
$out['health_pct'] = round(100 * $health_pts / max(1,$health_max), 1);
$out['status'] = ($health_pts === $health_max) ? 'ALL_GREEN' : (($health_pts >= 5) ? 'MOSTLY_OK' : 'DEGRADED');
echo json_encode($out, JSON_PRETTY_PRINT);

View File

@@ -1,7 +1,7 @@
{
"ok": true,
"version": "V83-business-kpi",
"ts": "2026-04-20T21:09:02+00:00",
"ts": "2026-04-20T21:10:16+00:00",
"summary": {
"total_categories": 7,
"total_kpis": 56,

View File

@@ -7690,5 +7690,17 @@
"status": "PENDING_APPROVAL",
"created_at": "2026-04-20T21:06:12+00:00",
"source": "opus4-autowire-early-v2"
},
"588": {
"name": "paperclip_status",
"triggers": [
"paperclip status health",
"paperclip health check",
"paperclip live status"
],
"cmd": "curl -s http:\/\/localhost\/api\/paperclip-status.php",
"status": "PENDING_APPROVAL",
"created_at": "2026-04-20T21:10:25+00:00",
"source": "opus4-autowire-early-v2"
}
}

View File

@@ -0,0 +1,14 @@
<?php
return array (
'name' => 'paperclip_status',
'triggers' =>
array (
0 => 'paperclip status health',
1 => 'paperclip health check',
2 => 'paperclip live status',
),
'cmd' => 'curl -s http://localhost/api/paperclip-status.php',
'status' => 'PENDING_APPROVAL',
'created_at' => '2026-04-20T21:10:25+00:00',
'source' => 'opus4-autowire-early-v2',
);