diff --git a/packages/extension/src/entrypoints/content.ts b/packages/extension/src/entrypoints/content.ts index 8082ed1..06314cb 100644 --- a/packages/extension/src/entrypoints/content.ts +++ b/packages/extension/src/entrypoints/content.ts @@ -92,10 +92,17 @@ async function queryShouldShowMask(getController: () => PageController): Promise tabId, } + console.debug(`${DEBUG_PREFIX} shouldShowMask query:`, { + tabId, + url: window.location.href, + queryId, + }) + try { // Set up response listener const responsePromise = new Promise((resolve) => { const timeout = setTimeout(() => { + console.debug(`${DEBUG_PREFIX} shouldShowMask query timeout (3s)`) chrome.runtime.onMessage.removeListener(listener) resolve(false) }, 3000) @@ -118,11 +125,16 @@ async function queryShouldShowMask(getController: () => PageController): Promise // Wait for response const shouldShowMask = await responsePromise - console.debug(`${DEBUG_PREFIX} shouldShowMask result:`, shouldShowMask) + + console.debug(`${DEBUG_PREFIX} shouldShowMask response:`, { + tabId, + shouldShowMask, + action: shouldShowMask ? 'showMask' : 'noAction', + }) if (shouldShowMask) { - console.debug(`${DEBUG_PREFIX} Restoring mask after page reload`) await getController().showMask() + console.debug(`${DEBUG_PREFIX} Mask shown after page load`) } } catch (error) { console.debug(`${DEBUG_PREFIX} shouldShowMask query failed:`, error) diff --git a/packages/extension/src/entrypoints/sidepanel/AgentController.ts b/packages/extension/src/entrypoints/sidepanel/AgentController.ts index 05cbe4e..97b5c62 100644 --- a/packages/extension/src/entrypoints/sidepanel/AgentController.ts +++ b/packages/extension/src/entrypoints/sidepanel/AgentController.ts @@ -212,12 +212,24 @@ export class AgentController extends EventTarget { */ shouldShowMaskForTab(tabId: number): boolean { const agentCurrentTabId = this.tabsManager?.getCurrentTabId() - return ( - this.status === 'running' && - this.windowHasFocus && - this.browserActiveTabId === tabId && - agentCurrentTabId === tabId - ) + const isRunning = this.status === 'running' + const isBrowserActiveTab = this.browserActiveTabId === tabId + const isAgentCurrentTab = agentCurrentTabId === tabId + const shouldShow = isRunning && this.windowHasFocus && isBrowserActiveTab && isAgentCurrentTab + + console.debug('[AgentController] shouldShowMaskForTab:', { + queryTabId: tabId, + agentStatus: this.status, + isRunning, + windowHasFocus: this.windowHasFocus, + browserActiveTabId: this.browserActiveTabId, + isBrowserActiveTab, + agentCurrentTabId, + isAgentCurrentTab, + shouldShow, + }) + + return shouldShow } /** diff --git a/packages/extension/wxt.config.js b/packages/extension/wxt.config.js index 94a5f85..a6f4203 100644 --- a/packages/extension/wxt.config.js +++ b/packages/extension/wxt.config.js @@ -12,6 +12,7 @@ export default defineConfig({ webExt: { chromiumProfile: chromeProfile, keepProfileChanges: true, + chromiumArgs: ['--hide-crash-restore-bubble'], }, vite: () => ({ plugins: [tailwindcss()],