@aicopycoders/exodus 2026.11.1200-beta.14 → 2026.11.1200-beta.16

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.
@@ -362,10 +362,15 @@ the run started:
362
362
 
363
363
  - **The app makes the cut** of a swiped video, a video from the dashboard's
364
364
  Video page and a beta tester's run, once every clip is made and no scene is
365
- held. On a run started with `--one-shot` that cut is delivered by itself,
365
+ held. While it makes it, `status` on an admin key says "Every piece is
366
+ made. The app makes the cut now; look again in a minute: exodus video
367
+ status <runId>": make no cut of your own, and read `status` again in a
368
+ minute. `exodus video wait <runId>` waits through it. On a run started with `--one-shot` that cut is delivered by itself,
366
369
  with no approve: on an admin key `status` then says "Final cut: approved
367
370
  and delivered.", and on a beta tester's key "Your video is ready: <link>".
368
- Only when the app's check of the finished film against its own sound fails
371
+ In the minute between the cut and the delivery, `status` on an admin key
372
+ says "Final cut: made. This run delivers it by itself; look again in a
373
+ minute.": read it again then, and send no approve. Only when the app's check of the finished film against its own sound fails
369
374
  (One-take UGC checks it) does a One-shot cut wait instead, as a Guided one
370
375
  does, with the check's sentences under it in `status`. The member's last say is before that: the One-shot yes, and the yes to keep
371
376
  the last held take, since that keep starts the cut. Say so at each. Give
@@ -388,14 +393,18 @@ it): ask approve, a new run that films every take again at its full price
388
393
  (for a swiped video, `exodus video swipe start <swipeId> --again`, its price
389
394
  first), or stop here.
390
395
 
391
- On an admin key, `pull` writes the pieces only, never the finished video,
392
- even once the app has made and delivered it: give the member the run page to
393
- watch it. On a beta tester's key, `pull` also writes `video.<ext>` once the
394
- finished video is ready.
396
+ `pull` also writes the finished video as `video.<ext>` once the run has one,
397
+ on an admin key as on a beta tester's. On a delivered run it ends "This run
398
+ is delivered. The finished video is <file>.": give the member that file and
399
+ the run page to watch it. On a run the app cuts, once every piece is made
400
+ and until it is delivered, it ends with no upload line: make no cut of your
401
+ own, unless `status` says the app's cut didn't work and offers you to cut it
402
+ yourself, and the member says yes.
395
403
 
396
404
  - Approve: `exodus video approve <runId>` makes the cut the ad. It is one-way.
397
- - Redo a clip: `retry-clip` as at stop 4, after their yes. Then pull, cut
398
- and upload again.
405
+ - Redo a clip: `retry-clip` as at stop 4, after their yes. On a run the app
406
+ cuts, it cuts again by itself (read `status`); on any other, pull, cut and
407
+ upload again.
399
408
 
400
409
  **On the song format**, tell the member this before they approve: "The song
401
410
  made here is for review. Before this video runs as a paid ad, make the same
@@ -694,9 +703,9 @@ The rows:
694
703
  "ugc-one-take" in the sheet before its next run.": set it only on their yes,
695
704
  and say that the next run writes that ad again, which is paid. On an ad it
696
705
  can't be made from, the write refuses it and says why. It buys a face photo,
697
- a picture of the room, a cut-out of the product and one take for each 15 or
698
- 25 seconds of script, on the member's Kie key, and text calls on their model
699
- key; it needs their ElevenLabs key and their Kie key. Its price is the
706
+ a picture of the room, a cut-out of the product, a picture of an animal when
707
+ the script puts one in the picture, and one take for each 15 or 25 seconds of
708
+ script, on the member's Kie key, and text calls on their model key; it needs their ElevenLabs key and their Kie key. Its price is the
700
709
  server's estimate, known once the swipe is written: `exodus video swipe
701
710
  sheet price <swipeId>` (free) prints it at 720p or a 480p draft, the whole
702
711
  video or the first take only, each with the most it can cost. The "about"
@@ -711,10 +720,11 @@ The rows:
711
720
  - **The saved sheet** (a kind that has one; One-take UGC today). The server
712
721
  keeps one for each swipe of such a kind, made after its write. For such a
713
722
  video this sheet's yes covers the write and its people only, and **It
714
- buys:** says so: "<n> scripts now, each with <k> people to pick from (at
715
- most $<most> for each script's people); each video after your yes on its
716
- saved sheet", with the people's part only when the dry write printed their
717
- price (People, below). The saved sheet and its yes come in step 4.
723
+ buys:** says so: "<n> scripts now, each with <k> people to pick from and
724
+ the animal when its script puts one in the picture (at most $<most> for each
725
+ script's people and animal); each video after your yes on its saved sheet",
726
+ with the people's part only when the dry write printed their price (People,
727
+ below). The saved sheet and its yes come in step 4.
718
728
  - **People** (a kind whose write can make them: One-take UGC, when the
719
729
  server offers people to pick from). Before you
720
730
  send the sheet, run that video's write line (step 4) without `--yes`: it
@@ -723,7 +733,14 @@ The rows:
723
733
  ("About $… for new people: …" and "At most $… in all: …") and the line to
724
734
  run: "On their yes, run the same command with --yes --people-max-usd
725
735
  <most>". Put that most on the sheet, as above: the sheet's yes is the yes to
726
- it. When the member gave a money limit and the people's most, added over
736
+ it. The same price names the animal: "A picture of the animal, if the
737
+ script puts one in the picture: $…". With that yes, the write also reads the
738
+ stored script for an animal it puts in the picture (the dog in a dog
739
+ product's ad) and draws one picture of it with the people, inside the same
740
+ most. The saved sheet shows it on the row "The animal", with its picture;
741
+ `exodus video swipe sheet set <swipeId> animal=none` takes it out of the
742
+ video (free). With no animal in the script the row says "No animal in the
743
+ script." and no picture is paid for. When the member gave a money limit and the people's most, added over
727
744
  every video on the sheet, is already over it, say so on the sheet and ask:
728
745
  no write goes out until what it can cost fits. When it prints no people's
729
746
  price, the write makes none. When the member
@@ -955,7 +972,10 @@ every video has started:
955
972
  write: its yes carried no --people-max-usd. See their price (free): …".
956
973
  With the figure, the write waits for the people (a line ending "Waiting for
957
974
  them, up to 5 minutes."), then prints how their ask ended and each person
958
- with their picture's address. Show each person's name and picture. Read the
975
+ with their picture's address. The animal, when the script puts one in the
976
+ picture, is on the saved sheet's row "The animal" a few minutes later
977
+ (`exodus video swipe sheet <swipeId>` shows it with its picture's address);
978
+ a start waits for it while it is still being made. Show each person's name and picture. Read the
959
979
  write's own lines; never assume one is recommended. When the ask names one
960
980
  ("Person N is recommended." and why), the write says "A start with no pick
961
981
  films person N, the recommended one." When it names none, it says "… films
@@ -1003,9 +1023,9 @@ every video has started:
1003
1023
  <runId>` and do what it prints. The app makes a swiped video's cut ("End:
1004
1024
  watch and approve"), so make no cut of your own. A one-shot run is
1005
1025
  delivered by itself once that cut is made: give the member its run page.
1006
- While the app makes it, `status` may still say "Parked: every piece is
1007
- made and the run is waiting for a cut." for a short while: read `status`
1008
- again before anything else. A run that stopped at the storyboard goes to
1026
+ While the app makes it, `status` says "Every piece is made. The app makes
1027
+ the cut now; look again in a minute: exodus video status <runId>": read
1028
+ `status` again in a minute. A run that stopped at the storyboard goes to
1009
1029
  stop 3, then the end.
1010
1030
 
1011
1031
  **Never start the same swipe twice.** One swipe is one video. A start of a
@@ -1648,7 +1668,10 @@ under it:
1648
1668
  `retry-frame --note` before `retry-clip`; the clip redo alone resends the
1649
1669
  refused picture. On a video the app cuts itself (one started from the
1650
1670
  dashboard, a swiped video, a beta tester's run: "End: watch and approve"),
1651
- the app makes the cut; when a scene's clip still has a drawing fault after it was made
1671
+ the app makes the cut. While it makes it, the stop block says "Every piece
1672
+ is made. The app makes the cut now; look again in a minute: exodus video
1673
+ status <runId>" and names no pull, upload or `retry-clip`: read `status`
1674
+ again in a minute. When a scene's clip still has a drawing fault after it was made
1652
1675
  again, the stop block says `Held:` and names the scene
1653
1676
  (`stop.heldScenes` in `--json`). No cut is made until each held scene is
1654
1677
  made again with `retry-clip`, or kept as it is with `exodus video keep
@@ -1657,7 +1680,8 @@ under it:
1657
1680
  A One-take take held for its words, for a picture that came out turned on
1658
1681
  its side or upside down, or for a product label that came out backwards and
1659
1682
  could not be fixed, is named under `Held:` with its own
1660
- sentence, every reason it was held for (`stop.heldTakes` in `--json`). It
1683
+ sentence, every reason it was held for (`stop.heldTakes` in `--json`), from
1684
+ the moment the take is made. It
1661
1685
  cannot be made again on its own, so no `retry-clip` is offered. Show the user the sentence
1662
1686
  and ask them to watch the take. With their yes, `exodus video keep <runId>
1663
1687
  --scene <n>` keeps it as it is: it orders nothing, and keeping the last held
@@ -2318,8 +2342,10 @@ length. Do not invent a number.
2318
2342
  `pull` writes a flat folder and a `manifest.json` that indexes it. The manifest
2319
2343
  is the data you decide from; the filenames are its values. Scene numbers are the
2320
2344
  run's own. Every `pull` re-downloads and overwrites every file, so running it
2321
- again is always safe. It never writes the finished video the app made ("End:
2322
- watch and approve").
2345
+ again is always safe. Once the run has a finished video, it writes that too,
2346
+ as `video.<ext>` ("End: watch and approve"), except while the app makes the
2347
+ cut again after a redo: the one on the run then is about to be replaced. When
2348
+ a different `video.<ext>` was already in the folder, it says it replaced it.
2323
2349
 
2324
2350
  ```
2325
2351
  storyboard.json the whole storyboard envelope (see below)
@@ -2334,6 +2360,7 @@ narration.mp3 one continuous narrator take of the whole script
2334
2360
  narration.json that take's settings, master-timeline words, and the
2335
2361
  per-scene ranges it was cut into
2336
2362
  music.<ext> the music bed
2363
+ video.<ext> the finished video, once the run has one
2337
2364
  manifest.json the index below
2338
2365
  ```
2339
2366
 
@@ -2413,6 +2440,8 @@ provenance which saved rulebook this run followed:
2413
2440
  rig is a copy. Names, ids and a version
2414
2441
  only — never the rules themselves
2415
2442
  failed[] files that did not download: {file, url, error}
2443
+ video the finished video's filename; null when it
2444
+ did not download. Absent when the run has none
2416
2445
  ```
2417
2446
 
2418
2447
  ### What each piece is
@@ -98,6 +98,34 @@ export class SourceMapRefusal extends FirstCutError {
98
98
  readonly findings: SourceMapFinding[];
99
99
  }
100
100
 
101
+ /** A heard word on the cut's clock before its speed-up. */
102
+ export interface CutWordRow { text: string; start: number; end: number; scene: number }
103
+
104
+ /** #4585: the heard words the end card would cover; empty with no card or when every word ends before it. */
105
+ export function voiceUnderEndCard(rows: CutWordRow[], endCard: { in: number } | null): CutWordRow[];
106
+
107
+ /** #4585: the staff message of a cut refused because the end card would cover some of its voice. */
108
+ export function voiceUnderEndCardMessage(words: CutWordRow[]): string;
109
+
110
+ /** #4585: the end card's place and length, after the last heard word; `holdSec` is how long the picture runs on under it. */
111
+ export function endCardLayersOf(
112
+ brand: unknown, storyboard: unknown, pictureSec: number, speed?: number, voiceEndSec?: number | null,
113
+ ): { file: string; in: number; out: number; seconds: number; holdSec?: number } | null;
114
+
115
+ /** #4585: the seconds between the last heard word's end and the end card. */
116
+ export const END_CARD_AFTER_VOICE_SEC: number;
117
+
118
+ /** #4585: the end card on the cut, holding the last scene's picture under it; throws VoiceUnderEndCardRefusal when it would cover a word. */
119
+ export function placeEndCard(
120
+ timeline: unknown, brand: unknown, storyboard: unknown, pictureSec: number, speed: number, notes: string[],
121
+ ): ReturnType<typeof endCardLayersOf>;
122
+
123
+ /** #4585: the end card would cover some of the cut's voice, so the cut is not delivered. */
124
+ export class VoiceUnderEndCardRefusal extends FirstCutError {
125
+ constructor(words: CutWordRow[]);
126
+ readonly words: CutWordRow[];
127
+ }
128
+
101
129
  export interface SourceMapFinding {
102
130
  /** "refuse" stops the cut and nothing is delivered; "declared" is a measured fact the cut carries out. */
103
131
  severity: "refuse" | "declared";
@@ -2196,9 +2196,11 @@ function trimTemplateTerminalSilence(file, timeline, manifest, board, notes) {
2196
2196
  if (Math.max(authoredEnd, reservedEnd, resolvedEnd) > silenceStart + 1 / FPS) notes.push(
2197
2197
  `terminal-silence-authored: measured -50dB EOF silence starts ${silenceStart.toFixed(3)}s; ` +
2198
2198
  `resolved picture/acting reservation retained through ${Math.max(authoredEnd, reservedEnd, resolvedEnd).toFixed(3)}s, not claimed observed`);
2199
+ // #4585: the end card is quiet after the voice on purpose, so a cut with one is never trimmed short of its end.
2200
+ const cardEnd = timeline.endCard ? Math.max(0, ...timeline.spine.map((seg) => seg.startSec + seg.seconds)) : 0;
2199
2201
  const frames = Math.max(Math.ceil(silenceStart * FPS - 1e-6),
2200
2202
  Math.floor((lastWord + .3) * FPS + 1e-6), Math.ceil(authoredEnd * FPS - 1e-6),
2201
- Math.ceil(reservedEnd * FPS - 1e-6), Math.ceil(resolvedEnd * FPS - 1e-6));
2203
+ Math.ceil(reservedEnd * FPS - 1e-6), Math.ceil(resolvedEnd * FPS - 1e-6), Math.ceil(cardEnd * FPS - 1e-6));
2202
2204
  if (frames >= media.picture.frames || frames <= 0) return false;
2203
2205
  const endSec = frames / FPS;
2204
2206
  const spine = timeline.spine.filter((seg) => seg.startSec < endSec).map((seg) => {
@@ -3996,9 +3998,12 @@ export function buildFfmpegArgs(timeline, { resolve, music, out, finish = null,
3996
3998
  const [fadeIn, fadeOut] = [seg.fadeInSec ?? EDGE_FADE_SEC, seg.fadeOutSec ?? EDGE_FADE_SEC];
3997
3999
  // A cubic rise keeps a reaction's quiet start near silent until its laugh (#2666).
3998
4000
  const rise = fadeIn > EDGE_FADE_SEC ? ":curve=cub" : "";
4001
+ // #4585: the end card's held picture runs on in silence after the segment's own sound has faded out.
4002
+ const sounding = seg.seconds - (seg.endCardHoldSec ?? 0);
3999
4003
  const fitLength =
4000
- `apad,atrim=0:${sec(seg.seconds)},afade=t=in:d=${sec(fadeIn)}${rise},` +
4001
- `afade=t=out:st=${sec(seg.seconds - fadeOut)}:d=${sec(fadeOut)}`;
4004
+ `apad,atrim=0:${sec(sounding)},afade=t=in:d=${sec(fadeIn)}${rise},` +
4005
+ `afade=t=out:st=${sec(sounding - fadeOut)}:d=${sec(fadeOut)}` +
4006
+ (seg.endCardHoldSec ? `,apad,atrim=0:${sec(seg.seconds)}` : "");
4002
4007
  const fitSound = `${level},${fitLength}`;
4003
4008
  if (seg.wholeVoice) {
4004
4009
  filters.push(`anullsrc=r=48000:cl=stereo,atrim=0:${sec(seg.seconds)}[a${i}]`);
@@ -4100,25 +4105,28 @@ export function buildFfmpegArgs(timeline, { resolve, music, out, finish = null,
4100
4105
  );
4101
4106
  videoLabel = `pin${j}`;
4102
4107
  });
4103
- // endCardLayers: the brand's ground over the whole frame, then the pack photo in its box, pushing in slowly.
4108
+ // endCardLayers: the brand's ground over the whole frame and the pack photo in its box, pushing in slowly, made as
4109
+ // one card on its own clock and dissolved in over the last picture (#4585: never the ground alone, never black).
4104
4110
  if (finish?.endCard) {
4105
4111
  const e = finish.endCard;
4106
4112
  const box = END_CARD_PHOTO_BOX;
4107
4113
  const w = even((box[2] - box[0]) * WIDTH);
4108
4114
  const h = even((box[3] - box[1]) * HEIGHT);
4109
4115
  const frames = Math.max(1, Math.round(e.seconds * FPS));
4110
- const k = addInput("-loop", "1", "-t", sec(e.seconds), "-i", resolve(e.file));
4111
- filters.push(`color=c=0x${e.colors.background}:s=${WIDTH}x${HEIGHT}:r=${FPS}:d=${sec(e.out)},format=yuv420p[ecground]`);
4112
- filters.push(`[${videoLabel}][ecground]overlay=enable=between(t\\,${sec(e.in)}\\,${sec(e.out)}):eof_action=pass[ecg]`);
4116
+ const length = sec(e.out - e.in);
4117
+ const k = addInput("-loop", "1", "-t", length, "-i", resolve(e.file));
4118
+ filters.push(`color=c=0x${e.colors.background}:s=${WIDTH}x${HEIGHT}:r=${FPS}:d=${length},format=yuv420p[ecground]`);
4113
4119
  filters.push(
4114
4120
  `[${k}:v]fps=${FPS},scale=${w}:${h}:force_original_aspect_ratio=decrease,` +
4115
4121
  `pad=${w}:${h}:(ow-iw)/2:(oh-ih)/2:color=0x${e.colors.background},setsar=1,` +
4116
4122
  `zoompan=z=1+${END_CARD_PUSH_IN}*on/${frames}:x=iw/2-(iw/zoom/2):y=ih/2-(ih/zoom/2):d=1:s=${w}x${h}:fps=${FPS},` +
4117
- `format=yuv420p,fade=t=in:st=0:d=${END_CARD_PHOTO_FADE_SEC},setpts=PTS-STARTPTS+${sec(e.in)}/TB[ecpic]`,
4123
+ `format=yuv420p[ecpic]`,
4118
4124
  );
4119
4125
  filters.push(
4120
- `[ecg][ecpic]overlay=x=${Math.round(box[0] * WIDTH)}:y=${Math.round(box[1] * HEIGHT)}:enable=between(t\\,${sec(e.in)}\\,${sec(e.out)}):eof_action=pass[ecard]`,
4126
+ `[ecground][ecpic]overlay=x=${Math.round(box[0] * WIDTH)}:y=${Math.round(box[1] * HEIGHT)},` +
4127
+ `format=yuva420p,fade=t=in:st=0:d=${END_CARD_FADE_SEC}:alpha=1,setpts=PTS-STARTPTS+${sec(e.in)}/TB[ecbody]`,
4121
4128
  );
4129
+ filters.push(`[${videoLabel}][ecbody]overlay=enable=between(t\\,${sec(e.in)}\\,${sec(e.out)}):eof_action=pass[ecard]`);
4122
4130
  videoLabel = "ecard";
4123
4131
  }
4124
4132
  const speed = finish?.speed > 1 ? finish.speed : null;
@@ -4340,7 +4348,8 @@ export function sceneTimes(timeline, exact = false) {
4340
4348
  .filter((c) => c.seconds > 0)
4341
4349
  .map((c) => ({ from: c.startSec, to: c.startSec + c.seconds }));
4342
4350
  const visible = timeline.spine.flatMap((seg) => {
4343
- let pieces = [{ from: seg.startSec, to: seg.startSec + seg.seconds }];
4351
+ // #4585: the picture held under the end card is the card's, not the scene's.
4352
+ let pieces = [{ from: seg.startSec, to: seg.startSec + seg.seconds - (seg.endCardHoldSec ?? 0) }];
4344
4353
  for (const c of covers) {
4345
4354
  pieces = pieces.flatMap((p) =>
4346
4355
  c.to <= p.from || c.from >= p.to
@@ -4917,40 +4926,45 @@ export function sourceAdPaceShots(sourceAd) {
4917
4926
  }
4918
4927
 
4919
4928
  /**
4920
- * endCardLayers and brandCheck (Plan 14): the manifest's `brand`, written by
4921
- * the worker beside `finishing`: the product's pack photo it downloaded
4922
- * (`packPhoto`, a file in the folder), the product's name, the scenes whose
4923
- * picture the pull's rule draws from that photo (`photoScenes`), the end
4924
- * card's length and the brand's colours (hex), each optional. Null when the
4925
- * manifest has none, so a cut without it is the one it always was.
4929
+ * How long the end card shows, the same for every brand: Daniel's ruling on COP-309 (2026-11-14, #4585), "the card
4930
+ * comes up just after the last spoken word and shows for about 2 seconds, so nothing said is covered".
4926
4931
  */
4927
- export const END_CARD_LAYERS_SEC = 6;
4928
- export const END_CARD_MIN_SEC = 5;
4929
- export const END_CARD_MAX_SEC = 8;
4932
+ export const END_CARD_LAYERS_SEC = 2;
4930
4933
  /** The end card's colours when the brand gives none: a near-black ground, white words, a white call-to-action box. */
4931
4934
  export const END_CARD_COLORS = { background: "111111", text: "FFFFFF", accent: "FFFFFF" };
4932
4935
  /** Where the pack photo sits on the end card, as shares of the frame, and how far it pushes in across the card. */
4933
4936
  export const END_CARD_PHOTO_BOX = [0.1, 0.1, 0.9, 0.56];
4934
4937
  export const END_CARD_PUSH_IN = 0.05;
4935
- /** The words build in one after another, this far apart, after the photo has faded in. */
4936
- const END_CARD_WORD_STEP_SEC = 0.6;
4937
- const END_CARD_PHOTO_FADE_SEC = 0.4;
4938
+ /**
4939
+ * #4585: the card dissolves in over the last picture in END_CARD_FADE_SEC, so its ground never shows alone before the
4940
+ * photo, and its words build in one after another, this far apart, each fading in over END_CARD_WORD_FADE_MS, as the
4941
+ * dissolve ends. On a 2 s card the headline is fully on screen for 1.65 s, the offer 1.5 s, the call to action 1.35 s.
4942
+ */
4943
+ const END_CARD_WORD_STEP_SEC = 0.15;
4944
+ const END_CARD_FADE_SEC = 0.2;
4945
+ const END_CARD_WORD_FADE_MS = 150;
4938
4946
  /** A spoken call to action longer than this many words is too long to letter; the card then shows none. */
4939
4947
  const END_CARD_CTA_MAX_WORDS = 8;
4940
4948
 
4941
4949
  const hexColour = (value) => (typeof value === "string" && /^#?[0-9a-f]{6}$/i.test(value.trim()) ? value.trim().replace(/^#/, "").toUpperCase() : null);
4942
4950
 
4951
+ /**
4952
+ * endCardLayers and brandCheck (Plan 14): the manifest's `brand`, written by
4953
+ * the worker beside `finishing`: the product's pack photo it downloaded
4954
+ * (`packPhoto`, a file in the folder), the product's name, the scenes whose
4955
+ * picture the pull's rule draws from that photo (`photoScenes`) and the
4956
+ * brand's colours (hex), each optional. Null when the manifest has none, so a
4957
+ * cut without it is the one it always was.
4958
+ */
4943
4959
  export function brandOf(manifest) {
4944
4960
  const b = manifest?.brand;
4945
4961
  if (!b || typeof b !== "object") return null;
4946
4962
  const text = (v) => (hasText(v) ? v.trim() : null);
4947
4963
  const colors = b.colors && typeof b.colors === "object" ? b.colors : {};
4948
- const seconds = Number.isFinite(b.endCardSec) ? Math.min(END_CARD_MAX_SEC, Math.max(END_CARD_MIN_SEC, b.endCardSec)) : END_CARD_LAYERS_SEC;
4949
4964
  return {
4950
4965
  packPhoto: text(b.packPhoto),
4951
4966
  productName: text(b.productName),
4952
4967
  photoScenes: Array.isArray(b.photoScenes) ? b.photoScenes.filter((n) => Number.isInteger(n)) : [],
4953
- endCardSec: seconds,
4954
4968
  colors: {
4955
4969
  background: hexColour(colors.background) ?? END_CARD_COLORS.background,
4956
4970
  text: hexColour(colors.text) ?? END_CARD_COLORS.text,
@@ -4983,28 +4997,81 @@ export function endCardWords(storyboard, productName = null) {
4983
4997
  };
4984
4998
  }
4985
4999
 
5000
+ /** #4585: the end card comes up this long after the last heard word ends. */
5001
+ export const END_CARD_AFTER_VOICE_SEC = 0.3;
5002
+
4986
5003
  /**
4987
- * endCardLayers: the ad's last `endCardSec` seconds of screen time (`speed`
5004
+ * endCardLayers: the ad's last END_CARD_LAYERS_SEC seconds of screen time (`speed`
4988
5005
  * is the cut's speed-up, applied after) become the end card: the brand's
4989
5006
  * ground colour, the pack photo pushing in slowly, and the words drawn by
4990
- * code over it. The sound runs on under it as cut, so the call to action is
4991
- * heard over the card. Never more than half the ad. Null without a pack photo.
5007
+ * code over it. Never more than half the ad. Null without a pack photo.
5008
+ * #4585: the card never covers a heard word. When the last word (`voiceEndSec`,
5009
+ * on the cut's clock before the speed-up) ends inside those seconds, the card
5010
+ * comes up just after it, and `holdSec` is how much longer the picture must run
5011
+ * under the card so the card keeps its length.
4992
5012
  */
4993
- export function endCardLayersOf(brand, storyboard, pictureSec, speed = 1) {
5013
+ export function endCardLayersOf(brand, storyboard, pictureSec, speed = 1, voiceEndSec = null) {
4994
5014
  if (!brand?.packPhoto) return null;
4995
- const seconds = Math.min(brand.endCardSec * speed, pictureSec / 2);
5015
+ const seconds = Math.min(END_CARD_LAYERS_SEC * speed, pictureSec / 2);
4996
5016
  if (!(seconds > 0)) return null;
4997
- const at = roundMs(Math.max(0, pictureSec - seconds));
5017
+ // Only a card that would cover a word moves; one that comes up after the last word stays where it was.
5018
+ const waits = Number.isFinite(voiceEndSec) && voiceEndSec > Math.max(0, pictureSec - seconds) + 1e-3;
5019
+ const afterVoice = waits ? voiceEndSec + END_CARD_AFTER_VOICE_SEC : 0;
5020
+ const at = roundMs(Math.max(0, waits ? afterVoice : pictureSec - seconds));
5021
+ // Whole frames, so the held picture ends on the cut's own frame clock.
5022
+ const holdSec = waits ? Math.max(0, Math.ceil((at + seconds - pictureSec) * FPS - 1e-6)) / FPS : 0;
5023
+ const end = pictureSec + holdSec;
4998
5024
  return {
4999
5025
  file: brand.packPhoto,
5000
5026
  in: at,
5001
- out: roundMs(pictureSec + 1),
5002
- seconds: roundMs(pictureSec - at),
5027
+ out: roundMs(end + 1),
5028
+ seconds: roundMs(end - at),
5029
+ ...(holdSec > 0 ? { holdSec } : {}),
5003
5030
  words: endCardWords(storyboard, brand.productName),
5004
5031
  colors: brand.colors,
5005
5032
  };
5006
5033
  }
5007
5034
 
5035
+ /**
5036
+ * #4585: the heard words the end card would cover, so they would play with no picture of their scene. Each is a word
5037
+ * row (the cut's clock before the speed-up). Empty with no card, or when every word ends before the card comes up.
5038
+ */
5039
+ export function voiceUnderEndCard(rows, endCard) {
5040
+ return endCard ? rows.filter((r) => r.end > endCard.in + 1e-3) : [];
5041
+ }
5042
+
5043
+ /**
5044
+ * #4585: the end card on the cut. It comes up after the last heard word, and the last scene's picture runs on under it
5045
+ * (its sound faded out where it ends, then silence), so the card keeps its length. A cut laid on its measured map
5046
+ * cannot run on past its picture, so its card keeps the ad's last seconds. A card that would cover a heard word refuses
5047
+ * the cut (VoiceUnderEndCardRefusal). What it did goes in `notes`.
5048
+ */
5049
+ export function placeEndCard(timeline, brand, storyboard, pictureSec, speed, notes) {
5050
+ const rows = wordRows(timeline);
5051
+ const voiceEndSec = timeline.mapped ? null : Math.max(...rows.map((r) => r.end));
5052
+ const card = endCardLayersOf(brand, storyboard, pictureSec, speed, voiceEndSec);
5053
+ if (card?.holdSec) {
5054
+ const last = timeline.spine.at(-1);
5055
+ last.endCardHoldSec = card.holdSec;
5056
+ last.holdSec = (last.holdSec ?? 0) + card.holdSec;
5057
+ last.seconds += card.holdSec;
5058
+ notes.push(`the end card waits for the last word, so the ad runs ${card.holdSec.toFixed(2)}s longer under it`);
5059
+ }
5060
+ const covered = voiceUnderEndCard(rows, card);
5061
+ if (covered.length > 0) throw new VoiceUnderEndCardRefusal(covered);
5062
+ if (card) timeline.endCard = { in: card.in, out: card.out };
5063
+ return card;
5064
+ }
5065
+
5066
+ /** The staff message of a cut refused because the end card would cover some of its voice (VoiceUnderEndCardRefusal). */
5067
+ export function voiceUnderEndCardMessage(words) {
5068
+ const scenes = [...new Set(words.map((r) => r.scene))].sort((a, b) => a - b);
5069
+ const named = scenes.length > 1 ? `scenes ${scenes.slice(0, -1).join(", ")} and ${scenes.at(-1)}` : `scene ${scenes[0]}`;
5070
+ const from = Math.min(...words.map((r) => r.start));
5071
+ const to = Math.max(...words.map((r) => r.end));
5072
+ return `The end card would cover the voice of ${named} from ${from.toFixed(2)}s to ${to.toFixed(2)}s, so the cut was not attached`;
5073
+ }
5074
+
5008
5075
  /** An ASS colour (&HAABBGGRR) from a hex RRGGBB. */
5009
5076
  const assColour = (hex, alpha = "00") => `&H${alpha}${hex.slice(4, 6)}${hex.slice(2, 4)}${hex.slice(0, 2)}`;
5010
5077
 
@@ -5019,7 +5086,7 @@ function endCardStyles(colors, H) {
5019
5086
  ];
5020
5087
  }
5021
5088
 
5022
- /** The end card's words, building in one after another after the photo. `at` writes a time of the cut's clock. */
5089
+ /** The end card's words, building in one after another as the card's dissolve ends. `at` writes a time of the cut's clock. */
5023
5090
  function endCardDialogues(e, W, H, at = assTime) {
5024
5091
  const rows = [
5025
5092
  ["EndHead", e.words.headline, 0.64],
@@ -5027,8 +5094,8 @@ function endCardDialogues(e, W, H, at = assTime) {
5027
5094
  ["EndCta", e.words.cta, 0.82],
5028
5095
  ].filter(([, words]) => hasText(words));
5029
5096
  return rows.map(([style, words, y], k) => {
5030
- const from = roundMs(e.in + END_CARD_PHOTO_FADE_SEC + k * END_CARD_WORD_STEP_SEC);
5031
- return `Dialogue: 5,${at(from)},${at(e.out)},${style},,0,0,0,,{\\pos(${W / 2},${Math.round(H * y)})\\fad(250,0)}${assText(words)}`;
5097
+ const from = roundMs(e.in + END_CARD_FADE_SEC + k * END_CARD_WORD_STEP_SEC);
5098
+ return `Dialogue: 5,${at(from)},${at(e.out)},${style},,0,0,0,,{\\pos(${W / 2},${Math.round(H * y)})\\fad(${END_CARD_WORD_FADE_MS},0)}${assText(words)}`;
5032
5099
  });
5033
5100
  }
5034
5101
 
@@ -5339,11 +5406,12 @@ export function takesOf(timeline, plans, speed = 1) {
5339
5406
  const last = takes.at(-1);
5340
5407
  const endsOnReaction = Boolean(timeline.spine[i + 1]?.reaction);
5341
5408
  if (last && last.n === seg.sceneIndex && last.lastSeg === i - 1) {
5342
- Object.assign(last, { takeSec: last.takeSec + seg.seconds, lastSeg: i, endsOnReaction });
5409
+ Object.assign(last, { takeSec: last.takeSec + seg.seconds - (seg.endCardHoldSec ?? 0), lastSeg: i, endsOnReaction });
5343
5410
  return;
5344
5411
  }
5412
+ // #4585: the picture held under the end card is not the take's.
5345
5413
  takes.push({
5346
- n: seg.sceneIndex, start: seg.startSec, takeSec: seg.seconds, dialogue: seg.audio === "clip",
5414
+ n: seg.sceneIndex, start: seg.startSec, takeSec: seg.seconds - (seg.endCardHoldSec ?? 0), dialogue: seg.audio === "clip",
5347
5415
  planSec: plans.get(seg.sceneIndex)?.durationSec ?? 0, lastSeg: i, endsOnReaction,
5348
5416
  });
5349
5417
  });
@@ -5857,6 +5925,15 @@ function mediaReader(here, exists) {
5857
5925
  export const sourceMapPath = (outPath) =>
5858
5926
  path.join(path.dirname(outPath), `${path.basename(outPath, path.extname(outPath))}.source-map.json`);
5859
5927
 
5928
+ /** #4585: the end card would cover some of the cut's voice (voiceUnderEndCard), so the cut is not delivered. */
5929
+ export class VoiceUnderEndCardRefusal extends FirstCutError {
5930
+ constructor(words) {
5931
+ super(1, voiceUnderEndCardMessage(words));
5932
+ this.name = "VoiceUnderEndCardRefusal";
5933
+ this.words = words;
5934
+ }
5935
+ }
5936
+
5860
5937
  /** A required text/fulfillment obligation cannot be claimed as delivered. */
5861
5938
  export class TextFinishRefusal extends FirstCutError {
5862
5939
  constructor(holds) {
@@ -6995,7 +7072,7 @@ export function firstCut({ dir, out: outOpt, skip = new Set(), music: musicOn =
6995
7072
  const packPhoto = Boolean(brand?.packPhoto) && exists(brand.packPhoto);
6996
7073
  let endLayers = null;
6997
7074
  if (finish?.endCardLayers) {
6998
- endLayers = packPhoto ? endCardLayersOf(brand, storyboard, pictureSec, speed) : null;
7075
+ endLayers = packPhoto ? placeEndCard(timeline, brand, storyboard, pictureSec, speed, notes) : null;
6999
7076
  if (!endLayers) notes.push("the pull has no pack photo of the product, so the end card was not drawn");
7000
7077
  }
7001
7078
  if (finish && (finish.captions || finish.cards || endLayers) && !stagedText) {
@@ -539,6 +539,8 @@ export declare function priceLines(price: SwipePrice, dashboardUrl: string): str
539
539
  export declare function swipeSheetPriceFlow(swipeId: string, opts: SwipeOpts, deps: VideoDeps): Promise<FlowResult>;
540
540
  export declare function swipeSheetPeopleFlow(swipeId: string, count: number | null, maxUsd: number | null, opts: SwipeRunOptions, deps: VideoDeps): Promise<FlowResult>;
541
541
  export declare function swipeSheetVoicesFlow(swipeId: string, opts: SwipeOpts, deps: VideoDeps): Promise<FlowResult>;
542
+ export declare const ANIMAL_WAIT_LINE = "The animal the script puts in the picture is being found and drawn for this swipe. The start waits for it, until 5 minutes after the write asked for it, so the video films the one on the sheet and does not pay to find and draw it again.";
543
+ export declare const ANIMAL_GOES_ON_LINE = "The animal is still being found or drawn 5 minutes after the write asked for it, so the start goes on: the video looks for an animal in the script itself and draws one when it finds one.";
542
544
  export declare const SWIPE_ALREADY_STARTED_CODE = "SWIPE_ALREADY_STARTED";
543
545
  export declare function alreadyStartedOf(res: ApiResponse<unknown>): {
544
546
  runId: string;
@@ -251,9 +251,9 @@ export function planSwipeCommand(rest, occurrences) {
251
251
  return usage(`video swipe write --kind needs the key of a kind of ad. ${KIND_CHECKED}`);
252
252
  const peopleMost = value("people-max-usd");
253
253
  if (peopleMost === null)
254
- return usage("video swipe write --people-max-usd needs the people's most the write showed, such as 1.32.");
254
+ return usage("video swipe write --people-max-usd needs the people's most the write showed, such as 1.52.");
255
255
  if (peopleMost !== undefined && !/^\d+(\.\d{1,2})?$/.test(peopleMost.trim())) {
256
- return usage(`video swipe write --people-max-usd takes a dollar amount, such as 1.32 (got "${peopleMost}").`);
256
+ return usage(`video swipe write --people-max-usd takes a dollar amount, such as 1.52 (got "${peopleMost}").`);
257
257
  }
258
258
  const noPeople = last("people")?.flag === "no-people";
259
259
  if (peopleMost !== undefined && noPeople)
@@ -1153,7 +1153,7 @@ export async function swipeWriteFlow(breakdownId, ask, opts, deps) {
1153
1153
  const out = progress(opts);
1154
1154
  out.say("Writing the brand's version on the member's key. It takes four to nine minutes.");
1155
1155
  if (ask.peopleMaxUsd !== undefined) {
1156
- out.say(`Once the script is stored, the people to pick from are made, or taken from an earlier write of this ad with at most one check of their pictures paid; at most ${usd(ask.peopleMaxUsd)} on the member's keys.`);
1156
+ out.say(`Once the script is stored, the people to pick from are made, or taken from an earlier write of this ad with at most one check of their pictures paid, and the script is read for an animal it puts in the picture, whose picture is drawn when it has one; at most ${usd(ask.peopleMaxUsd)} on the member's keys for all of it.`);
1157
1157
  }
1158
1158
  const ended = await poll(() => deps.get(`${SWIPES_PATH}?job=${encodeURIComponent(job)}`), (polled) => {
1159
1159
  if (!polled.ok)
@@ -1738,15 +1738,8 @@ export async function swipeSheetVoicesFlow(swipeId, opts, deps) {
1738
1738
  ],
1739
1739
  };
1740
1740
  }
1741
- async function peopleBeforeStart(swipeId, opts, deps) {
1742
- let first = null;
1743
- try {
1744
- const res = await deps.get(peopleSheetPath(swipeId));
1745
- first = res.ok ? sheetOf(res.data) : null;
1746
- }
1747
- catch {
1748
- first = null;
1749
- }
1741
+ async function peopleBeforeStart(swipeId, opts, deps, read) {
1742
+ const first = read !== undefined ? read : await readSheetForStart(swipeId, deps);
1750
1743
  const who = first ? rowOfSheet(first.sheet, "who") : undefined;
1751
1744
  if (!who)
1752
1745
  return null;
@@ -1773,6 +1766,40 @@ async function peopleBeforeStart(swipeId, opts, deps) {
1773
1766
  return { lines: [...out.kept, ...(sentence ? [sentence] : []), ...(films ? [films] : [])], stillMaking: false, waited: true, who: ended.done.who };
1774
1767
  }
1775
1768
  const PEOPLE_MADE_WAIT_MS = 5 * 60_000;
1769
+ async function readSheetForStart(swipeId, deps) {
1770
+ try {
1771
+ const res = await deps.get(peopleSheetPath(swipeId));
1772
+ return res.ok ? sheetOf(res.data) : null;
1773
+ }
1774
+ catch {
1775
+ return null;
1776
+ }
1777
+ }
1778
+ export const ANIMAL_WAIT_LINE = "The animal the script puts in the picture is being found and drawn for this swipe. The start waits for it, until 5 minutes after the write asked for it, so the video films the one on the sheet and does not pay to find and draw it again.";
1779
+ export const ANIMAL_GOES_ON_LINE = "The animal is still being found or drawn 5 minutes after the write asked for it, so the start goes on: the video looks for an animal in the script itself and draws one when it finds one.";
1780
+ async function animalBeforeStart(swipeId, first, opts, deps) {
1781
+ const animal = first ? rowOfSheet(first.sheet, "animal") : undefined;
1782
+ if (animal?.optionsStatus?.making !== true)
1783
+ return { sheet: first, lines: [] };
1784
+ const out = progress(opts);
1785
+ const leftMs = PEOPLE_MADE_WAIT_MS - Math.max(0, animal.optionsStatus.makingForMs ?? 0);
1786
+ if (leftMs <= 0) {
1787
+ out.say(ANIMAL_GOES_ON_LINE);
1788
+ return { sheet: first, lines: out.kept };
1789
+ }
1790
+ out.say(ANIMAL_WAIT_LINE);
1791
+ let last = first;
1792
+ const ended = await poll(() => deps.get(peopleSheetPath(swipeId)), (res) => {
1793
+ const sheet = res.ok ? sheetOf(res.data) : null;
1794
+ if (!sheet)
1795
+ return { done: false };
1796
+ last = sheet;
1797
+ return rowOfSheet(sheet.sheet, "animal")?.optionsStatus?.making === true ? null : { done: true };
1798
+ }, Math.ceil(leftMs / POLL_MS), deps, deps.now() + leftMs);
1799
+ if (!("done" in ended) || !ended.done)
1800
+ out.say(ANIMAL_GOES_ON_LINE);
1801
+ return { sheet: last, lines: out.kept };
1802
+ }
1776
1803
  const checksOnly = (who, aged) => aged && who.optionsStatus?.making === true && typeof who.optionsStatus.count !== "number";
1777
1804
  function goesOnLine(who, aged, why) {
1778
1805
  const checking = checksOnly(who, aged);
@@ -1819,9 +1846,14 @@ export async function swipeStartFlow(swipeId, ask, opts, deps, again = false, wa
1819
1846
  if (!opts.yes) {
1820
1847
  return startNeedsYes(swipeId, ask.oneShot ? "start-one-shot" : "start", json, again, again ? ["With --again: a second video from this swipe, even if it already has one. It is paid on its own."] : [], deps);
1821
1848
  }
1822
- const people = waitPeople ? await peopleBeforeStart(swipeId, opts, deps) : null;
1849
+ const animal = waitPeople ? await animalBeforeStart(swipeId, await readSheetForStart(swipeId, deps), opts, deps) : null;
1850
+ const people = waitPeople ? await peopleBeforeStart(swipeId, opts, deps, animal?.sheet ?? null) : null;
1823
1851
  if (people)
1824
- return withPeopleWait(await swipeStartFlow(swipeId, ask, opts, deps, again), people, json);
1852
+ return withPeopleWait(await swipeStartFlow(swipeId, ask, opts, deps, again), { ...people, lines: [...(animal?.lines ?? []), ...people.lines] }, json);
1853
+ if (animal && animal.lines.length > 0) {
1854
+ const result = await swipeStartFlow(swipeId, ask, opts, deps, again);
1855
+ return json ? result : { ...result, lines: [...animal.lines, ...result.lines] };
1856
+ }
1825
1857
  if (ask.maxUsd !== undefined) {
1826
1858
  const unheld = await maxUsdUnsupported(swipeId, ask.maxUsd, deps);
1827
1859
  if (unheld)
@@ -3133,6 +3165,8 @@ function runStateWord(data) {
3133
3165
  return "failed";
3134
3166
  if (run.isTerminal)
3135
3167
  return "done";
3168
+ if (run.appCut === "making")
3169
+ return "running";
3136
3170
  if (run.status === "awaiting-approval" || run.status === "awaiting-review") {
3137
3171
  const parked = run.nodes.find((node) => node.nodeId === run.pausedNodeId);
3138
3172
  return run.pauseReason === undefined && parked && ["scene-frames", "storyboard"].includes(parked.kind) ? "storyboard" : "waiting";
@@ -94,7 +94,7 @@ export type ArtifactSubset = {
94
94
  type: "image";
95
95
  imageUrl?: string;
96
96
  storageId?: string;
97
- anchor?: "set-plate" | "product-sheet" | "filled-plate" | "product-plate" | "layout-plate";
97
+ anchor?: "set-plate" | "product-sheet" | "filled-plate" | "product-plate" | "layout-plate" | "animal-plate";
98
98
  holds?: string[];
99
99
  lid?: "closed";
100
100
  camera?: string;
@@ -107,6 +107,7 @@ export type ArtifactSubset = {
107
107
  words?: ClipWord[];
108
108
  qc?: ClipQc;
109
109
  final?: boolean;
110
+ autoCut?: boolean;
110
111
  revoiced?: boolean;
111
112
  speechTrimmed?: boolean;
112
113
  tailTrimmed?: boolean;
@@ -225,6 +226,9 @@ export interface VideoRun {
225
226
  };
226
227
  workflowId?: string;
227
228
  cutHeldScenes?: number[];
229
+ appCut?: "making" | "needs-person";
230
+ storyboardAutoApprove?: boolean;
231
+ moduleKey?: string;
228
232
  cutFailure?: {
229
233
  sentence: string;
230
234
  };
@@ -256,6 +260,9 @@ export interface NodeItem {
256
260
  error?: string;
257
261
  attempt?: number;
258
262
  flagged?: boolean;
263
+ acceptedAsIs?: {
264
+ at: number;
265
+ };
259
266
  findings?: ClipFinding[];
260
267
  speech?: SpeechSummary;
261
268
  staleClaim?: boolean;
@@ -290,12 +297,14 @@ export interface FlowResult {
290
297
  lines: string[];
291
298
  usage?: true;
292
299
  }
300
+ export declare function checkDownloadSize(received: number, headers: Pick<Headers, "get">): void;
293
301
  export interface VideoDeps {
294
302
  get: (path: string) => Promise<ApiResponse<unknown>>;
295
303
  post: (path: string, body: unknown) => Promise<ApiResponse<unknown>>;
296
304
  mkdirp: (dir: string) => void;
297
305
  writeFile: (filePath: string, text: string) => void;
298
306
  downloadToFile: (url: string, filePath: string) => Promise<void>;
307
+ piecesOnly?: true;
299
308
  readFile: (filePath: string) => string;
300
309
  readFileBytes: (filePath: string) => Uint8Array;
301
310
  statFile: (filePath: string) => {
@@ -334,6 +343,10 @@ export type RunStop = {
334
343
  heldScenes?: number[];
335
344
  heldTakes?: HeldTake[];
336
345
  cutFailure?: string;
346
+ appMakesCut?: true;
347
+ appCutOnRun?: true;
348
+ appOutdatesCut?: true;
349
+ redoingScenes?: number[];
337
350
  } | {
338
351
  at: "pilot";
339
352
  nodeId?: string;
@@ -388,7 +401,10 @@ export interface HeldTake {
388
401
  sentence: string;
389
402
  }
390
403
  export declare function heldTakesOf(scenes: readonly number[] | undefined, items: readonly NodeItem[] | null | undefined): HeldTake[];
404
+ export declare function flaggedHeldTakesOf(items: readonly NodeItem[] | null | undefined): HeldTake[];
391
405
  export declare function resolveStop(stop: RunStop, cutAttached: boolean | null, items?: NodeItem[] | null): ResolvedStop;
406
+ export declare function appCutOutdates(run: Pick<VideoRun, "appCut" | "moduleKey">): boolean;
407
+ export declare function appIsCutting(stop: ResolvedStop): boolean;
392
408
  export declare function resolveStopAtPark(stop: RunStop, runId: string, deps: Pick<VideoDeps, "get">): Promise<ResolvedStop>;
393
409
  export declare function stageWord(stage: string): string;
394
410
  export declare function stepName(kind: string | undefined): string;
@@ -502,6 +518,7 @@ export interface VideoManifest {
502
518
  file: string | null;
503
519
  reason?: string;
504
520
  };
521
+ video?: string | null;
505
522
  }
506
523
  export interface RunShots {
507
524
  frame?: string;
@@ -520,6 +537,7 @@ export declare function scenePrefix(sceneIndex: number): string;
520
537
  export declare function planPull(run: VideoRun, items: NodeItem[], opts: {
521
538
  pulledAt: string;
522
539
  dashboardUrl: string;
540
+ piecesOnly?: true;
523
541
  }): PullPlan;
524
542
  export declare function markPullFailure(manifest: VideoManifest, failure: PullFailure): void;
525
543
  export declare function missingSetupLabels(progress: ShowRow["setupProgress"]): string[];
@@ -561,9 +561,12 @@ swipe write also makes people to pick from for a kind whose sheet has a person,
561
561
  when the server offers them: without --yes it says their price too, and the
562
562
  yes line carries their most (--people-max-usd <n>). The write then makes 4 on
563
563
  the member's own keys once the script is stored, waits a few minutes for them
564
- and shows each, with the one a check of the faces recommends. --yes alone, or
565
- --no-people, writes without them. swipe start waits while people are being
566
- made, until 5 minutes after they were asked for.
564
+ and shows each, with the one a check of the faces recommends. Inside the same
565
+ most it also reads the stored script for an animal it puts in the picture and
566
+ draws one picture of it: the sheet's row "The animal" shows it, and swipe sheet
567
+ set <swipeId> animal=none takes it out. --yes alone, or --no-people, writes
568
+ without them. swipe start waits while people or the animal are being made,
569
+ until 5 minutes after they were asked for.
567
570
  The template picks the kind of ad: swipe template prints it and its look, so
568
571
  ask the member before the write. A swipe run has no picks stop and no pilot
569
572
  clip; it stops at the storyboard unless --one-shot. --wait on swipe and swipe
@@ -703,6 +706,17 @@ export function asVideoRun(data) {
703
706
  const run = (data ?? {});
704
707
  return { ...run, nodes: Array.isArray(run.nodes) ? run.nodes : [] };
705
708
  }
709
+ export function checkDownloadSize(received, headers) {
710
+ if (received === 0)
711
+ throw new Error("the download was empty");
712
+ const encoding = headers.get("content-encoding");
713
+ if (encoding && encoding !== "identity")
714
+ return;
715
+ const stated = Number(headers.get("content-length") ?? "");
716
+ if (Number.isFinite(stated) && stated > 0 && stated !== received) {
717
+ throw new Error(`the download came to ${received} bytes, not the ${stated} the server sent`);
718
+ }
719
+ }
706
720
  export const defaultDeps = {
707
721
  get: (p) => apiGet(p),
708
722
  post: (p, body) => apiPost(p, body),
@@ -714,7 +728,17 @@ export const defaultDeps = {
714
728
  const res = await fetch(url);
715
729
  if (!res.ok)
716
730
  throw new Error(`HTTP ${res.status}`);
717
- fs.writeFileSync(filePath, Buffer.from(await res.arrayBuffer()));
731
+ const bytes = Buffer.from(await res.arrayBuffer());
732
+ checkDownloadSize(bytes.length, res.headers);
733
+ const part = `${filePath}.part`;
734
+ try {
735
+ fs.writeFileSync(part, bytes);
736
+ fs.renameSync(part, filePath);
737
+ }
738
+ catch (err) {
739
+ fs.rmSync(part, { force: true });
740
+ throw err;
741
+ }
718
742
  },
719
743
  readFile: (filePath) => fs.readFileSync(filePath, "utf-8"),
720
744
  readFileBytes: (filePath) => fs.readFileSync(filePath),
@@ -917,6 +941,8 @@ export function classifyRun(run) {
917
941
  ...(missingScenes.length > 0 && framesNodeId ? { framesNodeId } : {}),
918
942
  ...(run.cutHeldScenes?.length ? { heldScenes: run.cutHeldScenes } : {}),
919
943
  ...(run.cutFailure?.sentence ? { cutFailure: run.cutFailure.sentence } : {}),
944
+ ...(run.appCut === "making" ? { appMakesCut: true } : {}),
945
+ ...(appCutOutdates(run) ? { appOutdatesCut: true } : {}),
920
946
  };
921
947
  }
922
948
  return { at: "paused", nodeId: run.pausedNodeId, reason: run.pauseReason };
@@ -943,13 +969,33 @@ export function heldTakesOf(scenes, items) {
943
969
  if (!scenes?.length || !items)
944
970
  return [];
945
971
  return scenes.flatMap((sceneIndex) => {
946
- const latest = items
947
- .filter((i) => i.itemKind === "clip" && i.sceneIndex === sceneIndex)
948
- .reduce((best, i) => (!best || (i.attempt ?? 0) >= (best.attempt ?? 0) ? i : best), undefined);
949
- const said = (latest?.findings ?? [])
950
- .filter((f) => ONE_TAKE_HOLD_CODES.includes(f.code) && f.detail.trim())
951
- .map((f) => f.detail.trim());
952
- return said.length > 0 ? [{ sceneIndex, sentence: said.join(" ") }] : [];
972
+ const said = holdSentenceOf(latestClipRow(items, sceneIndex));
973
+ return said !== null ? [{ sceneIndex, sentence: said }] : [];
974
+ });
975
+ }
976
+ function latestClipRow(items, sceneIndex) {
977
+ return items
978
+ .filter((i) => i.itemKind === "clip" && i.sceneIndex === sceneIndex)
979
+ .reduce((best, i) => (!best || (i.attempt ?? 0) >= (best.attempt ?? 0) ? i : best), undefined);
980
+ }
981
+ function holdSentenceOf(row) {
982
+ const said = (row?.findings ?? [])
983
+ .filter((f) => ONE_TAKE_HOLD_CODES.includes(f.code) && f.detail.trim())
984
+ .map((f) => f.detail.trim());
985
+ return said.length > 0 ? said.join(" ") : null;
986
+ }
987
+ export function flaggedHeldTakesOf(items) {
988
+ if (!items)
989
+ return [];
990
+ const scenes = [...new Set(items.filter((i) => i.itemKind === "clip" && isPullSceneIndex(i.sceneIndex)).map((i) => i.sceneIndex))];
991
+ return scenes
992
+ .sort((a, b) => a - b)
993
+ .flatMap((sceneIndex) => {
994
+ const latest = latestClipRow(items, sceneIndex);
995
+ if (!latest || latest.status !== "done" || latest.flagged !== true || latest.acceptedAsIs)
996
+ return [];
997
+ const said = holdSentenceOf(latest);
998
+ return said !== null ? [{ sceneIndex, sentence: said }] : [];
953
999
  });
954
1000
  }
955
1001
  export function resolveStop(stop, cutAttached, items) {
@@ -962,8 +1008,36 @@ export function resolveStop(stop, cutAttached, items) {
962
1008
  }
963
1009
  if (stop.at !== "final-watch")
964
1010
  return stop;
965
- const heldTakes = heldTakesOf(stop.heldScenes, items);
966
- return { ...stop, cutAttached, ...(heldTakes.length > 0 ? { heldTakes } : {}) };
1011
+ const named = heldTakesOf(stop.heldScenes, items);
1012
+ const fromRows = cutAttached === false
1013
+ ? flaggedHeldTakesOf(items).filter((t) => !(stop.heldScenes ?? []).includes(t.sceneIndex))
1014
+ : [];
1015
+ const heldTakes = fromRows.length > 0 ? [...named, ...fromRows].sort((a, b) => a.sceneIndex - b.sceneIndex) : named;
1016
+ const heldScenes = fromRows.length > 0
1017
+ ? [...(stop.heldScenes ?? []), ...fromRows.map((t) => t.sceneIndex)].sort((a, b) => a - b)
1018
+ : stop.heldScenes;
1019
+ return {
1020
+ ...stop,
1021
+ cutAttached,
1022
+ ...(heldScenes?.length ? { heldScenes } : {}),
1023
+ ...(heldTakes.length > 0 ? { heldTakes } : {}),
1024
+ ...(items && hasAppCut(items) ? { appCutOnRun: true } : {}),
1025
+ };
1026
+ }
1027
+ export function appCutOutdates(run) {
1028
+ return run.appCut === "making" && run.moduleKey === "script-video";
1029
+ }
1030
+ function hasAppCut(items) {
1031
+ return items.some((i) => i.itemKind === "final" && i.status === "done" && i.artifact?.type === "video" && i.artifact.autoCut === true);
1032
+ }
1033
+ export function appIsCutting(stop) {
1034
+ return (stop.at === "final-watch" &&
1035
+ stop.appMakesCut === true &&
1036
+ !stop.missingScenes?.length &&
1037
+ !stop.heldScenes?.length &&
1038
+ !stop.cutFailure &&
1039
+ stop.cutAttached !== null &&
1040
+ (!stop.cutAttached || (stop.appCutOnRun === true && stop.appOutdatesCut === true)));
967
1041
  }
968
1042
  export async function resolveStopAtPark(stop, runId, deps) {
969
1043
  if (stop.at !== "final-watch" && stop.at !== "pilot")
@@ -1159,6 +1233,21 @@ export function stopLines(stop, runId, runUrl, videoPage) {
1159
1233
  `Watch it here: ${runUrl}`,
1160
1234
  ];
1161
1235
  }
1236
+ if (appIsCutting(stop)) {
1237
+ if (stop.redoingScenes?.length) {
1238
+ const many = stop.redoingScenes.length > 1;
1239
+ return [
1240
+ `Scene${many ? "s" : ""} ${stop.redoingScenes.join(", ")} ${many ? "are" : "is"} being made again. The app cuts the video again once ${many ? "they are" : "it is"} made; look again in a few minutes: exodus video status ${runId}`,
1241
+ `Watch it here: ${runUrl}`,
1242
+ ];
1243
+ }
1244
+ return [
1245
+ stop.cutAttached
1246
+ ? `Every piece is made. The app makes the cut again now; look again in a minute: exodus video status ${runId}`
1247
+ : `Every piece is made. The app makes the cut now; look again in a minute: exodus video status ${runId}`,
1248
+ `Watch it here: ${runUrl}`,
1249
+ ];
1250
+ }
1162
1251
  if (stop.cutAttached) {
1163
1252
  return [
1164
1253
  "Parked: your cut is uploaded and waiting for your approval.",
@@ -1732,6 +1821,8 @@ export function planPull(run, items, opts) {
1732
1821
  };
1733
1822
  });
1734
1823
  const { cast, downloads: castDownloads } = planCastRefs(run, items, castVoicePins(storyboardArtifact));
1824
+ const finishedUrl = opts.piecesOnly || appCutOutdates(run) ? undefined : finishedVideoUrl(items);
1825
+ const finished = finishedUrl ? { file: `video.${extFor(finishedUrl, "video")}`, url: finishedUrl } : null;
1735
1826
  const downloads = [
1736
1827
  ...(reference ? [reference] : []),
1737
1828
  ...(productSheet ? [productSheet] : []),
@@ -1743,6 +1834,7 @@ export function planPull(run, items, opts) {
1743
1834
  ...[...clipByScene.values()].map((c) => c.download),
1744
1835
  ...(music ? [music] : []),
1745
1836
  ...castDownloads,
1837
+ ...(finished ? [finished] : []),
1746
1838
  ];
1747
1839
  return {
1748
1840
  downloads,
@@ -1788,11 +1880,40 @@ export function planPull(run, items, opts) {
1788
1880
  ...(run.videoChoice?.videoModel === "template-video" && run.heldSong === true
1789
1881
  ? { wholeVoice: true, templateMotion: { enabled: true } } : {}),
1790
1882
  ...(run.shots?.frame || run.shots?.pacing ? { shots: run.shots } : {}),
1883
+ ...(finished ? { video: finished.file } : {}),
1791
1884
  },
1792
1885
  };
1793
1886
  }
1887
+ function finishedVideoUrl(items) {
1888
+ const finals = items.filter((i) => i.itemKind === "final" && i.status === "done" && i.artifact?.type === "video");
1889
+ return finals.length === 1 && finals[0].artifact?.type === "video" ? finals[0].artifact.videoUrl || undefined : undefined;
1890
+ }
1891
+ function appCutsRun(run, items) {
1892
+ return run.appCut !== undefined || hasAppCut(items);
1893
+ }
1894
+ function fingerprintInFolder(dir, file, deps) {
1895
+ if (!file || deps.statFile(path.join(dir, file)) === null)
1896
+ return null;
1897
+ return createHash("sha256").update(deps.readFileBytes(path.join(dir, file))).digest("hex");
1898
+ }
1899
+ function replacedVideoLines(dir, file, before, deps) {
1900
+ if (!file || before === null)
1901
+ return [];
1902
+ const after = fingerprintInFolder(dir, file, deps);
1903
+ return after !== null && after !== before
1904
+ ? [`A different ${file} was already in ${dir}; the pull replaced it with this run's finished video.`]
1905
+ : [];
1906
+ }
1907
+ function runStopped(run) {
1908
+ return run.status === "failed" || run.status === "cancelled" || run.status === "canceled";
1909
+ }
1910
+ function deliveredLine(dir, video) {
1911
+ return video ? `This run is delivered. The finished video is ${path.join(dir, video)}.` : "This run is delivered.";
1912
+ }
1794
1913
  export function markPullFailure(manifest, failure) {
1795
1914
  manifest.failed.push(failure);
1915
+ if (manifest.video === failure.file)
1916
+ manifest.video = null;
1796
1917
  if (manifest.storyboard === failure.file)
1797
1918
  manifest.storyboard = null;
1798
1919
  if (manifest.reference === failure.file)
@@ -3802,6 +3923,10 @@ export async function waitFlow(runId, opts, deps) {
3802
3923
  }
3803
3924
  }
3804
3925
  const resolved = resolveStop(stop, items ? hasAttachedCut(items) : null, items);
3926
+ if (appIsCutting(resolved)) {
3927
+ progress("Working: the app makes the cut…");
3928
+ continue;
3929
+ }
3805
3930
  if (opts.json) {
3806
3931
  return {
3807
3932
  code: stop.at === "failed" ? 1 : 0,
@@ -3844,6 +3969,9 @@ function carryingOn(run) {
3844
3969
  return (run.status === "queued" &&
3845
3970
  run.nodes.some((n) => n.status !== "idle" && n.status !== "out-of-scope"));
3846
3971
  }
3972
+ function cutDeliversItself(run, stop) {
3973
+ return run.storyboardAutoApprove === true && stop.at === "running";
3974
+ }
3847
3975
  export async function statusFlow(runId, json, deps) {
3848
3976
  const runRes = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`);
3849
3977
  if (!runRes.ok)
@@ -3861,7 +3989,9 @@ export async function statusFlow(runId, json, deps) {
3861
3989
  return errorResult(itemsRes, json);
3862
3990
  const items = itemsRes.data.items ?? [];
3863
3991
  const hasFinal = hasAttachedCut(items);
3864
- const stop = resolveStop(classifyRun(run), hasFinal, items);
3992
+ const resolved = resolveStop(classifyRun(run), hasFinal, items);
3993
+ const redoingScenes = resolved.at === "final-watch" ? scenesBeingRedone(run, items) : [];
3994
+ const stop = resolved.at === "final-watch" && redoingScenes.length > 0 ? { ...resolved, redoingScenes } : resolved;
3865
3995
  const failedStoryboard = failedStoryboardNode(run);
3866
3996
  const guidance = stopLines(stop.at === "failed" && errorEchoesReasons(stop.error, failedStoryboard?.planFailure)
3867
3997
  ? { ...stop, error: undefined }
@@ -4019,11 +4149,17 @@ export async function statusFlow(runId, json, deps) {
4019
4149
  lines.push(...(await statusVoiceLines(runId, deps)));
4020
4150
  }
4021
4151
  const cost = runCostLine(run, items);
4022
- lines.push("", ...(cost ? [cost] : []), hasFinal && stop.at === "finished"
4023
- ? "Final cut: approved and delivered."
4024
- : hasFinal
4025
- ? `Final cut: uploaded. Approve it with: exodus video approve ${runId}`
4026
- : "Final cut: not uploaded yet.", ...(run.cutCheck ?? []));
4152
+ lines.push("", ...(cost ? [cost] : []), runStopped(run)
4153
+ ? hasFinal ? "Final cut: on the run, which stopped before it was delivered." : "Final cut: none. This run stopped before one was made."
4154
+ : hasFinal && stop.at === "finished"
4155
+ ? "Final cut: approved and delivered."
4156
+ : hasFinal && cutDeliversItself(run, stop)
4157
+ ? "Final cut: made. This run delivers it by itself; look again in a minute."
4158
+ : hasFinal && appIsCutting(stop)
4159
+ ? "Final cut: the app makes it again now; look again in a minute."
4160
+ : hasFinal
4161
+ ? `Final cut: uploaded. Approve it with: exodus video approve ${runId}`
4162
+ : "Final cut: not uploaded yet.", ...(run.cutCheck ?? []));
4027
4163
  let finalSpeech;
4028
4164
  for (const item of items)
4029
4165
  if (item.itemKind === "final" && item.status === "done")
@@ -5511,6 +5647,7 @@ async function customerPullFlow(run, dir, json, deps) {
5511
5647
  dashboardUrl: deps.dashboardUrl,
5512
5648
  });
5513
5649
  deps.mkdirp(dir);
5650
+ const videoBefore = fingerprintInFolder(dir, manifest.video, deps);
5514
5651
  const failures = (await runPool(downloads.map((download) => () => downloadWithRetry(download, dir, deps)), PULL_CONCURRENCY)).filter((f) => f !== null);
5515
5652
  const landed = (file) => file !== null && !failures.some((f) => f.file === file) ? file : null;
5516
5653
  for (const scene of manifest.scenes) {
@@ -5539,6 +5676,7 @@ async function customerPullFlow(run, dir, json, deps) {
5539
5676
  lines: [
5540
5677
  `Pulled ${downloads.length - failures.length + 1} files into ${dir}`,
5541
5678
  `Every piece is listed in ${manifestPath}.`,
5679
+ ...replacedVideoLines(dir, manifest.video, videoBefore, deps),
5542
5680
  ...(manifest.video ? [] : ["The finished video isn't ready yet, so only the scene pieces came down."]),
5543
5681
  ...(failures.length > 0
5544
5682
  ? [
@@ -5548,11 +5686,13 @@ async function customerPullFlow(run, dir, json, deps) {
5548
5686
  "Run the same command again to retry.",
5549
5687
  ]
5550
5688
  : []),
5551
- "",
5552
- `When your cut is ready: exodus video upload ${runId} --file cut.mp4`,
5689
+ ...(customerDelivered(run) ? ["", deliveredLine(dir, manifest.video)] : []),
5553
5690
  ],
5554
5691
  };
5555
5692
  }
5693
+ function customerDelivered(run) {
5694
+ return run.stage === "ready" && run.awaitingSignOff !== true;
5695
+ }
5556
5696
  export async function pullFlow(runId, dir, json, deps) {
5557
5697
  const runRes = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`);
5558
5698
  if (!runRes.ok)
@@ -5568,6 +5708,7 @@ export async function pullFlow(runId, dir, json, deps) {
5568
5708
  const plan = planPull(run, items, {
5569
5709
  pulledAt: new Date(deps.now()).toISOString(),
5570
5710
  dashboardUrl: deps.dashboardUrl,
5711
+ ...(deps.piecesOnly ? { piecesOnly: true } : {}),
5571
5712
  });
5572
5713
  deps.mkdirp(dir);
5573
5714
  if (plan.downloads.length === 0 && plan.texts.length === 0) {
@@ -5582,6 +5723,7 @@ export async function pullFlow(runId, dir, json, deps) {
5582
5723
  for (const text of plan.texts) {
5583
5724
  deps.writeFile(path.join(dir, text.file), text.body);
5584
5725
  }
5726
+ const videoBefore = fingerprintInFolder(dir, plan.manifest.video, deps);
5585
5727
  const failures = await runPool(plan.downloads.map((download) => () => downloadWithRetry(download, dir, deps)), PULL_CONCURRENCY);
5586
5728
  for (const failure of failures) {
5587
5729
  if (failure)
@@ -5601,6 +5743,7 @@ export async function pullFlow(runId, dir, json, deps) {
5601
5743
  const lines = [
5602
5744
  `Pulled ${wrote} files into ${dir}`,
5603
5745
  `Every piece is indexed in ${path.join(dir, "manifest.json")} — scene numbers there are the run's own.`,
5746
+ ...replacedVideoLines(dir, plan.manifest.video, videoBefore, deps),
5604
5747
  ...musicLines(plan.manifest),
5605
5748
  ];
5606
5749
  if (plan.manifest.dropped.length > 0) {
@@ -5634,7 +5777,15 @@ export async function pullFlow(runId, dir, json, deps) {
5634
5777
  lines.push(` ${failure.file}: ${failure.error}`);
5635
5778
  lines.push("Run the same command again to retry just those.");
5636
5779
  }
5637
- lines.push("", `When your cut is ready: exodus video upload ${runId} --file cut.mp4`);
5780
+ if (runStopped(run)) {
5781
+ lines.push("", "This run stopped before it was delivered, so no cut can be uploaded to it now.");
5782
+ }
5783
+ else if (hasAttachedCut(items) && classifyRun(run).at === "finished") {
5784
+ lines.push("", deliveredLine(dir, plan.manifest.video));
5785
+ }
5786
+ else if (!appCutsRun(run, items)) {
5787
+ lines.push("", `When your cut is ready: exodus video upload ${runId} --file cut.mp4`);
5788
+ }
5638
5789
  return { code: failed.length > 0 ? 1 : 0, lines };
5639
5790
  }
5640
5791
  const BOX_HEADER = 8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicopycoders/exodus",
3
- "version": "2026.11.1200-beta.14",
3
+ "version": "2026.11.1200-beta.16",
4
4
  "description": "CLI + Claude Code skills for the Copycoders Exodus ad pipeline",
5
5
  "repository": {
6
6
  "type": "git",