Skip to content

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

feat: add Eidoverse Video music-video render style

[._.]/ Adam Eivyb4f051d5e38a
diff --git a/client/src/components/musicVideo/EidoverseVideoPanel.jsx b/client/src/components/musicVideo/EidoverseVideoPanel.jsx
new file mode 100644
index 0000000000..a7d843815d
--- /dev/null
+++ b/client/src/components/musicVideo/EidoverseVideoPanel.jsx
@@ -0,0 +1,43 @@
+import { useState } from 'react';
+import { updateMusicVideoProject } from '../../services/apiMusicVideo.js';
+import { compositionDraft } from './compositionDraft.js';
+
+/** Authored scene input; execution happens only through the render controls. */
+export default function EidoverseVideoPanel({ project, onProject }) {
+ const [source, setSource] = useState(() => project.composition?.eidoverseScene
+ ? JSON.stringify(project.composition.eidoverseScene, null, 2) : '');
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState('');
+ const [saved, setSaved] = useState(false);
+ const save = async () => {
+ setError('');
+ setSaved(false);
+ let scene;
+ try { scene = JSON.parse(source); } catch { setError('Enter a valid scene JSON object.'); return; }
+ if (!scene || typeof scene.inlineScript !== 'string' || !scene.inlineScript.trim()) {
+ setError('The scene needs a non-empty inlineScript.'); return;
+ }
+ setBusy(true);
+ await updateMusicVideoProject(project.id, { composition: compositionDraft(project, { eidoverseScene: scene }) }, { silent: true })
+ .then((next) => { onProject(next); setSaved(true); })
+ .catch((err) => setError(err?.message || 'Could not save the Eidoverse scene.'))
+ .finally(() => setBusy(false));
+ };
+ return (
+ <section aria-label="Eidoverse Video" className="min-w-0 space-y-2 border-t border-port-border pt-3">
+ <h3 className="text-sm font-medium">Eidoverse Video</h3>
+ <p className="text-xs text-port-text-muted">Render an authored 3D scene with the optional Eidoverse Video runtime. The master song supplies the audio. Save the scene, then render a draft in Review &amp; Export before approving production.</p>
+ <p className="text-xs text-port-text-muted">Requires Docker and the PortOS Eidoverse render image; setup is documented in docs/EIDOVERSE_VIDEO.md. The runtime is separate AGPL-3.0 software. Rendering uses software WebGPU; long scenes can take time.</p>
+ <label htmlFor="mv-eidoverse-scene" className="block text-xs text-port-text-muted">Scene JSON (inlineScript and optional bundled assets)</label>
+ <textarea id="mv-eidoverse-scene" value={source} disabled={busy} rows={12}
+ onChange={(event) => { setSource(event.target.value); setSaved(false); }}
+ placeholder={'{"inlineScript":"... Eidoverse scene code ...","assets":{}}'}
+ className="w-full min-w-0 rounded border border-port-border bg-port-bg p-2 font-mono text-xs" />
+ <p className="text-xs text-port-text-muted">Song duration, aspect and 24 fps are set by the project. Assets must use bundled eidoverse/assets/ paths. Code runs in a container with network access disabled. Drafts render from song time zero, then trim the requested window to preserve simulation timing.</p>
+ {error && <p role="alert" className="text-xs text-port-error">{error}</p>}
+ {saved && <p role="status" className="text-xs text-port-success">Scene saved. Render a draft to review it with the song.</p>}
+ <button type="button" onClick={save} disabled={busy || !source.trim()}
+ className="min-h-[44px] rounded border border-port-border bg-port-bg px-3 py-1.5 text-sm disabled:opacity-50">{busy ? 'Saving…' : 'Save scene'}</button>
+ </section>
+ );
+}
diff --git a/client/src/components/musicVideo/EidoverseVideoPanel.test.jsx b/client/src/components/musicVideo/EidoverseVideoPanel.test.jsx
new file mode 100644
index 0000000000..30392e618a
--- /dev/null
+++ b/client/src/components/musicVideo/EidoverseVideoPanel.test.jsx
@@ -0,0 +1,42 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { render, screen, fireEvent, waitFor, cleanup } from '@testing-library/react';
+vi.mock('../../services/apiMusicVideo.js', () => ({ updateMusicVideoProject: vi.fn() }));
+import { updateMusicVideoProject } from '../../services/apiMusicVideo.js';
+import EidoverseVideoPanel from './EidoverseVideoPanel.jsx';
+import { RenderStyleSelect, RenderFinalButton } from './ProjectActionGroups.jsx';
+const project = { id: 'example', uploadedAudioFilename: 'song.wav', audioAnalysis: { durationSec: 10 }, composition: { mode: 'eidoverse', textCues: [], style: { color: '#ffffff', font: 'sans' } } };
+beforeEach(() => { cleanup(); vi.clearAllMocks(); });
+it('offers Eidoverse as its own render style and saves the scene without generating footage', async () => {
+ const onRenderStyle = vi.fn();
+ render(<RenderStyleSelect project={project} onRenderStyle={onRenderStyle} />);
+ fireEvent.change(screen.getByLabelText('Render style'), { target: { value: 'eidoverse' } });
+ expect(onRenderStyle).toHaveBeenCalledWith('eidoverse');
+ const scene = { inlineScript: 'globalThis.setup = async () => {};' };
+ const saved = { ...project, composition: { ...project.composition, eidoverseScene: scene } };
+ updateMusicVideoProject.mockResolvedValue(saved);
+ const onProject = vi.fn();
+ render(<EidoverseVideoPanel project={project} onProject={onProject} />);
+ fireEvent.change(screen.getByLabelText(/Scene JSON/), { target: { value: JSON.stringify(scene) } });
+ fireEvent.click(screen.getByRole('button', { name: 'Save scene' }));
+ await waitFor(() => expect(onProject).toHaveBeenCalledWith(saved));
+ expect(updateMusicVideoProject).toHaveBeenCalledWith('example', { composition: { ...project.composition, version: 1, posterSec: null, eidoverseScene: scene } }, { silent: true });
+});
+it('keeps failed saves editable with a visible error and does not claim success', async () => {
+ updateMusicVideoProject.mockRejectedValue(new Error('Scene assets are invalid'));
+ const onProject = vi.fn();
+ render(<EidoverseVideoPanel project={project} onProject={onProject} />);
+ fireEvent.change(screen.getByLabelText(/Scene JSON/), { target: { value: '{"inlineScript":"x"}' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Save scene' }));
+ await waitFor(() => expect(screen.getByRole('alert').textContent).toContain('Scene assets are invalid'));
+ expect(onProject).not.toHaveBeenCalled();
+ expect(screen.getByRole('button', { name: 'Save scene' }).disabled).toBe(false);
+ expect(screen.queryByRole('status')).toBeNull();
+});
+it('allows final Eidoverse rendering with a saved scene and current approval without scene footage, and blocks a missing scene', () => {
+ const renderJob = { start: vi.fn(), active: false };
+ const view = render(<RenderFinalButton project={project} renderJob={renderJob} readiness={{ readyForProduction: true }} />);
+ expect(screen.getByRole('button', { name: 'Render final' }).disabled).toBe(true);
+ view.rerender(<RenderFinalButton project={{ ...project, composition: { ...project.composition, eidoverseScene: { inlineScript: 'x' } } }} renderJob={renderJob} readiness={{ readyForProduction: true }} />);
+ fireEvent.click(screen.getByRole('button', { name: 'Render final' }));
+ expect(renderJob.start).toHaveBeenCalledWith('example');
+});
diff --git a/client/src/components/musicVideo/ProjectActionGroups.jsx b/client/src/components/musicVideo/ProjectActionGroups.jsx
index 252a321a4c..78f505686c 100644
--- a/client/src/components/musicVideo/ProjectActionGroups.jsx
+++ b/client/src/components/musicVideo/ProjectActionGroups.jsx
@@ -90,7 +90,7 @@ export function GenerationActions({ project, videoSettings, sceneMedia }) {
// needs neither frame nor clip, so the counts cover the scenes that use them.
const mode = project.composition?.mode || 'concat';
const layered = isLayeredComposition(project);
- const codeMode = mode === 'code';
+ const codeMode = mode === 'code' || mode === 'eidoverse';
const frameScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) !== 'card');
const footageScenes = scenes.filter((scene) => sceneVisualLayer(scene, { layered }) === 'footage');
const referenceFrameCount = frameScenes.filter((scene) => scene.referenceImageId).length;
@@ -102,7 +102,7 @@ export function GenerationActions({ project, videoSettings, sceneMedia }) {
const footageFramesReady = footageScenes.every((scene) => scene.referenceImageId);
const generatingFrames = Object.keys(sceneMedia.genScenes).length > 0;
const generatingVideos = Object.keys(sceneMedia.genVideoScenes).length > 0;
- const footageBlocked = codeMode ? 'Code-rendered style draws the picture in code and does not generate footage' : '';
+ const footageBlocked = codeMode ? 'This render style draws its own scene and does not generate footage' : '';
return (
<div className={groupCls}>
<RecordRenderPinRow
@@ -168,6 +168,10 @@ export function RenderFinalButton({ project, renderJob, readiness }) {
const layered = isLayeredComposition(project);
const codeMode = mode === 'code';
const documentMode = mode === 'document';
+ const eidoverseMode = mode === 'eidoverse';
+ const eidoverseBlocked = !eidoverseMode ? '' : noAudioOf(project) ? 'Link a track first'
+ : !(project.audioAnalysis?.durationSec > 0) ? 'Analyze the master song first'
+ : !project.composition?.eidoverseScene?.inlineScript ? 'Save an Eidoverse scene in Compose first' : '';
const readySceneCount = scenes.filter((scene) => sceneRenderReady(scene, { layered })).length;
const noAudio = noAudioOf(project);
const codeDuration = Math.max(
@@ -191,9 +195,11 @@ export function RenderFinalButton({ project, renderJob, readiness }) {
);
}
return (
- <button onClick={() => renderJob.start(project.id)} disabled={!readiness?.readyForProduction || renderJob.active || (documentMode ? !!documentBlocked : codeMode ? !codeReady : (sceneCount === 0 || readySceneCount !== sceneCount))}
+ <button onClick={() => renderJob.start(project.id)} disabled={!readiness?.readyForProduction || renderJob.active || (eidoverseMode ? !!eidoverseBlocked : documentMode ? !!documentBlocked : codeMode ? !codeReady : (sceneCount === 0 || readySceneCount !== sceneCount))}
title={!readiness?.readyForProduction ? 'Approve the current visual guide, timed storyboard and animated proof first' : renderJob.active
? 'Wait for the other project render to finish, or return to it to cancel'
+ : eidoverseMode
+ ? (eidoverseBlocked || 'Render the Eidoverse scene over the master song')
: documentMode
? (documentBlocked || 'Render the composition document over the song')
: codeMode
diff --git a/client/src/components/musicVideo/compositionDraft.js b/client/src/components/musicVideo/compositionDraft.js
index 30ca6a3b3b..95e30d2101 100644
--- a/client/src/components/musicVideo/compositionDraft.js
+++ b/client/src/components/musicVideo/compositionDraft.js
@@ -10,6 +10,7 @@ export const RENDER_STYLES = [
['composed', 'Composed'],
['code', 'Code-rendered'],
['document', 'Composition document'],
+ ['eidoverse', 'Eidoverse Video'],
];
export function compositionDraft(project, patch = {}) {
diff --git a/client/src/components/musicVideo/stages/ComposeStage.jsx b/client/src/components/musicVideo/stages/ComposeStage.jsx
index 5a4acc3fad..0f95c5768f 100644
--- a/client/src/components/musicVideo/stages/ComposeStage.jsx
+++ b/client/src/components/musicVideo/stages/ComposeStage.jsx
@@ -1,6 +1,7 @@
import { RenderFailure } from '../RenderStatusPanel.jsx';
import GradePanel from '../GradePanel.jsx';
import TypographyPanel from '../TypographyPanel.jsx';
+import EidoverseVideoPanel from '../EidoverseVideoPanel.jsx';
import CodeVideoPanel from '../CodeVideoPanel.jsx';
import DocumentCompositionPanel from '../DocumentCompositionPanel.jsx';
import { RenderStyleSelect } from '../ProjectActionGroups.jsx';
@@ -22,7 +23,8 @@ export default function ComposeStage({ board }) {
<RenderStyleSelect project={project} onRenderStyle={board.onRenderStyle} />
</div>
<GradePanel project={project} onSave={board.saveCompositionGrade} />
- <TypographyPanel project={project} onEditLocal={board.editProjectLocal} onSave={board.saveProjectFields} />
+ {mode !== 'eidoverse' && <TypographyPanel project={project} onEditLocal={board.editProjectLocal} onSave={board.saveProjectFields} />}
+ {mode === 'eidoverse' && <EidoverseVideoPanel key={project.id} project={project} onProject={board.replaceProject} />}
{mode === 'code' && (
<CodeVideoPanel project={project} audioUrl={audioUrl} onProject={board.replaceProject} />
)}
diff --git a/docker/eidoverse-video/Dockerfile b/docker/eidoverse-video/Dockerfile
new file mode 100644
index 0000000000..28150a6a22
--- /dev/null
+++ b/docker/eidoverse-video/Dockerfile
@@ -0,0 +1,11 @@
+# Build the upstream auto branch's render-only eidoverse:render image first.
+# Context: the independent eidoverse-video checkout, never the PortOS data tree.
+FROM eidoverse:render
+USER root
+COPY --chown=node:node eidoverse /workspace/eidoverse
+COPY --chown=node:node deno.json deno.lock LICENSE /workspace/
+USER node
+ENV DENO_DIR=/home/node/.cache/deno
+RUN deno cache --node-modules-dir=auto eidoverse/render_common.mjs eidoverse/render_scene.mjs npm:@dimforge/[email protected]
+# Software WebGPU is portable; upstream's NVENC default requires NVIDIA.
+ENV GALLIUM_DRIVER=llvmpipe RENDER_CODEC=libx264 LD_LIBRARY_PATH=""
diff --git a/docs/EIDOVERSE_VIDEO.md b/docs/EIDOVERSE_VIDEO.md
new file mode 100644
index 0000000000..6900f48e24
--- /dev/null
+++ b/docs/EIDOVERSE_VIDEO.md
@@ -0,0 +1,67 @@
+# Eidoverse Video in Music Video Studio
+
+Choose **Compose → Render style → Eidoverse Video** to render an authored
+[Eidoverse Video](https://github.com/anima-research/eidoverse-video) scene over
+an analyzed master song. This is a separate renderer from Code Animation,
+HTML composition documents and video-generation models. No provider call runs
+when selecting or saving it. Existing projects retain their chosen renderer.
+
+## Optional runtime setup
+
+Eidoverse remains a separate AGPL-3.0 checkout and container image. PortOS does
+not vendor its engine or install it on startup. The Worlds feature toggle and
+Worlds server are not required. Read upstream's license, asset licenses and
+setup requirements before building. These commands are explicit operator setup,
+not commands PortOS runs on a render request:
+
+1. Obtain the upstream `auto` branch in an independent checkout, following its
+ setup documentation. Build its render-only base image there:
+
+ ```sh
+ docker build -f docker/Dockerfile --build-arg AGENT=none -t eidoverse:render docker
+ ```
+
+2. Build the PortOS adapter image with that checkout as context. Replace the
+ placeholders with the two checkout locations:
+
+ ```sh
+ docker build -f <portos-root>/docker/eidoverse-video/Dockerfile \
+ -t portos-eidoverse-video:1 <eidoverse-video-root>
+ ```
+
+Docker must be running on the PortOS host. The adapter uses Mesa software
+WebGPU and libx264 for a portable baseline; it does not request host GPU devices.
+Software rendering can be slow. The image contains the engine, bundled assets
+and cached dependencies; render jobs never download dependencies or pull images.
+A missing image or unavailable Docker engine produces an actionable preflight
+error before a job is marked rendering. Image discovery is not a render-readiness
+or visual-quality verdict: validate a real draft on the target host.
+
+## Authoring and review
+
+Use the upstream scene API to author a JSON object with `inlineScript` and an
+optional `assets` map. Paste it into **Scene JSON** and save it. Asset values
+must name bundled `eidoverse/assets/` files, without parent traversal or URLs.
+PortOS supplies width/height from the project's aspect ratio, 24 fps, the analyzed
+song duration rounded to a frame, and the output location. Other JSON fields are
+rejected rather than silently overriding the project.
+
+Render a draft in **Review & Export**. Eidoverse simulations start at zero;
+draft rendering runs the scene's full song timeline and then trims the requested
+window, including the corresponding master-song offset. This preserves the same
+simulation state in the proof and final film. The existing art/storyboard/proof
+review requirements still apply to final rendering. Asset autopilot does not
+queue scene media for this mode; author the scene in Compose.
+
+Scene changes invalidate the existing proof through the normal composition
+review basis. The scene source and bundled asset references can sync to another
+user-controlled install; the optional runtime image is machine-local. Schema
+version 20 prevents older peers from dropping the new render mode/source.
+
+The container runs without network, capabilities, host credentials or PortOS
+API access. Its root filesystem and input are read-only. Only the private job
+output directory and bounded temporary space are writable. PortOS bounds time,
+CPU, memory and process count, removes the container on cancel/failure, validates
+its output, and muxes the master song outside the scene runtime. No uncontained
+host execution fallback is provided. Typography and grading controls for HTML
+compositions do not apply to this renderer; author those visuals in the scene.
diff --git a/docs/README.md b/docs/README.md
index 1d705cc2a2..390f50621f 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -62,7 +62,7 @@ Identity & self: [digital-twin](./features/digital-twin.md) · [identity-system]
Knowledge: [brain-system](./features/brain-system.md) · [untrusted messages and GitHub automation](./features/messages-security.md) · [scope adherence](./features/scope-adherence.md)
-Create: [writers-room](./features/writers-room.md) · [fableloom](./features/fableloom.md) · [Eidoverse Worlds integration](./features/eidoverse.md) · [OpenWorld historical reference](./features/openworld.md) · [sprite-export-contract](./features/sprite-export-contract.md) · [video-text-encoders](./features/video-text-encoders.md) · [video-speed-profiles](./features/video-speed-profiles.md) · [video-render-batches](./features/video-render-batches.md) · [video-upscale](./features/video-upscale.md)
+Create: [writers-room](./features/writers-room.md) · [fableloom](./features/fableloom.md) · [Eidoverse Worlds integration](./features/eidoverse.md) · [Eidoverse music-video renderer](./EIDOVERSE_VIDEO.md) · [OpenWorld historical reference](./features/openworld.md) · [sprite-export-contract](./features/sprite-export-contract.md) · [video-text-encoders](./features/video-text-encoders.md) · [video-speed-profiles](./features/video-speed-profiles.md) · [video-render-batches](./features/video-render-batches.md) · [video-upscale](./features/video-upscale.md)
Comms & voice: [beeper](./features/beeper.md) · [openclaw-operator-chat](./features/openclaw-operator-chat.md) ([pre-build audit](./research/2026-03-31-openclaw-operator-chat-audit.md)) · [stacker-news](./features/stacker-news.md) · [voice](./features/voice.md) ([Jev feasibility](./research/2026-09-30-jev-voice-feasibility.md))
diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.js
index 0cb769e896..56a7592350 100644
--- a/server/lib/musicVideoValidation.js
+++ b/server/lib/musicVideoValidation.js
@@ -298,7 +298,7 @@ export const musicVideoLyricsAlignSchema = z.object({
// `document` renders a project-owned HTML composition document (its own
// folder under data/music-video/<projectId>/composition/) seeked over the
// song; see services/musicVideo/compositionDocument.js and documentRender.js.
-export const MUSIC_VIDEO_COMPOSITION_MODES = ['concat', 'composed', 'code', 'document'];
+export const MUSIC_VIDEO_COMPOSITION_MODES = ['concat', 'composed', 'code', 'document', 'eidoverse'];
// #9290: 'scene' cuts once per planned shot; 'intercut' re-cuts on section energy and sung words.
export const MUSIC_VIDEO_CUTTING_MODES = ['scene', 'intercut'];
// Shipped starting points a project can copy into its document folder.
@@ -405,6 +405,15 @@ export const musicVideoReactiveSectionSchema = z.object({
maxGain: z.number().min(0).max(1),
}).strict();
+// Scene code is data until the isolated Eidoverse container renders it. No
+// executable, host path, output path or remote asset can be selected here.
+export const musicVideoEidoverseSceneSchema = z.object({
+ inlineScript: z.string().trim().min(1).max(100000),
+ assets: z.record(z.string().regex(/^[A-Za-z0-9_-]{1,80}$/),
+ z.string().max(300).regex(/^eidoverse\/assets\/(?:[A-Za-z0-9_-][A-Za-z0-9_.-]*\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*$/))
+ .refine(assets => Object.keys(assets).length <= 32, 'At most 32 assets').optional(),
+}).strict();
+
// Replaced whole by a project PATCH (the editor sends the full manifest).
export const musicVideoCompositionSchema = z.object({
version: z.literal(1).optional(),
@@ -426,6 +435,7 @@ export const musicVideoCompositionSchema = z.object({
accentColor: z.string().regex(/^#[0-9a-f]{6}$/i, 'accentColor is #rrggbb').optional(),
}).strict().optional(),
posterSec: timedSec,
+ eidoverseScene: musicVideoEidoverseSceneSchema.nullable().optional(),
codeVideo: musicVideoCodeVideoSchema.nullable().optional(),
document: musicVideoCompositionDocumentSchema.nullable().optional(),
documentDraft: musicVideoCompositionDocumentSchema.nullable().optional(),
diff --git a/server/lib/schemaVersions.js b/server/lib/schemaVersions.js
index 7795a958a0..8a684b7b55 100644
--- a/server/lib/schemaVersions.js
+++ b/server/lib/schemaVersions.js
@@ -678,7 +678,9 @@ export const PORTOS_SCHEMA_VERSIONS = Object.freeze({
// composition normalizers drop these fields on edit. Absent remains legacy;
// no stored row rewrite is needed. Document manifests remain wire-local.
// v19 pins whole-workflow media policy; older peers cannot enforce it.
- musicVideoProjects: 19,
+ // v20 adds the Eidoverse render mode and scene source. Older normalizers
+ // would collapse the mode to footage and discard the authored scene.
+ musicVideoProjects: 20,
// v1 = Creative Commission FEEDBACK federation (PostgreSQL `commission_feedback`)
// via the per-record peer-sync push pipeline (record kind `commissionFeedback`,
// sync category `commissionFeedback`, #2686 — split-record follow-up to #2657).
diff --git a/server/lib/schemaVersions.test.js b/server/lib/schemaVersions.test.js
index 55b9d0a478..487df19371 100644
--- a/server/lib/schemaVersions.test.js
+++ b/server/lib/schemaVersions.test.js
@@ -66,10 +66,10 @@ describe('PORTOS_SCHEMA_VERSIONS', () => {
describe('buildPortosMeta', () => {
it('rejects repair, timing and narrative event metadata on older music-video peers', async () => {
const meta = await buildPortosMeta();
- expect(meta.schemaVersions.musicVideoProjects).toBe(19);
- for (const receiverV of [13, 14, 15, 16, 17, 18]) {
+ expect(meta.schemaVersions.musicVideoProjects).toBe(20);
+ for (const receiverV of [13, 14, 15, 16, 17, 18, 19]) {
expect(compareSchemaVersions(meta.schemaVersions, { ...meta.schemaVersions, musicVideoProjects: receiverV }).ahead)
- .toContainEqual({ category: 'musicVideoProjects', senderV: 19, receiverV });
+ .toContainEqual({ category: 'musicVideoProjects', senderV: 20, receiverV });
}
});
diff --git a/server/services/musicVideo/composition.js b/server/services/musicVideo/composition.js
index da461d1e82..2dc07d7510 100644
--- a/server/services/musicVideo/composition.js
+++ b/server/services/musicVideo/composition.js
@@ -20,6 +20,7 @@ import { normalizeMusicVideoGrade } from '../../lib/musicVideoGrade.js';
import { randomUUID } from 'crypto';
import { trimTo } from '../../lib/textUtils.js';
import {
+ musicVideoEidoverseSceneSchema,
MUSIC_VIDEO_COMPOSITION_MODES as COMPOSITION_MODES,
MUSIC_VIDEO_CUTTING_MODES as CUTTING_MODES,
MUSIC_VIDEO_DOCUMENT_DIRECTORY,
@@ -144,6 +145,7 @@ export function normalizeComposition(input) {
});
}
const style = input.style && typeof input.style === 'object' ? input.style : {};
+ const eidoverse = musicVideoEidoverseSceneSchema.safeParse(input.eidoverseScene);
const codeVideo = normalizeCodeVideo(input.codeVideo);
const documentRef = normalizeCompositionDocument(input.document);
const documentDraft = normalizeCompositionDocument(input.documentDraft);
@@ -166,6 +168,7 @@ export function normalizeComposition(input) {
// Absent unless a code video was actually stored, so a composed manifest
// stays the shape peers and clones already compare.
...(codeVideo ? { codeVideo } : {}),
+ ...(eidoverse.success ? { eidoverseScene: eidoverse.data } : {}),
// Same posture: present only once a document was imported / a HUD set.
...(documentRef ? { document: documentRef } : {}),
...(documentDraft ? { documentDraft } : {}),
diff --git a/server/services/musicVideo/eidoverseRender.js b/server/services/musicVideo/eidoverseRender.js
new file mode 100644
index 0000000000..6719021f67
--- /dev/null
+++ b/server/services/musicVideo/eidoverseRender.js
@@ -0,0 +1,136 @@
+/** Eidoverse is an optional independent AGPL runtime, never host eval. */
+import { mkdtemp, mkdir, writeFile, rm, lstat, realpath, readdir, chmod, access } from 'node:fs/promises';
+import { constants } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { randomUUID } from 'node:crypto';
+import { ServerError } from '../../lib/errorHandler.js';
+import { bufferedSpawn } from '../../lib/bufferedSpawn.js';
+import { runStreamingCommand } from '../../lib/streamingSpawn.js';
+import { whichFirst } from '../../lib/processEnv.js';
+import { musicVideoEidoverseSceneSchema } from '../../lib/musicVideoValidation.js';
+import { codeFrameSize, quantizeSongDuration } from './codeTimeline.js';
+import { musicVideoAspect } from '../../lib/musicVideoAspect.js';
+
+export const EIDOVERSE_RENDER_IMAGE = 'portos-eidoverse-video:1';
+const DOCKER_FALLBACKS = ['/usr/local/bin/docker', '/opt/homebrew/bin/docker', '/Applications/Docker.app/Contents/Resources/bin/docker'];
+const OUTPUT_LIMIT = 2 * 1024 ** 3;
+const WALL_MS = 30 * 60 * 1000;
+
+export async function prepareEidoverseRender(project) {
+ const scene = musicVideoEidoverseSceneSchema.safeParse(project.composition?.eidoverseScene);
+ if (!scene.success) throw new ServerError('Save an Eidoverse scene before rendering.', { status: 422, code: 'EIDOVERSE_SCENE_REQUIRED' });
+ const duration = project.audioAnalysis?.durationSec;
+ if (!(duration > 0)) throw new ServerError('Analyze the master song before rendering Eidoverse.', { status: 422, code: 'NO_TIMELINE' });
+ let docker = await whichFirst('docker');
+ for (const candidate of DOCKER_FALLBACKS) {
+ if (docker) break;
+ if (await access(candidate, constants.X_OK).then(() => true, () => false)) docker = candidate;
+ }
+ if (!docker) throw new ServerError('Eidoverse Video requires Docker and the optional render image. See docs/EIDOVERSE_VIDEO.md.', { status: 422, code: 'EIDOVERSE_RUNTIME_MISSING' });
+ const image = await bufferedSpawn(docker, ['image', 'inspect', '--format', '{{.Id}}', EIDOVERSE_RENDER_IMAGE], { timeoutMs: 15000 });
+ const imageId = image.stdout?.trim();
+ if (!image.success || !/^sha256:[a-f0-9]{64}$/.test(imageId || '')) throw new ServerError('Build the optional Eidoverse Video render image first. See docs/EIDOVERSE_VIDEO.md.', { status: 422, code: 'EIDOVERSE_RUNTIME_MISSING' });
+ return { scene: scene.data, docker, imageId, ...codeFrameSize(musicVideoAspect(project)),
+ fps: 24, durationSec: quantizeSongDuration(duration, 24).durationSec };
+}
+
+// No checkout, home, credentials, API token, song or Docker socket is mounted.
+// Scene code can only see the installed runtime and this job's two directories.
+export function eidoverseContainerArgs({ name, root, imageId }) {
+ return ['run', '--rm', '--pull=never', '--name', name, '--network=none', '--read-only',
+ '--cap-drop=ALL', '--security-opt=no-new-privileges', '--pids-limit=256', '--memory=8g', '--cpus=4',
+ '--ulimit', `fsize=${OUTPUT_LIMIT}:${OUTPUT_LIMIT}`, '--user=1000:1000', '--tmpfs', '/tmp:rw,nosuid,nodev,size=512m,mode=1777',
+ '--mount', `type=bind,src=${join(root, 'input')},dst=/input,readonly`,
+ '--mount', `type=bind,src=${join(root, 'output')},dst=/output`,
+ '--workdir=/workspace', '--entrypoint=timeout', imageId,
+ '--signal=KILL', '1800', 'deno', 'run', '--cached-only', '--frozen', '--node-modules-dir=manual', '--allow-all', '--unstable-webgpu',
+ 'eidoverse/render_scene.mjs', '/input/scene.json'];
+}
+
+// lstat never follows worker-created symlinks. Bound both bytes and entries.
+async function outputOverLimit(directory) {
+ let bytes = 0;
+ let entries = 0;
+ for (const name of await readdir(directory)) {
+ const info = await lstat(join(directory, name)).catch(() => null);
+ if (!info) continue;
+ if (++entries > 1024 || info.isDirectory()) return true; // engine output is flat
+ bytes += info.size;
+ if (bytes > OUTPUT_LIMIT) return true;
+ }
+ return false;
+}
+
+/** Render full song time before trimming: simulations preserve their pre-roll. */
+export async function encodeEidoverseComposition({ plan, project, audioPath, outputPath, signal, onProgress, windowStart = 0, windowEnd = plan.durationSec, fade = false }) {
+ const { findFfmpeg, runFfmpegProcess, probeVideoDuration, probeVideoGeometry, edgeFadeFilter } = await import('../../lib/ffmpeg.js');
+ const ffmpeg = await findFfmpeg();
+ if (!ffmpeg) throw new ServerError('ffmpeg not found on PATH', { status: 500, code: 'FFMPEG_MISSING' });
+ signal?.throwIfAborted();
+ const root = await realpath(await mkdtemp(join(tmpdir(), 'portos-eidoverse-')));
+ const name = `portos-mv-eido-${randomUUID()}`;
+ let removed = false;
+ let quotaExceeded = false;
+ let quotaTimer;
+ let checking = false;
+ try {
+ await mkdir(join(root, 'input'));
+ // The unprivileged image user must be able to traverse/write these mounts.
+ await chmod(root, 0o755);
+ await mkdir(join(root, 'output'), { mode: 0o777 });
+ await chmod(join(root, 'output'), 0o777);
+ await writeFile(join(root, 'input', 'scene.json'), JSON.stringify({
+ ...plan.scene, width: plan.width, height: plan.height, fps: plan.fps,
+ duration: plan.durationSec, outputVideo: '/output/scene.mp4',
+ }));
+ signal?.throwIfAborted();
+ quotaTimer = setInterval(() => {
+ if (checking) return;
+ checking = true;
+ outputOverLimit(join(root, 'output')).then(over => { quotaExceeded ||= over; })
+ .catch(() => { quotaExceeded = true; }).finally(() => { checking = false; });
+ }, 500);
+ const render = await runStreamingCommand(plan.docker, eidoverseContainerArgs({ name, root, imageId: plan.imageId }), (line) => {
+ const frame = line.match(/^\[render_scene\] frame (\d+)\/(\d+)/);
+ if (frame && Number(frame[2]) > 0) onProgress?.(Math.min(0.9, Number(frame[1]) / Number(frame[2]) * 0.9));
+ },
+ { timeoutMs: WALL_MS, isCancelled: () => Boolean(signal?.aborted) || quotaExceeded });
+ // Killing docker's client does not kill its container. Confirm teardown
+ // before touching any worker output, even after normal completion.
+ const cleanup = await bufferedSpawn(plan.docker, ['rm', '--force', name], { timeoutMs: 30000 });
+ removed = cleanup.success || /no such container/i.test(cleanup.stderr || '');
+ if (!removed) throw new ServerError('Eidoverse container cleanup failed; inspect Docker before retrying.', { status: 500, code: 'EIDOVERSE_CLEANUP_FAILED' });
+ signal?.throwIfAborted();
+ if (quotaExceeded || await outputOverLimit(join(root, 'output'))) throw new ServerError('Eidoverse exceeded its output limit.', { status: 422, code: 'EIDOVERSE_OUTPUT_LIMIT' });
+ if (!render.success) throw new ServerError(render.error === 'cancelled' ? 'Render cancelled' : 'Eidoverse rendering failed. Check the scene and optional runtime setup.', { status: 422, code: render.error === 'cancelled' ? 'CANCELED' : 'EIDOVERSE_RENDER_FAILED' });
+ const silent = join(root, 'output', 'scene.mp4');
+ const info = await lstat(silent);
+ if (!info.isFile() || info.isSymbolicLink() || info.nlink !== 1 || info.size === 0 || info.size > OUTPUT_LIMIT) throw new ServerError('Eidoverse produced an invalid video.', { status: 422, code: 'EIDOVERSE_OUTPUT_INVALID' });
+ const [duration, geometry] = await Promise.all([probeVideoDuration(silent), probeVideoGeometry(silent)]);
+ if (!Number.isFinite(duration) || Math.abs(duration - plan.durationSec) > 1 / plan.fps || geometry?.width !== plan.width || geometry?.height !== plan.height || Math.abs((geometry?.fps || 0) - plan.fps) > 0.01) throw new ServerError('Eidoverse output does not match the song duration and frame size.', { status: 422, code: 'EIDOVERSE_OUTPUT_INVALID' });
+ onProgress?.(0.9);
+ const span = windowEnd - windowStart;
+ const mux = await runFfmpegProcess({ bin: ffmpeg, signal, args: [
+ '-hide_banner', '-loglevel', 'error', '-ss', String(windowStart), '-i', silent,
+ '-ss', String(windowStart), '-i', audioPath, '-map', '0:v:0', '-map', '1:a:0',
+ '-t', String(span), '-c:v', 'libx264', '-pix_fmt', 'yuv420p', '-c:a', 'aac', '-b:a', '192k',
+ '-af', `atrim=duration=${span},apad=whole_dur=${span},asetpts=PTS-STARTPTS${fade ? edgeFadeFilter(span) : ''}`,
+ '-movflags', '+faststart', '-y', outputPath,
+ ] });
+ signal?.throwIfAborted();
+ if (!mux.ok) throw new Error(mux.reason || 'Master song mux failed');
+ onProgress?.(1);
+ const boundaryTimes = [...new Set([0, ...(project.scenes || []).map(s => s.startSec - windowStart)]
+ .filter(t => t >= 0 && t < span))].sort((a, b) => a - b);
+ return { width: plan.width, height: plan.height, fps: plan.fps, durationSec: span, boundaryTimes };
+ } finally {
+ clearInterval(quotaTimer);
+ if (!removed) {
+ const cleanup = await bufferedSpawn(plan.docker, ['rm', '--force', name], { timeoutMs: 30000 });
+ removed = cleanup.success || /no such container/i.test(cleanup.stderr || '');
+ }
+ if (removed) await rm(root, { recursive: true, force: true });
+ else console.error('❌ Eidoverse container cleanup failed; retained its private scratch directory.');
+ }
+}
diff --git a/server/services/musicVideo/eidoverseRender.test.js b/server/services/musicVideo/eidoverseRender.test.js
new file mode 100644
index 0000000000..b7fb5f342e
--- /dev/null
+++ b/server/services/musicVideo/eidoverseRender.test.js
@@ -0,0 +1,74 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { writeFile, symlink, access } from 'node:fs/promises';
+import { join } from 'node:path';
+vi.mock('../../lib/processEnv.js', async load => ({ ...await load(), whichFirst: vi.fn(async () => '/usr/bin/docker') }));
+vi.mock('../../lib/bufferedSpawn.js', () => ({ bufferedSpawn: vi.fn(async () => ({ success: true, stdout: `sha256:${'a'.repeat(64)}` })) }));
+vi.mock('../../lib/streamingSpawn.js', () => ({ runStreamingCommand: vi.fn() }));
+vi.mock('../../lib/ffmpeg.js', () => ({
+ findFfmpeg: vi.fn(async () => '/usr/bin/ffmpeg'), runFfmpegProcess: vi.fn(async () => ({ ok: true })),
+ probeVideoDuration: vi.fn(async () => 10), probeVideoGeometry: vi.fn(async () => ({ width: 1280, height: 720, fps: 24 })), edgeFadeFilter: () => ',afade=t=in:d=0.1',
+}));
+const { bufferedSpawn } = await import('../../lib/bufferedSpawn.js');
+const { runStreamingCommand } = await import('../../lib/streamingSpawn.js');
+const { runFfmpegProcess, probeVideoDuration } = await import('../../lib/ffmpeg.js');
+const { normalizeComposition } = await import('./composition.js');
+const { musicVideoCompositionSchema } = await import('../../lib/musicVideoValidation.js');
+const { prepareEidoverseRender, encodeEidoverseComposition } = await import('./eidoverseRender.js');
+const project = { id: 'example', audioAnalysis: { durationSec: 10 }, scenes: [{ startSec: 2, endSec: 6 }],
+ composition: { mode: 'eidoverse', eidoverseScene: { inlineScript: 'globalThis.setup = async () => {};', assets: { prop: 'eidoverse/assets/models/example.glb' } } } };
+const outputRoot = args => args.find(arg => arg.startsWith('type=bind,src=') && arg.endsWith('dst=/output')).split(',')[1].slice(4);
+beforeEach(() => {
+ vi.clearAllMocks();
+ bufferedSpawn.mockResolvedValue({ success: true, stdout: `sha256:${'a'.repeat(64)}` });
+ probeVideoDuration.mockResolvedValue(10);
+ runStreamingCommand.mockImplementation(async (bin, args) => { await writeFile(join(outputRoot(args), 'scene.mp4'), 'synthetic fixture'); return { success: true }; });
+});
+it('preserves the new source through schema validation, normalization and renderer switches; refuses path/URL/command overrides', () => {
+ const stored = normalizeComposition(musicVideoCompositionSchema.parse(project.composition));
+ expect(stored).toMatchObject(project.composition);
+ expect(normalizeComposition({ ...stored, mode: 'code' }).eidoverseScene).toEqual(project.composition.eidoverseScene);
+ for (const scene of [
+ { inlineScript: 'x', assets: { prop: 'eidoverse/assets/../../private.json' } },
+ { inlineScript: 'x', assets: { prop: 'https://example.com/model.glb' } },
+ { inlineScript: 'x', outputVideo: '/tmp/other.mp4' },
+ { inlineScript: 'x', script: '/tmp/other.js' },
+ ]) expect(musicVideoCompositionSchema.safeParse({ mode: 'eidoverse', eidoverseScene: scene }).success).toBe(false);
+});
+it('renders in the isolated image, checks output and muxes only the matching master-song window', async () => {
+ const plan = await prepareEidoverseRender(project);
+ const result = await encodeEidoverseComposition({ plan, project, audioPath: '/example/song.wav', outputPath: '/example/final.mp4', windowStart: 2, windowEnd: 6 });
+ const args = runStreamingCommand.mock.calls[0][1];
+ expect(args).toEqual(expect.arrayContaining(['--network=none', '--read-only', '--cap-drop=ALL', '--pull=never', '--user=1000:1000', '--cached-only', plan.imageId]));
+ expect(args.some(arg => arg.includes('/example/song.wav'))).toBe(false);
+ expect(args.some(arg => arg.includes('docker.sock'))).toBe(false);
+ expect(bufferedSpawn.mock.calls.at(-1)[1]).toEqual(['rm', '--force', expect.stringMatching(/^portos-mv-eido-/)]);
+ expect(runFfmpegProcess.mock.calls[0][0].args).toEqual(expect.arrayContaining(['-ss', '2', '-t', '4', '-map', '1:a:0', '/example/song.wav']));
+ expect(result).toMatchObject({ durationSec: 4, boundaryTimes: [0] });
+ await expect(access(outputRoot(args))).rejects.toThrow();
+});
+it('refuses a missing runtime during preparation, before rendering anything', async () => {
+ bufferedSpawn.mockResolvedValue({ success: false, stdout: '' });
+ await expect(prepareEidoverseRender(project)).rejects.toMatchObject({ code: 'EIDOVERSE_RUNTIME_MISSING' });
+ expect(runStreamingCommand).not.toHaveBeenCalled();
+});
+it('stops and cleans the actual container on cancel without muxing a partial result', async () => {
+ const plan = await prepareEidoverseRender(project);
+ const controller = new AbortController();
+ runStreamingCommand.mockImplementation(async (bin, args, hook, options) => {
+ controller.abort();
+ expect(options.isCancelled()).toBe(true);
+ return { success: false, error: 'cancelled' };
+ });
+ await expect(encodeEidoverseComposition({ plan, project, audioPath: '/example/song.wav', outputPath: '/example/final.mp4', signal: controller.signal })).rejects.toThrow();
+ expect(bufferedSpawn.mock.calls.at(-1)[1][0]).toBe('rm');
+ expect(runFfmpegProcess).not.toHaveBeenCalled();
+});
+it('rejects symlink or short output instead of marking an unusable film complete', async () => {
+ const plan = await prepareEidoverseRender(project);
+ runStreamingCommand.mockImplementation(async (bin, args) => { await symlink('/example/private', join(outputRoot(args), 'scene.mp4')); return { success: true }; });
+ await expect(encodeEidoverseComposition({ plan, project, audioPath: '/example/song.wav', outputPath: '/example/final.mp4' })).rejects.toMatchObject({ code: 'EIDOVERSE_OUTPUT_INVALID' });
+ runStreamingCommand.mockImplementation(async (bin, args) => { await writeFile(join(outputRoot(args), 'scene.mp4'), 'short fixture'); return { success: true }; });
+ probeVideoDuration.mockResolvedValue(1);
+ await expect(encodeEidoverseComposition({ plan, project, audioPath: '/example/song.wav', outputPath: '/example/final.mp4' })).rejects.toMatchObject({ code: 'EIDOVERSE_OUTPUT_INVALID' });
+ expect(runFfmpegProcess).not.toHaveBeenCalled();
+});
diff --git a/server/services/musicVideo/excerptRender.js b/server/services/musicVideo/excerptRender.js
index 2155bd539f..aba4e6ea0d 100644
--- a/server/services/musicVideo/excerptRender.js
+++ b/server/services/musicVideo/excerptRender.js
@@ -85,6 +85,17 @@ const unlinkUnder = (root, filename) => {
// A code-rendered or composition-document project excerpts the same seekable
// composition, windowed on song time, instead of the footage concat.
const SEEKED_EXCERPTS = Object.freeze({
+ eidoverse: {
+ label: 'Eidoverse Video',
+ prepare: async (project) => {
+ const plan = await (await import('./eidoverseRender.js')).prepareEidoverseRender(project);
+ return { plan, totalSec: plan.durationSec, songSections: (project.scenes || [])
+ .filter(s => s.endSec > s.startSec).map(s => ({ sceneId: s.sceneId, startSec: s.startSec, endSec: s.endSec })) };
+ },
+ encode: async ({ prepared, startSec, endSec, ...input }) => (await import('./eidoverseRender.js')).encodeEidoverseComposition({
+ ...input, plan: prepared.plan, windowStart: startSec, windowEnd: endSec,
+ }),
+ },
code: {
label: 'code',
prepare: async (project) => {
diff --git a/server/services/musicVideo/production.js b/server/services/musicVideo/production.js
index 38954ea900..a7ee43fbda 100644
--- a/server/services/musicVideo/production.js
+++ b/server/services/musicVideo/production.js
@@ -207,8 +207,8 @@ export function startProductionOnProject(project, {
if (!project.scenes?.length || assets.conflicts.length) throw productionError(409, 'PRODUCTION_MEDIUM_CONFLICT', assets.conflicts.join(' ') || 'Approve a timed medium plan before starting production');
if (!authoring?.providerId || !authoring?.model) throw productionError(422, 'PRODUCTION_AUTHORING_REQUIRED', 'Select a separate code-authoring provider and model');
}
- if (!codeFirst && project?.composition?.mode === 'code') {
- throw productionError(409, 'PRODUCTION_UNSUPPORTED', 'Use Code authoring and Production review for a standalone code project: approve the storyboard, author the animation, then approve its chorus proof before rendering. Asset autopilot requires document composition.');
+ if (!codeFirst && ['code', 'eidoverse'].includes(project?.composition?.mode)) {
+ throw productionError(409, 'PRODUCTION_UNSUPPORTED', 'Use Compose and Production review for a standalone scene project: approve the storyboard, author the animation, then approve its chorus proof before rendering. Asset autopilot requires document composition.');
}
if (!Array.isArray(project?.audioAnalysis?.sections) || !project.audioAnalysis.sections.length) {
throw productionError(409, 'NOT_ANALYZED', 'Analyze the song before starting production');
diff --git a/server/services/musicVideo/render.eidoverse.test.js b/server/services/musicVideo/render.eidoverse.test.js
new file mode 100644
index 0000000000..57e983d1f5
--- /dev/null
+++ b/server/services/musicVideo/render.eidoverse.test.js
@@ -0,0 +1,49 @@
+import { expect, it, vi, afterAll } from 'vitest';
+import { mkdir, writeFile } from 'node:fs/promises';
+import { join } from 'node:path';
+import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../../lib/mockPathsDataRoot.js';
+vi.mock('../../lib/paths.js', async load => makePathsProxy(await load(), { dataRoot: () => lazyTempDataRoot('portos-mv-eidoverse-plan-') }));
+vi.mock('./productionReview.js', async load => ({ ...await load(), assertProductionApproval: vi.fn() }));
+vi.mock('../../lib/ffmpeg.js', async load => ({ ...await load(), generateThumbnail: vi.fn(async () => 'thumb.jpg') }));
+vi.mock('../instanceIdentity.js', () => ({ ensureInstanceId: vi.fn(async () => 'test-instance') }));
+vi.mock('../videoGen/local.js', () => ({ loadHistory: vi.fn(async () => []), mutateVideoHistory: vi.fn(async () => {}) }));
+vi.mock('./codeRender.js', async load => ({ ...await load(), writeCodeProofSheet: vi.fn(async () => null) }));
+vi.mock('./eidoverseRender.js', async load => ({
+ ...await load(),
+ prepareEidoverseRender: vi.fn(async project => {
+ if (!project.composition.eidoverseScene) throw Object.assign(new Error('Save a scene'), { code: 'EIDOVERSE_SCENE_REQUIRED' });
+ return { width: 1280, height: 720, durationSec: project.audioAnalysis.durationSec, fps: 24 };
+ }),
+ encodeEidoverseComposition: vi.fn(async ({ plan, windowStart = 0, windowEnd = plan.durationSec }) => ({ ...plan, durationSec: windowEnd - windowStart, boundaryTimes: [0] })),
+}));
+const { PATHS } = await import('../../lib/paths.js');
+const projects = await import('./projects.js');
+const { renderMusicVideo } = await import('./render.js');
+const { startExcerptRender } = await import('./excerptRender.js');
+const { encodeEidoverseComposition } = await import('./eidoverseRender.js');
+const { mutateVideoHistory } = await import('../videoGen/local.js');
+afterAll(cleanupTempDataRoots);
+async function create(scene = { inlineScript: 'example source' }) {
+ await mkdir(PATHS.music, { recursive: true });
+ await writeFile(join(PATHS.music, 'song.wav'), Buffer.alloc(64));
+ const p = await projects.createProject({ name: 'Example Eidoverse Film', uploadedAudioFilename: 'song.wav', composition: { mode: 'eidoverse', eidoverseScene: scene } });
+ await projects.mutateProjectRecord(p.id, current => ({ project: { ...current, audioAnalysis: { durationSec: 10, beats: [], downbeats: [], sections: [] } } }));
+ return p.id;
+}
+it('routes both the final film and song-window proof through Eidoverse without requiring generated scene clips', async () => {
+ const id = await create();
+ const { jobId } = await renderMusicVideo(id);
+ await vi.waitFor(async () => expect((await projects.getProject(id)).renderHistoryId).toBe(jobId));
+ expect(mutateVideoHistory).toHaveBeenCalled();
+ expect(encodeEidoverseComposition.mock.calls.at(-1)[0]).toMatchObject({ audioPath: join(PATHS.music, 'song.wav'), project: { composition: { mode: 'eidoverse' } } });
+ const { excerptId } = await startExcerptRender(id, { startSec: 2, endSec: 5 });
+ await vi.waitFor(async () => expect((await projects.getProject(id)).excerpts.find(e => e.id === excerptId).status).toBe('complete'));
+ expect(encodeEidoverseComposition.mock.calls.at(-1)[0]).toMatchObject({ windowStart: 2, windowEnd: 5, audioPath: join(PATHS.music, 'song.wav') });
+});
+it('refuses a missing scene for both render paths and releases their reservations for retry', async () => {
+ const id = await create(null);
+ for (let i = 0; i < 2; i++) {
+ await expect(renderMusicVideo(id)).rejects.toMatchObject({ code: 'EIDOVERSE_SCENE_REQUIRED' });
+ await expect(startExcerptRender(id, { startSec: 0, endSec: 2 })).rejects.toMatchObject({ code: 'EIDOVERSE_SCENE_REQUIRED' });
+ }
+});
diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.js
index 8c2681d38c..4e97ac7255 100644
--- a/server/services/musicVideo/render.js
+++ b/server/services/musicVideo/render.js
@@ -633,6 +633,11 @@ export async function planMusicVideoRender(project) {
// map so the existing SSE and cancel routes apply. Code mode never asks a
// footage model for pixels; a document draws the scenes' selected takes.
const SEEKED_RENDERERS = Object.freeze({
+ eidoverse: {
+ label: 'Eidoverse Video', modelId: 'music-video-eidoverse',
+ prepare: async (project) => (await import('./eidoverseRender.js')).prepareEidoverseRender(project),
+ encode: async (input) => (await import('./eidoverseRender.js')).encodeEidoverseComposition(input),
+ },
code: {
label: 'code',
modelId: 'music-video-code',