@eum-agent/llm-provider-deepseek 1.1.0 → 1.2.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/dist/index.js +182 -37
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#endregion
|
|
2
2
|
//#region src/catalog.ts
|
|
3
|
-
/** Supplier-owned catalogue rows; protocol request facts belong to protocol registrations. */
|
|
4
3
|
const catalog = {
|
|
5
4
|
vendors: [{
|
|
6
5
|
kind: "vendor",
|
|
@@ -24,9 +23,9 @@ const catalog = {
|
|
|
24
23
|
}]
|
|
25
24
|
}],
|
|
26
25
|
snapshot: { "deepseek": {
|
|
27
|
-
"deepseek-v4-flash
|
|
28
|
-
"id": "deepseek-v4-flash
|
|
29
|
-
"name": "DeepSeek V4 Flash
|
|
26
|
+
"deepseek-v4-flash": {
|
|
27
|
+
"id": "deepseek-v4-flash",
|
|
28
|
+
"name": "DeepSeek V4 Flash",
|
|
30
29
|
"family": "deepseek-flash",
|
|
31
30
|
"reasoning": true,
|
|
32
31
|
"reasoning_options": [{ "type": "toggle" }, {
|
|
@@ -45,14 +44,14 @@ const catalog = {
|
|
|
45
44
|
"output": ["text"]
|
|
46
45
|
},
|
|
47
46
|
"limit": {
|
|
48
|
-
"context":
|
|
49
|
-
"output":
|
|
47
|
+
"context": 1048576,
|
|
48
|
+
"output": 393216
|
|
50
49
|
},
|
|
51
|
-
"release_date": "2026-
|
|
50
|
+
"release_date": "2026-10-17"
|
|
52
51
|
},
|
|
53
|
-
"deepseek-
|
|
54
|
-
"id": "deepseek-
|
|
55
|
-
"name": "DeepSeek V4 Flash",
|
|
52
|
+
"deepseek-flash": {
|
|
53
|
+
"id": "deepseek-flash",
|
|
54
|
+
"name": "DeepSeek V4.1 Flash 1017",
|
|
56
55
|
"family": "deepseek-flash",
|
|
57
56
|
"reasoning": true,
|
|
58
57
|
"reasoning_options": [{ "type": "toggle" }, {
|
|
@@ -71,10 +70,10 @@ const catalog = {
|
|
|
71
70
|
"output": ["text"]
|
|
72
71
|
},
|
|
73
72
|
"limit": {
|
|
74
|
-
"context":
|
|
75
|
-
"output":
|
|
73
|
+
"context": 1048576,
|
|
74
|
+
"output": 393216
|
|
76
75
|
},
|
|
77
|
-
"release_date": "2026-
|
|
76
|
+
"release_date": "2026-10-17"
|
|
78
77
|
},
|
|
79
78
|
"deepseek-v4-pro": {
|
|
80
79
|
"id": "deepseek-v4-pro",
|
|
@@ -83,7 +82,11 @@ const catalog = {
|
|
|
83
82
|
"reasoning": true,
|
|
84
83
|
"reasoning_options": [{ "type": "toggle" }, {
|
|
85
84
|
"type": "effort",
|
|
86
|
-
"values": [
|
|
85
|
+
"values": [
|
|
86
|
+
"low",
|
|
87
|
+
"high",
|
|
88
|
+
"max"
|
|
89
|
+
]
|
|
87
90
|
}],
|
|
88
91
|
"temperature": true,
|
|
89
92
|
"tool_call": true,
|
|
@@ -93,14 +96,14 @@ const catalog = {
|
|
|
93
96
|
"output": ["text"]
|
|
94
97
|
},
|
|
95
98
|
"limit": {
|
|
96
|
-
"context":
|
|
97
|
-
"output":
|
|
99
|
+
"context": 1048576,
|
|
100
|
+
"output": 393216
|
|
98
101
|
},
|
|
99
|
-
"release_date": "2026-08-
|
|
102
|
+
"release_date": "2026-08-13"
|
|
100
103
|
},
|
|
101
|
-
"deepseek-flash": {
|
|
102
|
-
"id": "deepseek-flash",
|
|
103
|
-
"name": "DeepSeek V4
|
|
104
|
+
"deepseek-v4-flash-vision-exp": {
|
|
105
|
+
"id": "deepseek-v4-flash-vision-exp",
|
|
106
|
+
"name": "DeepSeek V4 Flash Vision Exp",
|
|
104
107
|
"family": "deepseek-flash",
|
|
105
108
|
"reasoning": true,
|
|
106
109
|
"reasoning_options": [{ "type": "toggle" }, {
|
|
@@ -119,17 +122,167 @@ const catalog = {
|
|
|
119
122
|
"output": ["text"]
|
|
120
123
|
},
|
|
121
124
|
"limit": {
|
|
122
|
-
"context":
|
|
123
|
-
"output":
|
|
125
|
+
"context": 1048576,
|
|
126
|
+
"output": 393216
|
|
124
127
|
},
|
|
125
|
-
"release_date": "2026-
|
|
128
|
+
"release_date": "2026-10-17"
|
|
126
129
|
}
|
|
127
130
|
} },
|
|
128
|
-
snapshotAt: Date.parse("2026-
|
|
131
|
+
snapshotAt: Date.parse("2026-11-18")
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/facts.ts
|
|
135
|
+
const modelFacts = {
|
|
136
|
+
revisions: [],
|
|
137
|
+
presets: [
|
|
138
|
+
"deepseek-v4-flash-vision-exp",
|
|
139
|
+
"deepseek-v4-flash",
|
|
140
|
+
"deepseek-v4-pro",
|
|
141
|
+
"deepseek-flash"
|
|
142
|
+
].map((model) => ({
|
|
143
|
+
model,
|
|
144
|
+
entry: { outputLimit: {
|
|
145
|
+
ordinary: 16384,
|
|
146
|
+
thinking: 32768
|
|
147
|
+
} }
|
|
148
|
+
}))
|
|
149
|
+
};
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/resources.ts
|
|
152
|
+
function failure(detail) {
|
|
153
|
+
const code = detail === "Resource request failed" ? "source-failed" : "invalid-response";
|
|
154
|
+
return Object.assign(new Error(code), {
|
|
155
|
+
name: "ProviderResourceFailure",
|
|
156
|
+
code,
|
|
157
|
+
retryable: false
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
async function readResourceSource(input) {
|
|
161
|
+
if (input.sourceId !== "balance" || input.endpointId !== "openai") throw failure("Invalid resource source");
|
|
162
|
+
if (!input.secrets.apiKey) return {
|
|
163
|
+
kind: "unavailable",
|
|
164
|
+
reason: "auth-required"
|
|
165
|
+
};
|
|
166
|
+
const response = await input.queryJSON({
|
|
167
|
+
requestId: "balance",
|
|
168
|
+
headers: { Authorization: `Bearer ${input.secrets.apiKey}` }
|
|
169
|
+
});
|
|
170
|
+
if (response.status === 401) return {
|
|
171
|
+
kind: "unavailable",
|
|
172
|
+
reason: "auth-required"
|
|
173
|
+
};
|
|
174
|
+
if (response.status === 403) return {
|
|
175
|
+
kind: "unavailable",
|
|
176
|
+
reason: "permission-denied"
|
|
177
|
+
};
|
|
178
|
+
if (response.status !== 200) throw failure("Resource request failed");
|
|
179
|
+
const body = response.body;
|
|
180
|
+
if (!body || typeof body.is_available !== "boolean" || !Array.isArray(body.balance_infos)) throw failure("Invalid resource response");
|
|
181
|
+
const resources = [];
|
|
182
|
+
for (const row of body.balance_infos) {
|
|
183
|
+
if (!row || !["CNY", "USD"].includes(row.currency)) throw failure("Invalid resource currency");
|
|
184
|
+
const currency = row.currency;
|
|
185
|
+
for (const [field, id, en, zh] of [
|
|
186
|
+
[
|
|
187
|
+
"total_balance",
|
|
188
|
+
"balance",
|
|
189
|
+
"Available balance",
|
|
190
|
+
"\u53ef\u7528\u4f59\u989d"
|
|
191
|
+
],
|
|
192
|
+
[
|
|
193
|
+
"granted_balance",
|
|
194
|
+
"granted",
|
|
195
|
+
"Granted balance",
|
|
196
|
+
"\u8d60\u9001\u4f59\u989d"
|
|
197
|
+
],
|
|
198
|
+
[
|
|
199
|
+
"topped_up_balance",
|
|
200
|
+
"topped-up",
|
|
201
|
+
"Topped-up balance",
|
|
202
|
+
"\u5145\u503c\u4f59\u989d"
|
|
203
|
+
]
|
|
204
|
+
]) {
|
|
205
|
+
const value = row[field];
|
|
206
|
+
if (value === void 0) continue;
|
|
207
|
+
if (typeof value !== "string" || !/^-?(0|[1-9]\d*)(\.\d+)?$/.test(value)) throw failure("Invalid resource amount");
|
|
208
|
+
resources.push({
|
|
209
|
+
kind: "balance",
|
|
210
|
+
id: `${id}-${currency}`,
|
|
211
|
+
group: id === "balance" ? "available-balance" : "balance-components",
|
|
212
|
+
labels: {
|
|
213
|
+
"en-US": en,
|
|
214
|
+
"zh-CN": zh
|
|
215
|
+
},
|
|
216
|
+
meaning: /^0(?:\.0+)?$/.test(value) ? "exhausted" : value.startsWith("-") ? "exhausted" : "available",
|
|
217
|
+
valueOrigin: "reported",
|
|
218
|
+
remaining: {
|
|
219
|
+
value: value.includes(".") ? value.replace(/0+$/, "").replace(/\.$/, "").replace(/^-0$/, "0") : value.replace(/^-0$/, "0"),
|
|
220
|
+
unit: {
|
|
221
|
+
kind: "currency",
|
|
222
|
+
code: currency
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
...id === "balance" ? {} : { relationships: [{
|
|
226
|
+
kind: "part-of",
|
|
227
|
+
resourceId: `balance-${currency}`,
|
|
228
|
+
...row.total_balance === void 0 ? { unavailable: true } : {}
|
|
229
|
+
}] }
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
kind: "ready",
|
|
235
|
+
resources,
|
|
236
|
+
restrictions: [{
|
|
237
|
+
id: "account-unavailable",
|
|
238
|
+
labels: {
|
|
239
|
+
"en-US": "Account unavailable",
|
|
240
|
+
"zh-CN": "\u8d26\u6237\u4e0d\u53ef\u7528"
|
|
241
|
+
},
|
|
242
|
+
active: !body.is_available
|
|
243
|
+
}]
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const resourceCapability = {
|
|
247
|
+
support: "supported",
|
|
248
|
+
applicability: {
|
|
249
|
+
kind: "base-url",
|
|
250
|
+
defaultBaseUrl: "https://api.deepseek.com",
|
|
251
|
+
allowedBaseUrls: [
|
|
252
|
+
"https://api.deepseek.com",
|
|
253
|
+
"https://api.deepseek.com/v1",
|
|
254
|
+
"https://api.deepseek.com/anthropic/v1"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
sources: [{
|
|
258
|
+
id: "balance",
|
|
259
|
+
labels: {
|
|
260
|
+
"en-US": "Account balance",
|
|
261
|
+
"zh-CN": "\u8d26\u6237\u4f59\u989d"
|
|
262
|
+
},
|
|
263
|
+
optional: false,
|
|
264
|
+
requests: [{
|
|
265
|
+
id: "balance",
|
|
266
|
+
method: "GET",
|
|
267
|
+
url: "https://api.deepseek.com/user/balance"
|
|
268
|
+
}],
|
|
269
|
+
allowedHeaderNames: ["Authorization"]
|
|
270
|
+
}],
|
|
271
|
+
presets: [{
|
|
272
|
+
id: "available-balance",
|
|
273
|
+
labels: {
|
|
274
|
+
"en-US": "Available balance",
|
|
275
|
+
"zh-CN": "\u53ef\u7528\u4f59\u989d"
|
|
276
|
+
},
|
|
277
|
+
sourceId: "balance",
|
|
278
|
+
order: 0,
|
|
279
|
+
recommended: true,
|
|
280
|
+
format: "amount",
|
|
281
|
+
match: { group: "available-balance" }
|
|
282
|
+
}]
|
|
129
283
|
};
|
|
130
284
|
//#endregion
|
|
131
285
|
//#region src/routing.ts
|
|
132
|
-
/** Maps only declared official roots; protocol implementations own the remaining resource URI. */
|
|
133
286
|
function connectionConfig(endpoint, protocolId, config, aliases = []) {
|
|
134
287
|
const defaults = Object.values(endpoint.capabilities).find((one) => one.protocolIds.includes(protocolId))?.protocolDefaults?.[protocolId] ?? {};
|
|
135
288
|
const configured = config.baseUrl;
|
|
@@ -149,11 +302,11 @@ function connectionConfig(endpoint, protocolId, config, aliases = []) {
|
|
|
149
302
|
}
|
|
150
303
|
//#endregion
|
|
151
304
|
//#region src/type.ts
|
|
152
|
-
/** Stable supplier registration identity. */
|
|
153
305
|
const TYPE = "deepseek";
|
|
154
306
|
const endpoints = [{
|
|
155
307
|
id: "openai",
|
|
156
308
|
label: "DeepSeek API",
|
|
309
|
+
resourceCapability,
|
|
157
310
|
capabilities: { chat: {
|
|
158
311
|
protocolIds: [
|
|
159
312
|
"openai",
|
|
@@ -190,10 +343,11 @@ const protocolOptions = {
|
|
|
190
343
|
thinkingMode: "enabled"
|
|
191
344
|
}
|
|
192
345
|
};
|
|
193
|
-
/** Builds this supplier's declaration without network activity or protocol imports. */
|
|
194
346
|
function deepseekProviderType(support) {
|
|
195
347
|
return {
|
|
196
348
|
type: TYPE,
|
|
349
|
+
listingContractVersion: "capacity-listing-v1",
|
|
350
|
+
modelFacts,
|
|
197
351
|
label: "DeepSeek",
|
|
198
352
|
fields: [{
|
|
199
353
|
key: "apiKey",
|
|
@@ -202,19 +356,11 @@ function deepseekProviderType(support) {
|
|
|
202
356
|
required: true
|
|
203
357
|
}],
|
|
204
358
|
endpoints,
|
|
359
|
+
readResourceSource,
|
|
205
360
|
catalog: support ? {
|
|
206
361
|
...catalog,
|
|
207
362
|
source: support.catalogueSource("https://models.dev/api.json", "models")
|
|
208
363
|
} : catalog,
|
|
209
|
-
describeModel({ model }) {
|
|
210
|
-
return Object.values(catalog.snapshot).some((row) => Object.hasOwn(row, model)) ? {
|
|
211
|
-
id: model,
|
|
212
|
-
outputLimit: {
|
|
213
|
-
ordinary: 16384,
|
|
214
|
-
thinking: 32768
|
|
215
|
-
}
|
|
216
|
-
} : void 0;
|
|
217
|
-
},
|
|
218
364
|
prepareConnection(input) {
|
|
219
365
|
const endpoint = endpoints.find((one) => one.id === input.endpointId);
|
|
220
366
|
if (!endpoint || !Object.values(endpoint.capabilities).some((one) => one.protocolIds.includes(input.protocolId))) throw new Error("unsupported supplier endpoint or protocol");
|
|
@@ -227,7 +373,6 @@ function deepseekProviderType(support) {
|
|
|
227
373
|
}
|
|
228
374
|
//#endregion
|
|
229
375
|
//#region src/index.ts
|
|
230
|
-
/** Suppliers contribute no tools. */
|
|
231
376
|
const TOOL_NAMES = [];
|
|
232
377
|
const plugin = {
|
|
233
378
|
name: "@eum-agent/llm-provider-deepseek",
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"en-US": "DeepSeek Model Connection",
|
|
5
5
|
"zh-CN": "模型接入 · DeepSeek"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.2.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"description": "DeepSeek model provider using registered OpenAI and Anthropic protocols",
|
|
10
10
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"assets"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@eum-agent/plugin": "1.
|
|
21
|
+
"@eum-agent/plugin": "1.2.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"zod": "^4.4.3"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"zh-CN": "通过已注册的 OpenAI 与 Anthropic 协议接入 DeepSeek 模型"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eum-agent/llm-management": "1.
|
|
32
|
+
"@eum-agent/llm-management": "1.2.0"
|
|
33
33
|
},
|
|
34
34
|
"kind": "extension"
|
|
35
35
|
},
|