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-web-search-zhihu

v1.0.0

Published

DSH 插件:注册 zhihu-global web search provider,使内置 web_search 工具改走知乎开放平台全网搜索(免费)。Registers a zhihu-global provider into ctx.web so the built-in web_search tool routes through Zhihu's free global search API.

Readme

dsh-web-search-zhihu

DSH(DeepSeek Harness)插件:向 ctx.web 注册 zhihu-global search provider,使内置 web_search 工具改走知乎开放平台全网搜索(免费,5000 次/日),替代默认的 DeepSeek 官方搜索。

安装

dsh plugin --profile web add dsh-web-search-zhihu
dsh web   # 重启生效

安装后包内 patch 自动注册插件行并把 web 行的 searchProvider 切换为 zhihu-global(config 整体替换语义;你的用户层 cordis.patch.yml 若已配置该行,以你后应用的层为准)。

凭据

先在知乎开放平台个人中心获取 Access Secret,然后三选一(优先级从高到低):

  1. 插件行 config 字面 apiKey
  2. DSH 凭据存储:~/.dsh/.credentials.yaml 写入 ZHIHU_API_KEY: <secret>(推荐,0600 权限)
  3. 启动环境变量 ZHIHU_API_KEY

逐请求解析,改密钥即刻生效,不缓存不落日志。

配置

- id: web-search-zhihu
  name: dsh-web-search-zhihu
  config:
    apiKeyEnv: ZHIHU_API_KEY   # 凭据引用名,默认即此
    attribution: true          # 结果归属标识行,默认开启
    # apiKey: <literal>        # 字面密钥(不推荐,优先用凭据存储)

结果标识

知乎全网搜索索引全网,可能返回非知乎域名的结果,不能靠 URL 域名辨认。开启 attribution(默认)时,每次搜索结果首行带:

[via zhihu-global · 知乎全网搜索]

模型可见,且渲染在搜索卡片的 answer 区域(展开 web_search 工具卡片即可见)。attribution: false 可关闭。

映射与错误

| 知乎字段 | 工具字段 | 处理 | | - | - | - | | Url | sources[].url | 去除 utm_* 追踪参数 | | Title | sources[].title | 原样 | | ContentText | sources[].snippet | 去 HTML 标签、压空白、截 300 字符 | | EditTime | sources[].publishedAt | 秒级时间戳 → ISO 8601 |

错误:HTTP 非 200 / 知乎业务码(20001 鉴权、30001 限频、30002 配额等带码入消息)→ WEB_PROVIDER_ERROR;密钥缺失 → WEB_PROVIDER_CREDENTIAL_MISSING;取消 → WEB_ABORTED。不重试。

回滚

searchProvider 改回 deepseek-official 并重启;或 dsh plugin --profile web remove dsh-web-search-zhihu

Requirements

  • DSH ≥ 0.1.0-rc(ctx.web provider 注册表)
  • Node.js ≥ 18(原生 fetch)

架构(开发者参考)

DSH 宿主组合($DSH_HOME/profiles/web/)
├─ cordis.patch.yml ──────────── ① web 行: searchProvider=zhihu-global(切换点)
│                                 ② insert: web-search-zhihu 插件行
└─ plugins/dsh-web-search-zhihu ─→ 本包(npm 安装或 symlink 两种部署)
        │
        ▼ registerSearchProvider({ id: 'zhihu-global', ... })
ctx.web 服务(dsh-web,provider 注册表,配置 id 优先于注册顺序)
        │
        ▼ search({query, maxResults})
web_search 工具(dsh-tool-web,完全不感知 provider:schema/提示词/UI 不变)
  • 宿主组合而非 agent preset:web 服务与其 provider 是跨会话共享的进程级能力。
  • 软依赖 schemastery:npm 安装环境获得 Config schema 校验;本地 symlink 部署(无 node_modules)自动回退直通,功能不受影响。
  • 本地部署(不经 npm):ln -s <本仓库> ~/.dsh/profiles/web/plugins/dsh-web-search-zhihu,再在 profile 的 cordis.patch.yml 写入与包内 patch 相同的两段。

测试(开发者参考)

node test/probe.mjs          # 离线映射断言(无网络)
node test/probe.mjs --live   # 在线实测(读 ~/.dsh/.credentials.yaml),产物落盘 test/artifacts/

License

MIT