Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
docs(spec): restore the missing rationale cell on D669
vastsa533639f615a0
diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 4f7383c09..7259a0e98 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -333,7 +333,7 @@ Gold source: local Codex electron captures; latest row wins where rows conflict.| D619 | A copied formula is its TeX source | **Renderer only: a copy whose selection covers rendered math writes `text/plain` from the MathML `annotation` — `$…$` inline, `$$…$$` on its own lines, the delimiters `lib/latex-math.ts` normalizes `\(…\)` and `\[…\]` to, each run widened past any run inside the formula as a code span's fence is — instead of the two trees KaTeX paints. A cut that lands inside a formula grows to the whole formula. Only the formulas are rewritten: the reduced clone is read back through `Selection.toString()`, the serializer a copy itself runs, so prose, lists, tables and code blocks sharing the selection keep the platform's own reading — `user-select: none` chrome left behind included, which `innerText` would have written out. A selection with no formula in it, and a copy raised where the selection does not live, are left to the platform entirely. One flavour is written, `text/plain`: taking the event over drops the platform's `text/html` too and none is written back, because the reduced clone is app markup that would carry the `user-select: none` chrome the text reading drops, and because carrying the rendering instead would paste every formula twice — KaTeX's stylesheet is the only thing hiding the MathML tree and no stylesheet travels on the clipboard. One document `copy` listener owned by the shell, and the transcript's right-click Copy reads the same selection through the same module.** | A formula pasted as its glyphs, once per rendered tree, so it could not be carried into a LaTeX document or another Markdown editor (issue #414). ADR 0268 removed quoting on the grounds that the OS clipboard was the substitute; the clipboard had to actually carry the source. || D620 | pi-ai built-in API-key services are named presets | **Add fifteen named endpoint presets — Ant Ling, Baseten, Cerebras, Hugging Face, Meta (`responses`), MiniMax (International), Moonshot AI (International), NVIDIA, OpenCode Zen, Vercel AI Gateway, Qwen Token Plan (`alibaba-token-plan`), Qwen Token Plan (China), Xiaomi Token Plan (China / Europe / Singapore) — to `NAMED_ENDPOINT_PRESETS`, each at its published host, with the pi-ai provider id kept as an alias wherever the models.dev key differs. Eight built-in providers remain exceptions with a recorded reason: Amazon Bedrock, Azure OpenAI, Cloudflare AI Gateway, Cloudflare Workers AI, Google Vertex AI (account- or region-scoped URLs), GitHub Copilot and OpenAI Codex (vendor-account rows), and Radius (`pi_messages` is account-only here). `packages/agent-runtime/src/pi-ai-provider-sync.test.ts` fails on a pi-ai upgrade that leaves a provider neither covered nor excepted. No protocol, storage, or IPC change.** | Every other pi-ai capability was already reachable, but the API-key half of the service catalog was hand-maintained and had drifted from the library's own provider list (ADR 0307). || D668 | One process disclosure per turn, with three transcript display modes | **Amend D661 / the `turn-process-and-thinking-display` ADR. A turn renders exactly one top-level process disclosure holding every pre-answer row; the answer stays outside it. `AppSettings.transcriptDisplayMode` selects the layout: `flat` renders no nested activity groups, `command-first` renders `Bash`/run rows as standalone rows beside activity groups, and `fully-folded` (the default for absent or invalid values) keeps commands inside their groups and lets only ordinary assistant progress text split them. The mode is read while rendering, so switching repaints immediately - the projection cache is keyed by messages and compactions only. The disclosure header reports failed / stopped / running / finished with precedence in that order and never echoes the current item, and the disclosure shares one left edge with the levels it reveals. `transcriptDisplayMode` joins the portable application fields; `keepCommandsExpanded` is deprecated, retained only for persisted-settings compatibility, and no longer exposed or read for rendering. No 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.** | Chronological segmentation split one turn into several sibling disclosures above the answer, and the boolean command-folding preference could only express two layouts; a three-mode setting covers flat, command-first, and the released grouped view without changing what a tool received or stored. |-| D669 | `@` queries search past a truncated file index | **Amend D124: while the 8000-entry `fs/index` snapshot is truncated, a non-empty `@` query is also searched over the root's full listing through the read-only Electron channel `pi-desktop/fs/search` once typing pauses, and its best 50 rows merge with the local matches. A complete index never searches. Remote sessions keep their snapshot. No host RPC, storage, or schema change.** |+| D669 | `@` queries search past a truncated file index | **Amend D124: while the 8000-entry `fs/index` snapshot is truncated, a non-empty `@` query is also searched over the root's full listing through the read-only Electron channel `pi-desktop/fs/search` once typing pauses, and its best 50 rows merge with the local matches. A complete index never searches. Remote sessions keep their snapshot. No host RPC, storage, or schema change.** | The shallowest-8000-entry index left a script several folders down matching no query at all, even though the truncation note invited the reader to refine it (issue #1781). |## M0. Model catalog decisionsdiff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex 6d1aea64b..50bb3987a 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -336,7 +336,7 @@| D619 | 复制公式得到的是它的 TeX 源码 | **仅渲染层:当选区覆盖到渲染出来的公式时,`text/plain` 从 MathML `annotation` 写出——行内 `$…$`,块级 `$$…$$` 独占行,也就是 `lib/latex-math.ts` 把 `\(…\)` 和 `\[…\]` 归一到的那组定界符,且每组定界符都像代码段的围栏那样加长到盖过公式内部出现的最长同字符串——而不是 KaTeX 画的那两棵树。落在公式内部的切口会扩展成整个公式。只有公式被改写:归约后的克隆经由 `Selection.toString()`——复制自己跑的那个序列化器——读回,因此同处一个选区的正文、列表、表格和代码块保留平台自己的读法,包括 `innerText` 会写出、而复制本就会略过的 `user-select: none` 界面零件。不含公式的选区,以及在选区所在位置之外触发的复制,整份交回平台。只写一种 flavour:`text/plain`。接管事件同时丢掉了平台的 `text/html`,且不再写回——归约后的克隆是应用自己的标记,写回去会带上文本读法已略过的 `user-select: none` 界面零件;而改为携带渲染结果则会把每个公式粘贴两遍,因为隐藏 MathML 树的只有 KaTeX 自己的样式表,样式表不会随剪贴板一起走。只有一个由外壳持有的文档级 `copy` 监听器,记录区的右键复制经由同一个模块读取同一个选区。** | 公式粘出来是它的字形,而且每棵渲染树各一份,无法带进 LaTeX 文档或别的 Markdown 编辑器(issue #414)。ADR 0268 当年移除「引用」的理由正是 OS 剪贴板可以替代,那剪贴板就得真的装着源码。 || D620 | pi-ai 内置的 API-key 服务成为命名预设 | **向 `NAMED_ENDPOINT_PRESETS` 新增十五条命名预设——Ant Ling、Baseten、Cerebras、Hugging Face、Meta(`responses`)、MiniMax(国际)、Moonshot AI(国际)、NVIDIA、OpenCode Zen、Vercel AI Gateway、Qwen Token 套餐(`alibaba-token-plan`)、Qwen Token 套餐(中国)、小米 Token 套餐(中国/欧洲/新加坡)——各自使用官方主机名;models.dev 键与 pi-ai 提供方 id 不同的那几条,把 pi-ai id 保留为别名。八个内置提供方仍作例外并写明原因:Amazon Bedrock、Azure OpenAI、Cloudflare AI Gateway、Cloudflare Workers AI、Google Vertex AI(URL 里带账户或区域),GitHub Copilot 与 OpenAI Codex(以厂商账号行提供),以及 Radius(这里的 `pi_messages` 仅限账号)。pi-ai 升级后若某提供方既未被覆盖也不在例外中,`packages/agent-runtime/src/pi-ai-provider-sync.test.ts` 会失败。不改协议、存储或 IPC。** | pi-ai 其他能力本就可达,但服务目录的 API-key 一半靠手工维护,已经跟库自带的提供方列表脱节(ADR 0307)。 || D668 | 每回合一个过程披露,并提供三种转录显示模式 | **修订 D661 / `turn-process-and-thinking-display` ADR:每个回合渲染一个顶层过程披露,包含回答前的全部行;回答留在披露之外。`AppSettings.transcriptDisplayMode` 选择布局:`flat` 不渲染嵌套活动组,`command-first` 将 `Bash`/run 行作为活动组旁的独立行,`fully-folded`(缺失或无效值的默认)让命令留在所属组内,且只有普通助手进度文字会拆分活动组。该模式在渲染时读取,因此切换后立即重绘——投影缓存只以消息和压缩为键。披露标题按失败/停止/执行中/已完成的优先级报告,且绝不回显当前条目;披露与它展开的层级共用一条左边缘。`transcriptDisplayMode` 加入可移植应用字段;`keepCommandsExpanded` 已弃用,仅为持久化设置兼容性保留,不再暴露,也不再参与渲染读取。无 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。** | 按时间顺序的分段把同一回合拆成答案上方多个并列披露,而布尔命令折叠偏好只能表达两种布局;三种模式覆盖平铺、命令优先与已发布的分组视图,且不改变工具收到的内容或持久化内容。 |-| D669 | `@` 查询越过被截断的文件索引 | **修订 D124:8000 条的 `fs/index` 快照被截断时,非空的 `@` 查询会在输入停顿后,通过只读的 Electron 通道 `pi-desktop/fs/search` 在该根目录的完整清单中搜索,最好的 50 行与本地匹配合并。完整的索引从不搜索。远程会话保持使用快照。不改变主机 RPC、存储或 schema。** |+| D669 | `@` 查询越过被截断的文件索引 | **修订 D124:8000 条的 `fs/index` 快照被截断时,非空的 `@` 查询会在输入停顿后,通过只读的 Electron 通道 `pi-desktop/fs/search` 在该根目录的完整清单中搜索,最好的 50 行与本地匹配合并。完整的索引从不搜索。远程会话保持使用快照。不改变主机 RPC、存储或 schema。** | 只保留最浅 8000 条的索引,会让深几层目录里的脚本对任何查询都匹配不到,而截断提示还在邀请用户细化查询(issue #1781)。 |## M0. 模型目录决策