Skip to content

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

fix(window): integrate current main and renumber ADR

adoind14aafc1b92c
diff --cc docs/adr/0313-windows-borderless-window-resize.md
index af5dcde95,000000000..ebcaa19d9
mode 100644,000000..100644
--- a/docs/adr/0313-windows-borderless-window-resize.md
+++ b/docs/adr/0313-windows-borderless-window-resize.md
@@@ -1,72 -1,0 +1,72 @@@
- # ADR 0312: Preserve Windows resizing without the native frameless rim
++# ADR 0313: Preserve Windows resizing without the native frameless rim
+
+- Status: Accepted
+- Date: 2026-09-29
+- Deciders: PI-Desktop maintainers
+- Related: D635, D637, 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 970447f2a,881c2b2cd..530f6ddd1
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@@ -342,7 -342,7 +342,8 @@@ Each ADR includes
| 0309 | [Remove bundled macOS first-launch guidance](0309-remove-macos-first-launch-artifacts.md) | Accepted (D634; amends D457 / ADR 0296) |
| 0310 | [Keep local permission approvals pending until resolved](0310-local-permission-approvals-without-deadline.md) | Accepted for implementation |
| 0311 | [Recheck Live Work workspace identity at Host admission](0311-live-work-workspace-admission-guard.md) | Implemented candidate |
- | 0312 | [Preserve Windows resizing without the native frameless rim](0312-windows-borderless-window-resize.md) | Accepted (D637) |
+ | 0312 | [Session-scoped Todo checklist](0312-session-scoped-todo-checklist.md) | Accepted for implementation |
++| 0313 | [Preserve Windows resizing without the native frameless rim](0313-windows-borderless-window-resize.md) | Accepted (D637) |
| 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/08-meta/decisions-log.md
index 8dcedd804,3251fbc58..c4ef900d0
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@@ -31,7 -31,6 +31,7 @@@ This log freezes previously open questi
| 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 0312 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. 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 0313 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
@@@ -7335,16 -7334,3 +7335,16 @@@ must keep splitting are covered by `mar
Tool-specific command/plugin execution budgets and the independent Plan/Goal
and RACP approval lifetimes are unchanged. See ADR 0310, issue #1214, and
E2E-017.
+
+## 2026-09-29 — Remove the Windows frameless resize rim (D637)
+
+- 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
+ 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 0312 and E2E-167.
++ window-geometry decision. See ADR 0313 and E2E-167.
diff --cc docs/zh-CN/spec/08-meta/decisions-log.md
index 2c037127a,08c3fc17c..2ba56700d
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@@ -34,7 -34,6 +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 0312 与 E2E-167。** | 厚边框绘制了主题无法移除的左、下、右边缘。原生命中检测和窗口形状在不新增渲染层缩放 IPC 的情况下保留缩放能力及透明外角。 |
++| D637 | 移除 Windows 无边框窗口的缩放边缘 | **关闭 Windows 主窗口的厚边框,同时保留 Electron 43.6 原生无边框窗口的边缘和角落缩放。默认应用 4 DIP 原生圆角;获得授权的插件主题可选择 0 至 24 DIP 的整数半径。保留 D635 的最小尺寸约定和现有工作面板缩放归属。见 ADR 0313 与 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. 辅助实现默认值
@@@ -5156,13 -5155,3 +5156,13 @@@ Markdown 源码,不是 `text/html` �
- 权限请求不再携带 `timeoutMs`;pending 快照不再暴露 `expiresAt` 或
`remainingMs`,UI 也不再显示倒计时。工具自身的命令/插件执行预算以及独立的
Plan/Goal 和 RACP 审批时限保持不变。见 ADR 0310、issue #1214 与 E2E-017。
+
+## 2026-09-29 —— 移除 Windows 无边框窗口的缩放边缘(D637)
+
+- Windows 主窗口关闭 Electron 厚边框,移除左、下、右侧的原生可见边缘。
+ Electron 43.6 仍保留无边框窗口的原生边缘与角落命中检测,因此不新增渲染层
+ 缩放路径或几何 IPC。macOS/Linux 的窗口行为和工作面板的缩放归属不变。
+- Windows 主窗口默认使用 4 DIP 原生圆角,圆角外的像素和命中区域均不存在。
+ 获得授权的插件主题可将半径设为 0 至 24 DIP 的整数;撤销主题后恢复 4 DIP。
+ D635 按工作区裁剪的最小尺寸仍然生效。移除厚边框后,主题无法控制原生阴影;
- 外部阴影需要单独决定窗口几何结构。见 ADR 0312 与 E2E-167。
++ 外部阴影需要单独决定窗口几何结构。见 ADR 0313 与 E2E-167。