@aicopycoders/exodus 2026.11.500-beta.1 → 2026.11.700-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/assets/skills/exodus-video/SKILL.md +8 -0
- package/assets/skills/exodus-video/scripts/first-cut-text-render.mjs +190 -0
- package/assets/skills/exodus-video/scripts/first-cut-text.d.mts +120 -0
- package/assets/skills/exodus-video/scripts/first-cut-text.mjs +247 -0
- package/assets/skills/exodus-video/scripts/first-cut.d.mts +246 -2
- package/assets/skills/exodus-video/scripts/first-cut.mjs +1653 -65
- package/dist/commands/video-customer.d.ts +2 -0
- package/dist/commands/video-customer.js +6 -0
- package/dist/commands/video.d.ts +60 -1
- package/dist/commands/video.js +447 -6
- package/package.json +1 -1
package/dist/commands/video.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { apiGet, apiPost, getDashboardUrl } from "../lib/client.js";
|
|
@@ -78,6 +79,10 @@ The whole loop, in order:
|
|
|
78
79
|
Add a shot on a line, move one, or remove one while the storyboard
|
|
79
80
|
waits. Each change redraws only the pictures it changes, and every
|
|
80
81
|
other picture stays as it was. Wait for it before you approve.
|
|
82
|
+
exodus video quote <runId> [--private]
|
|
83
|
+
A format that quotes its video requests stops before a prepared paid
|
|
84
|
+
request, even on a One-shot run. Review its exact requests and prices here,
|
|
85
|
+
then approve those same requests with --request-quote <reviewSha256>.
|
|
81
86
|
|
|
82
87
|
7. exodus video status <runId>
|
|
83
88
|
Where the run is and how each scene's clip turned out. If the storyboard
|
|
@@ -91,6 +96,30 @@ The whole loop, in order:
|
|
|
91
96
|
8. exodus video pull <runId> --out ./ad
|
|
92
97
|
Writes every piece to that folder plus a manifest.json index.
|
|
93
98
|
|
|
99
|
+
exodus video review <runId> --file ./cut.mp4 --accept | --reject
|
|
100
|
+
[--resolve "<findingKey>|accepted-as-is|<why>" ...] [--disagree "<findingKey>|<your words>" ...]
|
|
101
|
+
Record YOUR review of the final cut as it is now. It binds to that exact
|
|
102
|
+
local file's bytes and filename; its hash must match the stored final cut.
|
|
103
|
+
A different cut needs a new review. Give every critical finding a note; a
|
|
104
|
+
finding still on the cut cannot be called fixed, and your disagreement is
|
|
105
|
+
kept as you wrote it.
|
|
106
|
+
--heard "<scene>|<observed speaker>|<term>|<what you heard>|accept|reject"
|
|
107
|
+
records your own listen against the selected take's actual bytes. Repeat
|
|
108
|
+
per watched term. The script's speaker and ASR are never a human listen.
|
|
109
|
+
--heard-final "<observed speaker>|<term>|<what you heard>|accept|reject"
|
|
110
|
+
listens to the exact final file instead, including its narration or Song.
|
|
111
|
+
A scene-take listen is never reinterpreted as a final-file listen.
|
|
112
|
+
|
|
113
|
+
exodus video song <runId>
|
|
114
|
+
The Song master to listen to: its sha256s, lyric, coverage, and whether
|
|
115
|
+
it can be approved at all. Never the audio bytes.
|
|
116
|
+
exodus video song approve <runId> --master <masterSha256>
|
|
117
|
+
Approve exactly the master you listened to (a changed one is refused).
|
|
118
|
+
exodus video song import <runId> --file song.mp3 --lyric @lyric.txt --rights "<who owns it and consents>" [--from <s> --to <s>]
|
|
119
|
+
Use your own recording as the Song. The rights statement is kept
|
|
120
|
+
verbatim; the lyric is one line per scene, and a lyric line nobody can
|
|
121
|
+
hear on the recording keeps it from being approved.
|
|
122
|
+
|
|
94
123
|
exodus video retry-clip <runId> --scene <n>
|
|
95
124
|
Redo ONE finished clip while the run waits for the cut. Everything
|
|
96
125
|
else stays. A --note steers the motion, never the words. Add
|
|
@@ -116,6 +145,10 @@ The whole loop, in order:
|
|
|
116
145
|
|
|
117
146
|
Usage:
|
|
118
147
|
exodus video status <runId> [--rejected-draft] [--json]
|
|
148
|
+
exodus video review <runId> (--accept | --reject) [--resolve "<key>|<accepted-as-is|waived>|<why>"] [--disagree "<key>|<words>"] [--grade <v>] [--media <v>] [--json]
|
|
149
|
+
exodus video song <runId> [--json]
|
|
150
|
+
exodus video song approve <runId> --master <masterSha256> [--json]
|
|
151
|
+
exodus video song import <runId> --file <audio> --lyric <text|@file> --rights "<statement>" [--from <s> --to <s>] [--json]
|
|
119
152
|
exodus video storyboard <runId> [--json]
|
|
120
153
|
exodus video approve <runId> [--approve-stale-cut] [--json]
|
|
121
154
|
exodus video retry-frame <runId> [--node <nodeId>] --scene <n> [--note "..."] [--json]
|
|
@@ -129,7 +162,7 @@ Usage:
|
|
|
129
162
|
exodus video voices [<runId>] --catalog [--json]
|
|
130
163
|
exodus video pull <runId> --out <dir> [--json]
|
|
131
164
|
exodus video upload <runId> --file <cut.mp4> [--duration <sec>] [--json]
|
|
132
|
-
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>] [--music] [--broll] [--one-shot] [--director] [--wait] [--json]
|
|
165
|
+
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]
|
|
133
166
|
exodus video director <runId> <on|off|follow> [--json]
|
|
134
167
|
|
|
135
168
|
Options:
|
|
@@ -182,8 +215,14 @@ Options:
|
|
|
182
215
|
from, it says what is missing and starts nothing
|
|
183
216
|
--source-record <file.json>
|
|
184
217
|
A real ad's source record (start, with --conceit), for
|
|
185
|
-
a kind of ad that copies an ad shot for shot.
|
|
186
|
-
kind
|
|
218
|
+
a kind of ad that copies an ad shot for shot. Without
|
|
219
|
+
one such a kind plans its own scenes; any other kind
|
|
220
|
+
refuses it
|
|
221
|
+
--adaptation-plan <file|original>
|
|
222
|
+
A swipe's adaptation plan JSON (start, with --conceit),
|
|
223
|
+
for a template that keeps its source's roles and beats,
|
|
224
|
+
or "original" for a brief with no source ad. Any other
|
|
225
|
+
kind refuses it
|
|
187
226
|
--stop-at-script Print the script the run would start on, and start
|
|
188
227
|
nothing (start, with --conceit). To read a written or
|
|
189
228
|
laid-out script first; send it back with --script
|
|
@@ -275,6 +314,14 @@ export const ITEMS_PATH = "/api/v2/workflow/items";
|
|
|
275
314
|
const REJECTED_DRAFT_PATH = "/api/v2/workflow/rejected-draft";
|
|
276
315
|
const REJECTED_DRAFT_NOT_ON_THIS_SERVER = "This Exodus server does not keep rejected drafts yet, so there is nothing to read. It arrives " +
|
|
277
316
|
"with the next server update.";
|
|
317
|
+
const LINEAGE_PATH = "/api/v2/video/lineage";
|
|
318
|
+
const LINEAGE_NOT_ON_THIS_SERVER = "This Exodus server does not keep run lineage yet, so there is nothing to read. It arrives " +
|
|
319
|
+
"with the next server update.";
|
|
320
|
+
const REVIEW_PATH = "/api/v2/video/review";
|
|
321
|
+
const SONG_PATH = "/api/v2/video/song";
|
|
322
|
+
const SONG_APPROVE_PATH = "/api/v2/video/song/approve";
|
|
323
|
+
const SONG_IMPORT_PATH = "/api/v2/video/song/import";
|
|
324
|
+
const QUOTE_PATH = "/api/v2/video/quote";
|
|
278
325
|
const STORYBOARD_PATH = "/api/v2/video/storyboard";
|
|
279
326
|
const FLAG_PATH = "/api/v2/video/storyboard/flag";
|
|
280
327
|
const BROLL_PATH = "/api/v2/video/storyboard/broll";
|
|
@@ -448,6 +495,8 @@ export function classifyRun(run) {
|
|
|
448
495
|
...(why ? { error: why } : {}),
|
|
449
496
|
};
|
|
450
497
|
}
|
|
498
|
+
if (run.requestQuotePending === true)
|
|
499
|
+
return { at: "request-quote" };
|
|
451
500
|
const pausedNode = run.nodes.find((n) => n.nodeId === run.pausedNodeId);
|
|
452
501
|
if (pausedNode && parkedAtStoryboardGate(run, pausedNode)) {
|
|
453
502
|
const held = heldReason(run);
|
|
@@ -574,6 +623,12 @@ function missingSceneLines(missing, framesNodeId, runId, runUrl) {
|
|
|
574
623
|
return lines;
|
|
575
624
|
}
|
|
576
625
|
export function stopLines(stop, runId, runUrl) {
|
|
626
|
+
if (stop.at === "request-quote")
|
|
627
|
+
return [
|
|
628
|
+
"Parked: final provider requests are prepared; the unapproved paid operations have not been sent.",
|
|
629
|
+
`Review the exact requests and prices: exodus video quote ${runId}`,
|
|
630
|
+
`Approve the reviewed identities: exodus video approve ${runId} --request-quote <reviewSha256>`,
|
|
631
|
+
];
|
|
577
632
|
if (stop.at === "storyboard-gate") {
|
|
578
633
|
const lines = [
|
|
579
634
|
...(stop.heldReason ? [stop.heldReason] : []),
|
|
@@ -1467,6 +1522,9 @@ export function planVideoStart(flags, occurrences) {
|
|
|
1467
1522
|
const recordFlag = planValueFlag(occurrences, "source-record");
|
|
1468
1523
|
if (!recordFlag.ok)
|
|
1469
1524
|
return { kind: "usage", line: recordFlag.line };
|
|
1525
|
+
const planFlag = planValueFlag(occurrences, "adaptation-plan");
|
|
1526
|
+
if (!planFlag.ok)
|
|
1527
|
+
return { kind: "usage", line: planFlag.line };
|
|
1470
1528
|
const videoModel = videoModelFlag.value;
|
|
1471
1529
|
const voiceMode = voiceFlag.value;
|
|
1472
1530
|
const reviewStoryboardFlag = occurrences.some((o) => o.flag === "review-storyboard");
|
|
@@ -1551,6 +1609,12 @@ export function planVideoStart(flags, occurrences) {
|
|
|
1551
1609
|
line: "--source-record works with --conceit, not --show.",
|
|
1552
1610
|
};
|
|
1553
1611
|
}
|
|
1612
|
+
if (showId && planFlag.value) {
|
|
1613
|
+
return {
|
|
1614
|
+
kind: "usage",
|
|
1615
|
+
line: "--adaptation-plan works with --conceit, not --show.",
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1554
1618
|
if (showId && broll) {
|
|
1555
1619
|
return {
|
|
1556
1620
|
kind: "usage",
|
|
@@ -1631,6 +1695,8 @@ export function planVideoStart(flags, occurrences) {
|
|
|
1631
1695
|
opts.rewriteToFit = true;
|
|
1632
1696
|
if (recordFlag.value)
|
|
1633
1697
|
opts.sourceRecordFile = recordFlag.value;
|
|
1698
|
+
if (planFlag.value)
|
|
1699
|
+
opts.adaptationPlanFile = planFlag.value;
|
|
1634
1700
|
if (frameFlag.value || pacingFlag.value) {
|
|
1635
1701
|
opts.shots = {
|
|
1636
1702
|
...(frameFlag.value ? { frame: frameFlag.value } : {}),
|
|
@@ -1910,6 +1976,17 @@ export async function startScriptFlow(opts, deps) {
|
|
|
1910
1976
|
};
|
|
1911
1977
|
}
|
|
1912
1978
|
}
|
|
1979
|
+
let adaptationPlan;
|
|
1980
|
+
if (opts.adaptationPlanFile) {
|
|
1981
|
+
try {
|
|
1982
|
+
adaptationPlan = opts.adaptationPlanFile === "original"
|
|
1983
|
+
? { kind: "original", reason: "Member explicitly selected an original brief." }
|
|
1984
|
+
: JSON.parse(deps.readFile(opts.adaptationPlanFile));
|
|
1985
|
+
}
|
|
1986
|
+
catch (error) {
|
|
1987
|
+
return { code: 1, lines: [`Can't read semantic adaptation JSON: ${String(error)}`] };
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1913
1990
|
const listed = await deps.get(SCRIPT_RUNS_PATH).catch(() => null);
|
|
1914
1991
|
if (listed?.ok) {
|
|
1915
1992
|
const options = scriptRunOptionsOf(listed.data);
|
|
@@ -1937,6 +2014,7 @@ export async function startScriptFlow(opts, deps) {
|
|
|
1937
2014
|
...(opts.stopAtScript ? { stopAtScript: true } : {}),
|
|
1938
2015
|
...(opts.rewriteToFit ? { rewriteToFit: true } : {}),
|
|
1939
2016
|
...(sourceRecord !== undefined ? { sourceRecord } : {}),
|
|
2017
|
+
...(adaptationPlan !== undefined ? { adaptationPlan } : {}),
|
|
1940
2018
|
});
|
|
1941
2019
|
if (!res.ok)
|
|
1942
2020
|
return scriptNeedsCallerResult(res, opts.json) ?? scriptStartRefused(res, opts.json);
|
|
@@ -2512,11 +2590,81 @@ function sceneCardLines(scene) {
|
|
|
2512
2590
|
lines.push(` picture: ${scene.frame.status}`);
|
|
2513
2591
|
return lines;
|
|
2514
2592
|
}
|
|
2593
|
+
function readPreparedQuotes(data) {
|
|
2594
|
+
if (!data || typeof data !== "object" || !("prepared" in data) || !Array.isArray(data.prepared))
|
|
2595
|
+
return null;
|
|
2596
|
+
const result = [];
|
|
2597
|
+
const seen = new Set();
|
|
2598
|
+
for (const q of data.prepared) {
|
|
2599
|
+
if (!q || typeof q !== "object" ||
|
|
2600
|
+
!Number.isInteger(q.sceneIndex) || q.sceneIndex < 0 || seen.has(q.sceneIndex) ||
|
|
2601
|
+
q.operation !== "clip" ||
|
|
2602
|
+
typeof q.requestSha256 !== "string" || !/^[0-9a-f]{64}$/.test(q.requestSha256) ||
|
|
2603
|
+
typeof q.refsSha256 !== "string" || !/^[0-9a-f]{64}$/.test(q.refsSha256) ||
|
|
2604
|
+
typeof q.model !== "string" || typeof q.mode !== "string" ||
|
|
2605
|
+
typeof q.durationSec !== "number" || !Number.isFinite(q.durationSec) || q.durationSec <= 0 ||
|
|
2606
|
+
typeof q.quotedUsd !== "number" || !Number.isFinite(q.quotedUsd) || q.quotedUsd < 0 ||
|
|
2607
|
+
(q.voiceId !== undefined && typeof q.voiceId !== "string"))
|
|
2608
|
+
return null;
|
|
2609
|
+
seen.add(q.sceneIndex);
|
|
2610
|
+
result.push({
|
|
2611
|
+
sceneIndex: q.sceneIndex, requestSha256: q.requestSha256, refsSha256: q.refsSha256,
|
|
2612
|
+
operation: q.operation,
|
|
2613
|
+
model: q.model, mode: q.mode, durationSec: q.durationSec, quotedUsd: q.quotedUsd,
|
|
2614
|
+
...(q.voiceId !== undefined ? { voiceId: q.voiceId } : {}),
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
return result;
|
|
2618
|
+
}
|
|
2619
|
+
function quoteReviewHash(prepared) {
|
|
2620
|
+
return createHash("sha256").update(JSON.stringify([...prepared].sort((a, b) => a.sceneIndex - b.sceneIndex || a.operation.localeCompare(b.operation)))).digest("hex");
|
|
2621
|
+
}
|
|
2622
|
+
export async function quoteFlow(runId, json, deps, privateExport = false) {
|
|
2623
|
+
const res = await deps.get(`${QUOTE_PATH}?runId=${encodeURIComponent(runId)}${privateExport ? "&private=1" : ""}`);
|
|
2624
|
+
if (!res.ok)
|
|
2625
|
+
return errorResult(res, json);
|
|
2626
|
+
const prepared = readPreparedQuotes(res.data);
|
|
2627
|
+
if (!prepared)
|
|
2628
|
+
return { code: 1, lines: ["The server did not return readable prepared request identities. Nothing was approved."] };
|
|
2629
|
+
if (prepared.length === 0)
|
|
2630
|
+
return { code: 1, lines: ["No final requests have been prepared yet. Nothing can be quoted or approved."] };
|
|
2631
|
+
const reviewSha256 = quoteReviewHash(prepared);
|
|
2632
|
+
const privateView = res.data && typeof res.data === "object" && "private" in res.data ? res.data.private : undefined;
|
|
2633
|
+
if (json)
|
|
2634
|
+
return { code: 0, lines: [JSON.stringify({ runId, prepared, reviewSha256, ...(privateView !== undefined ? { private: privateView } : {}) })] };
|
|
2635
|
+
return { code: 0, lines: [
|
|
2636
|
+
`EXACT REQUEST QUOTE — ${runId}`,
|
|
2637
|
+
...prepared.flatMap((q) => [
|
|
2638
|
+
` scene ${q.sceneIndex} ${q.operation}: ${q.model} / ${q.mode} / ${q.durationSec}s / $${q.quotedUsd.toFixed(4)}${q.voiceId ? ` / voice ${q.voiceId}` : ""}`,
|
|
2639
|
+
` request sha256: ${q.requestSha256}`,
|
|
2640
|
+
` references sha256: ${q.refsSha256}`,
|
|
2641
|
+
]),
|
|
2642
|
+
` total: $${prepared.reduce((sum, q) => sum + q.quotedUsd, 0).toFixed(4)}`,
|
|
2643
|
+
`Approve only these requests: exodus video approve ${runId} --request-quote ${reviewSha256}`,
|
|
2644
|
+
...(privateExport ? [privateView === undefined
|
|
2645
|
+
? "Private request review is not available for this caller or run."
|
|
2646
|
+
: `AUTHORIZED RAW REQUEST REVIEW: ${JSON.stringify(privateView)}`] : []),
|
|
2647
|
+
] };
|
|
2648
|
+
}
|
|
2515
2649
|
export async function approveFlow(runId, opts, deps) {
|
|
2650
|
+
let requestQuote;
|
|
2651
|
+
if (opts.requestQuoteHash !== undefined) {
|
|
2652
|
+
const read = await deps.get(`${QUOTE_PATH}?runId=${encodeURIComponent(runId)}`);
|
|
2653
|
+
if (!read.ok)
|
|
2654
|
+
return errorResult(read, opts.json);
|
|
2655
|
+
const prepared = readPreparedQuotes(read.data);
|
|
2656
|
+
if (!prepared)
|
|
2657
|
+
return { code: 1, lines: ["The server did not return readable prepared request identities. Nothing was approved."] };
|
|
2658
|
+
if (!prepared.length || quoteReviewHash(prepared) !== opts.requestQuoteHash) {
|
|
2659
|
+
return { code: 1, lines: [`The prepared requests are not the quote you reviewed. Review again: exodus video quote ${runId}`] };
|
|
2660
|
+
}
|
|
2661
|
+
requestQuote = { quotes: prepared };
|
|
2662
|
+
}
|
|
2516
2663
|
const res = await deps.post(APPROVE_PATH, {
|
|
2517
2664
|
runId,
|
|
2518
2665
|
...(opts.acceptFindings ? { acceptFindings: true } : {}),
|
|
2519
2666
|
...(opts.approveStaleCut ? { approveStaleCut: true } : {}),
|
|
2667
|
+
...(requestQuote ? { requestQuote } : {}),
|
|
2520
2668
|
});
|
|
2521
2669
|
if (!res.ok) {
|
|
2522
2670
|
const refusal = errorResult(res, opts.json);
|
|
@@ -3437,9 +3585,11 @@ export async function pullFlow(runId, dir, json, deps) {
|
|
|
3437
3585
|
if (failure)
|
|
3438
3586
|
markPullFailure(plan.manifest, failure);
|
|
3439
3587
|
}
|
|
3588
|
+
if (run.sourceEditMap === true)
|
|
3589
|
+
plan.manifest.lineage = await pullLineage(runId, dir, deps);
|
|
3440
3590
|
deps.writeFile(path.join(dir, "manifest.json"), `${JSON.stringify(plan.manifest, null, 2)}\n`);
|
|
3441
3591
|
const failed = plan.manifest.failed;
|
|
3442
|
-
const wrote = plan.downloads.length + plan.texts.length - failed.length + 1;
|
|
3592
|
+
const wrote = plan.downloads.length + plan.texts.length - failed.length + 1 + (plan.manifest.lineage?.file ? 1 : 0);
|
|
3443
3593
|
if (json) {
|
|
3444
3594
|
return {
|
|
3445
3595
|
code: failed.length > 0 ? 1 : 0,
|
|
@@ -3650,13 +3800,33 @@ function readSidecar(file, parse, max, deps) {
|
|
|
3650
3800
|
const parsed = rows.map(parse);
|
|
3651
3801
|
return parsed.every((r) => r !== null) ? parsed : null;
|
|
3652
3802
|
}
|
|
3803
|
+
async function pullLineage(runId, dir, deps) {
|
|
3804
|
+
const res = await deps.get(`${LINEAGE_PATH}?runId=${encodeURIComponent(runId)}`);
|
|
3805
|
+
if (!res.ok) {
|
|
3806
|
+
return { file: null, reason: res.status === 404 ? LINEAGE_NOT_ON_THIS_SERVER : `could not read it: ${videoApiError(res)}` };
|
|
3807
|
+
}
|
|
3808
|
+
const lineage = res.data?.lineage;
|
|
3809
|
+
if (typeof lineage !== "object" || lineage === null) {
|
|
3810
|
+
return { file: null, reason: "the server answered without a lineage" };
|
|
3811
|
+
}
|
|
3812
|
+
deps.writeFile(path.join(dir, "lineage.json"), `${JSON.stringify(res.data, null, 2)}\n`);
|
|
3813
|
+
return { file: "lineage.json" };
|
|
3814
|
+
}
|
|
3653
3815
|
export function cutSidecars(filePath, deps) {
|
|
3654
3816
|
const base = path.join(path.dirname(filePath), path.basename(filePath, path.extname(filePath)));
|
|
3655
3817
|
const cutScenes = readSidecar(`${base}.scenes.json`, cutScene, CUT_SCENES_MAX, deps);
|
|
3656
3818
|
const cutWords = readSidecar(`${base}.words.json`, cutWord, CUT_WORDS_MAX, deps);
|
|
3657
|
-
|
|
3819
|
+
let finalSourceMap;
|
|
3820
|
+
try {
|
|
3821
|
+
const raw = JSON.parse(deps.readFile(`${base}.source-map.json`));
|
|
3822
|
+
if (raw && typeof raw === "object" && "version" in raw && raw.version === "source-edit-map.v2")
|
|
3823
|
+
finalSourceMap = raw;
|
|
3824
|
+
}
|
|
3825
|
+
catch {
|
|
3826
|
+
}
|
|
3827
|
+
return { ...(cutScenes ? { cutScenes } : {}), ...(cutWords ? { cutWords } : {}), ...(finalSourceMap ? { finalSourceMap } : {}) };
|
|
3658
3828
|
}
|
|
3659
|
-
export async function uploadFlow(runId, filePath, durationFlag, json, deps) {
|
|
3829
|
+
export async function uploadFlow(runId, filePath, durationFlag, json, deps, options = {}) {
|
|
3660
3830
|
const stat = deps.statFile(filePath);
|
|
3661
3831
|
if (!stat)
|
|
3662
3832
|
return { code: 1, lines: [`No such file: ${filePath}`] };
|
|
@@ -3735,11 +3905,15 @@ export async function uploadFlow(runId, filePath, durationFlag, json, deps) {
|
|
|
3735
3905
|
if (!assetId) {
|
|
3736
3906
|
return { code: 1, lines: ["The server stored the file but did not say what to call it."] };
|
|
3737
3907
|
}
|
|
3908
|
+
const finalSha256 = timing.finalSourceMap || options.bindFinalBytes
|
|
3909
|
+
? createHash("sha256").update(bytes).digest("hex")
|
|
3910
|
+
: undefined;
|
|
3738
3911
|
const attaching = await withUploadRetry("attach", deps, () => deps.post(FINAL_PATH, {
|
|
3739
3912
|
runId,
|
|
3740
3913
|
assetId,
|
|
3741
3914
|
durationSec,
|
|
3742
3915
|
...timing,
|
|
3916
|
+
...(finalSha256 ? { finalSha256 } : {}),
|
|
3743
3917
|
}));
|
|
3744
3918
|
if (!attaching.ok)
|
|
3745
3919
|
return uploadRetryResult(attaching, json);
|
|
@@ -3784,6 +3958,226 @@ export async function uploadFlow(runId, filePath, durationFlag, json, deps) {
|
|
|
3784
3958
|
],
|
|
3785
3959
|
};
|
|
3786
3960
|
}
|
|
3961
|
+
export function parseReviewFlags(flags, occurrences) {
|
|
3962
|
+
const accept = flags["accept"] !== undefined && flags["accept"] !== false;
|
|
3963
|
+
const reject = flags["reject"] !== undefined && flags["reject"] !== false;
|
|
3964
|
+
if (accept === reject)
|
|
3965
|
+
return { ok: false, line: "video review needs exactly one of --accept or --reject." };
|
|
3966
|
+
const file = flagString(flags, "file");
|
|
3967
|
+
if (!file)
|
|
3968
|
+
return { ok: false, line: "video review needs --file <cut.mp4>, the actual final file you reviewed." };
|
|
3969
|
+
const resolutions = [];
|
|
3970
|
+
const disagreements = [];
|
|
3971
|
+
const humanListens = [];
|
|
3972
|
+
for (const o of occurrences) {
|
|
3973
|
+
if (o.flag === "resolve") {
|
|
3974
|
+
const [findingKey, resolution, ...why] = (o.value ?? "").split("|");
|
|
3975
|
+
if (!findingKey || (resolution !== "accepted-as-is" && resolution !== "waived") || !why.join("|").trim()) {
|
|
3976
|
+
return { ok: false, line: 'video review --resolve is "<findingKey>|accepted-as-is|<why>" (or waived); a finding still on the cut is never "fixed".' };
|
|
3977
|
+
}
|
|
3978
|
+
resolutions.push({ findingKey, resolution, note: why.join("|").trim() });
|
|
3979
|
+
}
|
|
3980
|
+
else if (o.flag === "disagree") {
|
|
3981
|
+
const [findingKey, ...words] = (o.value ?? "").split("|");
|
|
3982
|
+
if (!findingKey || !words.join("|").trim())
|
|
3983
|
+
return { ok: false, line: 'video review --disagree is "<findingKey>|<your words>".' };
|
|
3984
|
+
disagreements.push({ findingKey, note: words.join("|").trim() });
|
|
3985
|
+
}
|
|
3986
|
+
else if (o.flag === "heard") {
|
|
3987
|
+
const [scene, speaker, term, heard, decision, ...extra] = (o.value ?? "").split("|");
|
|
3988
|
+
if (extra.length || !scene?.trim() || !Number.isInteger(Number(scene)) ||
|
|
3989
|
+
!speaker?.trim() || !term?.trim() || !heard?.trim() || (decision !== "accept" && decision !== "reject")) {
|
|
3990
|
+
return { ok: false, line: 'video review --heard is "<scene>|<observed speaker>|<term>|<what you heard>|accept|reject".' };
|
|
3991
|
+
}
|
|
3992
|
+
humanListens.push({ scope: "selected-take", sceneIndex: Number(scene), speaker: speaker.trim(), term: term.trim(), heard: heard.trim(), accepted: decision === "accept" });
|
|
3993
|
+
}
|
|
3994
|
+
else if (o.flag === "heard-final") {
|
|
3995
|
+
const [speaker, term, heard, decision, ...extra] = (o.value ?? "").split("|");
|
|
3996
|
+
if (extra.length || !speaker?.trim() || !term?.trim() || !heard?.trim() || (decision !== "accept" && decision !== "reject")) {
|
|
3997
|
+
return { ok: false, line: 'video review --heard-final is "<observed speaker>|<term>|<what you heard>|accept|reject".' };
|
|
3998
|
+
}
|
|
3999
|
+
humanListens.push({ scope: "final-file", speaker: speaker.trim(), term: term.trim(), heard: heard.trim(), accepted: decision === "accept" });
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
return {
|
|
4003
|
+
ok: true,
|
|
4004
|
+
opts: {
|
|
4005
|
+
verdict: accept ? "accept" : "reject",
|
|
4006
|
+
file,
|
|
4007
|
+
resolutions,
|
|
4008
|
+
disagreements,
|
|
4009
|
+
...(humanListens.length ? { humanListens } : {}),
|
|
4010
|
+
...(flagString(flags, "grade") ? { gradeVersion: flagString(flags, "grade") } : {}),
|
|
4011
|
+
...(flagString(flags, "media") ? { mediaVersion: flagString(flags, "media") } : {}),
|
|
4012
|
+
},
|
|
4013
|
+
};
|
|
4014
|
+
}
|
|
4015
|
+
export async function reviewFlow(runId, opts, deps) {
|
|
4016
|
+
const read = await deps.get(`${LINEAGE_PATH}?runId=${encodeURIComponent(runId)}`);
|
|
4017
|
+
if (missingRouteLine(read, "exodus video review"))
|
|
4018
|
+
return { code: 1, lines: [LINEAGE_NOT_ON_THIS_SERVER] };
|
|
4019
|
+
if (!read.ok)
|
|
4020
|
+
return errorResult(read, opts.json);
|
|
4021
|
+
const final = read.data.lineage.final;
|
|
4022
|
+
if (final.state !== "known")
|
|
4023
|
+
return { code: 1, lines: [`There is no final cut to review yet (${final.reason}).`] };
|
|
4024
|
+
const file = final.value.file;
|
|
4025
|
+
if (file.sha256Base64.state !== "known") {
|
|
4026
|
+
return { code: 1, lines: [`The final cut's stored hash could not be read (${file.sha256Base64.reason}), so it cannot be reviewed yet.`] };
|
|
4027
|
+
}
|
|
4028
|
+
let reviewedBytes;
|
|
4029
|
+
try {
|
|
4030
|
+
reviewedBytes = deps.readFileBytes(opts.file);
|
|
4031
|
+
}
|
|
4032
|
+
catch (err) {
|
|
4033
|
+
return { code: 1, lines: [`Cannot read the reviewed file: ${err instanceof Error ? err.message : String(err)}`] };
|
|
4034
|
+
}
|
|
4035
|
+
const reviewedHash = createHash("sha256").update(reviewedBytes).digest("base64");
|
|
4036
|
+
if (reviewedHash !== file.sha256Base64.value) {
|
|
4037
|
+
return { code: 1, lines: ["That file's bytes do not match the current stored final cut. Pull and review the current file."] };
|
|
4038
|
+
}
|
|
4039
|
+
const res = await deps.post(REVIEW_PATH, {
|
|
4040
|
+
runId,
|
|
4041
|
+
verdict: opts.verdict,
|
|
4042
|
+
storageId: file.storageId,
|
|
4043
|
+
sha256Base64: file.sha256Base64.value,
|
|
4044
|
+
filename: path.basename(opts.file),
|
|
4045
|
+
...(opts.gradeVersion ? { gradeVersion: opts.gradeVersion } : {}),
|
|
4046
|
+
...(opts.mediaVersion ? { mediaVersion: opts.mediaVersion } : {}),
|
|
4047
|
+
resolutions: opts.resolutions,
|
|
4048
|
+
disagreements: opts.disagreements,
|
|
4049
|
+
...(opts.humanListens?.length ? { humanListens: opts.humanListens } : {}),
|
|
4050
|
+
});
|
|
4051
|
+
if (missingRouteLine(res, "exodus video review"))
|
|
4052
|
+
return { code: 1, lines: ["This Exodus server does not record final reviews yet."] };
|
|
4053
|
+
if (!res.ok)
|
|
4054
|
+
return errorResult(res, opts.json);
|
|
4055
|
+
const verdict = res.data;
|
|
4056
|
+
if (opts.json)
|
|
4057
|
+
return { code: 0, lines: [JSON.stringify({ runId, storageId: file.storageId, filename: path.basename(opts.file), sha256Base64: reviewedHash, ...verdict })] };
|
|
4058
|
+
const lines = [`Recorded your ${opts.verdict} of ${path.basename(opts.file)} — ${file.storageId} (sha256 base64 ${reviewedHash}).`];
|
|
4059
|
+
if (verdict.ok)
|
|
4060
|
+
lines.push("This final-file review accepts these exact bytes. Delivery still checks the current run gates.");
|
|
4061
|
+
for (const b of verdict.blockers) {
|
|
4062
|
+
lines.push(b.finding
|
|
4063
|
+
? ` still open: ${b.finding.key} [${b.finding.status}] — answer it with --resolve "${b.finding.key}|accepted-as-is|<why>"`
|
|
4064
|
+
: ` blocks delivery: ${b.kind}${b.scene !== undefined ? ` (scene ${b.scene})` : ""}`);
|
|
4065
|
+
}
|
|
4066
|
+
return { code: 0, lines };
|
|
4067
|
+
}
|
|
4068
|
+
async function readSongListen(runId, deps) {
|
|
4069
|
+
const res = await deps.get(`${SONG_PATH}?runId=${encodeURIComponent(runId)}`);
|
|
4070
|
+
return { res, song: res.ok ? (res.data.song ?? null) : null };
|
|
4071
|
+
}
|
|
4072
|
+
const SONG_NOT_ON_THIS_SERVER = "This Exodus server does not hold Song masters for approval yet.";
|
|
4073
|
+
export async function songListenFlow(runId, json, deps) {
|
|
4074
|
+
const { res, song } = await readSongListen(runId, deps);
|
|
4075
|
+
if (missingRouteLine(res, "exodus video song"))
|
|
4076
|
+
return { code: 1, lines: [SONG_NOT_ON_THIS_SERVER] };
|
|
4077
|
+
if (!res.ok)
|
|
4078
|
+
return errorResult(res, json);
|
|
4079
|
+
if (json)
|
|
4080
|
+
return { code: 0, lines: [JSON.stringify({ runId, song })] };
|
|
4081
|
+
if (!song)
|
|
4082
|
+
return { code: 0, lines: ["This run holds no Song master yet, so there is nothing to listen to."] };
|
|
4083
|
+
const heard = song.coverage.status === "full" ? "every lyric line heard" : `lyric ${song.coverage.status}${song.coverage.unheardLines.length ? `; no word heard on line ${song.coverage.unheardLines.map((n) => n + 1).join(", ")}` : ""}`;
|
|
4084
|
+
return {
|
|
4085
|
+
code: 0,
|
|
4086
|
+
lines: [
|
|
4087
|
+
`SONG MASTER — ad run ${runId} (${song.source}, ${song.status}, ${song.seconds}s, track ${song.identity.track})`,
|
|
4088
|
+
` ${song.stop}`,
|
|
4089
|
+
` listen: ${song.audioUrl}`,
|
|
4090
|
+
` master sha256: ${song.identity.masterSha256}`,
|
|
4091
|
+
` lyric sha256: ${song.identity.lyricSha256} — ${heard}`,
|
|
4092
|
+
...song.lyric.split("\n").map((line, i) => ` ${i + 1}. ${line}`),
|
|
4093
|
+
...(song.cannotApprove ? [` cannot be approved: ${song.cannotApprove}`] : []),
|
|
4094
|
+
song.status === "approved"
|
|
4095
|
+
? ` approved at ${new Date(song.approvedAt ?? 0).toISOString()}`
|
|
4096
|
+
: ` approve it after listening: exodus video song approve ${runId} --master ${song.identity.masterSha256}`,
|
|
4097
|
+
],
|
|
4098
|
+
};
|
|
4099
|
+
}
|
|
4100
|
+
export async function songApproveFlow(runId, masterSha256, json, deps) {
|
|
4101
|
+
const { res, song } = await readSongListen(runId, deps);
|
|
4102
|
+
if (missingRouteLine(res, "exodus video song approve"))
|
|
4103
|
+
return { code: 1, lines: [SONG_NOT_ON_THIS_SERVER] };
|
|
4104
|
+
if (!res.ok)
|
|
4105
|
+
return errorResult(res, json);
|
|
4106
|
+
if (!song)
|
|
4107
|
+
return { code: 1, lines: ["This run holds no Song master yet, so there is nothing to approve."] };
|
|
4108
|
+
if (song.identity.masterSha256 !== masterSha256) {
|
|
4109
|
+
return { code: 1, lines: [`The Song master now held is ${song.identity.masterSha256}, not the one you listened to. Listen again: exodus video song ${runId}`] };
|
|
4110
|
+
}
|
|
4111
|
+
const approved = await deps.post(SONG_APPROVE_PATH, { runId, ...song.identity });
|
|
4112
|
+
if (!approved.ok)
|
|
4113
|
+
return errorResult(approved, json);
|
|
4114
|
+
if (json)
|
|
4115
|
+
return { code: 0, lines: [JSON.stringify({ ok: true, runId, ...approved.data })] };
|
|
4116
|
+
return { code: 0, lines: ["Song master approved. The run may go on to timing and motion."] };
|
|
4117
|
+
}
|
|
4118
|
+
export async function songImportFlow(runId, opts, json, deps) {
|
|
4119
|
+
const stat = deps.statFile(opts.file);
|
|
4120
|
+
if (!stat)
|
|
4121
|
+
return { code: 1, lines: [`No such file: ${opts.file}`] };
|
|
4122
|
+
const policy = ASSET_UPLOAD_POLICY.audio;
|
|
4123
|
+
const mime = policy.mimeByExtension[path.extname(opts.file).toLowerCase()];
|
|
4124
|
+
if (!mime)
|
|
4125
|
+
return { code: 1, lines: [`"${path.basename(opts.file)}" isn't an audio file the dashboard accepts. It takes ${policy.accepts}.`] };
|
|
4126
|
+
if (stat.size > policy.maxBytes)
|
|
4127
|
+
return { code: 1, lines: [`"${path.basename(opts.file)}" is over the ${Math.round(policy.maxBytes / MB)}MB limit.`] };
|
|
4128
|
+
const lyric = opts.lyric.startsWith("@") ? deps.readFile(opts.lyric.slice(1)) : opts.lyric;
|
|
4129
|
+
let bytes;
|
|
4130
|
+
try {
|
|
4131
|
+
bytes = deps.readFileBytes(opts.file);
|
|
4132
|
+
}
|
|
4133
|
+
catch (e) {
|
|
4134
|
+
return { code: 1, lines: [`Can't read "${opts.file}": ${e instanceof Error ? e.message : String(e)}`] };
|
|
4135
|
+
}
|
|
4136
|
+
const sha256 = createHash("sha256").update(bytes).digest("hex");
|
|
4137
|
+
const minting = await withUploadRetry("mint", deps, () => deps.post(ASSET_UPLOAD_URL_PATH, {}));
|
|
4138
|
+
if (!minting.ok)
|
|
4139
|
+
return uploadRetryResult(minting, json);
|
|
4140
|
+
if (!minting.value.ok)
|
|
4141
|
+
return errorResult(minting.value, json);
|
|
4142
|
+
const { uploadUrl, receiptId } = minting.value.data;
|
|
4143
|
+
if (!uploadUrl || !receiptId)
|
|
4144
|
+
return { code: 1, lines: ["The server did not hand back a place to upload to."] };
|
|
4145
|
+
const storing = await withUploadRetry("store", deps, () => deps.uploadBytes(uploadUrl, mime, bytes));
|
|
4146
|
+
if (!storing.ok)
|
|
4147
|
+
return uploadRetryResult(storing, json);
|
|
4148
|
+
if (!storing.value.ok || !storing.value.storageId)
|
|
4149
|
+
return { code: 1, lines: [`Upload failed (HTTP ${storing.value.status})`] };
|
|
4150
|
+
const storageId = storing.value.storageId;
|
|
4151
|
+
const registering = await withUploadRetry("register", deps, () => deps.post(ASSETS_PATH, { storageId, receiptId, filename: path.basename(opts.file) }));
|
|
4152
|
+
if (!registering.ok)
|
|
4153
|
+
return uploadRetryResult(registering, json);
|
|
4154
|
+
if (!registering.value.ok)
|
|
4155
|
+
return errorResult(registering.value, json);
|
|
4156
|
+
const assetId = registering.value.data.assetId;
|
|
4157
|
+
if (!assetId)
|
|
4158
|
+
return { code: 1, lines: ["The server stored the file but did not say what to call it."] };
|
|
4159
|
+
const res = await deps.post(SONG_IMPORT_PATH, {
|
|
4160
|
+
runId,
|
|
4161
|
+
assetId,
|
|
4162
|
+
sha256,
|
|
4163
|
+
lyric,
|
|
4164
|
+
rightsStatement: opts.rights,
|
|
4165
|
+
...(opts.trim ? { trim: opts.trim } : {}),
|
|
4166
|
+
});
|
|
4167
|
+
if (missingRouteLine(res, "exodus video song import"))
|
|
4168
|
+
return { code: 1, lines: [SONG_NOT_ON_THIS_SERVER] };
|
|
4169
|
+
if (!res.ok)
|
|
4170
|
+
return errorResult(res, json);
|
|
4171
|
+
if (json)
|
|
4172
|
+
return { code: 0, lines: [JSON.stringify({ ok: true, runId, assetId, sha256 })] };
|
|
4173
|
+
return {
|
|
4174
|
+
code: 0,
|
|
4175
|
+
lines: [
|
|
4176
|
+
`Your recording is the Song for this run (sha256 ${sha256}).`,
|
|
4177
|
+
`Listen to it and approve it before motion: exodus video song ${runId}`,
|
|
4178
|
+
],
|
|
4179
|
+
};
|
|
4180
|
+
}
|
|
3787
4181
|
const VALUE_FLAGS = new Set([
|
|
3788
4182
|
"show",
|
|
3789
4183
|
"script",
|
|
@@ -3796,6 +4190,7 @@ const VALUE_FLAGS = new Set([
|
|
|
3796
4190
|
"frame",
|
|
3797
4191
|
"pacing",
|
|
3798
4192
|
"source-record",
|
|
4193
|
+
"adaptation-plan",
|
|
3799
4194
|
"note",
|
|
3800
4195
|
"out",
|
|
3801
4196
|
"file",
|
|
@@ -3806,6 +4201,11 @@ const VALUE_FLAGS = new Set([
|
|
|
3806
4201
|
"set",
|
|
3807
4202
|
"clear",
|
|
3808
4203
|
"from",
|
|
4204
|
+
"to",
|
|
4205
|
+
"master",
|
|
4206
|
+
"lyric",
|
|
4207
|
+
"rights",
|
|
4208
|
+
"request-quote",
|
|
3809
4209
|
]);
|
|
3810
4210
|
export function parsePositional(args = process.argv.slice(3)) {
|
|
3811
4211
|
const out = [];
|
|
@@ -3882,6 +4282,9 @@ export async function run(flags, occurrences) {
|
|
|
3882
4282
|
"pull",
|
|
3883
4283
|
"upload",
|
|
3884
4284
|
"director",
|
|
4285
|
+
"review",
|
|
4286
|
+
"song",
|
|
4287
|
+
"quote",
|
|
3885
4288
|
];
|
|
3886
4289
|
if (sub === "voices" && flags["catalog"] !== undefined && flags["catalog"] !== false) {
|
|
3887
4290
|
return printResult(await voiceCatalogFlow(runId, json, defaultDeps));
|
|
@@ -3895,6 +4298,37 @@ export async function run(flags, occurrences) {
|
|
|
3895
4298
|
}
|
|
3896
4299
|
return printResult(await statusFlow(runId, json, defaultDeps));
|
|
3897
4300
|
}
|
|
4301
|
+
if (sub === "review") {
|
|
4302
|
+
const plan = parseReviewFlags(flags, occurrences);
|
|
4303
|
+
if (!plan.ok)
|
|
4304
|
+
usage(plan.line);
|
|
4305
|
+
return printResult(await reviewFlow(runId, { ...plan.opts, json }, defaultDeps));
|
|
4306
|
+
}
|
|
4307
|
+
if (sub === "song") {
|
|
4308
|
+
if (runId === "approve" || runId === "import") {
|
|
4309
|
+
const songRun = rest[1];
|
|
4310
|
+
if (!songRun)
|
|
4311
|
+
usage(`video song ${runId} needs a run id: exodus video song ${runId} <runId>`);
|
|
4312
|
+
if (runId === "approve") {
|
|
4313
|
+
const master = flagString(flags, "master");
|
|
4314
|
+
if (!master)
|
|
4315
|
+
usage("video song approve needs --master <masterSha256>, the master you listened to.");
|
|
4316
|
+
return printResult(await songApproveFlow(songRun, master, json, defaultDeps));
|
|
4317
|
+
}
|
|
4318
|
+
const file = flagString(flags, "file");
|
|
4319
|
+
const lyric = flagString(flags, "lyric");
|
|
4320
|
+
const rights = flagString(flags, "rights");
|
|
4321
|
+
if (!file || !lyric || !rights)
|
|
4322
|
+
usage('video song import needs --file <audio>, --lyric <text|@file> and --rights "<who owns it and consents>".');
|
|
4323
|
+
const from = flagString(flags, "from");
|
|
4324
|
+
const to = flagString(flags, "to");
|
|
4325
|
+
if ((from === undefined) !== (to === undefined) || (from !== undefined && !(Number(from) >= 0 && Number(to) > Number(from)))) {
|
|
4326
|
+
usage("video song import --from and --to are a cut of the recording in seconds, given together, with --to after --from.");
|
|
4327
|
+
}
|
|
4328
|
+
return printResult(await songImportFlow(songRun, { file, lyric, rights, ...(from !== undefined ? { trim: { from: Number(from), to: Number(to) } } : {}) }, json, defaultDeps));
|
|
4329
|
+
}
|
|
4330
|
+
return printResult(await songListenFlow(runId, json, defaultDeps));
|
|
4331
|
+
}
|
|
3898
4332
|
if (sub === "storyboard")
|
|
3899
4333
|
return printResult(await storyboardFlow(runId, json, defaultDeps));
|
|
3900
4334
|
if (sub === "director") {
|
|
@@ -3903,11 +4337,18 @@ export async function run(flags, occurrences) {
|
|
|
3903
4337
|
usage(`video director needs on, off or follow: exodus video director ${runId} on`);
|
|
3904
4338
|
return printResult(await directorFlow(runId, choice.on, json, defaultDeps));
|
|
3905
4339
|
}
|
|
4340
|
+
if (sub === "quote")
|
|
4341
|
+
return printResult(await quoteFlow(runId, json, defaultDeps, flags["private"] !== undefined && flags["private"] !== false));
|
|
3906
4342
|
if (sub === "approve") {
|
|
4343
|
+
const requestQuoteHash = flagString(flags, "request-quote");
|
|
4344
|
+
if (flags["request-quote"] !== undefined && !/^[0-9a-f]{64}$/.test(requestQuoteHash ?? "")) {
|
|
4345
|
+
usage("--request-quote needs the reviewSha256 printed by exodus video quote.");
|
|
4346
|
+
}
|
|
3907
4347
|
return printResult(await approveFlow(runId, {
|
|
3908
4348
|
json,
|
|
3909
4349
|
approveStaleCut: flags["approve-stale-cut"] === true,
|
|
3910
4350
|
acceptFindings: flags["accept-findings"] === true,
|
|
4351
|
+
...(requestQuoteHash ? { requestQuoteHash } : {}),
|
|
3911
4352
|
}, defaultDeps));
|
|
3912
4353
|
}
|
|
3913
4354
|
if (sub === "flag") {
|