Skip to content

armgit / fuobe

Public Imported from GitHub
0

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

Ready-made starters for Assist, Cinema Studio, Storyboard, Elements and the Library

Adarshf5f976daf02b
diff --git a/docs/public-signup.md b/docs/public-signup.md
index 043854f9..3eefea7b 100644
--- a/docs/public-signup.md
+++ b/docs/public-signup.md
@@ -70,10 +70,13 @@ An account is signed in, but it sees the owner's studio as a guest does:
owner's Library, with or without a GPU. Accounts have their own uploads and runs (below), but no
projects yet.
Canvas shows its ready boards to guests and accounts as read-only pages (`/canvas/start/<id>`):
- what goes in, the steps and what comes out. Only the owner makes boards. Faceless Studio, Content
- Factory, Explainer, Ads Studio, Click to Ad and Marketing Studio show their ready-made starters the
- same way (`<studio>/start/<id>`); making one (`POST /api/starters/<id>`) is the owner's, and an
- account gets 403 `library`.
+ what goes in, the steps and what comes out. Only the owner makes boards. Assist, Cinema Studio,
+ Storyboard, Elements, Faceless Studio, Content Factory, Explainer, Ads Studio, Click to Ad and
+ Marketing Studio show their ready-made starters the same way (`<studio>/start/<id>`); making one
+ (`POST /api/starters/<id>`) is the owner's, and an account gets 403 `library`. A starter without its
+ cover yet is the owner's only: its card, its words and its page (404 for anyone else). Storyboard's
+ ready stories with a cover also fill its composer for anyone (`/storyboard?starter=<id>`), and the
+ Library's "Make your first" row links to pages everyone can open.
- **Settings, keys and tokens are the owner's.** Changing settings or model switches, the password,
API tokens, Public sign-up, LoRA downloads, Assist connectors and the MCP endpoint answer 403 for
an account.
diff --git a/src/app/(studio)/assist/page.tsx b/src/app/(studio)/assist/page.tsx
index c45d62e6..800120cf 100644
--- a/src/app/(studio)/assist/page.tsx
+++ b/src/app/(studio)/assist/page.tsx
@@ -1,13 +1,15 @@
import type { Metadata } from "next";
import { Suspense } from "react";
import { AssistView } from "@/components/assist-view";
+import { starterCards, starterFills } from "@/lib/starters/catalog";
export const metadata: Metadata = { title: "Assist" };
export default function Page() {
return (
<Suspense>
- <AssistView />
+ {/* Only the starters with their real cover: the owner's view loads the rest (GET /api/starters). */}
+ <AssistView starters={starterCards("assist")} fills={starterFills("assist")} />
</Suspense>
);
}
diff --git a/src/app/(studio)/assist/start/[id]/page.tsx b/src/app/(studio)/assist/start/[id]/page.tsx
new file mode 100644
index 00000000..3130ffbc
--- /dev/null
+++ b/src/app/(studio)/assist/start/[id]/page.tsx
@@ -0,0 +1,14 @@
+import type { Metadata } from "next";
+import { starterMetadata, starterParams, StarterRoute } from "@/components/starters/starter-route";
+
+export function generateStaticParams() {
+ return starterParams("assist");
+}
+
+export function generateMetadata({ params }: PageProps<"/assist/start/[id]">): Promise<Metadata> {
+ return starterMetadata("assist", params);
+}
+
+export default function Page({ params }: PageProps<"/assist/start/[id]">) {
+ return <StarterRoute surface="assist" params={params} />;
+}
diff --git a/src/app/(studio)/cinema/page.tsx b/src/app/(studio)/cinema/page.tsx
index 1b2d47c0..85eac071 100644
--- a/src/app/(studio)/cinema/page.tsx
+++ b/src/app/(studio)/cinema/page.tsx
@@ -1,9 +1,10 @@
import type { Metadata } from "next";
import { CinemaProjects } from "@/components/cinema/projects-view";
import { exampleRow } from "@/lib/examples/catalog";
+import { starterCards } from "@/lib/starters/catalog";
export const metadata: Metadata = { title: "Cinema Studio" };
export default function Page() {
- return <CinemaProjects examples={exampleRow("suite:cinema")} />;
+ return <CinemaProjects examples={exampleRow("suite:cinema")} starters={starterCards("cinema")} />;
}
diff --git a/src/app/(studio)/cinema/start/[id]/page.tsx b/src/app/(studio)/cinema/start/[id]/page.tsx
new file mode 100644
index 00000000..5d0bb075
--- /dev/null
+++ b/src/app/(studio)/cinema/start/[id]/page.tsx
@@ -0,0 +1,14 @@
+import type { Metadata } from "next";
+import { starterMetadata, starterParams, StarterRoute } from "@/components/starters/starter-route";
+
+export function generateStaticParams() {
+ return starterParams("cinema");
+}
+
+export function generateMetadata({ params }: PageProps<"/cinema/start/[id]">): Promise<Metadata> {
+ return starterMetadata("cinema", params);
+}
+
+export default function Page({ params }: PageProps<"/cinema/start/[id]">) {
+ return <StarterRoute surface="cinema" params={params} />;
+}
diff --git a/src/app/(studio)/elements/page.tsx b/src/app/(studio)/elements/page.tsx
index 6e62b44c..fb7f1809 100644
--- a/src/app/(studio)/elements/page.tsx
+++ b/src/app/(studio)/elements/page.tsx
@@ -1,8 +1,9 @@
import type { Metadata } from "next";
import { ElementsView } from "@/components/elements-view";
+import { starterCards } from "@/lib/starters/catalog";
export const metadata: Metadata = { title: "Elements" };
export default function Page() {
- return <ElementsView />;
+ return <ElementsView starters={starterCards("elements")} />;
}
diff --git a/src/app/(studio)/elements/start/[id]/page.tsx b/src/app/(studio)/elements/start/[id]/page.tsx
new file mode 100644
index 00000000..dec25024
--- /dev/null
+++ b/src/app/(studio)/elements/start/[id]/page.tsx
@@ -0,0 +1,14 @@
+import type { Metadata } from "next";
+import { starterMetadata, starterParams, StarterRoute } from "@/components/starters/starter-route";
+
+export function generateStaticParams() {
+ return starterParams("elements");
+}
+
+export function generateMetadata({ params }: PageProps<"/elements/start/[id]">): Promise<Metadata> {
+ return starterMetadata("elements", params);
+}
+
+export default function Page({ params }: PageProps<"/elements/start/[id]">) {
+ return <StarterRoute surface="elements" params={params} />;
+}
diff --git a/src/app/(studio)/library/page.tsx b/src/app/(studio)/library/page.tsx
index cbed3f42..7af3a2d1 100644
--- a/src/app/(studio)/library/page.tsx
+++ b/src/app/(studio)/library/page.tsx
@@ -1,8 +1,9 @@
import type { Metadata } from "next";
import { LibraryView } from "@/components/library-view";
+import { starterCards } from "@/lib/starters/catalog";
export const metadata: Metadata = { title: "Library" };
export default function Page() {
- return <LibraryView />;
+ return <LibraryView starters={starterCards("library")} />;
}
diff --git a/src/app/(studio)/storyboard/page.tsx b/src/app/(studio)/storyboard/page.tsx
index a088c5e5..af55fecf 100644
--- a/src/app/(studio)/storyboard/page.tsx
+++ b/src/app/(studio)/storyboard/page.tsx
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import { StoryboardView } from "@/components/storyboard-view";
import { getModel } from "@/lib/catalog";
import { STORYBOARD_LOOK_MODEL, STORYBOARD_MODELS, STORYBOARD_NEXT_SCENE, STORYBOARD_PARTNERS } from "@/lib/catalog/storyboard";
+import { starterCards, starterFills } from "@/lib/starters/catalog";
export const metadata: Metadata = { title: "Storyboard" };
@@ -14,5 +15,6 @@ const MODEL_NAMES = Object.fromEntries(
);
export default function Page() {
- return <StoryboardView modelNames={MODEL_NAMES} />;
+ // The ready stories with their real cover, and what each puts into the composer; the owner's view loads the rest.
+ return <StoryboardView modelNames={MODEL_NAMES} starters={starterCards("storyboard")} fills={starterFills("storyboard")} />;
}
diff --git a/src/app/(studio)/storyboard/start/[id]/page.tsx b/src/app/(studio)/storyboard/start/[id]/page.tsx
new file mode 100644
index 00000000..dbed525f
--- /dev/null
+++ b/src/app/(studio)/storyboard/start/[id]/page.tsx
@@ -0,0 +1,14 @@
+import type { Metadata } from "next";
+import { starterMetadata, starterParams, StarterRoute } from "@/components/starters/starter-route";
+
+export function generateStaticParams() {
+ return starterParams("storyboard");
+}
+
+export function generateMetadata({ params }: PageProps<"/storyboard/start/[id]">): Promise<Metadata> {
+ return starterMetadata("storyboard", params);
+}
+
+export default function Page({ params }: PageProps<"/storyboard/start/[id]">) {
+ return <StarterRoute surface="storyboard" params={params} />;
+}
diff --git a/src/components/assist-view.tsx b/src/components/assist-view.tsx
index b72b66ca..8a96b26f 100644
--- a/src/components/assist-view.tsx
+++ b/src/components/assist-view.tsx
@@ -3,7 +3,7 @@
import { BookmarkPlus, Bot, CalendarClock, Cpu, Loader2, MessageSquarePlus } from "lucide-react";
import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
-import { useEffect, useMemo, useRef, useState } from "react";
+import { Suspense, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
@@ -21,10 +21,13 @@ import { ProjectDot, RailButton } from "@/components/assist/shell";
import { SkillIcon } from "@/components/assist/skill-icon";
import { Transcript } from "@/components/assist/transcript";
import { AssistVisitorNote } from "@/components/assist/visitor-note";
+import { StarterParam } from "@/components/starters/starter-param";
+import { StarterSection, useStarters } from "@/components/starters/starter-section";
import { useSkillBuilder } from "@/components/skills/skill-builder-provider";
import { useAssistActions, useAssistThread, useEngine } from "@/lib/api";
import { ASSIST_SUGGESTIONS, assistDraft, modeLabel, threadModeChoice, type AssistAvailability, type AssistModeChoice, type AssistProject, type AssistThread, type SkillSummary } from "@/lib/assist";
import type { Generation } from "@/lib/catalog/types";
+import { starterShown, type StarterCardData, type StarterFill } from "@/lib/starters/types";
import { cn } from "@/lib/utils";
import { toastError } from "@/lib/refusals";
@@ -86,7 +89,12 @@ export function NewChatControls({
);
}
-export function AssistView() {
+/**
+ * starters: the ready jobs under the composer (the covered ones, from the page; the owner's view loads the rest);
+ * fills: what each one types into the composer ("/skill words"), by id, also for /assist?starter=<id>.
+ */
+export function AssistView({ starters: given = [], fills: givenFills = {} }: { starters?: StarterCardData[]; fills?: Record<string, StarterFill> } = {}) {
+ const { owner, starters, fills } = useStarters("assist", given, givenFills);
const router = useRouter();
const params = useSearchParams();
const id = params.get("c");
@@ -97,6 +105,15 @@ export function AssistView() {
// /assist?prompt=<text>: the composer starts with the text. Neither sends anything.
const skillParam = params.get("skill");
const [draft, setDraft] = useState(() => ({ key: 0, text: assistDraft(skillParam, params.get("prompt")) }));
+ // A ready job (its card here, or /assist?starter=<id>) types its skill and words in: one this viewer may see only.
+ const fillStarter = (sid: string) => {
+ const f = Object.hasOwn(fills, sid) ? fills[sid] : undefined;
+ if (f?.kind !== "assist") return false;
+ // The composer comes back with the job typed in (and the focus, so a phone scrolls up to it).
+ setDraft((d) => ({ key: d.key + 1, text: f.text }));
+ return true;
+ };
+ const readyShown = starters.some((s) => starterShown(s, !owner));
const chats = useChats({ project: "none" });
const can = chats.data?.availability;
const [choice, setChoice] = useModeChoice(can?.defaultMode);
@@ -212,7 +229,23 @@ export function AssistView() {
onSend={start}
footer={<NewChatControls choice={choice} setChoice={setChoice} can={can} engine={engine} setEngine={setEngine} askFirst={askFirst} setAskFirst={setAskFirst} />}
/>
- <SkillStarters skills={available} loading={skills.data === undefined && !skills.isError} onPick={(s) => setDraft((d) => ({ key: d.key + 1, text: `/${s.name} ` }))} />
+ <SkillStarters
+ skills={available}
+ loading={skills.data === undefined && !skills.isError}
+ onPick={(s) => setDraft((d) => ({ key: d.key + 1, text: `/${s.name} ` }))}
+ // On a phone the ready jobs sit below the skills: one tap away.
+ extra={
+ readyShown && (
+ <a href="#starters" className="text-[12px] text-brand-text hover:underline sm:hidden">
+ Ready jobs
+ </a>
+ )
+ }
+ />
+ <Suspense fallback={null}>
+ <StarterParam onStarter={fillStarter} />
+ </Suspense>
+ <StarterSection surface="assist" starters={given} row onFill={fillStarter} className="mt-8 text-left" />
<div className="mt-6 flex flex-wrap justify-center gap-2">
{ASSIST_SUGGESTIONS.map((s) => (
<button
@@ -307,7 +340,20 @@ export function AssistView() {
* The starter cards under the composer. While the skills load (`loading`) the six cards are drawn
* as same-sized placeholders, so the suggestions below don't jump down when they arrive.
*/
-export function SkillStarters({ skills, loading, onPick, className }: { skills: SkillSummary[]; loading?: boolean; onPick: (s: SkillSummary) => void; className?: string }) {
+export function SkillStarters({
+ skills,
+ loading,
+ onPick,
+ extra,
+ className,
+}: {
+ skills: SkillSummary[];
+ loading?: boolean;
+ onPick: (s: SkillSummary) => void;
+ /** Another link beside "All skills". */
+ extra?: ReactNode;
+ className?: string;
+}) {
const shown = [...STARTER_SKILLS.map((n) => skills.find((s) => s.name === n)).filter((s): s is SkillSummary => !!s), ...skills.filter((s) => !STARTER_SKILLS.includes(s.name))].slice(0, 6);
if (loading && !shown.length) {
return (
@@ -338,9 +384,12 @@ export function SkillStarters({ skills, loading, onPick, className }: { skills:
<div className={cn("mt-4", className)}>
<div className="flex items-center justify-between px-1 pb-2">
<p className="text-[12px] font-medium text-muted-foreground">Start with a skill</p>
- <Link href="/assist/skills" className="text-[12px] text-brand-text hover:underline">
- All skills
- </Link>
+ <span className="flex items-center gap-3">
+ {extra}
+ <Link href="/assist/skills" className="text-[12px] text-brand-text hover:underline">
+ All skills
+ </Link>
+ </span>
</div>
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3">
{shown.map((s) => (
diff --git a/src/components/cinema/projects-view.tsx b/src/components/cinema/projects-view.tsx
index 5c94e2ac..3262ca7c 100644
--- a/src/components/cinema/projects-view.tsx
+++ b/src/components/cinema/projects-view.tsx
@@ -9,6 +9,7 @@ import { PageHeader } from "@/components/page-shell";
import { HadItemsScript, useHadItems } from "@/components/use-had-items";
import { SelfHostNote } from "@/components/self-host-note";
import { ExampleRow } from "@/components/studio/example-row";
+import { StarterSection, useStarters } from "@/components/starters/starter-section";
import { useIsVisitor } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
@@ -17,6 +18,7 @@ import type { CinemaProject } from "@/lib/catalog/cinema";
import { formatUsd } from "./money";
import { timeAgo } from "@/lib/format";
import type { ExampleRowData } from "@/lib/examples/types";
+import { starterShown, type StarterCardData } from "@/lib/starters/types";
import { cn } from "@/lib/utils";
import { copyWithToast } from "@/lib/clipboard";
import { useCinemaProjects, useUpdateProject } from "./hooks";
@@ -165,8 +167,11 @@ function EmptyProjects({ loading, onCreate, className }: { loading?: boolean; on
);
}
-/** examples: "More to try" (exampleRow(), from the page), under a guest's or an account's empty list. */
-export function CinemaProjects({ examples }: { examples?: ExampleRowData | null }) {
+/**
+ * examples: "More to try" (exampleRow(), from the page), under a guest's or an account's empty list. starters: the ready
+ * films (catalog cards), first while there are no projects, then in one row under them.
+ */
+export function CinemaProjects({ examples, starters: given = [] }: { examples?: ExampleRowData | null; starters?: StarterCardData[] }) {
const { data, isLoading } = useCinemaProjects();
const router = useRouter();
const [creating, setCreating] = useState(false);
@@ -174,6 +179,10 @@ export function CinemaProjects({ examples }: { examples?: ExampleRowData | null
// A project is saved to the studio's library, which is its owner's: a guest or an account can't start one.
const visitor = useIsVisitor();
const onCreate = visitor ? undefined : () => setCreating(true);
+ // The ready films this viewer sees: a visitor only those with their real cover (the page carries only those), the
+ // owner every one.
+ const { owner, starters } = useStarters("cinema", given);
+ const hasStarters = starters.some((s) => starterShown(s, !owner));
useHadItems("cinema-projects", data?.length);
const [blockout, setBlockout] = useState(false);
const markBlockout = useCallback(() => setBlockout(true), []);
@@ -212,7 +221,14 @@ export function CinemaProjects({ examples }: { examples?: ExampleRowData | null
</div>
) : !data?.length ? (
<div key="empty">
- <EmptyProjects onCreate={onCreate} />
+ {hasStarters ? (
+ <>
+ {!owner && <SelfHostNote className="mb-5">Projects aren&apos;t available here.</SelfHostNote>}
+ <StarterSection surface="cinema" starters={given} />
+ </>
+ ) : (
+ <EmptyProjects onCreate={onCreate} />
+ )}
{examples && <ExampleRow row={examples} className="mt-12" />}
</div>
) : (
@@ -226,6 +242,7 @@ export function CinemaProjects({ examples }: { examples?: ExampleRowData | null
>
<Plus className="size-5" /> New project
</button>
+ <StarterSection surface="cinema" starters={given} row className="col-span-full mt-6" />
</div>
)}
<ProjectDialog
diff --git a/src/components/cinema/workspace.tsx b/src/components/cinema/workspace.tsx
index f1c9c712..86a07d7d 100644
--- a/src/components/cinema/workspace.tsx
+++ b/src/components/cinema/workspace.tsx
@@ -29,7 +29,7 @@ import { ElementsPanel } from "./elements-panel";
import { FolderSidebar, subtree, viewKey, type CinemaView } from "./folder-sidebar";
import { mediaDuration } from "./media";
import { formatUsd } from "./money";
-import { foreign, useAutosave, useCinemaGenerate, useCinemaItems, useCinemaProject, useItemActions, useStudioGenerations, useUpdateProject, type CinemaGeneration, type ProjectView } from "./hooks";
+import { foreign, useAutosave, useCinemaGenerate, useCinemaItems, useCinemaProject, useDirectorChat, useItemActions, useStudioGenerations, useUpdateProject, type CinemaGeneration, type ProjectView } from "./hooks";
import { cutGrid } from "./media";
import { ProjectDialog } from "./project-settings";
import { useShare } from "@/components/share/share-provider";
@@ -178,6 +178,35 @@ export function CinemaWorkspace({ id }: { id: string }) {
return <Workspace data={project.data} items={items.data ?? []} loading={items.isLoading} />;
}
+/**
+ * /cinema/<id>?shot=<n> (a project made from a starter): the AI Director's proposed shot n goes into the prompt bar once
+ * the chat is in (`onLoad` gets it and how many shots there are), and the address drops that parameter (keeping any
+ * other), so a reload keeps what the person changed since.
+ */
+function LoadProposedShot({ projectId, n, onLoad }: { projectId: string; n: number; onLoad: (s: DirectorShot, of: number) => void }) {
+ const router = useRouter();
+ const params = useSearchParams();
+ const { messages, loading } = useDirectorChat(projectId);
+ const done = useRef(false);
+ useEffect(() => {
+ if (done.current || loading) return;
+ done.current = true;
+ const shots = messages.findLast((m) => m.role === "assistant" && m.shots?.length)?.shots ?? [];
+ if (shots[n - 1]) onLoad(shots[n - 1], shots.length);
+ const rest = new URLSearchParams(params.toString());
+ rest.delete("shot");
+ const q = rest.toString();
+ router.replace(`/cinema/${projectId}${q ? `?${q}` : ""}`, { scroll: false });
+ }, [loading, messages, n, onLoad, params, projectId, router]);
+ return 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;
@@ -221,6 +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);
const [blockoutOpen, setBlockoutOpen] = useState(() => search.get("blockout") === "1");
const [blockout, setBlockout] = useState<BlockoutDraft>(initialBlockout);
const [builder, setBuilder] = useState<BlockoutScene | null>(null);
@@ -402,6 +433,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)} />
) : (
<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." />
);
@@ -424,9 +457,22 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaG
<SidePanel project={project} tab={panel} setTab={setPanel} onClose={() => setPanel(null)} onLoadShot={onLoadShot} promptText={draft.prompt} />
);
const builderProps = { projectId: id, folderId, engine, settings, context, brief: project.brief.body };
+ const proposedShot = Number(search.get("shot")) || 0;
return (
<div className="flex h-content min-w-0 flex-col">
+ {proposedShot > 0 && (
+ <LoadProposedShot
+ projectId={id}
+ n={proposedShot}
+ onLoad={(s, of) => {
+ onLoadShot(s);
+ setStarterShots(of);
+ // On a wide screen the AI Director shows the other shots beside the work.
+ if (xl) setPanel("director");
+ }}
+ />
+ )}
<header className="flex h-14 shrink-0 items-center gap-1.5 border-b px-2 sm:gap-2 sm:px-4">
<Tooltip>
<TooltipTrigger asChild>
diff --git a/src/components/elements-view.tsx b/src/components/elements-view.tsx
index 4278a742..ca287456 100644
--- a/src/components/elements-view.tsx
+++ b/src/components/elements-view.tsx
@@ -30,14 +30,15 @@ import { VoiceRecorder } from "@/components/studio/voice-recorder";
import { useMaybeClean } from "@/components/audio-tools/clean-voice-switch";
import { SelfHostNote } from "@/components/self-host-note";
import { useEdgeFade } from "@/components/studio/use-edge-fade";
+import { StarterSection, useStarters } from "@/components/starters/starter-section";
import { useDeleteElement, useElements, useIsVisitor, useSaveElement } from "@/lib/api";
import { ELEMENT_KINDS, elementKindInfo, handleFor, MAX_ELEMENT_PHOTOS, type ElementKind, type StudioElement } from "@/lib/catalog/elements";
import { isLegacySoulId, SOUL_ID_PHOTOS } from "@/lib/catalog/training";
import { copyText } from "@/lib/clipboard";
+import { starterShown, type StarterCardData } from "@/lib/starters/types";
import { cn } from "@/lib/utils";
import { toastError } from "@/lib/refusals";
import { voiceOrigin } from "@/lib/voice-design";
-import { ElementsExample } from "@/components/empty-examples";
const TIPS: Record<ElementKind, string> = {
character: `3+ clear photos of one person (${SOUL_ID_PHOTOS.recommended}+ to train a Soul ID, up to ${SOUL_ID_PHOTOS.max}): different angles, at least one full-body, no sunglasses, filters or group shots.`,
@@ -381,7 +382,7 @@ function ElementCard({ el }: { el: StudioElement }) {
);
}
-function ElementsBody() {
+function ElementsBody({ starters: given }: { starters: StarterCardData[] }) {
const sp = useSearchParams();
const router = useRouter();
const els = useElements();
@@ -391,6 +392,12 @@ function ElementsBody() {
const visitor = useIsVisitor();
const [kinds, kindsFade] = useEdgeFade<HTMLDivElement>();
const list = useMemo(() => (els.data ?? []).filter((e) => tab === "all" || e.kind === tab), [els.data, tab]);
+ // The ready elements this viewer sees (the page carries the covered ones; the owner's view loads every one), less the
+ // ones already saved: an element keeps its starter's name.
+ const { owner, starters } = useStarters("elements", given);
+ const saved = useMemo(() => new Set((els.data ?? []).map((e) => e.name)), [els.data]);
+ const unsaved = (s: StarterCardData) => !saved.has(s.name);
+ const hasStarters = starters.some((s) => starterShown(s, !owner) && unsaved(s));
return (
<PageShell>
@@ -432,7 +439,10 @@ function ElementsBody() {
{list.map((el) => (
<ElementCard key={el.id} el={el} />
))}
+ {tab === "all" && <StarterSection surface="elements" starters={given} hide={(s) => !unsaved(s)} row className="col-span-full mt-8" />}
</div>
+ ) : tab === "all" && hasStarters ? (
+ <StarterSection surface="elements" starters={given} hide={(s) => !unsaved(s)} />
) : (
<div className="rounded-xl border border-primary/10 bg-brand-faint px-6 py-14 text-center">
<AtSign className="mx-auto size-8 text-brand-text" />
@@ -440,7 +450,6 @@ function ElementsBody() {
<p className="mx-auto mt-1 max-w-md text-[14px] text-muted-foreground">
Save a person, a place or a product from a few photos. Then write “@Maya walking into @Rooftop_bar” in any prompt.
</p>
- {tab === "all" && <ElementsExample />}
{!visitor && (
<Button className="mt-5" variant="outline" onClick={() => setOpen(true)}>
<Plus /> New element
@@ -460,10 +469,11 @@ function ElementsBody() {
);
}
-export function ElementsView() {
+/** starters: the ready elements (catalog cards, from the page), first while there are none, then in one row under them. */
+export function ElementsView({ starters = [] }: { starters?: StarterCardData[] }) {
return (
<Suspense fallback={<PageSkeleton title="Elements" rows={2} />}>
- <ElementsBody />
+ <ElementsBody starters={starters} />
</Suspense>
);
}
diff --git a/src/components/library-view.tsx b/src/components/library-view.tsx
index 02df1317..9b2680bc 100644
--- a/src/components/library-view.tsx
+++ b/src/components/library-view.tsx
@@ -47,6 +47,8 @@ import { keyCombo, useModKey } from "@/lib/keys";
import { buildEntries, folderAndDescendants, reviewInfo, splitByDate, toggleAll, TRASH_DAYS, type LibraryEntry } from "@/lib/library";
import { isLayered, shownOutputs } from "@/lib/output-actions";
import { isExpired } from "@/lib/share";
+import { StarterSection, useStarters } from "@/components/starters/starter-section";
+import { starterShown, type StarterCardData } from "@/lib/starters/types";
import { cn } from "@/lib/utils";
import { toastError } from "@/lib/refusals";
@@ -224,7 +226,7 @@ function Cards({ entries, prefs, expanded, render, panel }: { entries: LibraryEn
);
}
-function Inner() {
+function Inner({ starters: given }: { starters: StarterCardData[] }) {
const routed = useSearchParams();
// The params just set by go(): the History API hands them to useSearchParams in a transition, a frame later; shown at
// once until the router has them.
@@ -281,6 +283,8 @@ function Inner() {
// Trash or skills here (they're the studio owner's). Left out until /api/auth/me says it's the owner, so a visitor
// never sees them flash in and out.
const owner = useIsOwner();
+ // "Make your first": the covered starters the page carries, every one for the owner.
+ const { starters } = useStarters("library", given);
const shareApi = useShare();
const share = owner ? shareApi : null;
const builder = useSkillBuilder();
@@ -545,6 +549,19 @@ function Inner() {
</Empty>
);
if (uploadsTab) return <Empty title="No uploads yet">Files you add to a studio show up here.</Empty>;
+ // Nothing made yet: "Make your first" leads on All (a visitor's cards only those with their cover), then one quiet line.
+ if (tab.id === "all" && starters.some((s) => starterShown(s, !owner)))
+ return (
+ <>
+ <StarterSection surface="library" starters={given} />
+ <p className="mt-8 text-center text-[14px] text-muted-foreground">
+ Everything you make lands here.{" "}
+ <Link href="/image" className="text-brand-text underline underline-offset-2">
+ Create an image
+ </Link>
+ </p>
+ </>
+ );
return (
<Empty title="Your creations will appear here">
Generate something and it lands here.{" "}
@@ -1005,12 +1022,13 @@ function BarButton({ icon: Icon, label, onClick, disabled, destructive, classNam
);
}
-export function LibraryView() {
+/** starters: "Make your first" under an empty Library (catalog cards, from the page). */
+export function LibraryView({ starters = [] }: { starters?: StarterCardData[] }) {
return (
<Suspense fallback={null}>
<ForeverConfirmProvider>
<UploadDeleteProvider>
- <Inner />
+ <Inner starters={starters} />
</UploadDeleteProvider>
</ForeverConfirmProvider>
</Suspense>
diff --git a/src/components/moodboards/moodboards-view.tsx b/src/components/moodboards/moodboards-view.tsx
index 083303f7..bc8cd4ef 100644
--- a/src/components/moodboards/moodboards-view.tsx
+++ b/src/components/moodboards/moodboards-view.tsx
@@ -143,7 +143,13 @@ export function MoodboardsView() {
const { data, isLoading } = useMoodboards();
const { rename, remove } = useMoodboardActions();
const [engine, setEngine] = useEngine();
- const [tab, setTab] = useState<"mine" | "curated">("mine");
+ const looks = useCuratedSet("soul-v2");
+ // Curated first while the person has no boards of their own (a guest or an account always), once curated looks have
+ // their real covers (a wall of drawn tiles is no place to start): picking a tab keeps it. Known once the list is in,
+ // so the owner's own boards never wait behind a flash of Curated.
+ const [picked, setTab] = useState<"mine" | "curated" | null>(null);
+ const curatedFirst = !isLoading && !data?.items.length && looks.some((c) => c.preview);
+ const tab = picked ?? (curatedFirst ? "curated" : "mine");
const [cat, setCat] = useState("All presets");
const [q, setQ] = useState("");
const [creating, setCreating] = useState(false);
@@ -152,10 +158,13 @@ export function MoodboardsView() {
const [deleting, setDeleting] = useState<Moodboard | null>(null);
const needle = q.trim().toLowerCase();
const mine = useMemo(() => (data?.items ?? []).filter((m) => !needle || m.name.toLowerCase().includes(needle)), [data, needle]);
- const looks = useCuratedSet("soul-v2");
- // Curated looks are Fuobe Soul's: they open on Fuobe Soul, which applies the whole look on either engine.
+ // Curated looks are Fuobe Soul's: they open on Fuobe Soul, which applies the whole look on either engine. Looks with
+ // their real cover come first.
const curated = useMemo(
- () => looks.filter((c) => (needle ? `${c.name} ${c.description}`.toLowerCase().includes(needle) : inCuratedTab(c, cat))),
+ () =>
+ looks
+ .filter((c) => (needle ? `${c.name} ${c.description}`.toLowerCase().includes(needle) : inCuratedTab(c, cat)))
+ .sort((a, b) => Number(!a.preview) - Number(!b.preview)),
[looks, needle, cat],
);
@@ -238,6 +247,9 @@ export function MoodboardsView() {
)
) : (
<>
+ {curatedFirst && !picked && !needle && (
+ <p className="mb-3 text-[14px] text-pretty text-muted-foreground">Start from a curated look: tap one to use it in the Image studio, or make your own from {MOODBOARD_LIMITS.min} or more pictures.</p>
+ )}
{!needle && (
<div className="scrollbar-none mb-4 flex gap-1.5 overflow-x-auto">
{CURATED_TABS["soul-v2"].map((c) => (
diff --git a/src/components/starters/starter-card.tsx b/src/components/starters/starter-card.tsx
index f61af1ef..d17071b9 100644
--- a/src/components/starters/starter-card.tsx
+++ b/src/components/starters/starter-card.tsx
@@ -32,6 +32,8 @@ export interface StarterCardProps {
wide?: boolean;
/** On a phone, the cover as a thumbnail on the left and the words beside it (a row that must fit above a docked composer). */
compact?: boolean;
+ /** A portrait still: shown from its top, so a head is never cut off in the wide frame. */
+ coverTop?: boolean;
className?: string;
}
@@ -40,7 +42,7 @@ export interface StarterCardProps {
* line of description and one action. The cards of a row line up: the description takes two lines at most and the
* action sits at the foot.
*/
-export function StarterCard({ coverKey, cover, hue, flow, overlay, icon, title, description, href, meta, badge, action, wide, compact, className }: StarterCardProps) {
+export function StarterCard({ coverKey, cover, hue, flow, overlay, icon, title, description, href, meta, badge, action, wide, compact, coverTop, className }: StarterCardProps) {
const { ref, playing, asked, handlers } = useCoverPlayback<HTMLElement>(coverKey, cover);
// A phone's compact card: a thumbnail as tall as the words beside it.
const shape = cn(wide ? "aspect-[16/9] sm:aspect-[2/1]" : "aspect-[16/9]", compact && "max-sm:aspect-auto max-sm:min-h-28 max-sm:w-28 max-sm:shrink-0");
@@ -57,10 +59,15 @@ export function StarterCard({ coverKey, cover, hue, flow, overlay, icon, title,
>
{cover ? (
<div className={cn("relative overflow-hidden bg-muted", shape)}>
- {cover.frames.length > 1 ? (
+ {cover.frames.length > 1 || (coverTop && !cover.video) ? (
<div className="absolute inset-0 grid auto-cols-fr grid-flow-col gap-0.5">
{cover.frames.map((f) => (
- <CoverImg key={f.src} frame={f} sizes="(max-width: 640px) 34vw, (max-width: 1024px) 17vw, 150px" />
+ <CoverImg
+ key={f.src}
+ frame={f}
+ sizes={cover.frames.length > 1 ? "(max-width: 640px) 34vw, (max-width: 1024px) 17vw, 150px" : "(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 440px"}
+ className={coverTop ? "object-top" : undefined}
+ />
))}
</div>
) : (
diff --git a/src/components/starters/starter-icon.tsx b/src/components/starters/starter-icon.tsx
index eb040850..2333530f 100644
--- a/src/components/starters/starter-icon.tsx
+++ b/src/components/starters/starter-icon.tsx
@@ -1,9 +1,53 @@
"use client";
// The starters' icons, by lucide name (src/lib/starters/catalog.ts). Its own small map: a page loads only these.
-import { FlaskConical, Gem, Landmark, Leaf, Sailboat, Scissors, Shirt, ShoppingBag, Sparkles, Sun, Waves, type LucideIcon } from "lucide-react";
+import {
+ AudioLines,
+ Castle,
+ Clapperboard,
+ Droplet,
+ FlaskConical,
+ Gem,
+ Image,
+ Landmark,
+ Leaf,
+ Moon,
+ Palette,
+ Sailboat,
+ Scissors,
+ Ship,
+ Shirt,
+ ShoppingBag,
+ Sparkles,
+ Star,
+ Sun,
+ User,
+ Waves,
+ type LucideIcon,
+} from "lucide-react";
-export const STARTER_ICONS: Record<string, LucideIcon> = { FlaskConical, Gem, Landmark, Leaf, Sailboat, Scissors, Shirt, ShoppingBag, Sun, Waves };
+export const STARTER_ICONS: Record<string, LucideIcon> = {
+ AudioLines,
+ Castle,
+ Clapperboard,
+ Droplet,
+ FlaskConical,
+ Gem,
+ Image,
+ Landmark,
+ Leaf,
+ Moon,
+ Palette,
+ Sailboat,
+ Scissors,
+ Ship,
+ Shirt,
+ ShoppingBag,
+ Star,
+ Sun,
+ User,
+ Waves,
+};
export function StarterIcon({ name, className }: { name: string; className?: string }) {
const Icon: LucideIcon = STARTER_ICONS[name] ?? Sparkles;
diff --git a/src/components/starters/starter-page.tsx b/src/components/starters/starter-page.tsx
index 132d1a32..59c35b04 100644
--- a/src/components/starters/starter-page.tsx
+++ b/src/components/starters/starter-page.tsx
@@ -25,6 +25,10 @@ function Input({ input }: { input: StarterInput }) {
{input.image && <p className="text-[13px] text-muted-foreground">{input.image.name}</p>}
</div>
</div>
+ {input.audio && (
+ // A voice sample: its words are what it shows.
+ <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>}
</li>
);
@@ -69,10 +73,16 @@ export function StarterPage({ s }: { s: StarterCardData }) {
<div className="min-w-0">
<div ref={ref} {...handlers} className="relative aspect-[16/9] overflow-hidden rounded-2xl border bg-muted">
{cover ? (
- cover.frames.length > 1 ? (
+ cover.frames.length > 1 || (s.coverTop && !cover.video) ? (
<div className="absolute inset-0 grid auto-cols-fr grid-flow-col gap-0.5">
{cover.frames.map((f) => (
- <CoverImg key={f.src} frame={f} sizes="(max-width: 1024px) 34vw, 280px" />
+ <CoverImg
+ key={f.src}
+ frame={f}
+ sizes={cover.frames.length > 1 ? "(max-width: 1024px) 34vw, 280px" : "(max-width: 1024px) 100vw, 820px"}
+ // A portrait: from its top, so the head stays whole in the wide frame.
+ className={s.coverTop ? "object-top" : undefined}
+ />
))}
</div>
) : (
@@ -115,7 +125,7 @@ export function StarterPage({ s }: { s: StarterCardData }) {
<div className="mt-4 flex flex-wrap items-center gap-3">
<Button asChild className="rounded-full">
<Link href={s.tryIn.href}>
- Try it in {s.tryIn.label} <ArrowRight />
+ {s.tryIn.text ?? `Try it in ${s.tryIn.label}`} <ArrowRight />
</Link>
</Button>
</div>
diff --git a/src/components/starters/starter-section.tsx b/src/components/starters/starter-section.tsx
index 35f409fd..537e8640 100644
--- a/src/components/starters/starter-section.tsx
+++ b/src/components/starters/starter-section.tsx
@@ -4,6 +4,7 @@ import { ArrowRight, Loader2, Plus } from "lucide-react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useRouter } from "next/navigation";
import { useState, useTransition } from "react";
+import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { StepFlow } from "@/components/canvas/template-card";
import { useEngine, useIsOwner } from "@/lib/api";
@@ -48,19 +49,24 @@ export function useStarterUse(onFill?: (id: string) => void) {
const [opening, setOpening] = useState<string | null>(null);
const [navigating, startTransition] = useTransition();
const use = async (s: StarterCardData) => {
- if (s.use.kind === "fill") {
- if (onFill) onFill(s.id);
+ 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);
try {
const res = await fetch(`/api/starters/${encodeURIComponent(s.id)}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ engine }) });
- const body = (await res.json().catch(() => ({}))) as { href?: string; error?: string };
+ 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 couldn't be made. Please try again.");
- // What it made (a brand, a product, a channel) is in the lists the next page picks it from, before it opens.
- await Promise.all([qc.invalidateQueries({ queryKey: ["brands"] }), qc.invalidateQueries({ queryKey: ["products"] }), qc.invalidateQueries({ queryKey: ["faceless"] })]);
+ // What it made (a brand, a product, a channel, a film, an element) is in the lists the next page picks it from,
+ // before it opens.
+ await Promise.all(
+ [["brands"], ["products"], ["faceless"], ["cinema", "projects"], ["elements"]].map((queryKey) => qc.invalidateQueries({ queryKey })),
+ );
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);
startTransition(() => router.push(href));
} catch (e) {
@@ -72,8 +78,12 @@ export function useStarterUse(onFill?: (id: string) => void) {
return { use, busy: making ?? (navigating ? opening : null) };
}
-/** One starter as a card: the whole card opens its page; the owner's action makes or fills it. */
+/**
+ * One starter as a card: the whole card opens its page; the owner's action makes or fills it. A link starter (the
+ * Library's) opens its studio, with everything loaded, for everyone.
+ */
export function StarterTile({ s, owner, busy, onUse, wide, compact }: { s: StarterCardData; owner: boolean; busy: boolean; onUse: () => void; wide?: boolean; compact?: boolean }) {
+ const link = s.use.kind === "link";
return (
<StarterCard
wide={wide}
@@ -86,10 +96,15 @@ export function StarterTile({ s, owner, busy, onUse, wide, compact }: { s: Start
icon={<StarterIcon name={s.icon} className="size-4" />}
title={s.name}
description={s.description}
- href={starterHref(s)}
+ href={starterHref(s, owner)}
+ coverTop={s.coverTop}
badge={owner && !s.cover ? "No cover yet" : undefined}
action={
- owner ? (
+ link ? (
+ <span className="inline-flex items-center gap-1 text-[13px] font-medium text-foreground">
+ Open it <ArrowRight className="size-3.5 transition-transform group-hover/starter:translate-x-0.5" />
+ </span>
+ ) : owner ? (
<Button size="sm" className="w-fit rounded-full" onClick={onUse} disabled={busy}>
{busy ? <Loader2 className="animate-spin" /> : <Plus />} Use template
</Button>
@@ -118,6 +133,7 @@ export function StarterSection({
narrow = false,
center = false,
compact = false,
+ hide,
}: {
surface: StarterSurface;
/** The covered starters the page was given; the owner's view adds the rest (useStarters). */
@@ -132,17 +148,21 @@ export function StarterSection({
center?: boolean;
/** On a phone, each card as a thumbnail beside its words (Marketing Studio's, above its docked composer). */
compact?: boolean;
+ /** Starters this viewer has already made (an element saved from one): left out of the row. */
+ hide?: (s: StarterCardData) => boolean;
}) {
// Until the viewer is known to be the owner, the page is a visitor's: only starters with their real cover show.
const { owner, starters } = useStarters(surfaceId, given);
const { use, busy } = useStarterUse(onFill);
const [all, setAll] = useState(false);
- const shown = starters.filter((s) => starterShown(s, !owner));
+ const shown = starters.filter((s) => starterShown(s, !owner) && !hide?.(s));
if (!shown.length) return null;
const surface = STARTER_SURFACES[surfaceId];
const items = row && !all ? shown.slice(0, 3) : shown;
- // Two cards or fewer: two columns at most, so no column stands empty beside them, with wider, lower covers.
+ // Two cards or fewer: two columns at most, so no column stands empty beside them, with wider, lower covers. Four:
+ // two by two, or one row of four on a wide screen, never three and one.
const few = items.length <= 2;
+ const four = items.length === 4;
const H = headingLevel;
// A snap row on a phone reaches the screen's edges: it steps out of the page's 16 px gutter and snaps back inside it.
const snap = row && !all && items.length > 1;
@@ -153,7 +173,7 @@ export function StarterSection({
<H id="starters-title" className="font-heading text-[24px] leading-tight">
{surface.section}
</H>
- <p className="mt-0.5 text-[13px] text-muted-foreground">{surface.note}</p>
+ <p className="mt-0.5 text-[13px] text-muted-foreground">{owner ? surface.note : (surface.visitorNote ?? surface.note)}</p>
</div>
{row && shown.length > 3 && (
<button type="button" onClick={() => setAll((v) => !v)} className="text-[13px] font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline">
@@ -164,7 +184,7 @@ export function StarterSection({
<div
className={cn(
"grid grid-cols-1 gap-4 sm:grid-cols-2",
- !narrow && !few && "lg:grid-cols-3",
+ !narrow && !few && (four ? "xl:grid-cols-4" : "lg:grid-cols-3"),
!narrow && few && "lg:max-w-[880px]",
snap && "-mx-4 flex scroll-px-4 snap-x snap-mandatory overflow-x-auto px-4 pb-1 sm:mx-0 sm:grid sm:scroll-px-0 sm:overflow-visible sm:px-0 sm:pb-0 [&>*]:w-[78%] [&>*]:shrink-0 [&>*]:snap-start sm:[&>*]:w-auto",
)}
diff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsx
index c37c36f2..3339377a 100644
--- a/src/components/storyboard-view.tsx
+++ b/src/components/storyboard-view.tsx
@@ -4,7 +4,7 @@ import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tansta
import { ArrowUp, Clapperboard, Film, ImagePlus, Loader2, Minus, Plus, Sparkles, Trash2, Wand2, X } from "lucide-react";
import dynamic from "next/dynamic";
import Link from "next/link";
-import { useMemo, useState, useSyncExternalStore } from "react";
+import { Suspense, useMemo, useRef, useState, useSyncExternalStore } from "react";
import { nanoid } from "nanoid";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
@@ -18,6 +18,8 @@ import { finishGaveUp, useSoulFinish } from "@/components/studio/soul-finish";
import { FailedTile, MediaThumb, PendingTile, tileRatio } from "@/components/studio/feed";
import { fileToSlot, MediaSlot, type SlotValue } from "@/components/studio/media-slot";
import { Viewer } from "@/components/studio/viewer";
+import { StarterParam } from "@/components/starters/starter-param";
+import { StarterSection, useStarters } from "@/components/starters/starter-section";
import { useCreateGeneration, useEngine, useGenerationActions, useGenerations, useHydrated, useIsVisitor, useStatus } from "@/lib/api";
import { MAX_FRAMES, STORYBOARD_ASPECTS, STORYBOARD_PARTNER_IDS, type StoryboardNextScene, type StoryboardPartner } from "@/lib/catalog/storyboard";
import { lookCard } from "@/lib/catalog/soul-cards";
@@ -25,6 +27,7 @@ import type { Engine, Generation } from "@/lib/catalog/types";
import { timeAgo } from "@/lib/format";
import { BOARD_TITLES_KEY, boardTitle, filmReady, rememberTitle } from "@/lib/storyboard-board";
import { animateHref, MAX_KEYS } from "@/lib/inbetween";
+import { starterShown, type StarterCardData, type StarterFill } from "@/lib/starters/types";
import { cn } from "@/lib/utils";
import { responseError, toastError } from "@/lib/refusals";
import { BoardExample, hasBoardExample } from "@/components/empty-examples";
@@ -320,7 +323,18 @@ function Board({
);
}
-export function StoryboardView({ modelNames = {} }: { /** Display names of the storyboard models, from the server. */ modelNames?: Record<string, string> }) {
+export function StoryboardView({
+ modelNames = {},
+ starters: given = [],
+ fills: givenFills = {},
+}: {
+ /** Display names of the storyboard models, from the server. */
+ modelNames?: Record<string, string>;
+ /** The ready stories with their real cover (catalog cards), and what each one puts into the composer, by id. */
+ starters?: StarterCardData[];
+ fills?: Record<string, StarterFill>;
+}) {
+ const { owner, starters, fills } = useStarters("storyboard", given, givenFills);
const qc = useQueryClient();
const [engine, setEngine] = useEngine();
// The engine is known once the install's engine mode is and the page has hydrated (until then useEngine answers the
@@ -344,6 +358,25 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
// Your GPU only: the next frames' model (Qwen-Image 2.1 unless the classic recipe is picked).
const [nextScene, setNextScene] = useState<StoryboardNextScene | undefined>();
const [open, setOpen] = useState<Generation | null>(null);
+ // A ready story fills the composer (for everyone: the price shows at once, and Generate is the owner's), from its
+ // page's link (?starter=<id>) or its card here, then the composer comes into view.
+ const storyRef = useRef<HTMLTextAreaElement>(null);
+ const applyStarter = (id: string) => {
+ const s = Object.hasOwn(fills, id) ? fills[id] : undefined;
+ if (s?.kind !== "storyboard") return false;
+ setMode("auto");
+ setStory(s.story);
+ setCount(Math.min(MAX_FRAMES, Math.max(2, s.frames)));
+ setAspect(s.aspectRatio);
+ setLook(s.look);
+ setLookStrength(1);
+ requestAnimationFrame(() => {
+ storyRef.current?.scrollIntoView({ block: "center", behavior: "smooth" });
+ storyRef.current?.focus({ preventScroll: true });
+ });
+ return true;
+ };
+ const hasStarters = starters.some((s) => starterShown(s, !owner));
const feed = useGenerations({ features: ["storyboard", "storyboard-film"], limit: 240 });
const titles = useBoardTitles();
// A board with a look: each frame gets the look's grade and overlay here, once it's made.
@@ -434,6 +467,9 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
return (
<div className="flex min-h-content min-w-0 flex-col">
+ <Suspense fallback={null}>
+ <StarterParam onStarter={applyStarter} />
+ </Suspense>
<header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<h1 className="min-w-0 truncate font-heading text-[22px] leading-none">Storyboard</h1>
<div className="ml-auto">
@@ -465,11 +501,12 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
</div>
{mode === "auto" ? (
<textarea
+ ref={storyRef}
value={story}
onChange={(e) => setStory(e.target.value)}
rows={2}
aria-label="Your story"
- placeholder="The whole story in a sentence or two — e.g. “a lighthouse keeper finds a glowing bottle and follows its map into the sea”"
+ placeholder="The whole story in a sentence or two — e.g. “a model in an emerald gown slips out of a palace ball at midnight and drives a vintage car to the sea”"
className="field-sizing-content max-h-52 min-h-16 w-full resize-none bg-transparent px-2 py-1.5 text-base leading-relaxed outline-none placeholder:text-subtle-foreground"
/>
) : (
@@ -591,7 +628,10 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
names={modelNames}
/>
))}
+ <StarterSection surface="storyboard" starters={given} onFill={applyStarter} row className="col-span-full pt-6" />
</div>
+ ) : hasStarters ? (
+ <StarterSection surface="storyboard" starters={given} onFill={applyStarter} />
) : (
<div className="grid place-items-center rounded-xl border border-dashed px-4 py-14 text-center text-muted-foreground">
{/* An example board (six frames) in place of the icon, once it is published. */}
diff --git a/src/lib/assist.ts b/src/lib/assist.ts
index 70422c01..ffc8ea75 100644
--- a/src/lib/assist.ts
+++ b/src/lib/assist.ts
@@ -123,10 +123,10 @@ export function threadTitle(text: string): string {
* (tests/assist-suggestions.test.ts runs them through the offline planner).
*/
export const ASSIST_SUGGESTIONS = [
- "A 3-shot product ad for a matte black perfume bottle — hero still, then animate it",
- "Four moody portraits of a lighthouse keeper, 35mm film, then pick the best and animate it",
- "Storyboard a 6-frame heist in Paris at night",
- "A 10-second vertical video of a fox running through snow, with sound",
+ "A 3-shot ad for a gold watch on a model's wrist on a Lake Como terrace — hero still, then animate it",
+ "Four moody portraits of a model in a black velvet suit, 35mm film, then pick the best and animate it",
+ "Storyboard a 6-frame escape from a Venice masquerade ball at midnight",
+ "A 10-second vertical video of a model in a red silk gown running through falling snow at night, with sound",
] as const;
/** The longest prompt a link can type into a new chat (/assist?prompt=). */
diff --git a/src/lib/record-pages.ts b/src/lib/record-pages.ts
index 8ad972f9..5017b4e1 100644
--- a/src/lib/record-pages.ts
+++ b/src/lib/record-pages.ts
@@ -41,8 +41,13 @@ const PAGES: [RegExp, (m: string[]) => RecordRef][] = [
const FIXED = new Set(["/ads/multiplier"]);
/** A ready-made starter's page (/faceless/start/<id>…): catalog data, not a stored record. */
-const STARTER_PAGE = /^\/(faceless|content-factory|explainer|ads|marketing|marketing\/click-to-ad)\/start\/([^/]+)$/;
-const STARTER_BASE: Record<string, StarterSurface> = { faceless: "faceless", "content-factory": "content-factory", explainer: "explainer", ads: "ads", marketing: "marketing", "marketing/click-to-ad": "click-to-ad" };
+const STARTER_PAGE = /^\/(assist|cinema|storyboard|elements|faceless|content-factory|explainer|ads|marketing|marketing\/click-to-ad)\/start\/([^/]+)$/;
+const STARTER_BASE: Record<string, StarterSurface> = {
+ assist: "assist",
+ cinema: "cinema",
+ storyboard: "storyboard",
+ elements: "elements",
+ faceless: "faceless", "content-factory": "content-factory", explainer: "explainer", ads: "ads", marketing: "marketing", "marketing/click-to-ad": "click-to-ad" };
function decode(s: string): string {
try {
diff --git a/src/lib/starters/assist.ts b/src/lib/starters/assist.ts
new file mode 100644
index 00000000..85dd4047
--- /dev/null
+++ b/src/lib/starters/assist.ts
@@ -0,0 +1,141 @@
+import "server-only";
+import type { Starter } from "./catalog";
+
+const JEWEL =
+ "A campaign for an emerald and diamond necklace: a hero still of a model in a black velvet gown wearing it in a candlelit palace hall, a close-up still of the necklace on her collarbone catching the candlelight, then animate the hero still into a slow 5-second push-in.";
+
+/**
+ * Assist's starters: one whole job each, in words that need nothing else (no photo to attach), with the skill that
+ * does it when one fits. The owner's tap types it into a new chat's composer (nothing is sent); a guest or an account
+ * gets its page.
+ */
+export const ASSIST_STARTERS: Starter[] = [
+ {
+ id: "assist.jewel-campaign",
+ surface: "assist",
+ rank: 1,
+ name: "Emerald necklace campaign",
+ description: "Two stills of a model in an emerald necklace in a candlelit palace, then a slow film",
+ icon: "Gem",
+ hue: 150,
+ flow: ["Plan", "Stills", "Film"],
+ steps: [
+ "Assist plans the shoot and shows you the cost before anything runs.",
+ "A hero still of a model in a black velvet gown wearing the necklace in a candlelit palace hall.",
+ "A close-up of the necklace on her collarbone, the emeralds catching the candlelight.",
+ "The hero still turns into a slow 5-second push-in.",
+ ],
+ makes: "Two campaign stills and a 5-second film of the necklace.",
+ words: [{ label: "The brief", text: JEWEL }],
+ seed: { kind: "assist", prompt: JEWEL },
+ },
+ {
+ id: "assist.monaco-short",
+ surface: "assist",
+ rank: 2,
+ name: "One night in Monaco",
+ description: "A 30-second short film in four shots, from the casino steps to fireworks over the harbour",
+ icon: "Clapperboard",
+ hue: 160,
+ flow: ["Story", "Shots", "Film"],
+ steps: [
+ "Assist breaks the story into four shots and shows you the cost.",
+ "A woman in an emerald silk gown leaves the casino at blue hour.",
+ "She drives a silver vintage convertible along the coast road.",
+ "She stops at a cliff overlook as fireworks open over the harbour, and the shots are joined into one film.",
+ ],
+ makes: "A 30-second film in four shots.",
+ words: [
+ {
+ label: "The story",
+ text: "A 30-second short film in 4 shots: a woman in an emerald silk gown leaves a Monte Carlo casino at blue hour, steps into a silver vintage convertible, drives the coast road, and stops at a cliff overlook as fireworks open over the harbour.",
+ },
+ ],
+ // The same night on the Riviera as Cinema Studio's first film, until its own cover is made.
+ coverOf: { template: "starters/cinema.riviera-night" },
+ seed: {
+ kind: "assist",
+ skill: "short-film",
+ prompt:
+ "A 30-second short film in 4 shots: a woman in an emerald silk gown leaves a Monte Carlo casino at blue hour, steps into a silver vintage convertible, drives the coast road, and stops at a cliff overlook as fireworks open over the harbour.",
+ },
+ },
+ {
+ id: "assist.linen-lookbook",
+ surface: "assist",
+ rank: 3,
+ name: "Linen capsule lookbook",
+ description: "Six stills of one model in cream linen on a Capri terrace at golden hour",
+ icon: "Shirt",
+ hue: 30,
+ flow: ["Plan", "6 stills"],
+ steps: [
+ "Assist plans six stills of the same model and shows you the cost.",
+ "Full length, walking, seated on a stone bench, a close-up of the fabric, laughing over her shoulder, and a wide with the sea.",
+ "Every still keeps her face, the collection and the golden light.",
+ ],
+ makes: "Six lookbook stills of one model on a Capri terrace.",
+ words: [
+ {
+ label: "The brief",
+ text: "Six lookbook stills of one model in a cream linen capsule collection on a Capri terrace at golden hour: full length, walking, seated on a stone bench, a close-up of the fabric, laughing over her shoulder, and a wide with the sea.",
+ },
+ ],
+ seed: {
+ kind: "assist",
+ prompt:
+ "Six lookbook stills of one model in a cream linen capsule collection on a Capri terrace at golden hour: full length, walking, seated on a stone bench, a close-up of the fabric, laughing over her shoulder, and a wide with the sea.",
+ },
+ },
+ {
+ id: "assist.serum-ugc",
+ surface: "assist",
+ rank: 4,
+ name: "Serum video, creator style",
+ description: "A 15-second vertical video of a model showing a glass serum bottle to her phone",
+ icon: "Droplet",
+ hue: 200,
+ flow: ["Script", "Video"],
+ steps: [
+ "Assist writes the shot and the line she says.",
+ "A model in a white robe in a marble bathroom shows the serum bottle to her phone camera.",
+ "She applies one drop and says the line, in soft daylight.",
+ ],
+ makes: "A 15-second vertical video with her voice.",
+ words: [
+ {
+ label: "The brief",
+ text: "A 15-second vertical creator video: a model in a white robe in a marble bathroom shows a glass serum bottle to her phone camera, applies one drop and says: 'Three weeks in, and my skin feels calm and glowing.' Soft daylight.",
+ },
+ ],
+ seed: {
+ kind: "assist",
+ prompt:
+ "A 15-second vertical creator video: a model in a white robe in a marble bathroom shows a glass serum bottle to her phone camera, applies one drop and says: 'Three weeks in, and my skin feels calm and glowing.' Soft daylight.",
+ },
+ },
+ {
+ id: "assist.boat-hotels",
+ surface: "assist",
+ rank: 5,
+ name: "Travel short with narration",
+ description: "A 45-second video about five hotels you can only reach by boat, with calm narration",
+ icon: "Ship",
+ hue: 190,
+ flow: ["Script", "Voice", "Video"],
+ steps: [
+ "Assist writes a 45-second script about five hotels you can only reach by boat.",
+ "A calm voice reads it over cinematic drone shots.",
+ "Gentle piano plays under it all.",
+ ],
+ makes: "A 45-second travel video with narration and music.",
+ words: [{ label: "The brief", text: "A 45-second video for a luxury travel channel, 'Five hotels you can only reach by boat': cinematic drone shots over turquoise water and island hotels, a calm voice telling the story, gentle piano." }],
+ // The same channel as Faceless Studio's first, until its own cover is made.
+ coverOf: { template: "starters/faceless.boat-hotels" },
+ seed: {
+ kind: "assist",
+ skill: "faceless-video",
+ prompt: "A 45-second video for a luxury travel channel, 'Five hotels you can only reach by boat': cinematic drone shots over turquoise water and island hotels, a calm voice telling the story, gentle piano.",
+ },
+ },
+];
diff --git a/src/lib/starters/catalog.ts b/src/lib/starters/catalog.ts
index 239e6b74..ee0a0d75 100644
--- a/src/lib/starters/catalog.ts
+++ b/src/lib/starters/catalog.ts
@@ -1,6 +1,6 @@
/**
- * The ready-made starters of Faceless Studio, Content Factory, Explainer, Ads Studio, Click to Ad and Marketing Studio
- * (Canvas's are its templates: src/lib/catalog/canvas.ts). Server only: a page gets its few slim cards
+ * The ready-made starters of Assist, the Library, Cinema Studio, Storyboard, Elements, Faceless Studio, Content Factory,
+ * Explainer, Ads Studio, Click to Ad and Marketing Studio (Canvas's are its templates: src/lib/catalog/canvas.ts). Server only: a page gets its few slim cards
* (starterCards), and the words, settings and sample files stay here. What the owner's "Use template" makes is in
* src/server/starters.ts.
*
@@ -9,20 +9,30 @@
*/
import "server-only";
import { getPreset } from "@/lib/catalog";
+import { ASSIST_PROMPT_MAX } from "@/lib/assist";
+import { getTemplate } from "@/lib/catalog/canvas";
+import { CAMERA_MOVES, type DirectorSettings, type DirectorShot } from "@/lib/catalog/cinema";
+import { ELEMENT_KINDS, MAX_ELEMENT_PHOTOS, type ElementKind } from "@/lib/catalog/elements";
+import { MAX_FRAMES, STORYBOARD_ASPECTS } from "@/lib/catalog/storyboard";
import { CF_LENGTH_VALUES, getPreset as getCfPreset } from "@/lib/catalog/content-factory";
import { EXPLAINER_STYLE_IDS, FACELESS_LENGTHS, FACELESS_STYLE_IDS, GENRES, type FacelessGenre } from "@/lib/catalog/faceless";
import { TEMPLATE_INDEX } from "@/lib/catalog/marketing";
-import { exampleSurfaceOf } from "@/lib/examples/catalog";
+import { exampleById, exampleSurfaceOf } from "@/lib/examples/catalog";
import { EXAMPLE_MEDIA } from "@/lib/examples/media.generated";
import { presetCover } from "@/lib/preset-covers";
import { thumbOf } from "@/lib/preset-cards";
import { PRESET_PEAKS } from "@/lib/preset-peaks.generated";
-import { templateCover, type TemplateCover } from "@/lib/template-covers";
+import { TEMPLATE_GROUPS, templateCover, type TemplateCover, type TemplateGroup } from "@/lib/template-covers";
import { AD_STARTERS } from "./ads";
+import { ASSIST_STARTERS } from "./assist";
+import { CINEMA_STARTERS } from "./cinema";
import { CONTENT_FACTORY_STARTERS } from "./content-factory";
+import { ELEMENT_STARTERS } from "./elements";
import { EXPLAINER_STARTERS } from "./explainer";
import { FACELESS_STARTERS } from "./faceless";
-import type { StarterCardData, StarterFill, StarterInput, StarterSurface } from "./types";
+import { LIBRARY_STARTERS } from "./library";
+import { STORYBOARD_STARTERS } from "./storyboard";
+import { STARTER_SURFACES, type StarterCardData, type StarterFill, type StarterInput, type StarterSurface } from "./types";
/** A sample file a starter brings: a published example input (src/lib/examples/media.generated.ts). */
export interface StarterSample {
@@ -36,10 +46,26 @@ export interface StarterProduct {
product: { name: string; description: string; sellingPoints: string[]; price: number; currency: string; image: StarterSample };
}
+/**
+ * A cover borrowed until the starter's own (starters/<id>) is made: another tile's ("<group>/<id>" in the covers
+ * manifest), an example's result, or the starter's own published pictures side by side (an element's).
+ */
+export type StarterCoverRef = { template: string } | { example: string } | { files: string[] };
+
/** What the owner's tap makes or fills. */
export type StarterSeed =
+ /** Assist: the composer gets "/skill words" (nothing is sent). */
+ | { kind: "assist"; skill?: string; prompt: string }
+ /** The Library's row: another studio's page with its example or starter loaded, for everyone. */
+ | { kind: "link"; href: string; ownerHref?: string }
+ /** Cinema Studio: a project with its look, its brief and the Director's shots, opened with shot 1 in the prompt bar. */
+ | { kind: "cinema"; project: { name: string; description: string }; director: DirectorSettings; brief: { title: string; body: string }; shots: DirectorShot[] }
+ /** Storyboard: the composer's story, frame count, shape and look. */
+ | { kind: "storyboard"; story: string; frames: number; aspectRatio: string; look?: string }
+ /** Elements: a saved element made from the starter's own files (`samples`). */
+ | { kind: "element"; element: { name: string; kind: ElementKind; description: string } }
| { kind: "faceless"; channel: { idea: string; genre: FacelessGenre; name: string }; episode: { topic: string; styleId: string; length: number } }
- | { kind: "fill"; fill: StarterFill }
+ | { kind: "fill"; fill: Extract<StarterFill, { kind: "content-factory" | "explainer" }> }
| { kind: "product"; kit: StarterProduct; open: { to: "brand" } | { to: "click-to-ad" } | { to: "marketing"; template: string } };
export interface Starter {
@@ -58,9 +84,14 @@ export interface Starter {
words: { label: string; text: string }[];
/** Until its own cover (starters/<id>) is made: a published preset cover that shows the same product. */
coverFrom?: string;
+ /** Or another published cover that shows the same thing (see StarterCoverRef). */
+ coverOf?: StarterCoverRef;
+ /** Published files it starts with (an element's pictures or recording), shown on its page and stored on the owner's tap. */
+ samples?: { label: string; src: string }[];
/**
- * The app that makes the same thing from the same photo, with that example loaded (`/apps/<app>?example=<example>`):
- * where a guest or an account goes from the starter's page, and the "More to try" tile its studio leaves out.
+ * The app (or the Video studio's effect or camera move) that makes the same thing from the same photo, with that
+ * example loaded (`/apps/<app>?example=<example>`, `/video?preset=<id>&example=<example>`): where a guest or an
+ * account goes from the starter's page, and the "More to try" tile its studio leaves out.
*/
tryIn?: { app: string; example: string };
seed: StarterSeed;
@@ -69,7 +100,29 @@ export interface Starter {
// ---------------------------------------------------------------------------
// The starters, one file per studio
-export const STARTERS: Starter[] = [...FACELESS_STARTERS, ...CONTENT_FACTORY_STARTERS, ...EXPLAINER_STARTERS, ...AD_STARTERS];
+export const STARTERS: Starter[] = [
+ ...ASSIST_STARTERS,
+ ...LIBRARY_STARTERS,
+ ...CINEMA_STARTERS,
+ ...STORYBOARD_STARTERS,
+ ...ELEMENT_STARTERS,
+ ...FACELESS_STARTERS,
+ ...CONTENT_FACTORY_STARTERS,
+ ...EXPLAINER_STARTERS,
+ ...AD_STARTERS,
+];
+
+/** The skills Assist's starters may name: built-in ones (tests/starters-studios.test.ts checks each is there). */
+export const ASSIST_STARTER_SKILLS = ["short-film", "faceless-video", "visual-studio"] as const;
+
+/**
+ * Skills that start from the person's own photo (a product's, a creator's) and ask for one when none is attached: a
+ * starter types words only, so it never names one of these (tests/starters-studios.test.ts reads each SKILL.md).
+ */
+export const PHOTO_SKILLS = ["product-photoshoot", "ugc-video"] as const;
+
+/** A starter's published file: an example input, or one of Fuobe's samples. */
+const published = (src: string) => (src.startsWith("/examples/") ? EXAMPLE_MEDIA[src]?.role === "in" : /^\/samples\/[a-z0-9-]+\/[a-z0-9.-]+$/.test(src));
// ---------------------------------------------------------------------------
// Checks, once, when the module loads
@@ -91,14 +144,46 @@ export function assertStarters(list: Starter[] = STARTERS): void {
if (!getCfPreset(f.presetId)) throw new Error(`Starter ${s.id}: no Content Factory preset ${f.presetId}`);
if (!CF_LENGTH_VALUES.includes(f.length)) throw new Error(`Starter ${s.id}: ${f.length} s isn't a Content Factory length`);
} else if (!EXPLAINER_STYLE_IDS.includes(f.styleId)) throw new Error(`Starter ${s.id}: no Explainer style ${f.styleId}`);
+ } else if (seed.kind === "assist") {
+ if (seed.skill && (PHOTO_SKILLS as readonly string[]).includes(seed.skill)) throw new Error(`Starter ${s.id}: ${seed.skill} asks for the person's own photo`);
+ if (seed.skill && !(ASSIST_STARTER_SKILLS as readonly string[]).includes(seed.skill)) throw new Error(`Starter ${s.id}: no Assist skill ${seed.skill}`);
+ if (`/${seed.skill ?? ""} ${seed.prompt}`.length > ASSIST_PROMPT_MAX) throw new Error(`Starter ${s.id}: its words are too long for Assist`);
+ } else if (seed.kind === "link") {
+ for (const href of [seed.href, ...(seed.ownerHref ? [seed.ownerHref] : [])]) {
+ const canvas = /^\/canvas\/start\/([a-z0-9-]+)$/.exec(href);
+ const example = /[?&]example=([^&]+)/.exec(href);
+ const starter = /[?&]starter=([^&]+)/.exec(href);
+ const preset = /[?&]preset=([^&]+)/.exec(href);
+ if (canvas && !getTemplate(canvas[1])) throw new Error(`Starter ${s.id}: no Canvas template ${canvas[1]}`);
+ if (example && !exampleById(decodeURIComponent(example[1]))) throw new Error(`Starter ${s.id}: no example ${example[1]}`);
+ if (preset && !getPreset(decodeURIComponent(preset[1]))) throw new Error(`Starter ${s.id}: no preset ${preset[1]}`);
+ if (starter && !list.some((x) => x.id === decodeURIComponent(starter[1]))) throw new Error(`Starter ${s.id}: no starter ${starter[1]}`);
+ if (!canvas && !example && !starter) throw new Error(`Starter ${s.id}: a link opens a ready board, an example or a starter`);
+ }
+ } else if (seed.kind === "cinema") {
+ if (seed.shots.length < 2 || seed.shots.length > 6) throw new Error(`Starter ${s.id}: a film has 2 to 6 shots`);
+ for (const shot of seed.shots) for (const m of shot.moves ?? []) if (!CAMERA_MOVES.some((c) => c.slug === m)) throw new Error(`Starter ${s.id}: no camera move ${m}`);
+ } else if (seed.kind === "storyboard") {
+ if (seed.frames < 2 || seed.frames > MAX_FRAMES) throw new Error(`Starter ${s.id}: ${seed.frames} frames`);
+ if (!(STORYBOARD_ASPECTS as readonly string[]).includes(seed.aspectRatio)) throw new Error(`Starter ${s.id}: no Storyboard shape ${seed.aspectRatio}`);
+ } else if (seed.kind === "element") {
+ if (!ELEMENT_KINDS.some((k) => k.kind === seed.element.kind)) throw new Error(`Starter ${s.id}: no element kind ${seed.element.kind}`);
+ const files = s.samples ?? [];
+ if (!files.length || files.length > MAX_ELEMENT_PHOTOS) throw new Error(`Starter ${s.id}: an element starts with 1 to ${MAX_ELEMENT_PHOTOS} files`);
} else {
if (!EXAMPLE_MEDIA[seed.kit.product.image.src]) throw new Error(`Starter ${s.id}: ${seed.kit.product.image.src} isn't a published example file`);
if (seed.open.to === "marketing" && !TEMPLATE_INDEX.get(seed.open.template)) throw new Error(`Starter ${s.id}: no Marketing template ${seed.open.template}`);
}
if (s.coverFrom && (!presetCover(s.coverFrom) || !PRESET_PEAKS[s.coverFrom])) throw new Error(`Starter ${s.id}: no preset cover with a finished frame ${s.coverFrom}`);
+ for (const f of s.samples ?? []) if (!published(f.src)) throw new Error(`Starter ${s.id}: ${f.src} isn't a published example input or sample`);
+ const ref = s.coverOf;
+ if (ref && "template" in ref && !TEMPLATE_GROUPS.includes(ref.template.split("/")[0] as TemplateGroup)) throw new Error(`Starter ${s.id}: no cover group in ${ref.template}`);
+ if (ref && "example" in ref && !exampleById(ref.example)) throw new Error(`Starter ${s.id}: no example ${ref.example}`);
+ if (ref && "files" in ref && ref.files.some((f) => !EXAMPLE_MEDIA[f])) throw new Error(`Starter ${s.id}: a cover file isn't a published example file`);
if (s.tryIn) {
if (!getPreset(s.tryIn.app)) throw new Error(`Starter ${s.id}: no app ${s.tryIn.app}`);
- if (exampleSurfaceOf(s.tryIn.example) !== `app:${s.tryIn.app}`) throw new Error(`Starter ${s.id}: ${s.tryIn.example} isn't an example of ${s.tryIn.app}`);
+ const of = exampleSurfaceOf(s.tryIn.example);
+ if (of !== `app:${s.tryIn.app}` && of !== `preset:${s.tryIn.app}`) throw new Error(`Starter ${s.id}: ${s.tryIn.example} isn't an example of ${s.tryIn.app}`);
}
}
}
@@ -123,15 +208,52 @@ function presetAsCover(id: string): TemplateCover | undefined {
return { poster, thumb, frames: [{ src: poster, thumb }] };
}
-/** A starter's real cover: its own (starters/<id>), else the preset cover that shows the same thing. */
-export function starterCover(s: Pick<Starter, "id" | "coverFrom">): TemplateCover | undefined {
- return templateCover("starters", s.id) ?? (s.coverFrom ? presetAsCover(s.coverFrom) : undefined);
+/** A published example file's display URL (its content version), and its small copy. */
+function exampleFrame(src: string) {
+ const f = EXAMPLE_MEDIA[src];
+ if (!f) return undefined;
+ const url = `${src}?v=${f.v}`;
+ return { src: url, thumb: f.thumb ?? f.poster ?? url };
}
+/** A borrowed cover (StarterCoverRef), or undefined while that one isn't published either. */
+function borrowedCover(ref: StarterCoverRef): TemplateCover | undefined {
+ if ("template" in ref) {
+ const [group, id] = ref.template.split("/");
+ return templateCover(group as TemplateGroup, id);
+ }
+ if ("example" in ref) {
+ const out = exampleById(ref.example)?.output;
+ if (!out) return undefined;
+ const poster = out.rest?.src ?? out.poster ?? out.src;
+ const still = out.kind === "image" ? out.src : poster;
+ return {
+ poster: still,
+ thumb: out.poster ?? still,
+ ...(out.kind === "video" && { video: out.src, ...(out.rest && { at: out.rest.at }) }),
+ frames: [{ src: still, thumb: out.poster ?? still }],
+ };
+ }
+ const frames = ref.files.map(exampleFrame);
+ if (!frames.length || frames.some((f) => !f)) return undefined;
+ const all = frames as NonNullable<ReturnType<typeof exampleFrame>>[];
+ return { poster: all[0].src, thumb: all[0].thumb, frames: all };
+}
+
+/** A starter's real cover: its own (starters/<id>), else the published cover that shows the same thing. */
+export function starterCover(s: Pick<Starter, "id" | "coverFrom" | "coverOf">): TemplateCover | undefined {
+ return templateCover("starters", s.id) ?? (s.coverFrom ? presetAsCover(s.coverFrom) : undefined) ?? (s.coverOf ? borrowedCover(s.coverOf) : undefined);
+}
+
+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;
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 })),
];
}
@@ -152,13 +274,36 @@ export function starterCard(s: Starter): StarterCardData {
inputs: inputs(s),
...(cover && { cover }),
coverKey: `starters/${s.id}`,
+ ...(s.seed.kind === "element" && s.seed.element.kind === "character" && { coverTop: true }),
...(s.tryIn && {
- tryIn: { href: `/apps/${s.tryIn.app}?example=${encodeURIComponent(s.tryIn.example)}`, label: getPreset(s.tryIn.app)?.name ?? "the app", example: s.tryIn.example },
+ tryIn: { href: tryInHref(s.tryIn), label: getPreset(s.tryIn.app)?.name ?? "the app", example: s.tryIn.example },
}),
- use: s.seed.kind === "fill" ? { kind: "fill", href: `${s.surface === "content-factory" ? "/content-factory" : "/explainer"}?starter=${encodeURIComponent(s.id)}` } : { kind: "create" },
+ // A guest or an account sees the story in Storyboard's composer, with its price (Generate is the owner's).
+ ...(s.seed.kind === "storyboard" && { tryIn: { href: fillHref(s), label: "Storyboard", text: "See it in Storyboard" } }),
+ use: starterUse(s),
};
}
+/** An app's page, or the Video studio with an effect or a camera move, with its example loaded. */
+const tryInHref = ({ app, example }: { app: string; example: string }) =>
+ app.startsWith("app-") ? `/apps/${app}?example=${encodeURIComponent(example)}` : `/video?preset=${app}&example=${encodeURIComponent(example)}`;
+
+/** Where a "fill" starter opens: its studio, with `?starter=<id>`. */
+const fillHref = (s: Starter) => `${STARTER_SURFACES[s.surface].base}?starter=${encodeURIComponent(s.id)}`;
+
+function starterUse(s: Starter): StarterCardData["use"] {
+ switch (s.seed.kind) {
+ case "fill":
+ case "assist":
+ case "storyboard":
+ return { kind: "fill", href: fillHref(s) };
+ case "link":
+ return { kind: "link", href: s.seed.href, ...(s.seed.ownerHref && { ownerHref: s.seed.ownerHref }) };
+ default:
+ return { kind: "create" };
+ }
+}
+
/**
* A surface's starters as cards, covered first, then by rank. A page's props (prerendered, the same for everyone) get
* only the covered ones: a starter with no cover yet is the owner's, who loads the rest from GET /api/starters, so its
@@ -171,11 +316,6 @@ export function starterCards(surface: StarterSurface, { all = false }: { all?: b
.sort((a, b) => Number(!a.cover) - Number(!b.cover) || a.rank - b.rank);
}
-/** The composers' fills of a surface, by starter id (small: the page gets them all), the covered ones unless `all`. */
-export function starterFills(surface: "content-factory" | "explainer", { all = false }: { all?: boolean } = {}): Record<string, StarterFill> {
- return Object.fromEntries(STARTERS.flatMap((s) => (s.surface === surface && s.seed.kind === "fill" && (all || starterCover(s)) ? [[s.id, s.seed.fill] as const] : [])));
-}
-
/** Studios whose starters speak through a narrator (Faceless, Content Factory, Explainer). */
const NARRATED: ReadonlySet<StarterSurface> = new Set(["faceless", "content-factory", "explainer"]);
@@ -187,6 +327,28 @@ export function starterVoice(s: Pick<Starter, "id" | "surface">): StarterSample
return NARRATED.has(s.surface) ? { src: `/starters/${s.id}/1/voice.m4a`, name: "Narrator" } : undefined;
}
+/** What a "fill" starter puts into its studio's composer. */
+function fillOf(s: Starter): StarterFill | undefined {
+ const seed = s.seed;
+ if (seed.kind === "fill") return seed.fill;
+ if (seed.kind === "assist") return { kind: "assist", text: `${seed.skill ? `/${seed.skill} ` : ""}${seed.prompt}` };
+ if (seed.kind === "storyboard") return { kind: "storyboard", story: seed.story, frames: seed.frames, aspectRatio: seed.aspectRatio, ...(seed.look && { look: seed.look }) };
+ return undefined;
+}
+
+/** The studios whose starters fill a composer on the page. */
+export type FillSurface = "assist" | "storyboard" | "content-factory" | "explainer";
+
+/** The composers' fills of a surface, by starter id (small: the page gets them all), the covered ones unless `all`. */
+export function starterFills(surface: FillSurface, { all = false }: { all?: boolean } = {}): Record<string, StarterFill> {
+ return Object.fromEntries(
+ STARTERS.flatMap((s) => {
+ const fill = s.surface === surface && (all || starterCover(s)) ? fillOf(s) : undefined;
+ return fill ? [[s.id, fill] as const] : [];
+ }),
+ );
+}
+
/** Every starter page of a surface, prerendered. */
export const starterIds = (surface: StarterSurface) => STARTERS.filter((s) => s.surface === surface).map((s) => s.id);
diff --git a/src/lib/starters/cinema.ts b/src/lib/starters/cinema.ts
new file mode 100644
index 00000000..c1be4493
--- /dev/null
+++ b/src/lib/starters/cinema.ts
@@ -0,0 +1,141 @@
+import "server-only";
+import type { DirectorShot } from "@/lib/catalog/cinema";
+import type { Starter } from "./catalog";
+
+const shot = (title: string, prompt: string, moves: string[], duration = 5): DirectorShot => ({ title, prompt, duration, moves, settings: {} });
+
+/** The brief's words: the film in one line, then its shots. */
+const brief = (logline: string, shots: DirectorShot[]) => `${logline}\n\n${shots.map((s, i) => `${i + 1}. ${s.title}: ${s.prompt}`).join("\n")}`;
+
+const RIVIERA = [
+ shot(
+ "Wide, the terrace",
+ "A fashion model in a long emerald silk gown walks out of a Monte Carlo casino onto the terrace at blue hour, warm lamps along the stone balustrade, the harbour lights glittering below.",
+ ["dolly-in"],
+ ),
+ shot("Close-up, the turn", "Close-up of the model in the emerald silk gown as she turns to the lens, the warm terrace lamps catching her face and her diamond earrings, the harbour soft behind her.", ["arc-left"]),
+ shot(
+ "Medium, the drive",
+ "The model in the emerald silk gown steps into a silver vintage convertible and drives off along the coast road at blue hour, the lights of Monaco glowing below the cliffs.",
+ ["tracking"],
+ ),
+];
+
+const NOIR = [
+ shot("Wide, the street", "A fashion model in a black satin trench coat walks a rain-slick Paris street at night, the shop windows and street lamps shining in the wet cobbles.", ["tracking"]),
+ shot("Close-up, the bottle", "Close-up of her gloved hand lifting a matte black perfume bottle with a gold cap into the lamplight, raindrops glittering behind it.", ["slow-zoom-in"]),
+ shot("Wide, the doorway", "The model in the black satin trench coat walks into a glowing hotel doorway, the rain shining in the golden light behind her.", ["dolly-out"]),
+];
+
+const DESERT = [
+ shot("Aerial, the 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.", ["crane-up"]),
+ shot("Tracking, the ridge", "The saffron silk streams behind the model as she walks along the sharp ridge of the dune, the low sun turning the sand to copper.", ["side-tracking"]),
+ shot("Close-up, the look back", "Close-up of the model looking back at the lens over her shoulder, the rising sun behind her lighting the edge of her saffron silk veil.", ["slow-zoom-in"]),
+];
+
+/**
+ * Cinema Studio's starters: a project with its look (genre, camera, lens, light, palette), its brief and three shots
+ * the AI Director proposes; it opens with shot 1 in the prompt bar. Every slug and move is checked against the
+ * catalog (tests/starters-catalog.test.ts).
+ */
+export const CINEMA_STARTERS: Starter[] = [
+ {
+ id: "cinema.riviera-night",
+ surface: "cinema",
+ rank: 1,
+ name: "Riviera night",
+ description: "A three-shot fashion film on the Côte d'Azur at blue hour",
+ icon: "Moon",
+ hue: 160,
+ flow: ["Look", "3 shots", "Film"],
+ steps: [
+ "The look is set: drama, 35mm film, anamorphic lens, warm practical lamps and a blue-hour palette.",
+ "Shot 1: she walks out of the casino onto the terrace, the harbour lights below.",
+ "Shot 2: she turns to the lens as the terrace lamps catch her face.",
+ "Shot 3: she drives off in a silver vintage convertible along the coast road.",
+ ],
+ makes: "A short fashion film in three shots, each about 5 seconds.",
+ words: RIVIERA.map((s, i) => ({ label: `Shot ${i + 1}`, text: s.prompt })),
+ seed: {
+ kind: "cinema",
+ project: { name: "Riviera night", description: "A three-shot fashion film on the Côte d'Azur at blue hour" },
+ director: {
+ genre: "drama",
+ era: "2020s",
+ tempo: "calm",
+ camera: "35mm-film",
+ lens: "anamorphic",
+ aperture: "f14-wide-open",
+ lighting: { kind: "preset", slug: "practicals" },
+ palette: { kind: "preset", slug: "twilight-fable" },
+ },
+ brief: { title: "Riviera night", body: brief("A model in an emerald silk gown leaves the casino at blue hour and drives off along the coast.", RIVIERA) },
+ shots: RIVIERA,
+ },
+ },
+ {
+ id: "cinema.noir-perfume",
+ surface: "cinema",
+ rank: 2,
+ name: "Nuit Noire",
+ description: "A noir perfume film in three shots on a rainy Paris night",
+ icon: "Gem",
+ hue: 270,
+ flow: ["Look", "3 shots", "Film"],
+ steps: [
+ "The look is set: noir, a clean modern lens and light from behind.",
+ "Shot 1: she walks a rain-slick Paris street at night.",
+ "Shot 2: her gloved hand lifts the black bottle into the lamplight.",
+ "Shot 3: she walks into a glowing hotel doorway.",
+ ],
+ makes: "A perfume film in three shots, each about 5 seconds.",
+ words: NOIR.map((s, i) => ({ label: `Shot ${i + 1}`, text: s.prompt })),
+ seed: {
+ kind: "cinema",
+ project: { name: "Nuit Noire", description: "A noir perfume film in three shots on a rainy Paris night" },
+ director: {
+ genre: "noir",
+ tempo: "calm",
+ camera: "modern",
+ lens: "clean-sharp",
+ lighting: { kind: "preset", slug: "contre-jour" },
+ // Deep blacks and muted gold: the night, the rain and the bottle's cap.
+ palette: { kind: "preset", slug: "oil-ochre" },
+ },
+ brief: { title: "Nuit Noire", body: brief("A model in a black satin trench walks through the Paris rain with a matte black perfume bottle.", NOIR) },
+ shots: NOIR,
+ },
+ },
+ {
+ id: "cinema.desert-couture",
+ surface: "cinema",
+ rank: 3,
+ name: "Desert couture",
+ description: "An epic three-shot couture film on the Sahara dunes at sunrise",
+ icon: "Sun",
+ hue: 35,
+ flow: ["Look", "3 shots", "Film"],
+ steps: [
+ "The look is set: epic, an anamorphic lens, silhouette light and an ochre palette.",
+ "Shot 1: from the air, she stands on the crest of a vast dune at sunrise.",
+ "Shot 2: the saffron silk streams behind her as she walks the ridge.",
+ "Shot 3: she looks back at the lens, the sun behind her.",
+ ],
+ makes: "A couture film in three shots, each about 5 seconds.",
+ words: DESERT.map((s, i) => ({ label: `Shot ${i + 1}`, text: s.prompt })),
+ seed: {
+ kind: "cinema",
+ project: { name: "Desert couture", description: "An epic three-shot couture film on the Sahara dunes at sunrise" },
+ director: {
+ genre: "epic",
+ tempo: "calm",
+ camera: "modern",
+ lens: "anamorphic",
+ lighting: { kind: "preset", slug: "silhouette" },
+ palette: { kind: "preset", slug: "oil-ochre" },
+ },
+ brief: { title: "Desert couture", body: brief("A model in flowing saffron silk on the Sahara dunes at sunrise.", DESERT) },
+ shots: DESERT,
+ },
+ },
+];
diff --git a/src/lib/starters/elements.ts b/src/lib/starters/elements.ts
new file mode 100644
index 00000000..215a685e
--- /dev/null
+++ b/src/lib/starters/elements.ts
@@ -0,0 +1,96 @@
+import "server-only";
+import type { Starter } from "./catalog";
+
+/**
+ * Elements' starters: a character, a place, a product, a look and a voice, each made from Fuobe's own published
+ * pictures (or its voice sample). The owner's tap saves it as an element, ready to @mention in any prompt; the cover is
+ * the element's own pictures.
+ */
+export const ELEMENT_STARTERS: Starter[] = [
+ {
+ id: "elements.amara",
+ surface: "elements",
+ rank: 1,
+ name: "Amara",
+ description: "A fashion model with a sleek high bun, ready to cast in any image or video",
+ icon: "User",
+ hue: 30,
+ flow: ["Photo", "Element", "Any shot"],
+ steps: ["Her studio portrait is saved as a character.", "Type @Amara in any image or video prompt to cast her.", "Her face stays the same from shot to shot."],
+ makes: "A character element called @Amara.",
+ words: [],
+ samples: [{ label: "Portrait", src: "/examples/app-makeup-studio/1/in-image.jpg" }],
+ coverOf: { files: ["/examples/app-makeup-studio/1/in-image.jpg"] },
+ tryIn: { app: "app-makeup-studio", example: "app-makeup-studio.1" },
+ seed: { kind: "element", element: { name: "Amara", kind: "character", description: "A fashion model in her late twenties, deep brown skin, dark hair in a sleek high bun, sculpted cheekbones" } },
+ },
+ {
+ id: "elements.highland-castle",
+ surface: "elements",
+ rank: 2,
+ name: "Highland castle",
+ description: "A castle on a tidal island in a Scottish loch, among autumn hills",
+ icon: "Castle",
+ hue: 140,
+ flow: ["Photo", "Element", "Any shot"],
+ steps: ["The aerial photo is saved as a location.", "Type @Highland_castle in a prompt to set a scene there."],
+ makes: "A location element called @Highland_castle.",
+ words: [],
+ samples: [{ label: "The place", src: "/examples/motion-helicopter-shot/1/in-image.jpg" }],
+ coverOf: { files: ["/examples/motion-helicopter-shot/1/in-image.jpg"] },
+ tryIn: { app: "motion-helicopter-shot", example: "motion-helicopter-shot.1" },
+ seed: { kind: "element", element: { name: "Highland castle", kind: "location", description: "A stone castle on a tidal island in a Scottish loch, a footbridge to the shore, autumn hills and low cloud" } },
+ },
+ {
+ id: "elements.solitaire-ring",
+ surface: "elements",
+ rank: 3,
+ name: "Solitaire ring",
+ description: "An emerald-cut diamond on a platinum band, for jewellery shots and ads",
+ icon: "Gem",
+ hue: 220,
+ flow: ["Photo", "Element", "Any shot"],
+ steps: ["The product photo is saved as a prop.", "Type @Solitaire_ring in a prompt to put the ring in a shot."],
+ makes: "A prop element called @Solitaire_ring.",
+ words: [],
+ samples: [{ label: "The ring", src: "/examples/app-macroshot-product/1/in-image.jpg" }],
+ coverOf: { files: ["/examples/app-macroshot-product/1/in-image.jpg"] },
+ tryIn: { app: "app-macroshot-product", example: "app-macroshot-product.1" },
+ seed: { kind: "element", element: { name: "Solitaire ring", kind: "prop", description: "An emerald-cut diamond solitaire ring on a slim platinum band" } },
+ },
+ {
+ id: "elements.gilded-salon",
+ surface: "elements",
+ rank: 4,
+ name: "Gilded salon",
+ description: "Warm gold light in grand old rooms: a look for editorial fashion",
+ icon: "Palette",
+ hue: 45,
+ flow: ["2 photos", "Element", "Any shot"],
+ steps: ["Two photos that share the look are saved as a style.", "Type @Gilded_salon in a prompt to give a picture the same light and colour."],
+ makes: "A style element called @Gilded_salon.",
+ words: [],
+ samples: [
+ { label: "The ballroom", src: "/examples/app-dance/1/in-image.jpg" },
+ { label: "The library", src: "/examples/motion-dolly-in/1/in-image.jpg" },
+ ],
+ coverOf: { files: ["/examples/app-dance/1/in-image.jpg", "/examples/motion-dolly-in/1/in-image.jpg"] },
+ tryIn: { app: "motion-dolly-in", example: "motion-dolly-in.1" },
+ seed: { kind: "element", element: { name: "Gilded salon", kind: "style", description: "Grand gilded interiors in warm golden light, polished wood and marble, rich deep colour, editorial fashion" } },
+ },
+ {
+ id: "elements.studio-voice",
+ surface: "elements",
+ rank: 5,
+ name: "Studio voice",
+ description: "A woman's clear, calm voice, for narration and talking clips",
+ icon: "AudioLines",
+ hue: 280,
+ flow: ["Recording", "Voice"],
+ steps: ["A clean recording of her voice is saved as a voice.", "Pick it as the voice in Audio, a talking clip or a narration."],
+ makes: "A voice element called Studio voice.",
+ words: [],
+ samples: [{ label: "Recording", src: "/samples/clean-voice/clean.m4a" }],
+ seed: { kind: "element", element: { name: "Studio voice", kind: "voice", description: "A woman's clear, calm voice, close to the microphone" } },
+ },
+];
diff --git a/src/lib/starters/ids.ts b/src/lib/starters/ids.ts
index 2b922304..f774e435 100644
--- a/src/lib/starters/ids.ts
+++ b/src/lib/starters/ids.ts
@@ -3,10 +3,15 @@
* (src/lib/record-pages.ts unknownStarterPage), and so does one with no real cover yet for anyone but the owner
* (hiddenStarterPage). tests/starters-catalog.test.ts checks both match the catalog.
*/
-import { templateCover } from "@/lib/template-covers";
+import { templateCover, type TemplateGroup } from "@/lib/template-covers";
import type { StarterSurface } from "./types";
export const STARTER_IDS: Record<StarterSurface, readonly string[]> = {
+ assist: ["assist.jewel-campaign", "assist.monaco-short", "assist.linen-lookbook", "assist.serum-ugc", "assist.boat-hotels"],
+ library: ["library.pearl-earring", "library.namib-gown", "library.superstar", "library.perfume-storyboard"],
+ cinema: ["cinema.riviera-night", "cinema.noir-perfume", "cinema.desert-couture"],
+ storyboard: ["storyboard.perfume-ad", "storyboard.heist", "storyboard.capri-swim"],
+ elements: ["elements.amara", "elements.highland-castle", "elements.solitaire-ring", "elements.gilded-salon", "elements.studio-voice"],
faceless: ["faceless.boat-hotels", "faceless.couture-icons", "faceless.lost-empires"],
"content-factory": ["cf.underwater-fashion-week", "cf.perfume-atelier", "cf.narcissus"],
explainer: ["ex.couture-400-hours", "ex.riviera-light", "ex.perfume-notes"],
@@ -15,8 +20,33 @@ export const STARTER_IDS: Record<StarterSurface, readonly string[]> = {
marketing: ["mk.perfume-moss", "mk.bag-packshot"],
};
-/** The starters shown with another cover until their own is made (Starter.coverFrom in the catalog). */
-const BORROWED_COVER: ReadonlySet<string> = new Set(["mk.perfume-moss", "mk.bag-packshot"]);
+/**
+ * The starters shown with another cover that is always there until their own is made: a preset's (Starter.coverFrom),
+ * an example's result or the starter's own published pictures (Starter.coverOf `example` / `files`).
+ */
+const BORROWED_COVER: ReadonlySet<string> = new Set([
+ "mk.perfume-moss",
+ "mk.bag-packshot",
+ "library.namib-gown",
+ "elements.amara",
+ "elements.highland-castle",
+ "elements.solitaire-ring",
+ "elements.gilded-salon",
+]);
+
+/** The starters that borrow another tile's cover (Starter.coverOf `template`), shown once that one is published. */
+const BORROWED_TILE: Readonly<Record<string, readonly [TemplateGroup, string]>> = {
+ "assist.monaco-short": ["starters", "cinema.riviera-night"],
+ "assist.boat-hotels": ["starters", "faceless.boat-hotels"],
+ "storyboard.heist": ["examples", "storyboard-heist"],
+ "library.pearl-earring": ["canvas", "effect-chain-pearl-earring"],
+ "library.superstar": ["canvas", "effect-chain-superstar"],
+ "library.perfume-storyboard": ["starters", "storyboard.perfume-ad"],
+};
/** Whether a starter has a real cover, so visitors see it: its own (starters/<id>), or one it borrows. */
-export const starterCovered = (id: string): boolean => BORROWED_COVER.has(id) || !!templateCover("starters", id);
+export function starterCovered(id: string): boolean {
+ if (BORROWED_COVER.has(id) || templateCover("starters", id)) return true;
+ const tile = Object.hasOwn(BORROWED_TILE, id) ? BORROWED_TILE[id] : undefined;
+ return !!tile && !!templateCover(tile[0], tile[1]);
+}
diff --git a/src/lib/starters/library.ts b/src/lib/starters/library.ts
new file mode 100644
index 00000000..c46c60a5
--- /dev/null
+++ b/src/lib/starters/library.ts
@@ -0,0 +1,67 @@
+import "server-only";
+import type { Starter } from "./catalog";
+
+/** The Library's "Make your first" row: one tap opens a studio with a ready example or starter loaded, for everyone. */
+export const LIBRARY_STARTERS: Starter[] = [
+ {
+ id: "library.pearl-earring",
+ surface: "library",
+ rank: 1,
+ name: "A portrait that comes alive",
+ description: "A photo becomes a Dutch Golden Age painting, then a moving shot",
+ icon: "Gem",
+ hue: 220,
+ flow: ["Photo", "Scene", "Film"],
+ steps: ["The Video studio opens with the effect and a photo in place.", "Press Generate, or use your own photo."],
+ makes: "A painted portrait and a short film of it.",
+ coverOf: { template: "canvas/effect-chain-pearl-earring" },
+ words: [],
+ // The Video studio with the effect and its photo loaded; the owner opens the ready board, which they can save.
+ seed: { kind: "link", href: "/video?preset=effect-pearl-earring&example=effect-pearl-earring.1", ownerHref: "/canvas/start/effect-chain-pearl-earring" },
+ },
+ {
+ id: "library.namib-gown",
+ surface: "library",
+ rank: 2,
+ name: "A gown on a Namib dune",
+ description: "A ready prompt for a fashion still in the desert at golden hour",
+ icon: "Image",
+ hue: 25,
+ flow: ["Prompt", "Still"],
+ steps: ["The Image studio opens with the prompt in place.", "Press Generate, or change any word first."],
+ makes: "A fashion still.",
+ coverOf: { example: "image.1" },
+ words: [],
+ seed: { kind: "link", href: "/image?example=image.1" },
+ },
+ {
+ id: "library.superstar",
+ surface: "library",
+ rank: 3,
+ name: "Superstar on stage",
+ description: "A photo becomes a moving shot on a stadium stage under the lights",
+ icon: "Star",
+ hue: 300,
+ flow: ["Photo", "Film"],
+ steps: ["The Video studio opens with the effect and a photo in place.", "Press Generate, or use your own photo."],
+ makes: "A short film on a stadium stage.",
+ coverOf: { template: "canvas/effect-chain-superstar" },
+ words: [],
+ seed: { kind: "link", href: "/video?preset=effect-superstar&example=effect-superstar.1" },
+ },
+ {
+ id: "library.perfume-storyboard",
+ surface: "library",
+ rank: 4,
+ name: "Perfume ad in 6 frames",
+ description: "A ready story for Storyboard: a night in Paris with a black perfume bottle",
+ icon: "Clapperboard",
+ hue: 40,
+ flow: ["Story", "6 frames"],
+ steps: ["Storyboard opens with the story, the frames and the look in place.", "Press Generate, or change anything first."],
+ makes: "Six frames of one perfume ad.",
+ coverOf: { template: "starters/storyboard.perfume-ad" },
+ words: [],
+ seed: { kind: "link", href: "/storyboard?starter=storyboard.perfume-ad" },
+ },
+];
diff --git a/src/lib/starters/storyboard.ts b/src/lib/starters/storyboard.ts
new file mode 100644
index 00000000..289000b2
--- /dev/null
+++ b/src/lib/starters/storyboard.ts
@@ -0,0 +1,65 @@
+import "server-only";
+import type { Starter } from "./catalog";
+
+const PERFUME =
+ "Nuit Noire perfume ad. A model in a black satin gown on a Paris balcony at night; a close-up of her hand lifting the matte black bottle; the gold cap catching the light; she sprays it and the mist glitters in the street light; she walks down a glowing hotel corridor; the bottle on black marble with the city lights behind it.";
+
+const HEIST =
+ "A jewel heist in Paris at night. A model in a black trench coat crouches on a zinc rooftop above the glowing boulevards; a close-up as she checks a slim gold watch on her gloved wrist; she lowers herself on a rope through a glass skylight into a dark jewellery salon; she lifts a diamond necklace from a glowing display case; she runs along a rain-slick street past glowing café terraces; she smiles in the back of a black vintage car, the Eiffel Tower glowing through the rear window.";
+
+const CAPRI =
+ "A swimwear campaign on Capri: a model in a white one-piece on the rocks at sunrise; diving into turquoise water; laughing on a yacht deck; walking a cliff path in a linen shirt at golden hour.";
+
+/**
+ * Storyboard's starters: a story, its frame count, its shape and its look, put into the composer for everyone (the
+ * price shows at once; Generate runs it for the owner).
+ */
+export const STORYBOARD_STARTERS: Starter[] = [
+ {
+ id: "storyboard.perfume-ad",
+ surface: "storyboard",
+ rank: 1,
+ name: "Perfume ad in 6 frames",
+ description: "A night in Paris with a black perfume bottle, from the balcony to black marble",
+ icon: "Gem",
+ hue: 40,
+ flow: ["Story", "6 frames"],
+ steps: [
+ "The story is split into six frames.",
+ "Frame 1 sets the model, the gown and the night light.",
+ "Each next frame is made from the one before, so her face and the gown carry through.",
+ ],
+ makes: "Six 16:9 frames of one perfume ad, ready to animate into a film.",
+ words: [{ label: "The story", text: PERFUME }],
+ seed: { kind: "storyboard", story: PERFUME, frames: 6, aspectRatio: "16:9", look: "v1-quiet-luxury" },
+ },
+ {
+ id: "storyboard.heist",
+ surface: "storyboard",
+ rank: 2,
+ name: "A heist in Paris",
+ description: "Six frames of a jewel heist, from the rooftops to a getaway car",
+ icon: "Moon",
+ hue: 230,
+ flow: ["Story", "6 frames"],
+ steps: ["The story is split into six frames.", "Frame 1 sets the model on the rooftop at night.", "Each next frame is made from the one before, so she stays the same."],
+ makes: "Six 16:9 frames of one heist, ready to animate into a film.",
+ words: [{ label: "The story", text: HEIST }],
+ coverOf: { template: "examples/storyboard-heist" },
+ seed: { kind: "storyboard", story: HEIST, frames: 6, aspectRatio: "16:9" },
+ },
+ {
+ id: "storyboard.capri-swim",
+ surface: "storyboard",
+ rank: 3,
+ name: "Swimwear on Capri",
+ description: "Four vertical frames of a swimwear campaign, from sunrise to golden hour",
+ icon: "Sun",
+ hue: 190,
+ flow: ["Story", "4 frames"],
+ steps: ["The story is split into four frames.", "Frame 1 sets the model on the rocks at sunrise.", "Each next frame is made from the one before, in warm film colour."],
+ makes: "Four 9:16 frames for phones, ready to animate into a film.",
+ words: [{ label: "The story", text: CAPRI }],
+ seed: { kind: "storyboard", story: CAPRI, frames: 4, aspectRatio: "9:16", look: "v2-warm-vivid-film" },
+ },
+];
diff --git a/src/lib/starters/types.ts b/src/lib/starters/types.ts
index 301059dd..42205f5c 100644
--- a/src/lib/starters/types.ts
+++ b/src/lib/starters/types.ts
@@ -1,14 +1,50 @@
/**
- * Ready-made starters outside Canvas (client-safe: no catalog). A starter is a real piece of work, a channel, a series,
- * an explainer, a brand kit or a product with its photo, filled with its own words and settings, so it runs as it is.
+ * Ready-made starters outside Canvas (client-safe: no catalog). A starter is a real piece of work, a chat's whole job, a
+ * film, a story, an element, a channel, a series, an explainer, a brand kit or a product with its photo, filled with its own words and settings, so it runs as it is.
* The list lives on the server (src/lib/starters/catalog.ts); pages get these slim cards as props.
*/
import type { TemplateCover } from "@/lib/template-covers";
-export type StarterSurface = "faceless" | "content-factory" | "explainer" | "ads" | "click-to-ad" | "marketing";
+export type StarterSurface = "assist" | "library" | "cinema" | "storyboard" | "elements" | "faceless" | "content-factory" | "explainer" | "ads" | "click-to-ad" | "marketing";
-/** Where each surface lives, and where its starters' pages are (`<base>/start/<id>`). */
-export const STARTER_SURFACES: Record<StarterSurface, { base: string; name: string; section: string; note: string; unavailable: string }> = {
+/**
+ * Where each surface lives, and where its starters' pages are (`<base>/start/<id>`). `note` is the line under the
+ * section's title; `visitorNote`, where it differs, a guest's or an account's.
+ */
+export const STARTER_SURFACES: Record<StarterSurface, { base: string; name: string; section: string; note: string; visitorNote?: string; unavailable: string }> = {
+ assist: {
+ base: "/assist",
+ name: "Assist",
+ section: "Start from a ready job",
+ note: "Each one types a whole job into the box above. Change anything, then send.",
+ visitorNote: "A whole job in one message. See how each one is made.",
+ unavailable: "Assist isn't available here.",
+ },
+ library: { base: "/library", name: "Library", section: "Make your first", note: "Each one opens a studio with everything in place. Change anything, then make it.", unavailable: "" },
+ cinema: {
+ base: "/cinema",
+ name: "Cinema Studio",
+ section: "Start from a ready film",
+ note: "Each one comes with its look, its brief and three shots. It opens with shot 1 ready to make.",
+ visitorNote: "Each one comes with its look, its brief and three shots.",
+ unavailable: "Projects aren't available here.",
+ },
+ storyboard: {
+ base: "/storyboard",
+ name: "Storyboard",
+ section: "Start from a ready story",
+ note: "Each one puts its story, frames, shape and look into the box above. Change anything, then make it.",
+ visitorNote: "A story, its frames, its shape and its look, ready to make.",
+ unavailable: "Storyboards aren't available here.",
+ },
+ elements: {
+ base: "/elements",
+ name: "Elements",
+ section: "Start with a ready element",
+ note: "A model, a place, a product and a look, each saved from its own pictures. Then type its @name in any image or video prompt.",
+ visitorNote: "A model, a place, a product and a look, each made from its own pictures.",
+ unavailable: "Elements aren't available here.",
+ },
faceless: { base: "/faceless", name: "Faceless Studio", section: "Start from a ready channel", note: "Each one comes with its idea, its first episode and its look, so it runs as it is.", unavailable: "Faceless channels aren't available here." },
"content-factory": { base: "/content-factory", name: "Content Factory", section: "Start from a ready series", note: "A style and an idea, ready to make. Change anything before you start.", unavailable: "Content Factory isn't available here." },
explainer: { base: "/explainer", name: "Explainer", section: "Start from a ready explainer", note: "A topic, a style and a length, ready to make.", unavailable: "Explainer videos aren't available here." },
@@ -22,10 +58,19 @@ export interface StarterInput {
label: string;
text?: string;
image?: { thumb: string; name: string };
+ /** A recording, played on its page. */
+ audio?: { src: string; name: string };
}
-/** What the owner's "Use template" does: make it on the server (POST /api/starters/<id>), or fill the composer on this page. */
-export type StarterUse = { kind: "create" } | { kind: "fill"; href: string };
+/**
+ * What the owner's "Use template" does: make it on the server (POST /api/starters/<id>), or fill the composer on this
+ * page. A "link" (the Library's row) opens another studio with everything loaded there, for everyone.
+ */
+export type StarterUse =
+ | { kind: "create" }
+ | { kind: "fill"; href: string }
+ /** `ownerHref`: where it opens for the owner, when that differs (a ready board the owner can save). */
+ | { kind: "link"; href: string; ownerHref?: string };
/** A starter as its card and its page show it. Its words are visitor words: no model names. */
export interface StarterCardData {
@@ -48,16 +93,24 @@ export interface StarterCardData {
cover?: TemplateCover;
/** The cover's key, for one-clip-at-a-time playback. */
coverKey: string;
+ /** A portrait cover: shown from its top, so a head is never cut off in a wide frame. */
+ coverTop?: boolean;
use: StarterUse;
- /** The app that makes the same from the same photo, its example loaded: a visitor's next step from the page. */
- tryIn?: { href: string; label: string; example: string };
+ /**
+ * Where a guest or an account goes on from its page: the app that makes the same from the same photo, its example
+ * loaded (`example`), or the studio with this starter in its composer. `text`: the button's words, when "Try it in
+ * <label>" would promise more than a visitor can do there.
+ */
+ tryIn?: { href: string; label: string; example?: string; text?: string };
}
/**
- * The composer a "fill" starter loads (Content Factory, Explainer): small enough to pass to the page, read when the
+ * The composer a "fill" starter loads (Assist, Storyboard, Content Factory, Explainer): small enough to pass to the page, read when the
* page opens with `?starter=<id>` or when the owner taps "Use template" on its card.
*/
export type StarterFill = (
+ | { kind: "assist"; text: string }
+ | { kind: "storyboard"; story: string; frames: number; aspectRatio: string; look?: string }
| { kind: "content-factory"; presetId: string; prompt: string; length: number; episodes: number }
| { kind: "explainer"; prompt: string; styleId: string; duration: "auto" | number; aspect: "9:16" | "16:9"; voice?: string }
) & {
@@ -71,8 +124,9 @@ export interface OwnerStarters {
fills: Record<string, StarterFill>;
}
-/** The starter's page (`<base>/start/<id>`). */
-export const starterHref = (s: Pick<StarterCardData, "id" | "surface">) => `${STARTER_SURFACES[s.surface].base}/start/${s.id}`;
+/** The starter's page (`<base>/start/<id>`); a link's is where it opens (for the owner, its `ownerHref` when it has one). */
+export const starterHref = (s: Pick<StarterCardData, "id" | "surface"> & { use?: StarterUse }, owner = false) =>
+ s.use?.kind === "link" ? (owner && s.use.ownerHref) || s.use.href : `${STARTER_SURFACES[s.surface].base}/start/${s.id}`;
/** Who sees a starter's card: a visitor only one with its real cover (the owner sees all, marked). */
export const starterShown = (s: Pick<StarterCardData, "cover">, visitor: boolean) => !visitor || !!s.cover;
diff --git a/src/server/starters.ts b/src/server/starters.ts
index d92ad22c..07e3aaac 100644
--- a/src/server/starters.ts
+++ b/src/server/starters.ts
@@ -1,16 +1,20 @@
import "server-only";
+import { nanoid } from "nanoid";
import type { Engine } from "@/lib/catalog/types";
import type { NarratorVoice } from "@/lib/catalog/faceless";
import { getStarter, starterCards, starterFills, starterVoice, type Starter, type StarterProduct } from "@/lib/starters/catalog";
import type { OwnerStarters, StarterFill, StarterSurface } from "@/lib/starters/types";
import { createManualBrand, createProduct, listBrands, listProducts, updateProduct } from "./brand";
import { adoptSample } from "./canvas-samples";
+import { appendChat, createProject, getChat, listItems, listProjects, updateProject } from "./cinema";
+import { createElement, listElements } from "./elements";
import { createChannel, listChannels, updateChannel } from "./faceless";
/**
- * The owner's "Use template" on a starter that is made here (POST /api/starters/<id>): a Faceless channel set up for
- * its first episode, or a brand kit with its product and photo (Ads Studio, Click to Ad, Marketing Studio). It answers
- * where to go next. A starter that fills a composer (Content Factory, Explainer) is opened, not made.
+ * The owner's "Use template" on a starter that is made here (POST /api/starters/<id>): a Cinema Studio project with its
+ * look, brief and shots, a saved element from its own files, a Faceless channel set up for its first episode, or a brand
+ * kit with its product and photo (Ads Studio, Click to Ad, Marketing Studio). It answers where to go next. A starter that
+ * fills a composer (Assist, Storyboard, Content Factory, Explainer) or links to one (the Library's) is opened, not made.
*
* Guests get 401 and accounts 403 "library" before this runs (LIBRARY_CHANGES in src/lib/guest-access.ts): a starter
* is saved to the owner's library.
@@ -68,16 +72,54 @@ export function startersForOwner(surface: StarterSurface): OwnerStarters {
const voice = narrator({ id, surface });
fills[id] = voice ? { ...f, voiceSample: voice.url } : f;
}
- }
+ } else if (surface === "assist" || surface === "storyboard") Object.assign(fills, starterFills(surface, { all: true }));
return { starters, fills };
}
-/** Make the starter and say where it opens. */
-export async function createFromStarter(id: string, engine: Engine): Promise<{ href: string }> {
+/** The starter's own files as the owner's stored files, in order (made once each, kept out of the Library lists). */
+function adoptSamples(s: Starter): string[] {
+ return (s.samples ?? []).map((f) => {
+ const url = adoptSample(f.src);
+ if (!url) throw new StarterError("That starter's file is missing", 500);
+ return url;
+ });
+}
+
+/** 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 }> {
const s = getStarter(id);
if (!s) throw new StarterError("That starter doesn't exist", 404);
const seed = s.seed;
- if (seed.kind === "fill") throw new StarterError("That starter opens in its studio: nothing to make here");
+ 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") {
+ // 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 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.
+ appendChat(p.id, {
+ id: nanoid(10),
+ role: "assistant",
+ text: `The look is set and the brief is in place. Here are the ${seed.shots.length} shots: load one into the prompt bar, then press Generate.`,
+ shots: seed.shots,
+ createdAt: Date.now(),
+ });
+ return { href: `/cinema/${p.id}?shot=1`, id: p.id };
+ }
+ if (seed.kind === "element") {
+ const references = adoptSamples(s);
+ // Saved before (same name, same first picture): that one, not a second copy with its own handle.
+ const known = listElements(seed.element.kind).find((e) => e.name === seed.element.name && e.references[0] === references[0]);
+ const el = known ?? createElement({ ...seed.element, references });
+ const note =
+ el.kind === "voice"
+ ? `${el.name} is saved. Pick it as the voice in Audio, a talking clip or a narration.`
+ : `${el.name} is saved. Type @${el.handle} in any image or video prompt.`;
+ return { href: "/elements", id: el.id, note };
+ }
if (seed.kind === "faceless") {
// On the open engine the narrator clones a voice: the starter's own sample, while it is published.
const voice = engine === "open" ? narrator(s) : undefined;
diff --git a/tests/assist-suggestions.test.ts b/tests/assist-suggestions.test.ts
index 2aee1113..05dce81f 100644
--- a/tests/assist-suggestions.test.ts
+++ b/tests/assist-suggestions.test.ts
@@ -48,7 +48,7 @@ describe("Assist's suggestion chips on the offline planner (R4-04)", () => {
const p = agent.offlinePlan(ASSIST_SUGGESTIONS[1], "cloud")!;
const jobs = jobsOf(p);
expect(jobs).toHaveLength(1);
- expect(jobs[0]).toMatchObject({ model_id: "nano-banana-pro", outputs: 4, prompt: "Moody portrait of a lighthouse keeper, 35mm film" });
+ expect(jobs[0]).toMatchObject({ model_id: "nano-banana-pro", outputs: 4, prompt: "Moody portrait of a model in a black velvet suit, 35mm film" });
expect(jobs[0].after).toBeUndefined();
expect((p.input as { summary: string }).summary).toMatch(/^Pick the best of 4 stills/);
expect(p.say).toMatch(/4 stills first.*tell me which one to animate/);
@@ -211,7 +211,7 @@ describe("picking a take", () => {
const clip = v.generations.find((g) => g.kind === "video")!;
expect(clip).toBeTruthy();
expect(clip.request).toMatchObject({ modelId: "minimax-h3", inputs: { images: ["/api/files/outputs/take-2.png"] } });
- expect(clip.request.prompt).toMatch(/^Moody portrait of a lighthouse keeper, 35mm film\. The still comes to life/);
+ expect(clip.request.prompt).toMatch(/^Moody portrait of a model in a black velvet suit, 35mm film\. The still comes to life/);
expect(v.thread.items.filter((i) => i.role === "assistant").map((i) => (i as { text: string }).text)).toContain("I'll animate take 2 with the default video model.");
});
diff --git a/tests/e2e/starters-b.mjs b/tests/e2e/starters-series-and-ads.mjs
similarity index 98%
rename from tests/e2e/starters-b.mjs
rename to tests/e2e/starters-series-and-ads.mjs
index 76e43cf7..21d64181 100644
--- a/tests/e2e/starters-b.mjs
+++ b/tests/e2e/starters-series-and-ads.mjs
@@ -5,14 +5,14 @@
// opens the channel's first episode, the filled composer, the brand kit, the product's ad or the product shot, ready
// to run. After that the owner's own work leads and the starters sit in one row below.
//
-// node tests/e2e/starters-b.mjs <app address> <owner password> [screenshot folder]
+// node tests/e2e/starters-series-and-ads.mjs <app address> <owner password> [screenshot folder]
// Against `next start` with a fresh data dir, FUOBE_PUBLIC_SIGNUP=1 and demo mode on (FUOBE_DEMO_MODE=on).
import fs from "node:fs";
import path from "node:path";
import { launch, PHONE, DESKTOP } from "./_browser.mjs";
const [app, password, shots] = process.argv.slice(2);
-if (!app || !password) throw new Error("usage: node tests/e2e/starters-b.mjs <app address> <owner password> [screenshot folder]");
+if (!app || !password) throw new Error("usage: node tests/e2e/starters-series-and-ads.mjs <app address> <owner password> [screenshot folder]");
if (shots) fs.mkdirSync(shots, { recursive: true });
const ENGINE_WORDS = /Fuobe DoP|Effects 2\.0|\bGPU\b|Qwen|MiniMax|Nano Banana|Seedance|Ideogram|Kling|ElevenLabs|ACE-Step|placeholder/;
@@ -39,8 +39,8 @@ async function signIn(ctx, persona) {
const r = await ctx.request.post(`${app}/api/auth/login`, { data: { password } });
if (!r.ok()) throw new Error(`owner login ${r.status()}`);
} else if (persona === "account") {
- const email = `starters-b-${Date.now()}-${Math.random().toString(36).slice(2, 6)}@example.com`;
- const r = await ctx.request.post(`${app}/api/auth/signup`, { data: { email, password: "starters-b-pw-123" } });
+ const email = `starters-sa-${Date.now()}-${Math.random().toString(36).slice(2, 6)}@example.com`;
+ const r = await ctx.request.post(`${app}/api/auth/signup`, { data: { email, password: "starters-sa-pw-123" } });
if (!r.ok()) throw new Error(`signup ${r.status()}`);
}
}
diff --git a/tests/e2e/starters-studios.mjs b/tests/e2e/starters-studios.mjs
new file mode 100644
index 00000000..7ca7f437
--- /dev/null
+++ b/tests/e2e/starters-studios.mjs
@@ -0,0 +1,303 @@
+// The ready-made starters of Assist, the Library, Cinema Studio, Storyboard and Elements, and Moodboards' Curated
+// first screen, as a guest, a fresh account and the owner, at 390 and 1440 px: an empty studio leads with its
+// starters (the owner's marked until their covers exist), visitors see only starters with a real cover and no model or
+// engine words, every starter has a read-only page, the Library's row opens each studio with its content loaded, and
+// the owner's "Use template" types the job into Assist, makes the Cinema film (shot 1 in the prompt bar, ready to
+// generate), fills Storyboard's composer and saves the element. After that the owner's own work leads and the
+// starters sit in one row below.
+//
+// node tests/e2e/starters-studios.mjs <app address> <owner password> [screenshot folder]
+// Against `next start` with a fresh data dir, FUOBE_PUBLIC_SIGNUP=1 and demo mode on (FUOBE_DEMO_MODE=on).
+import fs from "node:fs";
+import path from "node:path";
+import { launch, PHONE, DESKTOP } from "./_browser.mjs";
+
+const [app, password, shots] = process.argv.slice(2);
+if (!app || !password) throw new Error("usage: node tests/e2e/starters-studios.mjs <app address> <owner password> [screenshot folder]");
+if (shots) fs.mkdirSync(shots, { recursive: true });
+
+// Curated looks with their real covers (published "soul/<id>" covers): only then does Moodboards open on Curated.
+const SOUL_COVERS = /"soul\/[^"]+":/.test(fs.readFileSync(path.join(import.meta.dirname, "../../src/lib/template-covers.generated.ts"), "utf8"));
+
+const ENGINE_WORDS = /Fuobe DoP|Effects 2\.0|\bGPU\b|Qwen|MiniMax|Nano Banana|Seedance|Ideogram|Kling|ElevenLabs|ACE-Step|placeholder|No cover yet/;
+const failures = [];
+const check = (name, ok, detail = "") => {
+ console.log(`${ok ? "ok " : "FAIL"} ${name}${detail ? ` (${detail})` : ""}`);
+ if (!ok) failures.push(name);
+};
+
+/**
+ * Each studio, the heading of its starters, how many the owner sees, how many a visitor sees today (those with a real
+ * cover), a starter whose page is checked, and words of that starter a visitor never receives while it has no cover.
+ */
+const SURFACES = [
+ // Assist's starters sit in one row of three under the composer (See all opens the rest).
+ { path: "/assist", heading: "Start from a ready job", n: 5, shown: 0, page: "assist.jewel-campaign", words: "candlelit palace hall", row: 3 },
+ { path: "/library", heading: "Make your first", n: 4, shown: 3, link: true },
+ { path: "/cinema", heading: "Start from a ready film", n: 3, shown: 0, page: "cinema.riviera-night", words: "Monte Carlo casino" },
+ { path: "/storyboard", heading: "Start from a ready story", n: 3, shown: 0, page: "storyboard.perfume-ad", words: "Nuit Noire perfume ad" },
+ { path: "/elements", heading: "Start with a ready element", n: 5, shown: 4, page: "elements.amara" },
+];
+
+async function signIn(ctx, persona) {
+ if (persona === "owner") {
+ const r = await ctx.request.post(`${app}/api/auth/login`, { data: { password } });
+ if (!r.ok()) throw new Error(`owner login ${r.status()}`);
+ } else if (persona === "account") {
+ const email = `starters-st-${Date.now()}-${Math.random().toString(36).slice(2, 6)}@example.com`;
+ const r = await ctx.request.post(`${app}/api/auth/signup`, { data: { email, password: "starters-st-pw-123" } });
+ if (!r.ok()) throw new Error(`signup ${r.status()}`);
+ }
+}
+
+const browser = await launch();
+/** The film the owner's phone made from a starter (its path), opened again at 1440. */
+let phoneFilm = null;
+try {
+ for (const persona of ["guest", "account", "owner"]) {
+ for (const [size, device] of [
+ ["390", PHONE],
+ ["1440", DESKTOP],
+ ]) {
+ const tag = `${persona} ${size}`;
+ const ctx = await browser.newContext({ ...device, colorScheme: "light" });
+ await signIn(ctx, persona);
+ const page = await ctx.newPage();
+ page.setDefaultTimeout(30_000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(`${page.url()} :: ${String(e).slice(0, 200)}`));
+ const shot = async (name) => shots && page.screenshot({ path: path.join(shots, `${name}--${persona}--${size}.png`), fullPage: false });
+ const fullShot = async (name) => shots && page.screenshot({ path: path.join(shots, `${name}--${persona}--${size}--full.png`), fullPage: true });
+ const sideways = () => page.evaluate(() => document.documentElement.scrollWidth - window.innerWidth);
+ const text = () => page.locator("main, body").first().innerText();
+ const owner = persona === "owner";
+
+ // ---- Each studio's first screen, with nothing of one's own yet
+ for (const s of SURFACES) {
+ const name = s.path.slice(1);
+ const want = Math.min(owner ? s.n : s.shown, s.row ?? Infinity);
+ const first = await page.goto(`${app}${s.path}`, { waitUntil: "load", timeout: 180_000 });
+ // The page itself (its HTML and its data) carries no words of a starter a visitor can't see.
+ if (!owner && s.words && !s.shown) check(`${tag}: ${s.path} sends a visitor no words of a starter without its cover`, !((await first?.text()) ?? "").includes(s.words));
+ if (want) await page.getByRole("heading", { name: s.heading }).waitFor({ timeout: 60_000 }).catch(() => {});
+ else await page.waitForTimeout(2500);
+ const section = page.locator("#starters");
+ const cards = section.locator("article");
+ const n = await cards.count();
+ const t = await text();
+ check(`${tag}: ${s.path} shows ${want} starters`, n === want, `${n}`);
+ if (owner && !s.link) {
+ check(`${tag}: ${s.path} starters each have Use template`, (await section.getByRole("button", { name: "Use template" }).count()) === want);
+ check(`${tag}: ${s.path} marks the starters without a cover`, (await section.getByText("No cover yet").count()) === want - Math.min(s.shown, want));
+ if (s.row) {
+ await section.getByRole("button", { name: "See all" }).click();
+ check(`${tag}: ${s.path} See all shows all ${s.n}`, (await cards.count()) === s.n, `${await cards.count()}`);
+ }
+ } else if (want && !owner) {
+ check(`${tag}: ${s.path} cards each show their cover`, await cards.evaluateAll((els) => els.every((e) => e.querySelector("img, video"))));
+ }
+ if (owner && s.link) check(`${tag}: ${s.path} marks the link starter without a cover`, (await section.getByText("No cover yet").count()) === s.n - s.shown);
+ if (!owner && want) {
+ if (!s.link) check(`${tag}: ${s.path} visitor cards say See how it works`, (await section.getByText("See how it works").count()) === want && !/Use template|No cover yet/.test(await section.innerText()));
+ else check(`${tag}: ${s.path} cards say Open it`, (await section.getByText("Open it").count()) === want);
+ const top = await cards.first().evaluate((e) => e.getBoundingClientRect().top + window.scrollY);
+ check(`${tag}: ${s.path} starters sit near the top`, top < (size === "390" ? 1100 : 800), `${Math.round(top)} px`);
+ } else if (!owner) {
+ check(`${tag}: ${s.path} shows a visitor no starter without its cover`, !t.includes(s.heading) && !/No cover yet|Use template/.test(t));
+ }
+ if (!owner) check(`${tag}: no model or engine words in ${s.path}'s starters`, !ENGINE_WORDS.test(n ? await section.innerText() : ""));
+ if (size === "1440" && n === 4) {
+ const tops = await cards.evaluateAll((els) => els.map((e) => Math.round(e.getBoundingClientRect().top)));
+ check(`${tag}: ${s.path}'s four cards sit in one row`, new Set(tops).size === 1, tops.join(","));
+ }
+ check(`${tag}: no sideways scroll on ${s.path}`, (await sideways()) <= 1, `${await sideways()} px`);
+ await shot(`${name}-first`);
+ if (size === "1440" || want) await fullShot(`${name}-first`);
+
+ // The starter's read-only page.
+ if (s.page) {
+ const res = await page.goto(`${app}${s.path}/start/${s.page}`, { waitUntil: "load" });
+ if (owner || s.shown) {
+ await page.getByRole("heading", { name: "What goes in" }).waitFor({ timeout: 60_000 });
+ const pt = await text();
+ check(`${tag}: ${s.page}'s page says what goes in, the steps and what comes out`, /The steps/i.test(pt) && /What comes out/i.test(pt));
+ if (owner) {
+ await page.getByText("Use template").first().waitFor({ timeout: 30_000 }).catch(() => {});
+ check(`${tag}: the owner can use ${s.page} from its page`, (await page.getByRole("button", { name: "Use template" }).count()) + (await page.getByRole("link", { name: "Use template" }).count()) === 1);
+ } else {
+ check(`${tag}: ${s.page}'s page has no model words and no Use template`, !ENGINE_WORDS.test(pt) && !/Use template/.test(pt), (pt.match(ENGINE_WORDS) ?? [""])[0]);
+ check(`${tag}: ${s.page}'s page shows its pictures`, (await page.locator("main img").count()) >= 2);
+ }
+ check(`${tag}: no sideways scroll on ${s.page}'s page`, (await sideways()) <= 1, `${await sideways()} px`);
+ } else {
+ // A starter with no cover yet has no page for a visitor: a real 404, and none of its words in the answer.
+ const body = (await res?.text()) ?? "";
+ check(`${tag}: ${s.page} (no cover yet) is a 404 for a visitor`, res?.status() === 404 && !/The steps/i.test(await text()), String(res?.status()));
+ check(`${tag}: ${s.page}'s words don't reach a visitor`, !body.includes(s.words), s.words);
+ }
+ await shot(`${name}-start`);
+ }
+ }
+
+ // The Library's row opens each studio with its content loaded, for everyone.
+ if (size === "1440" || !owner) {
+ await page.goto(`${app}/library`, { waitUntil: "load" });
+ await page.getByRole("heading", { name: "Make your first" }).waitFor({ timeout: 60_000 });
+ await page.locator("#starters article").filter({ hasText: "A portrait that comes alive" }).getByRole("link").first().click();
+ if (owner) {
+ await page.waitForURL(/\/canvas\/start\/effect-chain-pearl-earring$/, { timeout: 60_000 });
+ await page.getByRole("heading", { name: "What goes in" }).waitFor({ timeout: 60_000 }).catch(() => {});
+ check(`${tag}: the Library's portrait opens its ready board for the owner`, /What goes in/i.test(await text()));
+ } else {
+ await page.waitForURL((u) => u.pathname === "/video" && u.searchParams.get("example") === "effect-pearl-earring.1", { timeout: 60_000 });
+ await page.getByText("In the composer").first().waitFor({ timeout: 60_000 }).catch(() => {});
+ check(`${tag}: the Library's portrait opens the Video studio with its photo in`, /In the composer/.test(await text()));
+ await shot("library-to-video");
+ }
+ await page.goto(`${app}/library`, { waitUntil: "load" });
+ await page.getByRole("heading", { name: "Make your first" }).waitFor({ timeout: 60_000 });
+ await page.locator("#starters article").filter({ hasText: "A gown on a Namib dune" }).getByRole("link").first().click();
+ await page.waitForURL((u) => u.pathname === "/image", { timeout: 60_000 });
+ await page.getByText("In the composer").first().waitFor({ timeout: 60_000 }).catch(() => {});
+ check(`${tag}: the Library's gown opens the Image studio with its prompt in`, /In the composer/.test(await text()));
+ await shot("library-to-image");
+ }
+
+ // A starter page whose id isn't that studio's answers a real 404.
+ if (size === "1440") {
+ for (const bad of ["/cinema/start/elements.amara", "/elements/start/nope.x", "/assist/start/storyboard.heist"]) {
+ const r = await page.goto(`${app}${bad}`, { waitUntil: "load" });
+ check(`${tag}: ${bad} is a real 404`, r?.status() === 404, String(r?.status()));
+ }
+ await page.goto(`${app}/cinema/start/cinema.riviera-night`, { waitUntil: "load" });
+ if (!owner) check(`${tag}: a starter with no cover yet has a neutral title`, !/Riviera/.test(await page.title()), await page.title());
+ }
+
+ // Moodboards opens on Curated while there are none of one's own, once the curated looks have their real covers.
+ await page.goto(`${app}/moodboards`, { waitUntil: "load" });
+ await page.getByRole("tab", { name: "Curated" }).waitFor({ timeout: 60_000 });
+ await page.waitForTimeout(1500);
+ const curatedOn = (await page.getByRole("tab", { name: "Curated" }).getAttribute("aria-selected")) === "true";
+ check(`${tag}: Moodboards opens on Curated only while curated looks have their covers`, curatedOn === SOUL_COVERS, `curated ${curatedOn}, covers ${SOUL_COVERS}`);
+ if (curatedOn) check(`${tag}: Moodboards says how to start from a curated look`, /Start from a curated look/.test(await text()));
+ check(`${tag}: no sideways scroll on /moodboards`, (await sideways()) <= 1, `${await sideways()} px`);
+ await shot("moodboards-first");
+
+ // ?starter= of a story or a job with no cover yet fills nothing for a visitor (its words never reach them).
+ if (!owner && size === "1440") {
+ await page.goto(`${app}/storyboard?starter=storyboard.capri-swim`, { waitUntil: "load" });
+ const story = page.getByRole("textbox", { name: "Your story" });
+ await story.waitFor({ timeout: 60_000 });
+ await page.waitForTimeout(1500);
+ check(`${tag}: ?starter= of a story with no cover leaves a visitor's composer empty`, !/Capri/.test(await story.inputValue()));
+ await page.goto(`${app}/assist?starter=assist.serum-ugc`, { waitUntil: "load" });
+ await page.waitForTimeout(2500);
+ const typedIn = (await page.locator("textarea").first().inputValue().catch(() => "")) ?? "";
+ check(`${tag}: ?starter= of a job with no cover types nothing into a visitor's Assist`, !/serum/.test(typedIn), typedIn.slice(0, 40));
+ }
+
+ // ---- The owner's "Use template", studio by studio
+ if (owner) {
+ const tapUse = async (s, title) => {
+ await page.goto(`${app}${s.path}`, { waitUntil: "load" });
+ await page.getByRole("heading", { name: s.heading }).waitFor({ timeout: 60_000 });
+ await page.locator("#starters article").filter({ hasText: title }).getByRole("button", { name: "Use template" }).click();
+ };
+
+ // Assist: the job is typed into the composer, never sent.
+ await tapUse(SURFACES[0], "Emerald necklace campaign");
+ await page.waitForTimeout(800);
+ const typed = await page.locator("textarea").first().inputValue();
+ check(`${tag}: a ready job types its words into Assist`, /^A campaign for an emerald and diamond necklace/.test(typed), typed.slice(0, 60));
+ check(`${tag}: nothing was sent`, !/[?&]c=/.test(page.url()));
+ await shot("assist-filled");
+ await page.goto(`${app}/assist?starter=assist.serum-ugc`, { waitUntil: "load" });
+ await page.waitForTimeout(1500);
+ check(`${tag}: ?starter= types a ready job in too`, /^A 15-second vertical creator video/.test(await page.locator("textarea").first().inputValue()));
+ if (size === "390") {
+ // On a phone the ready jobs sit below the skills: a link beside "All skills" goes to them.
+ await page.goto(`${app}/assist`, { waitUntil: "load" });
+ const ready = page.getByRole("link", { name: "Ready jobs" });
+ await ready.waitFor({ timeout: 60_000 }).catch(() => {});
+ check(`${tag}: a phone's Assist links to the ready jobs`, await ready.isVisible().catch(() => false));
+ const readyTop = await ready.evaluate((e) => e.getBoundingClientRect().top).catch(() => Infinity);
+ check(`${tag}: the Ready jobs link is on the first screen`, readyTop < 844, `${Math.round(readyTop)} px`);
+
+ // Cinema on a phone: shot 1 in the prompt bar, and the empty view says where shots 2 and 3 are.
+ await tapUse(SURFACES[2], "Riviera night");
+ await page.waitForURL(/\/cinema\/[^/?]+$/, { timeout: 90_000 });
+ await page.getByText("Shot 1 of 3 is ready below.").first().waitFor({ timeout: 60_000 }).catch(() => {});
+ check(`${tag}: a phone's ready film says where shots 2 and 3 are`, /Shot 1 of 3 is ready below\. Shots 2 and 3 are in the AI Director\./.test(await text()));
+ phoneFilm = new URL(page.url()).pathname;
+ await shot("cinema-from-starter");
+ }
+
+ if (size === "1440") {
+ // Cinema: the film is made with its look and brief, and opens with shot 1 in the prompt bar.
+ await tapUse(SURFACES[2], "Riviera night");
+ await page.waitForURL(/\/cinema\/[^/?]+$/, { timeout: 90_000 });
+ if (phoneFilm) check(`${tag}: Use template again opens the untouched film made before`, new URL(page.url()).pathname === phoneFilm, `${new URL(page.url()).pathname} vs ${phoneFilm}`);
+ const prompt = page.getByRole("textbox", { name: "Prompt" });
+ await prompt.waitFor({ timeout: 60_000 });
+ await page.waitForFunction(() => /emerald silk gown/.test(document.querySelector('textarea[aria-label="Prompt"]')?.value ?? ""), null, { timeout: 30_000 }).catch(() => {});
+ check(`${tag}: a ready film opens with shot 1 in the prompt bar`, /emerald silk gown/.test(await prompt.inputValue()), (await prompt.inputValue()).slice(0, 60));
+ check(`${tag}: the AI Director shows the three shots`, /Here are the 3 shots/.test(await text()));
+ await shot("cinema-from-starter");
+ await page.getByRole("button", { name: /^Generate/ }).first().click();
+ await page.locator('[data-status="succeeded"], video, img[src*="/api/files/"]').first().waitFor({ timeout: 120_000 }).catch(() => {});
+ check(`${tag}: shot 1 runs (demo)`, (await page.locator('video, img[src*="/api/files/"]').count()) > 0);
+ await shot("cinema-shot-1");
+ await page.goto(`${app}/cinema`, { waitUntil: "load" });
+ await page.getByText("Riviera night").first().waitFor({ timeout: 60_000 });
+ await page.getByRole("heading", { name: SURFACES[2].heading }).waitFor({ timeout: 30_000 }).catch(() => {});
+ const projTop = (await page.getByText("Updated just now").first().boundingBox())?.y ?? Infinity;
+ const rowTop = (await page.locator("#starters").boundingBox())?.y ?? -1;
+ const order = projTop < rowTop;
+ check(`${tag}: with a film, the projects lead and the starters sit in a row below`, order);
+ await fullShot("cinema-with-project");
+
+ // Elements: the element is saved from its own picture.
+ await tapUse(SURFACES[4], "Amara");
+ await page.getByText("Type @Amara in any image or video prompt.").first().waitFor({ timeout: 60_000 }).catch(() => {});
+ check(`${tag}: saving a ready element says how to use it`, (await page.getByText("Type @Amara in any image or video prompt.").count()) > 0);
+ await page.getByText("@Amara").first().waitFor({ timeout: 60_000 }).catch(() => {});
+ check(`${tag}: a ready element is saved as @Amara`, /@Amara/.test(await text()) && !/Amara_2/.test(await text()));
+ await page.locator("#starters").waitFor({ timeout: 30_000 }).catch(() => {});
+ check(`${tag}: a saved element's card leaves the row`, (await page.locator("#starters article").filter({ has: page.getByText("Amara", { exact: true }) }).count()) === 0 && (await page.locator("#starters article").count()) > 0);
+ await fullShot("elements-with-one");
+ }
+
+ // Storyboard: the composer fills with the story, the frames, the shape and the look.
+ await tapUse(SURFACES[3], "Perfume ad in 6 frames");
+ const story = page.getByRole("textbox", { name: "Your story" });
+ await page.waitForTimeout(800);
+ check(`${tag}: a ready story fills Storyboard's composer`, /^Nuit Noire perfume ad/.test(await story.inputValue()) && /6 frames/.test(await text()));
+ await shot("storyboard-filled");
+ if (size === "1440") {
+ await page.getByRole("button", { name: "Generate storyboard" }).click();
+ await page.getByRole("button", { name: /^Open frame 1$/ }).first().waitFor({ timeout: 120_000 }).catch(() => {});
+ check(`${tag}: Generate makes the board (demo)`, (await page.getByRole("button", { name: /^Open frame / }).count()) > 0);
+ await page.goto(`${app}/storyboard`, { waitUntil: "load" });
+ await page.getByRole("heading", { name: SURFACES[3].heading }).waitFor({ timeout: 60_000 }).catch(() => {});
+ const below = await page.evaluate((h) => {
+ const frame = document.querySelector('[aria-label^="Open frame"]');
+ const head = [...document.querySelectorAll("h2")].find((e) => e.textContent?.trim() === h);
+ return frame && head ? frame.getBoundingClientRect().top < head.getBoundingClientRect().top : false;
+ }, SURFACES[3].heading);
+ check(`${tag}: with a board, the board leads and the starters sit below`, below);
+ await fullShot("storyboard-with-board");
+ }
+ }
+ check(`${tag}: no page errors`, errors.length === 0, errors[0]);
+ await ctx.close();
+ }
+ }
+} finally {
+ await browser.close();
+}
+
+if (failures.length) {
+ console.log(`\n${failures.length} check(s) failed`);
+ process.exit(1);
+}
+console.log("\nall checks passed");
diff --git a/tests/starters-catalog.test.ts b/tests/starters-catalog.test.ts
index 05a82e25..0f99f921 100644
--- a/tests/starters-catalog.test.ts
+++ b/tests/starters-catalog.test.ts
@@ -62,7 +62,22 @@ describe("the starters catalog", () => {
for (const name of names) expect(words, `${s.id}: ${name}`).not.toContain(name);
// The words a starter puts in (its prompts and topics) name only what should be there.
const seed = s.seed;
- const prompts = seed.kind === "faceless" ? [seed.channel.idea, seed.episode.topic] : seed.kind === "fill" ? [seed.fill.prompt] : [seed.kit.brand.description, seed.kit.product.description];
+ const prompts =
+ seed.kind === "faceless"
+ ? [seed.channel.idea, seed.episode.topic]
+ : seed.kind === "fill"
+ ? [seed.fill.prompt]
+ : seed.kind === "product"
+ ? [seed.kit.brand.description, seed.kit.product.description]
+ : seed.kind === "assist"
+ ? [seed.prompt]
+ : seed.kind === "cinema"
+ ? [seed.brief.body, ...seed.shots.map((x) => x.prompt)]
+ : seed.kind === "storyboard"
+ ? [seed.story]
+ : seed.kind === "element"
+ ? [seed.element.description]
+ : [];
for (const p of prompts) expect(p, s.id).not.toMatch(NEGATIONS);
}
});
@@ -111,7 +126,8 @@ describe("the starters catalog", () => {
for (const c of cards) {
expect(starterShown(c, false)).toBe(true);
expect(starterShown(c, true)).toBe(!!c.cover);
- expect(starterHref(c)).toBe(`${STARTER_SURFACES[surface].base}/start/${c.id}`);
+ // A link (the Library's row) opens its studio; every other starter has its own page.
+ expect(starterHref(c)).toBe(c.use.kind === "link" ? c.use.href : `${STARTER_SURFACES[surface].base}/start/${c.id}`);
}
}
expect(starterOn("faceless", "cf.narcissus")).toBeUndefined();
@@ -143,7 +159,7 @@ describe("the starters catalog", () => {
describe("who may use a starter", () => {
it("opens a starter's page to everyone, as catalog data, not a stored record", () => {
- for (const s of STARTERS) {
+ for (const s of STARTERS.filter((x) => x.seed.kind !== "link")) {
const href = starterHref(s);
expect(recordForPath(href), href).toBeNull();
expect(guestRead(href), href).toEqual({ kind: "pass" });
@@ -155,6 +171,8 @@ describe("who may use a starter", () => {
it("keeps a starter with no cover yet the owner's: the proxy's 404 for others matches the catalog's covers", () => {
for (const s of STARTERS) {
expect(starterCovered(s.id), s.id).toBe(!!starterCover(s));
+ // A Library link has no page of its own: its card opens another studio.
+ if (s.seed.kind === "link") continue;
expect(hiddenStarterPage(starterHref(s)), s.id).toBe(!starterCover(s));
expect(hiddenStarterPage(`${starterHref(s)}/`), s.id).toBe(!starterCover(s));
}
diff --git a/tests/starters-run.test.ts b/tests/starters-run.test.ts
new file mode 100644
index 00000000..f6096221
--- /dev/null
+++ b/tests/starters-run.test.ts
@@ -0,0 +1,182 @@
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
+
+// Every starter runs as it comes, on a fresh install in demo mode: the owner's tap makes the Cinema project or the
+// element, Assist's starters plan and run on the offline planner, Storyboard's price and run, and Cinema's shot 1
+// renders from the project the starter made.
+
+vi.setConfig({ testTimeout: 120_000 });
+vi.mock("next/server", async (importOriginal) => ({ ...(await importOriginal<typeof import("next/server")>()), connection: async () => {}, after: () => {} }));
+
+const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-starters-run-"));
+process.env.FUOBE_DATA_DIR = dir;
+process.env.COMFYUI_URL = "http://127.0.0.1:9";
+process.env.OLLAMA_URL = "http://127.0.0.1:9";
+
+const { setSetting } = await import("@/server/settings");
+const gens = await import("@/server/generations");
+const cinema = await import("@/server/cinema");
+const { getElement, listElements } = await import("@/server/elements");
+const { absolutePath, filesRel, listAssets } = await import("@/server/storage");
+const { sampleFile } = await import("@/server/canvas-samples");
+const agent = await import("@/server/assist/agent");
+const { STARTERS } = await import("@/lib/starters/catalog");
+const startersRoute = await import("@/app/api/starters/[id]/route");
+const generateRoute = await import("@/app/api/cinema/projects/[id]/generate/route");
+const boardsRoute = await import("@/app/api/storyboards/route");
+const estimateRoute = await import("@/app/api/storyboards/estimate/route");
+
+beforeAll(() => {
+ setSetting("demoMode", "auto");
+ setSetting("enhanceProvider", "none");
+});
+afterAll(() => {
+ try {
+ fs.rmSync(dir, { recursive: true, force: true });
+ } catch {}
+});
+
+const post = (url: string, body?: unknown) => new Request(`http://localhost${url}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body) });
+const params = <T extends Record<string, string>>(p: T) => ({ params: Promise.resolve(p) });
+const make = async (id: string) => startersRoute.POST(post(`/api/starters/${id}`), params({ id }));
+
+async function settle(id: string, ms = 60_000) {
+ const until = Date.now() + ms;
+ for (;;) {
+ const g = gens.getGeneration(id)!;
+ if (["succeeded", "failed", "canceled"].includes(g.status)) return g;
+ if (Date.now() > until) throw new Error(`timed out: ${g.status} ${g.message}`);
+ await new Promise((r) => setTimeout(r, 250));
+ }
+}
+
+const of = <K extends string>(kind: K) => STARTERS.filter((s) => s.seed.kind === kind);
+
+describe("Cinema starters", () => {
+ it("make the project with its look, its brief and the Director's three shots, and shot 1 renders in demo mode", async () => {
+ for (const s of of("cinema")) {
+ if (s.seed.kind !== "cinema") continue;
+ const res = await make(s.id);
+ expect(res.status, s.id).toBe(201);
+ const made = (await res.json()) as { href: string; id: string };
+ expect(made.href).toBe(`/cinema/${made.id}?shot=1`);
+ const p = cinema.getProject(made.id)!;
+ expect(p.name).toBe(s.seed.project.name);
+ expect(p.director).toMatchObject(s.seed.director);
+ expect(p.brief.body).toContain(s.seed.shots[2].prompt);
+ const proposed = cinema.getChat(p.id).findLast((m) => m.shots?.length);
+ expect(proposed?.shots?.map((x) => x.prompt)).toEqual(s.seed.shots.map((x) => x.prompt));
+ // Shot 1 as the prompt bar sends it, with the project's look.
+ const shot = s.seed.shots[0];
+ for (const engine of ["cloud", "open"] as const) {
+ const r = await generateRoute.POST(
+ post("/x", { input: { engine, mode: "video", action: "generate", prompt: shot.prompt, moves: shot.moves, duration: shot.duration, aspectRatio: "16:9", batch: 1, settings: p.director } }),
+ params({ id: p.id }),
+ );
+ expect(r.status, `${s.id} ${engine}`).toBe(201);
+ const { items } = (await r.json()) as { items: { id: string }[] };
+ expect(items.length).toBeGreaterThan(0);
+ const g = await settle(items[0].id);
+ expect(g.status, `${s.id} ${engine}: ${g.message}`).toBe("succeeded");
+ }
+ expect(cinema.listItems(p.id).length).toBeGreaterThanOrEqual(2);
+ }
+ });
+
+ it("open the project made before while nothing has been made in it, and make a new one after", async () => {
+ const id = "cinema.desert-couture";
+ const count = () => cinema.listProjects().filter((p) => p.name === "Desert couture").length;
+ const before = count();
+ const a = (await (await make(id)).json()) as { id: string; href: string };
+ const b = (await (await make(id)).json()) as { id: string; href: string };
+ expect(b).toEqual(a);
+ expect(count()).toBe(before + 1);
+ // A take in it: the next tap starts a fresh project.
+ const shot = STARTERS.find((s) => s.id === id)!.seed;
+ if (shot.kind !== "cinema") throw new Error(id);
+ const r = await generateRoute.POST(
+ post("/x", { input: { engine: "cloud", mode: "video", action: "generate", prompt: shot.shots[0].prompt, duration: 5, aspectRatio: "16:9", batch: 1, settings: shot.director } }),
+ params({ id: a.id }),
+ );
+ expect(r.status).toBe(201);
+ const c = (await (await make(id)).json()) as { id: string };
+ expect(c.id).not.toBe(a.id);
+ });
+});
+
+describe("Element starters", () => {
+ it("save the element from stored copies of its own files, once each, out of the Library", async () => {
+ for (const s of of("element")) {
+ if (s.seed.kind !== "element") continue;
+ const res = await make(s.id);
+ expect(res.status, s.id).toBe(201);
+ const { id, href } = (await res.json()) as { href: string; id: string };
+ expect(href).toBe("/elements");
+ const el = getElement(id)!;
+ expect(el).toMatchObject({ name: s.seed.element.name, kind: s.seed.element.kind, description: s.seed.element.description, status: "ready" });
+ expect(el.references).toHaveLength(s.samples!.length);
+ el.references.forEach((url, i) => {
+ expect(url).toMatch(/^\/api\/files\//);
+ expect(fs.readFileSync(absolutePath(filesRel(url)!)).equals(fs.readFileSync(sampleFile(s.samples![i].src)!)), s.id).toBe(true);
+ });
+ }
+ // A second tap opens the one saved before (no "Amara_2"), and says how to use it.
+ const first = (await (await make("elements.amara")).json()) as { id: string; note: string };
+ const again = (await (await make("elements.amara")).json()) as { id: string; note: string };
+ expect(again.id).toBe(first.id);
+ expect(getElement(again.id)!.handle).toBe("Amara");
+ expect(again.note).toBe("Amara is saved. Type @Amara in any image or video prompt.");
+ expect(listElements().filter((e) => e.name === "Amara")).toHaveLength(1);
+ // The stored copies are files the Library lists don't show.
+ expect(listAssets({}).filter((x) => x.name?.startsWith("starter-"))).toEqual([]);
+ });
+});
+
+describe("The starters route", () => {
+ it("answers an unknown starter, and one that only fills a studio, without making anything", async () => {
+ expect((await make("cinema.nope")).status).toBe(404);
+ const fill = await make("assist.jewel-campaign");
+ expect(fill.status).toBe(400);
+ expect(((await fill.json()) as { error: string }).error).toMatch(/opens in its studio/);
+ expect((await make("storyboard.heist")).status).toBe(400);
+ });
+});
+
+describe("Storyboard starters", () => {
+ it("price on both engines, and run in demo mode", async () => {
+ for (const s of of("storyboard")) {
+ if (s.seed.kind !== "storyboard") continue;
+ const { story, frames, aspectRatio, look } = s.seed;
+ for (const engine of ["cloud", "open"] as const) {
+ const est = await estimateRoute.POST(post("/api/storyboards/estimate", { engine, story, frames, aspectRatio, ...(look && { look, lookStrength: 1 }) }));
+ expect(est.status, `${s.id} ${engine}`).toBe(200);
+ expect(((await est.json()) as { frames: number }).frames).toBe(frames);
+ }
+ const res = await boardsRoute.POST(post("/api/storyboards", { engine: "cloud", story, frames, aspectRatio, ...(look && { look, lookStrength: 1 }) }));
+ expect(res.status, s.id).toBe(201);
+ const body = (await res.json()) as { scenes: string[]; batchId?: string };
+ expect(body.scenes).toHaveLength(frames);
+ }
+ });
+});
+
+describe("Assist starters", () => {
+ it("plan on the offline planner and run in demo mode, on both engines", async () => {
+ for (const s of of("assist")) {
+ if (s.seed.kind !== "assist") continue;
+ for (const engine of ["cloud", "open"] as const) {
+ const t = agent.createThread({ agent: "offline", engine, autoApprove: true });
+ agent.addMessage(t.id, s.seed.skill ? `/${s.seed.skill} ${s.seed.prompt}` : s.seed.prompt);
+ await agent.run(t.id, agent.offline);
+ const v = agent.getThread(t.id)!;
+ const said = v.thread.items.filter((i) => i.role === "assistant").map((i) => (i as { text: string }).text);
+ const errors = v.thread.items.filter((i) => i.role === "notice" && i.tone === "error");
+ expect(errors, `${s.id} ${engine}: ${said.join(" | ")}`).toEqual([]);
+ expect(v.generations.length, `${s.id} ${engine}: ${said.join(" | ")}`).toBeGreaterThan(0);
+ for (const g of v.generations) expect(g.status, `${s.id} ${engine} ${g.message}`).not.toBe("failed");
+ }
+ }
+ });
+});
diff --git a/tests/starters-studios.test.ts b/tests/starters-studios.test.ts
new file mode 100644
index 00000000..725ef3dc
--- /dev/null
+++ b/tests/starters-studios.test.ts
@@ -0,0 +1,246 @@
+import { createElement, type FC } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import fs from "node:fs";
+import path from "node:path";
+import { describe, expect, it } from "vitest";
+import { ASSIST_PROMPT_MAX, ASSIST_SUGGESTIONS } from "@/lib/assist";
+import { APERTURES, CAMERA_BODIES, CAMERA_MOVES, ERAS, GENRES, LENSES, LIGHTING_PRESETS, PALETTES, TEMPOS } from "@/lib/catalog/cinema";
+import { handleFor } from "@/lib/catalog/elements";
+import { lookCard } from "@/lib/catalog/soul-cards";
+import { MAX_FRAMES, STORYBOARD_ASPECTS } from "@/lib/catalog/storyboard";
+import { exampleById, FORBIDDEN_WORDS } from "@/lib/examples/catalog";
+import { EXAMPLE_MEDIA } from "@/lib/examples/media.generated";
+import { guestRead, isLibraryChange } from "@/lib/guest-access";
+import { hiddenStarterPage, unknownStarterPage } from "@/lib/record-pages";
+import { ASSIST_STARTER_SKILLS, PHOTO_SKILLS, STARTERS, starterCards, starterFills, starterIds, starterOn, type Starter } from "@/lib/starters/catalog";
+import { starterCovered } from "@/lib/starters/ids";
+import { starterHref, starterShown, type StarterSurface } from "@/lib/starters/types";
+import { STARTER_ICONS } from "@/components/starters/starter-icon";
+import { getSkill } from "@/server/skills";
+import { sampleFile } from "@/server/canvas-samples";
+
+// The starters of Assist, the Library, Cinema Studio, Storyboard and Elements: each one is real (its skill, look, slugs,
+// files and links exist), speaks plainly to a visitor, and shows to a visitor only with its real cover.
+// tests/starters-run.test.ts makes and runs every one in demo mode.
+
+const SURFACES: StarterSurface[] = ["assist", "library", "cinema", "storyboard", "elements"];
+const ENGINE_WORDS = /Nano Banana|MiniMax|Qwen|Ideogram|Seedance|Kling|\bVeo\b|\bWan\b|\bLTX\b|\bLoRA\b|Soul ID/i;
+const of = (surface: StarterSurface) => STARTERS.filter((s) => s.surface === surface);
+const card = (s: Starter) => starterOn(s.surface, s.id)!;
+
+describe("studio starters", () => {
+ it("each surface has its own, ranked once each, premium first", () => {
+ expect(of("assist")).toHaveLength(5);
+ expect(of("library")).toHaveLength(4);
+ expect(of("cinema")).toHaveLength(3);
+ expect(of("storyboard")).toHaveLength(3);
+ expect(of("elements")).toHaveLength(5);
+ for (const surface of SURFACES) {
+ const ranks = of(surface).map((s) => s.rank);
+ expect(new Set(ranks).size, surface).toBe(ranks.length);
+ }
+ expect(of("cinema").sort((a, b) => a.rank - b.rank)[0].id).toBe("cinema.riviera-night");
+ expect(of("storyboard").sort((a, b) => a.rank - b.rank)[0].id).toBe("storyboard.perfume-ad");
+ });
+
+ it("speak plainly: no model names, nothing a card must never say, an icon of their own", () => {
+ for (const s of STARTERS.filter((x) => SURFACES.includes(x.surface))) {
+ const words = [s.name, s.description, s.makes, ...s.flow, ...s.steps, ...s.words.flatMap((w) => [w.label, w.text]), ...(s.samples ?? []).map((f) => f.label)].join("\n");
+ expect(words, s.id).not.toMatch(ENGINE_WORDS);
+ for (const re of FORBIDDEN_WORDS) expect(words, `${s.id} ${re}`).not.toMatch(re);
+ expect(Object.keys(STARTER_ICONS), s.id).toContain(s.icon);
+ }
+ });
+
+ it("bring only Fuobe's own published files, and borrow only published covers", () => {
+ for (const s of STARTERS.filter((x) => SURFACES.includes(x.surface))) {
+ for (const f of s.samples ?? []) expect(sampleFile(f.src), `${s.id} ${f.src}`).toBeTruthy();
+ const ref = s.coverOf;
+ if (ref && "files" in ref) for (const f of ref.files) expect(EXAMPLE_MEDIA[f]?.role, `${s.id} ${f}`).toBe("in");
+ if (ref && "example" in ref) expect(exampleById(ref.example), s.id).toBeTruthy();
+ // A starter's borrowed starter cover is another starter's own.
+ if (ref && "template" in ref && ref.template.startsWith("starters/")) expect(STARTERS.map((x) => `starters/${x.id}`), s.id).toContain(ref.template);
+ }
+ // A cover that exists today shows its versioned files.
+ const amara = card(STARTERS.find((s) => s.id === "elements.amara")!);
+ expect(amara.cover?.poster).toMatch(/^\/examples\/app-makeup-studio\/1\/in-image\.jpg\?v=[0-9a-f]{8}$/);
+ const gown = card(STARTERS.find((s) => s.id === "library.namib-gown")!);
+ expect(gown.cover?.poster).toMatch(/^\/examples\/image\/1\/out\.[a-z]+\?v=/);
+ });
+
+ it("show to a visitor only with their real cover; the owner sees every one", () => {
+ for (const surface of SURFACES) {
+ // A page carries only the covered ones; the owner's list (GET /api/starters) has every one.
+ const page = starterCards(surface);
+ for (const c of page) expect(c.cover, c.id).toBeTruthy();
+ const all = starterCards(surface, { all: true });
+ expect(all.filter((c) => starterShown(c, false))).toHaveLength(of(surface).length);
+ expect(all.filter((c) => starterShown(c, true)).map((c) => c.id)).toEqual(page.map((c) => c.id));
+ }
+ // The elements made from Fuobe's published photos show at once; the voice waits for a cover of its own.
+ expect(starterCards("elements").filter((c) => starterShown(c, true)).map((c) => c.id)).toEqual(["elements.amara", "elements.highland-castle", "elements.solitaire-ring", "elements.gilded-salon"]);
+ });
+});
+
+describe("Assist starters", () => {
+ it("name a built-in skill (or none), fit a new chat's composer and fill it from the address", () => {
+ const fills = starterFills("assist", { all: true });
+ for (const s of of("assist")) {
+ if (s.seed.kind !== "assist") throw new Error(s.id);
+ if (s.seed.skill) expect(getSkill(s.seed.skill), s.id).toBeTruthy();
+ const text = s.seed.skill ? `/${s.seed.skill} ${s.seed.prompt}` : s.seed.prompt;
+ expect(text.length, s.id).toBeLessThanOrEqual(ASSIST_PROMPT_MAX);
+ expect(card(s).use).toEqual({ kind: "fill", href: `/assist?starter=${encodeURIComponent(s.id)}` });
+ expect(starterHref(card(s))).toBe(`/assist/start/${s.id}`);
+ expect(fills[s.id]).toEqual({ kind: "assist", text });
+ }
+ // A page's fills, like its cards, are the covered starters' only: an owner-only job's words never reach a visitor.
+ expect(Object.keys(starterFills("assist")).sort()).toEqual(starterCards("assist").map((c) => c.id).sort());
+ });
+
+ it("never name a skill that asks for the person's own photo: a starter types words, it attaches nothing", () => {
+ const skillText = (name: string) => fs.readFileSync(path.join(process.cwd(), "skills", name, "SKILL.md"), "utf8");
+ // These skills ask for a photo when none is attached (or take an earlier upload as the product).
+ const asks = /photo the user attached|Product photo \(attachment|ask for one clear photo/i;
+ for (const name of PHOTO_SKILLS) expect(skillText(name), name).toMatch(asks);
+ for (const name of ASSIST_STARTER_SKILLS) expect(skillText(name), name).not.toMatch(asks);
+ for (const s of of("assist")) if (s.seed.kind === "assist" && s.seed.skill) expect(PHOTO_SKILLS as readonly string[], s.id).not.toContain(s.seed.skill);
+ });
+
+ it("the suggestion chips ask for fashion models, and none repeats a ready job", () => {
+ expect(ASSIST_SUGGESTIONS[1]).toMatch(/black velvet suit/);
+ expect(ASSIST_SUGGESTIONS[3]).toMatch(/red silk gown/);
+ for (const s of ASSIST_SUGGESTIONS) expect(s).not.toMatch(/\b(fox|lighthouse|owl|otter)\b/i);
+ // The jobs right above them (Assist's starters, Storyboard's heist) are not asked for again.
+ for (const s of ASSIST_SUGGESTIONS) expect(s).not.toMatch(/\b(perfume|heist|necklace|linen|serum|Monaco)\b/i);
+ });
+});
+
+describe("Cinema starters", () => {
+ const slug = (list: { slug: string | null }[]) => list.map((x) => x.slug);
+ it("set a look the Director knows, and three shots whose moves exist", () => {
+ for (const s of of("cinema")) {
+ if (s.seed.kind !== "cinema") throw new Error(s.id);
+ const d = s.seed.director;
+ if (d.genre) expect(slug(GENRES), s.id).toContain(d.genre);
+ if (d.era) expect(slug(ERAS), s.id).toContain(d.era);
+ if (d.tempo) expect(slug(TEMPOS), s.id).toContain(d.tempo);
+ if (d.camera) expect(slug(CAMERA_BODIES), s.id).toContain(d.camera);
+ if (d.lens) expect(slug(LENSES), s.id).toContain(d.lens);
+ if (d.aperture) expect(slug(APERTURES), s.id).toContain(d.aperture);
+ if (d.lighting?.kind === "preset") expect(slug(LIGHTING_PRESETS), s.id).toContain(d.lighting.slug);
+ if (d.palette?.kind === "preset") expect(slug(PALETTES), s.id).toContain(d.palette.slug);
+ expect(s.seed.shots, s.id).toHaveLength(3);
+ for (const sh of s.seed.shots) {
+ for (const m of sh.moves ?? []) expect(slug(CAMERA_MOVES), `${s.id} ${m}`).toContain(m);
+ expect(sh.duration).toBe(5);
+ }
+ expect(s.seed.brief.body).toContain(s.seed.shots[0].prompt);
+ expect(card(s).use).toEqual({ kind: "create" });
+ }
+ // The Riviera film: a fashion model in an emerald silk gown, three shots.
+ expect(STARTERS.find((s) => s.id === "cinema.riviera-night")!.words[0].text).toMatch(/emerald silk gown/);
+ });
+});
+
+describe("Storyboard starters", () => {
+ it("fit the composer: a story, a frame count, a shape and a look that exist", () => {
+ const fills = starterFills("storyboard", { all: true });
+ for (const s of of("storyboard")) {
+ if (s.seed.kind !== "storyboard") throw new Error(s.id);
+ expect(s.seed.frames, s.id).toBeLessThanOrEqual(MAX_FRAMES);
+ expect(STORYBOARD_ASPECTS as readonly string[], s.id).toContain(s.seed.aspectRatio);
+ if (s.seed.look) expect(lookCard(s.seed.look), s.id).toBeTruthy();
+ expect(card(s).use).toEqual({ kind: "fill", href: `/storyboard?starter=${encodeURIComponent(s.id)}` });
+ // A guest or an account sees it in the composer, with its price (Generate is the owner's): "See", not "Try".
+ expect(card(s).tryIn).toMatchObject({ href: `/storyboard?starter=${encodeURIComponent(s.id)}`, text: "See it in Storyboard" });
+ expect(fills[s.id]).toMatchObject({ kind: "storyboard", story: s.seed.story, frames: s.seed.frames });
+ }
+ expect(STARTERS.find((s) => s.id === "storyboard.perfume-ad")!.seed).toMatchObject({ frames: 6, aspectRatio: "16:9" });
+ });
+});
+
+describe("Element starters", () => {
+ it("name the @handle they are saved as, and take the files their kind takes", () => {
+ for (const s of of("elements")) {
+ if (s.seed.kind !== "element") throw new Error(s.id);
+ if (s.seed.element.kind !== "voice") expect(s.makes, s.id).toContain(`@${handleFor(s.seed.element.name)}`);
+ expect(s.samples?.length, s.id).toBeGreaterThan(0);
+ for (const f of s.samples ?? []) expect(/\.m4a$/.test(f.src), `${s.id} ${f.src}`).toBe(s.seed.element.kind === "voice");
+ expect(starterHref(card(s))).toBe(`/elements/start/${s.id}`);
+ // A visitor's next step: the app or the camera move its photo comes from, with that example loaded.
+ if (s.seed.element.kind !== "voice") {
+ const t = card(s).tryIn;
+ expect(t?.example, s.id).toBeTruthy();
+ expect(t?.href, s.id).toMatch(new RegExp(`^(/apps/[a-z0-9-]+\\?|/video\\?preset=[a-z0-9-]+&)example=${t!.example!.replace(".", "\\.")}$`));
+ }
+ }
+ // A portrait shows from its top in a wide frame; the other pictures from their middle.
+ expect(card(STARTERS.find((s) => s.id === "elements.amara")!).coverTop).toBe(true);
+ expect(card(STARTERS.find((s) => s.id === "elements.highland-castle")!).coverTop).toBeUndefined();
+ });
+});
+
+describe("Library starters", () => {
+ it("each opens a studio with its content loaded, for everyone", () => {
+ const cards = of("library").sort((a, b) => a.rank - b.rank).map(card);
+ expect(cards.map((c) => (c.use.kind === "link" ? c.use.href : ""))).toEqual([
+ "/video?preset=effect-pearl-earring&example=effect-pearl-earring.1",
+ "/image?example=image.1",
+ "/video?preset=effect-superstar&example=effect-superstar.1",
+ "/storyboard?starter=storyboard.perfume-ad",
+ ]);
+ for (const c of cards) expect(starterHref(c)).toBe(c.use.kind === "link" ? c.use.href : "");
+ // The owner opens the Pearl Earring's ready board, which they can save.
+ expect(starterHref(cards[0], true)).toBe("/canvas/start/effect-chain-pearl-earring");
+ expect(starterHref(cards[1], true)).toBe("/image?example=image.1");
+ });
+});
+
+describe("starter pages and the owner's tap", () => {
+ it("pages exist for Assist, Cinema, Storyboard and Elements, and nowhere else", () => {
+ for (const surface of ["assist", "cinema", "storyboard", "elements"] as const) expect(starterIds(surface).every((id) => starterOn(surface, id)), surface).toBe(true);
+ expect(starterOn("cinema", "elements.amara")).toBeUndefined();
+ expect(starterOn("cinema", "cinema.nope")).toBeUndefined();
+ });
+
+ it("a guest reads the pages; making a starter is the owner's (guest 401, account 403 library)", () => {
+ for (const p of ["/assist/start/assist.jewel-campaign", "/cinema/start/cinema.riviera-night", "/storyboard/start/storyboard.heist", "/elements/start/elements.amara"]) expect(guestRead(p).kind, p).toBe("pass");
+ expect(isLibraryChange("POST", "/api/starters/cinema.riviera-night")).toBe(true);
+ expect(isLibraryChange("POST", "/api/starters/elements.amara")).toBe(true);
+ });
+
+ it("every card a visitor sees opens: its page is there for them, or its link's studio has what it names", () => {
+ for (const surface of SURFACES) {
+ for (const c of starterCards(surface)) {
+ expect(starterCovered(c.id), c.id).toBe(true);
+ const href = starterHref(c);
+ if (c.use.kind === "link") {
+ // A Library link to another starter shows only once that one is shown too.
+ const other = /[?&]starter=([^&]+)/.exec(href)?.[1];
+ if (other) expect(starterCovered(decodeURIComponent(other)), c.id).toBe(true);
+ continue;
+ }
+ expect(unknownStarterPage(href), href).toBe(false);
+ expect(hiddenStarterPage(href), href).toBe(false);
+ }
+ // And a card a visitor doesn't see has no page for them.
+ for (const c of starterCards(surface, { all: true }).filter((x) => !x.cover && x.use.kind !== "link")) expect(hiddenStarterPage(starterHref(c)), c.id).toBe(true);
+ }
+ });
+
+ it("a card never shows a visitor the owner's mark; a Library card opens its studio", async () => {
+ const { StarterTile } = await import("@/components/starters/starter-section");
+ const html = (props: Record<string, unknown>) => renderToStaticMarkup(createElement(StarterTile as FC<Record<string, unknown>>, props));
+ const amara = starterCards("elements")[0];
+ const guest = html({ s: amara, owner: false, busy: false, onUse: () => {} });
+ expect(guest).not.toContain("No cover yet");
+ expect(guest).toContain("See how it works");
+ expect(guest).toContain(`href="/elements/start/${amara.id}"`);
+ expect(html({ s: amara, owner: true, busy: false, onUse: () => {} })).toContain("Use template");
+ const link = starterCards("library").find((c) => c.cover)!;
+ const linkHtml = html({ s: link, owner: false, busy: false, onUse: () => {} });
+ expect(linkHtml).toContain("Open it");
+ expect(linkHtml).toContain(`href="${link.use.kind === "link" ? link.use.href.replace(/&/g, "&amp;") : ""}"`);
+ });
+});
diff --git a/tests/template-covers.test.ts b/tests/template-covers.test.ts
index b6395dd8..87cad3c8 100644
--- a/tests/template-covers.test.ts
+++ b/tests/template-covers.test.ts
@@ -56,7 +56,8 @@ const TILES: Record<TemplateGroup, string[]> = {
// The example pictures of the empty pages: Character Sheet, Storyboard (six frames), Elements (four pictures).
examples: ["character-sheet", "storyboard-heist", "element-maya", "element-rooftop-bar", "element-aurora", "element-together"],
// The studios' ready-made starters, by starter id (src/lib/starters/catalog.ts).
- starters: STARTERS.map((s) => s.id),
+ // A starter that shows another tile's cover, an example's or its own published photos (coverOf) gets none of its own.
+ starters: STARTERS.filter((s) => !s.coverOf).map((s) => s.id),
};
const VERSIONED = /^(\/previews\/[^?]+)\?v=([0-9a-f]{8})$/;
const sha8 = (...files: string[]) => {
@@ -131,10 +132,11 @@ describe("the template covers manifest", () => {
}
}
// The studios' tiles (242, with Keyframes → animation, Outfit lookbook and Music video), Fuobe Soul's looks (139),
- // AI Influencer's types (9), the empty pages' examples (6) and the studios' ready-made starters (15).
- expect(lines).toHaveLength(242 + 139 + 9 + 6 + 15);
+ // AI Influencer's types (9), the empty pages' examples (6) and the studios' ready-made starters with a cover of their
+ // own (24).
+ expect(lines).toHaveLength(242 + 139 + 9 + 6 + 24);
const text = `{\n${lines.join(",\n")}\n}`;
- expect(text.length).toBeLessThan(36_000);
+ expect(text.length).toBeLessThan(37_000);
expect(gzipSync(text).length).toBeLessThan(8_000);
});
});