Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Upscale: Open-H3 Regenerate as an open model, with its draft preset, 15 s parts and licences

Claude146e9b315c1d
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index 515627c7..bb4f8535 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -5,6 +5,7 @@ import { loraEntry, loraRef } from "./loras";
import { ANGLES_LORA, MOSAIC_SCALE, MOSAIC_TARGET, SPEAK_GRAPH, SPEAK_LORA, SPEAK_PROMPT } from "./open-tools";
import { CINEMA_CROP, SOUL_ASPECTS, SOUL_TIERS } from "./soul";
import { RESTORE, offlineRestorePrompt } from "./restore";
+import { REGEN_DEFAULT_TIER, REGEN_MODEL, REGEN_TIERS, REGEN_WORKFLOW } from "./regenerate";
import { denoiseFor, EVOLUTION, EVOLUTION_DEFAULT_RESOLUTION, EVOLUTION_RESOLUTIONS, INTENSITIES, type Intensity } from "./evolution";
import { LAST_FRAME_CHAIN, type ModelDef, type ModelOptions, type ModelRoute, type Operation } from "./types";
@@ -708,6 +709,43 @@ const open: ModelDef[] = [
options: { seed: true, resolutions: VIDEO_UPSCALE_TIERS },
defaults: { resolution: "1080p" },
}),
+ // Open-H3 Regenerate 2K (docs/research/new-models-7.md §2): the creative finishing step beside SeedVR2's faithful one. It
+ // redraws the clip at 1080p / 2K / 4K from its words (src/lib/catalog/regenerate.ts); GPU-only, nobody hosts it.
+ o({
+ id: REGEN_MODEL,
+ name: "Open-H3 Regenerate",
+ vendor: "NVIDIA",
+ family: "minimax-h3",
+ kind: "video",
+ tagline: "Redraws a soft clip at 1080p, 2K or 4K. Details may change; motion and layout stay.",
+ badges: ["new", "4k", "audio"],
+ routes: [comfy("upscale-video", REGEN_WORKFLOW, "MiniMax H3 with NVIDIA's refiner LoRA: 3 steps from the clip at 24 fps, up to 15 s a pass, its sound kept")],
+ options: {
+ seed: true,
+ resolutions: [...REGEN_TIERS],
+ requires: { prompt: true, msg: "Regenerate redraws the clip from words: describe what is in it" },
+ controls: [
+ {
+ param: "creativity",
+ label: "Creativity",
+ values: ["close", "balanced", "detail"],
+ default: "balanced",
+ labels: { close: "Close to the clip", balanced: "Balanced", detail: "More detail" },
+ // The refine's start noise: 0 is the release grid (0.909), which redraws the most.
+ sets: { close: { startSigma: 0.7 }, balanced: { startSigma: 0.8 }, detail: { startSigma: 0 } },
+ },
+ {
+ param: "speed",
+ label: "Speed",
+ values: ["standard", "faster"],
+ default: "standard",
+ labels: { standard: "Standard · 3 steps", faster: "Faster · 2 steps, softer texture" },
+ sets: { standard: { steps: 3 }, faster: { steps: 2 } },
+ },
+ ],
+ },
+ defaults: { resolution: REGEN_DEFAULT_TIER },
+ }),
o({
id: "oss-upscale-video-esrgan",
name: "ESRGAN video upscale",
diff --git a/src/lib/catalog/regenerate.ts b/src/lib/catalog/regenerate.ts
new file mode 100644
index 00000000..f6084df6
--- /dev/null
+++ b/src/lib/catalog/regenerate.ts
@@ -0,0 +1,208 @@
+/**
+ * Open-H3 Regenerate 2K (docs/research/new-models-7.md §2): NVIDIA's open refiner for MiniMax H3, a finishing step that
+ * redraws a soft clip at 1080p, 2K or 4K. Pure: the ModelDef's settings, the graph's strings, the 15 s windows a longer
+ * clip runs in, the draft preset by source, the copy, the licences as information, and the cloud's re-render of a fal H3
+ * result at 2K (the same hosted model asked for a size it offers, never a stand-in for the open model).
+ *
+ * Nobody hosts the open model, so Regenerate · creative is GPU-only: the cloud engine says it runs on your GPU, and
+ * Engine mode "Paid APIs only" hides it (the owner's rule of 10-30).
+ */
+import type { Generation, GenerationRequest, LoraRef } from "./types";
+
+export const REGEN_MODEL = "oss-h3-regenerate";
+export const REGEN_WORKFLOW = "video-regenerate-h3";
+/** Upscale → Video's restore model, shown beside Regenerate. */
+export const RESTORE_MODEL = "oss-seedvr2";
+
+/** The output tiers (the result's shorter edge, as Upscale → Video names them) and the default, 2K. */
+export const REGEN_TIERS = ["1080p", "1440p", "2160p"] as const;
+export const REGEN_DEFAULT_TIER = "1440p";
+
+/** A tier as OpenH3RegenUpscale's combo names it (copied from the pack's INPUT_TYPES at 9b686c5). */
+export const REGEN_RESOLUTION: Record<(typeof REGEN_TIERS)[number], string> = {
+ "1080p": "1080p (1920x1080)",
+ "1440p": "2k (2560x1440)",
+ "2160p": "4k (3840x2160)",
+};
+
+/** The pack's resolution string for a tier ("2k (2560x1440)" for anything it doesn't know). */
+export function regenResolution(tier: string | undefined): string {
+ return REGEN_RESOLUTION[(tier ?? REGEN_DEFAULT_TIER) as keyof typeof REGEN_RESOLUTION] ?? REGEN_RESOLUTION[REGEN_DEFAULT_TIER];
+}
+
+/** OpenH3RegenPrepareDraft's sizes (the pack's SIZES). */
+export const REGEN_DRAFT = { h3: "768p (1344x768)", other: "576p (1024x576)", keep: "keep (snap to 32)" } as const;
+
+/** Models whose clips are H3 drafts (the refiner was trained on them): MiniMax H3 in any form, and the Character swaps. */
+export function isH3Source(modelId: string | undefined): boolean {
+ return !!modelId && /(^|-)(h3|hailuo)(-|$)|minimax-h3|character-swap/.test(modelId);
+}
+
+/**
+ * The draft preset (NVIDIA's reference: 768p for H3 drafts, 576p for other models). The pack turns a preset for a
+ * portrait clip itself (768 x 1344), so 16:9 and 9:16 take the preset; any other shape (square, 4:3, 21:9) keeps its
+ * own on the 32-pixel grid rather than being cropped to 16:9. An unknown shape takes the preset.
+ */
+export function draftSizeFor(o: { fromH3: boolean; width?: number; height?: number }): string {
+ const { width, height } = o;
+ if (width && height) {
+ const r = Math.max(width, height) / Math.min(width, height);
+ if (Math.abs(r - 16 / 9) > 0.06) return REGEN_DRAFT.keep;
+ }
+ return o.fromH3 ? REGEN_DRAFT.h3 : REGEN_DRAFT.other;
+}
+
+/** The refine runs at 24 fps, up to 360 frames (15 s) a pass. */
+export const REGEN_FPS = 24;
+export const REGEN_MAX_FRAMES = 360;
+export const REGEN_WINDOW_SECONDS = 15;
+
+/**
+ * The frames one pass reads: the clip's seconds at 24 fps, at most 360. Unknown length: 360 (Prepare Draft reads at most
+ * the frames the clip has, so a shorter clip is read whole).
+ */
+export function regenFrames(seconds: number | undefined): number {
+ if (!seconds || !(seconds > 0)) return REGEN_MAX_FRAMES;
+ return Math.max(5, Math.min(REGEN_MAX_FRAMES, Math.round(seconds * REGEN_FPS)));
+}
+
+/**
+ * The windows a clip is regenerated in: one pass up to 15 s; a longer clip in equal parts of at most 15 s each (20 s
+ * → 2 × 10 s, 40 s → 3 × 13.3 s), so no part is a sliver. Each is its own run, then they are joined packet by packet.
+ */
+export function regenWindows(seconds: number | undefined): { start: number; duration: number }[] {
+ if (!seconds || !(seconds > REGEN_WINDOW_SECONDS + 0.05)) return [{ start: 0, duration: seconds && seconds > 0 ? seconds : 0 }];
+ const n = Math.ceil(seconds / REGEN_WINDOW_SECONDS);
+ const len = seconds / n;
+ return Array.from({ length: n }, (_, i) => ({ start: Math.round(i * len * 1000) / 1000, duration: Math.round(len * 1000) / 1000 }));
+}
+
+export const REGEN_SEAM_NOTE =
+ "Open-H3 Regenerate redraws up to 15 s at a time, so this clip is redrawn in parts and joined: the parts don't share history, so a seam or a small jump in detail can show where they meet";
+
+// ---------------------------------------------------------------------------
+// Copy
+
+export const REGEN_COPY = {
+ creative: "Regenerate · creative: redraws your clip at 2K. Details may change; motion and layout stay.",
+ faithful: "Restore · faithful: keeps every detail and sharpens it.",
+ gpu: "About 3 minutes per 5 s at 2K on a 72 GB GPU. Needs about 40 GB of new files (OPEN_H3_REGEN=1 in install-comfyui.sh).",
+ missing: "Your ComfyUI is missing the Open-H3 Regenerate nodes: run scripts/comfy/install-comfyui.sh with OPEN_H3_REGEN=1.",
+ gpuOnly: "Runs on your GPU (open source)",
+ gpuOnlyWhy: "Runs on your GPU (open source): nobody hosts Open-H3 Regenerate in the cloud",
+ prompt: "Describe the clip: what is in it, how it moves, the light. Regenerate redraws it from these words",
+} as const;
+
+/** The two finishing choices Upscale → Video shows side by side on the open engine. */
+export const FINISH_CHOICES = [
+ { modelId: RESTORE_MODEL, label: "Restore · faithful", hint: "Keeps every detail and sharpens it." },
+ { modelId: REGEN_MODEL, label: "Regenerate · creative", hint: "Redraws your clip at 2K. Details may change; motion and layout stay." },
+] as const;
+
+// ---------------------------------------------------------------------------
+// Files and licences (information for Settings → Models & licences, never a gate)
+
+const H3_TERMS =
+ 'MiniMax H3 Community License: granted outside the US, the EU, the UK and the Republic of Korea; written authorization above US$20M yearly revenue; show "MiniMax H3" on a commercial product\'s interface. Comfy\'s docs add that commercial use of locally made outputs needs a MiniMax licence';
+
+/** NVIDIA's merged refiner LoRA (refiner + LightX2V Turbo v1.2 + LMS Sharp), which the graph loads itself. */
+export const REGEN_LORA: LoraRef = {
+ file: "open_h3_regenerate_2k_lora.safetensors",
+ url: "https://huggingface.co/Efficient-Large-Model/Open-H3-Regenerate-2K/resolve/5809c33730c18b6b1c827b40974855a4288641b3/lora/open_h3_regenerate_2k_lora.safetensors",
+ version: "5809c33730c18b6b1c827b40974855a4288641b3",
+ licence: { commercial: true, hostedOk: true, snapshotDate: "2026-10-29", name: "MiniMax H3 Community License" },
+};
+
+/** The LoRA files a Regenerate graph loads itself, so a run downloads the ones ComfyUI lacks before it starts. */
+export function regenerateGraphLoras(endpoint: string): LoraRef[] {
+ return endpoint === REGEN_WORKFLOW ? [REGEN_LORA] : [];
+}
+
+/** The new files and their licences, as the research recorded them (§2.4, §2.5). */
+export const REGEN_FILES: { file: string; item: string; sizeGb: number; licence: string; note: string }[] = [
+ {
+ file: REGEN_LORA.file,
+ item: "Open-H3-Regenerate-2K LoRA (NVIDIA)",
+ sizeGb: 12.45,
+ licence: "MiniMax H3 Community License",
+ note: `${H3_TERMS}. The merged LightX2V Turbo v1.2 part is Apache-2.0 (at 3ec17a3); the LMS Sharp part has no stated licence`,
+ },
+ { file: "fast_h3_vae_noncausal_24l.safetensors", item: "Fast H3 VAE decoder (NVIDIA StreamRender-H3)", sizeGb: 6.47, licence: "MiniMax H3 Community License", note: `A distilled Model Derivative. ${H3_TERMS}` },
+ { file: "minimax_h3_fl2va_pruned_int8_convrot.safetensors", item: "MiniMax H3 FL2VA (pruned int8, Comfy-Org)", sizeGb: 20.97, licence: "MiniMax H3 Community License", note: H3_TERMS },
+ {
+ file: "minimax_h3_latent_upscaler_3d_conv_v1_bf16.safetensors",
+ item: "H3 latent upscaler (LBH-123-AI)",
+ sizeGb: 0.69,
+ licence: "Apache-2.0",
+ note: "Weights Apache-2.0 (LBH's model card; NVIDIA's copy ships the Apache text); LBH's node code is MIT",
+ },
+];
+
+// ---------------------------------------------------------------------------
+// Result actions
+
+/** Model families whose clips get "Regenerate in 2K" among the next steps under a fresh result. */
+export function regenerateFamily(modelId: string): "h3" | "ltx" | "wan" | "sana" | null {
+ if (isH3Source(modelId)) return "h3";
+ if (/ltx/.test(modelId)) return "ltx";
+ if (/(^|-)wan(\d|-|$)/.test(modelId)) return "wan";
+ if (/sana/.test(modelId)) return "sana";
+ return null;
+}
+
+/** The longest prompt a hand-off link carries (the composer shows it to edit; Regenerate needs words). */
+const HANDOFF_PROMPT = 1500;
+
+/** Upscale → Video on Regenerate, at 2K, with the clip and its own words (when it has some). */
+export function regenerateHref(video: string, prompt?: string | null): string {
+ const words = prompt?.trim().slice(0, HANDOFF_PROMPT);
+ return `/upscale/video?video=${encodeURIComponent(video)}&model=${REGEN_MODEL}&resolution=${REGEN_DEFAULT_TIER}${words ? `&prompt=${encodeURIComponent(words)}` : ""}`;
+}
+
+/**
+ * fal's hosted MiniMax H3 results the cloud can render again at 2K or 4K: the same endpoint, inputs and seed with a size
+ * it offers. A new render (fal makes 2K and 4K from a 768P base), not a sharpened copy, and priced per second.
+ */
+export const RERENDER: Record<string, { label: string; perSecond: Record<"2K" | "4K", number> }> = {
+ "minimax-h3": { label: "MiniMax H3", perSecond: { "2K": 0.13, "4K": 0.16 } },
+ "fuobe-character-swap": { label: "the Character swap (MiniMax H3 with LoRAs)", perSecond: { "2K": 0.1625, "4K": 0.2 } },
+};
+
+/** A cloud result that can be re-rendered at 2K: a finished fal H3 run whose inputs are in its request. */
+export function canRerender(g: Pick<Generation, "engine" | "provider" | "modelId" | "status" | "request" | "kind">): boolean {
+ return g.kind === "video" && g.status === "succeeded" && g.engine === "cloud" && g.provider === "fal" && !!RERENDER[g.modelId] && !g.request.chain?.length;
+}
+
+/** $0.13, $0.1625, $0.20: cents always, more places only when the price has them. */
+const money = (n: number) => `$${n.toFixed(4).replace(/0{1,2}$/, "")}`;
+
+/** "Re-render at 2K · a new render · $0.13/s". */
+export function rerenderLabel(modelId: string, size: "2K" | "4K" = "2K"): string {
+ const r = RERENDER[modelId];
+ return `Re-render at ${size} · a new render${r ? ` · ${money(r.perSecond[size])}/s` : ""}`;
+}
+
+/** The seed a result was made with: the one the provider reported, else the request's. */
+function seedOf(g: Pick<Generation, "request" | "outputs">): number | undefined {
+ const reported = g.outputs.find((o) => typeof o.meta?.seed === "number")?.meta?.seed as number | undefined;
+ const asked = g.request.params?.seed;
+ return reported ?? (asked !== undefined && asked >= 0 ? asked : undefined);
+}
+
+/** The request that renders a fal H3 result again at 2K (or 4K): the same model, operation, inputs, words and seed. */
+export function rerenderRequest(g: Pick<Generation, "request" | "outputs" | "modelId" | "op" | "feature">, size: "2K" | "4K" = "2K"): GenerationRequest {
+ const r = g.request;
+ const seed = seedOf(g);
+ return {
+ feature: r.feature ?? g.feature,
+ modelId: g.modelId,
+ op: r.op ?? g.op,
+ engine: "cloud",
+ ...(r.prompt !== undefined && { prompt: r.prompt }),
+ ...(r.negativePrompt && { negativePrompt: r.negativePrompt }),
+ ...(r.inputs && { inputs: r.inputs }),
+ ...(r.loras?.length && { loras: r.loras }),
+ ...(r.presetId && { presetId: r.presetId }),
+ params: { ...r.params, resolution: size, numOutputs: 1, ...(seed !== undefined && { seed }) },
+ };
+}
diff --git a/src/lib/licences.ts b/src/lib/licences.ts
index 82e8f11f..a505d5f4 100644
--- a/src/lib/licences.ts
+++ b/src/lib/licences.ts
@@ -495,6 +495,19 @@ export const NODE_PACKS: NodePack[] = [
url: SPDX("MIT"),
note: "PlagueKind's H3 SLA attention (needs Triton) and AdaLN LoRA fix for MiniMax H3; MIT code",
}),
+ // Open-H3 Regenerate 2K (Upscale → Video's Regenerate · creative), opt-in in install-comfyui.sh (OPEN_H3_REGEN=1).
+ pack("ComfyUI-Open-H3-Regenerate", "https://github.com/rdh9616/ComfyUI-Open-H3-Regenerate/tree/9b686c5ffd380e9d1351f9b8beef6d20d703ca3e", {
+ name: "Apache-2.0",
+ class: "commercial",
+ url: SPDX("Apache-2.0"),
+ note: "rdh9616's Open-H3 Regenerate nodes (NVIDIA's refine recipe, with NVIDIA's fast H3 VAE decoder vendored); Apache-2.0 code with a NOTICE file. The MiniMax H3 weights and the refiner LoRA it runs leave out the US, the EU, the UK and South Korea",
+ }),
+ pack("Comfyui_Minimax_h3_latent_Upscaler", "https://github.com/LBH-123-AI/Comfyui_Minimax_h3_latent_Upscaler/tree/40316cf008b2fd8663263270669eb4da23f89d2c", {
+ name: "MIT",
+ class: "commercial",
+ url: SPDX("MIT"),
+ note: "LBH-123-AI's H3 latent upscaler nodes (the Open-H3 Regenerate nodes call them by name); MIT code, copyright (c) 2026 LBH-123-AI. Its upscaler weights are Apache-2.0",
+ }),
];
export const nodePack = (name: string): NodePack | undefined => NODE_PACKS.find((p) => p.name === name);
diff --git a/src/server/generations.ts b/src/server/generations.ts
index ed5101d0..69f2f546 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -51,7 +51,9 @@ import { listElements } from "./elements";
import { markStale } from "./gpu/snapshots";
import { BLOCKED_CARD_MESSAGE, looksBlocked } from "./safety-card";
import { pollTrainings } from "./training";
-import { createExtendChain, createKeyframeFilm, createMosaicRun, createRelitClip, createShotFilm, createStillTo3d } from "./chains";
+import { createExtendChain, createKeyframeFilm, createMosaicRun, createRelitClip, createShotFilm, createStillTo3d, joinClips } from "./chains";
+import { createRegenerateRun } from "./regenerate";
+import { REGEN_MODEL, regenerateGraphLoras } from "@/lib/catalog/regenerate";
import { enhancePrompt, enhanceSoulWords, ideogramCaption } from "./enhance";
import { carriesLayout } from "@/lib/layout-prompt";
import { setResolver, watchGenerations, type LiveEvent } from "./live";
@@ -736,7 +738,7 @@ function prepare(original: GenerationRequest) {
}
/** The LoRA files a graph loads itself (not injected), so a run downloads the ones ComfyUI lacks before it starts. */
-const graphLoras = (endpoint: string, extra: Record<string, unknown> | undefined) => [...h3GraphLoras(endpoint, extra), ...restoreGraphLoras(endpoint, extra)];
+const graphLoras = (endpoint: string, extra: Record<string, unknown> | undefined) => [...h3GraphLoras(endpoint, extra), ...restoreGraphLoras(endpoint, extra), ...regenerateGraphLoras(endpoint)];
/** Operations whose clip length is the duration picked (made, or added by extend), not an input video's. */
const MADE_LENGTH_OPS = new Set<Operation>(["t2v", "i2v", "flf2v", "ref2v", "extend", "keyframes"]);
@@ -855,6 +857,11 @@ export function createGenerations(given: GenerationRequest, opts: CreateOptions
const waitsFor = opts.dependsOn === undefined ? undefined : Array.isArray(opts.dependsOn) ? opts.dependsOn : [opts.dependsOn];
return createMosaicRun(original, shotModel, { batchId: opts.batchId, dependsOn: waitsFor });
}
+ // Open-H3 Regenerate: the draft preset from the clip's maker, and a clip over 15 s in 15 s parts joined (regenerate.ts).
+ if (shotModel?.id === REGEN_MODEL) {
+ const run = createRegenerateRun(original, shotModel, opts, createGenerations, joinClips, (id) => void cancelGeneration(id));
+ if (run) return run;
+ }
const deps = opts.dependsOn === undefined ? [] : Array.isArray(opts.dependsOn) ? opts.dependsOn : [opts.dependsOn];
const waits = deps.length > 0;
// A dependent job can't be planned until its inputs exist; it's validated with placeholders, then launched by the runner.
diff --git a/src/server/model-access.ts b/src/server/model-access.ts
index ac43ea72..43f47ea2 100644
--- a/src/server/model-access.ts
+++ b/src/server/model-access.ts
@@ -1,6 +1,7 @@
import "server-only";
import { getPreset, MODELS } from "@/lib/catalog";
-import { CHARACTER_LORAS, characterLora } from "@/lib/catalog/character-swap";
+import { CHARACTER_LORAS, characterLora, MINIMAX_H3_LICENCE } from "@/lib/catalog/character-swap";
+import { REGEN_FILES, REGEN_LORA } from "@/lib/catalog/regenerate";
import { onEngine, providerEngine } from "@/lib/catalog/engines";
import { LORA_LIBRARY, MOTION_EFFECT_LORAS } from "@/lib/catalog/lora-library.generated";
import { libraryEntry, loraName } from "@/lib/catalog/loras";
@@ -248,10 +249,17 @@ export function loraLicence(l: Pick<LoraRef, "file" | "url" | "licence">): Licen
// The Character swap's LoRAs carry MiniMax H3's own terms (restricted regions), or Turbo's Apache-2.0.
const h3 = characterLora(l.file);
if (h3) return characterLoraLicence(h3);
+ if (l.file === REGEN_LORA.file) return regenLoraLicence();
const e = libraryEntry(l);
return loraLicenceInfo(l.licence ?? e?.licence, e?.page);
}
+/** Open-H3 Regenerate's merged LoRA: MiniMax H3's terms (restricted regions), with what its merged parts carry. */
+function regenLoraLicence(): LicenceInfo {
+ const { name, class: cls, url, excludes, notices } = MINIMAX_H3_LICENCE;
+ return { name, class: cls, url: modelCardOf(REGEN_LORA.url) ?? url, note: REGEN_FILES[0].note, ...(excludes && { excludes }), ...(notices?.length && { notices }) };
+}
+
/** A Character swap LoRA's licence as the list shows it (its own recorded terms, its pinned model card). */
function characterLoraLicence(l: (typeof CHARACTER_LORAS)[number]): LicenceInfo {
const { name, class: cls, url, excludes, notices, note } = l.licence;
@@ -347,6 +355,8 @@ function loraRows(access: ModelAccess): LoraInfo[] {
}
// The LoRAs the Character swap's graphs load (and fal's route takes): Akatz Labs' swap LoRA and lightx2v's Turbo.
for (const l of CHARACTER_LORAS) rows.push({ file: l.file, name: l.name, group: "adapter", base: "MiniMax H3", licence: characterLoraLicence(l), on: !access.loras.includes(l.file) });
+ // The refiner LoRA Open-H3 Regenerate's graph loads (and a run downloads).
+ rows.push({ file: REGEN_LORA.file, name: REGEN_FILES[0].item, group: "adapter", base: "MiniMax H3", licence: regenLoraLicence(), on: !access.loras.includes(REGEN_LORA.file) });
return rows;
}
@@ -363,7 +373,7 @@ export function knownSwitch(kind: "model" | "provider" | "pack" | "lora", id: st
case "pack":
return NODE_PACKS.some((p) => p.name === id);
case "lora":
- return LORA_LIBRARY.some((e) => e.file === id) || Object.values(OSS_LORAS).some((refs) => refs.some((r) => r.file === id)) || !!characterLora(id);
+ return LORA_LIBRARY.some((e) => e.file === id) || Object.values(OSS_LORAS).some((refs) => refs.some((r) => r.file === id)) || !!characterLora(id) || id === REGEN_LORA.file;
}
}
diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.ts
index d8cc45ab..cc89c46e 100644
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@ -40,6 +40,7 @@ import {
import { fpsPlan } from "@/lib/av/fps";
import { resolveWorkflowId } from "@/lib/comfy-variants";
import { h3Canvas, h3Frames, isH3Graph } from "@/lib/h3-prompt";
+import { draftSizeFor, REGEN_COPY, REGEN_WORKFLOW, regenFrames, regenResolution } from "@/lib/catalog/regenerate";
import { fixFromPromptError } from "@/lib/gpu/fix-codes";
import { loadIndex } from "../gpu/index-file";
import { crossfadeProblem, fadeCurveWav } from "@/lib/av/crossfade";
@@ -1205,6 +1206,17 @@ export async function prepareWorkflow(endpointTemplate: string, input: GenInput,
// Video finishing (Upscale hub): export formats, HDR curves, FPS Boost's m / n, chunked upscaling.
const finish = videoFinishValues(manifest, input, clip, extra);
Object.assign(values, finish.values);
+ // Open-H3 Regenerate (video-regenerate-h3): the output size and the draft preset as the pack's strings, and the frames
+ // this pass reads (its seconds at 24 fps, at most 15 s); the words are what it redraws from (regenerate.ts).
+ if (manifest.id === REGEN_WORKFLOW) {
+ if (!(typeof values.prompt === "string" && values.prompt.trim())) throw new ProviderError("Regenerate redraws the clip from words: describe what is in it", 400);
+ const length = span ?? (clipLength !== undefined ? Math.max(0, clipLength - start) : input.sourceDuration);
+ const size = clip?.width && clip.height ? clip : input.sourceSize;
+ values.resolution = regenResolution(input.resolution);
+ values.draftSize = draftSizeFor({ fromH3: extra.draftFrom === "h3", width: size?.width, height: size?.height });
+ values.frames = regenFrames(length);
+ delete extra.draftFrom;
+ }
// Drawn motion paths (normalised to the start frame) → one pixel point per output frame (Wan-Move).
const paths = extra.motionPaths as MotionPaths | undefined;
@@ -1650,7 +1662,11 @@ export function promptRefusal(body: PromptRefusalBody, status: number, manifest:
const packs = missingClass?.pack ? [missingClass.pack] : manifest.customNodes.map((c) => c.name);
const where = worker === "isolated" ? "the isolated ComfyUI worker" : "your ComfyUI";
const missingPack =
- body.error?.type === "missing_node_type" && packs.length ? `This workflow needs the ${packs.join(" + ")} node pack${packs.length > 1 ? "s" : ""} on ${where} (see scripts/comfy/README.md)` : undefined;
+ body.error?.type === "missing_node_type" && manifest.id === REGEN_WORKFLOW && worker === "main"
+ ? REGEN_COPY.missing
+ : body.error?.type === "missing_node_type" && packs.length
+ ? `This workflow needs the ${packs.join(" + ")} node pack${packs.length > 1 ? "s" : ""} on ${where} (see scripts/comfy/README.md)`
+ : undefined;
// A LoRA it lacks: point at its model card (a civitai download URL answers 401 without the key) and the LoRA folder setting.
const loraModels = loras.map((l) => ({ file: l.file, folder: "loras", url: loraByFile(l.file)?.page ?? (l.url && !needsToken(l.url) ? l.url : undefined) }));
let detail = body.node_errors && Object.keys(body.node_errors as object).length ? explainComfyError(body.node_errors, { ...manifest, models: [...manifest.models, ...loraModels] }) : (missingPack ?? (typeof body.error?.message === "string" ? body.error.message.slice(0, 1024) : undefined));
diff --git a/src/server/regenerate.ts b/src/server/regenerate.ts
new file mode 100644
index 00000000..be1feaee
--- /dev/null
+++ b/src/server/regenerate.ts
@@ -0,0 +1,96 @@
+import "server-only";
+import path from "node:path";
+import { nanoid } from "nanoid";
+import { isH3Source, REGEN_SEAM_NOTE, regenWindows } from "@/lib/catalog/regenerate";
+import type { Generation, GenerationRequest, ModelDef } from "@/lib/catalog/types";
+import { fileAccount } from "./account-library";
+import { db } from "./db";
+import { filesRel, storedMedia } from "./storage";
+import { tenant, tenantAccount } from "./tenant";
+
+/**
+ * Open-H3 Regenerate on the server (src/lib/catalog/regenerate.ts): what the clip is (the model that made it, for the
+ * draft preset; its length, for the 15 s windows), and the run itself: one pass up to 15 s, or one pass per window
+ * joined packet by packet. Nothing is fetched: a clip is read from Fuobe's own files, inside a tenant only the
+ * account's own (storage.ts storedMedia and the asset's owner), so an account never learns about the owner's runs.
+ */
+
+/** The model that made a stored clip (its run's), or undefined: an upload, a link, or a file the asker may not use. */
+export function clipMaker(ref: string | undefined): string | undefined {
+ const rel = ref ? filesRel(ref) : null;
+ if (!rel) return undefined;
+ if (tenant()) {
+ const who = tenantAccount();
+ if (!who || fileAccount(rel) !== who) return undefined;
+ }
+ const native = rel.split("/").join(path.sep);
+ const row = db()
+ .prepare("SELECT g.model_id AS model FROM assets a JOIN generations g ON g.id = a.generation_id WHERE a.rel_path IN (?, ?) LIMIT 1")
+ .get(rel, native) as { model: string } | undefined;
+ return row?.model;
+}
+
+/** A stored clip's length from its header (none for a link or another's file). */
+function clipSeconds(ref: string | undefined): number | undefined {
+ const info = ref ? storedMedia(ref)?.info : undefined;
+ return info ? (info.videoDuration ?? info.duration) : undefined;
+}
+
+/** Whether a request was already planned here (its draft preset is set): a retry, or one of a split run's windows. */
+const planned = (r: GenerationRequest) => typeof r.params?.extra?.draftFrom === "string";
+
+/**
+ * A Regenerate run: the draft preset decided once from the clip's maker (an earlier step's model when it waits for one),
+ * then one pass for a clip up to 15 s, or a pass per 15 s window and a copy join (each window keeps its own sound; all
+ * come out at the same size at 24 fps). `create` is createGenerations (passed in: this module sits under it).
+ */
+export function createRegenerateRun(
+ original: GenerationRequest,
+ model: ModelDef,
+ opts: { batchId?: string; dependsOn?: string | string[] },
+ create: (r: GenerationRequest, o?: { batchId?: string; dependsOn?: string | string[] }) => Generation[],
+ join: (ids: string[], o: { engine: "open"; feature: string; batchId: string; title: string; copy: true; demo?: boolean; step: GenerationRequest["step"] }) => Generation,
+ cancel: (id: string) => void,
+): Generation[] | null {
+ if (planned(original)) return null;
+ const deps = opts.dependsOn === undefined ? [] : Array.isArray(opts.dependsOn) ? opts.dependsOn : [opts.dependsOn];
+ const video = original.inputs?.video;
+ const maker = deps.length ? (db().prepare("SELECT model_id AS model FROM generations WHERE id = ?").get(deps[0]) as { model: string } | undefined)?.model : clipMaker(video);
+ // The preset's source half; the provider adds the shape from the header ComfyUI is sent (draftSizeFor).
+ const extra = { ...original.params?.extra, draftFrom: isH3Source(maker) ? "h3" : "other" };
+ const seconds = original.params?.sourceDuration ?? (deps.length ? undefined : clipSeconds(video));
+ const windows = deps.length || original.params?.startTime !== undefined || original.params?.endTime !== undefined ? [] : regenWindows(seconds);
+ if (windows.length <= 1) return create({ ...original, params: { ...original.params, extra } }, opts);
+ const batchId = opts.batchId ?? nanoid(10);
+ const parts: Generation[] = [];
+ try {
+ for (const [i, w] of windows.entries()) {
+ parts.push(
+ create(
+ {
+ ...original,
+ params: { ...original.params, startTime: w.start, endTime: Math.round((w.start + w.duration) * 1000) / 1000, numOutputs: 1, extra },
+ step: { label: `Part ${i + 1} of ${windows.length}`, index: i, of: windows.length + 1 },
+ },
+ { batchId },
+ )[0],
+ );
+ }
+ const film = join(
+ parts.map((p) => p.id),
+ {
+ engine: "open",
+ feature: original.feature,
+ batchId,
+ title: original.prompt?.trim().slice(0, 120) || model.name,
+ copy: true,
+ ...(original.demo && { demo: true }),
+ step: { label: `Regenerated · ${windows.length} parts joined`, index: windows.length, of: windows.length + 1 },
+ },
+ );
+ return [{ ...film, notes: [...(film.notes ?? []), REGEN_SEAM_NOTE] }, ...parts];
+ } catch (e) {
+ for (const p of parts) cancel(p.id);
+ throw e;
+ }
+}
diff --git a/tests/model-access-listings.test.ts b/tests/model-access-listings.test.ts
index 09fc4430..e253ebce 100644
--- a/tests/model-access-listings.test.ts
+++ b/tests/model-access-listings.test.ts
@@ -97,8 +97,11 @@ describe("Models & licences in listings and picks", () => {
// The library's 118 LoRAs (Fuobe Try-On's try-on LoRA, the Storyboard's next-scene LoRA, and since O11 Fuobe Angles'
// Multiple-angles and Fuobe Speak's FusioniX among them), the preset LoRA map's files that aren't library files, and
// MiniMax H3's four (Akatz Labs' swap LoRA V1.5 and V1 and Person Remover V1, lightx2v's H3 Turbo), and Fuobe Restore's
- // two gated IC-LoRAs (Lightricks' Restore and Detail Refine), each once.
- expect(list.loras.length).toBe(176);
+ // two gated IC-LoRAs (Lightricks' Restore and Detail Refine), and Open-H3 Regenerate's merged refiner LoRA, each once.
+ expect(list.loras.length).toBe(177);
+ expect(list.loras.find((l) => l.file === "open_h3_regenerate_2k_lora.safetensors")).toMatchObject({ group: "adapter", base: "MiniMax H3", on: true, licence: { name: "MiniMax H3 Community License", class: "regions" } });
+ expect(list.packs.find((p) => p.name === "ComfyUI-Open-H3-Regenerate")).toMatchObject({ licence: { name: "Apache-2.0" }, on: true, models: 1 });
+ expect(list.packs.find((p) => p.name === "Comfyui_Minimax_h3_latent_Upscaler")).toMatchObject({ licence: { name: "MIT" }, on: true, models: 1 });
expect(list.loras.find((l) => l.file === "next-scene_lora-v2-3000.safetensors")).toMatchObject({ group: "adapter", on: true, licence: { name: "MIT", class: "commercial" } });
expect(list.loras.find((l) => l.file === "qwen-edit-2509-multiple-angles-dx8152.safetensors")).toMatchObject({ group: "adapter", on: true, licence: { name: "Apache-2.0", class: "commercial" } });
expect(list.loras.find((l) => l.file === "Wan2.1_I2V_14B_FusionX_LoRA.safetensors")).toMatchObject({ group: "adapter", on: true });