Skip to content

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

Merge origin/main into fix/two-step-delete-confirm

vastsae88a03ff6455
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index 1fe1fa0a5,596dcfe3f..fc2cf0ede
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -8159,31 -8160,6 +8164,31 @@@ This test plan spec is accepted when
ids, the dialog's running-session line and stop-and-delete label, the abort
loop running before `deleteProject`, the `CONFLICT` fallback, and the new
copy in every shipped catalog; the end-to-end journey remains Draft
+
+### E2E-SESSION-two-click-delete-arms-first
+
+- **Preconditions**: a project with one idle session and one running session,
+ both reachable from the sidebar session menu, the sidebar project menu, and
+ the Projects index.
+- **Steps**: open the session menu of the idle session, press Delete once, and
+ leave the item armed until the arm expires before pressing it again to confirm
+ the removal. Repeat for a project row from the sidebar menu and from the
+ Projects index.
+- **Expected**: the first press removes nothing and relabels the item to
+ `nav.deleteTaskConfirm` / `project.deleteMenuConfirm` ("Delete?" / "确认删除?")
+ with `data-armed="true"`; the menu stays open, and an outside press, Escape, or
+ the expiry clears the arm without removing anything. Only the second press
+ removes the session with its transcript and its row, and only the second press
+ on a project row removes an idle project. A session and a project never share
+ an arm. Deleting a project whose turn is live still opens the dialog that names
+ those sessions and stops them (see
+ E2E-PROJECT-delete-running-sessions-are-named-and-stopped).
- - **Specs linked**: `04-ux/09-interaction-patterns.md` §1.6, D421, D431, D437
++- **Specs linked**: `04-ux/09-interaction-patterns.md` §1.6, D421, D431, D438
+- **Acceptance criterion**: Quality
+- **Milestone**: M6+
+- **Status**: Partially automated — `apps/desktop/test/two-step-delete.test.mjs`
+ pins the shared arm and its expiry, both labels in every shipped catalog, and
+ that the first press only arms; the end-to-end journey remains Draft
### US-UI-59 Session-rooted background tools
- Start a visible turn in project A, switch to project B while it runs, and
inspect both sidebar status indicators.
diff --cc docs/spec/08-meta/decisions-log.md
index 1afd05158,580fc0f7b..4b7d14afd
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@@ -5654,33 -5654,32 +5654,63 @@@ that was sitting at the bottom — incl
`03-runtime/09-logging-and-observability.md`, and
`06-delivery/04-e2e-test-plan.md` E2E-SKILL-MARKET-NET-BOUNDARY.
- ## 2026-09-17 — Session and project rows delete on the second click (D437)
+ ## 2026-09-17 — The dock question card is a composer plate (#360, D437)
+
+ - The asktool question card is mounted in the transparent composer dock
+ (`Composer.tsx` renders it as a direct `.composer-stack` child, and the
+ transcript mount is gone), yet it still painted the in-flow `--ds-tile` wash:
+ a 3.5% ink mix with no shadow. On the light page that leaves a `#f7f7f7`
+ panel with white option rows next to the composer plate below it, which is
+ how #360 item 1 ("选择交互面板缺少背景色") reads. The dock rule's own comment
+ already claimed the card "uses the same decision surface as Plan and Goal
+ approval", while `.plan-approval-bar` in that exact slot paints
+ `--ds-bg-composer` with `--ds-shadow-composer` (`04-ux/03-permission-ux.md`
+ §9, `04-ux/08-component-spec.md` §11.5).
+ - `.composer-stack > .asktool-card` now paints that plate: `--ds-bg-composer`
+ with `--ds-shadow-composer` (light `#ffffff`, dark
+ `color-mix(in oklab, #212121 96%, transparent)` with the composer shadow).
+ - Its controls move to the plate's inlaid tier, the layer `.plan-approval-split`
+ already uses on that same plate: `.asktool-option` and
+ `.asktool-custom-input` drop `--ds-raised` and `--ds-raised-shadow` for
+ `--ds-tile-deep`, and the hover/selected mix is rebased on `--ds-tile-deep`.
+ Without that flip the rows would be white on white in the light palette,
+ where `--ds-raised` and `--ds-bg-composer` are both `#ffffff`. The 15 px
+ option mark keeps `--ds-tile-deep` — the sidebar checkbox's mark — which
+ still reads against the inlaid row exactly as it does against the sidebar.
+ - Renderer only: no protocol, storage, host, permission, migration, or
+ preference change, and no new default. Both layers are existing tokens in
+ both palettes, so a contributed theme moves the plate and the rows with
+ `--ds-bg-composer` / `--ds-tile-deep`. See
+ `04-ux/11-asktool-question-card.md`, `04-ux/07-ui-design-system.md` §6.4, and
+ E2E-078.
++
++## 2026-09-17 — Session and project rows delete on the second click (D438)
+
+- 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.
+- 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`.
diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 23bea7406,c2d4936d0..4650c0b8f
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@@ -5561,24 -5560,6 +5564,24 @@@ IPC 请求无法关闭�
先于 `deleteProject` 执行、`CONFLICT` 兜底路径,以及所有已发布语言包中的新文案;端到端旅程仍为
草稿
+### E2E-SESSION-two-click-delete-arms-first
+
+- **前提条件**:一个包含一个空闲会话和一个运行中会话的项目,二者都可从侧边栏会话菜单、侧边栏
+ 项目菜单以及项目索引到达。
+- **步骤**:打开空闲会话的会话菜单,按一次删除,并让该项保持武装直到武装超时,然后再按一次以
+ 确认移除。对来自侧边栏菜单与项目索引的项目行重复该操作。
+- **预期**:第一次按下不会移除任何东西,并把该项标签改为 `nav.deleteTaskConfirm` /
+ `project.deleteMenuConfirm`("Delete?" / "确认删除?")且带 `data-armed="true"`;菜单保持
+ 打开,点击外部、按 Escape 或武装超时都会解除武装且不移除任何内容。只有第二次按下才会移除
+ 该会话及其转录本和该行,也只有对项目行的第二次按下才会移除空闲项目。会话与项目永远不会共用
+ 一次武装。删除仍有运行中轮次的项目时,仍会打开指明这些会话并停止它们的对话框(见
+ E2E-PROJECT-delete-running-sessions-are-named-and-stopped)。
- - **链接规格**:`04-ux/09-interaction-patterns.md` §1.6、D421、D431、D437
++- **链接规格**:`04-ux/09-interaction-patterns.md` §1.6、D421、D431、D438
+- **验收**:品质
+- **里程碑**:M6+
+- **状态**:部分自动化 —— `apps/desktop/test/two-step-delete.test.mjs` 固定了共享的武装与它的
+ 超时、所有已发布语言包中的两个标签,以及第一次按下只做武装;端到端旅程仍为草稿
+
### US-UI-59 基于会话的后台工具
- 在项目 A 中启动可见轮次,在项目 B 运行时切换到项目 B,并且
检查两个侧边栏状态指示器。
diff --cc docs/zh-CN/spec/08-meta/decisions-log.md
index 1febe037a,23e8411f4..d1ebf21a0
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@@ -4280,10 -4280,9 +4280,17 @@@ that amendment are retired by ADR 0268
- MCP 市场仍使用自己的地址钉定 Node HTTPS 守卫(ADR 0245),本次不变;fake-IP 环境下它的源仍会被拒绝。
- 见 ADR 0272、`05-security/01-security.md` §4.1、`03-runtime/09-logging-and-observability.md` 与 `06-delivery/04-e2e-test-plan.md` 的 E2E-SKILL-MARKET-NET-BOUNDARY。
- ## 2026-09-17 —— 会话与项目行在第二次点击时才删除(D437)
+ ## 2026-09-17 —— dock 内的问题卡是 composer 板(#360,D437)
+
+ - asktool 问题卡挂在透明的 composer dock 里(`Composer.tsx` 把它渲染为 `.composer-stack` 的直接子节点,成绩单内的挂载已移除),但它仍在绘制流动层的 `--ds-tile` 洗色:3.5% 墨色混合、没有阴影。在浅色页面上这留下一块 `#f7f7f7` 面板加白色选项行,紧邻下方的 composer 板 —— 这正是 #360 第 1 项(“选择交互面板缺少背景色”)读到的样子。该 dock 规则自己的注释早已声称这张卡“使用与 Plan/Goal 批准相同的决策表面”,而同一槽位里的 `.plan-approval-bar` 绘制的是 `--ds-bg-composer` 加 `--ds-shadow-composer`(`04-ux/03-permission-ux.md` §9、`04-ux/08-component-spec.md` §11.5)。
+ - `.composer-stack > .asktool-card` 现在绘制那块板:`--ds-bg-composer` 加 `--ds-shadow-composer`(浅色 `#ffffff`,深色 `color-mix(in oklab, #212121 96%, transparent)` 配合 composer 阴影)。
+ - 它的控件移到该板的内嵌层 —— 也就是 `.plan-approval-split` 在同一块板上已经使用的层:`.asktool-option` 与 `.asktool-custom-input` 去掉 `--ds-raised` 与 `--ds-raised-shadow`,改用 `--ds-tile-deep`,悬停/选中混合也以 `--ds-tile-deep` 为基底。不做这次翻转,浅色主题下选项行会白上加白,因为该调色板里 `--ds-raised` 与 `--ds-bg-composer` 都是 `#ffffff`。15 px 的选项标记保留 `--ds-tile-deep` —— 与侧边栏复选框同一枚标记 —— 它与内嵌行之间的对比,和它与侧边栏之间的对比完全一致。
+ - 仅渲染层:无协议、存储、宿主、权限、迁移或偏好改动,也没有新增默认值。两层在两种调色板里都是既有 token,因此贡献主题可以分别用 `--ds-bg-composer` / `--ds-tile-deep` 移动板与行。见 `04-ux/11-asktool-question-card.md`、`04-ux/07-ui-design-system.md` §6.4 与 E2E-078。
++
++## 2026-09-17 —— 会话与项目行在第二次点击时才删除(D438)
+
+- 侧边栏的会话菜单项与两个项目菜单(侧边栏与项目索引)此前在第一次点击「删除」时就移除该行。应用内其他所有破坏性行操作 —— 设置里的模型服务行、厂商账户行以及能力表格 —— 都先武装再改写控件标签,于是最不能撤销的两个动作反而是唯一单击即生效的。
+- 这一模式现在由 `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,因此它的第二次点击就是用户已经给出的确认。
+- 仅渲染层:无协议、存储、宿主、权限或迁移改动,也没有新增默认值。磁盘上的文件夹仍永远不被触碰。见 `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`。