Skip to content

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

fix(desktop): restore ordinary route titlebar control geometry

ZeroYb96a8ab437f8
diff --git a/apps/desktop/src/styles/chrome.css b/apps/desktop/src/styles/chrome.css
index c24d28c10..d54e90dd7 100644
--- a/apps/desktop/src/styles/chrome.css
+++ b/apps/desktop/src/styles/chrome.css
@@ -524,6 +524,7 @@
them. */
.conversation-topbar .ct-icon-btn,
.app-work-panel-toggle,
+.main-titlebar .title-nav-btn,
.window-chrome-row .title-nav-btn,
.work-panel-new-tab,
.work-panel-maximize {
@@ -544,6 +545,7 @@
.conversation-topbar .ct-icon-btn:hover:not(:disabled),
.app-work-panel-toggle:hover:not(:disabled),
+.main-titlebar .title-nav-btn:hover:not(:disabled),
.window-chrome-row .title-nav-btn:hover:not(:disabled),
.work-panel-new-tab:hover:not(:disabled),
.work-panel-maximize:hover:not(:disabled) {
@@ -553,6 +555,7 @@
.conversation-topbar .ct-icon-btn:disabled,
.app-work-panel-toggle:disabled,
+.main-titlebar .title-nav-btn:disabled,
.window-chrome-row .title-nav-btn:disabled,
.work-panel-new-tab:disabled,
.work-panel-maximize:disabled {
diff --git a/apps/desktop/test/chrome-control-geometry.test.mjs b/apps/desktop/test/chrome-control-geometry.test.mjs
index b0188f91a..864112408 100644
--- a/apps/desktop/test/chrome-control-geometry.test.mjs
+++ b/apps/desktop/test/chrome-control-geometry.test.mjs
@@ -117,6 +117,15 @@ function sharedChromeControlMembers(suffix = "") {
}
test("the preview and route-band actions share the chrome control geometry", () => {
+ for (const suffix of ["", ":hover:not(:disabled)", ":disabled"]) {
+ const members = sharedChromeControlMembers(suffix);
+ for (const container of [".main-titlebar", ".window-chrome-row"]) {
+ assert.ok(
+ members.includes(`${container} .title-nav-btn${suffix}`),
+ `${container} actions are missing from the shared chrome-control ${suffix || "rest"} rule`,
+ );
+ }
+ }
// The topbar's dock toggle, the viewport-fixed panel toggle, and the lane
// actions are the same control: one geometry, stated once.
const shared = sharedChromeControlRule().replace(/^[^{]*\{/, "");
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 8354ae1aa..5c26fb389 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -281,6 +281,10 @@ combined model × reasoning selection (§11).
lane reserve is derived from that same control size rather than from a
literal, and the toggle's open state is its glyph swap plus the engaged ink —
no control in this family paints a filled or raised "on" pill.
+ With the sidebar collapsed, Plugins, Pull requests, and Scheduled render their
+ sidebar/New Task actions inside `.main-titlebar`, not the preview-only
+ `.window-chrome-row`. Both containers must share the same geometry, rest,
+ hover, and disabled rules; route actions must not duplicate those declarations.
- Band reservation is platform-independent (D269). The band is opaque and
absolutely positioned, so scrolling route content passes underneath it on
every platform, macOS included. Every route surface that starts its own
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index b4686d2f9..4e70f676d 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -12197,7 +12197,16 @@ plugin-form fixtures in an isolated temporary directory at runtime.
4. Close the work panel and confirm the sidebar returns; repeat after
manually collapsing the sidebar.
5. Repeat divider changes with `ArrowLeft`, `ArrowRight`, `Home`, and `End`.
-- **Expected**: The native window width never changes. MainChat never measures
+ 6. Navigate to the real Plugins, Pull requests, and Scheduled routes with the
+ work panel closed, then collapse the sidebar. In light and dark themes,
+ measure both titlebar actions and compare their rest/hover styling with the
+ shared work-panel toggle. Reopen the sidebar, collapse it again, and use
+ New Task to return to an editable chat composer on each route.
+- **Expected**: The ordinary `.main-titlebar` actions (without a preview chrome
+ ancestor) render as centered 28px square targets, with the shared transparent
+ rest surface, secondary ink, radius, and semantic hover wash/primary ink.
+ Hover does not change geometry; sidebar and New Task actions remain usable.
+ The native window width never changes. MainChat never measures
below 450px — including mid-drag and while `sidebar-out` still occupies flex
space. The effective panel maximum is the client width minus the 450px
MainChat floor and the expanded sidebar width, with no fixed pixel cap. When that
@@ -12221,9 +12230,13 @@ plugin-form fixtures in an isolated temporary directory at runtime.
`pnpm test:e2e:layout` — fixed-window width invariance, the 450px floor across
a pointer drag, the unfolded composer row at that floor, sidebar
yield/restore, the 460px reopen target, the panel action group's shared
- control gap, and preview mode). The panel controls' transparent seat is pinned
- by the source contracts in `chrome-control-geometry.test.mjs`; the rendered
- surface needs the eyes-on pass above. Unit coverage in
+ control gap, preview mode, and ordinary Plugins/Pull requests/Scheduled titlebar
+ geometry, light/dark rest/hover styles, and sidebar/New Task DOM actions).
+ Source contracts in `chrome-control-geometry.test.mjs` also cover the shared
+ disabled state and panel controls' transparent seat; the panel surface still
+ needs the eyes-on pass above. DOM/CDP checks establish renderer behavior, not
+ native Windows/Linux hit testing; native platform checks remain separate.
+ Unit coverage in
`work-panel-resize.test.mjs`
#### E2E-LAYOUT-work-panel-maximize
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index 95a36230d..dbd8ce7f6 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -233,6 +233,10 @@ Composer 拥有 Agent/Plan/Goal 控件以及组合的模型 × 推理选择(§
由图标本身承载,只有语义化的悬停淡色才会在其下着色。面板头部为动作组
预留的车道宽度也由同一个控件尺寸推导,而不是写死的字面量;开关的打开
状态只改变图形与墨色,这一族控件都不绘制填充或抬升的“开启”胶囊。
+ With the sidebar collapsed, Plugins, Pull requests, and Scheduled render their
+ sidebar/New Task actions inside `.main-titlebar`, not the preview-only
+ `.window-chrome-row`. Both containers must share the same geometry, rest,
+ hover, and disabled rules; route actions must not duplicate those declarations.
### 2.4 状态
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.md
index 26b093c21..8b6af7f6d 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
@@ -7215,6 +7215,17 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture
3. 在布局收起左栏后手动重开左栏。
4. 关闭工作面板并确认左栏恢复;再在手动收起左栏后重复一次。
5. 用 `ArrowLeft`、`ArrowRight`、`Home`、`End` 重复调整分隔线。
+ 6. Navigate to the real Plugins, Pull requests, and Scheduled routes with the
+ work panel closed, then collapse the sidebar. In light and dark themes,
+ measure both titlebar actions and compare their rest/hover styling with the
+ shared work-panel toggle. Reopen the sidebar, collapse it again, and use
+ New Task to return to an editable chat composer on each route.
+- **Route chrome expected**: The ordinary `.main-titlebar` actions (without a
+ preview chrome ancestor) render as centered 28px square targets with the shared
+ transparent rest surface, secondary ink, radius, and semantic hover wash/primary
+ ink. Hover does not change geometry; sidebar and New Task remain usable.
+ Automated by `pnpm test:e2e:layout` using real route components and DOM/CDP
+ interaction. This is renderer evidence, not native Windows/Linux hit-test proof.
- **预期**:原生窗口宽度全程不变。MainChat 永不低于 360px —— 包含拖动过程中以及 `sidebar-out` 仍占位弹性空间期间。工作面板有效上限为客户端宽度减去 360px 下限与展开的左栏宽度,且无固定像素上限。预算耗尽时展开的左栏立即收起,面板之后仍可继续增长。手动重开优先占用右栏宽度;能保住当前 MainChat 则保持,否则落在 370px 的重开目标。关闭面板只恢复由布局机制收起的左栏。分隔线的 ARIA 最小/最大值遵循同一动态预算。
- **链接规格**:`04-ux/01-ui-ia.md`、`04-ux/07-ui-design-system.md` §10、`04-ux/08-component-spec.md` §1 与 §5、`04-ux/09-interaction-patterns.md` §8、ADR 0238
- **验收**:F(持久化)、品质
diff --git a/scripts/e2e-three-column-layout.mjs b/scripts/e2e-three-column-layout.mjs
index e92558b6e..4ce659967 100644
--- a/scripts/e2e-three-column-layout.mjs
+++ b/scripts/e2e-three-column-layout.mjs
@@ -945,6 +945,99 @@ async function main() {
await cdp.evaluate(`document.querySelector(".work-panel-maximize")?.click?.()`);
await e2eChromeSettle(900);
+ await rig(`window.__PI_DESKTOP__.collapseWorkPanel()`);
+ const originalTheme = await cdp.evaluate(`document.documentElement.dataset.theme`);
+ const routeActionSelector = ".main-titlebar .title-nav-btn";
+ const readChromeAction = (selector) => cdp.evaluate(`(() => {
+ const control = document.querySelector(${JSON.stringify(selector)});
+ if (!control) throw new Error("Chrome action missing");
+ const box = control.getBoundingClientRect();
+ const style = getComputedStyle(control);
+ return {
+ width: box.width, height: box.height,
+ x: box.left + box.width / 2, y: box.top + box.height / 2,
+ background: style.backgroundColor, color: style.color,
+ radius: style.borderRadius, border: style.borderWidth,
+ display: style.display, align: style.alignItems, justify: style.justifyContent,
+ flex: style.flex, cursor: style.cursor,
+ hovered: control.matches(":hover"),
+ };
+ })()`);
+ const movePointer = async (x, y) => {
+ await cdp.send("Input.dispatchMouseEvent", { type: "mouseMoved", x, y });
+ await delay(220);
+ };
+ for (const route of ["plugins", "pulls", "scheduled"]) {
+ if ((await measure()).sidebarKind !== "sidebar") await clickSidebarToggle();
+ await rig(`window.__PI_DESKTOP__.setPage(${JSON.stringify(route)})`);
+ await waitFor(
+ () => cdp.evaluate(`!!document.querySelector(".route-page .page-frame") && !!document.querySelector(".main-titlebar")`),
+ `${route} route mounted`,
+ );
+ await clickSidebarToggle();
+ await waitFor(
+ () => cdp.evaluate(`!document.querySelector(".sidebar") && document.querySelectorAll(${JSON.stringify(routeActionSelector)}).length === 2`),
+ `${route} collapsed-sidebar actions`,
+ );
+ check(
+ await cdp.evaluate(`!document.querySelector(".window-chrome-row")`),
+ `${route} exercises the ordinary titlebar, not preview chrome`,
+ );
+ for (const theme of ["light", "dark"]) {
+ await cdp.evaluate(`window.__PI_DESKTOP__.setThemeAttr(${JSON.stringify(theme)})`);
+ await movePointer(500, 300);
+ const reference = await readChromeAction(".app-work-panel-toggle");
+ await movePointer(reference.x, reference.y);
+ const referenceHover = await readChromeAction(".app-work-panel-toggle");
+ check(
+ reference.background === "rgba(0, 0, 0, 0)" &&
+ referenceHover.hovered && referenceHover.background !== reference.background,
+ `${route}/${theme} shared chrome reference has transparent rest and hover wash`,
+ JSON.stringify({ reference, referenceHover }),
+ );
+ for (const action of ["toggle-sidebar", "new-task"]) {
+ const selector = `${routeActionSelector}[data-nav="${action}"]`;
+ await movePointer(500, 300);
+ const rest = await readChromeAction(selector);
+ check(
+ Math.abs(rest.width - 28) < 0.1 && Math.abs(rest.height - 28) < 0.1 &&
+ ["background", "color", "radius", "border", "display", "align", "justify", "flex", "cursor"].every(
+ (property) => rest[property] === reference[property],
+ ),
+ `${route}/${theme} ${action} shares the rendered 28px chrome target and rest style`,
+ JSON.stringify(rest),
+ );
+ await movePointer(rest.x, rest.y);
+ const hover = await readChromeAction(selector);
+ check(
+ hover.hovered && hover.background === referenceHover.background &&
+ hover.color === referenceHover.color &&
+ hover.width === rest.width && hover.height === rest.height,
+ `${route}/${theme} ${action} shares the hover wash without changing geometry (CDP)`,
+ JSON.stringify(hover),
+ );
+ }
+ }
+ await cdp.evaluate(`document.querySelector('${routeActionSelector}[data-nav="toggle-sidebar"]').click()`);
+ await waitFor(
+ () => cdp.evaluate(`!!document.querySelector(".sidebar:not(.is-exiting)") && !document.querySelector(${JSON.stringify(routeActionSelector)})`),
+ `${route} sidebar reopens through its titlebar action`,
+ );
+ check(true, `${route} titlebar sidebar action reopens navigation (DOM)`);
+ await clickSidebarToggle();
+ await waitFor(
+ () => cdp.evaluate(`!document.querySelector(".sidebar") && !!document.querySelector('${routeActionSelector}[data-nav="new-task"]')`),
+ `${route} new-task action after recollapse`,
+ );
+ await cdp.evaluate(`document.querySelector('${routeActionSelector}[data-nav="new-task"]').click()`);
+ await waitFor(
+ () => cdp.evaluate(`!!document.querySelector(".conversation-topbar") && !!document.querySelector(".composer-input:not(:disabled)") && !document.querySelector(".route-page")`),
+ `${route} new task returns to an editable chat composer`,
+ );
+ check(true, `${route} titlebar new-task action returns to chat (DOM)`);
+ }
+ await cdp.evaluate(`document.documentElement.dataset.theme = ${JSON.stringify(originalTheme)}`);
+
const failed = results.filter((entry) => !entry.ok);
console.log(
`\nE2E-LAYOUT-three-column-width-priority: ${results.length - failed.length}/${results.length} checks passed`,