@molecule/api-ai-deepseek 1.2.2 → 1.2.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/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +14 -1
- package/package.json +3 -3
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EACV,UAAU,EAIV,SAAS,EAET,UAAU,EAEV,cAAc,EACd,uBAAuB,EAGxB,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EACV,UAAU,EAIV,SAAS,EAET,UAAU,EAEV,cAAc,EACd,uBAAuB,EAGxB,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AA4IhD,8DAA8D;AAC9D,eAAO,MAAM,8BAA8B,QAAS,CAAA;AA8MpD;;;;GAIG;AACH,cAAM,sBAAuB,YAAW,UAAU;IAChD,QAAQ,CAAC,IAAI,cAAa;IAC1B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,WAAW,CAAC,CAAqB;IACzC,OAAO,CAAC,aAAa,CAAC,CAAuB;IAC7C,OAAO,CAAC,mBAAmB,CAAQ;IACnC,OAAO,CAAC,sBAAsB,CAAQ;IACtC,OAAO,CAAC,aAAa,CAAS;gBAElB,MAAM,GAAE,cAAmB;IAyBvC;;;;;OAKG;IACI,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;IAsVzD;;;;;;;;;;;;;;;;;;OAkBG;IACH,wBAAwB,CAAC,KAAK,EAAE,cAAc,GAAG,uBAAuB;IAQxE;;;;;;;;;OASG;YACW,2BAA2B;IAsKzC;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,cAAc;IA8FtB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAWnB;;;;;OAKG;IACH,OAAO,CAAE,yBAAyB;IAiFlC;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;IAYlB;;;;;;;;;;;;OAYG;YACY,sBAAsB;IA2GrC;;;;;;;;;;OAUG;IACH,OAAO,CAAE,eAAe;CA8OzB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,+BAAyB,CAAA;AAExD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAElE"}
|
package/dist/provider.js
CHANGED
|
@@ -495,7 +495,7 @@ class DeepseekAIProviderImpl {
|
|
|
495
495
|
let detail = `HTTP ${response.status}`;
|
|
496
496
|
try {
|
|
497
497
|
const parsed = JSON.parse(errorBody);
|
|
498
|
-
if (parsed
|
|
498
|
+
if (typeof parsed?.error?.message === 'string' && parsed.error.message)
|
|
499
499
|
detail = parsed.error.message;
|
|
500
500
|
}
|
|
501
501
|
catch (_error) {
|
|
@@ -542,6 +542,13 @@ class DeepseekAIProviderImpl {
|
|
|
542
542
|
// code is classifiable (and 5xx-shaped ones ride `http 5xx`
|
|
543
543
|
// into the transient class) instead of a bare "try again".
|
|
544
544
|
`AI service error (HTTP ${response.status}). Please try again.`;
|
|
545
|
+
try {
|
|
546
|
+
params.onProviderHttpError?.(response.status, detail);
|
|
547
|
+
}
|
|
548
|
+
catch (_error) {
|
|
549
|
+
// A host telemetry failure cannot replace the original rejection.
|
|
550
|
+
logger.warn('DeepSeek provider HTTP error callback threw');
|
|
551
|
+
}
|
|
545
552
|
yield { type: 'error', message: clientMessage, errorKey: 'ai.error.apiError' };
|
|
546
553
|
return;
|
|
547
554
|
}
|
|
@@ -1033,9 +1040,11 @@ class DeepseekAIProviderImpl {
|
|
|
1033
1040
|
*/
|
|
1034
1041
|
parseUsage(usage) {
|
|
1035
1042
|
const cached = usage.prompt_cache_hit_tokens ?? usage.prompt_tokens_details?.cached_tokens ?? 0;
|
|
1043
|
+
const reasoning = usage.completion_tokens_details?.reasoning_tokens;
|
|
1036
1044
|
return {
|
|
1037
1045
|
inputTokens: usage.prompt_cache_miss_tokens ?? Math.max(0, (usage.prompt_tokens ?? 0) - cached),
|
|
1038
1046
|
outputTokens: usage.completion_tokens ?? 0,
|
|
1047
|
+
...(typeof reasoning === 'number' ? { reasoningOutputTokens: reasoning } : {}),
|
|
1039
1048
|
cacheReadInputTokens: cached,
|
|
1040
1049
|
};
|
|
1041
1050
|
}
|
|
@@ -1249,6 +1258,10 @@ class DeepseekAIProviderImpl {
|
|
|
1249
1258
|
state.usage = {
|
|
1250
1259
|
...state.usage,
|
|
1251
1260
|
...usage,
|
|
1261
|
+
completion_tokens_details: {
|
|
1262
|
+
...state.usage.completion_tokens_details,
|
|
1263
|
+
...usage.completion_tokens_details,
|
|
1264
|
+
},
|
|
1252
1265
|
prompt_tokens_details: {
|
|
1253
1266
|
...state.usage.prompt_tokens_details,
|
|
1254
1267
|
...usage.prompt_tokens_details,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-ai-deepseek",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "DeepSeek AI provider
|
|
3
|
+
"version": "1.2.4",
|
|
4
|
+
"description": "DeepSeek AI chat provider bond — DeepSeek API completions over the swappable @molecule/api-ai ai bond (DEEPSEEK_API_KEY), with bounded stream-stall timeouts",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/api-ai-deepseek",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"directory": "packages/api/bonds/ai/deepseek"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@molecule/api-ai": "1.6.
|
|
36
|
+
"@molecule/api-ai": "1.6.2",
|
|
37
37
|
"@molecule/api-bond": "1.0.4",
|
|
38
38
|
"@types/node": "26.6.5",
|
|
39
39
|
"typescript": "6.0.3",
|