Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(desktop): hide docked native views under the extension prompt
vastsa143113bd18bc
diff --git a/apps/desktop/src/components/ExtensionPromptDialog.tsx b/apps/desktop/src/components/ExtensionPromptDialog.tsxindex 63ce9deb9..2876be0a9 100644--- a/apps/desktop/src/components/ExtensionPromptDialog.tsx+++ b/apps/desktop/src/components/ExtensionPromptDialog.tsx@@ -3,6 +3,7 @@ import { createPortal } from "react-dom";import { useTranslation } from "react-i18next";import type { TrustedExtensionUiPrompt } from "@pi-desktop/shared";import { api } from "../lib/api";+import { useBlockingOverlay } from "../lib/blocking-overlay";import { useHostSafetySurface } from "../lib/host-safety-layer";import { useAppStore } from "../stores/app-store";import { Button, TooltipButton } from "./ui";@@ -85,8 +86,10 @@ function ExtensionPromptDialog({);const inputRef = useRef<HTMLInputElement | null>(null);const dialogId = `extension-prompt-${prompt.promptId}`;- // Plugin layers step aside while the user answers.+ // Plugin layers step aside while the user answers, and the docked native+ // views hide: a WebContentsView composites above this modal otherwise.useHostSafetySurface();+ useBlockingOverlay();useEffect(() => {const previousOverflow = document.body.style.overflow;diff --git a/apps/desktop/test/fixtures/dialog-overflow-runner.cjs b/apps/desktop/test/fixtures/dialog-overflow-runner.cjsindex aa8add14c..b8575d606 100644--- a/apps/desktop/test/fixtures/dialog-overflow-runner.cjs+++ b/apps/desktop/test/fixtures/dialog-overflow-runner.cjs@@ -42,9 +42,11 @@ app.whenReady().then(async () => {const original = await measure();check('extension source fits and close is reachable', original.contained && original.overflow <= 1 && original.closeContained && original.closeHit, original);check('full source path wraps without clipping or changing dialog width', original.sourceWrapped && original.width <= 420, original);+ check('extension prompt suppresses native preview while open', await evaluate('window.dialogFixture.isBlockingOverlayActive()'));writeFileSync(join(process.env.PI_DIALOG_ARTIFACT_DIR, 'extension-path.png'), (await win.webContents.capturePage()).toPNG());await click('.session-rename-dialog-close');check('close dismisses the extension prompt', await evaluate('!document.querySelector("[role=dialog]") && window.dialogFixture.responses.length === 1'));+ check('extension prompt releases native preview after close', await evaluate('!window.dialogFixture.isBlockingOverlayActive()'));await evaluate('window.dialogFixture.show("extension")');for (const keyCode of 'Ann') win.webContents.sendInputEvent({ type: 'char', keyCode });await click('button[type="submit"]');diff --git a/apps/desktop/test/host-safety-layer.test.mjs b/apps/desktop/test/host-safety-layer.test.mjsindex a8e049a94..71e53de62 100644--- a/apps/desktop/test/host-safety-layer.test.mjs+++ b/apps/desktop/test/host-safety-layer.test.mjs@@ -56,3 +56,16 @@ test("an extension prompt holds the plugin layers aside while it is up", async (const dialog = source.slice(source.indexOf("function ExtensionPromptDialog("));assert.match(dialog, /\n useHostSafetySurface\(\);\n/);});++test("the extension prompt also hides the docked native views while it is up", async () => {+ const { readFile } = await import("node:fs/promises");+ const source = await readFile(+ new URL("../src/components/ExtensionPromptDialog.tsx", import.meta.url),+ "utf8",+ );+ const dialog = source.slice(source.indexOf("function ExtensionPromptDialog("));+ // The prompt is a centered modal over the whole shell, so a docked+ // WebContentsView composites above it. The dialog mounts only while a prompt+ // is queued, which is exactly the window that must block the panel.+ assert.match(dialog, /\n useBlockingOverlay\(\);\n/);+});