@gentbajko/slopify 3.0.7 → 3.0.9
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/edge/autostart/native.js +12 -3
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/kernel/db/migrations/0042-narration-retries.sql +13 -0
- package/dist/main.js +14 -19
- package/dist/patch-notes/3.0.8.md +23 -0
- package/dist/patch-notes/3.0.9.md +27 -0
- package/dist/patch-notes/index.json +12 -0
- package/dist/slices/admission/rules.js +71 -2
- package/dist/slices/admission/schema.js +2 -0
- package/dist/slices/admission/substitute.js +5 -2
- package/dist/slices/estimate/index.js +3 -0
- package/dist/slices/images/scenes.js +103 -0
- package/dist/slices/play-drafts/convert.js +5 -1
- package/dist/slices/play-drafts/schema.js +2 -0
- package/dist/slices/project-templates/from-project.js +1 -0
- package/dist/slices/rebuild/narration-retry.js +128 -0
- package/dist/slices/rebuild/preview-details.js +3 -1
- package/dist/slices/rebuild/recipe-build.js +5 -1
- package/dist/slices/rebuild/recipe-model.js +3 -0
- package/dist/slices/rebuild/recipe-provider-choice.js +3 -1
- package/dist/slices/rebuild/recipe-save.js +3 -2
- package/dist/slices/rebuild/recipe-scenes.js +61 -0
- package/dist/slices/rebuild/recipe-text.js +4 -3
- package/dist/slices/rebuild/recipe-validation.js +3 -2
- package/dist/slices/rebuild/recipe-visual.js +46 -2
- package/dist/slices/rebuild/recipe-work.js +18 -0
- package/dist/slices/rebuild/recovery-selection.js +7 -0
- package/dist/slices/rebuild/runtime-document.js +1 -1
- package/dist/slices/rebuild/runtime-piece-label.js +2 -0
- package/dist/slices/rebuild/runtime-plan.js +1 -1
- package/dist/slices/rebuild/runtime-provider.js +16 -0
- package/dist/slices/rebuild/runtime-subtitles.js +53 -11
- package/dist/slices/revisions/mutation-prepare.js +1 -1
- package/dist/slices/revisions/view.js +3 -1
- package/dist/slices/storage/backup-format.js +1 -0
- package/dist/tutorials/Play-Images.md +16 -0
- package/dist/tutorials/Play-Title-and-Article.md +1 -0
- package/dist/updater/service.js +13 -2
- package/dist/updater/work-in-progress.js +59 -0
- package/dist/web/assets/{index-Cdb0Jh3P.js → index-CIXw6vpi.js} +115 -115
- package/dist/web/assets/{pdf-BhFuoBjr.js → pdf-B9CdIc1m.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { derive } from "../kernel/runner/graph.js";
|
|
2
|
+
import { projectPaused, stagesOf } from "../slices/admission/repo.js";
|
|
3
|
+
// A scheduled run this close is treated as running: a restart then could land on its time,
|
|
4
|
+
// and a schedule that skips missed runs would skip it.
|
|
5
|
+
export const scheduledSoonMs = 10 * 60_000;
|
|
6
|
+
// What an update must wait for, named for "installs when … finishes"; undefined when nothing
|
|
7
|
+
// is. An update never installs while a job is going: a step running or about to run, a step
|
|
8
|
+
// waiting to try again, a batch with videos still to make, a narration chunk about to be
|
|
9
|
+
// recorded again, a schedule writing topics or due to start a run.
|
|
10
|
+
export function workInProgress(db, inflight, now) {
|
|
11
|
+
const projects = db
|
|
12
|
+
.prepare("SELECT id, title FROM projects WHERE id NOT IN (SELECT project_id FROM project_trash)")
|
|
13
|
+
.all()
|
|
14
|
+
.flatMap((row) => typeof row.id === "string" && typeof row.title === "string"
|
|
15
|
+
? [{ id: row.id, title: row.title }]
|
|
16
|
+
: []);
|
|
17
|
+
for (const project of projects) {
|
|
18
|
+
if (inflight(project.id))
|
|
19
|
+
return project.title;
|
|
20
|
+
if (projectPaused(db, project.id))
|
|
21
|
+
continue;
|
|
22
|
+
// Running, or waiting to try a step again (`derive`); or between two steps, with work
|
|
23
|
+
// admitted and free to start. Work held for a person (a review checkpoint) doesn't count.
|
|
24
|
+
const state = derive(stagesOf(db, project.id));
|
|
25
|
+
if (state === "running")
|
|
26
|
+
return project.title;
|
|
27
|
+
if (state === "pending" &&
|
|
28
|
+
db
|
|
29
|
+
.prepare("SELECT 1 FROM revision_work WHERE project_id=? AND state IN ('pending','running') AND dispatch_state='allowed' LIMIT 1")
|
|
30
|
+
.get(project.id) !== undefined)
|
|
31
|
+
return project.title;
|
|
32
|
+
}
|
|
33
|
+
const queued = db
|
|
34
|
+
.prepare(`SELECT p.title FROM project_queue q JOIN projects p ON p.id=q.project_id
|
|
35
|
+
WHERE q.state IN ('queued','active')
|
|
36
|
+
AND q.project_id NOT IN (SELECT project_id FROM project_trash)
|
|
37
|
+
AND q.project_id NOT IN (SELECT project_id FROM project_controls WHERE paused=1)
|
|
38
|
+
LIMIT 1`)
|
|
39
|
+
.get();
|
|
40
|
+
if (typeof queued?.title === "string")
|
|
41
|
+
return queued.title;
|
|
42
|
+
const retry = db
|
|
43
|
+
.prepare(`SELECT p.title FROM narration_retries r JOIN projects p ON p.id=r.project_id
|
|
44
|
+
WHERE r.state='pending' LIMIT 1`)
|
|
45
|
+
.get();
|
|
46
|
+
if (typeof retry?.title === "string")
|
|
47
|
+
return retry.title;
|
|
48
|
+
const schedule = db
|
|
49
|
+
.prepare(`SELECT name FROM schedules WHERE deleted_at IS NULL AND (
|
|
50
|
+
(status='active' AND next_run_at IS NOT NULL AND next_run_at <= ?)
|
|
51
|
+
OR (topics_generating_at IS NOT NULL
|
|
52
|
+
AND (topics_generated_at IS NULL OR topics_generated_at < topics_generating_at)
|
|
53
|
+
AND (topics_failed_at IS NULL OR topics_failed_at < topics_generating_at))
|
|
54
|
+
) LIMIT 1`)
|
|
55
|
+
.get(new Date(now + scheduledSoonMs).toISOString());
|
|
56
|
+
if (typeof schedule?.name === "string")
|
|
57
|
+
return schedule.name;
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|