Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
Merge origin/main into fix/window-chrome-geometry
vastsaa129f121baed
diff --cc docs/spec/08-meta/decisions-log.mdindex 3e21ecad0,4997fb0c1..7d157cf71--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@@ -5444,133 -5454,26 +5454,157 @@@ that was sitting at the bottom — incl`07-plugins/13-plugin-permissions-matrix.md` §6, andE2E-PLUGIN-fs-root-follows-the-calling-session.+ ## 2026-09-16 — Quotes, annotations, and side chats are removed (ADR 0268)++ - Quote, the text-selection overlay, response annotations (comment editor,+ floating index, source badges, composer attachment), and renderer-owned side+ chats are removed from every surface. Message action rows keep Copy, Edit,+ Delete, Fork, Retry, and Regenerate; the composer keeps its draft, chips, smart+ Stop, and per-session draft slots; the work panel keeps its other tab kinds;+ `session.fork` and the Fork action are unchanged.+ - Sends no longer compose a `# Response annotations:` block, and the display-side+ reduction `requestTextWithoutAnnotations` is gone, so a prompt stored before the+ removal is shown exactly as it was stored in the transcript, the edit seed, and+ the queue preview.+ - Retired and never reusable: `D-LOCAL-message-quotes`, `D-LOCAL-selection-overlay`,+ `D-LOCAL-response-annotations`, `D-native-sidechat-stream`, and the E2E IDs+ E2E-CHAT-quote-prefill, E2E-CHAT-selection-markdown,+ E2E-CHAT-selection-side-chat, E2E-CHAT-annotation-attachments,+ E2E-CHAT-annotation-session-state, E2E-CHAT-annotation-source-index,+ E2E-CHAT-annotation-ack-and-steering, E2E-CHAT-side-chat-fork,+ E2E-CHAT-side-chat-stream, E2E-CHAT-side-chat-add-to-main,+ E2E-CHAT-side-chat-promote, E2E-CHAT-side-chat-close, and+ E2E-SESSION-native-side-chat-fork-survives-close.+ - No host protocol (v11), storage schema (v15), IPC channel, permission, or Rust+ change. See ADR 0268.+++## 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 — One geometry for every chrome icon control++- The preview- and route-band lane actions (`.title-nav-btn`) rendered as 22px+ tiles with `--radius-2xs` and a `--ds-tile` seat, beside 28px siblings: the+ same dock toggle in the conversation topbar, the viewport-fixed work-panel+ toggle, and the work-panel's own actions. One control, two sizes and two+ shapes, in the same 46px band.+- Those actions now take the shared chrome-control geometry (the `.ct-icon-btn`+ group): a 28px square from `--ds-work-panel-toggle-size`, `flex: 0 0` so a+ crowded band cannot squeeze them out of square, `--radius-md`, a transparent+ seat with the semantic hover wash, and the 15px glyph every other chrome+ control uses. `.title-nav-btn` keeps only its press feedback and active tone.+- The preview action lane is derived from the control it reserves room for:+ `--ds-preview-action-lane-width: calc(2 * var(--ds-work-panel-toggle-size) + 4px + 8px)`,+ so the panel header's reserve and the buttons cannot drift apart.+- Renderer only: no protocol, storage, host, permission, or migration change.+ See `04-ux/08-component-spec.md` §2.++## 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+ `76px`: five declarations across `apps/desktop/src/styles/chrome.css` and+ `apps/desktop/src/styles/work-panel.css` — `.main-titlebar-left` (`64px`, that+ number minus the row's own 12px padding), `.conversation-topbar.ct-collapsed`+ (`--ct-lead-inset`), `.sidebar-header`,+ `.window-chrome-row:not(.sidebar-expanded)`, and the preview+ `.work-panel-header` (`calc(76px + var(--ds-preview-action-lane-width))`) —+ each with its own `[data-fullscreen="true"]` sibling. None of them was tied to+ the `trafficLightPosition` the main process hands Electron, so either side+ changing on its own would have drifted from the other.+- The native geometry now has one home, `packages/shared/src/window-chrome.ts`:+ `MAC_TRAFFIC_LIGHT_POSITION` (`{x:16,y:16}`) and+ `MAC_TRAFFIC_LIGHT_CLUSTER_WIDTH_DIP` (`60`), with+ `MAC_TRAFFIC_LIGHT_EDGE_DIP` (`16 + 60 = 76`) as the cluster's right edge. The+ main process positions the buttons from those constants, and the renderer+ injects the edge into `--ds-traffic-light-edge` at boot. Every consumer reads+ `--ds-window-lead-inset`, which `chrome.css` composes once for+ `:root[data-platform="darwin"]` as `--ds-traffic-light-edge` ++ `--ds-traffic-light-gap` (`12px`) = `88px`.+- The buttons used to sit flush against the green light, with a 0 gap. The+ reserve now keeps `12px` of breathing room between the cluster's right edge and+ the first shell control, which is why windowed mode moved from `76px` to+ `88px`.+- The per-selector `[data-fullscreen="true"]` overrides are gone. Fullscreen+ hides the buttons, and the same token's `[data-fullscreen="true"]` rule drops+ the reserve to the ordinary `8px` gutter for every consumer at once.+- Windows and Linux are unchanged: `--ds-window-lead-inset` keeps its `0px`+ default and those platforms still use the renderer-drawn controls in the 120px+ right-side band. Plugin-panel windows create a plain frameless `BrowserWindow`+ with no native traffic lights, so they are unaffected.+- Renderer + shared constant only: no protocol, storage, host, permission, or+ migration change, and no new default.+- See `04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`, and+ E2E-LAYOUT-three-column-width-priority.++## 2026-09-16 — The work-panel header's buttons are one group++- The work-panel header read as two clusters: the action group inside the header+ (`+` and maximize, 4px apart) and the viewport-fixed collapse toggle outside+ it. The separator between them was compounded from four declarations on+ `.work-panel-actions` — `margin-right: 8px`, `padding-right: 8px`, a 1px+ `--ds-border-subtle` divider, and a separate `--ds-work-panel-toggle-gap: 20px`+ lane token — for a real 37px gap plus a hairline rule, so the same three+ 28px squares in the same 46px row looked like two unrelated clusters.+- One token now spaces the whole row. `--ds-work-panel-control-gap: 4px`+ replaces `--ds-work-panel-toggle-gap` and is the header's flex gap (tab strip+ to action group), the `.work-panel-actions` gap (`+` to maximize), and — spent+ by the header's right padding as+ `calc(size + inset + control-gap)`, 44px — the gap from the action group to+ the fixed collapse toggle. `.work-panel-actions` states spacing only: the+ divider, inset, and margin are gone.+- The lane still reserves the whole toggle, and the `+` trigger still clears the+ toggle by 36px inside the lane (4px + the 28px maximize control + 4px), so the+ `WORK_PANEL_HEADER_PROBE` 24px assertion and E2E-152's hit-region contract+ still hold.+- Renderer only: no protocol, storage, host, permission, or migration change,+ and no new default. See `04-ux/08-component-spec.md` §5.2,+ `04-ux/07-ui-design-system.md` §4.3, and+ E2E-LAYOUT-three-column-width-priority.++## 2026-09-16 — The work-panel controls are quiet icons, not filled seats++- The work-panel header's `+` and maximize controls were painted with a+ `--ds-tile` seat of their own, and the viewport-fixed collapse toggle added+ `--ds-tile-deep` plus `--ds-raised-shadow` while `aria-pressed="true"`. In the+ light theme that turned a row of three 28px controls into filled squares, with+ the toggle reading as a raised circular pill floating over the panel header —+ nothing like the top-left dock toggle and new-task controls beside them.+- `+` and maximize now join the shared chrome-control group in `chrome.css` —+ the same rule that seats the topbar's dock toggle, the viewport-fixed panel+ toggle, and the preview/route-band lane actions — so they take one geometry+ (28px square, `--radius-md`, `flex: 0 0`), one transparent seat, the semantic+ `--ds-bg-hover` wash on pointer, and the `opacity: 0.4` disabled state. Their+ duplicated rules in `work-panel.css` are gone; the partial keeps only the+ action group's spacing.+- The toggle's pressed state drops the fill and the raised shadow and keeps the+ engaged ink, so the open state is the glyph swap plus `--ds-text-primary`.+ `aria-pressed` still carries the state to assistive technology, and+ `.app-work-panel-toggle` keeps its viewport-fixed ownership and `no-drag`+ carve-out.+- Keyboard focus is unchanged: the global `:focus-visible` outline applies as it+ does to every other chrome icon control, so removing the retired+ `:focus-visible` background wash costs no focus affordance.+- Renderer only: no geometry, gap, inset, protocol, storage, host, permission, or+ migration change, and no new token. See `04-ux/08-component-spec.md` §2.3 and+ §5.2, `04-ux/07-ui-design-system.md` §4.3, and+ E2E-LAYOUT-three-column-width-priority.diff --cc docs/zh-CN/spec/08-meta/decisions-log.mdindex ec1e45786,50e3a8254..daace494a--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@@ -4213,41 -4220,9 +4220,48 @@@ that amendment are retired by ADR 0268- 权限、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 —— 引用、批注与侧边聊天已移除(ADR 0268)++ - 引用、文本选区浮层、响应批注(评论编辑器、悬浮批注索引、源标记、composer 批注附件)与渲染器拥有的侧边聊天已从所有界面移除。消息操作行保留 Copy、Edit、Delete、Fork、Retry 与 Regenerate;composer 保留草稿、芯片、智能 Stop 与会话级草稿槽;工作面板保留其余标签类型;`session.fork` 与 Fork 操作不变。+ - 发送路径不再拼装 `# Response annotations:` 块,显示层还原函数 `requestTextWithoutAnnotations` 一并删除,因此移除之前已存入会话的提示词在转录、编辑种子与队列预览中都按存储原文显示。+ - 永久退役且不得复用:`D-LOCAL-message-quotes`、`D-LOCAL-selection-overlay`、`D-LOCAL-response-annotations`、`D-native-sidechat-stream`,以及 E2E-CHAT-quote-prefill、E2E-CHAT-selection-markdown、E2E-CHAT-selection-side-chat、E2E-CHAT-annotation-attachments、E2E-CHAT-annotation-session-state、E2E-CHAT-annotation-source-index、E2E-CHAT-annotation-ack-and-steering、E2E-CHAT-side-chat-fork、E2E-CHAT-side-chat-stream、E2E-CHAT-side-chat-add-to-main、E2E-CHAT-side-chat-promote、E2E-CHAT-side-chat-close、E2E-SESSION-native-side-chat-fork-survives-close。+ - 未改动宿主协议(v11)、存储 schema(v15)、IPC 通道、权限与 Rust 侧。见 ADR 0268。+++## 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 —— 每个 chrome 图标控件共用一套几何++- 预览态与路由带上的动作按钮(`.title-nav-btn`)此前渲染为 22px 的方块,使用 `--radius-2xs` 与 `--ds-tile` 底色,而它们的同级控件是 28px:会话顶栏里同一个侧边栏开关、视口固定的工作面板开关,以及工作面板自身的操作。同一个控件、同一个 46px 带内,却有两种尺寸和两种形状。+- 这些动作按钮现在采用共享的 chrome 控件几何(`.ct-icon-btn` 组):由 `--ds-work-panel-toggle-size` 得到的 28px 正方形、`flex: 0 0` 以免拥挤的带把它们挤扁、`--radius-md`、透明底座加语义化 hover 底色,以及其它 chrome 控件统一使用的 15px 图形。`.title-nav-btn` 只保留按压反馈与 active 色调。+- 预览态动作组的车道宽度改为由它所预留的控件推导:`--ds-preview-action-lane-width: calc(2 * var(--ds-work-panel-toggle-size) + 4px + 8px)`,这样面板头部的预留与按钮本身不会再各自漂移。+- 仅渲染层:无协议、存储、宿主、权限或迁移改动。见 `04-ux/08-component-spec.md` §2。++## 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` 建立关联,因此任一侧单独改动都会与另一侧漂移。+- 原生几何现在只有一个归属地 `packages/shared/src/window-chrome.ts`:`MAC_TRAFFIC_LIGHT_POSITION`(`{x:16,y:16}`)与 `MAC_TRAFFIC_LIGHT_CLUSTER_WIDTH_DIP`(`60`),并由 `MAC_TRAFFIC_LIGHT_EDGE_DIP`(`16 + 60 = 76`)给出灯簇右缘。主进程用这些常量放置按钮,渲染层在启动时把右缘注入 `--ds-traffic-light-edge`。所有消费点都读 `--ds-window-lead-inset`,它由 `chrome.css` 针对 `:root[data-platform="darwin"]` 组合一次:`--ds-traffic-light-edge` + `--ds-traffic-light-gap`(`12px`)= `88px`。+- 按钮此前紧贴绿灯右缘,间隙为 0。现在灯簇右缘与第一个 shell 控件之间保留了 `12px` 呼吸空间,这也是窗口模式从 `76px` 变为 `88px` 的原因。+- 逐个选择器的 `[data-fullscreen="true"]` 覆盖规则已删除。全屏会隐藏按钮,同一个 token 的 `[data-fullscreen="true"]` 规则一次性把所有消费点的预留量降为普通的 `8px` 留白。+- Windows 与 Linux 行为不变:`--ds-window-lead-inset` 保持 `0px` 默认值,这两个平台仍使用右侧 120px 带内由渲染层绘制的控件。插件面板窗口创建的是普通无框架 `BrowserWindow`,没有原生交通灯,因此不受影响。+- 仅渲染层 + 共享常量:无协议、存储、宿主、权限或迁移改动,也没有新增默认值。+- 见 `04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md` 与 E2E-LAYOUT-three-column-width-priority。++## 2026-09-16 —— 工作面板头部的按钮现在是一组++- 工作面板头部此前读起来是两簇:头部内部的动作组(`+` 与最大化,相距 4px),以及头部之外视口固定的折叠开关。它们之间的分隔由 `.work-panel-actions` 上的四条声明叠加而成 —— `margin-right: 8px`、`padding-right: 8px`、1px 的 `--ds-border-subtle` 分隔线,以及另一个车道 token `--ds-work-panel-toggle-gap: 20px` —— 实际间距 37px 外加一条细线,于是同一个 46px 行内同样的三个 28px 方块看起来像两簇毫不相干的控件。+- 现在整行由同一个 token 控制间距。`--ds-work-panel-control-gap: 4px` 取代了 `--ds-work-panel-toggle-gap`,同时是头部的 flex 间距(标签条到动作组)、`.work-panel-actions` 的间距(`+` 到最大化),以及头部右侧内边距以 `calc(size + inset + control-gap)`(44px)形式花费的、动作组到固定折叠开关的间距。`.work-panel-actions` 只声明间距:分隔线、内缩与外边距都已移除。+- 车道仍然为整个开关预留空间,`+` 触发按钮在车道内与开关之间仍有 36px(4px + 28px 的最大化控件 + 4px),因此 `WORK_PANEL_HEADER_PROBE` 的 24px 断言与 E2E-152 的命中区域契约依然成立。+- 仅渲染层:无协议、存储、宿主、权限或迁移改动,也没有新增默认值。见 `04-ux/08-component-spec.md` §5.2、`04-ux/07-ui-design-system.md` §4.3 与 E2E-LAYOUT-three-column-width-priority。++## 2026-09-16 —— 工作面板的控件是安静的图标,而不是填充的底座++- 工作面板头部的 `+` 与最大化控件此前各有一个 `--ds-tile` 底座,视口固定的折叠开关在 `aria-pressed="true"` 时又叠加 `--ds-tile-deep` 与 `--ds-raised-shadow`。在浅色主题下,这一行三个 28px 控件读起来就是三个填充方块,开关更像一颗悬浮在面板头部之上的抬升圆形胶囊 —— 与旁边左上角的侧边栏开关、新任务控件完全不是同一种语言。+- `+` 与最大化现在加入 `chrome.css` 中的共享 chrome 控件组 —— 也就是为顶栏侧边栏开关、视口固定的面板开关与预览态/路由带动作组提供底座的同一条规则 —— 因此它们共用一套几何(28px 方形、`--radius-md`、`flex: 0 0`)、同一个透明底座、指针悬停时的语义化 `--ds-bg-hover` 淡色,以及 `opacity: 0.4` 的禁用状态。它们在 `work-panel.css` 中重复的规则已删除,该分部只保留动作组的间距。+- 开关的按下状态去掉填充与抬升阴影,保留被激活的墨色,因此打开状态就是图形切换加 `--ds-text-primary`。`aria-pressed` 仍向辅助技术传达状态,`.app-work-panel-toggle` 继续拥有视口固定定位与 `no-drag` 排除区。+- 键盘焦点不变:全局 `:focus-visible` 轮廓与其他 chrome 图标控件一致地生效,因此移除已废弃的 `:focus-visible` 背景淡色不会损失任何焦点提示。+- 仅渲染层:几何、间距、内缩、协议、存储、宿主、权限与迁移均无改动,也没有新增 token。见 `04-ux/08-component-spec.md` §2.3 与 §5.2、`04-ux/07-ui-design-system.md` §4.3 与 E2E-LAYOUT-three-column-width-priority。