dsh-free-search 0.9.44 → 0.9.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,7 +34,7 @@
34
34
  #### 引擎与切换
35
35
 
36
36
  - **零成本** —— 多个免费引擎,无需 key、无需注册
37
- - **38 个引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、AnySearch、Exa、Tavily、Keenable、Firecrawl、Parallel、Perplexity、SerpBase、Serply、Outcrawl、Google 自定义搜索(`google`,需 API key + CSE ID)、秘塔搜索(`metaso`,官方 API,按点数计费)、Yandex 搜索(`yandex`,官方 API,按请求计费,需 folder ID)、DeepSeek 官方、DeepSeek 原生搜索 API、You.com、百度千帆、Kimi、阿里云百炼、火山联网搜索(豆包搜索)、知乎全网/站内(`zhihu_global`/`zhihu_site`,经知乎开放平台 MCP)、Antigravity CLI 搜索(`agy`,需本机安装)、OpenAI / Gemini / Claude 模型内置搜索。默认自动回退链覆盖其中 28 个;5 个 HTML SERP 引擎默认不参与,OpenAI / Gemini / Claude 三个模型引擎、Metaso 和 Yandex 都只在显式点名时运行。
37
+ - **39 个引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、AnySearch、Exa、Tavily、Keenable、Firecrawl、Parallel、Perplexity、SerpBase、Serply、Outcrawl、Google 自定义搜索(`google`,需 API key + CSE ID)、秘塔搜索(`metaso`,官方 API,按点数计费)、Yandex 搜索(`yandex`,官方 API,按请求计费,需 folder ID)、腾讯元宝搜索(`yuanbao`,API key 网关,有活动免费额度)、DeepSeek 官方、DeepSeek 原生搜索 API、You.com、百度千帆、Kimi、阿里云百炼、火山联网搜索(豆包搜索)、知乎全网/站内(`zhihu_global`/`zhihu_site`,经知乎开放平台 MCP)、Antigravity CLI 搜索(`agy`,需本机安装)、OpenAI / Gemini / Claude 模型内置搜索。默认自动回退链覆盖其中 28 个;5 个 HTML SERP 引擎默认不参与,OpenAI / Gemini / Claude 三个模型引擎、Metaso、Yandex 和 Yuanbao 都只在显式点名时运行。
38
38
  - **5 个 HTML 搜索页引擎(默认关闭)** —— 把传统搜索页并入同一套引擎 / 回退 / 冷却 / 设置体系:`baidu-html`(百度网页)、`so360`、`sogou`、`wechat`(微信文章)、`toutiao`。免 key、免额度,代价是抓页面:验证码/反爬按 `bot-wall` 归类并让整个家族冷却 10 分钟(整段出口 IP 都会被打标),结果也没有 API 摘要。它们默认不进 auto / 回退链 / 语言池,只在显式 `engine=` 或加入语言池时运行。
39
39
  - **引擎白名单** —— 设置页「只使用勾选的引擎」开启后,只有勾选的引擎可用,升级新增的引擎默认不启用;配置里对应 `allowedEngines`(非空时等价于把其余引擎全部禁用)。
40
40
  - **全局引擎开关与回退优先级** —— 设置页可勾选/取消引擎(取消后全局生效:普通搜索 / Auto / `advanced_search` / `multi_search` / 引擎测试都不再用它),并可用 ↑↓ 调整全局回退顺序(一键恢复默认)。
@@ -151,6 +151,7 @@
151
151
  | `google` | Google 自定义搜索 | 免费额度 | 需 `GOOGLE_CSE_API_KEY` 和 Programmable Search Engine ID(`googleCseId` / cx);Google 官方 Custom Search JSON API,每天 100 次免费,按次计费超额;支持 `hl`、安全搜索和 `dateRestrict` 时间过滤 |
152
152
  | `metaso` | 秘塔搜索 | 付费(点数) | 需 `METASO_API_KEY`(metaso.cn/api);官方 AI 搜索 API,按点数计费(约 0.03 元/次,新用户有体验额度);支持网页 / 文库 / 学术三种 `scope`,返回摘要和来源;不在默认回退顺序里,配 key 后显式选用 |
153
153
  | `yandex` | Yandex 搜索 | 付费 | 需 `YANDEX_API_KEY` 和 `yandexFolderId`(AI Studio,按请求计费,需 billing account);官方 Search API,`searchType` 支持 RU/TR/COM/KK/BE/UZ,响应为 Base64 XML;支持 day / 2 weeks / month 时间过滤;显式专用 |
154
+ | `yuanbao` | 腾讯元宝搜索 | 付费(有活动免费额度) | 需 `TENCENTCLOUD_WSA_APIKEY`(console.cloud.tencent.com/wsapi);API key 网关,支持自然 / 权威 / 混合模式、站点限定、时间范围;活动页可领每日免费额度(限时);显式专用 |
154
155
  | `deepseek-official` | DeepSeek 官方 | 付费 | 需 `DEEPSEEK_API_KEY`;走 Anthropic 兼容的 `web_search` 服务端工具,每次搜索是一整个模型轮次(慢、耗 token) |
155
156
  | `deepseek-tools` | DeepSeek 原生搜索 API | 付费 | 需 `DEEPSEEK_API_KEY`(与上一档共用);直接 `POST /v1/tools/search`,无模型参与,返回结构化 `results[]`(`title`/`url`/`summary`/`date`),同 query 实测 ~0.3s vs 上一档 ~5-6s |
156
157
  | `baidu` | 百度千帆 AI 搜索 | 额度 | 需 `BAIDU_API_KEY`(千帆 AI 搜索:web_search 每日赠 50 次,额度用尽/403 时自动回退到 chat/completions,另有 100 次/天免费额度;超额按量后付费);中文全网,支持时间过滤 |
@@ -281,7 +282,7 @@ DSH 0.2.1 设置 → 网页搜索 → **DeepSeek 搜索 API** 开关会和本插
281
282
  配置页提供:
282
283
 
283
284
  - **Search engine**:下拉框切换引擎,保存即生效
284
- - **API keys**:为 Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek / SerpBase / Serply / Outcrawl / Google CSE / Metaso / Yandex / You.com 填写 key(密码框,保存后只显示"已配置";Exa / Tavily / Keenable / Firecrawl / Parallel / You.com 不填也可免 key 使用)
285
+ - **API keys**:为 Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek / SerpBase / Serply / Outcrawl / Google CSE / Metaso / Yandex / Yuanbao / You.com 填写 key(密码框,保存后只显示"已配置";Exa / Tavily / Keenable / Firecrawl / Parallel / You.com 不填也可免 key 使用)
285
286
  - **推荐**:付费引擎 key 建议写入 harness 凭据中心 `~/.dsh/.credentials.yaml`(如 `DEEPSEEK_API_KEY: sk-...`,与官方 LLM provider 一致,一处管理所有 key)。插件读取优先级:凭据中心 > 设置页 > 环境变量,设置页填的 key 仅作为遗留兼容。
286
287
  - **Test engine**:直测当前引擎可用性(不走回退链,付费引擎无 key 会明确报错)
287
288
  - **Use Bing default**:把当前搜索引擎切回稳定的免费 Bing;`Discard` 只撤销尚未保存的编辑
@@ -618,7 +619,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
618
619
 
619
620
  #### 离线自检断言(tools/)
620
621
 
621
- 仓库自带 **59 个**零依赖断言脚本(合计 **867 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑。一次跑全部:`npm test`。
622
+ 仓库自带 **60 个**零依赖断言脚本(合计 **878 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑。一次跑全部:`npm test`。
622
623
 
623
624
  | 脚本 | 覆盖 | 运行(项数) |
624
625
  |---|---|---|
@@ -629,7 +630,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
629
630
  | `assert-multi-policy.mjs` | multi 执行策略:并发上限是天花板 / 目标成功源非硬下限 / 凭据资格在上限之前分流 / **Fast·Balanced·Deep 档位** | `node tools/assert-multi-policy.mjs`(146) |
630
631
  | `assert-multi-limit.mjs` | multi 结果上限(#109):默认 20 / 硬上限 100 / 配置归一化、单次 maxResults 受上限约束、工具参数与本段提示词写明生效上限、设置页字段与保存 | `node tools/assert-multi-limit.mjs`(6) |
631
632
  | `assert-maintenance.mjs` | 维护面:CI 在 Node 20/22/24 跑全部断言并过打包闸门、发布脚本会 bump / 校验 / 打 tag / 可发布、恢复官方 provider 的桥接与设置页按钮 | `node tools/assert-maintenance.mjs`(4) |
632
- | `assert-engine-modules.mjs` | 引擎分层:实现文件存在且被 index 引用、引擎函数已迁出 index、设置页引擎 id 与服务端清单一致、清单覆盖 38 个引擎且免费/按次标记正确、index 不引用引擎私有名 | `node tools/assert-engine-modules.mjs`(6) |
633
+ | `assert-engine-modules.mjs` | 引擎分层:实现文件存在且被 index 引用、引擎函数已迁出 index、设置页引擎 id 与服务端清单一致、清单覆盖 39 个引擎且免费/按次标记正确、index 不引用引擎私有名 | `node tools/assert-engine-modules.mjs`(6) |
633
634
  | `assert-bing-relevance.mjs` | Bing 相关性(#112):单字中文 token 被剔除、无关替代 SERP 被拒、真正相关的结果通过、只命中通用引擎名的整批被拒、单一 token 覆盖一半时放行、单字/纯数字查询的显式行为 | `node tools/assert-bing-relevance.mjs`(6) |
634
635
  | `assert-quality.mjs` | 研究证据闸门:8 源 / 3 域 / 3 正文 / 2 日期为 high,3 源 / 2 域 / 1 正文为 medium,单源与失败注记为 low,空包为 low,research 的 schema/输出/brief 接线 | `node tools/assert-quality.mjs`(6) |
635
636
  | `assert-dedupe.mjs` | 近重复去重:MinHash 同文本同签名、同 URL 去重、跨站转载去重、不同文章保留且顺序不变、阈值可调、provider 与 multi 两条路径接线 | `node tools/assert-dedupe.mjs`(6) |
@@ -644,6 +645,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
644
645
  | `assert-mcp.mjs` | MCP stdio 面:initialize 协议协商、tools/list 的 JSON Schema、tools/call 文本结果、工具错误与 JSON-RPC 错误区分、必填参数校验、bin/files 打包 | `node tools/assert-mcp.mjs`(6) |
645
646
  | `assert-mcp.mjs` | MCP stdio surface: initialize negotiation, tools/list JSON Schema, tools/call text results, tool errors vs JSON-RPC errors, required arguments, bin/files packaging | `node tools/assert-mcp.mjs` (6) |
646
647
  | `assert-baidu.mjs` | 百度千帆:key 必填、web_search 首请求、403 或 results.code 额度错误回退 chat/completions(stream:false)、401 不回退、双端失败合并报错 | `node tools/assert-baidu.mjs`(6) |
648
+ | `assert-yuanbao.mjs` | 元宝搜索:key 必填、Bearer 网关/Query/Mode/Site/FromTime、自然与 VR 页面解析、日期归一、错误分类、注册与显式专用 | `node tools/assert-yuanbao.mjs`(6) |
647
649
  | `assert-yandex.mjs` | Yandex Search:key+folder 必填、Api-Key/请求体/分组、searchType 与 period/family 映射、Base64 XML 解析与日期、错误分类、注册与显式专用 | `node tools/assert-yandex.mjs`(6) |
648
650
  | `assert-metaso.mjs` | 秘塔搜索:key 必填、请求体(q/scope/size/summary/raw/concise)、摘要与日期映射、文库数组、size 上限、无效 scope 回退、401/402/429/400 错误分类、注册与默认回退排除 | `node tools/assert-metaso.mjs`(6) |
649
651
  | `assert-google-cse.mjs` | Google Custom Search:key+ID 必填、请求参数(q/num/start/hl/safe/dateRestrict)、结果映射与发布日期、超过 10 条分页、403/429/400 错误分类、时间档映射、全链路注册 | `node tools/assert-google-cse.mjs`(6) |
@@ -679,7 +681,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
679
681
  | `assert-firecrawl-keyless.mjs` | Firecrawl keyless 出口判定:403 + VPN/proxy 文案才算拒绝、普通 403 与 401/429/500 不算、冷却初始未触发 | `node tools/assert-firecrawl-keyless.mjs`(5) |
680
682
  | `assert-fetch-charset.mjs` | 抓取编码(#88):`charset=gbk` / `gb2312` 按声明解码、无声明时嗅探 `<meta charset>` 与 http-equiv 形式、默认 UTF-8、未知 label 兜底 UTF-8 不抛错 | `node tools/assert-fetch-charset.mjs`(6) |
681
683
  | `assert-fetch-abort.mjs` | 抓取中断(#87):压缩响应中途断连必须 reject(不再永久 pending)、明文断连同样 reject、abort 能打断停滞的 gzip 流、complete 响应与重定向仍正常 | `node tools/assert-fetch-abort.mjs`(6) |
682
- | `assert-bridge-access.mjs` | 桥接 Host 围栏(#84):loopback 放行、remote peer 打 loopback Host 拒绝、`--trusted-host`(无端口匹配任意端口 / 带端口精确匹配)、`--public-url`、绑定地址、跨站与异源拒绝、connection 鉴权委托与 fail-closed | `node tools/assert-bridge-access.mjs`(13) |
684
+ | `assert-bridge-access.mjs` | 桥接 Host 围栏(#84):loopback 放行、remote peer 打 loopback Host 拒绝、`--trusted-host`(无端口匹配任意端口 / 带端口精确匹配)、`--public-url`、绑定地址、跨站与异源拒绝、connection 鉴权委托与 fail-closed、设置客户端按 `document.baseURI` 解析子路径 | `node tools/assert-bridge-access.mjs`(14) |
683
685
  | `assert-provider-takeover.mjs` | provider 接管:旧属性 API 与 rc.2 的 `config.*` ref 两套兼容、`settings.mutate(web)` 单批写入、显式指定的 provider 不被抢占、`fetchProviderTakeover: false` 时保留显式 `http`、describe 噪声不误报、嵌套 config 变化与 web 重建分别成行、关闭 DSH 搜索开关后重新接管(`deepseek-search-api` / `deepseek-official` 均视为官方默认)、打开 DeepSeek 开关(`deepseek-fetch-api`)时让路、apply 重入/重复注册不再中断、重复日志去重 | `node tools/assert-provider-takeover.mjs`(20) |
684
686
 
685
687
  任何一个失败会以非 0 退出码结束并列出失败项;把某个旧版本文件路径作为参数传进去,可以看到修复前必红(用来证明断言不是空转)。改动发布相关逻辑后建议先跑一遍再发版。
@@ -732,7 +734,7 @@ This plugin solves exactly that: multiple free engines plus automatic fallback,
732
734
  #### Engines and switching
733
735
 
734
736
  - **Zero Cost** — Multiple free engines with no API key or registration required
735
- - **38 engines available** — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Tavily, Keenable, Firecrawl, Parallel, Perplexity, SerpBase, Serply, Outcrawl, Google Programmable Search (`google`, needs an API key plus a CSE ID), Metaso (秘塔搜索, official API, billed per call), Yandex Search (official API, billed per request, folder ID required), DeepSeek Official, DeepSeek Native Search API, You.com, Baidu Qianfan, Kimi, Aliyun Bailian, Volcano Doubao, Zhihu web-wide/site search (`zhihu_global`/`zhihu_site`, via the Zhihu open-platform MCP), Antigravity CLI search (`agy`, requires the local CLI), and the model-based OpenAI / Gemini / Claude searches. The default auto-fallback chain covers 28 of them; the 5 HTML SERP engines stay out by default and the per-call billed OpenAI / Gemini / Claude engines, Metaso and Yandex run only when explicitly named.
737
+ - **39 engines available** — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Tavily, Keenable, Firecrawl, Parallel, Perplexity, SerpBase, Serply, Outcrawl, Google Programmable Search (`google`, needs an API key plus a CSE ID), Metaso (秘塔搜索, official API, billed per call), Yandex Search (official API, billed per request, folder ID required), Tencent Yuanbao Search (API-key gateway with a limited free-quota activity), DeepSeek Official, DeepSeek Native Search API, You.com, Baidu Qianfan, Kimi, Aliyun Bailian, Volcano Doubao, Zhihu web-wide/site search (`zhihu_global`/`zhihu_site`, via the Zhihu open-platform MCP), Antigravity CLI search (`agy`, requires the local CLI), and the model-based OpenAI / Gemini / Claude searches. The default auto-fallback chain covers 28 of them; the 5 HTML SERP engines stay out by default and the per-call billed OpenAI / Gemini / Claude engines, Metaso, Yandex and Yuanbao run only when explicitly named.
736
738
  - **5 HTML SERP engines (off by default)** — Traditional result pages join the same engine / fallback / cooldown / settings machinery: `baidu-html` (Baidu web), `so360`, `sogou`, `wechat` (WeChat articles) and `toutiao`. No key, no quota — the trade-off is scraping: captcha/anti-bot pages are classified as `bot-wall` and cool the whole family down for 10 minutes (the egress IP gets flagged as a whole), and results carry no API snippets. They never join auto routing, the fallback chain or the language pools; they only run when named via `engine=` or added to a pool.
737
739
  - **Engine whitelist** — turn on Use only the checked engines and only those engines stay usable; engines added by later versions stay off. It maps to `allowedEngines` in the config (a non-empty list is equivalent to disabling every other engine).
738
740
  - **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).
@@ -850,6 +852,7 @@ If this plugin has been helpful, a ⭐ on [GitHub](https://github.com/DDDMUC/dsh
850
852
  | `google` | Google Programmable Search | Free quota | Requires `GOOGLE_CSE_API_KEY` and a Programmable Search Engine ID (`googleCseId` / cx); official Custom Search JSON API, 100 free queries/day then billed; supports `hl`, safe search and `dateRestrict` time filtering |
851
853
  | `metaso` | Metaso (秘塔搜索) | Paid (credits) | Requires `METASO_API_KEY` (metaso.cn/api); official AI search API billed per call (about ¥0.03/query, trial credits for new accounts); supports webpage / document / scholar scopes and returns summaries with sources; not in the default fallback order, use it explicitly after configuring a key |
852
854
  | `yandex` | Yandex Search | Paid | Requires `YANDEX_API_KEY` and `yandexFolderId` (AI Studio; billed per request to a billing account); official Search API with RU/TR/COM/KK/BE/UZ search types and Base64 XML responses; supports day / 2 weeks / month time filters; explicit-only |
855
+ | `yuanbao` | Tencent Yuanbao Search | Paid (limited free-quota activity) | Requires `TENCENTCLOUD_WSA_APIKEY` (console.cloud.tencent.com/wsapi); API-key gateway with natural / authoritative / hybrid modes, site restriction and time ranges; the activity page offers a limited daily free quota; explicit-only |
853
856
  | `deepseek-official` | DeepSeek Official | Paid | Requires `DEEPSEEK_API_KEY`; uses the Anthropic-compatible `web_search` server tool, so every search is a full model turn (slow, token-billed) |
854
857
  | `deepseek-tools` | DeepSeek Native Search API | Paid | Requires `DEEPSEEK_API_KEY` (shared with the row above); calls `POST /v1/tools/search` directly, no model involved, returns structured `results[]` (`title`/`url`/`summary`/`date`) — measured ~0.3s vs ~5-6s for the row above on the same query |
855
858
  | `baidu` | Baidu Qianfan AI Search | Quota | Requires `BAIDU_API_KEY` (Qianfan AI Search: 50 free web_search calls/day; when that quota is exhausted or returns 403 it falls back to chat/completions, which has a separate 100/day free quota; pay-as-you-go beyond); Chinese web-wide, supports time filtering |
@@ -981,7 +984,7 @@ After installation, open the config page (DSH 0.2.1-rc.2+):
981
984
  The config page provides:
982
985
 
983
986
  - **Search engine**: Select an engine from the dropdown; changes take effect immediately upon saving.
984
- - **API keys**: Enter keys for Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek / Google CSE / Metaso / Yandex / You.com (password fields; displayed as "configured" once saved; Exa / Tavily / Keenable / Firecrawl / Parallel / You.com work without a key too).
987
+ - **API keys**: Enter keys for Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek / Google CSE / Metaso / Yandex / Yuanbao / You.com (password fields; displayed as "configured" once saved; Exa / Tavily / Keenable / Firecrawl / Parallel / You.com work without a key too).
985
988
  - **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.
986
989
  - **Test engine**: Tests the selected engine directly (no fallback chain; paid engines without a key report an explicit error).
987
990
  - **Use Bing default**: stage a switch back to the stable free Bing engine; `Discard` only cancels unsaved edits
@@ -1318,7 +1321,7 @@ Restart `dsh web` after switching to apply changes.
1318
1321
 
1319
1322
  #### Offline self-check assertions (`tools/`)
1320
1323
 
1321
- **Fifty-nine** zero-dependency assertion scripts ship with the repo (**867 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20. Run everything with `npm test`.
1324
+ **Sixty** zero-dependency assertion scripts ship with the repo (**878 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20. Run everything with `npm test`.
1322
1325
 
1323
1326
  | Script | Covers | Run (count) |
1324
1327
  |---|---|---|
@@ -1329,7 +1332,7 @@ Restart `dsh web` after switching to apply changes.
1329
1332
  | `assert-multi-policy.mjs` | multi execution policy: ceiling semantics / target-is-not-a-hard-minimum / credential eligibility before the ceiling / **Fast·Balanced·Deep presets** | `node tools/assert-multi-policy.mjs` (146) |
1330
1333
  | `assert-multi-limit.mjs` | Multi result ceiling (#109): default 20 / hard max 100 / config normalisation, per-call maxResults clamped to the ceiling, tool copy and prompt state name the effective limit, settings field and save path | `node tools/assert-multi-limit.mjs` (6) |
1331
1334
  | `assert-maintenance.mjs` | Maintenance surface: CI runs every assertion on Node 20/22/24 plus the packaging gate, the release script bumps / verifies / tags / can publish, and the restore-official-provider bridge and settings button are wired | `node tools/assert-maintenance.mjs` (4) |
1332
- | `assert-engine-modules.mjs` | Engine layout: module files exist and are imported, implementations have left index.js, the client engine ids match the server catalog, the catalog covers 38 engines with the right free/explicit flags, and index never reads an engine-private name | `node tools/assert-engine-modules.mjs` (6) |
1335
+ | `assert-engine-modules.mjs` | Engine layout: module files exist and are imported, implementations have left index.js, the client engine ids match the server catalog, the catalog covers 39 engines with the right free/explicit flags, and index never reads an engine-private name | `node tools/assert-engine-modules.mjs` (6) |
1333
1336
  | `assert-bing-relevance.mjs` | Bing relevance (#112): single-character CJK tokens removed, an unrelated substituted SERP rejected, genuinely relevant results accepted, a batch matching only a generic engine name rejected, one distinctive token covering half the query accepted, and explicit single-character/numeric behaviour | `node tools/assert-bing-relevance.mjs` (6) |
1334
1337
  | `assert-quality.mjs` | Research evidence gate: 8 sources / 3 domains / 3 bodies / 2 dates is high, 3 / 2 / 1 is medium, a single source or a degraded note is low, an empty package is low, and research wires the gate into schema, output and brief | `node tools/assert-quality.mjs` (6) |
1335
1338
  | `assert-dedupe.mjs` | Near-duplicate removal: identical text shares a MinHash signature, exact URLs and cross-site copies are dropped, different articles survive in order, the threshold is configurable, and both the provider and multi paths run it | `node tools/assert-dedupe.mjs` (6) |
@@ -1342,6 +1345,7 @@ Restart `dsh web` after switching to apply changes.
1342
1345
  | `assert-fetch-chain.mjs` | `fs-quality-fetch` tier ordering, stop-on-first-success, silent firecrawl degradation, aggregated all-tiers failure | `node tools/assert-fetch-chain.mjs` (8) |
1343
1346
  | `assert-fetch-ssrf.mjs` | Fetch SSRF guard: public/private/reserved address classification, DNS resolving to a private address rejected, localhost and IP literals rejected, non-HTTPS and credential URLs rejected, fake-ip ranges blocked by default and allowed only when configured, loopback/RFC1918 still blocked after opt-in, provider wiring and settings | `node tools/assert-fetch-ssrf.mjs` (8) |
1344
1347
  | `assert-baidu.mjs` | Baidu Qianfan: key required, web_search first, 403 or results.code quota fallback to chat/completions (stream:false), no fallback on 401, combined error when both fail | `node tools/assert-baidu.mjs` (6) |
1348
+ | `assert-yuanbao.mjs` | Yuanbao Search: key required, Bearer gateway and Query/Mode/Site/FromTime, natural and VR page parsing, date normalization, error classes, registration and explicit-only | `node tools/assert-yuanbao.mjs` (6) |
1345
1349
  | `assert-yandex.mjs` | Yandex Search: key + folder required, Api-Key/body/grouping, searchType and period/family mapping, Base64 XML parsing and dates, error classes, registration and explicit-only | `node tools/assert-yandex.mjs` (6) |
1346
1350
  | `assert-metaso.mjs` | Metaso search: key required, request body (q/scope/size/summary/raw/concise), summary and date mapping, document array, size clamp, invalid scope fallback, 401/402/429/400 error classes, registration and default-chain exclusion | `node tools/assert-metaso.mjs` (6) |
1347
1351
  | `assert-google-cse.mjs` | Google Custom Search: key + ID required, request params (q/num/start/hl/safe/dateRestrict), result mapping with dates, pagination past ten results, 403/429/400 classification, time-range mapping, full registration | `node tools/assert-google-cse.mjs` (6) |
@@ -1377,7 +1381,7 @@ Restart `dsh web` after switching to apply changes.
1377
1381
  | `assert-firecrawl-keyless.mjs` | Firecrawl keyless egress refusal: only a 403 with the VPN/proxy wording counts, plain 403 and 401/429/500 do not, and the cooldown starts inactive | `node tools/assert-firecrawl-keyless.mjs` (5) |
1378
1382
  | `assert-fetch-charset.mjs` | fetch encoding (#88): `charset=gbk` / `gb2312` decoded as declared, `<meta charset>` and the http-equiv form sniffed when the header omits it, UTF-8 by default, and an unknown label falls back to UTF-8 instead of throwing | `node tools/assert-fetch-charset.mjs` (6) |
1379
1383
  | `assert-fetch-abort.mjs` | fetch interruption (#87): a compressed response cut mid-body rejects instead of hanging forever, identity truncation rejects too, abort breaks a stalled gzip stream, and complete responses plus redirects still work | `node tools/assert-fetch-abort.mjs` (6) |
1380
- | `assert-bridge-access.mjs` | bridge Host fence (#84): loopback allowed, a remote peer behind a loopback Host refused, `--trusted-host` (port-less matches any port, explicit port matches exactly), `--public-url`, the bind address, cross-site and foreign-Origin refused, connection-auth delegation and fail-closed behavior | `node tools/assert-bridge-access.mjs` (13) |
1384
+ | `assert-bridge-access.mjs` | bridge Host fence (#84): loopback allowed, a remote peer behind a loopback Host refused, `--trusted-host` (port-less matches any port, explicit port matches exactly), `--public-url`, the bind address, cross-site and foreign-Origin refused, connection-auth delegation, fail-closed behavior, and settings-client subpath resolution via `document.baseURI` | `node tools/assert-bridge-access.mjs` (14) |
1381
1385
  | `assert-provider-takeover.mjs` | provider takeover: both the legacy property API and the rc.2 `config.*` refs, a single batched `settings.mutate(web)`, explicit foreign providers left untouched, an explicit `http` kept when `fetchProviderTakeover` is off, describe()-triggered events ignored when nothing changed, nested config changes and web rebuilds reported separately, re-takeover after DSH's search switch is turned off (both `deepseek-search-api` and `deepseek-official` count as the factory default), stepping aside for the explicit `deepseek-fetch-api` switch, apply re-entry / duplicate registrations tolerated, and repeated logs deduplicated | `node tools/assert-provider-takeover.mjs` (20) |
1382
1386
 
1383
1387
  Any failure exits non-zero with the failing items listed. Passing the path of an older file shows the pre-fix failures (proving the assertions are not vacuous). Worth running before a release.
package/lib/client.js CHANGED
@@ -301,7 +301,14 @@ window.__ModuleLoader__.load({
301
301
  }
302
302
  //#endregion
303
303
 
304
- const BRIDGE_PREFIX = "/api/dsh-free-search-settings";
304
+ const BRIDGE_PATH = "api/dsh-free-search-settings";
305
+ const bridgeUrl = (endpoint) => {
306
+ try {
307
+ return new URL(`${BRIDGE_PATH}/${endpoint}`, document.baseURI).toString();
308
+ } catch {
309
+ return `/${BRIDGE_PATH}/${endpoint}`;
310
+ }
311
+ };
305
312
  // rc.1: the settings namespace is the profile composition entry id (the
306
313
  // `web-search-free` row declared by cordis.patch.yml), not the old `free-search`
307
314
  // section name. Keep in sync with FREE_SEARCH_NS in lib/index.js.
@@ -459,6 +466,15 @@ window.__ModuleLoader__.load({
459
466
  yandexSearchTypeBe: "BE · 白俄罗斯",
460
467
  yandexSearchTypeUz: "UZ · 乌兹别克斯坦",
461
468
  yandexSearchTypeHint: "自动按 lang 选择;也可以固定到某个区域。",
469
+ yuanbaoKeyLabel: "腾讯元宝搜索 API key",
470
+ yuanbaoKeyHint: "在 console.cloud.tencent.com/wsapi 开通标准版并创建 key;活动页可领每日免费额度(限时)。",
471
+ yuanbaoModeLabel: "元宝搜索模式",
472
+ yuanbaoModeNatural: "自然结果",
473
+ yuanbaoModeVr: "权威/多模态结果",
474
+ yuanbaoModeHybrid: "混合结果",
475
+ yuanbaoModeHint: "自然结果最通用;权威/多模态适合天气、股价、汇率等时效信息。",
476
+ yuanbaoSiteLabel: "限定站点(可选)",
477
+ yuanbaoSiteHint: "只搜某个域名时填写,例如 qq.com;留空搜索全网。",
462
478
  restoreOfficial: "恢复官方搜索",
463
479
  restoreOfficialHint: "把 web.searchProvider 改回 deepseek-official、web.fetchProvider 改回 http。停用或卸载本插件前建议先点一次,避免宿主报 configured web provider \"ddg\" is not registered。",
464
480
  restoringOfficial: "恢复中…",
@@ -645,6 +661,15 @@ window.__ModuleLoader__.load({
645
661
  yandexSearchTypeBe: "BE · Belarus",
646
662
  yandexSearchTypeUz: "UZ · Uzbekistan",
647
663
  yandexSearchTypeHint: "Auto follows lang; pin a region to override.",
664
+ yuanbaoKeyLabel: "Tencent Yuanbao search API key",
665
+ yuanbaoKeyHint: "Enable the standard service and create a key at console.cloud.tencent.com/wsapi; the activity page offers a limited daily free quota.",
666
+ yuanbaoModeLabel: "Yuanbao search mode",
667
+ yuanbaoModeNatural: "Natural results",
668
+ yuanbaoModeVr: "Authoritative / multimodal",
669
+ yuanbaoModeHybrid: "Hybrid results",
670
+ yuanbaoModeHint: "Natural is the general default; authoritative/multimodal suits weather, stocks, FX and other timely facts.",
671
+ yuanbaoSiteLabel: "Restrict to site (optional)",
672
+ yuanbaoSiteHint: "Only search one domain, e.g. qq.com; leave empty for the whole web.",
648
673
  restoreOfficial: "Restore official search",
649
674
  restoreOfficialHint: "Sets web.searchProvider back to deepseek-official and web.fetchProvider back to http. Run this before disabling or uninstalling the plugin, otherwise the host reports configured web provider \"ddg\" is not registered.",
650
675
  restoringOfficial: "Restoring…",
@@ -694,7 +719,7 @@ window.__ModuleLoader__.load({
694
719
  "cache_search",
695
720
  "domain_search",
696
721
  ];
697
- const PLUGIN_VERSION = "0.9.44";
722
+ const PLUGIN_VERSION = "0.9.46";
698
723
  const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
699
724
  // 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
700
725
  const NAV_ITEMS = [
@@ -737,6 +762,7 @@ window.__ModuleLoader__.load({
737
762
  { id: "google", label: "Google · 自定义搜索", badge: "API KEY", link: "https://developers.google.com/custom-search/v1/overview" },
738
763
  { id: "metaso", label: "Metaso · 秘塔搜索", badge: "API KEY", link: "https://metaso.cn/api" },
739
764
  { id: "yandex", label: "Yandex · 搜索 API", badge: "API KEY", link: "https://aistudio.yandex.cloud" },
765
+ { id: "yuanbao", label: "腾讯元宝 · 搜索", badge: "API KEY", link: "https://console.cloud.tencent.com/wsapi" },
740
766
  { id: "deepseek-official", label: "DeepSeek Official", badge: "API KEY", link: "https://platform.deepseek.com/api_keys" },
741
767
  { id: "deepseek-tools", label: "DeepSeek Tools API", badge: "API KEY", link: "https://api-docs.deepseek.com/zh-cn/guides/search" },
742
768
  { id: "you", label: "You.com", badge: "FREE", link: "https://you.com/platform/api-keys" },
@@ -760,10 +786,12 @@ window.__ModuleLoader__.load({
760
786
  ];
761
787
  const ENGINE_IDS = ENGINES.filter((engine) => engine.id !== "auto" && engine.id !== "multi").map((engine) => engine.id);
762
788
  // 与 lib/index.js 的 EXPLICIT_ONLY_ENGINES 同源:按次计费、只在显式选中时运行,因此不提供入池候选。
763
- const EXPLICIT_ONLY_ENGINES = ["openai", "gemini", "claude", "metaso", "yandex"];
789
+ const EXPLICIT_ONLY_ENGINES = ["openai", "gemini", "claude", "metaso", "yandex", "yuanbao"];
764
790
  // 与 lib/serp_engines.js 的 SERP_ENGINE_IDS 同源:HTML 抓取型引擎,默认不进自动回退链。
765
791
  const SERP_ENGINE_IDS = ["baidu-html", "so360", "sogou", "wechat", "toutiao"];
766
- const MODEL_ENGINES = ENGINES.filter((engine) => EXPLICIT_ONLY_ENGINES.includes(engine.id) && engine.id !== "metaso" && engine.id !== "yandex");
792
+ const MODEL_ENGINES = ENGINES.filter(
793
+ (engine) => EXPLICIT_ONLY_ENGINES.includes(engine.id) && !["metaso", "yandex", "yuanbao"].includes(engine.id)
794
+ );
767
795
  const DEFAULT_FALLBACK_ORDER = ["exa", "tavily", "keenable", "firecrawl", "parallel", "perplexity", "serpbase", "serply", "outcrawl", "agy", "deepseek-tools", "deepseek-official", "you", "baidu", "kimi", "aliyun", "doubao", "tinyfish", "jina", "bing", "anysearch", "ddg", "ddg-lite", "searxng", "degoog", "zhihu_global", "zhihu_site"];
768
796
  const normalizeFallbackOrder = (value) => {
769
797
  const configured = Array.isArray(value) ? value.filter((id) => ENGINE_IDS.includes(id)) : [];
@@ -829,7 +857,7 @@ window.__ModuleLoader__.load({
829
857
  };
830
858
 
831
859
  async function bridgeRestoreProvider() {
832
- const response = await fetch(`${BRIDGE_PREFIX}/restore-provider`, {
860
+ const response = await fetch(bridgeUrl("restore-provider"), {
833
861
  method: "POST",
834
862
  headers: { "content-type": "application/json" },
835
863
  body: "{}",
@@ -838,7 +866,7 @@ window.__ModuleLoader__.load({
838
866
  }
839
867
 
840
868
  async function bridgeCheckUpdate() {
841
- const response = await fetch(`${BRIDGE_PREFIX}/check-update`, {
869
+ const response = await fetch(bridgeUrl("check-update"), {
842
870
  method: "POST",
843
871
  headers: { "content-type": "application/json" },
844
872
  body: "{}",
@@ -848,7 +876,7 @@ window.__ModuleLoader__.load({
848
876
 
849
877
  // 诊断文本由服务端拼好,客户端只负责显示。
850
878
  async function bridgeDoctor() {
851
- const response = await fetch(`${BRIDGE_PREFIX}/doctor`, {
879
+ const response = await fetch(bridgeUrl("doctor"), {
852
880
  method: "POST",
853
881
  headers: { "content-type": "application/json" },
854
882
  body: "{}",
@@ -857,7 +885,7 @@ window.__ModuleLoader__.load({
857
885
  }
858
886
 
859
887
  async function bridgeDescribe() {
860
- const response = await fetch(`${BRIDGE_PREFIX}/describe`, {
888
+ const response = await fetch(bridgeUrl("describe"), {
861
889
  method: "POST",
862
890
  headers: { "content-type": "application/json" },
863
891
  body: "{}",
@@ -866,7 +894,7 @@ window.__ModuleLoader__.load({
866
894
  }
867
895
 
868
896
  async function bridgeMutate(payload) {
869
- const response = await fetch(`${BRIDGE_PREFIX}/mutate`, {
897
+ const response = await fetch(bridgeUrl("mutate"), {
870
898
  method: "POST",
871
899
  headers: { "content-type": "application/json" },
872
900
  body: JSON.stringify(payload),
@@ -875,7 +903,7 @@ window.__ModuleLoader__.load({
875
903
  }
876
904
 
877
905
  async function bridgeRawSearch(payload) {
878
- const response = await fetch(`${BRIDGE_PREFIX}/raw-search`, {
906
+ const response = await fetch(bridgeUrl("raw-search"), {
879
907
  method: "POST",
880
908
  headers: { "content-type": "application/json" },
881
909
  body: JSON.stringify(payload),
@@ -884,7 +912,7 @@ window.__ModuleLoader__.load({
884
912
  }
885
913
 
886
914
  async function bridgeCredentialsStatus() {
887
- const response = await fetch(`${BRIDGE_PREFIX}/credentials-status`, {
915
+ const response = await fetch(bridgeUrl("credentials-status"), {
888
916
  method: "POST",
889
917
  headers: { "content-type": "application/json" },
890
918
  body: "{}",
@@ -893,7 +921,7 @@ window.__ModuleLoader__.load({
893
921
  }
894
922
 
895
923
  async function bridgeCredentialsSet(key, value) {
896
- const response = await fetch(`${BRIDGE_PREFIX}/credentials-set`, {
924
+ const response = await fetch(bridgeUrl("credentials-set"), {
897
925
  method: "POST",
898
926
  headers: { "content-type": "application/json" },
899
927
  body: JSON.stringify({ key, value }),
@@ -902,7 +930,7 @@ window.__ModuleLoader__.load({
902
930
  }
903
931
 
904
932
  async function bridgeCredentialsUnset(key) {
905
- const response = await fetch(`${BRIDGE_PREFIX}/credentials-unset`, {
933
+ const response = await fetch(bridgeUrl("credentials-unset"), {
906
934
  method: "POST",
907
935
  headers: { "content-type": "application/json" },
908
936
  body: JSON.stringify({ key }),
@@ -982,6 +1010,9 @@ window.__ModuleLoader__.load({
982
1010
  const [yandexKey, setYandexKey] = react.useState("");
983
1011
  const [yandexFolder, setYandexFolder] = react.useState("");
984
1012
  const [yandexType, setYandexType] = react.useState("auto");
1013
+ const [yuanbaoKey, setYuanbaoKey] = react.useState("");
1014
+ const [yuanbaoMode, setYuanbaoMode] = react.useState("0");
1015
+ const [yuanbaoSite, setYuanbaoSite] = react.useState("");
985
1016
  const [youcomKey, setYoucomKey] = react.useState("");
986
1017
  const [baiduKey, setBaiduKey] = react.useState("");
987
1018
  const [kimiKey, setKimiKey] = react.useState("");
@@ -1163,6 +1194,9 @@ window.__ModuleLoader__.load({
1163
1194
  setYandexKey(v.yandexApiKey ?? "");
1164
1195
  setYandexFolder(v.yandexFolderId ?? "");
1165
1196
  setYandexType(["ru", "tr", "com", "kk", "be", "uz"].includes(v.yandexSearchType) ? v.yandexSearchType : "auto");
1197
+ setYuanbaoKey(v.yuanbaoApiKey ?? "");
1198
+ setYuanbaoMode(v.yuanbaoMode === 1 || v.yuanbaoMode === 2 ? String(v.yuanbaoMode) : "0");
1199
+ setYuanbaoSite(v.yuanbaoSite ?? "");
1166
1200
  setYoucomKey(v.youcomApiKey ?? "");
1167
1201
  setBaiduKey(v.baiduApiKey ?? "");
1168
1202
  setKimiKey(v.kimiApiKey ?? "");
@@ -1214,6 +1248,7 @@ window.__ModuleLoader__.load({
1214
1248
  if (path === "googleCseApiKey") configured.google = true;
1215
1249
  if (path === "metasoApiKey") configured.metaso = true;
1216
1250
  if (path === "yandexApiKey") configured.yandex = true;
1251
+ if (path === "yuanbaoApiKey") configured.yuanbao = true;
1217
1252
  }
1218
1253
  }
1219
1254
  setKeysConfigured(configured);
@@ -1225,7 +1260,7 @@ window.__ModuleLoader__.load({
1225
1260
  const cred = await bridgeCredentialsStatus();
1226
1261
  if (cred.ok) {
1227
1262
  const cc = {};
1228
- const map = { anysearchApiKey: "anysearch", exaApiKey: "exa", tavilyApiKey: "tavily", keenableApiKey: "keenable", firecrawlApiKey: "firecrawl", parallelApiKey: "parallel", perplexityApiKey: "perplexity", deepseekApiKey: "deepseek", serpbaseApiKey: "serpbase", serplyApiKey: "serply", outcrawlApiKey: "outcrawl", youcomApiKey: "youcom", degoogApiKey: "degoog", googleCseApiKey: "google", metasoApiKey: "metaso", yandexApiKey: "yandex", baiduApiKey: "baidu", kimiApiKey: "kimi", aliyunApiKey: "aliyun", doubaoApiKey: "doubao", openaiApiKey: "openai", geminiApiKey: "gemini", claudeApiKey: "claude", zhihuApiKey: "zhihu", tinyfishApiKey: "tinyfish", jinaApiKey: "jina", searxngBearerToken: "searxng" };
1263
+ const map = { anysearchApiKey: "anysearch", exaApiKey: "exa", tavilyApiKey: "tavily", keenableApiKey: "keenable", firecrawlApiKey: "firecrawl", parallelApiKey: "parallel", perplexityApiKey: "perplexity", deepseekApiKey: "deepseek", serpbaseApiKey: "serpbase", serplyApiKey: "serply", outcrawlApiKey: "outcrawl", youcomApiKey: "youcom", degoogApiKey: "degoog", googleCseApiKey: "google", metasoApiKey: "metaso", yandexApiKey: "yandex", yuanbaoApiKey: "yuanbao", baiduApiKey: "baidu", kimiApiKey: "kimi", aliyunApiKey: "aliyun", doubaoApiKey: "doubao", openaiApiKey: "openai", geminiApiKey: "gemini", claudeApiKey: "claude", zhihuApiKey: "zhihu", tinyfishApiKey: "tinyfish", jinaApiKey: "jina", searxngBearerToken: "searxng" };
1229
1264
  for (const [k, v] of Object.entries(cred.value.configured ?? {})) {
1230
1265
  if (map[k]) cc[map[k]] = v;
1231
1266
  }
@@ -1276,6 +1311,7 @@ window.__ModuleLoader__.load({
1276
1311
  ["googleCseApiKey", googleKey],
1277
1312
  ["metasoApiKey", metasoKey],
1278
1313
  ["yandexApiKey", yandexKey],
1314
+ ["yuanbaoApiKey", yuanbaoKey],
1279
1315
  ["youcomApiKey", youcomKey],
1280
1316
  ["baiduApiKey", baiduKey],
1281
1317
  ["kimiApiKey", kimiKey],
@@ -1325,6 +1361,8 @@ window.__ModuleLoader__.load({
1325
1361
  ops.push({ op: "set", path: ["metasoScope"], value: metasoScope === "document" || metasoScope === "scholar" ? metasoScope : "webpage" });
1326
1362
  ops.push({ op: "set", path: ["yandexFolderId"], value: yandexFolder.trim() });
1327
1363
  ops.push({ op: "set", path: ["yandexSearchType"], value: ["ru", "tr", "com", "kk", "be", "uz"].includes(yandexType) ? yandexType : "auto" });
1364
+ ops.push({ op: "set", path: ["yuanbaoMode"], value: yuanbaoMode === "1" || yuanbaoMode === "2" ? Number(yuanbaoMode) : 0 });
1365
+ ops.push({ op: "set", path: ["yuanbaoSite"], value: yuanbaoSite.trim() });
1328
1366
  ops.push({ op: "set", path: ["browserFetch"], value: browserFetch });
1329
1367
  ops.push({
1330
1368
  op: "set",
@@ -1421,7 +1459,7 @@ window.__ModuleLoader__.load({
1421
1459
  setFailed(false);
1422
1460
  setSaveError("");
1423
1461
  try {
1424
- const response = await fetch(`${BRIDGE_PREFIX}/update`, {
1462
+ const response = await fetch(bridgeUrl("update"), {
1425
1463
  method: "POST",
1426
1464
  headers: { "content-type": "application/json" },
1427
1465
  body: "{}",
@@ -2249,6 +2287,90 @@ react_jsx_runtime.jsx("div", {
2249
2287
  }),
2250
2288
  ],
2251
2289
  }),
2290
+ react_jsx_runtime.jsx("div", {
2291
+ className: "dshfs-field",
2292
+ children: [
2293
+ react_jsx_runtime.jsx("div", {
2294
+ className: "dshfs-label",
2295
+ children: t.yuanbaoKeyLabel,
2296
+ }),
2297
+ react_jsx_runtime.jsx("input", {
2298
+ className: "dshfs-input",
2299
+ type: "password",
2300
+ value: yuanbaoKey,
2301
+ spellCheck: false,
2302
+ placeholder: "API key",
2303
+ disabled: !ready || saving,
2304
+ onChange: (e) => {
2305
+ setYuanbaoKey(e.target.value);
2306
+ setDirty(true);
2307
+ setFailed(false);
2308
+ setSaveError("");
2309
+ },
2310
+ }),
2311
+ react_jsx_runtime.jsx("p", {
2312
+ className: "dshfs-hint",
2313
+ children: t.yuanbaoKeyHint,
2314
+ }),
2315
+ ],
2316
+ }),
2317
+ react_jsx_runtime.jsx("div", {
2318
+ className: "dshfs-field",
2319
+ children: [
2320
+ react_jsx_runtime.jsx("div", {
2321
+ className: "dshfs-label",
2322
+ children: t.yuanbaoModeLabel,
2323
+ }),
2324
+ react_jsx_runtime.jsx("select", {
2325
+ className: "dshfs-select",
2326
+ value: yuanbaoMode,
2327
+ style: { colorScheme: selectColorScheme },
2328
+ disabled: !ready || saving,
2329
+ onChange: (e) => {
2330
+ setYuanbaoMode(e.target.value === "1" || e.target.value === "2" ? e.target.value : "0");
2331
+ setDirty(true);
2332
+ setFailed(false);
2333
+ setSaveError("");
2334
+ },
2335
+ children: [
2336
+ react_jsx_runtime.jsx("option", { value: "0", children: t.yuanbaoModeNatural }),
2337
+ react_jsx_runtime.jsx("option", { value: "1", children: t.yuanbaoModeVr }),
2338
+ react_jsx_runtime.jsx("option", { value: "2", children: t.yuanbaoModeHybrid }),
2339
+ ],
2340
+ }),
2341
+ react_jsx_runtime.jsx("p", {
2342
+ className: "dshfs-hint",
2343
+ children: t.yuanbaoModeHint,
2344
+ }),
2345
+ ],
2346
+ }),
2347
+ react_jsx_runtime.jsx("div", {
2348
+ className: "dshfs-field",
2349
+ children: [
2350
+ react_jsx_runtime.jsx("div", {
2351
+ className: "dshfs-label",
2352
+ children: t.yuanbaoSiteLabel,
2353
+ }),
2354
+ react_jsx_runtime.jsx("input", {
2355
+ className: "dshfs-input",
2356
+ type: "text",
2357
+ value: yuanbaoSite,
2358
+ spellCheck: false,
2359
+ placeholder: "qq.com",
2360
+ disabled: !ready || saving,
2361
+ onChange: (e) => {
2362
+ setYuanbaoSite(e.target.value);
2363
+ setDirty(true);
2364
+ setFailed(false);
2365
+ setSaveError("");
2366
+ },
2367
+ }),
2368
+ react_jsx_runtime.jsx("p", {
2369
+ className: "dshfs-hint",
2370
+ children: t.yuanbaoSiteHint,
2371
+ }),
2372
+ ],
2373
+ }),
2252
2374
  react_jsx_runtime.jsx("div", {
2253
2375
  className: "dshfs-field",
2254
2376
  id: "dshfs-anchor-fallback",
@@ -3101,7 +3223,7 @@ react_jsx_runtime.jsx("div", {
3101
3223
  // 挂插件页 slot:侧栏 插件 → 已安装 → free-search → 行配置页。
3102
3224
  // rc.1 废弃了旧版设置页的插件配置 slot,只保留 plugins.row.config;
3103
3225
  // key 规则见 ui-plugin-manager 的 rowConfigKey:<包名>#<patch 里声明的行 id>。
3104
- // 配置读写走自建 bridge(/api/dsh-free-search-settings),不依赖 dsh-web-ui。
3226
+ // 配置读写走自建 bridge(按页面 base 解析 api/dsh-free-search-settings),不依赖 dsh-web-ui。
3105
3227
  ctx.slots.inject("plugins.row.config", () =>
3106
3228
  ctx.slots.register(
3107
3229
  {
@@ -26,6 +26,7 @@ const BASE_ENGINES = [
26
26
  { id: "google", free: false, time: true },
27
27
  { id: "metaso", free: false, time: false, explicitOnly: true },
28
28
  { id: "yandex", free: false, time: false, explicitOnly: true },
29
+ { id: "yuanbao", free: false, time: true, explicitOnly: true },
29
30
  { id: "deepseek-official", free: false, time: false },
30
31
  { id: "deepseek-tools", free: false, time: true },
31
32
  { id: "you", free: false, time: false },
@@ -66,6 +67,7 @@ export const TIME_ENGINES = [
66
67
  "ddg",
67
68
  "ddg-lite",
68
69
  "baidu",
70
+ "yuanbao",
69
71
  "doubao",
70
72
  "tinyfish",
71
73
  "deepseek-tools",
@@ -0,0 +1,145 @@
1
+ // Tencent Yuanbao Search (WSA) via its API-key gateway.
2
+ // The WorkBuddy skill uses https://api.wsa.cloud.tencent.com/SearchPro with a
3
+ // Bearer key; results are JSON strings in Response.Pages.
4
+ import { uniqueSources } from "./shared.js";
5
+
6
+ const YUANBAO_URL = "https://api.wsa.cloud.tencent.com/SearchPro";
7
+ const MAX_RESULTS = 50;
8
+
9
+ export function normalizeYuanbaoMode(value) {
10
+ const mode = Number(value);
11
+ return mode === 1 || mode === 2 ? mode : 0;
12
+ }
13
+
14
+ export function yuanbaoTimeRange(timeRange) {
15
+ if (!timeRange) return {};
16
+ const now = Date.now();
17
+ let start = null;
18
+ if (timeRange.after) {
19
+ const parsed = Date.parse(`${timeRange.after}T00:00:00Z`);
20
+ if (Number.isFinite(parsed)) start = parsed;
21
+ } else if (Number.isFinite(Number(timeRange.days)) && Number(timeRange.days) > 0) {
22
+ start = now - Number(timeRange.days) * 86_400_000;
23
+ }
24
+ if (start === null) return {};
25
+ return { FromTime: Math.floor(start / 1000), ToTime: Math.floor(now / 1000) };
26
+ }
27
+
28
+ function publishedDate(raw) {
29
+ const text = String(raw ?? "").trim();
30
+ if (text === "") return "";
31
+ const normalized = text.replace(/\//g, "-");
32
+ const match = normalized.match(/^(\d{4}-\d{2}-\d{2})/);
33
+ if (match) return match[1];
34
+ const numeric = Number(text);
35
+ if (Number.isFinite(numeric) && numeric > 0) {
36
+ return new Date(numeric > 1e12 ? numeric : numeric * 1000).toISOString().slice(0, 10);
37
+ }
38
+ return "";
39
+ }
40
+
41
+ function parsePage(raw) {
42
+ let page;
43
+ try {
44
+ page = typeof raw === "string" ? JSON.parse(raw) : raw;
45
+ } catch {
46
+ return null;
47
+ }
48
+ if (page === null || typeof page !== "object") return null;
49
+
50
+ const vr = page.vr === true ? page.display ?? {} : null;
51
+ const url = String((vr?.url ?? page.url ?? "")).trim();
52
+ if (!url) return null;
53
+ const title = String(vr?.title ?? page.title ?? "").trim();
54
+ const snippet = String(
55
+ vr?.passage ?? vr?.content ?? page.passage ?? page.content ?? ""
56
+ ).trim();
57
+ const date = publishedDate(vr?.date ?? page.date);
58
+ return {
59
+ url,
60
+ ...(title ? { title } : {}),
61
+ ...(snippet ? { snippet } : {}),
62
+ ...(date ? { publishedAt: date } : {}),
63
+ };
64
+ }
65
+
66
+ export function parseYuanbaoPages(pages) {
67
+ if (!Array.isArray(pages)) return [];
68
+ return pages.map(parsePage).filter(Boolean);
69
+ }
70
+
71
+ function yuanbaoErrorMessage(status, detail) {
72
+ let upstream = "";
73
+ try {
74
+ const parsed = JSON.parse(detail);
75
+ upstream = parsed?.Response?.Error?.Message ?? parsed?.message ?? "";
76
+ } catch {}
77
+ const suffix = upstream ? `: ${String(upstream).slice(0, 200)}` : "";
78
+ if (status === 401 || status === 403) {
79
+ return `Yuanbao API key is invalid or unauthorized (HTTP ${status})${suffix} - create one at console.cloud.tencent.com/wsapi`;
80
+ }
81
+ if (status === 429) return `Yuanbao quota/rate limit exceeded (HTTP 429)${suffix}`;
82
+ return `Yuanbao API error (HTTP ${status})${suffix}`;
83
+ }
84
+
85
+ export async function searchYuanbao(query, maxResults, apiKey, options = {}, timeRange, signal) {
86
+ if (!apiKey) throw new Error("Yuanbao search requires TENCENTCLOUD_WSA_APIKEY");
87
+ const limit = Math.min(Math.max(Number(maxResults) || 10, 1), MAX_RESULTS);
88
+ const mode = normalizeYuanbaoMode(options.mode);
89
+ const site = String(options.site ?? "").trim();
90
+
91
+ const controller = new AbortController();
92
+ const timer = setTimeout(() => controller.abort(), 20000);
93
+ const onAbort = () => controller.abort();
94
+ signal?.addEventListener("abort", onAbort);
95
+
96
+ const body = {
97
+ Query: String(query),
98
+ Mode: mode,
99
+ ...(site ? { Site: site } : {}),
100
+ ...yuanbaoTimeRange(timeRange),
101
+ };
102
+
103
+ let response;
104
+ try {
105
+ response = await fetch(YUANBAO_URL, {
106
+ method: "POST",
107
+ redirect: "error",
108
+ headers: {
109
+ authorization: `Bearer ${apiKey}`,
110
+ "content-type": "application/json; charset=utf-8",
111
+ accept: "application/json",
112
+ "user-agent": "deepseek-harness/free-search",
113
+ },
114
+ body: JSON.stringify(body),
115
+ signal: controller.signal,
116
+ });
117
+ } catch (error) {
118
+ if (signal?.aborted) throw error;
119
+ if (error?.name === "AbortError") throw new Error("Yuanbao request timed out");
120
+ throw new Error(`Yuanbao request failed: ${error?.message ?? String(error)}`);
121
+ } finally {
122
+ clearTimeout(timer);
123
+ signal?.removeEventListener("abort", onAbort);
124
+ }
125
+
126
+ if (!response.ok) {
127
+ const detail = await response.text().catch(() => "");
128
+ throw new Error(yuanbaoErrorMessage(response.status, detail));
129
+ }
130
+
131
+ let data;
132
+ try {
133
+ data = await response.json();
134
+ } catch {
135
+ throw new Error("Yuanbao returned an invalid JSON response");
136
+ }
137
+ const result = data?.Response;
138
+ if (result === undefined || result === null) throw new Error("Yuanbao response has no Response object");
139
+ if (result.Error) {
140
+ throw new Error(`Yuanbao API error: ${result.Error.Message ?? JSON.stringify(result.Error)}`);
141
+ }
142
+
143
+ const sources = parseYuanbaoPages(result.Pages);
144
+ return { sources: uniqueSources(sources, limit), truncated: false };
145
+ }
package/lib/index.js CHANGED
@@ -42,6 +42,7 @@ import { searchOutcrawl } from "./engines/outcrawl.js";
42
42
  import { searchGoogle } from "./engines/google.js";
43
43
  import { searchMetaso } from "./engines/metaso.js";
44
44
  import { searchYandex } from "./engines/yandex.js";
45
+ import { searchYuanbao } from "./engines/yuanbao.js";
45
46
  import { createEngineRuntime, ENGINE_CONCURRENCY_LIMIT, SERP_CONCURRENCY_LIMIT } from "./engine_runtime.js";
46
47
  import { classifyIntent, preferForIntent } from "./intent.js";
47
48
  import { dedupeNearDuplicates } from "./dedupe.js";
@@ -1836,6 +1837,7 @@ const KEY_REF_MAP = {
1836
1837
  googleCseApiKey: "GOOGLE_CSE_API_KEY",
1837
1838
  metasoApiKey: "METASO_API_KEY",
1838
1839
  yandexApiKey: "YANDEX_API_KEY",
1840
+ yuanbaoApiKey: "TENCENTCLOUD_WSA_APIKEY",
1839
1841
  deepseekApiKey: "DEEPSEEK_API_KEY",
1840
1842
  // 设置页写入的凭据槽位保持旧名,已保存的 key 不受影响;读取时 YDC_API_KEY 优先(见 resolveYoucomApiKey)
1841
1843
  youcomApiKey: "YOUCOM_API_KEY",
@@ -1911,6 +1913,9 @@ const Config = z.object({
1911
1913
  yandexApiKey: z.string().role("secret").volatile(),
1912
1914
  yandexFolderId: z.string().default("").volatile(),
1913
1915
  yandexSearchType: z.string().default("auto").volatile(),
1916
+ yuanbaoApiKey: z.string().role("secret").volatile(),
1917
+ yuanbaoMode: z.number().default(0).volatile(),
1918
+ yuanbaoSite: z.string().default("").volatile(),
1914
1919
  searxngBearerToken: z.string().role("secret").volatile(),
1915
1920
  degoogApiKey: z.string().role("secret").volatile(),
1916
1921
  platforms: z.array(z.string()).default(["github", "v2ex", "bilibili", "reddit", "hn", "stackoverflow", "wikipedia", "npm", "youtube", "vimeo", "juejin", "douban", "qiita", "x"]).volatile(),
@@ -2462,6 +2467,19 @@ function apply(ctx, config) {
2462
2467
  safeSearch: cfg.safeSearch,
2463
2468
  }, timeRange, signal);
2464
2469
  },
2470
+ yuanbao: async ({ query, maxResults, timeRange, signal }) => {
2471
+ const key = await requireEngineKey(
2472
+ "TENCENTCLOUD_WSA_APIKEY",
2473
+ "yuanbaoApiKey",
2474
+ "Yuanbao",
2475
+ " (create one at console.cloud.tencent.com/wsapi)"
2476
+ );
2477
+ const cfg = current();
2478
+ return searchYuanbao(query, maxResults, key, {
2479
+ mode: cfg.yuanbaoMode,
2480
+ site: cfg.yuanbaoSite,
2481
+ }, timeRange, signal);
2482
+ },
2465
2483
  you: async ({ query, maxResults, signal }) =>
2466
2484
  searchYoucom(query, maxResults, await resolveYoucomKey(), signal),
2467
2485
  tinyfish: async ({ query, maxResults, timeRange, signal }) =>
@@ -3145,6 +3163,11 @@ function apply(ctx, config) {
3145
3163
  safeSearch: cfg.safeSearch,
3146
3164
  }, tr);
3147
3165
  }
3166
+ case "yuanbao": {
3167
+ const key = await resolveApiKey("TENCENTCLOUD_WSA_APIKEY", "yuanbaoApiKey");
3168
+ if (!key) return { ok: false, error: "TENCENTCLOUD_WSA_APIKEY not configured" };
3169
+ return await searchYuanbao(q, n, key, { mode: cfg.yuanbaoMode, site: cfg.yuanbaoSite }, tr);
3170
+ }
3148
3171
  case "agy": {
3149
3172
  if (!agyAvailable()) return { ok: false, error: "Antigravity CLI not installed (install Antigravity or set AGY_BIN)" };
3150
3173
  return await searchAgy(q, n, {});
@@ -223,6 +223,7 @@ export const REQUIRED_CREDENTIALS = {
223
223
  google: [{ env: "GOOGLE_CSE_API_KEY", settings: "googleCseApiKey" }],
224
224
  metaso: [{ env: "METASO_API_KEY", settings: "metasoApiKey" }],
225
225
  yandex: [{ env: "YANDEX_API_KEY", settings: "yandexApiKey" }],
226
+ yuanbao: [{ env: "TENCENTCLOUD_WSA_APIKEY", settings: "yuanbaoApiKey" }],
226
227
  tinyfish: [{ env: "TINYFISH_API_KEY", settings: "tinyfishApiKey" }],
227
228
  jina: [{ env: "JINA_API_KEY", settings: "jinaApiKey" }],
228
229
  baidu: [{ env: "BAIDU_API_KEY", settings: "baiduApiKey" }],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-free-search",
3
- "version": "0.9.44",
4
- "description": "Free web search for DeepSeek Harness: 38 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable/Firecrawl/Parallel/You.com keyless; Zhihu global/site via MCP and Perplexity/SerpBase/DeepSeek (official + native tools/search)/Baidu/Kimi/Aliyun/Doubao/Google CSE/Metaso/Yandex with key; OpenAI/Gemini/Claude model built-in search, explicit-only) + auto smart routing + global engine enable/disable & fallback priority + editable zh/en language pools + multi mode (parallel full language-pool merge) + multi_search cross-source tool + failure-aware fallback (quota/auth cooldown, transient retry, fallbackOn) + time filtering + platform search + domain blocklist (blockedDomains) + web_fetch, with web settings UI, plus a standalone stdio MCP server.",
3
+ "version": "0.9.46",
4
+ "description": "Free web search for DeepSeek Harness: 39 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable/Firecrawl/Parallel/You.com keyless; Zhihu global/site via MCP and Perplexity/SerpBase/DeepSeek (official + native tools/search)/Baidu/Kimi/Aliyun/Doubao/Google CSE/Metaso/Yandex/Yuanbao with key; OpenAI/Gemini/Claude model built-in search, explicit-only) + auto smart routing + global engine enable/disable & fallback priority + editable zh/en language pools + multi mode (parallel full language-pool merge) + multi_search cross-source tool + failure-aware fallback (quota/auth cooldown, transient retry, fallbackOn) + time filtering + platform search + domain blocklist (blockedDomains) + web_fetch, with web settings UI, plus a standalone stdio MCP server.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -48,7 +48,10 @@
48
48
  "volcano",
49
49
  "zhihu",
50
50
  "mcp",
51
- "model-context-protocol"
51
+ "model-context-protocol",
52
+ "yuanbao",
53
+ "tencent",
54
+ "wsa"
52
55
  ],
53
56
  "license": "MIT",
54
57
  "publishConfig": {