Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Expand Runway model choices with cached capability catalogs
wrenchwren2f2674667837
diff --git a/client/src/components/creative-director/VideoDraftDrawer.jsx b/client/src/components/creative-director/VideoDraftDrawer.jsxindex 4e9fd22695..817dd2313b 100644--- a/client/src/components/creative-director/VideoDraftDrawer.jsx+++ b/client/src/components/creative-director/VideoDraftDrawer.jsx@@ -1,6 +1,7 @@+import { useRunwayCatalog } from '../../hooks/useRunwayCatalog.js';import { VIDEO_REVIEW_CHECKPOINTS } from '../../../../server/lib/creativeDirectorPresets.js';import { VIDEO_RENDER_MODES, modeLabel } from '../../lib/imageGenBackends.js';-import { RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL, RUNWAY_VIDEO_MODELS, getRunwayVideoModel } from '../../lib/runwayVideoModels.js';+import { RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL, getRunwayVideoModel } from '../../lib/runwayVideoModels.js';import { useEffect, useState } from 'react';import Drawer from '../Drawer.jsx';import useDrawerTab from '../../hooks/useDrawerTab.js';@@ -20,6 +21,7 @@ const fieldClass = 'w-full mt-1 bg-port-bg border border-port-border rounded px-export default function VideoDraftDrawer({ open, onClose, project, onSaved, catalogIngredientIds = [] }) {const [tab, setTab] = useDrawerTab('videoDraftTab', 'brief', TABS.map(t => t.id));const [form, setForm] = useState({});+ const runwayCatalog = useRunwayCatalog(open && form.videoMode === 'runway');const [models, setModels] = useState([]);const [engines, setEngines] = useState([]);const [tracks, setTracks] = useState([]);@@ -82,7 +84,7 @@ export default function VideoDraftDrawer({ open, onClose, project, onSaved, cata<label htmlFor="video-draft-videoMode" className="block text-sm">Media backend<select id="video-draft-videoMode" className={fieldClass} value={form.videoMode || 'local'} onChange={e => { change('videoMode', e.target.value); change('backendModelId', ''); }}>{!VIDEO_RENDER_MODES.includes(form.videoMode) && form.videoMode && <option value={form.videoMode}>{form.videoMode} (saved backend)</option>}{VIDEO_RENDER_MODES.map(mode => <option key={mode} value={mode}>{modeLabel(mode)}</option>)}</select></label>{form.videoMode === 'local' ? select('modelId', 'Media model', [['', 'Choose before production'], ...(form.modelId && !models.some(m => m.id === form.modelId) ? [[form.modelId, `${form.modelId} (saved model unavailable)`]] : []), ...models.map(m => [m.id, m.name || m.id])]): form.videoMode === 'fal' ? input('backendModelId', 'fal.ai model (optional)', { placeholder: 'Use configured fal.ai default', maxLength: 64 })- : form.videoMode === 'runway' ? select('backendModelId', 'Runway model', [['', `${getRunwayVideoModel(RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL).label} (backend default)`], ...(form.backendModelId && !getRunwayVideoModel(form.backendModelId) ? [[form.backendModelId, `${form.backendModelId} (saved model unavailable)`]] : []), ...RUNWAY_VIDEO_MODELS.map(m => [m.id, m.label])])+ : form.videoMode === 'runway' ? select('backendModelId', 'Runway model', [['', `${getRunwayVideoModel(RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL).label} (backend default)`], ...(form.backendModelId && !runwayCatalog.videoModels.some((m) => m.id === form.backendModelId) ? [[form.backendModelId, `${form.backendModelId} (saved model unavailable)`]] : []), ...runwayCatalog.videoModels.map(m => [m.id, m.label])]): select('backendModelId', 'Media model', [['', form.videoMode === 'reactor' ? 'fast-h3 (backend default)' : 'Backend default'], ...(form.backendModelId ? [[form.backendModelId, `${form.backendModelId} (saved model)`]] : [])])}<p className="text-sm text-port-text-muted">Backend selections are saved without running providers. Cloud renders may incur charges when production is enabled.</p>{select('transition', 'Shot joins', [['cut', 'Straight cuts'], ['fade', 'Fade through black (no overlap)']])}diff --git a/client/src/components/creative-director/VideoDraftDrawer.test.jsx b/client/src/components/creative-director/VideoDraftDrawer.test.jsxindex 9e9e72df8a..db6727d891 100644--- a/client/src/components/creative-director/VideoDraftDrawer.test.jsx+++ b/client/src/components/creative-director/VideoDraftDrawer.test.jsx@@ -1,4 +1,5 @@vi.mock('../../services/apiTracks.js', () => ({ listTracks: vi.fn(async () => []) }));+vi.mock('../../services/apiRunwayCatalog.js', async (importOriginal) => ({ ...await importOriginal(), loadRunwayCatalog: vi.fn().mockResolvedValue(undefined) }));vi.mock('../../services/apiMusic.js', () => ({ listMusicEngines: vi.fn(() => Promise.resolve({ engines: [] })) }));vi.mock('../../services/apiUniverseBuilder.js', () => ({ listUniverseNames: vi.fn(() => Promise.resolve([])) }));vi.mock('../../services/apiPipeline.js', () => ({ listPipelineSeriesNames: vi.fn(() => Promise.resolve([])) }));diff --git a/client/src/components/imageGen/ImageGenFormEditor.jsx b/client/src/components/imageGen/ImageGenFormEditor.jsxindex 5dbdeb7c35..e3e5933802 100644--- a/client/src/components/imageGen/ImageGenFormEditor.jsx+++ b/client/src/components/imageGen/ImageGenFormEditor.jsx@@ -1,3 +1,4 @@+import { useRunwayCatalog } from '../../hooks/useRunwayCatalog.js';import { ChevronDown, Sparkles, X } from 'lucide-react';import StylePresetPicker from '../media/StylePresetPicker';import UniverseStylePicker from '../media/UniverseStylePicker';@@ -17,7 +18,7 @@ import LoraPicker from './LoraPicker';import ReferenceImagePicker from './ReferenceImagePicker';import { appendTriggerWords } from '../../lib/loraTriggers';import {- RUNWAY_IMAGE_MODELS, RUNWAY_IMAGE_DEFAULT_MODEL,+ RUNWAY_IMAGE_DEFAULT_MODEL,AGY_IMAGEGEN_DEFAULT_MODEL, FAL_IMAGE_DEFAULT_MODEL, FAL_IMAGE_MODEL_OPTIONS, IMAGE_GEN_MODE, falImageFamily,} from '../../lib/imageGenBackends';@@ -28,6 +29,7 @@ const ERROR_HEADINGS = {};export default function ImageGenFormEditor({ form, backend, generation }) {+ const runwayCatalog = useRunwayCatalog(backend?.isRunwayMode);const {fields,catalogs,@@ -82,7 +84,7 @@ export default function ImageGenFormEditor({ form, backend, generation }) {><buttontype="submit"- disabled={derived.loraHandoffBlocked || derived.unsupportedLocalInputs || remix.pending || (derived.remoteTargetActive+ disabled={(isRunwayMode && !runwayCatalog.imageModels.some((m) => m.id === effectiveRunwayModel)) || derived.loraHandoffBlocked || derived.unsupportedLocalInputs || remix.pending || (derived.remoteTargetActive? derived.remoteBlocked !== null: (derived.localBackendPending || derived.notConnected || derived.editImageMissing || derived.cloudNeedsPrompt))}title={derived.unsupportedLocalInputs ? 'Remove unsupported LoRAs and input images in Options before rendering.' : loraTest.pending ? 'Preparing this LoRA test…' : loraTest.error || (remix.pending@@ -241,7 +243,7 @@ export default function ImageGenFormEditor({ form, backend, generation }) {modelStatus={isLocalMode ? modelDownload.getStatus(fields.modelId) : null}onModelDownload={isLocalMode ? modelDownload.start : undefined}onModelDownloadCancel={modelDownload.cancel}- cloudModels={isAgyMode ? backend.agy.models : isFalMode ? FAL_IMAGE_MODEL_OPTIONS : isRunwayMode ? RUNWAY_IMAGE_MODELS : []}+ cloudModels={isAgyMode ? backend.agy.models : isFalMode ? FAL_IMAGE_MODEL_OPTIONS : isRunwayMode ? [...runwayCatalog.imageModels, ...(!runwayCatalog.imageModels.some((m) => m.id === effectiveRunwayModel) ? [{ id: effectiveRunwayModel, label: `${effectiveRunwayModel} (unavailable)` }] : [])] : []}cloudModel={isRunwayMode ? effectiveRunwayModel : isFalMode ? effectiveFalModel : effectiveAgyModel}onCloudModelChange={isRunwayMode ? fields.setRunwayModel : isFalMode ? fields.setFalModel : fields.setAgyModel}cloudModelLabel={isRunwayMode ? 'Runway model' : isFalMode ? 'fal.ai model' : 'Agent model'}diff --git a/client/src/components/imageGen/RunwayCatalogStatus.jsx b/client/src/components/imageGen/RunwayCatalogStatus.jsxnew file mode 100644index 0000000000..bbefb78bd4--- /dev/null+++ b/client/src/components/imageGen/RunwayCatalogStatus.jsx@@ -0,0 +1,17 @@+import { useState } from 'react';++export default function RunwayCatalogStatus({ catalog }) {+ const [busy, setBusy] = useState(false);+ const refresh = () => {+ setBusy(true);+ void catalog.refresh().finally(() => setBusy(false));+ };+ return (+ <div className="text-xs text-gray-400 space-y-1">+ <p>{catalog.stale ? 'Using cached Runway model options.' : 'Runway model options are cached.'} <button type="button" disabled={busy} onClick={refresh} className="text-port-accent disabled:opacity-50">{busy ? 'Refreshing…' : 'Refresh models'}</button></p>+ {catalog.error && <p role="status">Catalog refresh unavailable. Cached options remain usable.</p>}+ {catalog.unsupported?.length > 0 && <details><summary>Models requiring other workflows or an app update</summary><ul>{catalog.unsupported.map((item, index) => <li key={`${item.id}-${index}`}>{item.id}: {item.reason}</li>)}</ul></details>}+ <p>Catalog availability does not confirm account access. Prices not listed here are shown in Runway’s pricing guide.</p>+ </div>+ );+}diff --git a/client/src/components/imageGen/RunwayModelSelect.jsx b/client/src/components/imageGen/RunwayModelSelect.jsxindex 83ed31b6be..f06e6c2728 100644--- a/client/src/components/imageGen/RunwayModelSelect.jsx+++ b/client/src/components/imageGen/RunwayModelSelect.jsx@@ -1,10 +1,12 @@-import { RUNWAY_IMAGE_MODELS } from '../../lib/imageGenBackends';+import { useRunwayCatalog } from '../../hooks/useRunwayCatalog.js';export default function RunwayModelSelect({ value, onChange, ariaLabel = 'Runway model', ...props }) {+ const { imageModels } = useRunwayCatalog();return (<select aria-label={ariaLabel} {...props} value={value || ''} onChange={(e) => onChange(e.target.value || null)}><option value="">Runway default (Settings)</option>- {RUNWAY_IMAGE_MODELS.map((model) => (+ {value && !imageModels.some((m) => m.id === value) && <option value={value}>{value} (unavailable)</option>}+ {imageModels.map((model) => (<option key={model.id} value={model.id}>{model.label}{model.minReferences ? ' (requires reference)' : ''}</option>diff --git a/client/src/components/musicVideo/SceneRenderTarget.jsx b/client/src/components/musicVideo/SceneRenderTarget.jsxindex 22d2ff4e64..1e09f1cb7a 100644--- a/client/src/components/musicVideo/SceneRenderTarget.jsx+++ b/client/src/components/musicVideo/SceneRenderTarget.jsx@@ -1,3 +1,4 @@+import { useRunwayCatalog } from '../../hooks/useRunwayCatalog.js';import {FAL_DEFAULT_IMAGE_VIDEO_MODEL, FAL_IMAGE_VIDEO_MODELS, coerceFalVideoSeconds, describeFalVideoRate, falVideoResolutions, getFalVideoModel,} from '../../lib/falVideoModels.js';@@ -53,7 +54,7 @@ function savedLabel(saved, performance, scene) {return BACKEND_LABELS[saved.backend] || 'install default';}-export function renderTargetOptions({ performance, saved, endFrame = false, scene = null }) {+export function renderTargetOptions({ performance, saved, endFrame = false, scene = null, runwayModels = RUNWAY_VIDEO_MODELS }) {return [{ value: '', label: `Project setting · ${savedLabel(saved, performance, scene)}` },{ value: 'local', label: performance ? 'Local LTX lip-sync (free)' : 'Local LTX (free)' },@@ -74,7 +75,7 @@ export function renderTargetOptions({ performance, saved, endFrame = false, scen// Runway takes no song audio, so a performance shot cannot render there....(performance? [{ value: 'runway', label: 'Runway (cutaways only)', disabled: true }]- : RUNWAY_VIDEO_MODELS.map((model) => {+ : runwayModels.map((model) => {const rate = describeRunwayVideoRate(model.id);return { value: `runway:${model.id}`, label: `Runway · ${model.label}${rate ? ` · ${rate}` : ''}${endFrame && model.endImage ? ' · ends on end frame' : ''}` };})),@@ -209,6 +210,7 @@ function OptionSelect({ id, label, value, onChange, disabled, children }) {export default function SceneRenderTarget({id, value, onChange, options = {}, onOptionsChange, performance, saved, scene = null, models = [], defaultModel = '', disabled = false,}) {+ const runwayCatalog = useRunwayCatalog();const set = (patch) => {const next = { ...options, ...patch };onOptionsChange?.(next);@@ -228,7 +230,8 @@ export default function SceneRenderTarget({<select id={id} value={value} onChange={(e) => { onChange(e.target.value); onOptionsChange?.({}); rememberRenderTarget(e.target.value); }} disabled={disabled}title="Where this shot's clip renders. Only this shot; the project setting stays as it is."className={`${SELECT} flex-1 sm:flex-none`}>- {renderTargetOptions({ performance, saved, endFrame: Boolean(scene?.endImageId), scene }).map((option) => (+ {value.startsWith('runway:') && !runwayCatalog.videoModels.some((m) => `runway:${m.id}` === value) && <option value={value}>{value} (unavailable)</option>}+ {renderTargetOptions({ performance, saved, endFrame: Boolean(scene?.endImageId), scene, runwayModels: runwayCatalog.videoModels }).map((option) => (<option key={option.value} value={option.value} disabled={option.disabled}>{option.label}</option>))}</select>diff --git a/client/src/components/musicVideo/SceneRenderTarget.test.jsx b/client/src/components/musicVideo/SceneRenderTarget.test.jsxindex c5a611e14c..e686fe1752 100644--- a/client/src/components/musicVideo/SceneRenderTarget.test.jsx+++ b/client/src/components/musicVideo/SceneRenderTarget.test.jsx@@ -1,4 +1,5 @@-import { beforeEach, describe, expect, it } from 'vitest';+import { beforeEach, describe, expect, it, vi } from 'vitest';+vi.mock('../../services/apiRunwayCatalog.js', async (importOriginal) => ({ ...await importOriginal(), loadRunwayCatalog: vi.fn().mockResolvedValue(undefined) }));import { render, screen, within } from '@testing-library/react';import SceneRenderTarget, { lastRenderTarget, rememberRenderTarget, renderTargetOptions, renderTargetOverrides } from './SceneRenderTarget.jsx';import { FAL_IMAGE_VIDEO_MODELS, falVideoResolutions } from '../../lib/falVideoModels.js';diff --git a/client/src/components/musicVideo/VideoRenderSettings.jsx b/client/src/components/musicVideo/VideoRenderSettings.jsxindex 91af3baab3..6310c39355 100644--- a/client/src/components/musicVideo/VideoRenderSettings.jsx+++ b/client/src/components/musicVideo/VideoRenderSettings.jsx@@ -1,3 +1,4 @@+import { useRunwayCatalog } from '../../hooks/useRunwayCatalog.js';import RenderPoolPicker from './RenderPoolPicker.jsx';import ListLoadError from '../ui/ListLoadError.jsx';import { GROK_VIDEO_DURATIONS } from '../../lib/grokVideoClip.js';@@ -5,7 +6,7 @@ import {FAL_DEFAULT_IMAGE_VIDEO_MODEL, FAL_MUSIC_VIDEO_DEFAULT_MODEL, FAL_IMAGE_VIDEO_MODELS, describeFalVideoRate, falImageVideoQuotes, falVideoResolutions, getFalVideoModel,} from '../../lib/falVideoModels.js';import {- RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL, RUNWAY_VIDEO_MODELS, describeRunwayVideoRate, getRunwayVideoModel, runwayVideoLengths, runwayVideoResolutions,+ RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL, describeRunwayVideoRate, getRunwayVideoModel, runwayVideoLengths, runwayVideoResolutions,} from '../../lib/runwayVideoModels.js';import { projectFalSpend } from '../../lib/musicVideoStages.js';import { formatUsd } from '../../utils/formatters.js';@@ -28,6 +29,7 @@ const runwayOptionLabel = (model, resolution) => {// is in flight or any scene clip is generating, so the job payload and the// board's displayed setting cannot disagree.export default function VideoRenderSettings({ videoSettings, generating, project = null }) {+ const runwayCatalog = useRunwayCatalog(videoSettings?.settings?.backend === 'runway');const {settings, saving, models, modelsLoading, catalogStatus, retryCatalog, defaultModel, effectiveModelId,audioReactiveModels, audioReactiveLoras, detectedAudioReactiveLora,@@ -334,12 +336,12 @@ export default function VideoRenderSettings({ videoSettings, generating, projecttitle="Runway image-to-video model for this project's cutaway scenes (list price per generated second)"className={`${falSelectCls} sm:max-w-[280px]`}>- <option value="">{`Default · ${runwayOptionLabel(getRunwayVideoModel(RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL))}`}</option>- {RUNWAY_VIDEO_MODELS.filter((model) => model.id !== RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL).map((model) => (+ <option value="">{`Default · ${runwayOptionLabel(getRunwayVideoModel(RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL))}${runwayCatalog.videoModels.some((m) => m.id === RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL) ? '' : ' (unavailable)'}`}</option>+ {runwayCatalog.videoModels.map((model) => (<option key={model.id} value={model.id}>{runwayOptionLabel(model)}</option>))}- {settings.runwayModelId && !runwayModel && (- <option value={settings.runwayModelId}>{`${settings.runwayModelId} · cost unknown`}</option>+ {settings.runwayModelId && !runwayCatalog.videoModels.some((m) => m.id === settings.runwayModelId) && (+ <option value={settings.runwayModelId}>{`${settings.runwayModelId} (unavailable)`}</option>)}</select>{runwayResolutions.length > 1 && (diff --git a/client/src/components/musicVideo/VideoRenderSettings.test.jsx b/client/src/components/musicVideo/VideoRenderSettings.test.jsxindex e4eee356d9..7909e4bff9 100644--- a/client/src/components/musicVideo/VideoRenderSettings.test.jsx+++ b/client/src/components/musicVideo/VideoRenderSettings.test.jsx@@ -1,7 +1,9 @@import { describe, it, expect, vi } from 'vitest';+vi.mock('../../services/apiRunwayCatalog.js', async (importOriginal) => ({ ...await importOriginal(), loadRunwayCatalog: vi.fn().mockResolvedValue(undefined) }));import { render, screen, fireEvent } from '@testing-library/react';vi.mock('../../hooks/useFederatedMediaTarget.js', () => ({ useFederatedMediaTarget: () => ({ peers: [] }) }));import VideoRenderSettings from './VideoRenderSettings.jsx';+import { RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL } from '../../lib/runwayVideoModels.js';const base = {settings: { backend: 'local', generationMode: 'audioReactive', modelId: '', audioReactiveLora: '', audioReactiveScale: 1.2 },@@ -11,6 +13,11 @@ const base = {};describe('VideoRenderSettings catalog failure', () => {+ it('preserves an explicitly pinned Runway default model in the selector', () => {+ render(<VideoRenderSettings videoSettings={{ ...base, settings: { ...base.settings, backend: 'runway', runwayModelId: RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL } }} />);+ expect(screen.getByLabelText('Runway cutaway model').value).toBe(RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL);+ });+it('offers Retry instead of claiming audio-reactive is unavailable', () => {const retryCatalog = vi.fn();render(<VideoRenderSettings videoSettings={{ ...base, catalogStatus: 'error', retryCatalog }} />);diff --git a/client/src/components/settings/ImageGenProviderSections.jsx b/client/src/components/settings/ImageGenProviderSections.jsxindex 0261b5ad72..97eb6a3e0e 100644--- a/client/src/components/settings/ImageGenProviderSections.jsx+++ b/client/src/components/settings/ImageGenProviderSections.jsx@@ -1,3 +1,5 @@+import { useRunwayCatalog } from '../../hooks/useRunwayCatalog.js';+import RunwayCatalogStatus from '../imageGen/RunwayCatalogStatus.jsx';/*** Media settings — the per-provider sections (External SD API, Local* runtimes, Codex CLI, Grok CLI, Agy CLI, fal.ai). Every field is read from@@ -26,7 +28,7 @@ import { getVideoGenModelContext, getProviders } from '../../services/api';import {isLocalImageConfigured, IMAGE_GEN_MODE, FAL_IMAGE_DEFAULT_MODEL, falImageFamily,AGY_IMAGEGEN_DEFAULT_MODEL, AGY_IMAGEGEN_IMAGE_MODEL, CODEX_IMAGEGEN_DEFAULT_EFFORT, CODEX_IMAGEGEN_DEFAULT_MODEL,- GROK_ASPECT_RATIOS, localModelSelectOptions, RUNWAY_IMAGE_MODELS, RUNWAY_IMAGE_DISCLOSURE,+ GROK_ASPECT_RATIOS, localModelSelectOptions, getRunwayImageModel, RUNWAY_IMAGE_DISCLOSURE,} from '../../lib/imageGenBackends';import { withUnlistedOption } from '../../lib/withUnlistedOption';import { effortLevelsForProvider, isCodexSubscriptionProvider, providerModelList } from '../../utils/providers';@@ -55,6 +57,7 @@ const SECTION_CLASS = 'bg-port-card border border-port-border rounded-xl p-6 spaconst FIELD_LABEL_CLASS = 'block text-xs font-medium text-gray-400 mb-1';export default function ImageGenProviderSections({ mediaTab, setMediaTab, form, parallelBounds, falCredential, runwayCredential, localRuntime, onStatusRecheck }) {+ const runwayCatalog = useRunwayCatalog(mediaTab === 'runway');const { values, set } = form;const {mode, sdapiUrl, pythonPath, localModelId, localVideoModelId,@@ -531,19 +534,21 @@ export default function ImageGenProviderSections({ mediaTab, setMediaTab, form,<p className="text-xs text-gray-400">{RUNWAY_IMAGE_DISCLOSURE.summary} <a href={RUNWAY_IMAGE_DISCLOSURE.termsUrl} target="_blank" rel="noreferrer" className="text-port-accent hover:underline">Runway’s terms</a> and moderation apply. {RUNWAY_IMAGE_DISCLOSURE.billing}</p><label className="flex items-center gap-3 cursor-pointer"><input type="checkbox" checked={values.runwayEnabled} onChange={toggleProvider('runwayEnabled', IMAGE_GEN_MODE.RUNWAY)} /><span>Enable Runway Imagegen</span></label><FormField label="Default model" labelClassName={FIELD_LABEL_CLASS}>- <select value={values.runwayModel} onChange={(e) => set('runwayModel', e.target.value)} className={INPUT_CLASS}>- {RUNWAY_IMAGE_MODELS.map((model) => <option key={model.id} value={model.id}>{model.label}{model.minReferences ? ' (requires a reference)' : ''}</option>)}+ <select value={values.runwayModel} onChange={(e) => { set('runwayModel', e.target.value); set('runwayResolution', getRunwayImageModel(e.target.value).defaultResolution); }} className={INPUT_CLASS}>+ {!runwayCatalog.imageModels.some((m) => m.id === values.runwayModel) && <option value={values.runwayModel}>{values.runwayModel} (unavailable)</option>}+ {runwayCatalog.imageModels.map((model) => <option key={model.id} value={model.id}>{model.label}{model.minReferences ? ' (requires a reference)' : ''}</option>)}</select></FormField><FormField label="Resolution" labelClassName={FIELD_LABEL_CLASS}><select value={values.runwayResolution} onChange={(e) => set('runwayResolution', e.target.value)} className={INPUT_CLASS}>- {['720p', '1080p'].map((resolution) => (+ {Object.keys(getRunwayImageModel(values.runwayModel)?.ratios || {}).map((resolution) => (<option key={resolution} value={resolution}>- {resolution} · {RUNWAY_IMAGE_MODELS.map((model) => `${model.label}: ${formatCount(model.credits[resolution])} credits`).join(' / ')}+ {resolution === 'auto' ? 'Match requested aspect ratio' : resolution.replace(':', ' × ')}{getRunwayImageModel(values.runwayModel)?.credits[resolution] != null ? ` · ${formatCount(getRunwayImageModel(values.runwayModel).credits[resolution])} credits` : ''}</option>))}</select></FormField>+ <RunwayCatalogStatus catalog={runwayCatalog} /><CleanersToggles mode={IMAGE_GEN_MODE.RUNWAY} form={form} /></div>)}diff --git a/client/src/components/settings/ImageGenTab.test.jsx b/client/src/components/settings/ImageGenTab.test.jsxindex 4ca3427d24..707f9f4282 100644--- a/client/src/components/settings/ImageGenTab.test.jsx+++ b/client/src/components/settings/ImageGenTab.test.jsx@@ -792,3 +792,5 @@ describe('ImageGenTab local runtime card', () => {await waitFor(() => expect(getImageGenStatus).toHaveBeenCalledWith('local', 'flux2-klein-4b', expect.anything()));});});++vi.mock('../../services/apiRunwayCatalog.js', async (importOriginal) => ({ ...await importOriginal(), loadRunwayCatalog: vi.fn().mockResolvedValue(undefined) }));diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex 3c1eba011d..a397853991 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -313,3 +313,5 @@ grep -i "what you want to do" client/src/hooks/README.md| `useCalendarWindowEvents` | `useCalendarWindowEvents(startDate, endDate)` — sequential 200-event offset pages for a complete calendar window, account/event deduplication, retry and date/sync supersession. | Day/Week/Month grids; pair with CalendarWindowStatus to disclose incomplete availability. || `useMusicVideoReviewDraft.js` | Sequential exact-version availability checks for implicit imported draft selection; stale requests abort, unavailable newer drafts are disclosed, explicit review versions remain pinned. |++| `useRunwayCatalog.js` | Shared Runway model catalog capabilities and cached model selection. |diff --git a/client/src/hooks/index.js b/client/src/hooks/index.jsindex eca4e9a339..2ddf0e5526 100644--- a/client/src/hooks/index.js+++ b/client/src/hooks/index.js@@ -295,3 +295,5 @@ export * from './useCalendarWindowEvents.js';export * from './useMusicVideoReviewDraft.js';export * from './useGoogleAutoConfigProgress.js';++export * from './useRunwayCatalog.js';diff --git a/client/src/hooks/useImageGenForm.js b/client/src/hooks/useImageGenForm.jsindex 5d8625a043..65875bd259 100644--- a/client/src/hooks/useImageGenForm.js+++ b/client/src/hooks/useImageGenForm.js@@ -31,7 +31,7 @@ import {listLorasFull,} from '../services/api';-const REFERENCE_SLOT_COUNT = 10;+const REFERENCE_SLOT_COUNT = 16;const EMPTY_REF_SLOT = { file: null, previewUrl: null, strength: 1.0 };const IMAGE_GEN_RESTORE_PARAM_KEYS = ['prompt', 'negativePrompt', 'modelId', 'width', 'height', 'seed', 'steps', 'guidance', 'quantize'];const IMAGE_GEN_HANDOFF_PARAM_KEYS = ['remix', ...IMAGE_GEN_RESTORE_PARAM_KEYS, 'initImageFile'];@@ -481,10 +481,10 @@ export function useImageGenForm({ searchParams, setSearchParams, backend }) {hasInitImage: initImage.source != null,// fal.ai's edit models take 9–14 references (a mood board is the point),// so it gets every form slot; the per-model cap below still bounds it.- maxSlots: (isLocalMode && isQwen21Model) || isFalMode ? REFERENCE_SLOT_COUNT : 4,+ maxSlots: effectiveMode === IMAGE_GEN_MODE.RUNWAY ? REFERENCE_SLOT_COUNT : (isLocalMode && isQwen21Model) || isFalMode ? 10 : 4,localSupportsReferences: isFlux2Model || isQwen21Model,localInputCap: isQwen21Model ? 10 : null,- cloudModelId: isFalMode ? (falModel || savedFalModel || FAL_IMAGE_DEFAULT_MODEL) : null,+ cloudModelId: effectiveMode === IMAGE_GEN_MODE.RUNWAY ? (runwayModel || savedRunwayModel || 'gen4_image') : isFalMode ? (falModel || savedFalModel || FAL_IMAGE_DEFAULT_MODEL) : null,});const activeStylePresets = useMemo(() => [selectedUniverse ? withUniverseLabel(universeStylePreset(selectedUniverse)) : null,diff --git a/client/src/hooks/useRunwayCatalog.js b/client/src/hooks/useRunwayCatalog.jsnew file mode 100644index 0000000000..0129d5a455--- /dev/null+++ b/client/src/hooks/useRunwayCatalog.js@@ -0,0 +1,15 @@+import { useEffect, useSyncExternalStore } from 'react';+import { getRunwayCatalogSnapshot, subscribeRunwayCatalog, loadRunwayCatalog } from '../services/apiRunwayCatalog.js';+import { RUNWAY_IMAGE_MODELS } from '../lib/imageGenModes.js';+import { RUNWAY_VIDEO_MODELS } from '../lib/runwayVideoModels.js';++export function useRunwayCatalog(enabled = true, videoMode = 'image') {+ const catalog = useSyncExternalStore(subscribeRunwayCatalog, getRunwayCatalogSnapshot);+ useEffect(() => { if (enabled) void loadRunwayCatalog(); }, [enabled]);+ return {+ ...catalog,+ imageModels: RUNWAY_IMAGE_MODELS.filter((m) => catalog.available.text_to_image.includes(m.id)),+ videoModels: RUNWAY_VIDEO_MODELS.filter((m) => catalog.available[videoMode === 'text' ? 'text_to_video' : 'image_to_video'].includes(m.id)),+ refresh: () => loadRunwayCatalog({ refresh: true }),+ };+}diff --git a/client/src/hooks/useRunwayCatalog.test.jsx b/client/src/hooks/useRunwayCatalog.test.jsxnew file mode 100644index 0000000000..c5b25b5dfb--- /dev/null+++ b/client/src/hooks/useRunwayCatalog.test.jsx@@ -0,0 +1,35 @@+import { describe, expect, it, vi } from 'vitest';+import { act, renderHook, waitFor } from '@testing-library/react';+vi.mock('../services/apiCore.js', () => ({ request: vi.fn() }));+import { request } from '../services/apiCore.js';+import { useRunwayCatalog } from './useRunwayCatalog.js';++const initial = {+ available: { text_to_image: ['gen4_image', 'gpt_image_2'], image_to_video: ['gen4.5', 'gen4_turbo', 'veo3.1'], text_to_video: ['gen4.5', 'veo3.1'] },+ unsupported: [{ id: 'act_two', reason: 'Requires performance inputs' }], stale: false,+};+describe('Runway form catalog lifecycle', () => {+ it('shares repeated/concurrent loads, filters by capability, refreshes all open forms and keeps stale options on failure', async () => {+ request.mockResolvedValue(initial);+ const image = renderHook(() => useRunwayCatalog());+ const video = renderHook(() => useRunwayCatalog(true, 'text'));+ await waitFor(() => expect(image.result.current.stale).toBe(false));+ expect(request).toHaveBeenCalledTimes(1);+ expect(image.result.current.imageModels.map((m) => m.id)).toEqual(['gen4_image', 'gpt_image_2']);+ expect(video.result.current.videoModels.map((m) => m.id)).toEqual(['gen4.5', 'veo3.1']);+ image.unmount();+ const reopened = renderHook(() => useRunwayCatalog());+ expect(request).toHaveBeenCalledTimes(1);+ request.mockResolvedValue({ ...initial, available: { ...initial.available, text_to_image: ['gpt_image_2'], text_to_video: [] } });+ await act(async () => { await reopened.result.current.refresh(); });+ expect(request).toHaveBeenLastCalledWith('/image-gen/runway-models/refresh', { method: 'POST', silent: true });+ expect(reopened.result.current.imageModels.map((m) => m.id)).toEqual(['gpt_image_2']);+ expect(video.result.current.videoModels).toEqual([]);+ request.mockRejectedValue(new Error('offline'));+ await act(async () => { await reopened.result.current.refresh(); });+ expect(reopened.result.current).toMatchObject({ stale: true, error: 'offline' });+ expect(reopened.result.current.imageModels.map((m) => m.id)).toEqual(['gpt_image_2']);+ renderHook(() => useRunwayCatalog());+ expect(request).toHaveBeenCalledTimes(3);+ });+});diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex 2cc416d572..3bd632b8c0 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -1,3 +1,5 @@+import { useRunwayCatalog } from '../hooks/useRunwayCatalog.js';+import RunwayCatalogStatus from '../components/imageGen/RunwayCatalogStatus.jsx';/*** Video Generation page (LTX models via mlx_video on macOS, diffusers on* Windows), with local, Grok, and federated render targets.@@ -106,8 +108,8 @@ import {} from '../lib/falVideoModels.js';import { REACTOR_MAX_PROMPT_LENGTH } from '../lib/reactorVideoClip.js';import {- RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL, RUNWAY_VIDEO_MODELS, describeRunwayVideoRate, estimateRunwayVideoCostUsd, getRunwayVideoModel,- runwayModelTakesText, runwayVideoLengths, runwayVideoResolutions,+ RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL, describeRunwayVideoRate, estimateRunwayVideoCostUsd, getRunwayVideoModel,+ runwayVideoLengths, runwayVideoResolutions,} from '../lib/runwayVideoModels.js';import { videoGenEnqueuePolicy } from '../lib/videoGenEnqueuePolicy.js';import { styledVideoPrompt } from '../lib/videoGenSubmission.js';@@ -996,8 +998,10 @@ export default function VideoGen() {const modelFieldVisible = !modelsLoading || modelContextLoading;const falModel = getFalVideoModel(falModelId);const falResolutions = falVideoResolutions(falModel);+ const runwayCatalog = useRunwayCatalog(isRunway, mode);const runwayModel = getRunwayVideoModel(runwayModelId || RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL);- const runwayResolutions = runwayVideoResolutions(runwayModel);+ const runwaySizeModel = mode === 'text' && runwayModel?.textToVideo ? { ...runwayModel, size: runwayModel.textToVideo.size } : runwayModel;+ const runwayResolutions = runwayVideoResolutions(runwaySizeModel);const notConnected = !!status && status.connected === false && !needsByovProbe;@@ -1069,7 +1073,7 @@ export default function VideoGen() {const effectiveBatchSize = rendersOnThisMachine&& currentModel?.supportsWarmBatch && !chainingActive ? batchSize : 1;- const { canEnqueue, generateTitle, queueTitle, optionsHint } = videoGenEnqueuePolicy({+ const { canEnqueue: backendCanEnqueue, generateTitle, queueTitle, optionsHint } = videoGenEnqueuePolicy({prompt,remixHandoffPending,promptOverLimit,@@ -1091,6 +1095,7 @@ export default function VideoGen() {keyframesBlocked,keyframesError,});+ const canEnqueue = backendCanEnqueue && (!isRunway || runwayCatalog.videoModels.some((m) => m.id === runwayModel?.id));return (<div className="space-y-3">@@ -1689,6 +1694,7 @@ export default function VideoGen() {</div>) : isRunway ? (<div className="grid grid-cols-2 gap-3">+ <div className="col-span-2"><RunwayCatalogStatus catalog={runwayCatalog} /></div><FormField className="col-span-2" label="Runway model" labelClassName="block text-xs font-medium text-gray-400 mb-1"><selectid="runway-video-model"@@ -1696,9 +1702,10 @@ export default function VideoGen() {onChange={(e) => setRunwayModelId(e.target.value)}className="w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent">- {RUNWAY_VIDEO_MODELS.filter((m) => mode !== 'text' || runwayModelTakesText(m)).map((m) => (+ {!runwayCatalog.videoModels.some((m) => m.id === runwayModel?.id) && <option value={runwayModel?.id || runwayModelId}>{runwayModel?.label || runwayModelId} (unavailable)</option>}+ {runwayCatalog.videoModels.map((m) => (<option key={m.id} value={m.id}>- {`${m.label} · ${describeRunwayVideoRate(m.id)}${m.id === RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL ? ' (default)' : ''}`}+ {`${m.label} · ${describeRunwayVideoRate(m.id) || 'price varies'}${m.id === RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL ? ' (default)' : ''}`}</option>))}</select>@@ -1731,8 +1738,8 @@ export default function VideoGen() {onChange={(e) => setRunwayResolution(e.target.value)}className="w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent">- <option value="">{`${runwayModel.size.default} (default)`}</option>- {runwayResolutions.map((res) => <option key={res} value={res}>{`${res} · ${describeRunwayVideoRate(runwayModel.id, res)}`}</option>)}+ <option value="">{`${runwaySizeModel.size.default} (default)`}</option>+ {runwayResolutions.map((res) => <option key={res} value={res}>{`${res} · ${describeRunwayVideoRate(runwayModel.id, res) || 'price varies'}`}</option>)}</select></FormField>)}diff --git a/client/src/pages/VideoGen.runway.test.jsx b/client/src/pages/VideoGen.runway.test.jsxindex 30d9ae6cd0..6ec753c9c4 100644--- a/client/src/pages/VideoGen.runway.test.jsx+++ b/client/src/pages/VideoGen.runway.test.jsx@@ -1,4 +1,4 @@-import { beforeEach, describe, expect, it } from 'vitest';+import { beforeEach, describe, expect, it, vi } from 'vitest';import { fireEvent, screen, waitFor, within } from '@testing-library/react';import { findEnabledByRole } from '../test/enabledBarrier.js';import {@@ -28,7 +28,8 @@ describe('VideoGen Runway text lane', () => {expect(model).toHaveValue('gen4_turbo');fireEvent.click(modes.getByRole('button', { name: 'Text' }));await waitFor(() => expect(model).toHaveValue('gen4.5'));- expect([...model.options].map(option => option.value)).toEqual(['gen4.5']);+ expect([...model.options].map(option => option.value)).toEqual(expect.arrayContaining(['gen4.5', 'veo3.1', 'seedance2_5']));+ expect([...model.options].map(option => option.value)).not.toContain('gen4_turbo');expect(screen.getByText(/about \$0.60 at list price/)).toBeInTheDocument();fireEvent.change(screen.getByLabelText('Prompt'), { target: { value: 'a fox watches the rain' } });fireEvent.click(await findEnabledByRole('button', { name: /Add to queue/ }));@@ -39,3 +40,5 @@ describe('VideoGen Runway text lane', () => {expect(payload.sourceImage).toBe('');});});++vi.mock('../services/apiRunwayCatalog.js', async (importOriginal) => ({ ...await importOriginal(), loadRunwayCatalog: vi.fn().mockResolvedValue(undefined) }));diff --git a/client/src/services/README.md b/client/src/services/README.mdindex 4c44cd9e1e..d97fc5be60 100644--- a/client/src/services/README.md+++ b/client/src/services/README.md@@ -165,3 +165,5 @@ toasts on throw). **Custom catch ⇒ `silent: true`** — otherwise toasts fire| `apiRigging.js` | Character rigging. `getRiggingReadiness()` (`GET /rigging/readiness`): whether this install's Blender runtime is provisioned, the resolved interpreter, the module version, the install command when it is not, and the auto-skin threshold defaults. `rigImageTo3dModel(id, body)` (`POST /rigging/models/:id`): auto-skin a rendered mesh behind the measured weight-coverage gate, resolving with the updated model record. `listRiggingClips()` (`GET /rigging/clips`): the locally-held animation clip library plus CoS-state coverage. `retargetImageTo3dModel(id, body)` (`POST /rigging/models/:id/retarget`): apply a clip to a published rig in `diagnostic` (measure only) or `write` mode, resolving with the updated model record. || `apiAvatar.js` | Avatar surfaces. `getRiggedAvatars()` (`GET /avatar/rigged`): the install's verified animated records, each with its `?variant=` spelling, serving URL, retargeted clip name, and server-computed CoS-state coverage. |++| `apiRunwayCatalog.js` | Shared Runway model catalog capabilities and cached model selection. |diff --git a/client/src/services/api.js b/client/src/services/api.jsindex bef1be4217..8c53079244 100644--- a/client/src/services/api.js+++ b/client/src/services/api.js@@ -103,3 +103,5 @@ export * from './apiDockerContainment.js';// Default export for simplified imports (get/post/put/delete helpers)export { default } from './apiCore.js';++export * from './apiRunwayCatalog.js';diff --git a/client/src/services/apiRunwayCatalog.js b/client/src/services/apiRunwayCatalog.jsnew file mode 100644index 0000000000..2e8c39f839--- /dev/null+++ b/client/src/services/apiRunwayCatalog.js@@ -0,0 +1,31 @@+import { request } from './apiCore.js';+import { RUNWAY_CATALOG_SNAPSHOT } from '../../../server/lib/runwayCatalogSnapshot.js';++const TTL = 5 * 60 * 1000;+const listeners = new Set();+let snapshot = { available: Object.fromEntries(Object.entries(RUNWAY_CATALOG_SNAPSHOT).map(([key, rows]) => [key, rows.map((row) => row.id)])), bundled: true, stale: true, unsupported: [] };+let fetchedAt = null;+let pending = null;+let pendingForced = false;+export const getRunwayCatalogSnapshot = () => snapshot;+export const subscribeRunwayCatalog = (listener) => { listeners.add(listener); return () => listeners.delete(listener); };++/** Shared across every form mount, including concurrent drawers. Refresh updates open subscribers. */+export function loadRunwayCatalog({ refresh = false } = {}) {+ if (pending) return refresh && !pendingForced ? pending.then(() => loadRunwayCatalog({ refresh: true })) : pending;+ pendingForced = refresh;+ if (!refresh && fetchedAt != null && Date.now() - fetchedAt < TTL) return Promise.resolve(snapshot);+ pending = request(`/image-gen/runway-models${refresh ? '/refresh' : ''}`, { method: refresh ? 'POST' : 'GET', silent: true })+ .then((data) => {+ if (!Object.keys(snapshot.available).every((key) => Array.isArray(data?.available?.[key]))) throw new Error('Invalid Runway catalog response');+ snapshot = data;+ })+ .catch((err) => { snapshot = { ...snapshot, stale: true, error: err.message }; })+ .finally(() => {+ fetchedAt = Date.now();+ pending = null;+ for (const listener of listeners) listener();+ })+ .then(() => snapshot);+ return pending;+}diff --git a/docs/README.md b/docs/README.mdindex 1564fac95d..7c3571d645 100644--- a/docs/README.md+++ b/docs/README.md@@ -113,3 +113,5 @@ Comms & voice: [beeper](./features/beeper.md) · [messages-browser-send](./featu- [Peer push authentication](./PEER_PUSH_AUTH.md)- [Tool-free model delegation](SANDBOX_DELEGATION.md) — approved API workers, context packets, and advisory fidelity evaluation for Persistent Mind.++- [Runway model catalog](RUNWAY_MODELS.md) — supported operations, public schema source, caching, refresh and workflow limits.diff --git a/docs/RUNWAY_MODELS.md b/docs/RUNWAY_MODELS.mdnew file mode 100644index 0000000000..ca7bdc1067--- /dev/null+++ b/docs/RUNWAY_MODELS.md@@ -0,0 +1,61 @@+# Runway model options++PortOS uses Runway's public [OpenAPI document](https://docs.dev.runwayml.com/openapi.json)+(API version `2024-11-06`) and [model guide](https://docs.dev.runwayml.com/guides/models/).+The documented API has no model-list/discovery endpoint. In particular, `/v1/models`+is not used. The public schema describes advertised capabilities, not an account's+entitlements or remaining credits. Catalog refresh makes no generation request and+needs no API key.++The bundled capability snapshot was verified on 2026-10-22. It offers 19 image+models and 24 image-to-video models; 23 of the video models also accept text alone.+Selectors filter by the active operation. Gen-4 Image Turbo requires a reference;+Gen-4 Turbo video requires a start frame. The builder validates each model's prompt,+reference and seed constraints and emits supported parameters only. Models accepting+native negative prompts use that field; other video models receive a visible Avoid+addition. Native provider audio is disabled where the API exposes that control.++Image settings retain existing Gen-4 720p/1080p choices. Other models offer automatic+canvas selection that preserves requested aspect ratio, plus their exact documented+canvas dimensions. Video sizes and lengths depend on both model and operation:+WAN keyframe requests use auto ratios, text requests use explicit canvases, and+models such as MiniMax accept a separate resolution field. Optional advanced API+controls keep provider defaults. Unknown prices are displayed as unknown, not zero;+consult [Runway pricing](https://docs.dev.runwayml.com/guides/pricing/) before rendering.++## Cache and refresh++All form instances share a five-minute browser cache, including concurrent loads.+The server shares one 24-hour catalog cache across images and videos and persists+it atomically in `.cache/runway-model-catalog.json`. This is disposable public+metadata, not an application record; it contains no credentials or personal data,+is not federated, and needs no database migration. A hash of the shipped capability+snapshot invalidates older disk caches on upgrade. Changing credentials does not+invalidate public model metadata, and no key is sent to the documentation source.++The Refresh models button bypasses freshness on both layers and updates open+subscribers. Concurrent source refreshes coalesce. A source failure preserves the+last good catalog, or uses the bundled snapshot on a cold start, marks it stale,+and backs off automatic source retries for five minutes. A valid empty model list+stays empty. A malformed document or unsupported API version cannot overwrite the+last good catalog. Corrupt or incompatible disk caches are discarded.++Refresh can remove retired options. Known models with changed consumed request+constraints and newly advertised model IDs are listed as requiring a PortOS+capability update; refresh does not guess new payload semantics. Update+`server/lib/runwayCatalogSnapshot.js`, its shared image/video projections and tests+after checking the official schema. A refreshed removal also refuses submission+before a paid POST. Generation does not perform a separate discovery lookup.++## Workflow limits++Aleph 2 (`aleph2`) needs video-to-video editing inputs and Act-Two (`act_two`) needs+character/performance inputs. They are identified in the catalog UI but are not+runnable through the existing text/image forms. These are PortOS workflow limits,+not missing Runway APIs. Upscaling, HDR, avatars, source-video/audio references and+other specialized controls are also outside these forms. This integration does not+claim to expose every Runway API operation.++Tests use public schema excerpts and mocked transport, including refresh, cache+restart/expiry, source failures and capability-specific request bodies. No paid+Runway generation is needed for validation.diff --git a/server/hostControlCoverage.test.js b/server/hostControlCoverage.test.jsindex 50dd847fc1..e6cae3f927 100644--- a/server/hostControlCoverage.test.js+++ b/server/hostControlCoverage.test.js@@ -563,6 +563,8 @@ const REVIEWED_OPEN_MUTATIONS = [['POST /api/image-gen/models/:modelId/repair', MODEL_DATA],['POST /api/image-gen/models/verify', MODEL_DATA],['POST /api/image-gen/prompt-preview', READ_OVER_POST],+ // Refreshes public Runway documentation into a fixed disposable cache; no credentials, process or paid inference.+ ['POST /api/image-gen/runway-models/refresh', READ_OVER_POST],['POST /api/image-gen/setup/create-venv', HANDLER_GATED],['POST /api/image-gen/setup/flux2-install', MANAGED_INSTALL],['DELETE /api/image-gen/setup/hf-token', REMOVES_RECORD],diff --git a/server/lib/README.md b/server/lib/README.mdindex 03a44030e0..6a1da14625 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -365,8 +365,8 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `musicVideoShotTiming.js` | Music Video shot modes (#8977): `MUSIC_VIDEO_SHOT_MODES` (`cutaway`/`performance`), `isPerformanceScene`, `MUSIC_VIDEO_PERFORMANCE_STYLES` (`lipsync`/`music`) + `isLipSyncScene`, `selectedPerformanceInstruction(scene)` (the selected take's shot instruction, performance scenes only), `clipAudioOffsetSec(instruction)` (provider lead padding a landed take's edit points were moved by, #11210), `SOURCE_AUDIO_LIPSYNC` (verified source-audio lip-sync lanes — only fal.ai MiniMax H3 lip-sync, 5–30s per take, default 1080P), `SOURCE_AUDIO_MUSIC` (music-driven lanes — fal.ai audio-to-video models, picked by `videoSettings.falMusicModelId`, default OmniHuman v1.5 at 1080p), `falSceneTake()` (the fal model/length/resolution a scene take requests and its estimated cost — shared by the board, the submit path and the autopilot spend cap) + `falTakeRequestFields(take)` (that take as `/api/video-gen` fields), `performanceCapability(backend, { scene, videoSettings })` (lip-sync lane, or the music-driven one for a music-driven scene), `performanceBlockedReason(backend)` (Grok is cutaway-only), `planPerformanceWindow()` (provider-bounded audio window + clip-relative edit in/out points; refuses over-long shots instead of relying on provider truncation), `planPerformanceRepair()` (complete measured suffix evidence, safe word-gap boundary, source/clip timebases and next spend), `clipRelativeCues()`, `grokCoverage(spanSec)` (covering 6/10/15 s request, flags spans needing a split), `approximateMotionCues()`, `shotSplitLimit(scene, backend)` (per-take limit: lip-sync window or Grok's longest clip), `planShotSplit()` (contiguous pieces cut at lyric pauses → line/phrase boundaries → beats; one extra piece at most to avoid cutting a sung line). Dependency-free; the client re-exports it. || `reactorStartingFrame.js` | Fits a reactor.inc `starting_frame` to the fast-h3 session canvas before it is uploaded. `readImageSize(path)` → `{width,height}` or `null` (never a guessed dimension), and `prepareReactorStartingFrame(sourceImagePath, requestedAspect, outputPath)` → `{ aspect, canvas, framePath, fittedPath }`: an absent `requestedAspect` DERIVES the canvas from the frame's own shape (`nearestReactorAspect`), then centre cover-crops the frame to that canvas's exact pixel size so reactor's own "fitted to the session canvas" step is a no-op. `fittedPath` is the temp file the caller deletes; `null` means the original was uploaded unchanged. A frame sharp cannot decode (or a resize that fails) passes through untouched on the default canvas rather than failing a render PortOS merely could not measure — reactor decodes more containers than sharp does. || `reactorVideoClip.js` | The reactor.inc `fast-h3` clip contract, dependency-free so the route schema, the FableLoom prompt compiler and the VideoGen picker all read one copy — `REACTOR_MAX_PROMPT_LENGTH` (800; the API rejects a longer prompt rather than truncating it), `REACTOR_MIN_CLIP_SECONDS` / `REACTOR_MAX_CLIP_SECONDS` (5.167–14.375, i.e. 124–345 frames at the `REACTOR_CLIP_FPS` 24 it delivers), `REACTOR_MAX_CLIP_ID_LENGTH`, and the picker list `REACTOR_CLIP_LENGTHS` + `REACTOR_DEFAULT_CLIP_LENGTH` + `reactorClipLengthLabel()` (the two exact endpoints plus every whole second between them, since the accepted range is continuous but starts and ends off a round number). Also the CANVAS contract `set_canvas` accepts: `REACTOR_CANVASES` (`16:9` 1344×768, `4:3` 1024×768, `1:1` 768×768, `9:16` 768×1344 — every one a 768px short edge, so the aspect string is the whole choice), `REACTOR_ASPECTS`, `REACTOR_DEFAULT_ASPECT`, `reactorCanvas(aspect)` and `nearestReactorAspect(width, height)` (closest canvas in log-ratio space; anything unmeasurable answers the default rather than deriving one). Mirrored to `client/src/lib/reactorVideoClip.js`, parity pinned by `reactorVideoClip.test.js`. |-| `runwayVideoModels.js` | Curated Runway VIDEO model catalog for the developer API's `/v1/image_to_video` and (Gen-4.5) `/v1/text_to_video` — `RUNWAY_VIDEO_MODELS` (Gen-4.5 default, Gen-4 Turbo, Kling 3.0 Standard / Pro, Kling 2.5 Turbo Pro, MiniMax H3 Max, WAN 3.0) with per-model prompt caps, duration rules, output sizes (`ratio` or `resolution`), end-frame support and list prices verified on `RUNWAY_VIDEO_PRICING_VERIFIED_AT`; `getRunwayVideoModel()`, `coerceRunwayVideoSeconds()` (round UP to a covering length), `resolveRunwayVideoResolution()`, `runwayVideoLengths()`, `buildRunwayVideoRequest()` (the endpoint and exact body, text-only when no frame and the model has a `textToVideo` rule, `runwayModelTakesText()`; refuses an uncurated model, a missing frame or an over-cap prompt, never cuts it), `runwayVideoClipQuote()` / `estimateRunwayVideoCostUsd()`, `describeRunwayVideoRate()`. Dependency-free; the client re-exports it. |-| `runwayImageModels.js` | Native Gen-4 image model schemas, supported canvases, prices, hosted disclosure, request validation and stable binding-derived reference tags; shared with browser model pickers. |+| `runwayVideoModels.js` | Shared Runway image/text-to-video model capabilities, endpoint-specific request construction, duration/size selectors and verified-price quotes (null for unknown prices). Derived from the bundled OpenAPI snapshot. |+| `runwayImageModels.js` | Shared Runway image capabilities, exact canvases, reference/seed limits, hosted disclosure, request validation and reference identities. || `kimi.js` | Moonshot AI Kimi Code (`kimi`) provider helpers — id constants (`KIMI_CLI_ID`/`KIMI_TUI_ID`), `isKimiCommand`/`isKimiCliProvider`/`isKimiTuiProvider` predicates, `ensureKimiHeadlessArgs` (model flag only — non-interactive mode is implicit in `--prompt`, and kimi has no `--print`/`--afk` and refuses approval flags alongside `--prompt`) / `ensureKimiTuiArgs` (`--yolo`) argv builders (model selection uses the `KIMI_CONFIGURED_DEFAULT` sentinel in `providerModels.js` so PortOS omits `--model` like Grok/Antigravity), and `prepareKimiPrompt` (delivers the prompt as the `--prompt <value>` argv, not stdin). || `runners.js` | Image-runner family constants (`RUNNER_FAMILIES`, `loraCompatKey`), video LoRA families, MiniMax H3 runtime predicates, and the shared `AUDIO_TO_VIDEO_RUNTIMES` / `isAudioToVideoRuntime` capability gate (LTX plus H3 Ref2VA). Mirrored to `client/src/lib/runnerFamilies.js`. || `codexAccount.js` | The ChatGPT-subscription half of the Codex providers (#5589), pure. The fixed `codex app-server` invocation, the `account/*` method + notification names, `CODEX_ACCOUNT_STATUS` (`runtime-missing` / `unknown` / `signed-out` / `login-pending` / `ready` / `quota-exhausted` / `reauth-required`) and `CODEX_ERROR_CODES`, `isCodexSubscriptionProvider` (re-exported from `providerModels.js`; keyed on the `codex` COMMAND, so a renamed clone still resolves), the `normalizeCodexAccount` / `normalizeCodexRateLimits` / `normalizeCodexLoginStart` payload normalizers, `redactCodexPayload` (every log/error/response path runs through it, so "PortOS never writes down a Codex token" is one function rather than a rule per call site), and `deriveCodexAccountStatus`. Sentinels are load-bearing: `runtimeInstalled: null` = NOT PROBED, `accountFetched: false` ≠ signed out, `rateLimits: null` (failed fetch) ≠ a fetched window with nothing to report. The process half is `services/codexAppServer.js`. |@@ -970,3 +970,5 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub- `pgJson.js`: text repair for values bound to PostgreSQL, which refuses a lone UTF-16 surrogate in `jsonb` and NUL in `jsonb`/`text` where every file store accepted both. `normalizePgString(s)` → `toWellFormed()` with NUL → U+FFFD (the same lossy repair a UTF-8 file write applied). `toPgJson(value)` → `JSON.stringify` that repairs string values and object keys; **use it, never bare `JSON.stringify`, for a parameter bound to a `json`/`jsonb` column or `::jsonb` cast** (`pgJsonConventions.test.js` enforces this). `normalizePgParams(params)` is applied by `db.js` `query()` and the `withTransaction` client: repairs string and array-element params (never unescapes `\^@`) and serializes plain-object params via `toPgJson`.- `errorLogFingerprint.js`: stderr-log triage primitives for `error-log-triage` (#12851). `groupStderrEntries(text)` strips the PM2 date prefix and folds stack/continuation lines under their head line; `fingerprintEntry(entry, { extraTerms })` redacts the entry (home paths, hosts, IPs, UUIDs, credentials, quoted record names, plus install literals such as the hostname and OS user) and reduces the head to a template (timestamps, ids, SHAs, filesystem paths and numbers become placeholders; API routes stay distinct) with a stable 16-hex fingerprint; `templateSearchExcerpt(template)` picks a tracker search phrase, or null when too generic. Pure; the collector and tracker dedupe live in `services/errorLogTriage.js`.- `manuscriptLocate.js`: `locateFind` / `locateFindSpan` — the manuscript `find` locator (nearest-to-`anchorQuote` occurrence, then whitespace-tolerant regex fallback). The one implementation behind both the server accept path (`services/pipeline/manuscriptFix.js`) and the client highlight/impact preview (`client/src/lib/manuscriptAnchors.js` re-exports it), so the preview selects the span an accept replaces. Pure / browser-safe.++| `runwayCatalogSnapshot.js` | Shared Runway model catalog capabilities and cached model selection. |diff --git a/server/lib/imageGenCapabilities.js b/server/lib/imageGenCapabilities.jsindex 283986e56d..64b7ccc645 100644--- a/server/lib/imageGenCapabilities.js+++ b/server/lib/imageGenCapabilities.js@@ -1,3 +1,4 @@+import { getRunwayImageModel } from './runwayImageModels.js';/*** Per-backend image-gen capability literals.*@@ -227,6 +228,7 @@ export const supportsCloudModelOverride = (mode) => MODEL_OVERRIDE_CAPABLE_MODES* (fal.ai); an unknown or absent model falls back to the mode-level value.*/export const maxInputImages = (mode, modelId = null) => {+ if (mode === IMAGE_GEN_MODE.RUNWAY) return getRunwayImageModel(modelId)?.maxReferences ?? 3;if (mode === IMAGE_GEN_MODE.FAL) {const family = falImageFamily(modelId);if (family) return family.maxInputImages;diff --git a/server/lib/index.js b/server/lib/index.jsindex a7b8b7aeeb..133631f589 100644--- a/server/lib/index.js+++ b/server/lib/index.js@@ -956,3 +956,5 @@ export * from './moltworldExplore.js';export * from './pgJson.js';export * from './errorLogFingerprint.js';export * from './manuscriptLocate.js';++export * from './runwayCatalogSnapshot.js';diff --git a/server/lib/runwayCatalogSnapshot.js b/server/lib/runwayCatalogSnapshot.jsnew file mode 100644index 0000000000..e544c80cfd--- /dev/null+++ b/server/lib/runwayCatalogSnapshot.js@@ -0,0 +1,77 @@+// Public Runway OpenAPI capability snapshot, verified 2026-10-22.+// Source: https://docs.dev.runwayml.com/openapi.json (API version 2024-11-06).+// Only fields consumed by PortOS; optional advanced controls retain provider defaults.+export const RUNWAY_CATALOG_SNAPSHOT = {+ "text_to_image": [+ {"id": "gen4_image_turbo","promptRequired": true,"promptMin": 1,"promptMax": 1000,"ratios": ["1024:1024","1080:1080","1168:880","1360:768","1440:1080","1080:1440","1808:768","1920:1080","1080:1920","2112:912","1280:720","720:1280","720:720","960:720","720:960","1680:720"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": false,"endImage": false,"duration": {},"minReferences": 1,"maxReferences": 3,"referenceTags": true,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "gen4_image","promptRequired": true,"promptMin": 1,"promptMax": 1000,"ratios": ["1024:1024","1080:1080","1168:880","1360:768","1440:1080","1080:1440","1808:768","1920:1080","1080:1920","2112:912","1280:720","720:1280","720:720","960:720","720:960","1680:720"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 3,"referenceTags": true,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "gpt_image_2","promptRequired": true,"promptMin": 1,"promptMax": 32000,"ratios": ["2048:880","1920:1088","1920:1280","1920:1440","1920:1536","1920:1920","1536:1920","1440:1920","1280:1920","1088:1920","2912:1248","2560:1440","2560:1712","2560:1920","2560:2048","2560:2560","2048:2560","1920:2560","1712:2560","1440:2560","3840:1648","3840:2160","3504:2336","3264:2448","3200:2560","2880:2880","2560:3200","2448:3264","2336:3504","2160:3840","auto"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 16,"referenceTags": true,"seedMax": null,"negativePromptMax": 0},+ {"id": "gemini_image3.1_flash","promptRequired": true,"promptMin": 1,"promptMax": 5500,"ratios": ["512:512","416:624","624:416","432:592","592:432","448:576","576:448","384:672","672:384","768:336","256:1024","1024:256","176:1408","1408:176","1024:1024","832:1248","1248:832","864:1184","1184:864","896:1152","1152:896","768:1344","1344:768","1536:672","512:2048","2048:512","352:2816","2816:352","2048:2048","1696:2528","2528:1696","1792:2400","2400:1792","1856:2304","2304:1856","1536:2752","2752:1536","3168:1344","1024:4096","4096:1024","704:5632","5632:704","4096:4096","3392:5056","5056:3392","3584:4800","4800:3584","3712:4608","4608:3712","3072:5504","5504:3072","6336:2688","2048:8192","8192:2048","1408:11264","11264:1408"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 14,"referenceTags": true,"seedMax": null,"negativePromptMax": 0},+ {"id": "muse_image","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["2352:1008","2016:1152","1920:1280","1792:1344","1600:1600","1344:1792","1280:1920","1152:2016","auto"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 10,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "seedream5_pro","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["1024:1024","1184:896","896:1184","1376:768","768:1376","1296:864","864:1296","2048:2048","2304:1728","1728:2304","2720:1530","1530:2720","2496:1664","1664:2496","auto_1k","auto_2k"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 10,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "seedream5_lite","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["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"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 14,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "grok_imagine_image_2","promptRequired": true,"promptMin": 1,"promptMax": 2500,"ratios": ["1024:1024","1280:720","720:1280","1152:864","864:1152","1248:832","832:1248","1248:576","576:1248","1280:576","576:1280","1408:704","704:1408","2048:2048","2816:1584","1584:2816","2368:1776","1776:2368","2496:1664","1664:2496","2912:1344","1344:2912","3200:1440","1440:3200","2912:1456","1456:2912","auto_1k","auto_2k"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 3,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "gemini_image3.1_flash_lite","promptRequired": true,"promptMin": 1,"promptMax": 5500,"ratios": ["1024:1024","848:1264","1264:848","896:1200","1200:896","928:1152","1152:928","768:1376","1376:768","1584:672"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 14,"referenceTags": true,"seedMax": null,"negativePromptMax": 0},+ {"id": "gemini_image3_pro","promptRequired": true,"promptMin": 3,"promptMax": 5500,"ratios": ["1344:768","768:1344","1024:1024","1184:864","864:1184","1536:672","832:1248","1248:832","896:1152","1152:896","2048:2048","1696:2528","2528:1696","1792:2400","2400:1792","1856:2304","2304:1856","1536:2752","2752:1536","3168:1344","4096:4096","3392:5056","5056:3392","3584:4800","4800:3584","3712:4608","4608:3712","3072:5504","5504:3072","6336:2688"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 14,"referenceTags": true,"seedMax": null,"negativePromptMax": 0},+ {"id": "gpt_image_2_5_flare","promptRequired": true,"promptMin": 1,"promptMax": 32000,"ratios": ["2048:880","1920:1088","1920:1280","1920:1440","1920:1536","1920:1920","1536:1920","1440:1920","1280:1920","1088:1920","2912:1248","2560:1440","2560:1712","2560:1920","2560:2048","2560:2560","2048:2560","1920:2560","1712:2560","1440:2560","3840:1648","3840:2160","3504:2336","3264:2448","3200:2560","2880:2880","2560:3200","2448:3264","2336:3504","2160:3840","auto"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 16,"referenceTags": true,"seedMax": null,"negativePromptMax": 0},+ {"id": "gpt_image_2_5_sunburst","promptRequired": true,"promptMin": 1,"promptMax": 32000,"ratios": ["2048:880","1920:1088","1920:1280","1920:1440","1920:1536","1920:1920","1536:1920","1440:1920","1280:1920","1088:1920","2912:1248","2560:1440","2560:1712","2560:1920","2560:2048","2560:2560","2048:2560","1920:2560","1712:2560","1440:2560","3840:1648","3840:2160","3504:2336","3264:2448","3200:2560","2880:2880","2560:3200","2448:3264","2336:3504","2160:3840","auto"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 16,"referenceTags": true,"seedMax": null,"negativePromptMax": 0},+ {"id": "bria_fibo_1_5","promptRequired": true,"promptMin": 1,"promptMax": 10000,"ratios": ["1024:1024","768:1152","1152:768","768:1024","1024:768","768:960","960:768","576:1024","1024:576","2048:2048","1536:2304","2304:1536","1536:2048","2048:1536","1536:1920","1920:1536","1152:2048","2048:1152"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 1,"referenceTags": false,"seedMax": 2147483647,"negativePromptMax": 0},+ {"id": "bria_fibo_edit_1_5","promptRequired": true,"promptMin": 1,"promptMax": 10000,"ratios": ["1024:1024","768:1152","1152:768","768:1024","1024:768","768:960","960:768","576:1024","1024:576","auto"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 4,"referenceTags": false,"seedMax": 2147483647,"negativePromptMax": 0},+ {"id": "ideogram_4_0","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["2048:2048","2560:1440","1440:2560","2304:1728","1728:2304","2496:1664","1664:2496","3072:1280","1280:3072"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 1,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "ideogram_4_5","promptRequired": true,"promptMin": 1,"promptMax": 10000,"ratios": ["1024:1024","1280:720","720:1280","1152:864","864:1152","1248:832","832:1248","1120:896","896:1120","1440:720","720:1440","2048:2048","2560:1440","1440:2560","2304:1728","1728:2304","2496:1664","1664:2496","2240:1792","1792:2240","2880:1440","1440:2880","1024:576","576:1024","1408:704","704:1408","auto"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 5,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "seedream5_flash","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["1024:1024","1184:896","896:1184","1376:768","768:1376","1248:832","832:1248","1568:672","2048:2048","2304:1728","1728:2304","2848:1600","1600:2848","2496:1664","1664:2496","3136:1344","auto_1k","auto_2k"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 10,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "nano_banana_2.1","promptRequired": true,"promptMin": 1,"promptMax": 5500,"ratios": ["1024:1024","848:1264","1264:848","896:1200","1200:896","928:1152","1152:928","768:1376","1376:768","1584:672","512:2064","2064:512","352:2928","2928:352","2048:2048","1696:2528","2528:1696","1792:2400","2400:1792","1856:2304","2304:1856","1536:2752","2752:1536","3168:1344","1024:4128","4128:1024","704:5856","5856:704","4096:4096","3392:5056","5056:3392","3584:4800","4800:3584","3712:4608","4608:3712","3072:5504","5504:3072","6336:2688","2048:8256","8256:2048","1408:11712","11712:1408"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 14,"referenceTags": true,"seedMax": null,"negativePromptMax": 0},+ {"id": "gemini_2.5_flash","promptRequired": true,"promptMin": 1,"promptMax": 5500,"ratios": ["1344:768","768:1344","1024:1024","1184:864","864:1184","1536:672","832:1248","1248:832","896:1152","1152:896"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {},"minReferences": 0,"maxReferences": 3,"referenceTags": true,"seedMax": null,"negativePromptMax": 0}+ ],+ "image_to_video": [+ {"id": "gen4.5","promptRequired": true,"promptMin": 1,"promptMax": 1000,"ratios": ["1280:720","720:1280","1104:832","960:960","832:1104","1584:672"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": false,"endImage": false,"duration": {"minimum": 2,"maximum": 10},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "gen4_turbo","promptRequired": false,"promptMin": 1,"promptMax": 1000,"ratios": ["1280:720","720:1280","1104:832","832:1104","960:960","1584:672"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": false,"endImage": false,"duration": {"minimum": 2,"maximum": 10},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "veo3.1","promptRequired": false,"promptMin": 1,"promptMax": 1000,"ratios": ["1280:720","720:1280","1080:1920","1920:1080"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": true,"endImage": true,"duration": {"enum": [4,6,8]},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 1000},+ {"id": "veo3.1_fast","promptRequired": false,"promptMin": 1,"promptMax": 1000,"ratios": ["1280:720","720:1280","1080:1920","1920:1080"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": true,"endImage": true,"duration": {"enum": [4,6,8]},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 1000},+ {"id": "klingO3_4k","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["3840:2160","2160:3840","2880:2880"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "hailuo3","promptRequired": true,"promptMin": 1,"promptMax": 6000,"ratios": ["adaptive","21:9","16:9","4:3","1:1","3:4","9:16"],"ratioRequired": false,"resolutions": ["768p","2k"],"seed": false,"audio": false,"endImage": true,"duration": {"minimum": 5,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling3.0_4k","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["3840:2160","2160:3840","2880:2880"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "happyhorse_1_0","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": [],"ratioRequired": false,"resolutions": ["720p","1080p"],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling2.5_turbo_pro","promptRequired": true,"promptMin": 2,"promptMax": 2500,"ratios": [],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": true,"duration": {"enum": [5,10]},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling3.0_pro","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1920:1080","1080:1920","1440:1440"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling3.0_standard","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1280:720","720:1280","960:960"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "klingO3_pro","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1920:1080","1080:1920","1440:1440"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "klingO3_standard","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1280:720","720:1280","960:960"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "seedance2","promptRequired": false,"promptMin": 1,"promptMax": 3500,"ratios": ["992:432","864:496","752:560","640:640","560:752","496:864","1470:630","1280:720","1112:834","960:960","834:1112","720:1280","2206:946","1920:1080","1664:1248","1440:1440","1248:1664","1080:1920","3840:1646","3840:2160","3840:2880","3840:3840","2880:3840","2160:3840"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": true,"duration": {"minimum": 4,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "seedance2_fast","promptRequired": false,"promptMin": 1,"promptMax": 3500,"ratios": ["992:432","864:496","752:560","640:640","560:752","496:864","1470:630","1280:720","1112:834","960:960","834:1112","720:1280"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": true,"duration": {"minimum": 4,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "seedance2_mini","promptRequired": false,"promptMin": 1,"promptMax": 3500,"ratios": ["992:432","864:496","752:560","640:640","560:752","496:864","1470:630","1280:720","1112:834","960:960","834:1112","720:1280"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": true,"duration": {"minimum": 4,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "gemini_omni_flash","promptRequired": false,"promptMin": 1,"promptMax": 4000,"ratios": ["1280:720","720:1280"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 3,"maximum": 10},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "grok_imagine_1_5","promptRequired": false,"promptMin": 1,"promptMax": 2500,"ratios": [],"ratioRequired": false,"resolutions": ["480p","720p","1080p"],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 1,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "wan3","promptRequired": true,"promptMin": 1,"promptMax": 20000,"ratios": ["832:480","720:544","624:624","544:720","480:832","1280:720","1104:832","960:960","832:1104","720:1280","1920:1080","1648:1248","1440:1440","1248:1648","1080:1920","auto_480p","auto_720p","auto_1080p"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 2,"maximum": 30},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "gemini_omni_flash_1.1","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["640:360","360:640","1280:720","720:1280","1920:1080","1080:1920","3840:2160","2160:3840"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": true,"duration": {"minimum": 3,"maximum": 10},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "wan3_prime","promptRequired": true,"promptMin": 1,"promptMax": 20000,"ratios": ["832:480","720:544","624:624","544:720","480:832","1280:720","1104:832","960:960","832:1104","720:1280","1920:1080","1648:1248","1440:1440","1248:1648","1080:1920","auto_480p","auto_720p","auto_1080p"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": true,"duration": {"minimum": 2,"maximum": 30},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "h3_max","promptRequired": true,"promptMin": 1,"promptMax": 6000,"ratios": [],"ratioRequired": false,"resolutions": ["480p","768p"],"seed": true,"audio": false,"endImage": true,"duration": {"minimum": 5,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "seedance2_5","promptRequired": false,"promptMin": 1,"promptMax": 15000,"ratios": ["992:432","854:480","752:560","640:640","560:752","480:854","1470:630","1280:720","1112:834","960:960","834:1112","720:1280","2206:946","1920:1080","1664:1248","1440:1440","1248:1664","1080:1920"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": true,"duration": {"minimum": 4,"maximum": 30},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "grok_imagine_1_5_lite","promptRequired": false,"promptMin": 1,"promptMax": 2500,"ratios": ["auto_480p","auto_720p","auto_1080p"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 1,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0}+ ],+ "text_to_video": [+ {"id": "gen4.5","promptRequired": true,"promptMin": 1,"promptMax": 1000,"ratios": ["1280:720","720:1280"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": false,"endImage": false,"duration": {"minimum": 2,"maximum": 10},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "veo3.1","promptRequired": true,"promptMin": 1,"promptMax": 1000,"ratios": ["1280:720","720:1280","1080:1920","1920:1080"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": true,"endImage": false,"duration": {"enum": [4,6,8]},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 1000},+ {"id": "veo3.1_fast","promptRequired": true,"promptMin": 1,"promptMax": 1000,"ratios": ["1280:720","720:1280","1080:1920","1920:1080"],"ratioRequired": true,"resolutions": [],"seed": true,"audio": true,"endImage": false,"duration": {"enum": [4,6,8]},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 1000},+ {"id": "klingO3_4k","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["3840:2160","2160:3840","2880:2880"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "hailuo3","promptRequired": true,"promptMin": 1,"promptMax": 6000,"ratios": ["adaptive","21:9","16:9","4:3","1:1","3:4","9:16"],"ratioRequired": false,"resolutions": ["768p","2k"],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 5,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling3.0_4k","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["3840:2160","2160:3840","2880:2880"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "happyhorse_1_0","promptRequired": true,"promptMin": 2,"promptMax": 2500,"ratios": ["1280:720","720:1280","960:960","1108:832","832:1108","1920:1080","1080:1920","1440:1440","1662:1248","1248:1662"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling2.5_turbo_pro","promptRequired": true,"promptMin": 2,"promptMax": 2500,"ratios": ["1920:1080","1440:1440","1080:1920","1280:720","720:720","720:1280"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {"enum": [5,10]},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling3.0_pro","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1920:1080","1080:1920","1440:1440"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "kling3.0_standard","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1280:720","720:1280","960:960"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "klingO3_pro","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1920:1080","1080:1920","1440:1440"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "klingO3_standard","promptRequired": false,"promptMin": 2,"promptMax": 2500,"ratios": ["1280:720","720:1280","960:960"],"ratioRequired": true,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 3,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "seedance2","promptRequired": true,"promptMin": 1,"promptMax": 3500,"ratios": ["992:432","864:496","752:560","640:640","560:752","496:864","1470:630","1280:720","1112:834","960:960","834:1112","720:1280","2206:946","1920:1080","1664:1248","1440:1440","1248:1664","1080:1920","3840:1646","3840:2160","3840:2880","3840:3840","2880:3840","2160:3840"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": false,"duration": {"minimum": 4,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "seedance2_fast","promptRequired": true,"promptMin": 1,"promptMax": 3500,"ratios": ["992:432","864:496","752:560","640:640","560:752","496:864","1470:630","1280:720","1112:834","960:960","834:1112","720:1280"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": false,"duration": {"minimum": 4,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "seedance2_mini","promptRequired": true,"promptMin": 1,"promptMax": 3500,"ratios": ["992:432","864:496","752:560","640:640","560:752","496:864","1470:630","1280:720","1112:834","960:960","834:1112","720:1280"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": false,"duration": {"minimum": 4,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "gemini_omni_flash","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["1280:720","720:1280"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 3,"maximum": 10},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "grok_imagine_1_5","promptRequired": true,"promptMin": 1,"promptMax": 2500,"ratios": ["1:1","16:9","9:16","4:3","3:4","3:2","2:3"],"ratioRequired": false,"resolutions": ["480p","720p","1080p"],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 1,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "wan3","promptRequired": true,"promptMin": 1,"promptMax": 20000,"ratios": ["832:480","720:544","624:624","544:720","480:832","1280:720","1104:832","960:960","832:1104","720:1280","1920:1080","1648:1248","1440:1440","1248:1648","1080:1920","auto_480p","auto_720p","auto_1080p"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 2,"maximum": 30},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "gemini_omni_flash_1.1","promptRequired": true,"promptMin": 1,"promptMax": 4000,"ratios": ["640:360","360:640","1280:720","720:1280","1920:1080","1080:1920","3840:2160","2160:3840"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 3,"maximum": 10},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "wan3_prime","promptRequired": true,"promptMin": 1,"promptMax": 20000,"ratios": ["832:480","720:544","624:624","544:720","480:832","1280:720","1104:832","960:960","832:1104","720:1280","1920:1080","1648:1248","1440:1440","1248:1648","1080:1920","auto_480p","auto_720p","auto_1080p"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": true,"endImage": false,"duration": {"minimum": 2,"maximum": 30},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0},+ {"id": "h3_max","promptRequired": true,"promptMin": 1,"promptMax": 6000,"ratios": [],"ratioRequired": false,"resolutions": ["480p","768p"],"seed": true,"audio": false,"endImage": false,"duration": {"minimum": 5,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "seedance2_5","promptRequired": false,"promptMin": 1,"promptMax": 15000,"ratios": ["992:432","854:480","752:560","640:640","560:752","480:854","1470:630","1280:720","1112:834","960:960","834:1112","720:1280","2206:946","1920:1080","1664:1248","1440:1440","1248:1664","1080:1920"],"ratioRequired": false,"resolutions": [],"seed": true,"audio": true,"endImage": false,"duration": {"minimum": 4,"maximum": 30},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": 4294967295,"negativePromptMax": 0},+ {"id": "grok_imagine_1_5_lite","promptRequired": true,"promptMin": 1,"promptMax": 2500,"ratios": ["848:480","480:848","480:480","640:480","480:640","720:480","480:720","1280:720","720:1280","720:720","960:720","720:960","1088:720","720:1088","1904:1072","1072:1904","1424:1424","1648:1232","1232:1648","1744:1152","1152:1744"],"ratioRequired": false,"resolutions": [],"seed": false,"audio": false,"endImage": false,"duration": {"minimum": 1,"maximum": 15},"minReferences": 0,"maxReferences": 0,"referenceTags": false,"seedMax": null,"negativePromptMax": 0}+ ]+};diff --git a/server/lib/runwayImageModels.js b/server/lib/runwayImageModels.jsindex df59f40323..a9ff79be7f 100644--- a/server/lib/runwayImageModels.js+++ b/server/lib/runwayImageModels.js@@ -3,6 +3,8 @@* https://github.com/runwayml/sdk-node/blob/main/src/resources/text-to-image.ts* Dependency-free: shared by the server and browser model pickers.*/+import { RUNWAY_CATALOG_SNAPSHOT } from './runwayCatalogSnapshot.js';+export const RUNWAY_IMAGE_PRICING_VERIFIED_AT = '2026-10-22';const refuse = (message) => Object.assign(new Error(message), { status: 400, code: 'RUNWAY_IMAGE_INPUT_INVALID' });export const RUNWAY_IMAGE_DEFAULT_MODEL = 'gen4_image';@@ -16,17 +18,42 @@ 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']),});-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 })));+const LABELS = {+ gen4_image: 'Runway Gen-4 Image', gen4_image_turbo: 'Runway Gen-4 Image Turbo',+ gpt_image_2: 'GPT Image 2', gpt_image_2_5_flare: 'GPT Image 2.5 Flare', gpt_image_2_5_sunburst: 'GPT Image 2.5 Sunburst',+ 'gemini_image3.1_flash': 'Nano Banana 2', 'gemini_image3.1_flash_lite': 'Nano Banana 2 Lite',+ gemini_image3_pro: 'Nano Banana Pro', 'gemini_2.5_flash': 'Nano Banana', 'nano_banana_2.1': 'Nano Banana 2.1',+ muse_image: 'Muse Image', seedream5_pro: 'Seedream 5.0 Pro', seedream5_lite: 'Seedream 5.0 Lite', seedream5_flash: 'Seedream 5.0 Flash',+ grok_imagine_image_2: 'Grok Imagine Image 2', bria_fibo_1_5: 'FIBO 1.5', bria_fibo_edit_1_5: 'FIBO Edit 1.5',+ ideogram_4_0: 'Ideogram 4.0', ideogram_4_5: 'Ideogram 4.5',+};+// Preserve the native Gen-4 tier settings on existing installs. Other vendors+// expose exact canvases: do not invent resolution tiers from their pixel area.+function imageRatios(row) {+ if (row.id.startsWith('gen4_')) return RATIOS;+ const canvases = row.ratios.filter((r) => /^\d+:\d+$/.test(r));+ return { auto: canvases, ...Object.fromEntries(canvases.map((r) => [r, [r]])) };+}+export const RUNWAY_IMAGE_MODELS = Object.freeze(RUNWAY_CATALOG_SNAPSHOT.text_to_image.map((row) => {+ const ratios = imageRatios(row);+ return Object.freeze({+ id: row.id, label: LABELS[row.id] || row.id, ratios, defaultResolution: Object.keys(ratios)[0],+ minReferences: row.id === 'bria_fibo_edit_1_5' ? 1 : row.minReferences,+ maxReferences: row.maxReferences, referenceTags: row.referenceTags,+ seedMax: row.seedMax,+ promptMinChars: row.promptMin, promptMaxChars: row.promptMax, seed: row.seed,+ // Unknown prices remain unknown, never zero. The API returns actual cost separately.+ credits: row.id === 'gen4_image' ? { '720p': 5, '1080p': 8 } : row.id === 'gen4_image_turbo' ? { '720p': 2, '1080p': 2 } : {},+ });+}));+export const RUNWAY_IMAGE_RESOLUTIONS = Object.freeze([...new Set(RUNWAY_IMAGE_MODELS.flatMap((m) => Object.keys(m.ratios)))]);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 ratios = model.ratios[resolution || model.defaultResolution];+ if (!ratios) throw refuse(`Runway ${model.id} resolution must be ${Object.keys(model.ratios).join(" or ")}`);if (ratio) {if (!ratios.includes(ratio)) throw refuse(`Runway ${model.id} does not support ratio ${ratio} at ${resolution}`);return ratio;@@ -55,21 +82,24 @@ export function runwayReferenceTags(references = []) {export function buildRunwayImageRequest({ modelId = RUNWAY_IMAGE_DEFAULT_MODEL, prompt, referenceImages = [], seed, ...size }) {const model = getRunwayImageModel(modelId);if (!model) throw refuse(`Unknown Runway image model: ${modelId}`);- if (typeof prompt !== 'string' || !prompt.trim() || prompt.length > model.promptMaxChars) {+ if (typeof prompt !== 'string' || prompt.trim().length < model.promptMinChars || prompt.length > model.promptMaxChars) {throw refuse(`Runway ${modelId} prompt must contain 1–${model.promptMaxChars} characters (received ${prompt?.length ?? 0})`);}if (referenceImages.length < model.minReferences || referenceImages.length > model.maxReferences) {throw refuse(`Runway ${modelId} requires ${model.minReferences}–${model.maxReferences} reference images`);}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) {+ if (referenceImages.some((ref) => typeof ref.uri !== 'string' || !ref.uri || (model.referenceTags && !/^[a-z][a-z0-9_]{2,15}$/.test(ref.tag))) || (model.referenceTags && new Set(tags).size !== tags.length)) {throw refuse('Runway reference images require a URI and unique 3–16 character tags');}- 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';+ if (model.seed && seed != null && seed !== -1 && (!Number.isInteger(Number(seed)) || Number(seed) < 0 || Number(seed) > model.seedMax)) throw refuse(`Runway seed must be a nonnegative 32-bit integer no greater than ${model.seedMax}`);+ const preservesSourceFrame = modelId === 'bria_fibo_edit_1_5' && referenceImages.length === 1;+ if (preservesSourceFrame && (size.ratio || (size.resolution && size.resolution !== 'auto'))) throw refuse('FIBO Edit needs at least two references to choose a canvas; one reference keeps its source framing');+ const ratio = preservesSourceFrame ? null : runwayImageRatio(model, size);+ const resolution = size.resolution || model.defaultResolution;+ const wireReferences = referenceImages.map(({ uri, tag }) => ({ uri, ...(model.referenceTags ? { tag } : {}) }));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 ? { ratio } : {}), ...(referenceImages.length ? { referenceImages: wireReferences } : {}), ...(model.seed && seed != null && seed !== -1 ? { seed: Number(seed) } : {}) },+ resolution, estimatedCredits: model.credits[resolution] ?? null, estimatedCostUsd: model.credits[resolution] == null ? null : model.credits[resolution] / 100,};}diff --git a/server/lib/runwayImageModels.test.js b/server/lib/runwayImageModels.test.jsindex 8ee1498ede..a278cc2964 100644--- a/server/lib/runwayImageModels.test.js+++ b/server/lib/runwayImageModels.test.js@@ -5,11 +5,12 @@ const ref = { uri: 'https://example.com/anchor.png', tag: 'char1' };describe('Runway image wire contracts', () => {// Catches unsupported model fields and resolution/price drift without paid requests.it.each(RUNWAY_IMAGE_MODELS)('$id emits only the image API fields and prices each canvas', (model) => {+ const references = model.id === 'bria_fibo_edit_1_5' ? [ref, { uri: 'https://example.com/second.png', tag: 'ref2' }] : [ref];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] });- expect(request.estimatedCredits).toBe(model.credits[resolution]);+ const request = buildRunwayImageRequest({ modelId: model.id, prompt: ' @char1 in a garden ', resolution, ratio, seed: 42, referenceImages: references });+ expect(request.body).toEqual({ model: model.id, promptText: ' @char1 in a garden ', ratio, ...(model.seed ? { seed: 42 } : {}), referenceImages: references.map((r) => model.referenceTags ? r : { uri: r.uri }) });+ expect(request.estimatedCredits).toBe(model.credits[resolution] ?? null);}}});@@ -30,3 +31,20 @@ describe('Runway image wire contracts', () => {for (const { tag } of tags) expect(tag).toMatch(/^[a-z][a-z0-9_]{2,15}$/i);});});++it('enforces Bria seed bounds and keeps third-party canvas and prompt limits model-specific', () => {+ expect(() => buildRunwayImageRequest({ modelId: 'bria_fibo_1_5', prompt: 'A garden', seed: 2147483648 })).toThrow('2147483647');+ expect(buildRunwayImageRequest({ modelId: 'gpt_image_2', prompt: 'x'.repeat(20000), seed: 42, resolution: '3840:2160' }).body).toEqual({ model: 'gpt_image_2', promptText: 'x'.repeat(20000), ratio: '3840:2160' });+ expect(() => buildRunwayImageRequest({ modelId: 'gemini_image3_pro', prompt: 'x' })).toThrow('prompt');+ expect(() => buildRunwayImageRequest({ modelId: 'bria_fibo_edit_1_5', prompt: 'A garden' })).toThrow('1–4');+});++it('preserves requested portrait and landscape framing when the model uses automatic canvas selection', () => {+ expect(buildRunwayImageRequest({ modelId: 'gpt_image_2', prompt: 'A coast', width: 1920, height: 1080 }).body.ratio).toBe('2560:1440');+ expect(buildRunwayImageRequest({ modelId: 'muse_image', prompt: 'A coast', width: 720, height: 1280 }).body.ratio).toBe('1152:2016');+});++it('preserves FIBO Edit source framing with one reference and permits a canvas with two', () => {+ expect(buildRunwayImageRequest({ modelId: 'bria_fibo_edit_1_5', prompt: 'Make it blue', referenceImages: [ref] }).body).not.toHaveProperty('ratio');+ expect(() => buildRunwayImageRequest({ modelId: 'bria_fibo_edit_1_5', prompt: 'Make it blue', referenceImages: [ref], resolution: '1024:1024' })).toThrow('at least two references');+});diff --git a/server/lib/runwayVideoModels.js b/server/lib/runwayVideoModels.jsindex 27b17375a9..cee2c25bc2 100644--- a/server/lib/runwayVideoModels.js+++ b/server/lib/runwayVideoModels.js@@ -1,35 +1,8 @@-/**- * Curated Runway VIDEO model catalog — what PortOS knows about each model it- * offers through Runway's developer API (`POST /v1/image_to_video`, and- * `POST /v1/text_to_video` for a row with a `textToVideo` rule): the- * request fields each model takes (the body is one shape per `model`), its- * duration and output-size rules, whether it ends on a last frame, and its- * published price.- *- * Every row was checked against Runway's API reference and pricing guide- * (docs.dev.runwayml.com: api.md, guides/pricing.md, assets/inputs.md) on- * RUNWAY_VIDEO_PRICING_VERIFIED_AT. Runway changes these; when a render is- * refused with a 400 or a bill disagrees with an estimate, re-check that- * model's section and edit its row.- *- * Veo is deliberately not offered (a project choice), though- * Runway serves it; the native `negativePrompt` row field stays for a model- * that takes one.- *- * Every row animates a start frame, and the rows marked `endImage` also end on- * a last frame. Only Gen-4.5 also renders from text alone; its `textToVideo`- * rule lists the ratios `/v1/text_to_video` takes (the duration, prompt cap,- * seed and price are the row's own). The other curated rows stay image-only- * until a text-to-video need for them is checked against the API reference. Provider audio is always requested off- * (`audio: false`) where a model has the field, since a PortOS clip is silent- * unless the caller asks (a Music Video's master song is its only soundtrack),- * and the silent rate is what is priced.- *- * Runway bills credits at $0.01 each; prices below are credits per second ÷ 100.- *- * Dependency-free so `client/src/lib/runwayVideoModels.js` can re-export it and- * the board, the provider and the autopilot price a take identically.+/** Runway text/image-to-video capabilities shared by forms, submissions and quotes.+ * Published OpenAPI snapshot: 2026-10-22. Video-editing and performance endpoints+ * need different input workflows and are reported separately by the catalog API.*/+import { RUNWAY_CATALOG_SNAPSHOT } from './runwayCatalogSnapshot.js';/** Date the schemas and prices below were last verified against Runway's docs. */export const RUNWAY_VIDEO_PRICING_VERIFIED_AT = '2026-10-19';@@ -37,83 +10,50 @@ export const RUNWAY_VIDEO_PRICING_VERIFIED_AT = '2026-10-19';/** Runway's own Gen-4.5: the default when a request names no model. */export const RUNWAY_DEFAULT_IMAGE_VIDEO_MODEL = 'gen4.5';-const GEN4_RATIOS = Object.freeze(['1280:720', '720:1280', '1104:832', '960:960', '832:1104', '1584:672']);--/** The curated catalog, one frozen row per Runway model. */-export const RUNWAY_VIDEO_MODELS = Object.freeze([- {- id: 'gen4.5', label: 'Runway Gen-4.5', family: 'runway-gen4',- prompt: 'required', promptMaxChars: 1000,- endImage: false,- duration: { kind: 'range', min: 2, max: 10, defaultSec: 5 },- // `ratio` is required and names the output canvas.- size: { param: 'ratio', required: true, byResolution: { '720p': GEN4_RATIOS }, default: '720p' },- audio: false, seed: true, negativePrompt: false,- // `ratio` is required on /v1/text_to_video and offers only these two.- textToVideo: { ratios: Object.freeze(['1280:720', '720:1280']) },- pricing: { perSecond: 0.12 },- },- {- id: 'gen4_turbo', label: 'Runway Gen-4 Turbo', family: 'runway-gen4',- prompt: 'optional', promptMaxChars: 1000,- endImage: false,- duration: { kind: 'range', min: 2, max: 10, defaultSec: 5 },- size: { param: 'ratio', required: true, byResolution: { '720p': GEN4_RATIOS }, default: '720p' },- audio: false, seed: true, negativePrompt: false,- pricing: { perSecond: 0.05 },- },- {- id: 'kling3.0_standard', label: 'Kling 3.0 Standard', family: 'kling-3.0',- prompt: 'optional', promptMaxChars: 2500,- endImage: true,- duration: { kind: 'range', min: 3, max: 15, defaultSec: 5 },- // Optional; with a last frame the canvas follows the first frame.- size: { param: 'ratio', required: false, byResolution: { '720p': ['1280:720', '720:1280', '960:960'] }, default: '720p' },- // 13 credits/s with audio (Runway's default), 9 with audio off.- audio: true, seed: false, negativePrompt: false,- pricing: { perSecond: 0.09 },- },- {- id: 'kling3.0_pro', label: 'Kling 3.0 Pro', family: 'kling-3.0',- prompt: 'optional', promptMaxChars: 2500,- endImage: true,- duration: { kind: 'range', min: 3, max: 15, defaultSec: 5 },- size: { param: 'ratio', required: false, byResolution: { '1080p': ['1920:1080', '1080:1920', '1440:1440'] }, default: '1080p' },- // 17 credits/s with audio, 12 with audio off.- audio: true, seed: false, negativePrompt: false,- pricing: { perSecond: 0.12 },- },- {- id: 'kling2.5_turbo_pro', label: 'Kling 2.5 Turbo Pro', family: 'kling-2.5',- prompt: 'optional', promptMaxChars: 2500,- endImage: true,- duration: { kind: 'enum', values: [5, 10], defaultSec: 5 },- // No ratio field: the canvas follows the start frame.- size: null,- audio: false, seed: false, negativePrompt: false,- pricing: { perSecond: 0.12 },- },- {- id: 'h3_max', label: 'MiniMax H3 Max', family: 'minimax-h3',- prompt: 'required', promptMaxChars: 6000,- endImage: true,- duration: { kind: 'range', min: 5, max: 15, defaultSec: 5 },- // A resolution, not a ratio: the canvas follows the start frame.- size: { param: 'resolution', required: false, byResolution: { '480p': null, '768p': null }, default: '768p' },- audio: false, seed: true, negativePrompt: false,- pricing: { perSecond: { '480p': 0.05, '768p': 0.08 } },- },- {- id: 'wan3', label: 'WAN 3.0', family: 'wan-3',- prompt: 'required', promptMaxChars: 20000,- endImage: true,- duration: { kind: 'range', min: 2, max: 30, defaultSec: 5 },- // A keyframe render must use an `auto_*` ratio: the canvas follows the first frame.- size: { param: 'ratio', required: false, byResolution: { '480p': ['auto_480p'], '720p': ['auto_720p'], '1080p': ['auto_1080p'] }, default: '720p' },- audio: true, seed: false, negativePrompt: false,- pricing: { perSecond: { '480p': 0.05, '720p': 0.10, '1080p': 0.20 } },- },-].map((model) => Object.freeze(model)));+const PRICES = {+ 'gen4.5': 0.12, gen4_turbo: 0.05, 'kling3.0_standard': 0.09, 'kling3.0_pro': 0.12,+ 'kling2.5_turbo_pro': 0.12, h3_max: { '480p': 0.05, '768p': 0.08 },+ wan3: { '480p': 0.05, '720p': 0.10, '1080p': 0.20 },+};+const LABELS = {+ 'gen4.5': 'Runway Gen-4.5', gen4_turbo: 'Runway Gen-4 Turbo',+ 'veo3.1': 'Veo 3.1', 'veo3.1_fast': 'Veo 3.1 Fast',+ hailuo3: 'MiniMax H3', h3_max: 'MiniMax H3 Max', happyhorse_1_0: 'HappyHorse 1.0',+ wan3: 'WAN 3.0', wan3_prime: 'WAN 3.0 Prime',+ seedance2: 'Seedance 2.0', seedance2_fast: 'Seedance 2.0 Fast', seedance2_mini: 'Seedance 2.0 Mini', seedance2_5: 'Seedance 2.5',+ gemini_omni_flash: 'Gemini Omni Flash', 'gemini_omni_flash_1.1': 'Gemini Omni Flash 1.1',+ grok_imagine_1_5: 'Grok Imagine Video 1.5', grok_imagine_1_5_lite: 'Grok Imagine Video 1.5 Lite',+};+function sizeRule(row, textOnly) {+ if (row.resolutions.length) return {+ param: 'resolution', required: true, byResolution: Object.fromEntries(row.resolutions.map((r) => [r, null])),+ default: row.id === 'h3_max' ? '768p' : row.resolutions.includes('720p') ? '720p' : row.resolutions[0],+ };+ let ratios = row.ratios;+ if (row.id.startsWith('wan3')) ratios = ratios.filter((r) => textOnly ? !r.startsWith('auto_') : r.startsWith('auto_'));+ if (!ratios.length) return null;+ const byResolution = {};+ for (const ratio of ratios) {+ const [w, h] = ratio.split(':').map(Number);+ const pixels = w * h;+ const tier = ratio.startsWith('auto_') ? ratio.slice(5) : pixels > 5e6 ? '4k' : pixels > 1.1e6 ? '1080p' : pixels > 5e5 ? '720p' : pixels > 3e5 ? '480p' : '360p';+ (byResolution[tier] ||= []).push(ratio);+ }+ return { param: 'ratio', required: row.ratioRequired, byResolution, default: byResolution['720p'] ? '720p' : Object.keys(byResolution)[0] };+}+export const RUNWAY_VIDEO_MODELS = Object.freeze(RUNWAY_CATALOG_SNAPSHOT.image_to_video.map((row) => {+ const text = RUNWAY_CATALOG_SNAPSHOT.text_to_video.find((m) => m.id === row.id);+ const d = row.duration;+ const duration = d.enum ? { kind: 'enum', values: d.enum, defaultSec: d.enum.find((n) => n >= 5) || d.enum[0] }+ : { kind: 'range', min: d.minimum, max: d.maximum, defaultSec: Math.max(5, d.minimum) };+ return Object.freeze({+ id: row.id, label: LABELS[row.id] || row.id.replace('kling', 'Kling ').replaceAll('_', ' '), family: row.id,+ prompt: row.promptRequired ? 'required' : 'optional', promptMinChars: row.promptMin, promptMaxChars: row.promptMax,+ endImage: row.endImage, duration, size: sizeRule(row, false), audio: row.audio, seed: row.seed, negativePrompt: row.negativePromptMax > 0, negativePromptMaxChars: row.negativePromptMax,+ ...(text ? { textToVideo: { ratios: text.ratios.filter((r) => /^\d+:\d+$/.test(r)), size: sizeRule(text, true), promptRequired: text.promptRequired } } : {}),+ pricing: { perSecond: PRICES[row.id] ?? null },+ });+}));const BY_ID = new Map(RUNWAY_VIDEO_MODELS.map((m) => [m.id, m]));@@ -241,10 +181,11 @@ export function buildRunwayVideoRequest({if (!model) throw refuse(`"${modelId}" is not a Runway model PortOS offers`);const text = typeof prompt === 'string' ? prompt.trim() : '';const avoid = typeof negativePrompt === 'string' ? negativePrompt.trim() : '';- if (model.prompt === 'required' && !text) throw refuse(`${model.label} needs a prompt`);+ if ((model.prompt === 'required' || (!imageUri && model.textToVideo?.promptRequired)) && !text) throw refuse(`${model.label} needs a prompt`);// No native field: the negative prompt rides in the prompt as an "Avoid:"// clause, shown to the user as a labeled addition (same fallback as fal.ai).const sent = !model.negativePrompt && avoid ? `${text}\nAvoid: ${avoid}`.trim() : text;+ if (sent && sent.length < model.promptMinChars) throw refuse(`${model.label} needs at least ${model.promptMinChars} prompt characters`);if (sent.length > model.promptMaxChars) {throw refuse(`The prompt is ${sent.length.toLocaleString('en-US')} characters${sent === text ? '' : ' with its "Avoid:" clause'}; ${model.label} takes ${model.promptMaxChars.toLocaleString('en-US')}. Shorten it to render.`);}@@ -266,21 +207,20 @@ export function buildRunwayVideoRequest({if (model.negativePrompt && avoid) body.negativePrompt = avoid;const coercedSec = coerceRunwayVideoSeconds(model, seconds);body.duration = coercedSec;- const res = resolveRunwayVideoResolution(model, resolution);- if (textOnly) {- // No frame to follow, so the canvas is always named: the offered ratio closest to the target.- const want = aspectOf({ aspectRatio, width, height }) ?? 16 / 9;- body.ratio = model.textToVideo.ratios.reduce((best, r) => (Math.abs(ratioOf(r) - want) < Math.abs(ratioOf(best) - want) ? r : best));- } else if (model.size) {- const target = aspectOf({ aspectRatio, width, height });- // An optional ratio is sent only when there is a target to match and no- // last frame (a keyframe render's canvas follows its first frame);- // otherwise Runway sizes from the frame.- if (model.size.required || model.size.param === 'resolution' || model.size.byResolution[res]?.length === 1+ const activeModel = textOnly ? { ...model, size: model.textToVideo.size } : model;+ const res = resolveRunwayVideoResolution(activeModel, resolution);+ const target = aspectOf({ aspectRatio, width, height });+ if (activeModel.size) {+ if (textOnly || resolution || activeModel.size.required || activeModel.size.param === 'resolution' || activeModel.size.byResolution[res]?.length === 1|| (target != null && !endImageUri)) {- body[model.size.param] = pickSizeValue(model, res, target);+ body[activeModel.size.param] = pickSizeValue(activeModel, res, target);}}+ // These families take both a separate resolution and an aspect-ratio enum.+ if (textOnly && activeModel.size?.param === 'resolution' && model.textToVideo.ratios.length) {+ const want = target ?? 16 / 9;+ body.ratio = model.textToVideo.ratios.reduce((best, r) => Math.abs(ratioOf(r) - want) < Math.abs(ratioOf(best) - want) ? r : best);+ }if (model.audio) body.audio = false;if (model.seed && Number.isInteger(seed) && seed >= 0 && seed <= 4294967295) body.seed = seed;diff --git a/server/lib/runwayVideoModels.test.js b/server/lib/runwayVideoModels.test.jsindex ec46d2e1be..15eee8af15 100644--- a/server/lib/runwayVideoModels.test.js+++ b/server/lib/runwayVideoModels.test.js@@ -102,13 +102,18 @@ describe('Runway pricing and lengths', () => {it('rounds a shot up to the shortest length that covers it, capped at the longest', () => {expect(coerceRunwayVideoSeconds(getRunwayVideoModel('kling2.5_turbo_pro'), 5.01)).toBe(10);expect(coerceRunwayVideoSeconds(getRunwayVideoModel('kling2.5_turbo_pro'), 20)).toBe(10);- expect(getRunwayVideoModel('veo3.1')).toBeNull();+ expect(coerceRunwayVideoSeconds(getRunwayVideoModel('veo3.1'), 5)).toBe(6);expect(coerceRunwayVideoSeconds(getRunwayVideoModel('gen4_turbo'), 1)).toBe(2);expect(coerceRunwayVideoSeconds(getRunwayVideoModel('gen4_turbo'), null)).toBe(5);});- it('quotes every curated model and describes its rate', () => {+ it('keeps unknown prices explicit and preserves verified model quotes', () => {for (const model of RUNWAY_VIDEO_MODELS) {+ if (model.pricing.perSecond == null) {+ expect(runwayVideoClipQuote({ modelId: model.id, seconds: 4 })).toBeNull();+ expect(describeRunwayVideoRate(model.id)).toBeNull();+ continue;+ }expect(runwayVideoClipQuote({ modelId: model.id, seconds: 4 })?.costUsd).toBeGreaterThan(0);expect(describeRunwayVideoRate(model.id)).toMatch(/^\$[\d.]+\/s/);}@@ -116,3 +121,14 @@ describe('Runway pricing and lengths', () => {expect(runwayVideoClipQuote({ modelId: 'unknown' })).toBeNull();});});++describe('Additional Runway families', () => {+ it('uses native Veo exclusions, endpoint-specific WAN sizes and resolution plus ratio for Hailuo', () => {+ expect(buildRunwayVideoRequest({ modelId: 'veo3.1', prompt: 'A coast', negativePrompt: 'text', seconds: 5, resolution: '1080p' }).body).toEqual({ model: 'veo3.1', promptText: 'A coast', negativePrompt: 'text', duration: 6, ratio: '1920:1080', audio: false });+ expect(build('wan3_prime', { resolution: '1080p' }).body).toMatchObject({ ratio: 'auto_1080p', audio: false });+ expect(buildRunwayVideoRequest({ modelId: 'wan3_prime', prompt: 'A coast', resolution: '1080p' }).body).toMatchObject({ ratio: '1920:1080' });+ expect(buildRunwayVideoRequest({ modelId: 'hailuo3', prompt: 'A coast', resolution: '2k', aspectRatio: '9:16' }).body).toEqual({ model: 'hailuo3', promptText: 'A coast', duration: 5, resolution: '2k', ratio: '9:16' });+ expect(buildRunwayVideoRequest({ modelId: 'h3_max', prompt: 'A coast' }).body).not.toHaveProperty('ratio');+ expect(() => build('kling3.0_pro', { prompt: 'x' })).toThrow('at least 2');+ });+});diff --git a/server/lib/validation.js b/server/lib/validation.jsindex 907f929093..9e422f30ab 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -18,7 +18,7 @@ import { APP_FEATURE_IDS, INSTANCE_FEATURE_IDS, INSTANCE_FEATURE_GROUP_IDS } froimport { MAX_MONTHLY_COST } from './subscriptionSavings.js';import { MAX_PLAN_TIER_LENGTH } from './subscriptionPlanTiers.js';import { IMAGE_GEN_MODES, QUEUEABLE_IMAGE_MODES, VIDEO_GEN_MODES } from './generationModes.js';-import { RUNWAY_IMAGE_MODEL_IDS } from './runwayImageModels.js';+import { RUNWAY_IMAGE_MODEL_IDS, RUNWAY_IMAGE_RESOLUTIONS } from './runwayImageModels.js';import { FAL_IMAGE_MODEL_IDS } from './falImageModels.js';import { RENDER_TARGETS, RENDER_TARGET_BACKEND_AUTO } from './renderTargets.js';import {@@ -2292,7 +2292,7 @@ export const videoModelTermsSchema = z.object({export const imageGenRunwaySettingsSchema = z.object({enabled: z.boolean().optional(),model: z.preprocess((v) => v === '' ? undefined : v, z.enum(RUNWAY_IMAGE_MODEL_IDS).optional()),- resolution: z.enum(['720p', '1080p']).optional(),+ resolution: z.enum(RUNWAY_IMAGE_RESOLUTIONS).optional(),cleanC2PA: z.boolean().optional(),denoise: z.boolean().optional(),});diff --git a/server/routes/imageGen.js b/server/routes/imageGen.jsindex c172be5a7c..3847330a9a 100644--- a/server/routes/imageGen.js+++ b/server/routes/imageGen.js@@ -1,3 +1,4 @@+import { getRunwayModelCatalog } from '../services/runwayModelCatalog.js';import { assertCatalogIdentityWritable } from '../services/catalogDB/identityAccess.js';/*** Image Generation Routes — works against the external SD API, local mflux,@@ -63,6 +64,13 @@ import { promptAdditionsSchema } from '../lib/modelInput.js';const router = Router();+router.get('/runway-models', asyncHandler(async (_req, res) => {+ res.json(await getRunwayModelCatalog());+}));+router.post('/runway-models/refresh', asyncHandler(async (_req, res) => {+ res.json(await getRunwayModelCatalog({ refresh: true }));+}));+const routeSource = (req) => ({ route: `${req.baseUrl}${req.route?.path ?? ''}`, method: req.method });// Event-only pointer: job id in `target`, never the generation prompt (#5596).@@ -100,9 +108,9 @@ async function enqueueLoggedImage(req, job) {// Shared validation limits. MAX_REFERENCE_IMAGES must stay in sync with the// number of `referenceImageN` upload field names below.-const MAX_PROMPT_LENGTH = 8000;+const MAX_PROMPT_LENGTH = 32000;const MAX_LORAS = 8;-const MAX_REFERENCE_IMAGES = 10;+const MAX_REFERENCE_IMAGES = 16;const updatePromptSchema = z.object({ prompt: z.string().max(MAX_PROMPT_LENGTH) });const galleryImageFilenameSchema = (label) => z.string().max(256).regex(/^[^/\\]+\.(png|jpg|jpeg|webp)$/i, `${label} must be a basename ending in png/jpg/jpeg/webp`);diff --git a/server/routes/videoGen.js b/server/routes/videoGen.jsindex 7c6235c5ea..4a04bbb351 100644--- a/server/routes/videoGen.js+++ b/server/routes/videoGen.js@@ -354,7 +354,7 @@ const generateBodySchema = z.object({(v) => (v === '' ? undefined : v),z.enum(REACTOR_ASPECTS).optional(),),- prompt: z.string().min(1).max(8000),+ prompt: z.string().min(1).max(20000),negativePrompt: z.string().max(8000).optional(),modelId: z.string().max(64).optional(),width: optionalNum(64, 2048, 'width'),diff --git a/server/services/fixtures/runwayOpenApi.json b/server/services/fixtures/runwayOpenApi.jsonnew file mode 100644index 0000000000..96977ed5c5--- /dev/null+++ b/server/services/fixtures/runwayOpenApi.json@@ -0,0 +1,786 @@+{+ "info": {+ "version": "2024-11-06"+ },+ "paths": {+ "/v1/text_to_image": {+ "post": {+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "oneOf": [+ {+ "type": "object",+ "properties": {+ "promptText": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "seed": {+ "type": "integer",+ "minimum": 0,+ "maximum": 4294967295+ },+ "ratio": {+ "type": "string",+ "enum": [+ "1024:1024",+ "1080:1080",+ "1168:880",+ "1360:768",+ "1440:1080",+ "1080:1440",+ "1808:768",+ "1920:1080",+ "1080:1920",+ "2112:912",+ "1280:720",+ "720:1280",+ "720:720",+ "960:720",+ "720:960",+ "1680:720"+ ]+ },+ "referenceImages": {+ "maxItems": 3,+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "uri": {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ "tag": {+ "type": "string",+ "minLength": 3,+ "maxLength": 16,+ "pattern": "^[a-z][a-z0-9_]+$"+ }+ },+ "required": [+ "uri"+ ]+ }+ },+ "contentModeration": {+ "type": "object",+ "properties": {+ "publicFigureThreshold": {+ "type": "string",+ "enum": [+ "auto",+ "low"+ ]+ }+ },+ "additionalProperties": false+ },+ "model": {+ "type": "string",+ "const": "gen4_image"+ }+ },+ "required": [+ "promptText",+ "ratio",+ "model"+ ]+ },+ {+ "type": "object",+ "properties": {+ "promptText": {+ "type": "string",+ "minLength": 1,+ "maxLength": 32000+ },+ "ratio": {+ "type": "string",+ "enum": [+ "2048:880",+ "1920:1088",+ "1920:1280",+ "1920:1440",+ "1920:1536",+ "1920:1920",+ "1536:1920",+ "1440:1920",+ "1280:1920",+ "1088:1920",+ "2912:1248",+ "2560:1440",+ "2560:1712",+ "2560:1920",+ "2560:2048",+ "2560:2560",+ "2048:2560",+ "1920:2560",+ "1712:2560",+ "1440:2560",+ "3840:1648",+ "3840:2160",+ "3504:2336",+ "3264:2448",+ "3200:2560",+ "2880:2880",+ "2560:3200",+ "2448:3264",+ "2336:3504",+ "2160:3840",+ "auto"+ ]+ },+ "quality": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high",+ "auto"+ ]+ },+ "background": {+ "type": "string",+ "enum": [+ "transparent",+ "opaque",+ "auto"+ ]+ },+ "referenceImages": {+ "maxItems": 16,+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "uri": {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ "tag": {+ "type": "string",+ "minLength": 3,+ "maxLength": 16,+ "pattern": "^[a-z][a-z0-9_]+$"+ }+ },+ "required": [+ "uri"+ ],+ "additionalProperties": false+ }+ },+ "outputCount": {+ "type": "integer",+ "minimum": 1,+ "maximum": 10+ },+ "model": {+ "type": "string",+ "const": "gpt_image_2"+ }+ },+ "required": [+ "promptText",+ "ratio",+ "model"+ ],+ "additionalProperties": false+ }+ ]+ }+ }+ }+ }+ }+ },+ "/v1/image_to_video": {+ "post": {+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "oneOf": [+ {+ "type": "object",+ "properties": {+ "promptText": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "promptImage": {+ "anyOf": [+ {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ {+ "minItems": 1,+ "maxItems": 1,+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "uri": {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ "position": {+ "type": "string",+ "const": "first"+ }+ },+ "required": [+ "uri",+ "position"+ ],+ "additionalProperties": false+ }+ }+ ]+ },+ "seed": {+ "type": "integer",+ "minimum": 0,+ "maximum": 4294967295+ },+ "ratio": {+ "type": "string",+ "enum": [+ "1280:720",+ "720:1280",+ "1104:832",+ "960:960",+ "832:1104",+ "1584:672"+ ]+ },+ "duration": {+ "type": "integer",+ "minimum": 2,+ "maximum": 10+ },+ "contentModeration": {+ "type": "object",+ "properties": {+ "publicFigureThreshold": {+ "type": "string",+ "enum": [+ "auto",+ "low"+ ]+ }+ },+ "additionalProperties": false+ },+ "outputFormat": {+ "type": "string",+ "enum": [+ "mp4",+ "prores",+ "png_sequence",+ "hdr10",+ "hlg",+ "sdr_rec709_10bit",+ "hdr_pq_12bit_master",+ "hdr_prores",+ "hdr_png_sequence",+ "hdr_exr_sequence",+ "hdr_exr_acescg_sequence_1_3",+ "hdr_exr_acescg_sequence_2_0"+ ]+ },+ "proresProfile": {+ "type": "string",+ "enum": [+ "422",+ "4444",+ "422 Proxy",+ "422 LT",+ "422 HQ",+ "4444 XQ"+ ]+ },+ "model": {+ "type": "string",+ "const": "gen4.5"+ }+ },+ "required": [+ "promptText",+ "promptImage",+ "ratio",+ "duration",+ "model"+ ]+ },+ {+ "type": "object",+ "properties": {+ "promptText": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "promptImage": {+ "anyOf": [+ {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ {+ "minItems": 1,+ "maxItems": 1,+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "uri": {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ "position": {+ "type": "string",+ "const": "first"+ }+ },+ "required": [+ "uri",+ "position"+ ],+ "additionalProperties": false+ }+ }+ ]+ },+ "seed": {+ "type": "integer",+ "minimum": 0,+ "maximum": 4294967295+ },+ "ratio": {+ "type": "string",+ "enum": [+ "1280:720",+ "720:1280",+ "1104:832",+ "832:1104",+ "960:960",+ "1584:672"+ ]+ },+ "duration": {+ "type": "integer",+ "minimum": 2,+ "maximum": 10+ },+ "contentModeration": {+ "type": "object",+ "properties": {+ "publicFigureThreshold": {+ "type": "string",+ "enum": [+ "auto",+ "low"+ ]+ }+ },+ "additionalProperties": false+ },+ "model": {+ "type": "string",+ "const": "gen4_turbo"+ }+ },+ "required": [+ "promptImage",+ "ratio",+ "model"+ ]+ },+ {+ "type": "object",+ "properties": {+ "promptText": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "promptImage": {+ "anyOf": [+ {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ {+ "minItems": 1,+ "maxItems": 2,+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "uri": {+ "anyOf": [+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 2048,+ "pattern": "^https:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5000,+ "pattern": "^runway:\\/\\/.*"+ },+ {+ "type": "string",+ "minLength": 13,+ "maxLength": 5242880,+ "pattern": "^data:image\\/.*"+ }+ ]+ },+ "position": {+ "type": "string",+ "enum": [+ "first",+ "last"+ ]+ }+ },+ "required": [+ "uri",+ "position"+ ],+ "additionalProperties": false+ }+ }+ ]+ },+ "ratio": {+ "type": "string",+ "enum": [+ "1280:720",+ "720:1280",+ "1080:1920",+ "1920:1080"+ ]+ },+ "audio": {+ "default": true,+ "type": "boolean"+ },+ "negativePrompt": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "seed": {+ "type": "integer",+ "minimum": 0,+ "maximum": 4294967295+ },+ "duration": {+ "type": "number",+ "enum": [+ 4,+ 6,+ 8+ ]+ },+ "model": {+ "type": "string",+ "const": "veo3.1"+ }+ },+ "required": [+ "promptImage",+ "ratio",+ "model"+ ],+ "additionalProperties": false+ }+ ]+ }+ }+ }+ }+ }+ },+ "/v1/text_to_video": {+ "post": {+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "oneOf": [+ {+ "type": "object",+ "properties": {+ "promptText": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "ratio": {+ "type": "string",+ "enum": [+ "1280:720",+ "720:1280"+ ]+ },+ "duration": {+ "type": "integer",+ "minimum": 2,+ "maximum": 10+ },+ "seed": {+ "type": "integer",+ "minimum": 0,+ "maximum": 4294967295+ },+ "contentModeration": {+ "type": "object",+ "properties": {+ "publicFigureThreshold": {+ "type": "string",+ "enum": [+ "auto",+ "low"+ ]+ }+ },+ "additionalProperties": false+ },+ "outputFormat": {+ "type": "string",+ "enum": [+ "mp4",+ "prores",+ "png_sequence",+ "hdr10",+ "hlg",+ "sdr_rec709_10bit",+ "hdr_pq_12bit_master",+ "hdr_prores",+ "hdr_png_sequence",+ "hdr_exr_sequence",+ "hdr_exr_acescg_sequence_1_3",+ "hdr_exr_acescg_sequence_2_0"+ ]+ },+ "proresProfile": {+ "type": "string",+ "enum": [+ "422",+ "4444",+ "422 Proxy",+ "422 LT",+ "422 HQ",+ "4444 XQ"+ ]+ },+ "model": {+ "type": "string",+ "const": "gen4.5"+ }+ },+ "required": [+ "promptText",+ "ratio",+ "duration",+ "model"+ ]+ },+ {+ "type": "object",+ "properties": {+ "promptText": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "ratio": {+ "type": "string",+ "enum": [+ "1280:720",+ "720:1280",+ "1080:1920",+ "1920:1080"+ ]+ },+ "audio": {+ "default": true,+ "type": "boolean"+ },+ "negativePrompt": {+ "type": "string",+ "minLength": 1,+ "maxLength": 1000+ },+ "seed": {+ "type": "integer",+ "minimum": 0,+ "maximum": 4294967295+ },+ "duration": {+ "type": "number",+ "enum": [+ 4,+ 6,+ 8+ ]+ },+ "model": {+ "type": "string",+ "const": "veo3.1"+ }+ },+ "required": [+ "promptText",+ "ratio",+ "model"+ ],+ "additionalProperties": false+ }+ ]+ }+ }+ }+ }+ }+ }+ }+}\ No newline at end of filediff --git a/server/services/imageGen/cloudProviderConfig.js b/server/services/imageGen/cloudProviderConfig.jsindex db00a5b865..3d66cfc842 100644--- a/server/services/imageGen/cloudProviderConfig.js+++ b/server/services/imageGen/cloudProviderConfig.js@@ -133,7 +133,10 @@ export const CLOUD_PROVIDER_SPECS = Object.freeze({label: 'Runway Imagegen', errorCode: 'RUNWAY_IMAGEGEN_DISABLED',knownModels: RUNWAY_IMAGE_MODEL_IDS, unknownModelCode: 'RUNWAY_IMAGE_MODEL_UNKNOWN',modelId: (c, override) => override || (getRunwayImageModel(c.model) ? c.model : RUNWAY_IMAGE_DEFAULT_MODEL),- params: (c, override) => ({ model: override || (getRunwayImageModel(c.model) ? c.model : RUNWAY_IMAGE_DEFAULT_MODEL), resolution: c.resolution || '720p' }),+ params: (c, override) => {+ const model = getRunwayImageModel(override || c.model) || getRunwayImageModel(RUNWAY_IMAGE_DEFAULT_MODEL);+ return { model: override || model.id, resolution: model.ratios[c.resolution] ? c.resolution : model.defaultResolution };+ },}),[IMAGE_GEN_MODE.FAL]: Object.freeze({...IMAGE_GEN_PROVIDER_CAPABILITIES[IMAGE_GEN_MODE.FAL],diff --git a/server/services/imageGen/prepareParams.js b/server/services/imageGen/prepareParams.jsindex d66312c0d2..bd06bc3c95 100644--- a/server/services/imageGen/prepareParams.js+++ b/server/services/imageGen/prepareParams.js@@ -262,7 +262,8 @@ export async function prepareGenerateParams({ data, files, referenceImageFields,// Freeze the selected preference before capability checks. Explicit ids stay// untouched so the existing unknown/hardware rejection still applies.if (!data.modelId && localModel?.id) data.modelId = localModel.id;- const referenceCap = localModel?.pipelineClass === 'QwenImage21Pipeline' ? 10 : 4;+ const selectedCloudModel = mode === IMAGE_GEN_MODE.RUNWAY ? data.cloudModel || resolveCloudProviderConfig(settings, mode)?.modelId : null;+ const referenceCap = mode === IMAGE_GEN_MODE.RUNWAY ? maxInputImages(mode, selectedCloudModel) : localModel?.pipelineClass === 'QwenImage21Pipeline' ? 10 : 4;if (referenceImageCount > referenceCap) {cleanupReqFilesTemp();throw new ServerError(@@ -336,7 +337,7 @@ export async function prepareGenerateParams({ data, files, referenceImageFields,// so this only fires for direct API callers — but a silent drop is exactly// the failure the sidecar-honesty rule exists to prevent. `resolveInputImages`// keeps its own cap as the backstop for in-process callers that skip the route.- const inputImageCap = localModel?.pipelineClass === 'QwenImage21Pipeline' ? 10 : maxInputImages(mode);+ const inputImageCap = localModel?.pipelineClass === 'QwenImage21Pipeline' ? 10 : maxInputImages(mode, selectedCloudModel);if (inputImageCap != null && inputImageCount > inputImageCap) {cleanupReqFilesTemp();throw new ServerError(diff --git a/server/services/imageGen/promptPreview.js b/server/services/imageGen/promptPreview.jsindex 2cc8d3df3d..ba17bdceeb 100644--- a/server/services/imageGen/promptPreview.js+++ b/server/services/imageGen/promptPreview.js@@ -70,7 +70,7 @@ export async function previewImagePrompt({ uploadedInitImage = false, uploadedRereturn { mode, ...agySentPrompt({ ...common, stagingPath: jobOutputPath('portos-agy'), inputImages: previewInputImages(mode, params) }).record };}if (mode === IMAGE_GEN_MODE.RUNWAY) {- return { mode, ...runwayImageSentPrompt({ ...common, inputImages: previewInputImages(mode, params), visualConditioning: params.visualConditioning }).record };+ return { mode, ...runwayImageSentPrompt({ ...common, modelId: cloud?.providerParams.model, inputImages: previewInputImages(mode, params, cloud?.providerParams.model), visualConditioning: params.visualConditioning }).record };}if (mode === IMAGE_GEN_MODE.FAL) {const family = falImageFamily(cloud?.providerParams.model || FAL_IMAGE_DEFAULT_MODEL) || falImageFamily(FAL_IMAGE_DEFAULT_MODEL);diff --git a/server/services/imageGen/runway.js b/server/services/imageGen/runway.jsindex 3b23bcdba8..8cba7e7545 100644--- a/server/services/imageGen/runway.js+++ b/server/services/imageGen/runway.js@@ -74,18 +74,18 @@ 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, modelId = RUNWAY_IMAGE_DEFAULT_MODEL, promptAdditions = [] }) {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 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 `${getRunwayImageModel(modelId)?.referenceTags ? `@${ref.tag}` : `Image ${index + 1}`}: ${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', 'Runway reference image roles', 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 }) };}@@ -103,7 +103,7 @@ export const generateImage = (params) => preparations.run(params, generateImagePasync function generateImagePrepared({promptAdditions = [],- model, resolution = '720p', ratio, prompt = '', negativePrompt, width, height, seed,+ model, resolution, ratio, prompt = '', negativePrompt, width, height, seed,initImagePath, initImageStrength, referenceImagePaths = [],visualConditioning = null,jobId: providedJobId = null,@@ -135,8 +135,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, modelId: family.id, promptAdditions });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.`,@@ -168,7 +168,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 +182,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 +192,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({ uri: await encodeInputImage(ref.path), ...(family.referenceTags ? { 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.@@ -248,7 +248,7 @@ async function runRunway(job, jobId, {job.status = 'complete';if (activeRequests.get(jobId) === entry) activeRequests.delete(jobId);activeJobs.delete(jobId);- console.log(`✅ Image generated [${jobId.slice(0, 8)}]: ${filename} (Runway ${request.body.model}, ~$${request.estimatedCostUsd})`);+ console.log(`✅ Image generated [${jobId.slice(0, 8)}]: ${filename} (Runway ${request.body.model}, ${request.estimatedCostUsd == null ? 'price varies' : `~$${request.estimatedCostUsd}`})`);const done = { filename, path: `/data/images/${filename}` };dispatchTerminalEvent(jobId,diff --git a/server/services/imageGen/runway.test.js b/server/services/imageGen/runway.test.jsindex 7e6436f383..3351e1e86d 100644--- a/server/services/imageGen/runway.test.js+++ b/server/services/imageGen/runway.test.js@@ -78,6 +78,18 @@ describe('Runway image workflow', () => {expect(sidecar.referenceTags.map((r) => r.filename)).toEqual(['hero.png', 'rival.png']);expect(JSON.stringify(sidecar)).not.toContain(root);});+ it('renders an unseeded third-party model with more than three untagged references', async () => {+ const paths = Array.from({ length: 5 }, (_, i) => join(PATHS.images, `reference-${i}.png`));+ await Promise.all(paths.map((path) => writeFile(path, output)));+ const job = await runway.generateImage({ prompt: 'A cast in a garden', model: 'muse_image', seed: 42, referenceImagePaths: paths });+ expect(await terminal(job.jobId)).toMatchObject({ type: 'completed' });+ expect(calls[0].body).toMatchObject({ model: 'muse_image', ratio: '1600:1600' });+ expect(calls[0].body).not.toHaveProperty('seed');+ expect(calls[0].body.referenceImages).toHaveLength(5);+ expect(calls[0].body.referenceImages.every((ref) => Object.keys(ref).join() === 'uri')).toBe(true);+ expect(calls[0].body.promptText).toContain('Image 5: visual reference');+ expect(calls[0].body.promptText).not.toContain('@ref_');+ });it('reports the supplied and added prompt lengths before spending instead of silently cutting text', async () => {await expect(runway.generateImage({ prompt: 'x'.repeat(990), negativePrompt: 'a long negative' })).rejects.toMatchObject({status: 400, code: 'RUNWAY_IMAGE_PROMPT_TOO_LONG',diff --git a/server/services/runwayApi.js b/server/services/runwayApi.jsindex e27e765092..0df950bfe7 100644--- a/server/services/runwayApi.js+++ b/server/services/runwayApi.js@@ -1,3 +1,4 @@+import { assertRunwayCatalogModel } from './runwayModelCatalog.js';/*** Runway developer API — the shared task transport for image and video backends.*@@ -80,6 +81,7 @@ export async function cancelRunwayTask(entry) {/** Submit one paid generation to a generation endpoint. Resolves to the task id. */export async function submitRunwayTask({ apiKey, endpoint, body }) {+ assertRunwayCatalogModel(endpoint, body.model);const res = await fetchWithTimeout(`${RUNWAY_API_BASE}/v1/${endpoint}`, {method: 'POST', headers: headers(apiKey, true), body: JSON.stringify(body),}, RUNWAY_SUBMIT_TIMEOUT_MS).catch((err) => {diff --git a/server/services/runwayModelCatalog.js b/server/services/runwayModelCatalog.jsnew file mode 100644index 0000000000..342669923f--- /dev/null+++ b/server/services/runwayModelCatalog.js@@ -0,0 +1,139 @@+import { readFile, mkdir, writeFile, rename } from 'node:fs/promises';+import { dirname, join } from 'node:path';+import { createHash } from 'node:crypto';+import { PATHS } from '../lib/paths.js';+import { fetchWithTimeout } from '../lib/fetchWithTimeout.js';+import { RUNWAY_CATALOG_SNAPSHOT } from '../lib/runwayCatalogSnapshot.js';++export const RUNWAY_CATALOG_SOURCE = 'https://docs.dev.runwayml.com/openapi.json';+const TTL = 24 * 60 * 60 * 1000;+const RETRY = 5 * 60 * 1000;+// A new shipped snapshot invalidates even a fresh disk cache from an older install.+const VERSION = createHash('sha256').update(JSON.stringify(RUNWAY_CATALOG_SNAPSHOT)).digest('hex');+const fallback = Object.fromEntries(Object.entries(RUNWAY_CATALOG_SNAPSHOT).map(([endpoint, rows]) => [endpoint, rows.map(({ id }) => id)]));+const limitations = [+ { id: 'aleph2', reason: 'Requires video-to-video editing inputs; not supported by these text/image forms.' },+ { id: 'act_two', reason: 'Requires character and reference performance inputs; not supported by these forms.' },+];++function compatibleSchema(row, expected) {+ const p = row.properties;+ const required = row.required || [];+ const allowed = ['model', 'promptText', 'ratio', 'duration', 'promptImage', 'referenceImages'];+ if (required.some((key) => !allowed.includes(key))) return false;+ const d = p.duration?.anyOf?.find((v) => ['integer', 'number'].includes(v.type)) || p.duration || {};+ const ratios = p.ratio?.enum || p.ratio?.anyOf?.find((v) => v.enum)?.enum || [];+ const imageArray = p.promptImage?.anyOf?.find((v) => v.type === 'array');+ const endImage = (imageArray?.items?.properties?.position?.enum || []).includes('last');+ const sameValues = (a, b) => JSON.stringify([...a].sort()) === JSON.stringify([...b].sort());+ return endImage === expected.endImage+ && ('tag' in (p.referenceImages?.items?.properties || {})) === expected.referenceTags+ && required.includes('referenceImages') === (expected.minReferences > 0)+ && p.promptText?.maxLength === expected.promptMax && p.promptText?.minLength === expected.promptMin+ && required.includes('promptText') === expected.promptRequired+ && required.includes('ratio') === expected.ratioRequired+ && sameValues(ratios, expected.ratios)+ && sameValues((p.resolution?.enum || []).map((r) => r.toLowerCase()).filter((r, i, all) => all.indexOf(r) === i), expected.resolutions)+ && (p.seed?.maximum ?? null) === expected.seedMax+ && (p.negativePrompt?.maxLength || 0) === expected.negativePromptMax+ && ('seed' in p) === expected.seed && ('audio' in p) === expected.audio+ && (p.referenceImages?.minItems || 0) === expected.minReferences+ && (p.referenceImages?.maxItems || 0) === expected.maxReferences+ && d.minimum === expected.duration.minimum && d.maximum === expected.duration.maximum+ && sameValues(d.enum || [], expected.duration.enum || []);+}++function parseCatalog(spec) {+ if (spec?.info?.version !== '2024-11-06') throw new Error('Unsupported Runway API schema version');+ const available = {};+ const unsupported = [...limitations];+ for (const endpoint of Object.keys(fallback)) {+ const rows = spec.paths?.[`/v1/${endpoint}`]?.post?.requestBody?.content?.['application/json']?.schema?.oneOf;+ if (!Array.isArray(rows)) throw new Error(`Missing Runway ${endpoint} schema`);+ const ids = rows.map((row) => row?.properties?.model?.const);+ if (ids.some((id) => typeof id !== 'string' || !id || id.length > 100)) throw new Error('Invalid Runway model identifiers');+ available[endpoint] = [];+ for (const row of rows) {+ const id = row.properties.model.const;+ const known = RUNWAY_CATALOG_SNAPSHOT[endpoint].find((item) => item.id === id);+ if (known && compatibleSchema(row, known)) available[endpoint].push(id);+ else unsupported.push({ id, reason: `${endpoint}: requires a PortOS capability update` });+ }+ available[endpoint] = [...new Set(available[endpoint])];+ }+ return { available, unsupported };+}++/** Public documentation, never an invented /models API or an authenticated generation probe.+ * One bounded, machine-local disposable cache; no user data, credentials or federation.+ */+export function createRunwayModelCatalog({+ fetchSchema = () => fetchWithTimeout(RUNWAY_CATALOG_SOURCE, {}, 15_000),+ cachePath = join(PATHS.installRoot, '.cache', 'runway-model-catalog.json'), now = Date.now,+} = {}) {+ let cached = null;+ let loaded = false;+ let pending = null;+ let pendingForced = false;+ let retryAt = 0;+ let error = null;+ const present = () => ({+ ...(cached?.catalog || { available: fallback, unsupported: limitations }),+ source: RUNWAY_CATALOG_SOURCE, fetchedAt: cached?.fetchedAt ?? null,+ stale: !cached || now() - cached.fetchedAt >= TTL || !!error,+ bundled: !cached, error,+ });+ async function read() {+ if (loaded) return;+ loaded = true;+ const disk = await readFile(cachePath, 'utf8').then(JSON.parse).catch(() => null);+ if (disk?.version === VERSION && Number.isFinite(disk.fetchedAt) && disk.fetchedAt <= now()+ && Object.keys(fallback).every((key) => Array.isArray(disk.catalog?.available?.[key])+ && disk.catalog.available[key].every((id) => fallback[key].includes(id)))+ && Array.isArray(disk.catalog?.unsupported) && disk.catalog.unsupported.every((row) => typeof row?.id === 'string' && typeof row?.reason === 'string')) cached = disk;+ }+ async function refresh() {+ try {+ const res = await fetchSchema();+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ const catalog = parseCatalog(await res.json());+ cached = { version: VERSION, fetchedAt: now(), catalog };+ error = null;+ retryAt = 0;+ // A disk failure must not throw away a valid in-memory catalog.+ await mkdir(dirname(cachePath), { recursive: true });+ await writeFile(`${cachePath}.tmp`, JSON.stringify(cached));+ await rename(`${cachePath}.tmp`, cachePath);+ } catch (err) {+ error = `Runway catalog refresh unavailable: ${err.message}`;+ retryAt = now() + RETRY;+ }+ return present();+ }+ return {+ current: present,+ async get({ refresh: force = false } = {}) {+ if (pending) {+ if (force && !pendingForced) return pending.then(() => this.get({ refresh: true }));+ return pending;+ }+ pendingForced = force;+ pending = (async () => {+ await read();+ if (!force && (now() < retryAt || (cached && now() - cached.fetchedAt < TTL))) return present();+ return refresh();+ })().finally(() => { pending = null; });+ return pending;+ },+ };+}+const catalog = createRunwayModelCatalog();+export const getRunwayModelCatalog = (options) => catalog.get(options);++/** Refreshed removals/schema changes fail before a paid submission. No catalog lookup per render. */+export function assertRunwayCatalogModel(endpoint, modelId) {+ const current = catalog.current();+ if (current.available[endpoint] && !current.available[endpoint].includes(modelId)) {+ throw Object.assign(new Error(`Runway ${modelId} is unavailable for ${endpoint}; refresh the model catalog or choose another model`), { status: 400, code: 'RUNWAY_MODEL_UNAVAILABLE' });+ }+}diff --git a/server/services/runwayModelCatalog.test.js b/server/services/runwayModelCatalog.test.jsnew file mode 100644index 0000000000..7690312e06--- /dev/null+++ b/server/services/runwayModelCatalog.test.js@@ -0,0 +1,87 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';+import { join } from 'node:path';+import { tmpdir } from 'node:os';+import { createRunwayModelCatalog } from './runwayModelCatalog.js';++// Real public OpenAPI excerpts (2026-10-22), descriptions removed; no generation endpoint is called.+const fixture = JSON.parse(await readFile(new URL('./fixtures/runwayOpenApi.json', import.meta.url), 'utf8'));+const directories = [];+afterEach(async () => { await Promise.all(directories.splice(0).map((dir) => rm(dir, { recursive: true, force: true }))); });+async function setup() {+ const root = await mkdtemp(join(tmpdir(), 'runway-catalog-'));+ directories.push(root);+ const cachePath = join(root, 'catalog.json');+ let time = 1_000_000;+ const fetchSchema = vi.fn(async () => ({ ok: true, json: async () => structuredClone(fixture) }));+ const options = { cachePath, fetchSchema, now: () => time };+ return { cache: createRunwayModelCatalog(options), options, fetchSchema, advance: (ms) => { time += ms; } };+}+describe('Runway public catalog cache', () => {+ it('coalesces form loads, survives restart, expires and honors explicit refresh/removals', async () => {+ const { cache, options, fetchSchema, advance } = await setup();+ const [first, concurrent] = await Promise.all([cache.get(), cache.get()]);+ expect(first).toEqual(concurrent);+ expect(first.available.text_to_image).toEqual(['gen4_image', 'gpt_image_2']);+ expect(first.available.text_to_video).not.toContain('gen4_turbo');+ expect(fetchSchema).toHaveBeenCalledTimes(1);+ await cache.get();+ await createRunwayModelCatalog(options).get();+ expect(fetchSchema).toHaveBeenCalledTimes(1);+ advance(24 * 60 * 60 * 1000);+ await cache.get();+ expect(fetchSchema).toHaveBeenCalledTimes(2);+ const removed = structuredClone(fixture);+ removed.paths['/v1/text_to_image'].post.requestBody.content['application/json'].schema.oneOf = [];+ fetchSchema.mockResolvedValue({ ok: true, json: async () => removed });+ const refreshed = await cache.get({ refresh: true });+ expect(refreshed.available.text_to_image).toEqual([]); // valid empty is not fallback+ expect(refreshed.stale).toBe(false);+ await cache.get();+ expect(fetchSchema).toHaveBeenCalledTimes(3);+ });+ it('keeps last good data on timeout, malformed schema and HTTP failure, backing off repeated forms', async () => {+ const { cache, fetchSchema, advance } = await setup();+ const good = await cache.get();+ fetchSchema.mockRejectedValue(new Error('timeout'));+ advance(24 * 60 * 60 * 1000);+ const stale = await cache.get();+ expect(stale).toMatchObject({ available: good.available, stale: true, error: expect.stringContaining('timeout') });+ await cache.get();+ expect(fetchSchema).toHaveBeenCalledTimes(2);+ fetchSchema.mockResolvedValue({ ok: true, json: async () => ({}) });+ expect((await cache.get({ refresh: true })).available).toEqual(good.available);+ fetchSchema.mockResolvedValue({ ok: false, status: 403 });+ expect((await cache.get({ refresh: true })).available).toEqual(good.available);+ });+ it('falls back on cold failure/corrupt disk and invalidates an old snapshot version', async () => {+ const { cache, options, fetchSchema } = await setup();+ await writeFile(options.cachePath, 'broken');+ fetchSchema.mockRejectedValue(new Error('offline'));+ expect(await cache.get()).toMatchObject({ bundled: true, stale: true });+ await cache.get();+ expect(fetchSchema).toHaveBeenCalledTimes(1);+ await writeFile(options.cachePath, JSON.stringify({ version: 'old', fetchedAt: 1_000_000, catalog: { available: {} } }));+ fetchSchema.mockResolvedValue({ ok: true, json: async () => fixture });+ expect(await createRunwayModelCatalog(options).get()).toMatchObject({ bundled: false, stale: false });+ });+ it('does not claim unknown or changed request schemas are runnable and preserves forced refresh during disk load', async () => {+ const { cache, options, fetchSchema } = await setup();+ await cache.get();+ const changed = structuredClone(fixture);+ const rows = changed.paths['/v1/text_to_image'].post.requestBody.content['application/json'].schema.oneOf;+ delete rows[0].properties.referenceImages.items.properties.tag;+ rows.push({ properties: { model: { const: 'future_image' } } });+ fetchSchema.mockResolvedValue({ ok: true, json: async () => changed });+ const restarted = createRunwayModelCatalog(options);+ const load = restarted.get();+ const forced = restarted.get({ refresh: true });+ const forcedAgain = restarted.get({ refresh: true });+ await load;+ const updated = await forced;+ expect(await forcedAgain).toEqual(updated);+ expect(fetchSchema).toHaveBeenCalledTimes(2);+ expect(updated.available.text_to_image).toEqual(['gpt_image_2']);+ expect(updated.unsupported.map((r) => r.id)).toEqual(expect.arrayContaining(['gen4_image', 'future_image', 'aleph2', 'act_two']));+ });+});