@molecule/api-ai-deepseek 1.2.0 → 1.2.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.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-05T09:06:10.027Z
6
+ Generated: 2026-11-13T19:22:12.730Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-deepseek
@@ -206,7 +206,7 @@ export function setupAiDeepseek(): void {
206
206
 
207
207
  Peer dependencies:
208
208
 
209
- - `@molecule/api-ai` ^1.0.1
209
+ - `@molecule/api-ai` ^1.6.0
210
210
  - `@molecule/api-bond` ^1.0.1
211
211
  - `@molecule/api-i18n` ^1.0.1
212
212
  - `@molecule/api-secrets` ^1.0.1
@@ -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;AA2IhD,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,O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iling of the dispatch
417
417
  // that follows it.
418
418
  let ceiling;
419
- const restartCeiling = () => {
419
+ const pauseCeiling = () => {
420
420
  if (ceiling)
421
421
  clearTimeout(ceiling);
422
+ ceiling = undefined;
423
+ };
424
+ const restartCeiling = () => {
425
+ pauseCeiling();
422
426
  ceiling = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS);
423
427
  ceiling.unref?.();
424
428
  };
@@ -436,6 +440,7 @@ class DeepseekAIProviderImpl {
436
440
  model,
437
441
  controller,
438
442
  restartCeiling,
443
+ pauseCeiling,
439
444
  // A credit wait lasts until the caller cancels, so only a call that
440
445
  // CAN be cancelled waits; any other 402 still fails at once.
441
446
  waitForCredit: this.waitForCredit && params.signal !== undefined,
@@ -603,8 +608,7 @@ class DeepseekAIProviderImpl {
603
608
  return;
604
609
  }
605
610
  finally {
606
- if (ceiling)
607
- clearTimeout(ceiling);
611
+ pauseCeiling();
608
612
  params.signal?.removeEventListener('abort', forwardAbort);
609
613
  }
610
614
  }
@@ -743,6 +747,10 @@ class DeepseekAIProviderImpl {
743
747
  logger.warn('onRateLimit callback threw', { error });
744
748
  }
745
749
  if (willRetry) {
750
+ // The rejected body is consumed: this dispatch is over. A slow
751
+ // response may have used almost its whole ceiling; that old timer
752
+ // must not cancel the backoff before the next dispatch can re-arm it.
753
+ args.pauseCeiling?.();
746
754
  try {
747
755
  args.onProviderWait?.(event);
748
756
  }
@@ -962,11 +970,13 @@ class DeepseekAIProviderImpl {
962
970
  logger.warn('DeepSeek response did not complete', { finishReason });
963
971
  yield {
964
972
  type: 'error',
965
- message: t('ai.error.apiError', undefined, {
966
- defaultValue: finishReason === 'length'
967
- ? 'AI response reached the output token limit before completion.'
968
- : 'AI response ended before completion. Please try again.',
969
- }),
973
+ message: finishReason === 'length'
974
+ ? t('ai.error.responseTokenLimit', undefined, {
975
+ defaultValue: 'AI response reached the output token limit before completion.',
976
+ })
977
+ : t('ai.error.responseIncomplete', undefined, {
978
+ defaultValue: 'AI response ended before completion. Please try again.',
979
+ }),
970
980
  errorKey: 'ai.error.apiError',
971
981
  };
972
982
  return;
@@ -1121,7 +1131,7 @@ class DeepseekAIProviderImpl {
1121
1131
  });
1122
1132
  yield {
1123
1133
  type: 'error',
1124
- message: t('ai.error.apiError', undefined, {
1134
+ message: t('ai.error.responseIncomplete', undefined, {
1125
1135
  defaultValue: 'AI response ended before completion. Please try again.',
1126
1136
  }),
1127
1137
  errorKey: 'ai.error.apiError',
@@ -1305,11 +1315,13 @@ class DeepseekAIProviderImpl {
1305
1315
  });
1306
1316
  yield {
1307
1317
  type: 'error',
1308
- message: t('ai.error.apiError', undefined, {
1309
- defaultValue: finishReason === 'length'
1310
- ? 'AI response reached the output token limit before completion.'
1311
- : 'AI response was interrupted before completion. Please try again.',
1312
- }),
1318
+ message: finishReason === 'length'
1319
+ ? t('ai.error.responseTokenLimit', undefined, {
1320
+ defaultValue: 'AI response reached the output token limit before completion.',
1321
+ })
1322
+ : t('ai.error.responseIncomplete', undefined, {
1323
+ defaultValue: 'AI response ended before completion. Please try again.',
1324
+ }),
1313
1325
  errorKey: 'ai.error.apiError',
1314
1326
  };
1315
1327
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-deepseek",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "DeepSeek AI provider for molecule.dev",
5
5
  "homepage": "https://www.molecule.dev/packages/api-ai-deepseek",
6
6
  "type": "module",
@@ -40,7 +40,7 @@
40
40
  "vitest": "4.1.12"
41
41
  },
42
42
  "peerDependencies": {
43
- "@molecule/api-ai": "^1.0.1",
43
+ "@molecule/api-ai": "^1.6.0",
44
44
  "@molecule/api-bond": "^1.0.1",
45
45
  "@molecule/api-i18n": "^1.0.1",
46
46
  "@molecule/api-secrets": "^1.0.1"