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 remote-tracking branch 'origin/main' into fix/issue-324-disclosure-scroll-anchor
vastsa7dcdcea20432
diff --cc apps/desktop/src/features/chat/transcript/ChatTranscript.tsxindex 042ab4832,3ad13d5c0..2080426ad--- a/apps/desktop/src/features/chat/transcript/ChatTranscript.tsx+++ b/apps/desktop/src/features/chat/transcript/ChatTranscript.tsx@@@ -168,9 -166,15 +168,16 @@@ export const ChatTranscript = memo(func!assistantIsAnswering &&!hasSpecializedActivity;+ // The tail status lane is part of the layout for the whole running turn: the+ // indicators below mount and clear with the turn's phase, and a lane that+ // came and went with them would resize `.thread-content` and push the rows+ // the user is already reading (issue #323). An idle transcript renders no+ // lane at all, so a finished transcript keeps its exact layout.+ const runtimeStatusLane = transcriptRunning;+return (<TranscriptSearchContext.Provider value={searchTarget}>+ <DisclosureAnchorContext.Provider value={disclosureAnchorNotifier}><divclassName="thread-wrap"ref={wrapRef}diff --cc docs/spec/08-meta/decisions-log.mdindex 72d889d3d,afcc2a327..0c3bbe860--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@@ -5351,42 -5351,30 +5351,69 @@@ its menu instead of the conversation`03-runtime/04-data-storage.md`, `04-ux/08-component-spec.md` (§11), andE2E-QUEUE-promote-orders-delivery-by-click.+## 2026-09-16 — A manual disclosure keeps the reader's place (D430)++- **A manual disclosure hands its own title to the scroller that owns it,+ synchronously, before the expansion state changes.** The content+ `ResizeObserver` still re-pins a pinned transcript on every content resize+ (D287) and cannot tell a stream from a reader expanding a row, so the reader+ states their intent first: the transcript leaves follow mode and the scroller+ restores that title's viewport offset from inside the same observer, for as+ many frames as the height keeps changing (an activity group animates its+ `grid-template-rows`). `overflow-anchor: none` on `.thread-scroll` means this+ has to be explicit.+- **The anchor is the title element's offset from the scroller's top edge, not a+ `scrollTop`, and the browser's own boundary clamping is adopted as the new+ anchor.** A correction the content cannot reach, and a height change above the+ title, are both handled without fighting the browser frame after frame. There+ is no delayed "take the bottom back" compensation: the hold ends on real scroll+ input, the jump-to-latest control, a new turn, or a navigation.+- **Every scroll owner holds its own position and passes the hold outward.** The+ transcript scroller and the nested delegate dock (`useFollowScroll`, D302) share+ one controller; growing the dock grows the transcript's content, so an outer+ scroller still in follow mode would drag the same title away.+- **Input is attributed to the scroller that can consume it.** Only input that+ really moves a container may release follow or a held position: a press on a+ row, a control or an editable field is an ordinary click, a keystroke in a text+ field belongs to the field, and input a nested scroller consumes is not the+ outer scroller's gesture. Arrow keys still scroll and Space still activates a+ focused title.+- **Programmatic immediate scrolling records the `scrollTop` the scroller+ actually reached**, and a sub-pixel tolerance is applied only to scroll events+ no gesture produced. At DPR 1.1 follow asked for 841 and got 840.909; compared+ strictly that fraction read as the reader scrolling up and dropped follow mode.+ Real gestures are still compared exactly, so a one-pixel scroll unpins.+- Renderer only: no protocol, storage, host, permission, or migration change.+ See `04-ux/09-interaction-patterns.md` §9.1 and+ E2E-CHAT-disclosure-toggle-keeps-reading-position.++Readers reported that clicking a tool, thinking or activity title to expand it+dragged the whole transcript up by the height of the opened detail, in a session+that was sitting at the bottom — including after the turn had finished.+ ## 2026-09-16 — The delete dialog, not the menu, owns the running-task refusal (#360, D431)++ - Amends the renderer half of D421. The sidebar menu and the Projects index menu+ refused Delete project with a transient `project.deleteRunningBlocked` warning+ whenever any of the project's sessions was running, and returned before+ `ProjectDeleteDialog` was ever mounted. The refusal vanished with the toast+ and left no path forward, so a project with one live task could not be deleted+ at all — which is how #360 ("项目管理中无法真正删除项目") reads.+ - Both menus now always open the dialog. Each surface passes the project's live+ running session ids (`runningSessions[session.id]`, over the rows it already+ matches: `entry.sessions` in the sidebar, `sessionMatchesIndexProject` in the+ index), and the dialog derives its copy from that prop on every render, so a+ turn that starts or finishes while the dialog is open is reflected before the+ user confirms.+ - The dialog adds a warning line naming `{{count}}` running sessions and swaps+ its confirm label to `project.deleteRunningConfirm` ("Stop tasks and delete").+ Confirming aborts exactly those sessions and only then calls `deleteProject`,+ so removing a running turn stays a second, explicit confirmation of a stated+ consequence. Cancelling removes nothing.+ - The host guard is unchanged: `projects.remove` still refuses with 1008 /+ `CONFLICT` while an attached session has a running turn, and the dialog still+ maps that refusal to `project.deleteRunningBlocked`. A turn that starts after+ the abort loop is what that fallback covers.+ - Renderer only: no protocol, storage, host, permission, or migration change,+ and no new default. `project.deleteRunningBlocked` keeps its meaning, copy,+ and every translation. See ADR 0251, D421, and+ E2E-PROJECT-delete-running-sessions-are-named-and-stopped.diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 520e7f1da,bbf9b3d80..750a99ede--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@@ -7336,13 -7362,21 +7365,31 @@@ 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)。diff --cc docs/zh-CN/spec/08-meta/decisions-log.mdindex c5f72aab8,d5dcf6b29..de54ab62a--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@@ -4186,13 -4186,10 +4186,20 @@@ the retained upstream work-panel lifecy- 优先区块以**相邻的用户消息**投递:第一个已优先条目在边界处启动回合,其余条目通过引导通道注入同一回合,因此整块只被回复一次,而不是每行各回一次。被注入条目自己的回合被标记为已取消;运行时拒绝接收的条目仍留在队列中,在下一个边界作为自己的回合启动。- 已结算的回合对队列具有权威性:终态事件可能被丢弃(Main 不会转发点名它已不再拥有的回合的终态事件),也可能根本没发出,而留在 Host 中处于活动状态的回合会永久占住该会话的队列——“点立即发送再暂停”导致的卡住正源于此。现在结算会在模块内关闭该回合,且在 drain 进行中到达的请求会被重试而不是丢弃。见 ADR 0265、`03-runtime/01-ipc-protocol.md`(§5.6)、`03-runtime/04-data-storage.md`、`04-ux/08-component-spec.md`(§11)与 E2E-QUEUE-promote-orders-delivery-by-click。+## 2026-09-16 —— 手动展开详情时保持阅读位置(D430)++- **手动展开会把自己的标题交给拥有它的滚动器,发生在展开状态改变之前、且是同步的。** 内容 `ResizeObserver` 仍会在每次内容尺寸变化时重新触底一个已固定的转录(D287),它无法区分「流式增长」和「读者展开一行」,所以先让读者表达意图:转录退出跟随模式,滚动器在同一个观察器回调内恢复该标题的视口偏移,持续覆盖高度仍在变化的每一帧(活动组会动画 `grid-template-rows`)。`.thread-scroll` 上的 `overflow-anchor: none` 意味着这件事必须显式做。+- **锚点是标题元素相对滚动器顶边的偏移,而不是 `scrollTop`;浏览器自身的边界夹紧会被采纳为新的锚点。** 内容无法到达的修正量、以及标题上方同时发生的高度变化,都在不与浏览器逐帧对抗的前提下被处理。没有延时「把底部抢回来」的补偿:hold 会在真实滚动输入、跳到最新控件、新一轮或导航时结束。+- **每个滚动所有者各持自己的位置,并把 hold 向外传递。** 转录滚动器与嵌套的委派停靠区(`useFollowScroll`,D302)共用同一个控制器;停靠区变高同时也在增大转录的内容高度,因此仍处于跟随模式的外层滚动器会把同一个标题再次拽走。+- **输入会归属到真正能消费它的滚动器。** 只有真正能让某个容器移动的输入才可以释放跟随或已持有的位置:按在行、控件或可编辑字段上属于普通点击,文本框里的按键属于该字段,被嵌套滚动器消费的输入不算外层的手势。方向键仍能滚动,Space 仍能激活已获得焦点的标题。+- **程序化的立即滚动记录的是滚动器实际到达的 `scrollTop`**,并且亚像素容差只作用于非手势产生的滚动事件。在 DPR 1.1 下跟随请求 841 而实际得到 840.909,严格比较时这个小数会被读成读者向上滚动并解除跟随。真实手势仍按精确值比较,所以一个像素的上滚依然会解除固定。+- 仅渲染层:无协议、存储、宿主、权限或迁移改动。见 `04-ux/09-interaction-patterns.md` §9.1 与 E2E-CHAT-disclosure-toggle-keeps-reading-position。++有读者反馈:点击工具、思考或活动标题展开时,整个转录会被拽上去整整一个展开详情的高度,即使是停在底部、甚至该轮已经结束的会话也一样。+ ## 2026-09-16 —— 运行中任务的拒绝归属删除对话框,而不是菜单(#360,D431)++ - 修订 D421 的渲染层一半。侧边栏菜单与项目索引菜单一旦发现该项目有任何会话在运行,就用一条转瞬即逝的 `project.deleteRunningBlocked` 警告拒绝「删除项目」,并在 `ProjectDeleteDialog` 挂载之前就返回。这条拒绝随 toast 一起消失,没有留下任何可继续的路径,于是带有一个在跑任务的项目根本无法删除 —— 这正是 #360(「项目管理中无法真正删除项目」)所描述的体感。+ - 现在两个菜单都始终打开该对话框。每个入口都会传入该项目当前在运行的会话 id(`runningSessions[session.id]`,作用于它本来就已匹配的行:侧边栏的 `entry.sessions`、索引的 `sessionMatchesIndexProject`),对话框在每次渲染时从该 prop 推导文案,因此对话框打开期间新开始或已结束的回合都会在用户确认之前被反映出来。+ - 对话框新增一行警告,点名有 `{{count}}` 个会话正在运行,并把确认按钮文案换成 `project.deleteRunningConfirm`(「停止任务并删除」)。确认会精确中止这些会话,然后才调用 `deleteProject`,所以删除一个正在运行的回合仍然是针对已陈述后果的第二次显式确认。取消不删除任何东西。+ - 宿主侧的守卫未改动:只要仍有关联会话存在运行中的回合,`projects.remove` 依旧以 1008 / `CONFLICT` 拒绝,对话框也依旧把该拒绝映射为 `project.deleteRunningBlocked`。中止循环之后才开始的回合,正是这条兜底覆盖的情况。+ - 仅渲染层:无协议、存储、宿主、权限或迁移改动,也没有新增默认值。`project.deleteRunningBlocked` 的含义、文案与全部翻译保持不变。见 ADR 0251、D421 与 E2E-PROJECT-delete-running-sessions-are-named-and-stopped。