Files
html/api/cdp-status.php
Opus cf8108658d feat(chrome-cdp): wave 308 - 8/8 CDP live + doctrine no-overlap
- chrome-profile-launch.sh: CDP port mapping 9222-9229 per profile
- chrome-profile-launch.sh: --remote-debugging-port ajoute + address 0.0.0.0
- chrome-profile-launch.sh: PID extraction direct pgrep (no tmpfile)
- chrome-profile-launch.sh: JSON output include cdp_port + cdp_listening verify
- api/cdp-status.php NEW: proxy 8 CDP ports + bypass CORS 127.0.0.1
- vnc-picker.html: toast-stack BR->BL (doctrine zero overlap)
- vnc-picker.html: live polling 5s via /api/cdp-status.php
- vnc-picker.html: summary badge CDP LIVE x/8 coverage %
- 8/8 Chrome profiles running (openai/anthropic/google/deepseek/mistral/poe/perplexity/hf)
- 49 chrome processes active with CDP ports 9222-9229 listening
- Doctrine 308 wired: CDP port mapping + status proxy centralise
- GOLD: gold_vnc_picker_toast_fix + gold_chrome_launch_w308 + gold_vnc_picker_live_status_w308
2026-04-24 11:26:27 +02:00

73 lines
2.1 KiB
PHP

<?php
// API: /api/cdp-status.php
// Wave 308 - WEVIA CDP status proxy (bypass browser CORS 127.0.0.1 limit)
header('Content-Type: application/json');
header('Cache-Control: no-store');
$PROFILES = [
['slug' => '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://127.0.0.1:{$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('127.0.0.1', '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);