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 Runway Seedream 5 pro/lite image models with ordered references (#13199)

Adam Eivy23ef2264be6d
diff --git a/server/lib/imageGenCapabilities.js b/server/lib/imageGenCapabilities.js
index 283986e56d..72cde0a510 100644
--- a/server/lib/imageGenCapabilities.js
+++ b/server/lib/imageGenCapabilities.js
@@ -21,6 +21,7 @@
*/
import { CLOUD_IMAGE_GEN_MODES, IMAGE_GEN_MODE, IMAGE_GEN_MODES } from './generationModes.js';
+import { getRunwayImageModel } from './runwayImageModels.js';
import { FAL_IMAGE_MIN_INPUT_IMAGES, falImageFamily } from './falImageModels.js';
// Backends that cannot take an input image at all (#3243). Every *queueable*
@@ -224,13 +225,17 @@ export const supportsCloudModelOverride = (mode) => MODEL_OVERRIDE_CAPABLE_MODES
* reaches the resolver — `isEditCapableMode` rejects it first).
*
* `modelId` refines the answer for a backend whose cap depends on the model
- * (fal.ai); an unknown or absent model falls back to the mode-level value.
+ * (fal.ai, Runway); an unknown or absent model falls back to the mode-level value.
*/
export const maxInputImages = (mode, modelId = null) => {
if (mode === IMAGE_GEN_MODE.FAL) {
const family = falImageFamily(modelId);
if (family) return family.maxInputImages;
}
+ if (mode === IMAGE_GEN_MODE.RUNWAY) {
+ const row = getRunwayImageModel(modelId);
+ if (row) return row.maxReferences;
+ }
return IMAGE_GEN_PROVIDER_CAPABILITIES[mode]?.maxInputImages ?? null;
};
diff --git a/server/lib/runwayImageModels.js b/server/lib/runwayImageModels.js
index df59f40323..b96a30b986 100644
--- a/server/lib/runwayImageModels.js
+++ b/server/lib/runwayImageModels.js
@@ -16,26 +16,46 @@ const RATIOS = Object.freeze({
'720p': Object.freeze(['1280:720', '720:1280', '720:720', '960:720', '720:960', '1680:720']),
'1080p': Object.freeze(['1920:1080', '1080:1920', '1024:1024', '1080:1080', '1360:768', '1168:880', '1440:1080', '1080:1440', '1808:768', '2112:912']),
});
+// Seedream canvases are fixed pairs, not Gen-4's 720p/1080p tiers. `auto_*` lets Runway pick and is never
+// chosen by aspect matching. The shared 720p/1080p render setting maps onto a tier via `resolutionMap`.
+const SEEDREAM_PRO_RATIOS = Object.freeze({
+ '1k': Object.freeze(['1024:1024', '1184:896', '896:1184', '1376:768', '768:1376', '1296:864', '864:1296', 'auto_1k']),
+ '2k': Object.freeze(['2048:2048', '2304:1728', '1728:2304', '2720:1530', '1530:2720', '2496:1664', '1664:2496', 'auto_2k']),
+});
+const SEEDREAM_LITE_RATIOS = Object.freeze({
+ standard: Object.freeze(['2048:2048', '2304:1728', '1728:2304', '2848:1600', '1600:2848', '2496:1664', '1664:2496', '3136:1344', '3072:3072', '3456:2592', '2592:3456', '4096:2304', '2304:4096', '3744:2496', '2496:3744', '4704:2016']),
+});
+const GEN4 = { ratios: RATIOS, maxReferences: 3, promptMaxChars: 1000, seed: true, referenceMode: 'tagged', defaultResolution: '720p', resolutionMap: Object.freeze({}) };
+// Seedream is text-to-image with unordered, untagged `referenceImages: [{ uri }]` (no documented count; 6 is a
+// conservative ceiling) and no seed field. Credits per Runway's pricing guide.
+const SEEDREAM = { maxReferences: 6, promptMaxChars: 4000, seed: false, referenceMode: 'ordered', minReferences: 0 };
export const RUNWAY_IMAGE_MODELS = Object.freeze([
- { id: 'gen4_image', label: 'Runway Gen-4 Image', minReferences: 0, credits: Object.freeze({ '720p': 5, '1080p': 8 }) },
- { id: 'gen4_image_turbo', label: 'Runway Gen-4 Image Turbo', minReferences: 1, credits: Object.freeze({ '720p': 2, '1080p': 2 }) },
-].map((row) => Object.freeze({ ...row, ratios: RATIOS, maxReferences: 3, promptMaxChars: 1000, seed: true })));
+ { ...GEN4, id: 'gen4_image', label: 'Runway Gen-4 Image', minReferences: 0, credits: Object.freeze({ '720p': 5, '1080p': 8 }) },
+ { ...GEN4, id: 'gen4_image_turbo', label: 'Runway Gen-4 Image Turbo', minReferences: 1, credits: Object.freeze({ '720p': 2, '1080p': 2 }) },
+ { ...SEEDREAM, id: 'seedream5_pro', label: 'Runway Seedream 5 Pro', ratios: SEEDREAM_PRO_RATIOS, defaultResolution: '1k', resolutionMap: Object.freeze({ '720p': '1k', '1080p': '2k' }), credits: Object.freeze({ '1k': 5, '2k': 9 }) },
+ { ...SEEDREAM, id: 'seedream5_lite', label: 'Runway Seedream 5 Lite', ratios: SEEDREAM_LITE_RATIOS, defaultResolution: 'standard', resolutionMap: Object.freeze({ '720p': 'standard', '1080p': 'standard' }), credits: Object.freeze({ standard: 4 }) },
+].map((row) => Object.freeze(row)));
export const RUNWAY_IMAGE_MODEL_IDS = Object.freeze(RUNWAY_IMAGE_MODELS.map((row) => row.id));
export const getRunwayImageModel = (id) => RUNWAY_IMAGE_MODELS.find((row) => row.id === id) || null;
/** Preserve caller framing using the closest supported canvas at the chosen tier. */
-function runwayImageRatio(model, { width, height, resolution = '720p', ratio } = {}) {
- const ratios = model.ratios[resolution];
- if (!ratios) throw refuse(`Runway image resolution must be 720p or 1080p`);
+function runwayImageRatio(model, { width, height, resolution, ratio } = {}) {
+ const tier = resolution ? (model.ratios[resolution] ? resolution : model.resolutionMap[resolution]) : model.defaultResolution;
+ const ratios = model.ratios[tier];
+ if (!ratios) throw refuse(`Runway ${model.id} does not support resolution ${resolution}`);
if (ratio) {
- if (!ratios.includes(ratio)) throw refuse(`Runway ${model.id} does not support ratio ${ratio} at ${resolution}`);
- return ratio;
+ if (!ratios.includes(ratio)) throw refuse(`Runway ${model.id} does not support ratio ${ratio} at ${tier}`);
+ return { ratio, resolution: tier };
}
const aspect = Number(width) > 0 && Number(height) > 0 ? Number(width) / Number(height) : 1;
const distance = (value) => { const [w, h] = value.split(':').map(Number); return Math.abs(Math.log(w / h / aspect)); };
- return ratios.reduce((best, value) => distance(value) < distance(best) ? value : best);
+ const sized = ratios.filter((value) => !value.startsWith('auto_'));
+ return { ratio: sized.reduce((best, value) => distance(value) < distance(best) ? value : best), resolution: tier };
}
+/** Wire shape of one reference: Gen-4 addresses images by @tag; Seedream takes an ordered, untagged list. */
+export const runwayReferencePayload = (model, { uri, tag }) => (model.referenceMode === 'tagged' ? { uri, tag } : { uri });
+
/** Tags identify bindings across renders; supplemental images get distinct suffixes. */
export function runwayReferenceTags(references = []) {
const used = new Set();
@@ -61,15 +81,16 @@ export function buildRunwayImageRequest({ modelId = RUNWAY_IMAGE_DEFAULT_MODEL,
if (referenceImages.length < model.minReferences || referenceImages.length > model.maxReferences) {
throw refuse(`Runway ${modelId} requires ${model.minReferences}–${model.maxReferences} reference images`);
}
+ const tagged = model.referenceMode === 'tagged';
const tags = referenceImages.map((ref) => ref.tag);
- if (referenceImages.some((ref) => typeof ref.uri !== 'string' || !ref.uri || !/^[a-z][a-z0-9_]{2,15}$/i.test(ref.tag)) || new Set(tags).size !== tags.length) {
- throw refuse('Runway reference images require a URI and unique 3–16 character tags');
+ if (referenceImages.some((ref) => typeof ref.uri !== 'string' || !ref.uri || (tagged && !/^[a-z][a-z0-9_]{2,15}$/i.test(ref.tag))) || (tagged && new Set(tags).size !== tags.length)) {
+ throw refuse(tagged ? 'Runway reference images require a URI and unique 3–16 character tags' : 'Runway reference images require a URI');
}
- if (seed != null && seed !== -1 && (!Number.isInteger(Number(seed)) || Number(seed) < 0 || Number(seed) > 4294967295)) throw refuse('Runway seed must be an unsigned 32-bit integer');
- const ratio = runwayImageRatio(model, size);
- const resolution = size.resolution || '720p';
+ const sendSeed = model.seed && seed != null && seed !== -1;
+ if (sendSeed && (!Number.isInteger(Number(seed)) || Number(seed) < 0 || Number(seed) > 4294967295)) throw refuse('Runway seed must be an unsigned 32-bit integer');
+ const { ratio, resolution } = runwayImageRatio(model, size);
return {
- body: { model: model.id, promptText: prompt, ratio, ...(referenceImages.length ? { referenceImages } : {}), ...(seed != null && seed !== -1 ? { seed: Number(seed) } : {}) },
- resolution, estimatedCredits: model.credits[resolution], estimatedCostUsd: model.credits[resolution] / 100,
+ body: { model: model.id, promptText: prompt, ratio, ...(referenceImages.length ? { referenceImages: referenceImages.map((ref) => runwayReferencePayload(model, ref)) } : {}), ...(sendSeed ? { seed: Number(seed) } : {}) },
+ resolution, referenceMode: model.referenceMode, estimatedCredits: model.credits[resolution], estimatedCostUsd: model.credits[resolution] / 100,
};
}
diff --git a/server/lib/runwayImageModels.test.js b/server/lib/runwayImageModels.test.js
index 8ee1498ede..1f96181ac0 100644
--- a/server/lib/runwayImageModels.test.js
+++ b/server/lib/runwayImageModels.test.js
@@ -8,7 +8,8 @@ describe('Runway image wire contracts', () => {
for (const [resolution, ratios] of Object.entries(model.ratios)) {
for (const ratio of ratios) {
const request = buildRunwayImageRequest({ modelId: model.id, prompt: ' @char1 in a garden ', resolution, ratio, seed: 42, referenceImages: [ref] });
- expect(request.body).toEqual({ model: model.id, promptText: ' @char1 in a garden ', ratio, seed: 42, referenceImages: [ref] });
+ const tagged = model.referenceMode === 'tagged';
+ expect(request.body).toEqual({ model: model.id, promptText: ' @char1 in a garden ', ratio, ...(tagged ? { seed: 42 } : {}), referenceImages: [tagged ? ref : { uri: ref.uri }] });
expect(request.estimatedCredits).toBe(model.credits[resolution]);
}
}
@@ -21,6 +22,20 @@ describe('Runway image wire contracts', () => {
expect(() => buildRunwayImageRequest({ prompt: 'garden', ratio: '1:1' })).toThrow('ratio');
expect(() => buildRunwayImageRequest({ prompt: 'garden', seed: 4294967296 })).toThrow('32-bit');
});
+ it('sends Seedream text-only stills with the nearest sized canvas, mapped tier and no seed', () => {
+ const pro = buildRunwayImageRequest({ modelId: 'seedream5_pro', prompt: 'garden', width: 1920, height: 1080, seed: 7 });
+ expect(pro.body).toEqual({ model: 'seedream5_pro', promptText: 'garden', ratio: '1376:768' });
+ expect(pro).toMatchObject({ resolution: '1k', referenceMode: 'ordered', estimatedCredits: 5 });
+ expect(buildRunwayImageRequest({ modelId: 'seedream5_pro', prompt: 'garden', width: 1920, height: 1080, resolution: '1080p' })).toMatchObject({ body: { ratio: '2720:1530' }, resolution: '2k', estimatedCredits: 9 });
+ expect(buildRunwayImageRequest({ modelId: 'seedream5_lite', prompt: 'garden', width: 1920, height: 1080 })).toMatchObject({ body: { ratio: '4096:2304' }, resolution: 'standard', estimatedCredits: 4 });
+ expect(() => buildRunwayImageRequest({ modelId: 'seedream5_lite', prompt: 'garden', ratio: '1024:1024' })).toThrow('ratio');
+ expect(buildRunwayImageRequest({ modelId: 'seedream5_pro', prompt: 'x'.repeat(4000) }).body.promptText).toHaveLength(4000);
+ });
+ it('keeps ordered Seedream references in order, untagged and capped per model', () => {
+ const refs = ['a', 'b', 'c', 'd'].map((n) => ({ uri: `https://example.com/${n}.png`, tag: n }));
+ expect(buildRunwayImageRequest({ modelId: 'seedream5_pro', prompt: 'garden', referenceImages: refs }).body.referenceImages).toEqual(refs.map(({ uri }) => ({ uri })));
+ expect(() => buildRunwayImageRequest({ modelId: 'seedream5_pro', prompt: 'garden', referenceImages: [...refs, ...refs] })).toThrow('0–6 reference');
+ });
it('keeps binding tags stable across ordering, distinguishes supplemental anchors and obeys the tag grammar', () => {
const a = { bindingId: 'character-example-a', role: 'character-neutral' };
const b = { bindingId: 'character-example-b', role: 'character-neutral' };
diff --git a/server/services/fableLoom/production.js b/server/services/fableLoom/production.js
index 573c0fc705..74f5557e9a 100644
--- a/server/services/fableLoom/production.js
+++ b/server/services/fableLoom/production.js
@@ -515,7 +515,7 @@ async function prepareImageJob(run, asset) {
const capability = fableLoomImageCapabilities({
mode,
model: mode === IMAGE_GEN_MODE.LOCAL ? provisionalModel : { id: cloud?.modelId || null },
- inputBudget: maxInputImages(mode) || 4,
+ inputBudget: maxInputImages(mode, cloud?.modelId) || 4,
});
const conditioned = await conditionRequest(run, asset, 'image', capability);
if (run.mode === 'exact_inputs') assertExactConditioning(recordedConditioning, conditioned?.visualConditioning);
diff --git a/server/services/fableLoom/visualConditioning.js b/server/services/fableLoom/visualConditioning.js
index 89bfc9979a..18c6dc0b4d 100644
--- a/server/services/fableLoom/visualConditioning.js
+++ b/server/services/fableLoom/visualConditioning.js
@@ -16,7 +16,7 @@ import {
matchCharactersInText, matchObjectsInText, matchPlacesInText,
} from '../../lib/scenePrompt.js';
import { resolveFableLoomProtagonistPresence } from '../../lib/fableLoomPlayback.js';
-import { IMAGE_GEN_PROVIDER_CAPABILITIES } from '../../lib/imageGenCapabilities.js';
+import { IMAGE_GEN_PROVIDER_CAPABILITIES, maxInputImages } from '../../lib/imageGenCapabilities.js';
import { CLOUD_IMAGE_GEN_MODES } from '../../lib/generationModes.js';
import { buildFableLoomVisualPrompts } from '../../lib/fableLoomVisualPrompts.js';
import { getUniverse } from '../universeBuilder.js';
@@ -443,7 +443,7 @@ export function fableLoomImageCapabilities({ mode, model = null, inputBudget = 4
referenceRoles: localFlux2 || cloudEdit
? ['temporal-predecessor', 'character-neutral', 'character-profile', 'character-full-body', 'character-expression-gesture', 'character-wardrobe', 'character-prop-scale', 'character-negative-identity', 'character-draft-reference', 'environment', 'object']
: [],
- referenceBudget: localFlux2 || cloudEdit ? Math.min(inputBudget, runwayCapability?.maxInputImages ?? inputBudget) : 0,
+ referenceBudget: localFlux2 || cloudEdit ? Math.min(inputBudget, runwayCapability ? maxInputImages(mode, model?.id) ?? inputBudget : inputBudget) : 0,
supportsLora: localFlux2 || (mode === 'local' && model?.runner === 'mflux'),
loraCompatKey: model?.loraCompatKey || null,
loraBudget: 8,
diff --git a/server/services/fableLoom/visualConditioning.test.js b/server/services/fableLoom/visualConditioning.test.js
index 9b0f72e4d5..0c0dc9423c 100644
--- a/server/services/fableLoom/visualConditioning.test.js
+++ b/server/services/fableLoom/visualConditioning.test.js
@@ -85,6 +85,11 @@ describe('FableLoom visual conditioning compiler', () => {
expect(result.referenceImagePaths).toEqual(['/approved/opening.png', '/approved/aria-neutral.png', '/approved/bex-neutral.png']);
});
+ // Catches Runway's per-model reference cap being ignored, which would starve Seedream of anchors.
+ it('admits Seedream with its own wider reference budget', () => {
+ expect(fableLoomImageCapabilities({ mode: 'runway', model: { id: 'seedream5_pro' }, inputBudget: 8 })).toMatchObject({ referenceBudget: 6, multiCharacterPreservation: true });
+ });
+
it('compiles stable bindings, approved identity assets, adapters, graph continuity and provenance', async () => {
const loom = loomWith(lockedBinding);
const result = await compileFableLoomVisualRequest({
diff --git a/server/services/imageGen/runway.js b/server/services/imageGen/runway.js
index 3b23bcdba8..276b6a4de3 100644
--- a/server/services/imageGen/runway.js
+++ b/server/services/imageGen/runway.js
@@ -12,7 +12,7 @@ import { fetchWithTimeout } from '../../lib/fetchWithTimeout.js';
import { autoCleanGeneratedImage } from '../../lib/imageClean.js';
import { renderTimingFields } from '../../lib/renderTiming.js';
import {
- RUNWAY_IMAGE_DEFAULT_MODEL, getRunwayImageModel, buildRunwayImageRequest, runwayReferenceTags,
+ RUNWAY_IMAGE_DEFAULT_MODEL, getRunwayImageModel, buildRunwayImageRequest, runwayReferencePayload, runwayReferenceTags,
} from '../../lib/runwayImageModels.js';
import {
broadcastSse, attachSseClient as attachSse, closeJobAfterDelay, createJobFailureFinalizer, dispatchTerminalEvent,
@@ -74,18 +74,19 @@ export async function checkConnection({ model = RUNWAY_IMAGE_DEFAULT_MODEL } = {
return { connected: Boolean(apiKey), mode: MODE, model, ...(apiKey ? {} : { reason: noKeyReason }) };
}
-export function runwayImageSentPrompt({ prompt = '', negativePrompt, inputImages, initImageStrength, visualConditioning, promptAdditions = [] }) {
+export function runwayImageSentPrompt({ prompt = '', negativePrompt, inputImages, initImageStrength, visualConditioning, promptAdditions = [], referenceMode = 'tagged' }) {
const references = runwayReferenceTags(inputImages.paths.map((path) => {
const asset = visualConditioning?.assets?.find((item) => item.filename === basename(path));
return { filename: basename(path), ...(asset || {}), path };
}));
- const roles = references.map((ref) => {
+ const ordered = referenceMode === 'ordered';
+ const roles = references.map((ref, index) => {
const role = ref.path === inputImages.initPath
? `source image to edit — ${describeFidelity(initImageStrength)}`
: ref.role || 'visual reference';
- return `@${ref.tag}: ${role}${ref.label ? ` for ${ref.label}` : ''}.`;
+ return `${ordered ? `Reference image ${index + 1}` : `@${ref.tag}`}: ${role}${ref.label ? ` for ${ref.label}` : ''}.`;
}).join('\n');
- const added = [promptAddition('reference-tags', 'Tagged Runway reference images', roles), promptAddition('avoid', 'Negative prompt, sent as "Avoid:"', negativePrompt ? `Avoid: ${negativePrompt}` : '')];
+ const added = [promptAddition('reference-tags', ordered ? 'Ordered Runway reference images' : 'Tagged Runway reference images', roles), promptAddition('avoid', 'Negative prompt, sent as "Avoid:"', negativePrompt ? `Avoid: ${negativePrompt}` : '')];
const fullPrompt = [prompt, ...added.map((item) => item?.text).filter(Boolean)].join('\n\n');
return { fullPrompt, references, record: sentPromptRecord({ sentPrompt: fullPrompt, carried: carriedPromptAdditions({ promptAdditions }), added }) };
}
@@ -135,8 +136,8 @@ async function generateImagePrepared({
const jobId = providedJobId || randomUUID();
const filename = `${jobId}.png`;
const outputPath = join(PATHS.images, filename);
- if (inputImages.paths.length !== (initImagePath ? 1 : 0) + referenceImagePaths.length) throw new ServerError('Runway reference inputs are unavailable or exceed the three-image limit', { status: 400, code: 'RUNWAY_IMAGE_INPUT_INVALID' });
- const { fullPrompt, references, record: sentRecord } = runwayImageSentPrompt({ prompt, negativePrompt, inputImages, initImageStrength, visualConditioning, promptAdditions });
+ if (inputImages.paths.length !== (initImagePath ? 1 : 0) + referenceImagePaths.length) throw new ServerError("Runway reference inputs are unavailable or exceed the selected model's reference limit", { status: 400, code: 'RUNWAY_IMAGE_INPUT_INVALID' });
+ const { fullPrompt, references, record: sentRecord } = runwayImageSentPrompt({ prompt, negativePrompt, inputImages, initImageStrength, visualConditioning, promptAdditions, referenceMode: family.referenceMode });
if (fullPrompt.length > family.promptMaxChars) {
throw new ServerError(
`Runway's complete prompt is ${fullPrompt.length}/${family.promptMaxChars} characters: ${prompt.length} supplied, plus ${fullPrompt.length - prompt.length} from reference tags and the negative prompt. Shorten the supplied or negative prompt; the full text is available in Show full prompt. Nothing was submitted or truncated.`,
@@ -150,6 +151,7 @@ async function generateImagePrepared({
width: width ? Number(width) : null, height: height ? Number(height) : null,
filename, mode: MODE,
model: endpointId,
+ referenceMode: family.referenceMode,
ratio: request.body.ratio, resolution: request.resolution,
referenceTags: references.map(({ path: _path, ...ref }) => ref),
inputProvenance: 'provider-inputs',
@@ -168,7 +170,7 @@ async function generateImagePrepared({
activeJobs.set(jobId, { ...meta, generationId: jobId, totalSteps: 1, step: 0, progress: 0, currentImage: null });
broadcastSse(job, { type: 'status', message: 'Submitting to Runway…' });
runRunway(job, jobId, {
- apiKey, request, references,
+ apiKey, request, references, family,
outputPath, filename, meta, cleanC2PA, denoise,
}).catch((err) => {
console.error(`❌ Runway image run failed [${jobId.slice(0, 8)}]: ${err?.message}`);
@@ -182,7 +184,7 @@ async function generateImagePrepared({
}
async function runRunway(job, jobId, {
- apiKey, request, references,
+ apiKey, request, references, family,
outputPath, filename, meta, cleanC2PA = false, denoise = false,
}) {
const entry = createRunwayTaskEntry(apiKey);
@@ -192,7 +194,7 @@ async function runRunway(job, jobId, {
let wroteOutput = false;
try {
const referenceImages = [];
- for (const ref of references) referenceImages.push({ uri: await encodeInputImage(ref.path), tag: ref.tag });
+ for (const ref of references) referenceImages.push(runwayReferencePayload(family, { uri: await encodeInputImage(ref.path), tag: ref.tag }));
if (entry.aborted) return finalizeCanceled(job, jobId);
entry.taskId = await submitRunwayTask({ apiKey, endpoint: 'text_to_image', body: { ...request.body, ...(referenceImages.length ? { referenceImages } : {}) } });
// THROTTLED waits on this accepted task. A failed/moderated task is terminal, never resubmitted.
diff --git a/server/services/imageGen/runway.test.js b/server/services/imageGen/runway.test.js
index 7e6436f383..76b810f8de 100644
--- a/server/services/imageGen/runway.test.js
+++ b/server/services/imageGen/runway.test.js
@@ -111,4 +111,19 @@ describe('Runway image workflow', () => {
expect(calls.filter((c) => c.method === 'POST')).toHaveLength(1);
expect(calls.filter((c) => c.method === 'DELETE')).toHaveLength(1);
});
+ it('sends Seedream references ordered and untagged, names them in the prompt and records the reference mode', async () => {
+ const paths = ['hero.png', 'rival.png'].map((name) => join(PATHS.images, name));
+ await Promise.all(paths.map((path) => writeFile(path, output)));
+ const visualConditioning = { assets: [{ filename: 'hero.png', bindingId: 'char-a', role: 'character-neutral', label: 'Hero' }, { filename: 'rival.png', bindingId: 'char-b', role: 'character-neutral', label: 'Rival' }] };
+ const job = await runway.generateImage({ prompt: 'Two rivals', model: 'seedream5_pro', width: 1920, height: 1080, seed: 5, referenceImagePaths: paths, visualConditioning });
+ expect(await terminal(job.jobId)).toMatchObject({ type: 'completed' });
+ const { body } = calls[0];
+ expect(body).toMatchObject({ model: 'seedream5_pro', ratio: '1376:768' });
+ expect(body).not.toHaveProperty('seed');
+ expect(body.referenceImages.map((r) => Object.keys(r))).toEqual([['uri'], ['uri']]);
+ expect(body.promptText).toContain('Reference image 1: character-neutral for Hero.');
+ expect(body.promptText).toContain('Reference image 2: character-neutral for Rival.');
+ const sidecar = JSON.parse(await readFile(join(PATHS.images, `${job.jobId}.metadata.json`), 'utf8'));
+ expect(sidecar).toMatchObject({ model: 'seedream5_pro', referenceMode: 'ordered', ratio: '1376:768', resolution: '1k', estimatedCredits: 5 });
+ });
});