@gentbajko/slopify 4.5.1 → 4.5.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.
Files changed (54) hide show
  1. package/dist/edge/mcp/tools-runs.js +1 -1
  2. package/dist/extension/slopify-studio-chrome.zip +0 -0
  3. package/dist/extension/slopify-studio-firefox.zip +0 -0
  4. package/dist/kernel/db/migrations/0079-plan-history-indexes.sql +11 -0
  5. package/dist/kernel/db/migrations/0080-attempts-work-index.sql +4 -0
  6. package/dist/kernel/runner/providers.js +1 -1
  7. package/dist/kernel/runner/queue.js +31 -5
  8. package/dist/kernel/runner/work.js +52 -1
  9. package/dist/main.js +1 -1
  10. package/dist/patch-notes/4.5.2.md +17 -0
  11. package/dist/patch-notes/4.5.3.md +16 -0
  12. package/dist/patch-notes/index.json +12 -0
  13. package/dist/slices/article/production-note.js +75 -0
  14. package/dist/slices/loudness/level-pieces.js +12 -8
  15. package/dist/slices/loudness/sentence-level.js +35 -24
  16. package/dist/slices/narration/breaths-worker.js +126 -0
  17. package/dist/slices/narration/breaths.js +19 -81
  18. package/dist/slices/narration/clean-pieces.js +9 -10
  19. package/dist/slices/narration/pauses.js +18 -17
  20. package/dist/slices/narration/piece-jobs.js +54 -0
  21. package/dist/slices/narration/pronunciation.js +48 -3
  22. package/dist/slices/rebuild/admission-repo.js +14 -1
  23. package/dist/slices/rebuild/narration-history.js +72 -23
  24. package/dist/slices/rebuild/narration-reuse.js +16 -5
  25. package/dist/slices/rebuild/provided-review.js +14 -4
  26. package/dist/slices/rebuild/recipe-audio.js +6 -0
  27. package/dist/slices/rebuild/recipe-build.js +6 -2
  28. package/dist/slices/rebuild/recipe-document.js +23 -17
  29. package/dist/slices/rebuild/recipe-exports.js +8 -1
  30. package/dist/slices/rebuild/recipe-model.js +48 -4
  31. package/dist/slices/rebuild/recipe-preparation.js +28 -6
  32. package/dist/slices/rebuild/recipe-reviews.js +28 -24
  33. package/dist/slices/rebuild/recipe-save.js +16 -3
  34. package/dist/slices/rebuild/recipe-shorts.js +195 -8
  35. package/dist/slices/rebuild/recovery.js +35 -2
  36. package/dist/slices/rebuild/review-redo.js +15 -7
  37. package/dist/slices/rebuild/runtime-admission.js +5 -0
  38. package/dist/slices/rebuild/runtime-agent-review.js +4 -2
  39. package/dist/slices/rebuild/runtime-materialize.js +14 -0
  40. package/dist/slices/rebuild/runtime-plan.js +86 -40
  41. package/dist/slices/rebuild/runtime-provider.js +11 -4
  42. package/dist/slices/rebuild/runtime-review.js +3 -2
  43. package/dist/slices/rebuild/runtime-shorts.js +53 -13
  44. package/dist/slices/rebuild/transition-repo.js +13 -10
  45. package/dist/slices/reviews/outcome.js +5 -3
  46. package/dist/slices/reviews/repo.js +12 -0
  47. package/dist/slices/revisions/schema.js +1 -0
  48. package/dist/slices/revisions/view.js +3 -3
  49. package/dist/slices/settings/model.js +6 -2
  50. package/dist/slices/shorts/keep.js +37 -17
  51. package/dist/slices/storage/layout.js +15 -0
  52. package/dist/web/assets/{index-C0n0zeuZ.js → index-C8aMp7m3.js} +2 -2
  53. package/dist/web/index.html +1 -1
  54. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- import { editSettings } from "../../kernel/ports/settings-places.js";
2
1
  import { clipBounds } from "./pick.js";
3
2
  // Shorts kept through a change of their moments: a count raised or lowered, a new intro or a
4
3
  // narration edit that moves the timing. A kept short is remembered by its sentences' text, so
@@ -21,6 +20,10 @@ export function keptOf(clip, sentences) {
21
20
  hashtags: clip.hashtags,
22
21
  why: clip.why,
23
22
  ...(clip.seed === undefined ? {} : { seed: clip.seed }),
23
+ text: sentences
24
+ .slice(clip.first - 1, clip.last)
25
+ .map((sentence) => sentence.text)
26
+ .join(" "),
24
27
  };
25
28
  }
26
29
  const same = (left, right) => left.replace(/\s+/g, " ").trim() === right.replace(/\s+/g, " ").trim();
@@ -41,6 +44,12 @@ export function anchorKept(kept, sentences, durationSeconds) {
41
44
  continue;
42
45
  if (!same(opening.text, short.opening) || !same(closing.text, short.closing))
43
46
  continue;
47
+ const text = sentences
48
+ .slice(first - 1, last)
49
+ .map((sentence) => sentence.text)
50
+ .join(" ");
51
+ if (short.text !== undefined && !same(text, short.text))
52
+ continue;
44
53
  if (taken(first, last))
45
54
  continue;
46
55
  const bounds = clipBounds(sentences, first, last, durationSeconds);
@@ -56,10 +65,7 @@ export function anchorKept(kept, sentences, durationSeconds) {
56
65
  description: short.description,
57
66
  hashtags: short.hashtags,
58
67
  why: short.why,
59
- text: sentences
60
- .slice(first - 1, last)
61
- .map((sentence) => sentence.text)
62
- .join(" "),
68
+ text,
63
69
  ...(short.seed === undefined ? {} : { seed: short.seed }),
64
70
  };
65
71
  }
@@ -70,23 +76,37 @@ export function anchorKept(kept, sentences, durationSeconds) {
70
76
  }
71
77
  return { picks, lost };
72
78
  }
73
- // The kept shorts and the new ones together: kept 1…k, then the new ones as k+1… in the order
79
+ // The kept shorts and the new ones together: each kept short keeps its number; the new ones
80
+ // take the free numbers (a kept short's whose words changed first, then k+1…) in the order
74
81
  // they play, carrying `seed` (the pick's token).
75
82
  export function withNewPicks(kept, fresh, seed) {
83
+ const taken = new Set(kept.map((one) => one.number));
84
+ const free = Array.from({ length: kept.length + fresh.length }, (_value, at) => at + 1).filter((number) => !taken.has(number));
76
85
  return [
77
86
  ...kept,
78
87
  ...fresh
79
88
  .toSorted((left, right) => left.start - right.start)
80
- .map((pick, index) => ({ ...pick, number: kept.length + index + 1, seed })),
81
- ];
89
+ .map((pick, index) => ({ ...pick, number: free[index] ?? taken.size + index + 1, seed })),
90
+ ].toSorted((left, right) => left.number - right.number);
82
91
  }
83
- // Why the pick can't go on: kept shorts whose sentences changed in the narration.
84
- export function lostMessage(lost, kept) {
85
- const names = lost
86
- .map((at) => {
87
- const short = kept[at - 1];
88
- return short === undefined ? `short ${String(at)}` : `short ${String(at)} ("${short.title}")`;
89
- })
90
- .join(", ");
91
- return `The narration of ${names} changed, so its moment can't be kept. Untick it under Keep finished shorts in ${editSettings.shorts}, so a new moment is picked for it, save, then use Choose what to make again (in the project's More menu).`;
92
+ // Where a clip's sentences are in the narration as it is now: at the same numbers when they
93
+ // still say the same, else wherever the same run of sentences is found once. Undefined when
94
+ // its words are not in the narration any more.
95
+ export function locateClip(sentences, clip, durationSeconds) {
96
+ const count = clip.last - clip.first + 1;
97
+ const says = (first) => same(sentences
98
+ .slice(first - 1, first - 1 + count)
99
+ .map((sentence) => sentence.text)
100
+ .join(" "), clip.text);
101
+ const at = (first) => {
102
+ const bounds = clipBounds(sentences, first, first + count - 1, durationSeconds);
103
+ return bounds === undefined ? undefined : { first, last: first + count - 1, ...bounds };
104
+ };
105
+ if (count >= 1 && clip.last <= sentences.length && says(clip.first))
106
+ return at(clip.first);
107
+ const found = [];
108
+ for (let first = 1; first + count - 1 <= sentences.length; first++)
109
+ if (says(first))
110
+ found.push(first);
111
+ return found.length === 1 && found[0] !== undefined ? at(found[0]) : undefined;
92
112
  }
@@ -23,6 +23,21 @@ export function outputPath(paths, projectId, relativePath) {
23
23
  return contained(projectDir(paths, projectId), relativePath);
24
24
  return contained(projectDir(paths, projectId), paths.places?.placeOf(projectId, relativePath) ?? relativePath);
25
25
  }
26
+ // The same for many of one project's stored paths at once: whether it is a studio sample and
27
+ // where its folder is are looked up once, not for every file (each is a database read and a
28
+ // look on disk). For use within one synchronous pass; a later pass asks again.
29
+ export function outputPaths(paths, projectId) {
30
+ let folder;
31
+ return (relativePath) => {
32
+ folder ??= {
33
+ sample: paths.samples?.has(projectId) === true,
34
+ dir: projectDir(paths, projectId),
35
+ };
36
+ return contained(folder.dir, folder.sample
37
+ ? relativePath
38
+ : (paths.places?.placeOf(projectId, relativePath) ?? relativePath));
39
+ };
40
+ }
26
41
  // Scheduled backups (slices/backups) land in paths.backups unless the user picks another
27
42
  // folder. Installs from before 3.0 keep it inside the projects root, since that is the one
28
43
  // folder an older Docker install shares with the host; newer ones have it beside Projects.