commit 8e15ad905165fd514b1b1193af3bc73e816dd90f
parent 0cdf617498f831b04d40e7eb3fc54f7078e7a610
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 4 Nov 2026 13:18:50 -0500
umtool: chronoPieces -- a read's pieces in date order (the parents, the quote, linked posts and their transcripts, his words), for a batch that re-voices a whole thread chronologically
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/umtool/report-to-video/post-thread-scenes.test.mjs b/umtool/report-to-video/post-thread-scenes.test.mjs
@@ -315,3 +315,11 @@ test("THE BRANCH MAP (operator, 4 Nov: \"a specific visual for changing thread b
assert.equal(threadLayout({ ...p13, thread: { map: false } }, undefined, planContext(tl, 2)).map, undefined);
assert.equal(threadLayout({ ...p13, thread: { map: "label" } }, undefined, planContext(tl, 2)).map.style, "label");
});
+
+import { chronoPieces } from "./post-thread.mjs";
+
+test("chronoPieces: what a batch reads, oldest first -- his take (16:00), Kirsche (17:45), his reply (19:03); a carried post skipped", () => {
+ const e = base({ date: at(19), text: "Kirsche you're wrong on this one.", quoted: { author: "Subject", handle: "subject", date: at(16), text: "Here is my take." }, parents: [ref("2", "kirsche", "I hate watching it.", 17)] });
+ assert.deepEqual(chronoPieces(e).map((p) => p.role), ["quoted", "parent:0", "post"]);
+ assert.deepEqual(chronoPieces(e, { skip: ["parent:0"] }).map((p) => p.role), ["quoted", "post"]);
+});
diff --git a/umtool/report-to-video/post-thread.mjs b/umtool/report-to-video/post-thread.mjs
@@ -919,3 +919,26 @@ export function panelReadErrors(follow, panel, { id = "?", settle = 0.35 } = {})
}
return errors;
}
+
+/**
+ * THE READ's PIECES IN DATE ORDER (operator, 4 Nov: "include the whole thread chronologically"), pure: what a
+ * narration batch reads, in the order to read it -- `[{ role, date, author, handle, text }]`, every context post
+ * the card draws with words (the parents, the quoted post, the linked posts; a linked post's `transcript` as its own
+ * words) and his post, oldest first (roleOrderOf). `skip`: roles the run has read already (a carried post).
+ *
+ * @param {Record<string, any>} entry
+ * @param {{ skip?: string[] }} [o]
+ */
+export function chronoPieces(entry, { skip = [] } = {}) {
+ const order = roleOrderOf(entry);
+ const out = [];
+ const add = (role, ref, text) => {
+ if (!str(text).trim() || skip.includes(role)) return;
+ out.push({ role, date: str(ref?.date) || null, author: str(ref?.author) || null, handle: str(ref?.handle) || null, text: str(text) });
+ };
+ parentsOf(entry).forEach((p, i) => add(`parent:${i}`, p, contextText(p)));
+ if (isObj(entry?.quoted)) add("quoted", entry.quoted, contextText(entry.quoted));
+ linksOf(entry).forEach((l, i) => add(`linked:${i}`, l, [contextText(l), str(l.transcript)].filter((t) => t.trim()).join("\n\n")));
+ add("post", entry, cardText(entry));
+ return out.sort((a, b) => order(a.role) - order(b.role));
+}