a1113622001/dsh-auto-update

a1113622001★ 0JavaScript最后同步: 2026-08-21

在 GitHub 打开

DeepSeek Harness (cordis) plugin: self-update for the harness launcher - checks npm for a newer @deepseek-ai/dsh, stages it, and applies it on harness exit (or update-and-restart from the web panel).

README 摘要

dsh-auto-update DeepSeek Harness(cordis)插件: 让 harness 更新它自己 。 它定期检查 npm 上 @deepseek-ai/dsh 是否有比当前安装更新的版本;发现更新后自动下载 tarball 并暂存(stage);等 harness 进程退出时,由分离的辅助进程执行 npm install -g , 把全局安装替换成新版本;可选地按原启动参数自动重启 dsh 。Web 界面右下角默认只显示一个 「检查更新」小胶囊(点击展开完整面板),面板内显示版本状态,并提供「检查更新」「更新并重启」 「取消暂存」。 工作原理 1. 安装发现 —— 通过 process.argv[1] (npm shim 启动的 …/node modules/@deepseek-ai/dsh/lib/bin.js ) 推导全局安装根目录;也可用 config.installRoot 显式指定。若 harness 是从源码 ( pnpm dsh )运行的,则自动更新不可用并会在日志中说明。 2. 版本检查 —— 调用 npm view @deepseek-ai/dsh@ version --json ,复用你配置的 registry / 镜像 / 代理。内置极简 semver 比较(支持 1.2.3-rc.1 这类预发布版本)。 3. 暂存 —— npm pack 下载精确版本的 tarball 到 $DSH HOME/updates/ ,写入 pending-update.json (含 from/to、安装根、进程 pid、是否重启等)。此阶段不触碰运行中的安装。 4. 应用 —— 在 harness 的 process.on('exit') 里分离启动 bin/apply-update.js : 等待旧进程真正退出(Windows 上运行中的进程会锁住 sharp/koffi/node-pty 等原生模块文件, 所以必须在退出后安装)→ npm install -g → 校验安装版本 → 记录结果 → 按需用 dsh 重启。 安装 在 profile 目录安装插件(与 dsh-session-stats-panel 一致): 或直接从 GitHub 安装(利用随包发布的 dsh.bundle 清单,插件会自动注册并激活): 手动安装时,需要把仓库根目录下的 cordis.patch.yml 作为 bundle patch 注册到 harness,插件才会随 harness 自动启动。 dsh plugin add 已内置该 bundle,因此 无需手动维护(详见下面的 yaml 片段,它正是 cordis.patch.yml 的内容)。 然后在 %USERPROFILE%\.dsh\profiles\web\cordis.patch…

在 GitHub 查看完整 README →
工具/开发dsh-plugin

分类