PROOF: /proofs/wave343-cdp8of8-1777074298/ CAUSE RACINE CDP 0/8 (regression): - Doctrine 229c: chrome-profile-launch.sh redirige vers S95 (10.1.0.3 via WG) - S95 a tous les 8 CDP UP confirmes (curl 10.1.0.3:9222-9229 OK) - MAIS /api/cdp-status.php interrogeait 127.0.0.1 (LOCAL S204 = vide) - = Dashboard montrait 0/8 alors que S95 etait full operational FIX W343 (1 patch:1 ligne, surgical): - ligne 22: curl_init(http://127.0.0.1) -> curl_init(http://10.1.0.3) - ligne 58: str_replace(127.0.0.1) -> str_replace(10.1.0.3) - Ajustement WG endpoint (architecture multi-server doctrine 314) PROOF playwright PASS: - summary running=8/8 coverage_pct=100 - chart Tasks 24h alive (W338) - pas Erreur chargement (W341) - pageerror=0 Doctrine: surgical fix 1 ligne, test video AVANT commit, ZERO ecrasement, GOLD backup, chattr toggle
73 lines
2.1 KiB
PHP
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://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);
|