($h && $h['status'] === 'ok') ? 'active' : 'down','service'=>'MiroFish Swarm Intelligence','reports'=>$reps['count'] ?? 0,'capabilities'=>['report_generate','report_chat','simulation','graph'],'url'=>'https://mirofish.weval-consulting.com']); break; case 'ceo': $health = json_decode(@file_get_contents("$MF/health"), true); $reports = json_decode(@file_get_contents("$MF/api/report/list"), true); $arch = json_decode(@file_get_contents("/var/www/html/api/architecture-index.json"), true); echo json_encode(['mirofish'=>['status'=>$health['status'] ?? 'unknown','reports'=>$reports['count'] ?? 0],'infrastructure'=>['score'=>$arch['recommendations']['score'] ?? 0,'docker'=>count($arch['docker'] ?? [])],'actions'=>['Generate prediction report','Chat with report','Run simulation','CEO insights']]); break; case 'generate': $topic = $_POST['topic'] ?? $_GET['topic'] ?? ''; if (!$topic) { echo json_encode(['error'=>'topic required']); break; } $ctx = stream_context_create(['http'=>['method'=>'POST','header'=>"Content-Type: application/json\r\n",'content'=>json_encode(['topic'=>$topic,'language'=>'fr']),'timeout'=>30]]); echo @file_get_contents("$MF/api/report/generate", false, $ctx) ?: '{}'; break; case 'reports': echo @file_get_contents("$MF/api/report/list") ?: '{"count":0}'; break; default: echo json_encode(['error'=>'Unknown action','actions'=>['health','ceo','generate','reports']]); }