/** * GET /api/sdk/agents — Liste aller Compliance-Agenten */ import { NextResponse } from 'next/server' import { COMPLIANCE_AGENTS } from '@/lib/sdk/agents/agent-registry' import { soulFileExists } from '@/lib/sdk/agents/soul-reader' export async function GET() { try { // Check SOUL file existence for each agent and set status const agents = await Promise.all( COMPLIANCE_AGENTS.map(async (agent) => { const exists = await soulFileExists(agent.id) return { ...agent, status: exists ? agent.status : 'error' as const, } }) ) const activeCount = agents.filter(a => a.status === 'active').length const errorCount = agents.filter(a => a.status === 'error').length return NextResponse.json({ agents, stats: { total: agents.length, active: activeCount, inactive: agents.length - activeCount - errorCount, error: errorCount, totalSessions: 0, avgResponseTime: '—', }, timestamp: new Date().toISOString(), }) } catch (error) { console.error('Error fetching agents:', error) return NextResponse.json({ error: 'Failed to fetch agents' }, { status: 500 }) } }