"deprecated", "message" => "POST on agent-avatars.php is deprecated (was writing to legacy v1). Use /api/agent-avatar-update.php instead (writes to v2 SSOT, auto-backup, validation).", "new_endpoint" => "/api/agent-avatar-update.php" ]); exit; } // --- GET : derive from v2 --- if (!file_exists($SSOT_V2)) { // Fallback to legacy v1 if v2 missing (should never happen) if (file_exists($LEGACY_V1)) { echo file_get_contents($LEGACY_V1); exit; } echo "{}"; exit; } $raw = @file_get_contents($SSOT_V2); $v2 = json_decode($raw, true); if (!is_array($v2)) { echo "{}"; exit; } $format = $_GET['format'] ?? ($_GET['v'] ?? 'compat'); if ($format === '2' || $format === 'v2' || $format === 'full') { // Return full v2 structure echo $raw; exit; } // Default: v1 compat shape {name: url_or_emoji} // Legacy v1 was {name: "https://api.dicebear.com/..."} // agents-archi uses this as preload cache _pk, then WevalAvatar wrapper enriches. // We return url if present, else emoji, else "" (safe fallback). $out = []; foreach ($v2 as $name => $a) { if (!is_array($a)) continue; // DOCTRINE 14 fix (Wave-277): emoji custom > url heritage // Si user a set emoji explicite, il override le url Dicebear par defaut if (!empty($a['emoji'])) { $enc = urlencode($a['emoji']); $safeN = urlencode($name); $out[$name] = "/api/agent-avatar-svg.php?n=$safeN&e=$enc"; } elseif (!empty($a['url'])) { $out[$name] = $a['url']; } else { $out[$name] = ""; } } echo json_encode($out, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);