Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(webv2): MiniMax H3 Ref2VA reference mode
Lincoln Steinf05d1e1b978a
diff --git a/docs/src/content/docs/concepts/video-generation.mdx b/docs/src/content/docs/concepts/video-generation.mdxindex 1e7b90684a..5ec3cacebe 100644--- a/docs/src/content/docs/concepts/video-generation.mdx+++ b/docs/src/content/docs/concepts/video-generation.mdx@@ -178,7 +178,9 @@ The bundles are independent; installing both totals ~56 GB (shared components ar### MiniMax H3-MiniMax H3 is a single **FL2VA** model — *first/last-frame to video with audio*. One checkpoint covers every conditioning mode the panel offers (text-to-video, first frame, last frame, both, and extend), and every generation includes a **jointly generated stereo soundtrack**, muxed into the MP4 as AAC.+MiniMax H3 ships as two task transformers that share every other component. **FL2VA** — *first/last-frame to video with audio* — covers text-to-video, first frame, last frame, both, and extend. **Ref2VA** — *reference to video with audio* — conditions a new clip on **reference media**: up to 3 videos and 9 images, in an order you choose (order changes the result). Every generation from either includes a **jointly generated stereo soundtrack**, muxed into the MP4 as AAC.++The panel switches task by transformer: select the Ref2VA single-file transformer in **Model Components** and the conditioning sections become the ordered **References** list; select the FL2VA transformer to get the five frame/extend modes back. A video reference can contribute its image track, its soundtrack, or both — soundtrack-only references must be paired with at least one visual reference. Image references default to a high-detail 2048 px encoding ("Max"); the "Match generation size" option is several times faster at some fidelity cost.What makes it different from Wan in practice:@@ -190,11 +192,13 @@ What makes it different from Wan in practice:#### Installing MiniMax H3-The **MiniMax H3** starter bundle (~62 GB) installs the working set:+The **MiniMax H3** starter bundle (~85 GB) installs the working set:* **MiniMax H3 Components** (~11 GB) — the Diffusers-format main: tokenizer, processor, and the video + audio VAEs. **This is the model you select in the Video panel.**-* **MiniMax H3 FL2VA Transformer (int8, pruned)** (~21 GB) and **MiniMax H3 Text Encoder (int8)** (~27 GB) — single-file builds that slot into the panel's **Model Components** overrides (the bundled templates and the panel wire them the same way).-* **MiniMax H3 Turbo LoRA** and **MiniMax H3 LightX2V Turbo LoRA** — two independent step-distillation LoRAs (both Apache 2.0); the Turbo toggle picks one automatically.+* **MiniMax H3 FL2VA Transformer (int8, pruned)** and **MiniMax H3 Ref2VA Transformer (int8, pruned)** (~21 GB each) plus **MiniMax H3 Text Encoder (int8)** (~27 GB) — single-file builds that slot into the panel's **Model Components** overrides (the bundled templates and the panel wire them the same way). The transformer you pick decides the task: FL2VA for the frame/extend modes, Ref2VA for reference conditioning.+* **MiniMax H3 Turbo LoRA**, **MiniMax H3 LightX2V Turbo LoRA**, and **MiniMax H3 Ref2V Turbo LoRA** — independent step-distillation LoRAs; the Turbo toggle picks the one matching the selected task (the Ref2V build is trained against the Ref2VA transformer only).++Reference conditioning adds rows to every denoising step roughly linearly: a few references typically cost ~1–2 GiB of extra activation memory, but a full-detail 2048×2048 image reference alone adds ~4096 rows (about 1 GiB), and three full-length video references can triple the packed sequence. Prefer "Match generation size" for image references and trimmed clips for video references on smaller cards.H3 is the heaviest local video option — With 16 GB VRAM, `enable_partial_loading` enabled and 32 GB of system RAM it can create a full 345 frame video (about 14s) at 768x768 resolution, but for larger or longer videos a high-VRAM GPU (24 GB+) is strongly recommended.diff --git a/docs/src/content/docs/features/video-workflows.mdx b/docs/src/content/docs/features/video-workflows.mdxindex 3751d89af3..75466747e2 100644--- a/docs/src/content/docs/features/video-workflows.mdx+++ b/docs/src/content/docs/features/video-workflows.mdx@@ -6,7 +6,7 @@ lastUpdated: 2026-08-22import { Card, CardGrid, Steps, LinkButton } from '@astrojs/starlight/components';-InvokeAI ships **fifteen ready-made video workflows** — ten for **Wan 2.2** and five for **MiniMax H3** — so you can start generating video without wiring up nodes yourself. Each one is a complete recipe — open it from the **Workflows** library, pick your models, type a prompt (and/or drop in an image), and press **Invoke**.+InvokeAI ships **sixteen ready-made video workflows** — ten for **Wan 2.2** and six for **MiniMax H3** — so you can start generating video without wiring up nodes yourself. Each one is a complete recipe — open it from the **Workflows** library, pick your models, type a prompt (and/or drop in an image), and press **Invoke**.This page helps you choose the right workflow and run it. For how the models work under the hood, VRAM details, and troubleshooting, see the [Video Generation guide](/concepts/video-generation/).@@ -34,7 +34,7 @@ Whenever a workflow won't run because a model field is empty, open its **Notes**## Which workflow should I use?-The Wan workflows come in three families — **Text to Video**, **Image to Video**, and **Extend Video** — each with a high-quality option, a "concept LoRA" variant, and a lighter low-VRAM option — plus an **Interpolate** workflow that bridges two images and an **Extend Video to Image** variant that steers a continuation toward a target frame. The five **MiniMax H3** workflows cover the same conditioning modes with one model — and add sound.+The Wan workflows come in three families — **Text to Video**, **Image to Video**, and **Extend Video** — each with a high-quality option, a "concept LoRA" variant, and a lighter low-VRAM option — plus an **Interpolate** workflow that bridges two images and an **Extend Video to Image** variant that steers a continuation toward a target frame. The six **MiniMax H3** workflows cover the same conditioning modes — plus reference-conditioned generation — and add sound.| I want to… | Use | Notes ||---|---|---|@@ -44,6 +44,7 @@ The Wan workflows come in three families — **Text to Video**, **Image to Video| Make a video that *ends on* an image | **Last Frame to Video - MiniMax H3** | H3 only — the video builds toward your image. || Make a video between two images | **Interpolate 2 Images to Video - Wan 2.2 Lightning** or **First and Last Frame to Video - MiniMax H3** | Provide a start and end image; the model interpolates between them. || Make a video longer than one generation | **Extend Video - Wan 2.2 Lightning** or **Extend Video - MiniMax H3** | Continues an existing video and stitches the pieces together. |+| Make a clip **in the style/likeness of reference media** | **Reference to Video - MiniMax H3** | Conditions on up to 3 reference videos and 9 images (Ref2VA transformer required); reference order changes the result. || Extend a video toward a specific end frame | **Extend Video to Image - Wan 2.2 Lightning** | Continues a video and interpolates the new part to a target image. || Add my own style/subject LoRAs | the **w/ Concept LoRAs** variant of a Wan workflow | Same as the base workflow, plus slots for your LoRAs. || Run on a smaller GPU (≈12–16 GB) | a **TI2V-5B (Low Quality)** workflow | Smaller model, lower memory, lower quality. |@@ -128,7 +129,7 @@ Because the endpoint is pinned to your image, it's ideal for bridging a clip to## Bundled MiniMax H3 workflows-One model, five workflows, every conditioning mode — and every output is an MP4 with a **jointly generated stereo soundtrack**. All five default to the **Turbo** step-distillation LoRA (6 steps); H3 has no CFG or negative prompt to tune, and always renders at 24 fps.+One model family, six workflows, every conditioning mode — and every output is an MP4 with a **jointly generated stereo soundtrack**. All default to a **Turbo** step-distillation LoRA (6 steps for FL2VA, 4 for Ref2VA); H3 has no CFG or negative prompt to tune, and always renders at 24 fps. **Reference to Video** needs the Ref2VA transformer selected in the model loader; the other five use FL2VA.<CardGrid><Card title="Text to Video - MiniMax H3" icon="pencil">diff --git a/invokeai/app/invocations/metadata.py b/invokeai/app/invocations/metadata.pyindex 9e725c1098..139243dc88 100644--- a/invokeai/app/invocations/metadata.py+++ b/invokeai/app/invocations/metadata.py@@ -194,16 +194,31 @@ GENERATION_MODES = Literal["minimax_h3_lf2v","minimax_h3_flf2v","minimax_h3_extend_video",+ "minimax_h3_ref2v","minimax_h3_txt2img",]+class MiniMaxH3ReferenceMetadataField(BaseModel):+ """One recorded Ref2VA reference: names and options only, in conditioning order."""++ kind: Literal["image", "video"] = Field(description="Whether the reference was an image or a video.")+ image_name: Optional[str] = Field(default=None, description="The reference image's name.")+ video_name: Optional[str] = Field(default=None, description="The reference video's name.")+ conditioning: Optional[str] = Field(+ default=None, description="A video reference's conditioning choice (video_audio / video / audio)."+ )+ detail: Optional[str] = Field(default=None, description="An image reference's sizing choice (max / match).")+ start_frame: Optional[int] = Field(default=None, description="A video reference's trim start (inclusive).")+ end_frame: Optional[int] = Field(default=None, description="A video reference's trim end (inclusive).")++@invocation("core_metadata",title="Core Metadata",tags=["metadata"],category="metadata",- version="2.4.0",+ version="2.5.0",classification=Classification.Internal,)class CoreMetadataInvocation(BaseInvocation):@@ -299,6 +314,11 @@ class CoreMetadataInvocation(BaseInvocation):default=None,description="The single-file MiniMax H3 Qwen3-VL text encoder used in place of the main model's",)+ minimax_h3_references: Optional[list[MiniMaxH3ReferenceMetadataField]] = InputField(+ default=None,+ description="The ordered Ref2VA references this generation was conditioned on (names and options only; "+ "the media is re-resolved from the gallery at recall time)",+ )# High resolution fix metadata.hrf_enabled: Optional[bool] = InputField(diff --git a/invokeai/app/services/workflow_records/default_workflows/Extend Video - MiniMax H3.json b/invokeai/app/services/workflow_records/default_workflows/Extend Video - MiniMax H3.jsonindex c3d91cb1cd..1a3dc29ec7 100644--- a/invokeai/app/services/workflow_records/default_workflows/Extend Video - MiniMax H3.json+++ b/invokeai/app/services/workflow_records/default_workflows/Extend Video - MiniMax H3.json@@ -338,7 +338,7 @@"type": "invocation","data": {"id": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",- "version": "2.4.0",+ "version": "2.5.0","nodePack": "invokeai","label": "Core Metadata","notes": "Everything except the generation mode arrives over an edge from the node that used the value, so the record cannot go stale.",diff --git a/invokeai/app/services/workflow_records/default_workflows/First Frame to Video - MiniMax H3.json b/invokeai/app/services/workflow_records/default_workflows/First Frame to Video - MiniMax H3.jsonindex 4ee49d6852..3acda8b4df 100644--- a/invokeai/app/services/workflow_records/default_workflows/First Frame to Video - MiniMax H3.json+++ b/invokeai/app/services/workflow_records/default_workflows/First Frame to Video - MiniMax H3.json@@ -330,7 +330,7 @@"type": "invocation","data": {"id": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",- "version": "2.4.0",+ "version": "2.5.0","nodePack": "invokeai","label": "Core Metadata","notes": "Everything except the generation mode arrives over an edge from the node that used the value, so the record cannot go stale.",diff --git a/invokeai/app/services/workflow_records/default_workflows/First and Last Frame to Video - MiniMax H3.json b/invokeai/app/services/workflow_records/default_workflows/First and Last Frame to Video - MiniMax H3.jsonindex a176026d1b..76b7d50d6c 100644--- a/invokeai/app/services/workflow_records/default_workflows/First and Last Frame to Video - MiniMax H3.json+++ b/invokeai/app/services/workflow_records/default_workflows/First and Last Frame to Video - MiniMax H3.json@@ -334,7 +334,7 @@"type": "invocation","data": {"id": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",- "version": "2.4.0",+ "version": "2.5.0","nodePack": "invokeai","label": "Core Metadata","notes": "Everything except the generation mode arrives over an edge from the node that used the value, so the record cannot go stale.",diff --git a/invokeai/app/services/workflow_records/default_workflows/Last Frame to Video - MiniMax H3.json b/invokeai/app/services/workflow_records/default_workflows/Last Frame to Video - MiniMax H3.jsonindex 7225013cdf..dccbe2cc61 100644--- a/invokeai/app/services/workflow_records/default_workflows/Last Frame to Video - MiniMax H3.json+++ b/invokeai/app/services/workflow_records/default_workflows/Last Frame to Video - MiniMax H3.json@@ -330,7 +330,7 @@"type": "invocation","data": {"id": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",- "version": "2.4.0",+ "version": "2.5.0","nodePack": "invokeai","label": "Core Metadata","notes": "Everything except the generation mode arrives over an edge from the node that used the value, so the record cannot go stale.",diff --git a/invokeai/app/services/workflow_records/default_workflows/Reference to Video - MiniMax H3.json b/invokeai/app/services/workflow_records/default_workflows/Reference to Video - MiniMax H3.jsonnew file mode 100644index 0000000000..cfadad69a7--- /dev/null+++ b/invokeai/app/services/workflow_records/default_workflows/Reference to Video - MiniMax H3.json@@ -0,0 +1,1343 @@+{+ "name": "Reference to Video - MiniMax H3",+ "author": "InvokeAI",+ "description": "Generate video+audio conditioned on reference media with MiniMax H3 Ref2VA.",+ "version": "1.1.0",+ "contact": "",+ "tags": "minimax h3, text to video, video, audio",+ "notes": "Condition a new clip on reference media: wire up to 3 Video Reference and up to 9 Image Reference nodes through chained Collect nodes into BOTH the Reference Conditioning node and the Prompt node - the same ordered references must reach both, and reference ORDER changes the result. A video reference can contribute its image track, its soundtrack, or both (soundtrack-only references must be paired with at least one visual reference).\n\nNumber of Frames appears twice: the Denoise node's dropdown and the integer field feeding the Prompt and Reference Conditioning nodes. They must match; the run stops with a clear error if they do not.\n\nSelect the Ref2VA transformer (e.g. 'MiniMax H3 Ref2VA Transformer (int8, pruned)') in the model loader's Transformer field - the FL2VA transformer cannot consume references.\n\nEach InvokeAI install assigns its own internal model IDs, so every model field ships blank -- pick your installed models in the form before invoking.",+ "exposedFields": [+ {+ "nodeId": "9c0f3e11-2a3b-4c5d-8e6f-7a8b9c0d1e02",+ "fieldName": "value"+ },+ {+ "nodeId": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "fieldName": "width"+ },+ {+ "nodeId": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "fieldName": "height"+ },+ {+ "nodeId": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "fieldName": "target_resolution"+ },+ {+ "nodeId": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "fieldName": "num_frames"+ },+ {+ "nodeId": "9d1a4f22-3b4c-4d6e-9f70-8b9c0d1e2f03",+ "fieldName": "value"+ },+ {+ "nodeId": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "fieldName": "model"+ },+ {+ "nodeId": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "fieldName": "transformer_model"+ },+ {+ "nodeId": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "fieldName": "text_encoder_model"+ },+ {+ "nodeId": "9f10ad7a-1c2b-4d3e-8f40-5a6b7c8d9e01",+ "fieldName": "lora"+ },+ {+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001",+ "fieldName": "video"+ },+ {+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001",+ "fieldName": "conditioning"+ },+ {+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001",+ "fieldName": "start_frame"+ },+ {+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001",+ "fieldName": "end_frame"+ },+ {+ "nodeId": "8fa20002-1a2b-4c3d-8e4f-5a6b7c8d0002",+ "fieldName": "image"+ },+ {+ "nodeId": "8fa20002-1a2b-4c3d-8e4f-5a6b7c8d0002",+ "fieldName": "detail"+ },+ {+ "nodeId": "8fa60006-1a2b-4c3d-8e4f-5a6b7c8d0006",+ "fieldName": "value"+ }+ ],+ "meta": {+ "version": "4.0.0",+ "category": "default"+ },+ "nodes": [+ {+ "id": "9c0f3e11-2a3b-4c5d-8e6f-7a8b9c0d1e02",+ "type": "invocation",+ "data": {+ "id": "9c0f3e11-2a3b-4c5d-8e6f-7a8b9c0d1e02",+ "version": "1.0.1",+ "nodePack": "invokeai",+ "label": "Prompt",+ "notes": "Feeds the text encoder and the metadata record from one place, so the recorded prompt is always the prompt that ran.",+ "type": "string",+ "inputs": {+ "value": {+ "name": "value",+ "label": "Prompt",+ "description": "",+ "value": ""+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 620,+ "y": -320+ }+ },+ {+ "id": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "type": "invocation",+ "data": {+ "id": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "version": "1.4.0",+ "nodePack": "invokeai",+ "label": "",+ "notes": "",+ "type": "minimax_h3_model_loader",+ "inputs": {+ "model": {+ "name": "model",+ "label": "",+ "description": "",+ "value": null+ },+ "transformer_model": {+ "name": "transformer_model",+ "label": "",+ "description": "",+ "value": null+ },+ "text_encoder_model": {+ "name": "text_encoder_model",+ "label": "",+ "description": "",+ "value": null+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": false+ },+ "position": {+ "x": 140,+ "y": 420+ }+ },+ {+ "id": "9f10ad7a-1c2b-4d3e-8f40-5a6b7c8d9e01",+ "type": "invocation",+ "data": {+ "id": "9f10ad7a-1c2b-4d3e-8f40-5a6b7c8d9e01",+ "version": "1.1.0",+ "nodePack": "invokeai",+ "label": "",+ "notes": "The Turbo step-distillation LoRA is what makes 6 steps enough. Remove this node and raise the step count to about 50.",+ "type": "minimax_h3_lora_loader",+ "inputs": {+ "lora": {+ "name": "lora",+ "label": "",+ "description": "",+ "value": null+ },+ "weight": {+ "name": "weight",+ "label": "",+ "description": "",+ "value": 1+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 620,+ "y": 620+ }+ },+ {+ "id": "9f3c6144-5d6e-4f80-b192-0d1e2f3a4b05",+ "type": "invocation",+ "data": {+ "id": "9f3c6144-5d6e-4f80-b192-0d1e2f3a4b05",+ "version": "1.1.0",+ "nodePack": "invokeai",+ "label": "LoRAs (metadata)",+ "notes": "",+ "type": "collect",+ "inputs": {+ "collection": {+ "name": "collection",+ "label": "",+ "description": "",+ "value": []+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 1000,+ "y": 700+ }+ },+ {+ "id": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "type": "invocation",+ "data": {+ "id": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "version": "1.1.0",+ "nodePack": "invokeai",+ "label": "Prompt",+ "notes": "H3 is guidance-distilled: there is no negative prompt. The prompt and canvas arrive over edges so they always match the denoise node.",+ "type": "minimax_h3_text_encoder",+ "inputs": {+ "prompt": {+ "name": "prompt",+ "label": "Prompt",+ "description": "",+ "value": ""+ },+ "width": {+ "name": "width",+ "label": "",+ "description": "",+ "value": 1344+ },+ "height": {+ "name": "height",+ "label": "",+ "description": "",+ "value": 768+ },+ "references": {+ "name": "references",+ "label": "",+ "description": "",+ "value": null+ },+ "num_frames": {+ "name": "num_frames",+ "label": "",+ "description": "",+ "value": null+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 620,+ "y": -140+ }+ },+ {+ "id": "9c4cab0b-316c-8faf-c05e-6d7baf90eb03",+ "type": "invocation",+ "data": {+ "id": "9c4cab0b-316c-8faf-c05e-6d7baf90eb03",+ "version": "1.0.1",+ "nodePack": "invokeai",+ "label": "",+ "notes": "",+ "type": "rand_int",+ "inputs": {+ "low": {+ "name": "low",+ "label": "",+ "description": "",+ "value": 0+ },+ "high": {+ "name": "high",+ "label": "",+ "description": "",+ "value": 2147483647+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": false+ },+ "position": {+ "x": 1000,+ "y": 900+ }+ },+ {+ "id": "9d1a4f22-3b4c-4d6e-9f70-8b9c0d1e2f03",+ "type": "invocation",+ "data": {+ "id": "9d1a4f22-3b4c-4d6e-9f70-8b9c0d1e2f03",+ "version": "1.0.1",+ "nodePack": "invokeai",+ "label": "Steps",+ "notes": "6 steps assumes the Turbo LoRA. Without it, about 50.",+ "type": "integer",+ "inputs": {+ "value": {+ "name": "value",+ "label": "Steps",+ "description": "",+ "value": 6+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 620,+ "y": 900+ }+ },+ {+ "id": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "type": "invocation",+ "data": {+ "id": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "version": "1.4.0",+ "nodePack": "invokeai",+ "label": "",+ "notes": "",+ "type": "minimax_h3_denoise",+ "inputs": {+ "width": {+ "name": "width",+ "label": "",+ "description": "",+ "value": 1344+ },+ "height": {+ "name": "height",+ "label": "",+ "description": "",+ "value": 768+ },+ "num_frames": {+ "name": "num_frames",+ "label": "Frames",+ "description": "",+ "value": "124"+ },+ "steps": {+ "name": "steps",+ "label": "",+ "description": "",+ "value": 6+ },+ "seed": {+ "name": "seed",+ "label": "",+ "description": "",+ "value": 0+ },+ "reference_conditioning": {+ "name": "reference_conditioning",+ "label": "",+ "description": "",+ "value": null+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 1420,+ "y": -60+ }+ },+ {+ "id": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "type": "invocation",+ "data": {+ "id": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "version": "2.5.0",+ "nodePack": "invokeai",+ "label": "Core Metadata",+ "notes": "Everything except the generation mode arrives over an edge from the node that used the value, so the record cannot go stale.",+ "type": "core_metadata",+ "inputs": {+ "generation_mode": {+ "name": "generation_mode",+ "label": "",+ "description": "",+ "value": "minimax_h3_ref2v"+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 1860,+ "y": 380+ }+ },+ {+ "id": "9e5dcb1c-527d-9fb0-d16f-7e8cbaa1fc05",+ "type": "invocation",+ "data": {+ "id": "9e5dcb1c-527d-9fb0-d16f-7e8cbaa1fc05",+ "version": "1.0.0",+ "nodePack": "invokeai",+ "label": "",+ "notes": "",+ "type": "minimax_h3_latents_to_video",+ "inputs": {},+ "isOpen": true,+ "isIntermediate": false,+ "useCache": true+ },+ "position": {+ "x": 2300,+ "y": -60+ }+ },+ {+ "id": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "type": "invocation",+ "data": {+ "id": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "version": "1.1.0",+ "nodePack": "invokeai",+ "label": "",+ "notes": "Type the aspect ratio you want as width/height; the node snaps it onto a canvas H3 can render. '768 lowres' pins the long edge to 768 for fast renders -- switch to '768 highres' for the model's native canvas.",+ "type": "minimax_h3_ideal_dimensions",+ "inputs": {+ "width": {+ "name": "width",+ "label": "",+ "description": "",+ "value": 768+ },+ "height": {+ "name": "height",+ "label": "",+ "description": "",+ "value": 768+ },+ "target_resolution": {+ "name": "target_resolution",+ "label": "",+ "description": "",+ "value": "768 lowres"+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 120,+ "y": 60+ }+ },+ {+ "id": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001",+ "type": "invocation",+ "data": {+ "id": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001",+ "version": "1.0.0",+ "nodePack": "invokeai",+ "label": "Video Reference",+ "notes": "One reference video, trimmed to [start_frame, end_frame]. 'Audio only' conditions on its soundtrack alone.",+ "type": "minimax_h3_video_reference",+ "inputs": {+ "video": {+ "name": "video",+ "label": "",+ "description": "",+ "value": null+ },+ "conditioning": {+ "name": "conditioning",+ "label": "",+ "description": "",+ "value": "video_audio"+ },+ "start_frame": {+ "name": "start_frame",+ "label": "",+ "description": "",+ "value": 0+ },+ "end_frame": {+ "name": "end_frame",+ "label": "",+ "description": "",+ "value": -1+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": -340,+ "y": -320+ }+ },+ {+ "id": "8fa20002-1a2b-4c3d-8e4f-5a6b7c8d0002",+ "type": "invocation",+ "data": {+ "id": "8fa20002-1a2b-4c3d-8e4f-5a6b7c8d0002",+ "version": "1.0.0",+ "nodePack": "invokeai",+ "label": "Image Reference",+ "notes": "One reference image. 'Max' detail (2048px) is highest fidelity but adds rows to every denoising step.",+ "type": "minimax_h3_image_reference",+ "inputs": {+ "image": {+ "name": "image",+ "label": "",+ "description": "",+ "value": null+ },+ "detail": {+ "name": "detail",+ "label": "",+ "description": "",+ "value": "max"+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": -340,+ "y": -40+ }+ },+ {+ "id": "8fa30003-1a2b-4c3d-8e4f-5a6b7c8d0003",+ "type": "invocation",+ "data": {+ "id": "8fa30003-1a2b-4c3d-8e4f-5a6b7c8d0003",+ "version": "1.1.0",+ "nodePack": "invokeai",+ "label": "References 1",+ "notes": "Chained collectors keep the reference order deterministic - order is part of the request.",+ "type": "collect",+ "inputs": {+ "collection": {+ "name": "collection",+ "label": "",+ "description": "",+ "value": []+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": -60,+ "y": -320+ }+ },+ {+ "id": "8fa40004-1a2b-4c3d-8e4f-5a6b7c8d0004",+ "type": "invocation",+ "data": {+ "id": "8fa40004-1a2b-4c3d-8e4f-5a6b7c8d0004",+ "version": "1.1.0",+ "nodePack": "invokeai",+ "label": "References 2",+ "notes": "",+ "type": "collect",+ "inputs": {+ "collection": {+ "name": "collection",+ "label": "",+ "description": "",+ "value": []+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": -60,+ "y": -80+ }+ },+ {+ "id": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "type": "invocation",+ "data": {+ "id": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "version": "1.0.0",+ "nodePack": "invokeai",+ "label": "",+ "notes": "",+ "type": "minimax_h3_reference_conditioning",+ "inputs": {+ "references": {+ "name": "references",+ "label": "",+ "description": "",+ "value": null+ },+ "vae": {+ "name": "vae",+ "label": "",+ "description": "",+ "value": null+ },+ "audio_vae": {+ "name": "audio_vae",+ "label": "",+ "description": "",+ "value": null+ },+ "num_frames": {+ "name": "num_frames",+ "label": "",+ "description": "",+ "value": 124+ },+ "width": {+ "name": "width",+ "label": "",+ "description": "",+ "value": 1344+ },+ "height": {+ "name": "height",+ "label": "",+ "description": "",+ "value": 768+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": 220,+ "y": -200+ }+ },+ {+ "id": "8fa60006-1a2b-4c3d-8e4f-5a6b7c8d0006",+ "type": "invocation",+ "data": {+ "id": "8fa60006-1a2b-4c3d-8e4f-5a6b7c8d0006",+ "version": "1.0.1",+ "nodePack": "invokeai",+ "label": "Number of Frames (references)",+ "notes": "Must match the Denoise node's Number of Frames; the run stops with a clear error if they differ.",+ "type": "integer",+ "inputs": {+ "value": {+ "name": "value",+ "label": "",+ "description": "",+ "value": 124+ }+ },+ "isOpen": true,+ "isIntermediate": true,+ "useCache": true+ },+ "position": {+ "x": -340,+ "y": 200+ }+ }+ ],+ "edges": [+ {+ "id": "edge-9c0f3e11-value-9b2f7d8c-prompt",+ "source": "9c0f3e11-2a3b-4c5d-8e6f-7a8b9c0d1e02",+ "sourceHandle": "value",+ "target": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "targetHandle": "prompt",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-text_encoder-9b2f7d8c-text_encoder",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "text_encoder",+ "target": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "targetHandle": "text_encoder",+ "type": "default"+ },+ {+ "id": "edge-9b2f7d8c-conditioning-9d3b9faf-positive_conditioning",+ "source": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "sourceHandle": "conditioning",+ "target": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "targetHandle": "positive_conditioning",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-transformer-9f10ad7a-transformer",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "transformer",+ "target": "9f10ad7a-1c2b-4d3e-8f40-5a6b7c8d9e01",+ "targetHandle": "transformer",+ "type": "default"+ },+ {+ "id": "edge-9f10ad7a-transformer-9d3b9faf-transformer",+ "source": "9f10ad7a-1c2b-4d3e-8f40-5a6b7c8d9e01",+ "sourceHandle": "transformer",+ "target": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "targetHandle": "transformer",+ "type": "default"+ },+ {+ "id": "edge-9d1a4f22-value-9d3b9faf-steps",+ "source": "9d1a4f22-3b4c-4d6e-9f70-8b9c0d1e2f03",+ "sourceHandle": "value",+ "target": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "targetHandle": "steps",+ "type": "default"+ },+ {+ "id": "edge-9c4cab0b-value-9d3b9faf-seed",+ "source": "9c4cab0b-316c-8faf-c05e-6d7baf90eb03",+ "sourceHandle": "value",+ "target": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "targetHandle": "seed",+ "type": "default"+ },+ {+ "id": "edge-9e8d7c6b-width-9b2f7d8c-width",+ "source": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "sourceHandle": "width",+ "target": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "targetHandle": "width",+ "type": "default"+ },+ {+ "id": "edge-9e8d7c6b-height-9b2f7d8c-height",+ "source": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "sourceHandle": "height",+ "target": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "targetHandle": "height",+ "type": "default"+ },+ {+ "id": "edge-9e8d7c6b-width-9d3b9faf-width",+ "source": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "sourceHandle": "width",+ "target": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "targetHandle": "width",+ "type": "default"+ },+ {+ "id": "edge-9e8d7c6b-height-9d3b9faf-height",+ "source": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "sourceHandle": "height",+ "target": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "targetHandle": "height",+ "type": "default"+ },+ {+ "id": "edge-9d3b9faf-video_latents-9e5dcb1c-video_latents",+ "source": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "sourceHandle": "video_latents",+ "target": "9e5dcb1c-527d-9fb0-d16f-7e8cbaa1fc05",+ "targetHandle": "video_latents",+ "type": "default"+ },+ {+ "id": "edge-9d3b9faf-audio_latents-9e5dcb1c-audio_latents",+ "source": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "sourceHandle": "audio_latents",+ "target": "9e5dcb1c-527d-9fb0-d16f-7e8cbaa1fc05",+ "targetHandle": "audio_latents",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-vae-9e5dcb1c-vae",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "vae",+ "target": "9e5dcb1c-527d-9fb0-d16f-7e8cbaa1fc05",+ "targetHandle": "vae",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-audio_vae-9e5dcb1c-audio_vae",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "audio_vae",+ "target": "9e5dcb1c-527d-9fb0-d16f-7e8cbaa1fc05",+ "targetHandle": "audio_vae",+ "type": "default"+ },+ {+ "id": "edge-9c0f3e11-value-9e2b5033-positive_prompt",+ "source": "9c0f3e11-2a3b-4c5d-8e6f-7a8b9c0d1e02",+ "sourceHandle": "value",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "positive_prompt",+ "type": "default"+ },+ {+ "id": "edge-9d1a4f22-value-9e2b5033-steps",+ "source": "9d1a4f22-3b4c-4d6e-9f70-8b9c0d1e2f03",+ "sourceHandle": "value",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "steps",+ "type": "default"+ },+ {+ "id": "edge-9c4cab0b-value-9e2b5033-seed",+ "source": "9c4cab0b-316c-8faf-c05e-6d7baf90eb03",+ "sourceHandle": "value",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "seed",+ "type": "default"+ },+ {+ "id": "edge-9d3b9faf-width-9e2b5033-width",+ "source": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "sourceHandle": "width",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "width",+ "type": "default"+ },+ {+ "id": "edge-9d3b9faf-height-9e2b5033-height",+ "source": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "sourceHandle": "height",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "height",+ "type": "default"+ },+ {+ "id": "edge-9d3b9faf-num_frames-9e2b5033-num_frames",+ "source": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "sourceHandle": "num_frames",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "num_frames",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-model-9e2b5033-model",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "model",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "model",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-transformer_model-9e2b5033-minimax_h3_transformer_model",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "transformer_model",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "minimax_h3_transformer_model",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-text_encoder_model-9e2b5033-minimax_h3_text_encoder_model",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "text_encoder_model",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "minimax_h3_text_encoder_model",+ "type": "default"+ },+ {+ "id": "edge-9f10ad7a-lora_metadata-9f3c6144-item",+ "source": "9f10ad7a-1c2b-4d3e-8f40-5a6b7c8d9e01",+ "sourceHandle": "lora_metadata",+ "target": "9f3c6144-5d6e-4f80-b192-0d1e2f3a4b05",+ "targetHandle": "item",+ "type": "default"+ },+ {+ "id": "edge-9f3c6144-collection-9e2b5033-loras",+ "source": "9f3c6144-5d6e-4f80-b192-0d1e2f3a4b05",+ "sourceHandle": "collection",+ "target": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "targetHandle": "loras",+ "type": "default"+ },+ {+ "id": "edge-9e2b5033-metadata-9e5dcb1c-metadata",+ "source": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",+ "sourceHandle": "metadata",+ "target": "9e5dcb1c-527d-9fb0-d16f-7e8cbaa1fc05",+ "targetHandle": "metadata",+ "type": "default"+ },+ {+ "id": "edge-8fa10001-reference-8fa30003-item",+ "source": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001",+ "sourceHandle": "reference",+ "target": "8fa30003-1a2b-4c3d-8e4f-5a6b7c8d0003",+ "targetHandle": "item",+ "type": "default"+ },+ {+ "id": "edge-8fa30003-collection-8fa40004-collection",+ "source": "8fa30003-1a2b-4c3d-8e4f-5a6b7c8d0003",+ "sourceHandle": "collection",+ "target": "8fa40004-1a2b-4c3d-8e4f-5a6b7c8d0004",+ "targetHandle": "collection",+ "type": "default"+ },+ {+ "id": "edge-8fa20002-reference-8fa40004-item",+ "source": "8fa20002-1a2b-4c3d-8e4f-5a6b7c8d0002",+ "sourceHandle": "reference",+ "target": "8fa40004-1a2b-4c3d-8e4f-5a6b7c8d0004",+ "targetHandle": "item",+ "type": "default"+ },+ {+ "id": "edge-8fa40004-collection-8fa50005-references",+ "source": "8fa40004-1a2b-4c3d-8e4f-5a6b7c8d0004",+ "sourceHandle": "collection",+ "target": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "targetHandle": "references",+ "type": "default"+ },+ {+ "id": "edge-8fa40004-collection-9b2f7d8c-references",+ "source": "8fa40004-1a2b-4c3d-8e4f-5a6b7c8d0004",+ "sourceHandle": "collection",+ "target": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "targetHandle": "references",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-vae-8fa50005-vae",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "vae",+ "target": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "targetHandle": "vae",+ "type": "default"+ },+ {+ "id": "edge-9a1e6c7b-audio_vae-8fa50005-audio_vae",+ "source": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "sourceHandle": "audio_vae",+ "target": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "targetHandle": "audio_vae",+ "type": "default"+ },+ {+ "id": "edge-8fa50005-reference_conditioning-9d3b9faf-reference_conditioning",+ "source": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "sourceHandle": "reference_conditioning",+ "target": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "targetHandle": "reference_conditioning",+ "type": "default"+ },+ {+ "id": "edge-9e8d7c6b-width-8fa50005-width",+ "source": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "sourceHandle": "width",+ "target": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "targetHandle": "width",+ "type": "default"+ },+ {+ "id": "edge-9e8d7c6b-height-8fa50005-height",+ "source": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "sourceHandle": "height",+ "target": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "targetHandle": "height",+ "type": "default"+ },+ {+ "id": "edge-8fa60006-value-9b2f7d8c-num_frames",+ "source": "8fa60006-1a2b-4c3d-8e4f-5a6b7c8d0006",+ "sourceHandle": "value",+ "target": "9b2f7d8c-2e3f-5c4d-9f2b-3a4e5d6c7b02",+ "targetHandle": "num_frames",+ "type": "default"+ },+ {+ "id": "edge-8fa60006-value-8fa50005-num_frames",+ "source": "8fa60006-1a2b-4c3d-8e4f-5a6b7c8d0006",+ "sourceHandle": "value",+ "target": "8fa50005-1a2b-4c3d-8e4f-5a6b7c8d0005",+ "targetHandle": "num_frames",+ "type": "default"+ }+ ],+ "form": {+ "elements": {+ "root": {+ "id": "root",+ "type": "container",+ "data": {+ "children": [+ "heading-t2v-gen",+ "node-field-t2v-prompt",+ "heading-ref2v-refs",+ "node-field-ref2v-video",+ "node-field-ref2v-conditioning",+ "container-ref2v-trim",+ "node-field-ref2v-image",+ "node-field-ref2v-detail",+ "node-field-ref2v-frames-int",+ "container-t2v-size",+ "container-t2v-len",+ "divider-t2v",+ "heading-t2v-model",+ "container-t2v-model"+ ],+ "layout": "column"+ }+ },+ "heading-t2v-gen": {+ "id": "heading-t2v-gen",+ "parentId": "root",+ "type": "heading",+ "data": {+ "content": "Generation"+ }+ },+ "node-field-t2v-prompt": {+ "id": "node-field-t2v-prompt",+ "parentId": "root",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9c0f3e11-2a3b-4c5d-8e6f-7a8b9c0d1e02",+ "fieldName": "value"+ },+ "showDescription": false,+ "settings": {+ "type": "string-field-config",+ "component": "textarea"+ }+ }+ },+ "container-t2v-size": {+ "id": "container-t2v-size",+ "parentId": "root",+ "type": "container",+ "data": {+ "children": [+ "container-t2v-wh",+ "node-field-t2v-resolution"+ ],+ "layout": "column"+ }+ },+ "container-t2v-wh": {+ "id": "container-t2v-wh",+ "parentId": "container-t2v-size",+ "type": "container",+ "data": {+ "children": [+ "node-field-t2v-width",+ "node-field-t2v-height"+ ],+ "layout": "row"+ }+ },+ "node-field-t2v-width": {+ "id": "node-field-t2v-width",+ "parentId": "container-t2v-wh",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "fieldName": "width"+ },+ "showDescription": false+ }+ },+ "node-field-t2v-height": {+ "id": "node-field-t2v-height",+ "parentId": "container-t2v-wh",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "fieldName": "height"+ },+ "showDescription": false+ }+ },+ "node-field-t2v-resolution": {+ "id": "node-field-t2v-resolution",+ "parentId": "container-t2v-size",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b",+ "fieldName": "target_resolution"+ },+ "showDescription": false+ }+ },+ "container-t2v-len": {+ "id": "container-t2v-len",+ "parentId": "root",+ "type": "container",+ "data": {+ "children": [+ "node-field-t2v-frames",+ "node-field-t2v-steps"+ ],+ "layout": "row"+ }+ },+ "node-field-t2v-frames": {+ "id": "node-field-t2v-frames",+ "parentId": "container-t2v-len",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9d3b9faf-405b-7e6f-bf4d-5c6a7f8e9d04",+ "fieldName": "num_frames"+ },+ "showDescription": false+ }+ },+ "node-field-t2v-steps": {+ "id": "node-field-t2v-steps",+ "parentId": "container-t2v-len",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9d1a4f22-3b4c-4d6e-9f70-8b9c0d1e2f03",+ "fieldName": "value"+ },+ "showDescription": false,+ "settings": {+ "type": "integer-field-config",+ "showShuffle": false,+ "component": "number-input"+ }+ }+ },+ "divider-t2v": {+ "id": "divider-t2v",+ "parentId": "root",+ "type": "divider"+ },+ "heading-t2v-model": {+ "id": "heading-t2v-model",+ "parentId": "root",+ "type": "heading",+ "data": {+ "content": "Model"+ }+ },+ "container-t2v-model": {+ "id": "container-t2v-model",+ "parentId": "root",+ "type": "container",+ "data": {+ "children": [+ "node-field-t2v-model",+ "node-field-t2v-transformer",+ "node-field-t2v-textencoder",+ "node-field-t2v-lora"+ ],+ "layout": "column"+ }+ },+ "node-field-t2v-model": {+ "id": "node-field-t2v-model",+ "parentId": "container-t2v-model",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "fieldName": "model"+ },+ "showDescription": false+ }+ },+ "node-field-t2v-transformer": {+ "id": "node-field-t2v-transformer",+ "parentId": "container-t2v-model",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "fieldName": "transformer_model"+ },+ "showDescription": false+ }+ },+ "node-field-t2v-textencoder": {+ "id": "node-field-t2v-textencoder",+ "parentId": "container-t2v-model",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9a1e6c7b-1d2f-4b3c-8e1a-2f3d4c5b6a01",+ "fieldName": "text_encoder_model"+ },+ "showDescription": false+ }+ },+ "node-field-t2v-lora": {+ "id": "node-field-t2v-lora",+ "parentId": "container-t2v-model",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "nodeId": "9f10ad7a-1c2b-4d3e-8f40-5a6b7c8d9e01",+ "fieldName": "lora"+ },+ "showDescription": false+ }+ },+ "heading-ref2v-refs": {+ "id": "heading-ref2v-refs",+ "parentId": "root",+ "type": "heading",+ "data": {+ "content": "References"+ }+ },+ "node-field-ref2v-video": {+ "id": "node-field-ref2v-video",+ "parentId": "root",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "fieldName": "video",+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001"+ },+ "showDescription": false+ }+ },+ "node-field-ref2v-conditioning": {+ "id": "node-field-ref2v-conditioning",+ "parentId": "root",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "fieldName": "conditioning",+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001"+ },+ "showDescription": false+ }+ },+ "container-ref2v-trim": {+ "id": "container-ref2v-trim",+ "parentId": "root",+ "type": "container",+ "data": {+ "children": [+ "node-field-ref2v-start",+ "node-field-ref2v-end"+ ],+ "layout": "row"+ }+ },+ "node-field-ref2v-start": {+ "id": "node-field-ref2v-start",+ "parentId": "container-ref2v-trim",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "fieldName": "start_frame",+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001"+ },+ "showDescription": false,+ "settings": {+ "component": "number-input",+ "showShuffle": false,+ "type": "integer-field-config"+ }+ }+ },+ "node-field-ref2v-end": {+ "id": "node-field-ref2v-end",+ "parentId": "container-ref2v-trim",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "fieldName": "end_frame",+ "nodeId": "8fa10001-1a2b-4c3d-8e4f-5a6b7c8d0001"+ },+ "showDescription": false,+ "settings": {+ "component": "number-input",+ "showShuffle": false,+ "type": "integer-field-config"+ }+ }+ },+ "node-field-ref2v-image": {+ "id": "node-field-ref2v-image",+ "parentId": "root",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "fieldName": "image",+ "nodeId": "8fa20002-1a2b-4c3d-8e4f-5a6b7c8d0002"+ },+ "showDescription": false+ }+ },+ "node-field-ref2v-detail": {+ "id": "node-field-ref2v-detail",+ "parentId": "root",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "fieldName": "detail",+ "nodeId": "8fa20002-1a2b-4c3d-8e4f-5a6b7c8d0002"+ },+ "showDescription": false+ }+ },+ "node-field-ref2v-frames-int": {+ "id": "node-field-ref2v-frames-int",+ "parentId": "root",+ "type": "node-field",+ "data": {+ "fieldIdentifier": {+ "fieldName": "value",+ "nodeId": "8fa60006-1a2b-4c3d-8e4f-5a6b7c8d0006"+ },+ "showDescription": false,+ "settings": {+ "component": "number-input",+ "showShuffle": false,+ "type": "integer-field-config"+ }+ }+ }+ },+ "rootElementId": "root"+ },+ "id": "default_minimax_h3_ref2v"+}diff --git a/invokeai/app/services/workflow_records/default_workflows/Text to Video - MiniMax H3.json b/invokeai/app/services/workflow_records/default_workflows/Text to Video - MiniMax H3.jsonindex 0ba6ecd59f..8fc404b8cb 100644--- a/invokeai/app/services/workflow_records/default_workflows/Text to Video - MiniMax H3.json+++ b/invokeai/app/services/workflow_records/default_workflows/Text to Video - MiniMax H3.json@@ -334,7 +334,7 @@"type": "invocation","data": {"id": "9e2b5033-4c5d-4e7f-a081-9c0d1e2f3a04",- "version": "2.4.0",+ "version": "2.5.0","nodePack": "invokeai","label": "Core Metadata","notes": "Everything except the generation mode arrives over an edge from the node that used the value, so the record cannot go stale.",diff --git a/invokeai/frontend/web/openapi.json b/invokeai/frontend/web/openapi.jsonindex dca633f7cb..75ec1989c9 100644--- a/invokeai/frontend/web/openapi.json+++ b/invokeai/frontend/web/openapi.json@@ -24277,6 +24277,7 @@"minimax_h3_lf2v","minimax_h3_flf2v","minimax_h3_extend_video",+ "minimax_h3_ref2v","minimax_h3_txt2img"],"type": "string"@@ -24806,6 +24807,26 @@"orig_default": null,"orig_required": false},+ "minimax_h3_references": {+ "anyOf": [+ {+ "items": {+ "$ref": "#/components/schemas/MiniMaxH3ReferenceMetadataField"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "The ordered Ref2VA references this generation was conditioned on (names and options only; the media is re-resolved from the gallery at recall time)",+ "field_kind": "input",+ "input": "any",+ "orig_default": null,+ "orig_required": false,+ "title": "Minimax H3 References"+ },"hrf_enabled": {"anyOf": [{@@ -25021,7 +25042,7 @@"tags": ["metadata"],"title": "Core Metadata","type": "object",- "version": "2.4.0",+ "version": "2.5.0","output": {"$ref": "#/components/schemas/MetadataOutput"}@@ -71708,6 +71729,98 @@"title": "MiniMaxH3ReferenceMediaOutput","type": "object"},+ "MiniMaxH3ReferenceMetadataField": {+ "description": "One recorded Ref2VA reference: names and options only, in conditioning order.",+ "properties": {+ "kind": {+ "description": "Whether the reference was an image or a video.",+ "enum": ["image", "video"],+ "title": "Kind",+ "type": "string"+ },+ "image_name": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "The reference image's name.",+ "title": "Image Name"+ },+ "video_name": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "The reference video's name.",+ "title": "Video Name"+ },+ "conditioning": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "A video reference's conditioning choice (video_audio / video / audio).",+ "title": "Conditioning"+ },+ "detail": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "An image reference's sizing choice (max / match).",+ "title": "Detail"+ },+ "start_frame": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "A video reference's trim start (inclusive).",+ "title": "Start Frame"+ },+ "end_frame": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "A video reference's trim end (inclusive).",+ "title": "End Frame"+ }+ },+ "required": ["kind"],+ "title": "MiniMaxH3ReferenceMetadataField",+ "type": "object"+ },"MiniMaxH3TextEncoderField": {"description": "Field for the Qwen3-VL-32B conditioner used by MiniMax H3 models.\n\nUnlike :class:`Qwen3VLEncoderField`, H3 also needs the Qwen3VLProcessor \u2014 even for\ntext-only prompts (its multimodal token-type ids drive Qwen3-VL's 3D rotary layout), and\nfor feeding first/last keyframes to the conditioner as vision context.","properties": {diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.tsindex 4a36bc8922..c04585967e 100644--- a/invokeai/frontend/web/src/services/api/schema.ts+++ b/invokeai/frontend/web/src/services/api/schema.ts@@ -9030,7 +9030,7 @@ export type components = {* @description The generation mode that output this image* @default null*/- generation_mode?: ("txt2img" | "img2img" | "inpaint" | "outpaint" | "sdxl_txt2img" | "sdxl_img2img" | "sdxl_inpaint" | "sdxl_outpaint" | "flux_txt2img" | "flux_img2img" | "flux_inpaint" | "flux_outpaint" | "flux2_txt2img" | "flux2_img2img" | "flux2_inpaint" | "flux2_outpaint" | "sd3_txt2img" | "sd3_img2img" | "sd3_inpaint" | "sd3_outpaint" | "cogview4_txt2img" | "cogview4_img2img" | "cogview4_inpaint" | "cogview4_outpaint" | "z_image_txt2img" | "z_image_img2img" | "z_image_inpaint" | "z_image_outpaint" | "ernie_image_txt2img" | "ideogram4_txt2img" | "qwen_image_txt2img" | "qwen_image_img2img" | "qwen_image_inpaint" | "qwen_image_outpaint" | "anima_txt2img" | "anima_img2img" | "anima_inpaint" | "anima_outpaint" | "krea2_txt2img" | "krea2_img2img" | "krea2_inpaint" | "krea2_outpaint" | "wan_txt2img" | "wan_img2img" | "wan_inpaint" | "wan_outpaint" | "wan_t2v" | "wan_i2v" | "wan_interpolate" | "wan_extend_video" | "minimax_h3_t2v" | "minimax_h3_i2v" | "minimax_h3_lf2v" | "minimax_h3_flf2v" | "minimax_h3_extend_video" | "minimax_h3_txt2img") | null;+ generation_mode?: ("txt2img" | "img2img" | "inpaint" | "outpaint" | "sdxl_txt2img" | "sdxl_img2img" | "sdxl_inpaint" | "sdxl_outpaint" | "flux_txt2img" | "flux_img2img" | "flux_inpaint" | "flux_outpaint" | "flux2_txt2img" | "flux2_img2img" | "flux2_inpaint" | "flux2_outpaint" | "sd3_txt2img" | "sd3_img2img" | "sd3_inpaint" | "sd3_outpaint" | "cogview4_txt2img" | "cogview4_img2img" | "cogview4_inpaint" | "cogview4_outpaint" | "z_image_txt2img" | "z_image_img2img" | "z_image_inpaint" | "z_image_outpaint" | "ernie_image_txt2img" | "ideogram4_txt2img" | "qwen_image_txt2img" | "qwen_image_img2img" | "qwen_image_inpaint" | "qwen_image_outpaint" | "anima_txt2img" | "anima_img2img" | "anima_inpaint" | "anima_outpaint" | "krea2_txt2img" | "krea2_img2img" | "krea2_inpaint" | "krea2_outpaint" | "wan_txt2img" | "wan_img2img" | "wan_inpaint" | "wan_outpaint" | "wan_t2v" | "wan_i2v" | "wan_interpolate" | "wan_extend_video" | "minimax_h3_t2v" | "minimax_h3_i2v" | "minimax_h3_lf2v" | "minimax_h3_flf2v" | "minimax_h3_extend_video" | "minimax_h3_ref2v" | "minimax_h3_txt2img") | null;/*** Positive Prompt* @description The positive prompt parameter@@ -9202,6 +9202,12 @@ export type components = {* @default null*/minimax_h3_text_encoder_model?: components["schemas"]["ModelIdentifierField"] | null;+ /**+ * Minimax H3 References+ * @description The ordered Ref2VA references this generation was conditioned on (names and options only; the media is re-resolved from the gallery at recall time)+ * @default null+ */+ minimax_h3_references?: components["schemas"]["MiniMaxH3ReferenceMetadataField"][] | null;/*** Hrf Enabled* @description Whether or not high resolution fix was enabled.@@ -30613,6 +30619,54 @@ export type components = {*/type: "minimax_h3_reference_media_output";};+ /**+ * MiniMaxH3ReferenceMetadataField+ * @description One recorded Ref2VA reference: names and options only, in conditioning order.+ */+ MiniMaxH3ReferenceMetadataField: {+ /**+ * Kind+ * @description Whether the reference was an image or a video.+ * @enum {string}+ */+ kind: "image" | "video";+ /**+ * Image Name+ * @description The reference image's name.+ * @default null+ */+ image_name?: string | null;+ /**+ * Video Name+ * @description The reference video's name.+ * @default null+ */+ video_name?: string | null;+ /**+ * Conditioning+ * @description A video reference's conditioning choice (video_audio / video / audio).+ * @default null+ */+ conditioning?: string | null;+ /**+ * Detail+ * @description An image reference's sizing choice (max / match).+ * @default null+ */+ detail?: string | null;+ /**+ * Start Frame+ * @description A video reference's trim start (inclusive).+ * @default null+ */+ start_frame?: number | null;+ /**+ * End Frame+ * @description A video reference's trim end (inclusive).+ * @default null+ */+ end_frame?: number | null;+ };/*** MiniMaxH3TextEncoderField* @description Field for the Qwen3-VL-32B conditioner used by MiniMax H3 models.diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.jsonindex 564dd447fd..f808445717 100644--- a/invokeai/frontend/webv2/performance/browser-baseline.json+++ b/invokeai/frontend/webv2/performance/browser-baseline.json@@ -1,6 +1,6 @@{- "browserExecutable": "/home/toast/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome",- "capturedAt": "2026-08-25",+ "browserExecutable": "/home/lstein/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome",+ "capturedAt": "2026-08-27","routes": [{"activatedResourceBaseline": {@@ -25,13 +25,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 127.10000000149012,+ "domContentLoadedMedianMs": 150.69999980926514,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 127.29999999701977,- "longestTaskMaxMs": 77,+ "loadMedianMs": 150.89999961853027,+ "longestTaskMaxMs": 74,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -41,24 +41,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 37,- "scriptRawBytes": 1623492,+ "scriptRawBytes": 1623787,"scriptRequestCount": 33,- "totalRawBytes": 1800734+ "totalRawBytes": 1801974},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 37,- "scriptRawBytes": 1639727,+ "scriptRawBytes": 1640025,"scriptRequestCount": 33,- "totalRawBytes": 1818742+ "totalRawBytes": 1819994},- "routeReadyMedianMs": 281.29999999701977,+ "routeReadyMedianMs": 321.29999923706055,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "empty"},@@ -85,13 +85,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 125.09999999403954,+ "domContentLoadedMedianMs": 151.5999994277954,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 125.19999999552965,- "longestTaskMaxMs": 74,+ "loadMedianMs": 151.69999980926514,+ "longestTaskMaxMs": 78,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -101,24 +101,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 37,- "scriptRawBytes": 1623492,+ "scriptRawBytes": 1623787,"scriptRequestCount": 33,- "totalRawBytes": 1800734+ "totalRawBytes": 1801974},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 37,- "scriptRawBytes": 1639727,+ "scriptRawBytes": 1640025,"scriptRequestCount": 33,- "totalRawBytes": 1818742+ "totalRawBytes": 1819994},- "routeReadyMedianMs": 295.8999999985099,+ "routeReadyMedianMs": 336.69999980926514,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "representative"},@@ -145,15 +145,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 125.5,+ "domContentLoadedMedianMs": 127.80000019073486,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 125.70000000298023,- "longestTaskMaxMs": 109,+ "loadMedianMs": 128,+ "longestTaskMaxMs": 122,"owner": "workbench",- "projectSwitchMedianMs": 38,+ "projectSwitchMedianMs": 40.19999980926514,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -161,24 +161,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 114,- "scriptRawBytes": 3175424,+ "scriptRawBytes": 3186080,"scriptRequestCount": 109,- "totalRawBytes": 3509042+ "totalRawBytes": 3520643},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 114,- "scriptRawBytes": 3207179,+ "scriptRawBytes": 3217941,"scriptRequestCount": 109,- "totalRawBytes": 3544133+ "totalRawBytes": 3555850},- "routeReadyMedianMs": 708.1000000014901,+ "routeReadyMedianMs": 713.4000005722046,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -205,15 +205,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 137,+ "domContentLoadedMedianMs": 134.5,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 137.10000000149012,- "longestTaskMaxMs": 211,+ "loadMedianMs": 134.60000038146973,+ "longestTaskMaxMs": 195,"owner": "workbench",- "projectSwitchMedianMs": 66.80000000447035,+ "projectSwitchMedianMs": 84.39999961853027,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -221,24 +221,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 114,- "scriptRawBytes": 3175424,+ "scriptRawBytes": 3186080,"scriptRequestCount": 109,- "totalRawBytes": 3509042+ "totalRawBytes": 3520643},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 114,- "scriptRawBytes": 3207179,+ "scriptRawBytes": 3217941,"scriptRequestCount": 109,- "totalRawBytes": 3544133+ "totalRawBytes": 3555850},- "routeReadyMedianMs": 514.1000000014901,+ "routeReadyMedianMs": 516.3000001907349,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -247,31 +247,31 @@"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 137470,+ "largestAssetRawBytes": 137614,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 318553,+ "scriptRawBytes": 315955,"scriptRequestCount": 7,- "totalRawBytes": 318553+ "totalRawBytes": 315955},"activatedResourceLimits": {"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 138845,+ "largestAssetRawBytes": 138991,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 321739,+ "scriptRawBytes": 319115,"scriptRequestCount": 7,- "totalRawBytes": 321739+ "totalRawBytes": 319115},- "domContentLoadedMedianMs": 124.89999999850988,+ "domContentLoadedMedianMs": 138,"id": "editor-canvas",- "layoutAckMedianMs": 3.399999998509884,- "layoutReturnSwitchMedianMs": 42.100000001490116,- "layoutSwitchMedianMs": 88.60000000149012,- "loadMedianMs": 125.09999999403954,- "longestTaskMaxMs": 124,+ "layoutAckMedianMs": 8.199999809265137,+ "layoutReturnSwitchMedianMs": 37.39999961853027,+ "layoutSwitchMedianMs": 87.90000057220459,+ "loadMedianMs": 138.19999980926514,+ "longestTaskMaxMs": 114,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -281,24 +281,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 121,- "scriptRawBytes": 3493977,+ "scriptRawBytes": 3502035,"scriptRequestCount": 116,- "totalRawBytes": 3827595+ "totalRawBytes": 3836598},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 121,- "scriptRawBytes": 3528917,+ "scriptRawBytes": 3537056,"scriptRequestCount": 116,- "totalRawBytes": 3865871+ "totalRawBytes": 3874964},- "routeReadyMedianMs": 1086,+ "routeReadyMedianMs": 1157.6000003814697,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "empty"},@@ -307,31 +307,31 @@"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 137470,+ "largestAssetRawBytes": 137614,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 318553,+ "scriptRawBytes": 315955,"scriptRequestCount": 7,- "totalRawBytes": 318553+ "totalRawBytes": 315955},"activatedResourceLimits": {"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 138845,+ "largestAssetRawBytes": 138991,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 321739,+ "scriptRawBytes": 319115,"scriptRequestCount": 7,- "totalRawBytes": 321739+ "totalRawBytes": 319115},- "domContentLoadedMedianMs": 132.70000000298023,+ "domContentLoadedMedianMs": 126.80000019073486,"id": "editor-canvas",- "layoutAckMedianMs": 2.7000000029802322,- "layoutReturnSwitchMedianMs": 41.79999999701977,- "layoutSwitchMedianMs": 209.10000000149012,- "loadMedianMs": 132.89999999850988,- "longestTaskMaxMs": 465,+ "layoutAckMedianMs": 3.3000001907348633,+ "layoutReturnSwitchMedianMs": 36.5,+ "layoutSwitchMedianMs": 200.69999980926514,+ "loadMedianMs": 126.80000019073486,+ "longestTaskMaxMs": 395,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -341,24 +341,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 121,- "scriptRawBytes": 3493977,+ "scriptRawBytes": 3502035,"scriptRequestCount": 116,- "totalRawBytes": 3827595+ "totalRawBytes": 3836598},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 121,- "scriptRawBytes": 3528917,+ "scriptRawBytes": 3537056,"scriptRequestCount": 116,- "totalRawBytes": 3865871+ "totalRawBytes": 3874964},- "routeReadyMedianMs": 1385.2999999970198,+ "routeReadyMedianMs": 1332.8000001907349,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "representative"},@@ -385,13 +385,13 @@"scriptRequestCount": 6,"totalRawBytes": 383401},- "domContentLoadedMedianMs": 132.79999999701977,+ "domContentLoadedMedianMs": 136.69999980926514,"id": "editor-workflow",- "layoutAckMedianMs": 3.399999998509884,- "layoutReturnSwitchMedianMs": 36.600000001490116,- "layoutSwitchMedianMs": 100.29999999701977,- "loadMedianMs": 132.89999999850988,- "longestTaskMaxMs": 114,+ "layoutAckMedianMs": 11.200000762939453,+ "layoutReturnSwitchMedianMs": 30.899999618530273,+ "layoutSwitchMedianMs": 101.69999980926514,+ "loadMedianMs": 136.80000019073486,+ "longestTaskMaxMs": 111,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -401,24 +401,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 121,- "scriptRawBytes": 3539615,+ "scriptRawBytes": 3550271,"scriptRequestCount": 115,- "totalRawBytes": 3888646+ "totalRawBytes": 3900247},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 121,- "scriptRawBytes": 3575012,+ "scriptRawBytes": 3585774,"scriptRequestCount": 115,- "totalRawBytes": 3927533+ "totalRawBytes": 3939250},- "routeReadyMedianMs": 1115.3000000044703,+ "routeReadyMedianMs": 1163.3999996185303,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "empty"},@@ -445,13 +445,13 @@"scriptRequestCount": 6,"totalRawBytes": 383401},- "domContentLoadedMedianMs": 138.29999999701977,+ "domContentLoadedMedianMs": 144.19999980926514,"id": "editor-workflow",- "layoutAckMedianMs": 3.5,- "layoutReturnSwitchMedianMs": 46.70000000298023,- "layoutSwitchMedianMs": 163.5,- "loadMedianMs": 138.39999999850988,- "longestTaskMaxMs": 440,+ "layoutAckMedianMs": 3.1999998092651367,+ "layoutReturnSwitchMedianMs": 36.40000057220459,+ "layoutSwitchMedianMs": 137,+ "loadMedianMs": 144.39999961853027,+ "longestTaskMaxMs": 377,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -461,24 +461,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 121,- "scriptRawBytes": 3539615,+ "scriptRawBytes": 3550271,"scriptRequestCount": 115,- "totalRawBytes": 3888646+ "totalRawBytes": 3900247},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 121,- "scriptRawBytes": 3575012,+ "scriptRawBytes": 3585774,"scriptRequestCount": 115,- "totalRawBytes": 3927533+ "totalRawBytes": 3939250},- "routeReadyMedianMs": 1423.7000000029802,+ "routeReadyMedianMs": 1283.5,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "representative"},@@ -505,13 +505,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 134.70000000298023,+ "domContentLoadedMedianMs": 145.19999980926514,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 33.600000001490116,- "loadMedianMs": 135,- "longestTaskMaxMs": 117,+ "layoutSwitchMedianMs": 33.5,+ "loadMedianMs": 145.19999980926514,+ "longestTaskMaxMs": 105,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -521,24 +521,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 114,- "scriptRawBytes": 3175424,+ "scriptRawBytes": 3186080,"scriptRequestCount": 109,- "totalRawBytes": 3509042+ "totalRawBytes": 3520643},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 114,- "scriptRawBytes": 3207179,+ "scriptRawBytes": 3217941,"scriptRequestCount": 109,- "totalRawBytes": 3544133+ "totalRawBytes": 3555850},- "routeReadyMedianMs": 1346.7999999970198,+ "routeReadyMedianMs": 1411.9000005722046,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -565,13 +565,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 145.30000000447035,+ "domContentLoadedMedianMs": 141.30000019073486,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 110.5,- "loadMedianMs": 145.5,- "longestTaskMaxMs": 252,+ "layoutSwitchMedianMs": 99.10000038146973,+ "loadMedianMs": 141.30000019073486,+ "longestTaskMaxMs": 200,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -581,24 +581,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746355,- "otherRawBytes": 151419,+ "otherRawBytes": 152364,"requestCount": 114,- "scriptRawBytes": 3175424,+ "scriptRawBytes": 3186080,"scriptRequestCount": 109,- "totalRawBytes": 3509042+ "totalRawBytes": 3520643},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753819,- "otherRawBytes": 152934,+ "otherRawBytes": 153888,"requestCount": 114,- "scriptRawBytes": 3207179,+ "scriptRawBytes": 3217941,"scriptRequestCount": 109,- "totalRawBytes": 3544133+ "totalRawBytes": 3555850},- "routeReadyMedianMs": 1722.6999999955297,+ "routeReadyMedianMs": 1531,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"}diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex 419696bf93..019bfc7fbd 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -3147,7 +3147,22 @@"singleLow": "\"{{mainName}}\" is tagged as the low-noise expert. When running a single expert, the high-noise one is usually the better choice.","swap": "Swap experts","swapped": "The filename tags suggest these two experts are swapped. The wiring is authoritative — swap if unintended."- }+ },+ "addImageReference": "Add image ({{count}}/{{max}})",+ "addReference": "Add reference",+ "addVideoReference": "Add video ({{count}}/{{max}})",+ "dropReference": "Drop Reference",+ "moveReferenceDown": "Move reference down",+ "moveReferenceUp": "Move reference up",+ "referenceConditioningAudio": "Audio only",+ "referenceConditioningVideo": "Video only",+ "referenceConditioningVideoAudio": "Video + audio",+ "referenceDetailMatch": "Match generation size",+ "referenceDetailMax": "Max detail (2048px, slower)",+ "references": "References",+ "referencesHelp": "Up to 3 videos and 9 images condition the generation, in order — reordering references changes the result. A video reference can contribute its image track, its soundtrack, or both.",+ "removeReference": "Remove reference",+ "staleReferences": "References are set but the selected model cannot use them."}},"workflowLibrary": {diff --git a/invokeai/frontend/webv2/src/features/video/core/graph.test.ts b/invokeai/frontend/webv2/src/features/video/core/graph.test.tsindex 3d3e6b55a9..48e5cbceff 100644--- a/invokeai/frontend/webv2/src/features/video/core/graph.test.ts+++ b/invokeai/frontend/webv2/src/features/video/core/graph.test.ts@@ -451,3 +451,96 @@ describe('compileVideoGraph — MiniMax H3', () => {expect(() => compileVideoGraph(settingsFor(model, { numFrames: 100 }), model)).toThrow(/17·n \+ 5/);});});++describe('compileVideoGraph — MiniMax H3 Ref2VA', () => {+ const model = h3Model();+ const ref2vaTransformer: MainModelConfig = {+ base: 'minimax-h3',+ format: 'checkpoint',+ key: 'h3-ref2va-ckpt',+ name: 'MiniMax H3 Ref2VA Transformer (int8, pruned)',+ type: 'main',+ variant: 'ref2va',+ };+ const referenceSettings = settingsFor(model, {+ h3TransformerModel: ref2vaTransformer,+ references: [+ {+ clip: { endFrame: 47, fps: 24, height: 480, numFrames: 48, startFrame: 2, video_name: 'ref.mp4', width: 832 },+ conditioning: 'video_audio',+ kind: 'video',+ },+ { detail: 'match', image: { height: 512, image_name: 'ref.png', width: 512 }, kind: 'image' },+ ],+ });++ it('builds the reference graph: ordered chained collect into conditioning AND prompt, no frame conditioning', () => {+ const { backendGraph } = compileVideoGraph(referenceSettings, model);++ const video = nodeOfType(backendGraph, 'minimax_h3_video_reference');+ const image = nodeOfType(backendGraph, 'minimax_h3_image_reference');++ expect(video.id).toBe('reference_1');+ expect(video.conditioning).toBe('video_audio');+ expect(video.start_frame).toBe(2);+ // The end bound sits in the estimate's tail window, so it compiles as a negative+ // index the backend resolves against the clip's REAL frame count (the panel's count+ // is an estimate that can overshoot on VFR uploads) - same rule as the extend path.+ expect(video.end_frame).toBe(-1);+ expect(image.id).toBe('reference_2');+ expect(image.detail).toBe('match');++ // Order is contractual: chained collectors, each appending its item after the+ // inherited collection.+ expect(hasEdge(backendGraph, 'reference_1', 'reference', 'reference_collect_1', 'item')).toBe(true);+ expect(hasEdge(backendGraph, 'reference_collect_1', 'collection', 'reference_collect_2', 'collection')).toBe(true);+ expect(hasEdge(backendGraph, 'reference_2', 'reference', 'reference_collect_2', 'item')).toBe(true);++ // The final collection fans out to BOTH consumers.+ expect(hasEdge(backendGraph, 'reference_collect_2', 'collection', 'reference_conditioning', 'references')).toBe(+ true+ );+ expect(hasEdge(backendGraph, 'reference_collect_2', 'collection', 'pos_cond', 'references')).toBe(true);+ expect(+ hasEdge(+ backendGraph,+ 'reference_conditioning',+ 'reference_conditioning',+ 'denoise_latents',+ 'reference_conditioning'+ )+ ).toBe(true);+ expect(hasEdge(backendGraph, 'model_loader', 'vae', 'reference_conditioning', 'vae')).toBe(true);+ expect(hasEdge(backendGraph, 'model_loader', 'audio_vae', 'reference_conditioning', 'audio_vae')).toBe(true);++ // num_frames rides on prompt + reference conditioning; frame conditioning is absent.+ const posCond = nodeOfType(backendGraph, 'minimax_h3_text_encoder');+ const referenceConditioning = nodeOfType(backendGraph, 'minimax_h3_reference_conditioning');++ expect(posCond.num_frames).toBe(referenceSettings.numFrames);+ expect(referenceConditioning.num_frames).toBe(referenceSettings.numFrames);+ expect(nodesOfType(backendGraph, 'minimax_h3_frame_conditioning')).toHaveLength(0);++ // Metadata records the mode and the ordered reference payload for recall.+ const metadata = nodeOfType(backendGraph, 'core_metadata');++ expect(metadata.generation_mode).toBe('minimax_h3_ref2v');+ expect(metadata.minimax_h3_references).toEqual([+ { conditioning: 'video_audio', end_frame: 47, kind: 'video', start_frame: 2, video_name: 'ref.mp4' },+ { detail: 'match', image_name: 'ref.png', kind: 'image' },+ ]);+ });++ it('refuses to compile references on an fl2va transformer', () => {+ const fl2vaSettings = { ...referenceSettings, h3TransformerModel: null };++ expect(() => compileVideoGraph(fl2vaSettings, model)).toThrow(/reference-conditioned/);+ });++ it('fl2va graphs are unchanged by the ref2va machinery', () => {+ const { backendGraph } = compileVideoGraph(settingsFor(model), model);++ expect(nodesOfType(backendGraph, 'minimax_h3_reference_conditioning')).toHaveLength(0);+ expect(nodesOfType(backendGraph, 'collect')).toHaveLength(0);+ });+});diff --git a/invokeai/frontend/webv2/src/features/video/core/graph.ts b/invokeai/frontend/webv2/src/features/video/core/graph.tsindex ddfe3fe39b..d44731e729 100644--- a/invokeai/frontend/webv2/src/features/video/core/graph.ts+++ b/invokeai/frontend/webv2/src/features/video/core/graph.ts@@ -16,7 +16,7 @@ import {} from '@features/generation/graph';import { getCompatibleDiffusersComponentSource } from '@features/generation/settings';-import type { VideoGenerationMode, VideoSettings } from './types';+import type { VideoGenerationMode, VideoReferenceItem, VideoSettings } from './types';import { resolveVideoMode } from './settings';import { getVideoDimensions, getVideoModelPolicy, getVideoValidationReasons } from './videoPolicies';@@ -49,9 +49,57 @@ const MINIMAX_H3_GENERATION_MODES: Record<VideoGenerationMode, string> = {'first-frame': 'minimax_h3_i2v','first-last': 'minimax_h3_flf2v','last-frame': 'minimax_h3_lf2v',+ reference: 'minimax_h3_ref2v',txt2vid: 'minimax_h3_t2v',};+/**+ * Adds the per-reference descriptor nodes and the ordered collection feeding both the+ * Reference Conditioning node and the Prompt node (the same references must reach both —+ * the denoise node cross-checks them). Collect order matters: reference order is part of+ * the request contract, so the collectors are CHAINED (each appends its item after the+ * inherited collection), the same trick the extend scaffolding uses for its join order.+ */+const addReferenceNodes = (+ graph: BackendGraphContract,+ references: readonly VideoReferenceItem[]+): BackendInvocationContract => {+ let chain: BackendInvocationContract | null = null;+ references.forEach((reference, index) => {+ const node =+ reference.kind === 'image'+ ? addNode(graph, {+ detail: reference.detail,+ id: `reference_${index + 1}`,+ image: toImageField(reference.image),+ type: 'minimax_h3_image_reference',+ })+ : addNode(graph, {+ conditioning: reference.conditioning,+ // Same estimate-overshoot protection as the extend path: tail-window bounds+ // compile as negative indices the backend resolves against the REAL count.+ end_frame: toTailAwareIndex(reference.clip.endFrame, reference.clip.numFrames),+ id: `reference_${index + 1}`,+ start_frame: toTailAwareIndex(reference.clip.startFrame, reference.clip.numFrames),+ type: 'minimax_h3_video_reference',+ video: { video_name: reference.clip.video_name },+ });+ const collect = addNode(graph, { id: `reference_collect_${index + 1}`, type: 'collect' });++ if (chain) {+ addEdge(graph, chain, 'collection', collect, 'collection');+ }+ addEdge(graph, node, 'reference', collect, 'item');+ chain = collect;+ });++ if (!chain) {+ throw new Error('Reference mode requires at least one reference.');+ }++ return chain;+};+const addPromptAndSeedNodes = (graph: BackendGraphContract) => ({negativePrompt: addNode(graph, { id: 'negative_prompt', type: 'string' }),positivePrompt: addNode(graph, { id: 'positive_prompt', type: 'string' }),@@ -67,32 +115,33 @@ const toImageField = (image: { image_name: string }) => ({ image_name: image.ima* source with the freshly generated clip (2-frame crossfade over the seam).* Both intermediate video artifacts stay out of the gallery.*/+// The panel's frame count is an estimate (duration × fps; the records store+// no exact count, and VFR uploads can overshoot by a frame or two). A trim+// bound near the estimated ceiling therefore compiles as a NEGATIVE index —+// resolved by the backend against the clip's REAL count — so "keep to the+// end" can never land past it. Both bounds get the same treatment: a start+// in the tail window would otherwise stay a positive estimate-based index+// and land out of range exactly when the end's conversion saves it (the+// start is always below the end, so the pair keeps its order when both go+// negative). Mid-clip picks stay positive: a negative offset computed from+// an overshooting estimate would drift them instead.+const toTailAwareIndex = (frame: number, estimatedNumFrames: number): number => {+ const tailOffset = estimatedNumFrames - 1 - frame;++ return tailOffset <= 3 ? -(tailOffset + 1) : frame;+};+const addExtendScaffolding = (graph: BackendGraphContract,sourceVideo: NonNullable<VideoSettings['sourceVideo']>,newClip: BackendInvocationContract,options: { extractFps?: number } = {}) => {- // The panel's frame count is an estimate (duration × fps; the records store- // no exact count, and VFR uploads can overshoot by a frame or two). A trim- // bound near the estimated ceiling therefore compiles as a NEGATIVE index —- // resolved by the backend against the clip's REAL count — so "keep to the- // end" can never land past it. Both bounds get the same treatment: a start- // in the tail window would otherwise stay a positive estimate-based index- // and land out of range exactly when the end's conversion saves it (the- // start is always below the end, so the pair keeps its order when both go- // negative). Mid-clip picks stay positive: a negative offset computed from- // an overshooting estimate would drift them instead.- const toTailAwareIndex = (frame: number): number => {- const tailOffset = sourceVideo.numFrames - 1 - frame;-- return tailOffset <= 3 ? -(tailOffset + 1) : frame;- };const extract = addNode(graph, {- end_frame: toTailAwareIndex(sourceVideo.endFrame),+ end_frame: toTailAwareIndex(sourceVideo.endFrame, sourceVideo.numFrames),id: 'source_video',is_intermediate: true,- start_frame: toTailAwareIndex(sourceVideo.startFrame),+ start_frame: toTailAwareIndex(sourceVideo.startFrame, sourceVideo.numFrames),type: 'extract_video_range',use_cache: false,video: { video_name: sourceVideo.video_name },@@ -394,6 +443,7 @@ const buildMiniMaxH3VideoGraph = (settings: VideoSettings, model: MainModelConfitype: 'minimax_h3_text_encoder',width: dimensions.width,...keyframeLiterals,+ ...(mode === 'reference' ? { num_frames: settings.numFrames } : {}),});const denoise = addNode(graph, {height: dimensions.height,@@ -411,7 +461,24 @@ const buildMiniMaxH3VideoGraph = (settings: VideoSettings, model: MainModelConfiaddEdge(graph, posCond, 'conditioning', denoise, 'positive_conditioning');addEdge(graph, seed, 'value', denoise, 'seed');- const needsFrameConditioning = mode !== 'txt2vid';+ if (mode === 'reference') {+ const referenceChain = addReferenceNodes(graph, settings.references);+ const referenceConditioning = addNode(graph, {+ height: dimensions.height,+ id: 'reference_conditioning',+ num_frames: settings.numFrames,+ type: 'minimax_h3_reference_conditioning',+ width: dimensions.width,+ });++ addEdge(graph, referenceChain, 'collection', referenceConditioning, 'references');+ addEdge(graph, referenceChain, 'collection', posCond, 'references');+ addEdge(graph, modelLoader, 'vae', referenceConditioning, 'vae');+ addEdge(graph, modelLoader, 'audio_vae', referenceConditioning, 'audio_vae');+ addEdge(graph, referenceConditioning, 'reference_conditioning', denoise, 'reference_conditioning');+ }++ const needsFrameConditioning = mode !== 'txt2vid' && mode !== 'reference';let frameConditioning: BackendInvocationContract | null = null;if (needsFrameConditioning) {@@ -463,6 +530,21 @@ const buildMiniMaxH3VideoGraph = (settings: VideoSettings, model: MainModelConfiextras: {...(settings.h3TransformerModel ? { minimax_h3_transformer_model: settings.h3TransformerModel } : {}),...(settings.h3TextEncoderModel ? { minimax_h3_text_encoder_model: settings.h3TextEncoderModel } : {}),+ ...(mode === 'reference'+ ? {+ minimax_h3_references: settings.references.map((reference) =>+ reference.kind === 'image'+ ? { detail: reference.detail, image_name: reference.image.image_name, kind: 'image' }+ : {+ conditioning: reference.conditioning,+ end_frame: reference.clip.endFrame,+ kind: 'video',+ start_frame: reference.clip.startFrame,+ video_name: reference.clip.video_name,+ }+ ),+ }+ : {}),},generationMode: MINIMAX_H3_GENERATION_MODES[mode],graph,diff --git a/invokeai/frontend/webv2/src/features/video/core/settings.test.ts b/invokeai/frontend/webv2/src/features/video/core/settings.test.tsindex 48292a95fd..e217bf361c 100644--- a/invokeai/frontend/webv2/src/features/video/core/settings.test.ts+++ b/invokeai/frontend/webv2/src/features/video/core/settings.test.ts@@ -296,3 +296,85 @@ describe('clearDeletedVideoMedia', () => {expect(clearDeletedVideoMedia(junk, new Set(['nonsense']), new Set())).toBe(junk);});});++// ---------------------------------------------------------------------------+// Ref2VA references++const IMAGE_REFERENCE = {+ detail: 'max',+ image: { height: 512, image_name: 'ref.png', width: 512 },+ kind: 'image',+} as const;+const VIDEO_REFERENCE = {+ clip: { endFrame: 47, fps: 24, height: 480, numFrames: 48, startFrame: 0, video_name: 'ref.mp4', width: 832 },+ conditioning: 'video_audio',+ kind: 'video',+} as const;++describe('references', () => {+ it('reference mode wins the mode inference', () => {+ expect(resolveVideoMode(createSettings({ references: [IMAGE_REFERENCE] }))).toBe('reference');+ expect(resolveVideoMode(createSettings({ references: [VIDEO_REFERENCE], sourceVideo: SOURCE_VIDEO }))).toBe(+ 'reference'+ );+ });++ it('normalization drops frame/source media when references are present', () => {+ const normalized = normalizeVideoSettings(+ createSettings({ firstFrameImage: FIRST_FRAME, references: [IMAGE_REFERENCE], sourceVideo: SOURCE_VIDEO })+ );++ expect(normalized?.references).toEqual([IMAGE_REFERENCE]);+ expect(normalized?.firstFrameImage).toBeNull();+ expect(normalized?.sourceVideo).toBeNull();+ });++ it('normalization drops malformed entries and enforces the caps, preserving order', () => {+ const tooMany = [+ ...Array.from({ length: 4 }, (_, index) => ({+ ...VIDEO_REFERENCE,+ clip: { ...VIDEO_REFERENCE.clip, video_name: `v${index}.mp4` },+ })),+ { kind: 'image' },+ IMAGE_REFERENCE,+ ];+ const normalized = normalizeVideoSettings(createSettings({ references: tooMany as never }));++ expect(normalized?.references.map((entry) => (entry.kind === 'video' ? entry.clip.video_name : 'img'))).toEqual([+ 'v0.mp4',+ 'v1.mp4',+ 'v2.mp4',+ 'img',+ ]);+ });++ it('isVideoSettings rejects references combined with frame media', () => {+ expect(isVideoSettings(createSettings({ firstFrameImage: FIRST_FRAME, references: [IMAGE_REFERENCE] }))).toBe(+ false+ );+ expect(isVideoSettings(createSettings({ references: [IMAGE_REFERENCE] }))).toBe(true);+ });++ it('clone deep-copies references', () => {+ const values = { ...createSettings({ references: [VIDEO_REFERENCE] }), model: null };+ const clone = cloneVideoWidgetValues(values);++ expect(clone.references).toEqual(values.references);+ expect(clone.references[0]).not.toBe(values.references[0]);+ });++ it('clearDeletedVideoMedia filters deleted reference media, preserving order and identity', () => {+ const values = createSettings({ references: [VIDEO_REFERENCE, IMAGE_REFERENCE] });+ const untouched = clearDeletedVideoMedia(values, new Set(), new Set());++ expect(untouched).toBe(values);++ const swept = clearDeletedVideoMedia(values, new Set(['ref.png']), new Set());++ expect(swept.references).toEqual([VIDEO_REFERENCE]);++ const sweptVideo = clearDeletedVideoMedia(values, new Set(), new Set(['ref.mp4']));++ expect(sweptVideo.references).toEqual([IMAGE_REFERENCE]);+ });+});diff --git a/invokeai/frontend/webv2/src/features/video/core/settings.ts b/invokeai/frontend/webv2/src/features/video/core/settings.tsindex 4f2bbd727e..9aa2152a9c 100644--- a/invokeai/frontend/webv2/src/features/video/core/settings.ts+++ b/invokeai/frontend/webv2/src/features/video/core/settings.ts@@ -18,6 +18,7 @@ import type {MiniMaxH3TargetResolution,VideoAspectRatioId,VideoGenerationMode,+ VideoReferenceItem,VideoSettings,VideoSourceClip,VideoTargetResolution,@@ -72,6 +73,60 @@ export const isVideoSourceClip = (value: unknown): value is VideoSourceClip =>hasFiniteNumber(value, 'startFrame') &&hasFiniteNumber(value, 'endFrame');+/** Upstream Ref2VA's reference caps (mirrored by the backend's validate_reference_kinds). */+export const VIDEO_REFERENCE_MAX_VIDEOS = 3;+export const VIDEO_REFERENCE_MAX_IMAGES = 9;++const VIDEO_REFERENCE_CONDITIONINGS = ['video_audio', 'video', 'audio'] as const;+const VIDEO_REFERENCE_IMAGE_DETAILS = ['max', 'match'] as const;++export const isVideoReferenceItem = (value: unknown): value is VideoReferenceItem => {+ if (!isRecord(value)) {+ return false;+ }+ if (value.kind === 'video') {+ return (+ isVideoSourceClip(value.clip) &&+ VIDEO_REFERENCE_CONDITIONINGS.includes(value.conditioning as (typeof VIDEO_REFERENCE_CONDITIONINGS)[number])+ );+ }+ if (value.kind === 'image') {+ return (+ isImageWithDims(value.image) &&+ VIDEO_REFERENCE_IMAGE_DETAILS.includes(value.detail as (typeof VIDEO_REFERENCE_IMAGE_DETAILS)[number])+ );+ }+ return false;+};++/** Drops invalid entries and enforces the per-kind caps, preserving order. */+const sanitizeVideoReferences = (value: unknown): VideoReferenceItem[] => {+ if (!Array.isArray(value)) {+ return [];+ }+ const result: VideoReferenceItem[] = [];+ let videos = 0;+ let images = 0;+ for (const entry of value) {+ if (!isVideoReferenceItem(entry)) {+ continue;+ }+ if (entry.kind === 'image') {+ if (images >= VIDEO_REFERENCE_MAX_IMAGES) {+ continue;+ }+ images += 1;+ } else {+ if (videos >= VIDEO_REFERENCE_MAX_VIDEOS) {+ continue;+ }+ videos += 1;+ }+ result.push(entry);+ }+ return result;+};+const isVideoLora = (value: unknown): value is GenerateLora =>isRecord(value) &&isLoraModelConfig(value.model) &&@@ -93,8 +148,12 @@ const areAcceleratorLorasPresent = (keys: readonly string[], loras: readonly Gen* the destination the extension should land on.*/export const resolveVideoMode = (- settings: Pick<VideoSettings, 'firstFrameImage' | 'lastFrameImage' | 'sourceVideo'>+ settings: Pick<VideoSettings, 'firstFrameImage' | 'lastFrameImage' | 'sourceVideo' | 'references'>): VideoGenerationMode => {+ if (settings.references.length > 0) {+ return 'reference';+ }+if (settings.sourceVideo) {return 'extend';}@@ -140,10 +199,16 @@ export const normalizeVideoSettings = (values: unknown): VideoSettings | null =>return null;}- const firstFrameImage = isImageWithDims(values.firstFrameImage) ? values.firstFrameImage : null;+ // References are mutually exclusive with every frame/source-video slot; when a stale+ // record somehow holds both, the references win deterministically (mirroring the+ // first-frame-beats-source rule below).+ const references = sanitizeVideoReferences(values.references);+ const hasReferences = references.length > 0;+ const firstFrameImage = !hasReferences && isImageWithDims(values.firstFrameImage) ? values.firstFrameImage : null;// A first frame and a source video are mutually exclusive; if a stale// project somehow holds both, the first frame wins deterministically.- const sourceVideo = !firstFrameImage && isVideoSourceClip(values.sourceVideo) ? values.sourceVideo : null;+ const sourceVideo =+ !firstFrameImage && !hasReferences && isVideoSourceClip(values.sourceVideo) ? values.sourceVideo : null;const loras = Array.isArray(values.loras) ? values.loras.filter(isVideoLora) : [];const acceleratorLoraKeys = getStringArray(values.acceleratorLoraKeys);// The flag means "the accelerator LoRAs the toggle added are active": if any@@ -163,7 +228,7 @@ export const normalizeVideoSettings = (values: unknown): VideoSettings | null =>h3TransformerModel: isMainModelConfig(values.h3TransformerModel) ? values.h3TransformerModel : null,acceleratorEnabled,acceleratorLoraKeys: acceleratorEnabled ? acceleratorLoraKeys : [],- lastFrameImage: isImageWithDims(values.lastFrameImage) ? values.lastFrameImage : null,+ lastFrameImage: !hasReferences && isImageWithDims(values.lastFrameImage) ? values.lastFrameImage : null,loras,modelKey: typeof values.modelKey === 'string' ? values.modelKey : '',negativePrompt: typeof values.negativePrompt === 'string' ? values.negativePrompt : '',@@ -184,6 +249,7 @@ export const normalizeVideoSettings = (values: unknown): VideoSettings | null =>MAX_POSITIVE_PROMPT_HEIGHT_PX,DEFAULT_POSITIVE_PROMPT_HEIGHT_PX),+ references,seed: hasFiniteNumber(values, 'seed') ? (values.seed as number) : 0,shouldRandomizeSeed: typeof values.shouldRandomizeSeed === 'boolean' ? values.shouldRandomizeSeed : true,sourceVideo,@@ -224,6 +290,12 @@ export const isVideoSettings = (values: unknown): values is VideoSettings => {(values.lastFrameImage === null || isImageWithDims(values.lastFrameImage)) &&(values.sourceVideo === null || isVideoSourceClip(values.sourceVideo)) &&!(values.firstFrameImage !== null && values.sourceVideo !== null) &&+ Array.isArray(values.references) &&+ values.references.every(isVideoReferenceItem) &&+ !(+ (values.references as unknown[]).length > 0 &&+ (values.firstFrameImage !== null || values.lastFrameImage !== null || values.sourceVideo !== null)+ ) &&Array.isArray(values.loras) &&values.loras.every(isVideoLora) &&(values.vae === null || isVaeModelConfig(values.vae)) &&@@ -265,6 +337,11 @@ export const cloneVideoWidgetValues = (values: VideoWidgetValues): VideoWidgetValastFrameImage: values.lastFrameImage ? { ...values.lastFrameImage } : null,loras: values.loras.map((lora) => ({ ...lora, model: { ...lora.model } })),model: values.model ? { ...values.model } : null,+ references: values.references.map((reference) =>+ reference.kind === 'video'+ ? { ...reference, clip: { ...reference.clip } }+ : { ...reference, image: { ...reference.image } }+ ),sourceVideo: values.sourceVideo ? { ...values.sourceVideo } : null,vae: values.vae ? { ...values.vae } : null,wanLowNoiseModel: values.wanLowNoiseModel ? { ...values.wanLowNoiseModel } : null,@@ -321,12 +398,26 @@ export const clearDeletedVideoMedia = <T extends object>(removedImageNames: ReadonlySet<string>,removedVideoNames: ReadonlySet<string>): T => {- const slots = values as { firstFrameImage?: unknown; lastFrameImage?: unknown; sourceVideo?: unknown };+ const slots = values as {+ firstFrameImage?: unknown;+ lastFrameImage?: unknown;+ sourceVideo?: unknown;+ references?: unknown;+ };const clearFirst = isImageWithDims(slots.firstFrameImage) && removedImageNames.has(slots.firstFrameImage.image_name);const clearLast = isImageWithDims(slots.lastFrameImage) && removedImageNames.has(slots.lastFrameImage.image_name);const clearSource = isVideoSourceClip(slots.sourceVideo) && removedVideoNames.has(slots.sourceVideo.video_name);+ const references = Array.isArray(slots.references) ? slots.references : null;+ const keptReferences = references?.filter(+ (entry) =>+ !isVideoReferenceItem(entry) ||+ (entry.kind === 'video'+ ? !removedVideoNames.has(entry.clip.video_name)+ : !removedImageNames.has(entry.image.image_name))+ );+ const clearReferences = keptReferences !== undefined && keptReferences.length !== references?.length;- if (!clearFirst && !clearLast && !clearSource) {+ if (!clearFirst && !clearLast && !clearSource && !clearReferences) {return values;}@@ -337,5 +428,6 @@ export const clearDeletedVideoMedia = <T extends object>(...(clearFirst ? { firstFrameImage: null } : {}),...(clearLast ? { lastFrameImage: null } : {}),...(clearSource ? { sourceVideo: null } : {}),+ ...(clearReferences ? { references: keptReferences } : {}),} as T;};diff --git a/invokeai/frontend/webv2/src/features/video/core/types.ts b/invokeai/frontend/webv2/src/features/video/core/types.tsindex dc011a2b45..c35bccd2c4 100644--- a/invokeai/frontend/webv2/src/features/video/core/types.ts+++ b/invokeai/frontend/webv2/src/features/video/core/types.ts@@ -10,7 +10,7 @@ import type {* How a video generation is conditioned. There is no explicit mode selector:* the mode is inferred from which inputs are filled — see `resolveVideoMode`.*/-export type VideoGenerationMode = 'txt2vid' | 'first-frame' | 'last-frame' | 'first-last' | 'extend';+export type VideoGenerationMode = 'txt2vid' | 'first-frame' | 'last-frame' | 'first-last' | 'extend' | 'reference';/** A gallery video selected as the clip to extend, with the trim range to keep. */export interface VideoSourceClip {@@ -24,6 +24,25 @@ export interface VideoSourceClip {endFrame: number;}+/**+ * Which streams a Ref2VA video reference conditions. The graph-literal values of the+ * `minimax_h3_video_reference` node: 'audio' maps to upstream's standalone audio-reference+ * kind, sourced from the video's soundtrack.+ */+export type VideoReferenceConditioning = 'video_audio' | 'video' | 'audio';++/** Ref2VA image-reference sizing: 'max' = 2048px short edge, 'match' = generation's pixel area. */+export type VideoReferenceImageDetail = 'max' | 'match';++/**+ * One ordered Ref2VA reference. Order is part of the request contract — a different order+ * is a different generation — so references live in a single ordered array whatever their+ * kind. A video reference reuses `VideoSourceClip` for its trim bounds.+ */+export type VideoReferenceItem =+ | { kind: 'video'; clip: VideoSourceClip; conditioning: VideoReferenceConditioning }+ | { kind: 'image'; image: ImageWithDims; detail: VideoReferenceImageDetail };+export type WanTargetResolution = '480p' | '720p' | '1080p';export type MiniMaxH3TargetResolution = '768 highres' | '768 lowres';export type VideoTargetResolution = WanTargetResolution | MiniMaxH3TargetResolution;@@ -55,6 +74,12 @@ export interface VideoSettings {lastFrameImage: ImageWithDims | null;/** The clip to extend. Mutually exclusive with `firstFrameImage`. */sourceVideo: VideoSourceClip | null;+ /**+ * Ref2VA references, in conditioning order (up to 3 videos and 9 images). Mutually+ * exclusive with `firstFrameImage`/`lastFrameImage`/`sourceVideo`; only a Ref2VA+ * transformer consumes them — see `resolveVideoMode` and the `reference` mode.+ */+ references: VideoReferenceItem[];aspectRatioId: VideoAspectRatioId;targetResolution: VideoTargetResolution;numFrames: number;diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.tsindex 96e74a96b2..89fe0ad80a 100644--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts@@ -16,8 +16,10 @@ import {getVideoModelSelectionResult,getVideoModes,getVideoPromptPolicy,+ getVideoTransformerSelectionResult,getVideoValidationReasons,getWanExpertWiringWarning,+ resolveEffectiveVideoModel,isSupportedVideoModel,isValidVideoNumFrames,snapVideoNumFrames,@@ -605,14 +607,13 @@ describe('component section policy', () => {expect(transformerSlot?.filter?.(h3Model('diffusers'), ctx)).toBe(false);});- it('excludes Ref2VA transformers from the H3 transformer picker until the reference mode lands', () => {- // TODO(ref2va): invert this expectation when reference-conditioned generation ships.+ it('keeps Ref2VA transformers pickable - the variant switches the panel to the reference mode', () => {const model = h3Model();const policy = getVideoComponentSectionPolicy(model, settingsFor(model));const transformerSlot = policy.slots[0];const ctx = { model, selectedComponents: settingsFor(model), settings: settingsFor(model) };- expect(transformerSlot?.filter?.({ ...h3Model('checkpoint'), variant: 'ref2va' }, ctx)).toBe(false);+ expect(transformerSlot?.filter?.({ ...h3Model('checkpoint'), variant: 'ref2va' }, ctx)).toBe(true);});});@@ -889,3 +890,151 @@ describe('getVideoModelAvailabilityReasons', () => {expect(installed).toEqual([]);});});++// ---------------------------------------------------------------------------+// Ref2VA: effective variant, reference mode, transitions++const ref2vaTransformer = (key = 'h3-ref2va-ckpt'): MainModelConfig => ({+ ...h3Model('checkpoint', key),+ name: 'MiniMax H3 Ref2VA Transformer (int8, pruned)',+ variant: 'ref2va',+});++const fl2vaTransformer = (key = 'h3-fl2va-ckpt'): MainModelConfig => ({+ ...h3Model('checkpoint', key),+ name: 'MiniMax H3 FL2VA Transformer (int8, pruned)',+ variant: 'fl2va',+});++const imageReference = { detail: 'max', image: { height: 4, image_name: 'ref.png', width: 4 }, kind: 'image' } as const;++describe('resolveEffectiveVideoModel', () => {+ it('overrides the H3 variant with the selected transformer checkpoint', () => {+ const model = h3Model();+ const settings = settingsFor(model, { h3TransformerModel: ref2vaTransformer() });++ expect(resolveEffectiveVideoModel(model, settings)?.variant).toBe('ref2va');+ expect(resolveEffectiveVideoModel(model, settingsFor(model))?.variant).toBe('fl2va');+ });++ it('never touches non-H3 models', () => {+ const model = wanModel('t2v_a14b', 'diffusers');++ expect(resolveEffectiveVideoModel(model, settingsFor(model, { h3TransformerModel: ref2vaTransformer() }))).toBe(+ model+ );+ });+});++describe('reference mode policy', () => {+ it('a ref2va transformer switches the panel to the reference-only mode set', () => {+ const model = h3Model();+ const settings = settingsFor(model, { h3TransformerModel: ref2vaTransformer() });++ expect(getVideoModelPolicy(model, settings).modes).toEqual(['reference']);+ expect(getVideoModelPolicy(model, settings).references).toEqual({ maxImages: 9, maxVideos: 3 });+ expect(getVideoModelPolicy(model, settingsFor(model)).references).toBeNull();+ });++ it('an unknown variant still falls back to fl2va, but ref2va never does', () => {+ const unknown = { ...h3Model(), variant: 'novel_task' };++ expect(getVideoModes(unknown)).toContain('txt2vid');+ expect(getVideoModes({ ...h3Model(), variant: 'ref2va' })).toEqual(['reference']);+ });++ it('validates the reference rules', () => {+ const model = h3Model();+ const withRefTransformer = (overrides: Partial<VideoSettings>) =>+ settingsFor(model, { h3TransformerModel: ref2vaTransformer(), ...overrides });++ expect(getVideoValidationReasons(model, withRefTransformer({}))).toContain(+ 'Reference-to-video needs at least one image or video reference.'+ );+ expect(+ getVideoValidationReasons(+ model,+ withRefTransformer({+ references: [+ {+ clip: {+ endFrame: 10,+ fps: 24,+ height: 4,+ numFrames: 12,+ startFrame: 0,+ video_name: 'ref.mp4',+ width: 4,+ },+ conditioning: 'audio',+ kind: 'video',+ },+ ],+ })+ )+ ).toContain(+ 'At least one reference must contribute visuals — add an image, or set a video reference to include video.'+ );+ expect(getVideoValidationReasons(model, withRefTransformer({ references: [imageReference] }))).toEqual([]);+ });++ it('rejects references on an fl2va-effective panel', () => {+ const model = h3Model();+ const reasons = getVideoValidationReasons(model, settingsFor(model, { references: [imageReference] }));++ expect(reasons.some((reason) => reason.includes('reference-conditioned'))).toBe(true);+ });+});++describe('getVideoTransformerSelectionResult', () => {+ it('clears frame media when switching to a ref2va transformer, and references on the way back', () => {+ const model = h3Model();+ const first = { height: 4, image_name: 'kf.png', width: 4 };+ const toRef = getVideoTransformerSelectionResult({+ currentSettings: settingsFor(model, { firstFrameImage: first, modelKey: model.key }),+ model,+ models: [model],+ transformer: ref2vaTransformer(),+ });++ expect(toRef.settings.firstFrameImage).toBeNull();+ expect(toRef.settings.h3TransformerModel?.variant).toBe('ref2va');+ expect(toRef.clearedLabels).toContain('First frame');++ const backToFl = getVideoTransformerSelectionResult({+ currentSettings: { ...toRef.settings, references: [imageReference] },+ model,+ models: [model],+ transformer: fl2vaTransformer(),+ });++ expect(backToFl.settings.references).toEqual([]);+ expect(backToFl.clearedLabels).toContain('References');+ });+});++describe('ref2va accelerator auto-pick', () => {+ const REF2V_TURBO = {+ base: 'minimax-h3',+ key: 'ref2v-turbo',+ name: 'MiniMax H3 Ref2V Turbo LoRA',+ type: 'lora' as const,+ };+ const FL2VA_TURBO = { base: 'minimax-h3', key: 'turbo', name: 'MiniMax H3 Turbo LoRA', type: 'lora' as const };++ it('requires the ref2v-token repack for the ref2va variant and excludes it otherwise', () => {+ expect(findMiniMaxH3TurboLora([REF2V_TURBO, FL2VA_TURBO], 'ref2va')).toMatchObject({ key: 'ref2v-turbo' });+ expect(findMiniMaxH3TurboLora([REF2V_TURBO, FL2VA_TURBO], 'fl2va')).toMatchObject({ key: 'turbo' });+ expect(findMiniMaxH3TurboLora([FL2VA_TURBO], 'ref2va')).toBeNull();+ });++ it('the accelerator toggle resolves through the effective variant (4-step ref2v turbo)', () => {+ const model = h3Model();+ const settings = settingsFor(model, { h3TransformerModel: ref2vaTransformer() });+ const result = getAcceleratorToggleResult(settings, model, [model, REF2V_TURBO, FL2VA_TURBO], true);++ expect(result.missingLoras).toBe(false);+ expect(result.settings.acceleratorLoraKeys).toEqual(['ref2v-turbo']);+ expect(result.settings.steps).toBe(4);+ });+});diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.tsindex ba5e068479..579d5e5a2e 100644--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts@@ -109,6 +109,8 @@ interface VideoVariantConfig {negativePrompt: { visible: boolean; usage: VideoNegativePromptUsage };accelerator: VideoAcceleratorConfig | null;audioOutput: boolean;+ /** Ref2VA reference caps; present only on variants whose modes include 'reference'. */+ references?: { maxVideos: number; maxImages: number };}export const WAN_LIGHTNING_ACCELERATOR: VideoAcceleratorConfig = {@@ -125,6 +127,14 @@ export const MINIMAX_H3_TURBO_ACCELERATOR: VideoAcceleratorConfig = {steps: 6,};+/** The Ref2VA-trained 4-step Turbo distillation (Comfy-Org's ref2v turbo repack). */+export const MINIMAX_H3_REF2V_TURBO_ACCELERATOR: VideoAcceleratorConfig = {+ cfgScale: 1,+ cfgScaleLowNoise: null,+ label: 'Turbo',+ steps: 4,+};+const WAN_TARGET_RESOLUTION_OPTIONS: readonly VideoTargetResolutionOption[] = [{ id: '480p', label: '480p (Wan native)' },{ id: '720p', label: '720p (Wan native)' },@@ -202,11 +212,22 @@ const MINIMAX_H3_FL2VA: VideoVariantConfig = {targetResolutions: MINIMAX_H3_TARGET_RESOLUTION_OPTIONS,};+// The Ref2VA task transformer supports ONLY reference-conditioned generation (upstream+// declares tasks: ["ref2va"]); everything else it inherits from the FL2VA panel policy.+const MINIMAX_H3_REF2VA: VideoVariantConfig = {+ ...MINIMAX_H3_FL2VA,+ accelerator: MINIMAX_H3_REF2V_TURBO_ACCELERATOR,+ modes: ['reference'],+ references: { maxImages: 9, maxVideos: 3 },+};+export const VIDEO_GENERATION: Record<SupportedVideoBase,{ variants: Record<string, VideoVariantConfig>; fallback: VideoVariantConfig }> = {- 'minimax-h3': { fallback: MINIMAX_H3_FL2VA, variants: { fl2va: MINIMAX_H3_FL2VA } },+ // ref2va is REGISTERED, never the fallback: an unknown future variant may fall back to+ // fl2va's config, but a known ref2va transformer must not silently get fl2va's modes.+ 'minimax-h3': { fallback: MINIMAX_H3_FL2VA, variants: { fl2va: MINIMAX_H3_FL2VA, ref2va: MINIMAX_H3_REF2VA } },wan: { fallback: WAN_FALLBACK_VARIANT, variants: WAN_VARIANTS },};@@ -236,6 +257,26 @@ export const isComponentsOnlyH3Main = (model: MainModelConfig): boolean =>// that re-opens the fail-mid-generation hole this helper exists to close.model.base === 'minimax-h3' && model.format === 'diffusers' && model.components_only === true;+/**+ * The model whose variant decides the panel's policy. For MiniMax H3 the TASK lives on the+ * transformer: selecting a single-file Ref2VA transformer switches the whole panel to the+ * reference mode, whatever the (components) main model's variant says. Everything that maps a+ * model to a VideoVariantConfig and has the settings at hand must resolve through this first.+ */+export const resolveEffectiveVideoModel = <T extends MainModelConfig | undefined>(+ model: T,+ settings: Pick<VideoSettings, 'h3TransformerModel'> | null | undefined+): T => {+ if (!model || model.base !== 'minimax-h3') {+ return model;+ }+ const variant = settings?.h3TransformerModel?.variant;+ if (typeof variant === 'string' && variant.length > 0 && variant !== model.variant) {+ return { ...model, variant };+ }+ return model;+};+const getVideoVariantConfig = (model: Pick<MainModelConfig, 'base' | 'type' | 'variant' | 'format'> | undefined): VideoVariantConfig | null => {@@ -401,6 +442,8 @@ export interface VideoModelPolicy {negativeUsedInGraph: boolean;negativeHelpText?: string;};+ /** Ref2VA reference caps; null unless the effective variant has a reference mode. */+ references: { maxVideos: number; maxImages: number } | null;ui: {cfgVisible: boolean;cfgLowNoiseVisible: boolean;@@ -412,10 +455,13 @@ export interface VideoModelPolicy {}export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings: VideoSettings): VideoModelPolicy => {- const config = getVideoConfig(model);+ // The transformer override can redefine the task (fl2va vs ref2va): the panel policy+ // always comes from the effective model.+ const effectiveModel = resolveEffectiveVideoModel(model, settings);+ const config = getVideoConfig(effectiveModel);return {- aspectRatioOptions: getVideoAspectRatioOptions(model),+ aspectRatioOptions: getVideoAspectRatioOptions(effectiveModel),defaults: config.defaults,fps: config.fps,frames: config.frames,@@ -423,7 +469,8 @@ export const getVideoModelPolicy = (model: MainModelConfig | undefined, settingsminSteps: config.minSteps,modes: config.modes,pixelMultiple: config.pixelMultiple,- prompt: getVideoPromptPolicy(model, settings),+ prompt: getVideoPromptPolicy(effectiveModel, settings),+ references: config.references ?? null,targetResolutions: config.targetResolutions,ui: {accelerator: config.accelerator,@@ -495,8 +542,15 @@ const MINIMAX_H3_REF2V_PATTERN = /(?:^|[^a-z0-9])ref2va?(?:[^a-z0-9]|$)/i;* real repack whenever one is installed. Ref2VA-trained turbo LoRAs are* excluded: the FL2VA accelerator must not pick them.*/-export const findMiniMaxH3TurboLora = (models: readonly ModelConfig[]): LoraModelConfig | null => {+export const findMiniMaxH3TurboLora = (+ models: readonly ModelConfig[],+ variant: string | null | undefined = 'fl2va'+): LoraModelConfig | null => {const score = (model: LoraModelConfig): number => (MINIMAX_H3_NAME_PATTERN.test(model.name) ? 0 : 1);+ // The task decides which distillation qualifies: ref2va REQUIRES the ref2v-token repack,+ // every other variant excludes it — the two are trained against different transformers.+ const matchesTask = (name: string): boolean =>+ variant === 'ref2va' ? MINIMAX_H3_REF2V_PATTERN.test(name) : !MINIMAX_H3_REF2V_PATTERN.test(name);return (models@@ -505,16 +559,16 @@ export const findMiniMaxH3TurboLora = (models: readonly ModelConfig[]): LoraModeisLoraModelConfig(model) &&model.base === 'minimax-h3' &&TURBO_PATTERN.test(model.name) &&- !MINIMAX_H3_REF2V_PATTERN.test(model.name)+ matchesTask(model.name)).sort((a, b) => score(a) - score(b) || a.name.localeCompare(b.name))[0] ?? null);};-/** The accelerator LoRA entries for a model, or null when they are not installed. */+/** The accelerator LoRA entries for the EFFECTIVE model, or null when they are not installed. */const findAcceleratorLoraEntries = (model: MainModelConfig, models: readonly ModelConfig[]): GenerateLora[] | null => {if (model.base === 'minimax-h3') {- const turbo = findMiniMaxH3TurboLora(models);+ const turbo = findMiniMaxH3TurboLora(models, typeof model.variant === 'string' ? model.variant : 'fl2va');return turbo ? [{ isEnabled: true, model: turbo, weight: 1 }] : null;}@@ -546,7 +600,8 @@ export const getAcceleratorToggleResult = (models: readonly ModelConfig[],enabled: boolean): AcceleratorToggleResult => {- const config = getVideoConfig(model);+ const effectiveModel = resolveEffectiveVideoModel(model, settings);+ const config = getVideoConfig(effectiveModel);// Remove exactly the entries a previous toggle added — never a user's own// LoRA that happens to share a Lightning/Turbo-style name.const previousKeys = new Set(settings.acceleratorLoraKeys);@@ -567,7 +622,7 @@ export const getAcceleratorToggleResult = (};}- const entries = findAcceleratorLoraEntries(model, models);+ const entries = findAcceleratorLoraEntries(effectiveModel, models);if (!entries) {// Never leave the flag claiming a fast path that has no LoRAs behind it.@@ -791,16 +846,14 @@ export const getVideoComponentSectionPolicy = (return createComponentPolicy(componentsOnly, [{- // TODO(ref2va): remove the variant exclusion when the reference generation mode lands —- // until then a Ref2VA transformer must not silently generate under FL2VA's config.+ // Both task variants stay pickable: selecting a Ref2VA transformer is HOW the panel+ // switches to reference-conditioned generation (the variant drives the effective+ // policy — see resolveEffectiveVideoModel).filter: (candidate) =>- candidate.type === 'main' &&- candidate.base === 'minimax-h3' &&- candidate.format === 'checkpoint' &&- candidate.variant !== 'ref2va',+ candidate.type === 'main' && candidate.base === 'minimax-h3' && candidate.format === 'checkpoint',helpText: componentsOnly- ? 'Required: this main model is a components-only install, so the transformer must come from a single-file checkpoint (e.g. pruned int8).'- : 'Optional single-file transformer (e.g. pruned int8) used in place of the main model’s transformer.',+ ? 'Required: this main model is a components-only install, so the transformer must come from a single-file checkpoint (e.g. pruned int8). Its task variant (FL2VA vs Ref2VA) decides the panel’s generation mode.'+ : 'Optional single-file transformer (e.g. pruned int8) used in place of the main model’s transformer. Its task variant (FL2VA vs Ref2VA) decides the panel’s generation mode.',key: 'h3TransformerModel',label: 'Transformer (single file)',missingMessage: `${model.name} is a components-only install — select a single-file Transformer.`,@@ -928,6 +981,7 @@ export const getDefaultVideoSettings = (numFrames: config.frames.defaultValue,positivePrompt: '',positivePromptHeightPx: 96,+ references: [],seed: Math.floor(Math.random() * SEED_MAX),shouldRandomizeSeed: true,sourceVideo: null,@@ -982,6 +1036,12 @@ export const getVideoSettingsWithModelDefaults = (].map((lora) => (isLoraCompatibleWithModel(lora.model, model) ? lora : { ...lora, isEnabled: false })),modelKey: model.key,numFrames: modelDefaults.numFrames,+ // Resetting nulls the transformer override, and the override is what makes Ref2VA+ // references consumable - keeping them would leave an orphaned list for the widget+ // sync to sweep away silently. Clearing here keeps the reset's effects in one place.+ // (Frame/source conditioning media stay untouched: they remain valid under the+ // default FL2VA policy.)+ references: modelDefaults.references,steps: modelDefaults.steps,targetResolution: modelDefaults.targetResolution,vae: modelDefaults.vae,@@ -1016,7 +1076,12 @@ export const getVideoModelSelectionResult = ({model: MainModelConfig;models: readonly ModelConfig[];}): VideoModelSelectionResult => {- const config = getVideoConfig(model);+ // The transformer override can redefine the task (fl2va vs ref2va), so the policy comes+ // from the EFFECTIVE model. The override itself is reconciled at the end of this+ // transition; if it is dropped there, the caller re-runs selection through+ // getVideoTransformerSelectionResult on the next change anyway.+ const effectiveModel = resolveEffectiveVideoModel(model, currentSettings);+ const config = getVideoConfig(effectiveModel);// A record without a modelKey was healed from a store the panel never// seeded (a fresh project, or a pre-open "Send to Video" payload): its// sampling values are the model-agnostic healing fallbacks, not user@@ -1030,6 +1095,11 @@ export const getVideoModelSelectionResult = ({const clearedLabels: string[] = [];const modes = config.modes;+ if (next.references.length > 0 && !modes.includes('reference')) {+ next.references = [];+ addClearedLabel(clearedLabels, 'References');+ }+if (next.sourceVideo && !modes.includes('extend')) {next.sourceVideo = null;addClearedLabel(clearedLabels, 'Initial video');@@ -1057,7 +1127,7 @@ export const getVideoModelSelectionResult = ({addClearedLabel(clearedLabels, 'Target resolution');}- const snappedFrames = snapVideoNumFrames(model, next.numFrames);+ const snappedFrames = snapVideoNumFrames(effectiveModel, next.numFrames);if (snappedFrames !== next.numFrames) {next.numFrames = snappedFrames;@@ -1081,7 +1151,7 @@ export const getVideoModelSelectionResult = ({// changes (Lightning ↔ Turbo) is the toggle re-applied, and when the new// model has no accelerator — or its LoRAs are not installed — the fast// path turns off, restoring the model's own steps/CFG.- const targetEntries = config.accelerator ? findAcceleratorLoraEntries(model, models) : null;+ const targetEntries = config.accelerator ? findAcceleratorLoraEntries(effectiveModel, models) : null;const targetKeys = targetEntries?.map((entry) => entry.model.key).sort() ?? null;const currentKeys = [...next.acceleratorLoraKeys].sort();const sameAccelerator =@@ -1135,6 +1205,29 @@ export const getVideoModelSelectionResult = ({return { clearedLabels, settings: next };};+/**+ * Canonical transition for the H3 transformer slot. The transformer decides the TASK+ * (fl2va's five modes vs ref2va's reference mode), so changing it must run the same+ * media/accelerator/frames reconciliation a model selection runs — with the new override+ * already in place so the effective policy is the new task's.+ */+export const getVideoTransformerSelectionResult = ({+ currentSettings,+ model,+ models,+ transformer,+}: {+ currentSettings: VideoSettings;+ model: MainModelConfig;+ models: readonly ModelConfig[];+ transformer: MainModelConfig | null;+}): VideoModelSelectionResult =>+ getVideoModelSelectionResult({+ currentSettings: { ...currentSettings, h3TransformerModel: transformer },+ model,+ models,+ });+// ---------------------------------------------------------------------------// Validation@@ -1143,6 +1236,7 @@ const VIDEO_MODE_DESCRIPTIONS: Record<VideoGenerationMode, string> = {'first-frame': 'starting from a first frame','first-last': 'first-to-last-frame interpolation','last-frame': 'ending on a last frame',+ reference: 'reference-conditioned generation',txt2vid: 'text-to-video',};@@ -1182,21 +1276,71 @@ export const getVideoValidationReasons = (model: MainModelConfig, settings: Videreturn ['Video needs a supported video model before it can be invoked.'];}- const config = getVideoConfig(model);+ const effectiveModel = resolveEffectiveVideoModel(model, settings);+ const config = getVideoConfig(effectiveModel);const reasons: string[] = [];const mode = resolveVideoMode(settings);+ const referenceOnly = config.modes.length === 1 && config.modes[0] === 'reference';if (settings.firstFrameImage && settings.sourceVideo) {reasons.push('A first frame and an initial video cannot be combined. Clear one of them.');}+ if (settings.references.length > 0 && (settings.firstFrameImage || settings.lastFrameImage || settings.sourceVideo)) {+ reasons.push('References cannot be combined with first/last frames or an initial video. Clear one side.');+ }+if (!config.modes.includes(mode)) {- reasons.push(`${model.name} does not support ${VIDEO_MODE_DESCRIPTIONS[mode]}.`);+ if (referenceOnly && settings.references.length === 0) {+ // The generic message would say "does not support text-to-video", which reads as a+ // model defect; the actual fix is to add a reference.+ reasons.push('Reference-to-video needs at least one image or video reference.');+ } else {+ reasons.push(`${model.name} does not support ${VIDEO_MODE_DESCRIPTIONS[mode]}.`);+ }} else if (mode === 'extend' && settings.lastFrameImage && !config.modes.includes('first-last')) {reasons.push(`${model.name} cannot target a destination image while extending a video.`);}- if (!isValidVideoNumFrames(model, settings.numFrames)) {+ if (mode === 'reference') {+ const caps = config.references;+ const videoCount = settings.references.filter((reference) => reference.kind === 'video').length;+ const imageCount = settings.references.length - videoCount;+ const allAudioOnly =+ settings.references.length > 0 &&+ settings.references.every((reference) => reference.kind === 'video' && reference.conditioning === 'audio');++ if (allAudioOnly) {+ reasons.push(+ 'At least one reference must contribute visuals — add an image, or set a video reference to include video.'+ );+ }+ if (caps && videoCount > caps.maxVideos) {+ reasons.push(`At most ${caps.maxVideos} video references are supported.`);+ }+ if (caps && imageCount > caps.maxImages) {+ reasons.push(`At most ${caps.maxImages} image references are supported.`);+ }+ for (const reference of settings.references) {+ if (reference.kind !== 'video') {+ continue;+ }+ if (!Number.isInteger(reference.clip.startFrame) || !Number.isInteger(reference.clip.endFrame)) {+ reasons.push('Reference video trim bounds must be whole frame numbers.');+ break;+ }+ if (+ reference.clip.startFrame < 0 ||+ reference.clip.endFrame > reference.clip.numFrames - 1 ||+ reference.clip.endFrame < reference.clip.startFrame+ ) {+ reasons.push('A reference video trim is outside its clip.');+ break;+ }+ }+ }++ if (!isValidVideoNumFrames(effectiveModel, settings.numFrames)) {reasons.push(config.frames.kind === 'grid'? `Frame count must be between ${config.frames.min} and ${config.frames.max} in steps of ${config.frames.step} (4·n + 1).`@@ -1265,7 +1409,7 @@ export const getVideoValidationReasons = (model: MainModelConfig, settings: Vide}}- if (!getVideoDimensions(model, settings)) {+ if (!getVideoDimensions(effectiveModel, settings)) {reasons.push(model.base === 'minimax-h3'? 'MiniMax H3 supports aspect ratios from 1:4 to 4:1. The conditioning media is outside that range.'diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.tsindex 65d3cb03a2..540cb8e219 100644--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts@@ -14,8 +14,10 @@ import {getVideoModelAvailabilityReasons,getVideoModelPolicy,getVideoModelSelectionResult,+ getVideoModes,getVideoValidationReasons,isSupportedVideoModel,+ resolveEffectiveVideoModel,type VideoComponentPolicyContext,type VideoComponentValueKey,} from './videoPolicies';@@ -130,6 +132,17 @@ export const syncVideoWidgetValuesWithModels = (wanT5EncoderModel: syncComponent('wanT5EncoderModel', base.wanT5EncoderModel),};+ // The transformer decides the task: if the Ref2VA transformer was uninstalled (and the+ // slot re-resolved to null or an FL2VA file), the stored references are orphaned - the+ // effective policy no longer has a reference mode - so drop them, identity-preserving.+ if (next.references.length > 0 && model) {+ const effectiveModel = resolveEffectiveVideoModel(model, next);++ if (!getVideoModes(effectiveModel).includes('reference')) {+ next.references = [];+ }+ }+const isUnchanged =base === values &&next.model === values.model &&@@ -142,6 +155,7 @@ export const syncVideoWidgetValuesWithModels = (next.componentSourceModel === values.componentSourceModel &&next.h3TransformerModel === values.h3TransformerModel &&next.h3TextEncoderModel === values.h3TextEncoderModel &&+ next.references === values.references &&next.loras.length === values.loras.length &&next.loras.every((lora, index) => lora.model === values.loras[index]?.model);diff --git a/invokeai/frontend/webv2/src/features/video/index.ts b/invokeai/frontend/webv2/src/features/video/index.tsindex 3d7fe70310..1a654c0484 100644--- a/invokeai/frontend/webv2/src/features/video/index.ts+++ b/invokeai/frontend/webv2/src/features/video/index.ts@@ -8,6 +8,9 @@ export type {MiniMaxH3TargetResolution,VideoAspectRatioId,VideoGenerationMode,+ VideoReferenceConditioning,+ VideoReferenceImageDetail,+ VideoReferenceItem,VideoSettings,VideoSourceClip,VideoTargetResolution,@@ -20,6 +23,7 @@ export {createVideoSourceClip,isImageWithDims,isVideoAspectRatioId,+ isVideoReferenceItem,isVideoSettings,isVideoSourceClip,isVideoTargetResolution,@@ -28,6 +32,8 @@ export {normalizeVideoSettings,normalizeVideoWidgetValues,resolveVideoMode,+ VIDEO_REFERENCE_MAX_IMAGES,+ VIDEO_REFERENCE_MAX_VIDEOS,VIDEO_ASPECT_RATIO_IDS,VIDEO_UI_STATE_KEYS,WAN_TARGET_RESOLUTIONS,@@ -58,6 +64,7 @@ export {getVideoModelPolicy,getVideoModelSelectionResult,getVideoTargetResolutionOptions,+ getVideoTransformerSelectionResult,getWanExpertWiringWarning,getVideoModes,getVideoPromptPolicy,@@ -67,7 +74,9 @@ export {isValidVideoNumFrames,isVideoModelSelectable,isVideoModeSupported,+ MINIMAX_H3_REF2V_TURBO_ACCELERATOR,MINIMAX_H3_TURBO_ACCELERATOR,+ resolveEffectiveVideoModel,snapVideoNumFrames,SUPPORTED_VIDEO_BASES,VIDEO_GENERATION,diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsxindex a21210fdb5..db6c304e8c 100644--- a/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx@@ -15,10 +15,12 @@ import { ModelSelect } from '@features/models/react';import {getVideoComponentSectionPolicy,getVideoModelSelectionResult,+ getVideoTransformerSelectionResult,getWanExpertWiringWarning,} from '@features/video/core/videoPolicies';import { Field } from '@platform/ui';import { Button } from '@platform/ui/Button';+import { toaster } from '@platform/ui/toaster';import { memo, useCallback, useMemo } from 'react';import { useTranslation } from 'react-i18next';@@ -181,11 +183,45 @@ export const VideoComponentsSection = memo(function VideoComponentsSection({values: VideoWidgetValues;}) {const { t } = useTranslation();+ const models = useModelsSelector((snapshot) => snapshot.models);+ const modelsLoaded = useModelsSelector((snapshot) => snapshot.status) === 'loaded';const policy = useMemo(() => getVideoComponentSectionPolicy(values.model ?? undefined, values), [values]);const ctx = useMemo<VideoComponentPolicyContext | null>(() => (values.model ? { model: values.model, selectedComponents: values, settings: values } : null),[values]);+ // The H3 transformer slot decides the TASK (fl2va's five modes vs ref2va's reference+ // mode), so changing it must run the same reconciliation a model selection runs — media+ // the new task cannot consume is cleared, and the accelerator re-resolves to the task's+ // own Turbo distillation. Judged against a loaded catalog only, like the expert swap: a+ // transition computed against an empty catalog would strip the accelerator silently.+ const handlePatch = useCallback(+ (patch: Partial<VideoWidgetValues>) => {+ if ('h3TransformerModel' in patch && values.model && modelsLoaded) {+ const transformer = patch.h3TransformerModel ?? null;+ const result = getVideoTransformerSelectionResult({+ currentSettings: values,+ model: values.model,+ models,+ transformer,+ });++ onPatch({ ...result.settings });+ if (result.clearedLabels.length > 0) {+ toaster.create({+ description: t('widgets.video.settingsAdjustedDescription', {+ labels: result.clearedLabels.join(', '),+ }),+ title: t('widgets.video.settingsAdjusted'),+ type: 'info',+ });+ }+ return;+ }+ onPatch(patch);+ },+ [models, modelsLoaded, onPatch, t, values]+ );if (!ctx || policy.slots.length === 0) {return null;@@ -204,7 +240,7 @@ export const VideoComponentsSection = memo(function VideoComponentsSection({ctx={ctx}slot={slot}value={values[slot.key as VideoComponentValueKey]}- onPatch={onPatch}+ onPatch={handlePatch}/>))}<WanExpertWiringNotice values={values} onPatch={onPatch} />diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsxnew file mode 100644index 0000000000..438617a1c1--- /dev/null+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx@@ -0,0 +1,500 @@+import type { DragEndEvent } from '@dnd-kit/core';+import type {+ VideoReferenceConditioning,+ VideoReferenceImageDetail,+ VideoReferenceItem,+} from '@features/video/core/types';+import type { ChangeEvent } from 'react';++import { Badge, Box, createListCollection, HStack, Image, Input, Spinner, Stack, Text } from '@chakra-ui/react';+import { useDndContext, useDndMonitor, useDroppable } from '@dnd-kit/core';+import { galleryImages, galleryItems, galleryTransfers } from '@features/gallery';+import { galleryImageUrls, galleryVideoUrls, isGalleryItemDragData } from '@features/gallery/utility';+import { createVideoSourceClip } from '@features/video/core/settings';+import {+ assertAccountScopeCurrent,+ captureAccountScope,+ isAccountScopeCurrent,+} from '@platform/state/accountLifecycle';+import { Button, IconButton } from '@platform/ui/Button';+import { DropTargetOverlay } from '@platform/ui/DropTargetOverlay';+import { DropZone } from '@platform/ui/DropZone';+import { Field } from '@platform/ui/Field';+import { MiddleTruncate } from '@platform/ui/MiddleTruncate';+import { Select } from '@platform/ui/Select';+import { SliderNumberField } from '@platform/ui/SliderNumberField';+import { ArrowDownIcon, ArrowUpIcon, FilmIcon, ImagePlusIcon, XIcon } from 'lucide-react';+import { memo, useCallback, useMemo, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { useVideoUiActions } from './VideoUiContext';++/**+ * The ordered Ref2VA reference list: numbered cards (order is part of the request — a+ * different order is a different generation), one gallery drop target that accepts a single+ * image or video, per-kind file uploads, a per-video conditioning selector and trim, and a+ * per-image detail selector.+ */++const DROP_ID = 'video-reference-list';+const IMAGE_UPLOAD_ACCEPT = 'image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp';+const DROP_ZONE_FOCUS_PROPS = {+ outlineColor: 'accent.focusRing',+ outlineOffset: '2px',+ outlineStyle: 'solid',+ outlineWidth: '2px',+};+const DROP_ZONE_DISABLED_PROPS = { cursor: 'not-allowed', opacity: 0.6 };+const DROP_ZONE_BUSY_PROPS = { disabled: true };+const DROP_ZONE_HOVER_PROPS = { bg: 'bg.muted', color: 'fg' };++const getSingleGalleryDragItem = (data: unknown): { kind: 'image' | 'video'; name: string } | null => {+ if (!isGalleryItemDragData(data) || data.items.length !== 1) {+ return null;+ }++ const item = data.items[0];++ return item && (item.kind === 'image' || item.kind === 'video') ? { kind: item.kind, name: item.name } : null;+};++type ReferenceCollections = {+ conditioning: ReturnType<typeof createListCollection<{ label: string; value: string }>>;+ detail: ReturnType<typeof createListCollection<{ label: string; value: string }>>;+};++const ReferenceCard = memo(function ReferenceCard({+ collections,+ disabled,+ index,+ isFirst,+ isLast,+ onMove,+ onRemove,+ onUpdate,+ reference,+}: {+ collections: ReferenceCollections;+ disabled: boolean;+ index: number;+ isFirst: boolean;+ isLast: boolean;+ onMove: (index: number, direction: -1 | 1) => void;+ onRemove: (index: number) => void;+ onUpdate: (index: number, reference: VideoReferenceItem) => void;+ reference: VideoReferenceItem;+}) {+ const { t } = useTranslation();+ const name = reference.kind === 'video' ? reference.clip.video_name : reference.image.image_name;+ const selectValue = useMemo(+ () => [reference.kind === 'video' ? reference.conditioning : reference.detail],+ [reference]+ );+ const handleSelect = useCallback(+ (details: { value: string[] }) => {+ const value = details.value[0];++ if (!value) {+ return;+ }+ if (reference.kind === 'video') {+ onUpdate(index, { ...reference, conditioning: value as VideoReferenceConditioning });+ } else {+ onUpdate(index, { ...reference, detail: value as VideoReferenceImageDetail });+ }+ },+ [index, onUpdate, reference]+ );+ const handleStartFrame = useCallback(+ (startFrame: number) => {+ if (reference.kind === 'video') {+ onUpdate(index, {+ ...reference,+ clip: { ...reference.clip, endFrame: Math.max(startFrame, reference.clip.endFrame), startFrame },+ });+ }+ },+ [index, onUpdate, reference]+ );+ const handleEndFrame = useCallback(+ (endFrame: number) => {+ if (reference.kind === 'video') {+ onUpdate(index, {+ ...reference,+ clip: { ...reference.clip, endFrame, startFrame: Math.min(reference.clip.startFrame, endFrame) },+ });+ }+ },+ [index, onUpdate, reference]+ );+ const handleMoveUp = useCallback(() => onMove(index, -1), [index, onMove]);+ const handleMoveDown = useCallback(() => onMove(index, 1), [index, onMove]);+ const handleRemove = useCallback(() => onRemove(index), [index, onRemove]);++ return (+ <Box borderWidth="1px" p="2" rounded="md">+ <HStack align="start" gap="2">+ <Badge fontVariantNumeric="tabular-nums" size="xs" variant="solid">+ {index + 1}+ </Badge>+ <Box bg="blackAlpha.300" flexShrink={0} h="12" overflow="hidden" rounded="sm" w="16">+ <Image+ alt=""+ fit="cover"+ h="100%"+ src={reference.kind === 'video' ? galleryVideoUrls.thumbnail(name) : galleryImageUrls.thumbnail(name)}+ w="100%"+ />+ </Box>+ <Stack flex="1" gap="1" minW="0">+ <HStack gap="1">+ {reference.kind === 'video' ? <FilmIcon size={12} /> : <ImagePlusIcon size={12} />}+ <MiddleTruncate flex="1" fontSize="xs" text={name} />+ </HStack>+ <Select+ collection={reference.kind === 'video' ? collections.conditioning : collections.detail}+ disabled={disabled}+ size="xs"+ value={selectValue}+ onValueChange={handleSelect}+ />+ {reference.kind === 'video' ? (+ <HStack gap="2">+ <SliderNumberField+ ariaLabel={t('widgets.video.trimStart')}+ disabled={disabled}+ max={Math.max(0, reference.clip.numFrames - 1)}+ min={0}+ step={1}+ value={reference.clip.startFrame}+ onChange={handleStartFrame}+ />+ <SliderNumberField+ ariaLabel={t('widgets.video.trimEnd')}+ disabled={disabled}+ max={Math.max(0, reference.clip.numFrames - 1)}+ min={0}+ step={1}+ value={reference.clip.endFrame}+ onChange={handleEndFrame}+ />+ </HStack>+ ) : null}+ </Stack>+ <Stack gap="0">+ <IconButton+ aria-label={t('widgets.video.moveReferenceUp')}+ disabled={disabled || isFirst}+ size="2xs"+ variant="ghost"+ onClick={handleMoveUp}+ >+ <ArrowUpIcon size={12} />+ </IconButton>+ <IconButton+ aria-label={t('widgets.video.moveReferenceDown')}+ disabled={disabled || isLast}+ size="2xs"+ variant="ghost"+ onClick={handleMoveDown}+ >+ <ArrowDownIcon size={12} />+ </IconButton>+ <IconButton+ aria-label={t('widgets.video.removeReference')}+ disabled={disabled}+ size="2xs"+ variant="ghost"+ onClick={handleRemove}+ >+ <XIcon size={12} />+ </IconButton>+ </Stack>+ </HStack>+ </Box>+ );+});++export const VideoReferenceListField = memo(function VideoReferenceListField({+ disabled = false,+ maxImages,+ maxVideos,+ onChange,+ references,+}: {+ disabled?: boolean;+ maxImages: number;+ maxVideos: number;+ onChange: (references: VideoReferenceItem[]) => void;+ references: VideoReferenceItem[];+}) {+ const { t } = useTranslation();+ const { reportError, touchGalleryImages } = useVideoUiActions();+ const imageInputRef = useRef<HTMLInputElement | null>(null);+ const videoInputRef = useRef<HTMLInputElement | null>(null);+ const [isLoading, setIsLoading] = useState(false);+ const [errorMessage, setErrorMessage] = useState<string | null>(null);++ const videoCount = references.filter((reference) => reference.kind === 'video').length;+ const imageCount = references.length - videoCount;+ const canAddVideo = videoCount < maxVideos;+ const canAddImage = imageCount < maxImages;+ const isInert = disabled || isLoading;++ const { active } = useDndContext();+ const activeDragItem = getSingleGalleryDragItem(active?.data.current);+ const acceptsActiveDrag =+ !isInert && activeDragItem !== null && (activeDragItem.kind === 'video' ? canAddVideo : canAddImage);+ const { isOver, setNodeRef } = useDroppable({ disabled: !acceptsActiveDrag, id: DROP_ID });++ const conditioningCollection = useMemo(+ () =>+ createListCollection({+ items: [+ { label: t('widgets.video.referenceConditioningVideoAudio'), value: 'video_audio' },+ { label: t('widgets.video.referenceConditioningVideo'), value: 'video' },+ { label: t('widgets.video.referenceConditioningAudio'), value: 'audio' },+ ],+ }),+ [t]+ );+ const detailCollection = useMemo(+ () =>+ createListCollection({+ items: [+ { label: t('widgets.video.referenceDetailMax'), value: 'max' },+ { label: t('widgets.video.referenceDetailMatch'), value: 'match' },+ ],+ }),+ [t]+ );+ const collections = useMemo(+ () => ({ conditioning: conditioningCollection, detail: detailCollection }),+ [conditioningCollection, detailCollection]+ );+ const handlePickImage = useCallback(() => imageInputRef.current?.click(), []);+ const handlePickVideo = useCallback(() => videoInputRef.current?.click(), []);++ const addImageReference = useCallback(+ async (imageName: string) => {+ setErrorMessage(null);+ setIsLoading(true);++ try {+ const [resolved] = await galleryImages.resolveMany([imageName]);++ if (resolved) {+ onChange([+ ...references,+ {+ detail: 'max',+ image: { height: resolved.height, image_name: resolved.imageName, width: resolved.width },+ kind: 'image',+ },+ ]);+ }+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ setErrorMessage(message);+ reportError(message);+ } finally {+ setIsLoading(false);+ }+ },+ [onChange, references, reportError]+ );++ const addVideoReference = useCallback(+ async (videoName: string) => {+ setErrorMessage(null);+ setIsLoading(true);++ try {+ const item = await galleryItems.resolve({ kind: 'video', name: videoName });++ if (item?.kind === 'video') {+ const clip = createVideoSourceClip({+ durationSeconds: item.durationSeconds,+ fps: item.fps,+ height: item.height,+ name: item.name,+ width: item.width,+ });++ onChange([+ ...references,+ {+ // References are truncated to the generated duration, not joined: default to+ // the whole clip rather than the extend-mode 2-frame-tail trim.+ clip: { ...clip, endFrame: Math.max(0, clip.numFrames - 1), startFrame: 0 },+ conditioning: 'video_audio',+ kind: 'video',+ },+ ]);+ }+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ setErrorMessage(message);+ reportError(message);+ } finally {+ setIsLoading(false);+ }+ },+ [onChange, references, reportError]+ );++ const handleDragEnd = useCallback(+ (event: DragEndEvent) => {+ const item = getSingleGalleryDragItem(event.active.data.current);++ if (isInert || event.over?.id !== DROP_ID || !item) {+ return;+ }+ if (item.kind === 'video' && canAddVideo) {+ void addVideoReference(item.name);+ } else if (item.kind === 'image' && canAddImage) {+ void addImageReference(item.name);+ }+ },+ [addImageReference, addVideoReference, canAddImage, canAddVideo, isInert]+ );++ useDndMonitor({ onDragEnd: handleDragEnd });++ const uploadFile = useCallback(+ async (file: File, kind: 'image' | 'video') => {+ setErrorMessage(null);+ const owner = captureAccountScope();+ setIsLoading(true);++ try {+ if (kind === 'video') {+ const uploaded = await galleryTransfers.uploadVideo(file, 'none', { signal: owner.signal });++ assertAccountScopeCurrent(owner);+ await addVideoReference(uploaded.name);+ } else {+ const uploaded = await galleryTransfers.upload(file, 'none', { signal: owner.signal });++ assertAccountScopeCurrent(owner);+ await addImageReference(uploaded.imageName);+ }+ touchGalleryImages();+ } catch (error) {+ if (!isAccountScopeCurrent(owner)) {+ return;+ }++ const message = error instanceof Error ? error.message : String(error);+ setErrorMessage(message);+ reportError(message);+ } finally {+ setIsLoading(false);+ }+ },+ [addImageReference, addVideoReference, reportError, touchGalleryImages]+ );++ const handleImageFileChange = useCallback(+ (event: ChangeEvent<HTMLInputElement>) => {+ const file = event.currentTarget.files?.[0];++ if (file) {+ void uploadFile(file, 'image');+ }+ event.currentTarget.value = '';+ },+ [uploadFile]+ );+ const handleVideoFileChange = useCallback(+ (event: ChangeEvent<HTMLInputElement>) => {+ const file = event.currentTarget.files?.[0];++ if (file) {+ void uploadFile(file, 'video');+ }+ event.currentTarget.value = '';+ },+ [uploadFile]+ );++ const updateReference = useCallback(+ (index: number, reference: VideoReferenceItem) => {+ onChange(references.map((entry, entryIndex) => (entryIndex === index ? reference : entry)));+ },+ [onChange, references]+ );+ const removeReference = useCallback(+ (index: number) => {+ onChange(references.filter((_, entryIndex) => entryIndex !== index));+ },+ [onChange, references]+ );+ const moveReference = useCallback(+ (index: number, direction: -1 | 1) => {+ const target = index + direction;++ if (target < 0 || target >= references.length) {+ return;+ }+ const next = [...references];+ const [entry] = next.splice(index, 1);++ if (entry) {+ next.splice(target, 0, entry);+ onChange(next);+ }+ },+ [onChange, references]+ );++ return (+ <Stack gap="2">+ {references.map((reference, index) => (+ <ReferenceCard+ key={`${reference.kind === 'video' ? reference.clip.video_name : reference.image.image_name}-${index}`}+ collections={collections}+ disabled={isInert}+ index={index}+ isFirst={index === 0}+ isLast={index === references.length - 1}+ reference={reference}+ onMove={moveReference}+ onRemove={removeReference}+ onUpdate={updateReference}+ />+ ))}++ <Field helpText={t('widgets.video.referencesHelp')} label={t('widgets.video.addReference')}>+ <DropZone+ ref={setNodeRef}+ {...(isInert ? DROP_ZONE_DISABLED_PROPS : {})}+ {...(isLoading ? DROP_ZONE_BUSY_PROPS : {})}+ {...(isOver && acceptsActiveDrag ? DROP_ZONE_HOVER_PROPS : {})}+ _focusVisible={DROP_ZONE_FOCUS_PROPS}+ position="relative"+ >+ <HStack gap="2" justify="center" p="2">+ {isLoading ? <Spinner size="xs" /> : null}+ <Button disabled={isInert || !canAddImage} size="xs" variant="outline" onClick={handlePickImage}>+ <ImagePlusIcon size={12} />+ {t('widgets.video.addImageReference', { count: imageCount, max: maxImages })}+ </Button>+ <Button disabled={isInert || !canAddVideo} size="xs" variant="outline" onClick={handlePickVideo}>+ <FilmIcon size={12} />+ {t('widgets.video.addVideoReference', { count: videoCount, max: maxVideos })}+ </Button>+ </HStack>+ <DropTargetOverlay isActive={acceptsActiveDrag} isOver={isOver} label={t('widgets.video.dropReference')} />+ </DropZone>+ </Field>+ {errorMessage ? (+ <Text color="fg.error" fontSize="xs">+ {errorMessage}+ </Text>+ ) : null}+ <Input accept={IMAGE_UPLOAD_ACCEPT} hidden ref={imageInputRef} type="file" onChange={handleImageFileChange} />+ <Input accept="video/*" hidden ref={videoInputRef} type="file" onChange={handleVideoFileChange} />+ </Stack>+ );+});diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsxindex f961dce97c..51f3e3d294 100644--- a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx@@ -1,6 +1,6 @@import type { ImageWithDims } from '@features/generation/contracts';import type { ModelConfig, ModelTaxonomyType } from '@features/models';-import type { VideoSourceClip, VideoWidgetValues } from '@features/video/core/types';+import type { VideoReferenceItem, VideoSourceClip, VideoWidgetValues } from '@features/video/core/types';import { createListCollection, HStack, NumberInput, Stack, Switch, Text } from '@chakra-ui/react';import { GenerationSettingsSection } from '@features/generation/components';@@ -31,6 +31,7 @@ import { VideoComponentsSection } from './VideoComponentsSection';import { VideoConceptsSection } from './VideoConceptsSection';import { VideoPromptFields } from './VideoFormFields';import { VideoFrameImageField } from './VideoFrameImageField';+import { VideoReferenceListField } from './VideoReferenceListField';import { VideoSourceClipField } from './VideoSourceClipField';import { useVideoUi, useVideoUiActions } from './VideoUiContext';@@ -244,6 +245,15 @@ export const VideoWidgetView = () => {(sourceVideo: VideoSourceClip | null) => patch({ sourceVideo, ...(sourceVideo ? { firstFrameImage: null } : {}) }),[patch]);+ const setReferences = useCallback(+ (references: VideoReferenceItem[]) =>+ patch({+ references,+ ...(references.length > 0 ? { firstFrameImage: null, lastFrameImage: null, sourceVideo: null } : {}),+ }),+ [patch]+ );+ const clearReferences = useCallback(() => patch({ references: [] }), [patch]);const setLoras = useCallback((loras: VideoWidgetValues['loras']) => {// Removing or disabling one of the accelerator's LoRAs breaks the fast@@ -304,6 +314,7 @@ export const VideoWidgetView = () => {const supportsFirstFrame = policy.modes.includes('first-frame') || policy.modes.includes('first-last');const supportsLastFrame = policy.modes.includes('first-last') || policy.modes.includes('last-frame');const supportsExtend = policy.modes.includes('extend');+ const supportsReferences = policy.modes.includes('reference');const hasConditioningMedia = Boolean(values.firstFrameImage || values.lastFrameImage || values.sourceVideo);const derivedSourceText = dimensions ? t(`widgets.video.dimensionSource.${dimensions.source}`) : undefined;const derivedSizeText = dimensions@@ -385,6 +396,22 @@ export const VideoWidgetView = () => {{!supportsExtend && values.sourceVideo ? (<StaleMediaStub label={t('widgets.video.staleSourceVideo')} onClear={clearSourceVideo} />) : null}+ {!supportsReferences && values.references.length > 0 ? (+ <StaleMediaStub label={t('widgets.video.staleReferences')} onClear={clearReferences} />+ ) : null}++ {supportsReferences ? (+ <GenerationSettingsSection label={t('widgets.video.references')} sectionId="video-references" defaultOpen>+ <Stack gap="3" p="2">+ <VideoReferenceListField+ maxImages={policy.references?.maxImages ?? 9}+ maxVideos={policy.references?.maxVideos ?? 3}+ references={values.references}+ onChange={setReferences}+ />+ </Stack>+ </GenerationSettingsSection>+ ) : null}{supportsExtend ? (<GenerationSettingsSection label={t('widgets.video.initialVideo')} sectionId="video-source" defaultOpen>diff --git a/invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts b/invokeai/frontend/webv2/src/features/video/ui/videoComparators.tsindex 9b4075fe23..c0fd556832 100644--- a/invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts+++ b/invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts@@ -52,6 +52,7 @@ export const areVideoValuesEqual = (left: VideoWidgetValues, right: VideoWidgetVareVideoLorasEquivalent(left.loras, right.loras) &&stableStringify(left.firstFrameImage) === stableStringify(right.firstFrameImage) &&stableStringify(left.lastFrameImage) === stableStringify(right.lastFrameImage) &&+ stableStringify(left.references) === stableStringify(right.references) &&stableStringify(left.sourceVideo) === stableStringify(right.sourceVideo) &&stableStringify(left.vae) === stableStringify(right.vae) &&stableStringify(left.wanT5EncoderModel) === stableStringify(right.wanT5EncoderModel) &&diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx b/invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsxindex 3cb36e7c27..111ae3f731 100644--- a/invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx+++ b/invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx@@ -381,9 +381,11 @@ const SingleItemMenuItems = ({}openWidget('video', { preferredRegions: ['left'] });- // An initial video and a first frame are mutually exclusive in the panel.+ // An initial video, a first frame, and Ref2VA references all claim the same+ // conditioning slot: extending clears the rivals.widgets.patchValues('video', {firstFrameImage: null,+ references: [],sourceVideo: createVideoSourceClip({durationSeconds: item.durationSeconds,fps: item.fps,@@ -730,9 +732,11 @@ const SingleImageMenuItems = ({}, [generation, image.height, image.imageName, image.width, openWidget, widgets]);const handleSendToVideo = useCallback(() => {openWidget('video', { preferredRegions: ['left'] });- // The first frame and an initial video are mutually exclusive in the panel.+ // The first frame, an initial video, and Ref2VA references all claim the same+ // conditioning slot: sending a frame clears the rivals.widgets.patchValues('video', {firstFrameImage: { height: image.height, image_name: image.imageName, width: image.width },+ references: [],sourceVideo: null,});generation.setSource('video');diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts b/invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.tsindex c88ccdd4b6..dc2fd251a2 100644--- a/invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts+++ b/invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts@@ -1,5 +1,6 @@import type { GalleryVideoItem } from '@features/gallery';import type { ModelConfig } from '@features/models';+import type { VideoReferenceItem } from '@features/video';import type { AccountScope } from '@platform/state/accountLifecycle';import type { WorkbenchCommands } from '@workbench/workbenchStore';@@ -183,6 +184,76 @@ export const executeVideoRecall = async ({}}+ if (result.mediaNames.references.length > 0) {+ // Ordered re-hydration: resolve every recorded reference against the gallery,+ // dropping deleted media while PRESERVING the survivors' order (order is part of+ // the request contract).+ const imageNames = result.mediaNames.references+ .filter((reference): reference is typeof reference & { kind: 'image' } => reference.kind === 'image')+ .map((reference) => reference.name);+ const resolvedImages =+ imageNames.length > 0 ? await galleryImages.resolveMany([...new Set(imageNames)], owner.signal) : [];++ assertAccountScopeCurrent(owner);+ const imagesByName = new Map(resolvedImages.map((image) => [image.imageName, image]));+ const references: VideoReferenceItem[] = [];++ for (const recorded of result.mediaNames.references) {+ if (recorded.kind === 'image') {+ const image = imagesByName.get(recorded.name);++ if (image) {+ references.push({+ detail: recorded.detail === 'match' ? 'match' : 'max',+ image: { height: image.height, image_name: image.imageName, width: image.width },+ kind: 'image',+ });+ }+ continue;+ }+ try {+ const item = await galleryItems.resolve({ kind: 'video', name: recorded.name }, owner.signal);++ assertAccountScopeCurrent(owner);+ if (item?.kind !== 'video') {+ continue;+ }+ const clip = createVideoSourceClip({+ durationSeconds: item.durationSeconds,+ fps: item.fps,+ height: item.height,+ name: item.name,+ width: item.width,+ });+ // Restore the recorded trim, clamped to the fresh frame-count estimate.+ const startFrame = recorded.trim ? Math.min(Math.max(recorded.trim.startFrame, 0), clip.numFrames - 1) : 0;+ const endFrame = recorded.trim+ ? Math.min(Math.max(recorded.trim.endFrame, startFrame), clip.numFrames - 1)+ : clip.numFrames - 1;+ const conditioning =+ recorded.conditioning === 'video' || recorded.conditioning === 'audio'+ ? recorded.conditioning+ : 'video_audio';++ references.push({ clip: { ...clip, endFrame, startFrame }, conditioning, kind: 'video' });+ } catch {+ assertAccountScopeCurrent(owner);+ // The reference video is gone; the rest of the recall still applies.+ }+ }++ if (references.length > 0) {+ result.values = {+ ...result.values,+ firstFrameImage: null,+ lastFrameImage: null,+ references,+ sourceVideo: null,+ };+ recalledMedia = true;+ }+ }+if (!recalledMedia) {result.fields = result.fields.filter((field) => field !== 'media');}@@ -198,6 +269,18 @@ export const executeVideoRecall = async ({if (effectiveModel) {const modes = getVideoModelPolicy(effectiveModel, result.values).modes;let { firstFrameImage, lastFrameImage, sourceVideo } = result.values;+ let references = result.values.references;++ if (references.length > 0 && !modes.includes('reference')) {+ // The recalled transformer (or the panel's surviving one) has no reference mode.+ references = [];+ }+ if (references.length > 0) {+ // References replace the frame/source slots entirely.+ firstFrameImage = null;+ lastFrameImage = null;+ sourceVideo = null;+ }if (sourceVideo && !modes.includes('extend')) {sourceVideo = null;@@ -217,9 +300,10 @@ export const executeVideoRecall = async ({if (firstFrameImage !== result.values.firstFrameImage ||lastFrameImage !== result.values.lastFrameImage ||- sourceVideo !== result.values.sourceVideo+ sourceVideo !== result.values.sourceVideo ||+ references !== result.values.references) {- result.values = { ...result.values, firstFrameImage, lastFrameImage, sourceVideo };+ result.values = { ...result.values, firstFrameImage, lastFrameImage, references, sourceVideo };}}}diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/galleryOptimisticRollback.ts b/invokeai/frontend/webv2/src/workbench/image-actions/galleryOptimisticRollback.tsindex bbd4026ce9..e3790d8309 100644--- a/invokeai/frontend/webv2/src/workbench/image-actions/galleryOptimisticRollback.ts+++ b/invokeai/frontend/webv2/src/workbench/image-actions/galleryOptimisticRollback.ts@@ -33,6 +33,7 @@ const TRACKED_GALLERY_REMOVAL_FIELDS: ReadonlyArray<{ key: string; widgetId: Wid{ key: 'inputImage', widgetId: 'upscale' },{ key: 'firstFrameImage', widgetId: 'video' },{ key: 'lastFrameImage', widgetId: 'video' },+ { key: 'references', widgetId: 'video' },{ key: 'sourceVideo', widgetId: 'video' },];@@ -47,7 +48,13 @@ const TRACKED_GALLERY_REMOVAL_FIELDS: ReadonlyArray<{ key: string; widgetId: Wid*/const EXCLUSIVE_RIVAL_FIELDS: ReadonlyArray<{ key: string; rivalKey: string; widgetId: WidgetTypeId }> = [{ key: 'firstFrameImage', rivalKey: 'sourceVideo', widgetId: 'video' },+ { key: 'firstFrameImage', rivalKey: 'references', widgetId: 'video' },+ { key: 'lastFrameImage', rivalKey: 'references', widgetId: 'video' },{ key: 'sourceVideo', rivalKey: 'firstFrameImage', widgetId: 'video' },+ { key: 'sourceVideo', rivalKey: 'references', widgetId: 'video' },+ { key: 'references', rivalKey: 'firstFrameImage', widgetId: 'video' },+ { key: 'references', rivalKey: 'lastFrameImage', widgetId: 'video' },+ { key: 'references', rivalKey: 'sourceVideo', widgetId: 'video' },];const trackedFieldKey = (projectId: string, widgetId: WidgetTypeId, key: string): string =>@@ -153,13 +160,20 @@ export const selectRestorableGalleryWidgetPatches = (liveEntries,(candidate) => getProjectWidgetValues(projectsById.get(candidate.projectId)!, candidate.widgetId)[candidate.key])) {- const rival = EXCLUSIVE_RIVAL_FIELDS.find((field) => field.widgetId === entry.widgetId && field.key === entry.key);- const isOccupied = (value: unknown): boolean => value !== null && value !== undefined;+ const rivals = EXCLUSIVE_RIVAL_FIELDS.filter(+ (field) => field.widgetId === entry.widgetId && field.key === entry.key+ );+ // An ordered-list slot (the video references) is "occupied" only when non-empty; a+ // nullable slot when non-null.+ const isOccupied = (value: unknown): boolean =>+ Array.isArray(value) ? value.length > 0 : value !== null && value !== undefined;if (- rival &&+ rivals.length > 0 &&isOccupied(entry.before) &&- isOccupied(getProjectWidgetValues(projectsById.get(entry.projectId)!, entry.widgetId)[rival.rivalKey])+ rivals.some((rival) =>+ isOccupied(getProjectWidgetValues(projectsById.get(entry.projectId)!, entry.widgetId)[rival.rivalKey])+ )) {continue;}diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.tsindex 4b120b4a85..c35dd8ef20 100644--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts@@ -258,6 +258,7 @@ describe('buildVideoRecallSettings', () => {expect(result?.mediaNames).toEqual({firstFrameName: 'first.png',lastFrameName: null,+ references: [],sourceVideoName: null,sourceVideoTrim: null,});@@ -379,3 +380,61 @@ describe('buildVideoRecallSettings', () => {).toBeNull();});});++describe('ref2va reference recall', () => {+ const catalog = [WAN_T2V, WAN_I2V, h3Model(), LIGHTNING_HIGH, LIGHTNING_LOW];+ const currentValues = { ...createDefaultVideoWidgetValues([h3Model()]) };+ const h3RefMetadata = (extra: Record<string, unknown> = {}): Record<string, unknown> => ({+ generation_mode: 'minimax_h3_ref2v',+ height: 768,+ minimax_h3_references: [+ { conditioning: 'video_audio', end_frame: 47, kind: 'video', start_frame: 2, video_name: 'ref.mp4' },+ { detail: 'match', image_name: 'ref.png', kind: 'image' },+ { kind: 'video' },+ ],+ model: { base: 'minimax-h3', key: 'h3-main', name: 'MiniMax H3', type: 'main' },+ num_frames: 124,+ positive_prompt: 'a red fox',+ seed: 7,+ steps: 4,+ width: 1344,+ ...extra,+ });++ it('recognizes the ref2v generation mode as video metadata', () => {+ expect(isVideoGenerationMetadata({ generation_mode: 'minimax_h3_ref2v' })).toBe(true);+ });++ it('reports the ordered references, tolerantly skipping malformed entries', () => {+ const result = buildVideoRecallSettings({+ currentValues,+ kind: 'all',+ metadata: h3RefMetadata(),+ models: catalog,+ });++ expect(result?.fields).toContain('media');+ expect(result?.mediaNames.references).toEqual([+ { conditioning: 'video_audio', kind: 'video', name: 'ref.mp4', trim: { endFrame: 47, startFrame: 2 } },+ { detail: 'match', kind: 'image', name: 'ref.png' },+ ]);+ // References replace the frame/source slots.+ expect(result?.mediaNames.firstFrameName).toBeNull();+ expect(result?.values.references).toEqual([]);+ });++ it("clears the panel's held media so the executor re-hydrates references on a clean slate", () => {+ const holding = {+ ...currentValues,+ firstFrameImage: { height: 4, image_name: 'held.png', width: 4 },+ };+ const result = buildVideoRecallSettings({+ currentValues: holding,+ kind: 'all',+ metadata: h3RefMetadata(),+ models: catalog,+ });++ expect(result?.values.firstFrameImage).toBeNull();+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.tsindex 14a503eb95..9259b1b0bc 100644--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts@@ -14,6 +14,7 @@ import {getVideoAspectRatioOptions,getVideoDimensions,getVideoModelPolicy,+ resolveEffectiveVideoModel,getVideoModelSelectionResult,getVideoTargetResolutionOptions,isSupportedVideoModel,@@ -42,6 +43,7 @@ const VIDEO_GENERATION_MODE_IDS: ReadonlySet<string> = new Set(['minimax_h3_lf2v','minimax_h3_flf2v','minimax_h3_extend_video',+ 'minimax_h3_ref2v',]);export type VideoRecallKind = 'all' | 'remix' | 'prompts' | 'seed';@@ -279,6 +281,11 @@ export const deriveAcceleratorRecallState = (steps: number,settings: VideoWidgetValues): Pick<VideoWidgetValues, 'acceleratorEnabled' | 'acceleratorLoraKeys'> => {+ // The H3 task variant lives on the recalled transformer override, and the two tasks have+ // DIFFERENT accelerators (fl2va Turbo at 6 steps, ref2v Turbo at 4) - so both the policy+ // and the expected-LoRA lookup must go through the effective model. Callers must recall+ // the component overrides into `settings` before deriving this.+ const effectiveModel = resolveEffectiveVideoModel(model, settings);const accelerator = getVideoModelPolicy(model, settings).ui.accelerator;if (!accelerator || steps !== accelerator.steps) {@@ -286,10 +293,12 @@ export const deriveAcceleratorRecallState = (}const expected =- model.base === 'minimax-h3'- ? [findMiniMaxH3TurboLora(models)].flatMap((lora) => (lora ? [lora.key] : []))+ effectiveModel.base === 'minimax-h3'+ ? [+ findMiniMaxH3TurboLora(models, typeof effectiveModel.variant === 'string' ? effectiveModel.variant : 'fl2va'),+ ].flatMap((lora) => (lora ? [lora.key] : [])): (() => {- const pair = findWanLightningLoraPair(models, model.variant);+ const pair = findWanLightningLoraPair(models, effectiveModel.variant);return pair ? [pair.high.key, pair.low.key] : [];})();@@ -342,8 +351,53 @@ export interface VideoRecallMediaNames {* without them a recalled extension would start from the wrong frame.*/sourceVideoTrim: { endFrame: number; startFrame: number } | null;+ /**+ * The recorded Ref2VA references, in conditioning order. Names and options only — the+ * executor re-resolves each against the gallery and drops missing media, preserving order.+ */+ references: VideoRecallReferenceName[];}+export type VideoRecallReferenceName =+ | { kind: 'image'; name: string; detail: string | null }+ | { kind: 'video'; name: string; conditioning: string | null; trim: { endFrame: number; startFrame: number } | null };++/** Tolerant parser for the `minimax_h3_references` metadata extra: skips malformed entries, keeps order. */+const getRecallableReferences = (metadata: unknown): VideoRecallReferenceName[] => {+ if (!isRecord(metadata) || !Array.isArray(metadata.minimax_h3_references)) {+ return [];+ }++ // Cap at the request maximum (3 videos + 9 images): corrupt metadata must not drive an+ // unbounded chain of gallery resolves in the executor.+ return metadata.minimax_h3_references.slice(0, 12).flatMap((entry): VideoRecallReferenceName[] => {+ if (!isRecord(entry)) {+ return [];+ }+ if (entry.kind === 'image' && typeof entry.image_name === 'string') {+ return [+ { detail: typeof entry.detail === 'string' ? entry.detail : null, kind: 'image', name: entry.image_name },+ ];+ }+ if (entry.kind === 'video' && typeof entry.video_name === 'string') {+ const startFrame =+ typeof entry.start_frame === 'number' && Number.isInteger(entry.start_frame) ? entry.start_frame : null;+ const endFrame =+ typeof entry.end_frame === 'number' && Number.isInteger(entry.end_frame) ? entry.end_frame : null;++ return [+ {+ conditioning: typeof entry.conditioning === 'string' ? entry.conditioning : null,+ kind: 'video',+ name: entry.video_name,+ trim: startFrame !== null && endFrame !== null ? { endFrame, startFrame } : null,+ },+ ];+ }+ return [];+ });+};+export const buildVideoRecallSettings = ({currentValues,kind,@@ -365,6 +419,7 @@ export const buildVideoRecallSettings = ({const mediaNames: VideoRecallMediaNames = {firstFrameName: null,lastFrameName: null,+ references: [],sourceVideoName: null,sourceVideoTrim: null,};@@ -481,27 +536,8 @@ export const buildVideoRecallSettings = ({fields.push('size');}- const recordedLoras = getMetadataLoras(metadata);- const resolvedLoras = recordedLoras.flatMap((entry) => {- const installed = models.find((candidate) => candidate.key === entry.key);-- return installed && isLoraModelConfig(installed) && isLoraCompatibleWithModel(installed, model)- ? [{ isEnabled: true, model: installed as LoraModelConfig, weight: entry.weight }]- : [];- });-- // The recall reproduces the recorded LoRA set: empty when the video ran- // without LoRAs, and also when the recorded ones are no longer installed —- // keeping the panel's current LoRAs would misrepresent the run either way.- if (resolvedLoras.length > 0 || values.loras.length > 0) {- values = {- ...values,- loras: resolvedLoras,- ...deriveAcceleratorRecallState(model, models, resolvedLoras, values.steps, values),- };- fields.push('loras');- }-+ // Components recall FIRST: the accelerator derivation below resolves the H3 task off the+ // recalled transformer override, so `values` must already hold it.let componentsRecalled = false;for (const [metadataKey, valuesKey] of VIDEO_COMPONENT_METADATA_KEYS) {@@ -523,20 +559,51 @@ export const buildVideoRecallSettings = ({fields.push('components');}+ const recordedLoras = getMetadataLoras(metadata);+ const resolvedLoras = recordedLoras.flatMap((entry) => {+ const installed = models.find((candidate) => candidate.key === entry.key);++ return installed && isLoraModelConfig(installed) && isLoraCompatibleWithModel(installed, model)+ ? [{ isEnabled: true, model: installed as LoraModelConfig, weight: entry.weight }]+ : [];+ });++ // The recall reproduces the recorded LoRA set: empty when the video ran+ // without LoRAs, and also when the recorded ones are no longer installed —+ // keeping the panel's current LoRAs would misrepresent the run either way.+ if (resolvedLoras.length > 0 || values.loras.length > 0) {+ values = {+ ...values,+ loras: resolvedLoras,+ ...deriveAcceleratorRecallState(model, models, resolvedLoras, values.steps, values),+ };+ fields.push('loras');+ }+const media = getRecallableMediaNames(metadata);+ const references = getRecallableReferences(metadata);// Judged against the ORIGINAL panel state: the model transition above may// already have cleared media the new family cannot consume, and that change// is still part of what this recall did.- const hadMedia = Boolean(currentValues.firstFrameImage || currentValues.lastFrameImage || currentValues.sourceVideo);-- // Media selects the graph family (t2v vs i2v vs extend), so an all/remix+ const hadMedia = Boolean(+ currentValues.firstFrameImage ||+ currentValues.lastFrameImage ||+ currentValues.sourceVideo ||+ currentValues.references.length > 0+ );++ // Media selects the graph family (t2v vs i2v vs extend vs reference), so an all/remix// recall must reproduce the recorded media EXACTLY: whatever the panel held// is cleared, and the executor re-hydrates the recorded names on top.if (hadMedia) {- values = { ...values, firstFrameImage: null, lastFrameImage: null, sourceVideo: null };+ values = { ...values, firstFrameImage: null, lastFrameImage: null, references: [], sourceVideo: null };}- if (media.firstFrameName || media.lastFrameName || media.sourceVideoName) {+ if (references.length > 0) {+ // References replace every frame/source slot — the modes are mutually exclusive.+ mediaNames.references = references;+ fields.push('media');+ } else if (media.firstFrameName || media.lastFrameName || media.sourceVideoName) {mediaNames.firstFrameName = media.firstFrameName;mediaNames.lastFrameName = media.lastFrameName;mediaNames.sourceVideoName = media.sourceVideoName;diff --git a/tests/app/services/workflow_records/test_default_workflows_registry.py b/tests/app/services/workflow_records/test_default_workflows_registry.pyindex 76a96b652d..6baa9d6706 100644--- a/tests/app/services/workflow_records/test_default_workflows_registry.py+++ b/tests/app/services/workflow_records/test_default_workflows_registry.py@@ -26,8 +26,8 @@ WAN_WORKFLOWS = sorted(def test_wan_workflow_glob_finds_the_bundled_workflows() -> None:# Guard against the glob silently matching nothing (e.g. after a rename).- # 12 Wan workflows + 5 MiniMax H3 video workflows.- assert len(WAN_WORKFLOWS) == 17+ # 12 Wan workflows + 6 MiniMax H3 video workflows.+ assert len(WAN_WORKFLOWS) == 18@pytest.mark.parametrize("workflow_path", WAN_WORKFLOWS, ids=lambda p: p.stem)