import { NextResponse } from "next/server"; import { API_DAEMON_URL } from "../../../../../lib/apiDaemon"; /** Client components can't reach api-daemon's internal Docker hostname directly — this proxies the (auth-free, read-only) debug endpoint through the frontend's own origin. */ export async function GET(_req: Request, { params }: { params: Promise<{ sessionId: string }> }) { const { sessionId } = await params; const res = await fetch(`${API_DAEMON_URL}/debug/capture/${sessionId}`, { cache: "no-store" }); if (!res.ok) return NextResponse.json({ lines: [] }, { status: res.status }); const data = await res.json(); return NextResponse.json(data); }