@deepseek-ai/dsh-web-search-deepseek 0.1.6-alpha.2 → 0.1.7-alpha.2
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.i18n.yaml +2 -2
- package/README.md +4 -4
- package/README.zh.md +4 -4
- package/lib/index.js +21 -29
- package/lib/types/index.d.ts +25 -8
- package/package.json +16 -18
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/web/web-search-deepseek/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 6ac35d899ebfc281a3d830bd6050be46309f4ec9
|
|
6
|
+
README.zh.md: 7693a7470872b59065e66cdf2d71e41bb9a1e016
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Choose this backend when a deployment wants DeepSeek's native server-side web se
|
|
|
33
33
|
|
|
34
34
|
### Minimal configuration
|
|
35
35
|
|
|
36
|
-
Load the web service and the provider; the key resolves from `ctx.credentials` when that service is mounted, otherwise from the process environment. The auxiliary search call has its own endpoint setting and uses the Anthropic-compatible base `https://api.deepseek.com/anthropic/v1`, with `/messages` appended. It reads `$DEEPSEEK_SEARCH_BASE_URL`, independently of the conversation adapter’s `$DEEPSEEK_BASE_URL
|
|
36
|
+
Load the web service and the provider; the key resolves from `ctx.credentials` when that service is mounted, otherwise from the process environment. The auxiliary search call has its own endpoint setting and uses the Anthropic-compatible base `https://api.deepseek.com/anthropic/v1`, with `/messages` appended. It reads `$DEEPSEEK_SEARCH_BASE_URL`, independently of the conversation adapter’s `$DEEPSEEK_BASE_URL`.
|
|
37
37
|
|
|
38
38
|
```yaml
|
|
39
39
|
- name: '@deepseek-ai/dsh-web'
|
|
@@ -53,7 +53,7 @@ Load the web service and the provider; the key resolves from `ctx.credentials` w
|
|
|
53
53
|
| `maxTokens` | `4096` | Positive-integer upper bound on generated tokens for the Messages request |
|
|
54
54
|
| `maxUses` | `5` | Positive-integer maximum `web_search` server-tool uses per request |
|
|
55
55
|
|
|
56
|
-
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-web-search-deepseek)
|
|
56
|
+
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-web-search-deepseek) lists every accepted field. Each search captures options from the live Config references.
|
|
57
57
|
|
|
58
58
|
### What a search returns
|
|
59
59
|
|
|
@@ -88,14 +88,14 @@ The provider is built on two commitments:
|
|
|
88
88
|
|
|
89
89
|
| File | Role |
|
|
90
90
|
|---|---|
|
|
91
|
-
| [`src/index.ts`](src/index.ts) |
|
|
91
|
+
| [`src/index.ts`](src/index.ts) | Config schema and per-search option capture |
|
|
92
92
|
| [`src/provider.ts`](src/provider.ts) | The `DeepSeekSearchProvider`: Messages request dispatch, block parsing, citation joining, credential resolution |
|
|
93
93
|
| [`src/types.ts`](src/types.ts) | Anthropic wire types for the search response |
|
|
94
94
|
| — | No runtime invariant companion is published; the package emits a pre-dispatch log event but owns no later authoritative dispatch event to relate it to. Exact envelope equality is pinned at the provider boundary instead. |
|
|
95
95
|
|
|
96
96
|
### Request flow
|
|
97
97
|
|
|
98
|
-
Each search
|
|
98
|
+
Each search captures the current Config values into provider options — endpoint, model, key reference, limits — then resolves the credential reference through `ctx.credentials` (or the environment), appends the log-only session event, and dispatches the Messages request with the native `web_search` server tool. The response's `web_search_tool_result` blocks become `sources[]`; `cited_text` entries from text blocks are joined to their URLs as snippets; results are deduplicated by URL; and the service enforces the requested source bound on the way back.
|
|
99
99
|
|
|
100
100
|
</details>
|
|
101
101
|
|
package/README.zh.md
CHANGED
|
@@ -33,7 +33,7 @@ kind: "package-reference"
|
|
|
33
33
|
|
|
34
34
|
### 最小配置
|
|
35
35
|
|
|
36
|
-
加载 web 服务与本提供方;密钥在已挂载 `ctx.credentials` 服务时从其解析,否则从进程环境解析。辅助搜索调用有独立的端点设置,使用 Anthropic 兼容基址 `https://api.deepseek.com/anthropic/v1`,并追加 `/messages`。它读取 `$DEEPSEEK_SEARCH_BASE_URL`,与会话适配器的 `$DEEPSEEK_BASE_URL`
|
|
36
|
+
加载 web 服务与本提供方;密钥在已挂载 `ctx.credentials` 服务时从其解析,否则从进程环境解析。辅助搜索调用有独立的端点设置,使用 Anthropic 兼容基址 `https://api.deepseek.com/anthropic/v1`,并追加 `/messages`。它读取 `$DEEPSEEK_SEARCH_BASE_URL`,与会话适配器的 `$DEEPSEEK_BASE_URL` 相互独立。
|
|
37
37
|
|
|
38
38
|
```yaml
|
|
39
39
|
- name: '@deepseek-ai/dsh-web'
|
|
@@ -53,7 +53,7 @@ kind: "package-reference"
|
|
|
53
53
|
| `maxTokens` | `4096` | Messages 请求生成 token 的正整数上限 |
|
|
54
54
|
| `maxUses` | `5` | 每次请求使用 `web_search` 服务器工具的正整数上限 |
|
|
55
55
|
|
|
56
|
-
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-web-search-deepseek)
|
|
56
|
+
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-web-search-deepseek) 列出所有接受的字段。每次搜索从即时 Config 引用捕获选项。
|
|
57
57
|
|
|
58
58
|
### 搜索返回什么
|
|
59
59
|
|
|
@@ -88,14 +88,14 @@ kind: "package-reference"
|
|
|
88
88
|
|
|
89
89
|
| 文件 | 职责 |
|
|
90
90
|
|---|---|
|
|
91
|
-
| [`src/index.ts`](src/index.ts) |
|
|
91
|
+
| [`src/index.ts`](src/index.ts) | Config schema 与每次搜索的选项捕获 |
|
|
92
92
|
| [`src/provider.ts`](src/provider.ts) | `DeepSeekSearchProvider`:Messages 请求分发、块解析、引用拼接、凭据解析 |
|
|
93
93
|
| [`src/types.ts`](src/types.ts) | 搜索响应的 Anthropic 协议类型 |
|
|
94
94
|
| — | 不发布运行时不变量配套入口;本包会在分发前发出日志事件,但没有后续的权威分发事件可与之关联;精确的请求包络相等性改由提供方边界保障。 |
|
|
95
95
|
|
|
96
96
|
### 请求流程
|
|
97
97
|
|
|
98
|
-
每次搜索先把当前
|
|
98
|
+
每次搜索先把当前 Config 段投影为提供方选项——端点、模型、密钥引用、上限——然后通过 `ctx.credentials`(或环境)解析凭据引用,追加仅用于日志的会话事件,并以原生 `web_search` 服务器工具分发 Messages 请求。响应中的 `web_search_tool_result` 块变为 `sources[]`;文本块中的 `cited_text` 条目按其 URL 拼接为 snippet;结果按 URL 去重;服务在返回路径上强制执行请求的来源上限。
|
|
99
99
|
|
|
100
100
|
</details>
|
|
101
101
|
|
package/lib/index.js
CHANGED
|
@@ -229,25 +229,18 @@ function isPositiveInteger(value) {
|
|
|
229
229
|
}
|
|
230
230
|
//#endregion
|
|
231
231
|
//#region lib/types/index.js
|
|
232
|
-
/**
|
|
233
|
-
* Register a DeepSeek-backed provider in `ctx.web`. It calls the Anthropic-compatible Messages API
|
|
234
|
-
* with native `web_search_20250305`. The provider reuses `DEEPSEEK_API_KEY` but not
|
|
235
|
-
* `DEEPSEEK_BASE_URL`; auxiliary search has its own endpoint configuration.
|
|
236
|
-
* @module @deepseek-ai/dsh-web-search-deepseek
|
|
237
|
-
*/
|
|
238
232
|
/** Cordis plugin name used by loader diagnostics. */
|
|
239
233
|
const name = "web-search-deepseek";
|
|
240
234
|
/** The web seam this provider registers into. */
|
|
241
235
|
const inject = ["web"];
|
|
242
|
-
const DEFAULT_API_KEY_ENV = "DEEPSEEK_API_KEY";
|
|
243
236
|
const Config = z.object({
|
|
244
|
-
apiKey: z.string().role("secret"),
|
|
245
|
-
apiKeyEnv: z.string().role("credential-ref").default(
|
|
246
|
-
baseURL: z.string(),
|
|
247
|
-
model: z.string().default(DEEPSEEK_DEFAULT_MODEL),
|
|
248
|
-
apiVersion: z.string().default(DEEPSEEK_DEFAULT_API_VERSION),
|
|
249
|
-
maxTokens: z.number().step(1).min(1).default(DEEPSEEK_DEFAULT_MAX_TOKENS),
|
|
250
|
-
maxUses: z.number().step(1).min(1).default(5)
|
|
237
|
+
apiKey: z.string().role("secret").volatile(),
|
|
238
|
+
apiKeyEnv: z.string().role("credential-ref").default("DEEPSEEK_API_KEY").volatile(),
|
|
239
|
+
baseURL: z.string().volatile(),
|
|
240
|
+
model: z.string().default(DEEPSEEK_DEFAULT_MODEL).volatile(),
|
|
241
|
+
apiVersion: z.string().default(DEEPSEEK_DEFAULT_API_VERSION).volatile(),
|
|
242
|
+
maxTokens: z.number().step(1).min(1).default(DEEPSEEK_DEFAULT_MAX_TOKENS).volatile(),
|
|
243
|
+
maxUses: z.number().step(1).min(1).default(5).volatile()
|
|
251
244
|
});
|
|
252
245
|
/**
|
|
253
246
|
* Auxiliary-search endpoint, independent of the conversation adapter's
|
|
@@ -265,7 +258,7 @@ const WEB_SEARCH_DEEPSEEK_SETTINGS_NAMESPACE = "web-search-deepseek";
|
|
|
265
258
|
* @returns options for one search.
|
|
266
259
|
*/
|
|
267
260
|
function resolveOptions(ctx, config) {
|
|
268
|
-
const apiKeyEnv = credentialRef(config.apiKeyEnv
|
|
261
|
+
const apiKeyEnv = credentialRef(config.apiKeyEnv);
|
|
269
262
|
const literalApiKey = config.apiKey !== void 0 && config.apiKey.length > 0 ? config.apiKey : void 0;
|
|
270
263
|
return {
|
|
271
264
|
...literalApiKey === void 0 ? {} : { apiKey: literalApiKey },
|
|
@@ -277,10 +270,10 @@ function resolveOptions(ctx, config) {
|
|
|
277
270
|
},
|
|
278
271
|
apiKeyEnv,
|
|
279
272
|
baseURL: config.baseURL ?? launchEnvironmentOf(ctx).get(SEARCH_BASE_URL_ENV)?.value ?? "https://api.deepseek.com/anthropic/v1",
|
|
280
|
-
model: config.model
|
|
281
|
-
apiVersion: config.apiVersion
|
|
282
|
-
maxTokens: config.maxTokens
|
|
283
|
-
maxUses: config.maxUses
|
|
273
|
+
model: config.model,
|
|
274
|
+
apiVersion: config.apiVersion,
|
|
275
|
+
maxTokens: config.maxTokens,
|
|
276
|
+
maxUses: config.maxUses,
|
|
284
277
|
recordRequest: (request) => {
|
|
285
278
|
ctx.get("agents")?.currentInitiator()?.session.append("web/deepseek-search-llm-request", request);
|
|
286
279
|
}
|
|
@@ -288,16 +281,15 @@ function resolveOptions(ctx, config) {
|
|
|
288
281
|
}
|
|
289
282
|
/** Register the DeepSeek search provider with `ctx.web`. */
|
|
290
283
|
function apply(ctx, config) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
});
|
|
300
|
-
ctx.web.registerSearchProvider(new DeepSeekSearchProvider(() => resolveOptions(ctx, current())));
|
|
284
|
+
ctx.web.registerSearchProvider(new DeepSeekSearchProvider(() => resolveOptions(ctx, {
|
|
285
|
+
apiKey: config.apiKey.get(),
|
|
286
|
+
apiKeyEnv: config.apiKeyEnv.get(),
|
|
287
|
+
baseURL: config.baseURL.get(),
|
|
288
|
+
model: config.model.get(),
|
|
289
|
+
apiVersion: config.apiVersion.get(),
|
|
290
|
+
maxTokens: config.maxTokens.get(),
|
|
291
|
+
maxUses: config.maxUses.get()
|
|
292
|
+
})));
|
|
301
293
|
}
|
|
302
294
|
//#endregion
|
|
303
295
|
export { Config, DEEPSEEK_DEFAULT_API_VERSION, DEEPSEEK_DEFAULT_BASE_URL, DEEPSEEK_DEFAULT_MAX_TOKENS, DEEPSEEK_DEFAULT_MAX_USES, DEEPSEEK_DEFAULT_MODEL, DEEPSEEK_PROVIDER_ID, DeepSeekSearchProvider, WEB_SEARCH_DEEPSEEK_SETTINGS_NAMESPACE, apply, inject, name };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* `DEEPSEEK_BASE_URL`; auxiliary search has its own endpoint configuration.
|
|
5
5
|
* @module @deepseek-ai/dsh-web-search-deepseek
|
|
6
6
|
*/
|
|
7
|
+
import type { Volatile } from '@deepseek-ai/cordis';
|
|
7
8
|
import type { Context } from '@deepseek-ai/cordis';
|
|
8
9
|
import z from '@deepseek-ai/schemastery';
|
|
9
10
|
export { DeepSeekSearchProvider, DEEPSEEK_DEFAULT_API_VERSION, DEEPSEEK_DEFAULT_BASE_URL, DEEPSEEK_DEFAULT_MAX_TOKENS, DEEPSEEK_DEFAULT_MAX_USES, DEEPSEEK_DEFAULT_MODEL, DEEPSEEK_PROVIDER_ID, } from './provider.ts';
|
|
@@ -15,21 +16,37 @@ export declare const inject: string[];
|
|
|
15
16
|
/** Plugin config (all optional — `apply` fills env-var and constant defaults). */
|
|
16
17
|
export interface Config {
|
|
17
18
|
/** Literal DeepSeek API key; prefer {@link apiKeyEnv} so no secret enters configuration files. */
|
|
18
|
-
apiKey
|
|
19
|
+
apiKey: Volatile<string | undefined>;
|
|
19
20
|
/** Credential reference resolved for each search; defaults to `DEEPSEEK_API_KEY`. */
|
|
20
|
-
apiKeyEnv
|
|
21
|
+
apiKeyEnv: Volatile<string>;
|
|
21
22
|
/** Anthropic-compatible endpoint base; `/messages` is appended. */
|
|
22
|
-
baseURL
|
|
23
|
+
baseURL: Volatile<string | undefined>;
|
|
23
24
|
/** Anthropic-format model name. Defaults to `deepseek-v4-flash`. */
|
|
24
|
-
model
|
|
25
|
+
model: Volatile<string>;
|
|
25
26
|
/** `anthropic-version` header value. Defaults to `2023-06-01`. */
|
|
26
|
-
apiVersion
|
|
27
|
+
apiVersion: Volatile<string>;
|
|
27
28
|
/** Upper bound on generated tokens for the Messages request. Defaults to 4096. */
|
|
28
|
-
maxTokens
|
|
29
|
+
maxTokens: Volatile<number>;
|
|
29
30
|
/** Maximum `web_search` server-tool uses per request. Defaults to 5. */
|
|
30
|
-
maxUses
|
|
31
|
+
maxUses: Volatile<number>;
|
|
31
32
|
}
|
|
32
|
-
export declare const Config: z<
|
|
33
|
+
export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
34
|
+
apiKey: z<string, string, "volatile">;
|
|
35
|
+
apiKeyEnv: z<string, string, "volatile-defined">;
|
|
36
|
+
baseURL: z<string, string, "volatile">;
|
|
37
|
+
model: z<string, string, "volatile-defined">;
|
|
38
|
+
apiVersion: z<string, string, "volatile-defined">;
|
|
39
|
+
maxTokens: z<number, number, "volatile-defined">;
|
|
40
|
+
maxUses: z<number, number, "volatile-defined">;
|
|
41
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
42
|
+
apiKey: z<string, string, "volatile">;
|
|
43
|
+
apiKeyEnv: z<string, string, "volatile-defined">;
|
|
44
|
+
baseURL: z<string, string, "volatile">;
|
|
45
|
+
model: z<string, string, "volatile-defined">;
|
|
46
|
+
apiVersion: z<string, string, "volatile-defined">;
|
|
47
|
+
maxTokens: z<number, number, "volatile-defined">;
|
|
48
|
+
maxUses: z<number, number, "volatile-defined">;
|
|
49
|
+
}>>, "plain">;
|
|
33
50
|
/** Settings namespace carrying this provider's endpoint, model, and key reference. */
|
|
34
51
|
export declare const WEB_SEARCH_DEEPSEEK_SETTINGS_NAMESPACE = "web-search-deepseek";
|
|
35
52
|
/** Register the DeepSeek search provider with `ctx.web`. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-web-search-deepseek",
|
|
3
3
|
"description": "DeepSeek-backed search provider (native web_search via the Anthropic-compatible API) for the DeepSeek Harness web capability seam (ctx.web)",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,26 +27,24 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/dsh-
|
|
31
|
-
"@deepseek-ai/dsh-
|
|
32
|
-
"@deepseek-ai/dsh-launch-environment": "
|
|
33
|
-
"@deepseek-ai/dsh-session": "
|
|
34
|
-
"@deepseek-ai/
|
|
35
|
-
"@deepseek-ai/
|
|
36
|
-
"@deepseek-ai/dsh-settings": "^0.1.6-alpha.2"
|
|
30
|
+
"@deepseek-ai/dsh-credentials": "0.1.7-alpha.2",
|
|
31
|
+
"@deepseek-ai/dsh-agent": "0.1.7-alpha.2",
|
|
32
|
+
"@deepseek-ai/dsh-launch-environment": "0.1.7-alpha.2",
|
|
33
|
+
"@deepseek-ai/dsh-session": "0.1.7-alpha.2",
|
|
34
|
+
"@deepseek-ai/dsh-web": "0.1.7-alpha.2",
|
|
35
|
+
"@deepseek-ai/cordis": "~4.0.4"
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"@deepseek-ai/schemastery": "
|
|
38
|
+
"@deepseek-ai/schemastery": "~3.18.4"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@deepseek-ai/dsh-credentials": "
|
|
43
|
-
"@deepseek-ai/dsh-agent": "
|
|
44
|
-
"@deepseek-ai/dsh-credentials-local": "
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-web": "
|
|
48
|
-
"@deepseek-ai/cordis": "
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-http-proxy": "^0.1.6-alpha.2"
|
|
41
|
+
"@deepseek-ai/dsh-credentials": "0.1.7-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-agent": "0.1.7-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-credentials-local": "0.1.7-alpha.2",
|
|
44
|
+
"@deepseek-ai/dsh-session": "0.1.7-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-launch-environment": "0.1.7-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-web": "0.1.7-alpha.2",
|
|
47
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
48
|
+
"@deepseek-ai/dsh-http-proxy": "0.1.7-alpha.2"
|
|
51
49
|
}
|
|
52
50
|
}
|