From 3bd6f144f2dddbf55334871acd1f7a83852faa32 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 26 May 2026 14:09:07 -0300 Subject: [PATCH] feat(desktop): allow slim pro overlay when VITE_PRO_BUILD + VITE_DESKTOP both set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v0.3.x main.tsx explicitly REFUSED to load @pro when VITE_DESKTOP was true ("desktop owns its own license + auth UI"). v0.4.0 brings the AI agent into the desktop bundle, so the refusal needs to relax for that one use case. New routing inside the if(VITE_PRO_BUILD) branch: - VITE_DESKTOP also set → load @pro/desktop_index (slim entry that only mounts AgentChatPanel + DiagnoseCompileButton, no analytics / sessions / billing / admin / save overrides - those expect velxio.dev cookies the desktop has no way to send) - VITE_DESKTOP not set → load @pro/index (existing web behavior) VITE_DESKTOP alone (no pro) still loads zero overlay - that's the pure-OSS desktop build path for self-hosters who don't have the pro source tree at $PRO_OVERLAY_PATH. Companion commit in velxio-prod creates @pro/desktop_index, adapts the agent client for license-key Bearer auth, and updates build-frontend.sh to pass both flags. Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/src/main.tsx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 743e82ce..cd0ee633 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -47,15 +47,23 @@ requestAnimationFrame(() => { // VITE_PRO_BUILD=true at build time. The dynamic import keeps the pro chunk // out of the OSS bundle entirely (Vite tree-shakes the never-taken branch). // -// VITE_DESKTOP=true is set by the Tauri desktop build. The desktop shell -// owns its own license + auth UI (Phase 3 of paid-clients) and runs against -// a locally spawned sidecar, so the velxio.dev-coupled overlay (trackers, -// billing, cloud auth, admin) is intentionally NOT loaded — even if a -// build accidentally sets both flags. -if (import.meta.env.VITE_PRO_BUILD && !import.meta.env.VITE_DESKTOP) { - import('@pro/index') - .then((m) => m.mountPro?.()) - .catch((err) => console.warn('[pro] failed to load overlay:', err)); +// Two desktop modes since v0.4.0: +// - VITE_PRO_BUILD + VITE_DESKTOP → slim pro entry (@pro/desktop_index) +// that ONLY mounts the AI agent + DiagnoseCompileButton, no analytics +// / sessions / billing / admin / save overrides (those talk to +// velxio.dev with cookies the desktop doesn't have). +// - VITE_PRO_BUILD only (web) → full mountPro with every surface. +// VITE_DESKTOP alone (no pro) stays a pure-OSS desktop build. +if (import.meta.env.VITE_PRO_BUILD) { + if (import.meta.env.VITE_DESKTOP) { + import('@pro/desktop_index') + .then((m) => m.mountProDesktop?.()) + .catch((err) => console.warn('[pro-desktop] failed to load slim overlay:', err)); + } else { + import('@pro/index') + .then((m) => m.mountPro?.()) + .catch((err) => console.warn('[pro] failed to load overlay:', err)); + } } // Desktop-only hooks (ESP32 QEMU prompt now, welcome screen in Phase 3).