// Server-only dispatcher: reached only through the retry actions in actions.ts // ("use server"), so it is never bundled to the client. // // The per-kind replay logic lives in jobReplayRegistry.ts (a data-driven // lookup); this is just the dispatch over it. Re-running RE-DERIVES the work // from the channel's CURRENT state rather than replaying a frozen list — see // jobReplayRegistry.ts and jobSpec.ts. import type { JobSpec } from "yt-dlp-transcript-common/jobs/jobSpec"; import type { StreamActionResult } from "yt-dlp-transcript-common/jobs/streamCommand"; import { JOB_REPLAY_HANDLERS } from "./jobReplayRegistry"; export async function runJobSpec(spec: JobSpec): Promise { const handler = JOB_REPLAY_HANDLERS[spec.kind]; if (!handler) { return { ok: false, error: `Cannot re-run job kind: ${spec.kind}` }; } return handler(spec); }