Skip to content
dsh.fish
Bundle

@dsh-external/ui-plugin-manager

Manage third-party plugins from the Plugins settings page

Source
xiyue718
License
BSD-3-Clause
Updated
Updated 13 hours ago

Readme

[中文](./README.md) | [English](./README_EN.md)

# @dsh-external/ui-plugin-manager

## 介绍

`ui-plugin-manager` 是 DSH Web 客户端的“插件管理”插件。它在“设置 → 插件”页面中新增“插件管理”导航标签,用于查看和管理所有已安装的、非系统自带的第三方插件,支持启用/禁用和卸载。

## 安装

### dsh 命令安装(项目官方方式)

如果你已安装 `dsh` CLI,可以按项目官方教程使用 `dsh plugin` 命令安装:

```bash
# 从本地插件目录安装
dsh plugin --profile web add C:/Users/<user>/.dsh/plugins/ui-plugin-manager

# 或从 GitHub 仓库安装
dsh plugin --profile web add github:xiyue718/dsh-ui-plugin-manager
```

安装后启动:

```bash
dsh --profile web
```

查看组合配置:

```bash
dsh --profile web --dump-config
```

详细命令说明见项目文档:`docs/user/develop/basic/publish.md`。

构建产物:host 为**自包含**的 `lib/index.js`,client 为 `lib/client.js`,打包文件为 `dsh-external-ui-plugin-manager-0.1.0.tgz`。

安装前先构建一次:`DSH_CHECKOUT=<dsh 源码 checkout> bash scripts/build.sh`。官方渠道把插件装进 profile 后,宿主只从插件自身目录解析运行期依赖,所以 host 半由 tsdown 打包成自包含模块(内联 schemastery、zod 与 `@deepseek-ai/dsh-*` helper);未打包的 `lib/index.js` 会让该行以 `failed to import` 停用。

## 使用

1. 打开 DSH Web 设置。
2. 进入“插件”页面。
3. 切换到“插件管理”标签。
4. 查看第三方插件列表。
5. 使用搜索框按名称、Entry ID、作者筛选。
6. 点击“启用/禁用”切换插件状态,或点击“卸载”移除插件。
7. 列表会自动刷新并显示操作结果。

## 功能

- 查看第三方插件列表:
  - 插件模块名
  - Loader Entry ID
  - 版本
  - 作者
  - 启用/禁用状态
  - 当前 Fiber 状态
- 启用 / 禁用插件:通过 Loader 动态更新,立即生效,无需重启。
- 卸载插件:从当前 Loader 运行时移除。
- 搜索:按插件名称、Entry ID、作者筛选。
- 操作反馈:操作完成后自动刷新列表,并显示成功或失败提示。
- 与系统插件的关系:只列出并管理第三方插件;`@deepseek-ai/*`、`cordis:*`、`deepseek-harness/packages/*`、`deepseek-harness/vendor/*` 等系统内置条目会被过滤,不会出现在列表中,也不会被误操作。
- 安全说明:卸载操作会弹出确认框;如果插件是通过超级模组注入器注入的,重启后可能由超级模组自动恢复,如需永久卸载请使用 `dev_uninject_plugin`。
- 本插件没有提供配置表单入口;需要配置的插件仍可继续使用原“配置”标签页。

### Host API

```http
GET /@dsh-external/ui-plugin-manager/api/plugins
```

```http
POST /@dsh-external/ui-plugin-manager/api/toggle
Content-Type: application/json

{ "entryId": "xxx", "enabled": false }
```

```http
POST /@dsh-external/ui-plugin-manager/api/uninstall
Content-Type: application/json

{ "entryId": "xxx" }
```

## 原理

插件由 host 和 client 两部分组成。

Host 侧通过 `loader.entries()` 获取当前 Loader 的全部插件条目,再根据模块名过滤系统内置插件,只保留第三方插件。为了显示版本和作者,插件会从 profile `node_modules`、`DSH_HOME/plugins` 或 Loader base URL 解析对应包的 `package.json`。启用/禁用调用 `loader.update(entry.id, { disabled: !enabled })`,卸载调用 `loader.remove(entry.id)`,两者都立即作用于当前运行实例。

Client 侧在“设置 → 插件”中注册“插件管理”标签,通过 Host API 获取列表并渲染,操作时调用对应接口并展示项目内置反馈。

Install

dsh plugin --profile web add github:xiyue718/dsh-ui-plugin-manager

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source