Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(chat): collapse completed process details
vastsa3cf2e2050985
diff --git a/apps/desktop/src/lib/turn-process.ts b/apps/desktop/src/lib/turn-process.tsindex d37b1066b..502bcbd86 100644--- a/apps/desktop/src/lib/turn-process.ts+++ b/apps/desktop/src/lib/turn-process.ts@@ -66,13 +66,13 @@ export function isLastActivityPart(return false;}-/** Detailed keeps narration visible; compact reveals active failures only. */+/** Active processes open in Detailed; settled processes default closed. */export function shouldAutoOpenTurnProcess(mode: ThinkingDisplayMode,isActive: boolean,hasToolFailure: boolean,): boolean {- return mode === "detailed" || (isActive && hasToolFailure);+ return isActive && (mode === "detailed" || hasToolFailure);}/**diff --git a/apps/desktop/test/turn-process.test.mjs b/apps/desktop/test/turn-process.test.mjsindex 661d74fcc..f63f3c772 100644--- a/apps/desktop/test/turn-process.test.mjs+++ b/apps/desktop/test/turn-process.test.mjs@@ -99,10 +99,11 @@ test("missing and unknown display settings retain detailed mode", () => {assert.equal(resolveThinkingDisplayMode("compact"), "compact");});-test("both display modes group a turn and only compact auto-opens active failures", () => {+test("completed turn processes stay closed by default while active failures remain visible", () => {assert.equal(shouldGroupTurnProcess("detailed"), true);assert.equal(shouldGroupTurnProcess("compact"), true);- assert.equal(shouldAutoOpenTurnProcess("detailed", false, false), true);+ assert.equal(shouldAutoOpenTurnProcess("detailed", false, false), false);+ assert.equal(shouldAutoOpenTurnProcess("detailed", false, true), false);assert.equal(shouldAutoOpenTurnProcess("detailed", true, false), true);assert.equal(shouldAutoOpenTurnProcess("detailed", true, true), true);assert.equal(shouldAutoOpenTurnProcess("compact", false, false), false);diff --git a/docs/adr/turn-process-and-thinking-display.md b/docs/adr/turn-process-and-thinking-display.mdindex 8b9c10b62..3f3020be1 100644--- a/docs/adr/turn-process-and-thinking-display.md+++ b/docs/adr/turn-process-and-thinking-display.md@@ -2,7 +2,7 @@- Status: Accepted- Date: 2026-09-17-- Amended: 2026-09-20+- Amended: 2026-09-27- Issues: #510, #461- Amends: D071, [ADR 0242](0242-delta-only-streaming-updates.md)@@ -33,15 +33,16 @@ its item disclosure directly; hidden compact-mode thinking does not create aredundant wrapper. Existing Task topology remains its segment's container and isnot duplicated inside an ordinary activity group.-Detailed mode starts active and completed whole-process disclosures open. The-ordinary group that owns the active execution segment starts open, then closes-on completion only while untouched. Other completed ordinary groups start-closed. Compact mode starts process and ordinary-group disclosures closed, but-an untouched active process containing any recorded failed or denied tool stays-open through later recovery and closes on turn completion if still untouched.-Compact mode keeps every tool/search payload closed and renders no reasoning-text or excerpt; it shows only the active thinking indicator and omits empty-completed thinking-only containers.+Detailed mode starts active whole-process disclosures open. On completion,+untouched whole-process disclosures close by default; an explicit user choice+remains authoritative. The ordinary group that owns the active execution+segment starts open, then closes on completion only while untouched. Other+completed ordinary groups start closed. Compact mode starts process and+ordinary-group disclosures closed, but an untouched active process containing+any recorded failed or denied tool stays open through later recovery and closes+on turn completion if still untouched. Compact mode keeps every tool/search+payload closed and renders no reasoning text or excerpt; it shows only the+active thinking indicator and omits empty completed thinking-only containers.Detailed mode preserves the leaf default only for the literal final item of thelast activity group. If that item is an eligible tool-call or hosted-search row,@@ -81,8 +82,9 @@ delegated child work or treat a failed child as a failed assistant turn.- Both modes expose one whole-process disclosure while keeping the final answerand actionable interruptions reachable outside it.-- Detailed mode keeps progress narration visible by default, folds untouched- completed activity groups, and preserves the literal-final-item leaf default.+- Detailed mode keeps the active process visible, folds untouched completed+ processes by default, preserves explicit disclosure choices, and retains the+ literal-final-item leaf default.- Compact mode remains the low-detail option: the process is folded, payloadsstay closed, and reasoning content is suppressed.- Disclosure memory is pane-owned presentation state with stable turn, group,@@ -98,3 +100,6 @@ checks and compilation. The linked E2E scenarios describe intended behavior forsource and design review; no unit, component, integration, browser, Electron, orE2E tests are added or run for this amendment. SeeE2E-CHAT-turn-process-and-thinking-display for the synchronized scenario text.+For the 2026-09-27 amendment, `apps/desktop/test/turn-process.test.mjs` covers+the default selection, and `pnpm test:e2e:transcript-disclosure` exercises+active-to-completed collapse and user-open retention in real Chromium.diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex 5506cdfec..f51e0a2b6 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -846,13 +846,15 @@ only when the current mode has two or more visible items. A singleton uses its idisclosure directly, compact-hidden thinking never creates an empty wrapper, andthe existing Task topology remains the container for delegated work.-Detailed starts active and completed whole-process disclosures open. The ordinary-group owning the active execution segment starts open, then closes on completion-only if untouched; other completed groups start closed. Compact starts the process-and ordinary groups closed. Its untouched active process remains open when any-failed or denied tool has been recorded, through later successful recovery, and-closes on completion if still untouched. Group headers summarize count, running-state and issue count without treating a failed child as a failed turn.+Detailed opens whole-process disclosures while a turn is active. When a turn+settles, an untouched process defaults closed; an explicit user choice remains+authoritative. The ordinary group owning the active execution segment starts+open, then closes on completion only if untouched; other completed groups start+closed. Compact starts the process and ordinary groups closed. Its untouched+active process remains open when any failed or denied tool has been recorded,+through later successful recovery, and closes on completion if still untouched.+Group headers summarize count, running state and issue count without treating a+failed child as a failed turn.In Detailed, only the literal final item of the last activity group receives theleaf auto-open default when it is an eligible tool-call or hosted-search row.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 481c70e27..3624acda3 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -14931,29 +14931,37 @@ plugin-form fixtures in an isolated temporary directory at runtime.thinking, progress paragraph B, multiple commands plus thinking, and a finalanswer; Detailed and Compact display modes; legacy message-level transcriptsearch targets.-- **Steps:** Review the nested disclosure path in Detailed, including independent- group/item toggles, parent close/reopen, a singleton segment, literal-final-item- leaf selection, failure/denial/recovery, retained-pane remounts and a legacy- search reveal. Repeat in Compact and with permission/question/plan/goal action- cards, a stopped partial answer, an assistant error and delegated child work.+- **Steps:** In Detailed, confirm a live process starts open, let that same turn+ finish without interacting, and confirm the process collapses. On a second+ turn, explicitly open the completed process and confirm the choice survives+ subsequent updates. Review the nested path, including independent group/item+ toggles, parent close/reopen, a singleton segment, literal-final-item leaf+ selection, failure/denial/recovery, retained-pane remounts and a legacy search+ reveal. Repeat in Compact with permission/question/plan/goal cards, a stopped+ partial answer, an assistant error and delegated child work.- **Expected:** Both modes use one whole-process disclosure and leave the finalanswer, assistant errors, stopped trailing text and pending actions outside it.- Detailed starts active/completed processes open; the active multi-item group is- open and an untouched group closes on completion. Compact starts processes and- groups closed, hides reasoning, and keeps payloads closed; an untouched active- process with a recorded failed/denied tool stays open through recovery and closes- on completion. Singletons have no group. Detailed auto-opens only an eligible- literal final tool/search item of the last activity group; it does not scan past- thinking, and failed/denied leaves stay closed. Parent/child/sibling states remain- independent, pane-owned user choices survive updates, mode changes and remounts,- and renderer restart reapplies defaults. Search reveals the process and activity- group that own the named message once per request; item-level targeting is not- part of this change, and Compact reasoning requires an- explicit switch to Detailed. Saved mode survives restart and a missing/unknown- setting resolves to Detailed.+ Detailed starts active processes open; untouched processes collapse at+ completion, while explicit user choices persist. The active multi-item group+ is open and an untouched group closes on completion. Compact starts processes+ and groups closed, hides reasoning, and keeps payloads closed; an untouched+ active process with a recorded failed/denied tool stays open through recovery+ and closes on completion. Singletons have no group. Detailed auto-opens only+ an eligible literal final tool/search item of the last activity group; it does+ not scan past thinking, and failed/denied leaves stay closed. Parent/child/+ sibling states remain independent, pane-owned user choices survive updates,+ mode changes and remounts, and renderer restart reapplies defaults. Search+ reveals the process and activity group that own the named message once per+ request; item-level targeting is not part of this change, and Compact+ reasoning requires an explicit switch to Detailed. Saved mode survives+ restart and a missing/unknown setting resolves to Detailed.- **Validation scope for the 2026-09-20 change:** Nested disclosure and activitygroup presentation only; precise item-level transcript search targeting is outof scope and keeps the existing message-level search behavior.+- **Automation:** `pnpm test:e2e:transcript` covers default and active-to-completed+ process disclosure behavior; `pnpm test:e2e:transcript-disclosure` verifies+ manual-open retention and viewport anchoring; `apps/desktop/test/turn-process.test.mjs`+ covers default selection.- **Specs:** 04-ux/06-settings-ia, 04-ux/08-component-spec,04-ux/09-interaction-patterns; ADR turn-process-and-thinking-display.diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex c1330b92e..1c9d3e594 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -440,6 +440,7 @@ section mirrors only marketplace/catalog items still blocking nothing.| D124 | `@` file references are plain-text light references | **`@` at a token boundary opens a fuzzy file menu over a workspace index served by the new Electron-only channel `pi-desktop/fs/index` (files+dirs, `git ls-files -co --exclude-standard` fast path with ignore-set walk fallback, 8000-entry cap with truncation flag, short TTL cache, workspace-rooted, fails soft without a workspace). Accepting creates the canonical `@rel/path ` reference for files (quoted `@"a b.txt" ` when the path has spaces) and inserts `@dir/` without trailing space for directories; D209 amends completed-file draft presentation without changing the dispatched plain-text path. The model follows references with its Read tool in both Plan and Agent. No prompt content inlining or provider attachment conversion; clipboard file materialization is defined by D197.** | Matches pi CLI's model-facing semantics, avoids context inflation and truncation rules, and keeps user-driven file browsing out of the agent tool/permission path per ADR 0019. || D125 | Composer autocomplete interaction and IME contract | **One menu component anchored above the composer, full composer width, focus always stays in the textarea. Keys while open: ↑/↓ cycle with wraparound, Enter/Tab accept, Escape closes only the menu (takes precedence over the composer's clear/blur Escape), typing filters live; Enter never sends while an item is highlighted, and an empty result list counts as closed. The menu closes on outside mousedown, blur, deleting past the trigger character, or session switch. All key handling and trigger detection sit behind the IME guard (`isComposing || keyCode === 229` plus composition start/end tracking): during composition nothing triggers, updates, or intercepts, and state is re-evaluated on compositionend.** | First explicit IME rule in the spec — zh-CN Enter-to-send plus candidate confirmation must never fight the menu; uniform insert-then-dispatch keeps two-Enter flows fast and predictable. || D632 | Composer input history recall with ArrowUp/ArrowDown | **Amend D125 / D209 / D301: the accepted submissions of one conversation — a normal or steering prompt and a dispatched slash, extension, or mode command — are recorded newest-first in renderer-local `localStorage` (`pi.desktop.composerInputHistory`, one bounded bucket per conversation held newest-written-first, 100 entries per conversation, 20 conversations, consecutive duplicates collapsed) with the draft text and its file-reference snapshot, and recalling shows only that conversation's prompts. With the autocomplete menu closed and the draft empty (no text and no references), ArrowUp loads the newest entry and further ArrowUp walks older entries to the oldest; ArrowDown walks newer entries and past the newest returns to the empty draft. While browsing, both keys keep driving history even for a multi-line entry; any user input event, a submission, or a draft-key (session) change ends browsing, after which arrows are native again. IME composition and an open autocomplete menu keep priority over history. Because an entry is always recalled in the conversation that sent it, its file and image references are restored with its text, and no cross-conversation notice or i18n string exists. The caret moves to the end of the recalled text; the empty home composer (no conversation) recalls nothing, and a prompt sent from home is recorded in the conversation that submission materialized. Storage is best-effort: a missing, blocked, or corrupted store reads as empty and never breaks sending. No protocol, host, storage-schema, permission, theme, or packaging change. See `04-ux/09-interaction-patterns.md` and E2E-COMPOSER-input-history-recall.** | Retyping or re-copying a previous instruction is the most repeated composer action, and the app already keeps renderer-local MRU history for the plugin launcher (D219). Scoping the history to the conversation keeps a recalled draft's context intact and makes attachment restoration unconditional, because attachments live in that conversation's own scratch directory. |+| D633 | Completed turn-process disclosures fold by default | **Amend ADR turn-process-and-thinking-display: Detailed opens the whole-process disclosure while a turn is active; on settlement, untouched process details start closed and explicit user choices remain authoritative. Compact recovery, search reveals, answer/action placement, and persistence are unchanged.** | The completed process was the only default-open branch, leaving progress and tool details expanded after work ended. Folding untouched processes restores the answer as the end-of-turn focus while keeping explicit inspection available. || D197 | Composer clipboard files become session-scratch references | **When the composer clipboard contains one or more OS files/images, the renderer intercepts the file paste, transfers bounded bytes plus name/MIME metadata through the Electron-only `pi-desktop/composer/pasteFiles` channel, and includes the durable session id. Electron main verifies the session, sanitizes names, and writes unique files below `<data_dir>/scratch/<sessionId>/pasted/`; D209 amends the draft presentation while preserving each returned absolute path as the quoted-or-unquoted `@` reference sent to the agent. Text-only paste remains native. A home composer creates or reuses a durable session first. Clipboard bytes never enter the prompt, workspace, or artifact store, and session deletion removes the pasted files with the scratch root.** | Fixes the broken file/image paste path without dirtying the project or inventing provider-specific binary prompt plumbing; it reuses the existing scratch containment and lifecycle contract. || D209 | Composer file references separate compact display from canonical prompt paths | **Completed workspace-file selections and materialized clipboard files become renderer-owned, session-scoped reference chips. A chip persistently displays only the leaf name, exposes the canonical path through tooltip/accessibility metadata, and can be removed without deleting scratch bytes. Immediately before submit, references serialize in stable order after the visible draft with D124's exact quoting, so reference-only drafts, slash templates, and Agent/Plan/Goal mode aliases retain their current behavior. Accepted dispatch clears the active editor but keeps a renderer-only, turn-scoped pre-serialization snapshot while smart Stop can still undo an unanswered send. That undo restores the original text and chips rather than prefilling serialized message content; abort after reply start keeps the partial transcript and restores nothing. Rejected/failed sends retain the active draft. `ComposerPastedFile.name` is the sanitized original leaf label while `path` retains the UUID-backed absolute storage identity. No binary payload, provider attachment, host RPC, or schema is added.** *(amended by D362: chips are inline sentinel-backed elements in the contenteditable draft)* | Long relative paths and UUID-backed scratch paths overwhelmed the prompt row even though only the agent needs them. Separating presentation from serialization preserves exact tool-readable paths, duplicate-name identity, textarea/IME behavior, and the text-only provider contract (ADR 0070). || D362 | Accepted `@` files insert the same inline chip as paste | **Amend D209 / D125 in the renderer: accepting a completed workspace file from the `@` menu (Enter, Tab, or click) replaces the trigger token with one private-use sentinel in the draft and stores that token on the reference, the same path clipboard paste already uses. The chip paints at the caret; that confirmation never sends. Directories still insert `@dir/` as text. Token-less references are not a visible draft surface. Workspace-relative chips still drop on project switch; absolute scratch/paste paths stay. No IPC, storage, host-protocol, or schema change.** | After chips moved inline, file accept still stripped `@query` and stored a token-less reference that no longer painted, so Enter made the file vanish. |@@ -7274,3 +7275,13 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.navigation, session isolation, a rendered file chip, the delayed Home-sendswitch, and restoration from a second Electron process using the same testprofile (E2E-COMPOSER-input-history-recall).++## 2026-09-27 — Completed turn-process disclosures fold by default (D633)++- Detailed mode opens the whole-process disclosure while a turn is active.+ Once the turn settles, untouched process details default to closed; explicit+ user choices remain authoritative. Search reveals and actionable/error+ surfaces outside the process remain unchanged.+- Renderer presentation only: no transcript, persistence, provider-thinking,+ or host behavior changes. See ADR turn-process-and-thinking-display,+ `04-ux/08-component-spec.md`, and E2E-CHAT-turn-process-and-thinking-display.diff --git a/docs/zh-CN/adr/turn-process-and-thinking-display.md b/docs/zh-CN/adr/turn-process-and-thinking-display.mdindex 270f9ac11..b6eb9a50d 100644--- a/docs/zh-CN/adr/turn-process-and-thinking-display.md+++ b/docs/zh-CN/adr/turn-process-and-thinking-display.md@@ -4,7 +4,7 @@- 状态:已接受- 日期:2026-09-17-- 修订:2026-09-20+- 修订:2026-09-27- Issues:#510、#461- 修订对象:D071、[ADR 0242](/adr/0242-delta-only-streaming-updates)@@ -28,12 +28,12 @@可见项时出现。单个工具、搜索或思考直接使用自身披露;紧凑模式隐藏的思考不会制造多余的组层级。现有 Task 拓扑仍是其片段的容器,不会在普通活动组中重复渲染。-详细模式下,活动中和已完成的整个过程默认展开。拥有当前执行片段的普通活动组在运行-时默认展开;完成时仅在用户未操作的情况下自动收起。其他已完成的普通活动组默认-收起。紧凑模式下,过程和普通活动组默认收起;但活动回合中只要记录过失败或被拒工具,-尚未被用户接管的外层过程会在后续恢复期间保持展开,并在回合完成后自动收起。紧凑-模式下所有工具和搜索载荷默认收起,不渲染推理正文或摘要,仅保留活动思考指示器,且-不会留下空的已完成纯思考容器。+详细模式下,活动中的整个过程默认展开。回合完成后,未操作的整体过程默认收起;用户+明确选择的状态继续生效。拥有当前执行片段的普通活动组运行时默认展开,仅在用户未操作+时于完成后收起;其他已完成普通活动组默认收起。紧凑模式下过程和普通活动组默认收起,+但只要活动回合中记录过失败或被拒工具,尚未被用户接管的过程就会在后续恢复期间保持+展开,并在回合完成后收起。紧凑模式下所有工具/搜索载荷均默认收起,不渲染推理正文或+摘要,仅保留活动思考指示器,也不会留下空的已完成纯思考容器。详细模式仅为最后一个活动组的字面最后一项保留叶子默认值。如果该项是符合条件的工具调用或托管搜索,其载荷默认展开;失败和被拒项仍受保护并保持收起。若最后一项是思考,@@ -59,10 +59,9 @@## 结果-- 两种模式都提供一个整个过程的披露,同时把最终回答和待处理操作保留在过程之外。-- 详细模式默认保留进度叙述可见,收起未操作的已完成活动组,并保留字面最后一项的叶子- 默认值。-- 紧凑模式仍是低细节选项:过程收起、载荷关闭、推理内容隐藏。+- 两种模式均提供整体过程披露,同时把最终回答和待处理操作保留在过程之外。+- 详细模式在运行中展示整个过程,未操作的已完成过程默认收起,保留用户明确选择及字面+ 最后一项的叶子默认值。- 披露记忆是以稳定回合、组和条目标识为键的窗格展示状态,不是持久化转录契约,也不属于中央工作流 store。- 只对已加载的转录条目分组;不会重建未加载历史,也不会跨压缩边界合并回合。@@ -72,3 +71,6 @@2026-09-20 的修订按本次请求仅进行静态检查和编译。关联的 E2E 场景用于描述源码与设计审查中的预期行为;本次修订不新增或运行单元、组件、集成、浏览器、Electron 或 E2E测试。同步后的场景文本见 E2E-CHAT-turn-process-and-thinking-display。+2026-09-27 修订由 `apps/desktop/test/turn-process.test.mjs` 覆盖默认选择,并由+`pnpm test:e2e:transcript-disclosure` 在真实 Chromium 中验证运行中到完成时的自动收起和+用户展开状态保留。diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.mdindex 02634d16f..7164f9cc9 100644--- a/docs/zh-CN/spec/04-ux/08-component-spec.md+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md@@ -1057,11 +1057,11 @@ SESSIONS [msg+][↕]模式下至少有两个可见项时才显示组标题。单项活动直接使用自身披露,紧凑模式隐藏的思考不会制造空包装,委派工作继续使用现有 Task 拓扑作为容器。-详细模式下,活动中和已完成的整体过程默认展开。拥有当前执行片段的普通活动组默认-展开,完成时仅在用户未操作的情况下自动收起;其他已完成组默认收起。紧凑模式下过程-和普通活动组默认收起;若活动回合记录过失败或被拒工具,尚未被用户接管的过程会在-后续成功恢复期间保持展开,并在回合完成后收起。组标题显示计数、运行状态和问题计数,-但不会把失败子项当作整个回合失败。+详细模式下,活动过程默认展开;回合结束后,未操作的过程默认收起,用户明确选择的状态+继续生效。拥有当前执行片段的普通活动组默认展开,完成时仅在用户未操作的情况下收起;+其他已完成组默认收起。紧凑模式下过程和普通活动组默认收起;若活动回合记录过失败或+被拒工具,尚未被用户接管的过程会在后续成功恢复期间保持展开,并在回合完成后收起。+组标题显示计数、运行状态和问题计数,但不会把失败子项当作整个回合失败。详细模式仅对最后一个活动组的字面最后一项应用叶子自动展开;该项必须是符合条件的工具调用或托管搜索。失败和被拒行保持收起,最后一项为思考时不会向前寻找更早工具。diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex c6122e90b..e708b4658 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -8660,23 +8660,28 @@ the latest destination. These assertions measure work counts, not device FPS.- **先决条件:** 一个回合包含进度段落 A、多次搜索及思考、进度段落 B、多条命令及思考和最终回答;详细与紧凑显示模式。-- **步骤:** 在详细模式静态审查嵌套披露路径,包括相互独立的组/条目切换、父级收起- 与恢复、单项片段、字面最后一项选择、失败/被拒/恢复和保留窗格重新挂载。- 随后在紧凑模式重复,并覆盖权限/提问/计划/目标操作卡、中止的部分回答、- 助手错误和委派子任务。+- **步骤:** 在详细模式确认活动过程默认展开,让同一回合在无人操作时完成,并确认过程+ 收起。另一个回合中,明确展开已完成过程,并确认后续更新仍保留该选择。检查嵌套路径,+ 包括相互独立的组/条目切换、父级收起与恢复、单项片段、字面最后一项选择、失败/被拒/+ 恢复、保留窗格重新挂载和旧版搜索定位。随后在紧凑模式重复,并覆盖权限/提问/计划/+ 目标操作卡、中止的部分回答、助手错误和委派子任务。- **预期:** 两种模式都使用一个整体过程披露,并把最终回答、助手错误、中止后的末尾- 文字和待处理操作留在过程之外。详细模式的活动中/已完成过程默认展开;活动多项组- 展开,未操作组在完成时收起。紧凑模式的过程、组和载荷默认收起,隐藏推理;记录过- 失败/被拒工具的未操作活动过程会在恢复期间保持展开,并在完成后收起。单项没有组。- 详细模式只自动展开最后一个活动组中符合条件的字面最后工具/搜索项;不会越过思考- 向前查找,失败/被拒叶子保持关闭。父级、子级和同级状态相互独立;窗格拥有的用户- 选择跨更新、模式切换和重新挂载保留,渲染器重启后重新应用默认值。已保存模式跨重启- 保留,缺失或未知设置按详细模式处理。+ 文字和待处理操作留在过程之外。详细模式的活动过程默认展开;未操作的过程在回合完成时+ 收起,用户明确选择的状态继续保留。活动多项组默认展开,未操作组在完成时收起。紧凑模式+ 的过程、组和载荷默认收起,隐藏推理;记录过失败/被拒工具的未操作活动过程会在恢复期间+ 保持展开,并在完成后收起。单项没有组。详细模式只自动展开最后一个活动组中符合条件的+ 字面最后工具/搜索项;不会越过思考向前查找,失败/被拒叶子保持关闭。父级、子级和同级+ 状态相互独立;窗格拥有的用户选择跨更新、模式切换和重新挂载保留,渲染器重启后重新应用+ 默认值。搜索只展开拥有目标消息的过程和活动组,每个请求应用一次;条目级精确定位不在+ 本次范围内,紧凑模式推理仍需显式切换到详细模式。已保存模式跨重启保留,缺失或未知设置+ 按详细模式处理。- **2026-09-20 变更的验证范围:** 本次变更只包含多级折叠与活动组呈现;精确转录搜索定位不在本次范围内,保持原有搜索行为。+- **自动化:** `pnpm test:e2e:transcript` 覆盖默认及运行中到完成时的过程披露行为;+ `pnpm test:e2e:transcript-disclosure` 验证手动展开状态保留和视口锚定;+ `apps/desktop/test/turn-process.test.mjs` 覆盖默认选择。- **规格:** 04-ux/06-settings-ia、04-ux/08-component-spec、04-ux/09-interaction-patterns;ADR turn-process-and-thinking-display。-### E2E-CONTEXT-estimate-calibration-stays-safe- **先决条件:** 可脚本化上报用量的确定性提供商夹具;占用接近硬边界的会话;不使用真实凭据。diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex 967012fed..2bcb9f46e 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -462,6 +462,7 @@| D153 | 推理会话默认为最大思考 | *(由 D303 取代)* **新创建的会话(其继承的默认模型支持推理)从该模型的 pi 发布的 `supportedThinkingLevels` 中的最高规范条目开始。非推理模型和缺失的能力元数据从 `off` 开始;现有会议保留其持久选择。这改进了 D096,而无需添加提供程序覆盖。** | 具有推理能力的模型应该默认使用最强大的可用努力,同时保留明确的每会话选择和 pi-ai 的模型权威。 || D264 | Composer 输入避开全量排序与冗余 DOM 写入 | **`@` 文件菜单用有界 top-K 选择从匹配列表中挑出可见行,而不再排序全部匹配;该选择返回的行集合与顺序与完整排序完全一致,而较小且按命令类型分组的命令列表保留完整排序。Composer 自动调整高度与 `--composer-dock-height` 发布都是幂等的:高度未变化时不做 DOM 写入,也不会使整个文档样式失效,`height: auto` 测量探针仅在文本框可能需要收缩时读取。增长到七行、超过第七行后内部滚动,以及 delete/submit 后的收缩均保持不变。当一次按键既未改变草稿文件引用状态也未改变光标位置时,两者都保持原有的身份与取值,因此草稿缓存序列化 effect 和自动完成触发检测不再每次按键都重跑。不改动 IPC、存储、主机协议或 schema。** | 在大型工作区中打开 `@` 菜单时,每次按键都要对整个 8000 条的文件索引做一次完整排序才显示 50 行,还要为测量探针付一次强制同步重排,而每次按键新建的 `fileReferences` 数组身份又会重跑草稿缓存序列化 effect。代价是输入延迟而非正确性;与完整排序的顺序等价性由单元测试覆盖。 || D632 | Composer 按 ↑/↓ 召回当前会话的提交历史 | **修订 D125 / D209 / D301:每个会话仅记录已接受的常规或 steering 提示,以及已派发的 slash、扩展和模式命令;记录按新到旧存入渲染器 `localStorage`(`pi.desktop.composerInputHistory`),每会话最多 100 条、最多 20 个会话,连续重复项合并。空草稿按 ↑ 开始召回,↑/↓ 在历史中导航,越过最新项后恢复为空;编辑、提交或切换会话会结束浏览,IME 与自动补全优先。召回同时恢复该会话自己的文件和图片引用;首页无会话时不提供召回。首页首条消息被接受时,提交流程将实际 materialize 的 sessionId 回传给历史记录器,不再于异步结束后读取全局活动会话,因此导航竞态不会串写历史。不改协议、host、schema、权限、主题或打包。** | 重复输入指令无需重打;按会话隔离可保持上下文一致,并可无条件恢复存于该会话 scratch 目录的附件。 |+| D633 | 已完成回合的过程默认收起 | **修订 ADR turn-process-and-thinking-display:详细模式仅在回合运行时默认展开整体过程;回合完成后,未操作过程默认收起,用户明确选择仍生效。紧凑模式恢复、搜索定位、回答/操作面位置及持久化语义不变。** | 完成后的过程是唯一默认展开的分支,导致进度和工具详情在工作结束后仍占据对话区。收起未操作过程可让最终回答重新成为回合焦点,同时保留用户主动查看的入口。 |## T. 发布交付决策@@ -5095,6 +5096,7 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编- 该变化只影响元数据和 UI 投影,不改写持久化 wire ID、提供商身份或 host 能力归属。参见`03-runtime/13-model-catalog-and-selection.md` §11.3 与`04-ux/08-component-spec.md` §11。+## 2026-09-27 —— Composer 用 ↑/↓ 召回当前会话已提交的内容(D632)- 重复使用上一条指令是 Composer 中常见操作。历史保存在渲染器本地@@ -5109,3 +5111,11 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编- `composer-input-history.test.mjs` 覆盖存储、导航和 sessionId 回传竞态;`pnpm test:e2e:composer-paste` 覆盖真实渲染器键盘操作、附件芯片、发送期间切换会话,以及重启 Electron 进程后的历史恢复。参见 E2E-COMPOSER-input-history-recall。++## 2026-09-27 —— 已完成回合的过程默认收起(D633)++- 详细模式下,回合运行时整体过程默认展开;回合结束后,未操作的过程详情默认收起,+ 用户明确选择的状态继续生效。搜索定位以及过程之外的待处理/错误操作面保持不变。+- 仅改变渲染器展示:不改转录、持久化、提供商思考设置或宿主行为。参见 ADR+ turn-process-and-thinking-display、`04-ux/08-component-spec.md` 和+ E2E-CHAT-turn-process-and-thinking-display。diff --git a/scripts/e2e/transcript-disclosure-anchor.tsx b/scripts/e2e/transcript-disclosure-anchor.tsxindex f57f15ce7..7a659ccb1 100644--- a/scripts/e2e/transcript-disclosure-anchor.tsx+++ b/scripts/e2e/transcript-disclosure-anchor.tsx@@ -82,7 +82,7 @@ async function settle() {* viewport. Only the app's stylesheet is left out, so the geometry comes from* inline sizes and the real components' intrinsic height.*/-function TranscriptFixture({ messages, process = false }: { messages: UiMessage[]; process?: boolean }) {+function TranscriptFixture({ messages, process = false, isActive = false }: { messages: UiMessage[]; process?: boolean; isActive?: boolean }) {const entry = process ? buildTranscriptEntries(messages).entries.find((item) => item.kind === "assistant-turn") : undefined;const {scrollRef,@@ -118,7 +118,7 @@ function TranscriptFixture({ messages, process = false }: { messages: UiMessage[<div ref={contentRef} className="thread-content"><div style={{ height: 700 }} />{entry?.kind === "assistant-turn"- ? <AssistantTurn entry={entry} isActive={false} />+ ? <AssistantTurn entry={entry} isActive={isActive} />: <ToolRow message={messages[1]} />}<div style={{ height: 300 }} /></div>@@ -266,12 +266,28 @@ globalThis.transcriptDisclosureProbe = async () => {dockExpanded.scrollTop <= dockBefore.scrollTop + 2,"expanding the dock re-bottomed the dock scroller",);- const processContainer = mount(<TranscriptFixture process messages={[+ const processMessages = [message("process-user", "user", "Inspect"),message("progress", "assistant", Array.from({ length: 50 }, (_, i) => `Progress paragraph ${i}.`).join("\n\n")),toolRowMessage("process-tool"),message("final", "assistant", "Finished."),- ]} />);+ ];+ const processContainer = document.createElement("div");+ processContainer.style.height = "600px";+ processContainer.style.width = "640px";+ host.append(processContainer);+ const processRoot = createRoot(processContainer, {+ onUncaughtError: (error) => renderErrors.push(error),+ });+ roots.push(processRoot);+ const renderProcess = (isActive: boolean) => flushSync(() =>+ processRoot.render(+ <I18nextProvider i18n={i18n}>+ <TranscriptFixture process isActive={isActive} messages={processMessages} />+ </I18nextProvider>,+ ),+ );+ renderProcess(true);const processScroller = processContainer.querySelector<HTMLElement>(".thread-scroll");const processTitle = processContainer.querySelector<HTMLElement>(".turn-process > button");assert(processScroller && processTitle, "process fixture did not render");@@ -279,28 +295,43 @@ globalThis.transcriptDisclosureProbe = async () => {const processBefore = geometry(processScroller, processTitle);assert(processTitle.getAttribute("aria-expanded") === "true",- "detailed should start the process open",+ "an active detailed process should start open",);- processTitle.click();+ renderProcess(false);await settle();const processCollapsed = geometry(processScroller, processTitle);+ assert(+ processTitle.getAttribute("aria-expanded") === "false",+ `an untouched process should collapse when its turn completes (expanded=${processTitle.getAttribute("aria-expanded")}, active=${processContainer.querySelector(".turn-process")?.classList.contains("active") ?? false}, bodyHidden=${processContainer.querySelector<HTMLElement>(".turn-process-body")?.hidden ?? true}, focusInside=${processContainer.querySelector(".turn-process-body")?.contains(document.activeElement) ?? false}, selected=${window.getSelection()?.isCollapsed === false})`,+ );assert(processCollapsed.scrollHeight < processBefore.scrollHeight - 100,- "process did not collapse",+ "completed process content remained visible",);processTitle.click();await settle();const processExpanded = geometry(processScroller, processTitle);+ assert(+ processTitle.getAttribute("aria-expanded") === "true",+ "a completed process should expand on user request",+ );assert(processExpanded.scrollHeight > processCollapsed.scrollHeight + 100,"process did not expand",);// Expansion grows content under a pinned bottom, which is the case the held- // anchor has to compensate; the collapse above may legitimately clamp.+ // anchor has to compensate; the automatic collapse above may legitimately clamp.assert(Math.abs(processExpanded.titleTop - processCollapsed.titleTop) < 2,"process expansion moved its title",);+ renderProcess(true);+ renderProcess(false);+ await settle();+ assert(+ processTitle.getAttribute("aria-expanded") === "true",+ "a user-expanded process should stay open after completion",+ );assert(renderErrors.length === 0, `React render errors: ${renderErrors.map(String).join("; ")}`);return {ok: true,diff --git a/scripts/e2e/transcript-render.tsx b/scripts/e2e/transcript-render.tsxindex be8134e64..1036f2018 100644--- a/scripts/e2e/transcript-render.tsx+++ b/scripts/e2e/transcript-render.tsx@@ -380,8 +380,9 @@ globalThis.transcriptRuntimeSlotProbe = async () => {if (!passed) failures.push(message);};const sessionId = "runtime-slot";- const messages: UiMessage[] = [message("user", "user", "Inspect the workspace")];+ const messages: UiMessage[] = [];for (let index = 0; index < 8; index++) {+ messages.push(message(`user-${index}`, "user", `Inspect step ${index} in the workspace`));messages.push(message(`tool-${index}`, "tool", "done", {toolName: "Bash",@@ -395,17 +396,9 @@ globalThis.transcriptRuntimeSlotProbe = async () => {message(`answer-${index}`, "assistant", `Finished step ${index}.`),);}- // A completed tool row does not finish the turn: the fallback remains until- // the runtime reports the next phase or the turn reaches a terminal state.- messages.push(- message("tool-tail", "tool", "done", {- toolName: "Bash",- toolCallId: "call-tail",- toolStatus: "success",- toolArgs: { command: "printf tail" },- toolResult: { details: { stdout: "done", exitCode: 0 } },- }),- );+ messages.push(message("live-user", "user", "Inspect the next step"));+ // The live user turn exercises the runtime lane without an active process+ // disclosure changing geometry when that lane settles.const frame = () =>new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));diff --git a/scripts/e2e/turn-process.tsx b/scripts/e2e/turn-process.tsxindex 02d2cddb0..a80e5a1d8 100644--- a/scripts/e2e/turn-process.tsx+++ b/scripts/e2e/turn-process.tsx@@ -115,16 +115,32 @@ export async function turnProcessProbe() {"detailed wraps one process per turn",);check(- header()?.getAttribute("aria-expanded") === "true" && visible(process()),- "detailed starts the process open",+ header()?.getAttribute("aria-expanded") === "false" && !visible(process()),+ "detailed completed process starts collapsed",);check(visible(container.querySelector('[data-message-id="answer"]')),"final answer stays visible",);+ check(+ !visible(container.querySelector('[data-message-id="progress"]')),+ "completed progress stays hidden until expanded",+ );+ render(messages, true, null, "active-process");+ check(+ header()?.getAttribute("aria-expanded") === "true" && visible(process()),+ "active detailed process starts open",+ );+ render(messages, false, null, "active-process");+ check(+ header()?.getAttribute("aria-expanded") === "false" && !visible(process()),+ "untouched detailed process collapses on completion",+ );+ render(messages);+ click(header());check(visible(container.querySelector('[data-message-id="progress"]')),- "detailed keeps intermediate progress visible",+ "user can expand completed progress",);check(container.querySelector('[data-message-id="edit"]')?.classList.contains("open") === true,