commit fb84d197731d04c97e0e7c57fbe9f2d0d8f5dcad
parent a71ec2f490c2318f398447aa5abeabefeb3ea88e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 17 Nov 2026 09:54:54 -0500
umtool routes: Read again, unpicked, one at a time, waiting for a render in words
- post-narration: op take takes reading "next" and keepPick; one read of a post at a time (a second press 409
busy); a running read says it waits for the render while render mode holds the machine (renderMode.mjs
renderWaitSentence); op screen-read takes for/reading/tuning/keepPick; op thread-read reads the whole thread read
again (posts screen read, else posts narrate --take --thread as it was asked), unpicked.
- narration: the view lists each card's readings; play takes again/reading/tuning/text (umtool narration --read as
the job); action pick (umtool narration --pick); audio takes &key= for another reading of the card.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
6 files changed, 159 insertions(+), 18 deletions(-)
diff --git a/umtool/app/api/report/narration/audio/route.ts b/umtool/app/api/report/narration/audio/route.ts
@@ -9,7 +9,9 @@ export const dynamic = "force-dynamic";
// GET ?project&card: the narration's kept voice for that card's CURRENT words
// and voice (out/narration/<key>.wav), or a 404 until it is synthesized. Names,
-// never paths: the file is found from the manifest's narration.
+// never paths: the file is found from the manifest's narration. `&key=<key>`:
+// another reading kept for that card (lane line-rerun) -- its record must name
+// the card.
export async function GET(request: Request) {
const url = new URL(request.url);
const r = await resolveReport(url.searchParams.get("project") ?? "");
@@ -18,8 +20,12 @@ export async function GET(request: Request) {
const n = narrationsOf(r.manifest).find((x: { id: string }) => x.id === card);
if (!n) return new Response("not a card with a narration", { status: 404 });
const dir = narrationDir(path.join(r.project.dir, "out"));
- if (!(await readNarrationRecord(dir, n.key))) return new Response("this narration has not been synthesized yet", { status: 404 });
- const abs = resolveInRoots(narrationWavPath(dir, n.key));
+ const asked = url.searchParams.get("key");
+ if (asked !== null && !/^[0-9a-f]{64}$/.test(asked)) return new Response("not a reading's key", { status: 400 });
+ const key = asked ?? n.key;
+ const rec = await readNarrationRecord(dir, key);
+ if (!rec || rec.id !== card) return new Response("this narration has not been synthesized yet", { status: 404 });
+ const abs = resolveInRoots(narrationWavPath(dir, key));
const st = abs ? await stat(abs).catch(() => null) : null;
if (!abs || !st?.isFile()) return new Response("this narration has not been synthesized yet", { status: 404 });
return rangeResponse(request, {
diff --git a/umtool/app/api/report/narration/play/route.ts b/umtool/app/api/report/narration/play/route.ts
@@ -1,5 +1,7 @@
import { jobView, runningJob, startJob } from "@/lib/jobs";
-import { narrateCardSteps } from "@/lib/report/driver.mjs";
+import path from "node:path";
+import { UMTOOL_DIR, narrateCardSteps } from "@/lib/report/driver.mjs";
+import { parseTtsTuning, ttsReadingError } from "yt-dlp-transcript-common/lib/ttsTuning.mjs";
import { resolveReport } from "@/lib/report/serve.mjs";
import { narrationsOf } from "umtool-report-to-video/narration";
@@ -10,8 +12,13 @@ export const dynamic = "force-dynamic";
// (GET /api/report/build?job=<id>), then plays from
// /api/report/narration/audio. A voice already kept is a quick no-op job.
// One job at a time, as every job here: a running build is a 409.
+// { project, card, again: true, reading?: N | "next", tuning?, text? } (lane line-rerun: Read again, Read edited
+// text, Tune): ONE READING kept for the card, the card not changed -- `umtool narration <p> <card> --read …` as the
+// job; Pick is the narration route's `pick`.
+const TUNING_FLAG_OF: Record<string, string> = { temperature: "--temperature", top_p: "--top-p", top_k: "--top-k", min_p: "--min-p", repeat_penalty: "--repeat-penalty", takes: "--chunk-takes" };
+
export async function POST(request: Request) {
- const body = (await request.json().catch(() => null)) as { project?: string; card?: string } | null;
+ const body = (await request.json().catch(() => null)) as { project?: string; card?: string; again?: boolean; reading?: number | "next"; tuning?: unknown; text?: string } | null;
const r = await resolveReport(String(body?.project ?? ""));
if ("error" in r) return Response.json({ error: r.error }, { status: r.status });
const card = String(body?.card ?? "");
@@ -21,6 +28,25 @@ export async function POST(request: Request) {
const running = runningJob();
if (running) return Response.json({ error: `a job is already running (${running.kind})` }, { status: 409 });
try {
+ if (body?.again) {
+ const flags: string[] = [];
+ if (body.reading !== undefined && body.reading !== null) {
+ if (body.reading !== "next" && ttsReadingError(body.reading)) return Response.json({ error: ttsReadingError(body.reading) }, { status: 400 });
+ flags.push("--reading", String(body.reading));
+ }
+ if (body.tuning !== undefined && body.tuning !== null) {
+ const t = parseTtsTuning(body.tuning);
+ if (!t.ok) return Response.json({ error: t.error }, { status: 400 });
+ for (const [k, v] of Object.entries(t.value)) flags.push(TUNING_FLAG_OF[k], String(v));
+ }
+ if (typeof body.text === "string" && body.text.trim()) flags.push("--text", body.text.trim());
+ const step = {
+ cwd: path.join(/* turbopackIgnore: true */ UMTOOL_DIR, ".."), env: {}, label: `${card}: a reading of its narration (asks the editor)`, timeoutMs: 15 * 60_000,
+ argv: [process.execPath, path.join(/* turbopackIgnore: true */ UMTOOL_DIR, "bin", "umtool.mjs"), "narration", r.project.id, card, "--read", ...flags],
+ };
+ const job = startJob(`narrate ${r.project.id} ${card}`, [step], { project: r.project.id });
+ return Response.json({ ok: true, job: jobView(job) }, { headers: { "cache-control": "no-store" } });
+ }
const job = startJob(`narrate ${r.project.id} ${card}`, narrateCardSteps(r.project, card), { project: r.project.id });
return Response.json({ ok: true, job: jobView(job) }, { headers: { "cache-control": "no-store" } });
} catch (e) {
diff --git a/umtool/app/api/report/narration/route.ts b/umtool/app/api/report/narration/route.ts
@@ -18,6 +18,7 @@ export const dynamic = "force-dynamic";
// reject { note } rejected; the note says what is wrong (required)
// clear {} no verdict (the note is kept)
// note { note } the note alone
+// pick { key } another reading kept for the card plays (umtool narration --pick)
// edit { text, token? } the card's narration words, through the manifest
// writer (snapshot, validators, the edit-notes
// guard); an edit clears the verdict
@@ -81,8 +82,20 @@ export async function POST(request: Request) {
invalidateProjects();
break;
}
+ case "pick": {
+ // ANOTHER READING the card plays (lane line-rerun): `umtool narration <p> <card> --pick <key>`, the CLI's own
+ // command -- its words, reading and tuning; a verdict on the same words kept.
+ const key = String(body.key ?? "");
+ if (!/^[0-9a-f]{64}$/.test(key)) return Response.json({ error: "key must be a kept reading's key" }, { status: 400 });
+ const { cardNarrationCommand } = await import("@/lib/report/cardNarrationCli.mjs");
+ const said: string[] = [];
+ const code = await cardNarrationCommand([r.project.id, card, "--pick", key, "--json"], { out: (x: string) => said.push(x), err: (x: string) => said.push(x) });
+ if (code !== 0) return Response.json({ error: (() => { try { return JSON.parse(said.join("\n")).error; } catch { return said.join(" "); } })() }, { status: 400 });
+ invalidateProjects();
+ break;
+ }
default:
- return Response.json({ error: "action must be approve, reject, clear, note or edit" }, { status: 400 });
+ return Response.json({ error: "action must be approve, reject, clear, note, edit or pick" }, { status: 400 });
}
} catch (e) {
if (e instanceof StaleToken) return Response.json({ error: e.message, stale: true }, { status: 409 });
diff --git a/umtool/app/api/report/post-narration/route.ts b/umtool/app/api/report/post-narration/route.ts
@@ -1,7 +1,7 @@
import { mkdir, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
import path from "node:path";
import {
- POST_DERIVE_OPS, POST_DERIVE_ROUTES, derivedFileOf, isNarrated, nextTakeNumber, pickedTake, postIdOf, postNarrationKnobs, takeFileOf, takeIdOf, takesDirOf,
+ POST_DERIVE_OPS, POST_DERIVE_ROUTES, derivedFileOf, isNarrated, nextReadingOf, nextTakeNumber, pickedTake, postIdOf, postNarrationKnobs, takeFileOf, takeIdOf, takesDirOf,
} from "umtool-report-to-video/post-narration";
import { postItemPlan } from "umtool-report-to-video/post-item";
import { jobState, resultLine, startJob } from "@/lib/research/case-editor";
@@ -27,6 +27,7 @@ import { readLayers, recordedTrimFor } from "@/lib/report/characterLayers.mjs";
import { convertAskOf, derivePitchOf, deriveRefusalOf, stepPitchOf } from "@/lib/report/derivePitch.mjs";
import { getJob, runningJob, startJob as startUmtoolJob, type Job } from "@/lib/jobs";
import { UMTOOL_DIR } from "@/lib/report/driver.mjs";
+import { renderWaitSentence } from "@/lib/report/renderMode.mjs";
export const dynamic = "force-dynamic";
@@ -50,6 +51,9 @@ const benchVoice = (red: { slurs?: { voice?: string } | null } | null) => (red?.
// takes) and `reading` (0 = the first; 1, 2, … another reading)
// are sent as asked -- the take records what the editor says it
// was made with (`tuning`, every value; `reading`)
+// `reading: "next"`: one past the highest reading of these words
+// (lane line-rerun, Read again); `keepPick`: the take joins the list
+// unpicked. One read of a post at a time: a second is a 409 `busy`.
// POST {project, op: "fit", id, linger?} the attachment's best part for the read (posts fit)
// GET ?project&id&convert=1 what a convert of this post defaults to: its author's character in
// the cast (else the narrator) and that character's convert
@@ -79,8 +83,15 @@ const benchVoice = (red: { slurs?: { voice?: string } | null } | null) => (red?.
// job running `umtool posts screen <p> <item> record <id> <n>
// --recording <upload>` -- recorded, cleaned, converted to the
// speaker's character, none picked; the upload removed when it ends
-// POST {project, op: "screen-read", id} MAKE THE READ with its screens: a umtool job running `umtool posts
-// screen <p> <item> read` (the screens' chosen line takes in it)
+// POST {project, op: "screen-read", id, for?, reading?, tuning?, keepPick?}
+// MAKE THE READ with its screens: a umtool job running `umtool posts
+// screen <p> <item> read` (the screens' chosen line takes in it);
+// `for` (screen:<id>:<n>) `reading` (N | "next") `tuning`: one line
+// read again (--for --reading --temperature …), `keepPick`: --no-pick
+// POST {project, op: "thread-read", id, reading?, tuning?}
+// THE THREAD READ AGAIN (lane line-rerun): `posts screen … read` with
+// screens, else `posts narrate <p> <item> --take --thread` asked as the
+// playing read was -- every synthesized piece's next reading, unpicked
// GET ?project&id&screenJob=<job> either job: its state, its result, and -- ended -- the entry as it is
const noStore = { "cache-control": "no-store" };
@@ -128,7 +139,8 @@ export async function GET(request: Request) {
if (id && q.get("screenJob") !== null) {
const j = getJob(String(q.get("screenJob")));
if (!j || !screenJobKinds(r.project.id, id).includes(j.kind)) return Response.json({ error: "no such job" }, { status: 404 });
- return Response.json(await screenJobView(r.project.dir, id, j), { headers: noStore });
+ const waiting = j.state === "running" ? renderWaitSentence() : null;
+ return Response.json({ ...(await screenJobView(r.project.dir, id, j)), ...(waiting ? { waiting } : {}) }, { headers: noStore });
}
if (id && !job && q.get("convert") !== null) {
// What a convert of this post defaults to (`posts narrate --recording`'s rule: the author's character, else the narrator).
@@ -152,7 +164,10 @@ export async function GET(request: Request) {
if (!rel.startsWith(`${takesDirOf(postIdOf(e))}/take-`) || rel.includes("..") || !rel.endsWith(".wav")) return Response.json({ error: "not a take of this post" }, { status: 400 });
try {
const st = await jobState(job);
- if (!st.done) return Response.json({ state: "running", status: st.status }, { headers: noStore });
+ // While render mode gives the machine to a render, the read waits for it -- and says so (lane line-rerun).
+ const waiting = !st.done ? renderWaitSentence() : null;
+ if (!st.done) return Response.json({ state: "running", status: st.status, ...(waiting ? { waiting } : {}) }, { headers: noStore });
+ await rm(pendingFileOf(r.project.dir, e), { force: true });
if (st.status !== "done") return Response.json({ state: "failed", status: st.status, error: st.tail.slice(-3).join(" / ") }, { headers: noStore });
const had = ((e.narration?.takes ?? []) as Array<{ file?: string }>).some((t) => t.file === rel);
if (!had) {
@@ -199,7 +214,7 @@ export async function GET(request: Request) {
const { slurs, lexicon } = spoken;
// What the POST asked (its speed and where it came from), kept beside the file until the take is made.
const askFile = `${abs}.ask.json`;
- const ask = (await readFile(askFile, "utf8").then(JSON.parse, () => null)) as { speed?: number; speedAsked?: true | "item" | "preset" } | null;
+ const ask = (await readFile(askFile, "utf8").then(JSON.parse, () => null)) as { speed?: number; speedAsked?: true | "item" | "preset"; keepPick?: boolean } | null;
await rm(askFile, { force: true });
const take = {
...(typeof ask?.speed === "number" ? { speed: ask.speed } : {}), ...(ask?.speedAsked !== undefined ? { speedAsked: ask.speedAsked } : {}),
@@ -215,7 +230,7 @@ export async function GET(request: Request) {
script, at: new Date().toISOString(), jobId: job, ...(Number.isFinite(meas.lufs) ? { lufs: meas.lufs } : {}), ...(note ? { note } : {}),
};
const { result } = await withEditNotes(r.project, async () =>
- updatePostNarration(r.project.dir, id, { addTake: take, ...(script !== e.narration?.script ? { script } : {}) }, { token: await manifestToken(r.project.dir) }),
+ updatePostNarration(r.project.dir, id, { addTake: take, ...(ask?.keepPick ? { keepPick: true } : {}), ...(script !== e.narration?.script ? { script } : {}) }, { token: await manifestToken(r.project.dir) }),
);
// The editor's `note` (a tuning or reading its engine ignored), handed on so the bench can say so.
return Response.json({ state: "done", file: rel, entry: result.entry, token: result.token, ...(typeof res.note === "string" && res.note ? { note: res.note } : {}) }, { headers: noStore });
@@ -287,13 +302,34 @@ async function postHere(request: Request) {
const id = String(body.id ?? "");
const token = body.token === undefined || body.token === null ? null : String(body.token);
try {
- if (body.op === "screen-read") {
- // MAKE THE READ with the screens (the bench's button): the CLI's own command as a umtool job.
+ if (body.op === "screen-read" || body.op === "thread-read") {
+ // MAKE THE READ with the screens (the bench's button), or a line of it / the whole read READ AGAIN (lane
+ // line-rerun: Read again, Tune): the CLI's own command as a umtool job -- one at a time (a second press: 409).
const e = postsOf(m).find((x) => x.id === id);
if (!e) return Response.json({ error: `no post item ${id}` }, { status: 404 });
const running = runningJob();
if (running) return Response.json({ error: `umtool is running another job (${running.kind}): make the read when it is done`, busy: true }, { status: 409 });
- const j = startUmtoolJob(screenJobKinds(r.project.id, id)[1], [{ label: `${id}: its read made with its screens`, argv: [process.execPath, cliPath(), "posts", "screen", r.project.id, id, "read", "--json"], cwd: path.join(/* turbopackIgnore: true */ UMTOOL_DIR, ".."), env: {}, timeoutMs: 45 * 60 * 1000 }], { project: r.project.id });
+ let again: string[];
+ try {
+ again = readAgainArgv(body);
+ } catch (err) {
+ return Response.json({ error: err instanceof Error ? err.message : String(err) }, { status: 400 });
+ }
+ const withScreens = Array.isArray(e.screens) && (e.screens as unknown[]).length > 0;
+ let argv: string[];
+ if (body.op === "screen-read" || withScreens) argv = ["posts", "screen", r.project.id, id, "read", ...again, "--json"];
+ else {
+ // No screens: the thread read asked as the playing one was (castProject.mjs threadArgvOf), every piece anew.
+ const t = pickedTake(e) as { read?: Record<string, unknown> } | null;
+ if (t?.read?.kind !== "thread") return Response.json({ error: `${id} plays no thread read to read again` }, { status: 400 });
+ const { threadArgvOf } = await import("@/lib/report/castProject.mjs");
+ // Its pieces' own readings (`--tuned`) give way to the new one: every piece is read anew.
+ const asked = (threadArgvOf as (r: unknown, o: { takes: unknown }) => string[])(t.read, { takes: e.narration?.takes ?? [] });
+ const kept = asked.filter((x, i) => x !== "--tuned" && asked[i - 1] !== "--tuned");
+ argv = ["posts", "narrate", r.project.id, id, "--take", "--thread", ...kept, ...again, "--json"];
+ }
+ const label = body.op === "thread-read" ? `${id}: its thread read again` : body.for ? `${id}: ${String(body.for)} read again` : `${id}: its read made with its screens`;
+ const j = startUmtoolJob(screenJobKinds(r.project.id, id)[1], [{ label, argv: [process.execPath, cliPath(), ...argv], cwd: path.join(/* turbopackIgnore: true */ UMTOOL_DIR, ".."), env: {}, timeoutMs: 45 * 60 * 1000 }], { project: r.project.id });
return Response.json({ ok: true, job: { id: j.id, state: j.state } }, { headers: noStore });
}
if (body.op === "undo") {
@@ -314,9 +350,16 @@ async function postHere(request: Request) {
// Its tuning and reading (another reading of the same words): refused here in the editor's words, sent as asked.
const tuned = body.tuning === undefined || body.tuning === null ? null : parseTtsTuning(body.tuning);
if (tuned && !tuned.ok) return Response.json({ error: tuned.error }, { status: 400 });
- const reading = body.reading === undefined || body.reading === null ? null : body.reading;
+ // `reading: "next"` (Read again): one past the highest reading of these words (post-narration.mjs nextReadingOf).
+ const reading = body.reading === undefined || body.reading === null ? null : body.reading === "next" ? nextReadingOf(e.narration?.takes, script) : body.reading;
const readingError = reading === null ? null : ttsReadingError(reading);
if (readingError) return Response.json({ error: readingError }, { status: 400 });
+ // ONE READ OF A POST AT A TIME: a second press while one is made is refused, never asked twice.
+ const pending = await readFile(pendingFileOf(r.project.dir, e), "utf8").then(JSON.parse, () => null) as { jobId?: string } | null;
+ if (pending?.jobId) {
+ const st = await jobState(pending.jobId).catch(() => null);
+ if (st && !st.done) return Response.json({ error: "a read of this post is being made: wait for it", busy: true }, { status: 409 });
+ }
// The voice: the one asked for, the item's own character, the project's characters and voice map, the CAST, the
// narrator's -- a single read's rule (readVoice.mjs).
const said = await itemReadVoice(r.project, e, {
@@ -341,9 +384,12 @@ async function postHere(request: Request) {
const spoken = spokenRead(script, e, red, { voice: benchVoice(red) }).text;
const out = path.join(r.project.dir, ...rel.split("/"));
// Its speed and where it came from, for the take the GET makes when the job is done (a sidecar, removed then).
- if (speed) await writeFile(`${out}.ask.json`, JSON.stringify({ speed, speedAsked: body.speed !== undefined && body.speed !== null ? true : (e.narration as { speed?: number } | undefined)?.speed != null ? "item" : "preset" }));
+ // A re-read (`keepPick`, the bench's Read again) joins the list unpicked: said here too.
+ const keepPick = body.keepPick === true;
+ if (speed || keepPick) await writeFile(`${out}.ask.json`, JSON.stringify({ ...(speed ? { speed, speedAsked: body.speed !== undefined && body.speed !== null ? true : (e.narration as { speed?: number } | undefined)?.speed != null ? "item" : "preset" } : {}), ...(keepPick ? { keepPick: true } : {}) }));
const tuning = tuned?.ok && Object.keys(tuned.value).length ? tuned.value : null;
const jobId = await startJob("/api/ops/tts", { text: spoken, engine, voice, out, ...(speed ? { speed } : {}), ...(tuning ? { tuning } : {}), ...(reading !== null ? { reading } : {}) });
+ await writeFile(pendingFileOf(r.project.dir, e), JSON.stringify({ jobId, file: rel, at: new Date().toISOString() }));
// Echoed only for the engine that takes them (Orpheus): Kokoro and eSpeak NG ignore them (the editor's result
// says so in its `note`, which the GET below hands on), so the answer never claims a tuning that is not used.
const tunes = engine === "orpheus";
@@ -511,6 +557,36 @@ async function record(request: Request) {
/** The umtool CLI (bin/umtool.mjs). */
const cliPath = () => path.join(/* turbopackIgnore: true */ UMTOOL_DIR, "bin", "umtool.mjs");
+
+/** The read of a post being made now (one at a time): `{ jobId, file, at }` beside its takes, removed when it ends. */
+const pendingFileOf = (dir: string, e: Entry) => path.join(dir, ...takesDirOf(postIdOf(e)).split("/"), ".reading.json");
+
+const TUNING_FLAG_OF: Record<string, string> = { temperature: "--temperature", top_p: "--top-p", top_k: "--top-k", min_p: "--min-p", repeat_penalty: "--repeat-penalty", takes: "--chunk-takes" };
+const ROLE_RE = /^(post|quoted|parent:\d|linked:\d{1,2}|screen:[a-z0-9][a-z0-9-]{0,23}:\d{1,2})$/;
+
+/** A Read again's words for the CLI (lane line-rerun): `--for`, `--reading`, the tuning flags, `--no-pick`. */
+function readAgainArgv(body: Record<string, unknown>): string[] {
+ const a: string[] = [];
+ if (body.for !== undefined && body.for !== null) {
+ if (typeof body.for !== "string" || !ROLE_RE.test(body.for)) throw new Error("for must name one piece of the read (screen:<id>:<line>, post, quoted, parent:<i>)");
+ a.push("--for", body.for);
+ }
+ if (body.reading !== undefined && body.reading !== null) {
+ if (body.reading !== "next") {
+ const err = ttsReadingError(body.reading);
+ if (err) throw new Error(err);
+ }
+ a.push("--reading", String(body.reading));
+ }
+ if (body.tuning !== undefined && body.tuning !== null) {
+ const t = parseTtsTuning(body.tuning);
+ if (!t.ok) throw new Error(t.error);
+ for (const [k, v] of Object.entries(t.value)) a.push(TUNING_FLAG_OF[k], String(v));
+ }
+ if (a.includes("--for") && !a.includes("--reading") && !Object.values(TUNING_FLAG_OF).some((f) => a.includes(f))) throw new Error("for goes with a reading or a tuning");
+ if (body.keepPick === true || body.op === "thread-read") a.push("--no-pick");
+ return a;
+}
/** The jobs of one post item's screens: a line recorded, its read made. */
const screenJobKinds = (project: string, id: string) => [`screen-line ${project} ${id}`, `screen-read ${project} ${id}`];
diff --git a/umtool/lib/report/narration-review.mjs b/umtool/lib/report/narration-review.mjs
@@ -13,6 +13,7 @@ import { stat } from "node:fs/promises";
import { estimatedNarratedCardSeconds, narrationWords } from "umtool-report-to-video/narration";
import { DRAFTS_REVIEW_FILE, readNarrationReview, reviewRows } from "umtool-report-to-video/narration-review";
import { narrationDir, narrationWavPath, readNarrationRecord } from "umtool-report-to-video/narration-store";
+import { cardReadings } from "./cardNarrationCli.mjs";
/**
* @param {string} projectDir
@@ -53,6 +54,12 @@ export async function narrationReviewView(projectDir, manifest) {
judgedText: r.row?.text ?? "",
judgedAt: r.row?.at ?? "",
kept: rec ? { seconds: rec.seconds, disclosure: rec.disclosure, mtimeMs: wav ? Math.round(wav.mtimeMs) : 0 } : null,
+ // Its reading and tuning now, and every reading kept for it (lane line-rerun: Read again, Pick).
+ key: r.key,
+ reading: Number.isInteger(e.narration?.reading) ? e.narration.reading : 0,
+ tuning: e.narration?.tuning ?? null,
+ madeWith: rec?.tuning ?? null,
+ readings: (await cardReadings(projectDir, r.id)).map((x) => ({ key: x.key, text: x.text, reading: Number.isInteger(x.reading) ? x.reading : 0, tuning: x.askedTuning ?? null, seconds: x.seconds, createdAt: x.createdAt ?? null })),
});
}
const counts = { approved: 0, rejected: 0, edited: 0, unreviewed: 0 };
diff --git a/umtool/lib/report/renderMode.mjs b/umtool/lib/report/renderMode.mjs
@@ -49,6 +49,19 @@ export function renderModeFile(env = process.env) {
* @param {{ url: string, token: string, fetch?: typeof fetch }} cfg
* @returns {import("yt-dlp-transcript-common/lib/renderPriority.mjs").RenderModeLanes | null}
*/
+/**
+ * WHILE RENDER MODE GIVES THE MACHINE TO A RENDER (lane line-rerun): the sentence a read pressed now says in place of
+ * "running" -- its synthesis waits at the heavy slot's door until the render ends -- or null when render mode is off.
+ */
+export function renderWaitSentence(env = process.env, { file = renderModeFile(env) } = {}) {
+ try {
+ const s = readRenderPriority(file);
+ return s.held && s.state ? `waiting for the render (${describeRenderPriority(s.state)}): render mode gives it the machine, and this read is made when it ends` : null;
+ } catch {
+ return null;
+ }
+}
+
export function editorLanes(cfg) {
if (!cfg?.token) return null;
const ask = async (route, body) => {