The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Exact orbits: the switch in DoP and Cinema, Film it photoreal, Canvas nodes and Assist's fly_around
Claude3ff73cc9f328
diff --git a/src/components/canvas/canvas-context.tsx b/src/components/canvas/canvas-context.tsxindex 40cc8b40..96fb8f29 100644--- a/src/components/canvas/canvas-context.tsx+++ b/src/components/canvas/canvas-context.tsx@@ -2,6 +2,8 @@import {AtSign,+ Orbit,+ Rotate3d,AudioLines,AudioWaveform,Building2,@@ -78,6 +80,9 @@ export const ICONS: Record<string, LucideIcon> = {UserRound,Languages,Table,+ // Camera path and Fly around (N7-7)+ Orbit,+ Rotate3d,// Blockout to filmBox,// Effects 2.0 chains (src/lib/catalog/canvas.ts EFFECT_CHAINS)@@ -107,6 +112,7 @@ export const PORT_COLOR: Record<PortType, string> = {audio: "var(--chart-3)",element: "var(--chart-1)",voice: "var(--chart-3)",+ path: "var(--chart-1)",};export type NodeState = GenerationStatus | "idle";diff --git a/src/components/canvas/nodes.tsx b/src/components/canvas/nodes.tsxindex 69389312..8b0de6e5 100644--- a/src/components/canvas/nodes.tsx+++ b/src/components/canvas/nodes.tsx@@ -74,6 +74,7 @@ import { offered } from "@/lib/model-access";import { dualEngine, onEngine } from "@/lib/catalog/engines";import {CANVAS_TEXT_MAX,+ cameraPathOf,CONCAT_LIMITS,CONCAT_MODELS,CONCAT_RATIOS,@@ -118,6 +119,9 @@ import { keyCombo } from "@/lib/keys";import { cn } from "@/lib/utils";import { responseError, toastError } from "@/lib/refusals";import { BOARD_NODE_TYPES, type BoardType } from "./board";+import { ExactOrbitControls } from "@/components/exact-orbit-controls";+import { PATH_PRESETS } from "@/lib/camera-path";+import { exactDefaults } from "@/lib/exact-orbit";import { NodeIcon, PORT_COLOR, useEditorActions, useEditorGlobals, useEditorSelector, useNodeResults, useNodeView, type EditorSnapshot, type NodeResults } from "./canvas-context";/** A node on the board: a graph node, or a group, comment pin or drawing (./board.tsx). */@@ -1183,6 +1187,46 @@ const PromptNode = memo(function PromptNode({ id, type, data, selected }: NodePr);}, sameNodeProps);+/** "Exact orbit" in the Camera path node's move list: the orbit set by its numbers. */+const EXACT_PICK = "exact";++/** Camera path (N7-7): a preset move, or an exact orbit by its numbers, for Fly around nodes to follow. */+const CameraPathNode = memo(function CameraPathNode({ id, type, data, selected }: NodeProps<FlowNode>) {+ const actions = useEditorActions();+ const { readOnly } = useEditorGlobals();+ const pick = data.orbit ? EXACT_PICK : (data.pathPreset ?? "orbit_360");+ const { keys, label } = cameraPathOf(data.orbit ? { data } : { data: { pathPreset: pick } });+ return (+ <NodeShell id={id} type={type as CanvasNodeType} data={data} selected={!!selected} out="path" width={300}>+ <div className={cn("grid gap-2 p-3", NO_DRAG)}>+ <Select+ value={pick}+ disabled={readOnly}+ onValueChange={(v) => actions.update(id, v === EXACT_PICK ? { orbit: data.orbit ?? exactDefaults("motion-360-orbit"), pathPreset: undefined, keys: undefined } : { pathPreset: v, orbit: undefined, keys: undefined })}+ >+ <SelectTrigger size="sm" className="w-full text-[13px]" aria-label={`Move of ${data.label || "Camera path"}`}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {PATH_PRESETS.map((p) => (+ <SelectItem key={p.id} value={p.id}>+ {p.name}+ </SelectItem>+ ))}+ <SelectItem value={EXACT_PICK}>Exact orbit…</SelectItem>+ </SelectContent>+ </Select>+ {data.orbit ? (+ <ExactOrbitControls compact value={data.orbit} defaults={exactDefaults("motion-360-orbit")} onChange={(orbit) => actions.update(id, orbit ? { orbit } : { orbit: undefined, pathPreset: "orbit_360" })} className="border-0 bg-muted/50 p-2.5" />+ ) : (+ <p className="text-[12px] text-muted-foreground">{PATH_PRESETS.find((p) => p.id === pick)?.description ?? label}</p>+ )}+ <p className="text-[11.5px] text-subtle-foreground">{keys.length} keyframes</p>+ </div>+ </NodeShell>+ );+}, sameNodeProps);+const KIND_OF: Partial<Record<CanvasNodeType, "image" | "video" | "audio">> = { "image-input": "image", "video-input": "video", "audio-input": "audio" };function LibraryGrid({ kind, onPick }: { kind: MediaKind; onPick: (url: string, name?: string) => void }) {@@ -1772,6 +1816,8 @@ export const NODE_TYPES = {translate: GeneratorNode,concat: GeneratorNode,restore: GeneratorNode,+ "fly-around": GeneratorNode,+ "camera-path": CameraPathNode,table: TableNode,output: OutputNode,note: NoteNode,diff --git a/src/components/cinema/draft.ts b/src/components/cinema/draft.tsindex 1df27744..5895f42d 100644--- a/src/components/cinema/draft.ts+++ b/src/components/cinema/draft.ts@@ -1,5 +1,6 @@import { DURATION, type CinemaAction, type CinemaGenerateInput, type CinemaMode, type DirectorSettings, type GridSize, type GridType } from "@/lib/catalog/cinema";import type { Engine, MediaKind } from "@/lib/catalog/types";+import { takesExact, type ExactOrbit } from "@/lib/exact-orbit";/** The prompt bar's state (lifted into the workspace so the AI Director and tiles can fill it). */@@ -35,6 +36,8 @@ export interface CinemaDraft {imageTool: "still" | "grid";prompt: string;moves: string[];+ /** The first move as an exact orbit (N7-7): its numbers while the Exact switch is on. */+ exact?: ExactOrbit | null;refs: RefItem[];/** Model picked per mode and engine ("video:cloud" → "kling-3"). */models: Partial<Record<`${CinemaMode}:${Engine}`, string>>;@@ -92,6 +95,7 @@ export function draftToInput(d: CinemaDraft, engine: Engine, settings: DirectorSmodelId: d.models[`${d.mode}:${engine}`],prompt: d.prompt,moves: d.mode === "video" ? d.moves : undefined,+ ...(d.mode === "video" && d.exact && takesExact(d.moves[0]) && { exact: d.exact }),settings,images: ready.filter((r) => r.kind === "image").map((r) => r.ref),videos: ready.filter((r) => r.kind === "video").map((r) => r.ref),diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsxindex c2ee5186..dd83aefc 100644--- a/src/components/cinema/prompt-bar.tsx+++ b/src/components/cinema/prompt-bar.tsx@@ -70,6 +70,8 @@ import { modKey } from "@/lib/keys";import { cn } from "@/lib/utils";import { toastError } from "@/lib/refusals";import { MoveChips, MovePicker, prefetchMoves } from "./camera-moves";+import { ExactOrbitControls } from "@/components/exact-orbit-controls";+import { exactDefaults, takesExact } from "@/lib/exact-orbit";import { CameraChip, EmotionChip, FilmSetupChip, LightingChip, PaletteChip } from "./director-panel";import { directorPicks, draftToInput, type BarAction, type CinemaDraft, type RefItem } from "./draft";import { useCinemaGenerate } from "./hooks";@@ -681,6 +683,11 @@ export function PromptBar(props: PromptBarProps) {</div>{video && <MoveChips moves={draft.moves} onChange={(moves) => setDraft({ moves })} />}+ {video && action === "generate" && takesExact(draft.moves[0]) && (+ <div className="px-2 pb-1.5">+ <ExactOrbitControls compact engine={engine} value={draft.exact ?? null} defaults={exactDefaults(draft.moves[0])} onChange={(exact) => setDraft({ exact })} />+ </div>+ )}<PromptInput ref={promptRef} value={draft.prompt} onChange={onPrompt} onSubmit={() => void submit()} placeholder={placeholder} elements={elements} />diff --git a/src/components/exact-orbit-controls.tsx b/src/components/exact-orbit-controls.tsxnew file mode 100644index 00000000..41a39d18--- /dev/null+++ b/src/components/exact-orbit-controls.tsx@@ -0,0 +1,119 @@+"use client";++import { useId, type ReactNode } from "react";+import { Label } from "@/components/ui/label";+import { Slider } from "@/components/ui/slider";+import { Switch } from "@/components/ui/switch";+import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";+import { DIRECTION_NAMES, EXACT_LIMITS, exactSummary, normalizeExact, type ExactOrbit } from "@/lib/exact-orbit";+import type { Engine } from "@/lib/catalog/types";+import { cn } from "@/lib/utils";++/** What each engine does with an exact orbit, said under the switch. */+export const EXACT_ENGINE_LINE: Record<Engine, string> = {+ open: "On your GPU: the still's depth is measured and the camera follows your numbers exactly · about 5 s · needs a large GPU",+ cloud: "In the cloud: MiniMax H3 Max follows your numbers as camera keyframes",+};++/**+ * The "Exact" switch on an orbit move (build plan N7-7): off, the move follows its LoRA's or the prompt's idea of an+ * orbit ("Loose"); on, the camera follows the numbers: degrees, direction seen from above, a height tilt and a radius pulse.+ */+export function ExactOrbitControls({+ value,+ defaults,+ onChange,+ engine,+ className,+ compact,+ footer,+}: {+ /** null: the switch is off. */+ value: ExactOrbit | null;+ defaults: ExactOrbit;+ onChange: (v: ExactOrbit | null) => void;+ engine?: Engine;+ className?: string;+ compact?: boolean;+ /** Under the controls while the switch is on: the price, or what is still needed. */+ footer?: ReactNode;+}) {+ const id = useId();+ const on = !!value;+ const o = normalizeExact(value ?? defaults, defaults);+ const set = (patch: Partial<ExactOrbit>) => onChange(normalizeExact({ ...o, ...patch }, defaults));+ return (+ <div className={cn("min-w-0 rounded-xl border bg-card p-3", className)} data-testid="exact-orbit">+ <div className="flex items-center justify-between gap-3">+ <div className="min-w-0">+ <Label htmlFor={`${id}-switch`} className="text-[13px] font-medium">+ Exact orbit+ </Label>+ <p className="truncate text-[12px] text-muted-foreground">{on ? exactSummary(o) : "Off: the move keeps its own style of orbit"}</p>+ </div>+ <Switch id={`${id}-switch`} checked={on} onCheckedChange={(c) => onChange(c ? o : null)} aria-label="Exact orbit" />+ </div>+ {on && (+ <div className={cn("mt-3 grid gap-3", !compact && "sm:grid-cols-2")}>+ <div className="min-w-0">+ <div className="mb-1.5 flex justify-between text-[12px]">+ <span id={`${id}-deg`}>Degrees</span>+ <span className="text-muted-foreground tabular-nums">{o.degrees}°</span>+ </div>+ <Slider+ aria-labelledby={`${id}-deg`}+ aria-valuetext={`${o.degrees} degrees`}+ min={EXACT_LIMITS.degrees.min}+ max={EXACT_LIMITS.degrees.max}+ step={EXACT_LIMITS.degrees.step}+ value={[o.degrees]}+ onValueChange={([v]) => set({ degrees: v })}+ />+ </div>+ <div className="min-w-0">+ <div className="mb-1.5 flex justify-between text-[12px]">+ <span id={`${id}-tilt`}>Height tilt</span>+ <span className="text-muted-foreground tabular-nums">{o.tilt}°</span>+ </div>+ <Slider+ aria-labelledby={`${id}-tilt`}+ aria-valuetext={`${o.tilt} degrees`}+ min={EXACT_LIMITS.tilt.min}+ max={EXACT_LIMITS.tilt.max}+ step={EXACT_LIMITS.tilt.step}+ value={[o.tilt]}+ onValueChange={([v]) => set({ tilt: v })}+ />+ </div>+ <div className="min-w-0">+ <p className="mb-1.5 text-[12px]" id={`${id}-dir`}>+ Direction (seen from above)+ </p>+ <ToggleGroup type="single" variant="outline" size="sm" aria-labelledby={`${id}-dir`} value={o.direction} onValueChange={(v) => v && set({ direction: v as ExactOrbit["direction"] })} className="w-full">+ {(["cw", "ccw"] as const).map((d) => (+ <ToggleGroupItem key={d} value={d} className="flex-1 text-[12px]">+ {DIRECTION_NAMES[d]}+ </ToggleGroupItem>+ ))}+ </ToggleGroup>+ </div>+ <div className="min-w-0">+ <p className="mb-1.5 text-[12px]" id={`${id}-pulse`}>+ Radius pulse+ </p>+ <ToggleGroup type="single" variant="outline" size="sm" aria-labelledby={`${id}-pulse`} value={String(o.pulse)} onValueChange={(v) => v && set({ pulse: Number(v) })} className="w-full">+ <ToggleGroupItem value="0" className="flex-1 text-[12px]">+ None+ </ToggleGroupItem>+ <ToggleGroupItem value="0.25" className="flex-1 text-[12px]">+ In and out 25%+ </ToggleGroupItem>+ </ToggleGroup>+ </div>+ </div>+ )}+ {on && engine && <p className="mt-2.5 text-[11.5px] text-muted-foreground">{EXACT_ENGINE_LINE[engine]}</p>}+ {on && footer && <div className="mt-1.5 text-[12px] font-medium">{footer}</div>}+ </div>+ );+}diff --git a/src/components/fly-around-run.ts b/src/components/fly-around-run.tsnew file mode 100644index 00000000..51af796e--- /dev/null+++ b/src/components/fly-around-run.ts@@ -0,0 +1,73 @@+"use client";++import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";+import type { CameraKey } from "@/lib/camera-path";+import type { ExactOrbit } from "@/lib/exact-orbit";+import type { Engine, Generation } from "@/lib/catalog/types";+import { formatCost } from "@/lib/format";+import { responseError, toastError } from "@/lib/refusals";++/** What /api/fly-around takes (src/server/fly-around.ts FlyAroundSchema). */+export interface FlyAroundBody {+ engine: Engine;+ image?: string;+ views?: string[];+ orbit?: ExactOrbit;+ preset?: string;+ keys?: CameraKey[];+ render?: string;+ prompt?: string;+ duration?: number;+ resolution?: string;+ feature?: string;+ title?: string;+}++/** What `?preview=1` answers (FlyAroundPreview). */+export interface FlyAroundPreview {+ engine: Engine;+ model: { id: string; name: string };+ label: string;+ duration: number;+ steps: number;+ notes: string[];+ blocker?: string;+ costUsd: number | null;+ demo: boolean;+}++async function post<T>(url: string, body: unknown): Promise<T> {+ const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });+ const out = (await res.json().catch(() => ({}))) as T & { error?: string };+ if (!res.ok) throw responseError(res, out.error ?? "Something went wrong. Please try again.");+ return out;+}++/** The price line: "Free · on your GPU" on the open engine, the list price in the cloud. */+export function flyPrice(p: FlyAroundPreview | undefined): string {+ if (!p) return "";+ if (p.demo) return "Placeholder · free";+ if (p.engine === "open") return "Free · on your GPU";+ return p.costUsd != null ? `≈ ${formatCost(p.costUsd)}` : "";+}++/** A fly-around's live price (enabled while `body` is set) and its run, which puts the new cards in the feeds. */+export function useFlyAround(body: FlyAroundBody | null) {+ const qc = useQueryClient();+ const preview = useQuery({+ queryKey: ["fly-around-preview", body],+ queryFn: () => post<FlyAroundPreview>("/api/fly-around?preview=1", body),+ enabled: !!body,+ placeholderData: keepPreviousData,+ staleTime: 15_000,+ });+ const run = useMutation({+ mutationFn: (b: FlyAroundBody) => post<{ items: Generation[]; final: Generation }>("/api/fly-around", b),+ onSuccess: () => {+ void qc.invalidateQueries({ queryKey: ["generations"] });+ void qc.invalidateQueries({ queryKey: ["library-facets"] });+ },+ onError: (e) => toastError(e),+ });+ return { preview, run, price: flyPrice(preview.data) };+}diff --git a/src/components/model3d/model-card.tsx b/src/components/model3d/model-card.tsxindex 3f18663a..4f7b6e79 100644--- a/src/components/model3d/model-card.tsx+++ b/src/components/model3d/model-card.tsx@@ -1,12 +1,14 @@"use client";-import { Box, Clapperboard, Download, ImageIcon, Loader2, Pause, PersonStanding, Play, Rotate3d, Sparkles, Video } from "lucide-react";+import { Box, Camera, Clapperboard, Download, ImageIcon, Loader2, Pause, PersonStanding, Play, Rotate3d, Sparkles, Video } from "lucide-react";import Link from "next/link";-import { createElement, useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";+import { createElement, useCallback, useEffect, useEffectEvent, useRef, useState, useSyncExternalStore } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";-import { uploadFile, useHydrated } from "@/lib/api";-import { animateSpinHref, animationName, model3dView, stillOf, type Model3dView } from "@/lib/av/model3d";+import { uploadFile, useEngine, useHydrated } from "@/lib/api";+import { animateSpinHref, animationName, model3dView, photorealAngle, photorealBody, stillOf, type Model3dView } from "@/lib/av/model3d";+import { PATH_FPS, PATH_FRAMES } from "@/lib/camera-path";+import { useFlyAround } from "@/components/fly-around-run";import type { Generation } from "@/lib/catalog/types";import { cn } from "@/lib/utils";import { toastError } from "@/lib/refusals";@@ -87,6 +89,33 @@ export function ModelCard({ g, info, cloudAllowed }: { g: Generation; info: Reco// From words on the open engine: the Z-Image still the model was built from (a helper step the page hides).const drawn = stillOf(g);const name = (g.modelName ?? "model").replace(/[^\w .-]+/g, "");+ // "Film it photoreal" (N7-7): the photo filmed going round the model. Cloud: from the photo along the orbit. Your GPU:+ // the model recorded here along the same orbit guides the camera (a splat hands its own orbit video).+ const [engine] = useEngine();+ const [filming, setFilming] = useState<number | null>(null);+ const pendingFilm = useRef(false);+ const photorealStand = engine === "open" ? "/api/files/placeholder.mp4" : undefined;+ const photoreal = photorealBody(view, engine, photorealStand, drawn);+ const fly = useFlyAround(photoreal && !view.rigged && (view.glb || view.turntable) ? photoreal : null);+ const photoSrc = view.photo ?? drawn;+ const recordFilm = async (el: HTMLElement) => {+ setFilming(0);+ try {+ const blob = await recordTurntable(el as Parameters<typeof recordTurntable>[0], { onProgress: setFilming, frames: PATH_FRAMES, fps: PATH_FPS, angle: (i) => photorealAngle(i) });+ const asset = await uploadFile(new File([blob], `${name} orbit render.webm`, { type: "video/webm" }));+ const body = photorealBody({ photo: photoSrc }, "open", asset.url);+ if (body) {+ await fly.run.mutateAsync(body);+ toast.success("Filming the photoreal orbit — it shows up with your 3D models");+ }+ } catch (e) {+ toastError(e);+ } finally {+ setFilming(null);+ }+ };+ // The viewer's load listener starts the latest one.+ const startFilm = useEffectEvent((el: HTMLElement) => void recordFilm(el));const label = g.modelName ?? "3D";// Behind the viewer: the studio sweep the server's turntable and poster are on, so opening 3D doesn't jump.const backdrop = view.material ? TURNTABLE_BACKDROP : undefined;@@ -122,6 +151,10 @@ export function ModelCard({ g, info, cloudAllowed }: { g: Generation; info: RecopendingRecord.current = false;void startRecording(viewer);}+ if (pendingFilm.current) {+ pendingFilm.current = false;+ void startFilm(viewer);+ }};// A model that can't load won't record either. (A web GLB that fails falls back to the original first.)const onError = () => void (onOriginal && (pendingRecord.current = false));@@ -134,7 +167,7 @@ export function ModelCard({ g, info, cloudAllowed }: { g: Generation; info: Reco}, [viewer, startRecording, onOriginal]);const switchTo = (v: "preview" | "3d") => {// A recording asked for before the model loaded is off once the 3D view is closed.- if (v === "preview") pendingRecord.current = false;+ if (v === "preview") pendingRecord.current = pendingFilm.current = false;setShow(v);};// Recording needs the 3D view: open it and start once the model has loaded.@@ -143,6 +176,18 @@ export function ModelCard({ g, info, cloudAllowed }: { g: Generation; info: RecopendingRecord.current = true;setShow("3d");};+ const film = () => {+ if (engine === "cloud" || !view.glb) {+ const body = photorealBody(view, engine, engine === "open" ? view.turntable : undefined, drawn);+ if (body) fly.run.mutate(body, { onSuccess: () => void toast.success("Filming the photoreal orbit — it shows up with your 3D models") });+ return;+ }+ if (viewer && loaded) return void recordFilm(viewer);+ pendingFilm.current = true;+ setShow("3d");+ };+ const canFilm = !!photoreal && !view.rigged && (engine === "cloud" || (view.glb ? canRecord && !failed : !!view.turntable));+ const filmBusy = filming !== null || fly.run.isPending;const spin = view.rigged ? null : animateSpinHref(view, recorded?.saved);const notices = info[g.modelId]?.notices ?? [];// A rigged result rigs its source model again with another animation.@@ -326,6 +371,20 @@ export function ModelCard({ g, info, cloudAllowed }: { g: Generation; info: Reco<PersonStanding className="size-3.5" /> {view.rigged ? "Another animation" : "Rig & animate"}</Button>)}+ {canFilm && (+ <Button+ variant="outline"+ size="sm"+ className="rounded-full"+ onClick={film}+ disabled={filmBusy || !!fly.preview.data?.blocker}+ title={fly.preview.data?.blocker ?? (engine === "open" ? "The photo filmed going round the model, on your GPU" : "The photo filmed going round the model, in the cloud")}+ >+ {filmBusy ? <Loader2 className="size-3.5 animate-spin" /> : <Camera className="size-3.5" />}+ {filming !== null ? `Recording the orbit… ${Math.round(filming * 100)}%` : "Film it photoreal"}+ {filming === null && fly.price && <span className="text-muted-foreground">· {fly.price}</span>}+ </Button>+ )}{spin && (<Button asChild size="sm" className="rounded-full"><Link href={spin} prefetch={false}>diff --git a/src/components/model3d/model3d-studio.tsx b/src/components/model3d/model3d-studio.tsxindex 0f94f30a..0a5520ce 100644--- a/src/components/model3d/model3d-studio.tsx+++ b/src/components/model3d/model3d-studio.tsx@@ -19,6 +19,7 @@ import { useCreateGeneration, useEngine, useGenerations, useHydrated, useLikelyVimport {MAX_3D_PROMPT,MODEL3D_FEATURE,+ MODEL3D_FILM_FEATURE,MODEL3D_MODES,MODELS_3D,RIG_MODEL,@@ -129,7 +130,7 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {const visitor = useLikelyVisitor();const access = useModelAccess();const create = useCreateGeneration();- const results = useGenerations({ features: [MODEL3D_FEATURE, "app:app-image-to-3d"], limit: 24 });+ const results = useGenerations({ features: [MODEL3D_FEATURE, "app:app-image-to-3d", MODEL3D_FILM_FEATURE], limit: 24 });const [mode, setMode] = useState<Model3dMode>("image");const router = useRouter();// A mode picked here goes in the URL (?mode=), so a reload or a shared link opens it again (UrlModel reads it).@@ -373,5 +374,23 @@ function ResultCard({ g, info, cloudAllowed }: { g: Generation; info: Record<strconst create = useCreateGeneration();if (g.status === "queued" || g.status === "running") return <PendingTile g={g} ratio={4 / 3} />;if (g.status !== "succeeded") return <FailedTile g={g} ratio={4 / 3} onRetry={() => create.mutate(retryOf(g), { onError: (e) => toastError(e) })} />;+ if (g.kind === "video") return <FilmCard g={g} />;return <ModelCard g={g} info={info} cloudAllowed={cloudAllowed} />;}++/** A photoreal orbit filmed from a model ("Film it photoreal"): the clip, to watch and download. */+function FilmCard({ g }: { g: Generation }) {+ const video = g.outputs.find((o) => o.kind === "video");+ if (!video) return null;+ return (+ <article className="overflow-hidden rounded-2xl border bg-card">+ <video src={video.url} controls playsInline preload="metadata" className="aspect-[4/3] w-full bg-muted object-contain" aria-label="Photoreal orbit" />+ <div className="flex items-center justify-between gap-2 p-3">+ <p className="min-w-0 truncate text-[13px] font-medium">Photoreal orbit</p>+ <a href={video.url} download="photoreal orbit.mp4" className="shrink-0 text-[12px] text-muted-foreground underline underline-offset-2 hover:text-foreground">+ Download+ </a>+ </div>+ </article>+ );+}diff --git a/src/components/model3d/turntable.ts b/src/components/model3d/turntable.tsindex 6cec2ce7..c277bc8d 100644--- a/src/components/model3d/turntable.ts+++ b/src/components/model3d/turntable.ts@@ -75,7 +75,18 @@ export function paintBackdrop(ctx: CanvasRenderingContext2D, w: number, h: numbectx.restore();}-export async function recordTurntable(viewer: ViewerElement, o: { onProgress?: (p: number) => void; signal?: AbortSignal } = {}): Promise<Blob> {+/** How many frames a recording has and how fast they play. */+type Shape = { frames: number; fps: number };++/**+ * Record the model turning. By default one full turn (TURN_FRAMES at TURNTABLE_FPS); with `frames`, `fps` and `angle`,+ * any turn frame by frame (Image to 3D's "Film it photoreal" records the camera path's 81 frames at 16 fps).+ */+export async function recordTurntable(+ viewer: ViewerElement,+ o: { onProgress?: (p: number) => void; signal?: AbortSignal; frames?: number; fps?: number; angle?: (i: number) => number } = {},+): Promise<Blob> {+ const shape: Shape = { frames: o.frames ?? TURN_FRAMES, fps: o.fps ?? TURNTABLE_FPS };if (!recordableType()) throw new Error("This browser can't record video — download the .glb instead");const { resetTurntableRotation, toBlob } = viewer;if (!resetTurntableRotation || !toBlob) throw new Error("The 3D viewer isn't ready yet");@@ -91,7 +102,7 @@ export async function recordTurntable(viewer: ViewerElement, o: { onProgress?: (let canvas: HTMLCanvasElement | null = null;let ctx: CanvasRenderingContext2D | null = null;const grab = async (i: number) => {- turn(turnAngle(i));+ turn(o.angle ? o.angle(i) : turnAngle(i));// The new angle renders on the next frame; one more for the contact shadow.for (let k = 0; k < 3; k++) await nextFrame();const bitmap = await createImageBitmap(await toBlob.call(viewer, { mimeType: "image/png" }));@@ -116,10 +127,10 @@ export async function recordTurntable(viewer: ViewerElement, o: { onProgress?: (const first = await grab(0);stopped();const enc = await encoderConfig(first.width, first.height);- if (enc) return await withWebCodecs(first, grab, enc, o, stopped);+ if (enc) return await withWebCodecs(first, grab, enc, o, stopped, shape);// WebCodecs without VP9 / VP8 (Safari encodes H.264 only) and no WebM MediaRecorder either.if (!mediaRecorderType()) throw new Error("This browser can't record video — download the .glb instead");- return await withMediaRecorder(first, grab, o, stopped);+ return await withMediaRecorder(first, grab, o, stopped, shape);} finally {turn(0);if (auto) viewer.setAttribute("auto-rotate", "");@@ -133,6 +144,7 @@ async function withWebCodecs(enc: { config: VideoEncoderConfig; codec: "V_VP9" | "V_VP8" },o: { onProgress?: (p: number) => void },stopped: () => void,+ shape: Shape,): Promise<Blob> {const frames: WebmFrame[] = [];let failure: Error | null = null;@@ -145,40 +157,40 @@ async function withWebCodecs(error: (e) => (failure = e instanceof Error ? e : new Error(String(e))),});encoder.configure(enc.config);- const us = 1e6 / TURNTABLE_FPS;+ const us = 1e6 / shape.fps;try {- for (let i = 0; i < TURN_FRAMES; i++) {+ for (let i = 0; i < shape.frames; i++) {if (failure) throw failure;stopped();const c = i === 0 ? canvas : await grab(i);const frame = new VideoFrame(c, { timestamp: Math.round(i * us), duration: Math.round(us) });- encoder.encode(frame, { keyFrame: i % TURNTABLE_FPS === 0 });+ encoder.encode(frame, { keyFrame: i % shape.fps === 0 });frame.close();while (encoder.encodeQueueSize > 4) await sleep(5);- o.onProgress?.((i + 1) / TURN_FRAMES);+ o.onProgress?.((i + 1) / shape.frames);}await encoder.flush();if (failure) throw failure;} finally {if (encoder.state !== "closed") encoder.close();}- if (frames.length < TURN_FRAMES) throw new Error("The recording came out empty — download the .glb instead");+ if (frames.length < shape.frames) throw new Error("The recording came out empty — download the .glb instead");frames.sort((a, b) => a.timestamp - b.timestamp);- return muxWebm({ codec: enc.codec, width: canvas.width, height: canvas.height, fps: TURNTABLE_FPS, frames });+ return muxWebm({ codec: enc.codec, width: canvas.width, height: canvas.height, fps: shape.fps, frames });}/*** Without WebCodecs: collect the frames first (PNG blobs), then play them into MediaRecorder at the frame rate.* Drawing a decoded frame is quick, so the playback keeps time where rendering couldn't.*/-async function withMediaRecorder(canvas: HTMLCanvasElement, grab: (i: number) => Promise<HTMLCanvasElement>, o: { onProgress?: (p: number) => void }, stopped: () => void): Promise<Blob> {+async function withMediaRecorder(canvas: HTMLCanvasElement, grab: (i: number) => Promise<HTMLCanvasElement>, o: { onProgress?: (p: number) => void }, stopped: () => void, shape: Shape): Promise<Blob> {const type = mediaRecorderType()!;const shot = (c: HTMLCanvasElement) => new Promise<Blob>((resolve, reject) => c.toBlob((b) => (b ? resolve(b) : reject(new Error("The 3D viewer isn't ready yet"))), "image/png"));const stills: Blob[] = [await shot(canvas)];- for (let i = 1; i < TURN_FRAMES; i++) {+ for (let i = 1; i < shape.frames; i++) {stopped();stills.push(await shot(await grab(i)));- o.onProgress?.((0.8 * (i + 1)) / TURN_FRAMES);+ o.onProgress?.((0.8 * (i + 1)) / shape.frames);}const ctx = canvas.getContext("2d")!;// Frame rate 0: a frame is captured only when requested.@@ -188,16 +200,16 @@ async function withMediaRecorder(canvas: HTMLCanvasElement, grab: (i: number) =>const chunks: Blob[] = [];rec.ondataavailable = (e) => e.data.size && chunks.push(e.data);const done = new Promise<void>((resolve) => (rec.onstop = () => resolve()));- const step = 1000 / TURNTABLE_FPS;+ const step = 1000 / shape.fps;let next = createImageBitmap(stills[0]);rec.start(250);const t0 = performance.now();try {// One more than the frames: the last request only closes the last frame's duration.- for (let i = 0; i <= TURN_FRAMES; i++) {+ for (let i = 0; i <= shape.frames; i++) {stopped();- const bitmap = i < TURN_FRAMES ? await next : null;- if (i + 1 < TURN_FRAMES) next = createImageBitmap(stills[i + 1]);+ const bitmap = i < shape.frames ? await next : null;+ if (i + 1 < shape.frames) next = createImageBitmap(stills[i + 1]);const wait = t0 + i * step - performance.now();if (wait > 0) await sleep(wait);if (bitmap) {@@ -205,7 +217,7 @@ async function withMediaRecorder(canvas: HTMLCanvasElement, grab: (i: number) =>bitmap.close();}track.requestFrame?.();- o.onProgress?.(0.8 + (0.2 * Math.min(i, TURN_FRAMES)) / TURN_FRAMES);+ o.onProgress?.(0.8 + (0.2 * Math.min(i, shape.frames)) / shape.frames);}} finally {rec.stop();diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex 1aa80581..00729950 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -18,6 +18,9 @@ import { locksByDefault } from "@/lib/catalog/palettes";import { DEFAULT_LOOK, lookCard } from "@/lib/catalog/soul-cards";import { formatsOf } from "@/lib/av/formats";import { quoteBody, useHostedQuote, useSettled, type RunOn } from "@/lib/hosted";+import { ExactOrbitControls } from "@/components/exact-orbit-controls";+import { useFlyAround } from "@/components/fly-around-run";+import { exactDefaults, takesExact, type ExactOrbit } from "@/lib/exact-orbit";import { CONNECT_GPU_EVENT, enhance, useClipFacts, useCreateGeneration, useElements, useEngine, useHydrated, useStatus } from "@/lib/api";import { usePagePlace } from "@/components/gpu/use-page-place";import { applyMentions, elementsNote, type StudioElement } from "@/lib/catalog/elements";@@ -344,6 +347,12 @@ export function Composer({ docked }: { docked: boolean }) {const takesLook = !!model?.options.looks;const preset: Preset | undefined = draft.presetId && !takesLook ? catalog.getPreset(draft.presetId) : config.preset;const lockedModel = preset?.type === "app";+ // Fuobe DoP's orbit moves (N7-7): the Exact switch films the orbit by its numbers through /api/fly-around.+ const exactId = preset?.type === "motion" && takesExact(preset.id) ? preset.id : undefined;+ const [exactBy, setExactBy] = useState<{ id: string; orbit: ExactOrbit } | null>(null);+ const exact = exactId && exactBy?.id === exactId ? exactBy.orbit : null;+ const exactImage = draft.slots.image?.ref;+ const fly = useFlyAround(exact ? { engine, image: exactImage, orbit: exact, prompt: draft.prompt.trim() || undefined, feature: config.feature } : null);const presetLoading = !!draft.presetId && !takesLook && !preset && !catalog.complete;// The models the viewer's catalog has (the studio's slice, or the full catalog once it's loaded), and the ones this// viewer can run now: offered in Settings → Models & licences, and a key for its provider when it's an account's paid run.@@ -709,6 +718,15 @@ export function Composer({ docked }: { docked: boolean }) {// `skip` is true only from the guided fix's "Run anyway" (a click handler passes its event here).const submit = (skip?: unknown) => {const skipGpu = skip === true;+ if (exact) {+ // An exact orbit: the still filmed along the orbit's numbers (Fly around), priced in its panel.+ const stop = !exactImage ? "Add a start frame to film an exact orbit" : fly.preview.data?.blocker;+ if (stop) return void toast(stop, { id: "composer-blocker" });+ if (fly.run.isPending) return;+ toast.dismiss("composer-blocker");+ fly.run.mutate({ engine, image: exactImage, orbit: exact, prompt: draft.prompt.trim() || undefined, feature: config.feature });+ return;+ }if (keyToAdd && model && !create.isPending) return openAddKey(keyToAdd, model.id);if (!blocker && gpuSetup && !skipGpu && !create.isPending) return openGpuFix();if (blocker || create.isPending || signature.lock.isPending) {@@ -1460,6 +1478,16 @@ export function Composer({ docked }: { docked: boolean }) {/><span className="contents max-sm:hidden">{styleChips}</span></div>+ {exactId && (+ <ExactOrbitControls+ className="mx-1 mb-1.5"+ engine={engine}+ value={exact}+ defaults={exactDefaults(exactId)}+ onChange={(orbit) => setExactBy(orbit ? { id: exactId, orbit } : null)}+ footer={exact ? <span>{fly.preview.data?.blocker && exactImage ? fly.preview.data.blocker : fly.price}</span> : undefined}+ />+ )}{hostedHere && viewerInfo?.gpu.connected && (<buttontype="button"diff --git a/src/lib/av/model3d.ts b/src/lib/av/model3d.tsindex fa64fdc5..cebb1063 100644--- a/src/lib/av/model3d.ts+++ b/src/lib/av/model3d.ts@@ -1,4 +1,6 @@import type { Engine, Generation, GenerationRequest, OutputFile } from "@/lib/catalog/types";+import { PATH_FRAMES, keyAt } from "@/lib/camera-path";+import { exactOrbitKeys, type ExactOrbit } from "@/lib/exact-orbit";/*** Image to 3D / Product spin: the modes (from an image, from several images, from text, pick an object, a splat),@@ -10,6 +12,8 @@ import type { Engine, Generation, GenerationRequest, OutputFile } from "@/lib/caexport const MODEL3D_FEATURE = "image-to-3d";/** The helper steps of a chain (the open text-to-3D still): kept out of the page's results and the Library. */export const MODEL3D_STEP_FEATURE = "image-to-3d-step";+/** "Film it photoreal" (N7-7): the photoreal orbits, listed with the models they were filmed from. */+export const MODEL3D_FILM_FEATURE = "image-to-3d-film";export type Model3dMode = "image" | "multi" | "text" | "objects" | "splat";@@ -264,6 +268,34 @@ export function animateSpinHref(v: Model3dView, turntable?: string): string | nureturn null;}+// ---------------------------------------------------------------------------+// Film it photoreal (build plan N7-7): a photoreal orbit whose geometry matches the 3D model++/** The orbit "Film it photoreal" films: one level turn round the model, counter-clockwise seen from above. */+export const PHOTOREAL_ORBIT: ExactOrbit = { degrees: 360, direction: "ccw", tilt: 0, pulse: 0 };++/**+ * The model's turntable angle (radians) for frame i of the path render: the camera moving round to the right is the+ * model turning the other way under a still camera. One constant to flip if a GPU run shows the film turning against+ * its render.+ */+export const PHOTOREAL_TURN_SIGN: 1 | -1 = -1;+export function photorealAngle(i: number, frames = PATH_FRAMES): number {+ const k = keyAt(exactOrbitKeys(PHOTOREAL_ORBIT), frames > 1 ? i / (frames - 1) : 0);+ return (PHOTOREAL_TURN_SIGN * k.azimuth * Math.PI) / 180 + 0;+}++/**+ * "Film it photoreal": the photo the model was made from, filmed going round it. Cloud: H3 Max camera-controls from the+ * photo along the orbit. Open: Wan 2.1 + Uni3C from the photo, guided by the model recorded along the same orbit+ * (`render`; the browser records the GLB, a splat hands its own orbit video). Null when there's no photo to start from.+ */+export function photorealBody(v: Pick<Model3dView, "photo" | "poster">, engine: Engine, render?: string, still?: string) {+ const image = v.photo ?? still;+ if (!image) return null;+ return { engine, image, orbit: PHOTOREAL_ORBIT, feature: MODEL3D_FILM_FEATURE, title: "Photoreal orbit", ...(engine === "open" && render && { render }) };+}+// ---------------------------------------------------------------------------// Rig & animate (Meshy rigging on fal; cloud only — UniRig's ComfyUI pack isn't verified)diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.tsindex 5005d036..83fd1088 100644--- a/src/lib/catalog/canvas.ts+++ b/src/lib/catalog/canvas.ts@@ -15,6 +15,9 @@ import { chainedWaitMessage, keyframeChain } from "./keyframes";import { estimateCost, inferOperation, planGeneration, routesFor, type Plan } from "./plan";import { replacedBy, replacementOf } from "./replaced";import { REGEN_COPY, REGEN_MODEL } from "./regenerate";+import { FLY_MODELS, flyKeys, planFlyAround } from "./fly-around";+import type { CameraKey } from "@/lib/camera-path";+import type { ExactOrbit } from "@/lib/exact-orbit";import {OPERATION_LABELS,OPERATION_OUTPUT,@@ -32,7 +35,7 @@ import {// Graph types (stored as JSON in the canvases table)/** What travels along an edge. A voice is an audio sample to speak with (Clone Voice). */-export type PortType = "text" | "image" | "video" | "audio" | "element" | "voice";+export type PortType = "text" | "image" | "video" | "audio" | "element" | "voice" | "path";export const PORT_TYPE_LABEL: Record<PortType, string> = {text: "Text",@@ -41,6 +44,7 @@ export const PORT_TYPE_LABEL: Record<PortType, string> = {audio: "Audio",element: "Element",voice: "Voice",+ path: "Camera path",};export type CanvasNodeType =@@ -62,6 +66,8 @@ export type CanvasNodeType =| "concat"| "restore"| "table"+ | "camera-path"+ | "fly-around"| "output"| "note";@@ -111,6 +117,12 @@ export interface CanvasNodeData {rows?: string[][];/** Translate (video) on the open engine: the Translate & dub session it started (its result comes back from there). */dubId?: string;+ /** Camera path (N7-7): a preset (camera-path PATH_PRESETS), an exact orbit's numbers, or keys; the first set wins. */+ pathPreset?: string;+ orbit?: ExactOrbit;+ keys?: CameraKey[];+ /** Fly around: the clip's length in seconds (the cloud; your GPU always films about 5 s). */+ duration?: number;}export interface CanvasNode {@@ -242,11 +254,13 @@ export const NODE_SPECS: Record<CanvasNodeType, NodeSpec> = {concat: { type: "concat", label: "Assemble film", group: "Utilities", icon: "Film", ops: ["concat"], description: "Up to 50 clips in one film: trim and mute each, pick the frame" },restore: { type: "restore", label: "Restore & colourise", group: "Utilities", icon: "Palette", ops: ["restore-video"], description: "Old or black-and-white footage, cleaned and in colour" },table: { type: "table", label: "Table", group: "Inputs", icon: "Table", description: "Rows of words: what it feeds runs once per row" },+ "camera-path": { type: "camera-path", label: "Camera path", group: "Inputs", icon: "Orbit", description: "A move round the subject: a preset or an exact orbit" },+ "fly-around": { type: "fly-around", label: "Fly around", group: "Generate", icon: "Rotate3d", ops: ["camera-path"], description: "A still filmed along a camera path, with other views if you have them" },output: { type: "output", label: "Output", group: "Output", icon: "MonitorPlay", description: "Preview what's connected, side by side" },note: { type: "note", label: "Sticky note", group: "Output", icon: "StickyNote", description: "A note on the board (not run)" },};-export const GENERATOR_TYPES = new Set<CanvasNodeType>(["model", "join", "frame", "upscale", "bg-remove", "tts", "voice-change", "clean-voice", "translate", "concat", "restore"]);+export const GENERATOR_TYPES = new Set<CanvasNodeType>(["model", "join", "frame", "upscale", "bg-remove", "tts", "voice-change", "clean-voice", "translate", "concat", "restore", "fly-around"]);export const isGenerator = (n: Pick<CanvasNode, "type">) => GENERATOR_TYPES.has(n.type);/** Entries of the Add-node palette (several entries can make the same node type). */@@ -295,6 +309,8 @@ export const PALETTE: PaletteItem[] = [{ ...pick("concat"), id: "concat", keywords: "concatenate join merge stitch edit trim mute film assemble" },{ ...pick("restore"), id: "restore", keywords: "restore colourise colorize archive old footage black and white film scan vhs" },{ ...pick("table"), id: "table", data: { columns: ["Subject"], rows: [[""], [""], [""]] }, keywords: "rows batch spreadsheet list variations csv grid" },+ { ...pick("camera-path"), id: "camera-path", data: { pathPreset: "orbit_360" }, keywords: "orbit arc camera move path keyframes exact turnaround" },+ { ...pick("fly-around"), id: "fly-around", keywords: "orbit fly around turnaround camera path 360 spin product" },{ ...pick("output"), id: "output", keywords: "preview compare result" },{ ...pick("note"), id: "note", keywords: "comment annotation" },];@@ -436,6 +452,7 @@ const KIND_OP: Record<MediaKind, Operation> = { image: "t2i", video: "t2v", audi/** The model a new generator node starts with. */export function defaultModelForNode(n: Pick<CanvasNode, "type" | "data">, engine: Engine): ModelDef | undefined {if (n.type === "concat") return getModel(CONCAT_MODELS[engine]);+ if (n.type === "fly-around") return getModel(FLY_MODELS[engine]);if (n.type === "model") {const kind = n.data.mediaKind ?? "image";return defaultModelFor(n.data.op ?? KIND_OP[kind], engine) ?? MODELS.find((m) => m.engine === engine && !m.hidden && m.kind === kind);@@ -470,6 +487,7 @@ export function modelChoices(n: Pick<CanvasNode, "type" | "data">): ModelDef[] {return MODELS.filter((m) => !m.hidden && (!kind || m.kind === kind) && !needsMarks(m) && m.routes.some((r) => !UNSUPPORTED_OPS.has(r.op)));}if (n.type === "concat") return Object.values(CONCAT_MODELS).flatMap((id) => getModel(id) ?? []);+ if (n.type === "fly-around") return [FLY_MODELS.cloud, FLY_MODELS.open].flatMap((id) => getModel(id) ?? []);const ops = nodeOps(n);return MODELS.filter((m) => ops.some((op) => supportsOp(m, op)) && (!m.hidden || ops.includes("frame")) && !needsMarks(m));}@@ -477,7 +495,7 @@ export function modelChoices(n: Pick<CanvasNode, "type" | "data">): ModelDef[] {// ---------------------------------------------------------------------------// Ports-export type InputPortId = "prompt" | "elements" | "images" | "endImage" | "video" | "videos" | "audio" | "voice";+export type InputPortId = "prompt" | "elements" | "images" | "endImage" | "video" | "videos" | "audio" | "voice" | "path";export interface PortDef {id: InputPortId;@@ -490,7 +508,7 @@ export interface PortDef {export const OUT = "out";export const PREVIEW_IN = "in";-const INPUT_ORDER: InputPortId[] = ["prompt", "elements", "images", "endImage", "video", "videos", "audio", "voice"];+const INPUT_ORDER: InputPortId[] = ["prompt", "elements", "images", "endImage", "video", "videos", "audio", "voice", "path"];/** Which inputs each operation reads. */const OP_PORTS: Partial<Record<Operation, InputPortId[]>> = {@@ -566,6 +584,13 @@ export function inputPorts(n: Pick<CanvasNode, "type" | "data">): PortDef[] {// Clone voice: the sample can come from another node (a recording, a generated voice) instead of a file.if (n.type === "clone-voice") return [{ id: "audio", label: "Sample", type: "audio", multiple: false }];if (n.type === "output") return [];+ // Fly around: the still (then any other views of the subject), the path, and motion words.+ if (n.type === "fly-around")+ return [+ { id: "prompt", label: "Motion words", type: "text", multiple: true },+ { id: "images", label: "Still, then views", type: "image", multiple: true },+ { id: "path", label: "Camera path", type: "path", multiple: false },+ ];if (!isGenerator(n)) return [];const model = n.data.modelId ? getModel(n.data.modelId) : undefined;const all = nodeOps(n, model);@@ -598,6 +623,7 @@ export function inputPorts(n: Pick<CanvasNode, "type" | "data">): PortDef[] {videos: { id: "videos", label: "Clips", type: "video", multiple: true },audio: { id: "audio", label: "Audio", type: "audio", multiple: false },voice: { id: "voice", label: "Voice", type: "voice", multiple: false },+ path: { id: "path", label: "Camera path", type: "path", multiple: false },};return INPUT_ORDER.filter((id) => ids.has(id)).map((id) => defs[id]);}@@ -611,6 +637,8 @@ export function outputType(_graph: CanvasGraph, n: CanvasNode): PortType | nullif (n.type === "prompt" || n.type === "table") return "text";if (n.type === "clone-voice") return "voice";if (n.type === "element") return "element";+ if (n.type === "camera-path") return "path";+ if (n.type === "fly-around") return "video";if (MEDIA_INPUT_TYPE[n.type]) return MEDIA_INPUT_TYPE[n.type]!;if (!isGenerator(n)) return null;// Never inferred from the inputs (that would walk the whole upstream graph): a chosen or fixed op, else the model's kind.@@ -628,7 +656,7 @@ export function outputType(_graph: CanvasGraph, n: CanvasNode): PortType | null/** Which ports accept which types: a voice input also takes plain audio (a sample straight from a file or a model). */export function acceptsType(port: PortDef | "preview", type: PortType): boolean {- if (port === "preview") return type !== "element";+ if (port === "preview") return type !== "element" && type !== "path";return port.type === type || (port.type === "voice" && type === "audio");}@@ -776,6 +804,7 @@ const SLOT: Record<InputPortId, ChainSlot["slot"] | null> = {videos: "videos",audio: "audio",voice: "voiceAudio",+ path: null,};type InputKey = "endImage" | "video" | "audio" | "voiceAudio";@@ -942,6 +971,7 @@ function buildRequest(graph: CanvasGraph, n: CanvasNode, model: ModelDef, singleif (n.type !== "model" && op && !supportsOp(model, op)) return { error: `${model.name} can't do ${OPERATION_LABELS[op].toLowerCase()} — pick another model` };if ((op === "translate" || op === "dub") && !n.data.params?.targetLanguage) return { error: op === "dub" ? "Pick a language to dub into" : "Pick a language to translate into" };if (n.type === "concat") return concatRequest(graph, n, model);+ if (n.type === "fly-around") return flyAroundRequest(graph, n, model);if (!single) {const rows = rowsFeeding(graph, n);if (rows && "error" in rows) return rows;@@ -1306,6 +1336,90 @@ function concatRequest(graph: CanvasGraph, n: CanvasNode, model: ModelDef): Nodereturn { request: final.request, deps, steps };}+/** A Camera path node's keys (a preset, an exact orbit or keys) and their words; none when it has nothing set. */+export function cameraPathOf(n: Pick<CanvasNode, "data">): { keys: CameraKey[]; label: string } {+ const d = n.data;+ return flyKeys(d.orbit ? { orbit: d.orbit } : d.pathPreset ? { preset: d.pathPreset } : { keys: d.keys });+}++/**+ * Fly around (N7-7): the still (the first image, top to bottom; any more are other views of the subject) filmed along the+ * connected Camera path, as src/lib/catalog/fly-around.ts plans it. Cloud: H3 Max camera-controls, or with views H3 Max+ * reference-to-video. Your GPU: MoGe 2's depth of the still, then Wan 2.1 + Uni3C along the server's render of the path.+ */+function flyAroundRequest(graph: CanvasGraph, n: CanvasNode, model: ModelDef): NodeRequest | { error: string } {+ const nodes = nodeMap(graph);+ const into = (port: InputPortId) =>+ incoming(graph, n.id)+ .filter((e) => e.targetHandle === port && nodes.has(e.source))+ .map((e) => nodes.get(e.source)!)+ .sort(byPosition);+ const pathNode = into("path")[0];+ if (!pathNode) return { error: "Connect a Camera path" };+ if (pathNode.type !== "camera-path") return { error: `${nodeLabel(pathNode)} can't go into Camera path` };+ const { keys } = cameraPathOf(pathNode);+ if (keys.length < 2) return { error: `Pick a move in “${nodeLabel(pathNode)}”` };+ const words: string[] = [];+ for (const s of into("prompt")) {+ const src = sourceOf(graph, s);+ if ("error" in src) return src;+ if (src.kind !== "text") return { error: "Fly around takes typed words: connect a Text prompt" };+ if (src.text) words.push(src.text);+ }+ const pictures: Source[] = [];+ for (const s of into("images")) {+ if (outputType(graph, s) !== "image") return { error: `${nodeLabel(s)} can't go into Still, then views` };+ const src = sourceOf(graph, s);+ if ("error" in src) return src;+ pictures.push(src);+ }+ if (!pictures.length) return { error: "Connect the still to film" };+ const urlOf = (src: Source) => (src.kind === "media" ? src.url : PLACEHOLDER.image);+ const plan = planFlyAround({+ engine: model.engine,+ image: urlOf(pictures[0]),+ views: pictures.slice(1).map(urlOf),+ keys,+ prompt: words.join(". ") || undefined,+ duration: n.data.duration,+ resolution: n.data.params?.resolution,+ feature: "canvas",+ title: nodeLabel(n),+ });+ if (plan.blocker) return { error: plan.blocker };+ // Pictures from other nodes go in as chain slots, in board order; the planner's stand-ins for them come out.+ const deps: string[] = [];+ const fromNodes = pictures.flatMap((src) => (src.kind === "node" ? [src.nodeId] : []));+ for (const id of fromNodes) if (!deps.includes(id)) deps.push(id);+ const steps: NodeStep[] = plan.steps.map((st) => {+ // A step takes as many pictures as the planner gave it (the depth and the film: the still; references: all of them).+ const taken = st.request.inputs?.images?.length ?? 0;+ const mine = pictures.slice(0, taken);+ const slots: ChainSlot[] = [];+ const from: StepSource[] = [];+ let literal = false;+ for (const src of mine) {+ if (src.kind === "node") {+ slots.push({ slot: "images", position: literal ? "last" : "first" });+ from.push({ node: src.nodeId });+ } else literal = true;+ }+ for (const [i, c] of (st.request.chain ?? []).entries()) {+ slots.push(c);+ from.push({ step: st.after![i] });+ }+ const images = mine.flatMap((src) => (src.kind === "media" ? [src.url] : []));+ const inputs = { ...st.request.inputs, images: images.length ? images : undefined };+ return {+ key: st.key,+ request: { ...st.request, feature: st.key === "main" ? "canvas" : CANVAS_STEP_FEATURE, inputs, ...(slots.length ? { chain: slots } : { chain: undefined }) },+ from,+ };+ });+ const main = steps.find((st) => st.key === "main")!;+ return { request: main.request, deps, steps };+}+/** A Translate node set to video with no cloud model allowed: where the open engine dubs. */export const OPEN_DUB_HINT = "Dubbing a video on a canvas runs on the cloud (ElevenLabs Dubbing, HeyGen). On the open engine it's made in Translate & dub, where you check the translation before it's spoken: start it from here";diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.tsindex 6a7c8c7f..ab9b0c71 100644--- a/src/lib/catalog/cinema.ts+++ b/src/lib/catalog/cinema.ts@@ -10,6 +10,8 @@ import { ANGLES_2511_LORA } from "./open-tools";import { composeShots, estimateCost, planGeneration, routesFor } from "./plan";import { soulRecipe } from "./soul";import { planTurnaround, type TurnaroundInput } from "./turnaround";+import { planFlyAround } from "./fly-around";+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";@@ -217,6 +219,11 @@ export interface CinemaGenerateInput {prompt: string;/** # camera moves, in order. */moves?: string[];+ /**+ * The first move as an exact orbit (build plan N7-7): an orbit move (drone-orbit, arc-left, arc-right, bullet-time) with+ * the Exact switch on follows these numbers instead of a LoRA's or the prompt's idea of an orbit.+ */+ exact?: Partial<ExactOrbit>;settings: DirectorSettings;brief?: string;/** Reference images (the first one is the start frame). @elements add theirs on the server. */@@ -1479,7 +1486,27 @@ function clipModel(model: ModelDef, input: CinemaGenerateInput, notes: string[])return instead;}+/**+ * An exact orbit (build plan N7-7): the first move, an orbit with the Exact switch on, filmed from the start frame along+ * 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 {+ 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 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;+ return finish(plan.model, plan.steps, notes, blocker);+}+function planVideo(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {+ const exact = planExactVideo(input);+ if (exact) return exact;const notes: string[] = [];const engine = input.engine;const open = engine === "open";diff --git a/src/server/assist/agent.ts b/src/server/assist/agent.tsindex cb60c725..f9687abb 100644--- a/src/server/assist/agent.ts+++ b/src/server/assist/agent.ts@@ -700,7 +700,7 @@ How you work:- Call generate (or create_storyboard) directly. The app shows the user a plan card with the cost and runs it when they approve — never ask "shall I go ahead?" in text.- For multi-step work (an image, then animate it; transcribe, translate, then voice it), put the steps in one generate call and set "after" on each later job: it starts by itself when the earlier job finishes and gets its result as input. When you need to judge a result before deciding the next step, wait with check_generations instead (look=true to see images) and pass the output URL into the next call.- Besides images, video and audio, models can transcribe speech, translate or write text (scripts, captions, ad copy), split images into layers, separate voice from background, trim, caption or re-sound clips, and turn an image into a 3D model: search_models with kind "text" or "model3d" finds the text and 3D ones.-- Whole studio jobs have their own tools, and each job opens in its studio, where the user can carry on: split_layers (a Layers project), restyle_footage (a Shorts Studio session), dub_video (a dub the user reviews line by line in Translate & dub), faceless_episode (a Faceless Studio episode), create_ads (an Ads Studio batch), add_captions (the Captions editor), restore_video (old or black-and-white footage restored and colourised, in Restore & colourise), blockout_film (a grey-box 3D blockout from Blender or any 3D app filmed from reference stills and timed beats, as Cinema's Blockout does; in the Library) and katana (a reference edit — a 1–30 s video — rebuilt shot for shot with the user's own subject from 1–5 photos, when they want "this edit, but with me / my product"). Use them instead of chaining those steps by hand; once one starts, say which studio it's in (the chat links to it).+- Whole studio jobs have their own tools, and each job opens in its studio, where the user can carry on: split_layers (a Layers project), restyle_footage (a Shorts Studio session), dub_video (a dub the user reviews line by line in Translate & dub), faceless_episode (a Faceless Studio episode), create_ads (an Ads Studio batch), add_captions (the Captions editor), restore_video (old or black-and-white footage restored and colourised, in Restore & colourise), blockout_film (a grey-box 3D blockout from Blender or any 3D app filmed from reference stills and timed beats, as Cinema's Blockout does; in the Library), fly_around (a still filmed along an exact camera path: an orbit by its degrees, direction, tilt and pulse, or a ready move; in the Library) and katana (a reference edit — a 1–30 s video — rebuilt shot for shot with the user's own subject from 1–5 photos, when they want "this edit, but with me / my product"). Use them instead of chaining those steps by hand; once one starts, say which studio it's in (the chat links to it).- Use the user's files by the URLs listed in their message. Earlier outputs are found with list_recent. Saved characters and products are Elements: check list_elements and write their @handle in prompts.- Results show up in the chat by themselves, so don't repeat URLs back. After starting jobs, say briefly what's coming; after they finish, give a short take and suggest a next step.- Be brief and friendly. Plain sentences, no headings. Prices are estimates in USD; open-source models run free on the user's own GPU.diff --git a/src/server/assist/studio-tools.ts b/src/server/assist/studio-tools.tsindex 81010ff9..e85eda8a 100644--- a/src/server/assist/studio-tools.ts+++ b/src/server/assist/studio-tools.ts@@ -12,6 +12,8 @@ import { SHORTS_MODELS } from "@/lib/catalog/shorts";import type { ChainSlot, Engine, GenerationRequest, Operation } from "@/lib/catalog/types";import { TOOL_MODELS } from "@/lib/layers";import { planCinema } from "@/lib/catalog/cinema";+import { FLY_VIEWS_MAX, planFlyAround } from "@/lib/catalog/fly-around";+import { PATH_PRESETS } from "@/lib/camera-path";import { createPipeline, type PipelineStep } from "../chains";import { blockoutFromFile, cinemaContext } from "../cinema-generate";import { db } from "../db";@@ -771,7 +773,70 @@ const blockoutFilm = defineTool({},});-export const STUDIO_TOOLS = [splitLayers, restyleFootage, dubVideo, facelessEpisode, createAds, addCaptions, restoreVideo, blockoutFilm];+// ---------------------------------------------------------------------------+// Fly around (build plan N7-7): a still filmed along an exact camera path++export const FlyAroundToolInput = z.object({+ image: ref.describe("The still to film: the clip's first frame (a character, a product, a scene)."),+ views: z.array(ref).max(FLY_VIEWS_MAX).optional().describe("Cloud only: other pictures of the same subject from other sides; MiniMax H3 Max takes them as references (the path then goes in words)."),+ preset: z+ .enum(PATH_PRESETS.map((p) => p.id) as [string, ...string[]])+ .optional()+ .describe(`A ready move: ${PATH_PRESETS.map((p) => `${p.id} (${p.name})`).join(", ")}. Leave it out to give the orbit's numbers instead.`),+ degrees: z.number().min(30).max(360).optional().describe("An exact orbit: how far round the subject, 30–360° (default 360)."),+ direction: z.enum(["cw", "ccw"]).optional().describe("An exact orbit's direction seen from above: cw moves the camera round to the left, ccw to the right (default ccw)."),+ tilt: z.number().min(0).max(20).optional().describe("An exact orbit's height tilt, 0–20°: the ring rises on the way round and comes back level."),+ pulse: z.boolean().optional().describe("An exact orbit moves 25% in and out twice on the way round."),+ prompt: z.string().max(1500).optional().describe("Motion words: what the subject does while the camera moves (the camera's own move is set by the path)."),+ duration: z.number().min(1).max(15).optional().describe("Cloud only: seconds (default 5). Your GPU always films about 5 s."),+});+export type FlyAroundToolInput = z.infer<typeof FlyAroundToolInput>;++/** The fly-around's steps as a pipeline in the Library (src/lib/catalog/fly-around.ts). */+function flyAroundSteps(i: FlyAroundToolInput, ctx: ToolContext): PipelineStep[] {+ const engine = engineOf(ctx);+ const exact = !i.preset || i.degrees !== undefined || i.direction !== undefined || i.tilt !== undefined || i.pulse !== undefined;+ const plan = planFlyAround({+ engine,+ image: i.image,+ views: i.views,+ ...(exact ? { orbit: { degrees: i.degrees ?? 360, direction: i.direction ?? "ccw", tilt: i.tilt ?? 0, pulse: i.pulse ? 0.25 : 0 } } : { preset: i.preset }),+ prompt: i.prompt,+ duration: i.duration,+ feature: "fly-around",+ });+ 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 }) }));+}++const flyAround = defineTool({+ name: "fly_around",+ description:+ "Film a still along an exact camera path: an orbit set by numbers (degrees, direction seen from above, a height tilt, a radius pulse) or a ready move (Orbit 360°, arcs, a tilted ring, a figure of eight, dollies, trucks) — Fuobe's Fly around. " ++ "In the cloud MiniMax H3 Max camera controls follows the path as keyframes from the still (5 s at 768P is $0.40 at list price); with other views of the subject, MiniMax H3 Max takes them as references and the path goes in words. " ++ "On your GPU MoGe 2 measures the still's depth, the studio renders the path through it, and Wan 2.1 with Uni3C films the still along that render: free, about 5 s, a large GPU (about 48 GB). Gated by the same approval card as generate.",+ schema: FlyAroundToolInput,+ gated: true,+ title: (i) => (i.preset ? `Fly around: ${PATH_PRESETS.find((p) => p.id === i.preset)?.name ?? i.preset}` : `Fly around: ${i.degrees ?? 360}°`),+ plan: (i, ctx) => {+ try {+ return planSteps("fly_around", flyAroundSteps(i, ctx));+ } catch (e) {+ return [{ tool: "fly_around", modelId: "fly-around", modelName: "Fly around", kind: "video", op: "camera-path", prompt: "Fly around", count: 0, costUsd: 0, demo: false, atomic: true, error: (e as Error).message }];+ }+ },+ async run(i, ctx) {+ let steps: PipelineStep[];+ try {+ steps = flyAroundSteps(i, ctx);+ } catch (e) {+ return { content: JSON.stringify({ error: (e as Error).message }), isError: true };+ }+ return startPipeline("Fly around", steps, "Fly around");+ },+});++export const STUDIO_TOOLS = [splitLayers, restyleFootage, dubVideo, facelessEpisode, createAds, addCaptions, restoreVideo, blockoutFilm, flyAround];/** For tests: the fallback pipelines, as they would be created. */-export const fallbackSteps = { restore: restoreSteps, layers: layerSteps, restyle: restyleSteps, dub: dubSteps, faceless: facelessSteps, captions: captionSteps, ads: adRequests, blockout: blockoutSteps };+export const fallbackSteps = { restore: restoreSteps, layers: layerSteps, restyle: restyleSteps, dub: dubSteps, faceless: facelessSteps, captions: captionSteps, ads: adRequests, blockout: blockoutSteps, flyAround: flyAroundSteps };diff --git a/src/server/canvas.ts b/src/server/canvas.tsindex a9dc3520..3ec671bd 100644--- a/src/server/canvas.ts+++ b/src/server/canvas.ts@@ -1,4 +1,6 @@import "server-only";+import { MAX_KEYS } from "@/lib/camera-path";+import { CameraKeySchema, ExactOrbitSchema } from "./fly-around";import fs from "node:fs";import { nanoid } from "nanoid";import { z } from "zod";@@ -103,6 +105,8 @@ const NODE_TYPES = ["translate","concat","table",+ "camera-path",+ "fly-around","output","note",] as const satisfies readonly CanvasNodeType[];@@ -169,6 +173,11 @@ const NodeData = z.object({rows: z.array(z.array(z.string().max(TABLE_LIMITS.cell)).max(TABLE_LIMITS.columns)).max(TABLE_LIMITS.rows * 2).optional(),// Translate (video) on the open engine: the dub it started in Translate & dub.dubId: z.string().max(40).optional(),+ // Camera path (N7-7): a preset, an exact orbit or keys; Fly around: the clip's length.+ pathPreset: z.string().max(40).optional(),+ orbit: ExactOrbitSchema.optional(),+ keys: z.array(CameraKeySchema).min(1).max(MAX_KEYS).optional(),+ duration: z.number().min(1).max(15).optional(),});const Num = z.number().finite();diff --git a/src/server/cinema-schemas.ts b/src/server/cinema-schemas.tsindex 78f091f0..f707a82f 100644--- a/src/server/cinema-schemas.ts+++ b/src/server/cinema-schemas.ts@@ -112,6 +112,10 @@ export const GenerateBody = z.object({modelId: z.string().max(80).optional(),prompt: z.string().max(60_000).default(""),moves: z.array(z.string().max(40)).max(12).optional(),+ // N7-7: the first move as an exact orbit.+ exact: z+ .object({ degrees: z.number().min(30).max(360), direction: z.enum(["cw", "ccw"]), tilt: z.number().min(0).max(20).optional(), pulse: z.number().min(0).max(0.25).optional() })+ .optional(),settings: DirectorSchema.optional(),images: z.array(FileRef).max(30).optional(),videos: z.array(FileRef).max(10).optional(),diff --git a/src/server/fly-around.ts b/src/server/fly-around.tsindex 44a2ae58..bdb07cdb 100644--- a/src/server/fly-around.ts+++ b/src/server/fly-around.ts@@ -43,8 +43,11 @@ export const FlyAroundSchema = z.object({prompt: z.string().max(1500).optional(),duration: z.number().min(1).max(15).optional(),resolution: z.string().max(10).optional(),- /** Where the run is filed: Fuobe DoP's move, Image to 3D or Canvas (default "fly-around"). */- feature: z.enum(["fly-around", "motion", "model3d", "canvas", "assist"]).optional(),+ /** Where the run is filed: the studio's feed it starts from (default "fly-around"). */+ feature: z+ .string()+ .regex(/^[a-z0-9][a-z0-9-]{0,39}$/)+ .optional(),title: z.string().max(80).optional(),seed: z.number().int().min(0).max(4_294_967_295).optional(),requestId: z.string().max(80).optional(),diff --git a/src/server/generations.ts b/src/server/generations.tsindex 9d2d2f98..e1e6a8f5 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -1335,7 +1335,8 @@ async function advanceDependents(): Promise<void> {// depth step hands on a demo render.for (let i = 0; i < slots.length; i++) {if (slots[i].render !== "path") continue;- const photo = request.inputs?.images?.[0];+ // The still, once the other slots are in (it can come from an earlier step too: a Canvas node's picture).+ const photo = withChainInputs({ ...request, chain: slots }, values as string[]).inputs?.images?.[0];const keys = request.params?.cameraPath ?? [];if (deps[i]!.provider === "mock" || !photo) values[i] = placeholderFor(slots[i]);else {diff --git a/src/server/gpu/tools.ts b/src/server/gpu/tools.tsindex b4f9e5a1..d7b39d55 100644--- a/src/server/gpu/tools.ts+++ b/src/server/gpu/tools.ts@@ -1,4 +1,5 @@import "server-only";+import { FLY_MODELS } from "@/lib/catalog/fly-around";import { DUB_STEP_MODELS } from "@/lib/av/dub";import { SPLIT_MODEL } from "@/lib/av/split";import { REMOVE_DIALOGUE_MODELS } from "@/lib/av/remove-dialogue";@@ -185,6 +186,17 @@ export const STUDIO_ROWS: StudioRowDef[] = [{ href: "/character-swap", label: "Character swap", group: "Video", workflows: [STUDIO_WORKFLOWS.mask, STUDIO_WORKFLOWS.segment] },// Cinema's 3D scene films a still along a keyframed camera path (N7-5).{ href: "/cinema", label: "Fly path", group: "Video", steps: [{ modelId: PATH_MODELS.open, op: "camera-path" }] },+ // Exact orbits (N7-7): Fuobe DoP's and Cinema's orbit moves by their numbers, Canvas's Fly around and Assist's fly_around:+ // MoGe 2 measures the still's depth, the server renders the path, Uni3C films along it.+ {+ href: "/motions",+ label: "Exact orbits and Fly around",+ group: "Video",+ steps: [+ { modelId: FLY_MODELS.depth, op: "scene-3d" },+ { modelId: FLY_MODELS.open, op: "camera-path" },+ ],+ },// Cinema's Blockout to film on your GPU: the first frame from the references, the depth cut into windows, each window// rendered by the blockout graph and handed over on its last frame, then joined. An upload without a depth pass (the// usual Blender render) runs the restyle graph instead, which reads the depth with Depth Anything 3. The projects listdiff --git a/tests/assist-context.test.ts b/tests/assist-context.test.tsindex 8ab60932..ce265f49 100644--- a/tests/assist-context.test.ts+++ b/tests/assist-context.test.ts@@ -374,6 +374,10 @@ describe("studio tools", () => {create_ads: [{ brief: "oat milk for runners" }, { brief: "oat milk", product_image: image, count: 2, aspect_ratios: ["1:1", "9:16"] }],add_captions: [{ video }, { video, translate_to: "Spanish" }],restore_video: [{ video }, { video, prompt: "a harbour in the 1930s, natural colour", reference: image }],+ fly_around: [+ { image, degrees: 180, direction: "cw", tilt: 10, pulse: true },+ { image, preset: "orbit_90_ccw", views: [image], duration: 8 },+ ],blockout_film: [{ video, seconds: 8, beats: [{ start: 0, label: "Arrival", words: "She walks in." }] },{ video, seconds: 40, beats: [{ start: 0, label: "Arrival" }, { start: 20, label: "Lights out" }], references: [{ url: image, role: "character", name: "Mara" }], model: "minimax-h3-max-3d", sounds: ["Footsteps"] },diff --git a/tests/fly-around.test.ts b/tests/fly-around.test.tsindex 9d01d760..793b7f56 100644--- a/tests/fly-around.test.ts+++ b/tests/fly-around.test.ts@@ -199,3 +199,152 @@ describe("/api/fly-around", () => {}});});++describe("Cinema's Director: an orbit move with the Exact switch", () => {+ const still = "/api/files/uploads/still.png";+ const base = (engine: "cloud" | "open", over: Record<string, unknown> = {}) => ({ engine, mode: "video" as const, action: "generate" as const, prompt: "She smiles", settings: {}, moves: ["drone-orbit", "slow-zoom-in"], images: [still], ...over });++ it("films the numbers on both engines, the other moves stay words", async () => {+ const { planCinema } = await import("@/lib/catalog/cinema");+ const exactOrbit = { degrees: 180, direction: "cw" as const, tilt: 10, pulse: 0 };+ const cloud = planCinema(base("cloud", { exact: exactOrbit }), { cloudAllowed: true });+ expect(cloud.blocker).toBeUndefined();+ expect(cloud.steps.map((s) => s.request.modelId)).toEqual(["minimax-h3-max-camera"]);+ expect(cloud.steps[0].request.params?.cameraPath).toEqual(exact.exactOrbitKeys(exactOrbit));+ expect(cloud.steps[0].request.prompt).toMatch(/She smiles/);+ expect(cloud.notes[0]).toBe("Drone Orbit follows your numbers exactly: 180° clockwise · tilt 10°");+ const open = planCinema(base("open", { exact: exactOrbit }), { cloudAllowed: true });+ expect(open.steps.map((s) => [s.key, s.request.modelId, s.after])).toEqual([+ ["depth", "oss-scene-moge", undefined],+ ["main", "oss-uni3c-path", ["depth"]],+ ]);+ expect(open.costUsd).toBe(0);+ });++ it("keeps the LoRA's or the prompt's orbit with the switch off, and asks for a start frame with it on", async () => {+ const { planCinema } = await import("@/lib/catalog/cinema");+ const loose = planCinema(base("cloud"), { cloudAllowed: true });+ expect(loose.steps[0].request.modelId).not.toBe("minimax-h3-max-camera");+ expect(planCinema(base("cloud", { exact: { degrees: 90, direction: "ccw" }, images: [] }), { cloudAllowed: true }).blocker).toBe("Add a start frame to film an exact orbit");+ // A move that isn't an orbit ignores the numbers.+ expect(planCinema(base("cloud", { moves: ["dolly-in"], exact: { degrees: 90, direction: "ccw" } }), { cloudAllowed: true }).steps[0].request.modelId).not.toBe("minimax-h3-max-camera");+ });+});++describe("Image to 3D: Film it photoreal", () => {+ it("films the photo round the model: the model's render on your GPU, H3 Max's keyframes in the cloud", async () => {+ const m3d = await import("@/lib/av/model3d");+ const open = m3d.photorealBody({ photo: "/api/files/uploads/mug.png" }, "open", "/api/files/uploads/orbit.webm")!;+ expect(open).toMatchObject({ engine: "open", image: "/api/files/uploads/mug.png", render: "/api/files/uploads/orbit.webm", feature: m3d.MODEL3D_FILM_FEATURE, orbit: m3d.PHOTOREAL_ORBIT });+ const plan = fly.planFlyAround(open);+ expect(plan.steps.map((s) => s.request.modelId)).toEqual(["oss-uni3c-path"]);+ const cloud = m3d.photorealBody({ photo: "/api/files/uploads/mug.png" }, "cloud", "/api/files/uploads/orbit.webm")!;+ expect(cloud).not.toHaveProperty("render");+ expect(fly.planFlyAround(cloud).steps[0].request.modelId).toBe("minimax-h3-max-camera");+ expect(m3d.photorealBody({}, "cloud")).toBeNull();+ expect(m3d.photorealBody({}, "cloud", undefined, "/api/files/outputs/drawn.png")!.image).toBe("/api/files/outputs/drawn.png");+ // The model turns the other way to the camera: a full turn over the 81 frames, starting at the front.+ expect(m3d.photorealAngle(0)).toBe(0);+ expect(m3d.photorealAngle(PATH_FRAMES - 1)).toBeCloseTo(-2 * Math.PI, 5);+ });+});++describe("Canvas: the Camera path and Fly around nodes", () => {+ const node = (id: string, type: string, x: number, y: number, data: Record<string, unknown> = {}) => ({ id, type, position: { x, y }, data }) as never;+ const edge = (source: string, target: string, targetHandle: string) => ({ id: `${source}>${target}:${targetHandle}`, source, sourceHandle: "out", target, targetHandle });++ it("has the node types, ports and outputs", async () => {+ const c = await import("@/lib/catalog/canvas");+ expect(c.NODE_SPECS["camera-path"].group).toBe("Inputs");+ expect(c.NODE_SPECS["fly-around"]).toMatchObject({ group: "Generate", ops: ["camera-path"] });+ expect(c.isGenerator({ type: "fly-around" })).toBe(true);+ expect(c.isGenerator({ type: "camera-path" })).toBe(false);+ expect(c.inputPorts({ type: "fly-around", data: {} }).map((p) => [p.id, p.type, p.multiple])).toEqual([+ ["prompt", "text", true],+ ["images", "image", true],+ ["path", "path", false],+ ]);+ const g = { nodes: [], edges: [] };+ expect(c.outputType(g, node("p", "camera-path", 0, 0))).toBe("path");+ expect(c.outputType(g, node("f", "fly-around", 0, 0))).toBe("video");+ expect(c.acceptsType("preview", "path")).toBe(false);+ expect(c.defaultModelForNode({ type: "fly-around", data: {} }, "open")?.id).toBe("oss-uni3c-path");+ expect(c.defaultModelForNode({ type: "fly-around", data: {} }, "cloud")?.id).toBe("minimax-h3-max-camera");+ expect(c.paletteItems().some((p) => p.id === "camera-path")).toBe(true);+ expect(c.cameraPathOf({ data: { orbit: { degrees: 90, direction: "cw", tilt: 0, pulse: 0 } } }).keys.at(-1)!.azimuth).toBe(-90);+ });++ it("compiles a still, a view and a path into the engine's steps, a generated still chained in", async () => {+ const c = await import("@/lib/catalog/canvas");+ const graph = (modelId: string, still: Record<string, unknown>) => ({+ nodes: [+ still.type === "model" ? node("img", "model", 0, 0, { modelId: "nano-banana-pro", mediaKind: "image" }) : node("img", "image-input", 0, 0, { url: "/api/files/uploads/still.png" }),+ node("view", "image-input", 0, 100, { url: "/api/files/uploads/back.png" }),+ node("path", "camera-path", 0, 200, { orbit: { degrees: 180, direction: "ccw", tilt: 0, pulse: 0 } }),+ node("fly", "fly-around", 300, 0, { modelId }),+ ],+ edges: [edge("img", "fly", "images"), edge("view", "fly", "images"), edge("path", "fly", "path")],+ });+ const cloud = c.describeNode(graph("minimax-h3-max-camera", {}) as never, graph("minimax-h3-max-camera", {}).nodes[3] as never);+ expect(cloud.error).toBeUndefined();+ expect(cloud.steps!.map((s) => [s.request.modelId, s.request.op])).toEqual([["minimax-h3-max", "ref2v"]]);+ expect(cloud.steps![0].request.inputs?.images).toEqual(["/api/files/uploads/still.png", "/api/files/uploads/back.png"]);+ const g = graph("oss-uni3c-path", { type: "model" });+ const open = c.describeNode(g as never, g.nodes[3] as never);+ expect(open.error).toBeUndefined();+ expect(open.deps).toEqual(["img"]);+ expect(open.costUsd).toBe(0);+ const [depth, main] = open.steps!;+ expect(depth).toMatchObject({ key: "depth", request: { modelId: "oss-scene-moge", chain: [{ slot: "images", position: "first" }] }, from: [{ node: "img" }] });+ expect(main).toMatchObject({ key: "main", request: { modelId: "oss-uni3c-path", chain: [{ slot: "images", position: "first" }, { slot: "video", render: "path" }] }, from: [{ node: "img" }, { step: "depth" }] });+ expect(depth.request.feature).toBe(c.CANVAS_STEP_FEATURE);+ // Nothing on the path: said on the node.+ const bare = { ...g, edges: g.edges.filter((e) => e.targetHandle !== "path") };+ expect(c.describeNode(bare as never, g.nodes[3] as never).error).toBe("Connect a Camera path");+ });+});++describe("Assist / MCP: fly_around", () => {+ it("takes a still and an orbit's numbers or a preset, and plans the engine's steps", async () => {+ const tools = await import("@/server/assist/studio-tools");+ const tool = tools.STUDIO_TOOLS.find((t) => t.name === "fly_around")!;+ expect(tool).toBeDefined();+ expect(tools.FlyAroundToolInput.safeParse({ image: "/api/files/uploads/a.png", degrees: 720 }).success).toBe(false);+ expect(tools.FlyAroundToolInput.safeParse({ image: "/api/files/uploads/a.png", preset: "orbit_90_cw" }).success).toBe(true);+ expect(tools.FlyAroundToolInput.safeParse({ image: "/api/files/uploads/a.png", preset: "spin" }).success).toBe(false);+ const ctx = { engine: "open" } as never;+ const open = tools.fallbackSteps.flyAround({ image: "/api/files/uploads/a.png", degrees: 90, direction: "cw" }, ctx);+ expect(open.map((s) => [s.key, s.request.modelId, s.after])).toEqual([+ ["depth", "oss-scene-moge", undefined],+ ["main", "oss-uni3c-path", ["depth"]],+ ]);+ const cloud = tools.fallbackSteps.flyAround({ image: "/api/files/uploads/a.png", preset: "orbit_tilt_20" }, { engine: "cloud" } as never);+ expect(cloud[0].request).toMatchObject({ modelId: "minimax-h3-max-camera", op: "camera-path" });+ });+});++describe("the GPU pre-flight board", () => {+ it("lists exact orbits on the depth and Uni3C graphs", async () => {+ const { STUDIO_ROWS, studioTool } = await import("@/server/gpu/tools");+ const row = STUDIO_ROWS.find((r) => r.href === "/motions")!;+ expect(row.label).toBe("Exact orbits and Fly around");+ const t = studioTool(row)!;+ expect(t.workflows).toEqual(expect.arrayContaining(["scene-mesh-moge", "wan21-i2v-uni3c-path"]));+ });+});++describe("an account's path render reads only its own files", () => {+ it("refuses the owner's still and depth inside an account's run, and renders the account's own", async () => {+ const auth = await import("@/server/auth");+ const { runAsTenant } = await import("@/server/tenant");+ const { RefError } = await import("@/server/storage");+ const a = auth.createAccount("[email protected]", "long enough").id;+ const owners = scene();+ const keys = exact.exactOrbitKeys({ degrees: 60, direction: "ccw" });+ await runAsTenant({ kind: "account", id: a }, async () => {+ await expect(pathScene({ ...owners, keys })).rejects.toBeInstanceOf(RefError);+ const mine = scene();+ expect((await pathScene({ ...mine, keys })).count).toBe(PATH_FRAMES);+ });+ });+});diff --git a/tests/public-signup-tools.test.ts b/tests/public-signup-tools.test.tsindex 8cae9d80..e3afc47e 100644--- a/tests/public-signup-tools.test.ts+++ b/tests/public-signup-tools.test.ts@@ -28,6 +28,7 @@ const { encodePng } = await import("@/server/png");const { createElement } = await import("@/server/elements");const turnaround = await import("@/app/api/turnaround/route");const turnaroundEstimate = await import("@/app/api/turnaround/estimate/route");+const flyAround = await import("@/app/api/fly-around/route");const audioTools = await import("@/app/api/audio-tools/route");const { STUDIO_ROWS, studioOthers, studioTool, toolFor } = await import("@/server/gpu/tools");const { loadIndex } = await import("@/server/gpu/index-file");@@ -169,6 +170,35 @@ describe("the proxy: PR #15's routes as main treats their kind", () => {});});+describe("Fly around (N7-7) under the sign-up rules", () => {+ it("opens its price check to guests and accounts, and answers its run with own-gpu-tool", async () => {+ process.env.FUOBE_PUBLIC_SIGNUP = "1";+ expect(access.isPriceCheck("POST", "/api/fly-around", "?preview=1")).toBe(true);+ expect(access.isPriceCheck("POST", "/api/fly-around", "")).toBe(false);+ const a = newAccount();+ auth.setAccountGpu(a.id, { url: "https://gpu.example" });+ const cookie = auth.createSession(a.id).value;+ for (const c of [undefined, cookie]) {+ expect(passed(proxy(req("/api/fly-around?preview=1", { method: "POST", cookie: c })))).toBe(true);+ const r = proxy(req("/api/fly-around", { method: "POST", cookie: c }));+ expect(r.status).toBe(403);+ expect((await r.json()).code).toBe("own-gpu-tool");+ }+ expect(passed(proxy(req("/api/fly-around", { method: "POST", cookie: auth.createSession().value })))).toBe(true);+ });++ it("prices a visitor's fly-around for its own GPU, never a demo", async () => {+ process.env.FUOBE_PUBLIC_SIGNUP = "1";+ const image = png("fly.png");+ const account = auth.createSession(newAccount().id).value;+ for (const cookie of [undefined, account]) {+ const r = await flyAround.POST(call("/api/fly-around?preview=1", { engine: "open", image, orbit: { degrees: 90, direction: "cw" } }, cookie));+ expect(r.status).toBe(200);+ expect(await r.json()).toMatchObject({ engine: "open", demo: false, costUsd: 0, steps: 2 });+ }+ });+});+describe("the routes: a visitor's price is its own GPU's, and the owner's characters stay hidden", () => {it("prices a guest's and an account's turnaround on their own GPU, never a demo; the owner's stays the install's", async () => {process.env.FUOBE_PUBLIC_SIGNUP = "1";