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
Warn once in chat when the event log is not writable instead of losing history silently
Rowan Ashbye35df5b9e12a
diff --git a/app/server/jobs.test.ts b/app/server/jobs.test.tsindex b03f361..50f2463 100644--- a/app/server/jobs.test.ts+++ b/app/server/jobs.test.ts@@ -135,6 +135,16 @@ describe('required inputs', () => {assert.equal(status().song, 'provided');assert.deepEqual(J.openInputs(id), []);});+ test('an unwritable event log warns once in chat instead of losing history silently', async () => {+ const S = await import('./store.ts');+ const cid = newJob().id;+ writeFileSync(join(J.dirOf(cid), 'logs'), 'x'); // block the log path (disk-full/locked-folder land here)+ S.log(cid, { type: 'text', text: 'hello' });+ S.log(cid, { type: 'text', text: 'world' });+ const texts = J.load(cid).chat.map((c) => c.text || '');+ assert.equal(texts.filter((t) => /not writable|寫不進去/.test(t)).length, 1);+ assert.ok(S.recentLog(cid).some((e) => (e as { text?: string }).text === 'hello'));+ });});describe('restart recovery', () => {diff --git a/app/server/store.ts b/app/server/store.tsindex aaf5a58..ab7f841 100644--- a/app/server/store.ts+++ b/app/server/store.ts@@ -98,10 +98,19 @@ export function recentLog(id: string): LogEvent[] {recent.set(id, list);return list;}+const unwritableLog = new Set<string>();export function log(id: string, ev: LogEntry) {const e = { ts: now(), ...ev }, list = recentLog(id);list.push(e); if (list.length > LOG_KEEP) list.splice(0, list.length - LOG_KEEP);- try { mkdirSync(dirname(eventsFile(id)), { recursive: true }); appendFileSync(eventsFile(id), JSON.stringify(e) + '\n'); } catch {}+ try { mkdirSync(dirname(eventsFile(id)), { recursive: true }); appendFileSync(eventsFile(id), JSON.stringify(e) + '\n'); unwritableLog.delete(id); }+ catch {+ // The event survives in memory, but everything after this point is lost on restart.+ // Say so once (a full disk or a locked project folder must not fail silently).+ if (!unwritableLog.has(id)) {+ unwritableLog.add(id);+ try { chat(id, 'system', L(id, '事件紀錄寫不進去,歷史訊息只留在記憶體裡,重開後會遺失;請檢查磁碟空間與專案目錄權限。', 'The event log is not writable; history stays in memory only and will be lost on restart. Check disk space and project directory permissions.')); } catch {}+ }+ }bus.emit('job', id, { type: 'log', ev: e });}export function touch(id: string) { update(id, () => {}); } // tell open pages to reload (e.g. after files were added)