commit ec600e6bef4bf54f9cef49b217e14927bda290af
parent 77f2a12f95df366ff89ce06abbbe1049d9c09e2c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 01:35:38 -0500
umtool: a beeped take never waits on a held transcription lane
`posts narrate --take` on a post whose read says a slur the cut beeps word-
timed the take INLINE through the editor's transcription
(postNarrationCli.mjs makeTake → timeTakeWords). With the transcription lane
held -- as it must be while Orpheus runs -- the transcribe job waited for a
worker forever, and the take with it (rev 9: x05, killed by hand).
- Held lane (asked of the editor's autoQueue settings, renderMode.mjs
editorLanes): the take is kept as read (it says the slur; the build
refuses it until its words are timed) and the timing is deferred, with a
note naming `umtool posts narrate <p> <item> --words` to run after the
release; makeTake's result carries `deferred`.
- Not held: the timing is bounded (askEditorOp's new `deadlineMs`,
OpDeadline; BEEP_TIMING_DEADLINE_MS 5 min) and deferred the same way past
it -- never an unbounded wait. Any other failure keeps the old fallback
(read again with the slur left out).
Tests with stubs: a transcribe op that never settles is never asked under a
held lane; a deadline past is deferred; askEditorOp gives up on a job still
queued past its deadline (a local HTTP stub). docs/cli.md says so.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 104 insertions(+), 10 deletions(-)
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -101,7 +101,7 @@ Inbox cannot disagree about what is wrong with one.
| `posts progress <project> [auto\|on\|off\|default] [--json]` | the cut's **progress bar** default (`render.posts.progress`, `updatePostProgressRender`; [report-video.md](report-video.md#the-progress-bar)); bare, which items draw it |
| `timeline <project> threads [--json]` · `timeline <project> threads --write [--conversation <id>]` | **the cut's conversations** ([report-video.md](report-video.md#thread-reads), `post-conversation.mjs`): each tree of two post items or more — its root, its items' places, whether they play as one run (one scene) or are split by other entries, a reply placed before the post it answers, an item re-reading a post its run already read (with `posts set-item <p> <item> thread.parent.<i>=context`). `--write` gathers each (or the one holding `<id>`: its root, a post, an item, a `thread.group` name) at its first item's place in TREE order (a manual thread: in DATE order) — a post after what it answers, sibling branches by date, each depth first — in ONE write (one undo point); never across a section boundary (gathered within each section, and said) |
| `posts roles <project> [<item> …] [--write] [--set <n>=<role>,…] [--json]` | a narrated read **piece by piece** ([knobs.md](knobs.md#thread-reads-every-part-of-a-read-on-screen-while-it-is-said), [report-video.md](report-video.md#thread-reads)): the text each part of the picked take reads -- `parent:<i>`, `quoted`, `post`, `media:<i>` -- stored or inferred, what the card shows for each, and the build's guard (a part read off a post the card hides is refused). `--write` stores the inferred roles on the picked takes' parts (one write; the import stores them for every new take); `<item> --set n=role,…` sets parts' roles by hand (`off`: inferred again); a part out of range or an unknown role is refused (**exit 1**) |
-| `posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script "…"] [--pick <n>] [--approve\|--unapprove] [--off\|--on] [lead= tail= ramp= linger= clip=read\|full wet= lowpass= duck=on\|off short=hold\|loop attach=under\|after lufs= pace=fast\|normal]` · `<item> --take [--note "…"] [--voice v] [--engine e] [--speed s] [--script "…"]` · `<item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…` | a **narrated post item** ([report-video.md](report-video.md#narrated-post-items), [knobs.md](knobs.md#a-narrated-post-item)): `--import` reads `narration/posts/index.json` (`[{id, entry, script, takes: [{file, engine, voice, seconds}], pick}]`, and a take's `take-<n>.parts.json`) into the cut in ONE write, measuring each take (length, loudness); a re-run adds only takes not there. `--take` asks the EDITOR for a new take (`POST /api/ops/tts`, its `out` the next `narration/posts/<postId>/take-<n>.<engine>-<voice>.wav`; a job, waited for; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and picks it, its `--note` kept with it; `--pick <n>` is the take's number as `--list` shows it. `--derive <n>` makes a NEW take from take n through the editor's `voice-enhance` / `voice-convert` op (a stock synthetic voice; "not installed" until the editor has the engine), the original kept; `--delete <n>` moves a take's file to the post's `.trash/`. A new script or pick takes the approval away. `--all --draft-scripts` writes every post's words as its script, VERBATIM (cleaned only to be spoken: a reply's leading @handles, links, emoji dropped -- a handle typed inside the message is kept and said "at <handle>", the lexicon first; `plan(s)` → plans, `w/` → with, `&` → and; paragraphs kept). `--cut` sets `render.postNarration` (and its read-follow: `follow=on\|off`, `follow.dim=`, `follow.ease=`; its thread reads: `thread.parent=`, `thread.quoted=`, `thread.carry=`, `thread.reveal=`, `thread.shrink=`, `thread.dim=`, `thread.seconds=`, `thread.pan=`). Refused in the build's words (**exit 1**) |
+| `posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script "…"] [--pick <n>] [--approve\|--unapprove] [--off\|--on] [lead= tail= ramp= linger= clip=read\|full wet= lowpass= duck=on\|off short=hold\|loop attach=under\|after lufs= pace=fast\|normal]` · `<item> --take [--note "…"] [--voice v] [--engine e] [--speed s] [--script "…"]` · `<item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…` | a **narrated post item** ([report-video.md](report-video.md#narrated-post-items), [knobs.md](knobs.md#a-narrated-post-item)): `--import` reads `narration/posts/index.json` (`[{id, entry, script, takes: [{file, engine, voice, seconds}], pick}]`, and a take's `take-<n>.parts.json`) into the cut in ONE write, measuring each take (length, loudness); a re-run adds only takes not there. `--take` asks the EDITOR for a new take (`POST /api/ops/tts`, its `out` the next `narration/posts/<postId>/take-<n>.<engine>-<voice>.wav`; a job, waited for; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and picks it, its `--note` kept with it; `--pick <n>` is the take's number as `--list` shows it. `--derive <n>` makes a NEW take from take n through the editor's `voice-enhance` / `voice-convert` op (a stock synthetic voice; "not installed" until the editor has the engine), the original kept; `--delete <n>` moves a take's file to the post's `.trash/`. A new script or pick takes the approval away. `--all --draft-scripts` writes every post's words as its script, VERBATIM (cleaned only to be spoken: a reply's leading @handles, links, emoji dropped -- a handle typed inside the message is kept and said "at <handle>", the lexicon first; `plan(s)` → plans, `w/` → with, `&` → and; paragraphs kept). `--cut` sets `render.postNarration` (and its read-follow: `follow=on\|off`, `follow.dim=`, `follow.ease=`; its thread reads: `thread.parent=`, `thread.quoted=`, `thread.carry=`, `thread.reveal=`, `thread.shrink=`, `thread.dim=`, `thread.seconds=`, `thread.pan=`). Refused in the build's words (**exit 1**) A `--take` whose read says a slur the cut BEEPS is word-timed by the editor's transcription before it is kept -- never waited on: with the transcription lane held (as while Orpheus runs) the take is kept as read and the timing deferred (it says so, naming `posts narrate <p> <item> --words` to run after the release; the build refuses the take until then), and a timing still queued after 5 min is deferred the same way. An excerpted item (`posts set-item … excerpt=`) reads its spans. |
| `posts narrate <project> <item> --take --thread [--parents 0\|all\|none\|<n>] [--skip-parent <id\|parent:i>]… [--no-quoted] [--no-linked] [--read-seen] [--voice-for <handle>=<voice>]… [--voice v] [--engine e] [--note "…"] [--force] [--no-hold] [--dry-run] [--json]` | a **THREAD READ** as one command ([knobs.md](knobs.md#pronunciation-and-voices-the-lexicon-the-voice-map-a-thread-read), `lib/report/postThreadRead.mjs`): the post it answers (`--parents all`: every ancestor; `<n>`: parents 0..n; `none`), the post it quotes and the posts it links to, then his words, in DATE order, each in its author's voice (`--voice-for`, then the project's voice map, `posts voices`; his own: the narrator's), the redaction, the slur filter (a beep is skipped: a joined read is not word-timed) and the lexicon (`posts say`) applied. A parent or quoted post the item before already shows is not read again (`--read-seen`: it is). Each part is synthesized ONCE by the editor's tts op into `narration/parts-cache/<sha1(voice\|text)>.wav` (the transcription lane held meanwhile, only if it was not; `--no-hold`: left alone), joined (0.8 s between pieces, 0.6 between paragraphs, 0.25 inside one) into `take-<n>.<engine>-thread.wav` with `take-<n>.parts.json`, saved with its parts' roles, its lexicon and how it was asked (`read`) and PICKED — one write (one undo point). `--dry-run`: the pieces, voices and parts (cached or not), nothing asked. Already up to date (same words and voices): nothing done, **exit 0** (`--force`: again). A part not synthesized: **exit 1** (the parts made stay cached; run it again); `--json` prints `{ok: false, error}` too. A usage error: **exit 2** |
| `posts say <project> [ls] [--item <id>]` · `add <word\|phrase> "<spoken>" [--case] [--item <id>] [--note "…"]` · `remove <word\|n> [--item <id>]` · `try "<text>" [--item <id>]` · `stale` `[--json]` | **THE PRONUNCIATION LEXICON** ([knobs.md](knobs.md#pronunciation-and-voices-the-lexicon-the-voice-map-a-thread-read)): `narration/lexicon.json` in the project, a word or phrase said differently in EVERY synthesized read (a script's `--take`, each piece of a thread read, the bench's re-take); the scripts and cards keep their words. Whole words, without case unless `--case`, a phrase across any spaces, regex characters literal; `--item` for one item's reads (it wins over the project's). A masked slur and a redacted word are never replaced. `add` of a word already listed changes what is said. `try` prints what a voice would be asked to say. `stale` lists every picked read that still says an entry the old way, with the command that re-reads it. A bad entry or an unknown item: **exit 2** |
| `posts voices <project> [ls] \| set <handle\|*> <voice> \| remove <handle\|*> [--json]` | **THE VOICE MAP** (`narration/voices.json`): the stock voice a thread read gives each author (`*`: everyone it does not name; default `leo` on Orpheus); `ls` lists the map and every author the cut's items carry with the voice each would get. A bad handle or voice: **exit 2** |
diff --git a/umtool/lib/report/postNarrationCli.mjs b/umtool/lib/report/postNarrationCli.mjs
@@ -290,7 +290,26 @@ export function mixPatchOf(pairs, { cut = false } = {}) {
* the project, measured, appended (and picked) through the writer. Returns
* the take and the write's result.
*/
-export async function makeTake(project, e, { script = null, note = null, engine = null, voice = null, speed = null, render = {}, emit = () => {}, editor = null, ask = null, askOp = null, redaction = undefined } = {}) {
+/** The longest a take waits for its beep's word timing (the editor's transcription) before it defers it. */
+export const BEEP_TIMING_DEADLINE_MS = 5 * 60 * 1000;
+
+/**
+ * Is the editor's transcription lane HELD (render mode, a TTS session)? Its
+ * transcribe job would wait for a worker until it is released. Unknown (no
+ * token, the editor not answering): false -- the timing's own deadline bounds it.
+ */
+export async function transcriptionLaneHeld() {
+ try {
+ const { editorLanes } = await import("./renderMode.mjs");
+ const { editorConfig } = await import("./fetchWindows.mjs");
+ const lanes = editorLanes(editorConfig());
+ return lanes ? await lanes.isHeld("transcription") : false;
+ } catch {
+ return false;
+ }
+}
+
+export async function makeTake(project, e, { script = null, note = null, engine = null, voice = null, speed = null, render = {}, emit = () => {}, editor = null, ask = null, askOp = null, redaction = undefined, laneHeld = null, timingDeadlineMs = BEEP_TIMING_DEADLINE_MS } = {}) {
const k = postNarrationKnobs(e, render);
const words = String(script ?? e.narration?.script ?? "").trim();
if (!words) throw new NarrateError(`${e.id} has no script to read (--script "…", or --all --draft-scripts)`);
@@ -317,13 +336,32 @@ export async function makeTake(project, e, { script = null, note = null, engine
// done, the read is synthesized again with the slur left out -- a published take never says one it cannot cover.
let slurs = said.slurs;
let timed = null;
+ let deferred = null;
if (slurs === "said" && red?.slurs?.on && red.slurs.voice === "beep") {
+ // NEVER BLOCK ON THE LANE (rev 9, 6 Nov): with the transcription lane held -- as it is while Orpheus runs --
+ // the editor's transcribe job would wait for a worker until it is released, and this take with it. The take is
+ // kept as read (it says the slur; the build refuses to play it until its words are timed) and the timing is
+ // left for after the release: `posts narrate <p> <item> --words`.
+ // (A caller that hands in its own transcribe op -- a test's stub -- is asked about no lane unless it says.)
+ const held = laneHeld ?? (askOp ? async () => false : transcriptionLaneHeld);
+ if (await held()) {
+ deferred = { words: `umtool posts narrate ${project.id} ${e.id} --words` };
+ emit("note", { message: `${e.id}: its read says a slur the cut beeps, and the editor's transcription lane is held -- its words are NOT timed now (that would wait for the release). After releasing the lane run: ${deferred.words} (the build refuses this take until then)` });
+ }
+ }
+ if (!deferred && slurs === "said" && red?.slurs?.on && red.slurs.voice === "beep") {
try {
- timed = await timeTakeWords(project, rel, words, { askOp, emit });
+ timed = await timeTakeWords(project, rel, words, { askOp, emit, deadlineMs: timingDeadlineMs });
} catch (err) {
- emit("note", { message: `${e.id}: its read could not be word-timed for the beep (${err instanceof Error ? err.message : err}) -- synthesized again with the slur left out` });
- ({ jobId, result } = await askTts(ttsBody(spokenRead(words, e, red, { voice: "skip" }).text), { ...(editor ? { editor } : {}), emit }));
- slurs = "skip";
+ if (err?.name === "OpDeadline") {
+ // Waited its bound: kept as read, timed later -- never an unbounded wait.
+ deferred = { words: `umtool posts narrate ${project.id} ${e.id} --words` };
+ emit("note", { message: `${e.id}: ${err.message} -- the take is kept as read; time its words later: ${deferred.words} (the build refuses this take until then)` });
+ } else {
+ emit("note", { message: `${e.id}: its read could not be word-timed for the beep (${err instanceof Error ? err.message : err}) -- synthesized again with the slur left out` });
+ ({ jobId, result } = await askTts(ttsBody(spokenRead(words, e, red, { voice: "skip" }).text), { ...(editor ? { editor } : {}), emit }));
+ slurs = "skip";
+ }
}
}
const m = await measureTake(out);
@@ -339,7 +377,7 @@ export async function makeTake(project, e, { script = null, note = null, engine
};
const patch = { addTake: take, ...(script !== null && script !== e.narration?.script ? { script: words } : {}) };
const { result: wrote, editNotes } = await withEditNotes(project, async () => updatePostNarration(project.dir, e.id, patch, { token: await manifestToken(project.dir) }));
- return { take, result: wrote, editNotes };
+ return { take, result: wrote, editNotes, ...(deferred ? { deferred } : {}) };
}
/**
@@ -348,14 +386,14 @@ export async function makeTake(project, e, { script = null, note = null, engine
* scriptWordTimes) -- `posts narrate --words`' way, before the take is kept.
* Throws when the editor cannot, or hears no words.
*/
-async function timeTakeWords(project, rel, script, { askOp = null, emit = () => {} } = {}) {
+async function timeTakeWords(project, rel, script, { askOp = null, emit = () => {}, deadlineMs = null } = {}) {
const { recognizedOf, wordsFileOf } = await import("./postFxCli.mjs");
const { scriptWordTimes } = await import("umtool-report-to-video/word-zoom");
const ask = askOp ?? (await import("umtool-report-to-video/narrate-via-editor")).askEditorOp;
const abs = path.join(project.dir, ...rel.split("/"));
const outFile = path.join(project.dir, ...wordsFileOf(rel).split("/"));
emit("note", { message: `timing ${rel}'s words for the beep (the editor's transcription)…` });
- await ask("/api/ops/transcribe", { path: abs, words: true, out: outFile }, { emit });
+ await ask("/api/ops/transcribe", { path: abs, words: true, out: outFile }, { emit, ...(deadlineMs !== null ? { deadlineMs } : {}) });
const heard = recognizedOf(JSON.parse(await readFile(outFile, "utf8")), 0);
if (!heard.length) throw new Error("the transcription came back with no word timings");
return scriptWordTimes(script, heard).words;
diff --git a/umtool/lib/report/postSlurs.test.mjs b/umtool/lib/report/postSlurs.test.mjs
@@ -199,6 +199,50 @@ test("a beep take: said, then word-timed so the render can beep it; when it cann
assert.match(notes.join("\n"), /could not be word-timed for the beep \(no parakeet worker\)/);
});
+test("a beep take with the transcription lane HELD: never waits on it -- kept as read, the timing deferred to `posts narrate --words`; a timing past its deadline likewise", async () => {
+ const script = `Hello, you ${F}. Welcome.`;
+ const p = await project("held", [item("1", { narration: { script } })], { posts: { slurs: { voice: "beep" } } });
+ const asked = [];
+ const notes = [];
+ let transcribed = 0;
+ // A transcribe op that would wait forever while the lane is held (a promise that never settles): never asked.
+ const askOp = async () => { transcribed += 1; return new Promise(() => {}); };
+ const r = await makeTake(p, (await manifest(p)).timeline[0], { ask: asker(asked), askOp, laneHeld: async () => true, emit: (_e, f) => notes.push(f.message) });
+ assert.equal(transcribed, 0, "the held lane is never waited on");
+ assert.equal(asked.length, 1, "one read, the slur said (for the beep)");
+ assert.equal(r.take.slurs, "said");
+ assert.equal(r.take.words, undefined);
+ assert.deepEqual(r.deferred, { words: "umtool posts narrate held p-1 --words" });
+ assert.match(notes.join("\n"), /transcription lane is held -- its words are NOT timed now .* umtool posts narrate held p-1 --words/);
+ assert.equal((await manifest(p)).timeline[0].narration.takes.length, 1, "the take is kept");
+ // Not held, but the transcription takes longer than its bound: the same deferral, never an unbounded wait.
+ const q = await project("slow", [item("1", { narration: { script } })], { posts: { slurs: { voice: "beep" } } });
+ const notes2 = [];
+ const { OpDeadline } = await import("umtool-report-to-video/narrate-via-editor");
+ const slowOp = async (route, _body, o) => { assert.equal(o.deadlineMs, 50); throw new OpDeadline(route, "t-9", 50); };
+ const r2 = await makeTake(q, (await manifest(q)).timeline[0], { ask: asker([]), askOp: slowOp, laneHeld: async () => false, timingDeadlineMs: 50, emit: (_e, f) => notes2.push(f.message) });
+ assert.equal(r2.take.slurs, "said");
+ assert.deepEqual(r2.deferred, { words: "umtool posts narrate slow p-1 --words" });
+ assert.match(notes2.join("\n"), /did not finish within 0 s .* time its words later/);
+});
+
+test("askEditorOp's deadline: a job still queued past it is given up on (OpDeadline), never polled forever", async () => {
+ const { askEditorOp, OpDeadline } = await import("umtool-report-to-video/narrate-via-editor");
+ const http = await import("node:http");
+ const srv = http.createServer((req, res) => {
+ res.setHeader("content-type", "application/json");
+ if (req.method === "POST") return res.end(JSON.stringify({ ok: true, jobId: "j-1" }));
+ res.end(JSON.stringify({ ok: true, job: { status: "queued", queue: { position: 1, queued: 1 } } }));
+ });
+ await new Promise((ok) => srv.listen(0, "127.0.0.1", ok));
+ const url = `http://127.0.0.1:${srv.address().port}`;
+ try {
+ await assert.rejects(askEditorOp("/api/ops/transcribe", { path: "/x.wav" }, { editor: { url, token: "t" }, pollMs: 10, deadlineMs: 60 }), (e) => e instanceof OpDeadline && /did not finish/.test(e.message));
+ } finally {
+ srv.close();
+ }
+});
+
test("umtool take … --uncensored: the slur filter off in the take's patch, its label and take.json say so", async () => {
const p = await project("u", [item("1", { text: `you ${F}` })]);
await mkdir(path.join(p.dir, "out", "clips-raw"), { recursive: true });
diff --git a/umtool/report-to-video/narrate-via-editor.mjs b/umtool/report-to-video/narrate-via-editor.mjs
@@ -266,7 +266,17 @@ export function opResultIn(lines) {
* line, null when the op writes none and `out` is given). An op the editor
* has no engine for throws OpNotInstalled.
*/
-export async function askEditorOp(route, body, { editor = editorFromEnv(), emit = () => {}, pollMs = POLL_MS, onJob = () => {} } = {}) {
+/** An op that did not finish by its deadline (`askEditorOp`'s `deadlineMs`): its job may still be in the editor's queue. */
+export class OpDeadline extends Error {
+ constructor(route, jobId, ms) {
+ super(`the editor's ${route} job ${jobId} did not finish within ${Math.round(ms / 1000)} s (it may still be queued there)`);
+ this.name = "OpDeadline";
+ this.jobId = jobId;
+ }
+}
+
+export async function askEditorOp(route, body, { editor = editorFromEnv(), emit = () => {}, pollMs = POLL_MS, onJob = () => {}, deadlineMs = null } = {}) {
+ const started = Date.now();
const headers = { authorization: `Bearer ${editor.token}`, "content-type": "application/json" };
const reach = async (url, init) => {
try {
@@ -309,6 +319,8 @@ export async function askEditorOp(route, body, { editor = editorFromEnv(), emit
place = line;
}
if (status === "queued" || status === "running") {
+ // A caller that must not wait unbounded (a beep's word timing behind a held lane) gives up here.
+ if (deadlineMs !== null && Date.now() - started >= deadlineMs) throw new OpDeadline(route, jobId, deadlineMs);
await sleep(pollMs);
continue;
}