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: land PR #497 sidebar visual unify onto current main
vastsaceb115c6fab2
diff --cc docs/spec/04-ux/07-ui-design-system.mdindex 9f31d7fbd,e1914d742..50086aeb0--- a/docs/spec/04-ux/07-ui-design-system.md+++ b/docs/spec/04-ux/07-ui-design-system.md@@@ -1217,12 -1227,13 +1227,13 @@@ Full component contract and usage rules|---|---|| **Base padding 8px (space-2)** | Default inner padding for list items, form groups || **Message gap 10px** | Between chat message rows — denser WorkBuddy-like transcript |- | **Section gap 16px (space-4)** | Between distinct UI sections (sidebar sections, settings groups) |+ | **Section gap 16px (space-4)** | Between distinct UI sections (destination pages, settings groups, page-level blocks) || **Panel gap 0px** | Panels touch edge-to-edge with border-subtle separator — no gutters || **Compact list rows 28px height** | Sidebar session items, settings list rows |+ | **Sidebar rhythm 1px / 2px / 8px** | Sidebar lists: 1px between rows, 2px from a group header or section label to its first row, 8px after an expanded project group and between sidebar sections (1px when the preceding group is collapsed) || **Button rows 32px height** | Standard buttons || **Never exceed 24px vertical gap** | Even for "breathing room" — this is a workstation |-| **Max content width 720px** | Chat messages, tool disclosure rows — prevent over-wide eye-span |+| **Max content width 760px default** | Chat band is user-resizable (min 560px); user plates stay compact |## 14. Do / Don'tdiff --cc docs/spec/08-meta/decisions-log.mdindex c8cae6c6e,07b29fd39..c2c00dc49--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@@ -5790,52 -5758,105 +5790,155 @@@ that was sitting at the bottom — incl- Renderer plus one narrow main-process capability: no protocol, schema, hostRPC, permission, storage, or preference change. See ADR 0273,`03-runtime/01-ipc-protocol.md` §9, `04-ux/08-component-spec.md`, and E2E-258.++## 2026-09-16 — Draggable chat content width (D439)++- The centered conversation band, empty-home stack, and composer share one+ preferred max width, default 760px, persisted as+ `AppSettings.chatContentMaxWidth`. Dual edge handles (invisible at rest,+ glow on hover, hairline while dragging) change that width together so the+ column stays centered. Drag floor is 560px.+- The live used width is `min(available pane minus 24px gutters, preferred)`,+ so a squeezed sidebar or work panel compresses the band without rewriting+ the preference. The collapsed-sidebar 640px ceiling is removed.+- Assistant, tool, and decision rows follow the band. User plates stay+ `min(82%, 600px)`. Renderer only. See ADR 0274, E2E-208, and+ E2E-CHAT-content-width-handles.++## 2026-09-17 — Session and project rows delete on the second click (D441)++- The sidebar's session item and both project menus (sidebar and Projects index)+ removed the row on the first click of Delete. Every other destructive row+ action — the settings provider rows, vendor accounts, and the capability+ tables — arms first and relabels the control, so the two most destructive+ actions were the only ones that fired on a single click.+- `hooks/use-armed-delete.ts` now owns that pattern for the whole renderer: one+ `ARMED_DELETE_MS` (3200ms) expiry and one `useArmedDelete()`. The capability+ pages keep importing it from `AgentCapabilityLayout`, which re-exports the+ shared hook instead of holding a second copy with a timeout of its own, so the+ pattern cannot drift between the settings rows and the two menus.+- A session item arms on `session.id`; both project menus arm on a+ `project:`-prefixed key, so a session and a project can never share an arm. An+ armed item carries `data-armed="true"`, a danger wash, and the label+ `nav.deleteTaskConfirm` / `project.deleteMenuConfirm` ("Delete?" / "确认删除?")+ in all eight catalogs. The menu stays open between the two clicks, and an+ outside press, Escape, or the expiry clears the arm without removing anything.+- Amends D431 for the idle case: a project whose turn is still live still opens+ `ProjectDeleteDialog`, which names those sessions and stops them before it+ deletes, and the host's 1008 / `CONFLICT` refusal is still mapped to+ `project.deleteRunningBlocked` on both paths. A project with no live turn is+ removed by the same store action the dialog used, with the same success toast,+ so its second click is the confirmation the user already gave.+- The number is D441 because D438 was already claimed twice — by the+ window-toggle merge (#360, D438 with the D439 rebind) and by the+ Git-checkout decision (ADR 0273), which this log flags to move to D440.+ This entry does not rewrite another decision's text.+- Renderer only: no protocol, storage, host, permission, or migration change,+ and no new default. The folder on disk is still never touched. See+ `04-ux/09-interaction-patterns.md`, D421, D431,+ `06-delivery/04-e2e-test-plan.md`+ E2E-PROJECT-delete-removes-project-and-owned-sessions, and+ `apps/desktop/test/two-step-delete.test.mjs`.+++ ## 2026-09-16 — The sidebar list rhythm is 1px / 2px / 8px++ - The sidebar's session lists had no rhythm to read. Rows and group headers sat+ flush inside a group (a 0 gap), two project groups sat 2px apart, and the only+ air was the 4px above a section label. Adjacent 28px rows painted rounded+ hover fills that touched, so two rows read as one block, a collapsed group sat+ as far from its neighbour as an expanded group with ten rows under it, and a+ section label was closer to the rows above it than to the rows it introduces.+ - The lists now state one ladder: rows sit 1px apart, a project group header and+ a section label sit 2px above their first row, a sidebar section sits 8px+ below the one above it, and an expanded project group carries an 8px tail.+ - That tail belongs to the expanded group itself, so the spacing is decided by+ the preceding group alone: an expanded group is followed by 8px whether the+ next group is expanded or collapsed, and a collapsed group by 1px either way.+ The scroller's own gap stays a uniform 1px and the difference lives in the+ group body's inset, which leaves with the rows. Collapsing a group therefore+ cannot fork the spacing on a neighbour's state, and cannot snap its own tail.+ - The dated labels inside a project group are ordinary rows of that rhythm+ rather than a second level of groups: they keep no state, no disclosure, and+ no `aria-expanded`, and their own inset becomes a symmetric 4px instead of 6px+ above and 2px below, so a label no longer outweighs the 1px row gap it sits in.+ - `space-0.25` (1px) joins the spacing scale as the hairline step for dense list+ rhythms; the settings rail already used 1px between its navigation items. The+ section-gap rule no longer claims the sidebar, which has its own rhythm.+ - Two row budgets follow the pitch: the pinned body still shows eight rows+ (233px, was 224px) and the standalone Sessions body still shows five (146px,+ was 140px), because the 28px row grid no longer fits its own gaps inside the+ old numbers.+ - Renderer only: no protocol, storage, host, permission, or migration change.+ See `04-ux/07-ui-design-system.md` §6.1 and §13, and+ `04-ux/08-component-spec.md` §6.2 and §6.6.++ ## 2026-09-16 — The sidebar project group folds as one grid row++ - The rhythm above shipped with the group fold animating `max-height: 2000px →+ 0` over the 300ms slow duration, plus a separate 200ms opacity fade and a+ padding transition. A `max-height` curve spends most of its length above the+ content, so the visible move was a short snap at the end, and the shorter+ opacity curve emptied the group roughly two thirds of the way through: the+ rows disappeared first and the empty box closed afterwards. Collapsing a+ project read as two separate animations.+ - The group body is now a one-row grid whose row animates `1fr` → `0fr` over the+ 200ms normal duration. Every frame is a real fraction of the group's measured+ height, so the fold is a single continuous motion, and `opacity` stays 1 for+ the whole fold — the rows leave by being clipped, not by fading.+ - The body is three layers: the grid, a clip with `min-height: 0` and+ `overflow: hidden`, and the list that owns the 1px row gap and the fixed+ 2px / 7px inset. The inset has to sit inside the clip, because vertical+ padding on the animating box holds a `0fr` row open and leaves the group's+ tail behind after its rows are gone.+ - A folded group keeps its rows mounted inside the `0fr` row, so it is `inert`+ as well as `aria-hidden` and leaves the tab order. Under+ `prefers-reduced-motion: reduce` the fold keeps both endpoints and runs in a+ near-zero duration.+ - The scroll budgets, the indent, the pinned and standalone lists, and the+ shared `.sidebar-session-group-body` flex column are unchanged; only the+ project body folds as a grid.+ - Renderer only: no protocol, storage, host, permission, or migration change.+ See `04-ux/08-component-spec.md` §6.2 and+ `06-delivery/04-e2e-test-plan.md` E2E-LAYOUT-sidebar-project-group-fold.++ ## 2026-09-17 — Sidebar selection is distinct from workspace context++ - Project headers and project, pinned and standalone conversation rows share+ one row-level hover surface, radius and transition. Project title buttons+ stay transparent; selected conversation paint takes precedence over hover.+ - A project is a workspace/disclosure control, not a separate selected page.+ The current workspace keeps its dot and all existing workspace behavior but+ no persistent row fill, including when no conversation is selected. The+ renderer marks that context with `data-current-workspace`, not an `active`+ project class. Session selection remains chat-page-aware and follows the+ destination immediately while a switch is pending.+ - Folding a selected conversation does not transfer selection to its project.+ Keyboard focus retains its outline, action buttons retain local feedback,+ window blur releases hover without clearing selection, and drop-target paint+ takes precedence over hover.+ - Renderer presentation only: no persistence, workspace activation, permissions+ or protocol changes. See `04-ux/01-ui-ia.md`, `04-ux/08-component-spec.md`,+ `04-ux/09-interaction-patterns.md` §9.1c and+ E2E-LAYOUT-sidebar-row-states in `06-delivery/04-e2e-test-plan.md`.++ ## 2026-09-17 — Settings shares sidebar material and restores layout without entrance++ - Main and settings navigation now share `sidebar-surface`: the same opaque+ color/image fallback on Windows/Linux and the existing native vibrancy plus+ tint/sheen on macOS. Settings wrapper ancestry allows that native material+ through, while its content pane and content-column titlebar remain opaque.+ Only the inner settings content animates, not the navigation backing.+ - Built-in settings rail colors no longer diverge from the sidebar. Legacy+ `--ds-settings-rail-bg` remains an optional shared fallback; a canonical+ `--ds-bg-sidebar` override wins. No theme or native-window API changes.+ - Sidebar mounting no longer implies expansion. A dedicated transition hook+ distinguishes visible collapsed-state changes from route restoration. Only+ real collapse/expand changes animate; settings navigation cancels unfinished+ phases, and returning restores the retained width/state without replaying+ `sidebar-in`. Animation-end guards, scoped timeout cleanup, auto-restore and+ reduced motion remain supported. Boot presentation uses the existing splash+ reveal instead of a second sidebar width animation.+ - No changes to item indentation, widths, workspace state, data or permissions.+ See `04-ux/06-settings-ia.md`, `04-ux/07-ui-design-system.md`,+ `04-ux/08-component-spec.md` and E2E-LAYOUT-sidebar-settings in+ `06-delivery/04-e2e-test-plan.md`.diff --cc docs/zh-CN/spec/08-meta/decisions-log.mdindex 6c0ba3bf0,53edc9ca5..1bac22d00--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@@ -4331,45 -4330,35 +4331,78 @@@ that amendment are retired by ADR 0268- 主进程新增可加的 `project/cloneCheckout({ url, parentPath })`:它克隆到显式指定的父目录并返回 `{ path, name }`,不更改当前工作空间、也不弹出选择器。`project/clone` 为首页切换器保留原有的原生选择器行为。- 项目创建语义不变:两种来源调用同一个项目 slice 助手,`project-group/create` 仍写入唯一的持久记录,检出目录成为同一逻辑项目组的主要根(ADR 0233)。- 渲染器加一条窄的主进程能力:协议、schema、host RPC、权限、存储与偏好均无变化。见 ADR 0273、`03-runtime/01-ipc-protocol.md` §9、`04-ux/08-component-spec.md` 与 E2E-258。++## 2026-09-16 —— 可拖拽的对话内容宽度(D439)++- 居中的对话带、空首页和输入框共用一个首选最大宽度,默认 760px,持久化为+ `AppSettings.chatContentMaxWidth`。左右边缘各一条手柄(静止不可见、悬停光晕、拖拽时显示细线)同步改这个宽度,列保持居中。拖拽下限 560px。+- 实际宽度是 `min(可用窗格减去两侧 24px, 首选值)`,侧栏或工作区挤压时自适应压缩,不改写偏好。收起侧栏不再把内容带到 640px。+- 助手/工具/决策行跟随内容带;用户气泡仍是 `min(82%, 600px)`。仅渲染器。见 ADR 0274、E2E-208、E2E-CHAT-content-width-handles。++## 2026-09-17 —— 窗口开关键避开 macOS 的关闭窗口组合键(#360,D439)++- D438 把两个键合并到了 `Mod+W`,但这个键不能作为*系统级*全局加速键的默认值:+ macOS 把 `Cmd+W` 用于自己的「关闭窗口」命令,全局占用它等于从所有其它应用程序+ 手里把这个组合键抢走,而不只是关闭本窗口。因此 `Mod+W` 正是开关键唯一不能持有的键。+- 快捷键目录现在把 `toggleWindow` 发布在 `Alt+Shift+W` 上 —— 不含平台修饰键,因此在+ macOS、Windows 与 Linux 上是同一个组合键 —— 它与任何发布默认值、保留的编辑组合键+ 以及平台命令都不冲突。合并本身、隐藏/显示语义、以及退役的+ `closeWindow`/`summonWindow` 覆盖项的折叠规则,完全保持 D438 定义的样子。+- 在 macOS 上 `Mod+W` 现在也拒绝交给插件(`isReservedKeybinding`),因此即使应用不再+ 使用它,平台仍然独占它自己的这个组合键。+- 只重复「本版本发布默认值」或「已被取代的默认值」的 `toggleWindow` 存储值不携带用户+ 意图,折叠时会丢弃:曾经持久化过那个短命 `Mod+W` 默认值的配置会迁移到+ `Alt+Shift+W`,而不是把 macOS 的组合键冻结住;真实改绑(`Ctrl+Alt+T`)与明确的+ 「未绑定」(`null`)原样保留,退役项的自定义值也仍然优先于被丢弃的旧默认值。+- 编号取 D439,因为 D435 与 D437 已被其它在途工作占用。**注意**:本日志当前有两处+ `D438` —— 本文件上方的窗口开关键合并决策(#360,重绑前)与紧随其后的 Git 检出决策+ (ADR 0273)。后者是在开关键 D438 合入之后才追加的,编号需要由其作者改到 D440 或+ 之后的可用号;本条不代为改写他人决策正文。+- 见 ADR 0211(再次修订)、`04-ux/09-interaction-patterns.md` §1.1 与 §1.4、+ `04-ux/06-settings-ia.md`(快捷键选项卡)、`07-plugins/03-plugin-api.md`、+ `07-plugins/04-plugin-security.md`、E2E-072 与+ `apps/desktop/test/window-toggle-shortcut.test.mjs`。++## 2026-09-17 —— 会话与项目行在第二次点击时才删除(D441)++- 侧边栏的会话菜单项与两个项目菜单(侧边栏与项目索引)此前在第一次点击「删除」时就移除该行。应用内其他所有破坏性行操作 —— 设置里的模型服务行、厂商账户行以及能力表格 —— 都先武装再改写控件标签,于是最不能撤销的两个动作反而是唯一单击即生效的。+- 这一模式现在由 `hooks/use-armed-delete.ts` 为整个渲染层拥有:同一个 `ARMED_DELETE_MS`(3200ms)失效时间与同一个 `useArmedDelete()`。能力页面继续从 `AgentCapabilityLayout` 导入它,而该布局改为再导出这个共享 hook,不再保留一份带自己超时的副本,因此这一模式不会在设置行与两个菜单之间漂移。+- 会话菜单项以 `session.id` 作为武装键;两个项目菜单则以 `project:` 前缀的键武装,因此会话与项目永远不会共用一次武装。被武装的菜单项带 `data-armed="true"`、危险色淡底,并在八种语言里都把标签换成 `nav.deleteTaskConfirm` / `project.deleteMenuConfirm`("Delete?" / "确认删除?")。两次点击之间菜单保持打开;点击外部、按 Escape 或武装超时都会解除武装且不移除任何内容。+- 这是对 D431 在空闲场景下的修订:仍有运行中轮次的项目依然打开 `ProjectDeleteDialog`,由它指明这些会话并先停止它们再删除;宿主的 1008 / `CONFLICT` 拒绝在两条路径上仍映射为 `project.deleteRunningBlocked`。没有运行中轮次的项目由对话框原本使用的同一个 store 动作移除,并发出同样的成功 toast,因此它的第二次点击就是用户已经给出的确认。+- 编号取 D441:D438 已被两处占用 —— 窗口开关键合并(#360,D438 与后续的+ D439 重绑)与 Git 检出决策(ADR 0273),后者本日志已标明要改到 D440。本条不+ 代为改写他人决策正文。+- 仅渲染层:无协议、存储、宿主、权限或迁移改动,也没有新增默认值。磁盘上的文件夹仍永远不被触碰。见 `04-ux/09-interaction-patterns.md`、D421、D431、`06-delivery/04-e2e-test-plan.md` 的 E2E-PROJECT-delete-removes-project-and-owned-sessions,以及 `apps/desktop/test/two-step-delete.test.mjs`。+++ ## 2026-09-16 —— 侧边栏列表节奏为 1px / 2px / 8px++ - 侧边栏的会话列表原本没有可供阅读的节奏。行与分组标题在一个分组内紧贴(0 间隙),两个项目分组相距 2px,唯一的留白是分区标签上方的那 4px。相邻的 28px 行绘制的圆角悬停填充彼此相接,于是两行读起来像一整块,折叠的分组与相邻分组的距离,和一个展开后带十行的分组一样远,而分区标签距离它上方的行,比距离它所引出的行更近。+ - 这些列表现在陈述同一条阶梯:行与行之间相隔 1px,项目分组标题与分区标签位于其首行上方 2px,侧边栏分区位于其上方分区之下 8px,展开的项目分组带有一段 8px 的尾部。+ - 该尾部属于展开的分组本身,因此间距仅由前一个分组决定:展开的分组之后是 8px,无论下一个分组是展开还是折叠,折叠的分组之后则是 1px,两种情况都一样。滚动容器自身的间隙保持统一的 1px,差异存在于分组主体的内缩量中,它会随行一起消失。因此折叠一个分组既不会让间距取决于相邻分组的状态,也不会让它自己的尾部突然跳变。+ - 项目分组内的日期标签是该节奏中的普通行,而不是第二层分组:它们不保留状态、不保留展开披露,也没有 `aria-expanded`,并且它们自身的内缩量改为对称的 4px,而不再是上方 6px、下方 2px,于是它们不再盖过 1px 的行间隙。+ - `space-0.25`(1px)作为密集列表节奏的发丝级步进加入间距比例;设置栏在其导航项之间本来就已经使用 1px。节间隙规则不再声称适用于侧边栏,侧边栏有自己的节奏。+ - 两个行预算随该节距变化:固定主体仍显示八行(233px,原为 224px),独立的会话主体仍显示五行(146px,原为 140px),因为 28px 的行网格已无法把自身的间隙容纳进旧的数字里。+ - 仅渲染层:无协议、存储、宿主、权限或迁移改动。见 `04-ux/07-ui-design-system.md` §6.1 与 §13,以及 `04-ux/08-component-spec.md` §6.2 与 §6.6。++ ## 2026-09-16 —— 侧边栏项目分组以单行网格折叠++ - 上述节奏上线时,分组折叠使用的是 300ms 慢速时长上的 `max-height: 2000px → 0`,外加一段独立的 200ms opacity 淡出与 padding 过渡。`max-height` 的曲线大部分长度都落在内容高度之上,于是可见的位移只是末尾的一小段跳变;而更短的 opacity 曲线在约三分之二处就把分组清空了:行先消失,空盒子随后才合上。折叠一个项目读起来像是两段彼此分离的动画。+ - 分组主体现在是一个单行网格,其行在 200ms 的正常时长内从 `1fr` 动画到 `0fr`。每一帧都是该分组实测高度的真实比例,因此折叠是一次连续运动,并且整个折叠过程中 `opacity` 始终为 1 —— 行是被裁剪掉的,不是淡出的。+ - 主体由三层组成:网格层、带 `min-height: 0` 与 `overflow: hidden` 的裁剪层,以及持有 1px 行间隙与固定 2px / 7px 内缩量的列表层。内缩量必须位于裁剪层内部,因为动画盒上的垂直内边距会把 `0fr` 行撑开,并在行消失后留下分组的尾部。+ - 折叠的分组仍把行挂载在该 `0fr` 行内,因此它同时是 `inert` 与 `aria-hidden`,并离开 Tab 顺序。在 `prefers-reduced-motion: reduce` 下,折叠保留两端状态并以接近零的时长完成。+ - 滚动预算、缩进、固定与独立列表,以及共享的 `.sidebar-session-group-body` 弹性列都保持不变;只有项目主体以网格折叠。+ - 仅渲染层:无协议、存储、宿主、权限或迁移改动。见 `04-ux/08-component-spec.md` §6.2 与 `06-delivery/04-e2e-test-plan.md` 的 E2E-LAYOUT-sidebar-project-group-fold。++ ## 2026-09-17 —— 侧边栏选中态与工作区上下文分离++ - 项目标题与项目、置顶、独立会话行共享整行悬停背景、圆角和过渡;标题按钮透明,会话选中背景优先于悬停,不再叠加第二层背景。+ - 项目是工作区和折叠控件,不是独立选中的页面。当前工作区保留圆点及业务行为,但不再绘制持久选中背景,没有选中会话时也不例外。上下文由 `data-current-workspace` 标记,不再使用项目的 `active` 类。+ - 会话选中仍以聊天页及正在切换的目标为准;折叠分组不转移选中态。焦点轮廓、操作按钮反馈、窗口失焦释放和拖拽目标优先级保持独立。+ - 仅改变渲染表现,不改变持久化、工作区激活、权限或协议。见 `04-ux/01-ui-ia.md`、`04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md` §9.1c 及 `06-delivery/04-e2e-test-plan.md` 的 E2E-LAYOUT-sidebar-row-states。++ ## 2026-09-17 —— 设置共享侧栏材质,返回直接恢复布局++ - 主侧栏与设置导航共享 `sidebar-surface`:Windows/Linux 共享不透明颜色和背景图,macOS 共享现有原生 vibrancy、tint 与 sheen。设置外壳允许材质透出,右侧内容与顶部条保持不透明;仅内容内部播放入场动画。+ - 旧 `--ds-settings-rail-bg` 作为共享颜色的可选回退保留,显式 `--ds-bg-sidebar` 优先;不修改主题或原生窗口 API。+ - 侧栏挂载不再等同于展开。专用过渡 hook 只响应可见主界面的折叠状态变化,设置导航取消未完成阶段,返回恢复既有宽度和状态,不重播 `sidebar-in`。动画事件防护、超时清理、自动恢复及减少动态效果仍保留;首次显示由原有启动揭示处理,不再叠加侧栏宽度动画。+ - 不改变 item 缩进、宽度、工作区状态、数据或权限。见 `04-ux/06-settings-ia.md`、`04-ux/07-ui-design-system.md`、`04-ux/08-component-spec.md` 及 `06-delivery/04-e2e-test-plan.md` 的 E2E-LAYOUT-sidebar-settings。