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
Merge main's newer work into hosted-ux
Adarshf16a49313429
diff --cc src/app/api/account/keys/[provider]/route.tsindex c9e3e043,f8773e48..ec3ac087--- a/src/app/api/account/keys/[provider]/route.ts+++ b/src/app/api/account/keys/[provider]/route.ts@@@ -1,12 -1,10 +1,12 @@@import { z } from "zod";import { isCloudProvider, NOT_ACCOUNT_KEYS, type CloudProvider } from "@/lib/your-keys";- import { accountKeyInfo, cleanKey, removeAccountKey, saveAccountKey } from "@/server/account-keys";+ import { accountKey, accountKeyInfo, cleanKey, markKeyBalanceEmpty, markKeyGood, markKeyRejected, removeAccountKey, saveAccountKey } from "@/server/account-keys";import { accountKeyRecord, LoginGuard, requestAccount } from "@/server/auth";+import { poolReady } from "@/server/hosted";import { hit, unhit } from "@/server/rate";+import { clearRunOnFor } from "@/server/run-on";import { SecretBoxError } from "@/server/secret-box";- import { checkKey, runsGoingMessage, runsOnKey, stopRunsOnKey } from "@/server/your-keys";+ import { checkKey, recheckKey, runsGoingMessage, runsOnKey, stopRunsOnKey } from "@/server/your-keys";/*** Settings → Your keys: add, replace or remove the account's own fal.ai key or Replicate token. PUT checks the key withdiff --cc src/app/api/generations/route.tsindex e0ddc1de,7acd51b9..1969f313--- a/src/app/api/generations/route.ts+++ b/src/app/api/generations/route.ts@@@ -14,9 -14,9 +14,10 @@@ import { relightRunTitle } from "@/lib/import { ACCOUNT_LIMITS, ACCOUNT_MESSAGES, accountTotalBytes, accountUsage, diskHasRoom, filesFullMessage } from "@/server/account-files";import { accountInputProblem } from "@/server/account-inputs";import { findView, requestViewKey } from "@/server/any-angle";- import { accountLoraFix, accountRun, AccountRunError, asAccount, asVisitor, captureRun, createGenerations, getGeneration, listGenerations, outputKind, previewGeneration, stepsOf, type AccountRunRefusal } from "@/server/generations";+ import { accountLoraFix, accountRun, AccountRunError, asAccount, asVisitor, captureRun, CHAINED_RUN, createGenerations, getGeneration, keyMoveBlock, listGenerations, outputKind, previewGeneration, PROJECT_RUN, stepsOf, stopReplaced, type AccountRunRefusal, type KeyMoveBlock } from "@/server/generations";-import { accountActiveRuns, AdmitRefused, admitRun, clientAddress, poolLimitRefusal } from "@/server/pool-limits";+import { AdmitRefused, admitRun, clientAddress, ownActiveRuns, poolLimitPlan, type LimitPlan } from "@/server/pool-limits";+import { heldGuessMs, holdRun, holdShape, type HoldReason } from "@/server/pool-holds";+ import { db } from "@/server/db";import { ensureTrashPurge, listOptionsFrom } from "@/server/library";import { hit, unhit } from "@/server/rate";import { GenerationRequestSchema } from "@/server/request-schema";@@@ -68,16 -129,14 +130,16 @@@ const accountRunAnswer = (r: AccountRun});/**- * The answer to a run the limits refuse as it is made (admitRun), or one with a step this install's GPUs don't take (its- * label, which opens Connect your GPU: lateRefusal).- * The answer to a run the limits refuse as it is made (admitRun), one with a step this install's GPUs don't take, or one- * whose run it takes the place of was taken meanwhile.++ * The answer to a run the limits refuse as it is made (admitRun), one with a step this install's GPUs don't take (its++ * label, which opens Connect your GPU: lateRefusal), or one whose run it takes the place of was taken meanwhile.*/-const limitAnswer = (r: AdmitRefused["refusal"]): Answer => ({- status: r.status,- body: { error: r.error, code: r.code },- headers: r.code === "not-offered" ? { [BILLING_HEADER]: "not-offered" } : r.status === 429 ? { "Retry-After": String(r.retryAfterS ?? 30) } : {},-});+function limitAnswer(r: AdmitRefused["refusal"]): Answer {+ if (r.code === "not-offered") {+ const late = lateRefusal(r.error);+ return { status: late.status, body: late.body as Answer["body"], headers: late.headers };+ }- return { status: r.status, body: { error: r.error, code: r.code }, headers: { "Retry-After": String(r.retryAfterS ?? 30) } };++ return { status: r.status, body: { error: r.error, code: r.code }, headers: r.status === 429 ? { "Retry-After": String(r.retryAfterS ?? 30) } : {} };+}/** Start a generation; `?preview=1` only says what it would run as (model, operation, jobs, outputs, cost). */export async function POST(request: Request) {@@@ -121,27 -180,9 +183,27 @@@// A visitor's price check: priced as it would run, as that visitor (an account: its own GPU and keys; a guest: the open// engine, no demo).const priced = <T,>(fn: () => T): T => (viewer.kind === "owner" ? fn() : account ? asAccount(account.id, fn) : asVisitor(null, fn));+ // When the press came: a run that waits to enter the line for the system's reasons keeps this place (pool-holds.ts).+ const pressedAt = Date.now();+ // The studio's own limits of runs at once and an hour: with hosted runs off, on every run of an account, checked first,+ // as always. With them on, on its runs on its own GPU or key and its light work only (its other runs on this+ // install's GPUs meet the policy's limits instead), checked once its place is known. A refused run gives its count of the hour back (unhitRun).+ const ownLimitsFirst = !hostedRunsOn();+ let rated = false;+ const unhitRun = () => {+ if (account && rated) unhit(`run:${account.id}`);+ rated = false;+ };+ const ownLimits = (id: string): Response | null => {- if (ownActiveRuns(id) >= ACCOUNT_LIMITS.activeRuns) return refuse(429, ACCOUNT_MESSAGES.activeRuns, { code: ACTIVE_RUNS_CODE }, { "Retry-After": "30" });++ if (ownActiveRuns(id, { except: replaces?.ids, waitingApart: true }) >= ACCOUNT_LIMITS.activeRuns) return refuse(429, ACCOUNT_MESSAGES.activeRuns, { code: ACTIVE_RUNS_CODE }, { "Retry-After": "30" });+ const rate = hit(`run:${id}`, ACCOUNT_LIMITS.runsPerHour, 60 * 60_000);+ if (!rate.ok) return refuse(429, ACCOUNT_MESSAGES.runRate, {}, { "Retry-After": String(rate.retryAfterS) });+ rated = true;+ return null;+ };/** An account's run that can't go where it was planned: Connect your GPU, Add your key (the client opens either). */const refused = (r: AccountRunRefusal) => {- if (account) unhit(`run:${account.id}`);+ unhitRun();const a = accountRunAnswer(r);return refuse(a.status, a.body.error, a.body, a.headers);};@@@ -300,38 -342,38 +374,55 @@@// The moderation service's check (none set: nothing checked), before anything is set aside: a refusal costs nothing.// Then, on this install's GPUs, the billing service sets the run's price aside (none set: the run is free).let stamp: RunStamp | null = null;+ // A run on this install's GPUs that waits for a service (it didn't answer, or said runs are paused, or gave a later+ // start): why, and what its reserve then sends; `unchecked`: the moderation service didn't answer (it is checked first).+ let wait: ReserveWait | undefined;+ let facts: ReserveFacts | undefined;+ let unchecked = false;if (account) {const mod = await moderateRun(account, req, onPool?.planned ?? null, onPool ? "pool" : "own");- if (!mod.ok) return refusedBy(mod.refusal);+ if (!mod.ok) {+ // While runs on this install's GPUs wait for the services (the policy says so), one the moderation service didn't+ // answer for is taken, and checked before it enters the line.+ if (onPool && !onPool.light && holdsOn(onPool.policy) && mod.refusal.body.code === "paused") unchecked = true;+ else return refusedBy(mod.refusal);+ }+ const checkOutputs = mod.ok && mod.checkOutputs;if (onPool?.light) {// Light work only (joins, trims): free, so nothing is set aside, and it counts against none of the policy's limits.- stamp = { place: "pool", light: true, ...(mod.checkOutputs && { checkOutputs: true }) };+ stamp = { place: "pool", light: true, ...(checkOutputs && { checkOutputs: true }), ...policyWait(onPool.policy) };} else if (onPool) {- const held = await reservePool(account, req, onPool.planned, shown, mod.checkOutputs, onPool.steps, poolTry === null ? null : pressTry(account.id, pressId!, poolTry));+ const limit = "hold" in plan ? { reason: plan.hold, ...(plan.startAt !== undefined && { startAt: plan.startAt }) } : undefined;+ const press = poolTry === null ? null : pressTry(account.id, pressId!, poolTry);+ const held = await reservePool(account, req, onPool.planned, shown, checkOutputs, onPool.steps, press, onPool.policy, { heldMs: heldGuessMs(limit) });if (!held.ok) return refusedBy(held.refusal);stamp = held.stamp;- } else if (mod.checkOutputs) stamp = { checkOutputs: true };+ wait = held.wait;+ facts = held.facts;+ } else if (checkOutputs) stamp = { checkOutputs: true };}+ // The run this one takes the place of, asked again with nothing awaited from here until it is made: a press on another+ // of its batch's tiles meanwhile took it already (or it started on its GPU), so nothing new runs.+ if (replaces && account) {+ const now = replacedRun(body, account.id);+ if (!now || "blocked" in now) {+ unhit(`run:${account.id}`);+ if (stamp?.hold) queueRelease(stamp.hold);+ return now ? refuse(409, BLOCKED[now.blocked].error, { code: BLOCKED[now.blocked].code }) : refuse(409, NOT_REPLACEABLE, { code: "not-replaceable" });+ }+ // Fewer of its jobs left to stop (one was handed over meanwhile): fewer outputs. A run on this install's GPUs keeps+ // the count it was priced and set aside for.+ if (!onPool && now.outputs !== undefined && now.outputs !== replaces.outputs) req = { ...req, params: { ...req.params, numOutputs: Math.min(now.outputs, req.params?.numOutputs ?? now.outputs) } };+ replaces = now;+ }const make = () => createGenerations(req);- const inScope = <T,>(fn: () => T): T => (account && onPool ? runOnPool(account.id, () => withRunStamp(stamp ?? { place: "pool" }, fn)) : stamp ? onOwn(() => withRunStamp(stamp, fn)) : onOwn(fn));+ // An account's run made here is its own, in no tool's project: Run with your key may take its place while it waits.+ const alone = (s: RunStamp): RunStamp => ({ ...s, standalone: true });+ const inScope = <T,>(fn: () => T): T =>+ account && onPool ? runOnPool(account.id, () => withRunStamp(alone(stamp ?? { place: "pool" }), fn)) : account ? onOwn(() => withRunStamp(alone(stamp ?? {}), fn)) : stamp ? onOwn(() => withRunStamp(stamp, fn)) : onOwn(fn);let items: ReturnType<typeof createGenerations>;+ // Why the run waits to enter the line, when it does (its tile says "In line" at once all the same).+ let heldFor: HoldReason | undefined;try {if (account) {// Counted again as the run is made, in one transaction (admitRun): requests that arrived together all passed the@@@ -352,20 -396,23 +446,28 @@@// of its own, never a run against this one. Noted in the same transaction, before any send can look....(poolTry !== null && stamp?.hold && { refused: () => void endTry(account.id, pressId!, poolTry) }),},- () => {+ (admit) => {+ // The run this one takes the place of, asked once more in the same step: a press that reached another app+ // process first took it already, so nothing new runs.+ const still = replaces ? replacedRun(body, account.id) : undefined;+ if (still === null) throw new AdmitRefused({ status: 409, error: NOT_REPLACEABLE, code: "not-replaceable" });+ if (still && "blocked" in still) throw new AdmitRefused({ status: 409, ...BLOCKED[still.blocked] });const run = captureRun(make);const problem = pool && stepsProblem(pool.policy, stepsOf(run.ids));if (problem) throw new AdmitRefused({ status: 403, error: problem, code: "not-offered" });+ const shape = pool && !pool.light ? holdShape({ limit: admit.hold, wait, unchecked }) : null;+ if (shape) holdRun({ accountId: account.id, rows: run.rows, pressedAt, ...shape, ...(facts && { facts }) });+ // The runs this one takes the place of stop in the same step (they were waiting, or it failed): never two of+ // the same, whichever app process a second press reaches.+ if (still) stopReplaced(still.ids);if (poolTry !== null) notePressRun(account.id, pressId!, poolTry, run.value.map((g) => g.id), stamp?.hold ?? null);- return run;+ return { ...run, held: shape?.reason };},);- if (r.ok) r.value.start();+ if (r.ok) {+ if (r.value.held) r.value.settle();+ else r.value.start();+ }return r;});if (!admitted.ok && "prior" in admitted) {diff --cc src/components/gpu/account-gpu-section.tsxindex 577d8403,b71915ab..c643f099--- a/src/components/gpu/account-gpu-section.tsx+++ b/src/components/gpu/account-gpu-section.tsx@@@ -2,8 -2,8 +2,9 @@@import { ConnectChoice } from "@/components/gpu/connect-choice";import { PairedComfyUIs } from "@/components/gpu/fuobe-connect";+import { WhereRunsGo } from "@/components/gpu/where-runs-go";+ import { useHashAnchor } from "@/components/use-hash-anchor";-import { useHydrated, useViewer } from "@/lib/api";+import { useHydrated, useStatus, useViewer } from "@/lib/api";/*** Settings for an account (public sign-up): "Your GPU", at the top of the page (signing out is in Account, below).@@@ -12,9 -12,10 +13,12 @@@export function AccountGpuSection() {const hydrated = useHydrated();const account = useViewer().data?.account;+ // Hosted runs: runs already work without a GPU of one's own, so connecting one is optional.+ const hosted = !!useStatus().data?.viewer?.hosted;- if (!hydrated || !account) return null;+ const shown = hydrated && !!account;+ // A link to /settings#your-gpu arrives before this section exists: it is scrolled to once it does.+ useHashAnchor("your-gpu", shown);+ if (!shown) return null;return (<section id="your-gpu" aria-labelledby="your-gpu-title" className="grid scroll-mt-28 grid-cols-[minmax(0,1fr)] gap-6 border-b py-8 md:scroll-mt-20 md:grid-cols-[260px_minmax(0,1fr)]"><div className="min-w-0">diff --cc src/components/gpu/run-trouble-actions.tsxindex 00000000,1229ee34..0d5592edmode 000000,100644..100644--- a/src/components/gpu/run-trouble-actions.tsx+++ b/src/components/gpu/run-trouble-actions.tsx@@@ -1,0 -1,69 +1,72 @@@+ "use client";++ import { useRouter } from "next/navigation";+ import { useSyncExternalStore } from "react";+ import { toast } from "sonner";-import { TroubleActions } from "./trouble";++import { TroubleActions, type TroubleHandlers } from "./trouble";+ import { useCreateGeneration } from "@/lib/api";+ import type { Generation, ModelDef } from "@/lib/catalog/types";+ import type { TroubleAction, TroubleActionKind } from "@/lib/diagnose";+ import { openModelPicker } from "@/lib/open-model-picker";+ import { toastError } from "@/lib/refusals";+ import { batchKeyOf, failedRunHandlers, movingRun, subscribeMoving, waitingRunHandlers, type RunTroubleDeps } from "@/lib/run-trouble";++ /** The Library reads a run's model only when Try one size smaller is pressed (the catalog isn't on its page). */+ const loadModel = (id: string) => import("@/lib/catalog").then((m) => m.getModel(id));++ /**+ * A run's trouble buttons with what they do (src/lib/run-trouble.ts): a waiting run's Run with your key (its batch's+ * other tiles stop offering it while one press is on its way), a failed run's Run with your key, Pick another model, Try+ * one size smaller and Send a smaller copy. In a studio (`reuse`) the run comes back into its composer; elsewhere (the+ * Library) its studio opens with it.+ */+ export function RunTroubleActions({+ g,+ actions,+ reuse,+ model,+ skip = [],++ more,+ ...rest+ }: {+ g: Generation;+ actions: TroubleAction[];+ reuse?: (g: Generation) => void;+ model?: Pick<ModelDef, "options" | "defaults">;+ skip?: TroubleActionKind[];++ /** Handlers of the caller's own (Run on Our GPUs, with hosted runs on), beside the run's. */++ more?: TroubleHandlers;+ max?: number;+ compact?: boolean;+ context?: "run" | "other";+ className?: string;+ }) {+ const create = useCreateGeneration();+ const router = useRouter();+ const key = batchKeyOf(g);+ // (Nothing moves before the page is live: the server's answer is the same, empty one.)+ const moving = () => movingRun(key);+ const movingId = useSyncExternalStore(subscribeMoving, moving, moving);+ const waiting = g.status === "queued" || g.status === "running";+ const deps: RunTroubleDeps = {+ run: (request, done) =>+ create.mutateAsync(request).then(+ () => {+ if (done) toast.success(done);+ return true;+ },+ (e) => {+ toastError(e);+ return false;+ },+ ),+ onError: (e, next) => (next ? toast.error((e as Error).message || "That didn't work.", { action: next }) : toastError(e)),+ model,+ ...(model ? {} : { loadModel }),+ ...(reuse ? { reuse, openPicker: openModelPicker } : { go: (href: string) => router.push(href) }),+ };+ const handlers = waiting ? waitingRunHandlers(g, deps) : failedRunHandlers(g, deps);+ // Another tile of the same batch is moving it to a key right now: this one doesn't offer it again.+ const hide: TroubleActionKind[] = waiting && movingId && movingId !== g.id ? [...skip, "run-with-key"] : skip;- return <TroubleActions actions={actions} handlers={handlers} skip={hide} {...rest} />;++ return <TroubleActions actions={actions} handlers={more ? { ...handlers, ...more } : handlers} skip={hide} {...rest} />;+ }diff --cc src/components/gpu/trouble.tsxindex db02cc9b,accd4048..07e0ad8d--- a/src/components/gpu/trouble.tsx+++ b/src/components/gpu/trouble.tsx@@@ -1,9 -1,9 +1,9 @@@"use client";import { useQueryClient, type QueryClient } from "@tanstack/react-query";- import { CreditCard, ExternalLink, KeyRound, Loader2, Play, RefreshCw, RotateCcw, Server, Settings2, Shuffle, Stethoscope, Monitor } from "lucide-react";-import { CreditCard, Download, ExternalLink, KeyRound, Loader2, Minimize2, Monitor, Play, RefreshCw, RotateCcw, Settings2, Shuffle, Stethoscope } from "lucide-react";++import { CreditCard, Download, ExternalLink, KeyRound, Loader2, Minimize2, Monitor, Play, RefreshCw, RotateCcw, Server, Settings2, Shuffle, Stethoscope } from "lucide-react";import Link from "next/link";- import { useState } from "react";+ import { useEffect, useRef, useState } from "react";import { toast } from "sonner";import type { GpuTroubleView } from "@/lib/api";import { backoffMs, retryPlan, type TroubleAction, type TroubleActionKind } from "@/lib/diagnose";@@@ -49,23 -50,53 +50,56 @@@ const ICONS: Record<TroubleActionKind,"start-gpu": Play,pair: RefreshCw,"use-computer": Monitor,+ "run-on-site": Server,+ "send-smaller": Minimize2,+ "try-smaller": Minimize2,+ "get-file": Download,+ "update-comfy": RefreshCw,};- /** The first button stands out (the one most likely to help); the rest are quieter. */- const PILL = "inline-flex h-7 w-fit items-center gap-1.5 rounded-full px-2.5 text-[12px] font-medium";+ /** The first button stands out (the one most likely to help); the rest are quieter. One line each, cut short when narrow. */+ const PILL = "inline-flex h-7 max-w-full min-w-0 items-center gap-1.5 rounded-full px-2.5 text-[12px] font-medium whitespace-nowrap";const MAIN = "bg-highlight text-highlight-foreground hover:opacity-90";const QUIET = "bg-secondary hover:bg-accent";+ /** A link that leaves Fuobe (a model file's download): https only. */+ const HTTPS = /^https:\/\/[^\s"'<>]+$/i;export interface TroubleHandlers {onRetry?: () => void;/** "Run with your fal.ai key": the caller runs the cloud version (an explicit click: it spends the person's credit). */- onRunWithKey?: (a: TroubleAction) => void;+ onRunWithKey?: (a: TroubleAction) => void | Promise<unknown>;onPickModel?: () => void;/** "Use this computer": the caller switches runs to the ComfyUI on this computer. */- onUseComputer?: () => void;+ onUseComputer?: () => void | Promise<unknown>;+ /** "Run on Our GPUs": the caller sends this run once to this install's GPUs (hosted runs). */+ onRunOnSite?: () => void;+ /** "Send a smaller copy": the run made again with a smaller copy of its file. */+ onSendSmaller?: () => void | Promise<unknown>;+ /** "Try one size smaller": the run made again one size or length smaller. */+ onTrySmaller?: () => void | Promise<unknown>;+ }++ /**+ * When some buttons must go (a small tile), the ones that help least go first: Settings (Check my GPU leads there too),+ * Pair with a code, then the rest. The first button (the one most likely to help) always stays, and the order is kept.+ */-const DROP_FIRST: TroubleActionKind[] = ["gpu-settings", "pair", "use-computer", "pick-model", "retry", "check-gpu", "key-settings", "try-smaller", "send-smaller", "add-credit", "run-with-key", "get-file", "update-comfy", "start-gpu"];++const DROP_FIRST: TroubleActionKind[] = ["gpu-settings", "pair", "use-computer", "pick-model", "retry", "check-gpu", "key-settings", "try-smaller", "send-smaller", "add-credit", "run-with-key", "run-on-site", "get-file", "update-comfy", "start-gpu"];++ export function fitActions(actions: TroubleAction[], max?: number): TroubleAction[] {+ if (!max || actions.length <= max) return actions;+ const out = [...actions];+ for (const kind of DROP_FIRST) {+ for (let i = out.length - 1; i > 0 && out.length > max; i--) if (out[i].kind === kind) out.splice(i, 1);+ if (out.length <= max) break;+ }+ return out.slice(0, max);+ }++ /** A button's words where there is little room (a tile): the long Settings links get their short names. */+ function shortLabel(a: TroubleAction): string {+ if (a.kind === "gpu-settings" && a.label.startsWith("Open Settings")) return "Settings";+ if (a.kind === "key-settings" && a.label.startsWith("Open Settings")) return "Your keys";+ return a.label;}/**@@@ -81,23 -138,46 +141,47 @@@ export function TroubleActions(if (a.kind === "run-with-key") return !!handlers.onRunWithKey;if (a.kind === "pick-model") return !!handlers.onPickModel;if (a.kind === "use-computer") return !!handlers.onUseComputer;+ if (a.kind === "run-on-site") return !!handlers.onRunOnSite;+ if (a.kind === "send-smaller") return !!handlers.onSendSmaller;+ if (a.kind === "try-smaller") return !!handlers.onTrySmaller;+ // Where a model file downloads from: only an https link.+ if (a.kind === "get-file" || a.kind === "update-comfy") return !!a.target && HTTPS.test(a.target);+ // On a tile, Check my GPU leads to Settings when that is what helps: one button fewer.+ if (compact && a.kind === "gpu-settings" && actions.some((x) => x.kind === "check-gpu") && a.label.startsWith("Open Settings")) return false;return true;});- const shown = max ? usable.slice(0, max) : usable;+ const shown = fitActions(usable, max);if (!shown.length) return null;- const check = async () => {- setChecking(true);+ // Something that takes a moment (a run on a key, a check): pressed until it is done, so a second click starts nothing.+ const press = async (kind: TroubleActionKind, fn: () => void | Promise<unknown>) => {+ if (busy) return;+ setBusy(kind);try {- const r = await checkMyGpu(qc);- if (r.ok) toast.success(`Your GPU answered${r.device ? `: ${r.device}` : ""}. Press Retry to run it again.`);- else toast(r.words, { id: "check-gpu" });+ await fn();} finally {- setChecking(false);+ setBusy(null);}};+ const check = async (): Promise<void> => {+ const r = await checkMyGpu(qc);+ if (r.ok) {+ const what = r.device ? `: ${deviceLabel(r.device)}` : "";+ toast.success(context === "run" ? `Your GPU answered${what}. Press Retry to run it again.` : `Your GPU answered${what}.`, { id: "check-gpu" });+ } else if (r.retryAfterS) {+ // Too many checks in a minute: one more goes by itself once the wait is over.+ const s = Math.max(1, Math.round(r.retryAfterS));+ toast(`Too many checks. Checking again in ${s} s.`, { id: "check-gpu" });+ if (again.current) clearTimeout(again.current);+ setWaiting(true);+ again.current = setTimeout(() => {+ again.current = null;+ setWaiting(false);+ void press("check-gpu", check);+ }, s * 1000);+ } else toast(r.words, { id: "check-gpu" });+ };return (- <div className={cn("flex flex-wrap gap-1.5", className)}>+ <div className={cn("flex min-w-0 flex-wrap gap-1.5", className)}>{shown.map((a, i) => {const Icon = ICONS[a.kind];const cls = cn(PILL, i === 0 && a.kind !== "retry" ? MAIN : QUIET);@@@ -128,9 -209,12 +213,14 @@@? handlers.onPickModel: a.kind === "use-computer"? handlers.onUseComputer- : a.kind === "send-smaller"- ? handlers.onSendSmaller- : a.kind === "try-smaller"- ? handlers.onTrySmaller- : undefined;+ : a.kind === "run-on-site"+ ? handlers.onRunOnSite- : undefined;++ : a.kind === "send-smaller"++ ? handlers.onSendSmaller++ : a.kind === "try-smaller"++ ? handlers.onTrySmaller++ : undefined;+ const pending = busy === a.kind || (a.kind === "check-gpu" && waiting);return (<buttonkey={a.kind}diff --cc src/components/gpu/your-gpu.tsxindex 2e9f5014,9a18c545..c308dd18--- a/src/components/gpu/your-gpu.tsx+++ b/src/components/gpu/your-gpu.tsx@@@ -10,9 -10,8 +10,10 @@@ import { Button } from "@/components/uiimport { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";import { useStatus, type GpuTroubleView } from "@/lib/api";- import { canSaveAnyway } from "@/lib/diagnose";+ import { canSaveAnyway, diagnoseAddress, testWords } from "@/lib/diagnose";+ import { useComputerSupport } from "@/components/gpu/open-connect";+import { placeOf } from "@/lib/place-name";+import { runsGoNowText, useSetRunOn } from "@/lib/run-on";import { responseError, toastError } from "@/lib/refusals";import { cn } from "@/lib/utils";diff --cc src/components/keys/your-keys.tsxindex 6d1411ae,de673ed6..2640bce1--- a/src/components/keys/your-keys.tsx+++ b/src/components/keys/your-keys.tsx@@@ -9,13 -10,11 +10,15 @@@ import { Button } from "@/components/uiimport { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";+ import { useHashAnchor } from "@/components/use-hash-anchor";import { ADD_KEY_EVENT, preferEngine, useHydrated, useStatus, useViewer } from "@/lib/api";import { settingProblem } from "@/lib/connections";-import { CLOUD_KEY, CLOUD_PROVIDERS, type CloudProvider, type KeyInfo, type YourKeys } from "@/lib/your-keys";+import { CLOUD_KEY, CLOUD_PROVIDERS, keySavedText, type CloudProvider, type KeyInfo, type YourKeys } from "@/lib/your-keys";+import { engineAfterKeySave } from "@/lib/engine-pref";+import { placeOf } from "@/lib/place-name";+import { placeRows } from "@/lib/run-place";+import { runsGoNowText } from "@/lib/run-on";+ import { KeyAccountDetails, NoKeyYet } from "./key-account-details";import { cn } from "@/lib/utils";/**@@@ -187,7 -185,26 +192,27 @@@ function KeyCard({ provider, info }: {const [replacing, setReplacing] = useState(false);const [confirm, setConfirm] = useState<null | { going?: string }>(null);const [busy, setBusy] = useState(false);+ const viewer = useStatus().data?.viewer;+ const [checking, setChecking] = useState(false);+ const [checkNote, setCheckNote] = useState<{ words: string; details?: string } | null>(null);+ // Check again: the saved key asked of its provider again (free, nothing runs). A refusal or an empty balance noted on a+ // run is cleared when the provider says the key works now.+ const checkAgain = async () => {+ setChecking(true);+ setCheckNote(null);+ try {+ const r = await fetch(`/api/account/keys/${provider}`, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ recheck: true }) });+ const j = (await r.json().catch(() => ({}))) as KeyInfo & { error?: string; details?: string };+ changed();+ if (r.ok) toast.success(j.balanceEmptyAt ? `Your ${p.label} key works, but its balance is empty. Add credit, then run.` : `Your ${p.label} key works.`);+ else setCheckNote({ words: j.error ?? "We couldn't check your key. Try again in a minute.", ...(j.details && { details: j.details }) });+ } catch {+ setCheckNote({ words: "We couldn't check your key. Check this computer's internet, then try again." });+ } finally {+ setChecking(false);+ }+ };+ const empty = !!info?.readable && !info.rejectedAt && !!info.balanceEmptyAt;const remove = async (stopRuns: boolean) => {setBusy(true);@@@ -286,15 -333,11 +343,18 @@@ export function AccountKeysSection({ prconst account = useViewer().data?.account;const q = useYourKeys(!!account);// A studio with paid models off takes no keys: the section isn't shown.- const paidOff = useStatus().data?.viewer?.paidAllowed === false || q.data?.paidAllowed === false;+ const viewer = useStatus().data?.viewer;+ const paidOff = viewer?.paidAllowed === false || q.data?.paidAllowed === false;+ // Hosted runs: the limits below are a key's own (runs on this studio's GPUs have theirs).+ const hosted = !!viewer?.hosted;- if (!hydrated || !account || paidOff) return null;+ const shown = hydrated && !!account && !paidOff;+ // A link to /settings#your-keys arrives before this section exists: it is scrolled to once it does.+ useHashAnchor("your-keys", shown);+ if (!shown) return null;+ // Hosted runs: where the account's runs go now (Settings → Your GPU changes it).+ const keys = viewer?.keys ?? [];+ const runKey = viewer?.runKey && keys.includes(viewer.runKey) ? viewer.runKey : keys.includes("fal") ? "fal" : keys[0];+ const goesTo = hosted && viewer ? (placeRows(viewer, { key: runKey ? { provider: runKey } : null, cloud: true })?.rows.find((r) => r.selected)?.label ?? placeOf(viewer.placeName).label) : null;return (<section id="your-keys" aria-labelledby="your-keys-title" className="grid scroll-mt-28 grid-cols-[minmax(0,1fr)] gap-6 border-b py-8 md:scroll-mt-20 md:grid-cols-[260px_minmax(0,1fr)]"><div className="min-w-0">diff --cc src/components/library/asset-card.tsxindex 47c7a499,4a2ea27f..67da452d--- a/src/components/library/asset-card.tsx+++ b/src/components/library/asset-card.tsx@@@ -7,10 -7,8 +7,10 @@@ import { TileActions, useCanHover, typimport { LayersStack, MediaThumb, SmallThumb } from "@/components/studio/result-media";import { OPERATION_LABELS, type Generation } from "@/lib/catalog/types";import { elapsed, timeAgo } from "@/lib/format";- import { coverOf, trashDaysLeft, userTitle, type LibraryEntry } from "@/lib/library";+ import { cardStateWords, coverOf, trashDaysLeft, userTitle, type LibraryEntry } from "@/lib/library";import { isLayered, shownOutputs } from "@/lib/output-actions";+import { lineWords } from "@/lib/pool-line";+import { POOL_WORDS } from "@/lib/relay";import { cn } from "@/lib/utils";import { PlaceholderChip } from "@/components/demo-mode";import { TroubleActions, TroubleDetails } from "@/components/gpu/trouble";@@@ -45,52 -44,53 +46,70 @@@ const LIST_MENU ="grid size-8 shrink-0const idsOf = (e: LibraryEntry) => (e.type === "single" ? [e.g.id] : e.items.map((g) => g.id));+/** A run's state in a Library list row: on this install's GPUs, the words its tile says. */+export function listStatus(g: Pick<Generation, "status" | "place">): string {+ if (g.status === "canceled") return "Canceled";+ if (g.place === "pool") return g.status === "failed" ? "Couldn't be made" : g.status === "queued" ? POOL_WORDS.inLine : POOL_WORDS.working;+ return g.status === "failed" ? "Failed" : g.status === "queued" ? "Queued" : "Rendering";+}+- export function StatusCover({ g }: { g: Generation }) {+ /**+ * A run's cover while it goes or after it failed. An account's own GPU or key: what came back (small) and the way out+ * (Start your pod, Check my GPU, Replace key…), the buttons kept in view first (the words give way on a small card).+ * `small`: a list row's thumbnail (the row's own text says the rest).+ */+ export function StatusCover({ g, small, actionable }: { g: Generation; small?: boolean; /** The account's own Library: the buttons act (Pick another model opens the run's studio with it). */ actionable?: boolean }) {+ // On this install's GPUs (hosted runs): the words of its tile, in line with its place and wait, then working.+ const pool = g.place === "pool";if (g.status === "queued" || g.status === "running") {const pct = g.progress != null ? Math.round(g.progress * 100) : null;+ const label = pool ? (g.status === "queued" ? (g.queue ? lineWords(g.queue) : POOL_WORDS.inLine) : (g.message ?? POOL_WORDS.working)) : (g.message ?? (g.status === "queued" ? "Queued" : "Generating…"));+ const waiting = g.status === "queued" ? g.waiting : undefined;return (<div className="relative size-full bg-muted"><div className="skeleton-sweep absolute inset-0 animate-skeleton" />- <div className="absolute inset-x-0 bottom-0 p-3">- <p className="shimmer-text animate-shimmer-text truncate text-[13px] font-medium">{label}</p>- <p className="font-mono text-[11px] text-muted-foreground">- {pct != null ? `${pct}% · ` : ""}- {elapsed(g.createdAt)}- </p>- </div>+ {!small && (+ <div className="absolute inset-x-0 bottom-0 space-y-1 p-3">- <p className="shimmer-text animate-shimmer-text truncate text-[13px] font-medium">{g.message ?? (g.status === "queued" ? "Queued" : "Generating…")}</p>++ <p className="shimmer-text animate-shimmer-text truncate text-[13px] font-medium">{label}</p>+ <p className="font-mono text-[11px] text-muted-foreground">+ {pct != null ? `${pct}% · ` : ""}+ {elapsed(g.createdAt)}+ </p>+ {/* Waiting for its own GPU or key: what helps meanwhile (it goes on by itself). */}+ {waiting &&+ (actionable ? (+ <RunTroubleActions g={g} actions={waiting.actions} skip={["retry"]} max={2} compact />+ ) : (+ <TroubleActions actions={waiting.actions} skip={["retry", "run-with-key"]} max={2} compact />+ ))}+ </div>+ )}</div>);}+ if (small) return <div className="size-full border border-dashed bg-background" />;+ const trouble = g.status === "failed" ? g.trouble : undefined;return (- <div className="flex size-full flex-col justify-between border border-dashed bg-background p-3">- <div className="min-h-0 space-y-1 overflow-hidden">+ <div className="flex size-full flex-col justify-between gap-2 border border-dashed bg-background p-3">+ <div className="flex min-h-0 flex-col gap-1 overflow-hidden">- <p className="shrink-0 text-[13px] font-medium">{g.status === "canceled" ? "Canceled" : "Couldn't generate this one"}</p>- {g.error && <p className="line-clamp-3 text-[12px] leading-snug break-words text-muted-foreground @[16rem]:line-clamp-4">{g.error}</p>}+ {pool && g.status === "failed" ? (+ // One plain sentence, as its tile says it.- <p className="line-clamp-5 text-[13px] leading-snug font-medium break-words">{g.error || POOL_WORDS.failed}</p>++ <p className="line-clamp-5 shrink-0 text-[13px] leading-snug font-medium break-words">{g.error || POOL_WORDS.failed}</p>+ ) : (+ <>- <p className="text-[13px] font-medium">{g.status === "canceled" ? "Canceled" : "Couldn't generate this one"}</p>- {g.error && <p className="line-clamp-4 text-[12px] leading-snug break-words text-muted-foreground">{g.error}</p>}- </>- )}- {/* An account's own GPU or key: what came back (small), and the way out (Start your pod, Check my GPU, Replace key…). */}- {g.status === "failed" && g.trouble && (- <>- <TroubleDetails details={g.trouble.details} />- <TroubleActions className="pt-1" actions={g.trouble.actions} skip={["retry"]} max={2} />++ <p className="shrink-0 text-[13px] font-medium">{g.status === "canceled" ? "Canceled" : "Couldn't generate this one"}</p>++ {g.error && <p className="line-clamp-3 text-[12px] leading-snug break-words text-muted-foreground @[16rem]:line-clamp-4">{g.error}</p>}+ </>+ )}+ {/* The details line goes first when the card is small. */}+ {trouble && <TroubleDetails details={trouble.details} className="hidden @[16rem]:block" />}</div>+ {trouble &&+ (actionable ? (+ <RunTroubleActions g={g} className="shrink-0" actions={trouble.actions} skip={["retry"]} max={2} compact context="run" />+ ) : (+ <TroubleActions className="shrink-0" actions={trouble.actions} skip={["retry"]} max={2} compact />+ ))}</div>);}@@@ -270,8 -272,12 +291,12 @@@ export const AssetCard = memo(function{stack ? `${stack.label} · ` : `${g.modelName ?? g.modelId} · ${OPERATION_LABELS[g.op]} · `}{trashed ? `${trashDaysLeft(g.deletedAt!)} days left in Trash` : timeAgo(g.createdAt)}{/* "Rendering", as the Status filter calls it: "In progress" is a review status. */}- {!stack && g.status !== "succeeded" && ` · ${g.status === "failed" ? "Failed" : g.status === "canceled" ? "Canceled" : g.status === "queued" ? "Queued" : "Rendering"}`}+ {!stack && g.status !== "succeeded" && ` · ${listStatus(g)}`}</p>+ {/* An account's own GPU or key: the way out, in the row (its thumbnail is too small for it). */}+ {!stack && !trashed && (g.status === "failed" ? g.trouble : g.status === "queued" ? g.waiting : undefined) && (+ <RunTroubleActions g={g} className="mt-1" actions={(g.status === "failed" ? g.trouble : g.waiting)!.actions} skip={["retry"]} max={1} compact context={g.status === "failed" ? "run" : "other"} />+ )}</div>{g.favorite && !stack && <Heart className="size-4 shrink-0 fill-highlight text-highlight" />}{stack && <ChevronDown className={cn("size-4 shrink-0 text-muted-foreground transition-transform", expanded && "rotate-180")} />}diff --cc src/components/nav/status-chips.tsxindex d00c3f39,42ce21ec..80427062--- a/src/components/nav/status-chips.tsx+++ b/src/components/nav/status-chips.tsx@@@ -54,10 -54,10 +54,10 @@@ export function StatusDot({ ok }: { ok}/** A status dot centred in a slot as wide as the rows' icons (16 px in the menu, 18 px in the You sheet: --nav-icon). */- function DotSlot({ ok, hidden }: { ok: boolean | undefined; hidden?: boolean }) {-export function DotSlot({ ok }: { ok: boolean | undefined }) {++export function DotSlot({ ok, hidden }: { ok: boolean | undefined; hidden?: boolean }) {return (<span aria-hidden className="grid w-[var(--nav-icon,16px)] shrink-0 place-items-center">- <StatusDot ok={ok} />+ {!hidden && <StatusDot ok={ok} />}</span>);}diff --cc src/components/studio/composer.tsxindex f6db85c4,571a874d..3df5f475--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@@ -104,8 -99,9 +104,10 @@@ import { H3_TIER_PARAM, h3TierNote } frimport { formatCost } from "@/lib/format";import { toastError } from "@/lib/refusals";import { addKeyLabel, billedTo, CLOUD_KEY, cloudVersion, needsKey, paidThrough, startingModel } from "@/lib/your-keys";- import { gpuBeforeRun, onCloudKey } from "@/lib/before-run";- import { withKeyAction, type TroubleAction } from "@/lib/diagnose";-import { beforeRunTail, gpuBeforeRun, runOnceOnKey } from "@/lib/before-run";++import { beforeRunTail, gpuBeforeRun, onCloudKey, runOnceOnKey } from "@/lib/before-run";+ import { BILLING_URL, ISOLATED_ON_GPU_WHY, withKeyAction, type TroubleAction } from "@/lib/diagnose";+ import { openModelPicker } from "@/lib/open-model-picker";++import { GpuReadinessLine } from "@/components/gpu/file-steps";import { TroubleActions, TroubleDetails } from "@/components/gpu/trouble";import { cn } from "@/lib/utils";import { h3ReferenceProblem, openReferenceMode } from "@/lib/h3-references";@@@ -846,82 -833,29 +848,84 @@@ export function Composer({ docked }: {// strip's, every 30 s; nothing here asks the GPU) shows what is wrong and its fixes before Run. A run started anyway// waits for the GPU. One of the account's keys that runs this tool's cloud version is offered too (an explicit click:// it spends the person's own credit).- const gpuDown = gpuBeforeRun({ viewer: status?.viewer, model, engine, onPool: hostedHere && runOn === "pool", preset, has, getModel: catalog.getModel });+ // Hosted runs: the key that runs this item's cloud version (a row of the Run on list, "Run with your fal.ai key"), and+ // its price there, so a key is offered with its price and a press that showed "Free" never bills it.+ // (Not for an exact orbit: it runs as a fly-around, at its own price.)+ const keyTwin =- viewerInfo?.hosted && viewerInfo.kind === "account" && viewerInfo.paidAllowed !== false && model && !exact ? cloudVersion(preset, model, viewerInfo.keys ?? [], has, catalog.getModel) : null;++ viewerInfo?.hosted && viewerInfo.kind === "account" && viewerInfo.paidAllowed !== false && model && !exact ? cloudVersion(preset, model, viewerInfo.usableKeys ?? viewerInfo.keys ?? [], has, catalog.getModel) : null;+ const keyPrice = (() => {+ const m = keyTwin ? catalog.getModel(keyTwin.modelId) : undefined;+ if (!m) return null;+ try {+ const usd = estimateCost(onEngine(m, "cloud"), draft.params, 1, (keyTwin?.op ?? op) as Operation | undefined, false, today);+ return usd != null && usd > 0 ? `≈ ${formatCost(usd)}` : null;+ } catch {+ return null;+ }+ })();+ // What this studio's GPUs take (no label of an own setup), so the check before Run offers a run on them only then.+ const siteTakes = !!viewerInfo?.hosted && !!model && model.engine === "open" && !modelSetup(model) && !poolSetup;+ const gpuDown = gpuBeforeRun({+ viewer: status?.viewer,+ model,+ engine,+ onPool: hostedHere && runOn === "pool",+ preset,+ has,+ getModel: catalog.getModel,+ hosted: !!viewerInfo?.hosted,+ site: siteTakes ? sitePlace : null,+ keyPrice,+ });- // "Run with your fal.ai key". While hosted runs are on: this run, once, on the tool's cloud version and that key; the- // engine switch stays where it was, so the next run goes where runs go (the person picks Cloud themselves to stay- // there). Otherwise (as always): the switch moves to Cloud, and once it has moved the tool to its cloud model, it runs.- const [cloudRun, setCloudRun] = useState(false);- useEffect(() => {- if (!cloudRun) return;- const late = setTimeout(() => setCloudRun(false), 4000);- if (engine === "cloud" && model && (model.engine !== "open" || dualEngine(model))) {- setCloudRun(false);- submitRef.current();- }- return () => clearTimeout(late);- }, [cloudRun, engine, model]);- const onRunWithKey = viewerInfo?.hosted- ? (a: TroubleAction) => submitRef.current(undefined, a)- : () => {- setEngine("cloud");- setCloudRun(true);- };+ // A graph that needs a second ComfyUI (LatentSync 1.6, ThinkSound) can't run on an account's single GPU at a web address:+ // said before Run, with what runs it instead (its cloud version on a key, or another model).+ const viewerGpu = status?.viewer?.kind === "account" ? status.viewer.gpu : undefined;+ const isolatedHere = !!model && model.worker === "isolated" && model.engine === "open" && !!viewerGpu?.connected && viewerGpu.mode === "link" && !(hostedHere && runOn === "pool");+ const isolatedTwin =+ isolatedHere && status?.viewer?.paidAllowed !== false ? cloudVersion(preset, model, status?.viewer?.usableKeys ?? status?.viewer?.keys ?? [], has, catalog.getModel) : null;+ // "Run with your fal.ai key": this run, once, on the tool's cloud version and that key. The engine switch stays where it+ // was, so the next run goes to the GPU again (the person picks Cloud themselves to stay there).+ const runOnceWithKey = (a: TroubleAction) => {+ const sent = signature.apply(+ buildRequest(config.feature, songDraft(draft, model, config.slots), resolvesOnServer ? studioOp : op, config.promptSuffix, config.multiRef?.kind, framesCtx, targetFor(draft.modelId)),+ );+ const withVoiceFirst = cleanFirst ? { ...sent.request, params: { ...sent.request.params, extra: { ...sent.request.params?.extra, [VOICE_FIRST_PARAM]: true } } } : sent.request;+ return runOnceOnKey(withVoiceFirst, a, (r) => create.mutateAsync(r)).then(+ (words) => void toast.success(words),+ (e) => toastError(e),+ );+ };++ // While hosted runs are on, "Run with your fal.ai key" is this run, once, sent by Run itself (at the price it showed);++ // otherwise as above.++ const onRunWithKey = viewerInfo?.hosted ? (a: TroubleAction) => submitRef.current(undefined, a) : runOnceWithKey;+ // "Run on Our GPUs": this run, once, on this studio's GPUs; the account's pick stays as it was.+ const onRunOnSite = () => submitRef.current(undefined, undefined, "pool");+ // A long wait on this studio's GPUs (past the policy's offer time, or until a GPU is free): an account with its own GPU,+ // or a key that runs this item's cloud version (at its price, never without one), may run this run there now, once.+ // Its pick stays as it was, and the run is taken in line all the same when it doesn't. While the day's GPU time is used+ // up, or runs there are paused, an account with nothing of its own gets the quiet way to connect its own GPU.+ // ("Now" on its GPU only while it answers.)+ const waitOffer =+ viewerInfo?.kind === "account" && poolState && !poolState.refused && poolState.long+ ? viewerInfo.gpu.connected && viewerInfo.gpu.online+ ? { label: "Run it now on your GPU", run: () => submitRef.current(undefined, undefined, "own") }+ : keyTwin && keyPrice+ ? { label: `Run it now with your ${CLOUD_KEY[keyTwin.provider].label} key · ${keyPrice}`, run: () => submitRef.current(undefined, withKeyAction(keyTwin.provider, keyTwin.modelId, keyTwin.op, keyPrice)) }+ : !viewerInfo.gpu.connected && (poolState.held === "today" || poolState.held === "service")+ ? { label: "Or connect your own GPU", run: () => void pressSetup({ need: "gpu" }) }+ : undefined+ : undefined;+ // A choice before Run for an item this studio's GPUs can't run, for an account whose key runs its cloud version (and no+ // GPU): run it once on the key, at its price, or connect a GPU. Nothing runs until one is pressed.+ const [keyChoice, setKeyChoice] = useState(false);- // `skip` is true only from the guided fix's "Run anyway" (a click handler passes its event here).- const submit = (skip?: unknown) => {+ // `skip` is true only from the guided fix's "Run anyway" (a click handler passes its event here). `withKey`: this run+ // only, on the cloud version that action names and the account's key (hosted runs on; see onRunWithKey). `once`: a+ // place for this run only (hosted runs: "Run on Our GPUs", or the account's GPU for what only it runs). `signedUp`: the+ // run a guest pressed, started by itself back from sign-up (its note says so once the run is made).+ const submit = (skip?: unknown, withKey?: TroubleAction, once?: "own" | "pool", signedUp?: boolean): void => {const skipGpu = skip === true;+ setKeyChoice(false);if (exact) {// An exact orbit: the still filmed along the orbit's numbers (Fly around), priced in its panel.const stop = !exactImage ? "Add a start frame to film an exact orbit" : fly.preview.data?.blocker;@@@ -2041,7 -1868,7 +2048,11 @@@{priceNote}</p>)}-- {!blocker && gpuSetup && (++ {/* Files missing on the viewer's GPU: the preset card's readiness line (the file, Get it, Check again), which stays++ once the card is gone. It never changes what Generate does. */}++ {!blocker && gpuSetup && gpuRef && (gpuSetup[0] === "a" || gpuSetup[0] === "s") ? (++ <GpuReadinessLine badge={gpuSetup} gpuRef={gpuRef} name={presetGpu ? preset?.name : model?.name} className="mx-1" />++ ) : !blocker && gpuSetup && (<p className="px-2 text-[12px] text-muted-foreground"><buttontype="button"@@@ -2057,33 -1884,29 +2068,51 @@@{gpuDown && (<div role="note" aria-live="polite" className="mx-1 mt-2 space-y-1.5 rounded-xl border border-dashed px-3 py-2 text-[12px] leading-snug text-muted-foreground"><p>- <span className="font-medium text-foreground">{gpuDown.words}</span> A run you start now waits for it.+ <span className="font-medium text-foreground">{gpuDown.words}</span> {beforeRunTail(gpuDown.waits)}</p><TroubleDetails details={gpuDown.details} />- <TroubleActions actions={gpuDown.actions} skip={["retry"]} handlers={{ onRunWithKey: runOnceWithKey }} />+ <TroubleActions actions={gpuDown.actions} skip={["retry"]} handlers={{ onRunWithKey, onRunOnSite }} />+ </div>+ )}+ {/* Once, for an account whose runs moved to this studio's GPUs when hosted runs went on. */}+ <PlaceIntro run="Generate" onKeep={(r) => r === "key" && engine !== "cloud" && setEngine("cloud")} />+ {/* An item that runs on an own GPU, for an account whose key runs its cloud version: one run on the key, at its price. */}+ {keyChoice && poolSetup && keyTwin && keyPrice && (+ <div role="note" aria-live="polite" className="mx-1 mt-2 space-y-1.5 rounded-xl border border-dashed px-3 py-2 text-[12px] leading-snug text-muted-foreground">+ <p>+ <span className="font-medium text-foreground">This one runs on your own GPU.</span>{" "}+ {"vramGb" in poolSetup && poolSetup.vramGb ? `It needs a GPU with ${poolSetup.vramGb} GB of memory. ` : ""}+ Your {CLOUD_KEY[keyTwin.provider].label} key runs its cloud version.+ </p>+ <div className="flex flex-wrap gap-1.5">+ <TroubleActions actions={[withKeyAction(keyTwin.provider, keyTwin.modelId, keyTwin.op, keyPrice)]} handlers={{ onRunWithKey }} />+ <button+ type="button"+ onClick={() => (setKeyChoice(false), window.dispatchEvent(new Event(CONNECT_GPU_EVENT)))}+ className="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent"+ >+ Connect your GPU+ </button>+ </div></div>+ )}+ {isolatedHere && !gpuDown && (+ <div role="note" className="mx-1 mt-2 space-y-1.5 rounded-xl border border-dashed px-3 py-2 text-[12px] leading-snug text-muted-foreground">+ <p>+ <span className="font-medium text-foreground">{ISOLATED_ON_GPU_WHY}</span>{" "}+ {isolatedTwin ? "Run it with your key instead, or pick another model." : "Pick another model to run it now."}+ </p>+ <TroubleActions+ actions={[...(isolatedTwin ? [withKeyAction(isolatedTwin.provider, isolatedTwin.modelId, isolatedTwin.op)] : []), { kind: "pick-model", label: "Pick another model" }]}+ handlers={{ onRunWithKey: runOnceWithKey, onPickModel: openModelPicker }}+ />+ </div>+ )}+ {emptyPayer && model && (+ <div role="note" className="mx-1 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-xl border border-dashed px-3 py-2 text-[12px] leading-snug text-muted-foreground">+ <p className="min-w-0 flex-1 basis-56">Your {CLOUD_KEY[emptyPayer].label} balance is empty. Add credit there, then run.</p>+ <TroubleActions actions={[{ kind: "add-credit", label: `Add credit on ${CLOUD_KEY[emptyPayer].label}`, target: BILLING_URL[emptyPayer] }]} />+ </div>)}{outcome && (<p className="px-2 pt-1 text-[12px] text-muted-foreground tabular-nums" aria-live="polite">diff --cc src/components/studio/feed.tsxindex 6636c485,c15622fd..75fa92bc--- a/src/components/studio/feed.tsx+++ b/src/components/studio/feed.tsx@@@ -18,13 -18,10 +18,15 @@@ import} from "@/components/ui/dropdown-menu";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";import { OPERATION_LABELS, type Generation } from "@/lib/catalog/types";- import { onCloudKey } from "@/lib/before-run";- import { TroubleActions, TroubleDetails } from "@/components/gpu/trouble";+ import { useOptionalCatalog } from "./catalog";+ import { TroubleDetails } from "@/components/gpu/trouble";+ import { RunTroubleActions } from "@/components/gpu/run-trouble-actions";-import { useCreateGeneration, useGenerationActions, useMakingPoolRuns, useStatus } from "@/lib/api";++import { GpuFileSteps } from "@/components/gpu/file-steps";+import { useCreateGeneration, useGenerationActions, useMakingPoolRuns, usePlaceName, useStatus } from "@/lib/api";+import { knownPlace } from "@/lib/place-name";+import { runOnSiteAction } from "@/lib/diagnose";+import { retryRequest } from "@/lib/run-place";+import { shownTroubleActions, siteRunOf, siteRunRequest } from "@/lib/site-run";import { placeholdersOn } from "@/lib/demo-mode";import { useSoulFinish } from "./soul-finish";import { elapsed, formatCost, leftLabel, notePace, ratioValue, timeAgo, timeLeft } from "@/lib/format";@@@ -170,64 -173,48 +178,84 @@@ export function PendingTile({ g, ratio);}+/** The sentences about the person's own files: the same run would only fail again, so changing the draft comes first. */+const FILE_TROUBLE: readonly string[] = Object.values(FILE_TROUBLE_WORDS);+++/** The causes a failed tile offers no Retry for (src/lib/diagnose.ts): only a fix on the GPU helps. */++const NO_RETRY_CAUSES: readonly string[] = ["gpu-comfy-known", "gpu-model-file"];+++ /** A failed tile narrower than this (in px, at the feed's 224 px height) shows two trouble buttons, not three. */+ const NARROW_TILE_PX = 260;+-export function FailedTile({ g, ratio, onRetry }: { g: Generation; ratio: number; onRetry: () => void }) {+/**+ * A run that didn't make anything. `onReuse` (the feed's Reuse: the draft comes back to change): for a run on this+ * studio's GPUs that failed on the person's own files, Reuse is the main button and Retry the quiet second.+ */+export function FailedTile({ g, ratio, onRetry, onReuse }: { g: Generation; ratio: number; onRetry: () => void; onReuse?: () => void }) {const create = useCreateGeneration();+ const feed = useContext(FeedCtx);+ const catalog = useOptionalCatalog();const trouble = g.status === "failed" ? g.trouble : undefined;+ // Hosted runs: a run that failed on the person's own GPU or key can run once on this studio's GPUs instead, when they+ // take it (on its key: its open version).+ const site = usePlaceName();+ const pool = useStatus().data?.viewer?.pool;+ const siteRun = trouble ? siteRunOf(g, !!site, pool) : null;+ const actions = trouble ? shownTroubleActions(trouble.actions, !!site) : [];// A run on this studio's GPUs that couldn't finish: one plain sentence (the server's), nothing technical.const poolFailed = g.place === "pool" && g.status === "failed";+ const reuseFirst = poolFailed && !!onReuse && FILE_TROUBLE.includes(g.error ?? "");+ const shape = Math.max(ratio, 0.8);+ const narrow = shape * 224 < NARROW_TILE_PX;+ const [retrying, setRetrying] = useState(false);++ // Retry can't help a known ComfyUI problem or a missing model file: the same run would stop the same way.++ const retryHelps = !NO_RETRY_CAUSES.includes(trouble?.cause ?? "");return (- <div className="flex h-full max-w-full flex-col justify-between rounded-xl border border-dashed bg-background p-3" style={{ aspectRatio: Math.max(ratio, 0.8) }}>- <div className="min-h-0 space-y-1 overflow-hidden">+ <div className="flex h-full max-w-full flex-col justify-between rounded-xl border border-dashed bg-background p-3" style={{ aspectRatio: shape }}>+ <div className="flex min-h-0 flex-col gap-1 overflow-hidden">{poolFailed ? (- <p className="line-clamp-5 text-[13px] leading-snug font-medium break-words">{g.error || POOL_WORDS.failed}</p>+ <p className={cn("shrink-0 text-[13px] leading-snug font-medium break-words", narrow ? "line-clamp-4" : "line-clamp-5")}>{g.error || POOL_WORDS.failed}</p>) : (<>- <p className="text-[13px] font-medium">{g.status === "canceled" ? "Canceled" : "Couldn't generate this one"}</p>- {g.error && <p className="line-clamp-5 text-[12px] leading-snug break-words whitespace-pre-line text-muted-foreground">{g.error}</p>}- {/* An account's own GPU or key: what came back, small, for the curious. */}- <TroubleDetails details={trouble?.details} />+ <p className="shrink-0 text-[13px] font-medium">{g.status === "canceled" ? "Canceled" : "Couldn't generate this one"}</p>+ {g.error && <p className={cn("shrink-0 text-[12px] leading-snug break-words whitespace-pre-line text-muted-foreground", narrow ? "line-clamp-4" : "line-clamp-5")}>{g.error}</p>}+ {/* An account's own GPU or key: what came back, small, for the curious (the first thing cut when room is short). */}+ <TroubleDetails details={trouble?.details} className="min-h-0" /></>)}</div>++ {/* A model file missing on the account's GPU: the file, where it goes, and where to get it. */}++ {g.status === "failed" && (g.fix?.code === "comfy_missing_model" || trouble?.cause === "gpu-model-file") && (++ <GpuFileSteps gpuRef={g.presetId ? `preset:${g.presetId}` : `model:${g.modelId}#${g.op}`} className="mt-2 shrink-0" />++ )}+ {/* In a studio, Pick another model brings its settings back into the composer and opens its model picker. */}{trouble && (- <TroubleActions- className="mt-2"+ <RunTroubleActions+ g={g}+ reuse={feed?.reuse}+ model={catalog?.getModel(g.modelId)}+ className="mt-2 shrink-0"- actions={trouble.actions}+ actions={siteRun && site ? [runOnSiteAction(site.label), ...actions] : actions}skip={["retry"]}- max={3}- handlers={{- onRunWithKey: (a) => create.mutate(onCloudKey(g.request, a), { onError: (e) => toastError(e) }),- onRunOnSite: () => siteRun && create.mutate(siteRunRequest(g, siteRun), { onError: (e) => toastError(e) }),- }}+ max={narrow ? 2 : 3}+ compact+ context="run"++ more={{ onRunOnSite: () => siteRun && create.mutate(siteRunRequest(g, siteRun), { onError: (e) => toastError(e) }) }}/>)}- <div className="mt-2 flex flex-wrap gap-1.5">+ <div className="mt-2 flex shrink-0 flex-wrap gap-1.5">+ {reuseFirst && (+ <button+ onClick={(e) => {+ e.stopPropagation();+ onReuse?.();+ }}+ title="Load prompt, model and settings into the composer"+ className="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-highlight px-2.5 text-[12px] font-medium text-highlight-foreground hover:opacity-90"+ >+ <RotateCcw className="size-3" /> Reuse+ </button>+ )}{g.status === "failed" && g.fix && (// Something was missing on the GPU: the guided fix shows what, and how to add it.<button@@@ -240,20 -227,19 +268,26 @@@<Wrench className="size-3" /> Fix it</button>)}-- <button- disabled={create.isPending || retrying}-- onClick={(e) => {-- e.stopPropagation();- // A second click a moment later starts nothing more (each run is billed or uses the GPU).- setRetrying(true);- setTimeout(() => setRetrying(false), 3000);-- onRetry();-- }}- className={- reuseFirst- ? // After Reuse, the quiet second: the same files would only fail again.- "inline-flex h-7 w-fit items-center gap-1.5 rounded-full px-2.5 text-[12px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground"- : "inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent"- }- className="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent disabled:opacity-70"-- >-- <RotateCcw className="size-3" /> Retry-- </button>++ {retryHelps && (++ <button++ disabled={create.isPending || retrying}++ onClick={(e) => {++ e.stopPropagation();++ // A second click a moment later starts nothing more (each run is billed or uses the GPU).++ setRetrying(true);++ setTimeout(() => setRetrying(false), 3000);++ onRetry();++ }}++ className={++ reuseFirst++ ? // After Reuse, the quiet second: the same files would only fail again.++ "inline-flex h-7 w-fit items-center gap-1.5 rounded-full px-2.5 text-[12px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-70"++ : "inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent disabled:opacity-70"++ }++ >++ <RotateCcw className="size-3" /> Retry++ </button>++ )}</div></div>);diff --cc src/components/studio/model-picker.tsxindex 8419f3f6,dc7e3d54..1042fdfe--- a/src/components/studio/model-picker.tsx+++ b/src/components/studio/model-picker.tsx@@@ -234,8 -234,14 +237,15 @@@ export function phoneName(name: string)export function ModelPicker(props: PickerProps) {const [open, setOpen] = useState(false);+ const listens = !!props.listens;+ useEffect(() => {+ if (!listens) return;+ const show = () => setOpen(true);+ window.addEventListener(OPEN_MODEL_PICKER_EVENT, show);+ return () => window.removeEventListener(OPEN_MODEL_PICKER_EVENT, show);+ }, [listens]);- const { value, models, onChange } = props;+ const { value, models, onChange, answersPick } = props;+ useEffect(() => (answersPick ? answerPickModel(() => setOpen(true)) : undefined), [answersPick]);const made = !!value && value.id === props.madeWith;// The model a dimmed row was chosen for (by this picker only): picked once its key is saved and the studio knows it// (the status has the key, so the engine switch is on Cloud and nothing swaps the model back to an open one).diff --cc src/lib/before-run.tsindex db33ca61,922567e6..073009ec--- a/src/lib/before-run.ts+++ b/src/lib/before-run.ts@@@ -7,9 -7,8 +7,9 @@@*/import { dualEngine } from "./catalog/engines";import type { Engine, GenerationRequest } from "./catalog/types";- import { runOnSiteAction, withKeyAction, type Diagnosis, type TroubleAction } from "./diagnose";-import { beforeRunWords, withKeyAction, type Diagnosis, type TroubleAction } from "./diagnose";++import { beforeRunWords, runOnSiteAction, withKeyAction, type Diagnosis, type TroubleAction } from "./diagnose";+import type { Place } from "./place-name";- import { cloudVersion, type CloudProvider } from "./your-keys";+ import { CLOUD_KEY, cloudVersion, isCloudProvider, type CloudProvider } from "./your-keys";type Routed = { id: string; engine: string; engines?: Engine[]; routes: { provider: string }[] };@@@ -57,21 -57,19 +64,22 @@@ export function gpuBeforeRun(o:const toOwnGpu = dualEngine(model) ? o.engine === "open" : model.engine === "open";const gpu = viewer.gpu;if (!toOwnGpu || !gpu.connected || gpu.mode !== "link" || gpu.online !== false) return null;- // The cloud version itself (its model and operation there), so one click runs it, once.- const found = viewer.paidAllowed !== false ? cloudVersion(o.preset, model, viewer.keys ?? [], o.has, o.getModel) : null;- const twin = viewer.paidAllowed !== false ? cloudVersion(o.preset, model, viewer.usableKeys ?? viewer.keys ?? [], o.has, o.getModel) : null;++ // The cloud version itself (its model and operation there), so one click runs it, once. With hosted runs on, only++ // with its price known (never a key billed unpriced).++ const found = viewer.paidAllowed !== false ? cloudVersion(o.preset, model, viewer.usableKeys ?? viewer.keys ?? [], o.has, o.getModel) : null;+ const twin = found && (!o.hosted || o.keyPrice) ? found : null;const base: TroubleAction[] = gpu.trouble?.actions ?? [{ kind: "check-gpu", label: "Check my GPU" },{ kind: "gpu-settings", label: "Open Settings → Your GPU", target: "/settings#your-gpu" },];- const fixes = base.filter((a) => a.kind !== "retry" && a.kind !== "run-with-key");++ const fixes = base.filter((a) => a.kind !== "retry" && a.kind !== "run-with-key" && a.kind !== "run-on-site");+ // The key's run right after the first fix (Start your pod), so a narrow composer keeps it.- const offer = twin ? [withKeyAction(twin.provider, twin.modelId, twin.op)] : [];++ const offer = twin ? [withKeyAction(twin.provider, twin.modelId, twin.op, o.hosted ? o.keyPrice : undefined)] : [];return {- words: gpu.trouble?.words ?? GPU_OFF_WORDS,+ words: gpu.trouble ? beforeRunWords(gpu.trouble.words) : GPU_OFF_WORDS,...(gpu.trouble?.details && { details: gpu.trouble.details }),- actions: [- ...(o.site ? [runOnSiteAction(o.site.label)] : []),- ...base.filter((a) => a.kind !== "retry" && a.kind !== "run-with-key" && a.kind !== "run-on-site"),- ...(twin ? [withKeyAction(twin.provider, twin.modelId, twin.op, o.hosted ? o.keyPrice : undefined)] : []),- ],- actions: [...fixes.slice(0, 1), ...offer, ...fixes.slice(1)],++ actions: [...(o.site ? [runOnSiteAction(o.site.label)] : []), ...fixes.slice(0, 1), ...offer, ...fixes.slice(1)],+ waits: gpu.trouble ? gpu.trouble.retryable : true,};}diff --cc src/lib/diagnose.tsindex 7e5b6312,8a65a718..0f5b8655--- a/src/lib/diagnose.ts+++ b/src/lib/diagnose.ts@@@ -76,11 -88,14 +88,19 @@@ export type TroubleActionKind| "pair"/** Run on the ComfyUI on this computer instead. */| "use-computer"+ /**+ * Hosted runs: run this once on this install's GPUs ("Run on Our GPUs"), offered only where they take it. One-off:+ * the account's pick of where its runs go stays as it was.+ */- | "run-on-site";++ | "run-on-site"+ /** Send a smaller copy of the file the GPU's address refused as too big (a run made again with it, on a click). */+ | "send-smaller"+ /** Run it again one size or length smaller (out of memory), on a click. */+ | "try-smaller"+ /** Open where a model file downloads from (an https link: the file, or a gated file's Hugging Face page). */+ | "get-file"+ /** Open how to update ComfyUI (an https link: ComfyUI's own guide). */+ | "update-comfy";export interface TroubleAction {kind: TroubleActionKind;@@@ -174,21 -221,31 +226,35 @@@ const A =pair: (): TroubleAction => ({ kind: "pair", label: "Pair with a code", target: "/connect" }),pick: (): TroubleAction => ({ kind: "pick-model", label: "Pick another model" }),credit: (p: CloudProvider): TroubleAction => ({ kind: "add-credit", label: `Add credit on ${CLOUD_KEY[p].label}`, target: BILLING_URL[p] }),- withKey: (p: CloudProvider): TroubleAction => ({ kind: "run-with-key", label: `Run with your ${CLOUD_KEY[p].label} key`, target: p }),+ withKey: (p: CloudProvider, price?: string | null): TroubleAction => ({ kind: "run-with-key", label: `Run with your ${CLOUD_KEY[p].label} key${price ? ` · ${price}` : ""}`, target: p }),+ smaller: (): TroubleAction => ({ kind: "send-smaller", label: "Send a smaller copy" }),+ trySmaller: (): TroubleAction => ({ kind: "try-smaller", label: "Try one size smaller" }),+ connectGpu: (): TroubleAction => ({ kind: "gpu-settings", label: "Connect your GPU", target: "/settings#your-gpu" }),+ getFile: (url: string): TroubleAction => ({ kind: "get-file", label: "Get the file", target: url }),+ updateComfy: (): TroubleAction => ({ kind: "update-comfy", label: "How to update ComfyUI", target: COMFY_UPDATE_URL }),};/*** "Run with your fal.ai key": offered on a GPU trouble when the account has a key that runs this tool's cloud version- * (`modelId`). An explicit click: it spends the person's own credit.+ * (`modelId`). An explicit click: it spends the person's own credit, so with its price when known ("Run with your+ * fal.ai key · ≈ $0.04").*/-export function withKeyAction(p: CloudProvider, modelId?: string, op?: string): TroubleAction {- return { ...A.withKey(p), ...(modelId && { modelId }), ...(modelId && op && { op }) };+export function withKeyAction(p: CloudProvider, modelId?: string, op?: string, price?: string | null): TroubleAction {+ return { ...A.withKey(p, price), ...(modelId && { modelId }), ...(modelId && op && { op }) };}+/** "Run on Our GPUs": this run, once, on this install's GPUs (hosted runs), by the name visitors read for them. */+export const runOnSiteAction = (placeLabel: string): TroubleAction => ({ kind: "run-on-site", label: `Run on ${placeLabel}` });++ /**+ * A run's buttons with "Run with your … key" right after the first (the one that fixes the GPU): a tile that shows only a+ * few keeps it. Once only.+ */+ export function withOfferAfterFirst(actions: TroubleAction[], offer: TroubleAction | null | undefined): TroubleAction[] {+ if (!offer || actions.some((a) => a.kind === "run-with-key")) return actions;+ return [...actions.slice(0, 1), offer, ...actions.slice(1)];+ }+// ---------------------------------------------------------------------------// Your GPUdiff --cc src/lib/guest-access.tsindex 72afb908,f4e7041d..36dd8ffe--- a/src/lib/guest-access.ts+++ b/src/lib/guest-access.ts@@@ -202,7 -203,7 +203,8 @@@ export function accountOwnRead(pathnamepathname === "/api/generations" ||pathname === "/api/account/gpu" ||pathname === "/api/account/keys" ||+ pathname === "/api/account/run-on" ||+ pathname === "/api/key-info" ||ACCOUNT_CANVASES.test(pathname) ||GPU_READS.has(pathname) ||COMPUTER_READ.test(pathname) ||diff --cc src/server/computer/pool.tsindex 7634d322,44cdb5d6..9f3b214a--- a/src/server/computer/pool.ts+++ b/src/server/computer/pool.ts@@@ -1101,12 -1028,11 +1101,13 @@@ const SAME_PRESS = "(CASE WHEN @hold I** - `class`: the run's ("paid" when the billing service said so, else "free").* - `rankAt`: the run's place in line. The first job any of its rows had on the workers sets it (the row itself, or a- * step of the same run that fed it). A later step with no such job yet keeps the time the run was made (less its head- * start). Null for a run's first job: it waits from now.+ * step of the same run that fed it). A row with no such job yet keeps the time the run was made (less its head start):+ * a run's first job waits in the order it came, and so does one sent again after its first send was cut off before+ * its job was made (a restart or a deploy: generations.ts sendAgainOnWorkers).* - `started`: a worker took one of those jobs. The run's wait limit no longer applies then (it applies only before the* run's first start).+ * - `later`: the row is a later step of its run (it waits for a step the same press made). It has no wait limit: its run+ * was taken in line already, so it waits at the run's place for as long as it takes.** A chain's later step and a finishing job keep the run's place this way, instead of going behind every run sent after* the run started. Only steps the same press made count (the same billing hold; with none, the same batch): a result@@@ -1136,21 -1062,10 +1137,21 @@@ export function runPlaceOf(generationId).all(press) as Pick<TaskRow, "rank_at" | "claimed_at">[];const boost = Math.max(0, Math.min(Number(g.boost) || 0, 24 * 60 * 60_000));+ const later =+ !!g.depends_on &&+ !!d+ .prepare(+ `SELECT 1 FROM generations s,+ json_each(CASE WHEN substr(s.depends_on, 1, 1) = '[' AND json_valid(s.depends_on) THEN s.depends_on ELSE json_array(s.depends_on) END) d+ JOIN generations g ON g.id = d.value+ WHERE s.id = @id AND s.depends_on IS NOT NULL AND ${SAME_PRESS} LIMIT 1`,+ )+ .get(press);return {class: g.cls === "paid" ? "paid" : "free",- rankAt: jobs[0]?.rank_at ?? (g.depends_on ? g.created_at - boost : null),+ rankAt: jobs[0]?.rank_at ?? g.created_at - boost,started: jobs.some((t) => t.claimed_at !== null),+ later,};}diff --cc src/server/generations.tsindex 900fcfa8,420df637..ec757f03--- a/src/server/generations.ts+++ b/src/server/generations.ts@@@ -95,9 -99,11 +100,12 @@@ importtype KeyStage,type RunTrouble,type TroubleAction,+ type TroubleCause,} from "@/lib/diagnose";+ import { draining } from "./shutdown";+ import { keptText, networkCode, recordOwnRun, type HostKind } from "./run-events";import { CONNECT_GPU_MESSAGE, GUEST_RUN_MESSAGE, OWN_GPU_TOOL_MESSAGE } from "@/lib/guest-access";+import { MODEL3D_SETUP, ownSetupLabel } from "@/lib/own-setup";import { outsideTenant, runAsTenant, tenant, tenantAccount } from "./tenant";import { generationAccount } from "./account-library";import { ACCOUNT_LIMITS, ACCOUNT_MESSAGES, accountTotalBytes, accountUsage, diskHasRoom, filesFullMessage } from "./account-files";@@@ -126,15 -132,14 +134,15 @@@ import { convertMask, decodePng, encodeimport { engineMode, getSetting, withCandidates, withoutCandidates } from "./settings";import { blockedForAccounts, discardBody, fetchRemoteToFile, RemoteFetchError } from "./remote-fetch";import { accountSend } from "./account-send";-import { stamped, stampOf, withoutStamp, withRunStamp } from "./run-stamp";-import { POOL_WORDS, RELAY_WORDS } from "@/lib/relay";-import { placeInLine, poolOnWorkers, poolRunsProvider, poolWaitMs, runOnPool } from "./hosted";+import { stamped, stampOf, withoutStamp, withRunStamp, type RunStamp } from "./run-stamp";- import { anyHeld, dropGone, dropHold, HELD, holdRun, NOT_HELD } from "./pool-holds";- import { ACTIVE_STATES, FILE_TROUBLE_WORDS, POOL_WORDS, RELAY_WORDS } from "@/lib/relay";++import { anyHeld, dropGone, dropHold, HELD, NOT_HELD } from "./pool-holds";++import { FILE_TROUBLE_WORDS, POOL_WORDS, RELAY_WORDS } from "@/lib/relay";+import { heldLine, placeInLine, poolOnWorkers, poolRunsProvider, poolWaitMs, runOnPool } from "./hosted";import { hostedRunsOn } from "./hosted-switch";import { catalogVersion } from "./computer/catalog-version";-import { poolLane, queueOfGeneration } from "./computer/pool";+import { gettingReady, poolLane, queueOfGeneration, type LinePlace } from "./computer/pool";import { noteCatalogProcess, processStart } from "./computer/ticket-refresh";- import { endTask, runPreviewAt } from "./computer/tasks";+ import { hasJobFor, runPreviewAt, stopJobsOf } from "./computer/tasks";import { runCeilingMs } from "./queue-settings";import { sweepBilling } from "./billing-outbox";import { inDemoScope, outsideDemo } from "./demo-scope";@@@ -1642,7 -1766,7 +1847,7 @@@ const READY_DEPENDENTS = `SELECT g.* FRNOT EXISTS (SELECT 1 FROM ${DEP_IDS} JOIN generations dep ON dep.id = d.value WHERE dep.status IN ('queued', 'running'))OR EXISTS (SELECT 1 FROM ${DEP_IDS} LEFT JOIN generations dep ON dep.id = d.value WHERE dep.id IS NULL OR dep.status IN ('failed', 'canceled')))- AND NOT ${SENT_ELSEWHERE("g")} AND ${NOT_HELD("g")}- AND NOT ${TURN_HELD("g", true)}++ AND NOT ${TURN_HELD("g", true)} AND ${NOT_HELD("g")}ORDER BY g.created_at ASC LIMIT @limit`;/** The error a waiting step gets when an input failed (framesProgress tells these from a step's own failure). */@@@ -1710,9 -1836,12 +1917,12 @@@ export const COMFY_WAIT = { ms: 60_000/** Launch dependent jobs whose inputs finished; fail the ones whose inputs failed. Never waits for an upload. */async function advanceDependents(): Promise<void> {+ // A server that is stopping launches no step (the app process that goes on does), and leaves the steps it looked at.+ if (draining()) return;+ const now = Date.now();const rows = db().prepare(READY_DEPENDENTS)- .all({ limit: 50 + submitting().size + parked().size, me: runnerToken(), quiet: Date.now() - QUIET_MS }) as Row[];- .all({ limit: 50 + submitting().size, __me: runnerToken(), __quiet: now - QUIET_MS, __now: now }) as Row[];++ .all({ limit: 50 + submitting().size + parked().size, __me: runnerToken(), __quiet: now - QUIET_MS, __now: now }) as Row[];// A forced look at ComfyUI, at most one a sweep, for the steps that found it not answering.let lookedAgain: Promise<boolean> | undefined;for (const r of rows) {@@@ -2073,7 -2237,7 +2318,7 @@@ const poolOf = (r: Pick<Row, "request_j}};- function submit(id: string, route: ModelRoute, providerId: ProviderId, plan: ReturnType<typeof planGeneration>, req: GenerationRequest, index: number, rankAt?: number): Promise<void> {-function submit(id: string, route: ModelRoute, providerId: ProviderId, plan: ReturnType<typeof planGeneration>, req: GenerationRequest, index: number, resume?: HealState): Promise<void> {++function submit(id: string, route: ModelRoute, providerId: ProviderId, plan: ReturnType<typeof planGeneration>, req: GenerationRequest, index: number, resume?: HealState, rankAt?: number): Promise<void> {if (!req.account) return submitNow(id, route, providerId, plan, req, index);// On this install's GPUs (hosted runs): as the account, on this install's ComfyUI server only.if (req.place === "pool") {@@@ -2248,28 -2630,13 +2713,29 @@@ export function cloudTwin(req: Pick<Gen}/**- * A GPU trouble's buttons, with "Run with your … key" when one of the account's keys runs this tool's cloud version.- * While hosted runs are on, only with its price (a key is never billed by a press that showed none).+ * A GPU trouble's buttons, with "Run with your … key" when one of the account's keys runs this tool's cloud version: right- * after the first (the one that fixes the GPU), so a tile that shows only a few keeps it.++ * after the first (the one that fixes the GPU), so a tile that shows only a few keeps it. While hosted runs are on, only++ * with its price (a key is never billed by a press that showed none).*/-function withKeyOffer(actions: TroubleAction[], account: string, req: Pick<GenerationRequest, "presetId" | "modelId">): TroubleAction[] {+function withKeyOffer(actions: TroubleAction[], account: string, req: Pick<GenerationRequest, "presetId" | "modelId" | "params" | "op">): TroubleAction[] {if (actions.some((a) => a.kind === "run-with-key")) return actions;const twin = cloudTwin(req, account);- return withOfferAfterFirst(actions, twin && withKeyAction(twin.provider, twin.modelId, twin.op));+ if (!twin) return actions;- if (!hostedRunsOn()) return [...actions, withKeyAction(twin.provider, twin.modelId, twin.op)];++ if (!hostedRunsOn()) return withOfferAfterFirst(actions, withKeyAction(twin.provider, twin.modelId, twin.op));+ const price = keyRunPrice(twin, req);- return price ? [...actions, withKeyAction(twin.provider, twin.modelId, twin.op, price)] : actions;++ return price ? withOfferAfterFirst(actions, withKeyAction(twin.provider, twin.modelId, twin.op, price)) : actions;+}++/** A run's price on its cloud version (one run, at the request's settings), as a key offer says it ("≈ $0.04"), or null. */+function keyRunPrice(twin: { modelId: string; op?: string }, req: Pick<GenerationRequest, "params" | "op">): string | null {+ const m = getModel(twin.modelId);+ if (!m) return null;+ try {+ const usd = estimateCost(dualEngine(m) ? onEngine(m, "cloud") : m, req.params ?? {}, 1, (twin.op ?? req.op) as Operation | undefined, false);+ return usd != null && usd > 0 ? `≈ ${formatCost(usd)}` : null;+ } catch {+ return null;+ }}/**@@@ -2852,20 -3343,25 +3442,27 @@@ function startRunner(): void}/**- * Jobs that never got an external id (the server died mid-submit) can't be recovered. Runs every tick. One another app- * process that still runs is sending (a deploy's overlap: an account's files waiting their turn to go) is left to it, and- * so is a run made to wait to enter the line (pool-holds.ts). With hosted runs on, a run on this install's GPUs that was- * cut off between its row and its GPU task (a deploy, a crash) isn't failed: it waits to enter the line again at its- * press-time place, and the release loop makes its GPU task (pool-release.ts). Every other row fails as before.+ * Runs with no job yet that no app process that still runs is handing over (takeSubmitTurn: its process stopped, by a+ * restart, or a deploy's old instance gone). One waiting for its own GPU or key goes on here, with what is left of its+ * wait (one process takes it); so does one on this install's workers whose job was never made (sendAgainOnWorkers). One+ * cut off in the middle of its hand-over can't be recovered, and fails. A run a process that still runs is sending or- * waiting on (this one, or another in a deploy's overlap) is left to it. Runs at start and every tick; not while this++ * waiting on (this one, or another in a deploy's overlap) is left to it, and so is a run made to wait to enter the line++ * (pool-holds.ts). Runs at start and every tick; not while this+ * server stops (the app process that goes on looks).*/function sweepInterrupted(): void {+ if (draining()) return;const now = Date.now();const rows = db().prepare(- `SELECT g.id, g.batch_id, g.created_at, g.request_json FROM generations g WHERE g.status IN ('queued','running') AND g.external_id IS NULL AND g.depends_on IS NULL AND g.created_at < @before- AND NOT ${SENT_ELSEWHERE("g")} AND ${NOT_HELD("g")}`,+ `SELECT g.id, g.provider, g.model_id, g.op, g.request_json, g.external_meta_json, g.batch_id, g.created_at FROM generations g- WHERE g.status IN ('queued','running') AND g.external_id IS NULL AND g.depends_on IS NULL AND g.created_at < @before AND NOT ${TURN_HELD("g", false)}`,++ WHERE g.status IN ('queued','running') AND g.external_id IS NULL AND g.depends_on IS NULL AND g.created_at < @before AND NOT ${TURN_HELD("g", false)}++ AND ${NOT_HELD("g")}`,)- .all({ before: now - STALE_SUBMIT_MS, me: runnerToken(), quiet: now - QUIET_MS }) as Pick<Row, "id" | "batch_id" | "created_at" | "request_json">[];+ .all({ before: now - STALE_SUBMIT.ms, __me: runnerToken(), __quiet: now - QUIET_MS, __now: now }) as Pick<+ Row,+ "id" | "provider" | "model_id" | "op" | "request_json" | "external_meta_json" | "batch_id" | "created_at"+ >[];const busy = submitting();for (const r of rows) {if (busy.has(r.id)) continue;@@@ -2913,56 -3470,22 +3571,85 @@@ function takeOver(r: Pick<Row, "id" | "return true;}+ /**+ * A run that waited for its own GPU or key, planned again after a restart or a deploy (takeOver, or advanceDependents for+ * a step of a longer run), that would now go to another provider than the one it waited for: it stops in plain words and+ * is never sent there, since nobody pressed Run there. `was`: the provider it was made for.+ */+ function stopReplanned(id: string, was: string, account: string, p: { plan: { model: { id: string }; op: string } }, stage: "submit" | "chain"): void {+ const facts: RunFacts = { provider: was, model: p.plan.model.id, op: p.plan.op, stage };+ if (was === "comfyui") {+ const gpu = accountGpu(account);+ const end = diagnoseGpuJob({ kind: gpu ? "moved" : "disconnected" }, { kind: "link", url: gpuLink(gpu)?.url ?? "" });+ failRun(id, new Error("moved"), end, account, facts);+ } else if (updateLive(id, { status: "failed", error: "This run stopped because your keys changed while it waited. Press Retry.", completed_at: Date.now(), message: null }, " AND external_id IS NULL")) {+ ownFailed(id, account, facts, "keys-changed");+ }+ }+++/**++ * Hosted runs were switched off while runs waited to enter the line: nothing will release them, so they end as a run cut++ * off before it started does (the sweep's words), and their holds go. What the billing service set aside for them goes++ * back (each ended row's report closes its hold; a run whose reserve was never answered is released by its request id).++ */++function endHeldRuns(): void {++ const rows = db()++ .prepare(`SELECT g.id FROM generations g WHERE g.status = 'queued' AND g.external_id IS NULL AND ${HELD("g")}`)++ .all() as { id: string }[];++ for (const r of rows) updateLive(r.id, { status: "failed", error: "This run stopped before it started. Press Retry.", completed_at: Date.now(), message: null });++ dropGone();++}+++/**+ * Send a row of a run that waited to enter the line (pool-release.ts): planned again from its stored request, as its+ * run's place and stamp say, as job `job` of its run, taking its place at `rankAt` (its press) or now. False when it+ * doesn't wait to be sent any more (stopped meanwhile), or its plan can't be made (it fails in its words then).+ */+export function sendHeld(id: string, job: number, rankAt?: number): boolean {+ const r = db().prepare("SELECT * FROM generations WHERE id = ?").get(id) as Row | undefined;+ if (!r || r.status !== "queued" || r.external_id) return false;+ let stored: GenerationRequest;+ try {+ stored = JSON.parse(r.request_json) as GenerationRequest;+ } catch {+ return false;+ }+ const account = stored.account;+ if (!account || stored.place !== "pool") return false;+ let p: ReturnType<typeof prepare>;+ try {+ p = runOnPool(account, () => withRunStamp(stampOf(stored), () => prepare(stored)));+ } catch (e) {+ updateLive(id, { status: "failed", error: (e as Error).message, completed_at: Date.now(), message: null });+ return false;+ }+ submitting().add(id);- void submit(id, p.route, p.providerId, p.plan, p.req, job, rankAt);++ void submit(id, p.route, p.providerId, p.plan, p.req, job, undefined, rankAt);+ return true;+}++/** End the rows of a run that waited to enter the line, in words (a service refused it once it answered). */+export function failWaiting(ids: string[], error: string): void {+ for (const id of ids) {+ const r = db().prepare("SELECT status, external_id FROM generations WHERE id = ?").get(id) as Pick<Row, "status" | "external_id"> | undefined;+ if (r?.status === "queued" && !r.external_id) updateLive(id, { status: "failed", error, completed_at: Date.now(), message: null });+ }+}++/**+ * Add to the stamp of a run's rows (a run that waited for the billing service: its hold, once made; the moderation+ * service's ask to see its outputs). The rest of each row's stamp stays.+ */+export function restampRows(ids: string[], add: RunStamp): void {+ for (const id of ids) {+ const r = db().prepare("SELECT request_json FROM generations WHERE id = ?").get(id) as Pick<Row, "request_json"> | undefined;+ if (!r) continue;+ const stored = JSON.parse(r.request_json) as GenerationRequest;+ const next = withRunStamp({ ...stampOf(stored), ...add }, () => stamped(stored));+ update(id, { request_json: JSON.stringify(next) });+ }+}+async function pollGuarded(r: Row): Promise<void> {const polling = (globalThis.__fuobeRunner!.polling ??= new Set());if (polling.has(r.id)) return;diff --cc src/server/pool-limits.tsindex 92c609f6,3e1272bf..f9a6400c--- a/src/server/pool-limits.ts+++ b/src/server/pool-limits.ts@@@ -94,27 -105,17 +115,36 @@@ export function accountActiveRuns(accoureturn r.n + openCount(accountId, false);}+ /** An account's runs waiting for its own GPU to come back (WAITING_FOR_GPU), but those a new run takes the place of. */+ export function accountWaitingRuns(accountId: string, except: readonly string[] = []): number {+ const r = db()+ .prepare(`SELECT COUNT(DISTINCT COALESCE(batch_id, id)) AS n FROM generations WHERE status = 'queued' AND json_extract(request_json, '$.account') = ? AND ${WAITING_FOR_GPU} AND ${NOT_REPLACED}`)+ .get(accountId, JSON.stringify(except)) as { n: number };+ return r.n;+ }++/**+ * An account's runs going now that the studio's own limit of runs at once counts (ACCOUNT_LIMITS.activeRuns): with+ * hosted runs off, every run (accountActiveRuns, as always); with them on, its runs on its own GPU or its own key, and+ * its light work (joins, trims: free, on this install's CPU, and counted by none of the policy's limits), as its other- * runs on this install's GPUs meet the policy's limits instead.++ * runs on this install's GPUs meet the policy's limits instead. `o`: as a studio's Run counts them (StudioCount).+ */- export function ownActiveRuns(accountId: string): number {- if (!hostedRunsOn()) return accountActiveRuns(accountId);++export function ownActiveRuns(accountId: string, o: StudioCount = {}): number {++ if (!hostedRunsOn()) return accountActiveRuns(accountId, o);++ const waiting = o.waitingApart ? ` AND NOT ${WAITING_FOR_GPU}` : "";+ const r = db()+ .prepare(+ `SELECT COUNT(DISTINCT COALESCE(batch_id, id)) AS n FROM generations WHERE status IN ('queued', 'running') AND json_extract(request_json, '$.account') = ?- AND (json_extract(request_json, '$.place') IS NOT 'pool' OR json_extract(request_json, '$.light') IS 1)`,++ AND (json_extract(request_json, '$.place') IS NOT 'pool' OR json_extract(request_json, '$.light') IS 1)${waiting} AND ${NOT_REPLACED}`,+ )- .get(accountId) as { n: number };++ .get(accountId, JSON.stringify(o.except ?? [])) as { n: number };+ return r.n + openCount(accountId, false) - openCount(accountId, true);+}+/*** An account's runs going now on this install's GPUs, and how many of them haven't started yet (no row of theirs has).- * Runs of light work only (joins, trims) don't count. A run let in whose rows are still being made counts as one in line.+ * Runs of light work only (joins, trims) don't count, nor do runs waiting to enter the line (pool-holds.ts). A run let in+ * whose rows are still being made counts as one in line.*/export function poolRunCounts(accountId: string): { active: number; waiting: number } {const r = db()@@@ -265,29 -221,16 +295,37 @@@ export function lineRoom(policy: Pick<P}/**- * The studio's own limit of runs at once (every account run, wherever it goes), as a refusal. `studio`: a studio's Run,- * counted as StudioCount says; with `mayWait` (a run for the account's own GPU, which may wait for it) the runs waiting- * for that GPU meet a limit of their own too.+ * A press past the cap on an account's runs on the way (billing.ts heldCap: the policy's `limits.held` waiting behind+ * its runs at once, 8 behind 2 at launch: 10 in all; 0: no cap), as a refusal; null while there is room. Runs held for+ * any reason count, so a quiet service or the day's GPU time used up never lets more wait than that. `c`: its runs going+ * now (poolRunCounts), counted with the waiting ones in the words.+ */+export function heldCapRefusal(accountId: string, policy: Pick<Policy, "limits">, c = poolRunCounts(accountId)): LimitRefusal | null {+ const cap = heldCap(policy);+ if (!cap) return null;+ const held = heldRuns(accountId);+ const room = lineRoom(policy, c);+ if (held < cap + (Number.isFinite(room) ? room : 0)) return null;+ return { status: 429, error: POOL_LIMIT_WORDS.heldCap(c.active + held), code: ACTIVE_RUNS_CODE, retryAfterS: 30 };+}++/** The first of the policy's limits this run would be refused for, or null (poolLimitPlan; a run that waits is no refusal). */+export function poolLimitRefusal(accountId: string, policy: Pick<Policy, "limits">, addr: string | null | (() => string | null), now = Date.now()): LimitRefusal | null {+ const plan = poolLimitPlan(accountId, policy, addr, now);+ return "refuse" in plan ? plan.refuse : null;+}+- /** The studio's own limit of runs at once (ownActiveRuns), as a refusal. */- function accountLimitRefusal(accountId: string): LimitRefusal | null {- return ownActiveRuns(accountId) >= ACCOUNT_LIMITS.activeRuns ? { status: 429, error: ACCOUNT_MESSAGES.activeRuns, code: ACTIVE_RUNS_CODE, retryAfterS: 30 } : null;++/**++ * The studio's own limit of runs at once (ownActiveRuns), as a refusal. `studio`: a studio's Run, counted as StudioCount++ * says; with `mayWait` (a run for the account's own GPU, which may wait for it) the runs waiting for that GPU meet a++ * limit of their own too.+ */+ function accountLimitRefusal(accountId: string, studio?: StudioCount & { mayWait?: boolean }): LimitRefusal | null {+ if (studio?.mayWait && accountWaitingRuns(accountId, studio.except) >= ACCOUNT_LIMITS.waitingRuns) {+ return { status: 429, error: ACCOUNT_MESSAGES.waitingRuns, code: ACTIVE_RUNS_CODE, retryAfterS: 30 };+ }- const n = accountActiveRuns(accountId, studio ? { except: studio.except, waitingApart: true } : {});++ const n = ownActiveRuns(accountId, studio ? { except: studio.except, waitingApart: true } : {});+ return n >= ACCOUNT_LIMITS.activeRuns ? { status: 429, error: ACCOUNT_MESSAGES.activeRuns, code: ACTIVE_RUNS_CODE, retryAfterS: 30 } : null;}/** A refusal thrown inside admitRun's transaction, so nothing `make` wrote is kept. */@@@ -338,8 -275,7 +378,8 @@@ export function admitRun<T, P = never>.transaction((): Answer | null => {const prior = o.prior?.() ?? null;if (prior !== null) return { ok: false, prior };- const refusal = accountLimitRefusal(o.accountId, o.studio) ?? (o.pool ? poolLimitRefusal(o.accountId, o.pool.policy, o.pool.addr, now) : null);+ const plan: LimitPlan = o.pool ? poolLimitPlan(o.accountId, o.pool.policy, o.pool.addr, now) : { go: true };- const refusal = (o.pool ? null : accountLimitRefusal(o.accountId)) ?? ("refuse" in plan ? plan.refuse : null);++ const refusal = (o.pool ? null : accountLimitRefusal(o.accountId, o.studio)) ?? ("refuse" in plan ? plan.refuse : null);if (refusal) {refused?.(refusal);return { ok: false, refusal };diff --cc src/server/providers/comfyui.tsindex 331a7f7d,26912f7c..c5a671ac--- a/src/server/providers/comfyui.ts+++ b/src/server/providers/comfyui.ts@@@ -45,7 -46,8 +46,11 @@@ import { outsideTenant, runAsTenant, teimport { ask, checkReach, reachSync, sharedCheck, type Reach } from "./reach";import { ProviderError, type PollResult, type ProviderAdapter, type RemoteOutput } from "./types";import { isOutOfMemory } from "@/lib/gpu/fix-codes";- import { diagnoseGpu, diagnoseGpuJob, diagnoseRefusal, type Diagnosis, type GpuFailure, type GpuStage } from "@/lib/diagnose";+ import { diagnoseGpu, diagnoseGpuJob, diagnoseRefusal, isLoaderNode, loaderFiles, MODEL_FILE, modelFileProblem, type Diagnosis, type GpuFailure, type GpuJobTrouble, type GpuPlace, type GpuStage } from "@/lib/diagnose";+ import { hfPage } from "@/lib/gpu/plan";++import { fileTitle } from "@/lib/gpu/readiness";++import { formatBytes } from "@/lib/gpu/requirements";++import type { FileKey } from "@/lib/gpu/types";import {makingWords,META_BATCH_HISTORY,@@@ -1269,9 -1296,9 +1304,11 @@@ export function promptRefusal): { message?: string; fix?: ReturnType<typeof fixFromPromptError>; details?: string; plain?: true } {// The index names the pack a missing class comes from, so the message names that pack, not every pack the workflow uses.let packOf: (cls: string) => string | undefined = () => undefined;++ let idx: ReturnType<typeof loadIndex> | undefined;try {-- const idx = loadIndex();-- packOf = (cls) => Object.entries(idx.packs).find(([, p]) => p.classes.includes(cls))?.[0];++ const index = loadIndex();++ idx = index;++ packOf = (cls) => Object.entries(index.packs).find(([, p]) => p.classes.includes(cls))?.[0];} catch {}const fix = fixFromPromptError(body, manifest.id, manifest.models, packOf);const missingClass = fix?.code === "comfy_missing_node" ? fix.items[0] : undefined;@@@ -1309,7 -1336,7 +1346,12 @@@const words =fix.code === "comfy_missing_node"? `Your ComfyUI needs one add-on for this: ${name}. Press Fix it to add it.`-- : `Your ComfyUI needs one more file for this: ${name}. Press Fix it to see how to add it.`;++ : (() => {++ // The file as the index knows it: its title, size and folder.++ const f = first?.folder && first.file ? idx?.files[`${first.folder}/${first.file}` as FileKey] : undefined;++ const what = f ? `the ${fileTitle(f.folder, f.file)} (${f.file}, ${formatBytes(f.sizeBytes)})` : name;++ return `Your GPU needs ${what} in ComfyUI/models/${f?.folder ?? first?.folder ?? ""}. Press Fix it to get it, then Check again.`;++ })();return { message: words, fix, plain: true, ...(detail && detail !== words && { details: detail.replace(/\s*\(see scripts\/comfy\/README\.md\)/, "") }) };}}diff --cc src/server/request-schema.tsindex 255b356a,e141751f..f2c475fd--- a/src/server/request-schema.ts+++ b/src/server/request-schema.ts@@@ -127,8 -127,8 +127,10 @@@ export const GenerationRequestSchema =// A Fuobe Original runs on both engines: the one to run on (the composer's switch). Unset: the engine mode, else// the first connected.engine: z.enum(["open", "cloud"]).optional(),+ // "Run without LoRAs": an @element with a trained LoRA goes in as its photos instead.+ lorasOff: z.literal(true).optional(),+ // The provider whose key a cloud run goes on when the model is on several ("Run with your Replicate key").+ prefer: z.enum(["fal", "replicate"]).optional(),// A recipe's LoRAs (the evaluation harness, scripts/eval): added after the preset's own. On ComfyUI `file` must// already be in models/loras (ComfyUI checks the name against its list); a cloud LoRA endpoint takes `url`.loras: zdiff --cc src/server/run-stamp.tsindex 67c35fec,b78750b7..34fdb0f3--- a/src/server/run-stamp.ts+++ b/src/server/run-stamp.ts@@@ -34,11 -33,8 +36,13 @@@ export interface RunStampboostMs?: number;/** Light work only (hosted-run.ts lightRun): free, and not counted against the policy's limits. */light?: boolean;+ /**+ * In scope only, never stored (not a STAMP_FIELDS field): the time a run that waited to enter the line takes its place+ * at (its press, pool-holds.ts), when its first job is sent. Absent: the time it is sent.+ */+ rankAt?: number;+ /** Made on its own in a studio, not by a tool for one of the account's projects. */+ standalone?: boolean;}declare global {