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
Originals O6: Cinema runs on Fuobe Cinema and Fuobe Soul, with no Higgsfield context
Claudeb166a6a7727a
diff --git a/src/app/api/cinema/projects/[id]/route.ts b/src/app/api/cinema/projects/[id]/route.tsindex 6e5dd5a3..9dbaa7c0 100644--- a/src/app/api/cinema/projects/[id]/route.ts+++ b/src/app/api/cinema/projects/[id]/route.ts@@ -3,15 +3,15 @@ import { CinemaError, deleteProject, getProject, listFolders, spentUsd, updatePrimport { ProjectPatch, body, handle } from "@/server/cinema-schemas";import { cinemaContext } from "@/server/cinema-generate";-/** The project with its folders, its estimated spend and what this install can run (Higgsfield key or not). */+/** The project with its folders, its estimated spend and what this install can run (cloud models allowed or not). */export async function GET(_req: Request, ctx: RouteContext<"/api/cinema/projects/[id]">) {await connection();return handle(async () => {const { id } = await ctx.params;const project = getProject(id);if (!project) throw new CinemaError("Project not found", 404);- const { higgsfield, cloudAllowed } = cinemaContext();- return Response.json({ project, folders: listFolders(id), spentUsd: spentUsd(id), context: { higgsfield, cloudAllowed } });+ const { cloudAllowed } = cinemaContext();+ return Response.json({ project, folders: listFolders(id), spentUsd: spentUsd(id), context: { cloudAllowed } });});}diff --git a/src/components/cinema/camera-moves.tsx b/src/components/cinema/camera-moves.tsxindex 94cdef05..27a3b754 100644--- a/src/components/cinema/camera-moves.tsx+++ b/src/components/cinema/camera-moves.tsx@@ -5,7 +5,7 @@ import { useMemo, useState } from "react";import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";-import { CAMERA_MOVES, moveBySlug, openCameraRoute, type CameraMove } from "@/lib/catalog/cinema";+import { CAMERA_MOVES, cinemaMoveRoute, moveBySlug, type CameraMove } from "@/lib/catalog/cinema";import type { Engine } from "@/lib/catalog/types";import { cn } from "@/lib/utils";@@ -22,21 +22,23 @@ function moveScore(value: string, search: string, keywords?: string[]): number {return hint.includes(q) ? 0.2 : 0;}-/** How the open engine drives a move (shown as a small badge in the picker). */+/** How Fuobe Cinema drives a move on this engine, given a start frame (a small badge in the picker). */function routeBadge(m: CameraMove, engine: Engine): string | null {- if (engine !== "open") return null;- const r = openCameraRoute(m.slug, true);- return r.via === "lora" ? "LoRA" : r.via === "fun-camera" ? "Fun Camera" : null;+ const r = cinemaMoveRoute(m.slug, engine, true);+ return r.via === "camera-lora" ? "Camera LoRA" : r.via === "lora" ? "LoRA" : r.via === "fun-camera" ? "Fun Camera" : r.via === "hosted-move" ? "Focus move" : null;}export function MoveList({engine,+ badges = true,selected,onPick,defaultQuery,autoFocus,}: {engine: Engine;+ /** Say how Fuobe Cinema drives each move (off when a partner model gets the moves in words). */+ badges?: boolean;selected: string[];onPick: (slug: string) => void;/** What was typed after "#" in the prompt (the list mounts fresh each time the picker opens). */@@ -70,7 +72,7 @@ export function MoveList({<CommandEmpty>No camera moves match your search</CommandEmpty><CommandGroup>{moves.map((m) => {- const badge = routeBadge(m, engine);+ const badge = badges ? routeBadge(m, engine) : null;const n = selected.indexOf(m.slug);return (<CommandItem key={m.slug} value={m.name} keywords={[m.slug, m.hint]} onSelect={() => onPick(m.slug)} className="group/move items-start gap-2.5 py-2">@@ -99,6 +101,7 @@ export function MovePicker({open,onOpenChange,engine,+ badges,selected,onPick,initialQuery,@@ -106,6 +109,7 @@ export function MovePicker({open: boolean;onOpenChange: (o: boolean) => void;engine: Engine;+ badges?: boolean;selected: string[];onPick: (slug: string) => void;initialQuery?: string;@@ -139,6 +143,7 @@ export function MovePicker({</div><MoveListengine={engine}+ badges={badges}selected={selected}defaultQuery={initialQuery}autoFocusdiff --git a/src/components/cinema/hooks.ts b/src/components/cinema/hooks.tsindex eccaced7..d75da4c7 100644--- a/src/components/cinema/hooks.ts+++ b/src/components/cinema/hooks.ts@@ -16,7 +16,7 @@ export interface ProjectView {project: CinemaProject;folders: CinemaFolder[];spentUsd: number;- context: { higgsfield: boolean; cloudAllowed: boolean };+ context: { cloudAllowed: boolean };}async function json<T>(res: Response): Promise<T> {diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsxindex 094e9da9..e5ba5ef1 100644--- a/src/components/cinema/prompt-bar.tsx+++ b/src/components/cinema/prompt-bar.tsx@@ -16,7 +16,6 @@ import {ImageIcon,ImagePlus,Loader2,- Lock,MapPin,Maximize,Plus,@@ -47,16 +46,18 @@ import { uploadFile, useAssets, useStatus } from "@/lib/api";import { getModel } from "@/lib/catalog";import {BATCH,+ CINEMA_MODEL,CINEMA_MODELS,DURATION,GRID_SIZES,GRID_TYPES,- HIGGSFIELD_ONLY,IMAGE_ASPECTS,IMAGE_RESOLUTIONS,+ ORIGINAL_LINES,VIDEO_ASPECTS,VIDEO_RESOLUTIONS,checkReferences,+ modelLine,planCinema,type DirectorSettings,} from "@/lib/catalog/cinema";@@ -325,7 +326,7 @@ export interface PromptBarProps {onSettings: (patch: Partial<DirectorSettings>) => void;palettes: { name: string; hex: string[] }[];onPalettes: (p: { name: string; hex: string[] }[]) => void;- context: { higgsfield: boolean; cloudAllowed: boolean };+ context: { cloudAllowed: boolean };brief: string;spentUsd: number;costCapUsd: number | null;@@ -436,6 +437,9 @@ export function PromptBar(props: PromptBarProps) {const modelKey = `${draft.mode}:${engine}` as const;const modelList = CINEMA_MODELS[draft.mode][engine];+ // The model picked in the menu (a take may run on another: Fuobe DoP for a move's Wan camera LoRA, a references edit…).+ const chosen = draft.models[modelKey];+ const picked = chosen && modelList.includes(chosen) ? chosen : modelList[0];const pickable = action === "generate" && !(draft.mode === "image" && draft.imageTool === "grid");const placeholder = video? action === "edit"@@ -753,23 +757,27 @@ export function PromptBar(props: PromptBarProps) {{modelList.map((id) => {const m = getModel(id);if (!m) return null;- const locked = HIGGSFIELD_ONLY.has(id) && !context.higgsfield;- const sel = model.id === id;+ const sel = modelList.includes(model.id) ? model.id === id : picked === id;return (- <DropdownMenuItem key={id} disabled={locked} onClick={() => setDraft((d) => ({ models: { ...d.models, [modelKey]: id } }))} className="items-start">+ <DropdownMenuItem key={id} onClick={() => setDraft((d) => ({ models: { ...d.models, [modelKey]: id } }))} className="items-start"><span className="mt-0.5 w-4">{sel && <Check className="size-3.5" />}</span><span className="min-w-0 flex-1">- <span className="flex items-center gap-1 text-[13px] font-medium">- {m.name} {locked && <Lock className="size-3" />}+ <span className="flex flex-wrap items-center gap-1.5 text-[13px] font-medium">+ {m.name}+ {ORIGINAL_LINES[id] && <span className="rounded-full bg-brand-faint px-1.5 py-px text-[10.5px] font-medium text-brand-text">Original</span>}</span>- <span className="block text-[11.5px] leading-snug text-muted-foreground">{locked ? "Needs a Higgsfield key (Settings)" : m.tagline}</span>+ <span className="block text-[11.5px] leading-snug text-muted-foreground">{modelLine(m, engine)}</span></span></DropdownMenuItem>);})}<DropdownMenuSeparator /><p className="px-2 py-1.5 text-[11px] leading-snug text-muted-foreground">- {engine === "open" ? "The Director is written into the prompt; camera moves use camera LoRAs or Wan Fun Camera where they exist." : "Cinema Studio 4.0 reads the Director natively; the others get it written into the prompt."}+ {video+ ? engine === "open"+ ? "The Director is written into the prompt; a camera move uses its camera LoRA or a Fun Camera pose when you add a start frame."+ : "The Director is written into every model's prompt; Fuobe Cinema also drives camera moves with LTX-2.3's camera LoRAs."+ : "The Director's camera and lens are written into the prompt; Fuobe Soul Cinema adds its film look."}</p></DropdownMenuContent></DropdownMenu>@@ -789,6 +797,7 @@ export function PromptBar(props: PromptBarProps) {</Tooltip>{video && (<MovePicker+ badges={picked === CINEMA_MODEL || (engine === "open" && getModel(picked)?.family === "wan")}open={movesOpen}onOpenChange={(o) => {setMovesOpen(o);diff --git a/src/components/cinema/scene-actions.tsx b/src/components/cinema/scene-actions.tsxindex 860b4e17..b281178b 100644--- a/src/components/cinema/scene-actions.tsx+++ b/src/components/cinema/scene-actions.tsx@@ -72,7 +72,7 @@ export function askSceneConfirmAgain() {export interface ScenePlanContext {engine: Engine;settings: DirectorSettings;- context: { higgsfield: boolean; cloudAllowed: boolean };+ context: { cloudAllowed: boolean };brief: string;}diff --git a/src/components/cinema/scene-viewer.tsx b/src/components/cinema/scene-viewer.tsxindex 69a37572..94aaf2af 100644--- a/src/components/cinema/scene-viewer.tsx+++ b/src/components/cinema/scene-viewer.tsx@@ -35,7 +35,7 @@ export interface SceneViewerProps {engine: Engine;onEngine: (e: Engine) => void;settings: DirectorSettings;- context: { higgsfield: boolean; cloudAllowed: boolean };+ context: { cloudAllowed: boolean };brief: string;onClose: () => void;}diff --git a/src/components/cinema/soul-builders.tsx b/src/components/cinema/soul-builders.tsxindex 149e2313..37cd1bea 100644--- a/src/components/cinema/soul-builders.tsx+++ b/src/components/cinema/soul-builders.tsx@@ -11,7 +11,10 @@ import { Slider } from "@/components/ui/slider";import { Textarea } from "@/components/ui/textarea";import { useSaveElement, useStatus } from "@/lib/api";import {+ CAST_LOOK,+ LOCATION_LOOK,LOCATION_VIEWS,+ SOUL_BUILDER_MODEL,SOUL_CAST_FIELDS,SOUL_CAST_TABS,castDefaults,@@ -25,6 +28,7 @@ import {type CastValues,type DirectorSettings,} from "@/lib/catalog/cinema";+import { soulLook } from "@/lib/catalog/soul";import type { Engine, Generation } from "@/lib/catalog/types";import { formatCost } from "@/lib/format";import { cn } from "@/lib/utils";@@ -37,7 +41,7 @@ interface BuilderProps {folderId: string | null;engine: Engine;settings: DirectorSettings;- context: { higgsfield: boolean; cloudAllowed: boolean };+ context: { cloudAllowed: boolean };brief: string;}@@ -157,6 +161,11 @@ function Results({ items, picked, onPick }: { items: Generation[]; picked: strin);}+/** "Fuobe Soul · Realistic look": the maker, and the Soul look it uses. */+function builderLine(model: { id: string; name: string }, look: string): string {+ return model.id === SOUL_BUILDER_MODEL ? `${model.name} · ${soulLook(look)?.name ?? look} look` : model.name;+}+/** "a marble perfume atelier at golden hour, …" → "Marble Perfume Atelier". */function locationName(prompt: string): string {const words = prompt.split(/[,.;]/)[0].replace(/^(an?|the)\s+/i, "").split(/\s+/).filter((w) => w && !/^(at|in|on|of|with|by|under|near|and)$/i.test(w));@@ -308,7 +317,7 @@ function SoulCast({ projectId, folderId, engine, context, brief, onOpenChange }:</div></div><p className="-mt-1 text-[11.5px] text-muted-foreground">- {plan.model.name} · a turnaround sheet (front, three-quarter, profile, back and a close-up){engine === "open" ? " · open source" : ""}+ {builderLine(plan.model, CAST_LOOK)} · a turnaround sheet (front, three-quarter, profile, back and a close-up){engine === "open" ? " · on your GPU" : ""}</p>{results.length > 0 && (<div className="space-y-3 border-t pt-3">@@ -376,7 +385,9 @@ function SoulLocation({ projectId, folderId, engine, settings, context, brief, oplaceholder="e.g. “a rain-soaked rooftop bar in Tokyo, neon signs, wet tiles, a single string of bulbs”"autoFocus/>- <p className="text-[11.5px] text-muted-foreground">{look.length ? `Uses the Director's ${look.join(", ")}.` : "Set a camera, lens and palette in the Director's Panel to shape the look."} 16:9, no people.</p>+ <p className="text-[11.5px] text-muted-foreground">+ {look.length ? `Uses the Director's ${look.join(", ")}.` : "Set a camera, lens and palette in the Director's Panel to shape the look."} {builderLine(plan.model, LOCATION_LOOK)} · 16:9, no people.+ </p></div><div className="flex flex-wrap items-center justify-end gap-2"><div className="inline-flex h-8 rounded-full bg-muted p-0.5" role="radiogroup" aria-label="Variants">diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.tsindex 8d6228b6..f70dc034 100644--- a/src/lib/catalog/cinema.ts+++ b/src/lib/catalog/cinema.ts@@ -1,26 +1,32 @@import { APERTURE, LENS, anglesNote, poseWords, recomposePrompt, type ScenePose } from "@/lib/scene3d";import { getModel, getPreset } from "./index";-import { DOP_MODEL } from "./dop";-import { triggerOf } from "./loras";+import { DOP_MODEL, LTX25_HOSTED } from "./dop";+import { dualEngine, onEngine } from "./engines";+import { localOnly, triggerOf } from "./loras";import { composeShots, estimateCost, planGeneration, routesFor } from "./plan";import type { Engine, GenerationRequest, GenParams, LoraRef, ModelDef, Operation } from "./types";/*- * Cinema Studio 4.0: the director's data and the pure planning step shared by the browser- * (live cost, previews) and the server (src/server/cinema-generate.ts).+ * Cinema Studio 4.0 as a Fuobe Original (build plan O6): the director's data and the pure planning step+ * shared by the browser (live cost, previews) and the server (src/server/cinema-generate.ts). No Higgsfield+ * API: everything runs on open weights (Fuobe Cinema, Fuobe Soul) or on partner models through fal / Replicate.** Everything below the "Research data" line is copied from docs/research/higgsfield-studios.json →- * cinemaStudio (genres, eras, tempos, camera bodies, lenses, apertures, the 33 camera moves the API- * accepts, the 50 public palettes with their 12 hex colours, the 7 lighting presets, the Emotion Wheel)- * and higgsfield-image-studios.json → characterSheet.soulCast (the 17 Soul Cast fields).+ * cinemaStudio (genres, eras, tempos, camera bodies, lenses, apertures, the 33 camera moves, the 50 public+ * palettes with their 12 hex colours, the 7 lighting presets, the Emotion Wheel), higgsfield-image-studios.json+ * → characterSheet.soulCast (the 17 Soul Cast fields) and fuobe-originals-recipes-5.json →+ * studios[cinema-studio].original (Fuobe Cinema's recipe: which camera LoRA each move takes, the longest take).* tests/cinema.test.ts checks the copy against the JSON, so a research update shows up as a failing test.*- * Routes (fuobeBuild in the research):- * - Cloud video: Higgsfield `cinema-studio-4` reads genre / era / pacing / camera / lens / aperture /- * light / color_palette / camera_movement natively; without a Higgsfield key (or when another model- * is picked) Seedance 2.5, Kling 3.0 or Veo 3.1 get the same settings compiled into the prompt.- * - Open video: Wan 2.2 14B Lightning with the compiled prompt; camera moves become a camera LoRA or a- * Wan Fun Camera pose where motions.ts has one; a palette becomes a palette-transfer post-step.+ * Routes:+ * - Video: Fuobe Cinema (`fuobe-cinema`) with the Director's Panel compiled into the prompt. In the cloud it is+ * LTX-2.3 22B on fal: a move LTX-2.3's camera LoRA makes goes as `camera_lora`; a move with a Wan 2.2 LoRA runs on+ * Fuobe DoP (Wan 2.2 A14B) when there is a start frame; Rack Focus is LTX-2.5's focus shift; the rest are words. A+ * take longer than 20 s adds the rest with one extend. On the user's GPU it is Wan 2.2 14B Lightning: the move's+ * Wan LoRA or a Fun Camera pose (both need a start frame), then a palette-transfer step when a palette is set.+ * Seedance 2.5, Kling 3.0 and Veo 3.1 stay pickable with everything in the prompt.+ * - Stills: Fuobe Soul Cinema. Soul Cast and Soul Location: Fuobe Soul with a look, other views of a location by+ * the Multiple-Angles LoRA.*/// ---------------------------------------------------------------------------@@ -232,8 +238,6 @@ export interface SceneCapture {}export interface CinemaContext {- /** A Higgsfield key is configured (cinema-studio-4 and Soul run for real). */- higgsfield: boolean;/** Cloud models are allowed (engine mode isn't "open only"): extract-frame fallbacks need it. */cloudAllowed?: boolean;/** Models that exist in this build (open-engine adds the grid / Soul Cast / restyle workflows). */@@ -535,13 +539,86 @@ export const DURATION = { min: 4, max: 30, default: 5 } as const;export const BATCH = { min: 1, max: 4 } as const;export const REFERENCE_LIMITS = { images: 30, videos: 10, audios: 10, total: 50, clipMin: 2, clipMax: 30, totalVideo: 30, totalAudio: 30 } as const;-/** Models offered in the prompt bar, per mode and engine. The first is the default. */+/** Fuobe Cinema (O6): Cinema Studio 4.0's Original on both engines. */+export const CINEMA_MODEL = "fuobe-cinema";+/** Fuobe Soul Cinema: the stills. */+export const CINEMA_STILL_MODEL = "fuobe-soul-cinema";+/** Fuobe Soul: Soul Cast and Soul Location. */+export const SOUL_BUILDER_MODEL = "fuobe-soul";+/** The Soul look a cast sheet is made in (natural, unretouched skin and fabric) and a location in (a widescreen film still). */+export const CAST_LOOK = "v1-realistic";+export const LOCATION_LOOK = "v1-movie";++/**+ * Models offered in the prompt bar, per mode and engine. The first is the default: the Original on both engines.+ * Partner models stay as choices (the Director compiled into the prompt); LTX-2.5 is the open choice with sound.+ */export const CINEMA_MODELS: Record<CinemaMode, Record<Engine, string[]>> = {- video: { cloud: ["cinema-studio-4", "seedance-2-5", "kling-3", "veo-3-1"], open: ["oss-wan22-14b-fast", "oss-wan22-14b"] },- image: { cloud: ["nano-banana-pro", "seedream-5-pro", "soul-cinema"], open: ["oss-z-image-turbo", "oss-qwen-image"] },+ video: { cloud: [CINEMA_MODEL, "seedance-2-5", "kling-3", "veo-3-1"], open: [CINEMA_MODEL, "oss-ltx25", "oss-wan22-14b"] },+ image: { cloud: [CINEMA_STILL_MODEL, "nano-banana-pro", "seedream-5-pro"], open: [CINEMA_STILL_MODEL, "oss-z-image-turbo", "oss-qwen-image"] },+};++/**+ * LTX-2.3's built-in camera LoRA (fal's `camera_lora`) for each of the 33 moves, where one of its seven fits; null =+ * no fit (research studios[cinema-studio].original.cameraLora: a zoom is taken as a dolly, pans and tilts have none).+ */+export const CINEMA_CAMERA_LORA: Record<string, string | null> = {+ snorricam: null,+ "robot-arm": null,+ "tilt-up": null,+ "rack-focus": null,+ "tilt-down": null,+ pov: null,+ "pan-left": null,+ "crane-up": "jib_up",+ "pan-right": null,+ "crane-down": "jib_down",+ "side-tracking": null,+ "pedestal-up": "jib_up",+ "pedestal-down": "jib_down",+ handheld: null,+ tracking: null,+ "drone-orbit": null,+ "dolly-zoom": null,+ "aerial-pullback": "dolly_out",+ "static-shot": "static",+ "bullet-time": null,+ "whip-pan": null,+ "slow-zoom-in": "dolly_in",+ "arc-left": null,+ "slow-zoom-out": "dolly_out",+ "arc-right": null,+ "truck-right": "dolly_right",+ "dolly-in": "dolly_in",+ "truck-left": "dolly_left",+ "dolly-out": "dolly_out",+ "slider-right": "dolly_right",+ "crush-zoom": null,+ "slider-left": "dolly_left",+ "helicopter-shot": null,};-/** Models that need a Higgsfield key to run for real. */-export const HIGGSFIELD_ONLY = new Set(["cinema-studio-4", "soul-cinema", "soul-2"]);++/** The longest take one LTX-2.3 call makes (481 frames at 24 fps); a longer one adds the rest with an extend. */+export const CINEMA_MAX_SECONDS = 20;++/** What an Original runs on each engine, for the model menus (its own tagline covers both). */+export const ORIGINAL_LINES: Record<string, Record<Engine, string>> = {+ [CINEMA_MODEL]: {+ open: "Wan 2.2 Lightning on your GPU, with camera LoRAs and Fun Camera moves · 3 or 5 s · free",+ cloud: "LTX-2.3 on fal, with its camera LoRAs and sound · up to 30 s",+ },+ [CINEMA_STILL_MODEL]: {+ open: "Z-Image Turbo with two film-still LoRAs on your GPU · free",+ cloud: "Z-Image Turbo with two film-still LoRAs, hosted on fal",+ },+ [SOUL_BUILDER_MODEL]: {+ open: "Z-Image Turbo with a Soul look's LoRAs on your GPU · free",+ cloud: "Z-Image Turbo with a Soul look's LoRAs, hosted on fal",+ },+};++/** The line a model menu shows: an Original's line for this engine, else the model's tagline. */+export const modelLine = (m: Pick<ModelDef, "id" | "tagline">, engine: Engine): string => ORIGINAL_LINES[m.id]?.[engine] ?? m.tagline;export interface ReferenceCheck {images: number;@@ -713,11 +790,15 @@ export function castName(values: CastValues): string {// ---------------------------------------------------------------------------// Soul Location (cinemaStudio.soulLocation)-export const LOCATION_VIEWS: { id: string; name: string; prompt: string }[] = [- { id: "reverse", name: "Reverse angle", prompt: "Show the same location from the opposite direction (a reverse angle), as if the camera turned around" },- { id: "wide", name: "Wider", prompt: "Show the same location from further back, a wider establishing view that reveals more of it" },- { id: "close", name: "Closer, eye level", prompt: "Show the same location from closer in, at eye level, framing the most interesting part of the set" },- { id: "high", name: "High angle", prompt: "Show the same location from a high angle looking down, as from a crane or a balcony" },+/**+ * Other views of a location. `pose` is the camera the Multiple-Angles LoRA moves to (0° = where the still was+ * taken, 180° = the reverse angle; zoom 0 wide … 5 as framed … 10 close), as the Angles app and 3D re-shoots read it.+ */+export const LOCATION_VIEWS: { id: string; name: string; prompt: string; pose: ScenePose }[] = [+ { id: "reverse", name: "Reverse angle", prompt: "Show the same location from the opposite direction (a reverse angle), as if the camera turned around", pose: { horizontal: 180, vertical: 0, zoom: 5 } },+ { id: "wide", name: "Wider", prompt: "Show the same location from further back, a wider establishing view that reveals more of it", pose: { horizontal: 0, vertical: 0, zoom: 0 } },+ { id: "close", name: "Closer, eye level", prompt: "Show the same location from closer in, at eye level, framing the most interesting part of the set", pose: { horizontal: 0, vertical: 0, zoom: 8 } },+ { id: "high", name: "High angle", prompt: "Show the same location from a high angle looking down, as from a crane or a balcony", pose: { horizontal: 0, vertical: 60, zoom: 3 } },];/** An empty 16:9 set: no people, the place itself is the subject. */@@ -736,9 +817,11 @@ export function locationPrompt(description: string, settings: DirectorSettings):.join(". ") + ".";}+const LOCATION_KEEP = "Keep everything about the place the same: architecture, props, materials, time of day, lighting and colour grade. No people";+export function locationViewPrompt(view: string, description?: string): string {const v = LOCATION_VIEWS.find((x) => x.id === view) ?? LOCATION_VIEWS[0];- return `${v.prompt}. Keep everything about the place the same: architecture, props, materials, time of day, lighting and colour grade. No people${tidy(description) ? `. ${tidy(description)}` : ""}.`;+ return `${v.prompt}. ${LOCATION_KEEP}${tidy(description) ? `. ${tidy(description)}` : ""}.`;}// ---------------------------------------------------------------------------@@ -983,6 +1066,15 @@ export function stillCameraMissing(s: DirectorSettings): string | null {// ---------------------------------------------------------------------------// Planning: which model, which steps+/** A model as it runs on this engine: a Fuobe Original (both engines) keeps that engine's routes, options and price. */+function modelOn(id: string, engine: Engine): ModelDef | undefined {+ const m = getModel(id);+ return m && dualEngine(m) ? onEngine(m, engine) : m;+}++/** Fuobe Cinema in the cloud: LTX-2.3 makes any whole second up to 20 (a frame count at 24 fps). */+const anyLength = (m: ModelDef) => m.id === CINEMA_MODEL && m.engine === "cloud";+/*** Open camera route for a move: a camera LoRA (from the motion preset), else a Fun Camera pose, else* prompt only. Both need a start frame: the camera LoRAs are trained on Wan 2.2 image-to-video.@@ -1000,6 +1092,45 @@ export function openCameraRoute(slug: string, hasStartFrame: boolean): { via: "lreturn { via: "prompt" };}+/** How Fuobe Cinema makes a camera move on an engine. */+export type CinemaMoveRoute =+ /** Cloud: LTX-2.3's built-in camera LoRA (fal's camera_lora); no start frame needed. */+ | { via: "camera-lora"; cameraLora: string }+ /** The move's Wan 2.2 camera LoRA: on Fuobe Cinema (Wan 2.2 Lightning) on the GPU, on Fuobe DoP (fal's Wan 2.2 A14B) in the cloud. */+ | { via: "lora"; modelId: string; loras: LoraRef[]; trigger?: string }+ /** Open: a Wan 2.2 Fun Camera pose. */+ | { via: "fun-camera"; pose: string }+ /** Cloud: a hosted open model's own move (Rack Focus: LTX-2.5's focus_shift). */+ | { via: "hosted-move"; modelId: string; cameraMotion: string }+ /** The move's words only; `frame`: a start frame would let a LoRA, pose or hosted move drive it. */+ | { via: "prompt"; frame?: boolean };++/**+ * A camera move on Fuobe Cinema (research studios[cinema-studio].original.cameraLora). In the cloud: LTX-2.3's camera+ * LoRA where one fits, else (with a start frame) the move's Wan 2.2 LoRA on Fuobe DoP or a hosted model's own move, else+ * words. On the user's GPU: the move's Wan 2.2 LoRA or a Fun Camera pose (with a start frame), else words. A LoRA whose+ * licence keeps it on the GPU never goes to the cloud.+ */+export function cinemaMoveRoute(slug: string, engine: Engine, hasStartFrame: boolean): CinemaMoveRoute {+ const move = moveBySlug(slug);+ if (!move) return { via: "prompt" };+ if (engine === "open") {+ const r = openCameraRoute(slug, hasStartFrame);+ if (r.via === "lora" && r.loras?.length) return { via: "lora", modelId: CINEMA_MODEL, loras: r.loras, trigger: r.trigger };+ if (r.via === "fun-camera" && r.pose) return { via: "fun-camera", pose: r.pose };+ return { via: "prompt", frame: !hasStartFrame && openCameraRoute(slug, true).via !== "prompt" };+ }+ const cameraLora = CINEMA_CAMERA_LORA[slug];+ if (cameraLora) return { via: "camera-lora", cameraLora };+ const cloud = move.motionId ? getPreset(move.motionId)?.cloud : undefined;+ const loras = (cloud?.modelId === DOP_MODEL ? (cloud.loras ?? []) : []).filter((l) => !localOnly(l));+ const motion = cloud?.modelId === LTX25_HOSTED ? cloud.params?.extra?.camera_motion : undefined;+ if (!hasStartFrame) return { via: "prompt", frame: loras.length > 0 || typeof motion === "string" };+ if (loras.length) return { via: "lora", modelId: DOP_MODEL, loras, trigger: triggerOf(loras) };+ if (typeof motion === "string") return { via: "hosted-move", modelId: LTX25_HOSTED, cameraMotion: motion };+ return { via: "prompt" };+}+/** The chain-slot placeholder a planned step uses for the palette swatch (the server swaps in the real PNG). */export const SWATCH_PLACEHOLDER = "/api/files/placeholder.png";@@ -1073,6 +1204,9 @@ function nearest<T extends number>(values: T[], want: number): T {return [...values].sort((a, b) => Math.abs(a - want) - Math.abs(b - want) || a - b)[0];}+/** Cinema's image tiers on a model whose tiers are 720p / 1080p (Fuobe Soul: about 1 and 2 megapixels). */+const IMAGE_TIER: Record<string, string> = { "1K": "720p", "2K": "1080p", "4K": "1080p" };+/** Fit ratio, resolution, duration and batch to what the model takes, saying what changed. */function fitParams(model: ModelDef, input: CinemaGenerateInput, notes: string[], kind: CinemaMode): GenParams {const o = model.options;@@ -1085,7 +1219,10 @@ function fitParams(model: ModelDef, input: CinemaGenerateInput, notes: string[],const res = input.resolution;if (res && o.resolutions?.length) {if (o.resolutions.includes(res)) params.resolution = res;- else {+ else if (IMAGE_TIER[res] && o.resolutions.includes(IMAGE_TIER[res])) {+ params.resolution = IMAGE_TIER[res];+ if (res === "4K") notes.push(`${model.name} makes up to about 2 megapixels (its ${params.resolution} size)`);+ } else {const order = kind === "video" ? VIDEO_RESOLUTIONS : [...IMAGE_RESOLUTIONS, "0.5K", "1.5K", "720p", "1080p"];const below = o.resolutions.filter((r) => order.indexOf(r) <= order.indexOf(res) && order.indexOf(r) >= 0);params.resolution = below.sort((a, b) => order.indexOf(b) - order.indexOf(a))[0] ?? o.resolutions[0];@@ -1095,33 +1232,32 @@ function fitParams(model: ModelDef, input: CinemaGenerateInput, notes: string[],if (kind === "video" && model.kind === "video") {const want = Math.max(DURATION.min, Math.min(DURATION.max, Math.round(input.duration ?? DURATION.default)));const allowed = o.durations;- params.duration = allowed?.length ? nearest(allowed, want) : want;- if (params.duration !== want) notes.push(`${model.name} makes ${params.duration}s clips — use Extend for longer scenes`);+ // Fuobe Cinema in the cloud: any whole second; past 20 s planVideo adds an extend for the rest.+ if (anyLength(model)) params.duration = Math.min(want, CINEMA_MAX_SECONDS);+ else {+ params.duration = allowed?.length ? nearest(allowed, want) : want;+ if (params.duration !== want) notes.push(`${model.name} makes ${params.duration}s clips — use Extend for longer scenes`);+ }if (o.audio === true) params.generateAudio = input.audio !== false;}params.numOutputs = Math.max(BATCH.min, Math.min(BATCH.max, Math.round(input.batch ?? 1)));return params;}-function pickModel(kind: CinemaMode, input: CinemaGenerateInput, ctx: CinemaContext, notes: string[]): ModelDef {+/** The model a mode runs on this engine: the one picked from the model menu, else the Original. */+function pickModel(kind: CinemaMode, input: CinemaGenerateInput): ModelDef {const list = CINEMA_MODELS[kind][input.engine];- const fallback = kind === "video" && input.engine === "cloud" ? (ctx.higgsfield ? "cinema-studio-4" : "seedance-2-5") : list[0];- let id = input.modelId && list.includes(input.modelId) ? input.modelId : fallback;- if (HIGGSFIELD_ONLY.has(id) && !ctx.higgsfield) {- const instead = kind === "video" ? "seedance-2-5" : "nano-banana-pro";- if (input.modelId === id) notes.push(`${getModel(id)?.name ?? id} needs a Higgsfield key — ${getModel(instead)?.name} runs it with the Director in the prompt`);- id = instead;- }- return getModel(id) ?? getModel(fallback)!;+ const id = input.modelId && list.includes(input.modelId) ? input.modelId : list[0];+ return modelOn(id, input.engine) ?? modelOn(list[0], input.engine)!;}function stepCost(req: GenerationRequest, jobsOf: Record<string, number>, step: CinemaStep): { cost: number | null; jobs: number; outputs: number } {- const p = planGeneration(withPlaceholders({ ...step, request: req }), getModel, getPreset);+ // An Original is priced on the engine the step runs on (free on the user's GPU).+ const lookup = (id: string) => modelOn(id, req.engine ?? getModel(id)?.engine ?? "open");+ const p = planGeneration(withPlaceholders({ ...step, request: req }), lookup, getPreset);const waits = !!step.after?.length;const jobs = waits ? 1 : p.jobs;- let cost = estimateCost(p.model, p.params, jobs);- // Cinema Studio 4.0 is token-metered: 480p costs less per second than the 720p list price.- if (cost !== null && p.model.id === "cinema-studio-4" && p.params.resolution === "480p") cost = Math.round(cost * (0.2057 / 0.4623) * 1000) / 1000;+ const cost = estimateCost(p.model, p.params, jobs, p.op, p.loras.length > 0 && routesFor(p.model, p.op).some((r) => !!r.loraEndpoint));const times = step.perJobOf ? (jobsOf[step.perJobOf] ?? 1) : 1;return { cost: cost === null ? null : cost * times, jobs: jobs * times, outputs: jobs * times * p.perJobOutputs };}@@ -1164,54 +1300,70 @@ function withBrief(brief: string | undefined, prompt: string): string {return b ? `${tidy(b)}. ${prompt}` : prompt;}-function planVideo(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {+const loraNames = (loras: LoraRef[]) => [...new Set(loras.map((l) => l.file.replace(/\.safetensors$/, "")))].join(" + ");++/** Number the steps of a chained run ("Take", "Extended to 30s", "Palette · …") when there are several. */+function label(steps: CinemaStep[], labels: Record<string, string>): CinemaStep[] {+ if (steps.length < 2) return steps;+ return steps.map((s, i) => ({ ...s, request: { ...s.request, step: { label: labels[s.key] ?? s.key, index: i, of: steps.length } } }));+}++function planVideo(input: CinemaGenerateInput): CinemaPlan {const notes: string[] = [];- let model = pickModel("video", input, ctx, notes);- const open = input.engine === "open";+ const engine = input.engine;+ const open = engine === "open";+ let model = pickModel("video", input);const moves = (input.moves ?? []).filter((m) => moveBySlug(m));let images = [...(input.images ?? [])];let trigger: string | undefined;let loras: LoraRef[] | undefined;- let cameraMotion: string | undefined;- if (open && moves.length) {- const cam = openCameraRoute(moves[0], images.length > 0);+ const extra: Record<string, unknown> = {};+ // Fuobe Cinema drives the first move with a camera LoRA, a pose or a hosted move (Wan 2.2 on the GPU takes the same+ // LoRAs and poses); a partner model gets it in words.+ if (moves.length && (model.id === CINEMA_MODEL || (open && model.family === "wan"))) {const name = moveBySlug(moves[0])!.name;- if (cam.via === "lora") {- loras = cam.loras;- trigger = cam.trigger;- notes.push(`${name} adds the ${cam.loras!.map((l) => l.file.replace(/\.safetensors$/, "")).join(" + ")} camera LoRA`);- } else if (cam.via === "fun-camera") {- model = getModel("oss-wan22-fun-camera") ?? model;- cameraMotion = cam.pose;- notes.push(`${name} runs on Wan 2.2 Fun Camera (the “${cam.pose}” pose)`);- } else {- const better = !images.length && (moveBySlug(moves[0])!.funCamera || openCameraRoute(moves[0], true).via !== "prompt");- notes.push(`${name} is written into the prompt${better ? " — add a start frame to drive it with a camera LoRA or Fun Camera" : ""}`);- }+ const r = cinemaMoveRoute(moves[0], engine, images.length > 0);+ if (r.via === "camera-lora") {+ extra.camera_lora = r.cameraLora;+ notes.push(`${name} drives LTX-2.3's ${r.cameraLora.replace(/_/g, " ")} camera LoRA`);+ } else if (r.via === "lora") {+ loras = r.loras;+ trigger = r.trigger;+ if (!open && r.modelId !== model.id) {+ model = modelOn(r.modelId, engine) ?? model;+ notes.push(`${name}'s camera LoRA is made for Wan 2.2, so this take runs on ${model.name} (Wan 2.2 A14B on fal: 16 fps, no sound)`);+ } else notes.push(`${name} adds the ${loraNames(r.loras)} camera LoRA`);+ } else if (r.via === "fun-camera") {+ extra.cameraMotion = r.pose;+ notes.push(`${name} runs on Wan 2.2 Fun Camera (the “${r.pose}” pose)`);+ } else if (r.via === "hosted-move") {+ model = modelOn(r.modelId, engine) ?? model;+ extra.camera_motion = r.cameraMotion;+ notes.push(`${name} runs on ${model.name}'s own ${r.cameraMotion.replace(/_/g, " ")} move (open weights, hosted)`);+ } else notes.push(`${name} is written into the prompt${r.frame ? ` — add a start frame to drive it with its camera LoRA${open ? " or Fun Camera" : ""}` : ""}`);}- const native = model.id === "cinema-studio-4";- const compiled = compileDirector({ prompt: input.prompt, settings: input.settings, moves, brief: input.brief, mode: "video", target: native ? "native" : "prompt" });+ const compiled = compileDirector({ prompt: input.prompt, settings: input.settings, moves, brief: input.brief, mode: "video", target: "prompt" });let prompt = trigger ? `${trigger}. ${compiled.prompt}` : compiled.prompt;const params = fitParams(model, input, notes, "video");- const extra: Record<string, unknown> = { ...compiled.extra, ...(cameraMotion ? { cameraMotion } : {}) };if (Object.keys(extra).length) params.extra = extra;+ let seconds = Math.max(DURATION.min, Math.min(DURATION.max, Math.round(input.duration ?? DURATION.default)));const ms = input.multiShot;const shots = (ms?.shots ?? []).filter((s) => s.prompt.trim());if (ms?.mode === "auto") {if (model.options.multiShot?.mode === "prompt") params.multiShot = "auto";- else if (native) notes.push("Cinema Studio 4.0 cuts by Tempo — pick Chaotic, Dynamic or Calm in Film setup");else notes.push(`${model.name} can't plan its own cuts — switch Multi-shot to Manual and write the shots`);} else if (ms?.mode === "manual" && shots.length) {const concat = model.options.multiShot?.mode === "concat";const fitted = concat && model.options.durations?.length ? shots.map((s) => ({ ...s, duration: nearest(model.options.durations!, s.duration) })) : shots;if (model.options.multiShot) params.shots = fitted;else {- // Cinema Studio 4.0 and Veo have no shot list: the shots go into one prompt.- const total = Math.min(DURATION.max, fitted.reduce((n, s) => n + s.duration, 0));+ // Fuobe Cinema in the cloud, Veo: no shot list, so the shots go into one prompt.+ seconds = Math.min(DURATION.max, fitted.reduce((n, s) => n + s.duration, 0));prompt = composeShots(prompt, fitted);- if (model.options.durations?.length) params.duration = nearest(model.options.durations, total);- notes.push(`The ${fitted.length} shots are written into one ${params.duration}s prompt`);+ if (anyLength(model)) params.duration = Math.min(seconds, CINEMA_MAX_SECONDS);+ else if (model.options.durations?.length) params.duration = nearest(model.options.durations, seconds);+ notes.push(`The ${fitted.length} shots are written into one ${anyLength(model) ? seconds : params.duration}s prompt`);}}@@ -1221,7 +1373,7 @@ function planVideo(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {images = images.slice(0, max);}// Reference clips go to reference-to-video when the model's routes take them; otherwise a note says they're left out.- const others = CINEMA_MODELS.video[input.engine].filter((id) => ctx.higgsfield || !HIGGSFIELD_ONLY.has(id)).flatMap((id) => getModel(id) ?? []);+ const others = CINEMA_MODELS.video[engine].flatMap((id) => modelOn(id, engine) ?? []);const clips = clipInputs(model, "ref2v", input, notes, others);const withClips = !!(clips.videos?.length || clips.audios?.length);if (withClips && images.length === 1) notes.push("With reference clips, the image is a reference rather than the start frame");@@ -1229,15 +1381,44 @@ function planVideo(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {const blocker = !input.prompt.trim() && !images.length ? "Describe your scene first" : undefined;const inputs = images.length || withClips ? { ...(images.length ? { images } : {}), ...clips } : undefined;const steps: CinemaStep[] = [- { key: "main", request: { feature: "cinema", modelId: model.id, ...(withClips ? { op: "ref2v" as const } : {}), prompt, inputs, params, loras } },+ { key: "main", request: { feature: "cinema", modelId: model.id, engine, ...(withClips ? { op: "ref2v" as const } : {}), prompt, inputs, params, loras } },];+ const labels: Record<string, string> = { main: "Take" };+ let last = "main";+ // Longer than one LTX-2.3 call (20 s): one extend adds the rest to each take, with the same move.+ const rest = anyLength(model) && !withClips ? seconds - CINEMA_MAX_SECONDS : 0;+ if (rest > 0) {+ steps.push({+ key: "more",+ after: ["main"],+ perJobOf: "main",+ request: {+ feature: "cinema",+ modelId: model.id,+ engine,+ op: "extend",+ prompt,+ chain: [{ slot: "video" }],+ // The extension keeps the take's size; its resolution prices it.+ params: {+ duration: rest,+ numOutputs: 1,+ ...(params.resolution && { resolution: params.resolution }),+ ...(params.generateAudio !== undefined && { generateAudio: params.generateAudio }),+ ...(extra.camera_lora ? { extra: { camera_lora: extra.camera_lora } } : {}),+ },+ },+ });+ labels.more = `Extended to ${seconds}s`;+ notes.push(`${model.name} makes up to ${CINEMA_MAX_SECONDS}s in one take, so an extend adds the last ${rest}s`);+ last = "more";+ }const hex = paletteHex(input.settings.palette);if (open && hex && input.settings.paletteLock !== false) {- steps[0].request.step = { label: "Take", index: 0, of: 2 };steps.push({key: "palette",- after: ["main"],- perJobOf: "main",+ after: [last],+ perJobOf: last,swatch: hex,request: {feature: "cinema",@@ -1246,23 +1427,24 @@ function planVideo(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {prompt: `Palette lock · ${paletteLabel(input.settings.palette)}`,inputs: { images: [SWATCH_PLACEHOLDER] },chain: [{ slot: "video" }],- step: { label: `Palette · ${paletteLabel(input.settings.palette)}`, index: 1, of: 2 },},});+ labels.palette = `Palette · ${paletteLabel(input.settings.palette)}`;notes.push(`The grade is locked to ${paletteLabel(input.settings.palette)} with a palette transfer`);}- return finish(model, steps, notes, blocker);+ return finish(model, label(steps, labels), notes, blocker);}const STILL_CLIPS_NOTE = "Stills use image references — reference videos and audio are left out";+/** What edits a still with references: Qwen-Image-Edit 2511 on the user's GPU, Nano Banana Pro in the cloud. */function editModel(engine: Engine): ModelDef {return getModel(engine === "open" ? "oss-qwen-edit" : "nano-banana-pro")!;}-function planStill(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {+function planStill(input: CinemaGenerateInput): CinemaPlan {const notes: string[] = [];- let model = pickModel("image", input, ctx, notes);+ let model = pickModel("image", input);const images = (input.images ?? []).slice(0, input.engine === "open" ? 3 : 10);if (images.length && !model.routes.some((r) => r.op === "edit")) {const instead = editModel(input.engine);@@ -1274,11 +1456,10 @@ function planStill(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {const params = fitParams(model, { ...input, resolution: input.resolution ?? "1K" }, notes, "image");const blocker = stillCameraMissing(input.settings) ?? (!input.prompt.trim() ? "Describe your scene first" : undefined);const steps: CinemaStep[] = [- { key: "main", request: { feature: "cinema-image", modelId: model.id, prompt: compiled.prompt, inputs: images.length ? { images } : undefined, params } },+ { key: "main", request: { feature: "cinema-image", modelId: model.id, engine: input.engine, prompt: compiled.prompt, inputs: images.length ? { images } : undefined, params } },];const hex = paletteHex(input.settings.palette);if (input.engine === "open" && hex && input.settings.paletteLock !== false) {- steps[0].request.step = { label: "Still", index: 0, of: 2 };steps.push({key: "palette",after: ["main"],@@ -1291,11 +1472,10 @@ function planStill(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {prompt: `Palette lock · ${paletteLabel(input.settings.palette)}`,inputs: { images: [SWATCH_PLACEHOLDER] },chain: [{ slot: "images", position: "first" }],- step: { label: `Palette · ${paletteLabel(input.settings.palette)}`, index: 1, of: 2 },},});}- return finish(model, steps, notes, blocker);+ return finish(model, label(steps, { main: "Still", palette: `Palette · ${paletteLabel(input.settings.palette)}` }), notes, blocker);}function planGrid(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {@@ -1311,53 +1491,113 @@ function planGrid(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {model = getModel("oss-zimage-grid")!;const { rows, cols } = gridDims(size);Object.assign(extra, { rows, columns: cols });- } else model = input.engine === "cloud" ? getModel("nano-banana-pro")! : pickModel("image", input, ctx, notes);+ } else model = input.engine === "cloud" ? getModel("nano-banana-pro")! : pickModel("image", input);if (input.videos?.length || input.audios?.length) notes.push(STILL_CLIPS_NOTE);const compiled = compileDirector({ prompt: input.prompt, settings: input.settings, brief: input.brief, mode: "image", target: "prompt" });const params = fitParams(model, { ...input, batch: 1, resolution: input.resolution ?? "2K" }, notes, "image");if (Object.keys(extra).length) params.extra = extra;const blocker = !input.prompt.trim() ? "Describe your scene first" : undefined;- return finish(model, [{ key: "main", request: { feature: "cinema-grid", modelId: model.id, prompt: gridPrompt(compiled.prompt, size, type), inputs: images.length ? { images } : undefined, params } }], notes, blocker);+ return finish(+ model,+ [{ key: "main", request: { feature: "cinema-grid", modelId: model.id, engine: input.engine, prompt: gridPrompt(compiled.prompt, size, type), inputs: images.length ? { images } : undefined, params } }],+ notes,+ blocker,+ );+}++/** Soul Cast's makers: Fuobe Soul (the Realistic look) on both engines; Nano Banana Pro, or the open Soul Cast sheet graph. */+export const CAST_MODELS: Record<Engine, string[]> = { cloud: [SOUL_BUILDER_MODEL, "nano-banana-pro"], open: [SOUL_BUILDER_MODEL, "oss-zimage-soul-cast"] };+/** Soul Location's makers: Fuobe Soul (the Movie look) on both engines, partner and open alternatives after it. */+export const LOCATION_MODELS: Record<Engine, string[]> = { cloud: [SOUL_BUILDER_MODEL, "nano-banana-pro", "seedream-5-pro"], open: [SOUL_BUILDER_MODEL, "oss-z-image-turbo", "oss-qwen-image"] };++/** A builder's maker: the one asked for when this engine offers it (and this install has it), else the first. */+function builderModel(list: string[], input: CinemaGenerateInput, ctx: CinemaContext): ModelDef {+ const has = ctx.has ?? ((id: string) => !!getModel(id));+ const ok = list.filter(has);+ const id = input.modelId && ok.includes(input.modelId) ? input.modelId : (ok[0] ?? list[0]);+ return modelOn(id, input.engine)!;}function planCast(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {const notes: string[] = [];- const has = ctx.has ?? ((id: string) => !!getModel(id));- const open = input.engine === "open";- const id = open ? (has("oss-zimage-soul-cast") ? "oss-zimage-soul-cast" : "oss-z-image-turbo") : ctx.higgsfield ? "soul-2" : "nano-banana-pro";- const model = getModel(input.modelId && CAST_MODELS[input.engine].includes(input.modelId) && (ctx.higgsfield || !HIGGSFIELD_ONLY.has(input.modelId)) ? input.modelId : id)!;- const params = fitParams(model, { ...input, aspectRatio: "16:9", resolution: model.options.resolutions?.includes("2K") ? "2K" : model.options.resolutions?.includes("1080p") ? "1080p" : undefined }, notes, "image");+ const model = builderModel(CAST_MODELS[input.engine], input, ctx);+ const soul = model.id === SOUL_BUILDER_MODEL;+ const params = fitParams(model, { ...input, aspectRatio: "16:9", resolution: "2K" }, notes, "image");const prompt = withBrief(input.brief, castPrompt(input.cast ?? {}, input.prompt));- return finish(model, [{ key: "main", request: { feature: "cinema-cast", modelId: model.id, prompt, params } }], notes);+ return finish(model, [{ key: "main", request: { feature: "cinema-cast", modelId: model.id, engine: input.engine, ...(soul && { presetId: CAST_LOOK }), prompt, params } }], notes);}-export const CAST_MODELS: Record<Engine, string[]> = { cloud: ["soul-2", "nano-banana-pro"], open: ["oss-zimage-soul-cast", "oss-z-image-turbo"] };-export const LOCATION_MODELS: Record<Engine, string[]> = { cloud: ["soul-cinema", "nano-banana-pro", "seedream-5-pro"], open: ["oss-z-image-turbo", "oss-qwen-image"] };+/**+ * Another view of a location: the Multiple-Angles LoRA moves the camera to the view's pose, on Qwen-Image-Edit 2511 on the+ * user's GPU (the LoRA's own words) and on fal's hosted Multiple Angles model (the angles as fields) in the cloud.+ */+function planLocationView(input: CinemaGenerateInput): CinemaPlan {+ const notes: string[] = [];+ const view = LOCATION_VIEWS.find((x) => x.id === input.view) ?? LOCATION_VIEWS[0];+ const src = input.source?.kind === "image" ? input.source.url : undefined;+ const inputs = src ? { images: [src] } : undefined;+ let model: ModelDef;+ let request: GenerationRequest;+ if (input.engine === "cloud") {+ model = getModel("qwen-multiple-angles")!;+ const words = `${LOCATION_KEEP}${tidy(input.prompt) ? `. ${tidy(input.prompt)}` : ""}.`;+ request = {+ feature: "cinema-location",+ modelId: model.id,+ op: "edit",+ prompt: words,+ inputs,+ params: { numOutputs: 1, extra: { horizontal_angle: view.pose.horizontal, vertical_angle: view.pose.vertical, zoom: view.pose.zoom } },+ };+ } else {+ model = editModel("open");+ const loras = getPreset("app-angles")?.open?.loras;+ request = {+ feature: "cinema-location",+ modelId: model.id,+ op: "edit",+ prompt: `<sks> ${poseWords(view.pose)}. ${locationViewPrompt(view.id, input.prompt)}`,+ inputs,+ params: { numOutputs: 1 },+ ...(loras?.length ? { loras } : {}),+ };+ }+ notes.push(`${model.name} with the Multiple-Angles LoRA moves the camera for the ${view.name.toLowerCase()} view`);+ return finish(model, [{ key: "main", request }], notes, src ? undefined : "Pick the location image to re-angle");+}function planLocation(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {+ if (input.action === "location-view") return planLocationView(input);const notes: string[] = [];- if (input.action === "location-view") {- const model = editModel(input.engine);- const src = input.source?.kind === "image" ? input.source.url : undefined;- const prompt = withBrief(input.brief, locationViewPrompt(input.view ?? "reverse", input.prompt));- return finish(model, [{ key: "main", request: { feature: "cinema-location", modelId: model.id, op: "edit", prompt, inputs: src ? { images: [src] } : undefined, params: { numOutputs: 1 } } }], notes, src ? undefined : "Pick the location image to re-angle");- }- const fallback = input.engine === "open" ? "oss-z-image-turbo" : ctx.higgsfield ? "soul-cinema" : "nano-banana-pro";- const pick = input.modelId && LOCATION_MODELS[input.engine].includes(input.modelId) && (ctx.higgsfield || !HIGGSFIELD_ONLY.has(input.modelId)) ? input.modelId : fallback;- const model = getModel(pick)!;- const params = fitParams(model, { ...input, aspectRatio: "16:9", resolution: model.options.resolutions?.includes("2K") ? "2K" : model.options.resolutions?.includes("1080p") ? "1080p" : undefined }, notes, "image");+ const model = builderModel(LOCATION_MODELS[input.engine], input, ctx);+ const soul = model.id === SOUL_BUILDER_MODEL;+ const params = fitParams(model, { ...input, aspectRatio: "16:9", resolution: "2K" }, notes, "image");const prompt = withBrief(input.brief, locationPrompt(input.prompt, input.settings));- return finish(model, [{ key: "main", request: { feature: "cinema-location", modelId: model.id, prompt, params } }], notes, input.prompt.trim() ? undefined : "Describe your location first");+ return finish(+ model,+ [{ key: "main", request: { feature: "cinema-location", modelId: model.id, engine: input.engine, ...(soul && { presetId: LOCATION_LOOK }), prompt, params } }],+ notes,+ input.prompt.trim() ? undefined : "Describe your location first",+ );+}++/**+ * The video model an extend or a prequel runs on. On the user's GPU: Wan 2.2 Fun VACE (extend) or Fuobe Cinema's start and+ * end frame. In the cloud: the picked model when it does that on fal or Replicate, else Fuobe Cinema (LTX-2.3).+ */+function videoModelFor(op: Operation, input: CinemaGenerateInput, notes: string[]): ModelDef {+ if (input.engine === "open") return op === "extend" ? getModel("oss-wan22-vace-extend")! : modelOn(CINEMA_MODEL, "open")!;+ const picked = pickModel("video", input);+ if (picked.routes.some((r) => r.op === op && r.provider !== "higgsfield")) return picked;+ const cinema = modelOn(CINEMA_MODEL, "cloud")!;+ notes.push(`${picked.name} ${op === "extend" ? "extends" : "makes prequels"} through ${cinema.name}`);+ return cinema;}-/** The video model an extend/prequel runs on: the picked one when it can, else Seedance 2.5 (Higgsfield's engine). */-function videoModelFor(op: Operation, input: CinemaGenerateInput, ctx: CinemaContext, notes: string[]): ModelDef {- if (input.engine === "open") return getModel(op === "extend" ? "oss-wan22-vace-extend" : "oss-wan22-14b-fast")!;- const picked = pickModel("video", input, ctx, []);- if (picked.routes.some((r) => r.op === op)) return picked;- const seedance = getModel("seedance-2-5")!;- notes.push(`${picked.name} ${op === "extend" ? "extends" : "makes prequels"} through ${seedance.name}`);- return seedance;+/** LTX-2.3's camera LoRA for the first move, when Fuobe Cinema runs in the cloud and one fits. */+function cameraExtra(model: ModelDef, moves: string[] | undefined): Record<string, unknown> | undefined {+ const fit = anyLength(model) && moves?.length ? CINEMA_CAMERA_LORA[moves[0]] : undefined;+ return fit ? { camera_lora: fit } : undefined;}function planExtend(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {@@ -1366,21 +1606,38 @@ function planExtend(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlanconst settings = input.settings;const moves = input.moves ?? [];if (input.action === "extend-forward") {- const model = videoModelFor("extend", input, ctx, notes);+ const model = videoModelFor("extend", input, notes);const scene = input.prompt.trim() || "Continue the shot naturally: the same characters, location and camera language, picking up exactly where it ends";const compiled = compileDirector({ prompt: scene, settings, moves, brief: input.brief, mode: "video", target: "prompt" });const params = fitParams(model, input, notes, "video");params.numOutputs = 1;+ const camera = cameraExtra(model, moves);+ if (camera) params.extra = camera;const clips = clipInputs(model, "extend", input, notes);return finish(model,- [{ key: "main", request: { feature: "cinema", modelId: model.id, op: "extend", prompt: compiled.prompt, inputs: src ? { video: src.url, ...clips } : undefined, params, step: { label: "Extended · sequel", index: 0, of: 1 } } }],+ [{ key: "main", request: { feature: "cinema", modelId: model.id, engine: input.engine, op: "extend", prompt: compiled.prompt, inputs: src ? { video: src.url, ...clips } : undefined, params, step: { label: "Extended · sequel", index: 0, of: 1 } } }],+ notes,+ src ? undefined : "Select a video take to extend",+ );+ }+ if (input.videos?.length || input.audios?.length) notes.push("A prequel is made from the take's first frame — reference videos and audio aren't used");+ const scene = tidy(input.prompt) || "the moments right before this shot";+ const video = videoModelFor("flf2v", input, notes);+ // Fuobe Cinema in the cloud: LTX-2.3 extends the take backward from its first frame in one call.+ if (anyLength(video)) {+ const compiled = compileDirector({ prompt: `Prequel: ${scene}. The clip leads straight into the opening of the next shot`, settings, moves, brief: input.brief, mode: "video", target: "prompt" });+ const params = fitParams(video, input, notes, "video");+ params.numOutputs = 1;+ params.extra = { ...cameraExtra(video, moves), extend_direction: "backward" };+ return finish(+ video,+ [{ key: "main", request: { feature: "cinema", modelId: video.id, engine: input.engine, op: "extend", prompt: compiled.prompt, inputs: src ? { video: src.url } : undefined, params, step: { label: "Extended · prequel", index: 0, of: 1 } } }],notes,src ? undefined : "Select a video take to extend",);}- // Backward (prequel): a still of the moment before, then a clip from it that ends on the take's first frame.- const video = videoModelFor("flf2v", input, ctx, notes);+ // Elsewhere: a still of the moment before, then a clip from it that ends on the take's first frame.const edit = editModel(input.engine);const frame = src?.firstFrame;const steps: CinemaStep[] = [];@@ -1393,8 +1650,6 @@ function planExtend(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlanrequest: { feature: "cinema", modelId: "extract-frame", op: "frame", inputs: { video: src.url }, params: { extra: { frame_type: "first" } }, step: { label: "First frame", index: 0, of: 3 } },});}- if (input.videos?.length || input.audios?.length) notes.push("A prequel is made from the take's first frame — reference videos and audio aren't used");- const scene = tidy(input.prompt) || "the moments right before this shot";const n = frame ? 2 : 3;steps.push({key: "before",@@ -1402,6 +1657,7 @@ function planExtend(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlanrequest: {feature: "cinema",modelId: edit.id,+ engine: input.engine,op: "edit",prompt: `The same shot a few seconds earlier: ${scene}. Same characters, wardrobe, location, lighting, lens and colour grade; only time has moved back.`,inputs: frame ? { images: [frame] } : undefined,@@ -1419,6 +1675,7 @@ function planExtend(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlanrequest: {feature: "cinema",modelId: video.id,+ engine: input.engine,op: "flf2v",prompt: compiled.prompt,inputs: frame ? { endImage: frame } : undefined,@@ -1437,13 +1694,18 @@ function planEdit(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {const prompt = withBrief(input.brief, tidy(applyEmotions(input.prompt, input.settings.emotions)));let blocker = !src ? "Select a video take to edit" : !input.prompt.trim() ? "Describe the change" : undefined;if (input.engine === "cloud") {- const model = getModel(ctx.higgsfield ? "seedance-2-5" : "kling-o3")!;- const images = (input.images ?? []).slice(0, 4);+ // Fuobe Cinema edits with LTX-2.3's video-to-video; a partner pick edits through Kling O3 (Seedance 2.5 has no edit on fal).+ const picked = pickModel("video", input);+ const original = picked.id === CINEMA_MODEL;+ const model = original ? picked : getModel("kling-o3")!;+ if (!original) notes.push(`${picked.name}'s takes are edited with ${model.name}`);+ const images = original ? [] : (input.images ?? []).slice(0, 4);// Extra reference clips ride along when the edit model's routes take them.const clips = clipInputs(model, "v2v", input, notes);+ const params: GenParams = { numOutputs: 1, ...(model.options.audio === true && { generateAudio: input.audio !== false }) };return finish(model,- [{ key: "main", request: { feature: "cinema", modelId: model.id, op: "v2v", prompt, inputs: src ? { video: src.url, ...(images.length ? { images } : {}), ...clips } : undefined, params: { numOutputs: 1 }, step: { label: "Edited take", index: 0, of: 1 } } }],+ [{ key: "main", request: { feature: "cinema", modelId: model.id, engine: "cloud", op: "v2v", prompt, inputs: src ? { video: src.url, ...(images.length ? { images } : {}), ...clips } : undefined, params, step: { label: "Edited take", index: 0, of: 1 } } }],notes,blocker,);@@ -1559,7 +1821,7 @@ export function planCinema(input: CinemaGenerateInput, ctx: CinemaContext): Cinecase "recompose":return planRecompose(i);default:- return i.mode === "image" ? planStill(i, ctx) : planVideo(i, ctx);+ return i.mode === "image" ? planStill(i) : planVideo(i);}}diff --git a/src/server/cinema-generate.ts b/src/server/cinema-generate.tsindex 986b1644..94a02a10 100644--- a/src/server/cinema-generate.ts+++ b/src/server/cinema-generate.ts@@ -16,13 +16,12 @@ import type { Generation, GenerationRequest } from "@/lib/catalog/types";import { CinemaError, folderExists, getProject, recordTakes, spentUsd } from "./cinema";import { createGenerations, previewGeneration } from "./generations";import { encodePng } from "./png";-import { provider } from "./providers";import { engineMode } from "./settings";import { saveFile } from "./storage";-/** What this install can run right now (decides Cinema Studio 4.0 vs Seedance, frame fallbacks). */+/** What this install can run right now (cloud fallbacks such as reading a take's first frame, the workflows it has). */export function cinemaContext(): CinemaContext {- return { higgsfield: provider("higgsfield").isConfigured(), cloudAllowed: engineMode() !== "open", has: (id) => !!getModel(id) };+ return { cloudAllowed: engineMode() !== "open", has: (id) => !!getModel(id) };}declare global {diff --git a/tests/cinema-api.test.ts b/tests/cinema-api.test.tsindex 050043b8..35a80f71 100644--- a/tests/cinema-api.test.ts+++ b/tests/cinema-api.test.ts@@ -109,8 +109,8 @@ describe("Cinema API", () => {const res = await generateRoute.POST(json("POST", { input: { ...VIDEO, settings: { genre: "noir", focal: "50mm" } }, folderId: folder.id }), params({ id: p.id }));expect(res.status).toBe(201);const { items, plan } = await res.json();- // No Higgsfield key: Seedance 2.5 with the Director compiled into the prompt.- expect(plan.modelId).toBe("seedance-2-5");+ // Fuobe Cinema (LTX-2.3 in the cloud) with the Director compiled into the prompt; no Higgsfield anywhere.+ expect(plan.modelId).toBe("fuobe-cinema");expect(items).toHaveLength(1);const g = gens.getGeneration(items[0].id)!;expect(g.prompt).toMatch(/^Project brief: Rain, neon, regret\. A detective lights a match in the rain\. Noir film/);@@ -128,7 +128,9 @@ describe("Cinema API", () => {it("open engine: a palette-lock step waits for each take and gets the palette swatch", async () => {const p = cinema.createProject({ name: "Open run" });const { items } = generateInProject(p.id, { ...VIDEO, engine: "open", batch: 2, settings: { palette: { kind: "preset", slug: "the-circus" } } });- expect(items.map((g) => g.modelId)).toEqual(["oss-wan22-14b-fast", "oss-wan22-14b-fast", "oss-palette-video", "oss-palette-video"]);+ expect(items.map((g) => g.modelId)).toEqual(["fuobe-cinema", "fuobe-cinema", "oss-palette-video", "oss-palette-video"]);+ // The Original runs on the engine asked for: Wan 2.2 Lightning on the user's GPU (a demo here).+ expect(items[0].request.engine).toBe("open");const lock = items[2];expect(lock.request.inputs?.images?.[0]).toBe(swatchUrl(["#090a0b", "#900304", "#1d5768", "#58554a", "#8e5917", "#627163", "#979d7e", "#7daca6", "#7f907d", "#add3c0", "#ccebd8", "#b70204"]));const done = await settle(lock.id, 50_000);@@ -142,7 +144,8 @@ describe("Cinema API", () => {// Demo mode runs are free, so the guard only bites on real (paid) routes; previewing with a fake key shows the message.setSetting("falKey", "test-key");try {- expect(() => generateInProject(p.id, { ...VIDEO, duration: 10 })).toThrow(/past its \$0\.50 limit/);+ // 20 s on Fuobe Cinema at 720p is about $0.69 ($0.0347/s).+ expect(() => generateInProject(p.id, { ...VIDEO, duration: 20 })).toThrow(/past its \$0\.50 limit/);} finally {setSetting("falKey", "");}@@ -152,7 +155,12 @@ describe("Cinema API", () => {const p = cinema.createProject({ name: "Prequel" });const src = gens.createGenerations({ feature: "cinema", modelId: "seedance-2-5", prompt: "source take", params: { duration: 5 } })[0];const take = await settle(src.id);- const { items } = generateInProject(p.id, { ...VIDEO, action: "extend-backward", prompt: "he walks up to the door", source: { url: take.outputs[0].url, kind: "video" } });+ // Fuobe Cinema extends the take backward in one LTX-2.3 call.+ const one = generateInProject(p.id, { ...VIDEO, action: "extend-backward", prompt: "he walks up to the door", source: { url: take.outputs[0].url, kind: "video" } });+ expect(one.items.map((g) => [g.modelId, g.op])).toEqual([["fuobe-cinema", "extend"]]);+ expect(one.items[0].request.params?.extra).toMatchObject({ extend_direction: "backward" });+ // A partner model's prequel is the three-step chain.+ const { items } = generateInProject(p.id, { ...VIDEO, modelId: "seedance-2-5", action: "extend-backward", prompt: "he walks up to the door", source: { url: take.outputs[0].url, kind: "video" } });expect(items.map((g) => g.op)).toEqual(["frame", "edit", "flf2v"]);const film = await settle(items[2].id, 60_000);expect(film.status).toBe("succeeded");diff --git a/tests/cinema-fixes.test.ts b/tests/cinema-fixes.test.tsindex 16d43b7f..714c7351 100644--- a/tests/cinema-fixes.test.ts+++ b/tests/cinema-fixes.test.ts@@ -70,13 +70,14 @@ describe("Cinema retry", () => {it("retries a palette-locked take as a unit: the failed main step brings its palette step back", async () => {const p = cinema.createProject({ name: "Chain" });const { items } = generateInProject(p.id, { ...VIDEO, engine: "open", settings: CIRCUS });- expect(items.map((g) => g.modelId)).toEqual(["oss-wan22-14b-fast", "oss-palette-video"]);+ expect(items.map((g) => g.modelId)).toEqual(["fuobe-cinema", "oss-palette-video"]);await gens.cancelGeneration(items[0].id);expect((await settle(items[1].id)).status).toBe("failed");// Retrying the dependent finds the broken step it waits for; retrying the main finds its dependent.const again = cinema.retryItem(p.id, items[1].id);- expect(again.map((g) => g.modelId)).toEqual(["oss-wan22-14b-fast", "oss-palette-video"]);+ expect(again.map((g) => g.modelId)).toEqual(["fuobe-cinema", "oss-palette-video"]);+ expect(again[0].request.engine).toBe("open");expect(dependsOn(again[1].id)).toEqual([again[0].id]);// Its request is the unfilled one: the swatch only, the clip arrives through the chain.expect(again[1].request.inputs?.images).toEqual([circusSwatch()]);@@ -109,7 +110,8 @@ describe("Cinema retry", () => {const p = cinema.createProject({ name: "Prequel retry" });const src = gens.createGenerations({ feature: "cinema", modelId: "seedance-2-5", prompt: "source take", params: { duration: 5 } })[0];const take = await settle(src.id);- const { items } = generateInProject(p.id, { ...VIDEO, action: "extend-backward", prompt: "he walks up to the door", source: { url: take.outputs[0].url, kind: "video" } });+ // A partner model's prequel (Fuobe Cinema's is one extend call).+ const { items } = generateInProject(p.id, { ...VIDEO, modelId: "seedance-2-5", action: "extend-backward", prompt: "he walks up to the door", source: { url: take.outputs[0].url, kind: "video" } });expect(items.map((g) => g.op)).toEqual(["frame", "edit", "flf2v"]);await gens.cancelGeneration(items[0].id);await settle(items[2].id);diff --git a/tests/cinema-refs.test.ts b/tests/cinema-refs.test.tsindex 75faf0ec..93072e14 100644--- a/tests/cinema-refs.test.ts+++ b/tests/cinema-refs.test.ts@@ -6,10 +6,12 @@ import type { ModelRoute } from "@/lib/catalog/types";// Reference clips (video, audio) reach the cloud models whose field maps take them, and every other// route says plainly that they're left out. The maps come from the cloud catalog: the tests give the-// Cinema Studio 4.0 / Seedance routes the fields the catalog adds (video_urls, audio_urls) and put them back.+// Seedance / Kling routes the fields the catalog adds (video_urls, audio_urls) and put them back.+// Fuobe Cinema takes none yet (LTX-2.3's reference-video endpoint isn't read in the research).const VIDEO: CinemaGenerateInput = { engine: "cloud", mode: "video", action: "generate", prompt: "A lighthouse keeper climbs the stairs", settings: {}, duration: 5, batch: 1 };const CLIPS = { videos: ["/api/files/ref.mp4"], audios: ["/api/files/ref.mp3"] };+const ctx = { cloudAllowed: true };const saved: [ModelRoute, ModelRoute["map"]][] = [];function giveClipFields(modelId: string, op: ModelRoute["op"]) {@@ -24,50 +26,54 @@ afterEach(() => {describe("reference clips", () => {it("are sent to reference-to-video when the model's routes take them", () => {- giveClipFields("cinema-studio-4", "ref2v");- expect(takesClips(getModel("cinema-studio-4")!, "ref2v", "videos")).toBe(true);- const plan = planCinema({ ...VIDEO, ...CLIPS, images: ["/api/files/a.png"] }, { higgsfield: true });- expect(plan.model.id).toBe("cinema-studio-4");+ giveClipFields("seedance-2-5", "ref2v");+ expect(takesClips(getModel("seedance-2-5")!, "ref2v", "videos")).toBe(true);+ const plan = planCinema({ ...VIDEO, ...CLIPS, modelId: "seedance-2-5", images: ["/api/files/a.png"] }, ctx);+ expect(plan.model.id).toBe("seedance-2-5");expect(plan.blocker).toBeUndefined();const req = plan.steps[0].request;expect(req.op).toBe("ref2v");expect(req.inputs).toMatchObject({ images: ["/api/files/a.png"], ...CLIPS });expect(plan.notes.join(" ")).toMatch(/image is a reference rather than the start frame/);// Clips are references, not a scene: the prompt is still needed.- expect(planCinema({ ...VIDEO, ...CLIPS, prompt: "" }, { higgsfield: true }).blocker).toBe("Describe your scene first");+ expect(planCinema({ ...VIDEO, ...CLIPS, modelId: "seedance-2-5", prompt: "" }, ctx).blocker).toBe("Describe your scene first");});it("are left out with a note naming the models that would take them", () => {- giveClipFields("cinema-studio-4", "ref2v");- const plan = planCinema({ ...VIDEO, ...CLIPS, modelId: "kling-3" }, { higgsfield: true });+ giveClipFields("seedance-2-5", "ref2v");+ const plan = planCinema({ ...VIDEO, ...CLIPS, modelId: "kling-3" }, ctx);expect(plan.model.id).toBe("kling-3");expect(plan.steps[0].request.inputs).toBeUndefined();- // (Seedance 2.5 is named too once the cloud catalog maps its clip fields.)- expect(plan.notes.join(" ")).toMatch(/Kling 3\.0 doesn't take reference videos and reference audio — Cinema Studio 4\.0( or Seedance 2\.5 do| does)/);- // Without a Higgsfield key Cinema Studio isn't offered: Seedance is named when it takes them, else the note says plainly they're left out.- const none = planCinema({ ...VIDEO, videos: CLIPS.videos, modelId: "kling-3" }, { higgsfield: false });- expect(none.notes.join(" ")).toMatch(/Kling 3\.0 doesn't take reference videos — Seedance 2\.5 does|Reference videos aren't sent to Kling 3\.0 — only image references are used/);- expect(none.notes.join(" ")).not.toMatch(/Cinema Studio/);+ expect(plan.notes.join(" ")).toMatch(/Kling 3\.0 doesn't take reference videos and reference audio — Seedance 2\.5 does/);+ // Fuobe Cinema (the default) takes none yet: Seedance 2.5 is named.+ const original = planCinema({ ...VIDEO, ...CLIPS }, ctx);+ expect(original.model.id).toBe("fuobe-cinema");+ expect(original.steps[0].request.op).toBeUndefined();+ expect(original.notes.join(" ")).toMatch(/Fuobe Cinema doesn't take reference videos and reference audio — Seedance 2\.5 does/);+ expect(original.notes.join(" ")).not.toMatch(/Cinema Studio/);// Open models and stills never take them.- expect(planCinema({ ...VIDEO, ...CLIPS, engine: "open" }, { higgsfield: false }).notes.join(" ")).toMatch(/aren't sent to Wan 2\.2/);- expect(planCinema({ ...VIDEO, ...CLIPS, mode: "image", settings: { camera: "modern", lens: "clean-sharp", focal: "50mm" } }, { higgsfield: false }).notes).toContain(+ expect(planCinema({ ...VIDEO, ...CLIPS, engine: "open" }, ctx).notes.join(" ")).toMatch(/aren't sent to Fuobe Cinema/);+ expect(planCinema({ ...VIDEO, ...CLIPS, mode: "image", settings: { camera: "modern", lens: "clean-sharp", focal: "50mm" } }, ctx).notes).toContain("Stills use image references — reference videos and audio are left out",);});it("ride along on Edit and Extend when those routes take them", () => {- giveClipFields("seedance-2-5", "v2v");+ giveClipFields("kling-o3", "v2v");giveClipFields("seedance-2-5", "extend");const source = { url: "/api/files/take.mp4", kind: "video" as const };- const edit = planCinema({ ...VIDEO, ...CLIPS, action: "edit", prompt: "make it snow", source }, { higgsfield: true });- expect(edit.model.id).toBe("seedance-2-5");+ // A partner's take is edited with Kling O3, which (here) takes clips.+ const edit = planCinema({ ...VIDEO, ...CLIPS, modelId: "seedance-2-5", action: "edit", prompt: "make it snow", source }, ctx);+ expect(edit.model.id).toBe("kling-o3");expect(edit.steps[0].request.inputs).toMatchObject({ video: source.url, ...CLIPS });- const ext = planCinema({ ...VIDEO, ...CLIPS, action: "extend-forward", source }, { higgsfield: false });+ const ext = planCinema({ ...VIDEO, ...CLIPS, modelId: "seedance-2-5", action: "extend-forward", source }, ctx);+ expect(ext.model.id).toBe("seedance-2-5");expect(ext.steps[0].request.inputs).toMatchObject({ video: source.url, ...CLIPS });- const kling = planCinema({ ...VIDEO, ...CLIPS, action: "edit", prompt: "make it snow", source }, { higgsfield: false });- expect(kling.model.id).toBe("kling-o3");- expect(kling.steps[0].request.inputs).toEqual({ video: source.url });- expect(kling.notes.join(" ")).toMatch(/aren't sent to Kling O3/);+ // Fuobe Cinema's edit (LTX-2.3 video to video) takes only the take.+ const original = planCinema({ ...VIDEO, ...CLIPS, action: "edit", prompt: "make it snow", source }, ctx);+ expect(original.model.id).toBe("fuobe-cinema");+ expect(original.steps[0].request.inputs).toEqual({ video: source.url });+ expect(original.notes.join(" ")).toMatch(/aren't sent to Fuobe Cinema/);});});diff --git a/tests/cinema-scene.test.ts b/tests/cinema-scene.test.tsindex 8fdcac56..0ac8397e 100644--- a/tests/cinema-scene.test.ts+++ b/tests/cinema-scene.test.ts@@ -28,7 +28,7 @@ afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));const STILL = "/api/files/uploads/still.png";const CAPTURE = "/api/files/uploads/capture.png";-const ctx = { higgsfield: false, cloudAllowed: true };+const ctx = { cloudAllowed: true };const base = { mode: "image" as const, prompt: "", settings: {}, aspectRatio: "16:9" };const scene = (engine: "cloud" | "open"): CinemaGenerateInput => ({ ...base, engine, action: "scene", source: { url: STILL, kind: "image" } });const capture = { url: CAPTURE, lens: 85, aperture: 1.4, pose: { horizontal: 45, vertical: 30, zoom: 7 } };diff --git a/tests/cinema.test.ts b/tests/cinema.test.tsindex 6eedf361..163c37e2 100644--- a/tests/cinema.test.ts+++ b/tests/cinema.test.ts@@ -2,10 +2,16 @@ import fs from "node:fs";import path from "node:path";import { describe, expect, it } from "vitest";import { getModel } from "@/lib/catalog";+import { onEngine } from "@/lib/catalog/engines";import {APERTURES,CAMERA_BODIES,CAMERA_MOVES,+ CAST_MODELS,+ CINEMA_CAMERA_LORA,+ CINEMA_MAX_SECONDS,+ CINEMA_MODELS,+ LOCATION_MODELS,EMOTION_FAMILIES,ERAS,GENRES,@@ -18,6 +24,7 @@ import {applyEmotions,castPrompt,checkReferences,+ cinemaMoveRoute,compileDirector,gridPrompt,openCameraRoute,@@ -192,81 +199,180 @@ const base = (over: Partial<CinemaGenerateInput>): CinemaGenerateInput => ({...over,});+const ctx = { cloudAllowed: true };+const route = (id: string, op: string, engine: "open" | "cloud" = "cloud") => onEngine(getModel(id)!, engine).routes.find((r) => r.op === op)!;+describe("planCinema", () => {- it("runs Cinema Studio 4.0 natively with a Higgsfield key, fitted to what the API takes", () => {- const plan = planCinema(base({}), { higgsfield: true });- expect(plan.model.id).toBe("cinema-studio-4");+ it("runs Fuobe Cinema on LTX-2.3 in the cloud: the Director in the prompt, the move as camera_lora, prompt expansion off", () => {+ const plan = planCinema(base({}), ctx);+ expect(plan.model).toMatchObject({ id: "fuobe-cinema", engine: "cloud" });expect(plan.blocker).toBeUndefined();const req = plan.steps[0].request;- expect(req.params).toMatchObject({ aspectRatio: "21:9", resolution: "720p", duration: 10, numOutputs: 2, generateAudio: true });- expect(req.params!.extra).toMatchObject({ genre: "noir", camera_movement: "dolly-in", color_palette: "neon-rain-at-midnight" });- expect(plan.notes.join(" ")).toMatch(/up to 720p/);- // 2 takes × 10 s × $0.4623.- expect(plan.costUsd).toBeCloseTo(9.246, 2);- // The payload Higgsfield receives.- const route = getModel("cinema-studio-4")!.routes.find((r) => r.op === "t2v")!;- const payload = buildPayload(route.map!, { ...req.params, prompt: req.prompt });- expect(payload).toMatchObject({ aspect_ratio: "21:9", resolution: "720p", duration: 10, genre: "noir", era: "1980s", pacing: "calm", light: "window", camera_movement: "dolly-in" });+ expect(req).toMatchObject({ modelId: "fuobe-cinema", engine: "cloud" });+ expect(req.params).toMatchObject({ aspectRatio: "21:9", resolution: "1080p", duration: 10, numOutputs: 2, generateAudio: true, extra: { camera_lora: "dolly_in" } });+ expect(req.prompt).toContain("Noir film");+ expect(req.prompt).toMatch(/Camera moves, in this order: first .*; finally /);+ expect(plan.notes).toContain("Dolly In drives LTX-2.3's dolly in camera LoRA");+ // 2 takes × 10 s × the 1080p rate ($0.001605 per megapixel of 1920×1088×24 frames).+ expect(plan.costUsd).toBeCloseTo(2 * 10 * 0.0805, 3);+ // What fal receives: the tier's exact size, 241 frames at 24 fps (8n+1), the camera LoRA, prompt expansion off.+ const payload = buildPayload(route("fuobe-cinema", "t2v").map!, { ...req.params, prompt: req.prompt });+ expect(payload).toMatchObject({ video_size: { width: 2240, height: 960 }, num_frames: 241, camera_lora: "dolly_in", enable_prompt_expansion: false, generate_audio: true });+ // Sound off is sent as off.+ const silent = planCinema(base({ audio: false }), ctx).steps[0].request;+ expect(buildPayload(route("fuobe-cinema", "t2v").map!, { ...silent.params, prompt: silent.prompt })).toMatchObject({ generate_audio: false });+ });++ it("a take longer than 20 s is one LTX-2.3 call plus one extend for the rest", () => {+ const plan = planCinema(base({ duration: 30 }), ctx);+ expect(plan.steps.map((s) => s.key)).toEqual(["main", "more"]);+ expect(plan.steps[0].request.params!.duration).toBe(20);+ expect(plan.steps[1]).toMatchObject({ after: ["main"], perJobOf: "main", request: { modelId: "fuobe-cinema", engine: "cloud", op: "extend", chain: [{ slot: "video" }], params: { duration: 10, extra: { camera_lora: "dolly_in" } } } });+ expect(plan.steps[1].request.step).toMatchObject({ label: "Extended to 30s", index: 1, of: 2 });+ expect(plan.notes.join(" ")).toMatch(/an extend adds the last 10s/);+ // 20 s at 481 frames; the extend adds 241 frames; both takes are extended.+ expect(buildPayload(route("fuobe-cinema", "t2v").map!, { ...plan.steps[0].request.params, prompt: "x" })).toMatchObject({ num_frames: 481 });+ expect(buildPayload(route("fuobe-cinema", "extend").map!, { ...plan.steps[1].request.params, prompt: "x", video: "https://x/take.mp4" })).toMatchObject({ num_frames: 241, video_url: "https://x/take.mp4" });+ expect(plan.costUsd).toBeCloseTo(2 * 30 * 0.0805, 3);+ // Any whole second up to 20 in one call (no rounding to a preset length).+ expect(planCinema(base({ duration: 7 }), ctx).steps[0].request.params!.duration).toBe(7);});- it("falls back to Seedance 2.5 with the Director in the prompt without a Higgsfield key", () => {- const plan = planCinema(base({ modelId: "cinema-studio-4" }), { higgsfield: false });+ it("partner models stay pickable with the Director in the prompt", () => {+ const plan = planCinema(base({ modelId: "seedance-2-5" }), ctx);expect(plan.model.id).toBe("seedance-2-5");- expect(plan.notes[0]).toMatch(/needs a Higgsfield key/);const req = plan.steps[0].request;expect(req.params!.extra).toBeUndefined();expect(req.prompt).toContain("Noir film");expect(req.params!.duration).toBe(10);- // Kling 3.0 and Veo 3.1 fit the duration to what they make.- expect(planCinema(base({ modelId: "kling-3", duration: 30 }), { higgsfield: false }).steps[0].request.params!.duration).toBe(15);- expect(planCinema(base({ modelId: "veo-3-1", duration: 30 }), { higgsfield: false }).steps[0].request.params!.duration).toBe(8);+ expect(planCinema(base({ modelId: "kling-3", duration: 30 }), ctx).steps[0].request.params!.duration).toBe(15);+ expect(planCinema(base({ modelId: "veo-3-1", duration: 30 }), ctx).steps[0].request.params!.duration).toBe(8);+ // An old pick (Cinema Studio 4.0 on Higgsfield) falls back to the Original.+ expect(planCinema(base({ modelId: "cinema-studio-4" }), ctx).model.id).toBe("fuobe-cinema");+ expect(CINEMA_MODELS.video.cloud).not.toContain("cinema-studio-4");+ expect(CINEMA_MODELS.image.cloud).not.toContain("soul-cinema");});- it("open engine: Wan 2.2 Lightning, camera LoRA or Fun Camera, then a palette lock per take", () => {- const plan = planCinema(base({ engine: "open", moves: ["arc-left"], images: ["/api/files/a.png", "/api/files/b.png"] }), { higgsfield: false });- expect(plan.model.id).toBe("oss-wan22-14b-fast");+ it("open engine: Fuobe Cinema on Wan 2.2 Lightning, camera LoRA or Fun Camera, then a palette lock per take", () => {+ const plan = planCinema(base({ engine: "open", moves: ["arc-left"], images: ["/api/files/a.png", "/api/files/b.png"] }), ctx);+ expect(plan.model).toMatchObject({ id: "fuobe-cinema", engine: "open" });+ expect(plan.steps[0].request.engine).toBe("open");expect(plan.steps[0].request.loras?.length).toBeGreaterThan(0);expect(plan.steps[0].request.prompt).toMatch(/^orbit 360\. /);expect(plan.steps[0].request.inputs).toEqual({ images: ["/api/files/a.png"] });+ expect(plan.notes.join(" ")).toMatch(/doesn't make 21:9/);// Without a start frame the move is camera language in the prompt.- const t2v = planCinema(base({ engine: "open", moves: ["arc-left"] }), { higgsfield: false });+ const t2v = planCinema(base({ engine: "open", moves: ["arc-left"] }), ctx);expect(t2v.steps[0].request.loras).toBeUndefined();expect(t2v.notes.join(" ")).toMatch(/add a start frame/);expect(plan.steps[0].request.params!.duration).toBe(5);+ expect(plan.steps[0].request.params!.generateAudio).toBeUndefined();expect(plan.steps[1]).toMatchObject({ key: "palette", perJobOf: "main", after: ["main"] });expect(plan.steps[1].request).toMatchObject({ modelId: "oss-palette-video", op: "color-match", chain: [{ slot: "video" }] });expect(plan.steps[1].swatch).toEqual(PALETTES.find((p) => p.slug === "neon-rain-at-midnight")!.hex);expect(plan.costUsd).toBe(0);- // A Fun Camera pose needs a start frame; without one the move goes into the prompt.+ // A Fun Camera pose needs a start frame; it stays on Fuobe Cinema (its image-to-video graph runs the pose).expect(openCameraRoute("pan-left", true)).toMatchObject({ via: "fun-camera", pose: "Pan Left" });- const withFrame = planCinema(base({ engine: "open", moves: ["pan-left"], images: ["/api/files/a.png"], settings: {} }), { higgsfield: false });- expect(withFrame.model.id).toBe("oss-wan22-fun-camera");+ const withFrame = planCinema(base({ engine: "open", moves: ["pan-left"], images: ["/api/files/a.png"], settings: {} }), ctx);+ expect(withFrame.model.id).toBe("fuobe-cinema");expect(withFrame.steps[0].request.params!.extra).toMatchObject({ cameraMotion: "Pan Left" });expect(withFrame.steps).toHaveLength(1);- const noLock = planCinema(base({ engine: "open", settings: { ...NOIR, paletteLock: false } }), { higgsfield: false });+ const noLock = planCinema(base({ engine: "open", settings: { ...NOIR, paletteLock: false } }), ctx);expect(noLock.steps).toHaveLength(1);+ // LTX-2.5 is the open choice with sound; partner moves are words.+ const ltx = planCinema(base({ engine: "open", modelId: "oss-ltx25", moves: ["arc-left"], images: ["/api/files/a.png"] }), ctx);+ expect(ltx.model.id).toBe("oss-ltx25");+ expect(ltx.steps[0].request.loras).toBeUndefined();+ });++ it("every camera move has a route on both engines, and the camera LoRA map is the research's", () => {+ const rec = JSON.parse(fs.readFileSync(path.join(__dirname, "../docs/research/fuobe-originals-recipes-5.json"), "utf8")).studios.find((s: { id: string }) => s.id === "cinema-studio").original;+ expect(CINEMA_CAMERA_LORA).toEqual(rec.cameraLora.moves);+ expect(Object.keys(CINEMA_CAMERA_LORA)).toEqual(CAMERA_MOVES.map((m) => m.slug));+ expect(CINEMA_MAX_SECONDS).toBe(Math.floor(rec.cloud.maxFrames / rec.cloud.fps));+ // Every camera_lora value is one the endpoint takes.+ const enumValues = JSON.parse(fs.readFileSync(path.join(__dirname, "../docs/research/fuobe-originals-recipes-5.json"), "utf8"))+ .hostedLoraEndpoints.find((e: { id: string }) => e.id === "fal-ai/ltx-2.3-22b/image-to-video/lora").inputs.camera_lora.values;+ for (const v of Object.values(CINEMA_CAMERA_LORA)) if (v) expect(enumValues).toContain(v);++ // Cloud, with a start frame: camera_lora (on Fuobe Cinema) or the move's Wan LoRA (on Fuobe DoP) or a hosted move; else words.+ const words = new Set<string>();+ for (const m of CAMERA_MOVES) {+ const plan = planCinema(base({ moves: [m.slug], images: ["/api/files/a.png"], settings: {} }), ctx);+ const req = plan.steps[0].request;+ expect(plan.blocker, m.slug).toBeUndefined();+ const r = cinemaMoveRoute(m.slug, "cloud", true);+ if (r.via === "camera-lora") {+ expect(req.modelId).toBe("fuobe-cinema");+ expect(buildPayload(route("fuobe-cinema", "i2v").map!, { ...req.params, prompt: req.prompt, images: ["https://x/a.png"] }).camera_lora, m.slug).toBe(CINEMA_CAMERA_LORA[m.slug]);+ } else if (r.via === "lora") {+ expect(req.modelId, m.slug).toBe("fuobe-dop");+ expect(req.loras!.length, m.slug).toBeGreaterThan(0);+ expect(req.loras!.every((l) => l.licence?.hostedOk !== false), m.slug).toBe(true);+ } else if (r.via === "hosted-move") {+ expect(req.modelId).toBe("ltx-2-5-fast");+ expect(req.params!.extra).toMatchObject({ camera_motion: "focus_shift" });+ } else {+ expect(req.modelId).toBe("fuobe-cinema");+ words.add(m.slug);+ }+ // On the user's GPU every move is a Wan LoRA, a Fun Camera pose or words, always on Fuobe Cinema.+ const open = planCinema(base({ engine: "open", moves: [m.slug], images: ["/api/files/a.png"], settings: {} }), ctx).steps[0].request;+ expect(open.modelId).toBe("fuobe-cinema");+ const o = cinemaMoveRoute(m.slug, "open", true);+ if (o.via === "lora") expect(open.loras?.length).toBeGreaterThan(0);+ if (o.via === "fun-camera") expect(open.params!.extra).toMatchObject({ cameraMotion: o.pose });+ }+ expect([...words].sort()).toEqual(["helicopter-shot", "pan-left", "pan-right", "tilt-down", "tilt-up", "whip-pan"]);+ expect(Object.values(CINEMA_CAMERA_LORA).filter(Boolean)).toHaveLength(14);});- it("multi-shot: Auto on Seedance, Manual into one prompt on Cinema Studio 4.0", () => {- const auto = planCinema(base({ multiShot: { mode: "auto" } }), { higgsfield: false });+ it("a Wan-only move runs on Fuobe DoP in the cloud, Rack Focus on LTX-2.5's focus shift; both need a start frame", () => {+ const arc = planCinema(base({ moves: ["arc-left"], images: ["/api/files/a.png"] }), ctx);+ expect(arc.model).toMatchObject({ id: "fuobe-dop", engine: "cloud" });+ expect(arc.steps[0].request.prompt).toMatch(/^orbit 360\. /);+ expect(arc.notes.join(" ")).toMatch(/made for Wan 2.2, so this take runs on Fuobe DoP/);+ expect(arc.steps[0].request.params!.duration).toBe(5);+ // Wan 2.2 A14B with LoRAs: $0.10/s.+ expect(arc.costUsd).toBeCloseTo(2 * 5 * 0.1, 3);+ const t2v = planCinema(base({ moves: ["arc-left"] }), ctx);+ expect(t2v.model.id).toBe("fuobe-cinema");+ expect(t2v.notes.join(" ")).toMatch(/add a start frame to drive it with its camera LoRA$/);+ const focus = planCinema(base({ moves: ["rack-focus"], images: ["/api/files/a.png"], aspectRatio: "16:9" }), ctx);+ expect(focus.model.id).toBe("ltx-2-5-fast");+ expect(focus.steps[0].request.params!.extra).toMatchObject({ camera_motion: "focus_shift" });+ });++ it("multi-shot: Auto on Seedance, Manual into one prompt on Fuobe Cinema in the cloud, one clip per shot on the GPU", () => {+ const auto = planCinema(base({ modelId: "seedance-2-5", multiShot: { mode: "auto" } }), ctx);expect(auto.steps[0].request.params!.multiShot).toBe("auto");- const manual = planCinema(- base({ multiShot: { mode: "manual", shots: [{ prompt: "wide of the street", duration: 4 }, { prompt: "close on @maya", duration: 6 }] } }),- { higgsfield: true },- );+ expect(planCinema(base({ multiShot: { mode: "auto" } }), ctx).notes.join(" ")).toMatch(/can't plan its own cuts/);+ const shots = [{ prompt: "wide of the street", duration: 4 }, { prompt: "close on @maya", duration: 6 }];+ const manual = planCinema(base({ multiShot: { mode: "manual", shots } }), ctx);expect(manual.steps[0].request.prompt).toMatch(/Shot 1 \[0-4s\]: wide of the street\. Shot 2 \[4-10s\]: close on @maya/);expect(manual.steps[0].request.params!.duration).toBe(10);+ const open = planCinema(base({ engine: "open", multiShot: { mode: "manual", shots } }), ctx);+ expect(open.steps[0].request.params!.shots).toEqual([{ prompt: "wide of the street", duration: 3 }, { prompt: "close on @maya", duration: 5 }]);});- it("image mode: stills need the camera; grids are one contact sheet", () => {- const blocked = planCinema(base({ mode: "image", settings: { genre: "noir" } }), { higgsfield: false });+ it("image mode: stills on Fuobe Soul Cinema need the camera; grids are one contact sheet", () => {+ const blocked = planCinema(base({ mode: "image", settings: { genre: "noir" } }), ctx);expect(blocked.blocker).toMatch(/Camera settings are required/);- const still = planCinema(base({ mode: "image", resolution: undefined }), { higgsfield: false });+ const still = planCinema(base({ mode: "image", resolution: undefined }), ctx);expect(still.blocker).toBeUndefined();- expect(still.model.id).toBe("nano-banana-pro");- expect(still.steps[0].request).toMatchObject({ feature: "cinema-image", params: { aspectRatio: "21:9", resolution: "1K", numOutputs: 2 } });- const grid = planCinema(base({ mode: "image", action: "grid", grid: { size: "3x3", type: "zooms" } }), { higgsfield: false });+ expect(still.model).toMatchObject({ id: "fuobe-soul-cinema", engine: "cloud" });+ // Cinema's 1K is Soul's 720p tier (about 1 MP); 21:9 is Soul Cinema's crop.+ expect(still.steps[0].request).toMatchObject({ feature: "cinema-image", engine: "cloud", params: { aspectRatio: "21:9", resolution: "720p", numOutputs: 2 } });+ expect(planCinema(base({ mode: "image", resolution: "4K" }), ctx).notes.join(" ")).toMatch(/up to about 2 megapixels/);+ const open = planCinema(base({ mode: "image", engine: "open", resolution: "2K" }), ctx);+ expect(open.model).toMatchObject({ id: "fuobe-soul-cinema", engine: "open" });+ expect(open.steps.map((s) => s.request.modelId)).toEqual(["fuobe-soul-cinema", "oss-palette-image"]);+ expect(open.steps[0].request.params!.resolution).toBe("1080p");+ expect(open.costUsd).toBe(0);+ // A partner still stays pickable.+ expect(planCinema(base({ mode: "image", modelId: "nano-banana-pro" }), ctx).model.id).toBe("nano-banana-pro");+ const grid = planCinema(base({ mode: "image", action: "grid", grid: { size: "3x3", type: "zooms" } }), ctx);expect(grid.steps[0].request.params!.numOutputs).toBe(1);expect(grid.steps[0].request.prompt).toMatch(/3×3 grid of 9 equally sized film stills/);expect(grid.steps[0].request.prompt).toMatch(/extreme wide shot/);@@ -275,25 +381,38 @@ describe("planCinema", () => {it("extend forward / backward and edit on a selected take", () => {const source = { url: "/api/files/take.mp4", kind: "video" as const };- const fwd = planCinema(base({ action: "extend-forward", source }), { higgsfield: true });- expect(fwd.model.id).toBe("seedance-2-5");- expect(fwd.steps[0].request).toMatchObject({ op: "extend", inputs: { video: source.url } });- expect(planCinema(base({ engine: "open", action: "extend-forward", source }), { higgsfield: false }).model.id).toBe("oss-wan22-vace-extend");-- const back = planCinema(base({ action: "extend-backward", source }), { higgsfield: false });- expect(back.steps.map((s) => s.key)).toEqual(["frame", "before", "main"]);- expect(back.steps[0].request).toMatchObject({ modelId: "extract-frame", params: { extra: { frame_type: "first" } } });- expect(back.steps[2]).toMatchObject({ after: ["before", "frame"], request: { op: "flf2v", chain: [{ slot: "images", position: "first" }, { slot: "endImage" }] } });- const backOpen = planCinema(base({ engine: "open", action: "extend-backward", source: { ...source, firstFrame: "/api/files/f.png" } }), { higgsfield: false });- expect(backOpen.steps.map((s) => s.request.modelId)).toEqual(["oss-qwen-edit", "oss-wan22-14b-fast"]);- expect(backOpen.steps[1].request.inputs).toEqual({ endImage: "/api/files/f.png" });-- expect(planCinema(base({ action: "edit", source, prompt: "make it snow" }), { higgsfield: false }).steps[0].request).toMatchObject({ modelId: "kling-o3", op: "v2v" });- expect(planCinema(base({ action: "edit", source, prompt: "make it snow" }), { higgsfield: true }).steps[0].request.modelId).toBe("seedance-2-5");- expect(planCinema(base({ action: "edit", source: undefined }), { higgsfield: false }).blocker).toBe("Select a video take to edit");+ const fwd = planCinema(base({ action: "extend-forward", source }), ctx);+ expect(fwd.model).toMatchObject({ id: "fuobe-cinema", engine: "cloud" });+ expect(fwd.steps[0].request).toMatchObject({ op: "extend", engine: "cloud", inputs: { video: source.url }, params: { duration: 10, numOutputs: 1, extra: { camera_lora: "dolly_in" } } });+ // A partner that extends on fal keeps the take; on the GPU it is Wan 2.2 Fun VACE.+ expect(planCinema(base({ modelId: "seedance-2-5", action: "extend-forward", source }), ctx).model.id).toBe("seedance-2-5");+ expect(planCinema(base({ engine: "open", action: "extend-forward", source }), ctx).model.id).toBe("oss-wan22-vace-extend");++ // Fuobe Cinema's prequel: LTX-2.3 extends the take backward in one call.+ const back = planCinema(base({ action: "extend-backward", source }), ctx);+ expect(back.steps).toHaveLength(1);+ expect(back.steps[0].request).toMatchObject({ modelId: "fuobe-cinema", op: "extend", inputs: { video: source.url }, params: { extra: { extend_direction: "backward" } } });+ expect(buildPayload(route("fuobe-cinema", "extend").map!, { ...back.steps[0].request.params, prompt: "x", video: "https://x/t.mp4" })).toMatchObject({ extend_direction: "backward", enable_prompt_expansion: false });+ // A partner's prequel: the first frame, the moment before, then a start/end-frame clip.+ const partner = planCinema(base({ modelId: "seedance-2-5", action: "extend-backward", source }), ctx);+ expect(partner.steps.map((s) => s.key)).toEqual(["frame", "before", "main"]);+ expect(partner.steps[0].request).toMatchObject({ modelId: "extract-frame", params: { extra: { frame_type: "first" } } });+ expect(partner.steps[2]).toMatchObject({ after: ["before", "frame"], request: { op: "flf2v", chain: [{ slot: "images", position: "first" }, { slot: "endImage" }] } });+ const backOpen = planCinema(base({ engine: "open", action: "extend-backward", source: { ...source, firstFrame: "/api/files/f.png" } }), ctx);+ expect(backOpen.steps.map((s) => s.request.modelId)).toEqual(["oss-qwen-edit", "fuobe-cinema"]);+ expect(backOpen.steps[1].request).toMatchObject({ engine: "open", op: "flf2v", inputs: { endImage: "/api/files/f.png" } });++ // Edit: LTX-2.3 video to video on Fuobe Cinema; a partner's take is edited with Kling O3.+ const edit = planCinema(base({ action: "edit", source, prompt: "make it snow", images: ["/api/files/ref.png"] }), ctx);+ expect(edit.steps[0].request).toMatchObject({ modelId: "fuobe-cinema", engine: "cloud", op: "v2v", inputs: { video: source.url } });+ expect(edit.steps[0].request.inputs!.images).toBeUndefined();+ const kling = planCinema(base({ modelId: "seedance-2-5", action: "edit", source, prompt: "make it snow" }), ctx);+ expect(kling.steps[0].request).toMatchObject({ modelId: "kling-o3", op: "v2v" });+ expect(kling.notes.join(" ")).toMatch(/edited with Kling O3/);+ expect(planCinema(base({ action: "edit", source: undefined }), ctx).blocker).toBe("Select a video take to edit");});- it("Soul Cast and Soul Location prompts", () => {+ it("Soul Cast and Soul Location on Fuobe Soul, other views with the Multiple-Angles LoRA", () => {const values = { genre: "Western", budget: 150, era: 1880, archetype: "Rebel", gender: "Female", race: "Latino", age: 35, facial_hair: "Beard", imperfections: ["Freckles", "Facial scar"], outfit: "Workwear" };expect(visibleCast(values).facial_hair).toBeUndefined();const p = castPrompt(values);@@ -303,12 +422,27 @@ describe("planCinema", () => {expect(p).toMatch(/Full-body front view, three-quarter view, side profile and back view/);const r = randomizeCast({}, () => 0.5);expect(Object.keys(r).sort()).toEqual(["age", "archetype", "era", "gender", "genre", "race"]);- const cast = planCinema(base({ action: "cast", mode: "image", cast: values, prompt: "" }), { higgsfield: false });+ const cast = planCinema(base({ action: "cast", mode: "image", cast: values, prompt: "" }), ctx);expect(cast.blocker).toBeUndefined();- expect(cast.steps[0].request).toMatchObject({ feature: "cinema-cast", modelId: "nano-banana-pro", params: { aspectRatio: "16:9" } });- expect(planCinema(base({ action: "cast", mode: "image", cast: values }), { higgsfield: true }).model.id).toBe("soul-2");- const loc = planCinema(base({ action: "location", mode: "image", prompt: "an abandoned diner on Route 66", brief: "" }), { higgsfield: false });+ expect(cast.steps[0].request).toMatchObject({ feature: "cinema-cast", modelId: "fuobe-soul", engine: "cloud", presetId: "v1-realistic", params: { aspectRatio: "16:9", resolution: "1080p" } });+ expect(planCinema(base({ action: "cast", mode: "image", cast: values, engine: "open" }), ctx).model).toMatchObject({ id: "fuobe-soul", engine: "open" });+ expect(planCinema(base({ action: "cast", mode: "image", cast: values, engine: "open", modelId: "oss-zimage-soul-cast" }), ctx).model.id).toBe("oss-zimage-soul-cast");+ expect(planCinema(base({ action: "cast", mode: "image", cast: values, modelId: "nano-banana-pro" }), ctx).model.id).toBe("nano-banana-pro");+ expect(CAST_MODELS.cloud).not.toContain("soul-2");++ const loc = planCinema(base({ action: "location", mode: "image", prompt: "an abandoned diner on Route 66", brief: "" }), ctx);+ expect(loc.steps[0].request).toMatchObject({ modelId: "fuobe-soul", presetId: "v1-movie", params: { aspectRatio: "16:9", resolution: "1080p" } });expect(loc.steps[0].request.prompt).toMatch(/^Establishing shot of a film location: an abandoned diner on Route 66\. An empty set with no people/);+ expect(LOCATION_MODELS.cloud).not.toContain("soul-cinema");++ const still = { url: "/api/files/diner.png", kind: "image" as const };+ const reverse = planCinema(base({ action: "location-view", mode: "image", view: "reverse", source: still, prompt: "" }), ctx);+ expect(reverse.steps[0].request).toMatchObject({ modelId: "qwen-multiple-angles", op: "edit", inputs: { images: [still.url] }, params: { extra: { horizontal_angle: 180, vertical_angle: 0, zoom: 5 } } });+ const high = planCinema(base({ action: "location-view", mode: "image", view: "high", source: still, prompt: "", engine: "open" }), ctx);+ expect(high.steps[0].request).toMatchObject({ modelId: "oss-qwen-edit", op: "edit" });+ expect(high.steps[0].request.prompt).toMatch(/^<sks> front view high-angle shot medium shot\. Show the same location from a high angle/);+ expect(high.steps[0].request.loras?.[0].file).toMatch(/multiple-angles/);+ expect(planCinema(base({ action: "location-view", mode: "image", view: "wide", prompt: "" }), ctx).blocker).toBe("Pick the location image to re-angle");});});diff --git a/tests/scene3d-provider.test.ts b/tests/scene3d-provider.test.tsindex 002f244a..5e2cc933 100644--- a/tests/scene3d-provider.test.ts+++ b/tests/scene3d-provider.test.ts@@ -100,7 +100,7 @@ describe("open engine: the recomposition on Qwen-Image-Edit 2511 (qwen-image-edisource: { url: "/api/files/uploads/still.png", kind: "image" },capture: { url: "/api/files/uploads/capture.png", lens: 50, aperture: 2.8, pose: { horizontal: 300, vertical: 0, zoom: 5 } },},- { higgsfield: false },+ { cloudAllowed: true },);const req = plan.steps[0].request;const route = getModel(req.modelId!)!.routes[0];