DeepSeek Harness 插件

maxwell-feng/dsh-tinyfish-search

Star 数 ★ 28 下载量(近 30 天) 4,058 分类 浏览器与网页 收录于 2026-08-31 npm dsh-tinyfish-search

基于 TinyFish 的网页搜索提供方:把内置 web_search 接到 TinyFish Search API,每次搜索一次 GET,不消耗模型调用。

安装

# npm 包(预构建)

dsh plugin --profile web add dsh-tinyfish-search

# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)

dsh plugin --profile web add github:maxwell-feng/dsh-tinyfish-search

装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。

README

英文 | 中文

DeepSeek Harness 插件:将内置 web_search 接到 TinyFish Search API,每次查询一次 GET,不消耗模型调用。

插件作用

插件在 ctx.web 上注册网页搜索提供方 tinyfish:

  • 每次 web_search 调用为 GET https://api.search.tinyfish.ai,携带 x-api-key 头。
  • results[](标题、摘要、链接、日期)映射为 WebSearchSource。
  • ready(llmProvider) 检查是否已配置 API key;未配置时模型步不会获得 web_search。
  • 每次搜索不消耗模型轮次。
  • 内置 icon.svg 与双语清单(locale/en.json、locale/zh.json),供插件管理器使用。

补丁行为

cordis.patch.yml 覆盖两个宿主行:

  • web:设置 searchProvider: tinyfish,重述 fetchProvider: http。自 DSH 0.2.2-rc.5 起 dsh-base 不设搜索提供方,由 dsh-web 按模型路由选择:DeepSeek 路由用旧版 Messages 搜索,其他路由用 DeepSeek Search API;显式 id 固定为 TinyFish。
  • tool-web:以 disabled: false 重新启用宿主工具行,重述 search: true、fetch: true 与基础超时。dsh-web-app 自带该行且默认禁用,干净安装的 web profile 否则没有 web_search。

重新启用 tool-web 会让网页工具对本 profile 的每个 agent 预设可见,包括原本不带这些工具的预设(如 minimal)。自带 tool-web 行的预设会为其 agent 遮蔽该注册;若要限定单个预设,请在 profile 的 cordis.patch.yml 中覆盖或移除该行,并把 tool-web 加入该预设的组合。后续 profile、home 与 --patch 层仍可覆盖这两行。

配置使用易变 schema:Host 读取 Config,在 插件 页面为 dsh-tinyfish-search 行渲染表单。无插件侧设置代码;保存的修改对下一次搜索生效,无需重启。

环境要求

  • 带 web 缝的 DeepSeek Harness dsh,如 web profile。构建基线:0.2.3-alpha.2(2026-11-22)。engines.dsh:>=0.1.7-alpha.2 <0.3.0。
  • Node.js ^24.22.3 || >=26.13.1;DSH 0.2.3 要求 24.x 线为 24.22.3+,或 26.13.1+。
  • 一个 TinyFish API key。搜索在任意钱包余额下免费。
  • @deepseek-ai/dsh-credentials 与 @deepseek-ai/dsh-launch-environment 作为 peer;每个 dsh profile 都已自带。

DSH 在加载插件行前校验 engines.dsh;区间外宿主会被拒绝,并打印确切要求。要接受风险:

dsh plugin --profile web allow-version dsh-tinyfish-search@0.23.0 --dsh-version <your-dsh-version> --accept-risk

文档:安装 · 配置 · 使用 · 更新 · 卸载 · 更新日志;每篇都有英文版。

安装

dsh plugin --profile web add dsh-tinyfish-search

从源码目录或本地构建的 tarball 安装(npm pack 生成 .tgz):

dsh plugin --profile web add ./dsh-tinyfish-search
dsh plugin --profile web add ./dsh-tinyfish-search-0.23.0.tgz
dsh plugin --profile web add github:maxwell-feng/dsh-tinyfish-search

--profile <name> 必须放在 add、remove、update、allow-version 前。Git 安装通过 prepare 构建 lib/(tsc -p tsconfig.build.json)。

用 dsh --profile web --dump-config | grep tinyfish 检查 bundle 层。打开 插件 → 内置插件配置 → 网页搜索与获取,网页搜索提供方 下拉框应列出 TinyFish Search(id tinyfish);实际搜索应返回链接与摘要。

配置

设置 API key(推荐):

export TINYFISH_API_KEY="your_api_key_here"                      # 仅当前 shell
echo 'export TINYFISH_API_KEY="your_api_key_here"' >> ~/.bashrc  # 永久生效(bash)
echo 'export TINYFISH_API_KEY="your_api_key_here"' >> ~/.zshrc   # 永久生效(zsh)
source ~/.bashrc                                                 # 或重开终端

Windows PowerShell 可用 setx TINYFISH_API_KEY "your_api_key_here" 对新终端生效,或用 $env:TINYFISH_API_KEY = "your_api_key_here" 仅对当前会话生效。

在 profile 的 cordis.yml 或 patch 层设置这些字段:

字段 默认值 含义
apiKey — 字面量 API key(secret 角色;优先于环境变量)
apiKeyEnv TINYFISH_API_KEY 承载密钥的环境变量名
baseURL https://api.search.tinyfish.ai API 端点基地址
location — 可选地区定位;留空则不发送
language — 可选搜索语言;留空则不发送

所有字段均可选;schema、凭据顺序与就绪规则见配置说明。

使用

  1. 模型按常调用 web_search。
  2. 框架经 ctx.web → tinyfish → https://api.search.tinyfish.ai 路由。
  3. 结果以 WebSearchSource[](url、title、snippet、publishedAt)返回。

available() 是 web 缝的本地提供方检查;ready() 决定模型步是否获得该工具。未配置密钥时 web_search 被收起;绕过闸门的已派发搜索以 WEB_PROVIDER_CREDENTIAL_MISSING 失败。

错误遵循 dsh-web 缝:无密钥为 WEB_PROVIDER_CREDENTIAL_MISSING,取消为 WEB_ABORTED,其他为 WEB_PROVIDER_ERROR。示例与错误表见使用说明。

更新

dsh plugin --profile web add dsh-tinyfish-search@latest

本版将依赖更新到 DSH 0.2.3-alpha.2,将 Node.js 门槛提高到与 DSH 一致,并更新文档。正常搜索行为不变;畸形响应处理更稳健。步骤与回滚见更新说明。

卸载

dsh plugin --profile web remove dsh-tinyfish-search

这会移除 bundle 层与 tinyfish 提供方;web 与 tool-web 回到底层 bundle 的取值。自带 tool-web 行的预设仍保留 web_search,回退到宿主自身的选择:0.2.2-rc.5 起,DeepSeek 路由用 deepseek-official(旧版 Messages 搜索),其他路由用 deepseek-search-api;0.2.2-rc.2–rc.4 用 deepseek-search-api;更早宿主用 deepseek-official;无其他提供方则为空。依赖宿级 tool-web 行的预设(如 minimal)会失去 web_search,直到恢复 tool-web。

开发

本项目由 dsh-superagent 辅助维护。

pnpm install
pnpm build     # tsc -> lib/
pnpm test      # node --test,mock fetch
pnpm typecheck # tsc --noEmit,覆盖 src + test + scripts

运行 node scripts/check-docs-language.ts 检查双语文档。发布使用 GitHub Actions 的 npm Trusted Publishing(OIDC);见 .github/workflows/publish.yml。

发布说明:CHANGELOG.zh.md 或 CHANGELOG.md,以及 GitHub Releases 页面。

许可证

MIT — 见 LICENSE。

内容来自项目 README(GitHub)↗

链接

同类插件

查看整个分类 →

社区评论

评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。