dsh-web-search-enhanced 0.0.3 → 0.0.4
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 -1
- package/README.md +11 -2
- package/lib/index.js +24 -8
- package/lib/types/protocols.d.ts +1 -0
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the `dsh-web-search-enhanced` package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.0.4] - 2026-09-03
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **DSH 0.1.2-rc.1 Minimum Requirement & Compatibility**: Updated `engines.dsh` to `>= 0.1.2-rc.1` and `peerDependencies` across all `@deepseek-ai/dsh-*` packages to `^0.1.2-rc.1`.
|
|
9
|
+
- **RC-Only Support Policy**: Formally documented in `README.md` that the plugin exclusively supports DSH Release Candidate (RC) versions with a minimum requirement of `>= 0.1.2-rc.1`, and does not support intermediate alpha/beta/nightly snapshots.
|
|
10
|
+
- **Anthropic Endpoint Normalization**: Aligned with upstream PR #3451 specifications; added automatic normalization for Anthropic Messages `baseURL` with or without trailing `/v1` (e.g., `https://api.anthropic.com` safely resolves to `/v1/messages`), preventing 404 errors on official Anthropic endpoints and compatible gateways.
|
|
11
|
+
- **Out-of-the-Box Credential Fallback**: Added automatic fallback to `DEEPSEEK_API_KEY` when `apiKeyEnv` remains at default `WEB_SEARCH_ENHANCED_API` and the target endpoint is DeepSeek, enabling seamless drop-in replacement of the native search provider without redundant credential re-entry.
|
|
12
|
+
- **Client Build Defines Alignment**: Updated `tsdown.config.ts` define configuration to supply the root `import.meta.env` object alongside `import.meta.env.MODE`, matching upstream preset conventions and preventing property-probe runtime errors in bundled client libraries.
|
|
13
|
+
- **Egress & Compatibility Tests**: Added `tests/egress.spec.ts` and updated `tests/protocols.spec.ts` and `tests/plugin.spec.ts` to cover endpoint normalization and credential fallback behaviors.
|
|
14
|
+
|
|
5
15
|
## [0.0.3] - 2026-08-31
|
|
6
16
|
|
|
7
17
|
### Fixed
|
|
@@ -21,4 +31,4 @@ All notable changes to the `dsh-web-search-enhanced` package will be documented
|
|
|
21
31
|
- Initial release of `dsh-web-search-enhanced`.
|
|
22
32
|
- Support for Anthropic Messages, OpenAI Responses, and OpenAI Chat Completions search protocols.
|
|
23
33
|
- Follow mode (`current-session`) and fixed search configuration mode.
|
|
24
|
-
- DeepSeek Harness Web GUI settings card integration.
|
|
34
|
+
- DeepSeek Harness Web GUI settings card integration.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/dsh-web-search-enhanced)
|
|
4
4
|
[](LICENSE)
|
|
5
|
-
[-blueviolet)](https://github.com/deepseek-ai/deepseek-harness)
|
|
6
6
|
|
|
7
7
|
**dsh-web-search-enhanced** 是为 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 量身打造的增强型多协议联网搜索插件。
|
|
8
8
|
|
|
@@ -32,6 +32,15 @@
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
+
## 📋 版本兼容与支持策略 (Compatibility & Requirements)
|
|
36
|
+
|
|
37
|
+
- **最低支持的 DSH 版本**:`>= 0.1.2-rc.1`
|
|
38
|
+
- **版本支持范围声明**:
|
|
39
|
+
> ⚠️ **重要声明**:**本插件仅对 DeepSeek Harness 的 Release Candidate (RC) 版本进行官方维护与兼容性支持(最低版本要求为 0.1.2-rc.1)**。
|
|
40
|
+
> 插件不提供对开发中的 Alpha / Beta / Nightly 构建版本的稳定性承诺与 API 兼容保证。在升级 DSH 或使用本插件时,请确保运行环境使用的是官方正式的 RC 发布版本。
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
35
44
|
## 📦 快速安装
|
|
36
45
|
|
|
37
46
|
插件已正式发布至 npmjs,使用 DSH CLI 即可一键安装到 `web` Profile:
|
|
@@ -238,4 +247,4 @@ npx vitest run
|
|
|
238
247
|
|
|
239
248
|
## 📄 开源许可证
|
|
240
249
|
|
|
241
|
-
本项目基于 [MIT License](LICENSE) 开源。
|
|
250
|
+
本项目基于 [MIT License](LICENSE) 开源。
|
package/lib/index.js
CHANGED
|
@@ -22,11 +22,11 @@ function buildWireRequest(config, query, apiKey) {
|
|
|
22
22
|
const commonHeaders = {
|
|
23
23
|
"accept": "application/json",
|
|
24
24
|
"content-type": "application/json",
|
|
25
|
-
"user-agent": "dsh-web-search-enhanced/0.0.
|
|
25
|
+
"user-agent": "dsh-web-search-enhanced/0.0.4"
|
|
26
26
|
};
|
|
27
27
|
switch (config.protocol) {
|
|
28
28
|
case "anthropic-messages": return {
|
|
29
|
-
endpoint: appendEndpoint(config.baseURL,
|
|
29
|
+
endpoint: appendEndpoint(config.baseURL, config.protocol),
|
|
30
30
|
headers: {
|
|
31
31
|
...commonHeaders,
|
|
32
32
|
"anthropic-version": config.apiVersion,
|
|
@@ -51,7 +51,7 @@ function buildWireRequest(config, query, apiKey) {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
case "openai-responses": return {
|
|
54
|
-
endpoint: appendEndpoint(config.baseURL,
|
|
54
|
+
endpoint: appendEndpoint(config.baseURL, config.protocol),
|
|
55
55
|
headers: {
|
|
56
56
|
...commonHeaders,
|
|
57
57
|
authorization: `Bearer ${apiKey}`
|
|
@@ -87,7 +87,7 @@ function buildWireRequest(config, query, apiKey) {
|
|
|
87
87
|
const optionsField = config.chatSearchMode === "search-model" ? "web_search_options" : config.toolIdentifier;
|
|
88
88
|
body[optionsField] = config.searchContextSize === void 0 ? {} : { search_context_size: config.searchContextSize };
|
|
89
89
|
return {
|
|
90
|
-
endpoint: appendEndpoint(config.baseURL,
|
|
90
|
+
endpoint: appendEndpoint(config.baseURL, config.protocol),
|
|
91
91
|
headers: {
|
|
92
92
|
...commonHeaders,
|
|
93
93
|
authorization: `Bearer ${apiKey}`
|
|
@@ -186,9 +186,12 @@ function parseChatCompletionsResponse(payload) {
|
|
|
186
186
|
truncated: false
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
function appendEndpoint(baseURL,
|
|
189
|
+
function appendEndpoint(baseURL, protocol) {
|
|
190
190
|
const trimmed = baseURL.replace(/\/+$/u, "");
|
|
191
|
-
|
|
191
|
+
const suffix = ENDPOINT_SUFFIX[protocol];
|
|
192
|
+
if (trimmed.toLowerCase().endsWith(suffix)) return trimmed;
|
|
193
|
+
if (protocol === "anthropic-messages") return `${trimmed.endsWith("/v1") ? trimmed.slice(0, -3) : trimmed}/v1/messages`;
|
|
194
|
+
return trimmed + suffix;
|
|
192
195
|
}
|
|
193
196
|
function addSource(target, value, forcedSnippet) {
|
|
194
197
|
if (value === void 0) return;
|
|
@@ -503,8 +506,21 @@ function apply(ctx, config) {
|
|
|
503
506
|
if (runtime.apiKey !== void 0 && runtime.apiKey.length > 0) return runtime.apiKey;
|
|
504
507
|
const ref = credentialRef(runtime.apiKeyEnv);
|
|
505
508
|
const credentials = ctx.get("credentials");
|
|
506
|
-
if (credentials !== void 0)
|
|
507
|
-
|
|
509
|
+
if (credentials !== void 0) {
|
|
510
|
+
const resolvedValue = (await credentials.resolve(ref))?.value;
|
|
511
|
+
if (resolvedValue !== void 0 && resolvedValue.length > 0) return resolvedValue;
|
|
512
|
+
}
|
|
513
|
+
const ambient = launchEnvironmentOf(ctx).get(runtime.apiKeyEnv)?.value;
|
|
514
|
+
if (ambient !== void 0 && ambient.length > 0) return ambient;
|
|
515
|
+
if (runtime.apiKeyEnv === "WEB_SEARCH_ENHANCED_API" && runtime.baseURL.includes("deepseek.com")) {
|
|
516
|
+
const dsRef = credentialRef("DEEPSEEK_API_KEY");
|
|
517
|
+
if (credentials !== void 0) {
|
|
518
|
+
const dsVal = (await credentials.resolve(dsRef))?.value;
|
|
519
|
+
if (dsVal !== void 0 && dsVal.length > 0) return dsVal;
|
|
520
|
+
}
|
|
521
|
+
const dsAmbient = launchEnvironmentOf(ctx).get("DEEPSEEK_API_KEY")?.value;
|
|
522
|
+
if (dsAmbient !== void 0 && dsAmbient.length > 0) return dsAmbient;
|
|
523
|
+
}
|
|
508
524
|
}).search(request, signal);
|
|
509
525
|
}
|
|
510
526
|
};
|
package/lib/types/protocols.d.ts
CHANGED
|
@@ -42,4 +42,5 @@ export declare function parseAnthropicResponse(payload: unknown): WebSearchResul
|
|
|
42
42
|
export declare function parseResponsesResponse(payload: unknown): WebSearchResult;
|
|
43
43
|
/** Parse Chat Completions message text and URL citation annotations. */
|
|
44
44
|
export declare function parseChatCompletionsResponse(payload: unknown): WebSearchResult;
|
|
45
|
+
export declare function appendEndpoint(baseURL: string, protocol: SearchProtocol): string;
|
|
45
46
|
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-web-search-enhanced",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Multi-protocol web_search provider for DeepSeek Harness",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "^22.19.0 || >=24.0.0",
|
|
9
|
-
"dsh": ">=0.1.
|
|
9
|
+
"dsh": ">=0.1.2-rc.1"
|
|
10
10
|
},
|
|
11
11
|
"main": "./lib/index.js",
|
|
12
12
|
"types": "./lib/types/index.d.ts",
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
56
|
-
"@deepseek-ai/dsh-credentials": "^0.1.
|
|
57
|
-
"@deepseek-ai/dsh-launch-environment": "^0.1.
|
|
58
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
59
|
-
"@deepseek-ai/dsh-client-runtime": "^0.1.
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.
|
|
63
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.
|
|
64
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
65
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
66
|
-
"@deepseek-ai/dsh-web": "^0.1.
|
|
56
|
+
"@deepseek-ai/dsh-credentials": "^0.1.2-rc.1",
|
|
57
|
+
"@deepseek-ai/dsh-launch-environment": "^0.1.2-rc.1",
|
|
58
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.2-rc.1",
|
|
59
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.2-rc.1",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.2-rc.1",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.2-rc.1",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.2-rc.1",
|
|
63
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.2-rc.1",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.2-rc.1",
|
|
65
|
+
"@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
|
|
66
|
+
"@deepseek-ai/dsh-web": "^0.1.2-rc.1",
|
|
67
67
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
68
68
|
"react": "^18.2.0"
|
|
69
69
|
},
|
|
@@ -92,17 +92,17 @@
|
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
95
|
-
"@deepseek-ai/dsh-credentials": "^0.1.
|
|
96
|
-
"@deepseek-ai/dsh-launch-environment": "^0.1.
|
|
97
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
98
|
-
"@deepseek-ai/dsh-client-runtime": "^0.1.
|
|
99
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.
|
|
100
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.
|
|
101
|
-
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.
|
|
102
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.
|
|
103
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
104
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
105
|
-
"@deepseek-ai/dsh-web": "^0.1.
|
|
95
|
+
"@deepseek-ai/dsh-credentials": "^0.1.2-rc.1",
|
|
96
|
+
"@deepseek-ai/dsh-launch-environment": "^0.1.2-rc.1",
|
|
97
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.2-rc.1",
|
|
98
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.2-rc.1",
|
|
99
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.2-rc.1",
|
|
100
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.2-rc.1",
|
|
101
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.2-rc.1",
|
|
102
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.2-rc.1",
|
|
103
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.2-rc.1",
|
|
104
|
+
"@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
|
|
105
|
+
"@deepseek-ai/dsh-web": "^0.1.2-rc.1",
|
|
106
106
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
107
107
|
"@types/node": "^22.20.0",
|
|
108
108
|
"@types/react": "~18.3.1",
|