Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: preserve in-flight video work on pause and budget dialogue time
[._.]/ Adam Eivyb94cf42e10c3
diff --git a/server/routes/creativeDirector.js b/server/routes/creativeDirector.jsindex a1b8223ad0..11ded3a0df 100644--- a/server/routes/creativeDirector.js+++ b/server/routes/creativeDirector.js@@ -452,7 +452,8 @@ router.post('/:id/start', asyncHandler(async (req, res) => {router.post('/:id/pause', asyncHandler(async (req, res) => {const project = await getProject(req.params.id);if (project?.workspace === 'video') {- await stopProject(project.id, { reason: 'Paused by the user.' });+ const { pauseVideoExecution } = await import('../services/creativeDirector/videoExecution.js');+ await pauseVideoExecution(project.id, 'Paused by the user.');return res.json(await getProject(project.id));}const updated = await updateProject(req.params.id, { status: 'paused' });diff --git a/server/routes/creativeDirector.test.js b/server/routes/creativeDirector.test.jsindex 5dbe259280..f091811a21 100644--- a/server/routes/creativeDirector.test.js+++ b/server/routes/creativeDirector.test.js@@ -77,8 +77,8 @@ import * as creativeTools from '../services/creative/toolRegistry.js';import { CREATIVE_DIRECTOR_IDS_BATCH_MAX } from '../lib/creativeDirectorValidation.js';vi.mock('../services/creativeDirector/videoReview.js', () => ({ reviewVideo: vi.fn(async () => ({ checkpoints: [], feedback: [] })), getVideoReview: vi.fn(async () => ({ checkpoints: [], canReview: true })) }));import { reviewVideo } from '../services/creativeDirector/videoReview.js';-vi.mock('../services/creativeDirector/videoExecution.js', () => ({ getVideoExecutionPreview: vi.fn(async () => ({ canStart: true })), startVideoExecution: vi.fn(async () => ({ status: 'planning' })) }));-const { getVideoExecutionPreview, startVideoExecution } = await import('../services/creativeDirector/videoExecution.js');+vi.mock('../services/creativeDirector/videoExecution.js', () => ({ getVideoExecutionPreview: vi.fn(async () => ({ canStart: true })), startVideoExecution: vi.fn(async () => ({ status: 'planning' })), pauseVideoExecution: vi.fn(async () => ({})) }));+const { getVideoExecutionPreview, startVideoExecution, pauseVideoExecution } = await import('../services/creativeDirector/videoExecution.js');import creativeDirectorRoutes from './creativeDirector.js';describe('creativeDirector routes', () => {@@ -91,7 +91,7 @@ describe('creativeDirector routes', () => {vi.clearAllMocks();});- it('previews choices, validates explicit Start limits, and cancels owned work on Video Pause', async () => {+ it('previews choices, validates explicit Start limits, and preserves in-flight work on Video Pause', async () => {cdService.getProject.mockResolvedValue({ id: 'cd-video', workspace: 'video', status: 'draft' });expect((await request(app).get('/api/creative-director/cd-video/execution')).body.canStart).toBe(true);expect(getVideoExecutionPreview).toHaveBeenCalledWith('cd-video');@@ -101,7 +101,8 @@ describe('creativeDirector routes', () => {expect((await request(app).post('/api/creative-director/cd-video/start').send(input)).status).toBe(200);expect(startVideoExecution).toHaveBeenCalledWith('cd-video', expect.objectContaining({ configurationRevision: input.configurationRevision, limits: expect.objectContaining({ maxClips: 2 }) }));await request(app).post('/api/creative-director/cd-video/pause').send({});- expect(stop.stopProject).toHaveBeenCalledWith('cd-video', { reason: 'Paused by the user.' });+ expect(pauseVideoExecution).toHaveBeenCalledWith('cd-video', 'Paused by the user.');+ expect(stop.stopProject).not.toHaveBeenCalled();});it('validates review revisions and feedback before the owner mutation', async () => {diff --git a/server/services/creativeDirector/agentBridge.js b/server/services/creativeDirector/agentBridge.jsindex a928867931..9bfd0930db 100644--- a/server/services/creativeDirector/agentBridge.js+++ b/server/services/creativeDirector/agentBridge.js@@ -93,7 +93,7 @@ async function buildTaskRecord(project, kind, scene, context) {if (project.workspace === 'video') {const { reserveVideoAttempt, assertVideoAttemptDispatch } = await import('./videoExecution.js');const audio = project.videoExecution?.choices?.audio || project.videoDraft?.audio || { mode: 'native' };- context = `${context}\n\nSaved Video audio contract: ${JSON.stringify(audio)}. Native means the audio generated inside each video clip; there is NO separate dialogue, narration, voice casting, or lip-sync pass. Imported/generated means one assembled soundtrack replacing clip audio, not per-character speech synthesis. Silent means no final audio. Never promise an unconfigured later soundtrack or dialogue pass. Put every intended audible event in its shot prompt when using native audio, and keep any spoken line short enough for that shot. Plan visual storytelling to fit this audio choice. Repeat stable character appearance, wardrobe, and voice descriptions whenever they recur; names alone are not conditioning. Reference images must be existing supplied files, never invented filenames. Shot joins: ${project.videoDraft?.transition || 'cut'}; joins do not overlap or shorten the saved shot timing. Derive act timestamps from the actual summed shot durations. Latest revision requests: ${JSON.stringify(project.videoReview?.revisionRequests || [])}.`;+ context = `${context}\n\nSaved Video audio contract: ${JSON.stringify(audio)}. Native means the audio generated inside each video clip; there is NO separate dialogue, narration, voice casting, or lip-sync pass. Imported/generated means one assembled soundtrack replacing clip audio, not per-character speech synthesis. Silent means no final audio. Never promise an unconfigured later soundtrack or dialogue pass. Put every intended audible event in its shot prompt when using native audio, and keep any spoken line short enough for that shot. Speech must finish at least one second before the saved shot duration: put a speaking-time window and quiet closing hold in the prompt, prefer 6-9 words for a six-second shot, and allow fewer words for a slow voice or preceding action. Assembly trims any extra frames returned by the renderer, so never rely on that extra time to finish a sentence. Plan visual storytelling to fit this audio choice. Repeat stable character appearance, wardrobe, and voice descriptions whenever they recur; names alone are not conditioning. Reference images must be existing supplied files, never invented filenames. Shot joins: ${project.videoDraft?.transition || 'cut'}; joins do not overlap or shorten the saved shot timing. Derive act timestamps from the actual summed shot durations. Latest revision requests: ${JSON.stringify(project.videoReview?.revisionRequests || [])}.`;attempt = await reserveVideoAttempt(project.id, { kind, expectedProductionRevision: project.videoWorkRevision || 0, key: `${kind}:${scene?.sceneId || 'project'}`, ...(scene ? { sceneId: scene.sceneId, workRevision: scene.workRevision || 0 } : {}) });if (!attempt) return null;await assertVideoAttemptDispatch(project.id, attempt.id).catch(async error => {diff --git a/server/services/creativeDirector/videoExecution.test.js b/server/services/creativeDirector/videoExecution.test.jsindex a6793f0202..085bd03eeb 100644--- a/server/services/creativeDirector/videoExecution.test.js+++ b/server/services/creativeDirector/videoExecution.test.js@@ -130,6 +130,21 @@ it('reserves before enqueue, binds one queue ID, enforces retry bounds and pauseexpect(enqueueUnattendedMediaJob).toHaveBeenCalledTimes(1);});+it('parks new dispatch on Pause while retaining the in-flight clip for Resume', async () => {+ await startVideoExecution('example-video', await startInput());+ const queued = await enqueue();+ await assertVideoAttemptDispatch('example-video', queued.attemptId, { jobId: queued.jobId });+ state.project.treatment.scenes[0].status = 'rendering';+ await pauseVideoExecution('example-video', 'Paused by the user.');+ expect(await enqueue()).toBeNull();+ expect(state.project.treatment.scenes[0].workRevision).toBe(0);+ state.jobs[0].status = 'completed';+ await settleVideoAttempt('example-video', queued.attemptId, { status: 'completed' });+ await startVideoExecution('example-video', await startInput());+ expect(state.project.treatment.scenes[0]).toMatchObject({ status: 'evaluating', renderedJobId: queued.jobId, workRevision: 0 });+ expect(enqueueUnattendedMediaJob).toHaveBeenCalledTimes(1);+});+it('keeps uncertain submissions inert until the user explicitly acknowledges a possible duplicate charge', async () => {await startVideoExecution('example-video', await startInput());enqueueUnattendedMediaJob.mockRejectedValueOnce(new Error('connection lost after submit'));