Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(composer): sync deep search PR with current main

vastsa739699e56773
diff --cc apps/desktop/src/hooks/use-composer-autocomplete.ts
index 683dcc86a,00292f44b..ff7a69a61
--- a/apps/desktop/src/hooks/use-composer-autocomplete.ts
+++ b/apps/desktop/src/hooks/use-composer-autocomplete.ts
@@@ -24,9 -24,8 +24,9 @@@ import { useAppStore } from "../stores/
/**
* Composer autocomplete state machine (D123–D125): trigger detection over
- * draft+cursor, lazily fetched command/file sources, local fuzzy filtering,
- * and insert-on-accept. IME freezing and key routing live in the Composer;
+ * draft+cursor, lazily fetched command/file sources, local fuzzy filtering
- * (with a main-process search past a truncated file index, D665), and
++ * (with a main-process search past a truncated file index, D669), and
+ * insert-on-accept. IME freezing and key routing live in the Composer;
* this hook only refuses to update while `composing` is true.
*/
@@@ -263,41 -251,6 +263,41 @@@ export function useComposerAutocomplete
};
}, [trigger?.mode, dismissed, workspaceKey, hasWorkspace, sessionId]);
+ // A truncated index keeps only the shallowest entries, so a deep file of a
+ // large tree matches nothing in it. Once typing pauses, the query also
- // searches the main process's full listing (D665); the answer belongs to
++ // searches the main process's full listing (D669); the answer belongs to
+ // this `@` token and its rows merge with the index's.
+ const fileQuery =
+ trigger?.mode === "file" && !dismissed && files?.truncated ? trigger.query : "";
+ const searchScope = `${sessionId ?? ""}\n${workspaceKey}\n${triggerKey ?? ""}`;
+ useEffect(() => {
+ if (!fileQuery) return;
+ let cancelled = false;
+ const timer = setTimeout(() => {
+ void api
+ .fsSearch(sessionId, fileQuery)
+ .then((res) => {
+ if (!cancelled) setFound({ scope: searchScope, ...res });
+ })
+ .catch(() => {
+ // The index's rows still answer; the truncation note stays.
+ if (!cancelled) setFound({ scope: searchScope, entries: [], truncated: true });
+ });
+ }, FILE_SEARCH_DEBOUNCE_MS);
+ return () => {
+ cancelled = true;
+ clearTimeout(timer);
+ };
+ }, [fileQuery, searchScope, sessionId]);
+ // A later `@` at the same offset is a new token and must not inherit rows.
+ useEffect(() => {
+ if (!triggerKey) setFound(null);
+ }, [triggerKey]);
+ // A bare `@` lists the index alone; searched rows belong to a typed query.
+ const foundHere = fileQuery !== "" && found?.scope === searchScope ? found : null;
+ const fileTruncated =
+ (files?.truncated ?? false) && (!fileQuery || !foundHere || foundHere.truncated);
+
// Warm the `/` source once bootstrap settles, so the first slash of a session
// does not wait for a cold host round trip (#1543). Waiting for `ready` keeps
// the pre-warm off the pre-hydration empty workspace key, which would spend a
diff --cc docs/adr/0024-composer-commands-and-file-references.md
index 391f8c3b0,cfdf9958f..7bfa542a3
--- a/docs/adr/0024-composer-commands-and-file-references.md
+++ b/docs/adr/0024-composer-commands-and-file-references.md
@@@ -62,9 -62,6 +62,9 @@@ exported by the installed package and d
fallback, short TTL cache); `pi-desktop/composer/commands` returns the
merged command list. Both fail soft without a workspace. These
Electron-only channels do not change the host RPC protocol version.
- *(Amended by D665: while that index is truncated, a typed query is also
++ *(Amended by D669: while that index is truncated, a typed query is also
+ answered from the full listing by the read-only `pi-desktop/fs/search`,
+ because the shallow-first cap leaves deep files of a large tree out.)*
## Alternatives considered
diff --cc docs/spec/03-runtime/01-ipc-protocol.md
index 6b07edd63,64c0fa905..716770ba9
--- a/docs/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/spec/03-runtime/01-ipc-protocol.md
@@@ -2207,28 -2207,7 +2207,28 @@@ Workspace-rooted relative paths for th
--exclude-standard` fast path, ignore-set recursive walk fallback,
directories derived from file paths, 8000-entry cap with `truncated: true`,
short TTL cache per root. Fails closed to an empty list without a
-workspace. Fuzzy filtering happens renderer-side.
+workspace. Fuzzy filtering happens renderer-side; a truncated index keeps
+only the shallowest entries, so a query against it is also sent to
+`fs/search`.
+
+### fs/search
+
+```ts
+fs/search({ sessionId?, query }) -> { entries: FsIndexEntry[]; truncated: boolean }
+```
+
+The `@` menu calls this only while its `fs/index` snapshot is truncated and
+the query is non-empty, after a short typing pause, then merges the answer
- with its own matches (D665). Main ranks the query with the renderer's fuzzy
++with its own matches (D669). Main ranks the query with the renderer's fuzzy
+scorer over the root's full listing and returns the best 50 entries. The
+listing is the `git ls-files` list behind the index, or — when the index came
+from the walk — a deeper ignore-set walk of at most 200,000 entries or two
+seconds. It shares the index's TTL cache and is released when that expires.
+`truncated: true` means the search itself was capped. The query is trimmed and
+bounded to 256 characters; an empty query returns no entries. A remote session
+returns `{ entries: [], truncated: true }` without contacting its host — the
+remote file protocol has no search operation — so the menu keeps filtering
+the remote snapshot alone.
### composer/pickFiles and composer/pickPhotos
diff --cc docs/spec/04-ux/08-component-spec.md
index 8f1f78ef5,ea74e6206..8827d9a6e
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@@ -3454,13 -3506,9 +3506,13 @@@ Anatomy
at the caret — the same sentinel-backed chip as a pasted file — whose
canonical value is the original `entry.path`; the menu closes and that Enter
does not send. Accepting a directory keeps the literal path in the draft so
- completion can continue. Entries come from `fs/index` (D124, D209, D362). A
- truncation footnote appears when the index is capped; without a workspace the
- menu shows an "open a project" empty state.
+ completion can continue. Entries come from `fs/index` (D124, D209, D362).
+ When that index is capped, a typed query is also searched over the whole
+ listing through `fs/search` once typing pauses, and the found rows merge
- with the local matches (D665). A truncation footnote appears while the list
++ with the local matches (D669). A truncation footnote appears while the list
+ may be incomplete — the bare `@`, until the first search for the token
+ answers, and when a search is itself capped or unavailable, as in remote
+ sessions; without a workspace the menu shows an "open a project" empty state.
- Accepting commands and directories inserts text (`/name ` / `@dir/`);
accepting a completed file inserts the inline chip rather than deleting the
trigger. Immediately
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index 69f9b00f2,73061cc72..e351bd066
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -8764,40 -8778,6 +8778,40 @@@ must keep splitting are covered by `mar
layout covered by `scripts/e2e-composer-autocomplete.mjs`; full UI journey
Draft (run only in a capable environment when this surface changes)
+#### E2E-COMPOSER-deep-file-mentions: `@` reaches deep files in a large workspace
+
+- **Preconditions**: The app is running with an Agent session in a workspace
+ whose index is truncated (more than 8000 files and directories), with a
+ script several folders below thousands of shallow assets — for example a
+ Unity project's `Assets/_Game/Scripts/Gameplay/Player/FeatureController.cs`.
+ Run once with the workspace under git and once without.
+- **Steps**: 1) Type `@` and inspect the footnote. 2) Type the script's name
+ and pause. 3) Accept the script's row with Enter. 4) Edit the query quickly
+ through several prefixes. 5) Repeat in a small workspace and in a remote
+ session.
+- **Expected**:
+ - The bare `@` lists the index and shows the truncation footnote.
+ - After the pause the deep script appears as a row, ranked like any other
+ match, and the footnote disappears once that search has answered; files
+ excluded by `.gitignore` or the ignore set never appear.
+ - Accepting it inserts the same file chip as any other reference.
+ - Rows never belong to an earlier query. The menu keeps the local matches
+ while a search is pending.
+ - A small workspace issues no search request; a remote session keeps its
+ snapshot and footnote.
+- **Specs linked**: `04-ux/08-component-spec.md` §11.8,
+ `03-runtime/01-ipc-protocol.md` §13c, `08-meta/decisions-log.md` (D124,
- D665), ADR 0024
++ D669), ADR 0024
+- **Acceptance**: C (conversation & stream), Quality
+- **Milestone**: M5
+- **Status**: Unit-covered (`packages/host-runtime/src/fs-index.test.ts`
+ covers the git and walk listings, ignore rules, directories, and the result
+ limit); the renderer journey — search after the pause, merge, accept, stale
+ answers, the footnote, and the complete-index path — is covered by
+ `apps/desktop/test/composer-deep-file-search-user-path.test.mjs` in a real
+ Electron renderer. The full desktop journey against a large real tree is
+ Draft (run only in a capable environment when this surface changes).
+
#### E2E-102b: Unanswered Stop restores compact file-reference drafts
- **Preconditions**: An Agent session can delay its first assistant event. The
diff --cc docs/spec/08-meta/decisions-log.md
index 757538dbf,8d6165908..4f7383c09
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@@ -333,6 -332,7 +332,8 @@@ Gold source: local Codex electron captu
| D602 | Crash dumps stay in the data directory | **Electron's Crashpad reporter starts local-only (`uploadToServer: false`) before `ready`. Dumps live under `<data_dir>/crash-dumps`, not the default Electron `userData` crashDumps path, so a `PI_DESKTOP_DATA_DIR` profile does not share dumps. The next lock-holding launch writes one `diagnostics` line for dumps newer than `crash-dumps.json`, classified by Crashpad `ptype`: `error` if any new dump is the browser/main process, `warn` for recovered renderer/GPU/utility crashes. Host-core and sidecar crashes stay on the supervisor path. No upload, no IPC, no schema change.** | A crash left a minidump nobody read. Crashpad also records recovered renderer crashes, so a next-launch `error` that said the previous run died was a lie; and dumps outside the data directory escaped `PI_DESKTOP_DATA_DIR` isolation. |
| 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.** |
## M0. Model catalog decisions
@@@ -7780,25 -7780,100 +7781,123 @@@ must keep splitting are covered by `mar
normalization; no persisted schema or migration change is required. See
`04-ux/01-ui-ia.md`, `04-ux/06-settings-ia.md`, and E2E-266.
- ## 2026-10-19 — `@` queries search past a truncated file index (D665)
+ ## 2026-10-16 — macOS paints an opaque native window surface (D665)
+
+ - D665 supersedes the macOS `vibrancy: "sidebar"` + `transparent: true` window
+ backing from D348. A vibrancy material behind a transparent surface is
+ recomposited by WindowServer every frame the window stays dirty, which held an
+ idle focused window near 40% GPU on Apple Silicon (issue #1064). macOS now
+ paints the opaque background the other platforms already use, keeping the
+ `hiddenInset` titlebar, the inset traffic-light position, and the renderer's
+ sidebar tint and sheen.
+ - The `window.setBackgroundColor` IPC no longer returns early on darwin, so a
+ granted `windowAppearance.backgroundColor` plugin theme is applied on macOS
+ like every other platform (ADR 0248): a theme change repaints the native
+ surface instead of being skipped. Native corner behavior is unchanged.
+ - The bounded-animation contract that bounded idle indicators under #1064 stays
+ in force; only its stated rationale changes, because a dirty window is
+ recomposited on every platform. See ADR 0332, ADR 0248, ADR 0260,
+ `04-ux/08-component-spec.md`, `04-ux/07-ui-design-system.md`, and
+ `07-plugins/13-plugin-permissions-matrix.md`.
+ - Covered by `apps/desktop/test/macos-opaque-window-surface.test.mjs`,
+ `apps/desktop/test/window-background.test.mjs`,
+ `apps/desktop/test/window-background-theme.test.mjs`, and
+ `apps/desktop/test/idle-status-animations.test.mjs`.
+
+ ## 2026-10-20 — macOS translucency is a window setting (D666, amended by D667)
+
+ - D666 amends D665 / ADR 0332: the macOS main window still paints an opaque
+ native surface by default, and `AppSettings.macosWindowTranslucency` lets a
+ user opt back into the `sidebar` vibrancy material behind a transparent
+ backing. `macosWindowSurfaceOptions(translucent, color)` is the single surface
+ declaration; `mainWindowBackgroundOptions("darwin", color)` keeps the opaque
+ result so a platform-only caller never gets the material.
+ - Electron fixes `transparent` when a window is created, so the preference is
+ read before `new BrowserWindow` and a change applies on the next launch. The
+ darwin-only Settings → General → Appearance row persists the choice and shows
+ a restart hint while it differs from the surface this process was created
+ with; no runtime window mutation, renderer reload, or relaunch is performed.
+ - While the window is translucent, `window.setBackgroundColor` leaves the
+ surface to the material, so a plugin theme's
+ `windowAppearance.backgroundColor` is applied only on the opaque surface. The
+ renderer tint and sheen are unchanged in both modes, and no persisted-format
+ migration is required (D667 changed the absent-value meaning to translucent).
+ - Covered by `apps/desktop/test/macos-window-translucency.test.mjs`,
+ `apps/desktop/test/macos-opaque-window-surface.test.mjs`, and
+ `apps/desktop/test/window-background.test.mjs`. See ADR 0332,
+ `04-ux/08-component-spec.md`, and `04-ux/07-ui-design-system.md`.
+
+ ## 2026-10-20 — macOS translucency stays the default (D667)
+
+ - D667 amends D665 / D666 and ADR 0332: the macOS main window ships
+ **translucent** again — `vibrancy: "sidebar"`, `visualEffectState:
+ "followWindow"`, and a transparent `#00000000` backing — and
+ `AppSettings.macosWindowTranslucency` is the opt-out. Absent and `true` mean
+ the shipped material; only `false` paints the opaque surface that leaves
+ WindowServer's per-frame recomposition path (#1064). The store itself defaults
+ to translucent, so a boot that cannot read settings still paints the expected
+ window.
+ - A translucent window owns its pixels: the post-creation
+ `applyMainWindowBackground` call now skips macOS windows created translucent,
+ in addition to the already-guarded `window.setBackgroundColor` and theme paths.
+ Without that guard the window was created with the material and then had an
+ opaque host colour painted over it, so the switch looked inert after a restart.
+ `window/control` `getState` keeps reporting the surface the process actually
+ created, which keeps the Settings restart hint honest.
+ - No persisted migration: an absent value now means translucent, which restores
+ the pre-D665 appearance for every existing install, and an explicit `false`
+ keeps the opaque choice a user already made. See ADR 0332, ADR 0248,
+ `04-ux/06-settings-ia.md`, `04-ux/08-component-spec.md`, and
+ `apps/desktop/test/macos-window-translucency.test.mjs`.
+
+ ## 2026-10-21 — One process disclosure per turn, with three transcript display modes (D668)
+
+ - D668 amends D661 / the `turn-process-and-thinking-display` ADR: a turn now
+ renders exactly one top-level process disclosure containing every pre-answer
+ row. No run row is a sibling of that disclosure; the trailing answer, assistant
+ errors, stopped trailing text, and pending action surfaces stay outside it.
+ - `AppSettings.transcriptDisplayMode` selects the layout. `flat` renders no
+ nested activity groups and lists rows in transcript order. `command-first`
+ keeps the groups but lifts `Bash`/run rows into standalone rows, with a normal
+ progress message or a command ending a group. `fully-folded`, the default for
+ absent or invalid values, keeps run rows inside their groups and lets only
+ ordinary assistant progress text split them. The mode is read while rendering,
+ so switching repaints immediately.
+ - With `showThinking` on, Thinking rows default expanded in `flat` and
+ `command-first`; `fully-folded` keeps the released exception where only the
+ last active row opens while it is live. With the preference off, no completed
+ reasoning row renders and only a live whole-run TextShimmer `Thinking`
+ indicator remains while reasoning streams.
+ - `keepCommandsExpanded` is deprecated and retained only for persisted-settings
+ compatibility; it is no longer exposed or read for rendering. The disclosure
+ header, left edge, and pane-owned disclosure memory are unchanged.
+ - Covered by `apps/desktop/test/turn-process.test.mjs`,
+ `apps/desktop/test/transcript-display-modes-ui.test.mjs`,
+ `apps/desktop/test/transcript-display-mode-settings.test.mjs`, and
+ `apps/desktop/test/settings-roundtrip.test.mjs`. 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.
++
++## 2026-10-19 — `@` queries search past a truncated file index (D669)
+
+- The `fs/index` snapshot keeps the shallowest 8000 entries, and the menu
+ fuzzy-filtered only that snapshot. In a large tree — a Unity project, where
+ every asset has a `.meta` sibling — scripts several folders deep were never
+ in it, so no query could reach them even though the truncation footnote
+ invited refining the query (issue #1781).
+- While the snapshot is truncated, a non-empty query is now also sent to
+ `fs/search` after a 150 ms typing pause. Main ranks it with the renderer's
+ scorer over the listing it already built for the index (`git ls-files`), or
+ over a deeper ignore-set walk (at most 200,000 entries or two seconds) when
+ the index came from the walk, and returns the best 50 rows. The menu merges
+ them with its local matches; an answer for an earlier query is dropped.
+- A complete index never searches, so small projects behave as before. The
+ footnote stays while the list may be incomplete. Remote sessions keep their
+ snapshot because the remote file protocol has no search operation. Bundling
+ a native lister (ripgrep, bfs) was not needed: git already lists the whole
+ repository, and searching 60,000 paths takes a few milliseconds.
+- Covered by `packages/host-runtime/src/fs-index.test.ts` and
+ `apps/desktop/test/composer-deep-file-search-user-path.test.mjs`. See
+ `03-runtime/01-ipc-protocol.md` §13c, `04-ux/08-component-spec.md` §11.8,
+ and E2E-COMPOSER-deep-file-mentions.
diff --cc docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
index 10c9a8395,79a7716a2..d01a1e988
--- a/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
@@@ -1664,23 -1664,7 +1664,23 @@@ type FsIndexEntry = { path: string; kin
--exclude-standard`快速路径,忽略设置递归行走回退,
从文件路径派生的目录,8000 个条目上限,`truncated: true`,
每个根的短 TTL 缓存。无法关闭到空列表而没有
-工作区。模糊过滤发生在渲染器端。
+工作区。模糊过滤发生在渲染器端;被截断的索引只保留最浅的条目,因此针对它的
+查询还会发给 `fs/search`。
+
+### fs/search
+
+```ts
+fs/search({ sessionId?, query }) -> { entries: FsIndexEntry[]; truncated: boolean }
+```
+
+只有当 `fs/index` 快照被截断且查询非空时,`@` 菜单才会在输入短暂停顿后调用它,
- 并把结果与自己的匹配合并(D665)。主进程用与渲染器相同的模糊打分,在该根目录的
++并把结果与自己的匹配合并(D669)。主进程用与渲染器相同的模糊打分,在该根目录的
+完整清单上排序,返回最好的 50 个条目。清单就是索引背后的 `git ls-files` 列表;
+若索引来自目录遍历,则改为一次更深的遍历(遵守同一忽略集,最多 200,000 个条目或
+2 秒)。清单与索引共用 TTL 缓存,过期即释放。`truncated: true` 表示搜索本身被截断。
+查询会去掉首尾空白并限制在 256 个字符内;空查询不返回条目。远程会话直接返回
+`{ entries: [], truncated: true }`,不联系远程主机——远程文件协议没有搜索操作——
+菜单继续只在远程快照里过滤。
### composer/pickFiles 和 composer/pickPhotos
diff --cc docs/zh-CN/spec/04-ux/08-component-spec.md
index 4afd8c37c,07c8a7fef..b23fd19d6
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@@ -2290,11 -2316,8 +2316,11 @@@ Live Voice 受现有开发者模式和�
(Enter、Tab 或点击)会把 `@` 标记替换为光标处的行内叶名芯片
—— 与粘贴文件相同的哨兵芯片 —— 其规范值为原始 `entry.path`;
菜单关闭且这次 Enter 不会发送。接受目录会将文字路径保留在草稿中,
- 以便完成可以继续。条目来自 `fs/index`(D124、D209、D362)。一个
- 当索引被限制时出现截断脚注;没有工作空间
+ 以便完成可以继续。条目来自 `fs/index`(D124、D209、D362)。
+ 索引被截断时,输入停顿后查询还会通过 `fs/search` 在完整清单中搜索,
- 搜到的行与本地匹配合并(D665)。列表可能不完整时显示截断脚注——
++ 搜到的行与本地匹配合并(D669)。列表可能不完整时显示截断脚注——
+ 只输入 `@` 时、该标记的第一次搜索返回之前,以及搜索本身被截断或不可用
+ (如远程会话)时;没有工作空间
菜单显示“打开项目”空状态。
- 接受命令和目录插入文本(`/name ` / `@dir/`);
接受完成的文件会插入行内芯片,而不是删除触发符。立即
diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 086d23b4e,f292bc371..e81de2283
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@@ -5288,32 -5297,6 +5297,32 @@@ eleven-tool-round desktop paths are ver
布局由 `scripts/e2e-composer-autocomplete.mjs` 覆盖;完整的用户界面
旅程草稿(适用变更合入前需在具备条件的环境中运行 E2E)
+#### E2E-COMPOSER-deep-file-mentions:`@` 能找到大型工作区里的深层文件
+
+- **先决条件**:应用程序正在一个索引被截断(超过 8000 个文件和目录)的工作区中使用
+ Agent 会话运行,其中有一个脚本位于数千个浅层资源之下的几层目录里——例如 Unity
+ 项目的 `Assets/_Game/Scripts/Gameplay/Player/FeatureController.cs`。工作区在 git
+ 管理下和不在 git 管理下各运行一次。
+- **步骤**:1) 输入 `@` 并检查脚注。2) 输入脚本名称后停顿。3) 用 Enter 接受该脚本的行。
+ 4) 快速把查询改成几个不同的前缀。5) 在小工作区和远程会话中重复。
+- **预期**:
+ - 只输入 `@` 时列出索引并显示截断脚注。
+ - 停顿后深层脚本作为一行出现,排序与其他匹配一致;这次搜索返回后脚注消失;被
+ `.gitignore` 或忽略集排除的文件从不出现。
+ - 接受后插入与其他引用相同的文件芯片。
+ - 行永远不属于更早的查询。搜索进行中菜单保留本地匹配。
+ - 小工作区不发出搜索请求;远程会话保持使用快照并保留脚注。
+- **链接规格**:`04-ux/08-component-spec.md` §11.8、`03-runtime/01-ipc-protocol.md`
- §13c、`08-meta/decisions-log.md`(D124、D665)、ADR 0024
++ §13c、`08-meta/decisions-log.md`(D124、D669)、ADR 0024
+- **接受**:C(对话和直播),质量
+- **里程碑**:M5
+- **状态**:单元覆盖(`packages/host-runtime/src/fs-index.test.ts` 覆盖 git 与遍历两种
+ 清单、忽略规则、目录以及结果上限);渲染层旅程——停顿后搜索、合并、接受、过期
+ 结果、脚注以及完整索引路径——由
+ `apps/desktop/test/composer-deep-file-search-user-path.test.mjs` 在真实 Electron
+ 渲染器中覆盖。针对大型真实目录树的完整桌面旅程为草稿(适用变更合入前需在具备
+ 条件的环境中运行 E2E)。
+
#### E2E-102b:未答复的停止恢复紧凑的文件参考草稿
- **先决条件**:Agent 会话可以延迟其第一个辅助事件。的
diff --cc docs/zh-CN/spec/08-meta/decisions-log.md
index 1b25b35aa,44972d4d0..6d1aea64b
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@@ -336,6 -335,7 +335,8 @@@
| D602 | 崩溃转储留在数据目录 | **Electron 的 Crashpad 报告器在 `ready` 之前以本地模式启动(`uploadToServer: false`)。转储放在 `<data_dir>/crash-dumps`,而不是 Electron 默认的 `userData` crashDumps 路径,因此 `PI_DESKTOP_DATA_DIR` profile 不会与其它安装共用转储。下一次持有单实例锁的启动会为新于 `crash-dumps.json` 的转储写一条 `diagnostics` 记录,按 Crashpad `ptype` 分类:任一新转储属于 browser/main 进程则为 `error`,已恢复的 renderer/GPU/utility 崩溃为 `warn`。host-core 与 sidecar 崩溃仍走监督器路径。不上传,不改 IPC,不改 schema。** | 崩溃留下的 minidump 无人读取。Crashpad 也会记录已恢复的渲染进程崩溃,因此下次启动用 `error` 声称上次运行已死是错的;而数据目录之外的转储会逃出 `PI_DESKTOP_DATA_DIR` 隔离。 |
| 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。** |
## M0. 模型目录决策
@@@ -5490,19 -5490,23 +5491,40 @@@ Markdown 源码,不是 `text/html` �
schema 或迁移。设置读取通过渲染层 API 规范化应用这些默认值。见
`04-ux/01-ui-ia.md`、`04-ux/06-settings-ia.md` 与 E2E-266。
- ## 2026-10-19 —— `@` 查询越过被截断的文件索引(D665)
+ ## 2026-10-21 —— 每回合一个过程披露与三种转录显示模式(D668)
+
+ - D668 修订 D661 / `turn-process-and-thinking-display` ADR:每个回合现在渲染一个顶层
+ 过程披露,包含回答前的全部行。命令行不再是披露的同级;末尾回答、助手错误、中止后的
+ 末尾文字和待处理操作面留在披露之外。
+ - `AppSettings.transcriptDisplayMode` 选择布局。`flat` 不渲染嵌套活动组,按转录顺序列出
+ 各行。`command-first` 保留活动组,但把 `Bash`/run 行提升为独立行,普通进度消息或命令
+ 会结束当前组。`fully-folded` 是缺失或无效值的默认,让命令行留在所属组内,只有普通助手
+ 进度文字会拆分活动组。该模式在渲染时读取,因此切换后立即重绘。
+ - `showThinking` 开启时,`flat` 与 `command-first` 中的思考行默认展开;`fully-folded`
+ 保留已发布的例外,只有最后一个活动行在其为当前步骤时展开。关闭偏好时不再渲染任何
+ 已完成的推理行,仅在推理流式输出期间保留整段运行的 TextShimmer `Thinking` 指示器。
+ - `keepCommandsExpanded` 已弃用,仅为持久化设置兼容性保留;不再暴露,也不再参与渲染
+ 读取。披露标题、左边缘与窗格拥有的披露记忆保持不变。
+ - 已由 `apps/desktop/test/turn-process.test.mjs`、
+ `apps/desktop/test/transcript-display-modes-ui.test.mjs`、
+ `apps/desktop/test/transcript-display-mode-settings.test.mjs` 与
+ `apps/desktop/test/settings-roundtrip.test.mjs` 覆盖。见修订后的 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。
++
++## 2026-10-19 —— `@` 查询越过被截断的文件索引(D669)
+
+- `fs/index` 快照只保留最浅的 8000 个条目,菜单也只在这份快照里模糊过滤。在大项目里
+ ——例如每个资源都带一个 `.meta` 文件的 Unity 项目——藏在几层目录下的脚本根本不在
+ 快照中,无论怎么输入都找不到,尽管截断脚注提示用户继续输入(issue #1781)。
+- 快照被截断时,非空查询现在会在输入停顿 150 ms 后同时发给 `fs/search`。主进程用与
+ 渲染器相同的打分,在它为索引已经构建好的清单(`git ls-files`)上排序;若索引来自
+ 目录遍历,则改为一次更深的遍历(遵守同一忽略集,最多 200,000 个条目或 2 秒),
+ 返回最好的 50 行。菜单把它们与本地匹配合并;较早查询的结果会被丢弃。
+- 完整的索引从不搜索,小项目行为不变。列表可能不完整时截断脚注保留。远程会话继续
+ 使用快照,因为远程文件协议没有搜索操作。不需要打包原生列文件工具(ripgrep、bfs):
+ git 本来就能列出整个仓库,搜索 60,000 个路径只需几毫秒。
+- 由 `packages/host-runtime/src/fs-index.test.ts` 与
+ `apps/desktop/test/composer-deep-file-search-user-path.test.mjs` 覆盖。见
+ `03-runtime/01-ipc-protocol.md` §13c、`04-ux/08-component-spec.md` §11.8 与
+ E2E-COMPOSER-deep-file-mentions。
diff --cc packages/host-runtime/src/fs-index.ts
index 5a63abab2,5f4673a28..e3d2ca987
--- a/packages/host-runtime/src/fs-index.ts
+++ b/packages/host-runtime/src/fs-index.ts
@@@ -15,9 -10,8 +15,9 @@@ import { isIgnoredName } from "./worksp
* Served from the main process like the files tab (ADR 0019): user-driven
* browsing must not round-trip agent tools or permission prompts. The index
* prefers `git ls-files` for exact gitignore semantics and falls back to a
- * bounded walk over the panel's ignore set. Fuzzy filtering happens in the
- * renderer; this only snapshots relative paths.
+ * bounded walk over the panel's ignore set. The renderer fuzzy-filters the
+ * snapshot itself; when the snapshot is truncated, a query is also answered
- * here from the full listing (D665).
++ * here from the full listing (D669).
*/
export const FS_INDEX_MAX_ENTRIES = 8000;