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-plugin-custom-headers

v0.1.0

Published

Custom request headers settings page for DeepSeek Harness: per-route HTTP headers for custom model (llm-pi-ai) providers, written into the llm-pi-ai user settings section

Readme

dsh-plugin-custom-headers

DeepSeek Harness 的 Web 界面添加一个「自定义请求头」设置页:为自定义模型(llm-pi-ai 提供方路由)配置随每次模型请求发送的 HTTP 请求头。

  • 路由列表来自 llm-pi-ai 的 provider profile(显示名 + 路由 id)。
  • 「填入 Codex CLI 模板」一键填入一组 Codex CLI 请求头。
  • user-agent 是 Harness 强制署名的保留名(pi-ai 适配器会剥离它),页面会标记该行并在保存时跳过。
  • 保存的配置写入用户设置文档(settings.yamlllm-pi-ai.providers.<route>.headers),重启后依然生效。
  • 纯浏览器插件:页面注册一个 settings.section 条目,通过 DSH 自带的 settings 远程接口读写,无需修改宿主、无需重编译、无需改 apiproxy 白名单llm-pi-ai 命名空间本来就在白名单里,模型页在用)。

安装

前置条件:

  • Node.js ≥ 22.19(DSH 的运行要求)。
  • 已安装并用 web profile 启动的 DeepSeek Harness(本插件是 Web 界面插件)。
  • 已在「模型」设置页添加至少一个自定义模型(llm-pi-ai 路由)——插件只为这些路由配置请求头,没有自定义模型时页面会提示先去添加。

1. 安装插件

dsh plugin --profile web add dsh-plugin-custom-headers

这条命令等价于在 profile 目录执行 pnpm add,并自动把包登记为 bundle 层(因为包声明了 dsh.bundle.patch),无需手动改任何配置文件

2. 重启并打开

重启 DSH(或刷新 Web 页面),让新插件进入浏览器 roster。

3. 使用

打开 设置 → 自定义请求头

  1. 在「提供方路由」下拉里选择要配置的模型;
  2. 点「+ 添加请求头」逐行填写请求头名和值,或点「填入 Codex CLI 模板」一键填入;
  3. 点「保存」。保存后写入 settings.yamlllm-pi-ai.providers.<route>.headers 分节,重启后依然生效,后续模型请求都会携带这些请求头。

user-agent 是 Harness 强制署名的保留名,页面会标记该行并在保存时跳过,无法覆盖。

卸载

dsh plugin --profile web remove dsh-plugin-custom-headers

备选:也可以直接从 GitHub 仓库安装(无需发布 npm): dsh plugin --profile web add github:DJ1667/dsh-pluging-ui-settings-custom-headers 但 GitHub 安装不会触发 npm 的 prepack 构建,仓库里必须提交了构建好的 lib/ 才能用(本仓库未提交 lib/,因此建议走 npm 安装)。

工作原理(为什么不需要重编译)

DSH 的插件安装走 profile bundle 机制(apps/cli/src/plugin.ts):

  1. dsh plugin add <包> 在 profile 目录执行 pnpm add,包声明了 dsh.bundle.patch 就会被自动登记为 bundle 层;
  2. 启动时该层的 cordis.patch.yml 把插件插入浏览器 roster;
  3. dsh-client-modules 扫描到包声明 dsh.client.platform: "web",直接服务 exports["./client"] 指向的构建产物(lib/client.js),浏览器动态加载。

所以发布包里必须包含构建好的 lib/client.jsprepack 脚本会在发布前自动构建)。

构建与发布

pnpm install
pnpm run bundle        # 产出 lib/index.js、lib/invariant.js、lib/client.js、lib/types/
npm login              # 首次发布需要登录 npm 账号
npm publish            # prepack 会自动重新构建

注意:lib/client.js 里写入的模块 id 取自 package.json 的 name,浏览器模块表按包名查找。改包名时务必同步改 cordis.patch.yml 里的 name 字段(tsdown 配置会自动跟随 package.json,不用改)。

兼容性

  • 依赖 DSH 自带(官方仓库已包含)的 dsh-llm-pi-ai 适配器来合并请求头,无需额外安装。
  • peerDependencies 里的 @deepseek-ai/dsh-* 版本范围要和安装方运行的 DSH 版本线匹配(当前为 0.1.0-rc.x),@deepseek-ai/cordis 是独立版本线(4.x)。DSH 升级到新版本线时,可能需要同步调整这里的范围。
  • 请求头数据(llm-pi-ai.providers.<route>.headers)中如果包含 apiKey 明文,请改用 apiKeyEnv 引用环境变量,避免配置泄露。

开发

pnpm install
pnpm run bundle --watch   # 增量构建
pnpm run typecheck

License

MIT