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(desktop): seat the work-panel controls like every other chrome icon
ZeroYe131f9c957c7
diff --git a/apps/desktop/src/styles/chrome.css b/apps/desktop/src/styles/chrome.cssindex c84176620..c24d28c10 100644--- a/apps/desktop/src/styles/chrome.css+++ b/apps/desktop/src/styles/chrome.css@@ -515,13 +515,18 @@line-height: var(--leading-compact);}-/* One geometry for every chrome icon control: the topbar's dock toggle, the- viewport-fixed work-panel toggle, and the preview/route-band lane actions.+/* One geometry and one seat for every chrome icon control: the topbar's dock+ toggle, the viewport-fixed work-panel toggle, the preview/route-band lane+ actions, and the work-panel header's create and maximize controls. The seat is+ transparent at rest, so the icon alone carries the control and only the pointer+ hover wash paints a surface under it; keyboard focus keeps the global outline.`flex: 0 0` keeps them square when a crowded band would otherwise squeezethem. */.conversation-topbar .ct-icon-btn,.app-work-panel-toggle,-.window-chrome-row .title-nav-btn {+.window-chrome-row .title-nav-btn,+.work-panel-new-tab,+.work-panel-maximize {display: inline-flex;height: var(--ds-work-panel-toggle-size);width: var(--ds-work-panel-toggle-size);@@ -539,14 +544,18 @@.conversation-topbar .ct-icon-btn:hover:not(:disabled),.app-work-panel-toggle:hover:not(:disabled),-.window-chrome-row .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) {background: var(--ds-bg-hover);color: var(--ds-text-primary);}.conversation-topbar .ct-icon-btn:disabled,.app-work-panel-toggle:disabled,-.window-chrome-row .title-nav-btn:disabled {+.window-chrome-row .title-nav-btn:disabled,+.work-panel-new-tab:disabled,+.work-panel-maximize:disabled {opacity: 0.4;cursor: default;}@@ -581,10 +590,11 @@app-region: no-drag;}+/* The open state is the glyph swap plus the engaged ink — the same transparent+ seat as every other chrome icon control, so the toggle never floats over the+ panel header as a raised pill. */.app-work-panel-toggle[aria-pressed="true"] {- background: var(--ds-tile-deep);color: var(--ds-text-primary);- box-shadow: var(--ds-raised-shadow);}.app-work-panel-toggle-icon {diff --git a/apps/desktop/src/styles/work-panel.css b/apps/desktop/src/styles/work-panel.cssindex 2f48ee3ae..499391bee 100644--- a/apps/desktop/src/styles/work-panel.css+++ b/apps/desktop/src/styles/work-panel.css@@ -274,7 +274,9 @@/* One button group with the viewport-fixed collapse toggle: the same controlgap the header reserves for it, and no divider, inset, or margin of its own.- The rule owns spacing only — the controls keep their own sizes and seats. */+ The rule owns spacing only — `+` and maximize take the shared chrome-control+ geometry and transparent seat from chrome.css, beside the subagent back+ control's own matching rule, so the group reads as quiet icon controls. */.work-panel-actions {display: flex;flex: 0 0 auto;@@ -301,21 +303,6 @@color: var(--ds-text-primary);}-.work-panel-new-tab {- display: inline-flex;- width: var(--ds-work-panel-toggle-size);- height: var(--ds-work-panel-toggle-size);- flex: 0 0 auto;- align-items: center;- justify-content: center;- border-radius: var(--radius-md);- background: var(--ds-tile);- color: var(--ds-text-secondary);- transition:- background var(--motion-duration-fast) var(--motion-ease-out),- color var(--motion-duration-fast) var(--motion-ease-out);-}-/* Preview mode: the panel takes MainChat's width as well, so the divider has nosecond column to trade width with and the dock fills its flex row. */.work-panel.is-maximized {@@ -328,27 +315,6 @@cursor: default;}-.work-panel-maximize {- display: inline-flex;- width: var(--ds-work-panel-toggle-size);- height: var(--ds-work-panel-toggle-size);- flex: 0 0 auto;- align-items: center;- justify-content: center;- border-radius: var(--radius-md);- background: var(--ds-tile);- color: var(--ds-text-secondary);- transition:- background var(--motion-duration-fast) var(--motion-ease-out),- color var(--motion-duration-fast) var(--motion-ease-out);-}--.work-panel-new-tab:hover,-.work-panel-new-tab:focus-visible {- background: var(--ds-bg-active);- color: var(--ds-text-primary);-}-.work-panel-subagent-heading {display: inline-flex;min-width: 0;diff --git a/apps/desktop/test/chrome-control-geometry.test.mjs b/apps/desktop/test/chrome-control-geometry.test.mjsindex f234cef19..b0188f91a 100644--- a/apps/desktop/test/chrome-control-geometry.test.mjs+++ b/apps/desktop/test/chrome-control-geometry.test.mjs@@ -93,11 +93,33 @@ test("every icon-only .icon-btn states the square", async () => {}});+/**+ * The shared chrome-control rule for a state suffix (`""` is the rest state),+ * e.g. `:hover:not(:disabled)`. The selectors are a group, so the rule has to be+ * read from its first member through its closing brace — reading from the last+ * member's ` {` stops working the moment a selector is appended.+ */+function sharedChromeControlRule(suffix = "") {+ const start = styles.indexOf(`\n.conversation-topbar .ct-icon-btn${suffix}`);+ assert.ok(start >= 0, `the shared chrome-control rule "${suffix}" is missing`);+ const open = styles.indexOf("{", start);+ return styles.slice(start, styles.indexOf("}", open) + 1);+}++/** Every selector the shared chrome-control rule covers. */+function sharedChromeControlMembers(suffix = "") {+ const rule = sharedChromeControlRule(suffix);+ return rule+ .slice(rule.indexOf("\n") + 1, rule.indexOf("{"))+ .split(",")+ .map((selector) => selector.trim())+ .filter(Boolean);+}+test("the preview and route-band actions share the chrome control geometry", () => {// The topbar's dock toggle, the viewport-fixed panel toggle, and the lane// actions are the same control: one geometry, stated once.- const shared = styles.match(/\.window-chrome-row \.title-nav-btn \{([^}]*)\}/)?.[1] ?? "";- assert.ok(shared, "the shared chrome-control group does not cover the lane actions");+ const shared = sharedChromeControlRule().replace(/^[^{]*\{/, "");assert.match(shared, /height:\s*var\(--ds-work-panel-toggle-size\)/);assert.match(shared, /width:\s*var\(--ds-work-panel-toggle-size\)/);// `flex: 0 0` keeps the control square when a crowded band squeezes it.@@ -117,6 +139,97 @@ test("the preview and route-band actions share the chrome control geometry", ()}});+/** Every `selector { … }` rule in the effective stylesheet, comments stripped. */+function allRules() {+ return (+ styles.replace(/\/\*[\s\S]*?\*\//g, "").match(/[^{}]+\{[^{}]*\}/g) ?? []+ );+}++/** Every rule whose selector list names `selector` exactly. */+function rulesSelecting(selector) {+ return allRules().filter((rule) =>+ rule+ .slice(0, rule.indexOf("{"))+ .split(",")+ .some((candidate) => candidate.trim() === selector),+ );+}++/** The declaration body of one rule text. */+function ruleBody(rule) {+ return rule.slice(rule.indexOf("{") + 1);+}++test("the work-panel header controls take the shared seat, not one of their own", () => {+ // `+` and maximize sit in the panel header beside the viewport-fixed collapse+ // toggle, so they are members of the same family: 28px square, transparent at+ // rest, semantic hover wash, dimmed only when disabled. A `--ds-tile` seat of+ // their own turned the header into three filled squares.+ const members = sharedChromeControlMembers();+ for (const selector of [".work-panel-new-tab", ".work-panel-maximize"]) {+ assert.ok(+ members.includes(selector),+ `${selector} is not a member of the shared chrome-control group`,+ );+ }+ assert.match(sharedChromeControlRule(), /background:\s*transparent;/);+ assert.match(+ sharedChromeControlRule(),+ /transition:[^;]*var\(--motion-duration-fast\)/,+ );++ // Hover and disabled are the group's states too, so neither control can drift+ // back to a filled rest seat or lose its hover feedback on its own.+ assert.match(+ sharedChromeControlRule(":hover:not(:disabled)"),+ /background:\s*var\(--ds-bg-hover\);/,+ );+ assert.match(+ sharedChromeControlRule(":hover:not(:disabled)"),+ /color:\s*var\(--ds-text-primary\);/,+ );+ assert.match(sharedChromeControlRule(":disabled"), /opacity:\s*0\.4;/);++ // One geometry, stated once: every rule that names either control must be a+ // shared-family rule, and none of them may paint a tile or a raised seat.+ for (const selector of [".work-panel-new-tab", ".work-panel-maximize"]) {+ const own = rulesSelecting(selector);+ assert.ok(own.length > 0, `${selector} takes no rule at all`);+ for (const rule of own) {+ assert.match(+ rule,+ /\.conversation-topbar \.ct-icon-btn/,+ `${selector} has a rule outside the shared chrome-control group`,+ );+ assert.doesNotMatch(+ ruleBody(rule),+ /background:\s*var\(--ds-tile/,+ `${selector} paints a filled seat instead of the transparent seat`,+ );+ assert.doesNotMatch(+ ruleBody(rule),+ /box-shadow:/,+ `${selector} paints a raised seat instead of the transparent seat`,+ );+ }+ }+});++test("the pressed work-panel toggle keeps the transparent seat", () => {+ // The open state is the glyph swap plus the engaged ink. The raised pill this+ // used to paint floated over the panel header as a filled circular seat.+ const pressed =+ styles.match(+ /\.app-work-panel-toggle\[aria-pressed="true"\]\s*\{([^}]*)\}/,+ )?.[1] ?? "";+ assert.ok(pressed, "the pressed toggle rule is missing");+ assert.match(pressed, /color:\s*var\(--ds-text-primary\);/);+ assert.doesNotMatch(pressed, /background:/);+ assert.doesNotMatch(pressed, /box-shadow:/);+ assert.doesNotMatch(styles, /\.app-work-panel-toggle[^{}]*\{[^}]*--ds-raised-shadow/);+});+test("the preview action lane is derived from the control it reserves room for", () => {assert.match(styles,diff --git a/apps/desktop/test/work-panel.test.mjs b/apps/desktop/test/work-panel.test.mjsindex f63eabd25..e183fe4ec 100644--- a/apps/desktop/test/work-panel.test.mjs+++ b/apps/desktop/test/work-panel.test.mjs@@ -102,9 +102,21 @@ test("a viewport-fixed toggle is the sole pointer collapse control", () => {globalStyles,/\.work-panel-actions \{[^}]*border-right:/s,);+ // `+` and maximize are chrome icon controls: transparent at rest, hover wash+ // only. A filled tile of their own re-seated the header's quiet group as two+ // filled squares beside the toggle (chrome-control-geometry.test.mjs owns the+ // family and its interaction states).assert.match(globalStyles,- /\.work-panel-new-tab \{[^}]*background:\s*var\(--ds-tile\);/s,+ /\.work-panel-new-tab,\n\.work-panel-maximize \{[^}]*background:\s*transparent;/s,+ );+ assert.doesNotMatch(+ globalStyles,+ /\.work-panel-(?:new-tab|maximize)\s*\{[^}]*background:\s*var\(--ds-tile/,+ );+ assert.doesNotMatch(+ globalStyles,+ /\.app-work-panel-toggle\[aria-pressed="true"\] \{[^}]*box-shadow:/s,);assert.match(mainSource, /WORK_PANEL_HEADER_PROBE/);assert.match(mainSource, /querySelector\('\.work-panel-new-tab'\)/);