Files
html/api/weval-archi-manifest.php
2026-04-20 11:53:10 +02:00

194 lines
12 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// =============================================================
// WEVAL ARCHI MANIFEST V82 · Source of truth unifiée · Opus 20avr
// Doctrine #14 enrichissement · zéro duplication source
// Consommé par: tous les dashboards (WTP, admin, business-kpi, CRM, etc.)
// =============================================================
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store, must-revalidate');
header('Access-Control-Allow-Origin: *');
// --- 1. META HEALTH LIVE (lu depuis caches/endpoints existants) ---
$l99_cache = @json_decode(@file_get_contents('/tmp/l99-honest-cache.json'), true);
$disk_pct = (int)trim(@shell_exec("df / --output=pcent | tail -1 | tr -d ' %'"));
$meta = [
'ts' => date('c'),
'nr_master' => [
'pass' => $l99_cache['master']['pass'] ?? 0,
'total' => $l99_cache['master']['total'] ?? 72,
'fail' => $l99_cache['master']['fail'] ?? 0,
],
'nr_opus' => [
'pass' => $l99_cache['opus']['pass'] ?? 0,
'total' => $l99_cache['opus']['total'] ?? 129,
'fail' => $l99_cache['opus']['fail'] ?? 0,
],
'nr_combined' => [
'pass' => $l99_cache['combined']['pass'] ?? 0,
'total' => $l99_cache['combined']['total'] ?? 201,
'fail' => $l99_cache['combined']['fail'] ?? 0,
'pct' => $l99_cache['pct'] ?? 0,
'sigma' => $l99_cache['sigma'] ?? 'unknown',
],
'disk' => [
'used_pct' => $disk_pct,
'threshold' => 80,
'status' => $disk_pct <= 80 ? 'ok' : ($disk_pct <= 90 ? 'warn' : 'critical'),
],
'cache_age_sec' => isset($l99_cache) && @filemtime('/tmp/l99-honest-cache.json') ? (time() - @filemtime('/tmp/l99-honest-cache.json')) : null,
];
// --- 2. SERVEURS & INFRA ---
$servers = [
['key'=>'s204', 'name'=>'S204 Primary', 'ip'=>'204.168.152.13', 'host'=>'Hetzner', 'role'=>'main (apps, WEVIA, adx_system, twenty_db, paperclip)', 'status'=>'live'],
['key'=>'s95', 'name'=>'S95 WEVADS', 'ip'=>'95.216.167.89', 'host'=>'Hetzner', 'role'=>'WEVADS Arsenal + Ethica HCPs', 'status'=>'live'],
['key'=>'s202', 'name'=>'S202 PMTA', 'ip'=>'—', 'host'=>'Hetzner', 'role'=>'PMTA email delivery (MTA-only)', 'status'=>'live'],
['key'=>'blade', 'name'=>'Blade yacineutt', 'ip'=>'41.251.46.132', 'host'=>'Razer Windows', 'role'=>'sentinel + tasks executor', 'status'=>'live'],
['key'=>'huawei_ecs', 'name'=>'4 ECS Huawei', 'ip'=>'110.239.x.x / 182.160.x.x', 'host'=>'Huawei Cloud', 'role'=>'PMTA 4.5r8 pool', 'status'=>'live'],
['key'=>'s88', 'name'=>'S88 decommissioned', 'ip'=>'—', 'host'=>'Hetzner', 'role'=>'cancelled 29mars2026', 'status'=>'decommissioned'],
['key'=>'s151', 'name'=>'S151 decommissioned', 'ip'=>'—', 'host'=>'Hetzner', 'role'=>'tracking migré vers S204 12avr', 'status'=>'decommissioned'],
];
// --- 3. BASES DE DONNÉES ---
$databases = [
['key'=>'adx_system', 'engine'=>'PostgreSQL 13', 'host'=>'127.0.0.1:5432', 'schemas'=>['admin','crm','public'], 'role'=>'système global + visitors + forms'],
['key'=>'adx_clients', 'engine'=>'PostgreSQL 13', 'host'=>'127.0.0.1:5432', 'schemas'=>['clients'], 'role'=>'6.65M contacts business'],
['key'=>'twenty_db', 'engine'=>'PostgreSQL 16 (Docker)', 'host'=>'127.0.0.1:5432', 'schemas'=>['workspace_c8qrnq9rmk5wya777sxdjsfb5'], 'role'=>'Twenty CRM: 37341 companies + 60351 people + 6 opps'],
['key'=>'paperclip', 'engine'=>'PostgreSQL', 'host'=>'10.1.0.3', 'role'=>'paperclip.weval-consulting.com · 48 leads + 674 agents'],
['key'=>'ethica_s95', 'engine'=>'PostgreSQL', 'host'=>'S95 95.216.167.89', 'db'=>'ethica.medecins_real', 'count'=>141661, 'role'=>'HCPs Maghreb SOURCE OF TRUTH (S204 copy obsolete)'],
['key'=>'wevia_kb', 'engine'=>'SQLite', 'tables'=>32, 'entries'=>2490, 'role'=>'Knowledge base INTERNAL ONLY'],
['key'=>'qdrant', 'engine'=>'Qdrant vector', 'host'=>'Docker', 'vectors'=>22101, 'role'=>'RAG embeddings'],
];
// --- 4. 4 CRMs UNIFIÉS ---
$crms = [
['key'=>'paperclip', 'name'=>'Paperclip CRM', 'url'=>'https://paperclip.weval-consulting.com', 'db'=>'paperclip', 'count'=>48, 'role'=>'leads B2B + 674 agents pool'],
['key'=>'twenty', 'name'=>'Twenty CRM', 'url'=>'https://crm.weval-consulting.com', 'db'=>'twenty_db', 'count'=>['companies'=>37341,'people'=>60351,'opps'=>6], 'role'=>'scrapé enriched'],
['key'=>'forms', 'name'=>'Forms Visitors', 'url'=>'/admin/forms', 'db'=>'adx_system.public', 'count'=>75, 'role'=>'form submissions site public'],
['key'=>'weval_deals', 'name'=>'WEVAL Deal Tracker', 'url'=>'https://weval-consulting.com/crm.html', 'db'=>'adx_system.crm', 'count'=>6, 'pipeline'=>'104300€', 'role'=>'deals Vistex+Huawei+Ethica+Carrefour+Cosumar'],
];
// --- 5. DASHBOARDS & POINTS D'ENTRÉE ---
$dashboards = [
'canonical' => [
['key'=>'wtp', 'name'=>'WEVAL Technology Platform', 'url'=>'/weval-technology-platform.html', 'role'=>'POINT D\'ENTRÉE OFFICIEL · 16 modules ERP · auth gate', 'priority'=>1],
['key'=>'wevia_master', 'name'=>'WEVIA Master Chat', 'url'=>'/wevia-master.html', 'role'=>'multi-agent · auto-wire · SSE', 'priority'=>2],
],
'business' => [
['key'=>'business_kpi_v83', 'name'=>'Business KPI V83 SaaS', 'url'=>'/business-kpi-dashboard.php', 'role'=>'56 KPIs · 7 cats · drill-down'],
['key'=>'dg_center_v69', 'name'=>'DG Command Center', 'url'=>'/dg-command-center.html', 'role'=>'TOC · Conversion · Risk'],
['key'=>'intel_growth_v71', 'name'=>'Intelligence & Growth', 'url'=>'/intelligence-growth-insights.html', 'role'=>'DarkScout + Agility + Leads'],
['key'=>'enterprise_complete', 'name'=>'Enterprise Complete', 'url'=>'/enterprise-complete.html', 'role'=>'20 depts · 169 KPIs · 61 intégrations'],
],
'crm' => [
['key'=>'crm_v68_premium', 'name'=>'Admin CRM V68 Premium', 'url'=>'/wevia-ia/wevia-admin-crm-v68.php', 'role'=>'3 CRMs + SaaS + visitors rich'],
['key'=>'crm_v67', 'name'=>'Admin CRM V67', 'url'=>'/wevia-ia/wevia-admin-crm.php', 'role'=>'Bridge paperclip+forms'],
['key'=>'crm_weval_deals', 'name'=>'WEVAL Deal Tracker', 'url'=>'/crm.html', 'role'=>'6 deals 104k€'],
['key'=>'twenty_crm', 'name'=>'Twenty 37k CRM', 'url'=>'https://crm.weval-consulting.com', 'role'=>'37k companies'],
],
'ia' => [
['key'=>'wevia_training', 'name'=>'WEVIA Training', 'url'=>'/wevia-training.html', 'role'=>'auto-training + benchmark + Kaizen'],
['key'=>'unified_hub', 'name'=>'Unified Hub', 'url'=>'/wevia-unified-hub.html', 'role'=>'agents + intents + skills + dashboards'],
['key'=>'autonomy', 'name'=>'Autonomy Dashboard', 'url'=>'/wevia-autonomy-dashboard.html', 'role'=>'KPI Lean 6 Sigma'],
['key'=>'portal_exec', 'name'=>'Portal Exécutif', 'url'=>'/wevia-portal-executif.html', 'role'=>'6 piliers premium'],
],
'infra' => [
['key'=>'archi', 'name'=>'Architecture', 'url'=>'/archi.html'],
['key'=>'archi_map', 'name'=>'Archi Map', 'url'=>'/archi-map.html'],
['key'=>'monitoring', 'name'=>'Monitoring Kuma', 'url'=>'https://monitor.weval-consulting.com'],
['key'=>'blade', 'name'=>'Blade/GPU', 'url'=>'/blade-dashboard.html'],
],
'pharma' => [
['key'=>'ethica', 'name'=>'Ethica HCPs Maghreb', 'url'=>'/ethica-dashboard.html', 'role'=>'141k médecins DZ+MA+TN'],
['key'=>'consent', 'name'=>'Ethica Consent', 'url'=>'https://ethica.wevup.app', 'role'=>'consent collection'],
],
'email' => [
['key'=>'wevads_arsenal', 'name'=>'WEVADS Arsenal', 'url'=>'https://wevads.weval-consulting.com', 'role'=>'1432 screens · email platform'],
],
];
// --- 6. APIS CORE ---
$core_apis = [
'meta' => ['/api/weval-archi-manifest.php (THIS)', '/api/l99-honest.php', '/api/truth-registry.json'],
'wevia' => ['/api/wevia-master-api.php', '/api/wevia-safe-write.php', '/api/cx (sentinel)', '/api/wevia-v64-departments-kpi.php'],
'crm' => ['/api/wevia-admin-crm-bridge-v68.php (4 CRMs + quadruple lookup)', '/api/crm-api.php', '/api/paperclip-api.php'],
'nonreg' => ['/api/nonreg-master.php (72 tests)', '/api/nonreg-opus.php (129 tests)', '/api/l99-honest.php (combined)'],
'ia' => ['/api/weval-ia-full (sovereign cascade 13 providers)', '/api/weval-chatbot-api.php', 'http://127.0.0.1:11434 (Ollama local)'],
'business' => ['/api/wevia-v83-business-kpi.php (56 KPIs)'],
];
// --- 7. DOCTRINES CLÉS (résumé) ---
$doctrines = [
1 => 'Lire wiki + vault + plan AVANT et APRÈS',
2 => 'ZÉRO régression - NonReg 100% après chaque modif',
3 => 'GOLD backup obligatoire avant modif',
4 => 'HONNÊTETÉ ABSOLUE - jamais mentir',
5 => 'Séquence bloquante GOLD→commit→mockup→valid→modif',
6 => 'STRIKE RULE - problème 2x = root cause fix structurel',
7 => 'ZÉRO COMMANDE MANUELLE - WEVIA exécute via intents',
12 => 'WEVIA-FIRST - tous acts via /api/wevia-master-api.php',
13 => 'CAUSE RACINE - pas de workarounds',
14 => 'Écrans intouchables SAUF amélioration additive',
16 => 'NonReg mandatory avant chaque livraison',
60 => 'UX premium ULTRA partout',
77 => 'Every-gated-write-needs-read-guide',
];
// --- 8. SESSIONS HISTORY V67-V81 ---
$sessions_v67_v81 = [
'V67' => ['what'=>'CRM Bridge Admin (2 CRMs)','impact'=>'Paperclip+Forms unified'],
'V68' => ['what'=>'3 CRMs + SaaS chat + visitors rich','impact'=>'Twenty 37k + triple lookup'],
'V69' => ['what'=>'4ème CRM (WEVAL deals 104k€)','impact'=>'Quadruple lookup domain match'],
'V70' => ['what'=>'WTP drill-down sidebar + drawer','impact'=>'6 piliers + CRM tab'],
'V71' => ['what'=>'Business KPI V83 drill-down + charts','impact'=>'Doughnut + bars + 56 sparklines'],
'V71b' => ['what'=>'Archi complete → topbar','impact'=>'UX Yacine'],
'V72' => ['what'=>'Universal drill-down JS lib','impact'=>'v72-drilldown-universal.js propagé'],
'V73' => ['what'=>'Fix dashboard bugs','impact'=>'Doughnut 51.8% · Top8 hétérogène'],
'V75' => ['what'=>'Disk 82%→80%','impact'=>'Docker prune -2.26GB'],
'V76' => ['what'=>'NR 69→70/72','impact'=>'Analyse fails root cause'],
'V77' => ['what'=>'Throttle 1.2s api()','impact'=>'NR 71/72'],
'V78' => ['what'=>'SP UTF-8 bytes protégé','impact'=>'Master 72/72'],
'V79' => ['what'=>'15 Depts 82.7%→90.7%','impact'=>'14/14 OK · 0 WARN'],
'V80' => ['what'=>'Opus SP+XSS+DocGen widened','impact'=>'99% combined'],
'V81' => ['what'=>'api() retry empty response','impact'=>'201/201 = 100% 6σ ATTEINT 🏆'],
];
// --- 9. COUNT GLOBAUX (truth stats) ---
$stats = [
'agents' => 906,
'pages' => 280,
'apis' => 730,
'infra_components' => 23,
'docker_containers' => 19,
'providers_sovereign' => 13,
'subdomains_active' => 13,
'hcps_maghreb' => 146694,
'contacts_adx' => 6650000,
'doctrines_active' => 58,
'rag_vectors' => 22101,
'departements' => 15,
'erp_integrations' => 61,
'crms_unified' => 4,
'sessions_opus_wire' => 'V67-V81 (15 sessions consécutives sans régression)',
];
echo json_encode([
'ok' => true,
'version' => 'V82-archi-manifest-20avr2026',
'purpose' => 'Source of truth unifiée pour toute l\'archi WEVAL',
'canonical_entry_point' => 'https://weval-consulting.com/weval-technology-platform.html',
'master_chat' => 'https://weval-consulting.com/wevia-master.html',
'meta_health' => $meta,
'servers' => $servers,
'databases' => $databases,
'crms' => $crms,
'dashboards' => $dashboards,
'core_apis' => $core_apis,
'doctrines_key' => $doctrines,
'sessions_v67_v81' => $sessions_v67_v81,
'stats' => $stats,
'note' => 'Doctrine #14 additif pur · doctrine #4 honnête · doctrine #13 cause racine',
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);