commit 982dbb2b61fb2dc0f5f4740dc4536d9c2372febe
parent ab0835f786c8222429d8e3f5854a54f400cca282
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 5 Nov 2026 02:56:02 -0500
umtool: Reads and voices queues the whole cut's reads -- Queue: draft every script (posts narrate --all --draft-scripts) and Queue: read every missing take (--all --take) as steps of the durable queue (lib/queue/ addStep, the argv built by the route, never taken from the page), with the qid and a link to Jobs, where each has its state, Retry and Cancel
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/umtool/app/api/report/pronunciation/route.ts b/umtool/app/api/report/pronunciation/route.ts
@@ -1,6 +1,8 @@
import { projectRef } from "@/lib/projects";
import { refuseCaller } from "@/lib/report/caller";
import { sayCommand, voicesCommand } from "@/lib/report/postSay.mjs";
+import { addStep } from "@/lib/queue/store.mjs";
+import { kickQueue, queueDir } from "@/lib/queue/runner";
export const dynamic = "force-dynamic";
@@ -14,6 +16,10 @@ export const dynamic = "force-dynamic";
// { project, op: "say-try", text, item? } posts say <p> try "<text>"
// { project, op: "voices-set", handle, voice } posts voices <p> set <handle|*> <voice>
// { project, op: "voices-remove", handle } posts voices <p> remove <handle|*>
+// { project, op: "queue-narrate", what: "scripts" | "takes" } QUEUED (lib/queue/, /jobs): posts narrate <p> --all
+// --draft-scripts | --all --take -- long, so a step of
+// the queue, never a request held open; the argv is built
+// here, never taken from the page
type Flags = Map<string, string | true>;
async function run(fn: (out: (s: string) => void) => Promise<number>) {
@@ -55,6 +61,20 @@ export async function POST(request: Request) {
else if (b.op === "say-try") r = await say(project, ["try", s("text")], flags);
else if (b.op === "voices-set") r = await voices(project, ["set", s("handle"), s("voice")]);
else if (b.op === "voices-remove") r = await voices(project, ["remove", s("handle")]);
- else return Response.json({ error: "op must be say-add, say-remove, say-try, voices-set or voices-remove" }, { status: 400 });
+ else if (b.op === "queue-narrate") {
+ const what = b.what === "takes" ? "takes" : "scripts";
+ try {
+ const step = (await addStep(queueDir(), {
+ argv: ["posts", "narrate", project.id, "--all", what === "takes" ? "--take" : "--draft-scripts"],
+ label: what === "takes" ? `read every missing post take of ${project.id}` : `draft every post script of ${project.id}`,
+ target: { project: project.id, take: null },
+ by: "the umtool app (Reads and voices)",
+ })) as { qid: string };
+ kickQueue();
+ return Response.json({ exit: 0, json: { queued: step.qid } }, { headers: { "cache-control": "no-store" } });
+ } catch (e) {
+ return Response.json({ exit: 1, json: null, error: e instanceof Error ? e.message : String(e) }, { status: 400 });
+ }
+ } else return Response.json({ error: "op must be say-add, say-remove, say-try, voices-set, voices-remove or queue-narrate" }, { status: 400 });
return Response.json(r, { status: r.exit === 0 ? 200 : 400, headers: { "cache-control": "no-store" } });
}
diff --git a/umtool/components/projects/PronunciationPanel.tsx b/umtool/components/projects/PronunciationPanel.tsx
@@ -3,6 +3,7 @@
import { useCallback, useEffect, useState } from "react";
import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
+import { jobsHref } from "@/lib/hrefs";
// ---------------------------------------------------------------------------
// READS AND VOICES for a cut of posts (lane/ui-simplify, 5 Nov): the
@@ -30,6 +31,7 @@ export default function PronunciationPanel({ project }: { project: string }) {
const [tried, setTried] = useState<string | null>(null);
const [handle, setHandle] = useState("");
const [voice, setVoice] = useState("");
+ const [queued, setQueued] = useState<string | null>(null);
const load = useCallback(async () => {
const r = await fetch(`/api/report/pronunciation?project=${encodeURIComponent(project)}`, { cache: "no-store" });
const j = await r.json().catch(() => null);
@@ -160,6 +162,24 @@ export default function PronunciationPanel({ project }: { project: string }) {
</button>
</div>
</section>
+ {/* The whole cut's reads, long: steps of the queue (/jobs: their state, Retry, Cancel). */}
+ <section className="flex flex-wrap items-center gap-1.5 lg:col-span-2" data-narrate-all="">
+ <span className="micro">every post</span>
+ <button type="button" data-narrate-all-queue="scripts" disabled={busy} onClick={() => void post({ op: "queue-narrate", what: "scripts" }).then((j) => setQueued((j?.json as { queued?: string } | null)?.queued ?? null))} className={buttonVariants({ variant: "outline", size: "sm" })} title="umtool posts narrate <p> --all --draft-scripts, as a queue step">
+ Queue: draft every script
+ </button>
+ <button type="button" data-narrate-all-queue="takes" disabled={busy} onClick={() => void post({ op: "queue-narrate", what: "takes" }).then((j) => setQueued((j?.json as { queued?: string } | null)?.queued ?? null))} className={buttonVariants({ variant: "outline", size: "sm" })} title="umtool posts narrate <p> --all --take, as a queue step (resumable)">
+ Queue: read every missing take
+ </button>
+ {queued && (
+ <span className="text-text-2" data-narrate-all-queued={queued}>
+ queued {queued} —{" "}
+ <a href={jobsHref()} className="ink-link">
+ its state on Jobs
+ </a>
+ </span>
+ )}
+ </section>
{error && (
<p role="alert" className="m-0 text-reject-text lg:col-span-2" data-pronunciation-error="">
{error}