diff --git a/api/oss-cache.json.GOLD-20260417-234203-post-v56-fix b/api/oss-cache.json.GOLD-20260417-234203-post-v56-fix new file mode 100644 index 000000000..bbde58db4 --- /dev/null +++ b/api/oss-cache.json.GOLD-20260417-234203-post-v56-fix @@ -0,0 +1,7216 @@ +{ + "report": { + "total": 70, + "wired": 70, + "not_wired": 0, + "with_readme": 34, + "with_docker": 14, + "scan_time": "2026-04-17T23:00:02.066687", + "by_status": { + "integrated": 70, + "discovered": 0, + "evaluated": 0 + }, + "skills_injected": 1247 + }, + "tools": { + "weval-l99": { + "name": "weval-l99", + "path": "/opt/weval-l99", + "files": 251, + "has_readme": false, + "has_skill": false, + "has_python": true, + "has_node": false, + "has_docker": false, + "wired": true, + "description": "", + "discovered": "2026-04-17T23:00:02.043253" + }, + "wevia-brain": { + "name": "wevia-brain", + "path": "/opt/wevia-brain", + "files": 156, + "has_readme": false, + "has_skill": false, + "has_python": true, + "has_node": false, + "has_docker": false, + "wired": true, + "description": "", + "discovered": "2026-04-17T23:00:02.061095" + }, + "skills": { + "name": "skills", + "path": "/opt/skills", + "files": 110, + "has_readme": false, + "has_skill": false, + "has_python": false, + "has_node": false, + "has_docker": false, + "wired": true, + "description": "", + "discovered": "2026-04-17T23:00:02.019720" + }, + "everything-claude-code": { + "name": "everything-claude-code", + "path": "/opt/everything-claude-code", + "files": 68, + "has_readme": true, + "has_skill": false, + "has_python": false, + "has_node": true, + "has_docker": false, + "wired": true, + "description": "**Language:** English | [Portugu\u00eas (Brasil)](docs/pt-BR/README.md) | [\u7b80\u4f53\u4e2d\u6587](README.zh-CN.md) | [\u7e41\u9ad4\u4e2d\u6587](docs/zh-TW/README.md) | [\u65e5\u672c\u8a9e](docs/ja-JP/README.", + "discovered": "2026-04-17T23:00:01.929193" + }, + "open-webui-fresh": { + "name": "open-webui-fresh", + "path": "/opt/open-webui-fresh", + "files": 57, + "has_readme": true, + "has_skill": false, + "has_python": true, + "has_node": true, + "has_docker": true, + "wired": true, + "description": "# Open WebUI \ud83d\udc4b   | [Fran\u00e7ais](docs/translations/README.fr.md) | [Italiano](docs/translations/README.it.md) | ",
+ "discovered": "2026-04-17T23:00:01.855982"
+ },
+ "aios": {
+ "name": "aios",
+ "path": "/opt/aios",
+ "files": 19,
+ "has_readme": true,
+ "has_skill": false,
+ "has_python": false,
+ "has_node": false,
+ "has_docker": true,
+ "wired": true,
+ "description": "# AIOS: AI Agent Operating System
'auth']));
+}
+
+$action = $_GET['action'] ?? 'report';
+$DB_FILE = '/opt/wevads/vault/oss-discovery.json';
+$SKILLS_DIR = '/opt/deer-flow/skills/weval';
+$LOG = '/var/log/oss-discovery.log';
+$TG_BOT = '8544624912';
+$TG_CHAT = '7605775322';
+$OBSIDIAN_API = 'https://weval-consulting.com/api/obsidian-sync-receiver.php';
+
+if (!is_dir($SKILLS_DIR)) @mkdir($SKILLS_DIR, 0755, true);
+if (!is_dir('/opt/wevads/vault')) @mkdir('/opt/wevads/vault', 0755, true);
+
+$db = file_exists($DB_FILE) ? json_decode(file_get_contents($DB_FILE), true) : [
+ 'tools' => [], 'skills_created' => [], 'last_scan' => null,
+ 'total_discovered' => 0, 'total_integrated' => 0, 'total_skills_injected' => 0
+];
+
+// ─── NEEDS MATRIX ───
+$NEEDS = [
+ 'rag' => ['weight'=>10, 'kw'=>['rag','retrieval','vector','embedding','knowledge-base','semantic-search']],
+ 'skill_agent' => ['weight'=>10, 'kw'=>['skill','agent','plugin','hook','mcp','claude-code','subagent','orchestrat']],
+ 'scraping' => ['weight'=>9, 'kw'=>['scraper','crawl','extraction','playwright','selenium','browser-use']],
+ 'llm_local' => ['weight'=>9, 'kw'=>['ollama','llm','inference','quantize','gguf','local','sovereign','vllm']],
+ 'security' => ['weight'=>8, 'kw'=>['security','audit','vulnerability','scan','pentest','nuclei','shield']],
+ 'pharma_health' => ['weight'=>8, 'kw'=>['pharma','health','medical','hcp','drug','clinical','healthcare']],
+ 'email' => ['weight'=>8, 'kw'=>['email','smtp','deliverability','warmup','bounce','mta','newsletter']],
+ 'crm' => ['weight'=>7, 'kw'=>['crm','lead','pipeline','sales','contact','prospect']],
+ 'automation' => ['weight'=>7, 'kw'=>['automation','workflow','n8n','cron','pipeline','orchestrat','activepieces']],
+ 'analytics' => ['weight'=>6, 'kw'=>['analytics','dashboard','report','metric','tracking','plausible']],
+ 'monitoring' => ['weight'=>6, 'kw'=>['monitor','alert','health','uptime','prometheus','grafana']],
+ 'code_quality' => ['weight'=>5, 'kw'=>['lint','test','quality','ci','format','coverage','tdd']],
+ 'verification' => ['weight'=>9, 'kw'=>['verification','verifier','adversarial','nonreg','regression','audit','assertion']],
+ 'prompt_eng' => ['weight'=>9, 'kw'=>['system-prompt','prompt-engineering','prompt-leak','claude-code','instruction','guardrail']],
+ 'context_mgmt' => ['weight'=>10, 'kw'=>['context-window','context-compression','token-budget','context-collapse','summarization','compaction']],
+ 'moa_ensemble' => ['weight'=>9, 'kw'=>['mixture-of-agents','moa','ensemble','self-moa','multi-agent','coordinator','subagent','swarm']],
+ 'spec_decode' => ['weight'=>8, 'kw'=>['speculative-decoding','eagle','medusa','draft-model','spec-decode','lookahead','specforge']],
+ 'mem_consol' => ['weight'=>8, 'kw'=>['memory-consolidation','auto-dream','persistent-memory','session-memory','memory-layer','knowledge-graph']],
+ 'mcp_protocol' => ['weight'=>9, 'kw'=>['mcp','model-context-protocol','tool-server','mcp-server','function-calling','tool-use']],
+ 'vllm_serve' => ['weight'=>10, 'kw'=>['vllm','paged-attention','tensor-parallel','serving','inference-engine','sglang','tgi']],
+ 'sovereign_eu' => ['weight'=>9, 'kw'=>['sovereign','gdpr','eu-ai-act','on-premise','self-hosted','data-sovereignty','mistral']],
+];
+
+// ─── AUTO-INTEGRATION TARGETS ───
+$INTEGRATION_MAP = [
+ 'skill_agent' => ['target'=>'skill_factory', 'path'=>$SKILLS_DIR, 'server'=>'S204'],
+ 'rag' => ['target'=>'qdrant_pipeline', 'path'=>'/opt/weval-rag', 'server'=>'S204'],
+ 'security' => ['target'=>'aegis_nuclei', 'path'=>'/var/www/html/api/nuclei-templates', 'server'=>'S204'],
+ 'scraping' => ['target'=>'scraper_arsenal', 'path'=>'/opt/wevads-arsenal', 'server'=>'S95'],
+ 'llm_local' => ['target'=>'ollama_models', 'path'=>'ollama', 'server'=>'S204'],
+ 'pharma_health' => ['target'=>'ethica_tools', 'path'=>'/opt/ethica-tools', 'server'=>'S95'],
+ 'email' => ['target'=>'mta_tools', 'path'=>'/opt/wevads/email-tools', 'server'=>'S95'],
+ 'automation' => ['target'=>'n8n_workflows', 'path'=>'/opt/n8n-workflows', 'server'=>'S95'],
+ 'monitoring' => ['target'=>'monitoring', 'path'=>'/opt/wevads/monitoring', 'server'=>'S204'],
+ 'crm' => ['target'=>'crm_extensions', 'path'=>'/opt/crm-tools', 'server'=>'S204'],
+ 'analytics' => ['target'=>'analytics', 'path'=>'/opt/analytics-tools', 'server'=>'S204'],
+ 'verification' => ['target'=>'verifier_agent', 'path'=>'/opt/deer-flow/backend/packages/harness/deerflow/subagents', 'server'=>'S204'],
+ 'prompt_eng' => ['target'=>'prompt_library', 'path'=>'/opt/wevads/vault/prompt-patterns', 'server'=>'S204'],
+ 'context_mgmt' => ['target'=>'wcp_patterns', 'path'=>'/var/www/weval/wevia-ia', 'server'=>'S204'],
+ 'moa_ensemble' => ['target'=>'wsi_sovereign', 'path'=>'/var/www/weval/wevia-ia', 'server'=>'S204'],
+ 'spec_decode' => ['target'=>'vllm_config', 'path'=>'/opt/vllm', 'server'=>'S204'],
+ 'mem_consol' => ['target'=>'dream_engine', 'path'=>'/var/www/weval/wevia-ia', 'server'=>'S204'],
+ 'mcp_protocol' => ['target'=>'mcp_servers', 'path'=>'/opt/mcp-tools', 'server'=>'S204'],
+ 'vllm_serve' => ['target'=>'inference_engine', 'path'=>'/opt/vllm', 'server'=>'S204'],
+ 'sovereign_eu' => ['target'=>'sovereign_stack', 'path'=>'/opt/sovereign', 'server'=>'S204'],
+];
+
+// ─── HELPERS ───
+function score_tool($repo, $needs) {
+ $score = 0; $matched = [];
+ $text = strtolower(($repo['name']??'').' '.($repo['description']??'').' '.implode(' ',$repo['topics']??[]));
+ foreach ($needs as $need => $cfg) {
+ foreach ($cfg['kw'] as $kw) {
+ if (strpos($text, $kw) !== false) { $score += $cfg['weight']; $matched[] = $need; break; }
+ }
+ }
+ $stars = $repo['stargazers_count'] ?? 0;
+ if ($stars > 10000) $score += 5; elseif ($stars > 1000) $score += 3; elseif ($stars > 100) $score += 1;
+ $lic = strtolower($repo['license']['spdx_id'] ?? '');
+ if (in_array($lic, ['mit','apache-2.0','bsd-2-clause','bsd-3-clause'])) $score += 2;
+ $lang = strtolower($repo['language'] ?? '');
+ if (in_array($lang, ['python','php','javascript','typescript','shell','go'])) $score += 2;
+ return ['score'=>$score, 'matched_needs'=>array_unique($matched)];
+}
+
+function tg_notify($msg) {
+ global $TG_BOT, $TG_CHAT;
+ @file_get_contents("https://api.telegram.org/bot{$TG_BOT}:AAGdBn1f3m0UtnxK7LHhA33fJ1I2VZJPnug/sendMessage?" . http_build_query([
+ 'chat_id' => $TG_CHAT, 'text' => $msg, 'parse_mode' => 'HTML'
+ ]));
+}
+
+function obsidian_push($path, $content) {
+ global $OBSIDIAN_API;
+ $ch = curl_init($OBSIDIAN_API);
+ curl_setopt_array($ch, [
+ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false,
+ CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
+ CURLOPT_POSTFIELDS => json_encode(['action'=>'obsidian_sync','path'=>$path,'content'=>base64_encode($content)])
+ ]);
+ curl_exec($ch); curl_close($ch);
+}
+
+function create_skill($tool, $needs_matched, $skills_dir) {
+ $slug = preg_replace('/[^a-z0-9-]/', '-', strtolower($tool['name']));
+ $dir = "$skills_dir/$slug";
+ if (is_dir($dir)) return null;
+ @mkdir($dir, 0755, true);
+
+ $needs_str = implode(', ', $needs_matched);
+ $topics_str = implode(', ', array_slice($tool['topics'] ?? [], 0, 8));
+ $desc = $tool['description'] ?? 'No description';
+
+ $skill_md = "# {$tool['name']}\n\n";
+ $skill_md .= "## Source\n- GitHub: {$tool['url']}\n- Stars: {$tool['stars']}\n- Language: {$tool['language']}\n- License: {$tool['license']}\n\n";
+ $skill_md .= "## Description\n{$desc}\n\n";
+ $skill_md .= "## WEVAL Relevance\n- Score: {$tool['score']}\n- Matched needs: {$needs_str}\n- Topics: {$topics_str}\n\n";
+ $skill_md .= "## Integration\n- Status: auto-discovered\n- Target: " . ($GLOBALS['INTEGRATION_MAP'][$needs_matched[0] ?? 'skill_agent']['target'] ?? 'manual') . "\n";
+ $skill_md .= "- Server: " . ($GLOBALS['INTEGRATION_MAP'][$needs_matched[0] ?? 'skill_agent']['server'] ?? 'S204') . "\n\n";
+ $skill_md .= "## Usage\n```\n# Clone and evaluate\ngit clone {$tool['url']}\n# Check README for install instructions\n```\n\n";
+ $skill_md .= "## Triggers\n";
+ foreach ($needs_matched as $n) { $skill_md .= "- $n\n"; }
+ $skill_md .= "\n---\nAuto-discovered: " . date('Y-m-d H:i') . "\n";
+
+ file_put_contents("$dir/SKILL.md", $skill_md);
+ return $slug;
+}
+
+function github_fetch($url) {
+ $ctx = stream_context_create(['http' => [
+ 'header' => "User-Agent: WEVAL-Discovery/2.0\r\nAccept: application/vnd.github+json\r\n",
+ 'timeout' => 15
+ ]]);
+ $json = @file_get_contents($url, false, $ctx);
+ return $json ? json_decode($json, true) : null;
+}
+
+// ─── SOURCES ───
+$SOURCES = [
+ 'claude_skills' => 'https://api.github.com/search/repositories?q=topic:claude-code+OR+topic:claude-skills+OR+topic:agent-skills&sort=stars&order=desc&per_page=20',
+ 'ai_agents' => 'https://api.github.com/search/repositories?q=topic:ai-agents+topic:open-source+language:python&sort=updated&order=desc&per_page=15',
+ 'mcp_tools' => 'https://api.github.com/search/repositories?q=topic:mcp+OR+topic:model-context-protocol&sort=stars&order=desc&per_page=15',
+ 'rag_tools' => 'https://api.github.com/search/repositories?q=rag+retrieval+augmented+generation+language:python&sort=stars&order=desc&per_page=10',
+ 'security_tools'=> 'https://api.github.com/search/repositories?q=security+audit+agent+2026&sort=stars&order=desc&per_page=10',
+ 'pharma_ai' => 'https://api.github.com/search/repositories?q=pharma+healthcare+ai+open-source&sort=stars&order=desc&per_page=10',
+ 'ollama_tools' => 'https://api.github.com/search/repositories?q=topic:ollama+language:python&sort=updated&order=desc&per_page=10',
+ 'system_prompts'=> 'https://api.github.com/search/repositories?q=system+prompt+leak+OR+claude-code+prompt+engineering&sort=stars&order=desc&per_page=15',
+ 'verification' => 'https://api.github.com/search/repositories?q=adversarial+testing+OR+verification+agent+OR+regression+testing+ai&sort=stars&order=desc&per_page=10',
+];
+
+// ═══════════════════════════════════════════
+switch ($action) {
+
+case 'discover':
+case 'auto_run':
+ $new_tools = []; $new_skills = []; $integrated = [];
+
+ foreach ($SOURCES as $name => $url) {
+ $data = github_fetch($url);
+ if (!$data) continue;
+ foreach (($data['items'] ?? []) as $repo) {
+ $id = $repo['full_name'] ?? '';
+ if (isset($db['tools'][$id])) continue;
+
+ $eval = score_tool($repo, $NEEDS);
+ if ($eval['score'] < 5) continue;
+
+ $tool = [
+ 'name' => $repo['name'], 'full_name' => $id,
+ 'description' => mb_substr($repo['description'] ?? '', 0, 200),
+ 'url' => $repo['html_url'], 'stars' => $repo['stargazers_count'] ?? 0,
+ 'language' => $repo['language'] ?? '?', 'license' => $repo['license']['spdx_id'] ?? '?',
+ 'topics' => $repo['topics'] ?? [], 'score' => $eval['score'],
+ 'matched_needs' => $eval['matched_needs'], 'discovered_at' => date('c'),
+ 'status' => 'discovered', 'source' => $name,
+ ];
+
+ // ─── AUTO-INTEGRATE if score >= 15 ───
+ if ($eval['score'] >= 15 && $action === 'auto_run') {
+ $slug = create_skill($tool, $eval['matched_needs'], $SKILLS_DIR);
+ if ($slug) {
+ $tool['status'] = 'integrated';
+ $tool['integrated_at'] = date('c');
+ $tool['skill_slug'] = $slug;
+ $db['total_skills_injected']++;
+ $new_skills[] = $slug;
+ $integrated[] = $tool;
+ }
+ }
+
+ $db['tools'][$id] = $tool;
+ $db['total_discovered']++;
+ $new_tools[] = $tool;
+ }
+ usleep(500000); // Rate limit
+ }
+
+ $db['last_scan'] = date('c');
+ file_put_contents($DB_FILE, json_encode($db, JSON_PRETTY_PRINT));
+
+ // Log
+ $log_msg = date('Y-m-d H:i:s') . " SCAN: +{count($new_tools)} discovered, +" . count($new_skills) . " skills created\n";
+ file_put_contents($LOG, str_replace('{count($new_tools)}', count($new_tools), $log_msg), FILE_APPEND);
+
+ // ─── TELEGRAM NOTIFICATION ───
+ if (count($new_tools) > 0) {
+ $msg = "🔍 OSS Discovery\n";
+ $msg .= "+" . count($new_tools) . " new tools found\n";
+ $msg .= "+" . count($new_skills) . " skills auto-injected\n\n";
+ $top3 = array_slice($new_tools, 0, 3);
+ foreach ($top3 as $t) {
+ $msg .= "⭐ {$t['name']} ({$t['score']}pts)\n";
+ $msg .= " " . implode(', ', $t['matched_needs']) . "\n";
+ }
+ $msg .= "\nTotal: " . count($db['tools']) . " tools | " . $db['total_skills_injected'] . " skills";
+ tg_notify($msg);
+ }
+
+ // ─── OBSIDIAN AUTO-UPDATE ───
+ $obsidian_note = "# OSS Discovery Report\n\n";
+ $obsidian_note .= "**Last scan:** " . date('Y-m-d H:i') . "\n";
+ $obsidian_note .= "**Total tools:** " . count($db['tools']) . "\n";
+ $obsidian_note .= "**Skills injected:** " . $db['total_skills_injected'] . "\n\n";
+ $obsidian_note .= "## Latest Discoveries\n";
+ $sorted = $db['tools']; usort($sorted, fn($a,$b) => ($b['score']??0) - ($a['score']??0));
+ foreach (array_slice($sorted, 0, 15) as $t) {
+ $status_icon = $t['status'] === 'integrated' ? '✅' : '🔍';
+ $obsidian_note .= "- {$status_icon} **{$t['name']}** ({$t['score']}pts) — " . implode(', ', $t['matched_needs'] ?? []) . "\n";
+ }
+ $obsidian_note .= "\n## Skills Auto-Injected\n";
+ foreach ($db['skills_created'] ?? [] as $s) { $obsidian_note .= "- `{$s}`\n"; }
+ foreach ($new_skills as $s) { $obsidian_note .= "- `{$s}` ⚡ NEW\n"; $db['skills_created'][] = $s; }
+ file_put_contents($DB_FILE, json_encode($db, JSON_PRETTY_PRINT));
+ obsidian_push('/03-Resources/Techniques/OSS-Discovery-Report.md', $obsidian_note);
+
+ usort($new_tools, fn($a,$b) => $b['score'] - $a['score']);
+ echo json_encode([
+ 'ok' => true, 'new_tools' => count($new_tools), 'new_skills' => count($new_skills),
+ 'auto_integrated' => count($integrated),
+ 'top' => array_slice(array_map(fn($t) => ['name'=>$t['full_name'],'score'=>$t['score'],'needs'=>$t['matched_needs'],'status'=>$t['status']], $new_tools), 0, 10),
+ 'total_known' => count($db['tools']), 'total_skills' => $db['total_skills_injected']
+ ]);
+ break;
+
+case 'trending':
+ $data = github_fetch('https://api.github.com/search/repositories?q=ai+agent+tool+created:>2026-03-01&sort=stars&order=desc&per_page=20');
+ $trending = [];
+ foreach (($data['items'] ?? []) as $repo) {
+ $eval = score_tool($repo, $NEEDS);
+ $trending[] = ['name'=>$repo['full_name'],'stars'=>$repo['stargazers_count'],'description'=>mb_substr($repo['description']??'',0,150),
+ 'language'=>$repo['language'],'score'=>$eval['score'],'needs'=>$eval['matched_needs'],'url'=>$repo['html_url']];
+ }
+ usort($trending, fn($a,$b) => $b['score'] - $a['score']);
+ echo json_encode(['ok'=>true,'trending'=>array_slice($trending,0,15)]);
+ break;
+
+case 'evaluate':
+ $tid = $_GET['tool'] ?? '';
+ if (!$tid || !isset($db['tools'][$tid])) { echo json_encode(['error'=>'not found']); break; }
+ $t = $db['tools'][$tid];
+ $f = [
+ 'can_run_cpu' => !in_array('gpu', $t['topics'] ?? []),
+ 'language_ok' => in_array(strtolower($t['language']), ['python','php','javascript','typescript','shell','go']),
+ 'license_ok' => in_array(strtolower($t['license']), ['mit','apache-2.0','bsd-2-clause','bsd-3-clause','gpl-3.0']),
+ 'has_docker' => in_array('docker', $t['topics'] ?? []),
+ ];
+ $f['go'] = $f['can_run_cpu'] && $f['language_ok'] && $f['license_ok'];
+ $primary_need = $t['matched_needs'][0] ?? 'skill_agent';
+ $target = $INTEGRATION_MAP[$primary_need] ?? ['target'=>'manual','server'=>'S204'];
+
+ $db['tools'][$tid]['status'] = 'evaluated';
+ $db['tools'][$tid]['feasibility'] = $f;
+ $db['tools'][$tid]['integration_target'] = $target;
+ file_put_contents($DB_FILE, json_encode($db, JSON_PRETTY_PRINT));
+ echo json_encode(['ok'=>true,'tool'=>$t,'feasibility'=>$f,'target'=>$target]);
+ break;
+
+case 'integrate':
+ $tid = $_GET['tool'] ?? '';
+ if (!$tid || !isset($db['tools'][$tid])) { echo json_encode(['error'=>'not found']); break; }
+ $t = $db['tools'][$tid];
+ $slug = create_skill($t, $t['matched_needs'], $SKILLS_DIR);
+ if ($slug) {
+ $db['tools'][$tid]['status'] = 'integrated';
+ $db['tools'][$tid]['integrated_at'] = date('c');
+ $db['tools'][$tid]['skill_slug'] = $slug;
+ $db['total_skills_injected']++;
+ $db['skills_created'][] = $slug;
+ file_put_contents($DB_FILE, json_encode($db, JSON_PRETTY_PRINT));
+ tg_notify("🔧 Skill integrated: {$t['name']} → {$SKILLS_DIR}/{$slug}/");
+ echo json_encode(['ok'=>true,'skill'=>$slug,'path'=>"$SKILLS_DIR/$slug/SKILL.md"]);
+ } else {
+ echo json_encode(['ok'=>false,'message'=>'already exists']);
+ }
+ break;
+
+case 'skills':
+ // V56_RECURSIVE_SKILLS_SCAN - scan /var/www/html/skills/ with symlink follow
+ $SKILLS_PUBLIC = '/var/www/html/skills';
+ $skills = [];
+ $collections = [];
+ if (is_dir($SKILLS_PUBLIC)) {
+ foreach (scandir($SKILLS_PUBLIC) as $col) {
+ if ($col === '.' || $col === '..') continue;
+ $col_path = $SKILLS_PUBLIC . '/' . $col;
+ $real = is_link($col_path) ? readlink($col_path) : $col_path;
+ if (!is_dir($real)) continue;
+ $count = 0;
+ // Find SKILL.md files recursively (max depth 5)
+ $it = @new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($real, RecursiveDirectoryIterator::SKIP_DOTS | RecursiveDirectoryIterator::FOLLOW_SYMLINKS),
+ RecursiveIteratorIterator::LEAVES_ONLY
+ );
+ if ($it) {
+ foreach ($it as $f) {
+ $fname = $f->getFilename();
+ if (in_array(strtolower($fname), ['skill.md','readme.md','index.md'])) {
+ $skill_name = basename(dirname($f->getPathname()));
+ $skills[] = ['slug' => $col . '/' . $skill_name, 'name' => $skill_name, 'collection' => $col];
+ $count++;
+ if ($count >= 2000) break; // V56b higher cap
+ }
+ }
+ }
+ $collections[$col] = $count;
+ }
+ }
+ echo json_encode([
+ 'ok' => true,
+ 'skills' => array_slice($skills, 0, 5000), // V56b higher total cap
+ 'total' => count($skills),
+ 'collections' => $collections,
+ 'path' => $SKILLS_PUBLIC,
+ 'scan' => 'V56_recursive'
+ ]);
+ break;
+
+case 'report':
+default:
+ $by_status = ['discovered'=>0,'evaluated'=>0,'integrated'=>0,'rejected'=>0];
+ $by_need = []; $top = [];
+ foreach ($db['tools'] as $t) {
+ $by_status[$t['status']??'discovered']++;
+ foreach ($t['matched_needs']??[] as $n) { $by_need[$n] = ($by_need[$n]??0)+1; }
+ if (($t['score']??0) >= 10) $top[] = ['name'=>$t['full_name'],'score'=>$t['score'],'status'=>$t['status'],'needs'=>$t['matched_needs']??[],'wire_date'=>$t['wire_date']??'','wire_status'=>$t['wire_status']??'','test_status'=>$t['test_status']??'','stars'=>$t['stars']??0,'slug'=>$t['skill_slug']??''];
+ }
+ $wire_ok=$wire_fail=0;foreach($db["tools"] as $_t){if(($_t["wire_status"]??"")=="success")$wire_ok++;elseif(($_t["wire_status"]??"")=="failed")$wire_fail++;}
+ usort($top, fn($a,$b) => $b['score']-$a['score']); arsort($by_need);
+ echo json_encode([
+ 'ok'=>true,'total'=>count($db['tools']),'by_status'=>$by_status,'by_need'=>$by_need,
+ 'top'=>array_slice($top,0,15),'skills_injected'=>$db['total_skills_injected'],
+ 'skills_list'=>$db['skills_created']??[],'last_scan'=>$db['last_scan'],
+ 'integration_targets'=>array_keys($INTEGRATION_MAP),
+ 'test_summary'=>$db['test_summary']??[],'wire_stats'=>['success'=>$wire_ok,'failed'=>$wire_fail],'already_wired'=>['Browser Use','OpenClaw','Strix/Nuclei','Prometheus','Mastra','Dify','Supermemory','EvoMaster','Activepieces','Goose','AEGIS','SkillSmith','AIOS','vaultwarden','gitea','pmta-versions']
+ ]);
+ break;
+}
diff --git a/api/wevia-auto-intent.php b/api/wevia-auto-intent.php
index 3d6cea9b7..392605a9f 100644
--- a/api/wevia-auto-intent.php
+++ b/api/wevia-auto-intent.php
@@ -1,6 +1,6 @@
V57 8cat -> V58 15cat (brain nucleus, prompts, KB, skills OSS, agent frameworks, git repos, personas, knowledge deep)
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
@@ -10,25 +10,21 @@ $PROPOSALS = '/opt/wevads/state/autointent-proposals.json';
function load_proposals() {
global $PROPOSALS;
- if (!file_exists($PROPOSALS)) return [];
- return json_decode(@file_get_contents($PROPOSALS), true) ?: [];
+ return file_exists($PROPOSALS) ? (json_decode(@file_get_contents($PROPOSALS), true) ?: []) : [];
}
if ($action === 'list') {
- echo json_encode(['status'=>'ok','proposals'=>load_proposals(),'doctrine'=>'propose-only, never auto-wire'], JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
+ echo json_encode(['status'=>'ok','proposals'=>load_proposals(),'doctrine'=>'propose-only'], JSON_UNESCAPED_UNICODE);
exit;
}
if ($action === 'scan') {
if (!file_exists($LOG)) { echo json_encode(['status'=>'empty']); exit; }
$patterns = [];
- $lines = @file($LOG, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [];
- foreach (array_slice($lines, -500) as $l) {
+ foreach (array_slice(@file($LOG, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [], -500) as $l) {
$ev = @json_decode($l, true);
- if (!$ev || !isset($ev['msg']) || !isset($ev['exec_count'])) continue;
- if ($ev['exec_count'] > 0) continue;
- $toks = preg_split('/\W+/u', mb_strtolower($ev['msg']));
- $toks = array_filter($toks, fn($t) => mb_strlen($t) >= 4);
+ if (!$ev || !isset($ev['msg']) || !isset($ev['exec_count']) || $ev['exec_count'] > 0) continue;
+ $toks = array_filter(preg_split('/\W+/u', mb_strtolower($ev['msg'])), fn($t) => mb_strlen($t) >= 4);
if (empty($toks)) continue;
$sig = implode('|', array_unique($toks));
if (!isset($patterns[$sig])) $patterns[$sig] = ['count'=>0,'samples'=>[],'keywords'=>$toks];
@@ -36,96 +32,140 @@ if ($action === 'scan') {
if (count($patterns[$sig]['samples']) < 3) $patterns[$sig]['samples'][] = $ev['msg'];
}
uasort($patterns, fn($a,$b) => $b['count']-$a['count']);
- echo json_encode(['status'=>'ok','scanned_events'=>count($lines),'patterns_found'=>count($patterns),'top_candidates'=>array_slice($patterns,0,20,true)], JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
+ echo json_encode(['status'=>'ok','patterns_found'=>count($patterns),'top_candidates'=>array_slice($patterns,0,20,true)], JSON_UNESCAPED_UNICODE);
exit;
}
if ($action === 'propose' && $_SERVER['REQUEST_METHOD'] === 'POST') {
$body = @json_decode(file_get_contents('php://input'), true);
if (!$body || empty($body['trigger']) || empty($body['cmd']) || empty($body['name'])) {
- http_response_code(400); echo json_encode(['error'=>'trigger, cmd, name required']); exit;
+ http_response_code(400); echo json_encode(['error'=>'required fields missing']); exit;
}
- $proposals = load_proposals();
- $proposals[] = ['id'=>'proposal_'.date('YmdHis').'_'.substr(md5($body['name']),0,6),'name'=>$body['name'],'trigger'=>$body['trigger'],'cmd'=>$body['cmd'],'source'=>$body['source']??'manual','created_at'=>date('c'),'status'=>'pending','source_samples'=>$body['samples']??[]];
- @file_put_contents($PROPOSALS, json_encode($proposals, JSON_PRETTY_PRINT));
- echo json_encode(['status'=>'ok','stored'=>count($proposals)]);
+ $props = load_proposals();
+ $props[] = ['id'=>'prop_'.date('YmdHis'),'name'=>$body['name'],'trigger'=>$body['trigger'],'cmd'=>$body['cmd'],'status'=>'pending','created_at'=>date('c')];
+ @file_put_contents($PROPOSALS, json_encode($props, JSON_PRETTY_PRINT));
+ echo json_encode(['status'=>'ok','stored'=>count($props)]);
exit;
}
if ($action === 'dormants') {
- $dormants = [
- 'hubs'=>[],
- 'priority_intents'=>[],
- 'archived_intents'=>[],
- 'backend_php_intents'=>[],
- 'dormant_wevia_ia'=>[],
- 's89_ai_apis'=>[],
- 'orchestrators'=>[],
- 'tool_registries'=>[]
- ];
+ $dormants = [];
- // 1. Hub pages
+ // === LEVEL 1: Frontend Hubs ===
+ $dormants['hubs'] = [];
foreach (glob('/var/www/html/*hub*.html') as $h) {
$name = basename($h, '.html');
if (strpos($name,'pre-carto') !== false) continue;
- $dormants['hubs'][] = ['name'=>$name,'size_kb'=>round(filesize($h)/1024,1),'url'=>'/'.basename($h)];
+ $dormants['hubs'][] = ['name'=>$name, 'size_kb'=>round(filesize($h)/1024,1), 'url'=>'/'.basename($h)];
}
- // 2. Priority intents NL
+ // === LEVEL 2: Priority intents NL ===
+ $dormants['priority_intents'] = [];
$pif = '/opt/wevia-brain/priority-intents-nl.json';
if (file_exists($pif)) {
- $pi = @json_decode(file_get_contents($pif), true) ?: [];
- foreach ($pi as $p) {
+ foreach ((json_decode(file_get_contents($pif), true) ?: []) as $p) {
$cmd = trim($p['command'] ?? '');
- if (strlen($cmd) < 10 || $cmd === 'echo bonjour') continue;
- if (strpos($p['triggers'] ?? '', 'zxq') === 0) continue;
+ if (strlen($cmd) < 10 || $cmd === 'echo bonjour' || strpos($p['triggers'] ?? '','zxq') === 0) continue;
$dormants['priority_intents'][] = ['name'=>$p['name'],'trigger'=>$p['triggers'],'cmd_preview'=>substr($cmd,0,120)];
}
}
- // 3. Archived intents wiki
+ // === LEVEL 3: Archived intents wiki ===
+ $dormants['archived_intents'] = [];
foreach (glob('/opt/weval-l99/wiki/_var_www_html_api_wevia-*-intent*.json') as $a) {
$d = @json_decode(file_get_contents($a), true);
if (!$d) continue;
- $dormants['archived_intents'][] = ['file'=>basename($d['file']??''),'fns'=>$d['functions']??[],'lines'=>$d['lines']??0];
+ $dormants['archived_intents'][] = ['file'=>basename($d['file']??''),'fns'=>$d['functions']??[]];
}
- // 4. Backend PHP intents (73+)
- foreach (array_unique(array_merge(glob('/var/www/html/api/*intent*.php'), glob('/var/www/html/api/intent-*.php'), glob('/var/www/html/api/*-intents.php'))) as $p) {
- $bn = basename($p);
- $dormants['backend_php_intents'][] = ['name'=>$bn,'size_kb'=>round(filesize($p)/1024,1),'path'=>'/api/'.$bn];
+ // === LEVEL 4: Backend PHP intents ===
+ $dormants['backend_php_intents'] = [];
+ foreach (glob('/var/www/html/api/*intent*.php') as $p) {
+ $dormants['backend_php_intents'][] = ['name'=>basename($p),'size_kb'=>round(filesize($p)/1024,1)];
}
- // 5. DORMANT-CAPABILITIES-ARCHIVE dormant_wevia_ia (125)
+ // === LEVEL 5: DORMANT wevia-ia (125) ===
+ $dormants['dormant_wevia_ia'] = [];
+ $dormants['s89_ai_apis'] = [];
$dca = '/opt/wevia-brain/DORMANT-CAPABILITIES-ARCHIVE.json';
if (file_exists($dca)) {
$d = @json_decode(file_get_contents($dca), true);
if (!empty($d['categories']['dormant_wevia_ia']['files'])) {
- foreach ($d['categories']['dormant_wevia_ia']['files'] as $f) {
+ foreach ($d['categories']['dormant_wevia_ia']['files'] as $f)
$dormants['dormant_wevia_ia'][] = ['file'=>$f['file']??'','size_b'=>$f['size']??0];
- }
}
if (!empty($d['categories']['s89_ai_apis']['files'])) {
- foreach ($d['categories']['s89_ai_apis']['files'] as $f) {
+ foreach ($d['categories']['s89_ai_apis']['files'] as $f)
$dormants['s89_ai_apis'][] = ['file'=>$f['file']??'','size_b'=>$f['size']??0,'role'=>$f['role']??''];
- }
}
}
- // 6. Orchestrators (10)
+ // === LEVEL 6: Orchestrators ===
+ $dormants['orchestrators'] = [];
foreach (glob('/var/www/html/api/*orchestrator*.php') as $o) {
$bn = basename($o);
$active = in_array($bn, ['wevia-sse-orchestrator.php','wevia-sse-orchestrator-public.php']);
$dormants['orchestrators'][] = ['name'=>$bn,'size_kb'=>round(filesize($o)/1024,1),'status'=>$active?'active':'dormant'];
}
- // 7. Tool registries
+ // === LEVEL 7: Tool registries ===
+ $dormants['tool_registries'] = [];
foreach (['/opt/wevia-brain/tool-registry-v2.json','/opt/wevia-brain/tool-registry-v3-opus-arch.json','/var/www/html/api/wevia-tool-registry.json'] as $tr) {
if (!file_exists($tr)) continue;
$d = @json_decode(file_get_contents($tr), true);
$tools = $d['tools'] ?? [];
- $count = is_array($tools) ? count($tools) : 0;
- $dormants['tool_registries'][] = ['file'=>basename($tr),'path'=>$tr,'tools_count'=>$count,'version'=>$d['version']??'-'];
+ $dormants['tool_registries'][] = ['file'=>basename($tr),'tools_count'=>is_array($tools)?count($tools):0,'version'=>$d['version']??'-'];
+ }
+
+ // === LEVEL 8: NUCLEUS masteries (V58 NEW) ===
+ $dormants['brain_nucleus'] = [];
+ foreach (glob('/opt/wevia-brain/prompts/nucleus/*.md') as $n) {
+ $dormants['brain_nucleus'][] = ['name'=>basename($n,'.md'),'size_kb'=>round(filesize($n)/1024,1),'path'=>$n];
+ }
+
+ // === LEVEL 9: PERSONAS (V58 NEW) ===
+ $dormants['personas'] = [];
+ foreach (glob('/opt/wevia-brain/prompts/personas/*.md') as $p) {
+ $dormants['personas'][] = ['name'=>basename($p,'.md'),'size_kb'=>round(filesize($p)/1024,1)];
+ }
+
+ // === LEVEL 10: SYSTEM PROMPTS (V58 NEW) ===
+ $dormants['system_prompts'] = [];
+ foreach (glob('/opt/wevia-brain/prompts/system/*.md') as $sp) {
+ $dormants['system_prompts'][] = ['name'=>basename($sp,'.md'),'size_kb'=>round(filesize($sp)/1024,1)];
+ }
+
+ // === LEVEL 11: KNOWLEDGE BASES (V58 NEW) ===
+ $dormants['knowledge_bases'] = [];
+ foreach (glob('/opt/wevia-brain/knowledge/*.{json,md}', GLOB_BRACE) as $kb) {
+ $dormants['knowledge_bases'][] = ['name'=>basename($kb),'size_kb'=>round(filesize($kb)/1024,1),'type'=>pathinfo($kb,PATHINFO_EXTENSION)];
+ }
+
+ // === LEVEL 12: DEEP KBs (V58 NEW) ===
+ $dormants['knowledge_deep'] = [];
+ foreach (glob('/opt/wevia-brain/knowledge/deep/*.md') as $kd) {
+ $dormants['knowledge_deep'][] = ['name'=>basename($kd,'.md'),'size_kb'=>round(filesize($kd)/1024,1)];
+ }
+
+ // === LEVEL 13: OSS Skills /opt/skills (V58 NEW) ===
+ $dormants['oss_skills'] = [];
+ if (is_dir('/opt/skills')) {
+ foreach (glob('/opt/skills/*', GLOB_ONLYDIR) as $sk) {
+ $dormants['oss_skills'][] = ['name'=>basename($sk),'type'=>'dir'];
+ }
+ }
+
+ // === LEVEL 14: WEVAL ecosystem (V58 NEW) ===
+ $dormants['weval_ecosystem'] = [];
+ foreach (glob('/opt/weval-*', GLOB_ONLYDIR) as $we) {
+ $dormants['weval_ecosystem'][] = ['name'=>basename($we),'size_mb'=>round(array_sum(array_map('filesize',glob("$we/*"))) / 1024 / 1024, 1)];
+ }
+
+ // === LEVEL 15: OSS Git repos clones (V58 NEW) ===
+ $dormants['oss_repos'] = [];
+ foreach (glob('/opt/*/.git', GLOB_ONLYDIR) as $gr) {
+ $repo = basename(dirname($gr));
+ $dormants['oss_repos'][] = ['name'=>$repo,'path'=>'/opt/'.$repo];
}
$counts = [];
@@ -136,4 +176,4 @@ if ($action === 'dormants') {
exit;
}
-echo json_encode(['error'=>'action must be: list | scan | propose | dormants']);
+echo json_encode(['error'=>'action: list | scan | propose | dormants']);
diff --git a/cartographie-screens.html b/cartographie-screens.html
index 5b245dbc4..c235cc658 100644
--- a/cartographie-screens.html
+++ b/cartographie-screens.html
@@ -70,7 +70,7 @@ select{padding:10px;background:#0a0e27;color:#fff;border:1px solid #3d4476;borde
🗺️ WEVADS Cartographie Exhaustive Ecrans
-