Skip to content

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

fix(window): integrate current main into PR candidate

adoin842548ef90d5
diff --cc apps/desktop/electron/main/bootstrap/window.ts
index d50e8eaf0,d6664127c..1b1a8de49
--- a/apps/desktop/electron/main/bootstrap/window.ts
+++ b/apps/desktop/electron/main/bootstrap/window.ts
@@@ -573,13 -577,14 +581,14 @@@ 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(
- Math.min(windowMinWidth, workArea.width),
- Math.min(windowMinHeight, workArea.height),
+ const minimum = clampMinimumSizeToWorkArea(
+ { width: windowMinWidth, height: windowMinHeight },
+ workArea,
);
+ window.setMinimumSize(minimum.width, minimum.height);
const fitted = clampBoundsToWorkArea(currentBounds, workArea);
if (windowBoundsEqual(fitted, currentBounds)) return;
windowState.expectedWorkPanelBounds = fitted;
diff --cc docs/adr/0310-windows-borderless-window-resize.md
index 35eeed08e,000000000..7180670ce
mode 100644,000000..100644
--- a/docs/adr/0310-windows-borderless-window-resize.md
+++ b/docs/adr/0310-windows-borderless-window-resize.md
@@@ -1,72 -1,0 +1,72 @@@
+# ADR 0310: Preserve Windows resizing without the native frameless rim
+
+- Status: Accepted
- - Date: 2026-09-28
++- Date: 2026-09-29
+- Deciders: PI-Desktop maintainers
- - Related: D635, E2E-167, ADR 0025, ADR 0248
++- Related: D635, D636, 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 --cc docs/adr/README.md
index c1d1a0fbb,0a69f87a9..6c2d4b781
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@@ -340,7 -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) |
++| 0310 | [Preserve Windows resizing without the native frameless rim](0310-windows-borderless-window-resize.md) | Accepted (D636) |
| 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 --cc docs/spec/04-ux/01-ui-ia.md
index 9774e26ee,5483131d9..2034dbe63
--- a/docs/spec/04-ux/01-ui-ia.md
+++ b/docs/spec/04-ux/01-ui-ia.md
@@@ -145,11 -145,11 +145,11 @@@ destination, chat as the home surface,
panel across the client area beside the sidebar; leaving preview restores the
prior panel width and sidebar state without changing native bounds. The
renderer-measured panel
- rectangle continues to position the native Browser view. Native window edges
+ rectangle continues to position the native Browser view. Window edges
resize the app window only; they do not change the panel target. The outer
- window remains resizable from all native edges and corners, including
- Electron's frameless hit regions on Windows, with a
- minimum supported size of 1040×700. Replaces
- window remains natively resizable from all OS edges and corners, with a
- minimum supported size of 800×560, capped to the current display's work
- area (D635). Replaces
++ window remains natively resizable from all OS edges and corners, including
++ Electron's frameless hit regions on Windows, with a minimum supported size
++ of 800×560, capped to the current display's work area (D635). Replaces
the former context-panel overlay; workspace/model/status info lives in the
composer chips and Settings instead.
- **Composer**: workspace-agnostic floating pill anchored to the conversation
diff --cc docs/spec/04-ux/07-ui-design-system.md
index 9b3686501,d040e4812..59d2f0cf5
--- a/docs/spec/04-ux/07-ui-design-system.md
+++ b/docs/spec/04-ux/07-ui-design-system.md
@@@ -1106,24 -1106,12 +1106,24 @@@ header-height background behind the exc
- Panel open and collapse change only the in-flow flex allocation. No positive
native reservation is requested, and the panel's preferred width remains a
renderer-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. A
300ms stable-bounds settle window prevents recovery logic from competing with
a slow pointer gesture, and normal base bounds persist 600ms after the last
- resize/move event. Width < 1040px or height < 700px is unsupported and
- constrained by Electron's native resize handling.
+ native resize/move event. Electron enforces an 800×560 minimum, capped to the
+ current display's work area (D635); smaller sizes are unsupported.
## 11. Component foundations
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index b58975384,01425791c..ca603fe46
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -11288,37 -11304,21 +11305,38 @@@ This test plan spec is accepted when
native bounds stay fixed. Repeat below the panel minimum and above its
maximum, 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.
+ 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 frameless
- chrome, the minimum size remains 1040×700, and the recovery watchdog does not
+ - **Expected**: Native edge and corner hit regions remain available in frameless
+ chrome, the minimum size remains 800×560 (capped to the display
+ work area), and the recovery watchdog does not
compete with a slow resize stream. The renderer-owned divider updates the
bounded 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 temporary
work-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,
++ drags and the 800×560 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 gesture
diff --cc docs/spec/08-meta/decisions-log.md
index 852292757,d4fb90190..ce22ae998
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@@ -29,6 -29,7 +29,8 @@@ This log freezes previously open questi
| D459 | Restore resizable sidebar width with collapse-below-threshold | **Amend D408 / ADR 0238 and restore ADR 0141 (ADR 0290): the expanded sidebar is again a renderer-owned `240px..520px` column (default `275px`) with a right-edge handle that previews on pointer-down, persists on release, and supports ArrowLeft/ArrowRight (16px), Home, and End. A pointer width below `160px` collapses as a user action without overwriting the preferred expanded width; keyboard resize never collapses. Live maximum is the three-column remainder after MainChat's 450px floor. Renderer only; existing `pi.desktop.sidebarWidth` preference. See E2E-168.** | Long labels need reclaimable width; ADR 0238's fixed 275px pin blocked that while the live three-column budget could already cap a user-chosen width. This decision was mistakenly recorded as D451 (already used by Review-opens-only-on-explicit-user-action); renumbered per issue #620. |
| D457 | Signed macOS DMG is a two-icon install | *(amended by D634)* **Amend D406 / ADR 0232 / ADR 0204: official and local DMGs contain only PI-Desktop.app and the Applications link on a branded 720×440 plate. The ZIP contains PI-Desktop.app only. Neither macOS format includes the opening note or command helper, including unsigned debug artifacts. See ADR 0296 / ADR 0309 and E2E-196b.** | Tagged DMGs are signed and notarized (D450); unsigned first-launch guidance is no longer needed in package artifacts. |
| 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 | 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 0310 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. |
| D450 | Signed macOS GitHub Releases | **Amend D078 / ADR 0022: GitHub tag releases Developer ID-sign, notarize (`notarytool` via electron-builder 26), staple, and Gatekeeper-verify macOS DMG/ZIP before upload, using identity `Developer ID Application: XingYu Liu (DUV63RKYTW)` / team `DUV63RKYTW` from Actions secrets (`CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID`). Missing secrets fail the job. Local unsigned packaging without a certificate remains. `workflow_dispatch` may set `sign_macos: false` only for unsigned debug artifacts. Packaged macOS uses in-app `electron-updater` (ZIP + merged `latest-mac.yml`); Linux deb/rpm and Windows portable ZIP stay notify-and-link. No afterPack/afterSign adhoc codesign (ADR 0278).** | Production DMGs must open without a Gatekeeper warning, and signed macOS installs can download and restart into a new tag. See ADR 0289, E2E-196c, E2E-067A. |
## B. Secondary implementation defaults
@@@ -7300,15 -7301,22 +7302,35 @@@ must keep splitting are covered by `mar
- D634 amends D457 / ADR 0296 and supersedes the macOS distribution provisions
of ADR 0232 / ADR 0204. See ADR 0309.
- ## 2026-09-28 — Remove the Windows frameless resize rim (D635)
+ ## 2026-09-29 — Work-area-capped 800×560 window minimum (D635)
+
+ - The app-wide window minimum is 800×560 DIP. `clampMinimumSizeToWorkArea`
+ caps each dimension to the current display's work area (floored, at least 1)
+ wherever Main sets the minimum: window creation, display reconciliation,
+ Stage Manager recovery, and the work-panel resize paths. At 150% scaling on
+ Windows the work area is about 1280×672 DIP, so a fixed minimum could be
+ larger than the screen.
+ - `window/setWorkPanelChatWidth` and the renderer's chat-width clamp accept
+ `800..10000px`; the two floors share one constant so a renderer-valid width
+ is never rejected by Main.
+ - On a narrow window the existing three-column budget (`workPanelLayout`)
+ still applies: the docked panel is capped so MainChat keeps its 450px floor,
+ and the expanded sidebar auto-collapses first. Saved panel widths are not
+ rewritten.
+ - D635 supersedes the 1040×700 minimum in D156 / D447 (and the matching
+ clauses of ADR 0029 / ADR 0238) and the `1040..10000` chat-width range in
+ ADR 0146. `work-panel-window.test.mjs` and `work-panel-resize.test.mjs`
+ cover the clamp and chat-width range; see US-UI-19 and E2E-167.
++
++## 2026-09-29 — Remove the Windows frameless resize rim (D636)
+
+- 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.
++ 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
++ D635 work-area-capped minimum remains in force. 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 --cc docs/zh-CN/spec/08-meta/decisions-log.md
index c0fe54280,26c4443f6..a2bce5883
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@@ -32,6 -32,7 +32,8 @@@
| D459 | 恢复可拖拽侧边栏宽度,过窄时收起 | **修订 D408 / ADR 0238 并恢复 ADR 0141(ADR 0290):展开侧边栏重新成为渲染层拥有的 `240px..520px` 列(默认 `275px`),右缘手柄在指针按下时预览、释放时持久,并支持左右方向键(16px)、Home 与 End。指针宽度低于 `160px` 时以用户操作收起,不覆盖首选展开宽度;键盘调整永不收起。实时上限为扣除 MainChat 450px 下限后的三栏余量。仅渲染进程;沿用 `pi.desktop.sidebarWidth` 偏好。见 E2E-168。** | 长标签需要可回收宽度;ADR 0238 固定 275px 会挡住这一点,而三栏实时预算本就可以限制用户选定的宽度。该决策曾被误记为 D451(已由「审阅面板只在用户主动操作时打开」占用);按 issue #620 改号。 |
| D457 | 已签名 macOS DMG 改为双图标安装 | *(由 D634 修订)* **修订 D406 / ADR 0232 / ADR 0204:正式与本地 DMG 只包含 PI-Desktop.app 和 Applications 链接,使用 720×440 品牌背景。ZIP 只包含 PI-Desktop.app。任何 macOS 格式(包括未签名调试工件)都不再附带打开说明或 command 助手。见 ADR 0296 / ADR 0309 与 E2E-196b。** | 标签 DMG 已签名公证(D450);打包工件不再需要未签名首次启动指引。 |
| 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 | 移除 Windows 无边框窗口的缩放边缘 | **关闭 Windows 主窗口的厚边框,同时保留 Electron 43.6 原生无边框窗口的边缘和角落缩放。默认应用 4 DIP 原生圆角;获得授权的插件主题可选择 0 至 24 DIP 的整数半径。保留 D635 的最小尺寸约定和现有工作面板缩放归属。见 ADR 0310 与 E2E-167。** | 厚边框绘制了主题无法移除的左、下、右边缘。原生命中检测和窗口形状在不新增渲染层缩放 IPC 的情况下保留缩放能力及透明外角。 |
| D450 | 签名的 macOS GitHub Release | **修订 D078 / ADR 0022:GitHub tag 发布使用身份 `Developer ID Application: XingYu Liu (DUV63RKYTW)` / 团队 `DUV63RKYTW`,通过 Actions 密钥(`CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD`、`APPLE_TEAM_ID`)对 macOS DMG/ZIP 做 Developer ID 签名、`notarytool` 公证、装订和 Gatekeeper 校验;缺少密钥则失败。无证书的本地未签名打包仍可用。`workflow_dispatch` 仅可把 `sign_macos: false` 用于未签名调试产物。打包的 macOS 走应用内 `electron-updater`(ZIP + 合并后的 `latest-mac.yml`);Linux deb/rpm 与 Windows 便携版 ZIP 仍为通知并打开发布页。禁止 afterPack/afterSign adhoc 签名(ADR 0278)。** | 正式 DMG 应无需 Gatekeeper 警告即可打开,已签名 macOS 安装可下载并重启到新 tag。见 ADR 0289、E2E-196c、E2E-067A。 |
## B. 辅助实现默认值
@@@ -5129,3 -5130,17 +5131,27 @@@ Markdown 源码,不是 `text/html` �
- 签名、公证、装订和更新程序通道保持不变。未签名调试工件不代表通过 Gatekeeper 验证。
- `packaging-footprint.test.mjs` 检查打包配置;E2E-196b 覆盖本机 DMG 与 ZIP 归档检查。
- D634 修订 D457 / ADR 0296,并取代 ADR 0232 / ADR 0204 中的 macOS 分发约定。见 ADR 0309。
+
+ ## 2026-09-29 —— 按工作区上限裁剪的 800×560 窗口最小尺寸(D635)
+
+ - 应用级窗口最小尺寸为 800×560 DIP。Main 在所有设置最小尺寸的位置(窗口创建、
+ 显示器协调、Stage Manager 恢复和工作面板调整路径)都用
+ `clampMinimumSizeToWorkArea` 按维度裁剪到当前显示器工作区(向下取整,至少为 1)。
+ Windows 150% 缩放下工作区约为 1280×672 DIP,固定最小尺寸可能大于屏幕。
+ - `window/setWorkPanelChatWidth` 与渲染层聊天宽度裁剪接受 `800..10000px`;两处下限
+ 共用同一常量,渲染层认为合法的宽度不会被 Main 拒绝。
+ - 窄窗口下仍沿用现有三栏预算(`workPanelLayout`):限制停靠面板宽度以保证 MainChat
+ 的 450px 下限,并优先自动收起展开的侧边栏。已保存的面板宽度不会被改写。
+ - D635 取代 D156 / D447 中的 1040×700 最小尺寸(及 ADR 0029 / ADR 0238 的对应条款)
+ 和 ADR 0146 中 `1040..10000` 的聊天宽度范围。`work-panel-window.test.mjs` 与
+ `work-panel-resize.test.mjs` 覆盖裁剪与聊天宽度范围;见 US-UI-19 与 E2E-167。
++
++## 2026-09-29 —— 移除 Windows 无边框窗口的缩放边缘(D636)
++
++- Windows 主窗口关闭 Electron 厚边框,移除左、下、右侧的原生可见边缘。
++ Electron 43.6 仍保留无边框窗口的原生边缘与角落命中检测,因此不新增渲染层
++ 缩放路径或几何 IPC。macOS/Linux 的窗口行为和工作面板的缩放归属不变。
++- Windows 主窗口默认使用 4 DIP 原生圆角,圆角外的像素和命中区域均不存在。
++ 获得授权的插件主题可将半径设为 0 至 24 DIP 的整数;撤销主题后恢复 4 DIP。
++ D635 按工作区裁剪的最小尺寸仍然生效。移除厚边框后,主题无法控制原生阴影;
++ 外部阴影需要单独决定窗口几何结构。见 ADR 0310 与 E2E-167。
diff --cc scripts/e2e-window-controls.mjs
index 26a0e8cbd,8378c9ea1..7fb9974ac
--- a/scripts/e2e-window-controls.mjs
+++ b/scripts/e2e-window-controls.mjs
@@@ -104,103 -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}`);
++ assert.ok(bounds.afterWidth >= 800 && bounds.afterWidth <= 810, `minimum width: ${stdout}`);
+ } else {
- assert.ok(bounds.afterHeight >= 700 && bounds.afterHeight <= 710, `minimum height: ${stdout}`);
++ assert.ok(bounds.afterHeight >= 560 && bounds.afterHeight <= 570, `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 {
diff --cc scripts/e2e/drag-window-edge.ps1
index 7b0378347,000000000..5caa4f215
mode 100644,000000..100644
--- a/scripts/e2e/drag-window-edge.ps1
+++ b/scripts/e2e/drag-window-edge.ps1
@@@ -1,111 -1,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 }
++ 'left-min' { $startX = $before.Left + 1; $deltaX = 600 }
+ 'bottom' { $startY = $before.Bottom - 1; $deltaY = -40 }
- 'bottom-min' { $startY = $before.Bottom - 1; $deltaY = -100 }
++ 'bottom-min' { $startY = $before.Bottom - 1; $deltaY = -350 }
+ '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 -Compress