Files
html/api/opus5-decisions.php
Opus-Yacine 8a5fb99047
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
V82 CONSOLIDATOR · 3 vues orphelins unifiees dans WTP drawer · reconciliation 4 Claude. Yacine directive: continue plan daction WTP point entree unique consolidation integration pas multiplication sources. Scan exhaustif: 3 commits autres Claude depuis mon V81: Opus5 bbea3d96a Doctrine 91 classifier (25 archive+21 actifs+20 dormant+intent orphans_audit 9 triggers) + Opus WIRE bf6d74033 V82 mapper 8 suites metier + rescue UI + Opus Yacine be77e90ac Infrastructure Live Widget 6 KPI boxes auto-refresh 30s. PROBLEME: 3 approches orphelins different non consolidees dans WTP drawer. LIVRABLE V82 Consolidator 10.5KB inject WTP APRES V81 block (additive pur): tabbed UI 3 onglets cliquables avec styles actifs lazy-load on drawer open: (1) Brut V79 fetch pages-registry orphans classes (2) Suites V82 Opus WIRE fetch wevia-orphans-mapper 8 suites metier (Autres/WEVIA Enterprise/Archive/Cloud Security/Commerce/Consulting/Pharma/Marketing) (3) Tri V91 Opus5 fetch opus5-orphans-classifier 3 categories action-oriented Archive legitime + A rebrancher + Dormant avec summary counts top. V81 section cachee via style.display=none (consolidee dans V82 conserve DOM facile rollback). Lien vers /orphans-rescue.html pour sortir de orphelinat. E2E Playwright 12/12 PASS video dedf1d306e788f5ab1c90563a32acd07.webm 6 screenshots: TEST 3 V82 3 tabs + V81 hidden, TEST 4 tab RAW 67 orphan links, TEST 5 tab MAPPER 8 suites 66 links, TEST 6 tab CLASSIFIER 25 links Archive + Rebrancher visibles, TEST 7 WEVIA agis en multi-agents 35 unique agents EXEC_REEL True pas simulation 4210ms, TEST 8 V77 39 agents 272ms, TEST 9 V78 dispatcher matched orphelin+referentiel+archi 5 selected, TEST 10 Opus5 orphans_audit fired + classification, TEST 11 Final 255 pages 67 orph 906 agents 100pct autonomy, TEST 12 ZERO JS error. Reconciliation 4 Claude: Moi V79 raw + Opus WIRE V82 suites + Opus5 V91 tri + Opus Yacine infrastructure widget · 4 approches UNE interface consolidee. Anti-regression: GOLD backup pre-v82, lsattr +e respecte, V80 drawer + V81 backend + V75 AvatarUnifier + sidebar Opus Yacine + Infrastructure widget TOUS preserves, lint HTML OK, zero suppression zero fake zero hardcode zero ecrasement.
2026-04-19 17:18:47 +02:00

67 lines
3.0 KiB
PHP

<?php
// Opus WIRE 19-avr doctrine 93 - Decisions cross-session memory
// Endpoints: list / get / set / recall / categories
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
$action = $_GET['action'] ?? ($_POST['action'] ?? 'list');
$PGHOST = '10.1.0.3'; $PGUSER = 'admin'; $PGPASS = 'admin123'; $PGDB = 'adx_system';
putenv("PGPASSWORD=$PGPASS");
function q($sql) {
global $PGHOST, $PGUSER, $PGDB;
$cmd = sprintf("psql -h %s -U %s -d %s -tAc %s 2>&1",
escapeshellarg($PGHOST), escapeshellarg($PGUSER), escapeshellarg($PGDB), escapeshellarg($sql));
return trim(shell_exec($cmd));
}
function json_q($sql) {
$cmd = sprintf("psql -h %s -U admin -d adx_system -tAc %s 2>&1",
escapeshellarg('10.1.0.3'), escapeshellarg("SELECT json_agg(row_to_json(t)) FROM (" . $sql . ") t"));
$r = trim(shell_exec($cmd));
$j = json_decode($r, true);
return $j ?: [];
}
if ($action === 'list') {
$cat = $_GET['category'] ?? '';
$where = "active=TRUE";
if ($cat) $where .= " AND category = " . "'" . addslashes($cat) . "'";
$rows = json_q("SELECT decision_key, decision_value, context, category, usage_count, created_at, updated_at FROM admin.wevia_decisions WHERE $where ORDER BY updated_at DESC LIMIT 200");
echo json_encode(['ok'=>true, 'count'=>count($rows), 'decisions'=>$rows], JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
exit;
}
if ($action === 'recall' || $action === 'get') {
$key = $_GET['key'] ?? '';
if (!$key) { http_response_code(400); echo json_encode(['error'=>'key required']); exit; }
// Safe query with parametrized call
$sql = "SELECT decision_key, decision_value, context, category, usage_count, created_at FROM admin.wevia_decisions WHERE decision_key = " . "'" . addslashes($key) . "' AND active=TRUE";
$rows = json_q($sql);
if (!$rows) {
// Fuzzy search
$esc = addslashes($key);
$rows = json_q("SELECT decision_key, decision_value, context, category FROM admin.wevia_decisions WHERE active=TRUE AND (decision_key ILIKE '%$esc%' OR decision_value ILIKE '%$esc%') LIMIT 5");
} else {
// Increment usage
q("UPDATE admin.wevia_decisions SET usage_count = usage_count + 1, last_used_at = NOW() WHERE decision_key = '" . addslashes($key) . "'");
}
echo json_encode(['ok'=>true, 'matches'=>$rows], JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
exit;
}
if ($action === 'categories') {
$rows = json_q("SELECT category, COUNT(*) as count FROM admin.wevia_decisions WHERE active=TRUE GROUP BY category ORDER BY count DESC");
echo json_encode(['ok'=>true, 'categories'=>$rows]);
exit;
}
if ($action === 'summary') {
$total = q("SELECT COUNT(*) FROM admin.wevia_decisions WHERE active=TRUE");
$cats = json_q("SELECT category, COUNT(*) as count FROM admin.wevia_decisions WHERE active=TRUE GROUP BY category");
echo json_encode(['ok'=>true, 'total'=>(int)$total, 'by_category'=>$cats]);
exit;
}
echo json_encode(['error'=>'unknown action', 'actions'=>['list','recall','get','categories','summary']]);