fleet(tower): 0.18 — Tasks-View (Spool/Dead-Letter/Alarm) + Task-Detail-Modal + /healthz + /api/status; Fleet-Views 0.13-0.18 erstmals versioniert
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { NextResponse } from "next/server"
|
||||
import { readJournalTail } from "@/app/lib/fleet/fleetSource"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
/**
|
||||
* GET /api/fleet/escalations — HITL-/Escalation-Historie (Kernfeature 4):
|
||||
* Journal-Filter auf type=escalation + rejected-Events (Quarantine).
|
||||
* Kein psql — Escalations sind Spool-Envelopes, die DB bleibt reiner Index.
|
||||
*/
|
||||
export async function GET() {
|
||||
try {
|
||||
const tail = readJournalTail(500)
|
||||
const escalations = tail.filter(
|
||||
(l) => l.event === "accepted" && l.type === "escalation"
|
||||
)
|
||||
const rejected = tail.filter((l) => l.event === "rejected")
|
||||
return NextResponse.json(
|
||||
{
|
||||
escalations: escalations.reverse(),
|
||||
rejected: rejected.reverse(),
|
||||
counts: { escalations: escalations.length, rejected: rejected.length },
|
||||
},
|
||||
{ headers: { "Cache-Control": "no-store" } }
|
||||
)
|
||||
} catch (err) {
|
||||
return NextResponse.json(
|
||||
{ error: `FLEET_ESCALATIONS_FAILED: ${err instanceof Error ? err.message : String(err)}` },
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user