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(window): remove the Windows frameless rim
adoin18710b21b0e7
diff --git a/apps/desktop/electron/main/bootstrap/app-lifecycle.ts b/apps/desktop/electron/main/bootstrap/app-lifecycle.tsindex b1c996a69..6ca888118 100644--- a/apps/desktop/electron/main/bootstrap/app-lifecycle.ts+++ b/apps/desktop/electron/main/bootstrap/app-lifecycle.ts@@ -18,6 +18,7 @@ import {} from "@pi-desktop/shared";import { catalogs, resolveLocale } from "@pi-desktop/i18n";import { installApplicationMenu } from "../application-menu";+import { isWindowFullScreen, setWindowFullScreen } from "../window-fullscreen";import { createTraySessions } from "../tray-sessions";import { createTaskbarUnreadBadge } from "../taskbar-unread-badge";import { createWindow, type WindowLifecycleState } from "./window";@@ -402,7 +403,7 @@ export function createApplicationLifecycle({const window = state.mainWindow;return {maximized: Boolean(window && !window.isDestroyed() && window.isMaximized()),- fullScreen: Boolean(window && !window.isDestroyed() && window.isFullScreen()),+ fullScreen: Boolean(window && !window.isDestroyed() && isWindowFullScreen(window)),};}if (!target || target.isDestroyed()) {@@ -442,7 +443,11 @@ export function createApplicationLifecycle({contents.setZoomFactor(1);break;case "toggleFullScreen":- target.setFullScreen(!target.isFullScreen());+ setWindowFullScreen(+ target,+ !isWindowFullScreen(target),+ process.platform === "win32" && target === state.mainWindow,+ );break;case "minimize":target.minimize();@@ -458,7 +463,7 @@ export function createApplicationLifecycle({return {maximized: !target.isDestroyed() && target.isMaximized(),- fullScreen: !target.isDestroyed() && target.isFullScreen(),+ fullScreen: !target.isDestroyed() && isWindowFullScreen(target),};}diff --git a/apps/desktop/electron/main/bootstrap/window.ts b/apps/desktop/electron/main/bootstrap/window.tsindex 578ac7eb3..d50e8eaf0 100644--- a/apps/desktop/electron/main/bootstrap/window.ts+++ b/apps/desktop/electron/main/bootstrap/window.ts@@ -31,6 +31,8 @@ import {} from "../work-panel-window";import { readWindowState, writeWindowState } from "../window-preferences";import { suppressLinuxFramelessSystemMenu } from "../frameless-system-menu";+import { isWindowFullScreen } from "../window-fullscreen";+import { installWindowShape } from "../window-shape";import { recoverRendererAfterGone } from "../renderer-recovery";function windowsIconPath(): string | undefined {@@ -182,6 +184,7 @@ export async function createWindow({}: {frame: false,+ ...(process.platform === "win32" ? { thickFrame: false } : {}),backgroundColor: builtinWindowBackground(nativeTheme.shouldUseDarkColors ? "dark" : "light",),@@ -203,6 +206,7 @@ export async function createWindow({},});const window = windowState.mainWindow;+ if (process.platform === "win32") installWindowShape(window);suppressLinuxFramelessSystemMenu(window);const initialBounds = window.getBounds();windowState.workPanelBaseBounds = restoredBounds@@ -323,7 +327,7 @@ export async function createWindow({if (nativeWorkPanelResize ||windowState.requestedWorkPanelReservation <= 0 ||- window.isFullScreen() ||+ isWindowFullScreen(window) ||window.isMaximized()) {return nativeWorkPanelResize;@@ -356,7 +360,7 @@ export async function createWindow({if (!isLiveWindow() ||windowState.requestedWorkPanelReservation <= 0 ||- window.isFullScreen() ||+ isWindowFullScreen(window) ||window.isMaximized()) {return windowState.workPanelBaseBounds?.width ?? windowMinWidth;@@ -544,7 +548,7 @@ export async function createWindow({const sendFullScreen = () => {if (window.isDestroyed() || window.webContents.isDestroyed()) return;window.webContents.send(IPC.event.windowFullScreen, {- fullScreen: window.isFullScreen(),+ fullScreen: isWindowFullScreen(window),});};window.on("enter-full-screen", sendFullScreen);@@ -569,7 +573,7 @@ export async function createWindow({// window never lands partly off-screen. macOS keeps its own restore behavior.const refitWindowToWorkArea = () => {if (!isLiveWindow() || process.platform === "darwin") return;- if (window.isMaximized() || window.isFullScreen() || window.isMinimized()) return;+ if (window.isMaximized() || isWindowFullScreen(window) || window.isMinimized()) return;const currentBounds = window.getBounds();const workArea = screen.getDisplayMatching(currentBounds).workArea;window.setMinimumSize(@@ -854,7 +858,8 @@ export async function createWindow({!isLiveWindow() ||boundsGuard ||windowState.workPanelNativeResizeActive ||- windowState.workPanelChatResizeActive+ windowState.workPanelChatResizeActive ||+ isWindowFullScreen(window)) {return;}diff --git a/apps/desktop/electron/main/ipc/window-ipc.ts b/apps/desktop/electron/main/ipc/window-ipc.tsindex 358667c39..266cdec62 100644--- a/apps/desktop/electron/main/ipc/window-ipc.ts+++ b/apps/desktop/electron/main/ipc/window-ipc.ts@@ -1,5 +1,5 @@import { BrowserWindow } from "electron";-import { isWindowBackgroundColor } from "@pi-desktop/plugin-sdk";+import { isWindowBackgroundColor, MAX_WINDOW_CORNER_RADIUS } from "@pi-desktop/plugin-sdk";import {builtinWindowBackground,ErrorCodes,@@ -18,6 +18,10 @@ import {parseWorkPanelReservationWidth,type WorkPanelReservationState,} from "../work-panel-window";+import {+ DEFAULT_WINDOW_CORNER_RADIUS,+ setWindowCornerRadius,+} from "../window-shape";import type { IpcRegistrar } from "./types";export type WindowIpcDependencies = {@@ -49,7 +53,6 @@ export function registerWindowIpc({setTraySessionPreferences,}: WindowIpcDependencies): void {const { handle, handleWithEvent } = registrar;-handleWithEvent(IPC.invoke.traySetSessionPreferences, async (event, input: unknown) => {registrar.assertMainWindowSender(event);const preferences = parseTraySessionPreferences(input);@@ -94,7 +97,8 @@ export function registerWindowIpc({return { requested, applied: setter(requested) };});- handle(IPC.invoke.windowSetBackgroundColor, async (input: unknown = {}) => {+ handleWithEvent(IPC.invoke.windowSetBackgroundColor, async (event, input: unknown = {}) => {+ registrar.assertMainWindowSender(event);const theme = (input as { theme?: unknown })?.theme;if (!isThemeColorScheme(theme)) {throw Object.assign(new Error("invalid window background theme"), {@@ -113,6 +117,16 @@ export function registerWindowIpc({errorCode: ErrorCodes.INVALID_ARGUMENT,});}+ const requestedRadius = (input as { cornerRadius?: unknown })?.cornerRadius;+ if (+ requestedRadius !== undefined && requestedRadius !== null &&+ (typeof requestedRadius !== "number" || !Number.isInteger(requestedRadius) ||+ requestedRadius < 0 || requestedRadius > MAX_WINDOW_CORNER_RADIUS)+ ) {+ throw Object.assign(new Error("invalid window corner radius"), {+ errorCode: ErrorCodes.INVALID_ARGUMENT,+ });+ }if (process.platform === "darwin") return { applied: false, theme };const mainWindow = getMainWindow();if (!mainWindow || mainWindow.isDestroyed()) {@@ -121,8 +135,14 @@ export function registerWindowIpc({const color = isWindowBackgroundColor(requested)? requested: builtinWindowBackground(theme);+ const cornerRadius = process.platform === "win32"+ ? setWindowCornerRadius(+ mainWindow,+ typeof requestedRadius === "number" ? requestedRadius : DEFAULT_WINDOW_CORNER_RADIUS,+ )+ : null;mainWindow.setBackgroundColor(color);- return { applied: true, theme, color };+ return { applied: true, theme, color, cornerRadius };});handle(IPC.invoke.windowControl, async (input: { action?: string } = {}) => {diff --git a/apps/desktop/electron/main/plugin-runtime.ts b/apps/desktop/electron/main/plugin-runtime.tsindex 0379931c1..767a5c05f 100644--- a/apps/desktop/electron/main/plugin-runtime.ts+++ b/apps/desktop/electron/main/plugin-runtime.ts@@ -42,6 +42,7 @@ import {validatePluginThemeVariables,THEME_ASSET_MAX_BYTES,THEME_CSS_MAX_BYTES,+ MAX_WINDOW_CORNER_RADIUS,WINDOW_BACKGROUND_COLOR_PATTERN,resolvePluginLocalizedString,validateManifest,@@ -202,6 +203,7 @@ export type RegisteredPluginTheme = {* `ui.window.appearance` (ADR 0248).*/windowBackground?: { light?: string; dark?: string };+ windowCornerRadius?: number;};export type PluginPanelRequest = {@@ -1204,6 +1206,15 @@ function resolveWindowBackground(return result.light || result.dark ? result : undefined;}+function resolveWindowCornerRadius(value: unknown): number | undefined {+ if (!value || typeof value !== "object") return undefined;+ const radius = (value as { cornerRadius?: unknown }).cornerRadius;+ return typeof radius === "number" && Number.isInteger(radius) &&+ radius >= 0 && radius <= MAX_WINDOW_CORNER_RADIUS+ ? radius+ : undefined;+}+/** Default spawner: an Electron utilityProcess per plugin. */const spawnUtilityProcess: PluginProcessSpawner = async ({ pluginId, entry }) => {const { utilityProcess } = await import("electron");@@ -3336,6 +3347,9 @@ export class PluginRuntime {const windowBackground = loaded.permissions.has("ui.window.appearance")? resolveWindowBackground(loaded.manifest.contributes?.windowAppearance): undefined;+ const windowCornerRadius = loaded.permissions.has("ui.window.appearance")+ ? resolveWindowCornerRadius(loaded.manifest.contributes?.windowAppearance)+ : undefined;if (windowAppearanceDeclared && !loaded.permissions.has("ui.window.appearance")) {this.services.audit?.({pluginId,@@ -3420,6 +3434,7 @@ export class PluginRuntime {? { variablesCss: this.themeVariablesCss(loaded, id, contrib.variables) }: {}),...(windowBackground ? { windowBackground } : {}),+ ...(windowCornerRadius !== undefined ? { windowCornerRadius } : {}),});accepted += 1;}@@ -4731,6 +4746,9 @@ export class PluginRuntime {base,css: sanitized.css,...(previous?.windowBackground ? { windowBackground: previous.windowBackground } : {}),+ ...(previous?.windowCornerRadius !== undefined+ ? { windowCornerRadius: previous.windowCornerRadius }+ : {}),});this.services.onPluginThemesChanged?.(pluginId);this.services.audit?.({diff --git a/apps/desktop/electron/main/window-fullscreen.ts b/apps/desktop/electron/main/window-fullscreen.tsnew file mode 100644index 000000000..c3dbf7847--- /dev/null+++ b/apps/desktop/electron/main/window-fullscreen.ts@@ -0,0 +1,21 @@+import type { BrowserWindow } from "electron";++// Electron's Win32 thickFrame:false path fills display.bounds() but leaves+// BrowserWindow.isFullScreen() false. Track that fallback for toggle and state.+const borderlessFullScreen = new WeakSet<BrowserWindow>();++export function isWindowFullScreen(window: BrowserWindow): boolean {+ return borderlessFullScreen.has(window) || window.isFullScreen();+}++export function setWindowFullScreen(+ window: BrowserWindow,+ fullScreen: boolean,+ borderlessWindowsMain: boolean,+): void {+ if (borderlessWindowsMain) {+ if (fullScreen) borderlessFullScreen.add(window);+ else borderlessFullScreen.delete(window);+ }+ window.setFullScreen(fullScreen);+}diff --git a/apps/desktop/electron/main/window-shape.ts b/apps/desktop/electron/main/window-shape.tsnew file mode 100644index 000000000..dab310b87--- /dev/null+++ b/apps/desktop/electron/main/window-shape.ts@@ -0,0 +1,67 @@+import type { BrowserWindow, Rectangle } from "electron";+import { MAX_WINDOW_CORNER_RADIUS } from "@pi-desktop/plugin-sdk";+import { isWindowFullScreen } from "./window-fullscreen.ts";++export const DEFAULT_WINDOW_CORNER_RADIUS = 4;+const controllers = new WeakMap<BrowserWindow, { setRadius: (radius: number) => number }>();++/** Pixel rows approximate a quarter circle without changing window bounds. */+export function roundedWindowShape(width: number, height: number, radius: number): Rectangle[] {+ const corner = Math.min(Math.round(radius), Math.floor(width / 2), Math.floor(height / 2));+ if (corner <= 0) return [];+ const rects: Rectangle[] = [];+ for (let row = 0; row < corner; row += 1) {+ const distance = corner - row - 0.5;+ const inset = Math.max(0, Math.ceil(corner - Math.sqrt(corner * corner - distance * distance) - 0.5));+ const band = { x: inset, width: width - inset * 2, height: 1 };+ rects.push({ ...band, y: row }, { ...band, y: height - row - 1 });+ }+ if (height > corner * 2) {+ rects.push({ x: 0, y: corner, width, height: height - corner * 2 });+ }+ return rects;+}++/** Keep the native hit region matched to the current window dimensions. */+export function installWindowShape(window: BrowserWindow, initialRadius = DEFAULT_WINDOW_CORNER_RADIUS) {+ let radius = initialRadius;+ let lastShape = "";+ const apply = () => {+ if (window.isDestroyed()) return;+ const { width, height } = window.getBounds();+ const rectangular = window.isMaximized() || isWindowFullScreen(window);+ const shapeKey = `${width}:${height}:${rectangular ? 0 : radius}`;+ if (shapeKey === lastShape) return;+ window.setShape(rectangular ? [] : roundedWindowShape(width, height, radius));+ lastShape = shapeKey;+ };+ window.on("resize", apply);+ window.on("maximize", apply);+ window.on("unmaximize", apply);+ window.on("enter-full-screen", apply);+ window.on("leave-full-screen", apply);+ const dispose = () => {+ window.removeListener("resize", apply);+ window.removeListener("maximize", apply);+ window.removeListener("unmaximize", apply);+ window.removeListener("enter-full-screen", apply);+ window.removeListener("leave-full-screen", apply);+ window.removeListener("closed", dispose);+ controllers.delete(window);+ };+ window.once("closed", dispose);+ const controller = {+ setRadius(next: number) {+ radius = Math.max(0, Math.min(MAX_WINDOW_CORNER_RADIUS, Math.round(next)));+ apply();+ return radius;+ },+ };+ controllers.set(window, controller);+ apply();+ return controller;+}++export function setWindowCornerRadius(window: BrowserWindow, radius: number): number | null {+ return controllers.get(window)?.setRadius(radius) ?? null;+}diff --git a/apps/desktop/src/features/app/useAppShellRuntime.tsx b/apps/desktop/src/features/app/useAppShellRuntime.tsxindex 51b60e076..132fd6f5a 100644--- a/apps/desktop/src/features/app/useAppShellRuntime.tsx+++ b/apps/desktop/src/features/app/useAppShellRuntime.tsx@@ -511,7 +511,11 @@ export function useAppShellRuntime() {// the plugin theme is gone from the catalog, so there is nothing left to// pass and the host colour wins.void api- .setWindowBackgroundColor(resolvedTheme, pluginTheme?.windowBackground?.[resolvedTheme])+ .setWindowBackgroundColor(+ resolvedTheme,+ pluginTheme?.windowBackground?.[resolvedTheme],+ pluginTheme?.windowCornerRadius,+ ).catch(() => undefined);};apply();diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.tsindex 71b7f7f92..2c35e85de 100644--- a/apps/desktop/src/lib/api.ts+++ b/apps/desktop/src/lib/api.ts@@ -1386,10 +1386,10 @@ export const api = {IPC.invoke.windowSetWorkPanelChatWidth,{ width },),- setWindowBackgroundColor: (theme: "light" | "dark", color?: string) =>- invoke<{ applied: boolean; theme: "light" | "dark"; color?: string }>(+ setWindowBackgroundColor: (theme: "light" | "dark", color?: string, cornerRadius?: number) =>+ invoke<{ applied: boolean; theme: "light" | "dark"; color?: string; cornerRadius?: number | null }>(IPC.invoke.windowSetBackgroundColor,- { theme, color },+ { theme, color, cornerRadius },),windowControl: (action: WindowControlAction) =>invoke<{ maximized: boolean }>(IPC.invoke.windowControl, { action }),diff --git a/apps/desktop/test/plugin-themes.test.mjs b/apps/desktop/test/plugin-themes.test.mjsindex fed6c926d..31cbe3da3 100644--- a/apps/desktop/test/plugin-themes.test.mjs+++ b/apps/desktop/test/plugin-themes.test.mjs@@ -240,7 +240,9 @@ test("a contributed window background needs its own grant", () => {const register = runtimeSrc.slice(runtimeSrc.indexOf("private registerThemes"));assert.match(register, /permissions\.has\("ui\.window\.appearance"\)/);assert.match(register, /resolveWindowBackground\(/);+ assert.match(register, /resolveWindowCornerRadius\(/);assert.match(runtimeSrc, /windowBackground\?: \{ light\?: string; dark\?: string \}/);+ assert.match(runtimeSrc, /windowCornerRadius\?: number/);});test("the shipped example theme survives sanitation", () => {diff --git a/apps/desktop/test/window-background-theme.test.mjs b/apps/desktop/test/window-background-theme.test.mjsindex fac75e5cb..dc36b16fb 100644--- a/apps/desktop/test/window-background-theme.test.mjs+++ b/apps/desktop/test/window-background-theme.test.mjs@@ -21,11 +21,11 @@ test("theme changes synchronize the native non-macOS window background", () => {);assert.match(apiSource,- /setWindowBackgroundColor:\s*\(theme:\s*"light" \| "dark",\s*color\?:\s*string\)[\s\S]*?IPC\.invoke\.windowSetBackgroundColor/,+ /setWindowBackgroundColor:\s*\(theme:\s*"light" \| "dark",\s*color\?:\s*string,\s*cornerRadius\?:\s*number\)[\s\S]*?IPC\.invoke\.windowSetBackgroundColor/,);assert.match(mainSource,- /handle\(IPC\.invoke\.windowSetBackgroundColor,[\s\S]*?!isWindowBackgroundColor\(requested\)[\s\S]*?mainWindow\.setBackgroundColor\(color\)/,+ /handleWithEvent\(IPC\.invoke\.windowSetBackgroundColor,[\s\S]*?registrar\.assertMainWindowSender\(event\)[\s\S]*?!isWindowBackgroundColor\(requested\)[\s\S]*?mainWindow\.setBackgroundColor\(color\)/,);// A malformed colour is refused; an omitted one falls back to the host// palette, which is what restores the default after a theme switch.@@ -53,7 +53,7 @@ test("theme changes synchronize the native non-macOS window background", () => {);assert.ok(appSource.includes(- "setWindowBackgroundColor(resolvedTheme, pluginTheme?.windowBackground?.[resolvedTheme])",+ "pluginTheme?.windowCornerRadius",),);});diff --git a/apps/desktop/test/window-resize.test.mjs b/apps/desktop/test/window-resize.test.mjsindex 1f8d4c343..05a10d282 100644--- a/apps/desktop/test/window-resize.test.mjs+++ b/apps/desktop/test/window-resize.test.mjs@@ -10,8 +10,9 @@ const reservationHandler = mainSource.slice(mainSource.indexOf("IPC.invoke.windowSetWorkPanelChatWidth"),);-test("the main window keeps native edge and corner resizing enabled", () => {+test("the main window keeps native edge resizing without the Windows thick frame", () => {assert.match(mainSource, /resizable:\s*true/);+ assert.match(mainSource, /process\.platform === "win32" \? \{ thickFrame: false \}/);// The BrowserWindow props use the clamped `initialMin*` values so a small// work area does not lock the window past the display's own width.assert.match(mainSource, /minWidth:\s*initialMinWidth/);diff --git a/apps/desktop/test/window-shape.test.mjs b/apps/desktop/test/window-shape.test.mjsnew file mode 100644index 000000000..3662b687e--- /dev/null+++ b/apps/desktop/test/window-shape.test.mjs@@ -0,0 +1,50 @@+import assert from "node:assert/strict";+import { EventEmitter } from "node:events";+import test from "node:test";+import { installWindowShape, roundedWindowShape, setWindowCornerRadius } from "../electron/main/window-shape.ts";+import { setWindowFullScreen } from "../electron/main/window-fullscreen.ts";++test("4px shape cuts only the outer corner pixels", () => {+ const rects = roundedWindowShape(100, 80, 4);+ assert.deepEqual(rects[0], { x: 2, y: 0, width: 96, height: 1 });+ assert.deepEqual(rects[1], { x: 2, y: 79, width: 96, height: 1 });+ assert.deepEqual(rects.at(-1), { x: 0, y: 4, width: 100, height: 72 });+ assert.deepEqual(roundedWindowShape(100, 80, 0), []);+});++test("shape follows resize and becomes rectangular in maximized or fullscreen states", () => {+ const window = new EventEmitter();+ let bounds = { x: 20, y: 30, width: 100, height: 80 };+ let maximized = false;+ let lastShape = null;+ window.getBounds = () => bounds;+ window.isDestroyed = () => false;+ window.isMaximized = () => maximized;+ window.isFullScreen = () => false;+ window.setFullScreen = (value) => window.emit(value ? "enter-full-screen" : "leave-full-screen");+ window.setShape = (rects) => { lastShape = rects; };+ const shape = installWindowShape(window);+ assert.deepEqual(lastShape[0], { x: 2, y: 0, width: 96, height: 1 });+ bounds = { ...bounds, width: 120 };+ window.emit("resize");+ assert.equal(lastShape[0].width, 116);+ maximized = true;+ window.emit("maximize");+ assert.deepEqual(lastShape, []);+ maximized = false;+ window.emit("unmaximize");+ assert.equal(lastShape[0].width, 116);+ setWindowFullScreen(window, true, true);+ assert.deepEqual(lastShape, []);+ setWindowFullScreen(window, false, true);+ assert.equal(lastShape[0].width, 116);+ assert.equal(shape.setRadius(100), 24);+ assert.equal(lastShape[0].width < 116, true);+ assert.equal(setWindowCornerRadius(window, 0), 0);+ assert.deepEqual(lastShape, []);+ assert.equal(setWindowCornerRadius(window, 4), 4);+ assert.equal(lastShape[0].width, 116);+ window.emit("closed");+ assert.equal(window.listenerCount("resize"), 0);+ assert.equal(setWindowCornerRadius(window, 8), null);+});diff --git a/crates/host-core/src/plugins/tests.rs b/crates/host-core/src/plugins/tests.rsindex e28b9ef53..b3ee7e39c 100644--- a/crates/host-core/src/plugins/tests.rs+++ b/crates/host-core/src/plugins/tests.rs@@ -1111,6 +1111,17 @@ fn window_appearance_requires_permission_and_a_hex_colour() {);assert!(read_manifest_err(&no_perm).contains("ui.window.appearance permission"));+ let no_perm_radius = dir.path().join("no-perm-radius");+ write_plugin(+ &no_perm_radius,+ capability_manifest(+ json!({ "windowAppearance": { "cornerRadius": 4 } }),+ json!([]),+ ),+ &[],+ );+ assert!(read_manifest_err(&no_perm_radius).contains("ui.window.appearance permission"));+let bad_colour = dir.path().join("bad-colour");write_plugin(&bad_colour,@@ -1122,11 +1133,22 @@ fn window_appearance_requires_permission_and_a_hex_colour() {);assert!(read_manifest_err(&bad_colour).contains("#rrggbb or #rrggbbaa"));+ let bad_radius = dir.path().join("bad-radius");+ write_plugin(+ &bad_radius,+ capability_manifest(+ json!({ "windowAppearance": { "cornerRadius": 25 } }),+ json!(["ui.window.appearance"]),+ ),+ &[],+ );+ assert!(read_manifest_err(&bad_radius).contains("cornerRadius"));+let ok = dir.path().join("ok");write_plugin(&ok,capability_manifest(- json!({ "windowAppearance": { "backgroundColor": { "light": "#f5f5f5", "dark": "#0d1424cc" } } }),+ json!({ "windowAppearance": { "backgroundColor": { "light": "#f5f5f5", "dark": "#0d1424cc" }, "cornerRadius": 4 } }),json!(["ui.window.appearance"]),),&[],diff --git a/crates/host-core/src/plugins/validation.rs b/crates/host-core/src/plugins/validation.rsindex 8866ffc74..225b2fcc7 100644--- a/crates/host-core/src/plugins/validation.rs+++ b/crates/host-core/src/plugins/validation.rs@@ -449,6 +449,14 @@ pub(crate) fn validate_contributions(root: &Path, manifest: &PluginManifest) ->}}}+ if let Some(radius) = obj.get("cornerRadius") {+ match radius.as_u64() {+ Some(value) if value <= 24 => {}+ _ => bail!(+ "PLUGIN_INVALID: contributes.windowAppearance.cornerRadius must be an integer from 0 to 24"+ ),+ }+ }}if let Some(views) = map.get("views") {diff --git a/docs/adr/0310-windows-borderless-window-resize.md b/docs/adr/0310-windows-borderless-window-resize.mdnew file mode 100644index 000000000..35eeed08e--- /dev/null+++ b/docs/adr/0310-windows-borderless-window-resize.md@@ -0,0 +1,72 @@+# ADR 0310: Preserve Windows resizing without the native frameless rim++- Status: Accepted+- Date: 2026-09-28+- Deciders: PI-Desktop maintainers+- Related: D635, E2E-167, ADR 0025, ADR 0248++## Context++Electron 43 paints a visible region on the left, bottom, and right of a+frameless, resizable Windows window with the default thick frame. The renderer+cannot paint into that native area. Disabling `WS_THICKFRAME` removes the rim+and window animations. Although Electron's public option description warns of+losing edge dragging, the pinned Electron 43.6 frameless hit test still handles+native edge and corner resizing. The application requires its existing minimum+size, settled bounds persistence, and separate work-panel resize ownership to+remain intact.++## Decision++Disable the Windows thick frame on the main window only. Retain Electron's+native frameless edge/corner hit testing and the current minimum-size contract;+the renderer adds no resize handles or geometry IPC. Qualify this against the+pinned Electron version with real native edge/corner drags and minimum-size+checks, since the public option description is more restrictive than the+observed implementation.++macOS and Linux keep native edge resizing. Work-panel width remains a separate+renderer-owned interaction; the window resize changes only application bounds.+Electron's `thickFrame: false` fullscreen path changes display bounds without+setting the value returned by `isFullScreen()`. Main tracks this fallback so+fullscreen toggles, renderer events, and persisted normal bounds remain correct.++Apply a native 4 DIP rounded shape to the Windows main window. Electron's+`setShape` removes both drawing and pointer hit testing outside its rectangles,+so the corner cutouts have no opaque fill while the existing native background+colour remains theme-owned inside the window. Main reapplies the shape on+resize, and makes it rectangular while maximized or fullscreen. A plugin with+`ui.window.appearance` may declare an integer `cornerRadius` from 0 to 24 DIP+alongside its background colours. The selected theme supplies it through the+existing window-appearance IPC; removing the theme restores 4 DIP. Main validates+the value and the calling renderer before changing the native shape.++## Alternatives++- Keep the thick frame: leaves the visible rim.+- Make the window transparent: changes the opaque background and theme+ contract without removing the need to qualify native resizing.+- Use only renderer CSS rounding: leaves the opaque native background visible+ in the corners and cannot change the window's native hit region.+- Pin an older Electron: trades away newer security and runtime fixes for a+ historical rendering behavior.+- Wait for an upstream Electron fix: does not resolve the current UI defect.++## Consequences++- The Windows main window has no painted left, bottom, or right native rim.+- Native edge resizing and minimum size remain owned by Electron on every+ platform; there is no parallel renderer/Main resize path.+- Windows native shadow, minimize/maximize animation, and snap behavior may+ differ with `WS_THICKFRAME` removed. They require native qualification before+ landing; the application must not claim parity without that check.+- The native shadow cannot be made theme-configurable through Electron while+ this thick-frame-free window retains its current bounds. An external CSS+ shadow would need transparent window margin or a companion surface, changing+ window geometry and lifecycle; this decision does not add a shadow setting.+- `setShape` is an experimental Electron API and its pixel-row curve is not+ anti-aliased by Windows. Native corner hit testing is qualified on the target+ Electron version rather than assumed from CSS.+- The Plugin SDK gains one optional, permission-gated appearance property. Old+ manifests remain valid. No host RPC, database schema, or persisted format+ changes.diff --git a/docs/adr/README.md b/docs/adr/README.mdindex 0a69f87a9..c1d1a0fbb 100644--- a/docs/adr/README.md+++ b/docs/adr/README.md@@ -340,6 +340,7 @@ Each ADR includes:| 0307 | [Sync the API-key service catalog with pi-ai's built-in providers](0307-pi-ai-api-key-provider-sync.md) | Accepted (amends ADR 0012 / 0020 / 0116 / 0155) || 0308 | [Remove the Pull Requests destination and listing tool](0308-remove-pull-requests-destination.md) | Accepted || 0309 | [Remove bundled macOS first-launch guidance](0309-remove-macos-first-launch-artifacts.md) | Accepted (D634; amends D457 / ADR 0296) |+| 0310 | [Preserve Windows resizing without the native frameless rim](0310-windows-borderless-window-resize.md) | Accepted (D635) || turn-process-and-thinking-display | [Turn process and thinking presentation](turn-process-and-thinking-display.md) | Accepted || provider-display-order | [Provider display order](provider-display-order.md) | Accepted || registry-header-variable-spelling | [Remote header variables accept the registry's `{name}` spelling](registry-header-variable-spelling.md) | Proposed |diff --git a/docs/spec/03-runtime/01-ipc-protocol.md b/docs/spec/03-runtime/01-ipc-protocol.mdindex 3f5e824c9..a0985d21a 100644--- a/docs/spec/03-runtime/01-ipc-protocol.md+++ b/docs/spec/03-runtime/01-ipc-protocol.md@@ -1909,7 +1909,17 @@ platform, and minimize-to-tray needs it whichever close behavior is stored.Maximize/unmaximize changes also emit`window/event/maximized`. Unknown actions fail. These Electron-only channelsdo not cross into host-core and do not change the host RPC protocol version.-The preload intentionally exposes no arbitrary BrowserWindow resize channel.+The preload exposes no arbitrary BrowserWindow bounds or resize channel.+Windows retains Electron's native frameless edge/corner hit testing with+`thickFrame: false`; the renderer does not submit window geometry.+The Windows borderless fullscreen fallback is tracked in Main because Electron+reports `isFullScreen() === false` while it uses display bounds for that mode;+the window-control state and fullscreen event use the tracked value.+`window/setBackgroundColor` remains Electron-local and main-renderer-only. Its+optional `cornerRadius` is an integer from 0 to 24 DIP; omission restores the+Windows main-window default of 4. Main applies the native shape on theme+selection and resize, and clears the corner cutouts during maximize/fullscreen.+Malformed values fail with `INVALID_ARGUMENT` before changing the background.Plugin panel chrome uses a separate Electron-local`pi-plugin-panel-window-control` channel with the same four semantic actions,but the handler resolves the target strictly from the sender's live paneldiff --git a/docs/spec/04-ux/01-ui-ia.md b/docs/spec/04-ux/01-ui-ia.mdindex 4eb4e4bcb..9774e26ee 100644--- a/docs/spec/04-ux/01-ui-ia.md+++ b/docs/spec/04-ux/01-ui-ia.md@@ -145,9 +145,10 @@ destination, chat as the home surface, tools and permissions inline.panel across the client area beside the sidebar; leaving preview restores theprior panel width and sidebar state without changing native bounds. Therenderer-measured panel- rectangle continues to position the native Browser view. Native window edges+ rectangle continues to position the native Browser view. Window edgesresize the app window only; they do not change the panel target. The outer- window remains natively resizable from all OS edges and corners, with a+ window remains resizable from all native edges and corners, including+ Electron's frameless hit regions on Windows, with aminimum supported size of 1040×700. Replacesthe former context-panel overlay; workspace/model/status info lives in thecomposer chips and Settings instead.diff --git a/docs/spec/04-ux/07-ui-design-system.md b/docs/spec/04-ux/07-ui-design-system.mdindex 3431f0c37..9b3686501 100644--- a/docs/spec/04-ux/07-ui-design-system.md+++ b/docs/spec/04-ux/07-ui-design-system.md@@ -1102,16 +1102,28 @@ header-height background behind the excluded lane without covering its controls.- The inner panel divider changes the panel width in the renderer. Moving itleft takes internal space from MainChat until the 450px floor is reached, atwhich point the expanded sidebar yields; moving it right returns that space.- Native window edges resize only the fixed app window.+ Window edges resize only the fixed app window.- Panel open and collapse change only the in-flow flex allocation. No positivenative reservation is requested, and the panel's preferred width remains arenderer-local setting.-- The outer shell keeps native edge/corner resizing enabled on every platform.- Frameless titlebar drag regions never replace the OS resize ownership. A+- All platforms retain native edge/corner resizing. On Windows the main window+ disables the frameless `WS_THICKFRAME` rim while Electron 43.6's frameless+ hit test continues to own edge and corner resizing; no border is painted on+ the left, right, or bottom. The Windows main window uses a 4 DIP rounded+ hit/draw shape by+ default: pixels outside its corners have no fill or mouse target. A selected+ plugin theme with `ui.window.appearance` may set `cornerRadius` to an integer+ from 0 through 24 DIP; removing that theme restores 4 DIP. The shape becomes+ rectangular while maximized or fullscreen and follows every resize. Native+ window background colors remain theme-owned inside the shape. Electron's borderless+ fullscreen fallback fills the display without reporting `isFullScreen()`;+ Main tracks its state so toggling back restores the previous bounds and+ fullscreen geometry is never persisted. Frameless titlebar drag+ regions remain separate from window-edge resizing. A300ms stable-bounds settle window prevents recovery logic from competing witha slow pointer gesture, and normal base bounds persist 600ms after the last- native resize/move event. Width < 1040px or height < 700px is unsupported and- prevented by Electron.+ resize/move event. Width < 1040px or height < 700px is unsupported and+ constrained by Electron's native resize handling.## 11. Component foundationsdiff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex f51e0a2b6..d30a35eaf 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -81,7 +81,9 @@ Outer frame that positions Topbar, Sidebar, MainChat, and WorkPanel. Owns resize- Work panel resize: its inner left-edge handle changes the committed panelwidth in the renderer, so dragging left gives the panel more internal spaceand dragging right returns space to MainChat (§5.4)-- Window resize: native edges and corners resize the fixed application window;+- Window resize: native edges and corners on all platforms resize the fixed+ application window; Windows keeps Electron's frameless hit test without its+ painted thick-frame rim;they never resize or reserve the work panel. Responsive layout follows[07-ui-design-system.md](07-ui-design-system.md) §10.1@@ -1107,7 +1109,7 @@ entirely inside the plugin's isolated page:| Preview (maximize) | MainChat is unmounted and the panel fills the client area beside the sidebar. The mode is transient and restores the prior panel width and sidebar state when left. || Multiple artifacts | The header keeps a horizontally scrollable tab strip. The fixed `+` action creates a new launcher tab; its buttons open Review and all in-scope plugin views without duplicating open resource tabs. || Session switch | The destination session's retained open state, tabs, active tab, and Browser resource replace the previous session's panel context atomically; neither context is deleted |-| Resizing | The inner left divider follows anchored pointer delta or keyboard input for the panel target; pointer changes are frame-coalesced and committed in the renderer. Escape, pointer cancellation, or lost capture restores the prior panel width. Native window edges resize only the fixed application window. |+| Resizing | The inner left divider follows anchored pointer delta or keyboard input for the panel target; pointer changes are frame-coalesced and committed in the renderer. Escape, pointer cancellation, or lost capture restores the prior panel width. Native window edges resize only the fixed application window on every platform. || No workspace | Each tab renders its own "open a project" empty state || 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 |diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex cd2594fac..45747e955 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -547,7 +547,7 @@ may be retained while exactly one workspace supplies the visible shell context.- On every platform, opening and collapsing the visible panel change only theinternal flex allocation; native window bounds remain unchanged. The innerdivider updates the renderer-owned panel target from 244px upward, capped by- the live three-column budget, while native window edges resize only the fixed+ the live three-column budget, while window edges resize only the fixedapplication window (ADR 0151).- No tool result creates or activates a work-panel tab. Review opens only froman explicit user action — its `+` launcher row, or the retained context thediff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex ea15f57e1..b58975384 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -2979,12 +2979,12 @@ identify the platform validation still needed.#### E2E-024J: Plugin theme applies and falls back when withdrawn-- **Preconditions**: A marketplace/package-installable `examples/plugins/hello` variant (`demo.hello`) whose `midnight` theme CSS references a declared package-relative image at `art/preview.png`; a plugin with CSS using `@import` or remote `url()` for rejection plus a comment-only variant; an asset theme with `windowAppearance` variants with and without `ui.window.appearance`.+- **Preconditions**: A marketplace/package-installable `examples/plugins/hello` variant (`demo.hello`) whose `midnight` theme CSS references a declared package-relative image at `art/preview.png`; a plugin with CSS using `@import` or remote `url()` for rejection plus a comment-only variant; an asset theme with `windowAppearance` variants with and without `ui.window.appearance`, including `cornerRadius: 0` and an invalid value above 24.- **Steps**: 1) Install the packaged Hello variant from Marketplace or its `.piplug` package and select `Hello Midnight` in Settings → General → Theme. 2) Restart the app. 3) Disable the providing plugin. 4) Re-enable it, then uninstall it. 5) Load the plugin with unsafe CSS. 6) Load the comment-only variant. 7) Select the asset variant's theme on Windows/Linux and on macOS, verify the package-relative image renders through `plugin-asset:` in the shell and the plugin's panel, and load a sheet with an undeclared package-relative `url()` to verify it is refused. 8) Deselect its theme after removing `ui.window.appearance`.-- **Expected**: The packaged plugin installs successfully with its relative image resolved inside the plugin root; its theme appears in the picker alongside the built-ins and applies immediately, with the image served through `plugin-asset:`; the choice survives restart as `plugin:demo.hello:midnight`; disabling or uninstalling the provider falls back to `system` instead of an unstyled shell; unsafe CSS is refused at load with the reason logged and no `<style>` element injected; the comment-only sheet loads and contributes its theme, because the sanitizer only inspects CSS the browser would apply; the declared asset paints through `plugin-asset:` in the shell and in the plugin's own panel, an undeclared reference is refused with the reason logged, the declared background colours the native window on Windows/Linux and is never sent on macOS, and deselecting the theme or dropping the grant returns the window to the host background; the whole shell follows the theme, including the work-panel column, its header, and the browser/file viewer strips, all of which read `--ds-bg-dock` / `--ds-bg-dock-raised` rather than a literal.+- **Expected**: The packaged plugin installs successfully with its relative image resolved inside the plugin root; its theme appears in the picker alongside the built-ins and applies immediately, with the image served through `plugin-asset:`; the choice survives restart as `plugin:demo.hello:midnight`; disabling or uninstalling the provider falls back to `system` instead of an unstyled shell; unsafe CSS is refused at load with the reason logged and no `<style>` element injected; the comment-only sheet loads and contributes its theme, because the sanitizer only inspects CSS the browser would apply; the declared asset paints through `plugin-asset:` in the shell and in the plugin's own panel, an undeclared reference is refused with the reason logged, the declared background colours the native window on Windows/Linux and is never sent on macOS, and `cornerRadius: 0` makes only the Windows main window rectangular while the authorized theme is selected. Deselecting the theme or dropping the grant restores the host background and 4 DIP Windows corners; a radius above 24 rejects without changing the window. The whole shell follows the theme, including the work-panel column, its header, and the browser/file viewer strips, all of which read `--ds-bg-dock` / `--ds-bg-dock-raised` rather than a literal.- **Specs linked**: `07-plugins/02-plugin-manifest-schema.md`, `07-plugins/04-plugin-security.md` §3.1, `04-ux/07-ui-design-system.md`, D175- **Acceptance**: G (theme contribution) + Security-- **Status**: Unit-covered (`plugin-themes.test.mjs`, `theme-css` SDK tests, host-core package-relative asset/install tests); visual scenario Draft+- **Status**: Unit-covered (`plugin-themes.test.mjs`, `theme-css` SDK tests, host-core package-relative asset/install tests). `test:e2e:window-controls` selects an authorized test plugin theme with `cornerRadius: 0` and returns to a built-in theme, verifying the native shape follows both choices. The broader asset visual scenario remains Draft.#### E2E-PLUGIN-runtime-theme-apis@@ -3739,7 +3739,7 @@ identify the platform validation still needed.and native bounds while opening, repeating the same open action, resizing thepanel, collapsing, reopening, and closing the final resource. Repeat collapseon Windows while watching the entire frameless window. 9) With the panel open,- resize the application from each native edge and confirm only the application+ resize the application from each edge and confirm only the applicationbounds change; the panel remains at its renderer-committed width. Resize fromthe left edge and repeat after toggling the sidebar. 10) Open, resize, andcollapse on a small work area, then repeat while maximized and fullscreen. 11)@@ -11272,10 +11272,11 @@ This test plan spec is accepted when:adoption, previous-display replan regression, work-area clamping); thetwo-display desktop journey and the relaunch/hotplug legs are pending-#### E2E-167: Native edge resize stays smooth and persists the settled bounds+#### E2E-167: Window edge resize stays smooth and persists the settled bounds- **Preconditions**: PI-Desktop is open in a normal, non-maximized window on- macOS, Windows, or Linux. Run the case with the work panel closed and once+ macOS, Windows, or Linux. On Windows, the left, bottom, and right rim must+ have no visible native border. Run the case with the work panel closed and oncewith it open at a committed width.- **Steps**:1. Drag each reachable window edge and one corner slowly, including a brief@@ -11287,20 +11288,37 @@ This test plan spec is accepted when:native bounds stay fixed. Repeat below the panel minimum and above itsmaximum, then verify the target follows the live budget (`client width - 360px - expanded sidebar`) instead of a fixed cap.4. Close and relaunch the app after the resize settles.-- **Expected**: Native edge and corner hit regions remain available in frameless+ 5. On Windows, start an edge gesture, press Escape, and verify original bounds+ return. Release the pointer outside the original window bounds, then+ maximize and enter fullscreen; native hit regions must not block+ window controls or content in those states.+ 6. On Windows, inspect the default 4 DIP corner cutouts before and after+ resizing. Apply an authorized theme with `cornerRadius: 0`, then return to+ a built-in theme. Reject an out-of-range radius without changing the shape.+- **Expected**: Edge and corner hit regions remain available in framelesschrome, the minimum size remains 1040×700, and the recovery watchdog does notcompete with a slow resize stream. The renderer-owned divider updates thebounded panel target without changing native bounds; the last settled window- bounds and the committed panel width reopen after relaunch. No temporary+ bounds and the committed panel width reopen after relaunch. Windows uses+ Electron's frameless native hit regions without the thick-frame rim; no left, bottom,+ or right native rim is visible. No temporarywork-panel reservation width is persisted or restored.+ The four normal-window corners have no painted or interactive pixels outside+ the active radius; the default is 4 DIP, an authorized theme may choose 0..24+ DIP, and maximized/fullscreen windows are rectangular.- **Specs linked**: `03-runtime/01-ipc-protocol.md`,`04-ux/01-ui-ia.md`, `04-ux/07-ui-design-system.md`,`04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`,ADR 0029 / ADR 0151- **Acceptance**: A (app shell), F (persistence), Quality- **Milestone**: M6+-- **Status**: Unit/source-contract covered; native desktop edge/corner journey- remains pending+- **Status**: `test:e2e:window-controls` covers corner cutouts, theme radius+ changes, fullscreen, maximize, and controls in an isolated profile.+ `test:e2e:window-resize-native` adds physical Windows left/right/bottom/corner+ drags and the 1040×700 minimum; run it on a dedicated interactive desktop,+ since another app can take foreground or pointer input during the gesture.+ Relaunch persistence remains for native qualification; macOS/Linux native+ edge behavior is unchanged.#### E2E-168: Expanded sidebar width follows an anchored resize gesturediff --git a/docs/spec/07-plugins/02-plugin-manifest-schema.md b/docs/spec/07-plugins/02-plugin-manifest-schema.mdindex a57370705..706f229fa 100644--- a/docs/spec/07-plugins/02-plugin-manifest-schema.md+++ b/docs/spec/07-plugins/02-plugin-manifest-schema.md@@ -149,7 +149,7 @@ type PluginContributes = {settings?: PluginSettingContrib[];themes?: PluginThemeContrib[];scenicThemes?: PluginScenicThemesContrib;- windowAppearance?: PluginWindowAppearanceContrib; // native window background; needs `ui.window.appearance`+ windowAppearance?: PluginWindowAppearanceContrib; // native window background and Windows corner radius; needs `ui.window.appearance`mcpServers?: PluginMcpServerContrib[];services?: PluginServiceContrib[];bus?: PluginBusContrib;@@ -236,8 +236,14 @@ type PluginScenicThemesContrib = {type PluginWindowAppearanceContrib = {backgroundColor?: { light?: string; dark?: string }; // #rrggbb | #rrggbbaa+ cornerRadius?: number; // integer 0..24 DIP, Windows main window only; default 4};+`cornerRadius` belongs to the contributing plugin and applies while any of its+declared themes is selected. It does not change macOS/Linux native corners.+Removing the theme or its `ui.window.appearance` grant restores the Windows+main-window default of 4 DIP. Invalid or fractional values reject the manifest.+type PluginSkillContrib = {id?: string; // defaults to the file name without its extensionpath: string; // relative path to the skill documentdiff --git a/docs/spec/07-plugins/04-plugin-security.md b/docs/spec/07-plugins/04-plugin-security.mdindex 702dd09e5..4301e6915 100644--- a/docs/spec/07-plugins/04-plugin-security.md+++ b/docs/spec/07-plugins/04-plugin-security.md@@ -111,11 +111,13 @@ before it is ever sent to the UI:the registration is revoked when the plugin unloads. `pi.themes.upsert` mayregister the same kind of path at runtime. An unregistered reference is refused,and the raw path never reaches the renderer-- `contributes.windowAppearance` (`#rrggbb` / `#rrggbbaa`) requires+- `contributes.windowAppearance` (`#rrggbb` / `#rrggbbaa` background and an+ integer `cornerRadius` of 0..24 DIP) requires`ui.window.appearance` and applies only while one of that plugin's themes isthe selected one; leaving the theme restores the host background, because the- colour is derived from the live catalog rather than remembered. macOS keeps- `vibrancy` and is never sent one+ appearance is derived from the live catalog rather than remembered. macOS+ keeps `vibrancy` and its native corner behavior; Linux retains native corner+ behavior; Windows defaults to 4 DIP- The CSS is read from disk at load time and delivered whole over IPC; therenderer injects it into a single dedicated `<style>` element appended afterthe app's own stylesheets, so it can override tokens but never inject markupdiff --git a/docs/spec/07-plugins/13-plugin-permissions-matrix.md b/docs/spec/07-plugins/13-plugin-permissions-matrix.mdindex cc2ee0ac9..61abb54a6 100644--- a/docs/spec/07-plugins/13-plugin-permissions-matrix.md+++ b/docs/spec/07-plugins/13-plugin-permissions-matrix.md@@ -11,7 +11,7 @@ Provide a permission–capability–risk–default-policy reference table for re| `ui.panel` | low | Open the plugin panel | Granted at install | Needed by almost all UI plugins || `ui.view` | low | `contributes.views` are listed in the work panel and may be opened | Granted at install | Same isolation as a panel window: sandboxed page, per-plugin partition, `net.domains` egress. Filtered by activation scope || `ui.theme` | low | `contributes.themes` CSS is loaded and offered in Settings; runtime `pi.themes.upsert` / `remove` / `list` and `pi.app.setTheme` (ADR 0260) | Granted at install | CSS is sanitized by the host; it cannot script. Declared `assets` are served over the host's read-only `plugin-asset:` scheme. `setTheme` may only select a built-in preference or a currently registered plugin theme. There is no per-plugin theme count cap |-| `ui.window.appearance` | low | `contributes.windowAppearance` sets the native window background while one of the plugin's themes is selected | Granted at install | `#rrggbb` / `#rrggbbaa` only; applied per resolved palette and back to the host default once the theme is gone. macOS keeps vibrancy |+| `ui.window.appearance` | low | `contributes.windowAppearance` sets the native window background and Windows main-window corner radius while one of the plugin's themes is selected | Granted at install | `#rrggbb` / `#rrggbbaa` background and integer `cornerRadius` 0..24 DIP; restores host background and 4 DIP radius when the theme is gone. macOS keeps vibrancy and native corners || `clipboard.read` | medium | `clipboard.readText`, `clipboard.getHistory` | Confirm on first use | May read sensitive information and retained clipboard history || `clipboard.write` | medium | `clipboard.writeText` | Confirm on first use | Prevents clipboard pollution || `notify` | low | `ui.notify`, `ui.getNotificationPermission`, `ui.requestNotificationPermission`, `ui.showNativeNotification` | Can be granted by default | Native delivery is OS-controlled; avoid notification-spam abuse |@@ -136,7 +136,7 @@ so "Modify the files it lists" is followed by the list.| `shell.openExternal` | Open external links | 打开外部链接 || `ui.theme` | Provide a theme | 提供主题 || `ui.settings` | Add a sandboxed Settings entry in Extensions | 在“扩展”中添加沙盒设置项 |-| `ui.window.appearance` | Set the window background | 设置窗口背景 |+| `ui.window.appearance` | Customize window appearance | 自定义窗口外观 || `mcp.server.local` | Run a local MCP server | 运行本地 MCP 服务 || `mcp.server.remote` | Reach a remote MCP server | 连接远端 MCP 服务 || `background.service` | Keep a background service running | 保持后台服务运行 |diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 87c38ab62..852292757 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -7299,3 +7299,16 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.covers native DMG and ZIP archive inspection.- D634 amends D457 / ADR 0296 and supersedes the macOS distribution provisionsof ADR 0232 / ADR 0204. See ADR 0309.++## 2026-09-28 — Remove the Windows frameless resize rim (D635)++- The Windows main window disables Electron's thick frame, removing the native+ left, bottom, and right rim. Electron 43.6 retains its frameless native edge+ and corner hit test, so no renderer resize path or geometry IPC is added.+ macOS/Linux window behavior and work-panel resize ownership remain unchanged.+ The Windows main window defaults to a native+ 4 DIP shape whose corner pixels and hit targets are absent; an authorized+ plugin theme may choose an integer radius from 0 to 24 DIP, reverting to 4+ when the theme is withdrawn. The removed thick frame leaves no native shadow+ control for themes; external shadow needs a separate window-geometry decision.+ See ADR 0310 and E2E-167.diff --git a/package.json b/package.jsonindex b39f75079..4309259de 100644--- a/package.json+++ b/package.json@@ -45,6 +45,7 @@"test:e2e:config-sync": "node scripts/e2e-config-sync-multidevice.mjs","test:e2e:layout": "node scripts/e2e-three-column-layout.mjs","test:e2e:window-controls": "node scripts/e2e-window-controls.mjs",+ "test:e2e:window-resize-native": "node scripts/e2e-window-controls.mjs --native-edge-drag","test:e2e:work-panel-reorder": "node scripts/e2e-work-panel-reorder.mjs","test:e2e:supervision": "node scripts/e2e-supervision.mjs","test:e2e:subagents": "node scripts/e2e-subagents.mjs",diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.tsindex 1e92b375d..bef3d7732 100644--- a/packages/i18n/src/locales/de/index.ts+++ b/packages/i18n/src/locales/de/index.ts@@ -2108,7 +2108,7 @@ sklm: {"net.fetch": "Das Netzwerk nutzen","shell.openExternal": "Externe Links öffnen","ui.theme": "Geben Sie ein Thema an",- "ui.window.appearance": "Fensterhintergrund festlegen",+ "ui.window.appearance": "Fensterdarstellung anpassen","mcp.server.local": "Einen lokalen MCP-Server ausführen","mcp.server.remote": "Einen Remote-MCP-Server erreichen","background.service": "Einen Hintergrunddienst laufen lassen",@@ -2146,7 +2146,7 @@ sklm: {"net.fetch": "Kann ausgehende Netzwerkanfragen stellen.","shell.openExternal": "Kann Links in Ihrem Standardbrowser öffnen.","ui.theme": "Fügt ein Thema hinzu, das Sie in den Einstellungen auswählen können; nur Styling, keine Daten.",- "ui.window.appearance": "Passt den nativen Fensterhintergrund an das Theme dieses Plugins an. Nur Styling, keine Daten.",+ "ui.window.appearance": "Passt den nativen Fensterhintergrund und die Windows-Ecken an das Theme dieses Plugins an. Nur Styling, keine Daten.","mcp.server.local": "Startet ein Programm auf diesem Computer, um zusätzliche Agent-Tools bereitzustellen.","mcp.server.remote": "Sendet Toolaufrufe an einen Remote-MCP-Endpunkt, den das Plugin deklariert hat. Der Endpunkt verwendet möglicherweise unverschlüsseltes HTTP.","background.service": "Hält einen Worker am Laufen, während das Plugin aktiviert ist.",diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.tsindex 5f8ac0bd1..75cc8b7fa 100644--- a/packages/i18n/src/locales/en/index.ts+++ b/packages/i18n/src/locales/en/index.ts@@ -2127,7 +2127,7 @@ importConfirm: "Imported extensions run inside the agent process with the same a"net.fetch": "Use the network","shell.openExternal": "Open external links","ui.theme": "Provide a theme",- "ui.window.appearance": "Set the window background",+ "ui.window.appearance": "Customize window appearance","mcp.server.local": "Run a local MCP server","mcp.server.remote": "Reach a remote MCP server","background.service": "Keep a background service running",@@ -2177,7 +2177,7 @@ importConfirm: "Imported extensions run inside the agent process with the same a"net.fetch": "Can make outbound network requests.","shell.openExternal": "Can open links in your default browser.","ui.theme": "Adds a theme you can pick in Settings; only styling, no data.",- "ui.window.appearance": "Paints the native window background to match this plugin's theme. Only styling, no data.",+ "ui.window.appearance": "Matches the native window background and Windows corner radius to this plugin's theme. Styling only, no data.","mcp.server.local": "Starts a program on this computer to serve extra agent tools.","mcp.server.remote":"Sends tool calls to a remote MCP endpoint the plugin declared. The endpoint may use unencrypted HTTP.",diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.tsindex d063e0f50..49725260b 100644--- a/packages/i18n/src/locales/es/index.ts+++ b/packages/i18n/src/locales/es/index.ts@@ -2108,7 +2108,7 @@ sklm: {"net.fetch": "Usar la red","shell.openExternal": "Abrir enlaces externos","ui.theme": "Proporcionar un tema",- "ui.window.appearance": "Definir el fondo de la ventana",+ "ui.window.appearance": "Personalizar la apariencia de la ventana","mcp.server.local": "Ejecutar un servidor MCP local","mcp.server.remote": "Llegar a un servidor MCP remoto","background.service": "Mantener un servicio en segundo plano en ejecución",@@ -2146,7 +2146,7 @@ sklm: {"net.fetch": "Puede realizar solicitudes de red salientes.","shell.openExternal": "Puede abrir enlaces en su navegador predeterminado.","ui.theme": "Agrega un tema que puedes elegir en Configuración; solo estilo, sin datos.",- "ui.window.appearance": "Ajusta el fondo nativo de la ventana al tema de este plugin. Solo estilo, sin datos.",+ "ui.window.appearance": "Ajusta el fondo nativo de la ventana y las esquinas en Windows al tema de este plugin. Solo estilo, sin datos.","mcp.server.local": "Inicia un programa en esta computadora para ofrecer herramientas adicionales al agente.","mcp.server.remote": "Envía llamadas a herramientas a un punto final MCP remoto que el complemento declaró. El punto final puede utilizar HTTP sin cifrar.","background.service": "Mantiene a un trabajador en ejecución mientras el complemento está habilitado.",diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.tsindex efc15d0c3..ce3d028d9 100644--- a/packages/i18n/src/locales/fr/index.ts+++ b/packages/i18n/src/locales/fr/index.ts@@ -2108,7 +2108,7 @@ sklm: {"net.fetch": "Utiliser le réseau","shell.openExternal": "Ouvrir des liens externes","ui.theme": "Fournir un thème",- "ui.window.appearance": "Définir l’arrière-plan de la fenêtre",+ "ui.window.appearance": "Personnaliser l’apparence de la fenêtre","mcp.server.local": "Exécuter un serveur MCP local","mcp.server.remote": "Atteindre un serveur MCP distant","background.service": "Maintenir un service en arrière-plan en cours d'exécution",@@ -2146,7 +2146,7 @@ sklm: {"net.fetch": "Peut effectuer des requêtes réseau sortantes.","shell.openExternal": "Peut ouvrir des liens dans votre navigateur par défaut.","ui.theme": "Ajoute un thème que vous pouvez choisir dans Paramètres ; seulement du style, pas de données.",- "ui.window.appearance": "Adapte l’arrière-plan natif de la fenêtre au thème de ce plugin. Seulement du style, pas de données.",+ "ui.window.appearance": "Adapte l’arrière-plan natif et les coins de la fenêtre sous Windows au thème de ce plugin. Style uniquement, aucune donnée.","mcp.server.local": "Démarre un programme sur cet ordinateur pour fournir des outils d'agent supplémentaires.","mcp.server.remote": "Envoie des appels d'outil à un point de terminaison MCP distant déclaré par le plugin. Le point de terminaison peut utiliser du HTTP non chiffré.","background.service": "Maintient un travailleur en cours d'exécution pendant que le plugin est activé.",diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.tsindex 4b2af56ea..0bb01990e 100644--- a/packages/i18n/src/locales/ko/index.ts+++ b/packages/i18n/src/locales/ko/index.ts@@ -2124,7 +2124,7 @@ importConfirm: "가져온 확장은 에이전트 프로세스 안에서 에이"net.fetch": "네트워크 사용","shell.openExternal": "외부 링크 열기","ui.theme": "테마 제공",- "ui.window.appearance": "창 배경 설정",+ "ui.window.appearance": "창 모양 사용자 지정","mcp.server.local": "로컬 MCP 서버 실행","mcp.server.remote": "원격 MCP 서버에 연결","background.service": "백그라운드 서비스 계속 실행",@@ -2172,7 +2172,7 @@ importConfirm: "가져온 확장은 에이전트 프로세스 안에서 에이"net.fetch": "외부 네트워크 요청을 보낼 수 있습니다.","shell.openExternal": "기본 브라우저에서 링크를 열 수 있습니다.","ui.theme": "설정에서 선택할 수 있는 테마를 추가합니다. 스타일만 변경하며 데이터에는 접근하지 않습니다.",- "ui.window.appearance": "네이티브 창 배경을 이 플러그인의 테마에 맞춥니다. 스타일만 변경하며 데이터에는 접근하지 않습니다.",+ "ui.window.appearance": "네이티브 창 배경과 Windows 창 모서리를 이 플러그인의 테마에 맞춥니다. 스타일만 변경하며 데이터에는 접근하지 않습니다.","mcp.server.local": "이 컴퓨터에서 프로그램을 시작해 추가 에이전트 도구를 제공합니다.","mcp.server.remote":"플러그인이 선언한 원격 MCP 엔드포인트로 도구 호출을 보냅니다. 엔드포인트가 암호화되지 않은 HTTP를 사용할 수 있습니다.",diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.tsindex 34e3cb1c1..fc1f2d831 100644--- a/packages/i18n/src/locales/pt-BR/index.ts+++ b/packages/i18n/src/locales/pt-BR/index.ts@@ -2098,7 +2098,7 @@ export const ptBR = {"net.fetch": "Pode fazer solicitações de rede externas.","shell.openExternal": "Pode abrir links no seu navegador padrão.","ui.theme": "Adiciona um tema que você pode escolher em Configurações; apenas estilo, sem acesso a dados.",- "ui.window.appearance": "Ajusta o fundo da janela nativa para coincidir com o tema deste plugin. Apenas estilo, sem dados.",+ "ui.window.appearance": "Ajusta o fundo da janela nativa e os cantos no Windows ao tema deste plugin. Apenas estilo, sem dados.","mcp.server.local": "Inicia um programa neste computador para fornecer ferramentas adicionais ao agente.","mcp.server.remote": "Envia chamadas de ferramentas a um endpoint MCP remoto declarado pelo plugin. O endpoint pode usar HTTP sem criptografia.","background.service": "Mantém um processo auxiliar em execução enquanto o plugin está ativado.",diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.tsindex bc9551770..c03d3e755 100644--- a/packages/i18n/src/locales/tr/index.ts+++ b/packages/i18n/src/locales/tr/index.ts@@ -2114,7 +2114,7 @@ importConfirm: "İçe aktarılan uzantılar ajan sürecinde, ajanın kendi araç"net.fetch": "Ağı kullan","shell.openExternal": "Dış bağlantılar aç","ui.theme": "Tema sağla",- "ui.window.appearance": "Pencere arka planını ayarla",+ "ui.window.appearance": "Pencere görünümünü özelleştir","mcp.server.local": "Yerel bir MCP sunucusu çalıştır","mcp.server.remote": "Uzak bir MCP sunucusuna ulaş","background.service": "Arka plan servisini çalışır tut",@@ -2162,7 +2162,7 @@ importConfirm: "İçe aktarılan uzantılar ajan sürecinde, ajanın kendi araç"net.fetch": "Dışarıya ağ istekleri yapabilir.","shell.openExternal": "Varsayılan tarayıcınızda bağlantı açabilir.","ui.theme": "Ayarlar’dan seçebileceğiniz bir tema ekler; yalnızca stil, veri yok.",- "ui.window.appearance": "Yerel pencere arka planını bu eklentinin temasına uydurur. Yalnızca stil, veri yok.",+ "ui.window.appearance": "Yerel pencere arka planını ve Windows köşelerini bu eklentinin temasına uyarlar. Yalnızca stil, veri yok.","mcp.server.local": "Ek ajan araçları sunmak için bu bilgisayarda bir program başlatır.","mcp.server.remote":"Eklentinin bildirdiği uzak bir MCP uç noktasına araç çağrıları gönderir. Uç nokta şifresiz HTTP kullanabilir.",diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.tsindex 1dda003f0..742ccc002 100644--- a/packages/i18n/src/locales/zh-CN/index.ts+++ b/packages/i18n/src/locales/zh-CN/index.ts@@ -2093,7 +2093,7 @@ sklm: {"net.fetch": "访问网络","shell.openExternal": "打开外部链接","ui.theme": "提供主题",- "ui.window.appearance": "设置窗口背景",+ "ui.window.appearance": "自定义窗口外观","mcp.server.local": "运行本地 MCP 服务","mcp.server.remote": "连接远端 MCP 服务","background.service": "保持后台服务运行",@@ -2133,7 +2133,7 @@ sklm: {"net.fetch": "可发起出站网络请求。","shell.openExternal": "可在默认浏览器打开链接。","ui.theme": "在设置中新增一个可选主题,只影响外观,不涉及数据。",- "ui.window.appearance": "让原生窗口背景与该插件主题一致。只影响外观,不涉及数据。",+ "ui.window.appearance": "让原生窗口背景和 Windows 圆角与该插件主题一致。只影响外观,不涉及数据。","mcp.server.local": "在本机启动一个程序,为智能体提供额外工具。","mcp.server.remote": "把工具调用发送到插件声明的远端 MCP 端点,端点可能使用未加密的 HTTP。","background.service": "插件启用期间保持一个后台工作进程运行。",diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.tsindex 467a722a6..7c6c44283 100644--- a/packages/i18n/src/locales/zh-TW/index.ts+++ b/packages/i18n/src/locales/zh-TW/index.ts@@ -2093,7 +2093,7 @@ sklm: {"net.fetch": "訪問網路","shell.openExternal": "開啟外部連結","ui.theme": "提供主題",- "ui.window.appearance": "設定視窗背景",+ "ui.window.appearance": "自訂視窗外觀","mcp.server.local": "執行本地 MCP 服務","mcp.server.remote": "連線遠端 MCP 服務","background.service": "保持後臺服務執行",@@ -2132,7 +2132,7 @@ sklm: {"net.fetch": "可發起出站網路請求。","shell.openExternal": "可在預設瀏覽器開啟連結。","ui.theme": "在設定中新增一個可選主題,隻影響外觀,不涉及資料。",- "ui.window.appearance": "讓原生視窗背景與此外掛主題一致。隻影響外觀,不涉及資料。",+ "ui.window.appearance": "讓原生視窗背景與 Windows 圓角符合此外掛主題。僅影響外觀,不涉及資料。","mcp.server.local": "在本機啟動一個程式,為智慧體提供額外工具。","mcp.server.remote": "把工具呼叫傳送到外掛宣告的遠端 MCP 端點,端點可能使用未加密的 HTTP。","background.service": "外掛啟用期間保持一個後臺工作程序執行。",diff --git a/packages/plugin-sdk/src/index.test.ts b/packages/plugin-sdk/src/index.test.tsindex c1bcc2607..f0330bd74 100644--- a/packages/plugin-sdk/src/index.test.ts+++ b/packages/plugin-sdk/src/index.test.ts@@ -499,6 +499,16 @@ describe("contributed theme assets and window appearance", () => {}),).toBeUndefined();expect(validateContributions({ windowAppearance: {} })).toBeUndefined();+ expect(validateContributions({ windowAppearance: { cornerRadius: 4 } })).toBeUndefined();+ });++ it("bounds the native window corner radius", () => {+ for (const cornerRadius of [-1, 1.5, 25, "4"]) {+ expect(validateContributions({ windowAppearance: { cornerRadius } } as never))+ .toMatch(/cornerRadius/);+ }+ expect(validateContributions({ windowAppearance: { cornerRadius: 0 } })).toBeUndefined();+ expect(validateContributions({ windowAppearance: { cornerRadius: 24 } })).toBeUndefined();});it("rejects a window background that is not #rrggbb or #rrggbbaa", () => {@@ -521,6 +531,13 @@ describe("contributed theme assets and window appearance", () => {expect(validateManifest({ ...base, permissions: ["ui.window.appearance"], contributes }).ok,).toBe(true);+ const radiusOnly = { windowAppearance: { cornerRadius: 4 } };+ expect(validateManifest({ ...base, contributes: radiusOnly }).error).toMatch(+ /ui\.window\.appearance permission/,+ );+ expect(+ validateManifest({ ...base, permissions: ["ui.window.appearance"], contributes: radiusOnly }).ok,+ ).toBe(true);});});diff --git a/packages/plugin-sdk/src/index.ts b/packages/plugin-sdk/src/index.tsindex fd172445d..450591454 100644--- a/packages/plugin-sdk/src/index.ts+++ b/packages/plugin-sdk/src/index.ts@@ -535,8 +535,12 @@ export type PluginProviderContrib = {export type PluginWindowAppearanceContrib = {/** `#rrggbb` or `#rrggbbaa`, applied per resolved palette. */backgroundColor?: { light?: string; dark?: string };+ /** Windows main-window radius in DIP. Applies while a contributed theme is selected. */+ cornerRadius?: number;};+export const MAX_WINDOW_CORNER_RADIUS = 24;+/** The only colour form a contributed window background may take. */export const WINDOW_BACKGROUND_COLOR_PATTERN = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/;@@ -1802,6 +1806,14 @@ export function validateContributions(return "contributes.windowAppearance must be an object";}const backgroundColor = windowAppearance.backgroundColor;+ const cornerRadius = windowAppearance.cornerRadius;+ if (+ cornerRadius !== undefined &&+ (typeof cornerRadius !== "number" || !Number.isInteger(cornerRadius) ||+ cornerRadius < 0 || cornerRadius > MAX_WINDOW_CORNER_RADIUS)+ ) {+ return `contributes.windowAppearance.cornerRadius must be an integer from 0 to ${MAX_WINDOW_CORNER_RADIUS}`;+ }if (backgroundColor !== undefined) {if (typeof backgroundColor !== "object" ||diff --git a/packages/shared/src/types/plugins.ts b/packages/shared/src/types/plugins.tsindex 134cd4c6e..f877223d5 100644--- a/packages/shared/src/types/plugins.ts+++ b/packages/shared/src/types/plugins.ts@@ -277,6 +277,8 @@ export type PluginTheme = {* and holds `ui.window.appearance` (ADR 0248).*/windowBackground?: { light?: string; dark?: string };+ /** Validated `contributes.windowAppearance.cornerRadius`, in DIP. */+ windowCornerRadius?: number;};export type PluginServiceState = "starting" | "running" | "stopped" | "failed";diff --git a/scripts/e2e-window-controls.mjs b/scripts/e2e-window-controls.mjsindex 8378c9ea1..26a0e8cbd 100644--- a/scripts/e2e-window-controls.mjs+++ b/scripts/e2e-window-controls.mjs@@ -4,7 +4,9 @@* Platform CSS emulation is explicitly not native macOS/Linux qualification.*/import assert from "node:assert/strict";-import { spawn } from "node:child_process";+import { execFile, spawn } from "node:child_process";+import { promisify } from "node:util";+import { fileURLToPath } from "node:url";import { once } from "node:events";import { mkdtemp, rm, writeFile, mkdir } from "node:fs/promises";import { tmpdir } from "node:os";@@ -14,6 +16,8 @@ import { assertDesktopBuild, repositoryRoot, resolveElectronBinary } from "./e2eimport { Host, resolveHostBinary } from "./e2e/host.mjs";const root = repositoryRoot();+const runNativeEdgeDrag = process.argv.includes("--native-edge-drag");+const execFileAsync = promisify(execFile);const { appDir } = assertDesktopBuild(root);const { electronBinary } = resolveElectronBinary(root);const binary = resolveHostBinary();@@ -100,7 +104,103 @@ async function checkControls(label) {assert.ok(ok, label);}+async function checkWindowsRoundedCorners(label, rounded = true) {+ if (process.platform !== "win32") return;+ let corners;+ let probeError;+ await evaluate(`window.piDesktop.invoke('pi-desktop/menu/nativeAction', { action: 'restoreMainWindow' })`);+ await waitFor(() => evaluate(`document.hasFocus()`), `${label} window focused`);+ try {+ await waitFor(async () => {+ try {+ const { stdout } = await execFileAsync("pwsh.exe", [+ "-NoLogo", "-NoProfile", "-File",+ fileURLToPath(new URL("./e2e/probe-window-corners.ps1", import.meta.url)),+ String(child.pid),+ ]);+ corners = JSON.parse(stdout.trim());+ probeError = undefined;+ return corners.topLeftCutout === rounded && corners.bottomRightCutout === rounded &&+ corners.innerCornerOwned === true;+ } catch (error) {+ probeError = String(error);+ return false;+ }+ }, label);+ } catch (error) {+ throw new Error(`${label}: ${JSON.stringify(corners)}; ${probeError ?? String(error)}`);+ }+ assert.deepEqual(corners, {+ topLeftCutout: rounded,+ bottomRightCutout: rounded,+ innerCornerOwned: true,+ thickFrameStyle: false,+ }, label);+ console.log(`PASS ${label}: ${JSON.stringify(corners)}`);+}++async function checkNativeWindowResizes(edges) {+ if (process.platform !== "win32") return;+ if (!runNativeEdgeDrag) {+ console.log("SKIP native edge drag: run with --native-edge-drag on an interactive Windows desktop");+ return;+ }+ for (const edge of edges) {+ await evaluate(`window.piDesktop.invoke('pi-desktop/menu/nativeAction', { action: 'restoreMainWindow' })`);+ await waitFor(() => evaluate(`document.hasFocus()`), `${edge} drag window focused`);+ const { stdout } = await execFileAsync("pwsh.exe", [+ "-NoLogo", "-NoProfile", "-File",+ fileURLToPath(new URL("./e2e/drag-window-edge.ps1", import.meta.url)),+ String(child.pid), edge,+ ]);+ const bounds = JSON.parse(stdout.trim());+ assert.equal(bounds.restored, true, `restore after ${edge} drag: ${stdout}`);+ if (edge === "right") {+ assert.ok(Math.abs(bounds.afterWidth - bounds.beforeWidth) >= 20, `right edge: ${stdout}`);+ assert.equal(bounds.afterX, bounds.beforeX);+ assert.equal(bounds.afterHeight, bounds.beforeHeight);+ } else if (edge === "left") {+ assert.ok(Math.abs(bounds.afterWidth - bounds.beforeWidth) >= 20, `left edge: ${stdout}`);+ assert.ok(Math.abs(bounds.afterX + bounds.afterWidth - bounds.beforeX - bounds.beforeWidth) <= 2, `left anchor: ${stdout}`);+ assert.equal(bounds.afterHeight, bounds.beforeHeight);+ } else if (edge === "bottom") {+ assert.ok(Math.abs(bounds.afterHeight - bounds.beforeHeight) >= 20, `bottom edge: ${stdout}`);+ assert.equal(bounds.afterY, bounds.beforeY);+ assert.equal(bounds.afterWidth, bounds.beforeWidth);+ } else if (edge === "bottom-left") {+ // Win32 can reposition a synthetic cursor during a native corner drag.+ // Both axes must move while the opposite edges remain anchored.+ assert.ok(Math.abs(bounds.afterWidth - bounds.beforeWidth) >= 8, `corner width: ${stdout}`);+ assert.ok(Math.abs(bounds.afterHeight - bounds.beforeHeight) >= 8, `corner height: ${stdout}`);+ assert.ok(Math.abs(bounds.afterX + bounds.afterWidth - bounds.beforeX - bounds.beforeWidth) <= 2, `corner right anchor: ${stdout}`);+ assert.equal(bounds.afterY, bounds.beforeY);+ } else if (edge === "left-min") {+ assert.ok(bounds.afterWidth >= 1040 && bounds.afterWidth <= 1050, `minimum width: ${stdout}`);+ } else {+ assert.ok(bounds.afterHeight >= 700 && bounds.afterHeight <= 710, `minimum height: ${stdout}`);+ }+ console.log(`PASS native ${edge} drag: ${stdout.trim()}`);+ }+ await checkWindowsRoundedCorners("resized window corners remain transparent");+}+try {+ const radiusPluginPath = join(temp, "window-radius-plugin");+ await mkdir(radiusPluginPath, { recursive: true });+ await writeFile(join(radiusPluginPath, "manifest.json"), JSON.stringify({+ schemaVersion: 1,+ id: "demo.window-radius",+ name: "Window radius E2E",+ version: "0.1.0",+ main: "main.js",+ permissions: ["ui.theme", "ui.window.appearance"],+ contributes: {+ themes: [{ id: "square", label: "Square window", base: "dark", path: "theme.css" }],+ windowAppearance: { cornerRadius: 0 },+ },+ }));+ await writeFile(join(radiusPluginPath, "main.js"), "// E2E theme fixture.\n");+ await writeFile(join(radiusPluginPath, "theme.css"), ":root[data-theme=\"dark\"] { --ds-bg-primary: #181818; }\n");const host = new Host(binary, join(temp, "data"));let sessionId;try {@@ -112,7 +212,8 @@ try {await host.stop();}const env = { ...process.env, PI_DESKTOP_DATA_DIR: join(temp, "data"),- PI_DESKTOP_HOST_BIN: binary, PI_DESKTOP_START_MAXIMIZED: "0", ELECTRON_RENDERER_URL: "" };+ PI_DESKTOP_HOST_BIN: binary, PI_DESKTOP_START_MAXIMIZED: "0",+ PI_DESKTOP_MCP_CONTROL: "0", ELECTRON_RENDERER_URL: "" };delete env.ELECTRON_RUN_AS_NODE;child = spawn(electronBinary, [`--remote-debugging-port=${port}`, `--user-data-dir=${join(temp, "profile")}`, "."],{ cwd: appDir, env, stdio: ["ignore", "pipe", "pipe"] });@@ -142,10 +243,13 @@ try {await waitFor(() => evaluate(`document.querySelector('.app-work-panel-toggle')?.disabled === false`), "active session");await settle();await checkControls("panel closed");+ await checkWindowsRoundedCorners("normal window corners are transparent");+ await checkNativeWindowResizes(["left-min", "bottom-min"]);await click(".app-work-panel-toggle");await waitFor(() => evaluate(`!!document.querySelector('.work-panel')`), "panel opened");await settle();await checkControls("panel opened");+ await checkNativeWindowResizes(["right", "left", "bottom", "bottom-left"]);if (process.platform !== "darwin") {for (const platform of ["win32", "linux"]) {for (const theme of ["light", "dark"]) {@@ -159,6 +263,7 @@ try {}await click('[data-nav="toggle-sidebar"]');await checkControls("sidebar toggled with panel open");+ await waitFor(() => evaluate(`!!document.querySelector('.work-panel-maximize')`), "work-panel maximize action");await click(".work-panel-maximize");await waitFor(() => evaluate(`!!document.querySelector('.work-panel-maximized')`), "panel maximized");await checkControls("panel maximized");@@ -170,6 +275,15 @@ try {await waitFor(() => evaluate(`window.piDesktop.invoke('pi-desktop/menu/nativeAction', {action:'restoreMainWindow'}).then(s => s.ok && s.data.fullScreen)`), "native fullscreen");await settle();await checkControls("native fullscreen with panel open");+ if (process.platform === "win32") {+ const { stdout } = await execFileAsync("pwsh.exe", [+ "-NoLogo", "-NoProfile", "-File",+ fileURLToPath(new URL("./e2e/probe-fullscreen-taskbar.ps1", import.meta.url)),+ String(child.pid),+ ]);+ assert.equal(JSON.parse(stdout.trim()).appCoversTaskbar, true, `fullscreen covers the taskbar: ${stdout.trim()}`);+ console.log("PASS fullscreen covers the taskbar");+ }await evaluate(`window.piDesktop.invoke('pi-desktop/menu/nativeAction', {action:'toggleFullScreen'})`);await waitFor(() => evaluate(`window.piDesktop.invoke('pi-desktop/menu/nativeAction', {action:'restoreMainWindow'}).then(s => s.ok && !s.data.fullScreen)`), "leave native fullscreen");await settle();@@ -192,6 +306,46 @@ try {await click(".app-work-panel-toggle");await settle();await checkControls("panel reopened after settings");+ if (process.platform === "win32") {+ const scheme = await evaluate(`document.documentElement.dataset.theme === 'light' ? 'light' : 'dark'`);+ const setRadius = (radius) => evaluate(`window.piDesktop.invoke(+ 'pi-desktop/window/setBackgroundColor',+ { theme: ${JSON.stringify(scheme)}, cornerRadius: ${radius} }+ )`);+ assert.equal((await setRadius(0)).ok, true);+ await checkWindowsRoundedCorners("theme can request square corners", false);+ assert.equal((await setRadius(25)).ok, false, "out-of-range radius is rejected");+ await checkWindowsRoundedCorners("invalid radius leaves the current shape", false);+ assert.equal((await setRadius(4)).ok, true);+ await checkWindowsRoundedCorners("theme switch restores the 4px default");+ const loaded = await evaluate(`window.piDesktop.invoke(+ 'pi-desktop/plugin/loadDevConfirm',+ { path: ${JSON.stringify(radiusPluginPath)}, grantedPermissions: ['ui.theme', 'ui.window.appearance'] }+ )`);+ assert.equal(loaded.ok, true, "authorized theme fixture loads");+ await waitFor(() => evaluate(`window.piDesktop.invoke('pi-desktop/plugin/themes').then(+ result => result.ok && result.data.some(theme => theme.id === 'plugin:demo.window-radius:square' && theme.windowCornerRadius === 0)+ )`), "theme catalog includes the authorized radius");+ const chooseTheme = (themeId) => evaluate(`(async () => {+ const current = await window.piDesktop.invoke('pi-desktop/settings/get');+ if (!current.ok) return current;+ return window.piDesktop.invoke('pi-desktop/settings/set', { ...current.data, theme: ${JSON.stringify(themeId)} });+ })()`);+ const reloadTheme = async (themeId, label) => {+ assert.equal((await chooseTheme(themeId)).ok, true, label);+ await send("Page.reload");+ await waitFor(async () => {+ try {+ return await evaluate(`!!document.querySelector('.main-pane') && !document.querySelector('.startup-splash') &&+ document.documentElement.dataset.pluginTheme === ${JSON.stringify(themeId.startsWith("plugin:") ? themeId : undefined)}`);+ } catch { return false; }+ }, label);+ };+ await reloadTheme("plugin:demo.window-radius:square", "selected plugin theme");+ await checkWindowsRoundedCorners("selected plugin theme makes square corners", false);+ await reloadTheme("dark", "returned to built-in theme");+ await checkWindowsRoundedCorners("built-in theme restores rounded corners");+ }if (process.platform !== "darwin") {await click(".window-control-btn:first-child", false);await waitFor(() => evaluate(`document.visibilityState === 'hidden'`), "native minimize");diff --git a/scripts/e2e/drag-window-edge.ps1 b/scripts/e2e/drag-window-edge.ps1new file mode 100644index 000000000..7b0378347--- /dev/null+++ b/scripts/e2e/drag-window-edge.ps1@@ -0,0 +1,111 @@+param(+ [Parameter(Mandatory = $true)][int]$targetProcessId,+ [Parameter(Mandatory = $true)][ValidateSet('right', 'left', 'bottom', 'bottom-left', 'left-min', 'bottom-min')][string]$edge+)++$ErrorActionPreference = 'Stop'++Add-Type -TypeDefinition @'+using System;+using System.Runtime.InteropServices;++public struct NativePoint { public int X; public int Y; }+public struct NativeRect { public int Left; public int Top; public int Right; public int Bottom; }+public static class NativePointer {+ [DllImport("user32.dll")] public static extern bool GetCursorPos(out NativePoint point);+ [DllImport("user32.dll", SetLastError = true)] public static extern bool SetCursorPos(int x, int y);+ [DllImport("user32.dll")] public static extern short GetAsyncKeyState(int key);+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr window, out NativeRect rect);+ [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr window, IntPtr after, int x, int y, int width, int height, uint flags);+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr window);+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();+ [DllImport("user32.dll")] public static extern void mouse_event(uint flags, uint x, uint y, uint data, UIntPtr extra);+}+'@++$targetProcess = [System.Diagnostics.Process]::GetProcessById($targetProcessId)+$windowHandle = $targetProcess.MainWindowHandle+if ($windowHandle -eq [IntPtr]::Zero) { throw 'E2E main window is unavailable' }++$before = [NativeRect]::new()+$savedCursor = [NativePoint]::new()+if (-not [NativePointer]::GetWindowRect($windowHandle, [ref]$before)) { throw 'Cannot read E2E window bounds' }+$cursorSaved = $false+foreach ($attempt in 1..3) {+ if ([NativePointer]::GetCursorPos([ref]$savedCursor)) { $cursorSaved = $true; break }+ Start-Sleep -Milliseconds 50+}+if (-not $cursorSaved) { throw 'Cannot save pointer position' }+[void][NativePointer]::SetForegroundWindow($windowHandle)+Start-Sleep -Milliseconds 100+if ([NativePointer]::GetForegroundWindow() -ne $windowHandle) {+ throw 'E2E window could not receive foreground input'+}++$startX = [int](($before.Left + $before.Right) / 2)+$startY = [int](($before.Top + $before.Bottom) / 2)+$deltaX = 0+$deltaY = 0+switch ($edge) {+ 'right' { $startX = $before.Right - 1; $deltaX = 100 }+ 'left' { $startX = $before.Left + 1; $deltaX = 50 }+ 'left-min' { $startX = $before.Left + 1; $deltaX = 300 }+ 'bottom' { $startY = $before.Bottom - 1; $deltaY = -40 }+ 'bottom-min' { $startY = $before.Bottom - 1; $deltaY = -100 }+ 'bottom-left' {+ $startX = $before.Left + 3+ $startY = $before.Bottom - 3+ $deltaX = 30+ $deltaY = -30+ }+}+$pressed = $false+try {+ if (-not [NativePointer]::SetCursorPos($startX, $startY)) { throw 'Cannot position the E2E pointer' }+ Start-Sleep -Milliseconds 80+ [NativePointer]::mouse_event(0x0002, 0, 0, 0, [UIntPtr]::Zero)+ $pressed = $true+ Start-Sleep -Milliseconds 30+ if (([int][NativePointer]::GetAsyncKeyState(0x01) -band 0x8000) -eq 0) {+ throw 'E2E mouse down was not registered'+ }+ foreach ($step in 1..5) {+ $moved = [NativePointer]::SetCursorPos(+ [int]($startX + $deltaX * $step / 5),+ [int]($startY + $deltaY * $step / 5)+ )+ if (-not $moved) { throw 'E2E pointer movement was denied' }+ Start-Sleep -Milliseconds 50+ }+ $cursorAtRelease = [NativePoint]::new()+ if (-not [NativePointer]::GetCursorPos([ref]$cursorAtRelease)) {+ throw 'Cannot read the E2E release pointer'+ }+ if ([NativePointer]::GetForegroundWindow() -ne $windowHandle) {+ throw 'E2E window lost foreground during the drag'+ }+} finally {+ if ($pressed) { [NativePointer]::mouse_event(0x0004, 0, 0, 0, [UIntPtr]::Zero) }+ [void][NativePointer]::SetCursorPos($savedCursor.X, $savedCursor.Y)+}++Start-Sleep -Milliseconds 100+$after = [NativeRect]::new()+if (-not [NativePointer]::GetWindowRect($windowHandle, [ref]$after)) { throw 'Cannot read resized E2E window bounds' }+$restored = [NativePointer]::SetWindowPos(+ $windowHandle, [IntPtr]::Zero, $before.Left, $before.Top,+ $before.Right - $before.Left, $before.Bottom - $before.Top, 0x0014+)+@{+ restored = $restored+ beforeWidth = $before.Right - $before.Left+ afterWidth = $after.Right - $after.Left+ beforeHeight = $before.Bottom - $before.Top+ afterHeight = $after.Bottom - $after.Top+ beforeX = $before.Left+ afterX = $after.Left+ beforeY = $before.Top+ afterY = $after.Top+ cursorDeltaX = $cursorAtRelease.X - $startX+ cursorDeltaY = $cursorAtRelease.Y - $startY+} | ConvertTo-Json -Compressdiff --git a/scripts/e2e/probe-fullscreen-taskbar.ps1 b/scripts/e2e/probe-fullscreen-taskbar.ps1new file mode 100644index 000000000..590d24906--- /dev/null+++ b/scripts/e2e/probe-fullscreen-taskbar.ps1@@ -0,0 +1,47 @@+param([Parameter(Mandatory = $true)][int]$targetProcessId)++$ErrorActionPreference = 'Stop'+Add-Type -TypeDefinition @'+using System;+using System.Runtime.InteropServices;+public struct ProbePoint { public int X; public int Y; }+public struct ProbeRect { public int Left; public int Top; public int Right; public int Bottom; }+public static class WindowProbe {+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string className, string title);+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr window, out ProbeRect rect);+ [DllImport("user32.dll")] public static extern IntPtr WindowFromPoint(ProbePoint point);+ [DllImport("user32.dll")] public static extern IntPtr GetAncestor(IntPtr window, uint flags);+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr window);+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();+}+'@++$appWindow = [System.Diagnostics.Process]::GetProcessById($targetProcessId).MainWindowHandle+$taskbar = [WindowProbe]::FindWindow('Shell_TrayWnd', $null)+if ($appWindow -eq [IntPtr]::Zero -or $taskbar -eq [IntPtr]::Zero) {+ throw 'Cannot locate the E2E window or taskbar'+}+[void][WindowProbe]::SetForegroundWindow($appWindow)+Start-Sleep -Milliseconds 100+if ([WindowProbe]::GetForegroundWindow() -ne $appWindow) {+ throw 'E2E fullscreen window is not foreground'+}+$taskbarRect = [ProbeRect]::new()+if (-not [WindowProbe]::GetWindowRect($taskbar, [ref]$taskbarRect)) {+ throw 'Cannot inspect taskbar bounds'+}+$appRect = [ProbeRect]::new()+if (-not [WindowProbe]::GetWindowRect($appWindow, [ref]$appRect)) {+ throw 'Cannot inspect fullscreen window bounds'+}+$probe = [ProbePoint]::new()+$probe.X = [int](($taskbarRect.Left + $taskbarRect.Right) / 2)+$probe.Y = [int](($taskbarRect.Top + $taskbarRect.Bottom) / 2)+$hit = [WindowProbe]::GetAncestor([WindowProbe]::WindowFromPoint($probe), 2)+@{+ appCoversTaskbar = $hit -eq $appWindow+ appBounds = @($appRect.Left, $appRect.Top, $appRect.Right, $appRect.Bottom)+ taskbarBounds = @($taskbarRect.Left, $taskbarRect.Top, $taskbarRect.Right, $taskbarRect.Bottom)+ hitRoot = $hit.ToInt64()+ appWindow = $appWindow.ToInt64()+} | ConvertTo-Json -Compressdiff --git a/scripts/e2e/probe-window-corners.ps1 b/scripts/e2e/probe-window-corners.ps1new file mode 100644index 000000000..9ecde7a21--- /dev/null+++ b/scripts/e2e/probe-window-corners.ps1@@ -0,0 +1,41 @@+param([Parameter(Mandatory = $true)][int]$targetProcessId)++$ErrorActionPreference = 'Stop'+Add-Type -TypeDefinition @'+using System;+using System.Runtime.InteropServices;+public struct CornerPoint { public int X; public int Y; }+public struct CornerRect { public int Left; public int Top; public int Right; public int Bottom; }+public static class CornerProbe {+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr window, out CornerRect rect);+ [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr window, int index);+ [DllImport("user32.dll")] public static extern IntPtr WindowFromPoint(CornerPoint point);+ [DllImport("user32.dll")] public static extern IntPtr GetAncestor(IntPtr window, uint flags);+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr window);+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();+}+'@++$appWindow = [System.Diagnostics.Process]::GetProcessById($targetProcessId).MainWindowHandle+if ($appWindow -eq [IntPtr]::Zero) { throw 'E2E main window is unavailable' }+[void][CornerProbe]::SetForegroundWindow($appWindow)+Start-Sleep -Milliseconds 60+if ([CornerProbe]::GetForegroundWindow() -ne $appWindow) {+ throw 'E2E main window is not foreground'+}+$rect = [CornerRect]::new()+if (-not [CornerProbe]::GetWindowRect($appWindow, [ref]$rect)) { throw 'Cannot read E2E window bounds' }++function Test-AppAt([int]$pointX, [int]$pointY) {+ $point = [CornerPoint]::new()+ $point.X = $pointX+ $point.Y = $pointY+ return [CornerProbe]::GetAncestor([CornerProbe]::WindowFromPoint($point), 2) -eq $appWindow+}++@{+ topLeftCutout = -not (Test-AppAt $rect.Left $rect.Top)+ bottomRightCutout = -not (Test-AppAt ($rect.Right - 1) ($rect.Bottom - 1))+ innerCornerOwned = Test-AppAt ($rect.Left + 4) ($rect.Top + 4)+ thickFrameStyle = ([CornerProbe]::GetWindowLong($appWindow, -16) -band 0x00040000) -ne 0+} | ConvertTo-Json -Compress