dsh-search-enhance 0.1.4 → 0.1.6
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.md +54 -174
- package/README.zh.md +101 -0
- package/lib/diagnostics/probes.d.ts +2 -1
- package/lib/diagnostics/probes.js +3 -1
- package/lib/documentation/cache.d.ts +1 -0
- package/lib/documentation/cache.js +4 -0
- package/lib/documentation/context7-cache.d.ts +1 -0
- package/lib/documentation/context7-cache.js +1 -0
- package/lib/documentation/index.d.ts +1 -1
- package/lib/documentation/index.js +1 -1
- package/lib/documentation/service.d.ts +6 -12
- package/lib/documentation/service.js +43 -74
- package/lib/index.js +1 -2
- package/lib/orchestration/orchestrator.d.ts +0 -1
- package/lib/orchestration/orchestrator.js +2 -15
- package/lib/orchestration/types.d.ts +0 -1
- package/lib/presentation/render.d.ts +4 -0
- package/lib/presentation/render.js +8 -3
- package/lib/prompt/tool-discovery.js +2 -0
- package/lib/providers/context7.d.ts +7 -12
- package/lib/providers/context7.js +32 -97
- package/lib/providers/index.d.ts +1 -1
- package/lib/providers/index.js +1 -1
- package/lib/search/parse.d.ts +1 -1
- package/lib/search/parse.js +236 -30
- package/lib/tools/docs-search.js +2 -1
- package/lib/tools/schemas.d.ts +6 -2
- package/lib/tools/schemas.js +6 -2
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,221 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Search Enhance for DeepSeek Harness
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [简体中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`dsh-search-enhance` is a search extension for DeepSeek Harness. It uses a Grok-compatible Search API for primary web answers and can optionally use Context7, Exa, Tavily, and Firecrawl for documentation lookup, supplementary discovery, page extraction, and site mapping.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The plugin handles search, source retention, and page retrieval as separate steps. `web_search` and `docs_search` return an answer or documentation snippets with visible sources; the complete source record can be stored under a `source_ref` and paged later. Important pages can then be retrieved with `web_extract`, so search snippets remain distinct from fetched page content.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
用户问题
|
|
11
|
-
│
|
|
12
|
-
▼
|
|
13
|
-
DSH Agent
|
|
14
|
-
│
|
|
15
|
-
└─ 固定模型工具 surface(schema 与顺序不随披露状态变化)
|
|
16
|
-
├─ web_search ──────> Grok 主搜索
|
|
17
|
-
│ ├─ 按需要补充 Context7 / Exa
|
|
18
|
-
│ ├─ 按需要补充 Tavily / Firecrawl
|
|
19
|
-
│ └─ 返回回答、来源;有 source_ref 时追加 search_sources manifest
|
|
20
|
-
│
|
|
21
|
-
├─ docs_search ─────> Context7 / Exa 文档检索
|
|
22
|
-
│ └─ 返回文档片段、来源;有 source_ref 时追加 search_sources manifest
|
|
23
|
-
│
|
|
24
|
-
├─ web_extract ─────> Tavily → Firecrawl → smart_direct → direct
|
|
25
|
-
│ └─ 读取选中网页的正文
|
|
26
|
-
│
|
|
27
|
-
├─ search_tools ────> 按需返回 capability / operation manifest
|
|
28
|
-
│
|
|
29
|
-
└─ search_call ─────> 调用已经激活的延迟 operation
|
|
30
|
-
├─ Context7 精细查询
|
|
31
|
-
├─ 完整来源分页
|
|
32
|
-
├─ 站点页面发现
|
|
33
|
-
├─ 研究计划
|
|
34
|
-
└─ 配置诊断
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
插件继续使用 DSH 原有的 `web_search` 名称,不会再增加第二个普通搜索入口。在本来可以使用 `web_search` 的 Agent 中,插件提供增强后的搜索;如果某个 Agent 已经禁用网页搜索,插件不会强行重新开启。
|
|
38
|
-
|
|
39
|
-
普通搜索以 Grok 为主。其他服务只负责补充文档、来源或网页内容,不会替代 Grok 的主搜索位置。
|
|
40
|
-
|
|
41
|
-
### 固定模型工具 surface
|
|
42
|
-
|
|
43
|
-
默认使用 `progressive`。在 DSH 未另行限制的 Agent 中,插件在初始步骤和后续步骤提供的五个固定搜索入口(Native tool / Code Mode SDK)是:
|
|
44
|
-
|
|
45
|
-
| 工具 | 调用方式与用途 |
|
|
46
|
-
| --- | --- |
|
|
47
|
-
| `web_search` | 直接调用。使用 Grok 生成通用搜索的主要回答,并按搜索类型补充其他来源 |
|
|
48
|
-
| `docs_search` | 直接调用。检索库、框架、SDK、API 和源码仓库文档 |
|
|
49
|
-
| `web_extract` | 直接调用。读取指定网页正文,用于核对搜索摘要中的重要内容 |
|
|
50
|
-
| `search_tools` | 直接调用。按需返回延迟能力的 operation manifest,不注册新的模型工具 |
|
|
51
|
-
| `search_call` | 固定网关。通过 `search_call({ operation, arguments })` 调用已经激活的延迟 operation |
|
|
9
|
+
> Bring your own endpoints and credentials. The plugin ships no API keys. A Grok-compatible endpoint is required for `web_search`; Context7, Exa, Tavily, and Firecrawl are optional.
|
|
52
10
|
|
|
53
|
-
|
|
11
|
+

|
|
54
12
|
|
|
55
|
-
|
|
13
|
+
## Key characteristics
|
|
56
14
|
|
|
57
|
-
`
|
|
15
|
+
- `web_search` uses the Grok-compatible endpoint for the main answer, adds Exa for documentation-oriented queries, and uses Tavily or Firecrawl within the configured supplementary budget.
|
|
16
|
+
- Sources are normalized, de-duplicated, and reordered using source category, requested version, and publication-time signals before they are shown.
|
|
17
|
+
- `source_ref` keeps the complete source record in private durable storage, allowing the Agent to paginate beyond the links included in the initial result.
|
|
18
|
+
- `docs_search` uses Context7 only with an explicit `library_name` or `library_id`; requests without a library identity use Exa discovery.
|
|
19
|
+
- `web_extract` follows the fixed Tavily → Firecrawl → `smart_direct` → `direct` route and reports the retrieval route, evidence level, and available page metadata.
|
|
20
|
+
- Source pagination, Context7 detail operations, site mapping, research planning, and diagnostics are disclosed on demand through `search_tools` and `search_call`.
|
|
21
|
+
- Native Tool Mode and Code Mode use the same fixed tool surface and canonical outputs. DSH Settings, Credentials, Agent Presets, guards, and lifecycle cleanup continue to apply.
|
|
22
|
+
- Optional Providers are skipped when unconfigured. Tavily and Firecrawl supplementary-search budgets default to `0`, and optional Provider failures remain visible in the result.
|
|
58
23
|
|
|
59
|
-
|
|
60
|
-
| --- | --- | --- |
|
|
61
|
-
| `context7` | `context7_resolve_library_id`、`context7_query_docs`、`context7_get_library_docs`、`context7_get_cached_doc_raw` | 需要精确选择库版本或进一步读取 Context7 文档 |
|
|
62
|
-
| `sources` | `search_sources` | 搜索结果中的来源较多,需要继续分页读取完整来源 |
|
|
63
|
-
| `site_map` | `web_map` | 已知一个网站,需要继续发现该站点下的相关页面 |
|
|
64
|
-
| `planning` | `research_plan` | 明确要求深度研究、多来源核对或复杂比较时先制定计划 |
|
|
65
|
-
| `diagnostics` | `search_diagnostics` | 用户明确要求检查搜索配置或连接状态 |
|
|
24
|
+
## Quick start
|
|
66
25
|
|
|
67
|
-
|
|
26
|
+
### 1. Install
|
|
68
27
|
|
|
69
|
-
|
|
70
|
-
2. 在 `progressive` 模式下,新披露的能力组从下一模型 step 开始 active;同一步内提前调用会失败。激活范围属于当前 Agent,重复请求会再次返回同一 manifest,但不会创建第二套状态或入口。
|
|
71
|
-
3. 在 `all` 模式下,唯一变化是所有延迟 operation 从一开始就 active;`search_tools` 仍按需返回 manifest。`all` 不会“显示全部 12 个工具”,两种模式的五个模型工具及其 schema 完全相同。
|
|
72
|
-
4. 延迟 operation 只能通过 `search_call({ operation, arguments })` 调用,不能直接调用 `search_sources`、`web_map` 等名称;resident 的 `web_search`、`docs_search` 和 `web_extract` 仍然直接调用。
|
|
73
|
-
5. `web_search` 或 `docs_search` 成功返回 `source_ref` 时,插件会自动激活 `sources`,并在结果中追加 `search_sources` manifest;在 `progressive` 模式下可从下一 step 通过 `search_call` 使用它。
|
|
74
|
-
6. 固定 surface 仍受 DSH 原有 Preset、guard 和工具限制约束,插件不会绕过这些限制。
|
|
75
|
-
|
|
76
|
-
这种固定网关设计保留了按需披露,同时避免插件因披露状态变化而改写发送给 DeepSeek 的 system 文本、tool schema/顺序或 Code Mode SDK 前缀,从而消除插件自身造成的前缀变化。
|
|
77
|
-
|
|
78
|
-
### 一次完整搜索如何进行
|
|
79
|
-
|
|
80
|
-
1. 通用问题直接调用 `web_search`,文档问题直接调用 `docs_search`。
|
|
81
|
-
2. 当搜索产生来源时,结果会包含可见来源、`source_ref` 和追加的 `search_sources` manifest,同时自动激活 `sources`。
|
|
82
|
-
3. 在下一 step 需要更多来源时,调用 `search_call({ operation: 'search_sources', arguments: { source_ref, offset: 0, limit: 20, format: 'compact' } })` 分页读取,而不是直接调用 `search_sources`。
|
|
83
|
-
4. 对重要结论,选择权威链接并直接调用 `web_extract` 获取网页正文。
|
|
84
|
-
5. 如果任务需要站点内发现、研究计划、精细 Context7 查询或连接检查,先调用例如 `search_tools({ capabilities: ['site_map'] })` 取得 manifest;`progressive` 模式从下一 step、`all` 模式立即通过 `search_call({ operation: 'web_map', arguments: { url: 'https://example.com' } })` 调用相应 operation。
|
|
85
|
-
6. 最终回答综合主搜索、补充来源和已经读取的网页正文,并保留来源链接。
|
|
86
|
-
|
|
87
|
-
`source_ref` 只是完整来源列表的引用,不等同于网页正文;重要事实仍应通过 `web_extract` 读取原页面后再下结论。
|
|
88
|
-
|
|
89
|
-
## 安装
|
|
90
|
-
|
|
91
|
-
确保 `dsh` 和 `pnpm` 已经可以使用,然后直接安装到默认的 `web` 配置:
|
|
28
|
+
Install the published bundle into the DSH `web` profile:
|
|
92
29
|
|
|
93
30
|
```bash
|
|
94
31
|
dsh plugin --profile web add dsh-search-enhance@latest
|
|
95
32
|
```
|
|
96
33
|
|
|
97
|
-
|
|
34
|
+
### 2. Start DSH Web
|
|
98
35
|
|
|
99
36
|
```bash
|
|
100
37
|
dsh web
|
|
101
38
|
```
|
|
102
39
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
## 配置
|
|
40
|
+
### 3. Configure search
|
|
106
41
|
|
|
107
|
-
|
|
42
|
+
Open:
|
|
108
43
|
|
|
109
44
|
```text
|
|
110
|
-
|
|
45
|
+
Settings → Plugins → Plugin configuration → dsh-search-enhance
|
|
111
46
|
```
|
|
112
47
|
|
|
113
|
-
|
|
48
|
+
Under **Grok search backend**, configure:
|
|
114
49
|
|
|
115
|
-
|
|
50
|
+
1. the xAI endpoint or an explicit Grok-compatible gateway;
|
|
51
|
+
2. the matching `completions` or `responses` protocol;
|
|
52
|
+
3. a model supported by that endpoint;
|
|
53
|
+
4. the Grok credential in the card's Credentials section.
|
|
116
54
|
|
|
117
|
-
|
|
55
|
+
The default credential reference is `SEARCH_API_KEY`. Credential values are stored through DSH Credentials and are not exposed as model parameters.
|
|
118
56
|
|
|
119
|
-
|
|
120
|
-
| --- | --- |
|
|
121
|
-
| 接口地址 | xAI 官方地址或第三方 Grok 服务地址 |
|
|
122
|
-
| 模型 | 该服务实际支持的 Grok 模型名称 |
|
|
123
|
-
| Grok 密钥 | 在页面的“凭据”区域填写 |
|
|
57
|
+
Save the settings, restart DSH, and ask a current-information question. A successful run shows a `Search` tool row, an answer, and source links.
|
|
124
58
|
|
|
125
|
-
|
|
59
|
+
## Example requests
|
|
126
60
|
|
|
127
|
-
|
|
128
|
-
- `responses`:使用 Responses 接口。
|
|
61
|
+
Use normal language; the plugin gives the Agent routing guidance.
|
|
129
62
|
|
|
130
|
-
|
|
63
|
+
- “Find the most important React 19 user-visible changes. Prefer official release notes and include source links.”
|
|
64
|
+
- “Look up the current FastAPI JWT authentication API and show a minimal example from the official documentation.”
|
|
65
|
+
- “Read and summarize `https://example.com/article`, separating what the page states from your inference.”
|
|
131
66
|
|
|
132
|
-
|
|
67
|
+
Ask explicitly when you need complete source pagination, site discovery, a research plan, or Provider diagnostics.
|
|
133
68
|
|
|
134
|
-
|
|
69
|
+
## Providers
|
|
135
70
|
|
|
136
|
-
|
|
137
|
-
| --- | --- | --- |
|
|
138
|
-
| Context7 | 查找库和框架文档 | `CONTEXT7_API_KEY` |
|
|
139
|
-
| Exa | 补充文档和网页结果 | `EXA_API_KEY` |
|
|
140
|
-
| Tavily | 补充搜索、读取网页和发现站点页面 | `TAVILY_API_KEY` |
|
|
141
|
-
| Firecrawl | 补充搜索和读取网页 | `FIRECRAWL_API_KEY` |
|
|
71
|
+
Configure only the routes you need.
|
|
142
72
|
|
|
143
|
-
|
|
73
|
+
| Provider | Used for | Default credential reference | Required? |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| Grok-compatible Search API | Main `web_search` answer and sources | `SEARCH_API_KEY` | For `web_search` |
|
|
76
|
+
| Context7 | Documentation lookup for an explicit library | `CONTEXT7_API_KEY` | No |
|
|
77
|
+
| Exa | Broad documentation and supplementary discovery | `EXA_API_KEY` | No |
|
|
78
|
+
| Tavily | Supplementary search, page extraction, and site mapping | `TAVILY_API_KEY` | No |
|
|
79
|
+
| Firecrawl | Supplementary search and page extraction | `FIRECRAWL_API_KEY` | No |
|
|
144
80
|
|
|
145
|
-
Tavily
|
|
81
|
+
Unconfigured optional Providers are skipped. Tavily and Firecrawl supplementary-search budgets default to `0` for every search profile; explicit `web_extract` and `web_map` requests use their own routes.
|
|
146
82
|
|
|
147
|
-
|
|
83
|
+
For `docs_search`, Context7 requires an explicit `library_name` or `library_id`. Without one, `provider: "auto"` uses Exa instead of guessing a package name from the full question.
|
|
148
84
|
|
|
149
|
-
|
|
85
|
+
## Tool disclosure
|
|
150
86
|
|
|
151
|
-
- `
|
|
152
|
-
- `normal`:信息量适中;
|
|
153
|
-
- `deep`:适合需要更多来源的问题。
|
|
87
|
+
The model-facing surface remains five tools: `web_search`, `docs_search`, `web_extract`, `search_tools`, and `search_call`. Advanced operations are disclosed through manifests rather than registered as additional model tools.
|
|
154
88
|
|
|
155
|
-
|
|
89
|
+
The default `progressive` mode activates a newly disclosed capability on the next model step. In `all` mode, deferred operations are active immediately. Native Tool Mode and Code Mode use the same schemas, execution policy, and canonical outputs.
|
|
156
90
|
|
|
157
|
-
|
|
91
|
+
When `web_search` or `docs_search` returns a `source_ref`, the plugin automatically activates source pagination and appends its real operation manifest.
|
|
158
92
|
|
|
159
|
-
|
|
93
|
+
## Update and uninstall
|
|
160
94
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
代理设置位于:
|
|
164
|
-
|
|
165
|
-
```text
|
|
166
|
-
补充 Provider → 高级 Provider 设置 → 网页提取代理
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
`smart_direct` 和 `direct` 可以分别填写代理地址,例如:
|
|
170
|
-
|
|
171
|
-
```text
|
|
172
|
-
http://127.0.0.1:7890
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
留空表示不使用该项代理。这里只支持不带账号密码的 `http://` 地址,不支持 HTTPS 或 SOCKS 代理,也不会自动读取 `HTTP_PROXY`、`HTTPS_PROXY` 或 `ALL_PROXY`。
|
|
176
|
-
|
|
177
|
-
`direct` 使用代理时需要 Node.js 24.5 或更高版本。
|
|
178
|
-
|
|
179
|
-
### 5. 保存并重启
|
|
180
|
-
|
|
181
|
-
点击“保存配置”后重启 DSH:
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
dsh web
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
重启后,新配置才会用于搜索。
|
|
188
|
-
|
|
189
|
-
## 使用
|
|
190
|
-
|
|
191
|
-
安装并配置完成后,直接在 DSH 中描述需求即可,例如:
|
|
192
|
-
|
|
193
|
-
```text
|
|
194
|
-
搜索最近的相关信息,并列出来源。
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
```text
|
|
198
|
-
查找这个库当前版本的官方 API 用法。
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
```text
|
|
202
|
-
读取并总结 https://example.com/page 的正文。
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
```text
|
|
206
|
-
对这个问题做多来源核对,并说明各来源是否一致。
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
## 更新与卸载
|
|
210
|
-
|
|
211
|
-
更新到 npm 上的最新版本:
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
dsh plugin --profile web add dsh-search-enhance@latest
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
卸载插件:
|
|
95
|
+
To update, run the installation command above again. To remove the plugin:
|
|
218
96
|
|
|
219
97
|
```bash
|
|
220
98
|
dsh plugin --profile web remove dsh-search-enhance
|
|
221
99
|
```
|
|
100
|
+
|
|
101
|
+
Restart DSH after updating or removing the bundle.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# DeepSeek Harness Search Enhance
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
`dsh-search-enhance` 是 DeepSeek Harness 的搜索增强插件。它使用 Grok-compatible Search API 生成普通网页搜索的主要回答,并可选用 Context7、Exa、Tavily 和 Firecrawl 完成文档检索、补充来源、网页正文提取和站点页面发现。
|
|
6
|
+
|
|
7
|
+
插件将搜索、来源保留和页面读取作为不同步骤处理。`web_search` 和 `docs_search` 返回搜索回答或文档片段以及可见来源;完整来源记录可通过 `source_ref` 保存并继续分页读取;需要核对重要内容时,再由 `web_extract` 获取选中页面。因此,搜索 snippet 与实际读取的网页正文会保持明确区分。
|
|
8
|
+
|
|
9
|
+
> 你需要自行提供所选服务的端点和凭据,插件不内置任何 API Key。`web_search` 需要 Grok-compatible 端点;Context7、Exa、Tavily 和 Firecrawl 均为可选 Provider。
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## 主要特点
|
|
14
|
+
|
|
15
|
+
- `web_search` 使用 Grok-compatible 端点生成主要回答,对文档型问题补充 Exa 来源,并在配置的补充预算内使用 Tavily 或 Firecrawl。
|
|
16
|
+
- 来源在展示前会经过 URL 标准化、去重,并根据来源类别、目标版本和发布时间信号重新排序。
|
|
17
|
+
- `source_ref` 将完整来源记录保存在插件私有持久存储中,Agent 可以继续分页读取首次结果未展示的来源。
|
|
18
|
+
- `docs_search` 只在提供明确 `library_name` 或 `library_id` 时使用 Context7;没有库身份的请求使用 Exa 发现。
|
|
19
|
+
- `web_extract` 按 Tavily → Firecrawl → `smart_direct` → `direct` 的固定路径执行,并报告提取路径、证据等级和可用的页面元数据。
|
|
20
|
+
- 来源分页、Context7 精细操作、站点映射、研究计划和诊断通过 `search_tools` 与 `search_call` 按需披露。
|
|
21
|
+
- Native Tool Mode 与 Code Mode 使用相同的固定工具入口和规范输出。DSH Settings、Credentials、Agent Preset、guard 和生命周期清理继续生效。
|
|
22
|
+
- 未配置的可选 Provider 会被跳过。Tavily 和 Firecrawl 的补充搜索预算默认是 `0`,可选 Provider 失败也会在结果中显示。
|
|
23
|
+
|
|
24
|
+
## 快速开始
|
|
25
|
+
|
|
26
|
+
### 1. 安装
|
|
27
|
+
|
|
28
|
+
将已发布的 bundle 安装到 DSH `web` profile:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
dsh plugin --profile web add dsh-search-enhance@latest
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. 启动 DSH Web
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
dsh web
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. 配置搜索
|
|
41
|
+
|
|
42
|
+
打开:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
设置 → 插件 → 插件配置 → dsh-search-enhance
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
在 **Grok 搜索后端** 中配置:
|
|
49
|
+
|
|
50
|
+
1. xAI 端点或明确的 Grok-compatible 网关;
|
|
51
|
+
2. 与服务匹配的 `completions` 或 `responses` 协议;
|
|
52
|
+
3. 该端点支持的模型;
|
|
53
|
+
4. 设置卡片“凭据”区域中的 Grok 密钥。
|
|
54
|
+
|
|
55
|
+
默认凭据引用名是 `SEARCH_API_KEY`。密钥值通过 DSH Credentials 保存,不会暴露为模型参数。
|
|
56
|
+
|
|
57
|
+
保存设置并重启 DSH,然后询问一个需要当前信息的问题。成功时会看到 `Search` 工具行、回答和来源链接。
|
|
58
|
+
|
|
59
|
+
## 使用示例
|
|
60
|
+
|
|
61
|
+
直接使用自然语言即可,插件会为 Agent 提供路由指引。
|
|
62
|
+
|
|
63
|
+
- “查找 React 19 最重要的用户可见变化,优先引用官方发布说明并附上来源链接。”
|
|
64
|
+
- “查找 FastAPI 当前 JWT 认证 API,并根据官方文档给出最小示例。”
|
|
65
|
+
- “读取并总结 `https://example.com/article`,区分页面原文与推断。”
|
|
66
|
+
|
|
67
|
+
需要完整来源分页、站点发现、研究计划或 Provider 诊断时,请明确提出。
|
|
68
|
+
|
|
69
|
+
## Provider
|
|
70
|
+
|
|
71
|
+
只配置你实际需要的路径。
|
|
72
|
+
|
|
73
|
+
| Provider | 用途 | 默认凭据引用名 | 是否必需 |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| Grok-compatible Search API | `web_search` 的主要回答和来源 | `SEARCH_API_KEY` | 使用 `web_search` 时 |
|
|
76
|
+
| Context7 | 明确库身份的文档检索 | `CONTEXT7_API_KEY` | 否 |
|
|
77
|
+
| Exa | 广泛文档发现和补充发现 | `EXA_API_KEY` | 否 |
|
|
78
|
+
| Tavily | 补充搜索、网页提取和站点映射 | `TAVILY_API_KEY` | 否 |
|
|
79
|
+
| Firecrawl | 补充搜索和网页提取 | `FIRECRAWL_API_KEY` | 否 |
|
|
80
|
+
|
|
81
|
+
未配置的可选 Provider 会被跳过。所有搜索 profile 的 Tavily/Firecrawl 补充搜索预算默认都是 `0`;显式的 `web_extract` 和 `web_map` 请求使用各自的执行路径。
|
|
82
|
+
|
|
83
|
+
对于 `docs_search`,Context7 需要明确的 `library_name` 或 `library_id`。两者都未提供时,`provider: "auto"` 使用 Exa,不会根据完整问题猜测包名。
|
|
84
|
+
|
|
85
|
+
## 工具披露
|
|
86
|
+
|
|
87
|
+
模型可见入口始终是五个工具:`web_search`、`docs_search`、`web_extract`、`search_tools` 和 `search_call`。高级 operation 通过 manifest 披露,不会注册成更多模型工具。
|
|
88
|
+
|
|
89
|
+
默认 `progressive` 模式下,新披露的能力从下一模型 step 开始可调用。`all` 模式让延迟 operation 立即处于 active 状态。Native Tool Mode 与 Code Mode 使用相同 schema、执行策略和规范输出。
|
|
90
|
+
|
|
91
|
+
`web_search` 或 `docs_search` 返回 `source_ref` 时,插件会自动激活来源分页,并追加对应的真实 operation manifest。
|
|
92
|
+
|
|
93
|
+
## 更新与卸载
|
|
94
|
+
|
|
95
|
+
更新时重新运行上面的安装命令。卸载插件:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
dsh plugin --profile web remove dsh-search-enhance
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
更新或卸载 bundle 后请重启 DSH。
|
|
@@ -4,7 +4,8 @@ import type { BoundedSourceProvider } from '../providers/types.js';
|
|
|
4
4
|
import type { DiagnosticCapability, DiagnosticProbe, DiagnosticProbeInput, DiagnosticProbeResult, DiagnosticProviderName } from './types.js';
|
|
5
5
|
/** Fixed, non-user-controlled diagnostic targets. */
|
|
6
6
|
export declare const DIAGNOSTIC_SEARCH_QUERY = "search-enhance fixed connectivity diagnostic";
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const DIAGNOSTIC_CONTEXT7_LIBRARY_NAME = "React";
|
|
8
|
+
export declare const DIAGNOSTIC_CONTEXT7_QUERY = "documentation connectivity diagnostic";
|
|
8
9
|
export declare const DIAGNOSTIC_RESULT_LIMIT = 1;
|
|
9
10
|
/** Uses the public bounded model-list GET; it never calls Search API main search. */
|
|
10
11
|
export declare class SearchApiModelListDiagnosticProbe implements DiagnosticProbe {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { throwIfAborted } from '../provider-runtime/index.js';
|
|
2
2
|
/** Fixed, non-user-controlled diagnostic targets. */
|
|
3
3
|
export const DIAGNOSTIC_SEARCH_QUERY = 'search-enhance fixed connectivity diagnostic';
|
|
4
|
-
export const
|
|
4
|
+
export const DIAGNOSTIC_CONTEXT7_LIBRARY_NAME = 'React';
|
|
5
|
+
export const DIAGNOSTIC_CONTEXT7_QUERY = 'documentation connectivity diagnostic';
|
|
5
6
|
export const DIAGNOSTIC_RESULT_LIMIT = 1;
|
|
6
7
|
const COMPLETE = Object.freeze({ state: 'complete' });
|
|
7
8
|
const NOT_CONFIGURED = Object.freeze({ state: 'not_configured' });
|
|
@@ -38,6 +39,7 @@ export class Context7ResolveDiagnosticProbe {
|
|
|
38
39
|
await this.context7.resolve({
|
|
39
40
|
config: input.config,
|
|
40
41
|
limit: DIAGNOSTIC_RESULT_LIMIT,
|
|
42
|
+
libraryName: DIAGNOSTIC_CONTEXT7_LIBRARY_NAME,
|
|
41
43
|
onDispatch: input.onDispatch,
|
|
42
44
|
query: DIAGNOSTIC_CONTEXT7_QUERY,
|
|
43
45
|
signal: input.signal,
|
|
@@ -49,6 +49,7 @@ export interface Context7CacheRepository {
|
|
|
49
49
|
/** Cache identity includes every bounded input that can change a successful resolve value. */
|
|
50
50
|
export declare function context7ResolveCacheKey(input: {
|
|
51
51
|
readonly baseUrl: string;
|
|
52
|
+
readonly libraryName: string;
|
|
52
53
|
readonly query: string;
|
|
53
54
|
readonly maxResults: number;
|
|
54
55
|
readonly maxLibraryTextCharacters: number;
|
|
@@ -40,11 +40,15 @@ export function context7ResolveCacheKey(input) {
|
|
|
40
40
|
positiveSafeInteger(input.maxResults, 'maxResults');
|
|
41
41
|
positiveSafeInteger(input.maxLibraryTextCharacters, 'maxLibraryTextCharacters');
|
|
42
42
|
positiveSafeInteger(input.maxEntryBytes, 'maxEntryBytes');
|
|
43
|
+
const libraryName = input.libraryName.trim();
|
|
43
44
|
const query = input.query.trim();
|
|
45
|
+
if (libraryName.length === 0)
|
|
46
|
+
throw new RangeError('Context7 library name must not be empty');
|
|
44
47
|
if (query.length === 0)
|
|
45
48
|
throw new RangeError('Context7 resolve query must not be empty');
|
|
46
49
|
return `ctx7r_${digestIdentity('resolve', {
|
|
47
50
|
baseUrl: normalizedBaseUrl(input.baseUrl),
|
|
51
|
+
libraryName,
|
|
48
52
|
maxEntryBytes: input.maxEntryBytes,
|
|
49
53
|
maxLibraryTextCharacters: input.maxLibraryTextCharacters,
|
|
50
54
|
maxResults: input.maxResults,
|
|
@@ -174,6 +174,7 @@ export class Context7CachedOperations {
|
|
|
174
174
|
throwIfAborted(input.signal);
|
|
175
175
|
const cacheKey = context7ResolveCacheKey({
|
|
176
176
|
baseUrl: input.config.providers.context7.baseUrl,
|
|
177
|
+
libraryName: input.libraryName,
|
|
177
178
|
maxEntryBytes: input.config.cache.context7EntryMaxBytes,
|
|
178
179
|
maxLibraryTextCharacters: input.config.cache.context7LibraryTextMaxCharacters,
|
|
179
180
|
maxResults: input.maxResults,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CONTEXT7_CACHE_DOMAIN_NAME, CONTEXT7_CACHE_DOMAIN_SPEC, CONTEXT7_CACHE_FORMAT_VERSION, CONTEXT7_CACHE_KEY_PATTERN, CONTEXT7_CACHE_TABLE_NAME, CONTEXT7_DOC_REF_PATTERN, CachedContext7LibrarySchema, CachedDocumentationSnippetSchema, Context7CacheEntrySchema, Context7CacheKeySchema, Context7DocsCacheEntrySchema, Context7DocRefSchema, Context7ResolveCacheEntrySchema, type CachedContext7Library, type CachedDocumentationSnippet, type Context7CacheDomain, type Context7CacheEntry, type Context7CacheKey, type Context7DocsCacheEntry, type Context7DocRef, type Context7ResolveCacheEntry, } from './cache-domain.js';
|
|
2
2
|
export { CONTEXT7_CACHE_QUERY_MAX_SCAN_RECORDS, CONTEXT7_CACHE_QUERY_MAX_TERMS, CONTEXT7_CACHE_QUERY_MAX_TEXT_CHARACTERS, Context7CacheError, Context7CacheStore, PersistentContext7Cache, context7DocsCacheKey, context7ResolveCacheKey, isContext7DocRef, type Context7CacheErrorCode, type Context7CacheLimits, type Context7CacheRepository, type Context7CacheWriteResult, type Context7CachedDocFound, type Context7CachedDocLookup, type Context7CachedDocMatch, type Context7CachedDocMatchFound, type Context7CachedDocMatchNotFound, type Context7CachedDocNotFound, type Context7CachedDocQuery, } from './cache.js';
|
|
3
3
|
export { CONTEXT7_CACHE_STATES, Context7CachedOperations, Context7OperationFailure, context7CacheEntryIsFresh, isContext7LibraryId, normalizeContext7LibraryId, permitsContext7StaleFallback, type CachedContext7Operation, type Context7CacheClock, type Context7CacheState, type Context7DocsCachedInput, type Context7DocsRemoteResult, type Context7OperationPath, type Context7RemoteDiagnostics, type Context7ResolveCachedInput, type Context7ResolveRemoteResult, } from './context7-cache.js';
|
|
4
|
-
export { DOCUMENTATION_CACHE_PATH_STATES, DOCUMENTATION_CACHE_SKIP_REASONS, DOCUMENTATION_PROVIDER_STATES, DOCUMENTATION_RESULT_PROVIDERS, DOCUMENTATION_SEARCH_PROVIDERS, DOCUMENTATION_SEARCH_SERVICE_KEY, DOCUMENTATION_WARNING_CODES,
|
|
4
|
+
export { DOCUMENTATION_CACHE_PATH_STATES, DOCUMENTATION_CACHE_SKIP_REASONS, DOCUMENTATION_PROVIDER_STATES, DOCUMENTATION_RESULT_PROVIDERS, DOCUMENTATION_SEARCH_PROVIDERS, DOCUMENTATION_SEARCH_SERVICE_KEY, DOCUMENTATION_WARNING_CODES, DocumentationSearchInfrastructureError, DocumentationSearchService, type Context7CachedDocSearchInput, type Context7DocsInput, type Context7DocsResult, type Context7ResolveInput, type Context7ResolveResult, type DocumentationCachePath, type DocumentationCachePathState, type DocumentationCacheReport, type DocumentationCacheSkipReason, type DocumentationProviderState, type DocumentationProviderStatus, type DocumentationResultProvider, type DocumentationSearchDependencies, type DocumentationSearchInput, type DocumentationSearchProvider, type DocumentationSearchResult, type DocumentationWarning, type DocumentationWarningCode, } from './service.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CONTEXT7_CACHE_DOMAIN_NAME, CONTEXT7_CACHE_DOMAIN_SPEC, CONTEXT7_CACHE_FORMAT_VERSION, CONTEXT7_CACHE_KEY_PATTERN, CONTEXT7_CACHE_TABLE_NAME, CONTEXT7_DOC_REF_PATTERN, CachedContext7LibrarySchema, CachedDocumentationSnippetSchema, Context7CacheEntrySchema, Context7CacheKeySchema, Context7DocsCacheEntrySchema, Context7DocRefSchema, Context7ResolveCacheEntrySchema, } from './cache-domain.js';
|
|
2
2
|
export { CONTEXT7_CACHE_QUERY_MAX_SCAN_RECORDS, CONTEXT7_CACHE_QUERY_MAX_TERMS, CONTEXT7_CACHE_QUERY_MAX_TEXT_CHARACTERS, Context7CacheError, Context7CacheStore, PersistentContext7Cache, context7DocsCacheKey, context7ResolveCacheKey, isContext7DocRef, } from './cache.js';
|
|
3
3
|
export { CONTEXT7_CACHE_STATES, Context7CachedOperations, Context7OperationFailure, context7CacheEntryIsFresh, isContext7LibraryId, normalizeContext7LibraryId, permitsContext7StaleFallback, } from './context7-cache.js';
|
|
4
|
-
export { DOCUMENTATION_CACHE_PATH_STATES, DOCUMENTATION_CACHE_SKIP_REASONS, DOCUMENTATION_PROVIDER_STATES, DOCUMENTATION_RESULT_PROVIDERS, DOCUMENTATION_SEARCH_PROVIDERS, DOCUMENTATION_SEARCH_SERVICE_KEY, DOCUMENTATION_WARNING_CODES,
|
|
4
|
+
export { DOCUMENTATION_CACHE_PATH_STATES, DOCUMENTATION_CACHE_SKIP_REASONS, DOCUMENTATION_PROVIDER_STATES, DOCUMENTATION_RESULT_PROVIDERS, DOCUMENTATION_SEARCH_PROVIDERS, DOCUMENTATION_SEARCH_SERVICE_KEY, DOCUMENTATION_WARNING_CODES, DocumentationSearchInfrastructureError, DocumentationSearchService, } from './service.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,7 +3,7 @@ import type { Config } from '../config.js';
|
|
|
3
3
|
import type { CanonicalSource, SourceRecordCandidate } from '../contracts/index.js';
|
|
4
4
|
import { type ProviderAttemptRecord, type ProviderErrorKind } from '../provider-runtime/index.js';
|
|
5
5
|
import { type Context7RemoteClient, type Context7Library } from '../providers/context7.js';
|
|
6
|
-
import type { BoundedSourceProvider, DocumentationSnippet
|
|
6
|
+
import type { BoundedSourceProvider, DocumentationSnippet } from '../providers/types.js';
|
|
7
7
|
import type { Context7DocsCacheEntry, Context7DocRef } from './cache-domain.js';
|
|
8
8
|
import { type Context7CachedDocLookup, type Context7CachedDocMatch } from './cache.js';
|
|
9
9
|
import { Context7CachedOperations, type Context7OperationPath } from './context7-cache.js';
|
|
@@ -43,7 +43,10 @@ export interface DocumentationWarning {
|
|
|
43
43
|
export interface DocumentationSearchInput {
|
|
44
44
|
readonly query: string;
|
|
45
45
|
readonly provider?: DocumentationSearchProvider;
|
|
46
|
+
/** Exact Context7 id; when present it takes priority and bypasses resolve. */
|
|
46
47
|
readonly libraryId?: string;
|
|
48
|
+
/** Explicit Context7 package/product identity; never inferred from query. */
|
|
49
|
+
readonly libraryName?: string;
|
|
47
50
|
readonly maxResults: number;
|
|
48
51
|
readonly forceRefresh?: boolean;
|
|
49
52
|
readonly signal: AbortSignal;
|
|
@@ -138,8 +141,8 @@ declare module '@deepseek-ai/cordis' {
|
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
/**
|
|
141
|
-
* Lifecycle-bound documentation core shared by the high-level docs Consumer
|
|
142
|
-
*
|
|
144
|
+
* Lifecycle-bound documentation core shared by the high-level docs Consumer
|
|
145
|
+
* and the deferred granular Context7 Consumers.
|
|
143
146
|
*/
|
|
144
147
|
export declare class DocumentationSearchService extends Service {
|
|
145
148
|
private readonly context7;
|
|
@@ -167,13 +170,4 @@ export declare class DocumentationSearchService extends Service {
|
|
|
167
170
|
private runContext7;
|
|
168
171
|
private runExa;
|
|
169
172
|
}
|
|
170
|
-
/** Context7-only adapter used by web_search while sharing the high-level service/cache. */
|
|
171
|
-
export declare class DocumentationContext7Provider implements BoundedSourceProvider {
|
|
172
|
-
private readonly documentation;
|
|
173
|
-
readonly capability: "docs_search";
|
|
174
|
-
readonly provider: "context7";
|
|
175
|
-
constructor(documentation: DocumentationSearchService);
|
|
176
|
-
configured(): Promise<boolean>;
|
|
177
|
-
search(input: SourceProviderSearchInput): Promise<SourceProviderSearchOutcome>;
|
|
178
|
-
}
|
|
179
173
|
//# sourceMappingURL=service.d.ts.map
|