'blade_actions', 'tool' => 'blade_reconciler_list']; $json_file = '/var/www/html/api/blade-actions-surfaced.json'; if (is_readable($json_file)) { $d = json_decode(@file_get_contents($json_file), true); if ($d) { $out['actions_count'] = count($d['actions'] ?? []); $out['stats'] = $d['stats'] ?? []; $out['generated_at'] = $d['generated_at'] ?? null; // Surface 3 Kaouther actions in priorité $kaouther = array_values(array_filter($d['actions'] ?? [], fn($a) => ($a['action'] ?? '') === 'kaouther_send')); $chrome = array_values(array_filter($d['actions'] ?? [], fn($a) => ($a['action'] ?? '') === 'chrome_open')); $out['kaouther'] = array_map(fn($a) => [ 'label' => $a['label'] ?? '', 'url' => $a['url'] ?? '', 'task_id' => $a['task_id'] ?? '', ], $kaouther); $out['chrome_other'] = array_map(fn($a) => [ 'label' => $a['label'] ?? '', 'url' => substr($a['url'] ?? '', 0, 100), ], $chrome); } else { $out['error'] = 'actions JSON parse failed'; } } else { $out['error'] = 'actions JSON not found. Run /opt/weval-l99/blade-task-reconciler.py'; } $out['dashboard'] = 'https://weval-consulting.com/blade-actions.html'; $out['next_step'] = 'Ouvre ' . $out['dashboard'] . ' et clique les boutons Kaouther (ouvre Gmail avec drafts prets, Send 3x)'; header("Content-Type: application/json"); echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); exit; } } // Auto-dispatch $_ba_msg = ''; $_body = @file_get_contents('php://input'); if ($_body) { $_j = @json_decode($_body, true); if (is_array($_j) && !empty($_j['message'])) $_ba_msg = $_j['message']; } if (!$_ba_msg) $_ba_msg = $_POST['message'] ?? $_GET['message'] ?? ''; if ($_ba_msg) wevia_blade_actions_list($_ba_msg);