dsh-free-search 0.9.69 → 0.9.71
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 +18 -13
- package/lib/client.js +3593 -3629
- package/lib/engines/deepseek-official.js +9 -3
- package/lib/engines/deepseek-tools.js +7 -4
- package/lib/fetch_provider.js +23 -1
- package/lib/fetch_upstream.js +62 -3
- package/lib/index.js +29 -9
- package/lib/mcp_engines.js +1 -1
- package/lib/mcp_server.js +6 -1
- package/lib/safe_text.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
- **零成本** —— 多个免费引擎,无需 key、无需注册
|
|
37
37
|
- **42 个引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、AnySearch、Exa、Tavily、Keenable、Firecrawl、Parallel、Brave(`brave`,官方 Search API,需 `BRAVE_API_KEY`)、智谱(`zhipu`,官方 Web Search API,需 `ZHIPU_API_KEY`)、Perplexity、SerpBase、Serply、Outcrawl、SpecStream(`specstream`,官方 Search API,需 `SPECSTREAM_API_KEY`)、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 模型内置搜索。默认自动回退链覆盖其中 30 个;5 个 HTML SERP 引擎默认不参与,OpenAI / Gemini / Claude 三个模型引擎、Metaso、Yandex、Yuanbao 和 SpecStream 都只在显式点名时运行。
|
|
38
38
|
- **5 个 HTML 搜索页引擎(默认关闭)** —— 把传统搜索页并入同一套引擎 / 回退 / 冷却 / 设置体系:`baidu-html`(百度网页)、`so360`、`sogou`、`wechat`(微信文章)、`toutiao`。免 key、免额度,代价是抓页面:验证码/反爬按 `bot-wall` 归类并让整个家族冷却 10 分钟(整段出口 IP 都会被打标),结果也没有 API 摘要。它们默认不进 auto / 回退链 / 语言池,只在显式 `engine=` 或加入语言池时运行。
|
|
39
|
-
-
|
|
39
|
+
- **启用引擎白名单** —— 插件只维护一份 `allowedEngines` 启用列表;未勾选的引擎从所有搜索链、Auto / Multi 路由、引擎测试和提示词中移除。升级新增的引擎默认不启用,需要手动勾选。
|
|
40
40
|
- **全局引擎开关与回退优先级** —— 设置页可勾选/取消引擎(取消后全局生效:普通搜索 / Auto / `advanced_search` / `multi_search` / 引擎测试都不再用它),并可用 ↑↓ 调整全局回退顺序(一键恢复默认)。
|
|
41
41
|
- **弹出式切换命令** —— 聊天框输入 `/free-search-engine`,弹出引擎选择窗口,点选即切换(等效设置页 + 保存)。
|
|
42
42
|
- **免费标注** —— 设置页中免费引擎带绿色 `FREE` 徽章,付费引擎带橙色 `API KEY` 徽章。
|
|
@@ -329,7 +329,7 @@ DSH 0.2.1 设置 → 网页搜索 → **DeepSeek 搜索 API** 开关会和本插
|
|
|
329
329
|
|
|
330
330
|
设置页有这些块(都会保存进条目 config):
|
|
331
331
|
|
|
332
|
-
-
|
|
332
|
+
- **全局启用的搜索引擎**:这就是启用白名单本身,勾选即启用、取消即禁用;未启用的引擎会从普通 `web_search` 回退链、Auto 智能路由、`advanced_search`、`multi_search` 和引擎测试中**全局排除**。至少要保留一个引擎,新版本新增的引擎默认不启用。
|
|
333
333
|
- **全局回退优先级**:用 ↑↓ 调整先后顺序。首选引擎仍先尝试;Auto 保留"语言/时间"路由规则,但自定义后同一分组内及后续回退按此顺序。被禁用的引擎保留在列表里(标记「已禁用」)但不执行;「恢复默认顺序」一键还原。
|
|
334
334
|
- **中文查询池(zhPool)/ 英文查询池(enPool)**:Auto 路由的起始组,也是 Multi 模式的并发池。按查询语言自动二选一(检测到中日韩文字走中文池,其余走英文池);两池都可用 ↑↓ 排序、下拉添加引擎、「−」移除(**每池最低 2 个引擎,无上限**)。默认中文池 `bing / baidu / aliyun / anysearch`,默认英文池 `bing / exa / tavily`;禁用/冷却/缺 key 的引擎运行时自动跳过。
|
|
335
335
|
- **搜索引擎下拉里的 `Multi Search`**:选中后 `web_search` 会并发查询**查询语言对应池的全部**已启用引擎(不再是前 3 个),URL 去重合并、跨源命中的结果排前面。注意整池并发会成倍消耗额度(池里含按额度计费引擎时尤其注意);Multi 失败时会自动退回普通单引擎回退链并在结果里注明。
|
|
@@ -366,7 +366,7 @@ DSH 0.2.1 设置 → 网页搜索 → **DeepSeek 搜索 API** 开关会和本插
|
|
|
366
366
|
|
|
367
367
|
插件运行时会尝试接管 `web.fetchProvider`:
|
|
368
368
|
|
|
369
|
-
- 未设置、或仍是出厂默认 `http` → 接管为 `fs-quality-fetch
|
|
369
|
+
- 未设置、或仍是出厂默认 `http` → 接管为 `fs-quality-fetch`(DeepSeek 兼容抓取端点(可选)→ 直连 → exa contents → firecrawl → crawl4ai);
|
|
370
370
|
- 已被**显式指向其它 provider**(例如 `playwright`)→ **不抢占**,只记一条日志(进程内只打一次)。
|
|
371
371
|
|
|
372
372
|
如果你同时装了也会注册 fetch provider 的插件(例如 `dsh-web-fetch-playwright`、`dsh-chatgpt-subscription`),**请在 profile 的 `cordis.patch.yml` 里明确让一方退出**:
|
|
@@ -417,7 +417,9 @@ fetchProviderTakeover: true # false = 保留你显式 pin 的 fetchProvider: htt
|
|
|
417
417
|
fetchProviderForce: false # true = 连 DSH 搜索开关写进来的 deepseek-fetch-api 也接管(#142)
|
|
418
418
|
browserFetch: true # 直连失败时用系统浏览器无头渲染
|
|
419
419
|
allowFakeIpCidrs: [] # 显式放行的保留网段,例如 Clash/mihomo fake-ip 的 198.18.0.0/15
|
|
420
|
-
fetchPrefer: exa # exa | firecrawl —— 两者都失败后先试哪个 keyed 抓取层
|
|
420
|
+
fetchPrefer: exa # exa | firecrawl —— 两者都失败后先试哪个 keyed 抓取层
|
|
421
|
+
deepseekFetchBaseUrl: "" # 可选:自定义 DeepSeek 兼容抓取端点(…/fetch),留空不启用;失败自动回落直连 / exa / firecrawl
|
|
422
|
+
deepseekFetchApiKey: ... # 可选:只给这个抓取端点用;留空依次复用工具 key、DEEPSEEK_API_KEY
|
|
421
423
|
region: cn-zh # DuckDuckGo 区域(可选)
|
|
422
424
|
searxngInstances: # 自定义 SearXNG 实例(可选)
|
|
423
425
|
- https://your-instance.example
|
|
@@ -428,7 +430,7 @@ degoogApiKey: ... # 可选:实例开启 API Key 时使用的 Bearer
|
|
|
428
430
|
safeSearch: off # 安全搜索:off(默认)/ moderate / strict,作用于 bing / ddg / ddg-lite
|
|
429
431
|
blockedDomains: # 域名黑名单(可选):命中的域名不会进入结果
|
|
430
432
|
- spam-example.com
|
|
431
|
-
allowedEngines: []
|
|
433
|
+
allowedEngines: [...ALL] # 唯一启用列表;默认全部当前引擎,升级新增的引擎需手动加入
|
|
432
434
|
multiMaxEngines: 0 # multi 并发上限(0 = 不限,跑完整语言池);设置页有 Fast/Balanced/Deep 档位
|
|
433
435
|
multiMinSources: 1 # multi 目标成功源数(只用于触发补跑,不是硬下限)
|
|
434
436
|
multiMaxResults: 20 # multi 合并去重后的结果上限(1-100)
|
|
@@ -636,7 +638,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
636
638
|
|
|
637
639
|
#### 离线自检断言(tools/)
|
|
638
640
|
|
|
639
|
-
仓库自带 **
|
|
641
|
+
仓库自带 **74 个**零依赖断言脚本(合计 **1072 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑。一次跑全部:`npm test`。
|
|
640
642
|
|
|
641
643
|
| 脚本 | 覆盖 | 运行(项数) |
|
|
642
644
|
|---|---|---|
|
|
@@ -653,7 +655,8 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
653
655
|
| `assert-slash-commands.mjs` | 斜杠命令开关:`slashCommands` 默认开、设置页读写、两个命令按配置注册/注销、关闭后提示词不再提 `/free-search-engine` | `node tools/assert-slash-commands.mjs`(4) |
|
|
654
656
|
| `assert-keyless-first.mjs` | 免 key 优先:`keylessFirst` 默认关、开启后先走免 key 档,限流/鉴权/网络失败改用 key 并休息、其他失败不动用 key、无 key 行为不变,覆盖 Tavily、Exa 与 multi 模式 | `node tools/assert-keyless-first.mjs`(13) |
|
|
655
657
|
| `assert-zhipu.mjs` | 智谱搜索:catalog/回退链、请求头与 engine/count/recency、Sogou 步进、响应映射、错误分类、无 key | `node tools/assert-zhipu.mjs`(6) |
|
|
656
|
-
| `assert-deepseek-snippets.mjs` | deepseek-tools 摘要:默认 600、0 不截断、总预算上限、短条目保留 | `node tools/assert-deepseek-snippets.mjs`(
|
|
658
|
+
| `assert-deepseek-snippets.mjs` | deepseek-tools 摘要:默认 600、0 不截断、总预算上限、短条目保留 | `node tools/assert-deepseek-snippets.mjs`(5) |
|
|
659
|
+
| `assert-deepseek-official.mjs` | DeepSeek Official:Anthropic Messages + deepseek_web_search、title/snippet/site_name/page_age 映射、citation 回退、源码守卫 | `node tools/assert-deepseek-official.mjs`(4) |
|
|
657
660
|
| `assert-bing-relevance.mjs` | Bing 相关性(#112):单字中文 token 被剔除、无关替代 SERP 被拒、真正相关的结果通过、只命中通用引擎名的整批被拒、单一 token 覆盖一半时放行、单字/纯数字查询的显式行为 | `node tools/assert-bing-relevance.mjs`(6) |
|
|
658
661
|
| `assert-relevance-pools.mjs` | 相关性守卫与语言池(#132/#133):AnySearch 无关批次判空、相关批次保留、shared.js 守卫被 anysearch/searxng/ddg/ddg-lite/degoog/keenable 使用、doctor 地区默认文案与语言池告警、缓存 key 随 zhPool/enPool 变化 | `node tools/assert-relevance-pools.mjs`(5) |
|
|
659
662
|
| `assert-quality.mjs` | 研究证据闸门:8 源 / 3 域 / 3 正文 / 2 日期为 high,3 源 / 2 域 / 1 正文为 medium,单源与失败注记为 low,空包为 low,research 的 schema/输出/brief 接线 | `node tools/assert-quality.mjs`(6) |
|
|
@@ -664,7 +667,8 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
664
667
|
| `assert-prompt-contract.mjs` | 系统提示词契约:**检索≠抓取**、不可信边界、模型内置搜索只在显式选中时运行 | `node tools/assert-prompt-contract.mjs`(9) |
|
|
665
668
|
| `assert-research-degradation.mjs` | research 无 key 全降级、`node:sqlite` no-op、90s 预算隔离、缓存目录可配置、`budget.exhausted` 契约名 | `node tools/assert-research-degradation.mjs`(19) |
|
|
666
669
|
| `assert-research-call-wrappers.mjs` | research 四个 `call*` 包装层的替身/底层透传(#75 回归) | `node tools/assert-research-call-wrappers.mjs`(23) |
|
|
667
|
-
| `assert-fetch-chain.mjs` | `fs-quality-fetch` 四层链序、任一层命中即停、exa 失败静默降级 firecrawl、全层失败聚合报错、http 目标进到 tier 链而不是被入口断言拒绝 | `node tools/assert-fetch-chain.mjs`(9) |
|
|
670
|
+
| `assert-fetch-chain.mjs` | `fs-quality-fetch` 四层链序、任一层命中即停、exa 失败静默降级 firecrawl、全层失败聚合报错、http 目标进到 tier 链而不是被入口断言拒绝 | `node tools/assert-fetch-chain.mjs`(9) |
|
|
671
|
+
| `assert-deepseek-fetch.mjs` | #124 自定义 DeepSeek 兼容抓取端点:base/完整 URL 归一化、作为第一档命中即停、失败回落、未配置不出现、短内容被拒、明文 http 请求形状与鉴权、401/429/空正文的错误分类、配置/MCP/设置页接线 | `node tools/assert-deepseek-fetch.mjs`(8) |
|
|
668
672
|
| `assert-fetch-ssrf.mjs` | 抓取 SSRF 防护:公网/私网/保留地址判定、DNS 解析到私网拒绝、localhost 与 IP 字面量拒绝、`http://` 与 `https://` 放行而其他协议与带凭据 URL 拒绝、http 目标解析到私网同样拒绝、fake-ip 网段默认拒绝且仅按配置放行、IPv6 ULA 显式放行、放行后仍拒绝回环/IPv4 私网/链路本地、provider 接线与设置项 | `node tools/assert-fetch-ssrf.mjs`(10) |
|
|
669
673
|
| `assert-fetch-http.mjs` | 明文 http 目标(#143):直连层按协议选 transport、http 重定向可跟随、provider 不再在入口拒绝 http 而交给 tier 链、全层失败报直连原因而不再报 only https、非 http(s) 协议仍拒、`agentForUrl` 为 http 目标选明文隧道 agent、经 `CONNECT` 隧道抓取 http 页面 | `node tools/assert-fetch-http.mjs`(7) |
|
|
670
674
|
| `assert-mcp.mjs` | MCP stdio 面:initialize 协议协商、tools/list 的 JSON Schema、tools/call 文本结果、工具错误与 JSON-RPC 错误区分、必填参数校验、显式付费引擎与新 provider、advanced/multi/domain/platform/video/research/weather 新工具、bin/files 打包 | `node tools/assert-mcp.mjs`(10) |
|
|
@@ -778,8 +782,8 @@ This plugin solves exactly that: multiple free engines plus automatic fallback,
|
|
|
778
782
|
- **Zero Cost** — Multiple free engines with no API key or registration required
|
|
779
783
|
- **42 engines available** — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Tavily, Keenable, Firecrawl, Parallel, Brave (`brave`, official Search API, needs `BRAVE_API_KEY`), Zhipu (`zhipu`, official Web Search API, needs `ZHIPU_API_KEY`), Perplexity, SerpBase, Serply, Outcrawl, SpecStream (`specstream`, official Search API, needs `SPECSTREAM_API_KEY`), 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 30 of them; the 5 HTML SERP engines stay out by default and the per-call billed OpenAI / Gemini / Claude engines, Metaso, Yandex, Yuanbao and SpecStream run only when explicitly named.
|
|
780
784
|
- **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.
|
|
781
|
-
- **Engine
|
|
782
|
-
- **Global engine enable
|
|
785
|
+
- **Engine allowlist** — the plugin keeps a single `allowedEngines` enable list. Unchecked engines are removed from every search chain, Auto / Multi routing, engine tests and prompts. Engines added by later versions stay off until checked.
|
|
786
|
+
- **Global engine enable list & fallback priority** — the checklist is the allowlist itself: checked engines run, unchecked engines are excluded everywhere (web_search fallback, Auto routing, advanced_search, multi_search, engine tests). Engines added by later versions stay off. Reorder the global fallback chain with ↑↓ (one-click reset).
|
|
783
787
|
- **Popup Switch Command** — Type `/free-search-engine` in the chat: a picker opens with all engines; click one to switch (equivalent to the settings page + save).
|
|
784
788
|
- **Visual Badges** — Free engines feature a green `FREE` badge, while paid engines show an orange `API KEY` badge in the settings UI.
|
|
785
789
|
|
|
@@ -1172,7 +1176,7 @@ degoogApiKey: ... # Optional: bearer key, only when your instance enabl
|
|
|
1172
1176
|
safeSearch: off # Safe search: off (default) / moderate / strict; applies to bing / ddg / ddg-lite
|
|
1173
1177
|
blockedDomains: # Domain blocklist (optional): matching domains never enter the results
|
|
1174
1178
|
- spam-example.com
|
|
1175
|
-
allowedEngines: []
|
|
1179
|
+
allowedEngines: [...ALL] # The only enable list; defaults to all current engines, new engines need manual opt-in
|
|
1176
1180
|
multiMaxEngines: 0 # multi concurrency cap (0 = unlimited, whole language pool); the settings UI has Fast/Balanced/Deep presets
|
|
1177
1181
|
multiMinSources: 1 # multi target source count (only triggers top-up runs; not a hard minimum)
|
|
1178
1182
|
multiMaxResults: 20 # ceiling for unique results after merge (1-100)
|
|
@@ -1380,7 +1384,7 @@ Restart `dsh web` after switching to apply changes.
|
|
|
1380
1384
|
|
|
1381
1385
|
#### Offline self-check assertions (`tools/`)
|
|
1382
1386
|
|
|
1383
|
-
**Seventy-
|
|
1387
|
+
**Seventy-four** zero-dependency assertion scripts ship with the repo (**1072 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20. Run everything with `npm test`.
|
|
1384
1388
|
|
|
1385
1389
|
| Script | Covers | Run (count) |
|
|
1386
1390
|
|---|---|---|
|
|
@@ -1397,7 +1401,8 @@ Restart `dsh web` after switching to apply changes.
|
|
|
1397
1401
|
| `assert-slash-commands.mjs` | Slash-command switch: `slashCommands` defaults on, settings load/save it, both commands register/unregister from config, and the prompt stops naming `/free-search-engine` when off | `node tools/assert-slash-commands.mjs` (4) |
|
|
1398
1402
|
| `assert-keyless-first.mjs` | Keyless tier first: `keylessFirst` defaults off; when on, the keyless tier runs first and a rate limit, auth demand or network failure falls back to the key (which then rests the keyless tier), other failures leave the key alone, and no-key behaviour is unchanged; covers Tavily, Exa and multi mode | `node tools/assert-keyless-first.mjs` (13) |
|
|
1399
1403
|
| `assert-zhipu.mjs` | Zhipu Web Search: catalog/fallback wiring, auth and request engine/count/recency, Sogou count steps, response mapping, error classes, missing key | `node tools/assert-zhipu.mjs` (6) |
|
|
1400
|
-
| `assert-deepseek-snippets.mjs` | deepseek-tools snippets: default 600, 0 disables the cap, total budget ceiling,
|
|
1404
|
+
| `assert-deepseek-snippets.mjs` | deepseek-tools snippets: default 600, 0 disables the cap, total budget ceiling, short results survive, summary+snippet joining, and site labels | `node tools/assert-deepseek-snippets.mjs` (5) |
|
|
1405
|
+
| `assert-deepseek-official.mjs` | DeepSeek Official: Anthropic Messages + deepseek_web_search, title/snippet/site_name/page_age mapping, citation fallback, source guard | `node tools/assert-deepseek-official.mjs` (4) |
|
|
1401
1406
|
| `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) |
|
|
1402
1407
|
| `assert-relevance-pools.mjs` | Relevance guard and language pools (#132/#133): AnySearch drops an unrelated batch but keeps a matching one, the shared guard is used by anysearch/searxng/ddg/ddg-lite/degoog/keenable, doctor reports the geo default and warns about unused pools, and the cache key changes with zhPool/enPool | `node tools/assert-relevance-pools.mjs` (5) |
|
|
1403
1408
|
| `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) |
|