Back to home

Fiker1203

dsh-plugin-renamer

DSH Web UI 插件改名器:解决 plugin-switch 插件清单里插件名雷同不好分辨的问题,自动提取每个插件的说明并支持自定义别名(友好名),可与 plugin-switch 搭配使用。| Friendly user-editable names for the DSH plugin inventory, fixing duplicate-looking names in plugin-switch.

Stars
1
Language
JavaScript
Created
Aug 16, 2026
Updated
Aug 16, 2026

Introduction

dsh-plugin-renamer — DSH 插件改名器

让 DSH Web UI 的插件清单显示友好名称:自动从每个插件包的 package.json 提取 description,并允许用户自定义别名;显示层映射,不删除、不改变底层插件。

解决什么问题: 使用 plugin-switch 时,插件清单里很多插件名是雷同的模块名/条目 ID(如一堆 dsh-xxx),光靠默认名称很难分辨哪个是哪个。本插件给每个插件显示易读的友好名,并可自定义别名(如「插件开关」「插件市场」),让你一眼认出每个插件;还能直接复用 plugin-switch 的开关做启停,两者互补使用。

功能

  • 新增独立设置页标签「插件改名器」(id: renamer),以卡片形式展示:
    • 友好名(自定义别名 > package.json description > 模块名 > 条目 ID)
    • 模块名、条目短 ID、启用/停用状态
    • 搜索(别名 / 模块名 / 条目 ID)与筛选(全部 / 已启用 / 已停用)
  • 别名编辑:每条插件可保存自定义别名;留空保存或「恢复自动名」后回落到自动提取的名字
  • 别名持久化:浏览器 localStorage(key: dsh.pluginRenamer.aliases.v1
  • 一键启用/停用:复用 dsh-profile-plugin-switch/plugin-switch/toggle 接口;未安装 plugin-switch 时开关不可用但列表仍可浏览
  • 显示层兼容:以 700ms 间隔把 plugin-switch 原始清单中的 .psw-title(条目 ID)和模块名详情替换为友好名(React 重渲染后会自动再次替换)

安装

从 GitHub 安装(推荐):

dsh plugin --profile web add github:Fiker1203/dsh-plugin-renamer

本地开发时也可直接指定路径安装:

dsh plugin --profile web add C:/path/to/dsh-plugin-renamer

然后重启 Web UI 并刷新浏览器(Ctrl+Shift+R)。

写代码阶段不需要安装;本地安装/写入 profile 需要用户把权限调为 full access(danger-full-access)。

结构

dsh-plugin-renamer/
├─ package.json        # dsh.bundle + dsh.client 声明
├─ cordis.patch.yml    # 仅插入 plugin-renamer 条目,不 disable 任何插件
├─ index.js            # host:GET /plugin-renamer/list(读取 loader 条目 + package.json description)
├─ client.js           # browser:设置页标签 UI + localStorage 别名 + plugin-switch 显示层重写
└─ README.md

接口

GET /plugin-renamer/list

返回:

{
  "ok": true,
  "value": {
    "entries": [
      {
        "entryId": "...:dsh-profile-plugin-switch",
        "moduleName": "dsh-profile-plugin-switch",
        "enabled": true,
        "description": "DeepSeek Harness (DSH) web plugin: toggle any plugin on/off from the GUI, live, without restarting the server."
      }
    ],
    "switchAvailable": true,
    "switchEntryId": "plugin-switch"
  }
}
  • description 读取自 profile node_modules/<模块名>/package.json;读取失败为 null
  • switchAvailable 表示 loader 中是否存在 plugin-switch 条目,客户端据此决定是否渲染开关

与 plugin-switch 的兼容性

  • 不改写 cordis.patch.yml,不注册 id 为 all 的 tab,因此不会与 plugin-switch 争夺清单页
  • 开关动作直接 POST /plugin-switch/toggle,写配置与备份仍由 plugin-switch 统一负责,避免双写冲突
  • 显示层替换采用定时 DOM 重写,属于尽力而为的显示层;不影响 plugin-switch 的逻辑与持久化

开发验证

node test.mjs   # host 路由与 package.json description 提取冒烟测试
node --check index.js client.js

未安装到 profile 前,host 的 resolveNodeModulesDirs() 会优先使用 DSH_HOME(默认 ~/.dsh)下的 profiles/web/node_modules,因此本地路径安装(symlink)时也能读取到 profile 内各插件的 package.json

已知限制:plugin-switch 原始清单的搜索框仍按原始条目 ID / 模块名匹配;本插件自己的标签页已支持按别名/友好名搜索。原始清单标题与模块名详情会尽量替换为友好名,但 React 重渲染后需等待下一次间隔(约 700ms)才会恢复替换。

内置中文名

client.js 内置了一份 BUILTIN_ALIASES(源码:zh-names.json),为当前 profile 中 178 个插件条目提供默认中文名,例如:

  • @dsh-external/dsh-client-ui-skin-maid-atelier → 鲸鱼娘女仆主题
  • @linxin666/dsh-pet → 鲸鱼娘宠物
  • dsh-profile-plugin-switch → 插件开关
  • dsh-plugin-renamer → 插件改名器
  • dshmarket → 插件市场
  • dsh-vision-router → 视觉路由
  • @linxin666/dsh-ssh → SSH 远程操作
  • @linxin666/dsh-live-stats → 实时 Token 统计
  • @linxin666/dsh-task-board 等 → 任务看板 / Git 图形 / AionUI 右侧面板 / 手机远程控制 / 皮肤中心 / 梁神预设 / 图像描述工具
  • 系统条目统一为「会话存储服务」「Web 服务器」「插件清单(只读投影)」等清晰中文名

用户自定义别名仍优先于内置中文名。修改 zh-names.json 后,需要同步更新 client.js 内嵌的 BUILTIN_ALIASES