feat(cli): share rendered videos through unified reviews (#7135)

This commit is contained in:
Terence Cho
2026-11-09 16:10:31 -08:00
parent 48a2b4e019
commit b72970cb4a
23 changed files with 1363 additions and 20 deletions
+6 -4
View File
@@ -49,10 +49,11 @@ import { versionSentence } from "./reviewVersionSentences.mjs";
/** `projectId` overrides the recorded review project; `open`: a held video is watched only while the project is open.
* `filesForExport`: the synced snapshot a new version carries, null for
* none.
* none. `allowPending` lets a host treat accepted processing or screening as a successful return.
* @typedef {VersionHooks & { projectPath: string, title: string, client: ReviewClient, put?: typeof putFile,
* sleep?: (ms: number) => Promise<void>, probe?: (file: string) => Promise<VideoFacts | null>, now?: () => number,
* projectId?: string | null, filesForExport?: FilesForRender, fromReview?: FromReview | null }} VersionRequest */
* projectId?: string | null, filesForExport?: FilesForRender, fromReview?: FromReview | null,
* allowPending?: boolean }} VersionRequest */
/** The snapshot of `rendered`, the project as the export was rendered; null when the folder is not that render.
* @typedef {(projectPath: string, rendered: string | null) => Promise<import("./types/reviewWire.js").SnapshotRef | null>}
@@ -640,7 +641,7 @@ async function sendVersion(r, report, source, id, state) {
/** @param {Required<VersionRequest>} r @param {VersionRecord} state
* @param {NonNullable<VersionRecord["pending"]>} pending @param {string} id @param {ExportDTO} done @param {boolean} first */
async function finishRun(r, state, pending, id, done, first) {
if (going(done)) return stillGoing(done);
if (going(done)) return r.allowPending ? null : stillGoing(done);
const failed = await finish(r.projectPath, state, pending, id, done, r.fromReview);
if (!failed) {
const fromReview = pending.reviewSent?.value;
@@ -663,6 +664,7 @@ export async function addVersion(request) {
now: () => Date.now(),
onProgress: () => {},
open: () => true,
allowPending: false,
filesForExport: async () => null,
fromReview: null,
onAdded: () => {},
@@ -755,7 +757,7 @@ async function settleSavedExport(dir, client, fromReview) {
const id = await reviewProjectId(dir);
if (!pending?.videoId || !id || pending.projectId !== id) return;
const done = await client.readExport(id, pending.videoId);
if (going(done)) return;
if (done.status === "upload_pending" || going(done)) return;
const failure = await finish(dir, state, pending, id, done, fromReview);
const key = normalize(dir);
if (failure) failures.set(key, { ...failure, exportKey: exportKeyOf(dir) });