Files

20 lines
571 B
TypeScript

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 });
}
}