deepseek-web-retrieval 0.0.0-stage → 0.3.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 +241 -0
- package/LICENSE +21 -0
- package/README.md +100 -2
- package/dist/cli.js +4915 -0
- package/docs/adr/0001-refuse-drift-between-plan-and-apply.md +29 -0
- package/docs/agents/codex.md +193 -0
- package/docs/agents/domain.md +51 -0
- package/docs/agents/issue-tracker.md +45 -0
- package/docs/agents/opencode-v2.md +269 -0
- package/docs/agents/pi.md +209 -0
- package/docs/agents/triage-labels.md +15 -0
- package/docs/design/installer-design.md +184 -0
- package/docs/hosts.jsonc +155 -0
- package/docs/integration.md +152 -0
- package/docs/research/control-matrix.md +257 -0
- package/docs/research/mcp-compatibility.md +183 -0
- package/examples/opencode.global.jsonc +25 -0
- package/examples/opencode.project.jsonc +24 -0
- package/examples/pi.mcp.jsonc +18 -0
- package/index.ts +2 -0
- package/package.json +69 -4
- package/src/core/auth.ts +8 -0
- package/src/core/client.ts +129 -0
- package/src/core/constants.ts +30 -0
- package/src/core/descriptions.ts +19 -0
- package/src/core/domains.ts +153 -0
- package/src/core/format.ts +127 -0
- package/src/core/index.ts +9 -0
- package/src/core/jsonc.ts +16 -0
- package/src/core/options.ts +108 -0
- package/src/core/search.ts +84 -0
- package/src/core/transport.ts +253 -0
- package/src/core/types.ts +85 -0
- package/src/core/url.ts +42 -0
- package/src/installer/apply.ts +176 -0
- package/src/installer/cli.ts +215 -0
- package/src/installer/detect.ts +85 -0
- package/src/installer/formats/index.ts +58 -0
- package/src/installer/formats/json.ts +151 -0
- package/src/installer/formats/rules.ts +62 -0
- package/src/installer/formats/toml.ts +163 -0
- package/src/installer/formats/value.ts +57 -0
- package/src/installer/hosts/codex.ts +128 -0
- package/src/installer/hosts/index.ts +134 -0
- package/src/installer/hosts/opencode.ts +118 -0
- package/src/installer/hosts/pi.ts +115 -0
- package/src/installer/hosts/shared.ts +31 -0
- package/src/installer/paths.ts +18 -0
- package/src/installer/render.ts +62 -0
- package/src/installer/revert.ts +61 -0
- package/src/installer/rulesContent.ts +32 -0
- package/src/installer/state.ts +63 -0
- package/src/installer/types.ts +126 -0
- package/src/installer/uninstall.ts +33 -0
- package/src/mcp/auth.ts +13 -0
- package/src/mcp/cli.ts +39 -0
- package/src/mcp/config.ts +124 -0
- package/src/mcp/server.ts +155 -0
- package/src/opencode/auth.ts +70 -0
- package/src/opencode/plugin.ts +187 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
## 0.3.0
|
|
6
|
+
|
|
7
|
+
- Close the lifecycle gaps in the keyless e2e coverage with a `reinit` scenario: tier
|
|
8
|
+
downgrades revert orphaned artifacts through the real CLI (the Codex kill switch
|
|
9
|
+
restored inside the still-claimed config with the registration kept and the plan's
|
|
10
|
+
reverts section visible; the Pi preferred → optional downgrade deletes the orphaned,
|
|
11
|
+
installer-created rules file whole), a second Codex scope claiming the same config
|
|
12
|
+
file is refused with uninstall guidance, `list` reports the recorded installs, and
|
|
13
|
+
`XDG_CONFIG_HOME` routes the global config home with uninstall finding the record
|
|
14
|
+
there. The Codex project scope and OpenCode global scope path mappings are exercised
|
|
15
|
+
for the first time
|
|
16
|
+
- Refuse drift between plan and apply (ADR-0001): apply now re-verifies that the value
|
|
17
|
+
at every set-op path still equals what the plan previewed, and refuses with re-run
|
|
18
|
+
guidance when the config changed since the plan was rendered — the preview, the secret
|
|
19
|
+
guard, and the install record describe one snapshot taken once at plan time, and an
|
|
20
|
+
interim user edit can never be silently overwritten. A file that stopped parsing in
|
|
21
|
+
that window refuses the same way
|
|
22
|
+
- Deepen the modules the installer and adapters are built on, behavior-preserving
|
|
23
|
+
except where noted: revert and the cross-scope collision invariant each get exactly
|
|
24
|
+
one owner (a whole-file orphan revert now deletes a created file it leaves empty,
|
|
25
|
+
matching uninstall's semantics; partial orphan reverts never delete a still-claimed
|
|
26
|
+
file); the three config formats — comment-preserving JSONC, comment-lossy TOML, and
|
|
27
|
+
the host-marked rules block — sit behind one codec registry, with a plan's file edits
|
|
28
|
+
as a discriminated union instead of optional-field smuggling; each host module owns
|
|
29
|
+
its per-scope paths, tool ids, and shared plan header, the CLI roster derives from
|
|
30
|
+
the planner registry, and `docs/hosts.jsonc` records which hosts have installer
|
|
31
|
+
modules with test guards holding both in sync; the DeepSeek HTTP transport moves
|
|
32
|
+
behind its own seam with an injectable fetch, the per-call timeout becomes part of
|
|
33
|
+
the request context (the shorter of it and the configured timeout wins, for search
|
|
34
|
+
as well as fetch), and the OpenCode adapter stops rebuilding resolved options; the
|
|
35
|
+
core returns a host-neutral search result, owns the capability-fact description
|
|
36
|
+
fragments both adapters compose from, and resolves OpenCode's registration knobs
|
|
37
|
+
inside the OpenCode adapter where they are consumed; the `DEEPSEEK_*` environment
|
|
38
|
+
variable names have a single source in the core constants
|
|
39
|
+
- Make the installer CLI edge testable and explicit: command output is injectable,
|
|
40
|
+
input validation returns a discriminated result instead of smuggling exit codes as
|
|
41
|
+
numbers, and the config home is an explicit input with the XDG comparison resolved
|
|
42
|
+
once at the entry (behavior unchanged)
|
|
43
|
+
- Track the project's domain documentation: `CONTEXT.md` (the glossary hosts, adapters,
|
|
44
|
+
tiers, plans, records, reverts, codecs are written in) and `docs/adr/` now live in
|
|
45
|
+
the repository, alongside the `docs/agents/` agent-skills configuration (GitHub
|
|
46
|
+
Issues as the tracker, default triage labels, single-context domain docs)
|
|
47
|
+
- Enforce the forced tier's exclusivity promise and complete the detect phase: other
|
|
48
|
+
registered MCP servers are now classified web-capable from their name plus
|
|
49
|
+
command/args/url (a heuristic the plan notes state openly). Under a forced tier, Pi
|
|
50
|
+
disables the web-capable ones via their per-server `enabled` key with the prior value
|
|
51
|
+
snapshotted for uninstall, while Codex — which has no per-server kill switch — refuses
|
|
52
|
+
the tier with guidance instead of promising non-exclusive routing (OpenCode's forced is
|
|
53
|
+
replacement, which no third-party server overrides). The target rules file is scanned
|
|
54
|
+
for steering toward other web tools (the installer's own marked block excluded) and the
|
|
55
|
+
conflict is reported, not resolved; every forced-tier plan names the README's "Privacy
|
|
56
|
+
and cost" section; the both-off error and the stay-registered/replacement notes become
|
|
57
|
+
shared strings instead of per-planner copies
|
|
58
|
+
- Refuse cross-scope installs that would claim one config file: Codex's project-scope
|
|
59
|
+
fallback writes the user-level `~/.codex/config.toml`, so a project install beside a
|
|
60
|
+
global one left both scopes' records claiming `mcp_servers.deepseek` in that file, and
|
|
61
|
+
whichever uninstalled first reverted the other's registration. The plan now refuses a
|
|
62
|
+
second scope whose edits overlap the other scope's recorded files (pointing at the
|
|
63
|
+
uninstall command to run instead), and uninstall runs the same check defensively for
|
|
64
|
+
records that predate the guard. Pi and OpenCode scope pairs map to disjoint files and
|
|
65
|
+
install side by side as before
|
|
66
|
+
- Split installer config editing into `configFile` (JSONC text editing) and
|
|
67
|
+
`configValue` (the parsed-object model), unifying the duplicated path walkers,
|
|
68
|
+
append-array dedupe, created-parents pruning, and the isPlainObject guard along the
|
|
69
|
+
way (no behavior change); add a guard test that every version literal in installer
|
|
70
|
+
prose appears in `docs/hosts.jsonc`, so a version bump without the re-verification
|
|
71
|
+
pass fails tests instead of shipping stale facts in user-facing plan notes
|
|
72
|
+
- Close the remaining high- and medium-value e2e coverage gaps with four new Docker
|
|
73
|
+
scenarios: `installer` (keyless — the installer CLI's own product: init/apply/uninstall
|
|
74
|
+
for all three hosts, verified through the real agents' config readers, including the
|
|
75
|
+
Codex kill-switch write and the OpenCode engine replacement), `pkg` (keyless — the
|
|
76
|
+
`npm pack` tarball installed with npm in the container, its bin executed directly,
|
|
77
|
+
then registered as the Pi server for a real handshake), `capability-off` (keyless —
|
|
78
|
+
`DEEPSEEK_ENABLE_FETCH=false` leaves exactly the search tool, both flags false refuses
|
|
79
|
+
to start, and a registration without `exposure` reports `codemode`), and `preferred`
|
|
80
|
+
(billed — installer product at Pi project scope with preferred tiers, then
|
|
81
|
+
natural-language prompts that name no tool, so only the AGENTS.md rules block can steer
|
|
82
|
+
the model). The harness now accepts multiple scenario names, packs the npm tarball
|
|
83
|
+
before running, gives each scenario an isolated HOME and project dir (cleaned up
|
|
84
|
+
afterwards) while sharing one npm download cache per run, and suggests the keyless
|
|
85
|
+
subset when `DEEPSEEK_API_KEY` is missing
|
|
86
|
+
- Fix the installer's secret guard refusing its own output: a re-init over an existing
|
|
87
|
+
entry whose `DEEPSEEK_API_KEY` is the `${DEEPSEEK_API_KEY}` indirection form was
|
|
88
|
+
rejected as a literal credential. Pure `${VAR}` expansions now pass the guard (found
|
|
89
|
+
by the new installer e2e scenario running after pi-billed in a shared HOME); literal
|
|
90
|
+
keys are still refused
|
|
91
|
+
- Fix the `codex` e2e scenario, which had never actually completed a turn: the slim
|
|
92
|
+
Node base image ships no system CA bundle, so Codex's static-musl TLS stack (rustls,
|
|
93
|
+
unlike Node's bundled store) failed every HTTPS request as an opaque
|
|
94
|
+
"Reconnecting... waiting for network" loop — the Dockerfile now installs
|
|
95
|
+
`ca-certificates`. The scenario config also follows DeepSeek's official Codex
|
|
96
|
+
integration: a vendored `test/e2e/codex-models.json` catalog is written to
|
|
97
|
+
`~/.codex/models.json` and referenced via `model_catalog_json` (without it Codex
|
|
98
|
+
cannot resolve DeepSeek model slugs), with `wire_api = "responses"` and the key
|
|
99
|
+
still forwarded through `env_key`/`env_vars` instead of the official script's
|
|
100
|
+
bearer-token-in-file. The scenario now exercises the `web_search = "disabled"`
|
|
101
|
+
kill switch for real. All four scenarios (pi, pi-billed, opencode, codex) pass in
|
|
102
|
+
Docker with real billed requests
|
|
103
|
+
- Add the billed `pi-billed` e2e scenario, bringing Pi to the same invocation-level
|
|
104
|
+
coverage as the opencode and codex scenarios: headless `pi --print` prompts whose
|
|
105
|
+
LLM is Pi's native DeepSeek provider (`deepseek/deepseek-flash`), so one key pays
|
|
106
|
+
for both legs and the model really calls `deepseek_fetch` / `deepseek_web_search`
|
|
107
|
+
through Pi's own MCP client. The keyless `pi` handshake scenario stays
|
|
108
|
+
- Drop Continue and Gemini from the host matrix — they will not be supported.
|
|
109
|
+
Both generated tables, the per-host reference, the protocol research, the
|
|
110
|
+
installer examples, and the host-count invariants shrink accordingly (the
|
|
111
|
+
MCP-capable host count is now seven)
|
|
112
|
+
- Fix the critical code-review findings on the installer: a tier-change re-init now
|
|
113
|
+
reverts the previous init's artifacts explicitly (shown in the plan, undone on
|
|
114
|
+
apply) instead of orphaning them; the plan renders old values for every set op and
|
|
115
|
+
existing counts for appends; TOML comment-loss detection covers trailing comments
|
|
116
|
+
(string-aware); rules-block markers are per host so pi and codex can share one
|
|
117
|
+
AGENTS.md; install records are written 0600 with `.deepseek-web-retrieval/`
|
|
118
|
+
gitignored; replacing an entry that contains a literal credential-looking key is
|
|
119
|
+
refused instead of snapshotted; the CLI resolves `--cwd`, falls back to
|
|
120
|
+
`os.homedir()`, rejects unknown flags/positionals with targeted messages, and
|
|
121
|
+
apply refuses to clobber non-array/non-object config values before writing
|
|
122
|
+
anything; the e2e runner rejects stale flags (including `--local`) and forwards
|
|
123
|
+
empty env values as empty instead of passing host values through
|
|
124
|
+
- Add the installer CLI (`deepseek-web-retrieval init` / `uninstall` / `list`) for
|
|
125
|
+
OpenCode, Pi, and Codex: plan-then-apply with per-capability tiers (optional /
|
|
126
|
+
preferred / forced / off) and a first-class project/global scope, JSON edits that
|
|
127
|
+
preserve comments (jsonc-parser), TOML support (smol-toml), snapshot-based surgical
|
|
128
|
+
rollback that never clobbers user edits, and detect notes for competitors, other
|
|
129
|
+
registered MCP servers, and Codex's `[tools] web_search` no-op trap
|
|
130
|
+
- Add `DEEPSEEK_ENABLE_SEARCH` / `DEEPSEEK_ENABLE_FETCH` (and the OpenCode
|
|
131
|
+
`searchEnabled` / `fetchEnabled` options) for per-capability control on every host;
|
|
132
|
+
the MCP server refuses to start when both tools are disabled
|
|
133
|
+
- Promote Codex to supported: MCP-server adapter, the `docs/agents/codex.md` guide,
|
|
134
|
+
tier table with the top-level `web_search = "disabled"` kill switch, and
|
|
135
|
+
`env_vars`-based key forwarding that respects Codex's stdio env allowlist
|
|
136
|
+
- Make the e2e suites Docker-only (remove `--local`) and add the billed `codex`
|
|
137
|
+
scenario: headless `codex exec` in an isolated HOME with DeepSeek as the Codex LLM
|
|
138
|
+
over the Responses wire (Codex 0.163.0 dropped `wire_api = "chat"`; DeepSeek serves
|
|
139
|
+
the Responses endpoint), one key paying for both legs
|
|
140
|
+
- Replace the hand-written JSONC stripper with jsonc-parser (now also
|
|
141
|
+
`src/core/jsonc.ts`); drop `scripts/jsonc.ts`
|
|
142
|
+
|
|
143
|
+
- Fix documentation review findings: resolve the Pi `structuredContent` contradiction
|
|
144
|
+
against the v1.3.0 source (content-first, structuredContent as a no-content
|
|
145
|
+
fallback), add the missing `extension` mechanism to the taxonomy and re-path
|
|
146
|
+
OpenCode to its native mechanisms, qualify the Forced tier in the Tiers table
|
|
147
|
+
itself, de-restate version locks and the baseline in CONTRIBUTING/integration,
|
|
148
|
+
replace "planned" with "shipped" for the MCP server, tighten installer rollback
|
|
149
|
+
and forced-unavailable/session-scoped semantics, and dedupe the provenance and
|
|
150
|
+
quirk summaries
|
|
151
|
+
- State the installer principles — never overwrite user configuration without the
|
|
152
|
+
user's knowledge, and post-install behavior and impact scope must be controllable
|
|
153
|
+
and knowable — and specify the detect/merge/verify flow, tier semantics against
|
|
154
|
+
stock configuration, snapshot-based rollback, and a first-class project/global
|
|
155
|
+
scope choice (honor or report, never silently downgrade) in
|
|
156
|
+
`docs/design/installer-design.md`; qualify the control matrix's exclusion flavor as
|
|
157
|
+
relative to built-in competitors only
|
|
158
|
+
- Categorize `docs/`: per-agent guides in `docs/agents/`, research notes in
|
|
159
|
+
`docs/research/`, and design notes in `docs/design/`; the integration hub and
|
|
160
|
+
`docs/hosts.jsonc` stay at the root
|
|
161
|
+
- Add `docs/research/control-matrix.md`: control-tier research (optional / preferred /
|
|
162
|
+
forced, per host and capability) with a consolidated per-host reference — built-in web
|
|
163
|
+
tools and their kill switches, MCP registration, and rules files. The control matrix is
|
|
164
|
+
generated from the new `control` field in `docs/hosts.jsonc` (`bun run docs:matrix`;
|
|
165
|
+
drift fails tests)
|
|
166
|
+
- Correct the Continue host note (the CLI has no built-in `search_web`; it is
|
|
167
|
+
IDE-extension-only) and state the built-in web tools in the Codex, Cursor, Devin, and
|
|
168
|
+
Copilot notes; extend the host-evaluation checklist with the rules and built-in
|
|
169
|
+
kill-switch questions
|
|
170
|
+
- Move install-time tier planning to `docs/design/installer-design.md`, and fold the
|
|
171
|
+
`docs/research/mcp-compatibility.md` per-host setup notes and quirk catalog into the
|
|
172
|
+
control-matrix per-host reference; `integration.md` host notes now link there instead
|
|
173
|
+
of restating details
|
|
174
|
+
- Fix the hosts.jsonc drift guard: the matrix renderer no longer rewrites
|
|
175
|
+
docs/integration.md when imported by tests, and CI and `bun run check` now fail
|
|
176
|
+
on drift (`docs:matrix --check`)
|
|
177
|
+
- Serve both MCP tools end to end at every pinned client revision, not only
|
|
178
|
+
`listTools`
|
|
179
|
+
- Build `dist/cli.js` on demand for the stdio smoke test instead of silently
|
|
180
|
+
skipping it on a fresh checkout
|
|
181
|
+
- Share the fetch pipeline (parse, host policy, fetch, format) between the
|
|
182
|
+
OpenCode and MCP adapters through `fetchDocument` in the core
|
|
183
|
+
- Stop restating host version locks in narrative docs; reference
|
|
184
|
+
`docs/hosts.jsonc` instead
|
|
185
|
+
- Pin the e2e Docker base image (`node:22.23.3-slim`) and correct the 0.2.0
|
|
186
|
+
changelog wording about where e2e versions are pinned
|
|
187
|
+
- Type the `DEEPSEEK_*` environment mapping so option keys and variable names
|
|
188
|
+
cannot drift apart
|
|
189
|
+
|
|
190
|
+
## 0.2.0
|
|
191
|
+
|
|
192
|
+
- Make `docs/hosts.jsonc` the single source of truth for host facts: the
|
|
193
|
+
integration.md host table is generated from it (`bun run docs:matrix`, drift fails
|
|
194
|
+
tests), CI matrices and the e2e Docker build args derive from it, and narrative
|
|
195
|
+
docs reference it instead of restating version locks
|
|
196
|
+
- Add a local-only end-to-end script (`bun run test:e2e`): a keyless real
|
|
197
|
+
`pi mcp list` handshake against the built server, and a headless `opencode run`
|
|
198
|
+
scenario that makes real billed requests; never run in CI. Agents run inside
|
|
199
|
+
Docker with versions injected from `docs/hosts.jsonc` as Docker build args
|
|
200
|
+
(`--local` opts out)
|
|
201
|
+
- Add an MCP server adapter (`src/mcp/`) exposing `deepseek_web_search` and `deepseek_fetch`
|
|
202
|
+
over stdio, serving MCP clients from revision 2024-11-05 through 2026-07-28
|
|
203
|
+
- Support `DEEPSEEK_*` environment variable configuration in the MCP server, mapped onto the
|
|
204
|
+
shared option pipeline
|
|
205
|
+
- Add the Pi guide (`docs/pi.md`) and `examples/pi.mcp.jsonc`; Pi 1.3.0 is the first
|
|
206
|
+
supported MCP host
|
|
207
|
+
- Add `docs/mcp-compatibility.md`, a primary-source review of MCP protocol compatibility
|
|
208
|
+
across the hosts in the support matrix
|
|
209
|
+
- Add a Node build (`dist/cli.js`) with a `deepseek-web-retrieval` bin entry and Node 20+
|
|
210
|
+
engines, alongside the existing Bun workflow
|
|
211
|
+
- Cover the MCP server with SDK client personas pinned to 2024-11-05, 2025-06-18,
|
|
212
|
+
2025-11-25, and 2026-07-28, plus a real stdio smoke test of the built entry
|
|
213
|
+
- Enforce the fetch host policy inside the core client so direct core consumers cannot bypass it
|
|
214
|
+
- Fail fast on a missing API key before the fetch permission prompt, and reject non-string `url` inputs
|
|
215
|
+
- Move OpenCode-specific missing-key guidance out of the agent-agnostic core
|
|
216
|
+
- Document that `maxResults: 0` returns no results
|
|
217
|
+
- Cover response body reads with the request timeout and cancellation signal
|
|
218
|
+
- Reject successful API responses larger than 5 MiB
|
|
219
|
+
- Reject search queries that exceed 128 characters after adding search operators
|
|
220
|
+
- Block IPv4-mapped IPv6 private addresses in the fetch host policy
|
|
221
|
+
- Truncate API error bodies by Unicode code points
|
|
222
|
+
- Move OpenCode-specific setup and usage into `docs/opencode-v2.md`
|
|
223
|
+
- Add `docs/integration.md` with a version-locked host support matrix
|
|
224
|
+
- Calibrate the OpenCode v2 install and uninstall guide against verified behavior:
|
|
225
|
+
plugin hot reload, `plugin add` not selecting the provider, and `plugin remove` leftovers
|
|
226
|
+
|
|
227
|
+
## 0.1.0
|
|
228
|
+
|
|
229
|
+
Initial public-ready release.
|
|
230
|
+
|
|
231
|
+
- DeepSeek Search provider for OpenCode v2 (`websearch.provider = "deepseek"`)
|
|
232
|
+
- `deepseek_fetch` tool backed by DeepSeek Fetch
|
|
233
|
+
- Optional drop-in `webfetch` replacement
|
|
234
|
+
- Reuse of the active DeepSeek credential stored in OpenCode
|
|
235
|
+
- `DEEPSEEK_API_KEY` fallback and `apiKeySource` control
|
|
236
|
+
- Summary-only search with rerank/authority filtering and URL deduplication
|
|
237
|
+
- Markdown-only fetch with a configurable character cap
|
|
238
|
+
- Domain allow/deny lists and private-host blocking
|
|
239
|
+
- Bounded retries for 408, 425, 429, and 5xx responses with `Retry-After`
|
|
240
|
+
- Unicode-safe truncation and secret redaction in errors
|
|
241
|
+
- Unit tests and CI
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 deepseek-web-retrieval contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DeepSeek Web Retrieval
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Bringing [DeepSeek's in-house Search and Fetch APIs](https://api-docs.deepseek.com/guides/search) to coding agents.**
|
|
4
|
+
|
|
5
|
+
An adapter layer for coding agents. The core is agent-agnostic; each adapter exposes the
|
|
6
|
+
same retrieval behavior to a specific agent. OpenCode v2 has a native plugin adapter, and
|
|
7
|
+
an MCP server covers MCP-capable hosts, with Pi as the first guided host. Guides for other
|
|
8
|
+
coding agents are in progress.
|
|
9
|
+
|
|
10
|
+
This is an unofficial community project. It is not affiliated with OpenCode or DeepSeek.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
Shipped adapters:
|
|
15
|
+
|
|
16
|
+
- [OpenCode v2 setup and usage](docs/agents/opencode-v2.md) — native plugin API
|
|
17
|
+
- [Pi setup and usage](docs/agents/pi.md) — MCP server over stdio
|
|
18
|
+
- [Codex setup and usage](docs/agents/codex.md) — MCP server over stdio
|
|
19
|
+
|
|
20
|
+
The MCP server works with any host that supports MCP tools over stdio. The
|
|
21
|
+
`deepseek-web-retrieval init` CLI installs it with plan-then-apply semantics — search and
|
|
22
|
+
fetch tiers chosen per capability, project or global scope, snapshots for rollback. For
|
|
23
|
+
how coding agents integrate—native websearch providers, native fetch tools, MCP, or
|
|
24
|
+
wrappers—see the
|
|
25
|
+
[integration model](docs/integration.md) with its version-locked host support matrix, the
|
|
26
|
+
[control-level research](docs/research/control-matrix.md), and the
|
|
27
|
+
[MCP compatibility research](docs/research/mcp-compatibility.md). A host is listed as supported
|
|
28
|
+
only after an adapter and guide exist.
|
|
29
|
+
|
|
30
|
+
For shared search, fetch, retry, and privacy behavior, see below.
|
|
31
|
+
|
|
32
|
+
## General behavior
|
|
33
|
+
|
|
34
|
+
### Search
|
|
35
|
+
|
|
36
|
+
- Sends `need_content: false` and returns DeepSeek's `summary`, falling back to `snippet`.
|
|
37
|
+
- Filters by `rerank_score` and `authority`, deduplicates URLs, and returns at most five
|
|
38
|
+
results by default.
|
|
39
|
+
- The final query, including `blockedDomains`, `includeDomains`, and `language` operators,
|
|
40
|
+
must be 128 characters or fewer. Longer queries are rejected locally.
|
|
41
|
+
- An empty result set is normal and is not an error.
|
|
42
|
+
|
|
43
|
+
### Fetch
|
|
44
|
+
|
|
45
|
+
- DeepSeek Fetch returns Markdown only. `format: "text"` and `format: "html"` are rejected.
|
|
46
|
+
- Output is capped at 16,000 characters by default, including the title. A
|
|
47
|
+
`[content truncated]` marker is added when the limit leaves room for it.
|
|
48
|
+
- If the page already starts with the same title as a top-level heading, no duplicate title
|
|
49
|
+
is added.
|
|
50
|
+
- Responses larger than 5 MiB are rejected before parsing.
|
|
51
|
+
- URLs must be absolute `http://` or `https://` URLs with a host, no embedded credentials,
|
|
52
|
+
and at most 8,192 characters.
|
|
53
|
+
- The core supports allowed/blocked domain lists and private-host blocking. DeepSeek does
|
|
54
|
+
not render JavaScript and cannot reach private networks; PDFs, images, and other binary
|
|
55
|
+
files are unsupported.
|
|
56
|
+
|
|
57
|
+
### Timeouts and retries
|
|
58
|
+
|
|
59
|
+
Request timeouts include reading the response body. Retryable responses are 408, 425, 429,
|
|
60
|
+
and 5xx; `Retry-After` is honored up to 10 seconds. Other failures, including 401, timeouts,
|
|
61
|
+
and network errors, fail without retrying.
|
|
62
|
+
|
|
63
|
+
### No automatic fallback
|
|
64
|
+
|
|
65
|
+
If no API key is available, Search and Fetch fail. If DeepSeek is unavailable, returns an
|
|
66
|
+
error, or times out, the request fails. The tool does not silently switch to another search
|
|
67
|
+
provider or fetch implementation.
|
|
68
|
+
|
|
69
|
+
### Privacy and cost
|
|
70
|
+
|
|
71
|
+
Queries and URLs are sent to `https://api.deepseek.com`. The API key is sent only as a
|
|
72
|
+
Bearer token to DeepSeek. Search and Fetch are billed per successful request; check current
|
|
73
|
+
DeepSeek pricing and rate limits before enabling a team deployment. A 429 means you should
|
|
74
|
+
wait, reduce concurrency, or increase retries.
|
|
75
|
+
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
bun install
|
|
80
|
+
bun run typecheck
|
|
81
|
+
bun test
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The test suite mocks the DeepSeek HTTP API and the OpenCode plugin host, and drives the
|
|
85
|
+
MCP server with SDK clients pinned to each supported protocol revision. Real API calls
|
|
86
|
+
require a funded DeepSeek account. Shared retrieval logic lives in `src/core/`; adapters
|
|
87
|
+
live in `src/<agent>/` (the cross-host MCP server lives in `src/mcp/`). Adapter docs live
|
|
88
|
+
in `docs/agents/<agent>.md`.
|
|
89
|
+
|
|
90
|
+
## Prior art
|
|
91
|
+
|
|
92
|
+
Other community projects in this space include:
|
|
93
|
+
|
|
94
|
+
- [overwaven/opencode-deepseek-web](https://github.com/overwaven/opencode-deepseek-web)
|
|
95
|
+
- [JOEYZYC/opencode-deepseek-websearch](https://github.com/JOEYZYC/opencode-deepseek-websearch)
|
|
96
|
+
- [gtoxlili/opencode-deepseek-websearch](https://github.com/gtoxlili/opencode-deepseek-websearch)
|
|
97
|
+
- [OniVe/opencode-websearch-deepseek](https://github.com/OniVe/opencode-websearch-deepseek)
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT. See [LICENSE](LICENSE).
|