@tonydua/dsh-web-search-exa 0.1.4 → 0.2.1

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.i18n.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record.
4
- README.md: 9dc939e621c5ceacc4d0dffbc0eb920f039e2cf1
5
- README.zh.md: 4caca6729a7fd25894ecd9ddc6c8c3565e4e8605
4
+ README.md: b1d1b4f2e6f97ef83c1a542714ecceedd2f6036d
5
+ README.zh.md: 50c53ecf67bbf99720d36667e53731a6b634fdb4
package/README.md CHANGED
@@ -2,181 +2,212 @@
2
2
 
3
3
  **English** | [简体中文](README.zh.md)
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@tonydua/dsh-web-search-exa)](https://www.npmjs.com/package/@tonydua/dsh-web-search-exa)
5
+ [![npm version](https://img.shields.io/npm/v/@tonydua/dsh-web-search-exa?label=npm)](https://www.npmjs.com/package/@tonydua/dsh-web-search-exa)
6
+ [![GitHub release](https://img.shields.io/github/release/TonyDua/dsh-web-search-exa?label=release)](https://github.com/TonyDua/dsh-web-search-exa/releases/latest)
6
7
  [![npm downloads](https://img.shields.io/npm/dm/@tonydua/dsh-web-search-exa)](https://www.npmjs.com/package/@tonydua/dsh-web-search-exa)
7
8
  [![License](https://img.shields.io/npm/l/@tonydua/dsh-web-search-exa)](LICENSE)
9
+ [![dsh](https://img.shields.io/badge/dsh-0.1.2--alpha.2%20%E2%80%93%200.1.7--alpha.1-4c6?logo=deepseek&logoColor=white)](https://github.com/deepseek-ai/deepseek-harness)
10
+ [![Node](https://img.shields.io/badge/node-%3E%3D22.19.0-339933?logo=node.js&logoColor=white)](package.json)
8
11
  [![GitHub stars](https://img.shields.io/github/stars/TonyDua/dsh-web-search-exa)](https://github.com/TonyDua/dsh-web-search-exa)
9
12
  [![GitHub issues](https://img.shields.io/github/issues/TonyDua/dsh-web-search-exa)](https://github.com/TonyDua/dsh-web-search-exa)
10
- [![Node](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white)](package.json)
11
- [![dsh](https://img.shields.io/badge/dsh-0.1.2--rc.1-4c6?logo=deepseek&logoColor=white)](https://www.npmjs.com/package/@deepseek-ai/dsh)
12
13
 
13
- > Zero-config [Exa](https://exa.ai) web search for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh):
14
- > **no API key required** — a `WebSearchProvider` for the `ctx.web` seam with an
15
- > anonymous MCP fallback plus a keyed REST path.
14
+ Adds [Exa](https://exa.ai) web search to [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh).
16
15
 
17
- Built with [deepseek-v4-flash](https://api-docs.deepseek.com) inside DeepSeek Harness (dsh).
16
+ ```powershell
17
+ dsh plugin --profile web add @tonydua/dsh-web-search-exa
18
+ ```
18
19
 
19
- ## Supported versions
20
+ Restart `dsh web` and it works. No API key, no config edits, no provider to select.
20
21
 
21
- `@tonydua/dsh-web-search-exa@0.1.4` is tested and supported with:
22
+ Background, for reference only:
22
23
 
23
- - `@deepseek-ai/dsh` `0.1.2-rc.1` (the current npm `latest` release)
24
- - `@deepseek-ai/dsh-web` `0.1.2-rc.1`
25
- - `@deepseek-ai/dsh-settings` `0.1.2-rc.1` (optional; enables live Settings integration)
26
- - `@deepseek-ai/dsh-launch-environment` `0.1.2-rc.1`
27
- - `@deepseek-ai/cordis` `4.0.2`
28
- - Node.js `>=18`
24
+ - **Exa** is a search API. It retrieves pages by keyword or by meaning and returns citable sources with excerpts. It does not generate answers. Exa offers a REST API and also runs an unauthenticated public MCP server.
25
+ - **The official [`dsh-web-search-exa`](https://github.com/deepseek-ai/deepseek-harness/blob/HEAD/packages/web/web-search-exa/README.md)** is dsh's Exa search provider. It uses Exa's REST API and is only useful once you configure an API key.
26
+ - **This package is a modified copy of the official one.** The REST path works the same. What we added is a keyless channel: with no key it uses Exa's public MCP server, and with a key it still uses REST. The anonymous approach follows the oh-my-pi project, see [Acknowledgements](#acknowledgements).
29
27
 
30
- The dsh `0.1.2-rc.1` API is the compatibility baseline. The `0.1.5-alpha.1`
31
- alpha line is not part of this release's tested support matrix.
28
+ You can ignore all of this by default. Read [Selecting a provider](#selecting-a-provider) only if you also run the official package, or if dsh reports an ambiguous provider.
32
29
 
33
- ## Features
30
+ Built with [deepseek-v4-flash](https://api-docs.deepseek.com) inside DeepSeek Harness (dsh).
34
31
 
35
- - 🆓 **Zero-config, keyless by default** — searches route through Exa's hosted MCP
36
- server (`mcp.exa.ai/mcp`) with **no credentials at all** (Exa's documented
37
- unauthenticated public MCP, rate-limited).
38
- - 🔑 **Keyed REST upgrade** — set `EXA_API_KEY` and it automatically switches to
39
- Exa's `POST /search` REST API (higher limits, no behavior change).
40
- - 🔌 **Drop-in provider** — registers into the dsh `ctx.web` seam; the existing
41
- model-facing `web_search` / `web_fetch` tools, prompt sections, and result
42
- cards work unchanged.
43
- - 🎛️ **`providerId` switch** — can coexist with the official
44
- `@deepseek-ai/dsh-web-search-exa` package in one profile (no duplicate-id
45
- collisions, no silent overrides).
46
- - 📦 **npm-publishable** — MIT, ESM, bundled types, `files` limited to `lib/`.
47
-
48
- ## Why this package exists (vs. the official one)
49
-
50
- The DeepSeek Harness ships an official Exa provider,
51
- [`@deepseek-ai/dsh-web-search-exa`](https://www.npmjs.com/package/@deepseek-ai/dsh-web-search-exa).
52
- This package is its **zero-config variant**: it adds the anonymous MCP fallback
53
- the official one does not have, and keeps the same keyed REST behavior.
32
+ ## Features
54
33
 
55
- | | Official `@deepseek-ai/dsh-web-search-exa` | This package `@tonydua/dsh-web-search-exa` |
56
- |---|---|---|
57
- | REST path (`POST /search`) | ✅ only path | ✅ used when a key is configured |
58
- | Requires an API key | ✅ **yes — empty key makes it unavailable** | ❌ no — keyless anonymous MCP fallback |
59
- | Anonymous MCP (`mcp.exa.ai/mcp`) | ❌ not implemented | ✅ default when no key |
60
- | Zero-config install | ❌ | ✅ |
61
- | Provider id | `exa` (fixed) | `exa` by default, **configurable via `providerId`** |
62
- | Cordis plugin name | `web-search-exa` | `web-search-exa` |
63
- | Config keys | `apiKey`, `baseURL`, `searchType`, `numResults`, `highlightsPerResult` | `apiKey`, `apiKeyEnv`, `baseURL`, `apiURL` (legacy), `mcpURL`, `searchType`, `numResults`, `highlightsPerResult`, `providerId` |
34
+ - Works without a key. Searches go through Exa's public MCP server (`mcp.exa.ai/mcp`) and carry no credentials.
35
+ - Returns structured results on that keyless path. It calls `web_search_advanced_exa`, whose output is JSON in the REST field vocabulary, so sources carry real highlight snippets without text parsing.
36
+ - Upgrades itself when you add a key. Setting `EXA_API_KEY` switches to Exa's `POST /search` REST API for higher limits, with no behavior change.
37
+ - Drop-in. It registers into the dsh `ctx.web` seam; the model-facing `web_search` and `web_fetch` tools, their prompt sections, and the result cards all stay as they are.
38
+ - Works out of the box. With no official package installed there is no provider to select.
39
+ - Backs off when it fails. After repeated failures on the anonymous channel the plugin marks itself unavailable so dsh can pick another provider, instead of failing every search. See [What happens when a search fails](#what-happens-when-a-search-fails).
64
40
 
65
- ## Which one should I use?
41
+ ## Installation
66
42
 
67
- - **You have an `EXA_API_KEY` and want the officially maintained package** →
68
- use `@deepseek-ai/dsh-web-search-exa`. It is the canonical implementation.
69
- - **You want to try Exa search with zero setup, no key, no cost commitment** →
70
- use this package. It degrades gracefully: anonymous MCP by default, REST
71
- automatically when a key appears.
72
- - **You want both** → install both and use the `providerId` switch (see
73
- [Coexistence](#coexistence-with-the-official-package)).
43
+ Pick one of three. The choice only decides where the code comes from; all three end up the same.
74
44
 
75
- ## How it works
45
+ **From npm.** v0.1.4 and later ship the `dsh.bundle` manifest, so the bundle patch inserts the provider row and you do not edit any patch by hand.
76
46
 
77
- | Condition | Path | Endpoint |
78
- |---|---|---|
79
- | `apiKey` / `EXA_API_KEY` set | REST `POST /search` with `Authorization: Bearer` | `https://api.exa.ai/search` (`baseURL` configurable) |
80
- | No key configured | Anonymous MCP `tools/call web_search_exa` (JSON-RPC 2.0, no credentials) | `https://mcp.exa.ai/mcp` (configurable) |
47
+ ```powershell
48
+ dsh plugin --profile web add @tonydua/dsh-web-search-exa
49
+ ```
81
50
 
82
- The anonymous MCP path sends no credentials; attribution rides the
83
- `x-exa-source: dsh-anything` header. Results are normalized to the seam's
84
- `WebSearchSource` shape (`url`, `title`, `snippet`, `publishedAt`) and the seam
85
- enforces `maxResults` on the way back. Anonymous usage is rate-limited by Exa:
86
- an HTTP 429 surfaces as a `WEB_PROVIDER_ERROR` with a hint to configure an API
87
- key (which also switches to the REST path automatically).
51
+ **From the GitHub Release.** The same tarball, for when npm is unreachable.
88
52
 
89
- ## Installation (into a dsh profile)
53
+ ```powershell
54
+ dsh plugin --profile web add https://github.com/TonyDua/dsh-web-search-exa/releases/latest/download/dsh-web-search-exa.tgz
55
+ ```
90
56
 
91
- **One command from npm** (v0.1.4+ ships the `dsh.bundle` manifest — the bundle
92
- patch inserts the provider row, so no manual patch editing is needed):
57
+ **From the repository.** Tracks `main`, including work not yet released.
93
58
 
94
59
  ```powershell
95
- dsh plugin --profile web add @tonydua/dsh-web-search-exa
60
+ dsh plugin --profile web add github:TonyDua/dsh-web-search-exa
96
61
  ```
97
62
 
98
- Restart `dsh web`. **Without an API key** the official DeepSeek search
99
- provider is unavailable, so the seam auto-selects this provider — fully
100
- zero-config. **With a key configured**, select Exa explicitly in your own
101
- `$DSH_HOME/profiles/web/cordis.patch.yml` (applied after bundle patches):
63
+ For a local development checkout, use the same command with a path instead of a package name: `dsh plugin --profile web add ../plugins/dsh-web-search-exa`.
102
64
 
103
- ```yaml
104
- - id: web
105
- name: '@deepseek-ai/dsh-web'
106
- config:
107
- searchProvider: exa
108
- ```
65
+ Restart `dsh web` afterwards. That is the whole procedure in most cases.
109
66
 
110
- …or at runtime with the environment variable `$DSH_WEB_SEARCH_PROVIDER=exa`.
67
+ ### Selecting a provider
111
68
 
112
- **Local development checkout:**
69
+ **Skip this section unless you install the official package too.**
113
70
 
114
- ```powershell
115
- dsh plugin --profile web add ../plugins/dsh-web-search-exa
116
- ```
71
+ Before each search, the dsh seam picks an available provider. If exactly one is available it is selected automatically. If more than one is available the seam raises `WEB_PROVIDER_AMBIGUOUS` and asks you to name one. So there are only two cases where you have to act:
72
+
73
+ - **You installed the official package as well.** Both packages register the provider id `exa`, so `dsh web` fails at startup with `WEB_DUPLICATE_PROVIDER`. You must give this package a different id first, see [Coexistence with the official package](#coexistence-with-the-official-package).
74
+ - **You see `WEB_PROVIDER_AMBIGUOUS`.** Another provider is available. Name the one you want.
117
75
 
118
- Then enable the provider and select it. Either merge into
119
- `$DSH_HOME/profiles/web/cordis.patch.yml` (persistent):
76
+ Two ways to name it:
120
77
 
121
78
  ```yaml
122
- - id: web-search-exa
123
- name: '@tonydua/dsh-web-search-exa'
124
- config:
125
- apiKeyEnv: EXA_API_KEY
79
+ # $DSH_HOME/profiles/web/cordis.patch.yml
126
80
  - id: web
127
81
  name: '@deepseek-ai/dsh-web'
128
82
  config:
129
83
  searchProvider: exa
130
84
  ```
131
85
 
132
- Alternatively, select the provider at runtime with the environment variable
133
- `$DSH_WEB_SEARCH_PROVIDER=exa` (no config edit needed).
86
+ Or set `$DSH_WEB_SEARCH_PROVIDER=exa` at runtime.
87
+
88
+ Restart `dsh web` after the change. The model-facing `web_search` tool then uses the selected provider; no tool configuration changes.
134
89
 
135
- Restart `dsh web` for changes to take effect. The existing model-facing
136
- `web_search` tool then routes through this provider — no tool config changes.
90
+ <details>
91
+ <summary>Release artifacts and install warnings (usually not needed)</summary>
137
92
 
138
- ### Runtime singleton compatibility
93
+ **Release artifacts.** CI packs this version's tarball, verifies it against every supported dsh version, attaches it to the GitHub Release, and publishes that same artifact to npm. So the release asset and the npm tarball are one file, not two builds that happen to match.
94
+
95
+ **Profile install warnings.** dsh profiles default to `autoInstallPeers: false`, and the harness's own services are provided at runtime by the dsh host rather than resolved by pnpm. If `dsh plugin add` reports peer warnings, add this to the profile's `pnpm-workspace.yaml`:
96
+
97
+ ```yaml
98
+ peerDependencyRules:
99
+ ignoreMissing:
100
+ - '@deepseek-ai/cordis'
101
+ - '@deepseek-ai/dsh-*'
102
+ ```
139
103
 
140
- `@deepseek-ai/dsh-tools` is a dsh runtime singleton and must resolve to one
141
- physical package instance in a profile. This provider does not depend on it;
142
- the requirement belongs to the host profile. If another third-party plugin
143
- installs `@deepseek-ai/dsh-tools` as a nested regular dependency instead of a
144
- peer dependency, fix that plugin's dependency declaration or make the profile
145
- package manager resolve the shared instance before debugging search errors.
146
- Otherwise dsh's agent loop can fail before the provider is called with an
147
- error such as `Cannot read properties of undefined (reading 'prepare')`.
104
+ </details>
148
105
 
149
106
  ## Configuration
150
107
 
151
108
  | Key | Default | Meaning |
152
109
  |---|---|---|
153
- | `providerId` | `exa` | Provider id registered into `ctx.web`. Only change it when both this and the official package are installed (see next section). |
154
- | `apiKey` | unset | Literal Exa API key. Empty/missing enables the anonymous MCP path. |
155
- | `apiKeyEnv` | `EXA_API_KEY` | Environment variable consulted when no literal `apiKey` is set. |
156
- | `baseURL` | `https://api.exa.ai` | Exa API base URL; `/search` is appended for the keyed REST path. Matches the official dsh provider. |
157
- | `apiURL` | unset | Deprecated full REST endpoint alias. If set, it takes precedence over `baseURL`. |
158
- | `mcpURL` | `https://mcp.exa.ai/mcp` | Exa hosted MCP endpoint (anonymous path). |
159
- | `searchType` | `auto` | REST retrieval mode: `auto` / `keyword` / `neural`. |
160
- | `numResults` | unset | Default result count when the request carries no `maxResults`. |
110
+ | `apiKey` | unset | Literal Exa API key. Empty or missing enables the anonymous MCP path. |
111
+ | `apiKeyEnv` | `EXA_API_KEY` | Environment variable read when no literal `apiKey` is set. |
112
+ | `baseURL` | `https://api.exa.ai` | Exa API base URL. The keyed REST path appends `/search`, matching the official dsh provider. |
113
+ | `apiURL` | unset | Deprecated full REST endpoint alias. Takes precedence over `baseURL` when set. |
114
+ | `mcpURL` | `https://mcp.exa.ai/mcp?tools=web_search_exa,web_search_advanced_exa` | Exa hosted MCP endpoint, used by the anonymous path. The `tools` query is part of the default because the structured tool is not servable without it. Leave it out of your own URL and the plugin adds it for you. |
115
+ | `mcpTool` | `web_search_advanced_exa` | Which MCP tool the anonymous path calls: the structured one, or `web_search_exa` for the older `Title:`-section text blob. See [How it works](#how-it-works). |
116
+ | `searchType` | `auto` | REST retrieval mode: `auto`, `keyword`, or `neural`. Read on the REST path only. |
117
+ | `numResults` | unset | Default result count when a request carries no `maxResults`. |
161
118
  | `highlightsPerResult` | `1` | Highlight sentences requested per result on the REST path. |
119
+ | `providerId` | `exa` | Provider id registered into `ctx.web`. Change it only when this package and the official one are installed together, see [Coexistence with the official package](#coexistence-with-the-official-package). |
120
+
121
+ Where to put the config: edit this plugin's `config` in `$DSH_HOME/profiles/web/cordis.patch.yml`, then restart `dsh web`. The environment variables `EXA_API_KEY` and `$DSH_WEB_SEARCH_PROVIDER` work too. `apiKey` is marked `role('secret')`, so no `describe()` response exposes its value.
122
+
123
+ ### In the Web panel
124
+
125
+ In this version the config lives in the profile patch layer, not the Web UI, and there is no editable form. The Settings UI only renders cards that client plugins register by hand for fixed namespaces (`shell`, `agent-loop`, `web-search-deepseek`); it has no generic form for an arbitrary plugin namespace. The current state:
126
+
127
+ - **Plugin inventory** (Settings → Plugins): a `web-search-exa` entry appears automatically once the plugin is enabled. The inventory reads live entries from the Cordis loader, so no extra code is involved.
128
+ - **Settings namespace** (server side): the plugin registers a `web-search-exa` section through the `ctx.settings.installSection` API, and the data layer accepts writes. But no client card binds to it, so the UI does not show it. The built-in Web search card edits the official `web-search-deepseek` namespace, which is unrelated to this plugin.
129
+ - **Search result cards**: `web_search` calls render the usual `web` result cards through `dsh-tool-web` (sources, excerpts, dates), regardless of provider. Anonymous Exa results look identical to DeepSeek search results.
130
+
131
+ Roadmap: the next version adds a client card registered into the `settings.plugin.item` slot and bound to the `web-search-exa` namespace, so every field in the table above becomes editable in Settings → Plugins.
132
+
133
+ ## How it works
134
+
135
+ | Condition | Path | Endpoint |
136
+ |---|---|---|
137
+ | `apiKey` / `EXA_API_KEY` configured | REST `POST /search` with `Authorization: Bearer` | `https://api.exa.ai/search` (configurable via `baseURL`) |
138
+ | No key configured | Anonymous MCP `tools/call web_search_advanced_exa` (JSON-RPC 2.0, no credentials) | `https://mcp.exa.ai/mcp?tools=…` (configurable) |
139
+
140
+ The anonymous MCP path sends no credentials; attribution rides the `x-exa-source: dsh-anything` header. Results are normalized to the seam's `WebSearchSource` shape (`url`, `title`, `snippet`, `publishedAt`), and the seam enforces `maxResults` on the way back.
141
+
142
+ The anonymous path calls `web_search_advanced_exa` by default. Its text content is a sanitized JSON search response whose entries use the same field names as the REST API, so a result maps to a source directly and no `Title:`-section text parsing is involved. Two consequences worth knowing:
143
+
144
+ - **The structured tool is only served when the URL carries `?tools=…`.** The bare endpoint answers `MCP error -32602: Tool web_search_advanced_exa not found`, which is why that query is part of the default `mcpURL` and why the plugin splices it into any `mcpURL` that lacks it.
145
+ - **It returns whole-page text for every hit, and we ask for highlights separately.** Without `enableHighlights` the endpoint returns text-only entries, every result would lack a snippet, and the search would come back empty. The full text is discarded: a snippet is always a real highlight sentence, never generated and never lifted from the page body.
146
+
147
+ `searchType` is not forwarded here. The plugin's setting uses the REST vocabulary (`auto`, `keyword`, `neural`) while the tool accepts its own (`auto`, `fast`, `instant`), so forwarding it would make a configured `keyword` or `neural` fail argument validation and take the whole anonymous path down. The tool's default is what `auto` asks for anyway.
148
+
149
+ Pinning `mcpTool: web_search_exa` restores the older text-blob path, where the same results arrive as `Title:`-led sections. Use it if Exa changes the structured tool's shape; a body that is not the expected JSON already falls back to section parsing on its own.
150
+
151
+ Because the structured tool returns a whole page of text per hit, a response can be large. Anonymous responses are capped at 256 KiB: the declared `content-length` is checked before the body is read, and a body that keeps growing is aborted mid-transfer. Over-limit responses fail as transient errors rather than being truncated or silently parsed.
152
+
153
+ ### Rate limits
154
+
155
+ The anonymous channel is a public endpoint run by Exa, and it is rate-limited. When you hit the limit the search fails with the code `WEB_RATE_LIMITED` and a message telling you to configure `EXA_API_KEY`. That code is ours, so that you and the model can tell throttling apart from a broken network.
156
+
157
+ With a key configured, searches use the REST path and are not subject to this limit.
158
+
159
+ ### What happens when a search fails
160
+
161
+ **What you will see:**
162
+
163
+ - The anonymous channel is rate-limited: error code `WEB_RATE_LIMITED`, telling you to configure a key.
164
+ - The anonymous channel fails 3 times in a row: this plugin marks itself unavailable for a 5-minute cooldown. During that window `available()` returns `false`.
165
+ - You pinned `searchProvider: exa` and the cooldown is active: the search reports `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.
166
+ - You did not pin `searchProvider` and the cooldown is active: the seam skips this plugin and looks for another provider. With no other provider available it reports `WEB_PROVIDER_UNAVAILABLE`.
167
+ - You configured a key, so searches use REST: none of the above applies, and failures surface as usual.
168
+
169
+ **Why it works this way.** Before each search the seam calls `available()` to decide which provider to use. If this plugin always answered "available", a dead endpoint would make every search fail hard, and what the user sees is a broken dsh. So the plugin adds a circuit breaker: after 3 consecutive transient failures it admits it is temporarily unavailable, giving the seam a chance to choose someone else. That breaker is this plugin's design; Exa has no such mechanism.
170
+
171
+ **How failures are counted.** Only failures that a retry could fix: 5xx, 429, network errors, and unparseable response bodies. Three of them start a 5-minute cooldown, and any successful search clears the count immediately.
172
+
173
+ A 4xx other than 429 does not count. That is a configuration error and would fail identically on every retry, so hiding it behind a cooldown would only delay the same error by 5 minutes.
174
+
175
+ **This trade-off has a cost.** While Exa is down for those 5 minutes, a profile with a pinned `searchProvider: exa` reports an error instead of trying something else. The plugin cannot choose for you:
176
+
177
+ - Pinning `searchProvider: exa`: predictable behavior normally, but no fallback once the breaker opens.
178
+ - Leaving `searchProvider` unset: it can fall back when the breaker opens, at the cost that the seam raises `WEB_PROVIDER_AMBIGUOUS` whenever several providers are usable, and you have to name one.
179
+
180
+ Choose the second if you want fallback, and install only one alternative provider.
181
+
182
+ ## Compared with the official package
183
+
184
+ DeepSeek Harness has an official Exa provider, [`@deepseek-ai/dsh-web-search-exa`](https://www.npmjs.com/package/@deepseek-ai/dsh-web-search-exa), which you install separately; dsh does not include it by default. This package is its zero-config variant: it adds the anonymous MCP fallback the official one lacks and keeps the same REST behavior once you configure a key.
185
+
186
+ | | Official `@deepseek-ai/dsh-web-search-exa` | This package `@tonydua/dsh-web-search-exa` |
187
+ |---|---|---|
188
+ | REST path (`POST /search`) | ✅ the only path | ✅ used when a key is configured |
189
+ | Requires an API key | ✅ yes, an empty key makes it unavailable | ❌ no, with no key it uses the anonymous MCP fallback |
190
+ | Anonymous MCP (`mcp.exa.ai/mcp`) | ❌ not implemented | ✅ the default path with no key |
191
+ | Zero-config install | ❌ | ✅ |
192
+ | Provider id | `exa` (fixed) | `exa` by default, configurable via `providerId` |
193
+ | Cordis plugin name | `web-search-exa` | `web-search-exa` |
194
+ | Config keys | `apiKey`, `baseURL`, `searchType`, `numResults`, `highlightsPerResult` | `apiKey`, `apiKeyEnv`, `baseURL`, `apiURL` (legacy), `mcpURL`, `mcpTool`, `searchType`, `numResults`, `highlightsPerResult`, `providerId` |
195
+
196
+ Which to use:
197
+
198
+ - You have an `EXA_API_KEY` and want the officially maintained package: use the official one, it is the canonical implementation.
199
+ - You want to try Exa search with no configuration, no key, and no cost commitment: use this package. It defaults to the anonymous MCP path and switches to REST once a key appears.
200
+ - You want both: install both and separate them with `providerId`, see the next section.
162
201
 
163
202
  ## Coexistence with the official package
164
203
 
165
- Both packages register their provider under the **same default provider id
166
- (`exa`)** and the same cordis plugin name (`web-search-exa`). The seam rejects
167
- duplicate ids with `WEB_DUPLICATE_PROVIDER`, so **installing both into one
168
- profile without changes breaks at startup**.
204
+ Both packages register the same provider id (`exa`) under `ctx.web`, and both use the cordis plugin name `web-search-exa`. The seam rejects duplicate ids with `WEB_DUPLICATE_PROVIDER`, so installing both into one profile without changing the config fails at startup.
169
205
 
170
- There is **no silent override** — coexistence is explicit, via the `providerId`
171
- switch:
206
+ Coexistence requires explicit configuration through the `providerId` switch:
172
207
 
173
- 1. Keep the official package on `exa` (its id is fixed).
174
- 2. Give this package a distinct id — set `providerId: exa-anon` (any unique
175
- string) in this plugin's `config`.
176
- 3. Select the anonymous variant explicitly with
177
- `searchProvider: exa-anon` on the `web` seam (or
178
- `$DSH_WEB_SEARCH_PROVIDER=exa-anon`), and keep
179
- `searchProvider: exa` → the official one if you want it selectable too.
208
+ 1. The official package keeps `exa`; its id is fixed.
209
+ 2. Give this package a different id. Set `providerId: exa-anon` in this plugin's `config`; any unique string works.
210
+ 3. Name one of them on the `web` seam. Use `searchProvider: exa-anon` for the anonymous variant, or `searchProvider: exa` for the official package. `$DSH_WEB_SEARCH_PROVIDER` works too.
180
211
 
181
212
  ```yaml
182
213
  - insert:
@@ -190,79 +221,100 @@ switch:
190
221
  searchProvider: exa-anon
191
222
  ```
192
223
 
193
- Simplest alternative: install only one of the two packages per profile — the
194
- defaults then work as-is.
195
-
196
- ## In the Web panel
197
-
198
- **Status: configuration is done in the profile patch layer, not the Web UI —
199
- this version ships no editable UI entry.** The Settings UI only renders cards
200
- that are hand-registered by client plugins for fixed namespaces (`shell`,
201
- `agent-loop`, `web-search-deepseek`); it has no generic form for arbitrary
202
- plugin namespaces. What is true today:
203
-
204
- - **Plugin inventory** (Settings → Plugins): the entry appears automatically
205
- as `web-search-exa` (`@tonydua/dsh-web-search-exa`) once enabled — the
206
- inventory reads the live Cordis loader, no extra code needed.
207
- - **Settings namespace** (server-side): the plugin registers the
208
- `web-search-exa` section via the current `ctx.settings.installSection` API, so the data layer is
209
- writable — but **no client card binds to it**, so nothing shows in the UI.
210
- The built-in "Web search" card edits the official
211
- `web-search-deepseek` namespace, not this plugin.
212
- - **Changing configuration today**: edit the plugin's `config` in
213
- `$DSH_HOME/profiles/web/cordis.patch.yml` (fields and defaults in the table
214
- above) and restart `dsh web`; or set `EXA_API_KEY` / `$DSH_WEB_SEARCH_PROVIDER`
215
- as environment variables. The `apiKey` field is `role('secret')`: it never
216
- appears in `describe()` responses.
217
- - **Search result cards**: `web_search` calls render the usual `web` cards
218
- (sources, snippets, dates) through `dsh-tool-web`, independent of the
219
- provider — anonymous Exa results display exactly like DeepSeek ones.
220
-
221
- **Roadmap (next version)**: a client-side card registered into the
222
- `settings.plugin.item` slot bound to the `web-search-exa` namespace, so all
223
- fields above become editable live in Settings → Plugins (mirroring how the
224
- official cards work).
225
-
226
- ## FAQ
227
-
228
- **Q: Do I need an Exa API key?**
229
- No. Without a key the provider uses Exa's free anonymous hosted MCP. With a key
230
- it uses the REST API for higher limits.
231
-
232
- **Q: I got HTTP 429 / rate limited.**
233
- That's Exa's anonymous-MCP rate limit. Configure `EXA_API_KEY` (or the
234
- `apiKey` field) and the provider switches to the REST path automatically.
235
-
236
- **Q: Can I run this alongside the official Exa provider?**
237
- Yes — give this package a distinct `providerId` and select it explicitly
238
- (see [Coexistence](#coexistence-with-the-official-package)).
239
-
240
- **Q: Why don't I see a settings entry in the Web UI?**
241
- This version registers the `web-search-exa` settings namespace server-side
242
- only; a UI card is planned for the next version. Configure through
243
- `cordis.patch.yml` or environment variables for now (see
244
- [In the Web panel](#in-the-web-panel)).
245
-
246
- **Q: Which dsh versions are supported?**
247
- This release supports dsh `0.1.2-rc.1` and its matching `dsh-web`,
248
- `dsh-settings`, and `dsh-launch-environment` packages. The `0.1.5-alpha.1`
249
- line is not tested by this release.
224
+ The simplest alternative is to install only one of the two packages per profile, which works with the default config.
225
+
226
+ ## Troubleshooting
227
+
228
+ **`dsh web` fails at startup with `duplicate loader entry id: web`.** This is a 0.1.2 bug, fixed in 0.1.4, so upgrading the plugin resolves it. If you already run 0.1.4 or later, please open an issue with `dsh --version` and your `cordis.patch.yml`, because a user patch that inserts a `web` row produces the same error.
229
+
230
+ **Startup fails with `Cannot read properties of undefined (reading 'prepare')`.** `@deepseek-ai/dsh-tools` is a dsh runtime singleton and must resolve to one physical package instance per profile. This plugin does not depend on it. The usual cause is another third-party plugin in the profile declaring it as an ordinary nested dependency rather than a peer dependency. Fix that plugin's dependency declaration, or have the profile's package manager resolve one shared instance, and only then investigate search errors.
231
+
232
+ **A search reports `WEB_PROVIDER_AMBIGUOUS`.** More than one provider is available. Name one explicitly as described in [Selecting a provider](#selecting-a-provider).
233
+
234
+ **A search reports `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.** The provider you pinned is currently unavailable. This happens when the keyless channel's breaker is open, see [What happens when a search fails](#what-happens-when-a-search-fails).
235
+
236
+ **There is no settings entry in the Web UI.** This version has no UI card; configure through `cordis.patch.yml` or environment variables, see [In the Web panel](#in-the-web-panel).
237
+
238
+ ## Version compatibility
239
+
240
+ Every published dsh version from `0.1.2-alpha.2` to `0.2.1-alpha.1` has been tested. Testing means three things: installing that version in isolation, typechecking against its own declarations, and installing this plugin with npm under strict peer resolution. The last step is the one that fails most easily, because npm's peer rules are stricter than pnpm's. To reproduce: `bash scripts/compat-matrix.sh`.
241
+
242
+ | dsh line | Tested | Notes |
243
+ |---|---|---|
244
+ | `0.1.2-alpha.2` … `0.1.2-alpha.5` | ✅ | the oldest supported baseline |
245
+ | `0.1.2-rc.1` | ✅ | |
246
+ | `0.1.3-alpha.2` | ✅ | |
247
+ | `0.1.5-alpha.1`, `0.1.5-alpha.2` | ✅ | |
248
+ | `0.1.5-rc.1`, `0.1.5-rc.2`, `0.1.5-rc.3` | ✅ | `0.1.5-rc.2` is also verified end to end: a real `dsh --profile headless` task searched through the anonymous MCP path with no API key |
249
+ | `0.1.6-alpha.1`, `0.1.6-alpha.2` | ✅ | |
250
+ | `0.1.7-alpha.1` | ✅ | the settings service changed shape, see below |
251
+ | `0.2.0-rc.1`, `0.2.0-rc.2` | ✅ | strict npm install beside the host, then a live keyless search |
252
+ | `0.2.1-alpha.1` | ✅ | same, and the only version that needs `@deepseek-ai/cordis@4.0.5-alpha.1` |
253
+
254
+ Versions from the `0.2.0-rc.1` line onward are also declared one by one under `dsh.compatibility.dshReleases` in `package.json`, which is the precise per-version record a catalog needs; a peer range alone is not installable evidence.
255
+
256
+ ### What differs across versions
257
+
258
+ Probing the real export surface of every version, the `ctx.web` seam turns out to be completely stable: `WebError` is always exported from `dsh-web` and extends `HarnessError`, `launchEnvironmentOf` is always present, and `ctx.settings` is mounted in every version. Only two things differ.
259
+
260
+ First, `0.1.7-alpha.1` replaced the settings API. `SettingsProvider.installSection` is gone, and the service became `SettingsForms`, which derives a config page from the Config schema the Loader already holds (`SettingsDescriptor.schema`, `autoGenerate`). Code that called that method unconditionally throws a `TypeError` there: the plugin loads but fails. It now probes for the method, calls it only when present, and does nothing otherwise. On `0.1.7+` the Loader's schema drives the form and the plugin has nothing to register.
261
+
262
+ Second, the `@deepseek-ai/cordis` line moves with dsh, and it moves through pre-releases: `0.1.5`/`0.1.6` peer it at `^4.0.2` (exactly `4.0.2` for `0.1.5-rc.3`), `0.1.7` at `^4.0.3`, `0.2.0` at `~4.0.4`, and `0.2.1-alpha.1` at `~4.0.5-alpha.1`. Install the version the host asks for, and be careful how you pin it: `^4.0.2` resolves to `4.0.4`, which the `0.1.5` releases were not published against, and this plugin then fails to install strictly beside them. The matrix script reads that range and pins its floor as a concrete version. This plugin's own peer range also needed a `>=4.0.5-alpha.1` comparator, without which `0.2.1-alpha.1` would not install at all.
263
+
264
+ Also supported across that whole range: `@deepseek-ai/dsh-web`, `dsh-settings` (optional), and `dsh-launch-environment`. Node.js needs `>=22.19.0`, matching the harness's own floor.
265
+
266
+ <details>
267
+ <summary>Why the peer range looks like that</summary>
268
+
269
+ ```jsonc
270
+ "@deepseek-ai/dsh-web": ">=0.1.2-alpha.2 || >=0.1.3-alpha.2 || >=0.1.4-0 || >=0.1.5-alpha.1 || >=0.1.6-alpha.1 || >=0.1.7-alpha.1 || >=0.1.8 || >=0.2.0-rc.1 || >=0.2.1-alpha.1"
271
+ ```
272
+
273
+ That enumeration is the only form that installs across every published version under both pnpm and npm. The reason is one semver rule:
274
+
275
+ > A prerelease version satisfies a range only if some comparator in that range carries a prerelease on the same `major.minor.patch` triple.
276
+
277
+ So `>=0.1.2-rc.1` does not match `0.1.5-rc.2`; the triples differ. A single open-ended lower bound cannot cover a project published as a series of prereleases, and `*` would also admit a future breaking `1.0`.
278
+
279
+ Two things about the shape are easy to get wrong, and both were:
280
+
281
+ - **`||` here does not widen the range, it picks a lower bound.** Every comparator is an open-ended `>=`, so the whole expression is the union of "at or above X" for each X — which is simply "at or above the highest X". A comparator added for a *lower* release is dead weight: appending `|| >=0.2.0-rc.1` to a range ending in `>=0.1.8` drops `0.1.8` and everything above it up to `0.2.0-rc.1`, because the tuple rule above then has no 0.1.8 comparator to match against. This was caught by testing the range against the real published list rather than by reading it.
282
+ - **A prerelease line needs a comparator on its own tuple.** `0.2.0-rc.2` matches `>=0.2.0-rc.1`, but not `>=0.2.1-alpha.1`. `0.2.1-alpha.1` needs the second entry. The same rule applies to `@deepseek-ai/cordis`, whose own line moved through `4.0.5-alpha.1`: `>=4.0.2` excludes it, so the shipped range is `>=4.0.2 || >=4.0.5-alpha.1`. That one is not cosmetic — without it `npm install` of this plugin beside a `0.2.1-alpha.1` host fails with `ERESOLVE`.
283
+
284
+ Measured against the real published artifacts:
285
+
286
+ | Range | Installs with npm |
287
+ |---|---|
288
+ | `>=0.1.2-rc.1` (the earliest form) | **1** of the 14 releases it was meant to cover |
289
+ | The `0.1.8`-terminated enumeration | **14 / 14** |
290
+ | The current enumeration | **20 / 20** of every published release from `0.1.2-alpha.2` to `0.2.1-alpha.1` |
291
+
292
+ This was measured, not reasoned. The open-ended range is fine on pnpm, which is what `dsh plugin add` uses. On npm it made 13 of the first 14 versions fail with `ERESOLVE`. If you hit that error installing an older release of this plugin with npm, upgrade, or pass `--legacy-peer-deps` temporarily.
293
+
294
+ A range that *resolves* is not the same as a version that was *tested*: the matrix covers one release per line plus any release that changed a seam, which is 20 of these on the resolution side but 17 rows in the table above. `0.1.7-alpha.2`, `0.1.7-rc.1`, and `0.1.7-rc.2` resolve and are expected to work, but only `0.1.7-alpha.1` was run.
295
+
296
+ The plugin's own `dsh.compatibility.dshReleases` map is a separate record and does not affect resolution: it declares, one full version at a time, which dsh releases this build was verified against, for catalogs that require exact per-version evidence instead of a range.
297
+
298
+ </details>
299
+
300
+ ### Building from source
301
+
302
+ ```sh
303
+ pnpm install
304
+ pnpm run build # tsdown -> lib/index.js + lib/index.d.ts
305
+ pnpm run typecheck # tsc --noEmit
306
+ pnpm test # builds, then runs the node:test suite against lib/
307
+ ```
308
+
309
+ `src/` is the only source directory. `lib/` is still committed, because both the npm package and git-based installs consume it.
250
310
 
251
311
  ## Acknowledgements
252
312
 
253
- The anonymous MCP integration follows the `web_search` implementation in
254
- [can1357/oh-my-pi](https://github.com/can1357/oh-my-pi) (`packages/coding-agent/src/web/search/providers/exa.ts`
255
- and `src/exa/mcp-client.ts`) and the
256
- [`@oh-my-pi/exa`](https://www.npmjs.com/package/@oh-my-pi/exa) plugin: same
257
- "REST when a key exists, credential-free `mcp.exa.ai/mcp` otherwise" strategy,
258
- same `x-exa-source` attribution header, same `Title:`-section response parsing.
259
- Thanks to the oh-my-pi (omp) project for pioneering the zero-config Exa
260
- integration.
313
+ The anonymous MCP integration follows the `web_search` implementation in [can1357/oh-my-pi](https://github.com/can1357/oh-my-pi) (`packages/coding-agent/src/web/search/providers/exa.ts` and `src/exa/mcp-client.ts`) and the [`@oh-my-pi/exa`](https://www.npmjs.com/package/@oh-my-pi/exa) plugin: the same "REST when a key exists, credential-free `mcp.exa.ai/mcp` otherwise" strategy, the same `x-exa-source` attribution header, and the same `Title:`-section response parsing. Thanks to the oh-my-pi (omp) project for building the zero-config Exa integration first.
314
+
315
+ Thanks also to **[Exa](https://exa.ai)** for providing and operating the free, unauthenticated hosted MCP server (`mcp.exa.ai/mcp`) that makes this package's zero-config default possible. Exa's hosted MCP is an official Exa product, and anonymous usage is rate-limited, see [Rate limits](#rate-limits).
261
316
 
262
- Thanks also to **[Exa](https://exa.ai)** for providing and operating the
263
- **free, unauthenticated hosted MCP server** (`mcp.exa.ai/mcp`) that makes this
264
- package's zero-config default possible. Exa's hosted MCP is an official Exa
265
- product; anonymous usage is rate-limited (see FAQ).
317
+ Thanks to **[@kahlos](https://github.com/kahlos)** ([PR #1](https://github.com/TonyDua/dsh-web-search-exa/pull/1)), who found that `web_search_advanced_exa` returns a sanitized structured response and that the endpoint does not serve it without a `?tools=` query. Neither is documented; both were established by measurement. The anonymous path now uses that tool by default, and the older `Title:`-section path remains as the fallback.
266
318
 
267
319
  ## Changelog
268
320
 
@@ -270,4 +322,4 @@ See [CHANGELOG.md](CHANGELOG.md) for all notable changes.
270
322
 
271
323
  ## License
272
324
 
273
- MIT — see [LICENSE](LICENSE).
325
+ MIT, see [LICENSE](LICENSE).