'openai', 'port' => 9222, 'name' => 'ChatGPT'], ['slug' => 'anthropic', 'port' => 9223, 'name' => 'Claude.ai'], ['slug' => 'google', 'port' => 9224, 'name' => 'Gemini'], ['slug' => 'deepseek', 'port' => 9225, 'name' => 'DeepSeek'], ['slug' => 'mistral', 'port' => 9226, 'name' => 'Mistral'], ['slug' => 'poe', 'port' => 9227, 'name' => 'Poe'], ['slug' => 'perplexity', 'port' => 9228, 'name' => 'Perplexity'], ['slug' => 'hf', 'port' => 9229, 'name' => 'HuggingFace'], ]; $results = []; $up = 0; foreach ($PROFILES as $p) { $ch = curl_init("http://10.1.0.3:{$p['port']}/json/version"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT_MS => 1200, CURLOPT_CONNECTTIMEOUT_MS => 600, CURLOPT_FAILONERROR => false ]); $resp = curl_exec($ch); $http = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $status = 'offline'; $browser = null; $wsUrl = null; if ($http === 200 && $resp) { $data = @json_decode($resp, true); if (isset($data['Browser'])) { $status = 'running'; $browser = $data['Browser']; $wsUrl = $data['webSocketDebuggerUrl'] ?? null; $up++; } } // Also check process $pidOut = trim(shell_exec("pgrep -f 'chrome.*remote-debugging-port={$p['port']}' | head -1")); $results[] = [ 'slug' => $p['slug'], 'port' => $p['port'], 'name' => $p['name'], 'status' => $status, 'browser' => $browser, 'pid' => $pidOut ?: null, 'cdp_listening' => $status === 'running', 'ws_url' => $wsUrl ? str_replace('10.1.0.3', 'weval-consulting.com', $wsUrl) : null ]; } echo json_encode([ 'ok' => true, 'ts' => date('c'), 'summary' => [ 'total' => count($PROFILES), 'running' => $up, 'offline' => count($PROFILES) - $up, 'coverage_pct' => round($up / count($PROFILES) * 100, 1) ], 'providers' => $results ], JSON_PRETTY_PRINT);