Bundle
@jarvan642/dsh-hotswap
🔥 Hot-swap plugin manager for DeepSeek Harness — install, unload, enable, disable plugins without restarting DSH.
- Source
- jarvan642
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 5 days ago
Readme
# 🔥 dsh-hotswap — 从此告别重启!
> **DSH 插件的「即插即用」革命**
> 安装、卸载、启用、禁用插件,**全部无需重启 DSH**。
> 就像 USB 热插拔一样自然,一样优雅。
<p align="center">
<img src="https://img.shields.io/github/stars/jarvan642/dsh-hotswap?style=social" alt="stars">
<img src="https://img.shields.io/badge/dsh-plugin-blue?style=flat-square&logo=deepseek" alt="dsh-plugin">
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="license">
</p>
---
## ✨ 为什么你需要它?
传统的 DSH 插件工作流:
```
安装插件 → 重启 DSH → 试一下 → 不好用 → 卸载 → 再重启 DSH → 崩溃
```
**有了 dsh-hotswap:**
```
pnpm add 某插件 → 立刻生效 🎉 不满意 → pnpm remove → 瞬间消失
```
**零等待、零中断、零重启。**
---
## 🚀 一分钟上手
### 🤖 AI 时代玩法(推荐)
直接把 GitHub 链接甩给你的 AI:
```
https://github.com/jarvan642/dsh-hotswap
```
AI 会自动读源码、自动帮你装好,你只需要说一句"帮我安装这个插件"。
### 🧑💻 手动安装
# 1. 安装 dsh-hotswap(仅需重启一次)
cd ~/.dsh/profiles/web
pnpm add github:jarvan642/dsh-hotswap
# 2. 手动注册到 cordis.patch.yml(用 cat 代替 echo 确保格式正确)
cat >> cordis.patch.yml << 'EOF'
- insert:
- id: dsh-hotswap
name: 'dsh-hotswap'
EOF
# 3. 重启 DSH(仅此一次!)
# 按 Ctrl+C 停掉 DSH,然后重新启动
# 4. 从此以后——所有插件都是热插拔!
pnpm add @linxin666/dsh-pet # 装个桌面宠物?即刻生效 🐾
pnpm add @deepseek-ai/dsh-tools # 装个工具包?即装即用 🔧
pnpm remove dsh-pet # 不喜欢了?瞬间卸载 💨
```
> ⚡ **实测验证**:安装 `@linxin666/dsh-pet` 宠物插件,无需重启,立即可见!
---
## 🎯 核心能力
| 操作 | 传统 DSH | 有了 dsh-hotswap |
|------|---------|-----------------|
| 安装插件 | ⏳ 重启等待 | ⚡ **即刻生效** |
| 卸载插件 | ⏳ 重启等待 | ⚡ **瞬间消失** |
| 启用/禁用 | ⏳ 重启等待 | ⚡ **一键切换** |
| 更新插件 | ⏳ 重启等待 | ⚡ **热重载** |
| 调试开发 | 😫 改一行重启一次 | 😎 **改完即用** |
---
## 🔬 工作原理
dsh-hotswap 深度集成 DSH 底层的 Cordis 框架,通过三项核心技术实现真·热插拔:
```
┌─────────────────────────────────────────────┐
│ dsh-hotswap 🔥 │
│ │
│ 📡 ProfileWatcher ⚡ Cordis Loader API │
│ ───────────────── ─────────────────── │
│ 监听 package.json │ 运行时创建/销毁 │
│ 自动发现变更 │ Loader Entry │
│ 防抖批量处理 │ 完整生命周期管理 │
│ │
│ 🔗 PluginRegistry 🛡️ 依赖追踪 │
│ ──────────────── ────────────────── │
│ 记录所有插件状态 │ 防止卸载被依赖插件 │
│ 维护依赖关系图 │ 安全回滚机制 │
└─────────────────────────────────────────────┘
```
**一句话**:你装插件,它自动加载;你卸插件,它自动清理。全程不需要碰 DSH 的重启按钮。
---
## 📦 安装
```bash
# 前置条件:DSH >= 0.1.0-rc.5, Node.js >= 22.19
cd ~/.dsh/profiles/web
pnpm add dsh-hotswap
# 手动注册(后续版本将支持一键注册)
echo "- insert:" >> cordis.patch.yml
echo " - id: dsh-hotswap" >> cordis.patch.yml
echo " name: 'dsh-hotswap'" >> cordis.patch.yml
# 重启 DSH(仅首次需要)
```
---
## 📖 详细用法
### 热安装一个插件
```bash
# 从 npm 安装
pnpm add 某插件
# dsh-hotswap 自动检测 → 自动加载 → 即时生效!
# 无需任何额外操作 🎯
```
### 热卸载一个插件
```bash
pnpm remove 某插件
# 自动卸载 → 清理资源 → 瞬间完成 💨
```
### 查看热插拔状态
```bash
# 通过 DSH 插件列表查看
dsh plugin list
# 或者在 Web UI 的设置页面查看
```
---
## 🏗️ 适用场景
| 场景 | 效果 | 体验 |
|-----|------|------|
| 🧪 插件开发调试 | 改代码 → 重装 → 立即生效 | 😎 爽 |
| 🔌 试用新插件 | `pnpm add` → 马上用 | ⚡ 快 |
| 🧹 清理不需要的插件 | `pnpm remove` → 立刻消失 | 🧼 干净 |
| 🔄 批量更新插件 | 一个个装/卸,零中断 | 🚀 丝滑 |
| 🐛 插件出问题 | 秒卸,不影响正在进行的对话 | 🛡️ 安全 |
---
## ⚠️ 已知限制
- **带前端 UI 的插件**(桌面宠物、主题皮肤等):首次安装后需刷新页面才能看到 UI
- **核心服务插件**(修改 LLM 路由、session 持久化等):仍需重启
- **dsh-hotswap 自身**:第一个安装时需要重启一次(之后所有插件都不需要了)
---
## 🧑💻 开发者说
> "装个插件还要重启?那是上个时代的事了。"
> —— dsh-hotswap,为 DSH 生态带来真正的即插即用体验。
---
## ⭐ 支持项目
如果 dsh-hotswap 帮到了你,请给个 Star ⭐ 让更多人知道!
- [提交 Issue](https://github.com/jarvan642/dsh-hotswap/issues)
- [在 DSH 社区讨论](https://github.com/deepseek-ai/deepseek-harness/discussions)
---
## 📄 许可证
MIT © [Jarvan](https://github.com/jarvan642)Install
dsh plugin --profile web add github:jarvan642/dsh-hotswap
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install jarvan642-dsh-hotswap from the hub
- 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.