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
feat: configure local image and video model defaults
[._.]/ Adam Eivyed67a4c49bdd
diff --git a/client/src/components/settings/ImageGenTab.jsx b/client/src/components/settings/ImageGenTab.jsxindex cbfc52fac4..bb213d6d56 100644--- a/client/src/components/settings/ImageGenTab.jsx+++ b/client/src/components/settings/ImageGenTab.jsx@@ -23,7 +23,7 @@ import { isLoopbackHost } from '../../lib/loopbackHost.js';import { PORTS } from '../../lib/ports.js';import { getNavPageForPath } from '../../../../server/lib/navManifest.js';import {- getSettings, updateSettings, getImageGenStatus, generateImage,+ getSettings, updateSettings, getImageGenStatus, getVideoGenModelContext, generateImage,registerTool, updateTool, getToolsList,saveHfToken, clearHfToken,} from '../../services/api';@@ -129,11 +129,8 @@ export function ImageGenTab() {const [pythonPath, setPythonPath] = useState('');// Install-wide default local image model (`settings.imageGen.local.modelId`).// '' = no pin, which the server resolves to LOCAL_IMAGEGEN_DEFAULT_MODEL.- // Every SERVER-side local-render caller reads this key (deckRender, sprite- // references, the pipeline visual stages, character sheets, FableLoom, and- // now selectLocalImageModel itself); until now it was only reachable by- // hand-editing settings.json. Client-side defaults in lib/pipelineImageDefaults- // and lib/wrImageDefaults still hardcode their own model and do not consult it.+ // Server render callers and client forms use this pin unless a surface has+ // a saved model choice of its own.const [localModelId, setLocalModelId] = useState('');// Catalog for the picker, probed once the Local tab is mounted — the same// "don't probe a tab nobody looked at" rule as the Agy list below.@@ -141,6 +138,18 @@ export function ImageGenTab() {// default this machine's runner refuses is a render error waiting to happen,// and `checkLocalConnection` already reports it as unavailable.const { models: localModels } = useLocalImageModels(localMounted);+ const [videoModelContext, setVideoModelContext] = useState(null);+ const [videoModelContextFailed, setVideoModelContextFailed] = useState(false);+ const [localVideoModelId, setLocalVideoModelId] = useState('');+ useEffect(() => {+ if (!localMounted) return undefined;+ let active = true;+ setVideoModelContextFailed(false);+ getVideoGenModelContext({ silent: true })+ .then((context) => { if (active) setVideoModelContext(context); })+ .catch(() => { if (active) setVideoModelContextFailed(true); });+ return () => { active = false; };+ }, [localMounted]);const [exposeA1111, setExposeA1111] = useState(false);// Codex CLI provider config — gated by `codexEnabled` so users without// a paid Codex plan that includes image_gen can hide the option entirely.@@ -209,6 +218,7 @@ export function ImageGenTab() {denoiseByMode: { external: false, local: false, codex: false, grok: false, agy: false },renderDefaultsJson: '{}',videoGenMode: '',+ localVideoModelId: '',videoGenDisplaySleep: false,falApiKey: '',reactorApiKey: '',@@ -283,6 +293,7 @@ export function ImageGenTab() {// ('auto'/blank → '', i.e. no pin) for the select.const vg = (s?.videoGen && typeof s.videoGen === 'object') ? s.videoGen : {};const vgMode = normalizeRenderPinValue(vg.mode) || '';+ const vgModelId = vg.defaultModelId || '';const vgDisplaySleep = vg.displaySleep === true;const vgFalApiKey = vg.fal?.apiKey || '';const vgReactorApiKey = vg.reactor?.apiKey || '';@@ -321,6 +332,7 @@ export function ImageGenTab() {setMode(m);setRenderDefaults(rd);setVideoGenMode(vgMode);+ setLocalVideoModelId(vgModelId);setVideoGenDisplaySleep(vgDisplaySleep);setFalApiKey(vgFalApiKey);setReactorApiKey(vgReactorApiKey);@@ -353,6 +365,7 @@ export function ImageGenTab() {cleanC2PAByMode: c2, denoiseByMode: dn,renderDefaultsJson: JSON.stringify(rd),videoGenMode: vgMode,+ localVideoModelId: vgModelId,videoGenDisplaySleep: vgDisplaySleep,falApiKey: vgFalApiKey,reactorApiKey: vgReactorApiKey,@@ -374,6 +387,16 @@ export function ImageGenTab() {const { options: localModelOptions, fallbackLabel: localDefaultLabel } = localModelSelectOptions(localModels, localModelId,);+ const localVideoModels = videoModelContext?.models ?? null;+ const localVideoModelOptions = localVideoModels === null ? [] : (+ localVideoModelId && !localVideoModels.some((model) => model.id === localVideoModelId)+ ? [{ id: localVideoModelId, name: `${localVideoModelId} (unavailable on this machine)` }, ...localVideoModels]+ : localVideoModels+ );+ const localVideoDefaultId = videoModelContext?.defaultModel || '';+ const localVideoDefaultLabel = localVideoModels?.length === 0+ ? 'no compatible local model'+ : localVideoModels?.find((model) => model.id === localVideoDefaultId)?.name || localVideoDefaultId || 'no compatible local model';// Probe only while the Agy tab is actually open — the list spawns `agy models`// server-side, so an unopened tab must not pay for a child process.@@ -468,6 +491,7 @@ export function ImageGenTab() {|| denoiseByMode.external !== saved.denoiseByMode.external|| JSON.stringify(renderDefaults) !== saved.renderDefaultsJson|| videoGenMode !== saved.videoGenMode+ || localVideoModelId !== saved.localVideoModelId|| videoGenDisplaySleep !== saved.videoGenDisplaySleep|| falApiKey !== saved.falApiKey|| reactorApiKey !== saved.reactorApiKey;@@ -528,6 +552,7 @@ export function ImageGenTab() {videoGen: {...videoGenSliceRef.current,mode: videoGenMode || null,+ defaultModelId: localVideoModelId || null,displaySleep: videoGenDisplaySleep,fal: { ...videoGenSliceRef.current.fal, apiKey: falApiKey.trim() || undefined },reactor: { ...videoGenSliceRef.current.reactor, apiKey: reactorApiKey.trim() || undefined },@@ -548,6 +573,7 @@ export function ImageGenTab() {cleanC2PAByMode, denoiseByMode,renderDefaultsJson: JSON.stringify(patch.renderDefaults),videoGenMode,+ localVideoModelId,videoGenDisplaySleep,falApiKey: falApiKey.trim(),reactorApiKey: reactorApiKey.trim(),@@ -737,7 +763,7 @@ export function ImageGenTab() {</div><p className="text-xs text-gray-500">PortOS can either talk to a remote AUTOMATIC1111 / Forge server or run image- generation locally with mflux on this Mac. Pick whichever fits — you can also+ generation with local Python runtimes, including mflux and diffusers. You can alsoexpose this PortOS as an A1111-compatible endpoint for other tailnet boxes.</p><div className={`grid grid-cols-1 sm:grid-cols-2 ${(codexEnabled || grokEnabled || agyEnabled) ? 'lg:grid-cols-3' : ''} gap-3`}>@@ -761,7 +787,7 @@ export function ImageGenTab() {<Cpu className="w-4 h-4" /><span className="font-medium text-sm">Local (mflux)</span></div>- <p className="text-xs text-gray-500 mt-1">Run Flux + LTX models on this machine. Apple Silicon recommended.</p>+ <p className="text-xs text-gray-500 mt-1">Run image and video models on this machine. Apple Silicon enables MLX models such as FastMetal.</p></button>{codexEnabled && (<button@@ -820,9 +846,9 @@ export function ImageGenTab() {backend that is disabled (or unconfigured) falls back to whatever that surface wouldhave used anyway — enable the backend on its own tab to make a pin take effect. Amodel can be pinned for backends that accept one (Codex, Agy); Grok and Local pick- their models elsewhere. Surfaces that also render video get a video backend pin —- backend only, since Grok video has no model choice and local video models are picked- on the surface itself.+ their models elsewhere. Surfaces that also render video get a video backend pin.+ The default local video model is set on the Local tab, and a render's explicit model+ choice takes precedence.</p><div className="grid grid-cols-1 sm:grid-cols-[1fr_auto] gap-2 sm:items-center border border-port-border rounded-lg px-3 py-2 bg-port-bg/40"><FormField@@ -983,9 +1009,9 @@ export function ImageGenTab() {{localMounted && (<div className={`bg-port-card border border-port-border rounded-xl p-6 space-y-4 ${mediaTab === 'local' ? '' : 'hidden'}`}>- <h3 className="text-sm font-medium text-gray-300">Local Python (mflux + mlx_video)</h3>+ <h3 className="text-sm font-medium text-gray-300">Local runtimes (image + video)</h3><p className="text-xs text-gray-500">- Pick a Python 3.10+ interpreter — PortOS auto-detects venvs and conda installs and can install+ Pick a Python 3.10+ interpreter — PortOS auto-detects the configured local runtimes and can installmissing packages directly. HF model weights stream into the standard <code>~/.cache/huggingface</code>and are surfaced in <a href="/models/media" className="text-port-accent hover:underline">{getNavPageForPath('/models/media')?.breadcrumb || 'its management page'}</a>.</p>@@ -1037,6 +1063,44 @@ export function ImageGenTab() {No local image models are compatible with this machine.</p>)}+ <div className="border-t border-port-border pt-4 space-y-3">+ <h3 className="text-sm font-medium text-gray-300">Local video model</h3>+ <FormField+ label="Default local video model"+ labelClassName="block text-xs font-medium text-gray-400 mb-1"+ >+ <select+ value={localVideoModelId}+ onChange={(e) => setLocalVideoModelId(e.target.value)}+ disabled={localVideoModels === null || videoModelContextFailed}+ className="w-full bg-port-bg border border-port-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-port-accent disabled:opacity-50"+ >+ <option value="">+ {localVideoModels === null+ ? videoModelContextFailed ? 'Video models unavailable' : 'Loading models…'+ : `Install default (${localVideoDefaultLabel})`}+ </option>+ {localVideoModelOptions.map((model) => (+ <option key={model.id} value={model.id}>{model.name || model.id}</option>+ ))}+ </select>+ </FormField>+ <p className="text-xs text-gray-500">+ Used by local video renders that do not choose a model. A model selected for a+ render still wins. Weights download on first use; check the{' '}+ <a href="/models/media" className="text-port-accent hover:underline">+ {getNavPageForPath('/models/media')?.breadcrumb || 'media models page'}+ </a>{' '}for cached models.+ </p>+ {videoModelContextFailed && (+ <p role="status" className="text-xs text-port-warning">Could not load local video models.</p>+ )}+ {localVideoModels?.length === 0 && !videoModelContextFailed && (+ <p role="status" className="text-xs text-port-warning">+ No local video models are compatible with this machine.+ </p>+ )}+ </div><CleanersTogglescleanC2PA={cleanC2PAByMode.local}denoise={denoiseByMode.local}diff --git a/client/src/components/settings/ImageGenTab.test.jsx b/client/src/components/settings/ImageGenTab.test.jsxindex 418b97c857..a93c12d5fc 100644--- a/client/src/components/settings/ImageGenTab.test.jsx+++ b/client/src/components/settings/ImageGenTab.test.jsx@@ -6,6 +6,7 @@ vi.mock('../../services/api', () => ({getSettings: vi.fn(),updateSettings: vi.fn(),getImageGenStatus: vi.fn(),+ getVideoGenModelContext: vi.fn(),generateImage: vi.fn(),registerTool: vi.fn(),updateTool: vi.fn(),@@ -35,7 +36,8 @@ vi.mock('../../hooks/useMediaJobSse', () => ({}));import {- getSettings, getToolsList, updateSettings, listAgyImageModels, listImageModels, getImageGenStatus, generateImage,+ getSettings, getToolsList, updateSettings, listAgyImageModels, listImageModels, getImageGenStatus,+ getVideoGenModelContext, generateImage,} from '../../services/api';import { useHfTokenStatus } from '../../hooks/useHfTokenStatus';import { ImageGenTab, MEDIA_TABS } from './ImageGenTab';@@ -64,11 +66,19 @@ beforeEach(() => {});getToolsList.mockResolvedValue([]);getImageGenStatus.mockResolvedValue({ connected: true, mode: 'local', readiness: 'ready', model: 'FLUX.1 Dev', modelId: 'dev' });+ getVideoGenModelContext.mockResolvedValue({+ models: [+ { id: 'fastmetal_5b_qad', name: 'FastMetal 5B QAD' },+ { id: 'ltx23_distilled_q4', name: 'LTX-2.3 Distilled Q4' },+ ],+ defaultModel: 'fastmetal_5b_qad',+ });useHfTokenStatus.mockReturnValue({ present: false, source: 'none', refresh: vi.fn() });updateSettings.mockResolvedValue({});listAgyImageModels.mockResolvedValue({ models: ['gemini-image', 'custom/image-v2'], error: null });listImageModels.mockResolvedValue([{ id: 'dev', name: 'FLUX.1 Dev' },+ { id: 'qwen-image-2.1', name: 'Qwen-Image 2.1' },{ id: 'flux2-klein-4b', name: 'FLUX.2 Klein' },]);});@@ -108,6 +118,35 @@ describe('ImageGenTab grouped tabs', () => {await act(async () => {});});+ it('lets the user set a default local video model separately from the backend target', async () => {+ await renderTab(['/media/image?mediaTab=local']);+ await act(async () => {});++ const select = screen.getByLabelText('Default local video model');+ expect(select.value).toBe('');+ expect(screen.getByRole('option', { name: 'Install default (FastMetal 5B QAD)' })).toBeTruthy();+ fireEvent.change(select, { target: { value: 'ltx23_distilled_q4' } });+ fireEvent.click(screen.getByRole('button', { name: /^Save$/ }));+ await waitFor(() => expect(updateSettings).toHaveBeenCalled());++ expect(updateSettings.mock.calls[0][0].videoGen.defaultModelId).toBe('ltx23_distilled_q4');+ });++ it('clears the saved local video model pin to follow the install default', async () => {+ getSettings.mockResolvedValue({+ imageGen: { mode: 'external', external: { sdapiUrl: 'http://localhost:7860' } },+ videoGen: { defaultModelId: 'ltx23_distilled_q4' },+ });+ await renderTab(['/media/image?mediaTab=local']);+ await act(async () => {});++ fireEvent.change(screen.getByLabelText('Default local video model'), { target: { value: '' } });+ fireEvent.click(screen.getByRole('button', { name: /^Save$/ }));+ await waitFor(() => expect(updateSettings).toHaveBeenCalled());++ expect(updateSettings.mock.calls[0][0].videoGen.defaultModelId).toBeNull();+ });+it('keeps LocalSetupPanel mounted (hidden) after leaving the Local tab so an in-flight install stream is not torn down', async () => {await renderTab();// Not mounted until first visited (avoids a cold python-env probe).@@ -245,7 +284,7 @@ describe('ImageGenTab grouped tabs', () => {// Nothing pinned in settings — blank names what the server actually// resolves to, not an empty option the user has to guess at.expect(select.value).toBe('');- expect(screen.getByRole('option', { name: 'Install default (FLUX.1 Dev)' })).toBeTruthy();+ expect(screen.getByRole('option', { name: 'Install default (Qwen-Image 2.1)' })).toBeTruthy();fireEvent.change(select, { target: { value: 'flux2-klein-4b' } });fireEvent.click(screen.getByRole('button', { name: /^Save$/ }));@@ -576,7 +615,7 @@ describe('ImageGenTab local runtime card', () => {it('probes the runtime for the model the tab has pinned, not the install default', async () => {await renderTab();fireEvent.click(screen.getByRole('tab', { name: /^Local/i }));- await waitFor(() => expect(getImageGenStatus).toHaveBeenCalledWith('local', 'dev', expect.anything()));+ await waitFor(() => expect(getImageGenStatus).toHaveBeenCalledWith('local', 'qwen-image-2.1', expect.anything()));fireEvent.change(screen.getByLabelText('Default model'), { target: { value: 'flux2-klein-4b' } });await waitFor(() => expect(getImageGenStatus).toHaveBeenCalledWith('local', 'flux2-klein-4b', expect.anything()));diff --git a/client/src/hooks/useImageGenForm.js b/client/src/hooks/useImageGenForm.jsindex aa8c271643..1bdc95661a 100644--- a/client/src/hooks/useImageGenForm.js+++ b/client/src/hooks/useImageGenForm.js@@ -5,6 +5,7 @@ import { universeStylePreset } from '../lib/universeStylePreset';import { RUNNER_FAMILIES, loraCompatKey, usesDiffusersRunner } from '../lib/runnerFamilies';import {IMAGE_GEN_MODE,+ LOCAL_IMAGEGEN_DEFAULT_MODEL,cloudPromptRequired,deriveAvailableBackends,imageGenReadiness,@@ -184,7 +185,10 @@ export function useImageGenForm({ searchParams, setSearchParams, backend }) {useEffect(() => {if (modelId || savedLocalModelId === null || !models.length) return;- setModelId(models.some((model) => model.id === savedLocalModelId) ? savedLocalModelId : models[0].id);+ const preferredId = models.some((model) => model.id === savedLocalModelId)+ ? savedLocalModelId+ : LOCAL_IMAGEGEN_DEFAULT_MODEL;+ setModelId(models.some((model) => model.id === preferredId) ? preferredId : models[0].id);}, [models, savedLocalModelId, modelId]);useEffect(() => {diff --git a/client/src/lib/pipelineImageDefaults.js b/client/src/lib/pipelineImageDefaults.jsindex f99239c122..127407cdf1 100644--- a/client/src/lib/pipelineImageDefaults.js+++ b/client/src/lib/pipelineImageDefaults.js@@ -31,7 +31,7 @@ export const IMAGE_RENDER_KNOB_DEFAULTS = Object.freeze({export const PIPELINE_IMAGE_DEFAULTS = Object.freeze({mode: IMAGE_GEN_MODE.LOCAL,- modelId: 'flux2-klein-4b',+ modelId: LOCAL_IMAGEGEN_DEFAULT_MODEL,...IMAGE_RENDER_KNOB_DEFAULTS,});@@ -100,7 +100,7 @@ export function readPipelineImageSettings(settings) {: agyEnabled ? IMAGE_GEN_MODE.AGY : PIPELINE_IMAGE_DEFAULTS.mode;return {mode: stored.mode || defaultMode,- modelId: stored.modelId || PIPELINE_IMAGE_DEFAULTS.modelId,+ modelId: stored.modelId || installLocalModelId(settings),width: Number.isFinite(stored.width) ? stored.width : PIPELINE_IMAGE_DEFAULTS.width,height: Number.isFinite(stored.height) ? stored.height : PIPELINE_IMAGE_DEFAULTS.height,steps: stored.steps != null && stored.steps !== '' ? String(stored.steps) : '',diff --git a/client/src/lib/pipelineImageDefaults.test.js b/client/src/lib/pipelineImageDefaults.test.jsindex 3ddb55b822..d747e02017 100644--- a/client/src/lib/pipelineImageDefaults.test.js+++ b/client/src/lib/pipelineImageDefaults.test.js@@ -17,6 +17,20 @@ describe('readPipelineImageSettings', () => {pipeline: { imageGen: { mode: 'local' } },}).mode).toBe(IMAGE_GEN_MODE.LOCAL);});++ it('uses the install-wide local image model when the pipeline has no saved model choice', () => {+ expect(readPipelineImageSettings({+ imageGen: { local: { modelId: 'qwen-image-2.1' } },+ pipeline: { imageGen: { mode: 'local' } },+ }).modelId).toBe('qwen-image-2.1');+ expect(readPipelineImageSettings({ pipeline: { imageGen: { mode: 'local' } } }).modelId)+ .toBe('qwen-image-2.1');+ });++ it('keeps Qwen-Image 2.1 as the unresolved local form default', () => {+ expect(PIPELINE_IMAGE_DEFAULTS.modelId).toBe('qwen-image-2.1');+ expect(readPipelineImageSettings(null).modelId).toBe('qwen-image-2.1');+ });});describe('pipelineImageCfgToRenderOpts', () => {diff --git a/client/src/lib/wrImageDefaults.js b/client/src/lib/wrImageDefaults.jsindex 84e0a81a6e..774e6af06a 100644--- a/client/src/lib/wrImageDefaults.js+++ b/client/src/lib/wrImageDefaults.js@@ -5,7 +5,7 @@// the /api/image-gen/style-presets endpoint at runtime; only the two// special discriminators live here.-import { IMAGE_GEN_MODE } from './imageGenBackends';+import { IMAGE_GEN_MODE, LOCAL_IMAGEGEN_DEFAULT_MODEL, installLocalModelId } from './imageGenBackends';export const STYLE_ID = Object.freeze({ NONE: 'none', CUSTOM: 'custom' });export const EMPTY_IMAGE_STYLE = Object.freeze({ presetId: STYLE_ID.NONE, prompt: '', negativePrompt: '' });@@ -16,7 +16,7 @@ export const EMPTY_IMAGE_STYLE = Object.freeze({ presetId: STYLE_ID.NONE, prompt// directly. Empty string = "use model default" for steps, "random per render"// for seed. Parsed to numbers at the generateImage boundary in SceneCard.export const WR_IMAGE_DEFAULTS = Object.freeze({- modelId: 'flux2-klein-4b',+ modelId: LOCAL_IMAGEGEN_DEFAULT_MODEL,mode: IMAGE_GEN_MODE.LOCAL,width: 768,height: 512,@@ -71,7 +71,7 @@ export function readWrImageSettings(settings, availableBackends = null) {mode = availableBackends[0].id;}return {- modelId: stored.modelId || WR_IMAGE_DEFAULTS.modelId,+ modelId: stored.modelId || installLocalModelId(settings),mode,width: Number.isFinite(stored.width) ? stored.width : WR_IMAGE_DEFAULTS.width,height: Number.isFinite(stored.height) ? stored.height : WR_IMAGE_DEFAULTS.height,diff --git a/client/src/lib/wrImageDefaults.test.js b/client/src/lib/wrImageDefaults.test.jsindex 33a49d7b6f..507a6d4991 100644--- a/client/src/lib/wrImageDefaults.test.js+++ b/client/src/lib/wrImageDefaults.test.js@@ -1,5 +1,16 @@import { describe, it, expect } from 'vitest';-import { buildSceneRenderPayload, WR_IMAGE_DEFAULTS } from './wrImageDefaults';+import { buildSceneRenderPayload, readWrImageSettings, WR_IMAGE_DEFAULTS } from './wrImageDefaults';++describe('readWrImageSettings', () => {+ it('uses the install-wide local image model unless the Writers Room has its own choice', () => {+ expect(readWrImageSettings({ imageGen: { local: { modelId: 'qwen-image-2.1' } } }).modelId)+ .toBe('qwen-image-2.1');+ expect(readWrImageSettings({+ imageGen: { local: { modelId: 'qwen-image-2.1' } },+ writersRoom: { imageGen: { modelId: 'scene-model' } },+ }).modelId).toBe('scene-model');+ });+});describe('buildSceneRenderPayload', () => {it('folds prompt + imageCfg into the generate payload, dropping empty steps/seed', () => {diff --git a/client/src/pages/ImageGen.defaultLocalModel.test.jsx b/client/src/pages/ImageGen.defaultLocalModel.test.jsxindex 831a5d0625..cfb55c4ad1 100644--- a/client/src/pages/ImageGen.defaultLocalModel.test.jsx+++ b/client/src/pages/ImageGen.defaultLocalModel.test.jsx@@ -20,6 +20,7 @@ const DEV = imageGenModel('dev', { name: 'FLUX.1 Dev' });// Deliberately NOT first in the catalog — the regression this suite pins is the// page opening on models[0] and ignoring the saved pin.const KLEIN = imageGenModel('flux2-klein-4b', { name: 'FLUX.2 Klein', runner: 'flux2' });+const QWEN = imageGenModel('qwen-image-2.1', { name: 'Qwen-Image 2.1', runner: 'qwen' });await loadImageGenPage();@@ -29,7 +30,7 @@ const modelSelect = () => screen.getByLabelText('Model');describe('ImageGen default local model', () => {beforeEach(() => {resetImageGenMockState();- state.models = [DEV, KLEIN];+ state.models = [DEV, KLEIN, QWEN];window.matchMedia = vi.fn(() => ({ matches: false, addEventListener: vi.fn(), removeEventListener: vi.fn() }));});@@ -49,24 +50,24 @@ describe('ImageGen default local model', () => {await waitFor(() => expect(modelSelect().value).toBe('flux2-klein-4b'));});- it('falls back to the first catalog entry when nothing is pinned', async () => {+ it('uses Qwen-Image 2.1 when no model is pinned', async () => {state.getSettings.mockResolvedValue(settingsWith({}));await renderImageGenPage();- await waitFor(() => expect(modelSelect().value).toBe('dev'));+ await waitFor(() => expect(modelSelect().value).toBe('qwen-image-2.1'));});- it('falls back to the first catalog entry when the pin no longer resolves', async () => {+ it('falls back to Qwen-Image 2.1 when the saved pin no longer resolves', async () => {// A retired/incompatible pin must not leave the select empty — the form// would then submit a blank modelId the local runner cannot dispatch.state.getSettings.mockResolvedValue(settingsWith({ modelId: 'retired-model' }));await renderImageGenPage();- await waitFor(() => expect(modelSelect().value).toBe('dev'));+ await waitFor(() => expect(modelSelect().value).toBe('qwen-image-2.1'));});it('still settles on a model when the settings fetch fails', async () => {state.getSettings.mockRejectedValue(new Error('offline'));await renderImageGenPage();- await waitFor(() => expect(modelSelect().value).toBe('dev'));+ await waitFor(() => expect(modelSelect().value).toBe('qwen-image-2.1'));});it('lets a ?modelId= deep link win over the pin', async () => {diff --git a/data.reference/media-models.json b/data.reference/media-models.jsonindex fd5a43351f..567f7923ff 100644--- a/data.reference/media-models.json+++ b/data.reference/media-models.json@@ -1785,7 +1785,7 @@]}],- "defaultMlx": "ltx23_distilled_q4",+ "defaultMlx": "fastmetal_5b_qad","defaultCuda": "ltx_video"},"image": [diff --git a/server/lib/imageGenCapabilities.js b/server/lib/imageGenCapabilities.jsindex c9a275b0d3..59af546899 100644--- a/server/lib/imageGenCapabilities.js+++ b/server/lib/imageGenCapabilities.js@@ -102,7 +102,7 @@ export const AGY_IMAGEGEN_DEFAULT_MODEL = 'gemini-3.8-flash-low';// Lives here rather than in `services/imageGen/modes.js` because the Settings// Local tab labels its "install default" option with whichever model a blank// pin actually resolves to — the same reason the Codex/Agy pins moved down.-export const LOCAL_IMAGEGEN_DEFAULT_MODEL = 'dev';+export const LOCAL_IMAGEGEN_DEFAULT_MODEL = 'qwen-image-2.1';// The image model behind agy's generate_image tool — fixed server-side by// Antigravity and NOT selectable by PortOS. Re-probed 2026-07-30 against agydiff --git a/server/lib/imageGenCapabilities.test.js b/server/lib/imageGenCapabilities.test.jsindex e1d56ee619..3a6614c4ab 100644--- a/server/lib/imageGenCapabilities.test.js+++ b/server/lib/imageGenCapabilities.test.js@@ -2,7 +2,11 @@ import { describe, it, expect } from 'vitest';import { readFileSync } from 'fs';import { dirname, resolve } from 'path';import { fileURLToPath } from 'url';-import { AGY_IMAGEGEN_DEFAULT_MODEL, CODEX_IMAGEGEN_DEFAULT_MODEL } from './imageGenCapabilities.js';+import {+ AGY_IMAGEGEN_DEFAULT_MODEL,+ CODEX_IMAGEGEN_DEFAULT_MODEL,+ LOCAL_IMAGEGEN_DEFAULT_MODEL,+} from './imageGenCapabilities.js';import { pickAntigravityRelayModel } from './providerModels.js';// The cheap-tier pins here are code-level defaults: no migration carries them,@@ -10,16 +14,16 @@ import { pickAntigravityRelayModel } from './providerModels.js';// went out of sync exactly that way — see AGY_IMAGEGEN_DEFAULT_MODEL for the// incident this guard exists to make impossible to ship again.//-// Derived from `data.reference/providers.json` rather than a hand-transcribed-// list: that seed is what a fresh install starts with, and every catalog-// migration is written to keep it in lockstep, so it is the one place that-// already knows which ids a vendor still serves.+// Provider pins are checked against data.reference/providers.json, while the+// local image pin is checked against data.reference/media-models.json. Those+// seeds are what fresh installs start with and must contain every code default.//// Read as JSON instead of importing the toolkit's own catalog module — that// module pulls the whole provider subtree, and this is a two-value check (see// the server suite import budget in `importScoping.test.js`).-describe('shipped image-gen model pins stay in the seeded provider catalog', () => {+describe('shipped image-gen defaults stay in the seeded catalogs', () => {const SEED_PATH = resolve(dirname(fileURLToPath(import.meta.url)), '../../data.reference/providers.json');+ const MEDIA_SEED_PATH = resolve(dirname(fileURLToPath(import.meta.url)), '../../data.reference/media-models.json');const seeded = JSON.parse(readFileSync(SEED_PATH, 'utf8')).providers || {};const modelsFor = (id) => (Array.isArray(seeded[id]?.models) ? seeded[id].models : []);@@ -43,4 +47,10 @@ describe('shipped image-gen model pins stay in the seeded provider catalog', ()it('agy pin is the relay tier the runtime heal would pick from the same catalog', () => {expect(pickAntigravityRelayModel(modelsFor('antigravity-cli'))).toBe(AGY_IMAGEGEN_DEFAULT_MODEL);});++ it('local image default remains in the seeded media catalog', () => {+ const media = JSON.parse(readFileSync(MEDIA_SEED_PATH, 'utf8'));+ expect(media.image.some((model) => model.id === LOCAL_IMAGEGEN_DEFAULT_MODEL)).toBe(true);+ expect(LOCAL_IMAGEGEN_DEFAULT_MODEL).toBe('qwen-image-2.1');+ });});diff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.jsindex 1d45608ade..54f46366eb 100644--- a/server/lib/mediaModels.js+++ b/server/lib/mediaModels.js@@ -963,7 +963,7 @@ const DEFAULT_REGISTRY = {supportsDisableAudio: false,},]))))),- defaultMlx: 'ltx23_distilled_q4',+ defaultMlx: 'fastmetal_5b_qad',defaultCuda: 'ltx_video',},image: [@@ -1984,7 +1984,7 @@ export const getVideoModels = ({ includeDisabled = false } = {}) => {));};-export const getDefaultVideoModelId = (capabilities = captureSystemCapabilities()) => {+export const getDefaultVideoModelId = (capabilities = captureSystemCapabilities(), preferredId = null) => {const reg = loadMediaModels();// Note: defaultMlx / defaultCuda may legitimately point at a model// flagged `deprecated: true` — the dgrauet (non-deprecated) runtime@@ -1994,6 +1994,7 @@ export const getDefaultVideoModelId = (capabilities = captureSystemCapabilities(// pattern; user-driven migration > auto-rolling forward.const bucket = activeVideoBucket();const configuredId = readVideoDefault(reg.video, bucket);+ const preferred = typeof preferredId === 'string' && preferredId.trim() ? preferredId.trim() : null;// Validate against the bucket's available (non-broken) list — a typo or// a model marked broken on this bucket would otherwise surface as// "Unknown video model" the first time the UI tries to use the default.@@ -2003,14 +2004,20 @@ export const getDefaultVideoModelId = (capabilities = captureSystemCapabilities(model.hardwareRequirements,));const compatible = available.filter((model) => isHardwareCompatible(model.hardwareCompatibility));- if (compatible.some((m) => m.id === configuredId)) return configuredId;+ const candidates = [preferred, configuredId];+ // FastMetal 5B is the shipped Apple Silicon default. On a machine below its+ // 16 GB floor, use the smaller FastMetal profile when it is compatible+ // before considering older catalog entries.+ if (candidates.includes('fastmetal_5b_qad')) candidates.push('fastmetal_1_3b_qad');+ const selected = candidates.find((id) => compatible.some((model) => model.id === id));+ if (selected) return selected;const fallback = compatible[0]?.id;if (fallback) {- console.log(`⚠️ Default video model "${configuredId}" is unavailable or unknown for ${bucket}; falling back to "${fallback}"`);+ console.log(`⚠️ Default video model "${preferred || configuredId}" is unavailable or unknown for ${bucket}; falling back to "${fallback}"`);return fallback;}- console.log(`⚠️ Default video model "${configuredId}" is unavailable or unknown for ${bucket}; no available models to fall back to`);- return configuredId;+ console.log(`⚠️ Default video model "${preferred || configuredId}" is unavailable or unknown for ${bucket}; no available models to fall back to`);+ return preferred || configuredId;};export const getImageModels = ({ includeDisabled = false } = {}) => {diff --git a/server/lib/mediaModels.test.js b/server/lib/mediaModels.test.jsindex 04721666d6..9bf3d62e14 100644--- a/server/lib/mediaModels.test.js+++ b/server/lib/mediaModels.test.js@@ -29,6 +29,12 @@ afterEach(() => {// Compares the seed file to a freshly-bootstrapped registry with// _shippedDefaults stripped (that's a runtime-only field).describe('data.reference seed file', () => {+ it('defaults fresh Apple Silicon installs to FastMetal 5B when shipped', () => {+ const seeded = JSON.parse(readFileSync(SAMPLE_REGISTRY_PATH, 'utf8'));+ expect(seeded.video.defaultMlx).toBe('fastmetal_5b_qad');+ expect(seeded.video.mlx.some((entry) => entry.id === seeded.video.defaultMlx)).toBe(true);+ });+it('appends new Apple video choices to an existing registry and preserves later removals', async () => {const { loadMediaModels, reloadMediaModels } = await import('./mediaModels.js');const fresh = loadMediaModels();@@ -658,6 +664,20 @@ describe('mediaModels registry', () => {expect(id.length).toBeGreaterThan(0);});+ it('uses FastMetal 1.3B when FastMetal 5B is above an Apple Silicon host memory floor', async () => {+ const { getDefaultVideoModelId } = await import('./mediaModels.js');+ const restorePlatform = pinPlatform('darwin');+ try {+ expect(getDefaultVideoModelId({+ platform: 'darwin',+ appleSilicon: true,+ totalMemoryGb: 8,+ })).toBe('fastmetal_1_3b_qad');+ } finally {+ restorePlatform();+ }+ });+it('normalizes a registry missing the video key without crashing consumers', async () => {// Simulates a user editing media-models.json down to just textEncoders.// Without normalization, getVideoModels() / buildAppModels() would throwdiff --git a/server/lib/validation.js b/server/lib/validation.jsindex 0d55527993..2041133059 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -1983,9 +1983,9 @@ export const renderDefaultsSettingsSchema = z.object(// third rung in resolveVideoMode's ladder (request → target pin → THIS →// local). `'auto'`/`''`/null all mean "no pin — local". Tolerant of unknown// keys for the same rollback/forward-compat reason as renderDefaults above.-// `defaultModelId` predates this schema (pipeline storyboards/episodeVideo-// read it as the local-model default) — typed here so a Settings save can't-// write junk to it.+// `defaultModelId` is the install-wide local video model choice used by the+// Video Gen form and pipeline video stages — typed here so a Settings save+// can't write junk to it.export const videoGenSettingsSchema = z.object({mode: videoModePinSchema,defaultModelId: z.preprocess(emptyToNull, z.string().trim().max(64).nullable().optional()),diff --git a/server/routes/videoGen.js b/server/routes/videoGen.jsindex aaba170327..dfb4cfec79 100644--- a/server/routes/videoGen.js+++ b/server/routes/videoGen.js@@ -118,14 +118,15 @@ const hardwareAwareVideoModels = async () => {// MLX import, no model load, cached both ways). /status keeps returning them// for its other readers — this is the single builder both routes share, so the// two can't drift.-const videoModelContext = async () => {+const videoModelContext = async (loadedSettings = null) => {const { capabilities, models } = await hardwareAwareVideoModels();+ const settings = loadedSettings || await getSettings();return {// Each entry carries its optional `disclosure` block (provenance, weights/// runtime licenses, pinned-snapshot download size) straight off the// registry — absent for custom models, which the UI renders as Unknown.models,- defaultModel: defaultVideoModelId(capabilities),+ defaultModel: defaultVideoModelId(capabilities, settings?.videoGen?.defaultModelId),// Total system memory in GB — the client uses this to auto-select the// highest-memory mode-compatible model that fits on this machine.// Rounded to nearest GB; sub-GB precision isn't useful for the@@ -510,7 +511,7 @@ router.get('/status', asyncHandler(async (_req, res) => {// kept here for the callers that already read them off /status. The Video// Gen page takes them from GET /model-context instead, so its Model picker// never waits on the python probe above.- ...(await videoModelContext()),+ ...(await videoModelContext(s)),// Server-owned execution + policy scope per render backend (#3674). The// client renders these strings verbatim so the wording can't drift between// the two surfaces.diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.jsindex 614d95554b..d87f2680b4 100644--- a/server/routes/videoGen.test.js+++ b/server/routes/videoGen.test.js@@ -649,6 +649,20 @@ describe('videoGen routes', () => {expect(checkPackages).not.toHaveBeenCalled();});+ it('uses the saved local video model as the form default when available', async () => {+ const { getSettings } = await import('../services/settings.js');+ getSettings.mockResolvedValueOnce({ videoGen: { defaultModelId: 'preferred-video-model' } });+ videoGenService.defaultVideoModelId.mockImplementationOnce((capabilities, preferredId) => (+ preferredId || 'ltx2_unified'+ ));++ const r = await request(app).get('/api/video-gen/model-context');++ expect(r.status).toBe(200);+ expect(r.body.defaultModel).toBe('preferred-video-model');+ expect(videoGenService.defaultVideoModelId).toHaveBeenCalledWith(expect.any(Object), 'preferred-video-model');+ });+// The payload's `runtimeLoraCapable` is only as good as the probe having// ANSWERED first — the reason is on warmByovLoraCapabilities in// services/videoGen/runtimes.js. Calling the warm is not enough: the listdiff --git a/server/services/imageGen/local.js b/server/services/imageGen/local.jsindex 6a87f17c37..62c4645aa4 100644--- a/server/services/imageGen/local.js+++ b/server/services/imageGen/local.js@@ -1,7 +1,7 @@/**- * Image Gen — Local provider (Apple Silicon mflux / Windows diffusers).+ * Image Gen — Local provider (mflux, diffusers, and platform-specific runners).*- * Spawns a Python child process to generate Flux images. HF model weights+ * Spawns a Python child process to generate the selected local image model. HF model weights* stream into the user's standard HF cache (`~/.cache/huggingface/`) — PortOS* doesn't override HF_HOME. Generated images land in `data/images/<jobId>.png`* with a sidecar metadata JSON so the gallery and Remix flow can recoverdiff --git a/server/services/imageGen/prepareParams.js b/server/services/imageGen/prepareParams.jsindex 745ae937e6..0fd21bac25 100644--- a/server/services/imageGen/prepareParams.js+++ b/server/services/imageGen/prepareParams.js@@ -77,7 +77,7 @@ const MIME_TO_EXT = { 'image/png': '.png', 'image/jpeg': '.jpg', 'image/webp': '/*** Select the model a local render will actually use. An omitted model prefers* the install-wide pin (`settings.imageGen.local.modelId`, set on Settings →- * Media → Local), then the historical `dev` default — each only when it can+ * Media → Local), then the shipped Qwen-Image 2.1 default — each only when it can* actually run on this host; otherwise it falls through to the first* compatible catalog entry.*@@ -390,8 +390,8 @@ export async function prepareGenerateParams({ data, files, referenceImageFields* called from the route right before it enqueues a local job.** Resolves the effective model via the same fallback chain the local worker- * uses (`params.modelId` → the install pin → compatible `'dev'` → the first- * compatible model)+ * uses (`params.modelId` → the install pin → compatible Qwen-Image 2.1 → the+ * first compatible model)* and validates it can actually run: an edit-only model (e.g. Qwen-Image-Edit)* requires a source image, and any model that isn't FLUX.2 or diffusers-run* needs a configured pythonPath. Throws the identical `ServerError`s (same@@ -409,8 +409,8 @@ export function resolveLocalImageModel(settings, params) {// accept the job and only surface the failure async over SSE.const allModels = getImageModels();// Reject a typo'd modelId synchronously rather than enqueueing a doomed- // job. When omitted, fall through to the default ('dev'-ish) — the- // worker does the same lookup so behavior stays consistent.+ // job. When omitted, fall through to Qwen-Image 2.1 or the first compatible+ // catalog model — the worker uses the same selection path.if (params.modelId && !allModels.some((m) => m.id === params.modelId)) {throw new ServerError(`Unknown modelId: ${params.modelId}`,@@ -418,9 +418,8 @@ export function resolveLocalImageModel(settings, params) {);}// An explicit pin must fail clearly when the host cannot run it. For an- // omitted pin, prefer the historical `dev` default only when it is actually- // compatible, then choose the first known-compatible model. This keeps a- // Windows/Linux install from silently queueing the Apple-only default.+ // omitted pin, prefer the shipped default only when compatible, then choose+ // the first known-compatible model.const selectedModel = selectLocalImageModelFromSettings(settings, params.modelId, allModels);if (selectedModel && !isHardwareCompatible(selectedModel.hardwareCompatibility)) {throw new ServerError(diff --git a/server/services/imageGen/prepareParams.test.js b/server/services/imageGen/prepareParams.test.jsindex c569b668ab..e027635e92 100644--- a/server/services/imageGen/prepareParams.test.js+++ b/server/services/imageGen/prepareParams.test.js@@ -70,9 +70,17 @@ describe('selectLocalImageModel', () => {expect(selectLocalImageModel('custom', models).id).toBe('custom');});- it('falls back from an unavailable dev default to a compatible model', () => {+ it('uses Qwen-Image 2.1 as the shipped default when it is available', () => {const models = [- { id: 'dev', hardwareCompatibility: { state: 'unavailable' } },+ { id: 'other-model', hardwareCompatibility: { state: 'available' } },+ { id: 'qwen-image-2.1', hardwareCompatibility: { state: 'available' } },+ ];+ expect(selectLocalImageModel(undefined, models).id).toBe('qwen-image-2.1');+ });++ it('falls back from an unavailable shipped default to a compatible model', () => {+ const models = [+ { id: 'qwen-image-2.1', hardwareCompatibility: { state: 'unavailable' } },{ id: 'custom', hardwareCompatibility: { state: 'available' } },];expect(selectLocalImageModel(undefined, models).id).toBe('custom');@@ -81,7 +89,7 @@ describe('selectLocalImageModel', () => {// The install-wide pin (settings.imageGen.local.modelId, Settings → Media →// Local). Without this rung the setting is a control that silently does// nothing for any render whose body omits modelId.- it('prefers the install pin over the dev default when the caller omits a model', () => {+ it('prefers the install pin when the caller omits a model', () => {const models = [{ id: 'dev', hardwareCompatibility: { state: 'available' } },{ id: 'klein', hardwareCompatibility: { state: 'available' } },diff --git a/server/services/videoGen/generateVideo.js b/server/services/videoGen/generateVideo.jsindex 2888150924..f5ea612506 100644--- a/server/services/videoGen/generateVideo.js+++ b/server/services/videoGen/generateVideo.js@@ -148,7 +148,7 @@ export const resolveVideoModel = (modelId) =>export const listVideoModels = () => getVideoModels().map(decorateVideoModel);-export const defaultVideoModelId = (capabilities) => getDefaultVideoModelId(capabilities);+export const defaultVideoModelId = (capabilities, preferredId) => getDefaultVideoModelId(capabilities, preferredId);export async function generateVideo({ pythonPath, prompt, negativePrompt = '', modelId, width = null, height = null, numFrames = null, fps = 24, steps, guidanceScale, seed, batchSize = 1, tiling = 'auto', disableAudio = false, sourceImagePath = null, uploadedTempPath = null, uploadedTempPaths = [], lastImagePath = null, keyframes = null, extendFromVideoPath = null, audioFilePath = null, audioStartSec = null, mode = null, imageStrength = null, i2vReferenceMode = null, loras = null, icReferencePaths = null, icStrength = null, icAttentionStrength = null, icSkipStage2 = false, textEncoderId = null, speedProfileId = null, draftDecode = null, streamingMode = null, visualConditioning = null, hidden = false, displaySleep = null, jobId: providedJobId = null }) {uploadedTempPaths = Array.isArray(uploadedTempPaths) ? uploadedTempPaths : [];diff --git a/server/services/videoGen/modelSelection.js b/server/services/videoGen/modelSelection.jsindex 39e3c3177e..b4b952b42b 100644--- a/server/services/videoGen/modelSelection.js+++ b/server/services/videoGen/modelSelection.js@@ -1,5 +1,6 @@import { getVideoModels, getDefaultVideoModelId } from '../../lib/mediaModels.js';import { captureSystemCapabilities, detectSystemCapabilities, withHardwareCompatibility } from '../../lib/systemCapabilities.js';+import { getSettings } from '../settings.js';// Queue admission and rendering must agree on a capability-dependent default.// Explicit null remains an unknown model: routed jobs use it as a sentinel.@@ -7,14 +8,16 @@ export async function resolveVideoModelSelection(modelId, {resolveModel = (id) => getVideoModels().find((entry) => entry.id === id) || null,} = {}) {const omitted = modelId === undefined || modelId === '';+ const settings = omitted ? await getSettings() : null;+ const preferredId = settings?.videoGen?.defaultModelId;let capabilities = captureSystemCapabilities();- let selectedModelId = omitted ? getDefaultVideoModelId(capabilities) : modelId;+ let selectedModelId = omitted ? getDefaultVideoModelId(capabilities, preferredId) : modelId;let model = resolveModel(selectedModelId);const requirements = model?.hardwareRequirements;if (requirements?.requiresNvidiaGpu || requirements?.minVramGb != null|| requirements?.minCudaComputeCapability != null) {capabilities = await detectSystemCapabilities();- if (omitted) selectedModelId = getDefaultVideoModelId(capabilities);+ if (omitted) selectedModelId = getDefaultVideoModelId(capabilities, preferredId);model = resolveModel(selectedModelId);}return {diff --git a/server/services/videoGen/prepareParams.js b/server/services/videoGen/prepareParams.jsindex 87e3ba0ff2..25516dd551 100644--- a/server/services/videoGen/prepareParams.js+++ b/server/services/videoGen/prepareParams.js@@ -84,12 +84,14 @@ export async function validateVideoRetryParams(params = {}) {|| requirements?.minCudaComputeCapability != null;let capabilities = captureSystemCapabilities();const modelWasOmitted = params.modelId === undefined || params.modelId === '';- let modelId = modelWasOmitted ? defaultVideoModelId(capabilities) : params.modelId;+ const settings = modelWasOmitted ? await getSettings() : null;+ const preferredId = settings?.videoGen?.defaultModelId;+ let modelId = modelWasOmitted ? defaultVideoModelId(capabilities, preferredId) : params.modelId;const knownModels = listVideoModels();let model = knownModels.find((entry) => entry.id === modelId);if (needsCuda(model?.hardwareRequirements)) {capabilities = await detectSystemCapabilities();- if (modelWasOmitted) modelId = defaultVideoModelId(capabilities);+ if (modelWasOmitted) modelId = defaultVideoModelId(capabilities, preferredId);model = knownModels.find((entry) => entry.id === modelId);}model = model && withHardwareCompatibility(model, capabilities, model.hardwareRequirements);@@ -298,12 +300,13 @@ export async function prepareVideoGenParams({ body, uploads, localOnlyParamKeys// remain unknown so a legacy local dispatcher cannot render a remote job// locally.const modelWasOmitted = body.modelId === undefined || body.modelId === '';- let effectiveModelId = modelWasOmitted ? defaultVideoModelId(capabilities) : body.modelId;+ const preferredId = settings?.videoGen?.defaultModelId;+ let effectiveModelId = modelWasOmitted ? defaultVideoModelId(capabilities, preferredId) : body.modelId;let effectiveModel = knownModels.find((m) => m.id === effectiveModelId);if (needsCuda(effectiveModel?.hardwareRequirements)) {capabilities = await detectSystemCapabilities();if (modelWasOmitted) {- effectiveModelId = defaultVideoModelId(capabilities);+ effectiveModelId = defaultVideoModelId(capabilities, preferredId);effectiveModel = knownModels.find((m) => m.id === effectiveModelId);}}diff --git a/server/services/videoGen/prepareParams.test.js b/server/services/videoGen/prepareParams.test.jsindex fb02e763b8..1b6fe137b0 100644--- a/server/services/videoGen/prepareParams.test.js+++ b/server/services/videoGen/prepareParams.test.js@@ -176,6 +176,20 @@ describe('prepareVideoGenParams', () => {expect(unlink).toHaveBeenCalledWith('/tmp/multipart-sourceImage-frame.png');});+ it('uses the saved local video model when a request omits modelId', async () => {+ const preferredModel = {+ id: 'preferred-video-model', name: 'Preferred model', runtime: 'ltx2', supportedModes: ['text'],+ };+ getSettings.mockResolvedValueOnce({ videoGen: { defaultModelId: preferredModel.id } });+ listVideoModels.mockReturnValue([preferredModel]);+ defaultVideoModelId.mockImplementationOnce((_capabilities, preferredId) => preferredId || 'ltx2_unified');++ const prepared = await prepare({});++ expect(prepared.effectiveModelId).toBe(preferredModel.id);+ expect(defaultVideoModelId).toHaveBeenCalledWith(expect.any(Object), preferredModel.id);+ });+it('probes LTX-2.5 audio and derives a full-duration 8n+1 frame canvas', async () => {const ltx25 = {id: 'ltx25_mlx_q8',