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: upgrade local audio-reactive video generation
[._.]/ Adam Eivy5dedb0d54e04
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1e73cf7111..745b2145d7 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -6,6 +6,7 @@- **Slashdo-free TUI agent PRs now complete their lifecycle.** Codex, Antigravity, OpenCode, and lean Claude agents hand committed work back to PortOS so it can generate a non-empty PR description, run configured reviewers, and merge after the selected gates pass instead of leaving an ownerless PR open.- **Music Video projects now save their scene-video renderer and model.** Directors can choose local or Grok generation per project, pick an image-to-video-capable local model, see cut-pacing warnings, selectively continue clips on native LTX runtimes, generate all missing media from the board, and play or download the audio-backed final render in place.- **Music Video projects can now be forked into editable versions and rendered with local song-reactive motion.** A fork keeps the source board and scene media while clearing the final master, records its parent/root lineage, and opens immediately as the next version. Projects with the LTX-2.3 audio-reactive LoRA installed can condition each cut on its exact song segment while stripping generated clip audio and automatically directing the model away from singing, lip-sync, performers, and visible musical performance.+- **Music Video projects can pin an exact audio-reactive LoRA version and audit visual repetition before rendering.** The LoRA manager installs versioned HuggingFace files from the same repository side by side, recommends the LTX-2.3 Audio Reactive V2 weights at 1.2×, and the director toolbar now shows the selected LoRA plus unique-frame/unique-clip counts instead of treating repeated media as fully diverse. The local MLX runtime is pinned to ltx-2-mlx 0.14.19 and automatically prefers the improved LTX-2.3 1.1 distilled adapter when the selected Q4/Q8 checkpoint includes it.## Agent workspacesdiff --git a/client/src/pages/Loras.jsx b/client/src/pages/Loras.jsxindex da1250e684..6dc0b11fa4 100644--- a/client/src/pages/Loras.jsx+++ b/client/src/pages/Loras.jsx@@ -61,6 +61,8 @@ const MEDIA_FILTERS = [// takes the two ids explicitly rather than a whole card.const suggestionKey = (modelId, versionId) => `${modelId}-${versionId}`;const cardKey = (card) => suggestionKey(card.modelId, card.versionId);+const hfCardKey = (card) => `${card.repo}:${card.file || ''}`;+const installedHfKey = (lora) => `${lora.huggingface?.repo || ''}:${lora.huggingface?.file || ''}`;// Integer download percent (0..100) from an SSE progress frame, or null when// the frame carries no numeric ratio (server sent no Content-Length → the UI@@ -98,9 +100,9 @@ export default function Loras() {const [suggestions, setSuggestions] = useState(null);const [loadingSuggestions, setLoadingSuggestions] = useState(true);const [installingSuggestion, setInstallingSuggestion] = useState(null);- // Repo of the video suggestion currently installing (HF installs key off- // repo, not modelId/versionId like the Civitai path).- const [installingVideoRepo, setInstallingVideoRepo] = useState(null);+ // Repo+file key of the video suggestion currently installing. A single HF+ // repo can publish multiple versions that must remain independently selectable.+ const [installingVideoKey, setInstallingVideoKey] = useState(null);// Image/Video media-type filter for both panels. 'all' | 'image' | 'video'.const [mediaFilter, setMediaFilter] = useState('all');@@ -171,7 +173,7 @@ export default function Loras() {// Cross-guard against the curated video quick-install: both write the shared// hfProgress, so allowing them to overlap makes both progress readouts show// interleaved byte counts. Only one HF install runs at a time.- if (!url || hfInstalling || installingVideoRepo) return;+ if (!url || hfInstalling || installingVideoKey) return;setHfInstalling(true);setHfProgress(null);await installLoraFromHuggingfaceStream({ url, family, onProgress: setHfProgress })@@ -192,7 +194,7 @@ export default function Loras() {}}).finally(() => { setHfInstalling(false); setHfProgress(null); });- }, [hfInstalling, installingVideoRepo, refresh]);+ }, [hfInstalling, installingVideoKey, refresh]);const handleHfInstall = useCallback((e) => {e?.preventDefault?.();@@ -207,17 +209,22 @@ export default function Loras() {const installVideoSuggestion = useCallback(async (card) => {// Cross-guard against the form install (see runHfInstall) — one HF install// at a time so they don't clobber the shared hfProgress.- if (!card?.installUrl || installingVideoRepo || hfInstalling) return;- setInstallingVideoRepo(card.repo);+ if (!card?.installUrl || installingVideoKey || hfInstalling) return;+ setInstallingVideoKey(hfCardKey(card));setHfProgress(null);- await installLoraFromHuggingfaceStream({ url: card.installUrl, family: card.runnerFamily, onProgress: setHfProgress })+ await installLoraFromHuggingfaceStream({+ url: card.installUrl,+ family: card.runnerFamily,+ file: card.file,+ onProgress: setHfProgress,+ }).then((sidecar) => {toast.success(`Installed ${sidecar.name}`);refresh();}).catch((err) => toast.error(err?.message || 'HuggingFace install failed'))- .finally(() => { setInstallingVideoRepo(null); setHfProgress(null); });- }, [installingVideoRepo, hfInstalling, refresh]);+ .finally(() => { setInstallingVideoKey(null); setHfProgress(null); });+ }, [installingVideoKey, hfInstalling, refresh]);const handleDelete = async (filename) => {setDeleting(filename);@@ -309,7 +316,7 @@ export default function Loras() {/><buttontype="submit"- disabled={hfInstalling || !!installingVideoRepo || !hfUrl.trim()}+ disabled={hfInstalling || !!installingVideoKey || !hfUrl.trim()}className="bg-port-accent text-white px-4 py-2 rounded text-sm font-medium hover:bg-port-accent/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2">{hfInstalling ? (hfPct != null ? `Downloading ${hfPct}%` : 'Downloading…') : 'Install'}@@ -374,9 +381,9 @@ export default function Loras() {loading={loadingSuggestions}mediaFilter={mediaFilter}installedFilenames={new Set(loras.map((l) => l.filename))}- installedHfRepos={new Set(loras.map((l) => l.huggingface?.repo).filter(Boolean))}+ installedHfKeys={new Set(loras.filter((l) => l.huggingface?.repo).map(installedHfKey))}installingSuggestionKey={installingSuggestion}- installingVideoRepo={installingVideoRepo}+ installingVideoKey={installingVideoKey}installingVideoProgress={hfProgress}videoInstallBusy={hfInstalling}onRefresh={() => refreshSuggestions({ force: true })}@@ -476,7 +483,7 @@ function MediaFilter({ value, onChange }) {);}-function SuggestionsPanel({ suggestions, loading, mediaFilter = 'all', installedFilenames, installedHfRepos, installingSuggestionKey, installingVideoRepo, installingVideoProgress, videoInstallBusy, onRefresh, onInstall, onInstallVideo }) {+function SuggestionsPanel({ suggestions, loading, mediaFilter = 'all', installedFilenames, installedHfKeys, installingSuggestionKey, installingVideoKey, installingVideoProgress, videoInstallBusy, onRefresh, onInstall, onInstallVideo }) {const curated = suggestions?.curated || [];const runners = suggestions?.runners || {};const video = suggestions?.video || [];@@ -536,8 +543,8 @@ function SuggestionsPanel({ suggestions, loading, mediaFilter = 'all', installed{showVideo && (<VideoSuggestionsSectioncards={video}- installedHfRepos={installedHfRepos}- installingVideoRepo={installingVideoRepo}+ installedHfKeys={installedHfKeys}+ installingVideoKey={installingVideoKey}installingVideoProgress={installingVideoProgress}videoInstallBusy={videoInstallBusy}onInstall={onInstallVideo}@@ -549,9 +556,9 @@ function SuggestionsPanel({ suggestions, loading, mediaFilter = 'all', installed// Curated HuggingFace video LoRAs (LTX-Video). No keyword search / pagination// like the Civitai sections — it's a small hand-picked list installed via the-// HF path. Installed-state matches on the repo (HF installs carry no-// modelId/versionId).-function VideoSuggestionsSection({ cards, installedHfRepos, installingVideoRepo, installingVideoProgress, videoInstallBusy, onInstall }) {+// HF path. Installed-state matches the exact repo+file pair because a repo may+// publish multiple independently installable LoRA versions.+function VideoSuggestionsSection({ cards, installedHfKeys, installingVideoKey, installingVideoProgress, videoInstallBusy, onInstall }) {const list = cards || [];return (<div>@@ -567,19 +574,22 @@ function VideoSuggestionsSection({ cards, installedHfRepos, installingVideoRepo,<p className="text-xs text-gray-600 italic">No video LoRA suggestions yet.</p>) : (<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">- {list.map((card) => (- <VideoSuggestionCard- key={card.repo}- card={card}- installed={installedHfRepos?.has(card.repo)}- installing={installingVideoRepo === card.repo}- progress={installingVideoRepo === card.repo ? installingVideoProgress : null}- // Disable every quick-install button while ANY HF install is in- // flight (this card's, another card's, or the form's) — one at a time.- busy={!!installingVideoRepo || videoInstallBusy}- onInstall={onInstall}- />- ))}+ {list.map((card) => {+ const key = hfCardKey(card);+ return (+ <VideoSuggestionCard+ key={key}+ card={card}+ installed={installedHfKeys?.has(key)}+ installing={installingVideoKey === key}+ progress={installingVideoKey === key ? installingVideoProgress : null}+ // Disable every quick-install button while ANY HF install is in+ // flight (this card's, another card's, or the form's) — one at a time.+ busy={!!installingVideoKey || videoInstallBusy}+ onInstall={onInstall}+ />+ );+ })}</div>)}</div>diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex ffb946a806..53522a9eda 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -117,6 +117,7 @@ export default function MusicVideo() {const [cloning, setCloning] = useState(false);const [createOpen, setCreateOpen] = useState(false);const [videoModels, setVideoModels] = useState([]);+ const [videoModelsLoading, setVideoModelsLoading] = useState(true);const [videoLoras, setVideoLoras] = useState([]);const [defaultVideoModel, setDefaultVideoModel] = useState('');const [videoSettingsSaving, setVideoSettingsSaving] = useState(false);@@ -237,10 +238,12 @@ export default function MusicVideo() {// whose runtime supports both text and image conditioning.setVideoModels((status?.models || []).filter((model) => model.mode !== 't2v' && !model.deprecated));setDefaultVideoModel(status?.defaultModel || '');+ setVideoModelsLoading(false);}).catch(() => {setVideoModels([]);setDefaultVideoModel('');+ setVideoModelsLoading(false);});listLorasFull({ silent: true }).then((loras) => setVideoLoras(Array.isArray(loras) ? loras : []))@@ -471,6 +474,12 @@ export default function MusicVideo() {const renderableSceneCount = (selected?.scenes || []).filter((s) => s.videoHistoryId).length;const sceneCount = selected?.scenes?.length || 0;const referenceFrameCount = (selected?.scenes || []).filter((s) => s.referenceImageId).length;+ const uniqueReferenceFrameCount = new Set(+ (selected?.scenes || []).map((scene) => scene.referenceImageId).filter(Boolean),+ ).size;+ const uniqueVideoCount = new Set(+ (selected?.scenes || []).map((scene) => scene.videoHistoryId).filter(Boolean),+ ).size;const missingFrameCount = sceneCount - referenceFrameCount;const missingVideoCount = sceneCount - renderableSceneCount;const finalVideo = useVideoFileSrc(selected?.renderHistoryId, { enabled: !!selected?.renderHistoryId });@@ -488,10 +497,14 @@ export default function MusicVideo() {const activeVideoModel = videoModels.find((model) => model.id === effectiveVideoModelId) || null;const audioReactiveModels = videoModels.filter((model) =>model.runtime === 'ltx2' && /ltx.?2\.3|ltx23/i.test(`${model.id} ${model.name || ''} ${model.repo || ''}`));+ const audioReactiveLoras = videoLoras.filter((lora) =>+ /audio-reactive/i.test(`${lora.filename} ${lora.name || ''}`)+ && (lora.loraCompatKey || lora.runnerFamily) === 'ltx-video');const detectedAudioReactiveLora = videoLoras.find((lora) =>lora.filename === savedVideoSettings.audioReactiveLora)- || videoLoras.find((lora) => /audio-reactive/i.test(`${lora.filename} ${lora.name || ''}`)- && (lora.loraCompatKey || lora.runnerFamily) === 'ltx-video')+ || audioReactiveLoras.find((lora) =>+ /(?:^|[-_.\s])v2(?:[-_.\s]|$)/i.test(`${lora.filename} ${lora.name || ''}`))+ || audioReactiveLoras[0]|| null;const audioReactiveReady = !!(activeVideoModel?.runtime === 'ltx2'&& /ltx.?2\.3|ltx23/i.test(`${activeVideoModel.id} ${activeVideoModel.name || ''} ${activeVideoModel.repo || ''}`)@@ -1020,6 +1033,22 @@ export default function MusicVideo() {</select>{audioReactiveSelected && (<>+ <label htmlFor="mv-audio-reactive-lora" className="sr-only">Audio reactive LoRA</label>+ <select+ id="mv-audio-reactive-lora"+ value={savedVideoSettings.audioReactiveLora || detectedAudioReactiveLora?.filename || ''}+ onChange={(e) => handleVideoSettingsChange({ audioReactiveLora: e.target.value })}+ disabled={videoSettingsSaving || Object.keys(genVideoScenes).length > 0 || audioReactiveLoras.length === 0}+ title="Saved audio-reactive LoRA version for this project"+ className="max-w-[220px] bg-port-bg border border-port-border rounded px-1.5 py-1.5 text-sm disabled:opacity-50"+ >+ {audioReactiveLoras.length === 0 && <option value="">No audio-reactive LoRA installed</option>}+ {audioReactiveLoras.map((lora) => (+ <option key={lora.filename} value={lora.filename}>+ {lora.name || lora.filename}+ </option>+ ))}+ </select><label htmlFor="mv-audio-reactive-scale" className="sr-only">Audio reactive LoRA strength</label><selectid="mv-audio-reactive-scale"@@ -1034,10 +1063,16 @@ export default function MusicVideo() {<option value={1.5}>Reactive 1.5×</option></select><span- className={`text-[10px] px-1.5 py-0.5 rounded ${audioReactiveReady ? 'bg-port-success/20 text-port-success' : 'bg-port-error/20 text-port-error'}`}+ className={`text-[10px] px-1.5 py-0.5 rounded ${+ audioReactiveReady+ ? 'bg-port-success/20 text-port-success'+ : (videoModelsLoading ? 'bg-port-warning/20 text-port-warning' : 'bg-port-error/20 text-port-error')+ }`}title={detectedAudioReactiveLora?.filename || 'Audio-reactive LoRA not installed'}>- {audioReactiveReady ? 'song-conditioned · no vocals' : 'audio-reactive unavailable'}+ {audioReactiveReady+ ? 'song-conditioned · no vocals'+ : (videoModelsLoading ? 'checking local runtime…' : 'audio-reactive unavailable')}</span></>)}@@ -1078,6 +1113,14 @@ export default function MusicVideo() {><Video size={15} /> Videos {renderableSceneCount}/{sceneCount}</button>+ {(uniqueReferenceFrameCount < referenceFrameCount || uniqueVideoCount < renderableSceneCount) && (+ <span+ className="text-[10px] px-2 py-1.5 rounded border border-port-warning/40 bg-port-warning/10 text-port-warning"+ title={`${referenceFrameCount - uniqueReferenceFrameCount} scene${referenceFrameCount - uniqueReferenceFrameCount === 1 ? '' : 's'} reuse a reference frame; ${renderableSceneCount - uniqueVideoCount} reuse a video clip`}+ >+ Repetition: {uniqueReferenceFrameCount} unique frames · {uniqueVideoCount} unique clips+ </span>+ )}<buttononClick={handleClone}disabled={cloning}diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex f95aa6f617..d07276e520 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -60,6 +60,11 @@ vi.mock('../services/apiImageVideo.js', () => ({name: 'Audio Reactive',loraCompatKey: 'ltx-video',recommendedScale: 1.2,+ }, {+ filename: 'audio-reactive-v2.safetensors',+ name: 'Audio Reactive V2',+ loraCompatKey: 'ltx-video',+ recommendedScale: 1.2,}]),getVideoGenStatus: vi.fn(async () => ({connected: true,@@ -244,7 +249,7 @@ describe('MusicVideo project video renderer', () => {{videoSettings: expect.objectContaining({generationMode: 'audioReactive',- audioReactiveLora: 'audio-reactive.safetensors',+ audioReactiveLora: 'audio-reactive-v2.safetensors',modelId: 'ltx23_distilled_q4',}),},@@ -259,11 +264,46 @@ describe('MusicVideo project video renderer', () => {sourceImageFile: 'img1',audioStartSec: 0,disableAudio: true,- loraFilenames: ['audio-reactive.safetensors'],+ loraFilenames: ['audio-reactive-v2.safetensors'],loraScales: [1.2],prompt: expect.stringMatching(/No singing, lip-sync, speaking, mouth movement/i),})));});++ it('lets the project pin an exact installed audio-reactive LoRA version', async () => {+ await openProject({+ ...PROJECT_NO_CLIP,+ videoSettings: {+ backend: 'local',+ modelId: 'ltx23_distilled_q4',+ generationMode: 'audioReactive',+ audioReactiveLora: 'audio-reactive-v2.safetensors',+ audioReactiveScale: 1.2,+ },+ });++ const lora = await screen.findByLabelText('Audio reactive LoRA');+ expect(lora.value).toBe('audio-reactive-v2.safetensors');+ fireEvent.change(lora, { target: { value: 'audio-reactive.safetensors' } });++ await waitFor(() => expect(updateMusicVideoProject).toHaveBeenCalledWith(+ 'mv-2',+ { videoSettings: { audioReactiveLora: 'audio-reactive.safetensors' } },+ { silent: true },+ ));+ });++ it('warns when ready scenes reuse the same frames and clips', async () => {+ await openProject({+ ...PROJECT_WITH_CLIP,+ scenes: [+ PROJECT_WITH_CLIP.scenes[0],+ { ...PROJECT_WITH_CLIP.scenes[0], sceneId: 's2', order: 1 },+ ],+ });++ expect(await screen.findByText('Repetition: 1 unique frames · 1 unique clips')).toBeTruthy();+ });});describe('MusicVideo project versions', () => {diff --git a/client/src/services/apiImageVideo.js b/client/src/services/apiImageVideo.jsindex 624219e38e..875da236d6 100644--- a/client/src/services/apiImageVideo.js+++ b/client/src/services/apiImageVideo.js@@ -411,9 +411,9 @@ export const installLoraFromCivitai = ({ url, silent = false } = {}) => request(// `family` is an optional override (e.g. 'ltx-video') when autodetection from// the repo id/tags can't classify it. `silent` lets the page route HF_AUTH /// HF_UNKNOWN_FAMILY errors into its own inline UI.-export const installLoraFromHuggingface = ({ url, family, silent = false } = {}) => request('/loras/install/huggingface', {+export const installLoraFromHuggingface = ({ url, family, file, silent = false } = {}) => request('/loras/install/huggingface', {method: 'POST',- body: JSON.stringify(family ? { url, family } : { url }),+ body: JSON.stringify({ url, ...(family ? { family } : {}), ...(file ? { file } : {}) }),silent,});@@ -434,11 +434,11 @@ export const installLoraFromHuggingface = ({ url, family, silent = false } = {})// — a 401 AUTH_REQUIRED bounces to /login via maybeRedirectToLogin exactly like// request(), instead of dead-ending on a generic stream error. Frames are// SSE-encoded (`data: {json}\n\n`).-export async function installLoraFromHuggingfaceStream({ url, family, onProgress, signal } = {}) {+export async function installLoraFromHuggingfaceStream({ url, family, file, onProgress, signal } = {}) {const response = await fetch(`${API_BASE}/loras/install/huggingface/stream`, {method: 'POST',headers: { 'Content-Type': 'application/json' },- body: JSON.stringify(family ? { url, family } : { url }),+ body: JSON.stringify({ url, ...(family ? { family } : {}), ...(file ? { file } : {}) }),signal,});if (!response.ok || !response.body?.getReader) {diff --git a/scripts/generate_ltx2.py b/scripts/generate_ltx2.pyindex 1bf35652ba..47888c1c56 100644--- a/scripts/generate_ltx2.py+++ b/scripts/generate_ltx2.py@@ -64,6 +64,9 @@ import sysfrom pathlib import Pathfrom typing import NoReturn+DISTILLED_LORA_V11 = "ltx-2.3-22b-distilled-lora-384-1.1.safetensors"+DISTILLED_LORA_LEGACY = "ltx-2.3-22b-distilled-lora-384.safetensors"+# Must be set BEFORE any ltx_core_mlx import: ltx_core_mlx.model.transformer.model# reads LTX2_DIT_EVAL_EVERY at import time. Phosphene's M4 Max 64 GB I2V Balanced# 5s / 121 f matrix: upstream default =8 runs ~3 min/step (per-block Metal@@ -381,8 +384,8 @@ def parse_args() -> argparse.Namespace:"Default for fflf: transformer-dev.safetensors (matches dgrauet/ltx-2.3-mlx-q4 + q8 layouts).")p.add_argument("--distilled-lora", default=None,help="Filename of the distilled LoRA inside the model repo, fused on top of the "- "dev transformer for stage 2. Default for fflf: "- "ltx-2.3-22b-distilled-lora-384.safetensors.")+ "dev transformer for stage 2. By default PortOS prefers the 1.1 adapter "+ "when the selected model includes it, otherwise it uses the legacy adapter.")p.add_argument("--lora-strength", type=float, default=1.0,help="Distilled-LoRA fusion strength (default 1.0, matches dgrauet's CLI).")p.add_argument("--user-loras", default=None,@@ -589,6 +592,30 @@ def _one_stage_kwargs(args: argparse.Namespace, **extra) -> dict:return kwargs+def _prefer_distilled_lora(pipe, requested: str | None) -> str:+ """Select the newest compatible distilled adapter already in model_dir.++ BasePipeline resolves a HuggingFace repo ID to its cached snapshot during+ construction, but does not load the transformer until generate_and_save().+ That gives the bridge a safe point to prefer the 1.1 adapter without+ making a separate Hub metadata request. Repositories that do not carry 1.1+ keep using the legacy file; an explicit CLI value always wins.+ """+ selected = requested+ if selected is None:+ selected = next(+ (+ filename+ for filename in (DISTILLED_LORA_V11, DISTILLED_LORA_LEGACY)+ if (Path(pipe.model_dir) / filename).exists()+ ),+ DISTILLED_LORA_LEGACY,+ )+ pipe._distilled_lora = selected+ emit_status(f"Using distilled adapter {selected}")+ return selected++def run_two_stage(args: argparse.Namespace, image: str | None = None) -> str:"""T2V/I2V path that honors CFG via the dgrauet two-stage pipeline."""TwoStagePipeline = _resolve_pipeline("TI2VidTwoStagesPipeline", "TwoStagePipeline")@@ -598,9 +625,10 @@ def run_two_stage(args: argparse.Namespace, image: str | None = None) -> str:model_dir=args.model,gemma_model_id=args.gemma,dev_transformer=args.dev_transformer or "transformer-dev.safetensors",- distilled_lora=args.distilled_lora or "ltx-2.3-22b-distilled-lora-384.safetensors",+ distilled_lora=args.distilled_lora or DISTILLED_LORA_LEGACY,distilled_lora_strength=args.lora_strength,)+ _prefer_distilled_lora(pipe, args.distilled_lora)_apply_user_loras(pipe, args.user_lora_specs)bind_output_fps(pipe, args.fps)emit_stage(1, 1, 1, "Loaded")@@ -727,7 +755,7 @@ def run_fflf(args: argparse.Namespace) -> str:# can override via --dev-transformer / --distilled-lora when a future# repo renames them.dev_transformer = args.dev_transformer or "transformer-dev.safetensors"- distilled_lora = args.distilled_lora or "ltx-2.3-22b-distilled-lora-384.safetensors"+ distilled_lora = args.distilled_lora or DISTILLED_LORA_LEGACYemit_status(f"Loading Keyframe pipeline ({args.model}, dev+lora)…")emit_stage(1, 0, 1, "Loading model")pipe = KeyframeInterpolationPipeline(@@ -737,6 +765,7 @@ def run_fflf(args: argparse.Namespace) -> str:distilled_lora=distilled_lora,distilled_lora_strength=args.lora_strength,)+ _prefer_distilled_lora(pipe, args.distilled_lora)_apply_user_loras(pipe, args.user_lora_specs)emit_stage(1, 1, 1, "Loaded")emit_status(f"Interpolating between {len(keyframe_images)} keyframes at indices {keyframe_indices}…")@@ -829,6 +858,7 @@ def run_a2v(args: argparse.Namespace) -> str:emit_status(f"Loading A2V pipeline ({args.model})…")emit_stage(1, 0, 1, "Loading model")pipe = AudioToVideoPipeline(model_dir=args.model, gemma_model_id=args.gemma)+ _prefer_distilled_lora(pipe, args.distilled_lora)_apply_user_loras(pipe, args.user_lora_specs)emit_stage(1, 1, 1, "Loaded")emit_status(f"Generating A2V from {Path(args.audio).name}…")diff --git a/scripts/generate_ltx2_teacache_test.py b/scripts/generate_ltx2_teacache_test.pyindex 74cbb1fc02..fdd93c8715 100644--- a/scripts/generate_ltx2_teacache_test.py+++ b/scripts/generate_ltx2_teacache_test.py@@ -4,6 +4,7 @@ from __future__ import annotationsimport importlib.utilimport sys+import tempfileimport typesimport unittestfrom types import SimpleNamespace@@ -125,6 +126,31 @@ class GenerateLtx2TeaCacheTest(unittest.TestCase):with self.assertRaises(SystemExit):self.helper._resolve_pipeline("Nope1", "Nope2")+ def test_prefers_v11_distilled_lora_when_model_contains_it(self):+ with tempfile.TemporaryDirectory() as model_dir:+ Path(model_dir, self.helper.DISTILLED_LORA_V11).touch()+ Path(model_dir, self.helper.DISTILLED_LORA_LEGACY).touch()+ pipe = SimpleNamespace(+ model_dir=Path(model_dir),+ _distilled_lora=self.helper.DISTILLED_LORA_LEGACY,+ )+ selected = self.helper._prefer_distilled_lora(pipe, None)+ self.assertEqual(selected, self.helper.DISTILLED_LORA_V11)+ self.assertEqual(pipe._distilled_lora, self.helper.DISTILLED_LORA_V11)++ def test_distilled_lora_falls_back_and_honors_explicit_override(self):+ with tempfile.TemporaryDirectory() as model_dir:+ Path(model_dir, self.helper.DISTILLED_LORA_LEGACY).touch()+ pipe = SimpleNamespace(model_dir=Path(model_dir), _distilled_lora=None)+ self.assertEqual(+ self.helper._prefer_distilled_lora(pipe, None),+ self.helper.DISTILLED_LORA_LEGACY,+ )+ self.assertEqual(+ self.helper._prefer_distilled_lora(pipe, "custom.safetensors"),+ "custom.safetensors",+ )+def test_rate_kwarg_name_prefers_frame_rate_over_fps(self):def both(a, frame_rate=1, fps=2):passdiff --git a/scripts/setup-image-video.sh b/scripts/setup-image-video.shindex f8a92bfbbd..707dacdf9f 100755--- a/scripts/setup-image-video.sh+++ b/scripts/setup-image-video.sh@@ -220,7 +220,7 @@ if [[ "$INSTALL_LTX2" == "1" ]]; thenecho "❌ INSTALL_LTX2=1 requires git." >&2exit 1fi- # Pinned to v0.14.8 (2026-05-22). To upgrade: bump this SHA and verify with+ # Pinned to v0.14.19 (2026-07-19). To upgrade: bump this SHA and verify with# PortOS's video gen smoke tests (text/image/fflf/extend/a2v). Set# LTX2_PIN=main to bypass the pin and track upstream HEAD for development.# NOTE: v0.14.x renamed every public pipeline class (TextToVideoPipeline →@@ -228,7 +228,7 @@ if [[ "$INSTALL_LTX2" == "1" ]]; then# the output-rate kwarg from `fps` to `frame_rate`. generate_ltx2.py resolves# pipeline classes and the rate kwarg defensively so it works against this pin# AND older pre-rename pins an install may still have checked out.- LTX2_PIN="${LTX2_PIN:-d2ad8e9948157c14a063aca54e510d3d80c2c463}"+ LTX2_PIN="${LTX2_PIN:-1192051fd380e0501adb5f3c0e9a216e679cb123}"LTX2_DIR="${HOME}/.portos/ltx-2-mlx"LTX2_PY="${LTX2_DIR}/.venv/bin/python3"mkdir -p "${HOME}/.portos"diff --git a/server/lib/README.md b/server/lib/README.mdindex 5b5a5b557f..5c91cdae4c 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -232,7 +232,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `chiptuneRender.js` | Deterministic chiptune score → mono PCM → 16-bit WAV buffer (pure Node, no audio deps); `renderScoreToPcm` / `pcmToWavBuffer` / `renderScoreToWav`. || `chiptuneScore.js` | Chiptune score contract (#2911): `chiptuneScoreSchema` (Zod) + `sanitizeChiptuneScore`, pitch math (`pitchToMidi`/`midiToFreq`), and `buildScoreEvents` — the pattern/order → absolute-time flatten mirrored by `client/src/lib/chiptunePlayback.js`. || `civitai.js` | Civitai URL parsing + API client. |-| `huggingfaceLora.js` | HuggingFace LoRA import helpers: parse HF ref → `{repo,revision}`, fetch `/api/models` metadata, pick the `.safetensors`, detect the video-LoRA family (`ltx-video`), build the sidecar + `resolve` download URL. The HF analogue of `civitai.js` for video LoRAs. Pure. |+| `huggingfaceLora.js` | HuggingFace LoRA import helpers: parse HF ref → `{repo,revision}`, fetch `/api/models` metadata, select an exact or preferred `.safetensors`, detect the video-LoRA family (`ltx-video`), build the sidecar + `resolve` download URL. The HF analogue of `civitai.js` for video LoRAs. Pure. || `huggingfaceModel.js` | HuggingFace base-model (image/video) classifier for the self-service "add a model" flow (#2124): inspect repo siblings + card → decide the loadable runtime/runner, STRICTLY refuse GGUF-only / wan / hunyuan / unclassifiable repos (so a bad add can't wedge the picker), build the `media-models.json` entry (`source:'user'`), + a `searchHuggingfaceModels` Hub-search helper. Pure. || `localLlmCatalog.js` | Curated cross-backend (Ollama↔LM Studio) local-LLM catalog + install-id mapping for the migrate flow. Pure. || `localLlmDisk.js` | Pure on-disk reasoning for the migrate "copy GGUF locally instead of re-downloading" fast-path (Ollama manifest/blob parsing, LM Studio path layout, MLX/projector/shard detection) plus the Hugging Face registry addressing used to finish an abandoned Ollama pull. |diff --git a/server/lib/huggingfaceLora.js b/server/lib/huggingfaceLora.jsindex 9e5f53c47d..60111a829c 100644--- a/server/lib/huggingfaceLora.js+++ b/server/lib/huggingfaceLora.js@@ -134,12 +134,11 @@ export const modelSiblingFilenames = (model) => {const safetensorsSiblings = (model) =>modelSiblingFilenames(model).filter((f) => /\.safetensors$/i.test(f));-// Pick the LoRA weights file to download. Most LoRA repos ship a single-// .safetensors; when several are present we prefer the canonical diffusers-// filename, then anything with "lora" in the name, then the first. Throws when-// the repo has none (it's not a LoRA weights repo, or weights are split into a-// subdir we don't recognize).-export const pickHfLoraFile = (model) => {+// Pick the LoRA weights file to download. An explicit file must exactly match a+// .safetensors sibling — this lets curated cards select a versioned artifact+// from repos that publish several LoRAs without accepting an arbitrary path.+// Without an explicit file, preserve the legacy canonical-name preference.+export const pickHfLoraFile = (model, preferredFile = null) => {const files = safetensorsSiblings(model);if (!files.length) {throw new ServerError(@@ -147,6 +146,16 @@ export const pickHfLoraFile = (model) => {{ status: 422, code: 'HF_NO_SAFETENSORS' },);}+ if (preferredFile) {+ const exact = files.find((file) => file === preferredFile);+ if (!exact) {+ throw new ServerError(+ `HuggingFace repo ${model?.id || model?.modelId || ''} does not contain ${preferredFile}`,+ { status: 422, code: 'HF_FILE_NOT_FOUND' },+ );+ }+ return exact;+ }if (files.length === 1) return files[0];const canonical = files.find((f) => /(^|\/)pytorch_lora_weights\.safetensors$/i.test(f))|| files.find((f) => /(^|\/)lora\.safetensors$/i.test(f))@@ -214,9 +223,10 @@ export const buildHfLoraSidecar = ({ repo, revision, file, model, family, filena? model.cardData.instance_prompt.trim(): '';const description = extractHfCardDescription(model, DESCRIPTION_MAX_CHARS);+ const isV2 = /(?:^|[-_.])v2(?:[-_.]|$)/i.test(file);return {filename,- name: repo.split('/')[1] || repo,+ name: `${repo.split('/')[1] || repo}${isV2 ? ' V2' : ''}`,description,huggingface: {repo,@@ -229,7 +239,7 @@ export const buildHfLoraSidecar = ({ repo, revision, file, model, family, filenarunnerFamily: family,fluxVariant: null,triggerWords: instancePrompt ? [instancePrompt] : [],- recommendedScale: 1.0,+ recommendedScale: isV2 ? 1.2 : 1.0,file: {sizeKB: null,hashes: {},diff --git a/server/lib/huggingfaceLora.test.js b/server/lib/huggingfaceLora.test.jsindex d19bd7e369..15e4b75a32 100644--- a/server/lib/huggingfaceLora.test.js+++ b/server/lib/huggingfaceLora.test.js@@ -77,6 +77,16 @@ describe('pickHfLoraFile', () => {expect(pickHfLoraFile(m('model.safetensors', 'my_style_lora.safetensors'))).toBe('my_style_lora.safetensors');});+ it('selects an exact versioned file when requested', () => {+ const model = {+ id: 'fal/audio-reactive',+ ...m('audio_reactive.safetensors', 'audio_reactive_v2.safetensors'),+ };+ expect(pickHfLoraFile(model, 'audio_reactive_v2.safetensors'))+ .toBe('audio_reactive_v2.safetensors');+ expect(() => pickHfLoraFile(model, 'audio_reactive_v3.safetensors'))+ .toThrow(/does not contain audio_reactive_v3/);+ });it('throws when there is no .safetensors', () => {expect(() => pickHfLoraFile(m('config.json', 'README.md'))).toThrow(/no .safetensors/);});@@ -118,6 +128,19 @@ describe('buildHfLoraSidecar', () => {expect(sidecar.civitai).toBeUndefined();expect(sidecar.file.downloadUrl).toContain('/resolve/main/lora.safetensors');});++ it('labels a V2 LoRA distinctly and uses its recommended scale', () => {+ const sidecar = buildHfLoraSidecar({+ repo: 'fal/ltx2.3-audio-reactive-lora',+ revision: null,+ file: 'ltx2.3_audio_reactive_lora_v2.safetensors',+ family: VIDEO_LORA_FAMILIES.LTX_VIDEO,+ filename: 'lora-fal-ltx2.3-audio-reactive-lora-v2-hf.safetensors',+ model: {},+ });+ expect(sidecar.name).toBe('ltx2.3-audio-reactive-lora V2');+ expect(sidecar.recommendedScale).toBe(1.2);+ });});describe('fetchHuggingfaceModel', () => {diff --git a/server/routes/loras.js b/server/routes/loras.jsindex 39e8ef596e..96a5c0c806 100644--- a/server/routes/loras.js+++ b/server/routes/loras.js@@ -139,6 +139,7 @@ router.post('/install', asyncHandler(async (req, res) => {const hfInstallSchema = z.object({url: z.string().min(1).max(1024),family: z.enum(Object.values(VIDEO_LORA_FAMILIES)).optional(),+ file: z.string().min(1).max(512).regex(/\.safetensors$/i).optional(),// One-shot token override; absence falls back to the stored/env/CLI HF token.token: z.string().min(1).max(256).optional(),});@@ -163,6 +164,7 @@ router.post('/install/huggingface', asyncHandler(async (req, res) => {const hfInstallStreamSchema = z.object({url: z.string().min(1).max(1024),family: z.enum(Object.values(VIDEO_LORA_FAMILIES)).optional(),+ file: z.string().min(1).max(512).regex(/\.safetensors$/i).optional(),});router.post('/install/huggingface/stream', asyncHandler(async (req, res) => {const data = validateRequest(hfInstallStreamSchema, req.body);diff --git a/server/routes/loras.test.js b/server/routes/loras.test.jsindex ed426d7bab..799569590a 100644--- a/server/routes/loras.test.js+++ b/server/routes/loras.test.js@@ -83,7 +83,10 @@ describe('POST /api/loras/install/huggingface/stream', () => {it('streams byte-progress frames then a complete frame carrying the sidecar', async () => {const res = await request(makeApp()).post('/api/loras/install/huggingface/stream')- .send({ url: 'fal/ltx2.3-audio-reactive-lora' });+ .send({+ url: 'fal/ltx2.3-audio-reactive-lora',+ file: 'ltx2.3_audio_reactive_lora_v2.safetensors',+ });expect(res.status).toBe(200);const frames = parseSseFrames(res.text);// The service double emitted 4/8 then 8/8 → progress 0.5 then 1.@@ -92,7 +95,10 @@ describe('POST /api/loras/install/huggingface/stream', () => {expect(complete?.sidecar?.runnerFamily).toBe('ltx-video');// The body carries through to the service, with an AbortSignal + progress cb.expect(installFromHuggingface).toHaveBeenCalledWith(- expect.objectContaining({ url: 'fal/ltx2.3-audio-reactive-lora' }),+ expect.objectContaining({+ url: 'fal/ltx2.3-audio-reactive-lora',+ file: 'ltx2.3_audio_reactive_lora_v2.safetensors',+ }),expect.objectContaining({ onProgress: expect.any(Function), signal: expect.any(Object) }),);});@@ -116,6 +122,13 @@ describe('POST /api/loras/install/huggingface/stream', () => {.send({ url: 'x/y', family: 'bogus' });expect(res.status).toBe(400);});++ it('rejects a requested file that is not safetensors before opening the stream', async () => {+ const res = await request(makeApp())+ .post('/api/loras/install/huggingface/stream')+ .send({ url: 'x/y', file: 'README.md' });+ expect(res.status).toBe(400);+ });});describe('GET /api/loras/search', () => {diff --git a/server/services/loras.js b/server/services/loras.jsindex aff8aa5454..e869089cce 100644--- a/server/services/loras.js+++ b/server/services/loras.js@@ -497,7 +497,7 @@ export const installFromHuggingface = async (input, { fetchImpl = fetch, onProgr// send on public ones (HF ignores a bearer it doesn't require).const token = (typeof input?.token === 'string' && input.token.trim()) || (await getHfToken()) || '';const model = await fetchHuggingfaceModel(repo, { token, revision, fetchImpl });- const file = pickHfLoraFile(model);+ const file = pickHfLoraFile(model, input?.file || null);// Family: explicit override (validated) wins over autodetection so a user// can correct a mis-detected repo from the UI. An unrecognized repo with no@@ -522,11 +522,19 @@ export const installFromHuggingface = async (input, { fetchImpl = fetch, onProgr);}- // Stable filename: `lora-<org>-<name>-hf.safetensors`. The org+name slug- // disambiguates same-named LoRAs from different authors; the `-hf` suffix- // keeps it distinct from a Civitai install of the same model.+ // Stable filename: `lora-<org>-<name>[-<file-variant>]-hf.safetensors`.+ // No explicit file preserves the original filename contract. A versioned+ // file from the same repo (for example `_v2`) gets a distinct suffix so both+ // artifacts can coexist and projects can pin either one.const slug = slugifyForFilename(repo.replace('/', '-'));- const filename = `lora-${slug}-hf.safetensors`;+ const repoNameSlug = slugifyForFilename((repo.split('/')[1] || repo).replace(/_/g, '-'));+ const fileStemSlug = slugifyForFilename(file.replace(/\.safetensors$/i, '').split('/').pop().replace(/_/g, '-'));+ const explicitVariant = input?.file+ ? (fileStemSlug.startsWith(`${repoNameSlug}-`)+ ? fileStemSlug.slice(repoNameSlug.length + 1)+ : (fileStemSlug === repoNameSlug ? '' : fileStemSlug))+ : '';+ const filename = `lora-${slug}${explicitVariant ? `-${explicitVariant}` : ''}-hf.safetensors`;const destPath = join(PATHS.loras, filename);if (existsSync(destPath)) {throw new ServerError(diff --git a/server/services/loras.test.js b/server/services/loras.test.jsindex b7254f0b01..9ea1b82acd 100644--- a/server/services/loras.test.js+++ b/server/services/loras.test.js@@ -501,6 +501,40 @@ describe('installFromHuggingface', () => {expect(calls.some((u) => u.includes('/resolve/main/pytorch_lora_weights.safetensors'))).toBe(true);});+ it('installs an exact versioned file beside the repo default', async () => {+ const versionedModel = {+ ...HF_MODEL,+ siblings: [+ ...HF_MODEL.siblings,+ { rfilename: 'ltx2.3_audio_reactive_lora_v2.safetensors' },+ ],+ };+ const fetchImpl = async (url) => {+ if (url.startsWith('https://huggingface.co/api/models/')) {+ return mockJsonResponse(versionedModel);+ }+ if (url.includes('/resolve/main/ltx2.3_audio_reactive_lora_v2.safetensors')) {+ const stream = new ReadableStream({+ start(c) { c.enqueue(new Uint8Array(validSafetensors())); c.close(); },+ });+ return { ok: true, status: 200, body: stream };+ }+ throw new Error(`unexpected fetch: ${url}`);+ };+ const sidecar = await lorasService.installFromHuggingface(+ {+ url: 'https://huggingface.co/fal/ltx2.3-audio-reactive-lora',+ file: 'ltx2.3_audio_reactive_lora_v2.safetensors',+ token: 'hf_test',+ },+ { fetchImpl },+ );+ expect(sidecar.filename).toBe('lora-fal-ltx2.3-audio-reactive-lora-v2-hf.safetensors');+ expect(sidecar.huggingface.file).toBe('ltx2.3_audio_reactive_lora_v2.safetensors');+ expect(sidecar.name).toMatch(/V2$/);+ expect(sidecar.recommendedScale).toBe(1.2);+ });+it('refuses a repo it cannot classify as a supported video family', async () => {const fetchImpl = async (url) => {if (url.startsWith('https://huggingface.co/api/models/')) {diff --git a/server/services/videoLoraSuggestions.js b/server/services/videoLoraSuggestions.jsindex 31f5845ead..2d2383aa86 100644--- a/server/services/videoLoraSuggestions.js+++ b/server/services/videoLoraSuggestions.js@@ -28,9 +28,10 @@ const DESCRIPTION_MAX_CHARS = 240;const CURATED_VIDEO_LORAS = [{repo: 'fal/ltx2.3-audio-reactive-lora',+ file: 'ltx2.3_audio_reactive_lora_v2.safetensors',family: VIDEO_LORA_FAMILIES.LTX_VIDEO,- name: 'LTX-2.3 Audio Reactive',- note: 'Drives camera and scene energy from an audio track — built for LTX-2 (ltx2) video renders.',+ name: 'LTX-2.3 Audio Reactive V2',+ note: 'Improved beat response for LTX-2.3 audio-conditioned renders. Use music as motion guidance; PortOS keeps generated vocals disabled.',},];@@ -51,6 +52,7 @@ const buildCard = (entry, model) => {return {source: 'huggingface',repo: entry.repo,+ file: entry.file || null,name: entry.name || (entry.repo.split('/')[1] || entry.repo),note: entry.note || '',description,diff --git a/server/services/videoLoraSuggestions.test.js b/server/services/videoLoraSuggestions.test.jsindex e90ce514ad..bc281118b0 100644--- a/server/services/videoLoraSuggestions.test.js+++ b/server/services/videoLoraSuggestions.test.js@@ -22,6 +22,8 @@ describe('getVideoSuggestions', () => {expect(card.source).toBe('huggingface');expect(card.runnerFamily).toBe('ltx-video');expect(card.repo).toBe('fal/ltx2.3-audio-reactive-lora');+ expect(card.file).toBe('ltx2.3_audio_reactive_lora_v2.safetensors');+ expect(card.name).toBe('LTX-2.3 Audio Reactive V2');expect(card.description).toBe('Audio-reactive LTX LoRA.');expect(card.previewImageUrl).toBe('https://hf/preview.png');expect(card.installUrl).toBe('https://huggingface.co/fal/ltx2.3-audio-reactive-lora');@@ -32,6 +34,7 @@ describe('getVideoSuggestions', () => {const cards = await svc.getVideoSuggestions({ fetchImpl });expect(cards.length).toBeGreaterThan(0);expect(cards[0].repo).toBe('fal/ltx2.3-audio-reactive-lora');+ expect(cards[0].file).toBe('ltx2.3_audio_reactive_lora_v2.safetensors');expect(cards[0].runnerFamily).toBe('ltx-video');// No metadata → no description / preview, but the card is still usable.expect(cards[0].description).toBe('');