@gentbajko/slopify 4.5.4 → 4.5.5
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.
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/main.js +3 -0
- package/dist/patch-notes/4.5.5.md +13 -0
- package/dist/patch-notes/index.json +6 -0
- package/dist/slices/agents/attention.js +29 -0
- package/dist/slices/rebuild/continue-held.js +69 -0
- package/dist/slices/schedules/held-back.js +62 -0
- package/dist/slices/schedules/prepare.js +30 -2
- package/dist/slices/schedules/repo.js +1 -1
- package/dist/slices/schedules/scheduler.js +9 -3
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
package/dist/main.js
CHANGED
|
@@ -70,6 +70,7 @@ import { createNotificationSender } from "./slices/notifications/send.js";
|
|
|
70
70
|
import { createServerNotifier } from "./slices/notifications/server.js";
|
|
71
71
|
import { seedSamples } from "./slices/onboarding/sample.js";
|
|
72
72
|
import { templateById } from "./slices/project-templates/repo.js";
|
|
73
|
+
import { continueHeldRun } from "./slices/rebuild/continue-held.js";
|
|
73
74
|
import { createNarrationRetries } from "./slices/rebuild/narration-retry.js";
|
|
74
75
|
import { recoverProject } from "./slices/rebuild/recovery.js";
|
|
75
76
|
import { claimWork, finishWork, maySubmit } from "./slices/rebuild/repo.js";
|
|
@@ -518,6 +519,8 @@ export async function boot(config, options = {}) {
|
|
|
518
519
|
const scheduleRunnerDeps = {
|
|
519
520
|
...draftDeps,
|
|
520
521
|
designs: () => designMake,
|
|
522
|
+
// A made-ahead run a restart stopped goes on when its day takes it.
|
|
523
|
+
continueRun: (projectId) => continueHeldRun(rebuild, projectId),
|
|
521
524
|
// The newest version that may run: legacy, marked ready, or carried by Slopify. Only a
|
|
522
525
|
// project template's: a design schedule asks the designs (runnableDesignVersion).
|
|
523
526
|
template: (id) => runnableTemplate(runtimeDb, id),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Slopify 4.5.5
|
|
2
|
+
|
|
3
|
+
Released 27 November 2026.
|
|
4
|
+
|
|
5
|
+
A video made ahead is now made on its day even after the computer restarted, and a schedule that skips its runs says which video holds it back.
|
|
6
|
+
|
|
7
|
+
## A video made ahead is rendered on its day after a restart
|
|
8
|
+
|
|
9
|
+
- **Its day now continues a video made ahead that a restart stopped.** When the app restarted while a schedule held a video made ahead for its day, the video read Stopped, and on its day the schedule took it but nothing rendered it until someone pressed Continue the run. The schedule's day is the go-ahead, so it now does what Continue the run would: the steps the restart held go on and the video is made. Nothing already made is made or paid for again, a project you paused stays paused, and a checkpoint of yours still waits for your approval.
|
|
10
|
+
- **The day never starts paid work you didn't start.** If settings saved on the video since need new paid steps that were never started, the day leaves it Stopped and the schedule's run history says so, with the button to press.
|
|
11
|
+
- **A skipped run says which video holds it back.** A schedule skips its runs while the video of an earlier run is unfinished. When that video is paused, stopped by a restart, waiting for your review or has a failed step, the skipped run now names the video and says what to press, instead of only "the previous run was still going". In what needs attention, that video's entry also says which schedule waits on it.
|
|
12
|
+
- A video made ahead still reads Stopped between a restart and its day when the restart held its steps; its day now moves it on by itself.
|
|
13
|
+
- Technical: `continuePrepared` (`schedules/prepare.ts`) is async and, for a project with a `prepared_videos` row, calls the new `ScheduleDeps.continueRun`, wired in `main.ts` to `continueHeldRun` (`rebuild/continue-held.ts`). That calls `recoverProject` with `{ kind: "resume" }` only when the head has restart-held admitted work (`dispatch_state='held'`, `pendingAdmitted`, no waiting external review), the project isn't paused, and every provider recipe the resume plan would make is already reserved on the head with the same fingerprint; otherwise it returns a refusal sentence the scheduler stores as the run's `error`. `overlapSentence` (`schedules/held-back.ts`) replaces the fixed overlap skip text, and `needsAttention` appends the schedules an unsettled run's project holds back.
|
|
@@ -4,6 +4,7 @@ import { liveProject } from "../admission/repo.js";
|
|
|
4
4
|
import { externalReviewOf } from "../reviews/external-rows.js";
|
|
5
5
|
import { waitingExternalReviewRows } from "../reviews/external-waiting.js";
|
|
6
6
|
import { projectHolds } from "../reviews/holds.js";
|
|
7
|
+
import { heldBack } from "../schedules/held-back.js";
|
|
7
8
|
import { templateSampleProjects } from "../template-studio/repo.js";
|
|
8
9
|
import { setAsideProjects } from "../uploads/repo.js";
|
|
9
10
|
import { postsWaiting } from "./attention-posts.js";
|
|
@@ -58,6 +59,7 @@ export function needsAttention(deps, now) {
|
|
|
58
59
|
];
|
|
59
60
|
const aside = setAsideProjects(db);
|
|
60
61
|
const samples = templateSampleProjects(db);
|
|
62
|
+
const blocking = schedulesHeldBack(deps);
|
|
61
63
|
return sources
|
|
62
64
|
.flatMap(([source, entries]) => {
|
|
63
65
|
try {
|
|
@@ -71,8 +73,35 @@ export function needsAttention(deps, now) {
|
|
|
71
73
|
}
|
|
72
74
|
})
|
|
73
75
|
.filter((entry) => entry.projectId === null || (!aside.has(entry.projectId) && !samples.has(entry.projectId)))
|
|
76
|
+
.map((entry) => {
|
|
77
|
+
const names = entry.projectId === null ? undefined : blocking.get(entry.projectId);
|
|
78
|
+
return names === undefined
|
|
79
|
+
? entry
|
|
80
|
+
: {
|
|
81
|
+
...entry,
|
|
82
|
+
reason: `${entry.reason} Until this video finishes, ${names.map((name) => `the schedule “${name}”`).join(" and ")} skips its runs.`,
|
|
83
|
+
};
|
|
84
|
+
})
|
|
74
85
|
.toSorted((a, b) => a.since.localeCompare(b.since));
|
|
75
86
|
}
|
|
87
|
+
// The schedules each unfinished video of an earlier run holds back (`schedules/held-back.ts`):
|
|
88
|
+
// said on that video's entries, since a schedule skips its runs until the video finishes.
|
|
89
|
+
function schedulesHeldBack(deps) {
|
|
90
|
+
const names = new Map();
|
|
91
|
+
try {
|
|
92
|
+
for (const one of heldBack(deps.db)) {
|
|
93
|
+
const listed = names.get(one.projectId) ?? [];
|
|
94
|
+
if (!listed.includes(one.scheduleName))
|
|
95
|
+
names.set(one.projectId, [...listed, one.scheduleName]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
deps.log.write("error", "attention.source", {
|
|
100
|
+
detail: `needs_attention left out which schedules wait on a video because reading them failed: ${causedBy(error)}`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return names;
|
|
104
|
+
}
|
|
76
105
|
function titles(db) {
|
|
77
106
|
return new Map(db
|
|
78
107
|
.prepare("SELECT id, title FROM projects")
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { pendingAdmitted } from "../admission/admitted-work.js";
|
|
3
|
+
import { projectPaused, stagesOf } from "../admission/repo.js";
|
|
4
|
+
import { currentRevisionId } from "../revisions/repo.js";
|
|
5
|
+
import { getRevisionView } from "../revisions/view.js";
|
|
6
|
+
import { planPreview } from "./preview-plan.js";
|
|
7
|
+
import { retainedPreviewPlan } from "./preview-retained.js";
|
|
8
|
+
import { recoverProject } from "./recovery.js";
|
|
9
|
+
import { resumeSelection } from "./recovery-selection.js";
|
|
10
|
+
const fix = "Open it in Projects and press Continue the run.";
|
|
11
|
+
// The scheduled day is the go-ahead for a video made ahead, so a run a restart stopped goes on
|
|
12
|
+
// as Continue the run would take it on: the steps a restart held on its current version are let
|
|
13
|
+
// go again. Only steps already admitted go on. A step that costs money and was never admitted
|
|
14
|
+
// (an edit saved on it and never started) waits for the person, so the day spends nothing they
|
|
15
|
+
// didn't start. A Pause is left alone, and a person's checkpoint still holds what it holds.
|
|
16
|
+
export async function continueHeldRun(deps, projectId) {
|
|
17
|
+
const head = currentRevisionId(deps.db, projectId);
|
|
18
|
+
if (head === undefined || projectPaused(deps.db, projectId))
|
|
19
|
+
return { kind: "untouched" };
|
|
20
|
+
const held = deps.db
|
|
21
|
+
.prepare(`SELECT 1 FROM revision_work w WHERE w.project_id=? AND w.dispatch_state='held' AND ${pendingAdmitted("w")}
|
|
22
|
+
AND NOT EXISTS (SELECT 1 FROM external_reviews e WHERE e.work_id=w.id AND e.state='waiting')
|
|
23
|
+
LIMIT 1`)
|
|
24
|
+
.get(projectId);
|
|
25
|
+
if (held === undefined)
|
|
26
|
+
return { kind: "untouched" };
|
|
27
|
+
const view = getRevisionView(deps, projectId, head);
|
|
28
|
+
if (view === undefined)
|
|
29
|
+
return { kind: "untouched" };
|
|
30
|
+
const catalogue = deps.catalogue.read();
|
|
31
|
+
const selection = resumeSelection(retainedPreviewPlan(deps, view, catalogue), stagesOf(deps.db, projectId));
|
|
32
|
+
const planned = planPreview(deps, view, catalogue, selection, deps.ids.next());
|
|
33
|
+
if (!planned.ok)
|
|
34
|
+
return {
|
|
35
|
+
kind: "refused",
|
|
36
|
+
sentence: `This run took the video made ahead but couldn't continue it, because what is left to make couldn't be worked out. ${fix}`,
|
|
37
|
+
};
|
|
38
|
+
const { execution } = planned.value;
|
|
39
|
+
const reused = new Set(execution.dispositions.filter((row) => row.disposition === "reuse").map((row) => row.key));
|
|
40
|
+
// Admitted already: reserved on this version under the same starting point and not finished,
|
|
41
|
+
// which is the step admission lets go again rather than makes anew (`admission-repo.ts`).
|
|
42
|
+
const admitted = (key, fingerprint) => deps.db
|
|
43
|
+
.prepare(`SELECT 1 FROM revision_work_reservations r JOIN revision_work w ON w.id=r.work_id
|
|
44
|
+
WHERE r.revision_id=? AND r.work_key=? AND r.fingerprint=? AND w.state!='done'
|
|
45
|
+
AND w.recipe_context IS NOT NULL`)
|
|
46
|
+
.get(head, key, fingerprint) !== undefined;
|
|
47
|
+
const unstarted = execution.recipes.filter((recipe) => recipe.kind === "provider" &&
|
|
48
|
+
!reused.has(recipe.key) &&
|
|
49
|
+
!admitted(recipe.key, recipe.fingerprint));
|
|
50
|
+
if (unstarted.length > 0)
|
|
51
|
+
return {
|
|
52
|
+
kind: "refused",
|
|
53
|
+
sentence: `This run took the video made ahead but didn't continue it, because settings saved on it since need new paid steps that were never started (${String(unstarted.length)}). ${fix}`,
|
|
54
|
+
};
|
|
55
|
+
const result = await recoverProject(deps, projectId, {
|
|
56
|
+
baseRevisionId: head,
|
|
57
|
+
idempotencyKey: randomUUID(),
|
|
58
|
+
action: { kind: "resume" },
|
|
59
|
+
});
|
|
60
|
+
if (result.ok)
|
|
61
|
+
return { kind: "continued" };
|
|
62
|
+
const detail = result.reason === "readiness" && result.fields !== undefined && result.fields.length > 0
|
|
63
|
+
? result.fields.map((field) => field.message).join(" ")
|
|
64
|
+
: `Slopify refused to continue it (${result.reason}).`;
|
|
65
|
+
return {
|
|
66
|
+
kind: "refused",
|
|
67
|
+
sentence: `This run took the video made ahead but couldn't continue it. ${detail} ${fix}`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { projectPaused, stagesOf } from "../admission/repo.js";
|
|
3
|
+
import { projectHolds } from "../reviews/holds.js";
|
|
4
|
+
import { heldForItsDay } from "./prepare.js";
|
|
5
|
+
import { projectIsActive } from "./repo.js";
|
|
6
|
+
const row = z.object({
|
|
7
|
+
schedule_id: z.string(),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
project_id: z.string(),
|
|
10
|
+
title: z.string(),
|
|
11
|
+
});
|
|
12
|
+
// Oldest run first. A schedule deleted holds nothing back.
|
|
13
|
+
export function heldBack(db, scheduleId) {
|
|
14
|
+
const rows = db
|
|
15
|
+
.prepare(`SELECT r.schedule_id, s.name, admitted.value AS project_id, p.title
|
|
16
|
+
FROM schedule_runs r, json_each(r.project_ids_json) AS admitted
|
|
17
|
+
JOIN schedules s ON s.id=r.schedule_id AND s.deleted_at IS NULL
|
|
18
|
+
JOIN projects p ON p.id=admitted.value
|
|
19
|
+
WHERE r.projects_settled_at IS NULL AND r.status!='running'
|
|
20
|
+
AND (?1 IS NULL OR r.schedule_id=?1)
|
|
21
|
+
ORDER BY r.scheduled_for, r.started_at, r.id`)
|
|
22
|
+
.all(scheduleId ?? null)
|
|
23
|
+
.map((value) => row.parse(value));
|
|
24
|
+
return rows
|
|
25
|
+
.filter((one) => projectIsActive(db, one.project_id))
|
|
26
|
+
.map((one) => ({
|
|
27
|
+
scheduleId: one.schedule_id,
|
|
28
|
+
scheduleName: one.name,
|
|
29
|
+
projectId: one.project_id,
|
|
30
|
+
title: one.title,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
const generic = "Skipped because the previous run of this schedule was still going.";
|
|
34
|
+
// Why a run was skipped for overlap, naming the earlier run's video when nothing but the
|
|
35
|
+
// person moves it on: what stops it, and the button that fixes it.
|
|
36
|
+
export function overlapSentence(db, scheduleId) {
|
|
37
|
+
const first = heldBack(db, scheduleId)[0];
|
|
38
|
+
if (first === undefined)
|
|
39
|
+
return generic;
|
|
40
|
+
const video = `the video of an earlier run, “${first.title}”,`;
|
|
41
|
+
const after = "; this schedule's runs go ahead again once it finishes.";
|
|
42
|
+
if (projectPaused(db, first.projectId))
|
|
43
|
+
return `Skipped because ${video} is paused. Open it in Projects and press Continue the run${after}`;
|
|
44
|
+
const failed = stagesOf(db, first.projectId).find((stage) => stage.state === "failed");
|
|
45
|
+
if (failed !== undefined)
|
|
46
|
+
return `Skipped because ${video} has a failed ${failed.kind} step. Open it in Projects and press Try again on that step${after}`;
|
|
47
|
+
const holds = projectHolds(db, { projectId: first.projectId });
|
|
48
|
+
if (holds.stopped.has(first.projectId))
|
|
49
|
+
return `Skipped because ${video} stopped before it finished, as a restart leaves a run. Open it in Projects and press Continue the run${after}`;
|
|
50
|
+
// Any checkpoint of the person's left to approve, reached or not: the video can't be made
|
|
51
|
+
// until it is (one whose inputs are still being made holds nothing yet, `holds.ts`).
|
|
52
|
+
const review = db
|
|
53
|
+
.prepare(`SELECT c.stage FROM review_checkpoints c
|
|
54
|
+
JOIN project_heads h ON h.project_id=c.project_id AND h.revision_id=c.revision_id
|
|
55
|
+
WHERE c.project_id=? AND c.state IN ('held','pending-review') AND c.approved_at IS NULL
|
|
56
|
+
AND NOT (c.stage='video' AND ${heldForItsDay("c")})
|
|
57
|
+
ORDER BY c.created_at LIMIT 1`)
|
|
58
|
+
.get(first.projectId);
|
|
59
|
+
if (typeof review?.stage === "string")
|
|
60
|
+
return `Skipped because ${video} waits for your review before its ${review.stage} step. Open it in Projects and approve it${after}`;
|
|
61
|
+
return generic;
|
|
62
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { errorText } from "../../kernel/errors.js";
|
|
1
2
|
import { derive } from "../../kernel/runner/graph.js";
|
|
2
3
|
import { projectPaused, stagesOf } from "../admission/repo.js";
|
|
3
4
|
import { render } from "../admission/substitute.js";
|
|
@@ -141,8 +142,13 @@ export function preparedProject(db, scheduleId, title, byTitle = true) {
|
|
|
141
142
|
}
|
|
142
143
|
// The scheduled day for a prepared video: its own Before Video hold is taken away, so the
|
|
143
144
|
// video renders as soon as what it needs is done. A Before Video checkpoint the template had
|
|
144
|
-
// stays for the person to approve.
|
|
145
|
-
|
|
145
|
+
// stays for the person to approve. The day is the go-ahead for a video made ahead: one a restart
|
|
146
|
+
// stopped goes on as Continue the run would take it on (`continueHeldRun`), never past a Pause
|
|
147
|
+
// or a person's checkpoint. What it couldn't continue is said in a sentence for the run.
|
|
148
|
+
export async function continuePrepared(deps, prepared) {
|
|
149
|
+
const madeAhead = deps.db
|
|
150
|
+
.prepare("SELECT 1 FROM prepared_videos WHERE project_id=? LIMIT 1")
|
|
151
|
+
.get(prepared.projectId) !== undefined;
|
|
146
152
|
if (prepared.release) {
|
|
147
153
|
const head = currentRevisionId(deps.db, prepared.projectId);
|
|
148
154
|
if (head !== undefined) {
|
|
@@ -154,7 +160,29 @@ export function continuePrepared(deps, prepared) {
|
|
|
154
160
|
}
|
|
155
161
|
// Continued once: the topic is used, and the project is now the run's.
|
|
156
162
|
deps.db.prepare("DELETE FROM prepared_videos WHERE project_id=?").run(prepared.projectId);
|
|
163
|
+
let sentence;
|
|
164
|
+
if (madeAhead && deps.continueRun !== undefined) {
|
|
165
|
+
try {
|
|
166
|
+
const outcome = await deps.continueRun(prepared.projectId);
|
|
167
|
+
if (outcome.kind === "refused")
|
|
168
|
+
sentence = outcome.sentence;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
deps.log.write("error", "schedule.continue", {
|
|
172
|
+
projectId: prepared.projectId,
|
|
173
|
+
detail: errorText(error),
|
|
174
|
+
});
|
|
175
|
+
sentence =
|
|
176
|
+
"This run took the video made ahead but couldn't continue it, because Slopify hit an internal error. Open it in Projects and press Continue the run.";
|
|
177
|
+
}
|
|
178
|
+
if (sentence !== undefined)
|
|
179
|
+
deps.log.write("warn", "schedule.continue", {
|
|
180
|
+
projectId: prepared.projectId,
|
|
181
|
+
detail: sentence,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
157
184
|
deps.runner.tick(prepared.projectId);
|
|
185
|
+
return sentence;
|
|
158
186
|
}
|
|
159
187
|
// Which of a schedule's topics are prepared, and their projects, for the topic list.
|
|
160
188
|
export function preparedTopics(deps, scheduleId) {
|
|
@@ -251,7 +251,7 @@ export function settleTerminalScheduleRuns(db, settledAt) {
|
|
|
251
251
|
return settled;
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
function projectIsActive(db, projectId) {
|
|
254
|
+
export function projectIsActive(db, projectId) {
|
|
255
255
|
// A project in the trash takes no part in a schedule's overlap: it cannot run there.
|
|
256
256
|
if (!projectExists(db, projectId))
|
|
257
257
|
return false;
|
|
@@ -4,6 +4,7 @@ import { createDraft } from "../play-drafts/service.js";
|
|
|
4
4
|
import { startPlayDraft } from "../play-drafts/start.js";
|
|
5
5
|
import { nextOccurrence } from "./calendar.js";
|
|
6
6
|
import { claimDesignRun } from "./design-run.js";
|
|
7
|
+
import { overlapSentence } from "./held-back.js";
|
|
7
8
|
import { missedGraceMs } from "./next-run.js";
|
|
8
9
|
import { continuePrepared, preparedProject, scheduledDocument, scheduledTitle } from "./prepare.js";
|
|
9
10
|
import { activeRun, dueSchedules, insertRun, recordRunDispatch, recordRunStartIdentity, recoverRunningRuns, scheduleById, scheduleRows, updateRun, } from "./repo.js";
|
|
@@ -117,7 +118,7 @@ function claim(deps, schedule, now) {
|
|
|
117
118
|
endedAt: skip ? now.toISOString() : null,
|
|
118
119
|
error: skip
|
|
119
120
|
? overlapping
|
|
120
|
-
?
|
|
121
|
+
? overlapSentence(deps.db, schedule.id)
|
|
121
122
|
: occurrence
|
|
122
123
|
? "Skipped because Slopify was not running at the scheduled time."
|
|
123
124
|
: (noTopic ?? notReady)
|
|
@@ -151,10 +152,15 @@ async function execute(deps, claimed) {
|
|
|
151
152
|
// than make the same video twice.
|
|
152
153
|
const prepared = preparedProject(deps.db, claimed.schedule.id, scheduledTitle(fresh), topic !== undefined);
|
|
153
154
|
if (prepared !== undefined) {
|
|
154
|
-
continuePrepared(deps, prepared);
|
|
155
155
|
run = { ...run, projectIds: [prepared.projectId] };
|
|
156
156
|
recordRunDispatch(deps.db, run, deps.clock.now().toISOString(), topic);
|
|
157
|
-
|
|
157
|
+
const stuck = await continuePrepared(deps, prepared);
|
|
158
|
+
updateRun(deps.db, {
|
|
159
|
+
...run,
|
|
160
|
+
status: "succeeded",
|
|
161
|
+
endedAt: deps.clock.now().toISOString(),
|
|
162
|
+
...(stuck === undefined ? {} : { error: stuck }),
|
|
163
|
+
});
|
|
158
164
|
return;
|
|
159
165
|
}
|
|
160
166
|
const draft = createDraft(deps, { id: deps.uuid(), document: fresh });
|