Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.
JavaScript 2d-animationai-agentsai-videoanimationclaude-codecodexmulti-agentstyle-transfervideo-generation
No cast sheet or cast gate for pieces with no characters
許元豪4f4f9759d184
diff --git a/app/server/jobs.ts b/app/server/jobs.tsindex 9f32f3b..c2aad14 100644--- a/app/server/jobs.ts+++ b/app/server/jobs.ts@@ -375,7 +375,8 @@ export async function message(id: string, text: string, meta: MessageMeta = {})async function productionNote(id: string, msg: string) {const j = load(id), d = dirOf(id), ph = j.pipeline?.phase;update(id, (x) => { x.needs = []; x.error = null; x.failed = null; });- if (ph === 'cast' || (j.pipeline?.cast && !j.pipeline.cast.pass)) {+ const cast = (readJSON<Production>(join(d, 'build', 'production.json'))?.characters || []).length > 0;+ if (cast && (ph === 'cast' || (j.pipeline?.cast && !j.pipeline.cast.pass))) {const rv = readJSON<Review>(join(d, 'out', 'check', 'cast', 'review.json')) || {};pipe(id, (p) => { p.cast = { round: 0, pass: false, ...p.cast, state: 'fixing' }; });if (!(await step(id, 'producing', 'cast_fix', { issues: rv.issues || [], round: 'user', message: msg }, ['out/check/cast/sheet.jpg', 'out/check/cast/fixes.json']))) return;@@ -411,11 +412,13 @@ export async function approve(id: string) {// ---------- production: gates where defects are born ----------async function production(id: string, { fresh = false } = {}): Promise<boolean> {const d = dirOf(id), prev: Pipeline = fresh ? {} : load(id).pipeline || {};- const hasSetup = !fresh && existsSync(join(d, 'build', 'production.json')) && existsSync(join(d, 'out', 'check', 'cast', 'sheet.jpg'));+ // a piece with no characters (typography, motion graphics) has no cast sheet to make+ const sheet = (readJSON<Plan>(join(d, 'plan.json'))?.characters || []).length ? ['out/check/cast/sheet.jpg'] : [];+ const hasSetup = !fresh && [join('build', 'production.json'), ...sheet].every((f) => existsSync(join(d, f)));// 1) director: scaffold, shared assets, cast sheets, chunk plan (skipped when resuming)if (!hasSetup) {pipe(id, (p) => { p.phase = 'setup'; });- if (!(await step(id, 'producing', 'setup', {}, ['build/production.json', 'out/check/cast/sheet.jpg']))) return false;+ if (!(await step(id, 'producing', 'setup', {}, ['build/production.json', ...sheet]))) return false;} else setStage(id, 'producing', { error: null, failed: null });// 2) cast gate and 3) shot building run at the same time: shots only call the shared character definitions, so cast fixes// flow into them automatically. Shot REVIEWS wait until the cast has passed, and re-grab fresh frames first.@@ -522,6 +525,7 @@ async function castGate(id: string, prev: Pipeline): Promise<boolean> {const files = new Set(chars.map((c) => c.file));const parallel = chars.length > 1 && files.size === chars.length && chars.every((c) => existsSync(join(d, c.sheet)));if (prev.cast?.pass) return true;+ if (!(prod.characters || []).length) { pipe(id, (p) => { p.cast = { round: 0, pass: true, state: 'passed' }; }); return true; } // no cast: nothing to reviewif (!parallel) return castSerial(id, prev);const setC = (cid: string, v: Partial<CastCharProgress>) => pipe(id, (p) => { const cast = p.cast!; cast.chars = cast.chars || {}; cast.chars[cid] = { ...(cast.chars[cid] ?? { state: 'queued', round: 0 }), ...v }; });const keep: Record<string, CastCharProgress> = prev.cast?.mode === 'parallel' ? prev.cast.chars || {} : {}; // resuming: characters that already passed stay passeddiff --git a/app/server/pipeline.test.ts b/app/server/pipeline.test.tsindex f7fe139..5a0923c 100644--- a/app/server/pipeline.test.ts+++ b/app/server/pipeline.test.ts@@ -38,7 +38,7 @@ function outputs(prompt: string, dir: string): [string, Record<string, unknown>]if (m(/## 步驟:依使用者意見修改企劃/)) return ['replan', { 'plan.json': { title: 'T', version: 3 } }];if (m(/## 步驟:製作準備/)) return ['setup', {'build/production.json': { chunks: S.chunks, characters: S.chars.map((id) => ({ id, name: id, file: `build/${id}.js`, sheet: `out/check/cast/sheet_${id}.jpg` })) },- 'out/check/cast/sheet.jpg': 'jpg', ...Object.fromEntries(S.chars.map((id) => [`out/check/cast/sheet_${id}.jpg`, 'jpg'])) }];+ ...(S.chars.length ? { 'out/check/cast/sheet.jpg': 'jpg' } : {}), ...Object.fromEntries(S.chars.map((id) => [`out/check/cast/sheet_${id}.jpg`, 'jpg'])) }]; // no cast → no sheetif (m(/## 步驟:角色關/)) {const round = +(m(/第 (\d+) 輪/)?.[1] || 1), ch = m(/結果寫到 out\/check\/cast\/review_(\S+?)\.json/)?.[1];const who = ch || (m(/只看並排圖/) ? 'lineup' : 'serial'), ok = S.castPass(who, round);@@ -259,3 +259,29 @@ describe('pauses', () => {assert.equal(JSON.parse(readFileSync(join(J.dirOf(id), 'plan.json'), 'utf8')).version, 3);});});++describe('no characters', () => {+ test('a piece with no cast (typography, motion graphics) skips the cast sheet and the cast gate', async () => {+ S = base({ chars: [] });+ const id = newProject('plan_review');+ writeFileSync(join(J.dirOf(id), 'plan.json'), JSON.stringify({ title: 'T', version: 1, characters: [] }));+ await J.approve(id);+ const j = J.load(id);+ assert.equal(j.stage, 'done', j.error || '');+ assert.equal(j.pipeline.cast?.pass, true);+ assert.ok(!calls.some((c) => c.startsWith('cast_')), calls.join(', '));+ });++ test('a note while paused in the shot line goes to the shots, not to a cast fix', async () => {+ let s2 = 0; // S2 fails its first three reviews (the round limit), then passes after the note+ S = base({ chars: [], shotPass: (shot) => shot !== 'S2' || ++s2 > 3 });+ const id = newProject('plan_review');+ writeFileSync(join(J.dirOf(id), 'plan.json'), JSON.stringify({ title: 'T', version: 1, characters: [] }));+ await J.approve(id);+ assert.equal(J.load(id).stage, 'needs_input');+ calls = [];+ await J.message(id, 'make the title bigger');+ assert.ok(!calls.some((c) => c.startsWith('cast_')), calls.join(', '));+ assert.equal(J.load(id).stage, 'done', J.load(id).error || '');+ });+});