import { fetchClipLine } from "@/lib/articles/evidence"; import { findCitedPlay, targetOf } from "@/lib/clips/cited"; import { fail, ok } from "../../research/_respond"; export const dynamic = "force-dynamic"; // GET ?channel&video&from&to[&project&clip][&audio=1] // -> { play: CitedPlay | null, fetchLine } // // What plays a cited span now (lib/clips/cited.ts): a project's cached // window, a corpus clip window, a saved video, or audio -- found, never // fetched. `fetchLine` is the MCP line for the same seconds. export async function GET(request: Request) { try { const url = new URL(request.url); const t = targetOf((k) => url.searchParams.get(k)); return ok({ play: await findCitedPlay(t), fetchLine: fetchClipLine({ channel: t.channel, id: t.video, start: t.from, end: t.to }, url.searchParams.get("reason") || "umtool review") }); } catch (e) { return fail(e); } }