Merge remote-tracking branch 'origin/master' into feat/sdk-resume-permissions

This commit is contained in:
fz committed 2026-11-13 14:51:36 +08:00
commit 9cd8d21e43
166 files changed
+2580 -479

No files matched your search

@@ -9,8 +9,8 @@
en: fa4d3622fb18dd58
zh: 2b98640594c8344b
/agent-note-one-harness-home-resolver/decision:
en: 816e5109718bc4ae
zh: af3f08f07c3cb761
en: a9d9f7bf051341e9
zh: cc1fed8d2b606276
/agent-note-one-harness-home-resolver/alternatives-considered:
en: b1c9535540171d47
zh: 7df816d42945db94
@@ -21,9 +21,9 @@ One resolver owns the harness home, in `@deepseek-ai/dsh-home-paths`, single-roo
explicit configured path > $DSH_HOME > ~/.dsh
```
An empty or whitespace-only `$DSH_HOME` is treated as unset; otherwise `resolve('')` would silently place the home at the current working directory. The harness keeps all user data under one root; there is no XDG config/data/cache split. `dshHomePath(...segments)` joins deployment-owned children onto that root, and `dsh-app-boot` exposes it to Loader `!!js` config expressions before mounting entries, so shipped compositions derive `sessions` and `storages` without copying the resolver. `dshHomeDisplay()` names a resolved root symbolically for user-facing paths — `~/.dsh` for the default home, `$DSH_HOME` for any configured home — so the user-global `AGENTS.md` label never leaks an absolute machine path. It replaces agent-instructions's bespoke default-vs-`$DSH_HOME` check. Home is process policy rather than row configuration: `dsh-agent-instructions` accepts no home override, so a composition cannot point instruction loading at a root that sessions, skills, and storage would not read. `resolveAgentsHome()` and `agentsHomeDisplay()` apply the same precedence, tilde expansion, and symbolic labelling to the shared agent configuration root (`$DSH_AGENTS_HOME` or `~/.agents`), which stays outside the harness home because other agent tools share it ([shared agents root](2026-10-05-shared-agents-root-instructions.md)); `dsh-skill-filesystem` still accepts its own `dshHome` and `agentsHome` fields, which select its own skill roots and resolve through the shared resolver in the instruction-loading change.
An empty or whitespace-only `$DSH_HOME` is treated as unset; otherwise `resolve('')` would silently place the home at the current working directory. The harness keeps all user data under one root; there is no split into separate XDG roots. `dshHomePath(...segments)` joins deployment-owned children onto that root, and `dsh-app-boot` exposes it to Loader `!!js` config expressions before mounting entries, so shipped compositions derive `sessions` and `storages` without copying the resolver. `dshHomeDisplay()` names a resolved root symbolically for user-facing paths — `~/.dsh` for the default home, `$DSH_HOME` for any configured home — so the user-global `AGENTS.md` label never leaks an absolute machine path. It replaces agent-instructions's bespoke default-vs-`$DSH_HOME` check. Home is process policy rather than row configuration: `dsh-agent-instructions` accepts no home override, so a composition cannot point instruction loading at a root that sessions, skills, and storage would not read. `resolveAgentsHome()` and `agentsHomeDisplay()` apply the same precedence, tilde expansion, and symbolic labelling to the shared agent configuration root (`$DSH_AGENTS_HOME` or `~/.agents`), which stays outside the harness home because other agent tools share it ([shared agents root](2026-10-05-shared-agents-root-instructions.md)); `dsh-skill-filesystem` still accepts its own `dshHome` and `agentsHome` fields, which select its own skill roots and resolve through the shared resolver in the instruction-loading change.
`dshCachePath(...segments)` derives paths below the resolved home's `cache` directory. An initial `{ dshHome }` option preserves a provider's explicit home override. It resolves paths without creating directories; callers own directory creation. `attachment-local` uses this helper for regenerable request-image variants while retaining durable attachment objects in their versioned storage tree, so clearing the cache cannot remove Session attachments. Existing request-image cache entries are left in place and are not read or copied; a cache miss regenerates the variant from its durable attachment.
`dshPath(category, ...segments)` derives paths below a `config`, `data`, `state`, `cache`, or `backup` directory of that one root, and app-boot exposes it to Loader `!!js` expressions beside `dshHomePath`; the [home path categories proposal](../../proposed/architecture/2026-11-04-dsh-home-path-categories.md) owns the categories and which existing entries keep their top-level locations. `dshCachePath(...segments)` is `dshPath('cache', ...segments)`. An initial `{ dshHome }` option preserves a provider's explicit home override. It resolves paths without creating directories; callers own directory creation. `attachment-local` uses this helper for regenerable request-image variants while retaining durable attachment objects in their versioned storage tree, so clearing the cache cannot remove Session attachments. Existing request-image cache entries are left in place and are not read or copied; a cache miss regenerates the variant from its durable attachment.
`@deepseek-ai/dsh-home` is deleted. Home-owning providers and boot packages import `resolveDshHome` from `dsh-home-paths`; composition bundles contain only the resolved configuration rows.
@@ -21,9 +21,9 @@ Status: implemented
explicit configured path > $DSH_HOME > ~/.dsh
```
空或仅含空白的 `$DSH_HOME` 被当作未设置处理;否则,`resolve('')` 会悄悄把 home 落在当前工作目录。harness 把所有用户数据都放在同一个根目录下;不存在 XDG 的 config/data/cache 拆分。`dshHomePath(...segments)` 将部署负责的子路径拼接到该根目录下,`dsh-app-boot` 在挂载条目前向 Loader `!!js` 配置表达式暴露它,因此出厂组合无需复制解析器即可派生 `sessions` 和 `storages`。`dshHomeDisplay()` 为面向用户的路径以符号形式命名已解析的根目录——默认 home 显示为 `~/.dsh`,任何已配置的 home 显示为 `$DSH_HOME`——这样用户全局的 `AGENTS.md` 标签就绝不会泄露机器上的绝对路径。它取代了 agent-instructions 中自定义的「默认值 vs `$DSH_HOME`」判断。home 属于进程策略而非配置行:`dsh-agent-instructions` 不接受 home 覆盖,因此组合无法把指令加载指向会话、skill 与存储不会读取的根目录。`resolveAgentsHome()` 与 `agentsHomeDisplay()` 对共享 agent 配置根目录(`$DSH_AGENTS_HOME` 或 `~/.agents`)采用相同的优先级、波浪号展开与符号化标签;该根目录位于 harness home 之外,因为其他 agent 工具会共享它([共享 agents 根目录](2026-10-05-shared-agents-root-instructions.zh.md));`dsh-skill-filesystem` 仍接受自己的 `dshHome` 与 `agentsHome` 字段,用于选择它自己的 skill 根目录,并在指令加载改动中改用共享解析器。
空或仅含空白的 `$DSH_HOME` 被当作未设置处理;否则,`resolve('')` 会悄悄把 home 落在当前工作目录。harness 把所有用户数据都放在同一个根目录下;不拆分到各自独立的 XDG 根目录。`dshHomePath(...segments)` 将部署负责的子路径拼接到该根目录下,`dsh-app-boot` 在挂载条目前向 Loader `!!js` 配置表达式暴露它,因此出厂组合无需复制解析器即可派生 `sessions` 和 `storages`。`dshHomeDisplay()` 为面向用户的路径以符号形式命名已解析的根目录——默认 home 显示为 `~/.dsh`,任何已配置的 home 显示为 `$DSH_HOME`——这样用户全局的 `AGENTS.md` 标签就绝不会泄露机器上的绝对路径。它取代了 agent-instructions 中自定义的「默认值 vs `$DSH_HOME`」判断。home 属于进程策略而非配置行:`dsh-agent-instructions` 不接受 home 覆盖,因此组合无法把指令加载指向会话、skill 与存储不会读取的根目录。`resolveAgentsHome()` 与 `agentsHomeDisplay()` 对共享 agent 配置根目录(`$DSH_AGENTS_HOME` 或 `~/.agents`)采用相同的优先级、波浪号展开与符号化标签;该根目录位于 harness home 之外,因为其他 agent 工具会共享它([共享 agents 根目录](2026-10-05-shared-agents-root-instructions.zh.md));`dsh-skill-filesystem` 仍接受自己的 `dshHome` 与 `agentsHome` 字段,用于选择它自己的 skill 根目录,并在指令加载改动中改用共享解析器。
`dshCachePath(...segments)` 在解析出的主目录下的 `cache` 目录中派生路径。首个 `{ dshHome }` 选项保留提供方显式配置的主目录覆盖值。它只解析路径,不创建目录;目录创建由调用方负责。`attachment-local` 将此函数用于可重新生成的请求图片版本,持久附件对象仍保留在其带版本的存储树中,因此清空缓存不会删除 Session 附件。已有请求图片缓存条目保留在原处,不再读取或复制;缓存未命中时从持久附件重新生成请求版本。
`dshPath(category, ...segments)` 在该根目录下的 `config`、`data`、`state`、`cache` 或 `backup` 目录中派生路径,app-boot 将它与 `dshHomePath` 一并暴露给 Loader `!!js` 表达式;类别定义以及哪些现有条目保留顶层位置由 [home 路径类别提案](../../proposed/architecture/2026-11-04-dsh-home-path-categories.zh.md)负责。`dshCachePath(...segments)` 等同于 `dshPath('cache', ...segments)`。首个 `{ dshHome }` 选项保留提供方显式配置的主目录覆盖值。它只解析路径,不创建目录;目录创建由调用方负责。`attachment-local` 将此函数用于可重新生成的请求图片版本,持久附件对象仍保留在其带版本的存储树中,因此清空缓存不会删除 Session 附件。已有请求图片缓存条目保留在原处,不再读取或复制;缓存未命中时从持久附件重新生成请求版本。
`@deepseek-ai/dsh-home` 被删除。拥有 home 配置的提供方与 boot 包从 `dsh-home-paths` 导入 `resolveDshHome`;组合包只包含解析后的配置行。
@@ -0,0 +1,34 @@
# Bilingual-pair consistency record for 2026-11-04-dsh-home-path-categories.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/proposed/architecture/2026-11-04-dsh-home-path-categories.md
/agent-note-harness-home-path-categories:
en: 007593701a0d6bf5
zh: 3bf266378e3bba08
/agent-note-harness-home-path-categories/problem:
en: 3e98d90944daeb05
zh: 596f750e878f3e69
/agent-note-harness-home-path-categories/proposal:
en: 76abf280dfdba9bc
zh: 0ad29c3c67208086
/agent-note-harness-home-path-categories/proposal/path-helper:
en: 6f34630c5b05b0d7
zh: 2106fdbf4f5ca852
/agent-note-harness-home-path-categories/proposal/conventional-top-level-entries:
en: 940f404152322a33
zh: 5668927394d05723
/agent-note-harness-home-path-categories/proposal/other-existing-entries:
en: a8242fc3bbe3fe7a
zh: b90f9e9deda18e78
/agent-note-harness-home-path-categories/proposal/outside-the-home:
en: 9d78c323d3f9d159
zh: e11a87b74fe11e5c
/agent-note-harness-home-path-categories/alternatives-considered:
en: cfa4bc5557af4117
zh: 7971e54d5770d9aa
/agent-note-harness-home-path-categories/acceptance-criteria:
en: bf87d444099ebb2b
zh: 8315e6ddc07fe3c7
/agent-note-harness-home-path-categories/risks:
en: aa70b3a0243a1853
zh: 64c74b62d3a42472
@@ -0,0 +1,83 @@
# Agent Note: Harness home path categories
Status: proposed
English | [中文](2026-11-04-dsh-home-path-categories.zh.md)
## Problem
Each package builds its own path under `$DSH_HOME` (default `~/.dsh`), so the home root mixes user configuration, durable records, logs, indexes, and downloads. A new service or plugin has no rule for where its files belong, and some owners resolve the home by hand: [liveshare](../../../../packages/experimental/liveshare/src/host/share-host.ts) reads `process.env.DSH_HOME` directly, and [migrate-sessions-to-v4](../../../../scripts/migrate-sessions-to-v4.ts) defaults to `~/.dsh/sessions` without reading `DSH_HOME`.
## Proposal
Group paths under `$DSH_HOME` by the kinds the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir/latest/) uses. Every category stays inside `$DSH_HOME`; the harness does not read `XDG_*` variables.
| Category | Holds | Losing it |
|---|---|---|
| `config` | Files a person writes or edits to configure the harness | Loses the user's configuration |
| `data` | Durable records: user work, sign-ins, installed software | Loses user work, sign-ins, or installed software |
| `state` | Records that persist across runs but are not user work: logs, indexes, ids, retained outputs | Resets history; the harness keeps working |
| `cache` | Content the harness can rebuild or download again | Costs time or bandwidth only |
| `backup` | Backup archives the harness writes, such as compressed copies of the home or a profile | Nothing; the archives are not read during normal operation |
There is no `runtime` category, the XDG kind for sockets and pid files, because no owner needs one under the home: locks sit beside the file they protect, and live sockets stay in the operating-system temporary directory because Unix socket paths have a length limit. `backup` is not an XDG kind: it gives backup archives one directory that users and cleanup tools can empty at any time without affecting a running harness or the records the archives copy.
### Path helper
[`dshPath(category, ...segments)`](../../../../packages/util/home-paths/src/index.ts) in `@deepseek-ai/dsh-home-paths` returns `<home>/<category>/<segments>` without creating directories; `dshPath({ category, dshHome }, ...segments)` resolves an explicit configured home. Loader `!!js` config expressions receive the same function beside `dshHomePath`. A new path under the home uses `dshPath` and passes its owner's directory name, normally the package name without the `@deepseek-ai/dsh-` prefix, as the first segment. `dshHomePath` remains for the existing top-level entries, and `dshCachePath` is `dshPath('cache', ...)`.
### Conventional top-level entries
Users open, edit, and script against these entries directly, and documentation across the repository names them, so they keep their current top-level locations and are not candidates for moving:
| Path under `$DSH_HOME` | Owner | Kind |
|---|---|---|
| `.env` | [app-boot](../../../../packages/boot/app-boot/README.md) environment layer | config |
| `cordis.patch.yml` | [app-boot](../../../../packages/boot/app-boot/README.md) home patch layer | config |
| `AGENTS.md` | [agent-instructions](../../../../packages/context/agent-instructions/README.md) | config |
| `skills/` | [skill-filesystem](../../../../packages/skill/skill-filesystem/README.md) | config |
| `.credentials.yaml` | [credentials-local](../../../../packages/credentials/credentials-local/README.md) | data |
| `profiles/<name>/` | [app-boot](../../../../packages/boot/app-boot/README.md), plugin-manager, Desktop (`desktop` profile and its `lock`) | data |
| `sessions/` | session-persistence-jsonl root in the base and sdk-minimal bundles | data |
| `cache/` | already the `cache` category | cache |
Files inside a profile directory, such as `node_modules/`, `pnpm-lock.yaml`, `compatibility.json`, `.plugin-manager/`, `.plugin-market/repositories/`, `created-plugins/`, and `cua-*.lock`, stay with their profile because pnpm and the profile tools address them relative to it. The legacy `settings.yaml` importer keeps reading the home root because that file is the import source.
### Other existing entries
These entries have no user-facing convention. Each row names the category it belongs to; moving it is a separate change that needs a data migration plan:
| Current path under `$DSH_HOME` | Category | Owner | Why |
|---|---|---|---|
| `storages/` | `data` | storage-json root in the base bundle | Workspace, schedule, and other domain records; its `session_projcache` unit is a rebuildable cache, but storage-json has one root |
| `attachments/v1/` | `data` | [attachment-local](../../../../packages/attachment/attachment-local/README.md) | User attachments; Session history records their absolute paths |
| `dsh-runtimes/` | `data` | Desktop offline runtimes ([workspace-dependencies](../../../../packages/bundle/web-app/cordis.patch.yml)) | Installed software that may hold user additions |
| `liveshare/` | `data` | [liveshare](../../../../packages/experimental/liveshare/README.md) owner state and credential | Holds management tokens |
| `.anonymous-user-id` | `state` | [anonymous-user-id](../../../../packages/identity/anonymous-user-id/README.md) | Losing it only issues a new id |
| `logs/` | `state` | CLI startup failure reports | Logs |
| `llm-deepseek/files-v3.json` | `state` | [llm-deepseek](../../../../packages/llm/llm-deepseek/README.md) upload index | Derived index |
| `office-kit/outputs/` | `state` | [office-kit](../../../../packages/document/office-kit/README.md) | Retained conversion outputs removed after their retention period |
| `speech-to-text/sensevoice/` | `cache` | voice-input-bundle | Downloadable models |
| `cache/attachments/` | `cache` | attachment-local request images | Already in `cache` |
### Outside the home
These locations are out of scope: `~/.agents` (`DSH_AGENTS_HOME`), shared with other agent tools; Electron `userData` and `logs`, managed by Electron; the Python SDK resource cache `~/.cache/deepseek-harness/resources` (`DSH_RESOURCE_CACHE`), shared across homes; spill and subprocess output directories under the operating-system temporary directory; and developer or release script state such as `~/.dsh-desktop-signing`.
## Alternatives considered
**Move every entry now.** A first draft moved all entries, including the conventional ones, into category directories with no fallback. It made every existing home look empty after an upgrade, broke absolute attachment paths recorded in Sessions, and renamed files users edit by hand. The conventional entries above now stay, and the remaining moves wait for a migration plan.
**Read `XDG_*` variables.** Splitting the home across `XDG_CONFIG_HOME`, `XDG_DATA_HOME`, and similar roots would scatter one installation across several directories and break the single `DSH_HOME` override that tests, the SDK, and Desktop rely on; the [single harness home resolver](../../implemented/architecture/2026-07-24-single-harness-home-resolver.md) already rejected separate roots. The proposal borrows only the classification, inside that one root.
**Add a `runtime` category.** No current owner needs one; adding it would publish an unused value.
## Acceptance criteria
- New paths under `$DSH_HOME` are built with `dshPath` and land in one category directory.
- Each move of an entry from "Other existing entries" ships with a migration that preserves existing user data, plus an upgrade guide.
- The conventional top-level entries keep their locations.
## Risks
Until migrations land, the home holds both category directories and legacy top-level entries. Moving `attachments/` invalidates absolute paths in Session history unless the migration keeps the old location readable. Owners that resolve the home by hand do not pick up the helper until they are changed.
@@ -0,0 +1,83 @@
# Agent Note: harness home 路径类别
Status: proposed
[English](2026-11-04-dsh-home-path-categories.md) | 中文
## 问题
各个包在 `$DSH_HOME`(默认 `~/.dsh`)下自行构造路径,因此 home 根目录混杂着用户配置、持久记录、日志、索引和下载内容。新的服务或插件没有规则可以确定其文件应放在哪里,部分负责方还会手动解析 home:[liveshare](../../../../packages/experimental/liveshare/src/host/share-host.ts) 直接读取 `process.env.DSH_HOME`,[migrate-sessions-to-v4](../../../../scripts/migrate-sessions-to-v4.ts) 默认使用 `~/.dsh/sessions`,不读取 `DSH_HOME`。
## 方案
按照 [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir/latest/) 使用的类型,对 `$DSH_HOME` 下的路径分组。每个类别都位于 `$DSH_HOME` 内;harness 不读取 `XDG_*` 变量。
| 类别 | 存放内容 | 丢失后果 |
|---|---|---|
| `config` | 用户为配置 harness 而编写或编辑的文件 | 丢失用户配置 |
| `data` | 持久记录:用户工作成果、登录信息、已安装的软件 | 丢失用户工作成果、登录信息或已安装的软件 |
| `state` | 跨运行保留但不属于用户工作成果的记录:日志、索引、id、保留的输出 | 历史被重置;harness 仍可正常工作 |
| `cache` | harness 可以重新构建或重新下载的内容 | 仅耗费时间或带宽 |
| `backup` | harness 写入的备份压缩包,例如 home 或 profile 的压缩副本 | 无影响;正常运行时不会读取这些压缩包 |
不设 `runtime` 类别(XDG 中用于 socket 和 pid 文件的类型),因为没有负责方需要在 home 下使用它:锁文件放在其保护的文件旁边,而活动的 socket 留在操作系统临时目录中,因为 Unix socket 路径有长度限制。`backup` 不是 XDG 的类型:它为备份压缩包提供一个目录,用户和清理工具可以随时清空,不影响运行中的 harness,也不影响被备份的记录。
### 路径辅助函数
`@deepseek-ai/dsh-home-paths` 中的 [`dshPath(category, ...segments)`](../../../../packages/util/home-paths/src/index.ts) 返回 `<home>/<category>/<segments>`,不创建目录;`dshPath({ category, dshHome }, ...segments)` 基于显式配置的 home 解析路径。Loader `!!js` 配置表达式在 `dshHomePath` 之外也可以使用同一个函数。home 下的新路径使用 `dshPath`,并把负责方的目录名作为第一个路径段传入,该目录名通常是去掉 `@deepseek-ai/dsh-` 前缀的包名。`dshHomePath` 继续用于现有的顶层条目,`dshCachePath` 等同于 `dshPath('cache', ...)`。
### 约定的顶层条目
用户会直接打开、编辑这些条目并在脚本中引用它们,仓库中的文档也提到它们,因此它们保留当前的顶层位置,不在迁移候选之列:
| `$DSH_HOME` 下的路径 | 负责方 | 类型 |
|---|---|---|
| `.env` | [app-boot](../../../../packages/boot/app-boot/README.zh.md) 环境层 | config |
| `cordis.patch.yml` | [app-boot](../../../../packages/boot/app-boot/README.zh.md) home patch 层 | config |
| `AGENTS.md` | [agent-instructions](../../../../packages/context/agent-instructions/README.zh.md) | config |
| `skills/` | [skill-filesystem](../../../../packages/skill/skill-filesystem/README.zh.md) | config |
| `.credentials.yaml` | [credentials-local](../../../../packages/credentials/credentials-local/README.zh.md) | data |
| `profiles/<name>/` | [app-boot](../../../../packages/boot/app-boot/README.zh.md)、plugin-manager、Desktop(`desktop` profile 及其 `lock`) | data |
| `sessions/` | base 和 sdk-minimal bundle 中的 session-persistence-jsonl 根目录 | data |
| `cache/` | 已经是 `cache` 类别 | cache |
profile 目录内的文件,例如 `node_modules/`、`pnpm-lock.yaml`、`compatibility.json`、`.plugin-manager/`、`.plugin-market/repositories/`、`created-plugins/` 和 `cua-*.lock`,随所属 profile 保留,因为 pnpm 和 profile 工具按相对于 profile 的路径访问它们。旧版 `settings.yaml` 导入器继续读取 home 根目录,因为该文件是导入来源。
### 其他现有条目
这些条目没有面向用户的约定。每一行给出该条目所属的类别;迁移它属于单独的变更,需要数据迁移方案:
| `$DSH_HOME` 下的当前路径 | 类别 | 负责方 | 原因 |
|---|---|---|---|
| `storages/` | `data` | base bundle 中的 storage-json 根目录 | Workspace、schedule 及其他领域记录;其中 `session_projcache` 单元是可重建的缓存,但 storage-json 只有一个根目录 |
| `attachments/v1/` | `data` | [attachment-local](../../../../packages/attachment/attachment-local/README.zh.md) | 用户附件;Session 历史记录了它们的绝对路径 |
| `dsh-runtimes/` | `data` | Desktop 离线运行时([workspace-dependencies](../../../../packages/bundle/web-app/cordis.patch.yml)) | 已安装的软件,可能包含用户添加的内容 |
| `liveshare/` | `data` | [liveshare](../../../../packages/experimental/liveshare/README.zh.md) 的所有者状态和凭据 | 存放管理令牌 |
| `.anonymous-user-id` | `state` | [anonymous-user-id](../../../../packages/identity/anonymous-user-id/README.zh.md) | 丢失后只会生成新的 id |
| `logs/` | `state` | CLI 启动失败报告 | 日志 |
| `llm-deepseek/files-v3.json` | `state` | [llm-deepseek](../../../../packages/llm/llm-deepseek/README.zh.md) 上传索引 | 派生索引 |
| `office-kit/outputs/` | `state` | [office-kit](../../../../packages/document/office-kit/README.zh.md) | 保留的转换输出,超过保留期后删除 |
| `speech-to-text/sensevoice/` | `cache` | voice-input-bundle | 可下载的模型 |
| `cache/attachments/` | `cache` | attachment-local 请求图片 | 已位于 `cache` 中 |
### home 之外
以下位置不在本提案范围内:`~/.agents`(`DSH_AGENTS_HOME`),与其他 agent 工具共享;Electron 的 `userData` 和 `logs`,由 Electron 管理;Python SDK 资源缓存 `~/.cache/deepseek-harness/resources`(`DSH_RESOURCE_CACHE`),在多个 home 之间共享;操作系统临时目录下的 spill 和子进程输出目录;以及开发者或发布脚本的状态,例如 `~/.dsh-desktop-signing`。
## 备选方案
**立即迁移所有条目。** 最初的草案把所有条目(包括约定的条目)都移入类别目录,且不提供回退。这样做会使每个现有 home 在升级后看起来为空,使 Session 中记录的附件绝对路径失效,并重命名用户手动编辑的文件。上述约定条目现在保持不动,其余迁移等待迁移方案。
**读取 `XDG_*` 变量。** 把 home 拆分到 `XDG_CONFIG_HOME`、`XDG_DATA_HOME` 等多个根目录,会让一次安装分散到多个目录,并破坏测试、SDK 和 Desktop 所依赖的单一 `DSH_HOME` 覆盖;[单一 harness home 解析器](../../implemented/architecture/2026-07-24-single-harness-home-resolver.zh.md)已经否决了拆分根目录。本提案只借用分类方式,并且仍在这一个根目录之内。
**增加 `runtime` 类别。** 当前没有负责方需要它;增加它会发布一个未使用的值。
## 验收标准
- `$DSH_HOME` 下的新路径使用 `dshPath` 构造,并落在某一个类别目录中。
- 每次迁移“其他现有条目”中的条目时,都附带一个保留现有用户数据的迁移,以及一份升级指南。
- 约定的顶层条目保留其位置。
## 风险
在迁移落地之前,home 中同时存在类别目录和旧的顶层条目。迁移 `attachments/` 会使 Session 历史中的绝对路径失效,除非迁移保持旧位置可读。手动解析 home 的负责方在被修改之前不会使用该辅助函数。
+8 -12
View File
@@ -65,7 +65,6 @@ jobs:
CHECK_MODE: ${{ vars.MERGE_POLICY_PRE_MERGE }}
BASE_SHA: ${{ needs.master.outputs.base_sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
SINCE: ${{ needs.master.outputs.since }}
run: |
stop() {
if [ "$CHECK_MODE" = block ]; then
@@ -75,21 +74,18 @@ jobs:
echo "::warning title=Pre-Merge Check::$1"
exit 0
}
if [[ ! "$BASE_SHA" =~ ^[0-9a-f]{40}$ || ! "$SINCE" =~ ^[0-9]+$ ]]; then
if [[ ! "$BASE_SHA" =~ ^[0-9a-f]{40}$ ]]; then
stop "the master diff check reported no base commit, so nothing was merged or compiled"
fi
# A shallow fetch starts a background maintenance run that rewrites .git/shallow, and the second shallow fetch
# below then fails with "shallow file has changed since we read it".
fetch() {
git -c maintenance.auto=false -c gc.auto=0 fetch --no-tags --no-write-fetch-head "$@" origin "$HEAD_SHA" "$BASE_SHA"
}
fetch --shallow-since="$SINCE" ||
# The checkout is already shallow, and a shallow fetch starts a background maintenance run that rewrites
# .git/shallow, so the fetch below would fail with "shallow file has changed since we read it".
# The history is bounded by depth, not by date: a date window marks a merge commit shallow when one parent
# predates it, which drops the other parent too and lets the merge base settle on an older commit. Within its
# depth every commit keeps all parents; 150 covers the base-branch commits a 72-hour-old base can be behind.
git -c maintenance.auto=false -c gc.auto=0 fetch --no-tags --no-write-fetch-head --depth=150 --filter=blob:none origin "$HEAD_SHA" "$BASE_SHA" ||
stop "the base commit $BASE_SHA could not be fetched, so nothing was merged or compiled"
# A time window records a merge commit itself as shallow when one of its parents predates the window, which
# drops the other, in-window parent too; a depth bound keeps both parents of every commit it covers.
if ! git merge-base "$HEAD_SHA" "$BASE_SHA" >/dev/null; then
fetch --depth=20 --filter=blob:none ||
stop "the base commit $BASE_SHA could not be fetched, so nothing was merged or compiled"
stop "the pull request shares no commit with $BASE_SHA within 150 commits of history, so nothing was merged or compiled; merge master into it and push, then this check runs again"
fi
git -c user.name=pr-check -c [email protected] merge --no-ff --no-edit -m "Merge $BASE_SHA into $HEAD_SHA" "$BASE_SHA" ||
stop "the pull request cannot merge $BASE_SHA; merge master into it and push, then this check runs again"
+1
View File
@@ -101,6 +101,7 @@ External packages installed for runtime use or embedded in distributed Host or b
| [`execa`](https://github.com/sindresorhus/execa) | MIT |
| [`fast-xml-parser`](https://github.com/NaturalIntelligence/fast-xml-parser) | MIT |
| [`fflate`](https://github.com/101arrowz/fflate) | MIT |
| [`fuzzysort`](https://github.com/farzher/fuzzysort) | MIT |
| [`got`](https://github.com/sindresorhus/got) | MIT |
| [`hosted-git-info`](https://github.com/npm/hosted-git-info) | ISC |
| [`immer`](https://github.com/immerjs/immer) | MIT |
@@ -0,0 +1,75 @@
// Web e2e scenario: a web_fetch transport failure leads its collapsed row with the
// localized failure summary and keeps the recorded code and detail in the expanded
// output. Borrow the headless transport-failure fixture without any model call.
import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { join } from 'node:path'
import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import {
assertFixtureInventory, captureStableAria, compareOrRefreshGolden, fixtureUserPrompts,
launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { expandTurnProcesses, newEnglishPage, saveFailureShot, WEB_FIXTURE_TIME } from './support.ts'
const FIXTURE = fileURLToPath(new URL('../../../snapshots/session/web-fetch-transport-failure/session.v4.jsonl', import.meta.url))
const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/web-fetch-failure-row', import.meta.url))
const UI_EXPECTED = join(SNAPSHOT_DIR, 'ui.expected.md')
const MODE = webSnapshotMode()
const SEED_ID = 'web-fetch-failure-row-web-e2e'
const PROMPT = 'Use the web_fetch tool exactly once to fetch http://public.test:43117/menu.html, then reply with exactly DONE. Do not describe the content.'
const SUMMARY = 'Connection interrupted. Try again later.'
const DETAIL = 'Error: web fetch failed: the connection was interrupted (UND_ERR_SOCKET): other side closed'
describe.skipIf(MODE === 'record')('web e2e: web_fetch transport failure row', () => {
let scaffold: WebScaffold
let browser: Browser
let page: Page
let tripwire: ReturnType<typeof watchConsole>
beforeAll(async () => {
const fixture = await readFile(FIXTURE, 'utf8')
expect(fixtureUserPrompts(fixture)).toEqual([PROMPT])
scaffold = await launchWebScaffold({})
await seedSession(scaffold, fixture, SEED_ID, undefined, { createdAt: WEB_FIXTURE_TIME })
browser = await chromium.launch()
page = await newEnglishPage(browser)
await page.clock.setFixedTime(WEB_FIXTURE_TIME)
tripwire = watchConsole(page)
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
const groupRow = page.locator('[role="treeitem"]').first()
await groupRow.waitFor({ timeout: 15_000 })
await groupRow.click()
const sessionRow = page.locator('[role="treeitem"]').nth(1)
await sessionRow.waitFor({ timeout: 10_000 })
await sessionRow.click()
await expandTurnProcesses(page)
await page.getByText(SUMMARY, { exact: true }).waitFor({ timeout: 15_000 })
}, 120_000)
afterAll(async () => {
await browser?.close()
await scaffold?.close()
})
it('leads with the localized summary and expands to the recorded detail', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-web-fetch-failure-row'))
const summary = page.getByText(SUMMARY, { exact: true })
expect(await page.getByText(DETAIL, { exact: true }).count()).toBe(0)
await summary.click()
await page.getByText(DETAIL, { exact: true }).waitFor()
const snapshot = (await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd))
.split(SEED_ID).join('{{seededId}}')
await compareOrRefreshGolden(UI_EXPECTED, snapshot, MODE)
expect(tripwire.pageErrors).toEqual([])
expect(tripwire.warnings).toEqual([])
}, 60_000)
it('keeps its snapshot inventory closed', async () => {
await assertFixtureInventory(SNAPSHOT_DIR, ['ui.expected.md'])
})
})
+1
View File
@@ -246,6 +246,7 @@
"tests/auto-review-approval.e2e.ts",
"tests/auto-review-denial.e2e.ts",
"tests/bash-abort-row.e2e.ts",
"tests/web-fetch-failure-row.e2e.ts",
"tests/interrupted-turn.e2e.ts",
"tests/skill-tool-row.e2e.ts",
"tests/tool-details.e2e.ts",
+1
View File
@@ -5396,6 +5396,7 @@ Imported as libraries by other packages; a `cordis.yml` cannot load them.
| `@deepseek-ai/dsh-util-crypto` | — | [`packages/util/crypto/src/index.ts`](../packages/util/crypto/src/index.ts) |
| `@deepseek-ai/dsh-util-file-drag` | — | [`packages/util/file-drag/src/index.ts`](../packages/util/file-drag/src/index.ts) |
| `@deepseek-ai/dsh-util-ripgrep` | — | [`packages/util/ripgrep/src/index.ts`](../packages/util/ripgrep/src/index.ts) |
| `@deepseek-ai/dsh-util-text-search` | — | [`packages/util/text-search/src/index.ts`](../packages/util/text-search/src/index.ts) |
| `@deepseek-ai/dsh-util-time` | — | [`packages/util/time/src/index.ts`](../packages/util/time/src/index.ts) |
| `@deepseek-ai/dsh-util-values` | — | [`packages/util/values/src/index.ts`](../packages/util/values/src/index.ts) |
| `@deepseek-ai/dsh-util-workspace-path` | — | [`packages/util/workspace-path/src/index.ts`](../packages/util/workspace-path/src/index.ts) |
+1
View File
@@ -5398,6 +5398,7 @@ export interface Config {
| `@deepseek-ai/dsh-util-crypto` | — | [`packages/util/crypto/src/index.ts`](../packages/util/crypto/src/index.ts) |
| `@deepseek-ai/dsh-util-file-drag` | — | [`packages/util/file-drag/src/index.ts`](../packages/util/file-drag/src/index.ts) |
| `@deepseek-ai/dsh-util-ripgrep` | — | [`packages/util/ripgrep/src/index.ts`](../packages/util/ripgrep/src/index.ts) |
| `@deepseek-ai/dsh-util-text-search` | — | [`packages/util/text-search/src/index.ts`](../packages/util/text-search/src/index.ts) |
| `@deepseek-ai/dsh-util-time` | — | [`packages/util/time/src/index.ts`](../packages/util/time/src/index.ts) |
| `@deepseek-ai/dsh-util-values` | — | [`packages/util/values/src/index.ts`](../packages/util/values/src/index.ts) |
| `@deepseek-ai/dsh-util-workspace-path` | — | [`packages/util/workspace-path/src/index.ts`](../packages/util/workspace-path/src/index.ts) |
+1 -1
View File
@@ -28,7 +28,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:712`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:691`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:698`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:55`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:57`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` |
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - |
| `commands/change` | `emit` | [`packages/interaction/commands/src/types.ts:89`](../packages/interaction/commands/src/types.ts) | [`commands`](../packages/interaction/commands) (`events.dispatch`) | `remotes` |
+1 -1
View File
@@ -30,7 +30,7 @@
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:712`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:691`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:698`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:55`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:57`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` |
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - |
| `commands/change` | `emit` | [`packages/interaction/commands/src/types.ts:89`](../packages/interaction/commands/src/types.ts) | [`commands`](../packages/interaction/commands) (`events.dispatch`) | `remotes` |
+2
View File
@@ -28,6 +28,7 @@ flowchart TD
pkg_util_crypto["util-crypto"]
pkg_util_file_drag["util-file-drag"]
pkg_util_ripgrep["util-ripgrep"]
pkg_util_text_search["util-text-search"]
pkg_util_time["util-time"]
pkg_util_values["util-values"]
pkg_util_workspace_path["util-workspace-path"]
@@ -1589,6 +1590,7 @@ flowchart TD
| [`util-code-language`](../packages/util/code-language) | `util` | — |
| [`util-crypto`](../packages/util/crypto) | `util` | — |
| [`util-file-drag`](../packages/util/file-drag) | `util` | — |
| [`util-text-search`](../packages/util/text-search) | `util` | — |
| [`util-time`](../packages/util/time) | `util` | — |
| [`util-values`](../packages/util/values) | `util` | — |
| [`util-workspace-path`](../packages/util/workspace-path) | `util` | — |
+2
View File
@@ -30,6 +30,7 @@ flowchart TD
pkg_util_crypto["util-crypto"]
pkg_util_file_drag["util-file-drag"]
pkg_util_ripgrep["util-ripgrep"]
pkg_util_text_search["util-text-search"]
pkg_util_time["util-time"]
pkg_util_values["util-values"]
pkg_util_workspace_path["util-workspace-path"]
@@ -1591,6 +1592,7 @@ flowchart TD
| [`util-code-language`](../packages/util/code-language) | `util` | — |
| [`util-crypto`](../packages/util/crypto) | `util` | — |
| [`util-file-drag`](../packages/util/file-drag) | `util` | — |
| [`util-text-search`](../packages/util/text-search) | `util` | — |
| [`util-time`](../packages/util/time) | `util` | — |
| [`util-values`](../packages/util/values) | `util` | — |
| [`util-workspace-path`](../packages/util/workspace-path) | `util` | — |
+4 -2
View File
@@ -185,7 +185,9 @@ Exact-read consumer that prepares immutable cross-session message context.
* Discovery runs at keystroke rate, so titles and subagent labels only ever
* come from projection reads; sessions without either fall back to their id.
* @param agent - target agent; self is excluded and its cwd drives ranking.
* @param query - optional case-insensitive session-id/cwd/title/display-title substring.
* @param query - optional search text: label and display title match
* fuzzily, session id and working directory as substrings. Matches keep the
* working-directory affinity order; relevance breaks ties within it.
* @param limit - optional positive result cap.
* @param signal - optional cancellation boundary for host autocomplete teardown.
* @returns candidates with canonical mention labels and presentation titles.
@@ -197,7 +199,7 @@ async listCandidates( agent: Agent, query: string = '', limit: number = this.con
* applies, and every candidate carries the canonical mention a host inserts
* into the prompt draft.
* @param agent - target agent; self is excluded and its cwd drives ranking.
* @param query - optional case-insensitive session-id/cwd/title substring.
* @param query - optional search text, matched as {@link listCandidates} matches it.
* @param signal - caller cancellation.
* @returns mention-carrying candidates in rank order.
*/
+4 -2
View File
@@ -185,7 +185,9 @@ Exact-read consumer that prepares immutable cross-session message context.
* Discovery runs at keystroke rate, so titles and subagent labels only ever
* come from projection reads; sessions without either fall back to their id.
* @param agent - target agent; self is excluded and its cwd drives ranking.
* @param query - optional case-insensitive session-id/cwd/title/display-title substring.
* @param query - optional search text: label and display title match
* fuzzily, session id and working directory as substrings. Matches keep the
* working-directory affinity order; relevance breaks ties within it.
* @param limit - optional positive result cap.
* @param signal - optional cancellation boundary for host autocomplete teardown.
* @returns candidates with canonical mention labels and presentation titles.
@@ -197,7 +199,7 @@ async listCandidates( agent: Agent, query: string = '', limit: number = this.con
* applies, and every candidate carries the canonical mention a host inserts
* into the prompt draft.
* @param agent - target agent; self is excluded and its cwd drives ranking.
* @param query - optional case-insensitive session-id/cwd/title substring.
* @param query - optional search text, matched as {@link listCandidates} matches it.
* @param signal - caller cancellation.
* @returns mention-carrying candidates in rank order.
*/
+2 -2
View File
@@ -21,8 +21,8 @@
en: 6851874be5841d90
zh: dc085bf3b82d77df
/web-access/errors:
en: b07c04f462b4a0d9
zh: de5f09cd2fb0324c
en: cda399e195258b07
zh: c544c11fa7f7d217
/web-access/the-service:
en: c9e7dc85c08e64e1
zh: 277c52aac58f42dc
+1 -1
View File
@@ -137,7 +137,7 @@ The HTTP provider does not restrict destination addresses: `web_fetch` reaches l
## Errors
`WebError extends HarnessError` ([core.md](core.md) error taxonomy) with a `code: string` (open, like every other seam's error — `LlmError`, `SubagentError`), not a closed union: a provider may raise its own codes without editing `dsh-web`, and consumers must tolerate an unknown code. The codes split by owner. Seam-neutral codes are raised by the shared `WebRuntime` contract: `WEB_PROVIDER_UNAVAILABLE`, `WEB_PROVIDER_CONFIGURED_MISSING`, `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`, `WEB_PROVIDER_AMBIGUOUS`, `WEB_DUPLICATE_PROVIDER` (a registration-time programming error, the analogue of `LlmRuntime`'s `DUPLICATE_ADAPTER`), `WEB_ABORTED`, and `WEB_PROVIDER_ERROR` (the catch-all for a provider's own failure surfaced through the seam, including network/transport failure — DNS, connection refused, TLS). Fetch-transport codes are owned by the `dsh-web-fetch-http` implementation and a different fetch backend need not raise them: `WEB_INVALID_URL`, `WEB_BLOCKED_URL`, `WEB_REDIRECT_BLOCKED`, `WEB_FETCH_TOO_LARGE`, `WEB_FETCH_TIMEOUT`, `WEB_UNSUPPORTED_CONTENT_TYPE`.
`WebError extends HarnessError` ([core.md](core.md) error taxonomy) with a `code: string` (open, like every other seam's error — `LlmError`, `SubagentError`), not a closed union: a provider may raise its own codes without editing `dsh-web`, and consumers must tolerate an unknown code. The codes split by owner. Seam-neutral codes are raised by the shared `WebRuntime` contract: `WEB_PROVIDER_UNAVAILABLE`, `WEB_PROVIDER_CONFIGURED_MISSING`, `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`, `WEB_PROVIDER_AMBIGUOUS`, `WEB_DUPLICATE_PROVIDER` (a registration-time programming error, the analogue of `LlmRuntime`'s `DUPLICATE_ADAPTER`), `WEB_ABORTED`, and `WEB_PROVIDER_ERROR` (the catch-all for a provider's own failure surfaced through the seam). Fetch-transport codes are owned by the `dsh-web-fetch-http` implementation and a different fetch backend need not raise them: `WEB_INVALID_URL`, `WEB_BLOCKED_URL`, `WEB_REDIRECT_BLOCKED`, `WEB_FETCH_TOO_LARGE`, `WEB_FETCH_TIMEOUT`, `WEB_UNSUPPORTED_CONTENT_TYPE`, and the network failure classes `WEB_FETCH_DNS_FAILED`, `WEB_FETCH_CONNECTION_REFUSED`, `WEB_FETCH_CONNECTION_TIMEOUT`, `WEB_FETCH_CERTIFICATE_INVALID`, `WEB_FETCH_CONNECTION_INTERRUPTED`, `WEB_FETCH_NETWORK_UNREACHABLE`, and `WEB_FETCH_NETWORK_ERROR`. The Web `web_fetch` row shows a localized summary for a network failure class and keeps the recorded message in its output.
## The service
+1 -1
View File
@@ -137,7 +137,7 @@ HTTP 提供方不限制目的地址:`web_fetch` 会像访问其他主机一样
## 错误
`WebError extends HarnessError`([core.md](core.zh.md) 错误分类体系),带有 `code: string`(开放式,与其他 seam 的错误一致——`LlmError`、`SubagentError`),而非封闭联合类型:提供方可以在不修改 `dsh-web` 的情况下抛出自己的错误代码,消费方必须容忍未知错误代码。错误代码按所有者划分。共享的 `WebRuntime` 约定会抛出与 seam 无关的错误代码:`WEB_PROVIDER_UNAVAILABLE`、`WEB_PROVIDER_CONFIGURED_MISSING`、`WEB_PROVIDER_CONFIGURED_UNAVAILABLE`、`WEB_PROVIDER_AMBIGUOUS`、`WEB_DUPLICATE_PROVIDER`(注册时的编程错误,类似 `LlmRuntime` 的 `DUPLICATE_ADAPTER`)、`WEB_ABORTED`,以及 `WEB_PROVIDER_ERROR`(提供方自身故障经 seam 暴露时使用的兜底代码,包括 DNS、连接被拒绝、TLS 等网络或传输故障)。抓取传输层错误代码由 `dsh-web-fetch-http` 实现拥有,不同的抓取后端无需抛出它们:`WEB_INVALID_URL`、`WEB_BLOCKED_URL`、`WEB_REDIRECT_BLOCKED`、`WEB_FETCH_TOO_LARGE`、`WEB_FETCH_TIMEOUT`、`WEB_UNSUPPORTED_CONTENT_TYPE`。
`WebError extends HarnessError`([core.md](core.zh.md) 错误分类体系),带有 `code: string`(开放式,与其他 seam 的错误一致——`LlmError`、`SubagentError`),而非封闭联合类型:提供方可以在不修改 `dsh-web` 的情况下抛出自己的错误代码,消费方必须容忍未知错误代码。错误代码按所有者划分。共享的 `WebRuntime` 约定会抛出与 seam 无关的错误代码:`WEB_PROVIDER_UNAVAILABLE`、`WEB_PROVIDER_CONFIGURED_MISSING`、`WEB_PROVIDER_CONFIGURED_UNAVAILABLE`、`WEB_PROVIDER_AMBIGUOUS`、`WEB_DUPLICATE_PROVIDER`(注册时的编程错误,类似 `LlmRuntime` 的 `DUPLICATE_ADAPTER`)、`WEB_ABORTED`,以及 `WEB_PROVIDER_ERROR`(提供方自身故障经 seam 暴露时使用的兜底代码)。抓取传输层错误代码由 `dsh-web-fetch-http` 实现拥有,不同的抓取后端无需抛出它们:`WEB_INVALID_URL`、`WEB_BLOCKED_URL`、`WEB_REDIRECT_BLOCKED`、`WEB_FETCH_TOO_LARGE`、`WEB_FETCH_TIMEOUT`、`WEB_UNSUPPORTED_CONTENT_TYPE`,以及网络故障类别 `WEB_FETCH_DNS_FAILED`、`WEB_FETCH_CONNECTION_REFUSED`、`WEB_FETCH_CONNECTION_TIMEOUT`、`WEB_FETCH_CERTIFICATE_INVALID`、`WEB_FETCH_CONNECTION_INTERRUPTED`、`WEB_FETCH_NETWORK_UNREACHABLE` 和 `WEB_FETCH_NETWORK_ERROR`。Web 中的 `web_fetch` 行会为网络故障类别显示本地化摘要,并在输出中保留记录的消息。
## 服务
@@ -0,0 +1,16 @@
# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.1/web-fetch-transport-error-codes/guide.md
/:
en: 35ed3b25ea3d40d7
zh: 2b037f8b2ef608e7
/local-http-fetch-transport-failures-use-classified-codes:
en: 3897971fd31f36fe
zh: a8ef921a842e618e
/local-http-fetch-transport-failures-use-classified-codes/change:
en: ad6f5c7df983668c
zh: 43a1abab550cd7c4
/local-http-fetch-transport-failures-use-classified-codes/migration:
en: ac5fd3b3b803d45a
zh: bef35af54771b9b7
@@ -0,0 +1,18 @@
---
kind: upgrade-guide
description: "Local HTTP fetch transport failures raise classified WEB_FETCH_* codes instead of WEB_PROVIDER_ERROR."
---
# Local HTTP fetch transport failures use classified codes
English | [中文](guide.zh.md)
## Change
The local HTTP fetch provider (`dsh-web-fetch-http`) previously raised `WEB_PROVIDER_ERROR` with the text `web fetch failed: TypeError: fetch failed` for every network failure before or during the response. It now raises one of `WEB_FETCH_DNS_FAILED`, `WEB_FETCH_CONNECTION_REFUSED`, `WEB_FETCH_CONNECTION_TIMEOUT`, `WEB_FETCH_CERTIFICATE_INVALID`, `WEB_FETCH_CONNECTION_INTERRUPTED`, `WEB_FETCH_NETWORK_UNREACHABLE`, or `WEB_FETCH_NETWORK_ERROR` for an unrecognized failure. The message names the failure class, the system error code, and the underlying error. The same code appears in the `error.code` of new `web_fetch` tool results. Callers of `ctx.web.fetch()` and readers of tool-result error codes that match `WEB_PROVIDER_ERROR` for network failures are affected. Other providers, and other `dsh-web-fetch-http` failures, are unchanged.
## Migration
1. Where code routes local fetch network failures on `WEB_PROVIDER_ERROR`, match the seven codes above instead.
2. Do not parse the message text; it is diagnostic and may change.
3. Confirm by fetching an unresolvable host, such as `http://example.invalid/`, and checking that the error code is `WEB_FETCH_DNS_FAILED`.
@@ -0,0 +1,18 @@
---
kind: upgrade-guide
description: "本地 HTTP 抓取的传输故障改为抛出分类后的 WEB_FETCH_* 代码,而不是 WEB_PROVIDER_ERROR。"
---
# 本地 HTTP 抓取的传输故障使用分类代码
[English](guide.md) | 中文
## 变更
本地 HTTP 抓取提供方(`dsh-web-fetch-http`)以前在响应之前或响应期间遇到任何网络故障时,都会抛出 `WEB_PROVIDER_ERROR`,文本为 `web fetch failed: TypeError: fetch failed`。现在它会抛出 `WEB_FETCH_DNS_FAILED`、`WEB_FETCH_CONNECTION_REFUSED`、`WEB_FETCH_CONNECTION_TIMEOUT`、`WEB_FETCH_CERTIFICATE_INVALID`、`WEB_FETCH_CONNECTION_INTERRUPTED`、`WEB_FETCH_NETWORK_UNREACHABLE` 之一;无法识别的故障则抛出 `WEB_FETCH_NETWORK_ERROR`。错误消息会写明故障类别、系统错误码和底层错误。新的 `web_fetch` 工具结果的 `error.code` 中也会出现相同的代码。受影响的是 `ctx.web.fetch()` 的调用方,以及对网络故障匹配 `WEB_PROVIDER_ERROR` 的工具结果错误码读取方。其他提供方,以及 `dsh-web-fetch-http` 的其他故障,均不受影响。
## 迁移
1. 如果代码按 `WEB_PROVIDER_ERROR` 路由本地抓取的网络故障,改为匹配上述七个代码。
2. 不要解析错误消息文本;它仅用于诊断,可能会变化。
3. 抓取一个无法解析的主机(例如 `http://example.invalid/`),确认错误码为 `WEB_FETCH_DNS_FAILED`。
@@ -0,0 +1,16 @@
# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.2/shared-search-filter/guide.md
/:
en: e844e06044ae4528
zh: 0685de150de3ee75
/shared-search-filter-replaces-rankbyname-and-searchmode:
en: 056d8f43542817b6
zh: 57993ea06eab6dd4
/shared-search-filter-replaces-rankbyname-and-searchmode/change:
en: 10f142aa7be3f9d4
zh: bdcc63c40f895564
/shared-search-filter-replaces-rankbyname-and-searchmode/migration:
en: e574d0daa01c7cfb
zh: aaaab2d24ab55cf9
@@ -0,0 +1,18 @@
---
kind: upgrade-guide
description: "ui-primitives no longer exports rankByName, and popupSelect commands no longer accept searchMode."
---
# Shared search filter replaces rankByName and searchMode
English | [中文](guide.zh.md)
## Change
`@deepseek-ai/dsh-client-ui-primitives` exported `rankByName(items, query)`, which ranked items by an ordered subsequence of `name` or `label`. It is removed. `@deepseek-ai/dsh-client-ui-commands` accepted `searchMode: 'substring' | 'fuzzy-label'` on a `popupSelect` command spec and exported the `PopupSearchMode` type; both are removed. Every popup now filters its options one way: labels match fuzzily and details match as substrings, ranked within each group. The shared search is [`TextSearchIndex`](../../../../packages/util/text-search/README.md) in `@deepseek-ai/dsh-util-text-search`. Plugin authors who import `rankByName`, or who set `searchMode` or import `PopupSearchMode`, are affected.
## Migration
1. Replace `rankByName(items, query)` with a `TextSearchIndex` imported from `@deepseek-ai/dsh-util-text-search`: build `new TextSearchIndex(items, item => ({ fuzzy: [item.name, item.label] }))` when the list changes, and call `index.search(query)` per query. Add that package to the plugin's `devDependencies` for a Client plugin or `dependencies` for a Host plugin. Put descriptions or other long text in `substring`, and pass every language of a `LocalizedText` through `localizedValues`.
2. Delete `searchMode` from each `popupSelect` spec and remove any `PopupSearchMode` import.
3. Confirm the plugin typechecks, and that typing part of an option label in its popup still finds that option.
@@ -0,0 +1,18 @@
---
kind: upgrade-guide
description: "ui-primitives 不再导出 rankByName,popupSelect 命令不再接受 searchMode。"
---
# 共享搜索过滤器取代 rankByName 和 searchMode
[English](guide.md) | 中文
## 变更
`@deepseek-ai/dsh-client-ui-primitives` 曾导出 `rankByName(items, query)`,它按 `name` 或 `label` 的有序子序列对条目排序。该函数已移除。`@deepseek-ai/dsh-client-ui-commands` 曾在 `popupSelect` 命令规格上接受 `searchMode: 'substring' | 'fuzzy-label'`,并导出 `PopupSearchMode` 类型;两者均已移除。现在每个弹窗都用同一种方式过滤选项:标签模糊匹配,详情按子串匹配,选项在各自分组内排序。共享搜索是 `@deepseek-ai/dsh-util-text-search` 中的 [`TextSearchIndex`](../../../../packages/util/text-search/README.zh.md)。受影响的是导入 `rankByName`、设置 `searchMode` 或导入 `PopupSearchMode` 的插件作者。
## 迁移
1. 把 `rankByName(items, query)` 替换为从 `@deepseek-ai/dsh-util-text-search` 导入的 `TextSearchIndex`:列表变化时构建 `new TextSearchIndex(items, item => ({ fuzzy: [item.name, item.label] }))`,每次查询时调用 `index.search(query)`。把该包加入插件的依赖:Client 插件加入 `devDependencies`,Host 插件加入 `dependencies`。把描述或其他长文本放进 `substring`,并通过 `localizedValues` 传入 `LocalizedText` 的所有语言。
2. 从每个 `popupSelect` 规格中删除 `searchMode`,并移除所有 `PopupSearchMode` 导入。
3. 确认插件通过类型检查,并确认在其弹窗中键入选项标签的一部分仍能找到该选项。
+1
View File
@@ -15,6 +15,7 @@ These package-specific rules supplement the repo-wide [conventions](../AGENTS.md
- **Write model-facing contracts from the model's perspective.** Prompts, tool schemas, results, and diagnostics contain only task-relevant concepts, not UI, transport, or implementation vocabulary. Pin stable model-visible text verbatim and dynamic behavior through snapshots or end-to-end coverage.
- **Enforce a decision in the operation that makes it.** Schema omission, prompt filtering, facades, wrappers, and listener order are not enforcement when direct or alternate callers can bypass them; test denial through the executor.
- **Publish state only at its commit point.** Emit each notification and update derived state only after the operation succeeds; derive caches, prompts, UI echoes, replay, and query views from one authoritative source.
- **User search follows the [Client search rule](client/AGENTS.md#search-and-filter),** including a Host search that supplies a Client list.
- **Apply bounds to the complete result.** Enforce byte, token, item, and time limits where the complete emitted or retained value, including wrappers and metadata, is known; test tiny and exact limits, oversized single chunks, and multibyte byte limits.
- **Registry contributions prove disposal** through the HMR-safety test required by [testing policy](../docs/testing.md): dispose the fiber and observe removal.
- **Specs run concurrently** in forked workers beside other gate processes. Own each acquired port, path, and child process through teardown; a spec that passes only when run alone is a defect in the spec ([execution model](../docs/testing.md#how-specs-execute)).
+4 -1
View File
@@ -17,7 +17,7 @@ import { Context, type Fiber, type FiberState } from '@deepseek-ai/cordis'
import Loader, { type Entry, type EntryGroup, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
import Include, { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
import Group from '@deepseek-ai/cordis-plugin-group'
import { dshHomePath, resolveDshHome } from '@deepseek-ai/dsh-home-paths'
import { dshHomePath, dshPath, resolveDshHome } from '@deepseek-ai/dsh-home-paths'
import { createLaunchEnvironmentSnapshot, type LaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
export { readBundlePatches, readProfilePatches, resolveTelemetryPatch, type ProfileContext, type ProfilePnpmInvocation } from './profile-context.ts'
export { sanitizeProfile } from './profile-sanitize.ts'
@@ -44,6 +44,8 @@ declare module '@deepseek-ai/cordis' {
interface Context {
/** Harness-home path resolver available to Loader `!!js` config expressions. */
dshHomePath?: typeof dshHomePath
/** Harness-home category path resolver available to Loader `!!js` config expressions. */
dshPath?: typeof dshPath
}
interface Events {
@@ -1241,6 +1243,7 @@ export async function boot(
try {
ctx.baseUrl = pathToFileURL(dirname(absoluteConfigPath)).href + '/'
ctx.provide('dshHomePath', dshHomePath)
ctx.provide('dshPath', dshPath)
await ctx.plugin(Loader)
await prepare?.(ctx)
stage = 'plugin tree failed to load'
@@ -1068,7 +1068,7 @@ describe('boot', () => {
}
})
it('exposes dshHomePath to Loader config expressions', async () => {
it('exposes dshHomePath and dshPath to Loader config expressions', async () => {
const dir = tmp()
const dshHome = join(dir, 'home')
vi.stubEnv('DSH_HOME', dshHome)
@@ -1076,6 +1076,7 @@ describe('boot', () => {
'export const name = "capture"',
'export function apply(ctx, config) {',
' ctx.provide("capturedPath", config.path)',
' ctx.provide("capturedStatePath", config.state)',
'}',
'',
].join('\n'))
@@ -1084,12 +1085,14 @@ describe('boot', () => {
' name: ./capture.mjs',
' config:',
" path: !!js dshHomePath('sessions')",
" state: !!js dshPath('state', 'capture')",
'',
].join('\n'))
let ctx: Context | undefined
try {
ctx = await boot(NAME, join(dir, 'cordis.yml'))
expect(ctx.get('capturedPath')).toBe(join(dshHome, 'sessions'))
expect(ctx.get('capturedStatePath')).toBe(join(dshHome, 'state', 'capture'))
} finally {
await ctx?.fiber.dispose()
vi.unstubAllEnvs()
+12
View File
@@ -123,6 +123,18 @@ Menus use `Menu` or `MenuSurface`, including custom listboxes, except the explic
Every product-visible string—including text, accessibility names, tooltips, placeholders, status/unit formatters, and primitive chrome—lives in a typed locale dictionary and reaches components through the standard `t` seat or an already-localized prop. Cordis-free primitives require complete label props and own no fallback copy. Keep user/model/wire data and code tokens verbatim; internal matching uses discriminants or stable ids, never localized text. `pnpm run verify-client-ui-i18n` enforces source ownership ([decision](../../.agents/notes/implemented/architecture/2026-08-23-locale-owned-client-ui-copy.md)).
## Search and filter
User search queries over a list follow one rule, so a query finds the same item in every list. Unlike internal matching above, user query matching reads localized text:
- Rows display the current locale; matching covers every language the value carries. A `LocalizedText` carries all of its languages; text resolved through `t()` carries only the active one.
- Matching covers the text a row shows or the user can copy: names, titles, labels, descriptions, and ids. A menu whose default highlight spans several sources, such as the `/` menu, matches names and labels only, so a description hit in one group cannot take Enter from the name another group matched.
- Names, titles, labels, and readable ids match as substrings or as fuzzy subsequences that start at a word start, so `cpt` finds `compact`. Descriptions, prompts, paths, and opaque ids such as UUIDs match only as contiguous substrings. Matching ignores case, width, and diacritics, and every space-separated term must match.
- Results rank name prefix, then name substring, then fuzzy name, then text substring; equal matches keep the list's own order.
- Facet selections, such as status, category, or label filters, stay exact.
The rule covers lists filtered in memory, including a Host search that supplies a Client list, such as `@` Session candidates; [`TextSearchIndex`](../util/text-search/README.md) implements it for both. Searches backed by their own index keep their matcher: Session content search runs literal SQLite full-text terms over Session text, and the plugin market ranks its paged index on the Host. The sidebar's title, Workspace, and id matching follows this rule; only its content results use the full-text matcher.
## Testing and coverage
The GUI test structure (three tiers, lane map) is settled in the [GUI testing system reference](../../docs/testing.md); repo-wide policy in [docs/testing.md](../../docs/testing.md).
+1 -1
View File
@@ -97,7 +97,7 @@ function compiledClientStyle(
* Everything else under @deepseek-ai/* is either a module-table entry
* (external) or a leak the purity gate rejects.
*/
export const INLINE_SAFE = /^(?:@deepseek-ai\/dsh-(?:file-reference|fs-patch|session|llm|tools|brand|error|official-bundles|deque|output-retention|typert-protocol|util-crypto|util-time|util-values|util-workspace-path)(?:\/|$)|@deepseek-ai\/dsh-util-file-drag$|@deepseek-ai\/dsh-token-meter\/client$|@deepseek-ai\/dsh-commands\/builtin$|@deepseek-ai\/dsh-native-command\/types$|@deepseek-ai\/dsh-host-open-in-app\/shared$|@deepseek-ai\/dsh-plugin-manager\/registry$|@deepseek-ai\/dsh-agent-preset-registry\/display$|@deepseek-ai\/dsh-api-workspace-controller\/default-workspace$|@deepseek-ai\/dsh-spill-policy\/notice$)/
export const INLINE_SAFE = /^(?:@deepseek-ai\/dsh-(?:file-reference|fs-patch|session|llm|tools|brand|error|official-bundles|deque|output-retention|typert-protocol|util-crypto|util-text-search|util-time|util-values|util-workspace-path)(?:\/|$)|@deepseek-ai\/dsh-util-file-drag$|@deepseek-ai\/dsh-token-meter\/client$|@deepseek-ai\/dsh-commands\/builtin$|@deepseek-ai\/dsh-native-command\/types$|@deepseek-ai\/dsh-host-open-in-app\/shared$|@deepseek-ai\/dsh-plugin-manager\/registry$|@deepseek-ai\/dsh-agent-preset-registry\/display$|@deepseek-ai\/dsh-api-workspace-controller\/default-workspace$|@deepseek-ai\/dsh-spill-policy\/notice$)/
/**
* Vendored framework libraries: rescoped into @deepseek-ai, so the gate below
@@ -227,11 +227,32 @@ describe('MessageItem arms', () => {
expect(exec).toHaveBeenCalledWith('copy')
})
it('user copy succeeds through execCommand when the host refuses the async write', async () => {
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText: vi.fn().mockRejectedValue(new Error('denied')) },
})
const exec = vi.fn().mockReturnValue(true)
Object.defineProperty(document, 'execCommand', { configurable: true, value: exec })
render(
<MessageItem t={t} node={{
kind: 'user', seq: 1, time: 1_000,
content: [{ type: 'text', text: 'refused body' }] as never,
source: null,
}}
/>,
)
fireEvent.click(screen.getByRole('button', { name: '复制' }))
expect(await screen.findByRole('button', { name: '复制成功' })).toBeTruthy()
expect(exec).toHaveBeenCalledWith('copy')
})
it('user copy never claims success when the host rejects the write', async () => {
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText: vi.fn().mockRejectedValue(new Error('denied')) },
})
Object.defineProperty(document, 'execCommand', { configurable: true, value: vi.fn(() => false) })
render(
<MessageItem t={t} node={{
kind: 'user', seq: 1, time: 1_000,
+2 -2
View File
@@ -18,8 +18,8 @@
en: c325c9eaca4efe47
zh: dbbc29cc9cec54bc
/deepseek-ai-dsh-client-ui-commands/use-this-package/kinds-and-decorations:
en: 57679a20574d8b3f
zh: 98d5e5a7781e6de1
en: af1cf6b11bd61331
zh: 9ad85e6dbca1d4ec
/deepseek-ai-dsh-client-ui-commands/use-this-package/built-in-row-faces:
en: e96156be95ea87e3
zh: f5350db26483ec9f
+1 -1
View File
@@ -35,7 +35,7 @@ A popupSelect spec may supply `searchLabels()` to resolve its placeholder, empty
Options may carry `group: { name, label }`: `name` identifies the group and `label` supplies its localized sticky heading. Equal names share one group; groups retain first-occurrence order in the loaded options, including when a query hides earlier rows. Ungrouped options form one headingless block at their first occurrence. Groups without matching rows are hidden.
The optional `searchMode` defaults to `'substring'`, matching `label` and `detail` case-insensitively without ranking. `'fuzzy-label'` matches only labels as ordered, case-insensitive subsequences and ranks within each group: prefixes first, then alignment score, then original row order. Both modes ignore leading and trailing query spaces; a blank query keeps every row in group order. Rendering, keyboard navigation, and selection use the same filtered order. `/model` opts into `'fuzzy-label'`; other commands retain substring matching unless they opt in.
Popup search uses the shared [text search](../../util/text-search/README.md): labels match fuzzily, details match as substrings, and rows rank by match within each group. A blank query keeps every row in group order. Rendering, keyboard navigation, and selection use the same filtered order.
### Built-in row faces
+1 -1
View File
@@ -35,7 +35,7 @@ popupSelect 规格可提供 `searchLabels()`,在每次打开时解析占位文
选项可携带 `group: { name, label }`:`name` 标识分组,`label` 提供本地化吸顶标题。同名选项归入同一组;分组保持在已加载选项中首次出现的顺序,即使查询隐藏了较早的行也不变。未分组选项在首次出现的位置组成一个无标题区块。没有匹配行的分组会隐藏。
可选的 `searchMode` 默认为 `'substring'`,不区分大小写地匹配 `label` 与 `detail` 的子串,不进行相关性排序。`'fuzzy-label'` 仅匹配标签中按顺序、不区分大小写的子序列,并在组内排序:前缀优先,其次按匹配得分,最后按原始行顺序。两种模式均忽略查询首尾空格;空查询按分组顺序保留所有行。渲染、键盘导航与选择使用相同的筛选顺序。`/model` 启用 `'fuzzy-label'`;其他命令未显式启用时仍使用子串匹配。
弹窗搜索使用共享的[文本搜索](../../util/text-search/README.zh.md):标签模糊匹配,详情按子串匹配,各行在组内按匹配程度排序。空查询按分组顺序保留所有行。渲染、键盘导航与选择使用相同的筛选顺序。
### 内置行的展示面
+2 -1
View File
@@ -64,7 +64,8 @@
"@deepseek-ai/dsh-util-values": "workspace:*",
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
"clsx": "^2.0.0"
"clsx": "^2.0.0",
"@deepseek-ai/dsh-util-text-search": "workspace:*"
},
"files": [
"locale/*.json",
@@ -48,8 +48,8 @@ export function PopupSelectView({ popup, t }: PopupSelectViewProps) {
const cardRef = useRef<HTMLDivElement>(null)
const searchRef = useRef<HTMLInputElement>(null)
const viewportRef = useRef<HTMLDivElement>(null)
const rows = useMemo(() => filterOptions(state.options, state.search, state.searchMode),
[state.options, state.search, state.searchMode])
const rows = useMemo(() => filterOptions(state.options, state.search),
[state.options, state.search])
const groups = useMemo(() => groupOptions(rows), [rows])
useEffect(() => {
const viewport = viewportRef.current
@@ -23,9 +23,6 @@ export interface SelectOptionGroup {
readonly label: string
}
/** Search behavior selected by the popup owner. */
export type PopupSearchMode = 'substring' | 'fuzzy-label'
/** One option row of a popupSelect shell. */
export interface SelectOption {
readonly id: string
@@ -63,8 +60,6 @@ export interface PopupSearchLabels {
*/
export interface PopupSelectSpec {
readonly kind: 'popupSelect'
/** Defaults to substring search; fuzzy-label ranks names within each group. */
readonly searchMode?: PopupSearchMode
/**
* Supply localized search copy for this opening; omitted uses the shell's generic copy.
* @returns search placeholder and empty-state labels.
@@ -28,7 +28,7 @@ export type { PopupSelectDeps, PopupSpec, PopupState, TokenSegment } from './pop
export type { PopupSelectInjected, PopupSelectViewProps } from './PopupSelectView.tsx'
export type {
ActionSpec, CommandContribution, CommandDecoration, CommandUiContract, CommandUiSpec, PopupSearchLabels, PopupSelectSpec,
SelectConfirmation, SelectOption, SelectOptionGroup, PopupSearchMode,
SelectConfirmation, SelectOption, SelectOptionGroup,
} from './contract.ts'
export type { CommandKey } from './locales.ts'
+16 -30
View File
@@ -12,8 +12,8 @@
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
import type { TokenSpan } from '@deepseek-ai/dsh-client-ui-input-trigger/client'
import type { PopupSearchLabels, PopupSearchMode, PopupSelectSpec, SelectOption } from './contract.ts'
import { rankByName } from '@deepseek-ai/dsh-client-ui-primitives'
import { TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import type { PopupSearchLabels, PopupSelectSpec, SelectOption } from './contract.ts'
import { groupOptions } from './option-groups.ts'
/**
@@ -33,7 +33,7 @@ export type TokenSegment =
* session wiring passes its session projection; the controller only carries
* it from open() to the callbacks).
*/
export interface PopupSpec<TCtx> extends Pick<PopupSelectSpec, 'searchLabels' | 'searchMode'> {
export interface PopupSpec<TCtx> extends Pick<PopupSelectSpec, 'searchLabels'> {
/** Load the option rows once per open (retry after failure reuses the same signal). */
options(context: TCtx, signal: AbortSignal): Promise<readonly SelectOption[]>
/** Settle the picked option against the open-time context. */
@@ -67,8 +67,6 @@ export interface PopupState {
readonly search: string
/** Command-owned copy for this opening; null uses generic shell labels. */
readonly searchLabels: PopupSearchLabels | null
/** Search policy resolved from the command spec at opening. */
readonly searchMode: PopupSearchMode
/**
* Highlight index into the filtered row list: 0 until options land; afterwards
* the row the loaded list marks as the current value
@@ -87,31 +85,20 @@ export interface PopupState {
}
const CLOSED: PopupState = {
open: false, command: null, status: 'pending', options: [], search: '', searchLabels: null, searchMode: 'substring', active: 0,
open: false, command: null, status: 'pending', options: [], search: '', searchLabels: null, active: 0,
submitting: false, confirming: null, acknowledged: false, error: null,
}
/**
* Filter rows using substring matching, or rank labels fuzzily within each group.
* Blank search keeps every row; fuzzy matching preserves group order.
* Filter and rank rows within each group: labels match fuzzily, details as substrings.
* Blank search keeps every row; groups keep their order.
* @param options - the loaded rows.
* @param search - the shell's search text.
* @param mode - the command's policy; defaults to substring over label and detail.
* @returns the original option objects in the order shown and used for selection.
*/
export function filterOptions(
options: readonly SelectOption[], search: string, mode: PopupSearchMode = 'substring',
): readonly SelectOption[] {
const query = search.trim().toLowerCase()
const groups = groupOptions(options)
const ordered = groups.some(group => group.group !== undefined) ? groups.flatMap(group => group.rows) : options
if (query === '') return ordered
if (mode === 'fuzzy-label') {
return groups.flatMap(group => rankByName(
group.rows.map(option => ({ name: option.label, option })), query,
).map(row => row.option))
}
return ordered.filter(o => o.label.toLowerCase().includes(query) || (o.detail?.toLowerCase().includes(query) ?? false))
export function filterOptions(options: readonly SelectOption[], search: string): readonly SelectOption[] {
return groupOptions(options).flatMap(group =>
new TextSearchIndex(group.rows, option => ({ fuzzy: [option.label], substring: [option.detail] })).search(search))
}
/**
@@ -121,11 +108,10 @@ export function filterOptions(
* made without looking confirms that value instead of the topmost row.
* @param options - the loaded rows.
* @param search - the shell's live filter text (non-empty after a retry).
* @param mode - the command's search policy.
* @returns index into the filtered rows.
*/
function currentIndex(options: readonly SelectOption[], search: string, mode: PopupSearchMode): number {
const at = filterOptions(options, search, mode).findIndex(option => option.active === true)
function currentIndex(options: readonly SelectOption[], search: string): number {
const at = filterOptions(options, search).findIndex(option => option.active === true)
return at === -1 ? 0 : at
}
@@ -173,7 +159,7 @@ export class PopupSelectController<TCtx = unknown> {
this.binding?.abort.abort()
const binding: OpenBinding<TCtx> = { command, spec, context, segment, abort: new AbortController() }
this.binding = binding
this.state.set({ ...CLOSED, open: true, command, searchLabels, searchMode: spec.searchMode ?? 'substring' })
this.state.set({ ...CLOSED, open: true, command, searchLabels })
this.load(binding)
}
@@ -183,7 +169,7 @@ export class PopupSelectController<TCtx = unknown> {
(options) => {
if (this.binding !== binding) return
const current = this.state.getSnapshot()
this.state.set({ ...current, status: 'ready', options, active: currentIndex(options, current.search, current.searchMode), error: null })
this.state.set({ ...current, status: 'ready', options, active: currentIndex(options, current.search), error: null })
},
(error: unknown) => {
if (this.binding !== binding) return
@@ -222,7 +208,7 @@ export class PopupSelectController<TCtx = unknown> {
move(dir: 1 | -1): void {
const s = this.state.getSnapshot()
if (!s.open || s.status !== 'ready' || s.submitting || s.confirming !== null) return
const rows = filterOptions(s.options, s.search, s.searchMode)
const rows = filterOptions(s.options, s.search)
if (rows.length === 0) return
const active = (s.active + dir + rows.length) % rows.length
this.state.set({ ...s, active })
@@ -236,7 +222,7 @@ export class PopupSelectController<TCtx = unknown> {
highlight(index: number): void {
const s = this.state.getSnapshot()
if (!s.open || s.status !== 'ready' || s.submitting || s.confirming !== null) return
if (index < 0 || index >= filterOptions(s.options, s.search, s.searchMode).length || index === s.active) return
if (index < 0 || index >= filterOptions(s.options, s.search).length || index === s.active) return
this.state.set({ ...s, active: index })
}
@@ -254,7 +240,7 @@ export class PopupSelectController<TCtx = unknown> {
const binding = this.binding
const s = this.state.getSnapshot()
if (binding === null || !s.open || s.status !== 'ready' || s.submitting || s.confirming !== null) return
const option = filterOptions(s.options, s.search, s.searchMode)[index]
const option = filterOptions(s.options, s.search)[index]
if (option === undefined) return
if (option.confirmation !== undefined) {
this.state.set({ ...s, confirming: option, acknowledged: false, error: null })
@@ -5,8 +5,10 @@
* catalog with contributions by availability, gives built-in Host rows their
* localized face (presentation.ts), then position-filters; an empty query
* lists the Add and Commands sections in usage order, a typed query ranks
* every row by the `/` menu's shared name-and-label ranking (ui-primitives
* `rankByName`). A host/contribution name collision fails loud. Every
* every row through the shared search filter (`dsh-util-text-search`) over
* name and label. Descriptions stay unmatched: this source shares one menu and
* its default highlight with other sources, so a description-only hit would
* take Enter from a name another group matched. A host/contribution name collision fails loud. Every
* execute addresses the session's agent by sessionId — sessions are always
* agent-backed.
* Catalog RPCs retain an existing Client Session through completion and
@@ -23,7 +25,7 @@ import type { ISessions, SessionBinding } from '@deepseek-ai/dsh-api-session-con
import type { SessionId } from '@deepseek-ai/dsh-session/types'
import { WeakMapWithValues } from '@deepseek-ai/dsh-util-values'
import type { TranslateNS } from '@deepseek-ai/dsh-client-locale/client'
import { rankByName } from '@deepseek-ai/dsh-client-ui-primitives'
import { TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import type {
CandidateRequest, ClientSessionContext, CommandClaim, PickOutcome, InputTriggerCandidate, InputTriggerPick,
SubmitAttachment, SubmitEnvelope, SubmitOutcome,
@@ -219,7 +221,7 @@ export class CommandUiRuntime extends Service implements CommandUiContract {
/**
* Menu candidates: host catalog + contribution availability, built-in rows
* localized, then position filtering; sections for an empty query, the
* shared name-and-label ranking for a typed one.
* shared search filter for a typed one.
*/
private async candidates(session: ClientSessionContext, req: CandidateRequest): Promise<readonly InputTriggerCandidate[]> {
const list = await this.directory.ensureReady(session.sessionId, req.signal)
@@ -246,7 +248,7 @@ export class CommandUiRuntime extends Service implements CommandUiContract {
})
}
const visible = rows.filter(c => req.position === 'leading' || c.hint === undefined)
return req.query === '' ? sectionRows(visible, this.t) : rankByName(visible, req.query)
return req.query === '' ? sectionRows(visible, this.t) : new TextSearchIndex(visible, row => ({ fuzzy: [row.name, row.label] })).search(req.query)
}
/** Decision table, menu column: contribution/decorated-host → popup or action; host input → claim; host bare → detached execute. */
@@ -90,7 +90,7 @@ describe('PopupSelectView', () => {
{ id: 'other', label: 'Unmatched', group: { name: 'other', label: 'Other provider' } },
]
const onSelect = vi.fn()
const { search } = await mountOpen({ searchMode: 'fuzzy-label', options: () => Promise.resolve(options), onSelect })
const { search } = await mountOpen({ options: () => Promise.resolve(options), onSelect })
expect(screen.getAllByRole('group').map(group => group.querySelector('[data-menu-group-heading]')?.textContent))
.toEqual(['Alpha provider', 'Beta provider', 'Other provider'])
expect(rowLabels()).toEqual(['DeepSeek Flash', 'Flash Lite', 'Flash Beta', 'Unmatched'])
@@ -58,14 +58,14 @@ describe('filterOptions', () => {
it('keeps provider order while ranking fuzzy label matches within each group', () => {
expect(filterOptions(grouped, '')).toEqual([grouped[0], grouped[2], grouped[1]])
expect(filterOptions(grouped, ' FLASH ', 'fuzzy-label')).toEqual([grouped[2], grouped[0], grouped[1]])
expect(filterOptions(grouped, 'fslt', 'fuzzy-label')).toEqual([grouped[2]])
expect(filterOptions(grouped, 'Alpha provider', 'fuzzy-label')).toEqual([])
expect(filterOptions(grouped, ' FLASH ')).toEqual([grouped[2], grouped[0], grouped[1]])
expect(filterOptions(grouped, 'fslt')).toEqual([grouped[2]])
expect(filterOptions(grouped, 'Alpha provider')).toEqual([])
})
it('uses that same displayed order for highlighting and selection, then resets the mode on reopen', async () => {
it('uses that same displayed order for highlighting and selection', async () => {
const onSelect = vi.fn()
const { popup } = await readyPopup({ searchMode: 'fuzzy-label', options: () => Promise.resolve(grouped), onSelect })
const { popup } = await readyPopup({ options: () => Promise.resolve(grouped), onSelect })
expect(popup.state.getSnapshot().active).toBe(1)
popup.setSearch('flash')
expect(popup.state.getSnapshot().active).toBe(0)
@@ -73,16 +73,15 @@ describe('filterOptions', () => {
expect(popup.state.getSnapshot().active).toBe(2)
await popup.select(2)
expect(onSelect).toHaveBeenCalledWith(grouped[1], CTX_A)
popup.open('theme', spec(), CTX_A, SEGMENT)
await Promise.resolve()
expect(popup.state.getSnapshot().searchMode).toBe('substring')
})
it('matches case-insensitively over label and detail; blank keeps all', () => {
expect(filterOptions(OPTIONS, '')).toBe(OPTIONS)
expect(filterOptions(OPTIONS, ' ')).toBe(OPTIONS)
it('matches labels fuzzily and details as substrings; blank keeps all', () => {
expect(filterOptions(OPTIONS, '')).toEqual(OPTIONS)
expect(filterOptions(OPTIONS, ' ')).toEqual(OPTIONS)
expect(filterOptions(OPTIONS, 'DARK')).toEqual([OPTIONS[0]])
expect(filterOptions(OPTIONS, 'lgt')).toEqual([OPTIONS[1]])
expect(filterOptions(OPTIONS, 'warm')).toEqual([OPTIONS[2]])
expect(filterOptions(OPTIONS, 'wrm')).toEqual([])
expect(filterOptions(OPTIONS, 'nope')).toEqual([])
})
})
@@ -8,6 +8,9 @@
"src"
],
"references": [
{
"path": "../../util/text-search"
},
{
"path": "../../api/remotes/tsconfig.client.json"
},
@@ -350,6 +350,13 @@ export const zh = {
'tool.title.glob': '查找文件',
'tool.title.webSearch': '网页搜索',
'tool.title.webFetch': '网页获取',
'tool.webFetch.failure.dns': '无法解析域名,请检查网络、代理或 DNS 设置',
'tool.webFetch.failure.refused': '连接被拒绝,请检查地址、端口或代理',
'tool.webFetch.failure.connectionTimeout': '连接超时,请检查网络或代理后重试',
'tool.webFetch.failure.certificate': '安全证书校验失败,请检查系统时间、代理或证书配置',
'tool.webFetch.failure.interrupted': '连接中断,请稍后重试',
'tool.webFetch.failure.unreachable': '网络或主机不可达,请检查网络连接或代理',
'tool.webFetch.failure.network': '网络请求失败,详情见输出',
'tool.autoReviewRejected': 'Auto review 已拒绝',
'tool.autoReviewNotExecuted': '工具未执行。原因:{reason}',
'tool.autoReviewReasonFallback': 'Auto review 未授权此次操作',
@@ -749,6 +756,13 @@ export const en = {
'tool.title.glob': 'Glob',
'tool.title.webSearch': 'Search',
'tool.title.webFetch': 'Fetch',
'tool.webFetch.failure.dns': 'Couldn\'t resolve the host name. Check your network, proxy, or DNS settings.',
'tool.webFetch.failure.refused': 'Connection refused. Check the address, port, or proxy.',
'tool.webFetch.failure.connectionTimeout': 'Connection timed out. Check your network or proxy, then retry.',
'tool.webFetch.failure.certificate': 'Certificate verification failed. Check the system clock, proxy, or certificates.',
'tool.webFetch.failure.interrupted': 'Connection interrupted. Try again later.',
'tool.webFetch.failure.unreachable': 'Network or host unreachable. Check your network connection or proxy.',
'tool.webFetch.failure.network': 'Network request failed. See the output for details.',
'tool.autoReviewRejected': 'Rejected by Auto review',
'tool.autoReviewNotExecuted': 'Tool was not executed. Reason: {reason}',
'tool.autoReviewReasonFallback': 'Auto review did not authorize this action',
@@ -1147,6 +1161,13 @@ export const ja = {
'tool.title.glob': 'Glob',
'tool.title.webSearch': '検索',
'tool.title.webFetch': '取得',
'tool.webFetch.failure.dns': 'ホスト名を解決できませんでした。ネットワーク、プロキシ、または DNS の設定を確認してください。',
'tool.webFetch.failure.refused': '接続が拒否されました。アドレス、ポート、またはプロキシを確認してください。',
'tool.webFetch.failure.connectionTimeout': '接続がタイムアウトしました。ネットワークまたはプロキシを確認してから再試行してください。',
'tool.webFetch.failure.certificate': '証明書の検証に失敗しました。システムの時刻、プロキシ、または証明書を確認してください。',
'tool.webFetch.failure.interrupted': '接続が中断されました。しばらくしてから再試行してください。',
'tool.webFetch.failure.unreachable': 'ネットワークまたはホストに到達できません。ネットワーク接続またはプロキシを確認してください。',
'tool.webFetch.failure.network': 'ネットワークリクエストに失敗しました。詳細は出力を確認してください。',
'tool.autoReviewRejected': '自動認可レビューにより拒否されました',
'tool.autoReviewNotExecuted': 'ツールは実行されませんでした。理由: {reason}',
'tool.autoReviewReasonFallback': '自動認可レビューがこの操作を承認しませんでした',
@@ -1538,6 +1559,13 @@ export const es = {
'tool.title.glob': 'globo',
'tool.title.webSearch': 'Buscar',
'tool.title.webFetch': 'buscar',
'tool.webFetch.failure.dns': 'No se pudo resolver el nombre de host. Revisa la configuración de red, proxy o DNS.',
'tool.webFetch.failure.refused': 'Conexión rechazada. Revisa la dirección, el puerto o el proxy.',
'tool.webFetch.failure.connectionTimeout': 'Se agotó el tiempo de conexión. Revisa tu red o proxy y vuelve a intentarlo.',
'tool.webFetch.failure.certificate': 'Error al verificar el certificado. Revisa el reloj del sistema, el proxy o los certificados.',
'tool.webFetch.failure.interrupted': 'Conexión interrumpida. Vuelve a intentarlo más tarde.',
'tool.webFetch.failure.unreachable': 'Red o host inaccesible. Revisa tu conexión de red o el proxy.',
'tool.webFetch.failure.network': 'Error en la solicitud de red. Consulta la salida para ver los detalles.',
'tool.autoReviewRejected': 'Rechazado por Auto review',
'tool.autoReviewNotExecuted': 'La herramienta no fue ejecutada. Razón: {reason}',
'tool.autoReviewReasonFallback': 'Auto review no autorizó esta acción',
@@ -1936,6 +1964,13 @@ export const fr = {
'tool.title.glob': 'Glob',
'tool.title.webSearch': 'Rechercher',
'tool.title.webFetch': 'Récupérer',
'tool.webFetch.failure.dns': 'Impossible de résoudre le nom d’hôte. Vérifiez vos paramètres réseau, proxy ou DNS.',
'tool.webFetch.failure.refused': 'Connexion refusée. Vérifiez l’adresse, le port ou le proxy.',
'tool.webFetch.failure.connectionTimeout': 'Délai de connexion dépassé. Vérifiez votre réseau ou votre proxy, puis réessayez.',
'tool.webFetch.failure.certificate': 'Échec de la vérification du certificat. Vérifiez l’horloge système, le proxy ou les certificats.',
'tool.webFetch.failure.interrupted': 'Connexion interrompue. Réessayez plus tard.',
'tool.webFetch.failure.unreachable': 'Réseau ou hôte injoignable. Vérifiez votre connexion réseau ou votre proxy.',
'tool.webFetch.failure.network': 'Échec de la requête réseau. Consultez la sortie pour plus de détails.',
'tool.autoReviewRejected': 'Rejeté par Auto review',
'tool.autoReviewNotExecuted': "L'outil n'a pas été exécuté. Raison : {reason}",
'tool.autoReviewReasonFallback': "Auto review n'a pas autorisé cette action",
@@ -2334,6 +2369,13 @@ export const de = {
'tool.title.glob': 'Globus',
'tool.title.webSearch': 'Suchen',
'tool.title.webFetch': 'Holen',
'tool.webFetch.failure.dns': 'Hostname konnte nicht aufgelöst werden. Prüfen Sie Ihre Netzwerk-, Proxy- oder DNS-Einstellungen.',
'tool.webFetch.failure.refused': 'Verbindung abgelehnt. Überprüfen Sie Adresse, Port oder Proxy.',
'tool.webFetch.failure.connectionTimeout': 'Zeitüberschreitung der Verbindung. Überprüfen Sie Ihr Netzwerk oder Ihren Proxy und versuchen Sie es erneut.',
'tool.webFetch.failure.certificate': 'Zertifikatsprüfung fehlgeschlagen. Prüfen Sie die Systemzeit, den Proxy oder die Zertifikate.',
'tool.webFetch.failure.interrupted': 'Verbindung unterbrochen. Versuchen Sie es später erneut.',
'tool.webFetch.failure.unreachable': 'Netzwerk oder Host nicht erreichbar. Überprüfen Sie Ihre Netzwerkverbindung oder Ihren Proxy.',
'tool.webFetch.failure.network': 'Netzwerkanfrage fehlgeschlagen. Details finden Sie in der Ausgabe.',
'tool.autoReviewRejected': 'Abgelehnt von Auto review',
'tool.autoReviewNotExecuted': 'Werkzeug wurde nicht ausgeführt. Grund: {reason}',
'tool.autoReviewReasonFallback': 'Auto review hat diese Aktion nicht autorisiert',
@@ -2732,6 +2774,13 @@ export const ru = {
'tool.title.glob': 'Глоб',
'tool.title.webSearch': 'Поиск',
'tool.title.webFetch': 'Получить',
'tool.webFetch.failure.dns': 'Не удалось разрешить имя хоста. Проверьте настройки сети, прокси или DNS.',
'tool.webFetch.failure.refused': 'Соединение отклонено. Проверьте адрес, порт или прокси.',
'tool.webFetch.failure.connectionTimeout': 'Истекло время ожидания соединения. Проверьте сеть или прокси и повторите попытку.',
'tool.webFetch.failure.certificate': 'Не удалось проверить сертификат. Проверьте системное время, прокси или сертификаты.',
'tool.webFetch.failure.interrupted': 'Подключение прервано. Повторите попытку позже.',
'tool.webFetch.failure.unreachable': 'Сеть или хост недоступны. Проверьте сетевое подключение или прокси.',
'tool.webFetch.failure.network': 'Сетевой запрос не выполнен. Подробности см. в выводе.',
'tool.autoReviewRejected': 'Отклонено Auto review',
'tool.autoReviewNotExecuted': 'Инструмент не был выполнен. Причина: {reason}',
'tool.autoReviewReasonFallback': 'Auto review не санкционировал это действие',
@@ -3130,6 +3179,13 @@ export const pt = {
'tool.title.glob': 'globo',
'tool.title.webSearch': 'Pesquisar',
'tool.title.webFetch': 'Buscar',
'tool.webFetch.failure.dns': 'Não foi possível resolver o nome do host. Verifique as configurações de rede, proxy ou DNS.',
'tool.webFetch.failure.refused': 'Conexão recusada. Verifique o endereço, a porta ou o proxy.',
'tool.webFetch.failure.connectionTimeout': 'A conexão expirou. Verifique sua rede ou proxy e tente novamente.',
'tool.webFetch.failure.certificate': 'Falha na verificação do certificado. Verifique o relógio do sistema, o proxy ou os certificados.',
'tool.webFetch.failure.interrupted': 'Conexão interrompida. Tente novamente mais tarde.',
'tool.webFetch.failure.unreachable': 'Rede ou host inacessível. Verifique sua conexão de rede ou proxy.',
'tool.webFetch.failure.network': 'Falha na solicitação de rede. Consulte a saída para ver os detalhes.',
'tool.autoReviewRejected': 'Rejeitado por Auto review',
'tool.autoReviewNotExecuted': 'A ferramenta não foi executada. Motivo: {reason}',
'tool.autoReviewReasonFallback': 'Auto review não autorizou esta ação',
@@ -30,8 +30,8 @@
en: b4c2e8c1f7ab4de5
zh: 5dd0e14aa5f9d334
/deepseek-ai-dsh-client-ui-model-selection/understand-the-implementation:
en: c1d14a925c92950f
zh: f80f8169bc283c60
en: a11207241d0606e8
zh: 6e4f3fb27527f5b6
/deepseek-ai-dsh-client-ui-model-selection/further-exploration:
en: 14acd4692e923480
zh: ff89aed852aa0da8
+1 -1
View File
@@ -73,7 +73,7 @@ Menus use the shared `MenuSurface` material, including the macOS backing for bac
<details>
<summary>Implementation internals — click to expand</summary>
The composer `ModelSelect` and `/model` option builder share [provider ordering](src/client/provider-order.ts), while both searches use `rankByName` within each provider. The command supplies optional groups and `searchMode: 'fuzzy-label'` through the [popupSelect API](../ui-commands/README.md#use-this-package); both entries use `MenuGroup` and rebuild its sticky observer when the rendered groups change. The command popup fills the composer overlay, while the button retains its compact menu.
The composer `ModelSelect` and `/model` option builder share [provider ordering](src/client/provider-order.ts), while both searches use the shared [text search](../../util/text-search/README.md) within each provider. The command supplies optional groups through the [popupSelect API](../ui-commands/README.md#use-this-package); both entries use `MenuGroup` and rebuild its sticky observer when the rendered groups change. The command popup fills the composer overlay, while the button retains its compact menu.
Two entries over ONE per-session directory owned by `ModelDirectoryResolver` (`ctx.modelDirectories`): the `/model` popupSelect contribution (registered through `ctx.commandUi`) and the composer's named `conversation.input.model` seat both load the session's available directory through `session.models` and submit through `session.selectModel` via the same `ModelDirectory` instance, so a switch made in either entry is what the other shows next. Directory loads and selections share a generation counter so an older response never overwrites a newer one. The directory publishes the latest submitted selection as `pending` until it settles or a connection reset invalidates it; a connection reset drops every resident projection and repulls the Host-restored selection before display. Directories are per-session, resolved lazily, and disposed with the session scope; addressed subagent sessions expose neither entry. Every resident directory refetches directly on forwarded `llm/adapters-updated`, `llm/models-updated`, `settings/document-updated`, and credential update events.
@@ -73,7 +73,7 @@ composer 菜单中的模型名称和推理等级均使用 400(regular)字重
<details>
<summary>实现细节——点击展开</summary>
composer 的 `ModelSelect` 与 `/model` 选项构建器共用[提供方排序](src/client/provider-order.ts),两个搜索框均在每个提供方内使用 `rankByName`。命令通过 [popupSelect API](../ui-commands/README.zh.md#use-this-package) 提供可选分组与 `searchMode: 'fuzzy-label'`;两个入口均使用 `MenuGroup`,并在渲染分组变化时重建其吸顶观察器。命令弹窗撑满 composer 浮层,按钮则保留紧凑菜单。
composer 的 `ModelSelect` 与 `/model` 选项构建器共用[提供方排序](src/client/provider-order.ts),两个搜索框均在每个提供方内使用共享的[文本搜索](../../util/text-search/README.zh.md)。命令通过 [popupSelect API](../ui-commands/README.zh.md#use-this-package) 提供可选分组;两个入口均使用 `MenuGroup`,并在渲染分组变化时重建其吸顶观察器。命令弹窗撑满 composer 浮层,按钮则保留紧凑菜单。
两个入口共用一份由 `ModelDirectoryResolver`(`ctx.modelDirectories`)持有的会话级目录:`/model` popupSelect 贡献项(经 `ctx.commandUi` 注册)与 composer 的具名 `conversation.input.model` 位都经 `session.models` 加载会话的可用目录、经 `session.selectModel` 通过同一个 `ModelDirectory` 实例提交,因此任一入口所做的切换正是另一个入口接下来显示的。目录加载与选择共享一个代次计数器,旧响应不会覆盖新结果。目录把最近一次提交的选择发布为 `pending`,直到它完成或被连接重置作废;连接重置丢弃所有常驻投影,并在显示前重新拉取 Host 恢复的选择。目录按会话惰性解析,随会话作用域一并 dispose(资源释放);已寻址 subagent 会话不公开任一入口。每份常驻目录都会直接在转发的 `llm/adapters-updated`、`llm/models-updated`、`settings/document-updated` 与凭据更新事件上重拉。
@@ -67,7 +67,8 @@
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
"clsx": "^2.1.1",
"@deepseek-ai/dsh-client-product-analytics": "workspace:*"
"@deepseek-ai/dsh-client-product-analytics": "workspace:*",
"@deepseek-ai/dsh-util-text-search": "workspace:*"
},
"files": [
"locale/*.json",
@@ -37,11 +37,12 @@ import clsx from 'clsx'
import type { ModelReasoningEffort, ModelSelection } from '@deepseek-ai/dsh-api-remotes/client'
import {
IconCheckOutlineRegular, IconChevronDownOutlineRegular, IconChevronRightOutlineRegular, IconCloseFillRegular,
IconDataOutlineRegular, IconWarningOutlineRegular, Input, isMobileDevice, rankByName, StateDot, Tag, Toast,
IconDataOutlineRegular, IconWarningOutlineRegular, Input, isMobileDevice, StateDot, Tag, Toast,
} from '@deepseek-ai/dsh-client-ui-primitives'
import type { PropsLocale, PropsRenderSlots, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
import type { ModelLabelOwner, ModelMenuControls, ModelMenuPaneRef, ModelSelectInjected } from './slots.ts'
import css from './ModelSelect.module.css'
import { TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import { orderModelProviders } from './provider-order.ts'
/** Which pane the dropdown shows: the root menu, one drilled-in list, or a plugin-owned detail pane. */
@@ -124,9 +125,12 @@ export function ModelSelect(
} satisfies ModelSelection,
}))), [groups])
const showSearch = choices.length > 4
const filteredGroups = useMemo(() => groups.map(group => ({
...group, models: rankByName(group.models, showSearch ? query.trim() : ''),
})).filter(group => group.models.length > 0), [groups, query, showSearch])
const groupIndexes = useMemo(() => groups.map(group => ({
group, index: new TextSearchIndex(group.models, model => ({ fuzzy: [model.name, model.id], substring: [model.description] })),
})), [groups])
const filteredGroups = useMemo(() => groupIndexes.map(({ group, index }) => ({
...group, models: index.search(showSearch ? query : ''),
})).filter(group => group.models.length > 0), [groupIndexes, query, showSearch])
const visibleModels = useMemo(() => filteredGroups.flatMap(group => group.models.map(model => ({
provider: group.id, model: model.id,
}))), [filteredGroups])
@@ -134,7 +134,6 @@ export function apply(ctx: ClientContext): void {
available: session => sessions.subagentAddress(session.sessionId) === undefined,
ui: {
kind: 'popupSelect',
searchMode: 'fuzzy-label',
searchLabels: () => ({
placeholder: t('search.placeholder'),
empty: t('empty.models'),
@@ -245,7 +245,6 @@ describe('ui-model-selection dual entry', () => {
])
expect(options.map(option => option.group?.label)).toEqual(['DeepSeek', 'DeepSeek', 'External Provider'])
expect(options.every(option => option.detail === undefined)).toBe(true)
expect(b.popup().searchMode).toBe('fuzzy-label')
expect(options[0]?.active).toBe(true)
expect(options[1]?.active).toBeUndefined()
expect(b.popup().searchLabels?.()).toEqual(locale === 'zh'
@@ -11,6 +11,9 @@
{
"path": "../../core/agent"
},
{
"path": "../../util/text-search"
},
{
"path": "../../api/remotes/tsconfig.client.json"
},
@@ -27,8 +27,8 @@
en: 188ebf6f1590bad1
zh: e6d41e8586190fa0
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-one-row-of-a-bundle:
en: d3627d4dba5e6cc2
zh: e0d0eada4c20331f
en: 5f93ebe75d13b7cf
zh: 9c28f150263d041e
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/configuration-pages:
en: e9da90f03691101b
zh: 902cda935a4ce3c8
+1 -1
View File
@@ -82,7 +82,7 @@ A bundle's page shows its full package name under the title. Its **Source** sect
### Switching one row of a bundle
A row's switch on the bundle's page calls `pluginManager.setPluginEnabled`, which records the row's enablement in the profile's `cordis.patch.yml` under the [toggle rules](../../boot/plugin-manager/README.md#use-this-package). The tree recomposes at once on a profile with HMR, so the row's host half unmounts or mounts while the rest of the bundle keeps running, and the page follows the client module graph without reloading. Rows use the shared status marker for their Host fiber phase: pending and disabled are idle, loading and unloading are ongoing, active is done, and failed is error. The switch appears only on a bundle that is on; a row without a live entry, or one the Host will not address through the profile patch, is locked with the Host's reason. A list longer than ten rows gets a filter over localized titles, descriptions, row ids, and module names.
A row's switch on the bundle's page calls `pluginManager.setPluginEnabled`, which records the row's enablement in the profile's `cordis.patch.yml` under the [toggle rules](../../boot/plugin-manager/README.md#use-this-package). The tree recomposes at once on a profile with HMR, so the row's host half unmounts or mounts while the rest of the bundle keeps running, and the page follows the client module graph without reloading. Rows use the shared status marker for their Host fiber phase: pending and disabled are idle, loading and unloading are ongoing, active is done, and failed is error. The switch appears only on a bundle that is on; a row without a live entry, or one the Host will not address through the profile patch, is locked with the Host's reason. A list longer than ten rows gets a filter through the shared [text search](../../util/text-search/README.md): row ids, module names, and every declared language of titles match fuzzily, and every language of descriptions matches as a substring; rows display in the current language.
### Configuration pages
@@ -82,7 +82,7 @@ Host 将网络失败或超时归因于 GitHub 地址,且提供 npmmirror 时
### 切换组合包里的一行
组合包页面上行的开关调用 `pluginManager.setPluginEnabled`,按[开关规则](../../boot/plugin-manager/README.zh.md#use-this-package)在 profile 的 `cordis.patch.yml` 中记录该行的启用状态。启用了 HMR 的 profile 的树随即重组,该行的宿主半区卸下或挂上,组合包其余部分照常运行,页面无需重载即跟随客户端模块图。行使用共享状态标记表示 Host fiber 阶段:pending 与 disabled 为 idle,loading 与 unloading 为 ongoing,active 为 done,failed 为 error。开关只出现在已打开的组合包上;没有存活条目的行,以及 Host 不通过 profile patch 寻址的行,带着 Host 的原因锁定。超过十行的列表带一个按本地化标题、描述、行 id 和模块名筛选的输入框。
组合包页面上行的开关调用 `pluginManager.setPluginEnabled`,按[开关规则](../../boot/plugin-manager/README.zh.md#use-this-package)在 profile 的 `cordis.patch.yml` 中记录该行的启用状态。启用了 HMR 的 profile 的树随即重组,该行的宿主半区卸下或挂上,组合包其余部分照常运行,页面无需重载即跟随客户端模块图。行使用共享状态标记表示 Host fiber 阶段:pending 与 disabled 为 idle,loading 与 unloading 为 ongoing,active 为 done,failed 为 error。开关只出现在已打开的组合包上;没有存活条目的行,以及 Host 不通过 profile patch 寻址的行,带着 Host 的原因锁定。超过十行的列表带一个筛选框,使用共享的[文本搜索](../../util/text-search/README.zh.md):行 id、模块名和标题的所有声明语言模糊匹配,描述的所有语言按子串匹配;各行以当前语言显示。
### 配置页
@@ -74,7 +74,8 @@
"@deepseek-ai/dsh-util-crypto": "workspace:*",
"@deepseek-ai/dsh-client-ui-settings": "workspace:*",
"@deepseek-ai/dsh-plugin-manager": "workspace:*",
"@deepseek-ai/dsh-client-product-analytics": "workspace:*"
"@deepseek-ai/dsh-client-product-analytics": "workspace:*",
"@deepseek-ai/dsh-util-text-search": "workspace:*"
},
"files": [
"locale/*.json",
@@ -8,7 +8,7 @@
* the page declares.
*/
import { useEffect, useId, useRef, useState, type ReactNode } from 'react'
import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react'
import { createPortal } from 'react-dom'
import type { PluginInstallFailureKind, Registry } from '@deepseek-ai/dsh-api-remotes/client'
import {
@@ -22,6 +22,7 @@ import {
} from '@deepseek-ai/dsh-client-ui-primitives'
import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots'
import { EXTENSION_BUNDLES, HIDDEN_BUNDLES, MORE_BUNDLES } from '@deepseek-ai/dsh-official-bundles'
import { localizedValues, TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import type { createNavigationStore } from './navigation-store.ts'
import type { PluginHeaderLayoutFace } from './header-scroll.ts'
import { rowConfigKey, type OfficialItem } from './config-ledger.ts'
@@ -282,10 +283,12 @@ function RowsSection({ rows, t, resolveText, toggle, configure }: {
readonly configure?: RowConfigure | undefined
}): ReactNode {
const [filter, setFilter] = useState('')
const query = filter.trim().toLowerCase()
const localized = rows.map(row => ({ row, ...rowText(row, resolveText) }))
const shown = query === '' ? localized : localized.filter(({ row, title, description }) =>
[title, description, row.rowId, row.moduleName].some(value => value?.toLowerCase().includes(query)))
// Rows display one language; matching covers every language a value carries.
const rowIndex = useMemo(() => new TextSearchIndex(rows, row => ({
fuzzy: [row.rowId, row.moduleName, ...localizedValues(row.meta?.title)],
substring: localizedValues(row.meta?.description),
})), [rows])
const shown = rowIndex.search(filter).map(row => ({ row, ...rowText(row, resolveText) }))
return (
<section className={css.detailSection} data-plugin-rows>
<div className={css.sectionHead}>
@@ -1219,8 +1219,12 @@ describe('PluginManagerPage', () => {
fireEvent.click(toggle)
expect(actions.setRowEnabled).toHaveBeenCalledExactlyOnceWith('include:sidebar', false)
// The Chinese page still finds the row by its English title.
fireEvent.change(search, { target: { value: 'Sidebar component' } })
expect(document.querySelectorAll('[data-plugin-row]')).toHaveLength(1)
fireEvent.change(search, { target: { value: 'no such row' } })
expect(screen.getByText(zh.partsFilterEmpty)).toBeTruthy()
fireEvent.change(search, { target: { value: 'Sidebar component' } })
setLanguage(en)
expect(screen.getByRole('button', { name: en.configureRow.replace('{name}', 'Sidebar component') })).toBeTruthy()
fireEvent.click(screen.getByRole('button', { name: en.configureRow.replace('{name}', 'Sidebar component') }))
@@ -6,6 +6,9 @@
"tsBuildInfoFile": "lib/tsconfig.client.tsbuildinfo"
},
"references": [
{
"path": "../../util/text-search"
},
{
"path": "../../util/package-manifest"
},
@@ -21,8 +21,8 @@
en: 11686b52743a702d
zh: d865bb79d8f56ee1
/deepseek-ai-dsh-client-ui-primitives/use-this-package/controls-and-icons:
en: 69acdb3375548a62
zh: c392c11faf88938f
en: fd3499ef403a0594
zh: 3a17727316d3c666
/deepseek-ai-dsh-client-ui-primitives/use-this-package/rendering-agent-output:
en: 7fed4894a6d0d568
zh: c22881bfcef2d4b6
+1 -1
View File
@@ -97,7 +97,7 @@ Writing your own component in your own package is fine when the need is genuinel
### Controls and icons
The catalog above lists what each export is for; this section covers the behavior that props alone do not show. Product icon names omit artboard sizes and end in `Regular` or `Medium`. Line artwork uses stroke widths of 1 and 1.3 SVG user units respectively; the `size` prop controls rendered dimensions. Strokes scale with the viewport: a 1-unit stroke in a 16-unit view box renders at 0.875 CSS px at 14px and 0.75 CSS px at 12px, before further transforms. The renderer does not apply non-scaling strokes; filled contours scale as geometry and do not respond to stroke-width changes. Shared menus render icons at 14px, or 12px in compact lists, through `Menu.module.css`; these are rendered sizes, not fixed stroke widths. Named components keep the chosen weight visible at import sites; the library owns stroke geometry instead of consumer CSS overrides. Each product icon renders an `<svg>` box with one `<use>` of its `dsw-icon-<glyph>-<weight>` symbol, for example `dsw-icon-search-outline-regular`, and names that id in `data-icon`. `ICON_SYMBOLS` holds every symbol's default SVG document; ui-theme renders the document icon sprite from it, and an icon whose symbol is missing renders nothing. Artwork reached through `<use>` inherits `currentColor` and CSS variables from the use site. Each product, reference, link, and permission glyph intentionally keeps both weight exports even when the current product uses only one, so callers can choose emphasis without adding another API later; fill-only pairs render identically. `IconMailReadOutlineRegular`/`Medium` show an open envelope; `IconMailUnreadOutlineRegular`/`Medium` show a closed envelope with an unread dot. `IconWarningOutlineRegular`/`Medium` use a circle; `IconWarningTriangleOutlineRegular`/`Medium` use a rounded triangle. `IconEyeOutlineRegular`/`Medium` draw an open eye with a pupil and `IconEyeOffOutlineRegular`/`Medium` the same contour crossed by a diagonal slash, for paired show and hide toggles. `FishLogo` and `BrandWordmark` fill brand slots. `FileTypeIcon` renders the traditional 28px spreadsheet, folder, HTML, image, Markdown, generic, PDF, PPT, video, and Word glyphs, and uses the imported square technology artwork for the established 48 code and configuration categories. The import replaces artwork only: archive-only categories do not extend `CodeFileType`. `classifyFileType` applies exact filename, prefix, suffix, optional project-context, and extension rules in that order; React names win over TypeScript/JavaScript, Angular suffixes win over their base extension, and a Dart file becomes Flutter only when the supplied project files contain a `pubspec.yaml` with `flutter:`. Markdown and SVG remain traditional Markdown and image files. Spreadsheet mappings include CSV, TSV, Excel workbooks and templates, OpenDocument spreadsheets, and Numbers; KEY maps to slides, while RTF/ODT/Pages map to documents. `fileExtension` exposes the same basename and final-dot parsing for adjacent metadata labels. Traditional glyphs use a solid category-colored sheet with a white mark and translucent white corner; the generic code glyph uses angle brackets and a slash at the supplied 1.35px stroke; the generic file uses a grey sheet and darker grey corner. Callers may override the sheet color through `--dsh-file-type-icon-color`. The full-color technology artwork is the deliberate exception and retains its embedded palette. All glyphs are decorative and carry no label. `LinkIconMedium` is the leading glyph for clickable artifact links — globe, folder, code, image, document, or plain paper, and for a `url` link the mark of a well-known site named by its `href` — the developer sites a transcript usually cites (GitHub, GitLab, npm, PyPI, Stack Overflow, MDN, Wikipedia, Hacker News, YouTube, X, Bilibili, Zhihu, Juejin, CSDN) and mainstream search, video, social, shopping, and reference sites (Google, Baidu, DuckDuckGo, TikTok, Netflix, Spotify, Facebook, Instagram, Reddit, Telegram, WhatsApp, WeChat, QQ, Weibo, Taobao, AliExpress, eBay, Quora, V2EX, Apple) — while `classifyLinkPath` folds the shared file types into that existing six-category vocabulary. `ConnectionIndicator` renders a warning-colored disconnected action whose permanent retry glyph marks the retry action beside the owner-supplied outage label, the shared ongoing loader in the same warning color as its label whose one-to-three dots advance every 500ms independently of retry timing, or a success-colored recovered status. Clicking either warning state requests an immediate reconnect; no hover interaction changes the copy. The pill fades in on appearance, fades out for 150ms before unmounting, and sizes to its current label. Its owner supplies visibility, the recovery hold, localized labels, and the immediate-reconnect callback; the primitive uses no native title tooltip. `useAnchoredMaxHeight` keeps bottom-anchored overlays within the visible viewport; an oversized panel keeps the near margin instead of slidLine truncated
The catalog above lists what each export is for; this section covers the behavior that props alone do not show. Product icon names omit artboard sizes and end in `Regular` or `Medium`. Line artwork uses stroke widths of 1 and 1.3 SVG user units respectively; the `size` prop controls rendered dimensions. Strokes scale with the viewport: a 1-unit stroke in a 16-unit view box renders at 0.875 CSS px at 14px and 0.75 CSS px at 12px, before further transforms. The renderer does not apply non-scaling strokes; filled contours scale as geometry and do not respond to stroke-width changes. Shared menus render icons at 14px, or 12px in compact lists, through `Menu.module.css`; these are rendered sizes, not fixed stroke widths. Named components keep the chosen weight visible at import sites; the library owns stroke geometry instead of consumer CSS overrides. Each product icon renders an `<svg>` box with one `<use>` of its `dsw-icon-<glyph>-<weight>` symbol, for example `dsw-icon-search-outline-regular`, and names that id in `data-icon`. `ICON_SYMBOLS` holds every symbol's default SVG document; ui-theme renders the document icon sprite from it, and an icon whose symbol is missing renders nothing. Artwork reached through `<use>` inherits `currentColor` and CSS variables from the use site. Each product, reference, link, and permission glyph intentionally keeps both weight exports even when the current product uses only one, so callers can choose emphasis without adding another API later; fill-only pairs render identically. `IconMailReadOutlineRegular`/`Medium` show an open envelope; `IconMailUnreadOutlineRegular`/`Medium` show a closed envelope with an unread dot. `IconWarningOutlineRegular`/`Medium` use a circle; `IconWarningTriangleOutlineRegular`/`Medium` use a rounded triangle. `IconEyeOutlineRegular`/`Medium` draw an open eye with a pupil and `IconEyeOffOutlineRegular`/`Medium` the same contour crossed by a diagonal slash, for paired show and hide toggles. `FishLogo` and `BrandWordmark` fill brand slots. `FileTypeIcon` renders the traditional 28px spreadsheet, folder, HTML, image, Markdown, generic, PDF, PPT, video, and Word glyphs, and uses the imported square technology artwork for the established 48 code and configuration categories. The import replaces artwork only: archive-only categories do not extend `CodeFileType`. `classifyFileType` applies exact filename, prefix, suffix, optional project-context, and extension rules in that order; React names win over TypeScript/JavaScript, Angular suffixes win over their base extension, and a Dart file becomes Flutter only when the supplied project files contain a `pubspec.yaml` with `flutter:`. Markdown and SVG remain traditional Markdown and image files. Spreadsheet mappings include CSV, TSV, Excel workbooks and templates, OpenDocument spreadsheets, and Numbers; KEY maps to slides, while RTF/ODT/Pages map to documents. `fileExtension` exposes the same basename and final-dot parsing for adjacent metadata labels. Traditional glyphs use a solid category-colored sheet with a white mark and translucent white corner; the generic code glyph uses angle brackets and a slash at the supplied 1.35px stroke; the generic file uses a grey sheet and darker grey corner. Callers may override the sheet color through `--dsh-file-type-icon-color`. The full-color technology artwork is the deliberate exception and retains its embedded palette. All glyphs are decorative and carry no label. `LinkIconMedium` is the leading glyph for clickable artifact links — globe, folder, code, image, document, or plain paper, and for a `url` link the mark of a well-known site named by its `href` — the developer sites a transcript usually cites (GitHub, GitLab, npm, PyPI, Stack Overflow, MDN, Wikipedia, Hacker News, YouTube, X, Bilibili, Zhihu, Juejin, CSDN) and mainstream search, video, social, shopping, and reference sites (Google, Baidu, DuckDuckGo, TikTok, Netflix, Spotify, Facebook, Instagram, Reddit, Telegram, WhatsApp, WeChat, QQ, Weibo, Taobao, AliExpress, eBay, Quora, V2EX, Apple) — while `classifyLinkPath` folds the shared file types into that existing six-category vocabulary. `ConnectionIndicator` renders a warning-colored disconnected action whose permanent retry glyph marks the retry action beside the owner-supplied outage label, the shared ongoing loader in the same warning color as its label whose one-to-three dots advance every 500ms independently of retry timing, or a success-colored recovered status. Clicking either warning state requests an immediate reconnect; no hover interaction changes the copy. The pill fades in on appearance, fades out for 150ms before unmounting, and sizes to its current label. Its owner supplies visibility, the recovery hold, localized labels, and the immediate-reconnect callback; the primitive uses no native title tooltip. `useAnchoredMaxHeight` keeps bottom-anchored overlays within the visible viewport; an oversized panel keeps the near margin instead of slidLine truncated
`Tooltip` reads the anchor on hover or keyboard focus and fits its bubble from `ResizeObserver` border-box sizes. It stays hidden until its first fit, prefers the requested side, then tries the opposite and perpendicular sides, sliding along the anchor without covering it when a side fits. Horizontal placements keep a 10px gap; vertical placements use `gap` (8px by default). Width and height stay within a 12px viewport margin; text wraps, and content taller than the viewport scrolls when pinned. If no side fits, a stable viewport-bounded fallback can overlap the anchor. Viewport resize refreshes the anchor coordinates; label-size changes reuse them. Fitting does not synchronously measure the bubble or trigger a React render. Touch presses dismiss unpinned hints and do not trigger hover hints, including compatibility mouse events. Mouse entry opens hints only while `(any-hover: hover)` reports an available hover-capable input, excluding iOS mouse entry caused by a tapped icon changing. Keyboard focus and explicit click-to-open explanations remain available on touch-only devices. Opt-in `openOnClick` lets an informational button pin the bubble by click or tap and associates it with the anchor description. Another click or tap, Escape, Tab, or an outside pointerdown closes it. Ordinary action buttons execute their action directly without a touch tooltip. Opt-in `onlyWhenClipped` shows the bubble only when the anchor or an HTML element inside it overflows horizontally when the bubble is about to show, so a label that repeats ellipsis-cut text appears only while it adds information.
+1 -1
View File
@@ -97,7 +97,7 @@ kind: "package-library"
### 控件与图标
上面的目录说明每个导出的用途;本节讲 props 本身看不出来的行为。产品图标名称不含画板尺寸,以 `Regular` 或 `Medium` 结尾。线条图形分别使用 1 和 1.3 SVG 用户单位的描边宽度;`size` prop 控制渲染尺寸。描边随视口缩放:16 单位 viewBox 中宽度为 1 的描边,在 14px 下为 0.875 CSS px,在 12px 下为 0.75 CSS px,尚未计入额外变换。渲染器不使用非缩放描边;填充轮廓随几何缩放,不受 stroke-width 变化影响。共享菜单通过 `Menu.module.css` 将图标渲染为 14px,紧凑列表为 12px;这些是渲染尺寸,不是固定描边宽度。具名组件让所选线重在导入处可见;描边几何由组件库拥有,而不是由消费方 CSS 覆盖。每个产品图标渲染一个 `<svg>` 框,其中包含一个引用对应 `dsw-icon-<glyph>-<weight>` symbol 的 `<use>`,例如 `dsw-icon-search-outline-regular`,并在 `data-icon` 中写出该 id。`ICON_SYMBOLS` 保存每个 symbol 的默认 SVG 文档;ui-theme 据此渲染文档的图标 sprite,缺少对应 symbol 的图标不渲染任何内容。通过 `<use>` 引用的图形会从使用处继承 `currentColor` 与 CSS 变量。每个产品、引用、链接与权限图形都会有意保留两种线重导出,即使当前产品只使用其中一种,也让调用方无需再次扩展 API 就能选择强调程度;仅填充的成对图形外观相同。`IconMailReadOutlineRegular`/`Medium` 使用打开的信封,`IconMailUnreadOutlineRegular`/`Medium` 使用带未读圆点的闭合信封。`IconWarningOutlineRegular`/`Medium` 使用圆形;`IconWarningTriangleOutlineRegular`/`Medium` 使用圆角三角形。`IconEyeOutlineRegular`/`Medium` 绘制带瞳孔的睁眼,`IconEyeOffOutlineRegular`/`Medium` 在同一轮廓上加一条斜线,用于成对的显示与隐藏开关。`FishLogo` 与 `BrandWordmark` 填充品牌 slot。`FileTypeIcon` 渲染传统的 28px spreadsheet、folder、HTML、image、Markdown、generic、PDF、PPT、video 与 Word 图形,并为现有 48 个代码和配置类别使用导入的方形技术图形。该导入只替换图形:资源包中额外的类别不会扩展 `CodeFileType`。`classifyFileType` 按完整文件名、前缀、后缀、可选项目上下文、扩展名的顺序匹配;React 文件名优先于 TypeScript/JavaScript,Angular 后缀优先于基础扩展名,只有传入的项目文件包含带 `flutter:` 的 `pubspec.yaml` 时 Dart 文件才使用 Flutter。Markdown 与 SVG 仍分别使用传统 Markdown 与图片图形。表格映射包括 CSV、TSV、Excel 工作簿与模板、OpenDocument 表格和 Numbers;KEY 映射为幻灯片,RTF/ODT/Pages 映射为文档。`fileExtension` 为相邻元数据 label 暴露同一套 basename 与最终点号解析。传统图形使用实色分类底板、白色标记和半透明白色折角;通用代码图形使用尖括号与斜线,保留原图 1.35px 描边;通用文件使用灰色底板与较深灰色折角。调用方可通过 `--dsh-file-type-icon-color` 覆盖底板颜色。全彩技术图形是明确例外,会保留其内嵌调色板。所有图形都是装饰性的,不自带 label。`LinkIconMedium` 是可点击产物链接的前置图形——地球、文件夹、代码、图片、文档或纸张,`url` 链接的 `href` 指向已知站点时则改用该站点自己的标记——转写内容常引用的开发者站点(GitHub、GitLab、npm、PyPI、Stack Overflow、MDN、Wikipedia、Hacker News、YouTube、X、Bilibili、知乎、掘金、CSDN),以及主流搜索、视频、社交、购物与参考资料站点(Google、百度、DuckDuckGo、TikTok、Netflix、Spotify、Facebook、Instagram、Reddit、Telegram、WhatsApp、微信、QQ、微博、淘宝、速卖通、eBay、Quora、V2EX、Apple)——`classifyLinkPath` 把共享文件类型折叠进原有六类词汇。`ConnectionIndicator` 可渲染警告色的断联操作(常驻重试图形指明重试动作,断联文案由持有方提供)、与文案使用相同警告色的共享 ongoing loading 加一至三个点以独立于 retry 时序的 500ms 节奏推进的连接中状态,或成功色的恢复状态。点击任一警告状态都会请求立即重连;没有任何悬停交互会改变文案。药丸出现时淡入、卸载前淡出 150ms,宽度随当前 label 自适应。它的持有方提供可见性、恢复驻留时间、本地化 label 与立即重连回调;该原语不使用原生 title tooltip。`useAnchoredMaxHeight` 将底部锚定浮层限制在可见视口内;过大的面板保留近端边距,不会滑出该边缘。portal 模式的 `Menu` 按布局视口限制卡片高度,固定页脚位于内部滚动区域之外;子卡片使用各自的 body portal,父级滚动不会裁剪它们。`HoverCard` 在框架发布的顶部占用量上增加 20px,原生全屏时保留 20px,普通浏览器中沿用自身的最小边距;Line truncated
上面的目录说明每个导出的用途;本节讲 props 本身看不出来的行为。产品图标名称不含画板尺寸,以 `Regular` 或 `Medium` 结尾。线条图形分别使用 1 和 1.3 SVG 用户单位的描边宽度;`size` prop 控制渲染尺寸。描边随视口缩放:16 单位 viewBox 中宽度为 1 的描边,在 14px 下为 0.875 CSS px,在 12px 下为 0.75 CSS px,尚未计入额外变换。渲染器不使用非缩放描边;填充轮廓随几何缩放,不受 stroke-width 变化影响。共享菜单通过 `Menu.module.css` 将图标渲染为 14px,紧凑列表为 12px;这些是渲染尺寸,不是固定描边宽度。具名组件让所选线重在导入处可见;描边几何由组件库拥有,而不是由消费方 CSS 覆盖。每个产品图标渲染一个 `<svg>` 框,其中包含一个引用对应 `dsw-icon-<glyph>-<weight>` symbol 的 `<use>`,例如 `dsw-icon-search-outline-regular`,并在 `data-icon` 中写出该 id。`ICON_SYMBOLS` 保存每个 symbol 的默认 SVG 文档;ui-theme 据此渲染文档的图标 sprite,缺少对应 symbol 的图标不渲染任何内容。通过 `<use>` 引用的图形会从使用处继承 `currentColor` 与 CSS 变量。每个产品、引用、链接与权限图形都会有意保留两种线重导出,即使当前产品只使用其中一种,也让调用方无需再次扩展 API 就能选择强调程度;仅填充的成对图形外观相同。`IconMailReadOutlineRegular`/`Medium` 使用打开的信封,`IconMailUnreadOutlineRegular`/`Medium` 使用带未读圆点的闭合信封。`IconWarningOutlineRegular`/`Medium` 使用圆形;`IconWarningTriangleOutlineRegular`/`Medium` 使用圆角三角形。`IconEyeOutlineRegular`/`Medium` 绘制带瞳孔的睁眼,`IconEyeOffOutlineRegular`/`Medium` 在同一轮廓上加一条斜线,用于成对的显示与隐藏开关。`FishLogo` 与 `BrandWordmark` 填充品牌 slot。`FileTypeIcon` 渲染传统的 28px spreadsheet、folder、HTML、image、Markdown、generic、PDF、PPT、video 与 Word 图形,并为现有 48 个代码和配置类别使用导入的方形技术图形。该导入只替换图形:资源包中额外的类别不会扩展 `CodeFileType`。`classifyFileType` 按完整文件名、前缀、后缀、可选项目上下文、扩展名的顺序匹配;React 文件名优先于 TypeScript/JavaScript,Angular 后缀优先于基础扩展名,只有传入的项目文件包含带 `flutter:` 的 `pubspec.yaml` 时 Dart 文件才使用 Flutter。Markdown 与 SVG 仍分别使用传统 Markdown 与图片图形。表格映射包括 CSV、TSV、Excel 工作簿与模板、OpenDocument 表格和 Numbers;KEY 映射为幻灯片,RTF/ODT/Pages 映射为文档。`fileExtension` 为相邻元数据 label 暴露同一套 basename 与最终点号解析。传统图形使用实色分类底板、白色标记和半透明白色折角;通用代码图形使用尖括号与斜线,保留原图 1.35px 描边;通用文件使用灰色底板与较深灰色折角。调用方可通过 `--dsh-file-type-icon-color` 覆盖底板颜色。全彩技术图形是明确例外,会保留其内嵌调色板。所有图形都是装饰性的,不自带 label。`LinkIconMedium` 是可点击产物链接的前置图形——地球、文件夹、代码、图片、文档或纸张,`url` 链接的 `href` 指向已知站点时则改用该站点自己的标记——转写内容常引用的开发者站点(GitHub、GitLab、npm、PyPI、Stack Overflow、MDN、Wikipedia、Hacker News、YouTube、X、Bilibili、知乎、掘金、CSDN),以及主流搜索、视频、社交、购物与参考资料站点(Google、百度、DuckDuckGo、TikTok、Netflix、Spotify、Facebook、Instagram、Reddit、Telegram、WhatsApp、微信、QQ、微博、淘宝、速卖通、eBay、Quora、V2EX、Apple)——`classifyLinkPath` 把共享文件类型折叠进原有六类词汇。`ConnectionIndicator` 可渲染警告色的断联操作(常驻重试图形指明重试动作,断联文案由持有方提供)、与文案使用相同警告色的共享 ongoing loading 加一至三个点以独立于 retry 时序的 500ms 节奏推进的连接中状态,或成功色的恢复状态。点击任一警告状态都会请求立即重连;没有任何悬停交互会改变文案。药丸出现时淡入、卸载前淡出 150ms,宽度随当前 label 自适应。它的持有方提供可见性、恢复驻留时间、本地化 label 与立即重连回调;该原语不使用原生 title tooltip。`useAnchoredMaxHeight` 将底部锚定浮层限制在可见视口内;过大的面板保留近端边距,不会滑出该边缘。portal 模式的 `Menu` 按布局视口限制卡片高度,固定页脚位于内部滚动区域之外;子卡片使用各自的 body portal,父级滚动不会裁剪它们。`HoverCard` 在框架发布的顶部占用量上增加 20px,原生全屏时保留 20px,普通浏览器中沿用自身的最小边距;Line truncated
`Tooltip` 在悬停或键盘聚焦时读取锚点位置,再根据 `ResizeObserver` 提供的边框盒尺寸调整气泡。首次定位前保持隐藏,优先使用指定方向,再尝试相反方向和垂直于该方向的两侧;只要某一侧容得下,就沿锚点平移而不遮挡锚点。左右放置保留 10px 间距,上下放置使用 `gap`(默认 8px)。宽高限制在视口内并保留 12px 边距;文本自动换行,超出视口高度的内容在固定气泡后可滚动。若所有方向都放不下,则使用稳定的视口内回退位置,可能遮挡锚点。视口尺寸变化会重新读取锚点坐标,标签尺寸变化则复用坐标;定位不会同步测量气泡,也不会触发 React 渲染。 触摸按下会关闭未固定的提示,且不会触发悬停提示,包括触摸后的兼容鼠标事件。只有 `(any-hover: hover)` 表明存在可悬停的输入设备时,鼠标进入才会打开提示,从而排除 iOS 因已点击图标变化而生成的鼠标进入事件。仅有触摸输入的设备仍可使用键盘聚焦提示和显式点击打开的说明。信息按钮可显式启用 `openOnClick`,通过鼠标或触摸点击固定气泡供阅读,并将内容关联为锚点的无障碍描述;再次点击、Escape、Tab 或外部 pointerdown 会关闭。普通操作按钮在触摸点击时直接执行操作,不显示 Tooltip。可选的 `onlyWhenClipped` 只在气泡即将显示时锚点或其内部某个 HTML 元素横向溢出才显示气泡,因此重复被省略号截断文本的标签只在能补充信息时出现。
+29 -15
View File
@@ -1,10 +1,28 @@
// Host clipboard write shared by Web UI copy controls. Success feedback stays
// with each control; this helper only reports whether the host accepted a write.
// with each control; this helper reports whether the host accepted a write and
// leaves focus where it found it.
/**
* Attempt the async Clipboard API write.
* @param text - the exact text to place on the clipboard.
* @returns true only when the host accepted the write.
*/
async function writeWithClipboardApi(text: string): Promise<boolean> {
try {
await navigator.clipboard.writeText(text)
} catch (_error) {
// A denied permission can block the async API while execCommand still works; the caller tries it below.
return false
}
return true
}
/**
* Write text to the host clipboard, preferring the async Clipboard API and
* falling back to `execCommand('copy')` on hosts (jsdom, insecure contexts)
* that omit it.
* falling back to `execCommand('copy')` when that API is missing (jsdom,
* insecure contexts) or refuses the write (for example, a denied clipboard
* permission). The fallback replaces the page selection and succeeds only while
* the triggering user gesture's transient activation is still valid.
* @param text - the exact text to place on the clipboard.
* @returns true only when the host accepted the write.
*/
@@ -12,36 +30,32 @@ export async function writeClipboard(text: string): Promise<boolean> {
// lib.dom types clipboard non-optional, but insecure contexts omit it —
// that runtime gap is exactly what this guard detects.
/* oxlint-disable-next-line typescript/no-unnecessary-condition */
if (navigator.clipboard?.writeText) {
try {
await navigator.clipboard.writeText(text)
return true
} catch {
// Denied permissions / iframe policy — do not claim success.
return false
}
if (typeof navigator.clipboard?.writeText === 'function') {
if (await writeWithClipboardApi(text)) return true
}
// jsdom and older hosts: best-effort execCommand path when present.
// execCommand('copy') is the only clipboard fallback where the async API
// is missing; deprecated but deliberately retained.
// is missing or refused; deprecated but deliberately retained.
/* oxlint-disable typescript/no-deprecated */
const exec = typeof document.execCommand === 'function'
? document.execCommand.bind(document)
: undefined
if (exec === undefined) return false
// Selecting the textarea moves focus; return it so a keyboard user stays on the copy control.
const focused = document.activeElement
const el = document.createElement('textarea')
el.value = text
el.setAttribute('readonly', '')
el.style.position = 'fixed'
el.style.left = '-9999px'
document.body.appendChild(el)
el.select()
try {
document.body.appendChild(el)
el.select()
return exec('copy')
} catch {
return false
} finally {
el.remove()
if (focused instanceof HTMLElement) focused.focus({ preventScroll: true })
}
/* oxlint-enable typescript/no-deprecated */
}
@@ -92,7 +92,6 @@ export type {
export { CODE_HIGHLIGHT_EXTENSIONS, languageForPath, useCodeHighlighter } from './code-highlighting.ts'
export type { CodeHighlighter, HighlightSpan } from './code-highlighting.ts'
export { relativeTime } from './relative-time.ts'
export { rankByName } from './rank-by-name.ts'
export { isDarwinDesktop } from './darwin-desktop.ts'
export type { RelativeTime, RelativeTimeUnit } from './relative-time.ts'
export { JsonTree } from './JsonTree.tsx'
@@ -1,93 +0,0 @@
/**
* Shared ranking for `/` menu candidates: the query must be a
* case-insensitive ordered subsequence of the candidate name or, when the
* candidate carries one, of its display label (a localized title). Prefix
* hits rank first, then the strongest alignment score over either key, then
* the source order of the input. Decision record:
* .agents/notes/archived/feature/2026-08-04-web-slash-command-fuzzy-discovery.md
*/
/** One match with its stable source position. */
interface Ranked<T> {
readonly item: T
readonly index: number
readonly prefix: boolean
readonly score: number
}
/** Extra weight for name starts and separator boundaries. */
function boundaryBonus(name: string, index: number): number {
return index === 0 || name.charAt(index - 1) === '-' || name.charAt(index - 1) === '_' ? 8 : 0
}
/**
* Score the strongest ordered-subsequence alignment in O(name × query).
* Boundary and adjacent matches earn weight; skipped and leading characters
* cost weight. Undefined when the query is not a subsequence of the name.
*/
function alignmentScore(name: string, query: string): number | undefined {
if (query.length > name.length) return undefined
const noMatch = Number.NEGATIVE_INFINITY
let previous = Array<number>(name.length).fill(noMatch)
for (let index = 0; index < name.length; index++) {
if (name.charAt(index) === query.charAt(0)) previous[index] = 1 + boundaryBonus(name, index) - index
}
for (let queryIndex = 1; queryIndex < query.length; queryIndex++) {
const current = Array<number>(name.length).fill(noMatch)
// Sweep the previous row once: `left` is its score one character back
// (the adjacent continuation), `leftLeft` two back (the earliest gapped one).
let left = noMatch
let leftLeft = noMatch
let bestGapped = noMatch
for (const [index, prior] of previous.entries()) {
if (leftLeft !== noMatch) bestGapped = Math.max(bestGapped, leftLeft + index - 2)
if (name.charAt(index) === query.charAt(queryIndex)) {
const bonus = 1 + boundaryBonus(name, index)
let score = noMatch
if (left !== noMatch) score = left + bonus + 4
if (bestGapped !== noMatch) score = Math.max(score, bestGapped + bonus + 1 - index)
current[index] = score
}
leftLeft = left
left = prior
}
previous = current
}
let best = noMatch
for (const score of previous) best = Math.max(best, score)
return best === noMatch ? undefined : best
}
/**
* Rank named items by a menu query.
* @param items - candidates in source order (a host catalog, then client
* contributions); an item's optional `label` is a second search key beside
* its name.
* @param rawQuery - the text typed after the trigger, matched case-insensitively.
* @returns the matching items: prefix hits first, then by alignment score,
* then in source order. The input list itself for an empty query.
*/
export function rankByName<T extends { readonly name: string; readonly label?: string }>(
items: readonly T[],
rawQuery: string,
): readonly T[] {
const query = rawQuery.toLowerCase()
if (query === '') return items
const ranked: Ranked<T>[] = []
items.forEach((item, index) => {
const keys = item.label === undefined ? [item.name] : [item.name, item.label]
let prefix = false
let score: number | undefined
for (const key of keys) {
const lower = key.toLowerCase()
const keyScore = alignmentScore(lower, query)
if (keyScore === undefined) continue
prefix ||= lower.startsWith(query)
score = score === undefined ? keyScore : Math.max(score, keyScore)
}
if (score !== undefined) ranked.push({ item, index, prefix, score })
})
ranked.sort((left, right) =>
Number(right.prefix) - Number(left.prefix) || right.score - left.score || left.index - right.index)
return ranked.map(match => match.item)
}
@@ -1,55 +0,0 @@
/**
* Shared `/` menu ranker: case-insensitive ordered-subsequence matching,
* prefix hits first, alignment score next, source order for ties.
*/
import { describe, expect, it } from 'vitest'
import { rankByName } from '@deepseek-ai/dsh-client-ui-primitives'
const named = (...names: string[]) => names.map(name => ({ name }))
const names = (items: readonly { name: string }[]) => items.map(item => item.name)
describe('rankByName', () => {
it('returns the input list itself for an empty query', () => {
const items = named('b', 'a')
expect(rankByName(items, '')).toBe(items)
})
it('matches case-insensitive subsequences and ranks prefixes, boundaries, adjacency, gaps, then source order', () => {
const items = named('q-xylophone', 'qx-long', 'fabulous', 'foo-bar', 'zuv', 'zu1v', 'yu1v', 'zu12v')
expect(names(rankByName(items, 'QX'))).toEqual(['qx-long', 'q-xylophone'])
expect(names(rankByName(items, 'fb'))).toEqual(['foo-bar', 'fabulous'])
expect(names(rankByName(items, 'uv'))).toEqual(['zuv', 'zu1v', 'yu1v', 'zu12v'])
expect(names(rankByName(items, 'zzz'))).toEqual([])
expect(names(rankByName(items, 'query-longer-than-every-name'))).toEqual([])
})
it('a prefix hit outranks a stronger non-prefix alignment', () => {
// 'z_a_b' aligns both characters on separator boundaries and outscores
// every non-prefix rival; a name that starts with the query still wins.
expect(names(rankByName(named('z_a_b', 'xabc'), 'ab'))).toEqual(['z_a_b', 'xabc'])
expect(names(rankByName(named('z_a_b', 'abc'), 'ab'))).toEqual(['abc', 'z_a_b'])
})
it('takes the stronger of an adjacent and a gapped alignment for the same character', () => {
expect(names(rankByName(named('aab', 'ab'), 'ab'))).toEqual(['ab', 'aab'])
})
it('matches the display label as a second key and keeps the stronger alignment', () => {
const items = [
{ name: 'goal', label: '目标' },
{ name: 'plan', label: '计划' },
{ name: 'permission', label: '权限' },
]
expect(names(rankByName(items, '目标'))).toEqual(['goal'])
expect(names(rankByName(items, 'goal'))).toEqual(['goal'])
expect(names(rankByName(items, 'p'))).toEqual(['plan', 'permission'])
expect(names(rankByName(items, '划'))).toEqual(['plan'])
// A label prefix hit ranks like a name prefix hit.
expect(names(rankByName([{ name: 'xplan', label: 'plan' }, { name: 'plant' }], 'pla'))).toEqual(['xplan', 'plant'])
})
it('returns the ranked items with their payload intact', () => {
const items = [{ name: 'goal', description: 'g' }, { name: 'plan', description: 'p' }]
expect(rankByName(items, 'pl')).toEqual([{ name: 'plan', description: 'p' }])
})
})
@@ -448,14 +448,32 @@ describe('writeClipboard', () => {
expect(writeText).toHaveBeenCalledWith('payload')
})
it('reports false when the Clipboard API rejects', async () => {
it('reports false when the Clipboard API rejects and no fallback exists', async () => {
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText: vi.fn().mockRejectedValue(new Error('denied')) },
})
Object.defineProperty(document, 'execCommand', { configurable: true, value: undefined })
await expect(writeClipboard('payload')).resolves.toBe(false)
})
it('falls back to execCommand when the Clipboard API rejects', async () => {
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText: vi.fn().mockRejectedValue(new Error('denied')) },
})
let selected: string | undefined
const exec = vi.fn(() => {
selected = document.querySelector<HTMLTextAreaElement>('textarea[readonly]')?.value
return true
})
Object.defineProperty(document, 'execCommand', { configurable: true, value: exec })
await expect(writeClipboard('payload')).resolves.toBe(true)
expect(exec).toHaveBeenCalledWith('copy')
expect(selected).toBe('payload')
expect(document.querySelector('textarea')).toBeNull()
})
it('selects a detached textarea for the execCommand fallback and removes it after', async () => {
Object.defineProperty(navigator, 'clipboard', { configurable: true, value: undefined })
let selected: string | undefined
@@ -470,6 +488,25 @@ describe('writeClipboard', () => {
expect(document.querySelector('textarea')).toBeNull()
})
it('returns focus to the copy control after the execCommand fallback', async () => {
Object.defineProperty(navigator, 'clipboard', { configurable: true, value: undefined })
Object.defineProperty(document, 'execCommand', { configurable: true, value: vi.fn(() => true) })
const button = document.createElement('button')
document.body.appendChild(button)
button.focus()
await expect(writeClipboard('payload')).resolves.toBe(true)
expect(document.activeElement).toBe(button)
button.remove()
})
it('copies through the fallback when nothing had focus', async () => {
Object.defineProperty(navigator, 'clipboard', { configurable: true, value: undefined })
Object.defineProperty(document, 'execCommand', { configurable: true, value: vi.fn(() => true) })
const activeElement = vi.spyOn(document, 'activeElement', 'get').mockReturnValue(null)
await expect(writeClipboard('payload')).resolves.toBe(true)
activeElement.mockRestore()
})
it('reports execCommand\'s own refusal verbatim', async () => {
Object.defineProperty(navigator, 'clipboard', { configurable: true, value: undefined })
Object.defineProperty(document, 'execCommand', { configurable: true, value: vi.fn(() => false) })
+2 -1
View File
@@ -81,7 +81,8 @@
"clsx": "^2.1.1",
"@deepseek-ai/cordis": "workspace:~",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"@deepseek-ai/dsh-util-text-search": "workspace:*"
},
"files": [
"locale/*.json",
@@ -4,6 +4,7 @@ import type { ReactNode } from 'react'
import clsx from 'clsx'
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
import { IconChevronDownOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
import { TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import { TaskMenu } from './TaskMenu.tsx'
import type { TaskMenuEntry } from './TaskMenu.tsx'
import { zoneChoices, zoneName } from './schedule-format.ts'
@@ -56,10 +57,21 @@ export function RuleZoneRow({ value, disabled, onChange, t }: PropsLocale<'sched
}
return [...byLabel.values()]
}, [value, systemZone, t])
const normalized = query.trim().toLocaleLowerCase(t('time.locale'))
const matches = catalog.filter(item => `${item.zones.join(' ')} ${item.label}`.toLocaleLowerCase(t('time.locale')).includes(normalized))
.map(item => ({ ...item, id: item.zones.find(zone => zone.toLocaleLowerCase(t('time.locale')) === normalized) ?? item.id }))
const recentItems = normalized === '' ? recent.flatMap((zone) => {
// A row groups zones that share one label. The zone saved is the one the query
// names, by the same matching that kept the row; the row's own id wins only
// while the query names it or names no zone at all. The label answers query
// terms that name no zone, such as a localized city name.
const rowIndex = useMemo(() => new TextSearchIndex(
catalog.map(item => ({ item, zones: new TextSearchIndex(item.zones, zone => ({ fuzzy: [zone, item.label] })) })),
({ item }) => ({ fuzzy: [...item.zones, item.label] }),
), [catalog])
const searching = query.trim() !== ''
const matches = rowIndex.search(query).map(({ item, zones }) => {
if (!searching) return item
const named = zones.search(query)
return { ...item, id: named.includes(item.id) ? item.id : named[0] ?? item.id }
})
const recentItems = !searching ? recent.flatMap((zone) => {
const item = catalog.find(item => item.zones.includes(zone))
return item === undefined ? [] : [{ ...item, id: zone }]
}).filter((item, index, items) => items.findIndex(candidate => candidate.label === item.label) === index) : []
@@ -12,6 +12,7 @@ import type { ScheduleId, ScheduleCatalogEntry, ScheduleCreateRequest } from '@d
import type { TaskCreateOutcome } from './TaskDetail.tsx'
import type { TaskEditorStoreProps } from './editor-store.ts'
import { taskNextRunAt, taskSessionId } from './task-record.ts'
import { TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import type { CatalogSnapshot } from './catalog-source.ts'
import { CatalogFeedback } from './CatalogFeedback.tsx'
import { TaskDetail, useTaskDetail, type TaskDetailInjected } from './TaskDetail.tsx'
@@ -93,16 +94,12 @@ export function TaskManagerPage(props: TaskManagerPageProps) {
() => records.filter(record => record.status === 'ended').length,
[records],
)
const rows = useMemo(() => {
const query = search.trim().toLowerCase()
return records.filter(record => (
(statusFilter === 'all' || record.status === statusFilter)
&& (record.prompt.toLowerCase().includes(query)
|| (taskSessionId(record) ?? '').toLowerCase().includes(query)
|| taskName(record).toLowerCase().includes(query))
)).toSorted((left, right) =>
Date.parse(taskNextRunAt(left)) - Date.parse(taskNextRunAt(right)))
}, [records, search, statusFilter])
const rowIndex = useMemo(() => new TextSearchIndex(
records.filter(record => statusFilter === 'all' || record.status === statusFilter)
.toSorted((left, right) => Date.parse(taskNextRunAt(left)) - Date.parse(taskNextRunAt(right))),
record => ({ fuzzy: [taskName(record)], substring: [taskSessionId(record), record.prompt] }),
), [records, statusFilter])
const rows = useMemo(() => rowIndex.search(search), [rowIndex, search])
const emptyTitle = search.trim() !== '' ? 'list.noMatches'
: statusFilter === 'paused' ? 'list.emptyPaused'
@@ -1624,6 +1624,38 @@ describe('time zone menu', () => {
expectSavedRule(h, 'DTSTART;TZID=Europe/Bucharest:20990101T090000\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE')
})
it("keeps the row's own zone when a search names several zones of the row or none alone", () => {
pinSystemZone('UTC')
vi.mocked(Intl.supportedValuesOf).mockReturnValue(['Europe/Athens', 'Europe/Bucharest'])
// The stored zone makes Bucharest the shared row's own zone, while Athens is the row's first zone.
mount([{ ...task, rrule: task.rrule.replace('TZID=UTC', 'TZID=Europe/Bucharest') }])
const detail = openEdit()
// `eur` names both zones; `athens bucharest` names neither zone with both terms.
for (const query of ['eur', 'athens bucharest']) {
openZones(detail)
searchZones(query)
fireEvent.click(screen.getByRole('menuitem', { name: zoneName('Europe/Bucharest', 'UTC', t) }))
expect((JSON.parse(localStorage.getItem(RECENT)!) as string[])[0]).toBe('Europe/Bucharest')
}
})
it('saves the zone a fuzzy or full-width search names inside a shared row', async () => {
pinSystemZone('UTC')
vi.mocked(Intl.supportedValuesOf).mockReturnValue(['Europe/Athens', 'Europe/Bucharest'])
expect(zoneName('Europe/Bucharest', 'UTC', t)).toContain('European')
// The last query's second term matches only the shared label, not a zone id.
for (const query of ['bchrst', 'BUCHAREST', 'bucharest european']) {
const h = mount()
const detail = openEdit()
openZones(detail)
searchZones(query)
fireEvent.click(screen.getByRole('menuitem', { name: zoneName('Europe/Bucharest', 'UTC', t) }))
await save(detail)
expectSavedRule(h, 'DTSTART;TZID=Europe/Bucharest:20990101T090000\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE')
cleanup()
}
})
it('offers the system zone alone without a separator and says when no zone matches', () => {
pinSystemZone('UTC')
mount()
@@ -706,6 +706,11 @@ describe('Task manager catalog', () => {
expect(taskNames()).toEqual([])
fireEvent.change(input, { target: { value: 'numbers' } })
expect(taskNames()).toEqual(['Quarterly report'])
// Names match fuzzily; the long instruction matches only contiguous text.
fireEvent.change(input, { target: { value: 'qrtly' } })
expect(taskNames()).toEqual(['Quarterly report'])
fireEvent.change(input, { target: { value: 'sndnum' } })
expect(taskNames()).toEqual([])
})
it('combines search with the status filter and keeps both behind the empty state action', () => {
@@ -8,6 +8,9 @@
"src"
],
"references": [
{
"path": "../../util/text-search"
},
{
"path": "../../api/session-controller/tsconfig.client.json"
},
@@ -15,8 +15,8 @@
en: c26f81e8adf0128b
zh: e11ab371f51f66bc
/deepseek-ai-dsh-client-ui-settings-account/use-this-package:
en: ece8b18503977bdd
zh: 2d47640fb8367a3d
en: 9e61a6adc39fddbc
zh: fbcb4852ca4eded1
/deepseek-ai-dsh-client-ui-settings-account/use-this-package/desktop-onboarding:
en: 7ae4e68f9491b068
zh: f7478269bf8d28b3
@@ -38,7 +38,7 @@ Account operations carry this UI's client identity to the Host: build version, a
Balances use Platform Web currency formatting: two decimal places and digit grouping, positive amounts truncated to cents, positive sub-cent amounts shown as <0.01, and negative amounts rounded with a minimum displayed magnitude of 0.01. Raw Host balance strings remain unchanged.
Desktop usage, top-up, and onboarding recharge actions open one isolated native Platform view below a 48px return bar. The Desktop host owns a single such view, and opening a page destroys the previous one, so the plugin registers one shared host entry in `shell.overlay` and the Account settings page, the account quota notice, and the Desktop onboarding recharge page all request a page through its `PlatformPages` request channel instead of mounting their own container. Each request retires the previous owner before the newer page shows, and its identity-safe release clears only that request, so a stale owner cannot close a page it no longer owns. On Windows Electron the return bar and the native view start below the Desktop caption strip, so the Application and Edit menu text cannot cover the Back to DeepSeek Harness label. Back destroys the view, restores focus before any deferred Modal takes it, and preserves the Account settings page. Leaving a top-up page waits for any read already running and then reads again, because a top-up may have changed what the account holds. The Account settings page and the account quota notice re-read profile and balance and publish an account refresh for extensions; the onboarding recharge return re-reads profile and balance only. Superseding a page, releasing a request, plugin unload, and leaving usage all read nothing. Loading failures retain the return action and show a centered localized error with Retry. Retry reloads the same destination; renderer commands never receive the account token.
Desktop usage, top-up, and onboarding recharge actions open one isolated native Platform view below a 48px return bar. The Desktop host owns a single such view, and opening a page destroys the previous one, so the plugin registers one shared host entry in `shell.overlay` and the Account settings page, the account quota notice, and the Desktop onboarding recharge page all request a page through its `PlatformPages` request channel instead of mounting their own container. Each request retires the previous owner before the newer page shows, and its identity-safe release clears only that request, so a stale owner cannot close a page it no longer owns. On Windows Electron the return bar and the native view start below the Desktop caption strip, so the Application and Edit menu text cannot cover the Back to DeepSeek Harness label. Back destroys the view, restores focus before any deferred Modal takes it, and preserves the Account settings page. The page layer declares shortcut modal `platform` for the [right sidebar close command](../ui-sidebar-right/README.md). Leaving a top-up page waits for any read already running and then reads again, because a top-up may have changed what the account holds. The Account settings page and the account quota notice re-read profile and balance and publish an account refresh for extensions; the onboarding recharge return re-reads profile and balance only. Superseding a page, releasing a request, plugin unload, and leaving usage all read nothing. Loading failures retain the return action and show a centered localized error with Retry. Retry reloads the same destination; renderer commands never receive the account token.
Chat offers each live quota failure from a bound Session to the frame-wide `shell.quota-notice` chain from its host in `shell.overlay`, so the notice outlives the Chat panel that reported it. The account entry claims `ACCOUNT_QUOTA`: while an account credential is stored and the shared host entry exists, the Modal offers Cancel and Top up. While a page requested through the shared request channel is showing, the native view covers this document, so the entry paints neither the Modal nor the Toast. A quota failure that arrives while a Settings-opened page is already showing is not retained: it stays subject to newest-notice replacement, and the Modal appears after the viewer returns while that notice is still current. That Modal reports the failure of the original request, not the account's current balance: the top-up re-read is a separate read, and returning neither proves a successful payment nor dismisses the notice on its own. The notice's own Top up is the retained case: it calls `keepOpen()` and requests the `top-up` page through the shared request channel, keeping that notice and its page mounted through later quota failures. With the shared host entry the entry waits for the first account snapshot instead of rendering a Toast that its own timer could discard; a snapshot that reports no stored credential, or a failed account stream with no snapshot, then renders the same neutral warning Toast itself, and without that host entry the entry renders that Toast immediately, instead of relying on the chat host fallback. The entry owns the hold and its page request and releases both when it unmounts, so a later quota failure publishes again without replaying the dropped ones; dismissal or sign-out clears the hold and the page request. Close, Cancel, a sign-out, or leaving the notice's own embedded page takes the notice down without retrying the request.
@@ -38,7 +38,7 @@ Desktop 与普通 Web 客户端都挂载侧边栏账号菜单、账号设置、
余额沿用 Platform Web 的金额格式:两位小数和千分位分组,正金额截断至分,小于一分的正金额显示为 <0.01,负金额按舍入规则处理且显示绝对值至少为 0.01。Host 返回的原始余额字符串保持不变。
Desktop 的用量、充值与引导充值操作在 48px 返回栏下方打开同一个隔离的原生 Platform 视图。Desktop 宿主只有一个这样的视图,打开新页面会销毁上一个,因此插件在 `shell.overlay` 注册一个共享宿主条目,Account 设置页、账号欠费提示与 Desktop 引导充值页都通过其 `PlatformPages` 请求通道申请页面,而不再各自挂载容器。新请求会在新页面显示前退掉上一个持有者,其身份安全的释放只清除本次请求,因此过期的持有者无法关闭它已不再持有的页面。在 Windows Electron 中,返回栏与原生视图都从 Desktop 顶栏下方开始,Application 和 Edit 菜单文字不会盖住“返回 DeepSeek Harness”。返回操作销毁视图并保留 Account 设置页,且先恢复焦点,再由任何被延后的 Modal 接管。从充值页返回时会等待任何已在进行的读取结束后再读取,因为充值可能改变账号持有的内容。Account 设置页与账号欠费提示会重读资料、余额,并向扩展发布账号刷新事件;引导充值返回则只重读资料与余额。替换页面、释放请求、插件卸载与从用量页返回均不读取。加载失败时保留返回操作,居中显示本地化错误提示和“重试”按钮。重试重新加载同一目标页面;渲染进程命令不接收账号 token。
Desktop 的用量、充值与引导充值操作在 48px 返回栏下方打开同一个隔离的原生 Platform 视图。Desktop 宿主只有一个这样的视图,打开新页面会销毁上一个,因此插件在 `shell.overlay` 注册一个共享宿主条目,Account 设置页、账号欠费提示与 Desktop 引导充值页都通过其 `PlatformPages` 请求通道申请页面,而不再各自挂载容器。新请求会在新页面显示前退掉上一个持有者,其身份安全的释放只清除本次请求,因此过期的持有者无法关闭它已不再持有的页面。在 Windows Electron 中,返回栏与原生视图都从 Desktop 顶栏下方开始,Application 和 Edit 菜单文字不会盖住“返回 DeepSeek Harness”。返回操作销毁视图并保留 Account 设置页,且先恢复焦点,再由任何被延后的 Modal 接管。页面层为[右栏关闭命令](../ui-sidebar-right/README.zh.md)声明快捷键弹窗 `platform`。从充值页返回时会等待任何已在进行的读取结束后再读取,因为充值可能改变账号持有的内容。Account 设置页与账号欠费提示会重读资料、余额,并向扩展发布账号刷新事件;引导充值返回则只重读资料与余额。替换页面、释放请求、插件卸载与从用量页返回均不读取。加载失败时保留返回操作,居中显示本地化错误提示和“重试”按钮。重试重新加载同一目标页面;渲染进程命令不接收账号 token。
Chat 通过 `shell.overlay` 中的宿主把已绑定 Session 的实时欠费交给全局 `shell.quota-notice` 链,提示的生命周期因此长于上报它的 Chat 面板。账号条目认领 `ACCOUNT_QUOTA`:已存储账号凭证且存在共享宿主条目时,Modal 提供取消和去充值。只要通过该共享请求通道请求的页面正在显示,原生视图就会盖住本页,因此该条目既不绘制 Modal 也不绘制 Toast。在 Account 设置页已打开页面的情况下新到达的欠费不会被保持:它仍受最新提示替换规则约束,返回后若该提示仍是最新一条就显示 Modal。该 Modal 报告的是原始请求的失败,而不是账号当前余额:返回时的重读是一次独立读取,返回本身既不证明支付成功,也不会自动撤下该提示。提示自身的去充值属于被保持的情形:它调用 `keepOpen()` 并通过共享请求通道申请 `top-up` 页面,使该提示与其页面在后续欠费期间保持挂载。存在共享宿主条目时,该条目会等待首个账号快照,而不是渲染一个可能被自身计时器丢弃的 Toast;快照报告未存储凭证,或账号流失败且无快照时,才由该条目自行渲染同一段中立警告 Toast,缺少该宿主条目时则立即渲染该 Toast,而不依赖 Chat 宿主回退。该条目持有保持与页面请求,并在自身卸载时释放二者,因此后续欠费会重新发布而不重放已丢弃的提示;关闭与退出登录也会清除保持和页面请求。关闭、取消、退出登录或离开该提示自己的内嵌页面都会撤下提示,且不会重试请求。
@@ -66,7 +66,8 @@ export function PlatformOverlay({ bridge, page, backLabel, loadingLabel, failure
})
}
}, [bridge, page, attempt])
return createPortal(<div ref={layer} className={css.overlay} role="dialog" aria-modal="true" aria-label={backLabel}>
return createPortal(<div ref={layer} className={css.overlay} role="dialog" aria-modal="true" aria-label={backLabel}
data-shortcut-modal="platform">
<header className={css.header} data-window-drag>
<div className={css.controls}>
<span className={css.trafficLights} aria-hidden="true" />
@@ -309,6 +309,7 @@ it('opens usage inside Desktop and returns to the same Account settings', async
expect(platform.open).toHaveBeenCalledWith('usage', { x: 0, y: 0, width: 0, height: 0 })
const back = screen.getByRole('button', { name: en.backToHarness })
await expect(`${back.parentElement!.parentElement!.textContent}\n`).toMatchFileSnapshot('./expected/platform-header-en.txt')
expect(screen.getByRole('dialog', { name: en.backToHarness }).dataset.shortcutModal).toBe('platform')
await act(async () => { fireEvent.click(back) })
expect(platform.close).toHaveBeenCalledOnce()
expect(screen.queryByRole('button', { name: en.backToHarness })).toBeNull()
@@ -58,7 +58,8 @@
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
"@deepseek-ai/dsh-util-values": "workspace:*",
"@deepseek-ai/dsh-remote-mock": "workspace:*",
"@deepseek-ai/dsh-client-product-analytics": "workspace:*"
"@deepseek-ai/dsh-client-product-analytics": "workspace:*",
"@deepseek-ai/dsh-util-text-search": "workspace:*"
},
"dependencies": {
"@deepseek-ai/schemastery": "workspace:~"
@@ -22,6 +22,7 @@ import { useEffect, useMemo, useState } from 'react'
import type { ReactNode } from 'react'
import type { LlmDiscoveredModel } from '@deepseek-ai/dsh-api-remotes/client'
import { AnimatedRows, Button, IconPlusOutlineRegular, Modal } from '@deepseek-ai/dsh-client-ui-primitives'
import { TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import { formatCapacity, parseCapacity } from './DeepSeekModelsEditor.tsx'
import type { ModelsOperations } from './operations.ts'
import type { DeepSeekModelDraft } from './DeepSeekModelsEditor.tsx'
@@ -251,6 +252,10 @@ export function ModelListEditor(props: ModelListEditorProps): ReactNode {
const isPicked = (id: string): boolean => pickedByDefault(id) !== flipped.has(id)
const activeCandidates = candidates ?? []
const candidateIndex = useMemo(
() => new TextSearchIndex(candidates ?? [], candidate => ({ fuzzy: [candidate.id, candidate.name] })),
[candidates],
)
const listed = new Set(activeCandidates.map(candidate => candidate.id))
// An unchecked candidate leaves the list. A row the listing does not name,
// including a half-typed row without an id, is outside the picker and stays.
@@ -283,11 +288,7 @@ export function ModelListEditor(props: ModelListEditorProps): ReactNode {
})
}
const normalizedCandidateQuery = candidateQuery.trim().toLowerCase()
const visibleCandidates = normalizedCandidateQuery.length === 0
? activeCandidates
: activeCandidates.filter(candidate => candidate.id.toLowerCase().includes(normalizedCandidateQuery)
|| candidate.name?.toLowerCase().includes(normalizedCandidateQuery) === true)
const visibleCandidates = candidateIndex.search(candidateQuery)
const allVisibleCandidatesPicked = visibleCandidates.length > 0
&& visibleCandidates.every(candidate => isPicked(candidate.id))
@@ -8,6 +8,9 @@
"src"
],
"references": [
{
"path": "../../util/text-search"
},
{
"path": "../../host/webserver"
},
@@ -18,8 +18,8 @@
en: 67637808e7940157
zh: d4d0716ea4d33e4a
/deepseek-ai-dsh-client-ui-settings-plugin-inventory/use-this-package/reading-a-card:
en: 3cb7d3a63d5c0fea
zh: d127dfbb58e50e4b
en: 23f533442ed22d44
zh: f2ac59b57878aed1
/deepseek-ai-dsh-client-ui-settings-plugin-inventory/use-this-package/the-preset-switcher:
en: 84e5938329199a22
zh: 6f5cfaac56433e8b
@@ -33,7 +33,7 @@ A failed installation with pending pnpm build permissions offers **Allow these s
Each collapsed card uses the plugin's localized title and description when available; a description shows at most two lines until its card is expanded. Settings shortens literal package-name or module-name fallbacks by removing the npm scope and the `cordis:`, `cordis-plugin-`, or `dsh-`/`dsh-host-`/`dsh-client-` prefix; locale titles remain unchanged. The Host supplies locale and package-field fallbacks in `meta`; the Client selects the current language. Full module specifiers remain available in details and search. Missing descriptions are omitted, and metadata diagnostics appear with the card. This compact naming applies only to Settings, not the sidebar's Plugins page.
A small enablement tag marks only the states that differ from plainly enabled: disabled, conditional, provided by presets, and failed; a plainly enabled row carries no tag. A colored root-fiber status dot marks the live phases no tag states: `pending` maps to idle, while `loading` and `unloading` map to ongoing; an `active` or `failed` fiber shows no dot. The stable entry id appears in a code chip at the card's bottom-left, in line with the title, only when it differs from the title: a composition-generated id drops its leading `include:` marker there, and an id that then repeats the title is omitted. Whenever the chip shows, its hover text and the card's accessible name carry the complete id; search and expanded details always retain it. Long entry ids truncate in the chip and remain available on hover. Expanding one card reveals its full description, the declared entry id, the full module specifier, and the state facts: a preset row names the preset it comes from, its runtime status when the composition is live, and its disable condition when it carries one; a preset-provided global row explains that agent presets provide it per session, names the presets that enable it. Preset names resolve through the shared `presetDisplayText` fold (`dsh-agent-preset-registry/display`) over [`ui-agent-preset`](../ui-agent-preset/README.md)'s dictionaries: shipped presets follow the active locale while user-authored ones keep their own metadata, so an English surface never echoes the preset declarations' Chinese names. Search filters both groups by localized title and description, module name, and entry id.
A small enablement tag marks only the states that differ from plainly enabled: disabled, conditional, provided by presets, and failed; a plainly enabled row carries no tag. A colored root-fiber status dot marks the live phases no tag states: `pending` maps to idle, while `loading` and `unloading` map to ongoing; an `active` or `failed` fiber shows no dot. The stable entry id appears in a code chip at the card's bottom-left, in line with the title, only when it differs from the title: a composition-generated id drops its leading `include:` marker there, and an id that then repeats the title is omitted. Whenever the chip shows, its hover text and the card's accessible name carry the complete id; search and expanded details always retain it. Long entry ids truncate in the chip and remain available on hover. Expanding one card reveals its full description, the declared entry id, the full module specifier, and the state facts: a preset row names the preset it comes from, its runtime status when the composition is live, and its disable condition when it carries one; a preset-provided global row explains that agent presets provide it per session, names the presets that enable it. Preset names resolve through the shared `presetDisplayText` fold (`dsh-agent-preset-registry/display`) over [`ui-agent-preset`](../ui-agent-preset/README.md)'s dictionaries: shipped presets follow the active locale while user-authored ones keep their own metadata, so an English surface never echoes the preset declarations' Chinese names. Search filters both groups through the shared [text search](../../util/text-search/README.md): module name, entry id, and every declared language of the title match fuzzily, and every language of the description matches as a substring.
A card paints its hover surface only where the pointer can hover: a tap answers with the pressed fill, and an expanded card keeps its open surface on every device. The search field takes a 16px face under a coarse pointer, so iOS Safari does not zoom the page for a focused field.
@@ -33,7 +33,7 @@ kind: "package-reference"
每张收起的卡片使用插件可用的本地化标题与描述;描述最多显示两行,展开卡片后显示全文。设置页会缩短字面的包名或模块名回退值,移除 npm scope 以及 `cordis:`、`cordis-plugin-` 或 `dsh-`/`dsh-host-`/`dsh-client-` 前缀;locale 标题保持原样。Host 在 `meta` 中提供 locale 与包字段的回退结果,Client 选择当前语言。详情与搜索仍保留完整模块标识。缺失的描述不显示,元信息诊断随卡片展示。这种短名显示仅用于设置页,不影响侧栏的插件页。
表示启停状态的小标签只标记与普通启用不同的状态:已停用、条件启用、由预设提供与启动失败;普通启用的行不带标签。彩色根 fiber 状态圆点标记没有标签表达的存活阶段:`pending` 映射为 idle,`loading` 与 `unloading` 映射为 ongoing;`active` 或 `failed` fiber 不显示圆点。稳定的条目 id 仅在与标题不同时显示,位于卡片左下角的代码标签中,与标题左对齐:组合生成的 id 在此省略开头的 `include:` 标记,省略后与标题相同的 id 不再重复显示。显示代码标签时,其悬停提示与卡片的无障碍名称带完整 id;搜索与展开详情始终保留完整 id。长条目 id 会在代码标签内截断,悬停时仍可查看完整值。展开卡片后会显示完整描述、声明的条目 id、完整模块标识与状态事实:预设行说明它来自哪个预设、组合存活时的运行状态,以及它携带的禁用条件;被预设提供的全局行说明它由 Agent 预设按会话提供、列出启用它的预设。预设名经共享的 `presetDisplayText` 纯函数(`dsh-agent-preset-registry/display`)叠在 [`ui-agent-preset`](../ui-agent-preset/README.zh.md) 的字典上解析:内置预设走当前语言,用户自建预设保留自己的元数据,因此英文界面不会回显预设声明里的中文名。搜索按本地化标题与描述、模块名称及条目 id 过滤两组。
表示启停状态的小标签只标记与普通启用不同的状态:已停用、条件启用、由预设提供与启动失败;普通启用的行不带标签。彩色根 fiber 状态圆点标记没有标签表达的存活阶段:`pending` 映射为 idle,`loading` 与 `unloading` 映射为 ongoing;`active` 或 `failed` fiber 不显示圆点。稳定的条目 id 仅在与标题不同时显示,位于卡片左下角的代码标签中,与标题左对齐:组合生成的 id 在此省略开头的 `include:` 标记,省略后与标题相同的 id 不再重复显示。显示代码标签时,其悬停提示与卡片的无障碍名称带完整 id;搜索与展开详情始终保留完整 id。长条目 id 会在代码标签内截断,悬停时仍可查看完整值。展开卡片后会显示完整描述、声明的条目 id、完整模块标识与状态事实:预设行说明它来自哪个预设、组合存活时的运行状态,以及它携带的禁用条件;被预设提供的全局行说明它由 Agent 预设按会话提供、列出启用它的预设。预设名经共享的 `presetDisplayText` 纯函数(`dsh-agent-preset-registry/display`)叠在 [`ui-agent-preset`](../ui-agent-preset/README.zh.md) 的字典上解析:内置预设走当前语言,用户自建预设保留自己的元数据,因此英文界面不会回显预设声明里的中文名。搜索通过共享的[文本搜索](../../util/text-search/README.zh.md)过滤两组:模块名称、条目 id 和标题的所有声明语言模糊匹配,描述的所有语言按子串匹配。
卡片只在可悬停的指针下绘制悬停底色:点按以按下填充回馈,展开的卡片在任何设备上保持展开底色。搜索框在粗指针下使用 16px 字号,iOS Safari 不会因聚焦而放大页面。
@@ -62,7 +62,8 @@
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
"@deepseek-ai/dsh-agent-preset-registry": "workspace:*",
"@deepseek-ai/dsh-client-modules": "workspace:*",
"@deepseek-ai/dsh-client-store": "workspace:*"
"@deepseek-ai/dsh-client-store": "workspace:*",
"@deepseek-ai/dsh-util-text-search": "workspace:*"
},
"files": [
"locale/*.json",
@@ -12,6 +12,7 @@ import {
} from '@deepseek-ai/dsh-client-ui-primitives'
import type { StateDotState, TagTone } from '@deepseek-ai/dsh-client-ui-primitives'
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
import { localizedValues, TextSearchIndex, type SearchKeys } from '@deepseek-ai/dsh-util-text-search'
import type { PluginInventoryLocaleKey } from './locales.ts'
import css from './PluginInventorySettingsTab.module.css'
@@ -99,12 +100,12 @@ function pluginText(row: PluginInventoryEntry | AgentPresetRow, resolveText: Plu
}
}
/** Match translated text alongside the row's technical module and entry identities. */
function matches(row: PluginInventoryEntry | AgentPresetRow, normalizedQuery: string, resolveText: PluginInventorySettingsTabInjected['resolveText']): boolean {
if (normalizedQuery.length === 0) return true
const { title, description } = pluginText(row, resolveText)
return [row.moduleName, row.entryId, title, description]
.some(value => value?.toLocaleLowerCase().includes(normalizedQuery))
/** Search text of one row: its module and entry identities and every language of its title and description. */
function searchKeys(row: PluginInventoryEntry | AgentPresetRow): SearchKeys {
return {
fuzzy: [row.moduleName, row.entryId ?? undefined, ...localizedValues(row.meta?.title)],
substring: localizedValues(row.meta?.description),
}
}
/** The roster row shown when the preset switcher has no explicit choice. */
@@ -272,8 +273,7 @@ export function PluginInventorySettingsTab(
return () => { current = false }
}, [list, request])
const normalizedQuery = query.trim().toLocaleLowerCase()
const searching = normalizedQuery.length > 0
const searching = query.trim().length > 0
const snapshot = state.status === 'ready' ? state.snapshot : undefined
const presets = snapshot?.agentPresets ?? []
const selected = presets.find(preset => preset.id === chosenPreset) ?? fallbackPreset(presets)
@@ -293,24 +293,30 @@ export function PluginInventorySettingsTab(
}, [presets])
const entries = snapshot?.entries ?? []
const failedEntries: PluginInventoryEntry[] = []
const regularEntries: PluginInventoryEntry[] = []
for (const entry of entries) {
if (entry.fiberPhase === 'failed') failedEntries.push(entry)
else regularEntries.push(entry)
}
const entryMatch = (entry: PluginInventoryEntry): boolean => matches(entry, normalizedQuery, resolveText)
const rowMatch = (row: AgentPresetRow): boolean => matches(row, normalizedQuery, resolveText)
const filteredFailed = failedEntries.filter(entryMatch)
const filteredRegular = regularEntries.filter(entryMatch)
// One index per list, built when the snapshot changes; typing only searches them.
const indexes = useMemo(() => {
const failed: PluginInventoryEntry[] = []
const regular: PluginInventoryEntry[] = []
for (const entry of snapshot?.entries ?? []) {
if (entry.fiberPhase === 'failed') failed.push(entry)
else regular.push(entry)
}
return {
failed: new TextSearchIndex(failed, searchKeys),
regular: new TextSearchIndex(regular, searchKeys),
presets: (snapshot?.agentPresets ?? []).map(preset => ({ preset, index: new TextSearchIndex(preset.rows, searchKeys) })),
}
}, [snapshot])
const filteredFailed = indexes.failed.search(query)
const filteredRegular = indexes.regular.search(query)
const globalCount = filteredFailed.length + filteredRegular.length
const selectedRows = selected === undefined ? [] : selected.rows.filter(rowMatch)
const otherPresetMatches = searching
? presets.filter(preset => preset !== selected && preset.rows.some(rowMatch))
const selectedRows = indexes.presets.find(({ preset }) => preset === selected)?.index.search(query) ?? []
const otherMatches = searching
? indexes.presets.flatMap(({ preset, index }) => preset === selected ? [] : [{ preset, count: index.search(query).length }])
.filter(match => match.count > 0)
: []
const otherMatchCount = otherPresetMatches
.reduce((total, preset) => total + preset.rows.filter(rowMatch).length, 0)
const otherPresetMatches = otherMatches.map(match => match.preset)
const otherMatchCount = otherMatches.reduce((total, match) => total + match.count, 0)
// The preset group starts open and the larger global plane folded; a search opens both for as long as it lasts.
const presetEffectiveOpen = searching || (presetOpen ?? true)
@@ -228,8 +228,12 @@ describe('PluginInventorySettingsTab', () => {
fireEvent.change(search, { target: { value: '运行会话命令' } })
expect(screen.getAllByRole('listitem')).toHaveLength(1)
expect(screen.getByRole('button', { name: '会话执行器, include:preset-runner, 已启用' })).toBeTruthy()
// The Chinese page still finds the row by its English description.
fireEvent.change(search, { target: { value: 'Run per session' } })
expect(screen.getByRole('button', { name: '会话执行器, include:preset-runner, 已启用' })).toBeTruthy()
fireEvent.change(search, { target: { value: 'no such plugin' } })
expect(screen.getByText(zh.emptySearch)).toBeTruthy()
fireEvent.change(search, { target: { value: 'Run per session' } })
locale.setLocale('en')
view.rerender(<PluginInventorySettingsTab {...pageProps} />)
expect(screen.getByRole('button', { name: 'Session runner, include:preset-runner, Enabled' })).toBeTruthy()
@@ -288,7 +292,9 @@ describe('PluginInventorySettingsTab', () => {
expect(screen.getAllByRole('listitem')).toHaveLength(1)
locale.setLocale('en')
view.rerender(<PluginInventorySettingsTab {...pageProps} />)
expect(screen.getByText(en.emptySearch)).toBeTruthy()
// The English page still finds the row by its Chinese description, shown in English.
expect(screen.getAllByRole('listitem')).toHaveLength(1)
expect(screen.queryByText('中文主题说明。')).toBeNull()
fireEvent.change(screen.getByRole('searchbox', { name: en.search }), { target: { value: '@acme/dsh-theme/client' } })
expect(screen.getAllByRole('listitem')).toHaveLength(1)
expect(screen.getByRole('button', { name: '@acme/dsh-theme, include:theme, Enabled' }).getAttribute('aria-describedby')).toBeNull()
@@ -8,6 +8,9 @@
"src"
],
"references": [
{
"path": "../../util/text-search"
},
{
"path": "../../util/package-manifest"
},
+2 -1
View File
@@ -58,7 +58,8 @@
"@deepseek-ai/dsh-brand": "workspace:*",
"clsx": "^2.1.1",
"react": "^18.2.0",
"@deepseek-ai/dsh-client-test-runtime": "workspace:*"
"@deepseek-ai/dsh-client-test-runtime": "workspace:*",
"@deepseek-ai/dsh-util-text-search": "workspace:*"
},
"files": [
"locale/*.json",
@@ -1,6 +1,7 @@
/** Searchable editable shortcut reference and its General Settings row. */
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { Button, IconCloseOutlineRegular, IconRefreshOutlineRegular, Modal, ShortcutKeys, Tooltip, Toast, focusWithoutRing, isBehindModal, rankByName } from '@deepseek-ai/dsh-client-ui-primitives'
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { Button, IconCloseOutlineRegular, IconRefreshOutlineRegular, Modal, ShortcutKeys, Tooltip, Toast, focusWithoutRing, isBehindModal } from '@deepseek-ai/dsh-client-ui-primitives'
import { TextSearchIndex } from '@deepseek-ai/dsh-util-text-search'
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
import type { ObservableSnapshot, PropsStore } from '@deepseek-ai/dsh-client-store'
import type { ShortcutCatalogEntry, ShortcutPlatform, Shortcuts } from '@deepseek-ai/dsh-client-shortcuts/client'
@@ -133,7 +134,7 @@ export function ShortcutReference({
if (open && input !== null && !isBehindModal(input)) focusWithoutRing(input)
}, [open, focusRequest])
// Stop stays after the other fixed input actions.
const entries = [
const entryIndex = useMemo(() => new TextSearchIndex([
...catalog.map(row => ({
...row,
names: [...row.aliases, row.keys.filter(key => key !== '+').join('+'), row.keys.filter(key => key !== '+').join(''), row.aria ?? '', row.aria?.replace('Meta', 'Cmd') ?? ''],
@@ -142,9 +143,8 @@ export function ShortcutReference({
...fixedCatalog.map(row => ({ ...row, names: [row.id, row.keys.join(' ')] })),
].sort((left, right) => Number(left.id === 'response.stop') - Number(right.id === 'response.stop')
|| (coreActionOrder.get(left.id) ?? coreActionOrder.size) - (coreActionOrder.get(right.id) ?? coreActionOrder.size)
|| Number(left.id > right.id) - Number(left.id < right.id))
const ranked = rankByName(entries.flatMap(row => row.names.map(name => ({ name, label: row.label, row }))), query.trim())
const matches = [...new Set(ranked.map(match => match.row))]
|| Number(left.id > right.id) - Number(left.id < right.id)), row => ({ fuzzy: [row.label, ...row.names] })), [catalog, fixedCatalog])
const matches = entryIndex.search(query)
const modifiedCount = Object.keys(config.document.profiles[`${runtime}:${platform}`] ?? {}).length
useLayoutEffect(() => {
const input = search.current
@@ -8,6 +8,9 @@
"src"
],
"references": [
{
"path": "../../util/text-search"
},
{
"path": "../../../vendor/cordis"
},
@@ -33,8 +33,8 @@
en: ce5622d6d18ed8d1
zh: 292932d8edb6e1c3
/deepseek-ai-dsh-client-ui-sidebar-right/the-tab-domain:
en: 717b86e05b44ebdd
zh: 0f4f694d0ea1d7f8
en: b6c64c7649203e12
zh: c9341bbfd548a5eb
/deepseek-ai-dsh-client-ui-sidebar-right/the-guide:
en: 68fd575ef382223e
zh: 1ab1653ee20c64e9
+1 -1
View File
@@ -113,7 +113,7 @@ A type's `keepMounted: true` retains visited bodies across tab and Session chang
Tab owners register `registerCloseHandler(kind, handler)` through an effect. A handler synchronously retains any background cleanup before allowing explicit close or replacement. The resource owner tracks completion and retry; the sidebar does not wait. A thrown handler preserves the tab. Collapse, presentation changes and plugin disposal do not invoke close handlers; the tab abort signal identifies occurrence disposal, not an explicit close.
Close and refresh commands resolve the focused pane and tab occurrence. Page bodies bind their refresh operation through `tab.actions.bindCommands()` and release it on unmount; ended occurrences cannot regain capabilities. Refresh never reloads the application. Shortcut page opens, sidebar expansion, and all splits focus the selected dock or floating pane after its DOM commits, including singleton reveals and guide replacements. Sidebar expansion focuses the active dock pane; collapse preserves focus inside floating panes. Pane focus preserves existing text selections. If a focused page input or iframe is replaced, focus returns to its visible pane only while no other element owns focus; an outside pointer gesture or explicit blur cancels this restoration. Close checks the captured identity again and uses resource cleanup. After a keyboard or native-menu close, focus moves to a surviving visible pane in the same Session so consecutive close commands continue there. Stale targets and cleanup failures never fall back to closing a window. Modal restrictions follow the [shortcut service](../shortcuts/README.md). The close command first requests the foreground modal’s close action; a modal that declines dismissal, a menu, or an unregistered dialog blocks closing the sidebar or window behind it. Closing the sole docked guide with a shortcut or native menu collapses the sidebar and retains the guide. Desktop requests window closure through the shortcut service only when no modal is open and no sidebar page owns focus; Web leaves the browser open.
Close and refresh commands resolve the focused pane and tab occurrence. Page bodies bind their refresh operation through `tab.actions.bindCommands()` and release it on unmount; ended occurrences cannot regain capabilities. Refresh never reloads the application. Shortcut page opens, sidebar expansion, and all splits focus the selected dock or floating pane after its DOM commits, including singleton reveals and guide replacements. Sidebar expansion focuses the active dock pane; collapse preserves focus inside floating panes. Pane focus preserves existing text selections. If a focused page input or iframe is replaced, focus returns to its visible pane only while no other element owns focus; an outside pointer gesture or explicit blur cancels this restoration. Close checks the captured identity again and uses resource cleanup. After a keyboard or native-menu close, focus moves to a surviving visible pane in the same Session so consecutive close commands continue there. Stale targets and cleanup failures never fall back to closing a window. Modal restrictions follow the [shortcut service](../shortcuts/README.md). The close command first requests the foreground modal’s close action; a modal that declines dismissal, a menu, or an unregistered dialog blocks closing the sidebar or window behind it. Closing the sole docked guide with a shortcut or native menu collapses the sidebar and retains the guide. Desktop requests window closure through the shortcut service only when no modal is open and no sidebar page owns focus, or when the foreground modal is the Desktop Platform page layer (`platform`); Web leaves the browser open.
<a id="the-guide"></a>
## The guide
@@ -113,7 +113,7 @@ Tab 域按(Session,Tab id)保留品牌化 occurrence id、导航、中止
标签页所有者通过 effect 注册 `registerCloseHandler(kind, handler)`。handler 在允许显式关闭或替换前同步保存后台清理任务。资源所有者跟踪完成和重试,侧栏不等待清理。handler 抛错时保留标签页。折叠、展示方式改变和插件卸载不调用关闭 handler;tab abort signal 标识 occurrence 卸载,不代表显式关闭。
关闭与刷新命令解析聚焦 pane 和 tab occurrence。页面通过 `tab.actions.bindCommands()` 绑定刷新操作,并在卸载时释放;已结束的 occurrence 不能重新获得能力。刷新不会重载应用。通过快捷键打开页面、展开侧栏或执行分栏操作后,焦点在 DOM 提交后移至选中的停靠或浮动分栏,包括显示已有单例页面和替换引导页。展开侧栏时聚焦活动停靠分栏;收起时保留浮动分栏内的焦点。分栏获得焦点时保留现有文本选区。聚焦的页面输入框或 iframe 被替换时,仅在没有其他元素持有焦点的情况下将焦点交还其可见分栏;外部指针操作或显式失焦会取消此次恢复。关闭会再次检查捕获的身份并执行资源清理。通过快捷键或原生菜单关闭后,焦点移至同一 Session 中仍可见的分栏,让连续关闭继续作用于右栏。过期目标和清理失败均不会回退为关窗。模态限制遵循[快捷键服务](../shortcuts/README.zh.md)。关闭命令优先请求前台弹窗的关闭操作;弹窗拒绝关闭、菜单或未注册的对话框都会阻止关闭后方侧栏或窗口。通过快捷键或原生菜单关闭唯一的停靠引导页时,收起右栏并保留引导页。Desktop 仅在没有弹窗且焦点没有所属的右栏页面时通过快捷键服务请求关闭窗口;Web 保留浏览器窗口。
关闭与刷新命令解析聚焦 pane 和 tab occurrence。页面通过 `tab.actions.bindCommands()` 绑定刷新操作,并在卸载时释放;已结束的 occurrence 不能重新获得能力。刷新不会重载应用。通过快捷键打开页面、展开侧栏或执行分栏操作后,焦点在 DOM 提交后移至选中的停靠或浮动分栏,包括显示已有单例页面和替换引导页。展开侧栏时聚焦活动停靠分栏;收起时保留浮动分栏内的焦点。分栏获得焦点时保留现有文本选区。聚焦的页面输入框或 iframe 被替换时,仅在没有其他元素持有焦点的情况下将焦点交还其可见分栏;外部指针操作或显式失焦会取消此次恢复。关闭会再次检查捕获的身份并执行资源清理。通过快捷键或原生菜单关闭后,焦点移至同一 Session 中仍可见的分栏,让连续关闭继续作用于右栏。过期目标和清理失败均不会回退为关窗。模态限制遵循[快捷键服务](../shortcuts/README.zh.md)。关闭命令优先请求前台弹窗的关闭操作;弹窗拒绝关闭、菜单或未注册的对话框都会阻止关闭后方侧栏或窗口。通过快捷键或原生菜单关闭唯一的停靠引导页时,收起右栏并保留引导页。Desktop 仅在没有弹窗且焦点没有所属的右栏页面时,或前台弹窗为 Desktop Platform 页面层(`platform`)时,通过快捷键服务请求关闭窗口;Web 保留浏览器窗口。
<a id="the-guide"></a>
## 引导页
@@ -69,9 +69,10 @@ export function registerSidebarShortcuts(shortcuts: Pick<Shortcuts, 'register' |
id: `page.${kind}` as ShortcutCommandId, label: () => t(`command.${kind}`), aliases: [kind, 'page'],
defaults: { 'desktop:macos': desktop, 'desktop:windows': desktop, 'desktop:linux': desktop,
'web:windows': web, ...(kind === 'close' ? { 'web:macos': web } : {}) },
regions: ['page', 'editable', 'terminal'], modals: kind === 'close' ? ['settings', 'shortcuts', 'other'] : [],
regions: ['page', 'editable', 'terminal'], modals: kind === 'close' ? ['settings', 'shortcuts', 'platform', 'other'] : [],
resolve: ({ target: element, source, modal }) => {
if (kind === 'close' && modal !== null) {
// The Platform page layer registers no close action, so Close page acts as on a page and Desktop closes the window.
if (kind === 'close' && modal !== null && modal !== 'platform') {
return { status: 'handled', run: () => { closeTopModal(document) } }
}
const target = sidebar.focusedTarget(element)
@@ -12,6 +12,8 @@ import { createSidebarRightController } from '../src/client/service.ts'
import { createSidebarRightStore } from '../src/client/stores.ts'
import { SidebarRightTabRegistry } from '../src/client/tab-registry.ts'
import { ShortcutRegistry } from '@deepseek-ai/dsh-client-shortcuts/src/client/registry.ts'
import { installNativeKeyboard } from '@deepseek-ai/dsh-client-shortcuts/src/client/native.ts'
import type { DesktopShortcutInput } from '@deepseek-ai/dsh-client-shortcuts/protocol'
import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
import { registerSidebarShortcuts } from '../src/client/shortcuts.ts'
import { en } from '../src/client/locales.ts'
@@ -608,6 +610,24 @@ describe('page close and refresh', () => {
expect(h.layout().expanded).toBe(true)
})
it.each(['macos', 'windows', 'linux'] as const)('closes the window from the Platform page above Settings on %s', (platform) => {
const h = harness()
const registry = new ShortcutRegistry('desktop', platform)
const closeWindow = vi.fn(), closeModal = vi.fn()
releases.push(registerSidebarShortcuts({ register: command => registry.register(command), runtime: 'desktop' }, h.controller, makeTranslate(en), closeWindow))
render(createElement(Modal, { open: true, title: 'Settings', shortcutModal: 'settings', closeLabel: 'Close', onClose: closeModal }))
render(createElement('div', { role: 'dialog', 'aria-modal': 'true', 'data-shortcut-modal': 'platform' }))
let deliver: (input: DesktopShortcutInput) => void = () => {}
releases.push(installNativeKeyboard(window, { subscribe: (listener) => { deliver = listener; return () => {} }, closeWindow: vi.fn() },
registry, () => registry.config.getSnapshot()))
const revision = registry.config.getSnapshot().revision
deliver({ kind: 'keyboard', frameName: '', revision, code: 'KeyW', control: platform !== 'macos', alt: false, shift: false,
meta: platform === 'macos', repeat: false })
deliver({ kind: 'menu', commandId: 'page.close' as ShortcutCommandId, revision })
expect(closeWindow).toHaveBeenCalledTimes(2)
expect(closeModal).not.toHaveBeenCalled()
})
it('preserves a page when cleanup fails and never falls back to closing the window', () => {
const h = harness()
h.controller.openTab('terminal')
+2 -2
View File
@@ -18,8 +18,8 @@
en: 2f17d0875048ef3c
zh: 6878ee4c75f2b2cf
/deepseek-ai-dsh-client-ui-skill/use-this-package/what-the-source-offers:
en: 2ba1a6158c85b46e
zh: 9ab58ceef8743849
en: fa23ec0de0463e30
zh: 1772d637d96843b6
/deepseek-ai-dsh-client-ui-skill/use-this-package/the-skill-tool-row:
en: 270bc37a226ed247
zh: 15a1c4c82c3a1f00
+1 -1
View File
@@ -29,7 +29,7 @@ Type `/` in the composer and pick a skill from the suggestions, or type `/name`
### What the source offers
Ordinary-session candidates come from the `skills/list` Remote; the host serves every user-invocable skill, and a `modelInvocable: false` entry (a `disable-model-invocation` skill, whose only entry point is this path) wears the user-only marker as a description prefix in the active language. Results rank through the `/` menu's shared name ranker, `rankByName` from ui-primitives: the query matches a case-insensitive ordered subsequence of the skill name, prefix hits rank first, and ties keep the host order ([ranking decision](../../../.agents/notes/archived/feature/2026-08-04-web-slash-command-fuzzy-discovery.md)). A failed `skills/list` call is logged and folded into a silent menu-group drop — the menu shows only pending/ready states.
Ordinary-session candidates come from the `skills/list` Remote; the host serves every user-invocable skill, and a `modelInvocable: false` entry (a `disable-model-invocation` skill, whose only entry point is this path) wears the user-only marker as a description prefix in the active language. Results filter through the same [text search](../../util/text-search/README.md) as the command group: the skill name matches fuzzily and ties keep the host order. Descriptions do not match, because the `/` menu highlights its first row across all groups and a description hit in an earlier group would take Enter from the skill the user named. A failed `skills/list` call is logged and folded into a silent menu-group drop — the menu shows only pending/ready states.
### The skill tool row
Loaded 100 of 166 files, more files were not shown because too many files have changed in this diff. Show more