Files
html/api/agents-status.php
2026-04-12 22:57:03 +02:00

97 lines
4.4 KiB
PHP

<?php
// WEVAL Agents Status API — Real-time status of all agents
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
$agents = [];
// 1. oh-my-claudecode 19 agents
$agent_dir = '/opt/oh-my-claudecode/agents';
if (is_dir($agent_dir)) {
foreach (glob("$agent_dir/*.md") as $f) {
$name = basename($f, '.md');
$content = file_get_contents($f);
$desc = '';
if (preg_match('/^#\s+(.+)/m', $content, $m)) $desc = $m[1];
$agents[] = ['name' => $name, 'type' => 'cognitive', 'source' => 'oh-my-claudecode', 'status' => 'active', 'desc' => substr($desc, 0, 60)];
}
}
// 2. Paperclip CEO
$pc = @file_get_contents('http://127.0.0.1:3100/ready');
$agents[] = ['name' => 'CEO', 'type' => 'autonomous', 'source' => 'Paperclip', 'status' => $pc ? 'active' : 'down', 'desc' => 'Autonomous CEO agent (sovereign AI)', 'port' => 3100];
// 3. WEDROID
$wd = @file_get_contents('https://weval-consulting.com/api/wedroid-brain-api.php?k=DROID2026&action=status');
$agents[] = ['name' => 'WEDROID', 'type' => 'backend', 'source' => 'WEVAL', 'status' => $wd ? 'active' : 'down', 'desc' => 'Backend diagnostic + correction v5.0'];
// 4. DeerFlow Research
$df = @fsockopen('127.0.0.1', 3002, $e, $s, 2);
$agents[] = ['name' => 'DeerFlow', 'type' => 'research', 'source' => 'OSS', 'status' => $df ? 'active' : 'down', 'desc' => 'Deep research multi-agent (113 skills)'];
if ($df) fclose($df);
// 5. MiroFish
$mf = @fsockopen('127.0.0.1', 3050, $e, $s, 2);
$agents[] = ['name' => 'MiroFish', 'type' => 'creative', 'source' => 'OSS', 'status' => $mf ? 'active' : 'down', 'desc' => 'Creative AI agent'];
if ($mf) fclose($mf);
// 6. SuperClaude Modes
$modes = json_decode(@file_get_contents('/var/www/html/api/superclaude-modes.json'), true);
if ($modes) {
foreach ($modes['modes'] ?? [] as $key => $mode) {
$agents[] = ['name' => '/sc:' . $key, 'type' => 'mode', 'source' => 'SuperClaude', 'status' => 'active', 'desc' => $mode['desc'] ?? $key, 'icon' => $mode['icon'] ?? ''];
}
}
// 7. Watchdog
$agents[] = ['name' => 'Watchdog', 'type' => 'monitor', 'source' => 'WEVAL', 'status' => 'active', 'desc' => 'Service watchdog cron */3min + Telegram alert'];
// 8. Guardian
$agents[] = ['name' => 'Guardian', 'type' => 'security', 'source' => 'WEVAL', 'status' => 'active', 'desc' => 'Infrastructure protection + chattr'];
// 9. Blade Sentinel
$bl = json_decode(@file_get_contents('https://weval-consulting.com/api/blade-api.php?k=BLADE2026&action=status'), true);
$agents[] = ['name' => 'Blade Sentinel', 'type' => 'desktop', 'source' => 'WEVAL', 'status' => ($bl['blade']['online'] ?? false) ? 'active' : 'offline', 'desc' => 'Razer Blade agent + PowerShell executor'];
// 10. Ethica Scraper
$agents[] = ['name' => 'Ethica Scraper', 'type' => 'scraper', 'source' => 'WEVAL', 'status' => 'active', 'desc' => 'DabaDoc + LinkedIn HCP enrichment (132K+)'];
// Stats
$active = count(array_filter($agents, fn($a) => $a['status'] === 'active'));
$total = count($agents);
// 5. Paperclip Fleet (50 agents)
$pc_agents = @file_get_contents('http://127.0.0.1:3100/api/companies/dd12987b-c774-45e7-95fd-d34003f91650/agents');
if ($pc_agents) {
$pc_data = json_decode($pc_agents, true);
if (is_array($pc_data)) {
foreach ($pc_data as $pa) {
$agents[] = [
'name' => $pa['name'] ?? '?',
'type' => $pa['role'] ?? 'general',
'source' => 'Paperclip',
'status' => ($pa['status'] ?? 'idle') === 'idle' ? 'active' : $pa['status'],
'desc' => 'Paperclip agent - ' . ($pa['role'] ?? ''),
'id' => $pa['id'] ?? ''
];
}
}
}
echo json_encode([
'ok' => true,
'agents' => $agents,
'total' => count($agents),
'active' => count(array_filter($agents, fn($a) => ($a['status'] ?? '') === 'active')),
'types' => [
'cognitive' => count(array_filter($agents, fn($a) => $a['type'] === 'cognitive')),
'autonomous' => count(array_filter($agents, fn($a) => $a['type'] === 'autonomous')),
'mode' => count(array_filter($agents, fn($a) => $a['type'] === 'mode')),
'backend' => count(array_filter($agents, fn($a) => $a['type'] === 'backend')),
'monitor' => count(array_filter($agents, fn($a) => in_array($a['type'], ['monitor', 'security']))),
],
'timestamp' => date('Y-m-d H:i:s'),
], JSON_PRETTY_PRINT);