mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-03 06:00:49 +00:00
feat: add MCP tool progress update support in TUI and SDK mode
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
36931e1eab
commit
5ebbceea65
14 changed files with 724 additions and 25 deletions
|
|
@ -5,7 +5,11 @@
|
|||
*/
|
||||
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import type { Config } from '@qwen-code/qwen-code-core';
|
||||
import type {
|
||||
Config,
|
||||
ToolCallRequestInfo,
|
||||
McpToolProgressData,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import type {
|
||||
CLIAssistantMessage,
|
||||
CLIMessage,
|
||||
|
|
@ -267,6 +271,32 @@ export class StreamJsonOutputAdapter
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits a tool progress stream event when partial messages are enabled.
|
||||
* This overrides the no-op in BaseJsonOutputAdapter.
|
||||
*/
|
||||
override emitToolProgress(
|
||||
request: ToolCallRequestInfo,
|
||||
progress: McpToolProgressData,
|
||||
): void {
|
||||
if (!this.includePartialMessages) {
|
||||
return;
|
||||
}
|
||||
|
||||
const partial: CLIPartialAssistantMessage = {
|
||||
type: 'stream_event',
|
||||
uuid: randomUUID(),
|
||||
session_id: this.getSessionId(),
|
||||
parent_tool_use_id: null,
|
||||
event: {
|
||||
type: 'tool_progress',
|
||||
tool_use_id: request.callId,
|
||||
content: progress,
|
||||
},
|
||||
};
|
||||
this.emitMessageImpl(partial);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits stream events when partial messages are enabled.
|
||||
* This is a private method specific to StreamJsonOutputAdapter.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue