import { NextResponse } from "next/server"; import { processAgentHeartbeat } from "@/lib/heartbeat"; export async function GET( _request: Request, { params }: { params: Promise<{ agent: string }> }, ) { const { agent } = await params; try { const result = await processAgentHeartbeat(agent); return NextResponse.json(result); } catch (error) { const message = error instanceof Error ? error.message : String(error); const status = message === "agent_not_found" ? 404 : 500; return NextResponse.json({ error: message }, { status }); } }