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(chat): on a Mac the workflow tools say Create runs on MLX (C60-S5)
purplea1b2085b02c3
diff --git a/src/api/mcp/__tests__/workflow-tools.test.ts b/src/api/mcp/__tests__/workflow-tools.test.tsindex 6313330e..6b1d47fb 100644--- a/src/api/mcp/__tests__/workflow-tools.test.ts+++ b/src/api/mcp/__tests__/workflow-tools.test.ts@@ -15,6 +15,7 @@ const h = vi.hoisted(() => ({checkpoints: vi.fn(),check: vi.fn(),readWorkflowText: vi.fn(),+ comfy: true,}))vi.mock('../../backend', async (orig) => ({ ...(await orig<typeof import('../../backend')>()), backendCall: h.backendCall }))@@ -22,6 +23,7 @@ vi.mock('../../discover', () => ({ startModelDownload: h.startModelDownload }))vi.mock('../../comfy-restart', () => ({ restartComfyForNewNodes: h.restart }))vi.mock('../../comfyui', async (orig) => ({ ...(await orig<typeof import('../../comfyui')>()), getCheckpoints: h.checkpoints, getDiffusionModels: async () => [] }))vi.mock('../../workflow-import', async (orig) => ({ ...(await orig<typeof import('../../workflow-import')>()), readWorkflowText: h.readWorkflowText }))+vi.mock('../../../lib/capabilities', async (orig) => ({ ...(await orig<typeof import('../../../lib/capabilities')>()), hasComfy: () => h.comfy }))vi.mock('../../workflow-find', async (orig) => {const real = await orig<typeof import('../../workflow-find')>()return { ...real, checkCandidate: h.check }@@ -333,3 +335,21 @@ describe('errors in words', () => {expect(await executeWorkflowInspect({ id: candidateId() })).toMatch(/Could not read workflow url\d+: HTTP 401/)})})++describe('a Mac has no ComfyUI to run a workflow on', () => {+ it('every workflow tool says so and changes nothing', async () => {+ h.comfy = false+ try {+ userSays('install it')+ for (const r of [+ await executeWorkflowFind({ query: 'sd' }, run()),+ await executeWorkflowInspect({ id: 'x' }),+ await executeWorkflowInstall({ id: 'x' }, run()),+ await executeWorkflowAssign({ workflow: 'a', model: 'b' }, run()),+ ]) expect(r).toMatch(/^ComfyUI workflows are not used on this computer/)+ expect(queue()).toHaveLength(0)+ } finally {+ h.comfy = true+ }+ })+})diff --git a/src/api/mcp/workflow-tools.ts b/src/api/mcp/workflow-tools.tsindex 6b9b525d..35046674 100644--- a/src/api/mcp/workflow-tools.ts+++ b/src/api/mcp/workflow-tools.ts@@ -39,6 +39,7 @@ import { useModelStore } from '../../stores/modelStore'import { useSettingsAuditStore } from '../../stores/settingsAuditStore'import { checkSelfControl, noteCard } from '../../lib/self-control-policy'import { taintLabel } from '../../lib/run-taint'+import { hasComfy } from '../../lib/capabilities'import { useWorkflowStore } from '../../stores/workflowStore'import { useWorkflowCardStore } from '../../stores/workflowInstallConfirmStore'import type { WorkflowTemplate } from '../../types/workflows'@@ -77,6 +78,9 @@ function errText(e: unknown, max: number): string {return (t || 'unknown error').replace(/\s+/g, ' ').slice(0, max)}+/** A Mac renders with MLX and never with ComfyUI (lib/capabilities.ts). */+const NO_COMFY = 'ComfyUI workflows are not used on this computer: on a Mac, Create renders with MLX, not ComfyUI. Nothing changed.'+const NOT_HERE = 'Error: workflows can only be installed in a chat where the user sees the confirmation card. Nothing changed.'// ── workflow_find ───────────────────────────────────────────────────────────@@ -93,6 +97,7 @@ function hitLine(c: Candidate): string {}export async function executeWorkflowFind(args: ToolArgs, run?: AgentRunContext): Promise<string> {+ if (!hasComfy()) return NO_COMFYconst query = typeof args?.query === 'string' ? args.query.trim().slice(0, 120) : ''const url = typeof args?.url === 'string' ? args.url.trim() : ''const source = typeof args?.source === 'string' ? args.source : 'all'@@ -141,6 +146,7 @@ export async function executeWorkflowFind(args: ToolArgs, run?: AgentRunContext)export async function executeWorkflowInspect(args: ToolArgs): Promise<string> {const id = typeof args?.id === 'string' ? args.id.trim() : ''if (!id) return 'Error: id is missing. Use an id from workflow_find.'+ if (!hasComfy()) return NO_COMFYconst c = candidateById(id)if (!c) return `Error: there is no workflow "${cleanName(id, 40)}" from this session. Call workflow_find first.`try {@@ -202,6 +208,7 @@ async function apiGraphOf(checked: Checked): Promise<{ ok: true; graph: Workflowexport async function executeWorkflowInstall(args: ToolArgs, run?: AgentRunContext, signal?: AbortSignal): Promise<string> {const id = typeof args?.id === 'string' ? args.id.trim() : ''if (!id) return 'Error: id is missing. Use an id from workflow_find, checked with workflow_inspect. Nothing changed.'+ if (!hasComfy()) return NO_COMFYif (!run?.settingsCard) return NOT_HEREconst c = candidateById(id)if (!c) return `Error: there is no workflow "${cleanName(id, 40)}" from this session. Call workflow_find first.`@@ -350,6 +357,7 @@ export async function executeWorkflowAssign(args: ToolArgs, run?: AgentRunContexconst rawModel = typeof args?.model === 'string' ? args.model.trim() : ''if (!want) return 'Error: workflow is missing (name or id of an installed workflow). Nothing changed.'if (!rawModel) return 'Error: model is missing (a model file name as ComfyUI lists it). Nothing changed.'+ if (!hasComfy()) return NO_COMFYif (!run?.settingsCard) return NOT_HEREconst verdict = checkSelfControl(run, { names: assignNames, strong: false, what: 'which workflow a model uses' })if (!verdict.ok) { audit(run, want, 'refused', verdict.why); return verdict.reply }