Install
Inside DeepSeek Harness, with dsh-market
dsh plugin --profile web add dshmarket
Or from the command line
dsh plugin --profile web add @just-ai/dsh-auto-update
Installing runs third-party code with your own permissions — it can read your files, use your credentials and reach the network. Review the source first, and pin a commit (github:owner/repo#sha) when you can.
README
This plugin publishes its README in Chinese only.
自动检测最新DeepSeek Harness版本, 显示当前版本号, 并提供一键升级按钮。
功能
dsh plugin add安装后立即热加载生效,无需重启 dsh。- 加载时立即检查一次,之后每 30 分钟检查当前 dsh 版本与官方最新版本。
- 在 dsh web 左下角「设置」按钮内、靠右,以小号灰色字体显示当前运行版本。
- 检测到最新版高于当前版时,在版本号右侧显示蓝色「更新」按钮(蓝底黑字)。
点击后按钮变为 loading spinner,后台执行
npm install -g安装最新版; 安装完成后按钮文字变为「重启」。 - 点击「重启」后,开启独立子进程:先关闭占用 3080 端口的进程,再以
dsh web --no-open重启,日志追加写入~/dsh.log(Windows 写%USERPROFILE%\dsh.log)。
安装
从 npm 安装:
dsh plugin --profile web add @just-ai/dsh-auto-update
从本地安装(从仓库根目录执行):
dsh plugin --profile web add ./plugins/dsh-auto-update
兼容性
本插件要求 dsh >= 0.2.0-rc.2。该要求在 package.json 的 engines.dsh 中声明:
"engines": {
"node": ">=18",
"dsh": ">=0.2.0-rc.2"
}
这几个细节是刻意的:
- 为什么用
engines.dsh而不是peerDependencies。 dsh-market 判定主机兼容性时会同时读engines.dsh(也接受dsh.engines.dsh写法,两者都存在时顶层优先)和所有匹配@deepseek-ai/dsh*的peerDependencies,多个声明之间取交集。本插件不在代码里 import 任何@deepseek-ai/*包——Host 半边零 import,Client 半边只require("react")—— 因此没有需要声明 peer 的包;@deepseek-ai/dsh在index.js里只是被npm view/npm install -g用到的字符串常量。改用engines.dsh还有一个好处:npm 只检查engines.node与engines.npm,忽略自定义键,所以它既不会触发 peer 自动安装, 也不会有预发布版本引起的ERESOLVE。 - 预发布版本能正常匹配。 市场判定
engines.dsh时采用 includePrerelease 语义, 故>=0.2.0-rc.2同时匹配0.2.0-rc.2、0.2.1-rc.1、0.3.0-rc.1等后续预发布版本, 同时排除0.1.7-rc.2与0.2.0-rc.1。 - 生效前提是发版。 市场的兼容性数据取自 npm registry 的
latestmanifest,不是 GitHub 仓库,所以改完必须发布新版本(推v*tag 触发.github/workflows/publish.yml)才会在 市场详情页显示。
收录条目本身(
data/plugins/<owner>__<repo>.yml)没有版本字段,兼容性声明只存在于 插件自己的package.json中。
目录结构
dsh-auto-update/
├── package.json # 声明 dsh.bundle.patch + dsh.client + engines.dsh
├── cordis.patch.yml # 挂载条目(insert:id + 包名)
├── index.js # Host 半边:ESM 模块,export { name, inject, apply }
└── client.js # Client 半边:浏览器 bundle(window.__ModuleLoader__.load)
本插件为纯手写 JS、无构建步骤,故入口按官方 bundle 最简范式直接放在包根目录 (对照打包与安装插件 的
hello-plugin示例)。lib/在 dsh 约定中指由src/构建出的产物目录,此处不适用。
工作原理
- 版本检查(Host):
dsh --version读取当前版本;npm view @deepseek-ai/dsh time --json读取 npm 上所有版本的发布时间,取其中发布时间最近的版本作为「最新版」(跨通道,不区分 latest / next / alpha)。加载时执行一次,之后ctx.interval每 30 分钟一次。 命令执行走 shell 接缝:dsh ≥ 0.2 用ctx.shell.resolve()→ctx.shell.execute()→execution.result();更早的 dsh 用已被移除的ctx.shell.run()兜底(同一份代码兼容两者)。 - Client ↔ Host 通信:Host 用
ctx.webServer.register注册/dsh-auto-update/api路由 (POST{method}→ JSON),Client 通过fetch()调用,方法为getStatus/installUpdate/restart。 - 更新:
installUpdate执行npm install -g @deepseek-ai/dsh@<最新版确切版本号>(安装的就是 检测到的那个发布时间最近的版本,而非某个 dist-tag)。 - 重启(跨平台):
restart先用node -p process.platform检测操作系统,再按平台选择脚本—— Linux 用setsid + nohup + &、macOS 用nohup + &(无 setsid)、Windows 用 PowerShell (Get-NetTCPConnection结束监听进程 +Start-Process拉起新进程),均以脱离父进程的方式后台运行, 确保父进程(当前 dsh web)被杀死后脚本仍能继续启动新进程。
依赖说明
- Host 侧依赖
shell(bash 后端)、timer、webServer服务;Client 侧依赖slots、timer服务。 - 重启脚本按平台依赖:Linux 依赖
lsof(或fuser)/setsid/nohup;macOS 依赖lsof/nohup; Windows 依赖 PowerShell(Get-NetTCPConnection/Stop-Process/Start-Process,需 PowerShell 4+)。 - 版本号显示在
settings.trigger插槽(即「设置」按钮的内容区),侧边栏折叠为窄栏时只显示齿轮图标。
注意事项
- 「最新版本」= npm 上发布时间最近的版本,跨所有通道选取,不再按 dist-tag
(latest / next / alpha …)区分通道。例如 alpha 通道的
0.1.5-alpha.2虽是alphatag 指向的版本,但若0.1.5-rc.2发布时间更晚,则后者才是「真正的最新版」,检测与安装都取它。 检测到的版本就是会被安装的版本:npm install -g @deepseek-ai/dsh@<该确切版本号>。 - 防降级:当前版本在 npm 上有发布记录时,只有当「最新版发布时间 > 当前版发布时间」才提示更新, 即便当前跑的是发布时间更晚的版本也不会被拉回旧版本;若当前版本在 npm 上查不到发布时间 (本地 / 未发布版本),则只要版本号不同即视为可更新。
Comments
Comments live in GitHub Discussions. Sign in with GitHub to post or react.