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: restyle Video Gen and drop the MiniMax H3 eligibility checkbox
[._.]/ Adam Eivyc81357592f42
diff --git a/.changelog/next/changed-main.md b/.changelog/next/changed-main.mdnew file mode 100644index 0000000000..242f8cf4b0--- /dev/null+++ b/.changelog/next/changed-main.md@@ -0,0 +1,2 @@+- Video Gen drops the Preview card: advanced settings stay open in the form, and Prompt from media lives in the right-hand column.+- MiniMax H3 no longer asks for an eligibility checkbox — the Community License and excluded territories stay in the model details, and download / generate are not blocked.diff --git a/.changelog/next/fixed-main.md b/.changelog/next/fixed-main.mdindex 11af3a0e1c..a84aac7dd3 100644--- a/.changelog/next/fixed-main.md+++ b/.changelog/next/fixed-main.md@@ -3,3 +3,4 @@- Windows: orphaned and merged CoS worktrees were never cleaned up, because git reports POSIX paths while PortOS built Windows ones- Series Autopilot retires a queued gap task when a new run starts, so CoS stops dispatching agents against findings the resumed run has already repaired- Single-file HuggingFace downloads no longer sit at 100% for the whole transfer — the badge now tracks bytes.+- Enhance with AI and Prompt from media stay usable during a video render so the next clip can be queued.diff --git a/PLAN.md b/PLAN.mdindex b86976fa82..082bdfaf64 100644--- a/PLAN.md+++ b/PLAN.md@@ -340,7 +340,7 @@ is not reliably announced.### Show the restricted-model license gate on the remaining video render surfaces-- [ ] A restricted video model's license acknowledgement is now an install-wide recorded fact (`settings.videoGen.acceptedModelTerms`, written through `POST /api/video-gen/model-terms`), and `ModelTermsGate` + `useVideoModelTerms` are shared so any surface can render the acceptance UI. Two do: `client/src/pages/VideoGen.jsx` and the music-video board (`client/src/pages/MusicVideo.jsx` via `useMusicVideoModelSettings`). The other surfaces that let a user pin a video model still dead-end on the server's 403 the first time — before anything has been accepted anywhere: `client/src/pages/CreativeDirector.jsx` (`<ModelSelect>` per project), `client/src/components/creative-commission/CommissionConfigForm.jsx` (`videoModelId`, including cron-scheduled runs), `client/src/components/pipeline/stages/EpisodeVideoStage.jsx`, `client/src/components/media/MediaJobsQueue.jsx`'s edit-and-retry (free-text `modelId`, re-enqueued via `server/routes/mediaJobs.js` so it never passes through `prepareVideoGenParams`), and `client/src/components/media/PromptRefineModal.jsx`'s requeue. **The call to make:** don't hand-wire a gate into five components — handle `VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED` once, centrally, so future surfaces are covered for free: catch the code in `client/src/services/apiCore.js`'s error path (and in the media-job failure channel, where a queue-time rejection arrives as a message with no `code` — `server/lib/videoDisclosure.js#videoModelTermsError` is the single wording to match on) and open a `ModelTermsGate` modal seeded from the failing model's `termsGate`. The interim mitigation already shipped: that error names where the acknowledgement is made, so a blocked user on any surface has a path. Surfaced by the /simplify altitude review.+- [x] Dropped the MiniMax H3 execution-gate checkbox instead of spreading it to the remaining surfaces. The Community License and excluded territories stay in the Video Gen model disclosure; download and generate no longer 403 on a missing acknowledgement. The `/api/video-gen/model-terms` settings record is kept for older installs.### Let runner mode recover when the cos-runner app comes up after the serverdiff --git a/client/src/components/media/PromptFromMedia.jsx b/client/src/components/media/PromptFromMedia.jsxindex d028ea5db0..5a2c4386f8 100644--- a/client/src/components/media/PromptFromMedia.jsx+++ b/client/src/components/media/PromptFromMedia.jsx@@ -217,7 +217,7 @@ export default function PromptFromMedia({)}{isOpen && (- <div className="p-3 bg-port-bg/70 border border-port-border rounded-lg space-y-3">+ <div className={alwaysOpen ? 'space-y-3' : 'p-3 bg-port-bg/70 border border-port-border rounded-lg space-y-3'}><div className="flex flex-wrap items-center gap-2"><buttontype="button"diff --git a/client/src/components/media/PromptFromMedia.test.jsx b/client/src/components/media/PromptFromMedia.test.jsxindex 9acc983705..1a5165d01e 100644--- a/client/src/components/media/PromptFromMedia.test.jsx+++ b/client/src/components/media/PromptFromMedia.test.jsx@@ -109,4 +109,10 @@ describe('PromptFromMedia', () => {});expect(screen.getByText('the camera dollies past the subject')).toBeInTheDocument();});++ it('skips the disclosure toggle when hosted as an always-open card', () => {+ renderPanel({ alwaysOpen: true, initialSource: null });+ expect(screen.queryByRole('button', { name: /toggle prompt from media/i })).toBeNull();+ expect(screen.getByRole('button', { name: /pick image/i })).toBeInTheDocument();+ });});diff --git a/client/src/components/videoGen/AdvancedParamsPanel.jsx b/client/src/components/videoGen/AdvancedParamsPanel.jsxindex 11bc700068..e41f0467c7 100644--- a/client/src/components/videoGen/AdvancedParamsPanel.jsx+++ b/client/src/components/videoGen/AdvancedParamsPanel.jsx@@ -1,24 +1,12 @@/**- * "Advanced" disclosure for the local-backend sampler knobs — frames, chunks- * (plus their optional per-chunk prompt beats), fps, seed, steps, CFG scale,- * image strength, tiling and the audio flags.- *- * Closed by default so the Generate button sits above the fold on /media/video- * the way it already does on the sibling /media/image tab (issue #3279), which- * keeps only Model + Resolution inline too. Every value lives in the VideoGen- * page's state, so collapsing the panel never discards one — and the collapsed- * summary line surfaces the values a remix most often carries in (frames, fps,- * seed) without making the user expand to see them.+ * Local-backend sampler knobs — frames, chunks (plus optional per-chunk+ * prompt beats), fps, seed, steps, CFG scale, image strength, tiling and+ * the audio flags. Always visible in the main form card (no disclosure)+ * so the right-hand column can host Prompt from media.** Presentational: all state and handlers are owned by the VideoGen page.- *- * The body is conditionally rendered rather than merely hidden on purpose: a- * number input that is out of its min/max range while invisible would make the- * browser refuse the form submit ("invalid form control is not focusable"), so- * a half-typed Steps/CFG value behind a collapsed panel must not be in the DOM.*/-import { useState } from 'react';-import { ChevronDown, Dice5 } from 'lucide-react';+import { Dice5 } from 'lucide-react';import { FormField } from '../ui/FormField';import {frameOptionsForModel, fpsOptionsForModel, CHUNK_OPTIONS,@@ -45,7 +33,6 @@ export default function AdvancedParamsPanel({disableAudio, onDisableAudioChange,noMusic, onNoMusicChange,}) {- const [open, setOpen] = useState(false);// a2v derives its length + audio track from the uploaded audio, so chunking// and the audio flags don't apply there.const showAudioFlags = mode !== 'a2v';@@ -62,24 +49,10 @@ export default function AdvancedParamsPanel({const fpsOptions = fpsOptionsForModel(currentModel);const samplerLocked = currentModel?.samplerLocked === true;- const summary = `${numFrames}f @ ${fps}fps · ${(numFrames / fps).toFixed(1)}s · seed ${seed === '' || seed == null ? 'random' : seed}`;-return (- <div className="border-t border-port-border pt-2">- <button- type="button"- onClick={() => setOpen((o) => !o)}- aria-expanded={open}- aria-controls="video-advanced-params"- className="w-full flex items-center gap-2 text-xs font-medium text-gray-400 hover:text-white min-h-[32px]"- >- <ChevronDown className={`w-3.5 h-3.5 shrink-0 transition-transform ${open ? '' : '-rotate-90'}`} />- <span>Advanced</span>- <span className="font-normal text-[11px] text-gray-500 truncate">{summary}</span>- </button>-- {open && (- <div id="video-advanced-params" className="grid grid-cols-2 sm:grid-cols-3 gap-3 mt-3">+ <div className="border-t border-port-border pt-3 space-y-3">+ <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Advanced</h2>+ <div className="grid grid-cols-2 sm:grid-cols-3 gap-3"><FormField label="Frames" labelClassName="block text-xs font-medium text-gray-400 mb-1"><selectvalue={numFrames}@@ -309,7 +282,6 @@ export default function AdvancedParamsPanel({</label>)}</div>- )}</div>);}diff --git a/client/src/components/videoGen/AdvancedParamsPanel.test.jsx b/client/src/components/videoGen/AdvancedParamsPanel.test.jsxindex 738f7d89db..6143462d11 100644--- a/client/src/components/videoGen/AdvancedParamsPanel.test.jsx+++ b/client/src/components/videoGen/AdvancedParamsPanel.test.jsx@@ -24,34 +24,11 @@ const baseProps = {};const renderPanel = (props = {}) => render(<AdvancedParamsPanel {...baseProps} {...props} />);-const toggle = () => screen.getByRole('button', { name: /Advanced/i });describe('AdvancedParamsPanel', () => {- it('starts collapsed so the Generate button stays above the fold', () => {+ it('shows every sampler knob without a disclosure', () => {renderPanel();- expect(toggle().getAttribute('aria-expanded')).toBe('false');- expect(screen.queryByLabelText('Frames')).toBeNull();- expect(screen.queryByLabelText('FPS')).toBeNull();- expect(screen.queryByLabelText('Seed')).toBeNull();- expect(screen.queryByLabelText('Tiling')).toBeNull();- });-- it('summarizes the hidden values while collapsed', () => {- renderPanel({ numFrames: 121, fps: 24, seed: '42' });- expect(screen.getByText(/121f @ 24fps/)).toBeTruthy();- expect(screen.getByText(/5\.0s/)).toBeTruthy();- expect(screen.getByText(/seed 42/)).toBeTruthy();- });-- it('reads "random" in the summary when no seed is pinned', () => {- renderPanel({ seed: '' });- expect(screen.getByText(/seed random/)).toBeTruthy();- });-- it('reveals every sampler knob when expanded', () => {- renderPanel();- fireEvent.click(toggle());- expect(toggle().getAttribute('aria-expanded')).toBe('true');+ expect(screen.getByRole('heading', { name: /Advanced/i })).toBeTruthy();expect(screen.getByLabelText('Frames')).toBeTruthy();expect(screen.getByLabelText('Chunks')).toBeTruthy();expect(screen.getByLabelText('FPS')).toBeTruthy();@@ -63,20 +40,11 @@ describe('AdvancedParamsPanel', () => {expect(screen.getByText(/No music/)).toBeTruthy();});- it('collapses again on a second click', () => {- renderPanel();- fireEvent.click(toggle());- fireEvent.click(toggle());- expect(toggle().getAttribute('aria-expanded')).toBe('false');- expect(screen.queryByLabelText('Frames')).toBeNull();- });-it('propagates edits to the page handlers', () => {const onFpsChange = vi.fn();const onStepsChange = vi.fn();const onTilingChange = vi.fn();renderPanel({ onFpsChange, onStepsChange, onTilingChange });- fireEvent.click(toggle());fireEvent.change(screen.getByLabelText('FPS'), { target: { value: '30' } });expect(onFpsChange).toHaveBeenCalledWith(30);fireEvent.change(screen.getByLabelText(/Steps/), { target: { value: '40' } });@@ -88,14 +56,12 @@ describe('AdvancedParamsPanel', () => {it('fires onRandomSeed from the dice button', () => {const onRandomSeed = vi.fn();renderPanel({ onRandomSeed });- fireEvent.click(toggle());fireEvent.click(screen.getByTitle('Randomize seed'));expect(onRandomSeed).toHaveBeenCalled();});it('hides chunks + the audio flags in a2v mode', () => {renderPanel({ mode: 'a2v' });- fireEvent.click(toggle());expect(screen.queryByLabelText('Chunks')).toBeNull();expect(screen.queryByText(/Disable audio/)).toBeNull();expect(screen.queryByText(/No music/)).toBeNull();@@ -107,13 +73,11 @@ describe('AdvancedParamsPanel', () => {renderPanel({currentModel: { runtime: 'wan22', supportedModes: ['text'], frameStride: 4 },});- fireEvent.click(toggle());expect(screen.queryByLabelText('Chunks')).toBeNull();});it('locks chunks to 1 while multi-keyframe mode is active', () => {renderPanel({ chunks: 4, keyframesActive: true });- fireEvent.click(toggle());const select = screen.getByLabelText('Chunks');expect(select.value).toBe('1');expect(select.disabled).toBe(true);@@ -121,29 +85,24 @@ describe('AdvancedParamsPanel', () => {it('shows image strength only where it applies', () => {const { unmount } = renderPanel({ mode: 'text' });- fireEvent.click(toggle());expect(screen.queryByLabelText('Image Strength')).toBeNull();unmount();renderPanel({ mode: 'image' });- fireEvent.click(toggle());expect(screen.getByLabelText('Image Strength')).toBeTruthy();});it('hides image strength for an ltx2 extend render', () => {const { unmount } = renderPanel({ mode: 'extend', currentModel: { runtime: 'ltx2', supportedModes: MLX_MODES } });- fireEvent.click(toggle());expect(screen.queryByLabelText('Image Strength')).toBeNull();unmount();renderPanel({ mode: 'extend', currentModel: { runtime: 'mlx_video', supportedModes: MLX_MODES } });- fireEvent.click(toggle());expect(screen.getByLabelText('Image Strength')).toBeTruthy();});it('disables the no-music flag when audio is off entirely', () => {renderPanel({ disableAudio: true });- fireEvent.click(toggle());expect(screen.getByLabelText(/No music/).disabled).toBe(true);});@@ -157,7 +116,6 @@ describe('AdvancedParamsPanel', () => {supportsDisableAudio: false,},});- fireEvent.click(toggle());expect(screen.queryByText(/Disable audio/)).toBeNull();expect(screen.getByLabelText(/No music/)).not.toBeDisabled();expect(screen.queryByText(/use Extend/i)).toBeNull();@@ -165,20 +123,17 @@ describe('AdvancedParamsPanel', () => {it('keeps the long-render Extend guidance for models that support Extend', () => {renderPanel({ numFrames: 313, currentModel: { runtime: 'ltx2', supportedModes: MLX_MODES } });- fireEvent.click(toggle());expect(screen.getByText(/Past 241 frames/i)).toBeInTheDocument();});describe('per-chunk prompt beats (#3695)', () => {it('hides the beat editor when the request does not chain', () => {renderPanel({ chunks: 4, chainingActive: false });- fireEvent.click(toggle());expect(screen.queryByLabelText('Chunk 1')).toBeNull();});it('renders one beat row per live chunk, prefilled from the parent', () => {renderPanel({ chunks: 3, chainingActive: true, chunkPrompts: ['first', '', 'third'] });- fireEvent.click(toggle());expect(screen.getByLabelText('Chunk 1').value).toBe('first');expect(screen.getByLabelText('Chunk 2').value).toBe('');expect(screen.getByLabelText('Chunk 3').value).toBe('third');@@ -189,7 +144,6 @@ describe('AdvancedParamsPanel', () => {// The parent never truncates its array (so raising the count restores the// text) — the editor is what scopes the view to the current chunk count.renderPanel({ chunks: 2, chainingActive: true, chunkPrompts: ['a', 'b', 'c'] });- fireEvent.click(toggle());expect(screen.getByLabelText('Chunk 2').value).toBe('b');expect(screen.queryByLabelText('Chunk 3')).toBeNull();});@@ -197,7 +151,6 @@ describe('AdvancedParamsPanel', () => {it('reports edits by chunk index', () => {const onChunkPromptChange = vi.fn();renderPanel({ chunks: 2, chainingActive: true, onChunkPromptChange });- fireEvent.click(toggle());fireEvent.change(screen.getByLabelText('Chunk 2'), { target: { value: 'the storm breaks' } });expect(onChunkPromptChange).toHaveBeenCalledWith(1, 'the storm breaks');});@@ -209,7 +162,6 @@ describe('AdvancedParamsPanel', () => {it('stays hidden while the request is not chaining', () => {renderPanel({ currentModel: LTX2, chunks: 1, chainingActive: false });- fireEvent.click(toggle());expect(screen.queryByLabelText('Continuity')).toBeNull();});@@ -217,26 +169,22 @@ describe('AdvancedParamsPanel', () => {// Offering the control where the server discards the value would be a// knob that silently does nothing.renderPanel({ currentModel: { runtime: 'minimax_h3' }, chunks: 3, chainingActive: true });- fireEvent.click(toggle());expect(screen.queryByLabelText('Continuity')).toBeNull();});it('shows the selected window on a chaining ltx2 render', () => {renderPanel({ currentModel: LTX2, chunks: 3, chainingActive: true, contextFrames: 45 });- fireEvent.click(toggle());expect(screen.getByLabelText('Continuity').value).toBe('45');});it('offers last-frame chaining as an explicit choice', () => {renderPanel({ currentModel: LTX2, chunks: 3, chainingActive: true });- fireEvent.click(toggle());expect(screen.getByRole('option', { name: /Last frame only/ })).toBeTruthy();});it('reports the choice as a number, so a selected 0 is not sent as a string', () => {const onContextFramesChange = vi.fn();renderPanel({ currentModel: LTX2, chunks: 3, chainingActive: true, onContextFramesChange });- fireEvent.click(toggle());fireEvent.change(screen.getByLabelText('Continuity'), { target: { value: '0' } });expect(onContextFramesChange).toHaveBeenCalledWith(0);});diff --git a/client/src/components/videoGen/FactLink.jsx b/client/src/components/videoGen/FactLink.jsxindex bed94f6719..b7e3718972 100644--- a/client/src/components/videoGen/FactLink.jsx+++ b/client/src/components/videoGen/FactLink.jsx@@ -1,6 +1,6 @@// Outbound link to a primary source (a model card, a license text) as rendered-// by the disclosure surfaces. Shared by ModelDisclosure and ModelTermsGate so-// the two halves of one panel can't drift apart on link affordance.+// by the disclosure surfaces so the panel's license and source links stay one+// affordance.import { ExternalLink } from 'lucide-react';export default function FactLink({ href, children }) {diff --git a/client/src/components/videoGen/ModelDisclosure.jsx b/client/src/components/videoGen/ModelDisclosure.jsxindex f465e97bff..6efec1d15f 100644--- a/client/src/components/videoGen/ModelDisclosure.jsx+++ b/client/src/components/videoGen/ModelDisclosure.jsx@@ -13,9 +13,9 @@// place (server/lib/videoDisclosure.js) and can't drift here.//// It is deliberately NOT part of `ModelSelect` — that component selects models-// and must stay a plain picker, and it is deliberately NOT where a restricted-// model's terms gate lives: that is an execution gate every render surface-// needs, so it is its own component (`ModelTermsGate`) rendered beside this one.+// and must stay a plain picker. Territory exclusions (when a model declares+// them) render here as facts next to the weights license, not as a blocking+// acknowledgement.import { Server, Cloud } from 'lucide-react';import FactLink from './FactLink.jsx';@@ -136,6 +136,11 @@ export default function ModelDisclosure({</Fact><LicenseFact label="Weights license" license={disclosure?.weightsLicense} /><LicenseFact label="Runtime license" license={disclosure?.runtimeLicense} />+ {Array.isArray(model?.termsGate?.excludedTerritories) && model.termsGate.excludedTerritories.length > 0 && (+ <Fact label="License territory">+ Excludes {model.termsGate.excludedTerritories.join(', ')}+ </Fact>+ )}<Fact label="Estimated download">{formatGb(disclosure?.estimatedDownloadGb)}</Fact><MemoryFact model={model} systemMemoryGb={systemMemoryGb} /><Fact label="Supported modes">{modes}</Fact>diff --git a/client/src/components/videoGen/ModelDisclosure.test.jsx b/client/src/components/videoGen/ModelDisclosure.test.jsxindex b01b6da876..6dd2cd365c 100644--- a/client/src/components/videoGen/ModelDisclosure.test.jsx+++ b/client/src/components/videoGen/ModelDisclosure.test.jsx@@ -134,13 +134,19 @@ describe('ModelDisclosure', () => {expect(empty.querySelector('details')).toBeNull();});- // The restricted-model terms gate is NOT part of this component — it is an- // execution gate every render surface renders for itself (ModelTermsGate).- it('never renders a terms gate, even for a model that declares one', () => {+ it('lists excluded territories as a disclosure fact, not an acknowledgement checkbox', () => {renderDisclosure({backend: 'local',- model: { ...SHIPPED_MODEL, termsGate: { id: 'example-license-v1', title: 'Territory and terms' } },+ model: {+ ...SHIPPED_MODEL,+ termsGate: {+ id: 'example-license-v1',+ excludedTerritories: ['European Union', 'United States of America'],+ },+ },});+ expect(screen.getByText(/Excludes European Union, United States of America/)).toBeInTheDocument();expect(screen.queryByLabelText('Model terms acceptance')).toBeNull();+ expect(screen.queryByRole('checkbox')).toBeNull();});});diff --git a/client/src/components/videoGen/ModelTermsGate.jsx b/client/src/components/videoGen/ModelTermsGate.jsxdeleted file mode 100644index 7707d30a4c..0000000000--- a/client/src/components/videoGen/ModelTermsGate.jsx+++ /dev/null@@ -1,64 +0,0 @@-// Restricted-model license gate — the acknowledgement UI for a video model-// whose registry entry carries a `termsGate` (server/lib/videoDisclosure.js).-//-// It lives in its own component because the gate is not a Video Gen page-// concern: any surface that can start a render (the music video director-// board, a future storyboard renderer) must be able to show it. A render-// surface that only reports the server's 403 leaves the user with no way to-// resolve it — so wherever a gated model can be selected, this renders.-//-// Wording comes verbatim from the server's gate block; nothing is authored here.-import { ShieldAlert, CheckCircle } from 'lucide-react';-import FactLink from './FactLink.jsx';--export default function ModelTermsGate({- termsGate,- accepted = false,- onAcceptedChange,- disabled = false,- descriptionId,- inputId = 'model-terms-accept',-}) {- if (!termsGate || typeof termsGate !== 'object') return null;- return (- <section- id={descriptionId}- aria-label="Model terms acceptance"- className={`rounded-xl border px-3 py-3 text-xs ${accepted- ? 'border-port-success/40 bg-port-success/10 text-gray-300'- : 'border-port-warning/50 bg-port-warning/10 text-port-warning'}`}- >- <div className="flex items-start gap-2">- {accepted- ? <CheckCircle className="w-4 h-4 mt-0.5 shrink-0 text-port-success" aria-hidden="true" />- : <ShieldAlert className="w-4 h-4 mt-0.5 shrink-0" aria-hidden="true" />}- <div className="min-w-0 space-y-1.5">- <p className="font-semibold text-gray-200">{termsGate.title || 'Model terms required'}</p>- <p className="leading-snug">{termsGate.summary}</p>- {termsGate.licenseUrl && (- <p>- <FactLink href={termsGate.licenseUrl}>- Read the Community License and Acceptable Use Policy- </FactLink>- </p>- )}- <label htmlFor={inputId} className="flex items-start gap-2 text-gray-200 cursor-pointer">- <input- id={inputId}- type="checkbox"- checked={accepted}- disabled={disabled}- onChange={(event) => onAcceptedChange?.(event.target.checked)}- className="mt-0.5 rounded disabled:opacity-50"- />- <span>{termsGate.acknowledgement}</span>- </label>- <p className="text-[10px] text-gray-500">- PortOS cannot determine your location or legal eligibility. Do not accept if this statement is not true.- Accepting applies to every render on this install.- </p>- </div>- </div>- </section>- );-}diff --git a/client/src/components/videoGen/ModelTermsGate.test.jsx b/client/src/components/videoGen/ModelTermsGate.test.jsxdeleted file mode 100644index dbc7562271..0000000000--- a/client/src/components/videoGen/ModelTermsGate.test.jsx+++ /dev/null@@ -1,41 +0,0 @@-import { describe, it, expect, vi } from 'vitest';-import { fireEvent, render, screen, within } from '@testing-library/react';-import ModelTermsGate from './ModelTermsGate.jsx';--const GATE = {- id: 'example-license-v1',- title: 'Territory and terms',- summary: 'This model is available only in its applicable territory.',- acknowledgement: 'I confirm I am eligible and accept the license.',- licenseUrl: 'https://example.com/license',-};--describe('ModelTermsGate', () => {- it('renders the server-authored terms and reports an acceptance', () => {- const onChange = vi.fn();- render(- <ModelTermsGate termsGate={GATE} accepted={false} onAcceptedChange={onChange} descriptionId="model-terms" />,- );- const gate = screen.getByLabelText('Model terms acceptance');- // The id is what a blocked Generate/Download button points its- // aria-describedby at, so a screen reader gets the reason it's disabled.- expect(gate).toHaveAttribute('id', 'model-terms');- expect(within(gate).getByText(GATE.summary)).toBeInTheDocument();- expect(within(gate).getByText(/cannot determine your location or legal eligibility/i)).toBeInTheDocument();- expect(within(gate).getByRole('link', { name: /Community License/i }))- .toHaveAttribute('href', GATE.licenseUrl);- fireEvent.click(within(gate).getByRole('checkbox'));- expect(onChange).toHaveBeenCalledWith(true);- });-- it('locks the checkbox while the acceptance is being persisted', () => {- render(<ModelTermsGate termsGate={GATE} accepted onAcceptedChange={vi.fn()} disabled />);- expect(screen.getByRole('checkbox')).toBeChecked();- expect(screen.getByRole('checkbox')).toBeDisabled();- });-- it('renders nothing for an ungated model', () => {- const { container } = render(<ModelTermsGate termsGate={null} />);- expect(container).toBeEmptyDOMElement();- });-});diff --git a/client/src/components/videoGen/VideoPreviewPanel.jsx b/client/src/components/videoGen/VideoPreviewPanel.jsxdeleted file mode 100644index 0058686a69..0000000000--- a/client/src/components/videoGen/VideoPreviewPanel.jsx+++ /dev/null@@ -1,63 +0,0 @@-import { Film } from 'lucide-react';-import BrailleSpinner from '../BrailleSpinner';--// Preview column for VideoGen.jsx (#2834): the rendered clip (or spinner /-// placeholder), the progress bar, and the download link. `previewWidth` /-// `previewHeight` are the px dimensions the page computes from the aspect ratio.-export default function VideoPreviewPanel({- result, generating, statusMsg, progressPct, previewWidth, previewHeight,-}) {- const src = result ? (result.path || `/data/videos/${result.filename}`) : null;- return (- <div className="bg-port-card border border-port-border rounded-xl p-4 space-y-2">- <div className="flex items-center justify-between">- <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Preview</h2>- {result && (- <a href={src} download className="text-xs text-port-accent hover:underline">- Download- </a>- )}- </div>- <div- className="mx-auto bg-port-bg border border-port-border rounded-lg overflow-hidden flex items-center justify-center relative max-w-full"- style={{ width: previewWidth, height: previewHeight }}- >- {result ? (- // muted so the clip autoplays under the mobile media-engagement- // policy (iOS/Android block unmuted autoplay outside a user- // gesture — otherwise it just shows black); poster paints the- // thumbnail while it buffers. Controls let the user unmute.- <video- src={src}- poster={result.thumbnail ? `/data/video-thumbnails/${result.thumbnail}` : undefined}- controls- autoPlay- loop- muted- playsInline- preload="metadata"- className="w-full h-full"- />- ) : generating ? (- <div className="text-gray-500 text-xs flex flex-col items-center gap-1.5">- <BrailleSpinner />- <span>{statusMsg || 'Starting...'}</span>- </div>- ) : (- <div className="text-gray-600 text-xs flex flex-col items-center gap-1.5">- <Film className="w-8 h-8" />- <span>Generated video will appear here</span>- </div>- )}- {generating && progressPct != null && (- <div className="absolute bottom-0 left-0 right-0 h-1 bg-black/50">- <div className="h-full bg-port-accent transition-all" style={{ width: `${progressPct}%` }} />- </div>- )}- </div>- {result && (- <div className="text-xs text-gray-400 truncate">{result.filename}</div>- )}- </div>- );-}diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex 0194a7d5d7..4a9dc9efde 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -195,14 +195,13 @@ grep -i "what you want to do" client/src/hooks/README.md| `useYoutubeTrackImport` | One YouTube-audio-import job slot (#1945): start/cancel + SSE progress + terminal-frame handling via `POST /api/tracks/import/youtube`. Returns `{ active, percent, start(url, context), cancel }`; `onComplete(track, context)` fires with the finished Track. Call once per UI surface that can independently kick off an import — a shared slot would let one surface's kickoff orphan another's in-flight job. | Any picker that lets a user paste a YouTube URL to create a Track (Music Video's create form and track-change row). || `useVideoGenForm` | `useVideoGenForm({ models, status, availableLoras, grokEnabled })` → every VideoGen form field + setter, the URL-param prefill paths (ImageGen handoff, Continue, Remix, `?lora=`), the mode/backend transitions that clear stale inputs, the derived model/keyframe/IC gates (`extendModeBlocked`, `a2vModeBlocked`, `icLoraModeBlocked`, `keyframesError`), `applyRemix` / `applyResumedParams`, and `buildGeneratePayload()`. | The /media/video form — the single client-side source of truth for the payload `server/routes/videoGen.js` validates. Reuse it for any second entry point that generates video. || `useVideoGenQueue` | `useVideoGenQueue({ generating, runGeneration })` → `{ queue, runningQueueId, enqueue, removeFromQueue, clearFinishedQueue, cancelRunning }`. Client-side serial batch queue for VideoGen: owns the queue array + running marker + the worker effect that pumps the head whenever nothing is generating (with BUSY-backoff retry + unmount/staleness guards). | The VideoGen "Add to queue" batch flow. |-| `useVideoModelTerms` | `useVideoModelTerms()` → `{ accepted, loaded, saving, isAccepted(termsId), setAcceptance(termsId, value), refresh }`. The install-wide acknowledgement list for restricted video-model license gates (`model.termsGate`), read/written through `/api/video-gen/model-terms` so accepting once authorizes every render surface (and every background producer). `accepted` is `null` until loaded — distinct from `[]`. | Any surface that can select or render a gated video model — pair it with `ModelTermsGate` so the acknowledgement the server demands is resolvable where the render is triggered, instead of surfacing as a bare 403. || `useVideoDownload` | One full-video-download job slot (#1946): start/cancel + SSE progress + terminal-frame handling via `POST /api/devtools/video-download`. Returns `{ active, percent, stage, start(url), cancel }`; `onComplete(video)` fires with the finished video-history entry. | The Dev Tools Video Downloader page. || `useReferenceAudioImport` | One round reference-audio-import job slot (#2120): start/cancel + SSE progress + terminal-frame handling via `POST /api/rounds/reference-audio/import`. Returns `{ active, percent, stage, start(url, context), cancel }`; `onComplete(filename, context)` fires with the uploads-dir filename to persist on the reference. Call once per surface that can independently kick off a download. | The reference-audio attach controls (`ReferenceAudioAttach`) — the "Download from URL" convenience. || `useMidiTranscription` | One audio → MIDI transcription job slot (MuScriptor): start/cancel + SSE stage progress + terminal-frame handling, generic over the Rounds and Music Video API surfaces (pass `startRequest`/`eventsUrl`/`cancelRequest`). Returns `{ active, stage, stageLabel, context, start(context), cancel }` (`stageLabel` is the ready-to-render human label for the current STAGE — including a distinct "Downloading model…" for the first-use weight download, which also fires a one-time toast; `context` is the in-flight job's captured target, for per-target UI gates); `onComplete(frame, context)` fires with the terminal frame (`filename`, `model`, any server-merged extras). | The Rounds reference "Transcribe MIDI" control and the Music Video MIDI button. || `useMusicVideoYoutubeImport` | The Music Video page's two independent `useYoutubeTrackImport` slots (create form + detail-view track row) plus their URL drafts, the detail slot's captured target project, and the URL-nav backstop that bounces a deep link / Back / ⌘K jump away from an in-flight import back to its project. Returns `{ createUrl, setCreateUrl, editUrl, setEditUrl, createJob, editJob, startCreate, startEdit, switchBlockedMessage }`. | The Music Video page. Reuse `switchBlockedMessage` for any additional guard (delete, list picker) so every surface says the same thing. || `useMusicVideoMidiJob` | `useMidiTranscription` bound to the music-video API surface, plus the MuScriptor model-size picker state (read fresh at each kickoff). Returns the slot (`active`/`stage`/`stageLabel`/`context`/`start(projectId)`/`cancel`/`installGate`/`gatedGate`) plus `{ model, setModel }`; `onTranscribed(projectId, midiTranscription)` fires on a non-discarded terminal frame. | The Music Video MIDI button + model select. || `useMusicVideoRenderJob` | The final-render job (#1760 Phase 2): kickoff (409 → attach to the existing job), SSE progress, terminal-frame handling and non-terminal stream-close recovery. Returns `{ job, progress, start(projectId), cancel }`; `onRendered(projectId, result)` / `onFailed(projectId)` key on the projectId captured at kickoff. | The Music Video "Render final" control. |-| `useMusicVideoModelSettings` | A project's saved render pins — video backend/model/generation-mode/audio-reactive LoRA + the image-side frame pin — with the Video Gen catalog they read from. Optimistic-local + silent PATCH, rollback + toast on failure; `saving` gates the dependent generate buttons. Returns `{ models, modelsLoading, defaultModel, saving, settings, effectiveModelId, activeModel, audioReactiveModels, audioReactiveLoras, detectedAudioReactiveLora, audioReactiveReady, audioReactiveSelected, termsGate, termsAccepted, termsSaving, videoBlockedReason, acceptTerms, refreshTerms, change, changeFramePin }`. `videoBlockedReason` is the single "why can't I generate" string (unaccepted model license terms, or an unavailable audio-reactive setup) shared by the disabled buttons, their tooltips, and the blocked-call toast. | The Music Video renderer selects and anything building a scene-clip job payload from them. |+| `useMusicVideoModelSettings` | A project's saved render pins — video backend/model/generation-mode/audio-reactive LoRA + the image-side frame pin — with the Video Gen catalog they read from. Optimistic-local + silent PATCH, rollback + toast on failure; `saving` gates the dependent generate buttons. Returns `{ models, modelsLoading, defaultModel, saving, settings, effectiveModelId, activeModel, audioReactiveModels, audioReactiveLoras, detectedAudioReactiveLora, audioReactiveReady, audioReactiveSelected, videoBlockedReason, change, changeFramePin }`. `videoBlockedReason` is the single "why can't I generate" string (an unavailable audio-reactive setup) shared by the disabled buttons, their tooltips, and the blocked-call toast. | The Music Video renderer selects and anything building a scene-clip job payload from them. || `useMusicVideoSceneMedia` | Both per-scene generation lanes (reference frame + scene clip) over `useSceneRenderLifecycle`, the frame/shot prompt builders (concept-style suffix), and the batch "generate the missing ones" actions. Returns `{ genScenes, genVideoScenes, buildFramePrompt, buildShotPrompt, generateFrame, generateSceneVideo, continueSceneVideo, generateMissingFrames, generateMissingVideos }`. | The Music Video scene board — don't re-wire the two lanes or re-derive the i2v/a2v/extend payloads. || `useMusicVideoManualTempo` | The manual-tempo fallback for a project whose auto-detected BPM is null: BPM/offset drafts (reset on project switch), tap-tempo estimation, and the persisted `setMusicVideoManualTempo` call. Returns `{ bpm, setBpm, offset, setOffset, saving, tap, submit }`. | The Music Video "No tempo detected" row. || `useCanvasDprSize` | DevicePixelRatio-aware canvas sizing shared by the piano-roll renderers (`<PianoRoll>`, `<MidiPianoRoll>`): sizes the bitmap to container-width × height at the DPR, applies the transform, and redraws via a `drawRef` on mount + every `ResizeObserver` resize (observer created once per height, never churned by draw-closure changes). Returns a ref holding the current CSS width so draw code doesn't measure the DOM per frame. | Both piano-roll canvases. |diff --git a/client/src/hooks/index.js b/client/src/hooks/index.jsindex 01c93dba1f..0bd337b8c2 100644--- a/client/src/hooks/index.js+++ b/client/src/hooks/index.js@@ -190,6 +190,5 @@ export * from './useTwinEvaluationSuite.js';export * from './useUniverseNav.js';export * from './useVideoFileSrc.js';export * from './useVideoGenForm.js';-export { default as useVideoModelTerms } from './useVideoModelTerms.js';export * from './useVideoGenQueue.js';export * from './useVoiceUiSync.js';diff --git a/client/src/hooks/useMusicVideoModelSettings.js b/client/src/hooks/useMusicVideoModelSettings.jsindex d2a9e6e1f0..81de470ad9 100644--- a/client/src/hooks/useMusicVideoModelSettings.js+++ b/client/src/hooks/useMusicVideoModelSettings.js@@ -2,7 +2,6 @@ import { useEffect, useState } from 'react';import toast from '../components/ui/Toast';import { updateMusicVideoProject } from '../services/apiMusicVideo.js';import { getVideoGenStatus, listLorasFull } from '../services/apiImageVideo.js';-import useVideoModelTerms from './useVideoModelTerms.js';import { loraFamilyOf, VIDEO_LORA_FAMILIES } from '../lib/runnerFamilies';const isLtx23 = (model) => !!model@@ -78,27 +77,12 @@ export default function useMusicVideoModelSettings({ project, onProjectPatch } =const audioReactiveReady = !!(isLtx23(activeModel) && detectedAudioReactiveLora);const audioReactiveSelected = settings.backend === 'local' && settings.generationMode === 'audioReactive';- // Restricted-model license gate. A gated model reached from this board used- // to 403 at generate time with no way to resolve it from here — the- // acknowledgement UI only existed on the Video Gen page. Acceptance is now- // install-wide, so this board both reads it and can capture it inline.- // Grok renders never touch the local registry, so no gate applies there.- const modelTerms = useVideoModelTerms();- const termsGate = settings.backend !== 'grok' && activeModel?.termsGate ? activeModel.termsGate : null;- const termsAccepted = modelTerms.isAccepted(termsGate?.id);- const termsBlocked = !!termsGate && !termsAccepted;- const acceptTerms = (accepted) => {- if (termsGate?.id) modelTerms.setAcceptance(termsGate.id, accepted);- };-// One reason string for every scene-video kickoff gate, so the disabled// buttons, their tooltips, and the toast a blocked call raises all say the// same resolvable thing. `null` means nothing is blocking.- const videoBlockedReason = termsBlocked- ? `${termsGate.title || 'This model’s license terms'} must be accepted before generating`- : (audioReactiveSelected && !audioReactiveReady- ? 'Audio-reactive generation requires an installed LTX-2.3 audio-reactive LoRA and an LTX-2.3 local model'- : null);+ const videoBlockedReason = audioReactiveSelected && !audioReactiveReady+ ? 'Audio-reactive generation requires an installed LTX-2.3 audio-reactive LoRA and an LTX-2.3 local model'+ : null;const change = (patch) => {if (!project || saving) return;@@ -162,15 +146,7 @@ export default function useMusicVideoModelSettings({ project, onProjectPatch } =detectedAudioReactiveLora,audioReactiveReady,audioReactiveSelected,- termsGate,- termsAccepted,- termsSaving: modelTerms.saving,videoBlockedReason,- acceptTerms,- // Re-read after a render is rejected for terms, so a gate accepted (or- // withdrawn) elsewhere repaints this board instead of stranding the user- // on a 403 whose cause is invisible here.- refreshTerms: modelTerms.refresh,change,changeFramePin,};diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.jsindex e0243ef1aa..d3b037a240 100644--- a/client/src/hooks/useMusicVideoSceneMedia.js+++ b/client/src/hooks/useMusicVideoSceneMedia.js@@ -105,13 +105,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applySvideoLane.trackJob(jobId, sceneId);};- // A restricted model's license gate is enforced server-side, so a render can- // still be rejected for terms the board thought were accepted (accepted on- // another peer, withdrawn since this page loaded). Refresh the gate state so- // the acknowledgement panel appears with the checkbox the message is asking- // for, rather than leaving a 403 the user has nowhere to act on.const handleVideoError = (err, sceneId, fallbackMessage) => {- if (err?.code === 'VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED') videoSettings?.refreshTerms?.();toast.error(err?.message || fallbackMessage);videoLane.clearScene(sceneId);};diff --git a/client/src/hooks/useVideoModelTerms.js b/client/src/hooks/useVideoModelTerms.jsdeleted file mode 100644index 6b767fbd7f..0000000000--- a/client/src/hooks/useVideoModelTerms.js+++ /dev/null@@ -1,49 +0,0 @@-import { useCallback, useEffect, useState } from 'react';-import useAsyncAction from './useAsyncAction.js';-import { getVideoModelTerms, setVideoModelTerms } from '../services/apiImageVideo.js';--/**- * Install-wide acknowledgement of restricted video-model license gates- * (`model.termsGate`), persisted in settings rather than in this browser.- *- * One person operates a PortOS install, and they reach the same restricted- * model from several surfaces — the Video Gen page, a music video board, a- * pipeline stage, an agent run. Acceptance therefore belongs to the install:- * accepting once here authorizes every render path, and the server enforces- * the same exact versioned id it stores (a revised license fails closed).- *- * `accepted` is `null` until the list is fetched — distinct from `[]`- * ("fetched, nothing accepted") so a surface can tell "still loading" from- * "genuinely unaccepted". A failed fetch also leaves it null, and `isAccepted`- * stays false either way, so the gate fails closed and the user gets the- * acceptance UI instead of a dead end.- */-export default function useVideoModelTerms() {- const [accepted, setAccepted] = useState(null);-- const refresh = useCallback(() => getVideoModelTerms({ silent: true })- .then((res) => setAccepted(Array.isArray(res?.accepted) ? res.accepted : []))- .catch(() => {}), []);-- useEffect(() => { refresh(); }, [refresh]);-- const isAccepted = useCallback(- (termsId) => !!termsId && Array.isArray(accepted) && accepted.includes(termsId),- [accepted],- );-- const [writeAcceptance, saving] = useAsyncAction(- (termsId, value) => setVideoModelTerms(termsId, value, { silent: true })- .then((res) => setAccepted(Array.isArray(res?.accepted) ? res.accepted : [])),- { errorMessage: 'Failed to save model terms acceptance' },- );-- // Resolves to whether the write landed, so a caller can chain a retry of the- // render the user was blocked on. useAsyncAction resolves to null when the- // request throws (having already toasted it).- const setAcceptance = (termsId, value) => (termsId- ? writeAcceptance(termsId, value).then((result) => result !== null)- : Promise.resolve(false));-- return { accepted, loaded: accepted !== null, saving, isAccepted, setAcceptance, refresh };-}diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex c116b0a742..537b47f7d1 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -36,7 +36,6 @@ import TrackPanel from '../components/musicVideo/TrackPanel.jsx';import RenderStatusPanel from '../components/musicVideo/RenderStatusPanel.jsx';import AnalysisPanel from '../components/musicVideo/AnalysisPanel.jsx';import SceneCard from '../components/musicVideo/SceneCard.jsx';-import ModelTermsGate from '../components/videoGen/ModelTermsGate.jsx';import { autoArrangeScenes } from '../lib/beatGrid.js';import { videoSrcForJob, videoPosterForJob } from '../lib/creativeDirectorPreview.js';@@ -503,20 +502,10 @@ export default function MusicVideo() {onDelete={() => handleDelete(selected.id)}/>{/* Restricted-model license gate for the saved scene-video- renderer. Rendered right under the renderer picker so the- acknowledgement the server demands is resolvable from the- board that triggers the render — not only on Video Gen. */}- {videoSettings.termsGate && (- <div className="mt-2">- <ModelTermsGate- termsGate={videoSettings.termsGate}- accepted={videoSettings.termsAccepted}- onAcceptedChange={videoSettings.acceptTerms}- disabled={videoSettings.termsSaving}- inputId="mv-model-terms-accept"- />- </div>- )}+ renderer. Only mounts while that exact license is still+ unaccepted — after download-time acknowledgement it stays+ off the board. */}+{/* Concept & style — optional global direction for the whole video,set before "AI Plan" (see commitConcept above for what reads it). */}<div className="mt-2 grid grid-cols-1 sm:grid-cols-2 gap-2">diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 268f065994..1650b7fa40 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -370,9 +370,9 @@ describe('MusicVideo project video renderer', () => {});});-// A restricted model selected here used to 403 at generate time with the-// acknowledgement UI living only on the Video Gen page — the user saw an error-// naming terms they had no way to accept from this board.+// A model that used to carry a blocking license checkbox still generates+// from this board with no acknowledgement UI — the license lives on the+// Video Gen disclosure, not as a per-render gate.describe('MusicVideo restricted-model license gate', () => {const GATE = {id: 'example-community-license-2026-01-01',@@ -381,40 +381,19 @@ describe('MusicVideo restricted-model license gate', () => {acknowledgement: 'I am eligible and accept the Example Community License.',licenseUrl: 'https://example.com/license',};- const gatedStatus = (accepted) => {++ it('does not ask for an eligibility acknowledgement before generating', async () => {getVideoGenStatus.mockResolvedValueOnce({connected: true,defaultModel: 'gated_model',models: [{ id: 'gated_model', name: 'Gated Model', runtime: 'ltx2', termsGate: GATE }],});- getVideoModelTerms.mockResolvedValueOnce({ accepted });- };-- it('shows the acknowledgement inline and blocks generation until it is accepted', async () => {- gatedStatus([]);- setVideoModelTerms.mockResolvedValueOnce({ accepted: [GATE.id] });- await openProject(PROJECT_NO_CLIP);-- const checkbox = await screen.findByRole('checkbox', { name: /I am eligible/ });- expect(checkbox).not.toBeChecked();- const generate = screen.getByRole('button', { name: /^Generate video$/ });- expect(generate).toBeDisabled();- expect(generate.title).toMatch(/must be accepted before generating/);-- fireEvent.click(checkbox);- // Persisted install-wide, so every other render surface is authorized too.- await waitFor(() => expect(setVideoModelTerms).toHaveBeenCalledWith(GATE.id, true, { silent: true }));- await waitFor(() => expect(screen.getByRole('button', { name: /^Generate video$/ })).toBeEnabled());- });-- it('does not re-ask when the install already accepted these exact terms', async () => {- gatedStatus([GATE.id]);generateVideo.mockResolvedValue({ jobId: 'gated-job' });await openProject(PROJECT_NO_CLIP);const generate = await screen.findByRole('button', { name: /^Generate video$/ });await waitFor(() => expect(generate).toBeEnabled());- expect(screen.getByRole('checkbox', { name: /I am eligible/ })).toBeChecked();+ expect(screen.queryByRole('checkbox', { name: /I am eligible/ })).toBeNull();fireEvent.click(generate);await waitFor(() => expect(generateVideo).toHaveBeenCalled());});diff --git a/client/src/pages/VideoGen.composeWhileBusy.test.jsx b/client/src/pages/VideoGen.composeWhileBusy.test.jsxnew file mode 100644index 0000000000..9952f52792--- /dev/null+++ b/client/src/pages/VideoGen.composeWhileBusy.test.jsx@@ -0,0 +1,172 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';+import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';+import { MemoryRouter } from 'react-router';++const TERMS_ID = 'minimax-h3-license-v1';+const MODEL = {+ id: 'h3-one',+ name: 'MiniMax h3-one',+ repo: 'example-org/h3-one',+ revision: '1111111111111111111111111111111111111111',+ runtime: 'minimax_h3',+ supportedModes: ['text'],+ defaultFrames: 124,+ frameOptions: [124, 141],+ fpsOptions: [24],+ steps: 8,+ guidance: 0,+ samplerLocked: true,+ supportsNegativePrompt: false,+ supportsTiling: false,+ supportsDisableAudio: false,+ termsGate: {+ id: TERMS_ID,+ title: 'Terms for h3-one',+ summary: 'This model is available only in its applicable territory.',+ acknowledgement: `I am eligible and accept ${TERMS_ID}.`,+ licenseUrl: 'https://example.com/license',+ },+};++const state = vi.hoisted(() => ({+ generateVideo: vi.fn(),+ attach: vi.fn(),+ enqueue: vi.fn(),+ eventSourceRef: { current: null },+}));++vi.mock('../services/apiImageVideo.js', () => ({+ getVideoModelTerms: vi.fn(async () => ({ accepted: [TERMS_ID] })),+ setVideoModelTerms: vi.fn(async () => ({ accepted: [TERMS_ID] })),+}));++vi.mock('../services/api', () => ({+ getVideoGenStatus: vi.fn(async () => ({+ connected: true,+ pythonPath: '/opt/example/python3',+ defaultModel: 'h3-one',+ models: [MODEL],+ byovRuntimes: [],+ systemMemoryGb: 128,+ backendDisclosures: [],+ })),+ generateVideo: (...args) => state.generateVideo(...args),+ cancelVideoGen: vi.fn(async () => ({})),+ listVideoHistory: vi.fn(async () => []),+ deleteVideoHistoryItem: vi.fn(async () => ({})),+ setVideoHidden: vi.fn(async () => ({})),+ extractLastFrame: vi.fn(async () => ({})),+ upscaleVideo: vi.fn(async () => ({})),+ listImageGallery: vi.fn(async () => []),+ patchSettingsSlice: vi.fn(async () => ({})),+ getActiveVideoJob: vi.fn(async () => ({ activeJob: null })),+ getSettings: vi.fn(async () => ({ imageGen: { grok: { enabled: false } } })),+ getVideoGenRuntimeStatus: vi.fn(async () => ({ installed: true, ready: true, current: true })),+ listLorasFull: vi.fn(async () => []),+ getProviders: vi.fn(async () => ({ providers: [] })),+ getVisionModels: vi.fn(async () => ({ models: [] })),+}));++vi.mock('../hooks/useModelDownloadStatus', () => ({+ TEXT_ENCODER_DOWNLOAD_ID: '__text_encoder__',+ useModelDownloadStatus: () => ({+ extra: {},+ loading: false,+ statusError: null,+ activeModelId: null,+ progress: null,+ lastError: null,+ downloading: false,+ repairing: false,+ getStatus: () => ({ id: MODEL.id, repo: MODEL.repo, cached: true, sizeBytes: 100 }),+ start: vi.fn(),+ cancel: vi.fn(),+ repair: vi.fn(),+ refresh: vi.fn(),+ }),+}));++vi.mock('../hooks/useMediaJobSse', () => ({+ useMediaJobSse: () => ({ attach: state.attach, eventSourceRef: state.eventSourceRef }),+}));+vi.mock('../hooks/useMediaCompletionRefresh', () => ({ useMediaCompletionRefresh: vi.fn() }));+vi.mock('../hooks/useMediaAnnotations', () => ({+ useMediaAnnotations: () => ({ annotations: {}, updateAnnotation: vi.fn(), getCardProps: vi.fn(() => ({})) }),+}));+vi.mock('../hooks/usePreviewRoute', () => ({ default: () => [null, vi.fn()] }));+vi.mock('../hooks/useVideoGenQueue.js', () => ({+ useVideoGenQueue: () => ({+ queue: [],+ enqueue: state.enqueue,+ removeFromQueue: vi.fn(),+ clearFinishedQueue: vi.fn(),+ cancelRunning: vi.fn(),+ }),+}));+vi.mock('../components/ui/Toast', () => ({+ default: Object.assign(vi.fn(), { error: vi.fn(), success: vi.fn(), loading: vi.fn() }),+}));++vi.mock('../components/media/PromptEnhancer', () => ({+ default: ({ disabled }) => (+ <div data-testid="prompt-enhancer" data-disabled={disabled ? '1' : '0'}>Enhance with AI</div>+ ),+}));+vi.mock('../components/media/PromptFromMedia', () => ({+ default: ({ disabled }) => (+ <div data-testid="prompt-from-media" data-disabled={disabled ? '1' : '0'}>Prompt from media</div>+ ),+}));++vi.mock('../components/Drawer', () => ({ default: () => null }));+vi.mock('../components/settings/ImageGenTab', () => ({ ImageGenTab: () => null }));+vi.mock('../components/settings/LocalSetupPanel', () => ({ default: () => null }));+vi.mock('../components/install/RuntimeInstallModal', () => ({ default: () => null }));+vi.mock('../components/videoGen/FramePanel', () => ({ default: () => null }));+vi.mock('../components/videoGen/KeyframePanel', () => ({ default: () => null }));+vi.mock('../components/videoGen/AudioPanel', () => ({ default: () => null }));+vi.mock('../components/videoGen/ExtendPanel', () => ({ default: () => null }));+vi.mock('../components/videoGen/IcLoraPanel', () => ({ default: () => null }));+vi.mock('../components/videoGen/AdvancedParamsPanel', () => ({ default: () => null }));+vi.mock('../components/videoGen/RuntimeFingerprint', () => ({ default: () => null }));+vi.mock('../components/videoGen/VideoGenGallery', () => ({ default: () => null }));+vi.mock('../components/media/MediaPreview', () => ({ default: () => null }));+vi.mock('../components/media/StylePresetPicker', () => ({ default: () => null }));+vi.mock('../components/media/BatchQueuePanel', () => ({ default: () => null }));+vi.mock('../components/media/MediaJobsQueue', () => ({ default: () => null }));+vi.mock('../components/imageGen/LoraPicker', () => ({ default: () => null }));+vi.mock('../components/media/ResolutionField', () => ({ default: () => null }));++const { default: VideoGen } = await import('./VideoGen.jsx');++describe('VideoGen compose-while-busy', () => {+ beforeEach(() => {+ state.generateVideo.mockReset().mockReturnValue(new Promise(() => {}));+ state.attach.mockReset().mockReturnValue(new Promise(() => {}));+ state.enqueue.mockReset();+ state.eventSourceRef.current = null;+ });++ it('leaves Enhance with AI and Prompt from media usable so the next clip can be queued', async () => {+ await act(async () => {+ render(+ <MemoryRouter initialEntries={['/media/video']}>+ <VideoGen />+ </MemoryRouter>,+ );+ });++ const prompt = await screen.findByLabelText('Prompt');+ fireEvent.change(prompt, { target: { value: 'a fox watches the rain' } });+ await waitFor(() => expect(screen.getByRole('button', { name: /^Generate$/ })).toBeEnabled());++ await act(async () => {+ fireEvent.click(screen.getByRole('button', { name: /^Generate$/ }));+ });+ await waitFor(() => expect(screen.getByRole('button', { name: /Cancel/i })).toBeInTheDocument());++ expect(screen.getByTestId('prompt-enhancer')).toHaveAttribute('data-disabled', '0');+ expect(screen.getByTestId('prompt-from-media')).toHaveAttribute('data-disabled', '0');+ expect(screen.getByRole('button', { name: /Add to queue/ })).toBeEnabled();+ });+});diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex b3cbe2a6cb..a7d1c7513e 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -50,9 +50,7 @@ import IcLoraPanel from '../components/videoGen/IcLoraPanel';import AdvancedParamsPanel from '../components/videoGen/AdvancedParamsPanel';import RuntimeFingerprint from '../components/videoGen/RuntimeFingerprint';import ModelDisclosure from '../components/videoGen/ModelDisclosure';-import ModelTermsGate from '../components/videoGen/ModelTermsGate';import ModelRepairBanner from '../components/videoGen/ModelRepairBanner';-import VideoPreviewPanel from '../components/videoGen/VideoPreviewPanel';import VideoGenGallery from '../components/videoGen/VideoGenGallery';import GalleryImagePicker from '../components/imageGen/GalleryImagePicker';import MediaPreview from '../components/media/MediaPreview';@@ -95,9 +93,6 @@ import { GROK_VIDEO_DURATIONS, GROK_VIDEO_DEFAULT_DURATION } from '../lib/grokViimport ResolutionField from '../components/media/ResolutionField';import { VIDEO_EDGE_BOUNDS, videoEdgeBoundsForModel, IC_LORA_MODES } from '../lib/videoGenParams.js';import { finishTargetForRecord } from '../lib/videoFinish.js';-import { safeReadStorage, safeWriteStorage } from '../lib/safeStorage.js';-import useVideoModelTerms from '../hooks/useVideoModelTerms.js';-const MODES = [{ id: 'text', label: 'Text', icon: Type, desc: 'Text-to-video' },{ id: 'image', label: 'Image', icon: ImageIcon, desc: 'Image-to-video (start frame)' },@@ -177,39 +172,6 @@ export default function VideoGen() {const localResolutionOptions = resolutionOptionsForModel(currentModel);const localResolutionBounds = videoEdgeBoundsForModel(currentModel);- // Restricted model terms are accepted per exact reviewed license id, and the- // acceptance is recorded server-side so it authorizes every other render- // surface (music video board, pipeline, agent runs) — not just this page in- // this browser. That record is the ONLY authorization: no request carries an- // acceptance of its own, so the gates below are a UI mirror of what the- // server independently enforces on every download and render.- const termsGate = !isGrok && currentModel?.termsGate ? currentModel.termsGate : null;- const modelTerms = useVideoModelTerms();- // Key acceptance by the exact license id, never a shared boolean, so a model- // switch can't momentarily apply one model's acceptance to another's terms.- const termsAccepted = modelTerms.isAccepted(termsGate?.id);- // One-time carry-forward of the browser-local acceptance bit this page used- // to keep: the user already performed this exact acknowledgement (same- // versioned id) here, so re-home it into settings instead of asking again.- // The legacy key is cleared afterwards so it can never re-assert a later- // withdrawal, and `migratedTerms` keeps the re-home to one attempt per id —- // the effect re-runs on any acceptance-list change, and the PATCH is not- // instantaneous.- const migratedTerms = useRef(new Set());- useEffect(() => {- const id = termsGate?.id;- if (!id || !modelTerms.loaded || modelTerms.isAccepted(id) || migratedTerms.current.has(id)) return;- const legacyKey = `video-gen:terms:${id}`;- if (safeReadStorage(legacyKey) !== '1') return;- migratedTerms.current.add(id);- modelTerms.setAcceptance(id, true).then((saved) => { if (saved) safeWriteStorage(legacyKey, '0'); });- }, [termsGate?.id, modelTerms.loaded, modelTerms.isAccepted, modelTerms.setAcceptance]);- const handleTermsAcceptedChange = (accepted) => {- if (termsGate?.id) modelTerms.setAcceptance(termsGate.id, accepted);- };- const termsGateBlocked = !!termsGate && !termsAccepted;- const termsDescriptionId = termsGate ? 'video-model-terms-requirement' : undefined;-// Every gallery-image slot on this page (both frame panels, each multi-keyframe// row, each IC-LoRA reference row) opens the SAME GalleryImagePicker modal the// Image Gen i2i form uses — a searchable thumbnail grid over the whole gallery.@@ -321,7 +283,6 @@ export default function VideoGen() {const [generating, setGenerating] = useState(false);const [progress, setProgress] = useState(null);const [statusMsg, setStatusMsg] = useState('');- const [result, setResult] = useState(null);const [error, setError] = useState(null);const { attach, eventSourceRef } = useMediaJobSse('video');// Hold the reject() of the in-flight runGeneration Promise so cancel can@@ -367,7 +328,6 @@ export default function VideoGen() {if (msg.message) setStatusMsg(msg.message);},onComplete: (msg) => {- setResult(msg.result);setGenerating(false);setProgress({ progress: 1 });setStatusMsg('Complete');@@ -395,7 +355,7 @@ export default function VideoGen() {};// Resume an in-flight (or queued) render so a page reload doesn't lose- // the preview/progress display. Server holds the job's last SSE payload,+ // the progress line next to Generate. Server holds the job's last SSE payload,// so re-attaching replays the most recent status/progress immediately.// Mirrors the ImageGen `getActiveImageJob` mount path.useEffect(() => {@@ -561,13 +521,6 @@ export default function VideoGen() {const progressPct = progress?.progress != null ? Math.round(progress.progress * 100) : null;- // Explicit px sizing — maxWidth + maxHeight + aspectRatio together resolves- // inconsistently across browsers for mixed orientations.- const previewBudget = 420;- const previewRatio = (width > 0 && height > 0) ? width / height : 16 / 9;- const previewWidth = previewRatio >= 1 ? previewBudget : Math.round(previewBudget * previewRatio);- const previewHeight = previewRatio >= 1 ? Math.round(previewBudget / previewRatio) : previewBudget;-// Run a single payload through the SSE pipeline. Returns a promise that// resolves when the job completes (or rejects on error / cancel). Shared// by the inline submit and the queue worker.@@ -586,7 +539,6 @@ export default function VideoGen() {setGenerating(true);setProgress({ progress: 0 });setStatusMsg('Starting...');- setResult(null);setError(null);const myToken = ++runTokenRef.current;@@ -640,7 +592,7 @@ export default function VideoGen() {if (canEnqueue) handleEnqueue();return;}- if (!prompt.trim() || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked || termsGateBlocked))) return;+ if (!prompt.trim() || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked))) return;await runGeneration(buildGeneratePayload()).catch(() => {});};@@ -649,7 +601,7 @@ export default function VideoGen() {// would silently queue a doomed job that fails late in the worker with// VENV_MISSING, hiding the installer banner from the user. Block at// enqueue time so the only path forward is the install banner above.- if (!prompt.trim() || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked || termsGateBlocked))) return;+ if (!prompt.trim() || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked))) return;// useVideoGenQueue strips the File blobs into `_blobs` and snapshots the// rest as a stable summary for the queue UI.enqueue(buildGeneratePayload());@@ -694,7 +646,7 @@ export default function VideoGen() {const canEnqueue = prompt.trim() && (isGrok || (!notConnected && !extendModeBlocked&& !a2vModeBlocked && !icLoraModeBlocked && !byovGateBlocked- && !weightsGateBlocked && !keyframesBlocked && !termsGateBlocked));+ && !weightsGateBlocked && !keyframesBlocked));return (<div className="space-y-3">@@ -845,8 +797,7 @@ export default function VideoGen() {modelDownload.repair(modelId);}}onDismiss={() => setDismissedIntegrityKey(integrityKey)}- disabled={termsGateBlocked || modelDownload.repairing || modelDownload.downloading}- disabledReasonId={termsGateBlocked ? termsDescriptionId : undefined}+ disabled={modelDownload.repairing || modelDownload.downloading}repairing={modelDownload.repairing}/>)}@@ -899,7 +850,6 @@ export default function VideoGen() {<StylePresetPickervalue={stylePreset?.id || ''}onChange={setStylePreset}- disabled={generating}/><div className="grid grid-cols-1 md:grid-cols-2 gap-3"><FormField label="Prompt" labelClassName="block text-xs font-medium text-gray-400 mb-1">@@ -925,6 +875,8 @@ export default function VideoGen() {</FormField></div>+ {/* Keep Enhance live while a render is in flight so the next clip+ can be composed and queued. Generate itself becomes Cancel. */}<PromptEnhancerkind="video"prompt={prompt}@@ -932,14 +884,6 @@ export default function VideoGen() {negativePrompt={negativePrompt}setNegativePrompt={setNegativePrompt}renderConfig={{ stylePreset: stylePreset?.id, mode, model: modelId }}- disabled={generating}- />- <PromptFromMedia- kindDefault="both"- applyKind="video"- setPrompt={setPrompt}- setNegativePrompt={setNegativePrompt}- disabled={generating}/>{mode === 'fflf' && keyframesSupported && (@@ -1080,9 +1024,6 @@ export default function VideoGen() {onDownload={() => modelDownload.start(modelId)}onCancel={modelDownload.cancel}estimateLabel={deriveSizeEstimate(currentModel?.name)}- disabled={termsGateBlocked}- disabledReason="Accept the selected model's eligibility and license terms below before downloading."- disabledReasonId={termsDescriptionId}/>)}{activeWeightError && (@@ -1191,29 +1132,16 @@ export default function VideoGen() {</div>)}- {/* A restricted model's server-enforced terms gate, then provenance /- licensing / policy scope for the selected backend + model (#3674)- — both before Advanced / Generate. */}- <div className="space-y-2">- <ModelTermsGate- termsGate={termsGate}- accepted={termsAccepted}- onAcceptedChange={handleTermsAcceptedChange}- disabled={modelTerms.saving}- descriptionId={termsDescriptionId}- inputId="video-gen-terms-accept"- />- <ModelDisclosure- backend={backend}- backendDisclosures={status?.backendDisclosures}- model={isGrok ? null : currentModel}- systemMemoryGb={status?.systemMemoryGb}- />- </div>+ {/* Provenance / licensing / policy scope for the selected backend ++ model (#3674). Territory and Community License live here as+ facts — they do not block download or generate. */}+ <ModelDisclosure+ backend={backend}+ backendDisclosures={status?.backendDisclosures}+ model={isGrok ? null : currentModel}+ systemMemoryGb={status?.systemMemoryGb}+ />- {/* Sampler/output knobs live behind a closed-by-default disclosure so- Generate stays above the fold — the sibling /media/image tab keeps- only Model + Resolution inline for the same reason (issue #3279). */}{!isGrok && (<AdvancedParamsPanelmode={mode}@@ -1245,13 +1173,11 @@ export default function VideoGen() {) : (<buttontype="submit"- disabled={!prompt.trim() || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked || termsGateBlocked))}- aria-describedby={termsGateBlocked ? termsDescriptionId : undefined}+ disabled={!prompt.trim() || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked))}className="flex items-center gap-2 px-4 py-2 bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 disabled:cursor-not-allowed text-white text-sm font-medium rounded-lg min-h-[40px]"title={byovRuntimeMissing ? `${byovStatus?.label || byovRuntime} runtime is not installed — use the install banner above`: byovGateBlocked ? `Checking ${byovRuntime} runtime status…`- : termsGateBlocked ? 'Confirm the selected model eligibility and license terms above before generating': modelWeightsBlocked ? 'Download the selected model weights before generating': textEncoderWeightsBlocked ? 'Download the shared text encoder before generating': textEncoderOptionBlocked ? `Download the ${selectedTextEncoder?.label || 'selected'} text encoder before generating`@@ -1271,11 +1197,9 @@ export default function VideoGen() {type="button"onClick={handleEnqueue}disabled={!canEnqueue}- aria-describedby={termsGateBlocked ? termsDescriptionId : undefined}className="flex items-center gap-2 px-4 py-2 border border-port-border text-gray-200 hover:text-white hover:bg-port-border/40 disabled:opacity-50 disabled:cursor-not-allowed text-sm font-medium rounded-lg min-h-[40px]"title={canEnqueue ? 'Add this configuration to the batch queue': icWeightsBlocked ? `Download the ${icSpec?.label || 'IC-LoRA'} weight before queueing`- : termsGateBlocked ? 'Confirm the selected model eligibility and license terms above before queueing': weightsGateBlocked ? 'Finish required model downloads before queueing': 'Complete the required inputs before queueing'}>@@ -1290,14 +1214,16 @@ export default function VideoGen() {</div></div>- <VideoPreviewPanel- result={result}- generating={generating}- statusMsg={statusMsg}- progressPct={progressPct}- previewWidth={previewWidth}- previewHeight={previewHeight}- />+ <div className="bg-port-card border border-port-border rounded-xl p-4 space-y-3">+ <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Prompt from media</h2>+ <PromptFromMedia+ kindDefault="both"+ applyKind="video"+ setPrompt={setPrompt}+ setNegativePrompt={setNegativePrompt}+ alwaysOpen+ />+ </div></form><BatchQueuePaneldiff --git a/client/src/pages/VideoGen.terms.test.jsx b/client/src/pages/VideoGen.terms.test.jsxindex 1947412a87..93d793be69 100644--- a/client/src/pages/VideoGen.terms.test.jsx+++ b/client/src/pages/VideoGen.terms.test.jsx@@ -139,7 +139,6 @@ vi.mock('../components/videoGen/ExtendPanel', () => ({ default: () => null }));vi.mock('../components/videoGen/IcLoraPanel', () => ({ default: () => null }));vi.mock('../components/videoGen/AdvancedParamsPanel', () => ({ default: () => null }));vi.mock('../components/videoGen/RuntimeFingerprint', () => ({ default: () => null }));-vi.mock('../components/videoGen/VideoPreviewPanel', () => ({ default: () => null }));vi.mock('../components/videoGen/VideoGenGallery', () => ({ default: () => null }));vi.mock('../components/media/MediaPreview', () => ({ default: () => null }));vi.mock('../components/media/StylePresetPicker', () => ({ default: () => null }));@@ -165,9 +164,8 @@ const renderPage = async () => {const prompt = () => screen.getByLabelText('Prompt');const generate = () => screen.getByRole('button', { name: /^Generate$/ });const enqueue = () => screen.getByRole('button', { name: /Add to queue/ });-const termsCheckbox = () => screen.getByRole('checkbox', { name: /I am eligible/ });-describe('VideoGen restricted-model orchestration', () => {+describe('VideoGen MiniMax H3 orchestration', () => {beforeEach(() => {localStorage.clear();state.modelStatuses = {@@ -192,29 +190,19 @@ describe('VideoGen restricted-model orchestration', () => {});});- it('restores only the exact license, gates model switches, submit, queue, and revocation', async () => {- // A pre-existing browser-local acknowledgement of this exact license id is- // carried forward into the install-wide list once, then cleared — the user- // already performed this acknowledgement and must not be asked again.- localStorage.setItem(`video-gen:terms:${TERMS_ONE}`, '1');+ it('lets H3 generate and queue with no eligibility checkbox', async () => {await renderPage();await waitFor(() => expect(screen.getByLabelText('Model')).toHaveValue(H3_ONE.id));- await waitFor(() => expect(termsCheckbox()).toBeChecked());- expect(state.setVideoModelTerms).toHaveBeenCalledWith(TERMS_ONE, true, { silent: true });- await waitFor(() => expect(localStorage.getItem(`video-gen:terms:${TERMS_ONE}`)).toBe('0'));+ expect(screen.queryByRole('checkbox', { name: /I am eligible/ })).toBeNull();+ expect(screen.queryByText(/eligibility and terms/i)).toBeNull();fireEvent.change(prompt(), { target: { value: 'a fox watches the rain' } });await waitFor(() => expect(enqueue()).toBeEnabled());fireEvent.click(enqueue());- // The payload carries no acceptance of its own — the server resolves it- // from the install record, so nothing renders without a recorded (and- // therefore withdrawable) acknowledgement.expect(state.enqueue).toHaveBeenCalledWith(expect.objectContaining({ modelId: H3_ONE.id }));expect(state.enqueue.mock.calls[0][0]).not.toHaveProperty('termsAcceptance');- // A form submit models keyboard/Enter submission and must pass the same- // gate as clicking Generate.await act(async () => {fireEvent.submit(prompt().closest('form'));});@@ -225,34 +213,22 @@ describe('VideoGen restricted-model orchestration', () => {fireEvent.change(screen.getByLabelText('Model'), { target: { value: H3_TWO.id } });await waitFor(() => expect(screen.getByLabelText('Model')).toHaveValue(H3_TWO.id));- expect(termsCheckbox()).not.toBeChecked();- expect(generate()).toBeDisabled();- expect(enqueue()).toBeDisabled();- expect(generate()).toHaveAttribute('aria-describedby', 'video-model-terms-requirement');- expect(state.generateVideo).toHaveBeenCalledTimes(1);-- fireEvent.change(screen.getByLabelText('Model'), { target: { value: H3_ONE.id } });- await waitFor(() => expect(termsCheckbox()).toBeChecked());- fireEvent.click(termsCheckbox());- expect(state.setVideoModelTerms).toHaveBeenLastCalledWith(TERMS_ONE, false, { silent: true });- await waitFor(() => expect(generate()).toBeDisabled());- expect(enqueue()).toBeDisabled();+ expect(generate()).toBeEnabled();+ expect(enqueue()).toBeEnabled();+ expect(screen.queryByRole('checkbox', { name: /I am eligible/ })).toBeNull();});- it('blocks download until the acknowledgement is recorded', async () => {+ it('offers download without an eligibility acknowledgement', async () => {state.modelStatuses[H3_ONE.id] = { id: H3_ONE.id, repo: H3_ONE.repo, cached: false, sizeBytes: 0 };await renderPage();const download = await screen.findByRole('button', { name: /Download/ });- expect(download).toBeDisabled();- expect(download).toHaveAttribute('aria-describedby', 'video-model-terms-requirement');- fireEvent.click(termsCheckbox());- await waitFor(() => expect(download).toBeEnabled());+ expect(download).toBeEnabled();fireEvent.click(download);expect(state.startDownload).toHaveBeenCalledWith(H3_ONE.id);});- it('blocks integrity repair until the acknowledgement is recorded', async () => {+ it('offers integrity repair without an eligibility acknowledgement', async () => {state.modelStatuses[H3_ONE.id] = {id: H3_ONE.id,repo: H3_ONE.repo,@@ -263,10 +239,7 @@ describe('VideoGen restricted-model orchestration', () => {await renderPage();const repair = await screen.findByRole('button', { name: /Repair model/ });- expect(repair).toBeDisabled();- expect(repair).toHaveAttribute('aria-describedby', 'video-model-terms-requirement');- fireEvent.click(termsCheckbox());- await waitFor(() => expect(repair).toBeEnabled());+ expect(repair).toBeEnabled();fireEvent.click(repair);expect(state.repairModel).toHaveBeenCalledWith(H3_ONE.id);});diff --git a/server/lib/videoDisclosure.js b/server/lib/videoDisclosure.jsindex a27e8c50c9..dc645a5ff7 100644--- a/server/lib/videoDisclosure.js+++ b/server/lib/videoDisclosure.js@@ -68,17 +68,14 @@ const RUNTIME_LICENSE = {},};-// Unlike an informational disclosure, this is an execution gate. The upstream-// license grants rights solely in its Applicable Territory and makes use itself-// acceptance, so PortOS requires the exact versioned key on both download and-// generation requests.+// Informational territory facts for ModelDisclosure — not an execution gate.+// The license is use-as-acceptance; PortOS surfaces the exclusions and the+// license link rather than blocking download or generate.//// Shared verbatim by every MiniMax H3 entry — the MLX port and the CUDA path-// load the same weights under the same license, so one acceptance is the honest-// scope. Sharing the OBJECT (rather than repeating its fields) is what keeps the-// `id` identical: acceptance is recorded by id in settings, so a second entry-// with its own id would re-prompt a user who has already accepted, and a later-// edit to one copy would silently split the two gates apart.+// load the same weights under the same license. Sharing the OBJECT (rather+// than repeating its fields) keeps the `id` identical if an older client+// still writes `acceptedModelTerms`.const MINIMAX_H3_TERMS_GATE = Object.freeze({id: 'minimax-h3-community-license-2026-08-02',title: 'MiniMax H3 eligibility and terms',diff --git a/server/lib/videoTextEncoders.js b/server/lib/videoTextEncoders.jsindex 95e19ba220..057cf3416d 100644--- a/server/lib/videoTextEncoders.js+++ b/server/lib/videoTextEncoders.js@@ -83,11 +83,8 @@ const TEXT_ENCODERS_BY_RUNTIME = Object.freeze({weightsLicense: APACHE_2,reviewedAt: '2026-08-14',}),- // Informational, NOT a terms gate. H3's own `termsGate` already gates the- // render on its Community License, and this conditioner is plain- // Apache-2.0 with nothing extra to accept — so a second acknowledgement- // click would be friction with no legal basis behind it. What the user- // does need is to know the behavior changed, which the picker states+ // Informational, NOT a second license. This conditioner is Apache-2.0+ // with nothing extra to accept. The picker states the behavior change// inline at the moment of choosing.advisory:'This conditioner has had its refusal behavior removed. It will follow prompts the stock 'diff --git a/server/routes/videoGen.js b/server/routes/videoGen.jsindex 2b4e7b2b4a..af6113f354 100644--- a/server/routes/videoGen.js+++ b/server/routes/videoGen.js@@ -19,8 +19,8 @@ import { videoModelTermsSchema } from '../lib/validation.js';import { grokVideoDurationSchema } from '../lib/sharedSchemas.js';import { MIN_CONTEXT_FRAMES, MAX_CONTEXT_FRAMES } from '../lib/videoContinuity.js';import {- VIDEO_BACKEND_DISCLOSURES, isVideoModelTermsAccepted, acceptedVideoModelTerms,- videoModelTermsGateId, videoModelTermsError,+ VIDEO_BACKEND_DISCLOSURES, acceptedVideoModelTerms,+ videoModelTermsGateId,} from '../lib/videoDisclosure.js';import { IMAGE_GEN_MODE } from '../services/imageGen/modes.js';import { getSettings, updateSettingsWith } from '../services/settings.js';@@ -832,12 +832,6 @@ router.post('/models/:modelId/repair', asyncHandler(async (req, res) => {router.get('/models/:modelId/download', asyncHandler(async (req, res) => {const model = listVideoModels().find((m) => m.id === req.params.modelId);if (!model) throw new ServerError(`Unknown video model: ${req.params.modelId}`, { status: 404 });- // Only a gated model needs the recorded acknowledgement list — skip the- // settings read (and its deep clone) for every ordinary model.- if (videoModelTermsGateId(model)- && !isVideoModelTermsAccepted(model, acceptedVideoModelTerms(await getSettings()))) {- throw videoModelTermsError(model, 'download');- }const repos = modelDownloadTargets(model);if (repos.length === 0) throw new ServerError(`Model "${model.id}" has no HuggingFace repo on file.`, { status: 400, code: 'NO_REPO_FOR_MODEL' });const runtimeInfo = BYOV_RUNTIME_INFO[model.runtime];diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.jsindex 1b86a2b8c8..d3e3eb7a0e 100644--- a/server/routes/videoGen.test.js+++ b/server/routes/videoGen.test.js@@ -486,28 +486,8 @@ describe('videoGen routes', () => {}],};- it('rejects a download until the install has recorded this exact acknowledgement', async () => {- const { getSettings } = await import('../services/settings.js');- videoGenService.listVideoModels.mockReturnValueOnce([h3]).mockReturnValueOnce([h3]);-- const missing = await request(app).get('/api/video-gen/models/minimax_h3_8bit/download');- expect(missing.status).toBe(403);- expect(missing.body.code).toBe('VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED');- // The message is the only channel a blocked caller has, so it must point- // at where the acknowledgement is made.- expect(missing.body.error).toMatch(/Video Gen page/);-- // A superseded license revision is not this one.- getSettings.mockResolvedValueOnce({ videoGen: { acceptedModelTerms: ['minimax-h3-community-license-2025-01-01'] } });- const stale = await request(app).get('/api/video-gen/models/minimax_h3_8bit/download');- expect(stale.status).toBe(403);- expect(stale.body.code).toBe('VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED');- });-- it('downloads both exact snapshots once the acknowledgement is recorded', async () => {- const { getSettings } = await import('../services/settings.js');+ it('downloads both exact snapshots without a recorded acknowledgement', async () => {videoGenService.listVideoModels.mockReturnValueOnce([h3]);- getSettings.mockResolvedValueOnce({ videoGen: { acceptedModelTerms: [h3.termsGate.id] } });const accepted = await request(app).get('/api/video-gen/models/minimax_h3_8bit/download');expect(accepted.status).toBe(200);expect(sseDownload.start).toHaveBeenCalledWith(expect.objectContaining({@@ -526,18 +506,8 @@ describe('videoGen routes', () => {}));});- // The install-wide acknowledgement is what makes a single "I accept" click- // authorize every other surface — the music video board, a pipeline stage,- // an agent run — instead of each one 403ing with no UI to resolve it. It is- // also the ONLY authorization: a request cannot assert its own acceptance,- // so nothing renders without a recorded acknowledgement to withdraw.- it('queues the render on the recorded acknowledgement, and never on a self-asserted key', async () => {- const { getSettings } = await import('../services/settings.js');+ it('queues an H3 render without a recorded acknowledgement', async () => {videoGenService.listVideoModels.mockReturnValue([h3]);- getSettings.mockResolvedValueOnce({- imageGen: { local: { pythonPath: '/usr/bin/python3' } },- videoGen: { acceptedModelTerms: [h3.termsGate.id] },- });const render = await request(app).post('/api/video-gen/').send({prompt: 'a fox watches the rain',modelId: h3.id,@@ -548,8 +518,6 @@ describe('videoGen routes', () => {height: 672,});expect(render.status).toBe(200);- // Nothing about the acceptance rides the job: the render re-resolves it- // from settings, so a withdrawal reaches work already in the queue.expect(mediaJobQueue.enqueueJob).toHaveBeenCalledWith(expect.objectContaining({kind: 'video',params: expect.objectContaining({@@ -562,15 +530,6 @@ describe('videoGen routes', () => {}));expect(mediaJobQueue.enqueueJob.mock.calls.at(-1)[0].params).not.toHaveProperty('termsAcceptance');-- const asserted = await request(app).post('/api/video-gen/').send({- prompt: 'a fox watches the rain',- modelId: h3.id,- mode: 'text',- termsAcceptance: h3.termsGate.id,- });- expect(asserted.status).toBe(403);- expect(asserted.body.code).toBe('VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED');videoGenService.listVideoModels.mockReset();});});diff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.jsindex e12c56d11e..908a6e7f24 100644--- a/server/services/videoGen/local.js+++ b/server/services/videoGen/local.js@@ -41,13 +41,9 @@ import { safeChildProcessEnv } from '../../lib/processEnv.js';import { makeVideoGenLineHandler, finalizeGeneratedVideo, isWatchdogSuccess, describeSignalDeath, describeRenderConditioning, RENDER_INPUTS_VERSION } from './generateVideoHelpers.js';import { assertSafeLoraFilename, getLoraKeyLayout } from '../loras.js';import { videoLoraFamily } from '../../lib/runners.js';-import {- isVideoModelTermsAccepted, acceptedVideoModelTerms, videoModelTermsGateId, videoModelTermsError,-} from '../../lib/videoDisclosure.js';import {publicVideoTextEncoderOptions, resolveVideoTextEncoder,} from '../../lib/videoTextEncoders.js';-import { getSettings } from '../settings.js';import {isIcLoraMode, icLoraSpecForMode, resolveIcLoraWeight,assertIcReferenceCount, icResolutionIssue,@@ -1014,18 +1010,6 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', mconst model = resolveVideoModel(modelId);if (!model) throw new ServerError(`Unknown video model: ${modelId}`, { status: 400, code: 'VALIDATION_ERROR' });- // Final execution-boundary gate for a restricted model's license. Route- // preparation also rejects early, but internal producers, persisted jobs, and- // retries all reach this function directly — so authorization is resolved- // HERE, from the install's recorded acknowledgements, rather than trusted- // from a caller-supplied parameter. Read at execution time, so a withdrawn- // acknowledgement (or a license revision that mints a new id) fails a job- // that was queued while it was still accepted. Ungated models never pay for- // the settings read.- if (videoModelTermsGateId(model)- && !isVideoModelTermsAccepted(model, acceptedVideoModelTerms(await getSettings()))) {- throw videoModelTermsError(model);- }// Validate the mode contract before cache lookups, image resize, or staging// work. Internal producers and persisted/retried jobs bypass route// preparation, so silently dropping one of these inputs here would render adiff --git a/server/services/videoGen/local.test.js b/server/services/videoGen/local.test.jsindex f8f6481cba..70f4c4dd37 100644--- a/server/services/videoGen/local.test.js+++ b/server/services/videoGen/local.test.js@@ -2082,42 +2082,6 @@ describe('generateVideo — Wan MLX-Gen contract', () => {});describe('generateVideo — MiniMax H3 MLX contract', () => {- // Every test below renders H3, which is license-gated: authorization comes- // from the install's recorded acknowledgement, re-read here at the render- // boundary rather than trusted from the caller's params.- beforeEach(() => { settingsState.acceptedModelTerms = [H3_TERMS]; });-- it('resolves the license gate from the install record at the render boundary', async () => {- const { spawnDetached } = await import('../../lib/detachedSpawn.js');- vi.mocked(spawnDetached).mockClear();- const base = {- jobId: 'h3-terms',- modelId: 'minimax_h3_8bit',- prompt: 'a fox watches the rain',- width: 512, height: 320, numFrames: 141, fps: 24,- mode: 'text',- };-- settingsState.acceptedModelTerms = [];- await expect(generateVideo(base)).rejects.toMatchObject({- status: 403,- code: 'VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED',- });- // A superseded license revision does not carry forward — a job queued while- // the old one was accepted fails closed at execution.- settingsState.acceptedModelTerms = ['old-license'];- await expect(generateVideo(base)).rejects.toMatchObject({- status: 403,- code: 'VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED',- });- // A caller cannot assert its own acceptance — only the install record counts.- await expect(generateVideo({ ...base, termsAcceptance: H3_TERMS })).rejects.toMatchObject({- status: 403,- code: 'VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED',- });- expect(spawnDetached).not.toHaveBeenCalled();- });-// H3 anchors keyframes at the first/last latent frame only, so the ltx2// arbitrary-index array and every non-keyframe conditioning channel stay out.it.each([@@ -3635,18 +3599,4 @@ describe('generateVideo — MiniMax H3 CUDA contract', () => {const [, args] = cudaCall(spawnMock);expect(args).not.toContain('--offload-profile');});-- it('rejects the license gate from the install record, same as the MLX entry', async () => {- const { spawnDetached } = await import('../../lib/detachedSpawn.js');- vi.mocked(spawnDetached).mockClear();- settingsState.acceptedModelTerms = [];-- await expect(generateVideo({- jobId: 'h3-cuda-terms',- modelId: 'minimax_h3_cuda',- prompt: 'a fox watches the rain',- width: 1344, height: 768, numFrames: 141, fps: 24, mode: 'text',- })).rejects.toMatchObject({ code: 'VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED' });- expect(spawnDetached).not.toHaveBeenCalled();- });});diff --git a/server/services/videoGen/prepareParams.js b/server/services/videoGen/prepareParams.jsindex b64cde9c19..ca69734fbf 100644--- a/server/services/videoGen/prepareParams.js+++ b/server/services/videoGen/prepareParams.js@@ -33,7 +33,6 @@ import { ServerError } from '../../lib/errorHandler.js';import { PATHS, ensureDir, resolveGalleryImage } from '../../lib/fileUtils.js';import { safeUnder } from '../../lib/ffmpeg.js';import { RENDER_TARGET } from '../../lib/renderTargets.js';-import { isVideoModelTermsAccepted, acceptedVideoModelTerms, videoModelTermsError } from '../../lib/videoDisclosure.js';import { videoLoraFamily, isMiniMaxH3Runtime } from '../../lib/runners.js';import {isStockTextEncoder, supportsVideoTextEncoder, videoTextEncoderUnsupportedError,@@ -173,15 +172,6 @@ export async function prepareVideoGenParams({ body, uploads, localOnlyParamKeysawait cleanupMultipartTemp(uploads);throw videoTextEncoderUnsupportedError(effectiveModel, body.textEncoderId);}- // Reject a gated model here so the caller gets a synchronous, actionable 403- // instead of a doomed queue entry. The render itself re-checks (local.js) —- // this is the early half of the same gate, authorized by the same recorded- // acknowledgement (POST /api/video-gen/model-terms).- if (backend !== VIDEO_GEN_MODE.GROK && effectiveModel- && !isVideoModelTermsAccepted(effectiveModel, acceptedVideoModelTerms(settings))) {- await cleanupMultipartTemp(uploads);- throw videoModelTermsError(effectiveModel);- }// Reject up-front when the local python isn't configured AND the model's// runtime needs it. ltx2/wan22/hunyuan bring their own venv (resolved// inside buildArgs), so they must NOT be blocked by the legacy mlx_videodiff --git a/server/services/videoGen/prepareParams.test.js b/server/services/videoGen/prepareParams.test.jsindex f1937a3b73..defa3fb8bf 100644--- a/server/services/videoGen/prepareParams.test.js+++ b/server/services/videoGen/prepareParams.test.js@@ -419,19 +419,8 @@ describe('prepareVideoGenParams — MiniMax H3 contract', () => {getSettings.mockResolvedValue(settingsWith([H3_TERMS]));});- // A render kicked off from a surface with no terms UI of its own (the music- // video board, a pipeline stage) is authorized by the acknowledgement the- // user recorded once — anywhere — rather than 403ing with nowhere to go.- it('requires the install to have recorded this exact reviewed license', async () => {+ it('prepares an H3 text render without a recorded license acknowledgement', async () => {getSettings.mockResolvedValueOnce(settingsWith(undefined));- await expect(prepare({ modelId: H3_MODEL.id, mode: 'text' }))- .rejects.toMatchObject({ status: 403, code: 'VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED' });-- // A superseded license revision does not carry forward to this one.- getSettings.mockResolvedValueOnce(settingsWith(['some-older-license']));- await expect(prepare({ modelId: H3_MODEL.id, mode: 'text' }))- .rejects.toMatchObject({ status: 403, code: 'VIDEO_MODEL_TERMS_ACCEPTANCE_REQUIRED' });-const prepared = await prepare({ modelId: H3_MODEL.id, mode: 'text' });expect(prepared.effectiveModelId).toBe(H3_MODEL.id);expect(prepared.effectiveChunks).toBe(1);