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

@dingpenghui/dsh-web-search-serper

v0.3.1

Published

Serper.dev-backed web search provider for DSH (DeepSeek Harness) web capability seam

Readme

@dingpenghui/dsh-web-search-serper

English | 中文

npm version License: MIT DeepSeek Harness

概述

@dingpenghui/dsh-web-search-serper 是一个基于 Serper.dev API 的 Web 搜索提供方插件,专为 DeepSeek Harness (DSH) 的 web 能力 seam (ctx.web) 设计。

Serper.dev 是 Google 搜索的官方合作伙伴,提供高速、结构化的 Google 搜索结果 API。免费额度:每月 2,500 次查询,无需信用卡。

特性

  • 🚀 高速搜索 — 1-2 秒响应,基于 Google 真实索引
  • 📊 结构化结果 — JSON 格式返回,易于解析
  • 🔒 隐私友好 — 不追踪用户,无 Cookie 收集
  • 💰 免费额度高 — 每月 2,500 次查询,免费使用
  • 🌍 多语言支持 — 支持全球多个国家/地区的搜索结果
  • 🔧 零配置集成 — 一行代码接入 DSH

快速开始

安装

pnpm add @dingpenghui/dsh-web-search-serper
# 或
npm install @dingpenghui/dsh-web-search-serper

配置

在 DSH 的 cordis.patch.yml(profile 补丁层)中添加:

- id: web
  config:
    searchProvider: serper

- insert:
    - id: web-search-serper
      name: '@dingpenghui/dsh-web-search-serper'

无需 config 即可工作:API key 按以下顺序在每次搜索时解析:

  1. config.apiKey(显式配置,需给行加 config 块);
  2. DSH 宿主进程的环境变量 SERPER_API_KEY
  3. DSH 凭证库中的 SERPER_API_KEY 引用 ($DSH_HOME/.credentials.yamlrefs: —— 热加载,改动无需重启)。

也可以在 composition 中固定 key:

- insert:
    - id: web-search-serper
      name: '@dingpenghui/dsh-web-search-serper'
      config:
        apiKey: your-serper-api-key
        gl: cn  # 可选:设置默认国家代码

获取 API Key

  1. 访问 https://serper.dev
  2. 注册免费账户
  3. 在 Dashboard 获取 API Key
  4. 免费额度:每月 2,500 次查询

配置选项

| 字段 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | apiKey | string | 否 | $SERPER_API_KEY,再回退到凭证引用 SERPER_API_KEY | Serper API 密钥 | | baseURL | string | 否 | https://google.serper.dev | API 端点基址 | | gl | string | 否 | - | 国家代码(如 us, cn, jp) | | cr | string | 否 | - | 地区代码(如 us,作为 cr 参数发送) | | numResults | number | 否 | 省略(Serper 默认 10) | 默认结果数量,上限 100 |


使用示例

基础搜索

import { apply } from '@dingpenghui/dsh-web-search-serper'

// 在 Cordis 插件中使用
apply(ctx, {
  apiKey: 'your-api-key',
  gl: 'cn',
})

通过 ctx.web 搜索

const result = await ctx.web.search({
  query: '2026年AI发展趋势',
  maxResults: 5,
})

console.log(result.sources)
// [
//   { url: '...', title: '...', snippet: '...' },
//   ...
// ]

错误处理

| 错误码 | 含义 | 处理方式 | |--------|------|----------| | WEB_PROVIDER_CONFIGURED_MISSING | 配置的 provider 未注册 | 检查插件是否正确加载 | | WEB_PROVIDER_CONFIGURED_UNAVAILABLE | provider 已注册但不可用 | 检查 API Key 是否有效 | | WEB_ABORTED | 请求被中止 | 检查 AbortSignal | | WEB_PROVIDER_ERROR | API 请求失败 | 检查网络/API Key/速率限制 |


限制与已知问题

  1. 免费额度限制 — 每月 2,500 次查询,超出后需付费
  2. 仅支持 Google 搜索 — 不支持 Bing、Baidu 等其他搜索引擎
  3. 无生成答案 — 仅返回搜索结果列表,不包含 AI 生成的摘要
  4. 需要 API Key — 必须在配置中提供有效的 Serper API Key

相关项目


许可证

MIT License — 见 LICENSE 文件


贡献

欢迎提交 Issue 和 Pull Request!

  1. Fork 本仓库
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

支持

如有问题,请: