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
Orchestrated art and storyboard gates park for the director when revisions run out
Claude217c804a0c17
diff --git a/server/services/musicVideo/autonomousService.js b/server/services/musicVideo/autonomousService.jsindex ca172bf558..605172984e 100644--- a/server/services/musicVideo/autonomousService.js+++ b/server/services/musicVideo/autonomousService.js@@ -261,8 +261,10 @@ async function autoApproveStage(project, run, stage) {// ---- orchestrated mode (brief.orchestrator) --------------------------------------// The orchestrator stands in for the director at each review point. A review is// one provider call; a revision is applied and judged again until it approves or-// `limits.maxReviewAttempts` revisions of that checkpoint are spent — then the-// last version is accepted and the log says so. Revisions are counted from the+// `limits.maxReviewAttempts` revisions of that checkpoint are spent — then a+// text checkpoint accepts the last version and the log says so, while an art or+// storyboard gate with changes still asked for parks for the director with them+// named. Revisions are counted from the// persisted log, so a retried stage cannot buy itself a fresh allowance.const reviewLimit = (run) => run.brief.limits?.maxReviewAttempts || AUTONOMOUS_DEFAULT_LIMITS.maxReviewAttempts;@@ -666,8 +668,15 @@ async function orchestrateProductionStage(project, run, stage) {continue;}project = await getProject(project.id);+ // Out of revisions with changes still asked for: the director decides, never a silent approval.+ if (review.verdict === 'revise' && spent >= reviewLimit(run) && review.changes.length) {+ const open = review.changes.map((c) => `${c.field || c.sceneId}: ${c.text}`);+ await recordReview(project.id, reviewEntry(stage, review, { verdict: 'revise',+ notes: `Revision limit reached; left for the director. ${review.notes || ''}`.trim(), changes: open.map((line) => trimTo(line, 300)) }));+ throw runError(409, 'MUSIC_VIDEO_APPROVAL_REQUIRED', trimTo(`The orchestrator still wants changes to the ${stage} after ${spent} revision${spent === 1 ? '' : 's'}: ${open.join(' · ')} Approve the ${stage} yourself, or resume with more revisions per step.`, 500));+ }const readiness = productionReadiness(project);- const why = review.verdict !== 'revise' ? '' : spent >= reviewLimit(run) ? 'Revision limit reached; accepted the latest version. ' : 'Nothing to revise was supplied; accepted as is. ';+ const why = review.verdict === 'revise' ? 'Nothing to revise was supplied; accepted as is. ' : '';const problem = readiness[stage].problems[0] || stageBlockers(project, run, stage)[0];if (problem) {await recordReview(project.id, reviewEntry(stage, review, { verdict: 'revise', notes: `Could not approve: ${trimTo(problem, 300)} ${review.notes || ''}`.trim() }));diff --git a/server/services/musicVideo/autonomousService.test.js b/server/services/musicVideo/autonomousService.test.jsindex 157125c16e..efe1a8daf8 100644--- a/server/services/musicVideo/autonomousService.test.js+++ b/server/services/musicVideo/autonomousService.test.js@@ -1466,6 +1466,32 @@ describe('orchestrated mode (brief.orchestrator)', () => {expect(doubles.resumeProduction.mock.calls[0][2].stopBefore).toBeUndefined();});+ // Uniquely catches the orchestrator approving art or a storyboard it still wants changed once its revisions run out.+ it('parks for the director with the open changes named when a production gate runs out of revisions', async () => {+ creativeReview.real = true;+ const actual = await vi.importActual('./productionReview.js');+ doubles.approveProductionReview = stub('approve', async (id, input) => { store.set(id, clone(actual.approveProductionStage(clone(store.get(id)), input))); });+ service.__setAutonomousDepsForTests(doubles);+ doubles.analyzeSong.mockImplementation(async () => {+ Object.assign(store.get('mv-auto'), {+ audioAnalysis: { durationSec: 20, sections: [{ id: 'chorus', label: 'Chorus', startSec: 0, endSec: 20 }] },+ scenes: [{ sceneId: 'shot', startSec: 0, endSec: 20, label: 'Chorus' }],+ devArtifacts: [{ id: 'guide', version: 1, file: 'guide.html', mimeType: 'text/html' }],+ productionReview: { draft: { cast: 'A dancer', environments: 'Theatre', visualLanguage: 'Ink', motionLanguage: 'Orbit', guideArtifactId: 'guide',+ lyricsMode: 'instrumental', timingNotes: '', storyboard: [{ sceneId: 'shot', lyricCueIds: [], action: 'Dancer unfolds', staging: 'Wide', camera: 'Orbit', transition: 'Fade' }] } },+ });+ });+ const vague = { verdict: 'revise', notes: 'Still vague.', changes: [{ field: 'cast', text: 'A dancer in a red scarf' }] };+ answers.art = [vague, vague];+ await service.startAutonomousVideo({ prompt: 'p', tools: ['code:render'], authoring: { providerId: 'example', model: 'example-code' },+ limits: { maxReviewAttempts: 1 }, orchestrator: ORCHESTRATOR }, { autoApproveAuthorized: true });+ await settled('needs-human');+ expect(runOf()).toMatchObject({ errorCode: 'MUSIC_VIDEO_APPROVAL_REQUIRED', error: expect.stringContaining('cast: A dancer in a red scarf') });+ expect(reviews().filter((r) => r.startsWith('art'))).toEqual(['art:revise', 'art:revise']);+ expect(store.get('mv-auto').productionReview.approvals?.art).toBeFalsy();+ expect(doubles.renderVideo).not.toHaveBeenCalled();+ });+it('stops revising at the review limit and keeps a Suno song rather than spend credits on a retake', async () => {answers.lyrics = Array.from({ length: 5 }, (_, i) => ({ verdict: 'revise', notes: 'Again.', lyrics: `take ${i + 1}` }));answers.song = [{ verdict: 'retake', notes: 'Muddy mix.' }];