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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
No Higgsfield (O7): a stored request runs where its model and operation went, on the install's engine
Claude9dac48e29bd7
diff --git a/README.md b/README.mdindex 413a1394..e9aeae42 100644--- a/README.md+++ b/README.md@@ -1,7 +1,7 @@# Fuobe**An open-source AI image, video and audio studio — a 1:1 alternative to Higgsfield.**-Use the same frontier paid models Higgsfield uses (Nano Banana Pro, Seedance 2.5, Kling 3.0, Veo 3.1, Seedream 5, GPT Image 2.5, FLUX.3, Gemini Omni, MiniMax, ElevenLabs…, and Higgsfield's own Soul and Cinema Studio) with your own fal.ai / Replicate / Higgsfield key, **or** run the equivalent open-weight workflows on your own GPU through **ComfyUI**. Same studio, same apps, same camera motions — flip one switch.+Use the same frontier paid models Higgsfield uses (Nano Banana Pro, Seedance 2.5, Kling 3.0, Veo 3.1, Seedream 5, GPT Image 2.5, FLUX.3, Gemini Omni, MiniMax, ElevenLabs…) with your own fal.ai / Replicate key, **or** run the equivalent open-weight workflows on your own GPU through **ComfyUI**. Same studio, same apps, same camera motions — flip one switch. Higgsfield's in-house models (Soul, Cinema Studio, Genjutsu…) are rebuilt as **Fuobe Originals** from open-weight models and LoRAs, on both engines, and Higgsfield is never called.- **Assist:** describe the whole job in a chat; the agent picks models, shows the plan and its cost, runs it when you approve, checks the results and chains the next step. Free / Smart / Manual modes, 20 built-in **skills** (SKILL.md playbooks, or upload your own), **projects** with instructions and up to 20 sources (links, files and PDFs, elements, notes), and **memory**. Runs on Claude, a local Ollama model, or an offline planner- **MCP:** other agents (Claude Code, Claude Desktop, any MCP client) can drive the studio through `/api/mcp`, including whole studio jobs that open in their studio (a Layers project, a Shorts session, a dub to review, a Faceless episode, an Ads Studio batch, the Captions editor, a Katana edit; Genjutsu, Remove object, Content Factory, the AI Influencer builder and Layers' Inpaint, Enhancer and Save as element aren't tools yet) and the skills as prompts. `npx skills add workingprototype/Fuobe` installs the skills in other agents@@ -23,7 +23,7 @@ Use the same frontier paid models Higgsfield uses (Nano Banana Pro, Seedance 2.5- **LoRAs:** small add-on files that give an open model a look, a camera move or an effect. **Settings → LoRAs** lists a library of 114 researched LoRAs (67 looks, 23 motions, 24 effects) with each one's licence and source, and downloads them. On the open engine, a LoRA ComfyUI doesn't have is downloaded into your LoRA folder before the run and checked against its SHA-256 fingerprint. On the cloud, seven hosted open-weight models take LoRAs: Z-Image Turbo (hosted, now on fal and Replicate) and six new ones (Qwen-Image 2512, Qwen-Image-Edit 2511, FLUX.2 [klein] 4B, Wan 2.2 A14B image and video, LTX-2.3 22B), and a LoRA a run can't carry is left out with a warning. No preset takes its LoRAs from the new library yet- **Catalog:** 200 cloud models + 85 open-source models (plus 45 hidden ones: chain steps and studio helpers, self-tests, browser tools, and Gemma 4 speech translate, which no studio uses yet), 124 apps, 108 camera motions (mix any two), 255 effects- **Open-source engine:** 139 API-format ComfyUI workflows (official templates, community packs and hand-built graphs) validated against real ComfyUI node definitions, plus 43 researched LoRAs (camera moves, VFX) that 55 motion, effect and app presets use today (a separate set from the Settings → LoRAs library)-- **Evaluation harness (for developers):** `pnpm eval:run` (or `fuobe eval`) runs a suite of cases for each planned Fuobe Original (Fuobe's own open-weight versions of Higgsfield's in-house models, such as Soul and DoP) on the demo, open or cloud engine, scores the results with pinned open models, runs a blind A/B review and says whether a recipe may become a default. No Original is in the app yet: for now the suites measure their recipes on models already in the catalog (Z-Image Turbo for Soul, Wan 2.2 for DoP…), and cases that need the Original itself are skipped. Cloud runs are priced first and capped (default $5), and nothing goes through Higgsfield. Nothing has been measured on a GPU or the cloud yet; see [`scripts/eval/README.md`](scripts/eval/README.md)+- **Evaluation harness (for developers):** `pnpm eval:run` (or `fuobe eval`) runs a suite of cases for each planned Fuobe Original (Fuobe's own open-weight versions of Higgsfield's in-house models, such as Soul and DoP) on the demo, open or cloud engine, scores the results with pinned open models, runs a blind A/B review and says whether a recipe may become a default. No Original is in the app yet: for now the suites measure their recipes on models already in the catalog (Z-Image Turbo for Soul, Wan 2.2 for DoP…), and cases that need the Original itself are skipped. Cloud runs are priced first and capped (default $5), and Higgsfield is never called. Nothing has been measured on a GPU or the cloud yet; see [`scripts/eval/README.md`](scripts/eval/README.md)- **No keys? No GPU?** Demo mode lets you click through everything with clearly-labelled placeholder outputs.> Project status, what works, what's verified and what's left: **[docs/STATUS.md](docs/STATUS.md)** (also in-app at `/status`).@@ -50,8 +50,7 @@ The mode can also be set with `FUOBE_ENGINE_MODE=both|open|cloud`. Then connect| You have | What to set | You get ||---|---|---|| A [fal.ai](https://fal.ai/dashboard/keys) key | `fal.ai API key` (or `FAL_KEY`) | Every cloud model and cloud app |-| A Replicate token | `Replicate API token` (or `REPLICATE_API_TOKEN`) | Fallback route for models Replicate hosts; **Preferred provider** (or `FUOBE_CLOUD_PROVIDER`: `auto`, `fal`, `replicate` or `higgsfield`) picks which one goes first, unless only the other can carry the run's LoRAs or make the clip length asked |-| A [Higgsfield API](https://console.higgsfield.ai) key | `Higgsfield API key` as `KEY_ID:KEY_SECRET` (or `HIGGSFIELD_API_KEY`, `HF_KEY`, or `HF_API_KEY` + `HF_API_SECRET`) | Soul 2.0 / Soul Cinema / Soul v1 with live presets, Soul ID training, Genjutsu and Genjutsu Lite, Cinema Studio 4.0, Marketing Studio, Ads Studio, plus extra routes for Seedance, Kling, Wan, MiniMax… |+| A Replicate token | `Replicate API token` (or `REPLICATE_API_TOKEN`) | Fallback route for models Replicate hosts; **Preferred provider** (or `FUOBE_CLOUD_PROVIDER`: `auto`, `fal` or `replicate`) picks which one goes first, unless only the other can carry the run's LoRAs or make the clip length asked || A GPU running ComfyUI | `ComfyUI server URL` (or `COMFYUI_URL`, default `http://127.0.0.1:8188`; `COMFYUI_TOKEN` if it sits behind a proxy) | Every open-source model, app, motion, effect and studio route || An Anthropic key | `Anthropic API key` (or `ANTHROPIC_API_KEY`) | The full **Assist** agent (Smart and Manual modes), text steps (translate, write, scripts, ad copy, brand research), prompt **Enhance** and storyboard splitting with Claude || Ollama | `Prompt enhancement` → Ollama (`OLLAMA_URL`, `OLLAMA_MODEL`, default `qwen3:8b`; `FUOBE_ENHANCE_PROVIDER`) | The same text steps and the Assist agent on a local model (tool calling) |@@ -123,7 +122,7 @@ node tests/e2e/comfyui-faceless-plus.mjs http://localhost:3000 # Ken Burns, th```bashpnpm typecheck && pnpm lint && pnpm test # TypeScript, ESLint, Vitest (133 files, 2084 tests; with uv, also the harness's Python metric tests)pnpm build # production build-pnpm gen:catalog # regenerate cloud models, Higgsfield models and presets, LoRA map, LoRA library, AI Influencer options and icon map from docs/research/*.json+pnpm gen:catalog # regenerate cloud models, studio packs, LoRA map, LoRA library, AI Influencer options, Fuobe Soul's looks, trainers and icon map from docs/research/*.jsonpnpm dev:clean # clear the Turbopack cache if the dev server gets stuck reloading or serves stale CSSnode scripts/gen-demo-3d.mjs # regenerate the demo GLB and turntable (needs ffmpeg)```@@ -169,7 +168,7 @@ node tests/e2e/eval-review.mjs # the report and blind review pag## Tech-Next.js 16 (App Router, Cache Components) · React 19 · Tailwind CSS v4 · shadcn/ui (Radix) · TanStack Query · SQLite (better-sqlite3) · zod · fal.ai queue API · Replicate predictions API · Higgsfield API · ComfyUI HTTP + WebSocket API · Anthropic SDK (Claude) · Ollama · @xyflow/react (Canvas) · @google/model-viewer + three (3D) · unpdf (PDF text) · cmdk · WebGL · server-sent events · Vitest · Playwright · Python with uv (the evaluation harness's metrics).+Next.js 16 (App Router, Cache Components) · React 19 · Tailwind CSS v4 · shadcn/ui (Radix) · TanStack Query · SQLite (better-sqlite3) · zod · fal.ai queue API · Replicate predictions API · ComfyUI HTTP + WebSocket API · Anthropic SDK (Claude) · Ollama · @xyflow/react (Canvas) · @google/model-viewer + three (3D) · unpdf (PDF text) · cmdk · WebGL · server-sent events · Vitest · Playwright · Python with uv (the evaluation harness's metrics).## License notesdiff --git a/src/app/api/generations/route.ts b/src/app/api/generations/route.tsindex c54fcfd7..fc919bd7 100644--- a/src/app/api/generations/route.ts+++ b/src/app/api/generations/route.ts@@ -2,7 +2,6 @@ import { connection } from "next/server";import { z } from "zod";import { FORMAT_INFO } from "@/lib/av/formats";import { OPERATION_LABELS, type VideoFormat } from "@/lib/catalog/types";-import { migrateRequest } from "@/lib/catalog/replaced";import { createGenerations, listGenerations, outputKind, previewGeneration } from "@/server/generations";import { ensureTrashPurge, listOptionsFrom } from "@/server/library";import { SignatureSchema } from "@/server/palettes";@@ -155,18 +154,17 @@ export async function POST(request: Request) {if (!parsed.success) {return Response.json({ error: parsed.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ") }, { status: 400 });}- // A retired model id (an older script, a saved CLI or MCP call) runs on the model that replaced it (replaced.ts).- const moved = migrateRequest(parsed.data as Parameters<typeof createGenerations>[0]);- const req = moved.request;+ // A retired model id (an older script, a saved CLI or MCP call) runs on the model that replaced it, and the notes say+ // so: previewGeneration and createGenerations move it (generations.ts currentRequest, replaced.ts).+ const req = parsed.data as Parameters<typeof createGenerations>[0];try {if (new URL(request.url).searchParams.get("preview") === "1") {const { model, ...p } = previewGeneration(req);- const notes = [...(moved.note ? [moved.note] : []), ...(p.notes ?? [])];- return Response.json({ ...p, ...(notes.length && { notes }), modelId: model.id, modelName: model.name, engine: model.engine, kind: outputKind(p.op, model), opLabel: OPERATION_LABELS[p.op] ?? p.op });+ return Response.json({ ...p, modelId: model.id, modelName: model.name, engine: model.engine, kind: outputKind(p.op, model), opLabel: OPERATION_LABELS[p.op] ?? p.op });}const items = createGenerations(req);- // What the run leaves out or changes (a LoRA that runs only on a GPU, a length the API rounds).- const notes = [...new Set([...(moved.note ? [moved.note] : []), ...items.flatMap((g) => g.notes ?? [])])];+ // What the run leaves out or changes (a model that replaced a retired one, a LoRA that runs only on a GPU, a length the API rounds).+ const notes = [...new Set(items.flatMap((g) => g.notes ?? []))];return Response.json({ items, ...(notes.length && { notes }) }, { status: 201 });} catch (e) {return Response.json({ error: (e as Error).message }, { status: 422 });diff --git a/src/components/marketing/model-info.ts b/src/components/marketing/model-info.tsindex 5a889520..212fac96 100644--- a/src/components/marketing/model-info.ts+++ b/src/components/marketing/model-info.ts@@ -29,7 +29,7 @@ const slim = (m: ModelDef): ModelInfo => ({/** Every model a marketing flow can name, by id. */export function marketingModelInfo(): Record<string, ModelInfo> {- const ids = new Set<string>(["text-llm", "oss-text-llm", "oss-qwen-image", "oss-infinitetalk-long", "ads-studio", "nano-banana-pro", "oss-qwen-edit"]);+ const ids = new Set<string>(["text-llm", "oss-text-llm", "oss-qwen-image", "oss-infinitetalk-long", "nano-banana-pro", "oss-qwen-edit"]);for (const f of Object.keys(FORMATS) as FormatId[])for (const engine of ["cloud", "open"] as const)for (const has of [{ product: true, avatar: true }, { product: false, avatar: false }]) for (const c of formatModels(FORMATS[f], engine, has)) ids.add(c.id);diff --git a/src/components/moodboards/soul-preset-cards.tsx b/src/components/moodboards/soul-preset-cards.tsxindex ef9238fb..4ae39874 100644--- a/src/components/moodboards/soul-preset-cards.tsx+++ b/src/components/moodboards/soul-preset-cards.tsx@@ -3,20 +3,24 @@import { Images, UserRoundPlus } from "lucide-react";import Link from "next/link";import { useStudio } from "@/components/studio/studio-context";+import { SOUL_MODEL_IDS } from "@/lib/catalog/soul-cards";++/** The models the cards show for: Fuobe Soul and Soul HD, which take your own look (Soul Cinema has one fixed look). */+const TAKES_OWN_LOOK = new Set<string>([SOUL_MODEL_IDS.soul, SOUL_MODEL_IDS.hd]);/**- * The empty Image studio on Soul 2.0: Higgsfield's two "Make Soul 2.0 Preset" cards — a character of- * your own (Character Sheet, then a Soul ID from its page) and a moodboard of your own. Kept free of- * the moodboard logic (and the preset list it imports): every studio page loads it.+ * The empty Image studio on Fuobe Soul: two cards for a look of your own — a character (Character Sheet, then a+ * Fuobe Soul ID from its page) and a moodboard (trained as a style LoRA). Kept free of the moodboard logic (and the+ * look list it imports): every studio page loads it.*/export function SoulPresetCards() {const { draft } = useStudio();- if (draft.modelId !== "soul-2") return null;+ if (!TAKES_OWN_LOOK.has(draft.modelId)) return null;const card ="group flex min-w-0 items-center gap-3 rounded-2xl border bg-background p-3 text-left outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50";return (- <section aria-label="Make Soul 2.0 Preset" className="mx-auto w-full max-w-[760px] px-3 pb-10">- <p className="mb-2 text-center text-[12.5px] font-medium text-muted-foreground">Make Soul 2.0 Preset</p>+ <section aria-label="Make your own Soul look" className="mx-auto w-full max-w-[760px] px-3 pb-10">+ <p className="mb-2 text-center text-[12.5px] font-medium text-muted-foreground">Make your own Soul look</p><div className="grid gap-2 sm:grid-cols-2"><Link href="/character-sheet" className={card}><span className="grid size-10 shrink-0 place-items-center rounded-xl bg-brand-faint text-brand-text">diff --git a/src/components/studio/studio-page.tsx b/src/components/studio/studio-page.tsxindex 26df094a..81909caf 100644--- a/src/components/studio/studio-page.tsx+++ b/src/components/studio/studio-page.tsx@@ -13,7 +13,7 @@ import { useEngine, useGenerations } from "@/lib/api";import { claimStartToken, followEngineDefault, handoffKey, mergeHandoff, presetModel, promptShown, START_PARAM, withoutStart } from "@/lib/composer";import { positionsFrom } from "@/lib/catalog/keyframes";import { reuseSignature, withSignatureWords } from "@/lib/catalog/palettes";-import { migrateRequest, replacedBy } from "@/lib/catalog/replaced";+import { currentModelId, migrateRequest } from "@/lib/catalog/replaced";import { matchSpokenLanguage } from "@/lib/speech-languages";import { SoulPresetCards } from "@/components/moodboards/soul-preset-cards";import type { StudioCatalog } from "@/lib/studio-catalog";@@ -42,7 +42,8 @@ function initialDraft(lookup: { getModel: (id: string) => ModelDef | undefined; getPreset: (id: string) => Preset | undefined },): Draft {const preset = sp.get("preset") ? lookup.getPreset(sp.get("preset")!) : config.preset;- const requested = sp.get("model");+ // A link or Assist hand-off that names a model Fuobe retired opens on the one that replaced it (replaced.ts).+ const requested = sp.get("model") && currentModelId(sp.get("model")!);// An app opened on one of its own models (?model=, from ⌘K) takes that model's route and params.const presetRoute = preset? ([preset.cloud, preset.open].find((r) => !!requested && r?.modelId === requested) ?? (engine === "open" ? preset.open : preset.cloud) ?? preset.cloud ?? preset.open)@@ -265,8 +266,9 @@ function StudioBody({ header, tabs }: { header?: React.ReactNode; tabs?: React.Rconst reuse = useCallback((g: Generation) => {setDraft(draftFromGeneration(g, config, catalog.getModel));- const moved = replacedBy(g.request.modelId);- if (moved) toast(moved.note);+ // A run on a model (or an operation) Fuobe retired comes back on what replaced it: say what changed.+ const moved = migrateRequest(g.request).note;+ if (moved) toast(moved);if (g.engine !== engine) setEngine(g.engine);requestAnimationFrame(() => document.querySelector<HTMLTextAreaElement>("[data-composer] textarea")?.focus());},diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.tsindex a8c1ae87..b1951863 100644--- a/src/lib/catalog/canvas.ts+++ b/src/lib/catalog/canvas.ts@@ -12,7 +12,7 @@ import { getModel, getPreset, MODELS, supportsOp } from "./index";import { dualEngine, onEngine, runsOn } from "./engines";import { chainedWaitMessage, keyframeChain } from "./keyframes";import { estimateCost, inferOperation, planGeneration, routesFor, type Plan } from "./plan";-import { replacedBy } from "./replaced";+import { replacedBy, replacementOf } from "./replaced";import {OPERATION_LABELS,OPERATION_OUTPUT,@@ -1642,26 +1642,42 @@ export function withCurrentElements(graph: CanvasGraph, elements: readonly Elemeconst NODE_TYPES = new Set(Object.keys(NODE_SPECS));/**- * A node saved on a model Fuobe retired (src/lib/catalog/replaced.ts) moves to the one that replaced it, keeping the- * settings it offers; an Original runs in the cloud, where the retired model ran.+ * The operation a node on a retired model ran: its own, else what the retired model read connected images or elements+ * as (Cinema Studio took them as references, Replacement.withReferences).*/-function currentNode(n: CanvasNode): CanvasNode {- const to = replacedBy(n.data.modelId);+function storedOp(graph: CanvasGraph, n: CanvasNode): Operation | undefined {+ if (n.data.op) return n.data.op;+ const by = replacedBy(n.data.modelId)?.withReferences;+ return by && graph.edges.some((e) => e.target === n.id && (e.targetHandle === "images" || e.targetHandle === "elements")) ? by : undefined;+}++/**+ * A node saved on a model (or a model's operation) Fuobe retired when it stopped calling Higgsfield (replaced.ts)+ * moves to the one that does it now, keeping the settings it offers. A board picks a node's engine itself (nodeEngine+ * follows the install's engine mode first), so an Original keeps the cloud, where the retired model ran with your key.+ */+function currentNode(graph: CanvasGraph, n: CanvasNode): CanvasNode {+ const op = storedOp(graph, n);+ const to = n.data.modelId ? replacementOf(n.data.modelId, op) : undefined;const m = to && getModel(to.id);if (!m) return n;- return { ...n, data: { ...n.data, modelId: m.id, params: sanitizeParams(m, n.data.params), engine: dualEngine(m) ? (n.data.engine ?? "cloud") : undefined } };+ const runs = to.op ?? op;+ return {+ ...n,+ data: { ...n.data, modelId: m.id, ...(runs && { op: runs }), params: sanitizeParams(m, n.data.params), engine: dualEngine(m) ? (n.data.engine ?? "cloud") : undefined },+ };}/** A stored board with its nodes on retired models moved to the ones that replaced them (read before any save). */export const withCurrentModels = (graph: CanvasGraph): CanvasGraph =>- graph.nodes.some((n) => replacedBy(n.data.modelId)) ? { ...graph, nodes: graph.nodes.map(currentNode) } : graph;+ graph.nodes.some((n) => !!n.data.modelId && !!replacementOf(n.data.modelId, storedOp(graph, n))) ? { ...graph, nodes: graph.nodes.map((n) => currentNode(graph, n)) } : graph;/*** Drop unknown node types, dangling edges and edges into handles that don't exist (after a model or op change), and* move nodes on a retired model to the one that replaced it.*/export function cleanGraph(graph: CanvasGraph): CanvasGraph {- const nodes = graph.nodes.filter((n) => NODE_TYPES.has(n.type)).map(currentNode);+ const nodes = graph.nodes.filter((n) => NODE_TYPES.has(n.type)).map((n) => currentNode(graph, n));const g: CanvasGraph = { ...graph, nodes, edges: [] };const ids = new Set(nodes.map((n) => n.id));const seen = new Set<string>();diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.tsindex 2eb0925b..ef7ab740 100644--- a/src/lib/catalog/cinema.ts+++ b/src/lib/catalog/cinema.ts@@ -1066,6 +1066,28 @@ export function compileDirector(input: CompileInput): CompiledDirector {return { prompt: text ? `${text}.` : "", extra };}+/**+ * Cinema Studio 4.0's own Director fields, as a request stored before Fuobe stopped calling its API carried them+ * (params.extra: compileDirector's native target), in words for any other model: what compileDirector's prompt target+ * writes for the same picks. A slug Fuobe doesn't know is left out. The server reads it when it moves such a request to+ * the model that replaced it (src/lib/catalog/replaced.ts).+ */+export function directorFieldWords(fields: Record<string, string>): string {+ const preset = (slug: string) => ({ kind: "preset" as const, slug });+ const settings: DirectorSettings = {+ genre: fields.genre,+ era: fields.era,+ tempo: fields.pacing,+ camera: fields.camera_model,+ lens: fields.camera_lens,+ aperture: fields.camera_aperture,+ lighting: fields.light ? preset(fields.light) : null,+ palette: fields.color_palette ? preset(fields.color_palette) : null,+ };+ const moves = fields.camera_movement ? [fields.camera_movement] : [];+ return compileDirector({ prompt: "", settings, moves, mode: "video", target: "prompt" }).prompt;+}+/** "Noir · 80s · Calm" — the Director chips' summary. */export function directorSummary(s: DirectorSettings): string[] {return [diff --git a/src/lib/catalog/packs.ts b/src/lib/catalog/packs.tsindex 6f7ce340..aa819399 100644--- a/src/lib/catalog/packs.ts+++ b/src/lib/catalog/packs.ts@@ -354,8 +354,11 @@ export type PhotoSubject =/** What the server knows about this install, for planning. */export interface PlanCaps {- /** Models this install has (open-source workflows can be missing). */- has?: (id: string) => boolean;+ /**+ * Models this install has (open-source workflows can be missing) and offers (Settings → Models & licences); with+ * `engine`, a Fuobe Original's half on that engine.+ */+ has?: (id: string, engine?: Engine) => boolean;}/** Fuobe Soul: a character with a trained Soul ID makes its photos there, on either engine (build plan O3). */@@ -759,7 +762,7 @@ export function sheetFromReference(images: string[], engine: Engine, details?: s*/export function castSheetModel(engine: Engine, caps: PlanCaps): string {if (engine === "open") return !caps.has || caps.has("oss-zimage-soul-cast") ? "oss-zimage-soul-cast" : "oss-z-image-turbo";- return !caps.has || caps.has(SOUL_MODEL_IDS.soul) ? SOUL_MODEL_IDS.soul : "nano-banana-pro";+ return !caps.has || caps.has(SOUL_MODEL_IDS.soul, "cloud") ? SOUL_MODEL_IDS.soul : "nano-banana-pro";}/** Soul Cast fields that only make sense for some answers (mirrors SOUL_CAST_FIELDS[].when in cinema.ts). */diff --git a/src/lib/catalog/replaced.ts b/src/lib/catalog/replaced.tsindex f2798be1..d73dec17 100644--- a/src/lib/catalog/replaced.ts+++ b/src/lib/catalog/replaced.ts@@ -13,6 +13,17 @@* Pure and browser-safe (cards only, no recipes); shared by the browser and the server. tests/no-higgsfield.test.ts checks every target exists.*/import { lookCard } from "./soul-cards";+import type { Operation } from "./types";++/** Where one operation of a retired (or partner) model went, when the replacement doesn't do it under the same name. */+export interface OpReplacement {+ /** Another model that does it (else the replacement's own). */+ id?: string;+ /** The operation's name there (else the same). */+ op?: Operation;+ /** One line on what changed, instead of the model's note. */+ note?: string;+}export interface Replacement {/** The model (or training target) that does the job now. */@@ -21,8 +32,18 @@ export interface Replacement {was: string;/** One line on what changed, shown where an old setup or run is opened again. */note: string;- /** A Fuobe Original (both engines): a stored cloud run stays in the cloud unless it says otherwise. */+ /**+ * A Fuobe Original (both engines). A stored request names no engine (the retired model ran in the cloud only because+ * its provider was a cloud API), so it runs where the install runs an Original: its engine mode, else the first+ * engine connected (GenerationRequest.engine).+ */original?: true;+ /** Operations the replacement doesn't do under the same name. */+ ops?: Partial<Record<Operation, OpReplacement>>;+ /** The operation a stored request with images or clips and no op ran as (the retired model read them that way). */+ withReferences?: Operation;+ /** Its request carried Cinema Studio's own Director fields (genre, era, lens…): they become prompt words. */+ director?: true;}/** Retired model id → the model that replaced it. */@@ -30,10 +51,21 @@ export const REPLACED_BY: Readonly<Record<string, Replacement>> = {"soul-1": { id: "fuobe-soul", was: "Soul (Higgsfield)", note: "Soul now runs as Fuobe Soul, with Soul's 106 looks on open weights", original: true },"soul-2": { id: "fuobe-soul", was: "Soul 2.0 (Higgsfield)", note: "Soul 2.0 now runs as Fuobe Soul, with Soul 2.0's 33 looks on open weights", original: true },"soul-cinema": { id: "fuobe-soul-cinema", was: "Soul Cinema (Higgsfield)", note: "Soul Cinema now runs as Fuobe Soul Cinema on open weights", original: true },- "cinema-studio-4": { id: "fuobe-cinema", was: "Cinema Studio 4.0 (Higgsfield)", note: "Cinema Studio's clips now run on Fuobe Cinema, with the Director panel compiled into the run", original: true },+ "cinema-studio-4": {+ id: "fuobe-cinema",+ was: "Cinema Studio 4.0 (Higgsfield)",+ note: "Cinema Studio's clips now run on Fuobe Cinema, with the Director settings written into the prompt",+ original: true,+ director: true,+ // It had no start-frame route: images were references (cast, location). Fuobe Cinema takes none yet, so a reference+ // take runs where the Cinema studio sends one (cinema.ts clipModel): Seedance 2.5, a partner model on fal.+ withReferences: "ref2v",+ ops: { ref2v: { id: "seedance-2-5", note: "Cinema Studio's reference takes now run on Seedance 2.5 (Fuobe Cinema takes no references yet), with the Director settings written into the prompt" } },+ },"genjutsu-motion-transfer": { id: "fuobe-genjutsu-motion", was: "Genjutsu Motion Transfer (Higgsfield)", note: "Motion transfer now runs on Fuobe Genjutsu (Wan Animate)", original: true },"genjutsu-lite-motion-transfer": { id: "fuobe-genjutsu-motion-lite", was: "Genjutsu Lite Motion Transfer (Higgsfield)", note: "Motion transfer Lite now runs on Fuobe Genjutsu Lite", original: true },- "genjutsu-object-swap": { id: "fuobe-genjutsu-swap", was: "Genjutsu Object Swap (Higgsfield)", note: "Object swap now runs on Fuobe Genjutsu (SAM 3.1 + Wan VACE)", original: true },+ // Its v2v and video-swap routes were the same endpoint.+ "genjutsu-object-swap": { id: "fuobe-genjutsu-swap", was: "Genjutsu Object Swap (Higgsfield)", note: "Object swap now runs on Fuobe Genjutsu (SAM 3.1 + Wan VACE)", original: true, ops: { v2v: { op: "video-swap" } } },"genjutsu-lite-object-swap": { id: "fuobe-genjutsu-swap-lite", was: "Genjutsu Lite Object Swap (Higgsfield)", note: "Object swap Lite now runs on Fuobe Genjutsu Lite", original: true },"genjutsu-restyle": { id: "fuobe-genjutsu-restyle", was: "Genjutsu Restyle (Higgsfield)", note: "Restyle now runs on Fuobe Genjutsu with a Fuobe look", original: true },// O10 builds Fuobe's own Marketing image on Qwen-Image-Edit; until then the partner model Higgsfield ran underneath.@@ -50,36 +82,104 @@ export const TRAINING_REPLACED_BY: Readonly<Record<string, Replacement>> = {"soul-id-cinema": { id: "fal-z-image", was: "Soul ID for Soul Cinema (Higgsfield)", note: "Train the character again for Fuobe Soul on the same photos" },};+/**+ * Operations of current partner models that only the retired provider ran (build plan, "What replaces each Higgsfield+ * model": the lost ops) → the model that does them now.+ */+export const OPS_REPLACED_BY: Readonly<Record<string, Partial<Record<Operation, OpReplacement>>>> = {+ // bytedance/seedance-2.5/video-edit isn't on fal: Kling O3's edit takes the clip and @images the same way.+ "seedance-2-5": { v2v: { id: "kling-o3", note: "Seedance 2.5's video edit isn't offered any more: this edit runs on Kling O3" } },+ // LTX-2.3 on fal takes an end frame (end_image_url): Fuobe Cinema's start/end-frame route, on either engine.+ "ltx-2-5": { flf2v: { id: "fuobe-cinema", note: "LTX 2.5's start/end-frame clip isn't offered any more: it runs on Fuobe Cinema (LTX-2.3)" } },+};+/** The replacement of a retired model id, or undefined for a current one. */export const replacedBy = (id: string | undefined | null): Replacement | undefined => (id && Object.hasOwn(REPLACED_BY, id) ? REPLACED_BY[id] : undefined);/** The id to use for a stored model id: its replacement when it was retired, else itself. */export const currentModelId = (id: string): string => replacedBy(id)?.id ?? id;+/**+ * Where a stored model and operation run now: the retired model's replacement (with the operation's own target when+ * it has one, OpReplacement), or a current partner model's lost operation (OPS_REPLACED_BY). Undefined when nothing+ * changed. `op` is set only when it changes.+ */+export function replacementOf(modelId: string, op?: Operation): { id: string; op?: Operation; note: string; original: boolean } | undefined {+ const r = replacedBy(modelId);+ if (!r) {+ const lost = op && Object.hasOwn(OPS_REPLACED_BY, modelId) ? OPS_REPLACED_BY[modelId][op] : undefined;+ return lost && { id: lost.id ?? modelId, ...(lost.op && { op: lost.op }), note: lost.note ?? `${modelId} now runs ${op} elsewhere`, original: false };+ }+ const moved = op ? r.ops?.[op] : undefined;+ return { id: moved?.id ?? r.id, ...(moved?.op && { op: moved.op }), note: moved?.note ?? r.note, original: !moved?.id && !!r.original };+}+/** The settings keys a retired model's request carried that mean nothing to its replacement (style ids, Soul ID refs, looks). */const RETIRED_EXTRA = ["style_id", "custom_reference_id", "custom_reference_strength", "preset_id", "color_palette", "template_id"] as const;+/** Cinema Studio 4.0's own Director fields (params.extra): words for any other model (cinema.ts directorFieldWords). */+export const DIRECTOR_FIELDS = ["genre", "era", "pacing", "camera_model", "camera_lens", "camera_aperture", "light", "color_palette", "camera_movement"] as const;+interface StoredRequest {modelId: string;- engine?: "cloud" | "open";+ op?: Operation;+ prompt?: string;presetId?: string;+ inputs?: { images?: string[]; videos?: string[]; audios?: string[] };params?: { extra?: Record<string, unknown> };}+export interface MigrateOptions {+ /**+ * Cinema Studio's Director fields as prompt words (the server passes cinema.ts directorFieldWords; without it, as in+ * the browser, the fields are dropped).+ */+ directorWords?: (fields: Record<string, string>) => string;+}++const sentence = (a: string | undefined, b: string): string => {+ const head = (a ?? "").trim().replace(/[.\s]+$/, "");+ return head ? `${head}. ${b}` : b;+};+/**- * A stored request (Reuse, a saved project's step, an Assist plan) moved to the model that replaced its own, with what- * still means something kept: a Soul style id becomes the Fuobe look that replaced it (`presetId`), the retired API's- * own settings (style, Soul ID reference, palette slug, Genjutsu look) are dropped. A current model's request is- * returned as it is. `note` says what changed, for a toast.+ * A stored request (Reuse, a saved project's step, an Assist plan, a retry, a script) moved to the model that does its+ * job now, with what still means something kept: a Soul style id becomes the Fuobe look that replaced it (`presetId`),+ * Cinema Studio's Director fields become prompt words, the retired API's own settings (style, Soul ID reference, Genjutsu+ * look) are dropped, and an operation the replacement doesn't do goes where OpReplacement says (also for the partner+ * models' lost ops, OPS_REPLACED_BY). An Original gets no engine: the install picks it. A current model's request is+ * returned as it is. `note` says what changed, for a toast or the API's notes.*/-export function migrateRequest<T extends StoredRequest>(req: T): { request: T; note?: string } {+export function migrateRequest<T extends StoredRequest>(req: T, opts: MigrateOptions = {}): { request: T; note?: string } {const r = replacedBy(req.modelId);- if (!r) return { request: req };+ const refs = !!(req.inputs?.images?.length || req.inputs?.videos?.length || req.inputs?.audios?.length);+ const op = req.op ?? (r?.withReferences && refs ? r.withReferences : undefined);+ const to = replacementOf(req.modelId, op);+ if (!to) return { request: req };+ const newOp = to.op ?? op;+ if (!r) return { request: { ...req, modelId: to.id, ...(newOp && newOp !== req.op && { op: newOp }) } as T, note: to.note };const extra = { ...(req.params?.extra ?? {}) };const look = typeof extra.style_id === "string" ? lookCard(extra.style_id) : undefined;+ let prompt = req.prompt;+ if (r.director) {+ const fields: Record<string, string> = {};+ for (const k of DIRECTOR_FIELDS) {+ if (typeof extra[k] === "string" && extra[k]) fields[k] = extra[k] as string;+ delete extra[k];+ }+ const words = Object.keys(fields).length && opts.directorWords ? opts.directorWords(fields).trim() : "";+ if (words) prompt = sentence(prompt, words);+ }for (const k of RETIRED_EXTRA) delete extra[k];const params = req.params ? { ...req.params, ...(req.params.extra && { extra }) } : undefined;if (params?.extra && !Object.keys(params.extra).length) delete params.extra;- const request = { ...req, modelId: r.id, ...(params && { params }), ...(look && { presetId: look.id }), ...(r.original && { engine: req.engine ?? "cloud" }) };- return { request, note: r.note };+ const request = {+ ...req,+ modelId: to.id,+ ...(newOp && newOp !== req.op && { op: newOp }),+ ...(params && { params }),+ ...(look && { presetId: look.id }),+ ...(prompt !== req.prompt && { prompt }),+ } as T;+ return { request, note: to.note };}diff --git a/src/server/assist/tools.ts b/src/server/assist/tools.tsindex 470fa143..0a3e02ef 100644--- a/src/server/assist/tools.ts+++ b/src/server/assist/tools.ts@@ -13,7 +13,7 @@ import { loraFamily, runsSomewhere, TRAINING_FAMILIES } from "@/lib/catalog/traiimport type { ElementLora } from "@/lib/catalog/elements";import { createPipeline } from "../chains";import { listElements } from "../elements";-import { createGenerations, getGeneration, listGenerations, outputKind, previewChained, previewGeneration } from "../generations";+import { createGenerations, currentRequest, getGeneration, listGenerations, outputKind, previewChained, previewGeneration } from "../generations";import { provider } from "../providers";import { llmBackends } from "../providers/llm";import { engineMode } from "../settings";@@ -306,10 +306,17 @@ const engineOf = (ctx: ToolContext): "cloud" | "open" => (engineMode() === "both/*** A job as a request; `engine` is the user's, which a Fuobe Original (both engines) runs on unless the job names one.- * A retired model id (an older plan, an MCP client's saved call) runs on the model that replaced it (replaced.ts).+ * A retired model id or operation (an older plan, an MCP client's saved call) runs where it went (replaced.ts), so the+ * chain slots and checks below see the model and operation that run.*/function toRequest(job: JobInput, engine?: "cloud" | "open"): GenerationRequest {- const j = { ...job, model_id: currentModelId(job.model_id) };+ const req = currentRequest(asRequest(job)).request;+ const original = engine && dualEngine(getModel(req.modelId));+ return { ...req, ...((job.engine ?? (original ? engine : undefined)) && { engine: job.engine ?? engine }) };+}++/** A job as the request it names, before a retired model or operation is moved (toRequest). */+function asRequest(j: JobInput): GenerationRequest {const inputs = {...(j.images?.length && { images: j.images }),...(j.end_image && { endImage: j.end_image }),@@ -318,12 +325,11 @@ function toRequest(job: JobInput, engine?: "cloud" | "open"): GenerationRequest...(j.background_audio && { audio2: j.background_audio }),...(j.voice_audio && { voiceAudio: j.voice_audio }),};- const shots = j.shots && j.shots > 1 ? shotList(getModel(j.model_id), j.shots) : undefined;+ const shots = j.shots && j.shots > 1 ? shotList(getModel(currentModelId(j.model_id)), j.shots) : undefined;return {feature: "assist",modelId: j.model_id,...(j.look && { presetId: j.look }),- ...((j.engine ?? (engine && dualEngine(getModel(j.model_id)) ? engine : undefined)) && { engine: j.engine ?? engine }),op: j.op as Operation | undefined,prompt: j.prompt,negativePrompt: j.negative_prompt,diff --git a/src/server/generations.ts b/src/server/generations.tsindex be07b970..900a06f7 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -4,7 +4,8 @@ import path from "node:path";import { nanoid } from "nanoid";import { getModel, getPreset } from "@/lib/catalog";import { applyMentions } from "@/lib/catalog/elements";-import { replacedBy } from "@/lib/catalog/replaced";+import { migrateRequest, replacedBy } from "@/lib/catalog/replaced";+import { directorFieldWords } from "@/lib/catalog/cinema";import { withSignatureWords } from "@/lib/catalog/palettes";import { applySketch, stripMotionPaths } from "@/lib/catalog/sketch";import { cueText, type Cue } from "@/lib/cues";@@ -42,7 +43,7 @@ import { pollTrainings } from "./training";import { createExtendChain, createKeyframeFilm, createRelitClip, createShotFilm, createStillTo3d } from "./chains";import { enhancePrompt, enhanceSoulWords } from "./enhance";import { setResolver, watchGenerations, type LiveEvent } from "./live";-import { provider } from "./providers";+import { provider, PROVIDERS, RETIRED_PROVIDER_ERROR } from "./providers";import { comfyLoraFiles, probeComfy } from "./providers/comfyui";import { graphLoras } from "@/lib/catalog/character-swap";import { ensureLorasOnComfy, prepareCloudLoras, withoutUnreachableCivitai } from "./loras";@@ -442,6 +443,15 @@ setResolver((ids) =>// ---------------------------------------------------------------------------// Create+/**+ * A request as it runs now: one that names a model (or an operation) Fuobe retired when it stopped calling Higgsfield moves+ * to what replaced it (src/lib/catalog/replaced.ts), with Cinema Studio's Director fields in words. Every way in goes+ * through it (the API, a retry, a waiting step, a saved project's run); `note` says what changed.+ */+export function currentRequest(req: GenerationRequest): { request: GenerationRequest; note?: string } {+ return migrateRequest(req, { directorWords: directorFieldWords });+}+/*** The engine a model runs a request on: a Fuobe Original runs on the engine asked for (the composer's switch), else* the engine mode, else the first one connected; any other model on its own.@@ -548,9 +558,12 @@ const MADE_LENGTH_OPS = new Set<Operation>(["t2v", "i2v", "flf2v", "ref2v", "ext/** What a request would run as — model, operation, job count and cost — without starting it. */-export function previewGeneration(req: GenerationRequest) {- const { plan, route, demo, providerId, cost, notes, asked, unreachable, switchedOff } = prepare(req);- const fitted = routeLoras(route, asked.filter((l) => !unreachable.includes(l)));+export function previewGeneration(asked: GenerationRequest) {+ const moved = currentRequest(asked);+ const prepared = prepare(moved.request);+ const { plan, route, demo, providerId, cost, asked: askedLoras, unreachable, switchedOff } = prepared;+ const notes = moved.note ? [moved.note, ...prepared.notes] : prepared.notes;+ const fitted = routeLoras(route, askedLoras.filter((l) => !unreachable.includes(l)));const loras = {...fitted,dropped: [...switchedOff, ...unreachable.map((l) => ({ file: l.file, reason: "it downloads from civitai, which needs your civitai key (Settings → LoRAs)" })), ...fitted.dropped],@@ -596,7 +609,10 @@ export interface CreateOptions {const depIds = (v: string | null): string[] => (!v ? [] : v.startsWith("[") ? (JSON.parse(v) as string[]) : [v]);-export function createGenerations(original: GenerationRequest, opts: CreateOptions = {}): Generation[] {+export function createGenerations(asked: GenerationRequest, opts: CreateOptions = {}): Generation[] {+ // A retired model or operation (a retry, an old script, a saved project) runs on what replaced it, and says so.+ const moved = currentRequest(asked);+ const original = moved.request;// Open models make multi-shot films shot by shot, then join the clips. A Fuobe Original is taken on the engine it runs// on (Fuobe DoP's Frames mode is a GPU chain).// A model (or an Original's engine asked for) switched off in Settings → Models & licences is refused here, before a@@ -624,7 +640,8 @@ export function createGenerations(original: GenerationRequest, opts: CreateOptioconst 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.const p = waits ? prepare(withChainInputs(original, slotsFor(original, deps.length).map(placeholderFor))) : prepare(original);- const { req, plan, route, demo, providerId, cost, notes } = p;+ const { req, plan, route, demo, providerId, cost } = p;+ const notes = moved.note ? [moved.note, ...p.notes] : p.notes;// A chained route is built from its inputs when it's created; it can't wait for another step's output.if (waits && route.chained) throw new Error(chainedWaitMessage(plan.model.name, plan.op));const jobs = waits ? 1 : plan.jobs;@@ -916,7 +933,9 @@ async function advanceDependents(): Promise<void> {const rows = db().prepare(READY_DEPENDENTS).all(50 + submitting().size) as Row[];for (const r of rows) {if (submitting().has(r.id)) continue;- const stored = JSON.parse(r.request_json) as GenerationRequest;+ // A step queued before its model was retired runs on what replaced it (and its row says so).+ const moved = currentRequest(JSON.parse(r.request_json) as GenerationRequest);+ const stored = moved.request;const allIds = depIds(r.depends_on);const allSlots = slotsFor(stored, allIds.length);const allDeps = allIds.map(@@ -971,6 +990,7 @@ async function advanceDependents(): Promise<void> {if (mode.error) throw new Error(mode.error);const p = mode.forceDemo ? { ...prepared, demo: true, providerId: "mock" as const, cost: 0 } : prepared;update(r.id, {+ ...(moved.note && { model_id: p.plan.model.id, engine: p.plan.model.engine }),provider: p.providerId,op: p.plan.op,kind: outputKind(p.plan.op, p.plan.model),@@ -1249,7 +1269,9 @@ function pollContext(r: Row, model: NonNullable<ReturnType<typeof getModel>>): Pasync function pollOne(r: Row): Promise<void> {const model = getModel(r.model_id);if (!model) {- update(r.id, { status: "failed", error: `Model ${r.model_id} no longer exists`, completed_at: Date.now() });+ // A job on a model Fuobe retired with its provider (replaced.ts) can't be collected: Reuse runs it on the replacement.+ const retired = !!replacedBy(r.model_id) || !Object.hasOwn(PROVIDERS, r.provider);+ update(r.id, { status: "failed", error: retired ? RETIRED_PROVIDER_ERROR : `Model ${r.model_id} no longer exists`, completed_at: Date.now(), message: null });return;}// The clock runs from when the provider got the job (and from when it started it), not from creation:diff --git a/src/server/photodump.ts b/src/server/photodump.tsindex ec8d598b..47e83936 100644--- a/src/server/photodump.ts+++ b/src/server/photodump.ts@@ -21,7 +21,7 @@ import type { Engine, Generation, GenerationRequest } from "@/lib/catalog/types"import { createPipeline } from "./chains";import { db } from "./db";import { getElement } from "./elements";-import { createGenerations, getGeneration, pickOutput, previewGeneration } from "./generations";+import { createGenerations, currentRequest, getGeneration, pickOutput, previewGeneration } from "./generations";import { trashGenerations } from "./library";import { engineMode } from "./settings";import { isOffered } from "./model-access";@@ -81,7 +81,7 @@ export function deleteUserPack(id: string): boolean {/** What this install can do, for the pure planners. */export function planCaps(): PlanCaps {- return { has: (id) => !!getModel(id) && isOffered(id) };+ return { has: (id, engine) => !!getModel(id) && isOffered(id, engine) };}/** The engine a run uses: the one asked for, unless Settings locks the other. */@@ -192,6 +192,9 @@ export function retryPhoto(id: string): Generation[] {if (!g) throw new Error("That photo is gone");if (!RETRY_FEATURES.has(g.feature)) throw new Error("This result isn't part of a photo run");if (g.status !== "failed" && g.status !== "canceled") throw new Error("Only a failed or canceled photo can be retried");+ // A photo made on a model Fuobe retired (Soul 2.0 for a Cast sheet, the AI Influencer app's model) runs again on the+ // one that replaced it (src/lib/catalog/replaced.ts), sized for that model.+ const request = currentRequest(g.request).request;// A chained photo (the AI Influencer builder's face pass) whose earlier step failed never got that step's// image: both run again, chained as before.const deps = dependsOn(id);@@ -201,8 +204,8 @@ export function retryPhoto(id: string): Generation[] {if (deps.length !== 1 || !step || dependsOn(step.id).length || (step.status !== "failed" && step.status !== "canceled")) throw new Error("The step before it didn't finish — press Generate to run both again");const { items } = createPipeline([- { key: "before", request: step.request },- { key: "photo", request: g.request, after: "before" },+ { key: "before", request: currentRequest(step.request).request },+ { key: "photo", request, after: "before" },],g.batchId ? { batchId: g.batchId } : {},);@@ -212,11 +215,11 @@ export function retryPhoto(id: string): Generation[] {// Its earlier steps finished, but it never launched (it failed or was canceled while it waited): it waits// for them again, so the runner hands it their outputs (the sheet goes in as image 1) and launches it.if (deps.length && !gotChainInputs(g, before as Generation[])) {- const items = createGenerations(fitted(g.request), { ...(g.batchId && { batchId: g.batchId }), dependsOn: deps });+ const items = createGenerations(fitted(request), { ...(g.batchId && { batchId: g.batchId }), dependsOn: deps });trashGenerations([id]);return items;}- const req = fitted(g.request);+ const req = fitted(request);const p = previewGeneration(req);const per = p.jobs > 1 ? Math.max(1, Math.round(p.outputs / p.jobs)) : undefined;const items = createGenerations(per ? { ...req, params: { ...req.params, numOutputs: per } } : req, g.batchId ? { batchId: g.batchId } : {});diff --git a/tests/marketing-catalog.test.ts b/tests/marketing-catalog.test.tsindex 0586b168..469ce12c 100644--- a/tests/marketing-catalog.test.ts+++ b/tests/marketing-catalog.test.ts@@ -59,7 +59,7 @@ describe("marketing catalog", () => {it("routes every format to models that exist and do the job, on both engines", () => {for (const id of Object.keys(FORMATS) as FormatId[]) {for (const engine of ["cloud", "open"] as const) {- for (const has of [{ product: true, avatar: false, higgsfield: true }, { product: false, avatar: true, higgsfield: false }]) {+ for (const has of [{ product: true, avatar: false }, { product: false, avatar: true }]) {const list = formatModels(FORMATS[id], engine, has);expect(list.length, `${id}/${engine}`).toBeGreaterThan(0);for (const c of list) {diff --git a/tests/no-higgsfield.test.ts b/tests/no-higgsfield.test.tsindex 6bd83b1e..2a0f910f 100644--- a/tests/no-higgsfield.test.ts+++ b/tests/no-higgsfield.test.ts@@ -17,26 +17,59 @@ process.env.COMFYUI_URL = "http://127.0.0.1:9";const { MODELS, getModel } = await import("@/lib/catalog");const { enginesOf } = await import("@/lib/catalog/engines");-const { REPLACED_BY, TRAINING_REPLACED_BY, currentModelId, migrateRequest, replacedBy } = await import("@/lib/catalog/replaced");+const { DIRECTOR_FIELDS, OPS_REPLACED_BY, REPLACED_BY, TRAINING_REPLACED_BY, currentModelId, migrateRequest, replacedBy, replacementOf } = await import("@/lib/catalog/replaced");+const { directorFieldWords } = await import("@/lib/catalog/cinema");+const { routesFor } = await import("@/lib/catalog/plan");+const { castSheetModel } = await import("@/lib/catalog/packs");const { TRAINING_TARGETS } = await import("@/lib/catalog/training");const { SOUL_LEGACY_IDS } = await import("@/lib/catalog/soul-looks.generated");const { PROVIDER_SETTINGS } = await import("@/lib/connections");const { PROVIDERS, provider, RETIRED_PROVIDER_ERROR } = await import("@/server/providers");-const { SETTINGS, getSetting } = await import("@/server/settings");+const { SETTINGS, getSetting, setSetting } = await import("@/server/settings");const { db } = await import("@/server/db");const { withCurrentModels } = await import("@/lib/catalog/canvas");const generationsRoute = await import("@/app/api/generations/route");-const { getGeneration, listGenerations } = await import("@/server/generations");+const { currentRequest, ensureRunner, getGeneration, listGenerations, previewGeneration } = await import("@/server/generations");+const { planCaps, retryPhoto } = await import("@/server/photodump");+const assistTools = await import("@/server/assist/tools");+const { saveFile } = await import("@/server/storage");afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));+let rows = 0;+/** A generation row as one stored before the switch reads (the retired model and provider, as it was left). */+function storedRow(r: { feature: string; model: string; provider: string; op: string; kind?: string; status: string; request: object; externalId?: string; dependsOn?: string; outputs?: object[] }): string {+ const id = `old-${++rows}`;+ const now = Date.now();+ db()+ .prepare(+ `INSERT INTO generations (id, feature, model_id, engine, provider, op, kind, status, request_json, outputs_json, external_id, depends_on, created_at, updated_at)+ VALUES (?, ?, ?, 'cloud', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,+ )+ .run(id, r.feature, r.model, r.provider, r.op, r.kind ?? "image", r.status, JSON.stringify(r.request), JSON.stringify(r.outputs ?? []), r.externalId ?? null, r.dependsOn ?? null, now, now);+ return id;+}++/** Run the background runner until `done` holds (its own timer may be mid-tick). */+async function runUntil(done: () => boolean) {+ ensureRunner();+ for (let i = 0; i < 100 && !done(); i++) {+ await globalThis.__fuobeRunner!.tick();+ await new Promise((r) => setTimeout(r, 20));+ }+}+const ROOT = path.resolve(__dirname, "..");// ---------------------------------------------------------------------------// The guard: no code path names the provider-/** Where code and shipped content live (docs/ holds the research, which stays). */-const SCANNED = ["src", "scripts", "bin", "skills", "workflows", "package.json"];+/**+ * Where code and shipped content live, and the README's setup steps (docs/ holds the research, which stays). The+ * unmerged round-4 docs branches (claude/fuobe-r4-batch-4, claude/fuobe-r4-docs-3, origin/main) still add README lines+ * offering a Higgsfield key and generating "Higgsfield models and presets": merging one fails here until they go.+ */+const SCANNED = ["src", "scripts", "bin", "skills", "workflows", "package.json", "README.md"];const TEXT = /\.(ts|tsx|mts|js|mjs|cjs|py|json|md|sh|bat|ps1|css|html|txt|yml|yaml)$/;/**@@ -59,10 +92,21 @@ const RULES: [string, RegExp][] = [["offers the provider in copy",// ("as on Higgsfield" and "Higgsfield's old style ids" are comparisons and history, not an offer.)- /higgsfield (api|key|account|balance|route|provider|credit|console)|(needs|with|connect|add|set) (a |an |your )?higgsfield(?!'s)\b|(?<!as )\b(on|via|through) higgsfield\b|higgsfield's (api|own models?|route|key)|higgsfield (soul|cinema studio|ads studio|marketing studio)/i,+ /higgsfield (api|key|account|balance|route|provider|credit|console)|(needs|with|connect|add|set) (a |an |your )?higgsfield(?!'s)\b|(?<!as )\b(on|via|through) higgsfield\b|higgsfield's (api|own models?|route|key)|higgsfield (soul|cinema studio|ads studio|marketing studio)|higgsfield (models and )?presets\b/i,],+ // An identifier in any case: HiggsfieldProvider, viaHiggsfield, HIGGSFIELD_… (the env rule) — never history.+ ["names the provider in an identifier", /[A-Za-z0-9_$]Higgsfield|Higgsfield[A-Z0-9_$]/],+ // A choice, label or route named after it: { value: "Higgsfield" }, label: "Higgsfield first", provider: "Higgsfield".+ ["offers the provider as a value or label", /\b(label|value|provider|vendor|name|title|placeholder|engine|route)\s*:\s*["'`][^"'`]*\bhiggsfield\b/i],+ // Copy that says something runs on it: "Runs with Higgsfield's Soul", "rendered by Higgsfield", "Uses Higgsfield to render"+ // ("uses Higgsfield's labels" is a comparison).+ ["says something runs on the provider", /\b(runs? (with|on)|ran (with|on)|made (with|on|by)|rendered (with|on|by)|renders (with|on)|powered by|goes to|sent to|calls?)\s+higgsfield\b|\b(uses?|using)\s+higgsfield\b(?!'s)/i],];+/** A retired model or training id in code (a stored one resolves through replaced.ts; nothing else names it). */+const RETIRED_IDS = new RegExp(`["'\`](${[...Object.keys(REPLACED_BY), ...Object.keys(TRAINING_REPLACED_BY)].join("|")})["'\`]`);+const RETIRED_ID_ALLOWED = new Set(["src/lib/catalog/replaced.ts", "src/server/db.ts"]);+function walk(p: string, out: string[]) {const full = path.join(ROOT, p);if (!fs.existsSync(full)) return;@@ -99,6 +143,34 @@ describe("no code path names the Higgsfield provider", () => {expect(hits).toEqual([]);});+ it("catches what a later branch could bring back: identifiers, labels, copy and README key rows", () => {+ const probes = [+ "export const HiggsfieldProvider = createAdapter();",+ "const viaHiggsfield = route.provider === x;",+ 'label: "Higgsfield",',+ '{ value: "Higgsfield", label: "Higgsfield first" }',+ `note: "Runs with Higgsfield's Soul model"`,+ "toast('Uses Higgsfield to render the ad')",+ "| A Higgsfield key | `HIGGSFIELD_API_KEY` | Soul 2.0 |",+ "pnpm gen:catalog # regenerate cloud models, Higgsfield models and presets, LoRA map",+ ];+ for (const p of probes) expect(RULES.some(([, re]) => re.test(p.replace(RESEARCH_NAMES, ""))), p).toBe(true);+ // History and comparisons stay allowed.+ for (const ok of ["Higgsfield's pogo example names four things to remove", "the way Higgsfield names layer files", "a 1:1 alternative to Higgsfield", "Higgsfield is never called", "Progress uses Higgsfield's 14 labels"])+ expect(RULES.some(([, re]) => re.test(ok)), ok).toBe(false);+ });++ it("names no retired model or training id in code: stored ones resolve through replaced.ts", () => {+ const hits: string[] = [];+ for (const f of files.filter((x) => /^(src|bin)\//.test(x) && !RETIRED_ID_ALLOWED.has(x))) {+ fs.readFileSync(path.join(ROOT, f), "utf8")+ .split("\n")+ .forEach((line, i) => RETIRED_IDS.test(line) && hits.push(`${f}:${i + 1}: ${line.trim().slice(0, 140)}`));+ }+ expect(hits).toEqual([]);+ expect(RETIRED_IDS.test('if (draft.modelId !== "soul-2") return null;')).toBe(true);+ });+it("has no file named after it", () => {expect(files.filter((f) => /higgsfield/i.test(path.basename(f)))).toEqual([]);});@@ -196,9 +268,10 @@ describe("REPLACED_BY", () => {const style = Object.entries(SOUL_LEGACY_IDS).find(([, look]) => look === "v2-general")![0];const old = { feature: "image", modelId: "soul-2", prompt: "a rooftop party", params: { aspectRatio: "3:4", extra: { style_id: style, custom_reference_id: "ref-1", custom_reference_strength: 0.8, seed: 7 } } };const { request, note } = migrateRequest(old);- expect(request).toEqual({ feature: "image", modelId: "fuobe-soul", engine: "cloud", presetId: "v2-general", prompt: "a rooftop party", params: { aspectRatio: "3:4", extra: { seed: 7 } } });+ // No engine: the install runs the Original where its engine mode (else the first engine connected) says.+ expect(request).toEqual({ feature: "image", modelId: "fuobe-soul", presetId: "v2-general", prompt: "a rooftop party", params: { aspectRatio: "3:4", extra: { seed: 7 } } });expect(note).toMatch(/Fuobe Soul/);- // An engine asked for stays; a partner replacement gets none.+ // An engine asked for stays.expect(migrateRequest({ ...old, engine: "open" as const }).request.engine).toBe("open");expect(migrateRequest({ modelId: "marketing-studio-image", params: { extra: { template_id: "t" } } }).request).toEqual({ modelId: "gpt-image-2-5", params: {} });// A current model's request comes back as it was.@@ -207,17 +280,159 @@ describe("REPLACED_BY", () => {});});+describe("operations the replacements do elsewhere", () => {+ /** What each retired model did (the deleted catalog's routes), and the partner ops only the retired provider ran. */+ const RETIRED_OPS: Record<string, string[]> = {+ "soul-1": ["t2i"],+ "soul-2": ["t2i", "edit"],+ "soul-cinema": ["t2i"],+ "cinema-studio-4": ["t2v", "ref2v"],+ "genjutsu-motion-transfer": ["motion-transfer"],+ "genjutsu-lite-motion-transfer": ["motion-transfer"],+ "genjutsu-object-swap": ["v2v", "video-swap"],+ "genjutsu-lite-object-swap": ["video-swap"],+ "genjutsu-restyle": ["v2v"],+ "marketing-studio-image": ["t2i", "edit"],+ "ads-studio": ["t2i", "edit"],+ "ai-influencer": ["t2i", "edit"],+ "seedance-2-5": ["v2v"],+ "ltx-2-5": ["flf2v"],+ };++ it("sends every operation a retired model (or a partner's retired route) ran to a model that does it", () => {+ for (const [id, ops] of Object.entries(RETIRED_OPS)) {+ for (const op of ops) {+ const to = replacementOf(id, op as never);+ const target = to?.id ?? id;+ const m = getModel(target);+ expect(m, `${id} ${op} → ${target}`).toBeDefined();+ expect(routesFor(m!, (to?.op ?? op) as never).length, `${id} ${op} → ${target} ${to?.op ?? op}`).toBeGreaterThan(0);+ }+ }+ expect(Object.keys(OPS_REPLACED_BY).sort()).toEqual(["ltx-2-5", "seedance-2-5"]);+ });++ it("moves a stored request's operation with it, and reads Cinema Studio's references as references", () => {+ expect(migrateRequest({ modelId: "genjutsu-object-swap", op: "v2v" as const }).request).toMatchObject({ modelId: "fuobe-genjutsu-swap", op: "video-swap" });+ expect(migrateRequest({ modelId: "seedance-2-5", op: "v2v" as const }).request).toEqual({ modelId: "kling-o3", op: "v2v" });+ expect(migrateRequest({ modelId: "ltx-2-5", op: "flf2v" as const }).request).toEqual({ modelId: "fuobe-cinema", op: "flf2v" });+ // A partner model's own operations are untouched.+ const seedance = { modelId: "seedance-2-5", op: "t2v" as const };+ expect(migrateRequest(seedance).request).toBe(seedance);+ // Cinema Studio had no start-frame route: its images were references, which Fuobe Cinema doesn't take yet.+ const refs = migrateRequest({ modelId: "cinema-studio-4", prompt: "x", inputs: { images: ["/api/files/a.png"] } });+ expect(refs.request).toMatchObject({ modelId: "seedance-2-5", op: "ref2v" });+ expect(refs.note).toMatch(/Seedance 2\.5/);+ expect(migrateRequest({ modelId: "cinema-studio-4", prompt: "x" }).request).toEqual({ modelId: "fuobe-cinema", prompt: "x" });+ });++ it("writes Cinema Studio's Director fields into the prompt on the server, and drops them in the browser", () => {+ const extra = { genre: "noir", era: "1980s", camera_model: "35mm-film", camera_lens: "anamorphic", camera_aperture: "f14-wide-open", light: "silhouette", pacing: "calm", camera_movement: "dolly-in", color_palette: "neon-rain-at-midnight", seed: 3 };+ expect(Object.keys(extra).filter((k) => k !== "seed").sort()).toEqual([...DIRECTOR_FIELDS].sort());+ const old = { modelId: "cinema-studio-4", prompt: "A chase through the market.", params: { duration: 8, extra } };+ const server = currentRequest(old as never).request;+ expect(server.modelId).toBe("fuobe-cinema");+ expect(server.params).toEqual({ duration: 8, extra: { seed: 3 } });+ expect(server.prompt).toMatch(/^A chase through the market\. /);+ for (const words of [/noir/i, /1980s/i, /35mm/i, /anamorphic/i, /silhouette/i, /calm/i, /dolly/i, /neon/i]) expect(server.prompt).toMatch(words);+ expect(directorFieldWords({ genre: "not-a-genre" })).toBe("");+ // The browser has no Director words to write: the fields go, the prompt stays the user's.+ expect(migrateRequest(old).request).toEqual({ modelId: "fuobe-cinema", prompt: "A chase through the market.", params: { duration: 8, extra: { seed: 3 } } });+ // And the cloud half's payload carries none of them.+ const p = previewGeneration({ feature: "video", ...old } as never);+ expect(p.model.id).toBe("fuobe-cinema");+ expect(p.prompt).toMatch(/noir/i);+ });+});+describe("stored ids resolve where they are read", () => {+ it("runs a retired Original's request on the install's engine: open source only takes it to the GPU", async () => {+ const preview = async (modelId: string) =>+ (await (+ await generationsRoute.POST(+ new Request("http://x/api/generations?preview=1", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ feature: "image", modelId, prompt: "a fox" }) }),+ )+ ).json()) as { modelId: string; engine: string; notes?: string[]; error?: string };+ setSetting("engineMode", "open");+ try {+ const old = await preview("soul-2");+ expect(old.error).toBeUndefined();+ expect(old).toMatchObject({ modelId: "fuobe-soul", engine: "open" });+ expect(old.notes?.[0]).toMatch(/Fuobe Soul/);+ } finally {+ setSetting("engineMode", "cloud");+ }+ try {+ expect(await preview("soul-2")).toMatchObject({ modelId: "fuobe-soul", engine: "cloud" });+ } finally {+ setSetting("engineMode", "both");+ }+ // Both on: the same engine the Original itself gets.+ const [old, now] = [await preview("soul-2"), await preview("fuobe-soul")];+ expect(old.engine).toBe(now.engine);+ });+it("runs a generation asked for on a retired model on its replacement, and says so (Reuse, CLI, MCP)", async () => {const res = await generationsRoute.POST(new Request("http://x/api/generations?preview=1", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ feature: "image", modelId: "soul-2", prompt: "a fox" }) }),);const body = (await res.json()) as { modelId: string; engine: string; notes?: string[]; error?: string };expect(body.error).toBeUndefined();- expect(body).toMatchObject({ modelId: "fuobe-soul", engine: "cloud" });+ expect(body).toMatchObject({ modelId: "fuobe-soul" });expect(body.notes?.[0]).toMatch(/Fuobe Soul/);+ // Made, the run is stored on its replacement and its notes say so.+ const made = await generationsRoute.POST(+ new Request("http://x/api/generations", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ feature: "image", modelId: "cinema-studio-4", prompt: "a fox", params: { extra: { genre: "noir" } } }) }),+ );+ const created = (await made.json()) as { items: { id: string; modelId: string; request: { modelId: string; prompt: string } }[]; notes?: string[] };+ expect(created.items[0]).toMatchObject({ modelId: "fuobe-cinema", request: { modelId: "fuobe-cinema" } });+ expect(created.items[0].request.prompt).toMatch(/noir/i);+ expect(created.notes?.[0]).toMatch(/Fuobe Cinema/);+ });++ it("retries a Character Sheet or AI Influencer photo made on a retired model, on its replacement", () => {+ const sheet = storedRow({+ feature: "character-sheet",+ model: "soul-2",+ provider: "higgsfield",+ op: "t2i",+ status: "failed",+ request: { feature: "character-sheet", modelId: "soul-2", op: "t2i", prompt: "a sheet", params: { aspectRatio: "16:9", extra: { style_id: "x" } } },+ });+ const [again] = retryPhoto(sheet);+ expect(again).toMatchObject({ modelId: "fuobe-soul", feature: "character-sheet", request: { modelId: "fuobe-soul" } });+ const app = storedRow({ feature: "app:app-ai-influencer", model: "ai-influencer", provider: "higgsfield", op: "t2i", status: "canceled", request: { feature: "app:app-ai-influencer", modelId: "ai-influencer", op: "t2i", prompt: "a character" } });+ expect(retryPhoto(app)[0]).toMatchObject({ modelId: "nano-banana-pro" });+ });++ it("fails a job still running on a retired model with the way forward, not 'no longer exists'", async () => {+ const running = { feature: "image", op: "t2i", status: "running", externalId: "job-1", request: { feature: "image", modelId: "x", prompt: "an old run" } };+ const soul = storedRow({ ...running, model: "soul-2", provider: "higgsfield" });+ const partner = storedRow({ ...running, model: "nano-banana-pro", provider: "higgsfield" });+ const gone = storedRow({ ...running, model: "old-model", provider: "fal" });+ await runUntil(() => [soul, partner, gone].every((id) => getGeneration(id)?.status === "failed"));+ expect(getGeneration(soul)).toMatchObject({ status: "failed", error: RETIRED_PROVIDER_ERROR });+ expect(getGeneration(partner)).toMatchObject({ status: "failed", error: RETIRED_PROVIDER_ERROR });+ expect(getGeneration(gone)).toMatchObject({ status: "failed", error: "Model old-model no longer exists" });+ });++ it("starts a step that was waiting on a retired model on its replacement", async () => {+ const still = saveFile({ data: Buffer.concat([Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]), Buffer.alloc(2_000, 7)]), contentType: "image/png", name: "still.png", source: "upload" }).url;+ const first = storedRow({ feature: "image", model: "nano-banana-pro", provider: "mock", op: "t2i", status: "succeeded", externalId: "done", outputs: [{ url: still, kind: "image" }], request: { feature: "image", modelId: "nano-banana-pro", prompt: "a still" } });+ const step = storedRow({ feature: "image", model: "soul-2", provider: "higgsfield", op: "edit", status: "queued", dependsOn: first, request: { feature: "image", modelId: "soul-2", op: "edit", prompt: "restyle it", chainFrom: "first" } });+ await runUntil(() => getGeneration(step)?.status !== "queued");+ const g = getGeneration(step)!;+ expect(g.error ?? null).toBeNull();+ expect(g).toMatchObject({ modelId: "fuobe-soul", request: { modelId: "fuobe-soul" } });+ });++ it("casts a Soul Cast sheet in the cloud only when Fuobe Soul's cloud half is on", () => {+ expect(castSheetModel("cloud", planCaps())).toBe("fuobe-soul");+ expect(castSheetModel("cloud", { has: (id, engine) => !(id === "fuobe-soul" && engine === "cloud") })).toBe("nano-banana-pro");+ expect(castSheetModel("open", { has: (id, engine) => !(id === "fuobe-soul" && engine === "cloud") })).toBe("oss-zimage-soul-cast");});+it("keeps a past run on a retired model in the Library, named as it ran, with its outputs", async () => {const res = await generationsRoute.POST(new Request("http://x/api/generations", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ feature: "image", modelId: "fuobe-soul", prompt: "an old portrait" }) }),@@ -249,6 +464,43 @@ describe("stored ids resolve where they are read", () => {// A board with nothing retired comes back as it was.expect(withCurrentModels(moved)).toBe(moved);});++ it("moves a saved Canvas node's operation too: Cinema Studio's connected images were references", () => {+ const node = (id: string, modelId: string, op?: "v2v") => ({ id, type: "model" as const, position: { x: 0, y: 0 }, data: { modelId, mediaKind: "video" as const, ...(op && { op }) } });+ const image = { id: "img", type: "image" as const, position: { x: 0, y: 0 }, data: { url: "/api/files/a.png" } };+ const graph = {+ nodes: [node("refs", "cinema-studio-4"), node("plain", "cinema-studio-4"), node("swap", "genjutsu-object-swap", "v2v"), node("edit", "seedance-2-5", "v2v"), node("own", "seedance-2-5"), image],+ edges: [{ id: "e1", source: "img", target: "refs", targetHandle: "images" }],+ } as Parameters<typeof withCurrentModels>[0];+ const by = Object.fromEntries(withCurrentModels(graph).nodes.map((n) => [n.id, n.data]));+ expect(by.refs).toMatchObject({ modelId: "seedance-2-5", op: "ref2v" });+ expect(by.plain).toMatchObject({ modelId: "fuobe-cinema" });+ expect(by.plain.op).toBeUndefined();+ expect(by.swap).toMatchObject({ modelId: "fuobe-genjutsu-swap", op: "video-swap" });+ expect(by.edit).toMatchObject({ modelId: "kling-o3", op: "v2v" });+ expect(by.own).toEqual(graph.nodes[4].data);+ });++ it("plans an Assist or MCP job on a retired model or operation where it runs now", () => {+ const video = "/api/files/ad.mp4";+ const plan = assistTools.planFor(+ "generate",+ {+ summary: "Old saved calls",+ jobs: [+ { model_id: "soul-2", prompt: "a fox" },+ { model_id: "seedance-2-5", op: "v2v", prompt: "Make it snow", video },+ { model_id: "genjutsu-object-swap", op: "v2v", prompt: "Swap the mug", video, images: ["/api/files/mug.png"] },+ ],+ },+ { engine: "cloud" },+ );+ expect(plan.jobs.map((j) => [j.modelId, j.op, j.error])).toEqual([+ ["fuobe-soul", "t2i", undefined],+ ["kling-o3", "v2v", undefined],+ ["fuobe-genjutsu-swap", "video-swap", undefined],+ ]);+ });});// ---------------------------------------------------------------------------