From 1bf19fff592d5bbfd8b81a4cdc36da24739a1903 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Thu, 23 Apr 2026 14:37:33 +0300 Subject: [PATCH] fix(app): inline Tauri detection in EditorView IS_TAURI is evaluated at module load time and may be false if __TAURI_INTERNALS__ isn't injected yet. This prevented the automation WebSocket from connecting on Windows and some Linux configurations. --- src/views/EditorView.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/views/EditorView.vue b/src/views/EditorView.vue index 57b0f5569..5a10e2efb 100644 --- a/src/views/EditorView.vue +++ b/src/views/EditorView.vue @@ -11,7 +11,7 @@ import { useMenu } from '@/composables/use-menu' import { useCollab, COLLAB_KEY } from '@/composables/use-collab' import { connectAutomation } from '@/automation/server' import { spawnMCPIfNeeded } from '@/automation/spawn-mcp' -import { IS_TAURI } from '@/constants' +import { IS_BROWSER } from '@open-pencil/core' import { createDemoShapes } from '@/demo' import { useEditorStore } from '@/stores/editor' import { createTab, activeTab, getActiveStore } from '@/stores/tabs' @@ -61,12 +61,13 @@ onMounted(async () => { try { const mcp = await spawnMCPIfNeeded() mcpCleanup.value = mcp?.disconnect ?? null - if (import.meta.env.DEV || IS_TAURI) { + const isTauri = IS_BROWSER && '__TAURI_INTERNALS__' in window + if (import.meta.env.DEV || isTauri) { automationCleanup.value = connectAutomation(getActiveStore, mcp?.authToken ?? null).disconnect } } catch (e) { console.warn('[MCP]', e) - if (IS_TAURI) { + if (IS_BROWSER && '__TAURI_INTERNALS__' in window) { const { toast } = await import('@/utils/toast') toast.warning('MCP server failed to start. Install with: npm i -g @open-pencil/mcp') }