
2026-08-26:搞懂 DeepSeek Harness 里的 bundle 和 profile
From 行之的实践笔记
今天在学习 DeepSeek Harness 的源码。之前一直不知道 package.json 里的 bundle 和 profile 到底有什么区别,今天终于把它们捋清楚了。
bundle 和 profile 是 DSH 安装机制里两个不对称的概念,都由 package.json 的 dsh 段描述,但角色刚好相反。
bundle 是「供应者」,是一个可分发、可复用的 npm 包。它的 manifest 声明 dsh.bundle,回答的是「这个包贡献什么」——一个指向 cordis.patch.yml 的补丁层。你编写并发布它。
profile 是「消费者」,是一个位于 $DSH_HOME/profiles/<name> 下的目录,比如 web、headless。它的 manifest 声明 dsh.profile,回答的是「这套组合由哪些 bundle 按什么顺序组成」——一个 bundles 包名列表。用户通过 dsh --profile <name> 启动它。
启动时,loadProfile 会读取 profile 清单里列出的每个 bundle 包,再按照各个 bundle 声明的 patch 文件,把它们一层层叠到空根上:后层按 id 覆盖前层,用户自己的 cordis.patch.yml 永远最后生效。
所以,profile 是「购物清单」,bundle 是「货架上的商品」。web 这个 profile 引用了 dsh-base 和 dsh-web-app 两个 bundle,而 dsh-base 同时被 web 和 headless 两个 profile 引用。两者独立存在、角色不对称,仓库里没有任何一个包同时扮演两种角色。