auto-sync-1540

This commit is contained in:
opus
2026-04-19 15:40:02 +02:00
parent caaad11fc8
commit 98eb7d9cbe
64 changed files with 173 additions and 125 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 KiB

After

Width:  |  Height:  |  Size: 427 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 303 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 KiB

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 KiB

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 KiB

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 KiB

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 KiB

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 KiB

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 KiB

After

Width:  |  Height:  |  Size: 427 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 KiB

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 KiB

After

Width:  |  Height:  |  Size: 296 KiB

View File

@@ -1,7 +1,7 @@
{
"ok": true,
"version": "V83-business-kpi",
"ts": "2026-04-19T13:35:13+00:00",
"ts": "2026-04-19T13:39:52+00:00",
"summary": {
"total_categories": 7,
"total_kpis": 56,

View File

@@ -30,6 +30,11 @@ if ($__fp_input && isset($__fp_input["message"])) {
$st = $__fw_r["ok"] ? "SUCCESS" : "ERROR";
$tx = $__fw_r["ok"] ? $__fw_r["message"] . " Git: " . ($__fw_r["git"] ?? "n/a") : "ERREUR: " . ($__fw_r["error"] ?? "inconnue");
echo "data: " . json_encode(["type"=>"exec","text"=>$tx,"engine"=>"FileWrite/autonomous","intent"=>"file_write","status"=>$st]) . "\n\n";
/*FILE_WRITE_ANSWER_V7*/
$__fw_reply = $__fw_r["ok"]
? "J ai cree le fichier. " . ($__fw_r["message"] ?? "")
: "Je n ai pas pu creer le fichier : " . ($__fw_r["error"] ?? "raison inconnue") . ". Precise le chemin exact si tu veux reessayer.";
echo "data: " . json_encode(["type"=>"answer","text"=>$__fw_reply,"engine"=>"FileWrite/v7","intent"=>"file_write"]) . "\n\n";
echo "data: [DONE]\n\n";
exit;
}

View File

@@ -1,19 +1,18 @@
<?php
/**
* WEVIA Unified API · Agents + Intents + Skills + Brains + Pages · agrégés
* Source unique pour le Unified Hub
* WEVIA Unified API v2 · TOUTES les 7 sources agents + déduplication
* Opus Yacine · 19avr2026
*/
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
header('Access-Control-Allow-Origin: *');
$action = $_GET['action'] ?? 'all';
$action = $_GET['action'] ?? 'summary';
$QDRANT = 'http://127.0.0.1:6333';
function qdrant($url, $m='GET', $d=null) {
$ch = curl_init($url);
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER=>true, CURLOPT_TIMEOUT=>8, CURLOPT_CUSTOMREQUEST=>$m]);
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER=>true, CURLOPT_TIMEOUT=>6, CURLOPT_CUSTOMREQUEST=>$m]);
if ($d) { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($d)); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); }
$r = curl_exec($ch); curl_close($ch);
return json_decode($r ?: '{}', true);
@@ -21,49 +20,97 @@ function qdrant($url, $m='GET', $d=null) {
$out = ['ok'=>true, 'ts'=>date('c')];
// === AGENTS (consolidated) ===
$agents = [];
// ============== AGENTS MULTI-SOURCE DÉDUPLIQUÉ ==============
$agents_by_name = []; // key = normalized name → metadata
$sources_counts = [];
// Source 1: /api/*agent*.json
foreach (glob('/var/www/html/api/*agent*.json') as $f) {
$name = basename($f, '.json');
$info = @json_decode(@file_get_contents($f), true);
$agents[] = [
'name' => $name,
'source' => 'api_files',
'type' => 'file',
'path' => str_replace('/var/www/html', '', $f),
'desc' => $info['description'] ?? $info['desc'] ?? 'Agent file',
];
function normalize_name($n) { return strtolower(trim(preg_replace('/[^a-z0-9]+/i', '_', $n), '_')); }
function add_agent(&$reg, $name, $source, $meta = []) {
if (!$name) return;
$key = normalize_name($name);
if (!isset($reg[$key])) {
$reg[$key] = ['name' => $name, 'sources' => [], 'meta' => $meta];
}
if (!in_array($source, $reg[$key]['sources'])) {
$reg[$key]['sources'][] = $source;
}
$reg[$key]['meta'] = array_merge($reg[$key]['meta'], $meta);
}
// Source 2: /api/agent-stubs/*.php
// Source 1: agent-avatars-v2.json (most complete · 148 agents)
$av2 = @json_decode(@file_get_contents('/var/www/html/api/agent-avatars-v2.json'), true);
$sources_counts['agent_avatars_v2'] = 0;
if (is_array($av2)) {
foreach ($av2 as $name => $meta) {
add_agent($agents_by_name, $name, 'agent_avatars_v2', is_array($meta) ? $meta : []);
$sources_counts['agent_avatars_v2']++;
}
}
// Source 2: agent-avatars.json (136 agents · older)
$av1 = @json_decode(@file_get_contents('/var/www/html/api/agent-avatars.json'), true);
$sources_counts['agent_avatars_v1'] = 0;
if (is_array($av1)) {
foreach ($av1 as $name => $meta) {
add_agent($agents_by_name, $name, 'agent_avatars_v1', is_array($meta) ? $meta : []);
$sources_counts['agent_avatars_v1']++;
}
}
// Source 3: wevia-agents-registry.json (47 categorized · categories metadata)
$reg_cat = @json_decode(@file_get_contents('/var/www/html/api/wevia-agents-registry.json'), true);
$sources_counts['wevia_agents_registry'] = $reg_cat['total'] ?? 0;
// Categories metadata used later
// Source 4: paperclip-agility-agents-registered.json (12 agents V71)
$pc_agility = @json_decode(@file_get_contents('/var/www/html/api/paperclip-agility-agents-registered.json'), true);
$sources_counts['paperclip_agility_v71'] = 0;
if (is_array($pc_agility) && isset($pc_agility['agents'])) {
foreach ($pc_agility['agents'] as $a) {
add_agent($agents_by_name, $a['name'] ?? '?', 'paperclip_agility_v71', ['category' => $a['category'] ?? 'agility', 'icon' => $a['icon'] ?? '🤖', 'role' => $a['role'] ?? '']);
$sources_counts['paperclip_agility_v71']++;
}
}
// Source 5: /api/*agent*.json files (11 files)
$sources_counts['api_agent_files'] = 0;
foreach (glob('/var/www/html/api/*agent*.json') as $f) {
$fname = basename($f, '.json');
// Skip the registries we already processed
if (in_array($fname, ['agent-avatars', 'agent-avatars-v2', 'wevia-agents-registry', 'paperclip-agility-agents-registered', 'wevia-agents-pack-status'])) continue;
add_agent($agents_by_name, $fname, 'api_agent_files', ['path' => str_replace('/var/www/html','',$f)]);
$sources_counts['api_agent_files']++;
}
// Source 6: /api/agent-stubs/*.php (50 stubs)
$sources_counts['agent_stubs'] = 0;
foreach (glob('/var/www/html/api/agent-stubs/*.php') as $f) {
$name = basename($f, '.php');
$agents[] = [
'name' => $name,
'source' => 'agent_stubs',
'type' => 'stub_php',
'path' => str_replace('/var/www/html', '', $f),
'desc' => 'Agent stub PHP',
];
add_agent($agents_by_name, $name, 'agent_stubs', ['type' => 'stub_php']);
$sources_counts['agent_stubs']++;
}
// Source 3: /api/sub-agents/*.json (Claude Code pattern · 65 new)
// Source 7: /api/sub-agents/*.json (65 Claude sub-agents)
$sources_counts['claude_subagents'] = 0;
foreach (glob('/var/www/html/api/sub-agents/*.json') as $f) {
$name = basename($f, '.json');
$info = @json_decode(@file_get_contents($f), true);
$agents[] = [
'name' => $name,
'source' => 'claude_code_subagents',
'type' => 'sub_agent',
'category' => $info['category'] ?? 'dev',
'path' => str_replace('/var/www/html', '', $f),
'desc' => $info['description'] ?? 'Claude Code sub-agent',
];
$data = @json_decode(@file_get_contents($f), true);
$name = $data['name'] ?? basename($f, '.json');
add_agent($agents_by_name, $name, 'claude_subagents', $data ?: []);
$sources_counts['claude_subagents']++;
}
// === INTENTS ===
// Source 8: Qdrant weval_agents_registry (if exists)
$qdrant_agents = qdrant("$QDRANT/collections/weval_agents_registry");
$sources_counts['qdrant_agents_vectorized'] = $qdrant_agents['result']['points_count'] ?? 0;
// Paperclip ecosystem reference (from disk)
$paperclip_dirs = glob('/opt/deer-flow/skills/weval/paperclip*', GLOB_ONLYDIR);
$sources_counts['paperclip_opt_catalog'] = is_array($paperclip_dirs) ? count($paperclip_dirs) : 0;
$agents_unique_count = count($agents_by_name);
// ============== INTENTS ==============
$intents = [];
foreach (glob('/var/www/html/api/wired-pending/intent-*.php') as $f) {
ob_start();
@@ -76,114 +123,110 @@ foreach (glob('/var/www/html/api/wired-pending/intent-*.php') as $f) {
'status' => $info['status'] ?? '?',
'triggers' => array_slice($info['triggers'] ?? [], 0, 3),
'source' => $info['source'] ?? '?',
'desc' => $info['description'] ?? '',
];
}
}
// === SKILLS (5 sources) ===
$skills_disk = [];
foreach (glob('/var/www/html/skills/*', GLOB_ONLYDIR) as $dir) {
$name = basename($dir);
$has_md = file_exists("$dir/SKILL.md");
$sub_count = count(glob("$dir/*", GLOB_ONLYDIR));
$skills_disk[] = [
'name' => $name,
'has_skill_md' => $has_md,
'sub_count' => $sub_count,
'path' => "/skills/$name/",
];
}
$qdrant_info = qdrant("$QDRANT/collections/weval_skills");
$qdrant_count = $qdrant_info['result']['points_count'] ?? 0;
$arena = @json_decode(@file_get_contents('/var/www/html/api/arena-intent-registry.json'), true);
// ============== SKILLS ==============
$skills_disk = glob('/var/www/html/skills/*', GLOB_ONLYDIR);
$qdrant_skills = qdrant("$QDRANT/collections/weval_skills");
$qdrant_skills_count = $qdrant_skills['result']['points_count'] ?? 0;
$reg = @json_decode(@file_get_contents('/var/www/html/api/wevia-tool-registry.json'), true);
$tools_count = isset($reg['tools']) && is_array($reg['tools']) ? count($reg['tools']) : 0;
$arena = @json_decode(@file_get_contents('/var/www/html/api/arena-intent-registry.json'), true);
$arena_skills = $arena['total_skills'] ?? 0;
// === BRAINS ===
// Doctrines (58 mentioned in screenshots)
$doctrine_files = glob('/var/www/html/api/doctrine*.json');
$doctrines_count = is_array($doctrine_files) ? count($doctrine_files) : 0;
// Also check /opt/wevads/doctrines/
$doctrine_files2 = glob('/opt/wevads/doctrines/*.md');
if (is_array($doctrine_files2)) $doctrines_count += count($doctrine_files2);
// ============== BRAINS ==============
$brain_patterns = ['/var/www/html/api/*brain*.php', '/var/www/html/api/*brain*.json', '/var/www/html/api/*brain*.py'];
$brains = [];
$brain_files = [
'/var/www/html/api/wevia-master-brain.json' => ['name'=>'WEVIA Master Brain', 'type'=>'json', 'purpose'=>'Core orchestration config'],
'/var/www/html/api/wevia-brain-orchestrator.php' => ['name'=>'Brain Orchestrator', 'type'=>'php', 'purpose'=>'Cascade routing logic'],
'/var/www/html/api/ethica-brain.php' => ['name'=>'Ethica Brain', 'type'=>'php', 'purpose'=>'HCP intelligence'],
'/var/www/html/api/weval-brain-finetune.py' => ['name'=>'Weval Brain Finetune', 'type'=>'python', 'purpose'=>'ML finetuning'],
];
foreach ($brain_files as $path => $meta) {
if (file_exists($path)) {
$brains[] = array_merge($meta, [
'path' => str_replace('/var/www/html', '', $path),
'size' => filesize($path),
]);
foreach ($brain_patterns as $pat) {
foreach (glob($pat) as $f) {
$name = basename($f);
// Filter noise
if (strpos($name, 'playwright') !== false) continue;
if (strpos($name, 'screenshot') !== false) continue;
$brains[] = [
'name' => str_replace(['.php','.json','.py'], '', $name),
'path' => str_replace('/var/www/html','',$f),
'type' => pathinfo($f, PATHINFO_EXTENSION),
'size' => filesize($f),
];
}
}
// === DASHBOARDS (wevia-*.html + agents-*.html) ===
$dashboards = [];
$dash_paths = array_merge(
// Dashboards
$dash_paths = array_unique(array_merge(
glob('/var/www/html/wevia-*.html') ?: [],
glob('/var/www/html/agents-*.html') ?: [],
glob('/var/www/html/*-dashboard*.html') ?: [],
glob('/var/www/html/*-hub*.html') ?: [],
glob('/var/www/html/l99*.html') ?: []
);
$dash_paths = array_unique($dash_paths);
foreach ($dash_paths as $p) {
$name = basename($p, '.html');
$size = filesize($p);
$category = 'other';
if (strpos($name, 'agents') === 0) $category = 'agents';
elseif (strpos($name, 'wevia-autonomy') !== false) $category = 'autonomy';
elseif (strpos($name, 'business-visual') !== false) $category = 'bvs';
elseif (strpos($name, 'director') !== false) $category = 'director';
elseif (strpos($name, 'master') !== false || strpos($name, 'chat') !== false) $category = 'chat';
elseif (strpos($name, 'dashboard') !== false) $category = 'dashboard';
elseif (strpos($name, 'hub') !== false) $category = 'hub';
elseif (strpos($name, 'l99') !== false) $category = 'l99';
elseif (strpos($name, 'visual') !== false) $category = 'visual';
elseif (strpos($name, 'bvs') !== false) $category = 'bvs';
elseif (strpos($name, 'em-') !== false) $category = 'em';
elseif (strpos($name, 'wevia-') === 0) $category = 'wevia';
$dashboards[] = [
'name' => $name,
'url' => '/' . basename($p),
'size' => $size,
'category' => $category,
];
}
usort($dashboards, fn($a,$b) => strcmp($a['category'].$a['name'], $b['category'].$b['name']));
glob('/var/www/html/l99*.html') ?: [],
));
$dashboards_count = count($dash_paths);
// === APIs ===
// APIs
$apis_count = count(glob('/var/www/html/api/*.php') ?: []);
// === SUMMARY ===
if ($action === 'all' || $action === 'summary') {
$out['summary'] = [
'agents_total' => count($agents),
'agents_by_source' => array_count_values(array_column($agents, 'source')),
'intents_total' => count($intents),
'intents_by_domain' => array_count_values(array_column($intents, 'domain')),
'intents_by_status' => array_count_values(array_column($intents, 'status')),
'skills_disk_dirs' => count($skills_disk),
'skills_qdrant' => $qdrant_count,
'skills_tools_registry' => $tools_count,
'skills_arena_declared' => $arena_skills,
'skills_total' => count($skills_disk) + $qdrant_count + $tools_count + $arena_skills,
'brains_total' => count($brains),
'dashboards_total' => count($dashboards),
'dashboards_by_category' => array_count_values(array_column($dashboards, 'category')),
'apis_php_total' => $apis_count,
];
// ============== OUTPUT ==============
$out['summary'] = [
'agents' => [
'UNIQUE_DEDUP' => $agents_unique_count, // Real unique agents
'per_source' => $sources_counts,
'total_with_overlaps' => array_sum($sources_counts),
'note' => 'Agents dédupliqués par nom normalisé · fusion 7+ sources',
],
'intents' => [
'php_files' => count($intents),
'arena_declared' => $arena['total_intents'] ?? 0,
'by_status' => array_count_values(array_column($intents, 'status')),
'by_domain' => array_count_values(array_column($intents, 'domain')),
],
'skills' => [
'disk_dirs' => count($skills_disk),
'qdrant_vectorized' => $qdrant_skills_count,
'tools_registry' => $tools_count,
'arena_declared' => $arena_skills,
'doctrines' => $doctrines_count,
'TOTAL_ALL_SOURCES' => count($skills_disk) + $qdrant_skills_count + $tools_count + $arena_skills,
],
'brains' => [
'count' => count($brains),
'list' => $brains,
],
'dashboards' => $dashboards_count,
'apis' => $apis_count,
];
if ($action === 'agents') {
$agents_list = [];
foreach ($agents_by_name as $key => $a) {
$agents_list[] = [
'name' => $a['name'],
'key' => $key,
'sources' => $a['sources'],
'sources_count' => count($a['sources']),
'category' => $a['meta']['category'] ?? '?',
'role' => $a['meta']['role'] ?? $a['meta']['description'] ?? '',
'icon' => $a['meta']['icon'] ?? $a['meta']['emoji'] ?? '',
];
}
// Sort by sources_count desc (most referenced first), then alpha
usort($agents_list, function($a,$b) {
if ($a['sources_count'] !== $b['sources_count']) return $b['sources_count'] - $a['sources_count'];
return strcmp($a['name'], $b['name']);
});
$out['agents'] = $agents_list;
}
if ($action === 'all' || $action === 'agents') $out['agents'] = $agents;
if ($action === 'all' || $action === 'intents') $out['intents'] = $intents;
if ($action === 'all' || $action === 'skills') $out['skills'] = ['disk'=>$skills_disk, 'qdrant_count'=>$qdrant_count, 'tools_count'=>$tools_count, 'arena_count'=>$arena_skills];
if ($action === 'all' || $action === 'brains') $out['brains'] = $brains;
if ($action === 'all' || $action === 'dashboards') $out['dashboards'] = $dashboards;
if ($action === 'intents') $out['intents_list'] = $intents;
if ($action === 'brains') $out['brains_list'] = $brains;
echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);