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.

Own setup: Restore & colourise, Shorts Enhance and Regenerate to 1080p run on a visitor's own setup

Adarsh23f29c34777d
diff --git a/docs/public-signup.md b/docs/public-signup.md
index e19a99ea..47d1d280 100644
--- a/docs/public-signup.md
+++ b/docs/public-signup.md
@@ -278,7 +278,13 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188
the studio's local LLM is refused; "Enhance prompt" uses Fuobe's offline wording. Other tools
(Canvas, Assist, Marketing…) answer 403 with `code: "own-gpu-tool"`, because they
plan with the studio's own AI helpers or keep projects of their own. The Audio tools have their own routes (below).
- Restore & colourise is left out of the Video tools tabs and the result menus for them.
+ Restore & colourise (`POST /api/restore`) shows to everyone, its tab, page and result-menu item marked "Runs on your
+ own GPU · 24 GB or fal.ai key": an account runs it on its own GPU or fal.ai key after the same checks as Genjutsu's,
+ with Fuobe's offline template for the words (writing them from the frames with the studio's AI helper stays the
+ owner's); a guest gets the sign-up card, an account with neither "Connect your GPU". A guest's model pickers list the
+ paid models after the open ones, each marked "Use your own fal.ai key" (or Replicate); choosing one opens the sign-up
+ card. An account without a key sees the same list with "Add your fal.ai key". Image to 3D's cloud models, Retexture,
+ Rig and "Use the cloud" for Pick an object are marked the same way for a visitor on open models only.
A hosted model whose calls haven't yet passed a live run with a real key (`src/lib/catalog/hosted-untested.ts`:
MiniMax H3 Max's lip sync, relight, insert, looks and Turbo, H3 Lite and HighSpeed, Vidu Q4, the Mureka songs and
song tools, MiniMax Music 3, ElevenLabs Music, Lyria 3.5, the hosted voice cleaners, Meshy retexture, Tripo P2,
@@ -293,8 +299,11 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188
your GPU, Character Swap's Sharpen and its 1080p / 2K / 4K on your GPU; and Kandinsky 6.0 Pro) show to everyone,
marked "Runs on your own GPU · 48 GB" (Kandinsky Pro's choice says about 80 GB). An account runs them on its own GPU
only, when that GPU has the memory (`src/server/own-setup-run.ts`); otherwise it gets "Connect your GPU" (`connect-gpu`).
- Cinema's exact orbit is marked "Runs on your own GPU · 48 GB or fal.ai key". Faceless's "Regenerate to 1080p" is
- left out of an account's episodes: its route is not one of an account's tool runs.
+ Cinema's exact orbit is marked "Runs on your own GPU · 48 GB or fal.ai key". Faceless's "Regenerate to 1080p" and
+ Shorts' Enhance run on an account's own GPU through their own routes (`.../regenerate`, `.../enhance`). The owner sees
+ these surfaces too; while they are held on this studio's GPU, the owner's run answers with what it needs ("needs a
+ GPU with 48 GB or more"). Cinema's "Make a prop from a picture" (Idol 3D) runs on a visitor's own GPU through Image to
+ 3D's route.
"Write the lyrics" and "Rewrite my prompt now" use the studio's AI helper and are hidden from guests and accounts.
A song's stems come back as one zip: for an account it is fetched from public addresses only, within what its files
have room for (128 MB at most, 256 MB unpacked), and each stem is saved to disk as it is unpacked.
@@ -334,8 +343,8 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188
Idol 3D's other sides ("Make the other sides from the front") and Trim spikes show to everyone and run on the
account's own GPU through the same route; each is labelled with what it runs on ("Runs on your own GPU · 24 GB")
until its graph is validated on this studio's GPU (`graphs` in `src/lib/own-setup.ts`, read by the page with
- `ownSetupsNow`, `src/server/own-setup-live.ts`), when the label leaves by itself. Retexture opens once its cloud
- models pass a live call. On this install's
+ `ownSetupsNow`, `src/server/own-setup-live.ts`), when the label leaves by itself. Retexture and Rig run on the
+ account's own fal.ai key. On this install's
GPUs (hosted runs) 3D isn't offered yet. A guest gets the sign-up card.
- **Character Swap Studio.** An account keeps Character Swap projects of its own (`/character-swap`; `GET`/`POST
/api/swap-studio/projects`, `GET`/`PATCH`/`DELETE /api/swap-studio/projects/<id>`): its own only (another account's,
@@ -354,7 +363,8 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188
its History, a short's page (`/shorts/<id>`) and its preset list show only its own, and another account's or the
owner's read as not found (404). It keeps up to 50 shorts. Deleting a short deletes its runs for good (an account
has no Trash). It downloads the full video, each part, and "Download parts" as one zip of its own runs.
- Enhance (`.../enhance`) isn't offered to it yet (403 `own-gpu-tool`). A guest gets the sign-up card.
+ Enhance (`.../enhance`, Open-H3 Regenerate) runs on its own GPU only, one with 48 GB or more (`connect-gpu`
+ otherwise), after the same checks. A guest gets the sign-up card.
- **Cinema Studio.** An account makes, reopens and runs its own projects (`/api/cinema/projects/**`): up to 50,
each with its folders, takes, Director settings, brief and AI Director chat, deleted with the account. Another
account's project, or the owner's, reads as not found (404), and the owner's lists never show an account's. A take
@@ -420,8 +430,8 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188
script for review, a channel and a series made from a preset need no GPU or key. The server never fetches a link for
it: a channel's YouTube reference is kept as the link, and an explainer's link source and a series' TikTok or
Instagram link are the owner's (it attaches the file or uploads the clip). "Generate in Claude" (the studio's own MCP
- server) and "Regenerate to 1080p" (held with Open-H3 Regenerate) aren't offered to it (403 `own-gpu-tool`). A guest
- gets the sign-up card.
+ server) isn't offered to it (403 `own-gpu-tool`). "Regenerate to 1080p" runs on its own GPU only, one with 48 GB or
+ more (`connect-gpu` otherwise). A guest gets the sign-up card.
- **Files a run takes.** A run on your GPU takes only files you uploaded here, or your own results.
A link or a `data:` URI answers 400 with `code: "input-not-allowed"`, someone else's file 403
(`input-not-yours`), and a file that has expired 404 (`input-gone`, "That file has expired.
diff --git a/src/app/api/faceless/episodes/[id]/[action]/route.ts b/src/app/api/faceless/episodes/[id]/[action]/route.ts
index 88ff1e10..10a9aa90 100644
--- a/src/app/api/faceless/episodes/[id]/[action]/route.ts
+++ b/src/app/api/faceless/episodes/[id]/[action]/route.ts
@@ -1,6 +1,21 @@
import type { GenerationRequest } from "@/lib/catalog/types";
import { asViewer, guestRun, runAccountTool, toolViewer } from "@/server/account-tool-run";
-import { episodeView, graphFiles, graphToolSteps, handle, regenerateEpisode, renderEpisode, renderGraph, retryEpisode, retryGraph, rewriteEpisode, undoChange, upscaleEpisode, upscaleToolSteps } from "@/server/faceless";
+import {
+ episodeView,
+ graphFiles,
+ graphToolSteps,
+ handle,
+ regenerateEpisode,
+ regenerateToolSteps,
+ renderEpisode,
+ renderGraph,
+ retryEpisode,
+ retryGraph,
+ rewriteEpisode,
+ undoChange,
+ upscaleEpisode,
+ upscaleToolSteps,
+} from "@/server/faceless";
import { planned } from "@/server/faceless-account";
const ACTIONS = {
@@ -32,11 +47,13 @@ const RUNS: Partial<Record<Action, (id: string) => Work>> = {
return { steps: graphToolSteps(g), files: graphFiles(g) };
},
upscale: (id) => ({ steps: upscaleToolSteps(id), files: [] }),
+ // Its own GPU only, one with the memory it needs (regenerateEpisode's gate); the episode's own results are its files.
+ regenerate: (id) => ({ steps: regenerateToolSteps(id), files: [] }),
};
/**
- * An episode's action. A signed-in account's, on its own episode: a render, a retry and an upscale run on its own GPU or
- * key after the checks a studio run gets (src/server/account-tool-run.ts); a guest signs up first.
+ * An episode's action. A signed-in account's, on its own episode: a render, a retry, an upscale and Regenerate to 1080p
+ * run on its own GPU or key after the checks a studio run gets (src/server/account-tool-run.ts); a guest signs up first.
*/
export async function POST(request: Request, ctx: RouteContext<"/api/faceless/episodes/[id]/[action]">) {
const viewer = toolViewer(request);
diff --git a/src/app/api/restore/route.ts b/src/app/api/restore/route.ts
index 1d6a8794..0c7f0966 100644
--- a/src/app/api/restore/route.ts
+++ b/src/app/api/restore/route.ts
@@ -1,16 +1,40 @@
-import { createRestore, RestoreBodySchema } from "@/server/restore";
+import { bodyTooBig, guestRun, onceForAccount, runAccountTool, toolViewer } from "@/server/account-tool-run";
+import { createRestore, planRestoreRun, RestoreBodySchema, restoreSteps, startRestore, type RestoreRun } from "@/server/restore";
import { body, handle, once } from "@/server/shorts-schemas";
/**
* Restore & colourise a clip (Fuobe Restore): the prompt is written first when none is given; windows or pieces are
- * joined and the sound put back. The owner's only on a public studio: it plans with the studio's own AI helpers and
- * chains its steps on the server, so guests and accounts get own-gpu-tool from the proxy (src/proxy.ts).
+ * joined and the sound put back. The owner's run as always; an account's on its own GPU or its own fal.ai key, with its
+ * own files and Fuobe's offline template for the words, after the checks every tool run gets
+ * (src/server/account-tool-run.ts); a guest signs up first.
*/
export async function POST(request: Request) {
+ const viewer = toolViewer(request);
+ if (viewer.kind === "guest") return guestRun();
+ if (viewer.kind === "account") {
+ const big = bodyTooBig(request);
+ if (big) return big;
+ }
return handle(async () => {
const input = await body(request, RestoreBodySchema, "Add the clip to restore and pick an engine");
// A repeated requestId (a second click on Restore) gets the run the first one started.
- const result = await once("restore", input.requestId, () => createRestore(input));
- return Response.json(result, { status: 201 });
+ if (viewer.kind === "owner") {
+ const result = await once("restore", input.requestId, () => createRestore(input));
+ return Response.json(result, { status: 201 });
+ }
+ let run: RestoreRun | null = null;
+ return onceForAccount(
+ viewer.account,
+ "restore",
+ input.requestId,
+ () =>
+ runAccountTool(request, viewer.account, {
+ tool: "restore",
+ files: [input.source.url, input.reference],
+ plan: async () => restoreSteps((run = await planRestoreRun(input))),
+ start: () => startRestore(run!),
+ }),
+ ({ value, gpuWarning }) => Response.json({ ...value, ...(gpuWarning && { gpuWarning }) }, { status: 201 }),
+ );
}, request);
}
diff --git a/src/app/api/shorts/sessions/[id]/segments/[index]/enhance/route.ts b/src/app/api/shorts/sessions/[id]/segments/[index]/enhance/route.ts
index 51932386..0e300727 100644
--- a/src/app/api/shorts/sessions/[id]/segments/[index]/enhance/route.ts
+++ b/src/app/api/shorts/sessions/[id]/segments/[index]/enhance/route.ts
@@ -1,18 +1,40 @@
-import { ownGpuTool, toolViewer } from "@/server/account-tool-run";
-import { enhanceSegment, ShortsError } from "@/server/shorts";
+import { asViewer, bodyTooBig, guestRun, onceForAccount, runAccountTool, toolViewer } from "@/server/account-tool-run";
+import { enhanceSegment, planEnhanceRun, sessionFiles, shortsSteps, ShortsError, startEnhance, type EnhanceRun } from "@/server/shorts";
import { NonceSchema, handle, once, optionalBody } from "@/server/shorts-schemas";
/**
- * Enhance (H3 regenerate): a 1080p take of this segment, redrawn on your GPU (a repeated requestId gets the first answer).
- * The owner's only: it isn't offered on an account's own GPU yet.
+ * Enhance (H3 regenerate): a 1080p take of this segment, redrawn on a GPU (a repeated requestId gets the first answer).
+ * An account's runs on its own GPU only, when that GPU has the memory it needs, for its own session only, after the
+ * checks every tool run gets (src/server/account-tool-run.ts); a guest signs up first.
*/
export async function POST(request: Request, ctx: RouteContext<"/api/shorts/sessions/[id]/segments/[index]/enhance">) {
- if (toolViewer(request).kind !== "owner") return ownGpuTool();
+ const viewer = toolViewer(request);
+ if (viewer.kind === "guest") return guestRun();
+ if (viewer.kind === "account") {
+ const big = bodyTooBig(request);
+ if (big) return big;
+ }
return handle(async () => {
const { id, index } = await ctx.params;
const i = Number(index);
if (!Number.isInteger(i) || i < 0) throw new ShortsError("No such segment", 404);
const { requestId } = await optionalBody(request, NonceSchema);
- return Response.json(await once(`shorts-enhance:${id}:${i}`, requestId, () => enhanceSegment(id, i)), { status: 201 });
+ if (viewer.kind === "owner") return Response.json(await once(`shorts-enhance:${id}:${i}`, requestId, () => enhanceSegment(id, i)), { status: 201 });
+ // Its own session only (another's reads as gone), and the files its runs take.
+ const files = asViewer(viewer, () => sessionFiles(id));
+ let run: EnhanceRun | null = null;
+ return onceForAccount(
+ viewer.account,
+ `shorts-enhance:${id}:${i}`,
+ requestId,
+ () =>
+ runAccountTool(request, viewer.account, {
+ tool: "shorts",
+ files,
+ plan: () => shortsSteps((run = planEnhanceRun(id, i)).plan.steps),
+ start: () => startEnhance(run!),
+ }),
+ ({ value, gpuWarning }) => Response.json({ ...value, ...(gpuWarning && { gpuWarning }) }, { status: 201 }),
+ );
}, request);
}
diff --git a/src/components/audio-tools/speech-edit-tool.tsx b/src/components/audio-tools/speech-edit-tool.tsx
index e12959b3..8f784f26 100644
--- a/src/components/audio-tools/speech-edit-tool.tsx
+++ b/src/components/audio-tools/speech-edit-tool.tsx
@@ -19,6 +19,7 @@ import { useAskBeforeUpload, useCreateGeneration, useEngine, useGenerations, use
import { clock } from "@/lib/av/audio-tools";
import type { Generation, OutputFile } from "@/lib/catalog/types";
import type { Cue } from "@/lib/cues";
+import type { OwnSetup } from "@/lib/own-setup";
import { parseCues } from "@/lib/cues";
import { downloadHref } from "@/lib/library";
import { readSpeechEditHandoff } from "@/lib/speech-edit-handoff";
@@ -264,7 +265,12 @@ function EffectOptions({ effect, onChange }: { effect: SpeechEffect; onChange: (
}
}
-export function SpeechEditTool() {
+/**
+ * `setup`: what the page read for "audio:edit-speech" (ownSetupsNow): null once its graph is validated on this studio's
+ * GPU, when the label leaves; left out, the static entry.
+ */
+export function SpeechEditTool({ setup }: { setup?: OwnSetup | null } = {}) {
+ const item = setup === undefined ? OWN_SETUP : setup;
const [engine, setEngine, mode] = useEngine();
// A guest or an account: its own setup's label beside the title (after hydration, so it matches the server HTML),
// and a press that asks for it first.
@@ -366,7 +372,7 @@ export function SpeechEditTool() {
const transcribing = create.isPending || t?.status === "queued" || t?.status === "running";
const transcribe = () => {
- if (!ready || !press(OWN_SETUP)) return;
+ if (!ready || !press(item)) return;
create.mutate(
{ feature: SPEECH_EDIT_FEATURE, modelId: "oss-qwen3-asr", engine: "open", op: "transcribe", inputs: ready.kind === "video" ? { video: ready.ref } : { audio: ready.ref }, title: `Transcript · ${baseName(ready)}` },
{ onSuccess: (items) => setTranscriptId(items[0]?.id ?? null), onError: (e) => toastError(e) },
@@ -375,7 +381,7 @@ export function SpeechEditTool() {
const go = () => {
if (blocker) return void toast(blocker);
if (error) return void toast.error(error);
- if (!press(OWN_SETUP)) return;
+ if (!press(item)) return;
run.mutate(body!, {
onSuccess: (r) => {
const edit = r.items.find((x) => x.op === "speech-edit") ?? r.result;
@@ -394,7 +400,7 @@ export function SpeechEditTool() {
<ToolShell title="Audio">
{!source && (
<ToolHero title="Edit speech" subtitle={SUBTITLE}>
- {hydrated && visitor && <OwnSetupChip setup={OWN_SETUP} short={false} className="mt-3" />}
+ {hydrated && visitor && <OwnSetupChip setup={item} short={false} className="mt-3" />}
</ToolHero>
)}
<div className={cn("mx-auto max-w-[860px] space-y-3", source ? "pt-4" : "mt-6")}>
diff --git a/src/components/cinema/scene-props.tsx b/src/components/cinema/scene-props.tsx
index 9914aa8a..7bf21625 100644
--- a/src/components/cinema/scene-props.tsx
+++ b/src/components/cinema/scene-props.tsx
@@ -6,8 +6,10 @@ import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Slider } from "@/components/ui/slider";
import { MediaSlot, type SlotValue } from "@/components/studio/media-slot";
-import { priceLine, useRunPreview } from "@/components/model3d/hooks";
-import { useCreateGeneration, useGenerations, useStatus } from "@/lib/api";
+import { priceLine, useCreate3d, useRunPreview } from "@/components/model3d/hooks";
+import { OwnSetupChip, useOwnSetupPress, useOwnSetupViewer } from "@/components/own-setup";
+import { useGenerations, useStatus } from "@/lib/api";
+import type { OwnSetup } from "@/lib/own-setup";
import { IDOL_MODELS, IDOL_QUALITIES, MODEL3D_FEATURE, model3dRequest, type IdolQuality } from "@/lib/av/model3d";
import { getModel } from "@/lib/catalog";
import type { Generation } from "@/lib/catalog/types";
@@ -105,9 +107,15 @@ function AddPropBody({ onPlace, onMaking }: { onPlace: (c: PropCandidate & { nam
);
}
+/** A prop from a picture runs Idol 3D on a visitor's own GPU. */
+const PROP_SETUP: OwnSetup = { need: "gpu" };
+
function MakeFromPicture({ onMaking }: { onMaking: (generationId: string) => void }) {
const status = useStatus().data;
- const create = useCreateGeneration();
+ // The owner's run on the studio's GPU; a visitor's goes to Image to 3D's own route (its own GPU, its checks).
+ const create = useCreate3d();
+ const visitor = !!useOwnSetupViewer();
+ const press = useOwnSetupPress();
const [photo, setPhoto] = useState<SlotValue | null>(null);
const [quality, setQuality] = useState<IdolQuality>("best");
const blocker = propMakerBlocker(status && { ...status, idolOn: offered(status.access, IDOL_MODELS.open, "open") });
@@ -121,14 +129,14 @@ function MakeFromPicture({ onMaking }: { onMaking: (generationId: string) => voi
const price = priceLine(preview.data);
const make = () => {
if (!req) return;
- create.mutate(req, {
- onSuccess: (items) => {
+ void create.mutateAsync(req).then(
+ (items) => {
const g = items[0];
if (g) onMaking(g.id);
setPhoto(null);
},
- onError: (e) => toastError(e, "Couldn't start the prop"),
- });
+ (e) => toastError(e, "Couldn't start the prop"),
+ );
};
return (
<section className="space-y-2.5" aria-labelledby="prop-picture">
@@ -143,6 +151,7 @@ function MakeFromPicture({ onMaking }: { onMaking: (generationId: string) => voi
<MediaSlot label="Picture" kind="image" value={photo} onChange={setPhoto} />
<div className="min-w-0 flex-1 space-y-2 text-[13px]">
<p>One object, whole, on a plain background works best. Idol 3D makes it on your GPU (open source), and it lands in the scene when it&apos;s ready.</p>
+ {visitor && <OwnSetupChip setup={PROP_SETUP} />}
<div className="inline-flex h-8 rounded-full bg-muted p-0.5" role="radiogroup" aria-label="Idol 3D quality">
{IDOL_QUALITIES.map((q) => (
<button
@@ -160,7 +169,7 @@ function MakeFromPicture({ onMaking }: { onMaking: (generationId: string) => voi
</div>
</div>
</div>
- <Button className="w-full rounded-full" disabled={!req || create.isPending} onClick={make}>
+ <Button className="w-full rounded-full" disabled={!req || create.isPending} onClick={() => press(PROP_SETUP, make)}>
{create.isPending ? <Loader2 className="animate-spin" /> : <Plus />} Make the prop{price ? ` · ${price}` : ""}
</Button>
</>
diff --git a/src/components/elements-view.tsx b/src/components/elements-view.tsx
index 60a23876..63083f82 100644
--- a/src/components/elements-view.tsx
+++ b/src/components/elements-view.tsx
@@ -427,7 +427,7 @@ function ElementsBody({ starters: given }: { starters: StarterCardData[] }) {
description="Characters, locations, props and styles you can reuse. Save one once, then type @ in any image or video prompt, and it looks the same every time."
>
{visitor ? (
- <SelfHostNote className="max-w-xs">Saving elements isn&apos;t available here.</SelfHostNote>
+ <SelfHostNote className="max-w-xs">Saving elements runs on your own Fuobe install.</SelfHostNote>
) : (
<Button onClick={() => setOpen(true)}>
<Plus /> New element
diff --git a/src/components/layers/projects-view.tsx b/src/components/layers/projects-view.tsx
index 3c46949a..b8d26f41 100644
--- a/src/components/layers/projects-view.tsx
+++ b/src/components/layers/projects-view.tsx
@@ -301,7 +301,7 @@ function ProjectsInner({ examples }: { examples?: ExampleRowData | null }) {
</Popover>
</div>
{visitor ? (
- <SelfHostNote className="mx-auto mt-3 max-w-[560px]">Layers isn&apos;t available here.</SelfHostNote>
+ <SelfHostNote className="mx-auto mt-3 max-w-[560px]">Layers runs on your own Fuobe install.</SelfHostNote>
) : (
<p className="mt-3 text-[12px] text-muted-foreground">Upload an image, or pick one you already generated. Images only — JPG, PNG or WebP.</p>
)}
diff --git a/src/components/model3d/model-card.tsx b/src/components/model3d/model-card.tsx
index 7812d217..0be6425e 100644
--- a/src/components/model3d/model-card.tsx
+++ b/src/components/model3d/model-card.tsx
@@ -63,12 +63,15 @@ function rigClips(g: Generation, view: Model3dView): { key: string; label: strin
export function ModelCard({
g,
cloudAllowed,
+ keyInstead,
refineAllowed = false,
finalAllowed = false,
onFinal,
}: {
g: Generation;
cloudAllowed: boolean;
+ /** A visitor on open models only: Rig and Retexture run with its own fal.ai key, and say so. */
+ keyInstead?: boolean;
refineAllowed?: boolean;
/** TRELLIS.2 runs here and is switched on: an Idol 3D draft offers "Build the final with TRELLIS.2". */
finalAllowed?: boolean;
@@ -538,8 +541,8 @@ export function ModelCard({
</div>
{refinable && refining && view.glb && refineFrom && <RefineDialog glb={view.glb} photo={refineFrom} open={refining} onOpenChange={setRefining} feature={g.feature} />}
{printing && view.glb && <PrintDialog glb={view.glb} name={name} open={printing} onOpenChange={setPrinting} refined={refined} />}
- {rigSource && rigging && g.op !== "splat" && <RigDialog glb={rigSource} open={rigging} onOpenChange={setRigging} cloudAllowed={cloudAllowed} />}
- {view.glb && retexturing && <RetextureDialog glb={view.glb} open={retexturing} onOpenChange={setRetexturing} cloudAllowed={cloudAllowed} />}
+ {rigSource && rigging && g.op !== "splat" && <RigDialog glb={rigSource} open={rigging} onOpenChange={setRigging} cloudAllowed={cloudAllowed} keyInstead={keyInstead} />}
+ {view.glb && retexturing && <RetextureDialog glb={view.glb} open={retexturing} onOpenChange={setRetexturing} cloudAllowed={cloudAllowed} keyInstead={keyInstead} />}
</article>
);
}
diff --git a/src/components/model3d/model3d-studio.tsx b/src/components/model3d/model3d-studio.tsx
index ce489068..32f750ea 100644
--- a/src/components/model3d/model3d-studio.tsx
+++ b/src/components/model3d/model3d-studio.tsx
@@ -24,6 +24,7 @@ import {
IDOL_QUALITIES,
MAX_3D_PROMPT,
MODEL3D_FEATURE,
+ MODEL3D_KEY,
MODEL3D_FILM_FEATURE,
MODEL3D_MODES,
MODELS_3D,
@@ -178,11 +179,14 @@ function IdolSettings({
</summary>
<div className="flex items-center justify-between gap-3 pt-3">
<div className="min-w-0">
- <Label htmlFor="m3d-idol-trim" className="text-[13px] font-normal">
- Trim spikes
- </Label>
- {/* A visitor's run is on its own GPU: what that needs (the owner reads the line below instead). */}
- <OwnSetupChip setup={cleanSetup} className="ml-1.5 align-[1px]" />
+ {/* A visitor's run is on its own GPU: what that needs (the owner reads the line below instead). On a phone the
+ chip wraps under the name, flush with it. */}
+ <div className="flex flex-wrap items-center gap-x-1.5 gap-y-0.5">
+ <Label htmlFor="m3d-idol-trim" className="text-[13px] font-normal">
+ Trim spikes
+ </Label>
+ <OwnSetupChip setup={cleanSetup} />
+ </div>
<p id="m3d-idol-trim-hint" className="mt-0.5 text-[12px] text-muted-foreground">
Drops the thin, needle-like bits around the edges of the 3D file.
</p>
@@ -367,6 +371,12 @@ function Model3dStudioBody({ info, examples }: { info: Record<string, Model3dInf
const preview = useRunPreview(engineKnown ? priced : null);
const price = priceLine(preview.data);
const cloudAllowed = engineMode !== "open";
+ // A guest, or an account without a key, on open models only: the cloud models run with its own fal.ai key, labelled,
+ // and a press opens the step that sets it up (own-setup.ts).
+ const visitorView = useStatus().data?.viewer;
+ const keyInstead = !cloudAllowed && !!visitorView && visitorView.paidAllowed !== false;
+ // Those models, after the open ones in the picker.
+ const paidChoices = keyInstead ? MODELS_3D[mode].cloud : [];
// Hi3D runs on your GPU only: offered while the install runs open models and the model is switched on (a visitor's
// runs on its own GPU, its label beside the switch).
const refineAllowed = engineMode !== "cloud" && offered(access, HI3D_MODEL, "open");
@@ -511,6 +521,12 @@ function Model3dStudioBody({ info, examples }: { info: Record<string, Model3dInf
Use the cloud
</Button>
)}
+ {keyInstead && (
+ <Button size="sm" className="rounded-full" onClick={() => press(MODEL3D_KEY)}>
+ Use the cloud
+ <OwnSetupChip setup={MODEL3D_KEY} className="bg-primary-foreground/15 text-primary-foreground" />
+ </Button>
+ )}
<Button size="sm" variant="outline" className="rounded-full" onClick={() => setMode("image")}>
From an image
</Button>
@@ -522,7 +538,14 @@ function Model3dStudioBody({ info, examples }: { info: Record<string, Model3dInf
<Label htmlFor="m3d-model" className="sr-only">
Model
</Label>
- <Select value={modelId} onValueChange={(v) => setPicked((p) => ({ ...p, [`${mode}:${engine}`]: v }))}>
+ <Select
+ value={modelId}
+ onValueChange={(v) => {
+ // A paid model a visitor runs with its own key: the step that sets it up (the pick stays).
+ if (v.startsWith(PAID_3D)) return void press(MODEL3D_KEY);
+ setPicked((p) => ({ ...p, [`${mode}:${engine}`]: v }));
+ }}
+ >
<SelectTrigger id="m3d-model" className="h-9 w-full rounded-full">
<SelectValue />
</SelectTrigger>
@@ -532,6 +555,13 @@ function Model3dStudioBody({ info, examples }: { info: Record<string, Model3dInf
{info[m.id]?.name ?? m.id}
</SelectItem>
))}
+ {keyInstead &&
+ paidChoices.map((m) => (
+ <SelectItem key={m.id} value={`${PAID_3D}${m.id}`}>
+ {info[m.id]?.name ?? m.id}
+ <OwnSetupChip setup={MODEL3D_KEY} />
+ </SelectItem>
+ ))}
</SelectContent>
</Select>
<p className="text-[12px] text-muted-foreground">{modelNote(choices.find((m) => m.id === modelId)?.note, owner)}</p>
@@ -590,7 +620,7 @@ function Model3dStudioBody({ info, examples }: { info: Record<string, Model3dInf
) : (
<div className="grid gap-3 sm:grid-cols-2">
{items.map((g) => (
- <ResultCard key={g.id} g={g} cloudAllowed={cloudAllowed} refineAllowed={refineAllowed} finalAllowed={finalAllowed} onFinal={toFinal} />
+ <ResultCard key={g.id} g={g} cloudAllowed={cloudAllowed} keyInstead={keyInstead} refineAllowed={refineAllowed} finalAllowed={finalAllowed} onFinal={toFinal} />
))}
</div>
)}
@@ -599,6 +629,9 @@ function Model3dStudioBody({ info, examples }: { info: Record<string, Model3dInf
);
}
+/** A paid model's value in the picker (it never becomes the pick: choosing it opens the step that sets up a key). */
+const PAID_3D = "paid:";
+
/**
* A model's note under the picker. This studio renders the turntable of a model made on its own GPU; anyone else's
* model comes without one (its card records one in the browser), so their note leaves it out.
@@ -619,12 +652,14 @@ function retryOf(g: Generation): GenerationRequest {
function ResultCard({
g,
cloudAllowed,
+ keyInstead,
refineAllowed,
finalAllowed,
onFinal,
}: {
g: Generation;
cloudAllowed: boolean;
+ keyInstead: boolean;
refineAllowed: boolean;
finalAllowed: boolean;
onFinal: (photo: string) => void;
@@ -633,7 +668,7 @@ function ResultCard({
if (g.status === "queued" || g.status === "running") return <PendingTile g={g} ratio={4 / 3} />;
if (g.status !== "succeeded") return <FailedTile g={g} ratio={4 / 3} onRetry={() => create.mutate(retryOf(g), { onError: (e) => toastError(e) })} />;
if (g.kind === "video") return <FilmCard g={g} />;
- return <ModelCard g={g} cloudAllowed={cloudAllowed} refineAllowed={refineAllowed} finalAllowed={finalAllowed} onFinal={onFinal} />;
+ return <ModelCard g={g} cloudAllowed={cloudAllowed} keyInstead={keyInstead} refineAllowed={refineAllowed} finalAllowed={finalAllowed} onFinal={onFinal} />;
}
/** A photoreal orbit filmed from a model ("Film it photoreal"): the clip, to watch and download. */
diff --git a/src/components/model3d/retexture-dialog.tsx b/src/components/model3d/retexture-dialog.tsx
index 2241ab45..b45b0d40 100644
--- a/src/components/model3d/retexture-dialog.tsx
+++ b/src/components/model3d/retexture-dialog.tsx
@@ -3,13 +3,14 @@
import { ImagePlus, Loader2, Paintbrush, X } from "lucide-react";
import { useRef, useState } from "react";
import { toast } from "sonner";
+import { OwnSetupNote } from "@/components/own-setup";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Label } from "@/components/ui/label";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Textarea } from "@/components/ui/textarea";
import { uploadFile } from "@/lib/api";
-import { RETEXTURE_MODELS, RETEXTURE_PROMPT_MAX, RETEXTURE_SIZES, retextureRequest, type RetextureModel } from "@/lib/av/model3d";
+import { MODEL3D_KEY, RETEXTURE_MODELS, RETEXTURE_PROMPT_MAX, RETEXTURE_SIZES, retextureRequest, type RetextureModel } from "@/lib/av/model3d";
import { toastError } from "@/lib/refusals";
import { priceLine, useCreate3d, useRunPreview } from "./hooks";
@@ -19,7 +20,20 @@ const SIZE_LABEL: Record<(typeof RETEXTURE_SIZES)[number], string> = { "2k": "2K
* Retexture a finished model: Meshy paints new textures on the same mesh from words or a style picture (the picture wins when
* both are given). Cloud only (fal.ai): no open retexturer runs in ComfyUI here.
*/
-export function RetextureDialog({ glb, open, onOpenChange, cloudAllowed }: { glb: string; open: boolean; onOpenChange: (v: boolean) => void; cloudAllowed: boolean }) {
+export function RetextureDialog({
+ glb,
+ open,
+ onOpenChange,
+ cloudAllowed,
+ keyInstead,
+}: {
+ glb: string;
+ open: boolean;
+ onOpenChange: (v: boolean) => void;
+ cloudAllowed: boolean;
+ /** A visitor on open models only: it runs with its own fal.ai key, and says so (own-setup.ts). */
+ keyInstead?: boolean;
+}) {
const create = useCreate3d();
const [prompt, setPrompt] = useState("");
const [style, setStyle] = useState<{ url: string; preview: string } | null>(null);
@@ -61,9 +75,15 @@ export function RetextureDialog({ glb, open, onOpenChange, cloudAllowed }: { glb
<DialogDescription>The same model with new textures: describe the look, or add a picture of the style. Realistic surface detail — shine, roughness and bumps — is included.</DialogDescription>
</DialogHeader>
{!cloudAllowed ? (
- <p className="rounded-xl bg-muted p-3 text-[13px] text-muted-foreground" role="note">
- Retexturing runs on a cloud model, which isn&apos;t available here.
- </p>
+ keyInstead ? (
+ <OwnSetupNote setup={MODEL3D_KEY} onOpen={() => onOpenChange(false)}>
+ Retexturing runs on Meshy, a cloud model, with your own fal.ai key. You pay fal.ai directly.
+ </OwnSetupNote>
+ ) : (
+ <p className="rounded-xl bg-muted p-3 text-[13px] text-muted-foreground" role="note">
+ Retexturing runs on Meshy, a cloud model: turn on paid models in Settings → Engine mode.
+ </p>
+ )
) : (
<div className="grid gap-3">
<div className="grid gap-1.5">
diff --git a/src/components/model3d/rig-dialog.tsx b/src/components/model3d/rig-dialog.tsx
index d70aed89..c2be0f66 100644
--- a/src/components/model3d/rig-dialog.tsx
+++ b/src/components/model3d/rig-dialog.tsx
@@ -3,12 +3,13 @@
import { Loader2, PersonStanding } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
+import { OwnSetupNote } from "@/components/own-setup";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "@/components/ui/select";
-import { ANIMATION_LIBRARY_URL, ANIMATION_MAX, ANIMATION_PRESETS, animationId, rigRequest } from "@/lib/av/model3d";
+import { ANIMATION_LIBRARY_URL, ANIMATION_MAX, ANIMATION_PRESETS, animationId, MODEL3D_KEY, rigRequest } from "@/lib/av/model3d";
import { toastError } from "@/lib/refusals";
import { priceLine, useCreate3d, useRunPreview } from "./hooks";
@@ -19,7 +20,20 @@ const NUMBER = "number";
* Rig & animate a finished model: Meshy adds a skeleton and walk / run cycles; an animation preset makes the
* animated GLB the card plays. Cloud only (fal.ai): UniRig, the open rigger, has no verified ComfyUI pack.
*/
-export function RigDialog({ glb, open, onOpenChange, cloudAllowed }: { glb: string; open: boolean; onOpenChange: (v: boolean) => void; cloudAllowed: boolean }) {
+export function RigDialog({
+ glb,
+ open,
+ onOpenChange,
+ cloudAllowed,
+ keyInstead,
+}: {
+ glb: string;
+ open: boolean;
+ onOpenChange: (v: boolean) => void;
+ cloudAllowed: boolean;
+ /** A visitor on open models only: it runs with its own fal.ai key, and says so (own-setup.ts). */
+ keyInstead?: boolean;
+}) {
const create = useCreate3d();
const [pick, setPick] = useState<string>("30");
const [typed, setTyped] = useState("");
@@ -49,9 +63,15 @@ export function RigDialog({ glb, open, onOpenChange, cloudAllowed }: { glb: stri
</DialogDescription>
</DialogHeader>
{!cloudAllowed ? (
- <p className="rounded-xl bg-muted p-3 text-[13px] text-muted-foreground" role="note">
- Rigging runs on a cloud model, which isn&apos;t available here.
- </p>
+ keyInstead ? (
+ <OwnSetupNote setup={MODEL3D_KEY} onOpen={() => onOpenChange(false)}>
+ Rigging runs on Meshy, a cloud model, with your own fal.ai key. You pay fal.ai directly.
+ </OwnSetupNote>
+ ) : (
+ <p className="rounded-xl bg-muted p-3 text-[13px] text-muted-foreground" role="note">
+ Rigging runs on Meshy, a cloud model: turn on paid models in Settings → Engine mode.
+ </p>
+ )
) : (
<div className="grid gap-3">
<div className="grid gap-1.5">
diff --git a/src/components/own-setup.tsx b/src/components/own-setup.tsx
index efa784f7..3c6972f0 100644
--- a/src/components/own-setup.tsx
+++ b/src/components/own-setup.tsx
@@ -3,7 +3,8 @@
import { Cpu, KeyRound } from "lucide-react";
import { useCallback } from "react";
import { askToSignUp, CONNECT_GPU_EVENT, useIsOwner, useStatus, type ConnectGpuDetail } from "@/lib/api";
-import { ownSetupDetail, ownSetupLabel, ownSetupOnly, ownSetupShort, ownSetupStep, type OwnSetup, type OwnSetupStep, type OwnSetupViewer } from "@/lib/own-setup";
+import { ownSetupAction, ownSetupDetail, ownSetupLabel, ownSetupOnly, ownSetupShort, ownSetupStep, type OwnSetup, type OwnSetupStep, type OwnSetupViewer } from "@/lib/own-setup";
+import { Button } from "@/components/ui/button";
import { openAddKey } from "@/components/keys/your-keys";
import { cn } from "@/lib/utils";
@@ -62,6 +63,38 @@ export function OwnSetupMark({ setup, className }: { setup: OwnSetup | string |
);
}
+/**
+ * In place of a form a visitor can't run yet (a dialog, a panel): the item's label, one sentence on what it runs with
+ * (or `children`), and the one button that sets it up ("Create a free account", "Add your fal.ai key", "Connect your
+ * GPU"). Just the label for the owner, or a visitor who has the setup (its form shows instead, so this isn't used).
+ */
+export function OwnSetupNote({ setup, children, onOpen, className }: { setup: OwnSetup | string | null | undefined; children?: React.ReactNode; onOpen?: () => void; className?: string }) {
+ const viewer = useOwnSetupViewer();
+ const o = typeof setup === "string" ? ownSetupOnly(setup) : setup;
+ if (!o) return null;
+ const step = ownSetupStep(o, viewer);
+ const action = ownSetupAction(step);
+ return (
+ <div data-slot="own-setup-note" className={cn("flex flex-col items-start gap-2 rounded-xl bg-muted p-3 text-[13px] text-muted-foreground", className)}>
+ <OwnSetupChip setup={o} short={false} />
+ <p>{children ?? ownSetupDetail(o)}</p>
+ {action && (
+ <Button
+ size="sm"
+ variant="secondary"
+ className="rounded-full"
+ onClick={() => {
+ onOpen?.();
+ openOwnSetupStep(step);
+ }}
+ >
+ {action}
+ </Button>
+ )}
+ </div>
+ );
+}
+
/** Who is looking, as own-setup.ts reads it: null for the owner (and on the owner's own install). */
export function useOwnSetupViewer(): OwnSetupViewer | null {
const owner = useIsOwner();
diff --git a/src/components/restore/restore-tool.tsx b/src/components/restore/restore-tool.tsx
index f1eaed7d..15776f14 100644
--- a/src/components/restore/restore-tool.tsx
+++ b/src/components/restore/restore-tool.tsx
@@ -16,9 +16,10 @@ import { ClipBar, ClipDrop, costText, Field, Segmented } from "@/components/shor
import { clipDuration, clipSize, useSourceClip } from "@/components/shorts/use-source-clip";
import { Feed } from "@/components/studio/feed";
import { MediaSlot, type SlotValue } from "@/components/studio/media-slot";
-import { SelfHostNote } from "@/components/self-host-note";
+import { OwnSetupChip, useOwnSetupPress } from "@/components/own-setup";
+import type { OwnSetup } from "@/lib/own-setup";
import { useEngine, useGenerations, useLikelyVisitor } from "@/lib/api";
-import { CLOUD_NOTE, GPU_NOTE, RESTORE, RESTORE_UPSCALE, restoreNegative } from "@/lib/catalog/restore";
+import { CLOUD_NOTE, GPU_NOTE, offlineRestorePrompt, RESTORE, RESTORE_UPSCALE, restoreNegative } from "@/lib/catalog/restore";
import { THEN_UPSCALE } from "@/lib/catalog/upscale-first";
import { chainState } from "@/lib/catalog/shorts";
import { downloadHref, downloadName } from "@/lib/library";
@@ -44,10 +45,15 @@ interface Run {
* to 4K, deinterlacing and a reference picture; priced before it runs ("Free" on your GPU); the result with a before /
* after wipe. A clip handed over from the Library or a result arrives as ?video=.
*/
-export function RestoreTool() {
+export function RestoreTool({ setup }: { setup?: OwnSetup | null } = {}) {
+ // What the page read for "video-tools:restore" (ownSetupsNow): null once its graph is validated, when the label leaves.
+ const item = setup === undefined ? "video-tools:restore" : setup;
const [engine] = useEngine();
- // Guests and free accounts: it plans with the studio's own AI helpers and joins on the server (own-gpu-tool).
+ // Guests and accounts: it runs on the visitor's own GPU or fal.ai key (own-setup.ts "video-tools:restore"). A guest
+ // signs up first, an account without either connects one; the words come from Fuobe's template (the studio's AI
+ // helper is the owner's).
const visitor = useLikelyVisitor();
+ const press = useOwnSetupPress();
const source = useSourceClip(RESTORE.maxBytes);
const clip = source.clip;
const [prompt, setPrompt] = useState("");
@@ -94,9 +100,7 @@ export function RestoreTool() {
const estimate = useRestoreEstimate(body);
const est = estimate.data && !estimate.isError ? estimate.data : undefined;
- const blocker = visitor
- ? "Restore & colourise isn't available here"
- : !clip
+ const blocker = !clip
? "Add a clip"
: clip.error
? clip.error
@@ -114,6 +118,14 @@ export function RestoreTool() {
const write = async () => {
if (!clip) return;
+ if (visitor) {
+ // Fuobe's template, filled with the words given: edit it to fit the footage.
+ const t = offlineRestorePrompt(prompt.trim() || undefined);
+ setPrompt(t.prompt);
+ setNegative(t.negative);
+ setBy("offline");
+ return;
+ }
setWriting(true);
try {
const frames = await grabFrames(clip.preview, duration).catch(() => []);
@@ -131,6 +143,8 @@ export function RestoreTool() {
const start = () => {
if (blocker || !body) return void toast(blocker ?? "Not ready yet", { id: "restore-blocker" });
+ // A visitor without its own GPU or key gets the card that sets one up.
+ if (!press(item)) return;
void runGuard(JSON.stringify(body), (requestId) => actions.run.mutateAsync({ ...body, requestId }))
.then((r) => {
if (!r) return;
@@ -146,13 +160,13 @@ export function RestoreTool() {
};
return (
- <ToolShell title="Video tools" wide selfHostedOnly>
+ <ToolShell title="Video tools" wide>
{!clip && (
<ToolHero
title="Restore & colourise"
- subtitle={`Old scans, tape and black-and-white film back in colour, clean and sharp${visitor ? "." : ", free on your own ComfyUI."}`}
+ subtitle="Old scans, tape and black-and-white film back in colour, clean and sharp, free on your own ComfyUI."
>
- {visitor && <SelfHostNote className="mt-3 max-w-xl">Restore &amp; colourise isn&apos;t available here.</SelfHostNote>}
+ {visitor && <OwnSetupChip setup={item} short={false} className="mt-3" />}
</ToolHero>
)}
<div className={cn("mx-auto", clip ? "pt-4" : "mt-8 max-w-[640px]")}>
@@ -160,8 +174,9 @@ export function RestoreTool() {
<ClipDrop
accept={RESTORE.accept}
limits={LIMITS}
- disabled={visitor}
onFile={(f) => {
+ // A visitor without its own GPU or key sets one up first (its files are kept for runs there).
+ if (!press(item)) return;
const err = source.pick(f);
if (err) toast.error(err);
}}
@@ -241,10 +256,10 @@ export function RestoreTool() {
className="max-h-56 resize-y"
/>
<div className="flex flex-wrap items-center gap-2">
- <Button size="sm" variant="outline" className="rounded-full" onClick={() => void write()} disabled={writing || !clip || visitor}>
+ <Button size="sm" variant="outline" className="rounded-full" onClick={() => void write()} disabled={writing || !clip}>
{writing ? <Loader2 className="size-3.5 animate-spin" /> : <Sparkles className="size-3.5" />} Write it from the frames
</Button>
- <span className="text-[12px] text-muted-foreground">{open ? "A local model that sees pictures" : "Claude"}, else Fuobe&apos;s template · never starts a run</span>
+ <span className="text-[12px] text-muted-foreground">{visitor ? "Fuobe's template" : <>{open ? "A local model that sees pictures" : "Claude"}, else Fuobe&apos;s template</>} · never starts a run</span>
</div>
</Field>
@@ -308,7 +323,7 @@ export function RestoreTool() {
</>
)}
</div>
- <Button className="rounded-full" onClick={start} disabled={!!blocker || actions.run.isPending || visitor}>
+ <Button className="rounded-full" onClick={start} disabled={!!blocker || actions.run.isPending}>
{actions.run.isPending ? <Loader2 className="size-4 animate-spin" /> : <Wand2 className="size-4" />} Restore
</Button>
</div>
diff --git a/src/components/shorts/ui.tsx b/src/components/shorts/ui.tsx
index 93dcfb81..f8700cb7 100644
--- a/src/components/shorts/ui.tsx
+++ b/src/components/shorts/ui.tsx
@@ -172,7 +172,8 @@ export function ClipDrop({
disabled={disabled}
onChange={(e) => {
const f = e.target.files?.[0];
- if (f) onFile(f);
+ // Asked again here too: a file can arrive without the button (a file picker opened another way).
+ if (f && !askFirst()) onFile(f);
e.target.value = "";
}}
/>
diff --git a/src/components/shorts/use-source-clip.ts b/src/components/shorts/use-source-clip.ts
index 7f22b222..549a0ca1 100644
--- a/src/components/shorts/use-source-clip.ts
+++ b/src/components/shorts/use-source-clip.ts
@@ -1,6 +1,7 @@
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
+import { refusalShown } from "@/lib/refusals";
import { postFileWithProgress } from "@/lib/upload";
/**
@@ -85,6 +86,8 @@ export function useSourceClip(maxBytes: number) {
setClip((c) => (c && c.preview === local ? { ...c, url: up.url, uploading: false, progress: 1, info } : c));
} catch (e) {
if ((e as Error).name === "AbortError") return;
+ // Refused with its own card open (sign up, or connect a GPU or key): the slot is empty again, ready for the clip.
+ if (refusalShown(e)) return setClip((c) => (c && c.preview === local ? null : c));
setClip((c) => (c && c.preview === local ? { ...c, uploading: false, error: (e as Error).message } : c));
}
})();
diff --git a/src/components/studio/mode-switch-studio.tsx b/src/components/studio/mode-switch-studio.tsx
index 2bc4956d..78f64107 100644
--- a/src/components/studio/mode-switch-studio.tsx
+++ b/src/components/studio/mode-switch-studio.tsx
@@ -38,6 +38,7 @@ import { RemoveDialogueTool } from "@/components/audio-tools/remove-dialogue-too
import { CleanVoiceTool } from "@/components/audio-tools/clean-voice-tool";
import { DesignVoiceTool } from "@/components/audio-tools/design-voice-tool";
import { SpeechEditTool } from "@/components/audio-tools/speech-edit-tool";
+import { ownSetupsNow } from "@/server/own-setup-live";
import { HubBodySkeleton } from "@/components/skeletons";
import { StudioPage } from "./studio-page";
import type { StudioConfig } from "./studio-context";
@@ -74,14 +75,15 @@ const TOOLS: Partial<Record<HubKind, Record<string, () => React.ReactNode>>> = {
split: () => <SplitSoundtrackTool />,
clean: () => <CleanVoiceTool />,
design: () => <DesignVoiceTool />,
- "edit-speech": () => <SpeechEditTool />,
+ // Their labels follow the GPU's validated graphs (ownSetupsNow): read when the page is made.
+ "edit-speech": () => <SpeechEditTool setup={ownSetupsNow(["audio:edit-speech"])["audio:edit-speech"]} />,
},
"video-tools": {
"remove-object": () => <RemoveObjectTool />,
"remove-person": () => <RemoveObjectTool person />,
"remove-dialogue": () => <RemoveDialogueTool />,
evolution: () => <EvolutionTool />,
- restore: () => <RestoreTool />,
+ restore: () => <RestoreTool setup={ownSetupsNow(["video-tools:restore"])["video-tools:restore"]} />,
captions: () => <CaptionsStudio />,
trim: () => <TrimTool />,
},
diff --git a/src/components/studio/model-picker.tsx b/src/components/studio/model-picker.tsx
index cc9f99d7..6fa8aef6 100644
--- a/src/components/studio/model-picker.tsx
+++ b/src/components/studio/model-picker.tsx
@@ -13,12 +13,13 @@ import { useIsMobile } from "@/hooks/use-mobile";
import { useToday } from "@/hooks/use-today";
import type { Badge as BadgeT } from "@/lib/gpu/types";
import { type Engine, type ModelDef, type Operation } from "@/lib/catalog/types";
-import { useEngineMode, useStatus } from "@/lib/api";
+import { askToSignUp, useEngineMode, useStatus } from "@/lib/api";
import { groupModels, studioBest, toggleIn } from "@/lib/composer";
import { readsBoxes } from "@/lib/layout-prompt";
import { pickerPrice } from "@/lib/model-rows";
import { cn } from "@/lib/utils";
-import { addKeyLabel, billedTo, CLOUD_KEY, needsKey, type CloudProvider } from "@/lib/your-keys";
+import { ownSetupLabel } from "@/lib/own-setup";
+import { addKeyLabel, billedTo, CLOUD_KEY, CLOUD_PROVIDERS, needsKey, type CloudProvider } from "@/lib/your-keys";
import { EngineSwitch } from "./engine-switch";
import { ResponsivePanel } from "./responsive-panel";
import { RECENT_MODELS, STARRED_MODELS, useStoredList } from "./stored-list";
@@ -90,6 +91,7 @@ function ModelRow({
needs,
made,
edits,
+ guest,
}: {
m: ModelDef;
selected: boolean;
@@ -105,6 +107,8 @@ function ModelRow({
gpuName?: string;
/** An account's paid model it has no key for yet: dimmed, "Add your fal.ai key" in place of the price. */
needs?: CloudProvider[] | null;
+ /** A guest: the same row says "Use your own fal.ai key" (choosing it offers a free account first). */
+ guest?: boolean;
/** The active preset's live preview was made with this model. */
made?: boolean;
/** The studio edits clips (Edit video): the price is an edit's, on the seconds in and out (Kling 4.0). */
@@ -152,8 +156,8 @@ function ModelRow({
{needs ? (
// On a phone the short words, so the model's name keeps its room.
<span className="shrink-0 text-right text-[11px] font-medium text-brand-text">
- <span className="sm:hidden">Add key</span>
- <span className="max-sm:hidden">{addKeyLabel(needs[0])}</span>
+ <span className="sm:hidden">{guest ? "Your key" : "Add key"}</span>
+ <span className="max-sm:hidden">{guest ? ownSetupLabel({ need: "key", provider: needs[0] }) : addKeyLabel(needs[0])}</span>
</span>
) : (
<span className="shrink-0 text-right text-[11px] text-muted-foreground tabular-nums">{pickerPrice(m, today, edits)}</span>
@@ -320,15 +324,28 @@ function PickerList({
const viewer = status?.viewer?.kind === "account" ? status.viewer : null;
const keys = viewer ? (viewer.keys ?? []) : null;
const payer = keys?.length && engine === "cloud" ? keys : null;
- // With no key yet it is on open models only: a search lists the paid models it matches too (dimmed), so "nano
- // banana" finds Nano Banana and the way to run it.
- const keyless = !!viewer && !keys?.length && viewer.paidAllowed !== false;
+ // A guest sees them as an account without a key does; choosing one offers a free account first.
+ const guest = status?.viewer?.kind === "guest" && status.viewer.paidAllowed !== false;
+ // With no key yet it is on open models only: the paid models follow, dimmed (a search lists the ones it matches), so
+ // every model shows, with the way to run it.
+ const keyless = (!!viewer && !keys?.length && viewer.paidAllowed !== false) || guest;
const paid = useMemo(
- () => (keyless && q.trim() && !engines.includes("cloud") ? (groupModels({ models, engine: "cloud", engines: ["cloud"], query: q, recent: [], starred: [], best: [] }).groups[0]?.models ?? []) : []),
+ () => (keyless && !engines.includes("cloud") ? (groupModels({ models, engine: "cloud", engines: ["cloud"], query: q, recent: [], starred: [], best: [] }).groups[0]?.models ?? []) : []),
[keyless, q, engines, models],
);
const listed = paid.length ? [...groups, { id: "paid" as const, label: "Paid models · with your own key", models: paid }] : groups;
+ // The key a paid row needs: an account's (needsKey), or for a guest the providers that serve it.
+ const rowNeeds = (m: ModelDef): CloudProvider[] | null => {
+ if (!guest) return needsKey(m, status);
+ if (m.engine === "open") return null;
+ const served = CLOUD_PROVIDERS.filter((p) => m.routes.some((r) => r.provider === p));
+ return served.length ? served : null;
+ };
const pick = (m: ModelDef) => {
+ if (guest && rowNeeds(m)) {
+ onPicked();
+ return askToSignUp("run");
+ }
const needs = needsKey(m, status);
if (needs && onNeedsKey) return onNeedsKey(m, needs[0]);
onChange(m);
@@ -367,9 +384,22 @@ function PickerList({
<span aria-hidden>·</span>
<span className="min-w-0">
Paid models like Nano Banana and Kling need your own fal.ai or Replicate key ·{" "}
- <button type="button" onClick={addKey} className="text-brand-text underline underline-offset-2">
- Add a key
- </button>
+ {guest ? (
+ <button
+ type="button"
+ onClick={() => {
+ onPicked();
+ askToSignUp("run");
+ }}
+ className="text-brand-text underline underline-offset-2"
+ >
+ Create a free account
+ </button>
+ ) : (
+ <button type="button" onClick={addKey} className="text-brand-text underline underline-offset-2">
+ Add a key
+ </button>
+ )}
</span>
</>
)
@@ -398,7 +428,7 @@ function PickerList({
value={`${g.id}:${m.id}`}
onSelect={() => pick(m)}
data-checked={value?.id === m.id}
- aria-label={needsKey(m, status) ? `${m.name} needs your ${CLOUD_KEY[needsKey(m, status)![0]].label} key` : undefined}
+ aria-label={rowNeeds(m) ? `${m.name} needs your ${CLOUD_KEY[rowNeeds(m)![0]].label} key` : undefined}
className={cn("gap-2.5 rounded-lg px-2 py-1.5 [&>svg:last-child]:hidden", value?.id === m.id && "bg-brand-faint data-selected:bg-brand-faint-hover")}
>
<ModelRow
@@ -411,7 +441,8 @@ function PickerList({
onStar={() => setStarred((s) => toggleIn(s, m.id))}
gpu={m.engine === "open" ? badgeFor(badges, { modelId: m.id }) : null}
gpuName={badges?.gpu}
- needs={needsKey(m, status)}
+ needs={rowNeeds(m)}
+ guest={guest}
made={m.id === madeWith}
edits={editsClips}
/>
diff --git a/src/lib/av/model3d.ts b/src/lib/av/model3d.ts
index fe41d4b4..97696149 100644
--- a/src/lib/av/model3d.ts
+++ b/src/lib/av/model3d.ts
@@ -1,4 +1,5 @@
import type { Engine, Generation, GenerationRequest, OutputFile } from "@/lib/catalog/types";
+import type { OwnSetup } from "@/lib/own-setup";
import { PATH_FRAMES, keyAt } from "@/lib/camera-path";
import { exactOrbitKeys, type ExactOrbit } from "@/lib/exact-orbit";
@@ -108,6 +109,9 @@ export const MODEL3D_SETUPS = {
} as const;
export type Model3dSetupKey = keyof typeof MODEL3D_SETUPS;
+/** Image to 3D's cloud models (Meshy, Tripo, SAM 3D Objects, Idol 3D in the cloud) for a visitor: its own fal.ai key. */
+export const MODEL3D_KEY: OwnSetup = { need: "key", provider: "fal" };
+
/**
* Where "Build the final with TRELLIS.2" goes from a finished Idol 3D result on the open engine: Image to 3D with
* TRELLIS.2 picked and the result's own picture filled in. null on any other result, without the picture, or when
diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.ts
index 7218f239..feefd0a2 100644
--- a/src/lib/catalog/canvas.ts
+++ b/src/lib/catalog/canvas.ts
@@ -1629,8 +1629,8 @@ export function describeNode(graph: CanvasGraph, n: CanvasNode, ctx: DescribeCon
costUsd: null,
error:
mode === "open"
- ? `${model.name} is a cloud model, which isn't available here. Pick an open-source model`
- : `${model.name} is an open-source model, which isn't available here. Pick a cloud model`,
+ ? `${model.name} is a cloud model: pick an open-source model`
+ : `${model.name} is an open-source model: pick a cloud model`,
};
}
const built = buildRequest(graph, n, model);
diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.ts
index 002b46d1..edea8c09 100644
--- a/src/lib/catalog/cinema.ts
+++ b/src/lib/catalog/cinema.ts
@@ -1420,13 +1420,13 @@ function fitParams(model: ModelDef, input: CinemaGenerateInput, notes: string[],
const tier = videoTier(tiers, res)!;
params.resolution = tier;
if (tier.toLowerCase() !== res.toLowerCase()) {
- notes.push(tierHeight(tier)! < tierHeight(res)! ? `${model.name} renders up to ${tier} here` : `${model.name} renders at ${tier} here`);
+ notes.push(tierHeight(tier)! < tierHeight(res)! ? `${model.name} renders up to ${tier}` : `${model.name} renders at ${tier}`);
}
} else {
const order = kind === "video" ? VIDEO_RESOLUTIONS : [...IMAGE_RESOLUTIONS, "0.5K", "1.5K", "720p", "1080p"];
const below = tiers.filter((r) => order.indexOf(r) <= order.indexOf(res) && order.indexOf(r) >= 0);
params.resolution = below.sort((a, b) => order.indexOf(b) - order.indexOf(a))[0] ?? tiers[0];
- notes.push(`${model.name} renders up to ${params.resolution} here`);
+ notes.push(`${model.name} renders up to ${params.resolution}`);
}
}
if (kind === "video" && model.engine === "open" && typeof params.resolution === "string" && params.resolution.toLowerCase() === "2k") notes.push(H3_2K_OPEN_NOTE);
diff --git a/src/lib/catalog/regenerate.ts b/src/lib/catalog/regenerate.ts
index c2b4d8b7..675e81c3 100644
--- a/src/lib/catalog/regenerate.ts
+++ b/src/lib/catalog/regenerate.ts
@@ -398,16 +398,20 @@ export const REGEN_COPY = {
missingVisitor: "Your ComfyUI doesn't have Open-H3 Regenerate yet. Add it with Fuobe's ComfyUI setup, then run this again.",
/** The refusal when Settings → Models & licences has the refiner switched off. */
off: "Pick Restore · faithful to sharpen this clip.",
- /** The owner's refusals while Regenerate is held on this studio's GPUs (REGEN_OFFERED off); a visitor runs it on its own GPU (server/own-setup-run.ts). */
- held: "Regenerate isn't available yet. Pick Restore · faithful to sharpen the clip instead.",
+ /**
+ * The owner's answers while Regenerate is held on this studio's GPUs (REGEN_OFFERED off): what it needs, and what runs
+ * instead. The owner sees these surfaces as visitors do (labelled "Runs on your own GPU · 48 GB"); a visitor runs it on
+ * its own GPU (server/own-setup-run.ts).
+ */
+ held: "Regenerate needs a GPU with 48 GB or more. Pick Restore · faithful to sharpen the clip instead.",
/** MiniMax H3 at 2K on your GPU, whose takes it finishes. */
- heldTwoK: "MiniMax H3 in 2K isn't available on your GPU yet. Pick 768p, or make it in the cloud.",
+ heldTwoK: "MiniMax H3 in 2K needs a GPU with 48 GB or more. Pick 768p, or make it in the cloud.",
/** Enhance (H3 regenerate) on an Edit video result or a Shorts segment. */
- heldEnhance: "Enhance (H3 regenerate) isn't available yet.",
+ heldEnhance: "Enhance (H3 regenerate) needs a GPU with 48 GB or more.",
/** Finish in 2K on a take from your GPU (a cloud take still re-renders at 2K). */
- heldFinish: "Finish in 2K isn't available for a take from your GPU yet.",
+ heldFinish: "Finish in 2K on a take from your GPU needs a GPU with 48 GB or more.",
/** Faceless's Regenerate to 1080p. */
- heldEpisode: "Regenerate to 1080p isn't available yet. Pick Upscale to 1080p instead.",
+ heldEpisode: "Regenerate to 1080p needs a GPU with 48 GB or more. Pick Upscale to 1080p instead.",
gpuOnly: "Runs on your GPU (open source)",
prompt: "Describe the clip: what is in it, how it moves, the light. Regenerate redraws it from these words",
/** A 2K finish whose draft's saved copy is gone from the GPU (a retry redraws the draft's clip instead). */
diff --git a/src/lib/guest-access.ts b/src/lib/guest-access.ts
index 2a841e5a..8fc61f3d 100644
--- a/src/lib/guest-access.ts
+++ b/src/lib/guest-access.ts
@@ -312,6 +312,9 @@ export const ACCOUNT_TOOL_RUNS: readonly RegExp[] = [
// Translate & dub: a dub, and voicing one language of the account's own dub (src/server/dub.ts).
/^\/api\/audio-tools$/,
/^\/api\/dub(\/[^/]+\/voice)?$/,
+ // Restore & colourise: its windows or pieces and their join on the account's own GPU or fal.ai key, with Fuobe's
+ // offline template for the words when none are given (the studio's AI helper stays the owner's: /api/restore/prompt).
+ /^\/api\/restore$/,
];
/**
@@ -323,9 +326,9 @@ export const ACCOUNT_TOOL_RUNS: readonly RegExp[] = [
export const ACCOUNT_PROJECT_ROUTES: RegExp[] = [
// Character Swap Studio: the list, a project, its prices, its decisions, and stopping its jobs.
/^\/api\/swap-studio\/projects(\/[^/]+(\/(decisions|estimate|stop|takes\/stop))?)?$/,
- // Shorts Studio: its own sessions (start one, a new take, stitch again, pick a take, rename, delete) and its own
- // presets. Enhance isn't here: it isn't offered on an account's own GPU yet.
- /^\/api\/shorts\/sessions(\/[^/]+(\/stitch|\/segments\/[^/]+(\/primary)?)?)?$/,
+ // Shorts Studio: its own sessions (start one, a new take, Enhance a take on its own GPU, stitch again, pick a take,
+ // rename, delete) and its own presets.
+ /^\/api\/shorts\/sessions(\/[^/]+(\/stitch|\/segments\/[^/]+(\/(primary|enhance))?)?)?$/,
/^\/api\/shorts\/presets(\/[^/]+)?$/,
// Cinema Studio: its projects, folders, takes, grid tiles and AI Director chat (the Director's built-in breakdown:
// no AI helper, GPU or key), and a ready film made as its own project (src/server/cinema.ts).
@@ -342,9 +345,9 @@ export const ACCOUNT_PROJECT_ROUTES: RegExp[] = [
// Faceless Studio, the Explainer and Content Factory: their own channels, episodes, explainers and series, their topic
// ideas, documents and narrator samples, and their runs (renders, retries, changes, upscales, avatars, readings), each
// checked by the route on its own GPU or key (src/server/faceless.ts, content-factory.ts). "Generate in Claude" isn't
- // here (it hands the brief to the studio's own MCP server), nor "Regenerate to 1080p" (held with Open-H3 Regenerate),
- // nor reading a link (the server never fetches a link for an account: it uploads the file or pastes the words).
- /^\/api\/faceless\/(channels(\/[^/]+(\/avatar)?)?|episodes(\/[^/]+(\/(render|retry|rewrite|undo|upscale|change))?)?|topics|voices\/preview)$/,
+ // here (it hands the brief to the studio's own MCP server), nor reading a link (the server never fetches a link for an
+ // account: it uploads the file or pastes the words). "Regenerate to 1080p" runs on the account's own GPU only.
+ /^\/api\/faceless\/(channels(\/[^/]+(\/avatar)?)?|episodes(\/[^/]+(\/(render|retry|rewrite|undo|upscale|regenerate|change))?)?|topics|voices\/preview)$/,
/^\/api\/explainer(\/document)?$/,
/^\/api\/content-factory\/series(\/[^/]+(\/(episodes|generate|read))?)?$/,
/^\/api\/starters\/faceless\.[^/]+$/,
diff --git a/src/lib/hubs.ts b/src/lib/hubs.ts
index a5331c42..c327e60b 100644
--- a/src/lib/hubs.ts
+++ b/src/lib/hubs.ts
@@ -54,7 +54,7 @@ export const HUB_MODES: Record<HubKind, HubMode[]> = {
{ id: "remove-dialogue", label: "Remove dialogue" },
{ id: "remove-person", label: "Remove a person" },
{ id: "evolution", label: "Evolution" },
- { id: "restore", label: "Restore & colourise", ownerOnly: true, selfHostedOnly: true },
+ { id: "restore", label: "Restore & colourise", ownSetup: "video-tools:restore" },
{ id: "relight", label: "Relight" },
{ id: "depth", label: "Depth map" },
{ id: "captions", label: "Captions" },
diff --git a/src/lib/nav-search.ts b/src/lib/nav-search.ts
index b0e56600..fdc57536 100644
--- a/src/lib/nav-search.ts
+++ b/src/lib/nav-search.ts
@@ -112,7 +112,7 @@ export const INTENTS: readonly Intent[] = [
{
id: "restore",
triggers: ["restore", "restoration", "old photo", "old picture", "damaged", "scratched", "faded", "colorize", "colourise", "colorise", "colourize", "black and white"],
- targets: ["app-restore-photo", "app-colorize", "upscale", "video-tools"],
+ targets: ["app-restore-photo", "app-colorize", "video-tools-restore", "upscale", "video-tools"],
},
{ id: "logo", triggers: ["logo", "wordmark", "lettering", "typography", "font", "signage"], targets: ["image", "app-text-edit", "ads"] },
{
diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.ts
index 6da58a58..689c173a 100644
--- a/src/lib/output-actions.ts
+++ b/src/lib/output-actions.ts
@@ -117,9 +117,6 @@ export interface ActionContext {
/** A draft's one-tap 1080p render: a new paid run, said before the tap (left out while placeholders are on). */
export const draftRenderPaid = (placeholders: boolean | undefined): string => (placeholders ? "" : " · paid");
-/** Hand-offs to tools a guest or an account can't open (they run on a self-hosted Fuobe only). */
-const OWNER_ONLY_ACTIONS: ReadonlySet<OutputActionId> = new Set<OutputActionId>(["restore-video"]);
-
const q = (url: string) => encodeURIComponent(url);
/** Image to 3D → Splat on Idol 3D's Quick look with a picture in the slot (the link Image to 3D reads: readModel3dLink). */
@@ -146,7 +143,7 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =
}
const out: OutputAction[] = [];
const link = (id: OutputActionId, label: string, href: string, placement: OutputAction["placement"] = "menu") => {
- if (!(ctx.visitor && OWNER_ONLY_ACTIONS.has(id))) out.push({ id, label, href, placement });
+ out.push({ id, label, href, placement });
};
// A Kinetic Motion result (a clip, a frame, a contact sheet or a version) opens its recipe in the Kinetic editor.
// A visitor opens only their own (an owner's result shown on a public page would not open for them).
@@ -193,8 +190,9 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =
link("reframe", "Reframe", `/reframe?video=${q(o.url)}`);
link("lipsync", "Lipsync", `/lipsync?video=${q(o.url)}`);
link("upscale", "Upscale", `/upscale/video?video=${q(o.url)}`);
- // Old, faded or black-and-white footage (Fuobe Restore): Video tools → Restore & colourise with the clip in.
- link("restore-video", "Restore & colourise", `/video-tools/restore?video=${q(o.url)}`);
+ // Old, faded or black-and-white footage (Fuobe Restore): Video tools → Restore & colourise with the clip in. It runs
+ // on the viewer's own GPU or fal.ai key (own-setup.ts), and says so.
+ out.push({ id: "restore-video", label: "Restore & colourise", href: `/video-tools/restore?video=${q(o.url)}`, placement: "menu", ownSetup: "video-tools:restore" });
// A mask or clean foreground from Remove background or Green screen: on to ProRes 4444 or EXR for the edit (Export runs on
// your GPU). A cut-out isn't offered: Export would drop its transparency (src/lib/av/keying.ts).
if (ctx.engineMode !== "cloud" && exportsCleanly(g.op, g.request?.params)) link("export-pro", "Export as ProRes or EXR", `/upscale/export?video=${q(o.url)}&format=prores_4444`);
diff --git a/src/lib/own-setup.ts b/src/lib/own-setup.ts
index 6c2d35ae..6649d964 100644
--- a/src/lib/own-setup.ts
+++ b/src/lib/own-setup.ts
@@ -92,10 +92,12 @@ const ITEMS: Record<string, Entry> = {
"image-to-3d:idol-other-sides": { setup: gpu(8, { files: true }), graphs: ["image-to-views-idol"] },
"image-to-3d:idol-clean": { setup: gpu(8, { files: true }), graphs: ["image-to-splat-idol-clean"] },
// Tools whose steps run on a GPU of the visitor's own.
- "audio:edit-speech": { setup: gpu(24, { files: true }) },
- "video-tools:restore": { setup: gpu(24, { files: true, orKey: "fal" }) },
- "video-tools:remove-person": { setup: gpu(24) },
- "video-tools:remove-object-void": { setup: gpu(40) },
+ "audio:edit-speech": { setup: gpu(24, { files: true }), graphs: ["speech-edit-auk"] },
+ "video-tools:restore": { setup: gpu(24, { files: true, orKey: "fal" }), graphs: ["video-restore-ltx25-tiled"] },
+ // Validated on this studio's GPU already (their graphs): no label shows once a surface reads ownSetupsNow, and none
+ // asks for them on the client.
+ "video-tools:remove-person": { setup: gpu(24), graphs: ["video-person-remove-h3-relay", "video-person-remove-h3-mask"] },
+ "video-tools:remove-object-void": { setup: gpu(40), graphs: ["video-erase-void"] },
"cinema:world": { setup: gpu(24, { files: true }) },
"oss-hy-nomas-world": { setup: gpu(24, { files: true }) },
};
@@ -121,8 +123,11 @@ export function ownSetupFor(m: Pick<ModelDef, "id" | "engine" | "engines" | "rou
/**
* What an item needs to run on a visitor's own setup, or null when it runs as any other. `engine`: the side of a Fuobe
- * Original asked for. Never null for an item here until it passes (`passes`) or leaves the untested list: the hosted
- * runs never place one of these on this studio's GPUs or keys.
+ * Original asked for. Never null for an item here until it passes (`passes`) or leaves the untested list. It can't read
+ * the manifest (it runs in the browser too), so an item with `graphs` keeps its setup here even once they are
+ * validated: a server check (the hosted runs' pool gate) asks ownSetupOnlyNow in src/server/own-setup-live.ts, which
+ * reads them. Nothing in the pool enforces this table yet: hosted runs are off (FUOBE_HOSTED_RUNS), and the gate is the
+ * hosted runs' to add.
*/
export function ownSetupOnly(modelOrAppId: string, engine?: Engine): OwnSetup | null {
const item = ITEMS[modelOrAppId];
@@ -210,3 +215,17 @@ export function ownSetupStep(o: OwnSetup | null, viewer: OwnSetupViewer | null |
if (viewer.gpu?.connected || (o.orKey && keys.includes(o.orKey))) return { kind: "run" };
return { kind: "connect-gpu", gpuOnly: !o.orKey };
}
+
+/** The words on the button that opens a step: "Create a free account", "Add your fal.ai key", "Connect your GPU"; none for `run`. */
+export function ownSetupAction(step: OwnSetupStep): string | null {
+ switch (step.kind) {
+ case "sign-up":
+ return "Create a free account";
+ case "add-key":
+ return `Add your ${keyName(step.provider)} key`;
+ case "connect-gpu":
+ return "Connect your GPU";
+ default:
+ return null;
+ }
+}
diff --git a/src/lib/scene-props.ts b/src/lib/scene-props.ts
index 787795dd..012a0af8 100644
--- a/src/lib/scene-props.ts
+++ b/src/lib/scene-props.ts
@@ -194,13 +194,14 @@ export interface PropMakerStatus {
/**
* Why "Make a prop from a picture" (Idol 3D on your GPU, open source; Idol has no hosted route for this) can't run
- * here, or null when it can. The same rule as src/lib/connections.ts make3dOffered (Idol 3D on the open engine):
- * visitors make no 3D yet, Paid APIs only leaves the open engine out, the model can be off, and the GPU must be
+ * here, or null when it can. The same rule as src/lib/connections.ts make3dOffered (Idol 3D on the open engine): a
+ * guest or an account makes it on its own GPU (the press asks a guest to sign up, an account without a GPU to connect
+ * one: own-setup.ts), Paid APIs only leaves the open engine out, the model can be off, and the owner's GPU must be
* connected (or placeholder results on). A splat already in the Library can be placed either way.
*/
export function propMakerBlocker(s: PropMakerStatus | undefined): string | null {
if (!s) return "Checking what runs here…";
- if (s.viewer) return "Making a prop from a picture isn't available on your account yet. You can place 3D results you already have.";
+ if (s.viewer) return s.idolOn ? null : "Make a splat in Image to 3D → Splat, then place it here from your Library.";
if (s.engineMode === "cloud") return "Making a prop from a picture runs Idol 3D on your GPU (open source), which Paid APIs only leaves out. You can still place splats from your Library.";
if (!s.idolOn) return "Idol 3D is turned off in Settings → Models & licences. Turn it on there to make props from pictures.";
if (s.demoMode !== "on" && !s.providers?.comfyui?.configured && !s.ownerGpu) return "Connect ComfyUI in Settings to make props from pictures on your GPU.";
diff --git a/src/lib/upload.ts b/src/lib/upload.ts
index 2fa043ab..3b889b87 100644
--- a/src/lib/upload.ts
+++ b/src/lib/upload.ts
@@ -1,4 +1,4 @@
-import type { Asset } from "@/lib/api";
+import { CONNECT_GPU_EVENT, GUEST_PROMPT_EVENT, refusalCard, type Asset, type ConnectGpuDetail } from "@/lib/api";
import { KINETIC_UPLOAD_HEADER } from "@/lib/guest-access";
import { responseError } from "@/lib/refusals";
@@ -35,8 +35,17 @@ export function postFileWithProgress(file: File, onProgress: (p: number) => void
xhr.upload.onprogress = (e) => e.lengthComputable && onProgress(e.loaded / e.total);
xhr.onload = () => {
const body = xhr.response as { url?: string; name?: string; error?: string } | null;
- if (xhr.status >= 200 && xhr.status < 300 && body?.url) resolve({ url: body.url, name: body.name });
- else reject(new Error(body?.error ?? "That upload didn't go through. Please try again."));
+ if (xhr.status >= 200 && xhr.status < 300 && body?.url) return resolve({ url: body.url, name: body.name });
+ const err = new Error(body?.error ?? "That upload didn't go through. Please try again.");
+ // A guest's upload (401 x-fuobe-guest) or an account's with no GPU or key of its own (403 x-fuobe-connect-gpu):
+ // the card that sets it up opens, as for a fetch (watchGuestRefusals), and the error says it's shown.
+ const guest = xhr.status === 401 && xhr.getResponseHeader("x-fuobe-guest") === "1";
+ const gpu = xhr.status === 403 && xhr.getResponseHeader("x-fuobe-connect-gpu") === "1";
+ if ((guest || gpu) && typeof window !== "undefined" && refusalCard(guest ? "guest" : "gpu", window.location)) {
+ window.dispatchEvent(new CustomEvent<ConnectGpuDetail>(guest ? GUEST_PROMPT_EVENT : CONNECT_GPU_EVENT, { detail: { action: "upload" } }));
+ Object.assign(err, { refusalShown: true });
+ }
+ reject(err);
};
xhr.onerror = () => reject(new Error("Upload failed — check your connection"));
xhr.onabort = () => reject(new DOMException("Aborted", "AbortError"));
diff --git a/src/server/faceless.ts b/src/server/faceless.ts
index 13dd4e75..afcb9c66 100644
--- a/src/server/faceless.ts
+++ b/src/server/faceless.ts
@@ -1376,10 +1376,9 @@ export function upscaleToolSteps(id: string): { request: GenerationRequest; deps
/** "Regenerate to 1080p" on this episode: offered on the open engine once the film is done (null otherwise). */
function regenerateOffer(ep: FacelessEpisode, scenes: number): EpisodeView["regenerate"] {
const modelId = ENGINE_MODELS[ep.settings.engine].regenerate;
- // Open-H3 Regenerate needs a 48 GB card: offered with its label (own-setup.ts "regenerate:faceless"); a run goes to
- // the owner's GPU only once it is offered (regenerateEpisode). An account's episodes don't have it yet: its route
- // isn't one of an account's tool runs (src/lib/guest-access.ts).
- if (!modelId || !getModel(modelId) || tenantAccount()) return null;
+ // Open-H3 Regenerate needs a 48 GB card: offered with its label (own-setup.ts "regenerate:faceless"); an account's run
+ // goes to its own GPU only (regenerateEpisode), the owner's once it is offered.
+ if (!modelId || !getModel(modelId)) return null;
let demo = false;
try {
demo = runsAsDemo(modelId, "upscale-video");
@@ -1389,6 +1388,31 @@ function regenerateOffer(ep: FacelessEpisode, scenes: number): EpisodeView["rege
return { scenes, demo };
}
+const REGENERATE_OPEN_ONLY = "Regenerate runs on your GPU (open source): switch the episode to open source to use it";
+const REGENERATE_WAIT = "Wait for the episode to finish first";
+
+/** Regenerate to 1080p has run on this episode, or is running. */
+function regeneratedAlready(ep: FacelessEpisode): boolean {
+ const had = ep.plan?.regenerated ? getGeneration(ep.plan.regenerated.final) : null;
+ return !!had && had.status !== "failed" && had.status !== "canceled";
+}
+
+/** What "Regenerate to 1080p" would run (an account's run is checked with it first): none once it has run or is running. */
+export function regenerateToolSteps(id: string): { request: GenerationRequest; deps: number }[] {
+ const ep = mustEpisode(id);
+ if (!ENGINE_MODELS[ep.settings.engine].regenerate) throw new FacelessError(REGENERATE_OPEN_ONLY, 422);
+ if (!ep.plan || !finalOf(ep)) throw new FacelessError(REGENERATE_WAIT, 409);
+ if (regeneratedAlready(ep)) return [];
+ const models = resolveModels(withOfferedVideo(ep.settings), narrationText(ep.script.blocks).length, getModel);
+ let plan: ReturnType<typeof regeneratePlan>;
+ try {
+ plan = regeneratePlan(currentGraph(ep), { engine: ep.settings.engine, joinMax: models.joinMax, lookup: getModel });
+ } catch (e) {
+ throw new FacelessError((e as Error).message, 422);
+ }
+ return plan.steps.map((s) => ({ request: { ...s.request, ...(s.chain && { chain: s.chain }) }, deps: s.after?.length ?? 0 }));
+}
+
/**
* "Regenerate to 1080p": every scene redrawn by Open-H3 Regenerate (RIFE first for a 16 fps clip), joined at 1080p, with
* the episode's own narration, music bed and subtitles put back on (regeneratePlan). Runs on your GPU only; the finished
@@ -1396,15 +1420,15 @@ function regenerateOffer(ep: FacelessEpisode, scenes: number): EpisodeView["rege
*/
export function regenerateEpisode(id: string): FacelessEpisode {
const ep = mustEpisode(id);
+ // Made or making already: the episode as it is (before any gate: nothing new runs).
+ if (regeneratedAlready(ep)) return ep;
// Open-H3 Regenerate needs a 48 GB card: an account runs it on its own GPU when that GPU fits it (own-setup-run.ts),
// never on this studio's. The owner's waits until it has run on a card that fits it (REGEN_OFFERED): nothing is made.
if (tenant()) ownSetupGate("regenerate:faceless");
else if (!REGEN_OFFERED) throw new FacelessError(REGEN_COPY.heldEpisode, 422);
- if (!ENGINE_MODELS[ep.settings.engine].regenerate) throw new FacelessError("Regenerate runs on your GPU (open source): switch the episode to open source to use it", 422);
+ if (!ENGINE_MODELS[ep.settings.engine].regenerate) throw new FacelessError(REGENERATE_OPEN_ONLY, 422);
const final = finalOf(ep);
- if (!ep.plan || !final) throw new FacelessError("Wait for the episode to finish first", 409);
- const had = ep.plan.regenerated ? getGeneration(ep.plan.regenerated.final) : null;
- if (had && had.status !== "failed" && had.status !== "canceled") return ep;
+ if (!ep.plan || !final) throw new FacelessError(REGENERATE_WAIT, 409);
const graph = currentGraph(ep);
const models = resolveModels(withOfferedVideo(ep.settings), narrationText(ep.script.blocks).length, getModel);
let plan: ReturnType<typeof regeneratePlan>;
diff --git a/src/server/h3-gpu.ts b/src/server/h3-gpu.ts
index a2ea5e97..e1602f7d 100644
--- a/src/server/h3-gpu.ts
+++ b/src/server/h3-gpu.ts
@@ -84,7 +84,7 @@ export function h3Gpu(endpoint: string, extra: Record<string, unknown>, has: (id
const model = H3_TIER_MODEL[choice.tier];
if (!isOffered(model, "open")) {
if (asked !== choice.tier) return { gpuTier: "standard" };
- throw new Error(tenantAccount() ? `${choice.label.replace(/ \(.*\)$/, "")} isn't available here. Pick 32 GB or more` : offReason(getModel(model)!));
+ throw new Error(tenantAccount() ? `Pick 32 GB or more for ${choice.label.replace(/ \(.*\)$/, "")}` : offReason(getModel(model)!));
}
// (Options → Decoder has become the file it loads by now: controlSets in src/lib/catalog/plan.ts.)
const notes = [TIER_NOTES[choice.tier], ...(extra.quality === "best" ? [TIER_BEST_NOTE] : []), ...(extra.vae === SOL_VAE ? [TIER_DECODER_NOTE] : [])];
diff --git a/src/server/own-setup-live.ts b/src/server/own-setup-live.ts
index f13857f6..05570f44 100644
--- a/src/server/own-setup-live.ts
+++ b/src/server/own-setup-live.ts
@@ -2,6 +2,7 @@ import "server-only";
import fs from "node:fs";
import path from "node:path";
import { getModel } from "@/lib/catalog";
+import type { Engine } from "@/lib/catalog/types";
import { ownSetupGraphs, ownSetupOnly, type OwnSetup } from "@/lib/own-setup";
const MANIFEST = path.join(process.cwd(), "workflows", "comfyui", "manifest.json");
@@ -28,6 +29,19 @@ export function graphsReady(modelId: string, manifest = MANIFEST): boolean {
return graphs.every((g) => validated.has(g));
}
+/**
+ * ownSetupOnly as it stands now, for a server check (the hosted runs' pool gate, a price check): an item whose graphs
+ * the manifest marks validated runs as any other (null); everything else is ownSetupOnly's answer.
+ */
+export function ownSetupOnlyNow(id: string, engine?: Engine, manifest = MANIFEST): OwnSetup | null {
+ const graphs = ownSetupGraphs(id);
+ if (graphs.length) {
+ const validated = validatedGraphs(manifest);
+ if (graphs.every((g) => validated.has(g))) return null;
+ }
+ return ownSetupOnly(id, engine);
+}
+
/**
* The setups of these own-setup items as they stand now, by id: an item whose graphs (own-setup.ts `graphs`) the
* manifest marks validated has none (null), so its label leaves without a code change; any other keeps ownSetupOnly's.
diff --git a/src/server/qwen21-gpu.ts b/src/server/qwen21-gpu.ts
index c18253cd..373e3e64 100644
--- a/src/server/qwen21-gpu.ts
+++ b/src/server/qwen21-gpu.ts
@@ -51,7 +51,7 @@ export function qwen21Gpu(endpoint: string, extra: Record<string, unknown>, has:
if (asked === "large") return { gpu: "large" };
const on = isOffered(QWEN21_SMALL_MODEL, "open");
if (asked === "small") {
- if (!on) throw new Error(tenantAccount() ? "Small GPU isn't available here. Pick 20 GB or more" : offReason(getModel(QWEN21_SMALL_MODEL)!));
+ if (!on) throw new Error(tenantAccount() ? "Pick 20 GB or more for this model" : offReason(getModel(QWEN21_SMALL_MODEL)!));
return { gpu: "small", note: SMALL_GPU_NOTE };
}
return on && smallFits(graph) ? { gpu: "small", note: SMALL_GPU_NOTE } : { gpu: "large" };
diff --git a/src/server/restore.ts b/src/server/restore.ts
index f05acb6a..3e78fc12 100644
--- a/src/server/restore.ts
+++ b/src/server/restore.ts
@@ -20,7 +20,7 @@ import {
type Size,
} from "@/lib/catalog/restore";
import type { PlanStep } from "@/lib/catalog/shorts";
-import type { Engine, Generation } from "@/lib/catalog/types";
+import type { Engine, Generation, GenerationRequest } from "@/lib/catalog/types";
import { ACCESS_PLACE } from "@/lib/model-access";
import { createPipeline } from "./chains";
import { llmText, llmTextBackend } from "./enhance";
@@ -267,8 +267,21 @@ export function estimateRestore(body: z.infer<typeof RestoreEstimateSchema>): Re
};
}
-/** Start the run; a run with no prompt gets one written first. Returns the finished video's generation and the words used. */
-export async function createRestore(body: z.infer<typeof RestoreBodySchema>): Promise<{ final: Generation; items: Generation[]; prompt: string; negative: string; by: PromptAnswer["by"] | "you" }> {
+/** A run planned (the clip's header read, the words written when none were given), not started yet. */
+export interface RestoreRun {
+ steps: PlanStep[];
+ final: string;
+ prompt: string;
+ negative: string;
+ by: PromptAnswer["by"] | "you";
+}
+
+/**
+ * Plan the run; a run with no prompt gets one written first. An account's words come from Fuobe's offline template
+ * (the studio's AI helpers are the owner's), and its run is checked step by step before anything starts
+ * (src/server/account-tool-run.ts).
+ */
+export async function planRestoreRun(body: z.infer<typeof RestoreBodySchema>): Promise<RestoreRun> {
mustMatchMode(body.engine);
mustBeOffered(body.engine);
const info = await probeSource(body.source.url);
@@ -278,7 +291,7 @@ export async function createRestore(body: z.infer<typeof RestoreBodySchema>): Pr
// Refused before the writer is asked (a clip too long, 4K in the cloud).
if (!prompt) planInput(body, info, "the scene, natural colour", true);
if (!prompt) {
- const written = await writeRestorePrompt({ engine: body.engine, hint: body.hint, frames: [], seconds: info.duration ?? body.source.duration });
+ const written = tenant() ? { ...offlineRestorePrompt(body.hint), by: "offline" as const } : await writeRestorePrompt({ engine: body.engine, hint: body.hint, frames: [], seconds: info.duration ?? body.source.duration });
prompt = written.prompt;
negative ||= written.negative;
by = written.by;
@@ -289,13 +302,27 @@ export async function createRestore(body: z.infer<typeof RestoreBodySchema>): Pr
// a copy to send (a live one on fal, or the file on this machine), every piece would fail at submit, so the run is
// refused before anything starts (a placeholder run needs no file).
if (body.engine === "cloud" && !gatedReady("cloud") && !price(plan.steps).demo) {
+ if (tenant()) throw new ShortsError("Restore this clip on your own GPU: switch to open source.", 422);
throw new ShortsError(`${gatedHint("Lightricks' Restore IC-LoRA", RESTORE.loras.restore.page)}. A cloud run gets Fuobe's copy of the file, never your token`, 422);
}
+ return { steps: plan.steps, final: plan.final, prompt, negative: input.negative, by };
+}
+
+/** A planned run's steps, for an account's checks. */
+export const restoreSteps = (r: RestoreRun): { request: GenerationRequest; deps: number }[] => r.steps.map((s) => ({ request: withChain(s), deps: s.after?.length ?? 0 }));
+
+/** Start a planned run: the finished video's generation, every step, and the words used. */
+export function startRestore(r: RestoreRun): { final: Generation; items: Generation[]; prompt: string; negative: string; by: PromptAnswer["by"] | "you" } {
let p: ReturnType<typeof createPipeline>;
try {
- p = createPipeline(plan.steps);
+ p = createPipeline(r.steps);
} catch (e) {
throw new ShortsError((e as Error).message, 422);
}
- return { final: p.byKey[plan.final], items: p.items, prompt, negative: input.negative, by };
+ return { final: p.byKey[r.final], items: p.items, prompt: r.prompt, negative: r.negative, by: r.by };
+}
+
+/** Start the run; a run with no prompt gets one written first. Returns the finished video's generation and the words used. */
+export async function createRestore(body: z.infer<typeof RestoreBodySchema>): Promise<{ final: Generation; items: Generation[]; prompt: string; negative: string; by: PromptAnswer["by"] | "you" }> {
+ return startRestore(await planRestoreRun(body));
}
diff --git a/src/server/shorts.ts b/src/server/shorts.ts
index d0aa206a..11f025bf 100644
--- a/src/server/shorts.ts
+++ b/src/server/shorts.ts
@@ -772,6 +772,23 @@ export function regenerateSegment(id: string, index: number): ShortsSessionView
* result is a new take beside the others, to compare and pick.
*/
export function enhanceSegment(id: string, index: number): ShortsSessionView {
+ return startEnhance(planEnhanceRun(id, index));
+}
+
+/** An Enhance planned (the chosen take's 1080p redraw), not started yet. */
+export interface EnhanceRun {
+ id: string;
+ index: number;
+ from: string;
+ cut: ShortsTake["cut"];
+ plan: ReturnType<typeof planEnhance>;
+}
+
+/**
+ * Plan an Enhance of one segment's chosen take. An account's runs on its own GPU only, and only when that GPU has the
+ * memory it needs (own-setup-run.ts): its route checks the steps first (src/server/account-tool-run.ts).
+ */
+export function planEnhanceRun(id: string, index: number): EnhanceRun {
const s = readSession(id);
const seg = segmentAt(s, index);
// Open-H3 Regenerate needs a 48 GB card: an account runs it on its own GPU when that GPU fits it (own-setup-run.ts),
@@ -787,21 +804,29 @@ export function enhanceSegment(id: string, index: number): ShortsSessionView {
const url = g?.status === "succeeded" ? g.outputs.find((o) => o.kind === "video")?.url : undefined;
if (!url) throw new ShortsError(ENHANCE_COPY.notReady, 409);
let plan: ReturnType<typeof planEnhance>;
- let pipeline;
try {
plan = planEnhance(sessionPlanInput(s), seg, { url }, `e${seg.takes.length}`);
- pipeline = createPipeline(plan.steps, { batchId: s.batchId });
} catch (e) {
throw new ShortsError((e as Error).message, 422);
}
+ return { id, index, from: take.look, cut: take.cut, plan };
+}
+
+/** Start a planned Enhance: a new take beside the others, to compare and pick. */
+export function startEnhance(run: EnhanceRun): ShortsSessionView {
+ // Read again before anything is made: the session may have gone meanwhile.
+ const s = readSession(run.id);
+ segmentAt(s, run.index);
+ const { plan } = run;
+ const pipeline = pipelineOf(plan.steps, { batchId: s.batchId });
const next: ShortsTake = {
- cut: take.cut,
+ cut: run.cut,
look: pipeline.byKey[plan.keys.look].id,
- enhance: { from: take.look, ...(plan.keys.smooth ? { smooth: pipeline.byKey[plan.keys.smooth].id } : {}) },
+ enhance: { from: run.from, ...(plan.keys.smooth ? { smooth: pipeline.byKey[plan.keys.smooth].id } : {}) },
createdAt: Date.now(),
};
- saveSession({ ...s, segments: s.segments.map((x, i) => (i === index ? { ...x, takes: [...x.takes, next] } : x)) });
- return getSession(id);
+ saveSession({ ...s, segments: s.segments.map((x, i) => (i === run.index ? { ...x, takes: [...x.takes, next] } : x)) });
+ return getSession(run.id);
}
/** Use another take of a segment in the stitch. */
diff --git a/tests/account-content.test.ts b/tests/account-content.test.ts
index b13bef01..5a2780c9 100644
--- a/tests/account-content.test.ts
+++ b/tests/account-content.test.ts
@@ -266,10 +266,10 @@ describe("the proxy opens the three tools to accounts, and keeps the sign-up car
expect(link.status, who).toBe(403);
expect((await link.json()).code).toBe("own-gpu-tool");
}
- // "Regenerate to 1080p" stays held with Open-H3 Regenerate, for everyone.
- const regen = viaProxy("/api/faceless/episodes/ep1/regenerate", "POST", "a");
- expect(regen.status).toBe(403);
- expect((await regen.json()).code).toBe("own-gpu-tool");
+ // "Regenerate to 1080p" runs on its own GPU: the route checks its own episode first.
+ expect(passed(viaProxy("/api/faceless/episodes/ep1/regenerate", "POST", "a"))).toBe(true);
+ const guestRegen = viaProxy("/api/faceless/episodes/ep1/regenerate", "POST");
+ expect(guestRegen.status).toBe(401);
});
it("the routes refuse a guest themselves", async () => {
diff --git a/tests/account-shorts.test.ts b/tests/account-shorts.test.ts
index c6592228..a56270fb 100644
--- a/tests/account-shorts.test.ts
+++ b/tests/account-shorts.test.ts
@@ -202,6 +202,7 @@ describe("the proxy opens Shorts to accounts, and keeps the sign-up card for gue
["POST", "/api/shorts/sessions"],
["POST", "/api/shorts/sessions/s1/segments/0"],
["POST", "/api/shorts/sessions/s1/segments/0/primary"],
+ ["POST", "/api/shorts/sessions/s1/segments/0/enhance"],
["POST", "/api/shorts/sessions/s1/stitch"],
["PATCH", "/api/shorts/sessions/s1"],
["DELETE", "/api/shorts/sessions/s1"],
@@ -217,12 +218,11 @@ describe("the proxy opens Shorts to accounts, and keeps the sign-up card for gue
expect(await viaProxy("/api/shorts/sessions").json()).toEqual({ items: [] });
expect(await viaProxy("/api/shorts/presets").json()).toEqual({ items: [] });
expect(viaProxy("/api/shorts/sessions/s1").status).toBe(401);
- // The price check stays open to everyone; Enhance isn't offered to a visitor.
+ // The price check stays open to everyone.
expect(passed(viaProxy("/api/shorts/estimate", "POST"))).toBe(true);
- expect(viaProxy("/api/shorts/sessions/s1/segments/0/enhance", "POST").status).toBe(403);
});
- it("an account reaches its own Shorts routes (the routes scope them); Enhance stays closed", async () => {
+ it("an account reaches its own Shorts routes (the routes scope them), Enhance on its own GPU too", async () => {
for (const [method, p] of [
["GET", "/api/shorts/sessions"],
["POST", "/api/shorts/sessions"],
@@ -231,6 +231,7 @@ describe("the proxy opens Shorts to accounts, and keeps the sign-up card for gue
["DELETE", "/api/shorts/sessions/s1"],
["POST", "/api/shorts/sessions/s1/segments/0"],
["POST", "/api/shorts/sessions/s1/segments/0/primary"],
+ ["POST", "/api/shorts/sessions/s1/segments/0/enhance"],
["POST", "/api/shorts/sessions/s1/stitch"],
["GET", "/api/shorts/presets"],
["POST", "/api/shorts/presets"],
@@ -239,12 +240,9 @@ describe("the proxy opens Shorts to accounts, and keeps the sign-up card for gue
] as const) {
expect(passed(viaProxy(p, method, "a")), `${method} ${p}`).toBe(true);
}
- const e = viaProxy("/api/shorts/sessions/s1/segments/0/enhance", "POST", "a");
- expect(e.status).toBe(403);
- expect((await e.json()).code).toBe("own-gpu-tool");
});
- it("the routes refuse a guest themselves, and Enhance refuses anyone but the owner", async () => {
+ it("the routes refuse a guest themselves; Enhance answers an account with its own session only", async () => {
const p = { id: "s1", index: "0" };
for (const [name, r] of [
["create", () => sessionsRoute.POST(json("/api/shorts/sessions", "POST", {}))],
@@ -262,11 +260,13 @@ describe("the proxy opens Shorts to accounts, and keeps the sign-up card for gue
// A guest's reads have nothing of anyone's.
expect(await (await sessionsRoute.GET(json("/api/shorts/sessions", "GET"))).json()).toEqual({ items: [] });
expect(await (await presetsRoute.GET(json("/api/shorts/presets", "GET"))).json()).toEqual({ items: [] });
- for (const who of [undefined, "a"]) {
- const r = await enhanceRoute.POST(json("/api/shorts/sessions/s1/segments/0/enhance", "POST", {}, who), params(p));
- expect(r.status).toBe(403);
- expect((await r.json()).code).toBe("own-gpu-tool");
- }
+ const guest = await enhanceRoute.POST(json("/api/shorts/sessions/s1/segments/0/enhance", "POST", {}), params(p));
+ expect(guest.status).toBe(401);
+ expect(guest.headers.get(access.GUEST_HEADER)).toBe("1");
+ // An account's Enhance is never the "isn't available" refusal: a session that isn't its own reads as gone.
+ const mine = await enhanceRoute.POST(json("/api/shorts/sessions/s1/segments/0/enhance", "POST", {}, "a"), params(p));
+ expect(mine.status).toBe(404);
+ expect((await mine.json()).code).not.toBe("own-gpu-tool");
});
});
diff --git a/tests/account-video-tools.test.ts b/tests/account-video-tools.test.ts
index 7a53e458..98e72f2b 100644
--- a/tests/account-video-tools.test.ts
+++ b/tests/account-video-tools.test.ts
@@ -53,6 +53,7 @@ const flyRoute = await import("@/app/api/fly-around/route");
const katanaRoute = await import("@/app/api/katana/route");
const katanaOneRoute = await import("@/app/api/katana/[id]/route");
const katanaRetryRoute = await import("@/app/api/katana/[id]/retry/route");
+const restoreRoute = await import("@/app/api/restore/route");
const uploadsRoute = await import("@/app/api/uploads/route");
const gpuRoute = await import("@/app/api/account/gpu/route");
const { proxy } = await import("@/proxy");
@@ -209,6 +210,7 @@ const RUNS = [
"/api/fly-around",
"/api/katana",
"/api/katana/k1/retry",
+ "/api/restore",
];
describe("the proxy opens the video tools to accounts, and keeps the sign-up card for guests", () => {
@@ -264,6 +266,7 @@ describe("the proxy opens the video tools to accounts, and keeps the sign-up car
[turnaroundRoute, "/api/turnaround"],
[flyRoute, "/api/fly-around"],
[katanaRoute, "/api/katana"],
+ [restoreRoute, "/api/restore"],
] as const) {
const r = await route.POST(json(p, "POST", {}));
expect(r.status, p).toBe(401);
@@ -488,6 +491,20 @@ describe("an account runs the video tools on its own ComfyUI", () => {
}
});
+ it("Restore & colourise runs on the account's own ComfyUI, its words from Fuobe's template (never the AI helper)", async () => {
+ const r = await start(() => restoreRoute.POST(json("/api/restore", "POST", { engine: "open", source: { url: clip, name: "skate.mp4", ...src } }, "a")));
+ const body = (await r.clone().json()) as { by?: string; prompt?: string };
+ expect(body.by).toBe("offline");
+ expect(body.prompt).toBeTruthy();
+ await ranAsOwn(r, "a", a);
+ // Another account's clip is refused; one with neither a GPU nor a key is asked to connect one.
+ const theirs = await restoreRoute.POST(json("/api/restore", "POST", { engine: "open", source: { url: clip, ...src } }, "b"));
+ expect(theirs.status).toBe(403);
+ const none = await restoreRoute.POST(json("/api/restore", "POST", { engine: "open", source: { url: clip, ...src } }, "c"));
+ expect([403, 404]).toContain(none.status);
+ expect((await none.json()).code).not.toBe("own-gpu-tool");
+ });
+
it("an account's Katana runs go with the account", async () => {
const bClip = await upload("b", CLIP, "video/mp4", "b.mp4");
const bPic = await upload("b", TINY_PNG, "image/png", "b2.png");
diff --git a/tests/canvas-api.test.ts b/tests/canvas-api.test.ts
index c46bf91b..83464f17 100644
--- a/tests/canvas-api.test.ts
+++ b/tests/canvas-api.test.ts
@@ -216,7 +216,7 @@ describe("canvas API", () => {
// Cloud nodes are refused with a reason.
res = await run.POST(req("POST", { graph: board }), ctx(id));
expect(res.status).toBe(422);
- expect(((await res.json()) as { error: string }).error).toMatch(/^Nano Banana Pro is a cloud model, which isn't available here/);
+ expect(((await res.json()) as { error: string }).error).toMatch(/^Nano Banana Pro is a cloud model: pick an open-source model/);
// The open variant runs.
res = await run.POST(req("POST", {}), ctx(c.id));
expect(res.status).toBe(201);
diff --git a/tests/canvas.test.ts b/tests/canvas.test.ts
index 17fd6e95..ada6e9c4 100644
--- a/tests/canvas.test.ts
+++ b/tests/canvas.test.ts
@@ -240,7 +240,7 @@ describe("canvas graph → plan", () => {
// The engine mode is enforced per node.
plan = planCanvas(threeNodes(), { engineMode: "open" });
- expect(plan.errors[0]).toEqual({ nodeId: "img", message: "Nano Banana Pro is a cloud model, which isn't available here. Pick an open-source model" });
+ expect(plan.errors[0]).toEqual({ nodeId: "img", message: "Nano Banana Pro is a cloud model: pick an open-source model" });
});
it("finds loops", () => {
diff --git a/tests/cinema-models.test.ts b/tests/cinema-models.test.ts
index d4173d20..0d35af89 100644
--- a/tests/cinema-models.test.ts
+++ b/tests/cinema-models.test.ts
@@ -49,7 +49,8 @@ describe("Cinema Studio's models", () => {
// On the GPU, H3 renders 768p.
const open = planCinema(input({ modelId: "oss-minimax-h3", resolution: "720p" }), ctx);
expect(open.steps[0].request.params?.resolution).toBe("768p");
- expect(open.notes.join(" ")).toMatch(/MiniMax H3 renders at 768p here/);
+ expect(open.notes.join(" ")).toMatch(/MiniMax H3 renders at 768p/);
+ expect(open.notes.join(" ")).not.toMatch(/renders (at|up to) \S+ here/);
// Every cloud choice has a price.
for (const id of CINEMA_MODELS.video.cloud) expect(res({ modelId: id, resolution: "720p" }).costUsd, id).not.toBeNull();
});
diff --git a/tests/nav-areas.test.ts b/tests/nav-areas.test.ts
index e6b0dfd6..4a105b18 100644
--- a/tests/nav-areas.test.ts
+++ b/tests/nav-areas.test.ts
@@ -49,9 +49,9 @@ describe("what each area lists", () => {
for (const id of ["create", "studios"] as const)
for (const kind of [undefined, "guest", "account"] as const)
for (const i of ids(id, kind)) expect(entry(i)!.visibility ?? [], `${id}: ${i}`).not.toEqual(["owner"]);
- // The owner's own modes (Restore & colourise) are theirs alone.
+ // Restore & colourise is everyone's: it runs on a visitor's own GPU or key, and says so.
expect(ids("studios", "owner")).toContain("video-tools-restore");
- expect(ids("studios", "guest")).not.toContain("video-tools-restore");
+ expect(ids("studios", "guest")).toContain("video-tools-restore");
});
it("gives every card a cover from the catalog, or a picture drawn for it, and a line that fits two lines", async () => {
diff --git a/tests/nav-bar.test.ts b/tests/nav-bar.test.ts
index b90068f1..f9644e17 100644
--- a/tests/nav-bar.test.ts
+++ b/tests/nav-bar.test.ts
@@ -175,7 +175,7 @@ describe("the launcher's columns", () => {
expect(subs("genjutsu")).toEqual(["Motion transfer", "Character swap", "Object swap", "Restyle", "Insert", "From picture", "Finish"]);
expect(subs("upscale")).toEqual(["Image", "Video", "FPS Boost", "SDR to HDR", "Export"]);
expect(subs("audio")).toEqual(["Speech", "Dialogue", "Voice change", "See all 15"]);
- expect(subs("video-tools")).toEqual(["Relight", "Captions", "Remove object", "See all 12"]);
+ expect(subs("video-tools")).toEqual(["Relight", "Captions", "Remove object", "See all 13"]);
for (const w of ["Click to Ad", "Ads Studio", "Ad Multiplier", "Motion transfer", "FPS Boost"]) expect(words(html)).toContain(w);
// Under a hairline, quieter than a row, with no picture and no line of their own (nav-subs.css: 24 px
// names with a mouse, 44 px pills to tap on a touch screen).
diff --git a/tests/nav-model.test.ts b/tests/nav-model.test.ts
index ecda6df7..85d70a58 100644
--- a/tests/nav-model.test.ts
+++ b/tests/nav-model.test.ts
@@ -235,7 +235,7 @@ describe("nav model: launcher", () => {
describe("nav model: who sees what", () => {
const ids = (k: ViewerKind | undefined) => new Set(entriesFor(k).map((e) => e.id));
- const OWNER_ONLY = ["setting-cloud", "setting-comfyui", "setting-engine", "setting-loras", "setting-training", "setting-text-ai", "setting-assist-connectors", "setting-notifications", "setting-security", "setting-demo", "video-tools-restore"];
+ const OWNER_ONLY = ["setting-cloud", "setting-comfyui", "setting-engine", "setting-loras", "setting-training", "setting-text-ai", "setting-assist-connectors", "setting-notifications", "setting-security", "setting-demo"];
it("keeps the install's settings and its own tools from guests and accounts", () => {
for (const k of ["guest", "account", undefined] as const) for (const id of OWNER_ONLY) expect(ids(k).has(id), `${k} sees ${id}`).toBe(false);
diff --git a/tests/nav-search.test.ts b/tests/nav-search.test.ts
index 0dbbf5a8..4918b0a0 100644
--- a/tests/nav-search.test.ts
+++ b/tests/nav-search.test.ts
@@ -167,9 +167,9 @@ describe("search and who is looking", () => {
expect(labels("comfyui server", GUEST)[0]).toBe("Connect your GPU");
});
- it("never offers Restore to a guest or an account; Remove dialogue is everyone's (its page says where it runs)", () => {
+ it("offers Restore and Remove dialogue to everyone (their pages say what they run on)", () => {
for (const entries of [GUEST, ACCOUNT]) {
- for (const q of ["restore colourise", "restore old footage"]) expect(all(q, entries).map((h) => h.id), q).not.toContain("video-tools-restore");
+ for (const q of ["restore colourise", "restore old footage"]) expect(all(q, entries).map((h) => h.id), q).toContain("video-tools-restore");
expect(all("remove dialogue", entries).map((h) => h.id)).toContain("video-tools-remove-dialogue");
}
expect(all("restore colourise").map((h) => h.id)).toContain("video-tools-restore");
diff --git a/tests/nav-subfeatures.test.ts b/tests/nav-subfeatures.test.ts
index 088e341a..5d6702a6 100644
--- a/tests/nav-subfeatures.test.ts
+++ b/tests/nav-subfeatures.test.ts
@@ -116,7 +116,10 @@ describe("the catalogue of studio features", () => {
describe("who sees a studio's features", () => {
it("keeps the owner's own modes the owner's, in every place", () => {
- for (const id of ["canvas-skills", "assist-memory", "assist-scheduled", "video-tools-restore"]) {
+ // Restore & colourise shows to everyone, labelled: it runs on a visitor's own GPU or key (own-setup.ts).
+ expect(entry("video-tools-restore")!.visibility).toBeUndefined();
+ for (const kind of VISITORS) expect(entriesFor(kind).some((e) => e.id === "video-tools-restore"), kind).toBe(true);
+ for (const id of ["canvas-skills", "assist-memory", "assist-scheduled"]) {
expect(entry(id)!.visibility, id).toEqual(["owner"]);
for (const kind of VISITORS) expect(entriesFor(kind).some((e) => e.id === id), `${kind}: ${id}`).toBe(false);
}
diff --git a/tests/next-steps.test.ts b/tests/next-steps.test.ts
index b26b8f9a..c5b4d62d 100644
--- a/tests/next-steps.test.ts
+++ b/tests/next-steps.test.ts
@@ -97,7 +97,8 @@ describe("Keep going with this", () => {
expect(ids(sounded)).toContain("split-soundtrack");
expect(ids(sounded)).toContain("remove-dialogue");
expect(ids(sounded, { ...ALL_ADAPTERS, visitor: true })).toContain("remove-dialogue");
- expect(ids(sounded, { ...ALL_ADAPTERS, visitor: true })).not.toContain("restore-video");
+ // Restore & colourise is offered to a visitor as to the owner (labelled: its own GPU or key).
+ expect(ids(sounded, { ...ALL_ADAPTERS, visitor: true }).includes("restore-video")).toBe(ids(sounded, ALL_ADAPTERS).includes("restore-video"));
});
it("offers a sound: a photo that says it, another voice, a loop, the parts", () => {
diff --git a/tests/own-setup-routes.test.ts b/tests/own-setup-routes.test.ts
new file mode 100644
index 00000000..25a0ff48
--- /dev/null
+++ b/tests/own-setup-routes.test.ts
@@ -0,0 +1,115 @@
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { describe, expect, it } from "vitest";
+import { accountProjectRoute, ownGpuRun } from "@/lib/guest-access";
+import { OWN_SETUP_IDS, ownSetupAction, ownSetupItem, ownSetupOnly } from "@/lib/own-setup";
+import { ownSetupOnlyNow } from "@/server/own-setup-live";
+
+/**
+ * Every surface that shows a "runs with your own setup" label leads somewhere an account can run it: a label next to a
+ * press that the proxy then refuses ("This tool isn't available here") would be a visible feature refused.
+ */
+const reachable = (pathname: string) => ownGpuRun("POST", pathname) || accountProjectRoute(pathname);
+
+/** The route each labelled surface's press sends an account's run to. */
+const ROUTES: Record<string, string> = {
+ "video-tools:restore": "/api/restore",
+ "regenerate:enhance": "/api/shorts/sessions/s1/segments/0/enhance",
+ "regenerate:faceless": "/api/faceless/episodes/e1/regenerate",
+ "regenerate:upscale": "/api/generations",
+ "regenerate:h3-2k": "/api/generations",
+ "regenerate:cinema-finish": "/api/cinema/projects/p1/items/i1/finish",
+ "regenerate:swap-sharpen": "/api/swap-studio/projects/p1/sharpen",
+ "oss-h3-regenerate": "/api/generations",
+ "oss-kandinsky6:pro": "/api/generations",
+ "fly-around:exact-orbit": "/api/fly-around",
+ "oss-uni3c-path": "/api/fly-around",
+ "audio:edit-speech": "/api/audio-tools",
+ "video-tools:remove-person": "/api/remove-object",
+ "video-tools:remove-object-void": "/api/remove-object",
+ "image-to-3d:hi3d-refine": "/api/image-to-3d",
+ "image-to-3d:trellis-final": "/api/image-to-3d",
+ "image-to-3d:idol-other-sides": "/api/image-to-3d",
+ "image-to-3d:idol-clean": "/api/image-to-3d",
+ "cinema:world": "/api/cinema/projects/p1/generate",
+ "oss-hy-nomas-world": "/api/cinema/projects/p1/generate",
+ "sound:clean-voice-first": "/api/genjutsu/transcribe",
+};
+
+describe("a labelled item leads to a run an account can reach", () => {
+ it("maps every static item with a press to an account's route", () => {
+ for (const [id, route] of Object.entries(ROUTES)) {
+ expect(ownSetupItem(id), id).not.toBeNull();
+ expect(reachable(route), `${id} → ${route}`).toBe(true);
+ }
+ // Genjutsu's features and makers run through Genjutsu's own route.
+ for (const id of OWN_SETUP_IDS.filter((x) => x.startsWith("genjutsu:"))) expect(reachable("/api/genjutsu"), id).toBe(true);
+ });
+
+ it("opens Shorts' Enhance and Faceless's Regenerate to 1080p to an account, nothing else on those paths", () => {
+ expect(accountProjectRoute("/api/shorts/sessions/s1/segments/0/enhance")).toBe(true);
+ expect(accountProjectRoute("/api/shorts/sessions/s1/segments/0/other")).toBe(false);
+ expect(accountProjectRoute("/api/faceless/episodes/e1/regenerate")).toBe(true);
+ expect(ownGpuRun("POST", "/api/restore")).toBe(true);
+ // Writing the words from the frames uses the studio's AI helper: the owner's.
+ expect(ownGpuRun("POST", "/api/restore/prompt")).toBe(false);
+ });
+});
+
+describe("the label follows the GPU's validated graphs on the server", () => {
+ const manifest = (validated: Record<string, boolean>) => {
+ const f = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "own-setup-manifest-")), "manifest.json");
+ fs.writeFileSync(f, JSON.stringify({ workflows: Object.entries(validated).map(([id, v]) => ({ id, validated: v })) }));
+ return f;
+ };
+
+ it("drops an item whose graphs are all validated; keeps one that still waits", () => {
+ const m = manifest({ "image-to-3d-trellis2": true, "speech-edit-auk": false });
+ expect(ownSetupOnlyNow("image-to-3d:trellis-final", undefined, m)).toBeNull();
+ expect(ownSetupOnly("image-to-3d:trellis-final")).not.toBeNull();
+ expect(ownSetupOnlyNow("audio:edit-speech", undefined, m)).toEqual(ownSetupOnly("audio:edit-speech"));
+ // Without graphs, the static answer: a 48 GB card stays a 48 GB card.
+ expect(ownSetupOnlyNow("regenerate:upscale", undefined, m)).toEqual(ownSetupOnly("regenerate:upscale"));
+ });
+});
+
+describe("the step's button", () => {
+ it("says what it opens, in plain words", () => {
+ expect(ownSetupAction({ kind: "sign-up" })).toBe("Create a free account");
+ expect(ownSetupAction({ kind: "add-key", provider: "fal" })).toBe("Add your fal.ai key");
+ expect(ownSetupAction({ kind: "connect-gpu", gpuOnly: true })).toBe("Connect your GPU");
+ expect(ownSetupAction({ kind: "run" })).toBeNull();
+ });
+});
+
+describe("visitors see every model and every setup step", () => {
+ const read = (f: string) => fs.readFileSync(path.join(process.cwd(), f), "utf8");
+
+ it("lists the paid models for a guest too, marked with the key they need; choosing one offers a free account", () => {
+ const picker = read("src/components/studio/model-picker.tsx");
+ expect(picker).toContain('status?.viewer?.kind === "guest"');
+ expect(picker).toContain('askToSignUp("run")');
+ expect(picker).toContain('ownSetupLabel({ need: "key", provider: needs[0] })');
+ });
+
+ it("opens the setup card on a refused upload with progress, as a fetch does", () => {
+ const up = read("src/lib/upload.ts");
+ expect(up).toContain("GUEST_PROMPT_EVENT");
+ expect(up).toContain("CONNECT_GPU_EVENT");
+ expect(read("src/components/shorts/use-source-clip.ts")).toContain("refusalShown(e)");
+ });
+
+ it("never says a visible tool isn't available", () => {
+ for (const f of [
+ "src/components/restore/restore-tool.tsx",
+ "src/components/model3d/retexture-dialog.tsx",
+ "src/components/model3d/rig-dialog.tsx",
+ "src/components/layers/projects-view.tsx",
+ "src/components/elements-view.tsx",
+ "src/lib/scene-props.ts",
+ ]) {
+ expect(read(f), f).not.toMatch(/isn(&apos;|')t available/);
+ }
+ });
+});
diff --git a/tests/public-signup-tools.test.ts b/tests/public-signup-tools.test.ts
index fa10549b..d5a32a72 100644
--- a/tests/public-signup-tools.test.ts
+++ b/tests/public-signup-tools.test.ts
@@ -353,7 +353,10 @@ describe("Split soundtrack's, Remove dialogue's and Edit speech's pages are open
const speech = src("src/components/audio-tools/speech-edit-tool.tsx").replace(/\s+/g, " ");
expect(speech).toContain('const OWN_SETUP = "audio:edit-speech";');
expect(speech).toContain("useAskBeforeUpload({ gpuOnly: true })");
- expect(speech.match(/press\(OWN_SETUP\)/g)?.length).toBe(2);
+ // The label the page read (ownSetupsNow: none once AuK's graph is validated), else the static entry.
+ expect(speech).toContain("const item = setup === undefined ? OWN_SETUP : setup;");
+ expect(speech.match(/press\(item\)/g)?.length).toBe(2);
+ expect(src("src/components/studio/mode-switch-studio.tsx")).toContain('<SpeechEditTool setup={ownSetupsNow(["audio:edit-speech"])["audio:edit-speech"]} />');
});
});
diff --git a/tests/public-signup.test.ts b/tests/public-signup.test.ts
index e1416944..c187243d 100644
--- a/tests/public-signup.test.ts
+++ b/tests/public-signup.test.ts
@@ -227,14 +227,10 @@ describe("accounts never run on the owner's keys or GPU", () => {
"/api/content-factory/claude",
// A run route that ignores ?preview=1 isn't a price check.
"/api/faceless/episodes/e1/estimate",
- // Restore & colourise: its run and its prompt writer.
- "/api/restore",
+ // Restore & colourise's prompt writer (the studio's AI helper).
"/api/restore/prompt",
// Plan layout plans with the studio's own AI helper.
"/api/layout/plan",
- // Regenerate in Faceless and Shorts segments (n7-10): studio jobs, like their renders.
- "/api/faceless/episodes/e1/regenerate",
- "/api/shorts/sessions/s1/segments/0/enhance",
]) {
const r = proxy(req(p, { method: "POST", cookie }));
expect(r.status, p).toBe(403);
@@ -251,12 +247,17 @@ describe("accounts never run on the owner's keys or GPU", () => {
"/api/remove-object/preview",
"/api/remove-object/reroll",
"/api/katana/k1/retry",
+ // Restore & colourise runs on its own GPU or fal.ai key.
+ "/api/restore",
]) {
const r = proxy(req(p, { method: "POST", cookie }));
expect(r.status, p).toBe(403);
expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBe("1");
expect((await r.json()).code, p).toBe("connect-gpu");
}
+ // Regenerate to 1080p in Faceless and Enhance in Shorts run on its own GPU: the routes check its own episode or
+ // session, then its GPU (tests/account-content.test.ts, tests/account-shorts.test.ts).
+ for (const p of ["/api/faceless/episodes/e1/regenerate", "/api/shorts/sessions/s1/segments/0/enhance"]) expect(passed(proxy(req(p, { method: "POST", cookie }))), p).toBe(true);
// Owner-only routes say so (not "connect your GPU").
expect(proxy(req("/api/mcp", { method: "POST", cookie })).headers.get(access.CONNECT_GPU_HEADER)).toBeNull();
// Price checks and signing out are fine.
diff --git a/tests/regenerate-held.test.ts b/tests/regenerate-held.test.ts
index 6c81174b..2d594bc9 100644
--- a/tests/regenerate-held.test.ts
+++ b/tests/regenerate-held.test.ts
@@ -99,11 +99,12 @@ const regen = (video: string): GenerationRequest => ({ feature: "upscale", model
const twoK: GenerationRequest = { feature: "video", modelId: R.H3_OPEN_MODEL, op: "t2v", prompt: "A lighthouse in a storm", params: { resolution: "2K", duration: 5 } };
describe("Open-H3 Regenerate while it is held", () => {
- it("is held, and its refusals are plain words", () => {
+ it("is held, and the owner's answers say what it needs in plain words", () => {
expect(R.REGEN_OFFERED).toBe(false);
for (const words of [R.REGEN_COPY.held, R.REGEN_COPY.heldTwoK, R.REGEN_COPY.heldEnhance, R.REGEN_COPY.heldFinish, R.REGEN_COPY.heldEpisode]) {
plain(words);
- expect(words).toMatch(/isn't available .*yet/);
+ expect(words).toMatch(/needs a GPU with 48 GB or more/);
+ expect(words).not.toMatch(/isn't available|not available|coming soon|yet/i);
}
});
diff --git a/tests/regenerate-offered.test.ts b/tests/regenerate-offered.test.ts
index 0d09a2eb..35f726d2 100644
--- a/tests/regenerate-offered.test.ts
+++ b/tests/regenerate-offered.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { Generation, OutputFile } from "@/lib/catalog/types";
-import { REGEN_OFFERED } from "@/lib/catalog/regenerate";
+import { REGEN_COPY, REGEN_OFFERED } from "@/lib/catalog/regenerate";
import { UPSCALE_FIRST_STEPS } from "@/lib/catalog/upscale-first";
import { VIDEO_UPSCALE_STUDIO } from "@/lib/studios";
import { getModel } from "@/lib/catalog";
@@ -83,14 +83,15 @@ describe("Regenerate shows for everyone with what it needs, and runs on the visi
});
describe("tools a guest or an account can't open", () => {
- it("leaves Restore & colourise out of a visitor's result menus, keeps it for the owner, and offers Remove dialogue to both", () => {
+ it("offers Restore & colourise (labelled: the visitor's own GPU or key) and Remove dialogue to both", () => {
const owner = ids(gen());
expect(owner).toContain("restore-video");
const visitor = ids(gen(), { visitor: true });
- expect(visitor).not.toContain("restore-video");
+ expect(visitor).toContain("restore-video");
+ expect(outputActions(gen(), 0, { visitor: true }).find((a) => a.id === "restore-video")?.ownSetup).toBe("video-tools:restore");
// An account runs Remove dialogue on its own GPU (tests/account-audio.test.ts).
expect(visitor).toContain("remove-dialogue");
- expect(ids(upload(), { visitor: true })).not.toContain("restore-video");
+ expect(ids(upload(), { visitor: true })).toContain("restore-video");
});
it("offers Remove a person and Clean up dialogue in a visitor's result menus, as the owner's", () => {
@@ -102,8 +103,15 @@ describe("tools a guest or an account can't open", () => {
expect(visitor).toContain("clean-dialogue");
});
- it("leaves Restore & colourise's Video tools tab out for a visitor; Remove a person's and Remove dialogue's tabs are everyone's", () => {
+ it("shows every Video tools tab to everyone; Restore & colourise's says what it runs on", () => {
const tabs = Object.fromEntries(HUB_MODES["video-tools"].map((m) => [m.id, m.ownerOnly ?? false]));
- expect(tabs).toMatchObject({ restore: true, "remove-person": false, "remove-dialogue": false, matte: false, evolution: false, "remove-object": false });
+ expect(tabs).toMatchObject({ restore: false, "remove-person": false, "remove-dialogue": false, matte: false, evolution: false, "remove-object": false });
+ expect(HUB_MODES["video-tools"].find((m) => m.id === "restore")?.ownSetup).toBe("video-tools:restore");
+ });
+
+ it("shows the owner the same Regenerate surfaces, labelled; the owner's held run says what it needs", () => {
+ // OwnSetupChip has no owner check: the owner reads the same label a visitor does.
+ expect(UPSCALE_FIRST_STEPS.find((s) => s.id === "regenerate")?.ownSetup).toBe("regenerate:upscale");
+ for (const words of [REGEN_COPY.held, REGEN_COPY.heldTwoK, REGEN_COPY.heldEnhance, REGEN_COPY.heldFinish, REGEN_COPY.heldEpisode]) expect(words).toMatch(/48 GB/);
});
});
diff --git a/tests/restore-signup.test.ts b/tests/restore-signup.test.ts
index 1e5b110b..264f8833 100644
--- a/tests/restore-signup.test.ts
+++ b/tests/restore-signup.test.ts
@@ -4,9 +4,9 @@ import { tempDir } from "./helpers/temp-dir";
/**
* Restore & colourise under the owner's public sign-up rules (docs/public-signup.md): its price
- * check is open to guests and accounts and priced for their own GPU, never a demo; its run and its prompt writer plan
- * with the studio's own AI helpers and chain on the server, so a guest or an account gets own-gpu-tool (with or
- * without a GPU); the owner's are unchanged. The GPU pre-flight board has its row, on graphs the requirement index knows.
+ * check is open to guests and accounts and priced for their own GPU, never a demo; an account's run goes to its own GPU
+ * or fal.ai key (a guest signs up first, an account with neither connects one), while the prompt writer, which asks the
+ * studio's own AI helpers, stays the owner's (own-gpu-tool); the owner's are unchanged. The GPU pre-flight board has its row, on graphs the requirement index knows.
*/
const dir = tempDir("fuobe-restore-signup-");
@@ -72,15 +72,23 @@ describe("the proxy: Restore & colourise as main treats a tool", () => {
expect(passed(proxy(req("/video-tools/restore", { cookie })))).toBe(true);
});
- it("opens the price check to guests and accounts; the run and the writer get own-gpu-tool, with or without a GPU", async () => {
+ it("opens the price check to guests and accounts, the run to an account's own GPU; the writer stays the owner's", async () => {
process.env.FUOBE_PUBLIC_SIGNUP = "1";
const bare = auth.createSession(newAccount().id).value;
const withGpu = newAccount();
auth.setAccountGpu(withGpu.id, { url: "https://gpu.example" });
const gpu = auth.createSession(withGpu.id).value;
+ // The run: a guest signs up, an account with neither a GPU nor a key connects one, one with a GPU passes.
+ const guest = proxy(req("/api/restore", { method: "POST" }));
+ expect(guest.status).toBe(401);
+ expect(guest.headers.get(access.GUEST_HEADER)).toBe("1");
+ const none = proxy(req("/api/restore", { method: "POST", cookie: bare }));
+ expect(none.status).toBe(403);
+ expect(none.headers.get(access.CONNECT_GPU_HEADER)).toBe("1");
+ expect(passed(proxy(req("/api/restore", { method: "POST", cookie: gpu })))).toBe(true);
for (const cookie of [undefined, bare, gpu]) {
expect(passed(proxy(req("/api/restore/estimate", { method: "POST", cookie }))), String(cookie)).toBe(true);
- for (const p of RUNS) {
+ for (const p of ["/api/restore/prompt"]) {
const r = proxy(req(p, { method: "POST", cookie }));
expect(r.status, p).toBe(403);
expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBeNull();
diff --git a/tests/scene-props.test.ts b/tests/scene-props.test.ts
index 7d6baff3..9da5f79b 100644
--- a/tests/scene-props.test.ts
+++ b/tests/scene-props.test.ts
@@ -160,13 +160,20 @@ describe("making a prop from a picture (Idol 3D on your GPU only)", () => {
expect(propMakerBlocker({ ...owner, providers: {}, ownerGpu: { device: "x" } })).toBeNull();
});
- it("says why not otherwise: visitors, Paid APIs only, Idol 3D switched off, no GPU", () => {
- expect(propMakerBlocker({ ...owner, viewer: { account: "a" } })).toMatch(/isn't available on your account yet/);
+ it("opens to a visitor, on its own GPU (the press sets it up), whatever the owner's GPU", () => {
+ expect(propMakerBlocker({ ...owner, viewer: { kind: "account" } })).toBeNull();
+ expect(propMakerBlocker({ ...owner, viewer: { kind: "guest" }, providers: {} })).toBeNull();
+ const read = (f: string) => fs.readFileSync(path.join(process.cwd(), f), "utf8");
+ expect(read("src/components/cinema/scene-props.tsx")).toContain("press(PROP_SETUP, make)");
+ });
+
+ it("says why not otherwise: Paid APIs only, Idol 3D switched off, no GPU", () => {
expect(propMakerBlocker({ ...owner, engineMode: "cloud" })).toMatch(/your GPU \(open source\), which Paid APIs only leaves out/);
expect(propMakerBlocker({ ...owner, idolOn: false })).toMatch(/turned off in Settings → Models & licences/);
expect(propMakerBlocker({ ...owner, providers: {} })).toMatch(/Connect ComfyUI in Settings/);
- // Visitor copy names no files, codes or engines' internals.
- expect(propMakerBlocker({ ...owner, viewer: { account: "a" } })).not.toMatch(/ComfyUI|GPU|Idol|owner|install/i);
+ // Visitor copy names no files, codes or engines' internals, and no refusal.
+ const visitor = propMakerBlocker({ ...owner, viewer: { kind: "account" }, idolOn: false })!;
+ expect(visitor).not.toMatch(/ComfyUI|GPU|Idol|owner|install|isn't available/i);
});
});