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): match Windows corners to global radius (#1462)
Lan779e16d9c3ca
diff --git a/apps/desktop/electron/main/window-shape.ts b/apps/desktop/electron/main/window-shape.tsindex dab310b87..14c88e2d0 100644--- a/apps/desktop/electron/main/window-shape.ts+++ b/apps/desktop/electron/main/window-shape.ts@@ -2,7 +2,8 @@ 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;+/** Matches the renderer's global `--radius-md` token (12px). */+export const DEFAULT_WINDOW_CORNER_RADIUS = 12;const controllers = new WeakMap<BrowserWindow, { setRadius: (radius: number) => number }>();/** Pixel rows approximate a quarter circle without changing window bounds. */diff --git a/apps/desktop/test/window-shape.test.mjs b/apps/desktop/test/window-shape.test.mjsindex 3662b687e..47114706b 100644--- a/apps/desktop/test/window-shape.test.mjs+++ b/apps/desktop/test/window-shape.test.mjs@@ -1,14 +1,27 @@import assert from "node:assert/strict";+import { readFileSync } from "node:fs";import { EventEmitter } from "node:events";import test from "node:test";-import { installWindowShape, roundedWindowShape, setWindowCornerRadius } from "../electron/main/window-shape.ts";+import {+ DEFAULT_WINDOW_CORNER_RADIUS,+ 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 });+test("default native window radius matches the global medium radius token", () => {+ const tokens = readFileSync(new URL("../src/styles/tokens.css", import.meta.url), "utf8");+ const match = tokens.match(/^\s*--radius-md:\s*(\d+(?:\.\d+)?)px;/m);+ assert.ok(match, "the global medium radius token is defined");+ assert.equal(DEFAULT_WINDOW_CORNER_RADIUS, Number(match[1]));+});++test("global medium-radius shape cuts only the outer corner pixels", () => {+ const rects = roundedWindowShape(100, 80, DEFAULT_WINDOW_CORNER_RADIUS);+ assert.deepEqual(rects[0], { x: 9, y: 0, width: 82, height: 1 });+ assert.deepEqual(rects[1], { x: 9, y: 79, width: 82, height: 1 });+ assert.deepEqual(rects.at(-1), { x: 0, y: 12, width: 100, height: 56 });assert.deepEqual(roundedWindowShape(100, 80, 0), []);});@@ -24,22 +37,22 @@ test("shape follows resize and becomes rectangular in maximized or fullscreen stwindow.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 });+ assert.deepEqual(lastShape[0], { x: 9, y: 0, width: 82, height: 1 });bounds = { ...bounds, width: 120 };window.emit("resize");- assert.equal(lastShape[0].width, 116);+ assert.equal(lastShape[0].width, 102);maximized = true;window.emit("maximize");assert.deepEqual(lastShape, []);maximized = false;window.emit("unmaximize");- assert.equal(lastShape[0].width, 116);+ assert.equal(lastShape[0].width, 102);setWindowFullScreen(window, true, true);assert.deepEqual(lastShape, []);setWindowFullScreen(window, false, true);- assert.equal(lastShape[0].width, 116);+ assert.equal(lastShape[0].width, 102);assert.equal(shape.setRadius(100), 24);- assert.equal(lastShape[0].width < 116, true);+ assert.equal(lastShape[0].width < 102, true);assert.equal(setWindowCornerRadius(window, 0), 0);assert.deepEqual(lastShape, []);assert.equal(setWindowCornerRadius(window, 4), 4);diff --git a/docs/adr/0317-windows-borderless-window-resize.md b/docs/adr/0317-windows-borderless-window-resize.mdindex 51bf9441d..01e22c45b 100644--- a/docs/adr/0317-windows-borderless-window-resize.md+++ b/docs/adr/0317-windows-borderless-window-resize.md@@ -31,14 +31,16 @@ Electron's `thickFrame: false` fullscreen path changes display bounds withoutsetting the value returned by `isFullScreen()`. Main tracks this fallback sofullscreen toggles, renderer events, and persisted normal bounds remain correct.-Apply a native 4 DIP rounded shape to the Windows main window. Electron's+Apply the global `--radius-md` shape (12 DIP) to the Windows main window.+The previous 4 DIP cutout was too small to read as a rounded corner and did not+match the shared design scale. 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 backgroundcolour remains theme-owned inside the window. Main reapplies the shape onresize, and makes it rectangular while maximized or fullscreen. A plugin with`ui.window.appearance` may declare an integer `cornerRadius` from 0 to 24 DIPalongside its background colours. The selected theme supplies it through the-existing window-appearance IPC; removing the theme restores 4 DIP. Main validates+existing window-appearance IPC; removing the theme restores 12 DIP. Main validatesthe value and the calling renderer before changing the native shape.## Alternativesdiff --git a/docs/spec/03-runtime/01-ipc-protocol.md b/docs/spec/03-runtime/01-ipc-protocol.mdindex 36eadf78a..a1f97b469 100644--- a/docs/spec/03-runtime/01-ipc-protocol.md+++ b/docs/spec/03-runtime/01-ipc-protocol.md@@ -1974,8 +1974,9 @@ 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. Itsoptional `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.+Windows main-window default of 12 DIP, matching the global `--radius-md` token.+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,diff --git a/docs/spec/04-ux/07-ui-design-system.md b/docs/spec/04-ux/07-ui-design-system.mdindex b9e065136..be2eecf48 100644--- a/docs/spec/04-ux/07-ui-design-system.md+++ b/docs/spec/04-ux/07-ui-design-system.md@@ -1121,11 +1121,12 @@ header-height background behind the excluded lane without covering its controls.- All platforms retain native edge/corner resizing. On Windows the main windowdisables the frameless `WS_THICKFRAME` rim while Electron 43.6's framelesshit 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+ the left, right, or bottom. The Windows main window uses the global+ `--radius-md` token (12 DIP) as its default rounded hit/draw shape: pixels+ outside its corners have no fill or mouse target. A selectedplugin 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+ from 0 through 24 DIP; removing that theme restores the 12 DIP global+ default. The shape becomesrectangular while maximized or fullscreen and follows every resize. Nativewindow background colors remain theme-owned inside the shape. Electron's borderlessfullscreen fallback fills the display without reporting `isFullScreen()`;diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 2226f85d5..76a5df735 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -3419,7 +3419,7 @@ window; opening a normal panel afterward must still work.- **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 `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.+- **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 the global 12 DIP `--radius-md` 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). `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.@@ -12081,7 +12081,8 @@ This test plan spec is accepted when:return. Release the pointer outside the original window bounds, thenmaximize and enter fullscreen; native hit regions must not blockwindow controls or content in those states.- 6. On Windows, inspect the default 4 DIP corner cutouts before and after+ 6. On Windows, inspect the default 12 DIP corner cutouts, matching the global+ `--radius-md` token, before and afterresizing. Apply an authorized theme with `cornerRadius: 0`, then return toa built-in theme. Reject an out-of-range radius without changing the shape.- **Expected**: Native edge and corner hit regions remain available in frameless@@ -12094,12 +12095,13 @@ This test plan spec is accepted when: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+ the active radius; the default is the global 12 DIP `--radius-md` radius, an+ authorized theme may choose 0..24DIP, 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+ ADR 0029 / ADR 0151 / ADR 0317- **Acceptance**: A (app shell), F (persistence), Quality- **Milestone**: M6+- **Status**: `test:e2e:window-controls` covers corner cutouts, theme radiusdiff --git a/docs/spec/07-plugins/02-plugin-manifest-schema.md b/docs/spec/07-plugins/02-plugin-manifest-schema.mdindex 9f70b6f4e..c0aba5e99 100644--- a/docs/spec/07-plugins/02-plugin-manifest-schema.md+++ b/docs/spec/07-plugins/02-plugin-manifest-schema.md@@ -280,13 +280,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?: number; // integer 0..24 DIP, Windows main window only; default 12};`cornerRadius` belongs to the contributing plugin and applies while any of itsdeclared 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.+main-window default of 12 DIP (`--radius-md`). Invalid or fractional values+reject the manifest.type PluginSkillContrib = {id?: string; // defaults to the file name without its extensiondiff --git a/docs/spec/07-plugins/04-plugin-security.md b/docs/spec/07-plugins/04-plugin-security.mdindex 4b7f96526..5f3b2646f 100644--- a/docs/spec/07-plugins/04-plugin-security.md+++ b/docs/spec/07-plugins/04-plugin-security.md@@ -119,7 +119,7 @@ before it is ever sent to the UI:the selected one; leaving the theme restores the host background, because theappearance is derived from the live catalog rather than remembered. macOSkeeps `vibrancy` and its native corner behavior; Linux retains native corner- behavior; Windows defaults to 4 DIP+ behavior; Windows defaults to the global 12 DIP `--radius-md` token- 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 markup.diff --git a/docs/spec/07-plugins/13-plugin-permissions-matrix.md b/docs/spec/07-plugins/13-plugin-permissions-matrix.mdindex 8045a2abd..6e1e5d23f 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 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 |+| `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 the global 12 DIP `--radius-md` 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 |diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex ede63d003..f6e6e7813 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -31,7 +31,7 @@ This log freezes previously open questions into concrete decisions.| D634 | Remove bundled macOS first-launch guidance | **Amend D457 / ADR 0296 and the macOS distribution provisions of ADR 0232 / ADR 0204: neither macOS DMG nor ZIP ships `PI-Desktop-macOS-open.command`, `PI-Desktop-macOS-opening-help.txt`, or another bundled quarantine-clearing helper or opening note. The ZIP contains `PI-Desktop.app` at its root; the DMG remains a two-icon install. This applies to signed releases and local or opt-in unsigned debug builds. See ADR 0309 and E2E-196b.** | The signed release lane has eliminated the user need for an unsigned first-launch workaround; shipping it beside debug builds risks suggesting a Gatekeeper bypass. || D635 | Work-area-capped 800×560 window minimum | **Supersede the 1040×700 window minimum in D156 / D447 (and the matching clauses of ADR 0029 / ADR 0238) and the `1040..10000` `window/setWorkPanelChatWidth` range (ADR 0146): Electron enforces an 800×560 minimum, capped per dimension to the current display work area by `clampMinimumSizeToWorkArea`. The chat-width IPC and renderer accept `800..10000`. On narrow windows the existing `workPanelLayout` budget caps the docked panel so MainChat keeps its 450px floor, collapsing the sidebar first. See US-UI-19 and E2E-167.** | At 150% Windows scaling the work area is about 1280×672 DIP, so a fixed minimum could exceed the screen and leave the window unfittable. || D636 | Local permission approvals have no automatic deadline | **Amend D005 / ADR 0011 and supersede the local tool-permission timeout clauses in the runtime and UX specs: a permission-gated `tools.execute` request remains pending in host-core, the renderer, and the transport until the user chooses Allow once, Allow for session, or Deny, or the request is cancelled / the process shuts down. Remove the 120-second countdown and timeout fields from the local permission contract. Tool-specific execution budgets and the separate RACP/Plan approval lifetimes remain unchanged. See ADR 0310, issue #1214, and E2E-017.** | A visible permission request could be missed while the user worked elsewhere; automatic denial after 120 seconds silently prevented the requested action. Keeping cancellation and execution budgets preserves control and resource safety without turning inattention into a decision. |-| D637 | Remove the Windows frameless resize rim | **Disable the Windows main window's thick frame while retaining Electron 43.6 native frameless edge and corner resizing. Apply a 4 DIP native rounded shape by default; authorized plugin themes may choose an integer radius from 0 to 24 DIP. Keep the D635 minimum-size contract and existing work-panel resize ownership. See ADR 0317 and E2E-167.** | The thick frame paints an unwanted left, bottom, and right rim that themes cannot remove. Native hit testing and shape keep resizing and transparent outer corners without renderer resize IPC. |+| D637 | Remove the Windows frameless resize rim | **Disable the Windows main window's thick frame while retaining Electron 43.6 native frameless edge and corner resizing. Use the global `--radius-md` token (12 DIP) for the default native rounded shape; authorized plugin themes may choose an integer radius from 0 to 24 DIP. Keep the D635 minimum-size contract and existing work-panel resize ownership. See ADR 0317 and E2E-167.** | The thick frame paints an unwanted left, bottom, and right rim that themes cannot remove. Native hit testing and shape keep resizing and transparent outer corners without renderer resize IPC. The former 4 DIP cutout was nearly square and did not match the global radius scale. || D638 | Publish native Linux arm64 artifacts | **Amend D126 / D285 / D603 / ADR 0022: tag releases publish native Linux arm64 AppImage, deb, and rpm packages, built on GitHub's native `ubuntu-22.04-arm` runner and carrying an arm64 `pi-desktop-host-core`. The static Linux targets drop their pinned `arch` and take the workflow's `--x64` / `--arm64` flag; `linux.artifactName` becomes `PI-Desktop-<version>-linux-<arch>.AppImage`; each Linux lane verifies its architecture-named updater feed (`latest-linux.yml` on x64, `latest-linux-arm64.yml` on arm64); the ASAR export reads `linux-unpacked` or `linux-arm64-unpacked` and publishes `PI-Desktop-<version>-linux-<arch>.asar`. `pi-host-bundle` builds both Linux architectures and `PUBLISHED_TARGETS` gains `linux-arm64`. Updater ownership, signing, and delivery modes are unchanged. See ADR 0318, issue #1281, and E2E-192a.** | arm64 Linux devices could not install or run the published x64 artifact, and a cross-built or emulated lane would ship a mismatched Rust sidecar. || D639 | models.dev owns published chat-model metadata | **Supersede D136 / D266 and ADR `pi-ai-core-0991-authority` for chat metadata: the bundled and explicitly refreshed models.dev catalog supplies published chat-model limits, modalities, reasoning metadata, names, and prices. Prefer the selected official publisher; when it has no record, accept another publisher only for a safe, unambiguous match, otherwise keep generic metadata. The checked-in preset identities are the priority set; do not assert an unsupported fixed count of 39. Live endpoint/OAuth discovery still owns selectable IDs. Pi remains responsible for OAuth, wire identity, transport and typed non-chat operations, but never supplies sibling chat limits, reasoning or prices. Explicit user binding overrides remain authoritative. No credentials are sent to models.dev; no host schema/protocol or persistence change. See ADR `models-dev-catalog-authority` and E2E-162 / E2E-MODEL-catalog-window-correction-reaches-saved-bindings.** | A Pi sibling default assigned a 272,000-token window to GPT models whose selected models.dev records publish 1,050,000 tokens, changing the Settings display and runtime context budget. || D640 | User MCP tools keep the normal approval path | **`mcp_<serverId>_<tool>` calls are `medium` risk in host-core: under `ask` and `accept-edits` each call shows the approval card ("MCP server tool requires approval"), allow-once and allow-session keep their usual scope (one call / that exact tool name in that session), `auto` runs without a card, and Plan/Goal still deny. Annotations or risk values the MCP server declares about its own tools are ignored and never lower the path. Dispatch, read-only-mode handling and the `mcp_` namespace are unchanged; no host protocol or persistence change. See ADR `mcp-tool-approval-risk` and E2E-MCP-tool-requires-approval.** | MCP tools were auto-allowed as `low` risk, so a configured server could write files, call networks or run commands without any prompt under `ask`. Configuring a server is consent to launch it, not to every action its opaque tools take. |@@ -7359,9 +7359,11 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.left, bottom, and right rim. Electron 43.6 retains its frameless native edgeand 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+ The Windows main window defaults to the global 12 DIP `--radius-md` native+ 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 12 when the+ theme is withdrawn. This replaces the barely visible 4 DIP cutout so the+ native corners match the app's global radius scale. TheD635 work-area-capped minimum remains in force. The removed thick frameleaves no native shadow control for themes; external shadow needs a separatewindow-geometry decision. See ADR 0317 and E2E-167.diff --git a/docs/zh-CN/spec/04-ux/07-ui-design-system.md b/docs/zh-CN/spec/04-ux/07-ui-design-system.mdindex 3b7305191..b461c35f2 100644--- a/docs/zh-CN/spec/04-ux/07-ui-design-system.md+++ b/docs/zh-CN/spec/04-ux/07-ui-design-system.md@@ -970,7 +970,10 @@ Linux 保留淡入淡出和滑动退出。collapsed lane uses two controls, 4px spacing and an 8px gap.Right native-control exclusion is unchanged. Header-height backgroundpaint fills the excluded lane without covering panel controls.-- 外层外壳在每个平台上都保留原生边缘/角落调整大小。无边框标题栏的+- 外层外壳在每个平台上都保留原生边缘/角落调整大小。Windows 主窗口默认+ 使用全局 `--radius-md`(12 DIP)原生圆角,与界面的中型半径令牌一致;+ 获得 `ui.window.appearance` 授权的插件主题可选择 0 至 24 DIP,退出主题后+ 恢复为 12 DIP。最大化和全屏时窗口保持矩形。无边框标题栏的拖动区域不会替代操作系统的调整大小所有权。300ms 的稳定边界等待窗口可避免恢复逻辑与慢速指针手势竞争,原生调整大小/移动事件停止 600ms 后才保存正常基础边界。Electron 强制 800×560 最小尺寸,并按当前显示器diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 70dcf834a..f1348c06c 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -7024,16 +7024,21 @@ eleven-tool-round desktop paths are verified by2. 确认指针按下期间窗口持续跟随,没有跳回默认尺寸或显示器边缘。3. 工作面板打开时从外边缘调整大小,确认对话窗格回流,而面板宽度和分隔线首选项不变。- 4. 等待调整大小稳定后关闭并重新启动应用。-- **预期**:无边框外壳仍提供原生边缘和角落命中区域,最小尺寸保持+ 4. 在 Windows 上检查默认 12 DIP 圆角在调整大小前后保持一致;选择获授权+ 的 `cornerRadius: 0` 主题,再切回内置主题,确认恢复为全局 `--radius-md`;+ 输入超过 24 DIP 的半径应被拒绝。+ 5. 等待调整大小稳定后关闭并重新启动应用。+- **预期**:无边框外壳仍提供原生边缘和角落命中区域;Windows 默认圆角使用+ 全局 12 DIP `--radius-md`,最大化/全屏时为矩形。最小尺寸保持800×560(按显示器工作区裁剪),恢复看门狗不会与慢速调整大小流竞争。最后稳定的基础边界会在重新启动后恢复;临时工作面板预留宽度不会被保存为用户的聊天窗口尺寸。- **链接规格**:`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 0122+ `04-ux/09-interaction-patterns.md`、ADR 0029 / ADR 0122 / ADR 0317 / D637- **验收**:A(应用外壳)、F(坚持)、质量- **里程碑**:M6+-- **状态**:单元/源码契约覆盖;原生桌面边缘/角落旅程仍待补+- **状态**:`test:e2e:window-controls` 覆盖圆角裁切、主题半径变化、全屏、最大化和窗口控件;+ Windows 原生拖动需在专用交互式桌面上运行 `test:e2e:window-resize-native`。#### E2E-168:展开侧边栏宽度跟随锚定的调整手势diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex a3d0726a9..5a1a25910 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -34,7 +34,7 @@| D634 | 移除 macOS 首次启动辅助文件 | **修订 D457 / ADR 0296 及 ADR 0232 / ADR 0204 中的 macOS 分发约定:macOS DMG 与 ZIP 均不再附带 `PI-Desktop-macOS-open.command`、`PI-Desktop-macOS-opening-help.txt`,或其他捆绑的 quarantine 清理助手/打开说明。ZIP 根目录只包含 `PI-Desktop.app`;DMG 仍为双图标安装。该规定适用于签名发布和本地或可选的未签名调试构建。见 ADR 0309 与 E2E-196b。** | 已签名发布通道不再需要未签名首次启动兜底;随调试包附带此类文件可能误导用户绕过 Gatekeeper。 || D635 | 按工作区上限裁剪的 800×560 窗口最小尺寸 | **取代 D156 / D447 中的 1040×700 窗口最小尺寸(及 ADR 0029 / ADR 0238 的对应条款)和 `window/setWorkPanelChatWidth` 的 `1040..10000` 范围(ADR 0146):Electron 强制 800×560 最小尺寸,并由 `clampMinimumSizeToWorkArea` 按维度裁剪到当前显示器工作区。聊天宽度 IPC 与渲染层接受 `800..10000`。窄窗口下沿用现有 `workPanelLayout` 预算:限制停靠面板宽度以保证 MainChat 的 450px 下限,并优先收起侧边栏。见 US-UI-19 与 E2E-167。** | Windows 150% 缩放下工作区约为 1280×672 DIP,固定最小尺寸可能超过屏幕,导致窗口无法适配。 || D636 | 本地权限确认没有自动截止时间 | **修订 D005 / ADR 0011:需要权限的 `tools.execute` 请求会在 host-core、渲染层和传输中保持待处理,直到用户选择允许一次、允许会话或拒绝,或请求被取消/进程关闭。移除 120 秒倒计时以及本地权限契约中的超时字段。工具自身执行预算以及独立的 RACP/Plan 审批时限保持不变。见 ADR 0310、issue #1214 与 E2E-017。** | 用户可能在其他工作期间错过可见的权限请求;保持取消和执行预算即可保留控制与资源安全,又不会把“未注意”变成一个决定。 |-| D637 | 移除 Windows 无边框窗口的缩放边缘 | **关闭 Windows 主窗口的厚边框,同时保留 Electron 43.6 原生无边框窗口的边缘和角落缩放。默认应用 4 DIP 原生圆角;获得授权的插件主题可选择 0 至 24 DIP 的整数半径。保留 D635 的最小尺寸约定和现有工作面板缩放归属。见 ADR 0317 与 E2E-167。** | 厚边框绘制了主题无法移除的左、下、右边缘。原生命中检测和窗口形状在不新增渲染层缩放 IPC 的情况下保留缩放能力及透明外角。 |+| D637 | 移除 Windows 无边框窗口的缩放边缘 | **关闭 Windows 主窗口的厚边框,同时保留 Electron 43.6 原生无边框窗口的边缘和角落缩放。默认原生圆角使用全局 `--radius-md`(12 DIP);获得授权的插件主题可选择 0 至 24 DIP 的整数半径。保留 D635 的最小尺寸约定和现有工作面板缩放归属。见 ADR 0317 与 E2E-167。** | 厚边框绘制了主题无法移除的左、下、右边缘。原生命中检测和窗口形状在不新增渲染层缩放 IPC 的情况下保留缩放能力及透明外角。原 4 DIP 裁切近似直角,无法体现全局圆角尺度。 || D638 | 发布原生 Linux arm64 工件 | **修订 D126 / D285 / D603 / ADR 0022:标签发布构建并发布原生 Linux arm64 的 AppImage、deb 和 rpm 包,它们在 GitHub 原生 `ubuntu-22.04-arm` 运行器上构建并携带 arm64 `pi-desktop-host-core`。静态 Linux 目标去掉固定的 `arch`,改用工作流的 `--x64` / `--arm64` 参数;`linux.artifactName` 变为 `PI-Desktop-<version>-linux-<arch>.AppImage`;每条 Linux 通道校验按架构命名的更新源(x64 为 `latest-linux.yml`,arm64 为 `latest-linux-arm64.yml`);ASAR 导出读取 `linux-unpacked` 或 `linux-arm64-unpacked` 并发布 `PI-Desktop-<version>-linux-<arch>.asar`。`pi-host-bundle` 构建两个 Linux 架构,`PUBLISHED_TARGETS` 增加 `linux-arm64`。更新器归属、签名和交付模式不变。见 ADR 0318、issue #1281 与 E2E-192a。** | arm64 Linux 设备无法安装或运行已发布的 x64 工件,而交叉构建或模拟的通道会随包发布架构不匹配的 Rust sidecar。 || D639 | models.dev 拥有已发布的聊天模型元数据 | **就聊天元数据而言,取代 D136 / D266 和 ADR `pi-ai-core-0991-authority`:随应用打包并可显式刷新的 models.dev 目录提供已发布的聊天模型上下文 / 输出上限、模态、推理元数据、名称和价格。优先采用所选官方发布方;其没有记录时,只有安全且无歧义的匹配才采用其他发布方,否则保留通用元数据。仓库中的预设身份是优先集合;不要声称存在未经证实的 39 家固定名单。实时端点 / OAuth 发现仍决定可选模型 ID。Pi 仍负责 OAuth、wire 身份、传输和有类型的非聊天操作,但不再为聊天模型提供同档模型的上限、推理能力或价格。明确的用户绑定覆盖仍具权威性。不向 models.dev 发送凭据;不改主机模式 / 协议或持久化。见 ADR `models-dev-catalog-authority` 与 E2E-162 / E2E-MODEL-catalog-window-correction-reaches-saved-bindings。** | Pi 同档模型默认值曾把 GPT 模型的上下文窗口设为 272,000;所选 models.dev 记录实际发布的是 1,050,000,导致设置页显示和运行时上下文预算错误。 || D640 | 用户 MCP 工具保持常规审批路径 | **host-core 将 `mcp_<serverId>_<tool>` 调用视为 `medium` 风险:在 `ask` 与 `accept-edits` 下每次调用都显示审批卡片("MCP server tool requires approval"),允许一次与本会话允许保持原有范围(单次调用 / 该会话内同一工具名),`auto` 不显示卡片直接执行,Plan/Goal 仍然拒绝。MCP 服务器对自身工具声明的标注或风险值被忽略,绝不降低审批路径。分发、只读模式处理与 `mcp_` 命名空间不变;不改主机协议或持久化。见 ADR `mcp-tool-approval-risk` 与 E2E-MCP-tool-requires-approval。** | MCP 工具此前按 `low` 风险自动放行,已配置的服务器在 `ask` 下可以不经提示写文件、访问网络或执行命令。配置服务器意味着同意启动它,而不是同意其不透明工具的每一个操作。 |@@ -5180,8 +5180,9 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编- Windows 主窗口关闭 Electron 厚边框,移除左、下、右侧的原生可见边缘。Electron 43.6 仍保留无边框窗口的原生边缘与角落命中检测,因此不新增渲染层缩放路径或几何 IPC。macOS/Linux 的窗口行为和工作面板的缩放归属不变。-- Windows 主窗口默认使用 4 DIP 原生圆角,圆角外的像素和命中区域均不存在。- 获得授权的插件主题可将半径设为 0 至 24 DIP 的整数;撤销主题后恢复 4 DIP。+- Windows 主窗口默认使用全局 `--radius-md`(12 DIP)原生圆角,圆角外的像素和命中区域均不存在。+ 获得授权的插件主题可将半径设为 0 至 24 DIP 的整数;撤销主题后恢复 12 DIP。此值替代了+ 不易察觉的 4 DIP 裁切,使原生窗口圆角与应用的全局半径尺度一致。D635 按工作区裁剪的最小尺寸仍然生效。移除厚边框后,主题无法控制原生阴影;外部阴影需要单独决定窗口几何结构。见 ADR 0317 与 E2E-167。diff --git a/scripts/e2e-window-controls.mjs b/scripts/e2e-window-controls.mjsindex 7fb9974ac..7671d8c4e 100644--- a/scripts/e2e-window-controls.mjs+++ b/scripts/e2e-window-controls.mjs@@ -8,7 +8,7 @@ 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 { mkdtemp, rm, writeFile, mkdir, readFile } from "node:fs/promises";import { tmpdir } from "node:os";import { join, resolve } from "node:path";import { setTimeout as delay } from "node:timers/promises";@@ -16,6 +16,10 @@ import { assertDesktopBuild, repositoryRoot, resolveElectronBinary } from "./e2eimport { Host, resolveHostBinary } from "./e2e/host.mjs";const root = repositoryRoot();+const radiusTokens = await readFile(join(root, "apps/desktop/src/styles/tokens.css"), "utf8");+const mediumRadius = radiusTokens.match(/^\s*--radius-md:\s*(\d+(?:\.\d+)?)px;/m);+assert.ok(mediumRadius, "the global medium radius token is defined");+const defaultWindowCornerRadius = Number(mediumRadius[1]);const runNativeEdgeDrag = process.argv.includes("--native-edge-drag");const execFileAsync = promisify(execFile);const { appDir } = assertDesktopBuild(root);@@ -104,7 +108,7 @@ async function checkControls(label) {assert.ok(ok, label);}-async function checkWindowsRoundedCorners(label, rounded = true) {+async function checkWindowsRoundedCorners(label, rounded = true, radius = defaultWindowCornerRadius) {if (process.platform !== "win32") return;let corners;let probeError;@@ -116,11 +120,12 @@ async function checkWindowsRoundedCorners(label, rounded = true) {const { stdout } = await execFileAsync("pwsh.exe", ["-NoLogo", "-NoProfile", "-File",fileURLToPath(new URL("./e2e/probe-window-corners.ps1", import.meta.url)),- String(child.pid),+ String(child.pid), String(radius),]);corners = JSON.parse(stdout.trim());probeError = undefined;- return corners.topLeftCutout === rounded && corners.bottomRightCutout === rounded &&+ return corners.topLeftCutout === rounded && corners.topRightCutout === rounded &&+ corners.bottomLeftCutout === rounded && corners.bottomRightCutout === rounded &&corners.innerCornerOwned === true;} catch (error) {probeError = String(error);@@ -132,6 +137,8 @@ async function checkWindowsRoundedCorners(label, rounded = true) {}assert.deepEqual(corners, {topLeftCutout: rounded,+ topRightCutout: rounded,+ bottomLeftCutout: rounded,bottomRightCutout: rounded,innerCornerOwned: true,thickFrameStyle: false,@@ -316,8 +323,8 @@ try {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");+ assert.equal((await setRadius(defaultWindowCornerRadius)).ok, true);+ await checkWindowsRoundedCorners("theme switch restores the global radius token");const loaded = await evaluate(`window.piDesktop.invoke('pi-desktop/plugin/loadDevConfirm',{ path: ${JSON.stringify(radiusPluginPath)}, grantedPermissions: ['ui.theme', 'ui.window.appearance'] }diff --git a/scripts/e2e/probe-window-corners.ps1 b/scripts/e2e/probe-window-corners.ps1index 9ecde7a21..b1a251a8c 100644--- a/scripts/e2e/probe-window-corners.ps1+++ b/scripts/e2e/probe-window-corners.ps1@@ -1,4 +1,7 @@-param([Parameter(Mandatory = $true)][int]$targetProcessId)+param(+ [Parameter(Mandatory = $true)][int]$targetProcessId,+ [Parameter(Mandatory = $true)][int]$cornerRadius+)$ErrorActionPreference = 'Stop'Add-Type -TypeDefinition @'@@ -35,7 +38,9 @@ function Test-AppAt([int]$pointX, [int]$pointY) {@{topLeftCutout = -not (Test-AppAt $rect.Left $rect.Top)+ topRightCutout = -not (Test-AppAt ($rect.Right - 1) $rect.Top)+ bottomLeftCutout = -not (Test-AppAt $rect.Left ($rect.Bottom - 1))bottomRightCutout = -not (Test-AppAt ($rect.Right - 1) ($rect.Bottom - 1))- innerCornerOwned = Test-AppAt ($rect.Left + 4) ($rect.Top + 4)+ innerCornerOwned = Test-AppAt ($rect.Left + $cornerRadius + 1) ($rect.Top + $cornerRadius + 1)thickFrameStyle = ([CornerProbe]::GetWindowLong($appWindow, -16) -band 0x00040000) -ne 0} | ConvertTo-Json -Compress