Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
chore: merge main and resolve PR 402 documentation conflicts
zszz34c8e1b28ccb1
diff --cc docs/adr/README.mdindex 9a2bb2a04,2552d60da..9d1f2a894--- a/docs/adr/README.md+++ b/docs/adr/README.md@@@ -283,13 -283,4 +283,14 @@@ Each ADR includes| 0252 | Host turn-end event for plugins | Accepted (D422) || 0253 | [Remove the subagent turn limit](0253-remove-subagent-turn-limit.md) | Accepted (supersedes the `maxTurns` clauses of 0062 / 0063 / 0119 / 0126 / 0166 / 0210) || 0254 | [Continue native Pi sessions in their canonical JSONL](0254-native-pi-session-continuation.md) | Accepted (amends baseline D007; D421) |+| 0257 | [Host-mediated real-time capabilities for plugins](0257-plugin-real-time-capabilities.md) | Accepted for implementation |+| 0258 | [Trusted extension custom agents](0258-trusted-extension-custom-agents.md) | Accepted for implementation (D426; issue #401) |+| 0259 | [Plugin-declared providers are Host-owned rows](0259-plugin-declared-providers.md) | Accepted for implementation (D427) |+| 0255 | [Theme assets are absolute paths](0255-theme-assets-by-absolute-path.md) | Accepted |+| 0256 | [Preserve DeepSeek reasoning across context compaction](0256-deepseek-reasoning-across-compaction.md) | Accepted |+| 0260 | [Plugin runtime theme APIs and sidebar image token](0260-plugin-runtime-theme-apis.md) | Accepted for implementation |+| 0265 | [Priority block and row actions for the Host-owned turn queue](0265-turn-queue-priority-block-and-row-actions.md) | Accepted for implementation (D429; amends ADR 0213 / 0118) |+| session-content-search | [Discover sessions by indexed message text](session-content-search.md) | Accepted |+| transcript-reading-ownership | [Share renderer history and search views](transcript-reading-ownership.md) | Accepted |+| 0266 | [Plugin fs roots follow the calling session](0266-plugin-fs-root-follows-the-calling-session.md) | Accepted (D093) |+ | tray-session-shortcuts | [Bounded session navigation in the native tray](tray-session-shortcuts.md) | Accepted (amends ADR 0078; issue #293) |diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 18d471636,7264efd34..16744d920--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@@ -4894,6 -4879,9 +4894,7 @@@ IPC 请求无法关闭�| A — 应用程序启动 | E2E-001、E2E-002、E2E-003、E2E-004、E2E-067、E2E-076、E2E-079、E2E-092、E2E-097、E2E-143、E2E-150、E2E-168、E2E-204、E2E-217 || B——模型配置 | E2E-005、E2E-005G、E2E-006、E2E-007、E2E-038、E2E-050、E2E-052、E2E-055、E2E-066、E2E-080、E2E-082、E2E-151、E2E-005J、E2E-199、E2E-201、E2E-202、E2E-203、E2E-209、E2E-166 || C — 对话和直播 | E2E-008、E2E-008d、E2E-008a、E2E-009、E2E-010、E2E-011、E2E-011a、E2E-011b、E2E-031、E2E-040、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-052、 E2E-053、E2E-054、E2E-055、E2E-059、E2E-059a、E2E-060c、E2E-060d、E2E-061、E2E-061a、E2E-062、E2E-064、E2E-065、E2E-068、E2E-071、 E2E-073、E2E-074、E2E-075、E2E-081、E2E-083、E2E-084、E2E-086、E2E-087、E2E-088、E2E-088b、E2E-089、E2E-090、E2E-094、E2E-095、E2E-096、 E2E-097、E2E-098、E2E-099、E2E-102、E2E-102a、E2E-102b、E2E-106、E2E-109、E2E-111、E2E-114、E2E-116、E2E-117、E2E-118、E2E-119、 E2E-120、E2E-121、E2E-代理-001、E2E-142、E2E-144、E2E-145、E2E-146、E2E-147、E2E-151、E2E-199、E2E-250、E2E-166 |+ | A / C / F / Quality — Tray session navigation | E2E-TRAY-bounded-session-navigation |-| B——模型配置 | E2E-005、E2E-005G、E2E-006、E2E-007、E2E-038、E2E-050、E2E-052、E2E-055、E2E-066、E2E-080、E2E-082、E2E-151、E2E-005J、E2E-199、E2E-201、E2E-202、E2E-203、E2E-209 |-| C — 对话和直播 | E2E-008、E2E-008d、E2E-008a、E2E-009、E2E-010、E2E-011、E2E-011a、E2E-011b、E2E-031、E2E-040、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-052、 E2E-053、E2E-054、E2E-055、E2E-059、E2E-059a、E2E-060c、E2E-060d、E2E-061、E2E-061a、E2E-062、E2E-064、E2E-065、E2E-068、E2E-071、 E2E-073、E2E-074、E2E-075、E2E-081、E2E-083、E2E-084、E2E-086、E2E-087、E2E-088、E2E-088b、E2E-089、E2E-090、E2E-094、E2E-095、E2E-096、 E2E-097、E2E-098、E2E-099、E2E-102、E2E-102a、E2E-102b、E2E-106、E2E-109、E2E-111、E2E-114、E2E-116、E2E-117、E2E-118、E2E-119、 E2E-120、E2E-121、E2E-代理-001、E2E-142、E2E-144、E2E-145、E2E-146、E2E-147、E2E-151、E2E-199、E2E-250 || D——工作区 | E2E-012、E2E-013、E2E-022B、E2E-024I、E2E-047、E2E-049、E2E-057、E2E-058、E2E-060、E2E-068、E2E-075、E2E-078、E2E-153 || D——工作区(项目排序) | E2E-253 || E——工具和权限 | E2E-008a、E2E-014、E2E-015、E2E-016、E2E-017、E2E-018、E2E-019、E2E-024I、E2E-024K、E2E-040、E2E-049、E2E-074、E2E-093、E2E-097、 E2E-099、E2E-100、E2E-101、E2E-102、E2E-103、E2E-105、E2E-106、E2E-107、E2E-111、E2E-112、E2E-113、E2E-114、E2E-115、E2E-116、 E2E-119、E2E-121、E2E-122、E2E-123、E2E-142、E2E-145、E2E-147、E2E-PLUGIN-imported-pi-package-skills、E2E-166 |@@@ -7358,46 -7264,46 +7359,90 @@@ runner 会在运行时的隔离临时�- **里程碑**:M6+- **状态**:由模块测试覆盖(`apps/desktop/test/session-turn-ended.test.mjs`、`apps/desktop/test/queued-turn-finalization.test.mjs`);桌面旅程为草稿(该表面变更时需在具备条件的环境中运行)+#### E2E-CHAT-disclosure-toggle-keeps-reading-position++- **范围**:滚动器已固定在底部时,手动展开转录或委派运行停靠区里的工具、思考或活动组标题(issue #324)。+- **先决条件**:一个超过一屏的会话,停在底部并开启跟随模式;其中包含一行工具、一行思考和一个活动组,它们的展开详情都高于自身的标题栏;另有一个已展开、拥有嵌套滚动器的委派运行。分别在一轮已结束(`isRunning` 为 false)和一轮正在流式输出时各做一遍。+- **步骤**:在固定于底部时,依次点击工具行、思考行和活动组的标题,并在该轮结束后再点一次。把视口停在转录中部再重复一次;用键盘激活一次(先 Enter,再在获得焦点的标题上按 Space),以及从收起栏操作一次。在已展开的委派停靠区内展开一行工具。然后用滚轮滚动、在标题获得焦点时按 ArrowUp、点击“跳到最新”控件,并发送一条新提示。+- **预期**:详情动画展开与收起期间,被点击的标题保持它在屏幕上的位置,转录不会在它下方重新触底;跟随模式被退出,并出现“回到最新消息”控件。保持的位置在活动组动画的每一帧都成立,也覆盖标题上方同时发生的高度变化。嵌套停靠区保持自己的位置,其背后的转录同样不会重新触底。真实的滚动输入、跳转控件、新一轮以及任何导航都会释放保持并重新跟随实时尾部,而已经向上滚动的阅读者保持原来的位置。Space 仍能激活获得焦点的标题,方向键仍能滚动。+- **链接规格**:`04-ux/09-interaction-patterns.md` §9.1;ADR transcript-reading-ownership;D287、D302、D430+- **验收**:C(对话与流式)、E(工具与权限)、品质+- **里程碑**:M6++- **状态**:部分自动化。`pnpm test:e2e:transcript-disclosure` 在真实的 600 CSS px Electron 视口中挂载真实的转录滚动 hook 与真实的工具行,用真实 DOM 点击标题,并对转录以及嵌套跟随滚动器断言标题相对滚动器顶边的偏移与滚动偏移;没有该修复时,同一个夹具会报告标题移动了整个展开详情的高度。夹具未链接应用样式表,因此高度来自内联填充与组件自身的固有尺寸。`disclosure-anchor.test.mjs` 覆盖纯锚点与输入归属数学,`transcript-disclosure-reading.test.mjs` 覆盖接线。键盘、滚轮与活动组动画路径仍属补充验证。+#### E2E-CHAT-runtime-status-keeps-row-position++- **先决条件**:一个活动会话,其转录高于对话视口,且尾部由一行已完成的工具占用;窗格已构建(`pnpm build:js`)并已安装 Electron。+- **步骤**:+ 1. 用固定消息挂载生产环境的 `ChatTranscript`,尾部由已完成的活动组占用,并让会话处于运行中。+ 2. 在没有任何运行时活动上报的情况下,记录内容高度、滚动器的滚动高度/偏移,以及首行与末行的渲染位置。+ 3. 只把该会话的运行时活动切换到等待模型阶段,让布局稳定下来。+ 4. 再次清空运行时活动,让布局稳定下来。+ 5. 结束该轮(`isRunning` 为 false),检查尾部。+- **预期**:+ - 等待行占用预留的状态通道:在状态出现期间以及清空之后,内容高度、滚动高度、滚动偏移,以及每一个已渲染行的位置都保持不变(误差在 0.01px 以内)。+ - 空通道在深色与浅色两种主题下都保持已预留且不可见 —— 没有背景、边框或阴影。+ - 状态行保持其活动区域语义(`role="status"`、`aria-live="polite"`),而空通道不携带任何可供播报的文本。+ - 已结束的空闲转录完全不渲染状态通道,因此其布局不变。+- **链接规格**:`04-ux/08-component-spec.md`+- **验收**:C(对话与流式)、品质+- **里程碑**:M5+- **状态**:由单测覆盖(`active-turn-surface.test.mjs`),并有通过 `pnpm test:e2e:transcript`(`scripts/e2e/transcript-render.tsx`,无需供应商凭据,需要已安装的 Electron 与图形会话,Linux 上可用 Xvfb)自动化的 React/Chromium 几何回归。当预留通道被移除时,该场景会以 40.125px 的内容高度误差与 40px 的行位移失败(issue #323)。++#### E2E-PLUGIN-fs-root-follows-the-calling-session:插件工具的 fs 根跟随自己的会话,而不是可见工作区++- **先决条件**:两个项目 A 与 B,各自持有一个对方没有的文本文件,以及一个已启用的插件;该插件注册的智能体工具会在 execute 里对根相对路径调用 `pi.fs.readText` 与 `pi.fs.glob`,并声明带 `workspace` 根的 `fs.read`。两个项目都有该插件工具可用的活会话,且窗口显示项目 A。+- **步骤**:+ 1. 从会话 A 调用该工具读取只属于项目 A 的文件,再从会话 B(项目 B)调用它读取只属于项目 B 的文件,期间不切换窗口的可见工作区。+ 2. 把可见工作区切到项目 B,重复上面两次调用。+ 3. 在可见工作区为项目 B 时,让会话 A 的工具请求只存在于项目 A 下的路径,再让会话 B 的工具请求同一路径。+ 4. 打开该插件的面板,在项目 A 可见时通过面板桥做同样的读取,然后在项目 B 可见时再做一次。+ 5. 把其中一个会话移到临时对话,使没有可见工作区,从该会话调用该工具,再在同一状态下调用面板桥。+- **预期**:步骤 1 与 2 每次都以调用会话自己的项目作答:会话 A 读取并 glob 项目 A 的文件,会话 B 对应项目 B 的文件,可见工作区在这两个项目之间移动时答案都不变。步骤 3 对会话 A 返回项目 A 的文件,对会话 B 返回 `NOT_FOUND`,因此会话永远无法触达另一个项目的根。步骤 4 与之前完全一致:每次面板调用解析可见工作区,所以它的答案跟随屏幕上的项目,而不是任一会话。步骤 5 按会话继续工作 —— 会话的插件工具解析自己的项目 —— 而面板调用仍以 `NOT_FOUND`(「没有打开任何工作区」)失败。任何闸门都没有放宽:被拒的名称、`..` 或绝对路径、指向根外的符号链接,以及超出声明范围的路径,其行为与只有一个可见工作区时相同。+- **链接规格**:`07-plugins/03-plugin-api.md` §3、`07-plugins/13-plugin-permissions-matrix.md` §6、ADR 0016、ADR 0249、ADR 0266、D093+- **验收**:G(插件)、安全性、品质+- **里程碑**:M6++- **状态**:部分自动化(`apps/desktop/test/plugin-fs-session-root.test.mjs`):工具调用在发起会话的项目下写入与读取,面板调用与宿主未跟踪的会话回退到可见工作区,`userSelected` 模式保留选定的目录,窗口不显示任何项目时会话根依然生效。双活会话的桌面旅程与面板步骤为草稿(仅在此表面变化时于具备条件的环境中运行)+++ #### E2E-TRAY-bounded-session-navigation++ - **Scope**: Native tray groups, hidden/recreated window activation, and unread+ semantics (issue #293, ADR tray-session-shortcuts).+ - **Preconditions**: At least four running, four unread, and four pinned+ sessions across two projects; include overlaps, read-latest/older-unread+ notifications, archived/deleted sessions, an archived project, empty titles,+ multiline titles, long CJK/emoji titles, and literal ampersands. Also cover+ a single populated group of seven and one of more than nine, with the other+ two groups empty, to exercise reclaimed share. Use an+ isolated profile. Repeat native activation on macOS and Windows/Linux.+ - **Steps**: Hide the main window and open the tray menu. Inspect group order,+ counts, duplicates, titles, and unchanged unread records. Choose the third+ row from another project, then View more from Settings with a collapsed+ sidebar and a retained search query. Finish/abort tasks while hidden;+ read a result, pin/unpin, rename, archive/restore, and delete a session.+ Close the macOS window while a task runs and let it finish, then activate+ its tray row while the new renderer bootstraps a pending plan. Delay a Host+ read while a newer preference update, delete, or Host restart arrives.+ Retry a transient read failure by hovering/right-clicking the tray.+ Repeat after clearing all group memberships and changing shipped locales.+ Choose Quit then Cancel, then Quit and confirm.+ - **Expected**: Running → Unread → Pinned; at most nine rows in total. Each+ non-empty group keeps up to three rows and overflowing groups reclaim the+ share smaller groups leave unused, in priority order: seven running sessions+ with no unread or pinned show all seven, and a single group holding more than+ nine shows nine behind View more. Deduplicate before limits, so hidden+ Running overflow cannot+ appear as Unread/Pinned. Empty groups and stale shortcuts disappear. Unread+ uses the latest terminal result per session, newest first. Titles remain+ one line within the cap, including literal ampersands. Opening the macOS+ menu leaves the window hidden and records unread. A row opens exactly that+ session/project, acknowledges it normally, and wins over startup navigation.+ View more returns from Settings, closes search, and expands session navigation. Hidden/closed windows receive fresh groups;+ stale reads, archived/deleted targets, and a failed backend cannot restore+ stale shortcuts. Open, localization, quit cancellation, and shutdown work.+ - **Specs linked**: `03-runtime/01-ipc-protocol.md` §13b,+ `03-runtime/07-process-model.md`, `04-ux/08-component-spec.md`,+ `04-ux/09-interaction-patterns.md`, ADR tray-session-shortcuts.+ - **Acceptance**: A (app/window lifecycle), C (conversation navigation),+ F (unread persistence), Quality (bounded localized menu).+ - **Milestone**: Post-M6 desktop shell maintenance.+ - **Status**: Draft; native E2E requires an explicitly authorized run.