dsh-free-search 0.4.2 → 0.4.4

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.en.md CHANGED
@@ -1,159 +1,190 @@
1
- # dsh-free-search
2
-
3
- **Free web search provider for DeepSeek Harness — no API key required, multi-engine, zero cost.**
4
-
5
- A plugin that adds multi-engine search providers to DeepSeek Harness (dsh), registered into the `ctx.web` seam. The built-in `web_search` tool picks it up automatically. Includes a web settings page for engine switching and API key configuration, plus an engine test tool.
6
-
7
- [中文](./README.md) | English
8
-
9
- ## Why
10
-
11
- dsh ships a DeepSeek-official search provider by default, which requires a valid `DEEPSEEK_API_KEY`. If you:
12
- - don't have (or don't want) a DeepSeek official API key,
13
- - already use a gateway like opencode-go (which does not expose a `web_search` tool),
14
-
15
- ...then the built-in search always fails and the agent tells you "I can't access the internet."
16
-
17
- This plugin provides multiple free engines with automatic failover, fully independent of the DeepSeek official key.
18
-
19
- ## Features
20
-
21
- - **Zero cost** — multiple free engines, no key, no registration
22
- - **Multi-engine**: DuckDuckGo (html/lite), Bing, SearXNG (meta-search, custom instances), Exa, Perplexity, DeepSeek Official
23
- - **Web settings UI** — engine switching + API key configuration (keys are redacted in the UI, shown as "configured")
24
- - **Engine test tool** — `free_search_test`, lets the agent verify every engine in one call
25
- - **Auto-failover** — free engines fall back to the next available one on failure/rate-limit
26
- - **System prompt injection** — the agent knows the current engine and which need keys
27
- - **FREE / API KEY badges** — green FREE badge for free engines, orange API KEY badge for paid ones
28
- - **Clean integration** — implements the official `WebSearchProvider` seam, coexists with official plugins
29
- - **web_fetch** — agent can fetch page content (official `dsh-web-fetch-http` provider, pure JS, zero extra deps)
30
- - **platform_search** — search GitHub / V2EX / Bilibili (public APIs, zero deps)
31
-
32
- ## Engines
33
-
34
- | id | Engine | Cost | Notes |
35
- |---|---|---|---|
36
- | `ddg` | DuckDuckGo HTML | Free | Occasionally rate-limited (anti-bot), recovers automatically |
37
- | `ddg-lite` | DuckDuckGo Lite | Free | Lightweight variant, same caveat |
38
- | `bing` | Bing | Free | **Default engine**, most stable, zh-CN optimized |
39
- | `anysearch` | AnySearch AI | Free | AI search, no key (anonymous quota) |
40
- | `searxng` | SearXNG meta-search | Free | Multi-instance failover, custom instances supported |
41
- | `exa` | Exa | Free | **Works keyless** (anonymous MCP), add key for higher limits |
42
- | `perplexity` | Perplexity | Paid | Requires `PERPLEXITY_API_KEY` |
43
- | `deepseek-official` | DeepSeek Official | Paid | Requires `DEEPSEEK_API_KEY` |
44
-
45
- Free engines auto-fallback to another free engine on failure. Paid engines fail with a clear error when their key is missing or invalid — never a silent switch.
46
-
47
- - **Default engine is `bing`** (free and most stable), works out of the box after install.
48
- - **Settings page has official links**: free engines show "访问官网 →", paid engines show "获取 API Key →" (opens in a new tab):
49
- - Exa: <https://dashboard.exa.ai/api-keys>
50
- - Perplexity: <https://www.perplexity.ai/settings/api>
51
- - DeepSeek: <https://platform.deepseek.com/api_keys>
52
-
53
- ### Why is AnySearch free?
54
-
55
- AnySearch (anysearch.com) is an AI search gateway that offers **anonymous public search quota** — its `v1/search` REST endpoint can be called directly without registration or an API key. The quota is rate-limited (fine for everyday use), but as one of several free engines with mutual failover, the experience stays reliable.
56
-
57
- Exa works the same way: its public MCP endpoint (`mcp.exa.ai/mcp`) supports anonymous calls, so it works without a key; setting `EXA_API_KEY` unlocks higher limits.
58
-
59
- ## Install
60
-
61
- ```sh
62
- git clone https://github.com/DDDMUC/dsh-free-search.git
63
- dsh plugin --profile web add /path/to/dsh-free-search
64
- ```
65
-
66
- Then restart:
67
-
68
- ```sh
69
- dsh web
70
- ```
71
-
72
- ## Usage
73
-
74
- ### Web settings (recommended)
75
-
76
- After install, open **Settings → Plugins → Configurable** tab → **Free Search** card (official settings page, no dsh-web-ui needed):
77
-
78
- - **Search engine**: dropdown to switch engines, save to apply
79
- - **API keys**: fill keys for Exa / Perplexity / DeepSeek (password inputs; after save the UI only shows "configured")
80
-
81
- ### Config file
82
-
83
- Configuration lives in `~/.dsh/settings.yaml`:
84
-
85
- ```yaml
86
- free-search:
87
- provider: bing # ddg / ddg-lite / bing / searxng / exa / perplexity / deepseek-official
88
- bingMarket: zh-CN # Bing market
89
- region: cn-zh # DuckDuckGo region (optional)
90
- searxngInstances: # custom SearXNG instances (optional)
91
- - https://your-instance.example
92
- exaApiKey: ... # or configure via the settings page
93
- perplexityApiKey: ...
94
- deepseekApiKey: ...
95
- ```
96
-
97
- ### Have the agent test all engines
98
-
99
- Ask the agent to "test all search engines" — it calls the `free_search_test` tool and reports:
100
-
101
- ```
102
- Search engine test:
103
- - ddg: FAIL - DuckDuckGo is rate-limited right now (anti-bot challenge, usually temporary) - Bing works
104
- - bing: OK (2 results, e.g. "DeepSeek Harness developer preview...")
105
- - exa: FAIL - EXA_API_KEY not configured
106
- ```
107
-
108
- ### Fetch page content (web_fetch)
109
-
110
- After search, ask the agent to **read a page** (e.g. "open the first link and summarize it"). The `web_fetch` tool is enabled (official `dsh-web-fetch-http` provider):
111
-
112
- - Follows redirects, decodes body (HTML to text)
113
- - Timeout and size limits
114
- - ⚠️ Note: `web_fetch` has no SSRF protection — the agent could reach internal addresses. Use deliberately.
115
-
116
- ### Platform search (platform_search)
117
-
118
- Ask the agent to search a specific platform, e.g. "search GitHub for deepseek harness", "find Bilibili videos about this", "V2EX threads about dsh". The `platform_search` tool supports:
119
-
120
- | Platform | Purpose |
121
- |---|---|
122
- | `github` | GitHub repository search (public API, free, no key) |
123
- | `v2ex` | V2EX hot/relevant topics |
124
- | `bilibili` | Bilibili video/content search (public endpoint) |
125
-
126
- All use public APIs with zero external dependencies — works out of the box.
127
-
128
- ## Local engine switcher (tools/)
129
-
130
- Prefer a local tool over the web UI? The `tools/` directory ships a zero-dependency switcher:
131
-
132
- - **`启动搜索引擎切换器.cmd`** (Windows) — double-click to start a local Node server (`http://127.0.0.1:4789`) and open the picker page in your browser
133
- - **`switch-engine.html`** — the picker UI: shows the current engine, one-click switch
134
- - **`server.mjs`** — local server that reads/writes `~/.dsh/profiles/web/cordis.patch.yml`
135
- - **`switch-engine.ps1`** — headless CLI: `powershell -File tools/switch-engine.ps1 -Engine bing`
136
-
137
- Restart `dsh web` after switching.
138
-
139
- > The settings card mounts on the official `settings.plugin.item` slot (built into dsh); config reads/writes go through the plugin's own bridge. **No dsh-web-ui dependency — the plugin works standalone.**
140
-
141
- ## Proxy note
142
-
143
- DuckDuckGo and some engines may be blocked and need a proxy. Node.js `fetch` does not use the system proxy by default — set these environment variables for the dsh process (Node 24+):
144
-
145
- ```sh
146
- export NODE_USE_ENV_PROXY=1
147
- export HTTPS_PROXY=http://127.0.0.1:7897 # your proxy
148
- export HTTP_PROXY=http://127.0.0.1:7897
149
- ```
150
-
151
- ## How it works
152
-
153
- - `lib/index.js`: host side. Implements `WebSearchProvider` (`id` / `available()` / `search()`), multi-engine routing + auto-failover; registers the `free-search` settings namespace; serves the `/api/dsh-free-search-settings` read/write bridge; registers the `free_search_test` tool; injects the engine list into the system prompt.
154
- - `lib/client.js`: browser side. React settings card (engine select + key inputs), mounted on the official `settings.plugin.item` slot (Settings → Plugins → Configurable), no dsh-web-ui dependency.
155
- - `cordis.patch.yml`: plugin loader config.
156
-
157
- ## License
158
-
159
- MIT
1
+ # dsh-free-search
2
+
3
+ **Free web search plugin for DeepSeek Harness — no API key required, zero cost, multi-engine switcher.** A plugin that adds multi-engine search providers to DeepSeek Harness (dsh), registered into the `ctx.web` seam. The built-in `web_search` tool picks it up automatically. Supports switching engines via the web settings UI, configuring API keys, and one-click testing of all search engines.
4
+
5
+ English | [中文](./README.md)
6
+
7
+ <div align="center">
8
+ <a href="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free1.png">
9
+ <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free1.png" alt="Free Engine Settings (Bing)" width="820" />
10
+ </a>
11
+ <br>
12
+ <sub>▲ Free engine (using Bing as an example)</sub>
13
+ </div>
14
+
15
+ ## Why You Need It
16
+
17
+ dsh's default search provider relies on the official DeepSeek API key (`DEEPSEEK_API_KEY`). If you:
18
+ - Do not have (or prefer not to use) an official DeepSeek key,
19
+ - Use a gateway like opencode-go (whose OpenAI-compatible endpoint does not support the `web_search` tool),
20
+
21
+ ...then the built-in search will inevitably fail, and the agent will tell you "I cannot access the internet."
22
+
23
+ This plugin provides multiple free search engines with automatic fallback, completely freeing you from relying on DeepSeek's official key.
24
+
25
+ ## Features
26
+
27
+ - **Zero Cost** — Multiple free engines with no API key or registration required
28
+ - **Multi-Engine Support** — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Perplexity, and DeepSeek Official
29
+ - **Web Settings UI** — Engine switching and API key configuration (API keys are masked in the UI and displayed as "configured")
30
+ - **Engine Testing Tool** — `free_search_test`, allowing the agent to test the availability of all engines in a single call
31
+ - **Automatic Fallback** — Automatically falls back to the next available free engine if one fails or gets rate-limited
32
+ - **System Prompt Injection** — The agent is aware of the currently active engine and which engines require API keys
33
+ - **Visual Badges** — Free engines feature a green `FREE` badge, while paid engines show an orange `API KEY` badge in the settings UI
34
+ - **Webpage Fetching (`web_fetch`)** — Allows the agent to read full webpage contents (official `dsh-web-fetch-http` provider, pure JS, zero extra dependencies)
35
+ - **Platform Search (`platform_search`)** — Search GitHub / V2EX / Bilibili (public APIs, zero extra dependencies)
36
+ - **Clean Integration** — Implements the official `WebSearchProvider` seam interface, coexisting seamlessly with official plugins
37
+
38
+ ## Supported Engines
39
+
40
+ | id | Engine | Cost | Description |
41
+ |---|---|---|---|
42
+ | `ddg` | DuckDuckGo HTML | Free | Occasional rate limits (anti-bot challenges); recovers automatically |
43
+ | `ddg-lite` | DuckDuckGo Lite | Free | Lightweight version; same rate-limit behavior as above |
44
+ | `bing` | Bing | Free | **Default engine**, most stable, optimized for Chinese (`zh-CN`) |
45
+ | `anysearch` | AnySearch AI | Free | AI search, no key needed (anonymous quota) |
46
+ | `searxng` | SearXNG Meta Search | Free | Multi-instance automatic failover; supports custom instances |
47
+ | `exa` | Exa | Free | **Usable without a key** (anonymous MCP); configure a key for higher quota |
48
+ | `perplexity` | Perplexity | Paid | Requires `PERPLEXITY_API_KEY` |
49
+ | `deepseek-official` | DeepSeek Official | Paid | Requires `DEEPSEEK_API_KEY` |
50
+
51
+ - **Default engine is `bing`** (free and most stable), ready to use out of the box after installation.
52
+ - Free engines automatically fall back to other free engines upon failure. Paid engines report clear error messages when keys are missing or invalid, avoiding silent fallbacks.
53
+ - **Official Links in Settings**: Free engines display "Visit Website →", while paid engines display "Get API Key →" (opens in a new tab):
54
+ - Exa: <https://dashboard.exa.ai/api-keys>
55
+ - Perplexity: <https://www.perplexity.ai/settings/api>
56
+ - DeepSeek: <https://platform.deepseek.com/api_keys>
57
+
58
+ ### Why is AnySearch free?
59
+
60
+ AnySearch (anysearch.com) is an AI search gateway that provides **anonymous public search quota** — it can be called directly via its `v1/search` REST endpoint without registration or an API key. Quotas are rate-limited (suitable for daily queries), but as one of the free engines with mutual fallback, it offers a reliable experience.
61
+
62
+ The same applies to Exa: its public MCP endpoint (`mcp.exa.ai/mcp`) supports anonymous requests, allowing it to work without an API key. Configuring `EXA_API_KEY` grants a higher usage quota.
63
+
64
+ ## Installation
65
+
66
+ ```sh
67
+ git clone https://github.com/DDDMUC/dsh-free-search.git
68
+ dsh plugin --profile web add /path/to/dsh-free-search
69
+ ```
70
+
71
+ Then restart:
72
+
73
+ ```sh
74
+ dsh web
75
+ ```
76
+
77
+ ### Dependency Note
78
+
79
+ This plugin intentionally specifies `@deepseek-ai/dsh-settings` and `@deepseek-ai/dsh-tools` as `peerDependencies`: the DSH runtime must use a single instance from the installation tree. Always install the plugin using `dsh plugin --profile <profile> add ...`. Do **not** copy DSH core packages into a profile-local `node_modules`, as duplicate copies can break the tool scheduler.
80
+
81
+ ## Usage
82
+
83
+ ### Web Settings (Recommended)
84
+
85
+ After installation, navigate to **Settings → Plugins → Configurable** tab → **Free Search** card (the official settings page):
86
+
87
+ - **Search engine**: Select an engine from the dropdown; changes take effect immediately upon saving.
88
+ - **API keys**: Enter keys for Exa / Perplexity / DeepSeek (password fields; displayed as "configured" once saved).
89
+ - **Use Bing default**: stage a switch back to the stable free Bing engine; `Discard` only cancels unsaved edits.
90
+
91
+ <table align="center" style="border: none; border-collapse: collapse;">
92
+ <tr style="border: none;">
93
+ <td align="center" width="50%" style="border: none; padding: 6px;">
94
+ <a href="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free.png">
95
+ <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free.png" alt="Free Engine Settings" width="100%" />
96
+ </a>
97
+ <br>
98
+ <sub>▲ <b>Free Engine</b> (shows green FREE badge and official website link)</sub>
99
+ </td>
100
+ <td align="center" width="50%" style="border: none; padding: 6px;">
101
+ <a href="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-apikey.png">
102
+ <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-apikey.png" alt="Paid/API Key Engine Settings" width="100%" />
103
+ </a>
104
+ <br>
105
+ <sub>▲ <b>Paid / API Key Engine</b> (shows orange API KEY badge and link to get an API key)</sub>
106
+ </td>
107
+ </tr>
108
+ </table>
109
+
110
+ ### Configuration File / CLI
111
+
112
+ Configuration is stored in `~/.dsh/settings.yaml`:
113
+
114
+ ```yaml
115
+ free-search:
116
+ provider: bing # ddg / ddg-lite / bing / searxng / exa / perplexity / deepseek-official
117
+ bingMarket: zh-CN # Bing market
118
+ region: cn-zh # DuckDuckGo region (optional)
119
+ searxngInstances: # Custom SearXNG instances (optional)
120
+ - https://your-instance.example
121
+ exaApiKey: ... # Or configure via the web settings UI
122
+ perplexityApiKey: ...
123
+ deepseekApiKey: ...
124
+ ```
125
+
126
+ ### Asking the Agent to Test All Engines
127
+
128
+ Tell the agent *"Test all search engines"*, and it will call the `free_search_test` tool to check each engine sequentially and report back:
129
+
130
+ ```
131
+ Search engine test:
132
+ - ddg: FAIL - DuckDuckGo is rate-limited right now (anti-bot challenge, usually temporary) - Bing works
133
+ - bing: OK (2 results, e.g. "DeepSeek Harness developer preview...")
134
+ - exa: FAIL - EXA_API_KEY not configured
135
+ ```
136
+
137
+ ### Fetch Webpage Content (`web_fetch`)
138
+
139
+ 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):
140
+
141
+ - Automatically follows redirects and decodes HTML to plain text.
142
+ - Supports timeout and response size limits.
143
+ - ⚠️ Note: `web_fetch` does not have SSRF protection; the agent could theoretically access internal network addresses. Use as needed.
144
+
145
+ ### Platform Search (`platform_search`)
146
+
147
+ Ask the agent to search specific platforms (e.g., *"Search GitHub for deepseek harness"*, *"Find related videos on Bilibili"*, or *"Discussions about dsh on V2EX"*). The `platform_search` tool supports:
148
+
149
+ | Platform | Purpose |
150
+ |---|---|
151
+ | `github` | GitHub repository search (public API, free, no key required) |
152
+ | `v2ex` | V2EX hot / relevant topics |
153
+ | `bilibili` | Bilibili video / content search (public API) |
154
+
155
+ All platform searches rely on public endpoints with zero external dependencies and work out of the box.
156
+
157
+ ## Local Engine Switcher (`tools/`)
158
+
159
+ The `tools/` directory includes a lightweight, zero-dependency switcher:
160
+
161
+ - **`启动搜索引擎切换器.cmd`** (Windows) — Double-click to launch a local Node server (`http://127.0.0.1:4789`) and automatically open the engine selector page in your browser.
162
+ - **`switch-engine.html`** — The selector UI: displays current engine status and allows one-click switching.
163
+ - **`server.mjs`** — The local backend service responsible for reading/writing `~/.dsh/profiles/web/cordis.patch.yml`.
164
+ - **`switch-engine.ps1`** — Headless PowerShell script: `powershell -File tools/switch-engine.ps1 -Engine bing`.
165
+
166
+ Restart `dsh web` after switching to apply changes.
167
+
168
+ > The settings card mounts into the official `settings.plugin.item` slot (built into DSH), and configuration reads/writes go through the plugin's own bridge. **No `dsh-web-ui` dependency — the plugin can be used standalone.**
169
+
170
+ ## Proxy Note (for Users in Mainland China)
171
+
172
+ Engines like DuckDuckGo may require a proxy. Since Node.js `fetch` does not use the system proxy by default, set the following environment variables for the dsh process (Node 24+):
173
+
174
+ ```sh
175
+ export NODE_USE_ENV_PROXY=1
176
+ export HTTPS_PROXY=http://127.0.0.1:7897 # Your proxy address
177
+ export HTTP_PROXY=http://127.0.0.1:7897
178
+ ```
179
+
180
+ Windows users: The desktop shortcut already includes this configuration (`set NODE_USE_ENV_PROXY=1&& set HTTPS_PROXY=...`).
181
+
182
+ ## How It Works
183
+
184
+ - `lib/index.js`: Host side. Implements `WebSearchProvider` (`id` / `available()` / `search()`), multi-engine routing + auto-fallback; registers the `free-search` settings namespace; provides the `/api/dsh-free-search-settings` read/write bridge; registers the `free_search_test` tool; injects the engine list into system prompts.
185
+ - `lib/client.js`: Browser side. React configuration card (engine select + key inputs), mounted into the official `settings.plugin.item` slot (Settings → Plugins → Configurable), without requiring `dsh-web-ui`.
186
+ - `cordis.patch.yml`: Plugin loader configuration.
187
+
188
+ ## License
189
+
190
+ MIT
package/README.md CHANGED
@@ -1,160 +1,191 @@
1
- # dsh-free-search
2
-
3
- **DeepSeek Harness 免费搜索插件 —— 无需 API key,零成本,多引擎可切换。**
4
-
5
- 一个给 DeepSeek Harness (dsh) 添加多引擎搜索 provider 的插件,注册进 `ctx.web` seam。内置 `web_search` 工具自动选用,支持网页设置页切换引擎、配置 API key、一键测试所有引擎。
6
-
7
- [English](./README.en.md) | 中文
8
-
9
- ## 为什么需要它
10
-
11
- dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`)。如果你:
12
- - 没有(或不想用)DeepSeek 官方 key,
13
- - 用的是 opencode-go 这类网关(其 OpenAI 兼容端点不支持 `web_search` 工具),
14
-
15
- ……那么内置搜索必然失败,agent 会告诉你"无法联网"。
16
-
17
- 这个插件提供多个免费引擎 + 自动回退,彻底摆脱 DeepSeek 官方 key 的依赖。
18
-
19
- ## 特性
20
-
21
- - **零成本** —— 多个免费引擎,无需 key、无需注册
22
- - **多引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、Exa、Perplexity、DeepSeek 官方
23
- - **网页设置页** —— 引擎切换 + API key 配置(UI 中 key 脱敏显示"已配置")
24
- - **引擎测试工具** —— `free_search_test`,让 agent 一键测试所有引擎可用性
25
- - **自动回退** —— 免费引擎失败/限流时自动切换到下一个可用引擎
26
- - **系统提示词注入** —— agent 知道当前用哪个引擎、哪些需要 key
27
- - **免费标注** —— 设置页中免费引擎带绿色 `FREE` 徽章,付费引擎带橙色 `API KEY` 徽章
28
- - **网页抓取(web_fetch)** —— 让 agent 抓取网页内容(官方 `dsh-web-fetch-http` provider,纯 JS,零额外依赖)
29
- - **平台搜索(platform_search)** —— 搜 GitHub / V2EX / B站(公开 API,零依赖)
30
- - **干净集成** —— 实现官方 `WebSearchProvider` seam 接口,与官方插件共存
31
-
32
- ## 引擎列表
33
-
34
- | id | 引擎 | 费用 | 说明 |
35
- |---|---|---|---|
36
- | `ddg` | DuckDuckGo HTML | 免费 | 偶发限流(反爬),解封自动恢复 |
37
- | `ddg-lite` | DuckDuckGo Lite | 免费 | 轻量版,同上 |
38
- | `bing` | Bing | 免费 | **默认引擎**,最稳定,中文优化(zh-CN) |
39
- | `anysearch` | AnySearch AI | 免费 | AI 搜索,无 key(匿名额度) |
40
- | `searxng` | SearXNG 元搜索 | 免费 | 多实例自动切换,支持自定义实例 |
41
- | `exa` | Exa | 免费 | **无 key 也可用**(MCP 匿名),配 key 提升额度 |
42
- | `perplexity` | Perplexity | 付费 | 需 `PERPLEXITY_API_KEY` |
43
- | `deepseek-official` | DeepSeek 官方 | 付费 | 需 `DEEPSEEK_API_KEY` |
44
-
45
- - **默认引擎为 `bing`**(免费且最稳定),安装后开箱即用。
46
- - 免费引擎失败会自动回退到其他免费引擎;付费引擎缺 key 或 key 无效时报清晰错误,不会静默切换。
47
- - **设置页有官网链接**:免费引擎显示"访问官网 →",付费引擎显示"获取 API Key →"(新标签页打开):
48
- - Exa:<https://dashboard.exa.ai/api-keys>
49
- - Perplexity:<https://www.perplexity.ai/settings/api>
50
- - DeepSeek:<https://platform.deepseek.com/api_keys>
51
-
52
- ### 为什么 AnySearch 免费?
53
-
54
- AnySearch(anysearch.com)是一个 AI 搜索网关,提供**匿名的公共搜索额度**——通过其 `v1/search` REST 接口可以直接调用,无需注册或 API key。额度有限流(适合日常搜索),但作为免费引擎之一,与其他免费引擎互相回退,体验稳定。
55
-
56
- Exa 同理:其公开 MCP 端点(`mcp.exa.ai/mcp`)支持匿名调用,因此不配置 key 也能用;配置 `EXA_API_KEY` 后可获得更高额度。
57
-
58
- ## 安装
59
-
60
- ```sh
61
- git clone https://github.com/DDDMUC/dsh-free-search.git
62
- dsh plugin --profile web add /path/to/dsh-free-search
63
- ```
64
-
65
- 然后重启:
66
-
67
- ```sh
68
- dsh web
69
- ```
70
-
71
- ## 使用
72
-
73
- ### 网页设置(推荐)
74
-
75
- 安装后,打开 **设置 → 插件 → 可配置** 标签页 → **Free Search** 卡片(官方设置页,无需 dsh-web-ui):
76
-
1
+ # dsh-free-search
2
+
3
+ **DeepSeek Harness 免费搜索插件 —— 无需 API key,零成本,多引擎可切换。** 一个给 DeepSeek Harness (dsh) 添加多引擎搜索 provider 的插件,注册进 `ctx.web` seam。内置 `web_search` 工具自动选用,支持网页设置页切换引擎、配置 API key、一键测试所有引擎。
4
+
5
+ [English](./README.en.md) | 中文
6
+
7
+ <div align="center">
8
+ <a href="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free1.png">
9
+ <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free1.png" alt="免费引擎设置 (Bing)" width="820" />
10
+ </a>
11
+ <br>
12
+ <sub>▲ 免费引擎(以Bing为例)</sub>
13
+ </div>
14
+
15
+ ## 为什么需要它
16
+
17
+ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`)。如果你:
18
+ - 没有(或不想用)DeepSeek 官方 key,
19
+ - 用的是 opencode-go 这类网关(其 OpenAI 兼容端点不支持 `web_search` 工具),
20
+
21
+ ……那么内置搜索必然失败,agent 会告诉你"无法联网"。
22
+
23
+ 这个插件提供多个免费引擎 + 自动回退,彻底摆脱 DeepSeek 官方 key 的依赖。
24
+
25
+ ## 特性
26
+
27
+ - **零成本** —— 多个免费引擎,无需 key、无需注册
28
+ - **多引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、Exa、Perplexity、DeepSeek 官方
29
+ - **网页设置页** —— 引擎切换 + API key 配置(UI 中 key 脱敏显示"已配置")
30
+ - **引擎测试工具** —— `free_search_test`,让 agent 一键测试所有引擎可用性
31
+ - **自动回退** —— 免费引擎失败/限流时自动切换到下一个可用引擎
32
+ - **系统提示词注入** —— agent 知道当前用哪个引擎、哪些需要 key
33
+ - **免费标注** —— 设置页中免费引擎带绿色 `FREE` 徽章,付费引擎带橙色 `API KEY` 徽章
34
+ - **网页抓取(web_fetch)** —— 让 agent 抓取网页内容(官方 `dsh-web-fetch-http` provider,纯 JS,零额外依赖)
35
+ - **平台搜索(platform_search)** —— 搜 GitHub / V2EX / B站(公开 API,零依赖)
36
+ - **干净集成** —— 实现官方 `WebSearchProvider` seam 接口,与官方插件共存
37
+
38
+ ## 引擎列表
39
+
40
+ | id | 引擎 | 费用 | 说明 |
41
+ |---|---|---|---|
42
+ | `ddg` | DuckDuckGo HTML | 免费 | 偶发限流(反爬),解封自动恢复 |
43
+ | `ddg-lite` | DuckDuckGo Lite | 免费 | 轻量版,同上 |
44
+ | `bing` | Bing | 免费 | **默认引擎**,最稳定,中文优化(zh-CN) |
45
+ | `anysearch` | AnySearch AI | 免费 | AI 搜索,无 key(匿名额度) |
46
+ | `searxng` | SearXNG 元搜索 | 免费 | 多实例自动切换,支持自定义实例 |
47
+ | `exa` | Exa | 免费 | **无 key 也可用**(MCP 匿名),配 key 提升额度 |
48
+ | `perplexity` | Perplexity | 付费 | 需 `PERPLEXITY_API_KEY` |
49
+ | `deepseek-official` | DeepSeek 官方 | 付费 | 需 `DEEPSEEK_API_KEY` |
50
+
51
+ - **默认引擎为 `bing`**(免费且最稳定),安装后开箱即用。
52
+ - 免费引擎失败会自动回退到其他免费引擎;付费引擎缺 key 或 key 无效时报清晰错误,不会静默切换。
53
+ - **设置页有官网链接**:免费引擎显示"访问官网 →",付费引擎显示"获取 API Key →"(新标签页打开):
54
+ - Exa:<https://dashboard.exa.ai/api-keys>
55
+ - Perplexity:<https://www.perplexity.ai/settings/api>
56
+ - DeepSeek:<https://platform.deepseek.com/api_keys>
57
+
58
+ ### 为什么 AnySearch 免费?
59
+
60
+ AnySearch(anysearch.com)是一个 AI 搜索网关,提供**匿名的公共搜索额度**——通过其 `v1/search` REST 接口可以直接调用,无需注册或 API key。额度有限流(适合日常搜索),但作为免费引擎之一,与其他免费引擎互相回退,体验稳定。
61
+
62
+ Exa 同理:其公开 MCP 端点(`mcp.exa.ai/mcp`)支持匿名调用,因此不配置 key 也能用;配置 `EXA_API_KEY` 后可获得更高额度。
63
+
64
+ ## 安装
65
+
66
+ ```sh
67
+ git clone https://github.com/DDDMUC/dsh-free-search.git
68
+ dsh plugin --profile web add /path/to/dsh-free-search
69
+ ```
70
+
71
+ 然后重启:
72
+
73
+ ```sh
74
+ dsh web
75
+ ```
76
+
77
+ ### 依赖说明
78
+
79
+ 插件对 `@deepseek-ai/dsh-settings` 和 `@deepseek-ai/dsh-tools` 使用 `peerDependencies`,这是刻意的:DSH 运行时必须使用安装树中的唯一实例。请通过 `dsh plugin --profile <profile> add ...` 安装插件,不要把 DSH 核心包复制进 profile 的本地 `node_modules`;重复副本会导致工具调度器失效。
80
+
81
+ ## 使用
82
+
83
+ ### 网页设置(推荐)
84
+
85
+ 安装后,打开 **设置 → 插件 → 可配置** 标签页 → **Free Search** 卡片(官方设置页):
86
+
77
87
  - **Search engine**:下拉框切换引擎,保存即生效
78
88
  - **API keys**:为 Exa / Perplexity / DeepSeek 填写 key(密码框,保存后只显示"已配置")
79
-
80
- ### 命令行 / 配置文件
81
-
82
- 配置存在 `~/.dsh/settings.yaml`:
83
-
84
- ```yaml
85
- free-search:
86
- provider: bing # ddg / ddg-lite / bing / searxng / exa / perplexity / deepseek-official
87
- bingMarket: zh-CN # Bing 市场
88
- region: cn-zh # DuckDuckGo 区域(可选)
89
- searxngInstances: # 自定义 SearXNG 实例(可选)
90
- - https://your-instance.example
91
- exaApiKey: ... # 或通过设置页填写
92
- perplexityApiKey: ...
93
- deepseekApiKey: ...
94
- ```
95
-
96
- ### 让 agent 测试所有引擎
97
-
98
- 对 agent 说"测试一下所有搜索引擎",它会调用 `free_search_test` 工具,逐个测试并报告:
99
-
100
- ```
101
- Search engine test:
102
- - ddg: FAIL - DuckDuckGo is rate-limited right now (anti-bot challenge, usually temporary) - Bing works
103
- - bing: OK (2 results, e.g. "DeepSeek Harness developer preview...")
104
- - exa: FAIL - EXA_API_KEY not configured
105
- ```
106
-
107
- ### 抓取网页内容(web_fetch)
108
-
109
- 搜索到 URL 后,可以让 agent **读取网页全文**(如"打开第一个链接看看内容")。`web_fetch` 工具已启用(官方 `dsh-web-fetch-http` provider):
110
-
111
- - 自动跟随重定向、解码正文(HTML 转文本)
112
- - 支持超时和大小限制
113
- - ⚠️ 注意:`web_fetch` 无 SSRF 防护,agent 理论上可访问内网地址——按需使用
114
-
115
- ### 平台搜索(platform_search)
116
-
117
- 让 agent 搜特定平台,如"在 GitHub 上搜 deepseek harness"、"看看 B站有什么相关视频"、"V2EX 上关于 dsh 的讨论"。`platform_search` 工具支持:
118
-
119
- | 平台 | 用途 |
120
- |---|---|
121
- | `github` | GitHub 仓库搜索(API,免费无 key) |
122
- | `v2ex` | V2EX 热门/相关主题 |
123
- | `bilibili` | B站视频/内容搜索(公开接口) |
124
-
125
- 全部走公开 API,零外部依赖,开箱即用。
126
-
127
- ## 本地引擎切换工具(tools/)
128
-
129
- 不想用网页设置页?`tools/` 目录附带了一个本地切换小工具(零依赖):
130
-
131
- - **`启动搜索引擎切换器.cmd`**(Windows)——双击启动本地 Node 服务(`http://127.0.0.1:4789`)并自动打开浏览器选择页面
132
- - **`switch-engine.html`** —— 选择页面:显示当前引擎,点选新引擎,一键写入配置
133
- - **`server.mjs`** —— 本地服务,负责读写 `~/.dsh/profiles/web/cordis.patch.yml`
134
- - **`switch-engine.ps1`** —— 无界面命令行版:`powershell -File tools/switch-engine.ps1 -Engine bing`
135
-
136
- 切换后重启 `dsh web` 生效。
137
-
138
- > 配置卡片挂在官方设置页的 `settings.plugin.item` 插槽(dsh 自带),配置读写走插件自建 bridge,**不依赖 dsh-web-ui**,插件可独立使用。
139
-
140
- ## 代理说明(国内用户)
141
-
142
- DuckDuckGo 等引擎可能需要代理才能访问,而 Node.js 的 `fetch` 默认不走系统代理。需要给 dsh 进程设置(Node 24+):
143
-
144
- ```sh
145
- export NODE_USE_ENV_PROXY=1
146
- export HTTPS_PROXY=http://127.0.0.1:7897 # 你的代理地址
147
- export HTTP_PROXY=http://127.0.0.1:7897
148
- ```
149
-
150
- Windows 用户:桌面快捷方式已内置此配置(`set NODE_USE_ENV_PROXY=1&& set HTTPS_PROXY=...`)。
151
-
152
- ## 工作原理
153
-
154
- - `lib/index.js`:host 端。实现 `WebSearchProvider`(`id` / `available()` / `search()`),多引擎路由 + 自动回退;注册 `free-search` settings namespace;提供 `/api/dsh-free-search-settings` 读写桥;注册 `free_search_test` 工具;注入引擎清单到系统提示词。
155
- - `lib/client.js`:浏览器端。React 配置卡片(引擎选择 + key 输入),挂载到官方设置页的 `settings.plugin.item` 插槽(设置 → 插件 → 可配置),不依赖 dsh-web-ui。
156
- - `cordis.patch.yml`:插件 loader 配置。
157
-
158
- ## License
159
-
160
- MIT
89
+ - **Use Bing default**:把当前搜索引擎切回稳定的免费 Bing;`Discard` 只撤销尚未保存的编辑
90
+
91
+ <table align="center" style="border: none; border-collapse: collapse;">
92
+ <tr style="border: none;">
93
+ <td align="center" width="50%" style="border: none; padding: 6px;">
94
+ <a href="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free.png">
95
+ <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-free.png" alt="免费引擎设置" width="100%" />
96
+ </a>
97
+ <br>
98
+ <sub>▲ <b>免费引擎</b>(显示绿色 FREE 徽章与官网链接)</sub>
99
+ </td>
100
+ <td align="center" width="50%" style="border: none; padding: 6px;">
101
+ <a href="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-apikey.png">
102
+ <img src="https://raw.githubusercontent.com/DDDMUC/dsh-free-search/master/assets/settings-apikey.png" alt="付费引擎设置" width="100%" />
103
+ </a>
104
+ <br>
105
+ <sub>▲ <b>付费/API Key 引擎</b>(显示橙色 API KEY 徽章与获取链接)</sub>
106
+ </td>
107
+ </tr>
108
+ </table>
109
+
110
+
111
+ ### 命令行 / 配置文件
112
+
113
+ 配置存在 `~/.dsh/settings.yaml`:
114
+
115
+ ```yaml
116
+ free-search:
117
+ provider: bing # ddg / ddg-lite / bing / searxng / exa / perplexity / deepseek-official
118
+ bingMarket: zh-CN # Bing 市场
119
+ region: cn-zh # DuckDuckGo 区域(可选)
120
+ searxngInstances: # 自定义 SearXNG 实例(可选)
121
+ - https://your-instance.example
122
+ exaApiKey: ... # 或通过设置页填写
123
+ perplexityApiKey: ...
124
+ deepseekApiKey: ...
125
+ ```
126
+
127
+ ### 让 agent 测试所有引擎
128
+
129
+ 对 agent 说"测试一下所有搜索引擎",它会调用 `free_search_test` 工具,逐个测试并报告:
130
+
131
+ ```
132
+ Search engine test:
133
+ - ddg: FAIL - DuckDuckGo is rate-limited right now (anti-bot challenge, usually temporary) - Bing works
134
+ - bing: OK (2 results, e.g. "DeepSeek Harness developer preview...")
135
+ - exa: FAIL - EXA_API_KEY not configured
136
+ ```
137
+
138
+ ### 抓取网页内容(web_fetch)
139
+
140
+ 搜索到 URL 后,可以让 agent **读取网页全文**(如"打开第一个链接看看内容")。`web_fetch` 工具已启用(官方 `dsh-web-fetch-http` provider):
141
+
142
+ - 自动跟随重定向、解码正文(HTML 转文本)
143
+ - 支持超时和大小限制
144
+ - ⚠️ 注意:`web_fetch` 无 SSRF 防护,agent 理论上可访问内网地址——按需使用
145
+
146
+ ### 平台搜索(platform_search)
147
+
148
+ 让 agent 搜特定平台,如"在 GitHub 上搜 deepseek harness"、"看看 B站有什么相关视频"、"V2EX 上关于 dsh 的讨论"。`platform_search` 工具支持:
149
+
150
+ | 平台 | 用途 |
151
+ |---|---|
152
+ | `github` | GitHub 仓库搜索(API,免费无 key) |
153
+ | `v2ex` | V2EX 热门/相关主题 |
154
+ | `bilibili` | B站视频/内容搜索(公开接口) |
155
+
156
+ 全部走公开 API,零外部依赖,开箱即用。
157
+
158
+ ## 本地引擎切换工具(tools/)
159
+
160
+ `tools/` 目录附带了一个本地切换小工具(零依赖):
161
+
162
+ - **`启动搜索引擎切换器.cmd`**(Windows)——双击启动本地 Node 服务(`http://127.0.0.1:4789`)并自动打开浏览器选择页面
163
+ - **`switch-engine.html`** —— 选择页面:显示当前引擎,点选新引擎,一键写入配置
164
+ - **`server.mjs`** —— 本地服务,负责读写 `~/.dsh/profiles/web/cordis.patch.yml`
165
+ - **`switch-engine.ps1`** —— 无界面命令行版:`powershell -File tools/switch-engine.ps1 -Engine bing`
166
+
167
+ 切换后重启 `dsh web` 生效。
168
+
169
+ > 配置卡片挂在官方设置页的 `settings.plugin.item` 插槽(dsh 自带),配置读写走插件自建 bridge,**不依赖 dsh-web-ui**,插件可独立使用。
170
+
171
+ ## 代理说明(国内用户)
172
+
173
+ DuckDuckGo 等引擎可能需要代理才能访问,而 Node.js 的 `fetch` 默认不走系统代理。需要给 dsh 进程设置(Node 24+):
174
+
175
+ ```sh
176
+ export NODE_USE_ENV_PROXY=1
177
+ export HTTPS_PROXY=http://127.0.0.1:7897 # 你的代理地址
178
+ export HTTP_PROXY=http://127.0.0.1:7897
179
+ ```
180
+
181
+ Windows 用户:桌面快捷方式已内置此配置(`set NODE_USE_ENV_PROXY=1&& set HTTPS_PROXY=...`)。
182
+
183
+ ## 工作原理
184
+
185
+ - `lib/index.js`:host 端。实现 `WebSearchProvider`(`id` / `available()` / `search()`),多引擎路由 + 自动回退;注册 `free-search` settings namespace;提供 `/api/dsh-free-search-settings` 读写桥;注册 `free_search_test` 工具;注入引擎清单到系统提示词。
186
+ - `lib/client.js`:浏览器端。React 配置卡片(引擎选择 + key 输入),挂载到官方设置页的 `settings.plugin.item` 插槽(设置 → 插件 → 可配置),不依赖 dsh-web-ui。
187
+ - `cordis.patch.yml`:插件 loader 配置。
188
+
189
+ ## License
190
+
191
+ MIT
package/lib/client.js CHANGED
@@ -301,6 +301,17 @@ window.__ModuleLoader__.load({
301
301
  className: "dshfs-footer",
302
302
  children: [
303
303
  failed ? react_jsx_runtime.jsx("p", { className: "dshfs-failed", children: "save failed" }) : null,
304
+ react_jsx_runtime.jsx("button", {
305
+ className: "dshfs-btn",
306
+ type: "button",
307
+ onClick: () => {
308
+ setProvider("bing");
309
+ setDirty(true);
310
+ setFailed(false);
311
+ },
312
+ disabled: saving || !ready || provider === "bing",
313
+ children: "Use Bing default",
314
+ }),
304
315
  react_jsx_runtime.jsx("button", {
305
316
  className: "dshfs-btn",
306
317
  type: "button",
package/lib/index.js CHANGED
@@ -1048,6 +1048,11 @@ function apply(ctx, config) {
1048
1048
  const result = await searchPlatform(platform, args.query, limit);
1049
1049
  return { platform, sources: result.sources };
1050
1050
  },
1051
+ finalizeContent(exec, result) {
1052
+ // Tool-result content must be an array of content blocks, not a raw string.
1053
+ const text = result.content;
1054
+ return typeof text === "string" && text.length > 0 ? [{ type: "text", text }] : undefined;
1055
+ },
1051
1056
  })
1052
1057
  );
1053
1058
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-free-search",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Free web search for DeepSeek Harness: 8 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa keyless) + platform search + web_fetch, with web settings UI.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -38,10 +38,16 @@
38
38
  "node": ">=20"
39
39
  },
40
40
  "dependencies": {
41
- "@deepseek-ai/dsh-settings": "0.1.0-rc.6",
42
- "@deepseek-ai/dsh-tools": "0.1.0-rc.6",
43
41
  "@deepseek-ai/schemastery": "^3.18.1"
44
42
  },
43
+ "peerDependencies": {
44
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.6",
45
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.6"
46
+ },
47
+ "devDependencies": {
48
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.6",
49
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.6"
50
+ },
45
51
  "dsh": {
46
52
  "bundle": {
47
53
  "patch": "cordis.patch.yml"