Files
openshell_controller/app/api/fleet/owner/inbox/route.ts
T

26 lines
936 B
TypeScript

import { NextResponse } from "next/server"
import { mcpCallTool, FLEET_BOARD_MCP_URL } from "@/app/lib/fleet/fleetSource"
export const dynamic = "force-dynamic"
/**
* GET /api/fleet/owner/inbox — Owner-Inbox (NAR-Verfahren §1.3):
* Alle Tasks an 'tower-owner' via board-service list_owner_inbox.
* status=submitted = wartet auf Owner-Entscheidung.
*/
export async function GET() {
try {
const res = await mcpCallTool(FLEET_BOARD_MCP_URL, "list_owner_inbox", {})
if (!res.ok) {
return NextResponse.json({ error: `list_owner_inbox: ${res.error}` }, { status: 500 })
}
const payload = typeof res.data === "string" ? JSON.parse(res.data) : res.data
return NextResponse.json(payload, { headers: { "Cache-Control": "no-store" } })
} catch (err) {
return NextResponse.json(
{ error: `OWNER_INBOX_FAILED: ${err instanceof Error ? err.message : String(err)}` },
{ status: 500 }
)
}
}