@@ -17,13 +17,14 @@ import {
1717 searchToolConfig ,
1818 updateToolConfig ,
1919} from "@/services/agentConfigService" ;
20- import { useAgentImport } from "@/hooks/useAgentImport" ;
20+ import { useAgentImport , ImportAgentData } from "@/hooks/useAgentImport" ;
2121import {
2222 Agent ,
2323 AgentSetupOrchestratorProps ,
2424 Tool ,
2525 ToolParam ,
2626} from "@/types/agentConfig" ;
27+ import AgentImportWizard from "@/components/agent/AgentImportWizard" ;
2728import log from "@/lib/logger" ;
2829
2930import SubAgentPool from "./agent/SubAgentPool" ;
@@ -104,6 +105,10 @@ export default function AgentSetupOrchestrator({
104105 const [ importingAction , setImportingAction ] = useState <
105106 "force" | "regenerate" | null
106107 > ( null ) ;
108+
109+ // Agent import wizard states
110+ const [ importWizardVisible , setImportWizardVisible ] = useState ( false ) ;
111+ const [ importWizardData , setImportWizardData ] = useState < ImportAgentData | null > ( null ) ;
107112 // Use generation state passed from parent component, not local state
108113
109114 // Delete confirmation popup status
@@ -1589,7 +1594,7 @@ export default function AgentSetupOrchestrator({
15891594 [ runNormalImport , runForceImport ]
15901595 ) ;
15911596
1592- // Handle importing agent
1597+ // Handle importing agent - use AgentImportWizard for ExportAndImportDataFormat
15931598 const handleImportAgent = ( t : TFunction ) => {
15941599 // Create a hidden file input element
15951600 const fileInput = document . createElement ( "input" ) ;
@@ -1618,6 +1623,20 @@ export default function AgentSetupOrchestrator({
16181623 return ;
16191624 }
16201625
1626+ // Check if it's ExportAndImportDataFormat (has agent_id and agent_info)
1627+ if ( agentInfo . agent_id && agentInfo . agent_info && typeof agentInfo . agent_info === "object" ) {
1628+ // Use AgentImportWizard for full agent import with configuration
1629+ const importData : ImportAgentData = {
1630+ agent_id : agentInfo . agent_id ,
1631+ agent_info : agentInfo . agent_info ,
1632+ mcp_info : agentInfo . mcp_info || [ ] ,
1633+ } ;
1634+ setImportWizardData ( importData ) ;
1635+ setImportWizardVisible ( true ) ;
1636+ return ;
1637+ }
1638+
1639+ // Fallback to legacy import logic for other formats
16211640 const normalizeValue = ( value ?: string | null ) =>
16221641 typeof value === "string" ? value . trim ( ) : "" ;
16231642
@@ -1700,6 +1719,13 @@ export default function AgentSetupOrchestrator({
17001719 fileInput . click ( ) ;
17011720 } ;
17021721
1722+ // Handle import completion from wizard
1723+ const handleImportComplete = ( ) => {
1724+ refreshAgentList ( t , false ) ;
1725+ setImportWizardVisible ( false ) ;
1726+ setImportWizardData ( null ) ;
1727+ } ;
1728+
17031729 const handleConfirmedDuplicateImport = useCallback ( async ( ) => {
17041730 if ( ! pendingImportData ) {
17051731 return ;
@@ -2256,6 +2282,23 @@ export default function AgentSetupOrchestrator({
22562282 { t ( "businessLogic.config.import.duplicateDescription" ) }
22572283 </ p >
22582284 </ Modal >
2285+ { /* Agent Import Wizard */ }
2286+ < AgentImportWizard
2287+ visible = { importWizardVisible }
2288+ onCancel = { ( ) => {
2289+ setImportWizardVisible ( false ) ;
2290+ setImportWizardData ( null ) ;
2291+ } }
2292+ initialData = { importWizardData }
2293+ onImportComplete = { handleImportComplete }
2294+ title = { undefined } // Use default title
2295+ agentDisplayName = {
2296+ importWizardData ?. agent_info ?. [ String ( importWizardData . agent_id ) ] ?. display_name
2297+ }
2298+ agentDescription = {
2299+ importWizardData ?. agent_info ?. [ String ( importWizardData . agent_id ) ] ?. description
2300+ }
2301+ />
22592302 { /* Auto unselect knowledge_base_search notice when embedding not configured */ }
22602303 < Modal
22612304 title = { t ( "embedding.agentToolAutoDeselectModal.title" ) }
0 commit comments