deepseek-web-retrieval 0.7.0 → 0.8.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/CHANGELOG.md +11 -0
- package/README.md +92 -101
- package/dist/cli.js +255 -18
- package/docs/agents/claude-code.md +273 -0
- package/docs/agents/codex.md +2 -0
- package/docs/agents/opencode-v2.md +2 -0
- package/docs/agents/pi.md +2 -0
- package/docs/configuration.md +109 -0
- package/docs/design/installer-design.md +16 -13
- package/docs/hosts.jsonc +5 -1
- package/docs/integration.md +9 -6
- package/docs/research/control-matrix.md +34 -9
- package/docs/research/mcp-compatibility.md +2 -2
- package/package.json +1 -1
- package/src/core/env.ts +9 -6
- package/src/installer/hosts/claude-code.ts +325 -0
- package/src/installer/hosts/codex.ts +4 -1
- package/src/installer/hosts/index.ts +3 -0
- package/src/installer/hosts/pi.ts +24 -3
- package/src/installer/state.ts +1 -1
- package/src/installer/types.ts +1 -1
- package/src/installer/uninstall.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here, one sentence per item.
|
|
4
4
|
|
|
5
|
+
## 0.8.0
|
|
6
|
+
|
|
7
|
+
- Add Claude Code as a supported host: an MCP-only integration registered in `.mcp.json` (project scope) or `~/.claude.json` (user scope), with a full installer host module (plan/apply/uninstall, both scopes), a `docs/agents/claude-code.md` guide, a version probe with drift note, and managed-policy detection that reports a `managed-settings.json` layer outranking the install.
|
|
8
|
+
- Route Claude Code tiers through its own settings files: forced capabilities deny the built-in `WebSearch`/`WebFetch` via `permissions.deny` in `.claude/settings.json` or `~/.claude/settings.json` (merged with the user's entries), off capabilities deny the full `mcp__deepseek__*` tool ids, and preferred writes a rules block into `CLAUDE.md`; web-capable competitor servers are excluded under forced via server-level `mcp__<server>` deny rules instead of refusing the tier.
|
|
9
|
+
- Add a billed `claude-code` Docker e2e scenario that runs headless `claude -p` prompts with DeepSeek as the LLM over its Anthropic-compatible endpoint (single key for both legs) and asserts the deny-based kill switch keeps the built-in tools out of the session, plus installer/reinit coverage of the new host in the keyless scenarios.
|
|
10
|
+
- Guard Pi's global config files with the shared-file ownership sidecar, and release claims before deleting the install record on uninstall, so two installs under different config homes can no longer claim the same `~/.pi/agent` file.
|
|
11
|
+
- Run the Codex and Claude Code version probes through a shell so Windows npm `.cmd` shims launch and the drift check no longer silently skips on Windows.
|
|
12
|
+
- Correct the research attribution for Claude Code's MCP `2026-07-28` default negotiation (v2 runtime from 2.1.274+, changelog bullet at 2.1.299 — not 2.1.296).
|
|
13
|
+
- Restructure the README around a quickstart and a defaults table, moving the full configuration reference (knob classes, the complete file-key ↔ `DEEPSEEK_*` mapping, special semantics) to a new docs/configuration.md guide.
|
|
14
|
+
- Generate the configuration guide's knob table from the config vocabulary itself (`bun run docs:matrix` regenerates it, `--check` fails CI on drift), so the documented key ↔ variable ↔ default mapping can no longer hand-drift from the code.
|
|
15
|
+
|
|
5
16
|
## 0.7.0
|
|
6
17
|
|
|
7
18
|
- Layer a shared config file (`$XDG_CONFIG_HOME/deepseek-web-retrieval/config.json`, camelCase keys) under the environment on every host, with the precedence `built-in defaults < shared file < DEEPSEEK_* environment < host-native config`; unknown and host-integration keys are warned about and ignored, and the API key stays out of the file.
|
package/README.md
CHANGED
|
@@ -1,33 +1,52 @@
|
|
|
1
1
|
# DeepSeek Web Retrieval
|
|
2
2
|
|
|
3
|
-
**DeepSeek Search and Fetch for OpenCode, Pi, and
|
|
3
|
+
**DeepSeek Search and Fetch for OpenCode, Pi, Codex, and Claude Code.**
|
|
4
4
|
|
|
5
5
|
Search the web and fetch pages as Markdown through
|
|
6
6
|
[DeepSeek's APIs](https://api-docs.deepseek.com/guides/search), using a **native OpenCode
|
|
7
|
-
plugin**, a **native Pi extension**, or **MCP for Codex**. All
|
|
8
|
-
core, with results formatted for each host.
|
|
7
|
+
plugin**, a **native Pi extension**, or **MCP for Codex and Claude Code**. All four share
|
|
8
|
+
the same retrieval core, with results formatted for each host.
|
|
9
9
|
|
|
10
10
|
This is an unofficial community project, not affiliated with DeepSeek or the supported
|
|
11
11
|
host projects.
|
|
12
12
|
|
|
13
|
+
Jump to: [Features](#features) · [Quickstart](#quickstart) · [Usage](#usage) ·
|
|
14
|
+
[General behavior](#general-behavior) · [Configuration](#configuration) ·
|
|
15
|
+
[Development](#development)
|
|
16
|
+
|
|
13
17
|
## Features
|
|
14
18
|
|
|
15
|
-
- **One package,
|
|
16
|
-
and a stdio MCP server for Codex, all sharing one retrieval core
|
|
19
|
+
- **One package, four hosts** — a native OpenCode v2 plugin, a native Pi extension,
|
|
20
|
+
and a stdio MCP server for Codex and Claude Code, all sharing one retrieval core
|
|
17
21
|
- **Routing control per tool** — search and fetch are set independently to optional,
|
|
18
22
|
preferred, forced, or off; the tier table in Usage explains each
|
|
19
23
|
- **Review before anything is written** — `init` prints the full plan and writes only
|
|
20
24
|
with `--apply`; uninstall restores from snapshots while preserving edits you made
|
|
21
25
|
afterwards
|
|
22
26
|
- **Knows the host's web landscape** — detects conflicting web tools and rules,
|
|
23
|
-
configures Pi's MCP fallback for direct tool exposure, and reports Codex
|
|
24
|
-
drift
|
|
27
|
+
configures Pi's MCP fallback for direct tool exposure, and reports Codex and
|
|
28
|
+
Claude Code version drift
|
|
25
29
|
- **Your key never enters a config file** — installs reference the environment
|
|
26
30
|
(`${DEEPSEEK_API_KEY}` indirection or `env_vars`), so a project-scope install
|
|
27
31
|
commits clean
|
|
28
32
|
- **Fails loudly, never switches silently** — no fallback to another provider, and
|
|
29
33
|
localhost/private URLs are blocked before a request leaves the machine
|
|
30
34
|
|
|
35
|
+
## Quickstart
|
|
36
|
+
|
|
37
|
+
Requires Node.js 20+ and npm, plus a DeepSeek API key with Search and Fetch access
|
|
38
|
+
(retrieval is billed per successful request; the account needs balance).
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
export DEEPSEEK_API_KEY=sk-...
|
|
42
|
+
# Preview the plan for your host — nothing is written yet:
|
|
43
|
+
npx deepseek-web-retrieval init --host opencode --scope project --search forced --fetch preferred
|
|
44
|
+
# Re-run with --apply to write it:
|
|
45
|
+
npx deepseek-web-retrieval init --host opencode --scope project --search forced --fetch preferred --apply
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For Pi, Codex, or Claude Code, other scopes, or finer routing control, see [Usage](#usage).
|
|
49
|
+
|
|
31
50
|
## Usage
|
|
32
51
|
|
|
33
52
|
Choose your host:
|
|
@@ -37,23 +56,11 @@ Choose your host:
|
|
|
37
56
|
| OpenCode v2 | Native plugin: search provider and Fetch tools | [OpenCode guide](docs/agents/opencode-v2.md) |
|
|
38
57
|
| Pi | Native extension: Search and Fetch tools; MCP also available | [Pi guide](docs/agents/pi.md) |
|
|
39
58
|
| Codex | MCP server over stdio, with readable text results | [Codex guide](docs/agents/codex.md) |
|
|
59
|
+
| Claude Code | MCP server over stdio in `.mcp.json` or `~/.claude.json` | [Claude Code guide](docs/agents/claude-code.md) |
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Run the command for your host to preview a configuration:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
# OpenCode: select DeepSeek as the search provider and prefer its Fetch tool.
|
|
49
|
-
npx deepseek-web-retrieval init --host opencode --scope project --search forced --fetch preferred
|
|
50
|
-
|
|
51
|
-
# Pi: use the native extension and prefer both tools.
|
|
52
|
-
npx deepseek-web-retrieval init --host pi --scope project --search preferred --fetch preferred
|
|
53
|
-
|
|
54
|
-
# Codex: register the MCP server and prefer both tools.
|
|
55
|
-
npx deepseek-web-retrieval init --host codex --scope global --search preferred --fetch preferred
|
|
56
|
-
```
|
|
61
|
+
Set `DEEPSEEK_API_KEY` in the environment that launches your host; OpenCode can also
|
|
62
|
+
use its stored DeepSeek key. Run `init` for your host to preview a configuration — the
|
|
63
|
+
command shape is the quickstart's; each host guide shows its recommended tiers.
|
|
57
64
|
|
|
58
65
|
`--search` and `--fetch` each pick a tier — how strongly the host steers toward the
|
|
59
66
|
DeepSeek tool, chosen independently per capability:
|
|
@@ -89,19 +96,19 @@ Plan only — re-run with --apply to write these changes.
|
|
|
89
96
|
|
|
90
97
|
Repeat your chosen command with `--apply` to write the plan. The host guides explain
|
|
91
98
|
activation steps and per-host tier limits. Pi defaults to the extension path; add
|
|
92
|
-
`--path mcp` to use its MCP fallback.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
`--path mcp` to use its MCP fallback.
|
|
100
|
+
|
|
101
|
+
Add `--pin` to register the exact version of the CLI you are running
|
|
102
|
+
(`deepseek-web-retrieval@<version>`) instead of the unpinned name, so hosts keep
|
|
103
|
+
resolving that release rather than every latest publish. The trade-off is no
|
|
104
|
+
auto-updates: re-run `init --pin` from a newer CLI to move the pin.
|
|
96
105
|
|
|
97
106
|
Other stdio MCP hosts may use the server, but the supported setup guides and installer
|
|
98
|
-
currently cover the
|
|
99
|
-
for tested versions and the [control tiers](docs/research/control-matrix.md) for
|
|
100
|
-
limits. For an existing installation, follow the
|
|
107
|
+
currently cover the four hosts above. See the [integration model](docs/integration.md)
|
|
108
|
+
for tested versions and the [control tiers](docs/research/control-matrix.md) for
|
|
109
|
+
routing limits. For an existing installation, follow the
|
|
101
110
|
[upgrade instructions](docs/integration.md#upgrading-existing-installs).
|
|
102
111
|
|
|
103
|
-
For shared search, fetch, retry, and privacy behavior, see below.
|
|
104
|
-
|
|
105
112
|
## General behavior
|
|
106
113
|
|
|
107
114
|
What this adapter layer adds on top of the
|
|
@@ -109,50 +116,55 @@ What this adapter layer adds on top of the
|
|
|
109
116
|
own capabilities (Markdown-only output, no JavaScript rendering, no private networks or
|
|
110
117
|
binary files, per-request billing) are documented there.
|
|
111
118
|
|
|
119
|
+
| Default | Value | Knob |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| Results per search | 10 | `count` |
|
|
122
|
+
| Fetch output cap | 16,000 characters | `fetchMaxChars` |
|
|
123
|
+
| Search summary cap | 1,200 characters | `maxSummaryChars` |
|
|
124
|
+
| Request timeout, body read included | 30 s | `searchTimeoutMs` / `fetchTimeoutMs` |
|
|
125
|
+
| Transient retries | 2 (range 0–5) | `maxRetries` |
|
|
126
|
+
|
|
112
127
|
### Search
|
|
113
128
|
|
|
114
|
-
- Requests summaries only (`need_content: false`,
|
|
115
|
-
full page content never enters the results.
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
- Optional `rerank_score` and `authority` thresholds are off by default — the default
|
|
119
|
-
returns exactly what DeepSeek ranked, including results without a score. A positive
|
|
120
|
-
`rerank_score` threshold drops results below it and results without a score; a positive
|
|
121
|
-
`authority` threshold drops known authorities below it, while results with an unknown
|
|
122
|
-
authority stay unless `allowUnknownAuthority` is set to false.
|
|
123
|
-
- Builds `blockedDomains`, `includeDomains`, and `language` into query operators and
|
|
129
|
+
- Requests summaries only (`need_content: false`, falling back from `summary` to
|
|
130
|
+
`snippet`); full page content never enters the results.
|
|
131
|
+
- Deduplicates URLs; an empty result set is normal, not an error.
|
|
132
|
+
- Builds `blockedDomains`, `includeDomains`, and `language` into query operators, and
|
|
124
133
|
rejects the final query locally when it exceeds the API's 128-character limit.
|
|
134
|
+
- Optional `rerank_score` and `authority` thresholds are off by default — the default
|
|
135
|
+
returns exactly what DeepSeek ranked. A positive threshold drops results below it.
|
|
136
|
+
A missing `rerank_score` is dropped too; an unknown `authority` stays unless
|
|
137
|
+
`allowUnknownAuthority` is set to false.
|
|
125
138
|
- On the paths where this package defines the search tool's inputs (the MCP server and
|
|
126
|
-
the Pi extension), the tool accepts an optional `original_question
|
|
127
|
-
question in their own words
|
|
128
|
-
truncated to
|
|
129
|
-
|
|
130
|
-
- An empty result set is normal and is not an error.
|
|
139
|
+
the Pi extension), the tool accepts an optional `original_question`: the user's
|
|
140
|
+
question in their own words. It is forwarded as DeepSeek's `ori_question`, trimmed
|
|
141
|
+
and truncated to 128 characters; on the Pi extension, a blank input falls back to the
|
|
142
|
+
most recent user message in the session.
|
|
131
143
|
|
|
132
144
|
### Fetch
|
|
133
145
|
|
|
134
|
-
- Output is capped
|
|
135
|
-
|
|
146
|
+
- Output is capped per the table above, title included; a `[content truncated]` marker
|
|
147
|
+
is added when the limit leaves room for it.
|
|
136
148
|
- A page that already opens with its title as a top-level heading does not get a
|
|
137
149
|
duplicate title.
|
|
138
|
-
-
|
|
139
|
-
|
|
150
|
+
- URLs must be absolute `http://` or `https://`, credential-free, and at most 8,192
|
|
151
|
+
characters; responses larger than 5 MiB are rejected before parsing.
|
|
140
152
|
- `format: "text"` and `format: "html"` are rejected rather than misrepresented.
|
|
141
153
|
- Allowed/blocked domain lists and private-host blocking are enforced on the client,
|
|
142
154
|
before a request leaves the machine.
|
|
143
155
|
|
|
144
156
|
### Timeouts and retries
|
|
145
157
|
|
|
146
|
-
Request timeouts include reading the response body. Transient failures are retried
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
158
|
+
Request timeouts include reading the response body. Transient failures are retried per
|
|
159
|
+
the table; retryable responses are 408, 425, 429, and 5xx, and `Retry-After` is honored
|
|
160
|
+
up to 10 seconds. Other failures — including 401, timeouts, and network errors — fail
|
|
161
|
+
without retrying.
|
|
150
162
|
|
|
151
163
|
### No automatic fallback
|
|
152
164
|
|
|
153
|
-
If no API key is available, Search and Fetch fail. If DeepSeek is unavailable, returns
|
|
154
|
-
error, or times out, the request fails. The tool does not silently switch to another
|
|
155
|
-
provider or fetch implementation.
|
|
165
|
+
If no API key is available, Search and Fetch fail. If DeepSeek is unavailable, returns
|
|
166
|
+
an error, or times out, the request fails. The tool does not silently switch to another
|
|
167
|
+
search provider or fetch implementation.
|
|
156
168
|
|
|
157
169
|
### Privacy and cost
|
|
158
170
|
|
|
@@ -163,14 +175,15 @@ see the official docs for pricing and rate limits before enabling a team deploym
|
|
|
163
175
|
## Configuration
|
|
164
176
|
|
|
165
177
|
Every knob resolves through one chain, low → high, identically on every host:
|
|
178
|
+
|
|
166
179
|
`built-in defaults < shared config file < DEEPSEEK_* environment < host-native config`
|
|
167
|
-
— a higher layer always wins, so nothing already configured loses effect.
|
|
168
180
|
|
|
169
|
-
|
|
181
|
+
A higher layer always wins, so nothing already configured loses effect.
|
|
182
|
+
|
|
183
|
+
The shared file works on every host and takes camelCase keys:
|
|
184
|
+
`$XDG_CONFIG_HOME/deepseek-web-retrieval/config.json` — by default
|
|
170
185
|
`~/.config/deepseek-web-retrieval/config.json` on Linux and macOS and
|
|
171
|
-
`%APPDATA%\deepseek-web-retrieval\config.json` on Windows
|
|
172
|
-
`XDG_CONFIG_HOME` still wins there) — works on every host and uses the
|
|
173
|
-
camelCase option keys:
|
|
186
|
+
`%APPDATA%\deepseek-web-retrieval\config.json` on Windows.
|
|
174
187
|
|
|
175
188
|
```json
|
|
176
189
|
{
|
|
@@ -181,44 +194,23 @@ camelCase option keys:
|
|
|
181
194
|
}
|
|
182
195
|
```
|
|
183
196
|
|
|
184
|
-
Unknown keys and host-integration keys are warned about on stderr and ignored. The
|
|
185
|
-
|
|
186
|
-
|
|
197
|
+
Unknown keys and host-integration keys are warned about on stderr and ignored. The API
|
|
198
|
+
key does not go in the file — it keeps its existing channels (`DEEPSEEK_API_KEY` in the
|
|
199
|
+
environment, or OpenCode's stored credential).
|
|
187
200
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
| Host integration — the host's tool landscape | rejected — warned about and ignored | `searchEnabled`, `setDefaultWebsearch`, `apiKeySource` |
|
|
195
|
-
|
|
196
|
-
The same knob has two names — the camelCase key for the shared file and OpenCode's
|
|
197
|
-
options, the `DEEPSEEK_*` variable for the environment:
|
|
198
|
-
|
|
199
|
-
| Shared file / OpenCode options | Environment |
|
|
200
|
-
| --- | --- |
|
|
201
|
-
| `count` | `DEEPSEEK_SEARCH_COUNT` |
|
|
202
|
-
| `blockedDomains` | `DEEPSEEK_SEARCH_BLOCKED_DOMAINS` |
|
|
203
|
-
| `language` | `DEEPSEEK_SEARCH_LANGUAGE` |
|
|
204
|
-
| `searchLocalization` | `DEEPSEEK_SEARCH_LOCALIZATION` |
|
|
205
|
-
| `fetchMaxChars` | `DEEPSEEK_FETCH_MAX_CHARS` |
|
|
206
|
-
| `maxRetries` | `DEEPSEEK_MAX_RETRIES` |
|
|
207
|
-
|
|
208
|
-
The full per-knob mapping is documented side by side in each guide's option table;
|
|
209
|
-
per-host mechanics — how the environment reaches a stdio server, each host's output
|
|
210
|
-
caps and deadlines — live there too: [Codex](docs/agents/codex.md),
|
|
211
|
-
[Pi](docs/agents/pi.md), [OpenCode](docs/agents/opencode-v2.md). Keep
|
|
212
|
-
host-independent intent in the shared file; prefer a host layer when a
|
|
213
|
-
host-sensitive knob would cross its host's cap or deadline.
|
|
201
|
+
Which layer to set for a knob, the full file-key ↔ `DEEPSEEK_*` mapping, per-knob
|
|
202
|
+
defaults, and special semantics live in the [configuration guide](docs/configuration.md).
|
|
203
|
+
Per-host mechanics — how the environment reaches a stdio server, each host's output caps
|
|
204
|
+
and deadlines — live in the host guides: [Codex](docs/agents/codex.md),
|
|
205
|
+
[Claude Code](docs/agents/claude-code.md),
|
|
206
|
+
[Pi](docs/agents/pi.md), [OpenCode](docs/agents/opencode-v2.md).
|
|
214
207
|
|
|
215
208
|
To see what actually resolves, run `npx deepseek-web-retrieval config`: every knob
|
|
216
|
-
printed with its value and its source (`default`, `file`, or `env`)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
and network end to end.
|
|
209
|
+
printed with its value and its source (`default`, `file`, or `env`). Problems in the
|
|
210
|
+
file or in `DEEPSEEK_*` variables are replayed as visible warnings, and it exits 1 when
|
|
211
|
+
there are any — so it doubles as a dotfile CI check. `npx deepseek-web-retrieval config
|
|
212
|
+
--search "<query>"` runs one billed search through the effective configuration to verify
|
|
213
|
+
the key, config, and network end to end.
|
|
222
214
|
|
|
223
215
|
## Development
|
|
224
216
|
|
|
@@ -231,10 +223,9 @@ Use `bun run lint:fix` to apply Biome's safe lint fixes and formatting. See
|
|
|
231
223
|
[CONTRIBUTING.md](CONTRIBUTING.md) for development checks, e2e scenarios, and
|
|
232
224
|
[automated tag releases](CONTRIBUTING.md#automated-releases).
|
|
233
225
|
|
|
234
|
-
The test suite mocks the DeepSeek
|
|
235
|
-
MCP server with SDK clients pinned to each supported protocol revision. Real API calls
|
|
226
|
+
The test suite mocks the DeepSeek API and the OpenCode and Pi host APIs; real API calls
|
|
236
227
|
require a funded DeepSeek account. Shared retrieval logic lives in `src/core/`; adapters
|
|
237
|
-
live in `src/<agent>/` (the cross-host MCP server lives in `src/mcp/`)
|
|
228
|
+
live in `src/<agent>/` (the cross-host MCP server lives in `src/mcp/`), with adapter docs
|
|
238
229
|
in `docs/agents/<agent>.md`.
|
|
239
230
|
|
|
240
231
|
## Prior art
|