[taskboard] add heartbeat task pickup
This commit is contained in:
19
app/api/heartbeat/[agent]/route.ts
Normal file
19
app/api/heartbeat/[agent]/route.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user