DSH 插件描述扩展:给 Web 插件列表补上中英文说明

前言

在 DSH 的 Web 设置中,插件列表页可能列出较多模块,单个卡片不一定能直接说明其用途。下面介绍 dsh-plugin-description:它为 Web 设置中的插件列表页添加中英文功能说明,并发布 pluginDescriptions 服务,供同一 DSH 进程内的 Host 侧插件注册或覆盖说明。

这是什么

dsh-plugin-description 是一个 DeepSeek Harness 组合插件,维护者为 MysaDC,许可证为 MIT

它面向可正常运行的 DeepSeek Harness Web profile。安装后,它会在 Web 设置的插件列表页中为插件卡片补充说明,并提供 pluginDescriptions 服务与 GET /plugin-descriptions 数据端点。

它声明 dsh.bundle 补丁 cordis.patch.ymldsh plugin add 安装后自动插入组合行:同一行会进入宿主组合的 Node part 与浏览器插件名册的 Client part,DSH 每次启动自动挂载,不需要手动改写组合文件。

核心功能

  • 在 Web 设置的插件列表页中,为每张插件卡片显示中英文功能说明。
  • 展开卡片可查看完整说明、Loader 条目 id、配置状态与 Cordis 挂载状态。
  • 发布 pluginDescriptions 服务,供同一 DSH 进程内的 Host 侧插件注册或覆盖说明。
  • 提供 GET /plugin-descriptions 数据端点。
  • 内置覆盖 DSH 出厂组合全部 134 个模块名的说明字典。
  • 搜索框同时匹配插件名、Loader 条目 id 与说明文字,并随界面语言 zh/en 切换。
  • 支持在页面中「编辑说明」,可保存自定义说明、只改当前卡片或恢复默认。
  • 用户自定义说明会持久化到 <DSH_HOME>/plugin-descriptions.json
  • 支持从 GitHub Release、GitHub 仓库/tag、link 或手动方式安装。

安装与启用

安装前需要一个可正常运行的 DeepSeek Harness Web profile。dsh plugin 依赖 pnpm

如果 pnpm 提示:

ERR_PNPM_ADDING_TO_ROOT

可以在 profile 目录的 .npmrc 中添加:

ignore-workspace-root-check=true

然后重试安装命令。

从 GitHub Release 安装

默认安装最新 Release 的安装件:

npx @deepseek-ai/dsh plugin --profile web add https://github.com/MysaDC/dsh-plugin-description/releases/latest/download/dsh-plugin-description.tgz

上面的命令不带版本号,指向 releases/latest/download 下的固定名安装件。以后升级时重跑同一命令即可。

如果需要固定版本,可以使用具体版本安装件。下面是资料中的版本示例:

npx @deepseek-ai/dsh plugin --profile web add https://github.com/MysaDC/dsh-plugin-description/releases/download/v1.2.1/dsh-plugin-description-1.2.1.tgz

从 Git 安装

安装默认分支的最新代码:

npx @deepseek-ai/dsh plugin --profile web add github:MysaDC/dsh-plugin-description

安装固定 tag:

npx @deepseek-ai/dsh plugin --profile web add github:MysaDC/dsh-plugin-description#v1.2.1

验证安装

安装后启动 Web:

npx @deepseek-ai/dsh web

也可以查看 profile 配置中是否出现 plugin-description

npx @deepseek-ai/dsh web --dump-config | grep -n "plugin-description"

如果命令输出中出现 plugin-description,并且「设置 → 插件 → 插件列表」中的卡片带说明,即表示已加载。

升级与卸载

升级到最新 Release 安装件,可以重跑安装命令:

npx @deepseek-ai/dsh plugin --profile web add https://github.com/MysaDC/dsh-plugin-description/releases/latest/download/dsh-plugin-description.tgz

卸载插件:

npx @deepseek-ai/dsh plugin --profile web remove dsh-plugin-description

卸载后会移除相关依赖与 bundle 层,组合文件不会被改写。随后重启:

npx @deepseek-ai/dsh web

典型用法

在页面中编辑说明

  1. 打开「设置 → 插件 → 插件列表」。
  2. 展开任意插件卡片,点击「编辑说明」。
  3. 填写中文和英文说明,点击「保存」。

默认情况下,同名插件的所有卡片一起更新;如果勾选「只改当前卡片」,则只更新当前这张卡片。被自定义过的卡片会显示「已自定义」徽标,编辑态中点击「恢复默认」可退回内置说明。

用户自定义说明会保存到:

<DSH_HOME>/plugin-descriptions.json

该文件与 settings.yaml 同级。升级、重装插件不会丢失自定义说明,也可以直接用文本编辑器修改该文件,重新打开页面后生效。

示例结构:

{
  "modules": { "@your-scope/your-plugin": { "zh": "中文说明", "en": "English description" } },
  "entries": { "your-row-id": { "zh": "只改这一张卡片的说明" } }
}

说明的最终优先级为:

用户字典 > 插件运行时注册 > 内置特殊条目 > 内置字典

出于安全考虑,页面中的写操作只接受本机回环地址请求,与 DSH 设置 API 同级约束。

让其他插件注册自己的说明

本插件的 Host 半会在宿主组合中发布 pluginDescriptions 服务。同一 DSH 进程内的 Host 侧插件可以读取该服务,并注册自己的说明。

示例:

return {
  apply(ctx) {
    const descriptions = ctx.get('pluginDescriptions');
    if (descriptions === undefined) return;

    ctx.effect(() => descriptions.register([
      {
        moduleName: '@your-scope/your-plugin',
        zh: '你的插件的中文说明。',
        en: 'English description.'
      },
      {
        entryId: 'your-row-id',
        zh: '针对特定条目 id 的说明。'
      }
    ]))
  },
}

接入要点:

  • register(entries) 接收 { moduleName?, entryId?, zh, en? } 数组。
  • register(entries) 返回一个 disposer,可精确撤销本次注册的条目。
  • 将注册逻辑放进 ctx.effect,随插件 fiber 生命周期清理。
  • resolve(moduleName, entryId)entryIdmoduleName 的顺序查询注册表。
  • 其他插件读取 pluginDescriptions 时必须判空。
  • 如果希望作为硬依赖,可以声明:
inject: ['pluginDescriptions']

此时 Cordis 会在服务出现前挂起插件。

适用场景与注意

适合在以下场景使用:

  • 需要在 DSH Web 插件列表页快速理解每个插件模块的作用。
  • 希望为同一插件的多个 Loader 条目配置不同说明。
  • 希望其他 Host 侧插件通过统一服务注册自己的说明。
  • 希望保留一份可持久化的用户说明字典,升级插件后不丢失自定义内容。

使用前注意:

  • 需要可正常运行的 DeepSeek Harness Web profile。
  • dsh plugin 依赖 pnpm
  • 它会作为 DSH 组合插件在 DSH 进程中运行,安装前建议按自身安全策略检查源码、依赖与许可证。
  • 本插件只做可选服务读取,没有硬注入依赖。如果确实出现浏览器页白屏或启动失败,可以把组合行设置为:
disabled: true

以排除该组合行。

内置说明字典提取自 DeepSeek Harness 各官方包 README 首段,并经过人工校对;个别条目有专属说明。

链接

已核实资料中未提供目录页地址。GitHub 仓库地址如下:

https://github.com/MysaDC/dsh-plugin-description
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye