@aicopycoders/exodus 2026.11.1200-beta.2 → 2026.11.1200-beta.21

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.
@@ -9,9 +9,10 @@ import { missingRouteLine } from "../lib/route-support.js";
9
9
  import { probeDurationSec } from "../lib/preflight.js";
10
10
  import { composeTemplateBrief } from "../lib/templateBrief.js";
11
11
  import { scriptApprovalExpiresAt, scriptApprovalNeedsReview } from "../lib/script-approval.js";
12
- import { ASSET_UPLOAD_POLICY, pauseAheadLine, parseVoicesFlag, } from "./workflow.js";
13
- import { HELPER_LEDGER_BASE, SET_OPTION_LEDGER_BASE } from "../lib/helperLedgerBase.js";
14
- import { customerAnswer, customerRunPage, customerStageIsWorking, customerCutHeld, customerStageLines, customerStatusLines, customerStoryboardLines, customerVoicesLines, speechSummaryLines, } from "./video-customer.js";
12
+ import { ASSET_UPLOAD_POLICY, boardDrawsThePlaceFirst, pauseAheadLine, parseVoicesFlag, } from "./workflow.js";
13
+ import { HELPER_LEDGER_BASE, ONE_TAKE_BOARD_PLACE_LEDGER_INDEX, SET_OPTION_LEDGER_BASE } from "../lib/helperLedgerBase.js";
14
+ import { ONE_TAKE_HOLD_CODES } from "../lib/oneTakeHolds.js";
15
+ import { customerAnswer, customerRunPage, customerStageIsWorking, finalApproveLines, finalApprovedLines, customerCutHeld, customerStageLines, customerStatusLines, customerStoryboardLines, customerVoicesLines, speechSummaryLines, spendAskLines, onOwnDashboard, } from "./video-customer.js";
15
16
  import { planSwipeCommand, runSwipePlan } from "./video-swipe.js";
16
17
  const VOICE_MODES = ["native", "voice-first"];
17
18
  function joinedOr(items) {
@@ -158,6 +159,18 @@ The whole loop, in order:
158
159
  picture stays, no new video is made, and a clip whose voice pass
159
160
  cannot finish is kept as it was. Use --scene <n> for one clip.
160
161
 
162
+ exodus video keep <runId> --scene <n>
163
+ Keep a held scene's clip as it is, as "Use scene N as-is" on the
164
+ video's page does. It orders nothing. Once no scene is held, the app's
165
+ own cut goes on and makes the final video.
166
+
167
+ exodus video keep-going <runId>
168
+ exodus video stop-here <runId>
169
+ A video that reached the estimate it showed before the start stops
170
+ and waits ("Waiting for you:" in status). Run one of these only on
171
+ the member's own answer: keep-going films on (it asks again at the
172
+ next whole estimate); stop-here orders nothing more.
173
+
161
174
  9. Make your cut from those files.
162
175
 
163
176
  10. exodus video upload <runId> --file cut.mp4
@@ -171,6 +184,7 @@ The whole loop, in order:
171
184
 
172
185
  Usage:
173
186
  exodus video status <runId> [--rejected-draft] [--json]
187
+ exodus video wait <runId> [--json]
174
188
  exodus video review <runId> (--accept | --reject) [--resolve "<key>|<accepted-as-is|waived>|<why>"] [--disagree "<key>|<words>"] [--grade <v>] [--media <v>] [--json]
175
189
  exodus video song <runId> [--json]
176
190
  exodus video song approve <runId> --master <masterSha256> [--json]
@@ -188,11 +202,14 @@ Usage:
188
202
  exodus video broll remove <runId> --scene <n> [--json]
189
203
  exodus video retry-clip <runId> --scene <n> [--node <nodeId>] [--note "..."] [--voice-first] [--json]
190
204
  exodus video revoice <runId> (--scene <n> | --all) [--node <nodeId>] [--json]
205
+ exodus video keep <runId> --scene <n> [--json]
206
+ exodus video keep-going <runId> [--json]
207
+ exodus video stop-here <runId> [--json]
191
208
  exodus video voices <runId> [--set <character>=<voice>] [--clear <character>] [--from <file.json>] [--json]
192
209
  exodus video voices [<runId>] --catalog [--json]
193
210
  exodus video pull <runId> --out <dir> [--json]
194
211
  exodus video upload <runId> --file <cut.mp4> [--duration <sec>] [--json]
195
- exodus video start --script <file> --conceit <kind> --style <look> [--direction "<note>"] [--frame pov] [--pacing <jump-cuts|long-take|montage>] [--voice-path <path>] [--video-model <id>] [--voice <native|voice-first>] [--source-record <file.json>] [--adaptation-plan <file|original>] [--music] [--broll] [--one-shot] [--director] [--wait] [--json]
212
+ exodus video start --script <file> --conceit <kind> --style <look> [--direction "<note>"] [--frame pov] [--pacing <jump-cuts|long-take|montage>] [--voice-path <path>] [--video-model <id>] [--voice <native|voice-first>] [--source-record <file.json>] [--adaptation-plan <file|original>] [--music] [--broll] [--one-shot] [--director] [--yes --max-usd <n>] [--wait] [--json]
196
213
  Template starts also accept: [--requested-seconds <seconds>] [--pictures-per-scene <1|3>] [--product <brandProductId>] [--elements <json|@file>] [--voices <json|@file>] [--resume-script <saved-stop-response.json>]
197
214
  With --describe: [--product-context <text>] [--audience <text>] [--offer <text>] [--mechanism <text>]
198
215
  exodus video start --input-options [--conceit <template>] [--voice <native|voice-first>] [--voice-path <path>] [--video-model <id>] [--json]
@@ -201,14 +218,18 @@ Usage:
201
218
  exodus video swipe status <breakdownId> [--wait] [--full] [--json]
202
219
  exodus video swipe template <breakdownId> [--yes] [--json]
203
220
  exodus video swipe products [--json]
204
- exodus video swipe write <breakdownId> --product <id> [--mode whole-ad|hook-only|their-format|new-look] [--closeness <1-5|mirror|close|same-beats|same-arc|pattern-only>] [--look <slug>] [--script <file>] [--kind <kind>] [--yes] [--json]
221
+ exodus video swipe write <breakdownId> --product <id> [--mode whole-ad|hook-only|their-format|new-look] [--closeness <1-5|mirror|close|same-beats|same-arc|pattern-only>] [--look <slug>] [--script <file>] [--kind <kind>] [--yes [--people-max-usd <n>]] [--no-people] [--json]
205
222
  exodus video swipe show <swipeId> [--json]
206
223
  exodus video swipe list [--json]
207
224
  exodus video swipe find [--brand "<name>"] [--limit <n>] [--json]
208
- exodus video swipe start <swipeId> [--style <look>] [--title "<name>"] [--music] [--one-shot] [--again] [--yes] [--wait] [--json]
225
+ exodus video swipe start <swipeId> [--style <look>] [--title "<name>"] [--music] [--one-shot] [--again] [--max-usd <n>] [--yes] [--wait] [--json]
209
226
  exodus video swipe run --sheet <file> [--status] [--persona <name>] [--yes] [--retry-refused] [--wait] [--json]
210
227
  exodus video swipe sheet <swipeId> [--json]
211
228
  exodus video swipe sheet set <swipeId> <row>=<value> [<row>=<value> ...] [--json]
229
+ exodus video swipe sheet set <swipeId> <row>=<value> --yes --people-max-usd <n> [--json]
230
+ exodus video swipe sheet price <swipeId> [--json]
231
+ exodus video swipe sheet people <swipeId> [--count <n>] [--yes --max-usd <n>] [--wait] [--json]
232
+ exodus video swipe sheet voices <swipeId> [--json]
212
233
 
213
234
  Options:
214
235
  --out <dir> Folder to write the pulled pieces into (pull)
@@ -225,7 +246,8 @@ Options:
225
246
  Which video step holds the clip, when a scene has one on
226
247
  more than one step (retry-clip, revoice)
227
248
  --scene <n> Which scene to redo. One scene only, a whole number
228
- (retry-frame, retry-clip, revoice). Which B-roll shot
249
+ (retry-frame, retry-clip, revoice), or to keep as it is
250
+ (keep). Which B-roll shot
229
251
  to move or remove (broll move, broll remove)
230
252
  --all Every finished clip that kept the video model's voice
231
253
  (revoice)
@@ -445,7 +467,9 @@ the brand's version, then start the video on the kind the swipe wrote. Four
445
467
  steps cost money: swipe (the breakdown, on the team's keys), swipe template
446
468
  and swipe write (on your own Anthropic or OpenRouter key) and swipe start (the
447
469
  run's storyboard and pictures). Without --yes each one sends nothing and says
448
- what it buys and who pays. The CLI prints no price for any of them.
470
+ what it buys and who pays. The CLI prints no price for any of them, but for
471
+ the people swipe write makes and swipe start of a kind whose saved sheet has
472
+ one.
449
473
  --file <ad.mp4> The ad as a video file: MP4, MOV, M4V or WebM, up to
450
474
  300 MB (swipe)
451
475
  --url <link> A link to the ad: Meta Ad Library, TikTok, Instagram or
@@ -455,8 +479,10 @@ what it buys and who pays. The CLI prints no price for any of them.
455
479
  broken down before costs nothing. swipe find lists
456
480
  the library's video ads and their ids
457
481
  --yes The member said yes to this paid step (swipe, swipe
458
- template, swipe write, swipe start), or to every paid
459
- step of the sheet (swipe run)
482
+ template, swipe write, swipe start, and a beta tester's
483
+ start: without it the start says the price and starts
484
+ nothing; with it, --max-usd <the price it said>), or to
485
+ every paid step of the sheet (swipe run)
460
486
  --product <id> The product the swipe is for (swipe write). exodus
461
487
  video swipe products lists them
462
488
  --mode <mode> What to swipe (swipe write). whole-ad if left off:
@@ -474,7 +500,7 @@ what it buys and who pays. The CLI prints no price for any of them.
474
500
  1 mirror Mirror
475
501
  Same lines in the same order. Only your brand, product and claims change.
476
502
  2 close Close
477
- Same parts in the same order, each line said in new words.
503
+ Same parts in the same order, with the same kind of line in each, in new words.
478
504
  3 same-beats Same beats
479
505
  Same job for each part, in the same order. New words and new examples.
480
506
  4 same-arc Same arc
@@ -484,7 +510,7 @@ what it buys and who pays. The CLI prints no price for any of them.
484
510
  --full What the breakdown read from the ad (swipe status): each
485
511
  shot with its cut times, a-roll or cutaway, framing,
486
512
  camera and description; the script with who says each
487
- line; and the cast. No pictures
513
+ line; the cast; and how it is filmed. No pictures
488
514
  --look <slug> The new look (swipe write --mode new-look)
489
515
  --script <file> Your own script (swipe write --mode their-format)
490
516
  --kind <kind> A kind of ad in place of the one the template picked
@@ -527,9 +553,35 @@ swipe sheet is free too: the saved sheet, the choices the server keeps for a
527
553
  written swipe, and the swipe's page on the dashboard, which does not show the
528
554
  saved sheet yet. Each row says its value, where it comes from and why, and
529
555
  which step reads it. swipe sheet set <swipeId> <row>=<value> changes rows, all
530
- or none; <row>= clears one. The start copies the saved sheet into the video; a
556
+ or none; <row>= clears one. A choice that buys something is refused with its
557
+ price; set it again with --yes --people-max-usd <n>, the most that price
558
+ showed. The start copies the saved sheet into the video; a
531
559
  change after it is for the next video. A kind of ad with no sheet has nothing
532
- to set.
560
+ to set. swipe sheet price <swipeId> is free: the price of the video at the
561
+ sheet's rows and at each size and takes, with the most it can cost. swipe
562
+ start --max-usd <n> holds the start to the most a price showed: a start that
563
+ can now cost more is refused, and nothing is started.
564
+ swipe sheet people is paid, on the member's own keys: new people to pick from
565
+ for the person row, each one or two short text calls on their model key and one
566
+ face picture on their Kie key. Without --yes it says the price and what it buys
567
+ and makes nothing; --yes --max-usd <the price's most> makes them (--count 1 to
568
+ 8, 4 by default), --wait waits for them. Each is shown with their picture's
569
+ address; who=<n> picks one, and the video is then filmed with that person and
570
+ that face. swipe sheet voices makes one read of the voice list on the
571
+ member's ElevenLabs key, and no speech: the voices that fit the person, best
572
+ fit first, each with its sample's address and, when known, its age and accent,
573
+ and the one the voice row recommends; voice=<n> picks one, and the video is
574
+ filmed in it.
575
+ swipe write also makes people to pick from for a kind whose sheet has a person,
576
+ when the server offers them: without --yes it says their price too, and the
577
+ yes line carries their most (--people-max-usd <n>). The write then makes 4 on
578
+ the member's own keys once the script is stored, waits a few minutes for them
579
+ and shows each, with the one a check of the faces recommends. Inside the same
580
+ most it also reads the stored script for an animal it puts in the picture and
581
+ draws one picture of it: the sheet's row "The animal" shows it, and swipe sheet
582
+ set <swipeId> animal=none takes it out. --yes alone, or --no-people, writes
583
+ without them. swipe start waits while people or the animal are being made,
584
+ until 5 minutes after they were asked for.
533
585
  The template picks the kind of ad: swipe template prints it and its look, so
534
586
  ask the member before the write. A swipe run has no picks stop and no pilot
535
587
  clip; it stops at the storyboard unless --one-shot. --wait on swipe and swipe
@@ -542,11 +594,13 @@ switched on get these, on their own brands: start (--script, --conceit,
542
594
  --review-storyboard, --stop-at-script, --rewrite-to-fit), swipe (all of it
543
595
  but swipe start --title), status, storyboard, approve (the storyboard), voices,
544
596
  retry-frame --scene <n> (redo one scene's picture while the storyboard waits),
545
- pull (the finished video, each scene's clip and voice, and the music) and
546
- upload. These stay admin-only: start --video-model / --voice / --voice-path /
597
+ pull (the finished video, each scene's clip and voice, and the music),
598
+ upload and keep (a held scene as it is). These stay admin-only: start --video-model / --voice / --voice-path /
547
599
  --director, swipe start --title, director,
548
600
  status --rejected-draft, retry-clip, revoice, broll, map and move. start --broll
549
- works for whoever B-roll is switched on for.
601
+ works for whoever B-roll is switched on for. A stopped step's retry,
602
+ exodus workflow repair <runId> retry, needs an admin key today: a beta tester
603
+ uses Try again on the video's page.
550
604
  If a command answers "video isn't enabled for this key", the run id is wrong,
551
605
  the command is admin-only, or video isn't switched on for your dashboard user.
552
606
 
@@ -562,6 +616,7 @@ Examples:
562
616
  exodus video retry-clip run_123 --scene 3 --note "keep the handshake in frame"
563
617
  exodus video retry-clip run_123 --scene 3 --voice-first
564
618
  exodus video revoice run_123 --all
619
+ exodus video keep run_123 --scene 2
565
620
  exodus video picks run_123
566
621
  exodus video pick run_123 --face STRATEGIST=2 --voice STRATEGIST=3 --room OFFICE=4
567
622
  exodus video picks run_123 --redo face:STRATEGIST --note "older, greyer"
@@ -608,6 +663,8 @@ const VOICE_FIRST_NOT_ON_THIS_SERVER = "This Exodus server cannot redo a clip vo
608
663
  const REVOICE_NOT_ON_THIS_SERVER = "This Exodus server does not have the voice redo yet, so nothing was started and nothing " +
609
664
  "was spent. It arrives with the next server update.";
610
665
  export const FINAL_PATH = "/api/v2/video/final";
666
+ export const KEEP_SCENE_PATH = "/api/v2/video/keep-scene";
667
+ export const SPEND_ANSWER_PATH = "/api/v2/video/spend-answer";
611
668
  export const VOICES_PATH = "/api/v2/video/voices";
612
669
  export const PICKS_PATH = "/api/v2/video/picks";
613
670
  export const MAP_PATH = "/api/v2/video/map";
@@ -665,6 +722,17 @@ export function asVideoRun(data) {
665
722
  const run = (data ?? {});
666
723
  return { ...run, nodes: Array.isArray(run.nodes) ? run.nodes : [] };
667
724
  }
725
+ export function checkDownloadSize(received, headers) {
726
+ if (received === 0)
727
+ throw new Error("the download was empty");
728
+ const encoding = headers.get("content-encoding");
729
+ if (encoding && encoding !== "identity")
730
+ return;
731
+ const stated = Number(headers.get("content-length") ?? "");
732
+ if (Number.isFinite(stated) && stated > 0 && stated !== received) {
733
+ throw new Error(`the download came to ${received} bytes, not the ${stated} the server sent`);
734
+ }
735
+ }
668
736
  export const defaultDeps = {
669
737
  get: (p) => apiGet(p),
670
738
  post: (p, body) => apiPost(p, body),
@@ -676,7 +744,17 @@ export const defaultDeps = {
676
744
  const res = await fetch(url);
677
745
  if (!res.ok)
678
746
  throw new Error(`HTTP ${res.status}`);
679
- fs.writeFileSync(filePath, Buffer.from(await res.arrayBuffer()));
747
+ const bytes = Buffer.from(await res.arrayBuffer());
748
+ checkDownloadSize(bytes.length, res.headers);
749
+ const part = `${filePath}.part`;
750
+ try {
751
+ fs.writeFileSync(part, bytes);
752
+ fs.renameSync(part, filePath);
753
+ }
754
+ catch (err) {
755
+ fs.rmSync(part, { force: true });
756
+ throw err;
757
+ }
680
758
  },
681
759
  readFile: (filePath) => fs.readFileSync(filePath, "utf-8"),
682
760
  readFileBytes: (filePath) => fs.readFileSync(filePath),
@@ -707,6 +785,12 @@ export const defaultDeps = {
707
785
  now: () => Date.now(),
708
786
  dashboardUrl: getDashboardUrl(),
709
787
  };
788
+ function runNotYoursMessage(res) {
789
+ if (res.status !== 404)
790
+ return undefined;
791
+ const err = res.data?.error;
792
+ return err && err.code === "RUN_NOT_FOUND" && typeof err.message === "string" ? err.message : undefined;
793
+ }
710
794
  export const VIDEO_NOT_FOUND_MESSAGE = "video isn't enabled for this key\n" +
711
795
  "One of three things: that run id doesn't exist on this brand, this command is for admins only " +
712
796
  "(director, status --rejected-draft, retry-clip, revoice, broll), or video isn't " +
@@ -715,6 +799,9 @@ export function videoApiError(res) {
715
799
  const behind = missingRouteLine(res, "exodus video");
716
800
  if (behind)
717
801
  return behind;
802
+ const notYours = runNotYoursMessage(res);
803
+ if (notYours)
804
+ return notYours;
718
805
  if (res.status === 404)
719
806
  return VIDEO_NOT_FOUND_MESSAGE;
720
807
  return formatApiError(res);
@@ -794,6 +881,11 @@ function parkedByBuilderCheckpoint(run) {
794
881
  function parkedAtStoryboardGate(run, pausedNode) {
795
882
  return !parkedByBuilderCheckpoint(run) && GATE_NODE_KINDS.has(pausedNode.kind);
796
883
  }
884
+ function noPictureBeforeApproval(run, pausedNode) {
885
+ return (run.moduleKey === "script-video" &&
886
+ pausedNode.kind === "storyboard" &&
887
+ !run.nodes.some((n) => n.kind === "scene-frames" && n.status !== "out-of-scope"));
888
+ }
797
889
  function parkedAtFinalWatch(run) {
798
890
  return (!parkedByBuilderCheckpoint(run) &&
799
891
  run.nodes.some((n) => n.kind === "video" && n.status === "done"));
@@ -815,7 +907,7 @@ export function classifyRun(run) {
815
907
  if (isWorkerStoppedPark(run))
816
908
  return { at: "failed", repair: true, workerStopped: true };
817
909
  if (run.pauseReason === "repair") {
818
- const deadNode = run.nodes.find((n) => n.status === "failed");
910
+ const deadNode = run.nodes.find((n) => n.status === "failed" && n.memberStop?.retry === false) ?? run.nodes.find((n) => n.status === "failed");
819
911
  const why = deadNode?.error ?? run.error;
820
912
  return {
821
913
  at: "failed",
@@ -823,6 +915,7 @@ export function classifyRun(run) {
823
915
  nodeId: deadNode?.nodeId ?? run.pausedNodeId,
824
916
  ...(deadNode?.kind ? { step: deadNode.kind } : {}),
825
917
  ...(why ? { error: why } : {}),
918
+ ...(deadNode?.memberStop ? { memberStop: deadNode.memberStop } : {}),
826
919
  };
827
920
  }
828
921
  if (run.pauseReason === "pilot") {
@@ -854,6 +947,7 @@ export function classifyRun(run) {
854
947
  ...(isShowAd(run) ? { showAd: true } : {}),
855
948
  ...(held ? { heldReason: held } : {}),
856
949
  ...(run.blockingMap === true ? { blockingMap: true } : {}),
950
+ ...(noPictureBeforeApproval(run, pausedNode) ? { noPictureBeforeApproval: true } : {}),
857
951
  };
858
952
  }
859
953
  if (parkedAtFinalWatch(run)) {
@@ -877,6 +971,10 @@ export function classifyRun(run) {
877
971
  ...(missingScenes.length > 0 ? { missingScenes } : {}),
878
972
  ...(missingScenes.length > 0 && framesNodeId ? { framesNodeId } : {}),
879
973
  ...(run.cutHeldScenes?.length ? { heldScenes: run.cutHeldScenes } : {}),
974
+ ...(run.cutFailure?.sentence ? { cutFailure: run.cutFailure.sentence } : {}),
975
+ ...(run.appCut === "making" ? { appMakesCut: true } : {}),
976
+ ...(appCutOutdates(run) ? { appOutdatesCut: true } : {}),
977
+ ...(run.launchDoor === "template" ? { fromTemplate: true } : {}),
880
978
  };
881
979
  }
882
980
  return { at: "paused", nodeId: run.pausedNodeId, reason: run.pauseReason };
@@ -899,6 +997,40 @@ export function scenesBeingRedone(run, items) {
899
997
  }
900
998
  return [...scenes].sort((a, b) => a - b);
901
999
  }
1000
+ export function heldTakesOf(scenes, items) {
1001
+ if (!scenes?.length || !items)
1002
+ return [];
1003
+ return scenes.flatMap((sceneIndex) => {
1004
+ const said = holdSentenceOf(latestClipRow(items, sceneIndex));
1005
+ return said !== null ? [{ sceneIndex, sentence: said }] : [];
1006
+ });
1007
+ }
1008
+ const FAULT_AFTER_REDO_CODE = "fault-after-redo";
1009
+ function latestClipRow(items, sceneIndex) {
1010
+ return items
1011
+ .filter((i) => i.itemKind === "clip" && i.sceneIndex === sceneIndex)
1012
+ .reduce((best, i) => (!best || (i.attempt ?? 0) >= (best.attempt ?? 0) ? i : best), undefined);
1013
+ }
1014
+ function holdSentenceOf(row) {
1015
+ const said = (row?.findings ?? [])
1016
+ .filter((f) => ONE_TAKE_HOLD_CODES.includes(f.code) && f.detail.trim())
1017
+ .map((f) => f.detail.trim());
1018
+ return said.length > 0 ? said.join(" ") : null;
1019
+ }
1020
+ export function flaggedHeldTakesOf(items) {
1021
+ if (!items)
1022
+ return [];
1023
+ const scenes = [...new Set(items.filter((i) => i.itemKind === "clip" && isPullSceneIndex(i.sceneIndex)).map((i) => i.sceneIndex))];
1024
+ return scenes
1025
+ .sort((a, b) => a - b)
1026
+ .flatMap((sceneIndex) => {
1027
+ const latest = latestClipRow(items, sceneIndex);
1028
+ if (!latest || latest.status !== "done" || latest.flagged !== true || latest.acceptedAsIs)
1029
+ return [];
1030
+ const said = holdSentenceOf(latest);
1031
+ return said !== null ? [{ sceneIndex, sentence: said }] : [];
1032
+ });
1033
+ }
902
1034
  export function resolveStop(stop, cutAttached, items) {
903
1035
  if (stop.at === "pilot") {
904
1036
  if (!items)
@@ -907,9 +1039,57 @@ export function resolveStop(stop, cutAttached, items) {
907
1039
  const hasLine = (n) => (stop.silentScenes?.includes(n) ? false : undefined);
908
1040
  return { ...stop, checks: stop.sceneIndexes.map((n) => pilotCheck(n, clipOf(n), hasLine(n))) };
909
1041
  }
1042
+ if (stop.at === "storyboard-gate") {
1043
+ const place = stop.noPictureBeforeApproval ? placeAtStop(items, stop.nodeId) : undefined;
1044
+ return place ? { ...stop, place } : stop;
1045
+ }
910
1046
  if (stop.at !== "final-watch")
911
1047
  return stop;
912
- return { ...stop, cutAttached };
1048
+ const named = heldTakesOf(stop.heldScenes, items);
1049
+ const fromRows = cutAttached === false
1050
+ ? flaggedHeldTakesOf(items).filter((t) => !(stop.heldScenes ?? []).includes(t.sceneIndex))
1051
+ : [];
1052
+ const heldTakes = fromRows.length > 0 ? [...named, ...fromRows].sort((a, b) => a.sceneIndex - b.sceneIndex) : named;
1053
+ const heldScenes = fromRows.length > 0
1054
+ ? [...(stop.heldScenes ?? []), ...fromRows.map((t) => t.sceneIndex)].sort((a, b) => a - b)
1055
+ : stop.heldScenes;
1056
+ const redoFaultScenes = items && heldScenes?.length
1057
+ ? heldScenes.filter((scene) => {
1058
+ const row = latestClipRow(items, scene);
1059
+ return !row || row.findings?.some((f) => f.code === FAULT_AFTER_REDO_CODE) === true;
1060
+ })
1061
+ : undefined;
1062
+ return {
1063
+ ...stop,
1064
+ cutAttached,
1065
+ ...(heldScenes?.length ? { heldScenes } : {}),
1066
+ ...(heldTakes.length > 0 ? { heldTakes } : {}),
1067
+ ...(redoFaultScenes !== undefined ? { redoFaultScenes } : {}),
1068
+ ...(items && hasAppCut(items) ? { appCutOnRun: true } : {}),
1069
+ };
1070
+ }
1071
+ function placeAtStop(items, boardNodeId) {
1072
+ const row = items?.find((i) => i.nodeId === boardNodeId && i.itemKind === "frame" && i.sceneIndex === ONE_TAKE_BOARD_PLACE_LEDGER_INDEX);
1073
+ if (row?.status === "done" && row.artifact?.type === "image" && row.artifact.imageUrl)
1074
+ return { imageUrl: row.artifact.imageUrl };
1075
+ if (row?.status === "failed")
1076
+ return { imageUrl: null };
1077
+ return undefined;
1078
+ }
1079
+ export function appCutOutdates(run) {
1080
+ return run.appCut === "making" && run.moduleKey === "script-video";
1081
+ }
1082
+ function hasAppCut(items) {
1083
+ return items.some((i) => i.itemKind === "final" && i.status === "done" && i.artifact?.type === "video" && i.artifact.autoCut === true);
1084
+ }
1085
+ export function appIsCutting(stop) {
1086
+ return (stop.at === "final-watch" &&
1087
+ stop.appMakesCut === true &&
1088
+ !stop.missingScenes?.length &&
1089
+ !stop.heldScenes?.length &&
1090
+ !stop.cutFailure &&
1091
+ stop.cutAttached !== null &&
1092
+ (!stop.cutAttached || (stop.appCutOnRun === true && stop.appOutdatesCut === true)));
913
1093
  }
914
1094
  export async function resolveStopAtPark(stop, runId, deps) {
915
1095
  if (stop.at !== "final-watch" && stop.at !== "pilot")
@@ -977,14 +1157,42 @@ function missingSceneLines(missing, framesNodeId, runId, runUrl) {
977
1157
  lines.push("The ad can't be approved until every scene has a clip.", `Watch it here: ${runUrl}`);
978
1158
  return lines;
979
1159
  }
980
- function heldSceneLines(scenes, runId, videoPage) {
1160
+ function heldSceneLines(scenes, runId, videoPage, heldTakes = [], redoFaultScenes) {
1161
+ const takes = scenes.filter((scene) => heldTakes.some((t) => t.sceneIndex === scene));
1162
+ const faults = scenes.filter((scene) => !takes.includes(scene));
1163
+ return [...heldTakeLines(takes, heldTakes, runId, videoPage), ...(faults.length > 0 ? drawingFaultLines(faults, runId, videoPage, redoFaultScenes) : [])];
1164
+ }
1165
+ function heldTakeLines(takes, heldTakes, runId, videoPage) {
1166
+ if (takes.length === 0)
1167
+ return [];
1168
+ const one = takes.length === 1;
1169
+ const phrase = scenesPhrase(takes).replace(/^scenes?/, (word) => (word === "scene" ? "take" : "takes"));
1170
+ return [
1171
+ `Held: ${phrase} ${one ? "was" : "were"} kept for you to watch, so the final video wasn't made.`,
1172
+ ...takes.map((scene) => heldTakes.find((t) => t.sceneIndex === scene).sentence),
1173
+ ...takes.map((scene) => one
1174
+ ? `Keep it as it is: exodus video keep ${runId} --scene ${scene}`
1175
+ : `Keep take ${scene} as it is: exodus video keep ${runId} --scene ${scene}`),
1176
+ `${one ? "Watch it first: " : "Watch them first:"} ${videoPage}`,
1177
+ ];
1178
+ }
1179
+ function drawingFaultLines(scenes, runId, videoPage, redoFaultScenes) {
981
1180
  const one = scenes.length === 1;
1181
+ const redone = redoFaultScenes === undefined ? scenes : scenes.filter((scene) => redoFaultScenes.includes(scene));
1182
+ const checked = scenes.filter((scene) => !redone.includes(scene));
1183
+ const heldWhy = [
1184
+ ...(redone.length > 0
1185
+ ? [`${scenesPhrase(redone)} still ${redone.length === 1 ? "has" : "have"} a drawing fault after ${redone.length === 1 ? "it was" : "they were"} made again`]
1186
+ : []),
1187
+ ...(checked.length > 0 ? [`${scenesPhrase(checked)} failed a check`] : []),
1188
+ ].join(", and ");
982
1189
  return [
983
- `Held: ${scenesPhrase(scenes)} still ${one ? "has" : "have"} a drawing fault after ${one ? "it was" : "they were"} made again, so the final video wasn't made.`,
1190
+ `Held: ${heldWhy}, so the final video wasn't made.`,
984
1191
  ...scenes.map((scene) => one
985
1192
  ? `Remake it: exodus video retry-clip ${runId} --scene ${scene}`
986
1193
  : `Remake scene ${scene}: exodus video retry-clip ${runId} --scene ${scene}`),
987
- `${one ? "Keep it as it is" : "Keep them as they are"}: on the video's page, ${videoPage}`,
1194
+ ...scenes.map((scene) => one ? `Keep it as it is: exodus video keep ${runId} --scene ${scene}` : `Keep scene ${scene} as it is: exodus video keep ${runId} --scene ${scene}`),
1195
+ `Or on the video's page: ${videoPage}`,
988
1196
  ];
989
1197
  }
990
1198
  function pilotLines(stop, runId, runUrl) {
@@ -1048,9 +1256,26 @@ export function stopLines(stop, runId, runUrl, videoPage) {
1048
1256
  if (stop.at === "storyboard-gate") {
1049
1257
  const lines = [
1050
1258
  ...(stop.heldReason ? [stop.heldReason] : []),
1051
- "Parked: the storyboard is waiting for your yes.",
1052
- `Read it: exodus video storyboard ${runId}`,
1053
- `Approve it: exodus video approve ${runId}`,
1259
+ ...(stop.noPictureBeforeApproval && stop.place
1260
+ ? [
1261
+ "Parked: the script, the place and the voice are waiting for your yes. No take is filmed before you approve.",
1262
+ stop.place.imageUrl
1263
+ ? `The place: ${stop.place.imageUrl}`
1264
+ : "The picture of the place didn't come out. It is drawn when you approve, before the takes are filmed.",
1265
+ `Read them: exodus video storyboard ${runId}`,
1266
+ `Approve them: exodus video approve ${runId}`,
1267
+ ]
1268
+ : stop.noPictureBeforeApproval
1269
+ ? [
1270
+ "Parked: the script and the voice are waiting for your yes. No take gets a picture before you approve.",
1271
+ `Read them: exodus video storyboard ${runId}`,
1272
+ `Approve them: exodus video approve ${runId}`,
1273
+ ]
1274
+ : [
1275
+ "Parked: the storyboard is waiting for your yes.",
1276
+ `Read it: exodus video storyboard ${runId}`,
1277
+ `Approve it: exodus video approve ${runId}`,
1278
+ ]),
1054
1279
  ];
1055
1280
  if (stop.showAd) {
1056
1281
  lines.push(`Send back: exodus video flag ${runId} --note "what's wrong"`);
@@ -1067,7 +1292,17 @@ export function stopLines(stop, runId, runUrl, videoPage) {
1067
1292
  return missingSceneLines(stop.missingScenes, stop.framesNodeId, runId, runUrl);
1068
1293
  }
1069
1294
  if (stop.heldScenes?.length)
1070
- return heldSceneLines(stop.heldScenes, runId, videoPage);
1295
+ return heldSceneLines(stop.heldScenes, runId, videoPage, stop.heldTakes, stop.redoFaultScenes);
1296
+ if (stop.cutFailure) {
1297
+ return [
1298
+ "Parked: every piece is made, but the app's cut of them didn't work.",
1299
+ stop.cutFailure,
1300
+ `Cut it again on the video's page. It makes no new clips and costs nothing: ${videoPage}`,
1301
+ `Or cut it yourself: exodus video pull ${runId} --out ./ad-${runId}`,
1302
+ `Then upload: exodus video upload ${runId} --file cut.mp4`,
1303
+ `Watch it here: ${runUrl}`,
1304
+ ];
1305
+ }
1071
1306
  if (stop.cutAttached === null) {
1072
1307
  return [
1073
1308
  "Parked: every piece is made.",
@@ -1075,10 +1310,35 @@ export function stopLines(stop, runId, runUrl, videoPage) {
1075
1310
  `Watch it here: ${runUrl}`,
1076
1311
  ];
1077
1312
  }
1313
+ if (appIsCutting(stop)) {
1314
+ if (stop.redoingScenes?.length) {
1315
+ const many = stop.redoingScenes.length > 1;
1316
+ return [
1317
+ `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}`,
1318
+ `Watch it here: ${runUrl}`,
1319
+ ];
1320
+ }
1321
+ return [
1322
+ stop.cutAttached
1323
+ ? `Every piece is made. The app makes the cut again now; look again in a minute: exodus video status ${runId}`
1324
+ : `Every piece is made. The app makes the cut now; look again in a minute: exodus video status ${runId}`,
1325
+ `Watch it here: ${runUrl}`,
1326
+ ];
1327
+ }
1078
1328
  if (stop.cutAttached) {
1329
+ if (stop.appCutOnRun) {
1330
+ return [
1331
+ "Parked: the app's cut is made and waiting for your approval.",
1332
+ `Approve it: exodus video approve ${runId}`,
1333
+ ...finalApproveLines(stop.fromTemplate === true),
1334
+ `Watch it here: ${runUrl}`,
1335
+ "Changed your mind? A clip redo, where the run allows one, has the app make the cut again; a one-take take is filmed again only by a new run.",
1336
+ ];
1337
+ }
1079
1338
  return [
1080
1339
  "Parked: your cut is uploaded and waiting for your approval.",
1081
1340
  `Approve it: exodus video approve ${runId}`,
1341
+ ...finalApproveLines(stop.fromTemplate === true),
1082
1342
  `Watch it here: ${runUrl}`,
1083
1343
  "Changed your mind? You can still redo a clip and upload a new cut.",
1084
1344
  ];
@@ -1107,6 +1367,14 @@ export function stopLines(stop, runId, runUrl, videoPage) {
1107
1367
  `Open the run: ${runUrl}`,
1108
1368
  ];
1109
1369
  }
1370
+ if (stop.memberStop) {
1371
+ const lines = [`${stepName(stop.step)} stopped: ${stop.memberStop.sentence}`];
1372
+ if (stop.error && stop.error !== stop.memberStop.sentence)
1373
+ lines.push(`What the step said: ${stop.error}`);
1374
+ return stop.memberStop.retry
1375
+ ? [...lines, `Try that step again: exodus workflow repair ${runId} retry`, `Or open the run: ${runUrl}`]
1376
+ : [...lines, `Open the run: ${runUrl}`];
1377
+ }
1110
1378
  return [
1111
1379
  `${stepName(stop.step)} failed${stop.error ? `: ${stop.error}` : "."}`,
1112
1380
  `Try that step again: exodus workflow repair ${runId} retry`,
@@ -1640,6 +1908,8 @@ export function planPull(run, items, opts) {
1640
1908
  };
1641
1909
  });
1642
1910
  const { cast, downloads: castDownloads } = planCastRefs(run, items, castVoicePins(storyboardArtifact));
1911
+ const finishedUrl = opts.piecesOnly || appCutOutdates(run) ? undefined : finishedVideoUrl(items);
1912
+ const finished = finishedUrl ? { file: `video.${extFor(finishedUrl, "video")}`, url: finishedUrl } : null;
1643
1913
  const downloads = [
1644
1914
  ...(reference ? [reference] : []),
1645
1915
  ...(productSheet ? [productSheet] : []),
@@ -1651,6 +1921,7 @@ export function planPull(run, items, opts) {
1651
1921
  ...[...clipByScene.values()].map((c) => c.download),
1652
1922
  ...(music ? [music] : []),
1653
1923
  ...castDownloads,
1924
+ ...(finished ? [finished] : []),
1654
1925
  ];
1655
1926
  return {
1656
1927
  downloads,
@@ -1696,11 +1967,40 @@ export function planPull(run, items, opts) {
1696
1967
  ...(run.videoChoice?.videoModel === "template-video" && run.heldSong === true
1697
1968
  ? { wholeVoice: true, templateMotion: { enabled: true } } : {}),
1698
1969
  ...(run.shots?.frame || run.shots?.pacing ? { shots: run.shots } : {}),
1970
+ ...(finished ? { video: finished.file } : {}),
1699
1971
  },
1700
1972
  };
1701
1973
  }
1974
+ function finishedVideoUrl(items) {
1975
+ const finals = items.filter((i) => i.itemKind === "final" && i.status === "done" && i.artifact?.type === "video");
1976
+ return finals.length === 1 && finals[0].artifact?.type === "video" ? finals[0].artifact.videoUrl || undefined : undefined;
1977
+ }
1978
+ function appCutsRun(run, items) {
1979
+ return run.appCut !== undefined || hasAppCut(items);
1980
+ }
1981
+ function fingerprintInFolder(dir, file, deps) {
1982
+ if (!file || deps.statFile(path.join(dir, file)) === null)
1983
+ return null;
1984
+ return createHash("sha256").update(deps.readFileBytes(path.join(dir, file))).digest("hex");
1985
+ }
1986
+ function replacedVideoLines(dir, file, before, deps) {
1987
+ if (!file || before === null)
1988
+ return [];
1989
+ const after = fingerprintInFolder(dir, file, deps);
1990
+ return after !== null && after !== before
1991
+ ? [`A different ${file} was already in ${dir}; the pull replaced it with this run's finished video.`]
1992
+ : [];
1993
+ }
1994
+ function runStopped(run) {
1995
+ return run.status === "failed" || run.status === "cancelled" || run.status === "canceled";
1996
+ }
1997
+ function deliveredLine(dir, video) {
1998
+ return video ? `This run is delivered. The finished video is ${path.join(dir, video)}.` : "This run is delivered.";
1999
+ }
1702
2000
  export function markPullFailure(manifest, failure) {
1703
2001
  manifest.failed.push(failure);
2002
+ if (manifest.video === failure.file)
2003
+ manifest.video = null;
1704
2004
  if (manifest.storyboard === failure.file)
1705
2005
  manifest.storyboard = null;
1706
2006
  if (manifest.reference === failure.file)
@@ -1852,7 +2152,7 @@ export async function startFlow(opts, deps) {
1852
2152
  return { code: 1, lines: ["The server started the ad but did not say which run it is."] };
1853
2153
  }
1854
2154
  const runId = started.runId;
1855
- const url = started.url ?? reviewUrl(deps.dashboardUrl, { _id: runId });
2155
+ const url = started.url ? onOwnDashboard(started.url, deps.dashboardUrl) : reviewUrl(deps.dashboardUrl, { _id: runId });
1856
2156
  if (!opts.wait) {
1857
2157
  const lines = [
1858
2158
  `Started ad run ${runId}`,
@@ -1980,6 +2280,12 @@ export function planVideoStart(flags, occurrences) {
1980
2280
  const planFlag = planValueFlag(occurrences, "adaptation-plan");
1981
2281
  if (!planFlag.ok)
1982
2282
  return { kind: "usage", line: planFlag.line };
2283
+ const maxUsdFlag = planValueFlag(occurrences, "max-usd");
2284
+ if (!maxUsdFlag.ok)
2285
+ return { kind: "usage", line: maxUsdFlag.line };
2286
+ if (maxUsdFlag.value !== undefined && !(Number(maxUsdFlag.value) > 0)) {
2287
+ return { kind: "usage", line: "video start --max-usd must be the price the start showed, in dollars (e.g. 15.56)." };
2288
+ }
1983
2289
  const resumeFlag = planTemplateValue(occurrences, "resume-script");
1984
2290
  if (!resumeFlag.ok)
1985
2291
  return { kind: "usage", line: resumeFlag.line };
@@ -2260,6 +2566,10 @@ export function planVideoStart(flags, occurrences) {
2260
2566
  opts.music = musicChoice.music;
2261
2567
  if (!oneShot)
2262
2568
  opts.reviewStoryboard = true;
2569
+ if (occurrences.some((o) => o.flag === "yes"))
2570
+ opts.yes = true;
2571
+ if (maxUsdFlag.value !== undefined)
2572
+ opts.maxUsd = Number(maxUsdFlag.value);
2263
2573
  if (director)
2264
2574
  opts.director = true;
2265
2575
  if (broll)
@@ -3504,6 +3814,8 @@ export async function startScriptFlow(opts, deps) {
3504
3814
  ...(voices.voiceMode !== undefined ? { voiceMode: voices.voiceMode } : {}),
3505
3815
  ...(templateIntent ? (music !== undefined ? { music } : {}) : music === true ? { music: true } : {}),
3506
3816
  ...(opts.reviewStoryboard ? { reviewStoryboard: true } : {}),
3817
+ ...(opts.yes ? { yes: true } : {}),
3818
+ ...(opts.maxUsd !== undefined ? { maxUsd: opts.maxUsd } : {}),
3507
3819
  ...(opts.director ? { director: true } : {}),
3508
3820
  ...(opts.broll ? { broll: true } : {}),
3509
3821
  ...(shots ? { shots } : {}),
@@ -3564,7 +3876,7 @@ export async function startScriptFlow(opts, deps) {
3564
3876
  return { code: 1, lines: ["The server started the ad but did not say which run it is."] };
3565
3877
  }
3566
3878
  const runId = started.runId;
3567
- const url = typeof started.url === "string" ? started.url : "";
3879
+ const url = typeof started.url === "string" ? onOwnDashboard(started.url, deps.dashboardUrl) : "";
3568
3880
  const card = isResolvedCard(started.card) ? started.card : null;
3569
3881
  const video = startedVideoChoice(started.videoChoice);
3570
3882
  const tidied = started.tidied === undefined ? null : scriptTidiedOf(started.tidied);
@@ -3607,7 +3919,8 @@ export async function startScriptFlow(opts, deps) {
3607
3919
  return opts.json ? waitJsonWith(waited, facts) : waited;
3608
3920
  }
3609
3921
  async function customerStartedResult(started, opts, deps) {
3610
- const { runId, dashboardUrl } = started;
3922
+ const { runId } = started;
3923
+ const dashboardUrl = customerRunPage(deps.dashboardUrl, runId);
3611
3924
  const tidied = started.tidied === undefined ? null : scriptTidiedOf(started.tidied);
3612
3925
  const written = writtenOf(started.written);
3613
3926
  const rewritten = writtenOf(started.rewritten);
@@ -3645,6 +3958,8 @@ async function customerStartedResult(started, opts, deps) {
3645
3958
  }
3646
3959
  const POLL_INTERVAL_MS = 5000;
3647
3960
  const MAX_POLLS = 720;
3961
+ const WAIT_MAX_MISSES = 3;
3962
+ export const WAIT_LOST_CODE = 2;
3648
3963
  export async function waitFlow(runId, opts, deps) {
3649
3964
  const interval = opts.intervalMs ?? POLL_INTERVAL_MS;
3650
3965
  const maxPolls = opts.maxPolls ?? MAX_POLLS;
@@ -3662,17 +3977,38 @@ export async function waitFlow(runId, opts, deps) {
3662
3977
  else
3663
3978
  lines.push(line);
3664
3979
  };
3980
+ let misses = 0;
3665
3981
  for (let poll = 0; poll < maxPolls; poll++) {
3666
- if (poll > 0)
3982
+ if (poll > 0 || misses > 0)
3667
3983
  await deps.sleep(interval);
3668
- const res = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`);
3984
+ const res = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`).catch(() => null);
3985
+ if (res === null || res.status >= 500 || res.status === 429) {
3986
+ if (++misses < WAIT_MAX_MISSES) {
3987
+ poll -= 1;
3988
+ continue;
3989
+ }
3990
+ const lost = `The server did not answer three times in a row, so the wait stopped. The run goes on; look again with: exodus video wait ${runId}`;
3991
+ return {
3992
+ code: WAIT_LOST_CODE,
3993
+ lines: opts.json ? [JSON.stringify({ runId, stop: { at: "running" }, lost: true })] : [...lines, lost],
3994
+ };
3995
+ }
3996
+ misses = 0;
3669
3997
  if (!res.ok) {
3670
3998
  const failed = errorResult(res, opts.json);
3671
- return { code: failed.code, lines: [...lines, ...failed.lines] };
3999
+ return { code: failed.code, lines: opts.json ? failed.lines : [...lines, ...failed.lines] };
3672
4000
  }
3673
4001
  const customer = customerAnswer(res.data);
3674
4002
  if (customer) {
3675
4003
  const page = customerRunPage(deps.dashboardUrl, runId);
4004
+ if (customer.spendAsk) {
4005
+ return {
4006
+ code: 0,
4007
+ lines: opts.json
4008
+ ? [JSON.stringify(customer)]
4009
+ : [...lines, ...spendAskLines(customer, runId), `Watch it on the dashboard: ${page}`],
4010
+ };
4011
+ }
3676
4012
  if (customerStageIsWorking(customer.stage) && !customer.templateApproval?.audition) {
3677
4013
  progress(customerStageLines(customer, page)[0]);
3678
4014
  continue;
@@ -3686,6 +4022,14 @@ export async function waitFlow(runId, opts, deps) {
3686
4022
  }
3687
4023
  const run = asVideoRun(res.data);
3688
4024
  const stop = classifyRun(run);
4025
+ if (run.spendAsk) {
4026
+ return {
4027
+ code: 0,
4028
+ lines: opts.json
4029
+ ? [JSON.stringify({ runId, stop, spendAsk: run.spendAsk, status: run.status, url: opts.url })]
4030
+ : [...lines, ...spendAskLines(run, runId), `Open it: ${reviewUrl(deps.dashboardUrl, run)}`],
4031
+ };
4032
+ }
3689
4033
  if (stop.at === "running") {
3690
4034
  progress(stop.autoRedoScenes?.length
3691
4035
  ? autoRedoLine(stop.autoRedoScenes, stop.autoRedoReasons)
@@ -3693,6 +4037,10 @@ export async function waitFlow(runId, opts, deps) {
3693
4037
  continue;
3694
4038
  }
3695
4039
  let items = null;
4040
+ if (stop.at === "storyboard-gate" && stop.noPictureBeforeApproval) {
4041
+ const itemsRes = await deps.get(`${ITEMS_PATH}?runId=${encodeURIComponent(runId)}`).catch(() => null);
4042
+ items = itemsRes?.ok ? (itemsRes.data.items ?? []) : null;
4043
+ }
3696
4044
  if (stop.at === "pilot") {
3697
4045
  const itemsRes = await deps.get(`${ITEMS_PATH}?runId=${encodeURIComponent(runId)}`);
3698
4046
  items = itemsRes.ok ? (itemsRes.data.items ?? []) : null;
@@ -3710,6 +4058,10 @@ export async function waitFlow(runId, opts, deps) {
3710
4058
  }
3711
4059
  }
3712
4060
  const resolved = resolveStop(stop, items ? hasAttachedCut(items) : null, items);
4061
+ if (appIsCutting(resolved)) {
4062
+ progress("Working: the app makes the cut…");
4063
+ continue;
4064
+ }
3713
4065
  if (opts.json) {
3714
4066
  return {
3715
4067
  code: stop.at === "failed" ? 1 : 0,
@@ -3747,11 +4099,31 @@ function itemWord(item) {
3747
4099
  return "flagged";
3748
4100
  return ITEM_STATUS_WORD[item.status] ?? item.status;
3749
4101
  }
3750
- const CARRYING_ON_LINE = "Waiting for a worker to carry on. Everything finished so far is kept — the run picks up from there by itself.";
4102
+ const APP_CUT_SIZE_LINE = "The app's cut is 1080x1920, whatever size the clips were filmed at.";
4103
+ const HELD_CHOICE_TAIL = "is kept for you to watch: keep it as it is, or start a new run to film it again.";
4104
+ const KEPT_TAIL = "was kept as it is.";
4105
+ function heldChoiceMade(text) {
4106
+ return text.split(HELD_CHOICE_TAIL).join(KEPT_TAIL);
4107
+ }
4108
+ const BY_DESIGN_WARNINGS = new Set([
4109
+ "this ad has no narration track — its voices live in the scenes themselves, so there was nothing to voice over. Your ad is unaffected.",
4110
+ ]);
4111
+ function byDesign(node) {
4112
+ return (node !== undefined &&
4113
+ node.kind === "voiceover" &&
4114
+ node.status === "done" &&
4115
+ (node.outputs ?? []).length === 0 &&
4116
+ node.warning !== undefined &&
4117
+ BY_DESIGN_WARNINGS.has(node.warning));
4118
+ }
4119
+ const CARRYING_ON_LINE = "Waiting for a worker to carry on. The run is still going: what it made so far is kept, and it picks up from there by itself.";
3751
4120
  function carryingOn(run) {
3752
4121
  return (run.status === "queued" &&
3753
4122
  run.nodes.some((n) => n.status !== "idle" && n.status !== "out-of-scope"));
3754
4123
  }
4124
+ function cutDeliversItself(run, stop) {
4125
+ return run.storyboardAutoApprove === true && stop.at === "running";
4126
+ }
3755
4127
  export async function statusFlow(runId, json, deps) {
3756
4128
  const runRes = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`);
3757
4129
  if (!runRes.ok)
@@ -3769,7 +4141,9 @@ export async function statusFlow(runId, json, deps) {
3769
4141
  return errorResult(itemsRes, json);
3770
4142
  const items = itemsRes.data.items ?? [];
3771
4143
  const hasFinal = hasAttachedCut(items);
3772
- const stop = resolveStop(classifyRun(run), hasFinal, items);
4144
+ const resolved = resolveStop(classifyRun(run), hasFinal, items);
4145
+ const redoingScenes = resolved.at === "final-watch" ? scenesBeingRedone(run, items) : [];
4146
+ const stop = resolved.at === "final-watch" && redoingScenes.length > 0 ? { ...resolved, redoingScenes } : resolved;
3773
4147
  const failedStoryboard = failedStoryboardNode(run);
3774
4148
  const guidance = stopLines(stop.at === "failed" && errorEchoesReasons(stop.error, failedStoryboard?.planFailure)
3775
4149
  ? { ...stop, error: undefined }
@@ -3777,6 +4151,13 @@ export async function statusFlow(runId, json, deps) {
3777
4151
  const warnings = run.nodes
3778
4152
  .filter((n) => n.warning)
3779
4153
  .map((n) => ({ nodeId: n.nodeId, step: n.kind, warning: n.warning }));
4154
+ const delivered = stop.at === "finished" && !runStopped(run);
4155
+ const holdRows = items.filter((i) => i.itemKind === "clip" && i.findings?.some((f) => f.detail.includes(HELD_CHOICE_TAIL)));
4156
+ const choiceMade = (row) => delivered || row?.acceptedAsIs !== undefined;
4157
+ const everyHoldKept = delivered || (holdRows.length > 0 && holdRows.every((r) => r.acceptedAsIs !== undefined));
4158
+ const said = warnings
4159
+ .filter((w) => !byDesign(run.nodes.find((n) => n.nodeId === w.nodeId)))
4160
+ .map((w) => (everyHoldKept && w.warning ? { ...w, warning: heldChoiceMade(w.warning) } : w));
3780
4161
  if (json) {
3781
4162
  return {
3782
4163
  code: 0,
@@ -3796,6 +4177,7 @@ export async function statusFlow(runId, json, deps) {
3796
4177
  : {}),
3797
4178
  ...(failedStoryboard?.hasRejectedDraft === true ? { hasRejectedDraft: true } : {}),
3798
4179
  ...(run.director ? { director: run.director } : {}),
4180
+ ...(run.cutCheck?.length ? { cutCheck: run.cutCheck } : {}),
3799
4181
  }),
3800
4182
  ],
3801
4183
  };
@@ -3844,9 +4226,9 @@ export async function statusFlow(runId, json, deps) {
3844
4226
  headline,
3845
4227
  ...(carryingOn(run) ? [CARRYING_ON_LINE] : []),
3846
4228
  ...guidance,
3847
- ...(stop.at === "running" && run.pauseAhead ? [pauseAheadLine(run.pauseAhead)] : []),
4229
+ ...(stop.at === "running" && run.pauseAhead ? [pauseAheadLine(run.pauseAhead, { placeFirst: boardDrawsThePlaceFirst(run) })] : []),
3848
4230
  ...planFailureLines(failedStoryboard, runId),
3849
- ...warnings.map((w) => `Heads-up (${w.step}): ${w.warning}`),
4231
+ ...said.map((w) => `Heads-up (${w.step}): ${w.warning}`),
3850
4232
  ...(run.director ? ["", ...directorLines(run.director)] : []),
3851
4233
  ];
3852
4234
  if (byScene.size === 0) {
@@ -3854,6 +4236,7 @@ export async function statusFlow(runId, json, deps) {
3854
4236
  }
3855
4237
  else {
3856
4238
  lines.push("", "Scene Clip Voice Picture");
4239
+ let allFlippedSaid = false;
3857
4240
  for (const sceneIndex of [...byScene.keys()].sort((a, b) => a - b)) {
3858
4241
  const row = byScene.get(sceneIndex);
3859
4242
  lines.push(`${String(sceneIndex).padEnd(5)} ${itemWord(row.clip).padEnd(8)} ${itemWord(row.voiceover).padEnd(8)} ${itemWord(row.frame)}`);
@@ -3877,7 +4260,17 @@ export async function statusFlow(runId, json, deps) {
3877
4260
  }
3878
4261
  if (row.frame?.lastRedo)
3879
4262
  lines.push(` picture: ${row.frame.lastRedo.label}`);
3880
- for (const finding of row.clip?.findings ?? []) {
4263
+ for (const found of row.clip?.findings ?? []) {
4264
+ const finding = choiceMade(row.clip) ? { ...found, detail: heldChoiceMade(found.detail) } : found;
4265
+ if (ONE_TAKE_PLAIN_FINDING_CODES.includes(finding.code)) {
4266
+ if (finding.code === ONE_TAKE_LABEL_ALL_FLIPPED_CODE) {
4267
+ if (allFlippedSaid)
4268
+ continue;
4269
+ allFlippedSaid = true;
4270
+ }
4271
+ lines.push(` ${finding.detail}`);
4272
+ continue;
4273
+ }
3881
4274
  lines.push(` ${finding.code} (${finding.severity}): ${finding.detail}`);
3882
4275
  const judgeSeverity = finding.judgeSeverity ?? finding.severity;
3883
4276
  if (finding.judgeDetail) {
@@ -3915,11 +4308,20 @@ export async function statusFlow(runId, json, deps) {
3915
4308
  if (run.nodes.some((n) => n.kind === "storyboard" && n.status === "done")) {
3916
4309
  lines.push(...(await statusVoiceLines(runId, deps)));
3917
4310
  }
3918
- lines.push("", hasFinal && stop.at === "finished"
3919
- ? "Final cut: approved and delivered."
3920
- : hasFinal
3921
- ? `Final cut: uploaded. Approve it with: exodus video approve ${runId}`
3922
- : "Final cut: not uploaded yet.");
4311
+ const cost = runCostLine(run, items);
4312
+ lines.push("", ...(cost ? [cost] : []), ...(run.estimateUsd !== undefined ? [`Estimate shown before the start: $${run.estimateUsd.toFixed(2)}`] : []), ...spendAskLines(run, runId), runStopped(run)
4313
+ ? hasFinal ? "Final cut: on the run, which stopped before it was delivered." : "Final cut: none. This run stopped before one was made."
4314
+ : hasFinal && stop.at === "finished"
4315
+ ? "Final cut: approved and delivered."
4316
+ : hasFinal && cutDeliversItself(run, stop)
4317
+ ? "Final cut: made. This run delivers it by itself; look again in a minute."
4318
+ : hasFinal && appIsCutting(stop)
4319
+ ? "Final cut: the app makes it again now; look again in a minute."
4320
+ : hasFinal && stop.at === "final-watch" && stop.appCutOnRun
4321
+ ? `Final cut: made by the app. Approve it with: exodus video approve ${runId}`
4322
+ : hasFinal
4323
+ ? `Final cut: uploaded. Approve it with: exodus video approve ${runId}`
4324
+ : "Final cut: not uploaded yet.", ...(hasFinal && stop.at === "finished" && hasAppCut(items) ? [APP_CUT_SIZE_LINE] : []), ...(run.cutCheck ?? []));
3923
4325
  let finalSpeech;
3924
4326
  for (const item of items)
3925
4327
  if (item.itemKind === "final" && item.status === "done")
@@ -3928,6 +4330,34 @@ export async function statusFlow(runId, json, deps) {
3928
4330
  lines.push("Final speech:", ...speechSummaryLines(finalSpeech));
3929
4331
  return { code: 0, lines };
3930
4332
  }
4333
+ export const ONE_TAKE_FILMED_AGAIN_CODE = "one-take-filmed-again";
4334
+ export const COST_LEAVES_OUT = "Not in it: what was made before the run, such as a swipe's script and people.";
4335
+ export function runCostLine(run, items) {
4336
+ const total = run.costUsd;
4337
+ if (typeof total !== "number" || !Number.isFinite(total) || total <= 0)
4338
+ return null;
4339
+ const finished = run.costScope === undefined ? run.isTerminal === true : run.costScope === "final";
4340
+ const filmed = new Map();
4341
+ for (const item of items) {
4342
+ if (item.itemKind !== "clip" || !isPullSceneIndex(item.sceneIndex))
4343
+ continue;
4344
+ if (!(item.findings ?? []).some((f) => f.code === ONE_TAKE_FILMED_AGAIN_CODE))
4345
+ continue;
4346
+ const times = item.artifact?.type === "video" ? item.artifact.qc?.attempts : undefined;
4347
+ if (typeof times === "number" && Number.isInteger(times))
4348
+ filmed.set(item.sceneIndex, Math.max(filmed.get(item.sceneIndex) ?? 0, times));
4349
+ }
4350
+ const again = [...filmed.entries()]
4351
+ .filter(([, times]) => times > 1)
4352
+ .sort(([a], [b]) => a - b)
4353
+ .map(([scene, times]) => `scene ${scene} was filmed ${times} times`);
4354
+ return `${finished ? "Cost" : "Cost so far"}: $${total.toFixed(2)}${again.length > 0 ? ` (${again.join(", ")})` : ""}. ${COST_LEAVES_OUT}`;
4355
+ }
4356
+ export const ONE_TAKE_HEARD_AS_CODE = "one-take-words-heard-as";
4357
+ export const ONE_TAKE_LABEL_CODES = ["one-take-label-flipped", "one-take-label-unsure", "one-take-label-held", "one-take-label-flipped-all"];
4358
+ const ONE_TAKE_LABEL_ALL_FLIPPED_CODE = "one-take-label-flipped-all";
4359
+ export const ONE_TAKE_SAID_WRONG_CODES = ["one-take-said-wrong", "one-take-second-listen-failed"];
4360
+ const ONE_TAKE_PLAIN_FINDING_CODES = [ONE_TAKE_HEARD_AS_CODE, ...ONE_TAKE_LABEL_CODES, ...ONE_TAKE_SAID_WRONG_CODES];
3931
4361
  const DIRECTOR_STATUS_WORDS = {
3932
4362
  reviewing: "Watching this run",
3933
4363
  waiting: "Waiting for redos to finish",
@@ -4202,6 +4632,21 @@ export async function quoteFlow(runId, json, deps, privateExport = false) {
4202
4632
  : `AUTHORIZED RAW REQUEST REVIEW: ${JSON.stringify(privateView)}`] : []),
4203
4633
  ] };
4204
4634
  }
4635
+ async function waitsForFinalApprove(runId, deps) {
4636
+ try {
4637
+ const read = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`);
4638
+ if (!read?.ok)
4639
+ return null;
4640
+ const customer = customerAnswer(read.data);
4641
+ if (customer)
4642
+ return customer.stage === "ready" && customer.awaitingSignOff === true ? { template: customer.template === true } : null;
4643
+ const run = asVideoRun(read.data);
4644
+ return classifyRun(run).at === "final-watch" ? { template: run.launchDoor === "template" } : null;
4645
+ }
4646
+ catch {
4647
+ return null;
4648
+ }
4649
+ }
4205
4650
  export async function approveFlow(runId, opts, deps) {
4206
4651
  let requestQuote;
4207
4652
  if (opts.requestQuoteHash !== undefined) {
@@ -4216,6 +4661,7 @@ export async function approveFlow(runId, opts, deps) {
4216
4661
  }
4217
4662
  requestQuote = { quotes: prepared };
4218
4663
  }
4664
+ const final = opts.json ? null : await waitsForFinalApprove(runId, deps);
4219
4665
  const res = await deps.post(APPROVE_PATH, {
4220
4666
  runId,
4221
4667
  ...(opts.acceptFindings ? { acceptFindings: true } : {}),
@@ -4251,7 +4697,7 @@ export async function approveFlow(runId, opts, deps) {
4251
4697
  return {
4252
4698
  code: 0,
4253
4699
  lines: [
4254
- "Approved.",
4700
+ ...(final ? finalApprovedLines(final.template) : ["Approved."]),
4255
4701
  ...warnings,
4256
4702
  ...(summary.length > 0 ? ["", ...summary, ""] : []),
4257
4703
  `See what happens next: exodus video status ${runId}`,
@@ -4969,6 +5415,50 @@ function sceneListWords(sceneIndexes) {
4969
5415
  return `Scene ${sceneIndexes[0]}`;
4970
5416
  return `Scenes ${sceneIndexes.slice(0, -1).join(", ")} and ${sceneIndexes[sceneIndexes.length - 1]}`;
4971
5417
  }
5418
+ const KEEP_NOT_ON_THIS_SERVER = "This Exodus server cannot keep a scene from the command line yet, so nothing changed. Keep it on the video's page:";
5419
+ export async function keepFlow(runId, sceneIndex, json, deps) {
5420
+ const res = await deps.post(KEEP_SCENE_PATH, { runId, sceneIndex });
5421
+ if (missingRouteLine(res, "exodus video keep")) {
5422
+ const line = `${KEEP_NOT_ON_THIS_SERVER} ${customerRunPage(deps.dashboardUrl, runId)}`;
5423
+ return { code: 1, lines: json ? [JSON.stringify({ ok: false, status: 404, error: line })] : [line] };
5424
+ }
5425
+ if (!res.ok)
5426
+ return errorResult(res, json);
5427
+ if (json)
5428
+ return { code: 0, lines: [JSON.stringify({ ok: true, runId, sceneIndex })] };
5429
+ return {
5430
+ code: 0,
5431
+ lines: [
5432
+ `Kept scene ${sceneIndex} as it is. Nothing was ordered.`,
5433
+ "If the final video was waiting on this scene alone, the app makes it now.",
5434
+ `See where it stands: exodus video status ${runId}`,
5435
+ ],
5436
+ };
5437
+ }
5438
+ const SPEND_ANSWER_NOT_ON_THIS_SERVER = "This Exodus server cannot take this answer from the command line, so nothing changed. Answer on the video's page:";
5439
+ export async function spendAnswerFlow(runId, answer, json, deps) {
5440
+ const res = await deps.post(SPEND_ANSWER_PATH, { runId, answer });
5441
+ if (missingRouteLine(res, answer === "go" ? "exodus video keep-going" : "exodus video stop-here")) {
5442
+ const line = `${SPEND_ANSWER_NOT_ON_THIS_SERVER} ${customerRunPage(deps.dashboardUrl, runId)}`;
5443
+ return { code: 1, lines: json ? [JSON.stringify({ ok: false, status: 404, error: line })] : [line] };
5444
+ }
5445
+ if (!res.ok)
5446
+ return errorResult(res, json);
5447
+ const clearedToUsd = res.data?.clearedToUsd;
5448
+ if (json)
5449
+ return { code: 0, lines: [JSON.stringify({ ok: true, runId, answer, ...(typeof clearedToUsd === "number" ? { clearedToUsd } : {}) })] };
5450
+ return {
5451
+ code: 0,
5452
+ lines: [
5453
+ answer === "go"
5454
+ ? typeof clearedToUsd === "number"
5455
+ ? `Keeping going. It will ask again before it spends past $${clearedToUsd.toFixed(2)}.`
5456
+ : "Keeping going."
5457
+ : "Stopped at the estimate. Nothing more will be filmed. Every scene with a clip is kept.",
5458
+ `See where it stands: exodus video status ${runId}`,
5459
+ ],
5460
+ };
5461
+ }
4972
5462
  export async function revoiceFlow(runId, target, json, deps) {
4973
5463
  const runRes = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`);
4974
5464
  if (!runRes.ok)
@@ -5240,19 +5730,25 @@ async function statusVoiceLines(runId, deps) {
5240
5730
  return [];
5241
5731
  const sheet = (res.data ?? {});
5242
5732
  const cast = Array.isArray(sheet.cast) ? sheet.cast : [];
5243
- const summary = voiceSummaryLines(cast, []);
5733
+ const summary = voiceSummaryLines(cast, [], { checkSkipped: true });
5244
5734
  if (summary.length === 0)
5245
5735
  return [];
5246
5736
  const clash = cast.some((row) => row.fit?.clash === true);
5247
- return ["", ...summary, ...(clash ? [VOICE_CLASH_HINT] : [])];
5737
+ const unchecked = cast.some((row) => Boolean(row.voice) && row.availability === undefined);
5738
+ return [
5739
+ "",
5740
+ ...summary,
5741
+ ...(unchecked ? [`ElevenLabs is not asked here. To check these voices: exodus video voices ${runId}`] : []),
5742
+ ...(clash ? [VOICE_CLASH_HINT] : []),
5743
+ ];
5248
5744
  }
5249
- function voiceSummaryLines(cast, notices) {
5745
+ function voiceSummaryLines(cast, notices, opts = {}) {
5250
5746
  const rows = cast.filter((row) => row.spokenScenes > 0 || row.voice !== null);
5251
5747
  const width = Math.max(0, ...rows.map((row) => row.name.length));
5252
5748
  const lines = rows.length > 0 ? ["Voices"] : [];
5253
5749
  for (const row of rows) {
5254
5750
  lines.push(row.voice
5255
- ? ` ${row.name.padEnd(width)} → ${voiceWords(row)} ${availabilityWords(row)}${fitWords(row)}`
5751
+ ? ` ${row.name.padEnd(width)} → ${voiceWords(row)}${opts.checkSkipped && row.availability === undefined ? "" : ` ${availabilityWords(row)}`}${fitWords(row)}`
5256
5752
  : ` ${row.name.padEnd(width)} → no voice chosen (keeps the generated voice)`);
5257
5753
  }
5258
5754
  for (const notice of notices)
@@ -5359,6 +5855,7 @@ async function customerPullFlow(run, dir, json, deps) {
5359
5855
  dashboardUrl: deps.dashboardUrl,
5360
5856
  });
5361
5857
  deps.mkdirp(dir);
5858
+ const videoBefore = fingerprintInFolder(dir, manifest.video, deps);
5362
5859
  const failures = (await runPool(downloads.map((download) => () => downloadWithRetry(download, dir, deps)), PULL_CONCURRENCY)).filter((f) => f !== null);
5363
5860
  const landed = (file) => file !== null && !failures.some((f) => f.file === file) ? file : null;
5364
5861
  for (const scene of manifest.scenes) {
@@ -5387,6 +5884,7 @@ async function customerPullFlow(run, dir, json, deps) {
5387
5884
  lines: [
5388
5885
  `Pulled ${downloads.length - failures.length + 1} files into ${dir}`,
5389
5886
  `Every piece is listed in ${manifestPath}.`,
5887
+ ...replacedVideoLines(dir, manifest.video, videoBefore, deps),
5390
5888
  ...(manifest.video ? [] : ["The finished video isn't ready yet, so only the scene pieces came down."]),
5391
5889
  ...(failures.length > 0
5392
5890
  ? [
@@ -5396,11 +5894,13 @@ async function customerPullFlow(run, dir, json, deps) {
5396
5894
  "Run the same command again to retry.",
5397
5895
  ]
5398
5896
  : []),
5399
- "",
5400
- `When your cut is ready: exodus video upload ${runId} --file cut.mp4`,
5897
+ ...(customerDelivered(run) ? ["", deliveredLine(dir, manifest.video)] : []),
5401
5898
  ],
5402
5899
  };
5403
5900
  }
5901
+ function customerDelivered(run) {
5902
+ return run.stage === "ready" && run.awaitingSignOff !== true;
5903
+ }
5404
5904
  export async function pullFlow(runId, dir, json, deps) {
5405
5905
  const runRes = await deps.get(`${RUN_PATH}?runId=${encodeURIComponent(runId)}`);
5406
5906
  if (!runRes.ok)
@@ -5416,6 +5916,7 @@ export async function pullFlow(runId, dir, json, deps) {
5416
5916
  const plan = planPull(run, items, {
5417
5917
  pulledAt: new Date(deps.now()).toISOString(),
5418
5918
  dashboardUrl: deps.dashboardUrl,
5919
+ ...(deps.piecesOnly ? { piecesOnly: true } : {}),
5419
5920
  });
5420
5921
  deps.mkdirp(dir);
5421
5922
  if (plan.downloads.length === 0 && plan.texts.length === 0) {
@@ -5430,6 +5931,7 @@ export async function pullFlow(runId, dir, json, deps) {
5430
5931
  for (const text of plan.texts) {
5431
5932
  deps.writeFile(path.join(dir, text.file), text.body);
5432
5933
  }
5934
+ const videoBefore = fingerprintInFolder(dir, plan.manifest.video, deps);
5433
5935
  const failures = await runPool(plan.downloads.map((download) => () => downloadWithRetry(download, dir, deps)), PULL_CONCURRENCY);
5434
5936
  for (const failure of failures) {
5435
5937
  if (failure)
@@ -5449,6 +5951,7 @@ export async function pullFlow(runId, dir, json, deps) {
5449
5951
  const lines = [
5450
5952
  `Pulled ${wrote} files into ${dir}`,
5451
5953
  `Every piece is indexed in ${path.join(dir, "manifest.json")} — scene numbers there are the run's own.`,
5954
+ ...replacedVideoLines(dir, plan.manifest.video, videoBefore, deps),
5452
5955
  ...musicLines(plan.manifest),
5453
5956
  ];
5454
5957
  if (plan.manifest.dropped.length > 0) {
@@ -5482,7 +5985,15 @@ export async function pullFlow(runId, dir, json, deps) {
5482
5985
  lines.push(` ${failure.file}: ${failure.error}`);
5483
5986
  lines.push("Run the same command again to retry just those.");
5484
5987
  }
5485
- lines.push("", `When your cut is ready: exodus video upload ${runId} --file cut.mp4`);
5988
+ if (runStopped(run)) {
5989
+ lines.push("", "This run stopped before it was delivered, so no cut can be uploaded to it now.");
5990
+ }
5991
+ else if (hasAttachedCut(items) && classifyRun(run).at === "finished") {
5992
+ lines.push("", deliveredLine(dir, plan.manifest.video));
5993
+ }
5994
+ else if (!appCutsRun(run, items)) {
5995
+ lines.push("", `When your cut is ready: exodus video upload ${runId} --file cut.mp4`);
5996
+ }
5486
5997
  return { code: failed.length > 0 ? 1 : 0, lines };
5487
5998
  }
5488
5999
  const BOX_HEADER = 8;
@@ -5772,7 +6283,8 @@ export async function uploadFlow(runId, filePath, durationFlag, json, deps, opti
5772
6283
  return errorResult(attached, json);
5773
6284
  const customerFinal = customerAnswer(attached.data);
5774
6285
  if (customerFinal) {
5775
- const { finalWatchUrl, delivered } = customerFinal;
6286
+ const { delivered } = customerFinal;
6287
+ const finalWatchUrl = onOwnDashboard(customerFinal.finalWatchUrl, deps.dashboardUrl);
5776
6288
  if (json) {
5777
6289
  return {
5778
6290
  code: 0,
@@ -5788,7 +6300,7 @@ export async function uploadFlow(runId, filePath, durationFlag, json, deps, opti
5788
6300
  };
5789
6301
  }
5790
6302
  const final = attached.data;
5791
- const finalWatchUrl = final.finalWatchUrl ?? reviewUrl(deps.dashboardUrl, { _id: runId });
6303
+ const finalWatchUrl = final.finalWatchUrl ? onOwnDashboard(final.finalWatchUrl, deps.dashboardUrl) : reviewUrl(deps.dashboardUrl, { _id: runId });
5792
6304
  const delivered = final.delivered === true;
5793
6305
  if (json) {
5794
6306
  return {
@@ -6101,7 +6613,10 @@ const VALUE_FLAGS = new Set([
6101
6613
  "persona",
6102
6614
  ]);
6103
6615
  const FIND_VALUE_FLAGS = new Set(["brand", "limit"]);
6104
- const WRITE_VALUE_FLAGS = new Set(["kind"]);
6616
+ const WRITE_VALUE_FLAGS = new Set(["kind", "people-max-usd"]);
6617
+ const START_VALUE_FLAGS = new Set(["max-usd"]);
6618
+ const SHEET_PEOPLE_VALUE_FLAGS = new Set(["count", "max-usd"]);
6619
+ const SHEET_SET_VALUE_FLAGS = new Set(["people-max-usd"]);
6105
6620
  export function parsePositional(args = process.argv.slice(3)) {
6106
6621
  const read = (valueFlags) => {
6107
6622
  const out = [];
@@ -6127,8 +6642,38 @@ export function parsePositional(args = process.argv.slice(3)) {
6127
6642
  const asWrite = read(WRITE_VALUE_FLAGS);
6128
6643
  if (asWrite[0] === "swipe" && asWrite[1] === "write")
6129
6644
  return asWrite;
6645
+ const asStart = read(START_VALUE_FLAGS);
6646
+ if (asStart[0] === "swipe" && asStart[1] === "start")
6647
+ return asStart;
6648
+ const asPeople = read(SHEET_PEOPLE_VALUE_FLAGS);
6649
+ if (asPeople[0] === "swipe" && asPeople[1] === "sheet" && asPeople[2] === "people")
6650
+ return asPeople;
6651
+ const asSet = read(SHEET_SET_VALUE_FLAGS);
6652
+ if (asSet[0] === "swipe" && asSet[1] === "sheet" && asSet[2] === "set")
6653
+ return asSet;
6130
6654
  return read(new Set());
6131
6655
  }
6656
+ export function subcommandHelp(words = parsePositional()) {
6657
+ const block = helpText.slice(helpText.indexOf("\nUsage:\n") + "\nUsage:\n".length);
6658
+ const entries = [];
6659
+ for (const line of block.slice(0, block.indexOf("\n\n")).split("\n")) {
6660
+ if (line.startsWith(" exodus video "))
6661
+ entries.push([line]);
6662
+ else if (line.startsWith(" ") && entries.length > 0)
6663
+ entries[entries.length - 1].push(line);
6664
+ }
6665
+ const typed = words.filter((word) => !word.startsWith("-"));
6666
+ for (let n = typed.length; n > 0; n--) {
6667
+ const said = typed.slice(0, n).join(" ");
6668
+ const own = entries.filter(([line]) => {
6669
+ const rest = line.slice(" exodus video ".length);
6670
+ return rest === said || rest.startsWith(`${said} `);
6671
+ });
6672
+ if (own.length > 0)
6673
+ return ["Usage:", ...own.flat(), "", "exodus video --help shows everything."].join("\n");
6674
+ }
6675
+ return null;
6676
+ }
6132
6677
  function flagString(flags, name) {
6133
6678
  const value = flags[name];
6134
6679
  return typeof value === "string" ? value : undefined;
@@ -6194,6 +6739,9 @@ export async function run(flags, occurrences) {
6194
6739
  "retry-frame",
6195
6740
  "retry-clip",
6196
6741
  "revoice",
6742
+ "keep",
6743
+ "keep-going",
6744
+ "stop-here",
6197
6745
  "voices",
6198
6746
  "pull",
6199
6747
  "upload",
@@ -6205,6 +6753,7 @@ export async function run(flags, occurrences) {
6205
6753
  "pick",
6206
6754
  "map",
6207
6755
  "move",
6756
+ "wait",
6208
6757
  ];
6209
6758
  if (sub === "voices" && flags["catalog"] !== undefined && flags["catalog"] !== false) {
6210
6759
  return printResult(await voiceCatalogFlow(runId, json, defaultDeps));
@@ -6251,6 +6800,9 @@ export async function run(flags, occurrences) {
6251
6800
  }
6252
6801
  if (sub === "storyboard")
6253
6802
  return printResult(await storyboardFlow(runId, json, defaultDeps));
6803
+ if (sub === "wait") {
6804
+ return printResult(await waitFlow(runId, { json, onProgressLine: json ? undefined : (line) => console.log(line) }, defaultDeps));
6805
+ }
6254
6806
  if (sub === "picks") {
6255
6807
  const redo = flagString(flags, "redo");
6256
6808
  if (flags["redo"] !== undefined && !redo?.trim())
@@ -6331,6 +6883,18 @@ export async function run(flags, occurrences) {
6331
6883
  }
6332
6884
  return printResult(await retryClipFlow(runId, { sceneIndex, nodeId: flagString(flags, "node") }, { note: flagString(flags, "note"), voiceFirst: flags["voice-first"] === true }, json, defaultDeps));
6333
6885
  }
6886
+ if (sub === "keep-going" || sub === "stop-here") {
6887
+ return printResult(await spendAnswerFlow(runId, sub === "keep-going" ? "go" : "stop", json, defaultDeps));
6888
+ }
6889
+ if (sub === "keep") {
6890
+ const sceneRaw = flagString(flags, "scene");
6891
+ if (sceneRaw === undefined)
6892
+ usage("video keep needs --scene <n>, the scene to keep as it is.");
6893
+ const sceneIndex = Number(sceneRaw);
6894
+ if (!Number.isInteger(sceneIndex))
6895
+ usage(`video keep --scene must be a whole scene number, not "${sceneRaw}".`);
6896
+ return printResult(await keepFlow(runId, sceneIndex, json, defaultDeps));
6897
+ }
6334
6898
  if (sub === "revoice") {
6335
6899
  const sceneRaw = flagString(flags, "scene");
6336
6900
  const all = flags["all"] === true;