- import { NextResponse } from "next/server";
- import { loadAgentFeed } from "@/lib/agent-monitor";
- import { AgentStatus } from "@/types/agent";
- function isAgentStatus(value: string | null): value is AgentStatus {
- return value === "working" || value === "idle" || value === "warning" || value === "offline";
- }
- export async function GET(request: Request) {
- const { searchParams } = new URL(request.url);
- const status = searchParams.get("status");
- const feed = await loadAgentFeed(status && isAgentStatus(status) ? status : "all");
- return NextResponse.json(feed);
- }
|