结论:profile 依赖无法指向 registry,此路关闭

实测 pnpm add 会重新解析整个依赖树,撞上 DSH 私有的 @deepseek-ai/* 包(不在任何
registry,由 Electron 内置提供)直接失败。因此:
- profile 依赖只能 file: 本地路径,由 install.mjs 手工摆文件
- registry 降级为发布存档 / 给外部装,不做 profile 依赖来源
- 附带发现:pnpm 报错会打印 auth header 前 4 位,不构成泄露但要知情
This commit is contained in:
发条 committed 2026-11-08 16:19:04 +08:00
1 parent f585ec764c
commit c987d68d05
1 file changed
+46
+46
View File
@@ -190,3 +190,49 @@ registry 的价值只在版本化和指定版本安装,团队铺开前搞定
这是切 registry 前的最后一个未知数:Electron 启动时会不会覆盖 `node_modules`。 这是切 registry 前的最后一个未知数:Electron 启动时会不会覆盖 `node_modules`。
如果不认,就退回「从 registry 下包 + 手动解压」的折中路线。 如果不认,就退回「从 registry 下包 + 手动解压」的折中路线。
## 十三、registry 模式在 profile 层不可行(2026-11-08 实测,此路已关闭)
### 结论先说
**DSH 的 profile 依赖不能指向 registry。`file:` 是唯一可行的写法。**
registry 已能正常发包、能被外部安装,但它**不能作为 profile 的依赖来源**。
### 实测过程
跑 `scripts/switch-to-registry.mjs`(把 profile 依赖从 `file:` 改成 `^0.1.0` 后 `pnpm add`),失败:
```
@deepseek-ai/dsh-subagent-codex is not in the npm registry, or you have no permission to fetch it.
Progress: resolved 1, reused 0, downloaded 0, added 0
```
### 根因
profile 的 `dependencies` 里有 `@deepseek-ai/*` 一系列包(base / web-app / 各种 experimental bundle / subagent),
它们**不在公共 npm,也不在 Gitea registry** —— 由 DSH 安装包自身提供,解析机制是 Electron 内部的,
不走标准 npm 解析。
任何 `pnpm add` / `pnpm install` 都会**重新解析整个依赖树**,第一步就撞上这些包,直接失败。
所以:**profile 的依赖管理只能由 Electron 自己做,外部包管理器无权重写它。**
### 这意味着什么
| 事项 | 结论 |
|---|---|
| profile 的插件安装方式 | 只能是 `file:` 本地路径 + 手工摆文件(现在的 `install.mjs`) |
| npm registry 的定位 | 从「依赖来源」降级为「发布存档 / 给外部装」 |
| `update.mjs` | 走 git + 重建 + 装,这是正确且唯一的路 |
| 以后想「一条 pnpm 命令装好所有插件」 | **做不到**,除非 DSH 官方把这些包发到公共 npm |
### 附带发现:pnpm 报错会带出 auth header
失败信息里出现过 `An authorization header was used: Bearer 6f07[hidden]` ——
只显示前 4 位、其余隐藏,**不构成密钥泄露**,但要知情:
在 profile 目录跑任何包管理器命令,都可能把 token 前缀打到终端。
### 已做处理
- `switch-to-registry.mjs` 保留但**不再使用**,脚本里的自动回滚这次生效了(package.json 已恢复)
- 环境验证:bundles 14 个、依赖仍为 `file:`、插件文件齐全