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
feat(cloud): cloud voice + all six render ops in the Create surface
purplef40b3d91fcb7
diff --git a/src/api/voice.ts b/src/api/voice.tsindex 021434d4..47e53a7f 100644--- a/src/api/voice.ts+++ b/src/api/voice.ts@@ -1,9 +1,12 @@import { backendCall, isTauri } from "./backend";+import { cloudFetch, jsonOrError, CloudJobError } from "./cloud/client";/**- * Voice API — 100% local- * STT: Local Whisper (faster-whisper or openai-whisper) via /local-api/transcribe- * TTS: Browser SpeechSynthesis (runs locally in the browser, no cloud)+ * Voice API.+ * Local mode: STT = local Whisper (faster-whisper) via /local-api/transcribe,+ * TTS = Piper / external engine / browser SpeechSynthesis.+ * Cloud mode (appMode 'cloud'): STT = Whisper large-v3-turbo, TTS = MiniMax+ * Speech-02 — both via the metered lu-labs.ai endpoints (useVoice picks).*/let whisperChecked = false@@ -211,6 +214,41 @@ export async function transcribeAudio(audioBlob: Blob): Promise<string> {return data.transcript || "";}+// --- LU Cloud voice (appMode 'cloud') ---++/** Cloud STT: POST the recorded clip to /api/voice/transcribe (Whisper+ * large-v3-turbo, flat-metered per request — so useVoice disables the+ * interim-streaming cadence in cloud mode and only sends the final take). */+export async function transcribeAudioCloud(audioBlob: Blob): Promise<string> {+ const res = await cloudFetch("/api/voice/transcribe", {+ method: "POST",+ headers: { "content-type": audioBlob.type || "audio/wav" },+ body: audioBlob,+ });+ const data = await jsonOrError<{ text?: string }>(res);+ return data.text || "";+}++/** Cloud TTS: /api/voice/tts streams back MP3 (MiniMax Speech-02). Returns an+ * object URL for playNeuralAudio; the handful of clips per session makes+ * revocation bookkeeping not worth it. */+export async function synthesizeCloud(text: string, voice?: string): Promise<string> {+ const res = await cloudFetch("/api/voice/tts", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ text, ...(voice ? { voice } : {}) }),+ });+ if (!res.ok) {+ const body = await res.json().catch(() => ({}) as { error?: string });+ throw new CloudJobError(+ typeof body.error === "string" ? body.error : `cloud TTS failed (${res.status})`,+ res.status,+ );+ }+ const blob = await res.blob();+ return URL.createObjectURL(blob);+}+// --- Local neural TTS (Piper) ---// Synthesizes via the bundled Piper voice through the Rust `synthesize` command// (100% local, no cloud). The browser SpeechSynthesis path in useVoice handlesdiff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsxindex 72885c4a..5c188509 100644--- a/src/components/create/experimental/Composer.tsx+++ b/src/components/create/experimental/Composer.tsx@@ -31,6 +31,8 @@ export function Composer({ onOpenAdvanced }: Props) {const source = useCreateStore((s) => s.source)const isGenerating = useCreateStore((s) => s.isGenerating)const backend = useCreateStore((s) => s.backend)+ const targetResolution = useCreateStore((s) => s.targetResolution)+ const setTargetResolution = useCreateStore((s) => s.setTargetResolution)const { generate, cancel, quota } = useCreateExp()// The Create button turns into Cancel in place — a double-click's second@@ -47,6 +49,9 @@ export function Composer({ onOpenAdvanced }: Props) {}, [cancel])const needPrompt = meta.needsPrompt+ // Single-purpose endpoints (cutout/upscale/eraser): no prompt, no+ // generation knobs, no model choice — just the input (+ mask/resolution).+ const isUtility = meta.id === 'removebg' || meta.id === 'upscale' || meta.id === 'eraser'const creditsOk =backend !== 'cloud' ||(quota != null && quota.remaining.credits >= quota.costs[intentToJob(intent).kind])@@ -58,7 +63,7 @@ export function Composer({ onOpenAdvanced }: Props) {return (<div className="shrink-0 px-4 pb-4 pt-2"><div className="mx-auto w-full max-w-[760px] space-y-2.5">- {meta.id !== 'removebg' && <QuickControls />}+ {!isUtility && <QuickControls />}<div className="rounded-[var(--radius-panel)] bg-white/[0.03] border border-white/[0.06] focus-within:border-white/15 transition-colors">{meta.needsPrompt && (@@ -114,7 +119,20 @@ export function Composer({ onOpenAdvanced }: Props) {{/* The backend axis moved to the global header switch (2.5.7) —the Composer just reflects it via the CreditsMeter. */}{backend === 'cloud' && <CreditsMeter />}- {meta.id !== 'removebg' && (+ {meta.id === 'upscale' && (+ <Tooltip content="Target resolution for the super-resolution pass.">+ <div>+ <Segmented+ size="sm"+ layoutId="upscale-res"+ value={targetResolution}+ onChange={(v) => setTargetResolution(v as '2k' | '4k' | '8k')}+ options={[{ value: '2k', label: '2K' }, { value: '4k', label: '4K' }, { value: '8k', label: '8K' }]}+ />+ </div>+ </Tooltip>+ )}+ {!isUtility && (<><ModelChip /><Tooltip content="All advanced settings — sampler, seed, LoRA, VAE and more.">diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsxindex 50aaab99..1172600b 100644--- a/src/components/create/experimental/CreateContext.tsx+++ b/src/components/create/experimental/CreateContext.tsx@@ -2,7 +2,7 @@ import { createContext, useContext, useEffect, useState, useCallback, type Reactimport { useCreate } from '../../../hooks/useCreate'import { useCloudCreate } from '../../../hooks/useCloudCreate'import { useCloudSession } from '../../../hooks/useCloudSession'-import { useCreateStore } from '../../../stores/createStore'+import { useCreateStore, type GalleryItem } from '../../../stores/createStore'import { useUIStore } from '../../../stores/uiStore'import { getLoraModels, getVAEModels } from '../../../api/comfyui'import { getAllNodeInfo } from '../../../api/comfyui-nodes'@@ -18,6 +18,8 @@ import type { CloudQuota } from '../../../lib/render/cloud-jobs'interface CreateExpValue {generate: () => void | Promise<void>cancel: () => void | Promise<void>+ /** Video super-resolution on a finished cloud render (Lightbox "Enhance"). */+ enhanceVideo: (item: GalleryItem, targetResolution?: '720p' | '1080p' | '2k' | '4k') => Promise<void>/** ComfyUI /object_info sampler + scheduler names (fallback lists until loaded). */samplerList: string[]schedulerList: string[]@@ -117,6 +119,7 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {const value: CreateExpValue = {generate: backend === 'cloud' ? cloud.generate : generate,cancel: backend === 'cloud' ? cloud.cancel : cancel,+ enhanceVideo: cloud.enhanceVideo,samplerList, schedulerList, loraList, vaeList,connected, modelsLoaded, modelLoadError, installCapability,cloudAvailable, quota, refreshQuota,diff --git a/src/components/create/experimental/IntentBar.tsx b/src/components/create/experimental/IntentBar.tsxindex 2dbc5b3c..4e1576c3 100644--- a/src/components/create/experimental/IntentBar.tsx+++ b/src/components/create/experimental/IntentBar.tsx@@ -12,6 +12,11 @@ const EASE = 'ease-[cubic-bezier(0.22,1,0.36,1)]'export function IntentBar() {const intent = useCreateStore((s) => s.intent())const setIntent = useCreateStore((s) => s.setIntent)+ const backend = useCreateStore((s) => s.backend)+ // Utility intents (upscale/eraser) are hosted-only endpoints — hide them on+ // the local backend. setIntent's base already clears a stale utilityOp when+ // the mode flips back and the user picks any normal intent.+ const intents = INTENTS.filter((m) => !m.cloudOnly || backend === 'cloud')return (<div@@ -22,7 +27,7 @@ export function IntentBar() {// (which runs at scale 0.7): 0.7 × 1.09 ≈ 0.763.style={{ transform: 'scale(0.763)', transformOrigin: 'center' }}>- {INTENTS.map((meta) => {+ {intents.map((meta) => {const selected = intent === meta.idconst Icon = meta.iconreturn (diff --git a/src/components/create/experimental/Lightbox.tsx b/src/components/create/experimental/Lightbox.tsxindex 7a83e0e7..fc37428e 100644--- a/src/components/create/experimental/Lightbox.tsx+++ b/src/components/create/experimental/Lightbox.tsx@@ -1,11 +1,16 @@import { useEffect } from 'react'import { motion, AnimatePresence } from 'framer-motion'-import { X } from 'lucide-react'-import type { GalleryItem } from '../../../stores/createStore'+import { X, Sparkles } from 'lucide-react'+import { useCreateStore, type GalleryItem } from '../../../stores/createStore'+import { useCreateExp } from './CreateContext'import { galleryItemUrl } from './galleryUrl'import { cn } from '../ui/cn'export function Lightbox({ item, onClose }: { item: GalleryItem | null; onClose: () => void }) {+ const backend = useCreateStore((s) => s.backend)+ const isGenerating = useCreateStore((s) => s.isGenerating)+ const { enhanceVideo } = useCreateExp()+useEffect(() => {if (!item) returnconst onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose() }@@ -13,6 +18,10 @@ export function Lightbox({ item, onClose }: { item: GalleryItem | null; onClose:return () => window.removeEventListener('keydown', onKey)}, [item, onClose])+ // Video super-resolution: only for finished CLOUD renders (jobId = the+ // clip lives in the user's render storage, which the enhance op requires).+ const canEnhance = item?.type === 'video' && !!item.jobId && backend === 'cloud' && !isGenerating+return (<AnimatePresence>{item && (@@ -26,6 +35,19 @@ export function Lightbox({ item, onClose }: { item: GalleryItem | null; onClose:<button onClick={onClose} className="absolute top-4 right-4 w-9 h-9 flex items-center justify-center rounded-lg bg-white/10 text-gray-200 hover:bg-white/20"><X size={18} /></button>+ {canEnhance && (+ <button+ onClick={(e) => {+ e.stopPropagation()+ onClose()+ void enhanceVideo(item)+ }}+ title="Upscale this clip to 1080p on the cloud fleet"+ className="absolute top-4 right-16 h-9 px-3 flex items-center gap-1.5 rounded-lg bg-white/10 text-gray-200 hover:bg-white/20 text-[0.7rem] font-medium"+ >+ <Sparkles size={13} /> Enhance+ </button>+ )}{item.type === 'video' ? (<motion.videoinitial={{ scale: 0.95 }}diff --git a/src/components/create/experimental/intents.ts b/src/components/create/experimental/intents.tsindex 9da3a4bc..46c38c9a 100644--- a/src/components/create/experimental/intents.ts+++ b/src/components/create/experimental/intents.ts@@ -1,4 +1,4 @@-import { Image as ImageIcon, Wand2, Scissors, Video, Film } from 'lucide-react'+import { Image as ImageIcon, Wand2, Scissors, Video, Film, Maximize2, Eraser } from 'lucide-react'import type { LucideIcon } from 'lucide-react'import type { CreateIntent } from '../../../stores/createStore'@@ -14,6 +14,8 @@ export interface IntentMeta {isVideo: boolean/** Capability id (custom-node bundle) this intent depends on, if any. */capability?: 'rmbg'+ /** Single-purpose hosted endpoints — only offered on the cloud backend. */+ cloudOnly?: trueexamples: string[]}@@ -41,6 +43,20 @@ export const INTENTS: IntentMeta[] = [capability: 'rmbg',examples: [],},+ {+ id: 'upscale', label: 'Upscale', short: 'Upscale', icon: Maximize2,+ placeholder: '',+ needsSource: true, needsPrompt: false, allowsMask: false, isVideo: false,+ cloudOnly: true,+ examples: [],+ },+ {+ id: 'eraser', label: 'Erase Object', short: 'Erase', icon: Eraser,+ placeholder: '',+ needsSource: true, needsPrompt: false, allowsMask: true, isVideo: false,+ cloudOnly: true,+ examples: [],+ },{id: 'video', label: 'Video', short: 'Video', icon: Video,placeholder: 'Describe the motion and the scene…',diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.tsindex d1cbe169..e0032193 100644--- a/src/hooks/useCloudCreate.ts+++ b/src/hooks/useCloudCreate.ts@@ -11,10 +11,11 @@// remoteUrl + jobId and re-sign lazily via refreshResultUrl().import { useCallback, useRef } from 'react'-import { useCreateStore } from '../stores/createStore'+import { useCreateStore, type GalleryItem } from '../stores/createStore'import { intentToJob } from '../lib/render/cloud-jobs'import {cancelJob,+ getJob,pollJob,submitCloudJob,uploadInput,@@ -85,16 +86,21 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {s.setProgress(5, 'Uploading inputs…')try {- const params: CloudJobParams = {- op,- negative_prompt: s.negativePrompt || undefined,- width: s.width,- height: s.height,- steps: s.steps,- cfg: s.cfgScale,- seed: s.seed === -1 ? undefined : s.seed,- }- if (kind === 'video') {+ // Utility endpoints (removebg/upscale/eraser) take no generation knobs —+ // send only what the op consumes so the submit schema stays honest.+ const isUtility = op === 'removebg' || op === 'upscale' || op === 'eraser'+ const params: CloudJobParams = isUtility+ ? { op }+ : {+ op,+ negative_prompt: s.negativePrompt || undefined,+ width: s.width,+ height: s.height,+ steps: s.steps,+ cfg: s.cfgScale,+ seed: s.seed === -1 ? undefined : s.seed,+ }+ if (kind === 'video' && !isUtility) {params.frames = s.framesparams.fps = s.fps}@@ -102,14 +108,21 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {params.denoise = s.denoiseparams.grow_mask_by = s.growMaskBy}+ if (op === 'upscale') {+ params.target_resolution = s.targetResolution+ }// ImageRef.url is always a data URL preview; the cloud path re-uploads// from it, so a source picked while on the local backend still works.if (op !== 'generate' && s.source) {params.source_path = await uploadInput(await dataUrlToBlob(s.source.url), 'source')}- if (op === 'edit') {+ if (op === 'edit' || op === 'eraser') {if (!s.mask) {- s.setError('Paint a mask first — the edit only changes the painted area.')+ s.setError(+ op === 'eraser'+ ? 'Paint a mask first — the eraser removes what you painted.'+ : 'Paint a mask first — the edit only changes the painted area.',+ )s.setIsGenerating(false)return}@@ -211,5 +224,86 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {}}, [onQuotaChange])- return { generate, cancel }+ // Video super-resolution on a finished cloud render ("Enhance" in the+ // Lightbox). Re-signs the item's result URL, submits a video:upscale job+ // against the user's own storage clip, polls, and lands the enhanced clip+ // as a new gallery item. Runs through the same isGenerating choreography.+ const enhanceVideo = useCallback(+ async (item: GalleryItem, targetResolution: '720p' | '1080p' | '2k' | '4k' = '1080p') => {+ const s = useCreateStore.getState()+ if (s.isGenerating || !item.jobId) return+ s.setError(null)+ s.setIsGenerating(true)+ s.setProgressPhase('queued')+ s.setProgress(5, 'Fetching the source clip…')+ try {+ // Fresh signed URL — the stored one expires ~1 h after the last read.+ const sourceJob = await getJob(item.jobId)+ if (!sourceJob.result_url) throw new Error('The source clip has expired — re-render it first.')++ s.setProgress(10, 'Submitting to the render queue…')+ const { id } = await submitCloudJob({+ kind: 'video',+ model: item.model || 'wan-2.2-720p',+ prompt: '',+ params: { op: 'upscale', source_url: sourceJob.result_url, target_resolution: targetResolution },+ })+ activeJob.current = id+ abort.current = new AbortController()+ onQuotaChange?.()++ const startedAt = Date.now()+ const job = await pollJob(id, {+ timeoutMs: 45 * 60_000,+ signal: abort.current.signal,+ onTick: (j) => {+ const st = useCreateStore.getState()+ const elapsed = Math.round((Date.now() - startedAt) / 1000)+ if (j.status === 'queued') {+ st.setProgressPhase('queued')+ st.setProgress(15, `Waiting for a cloud GPU… ${elapsed}s`)+ } else if (j.status === 'running') {+ st.setProgressPhase('sampling')+ st.setProgress(Math.min(90, 20 + elapsed), `Enhancing in the cloud… ${elapsed}s`)+ }+ },+ })++ const st = useCreateStore.getState()+ if (job.status === 'succeeded' && job.result_url) {+ st.setProgressPhase('complete')+ st.setProgress(100, 'Complete!')+ st.addToGallery({+ ...item,+ id: job.id,+ createdAt: Date.now(),+ remoteUrl: job.result_url,+ dataUrl: undefined,+ attestation: job.attestation,+ jobId: job.id,+ })+ } else if (job.status !== 'canceled') {+ st.setError(job.error ?? 'Cloud enhance failed.')+ onQuotaChange?.()+ }+ } catch (err) {+ const st = useCreateStore.getState()+ if (err instanceof CloudJobError && err.status === 429) {+ st.setError('Monthly credit budget exhausted — upgrade your plan or wait for the next period.')+ } else if (!(err instanceof CloudJobError && err.message === 'polling aborted')) {+ st.setError(err instanceof Error ? err.message : String(err))+ }+ onQuotaChange?.()+ } finally {+ activeJob.current = null+ abort.current = null+ const st = useCreateStore.getState()+ st.setIsGenerating(false)+ st.setProgress(0)+ }+ },+ [onQuotaChange],+ )++ return { generate, cancel, enhanceVideo }}diff --git a/src/hooks/useVoice.ts b/src/hooks/useVoice.tsindex 359bbaa7..674f4b0f 100644--- a/src/hooks/useVoice.ts+++ b/src/hooks/useVoice.ts@@ -1,10 +1,13 @@import { useCallback, useRef } from "react";import { useVoiceStore } from "../stores/voiceStore";+import { useSettingsStore } from "../stores/settingsStore";+import { useCloudAuthStore, deriveCloudAvailable } from "../stores/cloudAuthStore";import {recheckWhisperAvailable,recheckTtsAvailable,synthesizeNeural,synthesizeExternal,+ synthesizeCloud,playNeuralAudio,stopNeuralAudio,isSpeechSynthesisSupported,@@ -14,6 +17,7 @@ import {getVoicesAsync,createAudioRecorder,transcribeAudio,+ transcribeAudioCloud,type AudioRecorder,} from "../api/voice";import { log } from "../lib/logger";@@ -27,14 +31,20 @@ export function useVoice() {const streamTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);const interimBusyRef = useRef(false);+ // Cloud mode routes voice through the metered lu-labs.ai endpoints — no+ // local Whisper/Piper install needed, both buttons just work.+ const appMode = useSettingsStore((s) => s.settings.appMode);+ const cloudUsable = useCloudAuthStore(deriveCloudAvailable);+ const cloudVoice = appMode === "cloud" && cloudUsable;+// Reactive: the source of truth is the store flag set by the startup probe// (App.tsx) and the in-app install (Settings). Reading a module-level boolean// here was the bug — it never re-rendered when Whisper came up.- const sttSupported = store.sttAvailable;+ const sttSupported = cloudVoice || store.sttAvailable;const ttsSupported = isSpeechSynthesisSupported();// Reactive neural-TTS availability (Piper), same model as sttAvailable.- const ttsAvailable = store.ttsAvailable;+ const ttsAvailable = cloudVoice || store.ttsAvailable;// External HTTP TTS engine configured + selected (#58). Lets the read-aloud// button light up even on a machine without Piper or browser voices.@@ -73,7 +83,10 @@ export function useVoice() {store.setRecording(true);store.setTranscript("");- if (onInterim) {+ // Cloud STT meters a FLAT rate per request — an interim tick every+ // 1.4 s would bill a full transcription each time. Cloud dictation+ // transcribes the final take only.+ if (onInterim && !cloudVoice) {streamTimerRef.current = setInterval(async () => {const rec = recorderRef.current;if (!rec?.isRecording() || interimBusyRef.current) return;@@ -101,7 +114,7 @@ export function useVoice() {recorderRef.current = null;}},- [store],+ [store, cloudVoice],);const stopRecording = useCallback(async (): Promise<string> => {@@ -120,7 +133,7 @@ export function useVoice() {// Final full-take transcription — more accurate than the interim chunks.store.setTranscribing(true);try {- const transcript = await transcribeAudio(blob);+ const transcript = cloudVoice ? await transcribeAudioCloud(blob) : await transcribeAudio(blob);store.setTranscript(transcript);return transcript;} catch (err) {@@ -136,7 +149,7 @@ export function useVoice() {recorderRef.current = null;return "";}- }, [store]);+ }, [store, cloudVoice]);// Speak `text`. Prefers local neural TTS (Piper) when installed; otherwise// falls back to the browser's SpeechSynthesis voices. `streaming` only@@ -146,13 +159,24 @@ export function useVoice() {async (text: string, streaming: boolean) => {if (!store.ttsEnabled) return;// An external HTTP engine (#58) needs a configured URL; Piper needs to be- // installed; the browser path needs SpeechSynthesis. Bail only if none of- // the three can speak.+ // installed; the browser path needs SpeechSynthesis; cloud mode brings+ // its own hosted engine. Bail only if none of them can speak.const externalReady = store.ttsMode === "external" && !!store.externalTtsUrl.trim();- if (!externalReady && !store.ttsAvailable && !ttsSupported) return;+ if (!cloudVoice && !externalReady && !store.ttsAvailable && !ttsSupported) return;store.setSpeaking(true);try {+ // Cloud mode: hosted MiniMax TTS first; a failure (offline, 429)+ // falls through to whatever local engine exists.+ if (cloudVoice) {+ try {+ const url = await synthesizeCloud(text, store.cloudTtsVoice || undefined);+ await playNeuralAudio(url);+ return;+ } catch (err) {+ log.error("Cloud TTS failed, falling back to local engines", { err });+ }+ }// External HTTP TTS engine takes precedence when selected + configured.if (externalReady) {try {@@ -188,7 +212,7 @@ export function useVoice() {store.setSpeaking(false);}},- [store, ttsSupported]+ [store, ttsSupported, cloudVoice]);const speakText = useCallback((text: string) => speakInternal(text, false), [speakInternal]);diff --git a/src/lib/render/__tests__/cloud-jobs.test.ts b/src/lib/render/__tests__/cloud-jobs.test.tsnew file mode 100644index 00000000..785bd543--- /dev/null+++ b/src/lib/render/__tests__/cloud-jobs.test.ts@@ -0,0 +1,20 @@+import { describe, it, expect } from 'vitest'+import { intentToJob } from '../cloud-jobs'+import type { CreateIntent } from '../../../stores/createStore'++describe('intentToJob', () => {+ it('maps every Create intent onto its queue kind + op', () => {+ const cases: Record<CreateIntent, { kind: string; op: string }> = {+ image: { kind: 'image', op: 'generate' },+ edit: { kind: 'image', op: 'edit' },+ removebg: { kind: 'image', op: 'removebg' },+ upscale: { kind: 'image', op: 'upscale' },+ eraser: { kind: 'image', op: 'eraser' },+ video: { kind: 'video', op: 'generate' },+ animate: { kind: 'video', op: 'animate' },+ }+ for (const [intent, expected] of Object.entries(cases)) {+ expect(intentToJob(intent as CreateIntent)).toEqual(expected)+ }+ })+})diff --git a/src/lib/render/cloud-jobs.ts b/src/lib/render/cloud-jobs.tsindex e44f5a92..bd441707 100644--- a/src/lib/render/cloud-jobs.ts+++ b/src/lib/render/cloud-jobs.ts@@ -4,9 +4,8 @@import type { CreateIntent } from '../../stores/createStore'export type RenderKind = 'image' | 'video'-// 'upscale'/'eraser' are WaveSpeed utility endpoints (super-resolution / masked-// object removal). Wired in the backend; the desktop Create UI surfaces them in-// a follow-up port.+// 'upscale'/'eraser' are WaveSpeed utility endpoints (super-resolution /+// masked object removal) — cloud-only intents in the Create UI since 2.5.7.export type RenderOp = 'generate' | 'edit' | 'removebg' | 'animate' | 'upscale' | 'eraser'// One shared compute-credit wallet — text + media draw from the same budget@@ -27,6 +26,10 @@ export function intentToJob(intent: CreateIntent): { kind: RenderKind; op: Rendereturn { kind: 'image', op: 'edit' }case 'removebg':return { kind: 'image', op: 'removebg' }+ case 'upscale':+ return { kind: 'image', op: 'upscale' }+ case 'eraser':+ return { kind: 'image', op: 'eraser' }case 'video':return { kind: 'video', op: 'generate' }case 'animate':diff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex 405a8463..ffbb1535 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -20,7 +20,12 @@ export type CreateBackend = 'local' | 'cloud'* mode / image sub-mode / video sub-mode / removebg. The `mode` + sub-mode* enums stay the load-bearing state; `intent` is a derived view over them.*/-export type CreateIntent = 'image' | 'edit' | 'removebg' | 'video' | 'animate'+export type CreateIntent = 'image' | 'edit' | 'removebg' | 'video' | 'animate' | 'upscale' | 'eraser'++/** Cloud-only single-purpose WaveSpeed endpoints (2.5.7): super-resolution+ * and masked object removal. Local backends have no lane for them, so the+ * IntentBar only offers these while the cloud backend is active. */+export type UtilityOp = 'upscale' | 'eraser'/*** A source or mask image loaded into the Stage input slot. `filename` is the@@ -30,14 +35,17 @@ export type CreateIntent = 'image' | 'edit' | 'removebg' | 'video' | 'animate'*/export interface ImageRef { filename: string; url: string; width: number; height: number }-/** Flatten mode / sub-mode / removebg into the single intent the UI drives. */+/** Flatten mode / sub-mode / removebg / utilityOp into the single intent the+ * UI drives. */export function deriveIntent(s: {removebg: boolean+ utilityOp: UtilityOp | nullmode: 'image' | 'video'imageSubMode: 'text2img' | 'img2img'videoSubMode: 't2v' | 'i2v'}): CreateIntent {if (s.removebg) return 'removebg'+ if (s.utilityOp) return s.utilityOpif (s.mode === 'video') return s.videoSubMode === 'i2v' ? 'animate' : 'video'return s.imageSubMode === 'img2img' ? 'edit' : 'image'}@@ -146,6 +154,10 @@ interface CreateState {// ── redesign additions: flat-intent model + unified inputs + extra params ──videoSubMode: 't2v' | 'i2v'removebg: boolean+ /** Cloud-only utility intents (upscale/eraser); null = normal generate axis. */+ utilityOp: UtilityOp | null+ /** Upscale target for the cloud super-resolution endpoint. */+ targetResolution: '2k' | '4k' | '8k'showNegative: booleanselectedLoras: { name: string; strength: number }[]selectedVae: string@@ -215,6 +227,7 @@ interface CreateState {setSelectedVae: (name: string) => voidsetClipSkip: (n: number) => voidsetGrowMaskBy: (n: number) => void+ setTargetResolution: (r: '2k' | '4k' | '8k') => voidsetSource: (img: ImageRef | null) => voidsetMask: (img: ImageRef | null) => voidsetBackend: (backend: CreateBackend) => void@@ -277,6 +290,8 @@ export const useCreateStore = create<CreateState>()(// ── redesign additions ──videoSubMode: 't2v' as 't2v' | 'i2v',removebg: false,+ utilityOp: null as UtilityOp | null,+ targetResolution: '4k' as '2k' | '4k' | '8k',showNegative: false,selectedLoras: [] as { name: string; strength: number }[],selectedVae: 'auto',@@ -382,11 +397,15 @@ export const useCreateStore = create<CreateState>()(// mirror setMode's reset so image resolution never leaks into video.// A stale error from the previous intent never carries over.const dropAll = { source: null, mask: null, sourceSetAt: 0 }- const base = { removebg: false, error: null }+ const base = { removebg: false, utilityOp: null, error: null }switch (intent) {case 'image': return { ...base, mode: 'image' as const, imageSubMode: 'text2img' as const, ...dropAll }case 'edit': return { ...base, mode: 'image' as const, imageSubMode: 'img2img' as const }- case 'removebg': return { removebg: true, error: null, mode: 'image' as const, imageSubMode: 'img2img' as const, mask: null }+ case 'removebg': return { ...base, removebg: true, mode: 'image' as const, imageSubMode: 'img2img' as const, mask: null }+ // Cloud-only utility endpoints: upscale keeps the source (no mask,+ // no prompt); eraser keeps source + mask (paint what to remove).+ case 'upscale': return { ...base, utilityOp: 'upscale' as const, mode: 'image' as const, imageSubMode: 'img2img' as const, mask: null }+ case 'eraser': return { ...base, utilityOp: 'eraser' as const, mode: 'image' as const, imageSubMode: 'img2img' as const }case 'video': {const d = MODEL_TYPE_DEFAULTS[classifyModel(s.videoModel)] || MODEL_TYPE_DEFAULTS.unknownreturn { ...base, mode: 'video' as const, videoSubMode: 't2v' as const, ...dropAll,@@ -408,9 +427,15 @@ export const useCreateStore = create<CreateState>()(setSelectedVae: (name) => set({ selectedVae: name || 'auto' }),setClipSkip: (n) => set({ clipSkip: Math.max(0, Math.min(12, Math.floor(n))) }),setGrowMaskBy: (n) => set({ growMaskBy: Math.max(0, Math.min(64, Math.floor(n))) }),+ setTargetResolution: (targetResolution) => set({ targetResolution }),setSource: (source) => set({ source, sourceSetAt: source ? Date.now() : 0, ...(source ? {} : { mask: null }) }),setMask: (mask) => set({ mask }),- setBackend: (backend) => set({ backend }),+ // Flipping to local clears a cloud-only utility intent (upscale/eraser+ // have no local lane) so the surface never strands on a dead op.+ setBackend: (backend) =>+ set((s) =>+ backend === 'local' && s.utilityOp ? { backend, utilityOp: null, mask: null, error: null } : { backend },+ ),setCloudImageModel: (cloudImageModel) => set({ cloudImageModel }),setCloudVideoModel: (cloudVideoModel) => set({ cloudVideoModel }),setCaps: (caps) => set({ caps }),diff --git a/src/stores/voiceStore.ts b/src/stores/voiceStore.tsindex 225880ae..aca245ce 100644--- a/src/stores/voiceStore.ts+++ b/src/stores/voiceStore.ts@@ -32,6 +32,8 @@ interface VoiceState {externalTtsUrl: string;/** Voice name passed to the external engine (e.g. "af_bella" / "alloy"). */externalTtsVoice: string;+ /** MiniMax voice for the cloud TTS endpoint (appMode 'cloud'). */+ cloudTtsVoice: string;// ActionssetRecording: (recording: boolean) => void;@@ -51,6 +53,7 @@ interface VoiceState {ttsMode: "piper" | "external";externalTtsUrl: string;externalTtsVoice: string;+ cloudTtsVoice: string;}>) => void;resetTransient: () => void;@@ -86,6 +89,7 @@ export const useVoiceStore = create<VoiceState>()(ttsMode: "piper",externalTtsUrl: "",externalTtsVoice: "",+ cloudTtsVoice: "Wise_Woman",// ActionssetRecording: (recording) => set({ isRecording: recording }),@@ -117,6 +121,7 @@ export const useVoiceStore = create<VoiceState>()(ttsMode: "piper",externalTtsUrl: "",externalTtsVoice: "",+ cloudTtsVoice: "Wise_Woman",}),}),{@@ -134,6 +139,7 @@ export const useVoiceStore = create<VoiceState>()(// stays Piper (hussam-batshon: "after saving it still shows Piper").ttsMode: state.ttsMode,externalTtsUrl: state.externalTtsUrl,+ cloudTtsVoice: state.cloudTtsVoice,externalTtsVoice: state.externalTtsVoice,}),}