mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 20:20:57 +00:00
Merge branch 'main' into feat/debug-logging-refactor
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
commit
135df54f27
378 changed files with 40051 additions and 6776 deletions
|
|
@ -981,26 +981,6 @@ describe('createTaskToolProgressHandler', () => {
|
|||
expect(mockAdapter.emitToolResult).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should work without adapter (non-JSON mode)', () => {
|
||||
const { handler } = createTaskToolProgressHandler(
|
||||
mockConfig,
|
||||
'parent-tool-id',
|
||||
undefined,
|
||||
);
|
||||
|
||||
const taskDisplay: TaskResultDisplay = {
|
||||
type: 'task_execution',
|
||||
subagentName: 'test-agent',
|
||||
taskDescription: 'Test task',
|
||||
taskPrompt: 'Test prompt',
|
||||
status: 'running',
|
||||
toolCalls: [],
|
||||
};
|
||||
|
||||
// Should not throw
|
||||
expect(() => handler('task-call-id', taskDisplay)).not.toThrow();
|
||||
});
|
||||
|
||||
it('should work with adapter that does not support subagent APIs', () => {
|
||||
const limitedAdapter = {
|
||||
emitToolResult: vi.fn(),
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ export async function buildSystemMessage(
|
|||
export function createTaskToolProgressHandler(
|
||||
config: Config,
|
||||
taskToolCallId: string,
|
||||
adapter: JsonOutputAdapterInterface | undefined,
|
||||
adapter: JsonOutputAdapterInterface,
|
||||
): {
|
||||
handler: OutputUpdateHandler;
|
||||
} {
|
||||
|
|
@ -405,7 +405,7 @@ export function createTaskToolProgressHandler(
|
|||
toolCallToEmit.status === 'executing' ||
|
||||
toolCallToEmit.status === 'awaiting_approval'
|
||||
) {
|
||||
if (adapter?.processSubagentToolCall) {
|
||||
if (adapter.processSubagentToolCall) {
|
||||
adapter.processSubagentToolCall(toolCallToEmit, taskToolCallId);
|
||||
emittedToolUseIds.add(toolCall.callId);
|
||||
}
|
||||
|
|
@ -431,19 +431,17 @@ export function createTaskToolProgressHandler(
|
|||
// Mark as emitted even if we skip, to prevent duplicate emits
|
||||
emittedToolResultIds.add(toolCall.callId);
|
||||
|
||||
if (adapter) {
|
||||
const request = buildRequest(toolCall);
|
||||
const response = buildResponse(toolCall);
|
||||
// For subagent tool results, we need to pass parentToolUseId
|
||||
// The adapter implementations accept an optional parentToolUseId parameter
|
||||
if (
|
||||
'emitToolResult' in adapter &&
|
||||
typeof adapter.emitToolResult === 'function'
|
||||
) {
|
||||
adapter.emitToolResult(request, response, taskToolCallId);
|
||||
} else {
|
||||
adapter.emitToolResult(request, response);
|
||||
}
|
||||
const request = buildRequest(toolCall);
|
||||
const response = buildResponse(toolCall);
|
||||
// For subagent tool results, we need to pass parentToolUseId
|
||||
// The adapter implementations accept an optional parentToolUseId parameter
|
||||
if (
|
||||
'emitToolResult' in adapter &&
|
||||
typeof adapter.emitToolResult === 'function'
|
||||
) {
|
||||
adapter.emitToolResult(request, response, taskToolCallId);
|
||||
} else {
|
||||
adapter.emitToolResult(request, response);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -500,12 +498,6 @@ export function createTaskToolProgressHandler(
|
|||
const taskDisplay = outputChunk as TaskResultDisplay;
|
||||
const previous = previousTaskStates.get(callId);
|
||||
|
||||
// If no adapter, just track state (for non-JSON modes)
|
||||
if (!adapter) {
|
||||
previousTaskStates.set(callId, taskDisplay);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only process if adapter supports subagent APIs
|
||||
if (
|
||||
!adapter.processSubagentToolCall ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue