Skip to content

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.

feat(mac): ComfyUI never auto-starts on macOS + wire MLX video into Create

purple88ce0302858f
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index 14020a23..2dbe1137 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -1554,6 +1554,15 @@ pub fn auto_start_ollama(state: &AppState) {
/// Auto-start ComfyUI on app launch (called from setup)
pub fn auto_start_comfyui(state: &AppState) {
+ // Hard rule: macOS local media is MLX only, NEVER ComfyUI (see
+ // commands::mlx / commands::video). Auto-starting ComfyUI on Mac violated
+ // that rule (2026-07-23 log: "[ComfyUI] Already running on port 8188").
+ // ComfyUI itself stays fully intact for Windows/Linux and for a user who
+ // manually invokes `start_comfyui` — only the unattended boot path skips it.
+ if cfg!(target_os = "macos") {
+ println!("[ComfyUI] Auto-start skipped on macOS — local media is MLX-only");
+ return;
+ }
// If user configured a remote host, don't try to auto-start anything locally.
{
let host = state.comfy_host.lock().unwrap().clone();
diff --git a/src/api/mlx-video.ts b/src/api/mlx-video.ts
index 8fb605d6..15cbba97 100644
--- a/src/api/mlx-video.ts
+++ b/src/api/mlx-video.ts
@@ -11,6 +11,7 @@
* elsewhere so the UI can dim/skip it.
*/
import { backendCall } from './backend'
+import type { ClassifiedModel, ModelType } from './comfyui'
/** See the `invokeMedia` doc comment in `mlx-image.ts` — the Rust wrappers
* take a single `args: serde_json::Value` param, so the payload must be
@@ -130,3 +131,38 @@ export async function getVideoProgress(): Promise<VideoProgress> {
export async function cancelVideo(): Promise<{ ok: boolean }> {
return invokeMedia<{ ok: boolean }>('video_cancel')
}
+
+// ── Create-tab wiring (mirrors mlx-image.ts's synthetic-model pattern) ──
+//
+// On macOS the video picker shows the installed MLX catalog directly — there
+// is no ComfyUI video backend to merge with (hard rule: Mac video is MLX
+// only). A "MLX " prefix keeps these display names visually distinct and
+// guarantees a fresh persisted `videoModel` never collides with a stale
+// ComfyUI checkpoint name from a pre-MLX session.
+
+export const MLX_VIDEO_MODEL_PREFIX = 'MLX '
+
+export function mlxVideoDisplayName(m: Pick<VideoModel, 'name'>): string {
+ return `${MLX_VIDEO_MODEL_PREFIX}${m.name}`
+}
+
+const mlxVideoIdByDisplayName = new Map<string, string>()
+
+/** Resolve a video dropdown selection back to the bridge catalog id. */
+export function mlxVideoModelIdFor(displayName: string | null | undefined): string | null {
+ return (displayName && mlxVideoIdByDisplayName.get(displayName)) || null
+}
+
+function mlxVideoModelType(family: string): ModelType {
+ return family === 'ltx_2' ? 'ltx' : 'wan'
+}
+
+/** Build the Create-tab video model list from the installed MLX catalog. */
+export function buildMlxVideoModels(catalog: VideoModel[]): ClassifiedModel[] {
+ return catalog
+ .filter((m) => m.installed)
+ .map((m) => {
+ mlxVideoIdByDisplayName.set(mlxVideoDisplayName(m), m.id)
+ return { name: mlxVideoDisplayName(m), type: mlxVideoModelType(m.family), source: 'checkpoint' } satisfies ClassifiedModel
+ })
+}
diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsx
index 78a34cda..08410383 100644
--- a/src/components/create/experimental/CreateContext.tsx
+++ b/src/components/create/experimental/CreateContext.tsx
@@ -6,7 +6,7 @@ import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
import { getLoraModels, getVAEModels } from '../../../api/comfyui'
import { getAllNodeInfo, clearNodeCache } from '../../../api/comfyui-nodes'
import { installCustomNodes } from '../../../api/discover'
-import { backendCall } from '../../../api/backend'
+import { backendCall, isMacOS } from '../../../api/backend'
import { ensureLocalFilename } from './loadImage'
import type { CloudQuota } from '../../../lib/render/cloud-jobs'
@@ -90,9 +90,13 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
}
}, [backend, connected])
- // Bootstrap the backend exactly like the old CreateView mount did.
+ // Bootstrap the backend exactly like the old CreateView mount did. On
+ // macOS skip the ComfyUI probe entirely — hard rule: Mac local media is
+ // MLX-only and ComfyUI never auto-starts there (process.rs::auto_start_
+ // comfyui). fetchModels() still runs unconditionally: it's what loads the
+ // MLX image/video catalogs on Mac.
useEffect(() => {
- checkConnection()
+ if (!isMacOS()) checkConnection()
fetchModels()
}, [checkConnection, fetchModels])
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 55623949..67868267 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -38,6 +38,10 @@ import {
generateMlxImageDataUrl, isMlxImageHost, isMlxImageModel,
mlxStatus, listMlxImageModels, buildMlxImageModels, mergeImageModels, mlxModelIdFor,
} from '../api/mlx-image'
+import {
+ getVideoStatus, listVideoModels, generateVideo, getVideoProgress, cancelVideo,
+ buildMlxVideoModels, mlxVideoModelIdFor,
+} from '../api/mlx-video'
export function useCreate() {
const [connected, setConnected] = useState<boolean | null>(null)
@@ -97,27 +101,45 @@ export function useCreate() {
// MLX catalog first (this also spins up the bundled bridge sidecar) so
// images work even when ComfyUI is absent — the normal Mac case.
let mlxImageModels: ClassifiedModel[] = []
+ // Video has no ComfyUI counterpart on Mac (hard rule: Mac video is
+ // MLX-only, ComfyUI never even auto-starts there — see
+ // process.rs::auto_start_comfyui). The video list IS the MLX catalog.
+ let mlxVideoModels: ClassifiedModel[] = []
if (isMlxImageHost()) {
try {
const mlx = await mlxStatus()
if (mlx.installed) mlxImageModels = buildMlxImageModels(await listMlxImageModels())
} catch { /* bridge/sidecar not up yet — treat as no MLX models */ }
+ try {
+ mlxVideoModels = buildMlxVideoModels(await listVideoModels())
+ } catch { /* mlx-video status unavailable yet — treat as no MLX video models */ }
}
// Check connection — if ComfyUI is down, don't waste time on its queries.
const comfyOk = await checkComfyConnection()
if (!comfyOk) {
- // On Apple Silicon MLX alone is a valid image backend — don't bail.
- if (mlxImageModels.length > 0) {
- setImageModels(mlxImageModels)
+ // On Apple Silicon MLX alone is a valid image/video backend — don't bail.
+ if (mlxImageModels.length > 0 || mlxVideoModels.length > 0) {
const st = useCreateStore.getState()
+ setImageModels(mlxImageModels)
st.setImageModelList(mlxImageModels)
- if (!st.imageModel) st.setImageModel(mlxImageModels[0].name, mlxImageModels[0].type)
+ if (mlxImageModels.length > 0 && !st.imageModel) {
+ st.setImageModel(mlxImageModels[0].name, mlxImageModels[0].type)
+ }
+ setVideoModelsList(mlxVideoModels)
+ st.setVideoModelList(mlxVideoModels)
+ if (mlxVideoModels.length > 0 && !mlxVideoModels.find(m => m.name === st.videoModel)) {
+ st.setVideoModel(mlxVideoModels[0].name)
+ }
zeroModelRetries.current = 0
setModelsLoaded(true)
return
}
- setModelLoadError('ComfyUI is not running. Start it from Settings or wait for auto-start.')
+ setModelLoadError(
+ isMlxImageHost()
+ ? 'No MLX models installed yet. Install one from the Model Manager (Mac Image / Mac Video).'
+ : 'ComfyUI is not running. Start it from Settings or wait for auto-start.'
+ )
return
}
@@ -126,7 +148,7 @@ export function useCreate() {
// and its internal cache hasn't updated yet.
await refreshComfyModels()
- const [comfyImgModels, vidModels, samplers, schedulers, vBackend, _nodeInfo] = await Promise.all([
+ const [comfyImgModels, comfyVidModels, samplers, schedulers, vBackend, _nodeInfo] = await Promise.all([
getImageModels(),
getVideoModels(),
getSamplers(),
@@ -138,6 +160,10 @@ export function useCreate() {
const imgModels = mlxImageModels.length
? mergeImageModels(comfyImgModels, mlxImageModels)
: comfyImgModels
+ // Mac video is MLX-only — never surface ComfyUI video checkpoints there,
+ // even in the rare case ComfyUI happens to be reachable (e.g. a manual
+ // install the user started outside LU).
+ const vidModels = isMlxImageHost() ? mlxVideoModels : comfyVidModels
setImageModels(imgModels)
setVideoModelsList(vidModels)
setSamplerList(samplers)
@@ -258,6 +284,12 @@ export function useCreate() {
if (!modelLoadError) return // No error — nothing to retry
if (modelsLoaded) return // modelsLoaded + error = gave up after max retries, don't loop
const retryInterval = setInterval(async () => {
+ // No ComfyUI to poll for on Mac (hard rule: MLX-only) — retry the MLX
+ // catalog directly instead of waiting on a connection that never comes.
+ if (isMlxImageHost()) {
+ fetchModels()
+ return
+ }
const ok = await checkComfyConnection()
if (ok) {
console.log('[useCreate] Retrying model fetch...')
@@ -337,6 +369,102 @@ export function useCreate() {
return
}
+ // ── MLX video pipeline (Apple Silicon) — hard rule: Mac local video is
+ // MLX-via-mlx-video, never ComfyUI. Unlike the image branch this doesn't
+ // need to check the selected model against a synthetic-name marker: on
+ // Mac the video picker IS the MLX catalog (Task 1 — ComfyUI never even
+ // auto-starts there, see process.rs::auto_start_comfyui), so every video
+ // generation routes here. Generation is a subprocess polled via
+ // video_progress every 2s (no WebSocket/node-graph like ComfyUI). ──
+ if (mode === 'video' && isMlxImageHost()) {
+ setError(null)
+ if (!prompt.trim()) { setError('Please enter a prompt.'); return }
+ if (!videoModel) { setError('No MLX video model selected. Install one from the Model Manager.'); return }
+ const catalogId = mlxVideoModelIdFor(videoModel)
+ if (!catalogId) { setError(`Unknown MLX video model "${videoModel}" — re-select it from the picker.`); return }
+ try {
+ const status = await getVideoStatus()
+ if (!status.available) { setError('MLX video is Apple Silicon only.'); return }
+ if (!status.mlxInstalled) { setError('mlx-video is not installed. Open the Model Manager → Mac Video to install it.'); return }
+ if (!status.installedModels.includes(catalogId)) { setError(`Model "${videoModel}" is not installed yet. Install it from the Model Manager.`); return }
+ } catch (e) {
+ setError(`MLX video status check failed: ${e instanceof Error ? e.message : String(e)}`)
+ return
+ }
+
+ setIsGenerating(true)
+ state.setProgressPhase('loading-model')
+ setProgress(0, 'Starting MLX video generation...')
+ addToPromptHistory(prompt)
+ const startTime = Date.now()
+ abortRef.current = new AbortController()
+ let result: Awaited<ReturnType<typeof generateVideo>>
+ try {
+ result = await generateVideo({
+ id: catalogId,
+ prompt,
+ seconds: Math.max(0.5, frames / Math.max(1, fps)),
+ fps,
+ seed: seed === -1 ? undefined : seed,
+ initImage: effI2vImage ?? undefined,
+ })
+ } catch (e) {
+ useCreateStore.getState().setError(`Failed to start: ${e instanceof Error ? e.message : String(e)}`)
+ useCreateStore.getState().setIsGenerating(false)
+ abortRef.current = null
+ return
+ }
+ try {
+ state.setProgressPhase('sampling')
+ await new Promise<void>((resolve, reject) => {
+ const tick = async () => {
+ if (abortRef.current?.signal.aborted) {
+ try { await cancelVideo() } catch { /* already finished/gone */ }
+ reject(new Error('Cancelled'))
+ return
+ }
+ try {
+ const prog = await getVideoProgress()
+ const elapsed = Math.round((Date.now() - startTime) / 1000)
+ setProgress(Math.min(95, elapsed * 2), `Generating with MLX... ${elapsed}s`)
+ if (prog.status === 'complete') {
+ setProgress(100, 'Complete!')
+ useCreateStore.getState().setLastGenTime(`${elapsed}s`)
+ addToGallery({
+ id: uuid(), type: 'video', filename: '', subfolder: '',
+ // No in-process route serves MLX video output yet (unlike the
+ // image sidecar's :47712) — see GalleryItem.localPath's TODO.
+ localPath: result.output,
+ prompt, negativePrompt, model: videoModel, modelType: 'wan',
+ seed: seed === -1 ? 0 : seed, steps, cfgScale, sampler, scheduler,
+ width, height, batchSize: 1,
+ createdAt: Date.now(), builderUsed: 'dynamic', intent,
+ })
+ resolve()
+ return
+ }
+ if (prog.status === 'error') {
+ reject(new Error(prog.error || 'mlx-video failed'))
+ return
+ }
+ setTimeout(tick, 2000)
+ } catch (e) {
+ reject(e instanceof Error ? e : new Error(String(e)))
+ }
+ }
+ tick()
+ })
+ } catch (e) {
+ const msg = e instanceof Error ? e.message : String(e)
+ if (msg !== 'Cancelled') useCreateStore.getState().setError(`Generation failed: ${msg}`)
+ } finally {
+ useCreateStore.getState().setIsGenerating(false)
+ useCreateStore.getState().setProgress(0)
+ abortRef.current = null
+ }
+ return
+ }
+
setError(null)
const activeModel = mode === 'image' ? imageModel : videoModel
// Always re-classify from model name to avoid stale type
diff --git a/src/hooks/useModels.ts b/src/hooks/useModels.ts
index a31058f6..e7d4a421 100644
--- a/src/hooks/useModels.ts
+++ b/src/hooks/useModels.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo } from 'react'
import { listModels, pullModel as pullModelApi, pullModelTauri, deleteModel as deleteModelApi } from '../api/ollama'
-import { isTauri } from '../api/backend'
+import { isTauri, isMacOS } from '../api/backend'
import { getCheckpoints as getComfyCheckpoints, getDiffusionModels as getComfyDiffusionModels, checkComfyConnection, filterPartialFiles } from '../api/comfyui'
import { parseNDJSONStream } from '../api/stream'
import { useModelStore } from '../stores/modelStore'
@@ -178,8 +178,11 @@ export function useModels() {
.map(m => ({ ...m, provider: 'ollama' as const, providerName: 'Ollama' })))
} catch { /* Ollama might not be running */ }
}
+ // Hard rule: Mac local media is MLX-only — ComfyUI never auto-starts
+ // there (process.rs::auto_start_comfyui), so skip the probe outright
+ // instead of a doomed connection check on every model-list refresh.
let comfyModels: AIModel[] = []
- const comfyOk = await checkComfyConnection()
+ const comfyOk = !isMacOS() && (await checkComfyConnection())
if (comfyOk) {
try {
const [checkpoints, diffusionModels] = await Promise.all([getComfyCheckpoints(), getComfyDiffusionModels()])
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index dba6791b..ed3b54de 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -124,6 +124,14 @@ export interface GalleryItem {
jobId?: string
/** Which redesign intent produced this item (gallery tagging). */
intent?: CreateIntent
+ /** MLX video (Mac, Apple Silicon): absolute filesystem path of the finished
+ * mp4, as returned by `video_generate`'s `output` field. TODO(mlx-video-
+ * playback): there is no in-process HTTP route or asset-protocol scope
+ * serving this yet (unlike the MLX image sidecar on :47712), and the CSP
+ * `media-src` doesn't allow `file:` — so `<video>` can't play it inline
+ * today. Wire a served route or Tauri asset scope, then point display/
+ * download at that URL instead of leaving this as a dead-end path. */
+ localPath?: string
/** Runtime-only (stripped by partialize): the item's media failed to load
* and can't be recovered right now — a local ComfyUI item while the engine
* is unreachable. Tiles render an honest offline state and Download