@molecule/api-ai-deepseek 1.0.3 → 1.0.5

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.
@@ -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;IAoKzD;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IA4EtB;;;;;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,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"}
package/dist/provider.js CHANGED
@@ -90,7 +90,25 @@ class DeepseekAIProviderImpl {
90
90
  const allTools = [...functions, ...serverTools];
91
91
  if (allTools.length > 0) {
92
92
  body.tools = allTools;
93
- if (params.toolChoice === 'required') {
93
+ // DeepSeek REFUSES a forced tool choice while thinking is on — the request
94
+ // 400s with "Thinking mode does not support this tool_choice", which kills
95
+ // the turn outright. The caller asked for both; only one can be sent, so
96
+ // the quality setting is kept and the nudge is degraded to 'auto': a
97
+ // weaker nudge still produces a turn, and the agent loop has its own
98
+ // prose-only backstops, whereas a 400 produces nothing at all.
99
+ //
100
+ // Latent rather than live at the time of writing — no DeepSeek model in
101
+ // the catalog sets supportsThinking — but the model-health cron adds
102
+ // models to that catalog unattended, and the one place forceToolUse fires
103
+ // is discovery mode, i.e. the FIRST turn of every new conversation.
104
+ const forcedChoice = params.toolChoice === 'required' ||
105
+ (typeof params.toolChoice === 'object' && params.toolChoice?.type === 'tool');
106
+ if (forcedChoice && params.thinking) {
107
+ console.warn('[ai-deepseek] thinking is enabled, so the forced tool choice was relaxed to ' +
108
+ '"auto" — DeepSeek rejects the combination (400: "Thinking mode does not ' +
109
+ 'support this tool_choice").');
110
+ }
111
+ else if (params.toolChoice === 'required') {
94
112
  body.tool_choice = 'required';
95
113
  }
96
114
  else if (typeof params.toolChoice === 'object' && params.toolChoice?.type === 'tool') {
@@ -276,6 +294,11 @@ class DeepseekAIProviderImpl {
276
294
  for (const tr of toolResults) {
277
295
  formatted.push(tr);
278
296
  }
297
+ // Non-tool parts of the SAME message (an image riding a tool result — the
298
+ // screenshot tool) must not be dropped: Chat Completions accepts a user
299
+ // message after the tool messages, so emit them instead of losing them.
300
+ if (parts.length > 0)
301
+ formatted.push({ role: m.role, content: parts });
279
302
  }
280
303
  else if (toolCalls.length > 0) {
281
304
  // Assistant message with tool calls
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-deepseek",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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.2.1",
36
+ "@molecule/api-ai": "1.3.0",
37
37
  "@molecule/api-bond": "1.0.2",
38
38
  "@types/node": "26.1.2",
39
39
  "typescript": "6.0.3",