feat: subagent phase 2 implementation

This commit is contained in:
tanzhenxin
2025-09-03 19:17:29 +08:00
parent c49e4f6e8a
commit 5d8874205d
33 changed files with 2435 additions and 21 deletions

View File

@@ -144,8 +144,10 @@ describe('useSlashCommandProcessor', () => {
mockSetQuittingMessages,
vi.fn(), // openPrivacyNotice
vi.fn(), // openSettingsDialog
vi.fn(), // openSubagentCreateDialog
vi.fn(), // toggleVimEnabled
setIsProcessing,
vi.fn(), // setGeminiMdFileCount
),
);
@@ -894,11 +896,11 @@ describe('useSlashCommandProcessor', () => {
vi.fn(), // toggleCorgiMode
mockSetQuittingMessages,
vi.fn(), // openPrivacyNotice
vi.fn(), // openSettingsDialog
vi.fn(), // openSubagentCreateDialog
vi.fn(), // toggleVimEnabled
vi.fn().mockResolvedValue(false), // toggleVimEnabled
vi.fn(), // setIsProcessing
vi.fn(), // setGeminiMdFileCount
),
);

View File

@@ -51,6 +51,7 @@ export const useSlashCommandProcessor = (
setQuittingMessages: (message: HistoryItem[]) => void,
openPrivacyNotice: () => void,
openSettingsDialog: () => void,
openSubagentCreateDialog: () => void,
toggleVimEnabled: () => Promise<boolean>,
setIsProcessing: (isProcessing: boolean) => void,
setGeminiMdFileCount: (count: number) => void,
@@ -379,6 +380,9 @@ export const useSlashCommandProcessor = (
case 'settings':
openSettingsDialog();
return { type: 'handled' };
case 'subagent_create':
openSubagentCreateDialog();
return { type: 'handled' };
case 'help':
return { type: 'handled' };
default: {
@@ -553,6 +557,7 @@ export const useSlashCommandProcessor = (
openEditorDialog,
setQuittingMessages,
openSettingsDialog,
openSubagentCreateDialog,
setShellConfirmationRequest,
setSessionShellAllowlist,
setIsProcessing,

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/
import { useState, useCallback } from 'react';
export function useSubagentCreateDialog() {
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] =
useState(false);
const openSubagentCreateDialog = useCallback(() => {
setIsSubagentCreateDialogOpen(true);
}, []);
const closeSubagentCreateDialog = useCallback(() => {
setIsSubagentCreateDialogOpen(false);
}, []);
return {
isSubagentCreateDialogOpen,
openSubagentCreateDialog,
closeSubagentCreateDialog,
};
}