Skip to content

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

Merge remote-tracking branch 'origin/main' into fix/two-step-delete-confirm

vastsae29066f0b3db
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index fc2cf0ede,57b297119..6005f5085
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -8164,31 -8180,6 +8184,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, D438
++- **Specs linked**: `04-ux/09-interaction-patterns.md` §1.6, D421, D431, D441
+- **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 4b7d14afd,289bdc08f..a73fbd445
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@@ -5684,33 -5768,25 +5768,60 @@@ that was sitting at the bottom — incl
`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)
+ ## 2026-09-17 — A git checkout is a Create project source (D438)
+
+ - The Create project dialog only collected a project name and local folders
+ (ADR 0233), and the home switcher's Clone git project entry renders inside the
+ hero of a project-bound session. A fresh installation therefore had to open an
+ unrelated local folder before any repository could be cloned.
+ - The dialog now owns a source selector with two equal peers: This computer and
+ Git repository. The git source keeps the one name field (seeded from the
+ repository name until the user types), adds a repository URL field and one
+ clone destination row, and parses URLs with the switcher's `parseGitCloneUrl`
+ rules, so private, loopback, link-local, credential-bearing, and malformed
+ remotes keep Create disabled (ADR 0247).
+ - Main exposes additive `project/cloneCheckout({ url, parentPath })`: it clones
+ into the explicit parent folder and returns `{ path, name }` without touching
+ the active workspace and without opening a picker. `project/clone` keeps its
+ native-picker behavior for the home switcher.
+ - Project creation is unchanged: both sources call one project-slice helper,
+ `project-group/create` still writes the only durable record, and a checkout
+ becomes the primary root of the same logical group (ADR 0233).
+ - Renderer plus one narrow main-process capability: no protocol, schema, host
+ RPC, 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-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`.
diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 4650c0b8f,a0ae0965b..073981db3
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@@ -5564,24 -5570,6 +5574,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、D438
++- **链接规格**:`04-ux/09-interaction-patterns.md` §1.6、D421、D431、D441
+- **验收**:品质
+- **里程碑**: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 d1ebf21a0,ef5ec6e8a..15eb5d209
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@@ -4287,10 -4287,71 +4287,82 @@@ that amendment are retired by ADR 0268
- 它的控件移到该板的内嵌层 —— 也就是 `.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)
+ ## 2026-09-17 —— 呼出与隐藏窗口合并为一个开关键(#360,D438)
+
+ - issue #360 第 3 项要求把「呼出窗口」与「隐藏/关闭窗口」两个全局快捷键合并成一个键。
+ D384 当年给的恰好是相反的安排 —— `summonWindow`(`Mod+Shift+W`)作为
+ `closeWindow`(`Mod+W`)的「对称键」,并由 `04-ux/09-interaction-patterns.md` §1.1
+ 记载 —— 因此 D438 取代 D384 的这一半;同一条决策里的插件 Plan 安全动作选项不受影响。
+ 编号跳过 D435 与 D437,因为其它在途工作已先占用。
+ - 快捷键目录现在只保留 `window` 组里的一个 `toggleWindow`;`closeWindow` 与
+ `summonWindow` 已从 `KEYBOARD_SHORTCUT_IDS` 移除,因此两个退役组合键都不再被任何
+ 东西占用:它们既不是随应用发布的默认值,也不会注册到 `globalShortcut`,既不是设置行,
+ 也不是菜单加速键,而被释放出来的 `Mod+Shift+W` 可以重新交给插件使用。D439 后来把
+ 开关键自己的默认值从 D438 选的 `Mod+W` 挪开;合并后的 id、切换语义与下面的迁移规则
+ 都不受这次改键影响。
+ - 按下这个键是一次判定,而不是一次关闭。`windowToggleAction` 对可见且在前台的窗口执行
+ `Window.hide()`,其余情况显示并获得焦点(已隐藏、已最小化、被其它应用挡在后面都算
+ 「不可见」)。`Window.hide()` 就是隐藏的全部路径,所以 Windows/Linux 的关闭行为询问、
+ 其中的「退出」选项、`window-all-closed` 与 `before-quit` 都不会被触达,没有窗口被销毁,
+ 应用继续运行;托盘图标、同一个键或 macOS 的应用激活都能把窗口调回来。
+ `windowControl("close")` 仍是窗口自己的关闭按钮,依旧走关闭行为。
+ - 已持久化的 `settings.keybindings` 仍可能写着这两个已退役的 id,两个进程遵循同一条规则:
+ `migrateKeybindingOverrides` 在读取时就折叠映射 —— Electron 主进程在注册加速键和构建
+ 菜单之前,渲染层 store 在任何消费方看到它之前 —— 因此没有任何表面会按退役 id 行事。
+ 规则有序且幂等:已存在的 `toggleWindow` 覆盖原样胜出;否则第一个带*绑定值*的退役项胜出,
+ `closeWindow` 优先,因为隐藏才是开关键的主要职责;只有在没有绑定值竞争时,
+ 仅写入 `null` 的退役项才被尊重,所以明确的「未绑定」不会被随应用发布的默认值顶替;
+ 与自身退役默认值相同的存储值不携带任何意图(设置界面会删除等于发布默认值的覆盖项),
+ 因此 `Mod+W`/`Mod+Shift+W` 这类值会被丢弃而不是被复活。存储本身不做改写:折叠后的映射
+ 由下一次快捷键保存写入,旧版本读到新映射时只是忽略不认识的 id。
+ - 窗口可见性键在 macOS、Windows 与 Linux 上都是受支持的全局快捷键,因此按一个键来记录:
+ 菜单标签与设置行在全部八套语言包里本地化,快捷键卡片显示唯一的一行「窗口」,
+ 而不是两行互相矛盾的行。
+ - 见 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`、`03-runtime/01-ipc-protocol.md`
+ (`NATIVE_MENU_ACTIONS`)、E2E-072 与
+ `apps/desktop/test/window-toggle-shortcut.test.mjs`。
+
+ ## 2026-09-17 — Git 检出成为新建项目的来源(D438)
+
+ - 新建项目对话框此前只收集项目名称与本地文件夹(ADR 0233),而首页「克隆 Git 项目」入口只在绑定项目的会话 hero 中渲染。全新安装因此必须先打开一个无关的本地文件夹才能克隆仓库。
+ - 对话框现在拥有两种对等来源:此电脑与 Git 仓库。Git 来源保留同一个名称字段(在用户输入前用仓库名预填),增加仓库地址输入框和一个克隆保存位置行,并复用切换器的 `parseGitCloneUrl` 规则,因此私网、回环、链路本地、带凭据与非法远程都会让创建按钮保持禁用(ADR 0247)。
+ - 主进程新增可加的 `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-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`。