<?php
require_once __DIR__ . '/../../config.php';
require_once __DIR__ . '/../../engine/Kernel.php';
Kernel::handle(['auth' => false, 'public' => true]);
require_once __DIR__ . '/../../engine/Logger.php';
require_once __DIR__.'/../../engine/AgentEngine.php';
$lat=(float)($_GET['lat']??0);$lng=(float)($_GET['lng']??0);
if(!$lat||!$lng){http_response_code(400);echo json_encode(['error'=>'lat_lng_required']);exit;}
echo json_encode(['ok'=>true,'agents'=>AgentEngine::getNearby($lat,$lng,(float)($_GET['radius']??5))]);