From 6142fbf64a87bde3c32165e3354de78f50cf2f24 Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Fri, 22 Aug 2025 15:17:42 +0800 Subject: [PATCH 1/3] fix: invalid web search tool schema when using deepseek api --- packages/core/src/tools/web-search.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/src/tools/web-search.ts b/packages/core/src/tools/web-search.ts index adeda1a7..eacb4143 100644 --- a/packages/core/src/tools/web-search.ts +++ b/packages/core/src/tools/web-search.ts @@ -5,7 +5,6 @@ */ import { BaseTool, Icon, ToolResult } from './tools.js'; -import { Type } from '@google/genai'; import { SchemaValidator } from '../utils/schemaValidator.js'; import { getErrorMessage } from '../utils/errors.js'; import { Config } from '../config/config.js'; @@ -57,10 +56,10 @@ export class WebSearchTool extends BaseTool< 'Performs a web search using the Tavily API and returns a concise answer with sources. Requires the TAVILY_API_KEY environment variable.', Icon.Globe, { - type: Type.OBJECT, + type: 'object', properties: { query: { - type: Type.STRING, + type: 'string', description: 'The search query to find information on the web.', }, }, From a6ce22773bbd782adf834284b152089d5527c6a6 Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Fri, 22 Aug 2025 15:21:55 +0800 Subject: [PATCH 2/3] feat: add specific header for dashscope provider --- packages/core/src/core/openaiContentGenerator.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/core/openaiContentGenerator.ts b/packages/core/src/core/openaiContentGenerator.ts index 3f223f3e..8f05f2e0 100644 --- a/packages/core/src/core/openaiContentGenerator.ts +++ b/packages/core/src/core/openaiContentGenerator.ts @@ -129,6 +129,7 @@ export class OpenAIContentGenerator implements ContentGenerator { : isDashScopeProvider ? { 'X-DashScope-CacheControl': 'enable', + 'X-DashScope-UserAgent': userAgent, } : {}), }; From aebb69925c92e1f44f71ad7d85ba3196ff680c8f Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Fri, 22 Aug 2025 16:15:32 +0800 Subject: [PATCH 3/3] fix: invalid tool call with IDE companion feature enabled --- packages/core/src/core/client.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts index 876e9027..e1da0471 100644 --- a/packages/core/src/core/client.ts +++ b/packages/core/src/core/client.ts @@ -485,7 +485,24 @@ export class GeminiClient { } } - if (this.config.getIdeModeFeature() && this.config.getIdeMode()) { + // Prevent context updates from being sent while a tool call is + // waiting for a response. The Qwen API requires that a functionResponse + // part from the user immediately follows a functionCall part from the model + // in the conversation history . The IDE context is not discarded; it will + // be included in the next regular message sent to the model. + const history = this.getHistory(); + const lastMessage = + history.length > 0 ? history[history.length - 1] : undefined; + const hasPendingToolCall = + !!lastMessage && + lastMessage.role === 'model' && + (lastMessage.parts?.some((p) => 'functionCall' in p) || false); + + if ( + this.config.getIdeModeFeature() && + this.config.getIdeMode() && + !hasPendingToolCall + ) { const { contextParts, newIdeContext } = this.getIdeContextParts( this.forceFullIdeContext || this.getHistory().length === 0, );