@qwen-code/qwen-code 0.10.0-preview.2 → 0.10.0-preview.3
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/cli.js +158 -19
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -71639,6 +71639,17 @@ var init_tools = __esm({
|
|
|
71639
71639
|
});
|
|
71640
71640
|
|
|
71641
71641
|
// packages/core/dist/src/tools/mcp-tool.js
|
|
71642
|
+
function wrapMcpCallToolResultAsParts(toolName, result) {
|
|
71643
|
+
const response = result.isError ? { error: result, content: result.content } : result;
|
|
71644
|
+
return [
|
|
71645
|
+
{
|
|
71646
|
+
functionResponse: {
|
|
71647
|
+
name: toolName,
|
|
71648
|
+
response
|
|
71649
|
+
}
|
|
71650
|
+
}
|
|
71651
|
+
];
|
|
71652
|
+
}
|
|
71642
71653
|
function transformTextBlock(block2) {
|
|
71643
71654
|
return { text: block2.text };
|
|
71644
71655
|
}
|
|
@@ -71756,8 +71767,10 @@ var init_mcp_tool = __esm({
|
|
|
71756
71767
|
displayName;
|
|
71757
71768
|
trust;
|
|
71758
71769
|
cliConfig;
|
|
71770
|
+
mcpClient;
|
|
71771
|
+
mcpTimeout;
|
|
71759
71772
|
static allowlist = /* @__PURE__ */ new Set();
|
|
71760
|
-
constructor(mcpTool, serverName, serverToolName, displayName, trust, params = {}, cliConfig) {
|
|
71773
|
+
constructor(mcpTool, serverName, serverToolName, displayName, trust, params = {}, cliConfig, mcpClient, mcpTimeout) {
|
|
71761
71774
|
super(params);
|
|
71762
71775
|
this.mcpTool = mcpTool;
|
|
71763
71776
|
this.serverName = serverName;
|
|
@@ -71765,6 +71778,8 @@ var init_mcp_tool = __esm({
|
|
|
71765
71778
|
this.displayName = displayName;
|
|
71766
71779
|
this.trust = trust;
|
|
71767
71780
|
this.cliConfig = cliConfig;
|
|
71781
|
+
this.mcpClient = mcpClient;
|
|
71782
|
+
this.mcpTimeout = mcpTimeout;
|
|
71768
71783
|
}
|
|
71769
71784
|
async shouldConfirmExecute(_abortSignal) {
|
|
71770
71785
|
const serverAllowListKey = this.serverName;
|
|
@@ -71808,7 +71823,63 @@ var init_mcp_tool = __esm({
|
|
|
71808
71823
|
}
|
|
71809
71824
|
return false;
|
|
71810
71825
|
}
|
|
71811
|
-
async execute(signal) {
|
|
71826
|
+
async execute(signal, updateOutput2) {
|
|
71827
|
+
if (this.mcpClient) {
|
|
71828
|
+
return this.executeWithDirectClient(signal, updateOutput2);
|
|
71829
|
+
}
|
|
71830
|
+
return this.executeWithCallableTool(signal);
|
|
71831
|
+
}
|
|
71832
|
+
/**
|
|
71833
|
+
* Execute using the raw MCP SDK Client, which supports progress
|
|
71834
|
+
* notifications via the onprogress callback. This enables real-time
|
|
71835
|
+
* streaming of progress updates to the user during long-running
|
|
71836
|
+
* MCP tool calls (e.g., browser automation).
|
|
71837
|
+
*/
|
|
71838
|
+
async executeWithDirectClient(signal, updateOutput2) {
|
|
71839
|
+
const callToolResult = await this.mcpClient.callTool({
|
|
71840
|
+
name: this.serverToolName,
|
|
71841
|
+
arguments: this.params
|
|
71842
|
+
}, void 0, {
|
|
71843
|
+
onprogress: /* @__PURE__ */ __name((progress) => {
|
|
71844
|
+
if (updateOutput2) {
|
|
71845
|
+
const progressData = {
|
|
71846
|
+
type: "mcp_tool_progress",
|
|
71847
|
+
progress: progress.progress,
|
|
71848
|
+
...progress.total != null && { total: progress.total },
|
|
71849
|
+
...progress.message != null && { message: progress.message }
|
|
71850
|
+
};
|
|
71851
|
+
updateOutput2(progressData);
|
|
71852
|
+
}
|
|
71853
|
+
}, "onprogress"),
|
|
71854
|
+
timeout: this.mcpTimeout,
|
|
71855
|
+
signal
|
|
71856
|
+
});
|
|
71857
|
+
const rawResponseParts = wrapMcpCallToolResultAsParts(this.serverToolName, callToolResult);
|
|
71858
|
+
if (this.isMCPToolError(rawResponseParts)) {
|
|
71859
|
+
const errorMessage = `MCP tool '${this.serverToolName}' reported tool error for function call: ${safeJsonStringify({
|
|
71860
|
+
name: this.serverToolName,
|
|
71861
|
+
args: this.params
|
|
71862
|
+
})} with response: ${safeJsonStringify(rawResponseParts)}`;
|
|
71863
|
+
return {
|
|
71864
|
+
llmContent: errorMessage,
|
|
71865
|
+
returnDisplay: `Error: MCP tool '${this.serverToolName}' reported an error.`,
|
|
71866
|
+
error: {
|
|
71867
|
+
message: errorMessage,
|
|
71868
|
+
type: ToolErrorType.MCP_TOOL_ERROR
|
|
71869
|
+
}
|
|
71870
|
+
};
|
|
71871
|
+
}
|
|
71872
|
+
const transformedParts = transformMcpContentToParts(rawResponseParts);
|
|
71873
|
+
return {
|
|
71874
|
+
llmContent: transformedParts,
|
|
71875
|
+
returnDisplay: getStringifiedResultForDisplay(rawResponseParts)
|
|
71876
|
+
};
|
|
71877
|
+
}
|
|
71878
|
+
/**
|
|
71879
|
+
* Fallback: execute using the @google/genai CallableTool wrapper.
|
|
71880
|
+
* This path does NOT support progress notifications.
|
|
71881
|
+
*/
|
|
71882
|
+
async executeWithCallableTool(signal) {
|
|
71812
71883
|
const functionCalls = [
|
|
71813
71884
|
{
|
|
71814
71885
|
name: this.serverToolName,
|
|
@@ -71871,7 +71942,9 @@ var init_mcp_tool = __esm({
|
|
|
71871
71942
|
parameterSchema;
|
|
71872
71943
|
trust;
|
|
71873
71944
|
cliConfig;
|
|
71874
|
-
|
|
71945
|
+
mcpClient;
|
|
71946
|
+
mcpTimeout;
|
|
71947
|
+
constructor(mcpTool, serverName, serverToolName, description, parameterSchema, trust, nameOverride, cliConfig, mcpClient, mcpTimeout) {
|
|
71875
71948
|
super(
|
|
71876
71949
|
nameOverride ?? generateValidName(`mcp__${serverName}__${serverToolName}`),
|
|
71877
71950
|
`${serverToolName} (${serverName} MCP Server)`,
|
|
@@ -71880,7 +71953,7 @@ var init_mcp_tool = __esm({
|
|
|
71880
71953
|
parameterSchema,
|
|
71881
71954
|
true,
|
|
71882
71955
|
// isOutputMarkdown
|
|
71883
|
-
|
|
71956
|
+
true
|
|
71884
71957
|
);
|
|
71885
71958
|
this.mcpTool = mcpTool;
|
|
71886
71959
|
this.serverName = serverName;
|
|
@@ -71888,14 +71961,17 @@ var init_mcp_tool = __esm({
|
|
|
71888
71961
|
this.parameterSchema = parameterSchema;
|
|
71889
71962
|
this.trust = trust;
|
|
71890
71963
|
this.cliConfig = cliConfig;
|
|
71964
|
+
this.mcpClient = mcpClient;
|
|
71965
|
+
this.mcpTimeout = mcpTimeout;
|
|
71891
71966
|
}
|
|
71892
71967
|
asFullyQualifiedTool() {
|
|
71893
|
-
return new _DiscoveredMCPTool(this.mcpTool, this.serverName, this.serverToolName, this.description, this.parameterSchema, this.trust, generateValidName(`mcp__${this.serverName}__${this.serverToolName}`), this.cliConfig);
|
|
71968
|
+
return new _DiscoveredMCPTool(this.mcpTool, this.serverName, this.serverToolName, this.description, this.parameterSchema, this.trust, generateValidName(`mcp__${this.serverName}__${this.serverToolName}`), this.cliConfig, this.mcpClient, this.mcpTimeout);
|
|
71894
71969
|
}
|
|
71895
71970
|
createInvocation(params) {
|
|
71896
|
-
return new DiscoveredMCPToolInvocation(this.mcpTool, this.serverName, this.serverToolName, this.displayName, this.trust, params, this.cliConfig);
|
|
71971
|
+
return new DiscoveredMCPToolInvocation(this.mcpTool, this.serverName, this.serverToolName, this.displayName, this.trust, params, this.cliConfig, this.mcpClient, this.mcpTimeout);
|
|
71897
71972
|
}
|
|
71898
71973
|
};
|
|
71974
|
+
__name(wrapMcpCallToolResultAsParts, "wrapMcpCallToolResultAsParts");
|
|
71899
71975
|
__name(transformTextBlock, "transformTextBlock");
|
|
71900
71976
|
__name(transformImageAudioBlock, "transformImageAudioBlock");
|
|
71901
71977
|
__name(transformResourceBlock, "transformResourceBlock");
|
|
@@ -156312,7 +156388,7 @@ __export(geminiContentGenerator_exports, {
|
|
|
156312
156388
|
createGeminiContentGenerator: () => createGeminiContentGenerator
|
|
156313
156389
|
});
|
|
156314
156390
|
function createGeminiContentGenerator(config2, gcConfig) {
|
|
156315
|
-
const version2 = "0.10.0-preview.
|
|
156391
|
+
const version2 = "0.10.0-preview.3";
|
|
156316
156392
|
const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
156317
156393
|
const baseHeaders = {
|
|
156318
156394
|
"User-Agent": userAgent2
|
|
@@ -210519,13 +210595,26 @@ async function discoverTools(mcpServerName, mcpServerConfig, mcpClient, cliConfi
|
|
|
210519
210595
|
if (!Array.isArray(tool.functionDeclarations)) {
|
|
210520
210596
|
return [];
|
|
210521
210597
|
}
|
|
210598
|
+
const mcpTimeout = mcpServerConfig.timeout ?? MCP_DEFAULT_TIMEOUT_MSEC;
|
|
210522
210599
|
const discoveredTools = [];
|
|
210523
210600
|
for (const funcDecl of tool.functionDeclarations) {
|
|
210524
210601
|
try {
|
|
210525
210602
|
if (!isEnabled(funcDecl, mcpServerName, mcpServerConfig)) {
|
|
210526
210603
|
continue;
|
|
210527
210604
|
}
|
|
210528
|
-
discoveredTools.push(new DiscoveredMCPTool(
|
|
210605
|
+
discoveredTools.push(new DiscoveredMCPTool(
|
|
210606
|
+
mcpCallableTool,
|
|
210607
|
+
mcpServerName,
|
|
210608
|
+
funcDecl.name,
|
|
210609
|
+
funcDecl.description ?? "",
|
|
210610
|
+
funcDecl.parametersJsonSchema ?? { type: "object", properties: {} },
|
|
210611
|
+
mcpServerConfig.trust,
|
|
210612
|
+
void 0,
|
|
210613
|
+
cliConfig,
|
|
210614
|
+
mcpClient,
|
|
210615
|
+
// raw MCP Client for direct callTool with progress
|
|
210616
|
+
mcpTimeout
|
|
210617
|
+
));
|
|
210529
210618
|
} catch (error2) {
|
|
210530
210619
|
debugLogger49.error(`Error discovering tool: '${funcDecl.name}' from MCP server '${mcpServerName}': ${error2.message}`);
|
|
210531
210620
|
}
|
|
@@ -373022,7 +373111,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
373022
373111
|
// packages/cli/src/utils/version.ts
|
|
373023
373112
|
async function getCliVersion() {
|
|
373024
373113
|
const pkgJson = await getPackageJson();
|
|
373025
|
-
return "0.10.0-preview.
|
|
373114
|
+
return "0.10.0-preview.3";
|
|
373026
373115
|
}
|
|
373027
373116
|
__name(getCliVersion, "getCliVersion");
|
|
373028
373117
|
|
|
@@ -380545,7 +380634,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
380545
380634
|
|
|
380546
380635
|
// packages/cli/src/generated/git-commit.ts
|
|
380547
380636
|
init_esbuild_shims();
|
|
380548
|
-
var GIT_COMMIT_INFO = "
|
|
380637
|
+
var GIT_COMMIT_INFO = "4ee4bd08";
|
|
380549
380638
|
|
|
380550
380639
|
// packages/cli/src/utils/systemInfo.ts
|
|
380551
380640
|
async function getNpmVersion() {
|
|
@@ -387262,6 +387351,19 @@ async function buildSystemMessage(config2, sessionId, permissionMode, allowedBui
|
|
|
387262
387351
|
return systemMessage;
|
|
387263
387352
|
}
|
|
387264
387353
|
__name(buildSystemMessage, "buildSystemMessage");
|
|
387354
|
+
function isMcpToolProgressData(output) {
|
|
387355
|
+
return typeof output === "object" && output !== null && "type" in output && output.type === "mcp_tool_progress";
|
|
387356
|
+
}
|
|
387357
|
+
__name(isMcpToolProgressData, "isMcpToolProgressData");
|
|
387358
|
+
function createToolProgressHandler(request4, adapter) {
|
|
387359
|
+
const handler = /* @__PURE__ */ __name((_callId, output) => {
|
|
387360
|
+
if (isMcpToolProgressData(output)) {
|
|
387361
|
+
adapter.emitToolProgress(request4, output);
|
|
387362
|
+
}
|
|
387363
|
+
}, "handler");
|
|
387364
|
+
return { handler };
|
|
387365
|
+
}
|
|
387366
|
+
__name(createToolProgressHandler, "createToolProgressHandler");
|
|
387265
387367
|
function createTaskToolProgressHandler(config2, taskToolCallId, adapter) {
|
|
387266
387368
|
const previousTaskStates = /* @__PURE__ */ new Map();
|
|
387267
387369
|
const emittedToolUseIds = /* @__PURE__ */ new Set();
|
|
@@ -388094,6 +388196,16 @@ ${event.value}`, null);
|
|
|
388094
388196
|
};
|
|
388095
388197
|
this.emitMessageImpl(systemMessage);
|
|
388096
388198
|
}
|
|
388199
|
+
/**
|
|
388200
|
+
* Emits a tool progress stream event.
|
|
388201
|
+
* Default implementation is a no-op. StreamJsonOutputAdapter overrides this
|
|
388202
|
+
* to emit stream events when includePartialMessages is enabled.
|
|
388203
|
+
*
|
|
388204
|
+
* @param _request - Tool call request info
|
|
388205
|
+
* @param _progress - Structured MCP progress data
|
|
388206
|
+
*/
|
|
388207
|
+
emitToolProgress(_request, _progress) {
|
|
388208
|
+
}
|
|
388097
388209
|
/**
|
|
388098
388210
|
* Builds a result message from options.
|
|
388099
388211
|
* Helper method used by both emitResult implementations.
|
|
@@ -388473,6 +388585,27 @@ var StreamJsonOutputAdapter = class extends BaseJsonOutputAdapter {
|
|
|
388473
388585
|
);
|
|
388474
388586
|
}
|
|
388475
388587
|
}
|
|
388588
|
+
/**
|
|
388589
|
+
* Emits a tool progress stream event when partial messages are enabled.
|
|
388590
|
+
* This overrides the no-op in BaseJsonOutputAdapter.
|
|
388591
|
+
*/
|
|
388592
|
+
emitToolProgress(request4, progress) {
|
|
388593
|
+
if (!this.includePartialMessages) {
|
|
388594
|
+
return;
|
|
388595
|
+
}
|
|
388596
|
+
const partial2 = {
|
|
388597
|
+
type: "stream_event",
|
|
388598
|
+
uuid: randomUUID8(),
|
|
388599
|
+
session_id: this.getSessionId(),
|
|
388600
|
+
parent_tool_use_id: null,
|
|
388601
|
+
event: {
|
|
388602
|
+
type: "tool_progress",
|
|
388603
|
+
tool_use_id: request4.callId,
|
|
388604
|
+
content: progress
|
|
388605
|
+
}
|
|
388606
|
+
};
|
|
388607
|
+
this.emitMessageImpl(partial2);
|
|
388608
|
+
}
|
|
388476
388609
|
/**
|
|
388477
388610
|
* Emits stream events when partial messages are enabled.
|
|
388478
388611
|
* This is a private method specific to StreamJsonOutputAdapter.
|
|
@@ -388962,24 +389095,21 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
|
|
|
388962
389095
|
const inputFormat = typeof config2.getInputFormat === "function" ? config2.getInputFormat() : InputFormat.TEXT;
|
|
388963
389096
|
const toolCallUpdateCallback = inputFormat === InputFormat.STREAM_JSON && options2.controlService ? options2.controlService.permission.getToolCallUpdateCallback() : void 0;
|
|
388964
389097
|
const isTaskTool = finalRequestInfo.name === "task";
|
|
388965
|
-
const
|
|
389098
|
+
const { handler: outputUpdateHandler } = isTaskTool ? createTaskToolProgressHandler(
|
|
388966
389099
|
config2,
|
|
388967
389100
|
finalRequestInfo.callId,
|
|
388968
389101
|
adapter
|
|
388969
|
-
) :
|
|
388970
|
-
const taskToolProgressHandler = taskToolProgress?.handler;
|
|
389102
|
+
) : createToolProgressHandler(finalRequestInfo, adapter);
|
|
388971
389103
|
const toolResponse = await executeToolCall(
|
|
388972
389104
|
config2,
|
|
388973
389105
|
finalRequestInfo,
|
|
388974
389106
|
abortController.signal,
|
|
388975
|
-
|
|
388976
|
-
|
|
388977
|
-
outputUpdateHandler: taskToolProgressHandler
|
|
388978
|
-
},
|
|
389107
|
+
{
|
|
389108
|
+
outputUpdateHandler,
|
|
388979
389109
|
...toolCallUpdateCallback && {
|
|
388980
389110
|
onToolCallsUpdate: toolCallUpdateCallback
|
|
388981
389111
|
}
|
|
388982
|
-
}
|
|
389112
|
+
}
|
|
388983
389113
|
);
|
|
388984
389114
|
if (toolResponse.error) {
|
|
388985
389115
|
handleToolError(
|
|
@@ -412799,6 +412929,15 @@ var useResultDisplayRenderer = /* @__PURE__ */ __name((resultDisplay) => import_
|
|
|
412799
412929
|
data: resultDisplay
|
|
412800
412930
|
};
|
|
412801
412931
|
}
|
|
412932
|
+
if (typeof resultDisplay === "object" && resultDisplay !== null && "type" in resultDisplay && resultDisplay.type === "mcp_tool_progress") {
|
|
412933
|
+
const progress = resultDisplay;
|
|
412934
|
+
const msg = progress.message ?? `Progress: ${progress.progress}`;
|
|
412935
|
+
const totalStr = progress.total != null ? `/${progress.total}` : "";
|
|
412936
|
+
return {
|
|
412937
|
+
type: "string",
|
|
412938
|
+
data: `\u23F3 [${progress.progress}${totalStr}] ${msg}`
|
|
412939
|
+
};
|
|
412940
|
+
}
|
|
412802
412941
|
if (typeof resultDisplay === "object" && resultDisplay !== null && "ansiOutput" in resultDisplay) {
|
|
412803
412942
|
return { type: "ansi", data: resultDisplay.ansiOutput };
|
|
412804
412943
|
}
|
|
@@ -434813,7 +434952,7 @@ var GeminiAgent = class {
|
|
|
434813
434952
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
434814
434953
|
description: APPROVAL_MODE_INFO[mode].description
|
|
434815
434954
|
}));
|
|
434816
|
-
const version2 = "0.10.0-preview.
|
|
434955
|
+
const version2 = "0.10.0-preview.3";
|
|
434817
434956
|
return {
|
|
434818
434957
|
protocolVersion: PROTOCOL_VERSION,
|
|
434819
434958
|
agentInfo: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwen-code/qwen-code",
|
|
3
|
-
"version": "0.10.0-preview.
|
|
3
|
+
"version": "0.10.0-preview.3",
|
|
4
4
|
"description": "Qwen Code - AI-powered coding assistant",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"locales"
|
|
21
21
|
],
|
|
22
22
|
"config": {
|
|
23
|
-
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.10.0-preview.
|
|
23
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.10.0-preview.3"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {},
|
|
26
26
|
"optionalDependencies": {
|