@molecule/api-ai-deepseek 1.0.6 → 1.0.8

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/LICENSE CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  Apache License
2
3
  Version 2.0, January 2004
3
4
  http://www.apache.org/licenses/
@@ -34,21 +35,33 @@
34
35
 
35
36
  "Work" shall mean the work of authorship, whether in Source or
36
37
  Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work.
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
38
40
 
39
41
  "Derivative Works" shall mean any work, whether in Source or Object
40
42
  form, that is based on (or derived from) the Work and for which the
41
43
  editorial revisions, annotations, elaborations, or other modifications
42
- represent, as a whole, an original work of authorship.
43
-
44
- "Contribution" shall mean any work of authorship, including the
45
- original version of the Work and any modifications or additions
46
- to that Work, that is intentionally submitted to the Licensor for
47
- inclusion in the Work by the copyright owner or by an individual or
48
- Legal Entity authorized to submit on behalf of the copyright owner.
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
49
62
 
50
63
  "Contributor" shall mean Licensor and any individual or Legal Entity
51
- on behalf of whom a Contribution has been received by the Licensor and
64
+ on behalf of whom a Contribution has been received by Licensor and
52
65
  subsequently incorporated within the Work.
53
66
 
54
67
  2. Grant of Copyright License. Subject to the terms and conditions of
@@ -61,8 +74,18 @@
61
74
  3. Grant of Patent License. Subject to the terms and conditions of
62
75
  this License, each Contributor hereby grants to You a perpetual,
63
76
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
- patent license to make, have made, use, offer to sell, sell, import,
65
- and otherwise transfer the Work.
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
66
89
 
67
90
  4. Redistribution. You may reproduce and distribute copies of the
68
91
  Work or Derivative Works thereof in any medium, with or without
@@ -84,23 +107,87 @@
84
107
  (d) If the Work includes a "NOTICE" text file as part of its
85
108
  distribution, then any Derivative Works that You distribute must
86
109
  include a readable copy of the attribution notices contained
87
- within such NOTICE file.
88
-
89
- 5. Submission of Contributions.
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
90
138
 
91
139
  6. Trademarks. This License does not grant permission to use the trade
92
- names, trademarks, service marks, or product names of the Licensor.
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
93
143
 
94
144
  7. Disclaimer of Warranty. Unless required by applicable law or
95
- agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
-
98
- 8. Limitation of Liability. In no event and under no legal theory shall
99
- any Contributor be liable to You for damages.
100
-
101
- 9. Accepting Warranty or Additional Liability.
102
-
103
- Copyright 2026 Molecule Dev, Inc.
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
104
191
 
105
192
  Licensed under the Apache License, Version 2.0 (the "License");
106
193
  you may not use this file except in compliance with the License.
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-10-01T18:20:44.372Z
6
+ Generated: 2026-10-16T10:23:43.043Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-deepseek
@@ -80,6 +80,31 @@ interface DeepseekConfig {
80
80
  modelMap?: Record<string, string>
81
81
  /** Called on each rate-limited/overloaded upstream response, before any retry sleep. */
82
82
  onRateLimit?: AiRateLimitCallback
83
+ /** Called when a stream accepts the request and then produces no content for the whole first-token window. */
84
+ onStreamStall?: AiStreamStallCallback
85
+ /**
86
+ * How long a stream may wait for its FIRST content event before the provider
87
+ * abandons it and asks again (ms). Defaults to 45 000.
88
+ *
89
+ * Counted from the moment the request is sent, and cleared by the first
90
+ * `text` / `thinking` / `tool_use` event — NOT by a liveness frame, because
91
+ * DeepSeek keeps a stalled prefill's connection alive with `: keep-alive`
92
+ * comments, so a byte-level idle timeout never sees the stall at all. A turn's
93
+ * healthy first-token wait is ~1 s even on million-token prompts, so this
94
+ * window is a stall bound, not a latency budget.
95
+ */
96
+ firstTokenTimeoutMs?: number
97
+ /**
98
+ * How long a stream that has ALREADY started may go without a single byte
99
+ * before the provider abandons it (ms). Defaults to 60 000.
100
+ *
101
+ * Measured over the socket, not over content: once the reply has started, any
102
+ * byte proves the connection is alive, and a stretch with none is a broken
103
+ * stream rather than a slow one. Abandoning it here is not retried — the
104
+ * partial reply is already on the wire — it is reported as an error event for
105
+ * the caller's own ladder, which keeps the partial.
106
+ */
107
+ streamSilenceTimeoutMs?: number
83
108
  }
84
109
  ```
85
110
 
@@ -113,12 +138,20 @@ function createProvider(config?: DeepseekConfig): AIProvider
113
138
 
114
139
  ### Constants
115
140
 
116
- #### `aiDeepseekSecretDefinitions`
141
+ #### `provider`
117
142
 
118
- Secret definitions required by the DeepSeek AI bond.
143
+ The provider implementation.
119
144
 
120
145
  ```typescript
121
- const aiDeepseekSecretDefinitions: SecretDefinition[]
146
+ const provider: AIProvider
147
+ ```
148
+
149
+ #### `DEFAULT_FIRST_TOKEN_TIMEOUT_MS`
150
+
151
+ How long a stream may wait for its first content event.
152
+
153
+ ```typescript
154
+ const DEFAULT_FIRST_TOKEN_TIMEOUT_MS: 45000
122
155
  ```
123
156
 
124
157
  #### `DeepseekAIProvider`
@@ -129,12 +162,12 @@ Back-compat alias for the provider class (the scaffold exported this name).
129
162
  const DeepseekAIProvider: typeof DeepseekAIProviderImpl
130
163
  ```
131
164
 
132
- #### `provider`
165
+ #### `aiDeepseekSecretDefinitions`
133
166
 
134
- The provider implementation.
167
+ Secret definitions required by the DeepSeek AI bond.
135
168
 
136
169
  ```typescript
137
- const provider: AIProvider
170
+ const aiDeepseekSecretDefinitions: SecretDefinition[]
138
171
  ```
139
172
 
140
173
  ## Core Interface
@@ -189,6 +222,14 @@ not at bond/module-load time) — it never silently sends an empty key.
189
222
  malformed tool schema) gets its own non-retryable message distinct from the generic
190
223
  "AI service error. Please try again." used for retryable failures.
191
224
 
225
+ **A stream that opens and then produces nothing is bounded, not waited on.** DeepSeek answers
226
+ 200 and then keeps a stalled prefill alive with `: keep-alive` comments, so no HTTP status is
227
+ ever wrong and a byte-level idle timeout never sees the stall. `chat()` therefore bounds the
228
+ wait for the first CONTENT event (45 s, `MOL_DEEPSEEK_FIRST_TOKEN_TIMEOUT_MS`) and asks once
229
+ more with a fresh stream; after the reply has started it bounds the silence between chunks
230
+ instead (60 s, `MOL_DEEPSEEK_STREAM_SILENCE_TIMEOUT_MS`) and surfaces an error event, keeping
231
+ the partial reply. Hosts observe both through the `onStreamStall` callback.
232
+
192
233
  ## E2E Tests
193
234
 
194
235
  Integration checklist — drive the real UI (live preview, no mocks), adapt
package/dist/index.d.ts CHANGED
@@ -31,6 +31,14 @@
31
31
  * malformed tool schema) gets its own non-retryable message distinct from the generic
32
32
  * "AI service error. Please try again." used for retryable failures.
33
33
  *
34
+ * **A stream that opens and then produces nothing is bounded, not waited on.** DeepSeek answers
35
+ * 200 and then keeps a stalled prefill alive with `: keep-alive` comments, so no HTTP status is
36
+ * ever wrong and a byte-level idle timeout never sees the stall. `chat()` therefore bounds the
37
+ * wait for the first CONTENT event (45 s, `MOL_DEEPSEEK_FIRST_TOKEN_TIMEOUT_MS`) and asks once
38
+ * more with a fresh stream; after the reply has started it bounds the silence between chunks
39
+ * instead (60 s, `MOL_DEEPSEEK_STREAM_SILENCE_TIMEOUT_MS`) and surfaces an error event, keeping
40
+ * the partial reply. Hosts observe both through the `onStreamStall` callback.
41
+ *
34
42
  * @module
35
43
  */
36
44
  export * from './browser-guard.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAMlD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAUrB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAMlD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAUrB,CAAA"}
package/dist/index.js CHANGED
@@ -31,6 +31,14 @@
31
31
  * malformed tool schema) gets its own non-retryable message distinct from the generic
32
32
  * "AI service error. Please try again." used for retryable failures.
33
33
  *
34
+ * **A stream that opens and then produces nothing is bounded, not waited on.** DeepSeek answers
35
+ * 200 and then keeps a stalled prefill alive with `: keep-alive` comments, so no HTTP status is
36
+ * ever wrong and a byte-level idle timeout never sees the stall. `chat()` therefore bounds the
37
+ * wait for the first CONTENT event (45 s, `MOL_DEEPSEEK_FIRST_TOKEN_TIMEOUT_MS`) and asks once
38
+ * more with a fresh stream; after the reply has started it bounds the silence between chunks
39
+ * instead (60 s, `MOL_DEEPSEEK_STREAM_SILENCE_TIMEOUT_MS`) and surfaces an error event, keeping
40
+ * the partial reply. Hosts observe both through the `onStreamStall` callback.
41
+ *
34
42
  * @module
35
43
  */
36
44
  export * from './browser-guard.js';
@@ -11,6 +11,8 @@
11
11
  import type { AIProvider, ChatEvent, ChatParams } from '@molecule/api-ai';
12
12
  import './secrets.js';
13
13
  import type { DeepseekConfig } from './types.js';
14
+ /** How long a stream may wait for its first content event. */
15
+ export declare const DEFAULT_FIRST_TOKEN_TIMEOUT_MS = 45000;
14
16
  /**
15
17
  * DeepSeek AI provider that implements the `AIProvider` interface using
16
18
  * DeepSeek's OpenAI-compatible Chat Completions API with support for streaming,
@@ -25,6 +27,9 @@ declare class DeepseekAIProviderImpl implements AIProvider {
25
27
  private completionsPath;
26
28
  private modelMap;
27
29
  private onRateLimit?;
30
+ private onStreamStall?;
31
+ private firstTokenTimeoutMs;
32
+ private streamSilenceTimeoutMs;
28
33
  constructor(config?: DeepseekConfig);
29
34
  /**
30
35
  * Sends a chat request and yields streamed events (text chunks, tool use, done/error).
@@ -33,6 +38,26 @@ declare class DeepseekAIProviderImpl implements AIProvider {
33
38
  * @yields {ChatEvent} Chat events including text chunks, tool use requests, done signals, and errors.
34
39
  */
35
40
  chat(params: ChatParams): AsyncIterable<ChatEvent>;
41
+ /**
42
+ * POST the chat body, retrying with exponential backoff on a rate-limited
43
+ * (429) or overloaded (503) status. Extracted from {@link chat} so the
44
+ * stream-level first-token retry can wrap it: a rate-limited request and a
45
+ * stalled stream are different failures with different budgets, and nesting
46
+ * them in one loop made each one's attempt count depend on the other's.
47
+ *
48
+ * @param args - The request body, headers, upstream model and abort signal.
49
+ * @returns The upstream response (possibly a 429/503 that exhausted retries).
50
+ */
51
+ private requestWithRateLimitRetries;
52
+ /**
53
+ * Record one stalled attempt: a warn line always, plus the host's
54
+ * `onStreamStall` callback so the gap is queryable from the turn's own
55
+ * analytics rather than only from a log buffer that has since rotated.
56
+ *
57
+ * @param model - The upstream model id the stalled request targeted.
58
+ * @param stall - What the stalled attempt looked like.
59
+ */
60
+ private reportStreamStall;
36
61
  /**
37
62
  * Converts internal `ChatMessage` objects to the OpenAI-compatible message format.
38
63
  * System prompt is prepended as a system role message.
@@ -61,6 +86,10 @@ declare class DeepseekAIProviderImpl implements AIProvider {
61
86
  * format), yielding `ChatEvent` objects as they arrive.
62
87
  *
63
88
  * @param response - The fetch Response with an SSE body stream.
89
+ * @param state - Mutable counters for this attempt's tokens, liveness frames
90
+ * and streamed content. Owned by the caller so a retry can read what the
91
+ * abandoned attempt produced.
92
+ * @param bounds - How to re-arm the stream bound after the reply starts.
64
93
  * @yields {ChatEvent} Chat events as they arrive from the SSE stream.
65
94
  */
66
95
  private parseStreamingResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EAGV,SAAS,EAET,UAAU,EAEX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAuBhD;;;;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;gBAE7B,MAAM,GAAE,cAAmB;IAqBvC;;;;;OAKG;IACI,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;IAwLzD;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAgFtB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAWnB;;;;;OAKG;IACH,OAAO,CAAE,yBAAyB;IAuDlC;;;;;;OAMG;YACY,sBAAsB;IAoFrC;;;;;;;;OAQG;IACH,OAAO,CAAE,eAAe;CAkIzB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,+BAAyB,CAAA;AAExD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAElE"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EAIV,SAAS,EAET,UAAU,EAEX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAoFhD,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,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;IA4MzD;;;;;;;;;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;;;;;;;;;;OAUG;YACY,sBAAsB;IAyGrC;;;;;;;;OAQG;IACH,OAAO,CAAE,eAAe;CAkIzB;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
@@ -26,6 +26,73 @@ import './secrets.js';
26
26
  function budgetToEffort(budgetTokens) {
27
27
  return budgetTokens >= 12_000 ? 'max' : 'high';
28
28
  }
29
+ /** How long a stream may wait for its first content event. */
30
+ export const DEFAULT_FIRST_TOKEN_TIMEOUT_MS = 45_000;
31
+ /** How long a stream that HAS started may go without a single byte. */
32
+ const DEFAULT_STREAM_SILENCE_TIMEOUT_MS = 60_000;
33
+ /** Node's `setTimeout` ceiling: a larger delay is clamped to 1 ms, i.e. instant. */
34
+ const MAX_TIMER_MS = 2_147_483_647;
35
+ /**
36
+ * Resolve a stream bound from the config, then the environment, then the
37
+ * default. A value that is not a positive finite number is IGNORED rather than
38
+ * armed: these values arm `setTimeout`, and a non-positive one (or one past
39
+ * Node's 32-bit timer ceiling, which `setTimeout` clamps to 1 ms) would abandon
40
+ * every stream on its first tick — turning a stall bound into a universal
41
+ * failure.
42
+ *
43
+ * @param configured - The value from the provider config, when set.
44
+ * @param envValue - The raw environment value, when set.
45
+ * @param fallback - The default to use when neither resolves.
46
+ * @returns Milliseconds for the bound.
47
+ */
48
+ function resolveBoundMs(configured, envValue, fallback) {
49
+ for (const candidate of [configured, Number(envValue)]) {
50
+ if (typeof candidate === 'number' &&
51
+ Number.isFinite(candidate) &&
52
+ candidate > 0 &&
53
+ candidate <= MAX_TIMER_MS) {
54
+ return candidate;
55
+ }
56
+ }
57
+ return fallback;
58
+ }
59
+ /**
60
+ * The first-token bound, from the config, then
61
+ * `MOL_DEEPSEEK_FIRST_TOKEN_TIMEOUT_MS`, then the default.
62
+ *
63
+ * @param configured - The value from {@link DeepseekConfig.firstTokenTimeoutMs}.
64
+ * @returns Milliseconds to wait for the first content event.
65
+ */
66
+ function resolveFirstTokenTimeoutMs(configured) {
67
+ return resolveBoundMs(configured, process.env.MOL_DEEPSEEK_FIRST_TOKEN_TIMEOUT_MS, DEFAULT_FIRST_TOKEN_TIMEOUT_MS);
68
+ }
69
+ /**
70
+ * The post-content inter-chunk silence bound, from the config, then
71
+ * `MOL_DEEPSEEK_STREAM_SILENCE_TIMEOUT_MS`, then the default.
72
+ *
73
+ * @param configured - The value from {@link DeepseekConfig.streamSilenceTimeoutMs}.
74
+ * @returns Milliseconds a started stream may go without a byte.
75
+ */
76
+ function resolveStreamSilenceTimeoutMs(configured) {
77
+ return resolveBoundMs(configured, process.env.MOL_DEEPSEEK_STREAM_SILENCE_TIMEOUT_MS, DEFAULT_STREAM_SILENCE_TIMEOUT_MS);
78
+ }
79
+ /**
80
+ * Whether an event means the reply has STARTED, i.e. the first-token bound no
81
+ * longer applies. A `keep_alive` is deliberately NOT content: it is exactly what
82
+ * a stalled upstream keeps dripping, so treating it as progress would disarm the
83
+ * bound on the one stream it exists to catch. `usage` and `done` are not content
84
+ * either — a stream that reports usage and closes produced no reply.
85
+ *
86
+ * @param event - One event from the provider stream.
87
+ * @returns True for the first real output of a reply.
88
+ */
89
+ function isContentEvent(event) {
90
+ return (event.type === 'text' ||
91
+ event.type === 'thinking' ||
92
+ event.type === 'tool_use' ||
93
+ event.type === 'tool_use_start' ||
94
+ event.type === 'tool_input_delta');
95
+ }
29
96
  /**
30
97
  * DeepSeek AI provider that implements the `AIProvider` interface using
31
98
  * DeepSeek's OpenAI-compatible Chat Completions API with support for streaming,
@@ -40,6 +107,9 @@ class DeepseekAIProviderImpl {
40
107
  completionsPath;
41
108
  modelMap;
42
109
  onRateLimit;
110
+ onStreamStall;
111
+ firstTokenTimeoutMs;
112
+ streamSilenceTimeoutMs;
43
113
  constructor(config = {}) {
44
114
  this.apiKey = config.apiKey ?? process.env.DEEPSEEK_API_KEY ?? '';
45
115
  this.defaultModel = config.defaultModel ?? 'deepseek-flash';
@@ -49,6 +119,9 @@ class DeepseekAIProviderImpl {
49
119
  config.completionsPath ?? process.env.DEEPSEEK_COMPLETIONS_PATH ?? '/v1/chat/completions';
50
120
  this.modelMap = config.modelMap ?? {};
51
121
  this.onRateLimit = config.onRateLimit;
122
+ this.onStreamStall = config.onStreamStall;
123
+ this.firstTokenTimeoutMs = resolveFirstTokenTimeoutMs(config.firstTokenTimeoutMs);
124
+ this.streamSilenceTimeoutMs = resolveStreamSilenceTimeoutMs(config.streamSilenceTimeoutMs);
52
125
  // Fail fast with an actionable local error rather than a cryptic 401 on the
53
126
  // first request. The default `provider` export constructs lazily on first
54
127
  // use (see index.ts), so this surfaces the moment the provider is actually
@@ -137,7 +210,147 @@ class DeepseekAIProviderImpl {
137
210
  Authorization: `Bearer ${this.apiKey}`,
138
211
  };
139
212
  const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000;
140
- const signal = params.signal ?? AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
213
+ const firstTokenTimeoutMs = this.firstTokenTimeoutMs;
214
+ const MAX_STALL_RETRIES = 1;
215
+ // A stream that OPENS and then produces no content is invisible to every
216
+ // other signal this provider has: the request returns 200, no status is ever
217
+ // wrong, and DeepSeek keeps a stalled prefill's connection alive with
218
+ // `: keep-alive` comments — so a byte-level idle timeout stays quiet too.
219
+ // Left alone, the whole first-token window is spent before anything notices.
220
+ // Measured in production: on 2026-10-01 nine turns died this way in one
221
+ // project, each spending 540-582 s — three 180 s windows of the chat
222
+ // handler's progress watchdog, which was the ONLY bound on the stream, and
223
+ // their own record named no provider time at all. Bound it here instead,
224
+ // where the same request can simply be asked again.
225
+ for (let stalledAttempt = 0;; stalledAttempt++) {
226
+ const controller = new AbortController();
227
+ const forwardAbort = () => controller.abort();
228
+ if (params.signal?.aborted)
229
+ controller.abort();
230
+ else
231
+ params.signal?.addEventListener('abort', forwardAbort, { once: true });
232
+ // The provider's own ceiling bounds each ATTEMPT; the caller's signal, when
233
+ // present, still wins over it (both abort this one controller).
234
+ const ceiling = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS);
235
+ ceiling.unref?.();
236
+ const signal = controller.signal;
237
+ try {
238
+ const response = await this.requestWithRateLimitRetries({
239
+ body,
240
+ headers,
241
+ model,
242
+ signal,
243
+ });
244
+ if (!response.ok) {
245
+ const errorBody = await response.text();
246
+ let detail = `HTTP ${response.status}`;
247
+ try {
248
+ const parsed = JSON.parse(errorBody);
249
+ if (parsed.error?.message)
250
+ detail = parsed.error.message;
251
+ }
252
+ catch (_error) {
253
+ // JSON.parse failed — raw text is already in `errorBody`; use it as-is.
254
+ if (errorBody.length > 0 && errorBody.length < 200)
255
+ detail = errorBody;
256
+ }
257
+ logger.error('DeepSeek API error', { status: response.status, detail, errorBody });
258
+ const clientMessage = response.status === 429
259
+ ? 'AI rate limit exceeded. Please try again shortly.'
260
+ : response.status === 401
261
+ ? 'AI service configuration error.'
262
+ : response.status === 400 &&
263
+ /prompt is too long|too many tokens|token.*limit|context.*length/i.test(detail)
264
+ ? "Conversation too long for the model's context window. Use /compact to free space, or start a new conversation."
265
+ : response.status === 400
266
+ ? 'AI request was invalid — check the model and request parameters.'
267
+ : response.status === 503
268
+ ? 'AI service is temporarily overloaded. Please try again in a moment.'
269
+ : 'AI service error. Please try again.';
270
+ yield { type: 'error', message: clientMessage, errorKey: 'ai.error.apiError' };
271
+ return;
272
+ }
273
+ if (params.stream === false) {
274
+ const data = (await response.json());
275
+ yield* this.parseNonStreamingResponse(data);
276
+ return;
277
+ }
278
+ const state = {
279
+ inputTokens: 0,
280
+ outputTokens: 0,
281
+ cachedTokens: 0,
282
+ keepAlives: 0,
283
+ streamedChars: 0,
284
+ contentSeen: false,
285
+ };
286
+ // Both bounds abort the same request; `expired` says which one did, and
287
+ // `windowStartedAt` how long that one had been running — the stall is
288
+ // the WINDOW that expired, not the time since the request went out (an
289
+ // inter-chunk stall after a long reply would otherwise report minutes).
290
+ const bounds = { expired: null, timer: null, windowStartedAt: 0 };
291
+ const armBound = (ms, phase) => {
292
+ if (bounds.timer)
293
+ clearTimeout(bounds.timer);
294
+ bounds.windowStartedAt = Date.now();
295
+ bounds.timer = setTimeout(() => {
296
+ bounds.expired = phase;
297
+ controller.abort();
298
+ }, ms);
299
+ };
300
+ armBound(firstTokenTimeoutMs, 'before_content');
301
+ try {
302
+ yield* this.parseStreamingResponse(response, state, {
303
+ silenceMs: this.streamSilenceTimeoutMs,
304
+ arm: armBound,
305
+ });
306
+ }
307
+ catch (error) {
308
+ // Only a bound expiry is this provider's to absorb — anything else
309
+ // (the caller aborting, a socket failure) belongs to the caller.
310
+ if (!bounds.expired)
311
+ throw error;
312
+ const stall = {
313
+ stallMs: Date.now() - bounds.windowStartedAt,
314
+ attempt: stalledAttempt + 1,
315
+ // Only a stream that never started may be asked again: a reply that
316
+ // already partly reached the consumer would be duplicated.
317
+ willRetry: bounds.expired === 'before_content' && stalledAttempt < MAX_STALL_RETRIES,
318
+ streamedChars: state.streamedChars,
319
+ keepAlives: state.keepAlives,
320
+ phase: bounds.expired,
321
+ };
322
+ this.reportStreamStall(model, stall);
323
+ if (stall.willRetry)
324
+ continue;
325
+ // Out of retries, or the partial reply is already on the wire. Hand it
326
+ // to the caller's own error ladder, which keeps the partial.
327
+ yield { type: 'error', message: t('ai.error.apiError'), errorKey: 'ai.error.apiError' };
328
+ return;
329
+ }
330
+ finally {
331
+ if (bounds.timer)
332
+ clearTimeout(bounds.timer);
333
+ }
334
+ return;
335
+ }
336
+ finally {
337
+ clearTimeout(ceiling);
338
+ params.signal?.removeEventListener('abort', forwardAbort);
339
+ }
340
+ }
341
+ }
342
+ /**
343
+ * POST the chat body, retrying with exponential backoff on a rate-limited
344
+ * (429) or overloaded (503) status. Extracted from {@link chat} so the
345
+ * stream-level first-token retry can wrap it: a rate-limited request and a
346
+ * stalled stream are different failures with different budgets, and nesting
347
+ * them in one loop made each one's attempt count depend on the other's.
348
+ *
349
+ * @param args - The request body, headers, upstream model and abort signal.
350
+ * @returns The upstream response (possibly a 429/503 that exhausted retries).
351
+ */
352
+ async requestWithRateLimitRetries(args) {
353
+ const { body, headers, model, signal } = args;
141
354
  // Retry with exponential backoff for rate limits (429) and overloaded (503)
142
355
  const MAX_RETRIES = 3;
143
356
  let response = null;
@@ -198,41 +411,42 @@ class DeepseekAIProviderImpl {
198
411
  }
199
412
  break;
200
413
  }
201
- if (!response.ok) {
202
- const errorBody = await response.text();
203
- let detail = `HTTP ${response.status}`;
204
- try {
205
- const parsed = JSON.parse(errorBody);
206
- if (parsed.error?.message)
207
- detail = parsed.error.message;
208
- }
209
- catch (_error) {
210
- // JSON.parse failed — raw text is already in `errorBody`; use it as-is.
211
- if (errorBody.length > 0 && errorBody.length < 200)
212
- detail = errorBody;
213
- }
214
- logger.error('DeepSeek API error', { status: response.status, detail, errorBody });
215
- const clientMessage = response.status === 429
216
- ? 'AI rate limit exceeded. Please try again shortly.'
217
- : response.status === 401
218
- ? 'AI service configuration error.'
219
- : response.status === 400 &&
220
- /prompt is too long|too many tokens|token.*limit|context.*length/i.test(detail)
221
- ? "Conversation too long for the model's context window. Use /compact to free space, or start a new conversation."
222
- : response.status === 400
223
- ? 'AI request was invalid — check the model and request parameters.'
224
- : response.status === 503
225
- ? 'AI service is temporarily overloaded. Please try again in a moment.'
226
- : 'AI service error. Please try again.';
227
- yield { type: 'error', message: clientMessage, errorKey: 'ai.error.apiError' };
228
- return;
414
+ return response;
415
+ }
416
+ /**
417
+ * Record one stalled attempt: a warn line always, plus the host's
418
+ * `onStreamStall` callback so the gap is queryable from the turn's own
419
+ * analytics rather than only from a log buffer that has since rotated.
420
+ *
421
+ * @param model - The upstream model id the stalled request targeted.
422
+ * @param stall - What the stalled attempt looked like.
423
+ */
424
+ reportStreamStall(model, stall) {
425
+ logger.warn('DeepSeek stream stalled', {
426
+ model,
427
+ phase: stall.phase,
428
+ stallMs: stall.stallMs,
429
+ attempt: stall.attempt,
430
+ willRetry: stall.willRetry,
431
+ streamedChars: stall.streamedChars,
432
+ keepAlives: stall.keepAlives,
433
+ });
434
+ try {
435
+ this.onStreamStall?.({
436
+ provider: this.name,
437
+ model,
438
+ phase: stall.phase,
439
+ stallMs: stall.stallMs,
440
+ attempt: stall.attempt,
441
+ willRetry: stall.willRetry,
442
+ streamedChars: stall.streamedChars,
443
+ keepAlives: stall.keepAlives,
444
+ });
229
445
  }
230
- if (params.stream === false) {
231
- const data = (await response.json());
232
- yield* this.parseNonStreamingResponse(data);
233
- return;
446
+ catch (error) {
447
+ // Host-app telemetry; its failure must never break the request.
448
+ logger.warn('onStreamStall callback threw', { error });
234
449
  }
235
- yield* this.parseStreamingResponse(response);
236
450
  }
237
451
  /**
238
452
  * Converts internal `ChatMessage` objects to the OpenAI-compatible message format.
@@ -390,9 +604,13 @@ class DeepseekAIProviderImpl {
390
604
  * format), yielding `ChatEvent` objects as they arrive.
391
605
  *
392
606
  * @param response - The fetch Response with an SSE body stream.
607
+ * @param state - Mutable counters for this attempt's tokens, liveness frames
608
+ * and streamed content. Owned by the caller so a retry can read what the
609
+ * abandoned attempt produced.
610
+ * @param bounds - How to re-arm the stream bound after the reply starts.
393
611
  * @yields {ChatEvent} Chat events as they arrive from the SSE stream.
394
612
  */
395
- async *parseStreamingResponse(response) {
613
+ async *parseStreamingResponse(response, state, bounds) {
396
614
  const reader = response.body?.getReader();
397
615
  if (!reader) {
398
616
  yield {
@@ -404,7 +622,6 @@ class DeepseekAIProviderImpl {
404
622
  }
405
623
  const decoder = new TextDecoder();
406
624
  let buffer = '';
407
- const state = { inputTokens: 0, outputTokens: 0, cachedTokens: 0 };
408
625
  // Track pending tool calls (accumulated across deltas). `started` guards the
409
626
  // one-shot tool_use_start emission once the id + name are first known.
410
627
  const pendingTools = new Map();
@@ -419,6 +636,20 @@ class DeepseekAIProviderImpl {
419
636
  let yieldedContent = false;
420
637
  for (const event of this.processSSELines(lines, pendingTools, state)) {
421
638
  yieldedContent = true;
639
+ // The reply has started. Counting this from the EVENTS (rather than
640
+ // from the byte stream) is what lets the first-token bound see a
641
+ // stall whose connection is kept alive by empty frames — the shape
642
+ // DeepSeek actually produces. And the bound is swapped the instant it
643
+ // starts, not at the end of the batch: a first-token timer that fired
644
+ // on a reply already yielded to the consumer would retry and
645
+ // duplicate it.
646
+ if (isContentEvent(event) && !state.contentSeen) {
647
+ state.contentSeen = true;
648
+ bounds.arm(bounds.silenceMs, 'after_content');
649
+ }
650
+ if (event.type === 'text' || event.type === 'thinking') {
651
+ state.streamedChars += event.content.length;
652
+ }
422
653
  yield event;
423
654
  // A mid-stream error (rate-limit/overload during high load, sent as a
424
655
  // `data: {"error": {...}}` chunk) means the turn was truncated. Stop
@@ -432,8 +663,13 @@ class DeepseekAIProviderImpl {
432
663
  // (e.g., during extended reasoning with empty chunks or keepalive comments).
433
664
  // This resets the consumer's stream timeout without forwarding to the client.
434
665
  if (!yieldedContent) {
666
+ state.keepAlives += 1;
435
667
  yield { type: 'keep_alive' };
436
668
  }
669
+ // Any chunk at all proves the socket is alive, so the post-content bound
670
+ // is re-armed here rather than on content events only.
671
+ if (state.contentSeen)
672
+ bounds.arm(bounds.silenceMs, 'after_content');
437
673
  }
438
674
  // Flush any remaining data in the buffer after EOF
439
675
  if (buffer.trim()) {
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import type { AiRateLimitCallback } from '@molecule/api-ai';
6
+ import type { AiRateLimitCallback, AiStreamStallCallback } from '@molecule/api-ai';
7
7
  /**
8
8
  * Configuration for DeepSeek.
9
9
  */
@@ -34,6 +34,31 @@ export interface DeepseekConfig {
34
34
  modelMap?: Record<string, string>;
35
35
  /** Called on each rate-limited/overloaded upstream response, before any retry sleep. */
36
36
  onRateLimit?: AiRateLimitCallback;
37
+ /** Called when a stream accepts the request and then produces no content for the whole first-token window. */
38
+ onStreamStall?: AiStreamStallCallback;
39
+ /**
40
+ * How long a stream may wait for its FIRST content event before the provider
41
+ * abandons it and asks again (ms). Defaults to 45 000.
42
+ *
43
+ * Counted from the moment the request is sent, and cleared by the first
44
+ * `text` / `thinking` / `tool_use` event — NOT by a liveness frame, because
45
+ * DeepSeek keeps a stalled prefill's connection alive with `: keep-alive`
46
+ * comments, so a byte-level idle timeout never sees the stall at all. A turn's
47
+ * healthy first-token wait is ~1 s even on million-token prompts, so this
48
+ * window is a stall bound, not a latency budget.
49
+ */
50
+ firstTokenTimeoutMs?: number;
51
+ /**
52
+ * How long a stream that has ALREADY started may go without a single byte
53
+ * before the provider abandons it (ms). Defaults to 60 000.
54
+ *
55
+ * Measured over the socket, not over content: once the reply has started, any
56
+ * byte proves the connection is alive, and a stretch with none is a broken
57
+ * stream rather than a slow one. Abandoning it here is not retried — the
58
+ * partial reply is already on the wire — it is reported as an error event for
59
+ * the caller's own ladder, which keeps the partial.
60
+ */
61
+ streamSilenceTimeoutMs?: number;
37
62
  }
38
63
  /**
39
64
  * Process Env interface.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,wFAAwF;IACxF,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,mFAAmF;IACnF,yBAAyB,CAAC,EAAE,MAAM,CAAA;CACnC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAElF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,wFAAwF;IACxF,WAAW,CAAC,EAAE,mBAAmB,CAAA;IACjC,8GAA8G;IAC9G,aAAa,CAAC,EAAE,qBAAqB,CAAA;IACrC;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;OASG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,mFAAmF;IACnF,yBAAyB,CAAC,EAAE,MAAM,CAAA;CACnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-deepseek",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
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.0",
36
+ "@molecule/api-ai": "1.3.2",
37
37
  "@molecule/api-bond": "1.0.2",
38
38
  "@types/node": "26.1.2",
39
39
  "typescript": "6.0.3",