Skip to content
Merged
850 changes: 261 additions & 589 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
},
"dependencies": {
"@agentclientprotocol/sdk": "^0.14.1",
"@google/genai": "1.30.0",
"@google/genai": "2.6.0",
"@iarna/toml": "^2.2.5",
"@modelcontextprotocol/sdk": "^1.25.1",
"@modelcontextprotocol/sdk": "^1.25.2",
"@qwen-code/acp-bridge": "file:../acp-bridge",
"@qwen-code/channel-base": "file:../channels/base",
"@qwen-code/channel-dingtalk": "file:../channels/dingtalk",
Expand Down
16 changes: 16 additions & 0 deletions packages/cli/src/ui/hooks/useGeminiStream.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3916,6 +3916,22 @@ describe('useGeminiStream', () => {
reason: 'IMAGE_SAFETY',
message: '⚠️ Response stopped due to image safety violations.',
},
{
reason: 'IMAGE_PROHIBITED_CONTENT',
message: '⚠️ Response stopped due to image prohibited content.',
},
{
reason: 'NO_IMAGE',
message: '⚠️ Response stopped due to no image.',
},
{
reason: 'IMAGE_RECITATION',
message: '⚠️ Response stopped due to image recitation policy.',
},
{
reason: 'IMAGE_OTHER',
message: '⚠️ Response stopped due to other image-related reasons.',
},
{
reason: 'UNEXPECTED_TOOL_CALL',
message: '⚠️ Response stopped due to unexpected tool call.',
Expand Down
8 changes: 6 additions & 2 deletions packages/cli/src/ui/hooks/useGeminiStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1164,11 +1164,15 @@ export const useGeminiStream = (
'Response stopped due to malformed function call.',
[FinishReason.IMAGE_SAFETY]:
'Response stopped due to image safety violations.',
[FinishReason.UNEXPECTED_TOOL_CALL]:
'Response stopped due to unexpected tool call.',
[FinishReason.IMAGE_PROHIBITED_CONTENT]:
'Response stopped due to image prohibited content.',
[FinishReason.IMAGE_RECITATION]:
Comment thread
InfiniteUselessness marked this conversation as resolved.
Resolved
'Response stopped due to image recitation policy.',
[FinishReason.IMAGE_OTHER]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The IMAGE_OTHER message says "other image safety reasons" but the SDK defines IMAGE_OTHER as "Image generation stopped for a reason not otherwise specified" — not necessarily safety-related. Consider rewording:

Suggested change
[FinishReason.IMAGE_OTHER]:
[FinishReason.IMAGE_OTHER]:
'Response stopped due to other image-related reasons.',

— qwen3.7-max via Qwen Code /review

'Response stopped due to other image-related reasons.',
[FinishReason.NO_IMAGE]: 'Response stopped due to no image.',
[FinishReason.UNEXPECTED_TOOL_CALL]:
'Response stopped due to unexpected tool call.',
};

const message = finishReasonMessages[finishReason];
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
],
"dependencies": {
"@anthropic-ai/sdk": "^0.36.1",
"@google/genai": "1.30.0",
"@google/genai": "2.6.0",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] @google/genai@2.6.0 declares @modelcontextprotocol/sdk@^1.25.2 as an optional peer dependency, but the lockfile resolves 1.25.1 which does not satisfy ^1.25.2. Since the peer dep is optional, npm install won't warn — but mcpToTool() (used in packages/core/src/tools/mcp-client.ts) may run against a version the SDK wasn't tested with. Consider bumping @modelcontextprotocol/sdk to ^1.25.2.

— qwen3.7-max via Qwen Code /review

"@iarna/toml": "^2.2.5",
"@modelcontextprotocol/sdk": "^1.25.1",
"@modelcontextprotocol/sdk": "^1.25.2",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-logs-otlp-grpc": "^0.203.0",
"@opentelemetry/exporter-logs-otlp-http": "^0.203.0",
Expand Down
36 changes: 36 additions & 0 deletions packages/core/src/core/openaiContentGenerator/converter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { RequestContext } from './types.js';
import {
Type,
FinishReason,
type GenerateContentResponse,
type GenerateContentParameters,
type Content,
type Part,
Expand Down Expand Up @@ -4231,6 +4232,41 @@ describe('Truncated tool call detection in streaming', () => {
});
});

describe('mapGeminiFinishReasonToOpenAI', () => {
it.each([
[FinishReason.STOP, 'stop'],
[FinishReason.MAX_TOKENS, 'length'],
[FinishReason.SAFETY, 'content_filter'],
[FinishReason.RECITATION, 'content_filter'],
[FinishReason.BLOCKLIST, 'content_filter'],
[FinishReason.PROHIBITED_CONTENT, 'content_filter'],
[FinishReason.SPII, 'content_filter'],
[FinishReason.IMAGE_SAFETY, 'content_filter'],
[FinishReason.IMAGE_RECITATION, 'content_filter'],
[FinishReason.IMAGE_PROHIBITED_CONTENT, 'content_filter'],
[FinishReason.IMAGE_OTHER, 'content_filter'],
[FinishReason.NO_IMAGE, 'stop'],
[undefined, 'stop'],
])('maps %s to %s', (geminiReason, expected) => {
const response = OpenAIContentConverter.convertGeminiResponseToOpenAI(
{
candidates: [{ finishReason: geminiReason, content: { parts: [] } }],
} as unknown as GenerateContentResponse,
{
model: 'test-model',
modalities: {
image: true,
pdf: true,
audio: true,
video: true,
},
startTime: 0,
},
);
expect(response.choices[0].finish_reason).toBe(expected);
});
});

describe('modality filtering', () => {
function makeRequest(parts: Part[]): GenerateContentParameters {
return {
Expand Down
13 changes: 10 additions & 3 deletions packages/core/src/core/openaiContentGenerator/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1378,11 +1378,18 @@ function mapGeminiFinishReasonToOpenAI(
case FinishReason.MAX_TOKENS:
return 'length';
case FinishReason.SAFETY:
case FinishReason.RECITATION:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The 6 new switch cases (RECITATION, IMAGE_SAFETY, IMAGE_RECITATION, IMAGE_PROHIBITED_CONTENT, IMAGE_OTHER, NO_IMAGE) in mapGeminiFinishReasonToOpenAI have no test coverage in converter.test.ts. The coverage added in useGeminiStream.test.tsx tests the display messages (a separate code path), not the finish_reason mapping. A regression that changes one of these mappings would not be caught.

Consider adding a parameterized test:

it.each([
  [FinishReason.RECITATION, 'content_filter'],
  [FinishReason.IMAGE_SAFETY, 'content_filter'],
  [FinishReason.IMAGE_RECITATION, 'content_filter'],
  [FinishReason.IMAGE_PROHIBITED_CONTENT, 'content_filter'],
  [FinishReason.IMAGE_OTHER, 'content_filter'],
  [FinishReason.NO_IMAGE, 'content_filter'],
])('maps %s to %s', (reason, expected) => {
  // test via convertGeminiResponseToOpenAI or export mapGeminiFinishReasonToOpenAI
});

— qwen3.7-max via Qwen Code /review

case FinishReason.BLOCKLIST:
case FinishReason.PROHIBITED_CONTENT:
case FinishReason.SPII:
case FinishReason.IMAGE_SAFETY:
case FinishReason.IMAGE_RECITATION:
case FinishReason.IMAGE_PROHIBITED_CONTENT:
case FinishReason.IMAGE_OTHER:
return 'content_filter';
case FinishReason.NO_IMAGE:
return 'stop';
default:
Comment thread
InfiniteUselessness marked this conversation as resolved.
Resolved
if (geminiReason === ('RECITATION' as FinishReason)) {
return 'content_filter';
}
return 'stop';
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"node": ">=22.0.0"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.25.1",
"@modelcontextprotocol/sdk": "^1.25.2",
"zod": "^3.25.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-ide-companion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
"@agentclientprotocol/sdk": "^0.14.1",
"@qwen-code/sdk": "*",
"@qwen-code/webui": "*",
"@modelcontextprotocol/sdk": "^1.25.1",
"@modelcontextprotocol/sdk": "^1.25.2",
"cors": "^2.8.5",
"dotenv": "^17.1.0",
"express": "^5.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/web-templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
],
"dependencies": {},
"devDependencies": {
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.2.0",
"autoprefixer": "^10.4.22",
"postcss": "^8.5.6",
Expand Down
Loading