mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: subagent feature wip
This commit is contained in:
@@ -258,10 +258,8 @@ describe('TaskTool', () => {
|
||||
beforeEach(() => {
|
||||
mockSubagentScope = {
|
||||
runNonInteractive: vi.fn().mockResolvedValue(undefined),
|
||||
output: {
|
||||
result: 'Task completed successfully',
|
||||
terminate_reason: SubagentTerminateMode.GOAL,
|
||||
},
|
||||
result: 'Task completed successfully',
|
||||
terminateMode: SubagentTerminateMode.GOAL,
|
||||
getFinalText: vi.fn().mockReturnValue('Task completed successfully'),
|
||||
formatCompactResult: vi
|
||||
.fn()
|
||||
@@ -305,6 +303,7 @@ describe('TaskTool', () => {
|
||||
successfulToolCalls: 3,
|
||||
failedToolCalls: 0,
|
||||
}),
|
||||
getTerminateMode: vi.fn().mockReturnValue(SubagentTerminateMode.GOAL),
|
||||
} as unknown as SubAgentScope;
|
||||
|
||||
mockContextState = {
|
||||
@@ -375,25 +374,6 @@ describe('TaskTool', () => {
|
||||
expect(display.subagentName).toBe('non-existent');
|
||||
});
|
||||
|
||||
it('should handle subagent execution failure', async () => {
|
||||
mockSubagentScope.output.terminate_reason = SubagentTerminateMode.ERROR;
|
||||
|
||||
const params: TaskParams = {
|
||||
description: 'Search files',
|
||||
prompt: 'Find all TypeScript files',
|
||||
subagent_type: 'file-search',
|
||||
};
|
||||
|
||||
const invocation = (
|
||||
taskTool as TaskToolWithProtectedMethods
|
||||
).createInvocation(params);
|
||||
const result = await invocation.execute();
|
||||
|
||||
const display = result.returnDisplay as TaskResultDisplay;
|
||||
expect(display.status).toBe('failed');
|
||||
expect(display.terminateReason).toBe('ERROR');
|
||||
});
|
||||
|
||||
it('should handle execution errors gracefully', async () => {
|
||||
vi.mocked(mockSubagentManager.createSubagentScope).mockRejectedValue(
|
||||
new Error('Creation failed'),
|
||||
|
||||
Reference in New Issue
Block a user