import { checkable, readRefreshChecks, runRefreshChecks } from "@/lib/inbox/refresh"; import { readLifecycle } from "@/lib/lifecycle"; import { readMutes } from "@/lib/mutes"; import { readPieceGraph } from "@/lib/pieces"; export const dynamic = "force-dynamic"; // THE DAILY REFRESH CHECK (plans/umtool-redesign.md, R4; lib/inbox/refresh.ts): // each active article's current report's enumerations again over the corpus // it read -- no fetch, no model -- kept a day. The Inbox reads what it kept and // checks a stale one in the background; this runs it NOW. // // GET what is kept (refresh-check.json) // POST { article?, force? } check (only `article`; `force`: even // one checked today) -> { checked, skipped } const headers = { "cache-control": "no-store" }; export async function GET() { return Response.json(await readRefreshChecks(), { headers }); } export async function POST(request: Request) { const body = ((await request.json().catch(() => null)) ?? {}) as { article?: unknown; force?: unknown }; const [graph, life, mutes] = await Promise.all([readPieceGraph(), readLifecycle(), readMutes()]); const out = await runRefreshChecks(checkable(graph, life, mutes), { force: body.force === true, ...(typeof body.article === "string" && body.article ? { only: body.article } : {}), }); return Response.json(out, { headers }); }