Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
fix(providers): preserve DeepSeek router capabilities
release-verificationb20240e6a8da
diff --git a/src/chrome/src/providers/deepseek-config.js b/src/chrome/src/providers/deepseek-config.jsindex a48996f04..930d38b63 100644--- a/src/chrome/src/providers/deepseek-config.js+++ b/src/chrome/src/providers/deepseek-config.js@@ -137,7 +137,9 @@ export function deepSeekThinkingExtras({} = {}) {if (!direct) return { chat_template_kwargs: { thinking: enabled } };if (responses) {- return { reasoning: { effort: enabled ? mappedDeepSeekReasoningEffort(effort) : 'none' } };+ // Responses API callers need an explicit value. Match DeepSeek's documented+ // default instead of inheriting the generic OpenAI Responses default.+ return { reasoning: { effort: enabled ? mappedDeepSeekReasoningEffort(effort === 'auto' ? 'high' : effort) : 'none' } };}if (!enabled) return { thinking: { type: 'disabled' } };return {diff --git a/src/chrome/src/providers/manager.js b/src/chrome/src/providers/manager.jsindex d27251020..73f3d5691 100644--- a/src/chrome/src/providers/manager.js+++ b/src/chrome/src/providers/manager.js@@ -30,6 +30,7 @@ import {DEEPSEEK_DEFAULT_MODEL,DEEPSEEK_LEGACY_DEFAULT_BASE_URL,DEEPSEEK_LEGACY_DEFAULT_MODEL,+ isDeepSeekModel,} from './deepseek-config.js';// Static, NOT dynamic: this module runs in the MV3 service worker, where// `await import()` throws "import() is disallowed on ServiceWorkerGlobalScope".@@ -1258,10 +1259,11 @@ export class ProviderManager {case 'webgpu':return new WebGPUProvider(normalizedConfig);case 'openai':- // The DeepSeek card (and any card pointed at DeepSeek's own API, or one- // that explicitly opts into the `deepseek` preset) gets the dedicated- // provider; every other OpenAI-compatible endpoint stays generic.- return isDirectDeepSeekConfig(normalizedConfig)+ // All non-local DeepSeek cards use the dedicated capability hooks. Only+ // direct cards opt into DeepSeek's native request contract; router cards+ // retain their existing OpenRouter compatibility preset.+ return (isDirectDeepSeekConfig(normalizedConfig)+ || (normalizedConfig.category !== 'local' && isDeepSeekModel(normalizedConfig.model)))? new DeepSeekProvider(normalizedConfig): new OpenAICompatibleProvider(normalizedConfig);case 'azure_openai':diff --git a/src/chrome/src/providers/provider-compatibility.js b/src/chrome/src/providers/provider-compatibility.jsindex cf2fcd874..7d0de62b6 100644--- a/src/chrome/src/providers/provider-compatibility.js+++ b/src/chrome/src/providers/provider-compatibility.js@@ -375,7 +375,11 @@ function mappedReasoningEffort(effort, preset) {export function compatibilityRequestBody(config = {}) {const compat = normalizeProviderCompatibility(config);- if (compat.reasoningEffort === 'auto') return {};+ // Direct DeepSeek Responses requests need an explicit effort. Its documented+ // default is high, unlike the generic OpenAI Responses default of medium.+ if (compat.reasoningEffort === 'auto' && !(+ isDirectDeepSeekConfig(config) && shouldUseOpenAIResponsesApi(config)+ )) return {};const preset = effectiveCompatibilityPreset(config);const enabled = compat.reasoningEffort !== 'off';diff --git a/src/firefox/src/providers/deepseek-config.js b/src/firefox/src/providers/deepseek-config.jsindex a48996f04..930d38b63 100644--- a/src/firefox/src/providers/deepseek-config.js+++ b/src/firefox/src/providers/deepseek-config.js@@ -137,7 +137,9 @@ export function deepSeekThinkingExtras({} = {}) {if (!direct) return { chat_template_kwargs: { thinking: enabled } };if (responses) {- return { reasoning: { effort: enabled ? mappedDeepSeekReasoningEffort(effort) : 'none' } };+ // Responses API callers need an explicit value. Match DeepSeek's documented+ // default instead of inheriting the generic OpenAI Responses default.+ return { reasoning: { effort: enabled ? mappedDeepSeekReasoningEffort(effort === 'auto' ? 'high' : effort) : 'none' } };}if (!enabled) return { thinking: { type: 'disabled' } };return {diff --git a/src/firefox/src/providers/manager.js b/src/firefox/src/providers/manager.jsindex ae558118b..1fdeb5c87 100644--- a/src/firefox/src/providers/manager.js+++ b/src/firefox/src/providers/manager.js@@ -12,6 +12,7 @@ import {DEEPSEEK_DEFAULT_MODEL,DEEPSEEK_LEGACY_DEFAULT_BASE_URL,DEEPSEEK_LEGACY_DEFAULT_MODEL,+ isDeepSeekModel,} from './deepseek-config.js';import { fetchWithTimeout } from './fetch-timeout.js';import {@@ -1149,10 +1150,11 @@ export class ProviderManager {case 'llamacpp':return new LlamaCppProvider(normalizedConfig);case 'openai':- // The DeepSeek card (and any card pointed at DeepSeek's own API, or one- // that explicitly opts into the `deepseek` preset) gets the dedicated- // provider; every other OpenAI-compatible endpoint stays generic.- return isDirectDeepSeekConfig(normalizedConfig)+ // All non-local DeepSeek cards use the dedicated capability hooks. Only+ // direct cards opt into DeepSeek's native request contract; router cards+ // retain their existing OpenRouter compatibility preset.+ return (isDirectDeepSeekConfig(normalizedConfig)+ || (normalizedConfig.category !== 'local' && isDeepSeekModel(normalizedConfig.model)))? new DeepSeekProvider(normalizedConfig): new OpenAICompatibleProvider(normalizedConfig);case 'azure_openai':diff --git a/src/firefox/src/providers/provider-compatibility.js b/src/firefox/src/providers/provider-compatibility.jsindex cf2fcd874..7d0de62b6 100644--- a/src/firefox/src/providers/provider-compatibility.js+++ b/src/firefox/src/providers/provider-compatibility.js@@ -375,7 +375,11 @@ function mappedReasoningEffort(effort, preset) {export function compatibilityRequestBody(config = {}) {const compat = normalizeProviderCompatibility(config);- if (compat.reasoningEffort === 'auto') return {};+ // Direct DeepSeek Responses requests need an explicit effort. Its documented+ // default is high, unlike the generic OpenAI Responses default of medium.+ if (compat.reasoningEffort === 'auto' && !(+ isDirectDeepSeekConfig(config) && shouldUseOpenAIResponsesApi(config)+ )) return {};const preset = effectiveCompatibilityPreset(config);const enabled = compat.reasoningEffort !== 'off';diff --git a/test/run.js b/test/run.jsindex 32527bb5a..b123ab06d 100644--- a/test/run.js+++ b/test/run.js@@ -71908,17 +71908,19 @@ test('DeepSeek Chat Completions uses native thinking, vision, streaming, and rep'DeepSeekProvider',`${PM.name}: a duplicated DeepSeek card keeps the dedicated provider`,);- assert.equal(- manager._createProvider('openrouter', {+ const routerFlash = manager._createProvider('openrouter', {type: 'openai',category: 'router',providerName: 'openrouter',baseUrl: 'https://openrouter.ai/api/v1',- model: 'deepseek/deepseek-v4',- }).constructor.name,- 'OpenAICompatibleProvider',- `${PM.name}: a router-hosted DeepSeek model stays on the generic provider`,+ model: 'deepseek/deepseek-v4-flash-vision-exp',+ });+ assert.equal(+ routerFlash.constructor.name,+ 'DeepSeekProvider',+ `${PM.name}: a router-hosted DeepSeek Flash model uses dedicated capability detection`,);+ assert.equal(routerFlash.supportsVision, true, `${PM.name}: router-hosted DeepSeek Flash aliases retain vision detection`);const migrated = manager._migrateStoredProviderConfigs({deepseek: {model: 'deepseek-v4-flash',@@ -72001,6 +72003,17 @@ test('DeepSeek Chat Completions uses native thinking, vision, streaming, and repassert.equal(responsesBody.thinking, undefined, `${label}: Responses must not carry the Chat Completions thinking object`);assert.equal(responsesBody.reasoning_effort, undefined, `${label}: Responses must not carry top-level reasoning_effort`);+ const defaultResponsesProvider = new Provider({+ ...provider.config,+ compat: { reasoningEffort: 'auto' },+ apiFormat: 'responses',+ });+ assert.deepEqual(+ defaultResponsesProvider._buildResponsesBody([{ role: 'user', content: 'Read the page' }], {}, false).reasoning,+ { effort: 'high' },+ `${label}: DeepSeek Responses uses its documented high default for auto effort`,+ );+const agent = new AgentClass({});const assistant = {role: 'assistant',