deepseek-web-retrieval 0.8.0 → 0.10.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/README.md +33 -16
  3. package/dist/cli.js +307 -174
  4. package/docs/adr/0001-refuse-drift-between-plan-and-apply.md +7 -3
  5. package/docs/adr/0002-shared-config-base-layer.md +5 -1
  6. package/docs/adr/0003-need-content-per-call-boolean.md +49 -0
  7. package/docs/agents/claude-code.md +16 -6
  8. package/docs/agents/codex.md +14 -8
  9. package/docs/agents/domain.md +2 -2
  10. package/docs/agents/issue-tracker.md +5 -5
  11. package/docs/agents/opencode-v2.md +29 -15
  12. package/docs/agents/pi.md +41 -12
  13. package/docs/configuration.md +24 -7
  14. package/docs/design/config-layering-design.md +10 -5
  15. package/docs/design/installer-design.md +57 -25
  16. package/docs/design/search-content-design.md +133 -0
  17. package/docs/integration.md +19 -16
  18. package/docs/research/control-matrix.md +39 -34
  19. package/docs/research/mcp-compatibility.md +3 -1
  20. package/docs/research/ori-question-sourcing.md +31 -20
  21. package/docs/research/result-quality-passthrough.md +9 -7
  22. package/docs/research/search-api-defaults.md +4 -2
  23. package/docs/research/search-inline-content.md +49 -9
  24. package/package.json +3 -2
  25. package/src/core/auth.ts +7 -0
  26. package/src/core/client.ts +98 -27
  27. package/src/core/config-summary.ts +3 -0
  28. package/src/core/constants.ts +30 -2
  29. package/src/core/descriptions.ts +17 -2
  30. package/src/core/env.ts +7 -1
  31. package/src/core/format.ts +35 -5
  32. package/src/core/options.ts +56 -0
  33. package/src/core/search.ts +106 -15
  34. package/src/core/types.ts +29 -0
  35. package/src/installer/apply.ts +4 -4
  36. package/src/installer/cli.ts +2 -2
  37. package/src/installer/config-command.ts +4 -3
  38. package/src/installer/hosts/claude-code.ts +3 -17
  39. package/src/installer/hosts/codex.ts +3 -17
  40. package/src/installer/hosts/index.ts +2 -2
  41. package/src/installer/hosts/opencode.ts +1 -1
  42. package/src/installer/hosts/pi.ts +14 -15
  43. package/src/installer/hosts/shared.ts +23 -0
  44. package/src/installer/ownership.ts +2 -2
  45. package/src/installer/paths.ts +2 -2
  46. package/src/installer/{state.ts → record.ts} +15 -15
  47. package/src/installer/types.ts +1 -1
  48. package/src/installer/uninstall.ts +4 -4
  49. package/src/mcp/serve.ts +1 -2
  50. package/src/mcp/server.ts +19 -19
  51. package/src/opencode/plugin.ts +15 -10
  52. package/src/pi/extension.ts +26 -17
  53. package/src/mcp/auth.ts +0 -11
package/CHANGELOG.md CHANGED
@@ -2,9 +2,26 @@
2
2
 
3
3
  All notable changes to this project are documented here, one sentence per item.
4
4
 
5
+ ## 0.10.0
6
+
7
+ - Add `need_content` as an optional per-call boolean on the MCP and Pi search tools: `true` attaches each result's page body as Markdown (structure-preserving, indented into the result list) in place of its summary, and a missing body falls back to the summary; OpenCode's fixed provider input keeps that path summary-only.
8
+ - Add the `searchContentMaxChars` (1,500 characters) and `searchContentTimeoutMs` (60,000 ms) deployment knobs — the content envelope every `need_content` call runs inside, never tool parameters, recorded in ADR-0003 and the search content design note.
9
+ - State the `need_content` facts — excerpt length, latency, price, and the fetch alternative — in the tool and parameter descriptions, with both full-page routes named side by side, and no usage policy: when content is worth it stays the model's per-call judgment.
10
+ - Extend the inline-content research note with the vendor reading that no surveyed architecture couples a content flag to another parameter's value range: budgets are static-range, conditional-effect.
11
+ - Add a keyless `pi-mock` e2e leg that drives a real Pi session search with `need_content: true` against the mock upstream and asserts the flag reached the wire and the page body reached the model, with the digest legs now also asserting `need_content: false` by default.
12
+
13
+ ## 0.9.0
14
+
15
+ - Accept an optional per-call `count` (1–50) on the MCP and Pi search tools and an optional per-call `maxChars` (0–1,000,000) on every adapter's fetch, each overriding the configured value for that one call.
16
+ - Open the search result text with `Searched for: <effective query>` whenever domain or language operators — or fitting the query-length limit — changed what was actually searched, so the model can attribute what it sees.
17
+ - Degrade gracefully instead of failing when search operators push a combined query past the API's 128-character limit: the query body truncates first, the language filter drops next, the include list last, and blocked domains never drop.
18
+ - Align user-facing installer wording with the domain glossary: the secrets refusal and record-repair guidance now say "install record" instead of "state file" or "undo state".
19
+ - Add the `baseUrl` knob (`DEEPSEEK_BASE_URL` environment variable or shared-file key) so every retrieval request can be routed through a proxy, enterprise gateway, or mock upstream; only an http(s) URL is accepted and anything else drops back to `https://api.deepseek.com`.
20
+ - Add keyless `pi-mock` and `opencode-mock` Docker e2e scenarios that run real host session loops (pi via a custom `models.json` provider, OpenCode via a custom provider) against an in-container mock upstream, invoking both retrieval tools and asserting the tool results reached the model — closing CI's tool-execution blind spot without a billed key — and document the keyless (CI) versus billed (local, real API) e2e responsibilities with a `test:e2e:billed` script.
21
+
5
22
  ## 0.8.0
6
23
 
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.
24
+ - Add Claude Code as a supported host: an MCP-only integration registered in `.mcp.json` (project scope) or `~/.claude.json` (Claude Code's user scope — global scope in this repo's vocabulary), 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
25
  - 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
26
  - 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
27
  - 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.
package/README.md CHANGED
@@ -4,8 +4,9 @@
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 and Claude Code**. All four share
8
- the same retrieval core, with results formatted for each host.
7
+ plugin**, a **native [Pi](https://pi.dev/) extension** (Pi, the open-source coding agent),
8
+ or **MCP for Codex and Claude Code**. All four share the same retrieval core, with results
9
+ formatted for each host.
9
10
 
10
11
  This is an unofficial community project, not affiliated with DeepSeek or the supported
11
12
  host projects.
@@ -16,8 +17,9 @@ Jump to: [Features](#features) · [Quickstart](#quickstart) · [Usage](#usage)
16
17
 
17
18
  ## Features
18
19
 
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
20
+ - **One package, four hosts** — a native plugin for OpenCode v2 (the 2.x series), a
21
+ native Pi extension, and a stdio MCP server for Codex and Claude Code, all sharing one
22
+ retrieval core
21
23
  - **Routing control per tool** — search and fetch are set independently to optional,
22
24
  preferred, forced, or off; the tier table in Usage explains each
23
25
  - **Review before anything is written** — `init` prints the full plan and writes only
@@ -59,8 +61,9 @@ Choose your host:
59
61
  | Claude Code | MCP server over stdio in `.mcp.json` or `~/.claude.json` | [Claude Code guide](docs/agents/claude-code.md) |
60
62
 
61
63
  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.
64
+ use its stored DeepSeek key. Run `init` for your host to preview a configuration — take
65
+ the quickstart command and swap `--host` and `--scope` for your host's values; each host
66
+ guide shows its recommended tiers.
64
67
 
65
68
  `--search` and `--fetch` each pick a tier — how strongly the host steers toward the
66
69
  DeepSeek tool, chosen independently per capability:
@@ -87,7 +90,8 @@ Files:
87
90
  upsert marked rules block
88
91
 
89
92
  Notes:
90
- - Codex stdio children do not inherit the parent environment, so the entry forwards DEEPSEEK_API_KEY and every DEEPSEEK_* option variable explicitly via env_vars; shell-set knobs reach the server without hand-editing config.toml (the shared config file works without any forwarding).
93
+ - Codex stdio children do not inherit the parent environment, so the entry forwards DEEPSEEK_API_KEY and every DEEPSEEK_* option variable explicitly via env_vars; shell-set knobs reach the server without hand-editing config.toml.
94
+ - The shared config file needs no forwarding at all: the server reads it itself.
91
95
  - Rules block upserted in ~/.codex/AGENTS.md; Codex reads ~/.codex/AGENTS.md plus every AGENTS.md from the project root to the cwd.
92
96
  - Shared config ownership is recorded in ~/.codex/.config.toml.deepseek-web-retrieval.codex.owner.json; uninstall releases it. Keep this local metadata with the config.
93
97
 
@@ -116,21 +120,28 @@ What this adapter layer adds on top of the
116
120
  own capabilities (Markdown-only output, no JavaScript rendering, no private networks or
117
121
  binary files, per-request billing) are documented there.
118
122
 
119
- | Default | Value | Knob |
123
+ | Setting | Default | Knob |
120
124
  | --- | --- | --- |
121
125
  | Results per search | 10 | `count` |
122
126
  | Fetch output cap | 16,000 characters | `fetchMaxChars` |
123
127
  | Search summary cap | 1,200 characters | `maxSummaryChars` |
124
- | Request timeout, body read included | 30 s | `searchTimeoutMs` / `fetchTimeoutMs` |
128
+ | Inline content cap, per result (when requested) | 1,500 characters | `searchContentMaxChars` |
129
+ | Request timeout, body read included | 30 s (60 s for `need_content` calls) | `searchTimeoutMs` / `fetchTimeoutMs` / `searchContentTimeoutMs` |
125
130
  | Transient retries | 2 (range 0–5) | `maxRetries` |
126
131
 
127
132
  ### Search
128
133
 
129
- - Requests summaries only (`need_content: false`, falling back from `summary` to
130
- `snippet`); full page content never enters the results.
134
+ - Requests summaries by default (`need_content: false`, falling back from `summary` to
135
+ `snippet`); a summary the cap shortens ends with an ellipsis. When a call sets
136
+ `need_content: true`, each result instead carries its page body as Markdown, clamped
137
+ to `searchContentMaxChars` per result — a missing body falls back to the summary.
131
138
  - Deduplicates URLs; an empty result set is normal, not an error.
132
- - Builds `blockedDomains`, `includeDomains`, and `language` into query operators, and
133
- rejects the final query locally when it exceeds the API's 128-character limit.
139
+ - Builds `blockedDomains`, `includeDomains`, and `language` into query operators (part of
140
+ DeepSeek's documented search syntax). A combined query over the API's 128-character limit
141
+ degrades instead of failing — the query body truncates first, the language filter drops
142
+ next, the include list last, and blocked domains never drop — and whenever operators or
143
+ degradation changed the query, the result text opens with `Searched for: <effective query>`
144
+ so the model can attribute what it sees.
134
145
  - Optional `rerank_score` and `authority` thresholds are off by default — the default
135
146
  returns exactly what DeepSeek ranked. A positive threshold drops results below it.
136
147
  A missing `rerank_score` is dropped too; an unknown `authority` stays unless
@@ -140,11 +151,17 @@ binary files, per-request billing) are documented there.
140
151
  question in their own words. It is forwarded as DeepSeek's `ori_question`, trimmed
141
152
  and truncated to 128 characters; on the Pi extension, a blank input falls back to the
142
153
  most recent user message in the session.
154
+ - The same paths also take an optional per-call `count` (1–50), overriding the
155
+ configured result count for that one call, and an optional per-call `need_content`
156
+ boolean requesting page bodies in the results (see
157
+ [search content design](docs/design/search-content-design.md)).
143
158
 
144
159
  ### Fetch
145
160
 
146
161
  - Output is capped per the table above, title included; a `[content truncated]` marker
147
- is added when the limit leaves room for it.
162
+ is added when the limit leaves room for it. An optional per-call `maxChars` parameter
163
+ (0–1,000,000) on every adapter overrides the configured cap for one call — a model that
164
+ sees the marker can widen the budget and re-fetch.
148
165
  - A page that already opens with its title as a top-level heading does not get a
149
166
  duplicate title.
150
167
  - URLs must be absolute `http://` or `https://`, credential-free, and at most 8,192
@@ -220,8 +237,8 @@ bun run check
220
237
  ```
221
238
 
222
239
  Use `bun run lint:fix` to apply Biome's safe lint fixes and formatting. See
223
- [CONTRIBUTING.md](CONTRIBUTING.md) for development checks, e2e scenarios, and
224
- [automated tag releases](CONTRIBUTING.md#automated-releases).
240
+ [CONTRIBUTING.md](CONTRIBUTING.md) for development checks and e2e scenarios, and
241
+ [automated tag releases](CONTRIBUTING.md#automated-releases-maintainers).
225
242
 
226
243
  The test suite mocks the DeepSeek API and the OpenCode and Pi host APIs; real API calls
227
244
  require a funded DeepSeek account. Shared retrieval logic lives in `src/core/`; adapters