Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(ui): remove embedded plugin view canvas frame

vastsaa89b46a88168
diff --git a/apps/desktop/electron/preload/plugin-panel.ts b/apps/desktop/electron/preload/plugin-panel.ts
index d52346580..b372b419a 100644
--- a/apps/desktop/electron/preload/plugin-panel.ts
+++ b/apps/desktop/electron/preload/plugin-panel.ts
@@ -130,6 +130,23 @@ function pluginOwnsTitlebarSpacing(): boolean {
return isWidgetPanel() || pluginChromeMode() !== "legacy";
}
+/**
+ * A docked view is composited inside the host work panel rather than rendered
+ * as a standalone window. Remove the document's default canvas edge so the
+ * host panel and plugin theme own the surface without an unconfigurable frame.
+ */
+function resetEmbeddedSurfaceChrome(): void {
+ const root = document.documentElement;
+ const body = document.body;
+ if (!root || !body) return;
+ for (const element of [root, body]) {
+ element.style.setProperty("box-sizing", "border-box");
+ element.style.setProperty("margin", "0");
+ element.style.setProperty("border", "0");
+ element.style.setProperty("background", "transparent");
+ }
+}
+
/**
* Keep plugin-owned panel documents aligned with the app renderer's compact
* scrollbar contract. A docked view is a separate WebContentsView, so it
@@ -587,6 +604,7 @@ function installPanelChrome(): void {
// toolbar offset resolves to the right value in both placements.
if (isEmbeddedPanel()) {
document.documentElement.style.setProperty("--pi-plugin-titlebar-height", "0px");
+ resetEmbeddedSurfaceChrome();
return;
}
diff --git a/apps/desktop/test/plugin-work-panel-views.test.mjs b/apps/desktop/test/plugin-work-panel-views.test.mjs
index 5644904d7..f6837a180 100644
--- a/apps/desktop/test/plugin-work-panel-views.test.mjs
+++ b/apps/desktop/test/plugin-work-panel-views.test.mjs
@@ -200,6 +200,10 @@ test("an embedded view drops the window-control chrome", () => {
preloadSource,
/if \(isEmbeddedPanel\(\)\) \{[\s\S]*--pi-plugin-titlebar-height", "0px"[\s\S]*return;/,
);
+ assert.match(preloadSource, /resetEmbeddedSurfaceChrome\(\)/);
+ assert.match(preloadSource, /element\.style\.setProperty\("margin", "0"\)/);
+ assert.match(preloadSource, /element\.style\.setProperty\("border", "0"\)/);
+ assert.match(preloadSource, /element\.style\.setProperty\("background", "transparent"\)/);
// The bridge is identical either way, so one HTML entry works in both.
assert.match(preloadSource, /contextBridge\.exposeInMainWorld\("pluginBridge", bridge\)/);
});
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 7d88bb65e..75438b8d2 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1112,7 +1112,7 @@ entirely inside the plugin's isolated page:
| Open with no resource | `Cmd/Ctrl + J` reveals the panel without creating a tab, so the body renders the New launcher. Clicking `+` creates an explicit, closable New tab with the same launcher rows. Activating a row from that tab replaces it with or selects the singleton view. Closing the final tab leaves the panel open in the no-resource state. |
| Constrained work area | The panel is capped by the shared three-column budget inside the existing client area; MainChat never drops below its 450px floor and the expanded sidebar yields at the threshold |
| New launcher active | The body hosts concise Review and plugin-view buttons. Each row replaces the launcher tab with its destination or activates the existing singleton; the page is independently closeable. |
-| Plugin view active | The body hosts the plugin's own isolated page as a native `WebContentsView`, positioned from the measured surface rect. It remains visible at its full rect while the divider is being resized or a New launcher tab is created; creating a page never pushes the plugin body down or changes its bounds. It is hidden whenever the tab is inactive, the panel is animating, or a panel-wide blocking overlay is open — the same rule the Browser preview follows, since both composite above renderer content. A view whose plugin is disabled, uninstalled, reloaded, or crashed is destroyed; the tab stays and re-opens the page on the next lifecycle event (ADR 0104) |
+| Plugin view active | The body hosts the plugin's own isolated page as a native `WebContentsView`, positioned from the measured surface rect. It remains visible at its full rect while the divider is being resized or a New launcher tab is created; creating a page never pushes the plugin body down or changes its bounds. Embedded plugin documents start with zero root/body margin and border and a transparent background, so the host panel and plugin theme own the visible surface edge. It is hidden whenever the tab is inactive, the panel is animating, or a panel-wide blocking overlay is open — the same rule the Browser preview follows, since both composite above renderer content. A view whose plugin is disabled, uninstalled, reloaded, or crashed is destroyed; the tab stays and re-opens the page on the next lifecycle event (ADR 0104) |
| Plugin out of scope | A view contributed by a plugin that is not active in the current project disappears from the New launcher when the project changes. Unlike contributed themes, which are one global setting and stay unfiltered, a view is scoped work |
### 5.4 Interactions