Skip to content

armgit / fuobe

Public Imported from GitHub
0

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

WorldCast: Fly path, Turnaround and exact orbits film with WorldCast on your GPU when its worker answers

Claudec8fca0447e56
diff --git a/scripts/comfy/hand-built/image-person-mask-sam3.json b/scripts/comfy/hand-built/image-person-mask-sam3.json
new file mode 100644
index 00000000..d7347b5f
--- /dev/null
+++ b/scripts/comfy/hand-built/image-person-mask-sam3.json
@@ -0,0 +1,12 @@
+{
+ "1": { "class_type": "LoadImage", "inputs": { "image": "example.png" }, "_meta": { "title": "Picture" } },
+ "2": { "class_type": "CheckpointLoaderSimple", "inputs": { "ckpt_name": "sam3.1_multiplex_fp16.safetensors" }, "_meta": { "title": "SAM 3.1" } },
+ "3": { "class_type": "CLIPTextEncode", "inputs": { "text": "person", "clip": ["2", 1] }, "_meta": { "title": "Who to find (text)" } },
+ "4": {
+ "class_type": "SAM3_Detect",
+ "inputs": { "model": ["2", 0], "image": ["1", 0], "conditioning": ["3", 0], "threshold": 0.4, "refine_iterations": 2, "individual_masks": false },
+ "_meta": { "title": "SAM 3.1: the person, one mask" }
+ },
+ "5": { "class_type": "MaskToImage", "inputs": { "mask": ["4", 0] }, "_meta": { "title": "Mask as a picture (white = the person)" } },
+ "6": { "class_type": "SaveImage", "inputs": { "images": ["5", 0], "filename_prefix": "fuobe/image-person-mask-sam3" }, "_meta": { "title": "Save" } }
+}
diff --git a/scripts/comfy/library.spec.mjs b/scripts/comfy/library.spec.mjs
index fd41a48f..9d38c2d8 100644
--- a/scripts/comfy/library.spec.mjs
+++ b/scripts/comfy/library.spec.mjs
@@ -2716,6 +2716,26 @@ export const SPEC = [
'No face found: the picture comes back unchanged. Core nodes and the SAM 3.1 checkpoint only.',
},
+ {
+ id: 'image-person-mask-sam3',
+ title: 'Person mask (SAM 3.1, core nodes)',
+ capability: 'bg-remove',
+ handBuilt: 'hand-built/image-person-mask-sam3.json',
+ bindings: {
+ image: [b('1', 'image')],
+ prompt: [b('3', 'text')],
+ threshold: [b('4', 'threshold')],
+ },
+ outputs: [{ node: '6', kind: 'image' }],
+ limits: { maxWidth: 4096, maxHeight: 4096 },
+ vramGb: 4,
+ license: 'Meta SAM License (SAM 3.1: royalty-free, commercial use allowed; attribution + acceptable-use terms)',
+ modelUrls: { 'sam3.1_multiplex_fp16.safetensors': 'https://huggingface.co/Comfy-Org/sam3.1/resolve/7bb8374780a725b4353ed31f3a9395c9742b5621/checkpoints/sam3.1_multiplex_fp16.safetensors' },
+ notes:
+ 'WorldCast cases (N7-9): the person in the still and in each view as a mask, white where they are, the size of the picture. SAM3_Detect with the words (prompt, "person" by default; ' +
+ 'threshold 0.4, every match merged into one mask) then MaskToImage. The WorldCast worker cuts its tight no_padding_black crops from it. Core nodes and the SAM 3.1 checkpoint only.',
+ },
+
// ---- palette / colour lock ----------------------------------------------
{
id: 'palette-transfer-image',
diff --git a/scripts/comfy/validation-state.json b/scripts/comfy/validation-state.json
index a48312aa..54dd7639 100644
--- a/scripts/comfy/validation-state.json
+++ b/scripts/comfy/validation-state.json
@@ -185,6 +185,12 @@
"error": null,
"at": "2026-10-29T10:46:02.938Z"
},
+ "image-person-mask-sam3": {
+ "sha256": "81f9b96a74bb2dfe09589e87c53ecb843f08d57b08a4e8b2418ae138f539a659",
+ "validated": true,
+ "error": null,
+ "at": "2026-11-02T21:03:03.876Z"
+ },
"image-to-3d-hunyuan3d-21": {
"sha256": "275a30c4184a8728e919166e72d88913abcf61a85b051a897ecb7249db849a08",
"validated": true,
diff --git a/src/app/api/cinema/projects/[id]/route.ts b/src/app/api/cinema/projects/[id]/route.ts
index 19b58e12..26a4feb1 100644
--- a/src/app/api/cinema/projects/[id]/route.ts
+++ b/src/app/api/cinema/projects/[id]/route.ts
@@ -1,17 +1,21 @@
import { connection } from "next/server";
import { CinemaError, deleteProject, getProject, listFolders, spentUsd, updateProject } from "@/server/cinema";
import { ProjectPatch, body, handle } from "@/server/cinema-schemas";
+import { requestViewer } from "@/server/auth";
import { cinemaContext } from "@/server/cinema-generate";
+import { worldcastContextNow } from "@/server/worldcast-on";
/** The project with its folders, its estimated spend and what this install can run (cloud models allowed, a civitai key). */
-export async function GET(_req: Request, ctx: RouteContext<"/api/cinema/projects/[id]">) {
+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 { cloudAllowed, civitai } = cinemaContext();
- return Response.json({ project, folders: listFolders(id), spentUsd: spentUsd(id), context: { cloudAllowed, civitai } });
+ // The studio's WorldCast worker, for its owner only (N7-9): the Fly path says what it films on.
+ const worldcast = requestViewer(req).kind === "owner" ? await worldcastContextNow() : undefined;
+ return Response.json({ project, folders: listFolders(id), spentUsd: spentUsd(id), context: { cloudAllowed, civitai, ...(worldcast !== undefined && { worldcast }) } });
});
}
diff --git a/src/app/api/fly-around/route.ts b/src/app/api/fly-around/route.ts
index 44eb17b4..36e4b33a 100644
--- a/src/app/api/fly-around/route.ts
+++ b/src/app/api/fly-around/route.ts
@@ -1,6 +1,7 @@
import { body, handle, once } from "@/server/shorts-schemas";
import { createFlyAround, FlyAroundSchema, previewFlyAround } from "@/server/fly-around";
import { priceAs } from "@/server/visitor";
+import { worldcastContextNow } from "@/server/worldcast-on";
/**
* Fly around (build plan N7-7): a still filmed along an exact camera path (an orbit's numbers, a preset or keys), on either
@@ -9,6 +10,8 @@ import { priceAs } from "@/server/visitor";
async function post(request: Request) {
return handle(async () => {
const { requestId, ...input } = await body(request, FlyAroundSchema, "Pick the engine, the still and the path");
+ // The WorldCast worker's answer, fresh, before the plan reads it (N7-9).
+ await worldcastContextNow();
if (new URL(request.url).searchParams.get("preview")) return Response.json(previewFlyAround(input));
// A plan that can't run (FlyAroundError) is a 422 with its reason, as any planner's error is.
const result = await once("fly-around", requestId, () => createFlyAround(input));
diff --git a/src/app/api/providers/test/route.ts b/src/app/api/providers/test/route.ts
index 5ff96c1a..6721e74e 100644
--- a/src/app/api/providers/test/route.ts
+++ b/src/app/api/providers/test/route.ts
@@ -41,7 +41,7 @@ export async function POST(request: Request) {
// The page says it isn't on this server's machine: a ComfyUI address on this machine or its network is never called
// for it (it would be the server's own, not the owner's computer). Only ever skips a test.
if (provider === "comfyui" && body.place === "hosted") {
- const field = focus === "comfyIsolatedUrl" ? "comfyIsolatedUrl" : "comfyUrl";
+ const field = focus === "comfyIsolatedUrl" || focus === "worldcastUrl" ? focus : "comfyUrl";
const refused = await hostedAddressRefusal(field, values[field]);
if (refused) return Response.json(refused);
}
diff --git a/src/app/api/turnaround/estimate/route.ts b/src/app/api/turnaround/estimate/route.ts
index fcb0f05b..62cfc194 100644
--- a/src/app/api/turnaround/estimate/route.ts
+++ b/src/app/api/turnaround/estimate/route.ts
@@ -3,6 +3,7 @@ import { recordExists } from "@/server/records";
import { body, handle } from "@/server/shorts-schemas";
import { previewTurnaround, TurnaroundBodySchema, turnaroundRun } from "@/server/turnaround";
import { priceAs } from "@/server/visitor";
+import { worldcastContextNow } from "@/server/worldcast-on";
/**
* A turnaround's price and plan, as the studio routes' estimates answer it (the evaluation harness prices a job here
@@ -16,6 +17,7 @@ async function post(request: Request) {
if (input.elementId && (requestViewer(request).kind !== "owner" || !recordExists({ kind: "element", ids: [input.elementId] }))) {
return Response.json({ error: "Character not found" }, { status: 404 });
}
+ await worldcastContextNow();
const p = previewTurnaround(turnaroundRun(input));
return Response.json({ ...p, modelId: p.model.id, modelName: p.model.name });
});
diff --git a/src/app/api/turnaround/route.ts b/src/app/api/turnaround/route.ts
index 5917cd31..ac46f06f 100644
--- a/src/app/api/turnaround/route.ts
+++ b/src/app/api/turnaround/route.ts
@@ -3,6 +3,7 @@ import { recordExists } from "@/server/records";
import { body, handle, once } from "@/server/shorts-schemas";
import { createTurnaround, previewTurnaround, TurnaroundBodySchema, turnaroundRun } from "@/server/turnaround";
import { priceAs } from "@/server/visitor";
+import { worldcastContextNow } from "@/server/worldcast-on";
/**
* Turnaround video (build plan N7-6): a 360° turnaround of a cast sheet or a character, on either engine. `?preview=1` plans
@@ -15,6 +16,7 @@ async function post(request: Request) {
if (input.elementId && (requestViewer(request).kind !== "owner" || !recordExists({ kind: "element", ids: [input.elementId] }))) {
return Response.json({ error: "Character not found" }, { status: 404 });
}
+ await worldcastContextNow();
const run = turnaroundRun(input);
if (new URL(request.url).searchParams.get("preview")) return Response.json(previewTurnaround(run));
const result = await once("turnaround", requestId, () => createTurnaround(run));
diff --git a/src/components/cinema/blockout-panel.tsx b/src/components/cinema/blockout-panel.tsx
index 7cdf8ec6..b800ae9c 100644
--- a/src/components/cinema/blockout-panel.tsx
+++ b/src/components/cinema/blockout-panel.tsx
@@ -176,7 +176,7 @@ export interface BlockoutPanelProps {
engine: Engine;
settings: DirectorSettings;
brief: string;
- context: { cloudAllowed: boolean; civitai?: boolean };
+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };
draft: BlockoutDraft;
setDraft: (fn: (d: BlockoutDraft) => BlockoutDraft) => void;
/** Open the builder (with the draft's scene, or the example). */
diff --git a/src/components/cinema/hooks.ts b/src/components/cinema/hooks.ts
index d0756c37..8d2ab2c1 100644
--- a/src/components/cinema/hooks.ts
+++ b/src/components/cinema/hooks.ts
@@ -17,7 +17,7 @@ export interface ProjectView {
project: CinemaProject;
folders: CinemaFolder[];
spentUsd: number;
- context: { cloudAllowed: boolean; civitai?: boolean };
+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };
}
async function json<T>(res: Response): Promise<T> {
diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsx
index 87822c99..f690a203 100644
--- a/src/components/cinema/prompt-bar.tsx
+++ b/src/components/cinema/prompt-bar.tsx
@@ -333,7 +333,7 @@ export interface PromptBarProps {
onSettings: (patch: Partial<DirectorSettings>) => void;
palettes: { name: string; hex: string[] }[];
onPalettes: (p: { name: string; hex: string[] }[]) => void;
- context: { cloudAllowed: boolean; civitai?: boolean };
+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };
brief: string;
spentUsd: number;
costCapUsd: number | null;
diff --git a/src/components/cinema/scene-actions.tsx b/src/components/cinema/scene-actions.tsx
index 60cba9b7..772ffd1a 100644
--- a/src/components/cinema/scene-actions.tsx
+++ b/src/components/cinema/scene-actions.tsx
@@ -73,7 +73,7 @@ export function askSceneConfirmAgain() {
export interface ScenePlanContext {
engine: Engine;
settings: DirectorSettings;
- context: { cloudAllowed: boolean; civitai?: boolean };
+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };
brief: string;
}
diff --git a/src/components/cinema/scene-path.tsx b/src/components/cinema/scene-path.tsx
index e898b73d..07d37fa0 100644
--- a/src/components/cinema/scene-path.tsx
+++ b/src/components/cinema/scene-path.tsx
@@ -6,6 +6,8 @@ import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { DEFAULT_MOTION, MAX_KEYS, PATH_FPS, PATH_FRAMES, PATH_PRESETS, keyLabel, type CameraKey } from "@/lib/camera-path";
import { PATH_DURATIONS } from "@/lib/catalog/cinema";
+import { WORLDCAST_SECONDS } from "@/lib/catalog/worldcast-plan";
+import { WORLDCAST_RUN } from "@/lib/worldcast";
import type { Engine } from "@/lib/catalog/types";
import { cn } from "@/lib/utils";
@@ -106,10 +108,12 @@ export interface PathOptionsProps {
onWords: (w: string) => void;
notes: string[];
disabled: boolean;
+ /** WorldCast films the path on the studio's worker (N7-9): its own length and shape. */
+ worldcast?: boolean;
}
/** The moves, the length and quality, the motion words and what will happen. */
-export function PathOptions({ engine, preset, onPreset, duration, onDuration, resolution, resolutions, onResolution, words, onWords, notes, disabled }: PathOptionsProps) {
+export function PathOptions({ engine, preset, onPreset, duration, onDuration, resolution, resolutions, onResolution, words, onWords, notes, disabled, worldcast }: PathOptionsProps) {
const wordsId = useId();
const open = engine === "open";
return (
@@ -131,7 +135,14 @@ export function PathOptions({ engine, preset, onPreset, duration, onDuration, re
</div>
<div className="space-y-1.5">
<p className="text-[12px] text-muted-foreground">Length</p>
- {open ? (
+ {open && worldcast ? (
+ <p className="text-[13px]">
+ About {WORLDCAST_SECONDS} s{" "}
+ <span className="text-muted-foreground">
+ · portrait {WORLDCAST_RUN.width} × {WORLDCAST_RUN.height}, {WORLDCAST_RUN.frames} frames at {WORLDCAST_RUN.fps} fps with WorldCast
+ </span>
+ </p>
+ ) : open ? (
<p className="text-[13px]">
About {OPEN_SECONDS} s <span className="text-muted-foreground">· {PATH_FRAMES} frames at {PATH_FPS} fps on your GPU</span>
</p>
diff --git a/src/components/cinema/scene-viewer.tsx b/src/components/cinema/scene-viewer.tsx
index e7e7d39e..d431ce57 100644
--- a/src/components/cinema/scene-viewer.tsx
+++ b/src/components/cinema/scene-viewer.tsx
@@ -24,6 +24,7 @@ import { toastError } from "@/lib/refusals";
import { useCinemaGenerate } from "./hooks";
import { usePlanPrice, type SceneTake } from "./scene-actions";
import { FilmButton, OPEN_SECONDS, PathKeys, PathOptions } from "./scene-path";
+import { WORLDCAST_SECONDS } from "@/lib/catalog/worldcast-plan";
import type { SceneEngine, SceneInfo } from "./scene-engine";
/**
@@ -43,7 +44,7 @@ export interface SceneViewerProps {
engine: Engine;
onEngine: (e: Engine) => void;
settings: DirectorSettings;
- context: { cloudAllowed: boolean; civitai?: boolean };
+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };
brief: string;
onClose: () => void;
/** Blockout to film: the path rendered through the scene (24 fps) handed to the composer as a blockout. */
@@ -145,7 +146,7 @@ export default function SceneViewer({ take, projectId, engine, onEngine, setting
const pathModel = getModel(PATH_MODELS[engine]);
const qualities = engine === "cloud" ? (pathModel?.options.resolutions ?? []) : [];
const quality = pathQuality && qualities.includes(pathQuality) ? pathQuality : (pathModel?.defaults?.resolution ?? qualities[0] ?? "");
- const seconds = engine === "open" ? OPEN_SECONDS : pathSeconds;
+ const seconds = engine === "open" ? (context.worldcast ? WORLDCAST_SECONDS : OPEN_SECONDS) : pathSeconds;
const pathInput: Omit<CinemaGenerateInput, "brief"> = useMemo(
() => ({
engine,
@@ -160,7 +161,7 @@ export default function SceneViewer({ take, projectId, engine, onEngine, setting
[engine, words, settings, take.still, quality, keys, pathSeconds, preset],
);
const pathPlan = useMemo(
- () => planCinema({ ...pathInput, brief, path: { ...pathInput.path!, ...(engine === "open" ? { render: PLACEHOLDER_RENDER } : {}) } }, context),
+ () => planCinema({ ...pathInput, brief, path: { ...pathInput.path!, ...(engine === "open" && !context.worldcast ? { render: PLACEHOLDER_RENDER } : {}) } }, context),
[pathInput, brief, context, engine],
);
const pathPrice = usePlanPrice(pathPlan);
@@ -176,7 +177,8 @@ export default function SceneViewer({ take, projectId, engine, onEngine, setting
const openRefusal = (): string | undefined => {
const m = pathPlan.model;
if (!offered(access, m.id, "open")) return `${m.name} is turned off in ${ACCESS_PLACE}. Turn it back on there, or film on the cloud engine`;
- if (appStatus && !pathPrice.demo && !m.routes.some((r) => appStatus.providers[r.provider]?.configured)) return "Connect ComfyUI in Settings to film a path on your GPU";
+ if (appStatus && !pathPrice.demo && !m.routes.some((r) => appStatus.providers[r.provider]?.configured))
+ return m.routes.some((r) => r.provider === "worldcast") ? "Connect the WorldCast worker in Settings to film a path with it" : "Connect ComfyUI in Settings to film a path on your GPU";
return undefined;
};
@@ -341,7 +343,8 @@ export default function SceneViewer({ take, projectId, engine, onEngine, setting
let uploaded: string | undefined;
try {
let render: string | undefined;
- if (engine === "open") {
+ // WorldCast (N7-9) renders the path on the server from the still's depth: nothing to record here.
+ if (engine === "open" && !context.worldcast) {
// The still's own view along the path: Uni3C's guide, in the still's shape (the open run keeps it).
setFilming("render");
setProgress(0);
@@ -577,6 +580,7 @@ export default function SceneViewer({ take, projectId, engine, onEngine, setting
words={words}
onWords={setWords}
notes={pathPlan.notes}
+ worldcast={engine === "open" && !!context.worldcast}
disabled={status !== "ready" || pathBusy}
/>
);
diff --git a/src/components/cinema/soul-builders.tsx b/src/components/cinema/soul-builders.tsx
index f23fb3ff..ca2a9463 100644
--- a/src/components/cinema/soul-builders.tsx
+++ b/src/components/cinema/soul-builders.tsx
@@ -51,7 +51,7 @@ interface BuilderProps {
folderId: string | null;
engine: Engine;
settings: DirectorSettings;
- context: { cloudAllowed: boolean; civitai?: boolean };
+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };
brief: string;
}
diff --git a/src/components/connect-field.tsx b/src/components/connect-field.tsx
index 76483135..e8b906a8 100644
--- a/src/components/connect-field.tsx
+++ b/src/components/connect-field.tsx
@@ -52,7 +52,7 @@ interface Result extends ConnectionTest {
saved?: boolean;
}
-const ADDRESS_FIELDS = new Set(["comfyUrl", "comfyIsolatedUrl"]);
+const ADDRESS_FIELDS = new Set(["comfyUrl", "comfyIsolatedUrl", "worldcastUrl"]);
/**
* A key or address field with one button that does what it says: "Save & test" tests the typed value
diff --git a/src/components/gpu/connect-choice.tsx b/src/components/gpu/connect-choice.tsx
index d371af54..d16668a3 100644
--- a/src/components/gpu/connect-choice.tsx
+++ b/src/components/gpu/connect-choice.tsx
@@ -4,7 +4,7 @@ import { useQuery, useQueryClient, type QueryClient } from "@tanstack/react-quer
import { ChevronDown, Cpu, Globe, Info, Loader2, TriangleAlert, Unplug } from "lucide-react";
import { createContext, useContext, useState } from "react";
import { toast } from "sonner";
-import { ConnectField, useAllowPrivate, useSettings } from "@/components/connect-field";
+import { ConnectField, useAllowPrivate, useSettings, type PublicSetting } from "@/components/connect-field";
import { gib } from "@/components/gpu/comfy-finder";
import { YourGpu } from "@/components/gpu/your-gpu";
import { Button } from "@/components/ui/button";
@@ -378,11 +378,32 @@ export function OwnerServerComfy({
refusal={refusal}
/>
)}
+ {!onlyAddress && !computer && (!hosted || advanced) && <WorldcastField get={get} hosted={hosted} />}
{computer && <p className="text-[12px] text-muted-foreground">Connecting a server address stops the runs still going on your computer.</p>}
</div>
);
}
+/**
+ * The WorldCast worker's address (build plan N7-9; docs/workers/worldcast.md), beside the isolated worker: Fly path,
+ * Turnaround and the exact orbits film with WorldCast while it answers.
+ */
+export function WorldcastField({ get, hosted = false }: { get: (n: string) => PublicSetting | undefined; hosted?: boolean }) {
+ const place = hosted ? ("hosted" as const) : undefined;
+ return (
+ <ConnectField
+ name="worldcastUrl"
+ setting={get("worldcastUrl")}
+ provider="comfyui"
+ label="WorldCast worker URL (optional)"
+ placeholder={hosted ? "https://…" : "http://127.0.0.1:8190"}
+ hint="WorldCast films Fly path, Turnaround and exact orbits so the back and sides match your photos. It runs beside ComfyUI on a GPU with 48 GB or more: workers/worldcast/README.md shows how to start it."
+ place={place}
+ refusal={hosted ? (line: string) => <HostedRefusal line={line} /> : undefined}
+ />
+ );
+}
+
export interface ConnectChoiceProps {
/** Opened from a run: once connected, the run starts by itself. */
fromRun?: boolean;
diff --git a/src/components/settings-form.tsx b/src/components/settings-form.tsx
index 434e20aa..6787e44d 100644
--- a/src/components/settings-form.tsx
+++ b/src/components/settings-form.tsx
@@ -6,7 +6,7 @@ import Link from "next/link";
import { useEffect, useState, useSyncExternalStore } from "react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
-import { ConnectChoice, OwnerComfyWhere } from "@/components/gpu/connect-choice";
+import { ConnectChoice, OwnerComfyWhere, WorldcastField } from "@/components/gpu/connect-choice";
import { WorkersChip } from "@/components/workers-admin";
import { usePagePlace } from "@/components/gpu/use-local-comfy";
import { Label } from "@/components/ui/label";
@@ -490,6 +490,7 @@ function LocalComfy({ get, onWhere }: { get: (n: string) => PublicSetting | unde
placeholder="http://127.0.0.1:8189"
hint="A second ComfyUI for LatentSync 1.6 and ThinkSound, whose node packs can't share the main install. scripts/comfy/README.md shows how to start one."
/>
+ <WorldcastField get={get} />
</>
);
}
diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.ts
index 7b648f80..6d5c797a 100644
--- a/src/lib/catalog/cinema.ts
+++ b/src/lib/catalog/cinema.ts
@@ -12,6 +12,7 @@ import { composeShots, estimateCost, planGeneration, routesFor } from "./plan";
import { soulRecipe } from "./soul";
import { planTurnaround, type TurnaroundInput } from "./turnaround";
import { planFlyAround } from "./fly-around";
+import { WORLDCAST_AFTER, WORLDCAST_MODELS, WORLDCAST_SECONDS, worldcastFallback, worldcastNote, worldcastSteps } from "./worldcast-plan";
import { exactDefaults, exactSummary, normalizeExact, takesExact, type ExactOrbit } from "@/lib/exact-orbit";
import { CAST_LOOK } from "./soul-cards";
import type { Engine, GenerationRequest, GenParams, LoraRef, ModelDef, Operation } from "./types";
@@ -328,6 +329,11 @@ export interface CinemaContext {
* needs it is written into the prompt instead (unknown = assumed set).
*/
civitai?: boolean;
+ /**
+ * The studio's WorldCast worker answers (N7-9): the Fly path and the exact orbits film with WorldCast on your GPU. False:
+ * it doesn't, and those runs say what they film on instead. Undefined: nothing is said (a visitor, or WorldCast is off).
+ */
+ worldcast?: boolean;
}
export interface CinemaStep {
@@ -1493,13 +1499,16 @@ function clipModel(model: ModelDef, input: CinemaGenerateInput, notes: string[])
* the orbit's numbers as Fly around plans it (src/lib/catalog/fly-around.ts): H3 Max camera-controls on the cloud; on your
* GPU, MoGe 2's depth, the server's render of the path and Uni3C. The other moves and the Director's words stay words.
*/
-function planExactVideo(input: CinemaGenerateInput): CinemaPlan | null {
+function planExactVideo(input: CinemaGenerateInput, ctx: CinemaContext = {}): CinemaPlan | null {
const moves = (input.moves ?? []).filter((m) => moveBySlug(m));
if (!input.exact || !takesExact(moves[0])) return null;
const orbit = normalizeExact(input.exact, exactDefaults(moves[0]));
const image = input.images?.[0];
const compiled = compileDirector({ prompt: input.prompt, settings: input.settings, moves: moves.slice(1), brief: input.brief, mode: "video", target: "prompt" });
- const plan = planFlyAround({ engine: input.engine, image, orbit, prompt: compiled.prompt, duration: input.duration, resolution: input.resolution, feature: "cinema" });
+ const plan = planFlyAround(
+ { engine: input.engine, image, orbit, prompt: compiled.prompt, duration: input.duration, resolution: input.resolution, feature: "cinema" },
+ { worldcast: ctx.worldcast },
+ );
const notes = [`${moveBySlug(moves[0])!.name} follows your numbers exactly: ${exactSummary(orbit)}`, ...plan.notes];
if ((input.images?.length ?? 0) > 1) notes.push("An exact orbit films from the first image alone");
const blocker = !image ? "Add a start frame to film an exact orbit" : plan.blocker;
@@ -1507,7 +1516,7 @@ function planExactVideo(input: CinemaGenerateInput): CinemaPlan | null {
}
function planVideo(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {
- const exact = planExactVideo(input);
+ const exact = planExactVideo(input, ctx);
if (exact) return exact;
const notes: string[] = [];
const engine = input.engine;
@@ -2125,14 +2134,29 @@ export const PATH_DURATIONS = [3, 5, 8, 10, 15];
/** The open engine's blocker until the browser has recorded and uploaded the render (the viewer does that on Film). */
export const PATH_RENDER_FIRST = "Record the path first";
+/**
+ * The Fly path on WorldCast (N7-9): the server measures the still's depth, finds the person and renders the path itself, so
+ * the browser records nothing; the subject's views come from the take's references when it has them (none here yet).
+ */
+function planPathWorldcast(input: CinemaGenerateInput): CinemaPlan {
+ const src = input.source?.kind === "image" ? input.source.url : undefined;
+ const keys = normalizeKeys(input.path?.keys ?? []);
+ const steps = worldcastSteps({ feature: "cinema-path", still: src ? { url: src } : undefined, anchors: [], keys, prompt: input.prompt });
+ const notes = [worldcastNote(0), WORLDCAST_AFTER];
+ if (input.path?.duration && Math.abs(input.path.duration - WORLDCAST_SECONDS) > 0.5) notes.push(`WorldCast always films about ${WORLDCAST_SECONDS} s, so the path is spread over that`);
+ const blocker = !src ? "Pick the scene's still" : keys.length < 2 ? "Add a keyframe or pick a move first" : undefined;
+ return finish(getModel(WORLDCAST_MODELS.film)!, steps, notes, blocker);
+}
+
/**
* Film the still along a path. Cloud: H3 Max camera-controls gets the still as its first frame and the keyframes as its
* camera_trajectory (a pure slide as its own truck move), prompt expansion off, and motion words that let the subject move
* (its default prompt freezes the scene). Open: the still is Wan 2.1's start image and the browser's render of the 3D scene
* along the path guides the camera through Uni3C; 81 frames at 16 fps.
*/
-function planPath(input: CinemaGenerateInput): CinemaPlan {
+function planPath(input: CinemaGenerateInput, ctx: CinemaContext = {}): CinemaPlan {
const open = input.engine === "open";
+ if (open && ctx.worldcast) return planPathWorldcast(input);
const model = getModel(PATH_MODELS[input.engine])!;
const src = input.source?.kind === "image" ? input.source.url : undefined;
const path = input.path;
@@ -2149,6 +2173,7 @@ function planPath(input: CinemaGenerateInput): CinemaPlan {
`Your browser renders the 3D scene along the path, then Wan 2.1 starts from the still and Uni3C keeps its camera on that render — ${PATH_FRAMES} frames at ${PATH_FPS} fps (${seconds} s) on your GPU, which needs about 48 GB`,
);
if (path?.duration && Math.abs(path.duration - seconds) > 0.5) notes.push(`The open engine always films about ${seconds} s, so the path is spread over that`);
+ if (ctx.worldcast === false) notes.push(worldcastFallback("Uni3C"));
const params: GenParams = { numOutputs: 1, aspectRatio: "auto", ...(resolution ? { resolution } : {}), cameraPath: keys };
request = { feature: "cinema-path", modelId: model.id, op: "camera-path", prompt, inputs: src && path?.render ? { images: [src], video: path.render } : undefined, params };
} else {
@@ -2183,7 +2208,7 @@ export function pathTake(input: Pick<CinemaGenerateInput, "engine" | "path">, pl
/** The turnaround's own steps (src/lib/catalog/turnaround.ts), filed as Cinema takes and priced as Cinema prices them. */
function planTurnaroundTake(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {
- const plan = planTurnaround({ ...input.turnaround, engine: input.engine, feature: "cinema-turnaround", stepFeature: "cinema-turnaround" }, { has: ctx.has });
+ const plan = planTurnaround({ ...input.turnaround, engine: input.engine, feature: "cinema-turnaround", stepFeature: "cinema-turnaround" }, { has: ctx.has, worldcast: ctx.worldcast });
return finish(plan.model, plan.steps, plan.notes, plan.blocker);
}
@@ -2444,7 +2469,7 @@ export function planCinema(input: CinemaGenerateInput, ctx: CinemaContext): Cine
case "recompose":
return planRecompose(i);
case "path":
- return planPath(i);
+ return planPath(i, ctx);
case "turnaround":
return planTurnaroundTake(i, ctx);
case "blockout":
diff --git a/src/lib/catalog/engines.ts b/src/lib/catalog/engines.ts
index 4b2a3801..adef352c 100644
--- a/src/lib/catalog/engines.ts
+++ b/src/lib/catalog/engines.ts
@@ -16,8 +16,8 @@ export const runsOn = (m: Pick<ModelDef, "engine" | "engines">, engine: Engine):
/** A model that runs on both engines. */
export const dualEngine = (m: Pick<ModelDef, "engines"> | undefined): boolean => (m?.engines?.length ?? 0) > 1;
-/** The engine a provider runs on: ComfyUI and the browser are the open engine, the rest the cloud. */
-export const providerEngine = (p: ProviderId): Engine => (p === "comfyui" || p === "local" ? "open" : "cloud");
+/** The engine a provider runs on: ComfyUI, the WorldCast worker and the browser are the open engine, the rest the cloud. */
+export const providerEngine = (p: ProviderId): Engine => (p === "comfyui" || p === "local" || p === "worldcast" ? "open" : "cloud");
const views = new WeakMap<ModelDef, Partial<Record<Engine, ModelDef>>>();
diff --git a/src/lib/catalog/fly-around.ts b/src/lib/catalog/fly-around.ts
index 4f27086d..c3199618 100644
--- a/src/lib/catalog/fly-around.ts
+++ b/src/lib/catalog/fly-around.ts
@@ -17,7 +17,9 @@ import { exactOrbitKeys, exactSummary, exactWords, type ExactOrbit } from "@/lib
import { getModel, getPreset } from "./index";
import { onEngine } from "./engines";
import { estimateCost, planGeneration } from "./plan";
+import type { TurnSide } from "./turnaround";
import type { Engine, GenerationRequest, GenParams, ModelDef } from "./types";
+import { WORLDCAST_AFTER, WORLDCAST_MODELS, WORLDCAST_SECONDS, worldcastFallback, worldcastNote, worldcastSteps, type WorldcastDepth } from "./worldcast-plan";
/** What films a path on each engine (N7-5's), what makes the depth on the open engine, and the cloud's route with views. */
export const FLY_MODELS = { open: "oss-uni3c-path", cloud: "minimax-h3-max-camera", depth: "oss-scene-moge", views: "minimax-h3-max" } as const;
@@ -45,6 +47,15 @@ export interface FlyAroundInput {
feature?: string;
title?: string;
seed?: number;
+ /** Views by the person's own side (Canvas's Fly around with named views): WorldCast's anchors on the open engine. */
+ sides?: Partial<Record<TurnSide, string>>;
+ /** WorldCast's depth model (default MoGe 2). */
+ depth?: WorldcastDepth;
+}
+
+/** What the planner knows about this install: whether its WorldCast worker answers and WorldCast is switched on. */
+export interface FlyContext {
+ worldcast?: boolean;
}
export interface FlyStep {
@@ -100,7 +111,7 @@ function stepCost(req: GenerationRequest, engine: Engine): number | null {
}
/** Plan a fly-around: the steps each engine runs, priced (free on the open engine), and what it still needs. */
-export function planFlyAround(input: FlyAroundInput): FlyAroundPlan {
+export function planFlyAround(input: FlyAroundInput, ctx: FlyContext = {}): FlyAroundPlan {
const { engine } = input;
const feature = input.feature ?? "fly-around";
const { keys, label } = flyKeys(input);
@@ -112,7 +123,17 @@ export function planFlyAround(input: FlyAroundInput): FlyAroundPlan {
let model: ModelDef;
let duration: number;
const image = input.image;
- if (engine === "open") {
+ if (engine === "open" && ctx.worldcast) {
+ // N7-9: WorldCast on the studio's worker; the still is the first frame and, when the views are named, the front's anchor.
+ model = getModel(WORLDCAST_MODELS.film)!;
+ duration = WORLDCAST_SECONDS;
+ const sides = (Object.entries(input.sides ?? {}) as [TurnSide, string][]).filter(([, url]) => !!url).map(([side, url]) => ({ side, src: { url } }));
+ steps.push(
+ ...worldcastSteps({ feature, title: input.title, still: image ? { url: image } : undefined, anchors: sides, keys, prompt: input.prompt, seed: input.seed, depth: input.depth }),
+ );
+ notes.push(worldcastNote(sides.length, input.depth), WORLDCAST_AFTER);
+ if (views.length && !sides.length) notes.push("WorldCast needs to know which side each view shows: name them to use them");
+ } else if (engine === "open") {
model = getModel(FLY_MODELS.open)!;
duration = Math.round((PATH_FRAMES / PATH_FPS) * 10) / 10;
const resolution = model.options.resolutions?.find((r) => r.toLowerCase() === input.resolution?.toLowerCase()) ?? "480p";
@@ -137,6 +158,7 @@ export function planFlyAround(input: FlyAroundInput): FlyAroundPlan {
});
}
if (views.length) notes.push("Your other views aren't used on your GPU: it films from the still alone");
+ if (ctx.worldcast === false) notes.push(worldcastFallback("Uni3C"));
} else if (views.length) {
model = getModel(FLY_MODELS.views)!;
duration = nearest(model.options.durations ?? FLY_DURATIONS, input.duration ?? 5);
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index 18e7336e..a32a9332 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -2106,6 +2106,81 @@ const open: ModelDef[] = [
},
defaults: { resolution: "480p", aspectRatio: "auto" },
}),
+ // N7-9: WorldCast (PixCtrol) on the WorldCast worker, outside ComfyUI (docs/workers/worldcast.md). Fly path, Turnaround and
+ // the exact orbits prefer it when the worker answers: the still's depth (MoGe 2), SAM 3.1 masks of the still and the views,
+ // then one case; the back and sides follow the views. 81 frames, portrait 480 × 832, 15 fps.
+ o({
+ id: "oss-worldcast",
+ name: "WorldCast",
+ vendor: "PixCtrol (Xiaomi MiLM Plus, Wuhan University)",
+ family: "wan",
+ kind: "video",
+ tagline: "A still filmed along an exact camera path, with the back and sides following your own views · portrait 480 × 832, 5.4 s · 48 GB+ GPU · Apache-2.0",
+ badges: ["new"],
+ hidden: true,
+ routes: [{ op: "camera-path", provider: "worldcast", endpoint: "cases", note: "WorldCast on Wan 2.1 I2V 720P, on your WorldCast worker" }],
+ licence: {
+ licence: "Apache-2.0",
+ commercial: true,
+ note:
+ "Apache-2.0 (code at PixCtrol/WorldCast 7ccf2e0d; weights ly56/worldcast 27635f27, on Wan2.1-I2V-14B-720P, Apache-2.0). Stage 1 trained on SpatialVID (CC BY-NC-SA 4.0), which the authors say they used \"strictly for academic research purposes and not for any commercial applications\"",
+ checked: "2026-11-02",
+ },
+ options: {
+ seed: true,
+ maxImages: 11,
+ aspectRatios: ["9:16"],
+ requires: { images: 1, msg: "Add the still to film" },
+ },
+ defaults: { aspectRatio: "9:16" },
+ }),
+ // N7-9: the paper's own depth models, on the WorldCast worker when it has them (GET /health "depth"): MoGe 2 stays the default.
+ o({
+ id: "oss-depth-pro",
+ name: "Depth Pro",
+ vendor: "Apple",
+ family: "depth-pro",
+ kind: "image",
+ tagline: "Metric depth of one photo, the depth WorldCast's paper used · on your WorldCast worker · Apple research licence (no commercial use)",
+ hidden: true,
+ routes: [{ op: "edit", provider: "worldcast", endpoint: "depth/depth-pro", note: "apple/DepthPro on the WorldCast worker" }],
+ licence: {
+ licence: "Apple ML Research License (research only; non-commercial)",
+ commercial: false,
+ note: "apple/DepthPro ccd1350a: research use only; it \"does not include any commercial exploitation, product development or use in any commercial product or service\"",
+ checked: "2026-11-02",
+ },
+ options: { maxImages: 1, requires: { images: 1, msg: "Add the still" } },
+ }),
+ o({
+ id: "oss-vggt-omega",
+ name: "VGGT-Omega",
+ vendor: "Meta FAIR",
+ family: "vggt",
+ kind: "image",
+ tagline: "Depth and cameras of a photo, the poses WorldCast's paper used · on your WorldCast worker · FAIR Noncommercial (gated download)",
+ hidden: true,
+ routes: [{ op: "edit", provider: "worldcast", endpoint: "depth/vggt-omega", note: "facebook/VGGT-Omega on the WorldCast worker (gated: the worker needs a Hugging Face token)" }],
+ licence: {
+ licence: "FAIR Noncommercial Research License",
+ commercial: false,
+ note: "facebook/VGGT-Omega 1041e80f: FAIR Noncommercial Research License; a gated download that Meta approves by hand",
+ checked: "2026-11-02",
+ },
+ options: { maxImages: 1, requires: { images: 1, msg: "Add the still" } },
+ }),
+ // N7-9: the person's mask in a picture (SAM 3.1), for WorldCast's still and views.
+ o({
+ id: "oss-person-mask",
+ name: "SAM 3.1 person mask",
+ vendor: "Meta",
+ family: "sam",
+ kind: "image",
+ tagline: "A black-and-white mask of the person in a picture · 4 GB GPU · Meta SAM License",
+ hidden: true,
+ routes: [comfy("bg-remove", "image-person-mask-sam3", "SAM 3.1 finds the person: white where they are")],
+ options: { maxImages: 1, requires: { images: 1, msg: "Add the picture" } },
+ }),
o({
id: "oss-tryon-klein",
name: "FLUX.2 [klein] Try-On",
diff --git a/src/lib/catalog/turnaround.ts b/src/lib/catalog/turnaround.ts
index 60814175..b6e0e961 100644
--- a/src/lib/catalog/turnaround.ts
+++ b/src/lib/catalog/turnaround.ts
@@ -21,6 +21,7 @@ import { onEngine } from "./engines";
import { FRAMES_MODELS, chainGapProblem, chainTiming, frameTimes } from "./keyframes";
import { ANGLES_2511_LORA } from "./open-tools";
import { estimateCost, planGeneration } from "./plan";
+import { WORLDCAST_AFTER, WORLDCAST_MODELS, WORLDCAST_SECONDS, worldcastFallback, worldcastNote, worldcastSteps } from "./worldcast-plan";
import type { ChainSlot, Engine, Generation, GenerationRequest, GenParams, ModelDef } from "./types";
// ---------------------------------------------------------------------------
@@ -56,34 +57,8 @@ export function pathAzimuth(side: TurnSide): number {
return -viewAzimuth(side) + 0;
}
-/**
- * WorldCast's convention (N7-9; new-models-7.md §3.4, §3.11): its 1–4 anchor photos are named front, right_side, back and
- * left_side, with each one's azimuth in body_views_meta.json. The names are WHERE THE CAMERA STANDS, not the body's own sides:
- * the demo case's aligned cameras (no_padding_black/anchors_aligned_camera_info.json) put right_side at +x of the first camera
- * (moved round to the camera's own right, 91.79°) and left_side at −x (266.91°, `left_sign` −1: reached turning the other
- * way, −93°), and its "right_side" crop shows the boy facing the lens because the first frame shows him in profile. So
- * WorldCast's azimuth is the camera-path library's (+ = moved round to the right), and a person's own right side, seen from
- * the camera moved round to its LEFT (pathAzimuth −90°), is WorldCast's left_side. Convert in worldcastAnchor and nowhere
- * else; a swapped left and right silently hurts identity.
- */
-export const WORLDCAST = {
- anchor: { front: "front", right: "left_side", back: "back", left: "right_side" } as const satisfies Record<TurnSide, string>,
- /** The demo case's azimuths (demo_case/A360-031__portrait/body_views_vggt/body_views_meta.json). */
- demoAzimuth: { front: 0, right_side: 91.79, back: 171.39, left_side: 266.91 },
- leftSign: -1 as const,
-};
-
-export type WorldcastView = (typeof WORLDCAST.anchor)[TurnSide];
-
-/**
- * A side as a WorldCast anchor: its name, the azimuth to write for it (0–360, + = the camera moved round to its right) and
- * the signed one (left_side by `left_sign`: −90°), which is also where camera-path keyPose puts its camera.
- */
-export function worldcastAnchor(side: TurnSide): { name: WorldcastView; azimuth: number; signed: number } {
- const name = WORLDCAST.anchor[side];
- const azimuth = (((pathAzimuth(side) % 360) + 360) % 360) + 0;
- return { name, azimuth, signed: name === "left_side" ? WORLDCAST.leftSign * (360 - azimuth) : azimuth };
-}
+// WorldCast's names for the sides (N7-9) live with its cases: src/lib/worldcast.ts.
+export { WORLDCAST, worldcastAnchor, type WorldcastView } from "@/lib/worldcast";
/**
* The Angles app's horizontal_angle for a side. The Multiple-Angles LoRA calls 90° the "right side view", read here as the
@@ -118,7 +93,7 @@ export const QMA_STILL_ANGLES: readonly number[] = [1, 2, 3, 4, 5, 6, 7].map((i)
// ---------------------------------------------------------------------------
// Routes
-export type TurnRoute = "frames" | "references" | "keyframes" | "camera" | "stills";
+export type TurnRoute = "worldcast" | "frames" | "references" | "keyframes" | "camera" | "stills";
export interface TurnRouteInfo {
engine: Engine;
@@ -133,6 +108,16 @@ export interface TurnRouteInfo {
/** The routes, the open engine's first, then the cloud's in the order they are offered. */
export const TURN_ROUTES: Record<TurnRoute, TurnRouteInfo> = {
+ // N7-9: WorldCast on the studio's WorldCast worker, offered when it answers (TurnaroundContext.worldcast).
+ worldcast: {
+ engine: "open",
+ modelId: WORLDCAST_MODELS.film,
+ name: "WorldCast",
+ detail: "WorldCast films an exact orbit from the front view; the back and sides follow your views",
+ durations: [],
+ duration: WORLDCAST_SECONDS,
+ resolution: "480 × 832",
+ },
frames: {
engine: "open",
modelId: FRAMES_MODELS.open.id,
@@ -182,7 +167,7 @@ export const TURN_ROUTES: Record<TurnRoute, TurnRouteInfo> = {
},
};
-export const ROUTES_ON: Record<Engine, TurnRoute[]> = { open: ["frames", "stills"], cloud: ["references", "keyframes", "camera"] };
+export const ROUTES_ON: Record<Engine, TurnRoute[]> = { open: ["worldcast", "frames", "stills"], cloud: ["references", "keyframes", "camera"] };
/** How the missing sides are drawn on your GPU: the Angles app's Multiple-Angles route (the default), or QMA · 96 views. */
export type TurnFill = "angles" | "qma";
@@ -343,6 +328,11 @@ export interface TurnaroundInput {
export interface TurnaroundContext {
/** Whether this install offers a model (Settings → Models & licences); every model by default. */
has?: (id: string) => boolean;
+ /**
+ * The studio's WorldCast worker answers (N7-9): the WorldCast route is offered and is the GPU's default. False: it doesn't,
+ * and Frames says so. Undefined: nothing is said (a visitor, or WorldCast is off).
+ */
+ worldcast?: boolean;
}
export interface TurnStep {
@@ -394,7 +384,7 @@ const offered = (ctx: TurnaroundContext) => (id: string) => (ctx.has ? ctx.has(i
*/
export function defaultRoute(engine: Engine, input: Pick<TurnaroundInput, "views" | "sheet">, routes: TurnRoute[] = ROUTES_ON[engine]): TurnRoute {
const own = TURN_SIDES.filter((s) => input.views?.[s]).length;
- const want: TurnRoute = engine === "open" ? "frames" : own >= 2 || input.sheet ? "references" : "camera";
+ const want: TurnRoute = engine === "open" ? (routes.includes("worldcast") ? "worldcast" : "frames") : own >= 2 || input.sheet ? "references" : "camera";
return routes.includes(want) ? want : (routes[0] ?? want);
}
@@ -448,7 +438,7 @@ type Source = { url: string } | { key: string };
export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext = {}): TurnaroundPlan {
const { engine } = input;
const has = offered(ctx);
- const routes = ROUTES_ON[engine].filter((r) => has(TURN_ROUTES[r].modelId));
+ const routes = ROUTES_ON[engine].filter((r) => has(TURN_ROUTES[r].modelId) && (r !== "worldcast" || ctx.worldcast === true));
const route = input.route && routes.includes(input.route) ? input.route : defaultRoute(engine, input, routes);
const info = TURN_ROUTES[route];
const model = getModel(info.modelId)!;
@@ -460,7 +450,8 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
const camera = route === "camera";
const stills = route === "stills";
const frontFromSheet = !views.front && !!sheet;
- const fill = camera || stills ? false : (input.fill ?? !(route === "references" && sheet));
+ // WorldCast takes the views there are (one to four): drawn sides only when asked, since a drawn side may drift.
+ const fill = camera || stills ? false : (input.fill ?? !((route === "references" && sheet) || route === "worldcast"));
const byQma = engine === "open" && input.fillWith === "qma" && has(QMA_MODEL);
const fills = fill && (views.front || frontFromSheet) ? TURN_SIDES.filter((s) => s !== "front" && !views[s]) : [];
const duration = turnDuration(route, input.duration);
@@ -628,6 +619,21 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
notes.push(
`${model.name} takes ${list.length === 1 ? "the front view" : `the ${list.length} pictures`} as references, starts and ends on the front, and turns the camera from the words: identity holds, the path is loose`,
);
+ } else if (route === "worldcast") {
+ // The front view is the first frame and an anchor (as WorldCast's demo case); every side with a picture is an anchor.
+ const path = input.path && presetKeys(input.path) ? input.path : DEFAULT_PATH;
+ const front = sourceOf("front");
+ const anchors = TURN_SIDES.flatMap((side) => {
+ const src = sourceOf(side);
+ return src ? [{ side, src }] : [];
+ });
+ frames = anchors.map((a) => ({ side: a.side, from: fromOf(a.src, a.side), ...("url" in a.src && { url: a.src.url }) }));
+ const ws = worldcastSteps({ feature, stepFeature, title, still: front, anchors, keys: presetKeys(path)!, prompt: cameraWords(path, input.prompt), seed: input.seed });
+ for (const st of ws) {
+ if (st.key === "main") main = st;
+ else steps.push(st);
+ }
+ notes.push(worldcastNote(anchors.length), WORLDCAST_AFTER);
} else {
const path = input.path && presetKeys(input.path) ? input.path : DEFAULT_PATH;
const keys: CameraKey[] = presetKeys(path)!;
@@ -659,7 +665,9 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
? qmaStillName(Number(k.slice(6)))
: `${SIDE_NAMES[k.slice(5) as TurnSide]} (${byQma ? "QMA" : "Angles"})`;
const total = steps.length + (main ? 1 : 0);
- steps.forEach((s, i) => (s.request.step = { label: stepLabel(s.key), index: i, of: total }));
+ steps.forEach((s, i) => (s.request.step = { label: s.request.step?.label ?? stepLabel(s.key), index: i, of: total }));
+ if (main && route === "worldcast") main.request.step = { label: main.request.step?.label ?? "Film", index: total - 1, of: total };
+ if (engine === "open" && route === "frames" && ctx.worldcast === false) notes.push(worldcastFallback("Frames"));
if (main) steps.push(main);
// Prices at list (or launch) rates; free on the open engine.
diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.ts
index 7260be37..730e2f41 100644
--- a/src/lib/catalog/types.ts
+++ b/src/lib/catalog/types.ts
@@ -286,7 +286,8 @@ export interface FocusPoint {
}
/** "llm" runs text steps (translate, write) on the configured LLM (Claude or a local model) inside the server. */
-export type ProviderId = "fal" | "replicate" | "openai" | "google" | "comfyui" | "mock" | "local" | "llm";
+/** "worldcast" is the WorldCast worker on the owner's GPU, outside ComfyUI (build plan N7-9; docs/workers/worldcast.md). */
+export type ProviderId = "fal" | "replicate" | "openai" | "google" | "comfyui" | "mock" | "local" | "llm" | "worldcast";
/** Duration encodings differ between APIs ("5" vs 5 vs "5s"). */
export interface DurationField {
diff --git a/src/lib/catalog/worldcast-plan.ts b/src/lib/catalog/worldcast-plan.ts
new file mode 100644
index 00000000..f843a7b2
--- /dev/null
+++ b/src/lib/catalog/worldcast-plan.ts
@@ -0,0 +1,135 @@
+/**
+ * WorldCast behind Fuobe's camera-path buttons (build plan N7-9): Cinema's Fly path, Turnaround / Fly around and the exact
+ * orbits (Fuobe DoP, Cinema moves, Image to 3D, Canvas, Assist) plan their open-engine run here when the studio's WorldCast
+ * worker answers (docs/workers/worldcast.md), and say what they run on instead when it doesn't.
+ *
+ * The steps: the still's depth (MoGe 2 by default; the paper's Depth Pro or VGGT-Omega when the worker has them), a SAM 3.1
+ * person mask of the still and of each view, then one WorldCast case (oss-worldcast), whose pictures sit where
+ * src/lib/worldcast.ts imageSlots says. Pure: the browser prices it, the server runs the same steps.
+ */
+
+import type { CameraKey } from "@/lib/camera-path";
+import { DEFAULT_MOTION } from "@/lib/camera-path";
+import { WORLDCAST_RUN, imageSlots, worldcastLayout } from "@/lib/worldcast";
+import type { TurnSide } from "./turnaround";
+import type { ChainSlot, GenerationRequest } from "./types";
+
+export const WORLDCAST_MODELS = { film: "oss-worldcast", mask: "oss-person-mask" } as const;
+
+/** What makes the still's depth: MoGe 2 (MIT, pinned, the default), or the paper's own models on the worker. */
+export const WORLDCAST_DEPTH = { moge: "oss-scene-moge", "depth-pro": "oss-depth-pro", "vggt-omega": "oss-vggt-omega" } as const;
+export type WorldcastDepth = keyof typeof WORLDCAST_DEPTH;
+export const DEPTH_NAMES: Record<WorldcastDepth, string> = { moge: "MoGe 2", "depth-pro": "Depth Pro", "vggt-omega": "VGGT-Omega" };
+
+/** WorldCast's clip, in seconds: 81 frames at 15 fps. */
+export const WORLDCAST_SECONDS = Math.round((WORLDCAST_RUN.frames / WORLDCAST_RUN.fps) * 10) / 10;
+
+/** Said on the open engine when no WorldCast worker answers, by the run that films instead. */
+export function worldcastFallback(on: "Uni3C" | "Frames"): string {
+ return `Runs on ${on}: add a WorldCast worker (48 GB+) for sides that match your photos`;
+}
+
+/** What WorldCast's run says about itself. */
+export function worldcastNote(views: number, depth: WorldcastDepth = "moge"): string {
+ const sides = views ? `the back and sides follow your ${views} view${views === 1 ? "" : "s"}` : "it films from the still alone (add views of the other sides so they match)";
+ return `${DEPTH_NAMES[depth]} measures the still's depth and SAM 3.1 finds the person, then WorldCast films the path on your WorldCast worker: ${sides} — portrait 480 × 832, ${WORLDCAST_RUN.frames} frames at ${WORLDCAST_RUN.fps} fps (${WORLDCAST_SECONDS} s)`;
+}
+
+/** Said after the run: what else the clip can go through. */
+export const WORLDCAST_AFTER = "Smooth it to 24 fps with RIFE, or upscale it, from the result's menu";
+
+/** A picture of the run: a file, or what an earlier step makes. */
+export type WorldcastSource = { url: string } | { key: string };
+
+export interface WorldcastInput {
+ feature: string;
+ /** Where the depth and mask steps are filed (default: `feature`). */
+ stepFeature?: string;
+ title?: string;
+ /** The first frame. */
+ still?: WorldcastSource;
+ /** The views of the subject, by the person's own side (the front is usually the still itself). */
+ anchors: { side: TurnSide; src: WorldcastSource }[];
+ keys: CameraKey[];
+ prompt?: string;
+ seed?: number;
+ depth?: WorldcastDepth;
+ /** Leave the anchors' ring cameras out (anchors_aligned_camera_info.json). */
+ alignedCameras?: boolean;
+}
+
+export interface WorldcastStep {
+ key: string;
+ request: GenerationRequest;
+ after?: string[];
+}
+
+/** One request's pictures in slot order: its own files, and the chain slots (with `at`) for what earlier steps make. */
+function gather(list: WorldcastSource[]) {
+ const images: string[] = [];
+ const chain: ChainSlot[] = [];
+ const after: string[] = [];
+ list.forEach((src, i) => {
+ if ("url" in src) images.push(src.url);
+ else {
+ chain.push({ slot: "images", at: i });
+ after.push(src.key);
+ }
+ });
+ return { images, chain, after };
+}
+
+const one = (src: WorldcastSource): Pick<WorldcastStep, "after"> & { request: Pick<GenerationRequest, "inputs" | "chain"> } =>
+ "url" in src ? { request: { inputs: { images: [src.url] } } } : { request: { chain: [{ slot: "images" }] }, after: [src.key] };
+
+/** The steps of a WorldCast run, film last (key "main"); numbered as one run. */
+export function worldcastSteps(input: WorldcastInput): WorldcastStep[] {
+ const layout = worldcastLayout(input.anchors.map((a) => a.side));
+ const anchors = layout.anchors.map((a) => input.anchors.find((x) => x.side === a.side)!.src);
+ const stepFeature = input.stepFeature ?? input.feature;
+ const depth = input.depth ?? "moge";
+ const steps: WorldcastStep[] = [];
+ const still = input.still ?? { url: "/api/files/placeholder.png" };
+ const pre = (key: string, src: WorldcastSource, request: Omit<GenerationRequest, "inputs" | "chain">): WorldcastStep => {
+ const o = one(src);
+ return { key, request: { ...request, ...o.request }, ...(o.after && { after: o.after }) };
+ };
+ steps.push(
+ depth === "moge"
+ ? pre("depth", still, { feature: stepFeature, modelId: WORLDCAST_DEPTH.moge, op: "scene-3d", prompt: "", params: { numOutputs: 1, extra: { decimation: 4 } } })
+ : pre("depth", still, { feature: stepFeature, modelId: WORLDCAST_DEPTH[depth], op: "edit", prompt: "", params: { numOutputs: 1 } }),
+ );
+ steps.push(pre("mask-still", still, { feature: stepFeature, modelId: WORLDCAST_MODELS.mask, op: "bg-remove", prompt: "person", params: { numOutputs: 1 } }));
+ layout.anchors.forEach((a, i) => steps.push(pre(`mask-${a.view}`, anchors[i], { feature: stepFeature, modelId: WORLDCAST_MODELS.mask, op: "bg-remove", prompt: "person", params: { numOutputs: 1 } })));
+ const slots = imageSlots(layout);
+ const order: WorldcastSource[] = new Array(slots.total);
+ order[slots.still] = still;
+ anchors.forEach((src, i) => (order[slots.anchor(i)] = src));
+ order[slots.stillMask] = { key: "mask-still" };
+ layout.anchors.forEach((a, i) => (order[slots.anchorMask(i)] = { key: `mask-${a.view}` }));
+ order[slots.depth] = { key: "depth" };
+ const { images, chain, after } = gather(order);
+ steps.push({
+ key: "main",
+ request: {
+ feature: input.feature,
+ modelId: WORLDCAST_MODELS.film,
+ op: "camera-path",
+ prompt: input.prompt?.trim() || DEFAULT_MOTION,
+ ...(input.title && { title: input.title }),
+ ...(images.length && { inputs: { images } }),
+ chain,
+ params: {
+ numOutputs: 1,
+ aspectRatio: "9:16",
+ cameraPath: input.keys,
+ ...(input.seed !== undefined && { seed: input.seed }),
+ extra: { worldcast: layout, ...(input.alignedCameras === false && { alignedCameras: false }) },
+ },
+ },
+ after,
+ });
+ const labels: Record<string, string> = { depth: `Depth of the still (${DEPTH_NAMES[depth]})`, "mask-still": "The person in the still", main: "Film along the path (WorldCast)" };
+ steps.forEach((s, i) => (s.request.step = { label: labels[s.key] ?? `The person in the ${s.key.slice(5).replace("_", " ")} view`, index: i, of: steps.length }));
+ return steps;
+}
diff --git a/src/lib/connections.ts b/src/lib/connections.ts
index 7eea9313..c45ba146 100644
--- a/src/lib/connections.ts
+++ b/src/lib/connections.ts
@@ -12,7 +12,7 @@ export const PROVIDER_SETTINGS = {
fal: ["falKey"],
replicate: ["replicateToken"],
// comfyWhere "server": a server address tested while ComfyUI runs on the owner's computer is tested as a server.
- comfyui: ["comfyUrl", "comfyToken", "comfyIsolatedUrl", "comfyWhere"],
+ comfyui: ["comfyUrl", "comfyToken", "comfyIsolatedUrl", "comfyWhere", "worldcastUrl"],
// Claude, and the local model servers of Settings → AI helper (Ollama, LM Studio, Unsloth Studio, any OpenAI-compatible one).
llm: [
"anthropicKey",
@@ -133,6 +133,8 @@ export function settingProblem(name: string, raw: string): string | null {
return addressProblem(v, DEFAULT_COMFY_URL);
case "comfyIsolatedUrl":
return addressProblem(v, "http://127.0.0.1:8189");
+ case "worldcastUrl":
+ return addressProblem(v, "http://127.0.0.1:8190");
case "ollamaUrl":
return addressProblem(v, "http://127.0.0.1:11434");
case "lmstudioUrl":
diff --git a/src/lib/path-splat.ts b/src/lib/path-splat.ts
index 5d34a089..94661cca 100644
--- a/src/lib/path-splat.ts
+++ b/src/lib/path-splat.ts
@@ -17,8 +17,17 @@ export const MAX_SPLAT_PX = 6;
* One frame, RGB (3 bytes a pixel, rows top-down), of `cloud` (glTF axes: x right, y up, the photo looking down −Z) seen by
* a camera-to-world `pose` in OpenCV axes (x right, y down, z forward; the world is the photo camera's own frame, as
* camera-path framePoses makes them) with pixel intrinsic `k`. Each point is a square as wide as its size at its distance.
+ * `holes` (RGB too, for WorldCast's render_mask.mp4) is filled white where no point landed and black where one did.
*/
-export function splatFrame(cloud: Pick<PointCloud, "positions" | "colors" | "sizes" | "count">, pose: Mat4, k: Mat3, width: number, height: number, out?: Uint8Array): Uint8Array {
+export function splatFrame(
+ cloud: Pick<PointCloud, "positions" | "colors" | "sizes" | "count">,
+ pose: Mat4,
+ k: Mat3,
+ width: number,
+ height: number,
+ out?: Uint8Array,
+ holes?: Uint8Array,
+): Uint8Array {
const rgb = out ?? new Uint8Array(width * height * 3);
rgb.fill(0);
const zbuf = new Float32Array(width * height).fill(Infinity);
@@ -59,5 +68,6 @@ export function splatFrame(cloud: Pick<PointCloud, "positions" | "colors" | "siz
rgb[o * 3 + 2] = blue;
}
}
+ if (holes) for (let o = 0; o < zbuf.length; o++) holes[o * 3] = holes[o * 3 + 1] = holes[o * 3 + 2] = zbuf[o] === Infinity ? 255 : 0;
return rgb;
}
diff --git a/src/lib/worldcast.ts b/src/lib/worldcast.ts
index 34ddc65a..61e238f8 100644
--- a/src/lib/worldcast.ts
+++ b/src/lib/worldcast.ts
@@ -16,7 +16,40 @@
*/
import { cropFov, keyPose, type FramePoses, type Mat3, type Mat4 } from "./camera-path";
-import { worldcastAnchor, type TurnSide, type WorldcastView } from "./catalog/turnaround";
+import type { TurnSide } from "./catalog/turnaround";
+
+/**
+ * WorldCast's convention (N7-9; new-models-7.md §3.4, §3.11): its 1–4 anchor photos are named front, right_side, back and
+ * left_side, with each one's azimuth in body_views_meta.json. The names are WHERE THE CAMERA STANDS, not the body's own sides:
+ * the demo case's aligned cameras (no_padding_black/anchors_aligned_camera_info.json) put right_side at +x of the first camera
+ * (moved round to the camera's own right, 91.79°) and left_side at −x (266.91°, `left_sign` −1: reached turning the other
+ * way, −93°), and its "right_side" crop shows the boy facing the lens because the first frame shows him in profile. So
+ * WorldCast's azimuth is the camera-path library's (+ = moved round to the right), and a person's own right side, seen from
+ * the camera moved round to its LEFT (pathAzimuth −90°), is WorldCast's left_side. Convert in worldcastAnchor and nowhere
+ * else; a swapped left and right silently hurts identity.
+ */
+/** Where the camera stands round the person to see each of their sides (turnaround.ts viewAzimuth). */
+const PERSON_AZIMUTH: Record<TurnSide, number> = { front: 0, right: 90, back: 180, left: 270 };
+
+export const WORLDCAST = {
+ anchor: { front: "front", right: "left_side", back: "back", left: "right_side" } as const satisfies Record<TurnSide, string>,
+ /** The demo case's azimuths (demo_case/A360-031__portrait/body_views_vggt/body_views_meta.json). */
+ demoAzimuth: { front: 0, right_side: 91.79, back: 171.39, left_side: 266.91 },
+ leftSign: -1 as const,
+};
+
+export type WorldcastView = (typeof WORLDCAST.anchor)[TurnSide];
+
+/**
+ * A side as a WorldCast anchor: its name, the azimuth to write for it (0–360, + = the camera moved round to its right) and
+ * the signed one (left_side by `left_sign`: −90°), which is also where camera-path keyPose puts its camera.
+ */
+export function worldcastAnchor(side: TurnSide): { name: WorldcastView; azimuth: number; signed: number } {
+ const name = WORLDCAST.anchor[side];
+ // The camera-path azimuth that sees this side (turnaround.ts pathAzimuth: −viewAzimuth), as 0–360.
+ const azimuth = (360 - PERSON_AZIMUTH[side]) % 360;
+ return { name, azimuth, signed: name === "left_side" ? WORLDCAST.leftSign * (360 - azimuth) : azimuth };
+}
/** What the released checkpoint was trained on and the demo runs with (demo.py): fixed, except the seed and the prompt. */
export const WORLDCAST_RUN = { frames: 81, fps: 15, width: 480, height: 832, steps: 50, cfg: 5, shift: 2, maxAnchors: 4 } as const;
diff --git a/src/server/assist/studio-tools.ts b/src/server/assist/studio-tools.ts
index b0f3e786..aa980de0 100644
--- a/src/server/assist/studio-tools.ts
+++ b/src/server/assist/studio-tools.ts
@@ -1,4 +1,5 @@
import "server-only";
+import { worldcastContext } from "../worldcast-on";
import { nanoid } from "nanoid";
import { z } from "zod";
import type { PlannedJob } from "@/lib/assist";
@@ -850,7 +851,7 @@ function flyAroundSteps(i: FlyAroundToolInput, ctx: ToolContext): PipelineStep[]
prompt: i.prompt,
duration: i.duration,
feature: "fly-around",
- });
+ }, { worldcast: worldcastContext() });
if (plan.blocker) throw new Error(plan.blocker);
return plan.steps.map((s) => ({ key: s.key, request: s.request, ...(s.after?.length && { after: s.after }) }));
}
diff --git a/src/server/cinema-generate.ts b/src/server/cinema-generate.ts
index 01633cd4..37e894d5 100644
--- a/src/server/cinema-generate.ts
+++ b/src/server/cinema-generate.ts
@@ -23,13 +23,14 @@ import { encodePng } from "./png";
import { engineMode, getSetting } from "./settings";
import { saveFile, storedMedia } from "./storage";
import { isOffered } from "./model-access";
+import { worldcastContext } from "./worldcast-on";
/**
* What this install can run right now (cloud fallbacks such as reading a take's first frame, the workflows it has, a
* camera LoRA that downloads from civitai, which fal gets only with the user's civitai key).
*/
export function cinemaContext(): CinemaContext {
- return { cloudAllowed: engineMode() !== "open", has: (id) => !!getModel(id) && isOffered(id), civitai: !!getSetting("civitaiKey") };
+ return { cloudAllowed: engineMode() !== "open", has: (id) => !!getModel(id) && isOffered(id), civitai: !!getSetting("civitaiKey"), worldcast: worldcastContext() };
}
declare global {
diff --git a/src/server/fly-around.ts b/src/server/fly-around.ts
index bdb07cdb..257e5a87 100644
--- a/src/server/fly-around.ts
+++ b/src/server/fly-around.ts
@@ -7,6 +7,8 @@ import { FLY_VIEWS_MAX, planFlyAround, type FlyAroundInput, type FlyAroundPlan,
import type { Generation } from "@/lib/catalog/types";
import { cancelGeneration, createGenerations, previewChained, previewGeneration } from "./generations";
import { isOffered } from "./model-access";
+import { worldcastDepths } from "./worldcast";
+import { worldcastContext } from "./worldcast-on";
/**
* Fly around (build plan N7-7): the plan from src/lib/catalog/fly-around.ts, checked step by step on this install (keys,
@@ -50,6 +52,10 @@ export const FlyAroundSchema = z.object({
.optional(),
title: z.string().max(80).optional(),
seed: z.number().int().min(0).max(4_294_967_295).optional(),
+ /** Views by the person's own side: WorldCast's anchors on the open engine (N7-9). */
+ sides: z.object({ front: FileRef.optional(), right: FileRef.optional(), back: FileRef.optional(), left: FileRef.optional() }).optional(),
+ /** WorldCast's depth model: MoGe 2 (default), or Depth Pro / VGGT-Omega on the worker. */
+ depth: z.enum(["moge", "depth-pro", "vggt-omega"]).optional(),
requestId: z.string().max(80).optional(),
});
@@ -77,7 +83,11 @@ export interface FlyAroundPreview {
/** The plan as this install runs it: a model switched off in Settings → Models & licences is a blocker. */
function plan(input: FlyAroundInput): FlyAroundPlan {
- const p = planFlyAround(input);
+ const p = planFlyAround(input, { worldcast: worldcastContext() });
+ // Depth Pro and VGGT-Omega run on the worker only when it has them installed (its GET /health lists them).
+ if (p.model.id === "oss-worldcast" && input.depth && input.depth !== "moge" && !worldcastDepths().includes(input.depth) && !p.blocker) {
+ return { ...p, blocker: `Your WorldCast worker doesn't have ${input.depth === "depth-pro" ? "Depth Pro" : "VGGT-Omega"} installed: use MoGe 2, or add it to the worker` };
+ }
const off = p.steps.find((s) => !isOffered(s.request.modelId));
return off && !p.blocker ? { ...p, blocker: "This move is switched off on this studio" } : p;
}
diff --git a/src/server/gpu/hosts.ts b/src/server/gpu/hosts.ts
index 69f1180a..0e361448 100644
--- a/src/server/gpu/hosts.ts
+++ b/src/server/gpu/hosts.ts
@@ -15,10 +15,10 @@ export function hostKey(url: string): string | null {
}
}
-/** The hosts of this install's own ComfyUI (main and isolated worker). */
+/** The hosts of this install's own ComfyUI (main and isolated worker) and its WorldCast worker. */
export function installHosts(): Set<string> {
const out = new Set<string>();
- for (const name of ["comfyUrl", "comfyIsolatedUrl"] as const) {
+ for (const name of ["comfyUrl", "comfyIsolatedUrl", "worldcastUrl"] as const) {
const h = hostKey(getSetting(name) ?? "");
if (h) out.add(h);
}
diff --git a/src/server/model-access.ts b/src/server/model-access.ts
index 43f47ea2..3820598d 100644
--- a/src/server/model-access.ts
+++ b/src/server/model-access.ts
@@ -15,6 +15,7 @@ import {
LICENCE_CLASSES,
llmLicence,
licenceInfo,
+ UNKNOWN_LICENCE,
loraLicenceInfo,
mergeLicences,
modelCardOf,
@@ -121,8 +122,10 @@ function comfyFacts(endpoint: string): { licence: LicenceInfo; packs: string[];
}
/** A route's licence: the weights' for ComfyUI, the provider's terms for a paid API, Fuobe's own code in the browser. */
-export function routeLicence(route: ModelRoute, model: Pick<ModelDef, "vendor">): LicenceInfo {
+export function routeLicence(route: ModelRoute, model: Pick<ModelDef, "vendor" | "licence">): LicenceInfo {
if (route.provider === "comfyui") return comfyFacts(route.endpoint).licence;
+ // The WorldCast worker (N7-9): the weights it runs, as the catalog records them (ModelDef.licence).
+ if (route.provider === "worldcast") return model.licence ? weightsLicence(model.licence) : licenceInfo(UNKNOWN_LICENCE);
if (route.provider === "local") return BROWSER_LICENCE;
if (route.provider === "llm") {
const local = localModelInUse();
diff --git a/src/server/path-render.ts b/src/server/path-render.ts
index ba0db3fd..978340a4 100644
--- a/src/server/path-render.ts
+++ b/src/server/path-render.ts
@@ -34,7 +34,7 @@ async function pixels(data: Buffer, size: { width: number; height: number }) {
}
/** Frames as RGB into ffmpeg's stdin, an H.264 MP4 out (yuv420p, so every reader plays it), written to `file`. */
-function encode(file: string, frames: number, width: number, height: number, fps: number, frame: (i: number) => Uint8Array): Promise<void> {
+export function encode(file: string, frames: number, width: number, height: number, fps: number, frame: (i: number) => Uint8Array): Promise<void> {
return new Promise((resolve, reject) => {
const args = ["-hide_banner", "-loglevel", "error", "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", `${width}x${height}`, "-r", String(fps), "-i", "pipe:0"];
args.push("-c:v", "libx264", "-preset", "veryfast", "-crf", "18", "-pix_fmt", "yuv420p", "-movflags", "+faststart", "-f", "mp4", "-y", file);
diff --git a/src/server/providers/comfy-address.ts b/src/server/providers/comfy-address.ts
index 3f281651..b7752a08 100644
--- a/src/server/providers/comfy-address.ts
+++ b/src/server/providers/comfy-address.ts
@@ -36,7 +36,7 @@ const lookup: Resolve = async (host) => (await dns.lookup(host, { all: true, ver
* - A name: looked up; any loopback, link-local, private or this machine's own address refuses it. A name that
* doesn't resolve goes on, and the test says it can't reach it. The answer never shows what it resolved to.
*/
-export async function hostedAddressRefusal(field: "comfyUrl" | "comfyIsolatedUrl", typed: string | undefined, o: { resolve?: Resolve } = {}): Promise<AddressRefusal | null> {
+export async function hostedAddressRefusal(field: "comfyUrl" | "comfyIsolatedUrl" | "worldcastUrl", typed: string | undefined, o: { resolve?: Resolve } = {}): Promise<AddressRefusal | null> {
let url = typed?.trim() ?? "";
if (!url) {
const source = settingSource(field);
diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.ts
index 0ee735f0..5ad47858 100644
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@ -105,6 +105,7 @@ import {
type TaskRow,
} from "../computer/tasks";
import { OWNER_BOOST_MS, poolFields, poolWaitMs, poolWaitWords } from "../computer/pool";
+import { worldcastBase, worldcastHealth } from "../worldcast";
export const WORKFLOW_DIR = path.join(process.cwd(), "workflows", "comfyui");
@@ -2424,6 +2425,12 @@ export const comfyProvider: ProviderAdapter = {
},
async test(opts) {
+ // The WorldCast worker's address (Settings → Open-source engine, beside the isolated worker): that worker answers.
+ if (opts?.focus === "worldcastUrl") {
+ const h = await worldcastHealth(10_000);
+ if (h.ok) globalThis.__fuobeWorldcast = { base: worldcastBase(), at: Date.now(), ok: true, depth: h.depth ?? [] };
+ return { ok: h.ok, detail: h.detail };
+ }
// On someone's computer: what its tab last said about it.
const computer = computerScope();
if (computer) {
diff --git a/src/server/providers/index.ts b/src/server/providers/index.ts
index 77d4e3d5..ba5eabdf 100644
--- a/src/server/providers/index.ts
+++ b/src/server/providers/index.ts
@@ -5,6 +5,7 @@ import { falProvider } from "./fal";
import { llmProvider } from "./llm";
import { mockProvider } from "./mock";
import { replicateProvider } from "./replicate";
+import { worldcastProvider } from "./worldcast";
import type { ProviderAdapter } from "./types";
const notImplemented = (id: ProviderId, label: string): ProviderAdapter => ({
@@ -43,6 +44,7 @@ export const PROVIDERS: Record<ProviderId, ProviderAdapter> = {
openai: notImplemented("openai", "OpenAI"),
google: notImplemented("google", "Google"),
llm: llmProvider,
+ worldcast: worldcastProvider,
};
/**
diff --git a/src/server/providers/worldcast.ts b/src/server/providers/worldcast.ts
new file mode 100644
index 00000000..5d097394
--- /dev/null
+++ b/src/server/providers/worldcast.ts
@@ -0,0 +1,65 @@
+import "server-only";
+import { readLayout } from "@/lib/worldcast";
+import { buildCase } from "../worldcast-case";
+import { cancelJob, jobStatus, jobVideoUrl, submitCase, worldcastBase, worldcastHealth } from "../worldcast";
+import type { ProviderAdapter } from "./types";
+import { ProviderError } from "./types";
+
+/**
+ * The WorldCast worker as a provider (build plan N7-9): a run's pictures stay on this server until submit, where the case
+ * is made (src/server/worldcast-case.ts) and sent as one multipart POST; polls read the job, and the clip is fetched from
+ * the worker when it is done. Open engine, the studio's own GPU only (accountRun refuses an account: not ComfyUI, not a key).
+ */
+
+const DATA_URI = /^data:([^;,]+);base64,(.*)$/s;
+
+function fileOf(ref: string): Buffer {
+ const m = DATA_URI.exec(ref);
+ if (!m) throw new ProviderError("WorldCast got a picture it can't read");
+ return Buffer.from(m[2], "base64");
+}
+
+export const worldcastProvider: ProviderAdapter = {
+ id: "worldcast",
+ label: "WorldCast worker",
+ isConfigured: () => !!worldcastBase(),
+ // Kept as data until the case is made: nothing is sent before submit.
+ prepareFile: async (data, contentType) => `data:${contentType || "application/octet-stream"};base64,${data.toString("base64")}`,
+
+ async submit({ input }) {
+ const layout = readLayout(input.extra?.worldcast);
+ const images = (input.images ?? []).map(fileOf);
+ const keys = input.cameraPath ?? [];
+ if (keys.length < 2) throw new ProviderError("Pick a path first");
+ const { parts } = await buildCase({
+ layout,
+ images,
+ keys,
+ prompt: input.prompt,
+ seed: input.seed,
+ alignedCameras: input.extra?.alignedCameras !== false,
+ });
+ const id = await submitCase(parts);
+ return {
+ externalId: id,
+ meta: { worldcast: true },
+ payload: { job: id, anchors: layout.anchors.map((a) => a.view), parts: parts.map((p) => p.name) },
+ };
+ },
+
+ async poll({ externalId }) {
+ const job = await jobStatus(externalId);
+ if (job.status === "succeeded") return { state: "succeeded", outputs: [{ url: jobVideoUrl(externalId), kind: "video", contentType: "video/mp4", meta: { fps: 15 } }] };
+ if (job.status === "failed") return { state: "failed", error: job.error };
+ return { state: job.status, ...(job.progress !== undefined && { progress: job.progress }), message: job.message ?? (job.status === "queued" ? "Waiting for the WorldCast worker" : "WorldCast is filming") };
+ },
+
+ async cancel({ externalId }) {
+ await cancelJob(externalId);
+ },
+
+ async test() {
+ const h = await worldcastHealth();
+ return { ok: h.ok, detail: h.detail };
+ },
+};
diff --git a/src/server/settings.ts b/src/server/settings.ts
index 70cf5ca2..f837df40 100644
--- a/src/server/settings.ts
+++ b/src/server/settings.ts
@@ -71,6 +71,8 @@ export const SETTINGS = {
comfyToken: { key: "comfyui.token", env: "COMFYUI_TOKEN", secret: true },
/** A second ComfyUI for workflows whose node packs can't share the main install (LatentSync 1.6, ThinkSound; scripts/comfy/README.md). */
comfyIsolatedUrl: { key: "comfyui.isolatedUrl", env: "COMFYUI_ISOLATED_URL" },
+ /** The WorldCast worker on the owner's GPU (docs/workers/worldcast.md): an HTTP service outside ComfyUI, usually port 8190. */
+ worldcastUrl: { key: "worldcast.url", env: "WORLDCAST_URL" },
/**
* Where the owner's ComfyUI runs: on this server (its address above), or on the computer the owner uses, reached
* through the owner's own Fuobe tab (a studio on a server, a ComfyUI at home: src/server/computer).
diff --git a/src/server/turnaround.ts b/src/server/turnaround.ts
index 7ce07107..e7787a1d 100644
--- a/src/server/turnaround.ts
+++ b/src/server/turnaround.ts
@@ -9,6 +9,7 @@ import { needsConsent } from "@/lib/catalog/training";
import { getElement } from "./elements";
import { cancelGeneration, createGenerations, previewChained, previewGeneration } from "./generations";
import { isOffered } from "./model-access";
+import { worldcastContext } from "./worldcast-on";
import { loadManifest } from "./providers/comfyui";
import { consentOnFile } from "./training";
@@ -25,7 +26,7 @@ export const TurnaroundSchema = z.object({
engine: z.enum(["cloud", "open"]),
views: z.object({ front: FileRef.optional(), right: FileRef.optional(), back: FileRef.optional(), left: FileRef.optional() }).default({}),
sheet: FileRef.optional(),
- route: z.enum(["frames", "references", "keyframes", "camera", "stills"]).optional(),
+ route: z.enum(["worldcast", "frames", "references", "keyframes", "camera", "stills"]).optional(),
fill: z.boolean().optional(),
fillWith: z.enum(["angles", "qma"]).optional(),
path: z.string().max(40).optional(),
@@ -86,7 +87,7 @@ export interface TurnaroundRequest extends TurnaroundInput {
/** What this install offers (Settings → Models & licences). */
export function turnaroundContext(): TurnaroundContext {
- return { has: (id) => !!getModel(id) && isOffered(id) };
+ return { has: (id) => !!getModel(id) && isOffered(id), worldcast: worldcastContext() };
}
/** Said when a real person's pictures go without the consent line (Soul ID's, src/lib/catalog/training.ts). */
@@ -120,6 +121,8 @@ function gpuGb(plan: TurnaroundPlan): number | undefined {
let most: number | undefined;
for (const s of plan.steps) {
const m = getModel(s.request.modelId);
+ // WorldCast's worker: 48 GB or more (its README and model card).
+ if (m?.routes.some((r) => r.provider === "worldcast")) most = Math.max(most ?? 0, 48);
const route = m && routesFor(m, s.request.op ?? "edit").find((r) => r.provider === "comfyui");
const gb = route && flows.find((w) => w.id === route.endpoint)?.vramGb;
if (typeof gb === "number") most = Math.max(most ?? 0, gb);
diff --git a/src/server/worldcast-case.ts b/src/server/worldcast-case.ts
new file mode 100644
index 00000000..03dd5f45
--- /dev/null
+++ b/src/server/worldcast-case.ts
@@ -0,0 +1,104 @@
+import "server-only";
+import fs from "node:fs";
+import path from "node:path";
+import { nanoid } from "nanoid";
+import sharp from "sharp";
+import { DEFAULT_MOTION, framePoses, type CameraKey } from "@/lib/camera-path";
+import { splatFrame } from "@/lib/path-splat";
+import { LENS, buildPointCloud, lensFov } from "@/lib/scene3d";
+import { WORLDCAST_RUN, caseParts, imageSlots, worldcastCrop, worldcastFov, type CasePart, type WorldcastLayout } from "@/lib/worldcast";
+import { encode } from "./path-render";
+import { scratchDir } from "./storage";
+
+/**
+ * A WorldCast case made from a run's pictures (build plan N7-9): the still cropped to 480 × 832 and its SAM 3.1 mask, the
+ * point-cloud render of the path through MoGe 2's depth with its hole mask (two MP4s at 15 fps), cam_info.json, and the anchors
+ * with their masks (the worker cuts their tight no_padding_black crops: docs/workers/worldcast.md). The pictures arrive in the
+ * order src/lib/worldcast.ts imageSlots gives.
+ */
+
+const MAX_POINTS = 300_000;
+
+export interface CaseInput {
+ layout: WorldcastLayout;
+ /** The step's pictures, as files (imageSlots' order). */
+ images: Buffer[];
+ keys: CameraKey[];
+ prompt?: string;
+ seed?: number;
+ /** false: leave anchors_aligned_camera_info.json out. */
+ alignedCameras?: boolean;
+}
+
+const W = WORLDCAST_RUN.width;
+const H = WORLDCAST_RUN.height;
+
+async function raw(img: ReturnType<typeof sharp>) {
+ const { data, info } = await img.raw().toBuffer({ resolveWithObject: true });
+ return { width: info.width, height: info.height, data };
+}
+
+/** A mask as 0 / 255 grey, white where the person is (any picture SAM 3.1 saved: grey, RGB or with alpha). */
+async function binaryMask(data: Buffer, size?: { width: number; height: number }, crop?: ReturnType<typeof worldcastCrop>): Promise<Buffer> {
+ let img = sharp(data, { failOn: "none" }).rotate().flatten({ background: "#000" }).greyscale();
+ if (size) img = img.resize(size.width, size.height, { fit: "fill", kernel: "nearest" });
+ if (crop) img = sharp(await img.png().toBuffer()).extract(crop).resize(W, H, { fit: "fill", kernel: "nearest" });
+ return img.threshold(128).png().toBuffer();
+}
+
+async function sizeOf(data: Buffer): Promise<{ width: number; height: number }> {
+ const m = await sharp(data, { failOn: "none" }).metadata();
+ return { width: m.autoOrient?.width ?? m.width ?? 1, height: m.autoOrient?.height ?? m.height ?? 1 };
+}
+
+/** The case's parts, ready for POST /cases. */
+export async function buildCase(input: CaseInput): Promise<{ parts: CasePart[]; pivotDepth: number }> {
+ const slots = imageSlots(input.layout);
+ if (input.images.length < slots.total) throw new Error("WorldCast needs the still, its depth and every picture's mask");
+ const still = input.images[slots.still];
+ const full = await sizeOf(still);
+ const crop = worldcastCrop(full.width, full.height);
+ const firstFrame = await sharp(still, { failOn: "none" }).rotate().removeAlpha().extract(crop).resize(W, H, { fit: "fill" }).png().toBuffer();
+ const personMask = await binaryMask(input.images[slots.stillMask], full, crop);
+ // The depth picture is MoGe 2's of the whole still: brought to the still's size, then cropped the same way.
+ const depthFull = await sharp(input.images[slots.depth], { failOn: "none" }).rotate().resize(full.width, full.height, { fit: "fill" }).png().toBuffer();
+ const photo = await raw(sharp(firstFrame).removeAlpha().ensureAlpha());
+ const depth = await raw(sharp(depthFull).extract(crop).resize(W, H, { fit: "fill" }).removeAlpha().ensureAlpha());
+ const hFov = worldcastFov(lensFov(LENS.default, full.width / full.height).h, full.width / full.height);
+ const cloud = buildPointCloud(photo, depth, { hFov, maxPoints: MAX_POINTS });
+ const poses = framePoses(input.keys, WORLDCAST_RUN.frames, cloud.depth, hFov, { width: W, height: H });
+ const dir = scratchDir();
+ const id = nanoid(10);
+ const renderFile = path.join(dir, `worldcast-${id}-render.mp4`);
+ const maskFile = path.join(dir, `worldcast-${id}-mask.mp4`);
+ try {
+ const holes: Uint8Array[] = [];
+ await encode(renderFile, poses.poses.length, W, H, WORLDCAST_RUN.fps, (i) => {
+ const hole = new Uint8Array(W * H * 3);
+ const rgb = splatFrame(cloud, poses.poses[i], poses.intrinsic, W, H, undefined, hole);
+ holes[i] = hole;
+ return rgb;
+ });
+ await encode(maskFile, poses.poses.length, W, H, WORLDCAST_RUN.fps, (i) => holes[i]);
+ const anchors = await Promise.all(
+ input.layout.anchors.map(async (_, i) => {
+ const pic = input.images[slots.anchor(i)];
+ const size = await sizeOf(pic);
+ return {
+ image: await sharp(pic, { failOn: "none" }).rotate().removeAlpha().png().toBuffer(),
+ mask: await binaryMask(input.images[slots.anchorMask(i)], size),
+ };
+ }),
+ );
+ const parts = caseParts(
+ input.layout,
+ poses,
+ { firstFrame, personMask, render: fs.readFileSync(renderFile), renderMask: fs.readFileSync(maskFile), anchors },
+ { prompt: input.prompt?.trim() || DEFAULT_MOTION, seed: input.seed ?? 42, pivotDepth: cloud.depth, noAlignedCameras: input.alignedCameras === false },
+ );
+ return { parts, pivotDepth: cloud.depth };
+ } finally {
+ fs.rmSync(renderFile, { force: true });
+ fs.rmSync(maskFile, { force: true });
+ }
+}
diff --git a/src/server/worldcast-on.ts b/src/server/worldcast-on.ts
new file mode 100644
index 00000000..535465e5
--- /dev/null
+++ b/src/server/worldcast-on.ts
@@ -0,0 +1,25 @@
+import "server-only";
+import { WORLDCAST_MODELS } from "@/lib/catalog/worldcast-plan";
+import { isOffered } from "./model-access";
+import { ownGpu } from "./providers/comfyui";
+import { tenantAccount } from "./tenant";
+import { refreshWorldcast, worldcastAnswers } from "./worldcast";
+
+/**
+ * What the camera-path planners get for WorldCast (build plan N7-9): true when the studio's worker answers and WorldCast is
+ * switched on, false when it is on but no worker answers (the run says what it films on instead), undefined for a visitor
+ * (a guest or an account runs on its own GPU, which has no WorldCast worker: nothing is said about the studio's) or when
+ * WorldCast is switched off in Settings → Models & licences.
+ */
+export function worldcastContext(): boolean | undefined {
+ if (tenantAccount() || ownGpu()) return undefined;
+ if (!isOffered(WORLDCAST_MODELS.film)) return undefined;
+ return worldcastAnswers();
+}
+
+/** The same, after asking the worker when the last answer is over a minute old (routes call it before they plan). */
+export async function worldcastContextNow(): Promise<boolean | undefined> {
+ if (tenantAccount() || ownGpu() || !isOffered(WORLDCAST_MODELS.film)) return undefined;
+ await refreshWorldcast().catch(() => false);
+ return worldcastAnswers();
+}
diff --git a/src/server/worldcast.ts b/src/server/worldcast.ts
new file mode 100644
index 00000000..fcfc9cc3
--- /dev/null
+++ b/src/server/worldcast.ts
@@ -0,0 +1,183 @@
+import "server-only";
+import type { CasePart } from "@/lib/worldcast";
+import { ProviderError } from "./providers/types";
+import { getSetting } from "./settings";
+import { tenantAccount } from "./tenant";
+
+/**
+ * The WorldCast worker's client (build plan N7-9; the contract is docs/workers/worldcast.md): an HTTP service on the owner's
+ * GPU, outside ComfyUI, at Settings → Open-source engine · WORLDCAST_URL. POST /cases takes a case Fuobe prepared
+ * (src/server/worldcast-case.ts) and answers a job id; GET /jobs/{id} says how it goes; GET /jobs/{id}/video is the MP4.
+ *
+ * It is the install's worker: an account's run never reaches it (its runs go to its own ComfyUI; the provider refuses one).
+ */
+
+export const WORLDCAST_SETTING = "Settings → Open-source engine · ComfyUI → WorldCast worker URL";
+/** How long a health check waits: the three buttons ask before they plan. */
+const HEALTH_TIMEOUT_MS = 3000;
+/** How long an answer stays good for the planners (they are synchronous: they read this). */
+const HEALTH_TTL_MS = 60_000;
+/** A job id as the worker gives it: anything else is refused, never put in a path. */
+export const JOB_ID = /^[A-Za-z0-9_-]{1,64}$/;
+
+export function worldcastBase(): string {
+ return (getSetting("worldcastUrl") ?? "").trim().replace(/\/+$/, "");
+}
+
+export interface WorldcastHealth {
+ ok: boolean;
+ detail: string;
+ model?: string;
+ vramGb?: number;
+ /** The extra depth models the worker can run itself ("depth-pro", "vggt-omega"), when it has them installed. */
+ depth?: string[];
+}
+
+function guard(): void {
+ if (tenantAccount()) throw new ProviderError("WorldCast runs on the studio's own GPU only.");
+}
+
+async function call(path: string, init: RequestInit = {}, timeoutMs = 60_000): Promise<Response> {
+ guard();
+ const base = worldcastBase();
+ if (!base) throw new ProviderError(`No WorldCast worker is set up: add its address in ${WORLDCAST_SETTING} (or WORLDCAST_URL)`);
+ try {
+ return await fetch(`${base}${path}`, { ...init, signal: init.signal ?? AbortSignal.timeout(timeoutMs) });
+ } catch (e) {
+ throw new ProviderError(`The WorldCast worker at ${base} doesn't answer (${(e as Error).message}). Start it (workers/worldcast/README.md) or check ${WORLDCAST_SETTING}`);
+ }
+}
+
+/** The worker's error text: its JSON `error` / `detail`, never an HTML page. */
+async function said(res: Response): Promise<string> {
+ const text = await res.text().catch(() => "");
+ try {
+ const j = JSON.parse(text) as { error?: unknown; detail?: unknown };
+ const m = typeof j.error === "string" ? j.error : typeof j.detail === "string" ? j.detail : "";
+ if (m) return m.slice(0, 300);
+ } catch {
+ // not JSON
+ }
+ return /^\s*</.test(text) ? "" : text.trim().slice(0, 300);
+}
+
+async function failure(what: string, res: Response): Promise<ProviderError> {
+ const detail = await said(res);
+ return new ProviderError(`The WorldCast worker answered HTTP ${res.status} to ${what}${detail ? `: ${detail}` : ""}`, res.status);
+}
+
+/** GET /health. */
+export async function worldcastHealth(timeoutMs = HEALTH_TIMEOUT_MS): Promise<WorldcastHealth> {
+ if (!worldcastBase()) return { ok: false, detail: "No WorldCast worker address set" };
+ try {
+ const res = await call("/health", {}, timeoutMs);
+ if (!res.ok) return { ok: false, detail: (await failure("a health check", res)).message };
+ const j = (await res.json()) as { ok?: boolean; model?: string; vram_gb?: number; depth?: unknown };
+ if (j.ok !== true) return { ok: false, detail: "The WorldCast worker says it isn't ready yet (still loading its weights?)" };
+ const depth = Array.isArray(j.depth) ? j.depth.filter((d): d is string => typeof d === "string") : [];
+ const vram = typeof j.vram_gb === "number" ? ` · ${Math.round(j.vram_gb)} GB` : "";
+ return { ok: true, detail: `WorldCast worker${j.model ? ` · ${j.model}` : ""}${vram}`, ...(j.model && { model: j.model }), ...(typeof j.vram_gb === "number" && { vramGb: j.vram_gb }), depth };
+ } catch (e) {
+ return { ok: false, detail: (e as Error).message };
+ }
+}
+
+declare global {
+ var __fuobeWorldcast: { base: string; at: number; ok: boolean; depth?: string[]; pending?: Promise<boolean> } | undefined;
+}
+
+/** Ask the worker now (or reuse an answer under a minute old for the same address). */
+export async function refreshWorldcast(force = false): Promise<boolean> {
+ const base = worldcastBase();
+ const cur = globalThis.__fuobeWorldcast;
+ if (!base) return false;
+ if (!force && cur?.base === base && Date.now() - cur.at < HEALTH_TTL_MS) return cur.ok;
+ if (cur?.base === base && cur.pending) return cur.pending;
+ const pending = worldcastHealth().then((h) => {
+ globalThis.__fuobeWorldcast = { base, at: Date.now(), ok: h.ok, depth: h.depth ?? [] };
+ return h.ok;
+ });
+ globalThis.__fuobeWorldcast = { base, at: cur?.base === base ? cur.at : 0, ok: cur?.base === base ? cur.ok : false, pending };
+ return pending;
+}
+
+/**
+ * Does the worker answer, as last seen (the planners are synchronous)? A stale answer starts a fresh look in the
+ * background. Never for an account: the worker is the studio's own.
+ */
+export function worldcastAnswers(): boolean {
+ if (tenantAccount()) return false;
+ const base = worldcastBase();
+ if (!base) return false;
+ const cur = globalThis.__fuobeWorldcast;
+ if (cur?.base !== base || Date.now() - cur.at >= HEALTH_TTL_MS) void refreshWorldcast().catch(() => false);
+ return cur?.base === base && cur.ok;
+}
+
+/** The extra depth models the worker said it has ("depth-pro", "vggt-omega"), as last seen. */
+export function worldcastDepths(): string[] {
+ const cur = globalThis.__fuobeWorldcast;
+ return cur?.base === worldcastBase() && cur.ok ? (cur.depth ?? []) : [];
+}
+
+/** POST /cases: the case as multipart; the job id. */
+export async function submitCase(parts: CasePart[]): Promise<string> {
+ const form = new FormData();
+ for (const p of parts) {
+ if ("value" in p) form.append(p.name, p.value);
+ else form.append(p.name, new Blob([new Uint8Array(p.data)], { type: p.contentType }), p.filename);
+ }
+ const res = await call("/cases", { method: "POST", body: form }, 5 * 60_000);
+ if (!res.ok) throw await failure("the case", res);
+ const j = (await res.json().catch(() => ({}))) as { id?: unknown };
+ if (typeof j.id !== "string" || !JOB_ID.test(j.id)) throw new ProviderError("The WorldCast worker didn't answer with a job id");
+ return j.id;
+}
+
+export type WorldcastJob =
+ | { status: "queued" | "running"; progress?: number; message?: string }
+ | { status: "succeeded" }
+ | { status: "failed"; error: string };
+
+/** GET /jobs/{id}. */
+export async function jobStatus(id: string): Promise<WorldcastJob> {
+ if (!JOB_ID.test(id)) throw new ProviderError("That isn't a WorldCast job");
+ const res = await call(`/jobs/${id}`);
+ if (res.status === 404) return { status: "failed", error: "The WorldCast worker no longer has this job (was it restarted?). Run it again" };
+ if (!res.ok) throw await failure("a status check", res);
+ const j = (await res.json()) as { status?: unknown; progress?: unknown; message?: unknown; error?: unknown };
+ const progress = typeof j.progress === "number" && Number.isFinite(j.progress) ? Math.max(0, Math.min(1, j.progress)) : undefined;
+ const message = typeof j.message === "string" ? j.message.slice(0, 200) : undefined;
+ switch (j.status) {
+ case "queued":
+ case "running":
+ return { status: j.status, ...(progress !== undefined && { progress }), ...(message && { message }) };
+ case "succeeded":
+ return { status: "succeeded" };
+ case "failed":
+ return { status: "failed", error: typeof j.error === "string" && j.error ? `WorldCast: ${j.error.slice(0, 300)}` : "WorldCast stopped without saying why" };
+ default:
+ throw new ProviderError("The WorldCast worker answered a status Fuobe doesn't know");
+ }
+}
+
+/** The finished clip's address (GET /jobs/{id}/video). */
+export function jobVideoUrl(id: string): string {
+ if (!JOB_ID.test(id)) throw new ProviderError("That isn't a WorldCast job");
+ return `${worldcastBase()}/jobs/${id}/video`;
+}
+
+/** GET /jobs/{id}/video: the MP4. */
+export async function jobVideo(id: string): Promise<Buffer> {
+ if (!JOB_ID.test(id)) throw new ProviderError("That isn't a WorldCast job");
+ const res = await call(`/jobs/${id}/video`, {}, 5 * 60_000);
+ if (!res.ok) throw await failure("the video", res);
+ return Buffer.from(await res.arrayBuffer());
+}
+
+/** DELETE /jobs/{id}: stop it (a job that is gone already counts as stopped). */
+export async function cancelJob(id: string): Promise<void> {
+ if (!JOB_ID.test(id)) return;
+ const res = await call(`/jobs/${id}`, { method: "DELETE" });
+ if (!res.ok && res.status !== 404) throw await failure("a stop", res);
+}
diff --git a/tests/catalog.test.ts b/tests/catalog.test.ts
index ce7c5ecf..312f2d18 100644
--- a/tests/catalog.test.ts
+++ b/tests/catalog.test.ts
@@ -20,11 +20,11 @@ describe("catalog integrity", () => {
const d = m.defaults ?? {};
if (d.aspectRatio && m.options.aspectRatios) expect(m.options.aspectRatios, `${m.id} aspect`).toContain(d.aspectRatio);
if (d.resolution && m.options.resolutions) expect(m.options.resolutions, `${m.id} resolution`).toContain(d.resolution);
- // ComfyUI, browser-only tools and Ollama-only text steps are the open engine; every API provider is cloud.
+ // ComfyUI, the WorldCast worker, browser-only tools and Ollama-only text steps are the open engine; every API provider is cloud.
// A Fuobe Original runs on both: each engine it lists has routes, and every route is on one of them.
const engines = m.engines ?? [m.engine];
for (const r of m.routes) {
- const open = r.provider === "comfyui" || r.provider === "local" || (r.provider === "llm" && r.endpoint === "ollama");
+ const open = r.provider === "comfyui" || r.provider === "worldcast" || r.provider === "local" || (r.provider === "llm" && r.endpoint === "ollama");
expect(engines, `${m.id} engine/provider`).toContain(open ? "open" : "cloud");
}
if (m.engines) {
diff --git a/tests/worldcast-plan.test.ts b/tests/worldcast-plan.test.ts
new file mode 100644
index 00000000..88b9a8e7
--- /dev/null
+++ b/tests/worldcast-plan.test.ts
@@ -0,0 +1,179 @@
+import { spawnSync } from "node:child_process";
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { afterAll, describe, expect, it } from "vitest";
+
+/**
+ * WorldCast behind the camera-path buttons (build plan N7-9): the steps of a run, the buttons preferring it when the
+ * worker answers and saying what they film on when it doesn't, the ModelDef's visibility, and the server's case.
+ */
+
+const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-worldcast-plan-"));
+process.env.FUOBE_DATA_DIR = dir;
+afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
+
+const { getModel, MODELS } = await import("@/lib/catalog");
+const { providerEngine } = await import("@/lib/catalog/engines");
+const { planFlyAround } = await import("@/lib/catalog/fly-around");
+const { planTurnaround } = await import("@/lib/catalog/turnaround");
+const { planCinema } = await import("@/lib/catalog/cinema");
+const { WORLDCAST_MODELS, worldcastFallback, worldcastSteps } = await import("@/lib/catalog/worldcast-plan");
+const { imageSlots, readLayout, worldcastLayout } = await import("@/lib/worldcast");
+const { modelLicence } = await import("@/server/model-access");
+
+const image = "/api/files/uploads/still.png";
+const V = { front: "/api/files/uploads/front.png", right: "/api/files/uploads/right.png", back: "/api/files/uploads/back.png", left: "/api/files/uploads/left.png" };
+const FALLBACK = "Runs on Uni3C: add a WorldCast worker (48 GB+) for sides that match your photos";
+
+describe("a WorldCast run's steps", () => {
+ it("measures the depth, masks the still and every view, then films with every picture in its slot", () => {
+ const steps = worldcastSteps({ feature: "fly-around", still: { url: V.front }, anchors: [{ side: "back", src: { url: V.back } }, { side: "front", src: { url: V.front } }], keys: [{ t: 0, azimuth: 0, elevation: 0, distance: 1 }, { t: 1, azimuth: -360, elevation: 0, distance: 1 }] });
+ expect(steps.map((s) => [s.key, s.request.modelId, s.request.op])).toEqual([
+ ["depth", "oss-scene-moge", "scene-3d"],
+ ["mask-still", "oss-person-mask", "bg-remove"],
+ ["mask-front", "oss-person-mask", "bg-remove"],
+ ["mask-back", "oss-person-mask", "bg-remove"],
+ ["main", "oss-worldcast", "camera-path"],
+ ]);
+ const main = steps.at(-1)!;
+ const layout = readLayout(main.request.params?.extra?.worldcast);
+ expect(layout.anchors.map((a) => a.view)).toEqual(["front", "back"]);
+ const slots = imageSlots(layout);
+ // The files first, in slot order; the masks and the depth come from the steps, each at its place.
+ expect(main.request.inputs?.images).toEqual([V.front, V.front, V.back]);
+ expect(main.request.chain).toEqual([
+ { slot: "images", at: slots.stillMask },
+ { slot: "images", at: slots.anchorMask(0) },
+ { slot: "images", at: slots.anchorMask(1) },
+ { slot: "images", at: slots.depth },
+ ]);
+ expect(main.after).toEqual(["mask-still", "mask-front", "mask-back", "depth"]);
+ expect(main.request.params).toMatchObject({ aspectRatio: "9:16", extra: { worldcast: worldcastLayout(["front", "back"]) } });
+ expect(steps.map((s) => s.request.step?.index)).toEqual([0, 1, 2, 3, 4]);
+ });
+
+ it("takes the paper's depth model when asked, and a still an earlier step makes", () => {
+ const steps = worldcastSteps({ feature: "t", still: { key: "front" }, anchors: [{ side: "front", src: { key: "front" } }], keys: [], depth: "depth-pro" });
+ expect(steps[0]).toMatchObject({ key: "depth", request: { modelId: "oss-depth-pro", op: "edit", chain: [{ slot: "images" }] }, after: ["front"] });
+ const main = steps.at(-1)!;
+ expect(main.request.inputs).toBeUndefined();
+ expect(main.after).toEqual(["front", "front", "mask-still", "mask-front", "depth"]);
+ });
+});
+
+describe("the buttons prefer WorldCast when the worker answers", () => {
+ const orbit = { degrees: 360, direction: "cw" as const, tilt: 0, pulse: 0 };
+ it("Fly around / exact orbits: WorldCast with a worker, Uni3C and the line without one", () => {
+ const on = planFlyAround({ engine: "open", image, orbit, sides: { back: V.back } }, { worldcast: true });
+ expect(on.model.id).toBe("oss-worldcast");
+ expect(on.duration).toBe(5.4);
+ expect(on.costUsd).toBe(0);
+ expect(on.blocker).toBeUndefined();
+ expect(on.steps.map((s) => s.key)).toEqual(["depth", "mask-still", "mask-back", "main"]);
+ expect(on.notes[0]).toMatch(/the back and sides follow your 1 view/);
+ expect(on.notes.join(" ")).toMatch(/RIFE/);
+
+ const off = planFlyAround({ engine: "open", image, orbit }, { worldcast: false });
+ expect(off.model.id).toBe("oss-uni3c-path");
+ expect(off.notes).toContain(FALLBACK);
+ // Nothing said where nobody can add a worker (a visitor, or WorldCast switched off), nor on the cloud.
+ expect(planFlyAround({ engine: "open", image, orbit }).notes).not.toContain(FALLBACK);
+ expect(planFlyAround({ engine: "cloud", image, orbit }, { worldcast: true }).model.id).toBe("minimax-h3-max-camera");
+ });
+
+ it("Turnaround: WorldCast is the GPU's default with a worker, with the front as the first frame and every view an anchor", () => {
+ const on = planTurnaround({ engine: "open", views: V }, { worldcast: true });
+ expect(on.routes).toEqual(["worldcast", "frames", "stills"]);
+ expect(on.route).toBe("worldcast");
+ expect(on.model.id).toBe(WORLDCAST_MODELS.film);
+ expect(on.fills).toEqual([]);
+ const main = on.steps.at(-1)!;
+ expect(main.key).toBe("main");
+ expect(main.request.inputs?.images?.[0]).toBe(V.front);
+ // The person's right side is WorldCast's left_side (where the camera stands).
+ expect(readLayout(main.request.params?.extra?.worldcast).anchors.map((a) => [a.side, a.view])).toEqual([
+ ["front", "front"],
+ ["right", "left_side"],
+ ["left", "right_side"],
+ ["back", "back"],
+ ]);
+ expect(on.steps.map((s) => s.request.step?.index)).toEqual(on.steps.map((_, i) => i));
+
+ const off = planTurnaround({ engine: "open", views: V }, { worldcast: false });
+ expect(off.routes).toEqual(["frames", "stills"]);
+ expect(off.route).toBe("frames");
+ expect(off.notes).toContain(worldcastFallback("Frames"));
+ expect(planTurnaround({ engine: "open", views: V }).notes).not.toContain(worldcastFallback("Frames"));
+ });
+
+ it("Cinema's Fly path: WorldCast needs no browser render; without a worker the Uni3C line is said", () => {
+ const input = {
+ engine: "open" as const,
+ mode: "video" as const,
+ action: "path" as const,
+ prompt: "",
+ settings: {},
+ source: { url: image, kind: "image" as const },
+ path: { keys: [{ t: 0, azimuth: 0, elevation: 0, distance: 1 }, { t: 1, azimuth: 90, elevation: 0, distance: 1 }], duration: 5 },
+ };
+ const on = planCinema(input, { worldcast: true });
+ expect(on.model.id).toBe("oss-worldcast");
+ expect(on.blocker).toBeUndefined();
+ expect(on.steps.at(-1)?.request.feature).toBe("cinema-path");
+ const off = planCinema({ ...input, path: { ...input.path, render: "/api/files/uploads/r.webm" } }, { worldcast: false });
+ expect(off.model.id).toBe("oss-uni3c-path");
+ expect(off.notes).toContain(FALLBACK);
+ });
+});
+
+describe("the WorldCast models", () => {
+ it("are open-engine models kept out of the pickers, with their licences recorded as information", () => {
+ for (const id of ["oss-worldcast", "oss-depth-pro", "oss-vggt-omega", "oss-person-mask"]) {
+ const m = getModel(id)!;
+ expect(m.engine).toBe("open");
+ expect(m.hidden).toBe(true);
+ expect(MODELS.some((x) => x.id === id)).toBe(true);
+ for (const r of m.routes) expect(providerEngine(r.provider)).toBe("open");
+ }
+ expect(getModel("oss-worldcast")!.routes[0].provider).toBe("worldcast");
+ const wc = modelLicence(getModel("oss-worldcast")!).licence;
+ expect(wc.class).toBe("commercial");
+ expect(wc.note).toMatch(/SpatialVID.*academic research/);
+ expect(modelLicence(getModel("oss-depth-pro")!).licence.class).toBe("non-commercial");
+ expect(modelLicence(getModel("oss-vggt-omega")!).licence.note).toMatch(/FAIR Noncommercial/);
+ expect(modelLicence(getModel("oss-person-mask")!).licence.name).toMatch(/SAM/);
+ });
+});
+
+const ffmpeg = spawnSync("ffmpeg", ["-version"]).status === 0;
+
+describe.skipIf(!ffmpeg)("the server's case", async () => {
+ const sharp = (await import("sharp")).default;
+ const { buildCase } = await import("@/server/worldcast-case");
+ it("crops the still to 480 × 832, renders the path and its holes at 81 frames, and keeps each view whole", async () => {
+ const still = await sharp({ create: { width: 320, height: 240, channels: 3, background: "#2050a0" } }).png().toBuffer();
+ const mask = await sharp({ create: { width: 320, height: 240, channels: 3, background: "#000" } })
+ .composite([{ input: await sharp({ create: { width: 60, height: 160, channels: 3, background: "#fff" } }).png().toBuffer(), left: 130, top: 40 }])
+ .png()
+ .toBuffer();
+ const depth = await sharp({ create: { width: 160, height: 120, channels: 3, background: "#808080" } }).png().toBuffer();
+ const view = await sharp({ create: { width: 200, height: 300, channels: 3, background: "#a03020" } }).png().toBuffer();
+ const layout = worldcastLayout(["back"]);
+ const keys = [{ t: 0, azimuth: 0, elevation: 0, distance: 1 }, { t: 1, azimuth: -90, elevation: 0, distance: 1 }];
+ const { parts } = await buildCase({ layout, images: [still, view, mask, mask, depth], keys, prompt: "", seed: 5 });
+ const file = (n: string) => (parts.find((p) => p.name === n) as { data: Uint8Array }).data;
+ expect(await sharp(file("first_frame.png")).metadata()).toMatchObject({ width: 480, height: 832 });
+ const m = await sharp(file("person_mask.png")).raw().toBuffer({ resolveWithObject: true });
+ expect(new Set(m.data)).toEqual(new Set([0, 255]));
+ expect(await sharp(file("anchor_back.png")).metadata()).toMatchObject({ width: 200, height: 300 });
+ const cam = JSON.parse(new TextDecoder().decode(file("cam_info.json")));
+ expect(cam.extrinsic).toHaveLength(81);
+ for (const name of ["render.mp4", "render_mask.mp4"]) {
+ const f = path.join(dir, name);
+ fs.writeFileSync(f, file(name));
+ const probe = spawnSync("ffprobe", ["-v", "error", "-count_frames", "-select_streams", "v:0", "-show_entries", "stream=width,height,nb_read_frames,r_frame_rate", "-of", "csv=p=0", f], { encoding: "utf8" });
+ expect(probe.stdout.trim()).toBe("480,832,15/1,81");
+ }
+ }, 60_000);
+});
diff --git a/tests/worldcast-worker.test.ts b/tests/worldcast-worker.test.ts
new file mode 100644
index 00000000..7481f6fc
--- /dev/null
+++ b/tests/worldcast-worker.test.ts
@@ -0,0 +1,175 @@
+import fs from "node:fs";
+import http from "node:http";
+import os from "node:os";
+import path from "node:path";
+import { afterAll, beforeEach, describe, expect, it } from "vitest";
+
+// The WorldCast worker's client (docs/workers/worldcast.md) against a stand-in worker: submit, poll, download, errors.
+const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-worldcast-"));
+process.env.FUOBE_DATA_DIR = dir;
+
+type Job = { status: string; progress?: number; error?: string };
+const state: { jobs: Map<string, Job>; health: unknown; healthStatus: number; caseStatus: number; fields: string[]; files: string[]; canceled: string[] } = {
+ jobs: new Map(),
+ health: { ok: true, model: "PixCtrol/WorldCast@7ccf2e0", vram_gb: 80, depth: ["depth-pro"] },
+ healthStatus: 200,
+ caseStatus: 200,
+ fields: [],
+ files: [],
+ canceled: [],
+};
+const VIDEO = Buffer.from("fake mp4 bytes");
+
+const server = http.createServer((req, res) => {
+ const send = (status: number, body: unknown) => {
+ res.writeHead(status, { "content-type": "application/json" });
+ res.end(JSON.stringify(body));
+ };
+ const url = req.url ?? "";
+ if (req.method === "GET" && url === "/health") return send(state.healthStatus, state.health);
+ if (req.method === "POST" && url === "/cases") {
+ const chunks: Buffer[] = [];
+ req.on("data", (c: Buffer) => chunks.push(c));
+ req.on("end", () => {
+ const text = Buffer.concat(chunks).toString("latin1");
+ state.fields = [...text.matchAll(/name="([^"]+)"(?!; filename)/g)].map((m) => m[1]).filter((n, i, a) => a.indexOf(n) === i);
+ state.files = [...text.matchAll(/name="([^"]+)"; filename="([^"]+)"/g)].map((m) => m[2]);
+ if (state.caseStatus !== 200) return send(state.caseStatus, { error: "render_mask.mp4 has 40 frames, but nframe=81" });
+ state.jobs.set("job1", { status: "queued" });
+ send(200, { id: "job1" });
+ });
+ return;
+ }
+ const m = /^\/jobs\/([^/]+)(\/video)?$/.exec(url);
+ if (m) {
+ const job = state.jobs.get(m[1]);
+ if (req.method === "DELETE") {
+ state.canceled.push(m[1]);
+ return job ? send(200, { ok: true }) : send(404, { error: "no such job" });
+ }
+ if (!job) return send(404, { error: "no such job" });
+ if (m[2]) {
+ res.writeHead(200, { "content-type": "video/mp4" });
+ return res.end(VIDEO);
+ }
+ return send(200, job);
+ }
+ send(404, { error: "not found" });
+});
+await new Promise<void>((r) => server.listen(0, "127.0.0.1", () => r()));
+const port = (server.address() as { port: number }).port;
+process.env.WORLDCAST_URL = `http://127.0.0.1:${port}/`;
+
+const wc = await import("@/server/worldcast");
+const { worldcastProvider } = await import("@/server/providers/worldcast");
+const { runAsTenant } = await import("@/server/tenant");
+const { caseParts, worldcastLayout } = await import("@/lib/worldcast");
+const { framePoses, presetKeys } = await import("@/lib/camera-path");
+
+afterAll(async () => {
+ await new Promise<void>((r) => server.close(() => r()));
+ delete process.env.WORLDCAST_URL;
+ fs.rmSync(dir, { recursive: true, force: true });
+});
+
+beforeEach(() => {
+ state.jobs.clear();
+ state.healthStatus = 200;
+ state.caseStatus = 200;
+ state.health = { ok: true, model: "PixCtrol/WorldCast@7ccf2e0", vram_gb: 80, depth: ["depth-pro"] };
+ globalThis.__fuobeWorldcast = undefined;
+});
+
+const parts = () => {
+ const path81 = framePoses(presetKeys("orbit_360_cw")!, 81, 2, 40, { width: 480, height: 832 });
+ const b = new Uint8Array([1, 2, 3]);
+ return caseParts(worldcastLayout(["front", "back"]), path81, { firstFrame: b, personMask: b, render: b, renderMask: b, anchors: [{ image: b, mask: b }, { image: b, mask: b }] }, { prompt: "walks", seed: 3, pivotDepth: 2 });
+};
+
+describe("the WorldCast worker's client", () => {
+ it("reads the worker's health, and remembers it for the planners", async () => {
+ expect(wc.worldcastBase()).toBe(`http://127.0.0.1:${port}`);
+ const h = await wc.worldcastHealth();
+ expect(h).toMatchObject({ ok: true, vramGb: 80, depth: ["depth-pro"] });
+ expect(h.detail).toContain("WorldCast worker");
+ expect(wc.worldcastAnswers()).toBe(false); // nothing seen yet: a look starts in the background
+ expect(await wc.refreshWorldcast(true)).toBe(true);
+ expect(wc.worldcastAnswers()).toBe(true);
+ expect(wc.worldcastDepths()).toEqual(["depth-pro"]);
+ // Never for an account: the worker is the studio's own.
+ expect(runAsTenant({ kind: "account", id: "a1" }, () => wc.worldcastAnswers())).toBe(false);
+ });
+
+ it("says when the worker is loading or failing", async () => {
+ state.health = { ok: false };
+ expect((await wc.worldcastHealth()).ok).toBe(false);
+ state.healthStatus = 502;
+ state.health = { error: "bad gateway" };
+ const h = await wc.worldcastHealth();
+ expect(h.ok).toBe(false);
+ expect(h.detail).toMatch(/HTTP 502.*bad gateway/);
+ expect(await wc.refreshWorldcast(true)).toBe(false);
+ });
+
+ it("sends a case as one multipart, and gets a job id", async () => {
+ expect(await wc.submitCase(parts())).toBe("job1");
+ expect(state.files).toEqual([
+ "first_frame.png",
+ "person_mask.png",
+ "render.mp4",
+ "render_mask.mp4",
+ "cam_info.json",
+ "anchor_front.png",
+ "anchor_front_mask.png",
+ "anchor_back.png",
+ "anchor_back_mask.png",
+ "anchors_aligned_camera_info.json",
+ ]);
+ expect(state.fields).toEqual(expect.arrayContaining(["anchors", "prompt", "seed", "steps", "cfg", "shift", "height", "width"]));
+ });
+
+ it("passes the worker's own error on", async () => {
+ state.caseStatus = 422;
+ await expect(wc.submitCase(parts())).rejects.toThrow(/HTTP 422 to the case: render_mask\.mp4 has 40 frames/);
+ });
+
+ it("polls a job, then downloads its clip", async () => {
+ state.jobs.set("job1", { status: "running", progress: 0.42 });
+ expect(await wc.jobStatus("job1")).toEqual({ status: "running", progress: 0.42 });
+ state.jobs.set("job1", { status: "failed", error: "CUDA out of memory" });
+ expect(await wc.jobStatus("job1")).toEqual({ status: "failed", error: "WorldCast: CUDA out of memory" });
+ state.jobs.set("job1", { status: "succeeded" });
+ expect(await wc.jobStatus("job1")).toEqual({ status: "succeeded" });
+ expect((await wc.jobVideo("job1")).equals(VIDEO)).toBe(true);
+ expect(await wc.jobStatus("gone")).toMatchObject({ status: "failed", error: expect.stringMatching(/no longer has this job/) });
+ state.jobs.set("odd", { status: "dancing" });
+ await expect(wc.jobStatus("odd")).rejects.toThrow(/status Fuobe doesn't know/);
+ await expect(wc.jobStatus("../etc")).rejects.toThrow(/isn't a WorldCast job/);
+ });
+
+ it("runs as a provider: a poll hands the clip's address on, a cancel stops the job", async () => {
+ state.jobs.set("job1", { status: "running", progress: 0.5 });
+ const ctx = { externalId: "job1", meta: {}, route: { op: "camera-path", provider: "worldcast", endpoint: "cases" }, model: {} as never, createdAt: 0 } as const;
+ expect(await worldcastProvider.poll(ctx as never)).toMatchObject({ state: "running", progress: 0.5 });
+ state.jobs.set("job1", { status: "succeeded" });
+ expect(await worldcastProvider.poll(ctx as never)).toEqual({
+ state: "succeeded",
+ outputs: [{ url: `http://127.0.0.1:${port}/jobs/job1/video`, kind: "video", contentType: "video/mp4", meta: { fps: 15 } }],
+ });
+ await worldcastProvider.cancel!(ctx as never);
+ expect(state.canceled).toContain("job1");
+ expect(worldcastProvider.isConfigured()).toBe(true);
+ expect(await worldcastProvider.prepareFile(Buffer.from("x"), "image/png", "a.png")).toBe("data:image/png;base64,eA==");
+ });
+
+ it("refuses an account's run, and says where to set the worker when none answers", async () => {
+ await expect(runAsTenant({ kind: "account", id: "a1" }, () => wc.submitCase(parts()))).rejects.toThrow(/studio's own GPU only/);
+ const saved = process.env.WORLDCAST_URL;
+ process.env.WORLDCAST_URL = "http://127.0.0.1:9";
+ try {
+ await expect(wc.jobStatus("job1")).rejects.toThrow(/doesn't answer.*Settings → Open-source engine/);
+ } finally {
+ process.env.WORLDCAST_URL = saved;
+ }
+ });
+});
diff --git a/workflows/comfyui/image-person-mask-sam3.json b/workflows/comfyui/image-person-mask-sam3.json
new file mode 100644
index 00000000..4a58b62c
--- /dev/null
+++ b/workflows/comfyui/image-person-mask-sam3.json
@@ -0,0 +1,81 @@
+{
+ "1": {
+ "class_type": "LoadImage",
+ "inputs": {
+ "image": "example.png"
+ },
+ "_meta": {
+ "title": "Picture"
+ }
+ },
+ "2": {
+ "class_type": "CheckpointLoaderSimple",
+ "inputs": {
+ "ckpt_name": "sam3.1_multiplex_fp16.safetensors"
+ },
+ "_meta": {
+ "title": "SAM 3.1"
+ }
+ },
+ "3": {
+ "class_type": "CLIPTextEncode",
+ "inputs": {
+ "text": "person",
+ "clip": [
+ "2",
+ 1
+ ]
+ },
+ "_meta": {
+ "title": "Who to find (text)"
+ }
+ },
+ "4": {
+ "class_type": "SAM3_Detect",
+ "inputs": {
+ "model": [
+ "2",
+ 0
+ ],
+ "image": [
+ "1",
+ 0
+ ],
+ "conditioning": [
+ "3",
+ 0
+ ],
+ "threshold": 0.4,
+ "refine_iterations": 2,
+ "individual_masks": false
+ },
+ "_meta": {
+ "title": "SAM 3.1: the person, one mask"
+ }
+ },
+ "5": {
+ "class_type": "MaskToImage",
+ "inputs": {
+ "mask": [
+ "4",
+ 0
+ ]
+ },
+ "_meta": {
+ "title": "Mask as a picture (white = the person)"
+ }
+ },
+ "6": {
+ "class_type": "SaveImage",
+ "inputs": {
+ "images": [
+ "5",
+ 0
+ ],
+ "filename_prefix": "fuobe/image-person-mask-sam3"
+ },
+ "_meta": {
+ "title": "Save"
+ }
+ }
+}
diff --git a/workflows/comfyui/manifest.json b/workflows/comfyui/manifest.json
index e4cffdd4..452e8ad3 100644
--- a/workflows/comfyui/manifest.json
+++ b/workflows/comfyui/manifest.json
@@ -1,6 +1,6 @@
{
"version": 1,
- "generatedAt": "2026-11-02T01:24:28.192Z",
+ "generatedAt": "2026-11-02T21:02:53.599Z",
"comfyuiCommit": "fc04da91b2ab12f99e4716371a7e4f98ac982597",
"comfyuiVersion": "0.41.0",
"workflowTemplatesVersion": "0.11.86",
@@ -10740,6 +10740,65 @@
"validated": true,
"notes": "Fuobe Soul's PixeletedFace look: SAM3_Detect with the words (prompt, \"face\" by default: every face, one merged mask, threshold 0.4), GrowMask 12 px so the hair line and jaw are covered, then the picture shrunk by mosaicScale with area averaging (0.04: blocks of 25 px) and blown back up with nearest-exact to its own size, composited only under the mask (ImageCompositeMasked). No face found: the picture comes back unchanged. Core nodes and the SAM 3.1 checkpoint only."
},
+ {
+ "id": "image-person-mask-sam3",
+ "title": "Person mask (SAM 3.1, core nodes)",
+ "capability": "bg-remove",
+ "file": "image-person-mask-sam3.json",
+ "source": "hand-built (scripts/comfy/hand-built/image-person-mask-sam3.json)",
+ "bindings": {
+ "image": [
+ {
+ "node": "1",
+ "input": "image"
+ }
+ ],
+ "prompt": [
+ {
+ "node": "3",
+ "input": "text"
+ }
+ ],
+ "threshold": [
+ {
+ "node": "4",
+ "input": "threshold"
+ }
+ ],
+ "filenamePrefix": [
+ {
+ "node": "6",
+ "input": "filename_prefix"
+ }
+ ]
+ },
+ "outputs": [
+ {
+ "node": "6",
+ "kind": "image"
+ }
+ ],
+ "defaults": {
+ "threshold": 0.4
+ },
+ "limits": {
+ "maxWidth": 4096,
+ "maxHeight": 4096
+ },
+ "models": [
+ {
+ "file": "sam3.1_multiplex_fp16.safetensors",
+ "folder": "checkpoints",
+ "url": "https://huggingface.co/Comfy-Org/sam3.1/resolve/7bb8374780a725b4353ed31f3a9395c9742b5621/checkpoints/sam3.1_multiplex_fp16.safetensors",
+ "sizeGb": 1.75
+ }
+ ],
+ "customNodes": [],
+ "vramGb": 4,
+ "license": "Meta SAM License (SAM 3.1: royalty-free, commercial use allowed; attribution + acceptable-use terms)",
+ "validated": true,
+ "notes": "WorldCast cases (N7-9): the person in the still and in each view as a mask, white where they are, the size of the picture. SAM3_Detect with the words (prompt, \"person\" by default; threshold 0.4, every match merged into one mask) then MaskToImage. The WorldCast worker cuts its tight no_padding_black crops from it. Core nodes and the SAM 3.1 checkpoint only."
+ },
{
"id": "palette-transfer-image",
"title": "Palette Lock (ColorTransfer to a swatch)",
diff --git a/workflows/comfyui/requirements.json b/workflows/comfyui/requirements.json
index 9e92f443..39822b37 100644
--- a/workflows/comfyui/requirements.json
+++ b/workflows/comfyui/requirements.json
@@ -1,6 +1,6 @@
{
"v": 1,
- "hash": "c3048d6ac483bc5ecfd763f654ac10b9bbb2601bd11bdf23a9f509b9c7bd410c",
+ "hash": "a52e1c125f15e9b7305e6d34e3b053507cfebb93b924ca6a4505bfaa8208fa91",
"comfyui": {"min":"0.41.0","testedCommit":"fc04da91"},
"folders": ["audio_encoders","background_removal","checkpoints","clip_vision","dbs","diffusion_models","facerestore_models","foley","frame_interpolation","geometry_estimation","insightface","latent_upscale_models","loras","mmaudio","model_patches","optical_flow","reuse","text_encoders","thinksound","upscale_models","vae"],
"sentinels": ["AILab_Qwen3ASRSubtitle","AILab_Qwen3TTSVoiceClone_Advanced","AILab_Qwen3TTSVoiceDesign_Advanced","AUSBOSS_NODES_CropForInpaint","AUSBOSS_NODES_ImageCropRotatePad","AUSBOSS_NODES_StitchInpaint","Add Subtitles To Frames","Apply Whisper","CFGOverride","ClothesSegment","ComfyMathExpression","CropFuobeLive","DBSLoader","DBSSeparate","DownloadAndLoadWav2VecModel","DualModelGuider","FL_ChatterboxDialogTTS","FL_ChatterboxMultilingualTTS","FL_ChatterboxVC","GetImageRangeFromBatch","GetImageSizeAndCount","GrowMaskWithBlur","H3AdaLNLoRAFix","H3CharacterSwapAssemble","H3CharacterSwapController","H3CharacterSwapExpandMask","H3CharacterSwapModels","H3CharacterSwapPrepareVideo","H3CharacterSwapRecoverMasks","H3CharacterSwapSelectSubject","H3CharacterSwapSettings","H3CharacterSwapShot","H3CharacterSwapWindowPlan","H3RelayAppendWindow","H3RelayApplyEditMask","H3RelayApplyHistory","H3RelayExpandMask","H3RelayFinishWindows","H3RelayPrepareSource","H3RelayRecoverMasks","H3RelayReviewWindows","H3RelaySamplingMemory","H3RelaySelectMask","H3RelayTextMemory","H3RelayWindowInputs","H3RelayWindowPlan","H3SLAAttention","HunyuanDependenciesLoader","HunyuanFoleySampler","HunyuanModelLoader","INTConstant","Ideogram4Scheduler","ImageBatchExtendWithOverlap","ImageGridtoBatch","ImageResizeKJv2","IndexTTS2Simple","Krea2EditGroundedEncode","Krea2EditModelPatch","Krea2OstrisEditModelPatch","LTXAVTextEncoderLoader","LTXAddVideoICLoRAGuide","LTXICLoRALoaderModelOnly","LTXVAddGuide","LTXVAudioVAEDecode","LTXVAudioVAELoader","LTXVConcatAVLatent","LTXVConditioning","LTXVCropGuides","LTXVDualCFGGuider","LTXVEmptyLatentAudio","LTXVImgToVideoInplace","LTXVLatentUpsampler","LTXVPreprocess","LTXVScheduler","LTXVSeparateAVLatent","LTXVTiledFusionSampler","LatentSyncNode","LoadBackgroundRemovalModel","LoadImageFuobeLive","LoadVideoDepthAnythingModel","MMAudioFeatureUtilsLoader","MMAudioModelLoader","MMAudioSampler","MelBandRoFormerModelLoader","MelBandRoFormerSampler","MiniMaxH3TurboLoRA","MiniMaxH3TurboSampler","MultiTalkModelLoader","MultiTalkWav2VecEmbeds","OpenH3RegenFastVAEDecode","OpenH3RegenFinish","OpenH3RegenLora","OpenH3RegenPrepareDraft","OpenH3RegenRefineLatent","OpenH3RegenSigmas","OpenH3RegenUpscale","OpenH3SaveRefinedLatent","PasteBackFuobeLive","Qwen21EncodeFuobeLive","Qwen21ReferenceFuobeLive","QwenImage21Cache","REUSEEnhance","REUSELoader","RIFE VFI","RMBG","ReActorFaceSwap","RemoveBackground","SAM3_Detect","SAM3_TrackToMask","SAM3_VideoTrack","SaveImageFuobeLive","SeedVR2Conditioning","SeedVR2PostProcessing","SeedVR2Preprocess","TS_ImageToSVGStringColor_Vtracer","TS_SVGStringToSVGBytesIO","TextEncodeFibo2","TextEncodeKrea2OstrisEdit","TextEncodeQwenImage21","ThinkSoundFeatureUtilsLoader","ThinkSoundModelLoader","ThinkSoundSampler","Trellis2Conditioning","Trellis2ShapeStage","Trellis2TextureStage","Trellis2UpsampleStage","VHS_BatchManager","VHS_LoadAudioUpload","VHS_LoadVideo","VHS_SelectEveryNthImage","VHS_VideoCombine","VHS_VideoInfo","VHS_VideoInfoLoaded","VideoDepthAnythingOutput","VideoDepthAnythingProcess","VideoLengthAdjuster","VoxCPM2_Clone","VoxCPM2_TTS","WanVideoBlockSwap","WanVideoClipVisionEncode","WanVideoDecode","WanVideoEncode","WanVideoImageToVideoMultiTalk","WanVideoLoraSelect","WanVideoModelLoader","WanVideoPassImagesFromSamples","WanVideoSampler","WanVideoTextEncodeCached","WanVideoVAELoader","ZenImage21AdapterLoader","ZenImage21TextEncode"],
@@ -295,6 +295,7 @@
"hunyuan15-t2v-720p": {"core":["BasicScheduler","CFGGuider","CLIPTextEncode","CreateVideo","DualCLIPLoader","EmptyHunyuanVideo15Latent","KSamplerSelect","ModelSamplingSD3","RandomNoise","SamplerCustomAdvanced","SaveVideo","UNETLoader","VAEDecode","VAELoader"],"packs":{},"files":["diffusion_models/hunyuanvideo1.5_720p_t2v_fp16.safetensors","text_encoders/byt5_small_glyphxl_fp16.safetensors","text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors","vae/hunyuanvideo15_vae_fp16.safetensors"],"optional":[],"vramGb":24,"isolated":false,"firstRun":[],"validated":true},
"ideogram4-t2i": {"core":["CFGOverride","CLIPLoader","CLIPTextEncode","ComfyMathExpression","ComfyNumberConvert","ConditioningZeroOut","CustomCombo","DualModelGuider","EmptyFlux2LatentImage","Ideogram4Scheduler","JsonExtractString","KSamplerSelect","PrimitiveInt","RandomNoise","SamplerCustomAdvanced","SaveImage","StringReplace","UNETLoader","VAEDecode","VAELoader"],"packs":{},"files":["diffusion_models/ideogram4_int8_convrot.safetensors","diffusion_models/ideogram4_unconditional_int8_convrot.safetensors","text_encoders/qwen3vl_8b_fp8_scaled.safetensors","vae/flux2-vae.safetensors"],"optional":[],"vramGb":24,"isolated":false,"firstRun":[]},
"image-face-mosaic-sam3": {"core":["CLIPTextEncode","CheckpointLoaderSimple","GetImageSize","GrowMask","ImageCompositeMasked","ImageScale","ImageScaleBy","LoadImage","SAM3_Detect","SaveImage"],"packs":{},"files":["checkpoints/sam3.1_multiplex_fp16.safetensors"],"optional":[],"vramGb":4,"isolated":false,"firstRun":[],"validated":true},
+ "image-person-mask-sam3": {"core":["CLIPTextEncode","CheckpointLoaderSimple","LoadImage","MaskToImage","SAM3_Detect","SaveImage"],"packs":{},"files":["checkpoints/sam3.1_multiplex_fp16.safetensors"],"optional":[],"vramGb":4,"isolated":false,"firstRun":[],"validated":true},
"image-to-3d-hunyuan3d-21": {"core":["CLIPVisionEncode","EmptyLatentHunyuan3Dv2","Hunyuan3Dv2Conditioning","ImageOnlyCheckpointLoader","KSampler","LoadImage","ModelSamplingAuraFlow","SaveGLB","VAEDecodeHunyuan3D","VoxelToMesh"],"packs":{},"files":["checkpoints/hunyuan_3d_v2.1.safetensors"],"optional":[],"vramGb":10,"isolated":false,"firstRun":[],"validated":true},
"image-to-3d-pixal3d": {"core":["ApplyTextureToMesh","BakeAmbientOcclusion","BakeNormalMapFromMesh","BakeTextureFromVoxel","CFGOverride","CLIPVisionLoader","DecimateMesh","EmptyTrellis2LatentStructure","GetMeshInfo","ImageCropToMask","KSampler","LoadBackgroundRemovalModel","LoadImage","LoadMoGeModel","MeshSmoothNormals","MeshToFile3D","MoGeGeometryToFOV","MoGeInference","ModelSamplingSD3","Pixal3DConditioning","PrimitiveInt","RemeshMesh","RemoveBackground","RescaleCFG","Save3DAdvanced","Trellis2ShapeStage","Trellis2TextureStage","Trellis2UpsampleStage","UNETLoader","UnwrapMesh","VAELoader","VaeDecodeShapeTrellis","VaeDecodeStructureTrellis2","VaeDecodeTextureTrellis"],"packs":{},"files":["background_removal/birefnet.safetensors","clip_vision/dino_v3_L_naf_fp32.safetensors","diffusion_models/pixal3d_int8_convrot.safetensors","geometry_estimation/moge_2_vitl_normal_fp16.safetensors","vae/trellis_2_shape_vae_bf16.safetensors","vae/trellis_2_texture_vae_bf16.safetensors"],"optional":[],"vramGb":16,"isolated":false,"firstRun":[],"validated":true},
"image-to-3d-trellis2": {"core":["ApplyTextureToMesh","BakeAmbientOcclusion","BakeNormalMapFromMesh","BakeTextureFromVoxel","CFGOverride","CLIPVisionLoader","DecimateMesh","EmptyTrellis2LatentStructure","GetMeshInfo","ImageCropToMask","KSampler","LoadBackgroundRemovalModel","LoadImage","MeshSmoothNormals","MeshToFile3D","ModelSamplingSD3","PrimitiveInt","RemeshMesh","RemoveBackground","RescaleCFG","Save3DAdvanced","Trellis2Conditioning","Trellis2ShapeStage","Trellis2TextureStage","Trellis2UpsampleStage","UNETLoader","UnwrapMesh","VAELoader","VaeDecodeShapeTrellis","VaeDecodeStructureTrellis2","VaeDecodeTextureTrellis"],"packs":{},"files":["background_removal/birefnet.safetensors","clip_vision/dino_v3_L_naf_fp32.safetensors","diffusion_models/trellis_2_int8_convrot.safetensors","vae/trellis_2_shape_vae_bf16.safetensors","vae/trellis_2_texture_vae_bf16.safetensors"],"optional":[],"vramGb":16,"isolated":false,"firstRun":[],"validated":true},