The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(create-studio): Runde 2, alle Blocker aus review-studio-A/B behoben
purpleff050e2503cc
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1b869e8e..1f46a390 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,9 +15,11 @@ installs stop losing environment variables to it.controls come straight from the picked model's own provider schema, and theprice shown is the one the provider actually confirms before Start, never aformula guessed on this side. This needs a server change that has not- shipped on lu-labs.ai yet; until it does, Create shows "This feature needs a- newer LU Cloud server. Try again later." instead of guessing a price or- booking one.+ shipped on lu-labs.ai yet; until it does, the shelf stays hidden and every+ Create tab behaves exactly as before. If a future server ever advertises+ Studio without also fixing the two price-check routes, Create shows "This+ feature needs a newer LU Cloud server. Try again later." instead of+ guessing a price or booking one.- **Cloud video renders now offer exactly the clip lengths the picked modelactually supports**, read from the live catalog, instead of a fixed 5s/8spair for every model.diff --git a/e2e/create-studio.spec.ts b/e2e/create-studio.spec.tsindex 102ae9c7..71d7ac6c 100644--- a/e2e/create-studio.spec.ts+++ b/e2e/create-studio.spec.ts@@ -12,7 +12,7 @@ import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch, type CloudS* (e2e/create-expert-section.spec.ts ist der eigentliche Beweis dafuer;* hier nur die Randbedingung, dass das Studio ihn nicht verdraengt).* (c) ein aelterer Server (Katalog ohne `quote_required` auf irgendeinem- * Eintrag) zeigt keine Schiene — Erkennung laeuft nur ueber das Feld,+ * Eintrag) zeigt keine Schiene. Erkennung laeuft nur ueber das Feld,* nie eine Versionsnummer (Portplan Abschnitt 4).* (d) `studio-quote` antwortet 404: Start bleibt gesperrt, der feste Satz* steht da, nie ein Rueckfall auf die eigene Formel.@@ -67,7 +67,7 @@ test('cloud track with a Studio catalog: the shelf appears, opens the workshop,await page.keyboard.press('Escape')await expect(dialog).toBeHidden()- // Reopen the same preset for the X case — Escape's own test above already+ // Reopen the same preset for the X case. Escape's own test above already// proved it, this proves the OTHER half of the popup house rule// (feedback-sampling-popup-mit-x.md: a popup is X AND Escape, never just// one of the two). The shelf itself is still expanded (Escape only closed@@ -82,7 +82,7 @@ test('local track: no shelf at all, even with a Studio catalog on the wire', asyawait bootIntoLocalCreate(page, { license: 'active', access: true, mediaLive: true, studioCatalog: true })await expect(presetShelf(page)).toHaveCount(0)- // The expert section still opens on the local track exactly as before —+ // The expert section still opens on the local track exactly as before:// the Studio port replaces AdvancedDrawer's body only behind a Studio// pick (backend === 'cloud' AND a resolved Studio model), never on local.await page.getByRole('radio', { name: 'Image', exact: true }).click()@@ -111,7 +111,7 @@ test('studio-quote answers 404: start stays locked, the version-gap message showawait expect(page.getByRole('alert')).toHaveText('This feature needs a newer LU Cloud server. Try again later.', { timeout: 15_000 })await expect(page.getByRole('button', { name: /^Generate$/ })).toBeDisabled()// The dialog still shows its own client-side PREVIEW ("≈ NNN credits",- // studio-contract.ts's formula) — that is allowed, it is clearly marked+ // studio-contract.ts's formula), and that is allowed: it is clearly marked// as an estimate and never what the run would book. What must NOT appear// is a CONFIRMED price (no "≈"): that string only ever comes from a// successful studio-quote() call, and would mean the app fell back to@@ -133,7 +133,7 @@ test('the presenter picker opens inline, not as a popup (P4, offen fuer P9)', as// AvatarPicker (SchemaControl's 'avatar' field) is a field that opens in// the normal document flow below its button, not a floating dialog of its- // own — the popup house rule (X + Escape) only applies where the source+ // own. The popup house rule (X + Escape) only applies where the source// actually renders a floating overlay, and this field never did (P4's// report on AvatarPicker.tsx). Proven two ways: no second dialog appears,// and Escape here closes the WORKSHOP dialog, not just a picker inside it.@@ -147,8 +147,8 @@ test('the cloud Length control follows clip.durations from the catalog, not a fiawait page.getByRole('radio', { name: /^Video$/ }).click()// Segmented (Composer.tsx's LabeledControl) does not wire an aria-label- // onto the "Length" radiogroup itself — "Length" is a sibling <span>, not- // an aria-labelledby target — so the three second-values themselves are+ // onto the "Length" radiogroup itself ("Length" is a sibling <span>, not+ // an aria-labelledby target), so the three second-values themselves are// the only reliable locator; they read as plain "Ns" nowhere else on the// Create surface (the Size control's options are "Xp", the steps slider// has no radio role at all).@@ -159,3 +159,101 @@ test('the cloud Length control follows clip.durations from the catalog, not a fiawait expect(page.getByRole('radio', { name: '5s' })).toHaveCount(0)await expect(page.getByRole('radio', { name: '8s' })).toHaveCount(0)})++// Review B1 (review-studio-B.md): the Composer's role-intent picker+// (Extend, Motion) is gated on `quote_required` too now, the same way+// PresetShelf already was. Measured on the un-fixed branch: Extend resolved+// to the Studio twin `preset-wan-2.2-spicy-extend` (price.mode 'output'),+// which called studio-quote, hit 404/CORS on this catalog, and showed the+// version-gap alert on a lane that used to just work; Motion resolved to+// `scail-2` (price.mode 'input'), which never calls studio-quote at all, so+// the button stayed enabled and the run only failed once the OLD server+// rejected `op: 'studio'`. Both must now stay on their classic twins.+test('an older server (no quote_required): Extend and Motion behave exactly as before the Studio port', async ({ page }) => {+ const studioQuoteCalls: string[] = []+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true }) // studioCatalog left unset+ page.on('request', (req) => { if (req.url().includes('/api/jobs/studio-quote')) studioQuoteCalls.push(req.url()) })++ await page.getByRole('radio', { name: 'Extend Video' }).click()+ // The classic twin from the mocked catalog, not a Studio id: proves+ // resolveIntentPick fell back instead of picking a model this server+ // never announced.+ await expect(page.getByRole('button', { name: /Wan 2\.2 Spicy Extend/ })).toBeVisible({ timeout: 15_000 })+ // The old, pre-Studio failure mode: no version-gap alert, because no+ // studio-quote call was ever made for a classic pick. (This app always+ // shows an unrelated "ComfyUI is not running" banner on the cloud track+ // with no local engine mocked, hence checking the TEXT, not alert count.)+ await expect(page.getByText('This feature needs a newer LU Cloud server')).toHaveCount(0)++ await page.getByRole('radio', { name: 'Motion Control' }).click()+ await expect(page.getByRole('button', { name: /Wan 2\.2 Animate/ })).toBeVisible({ timeout: 15_000 })+ await expect(page.getByText('This feature needs a newer LU Cloud server')).toHaveCount(0)++ expect(studioQuoteCalls, studioQuoteCalls.join(', ')).toHaveLength(0)+})++// Review B2 (review-studio-B.md): the Preset window used to abandon its+// paid-for step state whenever Escape/X closed it (Modal's default+// AnimatePresence unmount). `keepMounted` (Modal.tsx) fixes it by never+// unmounting the workshop while `selectedPreset` still names it; this proves+// the actual customer-visible contract, not the implementation: step 1+// stays finished, and Continue does NOT re-book it.+test('closing the workshop with Escape and reopening keeps a finished step finished (Review B2)', async ({ page }) => {+ const submitCalls: string[] = []+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true, studioCatalog: true })+ page.on('request', (req) => {+ if (req.method() === 'POST' && new URL(req.url()).pathname === '/api/jobs') submitCalls.push(req.url())+ })++ await expandPresets(page).click()+ await page.getByRole('button', { name: /Song from Words/ }).click()+ const dialog = page.getByRole('dialog', { name: 'Song from Words' })+ await expect(dialog).toBeVisible({ timeout: 15_000 })++ await page.getByLabel('Preset prompt').fill('a bright acoustic tune about a summer road trip')+ await expect(page.getByRole('button', { name: /^Generate$/ })).toBeEnabled({ timeout: 15_000 })+ await page.getByRole('button', { name: /^Generate$/ }).click()+ await expect(page.getByText('Saved to your gallery')).toBeVisible({ timeout: 15_000 })+ expect(submitCalls).toHaveLength(1)++ // Close with Escape (the exact path B2 found broken), not the Done button.+ await page.keyboard.press('Escape')+ await expect(dialog).toBeHidden()++ // Reopen via the shelf's own "Continue" affordance. Scoped to the shelf+ // itself: a preset card's own accessible name can otherwise collide with+ // a loose "Continue" match elsewhere on the page.+ await presetShelf(page).getByRole('button', { name: 'Continue', exact: true }).click()+ await expect(dialog).toBeVisible({ timeout: 15_000 })++ // The finished result is still there: no second upload/prompt/generate+ // round-trip, and critically no second booking.+ await expect(dialog.getByText('Saved to your gallery')).toBeVisible()+ expect(submitCalls, 'must not re-book a step the customer already paid for').toHaveLength(1)+})++// Review A kleiner Punkt 1: the cloud Length control used to read/write the+// SAME frames/fps the local video lane's own Frames slider owns, so picking+// a cloud length silently rewrote what the local track would remember.+// cloudFrames/cloudFps (createStore.ts) are now separate fields; this proves+// it from the customer's side: pick a non-default cloud length, switch to+// local, and the local Frames slider still shows its untouched default.+test('picking a cloud clip length leaves the local Frames slider untouched (Review A kleiner Punkt 1)', async ({ page }) => {+ await bootIntoCloudCreate(page, { license: 'active', access: true, mediaLive: true, studioCatalog: true })++ await page.getByRole('radio', { name: /^Video$/ }).click()+ await expect(page.getByRole('radio', { name: '9s' })).toBeVisible({ timeout: 15_000 })+ // Default snaps to the shortest option (4s); pick a different one so any+ // leak into the local frames/fps would actually be visible below.+ await page.getByRole('radio', { name: '9s' }).click()+ await expect(page.getByRole('radio', { name: '9s' })).toBeChecked()++ await cloudSwitch(page).click()+ await expect(cloudSwitch(page)).not.toBeChecked()+ await page.getByRole('radio', { name: /^Video$/ }).click()++ // Local video's own Frames slider: unchanged default is 24 frames at 8fps+ // (3.0s), the format Composer's LaneControls Slider uses. A leak from the+ // 9s cloud pick would show "144f" (9 * 16) instead.+ await expect(page.getByText('24f · 3.0s')).toBeVisible({ timeout: 15_000 })+})diff --git a/e2e/support/cloud-mock.ts b/e2e/support/cloud-mock.tsindex 8d41a0b3..9ae5846f 100644--- a/e2e/support/cloud-mock.ts+++ b/e2e/support/cloud-mock.ts@@ -37,7 +37,7 @@ export interface CloudScenario {* `api_schema`/`pricing`/`quote_required`, plus `clip.durations` and* `credits.by_duration` on the classic video entry (dd29f359). The Preset* shelf and StudioParams gate purely on `quote_required` being present on- * AT LEAST ONE entry (never a version number, Portplan Abschnitt 4) —+ * AT LEAST ONE entry (never a version number, Portplan Abschnitt 4);* leaving this unset reproduces an OLDER server's catalog (no entry knows* Studio at all), the shelf must stay hidden.*/@@ -60,7 +60,7 @@ export interface CloudScenario {// the server) renders the same fields a live run would use: a flat-rate// model with a bare `prompt` input, no upload, the simplest full booking path// for an e2e run. `pricing`/`api_schema` mirror studio-contract.ts's own-// StudioModel/Schema shape (Portplan Abschnitt 2.1) — present on the wire so+// StudioModel/Schema shape (Portplan Abschnitt 2.1), present on the wire so// a future server-truth switch is a data change, not a contract change; nothing// on the client reads them yet (studioQuote() is the price source of record).const STUDIO_CATALOG_MODEL = {@@ -179,6 +179,14 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v? { base: 40000, long: 64000, by_duration: { '4': 32000, '6': 48000, '9': 72000 } }: { base: 40000, long: 64000 },},+ // Review B1 (Runde 2): the CLASSIC twin of two role intents+ // (Extend, Motion) that predates Studio and must keep working+ // when the catalog carries no `quote_required` at all, present+ // on EVERY scenario, not just studioCatalog, so+ // create-studio.spec.ts can prove the fallback actually resolves+ // to a real, pickable model instead of an empty list.+ { id: 'wan-2.2-spicy-extend', label: 'Wan 2.2 Spicy Extend', kind: 'video', ops: ['extend'], t2v: false, i2v: false, adult: true, credits: { base: 15000 } },+ { id: 'wan-2.2-animate', label: 'Wan 2.2 Animate', kind: 'video', ops: ['motion'], t2v: false, i2v: false, credits: { base: 12000 } },...(scenario.studioCatalog ? [STUDIO_CATALOG_MODEL] : []),],ops: { removebg: 1000, eraser: 2500, upscale_image: 1000, upscale_video_per_s: 500, upscale_video_min: 2500 },@@ -192,11 +200,11 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v// P9: POST /api/jobs/studio-quote, the provider-confirmed price a Studio// run asks for before it books (Portplan Abschnitt 4, Punkt 1). A flat,- // deterministic number — real per-model pricing is studio-contract.ts's+ // deterministic number; real per-model pricing is studio-contract.ts's// job, not this mock's.if (path === '/api/jobs/studio-quote') {if (scenario.studioQuoteStatus === 404) return route.fulfill(json(404, { error: 'not found' }))- // 'unreachable': the pre-P0 state (no withCors/OPTIONS at all) — the+ // 'unreachable': the pre-P0 state (no withCors/OPTIONS at all). The// browser never lets a response reach the app, so the mock aborts// instead of fulfilling, the same failure shape a real CORS block// produces (studio.ts's own comment: this collapses to the identical@@ -206,7 +214,7 @@ export async function routeCloud(page: Page, scenario: CloudScenario): Promise<v}// P9: GET /api/jobs/runtime (Portplan Abschnitt 4, Punkt 2). Empty is a- // valid, common answer (MIN_SAMPLES: silence over a guess) — no spec+ // valid, common answer (MIN_SAMPLES: silence over a guess). No spec// needs a populated runtime map, so this mock never returns one.if (path === '/api/jobs/runtime') {return route.fulfill(json(200, { runtimes: {} }))diff --git a/src/api/cloud/jobs.ts b/src/api/cloud/jobs.tsindex c4c13198..3402931d 100644--- a/src/api/cloud/jobs.ts+++ b/src/api/cloud/jobs.ts@@ -18,7 +18,7 @@ export interface CloudJobParams {studio_options?: Record<string, unknown>/** Ceiling from the last confirmed studio-quote; the server re-quotes and* answers 409 quote_changed (see QuoteChangedError) if its own number now- * exceeds this — never books a price the customer never saw. */+ * exceeds this, never books a price the customer never saw. */max_credits?: number/** Kurze Ueberschrift fuer die Galerie, wenn der Lauf keinen Prompt hat oder* der Prompt nicht sagt, was dabei herauskam: der Titel eines Presets, die@@ -128,7 +128,7 @@ export interface CloudJobSubmitResult {id: string/** A submit retried with the same client_request_id (CloudJobParams) hits* the server's idempotency check and replays the original booking instead- * of charging twice — `used`/`limit` are not recomputed for a replay, only+ * of charging twice. `used`/`limit` are not recomputed for a replay, only* `cost` is guaranteed. */quota: { cost: number; used?: number; limit?: number }replayed?: boolean@@ -137,7 +137,7 @@ export interface CloudJobSubmitResult {/** The server re-quoted at submit time (prepareStudio()) and its own number* now exceeds the studio-quote price the customer confirmed. Distinct from* a plain CloudJobError so a Studio caller can show the new price instead of- * a generic failure — see Portplan Abschnitt 4 and Risiko 1. */+ * a generic failure, see Portplan Abschnitt 4 and Risiko 1. */export class QuoteChangedError extends CloudJobError {readonly credits: numberconstructor(message: string, credits: number) {diff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsxindex 1837d230..68a32484 100644--- a/src/components/create/experimental/Composer.tsx+++ b/src/components/create/experimental/Composer.tsx@@ -16,8 +16,9 @@ import {} from '../../../stores/cloudCatalogStore'import { intentRequiredInputs, intentRoles, isStudioModel, resolveIntentPick } from '../../../lib/render/create-studio'import { STUDIO_MODELS } from '../../../lib/render/studio-contract'-import { videoDurations } from '../../../lib/render/video-duration'+import { effectiveVideoDurations, snapToVideoDuration } from '../../../lib/render/video-duration'import { mediaSeconds, useStudioPrice } from './useStudioPrice'+import { getJob } from '../../../api/cloud/jobs'import { resolveCharacterModel } from '../../../hooks/useCloudCreate'import { INTENT_MAP } from './intents'import { subscribeInstallRuns, getInstallRun } from '../../../lib/model-install-runs'@@ -151,11 +152,38 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {const [measured, setMeasured] = useState<{ url: string; seconds: number | undefined } | null>(null)useEffect(() => {let alive = true- if (!mediaUrl) return+ // Review A kleiner Punkt 2: this number only feeds useStudioPrice, which+ // itself already no-ops off the cloud track (`studioPick` is undefined+ // there). Gating here too means a local lipsync/motion/extend attach+ // never spins up an <audio>/<video> element and an 8s measuring timer+ // for a number nobody reads.+ if (backend !== 'cloud' || !mediaUrl) returnvoid mediaSeconds(mediaUrl, mediaKind).then((v) => { if (alive) setMeasured({ url: mediaUrl, seconds: v }) })return () => { alive = false }- }, [mediaUrl, mediaKind])- const inputSeconds = measured && measured.url === mediaUrl ? measured.seconds : undefined+ }, [backend, mediaUrl, mediaKind])+ // Review B3: a generated voice (voiceFromJob, e.g. a qwen3-tts run picked+ // as the lipsync track) has no local blob URL, it is a prior job id, not+ // an upload. Skipping it left `seconds` undefined for exactly the run+ // useCloudCreate re-uploads at submit time (voiceFromJob && studioModel),+ // so the meter showed a 5-second price for a 60-second voice and booked+ // twelve times that (heygen-twin: shown 15,000, booked 180,000 at 60s,+ // measured in review-studio-B.md B3). Same async-only write rule as+ // `measured` above; the job fetch and the duration probe both go through+ // the callback, never the render body.+ const voiceJobId = backend === 'cloud' && intent === 'lipsync' && !audioInput ? voiceFromJob?.jobId : undefined+ const [measuredVoice, setMeasuredVoice] = useState<{ jobId: string; seconds: number | undefined } | null>(null)+ useEffect(() => {+ let alive = true+ if (!voiceJobId) return+ void getJob(voiceJobId)+ .then((job) => (job.result_url ? mediaSeconds(job.result_url, 'audio') : undefined))+ .then((v) => { if (alive) setMeasuredVoice({ jobId: voiceJobId, seconds: v }) })+ .catch(() => { if (alive) setMeasuredVoice({ jobId: voiceJobId, seconds: undefined }) })+ return () => { alive = false }+ }, [voiceJobId])+ const inputSeconds =+ (measured && measured.url === mediaUrl ? measured.seconds : undefined) ??+ (measuredVoice && measuredVoice.jobId === voiceJobId ? measuredVoice.seconds : undefined)const studioPrice = useStudioPrice(studioPick, cloudStudioOptions, prompt, runSeconds ?? inputSeconds)const setCloudStudioCredits = useCreateStore((s) => s.setCloudStudioCredits)useEffect(() => {@@ -463,7 +491,17 @@ function LaneControls() {const frames = useCreateStore((s) => s.frames)const setFrames = useCreateStore((s) => s.setFrames)const fps = useCreateStore((s) => s.fps)- const setFps = useCreateStore((s) => s.setFps)+ // The local Frames slider only ever reads fps (for the "Nf · Xs" caption);+ // it is set from the video model's own defaults (setVideoModel), never by+ // hand here, so there is no local setFps caller any more now that the+ // cloud Length control owns its own field (Review A kleiner Punkt 1).+ // Review A kleiner Punkt 1: the cloud Length control below reads and+ // writes ITS OWN frames/fps, not the local track's. See the field's doc+ // comment in createStore.ts.+ const cloudFrames = useCreateStore((s) => s.cloudFrames)+ const setCloudFrames = useCreateStore((s) => s.setCloudFrames)+ const cloudFps = useCreateStore((s) => s.cloudFps)+ const setCloudFps = useCreateStore((s) => s.setCloudFps)const videoModel = useCreateStore((s) => s.videoModel)const cloudVideoModel = useCreateStore((s) => s.cloudVideoModel)@@ -496,16 +534,23 @@ function LaneControls() {const cloudVideoOp = intentToJob(intent).opconst cloudVideoLaneModel = modelForOp('video', cloudVideoOp, cloudVideoModel || defaultCloudModel('video')?.id || '')const cloudVideoDurations = effectiveVideoDurations(cloudVideoLaneModel)- const cloudVideoSeconds = cloudVideoDurations.length ? snapToVideoDuration(cloudVideoDurations, frames, fps) : undefined+ // Review A kleiner Punkt 1 (studio-r2, 20.09.2026): this used to snap the+ // SHARED frames/fps and write back into them on every cloud model switch,+ // which silently rewrote the local Frames slider's remembered value too+ // (frames/fps back local video generation as well). Reading/writing+ // cloudFrames/cloudFps instead means a cloud length pick, or the snap this+ // effect performs when a model switch makes the current pick invalid,+ // never touches the local track's own frames/fps.+ const cloudVideoSeconds = cloudVideoDurations.length ? snapToVideoDuration(cloudVideoDurations, cloudFrames, cloudFps) : undefineduseEffect(() => {if (backend === 'cloud' && kind === 'video' && !specialOp &&- cloudVideoSeconds !== undefined && frames / fps !== cloudVideoSeconds+ cloudVideoSeconds !== undefined && cloudFrames / cloudFps !== cloudVideoSeconds) {- setFrames(cloudVideoSeconds * 16)- setFps(16)+ setCloudFrames(cloudVideoSeconds * 16)+ setCloudFps(16)}- }, [backend, kind, specialOp, cloudVideoSeconds, frames, fps, setFrames, setFps])+ }, [backend, kind, specialOp, cloudVideoSeconds, cloudFrames, cloudFps, setCloudFrames, setCloudFps])if (characterTrain) return null@@ -623,7 +668,7 @@ function LaneControls() {size="sm"layoutId="clip-length"value={String(cloudVideoSeconds ?? cloudVideoDurations[0])}- onChange={(k) => { setFrames(Number(k) * 16); setFps(16) }}+ onChange={(k) => { setCloudFrames(Number(k) * 16); setCloudFps(16) }}options={cloudVideoDurations.map((secs) => ({ value: String(secs), label: `${secs}s` }))}/></LabeledControl>@@ -686,24 +731,9 @@ function nearestKey(map: Record<string, number>, val: number): string {}// ── cloud video length (dd29f359, Portplan Abschnitt 6) ──-// The catalog is the runtime truth (a live model can add/retire lengths any-// day); video-durations.json is the offline notvorrat only. Neither one-// alone: an entry that has NOT yet re-fetched the live catalog still needs a-// length list, and a length the catalog names that the static file has not-// caught up with yet must still show.-export function effectiveVideoDurations(model: string): number[] {- const cat = cloudModelById(model)- if (cat?.clip?.durations?.length) return cat.clip.durations- const json = videoDurations(model)- if (json.length > 0) return [...json]- if (cat?.clip) return cat.clip.long !== undefined ? [cat.clip.short, cat.clip.long] : [cat.clip.short]- return []-}--// An invalid-become choice (model switch, or a persisted value from a model-// that no longer offers it) resets to the SHORTEST valid length, never to-// the nearest one, which could silently jump the price up.-export function snapToVideoDuration(allowed: number[], frames: number, fps: number): number {- const raw = fps > 0 ? frames / fps : allowed[0]- return allowed.includes(raw) ? raw : allowed[0]-}+// Review A2 (Runde 2): moved into video-duration.ts, the one file the+// booking path (useCloudCreate, PresetWorkshop) now reads too, so the+// picker and the booking can never name two different lists again. Kept+// re-exported here so composer-video-duration.test.ts's import path (and+// any other caller of this module) still resolves.+export { effectiveVideoDurations, snapToVideoDuration }diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsxindex 2476635a..bc111a88 100644--- a/src/components/create/experimental/CreateExperimental.tsx+++ b/src/components/create/experimental/CreateExperimental.tsx@@ -27,7 +27,7 @@ import { Modal } from '../../ui/Modal'// `provider-schemas.json` (P1) ist 256 KB. `PresetShelf` haengt schon// synchron an `studio-contract.ts` (fuer `STUDIO_MODELS` in der// Einzelmodell-Auswahl der Schiene), zieht das Schema also ohnehin in den-// Hauptbaum — nur die WERKSTATT selbst, die `SchemaControl`/`AvatarPicker`+// Hauptbaum. Nur die WERKSTATT selbst, die `SchemaControl`/`AvatarPicker`// und damit `studioSchema()` fuer jedes einzelne Feld aufruft, laesst sich// ohne Vertragsaenderung an `PresetShelf`/`studio-contract.ts` (P1/P3, fremde// Dateien) aus dem ersten Ladevorgang heraushalten: sie oeffnet sich erst auf@@ -445,8 +445,8 @@ function CreateExperimentalInner() {{/* Preset-Werkstatt (P6): ein Popup mit X und Escape, dieselbe Sperrklinkewie jedes andere Fenster (Modal, siehe src/components/ui/Modal.tsx).- Die Generation laeuft IM Fenster weiter, auch wenn niemand es zulaesst- — geschlossen wird nur von Hand (Portplan Abschnitt 5/7). */}+ Die Generation laeuft IM Fenster weiter, auch wenn niemand zusieht,+ geschlossen wird nur von Hand (Portplan Abschnitt 5/7). */}{selectedPreset && backend === 'cloud' && (<Modalopen={presetDialogOpen}@@ -454,6 +454,12 @@ function CreateExperimentalInner() {title={selectedPreset.title}maxWidth="max-w-4xl"panelPad="p-0"+ // Review B2: X/Escape darf den bezahlten Schrittzustand der+ // Werkstatt nicht wegwerfen. `keepMounted` haelt PresetWorkshop im+ // Baum und blendet nur das Fenster aus; `selectedPreset` bleibt+ // ohnehin schon stehen (siehe Kommentar oben bei presetDialogOpen),+ // also ist dies die letzte fehlende Haelfte.+ keepMounted><div className="flex h-[min(600px,90vh)] flex-col overflow-hidden"><Suspense fallback={<div className="flex flex-1 items-center justify-center t-control text-gray-500">Loading…</div>}>diff --git a/src/components/create/experimental/CreditsMeter.tsx b/src/components/create/experimental/CreditsMeter.tsxindex 87a5db6a..3e30968a 100644--- a/src/components/create/experimental/CreditsMeter.tsx+++ b/src/components/create/experimental/CreditsMeter.tsx@@ -29,8 +29,12 @@ export function CreditsMeter() {const cloudOpModel = useCreateStore((s) => s.cloudOpModel)const characterTab = useCreateStore((s) => s.characterTab)const selectedCharacter = useCreateStore((s) => s.selectedCharacter)- const frames = useCreateStore((s) => s.frames)- const fps = useCreateStore((s) => s.fps)+ // Review A kleiner Punkt 1: this meter is cloud-only (Composer renders it+ // only for backend 'cloud'), so it must price the SAME length the cloud+ // Length control shows and useCloudCreate books, cloudFrames/cloudFps, not+ // the local track's frames/fps.+ const frames = useCreateStore((s) => s.cloudFrames)+ const fps = useCreateStore((s) => s.cloudFps)const musicDuration = useCreateStore((s) => s.musicDuration)const targetResolution = useCreateStore((s) => s.targetResolution)const cloudStudioOptions = useCreateStore((s) => s.cloudStudioOptions)diff --git a/src/components/create/experimental/OutputView.tsx b/src/components/create/experimental/OutputView.tsxindex 895d1ad9..cc99adc0 100644--- a/src/components/create/experimental/OutputView.tsx+++ b/src/components/create/experimental/OutputView.tsx@@ -22,7 +22,7 @@ import { cn } from '../ui/cn'// 19.09.2026, Entscheid von David: das Warten traegt dasselbe Lila wie der// Rest der App, damit sichtbar ist, dass da etwas passiert. Sky fuer Laden,// Gruen fuer Sampling waren Schmuck fuer eine Phase, keine Warnung, und genau-// solche Stellen haben Farbe in der App bedeutungslos gemacht — die Phase sagt+// solche Stellen haben Farbe in der App bedeutungslos gemacht. Die Phase sagt// jetzt allein das Symbol, nicht mehr die Farbe.function phaseIcon(phase: ProgressPhase) {if (phase === 'loading-model' || phase === 'loading-clip' || phase === 'loading-vae') return <Cpu size={20} className="text-lu-accent" />diff --git a/src/components/create/experimental/PresetShelf.tsx b/src/components/create/experimental/PresetShelf.tsxindex 9b1befe2..4f60c045 100644--- a/src/components/create/experimental/PresetShelf.tsx+++ b/src/components/create/experimental/PresetShelf.tsx@@ -10,13 +10,13 @@ import { useCloudCatalogStore } from '../../../stores/cloudCatalogStore'** Eine Schiene am rechten Rand, die von 52 auf 260 Pixel aufgeht. Desktop-* Port (P6): der Web-Quelle Handy-Zweig (`useIsMobile`, das Blatt ueber dem- * Inhalt) entfaellt ersatzlos — der Desktop kennt kein Handy-Layout.+ * Inhalt) entfaellt ersatzlos, der Desktop kennt kein Handy-Layout.** Die Schiene erscheint NUR auf der Wolken-Spur (Portplan Abschnitt 1* Punkt 10, Abschnitt 3), UND nur, wenn der lebende Katalog Studio-Modelle* fuehrt: ein aelterer Server, der `quote_required` bei keinem Eintrag* mitschickt, sagt damit selbst, dass er das Studio nicht kennt (Portplan- * Abschnitt 4, "nie eine Serverversion fest verdrahten" — die Erkennung+ * Abschnitt 4, "nie eine Serverversion fest verdrahten": die Erkennung* laeuft ausschliesslich ueber das Vorhandensein des Feldes). Ohne diese* zweite Bedingung wuerde die Schiene bei so einem Server leer klicken:* jedes Preset stuende da, aber `studioQuote()` liefe sofort indiff --git a/src/components/create/experimental/PresetWorkshop.tsx b/src/components/create/experimental/PresetWorkshop.tsxindex cc4b5872..7f22f3df 100644--- a/src/components/create/experimental/PresetWorkshop.tsx+++ b/src/components/create/experimental/PresetWorkshop.tsx@@ -162,7 +162,7 @@ export function PresetWorkshop({preset,onClose,onGenerate}:{preset:CreatePreset;}catch(e){if(controller.signal.aborted)return// 409 quote_changed: den neuen, vom Anbieter bestaetigten Preis- // zeigen und als bestaetigt uebernehmen — NICHT still weiterbuchen.+ // zeigen und als bestaetigt uebernehmen, NICHT still weiterbuchen.// Der Kunde sieht die neue Zahl und muss noch einmal auf Start// druecken (Portplan Abschnitt 4/7, Risiko 1).if(e instanceof StudioQuoteChangedError){diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsxindex 9d16acf2..aa7b82c7 100644--- a/src/components/create/experimental/SpecialIntentControls.tsx+++ b/src/components/create/experimental/SpecialIntentControls.tsx@@ -1210,7 +1210,7 @@ function CloudExtendControls() {// problem it fixes (David, 19.09.2026: "everything// after that is just Cloud videos"). A prompt-less// entry here is routinely a Studio step (sharpen,- // extend, a preset step) — galleryLabelShort names+ // extend, a preset step), galleryLabelShort names// those from their model/label instead of a blank// notname.label: galleryLabelShort(g, 40),diff --git a/src/components/create/experimental/StudioParams.tsx b/src/components/create/experimental/StudioParams.tsxindex 0c86e47d..588a66ac 100644--- a/src/components/create/experimental/StudioParams.tsx+++ b/src/components/create/experimental/StudioParams.tsx@@ -8,8 +8,7 @@import { SlidersHorizontal } from 'lucide-react'import { useCreateStore } from '../../../stores/createStore'import { SchemaControl, isCompactField, studioFieldsInOrder } from './SchemaControl'-import { modelHint } from '../../../lib/render/preset-models'-import { modelLabel } from '../../../lib/render/preset-models'+import { modelHint, modelLabel } from '../../../lib/render/preset-models'export function StudioParams({ model }: { model: string }) {const options = useCreateStore((s) => s.cloudStudioOptions)diff --git a/src/components/create/experimental/__tests__/preset-workshop.test.tsx b/src/components/create/experimental/__tests__/preset-workshop.test.tsxindex fa1d2add..9a717e94 100644--- a/src/components/create/experimental/__tests__/preset-workshop.test.tsx+++ b/src/components/create/experimental/__tests__/preset-workshop.test.tsx@@ -27,7 +27,7 @@ import { StudioQuoteChangedError } from '../../../../api/cloud/studio'// `uploadInput`/`submitCloudJob`/`pollJob`/`getJob`/`cancelJob` aus// src/api/cloud/jobs.ts statt aus einer Web-eigenen cloud-jobs.ts. Der// globale `fetch`-Stub bleibt nur fuer das Herunterladen eines VORIGEN-// Ergebnisses (adopt()) stehen — das ist ein signierter S3-Link, keine+// Ergebnisses (adopt()) stehen: das ist ein signierter S3-Link, keine// Cloud-API-Route, und blieb im Web genauso ein blosses `fetch`.// - neue Faelle unten: die Schiene erscheint nur auf der Wolken-Spur UND nur,// wenn der Katalog `quote_required` fuehrt (Portplan Abschnitt 5/P6-@@ -57,7 +57,7 @@ function WerkstattFenster({ preset, onClosed }: { preset: CreatePreset; onClosed// P2-Befund (studio-p2.md, "Preisluecken im Notvorrat"): `flux-schnell` und// `wan-2.2-720p` fuehren im statischen Notvorrat bis heute KEIN `credits`--// Feld — im echten Betrieb heilt das die erste Katalogaktualisierung, hier+// Feld. Im echten Betrieb heilt das die erste Katalogaktualisierung, hier// braucht es einen Preis, damit die klassischen Faelle unten (Modellwechsel,// Frames/Fps) ueberhaupt einen bestaetigbaren Preis sehen.const QUOTE_REQUIRED_CATALOG: CloudModel[] = [@@ -87,7 +87,7 @@ vi.mock('../../../../api/cloud/studio', async (importOriginal) => ({}))// jsdom kennt keinen ResizeObserver; `Select` (P4/Bestand) braucht ihn nur,-// um die Menuegroesse an offenen Platz anzupassen — fuer die Faelle hier+// um die Menuegroesse an offenen Platz anzupassen, fuer die Faelle hier// reicht ein Stub, der nichts tut.class ResizeObserverStub {observe() {}@@ -428,7 +428,7 @@ it('haelt ein optionales Endbild unter den erweiterten Einstellungen', () => {// P6: ein Server, der Studio noch nicht kennt (oder die zwei Routen ohne CORS// vor P0), antwortet auf studio-quote mit 404 oder einem rohen Netzfehler.// studioQuote() (P3) wandelt beides in denselben festen Text um. Start bleibt-// gesperrt, weil `quote` nie gesetzt wird — kein Rueckfall auf die eigene+// gesperrt, weil `quote` nie gesetzt wird: kein Rueckfall auf die eigene// Formel, kein Buchen einer geratenen Zahl.it('Start bleibt gesperrt und zeigt den festen Text, wenn der Server das Studio nicht kennt', async () => {mocks.quote.mockRejectedValue(new CloudJobError('This feature needs a newer LU Cloud server. Try again later.', 404))@@ -440,7 +440,7 @@ it('Start bleibt gesperrt und zeigt den festen Text, wenn der Server das Studio})// P6: 409 quote_changed beim Buchen (POST /api/jobs, real erwarteter Fall-// laut Portplan Abschnitt 4 Punkt 3 — die Preisabfrage selbst liefert ihn+// laut Portplan Abschnitt 4 Punkt 3, die Preisabfrage selbst liefert ihn// laut P3-Bericht heute nicht). Der neue, vom Server bestaetigte Preis// erscheint, aber es wird NICHT still mit ihm weitergebucht: submitCloudJob// wurde genau einmal aufgerufen, ein zweiter Klick waere noetig.@@ -453,12 +453,38 @@ it('zeigt bei 409 quote_changed den neuen Preis, statt still neu zu buchen', asyawait waitFor(() => expect(screen.getByRole('alert').textContent).toContain('4,200 credits'), { timeout: 2000 })expect(screen.getAllByText(/4,200 credits/).length).toBeGreaterThan(0)expect(mocks.submit).toHaveBeenCalledTimes(1)- // Der Knopf ist wieder bedienbar, gegen den NEUEN Preis — ein zweiter,+ // Der Knopf ist wieder bedienbar, gegen den NEUEN Preis: ein zweiter,// ausdruecklicher Klick bucht ihn, keiner buchte ihn automatisch.expect((screen.getByRole('button', { name: 'Generate' }) as HTMLButtonElement).disabled).toBe(false)fireEvent.click(screen.getByRole('button', { name: 'Generate' }))await waitFor(() => expect(mocks.submit).toHaveBeenCalledTimes(2))expect(mocks.submit.mock.calls[1][0]).toMatchObject({ params: { max_credits: 4200 } })+ // review-studio-B.md, kleiner Punkt 5: genau HIER darf sich der Schluessel+ // nicht wiederholen, weil der Preis wirklich anders ist (ein NEUER Lauf,+ // nicht derselbe wiederholte).+ expect(mocks.submit.mock.calls[1][0].params.client_request_id)+ .not.toBe(mocks.submit.mock.calls[0][0].params.client_request_id)+})++// review-studio-B.md, kleiner Punkt 5: die Idempotenz haengt daran, dass ein+// Wiederholungsversuch DENSELBEN client_request_id schickt. Ein Absenden,+// das an einem gewoehnlichen Fehler (keine Preisaenderung) scheitert und ein+// zweites Mal versucht wird, ohne dass die Quote neu gezogen wurde, muss+// denselben Schluessel tragen, sonst bucht der Server zwei Auftraege fuer+// einen Klick, den der Kunde als einen einzigen Versuch sieht.+it('schickt bei einem Wiederholungsversuch ohne neue Quote denselben client_request_id', async () => {+ mocks.submit.mockRejectedValueOnce(new Error('network blip'))+ render(<PresetWorkshop preset={CREATE_PRESETS[1]} onClose={() => {}} onGenerate={() => {}} />)+ fireEvent.change(screen.getByLabelText('Preset prompt'), { target: { value: 'a misty forest creature' } })+ await waitFor(() => expect((screen.getByRole('button', { name: 'Generate' }) as HTMLButtonElement).disabled).toBe(false), { timeout: 2000 })+ fireEvent.click(screen.getByRole('button', { name: 'Generate' }))+ await waitFor(() => expect(mocks.submit).toHaveBeenCalledTimes(1))+ fireEvent.click(screen.getByRole('button', { name: 'Generate' }))+ await waitFor(() => expect(mocks.submit).toHaveBeenCalledTimes(2))+ const first = mocks.submit.mock.calls[0][0].params.client_request_id+ const second = mocks.submit.mock.calls[1][0].params.client_request_id+ expect(first).toBeDefined()+ expect(second).toBe(first)})// P6: `StudioQuoteChangedError` aus der Preisabfrage selbst (P3 haelt dendiff --git a/src/components/create/experimental/__tests__/waiting-icon-is-a-phase-icon.test.ts b/src/components/create/experimental/__tests__/waiting-icon-is-a-phase-icon.test.tsindex 8641eff2..313106c4 100644--- a/src/components/create/experimental/__tests__/waiting-icon-is-a-phase-icon.test.ts+++ b/src/components/create/experimental/__tests__/waiting-icon-is-a-phase-icon.test.ts@@ -18,7 +18,7 @@** 19.09.2026 (Portplan Studio, Paket P5): David dropped the per-phase COLOR* (sky for loading, green for sampling) in favor of one lu-accent purple- * everywhere, "damit sichtbar ist, dass da etwas passiert" — see+ * everywhere, "damit sichtbar ist, dass da etwas passiert", see* OutputView.tsx's phaseIcon/phaseBeat. Sampling and idle always rendered the* same Sparkles icon as the fallback branch, so the now-pointless standalone* `phase === 'sampling'` check was dropped with the color, not the mapping:@@ -50,7 +50,7 @@ describe('the waiting circle icon', () => {expect(body).toMatch(/phase === 'loading-clip'/)expect(body).toMatch(/phase === 'loading-vae'/)expect(body).toMatch(/phase === 'decoding'[\s\S]*?<ImageDown /)- // No standalone 'sampling' branch any more — it fell through to the+ // No standalone 'sampling' branch any more: it fell through to the// fallback Sparkles before the color unification too, so dropping the// dead check changed nothing sampling ever showed.expect(body).not.toMatch(/phase === 'sampling'/)diff --git a/src/components/create/experimental/useStudioPrice.ts b/src/components/create/experimental/useStudioPrice.tsindex c9e9f78d..65a5542a 100644--- a/src/components/create/experimental/useStudioPrice.ts+++ b/src/components/create/experimental/useStudioPrice.ts@@ -17,6 +17,22 @@// Effekt unten kehrt in dem Fall sofort um, ohne `studioQuote()` zu rufen.// Siehe useCloudCreate-studio.test.ts, Fall "no network call on the local// lane".+//+// Review A1/B3 (Runde 2, 20.09.2026): `price.mode` 'input'/'both' Modelle+// (pricesByInput()) bleiben hier weiterhin bei der Formel-Vorschau, OHNE+// `studioQuote()`, das ist bewusst, nicht die Luecke, die B3 fand. Diese+// Modelle rechnen serverseitig aus der GEMESSENEN Laenge der hochgeladenen+// Datei; eine echte Server-Quote vor dem Klick wuerde die Datei hochladen,+// bevor die Kundschaft ueberhaupt "Create" gedrueckt hat, fuer eine Zahl, die+// sie vielleicht nie sieht. Die Geldwahrheit liegt fuer diese 17 Modelle+// stattdessen in `useCloudCreate.ts`: `generate()` ruft `studioQuote()` MIT+// den bereits fuer den Lauf hochgeladenen Pfaden, unmittelbar vor der+// Buchung, und setzt genau diese Zahl als `max_credits`, kein Upload extra,+// kein Kredit ohne bestaetigte Zahl. Der Startknopf bleibt fuer diese 17+// deshalb nicht wegen eines fehlenden Preises gesperrt (er war es nie fuer+// price.mode 'output'/'characters' Modelle vor dem ersten Tastendruck+// entweder), sondern die Buchung selbst kann nie mehr Kredite abrechnen, als+// die Quote unmittelbar davor bestaetigt.import { useEffect, useRef, useState } from 'react'import { createStudioCost, pricesByInput } from '../../../lib/render/create-studio'diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsxindex c5abc3d8..76fd2134 100644--- a/src/components/ui/Modal.tsx+++ b/src/components/ui/Modal.tsx@@ -31,6 +31,19 @@ interface Props {* (`title=""` oder `hideHeader`). Ohne sie fällt der Dialog auf `title`* bzw. „Dialog" zurück. */ariaLabel?: string+ /** Review B2 (Runde 2, 20.09.2026): das Standardverhalten (AnimatePresence+ * plus `{open && children}`) baut die Kinder beim Schliessen VOLLSTAENDIG+ * ab. Fuer die meisten der zwoelf Einbindungen ist das richtig: ein+ * Formular soll beim naechsten Oeffnen leer sein. Ein Fenster, das+ * bezahlten, nicht wiederholbaren Fortschritt in seinem eigenen+ * React-Baum haelt (die Preset-Werkstatt), darf X/Escape nicht mit+ * diesem Fortschritt bezahlen lassen. `keepMounted` haelt die Kinder+ * MONTIERT und blendet das Fenster nur aus, genau wie die Web-Referenz+ * (`apps/web/.../CreateExperimental.tsx`: `className={open?'fixed+ * inset-0 z-50 ...':'hidden'}`). Alle Tastatur-/Fokus-/Escape-Effekte+ * oben bleiben unveraendert an `open` gehaengt und schalten sich beim+ * Ausblenden sauber ab; nur der Unmount entfaellt. */+ keepMounted?: boolean}// A modal is a real dialog, so it needs an OPAQUE, elevated surface — not the@@ -42,7 +55,7 @@ interface Props {// und Screenreader aber keiner — kein Escape, keine Fokus-Falle, keine Rolle.// Wer die Maus nicht benutzt, kam aus dem Ding nicht wieder heraus. Alles unten// sitzt bewusst an DIESER einen Stelle, damit die zwölf Einbindungen es erben.-export function Modal({ open, onClose, title, children, hideHeader, maxWidth = 'max-w-lg', panelRadius = 'rounded-2xl', panelPad = 'p-6', ariaLabel }: Props) {+export function Modal({ open, onClose, title, children, hideHeader, maxWidth = 'max-w-lg', panelRadius = 'rounded-2xl', panelPad = 'p-6', ariaLabel, keepMounted = false }: Props) {const overlayRef = useRef<HTMLDivElement>(null)const panelRef = useRef<HTMLDivElement>(null)/** Wohin der Fokus beim Schließen zurückkehrt. */@@ -157,6 +170,60 @@ export function Modal({ open, onClose, title, children, hideHeader, maxWidth = 'return () => document.removeEventListener('keydown', onKey)}, [open, reactId, onClose, focusables])+ const header = hideHeader ? (+ <button+ onClick={onClose}+ data-dialog-close+ className="absolute top-3 right-3 p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-400 hover:text-gray-700 dark:hover:text-white transition-colors"+ aria-label="Close"+ >+ <X size={18} />+ </button>+ ) : (+ <div className="flex items-center justify-between mb-4">+ <h2 id={titleId} className="text-lg font-semibold text-gray-900 dark:text-white">{title}</h2>+ <button+ onClick={onClose}+ data-dialog-close+ className="p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-400 hover:text-gray-700 dark:hover:text-white transition-colors"+ aria-label="Close"+ >+ <X size={20} />+ </button>+ </div>+ )+ const panelClass = `relative z-10 w-full outline-none ${panelRadius} ${panelPad} lu-elevated ` + maxWidth+ const dialogA11y = hasVisibleTitle+ ? { 'aria-labelledby': titleId }+ : { 'aria-label': ariaLabel || title || 'Dialog' }++ if (keepMounted) {+ // Kein AnimatePresence, kein Unmount: dieselbe montiert-und-ausgeblendet+ // Regel wie die Web-Referenz. `children` bleibt im Baum, auch wenn+ // `open` false ist, also ueberlebt der Zustand, den es haelt, X und+ // Escape (Review B2).+ return (+ <div+ ref={overlayRef}+ data-lu-dialog={open ? '' : undefined}+ className={open ? 'fixed inset-0 z-50 flex items-center justify-center p-4' : 'hidden'}+ >+ <div className="absolute inset-0 bg-black/60 backdrop-blur-sm" onClick={onClose} />+ <div+ ref={panelRef}+ role="dialog"+ aria-modal="true"+ {...dialogA11y}+ tabIndex={-1}+ className={panelClass}+ >+ {header}+ {children}+ </div>+ </div>+ )+ }+return (<AnimatePresence>{open && (@@ -173,40 +240,15 @@ export function Modal({ open, onClose, title, children, hideHeader, maxWidth = 'ref={panelRef}role="dialog"aria-modal="true"- {...(hasVisibleTitle- ? { 'aria-labelledby': titleId }- : { 'aria-label': ariaLabel || title || 'Dialog' })}+ {...dialogA11y}tabIndex={-1}- className={- `relative z-10 w-full outline-none ${panelRadius} ${panelPad} lu-elevated ` + maxWidth- }+ className={panelClass}initial={{ scale: 0.9, opacity: 0 }}animate={{ scale: 1, opacity: 1 }}exit={{ scale: 0.9, opacity: 0 }}transition={SPRING_PANEL}>- {hideHeader ? (- <button- onClick={onClose}- data-dialog-close- className="absolute top-3 right-3 p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-400 hover:text-gray-700 dark:hover:text-white transition-colors"- aria-label="Close"- >- <X size={18} />- </button>- ) : (- <div className="flex items-center justify-between mb-4">- <h2 id={titleId} className="text-lg font-semibold text-gray-900 dark:text-white">{title}</h2>- <button- onClick={onClose}- data-dialog-close- className="p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-400 hover:text-gray-700 dark:hover:text-white transition-colors"- aria-label="Close"- >- <X size={20} />- </button>- </div>- )}+ {header}{children}</motion.div></motion.div>diff --git a/src/hooks/__tests__/useCloudCreate-studio.test.ts b/src/hooks/__tests__/useCloudCreate-studio.test.tsindex bfa32716..951d989c 100644--- a/src/hooks/__tests__/useCloudCreate-studio.test.ts+++ b/src/hooks/__tests__/useCloudCreate-studio.test.ts@@ -72,6 +72,7 @@ const hoisted = vi.hoisted(() => {result_url: 'https://storage.example/out.mp4', created_at: new Date().toISOString(),})),cancelJob: vi.fn(async () => ({ status: 'canceled' })),+ studioQuote: vi.fn(async (..._args: unknown[]) => ({ credits: 42 })),}})const { submitted, hochgeladen } = hoisted@@ -94,8 +95,20 @@ vi.mock('../../api/cloud/jobs', () => ({QuoteChangedError: hoisted.FakeQuoteChangedError,}))+// Review A1/B3 (Runde 2): useCloudCreate now quotes a Studio run right+// before booking (see useCloudCreate.ts, the "Confirming the price…" step)+// and uses that number as max_credits. A fixed 42 keeps every existing+// assertion below about the OTHER params fields unaffected; the dedicated+// max_credits/quote_changed behavior gets its own tests further down.+vi.mock('../../api/cloud/studio', () => ({+ studioQuote: hoisted.studioQuote,+ StudioQuoteChangedError: hoisted.FakeQuoteChangedError,+}))+import { useCloudCreate } from '../useCloudCreate'import { useCreateStore } from '../../stores/createStore'+import { useCloudCatalogStore } from '../../stores/cloudCatalogStore'+import { CLOUD_MODEL_SEED } from '../../lib/render/cloud-models'const BILD = { filename: 'portrait.png', url: 'data:image/png;base64,AA', width: 512, height: 512 }const TON = { name: 'voice.mp3', url: 'blob:voice', blob: new Blob(['x']) }@@ -103,6 +116,13 @@ const TON = { name: 'voice.mp3', url: 'blob:voice', blob: new Blob(['x']) }beforeEach(() => {submitted.length = 0hochgeladen.length = 0+ hoisted.studioQuote.mockClear()+ hoisted.studioQuote.mockResolvedValue({ credits: 42 })+ hoisted.submitCloudJob.mockClear()+ hoisted.submitCloudJob.mockImplementation(async (payload: (typeof submitted)[number]) => {+ submitted.push(payload)+ return { id: 'job-test', quota: { cost: 1000, used: 1000, limit: 100000 } }+ })vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, blob: async () => new Blob(['x']) })))useCreateStore.setState({isGenerating: false, error: null, backend: 'cloud',@@ -110,6 +130,12 @@ beforeEach(() => {extendSource: null, gallery: [], cloudStudioOptions: {},})useCreateStore.getState().setPrompt('a neutral placeholder line')+ // Review B1: this whole file simulates a server that already knows Studio+ // (that is what every test here submits against). Without `quote_required`+ // on the live catalog, `resolveIntentPick` would fall back to a CLASSIC+ // member for every one of these role intents (create-studio.test.ts has+ // the dedicated fallback coverage for the opposite state).+ useCloudCatalogStore.setState({ models: [...CLOUD_MODEL_SEED, { id: 'test-studio-marker', label: 'x', kind: 'image', quote_required: true }] })})describe('Studio-Modelle in den Create-Unterkategorien', () => {@@ -197,4 +223,70 @@ describe('Studio-Modelle in den Create-Unterkategorien', () => {/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,)})++ // Review A1/B3: das war der eigentliche Blocker beider Urteile. Der+ // normale Create-Weg bucht jetzt nie mehr ohne einen server-bestaetigten+ // Deckel, egal ob das Modell nach Ausgabe oder nach Eingabe abrechnet.+ describe('bucht einen Studio-Lauf nur gegen eine bestaetigte Zahl (Review A1/B3)', () => {+ it('holt vor der Buchung eine frische Quote und schickt sie als max_credits', async () => {+ hoisted.studioQuote.mockResolvedValueOnce({ credits: 7654 })+ const s = useCreateStore.getState()+ s.setIntent('lipsync')+ s.setCloudOpModel('heygen-twin')+ useCreateStore.setState({ source: null, audioInput: TON })+ await useCloudCreate().generate()+ expect(hoisted.studioQuote).toHaveBeenCalledTimes(1)+ expect(hoisted.studioQuote.mock.calls[0][0]).toBe('heygen-twin')+ expect(submitted).toHaveLength(1)+ expect(submitted[0].params.max_credits).toBe(7654)+ expect(submitted[0].params.client_request_id).toBeDefined()+ })++ it('bucht price.mode input/both Modelle (die 17, review-studio-B.md B3) ebenso gegen eine bestaetigte Zahl', async () => {+ hoisted.studioQuote.mockResolvedValueOnce({ credits: 180000 })+ const s = useCreateStore.getState()+ s.setIntent('lipsync')+ s.setCloudOpModel('infinitetalk') // price.mode: 'input', review B3's exact example family+ useCreateStore.setState({ source: BILD, audioInput: TON })+ await useCloudCreate().generate()+ expect(hoisted.studioQuote).toHaveBeenCalledTimes(1)+ expect(submitted[0].params.max_credits).toBe(180000)+ })++ it('zeigt bei einer veralteten Quote den neuen Preis und bucht NICHT still nach', async () => {+ hoisted.studioQuote.mockRejectedValueOnce(new hoisted.FakeQuoteChangedError('The price has changed.', 9999))+ const s = useCreateStore.getState()+ s.setIntent('lipsync')+ s.setCloudOpModel('heygen-twin')+ useCreateStore.setState({ source: null, audioInput: TON })+ await useCloudCreate().generate()+ expect(submitted).toHaveLength(0)+ expect(useCreateStore.getState().error).toContain('9,999')+ })++ it('zeigt bei einer 409 quote_changed BEIM BUCHEN (nicht bei der Quote) den neuen Preis, statt still neu zu buchen', async () => {+ hoisted.submitCloudJob.mockRejectedValueOnce(new hoisted.FakeQuoteChangedError('The price has changed.', 5150))+ const s = useCreateStore.getState()+ s.setIntent('lipsync')+ s.setCloudOpModel('heygen-twin')+ useCreateStore.setState({ source: null, audioInput: TON })+ await useCloudCreate().generate()+ expect(useCreateStore.getState().error).toContain('5,150')+ // The dead branch B1/B3 flagged is alive now: submitCloudJob was+ // actually called (with a max_credits ceiling from the earlier, still+ // successful quote call) and ITS OWN 409 surfaced, instead of the call+ // never happening because max_credits was absent.+ expect(hoisted.submitCloudJob).toHaveBeenCalledTimes(1)+ expect(hoisted.submitCloudJob.mock.calls[0][0].params.max_credits).toBe(42)+ })++ it('bucht nie fuer eine klassische (nicht-Studio) Wahl gegen eine Quote', async () => {+ const s = useCreateStore.getState()+ s.setIntent('music')+ s.setCloudOpModel('ace-step')+ await useCloudCreate().generate()+ expect(hoisted.studioQuote).not.toHaveBeenCalled()+ expect(submitted[0].params.max_credits).toBeUndefined()+ })+ })})diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.tsindex 1bc5f5f0..3dd5ca90 100644--- a/src/hooks/useCloudCreate.ts+++ b/src/hooks/useCloudCreate.ts@@ -38,7 +38,8 @@ import { resolveRunSeed } from '../lib/run-seed'import { intentRoles, intentRequiredInputs, isStudioModel, resolveIntentPick } from '../lib/render/create-studio'import { STUDIO_MODELS, studioFields } from '../lib/render/studio-contract'import { modelLabel } from '../lib/render/preset-models'-import { selectedVideoSeconds } from '../lib/render/video-duration'+import { bookedVideoSeconds } from '../lib/render/video-duration'+import { studioQuote, StudioQuoteChangedError } from '../api/cloud/studio'// B3 (review-w2ui.md, 18.09.2026): the CSAM floor above runs regardless of// tier, but the adult half of safety.ts (ADULT_SOFT_TERMS/ADULT_HARD_TERMS)@@ -380,9 +381,17 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {seed: runSeed,}if (kind === 'video' && !bare) {- // dd29f359 (Portplan Abschnitt 6): book exactly a length the model- // prices, never a raw frames/fps ratio the server would reject.- const seconds = selectedVideoSeconds(model, s.frames, s.fps)+ // dd29f359 (Portplan Abschnitt 6), review A2 (Runde 2): book exactly+ // a length the model prices, read from the SAME catalog-first list+ // LaneControls shows (effectiveVideoDurations, in video-duration.ts),+ // never the static JSON alone, that mismatch silently booked a+ // shorter clip than the one shown and priced (review-studio-A.md+ // B2). bookedVideoSeconds throws loud, in English, if frames/fps+ // still fall outside the model's list, before any credit is claimed.+ // Review A kleiner Punkt 1 (studio-r2): reads the cloud track's OWN+ // cloudFrames/cloudFps, the same fields LaneControls' Length control+ // writes, not the local track's shared frames/fps.+ const seconds = bookedVideoSeconds(model, { frames: s.cloudFrames, fps: s.cloudFps })params.frames = seconds * 16params.fps = 16}@@ -487,6 +496,44 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {// we were uploading inputs.if (ac.signal.aborted) return+ // Review A1/B3 (Runde 2, 20.09.2026): a Studio run books against a+ // SERVER-CONFIRMED number, never the client formula alone+ // (studio-contract.ts's createStudioCost is a PREVIEW for the meter,+ // this call is what actually gets charged). Fetched HERE, right after+ // the uploads and right before the credits claim, against the SAME+ // staged paths the submit below sends, that is "before the render+ // starts" for every Studio pick, including the 17 price.mode+ // 'input'/'both' endpoints (talking/presenter/duo/motion/restyle/+ // upscale/extend) that Composer's live meter can only PREVIEW: those+ // price off the uploaded file's measured length, which the provider+ // only knows once the file is staged, so a true confirmed number+ // cannot exist before this point without uploading a file the+ // customer might never submit. useStudioPrice (Composer's live meter)+ // already confirms output/characters-mode picks continuously while+ // typing; this call re-confirms fresh, right before the claim, so a+ // stale live quote can never book either.+ //+ // Bewusste Abweichung von der Web-Referenz (Portplan Abschnitt 4/7):+ // apps/web/hooks/useCloudCreate.ts sendet `max_credits` NIE aus dem+ // normalen Create-Weg, nur die Preset-Werkstatt tut das+ // (PresetWorkshop.tsx:191). Das Web bucht also aus dem Create-Tab ohne+ // Deckel, genau das Risiko 1 des Portplans. Der Desktop weicht hier+ // bewusst ab und deckelt auch den Create-Tab. Der Eigner sollte den+ // Web-Client nachziehen (review-studio-A.md B1, review-studio-B.md B3).+ if (studioModel) {+ s.setProgress(9, 'Confirming the price…')+ const quoteFields: Record<string, unknown> = {}+ for (const k of ['source_path', 'mask_path', 'audio_path', 'audio2_path', 'video_path', 'last_image_path', 'shot_type'] as const) {+ if (params[k] !== undefined) quoteFields[k] = params[k]+ }+ const quote = await studioQuote(studioModel, s.prompt, {+ op: 'studio',+ studio_options: studioOptionsFiltered ?? {},+ ...quoteFields,+ })+ params.max_credits = quote.credits+ }+// Der Titel geht mit an den Server, sonst hiesse der Eintrag nach dem// naechsten Laden wieder nur nach seiner Gattung (Portplan Abschnitt 1,// Punkt 9). A Studio run with no prompt (or a schema whose prompt field@@ -573,14 +620,14 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {}} catch (err) {const st = useCreateStore.getState()- if (err instanceof QuoteChangedError) {- // 409 quote_changed (Portplan Abschnitt 3/4): a submit that DID carry- // a client-confirmed ceiling (max_credits, e.g. from a future Studio- // caller that quotes before booking) found the server's own re-quote- // exceeding it, show the new price instead of silently rebooking.- // This Composer path never sends max_credits itself today (no- // pre-submit quote call, see useStudioPrice for the on-screen-only- // preview), so this branch is a safety net, not yet a live path.+ if (err instanceof QuoteChangedError || err instanceof StudioQuoteChangedError) {+ // 409 quote_changed (Portplan Abschnitt 3/4, review A1/B3 Runde 2):+ // the confirmed number went stale between the pre-submit+ // studioQuote() call above and the server's own booking check+ // (QuoteChangedError), or the quote call itself came back stale+ // (StudioQuoteChangedError, e.g. the provider's price moved between+ // two calls). Either way: show the NEW price and stop, never+ // silently rebook against it.st.setError(`The price changed to ${err.credits.toLocaleString('en-US')} credits. Review it, then hit Create again.`)} else if (err instanceof CloudJobError && err.status === 429) {st.setError(throttleMessage(err))diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.tsindex a8639fc2..6673446e 100644--- a/src/lib/release-notes.ts+++ b/src/lib/release-notes.ts@@ -328,7 +328,7 @@ export const RELEASE_NOTES: ReleaseNote[] = [// Katalog).{title: 'Create-Studio: a new guided path on the cloud track.',- detail: 'A preset shelf next to the usual Create tab walks a render from image to motion to sound, in steps, each backed by any model that can do that step\'s job. Each step\'s controls come straight from the picked model\'s own provider schema, and the price shown is the one the provider actually confirms before Start, never a formula guessed on this side. This needs a server change that has not shipped on lu-labs.ai yet; until it does, Create shows "This feature needs a newer LU Cloud server. Try again later." instead of guessing a price or booking one.',+ detail: 'A preset shelf next to the usual Create tab walks a render from image to motion to sound, in steps, each backed by any model that can do that step\'s job. Each step\'s controls come straight from the picked model\'s own provider schema, and the price shown is the one the provider actually confirms before Start, never a formula guessed on this side. This needs a server change that has not shipped on lu-labs.ai yet; until it does, the shelf stays hidden and every Create tab behaves exactly as before. If a future server ever advertises Studio without also fixing the two price-check routes, Create shows "This feature needs a newer LU Cloud server. Try again later." instead of guessing a price or booking one.',},{title: 'Cloud video renders now offer exactly the lengths a model actually supports.',diff --git a/src/lib/render/__tests__/cloud-jobs.test.ts b/src/lib/render/__tests__/cloud-jobs.test.tsindex fdc5e575..cd4e37c2 100644--- a/src/lib/render/__tests__/cloud-jobs.test.ts+++ b/src/lib/render/__tests__/cloud-jobs.test.ts@@ -30,7 +30,7 @@ describe('intentToJob', () => {// P9: galleryItemFromJob was built twice independently (PresetWorkshop.tsx,// P6; inline in useCloudCreate.ts, P7) because P5 did not port the web's-// version — folded here into the one place the portplan names for it, so+// version, folded here into the one place the portplan names for it, so// both PresetWorkshop and useCloudCreate now build a gallery entry the same// way (studio-p5.md/studio-p6.md, "Offen fuer P9").describe('galleryItemFromJob', () => {diff --git a/src/lib/render/__tests__/create-studio.test.ts b/src/lib/render/__tests__/create-studio.test.tsindex c71f27f1..e6d807ee 100644--- a/src/lib/render/__tests__/create-studio.test.ts+++ b/src/lib/render/__tests__/create-studio.test.ts@@ -10,17 +10,28 @@// 'upscale' fuer Bild UND Video (aelterer Utility-Op-Pfad in createStore.ts,// P5's Datei). StudioIntent in create-studio.ts ist der lokale Behelf dafuer;// siehe die Notiz dort und den Bericht fuer P9.-import { describe, expect, it } from 'vitest'+import { beforeEach, describe, expect, it } from 'vitest'import {intentPickerModels, intentRequiredInputs, intentRoleFor, intentRoles,isStudioModel, resolveIntentPick, createStudioCost, type StudioIntent,} from '../create-studio'import { STUDIO_MODELS } from '../studio-contract'-import { opPickerModels } from '../../../stores/cloudCatalogStore'+import { CLOUD_MODEL_SEED } from '../cloud-models'+import { opPickerModels, useCloudCatalogStore } from '../../../stores/cloudCatalogStore'import type { CreateIntent } from '../../../stores/createStore'const MIT_ROLLE: StudioIntent[] = ['lipsync', 'music', 'extend', 'motion', 'video_upscale']+// Review B1 (Runde 2): die ganze Datei prueft den Fall "der lebende Katalog+// kennt Studio" (`quote_required` auf mindestens einem Eintrag). Das ist+// der Zustand nach einem erfolgreichen Katalogabruf gegen einen Server, der+// das Studio kennt. Der GEGENTEILIGE Fall (kein `quote_required`, altes+// Verhalten) hat einen eigenen Fall unten ("faellt ohne quote_required im+// Katalog auf die klassischen Mitglieder zurueck").+beforeEach(() => {+ useCloudCatalogStore.setState({ models: [...CLOUD_MODEL_SEED, { id: 'test-studio-marker', label: 'x', kind: 'image', quote_required: true }] })+})+describe('die Unterkategorien von Create fahren dieselben Modelle wie die Presets', () => {it('jede Unterkategorie mit einer Rolle hat eine Auswahl, und jedes Mitglied steht einmal drin', () => {for (const intent of MIT_ROLLE) {@@ -100,4 +111,42 @@ describe('die Unterkategorien von Create fahren dieselben Modelle wie die Presetexpect(intentPickerModels(intent), intent).toEqual([])}})++ // Review B1 (review-studio-B.md): ohne `quote_required` im Katalog (ein+ // aelterer Server, oder ein frischer Zustand vor der ersten Katalogabfrage)+ // darf KEIN Studio-Modell in der Auswahl stehen, und Extend/Motion muessen+ // sich exakt wie vor dem Port verhalten. Gemessen war: `resolveIntentPick`+ // gab fuer Extend `preset-wan-2.2-spicy-extend` (price.mode 'output', lief+ // sofort in CORS/404) und fuer Motion `scail-2` (price.mode 'input', lief+ // ungeprueft durch und wurde erst vom Server abgewiesen) zurueck, beide+ // Studio-Modelle, obwohl der Katalog sie nie angekuendigt hatte.+ describe('faellt ohne quote_required im Katalog auf die klassischen Mitglieder zurueck', () => {+ beforeEach(() => {+ useCloudCatalogStore.setState({ models: CLOUD_MODEL_SEED })+ })++ it('listet fuer keine Rollen-Absicht ein Studio-Mitglied', () => {+ for (const intent of MIT_ROLLE) {+ for (const m of intentPickerModels(intent)) {+ expect(m.op, `${intent}/${m.id}`).not.toBe('studio')+ expect(isStudioModel(m.id), `${intent}/${m.id}`).toBe(false)+ }+ }+ })++ it('waehlt fuer Extend keinen Studio-Zwilling, egal was zuvor gespeichert war', () => {+ const pick = resolveIntentPick('extend', '')+ expect(isStudioModel(pick), pick).toBe(false)+ // Eine gespeicherte Studio-Wahl aus einer frueheren Session (der+ // Katalog kannte Studio damals) ueberlebt den Ruecksprung auf einen+ // aelteren Server nicht.+ expect(isStudioModel(resolveIntentPick('extend', 'preset-wan-2.2-spicy-extend'))).toBe(false)+ })++ it('waehlt fuer Motion keinen Studio-Zwilling, egal was zuvor gespeichert war', () => {+ const pick = resolveIntentPick('motion', '')+ expect(isStudioModel(pick), pick).toBe(false)+ expect(isStudioModel(resolveIntentPick('motion', 'scail-2'))).toBe(false)+ })+ })})diff --git a/src/lib/render/__tests__/preset-models.test.ts b/src/lib/render/__tests__/preset-models.test.tsindex d603a37f..7bc2f4c8 100644--- a/src/lib/render/__tests__/preset-models.test.ts+++ b/src/lib/render/__tests__/preset-models.test.ts@@ -22,16 +22,29 @@// "Altbestand"; erst die lebende Katalogantwort liefert ihn). Ein Test, der// hier "hat immer einen Preis" verlangt, wuerde eine Vollstaendigkeit// behaupten, die die Testumgebung ohne Netz gar nicht hat.-import { describe, expect, it } from 'vitest'+import { beforeEach, describe, expect, it } from 'vitest'import {ALL_ROLES, classicCredits, presetModels, requiredRoleInputs, roleForModel,roleHasChoice, roleInputs,} from '../preset-models'import { CREATE_PRESETS } from '../create-presets'import { STUDIO_MODELS } from '../studio-contract'+import { CLOUD_MODEL_SEED } from '../cloud-models'import { cloudModelById, cloudModelSupportsOp, useCloudCatalogStore } from '../../../stores/cloudCatalogStore'import { videoDurations } from '../video-duration'+// Review B1 (Runde 2): `presetModels()` is what the Preset Workshop (P6)+// calls directly, and the workshop is only ever reachable when the live+// catalog already announces Studio (`quote_required`, PresetShelf.tsx hides+// itself otherwise). This whole file tests that reachable state, so it+// seeds one, the same way create-studio.test.ts does for the Composer's+// OWN gate. Without this, `allPresetModels()`'s "a classic id yields to its+// live studio twin" skip (preset-models.ts) turns off by default and every+// twin pair here would double up.+beforeEach(() => {+ useCloudCatalogStore.setState({ models: [...CLOUD_MODEL_SEED, { id: 'test-studio-marker', label: 'x', kind: 'image', quote_required: true }] })+})+// Die Ops, die die Submit-Route pro Art annimmt. Spiegel von SUPPORTED_OPS in// app/api/jobs/route.ts (Server): was dort fehlt, wird vor dem Abbuchen// abgelehnt.diff --git a/src/lib/render/cloud-jobs.ts b/src/lib/render/cloud-jobs.tsindex d553ffcd..b5c25640 100644--- a/src/lib/render/cloud-jobs.ts+++ b/src/lib/render/cloud-jobs.ts@@ -4,7 +4,7 @@// intentToJob's parameter, kept as a LOCAL literal union rather than an// `import type { CreateIntent } from '../../stores/createStore'`. createStore// now imports the cloud catalog (cloudCatalogStore, itself typed against-// RenderKind/RenderOp from this file) for addToGallery's backend gate — a+// RenderKind/RenderOp from this file) for addToGallery's backend gate, and a// type-only import back to createStore here would close that into a module// cycle (`npm run cycles`, madge, counts type-only edges too). The two sets// must be kept in sync by hand; CreateIntent in stores/createStore.ts is the@@ -19,7 +19,7 @@ export type RenderKind = 'image' | 'video' | 'audio'// 2.5.8 adds the specialized ops behind the new Create categories: 'lipsync'// (talking character), 'extend' (continue a clip), 'motion' (motion transfer,// NOT face-swap — banned), 'music', 'tts' and 'lora-train' (Character-Studio).-// 'studio' (2026-09): the guided Create-Studio path — a schema-driven+// 'studio' (2026-09): the guided Create-Studio path, a schema-driven// endpoint booked with `studio_options` and a server-confirmed quote, rather// than one of the fixed param shapes above.export type RenderOp =@@ -84,8 +84,8 @@ export function intentToJob(intent: CreateIntentLike): { kind: RenderKind; op: R}/** The neutral gallery-entry shape a finished cloud job produces before the- * caller layers its own fields on top (prompt, label, and — for the- * Composer's classic path — the actual local render params: sampler, steps,+ * caller layers its own fields on top (prompt, label, and, for the+ * Composer's classic path, the actual local render params: sampler, steps,* seed, cfgScale, width, height, intent).** Web equivalent: lib/render/cloud-jobs.ts's `galleryItemFromJob`, which P5diff --git a/src/lib/render/cloud-models.ts b/src/lib/render/cloud-models.tsindex eeccb6e3..b0a047d9 100644--- a/src/lib/render/cloud-models.ts+++ b/src/lib/render/cloud-models.ts@@ -71,9 +71,12 @@ export interface CloudModel {** `durations` (P3, server field `clip.durations`, from dd29f359): every* length the model actually books, not just the two named buttons; the- * booking truth is `bookedVideoSeconds()` in `video-duration.ts` against- * this same list. Optional: an older catalog payload omits it and the- * short/long pair above still holds. */+ * booking truth is `useCloudCreate`'s call to `bookedVideoSeconds()` in+ * `video-duration.ts`, which reads this SAME list first (via+ * `effectiveVideoDurations()`, also what the picker shows) and only falls+ * back to `video-durations.json` when this field is absent (review-+ * studio-A.md B2, fixed Runde 2 20.09.2026). Optional: an older catalog+ * payload omits it and the short/long pair above still holds. */clip?: { short: number; long?: number; durations?: number[] }/** Per-run credit cost (base = image or 5s clip, long = 8s clip; music* models additionally quote per_s for the duration slider).diff --git a/src/lib/render/create-studio.ts b/src/lib/render/create-studio.tsindex 19572a6a..0592000a 100644--- a/src/lib/render/create-studio.ts+++ b/src/lib/render/create-studio.ts@@ -12,8 +12,8 @@import type { CreateIntent } from '../../stores/createStore'import { STUDIO_MODELS, studioBaseCredits, studioPreviewCredits } from './studio-contract'-import { presetModels, requiredRoleInputs, roleInputs, type PresetModel, type StepRole } from './preset-models'-import { opPickerModels } from '../../stores/cloudCatalogStore'+import { presetModels, requiredRoleInputs, type PresetModel, type StepRole } from './preset-models'+import { catalogHasStudio, opPickerModels } from '../../stores/cloudCatalogStore'// Desktop port (P2, checked again in P9): the web's CreateIntent already// carries 'video_upscale' as a distinct intent from the plain 'upscale'@@ -22,7 +22,7 @@ import { opPickerModels } from '../../stores/cloudCatalogStore'// video upscale via the older utility-op path. This is not a leftover type// gap: components/create/experimental/intents.ts documents (comment at the// 'upscale' intent, predates the Studio port) that a separate video-upscale-// intent is "a feature decision for David ... out of scope here" — it needs+// intent is "a feature decision for David ... out of scope here": it needs// a new IntentBar tile and Composer wiring, a UI feature addition, not an// integration fold. StudioIntent stays as the local shim until that decision// is made; the video_upscale role list below (STUDIO_MODELS entries@@ -59,7 +59,20 @@ export function intentRoleFor(intent: StudioIntent, model: string): StepRole | u* kennt, und ein Wechsel der Liste darf seine bisherige Wahl nicht verschieben.* `lipsync` fuehrt zusaetzlich die beiden Nachvertonungsmodelle, die einen* fertigen Clip statt eines Fotos lesen. Die sind kein Rollenmitglied, gehoeren- * in der Oberflaeche aber seit jeher hierher. */+ * in der Oberflaeche aber seit jeher hierher.+ *+ * Review B1 (Runde 2, 20.09.2026): ein Studio-Mitglied (`m.op === 'studio'`)+ * erscheint NUR, wenn der lebende Katalog `quote_required` fuehrt+ * (catalogHasStudio(), cloudCatalogStore.ts). Ein aelterer Server (oder ein+ * frischer Zustand vor der ersten Katalogabfrage) sagt damit selbst, dass er+ * die Studio-Endpunkte nicht kennt, und diese EINE Stelle traegt die Regel+ * fuer alle fuenf Aufrufer (Composer, CreditsMeter, CreateExperimental,+ * ModelChip direkt, useCloudCreate ueber resolveIntentPick). Vorher wich+ * jede Rolle auf ihr erstes STUDIO_MODELS-Mitglied aus, sobald der+ * gespeicherte cloudOpModel nicht (mehr) in der Liste stand, und Extend/+ * Motion liefen damit auf einem Server ohne Studio ins Leere+ * (review-studio-B.md B1). Jede klassische Absicht (lipsync/music) faellt+ * auf ihre klassischen Mitglieder zurueck, genau wie vor dem Port. */export function intentPickerModels(intent: StudioIntent): PresetModel[] {const roles = intentRoles(intent)if (!roles.length) return []@@ -69,7 +82,11 @@ export function intentPickerModels(intent: StudioIntent): PresetModel[] {if (intent === 'lipsync') for (const m of opPickerModels('lipsync')) {add({ id: m.id, label: m.label, kind: m.kind, op: 'lipsync', adult: m.adult === true })}- for (const role of roles) for (const m of presetModels(role)) add(m)+ const studioLive = catalogHasStudio()+ for (const role of roles) for (const m of presetModels(role)) {+ if (m.op === 'studio' && !studioLive) continue+ add(m)+ }return out}@@ -88,22 +105,12 @@ export function isStudioModel(id: string): boolean {return !!STUDIO_MODELS[id]}-/** Was dieses Modell in dieser Absicht an Eingaben liest, als Anbieterfeld ->- * Job-Parameter. */-export function intentInputs(intent: StudioIntent, model: string): Record<string, string> {- const role = intentRoleFor(intent, model)- return role ? roleInputs(role, model) : {}-}-/** Die Eingaben, ohne die dieses Modell nicht starten kann. */export function intentRequiredInputs(intent: StudioIntent, model: string): string[] {const role = intentRoleFor(intent, model)return role ? requiredRoleInputs(role, model) : []}-/** Der Preis eines Studio-Laufs fuer die Anzeige. `null`, wenn die Optionen- * noch nicht vollstaendig sind: dann steht im Zaehler nichts statt einer- * erfundenen Zahl. *//** Der Preis eines Studio-Laufs fuer Zaehler und Startknopf im Create-Tab.** Endpunkte, die nach der gewuenschten Laenge abrechnen, stehen hier genau.@@ -127,13 +134,3 @@ export function pricesByInput(model: string): boolean {const mode = STUDIO_MODELS[model]?.price.modereturn mode === 'input' || mode === 'both'}--export function studioDisplayCredits(- model: string,- options: Record<string, unknown>,- seconds?: number,- imageCount = 1,- promptLength = 100,-): number | null {- return studioPreviewCredits(model, options, seconds, imageCount, promptLength)-}diff --git a/src/lib/render/gallery-label.ts b/src/lib/render/gallery-label.tsindex 18116ee6..bc22051c 100644--- a/src/lib/render/gallery-label.ts+++ b/src/lib/render/gallery-label.ts@@ -14,8 +14,7 @@// Katalog in einem Store statt in einer statischen Liste, deshalb kommt// cloudModelById hier aus cloudCatalogStore statt aus cloud-models.import type { GalleryItem } from '../../stores/createStore'-import { STUDIO_MODELS } from './studio-contract'-import { cloudModelById } from '../../stores/cloudCatalogStore'+import { modelLabel as resolveModelLabel } from './preset-models'/** Was der Lauf getan hat, wenn niemand etwas geschrieben hat. */const OP_NAME: Record<string, string> = {@@ -34,8 +33,17 @@ const TYPE_NAME: Record<GalleryItem['type'], string> = {audio: 'Audio',}+// Review A kleiner Punkt 3: this used to be its own copy (STUDIO_MODELS+// first, catalog second), while preset-models.ts's exported `modelLabel`+// (what useCloudCreate.ts sends as `params.label`) checks the catalog twin+// FIRST. A model that is both a Studio entry and a catalog twin with a+// DIFFERENT label could read one name before a reload (this file, from the+// job) and another after (preset-models.ts's version, from the picker),+// exactly the mix-up gallery-label.ts exists to prevent. One function now,+// imported, not two that can drift apart.function modelLabel(id: string): string | undefined {- return STUDIO_MODELS[id]?.label ?? cloudModelById(id)?.label+ const label = resolveModelLabel(id)+ return label === id ? undefined : label}/** Der Name des Eintrags. Nie leer: eine Kachel ohne Namen ist von derdiff --git a/src/lib/render/preset-models.ts b/src/lib/render/preset-models.tsindex 913488df..7a57c6eb 100644--- a/src/lib/render/preset-models.ts+++ b/src/lib/render/preset-models.ts@@ -10,7 +10,7 @@// The contract test walks each one and refuses a member that cannot.import { STUDIO_MODELS, studioSchema } from './studio-contract'-import { cloudModelById, cloudModelsFor, i2vModels, runCredits } from '../../stores/cloudCatalogStore'+import { catalogHasStudio, cloudModelById, cloudModelsFor, i2vModels, runCredits } from '../../stores/cloudCatalogStore'import type { RenderKind, RenderOp } from './cloud-jobs'export type StepRole =@@ -136,16 +136,6 @@ function entry(id: string, role: StepRole): PresetModel | null {* the whole list. Where it has none, the role is not about refusals at all* (adding sound, driving a mouth) and the full list stands, because an empty* picker would take the step away entirely. */-/** Studio-Bildmodelle ohne klassisches Gegenstueck. Der Bildwaehler im- * Create-Tab listet den Katalog; diese vier stehen in keinem Katalogeintrag,- * es gaebe sie dort also gar nicht. Ein Modell mit `sourceModel` bleibt aussen- * vor: das steht schon unter seinem alten Namen in der Liste. */-export function studioOnlyImageModels(): PresetModel[] {- const klassisch = new Set(cloudModelsFor('image').map((m) => m.id))- return presetModels('image').filter((m) =>- m.op === 'studio' && !klassisch.has(m.id) && !STUDIO_MODELS[m.id]?.sourceModel)-}-export function presetModels(role: StepRole, openOnly = false): PresetModel[] {const all = allPresetModels(role)if (!openOnly) return all@@ -161,9 +151,16 @@ function allPresetModels(role: StepRole): PresetModel[] {for (const id of ids) {if (seen.has(id)) continue// A classic id the studio registry already serves is dropped, not listed- // twice under the same name.+ // twice under the same name. Review B1 (Runde 2): ONLY when the live+ // catalog actually announces Studio (`catalogHasStudio()`), the same+ // gate `create-studio.ts`'s `intentPickerModels()` applies to the twin+ // itself. Without this, an older server dropped the classic id here+ // (its studio twin is in STUDIO_MODELS unconditionally, catalog or not)+ // while `intentPickerModels()` separately dropped the twin for being a+ // Studio entry, leaving Extend/Motion with NEITHER: an empty picker+ // instead of the classic member that used to run there.const twin = SUPERSEDED.get(id)- if (twin && ids.includes(twin)) continue+ if (twin && ids.includes(twin) && catalogHasStudio()) continueconst e = entry(id, role)if (!e) continueseen.add(id)diff --git a/src/lib/render/video-duration.ts b/src/lib/render/video-duration.tsindex d489fbcb..71eda563 100644--- a/src/lib/render/video-duration.ts+++ b/src/lib/render/video-duration.ts@@ -1,22 +1,64 @@// Supported and priced LU clip lengths. Provider schemas checked 2026-09-19.// Kept byte-identical between API and worker by a contract test.import durations from './video-durations.json'+import { cloudModelById } from '../../stores/cloudCatalogStore'+export function videoDurations(model: string): readonly number[] {return (durations as Record<string, number[]>)[model] ?? []}+// Review A2 (Runde 2, 20.09.2026): the catalog is the runtime truth for+// which lengths a model actually books TODAY (a live model can add or retire+// lengths any day); video-durations.json is the offline notvorrat, read only+// when the catalog carries nothing for this model yet. Neither source alone+// is enough: a fresh install that has not re-fetched the live catalog still+// needs a length list, and a length the catalog just added that the static+// file has not caught up with yet must still show and still book. This is+// the ONE place both the picker (Composer's LaneControls) and the booking+// (useCloudCreate, PresetWorkshop) read from now. Round 1 had the picker+// read this order and the booking read `videoDurations()` alone, so a length+// the catalog named but the JSON notvorrat did not know silently booked a+// shorter clip than the one shown and priced (review-studio-A.md B2).+export function effectiveVideoDurations(model: string): number[] {+ const cat = cloudModelById(model)+ if (cat?.clip?.durations?.length) return cat.clip.durations+ const json = videoDurations(model)+ if (json.length > 0) return [...json]+ if (cat?.clip) return cat.clip.long !== undefined ? [cat.clip.short, cat.clip.long] : [cat.clip.short]+ return []+}++// An invalid-become choice (model switch, or a persisted value from a model+// that no longer offers it) resets to the SHORTEST valid length, never to+// the nearest one, which could silently jump the price up.+export function snapToVideoDuration(allowed: number[], frames: number, fps: number): number {+ const raw = fps > 0 ? frames / fps : allowed[0]+ return allowed.includes(raw) ? raw : allowed[0]+}+// UI model switches reset stale selections to the shortest valid choice.export function selectedVideoSeconds(model: string, frames: number, fps: number): number {- const allowed = videoDurations(model)+ const allowed = effectiveVideoDurations(model)const raw = frames / fpsif (allowed.includes(raw)) return rawconst legacy = raw >= 6.5 ? 8 : 5return allowed.includes(legacy) && raw <= 8 ? legacy : (allowed[0] ?? 5)}+// Review A4: the one caller is useCloudCreate's booking path (Portplan+// Abschnitt 6), the client-side mirror of the server worker's own+// `bookedVideoSeconds()` validation, so a mismatched frames/fps pair fails+// loud, in English, before the credits claim, instead of silently booking+// whatever `selectedVideoSeconds` would have guessed. Reads the SAME+// catalog-first list as the picker (`effectiveVideoDurations`), not the+// static JSON alone (that mismatch was review-studio-A.md's B2).export function bookedVideoSeconds(model: string, params: Record<string, unknown>): number {- const allowed = videoDurations(model)- const invalid = () => new Error(`This model supports ${allowed.join(', ')} seconds in LU. Select a supported length before generating.`)+ const allowed = effectiveVideoDurations(model)+ const invalid = () => new Error(+ allowed.length+ ? `This model supports ${allowed.join(', ')} seconds in LU. Select a supported length before generating.`+ : 'This model\'s supported lengths are not available yet. Try again in a moment.',+ )let seconds = 5if (params.frames !== undefined || params.fps !== undefined) {const frames = params.frames ?? 80diff --git a/src/stores/__tests__/createStore-studio.test.ts b/src/stores/__tests__/createStore-studio.test.tsindex eb967928..2de70594 100644--- a/src/stores/__tests__/createStore-studio.test.ts+++ b/src/stores/__tests__/createStore-studio.test.ts@@ -3,7 +3,7 @@** Vier Faelle, die David/der Plan als Waechter verlangen:* 1. Ein Zustand der Version 1 (vor dem Studio) liest cloudStudioOptions als- * {} ein, nie als undefined — sonst faellt Object.entries() im Composer.+ * {} ein, nie als undefined, sonst faellt Object.entries() im Composer.* 2. Ein LOKALER Lauf laesst den Cloud-Modellwaehler in Ruhe: im Desktop* landen in derselben Galerie auch ComfyUI-/MLX-Ergebnisse, anders als im* Web, das keine lokale Spur kennt.@@ -90,7 +90,7 @@ describe('createStore Studio fields', () => {const s = store.getState()expect(s.cloudStudioOptions).toEqual({})expect(s.cloudStudioCredits).toBeNull()- // The Composer calls Object.entries() on this straight away — must+ // The Composer calls Object.entries() on this straight away, must// never throw on an old blob.expect(() => Object.entries(s.cloudStudioOptions)).not.toThrow()expect(Object.entries(s.cloudStudioOptions)).toEqual([])@@ -114,7 +114,7 @@ describe('createStore Studio fields', () => {expect(store.getState().cloudStudioOptions).toEqual({ duration: 8 })})- it('a saved price never rehydrates, at any version — a price from yesterday is a lie', async () => {+ it('a saved price never rehydrates, at any version: a price from yesterday is a lie', async () => {const store = await freshStoreFrom({ mode: 'image', cloudStudioCredits: 4200 },2,diff --git a/src/stores/__tests__/createStore.test.ts b/src/stores/__tests__/createStore.test.tsindex 77286f54..738eec10 100644--- a/src/stores/__tests__/createStore.test.ts+++ b/src/stores/__tests__/createStore.test.ts@@ -87,6 +87,8 @@ const INITIAL_STATE = {batchSize: 1,frames: 24,fps: 8,+ cloudFrames: 24,+ cloudFps: 8,denoise: 0.7,i2iImage: null,i2vImage: null,@@ -422,6 +424,53 @@ describe('createStore', () => {})})+ // ── cloudFrames/cloudFps: own fields, no leak either way ────+ //+ // Review A kleiner Punkt 1 (studio-r2, 20.09.2026): the cloud Length+ // control (Composer.tsx's LaneControls) used to read/write the SAME+ // frames/fps the local video lane's Frames slider owns, so a cloud clip+ // length pick silently rewrote what the local track remembered. Own+ // fields now; this proves the independence the store itself must hold,+ // the e2e test in create-studio.spec.ts proves it from the UI.+ describe('cloudFrames/cloudFps stay independent of frames/fps', () => {+ it('has its own defaults, same as frames/fps', () => {+ const state = useCreateStore.getState()+ expect(state.cloudFrames).toBe(24)+ expect(state.cloudFps).toBe(8)+ })++ it('setCloudFrames never touches frames', () => {+ useCreateStore.getState().setCloudFrames(96)+ expect(useCreateStore.getState().cloudFrames).toBe(96)+ expect(useCreateStore.getState().frames).toBe(24)+ })++ it('setCloudFps never touches fps', () => {+ useCreateStore.getState().setCloudFps(16)+ expect(useCreateStore.getState().cloudFps).toBe(16)+ expect(useCreateStore.getState().fps).toBe(8)+ })++ it('setFrames (the local slider) never touches cloudFrames', () => {+ useCreateStore.getState().setFrames(49)+ expect(useCreateStore.getState().frames).toBe(49)+ expect(useCreateStore.getState().cloudFrames).toBe(24)+ })++ it('setFps (the local slider) never touches cloudFps', () => {+ useCreateStore.getState().setFps(30)+ expect(useCreateStore.getState().fps).toBe(30)+ expect(useCreateStore.getState().cloudFps).toBe(8)+ })++ it('clamps to its own, higher ceiling (cloud has no 120-frame hardware limit, see setCloudFrames)', () => {+ useCreateStore.getState().setCloudFrames(9999)+ useCreateStore.getState().setCloudFps(0)+ expect(useCreateStore.getState().cloudFrames).toBe(3600)+ expect(useCreateStore.getState().cloudFps).toBe(1)+ })+ })+// ── setDenoise ─────────────────────────────────────────────describe('setDenoise', () => {diff --git a/src/stores/cloudCatalogStore.ts b/src/stores/cloudCatalogStore.tsindex 93ab7590..0ed1cf2c 100644--- a/src/stores/cloudCatalogStore.ts+++ b/src/stores/cloudCatalogStore.ts@@ -64,6 +64,23 @@ export function cloudModelsFor(kind: RenderKind): CloudModel[] {return useCloudCatalogStore.getState().models.filter((m) => m.kind === kind && !m.ops)}+/** Review B1 (Runde 2, 20.09.2026): the ONLY signal that the connected+ * server knows the Studio endpoints at all (Portplan Abschnitt 4, "nie+ * eine Serverversion fest verdrahten"): absence, not a version number, is+ * what an older catalog payload looks like. The default seed+ * (CLOUD_MODEL_SEED) carries `quote_required` on no entry, so a fresh+ * install reads false here until the first successful catalog fetch, same+ * as an old server that never gained Studio. Every caller that would+ * otherwise pick a Studio model as a role intent's DEFAULT (create-+ * studio.ts's `intentPickerModels`, which `resolveIntentPick` and five+ * downstream components all read) must gate on this, or a Create-tab run+ * on an old server picks an endpoint that server has never heard of+ * (review-studio-B.md B1: Extend/Motion broke on today's server). Already+ * used the same way by PresetShelf.tsx to hide the shelf entirely. */+export function catalogHasStudio(): boolean {+ return useCloudCatalogStore.getState().models.some((m) => m.quote_required === true)+}+// Does this catalog entry serve this op? Classic models (no `ops`) keep their// flag contract: generate always, edit per flag, animate = video i2v.export function cloudModelSupportsOp(m: CloudModel, op: RenderOp): boolean {@@ -210,14 +227,14 @@ export function runCredits(// Computing this generic base/long/by_duration figure for a Studio// generation would drift from the provider's real price the moment it// changes there, and a run must never book a different number than what- // got shown (Portplan Abschnitt 7, Risiko 1) — no UI path does this today+ // got shown (Portplan Abschnitt 7, Risiko 1); no UI path does this today// (Composer/CreditsMeter route a Studio pick around runCredits entirely,// preset-models.ts/create-presets.ts only call runCredits for non-studio// steps), this guard is the safety net for the day one of them slips.//// The guard sits HERE, not before the op branches above, on purpose: a// Studio-originated video can still reach the generic video-upscale- // 'enhance' action from the gallery Lightbox — a wholly separate WaveSpeed+ // 'enhance' action from the gallery Lightbox, a wholly separate WaveSpeed// utility endpoint, priced from the flat per-second `ops` rate table, not// from this model's own Studio price. Blocking that call too (the// original, wider guard did) forced the enhance-credits gate onto the@@ -255,8 +272,17 @@ export function shortCount(n: number): string {* hint said 1,800 cr while a 3:10 run really billed 5,700, which read as a* hidden price hike (sockenmonster, bug-reports 2026-08-08). Video quotes the* short clip; the meter refines it to the exact run. Undefined when the entry- * carries no price (seed/offline). */+ * carries no price (seed/offline).+ *+ * Review B7 (Runde 2): the same `quote_required` guard `runCredits()` has+ * twenty lines up: a Studio entry must never print a self-computed hint,+ * its real price lives in `studio-contract.ts`/`studioQuote()`, not in this+ * model's `credits` field. Harmless today (a Studio entry carries `pricing`,+ * not `credits`, so `c` is already undefined below), but a future catalog+ * payload that sends both must not silently start printing a wrong number+ * here just because the other guard was three lines away. */export function modelCostHint(m: CloudModel, op: RenderOp, seconds?: number): string | undefined {+ if (m.quote_required) return undefinedconst c = m.creditsif (!c) return undefinedconst cr =diff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex 4ebe1c65..7e2f9608 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -15,6 +15,10 @@ const RUNTIME_ONLY_KEYS: readonly string[] = [// unten): auch wenn ein fremder/aelterer Blob ihn doch mitbringt, darf er// nie zurueckkommen.'cloudStudioCredits',+ // Review A kleiner Punkt 1 (studio-r2): the cloud video length selection,+ // own fields since this bugfix. Session-scratch like source/mask, not a+ // preference worth remembering across restarts.+ 'cloudFrames', 'cloudFps',]import type { ModelType, ClassifiedModel } from '../api/comfyui'import { classifyModel } from '../api/comfyui'@@ -231,6 +235,16 @@ interface CreateState {batchSize: numberframes: numberfps: number+ // Review A kleiner Punkt 1 (studio-r2): the cloud video Length control used+ // to read and write these SAME frames/fps fields, which the local video+ // lane also owns. Picking a cloud length silently rewrote the local+ // Frames slider's remembered value, so a later switch back to the local+ // track showed a number the user never chose there. Own fields, runtime+ // only (see RUNTIME_ONLY_KEYS): the cloud track keeps its own length+ // selection, the local track keeps its own, and neither can overwrite the+ // other by backend switch or model switch alone.+ cloudFrames: number+ cloudFps: numberdenoise: number // Denoise strength for I2I (0.0–1.0)/** Native text-to-image latent upscale + refinement pass (local ComfyUI). */hiresFixEnabled: boolean@@ -299,11 +313,11 @@ interface CreateState {* coerces a stale cross-intent pick onto the op's own list. */cloudOpModel: string/** Studio: the schema-driven option values for the picked cloudOpModel step- * (studio-contract.ts). Belongs to the model, not the run — a model switch+ * (studio-contract.ts). Belongs to the model, not the run: a model switch* drops them, see setCloudOpModel. */cloudStudioOptions: Record<string, unknown>/** Studio: the last confirmed studio-quote price, shown next to the start- * button. Never persisted — a stale price is a lie, see partialize. */+ * button. Never persisted: a stale price is a lie, see partialize. */cloudStudioCredits: number | null/** Runtime-only: the LOCAL model picked inside a specialized lane (ACE* checkpoint / S2V UNet / Animate-VACE UNet). One slot for all lanes —@@ -363,6 +377,8 @@ interface CreateState {setBatchSize: (batchSize: number) => voidsetFrames: (frames: number) => voidsetFps: (fps: number) => void+ setCloudFrames: (frames: number) => void+ setCloudFps: (fps: number) => voidsetDenoise: (denoise: number) => voidsetHiresFixEnabled: (enabled: boolean) => voidsetHiresScale: (scale: number) => void@@ -426,7 +442,7 @@ interface CreateState {updateGalleryItem: (id: string, patch: Partial<GalleryItem>) => void/** Cloud hydration: merges freshly-listed jobs into the gallery. Existing* items (matched by jobId/id) just get a fresh signed URL plus a- * backfilled prompt/label when they never had one — nothing here ever+ * backfilled prompt/label when they never had one, nothing here ever* overwrites what is already on screen. See mergeGallery below. */mergeGallery: (items: GalleryItem[]) => voidremoveFromGallery: (id: string) => void@@ -532,6 +548,8 @@ export const useCreateStore = create<CreateState>()(batchSize: 1,frames: 24,fps: 8,+ cloudFrames: 24,+ cloudFps: 8,denoise: 0.7,hiresFixEnabled: false,hiresScale: 1.5,@@ -663,6 +681,16 @@ export const useCreateStore = create<CreateState>()(setBatchSize: (batchSize) => set({ batchSize: Math.max(1, Math.min(8, Math.floor(batchSize))) }),setFrames: (frames) => set({ frames: Math.max(1, Math.min(120, Math.floor(frames))) }),setFps: (fps) => set({ fps: Math.max(1, Math.min(60, Math.floor(fps))) }),+ // Review A kleiner Punkt 1 (studio-r2, 20.09.2026, found by the new+ // e2e test itself): the local slider's 120-frame clamp is a real+ // ComfyUI hardware constraint; the cloud track only ever encodes+ // `seconds * 16` here (never rendered as an actual frame count), and+ // video-durations.json's longest priced clip is already 15s (240+ // frames at 16fps). 3600 (225s) leaves headroom for a longer length a+ // provider adds later without silently clamping a real priced option+ // back down to the shortest one, the same Risiko 1 A2 fixed.+ setCloudFrames: (frames) => set({ cloudFrames: Math.max(1, Math.min(3600, Math.floor(frames))) }),+ setCloudFps: (fps) => set({ cloudFps: Math.max(1, Math.min(60, Math.floor(fps))) }),setDenoise: (denoise) => set({ denoise: Math.max(0, Math.min(1, denoise)) }),setHiresFixEnabled: (hiresFixEnabled) => set({ hiresFixEnabled }),setHiresScale: (hiresScale) => set({@@ -927,7 +955,7 @@ export const useCreateStore = create<CreateState>()(// Cloud hydration: the server's job list is the source of truth for// hosted renders. Existing items (matched by jobId/id) just get a fresh// signed URL plus a backfilled prompt/label when they never had one- // (an older gallery, from before the list route sent them) — nothing+ // (an older gallery, from before the list route sent them), nothing// here ever overwrites what is already on screen, so a value the// customer already saw cannot jump. Unknown jobs (other device,// cleared storage) are added with the server's metadata.@@ -951,6 +979,12 @@ export const useCreateStore = create<CreateState>()()}const merged = [...byKey.values()].sort((a, b) => b.createdAt - a.createdAt)+ // Review A3: dieselbe Zusage wie in addToGallery/removeFromGallery,+ // jeder Pfad, der einen Eintrag aus der Galerie wirft, gibt seine+ // blob-URL frei. Ein lokaler MLX-Clip, den eine Wolken-Hydrierung vom+ // Deckel schiebt, hielt seine Bytes sonst fuer den Rest der+ // Fenster-Lebensdauer fest (lu-desktop-oom-persist).+ for (const dropped of merged.slice(GALLERY_CAP)) releaseItemMedia(dropped)return { gallery: merged.slice(0, GALLERY_CAP) }}),removeFromGallery: (id) => set((s) => {@@ -1019,7 +1053,7 @@ export const useCreateStore = create<CreateState>()(triggerWord: state.triggerWord,trainSteps: state.trainSteps,// Studio: the picked step's option values are a preference like the- // ones above. cloudStudioCredits is NOT here on purpose — a saved+ // ones above. cloudStudioCredits is NOT here on purpose: a saved// price from yesterday is a lie, see the field's own doc comment.cloudStudioOptions: state.cloudStudioOptions,}),@@ -1032,7 +1066,7 @@ export const useCreateStore = create<CreateState>()(// an older build that still declares version 1 already ships its own// migrate (the identity function below, unchanged by this bump), so a// downgrade reading a version-2 blob calls THAT migrate, gets the state- // back unchanged, and loses nothing — the pairing the contract asks+ // back unchanged, and loses nothing: the pairing the contract asks// for was already in place before this change.version: 2,// Explicit annotations for the same reason the state creator carries@@ -1040,7 +1074,7 @@ export const useCreateStore = create<CreateState>()(// typing here and infers the store as Partial<CreateState>.//// A version-1 blob is missing cloudStudioOptions/cloudStudioCredits- // entirely (they did not exist yet) — merge() below already backfills+ // entirely (they did not exist yet); merge() below already backfills// any key absent from the persisted blob from `current`'s defaults, so// this migrate only needs to guard the one case merge() cannot: a// blob that DOES carry the key but as `undefined` (a JSON round-trip