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.

Public sign-up: PR #15's tools follow the owner's rules for guests and accounts

Claude0f85f9de32db
diff --git a/src/app/api/turnaround/estimate/route.ts b/src/app/api/turnaround/estimate/route.ts
index aab9869a..fcb0f05b 100644
--- a/src/app/api/turnaround/estimate/route.ts
+++ b/src/app/api/turnaround/estimate/route.ts
@@ -1,17 +1,27 @@
+import { requestViewer } from "@/server/auth";
import { recordExists } from "@/server/records";
import { body, handle } from "@/server/shorts-schemas";
import { previewTurnaround, TurnaroundBodySchema, turnaroundRun } from "@/server/turnaround";
+import { priceAs } from "@/server/visitor";
/**
* A turnaround's price and plan, as the studio routes' estimates answer it (the evaluation harness prices a job here
* before running it): the model the film runs on, what it costs, whether it would be a demo, the notes.
*/
-export async function POST(request: Request) {
+async function post(request: Request) {
return handle(async () => {
const input = await body(request, TurnaroundBodySchema, "Pick the engine and the character's pictures");
delete input.requestId;
- if (input.elementId && !recordExists({ kind: "element", ids: [input.elementId] })) return Response.json({ error: "Character not found" }, { status: 404 });
+ // Characters are the owner's library: a visitor (public sign-up) is never told whether one exists.
+ if (input.elementId && (requestViewer(request).kind !== "owner" || !recordExists({ kind: "element", ids: [input.elementId] }))) {
+ return Response.json({ error: "Character not found" }, { status: 404 });
+ }
const p = previewTurnaround(turnaroundRun(input));
return Response.json({ ...p, modelId: p.model.id, modelName: p.model.name });
});
}
+
+/** A visitor (public sign-up) gets the price of its run on its own GPU, never a demo (src/server/visitor.ts). */
+export async function POST(request: Request) {
+ return priceAs(request, () => post(request));
+}
diff --git a/src/app/api/turnaround/route.ts b/src/app/api/turnaround/route.ts
index ba18c5ce..5917cd31 100644
--- a/src/app/api/turnaround/route.ts
+++ b/src/app/api/turnaround/route.ts
@@ -1,18 +1,28 @@
+import { requestViewer } from "@/server/auth";
import { recordExists } from "@/server/records";
import { body, handle, once } from "@/server/shorts-schemas";
import { createTurnaround, previewTurnaround, TurnaroundBodySchema, turnaroundRun } from "@/server/turnaround";
+import { priceAs } from "@/server/visitor";
/**
* Turnaround video (build plan N7-6): a 360° turnaround of a cast sheet or a character, on either engine. `?preview=1` plans
* and prices it (the route, the pictures drawn first, the film's frames, the GPU it needs) without running it.
*/
-export async function POST(request: Request) {
+async function post(request: Request) {
return handle(async () => {
const { requestId, ...input } = await body(request, TurnaroundBodySchema, "Pick the engine and the character's pictures");
- if (input.elementId && !recordExists({ kind: "element", ids: [input.elementId] })) return Response.json({ error: "Character not found" }, { status: 404 });
+ // Characters are the owner's library: a visitor (public sign-up) is never told whether one exists.
+ if (input.elementId && (requestViewer(request).kind !== "owner" || !recordExists({ kind: "element", ids: [input.elementId] }))) {
+ return Response.json({ error: "Character not found" }, { status: 404 });
+ }
const run = turnaroundRun(input);
if (new URL(request.url).searchParams.get("preview")) return Response.json(previewTurnaround(run));
const result = await once("turnaround", requestId, () => createTurnaround(run));
return Response.json(result, { status: 201 });
});
}
+
+/** A visitor (public sign-up) gets the price of its run on its own GPU, never a demo (src/server/visitor.ts). */
+export async function POST(request: Request) {
+ return priceAs(request, () => post(request));
+}
diff --git a/src/lib/guest-access.ts b/src/lib/guest-access.ts
index 21b360a4..77819682 100644
--- a/src/lib/guest-access.ts
+++ b/src/lib/guest-access.ts
@@ -87,11 +87,11 @@ export function guestRead(pathname: string): GuestRead {
}
/** The run routes whose `?preview=1` only plans and prices (any other route would ignore the flag and run). */
-const PREVIEWS = [/^\/api\/(generations|audio-tools|dub|katana)$/, /^\/api\/dub\/[^/]+\/voice$/];
+const PREVIEWS = [/^\/api\/(generations|audio-tools|dub|katana|turnaround)$/, /^\/api\/dub\/[^/]+\/voice$/];
/** The estimate routes (named: a dynamic segment called "estimate" on another route must not pass for one). */
const ESTIMATES =
- /^\/api\/(ads|ads\/multiplier|assist\/skills\/[^/]+|content-factory|evolution|faceless|genjutsu|influencer|marketing|marketing\/click-to-ad|mixed-media|remove-object|shorts|storyboards)\/estimate$/;
+ /^\/api\/(ads|ads\/multiplier|assist\/skills\/[^/]+|content-factory|evolution|faceless|genjutsu|influencer|marketing|marketing\/click-to-ad|mixed-media|remove-object|shorts|storyboards|turnaround)\/estimate$/;
/** A POST that only plans and prices a run (an estimate route, or ?preview=1 where PREVIEWS honours it): free, and open to guests. */
export function isPriceCheck(method: string, pathname: string, search: string): boolean {
@@ -109,6 +109,8 @@ export function isPriceCheck(method: string, pathname: string, search: string):
const LIBRARY_CHANGES: [methods: string, path: RegExp][] = [
["POST", /^\/api\/uploads$/],
["POST", /^\/api\/media\/probe$/],
+ // Split soundtrack's Export mix: a WAV saved to the Library as an asset, in parts.
+ ["POST", /^\/api\/audio-tools\/export$/],
["POST", /^\/api\/folders$/],
["PATCH DELETE", /^\/api\/folders\/[^/]+$/],
["PATCH DELETE", /^\/api\/generations\/[^/]+$/],
diff --git a/src/server/gpu/tools.ts b/src/server/gpu/tools.ts
index a50fe51c..003d92b8 100644
--- a/src/server/gpu/tools.ts
+++ b/src/server/gpu/tools.ts
@@ -1,9 +1,17 @@
import "server-only";
+import { SPLIT_MODEL } from "@/lib/av/split";
import { getModel, getPreset, MODELS, modelsFor, PRESETS } from "@/lib/catalog";
import { graphLoras } from "@/lib/catalog/character-swap";
+import { PATH_MODELS } from "@/lib/catalog/cinema";
import { dualEngine, onEngine, runsOn } from "@/lib/catalog/engines";
+import { FRAMES_MODELS } from "@/lib/catalog/keyframes";
import { libraryEntry, needsToken } from "@/lib/catalog/loras";
+import { ANGLES_2511_LORA } from "@/lib/catalog/open-tools";
import { STUDIO_WORKFLOWS } from "@/lib/catalog/swap-studio-plan";
+import { FILL_MODELS } from "@/lib/catalog/turnaround";
+
+/** The open engine's Join clips (a turnaround's quarter turns become one film). */
+const JOIN_CLIPS_MODEL = "oss-join-clips";
import type { LoraRef, ModelDef, Operation } from "@/lib/catalog/types";
import type { LoraNeed } from "@/lib/gpu/readiness";
import { basename } from "@/lib/gpu/requirements";
@@ -112,6 +120,11 @@ export interface StudioRowDef {
config?: StudioConfig;
/** A studio with graphs of its own (Character swap). */
workflows?: string[];
+ /**
+ * A tool that runs open models' operations in steps (Split soundtrack, Cinema's fly path, the turnaround): their graphs
+ * and LoRAs together, with the LoRAs a step adds itself (the turnaround's Angles LoRA). The first names the tool.
+ */
+ steps?: { modelId: string; op: Operation; loras?: LoraRef[] }[];
}
/** The board's rows (src/lib/hubs.ts names the hub modes): each studio's open default. */
@@ -127,10 +140,26 @@ export const STUDIO_ROWS: StudioRowDef[] = [
{ href: "/reframe", label: "Reframe", group: "Video", config: S.REFRAME_STUDIO },
{ href: "/lipsync", label: "Lipsync", group: "Video", config: S.LIPSYNC_STUDIO },
{ href: "/character-swap", label: "Character swap", group: "Video", workflows: [STUDIO_WORKFLOWS.mask, STUDIO_WORKFLOWS.segment] },
+ // Cinema's 3D scene films a still along a keyframed camera path (N7-5).
+ { href: "/cinema", label: "Fly path", group: "Video", steps: [{ modelId: PATH_MODELS.open, op: "camera-path" }] },
+ // The turnaround (N7-6): Frames mode's start/end-frame clips joined into one film, with the sides it has no picture of
+ // drawn first by the Angles app (src/lib/catalog/turnaround.ts).
+ {
+ href: "/character-sheet",
+ label: "Turnaround",
+ group: "Video",
+ steps: [
+ { modelId: FRAMES_MODELS.open.id, op: "keyframes" },
+ { modelId: JOIN_CLIPS_MODEL, op: "concat" },
+ { modelId: FILL_MODELS.open, op: "edit", loras: [ANGLES_2511_LORA] },
+ ],
+ },
{ href: "/audio", label: "Voice", group: "Audio", config: S.AUDIO_STUDIO },
{ href: "/audio/dialogue", label: "Dialogue", group: "Audio", config: S.DIALOGUE_STUDIO },
{ href: "/audio/voice-change", label: "Voice change", group: "Audio", config: S.VOICE_CHANGE_STUDIO },
{ href: "/audio/transcribe", label: "Transcribe", group: "Audio", config: S.TRANSCRIBE_STUDIO },
+ // DBS soundtrack separation (D1): dialogue, music and effects.
+ { href: "/audio/split", label: "Split soundtrack", group: "Audio", steps: [{ modelId: SPLIT_MODEL, op: "separate-audio" }] },
{ href: "/audio/sfx", label: "Sound effects", group: "Audio", config: S.SFX_STUDIO },
{ href: "/audio/music", label: "Music", group: "Audio", config: S.MUSIC_STUDIO },
{ href: "/audio/video", label: "Sound for video", group: "Audio", config: S.FOLEY_STUDIO },
@@ -145,8 +174,24 @@ export const STUDIO_ROWS: StudioRowDef[] = [
{ href: "/video-tools/colors", label: "Match colors", group: "Video tools", config: S.VIDEO_COLOR_MATCH_STUDIO },
];
-/** A studio row's tool: its open default model on the studio's operations (or its own graphs). */
+/** A studio row's tool: its open default model on the studio's operations (or its own graphs, or its steps). */
export function studioTool(row: StudioRowDef): Tool | null {
+ if (row.steps) {
+ const parts = row.steps.flatMap((s) => {
+ const t = modelTool(s.modelId, s.op);
+ return t ? [{ ...t, loras: [...t.loras, ...(s.loras ?? []).map(loraNeed)] }] : [];
+ });
+ if (parts.length !== row.steps.length) return null;
+ const loras = new Map(parts.flatMap((p) => p.loras).map((l) => [l.file, l]));
+ return {
+ ref: `studio:${row.href}`,
+ name: parts[0].name,
+ kind: parts[0].kind,
+ workflows: [...new Set(parts.flatMap((p) => p.workflows))],
+ loras: [...loras.values()],
+ ...(parts.every((p) => p.local) && { local: true }),
+ };
+ }
if (row.workflows) {
const segment = row.workflows[row.workflows.length - 1];
return { ref: `studio:${row.href}`, name: row.label, kind: "video", workflows: row.workflows.filter((w) => !!loadIndex().workflows[w]), loras: graphLoras(segment, {}).map(loraNeed) };
diff --git a/tests/public-signup-tools.test.ts b/tests/public-signup-tools.test.ts
new file mode 100644
index 00000000..61484dbb
--- /dev/null
+++ b/tests/public-signup-tools.test.ts
@@ -0,0 +1,269 @@
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
+import { NextRequest } from "next/server";
+
+/**
+ * PR #15's tools under the owner's public sign-up rules (docs/public-signup.md): Split soundtrack (and its Export mix),
+ * MOSS-Image, Cinema's fly path and the turnaround. Guests and accounts get what main gives the same kind of route:
+ * price checks open and priced for their own GPU, runs refused (sign up, Connect your GPU, or own-gpu-tool), the
+ * owner's library closed, and the GPU pre-flight board lists the tools like main's studios.
+ */
+
+const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-signup-tools-"));
+process.env.FUOBE_DATA_DIR = dir;
+process.env.COMFYUI_URL = "http://127.0.0.1:9";
+process.env.OLLAMA_URL = "http://127.0.0.1:9";
+delete process.env.FUOBE_PASSWORD;
+delete process.env.FUOBE_PUBLIC_SIGNUP;
+delete process.env.FUOBE_ALLOWED_ORIGINS;
+
+const auth = await import("@/server/auth");
+const { proxy } = await import("@/proxy");
+const access = await import("@/lib/guest-access");
+const { setSetting } = await import("@/server/settings");
+const { saveFile } = await import("@/server/storage");
+const { encodePng } = await import("@/server/png");
+const { createElement } = await import("@/server/elements");
+const turnaround = await import("@/app/api/turnaround/route");
+const turnaroundEstimate = await import("@/app/api/turnaround/estimate/route");
+const audioTools = await import("@/app/api/audio-tools/route");
+const { STUDIO_ROWS, studioOthers, studioTool, toolFor } = await import("@/server/gpu/tools");
+const { loadIndex } = await import("@/server/gpu/index-file");
+afterAll(() => {
+ // The database stays open until the worker exits (Windows won't delete it before).
+ try {
+ fs.rmSync(dir, { recursive: true, force: true });
+ } catch {}
+});
+
+const passed = (r: Response) => r.headers.get("x-middleware-next") === "1";
+
+function req(url: string, init: { method?: string; cookie?: string } = {}) {
+ const method = init.method ?? "GET";
+ const headers: Record<string, string> = {};
+ if (init.cookie) headers.cookie = `${auth.SESSION_COOKIE}=${init.cookie}`;
+ return new NextRequest(`http://localhost:3000${url}`, { method, headers, ...(method !== "GET" && method !== "HEAD" && { body: "{}" }) });
+}
+
+/** A route call as the proxy hands it on: JSON body, the visitor's session cookie (none for a guest). */
+function call(url: string, body: unknown, cookie?: string) {
+ return new Request(`http://localhost:3000${url}`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json", ...(cookie && { cookie: `${auth.SESSION_COOKIE}=${cookie}` }) },
+ body: JSON.stringify(body),
+ });
+}
+
+const png = (name: string) => saveFile({ data: encodePng({ width: 18, height: 32, data: Buffer.alloc(18 * 32 * 4, 128) }), contentType: "image/png", name, source: "upload" }).url;
+
+/** A two-second 16-bit stereo WAV, saved as the owner's upload. */
+function wav(name = "film.wav"): string {
+ const rate = 8000;
+ const n = rate * 2;
+ const buf = Buffer.alloc(44 + n * 4);
+ buf.write("RIFF", 0);
+ buf.writeUInt32LE(36 + n * 4, 4);
+ buf.write("WAVEfmt ", 8);
+ buf.writeUInt32LE(16, 16);
+ buf.writeUInt16LE(1, 20);
+ buf.writeUInt16LE(2, 22);
+ buf.writeUInt32LE(rate, 24);
+ buf.writeUInt32LE(rate * 4, 28);
+ buf.writeUInt16LE(4, 32);
+ buf.writeUInt16LE(16, 34);
+ buf.write("data", 36);
+ buf.writeUInt32LE(n * 4, 40);
+ return saveFile({ data: buf, contentType: "audio/wav", name, source: "upload" }).url;
+}
+
+let n = 0;
+const newAccount = () => auth.createAccount(`tools${++n}@example.com`, "long enough");
+
+beforeAll(() => {
+ auth.setPassword("install password");
+ // The owner's own runs would be free demos: a visitor's price never is (src/server/visitor.ts).
+ setSetting("demoMode", "on");
+ setSetting("enhanceProvider", "none");
+});
+afterEach(() => {
+ delete process.env.FUOBE_PUBLIC_SIGNUP;
+});
+
+describe("the proxy: PR #15's routes as main treats their kind", () => {
+ it("lets guests and accounts open the tools' pages", () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ const cookie = auth.createSession(newAccount().id).value;
+ for (const p of ["/audio/split", "/character-sheet", "/cinema", "/image", "/connect"]) {
+ expect(passed(proxy(req(p))), `guest ${p}`).toBe(true);
+ expect(passed(proxy(req(p, { cookie }))), `account ${p}`).toBe(true);
+ }
+ });
+
+ it("knows the turnaround's price checks from its run", () => {
+ expect(access.isPriceCheck("POST", "/api/turnaround/estimate", "")).toBe(true);
+ expect(access.isPriceCheck("POST", "/api/turnaround", "?preview=1")).toBe(true);
+ expect(access.isPriceCheck("POST", "/api/audio-tools", "?preview=1")).toBe(true);
+ expect(access.isPriceCheck("POST", "/api/turnaround", "")).toBe(false);
+ expect(access.isPriceCheck("POST", "/api/turnaround", "?preview=true")).toBe(false);
+ expect(access.isPriceCheck("POST", "/api/audio-tools/export", "?preview=1")).toBe(false);
+ expect(access.isPriceCheck("GET", "/api/turnaround/estimate", "")).toBe(false);
+ });
+
+ it("opens the price checks to guests and refuses their runs and saves with the sign-up prompt", async () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ for (const p of ["/api/turnaround/estimate", "/api/turnaround?preview=1", "/api/audio-tools?preview=1"]) expect(passed(proxy(req(p, { method: "POST" }))), p).toBe(true);
+ for (const p of ["/api/turnaround", "/api/audio-tools", "/api/audio-tools/export?offset=0"]) {
+ const r = proxy(req(p, { method: "POST" }));
+ expect(r.status, p).toBe(401);
+ expect(r.headers.get(access.GUEST_HEADER), p).toBe("1");
+ expect((await r.json()).error, p).toMatch(/free account/);
+ }
+ });
+
+ it("gives an account the price checks, Connect your GPU for the runs, and library for the Export mix", async () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ const cookie = auth.createSession(newAccount().id).value;
+ for (const p of ["/api/turnaround/estimate", "/api/turnaround?preview=1", "/api/audio-tools?preview=1"]) expect(passed(proxy(req(p, { method: "POST", cookie }))), p).toBe(true);
+ for (const p of ["/api/turnaround", "/api/audio-tools"]) {
+ const r = proxy(req(p, { method: "POST", cookie }));
+ expect(r.status, p).toBe(403);
+ expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBe("1");
+ expect((await r.json()).code, p).toBe("connect-gpu");
+ }
+ // The mix is saved to the owner's Library: a library change, whatever the GPU.
+ const save = proxy(req("/api/audio-tools/export?offset=0", { method: "POST", cookie }));
+ expect(save.status).toBe(403);
+ expect(save.headers.get(access.CONNECT_GPU_HEADER)).toBeNull();
+ expect((await save.json()).code).toBe("library");
+ });
+
+ it("runs an account's MOSS-Image on its own GPU (the studios' generations); the tools say own-gpu-tool", async () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ const a = newAccount();
+ const cookie = auth.createSession(a.id).value;
+ auth.setAccountGpu(a.id, { url: "https://gpu.example" });
+ expect(passed(proxy(req("/api/generations", { method: "POST", cookie })))).toBe(true);
+ for (const p of ["/api/turnaround", "/api/audio-tools", "/api/cinema/projects/p1/generate"]) {
+ const r = proxy(req(p, { method: "POST", cookie }));
+ expect(r.status, p).toBe(403);
+ expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBeNull();
+ expect((await r.json()).code, p).toBe("own-gpu-tool");
+ }
+ expect((await proxy(req("/api/audio-tools/export?offset=0", { method: "POST", cookie })).json()).code).toBe("library");
+ });
+
+ it("keeps the owner's runs and saves unchanged", () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ const owner = auth.createSession().value;
+ for (const p of ["/api/turnaround", "/api/turnaround/estimate", "/api/audio-tools", "/api/audio-tools/export?offset=0"]) expect(passed(proxy(req(p, { method: "POST", cookie: owner }))), p).toBe(true);
+ });
+});
+
+describe("the routes: a visitor's price is its own GPU's, and the owner's characters stay hidden", () => {
+ it("prices a guest's and an account's turnaround on their own GPU, never a demo; the owner's stays the install's", async () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ const views = { front: png("front.png"), back: png("back.png") };
+ const owner = auth.createSession().value;
+ const account = auth.createSession(newAccount().id).value;
+ for (const [who, cookie] of [
+ ["guest", undefined],
+ ["account", account],
+ ] as const) {
+ const est = await turnaroundEstimate.POST(call("/api/turnaround/estimate", { engine: "open", views }, cookie));
+ expect(est.status, who).toBe(200);
+ expect(await est.json(), who).toMatchObject({ route: "frames", demo: false, costUsd: 0, modelId: "oss-wan22-14b" });
+ const preview = await turnaround.POST(call("/api/turnaround?preview=1", { engine: "open", views }, cookie));
+ expect(preview.status, who).toBe(200);
+ expect(await preview.json(), who).toMatchObject({ route: "frames", fills: ["right", "left"], demo: false });
+ }
+ // The owner, with Demo mode on: a free demo, as before.
+ expect(await (await turnaroundEstimate.POST(call("/api/turnaround/estimate", { engine: "open", views }, owner))).json()).toMatchObject({ demo: true, costUsd: 0 });
+ });
+
+ it("never tells a visitor whether one of the owner's characters exists", async () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ const views = { front: png("ada-front.png"), back: png("ada-back.png") };
+ const el = createElement({ name: "Ada", kind: "character", references: [views.front] });
+ const owner = auth.createSession().value;
+ const account = auth.createSession(newAccount().id).value;
+ for (const cookie of [undefined, account]) {
+ for (const [route, url] of [
+ [turnaroundEstimate, "/api/turnaround/estimate"],
+ [turnaround, "/api/turnaround?preview=1"],
+ ] as const) {
+ const real = await route.POST(call(url, { engine: "open", views, elementId: el.id, consent: true }, cookie));
+ const made = await route.POST(call(url, { engine: "open", views, elementId: "no-such-id", consent: true }, cookie));
+ expect([real.status, made.status], url).toEqual([404, 404]);
+ expect((await real.json()).error).toBe("Character not found");
+ }
+ }
+ const mine = await turnaroundEstimate.POST(call("/api/turnaround/estimate", { engine: "open", views, elementId: el.id, consent: true }, owner));
+ expect(mine.status).toBe(200);
+ expect((await turnaroundEstimate.POST(call("/api/turnaround/estimate", { engine: "open", views, elementId: "no-such-id" }, owner))).status).toBe(404);
+ });
+
+ it("prices a visitor's Split soundtrack on its own GPU, never a demo", async () => {
+ process.env.FUOBE_PUBLIC_SIGNUP = "1";
+ const media = wav();
+ const body = { tool: "split", engine: "open", media, kind: "audio", name: "Film" };
+ const guest = await audioTools.POST(call("/api/audio-tools?preview=1", body));
+ expect(guest.status).toBe(200);
+ expect(await guest.json()).toMatchObject({ steps: 1, costUsd: 0, demo: false });
+ const account = await audioTools.POST(call("/api/audio-tools?preview=1", body, auth.createSession(newAccount().id).value));
+ expect(await account.json()).toMatchObject({ steps: 1, demo: false });
+ const owner = await audioTools.POST(call("/api/audio-tools?preview=1", body, auth.createSession().value));
+ expect(await owner.json()).toMatchObject({ steps: 1, demo: true });
+ });
+});
+
+describe("the GPU pre-flight board lists PR #15's tools like main's studios", () => {
+ const idx = loadIndex();
+ const row = (href: string) => STUDIO_ROWS.find((r) => r.href === href)!;
+
+ it("has a row for Split soundtrack, the fly path and the turnaround, each on graphs the requirement index knows", () => {
+ const want: Record<string, { label: string; group: string; workflows: string[]; loras?: string[] }> = {
+ "/audio/split": { label: "Split soundtrack", group: "Audio", workflows: ["separate-soundtrack-dbs"] },
+ "/cinema": { label: "Fly path", group: "Video", workflows: ["wan21-i2v-uni3c-path"] },
+ "/character-sheet": { label: "Turnaround", group: "Video", workflows: ["wan22-flf2v-14b", "qwen-image-edit-2511-multi"], loras: ["qwen-image-edit-2511-multiple-angles-lora.safetensors"] },
+ };
+ for (const [href, w] of Object.entries(want)) {
+ const r = row(href);
+ expect(r, href).toBeDefined();
+ expect({ label: r.label, group: r.group }).toEqual({ label: w.label, group: w.group });
+ const t = studioTool(r)!;
+ expect(t, href).not.toBeNull();
+ expect(t.local, href).toBeUndefined();
+ expect(t.ref).toBe(`studio:${href}`);
+ for (const wf of w.workflows) expect(t.workflows, href).toContain(wf);
+ for (const wf of t.workflows) expect(idx.workflows[wf], `${href}: ${wf}`).toBeDefined();
+ for (const l of w.loras ?? []) expect(t.loras.map((x) => x.file), href).toContain(l);
+ // The plan route takes the row's ref.
+ expect(toolFor(`studio:${href}`)?.workflows).toEqual(t.workflows);
+ }
+ // The turnaround's film joins its quarter turns.
+ expect(studioTool(row("/character-sheet"))!.workflows.some((w) => /^video-concat-\d+$/.test(w))).toBe(true);
+ expect(new Set(STUDIO_ROWS.map((r) => r.href)).size).toBe(STUDIO_ROWS.length);
+ });
+
+ it("lists MOSS-Image among the Image studio's other tools, on its own graph", () => {
+ const moss = studioOthers(row("/image")).find((t) => t.ref === "model:oss-moss-image#t2i");
+ expect(moss).toBeDefined();
+ expect(moss!.workflows).toEqual(["moss-image-t2i"]);
+ expect(idx.workflows["moss-image-t2i"]).toBeDefined();
+ expect(toolFor("model:oss-moss-image#t2i")?.local).toBeUndefined();
+ });
+
+ it("needs ComfyUI-DBS and its weights for Split soundtrack", () => {
+ const w = idx.workflows["separate-soundtrack-dbs"];
+ expect(Object.keys(w.packs)).toEqual(["ComfyUI-DBS"]);
+ expect(idx.packs["ComfyUI-DBS"]).toMatchObject({ commit: "f656e53434b5485c148a2866fbd6ddc6b6152ed6", folders: ["dbs"] });
+ expect(Object.keys(idx.files).filter((k) => k.startsWith("dbs/")).sort()).toEqual([
+ "dbs/DBS-BSRNN-DnR/config.json",
+ "dbs/DBS-BSRNN-DnR/model.safetensors",
+ "dbs/DBS-TIGER-DnR/config.json",
+ "dbs/DBS-TIGER-DnR/model.safetensors",
+ ]);
+ });
+});