@gentbajko/slopify 4.3.1 → 4.3.3

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.
@@ -194,6 +194,8 @@ export function createRunner(deps) {
194
194
  }
195
195
  function startEligible(projectId) {
196
196
  const stages = deps.stages.stagesOf(projectId);
197
+ // Worked out once for this sweep and thrown away at the end of it.
198
+ const pass = new Map();
197
199
  const releasesKind = (dependent) => (kind) => {
198
200
  const matches = stages.filter((stage) => stage.kind === kind);
199
201
  return (matches.length > 0 && matches.every((stage) => releases(dependent, kind, stage.state)));
@@ -205,7 +207,7 @@ export function createRunner(deps) {
205
207
  const dependencies = deps.stages.dependenciesOf?.(projectId, stage.kind) ?? graph[stage.kind];
206
208
  if (deps.stages.ready === undefined
207
209
  ? !dependencies.every(releasesKind(stage.kind))
208
- : !deps.stages.ready(stage.work)) {
210
+ : !deps.stages.ready(stage.work, pass)) {
209
211
  continue;
210
212
  }
211
213
  if (deps.stages.paused?.(projectId))
package/dist/main.js CHANGED
@@ -1139,7 +1139,7 @@ alignSubtitles: aligner = alignSubtitlesWith(() => readSettings({ db, log }).sub
1139
1139
  return projectStandings(execution, projectId);
1140
1140
  },
1141
1141
  standingsOf: (projectId) => executionStandings(execution, projectId),
1142
- ready: (work) => invocationReady(execution, work),
1142
+ ready: (work, pass) => invocationReady(execution, work, pass),
1143
1143
  // A project in the trash (Settings → Trash) holds like a paused one until it is restored.
1144
1144
  paused: (projectId) => projectPaused(db, projectId) ||
1145
1145
  queueWaiting(db, projectId) ||
@@ -0,0 +1,16 @@
1
+ # Slopify 4.3.2
2
+
3
+ Released 9 November 2026.
4
+
5
+ Two fixes: the settings screen opens again, and a video with many images gets scenes worth drawing.
6
+
7
+ ## Edit settings opens again
8
+
9
+ - **It crashed on every project in 4.3.1**, with `createHash is not a function` and nothing to do but Try again. The form read the count of names you carry from Settings → Voices → Name pronunciations, and the code it read it from also stamps the list's version by hashing — which a browser cannot do. It now reads the count from the parser alone.
10
+ - **A check keeps it from coming back.** The web build's imports are walked from the router, and anything that reaches a Node built-in for its values fails the suite rather than the screen.
11
+
12
+ ## Scenes are written a batch at a time
13
+
14
+ - **Every image's scene came from one request.** Asked for twelve the model spent about 42 words on each; asked for 240 it rationed them down to 18, and the first thing it dropped was the material, light and colour an image is drawn from. "Broken towers of dark stone, collapsed palaces and scorched fields under a smoke-heavy sky" became "a demon lunges at an adventurer", and the pictures came out pale and simple while the prompts, the model and the settings were untouched.
15
+ - **Scenes are now written sixteen at a time,** each call reading only the stretch of the article its own pictures are shown over, and each image waiting on the batch that writes its scene. No answer is long enough to be worth compressing.
16
+ - **A short video is unchanged** — one batch, the same single step it always had.
@@ -0,0 +1,11 @@
1
+ # Slopify 4.3.3
2
+
3
+ Released 9 November 2026.
4
+
5
+ A video with many images no longer stops the app while it decides what to run next.
6
+
7
+ ## The run stops blocking the app
8
+
9
+ - **Every time a run asked itself what to start next, it worked the answer out from scratch for each waiting step** — reading the whole revision back off disk, a check for every output and every picture, the article read again, and every step re-derived from the narration up. With twelve pictures that happened a few dozen times across a run and nobody saw it. With 240 it happened tens of thousands of times, one core went to nothing but that, and the app stopped answering: pages hung, and nothing could be opened until it was restarted.
10
+ - **It is now worked out once for each sweep and shared by every step in it.** A sweep starts with nothing carried over from the one before, so a step that has just finished is still seen the moment it finishes.
11
+ - **Nothing about what runs, or in what order, has changed** — only how often the same answer is worked out.
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "id": "4.3.3",
4
+ "title": "Slopify 4.3.3",
5
+ "version": "4.3.3",
6
+ "date": "2026-11-09"
7
+ },
8
+ {
9
+ "id": "4.3.2",
10
+ "title": "Slopify 4.3.2",
11
+ "version": "4.3.2",
12
+ "date": "2026-11-09"
13
+ },
2
14
  {
3
15
  "id": "4.3.1",
4
16
  "title": "Slopify 4.3.1",
@@ -88,6 +88,44 @@ export function pictureKind(body, name) {
88
88
  // The count is written on a line of its own so the answer can be checked against it when the
89
89
  // call runs (`sceneCountOf`), from the saved request alone.
90
90
  const countLine = /^Pictures: (\d+)$/m;
91
+ // How many scenes one call writes. A model asked for a long list rations its answer: every
92
+ // scene it writes is a clause instead of two sentences, and what it drops first is the
93
+ // material, light and colour an image is drawn from. Twelve scenes came back at about 42
94
+ // words each; 240 in one answer came back at 18, and the pictures went flat. So the scenes
95
+ // are written a batch at a time, each call reading only the stretch of the article its own
96
+ // pictures cover.
97
+ export const scenesPerCall = 16;
98
+ // The pictures in batches, in slideshow order: [0..15], [16..31], and so on.
99
+ export function sceneBatches(items, size = scenesPerCall) {
100
+ const batches = [];
101
+ for (let at = 0; at < items.length; at += size)
102
+ batches.push([...items.slice(at, at + size)]);
103
+ return batches;
104
+ }
105
+ // The stretch of the article each batch reads, split on paragraph breaks and shared out in
106
+ // proportion to how many pictures each batch holds, so batch N covers the part of the article
107
+ // its pictures are shown over. A short article that cannot be split gives every batch the
108
+ // whole of it, which is what a single call always did.
109
+ export function sceneArticleSlices(article, counts) {
110
+ const total = counts.reduce((sum, count) => sum + count, 0);
111
+ const paragraphs = article.split(/\n\s*\n/).filter((one) => one.trim() !== "");
112
+ if (total === 0)
113
+ return [];
114
+ if (paragraphs.length < counts.length)
115
+ return counts.map(() => article);
116
+ const slices = [];
117
+ let taken = 0;
118
+ let done = 0;
119
+ for (const [index, count] of counts.entries()) {
120
+ done += count;
121
+ const upto = index === counts.length - 1
122
+ ? paragraphs.length
123
+ : Math.max(taken + 1, Math.round((done / total) * paragraphs.length));
124
+ slices.push(paragraphs.slice(taken, upto).join("\n\n"));
125
+ taken = upto;
126
+ }
127
+ return slices;
128
+ }
91
129
  // The thumbnails' scenes come after the images', one per thumbnail, when the thumbnail
92
130
  // prompt asks for one with `{{Scene}}`. They are not tied to a stretch of the article: each is
93
131
  // the moment that would make someone click, a different one for each thumbnail.
@@ -82,7 +82,7 @@ function buildEach(plain) {
82
82
  ...thumbnail,
83
83
  ...documentRecipes(context, text, thumbnail),
84
84
  ...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"))),
85
- ...(scenes === undefined ? [] : [scenes.recipe]),
85
+ ...(scenes === undefined ? [] : scenes.recipes),
86
86
  ...(thumbnailScened === undefined ? [] : [thumbnailScened.recipe]),
87
87
  ...(appearance === undefined ? [] : [appearance.recipe]),
88
88
  ]);
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { withLanguage } from "../../kernel/ports/languages.js";
3
3
  import { subjectOf, thumbnailCountOf } from "../admission/model.js";
4
- import { pictureKind, sceneMessages, usesScene, usesSlopifyScene, wantsSceneDetails, } from "../images/scenes.js";
4
+ import { pictureKind, sceneArticleSlices, sceneBatches, sceneMessages, scenesPerCall, usesScene, usesSlopifyScene, wantsSceneDetails, } from "../images/scenes.js";
5
5
  import { recipe, selectedReference, } from "./recipe-model.js";
6
6
  import { llmInput, llmInputFingerprint } from "./recipe-text.js";
7
7
  export const imageScenesKey = "images:scenes";
@@ -71,26 +71,51 @@ export function imageScenes(context, text) {
71
71
  }
72
72
  if (keys.length === 0)
73
73
  return undefined;
74
- const messages = withLanguage(sceneMessages({
75
- title: subjectOf(config),
76
- article: text.pictureText ?? "",
77
- pictures,
78
- ...(details ? { details } : {}),
79
- }), config.language);
80
- const value = recipe(context, imageScenesKey, "images", text.pictureText === null
81
- ? {
82
- kind: "deferred",
83
- version: 1,
84
- operation: "image-scenes",
85
- template: [llmInputFingerprint(context, messages), text.article.fingerprint],
86
- }
87
- : llmInput(context, messages), [text.article.key]);
88
- const saved = text.pictureText === null ? undefined : savedScenes(context, value, keys.length);
74
+ const batches = sceneBatches(pictures);
75
+ const slices = sceneArticleSlices(text.pictureText ?? "", batches.map((batch) => batch.length));
76
+ const recipes = batches.map((batch, index) => {
77
+ const messages = withLanguage(sceneMessages({
78
+ title: subjectOf(config),
79
+ article: slices[index] ?? text.pictureText ?? "",
80
+ pictures: batch,
81
+ ...(details ? { details } : {}),
82
+ }), config.language);
83
+ // The first batch keeps the bare key, so a run with one batch has the step it always had.
84
+ const key = index === 0 ? imageScenesKey : `${imageScenesKey}:${String(index)}`;
85
+ return recipe(context, key, "images", text.pictureText === null
86
+ ? {
87
+ kind: "deferred",
88
+ version: 1,
89
+ operation: "image-scenes",
90
+ template: [llmInputFingerprint(context, messages), text.article.fingerprint],
91
+ }
92
+ : llmInput(context, messages), [text.article.key]);
93
+ });
94
+ // Every batch has to have answered before any image can take its scene: a missing one
95
+ // leaves the images waiting as deferred requests, exactly as one unanswered call did.
96
+ const saved = text.pictureText === null
97
+ ? undefined
98
+ : batches.reduce((carried, batch, index) => {
99
+ if (carried === undefined)
100
+ return undefined;
101
+ const one = savedScenes(context, recipes[index], batch.length);
102
+ if (one === undefined)
103
+ return undefined;
104
+ return {
105
+ scenes: [...carried.scenes, ...one.scenes],
106
+ details: [
107
+ ...carried.details,
108
+ ...(one.details ?? batch.map(() => ({}))),
109
+ ],
110
+ any: carried.any || one.details !== undefined,
111
+ };
112
+ }, { scenes: [], details: [], any: false });
89
113
  return {
90
- recipe: value,
114
+ recipes,
115
+ recipeFor: (at) => recipes[Math.min(Math.floor(at / scenesPerCall), recipes.length - 1)],
91
116
  keys,
92
117
  scenes: saved?.scenes,
93
- ...(saved?.details === undefined ? {} : { details: saved.details }),
118
+ ...(saved?.any === true ? { details: saved.details } : {}),
94
119
  legacy,
95
120
  };
96
121
  }
@@ -181,7 +181,7 @@ function sceneImage(config, content, key, body, scenes, at, reference, appearanc
181
181
  version: 1,
182
182
  operation: "image-scene",
183
183
  template: [
184
- scenes.recipe.fingerprint,
184
+ scenes.recipeFor(at).fingerprint,
185
185
  at,
186
186
  config.images?.provider ?? null,
187
187
  config.images?.model ?? null,
@@ -201,7 +201,7 @@ function sceneImage(config, content, key, body, scenes, at, reference, appearanc
201
201
  ...(reference === undefined ? {} : { reference: reference.input }),
202
202
  ...castField(castFor(config, prompt)),
203
203
  }, [
204
- scenes.recipe.key,
204
+ scenes.recipeFor(at).key,
205
205
  ...wait.dependsOn,
206
206
  ...(reference === undefined ? [] : [reference.key]),
207
207
  ...keyed.dependsOn,
@@ -203,7 +203,7 @@ function checkAnswer(piece, answer) {
203
203
  ? `The AI model's description had no words a narrator could say. Use Try again; if it keeps happening, choose another model in ${editSettings.writer}, or turn off Describe tables and figures in ${editSettings.narration}.`
204
204
  : undefined;
205
205
  // Scenes from the article: one scene per image, as many as the request lists.
206
- if ((piece.key === imageScenesKey || piece.key === thumbnailScenesKey) &&
206
+ if ((piece.key.startsWith(imageScenesKey) || piece.key === thumbnailScenesKey) &&
207
207
  piece.input.kind === "llm") {
208
208
  const checked = checkScenes(answer.text, sceneCountOf(piece.input.messages) ?? 0);
209
209
  return checked.ok ? undefined : checked.reason;
@@ -245,7 +245,7 @@ function attributionSource(messages) {
245
245
  return messages.at(-1)?.content ?? "";
246
246
  }
247
247
  async function publishText(deps, context, piece, answer) {
248
- if ((piece.key === imageScenesKey || piece.key === thumbnailScenesKey) &&
248
+ if ((piece.key.startsWith(imageScenesKey) || piece.key === thumbnailScenesKey) &&
249
249
  piece.input.kind === "llm") {
250
250
  const checked = checkScenes(answer.text, sceneCountOf(piece.input.messages) ?? 0);
251
251
  if (!checked.ok)
@@ -82,7 +82,23 @@ export function executionStages(deps, projectId) {
82
82
  };
83
83
  });
84
84
  }
85
- export function invocationReady(deps, work) {
85
+ // The view and the plan a sweep works out once. Reading a revision stats every output and
86
+ // every piece on disk and reads the article back, and planning it derives every recipe from
87
+ // the narration up; at twelve images that was a few dozen times over a run and nobody saw it,
88
+ // at 240 it is tens of thousands and the server stops answering. `pass` is the caller's
89
+ // scratch space for one sweep (`kernel/runner`): within it nothing writes the pieces or
90
+ // outputs these are read from, so the answer cannot have gone stale. Without one, every call
91
+ // works it out afresh, as it always did.
92
+ function passPlan(pass, key, make) {
93
+ if (pass === undefined)
94
+ return make();
95
+ if (pass.has(key))
96
+ return pass.get(key);
97
+ const value = make();
98
+ pass.set(key, value);
99
+ return value;
100
+ }
101
+ export function invocationReady(deps, work, pass) {
86
102
  const row = deps.db
87
103
  .prepare("SELECT recipe_context,retry_at FROM revision_work WHERE id=? AND project_id=? AND revision_id=?")
88
104
  .get(work.workId, work.projectId, work.revisionId);
@@ -91,10 +107,12 @@ export function invocationReady(deps, work) {
91
107
  // Waiting out a failure time can fix: `dueRetries` clears the wait when it runs out.
92
108
  if (row.retry_at !== null)
93
109
  return false;
94
- const view = executionView(deps, work.projectId, work.revisionId);
110
+ const view = passPlan(pass, `view:${work.projectId}:${work.revisionId}`, () => executionView(deps, work.projectId, work.revisionId));
95
111
  if (view === undefined)
96
112
  return false;
97
- const plan = executionPlan(deps, view, savedCatalogue(row.recipe_context));
113
+ // The catalogue is the work row's own, so it belongs in the key: two steps saved under
114
+ // different catalogues must not share a plan.
115
+ const plan = passPlan(pass, `plan:${work.projectId}:${work.revisionId}:${String(row.recipe_context)}`, () => executionPlan(deps, view, savedCatalogue(row.recipe_context)));
98
116
  const pieces = workPieces(deps.db, work.workId);
99
117
  return pieces.some((piece) => {
100
118
  if (piece.state === "done" ||