Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit fdd53ccba2000e0507c42d8a108375150c2b1613
parent 70d4cf09619f79c61c09eeb44b770772dec6de1c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 17 Nov 2026 09:41:11 -0500

umtool: a screen line said as (saidAs) -- what the voice says for a read line, never what the card draws

- post-screens.mjs: screens[j].saidAs {"<n>": words}, saidAsOf, screenLineSpoken; screenLineSaid stays the shown
  words (the line's identity); withoutLines renumbers it; validateScreens refuses a missing or redacted line, no
  words, or a shape the card would mask; screenPieces carries `spoken`.
- post-thread.mjs chronoPieces/readTexts carry it; postThreadRead.mjs says it (the part's text) and keeps the
  shown line as `line`; screenLineRecord.mjs prompts it; post-item.mjs refuses a said-as that says what a
  line masks or a redacted line holds.
- posts screen <p> <item> set <id> said.<n>="…"|off; list shows it.
- Pins: shown, screenLineSaid, screenLineChanged, the drawn rows and the reading pin identical with a said-as.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/lib/report/postScreensCli.mjs | 13++++++++++++-
Mumtool/lib/report/postThreadRead.mjs | 4+++-
Mumtool/lib/report/screenLineRecord.mjs | 8+++++---
Aumtool/lib/report/screenSaidAs.test.mjs | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/post-item.mjs | 7++++++-
Aumtool/report-to-video/post-reading-pin.fixtures.mjs | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/post-reading-pin.test.mjs | 109++++---------------------------------------------------------------------------
Mumtool/report-to-video/post-screens.mjs | 54+++++++++++++++++++++++++++++++++++++++++++++++-------
Mumtool/report-to-video/post-thread.mjs | 6+++---
9 files changed, 270 insertions(+), 120 deletions(-)

diff --git a/umtool/lib/report/postScreensCli.mjs b/umtool/lib/report/postScreensCli.mjs @@ -55,6 +55,7 @@ export const SCREEN_USAGE = [ " set keys: kind= title=|off media= at=<a>,<b>|off unread= ref=|off read=all|none|<n>,… read.<n>=\"excerpt\"|on|off", " line.add=\"who: words\" line.<n>=off line.<n>.who=|off line.<n>.side=left|right|auto line.<n>.text=", " line.<n>.time=|off line.<n>.redact=on|off take.<n>=<take n>|off (the recording read in line n's place)", + " said.<n>=\"…\"|off (what the voice SAYS for line n -- an acronym spelled out, a typo said right; never drawn)", " check: the transcription read against the screenshot (by you, now); --undo takes it back. A screen not checked is a", " lint WARNING. An e-mail address, a phone number, an order or reference number in a line is masked whatever you do.", " read: the thread read with the screens (posts narrate <p> <item> --take --thread): his words from the take that plays", @@ -196,6 +197,15 @@ export function applyPairs(screen, pairs, { takeId = null } = {}) { } if (Object.keys(lt).length) sc.lineTakes = lt; else delete sc.lineTakes; + } else if ((m = /^said\.(\d{1,2})$/.exec(key))) { + // What line n is SAID AS (saidAs; never drawn -- the card shows the line as written); off: its own words. + const n = Number(m[1]); + lineAt(n); + const sa = isObj(sc.saidAs) ? { ...sc.saidAs } : {}; + if (off) delete sa[String(n)]; + else sa[String(n)] = v; + if (Object.keys(sa).length) sc.saidAs = sa; + else delete sc.saidAs; } else fail(`${key} is not a screen's knob (posts screen --help)`); } // Lines removed: the read's line numbers follow them (a dropped line's read goes too) -- the bench's rule too. @@ -220,7 +230,8 @@ export function screenListing(e, sc) { const ex = r && (r.cutBefore || r.cutAfter) ? ` [reads: "${str(l.text).slice(r.start, r.end)}"]` : ""; const recs = recordings.find((L) => L.screen === sc.id && L.n === n); const rec = recs ? ` [recorded: ${recs.takes.map((x) => `take ${x.n}${x.chosen ? " (chosen)" : ""}${x.current ? "" : " (line changed since)"}`).join(", ")}]` : ""; - return ` ${mark} ${String(n).padStart(2)} ${(l?.side ? `[${l.side}] ` : "") + (l?.who ? `${l.who}: ` : "- ")}${l?.redact ? "(redacted)" : str(l?.text)}${l?.time ? ` | ${l.time}` : ""}${ex}${rec}`; + const as = isObj(sc.saidAs) && typeof sc.saidAs[String(n)] === "string" ? ` [said as: "${sc.saidAs[String(n)]}"]` : ""; + return ` ${mark} ${String(n).padStart(2)} ${(l?.side ? `[${l.side}] ` : "") + (l?.who ? `${l.who}: ` : "- ")}${l?.redact ? "(redacted)" : str(l?.text)}${l?.time ? ` | ${l.time}` : ""}${ex}${as}${rec}`; }); return [head, ...rows]; } diff --git a/umtool/lib/report/postThreadRead.mjs b/umtool/lib/report/postThreadRead.mjs @@ -231,8 +231,10 @@ export function threadReadPlan(manifest, e, { red = null, map = {}, cast = {}, i } const sw = screenWho(p.who, e, names); const handle = sw.self ? str(e.handle) : sw.handle; + // `written`: the line as SHOWN (its identity: a take is this line's while it said these); what is SAID is its + // "said as" (post-screens.mjs saidAs) when it has one. const written = draftScript(p.text).script; - const said = spokenRead(written, e, red, { voice: slurVoice }); + const said = spokenRead(p.spoken ? draftScript(p.spoken).script : written, e, red, { voice: slurVoice }); if (!norm(said.text)) { skipped.push({ role: p.role, why: "nothing left to say (all of it redacted)" }); continue; diff --git a/umtool/lib/report/screenLineRecord.mjs b/umtool/lib/report/screenLineRecord.mjs @@ -26,7 +26,7 @@ import { characterOf, projectCharactersOf } from "umtool-report-to-video/cast"; import { draftScript, isNarrated, pickedTake, postIdOf, takesDirOf } from "umtool-report-to-video/post-narration"; import { spokenRead, termsFor } from "umtool-report-to-video/post-redact"; import { handleKey } from "umtool-report-to-video/post-say"; -import { parseScreenRole, screenLineSaid, screenOf, screenReadLines, screenWho, shapeSpans } from "umtool-report-to-video/post-screens"; +import { parseScreenRole, screenLineSaid, screenLineSpoken, screenOf, screenReadLines, screenWho, shapeSpans } from "umtool-report-to-video/post-screens"; import { readManifest } from "../projects/report.mjs"; const str = (v) => (typeof v === "string" ? v : ""); @@ -58,10 +58,12 @@ export function lineToRecord(e, role, { red = null, names = {} } = {}) { if (l.redact === true) throw new LineRecordError(`line ${p.n} of screen ${p.id} is redacted: it is never read`); if (!screenReadLines(sc).some((r) => r.n === p.n)) throw new LineRecordError(`line ${p.n} of screen ${p.id} is not read by the screen: tick it first (umtool posts screen <p> ${e.id} set ${p.id} read.${p.n}=on)`); const written = draftScript(screenLineSaid(sc, p.n)).script; + // What is SAID: its "said as" (post-screens.mjs saidAs) when it has one -- the prompt you read is what the voice says. + const say = draftScript(screenLineSpoken(sc, p.n)).script || written; // A beep needs the slur's time in the read; a joined read is not word-timed as it is made (postThreadRead.mjs): skipped. const voice = red?.slurs?.voice === "beep" ? "skip" : undefined; - const script = str(spokenRead(written, e, red, { voice }).text).replace(/\s+/g, " ").trim(); - const prompt = str(spokenRead(written, e, red ? { ...red, say: [] } : red, { voice }).text).replace(/\s+/g, " ").trim(); + const script = str(spokenRead(say, e, red, { voice }).text).replace(/\s+/g, " ").trim(); + const prompt = str(spokenRead(say, e, red ? { ...red, say: [] } : red, { voice }).text).replace(/\s+/g, " ").trim(); if (!script) throw new LineRecordError(`line ${p.n} of screen ${p.id} has nothing left to say (all of it masked or redacted)`); const sw = screenWho(l.who, e, names); return { role, screen: p.id, n: p.n, written, script, prompt, speaker: str(l.who), handle: sw.self ? str(e.handle).replace(/^@/, "") || null : sw.handle, self: sw.self }; diff --git a/umtool/lib/report/screenSaidAs.test.mjs b/umtool/lib/report/screenSaidAs.test.mjs @@ -0,0 +1,85 @@ +// A SCREEN LINE's "SAID AS" (lane line-rerun; operator ruling 3, 15 Nov 2026: every edit is for READING only): what the +// voice says for a read line (`screens[j].saidAs`), never what the card draws, never the line's identity. +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { saidAsOf, screenLineSaid, screenLineSpoken, screenReadLines, screenRows, validateScreens, withoutLines } from "umtool-report-to-video/post-screens"; +import { screenLineChanged } from "umtool-report-to-video/post-thread"; +import { validatePostItem } from "umtool-report-to-video/post-item"; +import { draftScript } from "umtool-report-to-video/post-narration"; +import { applyPairs } from "./postScreensCli.mjs"; +import { threadReadPlan } from "./postThreadRead.mjs"; +import { lineToRecord } from "./screenLineRecord.mjs"; +import { FIXTURES, PINNED_SHAS, drawn } from "../../report-to-video/post-reading-pin.fixtures.mjs"; + +const NO_RED = { terms: [], markup: {}, slurs: null }; +const DM = { + id: "s1", media: 0, kind: "dm", read: "all", lines: [ + { who: "rivertalk", text: "Did the BRT plan pass?" }, + { who: "bridgefan", text: "Ask the clerk, rm 4." }, + { who: "rivertalk", text: "Thanks." }, + ], +}; +const IMG = { src: "posts-media/bridge-x/7003/7003_1.png", kind: "image", width: 900, height: 1400 }; +const item = (sc) => ({ type: "post", id: "p-1", post: "bridge-x/1", platform: "x", handle: "bridgefan", author: "Bridge Fan", date: "2026-10-02T10:00:00.000Z", text: "Here it is.", media: [IMG], screens: [sc] }); + +test("saidAs: what the voice says, never what is shown -- shown, screenLineSaid, the drawn rows and the read runs identical with and without it", () => { + const as = { ...DM, saidAs: { 0: "Did the B R T plan pass?", 1: "Ask the clerk, room four." } }; + assert.equal(saidAsOf(as, 0), "Did the B R T plan pass?"); + assert.equal(saidAsOf(as, 2), null); + for (const n of [0, 1, 2]) assert.equal(screenLineSaid(as, n), screenLineSaid(DM, n)); + assert.equal(screenLineSpoken(as, 0), "Did the B R T plan pass?"); + assert.equal(screenLineSpoken(as, 2), screenLineSaid(DM, 2)); + assert.deepEqual(screenRows(as), screenRows(DM)); + assert.deepEqual(screenReadLines(as), screenReadLines(DM)); +}); + +test("saidAs: a take of the line as shown is still the line's when only its said-as changes (screenLineChanged reads the shown words)", () => { + const parts = [0, 1, 2].map((n) => ({ n: n + 1, para: (n + 1) * 100, text: screenLineSaid(DM, n), role: `screen:s1:${n}`, line: draftScript(screenLineSaid(DM, n)).script, speaker: DM.lines[n].who, start: n * 2, seconds: 1.5 })); + const narrated = (sc) => ({ ...item(sc), narration: { script: "Here it is.", pick: 0, takes: [{ file: "narration/posts/1/take-1.orpheus-thread.wav", seconds: 6, script: "x", parts, read: { kind: "thread" } }] } }); + const before = narrated(DM); + const after = narrated({ ...DM, saidAs: { 0: "Did the B R T plan pass?" } }); + for (const n of [0, 1, 2]) assert.equal(screenLineChanged(after, `screen:s1:${n}`), screenLineChanged(before, `screen:s1:${n}`)); + assert.equal(screenLineChanged(after, "screen:s1:0"), false); +}); + +test("saidAs: refused for a line it does not have, a redacted line, no words, or a shape the card would mask; a line removed takes its said-as with it", () => { + const bad = (saidAs) => validateScreens(item({ ...DM, saidAs })); + assert.deepEqual(bad({ 0: "Did the B R T plan pass?" }), []); + assert.ok(bad({ 7: "x" }).some((m) => /has no line 7/.test(m))); + assert.ok(validateScreens(item({ ...DM, lines: [...DM.lines.slice(0, 2), { text: "secret", redact: true }], saidAs: { 2: "secret" } })).some((m) => /redacted/.test(m))); + assert.ok(bad({ 0: " " }).some((m) => /must be words/.test(m))); + assert.ok(bad({ 1: "write to clerk@example.org" }).some((m) => /an e-mail address the card would mask/.test(m))); + assert.ok(bad({ 1: "call 5551234567" }).some((m) => /a number the card would mask/.test(m))); + assert.deepEqual(withoutLines({ ...DM, saidAs: { 0: "a", 2: "c" } }, [1]).saidAs, { 0: "a", 1: "c" }); + assert.equal("saidAs" in withoutLines({ ...DM, saidAs: { 1: "b" } }, [1]), false); +}); + +test("saidAs: a said-as that says what another line masks is refused by the item's validator", () => { + const sc = { ...DM, lines: [...DM.lines, { who: "rivertalk", text: "my number is 555 123 4567" }] }; + const hit = validatePostItem({ ...item(sc), screens: [{ ...sc, saidAs: { 0: "it is 5551234567 then" } }] }); + assert.ok(hit.some((m) => /a number/.test(m)), hit.join("\n")); +}); + +test("said.<n>= (posts screen set): sets and clears a line's said-as", () => { + const sc = applyPairs(DM, ['said.0="Did the B R T plan pass?"']); + assert.deepEqual(sc.saidAs, { 0: "Did the B R T plan pass?" }); + assert.equal("saidAs" in applyPairs(sc, ["said.0=off"]), false); + assert.throws(() => applyPairs(DM, ["said.9=x"]), /line 9/); +}); + +test("saidAs: the thread read SAYS it (a part's text) and keeps the line as shown (`line`, the identity); the record prompt says it too", () => { + const e = { ...item({ ...DM, saidAs: { 0: "Did the B R T plan pass?" } }), narration: { script: "Here it is." } }; + const plan = threadReadPlan({ timeline: [e], render: {} }, e, { red: NO_RED, map: {}, cast: {}, item: null, names: {} }); + const p0 = plan.pieces.find((p) => p.role === "screen:s1:0"); + assert.match(p0.text, /B R T/); + assert.doesNotMatch(p0.line, /B R T/); + const r = lineToRecord(e, "screen:s1:0", { red: NO_RED, names: {} }); + assert.match(r.prompt, /B R T/); + assert.doesNotMatch(r.written, /B R T/); +}); + +test("THE READING PIN with a said-as: a thread item's card draws as before", () => { + const e = structuredClone(FIXTURES.thread); + e.screens[0].saidAs = { 0: "Are the tolls going up again, yes or no?" }; + assert.deepEqual(drawn(e), PINNED_SHAS.thread); +}); diff --git a/umtool/report-to-video/post-item.mjs b/umtool/report-to-video/post-item.mjs @@ -36,7 +36,7 @@ import { BAR_CSS, barsHtml, hasMarks, projectRedactOf, redactEntry, redactSceneR import { blurErrors, blurOn, censorEntry } from "./post-censor.mjs"; import { WORD_ZOOM_HIGHLIGHT_ALPHA, cardTokens, cardWordsOf, findMatch, targetTextOf, validatePostFx } from "./word-zoom.mjs"; import { FOLLOW_MIN_SIZE, followBlocks, followKnobs, followSchedule, scopeBlocks, validatePostFollow } from "./read-follow.mjs"; -import { panelSchedule, pictureBeats, threadLayout, validatePostThread } from "./post-thread.mjs"; +import { panelSchedule, pictureBeats, spokenSaysHiddenErrors, threadLayout, validatePostThread } from "./post-thread.mjs"; import { isPictureOnly, pictureBeatSeconds, pictureHasSound, pictureMediaOf, pictureRuleEntry, validatePictureOnly, validatePictureReplyRender } from "./post-picture.mjs"; import { joinLayerHtml, validatePostJoin, validatePostJoinRender } from "./post-join.mjs"; import { validatePostLinkVisit, validatePostLinkVisitRender, visitsEnd } from "./post-link-visit.mjs"; @@ -809,6 +809,11 @@ export function validatePostItem(e) { errors.push(...validatePictureOnly(e)); // Its screens (post-screens.mjs): the text screenshots it carries, transcribed, and what of them is read. errors.push(...validateScreens(e)); + // A line's "said as" (saidAs) that says what another line masks or a redacted line holds: refused when written. + for (const sc of Array.isArray(e?.screens) ? e.screens : []) { + if (!isObj(sc?.saidAs)) continue; + for (const [k, v] of Object.entries(sc.saidAs)) if (typeof v === "string") errors.push(...spokenSaysHiddenErrors(e, v, `line ${k} of screen ${sc.id}'s "said as"`)); + } return errors; } diff --git a/umtool/report-to-video/post-reading-pin.fixtures.mjs b/umtool/report-to-video/post-reading-pin.fixtures.mjs @@ -0,0 +1,104 @@ +// The reading pin's fixtures and what it hashes (post-reading-pin.test.mjs; lane/line-rerun): imported by the +// tests that hold an edit to a read to the card main drew (lib/report/screenSaidAs.test.mjs too). +import { createHash } from "node:crypto"; +import { postCardHtml, postItemPlan } from "./post-item.mjs"; +import { drawnScreens, threadLayout } from "./post-thread.mjs"; +import { followBlocks } from "./read-follow.mjs"; +import { screenLineSaid } from "./post-screens.mjs"; +import { draftScript } from "./post-narration.mjs"; + +const sha = (v) => createHash("sha1").update(typeof v === "string" ? v : JSON.stringify(v)).digest("hex"); + +const POST = "The council met on Tuesday about the new bridge.\n\nNobody from the ministry came to explain the delay."; +const QUOTED = { id: "7002", handle: "harbourwatch", author: "Harbour Watch", text: "Bridge works paused again, the notice says.", date: "2026-10-01T09:00:00.000Z" }; +const PARENT = { + id: "7001", handle: "rivertalk", author: "River Talk", date: "2026-10-01T08:00:00.000Z", + text: "Does anyone know why the tolls on the old crossing keep rising?\n\nA second paragraph nobody reads aloud in this cut.", +}; +const IMG = { src: "posts-media/bridge-x/7003/7003_1.png", kind: "image", width: 900, height: 1400 }; +const DM = { + id: "s1", media: 0, kind: "dm", read: "all", lines: [ + { who: "rivertalk", text: "Are the tolls going up again?" }, + { who: "bridgefan", text: "Not this year, they said." }, + ], +}; +const base = (o = {}) => ({ + type: "post", id: "p-7003", post: "bridge-x/7003", platform: "x", author: "Bridge Fan", handle: "bridgefan", date: "2026-10-02T10:00:00.000Z", + text: POST, subjects: ["bridgefan"], ...o, +}); +const drafted = draftScript(POST).script; + +/** A single read of his words: one file, its script his words as drafted. */ +export function singleItem(o = {}) { + return base({ + quoted: QUOTED, ...o, + narration: { script: drafted, pick: 0, takes: [{ file: "narration/posts/7003/take-1.orpheus-zac.wav", engine: "orpheus", voice: "zac", seconds: 6.2, script: drafted }] }, + }); +} + +/** A thread read: the parent's first paragraph only (its tile an excerpt), the quoted post, his words, the screen's lines. */ +export function threadItem(o = {}) { + const e = base({ parents: [PARENT], quoted: QUOTED, thread: { parent: "excerpt" }, media: [IMG], screens: [DM], ...o }); + const parts = []; + let t = 0; + const add = (text, role, piece, gap, more = {}) => { + t += parts.length ? gap : 0; + const sec = Math.round((text.split(/\s+/).length / 3) * 100) / 100; + parts.push({ n: parts.length + 1, para: piece * 100 + (more.para ?? 0), text, voice: role === "post" ? "zac" : "leo", role, start: Math.round(t * 1000) / 1000, seconds: sec, ...(more.line ? { line: more.line, speaker: more.speaker } : {}) }); + t += sec; + }; + add(draftScript(PARENT.text.split("\n\n")[0]).script, "parent:0", 0, 0); + add(draftScript(QUOTED.text).script, "quoted", 1, 0.8); + const [p1, p2] = drafted.split("\n\n"); + add(p1, "post", 2, 0.8); + add(p2, "post", 2, 0.6, { para: 1 }); + DM.lines.forEach((l, n) => { + const said = screenLineSaid(DM, n); + add(draftScript(said).script, `screen:s1:${n}`, 3 + n, n ? 0.35 : 0.8, { line: draftScript(said).script, speaker: l.who }); + }); + return { + ...e, + narration: { + script: drafted, pick: 0, + takes: [{ file: "narration/posts/7003/take-1.orpheus-thread.wav", engine: "orpheus", voice: "zac+leo", seconds: Math.round(t * 1000) / 1000, script: parts.map((p) => p.text).join("\n\n"), parts, read: { kind: "thread", parents: "0" } }], + }, + }; +} + +/** What the card DRAWS of an item: never what its read sounds like (no timing). */ +export function drawn(e) { + const render = { postNarration: { lead: 0.4 } }; + const plan = postItemPlan(e, render); + const box = { width: 1600, height: 900 }; + const fb = followBlocks(e); + return { + plain: sha(postCardHtml(e, { ...box })), + follow: sha(postCardHtml(e, { ...box, follow: true, thread: plan.follow?.thread ?? null })), + // The blocks: their words, their scope, the screen line they are -- and whether a part reads them at all (an + // excerpt tile hides the ones none does). + blocks: sha(fb.blocks.map((b) => [b.k, b.scope, b.from, b.to, b.line ?? null, b.part === null])), + tiles: sha(Array.isArray(e.parents) || e.quoted ? (threadLayout(e, render).tiles ?? []).map((x) => [x.scope, x.mode, x.above ?? null, x.inside ?? null]) : []), + screens: sha(drawnScreens(e).map((s) => s.id)), + }; +} + +export const FIXTURES = { single: singleItem(), thread: threadItem() }; + +// Recorded on main (19fb842b5), before the S3 code. +export const PINNED_SHAS = { + single: { + plain: "b2d58c132a00371da7ae824538067737551a4e3f", + follow: "80b1456aff9178519d0def976396c9a4e5d61047", + blocks: "6dd74f6c9ca620ed3d2ec690fd229fc848dc5a59", + tiles: "b22e780f2eed98b5f9cefe21828d3600bd5af3c0", + screens: "97d170e1550eee4afc0af065b78cda302a97674c", + }, + thread: { + plain: "2bbb8717d3cad9f607463c969f5f7df622133cdf", + follow: "b0574d9a6149c221f3ed675ce748c98b48f6316b", + blocks: "3d085f775b916acd294b454fafde7bc770e72b85", + tiles: "68c08a31d2d1eaaac527741a5e83eaf5093d1b51", + screens: "2d021c30467f8a663cbd09eb672c85a6c484355a", + }, +}; + diff --git a/umtool/report-to-video/post-reading-pin.test.mjs b/umtool/report-to-video/post-reading-pin.test.mjs @@ -6,108 +6,9 @@ // // Recorded on main: PIN_RECORD=1 node --test report-to-video/post-reading-pin.test.mjs import assert from "node:assert/strict"; -import { createHash } from "node:crypto"; import { test } from "node:test"; -import { postCardHtml, postItemPlan } from "./post-item.mjs"; -import { drawnScreens, threadLayout } from "./post-thread.mjs"; -import { followBlocks } from "./read-follow.mjs"; -import { screenLineSaid } from "./post-screens.mjs"; import { draftScript } from "./post-narration.mjs"; - -const sha = (v) => createHash("sha1").update(typeof v === "string" ? v : JSON.stringify(v)).digest("hex"); - -const POST = "The council met on Tuesday about the new bridge.\n\nNobody from the ministry came to explain the delay."; -const QUOTED = { id: "7002", handle: "harbourwatch", author: "Harbour Watch", text: "Bridge works paused again, the notice says.", date: "2026-10-01T09:00:00.000Z" }; -const PARENT = { - id: "7001", handle: "rivertalk", author: "River Talk", date: "2026-10-01T08:00:00.000Z", - text: "Does anyone know why the tolls on the old crossing keep rising?\n\nA second paragraph nobody reads aloud in this cut.", -}; -const IMG = { src: "posts-media/bridge-x/7003/7003_1.png", kind: "image", width: 900, height: 1400 }; -const DM = { - id: "s1", media: 0, kind: "dm", read: "all", lines: [ - { who: "rivertalk", text: "Are the tolls going up again?" }, - { who: "bridgefan", text: "Not this year, they said." }, - ], -}; -const base = (o = {}) => ({ - type: "post", id: "p-7003", post: "bridge-x/7003", platform: "x", author: "Bridge Fan", handle: "bridgefan", date: "2026-10-02T10:00:00.000Z", - text: POST, subjects: ["bridgefan"], ...o, -}); -const drafted = draftScript(POST).script; - -/** A single read of his words: one file, its script his words as drafted. */ -export function singleItem(o = {}) { - return base({ - quoted: QUOTED, ...o, - narration: { script: drafted, pick: 0, takes: [{ file: "narration/posts/7003/take-1.orpheus-zac.wav", engine: "orpheus", voice: "zac", seconds: 6.2, script: drafted }] }, - }); -} - -/** A thread read: the parent's first paragraph only (its tile an excerpt), the quoted post, his words, the screen's lines. */ -export function threadItem(o = {}) { - const e = base({ parents: [PARENT], quoted: QUOTED, thread: { parent: "excerpt" }, media: [IMG], screens: [DM], ...o }); - const parts = []; - let t = 0; - const add = (text, role, piece, gap, more = {}) => { - t += parts.length ? gap : 0; - const sec = Math.round((text.split(/\s+/).length / 3) * 100) / 100; - parts.push({ n: parts.length + 1, para: piece * 100 + (more.para ?? 0), text, voice: role === "post" ? "zac" : "leo", role, start: Math.round(t * 1000) / 1000, seconds: sec, ...(more.line ? { line: more.line, speaker: more.speaker } : {}) }); - t += sec; - }; - add(draftScript(PARENT.text.split("\n\n")[0]).script, "parent:0", 0, 0); - add(draftScript(QUOTED.text).script, "quoted", 1, 0.8); - const [p1, p2] = drafted.split("\n\n"); - add(p1, "post", 2, 0.8); - add(p2, "post", 2, 0.6, { para: 1 }); - DM.lines.forEach((l, n) => { - const said = screenLineSaid(DM, n); - add(draftScript(said).script, `screen:s1:${n}`, 3 + n, n ? 0.35 : 0.8, { line: draftScript(said).script, speaker: l.who }); - }); - return { - ...e, - narration: { - script: drafted, pick: 0, - takes: [{ file: "narration/posts/7003/take-1.orpheus-thread.wav", engine: "orpheus", voice: "zac+leo", seconds: Math.round(t * 1000) / 1000, script: parts.map((p) => p.text).join("\n\n"), parts, read: { kind: "thread", parents: "0" } }], - }, - }; -} - -/** What the card DRAWS of an item: never what its read sounds like (no timing). */ -export function drawn(e) { - const render = { postNarration: { lead: 0.4 } }; - const plan = postItemPlan(e, render); - const box = { width: 1600, height: 900 }; - const fb = followBlocks(e); - return { - plain: sha(postCardHtml(e, { ...box })), - follow: sha(postCardHtml(e, { ...box, follow: true, thread: plan.follow?.thread ?? null })), - // The blocks: their words, their scope, the screen line they are -- and whether a part reads them at all (an - // excerpt tile hides the ones none does). - blocks: sha(fb.blocks.map((b) => [b.k, b.scope, b.from, b.to, b.line ?? null, b.part === null])), - tiles: sha(Array.isArray(e.parents) || e.quoted ? (threadLayout(e, render).tiles ?? []).map((x) => [x.scope, x.mode, x.above ?? null, x.inside ?? null]) : []), - screens: sha(drawnScreens(e).map((s) => s.id)), - }; -} - -export const FIXTURES = { single: singleItem(), thread: threadItem() }; - -// Recorded on main (19fb842b5), before the S3 code. -const PINNED = { - single: { - plain: "b2d58c132a00371da7ae824538067737551a4e3f", - follow: "80b1456aff9178519d0def976396c9a4e5d61047", - blocks: "6dd74f6c9ca620ed3d2ec690fd229fc848dc5a59", - tiles: "b22e780f2eed98b5f9cefe21828d3600bd5af3c0", - screens: "97d170e1550eee4afc0af065b78cda302a97674c", - }, - thread: { - plain: "2bbb8717d3cad9f607463c969f5f7df622133cdf", - follow: "b0574d9a6149c221f3ed675ce748c98b48f6316b", - blocks: "3d085f775b916acd294b454fafde7bc770e72b85", - tiles: "68c08a31d2d1eaaac527741a5e83eaf5093d1b51", - screens: "2d021c30467f8a663cbd09eb672c85a6c484355a", - }, -}; +import { FIXTURES, PINNED_SHAS, drawn, singleItem, threadItem } from "./post-reading-pin.fixtures.mjs"; test("THE READING PIN: an item whose read says its shown text as drafted draws as it did on main", () => { const got = Object.fromEntries(Object.entries(FIXTURES).map(([k, e]) => [k, drawn(e)])); @@ -115,7 +16,7 @@ test("THE READING PIN: an item whose read says its shown text as drafted draws a console.log(JSON.stringify(got, null, 2)); return; } - assert.deepEqual(got, PINNED); + assert.deepEqual(got, PINNED_SHAS); }); // --------------------------------------------------------------------------- @@ -158,15 +59,15 @@ function editedThread(script) { for (const [name, script] of Object.entries(EDITS)) { test(`EDITED FOR READING (${name}): a single read's card draws as before the edit`, () => { - assert.deepEqual(drawn(editedSingle(script)), PINNED.single); + assert.deepEqual(drawn(editedSingle(script)), PINNED_SHAS.single); }); test(`EDITED FOR READING (${name}): a thread read's card draws as before the edit -- the excerpt tile hides what it hid, the tiles keep their modes`, () => { - assert.deepEqual(drawn(editedThread(script)), PINNED.thread); + assert.deepEqual(drawn(editedThread(script)), PINNED_SHAS.thread); }); } test("EDITED BEFORE (no marker): the card follows the script, as it always did", () => { const e = editedSingle(EDITS.unrelated); delete e.narration.forReading; - assert.notDeepEqual(drawn(e), PINNED.single); + assert.notDeepEqual(drawn(e), PINNED_SHAS.single); }); diff --git a/umtool/report-to-video/post-screens.mjs b/umtool/report-to-video/post-screens.mjs @@ -14,7 +14,7 @@ // ref?: "<channel>/<postId>", unread?: "omit" | "dim", // lines: [{ who?, side?: "left" | "right", text, time?, redact?: true }], // read: "all" | "none" | [{ line, text? }], -// lineTakes?: { "<n>": "<take id>" } }] +// lineTakes?: { "<n>": "<take id>" }, saidAs?: { "<n>": "<what the voice says>" } }] // // - `media` names the attachment (an index into the item's `media`); `at` the source span a video or GIF shows it. // - `read`: every line ("all"), none ("none": transcribed only -- not drawn, not read), or the lines listed, each read @@ -26,6 +26,9 @@ // - `lineTakes`: the take the operator CHOSE for a line (a recording of it: `posts screen … record`, the bench's per-line // Record), by its id -- read in that line's place by every read of the item (postThreadRead.mjs); never chosen for // it by anything else. +// - `saidAs` (lane line-rerun; operator ruling 3, 15 Nov 2026: every edit is for READING only): what the voice SAYS +// for a read line, in place of its words -- an acronym spelled out, a typo said right. Never drawn: the card shows +// the line as written. A line's identity (is a take still this line?) is its shown words, never what it is said as. // - `who`: a handle or a name; it is the post's author (her own lines, on the right), or another speaker, voiced through // the project's characters and the cast as a thread read's pieces are (post-say.mjs) and drawn under the item's // privacy rule (a subject, or `redact: false`, shown; else blurred), an anonymous one under its shown name. @@ -236,7 +239,7 @@ const VIEWS = new WeakMap(); function viewOf(screen) { if (!isObj(screen)) return { reads: [], broken: [] }; const lines = Array.isArray(screen.lines) ? screen.lines : []; - const key = JSON.stringify([screen.read, lines]); + const key = JSON.stringify([screen.read, lines, isObj(screen.saidAs) ? screen.saidAs : null]); const had = VIEWS.get(screen); if (had && had.key === key) return had; const r = screen.read; @@ -263,7 +266,9 @@ function viewOf(screen) { } const masked = maskShapes(t).text; const cut = masked.slice(span.start, span.end); - reads.push({ n: x.line, start: span.start, end: span.end, cutBefore: span.start > all.start, cutAfter: span.end < all.end, said: cut.includes(REDACT_MARK) ? dropMarks(cut) : cut.trim(), shown: cut }); + const said = cut.includes(REDACT_MARK) ? dropMarks(cut) : cut.trim(); + const as = saidAsOf(screen, x.line); + reads.push({ n: x.line, start: span.start, end: span.end, cutBefore: span.start > all.start, cutAfter: span.end < all.end, said, shown: cut, spoken: as ?? said }); } reads.sort((a, b) => a.n - b.n); const v = { key, reads, broken }; @@ -277,17 +282,31 @@ function viewOf(screen) { * redacted line, a line with no words, or an EXCERPT NOT IN ITS LINE: none (never the whole line instead). */ export function screenReadLines(screen) { - return viewOf(screen).reads.map(({ said: _s, shown: _w, ...r }) => r); + return viewOf(screen).reads.map(({ said: _s, shown: _w, spoken: _p, ...r }) => r); +} + +/** A line's "said as" (`saidAs`), trimmed, or null when it has none. */ +export function saidAsOf(screen, n) { + const v = isObj(screen?.saidAs) ? screen.saidAs[String(n)] : undefined; + return typeof v === "string" && v.trim() ? v.trim() : null; } /** The screens the DATA says are read (a read line or more), in order. */ export const readScreens = (entry) => screensOf(entry).filter((s) => viewOf(s).reads.length > 0); -/** What a read line SAYS (before the thread read's spokenRead): its read run, its shapes left out ("" when not read). */ +/** + * A read line's words as SHOWN, ready to be said (before the thread read's spokenRead): its read run, its shapes left + * out ("" when not read). The line's identity -- a take is this line's while it said these -- never its "said as". + */ export function screenLineSaid(screen, n) { return viewOf(screen).reads.find((x) => x.n === n)?.said ?? ""; } +/** What the voice SAYS for a read line: its "said as" (`saidAs`), else screenLineSaid ("" when not read). */ +export function screenLineSpoken(screen, n) { + return viewOf(screen).reads.find((x) => x.n === n)?.spoken ?? ""; +} + /** * A screen with lines `drops` (their indices) REMOVED, pure (a copy): its read follows them -- a removed line's read * goes, the later lines' numbers move down (the CLI's `line.<n>=off`, the post bench's ×: one rule). A read the take @@ -304,6 +323,12 @@ export function withoutLines(screen, drops) { if (Object.keys(lt).length) out.lineTakes = lt; else delete out.lineTakes; } + // So do their "said as" (saidAs): a removed line's goes, the later ones' keys move down. + if (isObj(screen?.saidAs)) { + const sa = Object.fromEntries(Object.entries(screen.saidAs).filter(([k]) => /^\d{1,2}$/.test(k) && !gone.has(Number(k))).map(([k, v]) => [String(to(Number(k))), v])); + if (Object.keys(sa).length) out.saidAs = sa; + else delete out.saidAs; + } return out; } @@ -500,7 +525,7 @@ export function validateScreens(e) { errors.push(`${at} must be an object`); return; } - const known = new Set(["id", "media", "at", "kind", "title", "source", "checked", "ref", "unread", "lines", "read", "lineTakes"]); + const known = new Set(["id", "media", "at", "kind", "title", "source", "checked", "ref", "unread", "lines", "read", "lineTakes", "saidAs"]); for (const k of Object.keys(sc)) if (!known.has(k)) errors.push(`${at}.${k} is not a screen's field (${[...known].join(", ")})`); if (!SCREEN_ID_RE.test(str(sc.id))) errors.push(`${at}.id must be a short name (lower-case letters, digits, -)`); else if (ids.has(sc.id)) errors.push(`${at}.id "${sc.id}" is the id of another screen of the item`); @@ -559,6 +584,19 @@ export function validateScreens(e) { else if (!isObj(t.screenLine) || t.screenLine.screen !== sc.id) errors.push(`${at}.lineTakes.${k}: take ${takes.indexOf(t) + 1} is not a recording of a line of screen ${sc.id}${isObj(t.screenLine) ? ` (it is of screen ${t.screenLine.screen})` : ""}`); } } + // What a line is SAID AS (never drawn): a line it has, not redacted, words -- and no shape (an e-mail, a number the + // card would mask is never said, however it is typed). + if (sc.saidAs !== undefined) { + const sa = sc.saidAs; + if (!isObj(sa) || Object.keys(sa).length > SCREEN_LINES_MAX) errors.push(`${at}.saidAs must be { "<line>": "<what the voice says>" }`); + else for (const [k, v] of Object.entries(sa)) { + const n = /^\d{1,2}$/.test(k) ? Number(k) : -1; + if (n < 0 || !isObj(lines?.[n])) errors.push(`${at}.saidAs.${k}: the screen has no line ${k}`); + else if (lines[n].redact === true) errors.push(`${at}.saidAs.${k}: line ${k} is redacted -- it is never read`); + if (typeof v !== "string" || !v.trim() || v.length > SCREEN_LINE_MAX) errors.push(`${at}.saidAs.${k} must be words (at most ${SCREEN_LINE_MAX} characters)`); + else if (shapeSpans(v).length) errors.push(`${at}.saidAs.${k} says ${shapeSpans(v)[0].kind === "email" ? "an e-mail address" : "a number"} the card would mask -- a read never says one: say it another way`); + } + } const r = sc.read; if (r === "all" || r === "none") return; if (!Array.isArray(r)) { @@ -612,7 +650,9 @@ export function screenPieces(entry) { for (const sc of readScreens(entry)) { for (const r of screenReadLines(sc)) { const text = screenLineSaid(sc, r.n); - if (text.trim()) out.push({ role: screenRole(sc.id, r.n), who: str(sc.lines[r.n].who) || null, text, screen: sc.id }); + // `spoken`: its "said as" (saidAs), only when it has one -- `text` stays the line as shown (its identity). + const as = saidAsOf(sc, r.n); + if (text.trim()) out.push({ role: screenRole(sc.id, r.n), who: str(sc.lines[r.n].who) || null, text, screen: sc.id, ...(as ? { spoken: as } : {}) }); } } return out; diff --git a/umtool/report-to-video/post-thread.mjs b/umtool/report-to-video/post-thread.mjs @@ -55,7 +55,7 @@ import { followKnobs } from "./read-follow.mjs"; import { planContext } from "./post-conversation.mjs"; import { branchMapOf, mapKnobs, mapTimes } from "./post-branch-map.mjs"; import { isPictureOnly, pictureBeatSeconds } from "./post-picture.mjs"; -import { isScreenScope, parseScreenRole, readScreens, screenLineProblem, screenLineSaid, screenOrder, screenPieces, screenReadLines, screenRole, screenScope, screenWarnings, screensOf as screensOfEntry, shapeSpans, tileOfRole } from "./post-screens.mjs"; +import { isScreenScope, parseScreenRole, readScreens, screenLineProblem, screenLineSaid, screenLineSpoken, screenOrder, screenPieces, screenReadLines, screenRole, screenScope, screenWarnings, screensOf as screensOfEntry, shapeSpans, tileOfRole } from "./post-screens.mjs"; /** What a context tile may be. */ export const THREAD_MODES = Object.freeze(["auto", "full", "excerpt", "context", "carry", "hidden"]); @@ -166,7 +166,7 @@ export function readTexts(entry) { }); add("post", [cardText(entry), str(entry?.narration?.script), spoken(cardText(entry))]); // ITS SCREENS' read lines (post-screens.mjs): each its own text (a take's stored roles name them; a long line is matched). - for (const sc of readScreens(entry)) for (const r of screenReadLines(sc)) add(screenRole(sc.id, r.n), [screenLineSaid(sc, r.n)]); + for (const sc of readScreens(entry)) for (const r of screenReadLines(sc)) add(screenRole(sc.id, r.n), [screenLineSaid(sc, r.n), screenLineSpoken(sc, r.n)]); return out; } @@ -1354,6 +1354,6 @@ export function chronoPieces(entry, { skip = [] } = {}) { add("post", entry, cardText(entry)); out.sort((a, b) => order(a.role) - order(b.role)); // ITS SCREENS' read lines (post-screens.mjs), after everything else, in the screens' order: `who` as written. - for (const p of screenPieces(entry)) if (!skip.includes(p.role)) out.push({ role: p.role, date: null, author: null, handle: null, who: p.who, screen: p.screen, text: p.text }); + for (const p of screenPieces(entry)) if (!skip.includes(p.role)) out.push({ role: p.role, date: null, author: null, handle: null, who: p.who, screen: p.screen, text: p.text, ...(p.spoken ? { spoken: p.spoken } : {}) }); return out; }