npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-pi-ai-header-new-patch

v0.5.0

Published

Safely patch DeepSeek Harness profile headers without modifying the signed app bundle

Readme

dsh-pi-ai-header-new-patch

给新版 DeepSeek Harness 0.2.0-rc.2 内置的 @deepseek-ai/dsh-llm-pi-ai 的 requestHeaders() 打一个最小补丁,让 profile 中配置的 headers 覆盖同名的应用归因头(例如 user-agent)。

仅支持新版 Harness 的 $DSH_HOME/profiles 布局,默认 $DSH_HOME=~/.dsh。不扫描旧版 Desktop、全局 npm、pnpm、yarn 或 npx 路径。

使用

npx dsh-pi-ai-header-new-patch
npx dsh-pi-ai-header-new-patch --check
npx dsh-pi-ai-header-new-patch --path ~/.dsh/profiles/node_modules/@deepseek-ai/dsh-llm-pi-ai
npx dsh-pi-ai-header-new-patch --restore

工具会检查 $DSH_HOME/profiles/node_modules 以及 $DSH_HOME/profiles/*/node_modules。新版 Harness 运行时会从这些 profile 层加载包。

这次优化的重点

不修改 DeepSeek Harness 签名应用束(bundle)

新版 Harness 的 profile 可能通过符号链接指向签名 App:

$DSH_HOME/profiles/node_modules/@deepseek-ai/dsh-llm-pi-ai
  -> /Applications/DeepSeek Harness.app/Contents/Resources/app.asar/...

直接沿着链接写入会修改 .app 内的运行时文件,导致:

codesign --verify --deep --strict ...
a sealed resource is missing or invalid

新版 Harness 发现该符号链接指向签名 App 时,会先在 profile 中物化一份可写副本,再只修改副本。原始符号链接保存为同目录下的 .dsh-pi-ai-header-new-patch.stock-link,可用 --restore 回滚。工具始终拒绝直接修改 App bundle。

写入与版本匹配更安全

  • 通过括号匹配定位完整的 requestHeaders() 函数,不再依赖整段固定缩进。
  • 只接受能识别的 stock 函数;未知版本返回失败,不做猜测性替换。
  • 使用同目录临时文件 + fsync + rename 原子替换,避免中断留下半个 JS 文件。
  • 增加 --check、参数校验、--restore 和可读的失败状态。
  • 已打补丁、找不到目标、未知版本、签名 App 直写分别报告,不把它们混成成功。

验证

cd dsh-pi-ai-header-new-patch
npm test
node --check bin.mjs
npm pack --dry-run

运行 DeepSeek Harness 前建议检查:

npx dsh-pi-ai-header-new-patch --check
codesign --verify --deep --strict "/Applications/DeepSeek Harness.app"

--check 显示 [unsafe-app-bundle] 时,先退出 DeepSeek Harness,再运行不带 --check 的命令让工具创建 profile overlay。工具不会直接修改签名 App。

注意

这是对私有打包产物的补丁,不是官方扩展点。DeepSeek Harness 升级后可能重新建立 profile 符号链接,需要重新运行工具。真实的模型请求、登录状态和桌面 UI 仍需在 DeepSeek Harness 中单独验证。