import { createFileRoute } from '@tanstack/react-router'; import { createServerFn } from '@tanstack/react-start'; const loadPublicAgentCard = createServerFn({ method: 'GET' }).handler( async () => { const { handlers } = await import('@/lib/agent'); const response = await handlers.manifest({ request: new Request( 'http://agent.local/api/agent/.well-known/agent-card.json' ), }); if (!response.ok) throw new Error('Agent Card unavailable'); const card = (await response.json()) as { name?: string; description?: string; version?: string; }; return { name: card.name ?? 'Agent API', description: card.description ?? 'Headless agent API', version: card.version, }; } ); export const Route = createFileRoute('/')({ loader: () => loadPublicAgentCard(), component: ApiDirectory, }); function ApiDirectory() { const agent = Route.useLoaderData(); return (

API only

{agent.name}

{agent.description}

{agent.version ? (
Version
{agent.version}
) : null}
Agent Card
Open JSON
Health
Check status
); }