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: negotiate exact source audio for federated video

[._.]/ Adam Eivy031ec3f9a5aa
diff --git a/server/lib/federatedMediaRequest.js b/server/lib/federatedMediaRequest.js
index c72d9a814a..713424fab5 100644
--- a/server/lib/federatedMediaRequest.js
+++ b/server/lib/federatedMediaRequest.js
@@ -40,6 +40,7 @@ const FIELD_MAPS = Object.freeze({
initImageStrength: 'initImageStrength',
}),
video: Object.freeze({
+ audioConditioning: 'audioConditioning',
negativePrompt: 'negativePrompt',
width: 'width',
height: 'height',
diff --git a/server/lib/federatedMediaWire.js b/server/lib/federatedMediaWire.js
index 35e25d1bb3..feccd25352 100644
--- a/server/lib/federatedMediaWire.js
+++ b/server/lib/federatedMediaWire.js
@@ -157,6 +157,7 @@ export function normalizeRequestedMediaKinds(raw) {
// staging name, and the provider's path resolver cannot drift on what an
// acceptable conditioning image is.
export const FEDERATED_MEDIA_ASSET_EXTENSION = Object.freeze({
+ 'audio/wav': 'wav',
'image/png': 'png',
'image/jpeg': 'jpg',
'image/webp': 'webp',
@@ -180,7 +181,7 @@ export const FEDERATED_MEDIA_ASSET_TTL_MS = 6 * 60 * 60 * 1000;
// lands in so a capability's `roles` list reads as the set of fields a consumer
// may send, with no second mapping to keep in sync.
export const FEDERATED_MEDIA_INPUT_ROLES = Object.freeze([
- 'initImage', 'referenceImages', 'sourceImage', 'lastImage',
+ 'initImage', 'referenceImages', 'sourceImage', 'lastImage', 'sourceAudio',
]);
// Which of those roles hold a LIST rather than a single slot. One home, because
@@ -227,6 +228,18 @@ export const federatedMediaAssetId = (instanceId, sha256) =>
// What a submission carries in place of the bytes. Deliberately just the id:
// the id embeds the digest the provider verified at upload, so a second copy on
// the wire would be a second source of truth for the same fact.
+export const federatedSourceAudioSchema = z.object({
+ sourceSha256: z.string().regex(/^[a-f0-9]{64}$/),
+ clipSha256: z.string().regex(/^[a-f0-9]{64}$/),
+ sampleRate: z.literal(48000),
+ channels: z.literal(2),
+ startSample: z.number().int().min(0).max(48000 * 36000),
+ endSample: z.number().int().positive().max(48000 * 36000),
+ sampleCount: z.number().int().positive().max(48000 * 60),
+}).strict().refine((v) => v.endSample - v.startSample === v.sampleCount, {
+ message: 'Audio window must match its exact sample count',
+});
+
export const federatedMediaInputAssetRefSchema = z.object({
assetId: federatedMediaAssetIdSchema,
}).strict();
@@ -262,6 +275,7 @@ export const federatedMediaAssetSchema = z.object({
// and any provider-side filename validation. One source so a new result kind
// can't drift the two.
export const FEDERATED_MEDIA_RESULT_EXTENSION = Object.freeze({
+ 'audio/wav': 'wav',
'audio/wav': 'wav',
'image/png': 'png',
'video/mp4': 'mp4',
@@ -303,6 +317,14 @@ export const federatedMediaCapabilitySchema = z.object({
label: z.string().trim().max(120).optional(),
})).max(100).nullable().optional(),
inputAssets: federatedMediaInputAssetsSchema,
+ // Supplied audio drives motion; it does not establish verified lip-sync.
+ sourceAudio: z.object({ requiresImage: z.boolean() }).strict().optional(),
+ hardwareEligible: z.boolean().optional(),
+ memory: z.object({
+ requiredGb: z.number().nonnegative().nullable(),
+ totalGb: z.number().positive(),
+ freeGb: z.number().nonnegative(),
+ }).optional(),
});
// Per-kind occupancy of the provider's own generation lanes. Counts only —
@@ -348,7 +370,7 @@ const federatedMediaQueueStatusSchema = z.object({
// Additive and optional in both directions, so no SCHEMA_VERSIONS bump: a
// newer feature reaches an older consumer as an unmatched string, and an
// absent list reads as the wire-v1 baseline (see federatedMediaSupports).
-export const FEDERATED_MEDIA_FEATURES = Object.freeze(['lyrics', 'inputAssets']);
+export const FEDERATED_MEDIA_FEATURES = Object.freeze(['lyrics', 'inputAssets', 'sourceAudio']);
// A feature name is a short identifier token. Underscores and hyphens are in
// the alphabet even though this build's own vocabulary is camelCase: the point
diff --git a/server/lib/pathSafety.js b/server/lib/pathSafety.js
index 81ce57ab99..d128b3ffbc 100644
--- a/server/lib/pathSafety.js
+++ b/server/lib/pathSafety.js
@@ -286,7 +286,7 @@ export const resolveImageCleanTmp = makePathResolver(() => PATHS.imageCleanTmp);
* cannot become an arbitrary path argument to the generator.
*/
export const resolveFederatedMediaAsset = makePathResolver(() => PATHS.federatedMediaInbox, {
- extensions: ['png', 'jpg', 'jpeg', 'webp'],
+ extensions: ['png', 'jpg', 'jpeg', 'webp', 'wav'],
});
/**
diff --git a/server/lib/validation.js b/server/lib/validation.js
index ab63732faf..918f9c6ed8 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -1,3 +1,4 @@
+import { federatedSourceAudioSchema } from './federatedMediaWire.js';
import { MAX_IMAGE_EDGE, MAX_IMAGE_PIXELS } from './imageLimits.js';
export { MAX_IMAGE_EDGE, MAX_IMAGE_PIXELS } from './imageLimits.js';
import { CREDENTIALS } from './credentialRegistry.js';
@@ -1394,9 +1395,17 @@ export const federatedMediaVideoJobSubmissionBaseSchema = federatedMediaJobRouti
seed: z.number().int().min(0).optional(),
sourceImage: federatedMediaInputAssetRefSchema.optional(),
lastImage: federatedMediaInputAssetRefSchema.optional(),
+ sourceAudio: federatedMediaInputAssetRefSchema.optional(),
+ audioConditioning: federatedSourceAudioSchema.optional(),
}).strict();
export const federatedMediaVideoJobSubmissionSchema = federatedMediaVideoJobSubmissionBaseSchema
+ .refine((v) => Boolean(v.sourceAudio) === Boolean(v.audioConditioning), {
+ message: 'sourceAudio and audioConditioning must be supplied together',
+ })
+ .refine((v) => !v.sourceAudio || (!v.lastImage && v.sourceAudio.assetId.endsWith(v.audioConditioning?.clipSha256 || '!')), {
+ message: 'Source audio must match its clip digest and cannot combine with an end frame',
+ })
// First-last-frame needs both ends. A lone end frame would render a plain
// text-to-video clip and quietly discard the frame the caller supplied.
.refine((value) => value.lastImage === undefined || value.sourceImage !== undefined, {
diff --git a/server/services/federatedMedia/assetStore.js b/server/services/federatedMedia/assetStore.js
index 8ccedaab2c..5a2bff80b0 100644
--- a/server/services/federatedMedia/assetStore.js
+++ b/server/services/federatedMedia/assetStore.js
@@ -20,6 +20,7 @@
* state (rule 4). Neither is conditioning, and neither has a field on the wire.
*/
+import { pcmAudioInfo } from './sourceAudio.js';
import { readdir, rm, stat, utimes } from 'node:fs/promises';
import { join } from 'node:path';
import { ServerError } from '../../lib/errorHandler.js';
@@ -123,7 +124,7 @@ export async function storeFederatedMediaAsset({ callerId, mimeType, declaredSha
}
// Magic bytes, not just the declared header. The header is the caller's word
// for what this is; the bytes are what the generator will actually open.
- const detected = detectImageFormat(body);
+ const detected = mimeType === 'audio/wav' && pcmAudioInfo(body) ? { mime: 'audio/wav' } : detectImageFormat(body);
if (!detected || detected.mime !== mimeType) {
reject(
`Conditioning image bytes are not ${mimeType}`,
@@ -190,7 +191,7 @@ export async function describeFederatedMediaAsset(callerId, assetId) {
// The queue params a federated job reaches its conditioning through — the same
// four the provider writes in `buildQueueParams`. Listed here because this is
// where they have to be READ back to keep them alive.
-const CONDITIONING_PARAMS = ['initImagePath', 'referenceImagePaths', 'sourceImagePath', 'lastImagePath'];
+const CONDITIONING_PARAMS = ['initImagePath', 'referenceImagePaths', 'sourceImagePath', 'lastImagePath', 'audioFilePath'];
/**
* Basenames any queued or running job still depends on.
diff --git a/server/services/federatedMedia/inputAssets.js b/server/services/federatedMedia/inputAssets.js
index 4e39d8ea51..c48bce946c 100644
--- a/server/services/federatedMedia/inputAssets.js
+++ b/server/services/federatedMedia/inputAssets.js
@@ -24,6 +24,7 @@
* this side of the seam: the size cap, the MIME allowlist, the digest check.
*/
+import { pcmAudioInfo, resolveSourceAudioPath } from './sourceAudio.js';
import { readFile, stat } from 'node:fs/promises';
import { z } from 'zod';
import {
@@ -59,6 +60,7 @@ const ROLE_PARAMS = Object.freeze({
video: Object.freeze({
sourceImage: ['sourceImagePath', 'sourceImageFile'],
lastImage: ['lastImagePath', 'lastImageFile'],
+ sourceAudio: ['audioFilePath'],
}),
});
@@ -101,6 +103,12 @@ export const remoteInputAssetsSchema = z.array(remoteInputAssetSchema)
* @returns {string|null} a human-facing reason, or null when acceptable
*/
export function inputAssetRejection(capability, assets = [], status = null) {
+ if (assets.some((asset) => asset.role === 'sourceAudio')
+ && (!status?.features?.includes('sourceAudio') || !capability?.sourceAudio)) {
+ return 'This peer/model has not negotiated supplied-audio video generation.';
+ }
+ if (assets.some((asset) => asset.role === 'sourceAudio') && capability?.sourceAudio?.requiresImage
+ && !assets.some((asset) => asset.role === 'sourceImage')) return 'Supplied audio on this model requires a source image.';
const limits = capability?.inputAssets;
const model = capability?.modelName || 'The selected model';
// The remedy names the kind the caller is actually rendering. Saying
@@ -168,13 +176,13 @@ export function inputAssetRejection(capability, assets = [], status = null) {
function createInputAssetStager({ requestJson, emitStatus }) {
const uploads = new Map();
- async function uploadInputAsset(localPath) {
+ async function uploadInputAsset(localPath, role) {
// Re-anchored against the approved image roots on every attempt, exactly as
// the LOCAL runner re-validates the same input. The marker is persisted,
// user-editable queue state, so the path that becomes an outbound upload has
// to be one this machine would have rendered from — a bare basename resolves,
// and anything outside those roots resolves to null and is refused.
- const resolved = resolveImageInputPath(localPath);
+ const resolved = role === 'sourceAudio' ? resolveSourceAudioPath(localPath) : resolveImageInputPath(localPath);
const info = resolved ? await stat(resolved).catch(() => null) : null;
if (!info?.isFile()) {
throw inputAssetError(
@@ -214,14 +222,14 @@ function createInputAssetStager({ requestJson, emitStatus }) {
'MEDIA_PROVIDER_INPUT_UNREADABLE',
);
}
- const detected = detectImageFormat(body);
+ const detected = role === 'sourceAudio' && pcmAudioInfo(body) ? { mime: 'audio/wav' } : detectImageFormat(body);
if (!detected || !FEDERATED_MEDIA_ASSET_MIME_TYPES.includes(detected.mime)) {
throw inputAssetError(
'A conditioning image for this render is not a format peers accept',
'MEDIA_PROVIDER_ASSET_TYPE_UNSUPPORTED',
);
}
- emitStatus('Sending source image to the remote provider');
+ emitStatus('Sending conditioning asset to the remote provider');
const response = await requestJson('/api/federation/media/v1/assets', {
method: 'POST',
headers: { 'Content-Type': detected.mime, 'X-Content-SHA256': digest },
@@ -247,11 +255,12 @@ function createInputAssetStager({ requestJson, emitStatus }) {
// path concurrently, so memoizing only completed uploads would let a repeated
// path start a second transfer of the same bytes before the first could
// populate the cache — the exact case the memo exists to collapse.
- return function stageInputAsset(localPath) {
- const pending = uploads.get(localPath);
+ return function stageInputAsset(localPath, role) {
+ const key = `${role}:${localPath}`;
+ const pending = uploads.get(key);
if (pending) return pending;
- const upload = uploadInputAsset(localPath);
- uploads.set(localPath, upload);
+ const upload = uploadInputAsset(localPath, role);
+ uploads.set(key, upload);
return upload;
};
}
@@ -283,7 +292,7 @@ export async function applyRemoteInputAssets(request, assets, ctx, schema) {
// otherwise waiting out the last inside the run's timeout envelope. The
// results are folded in afterwards, in the original order, because reference
// order is conditioning order.
- const assetIds = await Promise.all(assets.map(({ path }) => stageAsset(path)));
+ const assetIds = await Promise.all(assets.map(({ path, role }) => stageAsset(path, role)));
const next = { ...request };
for (const [index, { role }] of assets.entries()) {
const assetId = assetIds[index];
diff --git a/server/services/federatedMedia/remoteSubmission.js b/server/services/federatedMedia/remoteSubmission.js
index 62d00f0dee..fac1e5ac0e 100644
--- a/server/services/federatedMedia/remoteSubmission.js
+++ b/server/services/federatedMedia/remoteSubmission.js
@@ -227,6 +227,9 @@ export async function prepareRemoteMediaJob({ peerId, kind, request, inputAssets
const effectiveRequest = kind === 'video'
? negotiateVideoConstraints(request, capability)
: request;
+ if (request.audioConditioning && (effectiveRequest.fps !== request.fps || effectiveRequest.numFrames !== request.numFrames)) {
+ throw new ServerError('Peer frame constraints would change the supplied audio window', { status: 400, code: 'MEDIA_PROVIDER_INPUT_UNSUPPORTED' });
+ }
return {
peer,
capability,
diff --git a/server/services/federatedMedia/sourceAudio.js b/server/services/federatedMedia/sourceAudio.js
new file mode 100644
index 0000000000..64d7eab785
--- /dev/null
+++ b/server/services/federatedMedia/sourceAudio.js
@@ -0,0 +1,76 @@
+/** Exact PCM conditioning windows. Paths stay local; only hashes and sample clocks travel. */
+import { randomUUID } from 'node:crypto';
+import { readFile, unlink } from 'node:fs/promises';
+import { join, resolve } from 'node:path';
+import { PATHS, ensureDir, sha256File } from '../../lib/fileUtils.js';
+import { isPathInsideDir } from '../../lib/pathSafety.js';
+import { ServerError } from '../../lib/errorHandler.js';
+
+// A bounded parser, not an audio decoder. The one accepted transport is stereo
+// 48 kHz signed 16-bit PCM; RIFF metadata chunks may occur before/after data.
+export function pcmAudioInfo(bytes) {
+ if (!Buffer.isBuffer(bytes) || bytes.length < 44 || bytes.toString('ascii', 0, 4) !== 'RIFF'
+ || bytes.toString('ascii', 8, 12) !== 'WAVE' || bytes.readUInt32LE(4) + 8 !== bytes.length) return null;
+ let format = false;
+ let samples = null;
+ for (let at = 12; at + 8 <= bytes.length;) {
+ const kind = bytes.toString('ascii', at, at + 4);
+ const size = bytes.readUInt32LE(at + 4);
+ const start = at + 8;
+ if (start + size > bytes.length) return null;
+ if (kind === 'fmt ') {
+ if (format || size < 16 || bytes.readUInt16LE(start) !== 1
+ || bytes.readUInt16LE(start + 2) !== 2 || bytes.readUInt32LE(start + 4) !== 48000
+ || bytes.readUInt32LE(start + 8) !== 192000 || bytes.readUInt16LE(start + 12) !== 4
+ || bytes.readUInt16LE(start + 14) !== 16) return null;
+ format = true;
+ }
+ if (kind === 'data') {
+ if (samples !== null || size === 0 || size % 4) return null;
+ samples = size / 4;
+ }
+ at = start + size + (size % 2);
+ }
+ return format && samples > 0 && samples <= 48000 * 60
+ ? { sampleRate: 48000, channels: 2, sampleCount: samples } : null;
+}
+
+export function resolveSourceAudioPath(path) {
+ if (typeof path !== 'string' || !path.endsWith('.wav')) return null;
+ const absolute = resolve(path);
+ return isPathInsideDir(PATHS.uploads, absolute) ? absolute : null;
+}
+
+/** Slice a project recording to the model's exact frame span, on a 48 kHz clock. */
+export async function prepareSourceAudioWindow({ project, scene, numFrames, fps }) {
+ const startSample = Math.round(scene.startSec * 48000);
+ const sampleCount = Math.round(((numFrames - 1) / fps) * 48000);
+ if (!Number.isSafeInteger(startSample) || startSample < 0 || !Number.isSafeInteger(sampleCount)
+ || sampleCount <= 0 || sampleCount > 48000 * 60) {
+ throw new ServerError('Supply a timed scene and a video window of at most 60 seconds', { status: 400, code: 'MUSIC_VIDEO_AUDIO_WINDOW_INVALID' });
+ }
+ const [{ resolveMasterAudioPath }, { findFfmpeg, runFfmpegProcess }] = await Promise.all([
+ import('../musicVideo/render.js'), import('../../lib/ffmpeg.js'),
+ ]);
+ const source = await resolveMasterAudioPath(project);
+ const sourceSha256 = await sha256File(source);
+ const bin = await findFfmpeg();
+ if (!bin) throw new ServerError('ffmpeg is required for supplied audio', { status: 503, code: 'FFMPEG_MISSING' });
+ await ensureDir(PATHS.uploads);
+ const audioFilePath = join(PATHS.uploads, `mv-source-audio-${randomUUID()}.wav`);
+ try {
+ const endSample = startSample + sampleCount;
+ const result = await runFfmpegProcess({ bin, args: ['-v', 'error', '-i', source, '-vn',
+ '-af', `aresample=48000,atrim=start_sample=${startSample}:end_sample=${endSample},asetpts=PTS-STARTPTS`,
+ '-ar', '48000', '-ac', '2', '-c:a', 'pcm_s16le', '-y', audioFilePath] });
+ const info = result.ok ? pcmAudioInfo(await readFile(audioFilePath)) : null;
+ if (info?.sampleCount !== sampleCount || await sha256File(source) !== sourceSha256) {
+ throw new ServerError('The recording changed or cannot cover the exact requested audio window', { status: 409, code: 'MUSIC_VIDEO_AUDIO_WINDOW_INVALID' });
+ }
+ return { audioFilePath, audioConditioning: { sourceSha256, clipSha256: await sha256File(audioFilePath),
+ ...info, startSample, endSample } };
+ } catch (error) {
+ await unlink(audioFilePath).catch(() => {});
+ throw error;
+ }
+}
diff --git a/server/services/federatedMediaProvider.js b/server/services/federatedMediaProvider.js
index d9ef54a0e9..fbaeba8e5b 100644
--- a/server/services/federatedMediaProvider.js
+++ b/server/services/federatedMediaProvider.js
@@ -7,7 +7,10 @@
* allowlisted capability/job/result projections cross the peer boundary.
*/
-import { stat } from 'node:fs/promises';
+import { stat, readFile } from 'node:fs/promises';
+import { totalmem, freemem } from 'node:os';
+import { evaluateHardwareRequirements } from '../lib/systemCapabilities.js';
+import { pcmAudioInfo } from './federatedMedia/sourceAudio.js';
import { ServerError } from '../lib/errorHandler.js';
import { createMutex } from '../lib/asyncMutex.js';
import { canonicalStringify } from '../lib/objects.js';
@@ -115,8 +118,9 @@ function federatedInputProfile(kind, model) {
const modes = resolveVideoSupportedModes(model);
if (!Array.isArray(modes) || modes.length === 0) return null;
const roles = [];
- if (modes.includes('image') || modes.includes('fflf')) roles.push('sourceImage');
+ if (modes.includes('image') || modes.includes('fflf') || modes.includes('a2v')) roles.push('sourceImage');
if (modes.includes('fflf')) roles.push('lastImage');
+ if (modes.includes('a2v')) roles.push('sourceAudio');
if (!roles.length) return null;
return { roles, required: !modes.includes('text') };
}
@@ -166,6 +170,7 @@ const INPUT_ASSET_FIELDS = Object.freeze({
video: [
{ role: 'sourceImage', param: 'sourceImagePath' },
{ role: 'lastImage', param: 'lastImagePath' },
+ { role: 'sourceAudio', param: 'audioFilePath' },
],
});
@@ -244,6 +249,18 @@ async function resolveSubmissionInputAssets({ callerId, input, capability }) {
{ assetId: missing.assetId },
);
}
+ if (found.some((hit) => entry.role === 'sourceAudio' ? hit.mimeType !== 'audio/wav' : !hit.mimeType.startsWith('image/'))) {
+ unavailable('Conditioning asset type does not match its role', 'MEDIA_PROVIDER_INPUT_UNSUPPORTED', 400);
+ }
+ if (entry.role === 'sourceAudio') {
+ const info = pcmAudioInfo(await readFile(found[0].path));
+ const audio = input.audioConditioning;
+ if (!audio || !info || info.sampleCount !== audio.sampleCount
+ || await sha256File(found[0].path) !== audio.clipSha256
+ || Math.abs((input.numFrames - 1) / input.fps - info.sampleCount / info.sampleRate) > 1 / info.sampleRate) {
+ unavailable('Source audio does not match its exact sample window', 'MEDIA_PROVIDER_ASSET_INTEGRITY', 400);
+ }
+ }
const paths = found.map((hit) => hit.path);
params[entry.param] = isMultiInputRole(entry.role) ? paths : paths[0];
}
@@ -442,13 +459,20 @@ async function localGeneratorCapabilities(kind, pythonPath, { models, configured
: needsPython ? !!pythonPath
: kind === 'video' ? await isByovRuntimeReady(model?.runtime)
: true;
- const held = kind === 'video' && model && isVideoModelHeld(model.id, model.runtime);
+ const requiredGb = model?.hardwareRequirements?.minMemoryGb ?? model?.memoryGb ?? null;
+ const hardware = model?.hardwareCompatibility || evaluateHardwareRequirements({
+ ...model?.hardwareRequirements, ...(requiredGb ? { minMemoryGb: requiredGb } : {}),
+ });
+ const hardwareEligible = hardware.state === 'available';
+ const memory = { requiredGb, totalGb: totalmem() / 2 ** 30, freeGb: freemem() / 2 ** 30 };
+ const held = kind === 'video' && model && isVideoModelHeld(model.id, model.runtime);
const reason = !isLocal ? 'unknown-engine'
: !model ? 'unknown-model'
: !modelSupportsInput ? 'unsupported-input'
: !runtimeReady || held ? 'runtime-unavailable'
: !modelReady ? 'model-unavailable'
- : null;
+ : !hardwareEligible ? 'hardware-ineligible'
+ : null;
const frameStride = Number.isInteger(Number(model?.frameStride)) && Number(model.frameStride) >= 1 && Number(model.frameStride) <= 64
? Number(model.frameStride)
: null;
@@ -497,6 +521,10 @@ async function localGeneratorCapabilities(kind, pythonPath, { models, configured
defaultDurationSec: null,
lyrics: false,
inputAssets: federatedInputAssetsBlock(kind, model),
+ hardwareEligible,
+ memory,
+ ...(kind === 'video' && resolveVideoSupportedModes(model).includes('a2v')
+ ? { sourceAudio: { requiresImage: true } } : {}),
autoDuration: false,
frameStride,
maxNumFrames: Number.isFinite(maxNumFrames) && maxNumFrames > 0 ? maxNumFrames : null,
@@ -816,6 +844,12 @@ export async function submitFederatedMediaJob({ callerId, config, input, idempot
reason: capability.unavailableReason,
});
}
+ if (input.sourceAudio && (!capability.sourceAudio || !input.sourceImage)) {
+ unavailable('This model requires negotiated source audio and a source image', 'MEDIA_PROVIDER_INPUT_UNSUPPORTED', 400);
+ }
+ if (input.sourceAudio && capability.memory?.requiredGb > capability.memory?.freeGb) {
+ unavailable('Insufficient free memory for supplied audio generation', 'MEDIA_PROVIDER_BUSY', 429, { retryable: true });
+ }
validateFederatedVideoControls(input, capability._model);
// Lyrics reach a lyric-aware model only. `input.lyrics` is checked for a
// non-empty string rather than mere presence: a consumer that renders an
@@ -938,7 +972,8 @@ function buildQueueParams(input, capability, federatedMedia, inputAssetParams =
// explicit or the end frame is silently dropped and the clip comes back as
// a plain image-to-video. 'image'/'fflf' are pipeline semantics, not
// backend tokens, so neither diverts the dispatcher off the local runner.
- ...(inputAssetParams.lastImagePath
+ ...(input.audioConditioning ? { audioConditioning: input.audioConditioning, audioStartSec: 0, disableAudio: true } : {}),
+ ...(inputAssetParams.audioFilePath ? { mode: 'a2v' } : inputAssetParams.lastImagePath
? { mode: 'fflf' }
: inputAssetParams.sourceImagePath ? { mode: 'image' } : {}),
};