dsh-free-search 0.4.38 → 0.5.0

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
@@ -29,7 +29,7 @@ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`
29
29
  ### 特性
30
30
 
31
31
  - **零成本** —— 多个免费引擎,无需 key、无需注册
32
- - **多引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、AnySearch、Exa、Tavily、Keenable、Firecrawl、Parallel、Perplexity、SerpBase、DeepSeek 官方
32
+ - **多引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、AnySearch、Exa、Tavily、Keenable、Firecrawl、Parallel、Perplexity、SerpBase、DeepSeek 官方、You.com
33
33
  - **网页设置页** —— 引擎切换 + API key 配置(UI 中 key 脱敏显示"已配置")+ 中英文切换;入口在左侧「插件」页的组件行配置(`plugins.row.config`,DSH 0.1.7-rc.1+)
34
34
  - **弹出式切换命令** —— 聊天框输入 `/free-search-engine`,弹出引擎选择窗口,点选即切换(等效设置页 + 保存)
35
35
  - **引擎测试** —— `free_search_test` 工具让 agent 一键测试所有引擎;设置页也有"测试引擎"按钮(直测当前引擎,不走回退链,付费引擎无 key 会明确报错)
@@ -50,6 +50,7 @@ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`
50
50
 
51
51
  | id | 引擎 | 费用 | 说明 |
52
52
  |---|---|---|---|
53
+ | `auto` | Auto 智能路由 | 动态 | **根据查询语言/时间条件自动选路**(含中文优先 Bing/Baidu/Aliyun/AnySearch,英文优先 Bing/Exa/Tavily;时间过滤优先支持引擎),末尾全量回退 |
53
54
  | `ddg` | DuckDuckGo HTML | 免费 | 偶发限流(反爬),解封自动恢复 |
54
55
  | `ddg-lite` | DuckDuckGo Lite | 免费 | 轻量版,同上 |
55
56
  | `bing` | Bing | 免费 | **默认引擎**,最稳定,中文优化(zh-CN) |
@@ -63,6 +64,10 @@ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`
63
64
  | `perplexity` | Perplexity | 付费 | 需 `PERPLEXITY_API_KEY` |
64
65
  | `serpbase` | SerpBase | 付费 | 需 `SERPBASE_API_KEY`(serpbase.dev,注册送 100 次免费额度) |
65
66
  | `deepseek-official` | DeepSeek 官方 | 付费 | 需 `DEEPSEEK_API_KEY` |
67
+ | `you` | You.com | 付费 | 需 `YOUCOM_API_KEY`(you.com/platform/api-keys,注册即送免费额度) |
68
+ | `baidu` | 百度千帆 AI 搜索 | 额度 | 需 `BAIDU_API_KEY`(千帆 AI 搜索,每日赠 50 次,超额按量后付费);中文全网,支持时间过滤 |
69
+ | `kimi` | Kimi(Moonshot)联网搜索 | 付费 | 需 `MOONSHOT_API_KEY`(basic 约 ¥0.01/次),返回带正文 chunks 的中文结果 |
70
+ | `aliyun` | 阿里云百炼 EnhancedSearch | 付费 | 需 `DASHSCOPE_API_KEY`(MCP search_pro,约 ¥0.03/次,新用户 200 次免费包);中文全网带来源 hostname |
66
71
 
67
72
  - **默认引擎为 `bing`**(免费且最稳定),安装后开箱即用。
68
73
  - **自动回退**:任何引擎失败(免费限流/反爬,付费缺 key/无效/网络错误)都会自动轮流尝试下一个引擎——先试其他已配 key 的付费引擎,再试免费引擎(Bing/AnySearch 等),并在结果中附带回退提示——搜索不会因引擎问题直接失败。
@@ -74,6 +79,7 @@ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`
74
79
  - Perplexity:<https://www.perplexity.ai/settings/api>
75
80
  - SerpBase:<https://serpbase.dev>
76
81
  - DeepSeek:<https://platform.deepseek.com/api_keys>
82
+ - You.com:<https://you.com/platform/api-keys>
77
83
 
78
84
  #### 为什么免费引擎不需要 key?
79
85
 
@@ -96,6 +102,31 @@ dsh plugin --profile web add /path/to/dsh-free-search
96
102
  dsh web
97
103
  ```
98
104
 
105
+ #### 接管行为与验证
106
+
107
+ 插件加载后**自动接管搜索**:
108
+
109
+ - `web.searchProvider` 未设置,或仍是 DSH 出厂默认的官方搜索 `deepseek-official` 时,自动切换为本插件;
110
+ - 如果(你或别的插件)已显式选择其他 provider,本插件不抢占,只在启动日志输出 WARN 与切换用的 YAML。
111
+
112
+ 正常安装(`dsh plugin add` / 插件管理器)时,插件自带的 **bundle patch**(`cordis.patch.yml`)还会在配置层显式写入 `searchProvider: ddg`;即使这层没生效(例如把插件作为普通依赖手工安装、或 profile patch 整体覆盖了 `web` 条目),上面的运行时兜底也会接管官方默认,不会再静默退回官方搜索。
113
+
114
+ 需要显式声明、或从其他 provider 切过来时(`profiles/<profile>/cordis.patch.yml`):
115
+
116
+ ```yaml
117
+ # 让 harness 的 web_search 使用本插件。
118
+ # DSH 0.1.2+ 的 patch 是"整段覆盖 config"而不是深度合并:
119
+ # 已有 web 条目里的字段(如 fetchProvider)必须在这里一并重述,否则会被抹掉。
120
+ - id: web
121
+ config:
122
+ searchProvider: ddg
123
+ fetchProvider: http
124
+ ```
125
+
126
+ - `searchProvider: ddg` —— `ddg` 是**本插件注册的 provider id(固定值)**,不是"使用 DuckDuckGo 引擎"的意思;具体用哪个引擎由设置页的 `provider` 字段决定(可填 `bing`/`baidu`/`auto` 等)。
127
+ - `fetchProvider: http` —— 官方网页抓取(web-fetch-http),请保留;漏掉会导致网页抓取失效或重复注册。
128
+ - 想改回官方搜索:在插件管理器里停用本插件条目即可。
129
+
99
130
  #### 姊妹插件:dsh-preset-workbench(预设工作台)
100
131
 
101
132
  同作者的**姊妹插件**:在设置页里可视化创建/编辑 Agent 预设——分段提示词、15 项能力开关、内置「鲸鱼娘 / 梁神模式」模板,不用手写 YAML。两者搭配:**free-search 解决"AI 联网搜索"、preset-workbench 解决"AI 人设能力编排"**,都是纯免费、开箱即用。
@@ -121,7 +152,7 @@ dsh web
121
152
  配置页提供:
122
153
 
123
154
  - **Search engine**:下拉框切换引擎,保存即生效
124
- - **API keys**:为 Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek 填写 key(密码框,保存后只显示"已配置";Exa / Tavily / Keenable / Firecrawl / Parallel 不填也可免 key 使用)
155
+ - **API keys**:为 Exa / Tavily / Keenable / Firecrawl / Parallel / Perplexity / DeepSeek / SerpBase / You.com 填写 key(密码框,保存后只显示"已配置";Exa / Tavily / Keenable / Firecrawl / Parallel 不填也可免 key 使用)
125
156
  - **推荐**:付费引擎 key 建议写入 harness 凭据中心 `~/.dsh/.credentials.yaml`(如 `DEEPSEEK_API_KEY: sk-...`,与官方 LLM provider 一致,一处管理所有 key)。插件读取优先级:凭据中心 > 设置页 > 环境变量,设置页填的 key 仅作为遗留兼容。
126
157
  - **Test engine**:直测当前引擎可用性(不走回退链,付费引擎无 key 会明确报错)
127
158
  - **Use Bing default**:把当前搜索引擎切回稳定的免费 Bing;`Discard` 只撤销尚未保存的编辑
@@ -159,7 +190,7 @@ DSH 0.1.7-rc.1 起,配置跟随 profile 的插件条目保存:设置页与 `
159
190
 
160
191
  ```yaml
161
192
  # profiles/<profile>/cordis.patch.yml 中该条目的 config:
162
- provider: bing # ddg / ddg-lite / bing / searxng / anysearch / exa / tavily / keenable / firecrawl / parallel / perplexity / serpbase / deepseek-official
193
+ provider: bing # ddg / ddg-lite / bing / searxng / anysearch / exa / tavily / keenable / firecrawl / parallel / perplexity / serpbase / deepseek-official / you
163
194
  lang: zh # 设置页界面语言(zh / en)
164
195
  bingMarket: zh-CN # Bing 市场
165
196
  region: cn-zh # DuckDuckGo 区域(可选)
@@ -217,6 +248,15 @@ Search engine test:
217
248
 
218
249
  示例对话:*"帮我搜最近 3 天关于 DSH 的新闻"* → agent 调用 `advanced_search`,`timeRange: "3d"`。
219
250
 
251
+ #### 多源并发合并搜索(multi_search)
252
+
253
+ 当需要对重要问题做**多源交叉验证**、避免单一引擎偏差或单源死锁时,可以让 agent 调用 `multi_search` 工具:
254
+
255
+ - **并发请求**:默认基于当前查询类型并发请求前 3 个优选引擎(或显式传入 `engines` 列表),各引擎独立解析 API Key 与容错(缺 key 引擎自动跳过,不阻断其他引擎)。
256
+ - **去重与合并**:按规范化 URL 去除结尾斜杠并合并结果,多引擎共同命中的条目优先置顶排在最前,并在结果附带 `seenIn` 命中来源清单(如 `[seen in: bing, exa]`)。
257
+ - **不可信边界与清洗**:严格遵守 `<untrusted-web-content>` 数据边界,正文 snippet 统一清洗。
258
+ - ⚠️ 注:多源并发会消耗更多 API 配额,建议在需要多角度核验时按需使用。
259
+
220
260
  #### 抓取网页内容(web_fetch)
221
261
 
222
262
  搜索到 URL 后,可以让 agent **读取网页全文**(如"打开第一个链接看看内容")。`web_fetch` 工具已启用(官方 `dsh-web-fetch-http` provider):
@@ -298,7 +338,7 @@ This plugin provides multiple free search engines with automatic fallback, compl
298
338
  ### Features
299
339
 
300
340
  - **Zero Cost** — Multiple free engines with no API key or registration required
301
- - **Multi-Engine Support** — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Tavily, Keenable, Firecrawl, Parallel, Perplexity, SerpBase, and DeepSeek Official
341
+ - **Multi-Engine Support** — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Tavily, Keenable, Firecrawl, Parallel, Perplexity, SerpBase, DeepSeek Official, and You.com
302
342
  - **Web Settings UI** — Engine switching, API key configuration (keys masked as "configured" in the UI), and a Chinese/English toggle; the entry is the component-row config (`plugins.row.config`) on the sidebar Plugins page (DSH 0.1.7-rc.1+)
303
343
  - **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)
304
344
  - **Engine Testing** — `free_search_test` for the agent to check all engines in one call; the settings UI also has a "Test engine" button that tests the selected engine directly (no fallback chain; paid engines without a key report an explicit error)
@@ -319,6 +359,7 @@ If this plugin has been helpful, a ⭐ on [GitHub](https://github.com/DDDMUC/dsh
319
359
 
320
360
  | id | Engine | Cost | Description |
321
361
  |---|---|---|---|
362
+ | `auto` | Auto Smart Routing | Dynamic | **Smartly routes engines based on query language/time filter** (Chinese queries prioritize Bing/Baidu/Aliyun/AnySearch, English queries prioritize Bing/Exa/Tavily; time filters prioritize time-capable engines), with full fallback |
322
363
  | `ddg` | DuckDuckGo HTML | Free | Occasional rate limits (anti-bot challenges); recovers automatically |
323
364
  | `ddg-lite` | DuckDuckGo Lite | Free | Lightweight version; same rate-limit behavior as above |
324
365
  | `bing` | Bing | Free | **Default engine**, most stable, optimized for Chinese (`zh-CN`) |
@@ -332,6 +373,10 @@ If this plugin has been helpful, a ⭐ on [GitHub](https://github.com/DDDMUC/dsh
332
373
  | `perplexity` | Perplexity | Paid | Requires `PERPLEXITY_API_KEY` |
333
374
  | `serpbase` | SerpBase | Paid | Requires `SERPBASE_API_KEY` (serpbase.dev, 100 free queries on signup) |
334
375
  | `deepseek-official` | DeepSeek Official | Paid | Requires `DEEPSEEK_API_KEY` |
376
+ | `you` | You.com | Paid | Requires `YOUCOM_API_KEY` (you.com/platform/api-keys, free tier on signup) |
377
+ | `baidu` | Baidu Qianfan AI Search | Quota | Requires `BAIDU_API_KEY` (Qianfan AI Search, 50 free calls/day then pay-as-you-go); Chinese web-wide, supports time filtering |
378
+ | `kimi` | Kimi (Moonshot) Web Search | Paid | Requires `MOONSHOT_API_KEY` (basic ~¥0.01/call); returns Chinese results with body chunks |
379
+ | `aliyun` | Aliyun Bailian EnhancedSearch | Paid | Requires `DASHSCOPE_API_KEY` (MCP search_pro, ~¥0.03/call, 200 free calls for new users); Chinese web-wide with source hostnames |
335
380
 
336
381
  - **Default engine is `bing`** (free and most stable), ready to use out of the box after installation.
337
382
  - **Auto-failover**: any engine failure (rate-limited free engine, or missing/invalid paid key, network error) automatically tries the next engine — the configured engine first, then other engines (exa/tavily/keenable/firecrawl/parallel are tried even without a key because they have built-in keyless quota), then the remaining free engines (Bing/AnySearch etc.) — with a note attached to the results naming the engine that actually served them (e.g. `Note: perplexity unavailable or failed, using exa.`). Search never fails outright because of engine issues.
@@ -343,6 +388,7 @@ If this plugin has been helpful, a ⭐ on [GitHub](https://github.com/DDDMUC/dsh
343
388
  - Perplexity: <https://www.perplexity.ai/settings/api>
344
389
  - SerpBase: <https://serpbase.dev>
345
390
  - DeepSeek: <https://platform.deepseek.com/api_keys>
391
+ - You.com: <https://you.com/platform/api-keys>
346
392
 
347
393
  #### Why are some engines free?
348
394
 
@@ -365,6 +411,31 @@ Then restart:
365
411
  dsh web
366
412
  ```
367
413
 
414
+ #### Takeover behavior and verification
415
+
416
+ The plugin **takes over search automatically** once loaded:
417
+
418
+ - When `web.searchProvider` is unset, or still the shipped default `deepseek-official`, it switches to this plugin;
419
+ - If you (or another plugin) explicitly selected a different provider, it does not steal it — it only logs a WARN with a copy-pasteable YAML snippet.
420
+
421
+ With a normal install (`dsh plugin add` / plugin manager) the bundled **bundle patch** (`cordis.patch.yml`) additionally writes `searchProvider: ddg` into the config layer. Even if that layer does not apply (e.g. the plugin was added as a plain dependency, or a profile patch replaced the whole `web` entry), the runtime fallback above still takes over from the official default — search no longer silently falls back to the official provider.
422
+
423
+ To declare it explicitly, or to switch over from another provider (`profiles/<profile>/cordis.patch.yml`):
424
+
425
+ ```yaml
426
+ # Route the harness web_search through this plugin.
427
+ # Since DSH 0.1.2 a patch REPLACES the whole entry config (no deep merge):
428
+ # restate any existing web.* fields (e.g. fetchProvider) or they are dropped.
429
+ - id: web
430
+ config:
431
+ searchProvider: ddg
432
+ fetchProvider: http
433
+ ```
434
+
435
+ - `searchProvider: ddg` — `ddg` is this plugin's **fixed provider id**, not "use the DuckDuckGo engine". The engine is chosen by the `provider` field in the settings page (`bing` / `baidu` / `auto` / …).
436
+ - `fetchProvider: http` — the official web-fetch provider; keep it, or page fetching breaks or double-registers.
437
+ - To go back to official search: disable this plugin's entry in the plugin manager.
438
+
368
439
  #### Sister Plugin: dsh-preset-workbench
369
440
 
370
441
  A **sister plugin** by the same author: a **visual workbench for creating/editing agent presets** right inside Settings — sectioned prompts, 15 capability toggles, and built-in "Whale Girl / Liangshen Mode" templates, no YAML needed. Pair them up: **free-search gives your AI web search, preset-workbench shapes its persona & capabilities** — both free and zero-config.
@@ -428,7 +499,7 @@ Since DSH 0.1.7-rc.1 the configuration is stored with the profile's plugin entry
428
499
 
429
500
  ```yaml
430
501
  # config of that entry in profiles/<profile>/cordis.patch.yml:
431
- provider: bing # ddg / ddg-lite / bing / searxng / anysearch / exa / tavily / keenable / firecrawl / parallel / perplexity / serpbase / deepseek-official
502
+ provider: bing # ddg / ddg-lite / bing / searxng / anysearch / exa / tavily / keenable / firecrawl / parallel / perplexity / serpbase / deepseek-official / you
432
503
  lang: zh # settings UI language (zh / en)
433
504
  bingMarket: zh-CN # Bing market
434
505
  region: cn-zh # DuckDuckGo region (optional)
@@ -486,6 +557,15 @@ Ask the agent for *"news from the last week"*, *"releases this month"*, *"update
486
557
 
487
558
  Example: *"Find DSH news from the last 3 days"* → agent calls `advanced_search` with `timeRange: "3d"`.
488
559
 
560
+ #### Multi-Engine Concurrent Search (`multi_search`)
561
+
562
+ When you need **cross-source verification** to prevent biases or fail-safes from a single engine, the agent can call `multi_search`:
563
+
564
+ - **Concurrent Execution**: Defaults to querying the top 3 recommended engines for the query type (or an explicit list passed via `engines`). Each engine independently resolves API keys and handles errors (missing keys are skipped without failing the batch).
565
+ - **Deduplication & Merge**: Normalizes URLs and ranks items by the number of engines that found them (`seenIn` counts), with cross-hit results placed at the top.
566
+ - **Untrusted Boundary**: Enforces the `<untrusted-web-content>` safety wrapper and trims snippets.
567
+ - ⚠️ Note: Running multiple engines in parallel consumes more search quota; use on demand when high source diversity is needed.
568
+
489
569
  #### Fetch Webpage Content (`web_fetch`)
490
570
 
491
571
  After searching, the agent can **read full webpage content** (e.g., *"Open the first link and summarize it"*). The `web_fetch` tool is enabled by default (official `dsh-web-fetch-http` provider):