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.

Restore 5: browser check, eval suite and the ComfyUI notes

Claude5ad8adbfcda8
diff --git a/scripts/comfy/README.md b/scripts/comfy/README.md
index ce6c6058..4fd2f59a 100644
--- a/scripts/comfy/README.md
+++ b/scripts/comfy/README.md
@@ -354,6 +354,30 @@ node validate-workflows.mjs video-character-swap-h3-segment video-mask-h3-relay
- **Not run**: neither graph has loaded in a ComfyUI with H3 Relay, and nothing has run on a GPU.
`tests/comfy-swap-studio.test.ts` checks the provider's rewrites on the library files.
+### Restore & colourise (o/archive-restore, 2026-10-30)
+
+One hand-built entry for Video tools → Restore & colourise and the Canvas Restore node: Lightricks' Restore IC-LoRA on
+LTX-2.5 22B distilled with tiled latent fusion (docs/research/fuobe-originals-recipes-5.json, studio `archive-restore`):
+
+```bash
+npm run build -- video-restore-ltx25-tiled
+node validate-workflows.mjs video-restore-ltx25-tiled --shared
+```
+
+| id | capability | what | validated here |
+|---|---|---|---|
+| `video-restore-ltx25-tiled` | restore-video | One window of up to 97 frames (`windowStart`, `windowFrames`) scaled with lanczos to the card's canvas (1440x1088 for 4:3, 1920x1088 for 16:9), restored by `LTXVTiledFusionSampler` in 960x544 tiles at 50% overlap with the card's 8-step sigmas (euler, cfg 1). A later window takes the last 17 restored frames of the one before through `LTXVAddGuide` at frame 0 (`video2`, `prefixFrom`, `prefixFrames`) and drops them from its output; a reference picture goes in at `frame_idx` -1; deinterlacing keeps one field (`fieldWidth`, `fieldHeight`). Stage 2 (Restore to 4K) is the same graph with the Detail Refine IC-LoRA and 1024x576 tiles at twice the canvas. A whole clip in one run streams past 97 frames up to 481. The provider removes the unused branches (`src/lib/restore-graph.ts`); the pipeline joins the windows packet by packet and puts the sound back. 24 GB | no: `missing_node_type` (the ComfyUI-LTXVideo classes) |
+
+- **Node pack**: ComfyUI-LTXVideo (LTX-2 Community License, free below US$10M annual revenue: information, not a gate),
+ pinned in `install-comfyui.sh` at `220e1d45`. It is not installed on the
+ CPU validation server, so the build records its classes as unknown and the entry stays unvalidated.
+- **Weights**: the LTX-2.5 22B distilled transformer (int8), its VAE and the Gemma text encoder, plus the Restore IC-LoRA
+ (1.7 GB) and, for stage 2, the Detail Refine IC-LoRA (1.3 GB). Both LoRAs are gated on Hugging Face: accept the licence
+ there, add a token in Settings → LoRAs, and the provider downloads the one a run loads before it submits. LoRA files
+ are never committed.
+- **Not run**: the graph has not loaded in a ComfyUI with ComfyUI-LTXVideo, and nothing has run on a GPU.
+ `tests/restore-comfy.test.ts` checks the bindings and branch removal on the library file.
+
## DBS soundtrack separation (DBS D1)
One hand-built graph splits a soundtrack into dialogue, music and effects (docs/research/dbs-separation-7.md §4.4, graph A):
diff --git a/scripts/eval/cases/restore.json b/scripts/eval/cases/restore.json
new file mode 100644
index 00000000..f67c91e8
--- /dev/null
+++ b/scripts/eval/cases/restore.json
@@ -0,0 +1,104 @@
+{
+ "$schema": "./case.schema.json",
+ "suite": "restore",
+ "title": "Fuobe Restore · archive footage restored and colourised",
+ "description": "Runs Video tools → Restore & colourise (POST /api/restore) on your own archive clip in local/restore/: scan.mp4 (10–60 s of black-and-white or faded footage you own or that is in the public domain). On ComfyUI, LTX-2.5 22B distilled with Lightricks' Restore IC-LoRA, 960x544 tiles fused every step, 97-frame windows each starting from the last 17 restored frames, the sound put back; Restore to 4K adds the Detail Refine IC-LoRA at twice the canvas. On fal, LTX-2.3 22B reference video to video with the same LoRA (mirrored from Hugging Face with your token), one untiled pass a piece. The LoRA is gated: accept its licence on Hugging Face and add a token in Settings → LoRAs before an open or cloud run. Temporal drift is read against the scan; nothing here has been rendered yet.",
+ "original": [
+ "fuobe-restore"
+ ],
+ "kind": "video",
+ "targets": {
+ "open": {
+ "models": [
+ "fuobe-restore"
+ ]
+ },
+ "cloud": {
+ "models": [
+ "fuobe-restore"
+ ]
+ },
+ "demo": {
+ "models": [
+ "fuobe-restore"
+ ]
+ }
+ },
+ "defaults": {
+ "seeds": [
+ 1001
+ ],
+ "metrics": [
+ "temporal",
+ "clip"
+ ],
+ "timeoutSeconds": 7200,
+ "candidate": "original"
+ },
+ "variants": {
+ "original": {
+ "description": "Fuobe Restore as the tool runs it"
+ }
+ },
+ "cases": [
+ {
+ "id": "restore/words",
+ "title": "Your words: period, place, light, clothing, natural colour",
+ "inputs": {
+ "video": "local/restore/scan.mp4"
+ },
+ "demoInputs": {
+ "video": "fixtures/walk-6s.mp4"
+ },
+ "prompts": [
+ {
+ "id": "street",
+ "text": "a city street in the 1930s, overcast daylight, trams and horse carts, people in wool coats and felt hats, painted shop fronts, natural colour"
+ }
+ ],
+ "metrics": [
+ "temporal",
+ "clip"
+ ],
+ "submit": {
+ "route": "/api/restore",
+ "body": {
+ "engine": "{{engine}}",
+ "prompt": "{{prompt}}",
+ "source": "{{source:inputs.video}}",
+ "seed": 1001,
+ "requestId": "{{requestId}}"
+ }
+ }
+ },
+ {
+ "id": "restore/written",
+ "title": "The words written for the clip (Claude, Ollama or the template)",
+ "inputs": {
+ "video": "local/restore/scan.mp4"
+ },
+ "demoInputs": {
+ "video": "fixtures/walk-6s.mp4"
+ },
+ "prompts": [
+ {
+ "id": "hint",
+ "text": "a street, 1930s"
+ }
+ ],
+ "metrics": [
+ "temporal"
+ ],
+ "submit": {
+ "route": "/api/restore",
+ "body": {
+ "engine": "{{engine}}",
+ "hint": "{{prompt}}",
+ "source": "{{source:inputs.video}}",
+ "seed": 1001,
+ "requestId": "{{requestId}}"
+ }
+ }
+ }
+ ]
+}
diff --git a/src/components/explainer/explainer-studio.tsx b/src/components/explainer/explainer-studio.tsx
index cbfe23d3..7844d8cf 100644
--- a/src/components/explainer/explainer-studio.tsx
+++ b/src/components/explainer/explainer-studio.tsx
@@ -60,7 +60,7 @@ type Draft =
const STEPS = [
{ icon: Sparkles, title: "Choose Preset", text: "One of 22 looks: whiteboard, pixel art, paper diorama…" },
- { icon: Paperclip, title: "Attach a file or just prompt", text: "Images, a PDF, Word or text document, or a link — or only a topic." },
+ { icon: Paperclip, title: "Attach a file or just prompt", text: "Images, old footage, a PDF, Word or text document, or a link — or only a topic." },
{ icon: Download, title: "Download your result", text: "A narrated, subtitled video; fix any scene in the timeline." },
];
diff --git a/src/server/assist/studio-tools.ts b/src/server/assist/studio-tools.ts
index 66ef4427..1dd69a39 100644
--- a/src/server/assist/studio-tools.ts
+++ b/src/server/assist/studio-tools.ts
@@ -661,7 +661,7 @@ const restoreVideo = defineTool({
name: "restore_video",
description:
"Restore and colourise archive footage (old scans, tape, black-and-white film, up to 2 minutes) with Lightricks' Restore IC-LoRA — Fuobe's Restore & colourise tool (Video tools → Restore & colourise), where the result sits beside the original with a Before/After wipe. " +
- "On your GPU: LTX-2.5 with tiled fusion in 97-frame windows, the sound kept, optional Restore to 4K and deinterlacing (the LoRA is gated: a Hugging Face token in Settings → Connections downloads it). " +
+ "On your GPU: LTX-2.5 with tiled fusion in 97-frame windows, the sound kept, optional Restore to 4K and deinterlacing (the LoRA is gated: a Hugging Face token in Settings → LoRAs downloads it). " +
"In the cloud: fal's LTX-2.3 reference video-to-video in pieces, priced per megapixel. Leave prompt out to have one written. Gated by the same approval card as generate.",
schema: RestoreInput,
gated: true,
diff --git a/tests/e2e/restore-flows.mjs b/tests/e2e/restore-flows.mjs
new file mode 100644
index 00000000..8eba035f
--- /dev/null
+++ b/tests/e2e/restore-flows.mjs
@@ -0,0 +1,167 @@
+// Restore & colourise in the browser (demo mode: no keys, no GPU). The tool opened from a clip handed over: its canvas
+// and tiles, the gated-download step and the GPU note, the words written from the frames (offline), Restore to 4K on
+// the GPU and refused in the cloud with the reason, the cloud size, a demo run with its Before/After wipe. Then the
+// Upscale tool's link, the masked Hugging Face token in Settings → LoRAs, the restore step offered under a clip
+// in Shorts and the Explainer, and each page at 1440 and 390 px, light and dark, without sideways scroll.
+// Usage: node tests/e2e/restore-flows.mjs [appUrl] [--shots <dir>] Exits 1 on a failed check.
+import { execFileSync } from "node:child_process";
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { launch, root } from "./_browser.mjs";
+
+const argv = process.argv.slice(2);
+const app = (argv.find((a) => !a.startsWith("--") && argv[argv.indexOf(a) - 1] !== "--shots") ?? "http://localhost:3000").replace(/\/$/, "");
+const shots = argv.includes("--shots") ? argv[argv.indexOf("--shots") + 1] : undefined;
+if (shots) fs.mkdirSync(shots, { recursive: true });
+
+const failures = [];
+const check = (label, ok, extra = "") => {
+ console.log(`${ok ? "ok " : "FAIL"} ${label.padEnd(76)}${extra ? ` ${extra}` : ""}`);
+ if (!ok) failures.push(label);
+};
+const fixture = path.join(root, "tests/fixtures/shorts-12s.mp4");
+// Playwright's Chromium has no H.264 decoder: the Explainer reads its still in the browser, so it gets the clip as a
+// black-and-white VP9 WebM (ffmpeg), which also shows the black-and-white wording.
+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-restore-e2e-"));
+const greyWebm = path.join(tmp, "harbour-1930.webm");
+execFileSync("ffmpeg", ["-loglevel", "error", "-y", "-i", fixture, "-t", "4", "-vf", "hue=s=0", "-c:v", "libvpx-vp9", "-b:v", "200k", "-an", greyWebm]);
+
+async function upload(file, type, name) {
+ const form = new FormData();
+ form.append("file", new Blob([fs.readFileSync(file)], { type }), name);
+ const res = await fetch(`${app}/api/uploads`, { method: "POST", body: form });
+ if (!res.ok) throw new Error(`upload failed: ${res.status}`);
+ return (await res.json()).url;
+}
+const clip = await upload(fixture, "video/mp4", "harbour 1930.mp4");
+
+const browser = await launch();
+const contextFor = async (engine, viewport = { width: 1440, height: 900 }, colorScheme = "light") => {
+ const context = await browser.newContext({ viewport, colorScheme, ...(viewport.width < 500 && { isMobile: true, hasTouch: true }) });
+ await context.addInitScript((e) => {
+ try {
+ localStorage.setItem("fuobe.engine", e);
+ } catch {}
+ }, engine);
+ const page = await context.newPage();
+ page.setDefaultTimeout(60_000);
+ return { context, page };
+};
+const text = (page) => page.evaluate(() => document.body.innerText.replace(/\s+/g, " "));
+
+try {
+ // ---------------------------------------------------------------------------
+ // The tool on the GPU
+ {
+ const { context, page } = await contextFor("open");
+ await page.goto(`${app}/video-tools/restore?video=${encodeURIComponent(clip)}`, { waitUntil: "load" });
+ await page.getByText(/Canvas \d+×\d+ · \d+ tiles of 960×544/).first().waitFor({ timeout: 30_000 });
+ const t = await text(page);
+ check("GPU: canvas, tiles and windows read from the clip", /Canvas 1088×1920 · \d+ tiles of 960×544 · 3 windows of up to 97 frames/.test(t));
+ check("GPU: the gated-download step with its link to Settings", /Restore IC-LoRA is gated/.test(t) && (await page.locator('a[href="/settings#huggingface"]').count()) > 0);
+ check("GPU: the hardware note", /24 GB|GPU/.test(t));
+ check("GPU: priced before it runs", /Free|Demo · free/.test(t));
+ await page.getByRole("button", { name: /Write it from the frames/ }).click();
+ await page.waitForFunction(() => (document.querySelector("#restore-prompt")?.value ?? "").length > 20, null, { timeout: 30_000 });
+ const words = await page.locator("#restore-prompt").inputValue();
+ check("words written from the frames, editable", /natural colour/.test(words), words.slice(0, 60));
+ await page.locator("#restore-prompt").fill(`${words} Edited.`);
+ check("the written words stay editable", (await page.locator("#restore-prompt").inputValue()).endsWith("Edited."));
+ const four = page.getByRole("switch", { name: /Restore to 4K/ });
+ check("Restore to 4K is offered on the GPU", (await four.count()) > 0 && !(await four.isDisabled()));
+ await four.click();
+ await page.getByText(/then 2176×3840/).first().waitFor({ timeout: 20_000 });
+ check("Restore to 4K adds the detail pass at twice the canvas", true);
+ if (shots) await page.screenshot({ path: path.join(shots, "restore-open-1440.png"), fullPage: true });
+ await four.click();
+ await page.getByRole("button", { name: /^Restore$/ }).click();
+ await page.getByLabel("Compare the archive clip and the restored one").first().waitFor({ timeout: 90_000 });
+ check("a demo run ends beside the original with a Before/After wipe", true);
+ await page.getByRole("heading", { name: "Your restorations" }).waitFor({ timeout: 30_000 });
+ check("the run is listed under Your restorations", true);
+ if (shots) await page.screenshot({ path: path.join(shots, "restore-open-result-1440.png"), fullPage: true });
+ await context.close();
+ }
+
+ // ---------------------------------------------------------------------------
+ // The tool in the cloud
+ {
+ const { context, page } = await contextFor("cloud");
+ await page.goto(`${app}/video-tools/restore?video=${encodeURIComponent(clip)}`, { waitUntil: "load" });
+ await page.getByText(/in one pass a piece/).first().waitFor({ timeout: 30_000 });
+ const t = await text(page);
+ check("cloud: one untiled pass a piece, in pieces of up to 97 frames", /704×1280 in one pass a piece · 2 pieces of up to 97 frames/.test(t));
+ check("cloud: Restore to 4K says it runs on your GPU", /Runs on your GPU \(open source\)/.test(t) && (await page.getByRole("switch", { name: /Restore to 4K/ }).isDisabled()));
+ check("cloud: the size to pick", (await page.getByRole("radio", { name: "1080p" }).count()) > 0);
+ if (shots) await page.screenshot({ path: path.join(shots, "restore-cloud-1440.png"), fullPage: true });
+ await context.close();
+ }
+
+ // ---------------------------------------------------------------------------
+ // Elsewhere: Upscale, Settings, Shorts, the Explainer
+ {
+ const { context, page } = await contextFor("open");
+ await page.goto(`${app}/upscale/video`, { waitUntil: "load" });
+ const up = page.getByRole("link", { name: /Restore archive footage first/ });
+ await up.first().waitFor({ timeout: 30_000 });
+ check("Upscale: Restore archive footage first", (await up.first().getAttribute("href")) === "/video-tools/restore");
+
+ await page.goto(`${app}/settings#huggingface`, { waitUntil: "load" });
+ const token = page.locator("#huggingface input").first();
+ await token.waitFor({ timeout: 30_000 });
+ check("Settings: the Hugging Face token field is masked", (await token.getAttribute("type")) === "password");
+
+ // A file set before React hydrates the drop zone is never read: wait for the step's heading, then a moment.
+ await page.goto(`${app}/shorts`, { waitUntil: "load" });
+ await page.getByRole("heading", { name: "Upload your video" }).waitFor({ timeout: 30_000 });
+ await page.waitForTimeout(1500);
+ await page.locator('input[type="file"]').first().setInputFiles(fixture);
+ await page.getByRole("link", { name: /Restore & colourise it first/ }).first().waitFor({ timeout: 60_000 });
+ const href = await page.getByRole("link", { name: /Restore & colourise it first/ }).first().getAttribute("href");
+ check("Shorts: the restore step offered under the uploaded clip, with the clip", /^\/video-tools\/restore\?video=%2Fapi%2Ffiles%2F/.test(href ?? ""), href ?? "");
+ if (shots) await page.screenshot({ path: path.join(shots, "shorts-old-footage-1440.png") });
+
+ await page.goto(`${app}/explainer`, { waitUntil: "load" });
+ await page.getByRole("button", { name: /Attach a file/ }).waitFor({ timeout: 30_000 });
+ await page.waitForTimeout(1500);
+ await page.locator('input[type="file"]').first().setInputFiles(greyWebm);
+ await page.getByRole("link", { name: /Restore & colourise it first/ }).first().waitFor({ timeout: 60_000 });
+ await page.getByText("This looks like black-and-white footage.").first().waitFor({ timeout: 30_000 });
+ const t = await text(page);
+ check("Explainer: a still from the footage as a source", /harbour-1930 still\.jpg/.test(t));
+ check("Explainer: black-and-white footage said plainly", /This looks like black-and-white footage\./.test(t));
+ await page.waitForFunction(() => /video=/.test([...document.querySelectorAll("a")].find((a) => /Restore & colourise it first/.test(a.textContent ?? ""))?.getAttribute("href") ?? ""), null, { timeout: 60_000 });
+ check("Explainer: the restore step offered with the clip", true);
+ if (shots) await page.screenshot({ path: path.join(shots, "explainer-old-footage-1440.png") });
+ await context.close();
+ }
+
+ // ---------------------------------------------------------------------------
+ // Every touched page at 1440 and 390 px, light and dark: nothing scrolls sideways.
+ const pages = [`/video-tools/restore?video=${encodeURIComponent(clip)}`, "/video-tools/restore", "/upscale/video", "/settings#huggingface", "/shorts", "/explainer"];
+ for (const [width, height] of [
+ [1440, 900],
+ [390, 844],
+ ]) {
+ for (const scheme of ["light", "dark"]) {
+ for (const engine of ["open", "cloud"]) {
+ const { context, page } = await contextFor(engine, { width, height }, scheme);
+ for (const p of pages) {
+ await page.goto(`${app}${p}`, { waitUntil: "load" });
+ await page.waitForTimeout(900);
+ const ok = await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1);
+ check(`${p.split("?")[0]}${p.includes("?") ? " (clip)" : ""} ${engine} at ${width}px ${scheme}: no sideways scroll`, ok);
+ if (shots && p.startsWith("/video-tools/restore?")) await page.screenshot({ path: path.join(shots, `restore-${engine}-${width}-${scheme}.png`), fullPage: true });
+ }
+ await context.close();
+ }
+ }
+ }
+} finally {
+ await browser.close();
+ fs.rmSync(tmp, { recursive: true, force: true });
+}
+
+console.log(failures.length ? `\n${failures.length} failed` : "\nall checks passed");
+process.exit(failures.length ? 1 : 0);
diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.ts
index ffdf6a80..b39ceb5c 100644
--- a/tests/eval-harness.test.ts
+++ b/tests/eval-harness.test.ts
@@ -40,6 +40,8 @@ const shortsSessions = await import("@/app/api/shorts/sessions/route");
const paletteLock = await import("@/app/api/palettes/lock/route");
const evolution = await import("@/app/api/evolution/route");
const evolutionEstimate = await import("@/app/api/evolution/estimate/route");
+const restore = await import("@/app/api/restore/route");
+const restoreEstimate = await import("@/app/api/restore/estimate/route");
// The harness is plain ESM JavaScript (it runs with node, no build step).
const evalCli = (await import("../scripts/eval/eval.mjs")) as { main: (argv: string[], io?: object) => Promise<number> };
@@ -81,6 +83,8 @@ const ROUTES: [string, RegExp, (req: Request, m: RegExpExecArray) => Promise<Res
["POST", /^\/api\/palettes\/lock$/, (r) => paletteLock.POST(r)],
["POST", /^\/api\/evolution$/, (r) => evolution.POST(r)],
["POST", /^\/api\/evolution\/estimate$/, (r) => evolutionEstimate.POST(r)],
+ ["POST", /^\/api\/restore$/, (r) => restore.POST(r)],
+ ["POST", /^\/api\/restore\/estimate$/, (r) => restoreEstimate.POST(r)],
];
let server: http.Server;
@@ -292,6 +296,21 @@ describe("the runner on the demo provider", () => {
expect(rows.every((x) => x.outputs?.[0]?.kind === "video")).toBe(true);
});
+ it("runs Fuobe Restore's suite on the demo provider: your words, and words written for the clip", async () => {
+ const r = await cli(["run", "--suite", "restore", "--engine", "demo", "--no-metrics"]);
+ expect(r.code, r.stderr).toBe(0);
+ const rows = store.latestJobs(path.join(results, runIdFrom(r.stderr)));
+ expect(rows.map((x) => [x.caseId, x.status]).sort()).toEqual([
+ ["restore/words", "succeeded"],
+ ["restore/written", "succeeded"],
+ ]);
+ const body = (id: string) => (rows.find((x) => x.caseId === id)!.request as { body: Record<string, unknown> }).body;
+ expect(body("restore/words")).toMatchObject({ engine: "open", prompt: expect.stringMatching(/natural colour$/) });
+ expect(body("restore/written")).toMatchObject({ engine: "open", hint: "a street, 1930s" });
+ expect(body("restore/written").prompt).toBeUndefined();
+ expect(rows.every((x) => x.outputs?.[0]?.kind === "video")).toBe(true);
+ });
+
it("runs Genjutsu's Character swap on the 6 s fixture clip: the part, the character, who to swap", async () => {
const r = await cli(["run", "--suite", "genjutsu", "--engine", "demo", "--cases", "genjutsu/character,genjutsu/character-plain", "--no-metrics"]);
expect(r.code, r.stderr).toBe(0);