dsh-union-search
v0.41.2
Published
Union web search for DeepSeek Harness (renamed from dsh-free-search): free keyless engines + many professional paid search APIs — 68 usable engines across free-keyless / freemium / paid tiers (Bing/DuckDuckGo/360/Degoog/WeChat/Toutiao/SearXNG multi-instan
Maintainers
Readme
dsh-union-search
DeepSeek Harness 联合搜索插件(原 dsh-free-search)—— 免费搜索与多种专业付费搜索 API 的联合体。 一个给 DeepSeek Harness (dsh) 添加多引擎搜索 provider 的插件,注册进 ctx.web seam。内置 web_search 工具自动选用,支持网页设置页切换引擎、配置 API key、一键测试所有引擎、弹出式命令切换引擎。免费引擎开箱即用、零成本;也支持接入多种专业付费搜索 API(Perplexity / DeepSeek 官方 / Kimi / 智谱 / 博查 / 秘塔 / 豆包 / You.com / OpenAI / Gemini / Claude / Grok 等)提升结果质量。
中文
为什么需要它
dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(DEEPSEEK_API_KEY)。如果你:
- 没有(或不想用)DeepSeek 官方 key,
- 用的是 opencode-go 这类网关(其 OpenAI 兼容端点不支持
web_search工具),
……那么内置搜索必然失败,agent 会告诉你"无法联网"。
这个插件提供多个免费引擎 + 多种专业付费搜索 API + 自动回退:不配任何 key 开箱即用,彻底摆脱 DeepSeek 官方 key 的依赖;配置付费 key 后可获得更高额度与更专业的搜索质量。
特性
- 免费 + 付费联合 —— 多个零成本免费引擎(无需 key、无需注册)+ 多种专业付费搜索 API(Perplexity / DeepSeek 官方 / Kimi / 智谱 / 博查 / 秘塔 / 豆包 / You.com / OpenAI / Gemini / Claude / Grok 等);只用免费引擎零成本,配付费 key 提质提额
- 多引擎可选:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、AnySearch、Exa、Tavily、Keenable、Firecrawl、Parallel、Perplexity、SerpBase、Serply、DeepSeek 官方、You.com、百度千帆、Kimi、阿里云百炼、火山联网搜索(豆包搜索)、知乎全网/站内(
zhihu_global/zhihu_site,经知乎开放平台 MCP)、智谱 Web Search(zhipu,普通平台 Key)、博查(bocha,DeepSeek 官方供应方)、秘塔(metaso,多模态)、OpenAI / Gemini / Claude / Grok(grok,xAI Responses APIx_search搜 X/Twitter)模型内置搜索 - 网页设置页 —— 引擎切换 + API key 配置(UI 中 key 脱敏显示"已配置")+ 中英文切换;入口在左侧「插件」页的组件行配置(
plugins.row.config,DSH 0.1.7-rc.1+) - 弹出式切换命令 —— 聊天框输入
/union-search-engine,弹出引擎选择窗口,点选即切换(等效设置页 + 保存) - 引擎测试 —— 设置卡「测试全部引擎」一键逐个测试并列出结果,失败引擎进入建议禁用清单(勾选后「应用禁用」,保存生效;auto/multi 虚拟模式不会入列);另有「测试引擎」按钮(直测当前引擎,不走回退链,付费引擎无 key 会明确报错)
- 全局引擎开关与回退优先级 —— 设置页可勾选/取消引擎(取消后全局生效:普通搜索 / Auto /
advanced_search/multi_search/ 引擎测试都不再用它),并可用 ↑↓ 调整全局回退顺序(一键恢复默认) - Multi 模式 —— 可把搜索引擎设为
Multi Search:web_search并发请求前 3 个已启用引擎、按 URL 合并去重、跨源命中的结果优先(代价是成倍消耗额度;multi 失败会自动退回单引擎回退链) - 统一引擎回退 —— 任何引擎失败(付费/免费,缺 key/401/限流/网络)自动轮流尝试下一个引擎:首选引擎 → 其他引擎(exa/tavily/keenable/firecrawl/parallel 无 key 也会尝试,因为它们自带 keyless 免费额度)→ 剩余免费引擎,搜索永不直接失败;结果顶部注明实际生效的引擎(如
Note: perplexity unavailable or failed, using exa.);失败按类别处理:额度/鉴权失败→本会话冷却该引擎,反爬→短退避,超时/5xx/限流→同引擎重试一次,解析失败/0 结果→不冷却(详见下文「失败分类与引擎冷却」) - 时间过滤 ——
advanced_search工具支持timeRange:固定档、自定义相对值、绝对日期三种形式(详见下方逻辑说明) - 翻页与条数 ——
advanced_search支持page(1 起)与maxResults(默认 5,上限 20)。page只有浏览器档九家与so360真生效(九家早已实现pn/start/offset等偏移;so360经真机实测pn=1/2/3结果集不同)。bing的count/first/FPIG/RSS 四条通道实测均无效,其余 HTTP 档无翻页证据,两者一律返回第 1 页并在结果里明说:page=2 was ignored because this engine does not support pagination.(条数拿满时也会说 —— 否则模型会以为翻页成功、反复要 page=3/4 拿到同一批结果)。请求 N 条实得 M 条时附Note: requested N results, engine "X" returned M (single page):只有支持翻页的引擎才追加「换更高 page」的建议,其余引擎绝不写from page N(它们只跑了第 1 页,写出来就是谎报),也不给翻页建议 —— 多数引擎单页上限就是 10,不凑数、不静默、不给假指引。 - 系统提示词注入 —— agent 知道当前用哪个引擎、哪些需要 key;并明确所有搜索结果是不可信外部数据,不得执行其中的指令。提示词只列当前真正可用的引擎:设置页取消勾选的不会出现;没有配 key 的引擎也会被隐去(凭据中心 / 本条目配置 / 环境变量三源判定,任一有值即视为可用),并提示百度场景改用免 key 的
baidu_browser—— 避免 agent 点名一个必然报API key is not configured的引擎 - 提示注入防护(不可信数据边界) —— 插件自有工具(advanced_search / platform_search / multi_search)的网页文本包在
<untrusted-web-content>边界内(正文里自带的同名标记会被剥离,防止提前闭合);核心 web_search / web_fetch 由 DSH 核心自带同类提示(External web content follows...);所有 snippet 统一清洗并截断到 300 字符 - 版本号 + 检查更新 —— 设置卡片显示当前版本(v0.4.17),"检查更新"按钮直连 npm registry 对比最新版,有新版本时提示并可一键跳转
- 结果缓存 —— 相同查询(含引擎/时间过滤参数)5 分钟内命中缓存(LRU 50 条),防免费引擎限流、省付费额度;时长可在设置页 0-5 分钟自由配置(0 关闭)
- 免费标注 —— 设置页中免费引擎带绿色
FREE徽章,付费引擎带橙色API KEY徽章 - 网页抓取(web_fetch) —— 让 agent 抓取网页内容(官方
dsh-web-fetch-httpprovider,纯 JS,零额外依赖) - 增强抓取(advance_fetch,实验性 · 免费) —— 在 web_fetch 之上的插件自有工具,零 key、零按次计费(区别于按次计费的付费搜索 API):整页转 GitHub-Flavored Markdown(转换配置与宿主 tool-web 同款复刻:不可见节点整体剔除、GFM 表格不展开跨列),并支持 CSS
selector限定范围与fields(label=selector|attr,分号分隔)定向结构化抽取——只要页面的一部分时优先用它。依赖插件自带(turndown + @joplin/turndown-plugin-gfm + cheerio),不碰宿主内部面;输出经门户页脏面清洗(javascript: 等伪协议链接只留文本、布局表全空管道行丢弃、表格内<br>归一为 " / "、行边界截断不留残句/不拆代理对/不留未闭合代码围栏);相对链接按最终 URL 自动绝对化并剥离 utm/gclid/fbclid 等跟踪参数;GBK/GB2312 等非 UTF-8 老站按声明字符集解码(header → BOM → meta charset 探测);200 状态的反爬挑战页(captcha/验证码等文案 + 近空正文)识别为失败而非当正文;RSS/Atom 按文本透传;登录墙/纯客户端渲染站只返回壳并附 note 提示。抓取身份可配置:设置页可自定义 User-Agent、Referer 与按域 Cookie(逐行域名 cookie串,仅在抓取目标匹配该域时附带、重定向换域不外流)——凭据只存设置页,勿在对话中粘贴。导航密集型门户页建议优先用 selector/fields 定向抽取;仅 http/https,重定向限 5 跳逐跳复检,SSRF 地址门默认拒绝回环/内网/云元数据地址(advanceFetchAllowPrivate可显式放行局域网设备),抓取内容包进不可信边界 - 按需帮助(search_fetch_tool_manual) —— 转换分派(HTML/JSON/RSS 透传、字符集探测、跟踪参数剥离、输出上限与截断)、fields 语法、引擎清单(读当前设置生成,不另立第二份真相)、抓取身份(自定义 UA/Referer/按域 Cookie)与故障形态,都可按工具名或主题号在
search_fetch_tool_manual查询;各工具描述只留短说明,不再把长规则平铺在每轮都付费的 schema 面里。 - 反馈内说明(note 通道) —— 与本次调用直接相关的局限随结果 note 返回:平台局限(如 v2ex 取热榜后本地过滤,不是站内全文)、某视频源空返、vimeo 搜索页空结果退回站内搜索、无结果、引擎成败清单等;
advance_fetch首次在会话内被调用时还会附一句指向手册的提示。指导类文字按「同会话同工具只发一次」去重——工具返回值进的是会话历史,每次调用都附等于把同一段说明复制多份,而首触一次既有「调用即得」的时机又不产生副本。 - 平台搜索(platform_search) —— 搜 GitHub / V2EX / B站 / Reddit / Hacker News / Stack Overflow / 维基百科 / npm / YouTube / Vimeo(公开 API 或免 key 抓取,零依赖)
- 视频搜索(video_search) —— 跨站找视频:Bing Videos + DuckDuckGo Videos(免 key,失败互相回退),返回视频链接、标题与来源/时长等元信息
- 干净集成 —— 实现官方
WebSearchProviderseam 接口,与官方插件共存 - 设置桥准入(0.19.0) —— 设置页「设置桥只接受本机回环请求」开关(
bridgeRestrictLoopback,默认关)。插件的 12 条设置桥路由(/api/dsh-union-search-settings/*,设置页与卡片用它读写配置)原本只接受字面回环请求,在反向代理部署下必然 403(网关地址 + 公开域名两条都判否)。现在主闸交给宿主自己的请求鉴权:0.2.3+ 走webserver/authorize瀑布(路由声明auth: 'required',浏览器登录态 cookie + SameSite=Strict 同时挡住 CSRF),0.1.2-rc.1…0.2.2 走connection.requestRejection——于是反代下设置页恢复可用,且校验比回环更严。默认不再限制回环;需要额外加固时开启本开关(非回环请求即使带合法 cookie 也 403)。安全底线:宿主若既无webserver/authorize也无requestRejection(0.1.0-rc.7 / 0.1.1),则无论开关如何都强制回环并 warn 一次——宁可反代不可用,不可裸奔。 - 屏蔽系统自带搜索 —— 设置页「屏蔽系统自带搜索」开关(
blockSystemSearch):开启后强制接管web_search,并把出厂官方搜索引擎deepseek-official/ rc.2 起的deepseek-search-api从所有引擎链与接管判据中剔除;保存即生效 - SearXNG 返回语言可锁定 —— 设置项
searxngLanguage(默认auto):自动档按 query 文字检测(假名→ja、谚文→ko、西里尔→ru、汉字→zh-CN,判不出落设置页语言兜底);选具体值(zh-CN/zh-TW/en/ja/ko/ru/de/fr/es/all)则锁定不随 query 变化;非法 locale 自动归一防 400 - SearXNG 多实例综合 —— 自定义列表配置 ≥2 个端点时,自动向前两个端点并发双发请求,等两份请求都返回后按 URL 合并去重,双实例共同命中的条目优先;两个都失败才顺序回退剩余实例
如果这个插件帮到了你,欢迎给仓库点个 ⭐(GitHub)——星标是开发者继续维护的最大动力,感谢支持!
引擎列表
共 68 个可用引擎(另含 1 个仅登记、暂不发请求的 blocked 档
so_51cto,以及 1 个虚拟路由模式auto,均不计入可用数)。按计费:免费免 key 35 · 送额度 freemium 17 · 纯付费 paid 17;其中 51 个免 API Key 即可用、9 个为浏览器升级档(借助dsh-browser-cdp复用已登录浏览器会话抓取,无需任何搜索 API key)、10 个为垂直槽引擎(news/baike/wiki/image/video/dev)。下表依据源码src/engines/tags.ts的ENGINE_TAGS单一真源整理。
虚拟模式
| id | 引擎 | 费用 | 说明 |
|---|---|---|---|
| auto | Auto 智能路由 | 动态 | 非真实引擎:按查询语言/时间条件自动选路(中文优先 Bing/Baidu/Aliyun/AnySearch,英文优先 Bing/Exa/Tavily;时间过滤优先支持引擎),末尾全量回退 |
免费开箱即用 · 网页档(免 key)
| id | 引擎 | 费用 | 说明 |
|---|---|---|---|
| bing | Bing | 免费 | 默认引擎,最稳定,中文优化(zh-CN) |
| ddg | DuckDuckGo HTML | 免费 | 偶发限流(反爬),解封自动恢复 |
| ddg-lite | DuckDuckGo Lite | 免费 | 轻量版,同上 |
| searxng | SearXNG 元搜索 | 免费 | 实例三态严格互斥(公网池 / 本地 Docker / 自定义列表);≥2 端点并发双发综合;按 query 文字判返回语言;聚合网页 + 维基卡片 + 直接答案 |
| anysearch | AnySearch AI | 免费 | AI 搜索,无 key(匿名额度) |
| so360 | 360 搜索 | 免费 | 免 key HTTP 直连 |
| degoog | Degoog | 免费 | 自建实例池(需自行部署);无实例 = 跳过不失败;实例级冷却,支持时间过滤 |
| wechat | 微信(搜狗) | 免费 | 免 key HTML SERP;/link 签名链单次有效;默认关 / 显式专用 |
| toutiao | 头条搜索 | 免费 | 免 key HTML SERP;JSON island 正反序双扫;默认关 / 显式专用 |
| agy | agy(反重力 CLI) | 免费(本地) | 本机 CLI 免 key;commandOnPath 门控;无 CLI 跳过;不进 auto 链 |
| mwmbl | Mwmbl | 免费 | 开源小网站索引,JSON;reserve 池、rps 1.0 |
免费 / 送额度 · AI 搜索(无 key 也有匿名额度)
| id | 引擎 | 费用 | 说明 |
|---|---|---|---|
| exa | Exa | 免费额度 | 无 key 也可用(MCP 匿名),配 key 提升额度 |
| tavily | Tavily | 免费额度 | 无 key 也可用(keyless 匿名),配 key 提升额度 |
| keenable | Keenable | 免费额度 | 无 key 也可用(MCP 匿名),配 key 提升额度 |
| firecrawl | Firecrawl | 免费额度 | 无 key 也可用(官方免 key 匿名额度),配 key 提限额 |
| parallel | Parallel | 免费额度 | 无 key 也可用(官方 MCP 匿名额度),配 key 支持精确时间过滤 |
外源免费 SERP(0.40.0 对齐移植)
| id | 引擎 | 费用 | 说明 |
|---|---|---|---|
| yahoo | Yahoo | 免费 | 外源移植;r.search.yahoo.com /RU= 跳转壳需解;外网档 |
| yahoojp | Yahoo! JAPAN | 免费 | 外源移植;时间档 vd=d\|w\|m1\|y |
| seznam | Seznam | 免费 | 本机实测 200;结果在 script#renderer-state-data JSON |
| naver | Naver | 免费 | 本机实测 200;正文含 h-captcha 须走 fetchRaw |
| daum | Daum | 免费 | 外源移植;立方卡 + 经典列表兜底 |
垂直槽引擎(news / baike / wiki / image / video / dev)
| id | 引擎 | 槽 | 费用 | 说明 |
|---|---|---|---|---|
| so360-news | 360 新闻 | news | 免费 | news.so.com 免 key,偶发反爬 |
| googlenews | Google News | news | 免费 | RSS 2.0;时间档走 q 的 when: |
| so360-baike | 360 百科 | baike | 免费 | baike.so.com/doc 直链免 key |
| wikipedia | Wikipedia | wiki | 免费 | list=search API,需自定义 UA(无 UA 429) |
| so360-image | 360 图片 | image | 免费 | image.so.com JSON 通道免 key |
| bilibili | 哔哩哔哩 | video | 免费 | 本机实测 code=0,video 组 20 条,mp4 直链 |
| sogou-video | 搜狗视频 | video | 免费 | v.sogou.com/v 直连,/vc/np 解真链;偶发反爬需 cookie 复用 |
| stackoverflow | Stack Overflow | dev | 免费 | api.stackexchange.com 直连,配额在 body |
| csdn | CSDN | dev | 免费 | so.csdn.net JSON 直连;页面为 SPA 壳不可抽;并发 ≤2 |
| so_51cto | 51CTO | dev | 免费(blocked) | _0x 混淆 + EO_Bot_Ssid 反爬壳,仅登记不发请求 |
浏览器升级档(browser-free · 需配合 dsh-browser-cdp 作受体)
| id | 引擎 | 费用 | 说明 |
|---|---|---|---|
| baidu_browser | 百度(浏览器档) | 免费 | 有头浏览器 + cookie 复用 |
| so360_browser | 360(浏览器档) | 免费 | 冗余通道,仅显式点名 |
| sogou_browser | 搜狗(浏览器档) | 免费 | 图片点选验证码,人工过一次后 cookie 复用 2–3 次 |
| yandex_browser | Yandex(浏览器档) | 免费 | 有头 + 代理可过;无头必撞 SmartCaptcha |
| mojeek_browser | Mojeek(浏览器档) | 免费 | 人工过一次验证码后可用 |
| ecosia_browser | Ecosia(浏览器档) | 免费 | 人工过一次验证码后可用 |
| brave_browser | Brave(浏览器档) | 免费 | 主结果为 /go/v1 跟踪壳,仅 cluster 卡带真 href |
| google_browser | Google(浏览器档) | 免费 | udm=14 Web 档;无头命中 reCAPTCHA 明确报 bot-wall,显式点名才跑 |
| google_hk_browser | Google HK(浏览器档) | 免费 | 显式落 HK 域,区别于被重定向 |
付费专业搜索 API(需 key)
| id | 引擎 | 费用 | 说明 |
|---|---|---|---|
| perplexity | Perplexity | 付费 | 需 PERPLEXITY_API_KEY |
| serpbase | SerpBase | 免费额度 | 需 SERPBASE_API_KEY(注册送 100 次) |
| serply | Serply | 免费额度 | 需 SERPLY_API_KEY(新账户 30 天内 2,500 次);Google 网页结果 |
| brave_api | Brave API | 免费额度 | BRAVE_API_KEY($5/1000 次);freshness 四档;与 brave_browser 并存 |
| serper | Serper | 免费额度 | SERPER_API_KEY(注册送额度);鉴权头 X-API-KEY;tbs 四档 |
| outcrawl | Outcrawl | 付费 | OUTCRAWL_API_KEY;POST + Bearer,无时间参数 |
| google | Google CSE | 免费额度 | GOOGLE_CSE_API_KEY + googleCseId(cx);$5/1000 且 100 次/日免费;缺 cx 报明确错 |
| yandex_api | Yandex API | 付费 | YANDEX_API_KEY + yandexFolderId;Authorization: Api-Key;显式专用 |
| yuanbao | 腾讯元宝 WSA | 付费 | YUANBAO_API_KEY;start/end 时间窗;国内直连;显式专用 |
| specstream | Specstream | 付费 | SPECSTREAM_API_KEY;Bearer;无时间参数;显式专用 |
| tapline | Tapline | 付费 | TAPLINE_API_KEY;x-api-key;只走 freshness;显式专用 |
| tinyfish | TinyFish | 付费 | TINYFISH_API_KEY;after_date(YYYY-MM-DD) |
| jina | Jina Reader | 免费额度 | JINA_API_KEY;Bearer;无时间参数 |
| deepseek-tools | DeepSeek 原生搜索 API | 付费 | 需 DEEPSEEK_API_KEY;直接 POST /v1/tools/search 无模型参与,同 query 实测 ~0.3s;透传 rerank_score/authority |
| deepseek-official | DeepSeek 官方 | 付费 | 需 DEEPSEEK_API_KEY;Search $0.75/千次成功请求 |
| you | You.com | 免费额度 | 需 YOUCOM_API_KEY(注册即送免费额度) |
| baidu | 百度千帆 AI 搜索 | 免费额度 | 需 BAIDU_API_KEY(每日赠 50 次);中文全网,支持时间过滤 |
| kimi | Kimi(Moonshot)联网搜索 | 付费 | 需 MOONSHOT_API_KEY(约 ¥0.01/次),带正文 chunks |
| aliyun | 阿里云百炼 EnhancedSearch | 免费额度 | 需 DASHSCOPE_API_KEY(新用户 200 次免费包);中文全网带来源 hostname |
| doubao | 火山引擎联网搜索(豆包搜索) | 免费额度 | 需 DOUBAO_SEARCH_API_KEY(每月 500 次免费);中文时效内容强 |
| zhihu_global | 知乎全网搜索(开放平台 MCP) | 付费 | 需 ZHIHU_API_KEY;支持时间过滤 |
| zhihu_site | 知乎站内搜索(开放平台 MCP) | 付费 | 需 ZHIHU_API_KEY;不支持时间过滤 |
| zhipu | 智谱 Web Search | 付费 | 需 ZHIPU_API_KEY(普通平台 Key);可经 zhipuEngine 切档;支持时间过滤 |
| bocha | 博查 AI 搜索 | 免费额度 | 需 BOCHA_API_KEY(注册送额度);DeepSeek 官方供应方,中文强 |
| metaso | 秘塔 AI 搜索 | 免费额度 | 需 METASO_API_KEY(注册送 5000 点);多模态(metasoScope) |
模型内置搜索(按次计费 · 仅显式选中,不参与自动回退)
| id | 引擎 | 费用 | 说明 |
|---|---|---|---|
| openai | OpenAI 模型内置搜索 | 付费 | 需 OPENAI_API_KEY;Responses API web_search;默认 gpt-6-luna(可配) |
| gemini | Gemini Grounding with Google Search | 付费 | 需 GEMINI_API_KEY;Interactions API;默认 gemini-3.8-flash(可配) |
| claude | Claude 服务端 web_search | 付费 | 需 ANTHROPIC_API_KEY;结果来自 web_search_tool_result;默认 claude-sonnet-5-5(可配) |
| grok | Grok · X (Twitter) 搜索 | 付费 | 需 XAI_API_KEY;xAI Responses API x_search;默认 grok-4.2(可配) |
- 默认引擎为
bing(免费且最稳定),安装后开箱即用。 - 自动回退:任何引擎失败(免费限流/反爬,付费缺 key/无效/网络错误)都会自动轮流尝试下一个引擎——先试其他已配 key 的付费引擎,再试免费引擎(Bing/AnySearch 等),并在结果中附带回退提示——搜索不会因引擎问题直接失败。
- 设置页有官网链接:免费引擎显示"访问官网 →",付费引擎显示"获取 API Key →"(新标签页打开):
- Exa:https://dashboard.exa.ai/api-keys
- Tavily:https://app.tavily.com/home
- Keenable:https://keenable.ai/login
- Parallel:https://platform.parallel.ai
- Perplexity:https://www.perplexity.ai/settings/api
- SerpBase:https://serpbase.dev
- Serply:https://serply.io(API 文档:https://serply.io/docs)
- DeepSeek:https://platform.deepseek.com/api_keys
- 豆包搜索(火山联网搜索):https://console.volcengine.com/search-infinity/web-search
- You.com:https://you.com/platform/api-keys
- 智谱:https://bigmodel.cn/usercenter/proj-mgmt/apikeys
- 博查:https://open.bochaai.com
- 秘塔:https://metaso.cn
- xAI(Grok):https://console.x.ai
为什么免费引擎不需要 key?
- AnySearch:其
v1/searchREST 接口提供匿名的公共搜索额度,无需注册或 API key。额度有限流(适合日常搜索),但作为免费引擎之一,与其他免费引擎互相回退,体验稳定。 - Exa:公开 MCP 端点(
mcp.exa.ai/mcp)支持匿名调用,不配 key 也能用;配置EXA_API_KEY后可获得更高额度。 - Tavily:通过
x-tavily-access-mode: keyless头走 keyless 匿名额度,不配 key 即可用;配置TAVILY_API_KEY后走账号档,额度更高、结果质量更稳定。 - Keenable:无 key 时走其公开 MCP 端点(
api.keenable.ai/mcp)匿名调用;配置KEENABLE_API_KEY后走 REST API(api.keenable.ai/v1/search),额度更高、按组织限流。 - Firecrawl:其
/v2/search端点无需 key 即可使用(官方文档明确说明,有匿名限流);配置FIRECRAWL_API_KEY后可提高限额。支持tbs时间过滤(qdr:h/d/w/m/y与自定义日期区间)。
DeepSeek 官方定价(2026-10,以官方定价页为准)
搜索/抓取是独立按请求计费的 API(与模型 token 费分开):
| API | 计费单位 | 价格 | |---|---|---| | Search(联网搜索) | 每 1,000 次成功请求 | $0.75(≈ 单次 ¥0.005・5 厘 @汇率7.1) | | Fetch(网页抓取) | 每 1,000 次成功请求 | $0.75(≈ 单次 ¥0.005・5 厘 @汇率7.1) |
注:通过 DeepSeek Harness(本宿主)/ Claude Code / Codex 调用时,服务端工具已经会命中 Search/Fetch API;这部分目前免费,自 2026-11-01 00:00(北京时间)起按次计费。本插件的
deepseek-official引擎走同一价目表;这也是「屏蔽系统自带搜索」开关存在的背景之一——如果你不想为出厂搜索付费,用免费引擎即可。
模型 token 定价(每百万 tokens,平峰/高峰,1 美元计价):
| 模型 | 输入(缓存命中) | 输入(缓存未命中) | 输出 |
|---|---|---|---|
| deepseek-flash | $0.003 / $0.006 | $0.15 / $0.30 | $0.60 / $1.20 |
| deepseek-v4-pro | $0.022 / $0.044 | $0.66 / $1.32 | $1.98 / $3.96 |
高峰时段为周一至周五 UTC 01:00–04:00、06:00–10:00(中国法定节假日除外),其余时段均为平峰,平峰价是高峰价一半。数据来源:https://api-docs.deepseek.com/quick_start/pricing。
安装
# npm(推荐,0.10.15+ 统一裸名)
dsh plugin --profile web add dsh-union-search
# 或从源码/本地 tgz 安装
git clone https://github.com/drscrewdriver/dsh-union-search.git
dsh plugin --profile web add /path/to/dsh-union-search注意:包名统一为裸名 dsh-union-search(scoped @drscrewdriver/dsh-union-search 自 0.10.15 起停止维护)。
DSH 以「bundle 行名 == 包内 name」判定客户端半(dsh-client-modules:locatePkgJson -> nearestPackage),
历史 scoped 安装升级到新版请用裸名重装(dsh plugin remove 后按裸名 add);插件已持久化设置(API key/引擎开关)以条目 id 为键,改名重装会重置,需重新配置(0.10.15 维护决策,2026-10-24 确认)。
然后重启:
dsh web接管行为与验证
插件加载后自动接管搜索(运行时接管,不改配置层):
web.searchProvider未设置,或仍是 DSH 出厂默认的官方搜索时,自动切换为本插件的 provider(id 固定为ddg);出厂默认在 0.2.1-rc.2 起有两个 id——deepseek-official(Messages 服务端 web_search)与deepseek-search-api(新内置的 Search/Fetch 独立 API),两者都会被识别并接管;0.2.2-rc.5 起宿主不再把默认写进配置,而是按模型路由自选(见下方 rc.5 说明),所以"未设置"成为常态,本插件照旧接管;- 如果(你或别的插件)已显式选择其他 provider,本插件不抢占,只在启动日志输出 WARN 与切换用的 YAML;
- 设置页开启「屏蔽系统自带搜索」(
blockSystemSearch: true)后,无论web.searchProvider指向谁,都强制接管为本插件 provider,且deepseek-official引擎被从所有引擎链中剔除;保存即生效,无需重启。
不再往配置里写 searchProvider: ddg:静态覆盖曾导致"悬空引用"——patch 是整段覆盖 config,一旦插件那一行被停用或跳过(比如在插件管理器里关掉),配置仍指向 ddg 而没有任何东西注册它,于是每次搜索都失败:
Error: configured web provider "ddg" is not registered现在没有这层覆盖:插件被停用时 web.searchProvider 保持官方默认(deepseek-official),搜索至少还能走官方通道;插件启用时由上面的运行时接管切到 ddg。
0.2.1-rc.2 机制变化:宿主删掉了可写的运行时选择字段,改为每次调用读
web条配置的 volatile 值(未配置且多个可用 provider 时报WEB_PROVIDER_AMBIGUOUS)。本插件能力探测分流:≤rc.1 仍走内存接管(非持久);rc.2+ 经 settings 服务把web.searchProvider: ddg钉进条配置(持久)——若后续停用本插件,记得删掉该字段(或拨回官方开关),否则宿主会响亮报CONFIGURED_MISSING;不想手动改可以直接跑随包的清理器:node node_modules/dsh-union-search/bin/restore.js --apply(0.11.6+,扫描各 profile 的cordis.patch.yml只删本插件钉选的那行,默认 dry-run);blockSystemSearch开启时同步把fetchProvider钉回http(web_fetch 保留,钳离按次计费的deepseek-fetch-api;你若显式指定了第三方 fetch provider,则不动它)。
0.2.2-rc.5 机制变化(重要,失败形态变了):宿主把
- id: web里写死的searchProvider: deepseek-search-api删掉了,只留fetchProvider: http,改成"未配置就按模型请求的路由自选"——deepseek-official/deepseek-account两条路由选deepseek-official(服务端 Messages 搜索,不按次计费),其余路由和无模型请求选deepseek-search-api。 对本插件的三个后果:①接管判据不受影响(未设置 → 仍是本插件的接管分支,ddg两种出厂 id 仍在白名单内);②钉选变得更要紧——一旦settings.mutate没落地(settings 服务尚未挂载时本插件会延迟重试),web_search不再报WEB_PROVIDER_AMBIGUOUS,而是静默走官方通道,看起来像"插件没生效"却没有任何错误;③设置页的搜索 provider 菜单多出一个「自动」项(AUTO_ID空串),选中它会resetField清掉searchProvider覆盖,于是本插件的钉选被解除、搜索回到官方通道——这不是 bug,是官方新语义,但要知道点了什么。 自查:日志里出现union-search: pinned web entry config searchProvider=ddg才算接管成功;只有出现settings service not ready/could not pin才是没落地。
接管残留自动回收(0.16.0)
上面 CONFIGURED_MISSING 悬空的根因是「rc.2+ 唯一接管通道 settings.mutate 会落盘到 cordis.patch.yml」。0.16.0 起在「写」的两端自动补救,三种场景各有覆盖:
- 停用插件 = 自动清:
autoRestoreOnDispose(默认开)开启时,本插件在停用/dispose 时自动unset它自己写进web条目的searchProvider/fetchProvider钉选行——只删自己写过的值(回滚前比对当前值 === 写入值),你后来手改成别家 provider、或本就不是本插件写的,一律不动。 - 上次没清干净 = 启动自检:崩溃/断电等未走 dispose 的情况,下次启动会在接管动作前自检当前钉选态:命中本插件旧 id(如改名前的
web-search-free)即安全清除;命中能解析到已注册 provider 的外部 id(你显式选的第三方)→ 静默不动;命中解析不到的悬空 id(别的已卸载插件留的)→ 打 ERROR 级日志给出修复命令,但不自动删(删别人的配置风险高于提示)。 - 卸载 = 需手跑
bin/restore.js --apply:pnpm remove之后插件代码已不在磁盘上,任何钩子都不会执行——这是执行模型的物理边界,无法靠开关绕过。卸载前请先在设置页关掉接管,或卸载后跑一次node node_modules/dsh-union-search/bin/restore.js --apply(0.11.6+,只删本插件钉选行,默认 dry-run)。
自检结论会反映到设置页「屏蔽系统自带搜索」抽屉底部的接管状态行(正常 / 悬空残留 / 外部占用),autoRestoreOnDispose 关掉后回滚登记与自检清除都停用,仅保留检测与提示。
如果你曾按旧文档手动在
profiles/<profile>/cordis.patch.yml里加过下面这段,而插件没有启用,就会看到上面那条错误——删掉这段即可(或重新启用插件):
# 可选,通常不需要:只有你想强制指定时才加。
# DSH 0.1.2+ 的 patch 是"整段覆盖 config",必须保留 fetchProvider。
- id: web
config:
searchProvider: ddg
fetchProvider: httpsearchProvider: ddg—— 本插件的 provider id(固定值),不是"使用 DuckDuckGo 引擎";用哪个引擎由设置页的provider字段决定(bing/baidu/auto/…)。fetchProvider: http—— 官方网页抓取(web-fetch-http),手动声明时必须保留。- 想改用官方搜索:在插件管理器里停用本插件条目即可,不需要改配置。
依赖说明
插件对 @deepseek-ai/dsh-settings 和 @deepseek-ai/dsh-tools 使用 peerDependencies,这是刻意的:DSH 运行时必须使用安装树中的唯一实例。请通过 dsh plugin --profile <profile> add ... 安装插件,不要把 DSH 核心包复制进 profile 的本地 node_modules;重复副本会导致工具调度器失效。
使用
网页设置(推荐)
安装后打开配置页(DSH 0.1.7-rc.1+):
- 左侧 插件 页 → 已安装 分组 →
union-search→ 点击组件行web-search-free(行内"配置"入口)
配置页提供:
- Search engine:下拉框切换引擎,保存即生效
- API keys:为 Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek / SerpBase / Serply / You.com 填写 key(密码框,保存后只显示"已配置";Exa / Tavily / Keenable / Firecrawl / Parallel 不填也可免 key 使用)
- 推荐:付费引擎 key 建议写入 harness 凭据中心
~/.dsh/.credentials.yaml(如DEEPSEEK_API_KEY: sk-...,与官方 LLM provider 一致,一处管理所有 key)。插件读取优先级:凭据中心 > 设置页 > 环境变量,设置页填的 key 仅作为遗留兼容。
- 推荐:付费引擎 key 建议写入 harness 凭据中心
- Test engine:直测当前引擎可用性(不走回退链,付费引擎无 key 会明确报错)
- Use Bing default:把当前搜索引擎切回稳定的免费 Bing;
Discard只撤销尚未保存的编辑 - Platform search:勾选启用 GitHub / V2EX / Bilibili / YouTube / Vimeo 平台搜索(
platform_search工具按此过滤) - EN / 中文:切换界面语言(默认中文)
聊天框切换引擎(/union-search-engine)
不用进设置页也能切换引擎:在聊天框输入 /union-search-engine,弹出引擎选择窗口(和 /model 选模型一样的交互),点选即切换,当前引擎会标记出来。等效于设置页切换 + 保存,且界面语言跟随设置页(中文/英文)。
命令只改首选引擎配置,搜索仍走 web_search + 统一回退链:即使首选引擎挂了也会自动换其他引擎,永不直接失败。系统提示词同步刷新。
引擎开关、回退优先级与 Multi 模式
设置页有三个新块(都会保存进条目 config):
- 全局启用的搜索引擎:取消勾选后,该引擎会从普通
web_search回退链、Auto 智能路由、advanced_search、multi_search、引擎测试、系统提示词的引擎清单以及search_fetch_tool_manual的engines主题输出中全局排除(手册只报「已启用 id」,不再倒出全部已知 id);至少要保留一个引擎。 - 全局回退优先级:用 ↑↓ 调整先后顺序。首选引擎仍先尝试;Auto 保留"语言/时间"路由规则,但自定义后同一分组内及后续回退按此顺序。被禁用的引擎保留在列表里(标记「已禁用」)但不执行;「恢复默认顺序」一键还原。
- 搜索引擎下拉里的
Multi Search:选中后web_search会并发查询路由/优先级前 3 个已启用引擎,URL 去重合并、跨源命中的结果排前面。注意并发会成倍消耗额度;Multi 失败时会自动退回普通单引擎回退链并在结果里注明。
失败分类与引擎冷却(Failure-aware fallback)
回退链不再把所有失败一视同仁,而是先给失败分类(issue #36):
quota(额度/预算耗尽,HTTP 402 /NO_MORE_CREDITS/ SerpBase 免费额度用尽):立即切换,并把该引擎在本进程内冷却——后续搜索不再尝试它,避免反复撞墙;auth(401/403、key 无效或未配置):同上,冷却到本会话结束(改好 key 重载插件即恢复);bot-wall(如 DDG 反爬挑战):冷却一小段(默认 60s)后再自动放回链中;transient(超时 / 5xx / 网络 / 429 限流):同一引擎重试一次再回退,避免一次抖动就丢掉好引擎;invalid-response(解析失败 / 结构变化 / 返回 0 结果):照常回退,但归类为插件侧问题,不冷却引擎。
回退结果的 Note: 现在会给出具体类别,例如 Note: exa is out of quota, using doubao.、Note: perplexity is misconfigured (API key rejected), using doubao.、Note: bing failed (transient), using doubao.。free_search_test 也会为每个失败引擎附上类别(failureClass)。
冷却只作用于本进程(重载插件或重启即清空),且对配置的首选引擎同样适用:若它正在冷却,本轮会跳过并回退,结果里注明 is cooling down;冷却中的引擎一旦成功即自动解冻。
fallbackOn 控制哪些失败类别允许触发回退:默认勾选全部六类,即当前的「搜索永不直接失败」;取消某类后,遇到该类失败会停下并把该引擎的错误报出,不再换引擎(例如去掉 invalid-response:首选引擎返回空/解析失败时直接报错,而不是静默退回低质引擎)。设为空数组 [] 则任何失败都立即中止。注意缺 key、被禁用、不支持时间过滤不算失败,无论怎样都照常换引擎。设置页有对应勾选框,也可在 config 写 fallbackOn: [quota, auth, bot-wall, transient, invalid-response, unknown]。
配置文件
DSH 0.1.7-rc.1 起,配置跟随 profile 的插件条目保存:设置页与 /union-search-engine 都会写入当前 profile 的 cordis.patch.yml 中 web-search-free(dsh-union-search)条目的 config。
旧版 ~/.dsh/settings.yaml 的 free-search: 段不会被 DSH 核心自动导入(核心的 importLegacyDocument 只为 ui-developer-tools / ui-onboarding / shell 三个段提供了映射),原文件在导入其它段后会被改名为 settings.yaml.imported,该段的值只留在那里。插件会在启动时检测 settings.yaml.imported(或仍存在的 settings.yaml)中的 free-search: 段,把可识别的字段一次性补种进当前 profile 的条目 config(写一次后不再重复,可在启动日志看到 free-search: migrated N field(s)…)。如果你想手动处理,也可以照着 settings.yaml.imported 里的值在插件页行配置中填一遍。
# profiles/<profile>/cordis.patch.yml 中该条目的 config:
provider: bing # ddg / ddg-lite / bing / searxng / anysearch / exa / tavily / keenable / firecrawl / parallel / perplexity / serpbase / serply / deepseek-official / you / baidu / kimi / aliyun / doubao / openai / gemini / claude / auto / multi
blockSystemSearch: false # true = 屏蔽系统自带搜索:强制接管并把 deepseek-official/search-api 移出引擎链
advanceFetchEnabled: true # false = 拒绝 advance_fetch 调用(热生效)
fetchTakeover: false # true = 注册并钉选 web.fetchProvider = union-search,接管宿主 web_fetch 出口(需宿主 ≥0.2.1-rc.2)
browserFetchTier: false # true = 登录墙/反爬/JS 空壳页命中时借 dsh-browser-cdp(≥1.15.0)的已登录浏览器重抓(带 cookie,默认关)
browserFetchAllowHosts: "" # 升级档域名白名单(逗号分隔后缀,含子域);空 = 不限制(仍受总开关)
advanceFetchAllowPrivate: false # true = 放行 advance_fetch 访问回环/内网(局域网设备场景;协议/重定向门不变)
bridgeRestrictLoopback: false # true = 设置桥额外要求字面回环(反代部署将不可用);默认 false = 主闸交给宿主登录鉴权
advanceFetchUserAgent: "" # 空 = 内置默认 UA;可自定义用于按 UA 拦截的站
advanceFetchReferer: "" # 空 = 不发 Referer;可配防盗链图床/接口解锁
advanceFetchCookieMap: "" # 逐行 `域名 cookie串`(# 注释),如 weibo.com SUB=xxx;仅在目标匹配该域时附带,重定向换域不外流
searxngLanguage: auto # SearXNG 返回语言:auto=按 query 检测;显式值=锁定(zh-CN/zh-TW/en/ja/ko/ru/de/fr/es/all)
fallbackOn: [quota, auth, bot-wall, transient, invalid-response, unknown] # 允许触发回退的失败类别;[] = 任何失败都立即中止(默认全部)
lang: zh # 设置页界面语言(zh / en)
bingMarket: zh-CN # Bing 市场
region: cn-zh # DuckDuckGo 区域(可选)
searxngInstances: # 自定义 SearXNG 实例(可选)
- https://your-instance.example
exaApiKey: ... # 或通过设置页填写
tavilyApiKey: ... # 或通过设置页填写
keenableApiKey: ... # 或通过设置页填写
firecrawlApiKey: ... # 或通过设置页填写
parallelApiKey: ... # 或通过设置页填写
perplexityApiKey: ...
serpbaseApiKey: ... # 或通过设置页填写
serplyApiKey: ... # 或通过设置页填写
deepseekApiKey: ...一键测试全部引擎
设置卡底部点「测试全部引擎」,host 端逐个测试并列出结果;失败的引擎会进入建议禁用清单(默认全勾选),取消勾选不想禁用的项后点「应用禁用」再保存即可。暂时性故障(CAPTCHA/限流)可以跳过不禁用,日后随时可在引擎勾选区恢复。
时间过滤(advanced_search)
让 agent 搜"最近一周的新闻"、"这个月的发布"、"最近 3 天的消息"、"7 月以来的更新",它会调用 advanced_search 工具,带 timeRange 参数。该工具同样走统一回退链,且可显式指定 engine,返回结构同 web_search。
timeRange 支持三种形式:
| 形式 | 示例 | 含义 |
|---|---|---|
| 固定档 | day / week / month / year | 分别 = 1 / 7 / 30 / 365 天 |
| 自定义相对值 | 12h、3d、2mo、1y | 最近 12 小时 / 3 天 / 2 个月 / 1 年 |
| 绝对日期 | 2026-07-01 | 该日期(含)之后发布的结果 |
各引擎对 timeRange 的处理逻辑:
| 引擎 | 参数 | 是否精确 | 说明 |
|---|---|---|---|
| Exa | startPublishedDate | ✅ 精确 | 自定义天数转成 ISO 日期(N 天前),绝对日期原样传入 |
| Keenable | published_after | ✅ 精确 | 相对值原样传(12h/3d/2mo/1y),绝对日期原样传 |
| Tavily | time_range | ⚠️ 近似 | 只认固定档,自定义天数自动映射到最近似档位 |
| Firecrawl | tbs | ⚠️ 近似 | 固定档映射到 qdr:d/w/m/y;绝对日期用 cdr:1,cd_min:M/D/YYYY(精确) |
| Parallel | source_policy.after_date(有 key 时精确);无 key 走 MCP,无日期参数,改为把窗口写进 objective 作为新鲜度提示(软过滤) | ✅ 精确 / ⚠️ 软过滤 | 自定义天数转成 ISO 日期(N 天前),绝对日期原样传入 |
| SearXNG | time_range | ⚠️ 近似 | 同上 |
| DuckDuckGo / Lite | df | ⚠️ 近似 | 同上 |
| Bing / AnySearch | — | ❌ 忽略 | 无对应参数 |
"最近似档位"映射规则:≤2 天 → day,≤14 天 → week,≤90 天 → month,否则 year。例如 3d 在 Tavily 上按 day 处理,2mo 按 month 处理。
引擎链优先级:当带 timeRange 搜索时,支持时间过滤的引擎(tavily / exa / keenable / firecrawl / parallel / searxng / ddg / ddg-lite)会排到引擎链前面,确保过滤真正生效——即使首选引擎是 bing(不支持过滤),也会先尝试支持过滤的引擎。
示例对话:"帮我搜最近 3 天关于 DSH 的新闻" → agent 调用 advanced_search,timeRange: "3d"。
多源并发合并搜索(multi_search)
当需要对重要问题做多源交叉验证、避免单一引擎偏差或单源死锁时,可以让 agent 调用 multi_search 工具:
- 并发请求:默认基于当前查询类型并发请求前 3 个优选引擎(或显式传入
engines列表),各引擎独立解析 API Key 与容错(缺 key 引擎自动跳过,不阻断其他引擎)。 - 去重与合并:按规范化 URL 去除结尾斜杠并合并结果,多引擎共同命中的条目优先置顶排在最前,并在结果附带
seenIn命中来源清单(如[seen in: bing, exa])。 - 不可信边界与清洗:严格遵守
<untrusted-web-content>数据边界,正文 snippet 统一清洗。 - ⚠️ 注:多源并发会消耗更多 API 配额,建议在需要多角度核验时按需使用。
- 同计费上游去重(0.15.0):
deepseek-tools与deepseek-official共用同一个DEEPSEEK_API_KEY(同一账号),multi 模式同时点名两者会双计费;现已自动只保留先点名的一路,被跳过项列在结果 note 的dedupedSameBilling里。
抓取网页内容(web_fetch)
搜索到 URL 后,可以让 agent 读取网页全文(如"打开第一个链接看看内容")。web_fetch 工具已启用(官方 dsh-web-fetch-http provider,免费、纯 JS、零额外依赖):
- 自动跟随重定向、解码正文(HTML 转文本)
- 支持超时和大小限制
- 0.2.1-rc.2+ 宿主新增内置
deepseek-fetch-api选项(Fetch $0.75/千次,2026-11-01 起按次计费):blockSystemSearch开启时会把web.fetchProvider钳制回免费的http(保留抓取、不产生抓取账单;显式指定的第三方 fetch provider 不动) - fetch provider 接管(0.12.0,需宿主 ≥0.2.1-rc.2):设置面开启
fetchTakeover后,本插件注册并钉选web.fetchProvider: union-search,web_fetch改走本插件抓取栈——ALPN 直连 + 宿主同款 Markdown 优化器,正文在插件侧完成转换(kind:text),不再受宿主「先截断后转换」影响(大页只剩标题的 #161 形态);SSRF 地址门/charset 解码/重定向限次同样生效。关闭后自动回落免费http;卸载/停用后的残留钉选可用node node_modules/dsh-union-search/bin/restore.js --apply清理 - 浏览器升级档(0.13.0,需同会话安装 dsh-browser-cdp ≥1.15.0):
fetchTakeover开启后,若直连结果命中登录墙(HTTP 401/403)/反爬挑战/JS 空壳页特征,经 cordis 服务总线调用 browser-cdp 的browser-fetch服务在已登录的 agent 浏览器里开后台 tab 重抓渲染后 DOM,再进同一套优化器出成品 markdown,结果尾部标注「fetched via user browser (session cookies included)」。⚠️ 总开关browserFetchTier默认关:带 cookie 访问由搜索结果(不可信文本)驱动的 URL 是身份泄漏面,建议配合browserFetchAllowHosts只钉登录墙域名;browser-cdp 不在位或服务报错时静默降级回直连形态 - ⚠️ 注意:
web_fetch无 SSRF 防护,agent 理论上可访问内网地址——按需使用
平台搜索(platform_search)
让 agent 搜特定平台,如"在 GitHub 上搜 deepseek harness"、"看看 B站有什么相关视频"、"V2EX 上关于 dsh 的讨论"。platform_search 工具支持:
| 平台 | 用途 |
|---|---|
| github | GitHub 仓库搜索(API,免费无 key) |
| v2ex | V2EX 热门/相关主题 |
| bilibili | B站视频/内容搜索(公开接口) |
| reddit | Reddit 帖子/讨论搜索(公开 JSON API;部分网络环境可能被 Reddit 反爬拦截) |
| hn | Hacker News 技术社区讨论(Algolia 官方 API) |
| stackoverflow | Stack Overflow 技术问答(Stack Exchange 官方公开 API) |
| wikipedia | 维基百科词条(中文环境用 zh.wikipedia.org,lang: en 时切换 en.wikipedia.org) |
| npm | npm 包搜索(registry 官方 API) |
| youtube | YouTube 视频搜索(抓 results 页 ytInitialData,免 key) |
| vimeo | Vimeo 视频搜索(抓搜索页内嵌数据;抓不到时退回网页搜索 site:vimeo.com,免 key) |
公开 API 或免 key 抓取,零外部依赖、无需任何 key。youtube / vimeo 需要先在设置页「平台搜索」里勾选启用。
视频搜索(video_search)
让 agent 找视频:"找几个关于 X 的视频"、"有没有 Y 的教学视频"。video_search 跨站搜索:
| 源 | 说明 |
|---|---|
| bing | Bing Videos(抓 bing.com/videos/search 的 vrhm 元数据,免 key) |
| ddg | DuckDuckGo Videos(vqd + v.js,免 key) |
默认两个源都试、失败互相回退,返回 url / title / snippet(来源站点、时长等)。免 key 抓取,对方改版可能失效;要按站点搜(YouTube / Vimeo / B站)请用 platform_search。
本地引擎切换工具(tools/)
tools/ 目录附带了一个本地切换小工具(零依赖):
启动搜索引擎切换器.cmd(Windows)——双击启动本地 Node 服务(http://127.0.0.1:4789)并自动打开浏览器选择页面switch-engine.html—— 选择页面:显示当前引擎,点选新引擎,一键写入配置server.mjs—— 本地服务,负责读写~/.dsh/profiles/web/cordis.patch.ymlswitch-engine.ps1—— 无界面命令行版:powershell -File tools/switch-engine.ps1 -Engine bing
切换后重启 dsh web 生效。
配置卡片挂在左侧「插件」页的
plugins.row.config行配置插槽(dsh 自带),配置读写走插件自建 bridge,不依赖 dsh-web-ui,插件可独立使用。
代理说明(国内用户)
DuckDuckGo 等引擎可能需要代理才能访问,而 Node.js 的 fetch 默认不走系统代理。需要给 dsh 进程设置(Node 24+):
export NODE_USE_ENV_PROXY=1
export HTTPS_PROXY=http://127.0.0.1:7897 # 你的代理地址
export HTTP_PROXY=http://127.0.0.1:7897Windows 用户:桌面快捷方式已内置此配置(set NODE_USE_ENV_PROXY=1&& set HTTPS_PROXY=...)。
工作原理
lib/index.js:host 端。实现WebSearchProvider(id/available()/search()),统一引擎路由 + 自动回退(付费引擎优先,免费兜底);解析timeRange(固定档/相对值/绝对日期)并透传给各引擎;在web-search-free条目上声明可编辑配置(.volatile())并自带设置页(plugins.row.config);提供/api/dsh-union-search-settings读写桥 +raw-search调试接口;注册free_search_test、platform_search、video_search、advanced_search、multi_search工具;动态注入引擎清单到系统提示词(设置变更时自动刷新)。lib/client.js:浏览器端。React 配置卡片(引擎选择 + key 输入 + 连通测试 + 中英切换),挂载到左侧「插件」页的plugins.row.config行配置插槽;注册/union-search-engine弹出式切换命令(commandUipopupSelect,与/model同机制)。cordis.patch.yml:插件 loader 配置。
English
Why You Need It
dsh's default search provider relies on the official DeepSeek API key (DEEPSEEK_API_KEY). If you:
- Do not have (or prefer not to use) an official DeepSeek key,
- Use a gateway like opencode-go (whose OpenAI-compatible endpoint does not support the
web_searchtool),
...then the built-in search will inevitably fail, and the agent will tell you "I cannot access the internet."
This plugin combines multiple free search engines with many professional paid search APIs and automatic fallback: out of the box it works with zero cost and no DeepSeek key, while paid keys (Perplexity / DeepSeek official / Kimi / Zhipu / Bocha / Metaso / Doubao / You.com / OpenAI / Gemini / Claude / Grok) raise result quality and quotas.
Features
- Free + Paid Union — Multiple zero-cost free engines (no key, no signup) plus many professional paid search APIs (Perplexity / DeepSeek official / Kimi / Zhipu / Bocha / Metaso / Doubao / You.com / OpenAI / Gemini / Claude / Grok); stay at zero cost on free engines, or upgrade quality/quota with paid keys
- Multi-Engine Support — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Tavily, Keenable, Firecrawl, Parallel, Perplexity, SerpBase, Serply, DeepSeek Official, You.com, Baidu Qianfan, Kimi, Aliyun Bailian, Volcano Doubao, Zhihu web-wide/site search (
zhihu_global/zhihu_site, via the Zhihu open-platform MCP), and the model-based OpenAI / Gemini / Claude searches - Web Settings UI — Engine switching, API key configuration (keys masked as "configured" in the UI), and a Chinese/English toggle; the entry is the component-row config (
plugins.row.config) on the sidebar Plugins page (DSH 0.1.7-rc.1+) - Popup Switch Command — Type
/union-search-enginein the chat: a picker opens with all engines; click one to switch (equivalent to the settings page + save) - Engine Testing — the settings card has a "Test all engines" button that checks every engine sequentially; failed engines appear in a tick-to-disable suggestion list (Apply → Save to persist; the auto/multi virtual modes are never listed). There is also a "Test engine" button that tests the selected engine directly (no fallback chain; paid engines without a key report an explicit error)
- Global engine enable/disable & fallback priority — uncheck engines you never want (applies everywhere: web_search fallback, Auto routing, advanced_search, multi_search, engine tests) and reorder the global fallback chain with ↑↓ (one-click reset)
- Multi mode — pick
Multi Searchas the engine: web_search queries the top 3 enabled engines concurrently, merges/deduplicates URLs and prioritizes cross-source hits (costs more quota; a failed multi run automatically falls back to the single-engine chain) - Unified Engine Fallback — Any engine failure (paid or free, missing key, 401, rate limit, network error) automatically tries the next engine: the configured engine first, then other engines (exa/tavily/keenable/firecrawl/parallel are tried even without a key because they have built-in keyless quota), then the remaining free engines (Bing/AnySearch etc.) — with a note attached to the results naming the engine that actually served them (e.g.
Note: perplexity unavailable or failed, using exa.). Failures are classified: quota/auth failures cool the engine down for the session, anti-bot walls back off briefly, timeout/5xx/rate-limit failures retry the same engine once, and parse errors / 0 results are reported without cooling it down (see "Failure-aware fallback" below). Search never fails outright. - Time Filtering — The
advanced_searchtool supportstimeRange: fixed tiers, custom relative values, or an absolute date (details below) - Pagination & result count —
advanced_searchacceptspage(1-based) andmaxResults(default 5, cap 20).pageis honoured only by the nine browser-tier engines andso360(the browser tier already implementspn/start/offsetoffsets;so360was verified on a real machine —pn=1/2/3return different result sets). Bing was measured on all four channels (count/first/FPIGtoken / RSS) and none of them work, and the remaining HTTP engines have no pagination evidence, so both return page 1 and say so explicitly:page=2 was ignored because this engine does not support pagination.(reported even when the row count is satisfied — otherwise a model assumes paging worked and keeps asking for page=3/4 while receiving the same URLs). When you ask for N and get M, the result carriesNote: requested N results, engine "X" returned M (single page): only engines that actually paginate get the "pass a higher page" hint; every other engine is never toldfrom page N(they only ran page 1, so that would be a lie) and gets no paging advice — most engines cap a page at 10, and the plugin never pads a short list or gives advice it cannot honour. - System Prompt Injection — The agent is aware of the currently active engine and which engines require API keys; it is also told that all search output is untrusted external data and must never be executed as instructions. The injected list contains only engines that can actually work right now: ones you unchecked never appear, and engines without a configured key are hidden (judged from three sources — credential store / this plugin's config / environment variable, any one of which counts), with a pointer telling the agent to use the keyless
baidu_browserfor Baidu instead of naming an engine that would just reportAPI key is not configured. - Prompt-Injection Guard (untrusted-data boundary) — Web-derived text from the plugin's own tools (
advanced_search/platform_search/multi_search) is wrapped in an explicit<untrusted-web-content>boundary (look-alike tags inside the text are stripped to prevent early closure); the coreweb_search/web_fetchtools carry DSH core's own notice (External web content follows...); every snippet is cleaned and capped at 300 characters - Version + Update Check — The settings card shows the current version (v0.4.17), and a "Check update" button queries the npm registry to compare against the latest release, prompting a one-click jump when a newer version exists
- Result Caching — Identical queries (same engine / time-filter args) hit an LRU cache (50 entries) for up to 5 minutes, protecting free engines from rate-limiting and saving paid quota; the TTL is configurable from 0-5 minutes in the settings UI (0 disables caching)
- Visual Badges — Free engines feature a green
FREEbadge, while paid engines show an orangeAPI KEYbadge in the settings UI - Webpage Fetching (
web_fetch) — Allows the agent to read full webpage contents (officialdsh-web-fetch-httpprovider, pure JS, zero extra dependencies) - Advanced Fetching (
advance_fetch, experimental · free) — a plugin-owned tool on top of web_fetch with no API key and no per-request billing (unlike the metered paid search APIs): whole-page GitHub-Flavored Markdown (replicating the host tool-web's exact turndown profile: invisible nodes dropped, GFM tables without colspan expansion), plus CSSselectorscoping andfieldsstructured extraction (label=selector|attr, semicolon-separated) — prefer it when you only need part of a page. Ships its own deps (turndown, @joplin/turndown-plugin-gfm, cheerio) without touching host internals; output is cleaned for portal pages (javascript:-style pseudo links keep text only, layout-table all-empty pipe rows dropped,<br>inside table cells normalized to " / ", truncation cuts at line boundaries without splitting surrogate pairs or leaving unclosed code fences); relative links are absolutized against the final URL and tracking params (utm_*/gclid/fbclid/mc_eid/igshid) stripped; non-UTF-8 legacy pages (GBK/GB2312) are decoded via declared charset; HTTP 200 anti-bot challenge pages (captcha wording on a near-empty body) are reported as failures instead of content; RSS/Atom passes through as text; login-walled/client-rendered sites return a shell with an explanatory note. Fetch identity is configurable in settings: a custom User-Agent, a Referer, and per-domain cookies (one line per domain:domain cookie-string; attached only when the target matches the domain, never forwarded across cross-domain redirects) - keep credentials in settings, never paste cookies into chat. For navigation-heavy portal pages preferselector/fieldsover whole-page markdown; http(s) only, output wrapped in the untrusted boundary - On-demand help (
search_fetch_tool_manual) — conversion dispatch (HTML/JSON/RSS passthrough, charset probing, tracking-param stripping, output caps and truncation), thefieldsgrammar, the engine inventory (generated from current settings, not a second source of truth), fetch identity (custom UA/Referer/per-domain cookies) and failure shapes are all queried by tool name or topic; each tool description keeps only a short blurb instead of flattening the long rules into the schema face that is paid for on every turn. - In-result guidance (note channel) — limits tied to the call that just happened ride back in the result note: platform caveats (v2ex filters the hot-topics feed locally, it is not a site-wide search), one video vertical returning nothing, the vimeo empty-result fallback to a scoped web search, no results at all, and the per-engine success/failure list.
advance_fetchalso appends one pointer to the manual the first time it is called inside a session. Guidance is de-duplicated as "once per tool per session": tool results live in the conversation history, so re-attaching the same paragraph on every call just multiplies copies, while a first-touch note keeps the useful timing without the copies. - Platform Search (
platform_search) — Search GitHub / V2EX / Bilibili / Reddit / Hacker News / Stack Overflow / Wikipedia / npm / YouTube / Vimeo (public APIs or keyless scraping, zero extra dependencies) - Video Search (
video_search) — Find videos across the web via Bing Videos + DuckDuckGo Videos (keyless, mutual fallback), returning video links with titles and publisher/duration metadata - Clean Integration — Implements the official
WebSearchProviderseam interface, coexisting seamlessly with official plugins - Block built-in system search — the "Block built-in system search" toggle (
blockSystemSearch): when on,web_searchis force-taken-over by this plugin and the shipped official engines (deepseek-official, plusdeepseek-search-apion rc.2+) are excluded from every engine chain; takes effect on save - Lockable SearXNG response language —
searxngLanguage(defaultauto): auto detects from the query script (kana→ja, hangul→ko, cyrillic→ru, CJK→zh-CN, falling back to the settings language); picking a concrete value (zh-CN/zh-TW/en/ja/ko/ru/de/fr/es/all) locks it regardless of query; invalid locales are normalized to avoid HTTP 400 - SearXNG multi-instance union — with 2+ custom endpoints configured, the first two are queried concurrently; the plugin waits for both responses, merges and deduplicates by URL, and ranks items hit by both instances first; only when both fail does it fall through to the remaining instances sequentially
If this plugin has been helpful, a ⭐ on GitHub would mean a lot — it's the biggest motivation for the developer to keep maintaining it. Thank you!
垂直槽模型(slot)与引擎清单(0.40.0)
自 0.40.0 起,引擎标签第四轴由 kind 改名为 slot(垂直槽),八值闭集:web / news / baike(站内百科)/ wiki(外网维基)/ image / video / shorts(短视频)/ dev(程序员站点),缺省 web。设置页每张引擎卡按槽打标签,可按槽筛选。
引擎注册表规模(pnpm run build 后由 engine-tags.test.mjs 钉死):
| 口径 | 数量 | 说明 |
|---|---|---|
| ALL_ENGINES | 69 | 全部引擎 id(含 HTTP 档 + 浏览器 web 档 + 垂直档) |
| FREE_ENGINES | 32 | 免 key 通道 |
| BROWSER_TIER_ENGINES | 9 | 走真实浏览器的 web 档 |
HTTP 垂直槽档(真实抓取,已接线主线):
| 引擎 id | 槽 | 通道 | 证据 |
|---|---|---|---|
| so360-news / so360-baike / so360-image | news / baike / image | 360 直连 | E1 |
| googlenews | news | 谷歌新闻 RSS | E1 |
| bilibili / sogou-video | video | 公开接口 / /vc/np base32 解真链 | E1 |
| wikipedia | wiki | 维基 REST(默认走代理出口) | E1 |
| stackoverflow / csdn | dev | Stack Exchange API / CSDN JSON(剥追踪参) | E1 |
| so_51cto | dev | 反爬壳 → 只登记不发请求 | E3 blocked |
浏览器槽矩阵(SLOT_SERP,声明式,不入 ALL_ENGINES):按 R7 证据门禁——无 E1 的格只写骨架与 blocked/pending 文案、不写选择器、不注册引擎(避免幽灵引擎)。当前 blocked:百度 news/video、搜狗 news/baike/image、360 video;pending(E2,仅 buildUrl):百度 baike/image、谷歌 image/video/shorts;covered-by-http:搜狗 video(已由 sogou-video HTTP 档承接)。摸底快照见 docs/verticals-probe.md(pnpm run probe:verticals 生成)。
Supported Engines
| id | Engine | Cost | Description |
|---|---|---|---|
| auto | Auto Smart Routing | Dynamic | Smartly routes engines based on query language/time filter (Chinese queries prioritize Bing/Baidu/Aliyun/AnySearch, English queries prioritize Bing/Exa/Tavily; time filters prioritize time-capable engines), with full fallback |
| ddg | DuckDuckGo HTML | Free | Occasional rate limits (anti-bot challenges); recovers automatically |
| ddg-lite | DuckDuckGo Lite | Free | Lightweight version; same rate-limit behavior as above |
| bing | Bing | Free | Default engine, most stable, optimized for Chinese (zh-CN) |
| anysearch | AnySearch AI | Free | AI search, no key needed (anonymous quota) |
| searxng | SearXNG Meta Search | Free | Strictly exclusive instance modes: public pool / local Docker (loopback) / custom list — never cross-falling-back; with 2+ custom endpoints the first two are queried concurrently and merged once both return (cross-hit items ranked first); the response language is auto-detected from the query script (kana→ja, hangul→ko, cyrillic→ru, CJK→zh-CN) with the settings language only as fallback; aggregates web results + wikipedia infobox cards + direct answers; the settings card supports instance probing and one-click "Use as primary" |
| exa | Exa | Free | Usable without a key (anonymous MCP); configure a key for higher quota |
| tavily | Tavily | Free | Usable without a key (keyless anonymous); configure a key for higher quota |
| keenable | Keenable | Free | Usable without a key (anonymous MCP); configure a key for higher quota |
| firecrawl | Firecrawl | Free | Usable without a key (official keyless anonymous quota); configure a key for higher limits |
| parallel | Parallel | Free | Works without a key (official MCP anonymous quota); a key raises limits and enables precise time filtering |
| perplexity | Perplexity | Paid | Requires PERPLEXITY_API_KEY |
| serpbase | SerpBase | Paid | Requires SERPBASE_API_KEY (serpbase.dev, 100 free queries on signup) |
| serply | Serply | Paid | Requires SERPLY_API_KEY (serply.io, 2,500 free credits for the first 30 days); Google web results localized to the settings language |
| degoog | Degoog | Free | Self-hosted instance pool (degoogInstances); no instance = unavailable (skip, no cooldown); per-instance cooldown; time filter |,| brave_api | Brave API | Paid (freemium) | BRAVE_API_KEY ($5/1,000 calls); freshness buckets; coexists with brave_browser |,| serper | Serper | Paid (freemium) | SERPER_API_KEY (signup credits); X-API-KEY auth, tbs buckets |,| outcrawl | Outcrawl | Paid | OUTCRAWL_API_KEY; POST + Bearer; no time filter |,| google | Google CSE | Paid (100/day) | GOOGLE_CSE_API_KEY + googleCseId (cx); dateRestrict buckets; explicit error when cx is missing |,| yandex_api | Yandex API | Paid | YANDEX_API_KEY + yandexFolderId; Authorization: Api-Key; explicit selection only |,| yuanbao | Tencent Yuanbao WSA | Paid | YUANBAO_API_KEY; start/end window; CN direct egress; explicit selection only |,| specstream | Specstream | Paid | SPECSTREAM_API_KEY; Bearer; no time filter; explicit selection only |,| tapline | Tapline | Paid | TAPLINE_API_KEY; x-api-key; freshness only (never mixed with date_from); explicit selection only |,| tinyfish | TinyFish | Paid | TINYFISH_API_KEY; after_date (YYYY-MM-DD) |,| jina | Jina Reader | Paid (freemium) | JINA_API_KEY; Bearer; no time filter |,| wechat | WeChat (Sogou) | Free | Keyless HTML SERP; /link signatures are single-use and fall back to the original link; off by default / explicit only |,| toutiao | Toutiao | Free | Keyless HTML SERP; JSON-island forward+reverse scan for article_url; off by default / explicit only |,| agy | agy (local CLI) | Free (local) | Local CLI, no key; commandOnPath gate (.exe on win32); 150s timeout; skipped when missing; not in the auto chain |
| deepseek-tools | DeepSeek Native Search API | Paid | Requires DEEPSEEK_API_KEY (same key as deepseek-official); hits POST /v1/tools/search directly with no model in the loop — ~0.3s vs ~5-6s for official on the same query; passes through rerank_score/authority; endpoint switchable to a self-hosted gateway via deepseekToolsBaseUrl (full URL or base both accepted) |
| deepseek-official | DeepSeek Official | Paid | Requires DEEPSEEK_API_KEY; official pricing: Search $0.75 per 1,000 successful requests (≈ ¥0.005 per request) (as of 2026-10; server-side tool calls through the DSH harness are free until 2026-11-01) — see "DeepSeek official pricing" below |
| you | You.com | Paid | Requires YOUCOM_API_KEY (you.com/platform/api-keys, free tier on signup) |
| baidu | Baidu Qianfan AI Search | Quota | Requires BAIDU_API_KEY (Qianfan AI Search, 50 free calls/day then pay-as-you-go); Chinese web-wide, supports time filtering |
| kimi | Kimi (Moonshot) Web Search | Paid | Requires MOONSHOT_API_KEY (basic ~¥0.01/call); returns Chinese results with body chunks |
| aliyun | Aliyun Bailian EnhancedSearch | Paid | Requires DASHSCOPE_API_KEY (MCP search_pro, ~¥0.03/call, 200 free calls for new users); Chinese web-wide with source hostnames |
| doubao | Volcano Web Search (Doubao) | Free quota | Requires DOUBAO_SEARCH_API_KEY (open it in the Web Search console; 500 free queries/month, pay-as-you-go beyond); strong for fresh Chinese content, supports time/site filters, returns long summaries |
| zhihu_global | Zhihu web-wide search (open-platform MCP) | Paid | Requires ZHIHU_API_KEY; supports the time filter (publish_time); skipped automatically when no key is set |
| zhihu_site | Zhihu site search (open-platform MCP) | Paid | Requires ZHIHU_API_KEY; time filtering not verified, so it is not offered |
| openai | OpenAI built-in web search | Paid | Requires OPENAI_API_KEY; uses the Responses API web_search tool and returns a cited answer. Billed per search, explicit selection only (never picked by the fallback chain or Auto); default gpt-6-luna, model/endpoint configurable (openaiModel / openaiBaseUrl) |
| gemini | Gemini grounding with Google Search | Paid | Requires GEMINI_API_KEY (falls back to GOOGLE_API_KEY); uses the recommended Interactions API (POST /v1beta/interactions, tools:[{type:"google_search"}]) and reads citations from steps[].content[].annotations. Billed per search, explicit selection only; default gemini-3.8-flash, model/endpoint configurable (geminiModel / geminiBaseUrl) |
| claude | Claude server-side web_search | Paid | Requires ANTHROPIC_API_KEY; results come from web_search_tool_result. Billed per search, explicit selection only; default claude-sonnet-5-5, model/endpoint configurable (claudeModel / claudeBaseUrl) |
- Default engine is
bing(free and most stable), ready to use out of the box after installation. - Auto-failover: any engine failure (rate-limited free engine, or missing/invalid paid key, network error) automatically tries the next engine — the configured engine first, then other engines (exa/tavily/keenable/firecrawl/parallel are tried even without a key because they have built-in keyless quota), then the remaining free engines (Bing/AnySearch etc.) — with a note attached to the results naming the engine that actually served them (e.g.
Note: perplexity unavailable or failed, using exa.). Search never fails outright because of engine issues. - Official Links in Settings: Free engines display "Visit Website →", while paid engines display "Get API Key →" (opens in a new tab):
- Exa: https://dashboard.exa.ai/api-keys
- Tavily: https://app.tavily.com/home
- Keenable: https://keenable.ai/login
- Parallel: https://platform.parallel.ai
- Perplexity: https://www.perplexity.ai/settings/api
- SerpBase: https://serpbase.dev
- Serply: https://serply.io (API docs: https://serply.io/docs)
- DeepSeek: https://platform.deepseek.com/api_keys
- Doubao / Volcano Web Search: https://console.volcengine.com/search-infinity/web-search
- You.com: https://you.com/platform/api-keys
Why are some engines free?
- AnySearch: its
v1/searchREST endpoint provides anonymous public search quota without registration or an API key. Quota is rate-limited (fine for daily queries), but as one of the free engines with mutual fallback it stays reliable. - Exa: its public MCP endpoint (
mcp.exa.ai/mcp) supports anonymous requests, so it works without a key; configuringEXA_API_KEYgrants a higher usage quota. - Tavily: offers keyless anonymous quota via the
x-tavily-access-mode: keylessheader — it works without a key; configuringTAVILY_API_KEYswitches to the account tier for higher quota and more stable results. - Keenable: without a key it is called via its public MCP endpoint (
api.keenable.ai/mcp); configuringKEENABLE_API_KEYswitches to the REST API (api.keenable.ai/v1/search) for higher quota and organization-scoped rate limits. - Firecrawl: its
/v2/searchendpoint works without a key out of the box (the official docs state "No API key needed to get started", with anonymous rate limits); configuringFIRECRAWL_API_KEYraises the limits. Supportstbstime filtering (qdr:h/d/w/m/yand custom date ranges).
DeepSeek official pricing (2026-10, per the official pricing page)
Search and Fetch are standalone APIs billed per request (separate from model token fees):
| API | Unit | Price | |---|---|---| | Search (web search) | per 1,000 successful requests | $0.75 (≈ ¥0.005 ≈ half a cent per request @FX 7.1) | | Fetch (webpage fetch) | per 1,000 successful requests | $0.75 (≈ ¥0.005 ≈ half a cent per request @FX 7.1) |
Note: when the DeepSeek API is used through DeepSeek Harness / Claude Code / Codex, server-side tool calls already hit the Search and Fetch APIs; these are currently free and per-request billing starts at 00:00 Beijing time on 2026-11-01. This plugin's
deepseek-officialengine follows the same rate card — one reason the "Block built-in system search" toggle exists: if you don't want to pay for the shipped search, just stay on the free engines.
Model token pricing (per 1M tokens, off-peak / peak, USD):
| Model | Input (cache hit) | Input (cache miss) | Output |
|---|---|---|---|
| deepseek-flash | $0.003 / $0.006 | $0.15 / $0.30 | $0.60 / $1.20 |
| deepseek-v4-pro | $0.022 / $0.044 | $0.66 / $1.32 | $1.98 / $3.96 |
Peak hours are 01:00–04:00 and 06:00–10:00 UTC Monday–Friday (excluding Chinese public holidays); all other hours are off-peak at half the peak rates. Source: https://api-docs.deepseek.com/quick_start/pricing.
Installation
# npm (recommended, 0.10.15+ — unified unscoped name)
dsh plugin --profile web add dsh-union-search
# or from source / a packed tgz
git clone https://github.com/drscrewdriver/dsh-union-search.git
dsh plugin --profile web add /path/to/dsh-union-searchNote: the canonical package name is now the unscoped dsh-union-search; the scoped @drscrewdriver/dsh-union-search is unmaintained as of 0.10.15.
DSH identifies a package's client half by "bundle row name == the manifest name" (dsh-client-modules: locatePkgJson -> nearestPackage),
so upgrading from a historic scoped install means removing it and re-adding by the bare name; settings persisted under the entry id
(API keys / engine toggles) reset on that swap and need re-configuring (maintenance decision confirmed 2026-10-24).
Then restart:
dsh webTakeover behavior and verification
The plugin takes over search at runtime once loaded (it does not touch the config layer):
- When
web.searchProvideris unset, or still a shipped default official provider, it switches to this plugin's provider (id:ddg); since 0.2.1-rc.2 there are two shipped ids —deepseek-official(Messages server-side web_search) anddeepseek-search-api(the new built-in Search/Fetch standalone API) — and both are recognized and taken over; since 0.2.2-rc.5 the host no longer writes a default into the config but selects by model route (see the rc.5 note below), so "unset" is the normal state and the takeover still applies; - If you (or another plugin) explicitly selected a different provider, it does not steal it — it only logs a WARN with a copy-pasteable YAML snippet;
- With the "Block built-in system search" toggle on (
blockSystemSearch: true), it force-takes-overweb.searchProviderno matter what it points to, and thedeepseek-officialengine is excluded from every engine chain; takes effect on save, no restart needed.
It no longer writes searchProvider: ddg into the config layer. A static override used to create a dangling reference: a patch replaces the whole row config, so when the plugin's row was disabled or skipped (e.g. switched off in the plugin manager) the config still said ddg while nothing registered it, and every search failed with:
Error: configured web provider "ddg" is not registeredWithout that override, a disabled plugin leaves web.searchProvider at the shipped default (deepseek-official) so search still works through the official provider; when the plugin is enabled the runtime takeover above points it at ddg.
0.2.1-rc.2 mechanism change: the host removed the writable runtime selection field and now reads the volatile
webentry config on every call (unset + multiple usable providers →WEB_PROVIDER_AMBIGUOUS). This plugin probes the capability: ≤rc.1 keeps the in-memory takeover (non-persistent); on rc.2+ it pinsweb.searchProvider: ddginto the entry config through the settings service (persistent) — if you later disable this plugin, remove that field (or flip the official switch back), otherwise the host fails loudly withCONFIGURED_MISSING; as a shortcut, run the bundled cleaner:node node_modules/dsh-union-search/bin/restore.js --apply(0.11.6+, scans each profile'scordis.patch.ymland removes only the line this plugin pinned; dry-run by default). WithblockSystemSearchon,fetchProvideris also clamped tohttp(web_fetch is kept; the metereddeepseek-fetch-apiis not). If you explicitly picked a third-party fetch provider, it is left alone.
0.2.2-rc.5 mechanism change (important — the failure mode changed): the host deleted the hard-coded
searchProvider: deepseek-search-apifrom- id: web, keeping onlyfetchProvider: http, and now selects per model-request route when nothing is configured —deepseek-official/deepseek-accountroutes getdeepseek-official(server-side Messages search, not billed per search), every other route and requests outside a model turn getdeepseek-search-api. Three consequences for this plugin: ① the takeover criterion is unaffected (unset → still this plugin's takeover branch, and both shipped ids stay in the whitelist); ② the pin matters more than before — ifsettings.mutatenever lands (this plugin defers and retries when the settings service is not mounted yet),web_searchno longer raisesWEB_PROVIDER_AMBIGUOUS; it silently goes to the official provider, so it looks like "the plugin did nothing" with no error at all; ③ the search-provider menu on the settings page gained an "Automatic" entry (empty id), and picking it callsresetField, clearing thesearchProvideroverride — i.e. it releases this plugin's pin and search returns to the official provider. That is official behaviour, not a bug, but be aware of what the click does. Self-check: takeover only succeeded when the log showsunion-search: pinned web entry config searchProvider=ddg; seeingsettings service not ready/could not pinmeans it did not land.
Takeover residue auto-reclaim (0.16.0)
The root cause of the CONFIGURED_MISSING dangling above is that on rc.2+ the only takeover channel, settings.mutate, persists into cordis.patch.yml. From 0.16.0 the plugin patches both ends of that write, one mechanism per scenario:
- Plugin disable = auto-clear: with
autoRestoreOnDispose(on by default), disabling this plugin un-pins thesearchProvider/fetchProviderrows it wrote into thewebentry — it only removes values it wrote itself (it compares current === pinned before un-setting), so a value you later hand-switched to another provider, or anything this plugin never wrote, is left intact. - Unclean previous exit = startup self-check: for crashes / power loss that skip dispose, the next start runs a self-check before takeover. A hit on this plugin's legacy id (e.g. the pre-rename
web-search-free) is cleared safely; a hit on an external id that resolves to a registered provider (a third party you picked on purpose) is left silently alone; a hit on an unresolvable dangling id (left by some other uninstalled plugin) logs an ERROR with the repair command but is not auto-deleted (removing someone else's config is riskier than warning). - Uninstall = run
bin/restore.js --applyby hand: afterpnpm removethe plugin code is gone from disk, so no hook can run — a physical limit of the execution model, not something a toggle can bypass. Turn off takeover on the settings page before uninstalling, or runnode node_modules/dsh-union-search/bin/restore.js --applyafterwards (since 0.11.6, removes only this plugin's pinned rows, dry-run by default).
The self-check verdict surfaces on the "Block built-in system search" drawer as a takeover-status line (OK / dangling / external). With autoRestoreOnDispose off, both the dispose rollback and the self-check clearing are disabled — only detection and the warning remain.
If you previously added the snippet below by hand to
profiles/<profile>/cordis.patch.ymland the plugin is not enabled, you will see that error — just remove the snippet (or re-enable the plugin):
# Optional; normally unnecessary — only to force a specific provider.
# Since DSH 0.1.2 a patch REPLACES the whole entry config: keep fetchProvider.
- id: web
config:
searchProvider: ddg
fetchProvider: httpsearchProvider: ddg— this plugin's fixed provider id, not "use the DuckDuckGo engine"; the engine is chosen by theproviderfield in settings (bing/baidu/auto/ …).fetchProvider: http— the official web-fetch provider; keep it when declaring the row by hand.- To go back to official search: disable this plugin's entry in the plugin manager — no config edit needed.
Dependency Note
This plugin intentionally specifies @deepseek-ai/dsh-settings and @deepseek-ai/dsh-tools as peerDependencies: the DSH runtime must use a single instance from the installation tree. Always install the plugin using dsh plugin --profile <profile> add .... Do not copy DSH core packages into a profile-local node_modules, as duplicate copies can break the tool scheduler.
Usage
Web Settings (Recommended)
After installation, open the config page (DSH 0.1.7-rc.1+):
- Sidebar Plugins page → Installed group →
union-search→ click theweb-search-freecomponent row (the row's "configure" entry)
The config page provides:
- Search engine: Select an engine from the dropdown; changes take effect immediately upon saving.
- API keys: Enter keys for Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek (password fields; displayed as "configured" once saved; Exa / Tavily / Keenable / Firecrawl / Parallel work without a key too).
- Recommended: store paid-engine keys in the harness credential center
~/.dsh/.credentials.yaml(e.g.DEEPSEEK_API_KEY: sk-..., same as the official LLM providers — one place for all keys). Resolution order: credentials center > settings page > environment variable; the settings-page fields remain for backward compatibility.
- Recommended: store paid-engine keys in the harness credential center
- Test engine: Tests the selected engine directly (no fallback chain; paid engines without a key report an explicit error).
- Use Bing default: stage a switch back to the stable free Bing engine;
Discardonly cancels
