dsh-free-search 0.9.45 → 0.9.47
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 +20 -14
- package/lib/client.js +92 -20
- package/lib/engines/deepseek-tools.js +24 -2
- package/lib/index.js +14 -5
- package/lib/multi_policy.js +4 -1
- package/lib/ssrf.js +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@
|
|
|
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
154
|
| `yuanbao` | 腾讯元宝搜索 | 付费(有活动免费额度) | 需 `TENCENTCLOUD_WSA_APIKEY`(console.cloud.tencent.com/wsapi);API key 网关,支持自然 / 权威 / 混合模式、站点限定、时间范围;活动页可领每日免费额度(限时);显式专用 |
|
|
155
155
|
| `deepseek-official` | DeepSeek 官方 | 付费 | 需 `DEEPSEEK_API_KEY`;走 Anthropic 兼容的 `web_search` 服务端工具,每次搜索是一整个模型轮次(慢、耗 token) |
|
|
156
|
-
| `deepseek-tools` | DeepSeek 原生搜索 API | 付费 | 需 `DEEPSEEK_API_KEY`(与上一档共用);直接 `POST /v1/tools/search`,无模型参与,返回结构化 `results[]`(`title`/`url`/`summary`/`date`),同 query 实测 ~0.3s vs 上一档 ~5-6s |
|
|
156
|
+
| `deepseek-tools` | DeepSeek 原生搜索 API | 付费 | 需 `DEEPSEEK_API_KEY`(与上一档共用);直接 `POST /v1/tools/search`,无模型参与,返回结构化 `results[]`(`title`/`url`/`summary`/`date`),同 query 实测 ~0.3s vs 上一档 ~5-6s;端点可通过 `deepseekToolsBaseUrl` 改成自定义网关(完整 URL 或 base),key 可用 `deepseekToolsApiKey` 单独覆盖 |
|
|
157
157
|
| `baidu` | 百度千帆 AI 搜索 | 额度 | 需 `BAIDU_API_KEY`(千帆 AI 搜索:web_search 每日赠 50 次,额度用尽/403 时自动回退到 chat/completions,另有 100 次/天免费额度;超额按量后付费);中文全网,支持时间过滤 |
|
|
158
158
|
| `kimi` | Kimi(Moonshot)联网搜索 | 付费 | 需 `MOONSHOT_API_KEY`(basic 约 ¥0.01/次),返回带正文 chunks 的中文结果;**无免费额度**,适合显式选用或作质量升级池,不建议放进默认并发池 |
|
|
159
159
|
| `kimi` | Kimi(Moonshot)联网搜索 | 付费 | 需 `MOONSHOT_API_KEY`(basic 约 ¥0.01/次),返回带正文 chunks 的中文结果 |
|
|
@@ -434,7 +434,9 @@ metasoScope: webpage # webpage | document | scholar
|
|
|
434
434
|
yandexApiKey: ... # Yandex Search API key (AI Studio)
|
|
435
435
|
yandexFolderId: "..." # folder the key was created in
|
|
436
436
|
yandexSearchType: auto # auto | ru | tr | com | kk | be | uz
|
|
437
|
-
deepseekApiKey: ...
|
|
437
|
+
deepseekApiKey: ...
|
|
438
|
+
deepseekToolsApiKey: ... # optional key for the custom endpoint
|
|
439
|
+
deepseekToolsBaseUrl: "" # custom /v1/tools/search endpoint or base; empty = api.deepseek.com
|
|
438
440
|
```
|
|
439
441
|
|
|
440
442
|
#### 让 agent 测试所有引擎
|
|
@@ -521,7 +523,7 @@ Search engine test:
|
|
|
521
523
|
|
|
522
524
|
- 自动跟随重定向、解码正文(HTML 转文本)
|
|
523
525
|
- 支持超时和大小限制
|
|
524
|
-
- ⚠️ 注意:`web_fetch` 默认拒绝回环、私网、链路本地和云元数据地址。若使用 Clash / mihomo TUN 的 fake-ip DNS,请把对应网段(常见 `198.18.0.0/15`)加入设置页的「额外允许的网段」,否则所有被代理域名都会被判成私网而抓取失败;只放行 fake-ip
|
|
526
|
+
- ⚠️ 注意:`web_fetch` 默认拒绝回环、私网、链路本地和云元数据地址。若使用 Clash / mihomo TUN 的 fake-ip DNS,请把对应网段(常见 `198.18.0.0/15`)加入设置页的「额外允许的网段」,否则所有被代理域名都会被判成私网而抓取失败;只放行 fake-ip 网段,不要放行 RFC1918;IPv6 fake-ip 常用 ULA(如 `fdfe:dcba:9876::/64`),需要显式加入才会放行。
|
|
525
527
|
|
|
526
528
|
#### MCP server(stdio)
|
|
527
529
|
|
|
@@ -619,7 +621,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
619
621
|
|
|
620
622
|
#### 离线自检断言(tools/)
|
|
621
623
|
|
|
622
|
-
仓库自带 **
|
|
624
|
+
仓库自带 **61 个**零依赖断言脚本(合计 **882 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑。一次跑全部:`npm test`。
|
|
623
625
|
|
|
624
626
|
| 脚本 | 覆盖 | 运行(项数) |
|
|
625
627
|
|---|---|---|
|
|
@@ -641,11 +643,12 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
641
643
|
| `assert-research-degradation.mjs` | research 无 key 全降级、`node:sqlite` no-op、90s 预算隔离、缓存目录可配置、`budget.exhausted` 契约名 | `node tools/assert-research-degradation.mjs`(19) |
|
|
642
644
|
| `assert-research-call-wrappers.mjs` | research 四个 `call*` 包装层的替身/底层透传(#75 回归) | `node tools/assert-research-call-wrappers.mjs`(23) |
|
|
643
645
|
| `assert-fetch-chain.mjs` | `fs-quality-fetch` 四层链序、任一层命中即停、exa 失败静默降级 firecrawl、全层失败聚合报错 | `node tools/assert-fetch-chain.mjs`(8) |
|
|
644
|
-
| `assert-fetch-ssrf.mjs` | 抓取 SSRF 防护:公网/私网/保留地址判定、DNS 解析到私网拒绝、localhost 与 IP 字面量拒绝、非 HTTPS 与带凭据 URL 拒绝、fake-ip
|
|
646
|
+
| `assert-fetch-ssrf.mjs` | 抓取 SSRF 防护:公网/私网/保留地址判定、DNS 解析到私网拒绝、localhost 与 IP 字面量拒绝、非 HTTPS 与带凭据 URL 拒绝、fake-ip 网段默认拒绝且仅按配置放行、IPv6 ULA 显式放行、放行后仍拒绝回环/IPv4 私网/链路本地、provider 接线与设置项 | `node tools/assert-fetch-ssrf.mjs`(8) |
|
|
645
647
|
| `assert-mcp.mjs` | MCP stdio 面:initialize 协议协商、tools/list 的 JSON Schema、tools/call 文本结果、工具错误与 JSON-RPC 错误区分、必填参数校验、bin/files 打包 | `node tools/assert-mcp.mjs`(6) |
|
|
646
648
|
| `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) |
|
|
647
649
|
| `assert-baidu.mjs` | 百度千帆:key 必填、web_search 首请求、403 或 results.code 额度错误回退 chat/completions(stream:false)、401 不回退、双端失败合并报错 | `node tools/assert-baidu.mjs`(6) |
|
|
648
|
-
| `assert-
|
|
650
|
+
| `assert-deepseek-endpoint.mjs` | DeepSeek 搜索端点:默认地址、base/完整 URL 归一、自定义 endpoint 收 Bearer/key/query、配置与设置页接线 | `node tools/assert-deepseek-endpoint.mjs`(4) |
|
|
651
|
+
| `assert-yuanbao.mjs` |key 必填、Bearer 网关/Query/Mode/Site/FromTime、自然与 VR 页面解析、日期归一、错误分类、注册与显式专用 | `node tools/assert-yuanbao.mjs`(6) |
|
|
649
652
|
| `assert-yandex.mjs` | Yandex Search:key+folder 必填、Api-Key/请求体/分组、searchType 与 period/family 映射、Base64 XML 解析与日期、错误分类、注册与显式专用 | `node tools/assert-yandex.mjs`(6) |
|
|
650
653
|
| `assert-metaso.mjs` | 秘塔搜索:key 必填、请求体(q/scope/size/summary/raw/concise)、摘要与日期映射、文库数组、size 上限、无效 scope 回退、401/402/429/400 错误分类、注册与默认回退排除 | `node tools/assert-metaso.mjs`(6) |
|
|
651
654
|
| `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) |
|
|
@@ -681,7 +684,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
681
684
|
| `assert-firecrawl-keyless.mjs` | Firecrawl keyless 出口判定:403 + VPN/proxy 文案才算拒绝、普通 403 与 401/429/500 不算、冷却初始未触发 | `node tools/assert-firecrawl-keyless.mjs`(5) |
|
|
682
685
|
| `assert-fetch-charset.mjs` | 抓取编码(#88):`charset=gbk` / `gb2312` 按声明解码、无声明时嗅探 `<meta charset>` 与 http-equiv 形式、默认 UTF-8、未知 label 兜底 UTF-8 不抛错 | `node tools/assert-fetch-charset.mjs`(6) |
|
|
683
686
|
| `assert-fetch-abort.mjs` | 抓取中断(#87):压缩响应中途断连必须 reject(不再永久 pending)、明文断连同样 reject、abort 能打断停滞的 gzip 流、complete 响应与重定向仍正常 | `node tools/assert-fetch-abort.mjs`(6) |
|
|
684
|
-
| `assert-bridge-access.mjs` | 桥接 Host 围栏(#84):loopback 放行、remote peer 打 loopback Host 拒绝、`--trusted-host`(无端口匹配任意端口 / 带端口精确匹配)、`--public-url`、绑定地址、跨站与异源拒绝、connection 鉴权委托与 fail-closed | `node tools/assert-bridge-access.mjs`(
|
|
687
|
+
| `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) |
|
|
685
688
|
| `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) |
|
|
686
689
|
|
|
687
690
|
任何一个失败会以非 0 退出码结束并列出失败项;把某个旧版本文件路径作为参数传进去,可以看到修复前必红(用来证明断言不是空转)。改动发布相关逻辑后建议先跑一遍再发版。
|
|
@@ -854,7 +857,7 @@ If this plugin has been helpful, a ⭐ on [GitHub](https://github.com/DDDMUC/dsh
|
|
|
854
857
|
| `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
858
|
| `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 |
|
|
856
859
|
| `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) |
|
|
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
|
|
860
|
+
| `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; the endpoint is configurable via `deepseekToolsBaseUrl` (full URL or base) and the key can be overridden with `deepseekToolsApiKey` for custom gateways |
|
|
858
861
|
| `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 |
|
|
859
862
|
| `kimi` | Kimi (Moonshot) Web Search | Paid | Requires `MOONSHOT_API_KEY` (basic ~¥0.01/call); returns Chinese results with body chunks; **no free quota**, so prefer explicit selection or the escalation pool over the default concurrent pool |
|
|
860
863
|
| `kimi` | Kimi (Moonshot) Web Search | Paid | Requires `MOONSHOT_API_KEY` (basic ~¥0.01/call); returns Chinese results with body chunks |
|
|
@@ -1136,7 +1139,9 @@ metasoScope: webpage # webpage | document | scholar
|
|
|
1136
1139
|
yandexApiKey: ... # Yandex Search API key (AI Studio)
|
|
1137
1140
|
yandexFolderId: "..." # folder the key was created in
|
|
1138
1141
|
yandexSearchType: auto # auto | ru | tr | com | kk | be | uz
|
|
1139
|
-
deepseekApiKey: ...
|
|
1142
|
+
deepseekApiKey: ...
|
|
1143
|
+
deepseekToolsApiKey: ... # optional key for the custom endpoint
|
|
1144
|
+
deepseekToolsBaseUrl: "" # custom /v1/tools/search endpoint or base; empty = api.deepseek.com
|
|
1140
1145
|
```
|
|
1141
1146
|
|
|
1142
1147
|
#### Asking the Agent to Test All Engines
|
|
@@ -1223,7 +1228,7 @@ After searching, the agent can **read full webpage content** (e.g., *"Open the f
|
|
|
1223
1228
|
|
|
1224
1229
|
- Automatically follows redirects and decodes HTML to plain text.
|
|
1225
1230
|
- Supports timeout and response size limits.
|
|
1226
|
-
- ⚠️ 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 fake-ip
|
|
1231
|
+
- ⚠️ 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.
|
|
1227
1232
|
|
|
1228
1233
|
#### MCP server (stdio)
|
|
1229
1234
|
|
|
@@ -1321,7 +1326,7 @@ Restart `dsh web` after switching to apply changes.
|
|
|
1321
1326
|
|
|
1322
1327
|
#### Offline self-check assertions (`tools/`)
|
|
1323
1328
|
|
|
1324
|
-
**Sixty** zero-dependency assertion scripts ship with the repo (**
|
|
1329
|
+
**Sixty-one** zero-dependency assertion scripts ship with the repo (**882 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20. Run everything with `npm test`.
|
|
1325
1330
|
|
|
1326
1331
|
| Script | Covers | Run (count) |
|
|
1327
1332
|
|---|---|---|
|
|
@@ -1343,9 +1348,10 @@ Restart `dsh web` after switching to apply changes.
|
|
|
1343
1348
|
| `assert-research-degradation.mjs` | research degrades fully without keys, `node:sqlite` no-op, 90s budget isolation, configurable cache dir, `budget.exhausted` contract names | `node tools/assert-research-degradation.mjs` (19) |
|
|
1344
1349
|
| `assert-research-call-wrappers.mjs` | the four research `call*` wrappers proxy to stubs / the real layer (#75 regression) | `node tools/assert-research-call-wrappers.mjs` (23) |
|
|
1345
1350
|
| `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) |
|
|
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/
|
|
1351
|
+
| `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, IPv6 ULA allowed only when listed, loopback/IPv4-private/link-local still blocked after opt-in, provider wiring and settings | `node tools/assert-fetch-ssrf.mjs` (8) |
|
|
1347
1352
|
| `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-
|
|
1353
|
+
| `assert-deepseek-endpoint.mjs` | DeepSeek search endpoint: default URL, base/full-URL normalization, custom endpoint receives bearer/key/query, config and settings wiring | `node tools/assert-deepseek-endpoint.mjs` (4) |
|
|
1354
|
+
| `assert-yuanbao.mjs` | 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) |
|
|
1349
1355
|
| `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) |
|
|
1350
1356
|
| `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) |
|
|
1351
1357
|
| `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) |
|
|
@@ -1381,7 +1387,7 @@ Restart `dsh web` after switching to apply changes.
|
|
|
1381
1387
|
| `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) |
|
|
1382
1388
|
| `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) |
|
|
1383
1389
|
| `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) |
|
|
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
|
|
1390
|
+
| `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) |
|
|
1385
1391
|
| `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) |
|
|
1386
1392
|
|
|
1387
1393
|
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
|
|
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.
|
|
@@ -432,7 +439,7 @@ window.__ModuleLoader__.load({
|
|
|
432
439
|
browserFetchLabel: "用本机浏览器渲染",
|
|
433
440
|
browserFetchHint: "直连失败时用系统 Chrome/Edge 无头加载页面,能过 JS 挑战;没有浏览器时自动跳过。",
|
|
434
441
|
fakeIpCidrsLabel: "额外允许的网段(fake-ip 透明代理)",
|
|
435
|
-
fakeIpCidrsHint: "一行一个 CIDR。Clash/mihomo TUN 的 fake-ip 通常是 198.18.0.0/15
|
|
442
|
+
fakeIpCidrsHint: "一行一个 CIDR。Clash/mihomo TUN 的 fake-ip 通常是 198.18.0.0/15;只豁免这里列出的保留段;回环、IPv4 私网、链路本地和云元数据仍会被拦截,IPv6 ULA(fc00::/7)只有显式列出时才放行。",
|
|
436
443
|
fetchPreferLabel: "抓取质量链顺序",
|
|
437
444
|
fetchPreferExa: "Exa 优先",
|
|
438
445
|
fetchPreferFirecrawl: "Firecrawl 优先",
|
|
@@ -467,7 +474,11 @@ window.__ModuleLoader__.load({
|
|
|
467
474
|
yuanbaoModeHybrid: "混合结果",
|
|
468
475
|
yuanbaoModeHint: "自然结果最通用;权威/多模态适合天气、股价、汇率等时效信息。",
|
|
469
476
|
yuanbaoSiteLabel: "限定站点(可选)",
|
|
470
|
-
yuanbaoSiteHint: "只搜某个域名时填写,例如 qq.com;留空搜索全网。",
|
|
477
|
+
yuanbaoSiteHint: "只搜某个域名时填写,例如 qq.com;留空搜索全网。",
|
|
478
|
+
deepseekToolsKeyLabel: "DeepSeek 搜索 API key(可选)",
|
|
479
|
+
deepseekToolsKeyHint: "留空复用现有 DeepSeek API key;自定义网关可以单独填。",
|
|
480
|
+
deepseekToolsUrlLabel: "DeepSeek 搜索端点(可选)",
|
|
481
|
+
deepseekToolsUrlHint: "留空使用 https://api.deepseek.com/v1/tools/search;可填完整 URL 或 base,自定义网关/代理的 key 使用下方 DeepSeek API key。",
|
|
471
482
|
restoreOfficial: "恢复官方搜索",
|
|
472
483
|
restoreOfficialHint: "把 web.searchProvider 改回 deepseek-official、web.fetchProvider 改回 http。停用或卸载本插件前建议先点一次,避免宿主报 configured web provider \"ddg\" is not registered。",
|
|
473
484
|
restoringOfficial: "恢复中…",
|
|
@@ -662,7 +673,11 @@ window.__ModuleLoader__.load({
|
|
|
662
673
|
yuanbaoModeHybrid: "Hybrid results",
|
|
663
674
|
yuanbaoModeHint: "Natural is the general default; authoritative/multimodal suits weather, stocks, FX and other timely facts.",
|
|
664
675
|
yuanbaoSiteLabel: "Restrict to site (optional)",
|
|
665
|
-
yuanbaoSiteHint: "Only search one domain, e.g. qq.com; leave empty for the whole web.",
|
|
676
|
+
yuanbaoSiteHint: "Only search one domain, e.g. qq.com; leave empty for the whole web.",
|
|
677
|
+
deepseekToolsKeyLabel: "DeepSeek search API key (optional)",
|
|
678
|
+
deepseekToolsKeyHint: "Leave empty to reuse the existing DeepSeek API key; set a separate key for custom gateways.",
|
|
679
|
+
deepseekToolsUrlLabel: "DeepSeek search endpoint (optional)",
|
|
680
|
+
deepseekToolsUrlHint: "Leave empty for https://api.deepseek.com/v1/tools/search; a full URL or base works, using the DeepSeek API key below for custom gateways.",
|
|
666
681
|
restoreOfficial: "Restore official search",
|
|
667
682
|
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.",
|
|
668
683
|
restoringOfficial: "Restoring…",
|
|
@@ -712,7 +727,7 @@ window.__ModuleLoader__.load({
|
|
|
712
727
|
"cache_search",
|
|
713
728
|
"domain_search",
|
|
714
729
|
];
|
|
715
|
-
const PLUGIN_VERSION = "0.9.
|
|
730
|
+
const PLUGIN_VERSION = "0.9.47";
|
|
716
731
|
const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
|
|
717
732
|
// 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
|
|
718
733
|
const NAV_ITEMS = [
|
|
@@ -850,7 +865,7 @@ window.__ModuleLoader__.load({
|
|
|
850
865
|
};
|
|
851
866
|
|
|
852
867
|
async function bridgeRestoreProvider() {
|
|
853
|
-
const response = await fetch(
|
|
868
|
+
const response = await fetch(bridgeUrl("restore-provider"), {
|
|
854
869
|
method: "POST",
|
|
855
870
|
headers: { "content-type": "application/json" },
|
|
856
871
|
body: "{}",
|
|
@@ -859,7 +874,7 @@ window.__ModuleLoader__.load({
|
|
|
859
874
|
}
|
|
860
875
|
|
|
861
876
|
async function bridgeCheckUpdate() {
|
|
862
|
-
const response = await fetch(
|
|
877
|
+
const response = await fetch(bridgeUrl("check-update"), {
|
|
863
878
|
method: "POST",
|
|
864
879
|
headers: { "content-type": "application/json" },
|
|
865
880
|
body: "{}",
|
|
@@ -869,7 +884,7 @@ window.__ModuleLoader__.load({
|
|
|
869
884
|
|
|
870
885
|
// 诊断文本由服务端拼好,客户端只负责显示。
|
|
871
886
|
async function bridgeDoctor() {
|
|
872
|
-
const response = await fetch(
|
|
887
|
+
const response = await fetch(bridgeUrl("doctor"), {
|
|
873
888
|
method: "POST",
|
|
874
889
|
headers: { "content-type": "application/json" },
|
|
875
890
|
body: "{}",
|
|
@@ -878,7 +893,7 @@ window.__ModuleLoader__.load({
|
|
|
878
893
|
}
|
|
879
894
|
|
|
880
895
|
async function bridgeDescribe() {
|
|
881
|
-
const response = await fetch(
|
|
896
|
+
const response = await fetch(bridgeUrl("describe"), {
|
|
882
897
|
method: "POST",
|
|
883
898
|
headers: { "content-type": "application/json" },
|
|
884
899
|
body: "{}",
|
|
@@ -887,7 +902,7 @@ window.__ModuleLoader__.load({
|
|
|
887
902
|
}
|
|
888
903
|
|
|
889
904
|
async function bridgeMutate(payload) {
|
|
890
|
-
const response = await fetch(
|
|
905
|
+
const response = await fetch(bridgeUrl("mutate"), {
|
|
891
906
|
method: "POST",
|
|
892
907
|
headers: { "content-type": "application/json" },
|
|
893
908
|
body: JSON.stringify(payload),
|
|
@@ -896,7 +911,7 @@ window.__ModuleLoader__.load({
|
|
|
896
911
|
}
|
|
897
912
|
|
|
898
913
|
async function bridgeRawSearch(payload) {
|
|
899
|
-
const response = await fetch(
|
|
914
|
+
const response = await fetch(bridgeUrl("raw-search"), {
|
|
900
915
|
method: "POST",
|
|
901
916
|
headers: { "content-type": "application/json" },
|
|
902
917
|
body: JSON.stringify(payload),
|
|
@@ -905,7 +920,7 @@ window.__ModuleLoader__.load({
|
|
|
905
920
|
}
|
|
906
921
|
|
|
907
922
|
async function bridgeCredentialsStatus() {
|
|
908
|
-
const response = await fetch(
|
|
923
|
+
const response = await fetch(bridgeUrl("credentials-status"), {
|
|
909
924
|
method: "POST",
|
|
910
925
|
headers: { "content-type": "application/json" },
|
|
911
926
|
body: "{}",
|
|
@@ -914,7 +929,7 @@ window.__ModuleLoader__.load({
|
|
|
914
929
|
}
|
|
915
930
|
|
|
916
931
|
async function bridgeCredentialsSet(key, value) {
|
|
917
|
-
const response = await fetch(
|
|
932
|
+
const response = await fetch(bridgeUrl("credentials-set"), {
|
|
918
933
|
method: "POST",
|
|
919
934
|
headers: { "content-type": "application/json" },
|
|
920
935
|
body: JSON.stringify({ key, value }),
|
|
@@ -923,7 +938,7 @@ window.__ModuleLoader__.load({
|
|
|
923
938
|
}
|
|
924
939
|
|
|
925
940
|
async function bridgeCredentialsUnset(key) {
|
|
926
|
-
const response = await fetch(
|
|
941
|
+
const response = await fetch(bridgeUrl("credentials-unset"), {
|
|
927
942
|
method: "POST",
|
|
928
943
|
headers: { "content-type": "application/json" },
|
|
929
944
|
body: JSON.stringify({ key }),
|
|
@@ -1241,7 +1256,8 @@ window.__ModuleLoader__.load({
|
|
|
1241
1256
|
if (path === "googleCseApiKey") configured.google = true;
|
|
1242
1257
|
if (path === "metasoApiKey") configured.metaso = true;
|
|
1243
1258
|
if (path === "yandexApiKey") configured.yandex = true;
|
|
1244
|
-
if (path === "yuanbaoApiKey") configured.yuanbao = true;
|
|
1259
|
+
if (path === "yuanbaoApiKey") configured.yuanbao = true;
|
|
1260
|
+
if (path === "deepseekToolsApiKey") configured.deepseek = true;
|
|
1245
1261
|
}
|
|
1246
1262
|
}
|
|
1247
1263
|
setKeysConfigured(configured);
|
|
@@ -1253,7 +1269,7 @@ window.__ModuleLoader__.load({
|
|
|
1253
1269
|
const cred = await bridgeCredentialsStatus();
|
|
1254
1270
|
if (cred.ok) {
|
|
1255
1271
|
const cc = {};
|
|
1256
|
-
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" };
|
|
1272
|
+
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", deepseekToolsApiKey: "deepseek", baiduApiKey: "baidu", kimiApiKey: "kimi", aliyunApiKey: "aliyun", doubaoApiKey: "doubao", openaiApiKey: "openai", geminiApiKey: "gemini", claudeApiKey: "claude", zhihuApiKey: "zhihu", tinyfishApiKey: "tinyfish", jinaApiKey: "jina", searxngBearerToken: "searxng" };
|
|
1257
1273
|
for (const [k, v] of Object.entries(cred.value.configured ?? {})) {
|
|
1258
1274
|
if (map[k]) cc[map[k]] = v;
|
|
1259
1275
|
}
|
|
@@ -1297,7 +1313,8 @@ window.__ModuleLoader__.load({
|
|
|
1297
1313
|
["firecrawlApiKey", firecrawlKey],
|
|
1298
1314
|
["parallelApiKey", parallelKey],
|
|
1299
1315
|
["perplexityApiKey", perplexityKey],
|
|
1300
|
-
["deepseekApiKey", deepseekKey],
|
|
1316
|
+
["deepseekApiKey", deepseekKey],
|
|
1317
|
+
["deepseekToolsApiKey", deepseekToolsKey],
|
|
1301
1318
|
["serpbaseApiKey", serpbaseKey],
|
|
1302
1319
|
["serplyApiKey", serplyKey],
|
|
1303
1320
|
["outcrawlApiKey", outcrawlKey],
|
|
@@ -1355,7 +1372,8 @@ window.__ModuleLoader__.load({
|
|
|
1355
1372
|
ops.push({ op: "set", path: ["yandexFolderId"], value: yandexFolder.trim() });
|
|
1356
1373
|
ops.push({ op: "set", path: ["yandexSearchType"], value: ["ru", "tr", "com", "kk", "be", "uz"].includes(yandexType) ? yandexType : "auto" });
|
|
1357
1374
|
ops.push({ op: "set", path: ["yuanbaoMode"], value: yuanbaoMode === "1" || yuanbaoMode === "2" ? Number(yuanbaoMode) : 0 });
|
|
1358
|
-
ops.push({ op: "set", path: ["yuanbaoSite"], value: yuanbaoSite.trim() });
|
|
1375
|
+
ops.push({ op: "set", path: ["yuanbaoSite"], value: yuanbaoSite.trim() });
|
|
1376
|
+
ops.push({ op: "set", path: ["deepseekToolsBaseUrl"], value: deepseekToolsUrl.trim() });
|
|
1359
1377
|
ops.push({ op: "set", path: ["browserFetch"], value: browserFetch });
|
|
1360
1378
|
ops.push({
|
|
1361
1379
|
op: "set",
|
|
@@ -1452,7 +1470,7 @@ window.__ModuleLoader__.load({
|
|
|
1452
1470
|
setFailed(false);
|
|
1453
1471
|
setSaveError("");
|
|
1454
1472
|
try {
|
|
1455
|
-
const response = await fetch(
|
|
1473
|
+
const response = await fetch(bridgeUrl("update"), {
|
|
1456
1474
|
method: "POST",
|
|
1457
1475
|
headers: { "content-type": "application/json" },
|
|
1458
1476
|
body: "{}",
|
|
@@ -2364,6 +2382,60 @@ react_jsx_runtime.jsx("div", {
|
|
|
2364
2382
|
}),
|
|
2365
2383
|
],
|
|
2366
2384
|
}),
|
|
2385
|
+
react_jsx_runtime.jsx("div", {
|
|
2386
|
+
className: "dshfs-field",
|
|
2387
|
+
children: [
|
|
2388
|
+
react_jsx_runtime.jsx("div", {
|
|
2389
|
+
className: "dshfs-label",
|
|
2390
|
+
children: t.deepseekToolsKeyLabel,
|
|
2391
|
+
}),
|
|
2392
|
+
react_jsx_runtime.jsx("input", {
|
|
2393
|
+
className: "dshfs-input",
|
|
2394
|
+
type: "password",
|
|
2395
|
+
value: deepseekToolsKey,
|
|
2396
|
+
spellCheck: false,
|
|
2397
|
+
placeholder: "API key",
|
|
2398
|
+
disabled: !ready || saving,
|
|
2399
|
+
onChange: (e) => {
|
|
2400
|
+
setDeepseekToolsKey(e.target.value);
|
|
2401
|
+
setDirty(true);
|
|
2402
|
+
setFailed(false);
|
|
2403
|
+
setSaveError("");
|
|
2404
|
+
},
|
|
2405
|
+
}),
|
|
2406
|
+
react_jsx_runtime.jsx("p", {
|
|
2407
|
+
className: "dshfs-hint",
|
|
2408
|
+
children: t.deepseekToolsKeyHint,
|
|
2409
|
+
}),
|
|
2410
|
+
],
|
|
2411
|
+
}),
|
|
2412
|
+
react_jsx_runtime.jsx("div", {
|
|
2413
|
+
className: "dshfs-field",
|
|
2414
|
+
children: [
|
|
2415
|
+
react_jsx_runtime.jsx("div", {
|
|
2416
|
+
className: "dshfs-label",
|
|
2417
|
+
children: t.deepseekToolsUrlLabel,
|
|
2418
|
+
}),
|
|
2419
|
+
react_jsx_runtime.jsx("input", {
|
|
2420
|
+
className: "dshfs-input",
|
|
2421
|
+
type: "text",
|
|
2422
|
+
value: deepseekToolsUrl,
|
|
2423
|
+
spellCheck: false,
|
|
2424
|
+
placeholder: "https://api.deepseek.com/v1/tools/search",
|
|
2425
|
+
disabled: !ready || saving,
|
|
2426
|
+
onChange: (e) => {
|
|
2427
|
+
setDeepseekToolsUrl(e.target.value);
|
|
2428
|
+
setDirty(true);
|
|
2429
|
+
setFailed(false);
|
|
2430
|
+
setSaveError("");
|
|
2431
|
+
},
|
|
2432
|
+
}),
|
|
2433
|
+
react_jsx_runtime.jsx("p", {
|
|
2434
|
+
className: "dshfs-hint",
|
|
2435
|
+
children: t.deepseekToolsUrlHint,
|
|
2436
|
+
}),
|
|
2437
|
+
],
|
|
2438
|
+
}),
|
|
2367
2439
|
react_jsx_runtime.jsx("div", {
|
|
2368
2440
|
className: "dshfs-field",
|
|
2369
2441
|
id: "dshfs-anchor-fallback",
|
|
@@ -3216,7 +3288,7 @@ react_jsx_runtime.jsx("div", {
|
|
|
3216
3288
|
// 挂插件页 slot:侧栏 插件 → 已安装 → free-search → 行配置页。
|
|
3217
3289
|
// rc.1 废弃了旧版设置页的插件配置 slot,只保留 plugins.row.config;
|
|
3218
3290
|
// key 规则见 ui-plugin-manager 的 rowConfigKey:<包名>#<patch 里声明的行 id>。
|
|
3219
|
-
// 配置读写走自建 bridge
|
|
3291
|
+
// 配置读写走自建 bridge(按页面 base 解析 api/dsh-free-search-settings),不依赖 dsh-web-ui。
|
|
3220
3292
|
ctx.slots.inject("plugins.row.config", () =>
|
|
3221
3293
|
ctx.slots.register(
|
|
3222
3294
|
{
|
|
@@ -4,6 +4,28 @@ import { parseMcpResponseText } from "../mcp_adapter.js";
|
|
|
4
4
|
|
|
5
5
|
const DEEPSEEK_TOOLS_SEARCH_URL = "https://api.deepseek.com/v1/tools/search";
|
|
6
6
|
|
|
7
|
+
export function deepseekToolsEndpoint(value) {
|
|
8
|
+
const raw = String(value ?? "").trim();
|
|
9
|
+
if (!raw) return DEEPSEEK_TOOLS_SEARCH_URL;
|
|
10
|
+
let url;
|
|
11
|
+
try {
|
|
12
|
+
url = new URL(raw);
|
|
13
|
+
} catch {
|
|
14
|
+
throw new Error("DeepSeek tools URL is invalid");
|
|
15
|
+
}
|
|
16
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
17
|
+
throw new Error("DeepSeek tools URL must be http(s)");
|
|
18
|
+
}
|
|
19
|
+
if (url.pathname === "" || url.pathname === "/") {
|
|
20
|
+
url.pathname = "/v1/tools/search";
|
|
21
|
+
} else if (url.pathname === "/v1" || url.pathname === "/v1/") {
|
|
22
|
+
url.pathname = "/v1/tools/search";
|
|
23
|
+
} else if (url.pathname.endsWith("/")) {
|
|
24
|
+
url.pathname = url.pathname.slice(0, -1);
|
|
25
|
+
}
|
|
26
|
+
return url.toString().replace(/\/$/, "");
|
|
27
|
+
}
|
|
28
|
+
|
|
7
29
|
// 原生搜索接口没有独立的时间字段,时间过滤写在 query 语法里(after:/before:)。
|
|
8
30
|
// 支持 `after:2025`、`after:2025-01-01`;这里把统一的 timeRange 映射成 after:。
|
|
9
31
|
|
|
@@ -18,13 +40,13 @@ function deepseekToolsQuery(query, timeRange) {
|
|
|
18
40
|
return query;
|
|
19
41
|
}
|
|
20
42
|
|
|
21
|
-
export async function searchDeepSeekTools(query, maxResults, apiKey, timeRange, signal) {
|
|
43
|
+
export async function searchDeepSeekTools(query, maxResults, apiKey, timeRange, signal, baseUrl = "") {
|
|
22
44
|
if (!apiKey) throw new Error("DeepSeek search requires DEEPSEEK_API_KEY");
|
|
23
45
|
const limit = Math.min(Math.max(maxResults ?? 5, 1), 50);
|
|
24
46
|
// 超额取数:按请求计费,且缺 url 的行会被丢弃,多取一些补位成本为零
|
|
25
47
|
const count = Math.min(50, Math.max(limit, Math.ceil(limit * 1.5)));
|
|
26
48
|
|
|
27
|
-
const response = await fetch(
|
|
49
|
+
const response = await fetch(deepseekToolsEndpoint(baseUrl), {
|
|
28
50
|
method: "POST",
|
|
29
51
|
redirect: "error",
|
|
30
52
|
headers: {
|
package/lib/index.js
CHANGED
|
@@ -1839,6 +1839,7 @@ const KEY_REF_MAP = {
|
|
|
1839
1839
|
yandexApiKey: "YANDEX_API_KEY",
|
|
1840
1840
|
yuanbaoApiKey: "TENCENTCLOUD_WSA_APIKEY",
|
|
1841
1841
|
deepseekApiKey: "DEEPSEEK_API_KEY",
|
|
1842
|
+
deepseekToolsApiKey: "DEEPSEEK_TOOLS_API_KEY",
|
|
1842
1843
|
// 设置页写入的凭据槽位保持旧名,已保存的 key 不受影响;读取时 YDC_API_KEY 优先(见 resolveYoucomApiKey)
|
|
1843
1844
|
youcomApiKey: "YOUCOM_API_KEY",
|
|
1844
1845
|
baiduApiKey: "BAIDU_API_KEY",
|
|
@@ -1931,6 +1932,8 @@ const Config = z.object({
|
|
|
1931
1932
|
outcrawlApiKey: z.string().role("secret").volatile(),
|
|
1932
1933
|
googleCseApiKey: z.string().role("secret").volatile(),
|
|
1933
1934
|
deepseekApiKey: z.string().role("secret").volatile(),
|
|
1935
|
+
deepseekToolsApiKey: z.string().role("secret").volatile(),
|
|
1936
|
+
deepseekToolsBaseUrl: z.string().default("").volatile(),
|
|
1934
1937
|
youcomApiKey: z.string().role("secret").volatile(),
|
|
1935
1938
|
baiduApiKey: z.string().role("secret").volatile(),
|
|
1936
1939
|
kimiApiKey: z.string().role("secret").volatile(),
|
|
@@ -2429,8 +2432,12 @@ function apply(ctx, config) {
|
|
|
2429
2432
|
searchPerplexity(query, maxResults, await requireEngineKey("PERPLEXITY_API_KEY", "perplexityApiKey", "Perplexity"), signal),
|
|
2430
2433
|
"deepseek-official": async ({ query, maxResults, signal }) =>
|
|
2431
2434
|
searchDeepSeekOfficial(query, maxResults, await requireEngineKey("DEEPSEEK_API_KEY", "deepseekApiKey", "DeepSeek"), signal),
|
|
2432
|
-
"deepseek-tools": async ({ query, maxResults, rawTimeRange, signal }) =>
|
|
2433
|
-
|
|
2435
|
+
"deepseek-tools": async ({ query, maxResults, rawTimeRange, signal }) => {
|
|
2436
|
+
const key =
|
|
2437
|
+
(await resolveApiKey("DEEPSEEK_TOOLS_API_KEY", "deepseekToolsApiKey")) ||
|
|
2438
|
+
(await requireEngineKey("DEEPSEEK_API_KEY", "deepseekApiKey", "DeepSeek"));
|
|
2439
|
+
return searchDeepSeekTools(query, maxResults, key, rawTimeRange, signal, current().deepseekToolsBaseUrl);
|
|
2440
|
+
},
|
|
2434
2441
|
serpbase: async ({ query, maxResults, cfg, signal }) =>
|
|
2435
2442
|
searchSerpbase(query, maxResults, await requireEngineKey("SERPBASE_API_KEY", "serpbaseApiKey", "SerpBase"), cfg, signal),
|
|
2436
2443
|
serply: async ({ query, maxResults, cfg, signal }) =>
|
|
@@ -3120,9 +3127,11 @@ function apply(ctx, config) {
|
|
|
3120
3127
|
return await searchDeepSeekOfficial(q, n, key);
|
|
3121
3128
|
}
|
|
3122
3129
|
case "deepseek-tools": {
|
|
3123
|
-
const key =
|
|
3124
|
-
|
|
3125
|
-
|
|
3130
|
+
const key =
|
|
3131
|
+
(await resolveApiKey("DEEPSEEK_TOOLS_API_KEY", "deepseekToolsApiKey")) ||
|
|
3132
|
+
(await resolveApiKey("DEEPSEEK_API_KEY", "deepseekApiKey"));
|
|
3133
|
+
if (!key) return { ok: false, error: "DEEPSEEK_TOOLS_API_KEY / DEEPSEEK_API_KEY not configured" };
|
|
3134
|
+
return await searchDeepSeekTools(q, n, key, tr, undefined, cfg.deepseekToolsBaseUrl);
|
|
3126
3135
|
}
|
|
3127
3136
|
case "serpbase": {
|
|
3128
3137
|
const key = await resolveApiKey("SERPBASE_API_KEY", "serpbaseApiKey");
|
package/lib/multi_policy.js
CHANGED
|
@@ -216,7 +216,10 @@ export function rankMergedResults(items, { appliesFreshness = false } = {}) {
|
|
|
216
216
|
export const REQUIRED_CREDENTIALS = {
|
|
217
217
|
perplexity: [{ env: "PERPLEXITY_API_KEY", settings: "perplexityApiKey" }],
|
|
218
218
|
"deepseek-official": [{ env: "DEEPSEEK_API_KEY", settings: "deepseekApiKey" }],
|
|
219
|
-
"deepseek-tools": [
|
|
219
|
+
"deepseek-tools": [
|
|
220
|
+
{ env: "DEEPSEEK_TOOLS_API_KEY", settings: "deepseekToolsApiKey" },
|
|
221
|
+
{ env: "DEEPSEEK_API_KEY", settings: "deepseekApiKey" },
|
|
222
|
+
],
|
|
220
223
|
serpbase: [{ env: "SERPBASE_API_KEY", settings: "serpbaseApiKey" }],
|
|
221
224
|
serply: [{ env: "SERPLY_API_KEY", settings: "serplyApiKey" }],
|
|
222
225
|
outcrawl: [{ env: "OUTCRAWL_API_KEY", settings: "outcrawlApiKey" }],
|
package/lib/ssrf.js
CHANGED
|
@@ -87,7 +87,6 @@ function isHardBlocked(address) {
|
|
|
87
87
|
const value = address.toLowerCase();
|
|
88
88
|
if (value === "::" || value === "::1") return true;
|
|
89
89
|
if (value.startsWith("::ffff:")) return isHardBlockedIPv4(value.slice(7));
|
|
90
|
-
if (value.startsWith("fc") || value.startsWith("fd")) return true;
|
|
91
90
|
if (/^fe[89ab]/.test(value)) return true;
|
|
92
91
|
return value.startsWith("ff");
|
|
93
92
|
}
|
|
@@ -95,8 +94,10 @@ function isHardBlocked(address) {
|
|
|
95
94
|
/**
|
|
96
95
|
* True only for globally routable addresses; unknown input is treated as unsafe.
|
|
97
96
|
* `allowedCidrs` is an explicit opt-in for reserved ranges (e.g. Clash/mihomo
|
|
98
|
-
* fake-ip 198.18.0.0/15). Loopback,
|
|
99
|
-
* blocked even when listed
|
|
97
|
+
* fake-ip 198.18.0.0/15 or an IPv6 ULA fake-ip range). Loopback, IPv4 private
|
|
98
|
+
* ranges, link-local and multicast stay blocked even when listed; IPv6 ULAs
|
|
99
|
+
* (fc00::/7) must be listed explicitly because Clash/mihomo may use them for
|
|
100
|
+
* fake-ip.
|
|
100
101
|
*/
|
|
101
102
|
export function isPublicAddress(address, { allowedCidrs = [], allowedList } = {}) {
|
|
102
103
|
const text = String(address);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-free-search",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.47",
|
|
4
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",
|