@molecule/api-ai-deepseek 1.0.9 → 1.0.10

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,17 +3,17 @@ 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-10-16T10:23:43.043Z
6
+ Generated: 2026-10-16T23:28:16.072Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-deepseek
10
10
 
11
+ DeepSeek AI provider for molecule.dev.
12
+
11
13
  > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
14
  > It is written to be read by coding agents as much as by people, and is generated from this
13
15
  > package's source — edit `src/index.ts` JSDoc, not this file.
14
16
 
15
- DeepSeek AI provider for molecule.dev.
16
-
17
17
  ## Quick Start
18
18
 
19
19
  ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EACV,UAAU,EAIV,SAAS,EAET,UAAU,EAGX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAsGhD,8DAA8D;AAC9D,eAAO,MAAM,8BAA8B,QAAS,CAAA;AAyFpD;;;;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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AAQ;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;gBAE1B,MAAM,GAAE,cAAmB;IAwBvC;;;;;OAKG;IACI,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;IAqPzD;;;;;;;;;OASG;YACW,2BAA2B;IA0EzC;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAgFtB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAWnB;;;;;OAKG;IACH,OAAO,CAAE,yBAAyB;IAuDlC;;;;;;;;;;;;OAYG;YACY,sBAAsB;IA2GrC;;;;;;;;;;OAUG;IACH,OAAO,CAAE,eAAe;CA2KzB;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
@@ -33,6 +33,12 @@ export const DEFAULT_FIRST_TOKEN_TIMEOUT_MS = 45_000;
33
33
  const DEFAULT_STREAM_SILENCE_TIMEOUT_MS = 60_000;
34
34
  /** Node's `setTimeout` ceiling: a larger delay is clamped to 1 ms, i.e. instant. */
35
35
  const MAX_TIMER_MS = 2_147_483_647;
36
+ /**
37
+ * How many stop sequences DeepSeek accepts in one request ("Up to 16 sequences
38
+ * where the API will stop generating further tokens", create-chat-completion).
39
+ * A longer list is sent truncated rather than refused by the API.
40
+ */
41
+ const MAX_STOP_SEQUENCES = 16;
36
42
  /**
37
43
  * Resolve a stream bound from the config, then the environment, then the
38
44
  * default. A value that is not a positive finite number is IGNORED rather than
@@ -144,6 +150,16 @@ class DeepseekAIProviderImpl {
144
150
  const model = this.modelMap[canonicalModel] ?? canonicalModel;
145
151
  const maxTokens = params.maxTokens ?? this.maxTokens;
146
152
  const messages = this.formatMessages(params.messages, params.system);
153
+ // Stop sequences, capped at the API's own limit. Verified honoured by the
154
+ // native endpoint on 2026-10-17: with `stop: ['<analysis>']` a reply that
155
+ // would have opened with that tag streamed nothing at all, and one that
156
+ // reached it mid-answer ended there with the tag dropped from the text.
157
+ const stop = (params.stop ?? []).filter((s) => s.length > 0).slice(0, MAX_STOP_SEQUENCES);
158
+ if ((params.stop?.length ?? 0) > MAX_STOP_SEQUENCES) {
159
+ logger.warn('DeepSeek takes at most 16 stop sequences — the rest were dropped', {
160
+ requested: params.stop?.length,
161
+ });
162
+ }
147
163
  const body = {
148
164
  // Abuse attribution (see ChatParams.endUserId): OpenAI-compatible APIs
149
165
  // scope enforcement by `user`, so an abusive tenant can be actioned
@@ -157,6 +173,7 @@ class DeepseekAIProviderImpl {
157
173
  messages,
158
174
  stream: params.stream !== false,
159
175
  ...(params.stream !== false ? { stream_options: { include_usage: true } } : {}),
176
+ ...(stop.length > 0 ? { stop } : {}),
160
177
  };
161
178
  // Tools: merge custom tools (function format) and server tools
162
179
  const functions = params.tools?.length ? this.formatTools(params.tools) : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-deepseek",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "DeepSeek AI provider for molecule.dev",
5
5
  "homepage": "https://www.molecule.dev/packages/api-ai-deepseek",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "directory": "packages/api/bonds/ai/deepseek"
34
34
  },
35
35
  "devDependencies": {
36
- "@molecule/api-ai": "1.3.3",
36
+ "@molecule/api-ai": "1.3.4",
37
37
  "@molecule/api-bond": "1.0.2",
38
38
  "@types/node": "26.1.2",
39
39
  "typescript": "6.0.3",