import { guarded, json } from "@/lib/api"; import { execFile } from "node:child_process"; import { promisify } from "node:util"; const run = promisify(execFile); export const maxDuration = 120; /** Live re-discovery of the provider listings (no inference). Runs the same script as the scheduled refresh. */ export const POST = guarded(async () => { const { stdout, stderr } = await run("npx", ["tsx", "scripts/registry-refresh.ts"], { cwd: process.cwd(), env: process.env, timeout: 110_000 }); return json({ ok: true, log: (stdout + stderr).trim().split("\n").slice(-5) }); });