@gentbajko/slopify 4.5.1 → 4.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,7 +79,7 @@ const revisions = [
79
79
  route: "POST /api/projects/:id/revisions",
80
80
  body: saveBody,
81
81
  title: "Save an edit",
82
- description: "Saves an edit as a new version, like Save in Edit settings; it starts nothing. Body: {baseRevisionId, idempotencyKey: a new UUID, edit: {config, content, regenerate?: [work keys to make again, such as a narration chunk key], uploads?: [{stagedFileId, destination}]}}; send get_revision's revision.config and revision.content with your change. One chunk's wording or delivery note is content.narrationOverrides[chunk key] = {kind: \"text\", text, direction?}. Finished shorts kept through a new pick are content.shortsKeep: leave one out to pick a new moment for it, and lower config.shorts.count as well to drop it. Then preview_rebuild (Choose what to make again) says what it makes and costs, and start_rebuild starts it.",
82
+ description: "Saves an edit as a new version, like Save in Edit settings; it starts nothing. Body: {baseRevisionId, idempotencyKey: a new UUID, edit: {config, content, regenerate?: [work keys to make again, such as a narration chunk key], uploads?: [{stagedFileId, destination}]}}; send get_revision's revision.config and revision.content with your change. One chunk's wording or delivery note is content.narrationOverrides[chunk key] = {kind: \"text\", text, direction?}. Finished shorts kept through a new pick are content.shortsKeep: leave one out to pick a new moment for it, and lower config.shorts.count as well to drop it. Leave content.shortsKeep as get_revision sent it unless the save picks the moments again: a new intro, outro or description never does, and a list sent with such an edit is ignored. Then preview_rebuild (Choose what to make again) says what it makes and costs, and start_rebuild starts it.",
83
83
  },
84
84
  {
85
85
  name: "restore_revision",
@@ -0,0 +1,17 @@
1
+ # Slopify 4.5.2
2
+
3
+ Released 18 November 2026.
4
+
5
+ A new intro or outro no longer makes a video's shorts again, and the AI's notes about its own work no longer open an article.
6
+
7
+ ## Shorts stay when the intro or outro changes
8
+
9
+ - **Shorts are now cut on the narration body's own clock.** A new intro or outro (its prompt, text or narration) no longer marks the shorts outdated: their picks, image prompts, pictures and renders stay as they are.
10
+ - **Only a short whose own words changed is picked again.** Rewriting another chapter or voicing another chunk again leaves every other short as it is. A short with a changed word gets a new moment in its own number, instead of the pick stopping with an error.
11
+ - **A short never reaches outside the body:** no intro or silence at its start, and it ends where the body's audio ends.
12
+ - **Existing projects keep their shorts.** The first change that moves the timing picks again once, keeping the finished shorts by their sentences, and only renders them again.
13
+ - **An edit that sends an empty keep list no longer drops every short.** Projects already re-picked before this keep their new shorts; the old ones come back only by restoring the version before that change.
14
+
15
+ ## No production notes in articles
16
+
17
+ - **Short opening paragraphs where the AI talks about its own work** ("I've read all sixteen documents and am now writing…") are now removed from the article before its first heading, and from the first paragraph of an AI-written intro or outro, so they are never narrated.
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "id": "4.5.2",
4
+ "title": "Slopify 4.5.2",
5
+ "version": "4.5.2",
6
+ "date": "2026-11-18"
7
+ },
2
8
  {
3
9
  "id": "4.5.1",
4
10
  "title": "Slopify 4.5.1",
@@ -0,0 +1,75 @@
1
+ // A model that works as an agent (the Claude Code provider) sometimes opens its answer with a
2
+ // line about its own work - "I've read all sixteen documents in full and am now writing the
3
+ // narration" - before the text it was asked for. Kept, that line is narrated, and asking for
4
+ // the text again only brings a new one like it. So it goes before the answer is kept.
5
+ //
6
+ // Conservative by design: a paragraph goes only when it is short and plainly about the work -
7
+ // the model saying what it read or is writing, naming the documents, sources, article or
8
+ // narration - or announces the text ("Here is the narration:"). A storyteller who says "I"
9
+ // keeps every word unless the sentence is also about the files. With a heading in the text,
10
+ // the notes before the first heading go; without one, only a first paragraph that is a note.
11
+ // The text is never left empty.
12
+ // ceiling: characters. A note is a sentence or two; a longer paragraph is narration.
13
+ const noteLength = 300;
14
+ // ceiling: paragraphs dropped before the first heading.
15
+ const notesBefore = 4;
16
+ const announcement = /^here(?:'s| is| are)\s+(?:the|your|my)\s+(?:[\w-]+\s+){0,3}?(?:article|narration|script|draft|intro|outro|end matter)\b/i;
17
+ const workStatement = /(?:\bI(?:'ve|'m|'ll|'d)?|\bI (?:have|am|will|had)|\blet me|\bnow|^|[.!?:]\s+)\s*(?:(?:now|just|also|fully|carefully|then|finished|done)\s+)*(?:read|reading|reviewed|reviewing|gone through|went through|been through|going through|looked (?:at|over|through)|studied|checked|drafted|drafting|draft|written|writing|write|compose|composing|produced|producing|prepare|preparing)\b/i;
18
+ const workNoun = /\b(?:documents?|sources?|notes|research|files?|brief|prompt|instructions|narration|article|script|draft|end matter|outline|attachments?|intro|outro)\b/i;
19
+ // A note opens on the model itself ("I", "let me", "now") or on the verb ("Writing the script
20
+ // now."); narration that only goes on to mention a document doesn't.
21
+ const noteOpening = /^\W*(?:okay|ok|alright|sure|great|right|done|i\b|i'|let me|now|writing|drafting|reading|composing)/i;
22
+ const rule = /^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/;
23
+ const headingLine = /^#{1,6}\s/m;
24
+ export function withoutProductionNote(text) {
25
+ const hasHeading = headingLine.test(text);
26
+ let rest = text;
27
+ let dropped = 0;
28
+ for (;;) {
29
+ const block = firstBlock(rest);
30
+ if (block === undefined)
31
+ break;
32
+ if (dropped > 0 && rule.test(block.text)) {
33
+ rest = block.after;
34
+ continue;
35
+ }
36
+ if (!isNote(block.text) || block.after.trim() === "")
37
+ break;
38
+ rest = block.after;
39
+ dropped += 1;
40
+ if (!hasHeading || dropped >= notesBefore)
41
+ break;
42
+ }
43
+ return dropped === 0 ? text : rest;
44
+ }
45
+ function isNote(paragraph) {
46
+ const text = paragraph.replace(/[‘’]/g, "'").replace(/\s+/g, " ").trim();
47
+ if (text === "" || text.length > noteLength || headingLine.test(text))
48
+ return false;
49
+ if (announcement.test(text))
50
+ return true;
51
+ return noteOpening.test(text) && workStatement.test(text) && workNoun.test(text);
52
+ }
53
+ // The first paragraph: its lines up to a blank line or a heading, and the text after it from
54
+ // its next non-blank line.
55
+ function firstBlock(text) {
56
+ const lines = text.replace(/^(?:[ \t]*\r?\n)+/, "").split("\n");
57
+ if (lines.length === 1 && lines[0]?.trim() === "")
58
+ return undefined;
59
+ let end = 1;
60
+ if (!headingLine.test(lines[0] ?? "")) {
61
+ while (end < lines.length) {
62
+ const line = lines[end] ?? "";
63
+ if (line.trim() === "" || headingLine.test(line))
64
+ break;
65
+ end += 1;
66
+ }
67
+ }
68
+ return {
69
+ text: lines.slice(0, end).join("\n"),
70
+ after: lines
71
+ .slice(end)
72
+ .join("\n")
73
+ .replace(/^(?:[ \t]*\r?\n)+/, ""),
74
+ };
75
+ }
@@ -57,6 +57,7 @@ export function audioRecipes(context, text) {
57
57
  ]);
58
58
  let sections;
59
59
  let cards = [];
60
+ let bodyChunks;
60
61
  if (config.sources.audio === "provide") {
61
62
  body = recipe(context, "audio:provided", "audio", {
62
63
  kind: "provided",
@@ -96,6 +97,10 @@ export function audioRecipes(context, text) {
96
97
  pending = true;
97
98
  parts.push(...group);
98
99
  }
100
+ bodyChunks = groups.map((group, at) => ({
101
+ key: group.key,
102
+ text: transcripts[at]?.effective ?? group.text,
103
+ }));
99
104
  // A chunk with its own narration edit keeps the transcript in this form even once the article
100
105
  // says the same (`bodyNarrationGroups`), so the word timing made from it stays current.
101
106
  if (transcripts.some((row) => row.effective !== row.original) ||
@@ -239,6 +244,7 @@ export function audioRecipes(context, text) {
239
244
  levels,
240
245
  ...(sections === undefined ? {} : { sections }),
241
246
  ...(cards.length === 0 ? {} : { cards }),
247
+ ...(bodyChunks === undefined ? {} : { bodyChunks }),
242
248
  };
243
249
  }
244
250
  function effectiveText(context, key, original) {
@@ -6,7 +6,7 @@ import { editPlan } from "./recipe-edit.js";
6
6
  import { exportRecipes } from "./recipe-exports.js";
7
7
  import { fillPrompt } from "./recipe-keywords.js";
8
8
  import { linePlan } from "./recipe-lines.js";
9
- import { masterPlan } from "./recipe-loudness.js";
9
+ import { levelKey, masterPlan } from "./recipe-loudness.js";
10
10
  import { resourceIdentity } from "./recipe-model.js";
11
11
  import { imageReference, referenceRecipe } from "./recipe-reference.js";
12
12
  import { withReviews } from "./recipe-reviews.js";
@@ -78,7 +78,11 @@ function buildEach(plain) {
78
78
  ...youtube,
79
79
  ...socialRecipes(context, text),
80
80
  ...(reference === undefined ? [] : [reference]),
81
- ...shortsRecipes(context, exports, drawnFrom, audio.cards ?? [], masterPlan(context, audio.levels, "video"), appearance),
81
+ ...shortsRecipes(context, exports, drawnFrom, audio.cards ?? [], masterPlan(context, audio.levels, "video"), appearance, {
82
+ master: masterPlan(context, audio.levels.filter((level) => level.key === levelKey("body")), "video"),
83
+ chunks: audio.bodyChunks,
84
+ level: audio.levels.find((level) => level.key === levelKey("body")),
85
+ }),
82
86
  ...thumbnail,
83
87
  ...documentRecipes(context, text, thumbnail),
84
88
  ...visualAssets(context, visualRecipes(context.config, context.content, audio.mediaFingerprint, captions?.fingerprint ?? null, (images) => editPlan(context, exports, youtube, images, audio.cards ?? []), drawnFrom, timing === undefined ? null : resourceIdentity(context, timing), withLines(masterPlan(context, audio.levels, "video"), linePlan(context, timing)), scenes, appearance, (text) => fillPrompt(context, text, "image"))),
@@ -95,20 +95,33 @@ export function planRevision(base, edit, prepared = { outputs: [], pieces: [] },
95
95
  },
96
96
  ],
97
97
  };
98
+ // A keep list only says which finished shorts outlast a new pick. An edit that picks
99
+ // nothing again (a new intro or outro, a prompt, a picture) keeps every short as it is,
100
+ // whatever list it sent: one sent with nothing ticked must not drop them all.
101
+ const { shortsKeep: _chosen, ...rest } = edit.content;
102
+ const kept = base.revision.content.shortsKeep;
103
+ const unchosen = planEdit(base, { ...edit, content: kept === undefined ? rest : { ...rest, shortsKeep: kept } }, prepared, inspected, false);
104
+ if (unchosen.ok && !picksAgain(base, unchosen))
105
+ return unchosen;
98
106
  return planEdit(base, edit, prepared, inspected, true);
99
107
  }
100
108
  const first = planEdit(base, edit, prepared, inspected, false);
101
109
  if (!first.ok)
102
110
  return first;
103
- const before = base.pieces.find((row) => row.key === shortsPickKey && row.selected && row.piece.state === "done")?.fingerprint;
104
- const after = first.fingerprints[shortsPickKey];
105
- if (before === undefined || after === undefined || after === before)
111
+ if (!picksAgain(base, first))
106
112
  return first;
107
113
  const finished = finishedShorts(base);
108
114
  if (finished.length === 0)
109
115
  return first;
110
116
  return planEdit(base, { ...edit, content: { ...edit.content, shortsKeep: finished } }, prepared, inspected, true);
111
117
  }
118
+ // Whether a save's plan picks the moments again: its pick is another than the version's
119
+ // finished one. Without a finished pick there is nothing to keep.
120
+ function picksAgain(base, plan) {
121
+ const before = base.pieces.find((row) => row.key === shortsPickKey && row.selected && row.piece.state === "done")?.fingerprint;
122
+ const after = plan.fingerprints[shortsPickKey];
123
+ return before !== undefined && after !== undefined && after !== before;
124
+ }
112
125
  function planEdit(base, edit, prepared, inspected, keeping) {
113
126
  const normal = normalizeImages(normalizeArticleIntent(base, edit));
114
127
  // A keep list chosen in this save: kept shorts numbered by their place, their work moved
@@ -3,10 +3,14 @@ import { fingerprint } from "../../kernel/runner/work.js";
3
3
  import { subjectOf } from "../admission/model.js";
4
4
  import { usesShorts } from "../admission/rules.js";
5
5
  import { withoutScene } from "../images/scenes.js";
6
+ import { pausesOf } from "../narration/pauses-model.js";
7
+ import { narrationRegenerationToken } from "../narration/plan.js";
6
8
  import { effectiveClips, pickedShortsOf } from "../shorts/clips.js";
7
9
  import { defaultShortsImagePrompt, musicVolumeOf, shortImageCount, shortsSpeedOf, } from "../shorts/model.js";
8
10
  import { imagePromptMessages } from "../shorts/prompts.js";
9
11
  import { lookWait, withLooks } from "./recipe-appearance.js";
12
+ import { voiceValues } from "./recipe-audio-parts.js";
13
+ import { breathValues } from "./recipe-breaths.js";
10
14
  import { castFor } from "./recipe-cast.js";
11
15
  import { noMaster } from "./recipe-loudness.js";
12
16
  import { recipe, resourceIdentity, selectedAsset, selectedReference, } from "./recipe-model.js";
@@ -23,8 +27,17 @@ import { llmInput, promptOf } from "./recipe-text.js";
23
27
  // clip was first picked, plus the one "Make this short again" renews under `shorts:N`. So
24
28
  // picking the moments again redoes only the clips whose sentences changed, and one short
25
29
  // can be made again alone.
30
+ //
31
+ // Shorts are cut from the body only, on the body's own clock (`bodyTiming`): the pick reads
32
+ // the body's words with times from the body's start, and its fingerprint holds the body's
33
+ // narration and timing, not the intro's or outro's. A new intro or outro moves every word of
34
+ // the video's timing, yet leaves the pick, each clip's prompts and images, and its render as
35
+ // they are; the render finds the body where it now starts. A pick saved before this, on the
36
+ // video's clock, is kept while the timing it read is unchanged (`legacy` below).
26
37
  export const shortsPickKey = "shorts:pick";
27
38
  export const shortsFutureKey = "shorts:future";
39
+ // The first value of a pick and a render on the body's clock.
40
+ export const bodyClockValue = "body-clock-v1";
28
41
  export function shortsRecipes(context, exports,
29
42
  // The establishing image the shorts' images are drawn from, when it is on.
30
43
  reference,
@@ -33,7 +46,10 @@ cards = [],
33
46
  // Level the volume: the levelled narration and the master (`recipe-loudness.ts`).
34
47
  master = noMaster,
35
48
  // How the figures look, for a shorts image prompt with `{{Appearance}}` (`recipe-appearance.ts`).
36
- appearance) {
49
+ appearance,
50
+ // The body alone, what a short on the body's clock is cut from: its levelled sound and, when
51
+ // it is voiced chunk by chunk, its chunks.
52
+ narration = { master }) {
37
53
  const { config } = context;
38
54
  const shorts = config.shorts;
39
55
  const timing = exports.find((value) => value.key === "subtitles:timing");
@@ -78,6 +94,8 @@ appearance) {
78
94
  [...short.hashtags],
79
95
  short.why,
80
96
  short.seed ?? null,
97
+ // Only on lists that remember every word, so older lists keep theirs.
98
+ ...(short.text === undefined ? [] : [short.text]),
81
99
  ]),
82
100
  ],
83
101
  ]),
@@ -85,7 +103,8 @@ appearance) {
85
103
  }, [...new Set([timing.key, ...(prompt?.dependsOn ?? []), ...(styled?.dependsOn ?? [])])],
86
104
  // A paid LLM call: readiness, the charge warning and the estimate treat it like one.
87
105
  { kind: "provider" });
88
- const pick = pickFor(resourceIdentity(context, timing));
106
+ // A pick saved on the video's clock, asked of the whole timing: kept while it still matches.
107
+ const legacy = pickFor(resourceIdentity(context, timing));
89
108
  // The same pick asked of the finished timing as it was recorded: a run's plan reads the
90
109
  // catalogue, which gives the timing another fingerprint than the one the version was saved
91
110
  // with, while the timing file is the same.
@@ -95,7 +114,17 @@ appearance) {
95
114
  asset !== null &&
96
115
  row.fingerprint !== timing.fingerprint &&
97
116
  selectedReference(row));
98
- const picked = savedPicked(context, pick, recorded === undefined ? [] : [pickFor([recorded.fingerprint, asset]).fingerprint]);
117
+ const legacyPicked = savedPicked(context, legacy, recorded === undefined ? [] : [pickFor([recorded.fingerprint, asset]).fingerprint]);
118
+ const chunks = narration.chunks === undefined ? undefined : chunkSource(context, narration);
119
+ const body = bodyTiming(timing, chunks?.anchor);
120
+ const onBody = legacyPicked === undefined && body !== undefined;
121
+ const pick = onBody ? pickFor(body) : legacy;
122
+ const picked = onBody ? savedPicked(context, pick) : legacyPicked;
123
+ // What a render on each clock reads the narration by: the body's timing and its levelled
124
+ // sound, or the whole timing and every levelled part.
125
+ const heard = (clip) => onBody
126
+ ? (chunks?.span(clip, body) ?? { timing: body, master: narration.master })
127
+ : { timing: resourceIdentity(context, timing), master };
99
128
  const images = config.images ?? { provider: "", model: "" };
100
129
  const style = styled === undefined ? defaultShortsImagePrompt : withoutScene(styled.text);
101
130
  if (picked === undefined)
@@ -167,15 +196,17 @@ appearance) {
167
196
  }, [prompts.key, ...(reference === undefined ? [] : [reference.key])], { token }));
168
197
  recipes.push(...stills);
169
198
  const extras = renderExtras(context, clip);
199
+ const sound = heard(clip);
170
200
  recipes.push(recipe(context, `${prefix}:render`, "video", {
171
201
  kind: "local",
172
202
  version: 1,
173
203
  operation: "short-render-v1",
174
204
  values: [
175
- resourceIdentity(context, timing),
205
+ sound.timing,
176
206
  clip.number,
177
- clip.start,
178
- clip.end,
207
+ // On its chunks, a clip is placed by its words when it renders: where the body's
208
+ // other chunks moved it is no reason to cut it again.
209
+ ...("chunks" in sound ? [clip.text] : [clip.start, clip.end]),
179
210
  stills.map((still) => resourceIdentity(context, still)),
180
211
  config.imageSeconds,
181
212
  config.zoomPercent,
@@ -189,17 +220,173 @@ appearance) {
189
220
  ? []
190
221
  : [["figure-cards-v1", cards.map((card) => resourceIdentity(context, card))]]),
191
222
  // Only while the volume is levelled, so every short without it keeps its fingerprint.
192
- ...master.values,
223
+ ...sound.master.values,
193
224
  ],
194
225
  }, [
195
226
  pick.key,
196
227
  ...stills.map((still) => still.key),
197
228
  ...cards.map((card) => card.key),
198
- ...master.keys,
229
+ ...sound.master.keys,
199
230
  ], { token }));
200
231
  }
201
232
  return recipes;
202
233
  }
234
+ // What the shorts' pick reads on the body's clock: the body's narration as the word timing was
235
+ // made from it (its file once it is made, else its recipe, with what it says), and how the
236
+ // words are timed. Not the intro or outro, the silence between them or at the edges: those
237
+ // move the body's words on the video's clock and not on its own. Undefined when the timing
238
+ // has no body to find.
239
+ export function bodyTiming(timing,
240
+ // The body's chunks as they were voiced, in place of the body's file (`chunkSource`).
241
+ chunks) {
242
+ if (timing.input.kind !== "local" || !Array.isArray(timing.input.values))
243
+ return undefined;
244
+ const values = timing.input.values;
245
+ const [timeline, , language, , ...words] = values;
246
+ const at = timing.dependsOn.findIndex((key) => key !== "audio:intro" && key !== "audio:outro");
247
+ if (!Array.isArray(timeline) || at < 0)
248
+ return undefined;
249
+ const entries = timeline;
250
+ const entry = entries[at];
251
+ if (!isRecord(entry))
252
+ return undefined;
253
+ const audio = entry.audio;
254
+ const file = Array.isArray(audio) && typeof audio[1] === "string" ? audio[1] : undefined;
255
+ return [
256
+ bodyClockValue,
257
+ timing.input.operation,
258
+ chunks ?? (file === undefined ? entry : ["file", file, entry.transcript ?? null]),
259
+ language ?? null,
260
+ ...words,
261
+ ];
262
+ }
263
+ // A body voiced chunk by chunk. The pick reads the chunks' words and how they were asked for
264
+ // (`anchor`): a chunk's own regeneration, the voice, the pauses. Not their files, which land
265
+ // mid-run; a change that brings a new file is in the request. Each short is cut from the chunks
266
+ // its sentences fall in (`span`), so a chunk voiced again elsewhere, or words added before it,
267
+ // leave it as it is. A clip whose words can't be found once among the chunks reads all of them.
268
+ function chunkSource(context, narration) {
269
+ const list = narration.chunks ?? [];
270
+ const tokens = context.content.regenerationTokens;
271
+ const token = (key) => narrationRegenerationToken(tokens, key, "body");
272
+ const asked = [voiceValues(context), pausesValue(context)];
273
+ const anchor = [
274
+ "chunks-v1",
275
+ list.map((chunk) => [chunk.text, token(chunk.key)]),
276
+ ...asked,
277
+ ];
278
+ // What the body was voiced from, in order: each chunk's requests as they were made (a chunk
279
+ // longer than the voice takes in one request is several), with the words each said and its
280
+ // file; a chunk not voiced yet is itself one. Read from the version's records, not the plan,
281
+ // so a plan that splits a chunk otherwise reads the same files.
282
+ const units = list.flatMap((chunk) => {
283
+ const parts = context.manifest.pieces
284
+ .flatMap((row) => {
285
+ const number = row.key.startsWith(`${chunk.key}:`)
286
+ ? Number(row.key.slice(chunk.key.length + 1))
287
+ : Number.NaN;
288
+ if (!Number.isInteger(number) ||
289
+ row.piece.state !== "done" ||
290
+ !selectedReference(row) ||
291
+ row.assetId === null)
292
+ return [];
293
+ const text = partText(row.piece.payload);
294
+ return text === undefined ? [] : [{ number, text, file: row.assetId }];
295
+ })
296
+ .toSorted((left, right) => left.number - right.number);
297
+ const whole = parts.length > 0 && parts.every((part, at) => part.number === at + 1);
298
+ return whole
299
+ ? parts.map((part) => ({
300
+ text: part.text,
301
+ identity: [part.text, token(chunk.key), part.file],
302
+ }))
303
+ : [{ text: chunk.text, identity: [chunk.text, token(chunk.key), null] }];
304
+ });
305
+ // Their words run together, letters and digits only, with where each one ends.
306
+ let stream = "";
307
+ const ends = [];
308
+ for (const unit of units) {
309
+ stream += spokenLetters(unit.text);
310
+ ends.push(stream.length);
311
+ }
312
+ const level = narration.level?.input.kind === "local" && Array.isArray(narration.level.input.values)
313
+ ? narration.level.input.values.slice(2)
314
+ : [];
315
+ // The levelled body's master, with the body's own levelled file left out: how it is levelled.
316
+ const master = {
317
+ keys: narration.master.keys,
318
+ values: narration.master.values.map((value) => Array.isArray(value) && value[0] === "loudness-v1"
319
+ ? ["span-loudness-v1", level, ...value.slice(2)]
320
+ : value),
321
+ };
322
+ return {
323
+ anchor,
324
+ span: (clip, body) => {
325
+ const words = spokenLetters(clip.text);
326
+ const at = words === "" ? -1 : stream.indexOf(words);
327
+ if (at < 0 || stream.indexOf(words, at + 1) >= 0)
328
+ return undefined;
329
+ const first = ends.findIndex((end) => end > at);
330
+ const last = ends.findIndex((end) => end >= at + words.length);
331
+ if (first < 0 || last < 0)
332
+ return undefined;
333
+ const values = Array.isArray(body) ? body : [];
334
+ return {
335
+ chunks: true,
336
+ timing: [
337
+ bodyClockValue,
338
+ "span-v1",
339
+ // How the words are timed: the timing operation, language and voices marker.
340
+ values[1] ?? null,
341
+ values[3] ?? null,
342
+ ...values.slice(4),
343
+ units.slice(first, last + 1).map((unit) => unit.identity),
344
+ ...asked,
345
+ breathValues(context.config),
346
+ ],
347
+ master,
348
+ };
349
+ },
350
+ };
351
+ }
352
+ // The words a narration request was voiced from, as its piece saved them.
353
+ function partText(payload) {
354
+ if (payload === null)
355
+ return undefined;
356
+ try {
357
+ const parsed = JSON.parse(payload);
358
+ return typeof parsed === "object" &&
359
+ parsed !== null &&
360
+ "text" in parsed &&
361
+ typeof parsed.text === "string"
362
+ ? parsed.text
363
+ : undefined;
364
+ }
365
+ catch {
366
+ return undefined;
367
+ }
368
+ }
369
+ function pausesValue(context) {
370
+ const pauses = pausesOf(context.config);
371
+ return pauses === undefined ? null : [pauses.sentenceSeconds, pauses.paragraphSeconds];
372
+ }
373
+ // What a text says, as letters and digits only and without its delivery notes in brackets:
374
+ // how a clip's words are found in its chunks whatever the word timing made of the
375
+ // punctuation, case and spacing.
376
+ export function spokenLetters(text) {
377
+ return text
378
+ .replace(/\[[^\]]*\]/g, " ")
379
+ .normalize("NFKD")
380
+ .toLowerCase()
381
+ .replace(/[^\p{L}\p{N}]+/gu, "");
382
+ }
383
+ function isRecord(value) {
384
+ return typeof value === "object" && value !== null && !Array.isArray(value);
385
+ }
386
+ // Whether a pick's or a render's values are on the body's clock.
387
+ export function onBodyClock(values) {
388
+ return Array.isArray(values) && Array.isArray(values[0]) && values[0][0] === bodyClockValue;
389
+ }
203
390
  // What the render draws and plays beyond the clip itself: the title headline, a faster
204
391
  // speed and the background music at its level. Undefined when none is in use.
205
392
  export function renderExtras(context, clip) {
@@ -3,6 +3,7 @@ import { internalError } from "../../kernel/errors.js";
3
3
  import { editSettings } from "../../kernel/ports/settings-places.js";
4
4
  import { referenceKey, thumbnailVariant } from "../admission/model.js";
5
5
  import { plainText } from "../article/plain.js";
6
+ import { withoutProductionNote } from "../article/production-note.js";
6
7
  import { splitEndMatter } from "../article/split.js";
7
8
  import { checkAppearance } from "../images/appearance.js";
8
9
  import { checkScenes, sceneCountOf } from "../images/scenes.js";
@@ -331,7 +332,9 @@ async function publishText(deps, context, piece, answer) {
331
332
  return;
332
333
  }
333
334
  if (piece.key === "article:body") {
334
- const parts = splitEndMatter(answer.text);
335
+ // A line the model wrote about its own work is never narrated.
336
+ const text = withoutProductionNote(answer.text);
337
+ const parts = splitEndMatter(text);
335
338
  // A script is read before it is kept: one the narration could not speak fails here, with
336
339
  // the line to fix, rather than at the narration.
337
340
  if (piece.input.kind === "llm" && piece.input.script !== undefined) {
@@ -341,11 +344,11 @@ async function publishText(deps, context, piece, answer) {
341
344
  }
342
345
  await publishResult(deps, context, piece, preparedTexts(deps, context, piece, [
343
346
  ["instructions", "instructions.md", frozenInstructions(deps, context, piece)],
344
- ["article_md", "article.md", answer.text],
347
+ ["article_md", "article.md", text],
345
348
  ["article_txt", "article.txt", plainText(parts.body)],
346
349
  ...(parts.sources ? [["sources", "sources.md", parts.sources]] : []),
347
350
  ...(parts.glossary ? [["glossary", "glossary.md", parts.glossary]] : []),
348
- ]), { text: answer.text });
351
+ ]), { text });
349
352
  return;
350
353
  }
351
354
  if (piece.key === "script:attribute") {
@@ -380,9 +383,13 @@ async function publishText(deps, context, piece, answer) {
380
383
  await publishResult(deps, context, piece, [], { title, notes: answer.text }, asset);
381
384
  return;
382
385
  }
386
+ // The intro and outro are spoken too, so a note about the work goes from them as well.
387
+ const spoken = piece.key === "entry:intro:text" || piece.key === "entry:outro:text"
388
+ ? withoutProductionNote(answer.text)
389
+ : answer.text;
383
390
  await publishResult(deps, context, piece, preparedTexts(deps, context, piece, [
384
391
  ["instructions", "instructions.md", frozenInstructions(deps, context, piece)],
385
- ]), { text: answer.text, prompt: answer.text });
392
+ ]), { text: spoken, prompt: spoken });
386
393
  }
387
394
  function narrationLabel(deps, context, piece) {
388
395
  if (piece.input.kind !== "tts")