前言¶
DeepSeek Harness(DSH)在安装、更新插件时依赖 pnpm 拉取依赖。在 Windows 上,Node 与 pnpm 不会走系统代理,pnpm 往往直连 registry.npmjs.org 和 GitHub。防火墙后常见慢连或 ECONNRESET;把 pnpm 指到本机代理(例如 Clash 的 127.0.0.1:7897)能明显加快解析,但代理一关,安装又会失败。手工改 ~/.npmrc 可以切换,却容易和日常配置缠在一起。
dsh-pnpm-manager(维护者 easyzoom,GitHub 仓库 easyzoom/dsh-pnpm-manager)面向上述场景:在 DSH 设置页或独立 CLI 里,控制 DSH 所用 pnpm 是否走代理,并查看、切换 registry 与 store。README 将其描述为「Proxy and registry switch for DeepSeek Harness (DSH) pnpm — host plugin + Settings tab + standalone CLI」。分类为客户端插件;当前 package 版本为 0.1.0,许可证 MIT,要求 Node >= 18。
这是什么¶
插件通过 package.json 的 dsh.bundle.patch 与 cordis.patch.yml 向宿主 bundle 插入一行配置;该行的 Config(schemastery)由 DSH 渲染成设置表单。可选的 lib/client.js 还会在插件页与 Settings → Built-in plugins 下注册 pnpm 代理 标签页(含保存确认与「测试连接」)。同一套逻辑也可脱离界面,用 bin/dsh-pnpm-manager.mjs 作为 CLI 使用。
会改哪些文件¶
只读写用户主目录下的 ~/.npmrc 中与 proxy、https-proxy、registry 相关的行,其余项保留不动。仅在内容确实变更时写入带时间戳的备份(*.bak-<timestamp>)。
核心功能¶
宿主设置项¶
| 字段 | 取值 | 含义 |
|---|---|---|
mode |
on / off / auto |
强制开代理 / 强制直连 / 仅当代理端口可达时启用 |
proxyUrl |
URL | 代理地址,默认 http://127.0.0.1:7897 |
noProxy |
逗号分隔主机名 | 走代理时的 bypass 列表(noproxy) |
strictSsl |
true / false |
严格 TLS;对 SSL 拦截型代理(如 Clash)可设为 false → strict-ssl=false |
registry |
keep / npmjs / npmmirror |
不改 registry / 官方源 / 中国镜像 |
在表单中修改后,会立即重写 ~/.npmrc(loader 会重新应用该行)。README 注明:在隔离的 web profile 与 desktop 应用中,宿主路由返回实时数据;卡片出现在插件页,并在 Settings → Built-in plugins 的 pnpm 代理 标签中展示模式状态及 开 / 关 / 自动 / 测试;宿主路由另有单元测试。
独立 CLI¶
在插件目录或全局安装后,可执行:
node bin/dsh-pnpm-manager.mjs status [--json]
node bin/dsh-pnpm-manager.mjs doctor [--json]
node bin/dsh-pnpm-manager.mjs on | off | toggle | auto
node bin/dsh-pnpm-manager.mjs proxy http://127.0.0.1:7890 # 或: proxy reset
node bin/dsh-pnpm-manager.mjs registry npmjs | npmmirror
node bin/dsh-pnpm-manager.mjs store
node bin/dsh-pnpm-manager.mjs test
环境变量:PNPM_PROXY_URL、DSH_PROFILE_DIR、DSH_PNPM_CJS。
安装与启用¶
使用 DSH 自带的 dsh CLI。将 <profile> 换成你的 profile 名(桌面应用为 desktop,dsh web 为 web,依此类推)。
# 1) git source (main channel)
dsh plugin --profile <profile> add "github:easyzoom/dsh-pnpm-manager#main"
# 2) npm (once published to npm)
dsh plugin --profile <profile> add dsh-pnpm-manager
# 3) local dev (a checkout of this repo)
dsh plugin --profile <profile> add /path/to/dsh-pnpm-manager
说明(摘自 README):
- desktop profile 由正在运行的应用锁定 — 用 CLI 安装前请先关闭 DeepSeek Harness,或在应用的 Plugins 面板里安装。
- git 源在已配置 git 凭证时可用于私有仓库;公开仓库无需鉴权。
- npm 方式需包已发布到 npm(
npm publish)后方能使用。
典型用法¶
- 在防火墙或需本机代理的环境下,安装插件后打开 Settings → Built-in plugins → pnpm 代理,将
mode设为on或auto,确认proxyUrl与本地代理端口一致,保存并点 测试连接。 - 需要国内镜像时,在表单或 CLI 中将 registry 设为
npmmirror:node bin/dsh-pnpm-manager.mjs registry npmmirror。 - 临时直连:
node bin/dsh-pnpm-manager.mjs off;恢复代理:on或toggle。 - 排查当前生效配置:
node bin/dsh-pnpm-manager.mjs status或doctor [--json]。
适用场景与注意¶
适合经常在 DSH 里装插件、且 pnpm 网络行为需要随环境(代理开/关、镜像切换)快速调整的用户。插件以当前 DSH 进程的用户权限读写 ~/.npmrc;安装前请自行查看仓库源码与 MIT 许可证,确认改动范围可接受。
DSH 生态强调「一切皆插件」;社区目录(如 SkillHub 上的条目)为独立站点,与 DeepSeek / 幻方无官方从属关系。
代码布局(便于对照仓库)¶
lib/index.js host plugin (name / Config / apply + web routes)
lib/npmrc.js shared .npmrc read/write helpers
lib/client.js optional client card (__ModuleLoader__ bundle)
bin/dsh-pnpm-manager.mjs standalone CLI
cordis.patch.yml bundle patch (inserts the host row)
更多细节与截图见仓库 README:github.com/easyzoom/dsh-pnpm-manager。