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
Templates: show the full look, make one shot in its film, and a framing tip
Adarsh491f3393d07f
diff --git a/src/app/api/starters/[id]/route.ts b/src/app/api/starters/[id]/route.tsindex 93e61a40..5a9a7d7d 100644--- a/src/app/api/starters/[id]/route.ts+++ b/src/app/api/starters/[id]/route.ts@@ -6,7 +6,8 @@ import { guestRun, toolViewer } from "@/server/account-tool-run";import { asAccount } from "@/server/generations";import { createFromStarter, StarterError } from "@/server/starters";-const Body = z.object({ engine: z.enum(["cloud", "open"]).default("cloud") });+/** `shot`: one shot of a ready film ("Make this shot"), opened in its film. */+const Body = z.object({ engine: z.enum(["cloud", "open"]).default("cloud"), shot: z.number().int().min(1).max(12).optional() });/*** The owner's "Use template" on a ready-made starter: makes it (a channel set up for its first episode, a brand kit with@@ -27,7 +28,7 @@ export async function POST(request: Request, { params }: RouteContext<"/api/starconst parsed = Body.safeParse(await request.json().catch(() => ({})));if (!parsed.success) return Response.json({ error: "Pick an engine" }, { status: 400 });try {- const make = () => createFromStarter(id, parsed.data.engine);+ const make = () => createFromStarter(id, parsed.data.engine, parsed.data.shot);return Response.json(await (viewer.kind === "account" ? asAccount(viewer.account.id, make) : make()), { status: 201 });} catch (e) {// A studio's own refusal (an engine this install doesn't use, a missing photo, an account's limit of projects) keeps its status.diff --git a/src/components/cinema/draft.ts b/src/components/cinema/draft.tsindex f94508fd..25601362 100644--- a/src/components/cinema/draft.ts+++ b/src/components/cinema/draft.ts@@ -1,4 +1,4 @@-import { DURATION, type CinemaAction, type CinemaGenerateInput, type CinemaMode, type DirectorSettings, type GridSize, type GridType } from "@/lib/catalog/cinema";+import { DEFAULT_ASPECT, 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";@@ -66,7 +66,7 @@ export const initialDraft = (): CinemaDraft => ({models: {},duration: DURATION.default,resolution: { video: "720p", image: "1K" },- aspect: { video: "16:9", image: "16:9" },+ aspect: { video: DEFAULT_ASPECT, image: DEFAULT_ASPECT },batch: 1,audio: true,multiShot: { mode: "off", shots: [] },diff --git a/src/components/cinema/workspace.tsx b/src/components/cinema/workspace.tsxindex c2e0e55e..7f5ed30c 100644--- a/src/components/cinema/workspace.tsx+++ b/src/components/cinema/workspace.tsx@@ -40,6 +40,7 @@ import { SoulCastDialog, SoulLocationDialog } from "./soul-builders";import { BlockoutPanel, initialBlockout, withBuilt, type BlockoutDraft } from "./blockout-panel";import { WorldPanel } from "./world-panel";import type { BlockoutScene } from "@/lib/blockout";+import { proposedShotLine } from "@/lib/starters/types";/** What a browser that can only write WebM is told: Seedance 2.5 takes MP4 or MOV reference clips. */const WEBM_BLOCKOUT = "This browser saved the blockout as WebM, which Seedance 2.5 doesn't take: render it in Chrome or Edge, upload an MP4 from your 3D app, or film it on your GPU.";@@ -202,12 +203,6 @@ function LoadProposedShot({ projectId, n, onLoad }: { projectId: string; n: numbreturn null;}-/** The empty project's line once a starter's shot 1 is in the prompt bar: where the other shots are. */-function proposedLine(of: number) {- const rest = of === 2 ? "Shot 2 is" : of === 3 ? "Shots 2 and 3 are" : `Shots 2 to ${of} are`;- return `Shot 1 of ${of} is ready below. ${rest} in the AI Director.`;-}-function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaGeneration[]; loading: boolean }) {const { project, folders, spentUsd, context } = data;const id = project.id;@@ -255,8 +250,8 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaG// Blockout to film: the composer's panel (its draft kept while the project is open) and the builder.// /cinema/<id>?blockout=1 (a link to Blockout to film) opens it.const search = useSearchParams();- // A starter's film: how many shots the AI Director proposed, once shot 1 is in the prompt bar.- const [starterShots, setStarterShots] = useState(0);+ // A starter's film: the shot in the prompt bar and how many the AI Director proposed.+ const [starterShot, setStarterShot] = useState<{ n: number; of: number } | null>(null);const [blockoutOpen, setBlockoutOpen] = useState(() => search.get("blockout") === "1");// World mode: /cinema/<id>?world=1 (the GPU board's World mode row) opens it. Hidden when the engine mode is "Paid APIs// only": Hy-Nomas runs on your GPU alone.@@ -443,8 +438,8 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaG<Empty icon={Library} title="No generations yet" text="Everything you make in Cinema Studio, in any project, shows up here." />) : currentView.kind === "folder" ? (<Empty icon={FolderOpen} title="An empty scene" text="Describe a scene below and hit Generate — new takes land in this folder." />- ) : starterShots > 1 ? (- <Empty icon={Clapperboard} title="Your first shot" text={proposedLine(starterShots)} />+ ) : starterShot && starterShot.of > 1 ? (+ <Empty icon={Clapperboard} title="Your first shot" text={proposedShotLine(starterShot.n, starterShot.of)} />) : (<Empty icon={Clapperboard} title="Your first shot" text="Start by describing a scene and pressing “Generate”. Set the genre, camera, palette and light in the Director's Panel." />);@@ -478,7 +473,7 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaGn={proposedShot}onLoad={(s, of) => {onLoadShot(s);- setStarterShots(of);+ setStarterShot({ n: proposedShot, of });// On a wide screen the AI Director shows the other shots beside the work.if (xl) setPanel("director");}}diff --git a/src/components/starters/starter-page.tsx b/src/components/starters/starter-page.tsxindex 6ed34c93..2841c67d 100644--- a/src/components/starters/starter-page.tsx+++ b/src/components/starters/starter-page.tsx@@ -1,18 +1,49 @@"use client";-import { ArrowLeft, ArrowRight, Loader2, Plus } from "lucide-react";+import { ArrowLeft, ArrowRight, Clapperboard, Loader2, Plus } from "lucide-react";import Link from "next/link";import { Button } from "@/components/ui/button";import { PageShell } from "@/components/page-shell";import { SelfHostNote } from "@/components/self-host-note";import { CoverArt, CoverImg, useCoverPlayback } from "@/components/template-cover";import { useIsOwner, useIsVisitor } from "@/lib/api";-import { STARTER_SURFACES, VISITOR_MAKES, starterShown, type StarterCardData, type StarterInput } from "@/lib/starters/types";+import { STARTER_SURFACES, VISITOR_MAKES, lookLine, starterShown, type StarterCardData, type StarterInput, type StarterLookItem } from "@/lib/starters/types";import { StarterIcon } from "./starter-icon";-import { useStarterUse } from "./starter-section";+import { shotKey, useStarterUse } from "./starter-section";import { StepsGlyph } from "./steps-glyph";-function Input({ input }: { input: StarterInput }) {+/**+ * The look it is made in, in the studio's own words ("Epic · Anamorphic · Silhouette · Oil & Ochre · 16:9"): with the+ * shots' words, the whole recipe.+ */+export function StarterLook({ look, className }: { look: StarterLookItem[]; className?: string }) {+ return (+ <div className={className}>+ <p className="sr-only">Look: {lookLine(look)}</p>+ <ul aria-hidden className="flex flex-wrap items-center gap-1.5">+ <li className="mr-0.5 text-[12px] font-semibold tracking-wide text-muted-foreground uppercase">Look</li>+ {look.map((i) => (+ <li key={i.name} className="inline-flex h-7 items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12.5px] font-medium text-secondary-foreground">+ {i.swatch && (+ <span className="flex -space-x-1">+ {i.swatch.map((c, n) => (+ <span key={n} className="size-3 rounded-full ring-2 ring-secondary" style={{ background: c }} />+ ))}+ </span>+ )}+ {i.name}+ </li>+ ))}+ </ul>+ </div>+ );+}++/**+ * One thing that goes in. A ready film's shot offers "Make this shot": the film opens with that shot in its prompt bar,+ * in the film's look and shape (`onMake`).+ */+function Input({ input, onMake, busy }: { input: StarterInput; onMake?: () => void; busy?: boolean }) {return (<li className="rounded-xl border bg-card p-3.5"><div className="flex items-start gap-3">@@ -30,6 +61,11 @@ function Input({ input }: { input: StarterInput }) {<audio controls preload="none" src={input.audio.src} aria-label={input.audio.name} className="mt-2 h-9 w-full" />)}{input.text && <p className="mt-2 rounded-lg bg-muted/60 px-3 py-2 text-[13px] text-pretty whitespace-pre-line">{input.text}</p>}+ {onMake && (+ <Button variant="outline" size="sm" className="mt-2.5 rounded-full px-3" onClick={onMake} disabled={busy} aria-label={`Make ${input.label.toLowerCase()} in this look`}>+ {busy ? <Loader2 className="animate-spin" /> : <Clapperboard />} Make this shot+ </Button>+ )}</li>);}@@ -62,6 +98,10 @@ export function StarterPage({ s }: { s: StarterCardData }) {}const heading = "text-[13px] font-semibold tracking-wide text-muted-foreground uppercase";+ // The owner, or a visitor where a ready one is theirs to make (a guest is asked to sign up first, then comes back here).+ const makes = owner || VISITOR_MAKES.has(s.surface);+ // A ready film: each shot can be made alone, in the film's look.+ const shots = makes && s.use.kind === "create" && s.inputs.some((i) => i.shot);const cover = s.cover;return (@@ -105,25 +145,27 @@ export function StarterPage({ s }: { s: StarterCardData }) {<h1 className="font-heading text-[30px] leading-tight text-balance">{s.name}</h1></div><p className="mt-2 text-[15px] text-pretty text-muted-foreground">{s.description}</p>+ {s.look?.length ? <StarterLook look={s.look} className="mt-3" /> : null}- {owner || VISITOR_MAKES.has(s.surface) ? (+ {makes ? (<div className="mt-4 flex flex-wrap items-center gap-3">{s.use.kind === "fill" ? (- <Button asChild className="rounded-full">+ <Button asChild size="lg" className="rounded-full px-4"><Link href={s.use.href}><Plus /> Use template</Link></Button>) : (- <Button className="rounded-full" onClick={() => void use(s)} disabled={busy === s.id}>+ <Button size="lg" className="rounded-full px-4" onClick={() => void use(s)} disabled={busy === s.id}>{busy === s.id ? <Loader2 className="animate-spin" /> : <Plus />} Use template</Button>)}+ {shots && <p className="basis-full text-[13px] text-muted-foreground">The whole film opens in {surface.name}: its look, its brief and every shot, ready to make.</p>}</div>) : s.tryIn ? (// A guest or an account makes the same from the same photo in its app, the example loaded there.<div className="mt-4 flex flex-wrap items-center gap-3">- <Button asChild className="rounded-full">+ <Button asChild size="lg" className="rounded-full px-4"><Link href={s.tryIn.href}>{s.tryIn.text ?? `Try it in ${s.tryIn.label}`} <ArrowRight /></Link>@@ -139,7 +181,7 @@ export function StarterPage({ s }: { s: StarterCardData }) {</h2><ul className="mt-2 space-y-2">{s.inputs.map((i) => (- <Input key={i.label} input={i} />+ <Input key={i.label} input={i} onMake={shots && i.shot ? () => void use(s, i.shot) : undefined} busy={!!i.shot && busy === shotKey(s.id, i.shot)} />))}</ul></section>diff --git a/src/components/starters/starter-section.tsx b/src/components/starters/starter-section.tsxindex 9efa9d50..e4c702d4 100644--- a/src/components/starters/starter-section.tsx+++ b/src/components/starters/starter-section.tsx@@ -36,9 +36,13 @@ export function useStarters(surface: StarterSurface, starters: StarterCardData[]return { owner, starters: mine?.starters ?? starters, fills: mine ? { ...fills, ...mine.fills } : fills };}+/** What is busy while one shot of a ready film is being opened ("Make this shot"), beside its starter's own id. */+export const shotKey = (id: string, shot: number) => `${id}#shot-${shot}`;+/*** The owner's "Use template": a starter made on the server (POST /api/starters/<id>) opens where it answers; one that- * fills a composer fills it here (`onFill`, on its own studio's page) or opens its studio with `?starter=`.+ * fills a composer fills it here (`onFill`, on its own studio's page) or opens its studio with `?starter=`. `shot`: one+ * shot of a ready film, which opens in that film with the shot in its prompt bar (busy as `shotKey`).*/export function useStarterUse(onFill?: (id: string) => void) {const router = useRouter();@@ -48,15 +52,20 @@ export function useStarterUse(onFill?: (id: string) => void) {// The page it opens may be this one (Click to Ad, Marketing Studio): busy until that address has rendered.const [opening, setOpening] = useState<string | null>(null);const [navigating, startTransition] = useTransition();- const use = async (s: StarterCardData) => {+ const use = async (s: StarterCardData, shot?: number) => {if (s.use.kind === "fill" || s.use.kind === "link") {if (onFill && s.use.kind === "fill") onFill(s.id);else router.push(s.use.href);return;}- setMaking(s.id);+ const key = shot ? shotKey(s.id, shot) : s.id;+ setMaking(key);try {- const res = await fetch(`/api/starters/${encodeURIComponent(s.id)}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ engine }) });+ const res = await fetch(`/api/starters/${encodeURIComponent(s.id)}`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ engine, ...(shot && { shot }) }),+ });const body = (await res.json().catch(() => ({}))) as { href?: string; note?: string; error?: string };if (!res.ok || !body.href) throw responseError(res, body.error ?? "That starter didn't come out right — try again, or pick another.");// What it made (a brand, a product, a channel, a film, an element) is in the lists the next page picks it from,@@ -67,7 +76,7 @@ export function useStarterUse(onFill?: (id: string) => void) {const href = body.href;// What to do with it next (an element's @name), where it opens.if (body.note) toast.success(body.note);- setOpening(s.id);+ setOpening(key);startTransition(() => router.push(href));} catch (e) {toastError(e);diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex bdc763ce..fa54a40e 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -159,6 +159,7 @@ import { useVoiceFirstLive, useVoiceFirstShown, VoiceFirstSwitch } from "@/compoimport { VOICE_FIRST_PARAM, voiceFirstDefault } from "@/lib/av/voice-first";import { FixFacesAfterSwitch } from "@/components/fix-faces/fix-faces-switch";import { FIX_FACES_AFTER_PARAM, fixFacesAfterOffered } from "@/lib/catalog/fix-faces";+import { framingLabel, framingSuggestion } from "@/lib/framing-hint";import { useSignature } from "../palettes/use-signature";import { placeholdersOn } from "@/lib/demo-mode";import { FILM_LOOK_PARAM, takesFilmLooks } from "@/lib/film-looks";@@ -359,6 +360,8 @@ export function Composer({ docked }: { docked: boolean }) {const [voiceFirstAsked, setVoiceFirstAsked] = useState<boolean | null>(null);// "Fix faces" after an H3 video from a start picture: off until turned on.const [fixFacesAsked, setFixFacesAsked] = useState(false);+ // The framing tip (a wide scene with a person, asked as a small square): "Keep 1:1" puts it away for this composer.+ const [framingKept, setFramingKept] = useState(false);const voiceFirstKind: "audio" | "video" | null = !config.voiceFirst ? null : typed.slots.audio?.ref ? "audio" : typed.slots.video?.ref && config.ops.includes("transcribe") ? "video" : null;const draft = useMemo(() =>@@ -1287,6 +1290,17 @@ export function Composer({ docked }: { docked: boolean }) {// Enhance writes a scene; a tool's optional words (FLUX.3 Upscale's details) stay as typed.const baseShape = settingsShape(model, effectiveOp, config.kind, showPrompt && !config.hidePrompt, p, config.ops, studioFormats);const shape = framesCtx ? framesShape(baseShape, framesCtx.chained) : layoutOn ? layoutShape(baseShape) : baseShape;+ // An image of a wide scene with a person in it, asked as a small square: one tap makes it 16:9 at a larger size.+ const framing =+ config.kind === "image" && !framingKept && !layoutOn && !framesOn && model+ ? framingSuggestion({+ prompt: draft.prompt,+ aspect: p.aspectRatio ?? model.defaults?.aspectRatio,+ resolution: p.resolution ?? model.defaults?.resolution,+ aspects: shape.aspect,+ resolutions: shape.resolution,+ })+ : null;const outcome = config.clipFacts && draft.slots.video?.ref ? clipOutcome(effectiveOp, facts, p, model, today) : null;const video = draft.slots.video?.ref;const alternative = config.comfyOnly?.alternative;@@ -2497,6 +2511,28 @@ export function Composer({ docked }: { docked: boolean }) {{sketched.note && <p className="px-2 pt-1 text-[12px] text-muted-foreground">{sketched.note}</p>}{signed.notes.length > 0 && <p className="px-2 pt-1 text-[12px] text-muted-foreground">{signed.notes.join(" · ")}</p>}{smallGpuNote && <p className="px-2 pt-1 text-[12px] text-muted-foreground">{smallGpuNote}</p>}+ {framing && (+ <div role="note" className="mx-1 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-xl border bg-brand-faint px-3 py-2 text-[12px] leading-snug">+ <p className="min-w-0 flex-1 basis-56 text-muted-foreground">+ <span className="font-medium text-foreground">A wide frame suits this scene.</span> {framing.aspectRatio}+ {framing.resolution ? ` at ${framing.resolution}` : ""} gives the figure room and keeps faces crisp and detailed.+ </p>+ <div className="flex items-center gap-1.5">+ <Button+ size="sm"+ variant="secondary"+ className="h-7 rounded-full px-3"+ onMouseDown={(e) => e.preventDefault()}+ onClick={() => setP({ aspectRatio: framing.aspectRatio, ...(framing.resolution && { resolution: framing.resolution }) })}+ >+ {framingLabel(framing)}+ </Button>+ <Button size="sm" variant="ghost" className="h-7 rounded-full px-2.5 text-muted-foreground" onMouseDown={(e) => e.preventDefault()} onClick={() => setFramingKept(true)}>+ Keep 1:1+ </Button>+ </div>+ </div>+ )}{model && !framesOn && <EndFrameNote model={model} start={draft.slots.image} end={draft.slots.endImage} hasStartSlot={slots.some((s) => s.key === "image")} setSlot={setSlot} />}{model && op && model.options.endFrame === undefined && draft.slots.endImage?.ref && (<p className="px-2 pt-1 text-[12px] text-warning">{model.name} ignores the end frame — pick Kling 2.5, Veo 3.1, Seedance or Wan 2.2 to use it.</p>diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.tsindex 928aeb4a..500e7e0b 100644--- a/src/lib/catalog/cinema.ts+++ b/src/lib/catalog/cinema.ts@@ -643,6 +643,8 @@ export const MAX_LIGHTS = 2;// ---------------------------------------------------------------------------// Generation settings (cinemaStudio.videoModes, imageMode, references)+/** The shape a new take starts at, a still or a clip: the prompt bar's first pick, and a ready film's look line. */+export const DEFAULT_ASPECT = "16:9";export const VIDEO_ASPECTS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];export const IMAGE_ASPECTS = ["16:9", "21:9", "3:2", "4:3", "1:1", "3:4", "2:3", "9:16"];export const VIDEO_RESOLUTIONS = ["480p", "720p", "1080p"];diff --git a/src/lib/framing-hint.ts b/src/lib/framing-hint.tsnew file mode 100644index 00000000..677109e0--- /dev/null+++ b/src/lib/framing-hint.ts@@ -0,0 +1,69 @@+/**+ * The Image studio's framing tip: a wide scene with a person in it (an aerial shot, a full-length look, a model on a+ * dune) asked for as a small square comes out with a small figure and soft faces. The composer offers a wider, larger+ * frame in one tap; the run is never held back. Plain words, read in the browser as the prompt is typed.+ */++/** Words that frame a whole scene or a whole figure: a square at a small size leaves the face only a few pixels. */+const WIDE = /\b(aerial|drone|birds?['’]?[- ]eye|wide[- ](?:shot|angle)|extreme wide|establishing shot|full[- ](?:body|length)|head[- ]to[- ]toe|long shot|panoram(?:a|ic))\b/i;++/** A big place around the figure. */+const SCENE = /\b(vast|landscape|dunes?|desert|horizon|crest|ridge|mountains?|mountaintop|cliffs?|canyon|valley|beach|coastline|shoreline|meadow|skyline)\b/i;++/** Someone in the picture. */+const PERSON =+ /\b(model|models|woman|women|man|men|girl|girls|boy|boys|person|people|she|he|her|him|couple|dancer|figure|bride|groom|lady|actress|actor|rider|surfer|athlete|hiker|family)\b/i;++/** A close framing: the face is already big in a square. */+const CLOSE = /\b(close[- ]?up|headshot|head shot|portrait|macro|detail shot)\b/i;++/** A wide or full-length scene with a person in it. A close-up is left alone unless the words also ask for the wide frame. */+export function widePersonPrompt(prompt: string): boolean {+ const p = prompt.trim();+ if (!p || !PERSON.test(p)) return false;+ return WIDE.test(p) || (SCENE.test(p) && !CLOSE.test(p));+}++/** A size as a number of K ("1K" 1, "1.5K" 1.5, "4MP" 2, "1024" 1); NaN when it isn't one. */+export function sizeK(v: string | undefined): number {+ if (!v) return NaN;+ const k = /^(\d+(?:\.\d+)?)\s*k$/i.exec(v.trim());+ if (k) return Number(k[1]);+ const mp = /^(\d+(?:\.\d+)?)\s*mp$/i.exec(v.trim());+ if (mp) return Math.sqrt(Number(mp[1]));+ const px = /^(\d{3,4})(?:px)?$/i.exec(v.trim());+ return px ? Number(px[1]) / 1024 : NaN;+}++/** What one tap sets: the wide shape, and a larger size when the model offers one. */+export interface FramingFix {+ aspectRatio: string;+ resolution?: string;+}++/** The size a wide scene is offered at: up to 2K. */+const TARGET_K = 2;+/** A square this size or smaller is a small square. */+const SMALL_K = 1.5;+export const WIDE_ASPECT = "16:9";++/**+ * The tip for this prompt and these settings, or null. `aspects` and `resolutions` are what the model offers for this+ * run (null when the run's shape is not picked here, like an edit that follows its picture).+ */+export function framingSuggestion(input: { prompt: string; aspect: string | undefined; resolution: string | undefined; aspects: string[] | null; resolutions: string[] | null }): FramingFix | null {+ const { prompt, aspect, resolution, aspects, resolutions } = input;+ if (aspect !== "1:1" || !aspects?.includes(WIDE_ASPECT)) return null;+ const now = sizeK(resolution);+ if (now > SMALL_K) return null;+ if (!widePersonPrompt(prompt)) return null;+ // The largest size up to 2K that is larger than now.+ const bigger = (resolutions ?? [])+ .map((r) => ({ r, k: sizeK(r) }))+ .filter((x) => x.k <= TARGET_K && (Number.isNaN(now) || x.k > now))+ .sort((a, b) => b.k - a.k)[0];+ return { aspectRatio: WIDE_ASPECT, ...(bigger && { resolution: bigger.r }) };+}++/** The tap's words: "Use 16:9 · 2K". */+export const framingLabel = (fix: FramingFix) => `Use ${[fix.aspectRatio, fix.resolution].filter(Boolean).join(" · ")}`;diff --git a/src/lib/starters/catalog.ts b/src/lib/starters/catalog.tsindex ee0a0d75..a4ea91fe 100644--- a/src/lib/starters/catalog.ts+++ b/src/lib/starters/catalog.ts@@ -32,7 +32,8 @@ import { EXPLAINER_STARTERS } from "./explainer";import { FACELESS_STARTERS } from "./faceless";import { LIBRARY_STARTERS } from "./library";import { STORYBOARD_STARTERS } from "./storyboard";-import { STARTER_SURFACES, type StarterCardData, type StarterFill, type StarterInput, type StarterSurface } from "./types";+import { cinemaLook, storyboardLook } from "./look";+import { STARTER_SURFACES, type StarterCardData, type StarterFill, type StarterInput, type StarterLookItem, type StarterSurface } from "./types";/** A sample file a starter brings: a published example input (src/lib/examples/media.generated.ts). */export interface StarterSample {@@ -248,18 +249,31 @@ export function starterCover(s: Pick<Starter, "id" | "coverFrom" | "coverOf">):const AUDIO = /\.(m4a|mp3|wav|ogg|aac)$/i;function inputs(s: Starter): StarterInput[] {- const photo = s.seed.kind === "product" ? s.seed.kit.product.image : undefined;+ const seed = s.seed;+ const photo = seed.kind === "product" ? seed.kit.product.image : undefined;return [...(photo ? [{ label: "Product photo", image: { thumb: EXAMPLE_MEDIA[photo.src]?.thumb ?? photo.src, name: photo.name } }] : []),...(s.samples ?? []).map((f) =>AUDIO.test(f.src) ? { label: f.label, audio: { src: f.src, name: "A recording" } } : { label: f.label, image: { thumb: exampleFrame(f.src)?.thumb ?? f.src, name: "A photo" } },),- ...s.words.map((w) => ({ label: w.label, text: w.text })),+ ...s.words.map((w) => {+ // A film's shot, by its words: its page makes that shot alone, in the film's look.+ const shot = seed.kind === "cinema" ? seed.shots.findIndex((x) => x.prompt === w.text) + 1 : 0;+ return { label: w.label, text: w.text, ...(shot > 0 && { shot }) };+ }),];}+/** The look a starter is made in, as its studio names it: a film's Director settings, a story's look and shape. */+function lookOf(s: Starter): StarterLookItem[] | undefined {+ if (s.seed.kind === "cinema") return cinemaLook(s.seed.director);+ if (s.seed.kind === "storyboard") return storyboardLook(s.seed);+ return undefined;+}+export function starterCard(s: Starter): StarterCardData {const cover = starterCover(s);+ const look = lookOf(s);return {id: s.id,surface: s.surface,@@ -272,6 +286,7 @@ export function starterCard(s: Starter): StarterCardData {steps: s.steps,makes: s.makes,inputs: inputs(s),+ ...(look && { look }),...(cover && { cover }),coverKey: `starters/${s.id}`,...(s.seed.kind === "element" && s.seed.element.kind === "character" && { coverTop: true }),diff --git a/src/lib/starters/look.ts b/src/lib/starters/look.tsnew file mode 100644index 00000000..1c047016--- /dev/null+++ b/src/lib/starters/look.ts@@ -0,0 +1,44 @@+/**+ * A ready-made starter's look as its page shows it ("Epic · Modern · Anamorphic · Silhouette · Oil & Ochre · 16:9"):+ * the same words the studio's own pickers use, so the page names the whole recipe, not only the shots' words.+ * Browser-safe: names and colours only.+ */+import { APERTURES, CAMERA_BODIES, DEFAULT_ASPECT, ERAS, FOCAL_LENGTHS, GENRES, LENSES, LIGHTING_PRESETS, optionName, paletteHex, paletteLabel, type DirectorOption, type DirectorSettings } from "@/lib/catalog/cinema";+import { lookCard } from "@/lib/catalog/soul-cards";+import type { StarterLookItem } from "./types";++/** An option's name, or nothing when the field is left to the model (Auto, General). */+function named(list: DirectorOption[], slug: string | null | undefined): StarterLookItem | undefined {+ const o = slug ? list.find((x) => x.slug === slug) : undefined;+ return o ? { name: o.name } : undefined;+}++/** Four of a palette's colours, dark to light and its accent last, for the chip's swatch. */+const swatchOf = (hex: string[] | undefined) => (hex && hex.length >= 12 ? [hex[3], hex[6], hex[9], hex[11]] : hex?.slice(0, 4));++/** A Cinema Studio film's look: genre, era, camera, lens, focal length, aperture, light, palette, then its shape. */+export function cinemaLook(d: DirectorSettings, aspect: string = DEFAULT_ASPECT): StarterLookItem[] {+ const light: StarterLookItem | undefined =+ d.lighting?.kind === "preset" ? named(LIGHTING_PRESETS, d.lighting.slug) : d.lighting?.kind === "custom" && d.lighting.lights.length ? { name: "Custom light" } : undefined;+ const palette = paletteLabel(d.palette);+ const swatch = swatchOf(paletteHex(d.palette));+ const aperture = d.aperture ? named(APERTURES, d.aperture) : undefined;+ return [+ named(GENRES, d.genre),+ named(ERAS, d.era),+ named(CAMERA_BODIES, d.camera),+ named(LENSES, d.lens),+ named(FOCAL_LENGTHS, d.focal),+ // "f/1.4 Wide Open" reads as "f/1.4", as the Camera chip shows it.+ aperture && { name: optionName(APERTURES, d.aperture).replace(/ .*/, "") },+ light,+ palette ? { name: palette, ...(swatch?.length && { swatch }) } : undefined,+ { name: aspect },+ ].filter((x): x is StarterLookItem => !!x);+}++/** A Storyboard story's look: its Fuobe Soul look (when it has one), its shape and its frame count. */+export function storyboardLook({ look, aspectRatio, frames }: { look?: string; aspectRatio: string; frames: number }): StarterLookItem[] {+ const card = lookCard(look);+ return [...(card ? [{ name: card.name }] : []), { name: aspectRatio }, { name: `${frames} frames` }];+}diff --git a/src/lib/starters/types.ts b/src/lib/starters/types.tsindex 228e0810..94b7cea9 100644--- a/src/lib/starters/types.ts+++ b/src/lib/starters/types.ts@@ -59,6 +59,15 @@ export interface StarterInput {image?: { thumb: string; name: string };/** A recording, played on its page. */audio?: { src: string; name: string };+ /** A ready film's shot (1-based): its page offers to make that shot alone, in the film's look and shape. */+ shot?: number;+}++/** One word of a starter's look: a genre, a lens, a light, a palette (with its colours) or a shape. */+export interface StarterLookItem {+ name: string;+ /** A palette's colours, for its chip. */+ swatch?: string[];}/**@@ -88,6 +97,8 @@ export interface StarterCardData {/** What comes out, in plain words. */makes: string;inputs: StarterInput[];+ /** The look it is made in, in the studio's own words: a film's genre, lens, light, palette and shape; a story's look and shape. */+ look?: StarterLookItem[];/** Its real cover, when it has one: visitors only see starters that have it. */cover?: TemplateCover;/** The cover's key, for one-clip-at-a-time playback. */@@ -136,3 +147,23 @@ export const starterShown = (s: Pick<StarterCardData, "cover">, visitor: boolean* a starter is saved to the owner's library, so only the owner makes it.*/export const VISITOR_MAKES: ReadonlySet<StarterSurface> = new Set<StarterSurface>(["cinema", "faceless", "content-factory", "explainer"]);++/** A starter's look in one line ("Epic · Anamorphic · Silhouette · Oil & Ochre · 16:9"), as a screen reader reads it. */+export const lookLine = (items: StarterLookItem[]) => items.map((i) => i.name).join(" · ");++/**+ * A ready film's empty project, once shot `n` of `of` is in the prompt bar: where the other shots are ("Shot 2 of 3 is+ * ready below. Shots 1 and 3 are in the AI Director.").+ */+export function proposedShotLine(n: number, of: number): string {+ const others = Array.from({ length: of }, (_, i) => i + 1).filter((x) => x !== n);+ const rest =+ others.length === 1+ ? `Shot ${others[0]} is`+ : others.length === 2+ ? `Shots ${others[0]} and ${others[1]} are`+ : others.every((x, i) => i === 0 || x === others[i - 1] + 1)+ ? `Shots ${others[0]} to ${others[others.length - 1]} are`+ : `The other ${others.length} shots are`;+ return `Shot ${n} of ${of} is ready below. ${rest} in the AI Director.`;+}diff --git a/src/server/starters.ts b/src/server/starters.tsindex cd79a3b1..0a2e1670 100644--- a/src/server/starters.ts+++ b/src/server/starters.ts@@ -88,18 +88,31 @@ function adoptSamples(s: Starter): string[] {});}-/** Make the starter and say where it opens (and, for a project or an element, what it made, and `note`: what to do next). */-export async function createFromStarter(id: string, engine: Engine): Promise<{ href: string; id?: string; note?: string }> {+/**+ * Make the starter and say where it opens (and, for a project or an element, what it made, and `note`: what to do next).+ * `shot`: a ready film's page asked for one of its shots ("Make this shot"): the film opens with that shot in the prompt+ * bar, in the film's look and shape. The film made before from this starter opens again while its shots are the+ * starter's, so a film's shots made one by one land in one project.+ */+export async function createFromStarter(id: string, engine: Engine, shot?: number): Promise<{ href: string; id?: string; note?: string }> {const s = getStarter(id);if (!s) throw new StarterError("That starter doesn't exist", 404);const seed = s.seed;if (seed.kind === "fill" || seed.kind === "assist" || seed.kind === "storyboard" || seed.kind === "link") throw new StarterError("That starter opens in its studio: nothing to make here");if (seed.kind === "cinema") {+ const n = shot && shot >= 1 && shot <= seed.shots.length ? Math.floor(shot) : 1;+ const open = (projectId: string) => ({ href: `/cinema/${projectId}?shot=${n}`, id: projectId });+ const ours = listProjects().filter((p) => p.name === seed.project.name && p.description === seed.project.description);+ // One shot: the latest film from this starter whose AI Director still proposes the starter's shots.+ const sameShots = (projectId: string) => {+ const proposed = getChat(projectId).findLast((m) => m.role === "assistant" && m.shots?.length)?.shots ?? [];+ return proposed.length === seed.shots.length && proposed.every((x, i) => x.prompt === seed.shots[i].prompt);+ };+ const film = shot ? ours.find((p) => sameShots(p.id)) : undefined;+ if (film) return open(film.id);// The project made before from this starter opens again while nothing has been made or asked in it yet.- const untouched = listProjects().find(- (p) => p.name === seed.project.name && p.description === seed.project.description && !listItems(p.id).length && getChat(p.id).length <= 1,- );- if (untouched) return { href: `/cinema/${untouched.id}?shot=1`, id: untouched.id };+ const untouched = ours.find((p) => !listItems(p.id).length && getChat(p.id).length <= 1);+ if (untouched) return open(untouched.id);const p = createProject(seed.project);updateProject(p.id, { director: seed.director, brief: seed.brief });// The AI Director's proposal, as if it had just planned the film: each shot loads into the prompt bar from the chat.@@ -110,7 +123,7 @@ export async function createFromStarter(id: string, engine: Engine): Promise<{ hshots: seed.shots,createdAt: Date.now(),});- return { href: `/cinema/${p.id}?shot=1`, id: p.id };+ return open(p.id);}if (seed.kind === "element") {const references = adoptSamples(s);diff --git a/tests/framing-hint.test.ts b/tests/framing-hint.test.tsnew file mode 100644index 00000000..be07a559--- /dev/null+++ b/tests/framing-hint.test.ts@@ -0,0 +1,84 @@+import { describe, expect, it } from "vitest";+import { framingLabel, framingSuggestion, sizeK, widePersonPrompt } from "@/lib/framing-hint";++// The Image studio's framing tip: a wide scene with a person in it, asked as a small square, gets a one-tap 16:9 at a+// larger size. It never shows for a close framing, a scene with nobody in it, or a frame that is already wide or large.++const DUNE = "Aerial shot of a fashion model in flowing saffron silk standing on the crest of a vast Sahara dune at sunrise, long ripples of sand glowing gold around her.";+const ASPECTS = ["1:1", "4:3", "3:4", "16:9", "9:16"];+const SIZES = ["1K", "1.5K", "2K"];+const tip = (prompt: string, aspect = "1:1", resolution: string | undefined = "1K", aspects: string[] | null = ASPECTS, resolutions: string[] | null = SIZES) =>+ framingSuggestion({ prompt, aspect, resolution, aspects, resolutions });++describe("widePersonPrompt", () => {+ it("finds a wide or full-length scene with a person in it", () => {+ for (const p of [+ DUNE,+ "Wide shot of a woman walking across a salt flat",+ "Full body photo of a model in a red gown on a marble staircase",+ "full-length look, a man in a linen suit",+ "Drone view of a surfer on a turquoise wave",+ "A bride standing on a cliff above the sea at dusk",+ "She walks along the ridge of a dune, the sun low",+ "Head to toe editorial of a dancer on a rooftop",+ ])+ expect(widePersonPrompt(p), p).toBe(true);+ });++ it("leaves close framings, empty scenes and plain prompts alone", () => {+ for (const p of [+ "",+ "Close-up portrait of a woman on the beach at golden hour",+ "Headshot of a man, mountains soft behind him",+ "Aerial view of a vast desert at sunrise",+ "Product shot of a matte black perfume bottle on wet volcanic rock",+ "A koi pond at night, neon rain",+ "Editorial portrait of a woman in a yellow raincoat",+ "the theme of the shot is a landscape",+ ])+ expect(widePersonPrompt(p), p).toBe(false);+ });++ it("lets the wide words win over a close word", () => {+ expect(widePersonPrompt("Full body portrait of a model in a white suit")).toBe(true);+ });+});++describe("framingSuggestion", () => {+ it("offers 16:9 at 2K for the dune shot as a 1K square", () => {+ const fix = tip(DUNE);+ expect(fix).toEqual({ aspectRatio: "16:9", resolution: "2K" });+ expect(framingLabel(fix!)).toBe("Use 16:9 · 2K");+ });++ it("offers it for a 1.5K square too, and only the shape when no larger size is offered", () => {+ expect(tip(DUNE, "1:1", "1.5K")).toEqual({ aspectRatio: "16:9", resolution: "2K" });+ expect(tip(DUNE, "1:1", "1K", ASPECTS, null)).toEqual({ aspectRatio: "16:9" });+ expect(tip(DUNE, "1:1", "1K", ASPECTS, ["1K"])).toEqual({ aspectRatio: "16:9" });+ expect(framingLabel({ aspectRatio: "16:9" })).toBe("Use 16:9");+ });++ it("never offers more than 2K", () => {+ expect(tip(DUNE, "1:1", "1K", ASPECTS, ["1K", "2K", "4K"])).toEqual({ aspectRatio: "16:9", resolution: "2K" });+ expect(tip(DUNE, "1:1", "1K", ASPECTS, ["1K", "1.5K"])).toEqual({ aspectRatio: "16:9", resolution: "1.5K" });+ });++ it("is quiet when the frame is already wide or large, when 16:9 isn't offered, or for another prompt", () => {+ expect(tip(DUNE, "16:9")).toBeNull();+ expect(tip(DUNE, "9:16")).toBeNull();+ expect(tip(DUNE, "1:1", "2K")).toBeNull();+ expect(tip(DUNE, "1:1", "1K", null)).toBeNull();+ expect(tip(DUNE, "1:1", "1K", ["1:1", "3:4"])).toBeNull();+ expect(tip("A koi pond at night, neon rain")).toBeNull();+ expect(tip("Close-up portrait of a woman on the beach")).toBeNull();+ });++ it("reads sizes as K", () => {+ expect(sizeK("1K")).toBe(1);+ expect(sizeK("1.5K")).toBe(1.5);+ expect(sizeK("4MP")).toBe(2);+ expect(sizeK("1024")).toBe(1);+ expect(sizeK("auto")).toBeNaN();+ expect(sizeK(undefined)).toBeNaN();+ });+});diff --git a/tests/starter-look.test.ts b/tests/starter-look.test.tsnew file mode 100644index 00000000..e3d5192c--- /dev/null+++ b/tests/starter-look.test.ts@@ -0,0 +1,145 @@+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it, vi } from "vitest";+import type { EngineMode } from "@/lib/api";+import type { Engine } from "@/lib/catalog/types";++/*+ * A ready film's page names its whole recipe: the look line (the Director's settings in the studio's own words, then its+ * shape), its shots, and "Use template" first. Each shot has "Make this shot", which opens that shot in the film, in the+ * film's look and shape (tests/starters-run.test.ts makes it on the server). A Storyboard story's page names its look,+ * shape and frames.+ */++const viewer = vi.hoisted(() => ({ owner: false, visitor: true }));+vi.mock("next/navigation", () => ({+ useRouter: () => ({ prefetch: () => {}, push: () => {}, replace: () => {}, back: () => {}, refresh: () => {} }),+ usePathname: () => "/cinema/start/cinema.desert-couture",+ useSearchParams: () => new URLSearchParams(),+}));+vi.mock("@/lib/api", async (load) => ({+ ...(await load<typeof import("@/lib/api")>()),+ useHydrated: () => true,+ useIsOwner: () => viewer.owner,+ useIsVisitor: () => viewer.visitor,+ useEngine: (): [Engine, (e: Engine) => void, EngineMode] => ["open", () => {}, "both"],+}));++const { cinemaLook, storyboardLook } = await import("@/lib/starters/look");+const { lookLine, proposedShotLine } = await import("@/lib/starters/types");+const { STARTERS, starterCards, starterOn } = await import("@/lib/starters/catalog");+const { GENRES, LENSES, LIGHTING_PRESETS, PALETTES, CAMERA_BODIES, ERAS, APERTURES, FOCAL_LENGTHS } = await import("@/lib/catalog/cinema");+const { StarterPage } = await import("@/components/starters/starter-page");++const page = (id: string, surface: "cinema" | "storyboard") => {+ const s = starterOn(surface, id)!;+ return renderToStaticMarkup(createElement(QueryClientProvider, { client: new QueryClient() }, createElement(StarterPage, { s })));+};++describe("a starter's look line", () => {+ it("names Desert couture's whole look in the Director's words, ending with its 16:9 shape", () => {+ const s = starterOn("cinema", "cinema.desert-couture")!;+ expect(lookLine(s.look!)).toBe("Epic · Modern · Anamorphic · Silhouette · Oil & Ochre · 16:9");+ // The palette's chip shows its colours.+ const palette = s.look!.find((i) => i.name === "Oil & Ochre")!;+ expect(palette.swatch).toHaveLength(4);+ for (const c of palette.swatch!) expect(PALETTES.find((p) => p.slug === "oil-ochre")!.hex).toContain(c);+ });++ it("reads every field the Director's Panel sets, and leaves out what the model picks", () => {+ expect(+ lookLine(+ cinemaLook({+ genre: "drama",+ era: "2020s",+ tempo: "calm",+ camera: "35mm-film",+ lens: "anamorphic",+ focal: "85mm",+ aperture: "f14-wide-open",+ lighting: { kind: "preset", slug: "practicals" },+ palette: { kind: "preset", slug: "twilight-fable" },+ }),+ ),+ ).toBe("Drama · 2020s · 35mm Film · Anamorphic · 85mm · f/1.4 · Practicals · Twilight Fable · 16:9");+ expect(lookLine(cinemaLook({ genre: null, lens: null, lighting: { kind: "preset", slug: "nope" } }))).toBe("16:9");+ expect(lookLine(cinemaLook({ lighting: { kind: "custom", lights: [{ direction: "top", color: "#ffffff", brightness: 50, diffuse: 50 }] }, palette: { kind: "custom", name: "Dune", hex: ["#111111", "#222222"] } }, "21:9"))).toBe(+ "Custom light · Dune · 21:9",+ );+ });++ it("gives every ready film a look line of real picker names", () => {+ const names = new Set([...GENRES, ...ERAS, ...CAMERA_BODIES, ...LENSES, ...FOCAL_LENGTHS, ...LIGHTING_PRESETS].map((o) => o.name).concat(APERTURES.map((a) => a.name.replace(/ .*/, "")), PALETTES.map((p) => p.name)));+ for (const s of starterCards("cinema", { all: true })) {+ expect(s.look?.length, s.id).toBeGreaterThan(2);+ expect(s.look!.at(-1)!.name, s.id).toBe("16:9");+ for (const i of s.look!.slice(0, -1)) expect(names.has(i.name), `${s.id}: ${i.name}`).toBe(true);+ expect(s.look!.some((i) => i.name === "Auto" || i.name === "General"), s.id).toBe(false);+ }+ });++ it("names a story's look, shape and frames", () => {+ expect(lookLine(starterOn("storyboard", "storyboard.perfume-ad")!.look!)).toBe("Quiet luxury · 16:9 · 6 frames");+ expect(lookLine(starterOn("storyboard", "storyboard.heist")!.look!)).toBe("16:9 · 6 frames");+ expect(lookLine(starterOn("storyboard", "storyboard.capri-swim")!.look!)).toBe(`${storyboardLook({ look: "v2-warm-vivid-film", aspectRatio: "9:16", frames: 4 })[0].name} · 9:16 · 4 frames`);+ });++ it("leaves the other studios' starters without one", () => {+ for (const s of STARTERS.filter((x) => x.surface !== "cinema" && x.surface !== "storyboard")) expect(starterOn(s.surface, s.id)!.look, s.id).toBeUndefined();+ });+});++describe("a ready film's shots", () => {+ it("are numbered by their words, in order", () => {+ for (const s of STARTERS.filter((x) => x.seed.kind === "cinema")) {+ const card = starterOn("cinema", s.id)!;+ expect(card.inputs.map((i) => i.shot), s.id).toEqual([1, 2, 3]);+ }+ for (const s of starterCards("storyboard", { all: true })) expect(s.inputs.every((i) => i.shot === undefined), s.id).toBe(true);+ });++ it("say where the other shots are once one is in the prompt bar", () => {+ expect(proposedShotLine(1, 3)).toBe("Shot 1 of 3 is ready below. Shots 2 and 3 are in the AI Director.");+ expect(proposedShotLine(2, 3)).toBe("Shot 2 of 3 is ready below. Shots 1 and 3 are in the AI Director.");+ expect(proposedShotLine(3, 3)).toBe("Shot 3 of 3 is ready below. Shots 1 and 2 are in the AI Director.");+ expect(proposedShotLine(1, 2)).toBe("Shot 1 of 2 is ready below. Shot 2 is in the AI Director.");+ expect(proposedShotLine(1, 5)).toBe("Shot 1 of 5 is ready below. Shots 2 to 5 are in the AI Director.");+ expect(proposedShotLine(3, 5)).toBe("Shot 3 of 5 is ready below. The other 4 shots are in the AI Director.");+ });+});++describe("the ready film's page", () => {+ it("shows the look, then Use template first, then Make this shot on each shot, for a visitor", () => {+ viewer.owner = false;+ viewer.visitor = true;+ const html = page("cinema.desert-couture", "cinema");+ expect(html).toContain("Look: Epic · Modern · Anamorphic · Silhouette · Oil & Ochre · 16:9");+ const use = html.indexOf("Use template");+ const shot = html.indexOf("Make this shot");+ expect(use).toBeGreaterThan(0);+ expect(shot).toBeGreaterThan(use);+ expect(html.match(/Make this shot/g)).toHaveLength(3);+ expect(html).toContain('aria-label="Make shot 2 in this look"');+ expect(html).toContain("The whole film opens in Cinema Studio: its look, its brief and every shot, ready to make.");+ // The shot's own words are still there to read.+ expect(html).toContain("Aerial shot of a fashion model in flowing saffron silk");+ });++ it("shows the same to the owner", () => {+ viewer.owner = true;+ viewer.visitor = false;+ const html = page("cinema.riviera-night", "cinema");+ expect(html.match(/Make this shot/g)).toHaveLength(3);+ expect(html).toContain("Look: Drama · 2020s · 35mm Film · Anamorphic · f/1.4 · Practicals · Twilight Fable · 16:9");+ });++ it("gives a story its look line and its way into Storyboard, with no shot buttons", () => {+ viewer.owner = false;+ viewer.visitor = true;+ const html = page("storyboard.perfume-ad", "storyboard");+ expect(html).toContain("Look: Quiet luxury · 16:9 · 6 frames");+ expect(html).toContain("See it in Storyboard");+ expect(html).not.toContain("Make this shot");+ });+});diff --git a/tests/starters-run.test.ts b/tests/starters-run.test.tsindex 4cb9b37c..fe728235 100644--- a/tests/starters-run.test.ts+++ b/tests/starters-run.test.ts@@ -98,6 +98,40 @@ describe("Cinema starters", () => {const c = (await (await make(id)).json()) as { id: string };expect(c.id).not.toBe(a.id);});++ it("Make this shot: opens that shot in the film, in its look, and keeps a film's shots in one project", async () => {+ const id = "cinema.noir-perfume";+ const s = STARTERS.find((x) => x.id === id)!.seed;+ if (s.kind !== "cinema") throw new Error(id);+ const shot = async (n: number) => {+ const res = await startersRoute.POST(post(`/api/starters/${id}`, { engine: "open", shot: n }), params({ id }));+ expect(res.status, `shot ${n}`).toBe(201);+ return (await res.json()) as { id: string; href: string };+ };+ const two = await shot(2);+ expect(two.href).toBe(`/cinema/${two.id}?shot=2`);+ const p = cinema.getProject(two.id)!;+ expect(p.director).toMatchObject(s.director);+ expect(cinema.getChat(p.id).findLast((m) => m.shots?.length)?.shots?.[1].prompt).toBe(s.shots[1].prompt);+ // A take of shot 2 in it; shot 3 opens in the same film.+ const r = await generateRoute.POST(+ post("/x", { input: { engine: "cloud", mode: "video", action: "generate", prompt: s.shots[1].prompt, duration: 5, aspectRatio: "16:9", batch: 1, settings: p.director } }),+ params({ id: p.id }),+ );+ expect(r.status).toBe(201);+ const three = await shot(3);+ expect(three).toEqual({ id: two.id, href: `/cinema/${two.id}?shot=3` });+ // "Use template" still starts a fresh film once one has a take.+ const fresh = (await (await make(id)).json()) as { id: string; href: string };+ expect(fresh.id).not.toBe(two.id);+ expect(fresh.href).toBe(`/cinema/${fresh.id}?shot=1`);+ // A shot number the film doesn't have opens shot 1; one out of range is refused.+ expect((await shot(1)).href).toMatch(/\?shot=1$/);+ const bad = await startersRoute.POST(post(`/api/starters/${id}`, { engine: "open", shot: 0 }), params({ id }));+ expect(bad.status).toBe(400);+ const many = await startersRoute.POST(post(`/api/starters/${id}`, { engine: "open", shot: 9 }), params({ id }));+ expect(((await many.json()) as { href: string }).href).toMatch(/\?shot=1$/);+ });});describe("Element starters", () => {