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(test): align transcript long-history fixture with disclosures
vastsa9475dc4e7110
diff --cc docs/spec/08-meta/decisions-log.mdindex 9690da891,e5fb235fa..0f4a3bdd2--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@@ -52,6 -52,7 +52,7 @@@ This log freezes previously open questi| D656 | Quarantine appends the host keeps refusing instead of stalling the outbox | **Amend ADR 0041 / D318 / D444 / D597: an append whose `session.appendMessage` or `session.recordUsage` call fails with an error the outbox cannot classify as a duplicate message id, a `PERMISSION_DENIED:` poison row, or a foreign-key orphan is retried on a bounded backoff (5s, doubling to a 60s cap) instead of ending the flush. The fifth consecutive failure on that head moves it into an application-owned dead-letter file, `session-message-outbox.dead-letter.json`, with its payload, session id, quarantine timestamp, and host error; only the newest 256 quarantined appends are kept, and the oldest is discarded with a warn. The flush then continues with the next entry, so one refused append can no longer hold the FIFO head, fill the 1024-entry cap, or fail every session's writes. Quarantined appends are never replayed automatically, and `session.delete` drops that session's quarantined appends too. No protocol version, storage schema, or queued-outbox format change.** | A `stream did not contain valid UTF-8` append stayed at the FIFO head for 14.8 hours while `session.persistence.outbox.is.full` fired 5990 times, so every session's appends failed until restart. Only three error classes had a drain, and every other error was treated as transient forever (#1560). || D657 | Let the embedded Browser open local files outside the workspace | **Amend ADR 0170: an explicit absolute path or `file:` URL may load any existing regular local file, and a local-file page may navigate to other existing local files. Relative inputs remain workspace-rooted; HTTP(S) pages retain only the prior in-workspace file-link allowance. Missing files, directories, and remote file authorities remain blocked. `BrowserPreview` and the sidecar keep their workspace-rooted resolver. The public `pi.browser.navigate` API follows this policy under the high-risk `browser.cdp` permission. See ADR 0328, E2E-059, `04-ux/08-component-spec.md`, and `05-security/01-security.md`.** | Users need to inspect local HTML outside a project, while workspace-scoped agent file tools and remote-page navigation must retain their existing boundary (#1627). || D659 | Reopen archived projects in the sidebar | **Amend D093 / D455: successful explicit project activation clears the normalized path's renderer-local archived flag and persists it, so Open from Project archive, reopening the same folder through Add project, and opening a project session reveal the project in the home sidebar. Selecting a row for inspection and ordinary session refreshes do not alter archive state. No host/project/session storage or protocol change. See ADR 0294, E2E-264, and issue #1653.** | Reopening a project changed the active workspace but left its path-keyed archived presentation flag set, hiding it from the sidebar after the user explicitly reopened it. |-| D660 | Segmented turn process and independent thinking preference | **Supersede the `Detailed` / `Compact` display-mode behavior and the single whole-process disclosure recorded by D633 / D651 and the `turn-process-and-thinking-display` ADR: a turn renders as chronological collapsible process segments, Bash and run aliases stay outside every folded container (the turn-level process disclosure and any ordinary activity group) and remain visible even when every group is collapsed, and process/group folding defaults are independent of the thinking preference. The preference is the optional boolean `AppSettings.showThinking`; absent or non-boolean values fall back to the legacy `thinkingDisplayMode` field (`compact` hides, `detailed`/unknown/absent shows), which is retained only for persisted-settings compatibility. `showThinking` joins the portable application fields so it synchronizes like the legacy field; no other host protocol, persistence schema, permission, or plugin contract change. See the amended ADR, `04-ux/06-settings-ia.md`, `04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`, and E2E-CHAT-turn-process-and-thinking-display.** | One flat container left long tool/search runs hard to scan and forced reasoning visibility and process folding into the same two-valued switch; an independent boolean plus always-visible Bash rows keeps shell-heavy turns readable without hiding the answer. |++| D661 | Segmented turn process and independent thinking preference | **Supersede the `Detailed` / `Compact` display-mode behavior and the single whole-process disclosure recorded by D633 / D651 and the `turn-process-and-thinking-display` ADR: a turn renders as chronological collapsible process segments, Bash and run aliases stay outside every folded container (the turn-level process disclosure and any ordinary activity group) and remain visible even when every group is collapsed, and process/group folding defaults are independent of the thinking preference. The preference is the optional boolean `AppSettings.showThinking`; absent or non-boolean values fall back to the legacy `thinkingDisplayMode` field (`compact` hides, `detailed`/unknown/absent shows), which is retained only for persisted-settings compatibility. `showThinking` joins the portable application fields so it synchronizes like the legacy field; no other host protocol, persistence schema, permission, or plugin contract change. See the amended ADR, `04-ux/06-settings-ia.md`, `04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`, and E2E-CHAT-turn-process-and-thinking-display.** | One flat container left long tool/search runs hard to scan and forced reasoning visibility and process folding into the same two-valued switch; an independent boolean plus always-visible Bash rows keeps shell-heavy turns readable without hiding the answer. |## B. Secondary implementation defaults@@@ -7686,22 -7686,31 +7687,51 @@@ must keep splitting are covered by `mar`03-runtime/02-agent-runtime.md` §6.3, and`03-runtime/11-provider-model-system.md`.-## 2026-10-16 — Segmented turn process and independent thinking preference (D660)--- D660 supersedes the `Detailed` / `Compact` display-mode behavior and the single+## 2026-10-14 — Composer file menu rows always show the full relative path (D660)++- D660 amends the `@` file-completion row contract in+ `04-ux/08-component-spec.md` §11.8, `04-ux/09-interaction-patterns.md` §8a.1,+ and E2E-102a: each row persists the leaf name (directories keep the trailing+ `/`) followed by the entry's complete workspace-relative path in a+ de-emphasized mono span that renders the raw `entry.path` without a trailing+ slash. The span takes the row's remaining width and ellipsizes before the+ leaf name can, so a short leaf name never truncates and no row overflows the+ menu.+- The tooltip still carries the complete relative path, and the accessible+ name becomes the path alone — the visible row already includes the leaf+ name, so the old `leaf — path` label would have read it twice.+- Reference chips (D209/D362, ADR 0024/ADR 0070), completion, insertion, and+ serialization are unchanged, and no earlier decision owned the old+ leaf-only row wording, so no entry is marked amended.+- Covered by `apps/desktop/test/composer-file-reference-display.test.mjs` and+ the file-mode fixture of `scripts/e2e-composer-autocomplete.mjs`. See+ `04-ux/08-component-spec.md` and `04-ux/09-interaction-patterns.md`.++++## 2026-10-16 — Segmented turn process and independent thinking preference (D661)++++- D661 supersedes the `Detailed` / `Compact` display-mode behavior and the single+ whole-process disclosure recorded by D633 / D651 and the+ `turn-process-and-thinking-display` ADR. A turn now renders as chronological+ collapsible process segments; the trailing answer, assistant errors, stopped+ trailing text, and pending action surfaces stay outside them.+ - Bash and run aliases render as standalone rows outside every folded container —+ neither the turn-level process disclosure nor an ordinary activity group — and+ stay visible even when every group is collapsed. Adjacent Bash rows remain+ separate, and a Bash row's detail stays closed until the user opens it.+ - Group folding defaults are unified and independent of the thinking preference:+ the active group opens and closes on completion only if untouched, other+ completed groups start closed, and an untouched active group with a recorded+ failed or denied tool stays open through later recovery.+ - The preference is the optional boolean `AppSettings.showThinking`. When false,+ the live thinking indicator stays visible while completed thinking rows and+ excerpts are hidden and empty thinking-only containers are omitted; the stored+ reasoning is retained. Absent or non-boolean values fall back to the legacy+ `thinkingDisplayMode` field (`compact` hides, `detailed`/unknown/absent shows),+ which is retained only for persisted-settings compatibility and is no longer+ exposed in the UI.+ - `showThinking` joins the portable application fields so it synchronizes like the+ legacy field; no other host protocol, persistence schema, permission, or plugin+ contract change. Covered by `apps/desktop/test/thinking-visibility.test.mjs` and+ the i18n catalog tests. See the amended ADR, `04-ux/06-settings-ia.md`,+ `04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`, and+ E2E-CHAT-turn-process-and-thinking-display.diff --cc docs/zh-CN/spec/08-meta/decisions-log.mdindex e7137f5b5,88ab3acb0..6f5dd088c--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@@ -54,6 -54,7 +54,7 @@@| D656 | 隔离宿主持续拒绝的 outbox 追加,避免整队停摆 | **修订 ADR 0041 / D318 / D444 / D597:当 `session.appendMessage` 或 `session.recordUsage` 返回的错误无法归类为重复消息 ID、`PERMISSION_DENIED:` 毒行或外键孤立行时,不再结束本次 flush,而是在同一 Host 代内按有界退避重试(5 秒起、翻倍、上限 60 秒)。同一队头连续第五次失败后,该追加被移入应用自有的死信文件 `session-message-outbox.dead-letter.json`(保留载荷、sessionId、隔离时间与宿主错误;只保留最新 256 条,超出丢弃最旧并记 warn),随后继续排空后续条目,因此单条被拒追加不再长期占用 FIFO 队头、填满 1024 条上限或导致所有会话写入失败。Host 重启属于新代,会立即重试该队头。隔离条目永不自动重放,`session.delete` 会连同该会话的隔离条目一起删除。协议版本、存储架构与队列文件格式均不变。** | 一条 `stream did not contain valid UTF-8` 追加在队头滞留 14.8 小时,期间 `session.persistence.outbox.is.full` 触发 5990 次,导致所有会话的写入直到重启前全部失败;此前只有三类错误有排空出口,其余错误被永久当作瞬时错误(#1560)。 || D657 | 让内置浏览器打开工作区外的本地文件 | **修订 ADR 0170:通过绝对路径或 `file:` URL 可打开任意已存在的本地普通文件,本地文件页面也可导航到其他已存在的本地文件。相对输入仍以工作区为根;HTTP(S) 页面只保留此前工作区内文件链接的权限。缺失文件、目录与远程文件 authority 仍被阻止。`BrowserPreview` 与 sidecar 继续使用工作区根解析。公开的 `pi.browser.navigate` API 在高风险 `browser.cdp` 权限下采用相同策略。见 ADR 0328、E2E-059、`04-ux/08-component-spec.md` 与 `05-security/01-security.md`。** | 用户需要检查项目外的本地 HTML,而工作区范围内的 Agent 文件工具和远程页面导航仍须保留原有边界(#1627)。 || D659 | 重新打开归档项目后恢复侧栏显示 | **修订 D093 / D455:成功明确激活项目时,清除该规范化路径的渲染层归档标记并持久化,使用户从「项目归档」点击「打开」、通过「添加项目」再次选择同一目录,或打开项目会话后,都能在主页侧边栏看到该项目。仅选择归档详情行而未激活,以及普通会话刷新,都不改变归档状态。不更改 Host/项目/会话存储或协议。见 ADR 0294、E2E-264 与 issue #1653。** | 用户明确重新打开项目后,活动工作区虽已切换,但按路径存储的归档展示标记仍在,导致项目从侧栏隐藏。 |-| D660 | 分段回合过程与独立的思考偏好 | **取代 D633 / D651 与 `turn-process-and-thinking-display` ADR 中记录的 `Detailed` / `Compact` 显示模式行为与单一整体过程披露:回合渲染为按时间顺序排列的可折叠过程片段,Bash 与 run 别名位于所有折叠容器之外(回合级过程披露与任何普通活动组),即使所有组都收起也保持可见,且过程/组折叠默认值不依赖思考偏好。偏好为可选的布尔值 `AppSettings.showThinking`;缺失或非布尔值回退到旧版 `thinkingDisplayMode` 字段(`compact` 隐藏,`detailed`/未知/缺失显示),该旧字段仅为持久化设置兼容性保留。`showThinking` 加入可移植应用字段,因此会像旧字段一样同步;其余 Host 协议、持久化 schema、权限或插件契约不变。见修订后的 ADR、`04-ux/06-settings-ia.md`、`04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md` 与 E2E-CHAT-turn-process-and-thinking-display。** | 单一扁平容器让较长的工具/搜索序列难以浏览,并把推理可见性与过程折叠挤进同一个二值开关;独立布尔值加上始终可见的 Bash 行,让命令密集的回合保持可读又不遮挡回答。 |++| D661 | 分段回合过程与独立的思考偏好 | **取代 D633 / D651 与 `turn-process-and-thinking-display` ADR 中记录的 `Detailed` / `Compact` 显示模式行为与单一整体过程披露:回合渲染为按时间顺序排列的可折叠过程片段,Bash 与 run 别名位于所有折叠容器之外(回合级过程披露与任何普通活动组),即使所有组都收起也保持可见,且过程/组折叠默认值不依赖思考偏好。偏好为可选的布尔值 `AppSettings.showThinking`;缺失或非布尔值回退到旧版 `thinkingDisplayMode` 字段(`compact` 隐藏,`detailed`/未知/缺失显示),该旧字段仅为持久化设置兼容性保留。`showThinking` 加入可移植应用字段,因此会像旧字段一样同步;其余 Host 协议、持久化 schema、权限或插件契约不变。见修订后的 ADR、`04-ux/06-settings-ia.md`、`04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md` 与 E2E-CHAT-turn-process-and-thinking-display。** | 单一扁平容器让较长的工具/搜索序列难以浏览,并把推理可见性与过程折叠挤进同一个二值开关;独立布尔值加上始终可见的 Bash 行,让命令密集的回合保持可读又不遮挡回答。 |## B. 辅助实现默认值@@@ -5420,17 -5420,22 +5421,37 @@@ Markdown 源码,不是 `text/html` �E2E-PROVIDER-custom-endpoint-session-identity 覆盖。见 issue #1634、`03-runtime/02-agent-runtime.md` §6.3 与 `03-runtime/11-provider-model-system.md`。-## 2026-10-16 —— 分段回合过程与独立的思考偏好(D660)+## 2026-10-14 —— Composer 文件菜单行始终显示完整相对路径(D660)-- D660 取代 D633 / D651 与 `turn-process-and-thinking-display` ADR 中记录的+- D660 修订 `04-ux/08-component-spec.md` §11.8、`04-ux/09-interaction-patterns.md` §8a.1+ 与 E2E-102a 中 `@` 文件补全的行契约:每行在叶名称(目录保留尾随 `/`)之后,+ 以弱化的等宽样式渲染条目完整的工作区相对路径,span 携带原始 `entry.path`+ (不带尾斜杠)。该 span 吸收行的剩余宽度并先于叶名截断,因此短叶名不会被+ 截断,行也不会溢出菜单。+- 工具提示仍携带完整相对路径;可访问名改为只念路径本身——可视行已包含叶名,+ 旧的 `叶名 — 路径` 标签会把它念两遍。+- 引用芯片(D209/D362、ADR 0024/ADR 0070)、补全、插入与序列化均不变;+ 此前没有决策拥有旧的纯叶名行措辞,因此没有条目被标记为已修订。+- 由 `apps/desktop/test/composer-file-reference-display.test.mjs` 与+ `scripts/e2e-composer-autocomplete.mjs` 的 file-mode fixture 覆盖。见+ `04-ux/08-component-spec.md` 与 `04-ux/09-interaction-patterns.md`。++++## 2026-10-16 —— 分段回合过程与独立的思考偏好(D661)++++- D661 取代 D633 / D651 与 `turn-process-and-thinking-display` ADR 中记录的+ `Detailed` / `Compact` 显示模式行为与单一整体过程披露。回合现在渲染为按时间顺序排列的+ 可折叠过程片段;末尾回答、助手错误、中止后的末尾文字和待处理操作面留在这些片段之外。+ - Bash 与 run 别名作为独立行渲染,位于所有折叠容器之外——既不属于回合级过程披露,也不+ 属于普通活动组——即使所有组都收起也保持可见。相邻的 Bash 行保持独立,Bash 行的详情在+ 用户打开之前保持收起。+ - 组折叠默认值统一且不依赖思考偏好:活动组默认展开,完成时仅在用户未操作时收起;其他+ 已完成组默认收起;记录过失败或被拒工具的未接管活动组会在后续恢复期间保持展开。+ - 偏好为可选的布尔值 `AppSettings.showThinking`。当它为 false 时,活动思考指示器保持+ 可见,而已完成的思考行和摘要被隐藏,空的纯思考容器被省略;已存推理仍会保留。缺失或+ 非布尔值回退到旧版 `thinkingDisplayMode` 字段(`compact` 隐藏,`detailed`/未知/缺失+ 显示),该旧字段仅为持久化设置兼容性保留,不再在界面中暴露。+ - `showThinking` 加入可移植应用字段,因此会像旧字段一样同步;其余 Host 协议、持久化+ schema、权限或插件契约不变。由 `apps/desktop/test/thinking-visibility.test.mjs` 与+ i18n 目录测试覆盖。见修订后的 ADR、`04-ux/06-settings-ia.md`、+ `04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md` 与+ E2E-CHAT-turn-process-and-thinking-display。diff --cc scripts/e2e/transcript-long-history.tsxindex 06264c133,df557c765..6523802eb--- a/scripts/e2e/transcript-long-history.tsx+++ b/scripts/e2e/transcript-long-history.tsx@@@ -303,6 -316,6 +316,12 @@@ export async function transcriptLongHisassert(sample.oldBodyReads === 0, `${item.summary.id}: reread ${sample.oldBodyReads} old bodies`);assert(sample.unchangedGroupRenders === 0, `${item.summary.id}: unchanged groups rerendered`);if (item.summary.id === "long-activity-group") {++ // The streamed answer is the actual turn tail, so the preceding process++ // chunk starts collapsed. Open each ancestor through its disclosure++ // before testing the nested live tool update.++ const processHeader = element<HTMLButtonElement>(".turn-process > .tool-activity-header");++ if (processHeader.getAttribute("aria-expanded") !== "true") flushSync(() => processHeader.click());++ await settled();const groupHeader = element<HTMLButtonElement>(".process-activity-group > .tool-activity-header");if (groupHeader.getAttribute("aria-expanded") !== "true") flushSync(() => groupHeader.click());await settled();@@@ -326,9 -339,9 +345,9 @@@const liveToolId = `${item.summary.id}-tool-128`;const liveTool = element<HTMLButtonElement>(`[data-message-id="${liveToolId}"] .tool-row-header`);if (liveTool.getAttribute("aria-expanded") !== "true") flushSync(() => liveTool.click());-- send(item.summary.id, { type: "tool_update", toolCallId: liveToolId, partialResult: { details: { output: "warm tool output" } } });-- await until(() => host.querySelector(`[data-message-id="${liveToolId}"]`)?.textContent?.includes("warm tool output") === true,-- "warm tool_update output", () => ({++ send(item.summary.id, { type: "tool_update", toolCallId: liveToolId, partialResult: { details: { content: "warm Read content" } } });++ await until(() => host.querySelector(`[data-message-id="${liveToolId}"]`)?.textContent?.includes("warm Read content") === true,++ "warm Read tool_update content", () => ({message: useAppStore.getState().messages.find((message) => message.id === liveToolId),groupExpanded: groupHeader.getAttribute("aria-expanded"),toolExpanded: liveTool.getAttribute("aria-expanded"),@@@ -336,9 -349,9 +355,9 @@@}));await settled();item.reads.count = 0; globalThis.__activityGroupRenders = [];-- send(item.summary.id, { type: "tool_update", toolCallId: liveToolId, partialResult: { details: { output: "fresh non-tail tool output" } } });-- await until(() => host.querySelector(`[data-message-id="${liveToolId}"]`)?.textContent?.includes("fresh non-tail tool output") === true,-- "fresh tool_update output");++ send(item.summary.id, { type: "tool_update", toolCallId: liveToolId, partialResult: { details: { content: "fresh non-tail Read content" } } });++ await until(() => host.querySelector(`[data-message-id="${liveToolId}"]`)?.textContent?.includes("fresh non-tail Read content") === true,++ "fresh non-tail Read tool_update content");await settled();assert(item.reads.count === 0, `tool_update reread ${item.reads.count} completed bodies`);assert(globalThis.__activityGroupRenders.length === 1, "tool_update must render exactly its changed group");