dsh-free-search 0.9.60 → 0.9.62

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
@@ -77,7 +77,7 @@
77
77
 
78
78
  #### 抓取与工具
79
79
 
80
- - **网页抓取(web_fetch)** —— 让 agent 抓取网页内容(官方 `dsh-web-fetch-http` provider,纯 JS,零额外依赖),可自动接管 `web.fetchProvider` 为插件的直连 → 浏览器渲染 → exa / firecrawl → crawl4ai 质量链。T1.5 浏览器渲染可在设置页关闭,exa 与 firecrawl 的先后顺序也可切换;私网、回环和云元数据地址一律拒绝(SSRF 防护)。Clash / mihomo TUN 的 fake-ip 网段(常见 198.18.0.0/15)可在「额外允许的网段」里显式放行,否则系统 DNS 返回的占位地址会被当成私网拒绝。
80
+ - **网页抓取(web_fetch)** —— 让 agent 抓取网页内容(官方 `dsh-web-fetch-http` provider,纯 JS,零额外依赖),可自动接管 `web.fetchProvider` 为插件的直连 → 浏览器渲染 → exa / firecrawl → crawl4ai 质量链。T1.5 浏览器渲染可在设置页关闭,exa 与 firecrawl 的先后顺序也可切换;默认只抓 HTTPS,设置页可开启 `allowHttp`(HTTP 目标先尝试 HTTPS 升级,再走 HTTP / 浏览器 / 云端);私网、回环和云元数据地址一律拒绝(SSRF 防护)。Clash / mihomo TUN 的 fake-ip 网段(常见 198.18.0.0/15)可在「额外允许的网段」里显式放行,否则系统 DNS 返回的占位地址会被当成私网拒绝。
81
81
 
82
82
  <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/ui-fetch.png" alt="抓取与平台:web_fetch 接管、Key 存储位置与平台搜索开关" width="100%" />
83
83
  <sub>▲ 抓取:自动接管 web_fetch、Key 存储位置与平台搜索开关</sub>
@@ -264,7 +264,7 @@ DSH 0.2.1 设置 → 网页搜索 → **DeepSeek 搜索 API** 开关会和本插
264
264
 
265
265
  | 操作 | 结果 |
266
266
  |---|---|
267
- | 打开开关 | `web.searchProvider` 写成 `deepseek-search-api`(属于「显式选择其他 provider」),**本插件主动让路**,搜索走官方直连 API;抓取同时变成 `deepseek-fetch-api` |
267
+ | 打开开关 | `web.searchProvider` 写成 `deepseek-search-api`(属于「显式选择其他 provider」),**本插件主动让路**,搜索走官方直连 API;抓取同时变成 `deepseek-fetch-api`。**0.9.62 起**抓取侧仍会接管为 `fs-quality-fetch`,搜索侧保持官方选择 |
268
268
  | 关闭开关 | DSH 会把整行 `- id: web` 删掉,provider 回到当前版本的官方默认:0.2.2-rc.2 起是 `deepseek-search-api`(按 Search API 计费),旧版是 `deepseek-official`(模型搜索,一次完整 aux 请求,按 token 计费);都不是免费引擎 |
269
269
  | 关闭后 | **0.9.8 起**:插件检测到任一官方默认会在运行时补一次接管(日志 `DSH's search switch put the web providers back to the official defaults — re-took …`),通常几秒内恢复免费链路;若没恢复,完整重启 DSH |
270
270
 
@@ -533,6 +533,7 @@ Search engine test:
533
533
 
534
534
  - 自动跟随重定向、解码正文(HTML 转文本)
535
535
  - 支持超时和大小限制
536
+ - 默认只抓 HTTPS;HTTP 目标默认被拒绝。设置页开启「允许抓取 http 页面」后,会先尝试 HTTPS 升级,失败再走 HTTP / 浏览器 / 云端 tier
536
537
  - ⚠️ 注意:`web_fetch` 默认拒绝回环、私网、链路本地和云元数据地址。若使用 Clash / mihomo TUN 的 fake-ip DNS,请把对应网段(常见 `198.18.0.0/15`)加入设置页的「额外允许的网段」,否则所有被代理域名都会被判成私网而抓取失败;只放行 fake-ip 网段,不要放行 RFC1918;IPv6 fake-ip 常用 ULA(如 `fdfe:dcba:9876::/64`),需要显式加入才会放行。
537
538
 
538
539
  #### MCP server(stdio)
@@ -543,7 +544,7 @@ Search engine test:
543
544
  npx -y -p dsh-free-search dsh-free-search-mcp
544
545
  ```
545
546
 
546
- `web_search` 默认只自动调用免 key 的 Bing / DuckDuckGo;在参数或 `MCP_SEARCH_ENGINE` 里显式点名 `google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu` 时才会使用付费引擎。支持 `time_range`(day/week/month/year)。`advanced_search` 是同一后端的兼容别名,便于按宿主工具名调用。`web_fetch` 仍走直连 / 浏览器 / Exa / Firecrawl。`multi_search` 并行合并多个引擎(默认只跑免费引擎),`domain_search` 直查包/论文/CVE/财报/金融/法律等垂直源,`platform_search` 直查 GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/掘金/豆瓣/Qiita/YouTube/Vimeo/X,`video_search` 查 Bing/DDG 视频,`research` 做轻量多引擎检索 + 抓取 + 证据摘要,`weather` 查询 1–7 天天气;不监听端口。Claude Desktop 配置示例:
547
+ `web_search` 默认只自动调用免 key 的 Bing / DuckDuckGo;在参数或 `MCP_SEARCH_ENGINE` 里显式点名 `google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu` 时才会使用付费引擎;`anysearch` / `searxng` / `exa` / `tavily` / `keenable` / `firecrawl` / `parallel` / `you` 可显式选择,且有免 key 档。支持 `time_range`(day/week/month/year)。`advanced_search` 是同一后端的兼容别名,便于按宿主工具名调用。`web_fetch` 仍走直连 / 浏览器 / Exa / Firecrawl。`multi_search` 并行合并多个引擎(默认只跑免费引擎),`domain_search` 直查包/论文/CVE/财报/金融/法律等垂直源,`platform_search` 直查 GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/掘金/豆瓣/Qiita/YouTube/Vimeo/X,`video_search` 查 Bing/DDG 视频,`research` 做轻量多引擎检索 + 抓取 + 证据摘要,`weather` 查询 1–7 天天气;不监听端口。Claude Desktop 配置示例:
547
548
 
548
549
  ```json
549
550
  {
@@ -557,7 +558,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
557
558
  }
558
559
  ```
559
560
 
560
- 环境变量:`MCP_SEARCH_ENGINE`(默认 auto,也可指定任意引擎 id)、`MCP_MAX_RESULTS`、`MCP_SAFE_SEARCH`、`MCP_LANG`、`MCP_BING_MARKET`、`MCP_BROWSER_FETCH`、`MCP_ALLOW_FAKE_IP_CIDRS`。付费引擎按需读取:`GOOGLE_CSE_API_KEY` + `GOOGLE_CSE_ID`、`BAIDU_API_KEY`、`BRAVE_API_KEY`、`METASO_API_KEY` / `MCP_METASO_SCOPE`、`YANDEX_API_KEY` + `YANDEX_FOLDER_ID`、`TENCENTCLOUD_WSA_APIKEY` / `MCP_YUANBAO_MODE` / `MCP_YUANBAO_SITE`、`DEEPSEEK_TOOLS_API_KEY` 或 `DEEPSEEK_API_KEY`、`ZHIPU_API_KEY` / `MCP_ZHIPU_SEARCH_ENGINE`;抓取层可用 `EXA_API_KEY` / `FIRECRAWL_API_KEY`。
561
+ 环境变量:`MCP_SEARCH_ENGINE`(默认 auto,也可指定任意引擎 id)、`MCP_MAX_RESULTS`、`MCP_SAFE_SEARCH`、`MCP_LANG`、`MCP_BING_MARKET`、`MCP_BROWSER_FETCH`、`MCP_ALLOW_FAKE_IP_CIDRS`。付费/可选 key 引擎按需读取:`GOOGLE_CSE_API_KEY` + `GOOGLE_CSE_ID`、`BAIDU_API_KEY`、`BRAVE_API_KEY`、`METASO_API_KEY` / `MCP_METASO_SCOPE`、`YANDEX_API_KEY` + `YANDEX_FOLDER_ID`、`TENCENTCLOUD_WSA_APIKEY` / `MCP_YUANBAO_MODE` / `MCP_YUANBAO_SITE`、`DEEPSEEK_TOOLS_API_KEY` 或 `DEEPSEEK_API_KEY`、`ZHIPU_API_KEY` / `MCP_ZHIPU_SEARCH_ENGINE`;免 key 档可选 `ANYSEARCH_API_KEY`、`MCP_SEARXNG_INSTANCES` / `MCP_SEARXNG_BEARER_TOKEN`、`EXA_API_KEY`、`TAVILY_API_KEY`、`KEENABLE_API_KEY`、`FIRECRAWL_API_KEY`、`PARALLEL_API_KEY`、`YDC_API_KEY`(旧名 `YOUCOM_API_KEY` 亦可)。
561
562
 
562
563
  #### 平台搜索(platform_search)
563
564
 
@@ -705,7 +706,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
705
706
  | `assert-fetch-abort.mjs` | 抓取中断(#87):压缩响应中途断连必须 reject(不再永久 pending)、明文断连同样 reject、abort 能打断停滞的 gzip 流、complete 响应与重定向仍正常 | `node tools/assert-fetch-abort.mjs`(6) |
706
707
  | `assert-fetch-proxy.mjs` | 抓取层代理:`http_proxy` / `https_proxy` / `all_proxy` / `no_proxy` 解析(大小写与小写优先、空值视为未设置)、`NO_PROXY` 的域名 / `host:port` / `*` 匹配、loopback 恒直连、`socks5://` 忽略、`CONNECT` 隧道握手与 `Proxy-Authorization`、代理拒绝与提前断连不挂起、有 agent 时重定向每一跳仍过 SSRF 校验、浏览器 tier 的 `--proxy-server` | `node tools/assert-fetch-proxy.mjs`(12) |
707
708
  | `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) |
708
- | `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) |
709
+ | `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) |
709
710
 
710
711
  任何一个失败会以非 0 退出码结束并列出失败项;把某个旧版本文件路径作为参数传进去,可以看到修复前必红(用来证明断言不是空转)。改动发布相关逻辑后建议先跑一遍再发版。
711
712
 
@@ -812,7 +813,7 @@ This plugin solves exactly that: multiple free engines plus automatic fallback,
812
813
 
813
814
  #### Fetch and tools
814
815
 
815
- - **Webpage Fetching (`web_fetch`)** — Allows the agent to read full webpage contents (official `dsh-web-fetch-http` provider, pure JS, zero extra dependencies); it can take over `web.fetchProvider` with the plugin's direct → browser render → exa / firecrawl → crawl4ai quality chain. The headless browser tier can be switched off in Settings and the exa/firecrawl order is configurable; loopback, private-network and cloud-metadata addresses are rejected (SSRF guard). Clash / mihomo TUN fake-ip ranges (usually 198.18.0.0/15) can be allowed explicitly under extra allowed networks, otherwise the placeholder addresses returned by system DNS are rejected as private.
816
+ - **Webpage Fetching (`web_fetch`)** — Allows the agent to read full webpage contents (official `dsh-web-fetch-http` provider, pure JS, zero extra dependencies); it can take over `web.fetchProvider` with the plugin's direct → browser render → exa / firecrawl → crawl4ai quality chain. The headless browser tier can be switched off in Settings and the exa/firecrawl order is configurable; only HTTPS is fetched by default and the API target first tries HTTPS, then HTTP / browser / cloud tiers when `allowHttp` is enabled in Settings; loopback, private-network and cloud-metadata addresses are rejected (SSRF guard). Clash / mihomo TUN fake-ip ranges (usually 198.18.0.0/15) can be allowed explicitly under extra allowed networks, otherwise the placeholder addresses returned by system DNS are rejected as private.
816
817
 
817
818
  <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/ui-fetch.png" alt="Fetch and platforms: web_fetch takeover, key storage and platform switches" width="100%" />
818
819
  <sub>▲ Fetch: web_fetch takeover, key storage location and platform search switches</sub>
@@ -1001,7 +1002,7 @@ DSH 0.2.1 has Settings → Web search → **DeepSeek search API**, which interac
1001
1002
 
1002
1003
  | Action | Result |
1003
1004
  |---|---|
1004
- | Turn the switch on | `web.searchProvider` becomes `deepseek-search-api` (an explicit choice), so **this plugin steps aside** and search goes through the official direct API; fetch becomes `deepseek-fetch-api` as well |
1005
+ | Turn the switch on | `web.searchProvider` becomes `deepseek-search-api` (an explicit choice), so search goes through the official direct API; fetch becomes `deepseek-fetch-api`. **Since 0.9.62** the fetch side is still taken over as `fs-quality-fetch`, while search stays on the official choice |
1005
1006
  | Turn the switch off | DSH deletes the whole `- id: web` row, so the provider falls back to the shipped default for the running DSH: `deepseek-search-api` since 0.2.2-rc.2 (billed per Search API call), or `deepseek-official` on older hosts (model search: a full auxiliary request, billed per token). Neither is a free engine |
1006
1007
  | After turning it off | **Since 0.9.8**: the plugin notices either official default and re-takes at runtime (log line `DSH's search switch put the web providers back to the official defaults — re-took …`), normally within seconds; if it does not, restart DSH |
1007
1008
 
@@ -1270,6 +1271,7 @@ After searching, the agent can **read full webpage content** (e.g., *"Open the f
1270
1271
 
1271
1272
  - Automatically follows redirects and decodes HTML to plain text.
1272
1273
  - Supports timeout and response size limits.
1274
+ - Fetches HTTPS only by default; plain HTTP URLs are rejected until "Allow plain HTTP fetches" is enabled in Settings, then it first tries an HTTPS upgrade before HTTP / browser / cloud tiers.
1273
1275
  - ⚠️ Note: `web_fetch` rejects loopback, private, link-local and cloud-metadata addresses by default. Under Clash / mihomo TUN fake-ip DNS, add the fake-ip range (usually `198.18.0.0/15`) to extra allowed networks in Settings, otherwise every proxied host resolves to a placeholder address and is rejected; only allow the fake-ip ranges, never RFC1918; IPv6 fake-ip often uses a ULA such as `fdfe:dcba:9876::/64`, which must be listed explicitly.
1274
1276
 
1275
1277
  #### MCP server (stdio)
@@ -1280,7 +1282,7 @@ The repo also ships a standalone stdio MCP server for Claude Desktop, Cursor, Co
1280
1282
  npx -y -p dsh-free-search dsh-free-search-mcp
1281
1283
  ```
1282
1284
 
1283
- `web_search` auto-runs only the keyless Bing / DuckDuckGo engines; a keyed engine (`google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu`) runs only when named in the argument or `MCP_SEARCH_ENGINE`. It supports `time_range` (day/week/month/year). `advanced_search` is a compatibility alias over the same backend for hosts that call that tool name. `web_fetch` still uses direct / browser / Exa / Firecrawl. `multi_search` merges several engines in parallel (free engines by default), `domain_search` queries structured package/paper/CVE/filing/finance/law sources, `platform_search` queries GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/Juejin/Douban/Qiita/YouTube/Vimeo/X, `video_search` queries Bing/DDG videos, `research` runs a lightweight multi-engine search + fetch + evidence brief, and `weather` returns a 1-7 day forecast; the server does not listen on a port. Claude Desktop example:
1285
+ `web_search` auto-runs only the keyless Bing / DuckDuckGo engines; a keyed engine (`google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu`) runs only when named in the argument or `MCP_SEARCH_ENGINE`; `anysearch` / `searxng` / `exa` / `tavily` / `keenable` / `firecrawl` / `parallel` / `you` can also be named explicitly and have keyless tiers. It supports `time_range` (day/week/month/year). `advanced_search` is a compatibility alias over the same backend for hosts that call that tool name. `web_fetch` still uses direct / browser / Exa / Firecrawl. `multi_search` merges several engines in parallel (free engines by default), `domain_search` queries structured package/paper/CVE/filing/finance/law sources, `platform_search` queries GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/Juejin/Douban/Qiita/YouTube/Vimeo/X, `video_search` queries Bing/DDG videos, `research` runs a lightweight multi-engine search + fetch + evidence brief, and `weather` returns a 1-7 day forecast; the server does not listen on a port. Claude Desktop example:
1284
1286
 
1285
1287
  ```json
1286
1288
  {
@@ -1294,7 +1296,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
1294
1296
  }
1295
1297
  ```
1296
1298
 
1297
- Environment: `MCP_SEARCH_ENGINE` (auto by default, or any explicit engine id), `MCP_MAX_RESULTS`, `MCP_SAFE_SEARCH`, `MCP_LANG`, `MCP_BING_MARKET`, `MCP_BROWSER_FETCH`, `MCP_ALLOW_FAKE_IP_CIDRS`. Keyed engines read their own env: `GOOGLE_CSE_API_KEY` + `GOOGLE_CSE_ID`, `BAIDU_API_KEY`, `BRAVE_API_KEY`, `METASO_API_KEY` / `MCP_METASO_SCOPE`, `YANDEX_API_KEY` + `YANDEX_FOLDER_ID`, `TENCENTCLOUD_WSA_APIKEY` / `MCP_YUANBAO_MODE` / `MCP_YUANBAO_SITE`, `DEEPSEEK_TOOLS_API_KEY` or `DEEPSEEK_API_KEY`, `ZHIPU_API_KEY` / `MCP_ZHIPU_SEARCH_ENGINE`; the fetch tiers can use `EXA_API_KEY` / `FIRECRAWL_API_KEY`.
1299
+ Environment: `MCP_SEARCH_ENGINE` (auto by default, or any explicit engine id), `MCP_MAX_RESULTS`, `MCP_SAFE_SEARCH`, `MCP_LANG`, `MCP_BING_MARKET`, `MCP_BROWSER_FETCH`, `MCP_ALLOW_FAKE_IP_CIDRS`. Keyed/optional engines read their own env: `GOOGLE_CSE_API_KEY` + `GOOGLE_CSE_ID`, `BAIDU_API_KEY`, `BRAVE_API_KEY`, `METASO_API_KEY` / `MCP_METASO_SCOPE`, `YANDEX_API_KEY` + `YANDEX_FOLDER_ID`, `TENCENTCLOUD_WSA_APIKEY` / `MCP_YUANBAO_MODE` / `MCP_YUANBAO_SITE`, `DEEPSEEK_TOOLS_API_KEY` or `DEEPSEEK_API_KEY`, `ZHIPU_API_KEY` / `MCP_ZHIPU_SEARCH_ENGINE`; keyless-capable engines can use `ANYSEARCH_API_KEY`, `MCP_SEARXNG_INSTANCES` / `MCP_SEARXNG_BEARER_TOKEN`, `EXA_API_KEY`, `TAVILY_API_KEY`, `KEENABLE_API_KEY`, `FIRECRAWL_API_KEY`, `PARALLEL_API_KEY`, `YDC_API_KEY` (the old `YOUCOM_API_KEY` alias also works).
1298
1300
 
1299
1301
  #### Platform Search (`platform_search`)
1300
1302
 
@@ -1440,7 +1442,7 @@ Restart `dsh web` after switching to apply changes.
1440
1442
  | `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) |
1441
1443
  | `assert-fetch-proxy.mjs` | proxy support for the fetch tiers: `http_proxy` / `https_proxy` / `all_proxy` / `no_proxy` parsing (either case, lowercase wins, empty means unset), `NO_PROXY` domain / `host:port` / `*` matching, loopback always direct, `socks5://` ignored, the `CONNECT` tunnel handshake and `Proxy-Authorization`, a refusing proxy and an early disconnect never hanging, the SSRF guard still applied to every redirect hop when an agent is in use, and `--proxy-server` for the browser tier | `node tools/assert-fetch-proxy.mjs` (12) |
1442
1444
  | `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) |
1443
- | `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) |
1445
+ | `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 search but still taking over fetch on the explicit `deepseek-fetch-api` switch, apply re-entry / duplicate registrations tolerated, and repeated logs deduplicated | `node tools/assert-provider-takeover.mjs` (20) |
1444
1446
 
1445
1447
  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.
1446
1448
 
package/lib/client.js CHANGED
@@ -450,6 +450,8 @@ window.__ModuleLoader__.load({
450
450
  fetchTakeoverHint: "开启时:web.fetchProvider 未设置或仍是出厂默认 http 会接管为 fs-quality-fetch。如果你刻意 pin 了 http(例如只想用内置抓取),关掉此项。",
451
451
  browserFetchLabel: "用本机浏览器渲染",
452
452
  browserFetchHint: "直连失败时用系统 Chrome/Edge 无头加载页面,能过 JS 挑战;没有浏览器时自动跳过。",
453
+ allowHttpLabel: "允许抓取 http 页面",
454
+ allowHttpHint: "默认只走 https;开启后 http 目标会先尝试 HTTPS 升级,失败再走 http / 浏览器 / 云端。内网和回环仍被 SSRF 拦截。",
453
455
  fakeIpCidrsLabel: "额外允许的网段(fake-ip 透明代理)",
454
456
  fakeIpCidrsHint: "一行一个 CIDR。Clash/mihomo TUN 的 fake-ip 通常是 198.18.0.0/15;只豁免这里列出的保留段;回环、IPv4 私网、链路本地和云元数据仍会被拦截,IPv6 ULA(fc00::/7)只有显式列出时才放行。",
455
457
  fetchPreferLabel: "抓取质量链顺序",
@@ -669,6 +671,8 @@ window.__ModuleLoader__.load({
669
671
  fetchTakeoverHint: "On: when web.fetchProvider is unset or still the factory default http, it is taken over as fs-quality-fetch. Turn this off if you deliberately pinned http (e.g. you only want the built-in fetcher).",
670
672
  browserFetchLabel: "Render with the local browser",
671
673
  browserFetchHint: "When direct fetch fails, load the page in headless Chrome/Edge to pass JS challenges; skipped when no browser is installed.",
674
+ allowHttpLabel: "Allow plain HTTP fetches",
675
+ allowHttpHint: "Off by default: only HTTPS is fetched. When on, an HTTP target first tries an HTTPS upgrade, then HTTP / browser / cloud tiers. Loopback and private addresses remain blocked by SSRF.",
672
676
  fakeIpCidrsLabel: "Extra allowed networks (fake-ip proxy)",
673
677
  fakeIpCidrsHint: "One CIDR per line. Clash/mihomo TUN fake-ip commonly uses 198.18.0.0/15; only the ranges listed here are exempted. Loopback, RFC1918, link-local and cloud metadata stay blocked.",
674
678
  fetchPreferLabel: "Fetch quality-chain order",
@@ -769,7 +773,7 @@ window.__ModuleLoader__.load({
769
773
  "cache_search",
770
774
  "domain_search",
771
775
  ];
772
- const PLUGIN_VERSION = "0.9.60";
776
+ const PLUGIN_VERSION = "0.9.62";
773
777
  const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
774
778
  // 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
775
779
  const NAV_ITEMS = [
@@ -1105,6 +1109,7 @@ window.__ModuleLoader__.load({
1105
1109
  const [bingMarket, setBingMarket] = react.useState("zh-CN");
1106
1110
  const [fetchProviderTakeover, setFetchProviderTakeover] = react.useState(true);
1107
1111
  const [browserFetch, setBrowserFetch] = react.useState(true);
1112
+ const [allowHttp, setAllowHttp] = react.useState(false);
1108
1113
  const [allowFakeIpCidrs, setAllowFakeIpCidrs] = react.useState("");
1109
1114
  const [fetchPrefer, setFetchPrefer] = react.useState("exa");
1110
1115
  const [anysearchKey, setAnysearchKey] = react.useState("");
@@ -1447,6 +1452,7 @@ window.__ModuleLoader__.load({
1447
1452
  setBingMarket(v.bingMarket === undefined ? "zh-CN" : v.bingMarket);
1448
1453
  setFetchProviderTakeover(v.fetchProviderTakeover !== false);
1449
1454
  setBrowserFetch(v.browserFetch !== false);
1455
+ setAllowHttp(v.allowHttp === true);
1450
1456
  setAllowFakeIpCidrs((Array.isArray(v.allowFakeIpCidrs) ? v.allowFakeIpCidrs : []).join("\n"));
1451
1457
  setFetchPrefer(v.fetchPrefer === "firecrawl" ? "firecrawl" : "exa");
1452
1458
  setLang(v.lang ?? "zh");
@@ -1677,6 +1683,7 @@ window.__ModuleLoader__.load({
1677
1683
  value: Number.isFinite(Number(snippetBudgetChars)) ? Math.max(0, Math.floor(Number(snippetBudgetChars))) : 0,
1678
1684
  });
1679
1685
  ops.push({ op: "set", path: ["browserFetch"], value: browserFetch });
1686
+ ops.push({ op: "set", path: ["allowHttp"], value: allowHttp });
1680
1687
  ops.push({
1681
1688
  op: "set",
1682
1689
  path: ["allowFakeIpCidrs"],
@@ -2863,6 +2870,32 @@ react_jsx_runtime.jsx("div", {
2863
2870
  }),
2864
2871
  ],
2865
2872
  }),
2873
+ react_jsx_runtime.jsx("div", {
2874
+ className: "dshfs-field",
2875
+ children: [
2876
+ react_jsx_runtime.jsx("label", {
2877
+ className: "dshfs-platform",
2878
+ children: [
2879
+ react_jsx_runtime.jsx("input", {
2880
+ type: "checkbox",
2881
+ checked: allowHttp,
2882
+ disabled: !ready || saving,
2883
+ onChange: (e) => {
2884
+ setAllowHttp(e.target.checked);
2885
+ setDirty(true);
2886
+ setFailed(false);
2887
+ setSaveError("");
2888
+ },
2889
+ }),
2890
+ t.allowHttpLabel,
2891
+ ],
2892
+ }),
2893
+ react_jsx_runtime.jsx("p", {
2894
+ className: "dshfs-hint",
2895
+ children: t.allowHttpHint,
2896
+ }),
2897
+ ],
2898
+ }),
2866
2899
  react_jsx_runtime.jsx("div", {
2867
2900
  className: "dshfs-field",
2868
2901
  children: [
@@ -6,6 +6,7 @@
6
6
  // ponytail: 无服务级令牌桶——web_fetch 为单发用户/agent 驱动调用,非扇出;若未来批量调用再引入共享调度。
7
7
 
8
8
  import https from "node:https";
9
+ import http from "node:http";
9
10
  import zlib from "node:zlib";
10
11
  import { spawn } from "node:child_process";
11
12
  import { existsSync, mkdtempSync, rmSync } from "node:fs";
@@ -352,6 +353,7 @@ export function createFetchProvider({
352
353
  browserEnabled = () => true,
353
354
  prefer = () => "exa",
354
355
  allowedCidrs = () => [],
356
+ allowHttp = () => false,
355
357
  validateUrl = assertPublicUrl,
356
358
  }) {
357
359
  // 每个 provider 实例按 proxy URL 复用同一条隧道 agent。
@@ -362,28 +364,45 @@ export function createFetchProvider({
362
364
  available() { return true; },
363
365
  async fetch(request, signal) {
364
366
  const url = String(request?.url || "");
365
- if (!/^https:\/\//i.test(url)) throw new Error(`fs-quality-fetch: only https URLs are supported (got "${url.slice(0, 60)}")`);
367
+ let target;
368
+ try {
369
+ target = new URL(url);
370
+ } catch {
371
+ throw new Error(`fs-quality-fetch: invalid URL (got "${url.slice(0, 60)}")`);
372
+ }
373
+ const isHttp = target.protocol === "http:";
374
+ if (isHttp && !allowHttp()) {
375
+ throw new Error(`fs-quality-fetch: http URLs require allowHttp (got "${url.slice(0, 60)}"); enable "Allow HTTP fetches" in Settings > Plugins > Free Search`);
376
+ }
377
+ if (!isHttp && target.protocol !== "https:") {
378
+ throw new Error(`fs-quality-fetch: only https URLs are supported (got "${url.slice(0, 60)}")`);
379
+ }
366
380
  // SSRF guard: never fetch loopback / private / metadata addresses, and use a
367
381
  // lookup that re-checks every redirect hop. Explicitly allowed CIDRs cover
368
382
  // transparent-proxy fake-ip ranges (Clash/mihomo 198.18.0.0/15).
369
383
  const allowed = allowedCidrs();
370
- await validateUrl(url, { allowedCidrs: allowed });
384
+ await validateUrl(url, { allowedCidrs: allowed, allowedProtocols: allowHttp() ? ["https:", "http:"] : ["https:"] });
371
385
  const errors = [];
372
386
 
373
387
  // T1:直连(文本类内容;二进制交给后层——exa 取正文,PDF 等仍由 firecrawl 处理)
374
388
  try {
375
- // 沿用宿主/环境里的代理配置:T1 用 node:https,看不到 undici 的全局 dispatcher。
376
- const r = await httpsGetFollow(url, {
377
- headers: browserishHeaders(acceptLanguage()),
378
- signal,
379
- lookup: makeSafeLookup(allowed),
380
- agent: agentForUrl(url, { settings: readProxyEnv(), cache: proxyAgents }),
381
- });
382
- if (r.status < 400 && TEXTUAL.test(r.contentType) && r.text.length >= T1_MIN_CHARS) {
383
- return { url: r.url, statusCode: r.status, body: { kind: "html", content: stripLoneSurrogates(r.text) }, truncated: false };
389
+ const proxyUrl = proxyForTarget(url, readProxyEnv());
390
+ const directUrl = isHttp ? `https://${target.host}${target.pathname}${target.search}` : url;
391
+ if (isHttp && proxyUrl) {
392
+ errors.push("direct: http target with a proxy is left to the browser/upstream tier");
393
+ } else {
394
+ const r = await httpsGetFollow(directUrl, {
395
+ headers: browserishHeaders(acceptLanguage()),
396
+ signal,
397
+ lookup: makeSafeLookup(allowed),
398
+ agent: isHttp ? null : agentForUrl(url, { settings: readProxyEnv(), cache: proxyAgents }),
399
+ }, isHttp ? http : https);
400
+ if (r.status < 400 && TEXTUAL.test(r.contentType) && r.text.length >= T1_MIN_CHARS) {
401
+ return { url: r.url, statusCode: r.status, body: { kind: "html", content: stripLoneSurrogates(r.text) }, truncated: false };
402
+ }
403
+ if (r.status >= 400) errors.push(`direct HTTP ${r.status}`);
404
+ else errors.push(`direct: ${r.contentType || "unknown type"} ${r.text.length}B`);
384
405
  }
385
- if (r.status >= 400) errors.push(`direct HTTP ${r.status}`);
386
- else errors.push(`direct: ${r.contentType || "unknown type"} ${r.text.length}B`);
387
406
  } catch (e) { errors.push(`direct: ${e.message}`); }
388
407
 
389
408
  // T1.5:系统浏览器无头渲染(执行 JS 过挑战,抓直连拿不到的页面;无浏览器或设置里关掉时跳过)
package/lib/index.js CHANGED
@@ -1223,6 +1223,8 @@ const Config = z.object({
1223
1223
  fetchProviderTakeover: z.boolean().default(true).volatile(),
1224
1224
  // T1.5 headless browser rendering (default on, matching 0.9.x behaviour).
1225
1225
  browserFetch: z.boolean().default(true).volatile(),
1226
+ // Opt-in plain-HTTP fetching. Default off: the direct tier only speaks HTTPS.
1227
+ allowHttp: z.boolean().default(false).volatile(),
1226
1228
  // Opt-in reserved ranges for transparent-proxy fake-ip DNS (Clash/mihomo
1227
1229
  // commonly use 198.18.0.0/15). Loopback / RFC1918 / link-local stay blocked.
1228
1230
  allowFakeIpCidrs: z.array(z.string()).default([]).volatile(),
@@ -2265,7 +2267,7 @@ function apply(ctx, config) {
2265
2267
  takeOverOps(ctx.web, "searchProvider", provider.id, ops);
2266
2268
  }
2267
2269
  if (
2268
- (config.fetchProvider === "http" || config.fetchProvider === undefined) &&
2270
+ (config.fetchProvider === "http" || config.fetchProvider === undefined || isFactoryFetchDefault(config.searchProvider, config.fetchProvider)) &&
2269
2271
  current().fetchProviderTakeover !== false
2270
2272
  ) {
2271
2273
  takeOverOps(ctx.web, "fetchProvider", fetchProvider.id, ops);
@@ -2359,8 +2361,14 @@ function apply(ctx, config) {
2359
2361
  // 旧版本是 deepseek-official。打开 DSH 的 DeepSeek 搜索开关还会把 fetch 改成
2360
2362
  // deepseek-fetch-api;这属于显式选择,插件不能再抢搜索。
2361
2363
  const OFFICIAL_SEARCH_PROVIDER_IDS = new Set(["deepseek-search-api", "deepseek-official"]);
2364
+ const OFFICIAL_FETCH_PROVIDER_ID = "deepseek-fetch-api";
2362
2365
  const isFactorySearchDefault = (searchId, fetchId) =>
2363
- OFFICIAL_SEARCH_PROVIDER_IDS.has(searchId) && fetchId !== "deepseek-fetch-api";
2366
+ OFFICIAL_SEARCH_PROVIDER_IDS.has(searchId) && fetchId !== OFFICIAL_FETCH_PROVIDER_ID;
2367
+ // DSH's DeepSeek switch sets BOTH official providers. The fetch side is still
2368
+ // the factory choice, so it must be eligible for takeover even though the
2369
+ // search side stays explicit.
2370
+ const isFactoryFetchDefault = (searchId, fetchId) =>
2371
+ fetchId === OFFICIAL_FETCH_PROVIDER_ID && OFFICIAL_SEARCH_PROVIDER_IDS.has(searchId);
2364
2372
 
2365
2373
  // provider 选择的读取与接管。DSH 0.2.1-rc.2 起,web 的 provider 选择收进了
2366
2374
  // config 的 volatile ref(config.searchProvider / config.fetchProvider),
@@ -2398,6 +2406,7 @@ function apply(ctx, config) {
2398
2406
  // #92:web_fetch 栈与 searchOnce 分开结算,这里按当前请求结算,而不是复用上一次请求留下的值。
2399
2407
  acceptLanguage: () => acceptLanguageFor(current()),
2400
2408
  browserEnabled: () => current().browserFetch !== false,
2409
+ allowHttp: () => current().allowHttp === true,
2401
2410
  prefer: () => (current().fetchPrefer === "firecrawl" ? "firecrawl" : "exa"),
2402
2411
  allowedCidrs: () => current().allowFakeIpCidrs ?? [],
2403
2412
  });
@@ -2410,7 +2419,11 @@ function apply(ctx, config) {
2410
2419
  const ops = [];
2411
2420
 
2412
2421
  const fetchSelection = providerSelection(ctx.web, "fetchProvider");
2413
- if (!fetchSelection.current || (fetchSelection.current === "http" && current().fetchProviderTakeover !== false)) {
2422
+ if (
2423
+ !fetchSelection.current ||
2424
+ ((fetchSelection.current === "http" || isFactoryFetchDefault(providerSelection(ctx.web, "searchProvider").current, fetchSelection.current)) &&
2425
+ current().fetchProviderTakeover !== false)
2426
+ ) {
2414
2427
  takeOverOps(ctx.web, "fetchProvider", fetchProvider.id, ops);
2415
2428
  logOnce(
2416
2429
  logger,
@@ -12,6 +12,14 @@ import { searchZhipu } from "./engines/zhipu.js";
12
12
  import { searchYandex } from "./engines/yandex.js";
13
13
  import { searchYuanbao } from "./engines/yuanbao.js";
14
14
  import { searchDeepSeekTools } from "./engines/deepseek-tools.js";
15
+ import { searchExa, searchExaMCP } from "./engines/exa.js";
16
+ import { searchTavily } from "./engines/tavily.js";
17
+ import { searchKeenable } from "./engines/keenable.js";
18
+ import { searchFirecrawl } from "./engines/firecrawl.js";
19
+ import { searchParallel, searchParallelMCP } from "./engines/parallel.js";
20
+ import { searchYoucom } from "./engines/you.js";
21
+ import { searchAnysearch } from "./engines/anysearch.js";
22
+ import { searchSearxng } from "./engines/searxng.js";
15
23
  import { parseTimeRange } from "./engines/shared.js";
16
24
 
17
25
  export const MCP_ENGINE_IDS = [
@@ -19,6 +27,14 @@ export const MCP_ENGINE_IDS = [
19
27
  "bing",
20
28
  "ddg",
21
29
  "ddg-lite",
30
+ "anysearch",
31
+ "searxng",
32
+ "exa",
33
+ "tavily",
34
+ "keenable",
35
+ "firecrawl",
36
+ "parallel",
37
+ "you",
22
38
  "google",
23
39
  "baidu",
24
40
  "brave",
@@ -30,6 +46,7 @@ export const MCP_ENGINE_IDS = [
30
46
  ];
31
47
 
32
48
  export const MCP_FREE_ENGINES = ["bing", "ddg", "ddg-lite"];
49
+ export const MCP_KEYLESS_ENGINES = ["anysearch", "searxng", "exa", "tavily", "keenable", "firecrawl", "parallel", "you"];
33
50
  export const MCP_KEYED_ENGINES = ["google", "baidu", "brave", "metaso", "yandex", "yuanbao", "deepseek-tools", "zhipu"];
34
51
 
35
52
  function env(name, fallback = "") {
@@ -83,6 +100,54 @@ export async function runMcpEngine(id, query, options = {}) {
83
100
  return { engine, ...(await searchDdgHtml(query, maxResults, { safeSearch, timeRange }, signal)) };
84
101
  case "ddg-lite":
85
102
  return { engine, ...(await searchDdgLite(query, maxResults, { safeSearch, timeRange }, signal)) };
103
+ case "anysearch":
104
+ return {
105
+ engine,
106
+ ...(await searchAnysearch(query, maxResults, signal, env("ANYSEARCH_API_KEY"))),
107
+ };
108
+ case "searxng": {
109
+ const instances = env("MCP_SEARXNG_INSTANCES")
110
+ .split(/[\s,]+/)
111
+ .map((entry) => entry.trim())
112
+ .filter(Boolean);
113
+ return {
114
+ engine,
115
+ ...(await searchSearxng(query, maxResults, {
116
+ timeRange,
117
+ ...(instances.length ? { searxngInstances: instances } : {}),
118
+ ...(env("MCP_SEARXNG_BEARER_TOKEN") ? { searxngBearerToken: env("MCP_SEARXNG_BEARER_TOKEN") } : {}),
119
+ }, signal)),
120
+ };
121
+ }
122
+ case "exa": {
123
+ const key = env("EXA_API_KEY");
124
+ return {
125
+ engine,
126
+ ...(key
127
+ ? await searchExa(query, maxResults, key, timeRange, signal)
128
+ : await searchExaMCP(query, maxResults, signal)),
129
+ };
130
+ }
131
+ case "tavily":
132
+ return { engine, ...(await searchTavily(query, maxResults, env("TAVILY_API_KEY"), timeRange, signal)) };
133
+ case "keenable":
134
+ return { engine, ...(await searchKeenable(query, maxResults, env("KEENABLE_API_KEY"), timeRange, signal)) };
135
+ case "firecrawl":
136
+ return { engine, ...(await searchFirecrawl(query, maxResults, env("FIRECRAWL_API_KEY"), timeRange, signal)) };
137
+ case "parallel": {
138
+ const key = env("PARALLEL_API_KEY");
139
+ return {
140
+ engine,
141
+ ...(key
142
+ ? await searchParallel(query, maxResults, key, timeRange, signal)
143
+ : await searchParallelMCP(query, maxResults, timeRange, signal)),
144
+ };
145
+ }
146
+ case "you":
147
+ return {
148
+ engine,
149
+ ...(await searchYoucom(query, maxResults, env("YDC_API_KEY") || env("YOUCOM_API_KEY"), signal)),
150
+ };
86
151
  case "google": {
87
152
  const key = requireEnv("GOOGLE_CSE_API_KEY", "Google");
88
153
  const cx = requireEnv("GOOGLE_CSE_ID", "Google");
package/lib/mcp_server.js CHANGED
@@ -25,7 +25,7 @@ const TOOLS = [
25
25
  properties: {
26
26
  query: { type: "string", description: "Search query." },
27
27
  max_results: { type: "integer", minimum: 1, maximum: 20, description: "Number of results, default 8." },
28
- engine: { type: "string", enum: MCP_ENGINE_IDS, description: "Engine id; auto tries Bing then DuckDuckGo. Keyed engines are explicit." },
28
+ engine: { type: "string", enum: MCP_ENGINE_IDS, description: "Engine id; auto tries Bing then DuckDuckGo. Other engines are explicit; several keyless-capable engines work without a key." },
29
29
  safe_search: { type: "string", enum: SAFE_SEARCH, description: "Safe-search level." },
30
30
  time_range: { type: "string", enum: ["day", "week", "month", "year"], description: "Optional freshness filter." },
31
31
  },
@@ -67,7 +67,7 @@ const TOOLS = [
67
67
  {
68
68
  name: "multi_search",
69
69
  description:
70
- "Search several engines in parallel and return merged, deduplicated results with the engines that found each source. Defaults to the free engines; keyed engines run only when listed.",
70
+ "Search several engines in parallel and return merged, deduplicated results with the engines that found each source. Defaults to the free engines; other engines run only when listed.",
71
71
  inputSchema: {
72
72
  type: "object",
73
73
  properties: {
@@ -78,7 +78,7 @@ const TOOLS = [
78
78
  minItems: 1,
79
79
  maxItems: 10,
80
80
  uniqueItems: true,
81
- description: "Engine ids; default Bing + DuckDuckGo HTML/Lite. Keyed engines are explicit.",
81
+ description: "Engine ids; default Bing + DuckDuckGo HTML/Lite. Other engines are explicit.",
82
82
  },
83
83
  max_results: { type: "integer", minimum: 1, maximum: 20, description: "Total merged results, default 8." },
84
84
  time_range: { type: "string", enum: ["day", "week", "month", "year"], description: "Optional freshness filter." },
package/lib/ssrf.js CHANGED
@@ -145,14 +145,14 @@ export const safeLookup = makeSafeLookup();
145
145
  * Reject non-HTTPS URLs and hosts that resolve (or literally point) to a private
146
146
  * address. A custom lookup is allowed for tests.
147
147
  */
148
- export async function assertPublicUrl(rawUrl, { lookup = dns.promises.lookup, allowedCidrs = [] } = {}) {
148
+ export async function assertPublicUrl(rawUrl, { lookup = dns.promises.lookup, allowedCidrs = [], allowedProtocols = ["https:"] } = {}) {
149
149
  let target;
150
150
  try {
151
151
  target = new URL(String(rawUrl ?? ""));
152
152
  } catch {
153
153
  throw new Error("invalid URL");
154
154
  }
155
- if (target.protocol !== "https:") throw new Error(`only https URLs are supported (got "${target.protocol}")`);
155
+ if (!allowedProtocols.includes(target.protocol)) throw new Error(`only https URLs are supported (got "${target.protocol}")`);
156
156
  if (target.username || target.password) throw new Error("URLs with embedded credentials are not allowed");
157
157
  const host = bareHost(target.hostname);
158
158
  if (host === "") throw new Error("URL has no host");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-free-search",
3
- "version": "0.9.60",
3
+ "version": "0.9.62",
4
4
  "description": "Free web search for DeepSeek Harness: 42 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable/Firecrawl/Parallel/Brave/Zhipu/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/SpecStream 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",