cai-exos-systems/daveadmin-exos-demo:api/agent-registry.php
api/agent-registry.php
```text
<?php
declare(strict_types=1);
require_once dirname(__DIR__) . '/auth.php';
demoRequireApiLogin();
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
http_response_code(405);
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(['error' => 'Method not allowed']);
exit;
}
$registryPath = (string)demoEnv(
'EXOS_AGENT_REGISTRY_FILE',
demoSupportDir() . DIRECTORY_SEPARATOR . 'agent-creator-registry.json'
);
$registry = [];
if (is_file($registryPath)) {
$decoded = json_decode((string)file_get_contents($registryPath), true);
if (is_array($decoded)) {
$registry = $decoded;
}
}
$items = array_map(static function (array $entry): array {
return [
'id' => $entry['id'] ?? '',
'created_at' => $entry['created_at'] ?? '',
'agent_name' => $entry['agent_name'] ?? '',
'domain' => $entry['domain'] ?? '',
'mission' => $entry['mission'] ?? '',
'tmf_apis_used' => $entry['tmf_apis_used'] ?? [],
'status' => $entry['status'] ?? 'draft',
'corpus' => $entry['corpus'] ?? 'exos_bss',
'model' => $entry['model'] ?? 'bnl-telecom',
'exports' => $entry['exports'] ?? [],
];
}, array_slice($registry, 0, 20));
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(['data' => $items], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
```