From 35635c0082f3b2dc2fa8d7828231a653015ff2cf Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Wed, 9 Sep 2026 18:49:15 +0300 Subject: [PATCH] fix(desktop): load Mini Chat from the resolved HMR UI Mini Chat used the API origin in HMR mode and could load the server auth page instead of the local application. Retain the resolved local UI URL and use it for Mini Chat windows. Verified native menu zoom in main and Mini Chat windows in isolated HMR and bundled Electron profiles; Electron syntax checks passed. --- packages/electron/README.md | 4 ++++ packages/electron/main.mjs | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/electron/README.md b/packages/electron/README.md index 3c53f510..c4bcb7bd 100644 --- a/packages/electron/README.md +++ b/packages/electron/README.md @@ -170,6 +170,10 @@ Use an explicit override when testing a different OpenCode CLI build or when a u ## Native Features Owned Here - Floating Mini Chat windows. +- Mini Chat loads from the resolved local UI origin in HMR development, not the + API server origin. Bundled mode keeps `openchamber-ui://` assets. Native zoom + targets the focused window directly; composer focus adjusts interface scale, + while terminal and file-editor focus adjust their own font sizes. - New Mini Chat windows default to the managed Chats target. Explicit project/worktree drafts retain their target, existing managed chat sessions reopen in their own directory, and the compact header omits project/branch metadata for Chats. Opening a managed draft back in the main window preserves that target. - Multiple native windows. - Native notifications. diff --git a/packages/electron/main.mjs b/packages/electron/main.mjs index acc378d0..f65e2d90 100644 --- a/packages/electron/main.mjs +++ b/packages/electron/main.mjs @@ -258,6 +258,7 @@ const { autoUpdater } = updaterPkg; const state = { serverHandle: null, sidecarUrl: null, + localUiUrl: null, localOrigin: null, apiBaseUrl: null, clientToken: null, @@ -2755,7 +2756,7 @@ const createAdditionalWindow = async (url, runtimeConfig = {}) => { const buildMiniChatUrl = ({ mode, sessionId, directory, projectId }) => { const base = shouldUsePackagedUi() ? buildPackagedUiUrl('/mini-chat.html') - : state.localOrigin || state.sidecarUrl; + : state.localUiUrl || state.localOrigin || state.sidecarUrl; if (!base) { throw new Error('Local UI is not available'); } @@ -2970,6 +2971,7 @@ const resolveInitialUrl = async () => { : localUrl; state.sidecarUrl = localUrl; + state.localUiUrl = localUiUrl; const localAvailable = Boolean(localUrl); const localOrigin = localUrl ? new URL(localUrl).origin : null;