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(mlx): the plain dev server says MLX needs the desktop app
purple889ac1c562b2
diff --git a/src/api/__tests__/mlx-says-dev-mode-instead-of-unknown-command.test.ts b/src/api/__tests__/mlx-says-dev-mode-instead-of-unknown-command.test.tsnew file mode 100644index 00000000..7edda804--- /dev/null+++ b/src/api/__tests__/mlx-says-dev-mode-instead-of-unknown-command.test.ts@@ -0,0 +1,38 @@+/**+ * GH #135 (eloieloie, 2026-09-15): "Install engine" under `npm run dev`+ * answered "Unknown backend command: install_mlx_diffusion".+ *+ * Run: npx vitest run src/api/__tests__/mlx-says-dev-mode-instead-of-unknown-command.test.ts+ */+import { describe, it, expect, vi, beforeEach } from 'vitest'++let tauri = false+const backendCall = vi.fn(async (cmd: string) => { throw new Error(`Unknown backend command: ${cmd}`) })+vi.mock('../backend', () => ({+ backendCall: (cmd: string) => backendCall(cmd),+ isTauri: () => tauri,+ isMacOS: () => true,+}))++import { MLX_DEV_MODE_ERROR } from '../mlx-invoke'+import { installMlxImageEngine } from '../mlx-image'+import { installMlxVideo } from '../mlx-video'++beforeEach(() => { backendCall.mockClear(); tauri = false })++describe('MLX outside the desktop app', () => {+ it('the image engine install says which dev command to use', async () => {+ await expect(installMlxImageEngine()).rejects.toThrow(MLX_DEV_MODE_ERROR)+ expect(backendCall).not.toHaveBeenCalled()+ })++ it('the video engine install says the same', async () => {+ await expect(installMlxVideo()).rejects.toThrow(MLX_DEV_MODE_ERROR)+ })++ it('inside the desktop app the command goes to Rust as before', async () => {+ tauri = true+ await expect(installMlxImageEngine()).rejects.toThrow(/Unknown backend command/)+ expect(backendCall).toHaveBeenCalledWith('install_mlx_diffusion')+ })+})diff --git a/src/api/mlx-image.ts b/src/api/mlx-image.tsindex 0ef5c9bf..c791fcda 100644--- a/src/api/mlx-image.ts+++ b/src/api/mlx-image.ts@@ -3,30 +3,17 @@* the app spawns its own MLX Python sidecar (server.py on 127.0.0.1:47712)* directly from Rust (`commands::mlx`), no separate lu-bridge daemon. Ported* from uselu/apps/web/api/mlx-image.ts; the transport is a direct Tauri- * `invoke` via `invokeMedia` (see below) plus a readiness wait: the FastAPI+ * `invoke` via `invokeMedia` (api/mlx-invoke) plus a readiness wait: the FastAPI* sidecar binds a beat after `mlx_start` returns, so a cold first generate* can race and 500 with "mlx unreachable".** Hard rule: this is the Mac local image backend, NOT ComfyUI.*/-import { backendCall, isMacOS } from './backend'+import { isMacOS } from './backend'+import { invokeMedia } from './mlx-invoke'import { siGbToBytes } from '../lib/formatters'import type { ClassifiedModel } from './comfyui'-/**- * Invoke an in-process MLX media Tauri command. The Rust wrappers- * (`src-tauri/src/commands/media_cmds.rs`) each take a single- * `args: serde_json::Value` parameter — matching the existing `shell_task_*`- * convention in this codebase (see `src/api/agents/bg-tasks.ts`) — so the- * payload must be nested under an `args` key, not passed at the top level.- */-async function invokeMedia<T = unknown>(- command: string,- args?: Record<string, unknown>,-): Promise<T> {- return backendCall<T>(command, { args: args ?? {} })-}-export interface MlxStatus {installed: booleanrunning: booleandiff --git a/src/api/mlx-invoke.ts b/src/api/mlx-invoke.tsnew file mode 100644index 00000000..d37bcaf0--- /dev/null+++ b/src/api/mlx-invoke.ts@@ -0,0 +1,27 @@+import { backendCall, isTauri } from './backend'++/**+ * GH #135 (eloieloie, 2026-09-15): "Install engine" under Models, Image ran+ * in the plain Vite dev server and answered "Unknown backend command:+ * install_mlx_diffusion", which reads like a broken build. MLX image and+ * video run in a Python sidecar the Rust side spawns, and `npm run dev` has+ * no Rust side. Remote Access says the same thing the same way+ * (stores/remoteStore REMOTE_DEV_MODE_ERROR).+ */+export const MLX_DEV_MODE_ERROR =+ "Local image and video generation on a Mac needs the installed desktop app. The plain `npm run dev` server has no Rust process to run the MLX engine in. Use `npm run tauri:dev` instead."++/**+ * Invoke an in-process MLX media Tauri command. The Rust wrappers+ * (`src-tauri/src/commands/media_cmds.rs`) each take a single+ * `args: serde_json::Value` parameter, matching the `shell_task_*`+ * convention (see `src/api/agents/bg-tasks.ts`), so the payload is nested+ * under an `args` key, not passed at the top level.+ */+export async function invokeMedia<T = unknown>(+ command: string,+ args?: Record<string, unknown>,+): Promise<T> {+ if (!isTauri()) throw new Error(MLX_DEV_MODE_ERROR)+ return backendCall<T>(command, { args: args ?? {} })+}diff --git a/src/api/mlx-video.ts b/src/api/mlx-video.tsindex aa9521e8..0d52aaad 100644--- a/src/api/mlx-video.ts+++ b/src/api/mlx-video.ts@@ -3,7 +3,7 @@* (`commands::video`) spawns `python -m mlx_video.<family>.generate` as a* subprocess directly, no separate lu-bridge daemon. Ported from* uselu/apps/web/api/video.ts; the transport is a direct Tauri `invoke` via- * `invokeMedia` (see mlx-image.ts) and progress is exposed for the frontend+ * `invokeMedia` (api/mlx-invoke) and progress is exposed for the frontend* to poll.** Hard rule: this is the Mac local video backend, NOT ComfyUI. Only Apple@@ -11,19 +11,10 @@* elsewhere so the UI can dim/skip it.*/import { backendCall } from './backend'+import { invokeMedia } from './mlx-invoke'import type { ClassifiedModel, ModelType } from './comfyui'import { siGbToBytes } from '../lib/formatters'-/** 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- * nested under an `args` key. */-async function invokeMedia<T = unknown>(- command: string,- args?: Record<string, unknown>,-): Promise<T> {- return backendCall<T>(command, { args: args ?? {} })-}-export interface VideoStatus {available: booleanappleSilicon: boolean