Skip to content

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

docs(spec): record the square icon-only control foundation

ZeroYeec5b2534503
diff --git a/docs/spec/04-ux/07-ui-design-system.md b/docs/spec/04-ux/07-ui-design-system.md
index ba61b608a..9fc77546d 100644
--- a/docs/spec/04-ux/07-ui-design-system.md
+++ b/docs/spec/04-ux/07-ui-design-system.md
@@ -1085,8 +1085,17 @@ These are **token-level foundations** for common primitives. Detailed component
| Primary | px-3 py-1.5 | 32px | text-sm 500 | radius-sm | none | accent |
| Secondary | px-3 py-1.5 | 32px | text-sm 400 | radius-sm | none (D297) | `--ds-tile`, hover `--ds-tile-hover` |
| Ghost | px-2 py-1 | 28px | text-sm 400 | radius-sm | none | transparent |
+| Icon-only | none | 28px | — | radius-full | none | transparent; `.icon-btn-square` pins the width to `--ds-control-size` |
| Danger | px-3 py-1.5 | 32px | text-sm 500 | radius-sm | none | error |
+An icon-only control states `.icon-btn-square`. `.icon-btn` alone takes its
+width from its content — glyph plus 8px of side padding — which is what a
+label-driven pill wants and what a control with no label must not inherit. The
+variant pins both axes to `--ds-control-size` (28px), keeps `flex: 0 0` so a
+crowded toolbar row cannot shrink it back out of square, and drops the side
+padding that under the global `border-box` would leave a 12px content box for a
+15px glyph.
+
### 11.2 Input / textarea
| Property | Value |
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 174ca5a8b..e5f36eb78 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -588,6 +588,13 @@ visually distinct from list content.
- The visible shell name is `PI-Desktop`; Codex is not used as the renderer
identity.
+- A control with no label states `.icon-btn-square`, which pins both axes to
+ `--ds-control-size` (28px). `.icon-btn` on its own takes its width from its
+ glyph plus 8px of side padding — right for a label-driven pill, wrong for a
+ control that carries no label — which is why the sidebar collapse control, the
+ conversation topbar toggle, and the composer's add/enhance/undo controls all
+ render the same 28px square target as the topbar and work-panel actions
+ instead of a wider-than-tall pill.
- `BrandLogo` imports the renderer-sized marks derived from the canonical
masters through Vite: `src/assets/brand/logo-light.png` for light mode and
`src/assets/brand/logo-dark.png` for dark mode (192x192, covering the 64 px
diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.md
index a60da7b27..6fe2f10e3 100644
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@ -5444,6 +5444,29 @@ that was sitting at the bottom — including after the turn had finished.
`07-plugins/13-plugin-permissions-matrix.md` §6, and
E2E-PLUGIN-fs-root-follows-the-calling-session.
+## 2026-09-16 — A control with no label states its square geometry
+
+- `.icon-btn` is shared with label-driven pills, so it takes its width from its
+ content — glyph plus 8px of side padding. Every icon-only use of it was
+ therefore taller than it was wide: the sidebar collapse control and the
+ composer's add button rendered 31×28, the composer's enhance and undo
+ controls 35×28 inside `.composer-right`, and the settings provider actions
+ 30×28 from their 14px glyphs. The same control in the conversation topbar was
+ already a 28×28 square, so one function had two sizes.
+- Those controls now state `.icon-btn-square`, which pins both axes to the new
+ `--ds-control-size` (28px) token, keeps `flex: 0 0` so a crowded toolbar row
+ cannot shrink the control back out of square, and drops the side padding that
+ under the global `border-box` would leave a 12px content box for a 15px
+ glyph. Icon-only controls now match the square the topbar toggle, the
+ work-panel actions, and the send/stop controls already used.
+- `.composer-right .icon-btn` no longer sets inline padding. The label-driven
+ model/thinking chip sets its own padding with `!important`, so that
+ declaration only ever widened the icon-only controls beside it; the
+ maximizing enhance control keeps its label geometry while it is loading.
+- Renderer only: no protocol, storage, host, permission, or migration change.
+ See `04-ux/07-ui-design-system.md` §11.1 and `04-ux/08-component-spec.md`
+ §3.7.
+
## 2026-09-16 — The macOS traffic-light reserve has one source (D433)
- The renderer's windowed lead-in for the macOS traffic lights was a hand-copied
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.md
index 207e2ae63..114dee29c 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
@@ -963,8 +963,14 @@ Linux 保留淡入淡出和滑动退出。
| 小学 | px-3 py-1.5 | 32像素 | 短信-sm 500 | 半径-sm | 无 | 口音 |
| 中学 | px-3 py-1.5 | 32像素 | 短信-sm 400 | 半径-sm | 无(D297) | `--ds-tile`,悬停 `--ds-tile-hover` |
| 幽灵 | px-2 py-1 | 28像素 | 短信-sm 400 | 半径-sm | 无 | 透明 |
+| 仅图标 | 无 | 28px | — | radius-full | 无 | 透明;`.icon-btn-square` 把宽度固定到 `--ds-control-size` |
| 危险 | px-3 py-1.5 | 32像素 | 短信-sm 500 | 半径-sm | 无 | 错误 |
+仅图标的控件声明 `.icon-btn-square`。单独的 `.icon-btn` 宽度来自内容 —— 图形加左右各 8px
+内边距 —— 这是带文字的胶囊按钮想要的,而不是没有文字的控件该继承的。该变体把两个轴都固定
+到 `--ds-control-size`(28px),保留 `flex: 0 0` 以免拥挤的工具条把它压扁,并去掉侧向内边距
+(在全局 `border-box` 下,那会给 15px 的图形只留 12px 内容区)。
+
### 11. 2 输入/文本区域
| 财产 | 价值 |
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 d57d79767..c77a5fbdf 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -453,6 +453,11 @@ Collapsed (48px):
- 可见shell名称为`PI-Desktop`; Codex 不用作渲染器
身份。
+- 没有文字标签的控件声明 `.icon-btn-square`,它把两个轴都固定到
+ `--ds-control-size`(28px)。单独的 `.icon-btn` 宽度来自图形加左右各 8px 内边距 ——
+ 这对带文字的胶囊按钮是正确的,对没有文字的控件则是错误的 —— 因此侧边栏收起控件、
+ 会话顶栏开关,以及输入框的添加/增强/撤销控件,都呈现与顶栏和工作面板操作一致的
+ 28px 正方形点击区,而不是"宽大于高"的胶囊。
- `BrandLogo` 通过 Vite 导入从规范母版派生的渲染器尺寸标记:
`src/assets/brand/logo-light.png` 用于浅色模式,
`src/assets/brand/logo-dark.png` 用于深色模式(192x192,可覆盖 3x 下的
diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.md
index 7390c702a..ab44eea19 100644
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@ -4213,6 +4213,13 @@ the retained upstream work-panel lifecycle. See
- 权限、realpath 包含、拒绝名单、声明范围与运行时同意这四类闸门都没有改动,插件 API 表面也未变化:`pi.workspace.get` 仍然以可见工作区及其项目组作答。
- 见 ADR 0266、`07-plugins/03-plugin-api.md` §3、`07-plugins/13-plugin-permissions-matrix.md` §6 与 E2E-PLUGIN-fs-root-follows-the-calling-session。
+## 2026-09-16 —— 没有文字的控件声明自己的正方形几何
+
+- `.icon-btn` 与带文字的胶囊按钮共用,宽度来自内容 —— 图形加左右各 8px 内边距。于是每一处只有图标的使用都变成了"高大于宽":侧边栏收起控件与输入框的添加按钮渲染为 31×28,`.composer-right` 内的增强与撤销控件为 35×28,设置里的服务商操作按钮因 14px 图形而为 30×28。同一个功能在会话顶栏早就是 28×28 的正方形,也就是同一个功能存在两种尺寸。
+- 这些控件现在声明 `.icon-btn-square`:把两个轴都固定到新增的 `--ds-control-size`(28px)标记,保留 `flex: 0 0` 以免拥挤的工具条把控件压回非正方形,并去掉侧向内边距(在全局 `border-box` 下,那会给 15px 的图形只留 12px 内容区)。只有图标的控件现在与顶栏开关、工作面板操作、发送/停止控件一直以来的正方形保持一致。
+- `.composer-right .icon-btn` 不再设置水平内边距。带文字的模型/思考胶囊自己用 `!important` 设置内边距,所以那条声明只会把它旁边的纯图标控件撑宽;增强控件在加载态仍保留自己的带文字几何。
+- 仅渲染层:无协议、存储、宿主、权限或迁移改动。见 `04-ux/07-ui-design-system.md` §11.1 与 `04-ux/08-component-spec.md` §3.7。
+
## 2026-09-16 —— macOS 交通灯预留量只有一个来源(D433)
- 渲染层为 macOS 交通灯留出的窗口模式引导内缩,原本是一个手抄的 `76px`:散在 `apps/desktop/src/styles/chrome.css` 与 `apps/desktop/src/styles/work-panel.css` 里的五处声明 —— `.main-titlebar-left`(`64px`,即该值减去行自身的 12px 内边距)、`.conversation-topbar.ct-collapsed`(`--ct-lead-inset`)、`.sidebar-header`、`.window-chrome-row:not(.sidebar-expanded)`,以及预览态的 `.work-panel-header`(`calc(76px + var(--ds-preview-action-lane-width))`)—— 每一处还各有一个 `[data-fullscreen="true"]` 分身。它们谁都没有和主进程交给 Electron 的 `trafficLightPosition` 建立关联,因此任一侧单独改动都会与另一侧漂移。