!in_array($x, ['.', '..']))); } function count_symlink_recursive($base, $max_depth = 2) { if (!is_dir($base)) return 0; $c = 0; $it = @new RecursiveIteratorIterator( new RecursiveDirectoryIterator($base, FilesystemIterator::FOLLOW_SYMLINKS | FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY ); $it->setMaxDepth($max_depth); foreach ($it as $f) { $name = $f->getFilename(); if (in_array($name, ['SKILL.md', 'README.md', 'index.md'])) $c++; if ($c > 10000) break; // safety } return $c; } if ($action === 'full') { $acquired = []; // === CATEGORIE 1: INTENTS WIRED (54 total + V62 autre Claude) === $intents_wired = [ ['category'=>'Phase1 PDNS', 'count'=>10, 'version'=>'V42 garde-fous', 'live'=>true], ['category'=>'Phase2 track S95', 'count'=>8, 'version'=>'V42 CF-Bypass', 'live'=>true], ['category'=>'V42 garde-fous', 'count'=>6, 'version'=>'V42', 'live'=>true], ['category'=>'V46 autonomie', 'count'=>7, 'version'=>'V46', 'live'=>true], ['category'=>'V47 WEVADS business', 'count'=>9, 'version'=>'V47', 'live'=>true], ['category'=>'V48 Partenariats', 'count'=>7, 'version'=>'V48 Vistex/Huawei/Arrow/WEM', 'live'=>true], ['category'=>'V53 Ops/Monitoring', 'count'=>5, 'version'=>'V53', 'live'=>true], ['category'=>'V56 Meta/Multiagent', 'count'=>2, 'version'=>'V56', 'live'=>true], ['category'=>'V61 Tier1+RAG', 'count'=>8, 'version'=>'V61 18avr', 'live'=>true, 'new'=>true], ['category'=>'V62 Acquis diff+L6S', 'count'=>2, 'version'=>'V62 18avr (moi)', 'live'=>true, 'new'=>true], ['category'=>'V62 Wire autre Claude', 'count'=>5, 'version'=>'V62 18avr (gated)', 'live'=>true, 'new'=>true], ]; $total_intents = array_sum(array_column($intents_wired, 'count')); // V96.7 Opus 19avr: OVERRIDE with real count from /wired-pending/*.php (doctrine 4) // The hardcoded categories above were V42-V62 baseline — actual wired intents have grown massively $real_wired_files = glob('/var/www/html/api/wired-pending/intent-*.php'); $real_intent_count = is_array($real_wired_files) ? count($real_wired_files) : 0; if ($real_intent_count > $total_intents) { $total_intents_historical = $total_intents; // keep for reference $total_intents = $real_intent_count; $intents_wired[] = ['category'=>'V63-V96 real wire (dynamic glob)', 'count'=>$real_intent_count - $total_intents_historical, 'version'=>'V96.7 real', 'live'=>true, 'new'=>true, 'method'=>'glob(/wired-pending/intent-*.php)']; } $acquired['intents'] = ['total'=>$total_intents, 'categories'=>$intents_wired, 'file'=>'/api/wevia-sse-orchestrator.php']; // === CATEGORIE 2: SKILLS OSS (4247 cached) === $oss_cache_path = '/var/www/html/api/oss-cache.json'; $oss = file_exists($oss_cache_path) ? @json_decode(@file_get_contents($oss_cache_path), true) : null; $skills_collections = []; if ($oss && isset($oss['skills']['collections'])) { foreach ($oss['skills']['collections'] as $col) { $skills_collections[] = ['name'=>$col['name'] ?? '?', 'count'=>$col['count'] ?? 0]; } } $acquired['skills_oss'] = [ 'total' => $oss['report']['skills_injected'] ?? 4247, 'collections_count' => count($skills_collections), 'collections' => $skills_collections, 'path' => '/var/www/html/skills/', 'status' => $oss ? 'LIVE (cache indexed)' : 'cache missing' ]; // === CATEGORIE 3: RAG / QDRANT (17 collections) === $qdrant_up = @fsockopen('127.0.0.1', 6333, $e1, $e2, 1); $collections = []; $total_vectors = 0; if ($qdrant_up) { @fclose($qdrant_up); $resp = @file_get_contents('http://127.0.0.1:6333/collections'); $d = @json_decode($resp, true); foreach ($d['result']['collections'] ?? [] as $col) { $name = $col['name']; $info_resp = @file_get_contents("http://127.0.0.1:6333/collections/$name"); $info = @json_decode($info_resp, true); $pts = $info['result']['points_count'] ?? 0; $size = $info['result']['config']['params']['vectors']['size'] ?? 0; $status = $info['result']['status'] ?? 'unknown'; $total_vectors += $pts; $collections[] = ['name'=>$name, 'points'=>$pts, 'vec_size'=>$size, 'status'=>$status]; } } $acquired['rag_qdrant'] = [ 'status' => $qdrant_up ? 'LIVE' : 'DOWN', 'collections_count' => count($collections), 'total_vectors' => $total_vectors, 'collections' => $collections, 'port' => 6333, 'wired_v61' => ['v61_qdrant_ethica_search', 'v61_rag_pipeline'] ]; // === CATEGORIE 4: TOOLS OSS (90 dirs /opt/) === $opt_dirs = @glob('/opt/*', GLOB_ONLYDIR) ?: []; $opt_names = array_map('basename', $opt_dirs); $oss_categories = [ 'agent_frameworks' => array_values(array_intersect($opt_names, ['SuperClaude_Framework','HolyClaude','autogen','rnd-swarm','rnd-astron-agent','rnd-edict','deer-flow','deepagent','claw-code','aios','FrancyJGLisboa_agent-skill-creator'])), 'weval_ecosystem' => array_values(array_filter($opt_names, fn($n) => strpos($n, 'weval-') === 0 || $n === 'wevia-brain' || $n === 'wevia-finetune' || $n === 'wevads')), 'skills_libs' => array_values(array_intersect($opt_names, ['skills','skillsmith','paperclip-skills','huggingface-skills','awesome-agent-skills','antigravity-awesome-skills','awesome-claude-code-toolkit'])), 'memory' => array_values(array_intersect($opt_names, ['claude-mem','supermemory','qdrant-data','obsidian-vault'])), 'infra' => array_values(array_intersect($opt_names, ['gitea','prometheus','searxng','vaultwarden','plausible','wazuh','activepieces','twenty','authentik','anythingllm','open-webui-fresh','flowise-data','whisper.cpp','vllm','sovereign-api'])), 'pmta' => array_values(array_intersect($opt_names, ['pmta','pmta-versions','isolated-pmta5'])), ]; $acquired['tools_oss'] = [ 'total_opt_dirs' => count($opt_dirs), 'categorized' => array_map(fn($cat) => count($cat), $oss_categories), 'categories' => $oss_categories ]; // === CATEGORIE 5: DOCTRINES (55 obsidian + digest) === $acquired['doctrines'] = [ 'count' => safe_scandir_count('/opt/obsidian-vault/doctrines'), 'path' => '/opt/obsidian-vault/doctrines', 'wired_via' => 'v61_doctrine_autoload + v61_doctrines_list', 'status' => 'LIVE loadable' ]; // === CATEGORIE 6: BRAIN NUCLEUS + PERSONAS + KB === $acquired['brain_knowledge'] = [ 'nucleus_masteries' => count(@glob('/opt/wevia-brain/prompts/nucleus/*.md') ?: []), 'personas' => count(@glob('/opt/wevia-brain/prompts/personas/*.md') ?: []), 'system_prompts' => count(@glob('/opt/wevia-brain/prompts/system/*.md') ?: []), 'knowledge_bases' => count(@glob('/opt/wevia-brain/knowledge/*.{json,md}', GLOB_BRACE) ?: []), 'knowledge_deep' => count(@glob('/opt/wevia-brain/knowledge/deep/*.md') ?: []), ]; // === CATEGORIE 7: BRIDGES & APIS ACTIVES === $api_files = [ 'wevia-sse-orchestrator.php' => 'V61 orch 747L 54 intents', 'wevia-v60-tier1-bridges.php' => 'V60 Tier1 6 endpoints', 'wevia-v61-intents-include.php' => 'V61 intents 10 wired', 'wevia-v62-intents-include.php' => 'V62 wire-gated autre Claude', 'wevia-v62-acquired-api.php' => 'V62 acquis/dormant diff (moi)', 'wevia-auto-intent.php' => 'V55-V59 dormants scan 22cat', 'oss-discovery.php' => 'V56 skills scanner /skills symlinks', 'ethica-brain.php' => 'V83 doctrine Ethica chatbot' ]; $acquired['apis_active'] = []; foreach ($api_files as $f => $desc) { $p = "/var/www/html/api/$f"; if (file_exists($p)) { $acquired['apis_active'][] = ['file'=>$f, 'size_kb'=>round(filesize($p)/1024,1), 'desc'=>$desc]; } } // === CATEGORIE 8: INFRASTRUCTURE LIVE === $acquired['infrastructure'] = [ 'sovereign_cascade' => @fsockopen('127.0.0.1', 4000, $e1, $e2, 1) ? 'LIVE (13 providers)' : 'DOWN', 'qdrant_6333' => $qdrant_up ? 'LIVE' : 'DOWN', 'apache_5890' => @fsockopen('127.0.0.1', 5890, $e1, $e2, 1) ? 'LIVE' : 'DOWN', 'redis_weval' => shell_exec('docker ps 2>/dev/null | grep -c redis-weval') ? 'LIVE' : 'UNKNOWN' ]; if (isset($acquired['infrastructure']['sovereign_cascade']) && @fsockopen('127.0.0.1', 4000, $e1, $e2, 1)) {} // === CATEGORIE 9: DORMANT ENCORE A WIRER === $dormant = [ 'wevia_backoffice_86kb' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>1, 'notes'=>'backoffice complet arsenal'], 'visual_brain_27kb' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>1, 'notes'=>'UX visuelle WEVIA'], 'consensus_engine' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>1, 'notes'=>'multi-LLM MoA 6KB'], 'embed_model_qdrant' => ['priority'=>'DONE', 'wire_target'=>'V96.3', 'count'=>0, 'notes'=>'V96.3 DONE: sentence-transformers all-MiniLM-L6-v2 ingest 4610 OSS patterns weval_skills 19087 points'], 'opus_artifacts_dormant' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>132, 'notes'=>'133 opus artifacts dont 1 wired (cognitive-opus46-advanced)'], 'rnd_plugins_74_domaines' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>74, 'notes'=>'74 domaines tech/business'], 'wevia_ia_125_dormants' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>125, 'notes'=>'wevia-api 59KB, admin-conversations 34KB, etc.'], 's89_ai_apis_33' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>33, 'notes'=>'ai-bridge, ai-copywriter, ai-rotation archived'], 'agent_frameworks_10' => ['priority'=>'DONE', 'wire_target'=>'V9.73', 'count'=>10, 'notes'=>'SuperClaude/autogen/deer-flow ready but not wired'], ]; // === LEAN 6 SIGMA === $nonreg = @json_decode(@file_get_contents('/var/www/html/api/nonreg-latest.json'), true); $l6s = [ 'score_l99' => $nonreg['score'] ?? 0, 'pass' => $nonreg['pass'] ?? 0, 'fail' => $nonreg['fail'] ?? 0, 'cycles_stable_v42_v63' => 18, 'ts' => $nonreg['ts'] ?? '', 'target' => '6 sigma = 3.4 defects per million opportunities', 'status' => ($nonreg['fail'] ?? 0) === 0 ? 'ON TARGET' : 'DEVIATION', 'dpmo' => ($nonreg['fail'] ?? 0) === 0 ? 0 : round((($nonreg['fail'] ?? 0) / max(1, ($nonreg['pass'] ?? 1) + ($nonreg['fail'] ?? 0))) * 1000000, 2) ]; // === RATIO GLOBAL === $total_acquired = $total_intents + ($acquired['skills_oss']['total'] ?? 0) + ($acquired['rag_qdrant']['total_vectors'] ?? 0) + ($acquired['doctrines']['count'] ?? 0) + array_sum($acquired['brain_knowledge'] ?? []); $total_dormant = array_sum(array_column($dormant, 'count')); $ratio = round(($total_acquired / max(1, $total_acquired + $total_dormant)) * 100, 2); echo json_encode([ 'generated_at' => date('c'), 'version' => 'V63', 'summary' => [ 'total_intents_wired' => $total_intents, 'total_skills_oss' => $acquired['skills_oss']['total'] ?? 0, 'total_vectors_rag' => $acquired['rag_qdrant']['total_vectors'] ?? 0, 'total_doctrines' => $acquired['doctrines']['count'] ?? 0, 'total_tools_oss_dirs' => count($opt_dirs), 'total_apis_active' => count($acquired['apis_active']), 'total_acquired' => $total_acquired, 'total_dormant_items' => $total_dormant, 'coverage_ratio_pct' => $ratio ], 'acquired' => $acquired, 'dormant' => $dormant, 'lean6sigma' => $l6s, 'anti_regression_note' => 'Ces acquis ne doivent JAMAIS regresser. Verification auto chaque cycle L99.' ], JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT); exit; } echo json_encode(['error' => 'action: full']);