The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Own setup: one label and one press for what runs on a visitor's own GPU or key
Adarshdf912c091798
diff --git a/src/components/own-setup.tsx b/src/components/own-setup.tsxnew file mode 100644index 00000000..efa784f7--- /dev/null+++ b/src/components/own-setup.tsx@@ -0,0 +1,105 @@+"use client";++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 { openAddKey } from "@/components/keys/your-keys";+import { cn } from "@/lib/utils";++/**+ * The "runs with your own setup" label and press (src/lib/own-setup.ts). Every surface that shows such an item (a+ * picker row, a tab, a choice, a menu item) puts `OwnSetupChip` next to its name and sends its press through+ * `useOwnSetupPress`: a guest gets "Create a free account", an account without the setup "Add your key" or "Connect+ * your GPU", and anyone with it (and the owner) the normal run.+ */++/**+ * The label: a small chip in the studios' badge style (the pickers' "Open source" and "Reads boxes" chips). `short`+ * uses the short words on a phone. Fixed height, so it never moves the row it sits in.+ */+export function OwnSetupChip({ setup, short = true, className }: { setup: OwnSetup | string | null | undefined; short?: boolean; className?: string }) {+ const o = typeof setup === "string" ? ownSetupOnly(setup) : setup;+ if (!o) return null;+ const Icon = o.need === "key" ? KeyRound : Cpu;+ const label = ownSetupLabel(o);+ return (+ <span+ data-slot="own-setup"+ title={ownSetupDetail(o)}+ className={cn(+ "inline-flex h-4 max-w-full shrink-0 items-center gap-1 overflow-hidden rounded-[4px] bg-brand-faint px-1 text-[10px] leading-4 font-medium whitespace-nowrap text-brand-text",+ className,+ )}+ >+ <Icon className="size-2.5! shrink-0" aria-hidden />+ {short ? (+ <>+ <span className="truncate sm:hidden">{ownSetupShort(o)}</span>+ <span className="truncate max-sm:hidden">{label}</span>+ </>+ ) : (+ <span className="truncate">{label}</span>+ )}+ </span>+ );+}++/**+ * The label as its icon alone, for a place with room for a word or two (a tab): the words are its tooltip and what a+ * screen reader says.+ */+export function OwnSetupMark({ setup, className }: { setup: OwnSetup | string | null | undefined; className?: string }) {+ const o = typeof setup === "string" ? ownSetupOnly(setup) : setup;+ if (!o) return null;+ const Icon = o.need === "key" ? KeyRound : Cpu;+ const label = ownSetupLabel(o);+ return (+ <span data-slot="own-setup" title={label} className={cn("inline-flex shrink-0 items-center text-brand-text", className)}>+ <Icon className="size-3 shrink-0" aria-hidden />+ <span className="sr-only">{`, ${label}`}</span>+ </span>+ );+}++/** 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();+ const v = useStatus().data?.viewer;+ if (owner || !v) return null;+ return { kind: v.kind, gpu: v.gpu, keys: v.keys };+}++/** Opens what a step asks for. True when it opened something (the run waits); false for `run`. */+export function openOwnSetupStep(step: OwnSetupStep): boolean {+ switch (step.kind) {+ case "sign-up":+ askToSignUp("run");+ return true;+ case "add-key":+ openAddKey(step.provider);+ return true;+ case "connect-gpu":+ window.dispatchEvent(new CustomEvent<ConnectGpuDetail>(CONNECT_GPU_EVENT, { detail: { action: "run", ...(step.gpuOnly ? { gpuOnly: true, needs: "gpu" } : { needs: "any" }) } }));+ return true;+ default:+ return false;+ }+}++/**+ * The press for an item: `press(idOrSetup, run)` runs it when the viewer has the setup (or is the owner), and otherwise+ * opens the sign-up, "Add your key" or "Connect your GPU" card. Returns whether it ran.+ */+export function useOwnSetupPress(): (item: OwnSetup | string | null | undefined, run?: () => void) => boolean {+ const viewer = useOwnSetupViewer();+ return useCallback(+ (item, run) => {+ const o = typeof item === "string" ? ownSetupOnly(item) : (item ?? null);+ if (openOwnSetupStep(ownSetupStep(o, viewer))) return false;+ run?.();+ return true;+ },+ [viewer],+ );+}diff --git a/src/lib/catalog/hosted-untested.ts b/src/lib/catalog/hosted-untested.tsindex 6f097a58..401db36b 100644--- a/src/lib/catalog/hosted-untested.ts+++ b/src/lib/catalog/hosted-untested.ts@@ -92,3 +92,8 @@ export function hostedUntestedSummary(models: ModelDef[], base: AccessSummary |}return { off: [...off], ...(Object.keys(engines).length && { engines }) };}++/** Whether this route of this model is a hosted call that hasn't been sent with a real key yet (own-setup.ts). */+export function isHostedUntested(modelId: string, route: Pick<ModelRoute, "provider" | "endpoint">): boolean {+ return hosted(route) && (HOSTED_UNTESTED_ENDPOINTS.has(route.endpoint) || HOSTED_UNTESTED_MODELS.has(modelId));+}diff --git a/src/lib/own-setup.ts b/src/lib/own-setup.tsnew file mode 100644index 00000000..bb13e23e--- /dev/null+++ b/src/lib/own-setup.ts@@ -0,0 +1,193 @@+/**+ * "Runs with your own setup": the models, modes and options that a guest or an account sees and runs only on its own+ * GPU or its own fal.ai / Replicate key, never on this studio's GPUs or keys. One table for every surface: a picker row,+ * a tab, a choice or a menu item shows `ownSetupLabel` next to it, and a press goes through `ownSetupStep`+ * (components/own-setup.tsx does both). The words say only what the visitor needs, never why.+ *+ * Who decides what:+ * - Static items are here: a card bigger than this studio's (Open-H3 Regenerate, WorldCast, Kandinsky 6.0 Pro), a step+ * that needs nodes or files this studio's GPU doesn't have, a feature that opens on this studio's GPU once a real+ * render passes (`passes`: gpu-tested.json), and the hosted routes no live call has passed yet (hosted-untested.ts).+ * - The dynamic cases (no worker holds the model right now, a lane not served) are the hosted-run rules' (pool-rules.ts),+ * which answer in this same shape.+ *+ * Pure (client and server): no server imports. Catalog files must not import this file (it reads the catalog): they+ * call `ownSetupFor(model)` from here instead, or are read by id.+ */+import GPU_TESTED from "../../workflows/comfyui/gpu-tested.json";+import { getModel } from "./catalog";+import { isHostedUntested } from "./catalog/hosted-untested";+import type { Engine, ModelDef } from "./catalog/types";++/** fal.ai or Replicate (your-keys.ts CloudProvider). */+type KeyProvider = "fal" | "replicate";++/**+ * What a visitor needs to run an item.+ * - `gpu`: its own GPU (Fuobe Connect). `vramGb`: the card's memory it needs. `linux`: a Linux computer. `files`: it+ * needs extra nodes or files on that computer first (Settings → Your GPU sets them up). `orKey`: a key of that+ * provider runs it too.+ * - `key`: its own key of that provider (fal.ai or Replicate).+ */+export type OwnSetup = { need: "gpu"; vramGb?: number; linux?: true; files?: true; orKey?: KeyProvider } | { need: "key"; provider: string };++interface Entry {+ setup: OwnSetup;+ /** A feature that opens on this studio's GPU once its real render passes (workflows/comfyui/gpu-tested.json). */+ passes?: string;+}++const gpu = (vramGb?: number, more: Omit<Extract<OwnSetup, { need: "gpu" }>, "need" | "vramGb"> = {}): OwnSetup => ({ need: "gpu", ...(vramGb && { vramGb }), ...more });++/**+ * The static items, by the id a surface asks with: a model id, or `<studio>:<feature>` for a mode, an option or a step+ * that has no model of its own. Genjutsu's features use their keys in genjutsu.ts (`genjutsu:<key>`).+ */+const ITEMS: Record<string, Entry> = {+ // Open-H3 Regenerate (a 48 GB card) and everything that finishes with it.+ "oss-h3-regenerate": { setup: gpu(48, { files: true }) },+ "regenerate:upscale": { setup: gpu(48, { files: true }) },+ "regenerate:h3-2k": { setup: gpu(48, { files: true }) },+ "regenerate:cinema-finish": { setup: gpu(48, { files: true }) },+ "regenerate:enhance": { setup: gpu(48, { files: true }) },+ "regenerate:faceless": { setup: gpu(48, { files: true }) },+ "regenerate:swap-sharpen": { setup: gpu(48, { files: true }) },+ // MiniMax H3's fast decoder: a newer ComfyUI and its decoder file.+ "h3:fast-decode": { setup: gpu(undefined, { files: true }) },+ // Genjutsu's modes and options, until each passes on this studio's GPU.+ "genjutsu:group-swap-one-by-one": { setup: gpu(24, { files: true }), passes: "group-swap-one-by-one" },+ "genjutsu:object-change": { setup: gpu(24, { files: true }), passes: "object-change" },+ "genjutsu:object-remove": { setup: gpu(24, { files: true }), passes: "object-remove" },+ "genjutsu:object-background": { setup: gpu(24, { files: true }), passes: "object-background" },+ "genjutsu:picture": { setup: gpu(24, { files: true }), passes: "picture" },+ "genjutsu:picture-light": { setup: gpu(24, { files: true }), passes: "picture-light" },+ "genjutsu:picture-own-person": { setup: gpu(24, { files: true }), passes: "picture-own-person" },+ "genjutsu:picture-h3-renderer": { setup: gpu(24, { files: true }), passes: "picture-h3-renderer" },+ "genjutsu:finish-faces": { setup: gpu(24, { files: true }), passes: "finish-faces" },+ "genjutsu:motion-h3": { setup: gpu(24, { files: true }), passes: "motion-h3" },+ // Genjutsu's makers that only those features use.+ "oss-h3-scene-edit": { setup: gpu(24, { files: true }), passes: "object-change" },+ "oss-from-picture": { setup: gpu(24, { files: true }), passes: "picture" },+ "oss-from-picture-frame": { setup: gpu(24, { files: true }), passes: "picture" },+ "oss-h3-fix-faces": { setup: gpu(24, { files: true }), passes: "finish-faces" },+ "oss-h3-motion": { setup: gpu(24, { files: true }), passes: "motion-h3" },+ // "Clean the voice first": a light voice split on any GPU, or a fal.ai key.+ "sound:clean-voice-first": { setup: gpu(undefined, { orKey: "fal" }), passes: "clean-voice-first" },+ // WorldCast filming: a Linux computer with a 48 GB card.+ "oss-worldcast": { setup: gpu(48, { linux: true, files: true }) },+ "worldcast:film": { setup: gpu(48, { linux: true, files: true }) },+ // Exact orbit (Fly around's camera path): a 48 GB card, or a fal.ai key.+ "oss-uni3c-path": { setup: gpu(48) },+ "fly-around:exact-orbit": { setup: gpu(48, { orKey: "fal" }) },+ // Kandinsky 6.0 (open) at Pro quality: an 80 GB card.+ "oss-kandinsky6:pro": { setup: gpu(80) },+ // Image to 3D's extra steps on a GPU.+ "image-to-3d:hi3d-refine": { setup: gpu(24, { files: true }) },+ "image-to-3d:trellis-final": { setup: gpu(24) },+ "image-to-3d:idol-other-sides": { setup: gpu(8, { files: true }) },+ "image-to-3d:idol-clean": { setup: gpu(8, { files: true }) },+ // 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) },+ "cinema:world": { setup: gpu(24, { files: true }) },+ "oss-hy-nomas-world": { setup: gpu(24, { files: true }) },+};++const passed = (GPU_TESTED as { features?: Record<string, { passed?: boolean }> }).features ?? {};++const KEY_PROVIDERS: readonly KeyProvider[] = ["fal", "replicate"];+const isHostedRoute = (r: { provider: string }) => KEY_PROVIDERS.includes(r.provider as KeyProvider);++/**+ * A model's own setup from its routes: a cloud model (or an Original's cloud engine, `engine` "cloud") whose every+ * hosted route is one no live call has passed yet runs on the visitor's own key of that route's provider. Its other+ * engine, if any, is untouched. Null for everything else.+ */+export function ownSetupFor(m: Pick<ModelDef, "id" | "engine" | "engines" | "routes">, engine?: Engine): OwnSetup | null {+ const hosted = m.routes.filter(isHostedRoute);+ if (!hosted.length || !hosted.every((r) => isHostedUntested(m.id, r))) return null;+ const cloudOnly = m.routes.every(isHostedRoute) && !(m.engines && m.engines.length > 1);+ if (!cloudOnly && engine !== "cloud") return null;+ const provider = KEY_PROVIDERS.find((p) => hosted.some((r) => r.provider === p)) ?? "fal";+ return { need: "key", provider };+}++/**+ * 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.+ */+export function ownSetupOnly(modelOrAppId: string, engine?: Engine): OwnSetup | null {+ const item = ITEMS[modelOrAppId];+ if (item) return item.passes && passed[item.passes]?.passed === true ? null : item.setup;+ const m = getModel(modelOrAppId);+ return m ? ownSetupFor(m, engine) : null;+}++/** Every id this table holds (tests, and the hosted runs' checks). */+export const OWN_SETUP_IDS: readonly string[] = Object.keys(ITEMS);++const KEY_NAME: Record<string, string> = { fal: "fal.ai", replicate: "Replicate" };+const keyName = (p: string) => KEY_NAME[p] ?? p;++/**+ * The label next to an item: "Runs on your own GPU · 48 GB", "Set up on your computer", "Use your own+ * fal.ai key". Plain and positive: what to use, never why.+ */+export function ownSetupLabel(o: OwnSetup): string {+ if (o.need === "key") return `Use your own ${keyName(o.provider)} key`;+ const gb = o.vramGb ? ` · ${o.vramGb} GB` : "";+ if (o.linux) return `Runs on your own Linux GPU${gb}`;+ if (o.orKey) return `Runs on your own GPU${gb} or ${keyName(o.orKey)} key`;+ if (!o.vramGb && o.files) return "Set up on your computer";+ return `Runs on your own GPU${gb}`;+}++/** The short label where a phone has no room: "Your GPU · 48 GB", "Your fal.ai key". */+export function ownSetupShort(o: OwnSetup): string {+ if (o.need === "key") return `Your ${keyName(o.provider)} key`;+ if (o.orKey) return `GPU or ${keyName(o.orKey)} key`;+ return `Your GPU${o.vramGb ? ` · ${o.vramGb} GB` : ""}`;+}++/** One sentence for a tooltip or a card: what the visitor sets up, and where. */+export function ownSetupDetail(o: OwnSetup): string {+ if (o.need === "key") return `Runs with your own ${keyName(o.provider)} key, billed to your ${keyName(o.provider)} account. Add it in Settings → Your keys.`;+ const card = o.vramGb ? `a GPU with ${o.vramGb} GB of memory` : "a GPU";+ const on = o.linux ? `on a Linux computer with ${card}` : `on your own computer with ${card}`;+ const files = o.files ? " Fuobe Connect sets up the files it needs." : "";+ const key = o.orKey ? ` Or use your own ${keyName(o.orKey)} key.` : "";+ return `Runs ${on}. Connect it in Settings → Your GPU.${files}${key}`;+}++/** Who presses: what /api/status says of a guest or an account (StatusInfo.viewer); none for the owner. */+export interface OwnSetupViewer {+ kind: "guest" | "account";+ gpu?: { connected: boolean };+ keys?: readonly string[];+}++/**+ * What a press does:+ * - `run`: the owner (today's behaviour), or an account with the setup: the normal run, on its own GPU or key.+ * - `sign-up`: a guest: "Create a free account to run this".+ * - `add-key`: an account without the key: "Add your key" for that provider.+ * - `connect-gpu`: an account without a GPU: "Connect your GPU" (`gpuOnly`: no key runs it).+ * Never a refusal.+ */+export type OwnSetupStep = { kind: "run" } | { kind: "sign-up" } | { kind: "add-key"; provider: KeyProvider } | { kind: "connect-gpu"; gpuOnly: boolean };++export function ownSetupStep(o: OwnSetup | null, viewer: OwnSetupViewer | null | undefined): OwnSetupStep {+ if (!viewer) return { kind: "run" };+ if (viewer.kind === "guest") return { kind: "sign-up" };+ if (!o) return { kind: "run" };+ const keys = viewer.keys ?? [];+ if (o.need === "key") {+ const p = (KEY_PROVIDERS.includes(o.provider as KeyProvider) ? o.provider : "fal") as KeyProvider;+ return keys.includes(p) ? { kind: "run" } : { kind: "add-key", provider: p };+ }+ if (viewer.gpu?.connected || (o.orKey && keys.includes(o.orKey))) return { kind: "run" };+ return { kind: "connect-gpu", gpuOnly: !o.orKey };+}diff --git a/tests/own-setup.test.ts b/tests/own-setup.test.tsnew file mode 100644index 00000000..95cfb2b3--- /dev/null+++ b/tests/own-setup.test.ts@@ -0,0 +1,182 @@+import { describe, expect, it } from "vitest";+import { getModel, MODELS } from "@/lib/catalog";+import { HOSTED_UNTESTED_ENDPOINTS, isHostedUntested } from "@/lib/catalog/hosted-untested";+import { OWN_SETUP_IDS, ownSetupDetail, ownSetupLabel, ownSetupOnly, ownSetupShort, ownSetupStep, type OwnSetup } from "@/lib/own-setup";++/**+ * "Runs with your own setup" (src/lib/own-setup.ts): the items a visitor sees and runs only on its own GPU or its own+ * fal.ai / Replicate key. Their words are plain and positive, a press never refuses, the owner keeps today's runs, and+ * the hosted runs can ask, for each of them, that it never goes on this studio's GPUs or keys.+ */++/** Words a visitor never reads on these labels: they say why, not what to use. */+const BANNED = /untested|not tested|unverified|not verified|not validated|validat|isn['’]t available|not available|unavailable|coming soon|held|owner|beta|experimental|soon/i;++/**+ * Every item of the sweep of what is hidden or held from visitors, by the id each surface asks own-setup.ts with. The+ * items left out have no setup a visitor makes (see SKIPPED).+ */+const INVENTORY: Record<string, string[]> = {+ "regenerate (Upscale, result menu, Canvas node, picker)": ["oss-h3-regenerate", "regenerate:upscale"],+ "MiniMax H3 in 2K on your GPU": ["regenerate:h3-2k"],+ "Cinema Finish in 2K on a GPU take": ["regenerate:cinema-finish"],+ "Enhance on Shorts and Edit video": ["regenerate:enhance"],+ "Faceless Regenerate to 1080p": ["regenerate:faceless"],+ "Character Swap Sharpen and open 1080p/2K/4K": ["regenerate:swap-sharpen"],+ "MiniMax H3 Fast decode": ["h3:fast-decode"],+ "Genjutsu group swap one by one": ["genjutsu:group-swap-one-by-one"],+ "Genjutsu Change it": ["genjutsu:object-change", "oss-h3-scene-edit"],+ "Genjutsu Remove it": ["genjutsu:object-remove"],+ "Genjutsu New background": ["genjutsu:object-background"],+ "Genjutsu From picture": ["genjutsu:picture", "oss-from-picture", "oss-from-picture-frame"],+ "Genjutsu From picture Light": ["genjutsu:picture-light"],+ "Genjutsu From picture own person": ["genjutsu:picture-own-person"],+ "Genjutsu From picture H3 renderer": ["genjutsu:picture-h3-renderer"],+ "Genjutsu Fix faces": ["genjutsu:finish-faces", "oss-h3-fix-faces"],+ "Genjutsu Motion transfer H3": ["genjutsu:motion-h3", "oss-h3-motion"],+ "Clean the voice first": ["sound:clean-voice-first"],+ WorldCast: ["oss-worldcast", "worldcast:film"],+ "Exact orbit": ["fly-around:exact-orbit", "oss-uni3c-path"],+ "Kandinsky 6.0 open, Pro": ["oss-kandinsky6:pro"],+ "Image to 3D Refine detail (Hi3D)": ["image-to-3d:hi3d-refine"],+ "Image to 3D final with TRELLIS.2": ["image-to-3d:trellis-final"],+ "Make the other sides (Idol views)": ["image-to-3d:idol-other-sides"],+ "Idol 3D clean": ["image-to-3d:idol-clean"],+ "Edit speech": ["audio:edit-speech"],+ "Restore & colourise": ["video-tools:restore"],+ "Remove a person": ["video-tools:remove-person"],+ "Cinema World mode": ["cinema:world", "oss-hy-nomas-world"],+ // The cloud models no live call has passed yet: each on its own key.+ "Audio Extend & remix": ["mureka-extend", "mureka-remix", "mureka-stems"],+ "MiniMax H3 Max family": [+ "minimax-h3-max-lipsync",+ "minimax-h3-max-relight",+ "minimax-h3-max-insert",+ "minimax-h3-max-look-pixel",+ "minimax-h3-max-look-hand-drawn",+ "minimax-h3-max-look-low-poly",+ "minimax-h3-max-look-retro-toon",+ "minimax-h3-max-look-vhs",+ "minimax-h3-max-turbo",+ "minimax-h3-max-turbo-refs",+ "minimax-h3-max-turbo-extend",+ ],+ "MiniMax H3 Lite and HighSpeed": ["minimax-h3-lite", "minimax-h3-highspeed"],+ "Vidu Q4": ["vidu-q4"],+ "Songs and music": ["mureka-song", "mureka-9", "mureka-9-5-instrumental", "mureka-9-instrumental", "minimax-music-3", "elevenlabs-music-2-5", "lyria-3-5"],+ "Voice cleaners": ["veed-clean-audio", "deepfilternet3"],+ "3D cloud": ["idol-3d", "meshy-7-retexture", "meshy-6-retexture", "tripo-p2"],+ "Kandinsky cloud": ["kandinsky-6", "kandinsky-vsr"],+ Bria: ["bria-green-screen", "bria-guided-cutout"],+};++/** Items of the sweep that are not a setup a visitor makes (they keep their own rules). */+const SKIPPED = [+ "AI helper buttons: the install's own language model; no GPU or key of a visitor runs them",+ "Starters and Canvas boards without a cover: a cover rule, not a setup",+ "Paid cloud models for guests: every paid model already runs on an account's own key (Add your key)",+ "Result hand-offs and owner menu links: they take their tool's label once that tool opens to accounts",+];++const engineOf = (id: string) => (getModel(id)?.engines && getModel(id)!.engines!.length > 1 ? ("cloud" as const) : undefined);++describe("own setup: what a visitor needs", () => {+ it("names a setup for every item of the sweep", () => {+ expect(SKIPPED.length).toBeGreaterThan(0);+ for (const [item, ids] of Object.entries(INVENTORY)) for (const id of ids) expect(ownSetupOnly(id, engineOf(id)), `${item}: ${id}`).not.toBeNull();+ });++ it("puts every cloud model no live call has passed yet on the visitor's own key, by its route's provider", () => {+ const untested = MODELS.filter((m) => m.routes.some((r) => isHostedUntested(m.id, r)));+ expect(untested.length).toBeGreaterThan(30);+ for (const m of untested) {+ const o = ownSetupOnly(m.id, "cloud");+ expect(o, m.id).not.toBeNull();+ expect(o!.need, m.id).toBe("key");+ const provider = (o as Extract<OwnSetup, { need: "key" }>).provider;+ expect(m.routes.some((r) => r.provider === provider && isHostedUntested(m.id, r)), m.id).toBe(true);+ }+ expect(ownSetupOnly("minimax-h3-lite")).toEqual({ need: "key", provider: "replicate" });+ expect(HOSTED_UNTESTED_ENDPOINTS.size).toBeGreaterThan(0);+ });++ it("leaves everything else as it is", () => {+ for (const id of ["oss-qwen-image-21", "nano-banana-pro", "oss-kandinsky6", "oss-h3-group-swap", "no-such-model"]) expect(ownSetupOnly(id), id).toBeNull();+ expect(ownSetupOnly("fuobe-animation")).toBeNull();+ expect(ownSetupOnly("fuobe-animation", "cloud")).toEqual({ need: "key", provider: "fal" });+ });++ it("knows every id its table holds by a real model where it names one", () => {+ for (const id of OWN_SETUP_IDS) if (!id.includes(":")) expect(getModel(id), id).toBeDefined();+ });+});++describe("own setup: the words", () => {+ const all: OwnSetup[] = [+ ...OWN_SETUP_IDS.map((id) => ownSetupOnly(id)).filter((o): o is OwnSetup => !!o),+ ...MODELS.map((m) => ownSetupOnly(m.id, "cloud")).filter((o): o is OwnSetup => !!o),+ ];++ it("say what to use, plainly, with no status words", () => {+ for (const o of all) {+ for (const text of [ownSetupLabel(o), ownSetupShort(o), ownSetupDetail(o)]) {+ expect(text, JSON.stringify(o)).not.toMatch(BANNED);+ expect(text.trim()).toBe(text);+ }+ expect(ownSetupLabel(o).length, ownSetupLabel(o)).toBeLessThanOrEqual(44);+ expect(ownSetupShort(o).length, ownSetupShort(o)).toBeLessThanOrEqual(18);+ }+ });++ it("read as the examples", () => {+ expect(ownSetupLabel({ need: "gpu", vramGb: 48 })).toBe("Runs on your own GPU · 48 GB");+ expect(ownSetupLabel({ need: "gpu", vramGb: 48, files: true })).toBe("Runs on your own GPU · 48 GB");+ expect(ownSetupLabel({ need: "gpu", files: true })).toBe("Set up on your computer");+ expect(ownSetupLabel({ need: "gpu", vramGb: 48, linux: true })).toBe("Runs on your own Linux GPU · 48 GB");+ expect(ownSetupLabel({ need: "gpu", vramGb: 48, orKey: "fal" })).toBe("Runs on your own GPU · 48 GB or fal.ai key");+ expect(ownSetupLabel({ need: "key", provider: "fal" })).toBe("Use your own fal.ai key");+ expect(ownSetupLabel({ need: "key", provider: "replicate" })).toBe("Use your own Replicate key");+ expect(ownSetupShort({ need: "gpu", vramGb: 48 })).toBe("Your GPU · 48 GB");+ expect(ownSetupShort({ need: "key", provider: "fal" })).toBe("Your fal.ai key");+ expect(ownSetupLabel(ownSetupOnly("oss-h3-regenerate")!)).toBe("Runs on your own GPU · 48 GB");+ expect(ownSetupLabel(ownSetupOnly("lyria-3-5")!)).toBe("Use your own fal.ai key");+ });+});++describe("own setup: a press", () => {+ const key: OwnSetup = { need: "key", provider: "fal" };+ const big: OwnSetup = { need: "gpu", vramGb: 48 };+ const either: OwnSetup = { need: "gpu", orKey: "fal" };+ const guest = { kind: "guest" as const };+ const bare = { kind: "account" as const, gpu: { connected: false }, keys: [] };+ const keyed = { kind: "account" as const, gpu: { connected: false }, keys: ["fal"] };+ const gpu = { kind: "account" as const, gpu: { connected: true }, keys: [] };++ it("asks a guest to sign up, whatever the item", () => {+ for (const o of [key, big, either, null]) expect(ownSetupStep(o, guest)).toEqual({ kind: "sign-up" });+ });++ it("runs for an account with the setup", () => {+ expect(ownSetupStep(key, keyed)).toEqual({ kind: "run" });+ expect(ownSetupStep(big, gpu)).toEqual({ kind: "run" });+ expect(ownSetupStep(either, keyed)).toEqual({ kind: "run" });+ expect(ownSetupStep(either, gpu)).toEqual({ kind: "run" });+ expect(ownSetupStep(null, bare)).toEqual({ kind: "run" });+ });++ it("gives an account without it the way to set it up, never a refusal", () => {+ expect(ownSetupStep(key, bare)).toEqual({ kind: "add-key", provider: "fal" });+ expect(ownSetupStep(key, gpu)).toEqual({ kind: "add-key", provider: "fal" });+ expect(ownSetupStep({ need: "key", provider: "replicate" }, keyed)).toEqual({ kind: "add-key", provider: "replicate" });+ expect(ownSetupStep(big, bare)).toEqual({ kind: "connect-gpu", gpuOnly: true });+ expect(ownSetupStep(big, keyed)).toEqual({ kind: "connect-gpu", gpuOnly: true });+ expect(ownSetupStep(either, bare)).toEqual({ kind: "connect-gpu", gpuOnly: false });+ });++ it("keeps the owner's runs as they are", () => {+ for (const o of [key, big, either, null]) {+ expect(ownSetupStep(o, null)).toEqual({ kind: "run" });+ expect(ownSetupStep(o, undefined)).toEqual({ kind: "run" });+ }+ });+});