@@ -568,6 +568,27 @@ export function renderApp(state: AppViewState) {
568568 includeVirtualSections : false ,
569569 ...overrides ,
570570 } ) ;
571+ const buildScopedConfigTabOverrides = ( params : {
572+ formMode : ConfigProps [ "formMode" ] ;
573+ searchQuery : string ;
574+ selection : ConfigSectionSelection ;
575+ setFormMode : ( mode : ConfigProps [ "formMode" ] ) => void ;
576+ setSearchQuery : ( query : string ) => void ;
577+ setActiveSection : ( section : string | null ) => void ;
578+ setActiveSubsection : ( section : string | null ) => void ;
579+ } ) : ConfigTabOverrides => ( {
580+ formMode : params . formMode ,
581+ searchQuery : params . searchQuery ,
582+ activeSection : params . selection . activeSection ,
583+ activeSubsection : params . selection . activeSubsection ,
584+ onFormModeChange : params . setFormMode ,
585+ onSearchChange : params . setSearchQuery ,
586+ onSectionChange : ( section ) => {
587+ params . setActiveSection ( section ) ;
588+ params . setActiveSubsection ( null ) ;
589+ } ,
590+ onSubsectionChange : params . setActiveSubsection ,
591+ } ) ;
571592 const configSelection = normalizeMainConfigSelection (
572593 state . configActiveSection ,
573594 state . configActiveSubsection ,
@@ -601,17 +622,15 @@ export function renderApp(state: AppViewState) {
601622 switch ( state . tab ) {
602623 case "config" :
603624 return renderConfigTab ( {
604- formMode : state . configFormMode ,
605- searchQuery : state . configSearchQuery ,
606- activeSection : configSelection . activeSection ,
607- activeSubsection : configSelection . activeSubsection ,
608- onFormModeChange : ( mode ) => ( state . configFormMode = mode ) ,
609- onSearchChange : ( query ) => ( state . configSearchQuery = query ) ,
610- onSectionChange : ( section ) => {
611- state . configActiveSection = section ;
612- state . configActiveSubsection = null ;
613- } ,
614- onSubsectionChange : ( section ) => ( state . configActiveSubsection = section ) ,
625+ ...buildScopedConfigTabOverrides ( {
626+ formMode : state . configFormMode ,
627+ searchQuery : state . configSearchQuery ,
628+ selection : configSelection ,
629+ setFormMode : ( mode ) => ( state . configFormMode = mode ) ,
630+ setSearchQuery : ( query ) => ( state . configSearchQuery = query ) ,
631+ setActiveSection : ( section ) => ( state . configActiveSection = section ) ,
632+ setActiveSubsection : ( section ) => ( state . configActiveSubsection = section ) ,
633+ } ) ,
615634 showModeToggle : true ,
616635 excludeSections : [
617636 ...COMMUNICATION_SECTION_KEYS ,
@@ -624,82 +643,72 @@ export function renderApp(state: AppViewState) {
624643 } ) ;
625644 case "communications" :
626645 return renderConfigTab ( {
627- formMode : state . communicationsFormMode ,
628- searchQuery : state . communicationsSearchQuery ,
629- activeSection : communicationsSelection . activeSection ,
630- activeSubsection : communicationsSelection . activeSubsection ,
631- onFormModeChange : ( mode ) => ( state . communicationsFormMode = mode ) ,
632- onSearchChange : ( query ) => ( state . communicationsSearchQuery = query ) ,
633- onSectionChange : ( section ) => {
634- state . communicationsActiveSection = section ;
635- state . communicationsActiveSubsection = null ;
636- } ,
637- onSubsectionChange : ( section ) => ( state . communicationsActiveSubsection = section ) ,
646+ ...buildScopedConfigTabOverrides ( {
647+ formMode : state . communicationsFormMode ,
648+ searchQuery : state . communicationsSearchQuery ,
649+ selection : communicationsSelection ,
650+ setFormMode : ( mode ) => ( state . communicationsFormMode = mode ) ,
651+ setSearchQuery : ( query ) => ( state . communicationsSearchQuery = query ) ,
652+ setActiveSection : ( section ) => ( state . communicationsActiveSection = section ) ,
653+ setActiveSubsection : ( section ) => ( state . communicationsActiveSubsection = section ) ,
654+ } ) ,
638655 navRootLabel : "Communication" ,
639656 includeSections : [ ...COMMUNICATION_SECTION_KEYS ] ,
640657 } ) ;
641658 case "appearance" :
642659 return renderConfigTab ( {
643- formMode : state . appearanceFormMode ,
644- searchQuery : state . appearanceSearchQuery ,
645- activeSection : appearanceSelection . activeSection ,
646- activeSubsection : appearanceSelection . activeSubsection ,
647- onFormModeChange : ( mode ) => ( state . appearanceFormMode = mode ) ,
648- onSearchChange : ( query ) => ( state . appearanceSearchQuery = query ) ,
649- onSectionChange : ( section ) => {
650- state . appearanceActiveSection = section ;
651- state . appearanceActiveSubsection = null ;
652- } ,
653- onSubsectionChange : ( section ) => ( state . appearanceActiveSubsection = section ) ,
660+ ...buildScopedConfigTabOverrides ( {
661+ formMode : state . appearanceFormMode ,
662+ searchQuery : state . appearanceSearchQuery ,
663+ selection : appearanceSelection ,
664+ setFormMode : ( mode ) => ( state . appearanceFormMode = mode ) ,
665+ setSearchQuery : ( query ) => ( state . appearanceSearchQuery = query ) ,
666+ setActiveSection : ( section ) => ( state . appearanceActiveSection = section ) ,
667+ setActiveSubsection : ( section ) => ( state . appearanceActiveSubsection = section ) ,
668+ } ) ,
654669 navRootLabel : t ( "tabs.appearance" ) ,
655670 includeSections : [ ...APPEARANCE_SECTION_KEYS ] ,
656671 includeVirtualSections : true ,
657672 } ) ;
658673 case "automation" :
659674 return renderConfigTab ( {
660- formMode : state . automationFormMode ,
661- searchQuery : state . automationSearchQuery ,
662- activeSection : automationSelection . activeSection ,
663- activeSubsection : automationSelection . activeSubsection ,
664- onFormModeChange : ( mode ) => ( state . automationFormMode = mode ) ,
665- onSearchChange : ( query ) => ( state . automationSearchQuery = query ) ,
666- onSectionChange : ( section ) => {
667- state . automationActiveSection = section ;
668- state . automationActiveSubsection = null ;
669- } ,
670- onSubsectionChange : ( section ) => ( state . automationActiveSubsection = section ) ,
675+ ...buildScopedConfigTabOverrides ( {
676+ formMode : state . automationFormMode ,
677+ searchQuery : state . automationSearchQuery ,
678+ selection : automationSelection ,
679+ setFormMode : ( mode ) => ( state . automationFormMode = mode ) ,
680+ setSearchQuery : ( query ) => ( state . automationSearchQuery = query ) ,
681+ setActiveSection : ( section ) => ( state . automationActiveSection = section ) ,
682+ setActiveSubsection : ( section ) => ( state . automationActiveSubsection = section ) ,
683+ } ) ,
671684 navRootLabel : "Automation" ,
672685 includeSections : [ ...AUTOMATION_SECTION_KEYS ] ,
673686 } ) ;
674687 case "infrastructure" :
675688 return renderConfigTab ( {
676- formMode : state . infrastructureFormMode ,
677- searchQuery : state . infrastructureSearchQuery ,
678- activeSection : infrastructureSelection . activeSection ,
679- activeSubsection : infrastructureSelection . activeSubsection ,
680- onFormModeChange : ( mode ) => ( state . infrastructureFormMode = mode ) ,
681- onSearchChange : ( query ) => ( state . infrastructureSearchQuery = query ) ,
682- onSectionChange : ( section ) => {
683- state . infrastructureActiveSection = section ;
684- state . infrastructureActiveSubsection = null ;
685- } ,
686- onSubsectionChange : ( section ) => ( state . infrastructureActiveSubsection = section ) ,
689+ ...buildScopedConfigTabOverrides ( {
690+ formMode : state . infrastructureFormMode ,
691+ searchQuery : state . infrastructureSearchQuery ,
692+ selection : infrastructureSelection ,
693+ setFormMode : ( mode ) => ( state . infrastructureFormMode = mode ) ,
694+ setSearchQuery : ( query ) => ( state . infrastructureSearchQuery = query ) ,
695+ setActiveSection : ( section ) => ( state . infrastructureActiveSection = section ) ,
696+ setActiveSubsection : ( section ) => ( state . infrastructureActiveSubsection = section ) ,
697+ } ) ,
687698 navRootLabel : "Infrastructure" ,
688699 includeSections : [ ...INFRASTRUCTURE_SECTION_KEYS ] ,
689700 } ) ;
690701 case "aiAgents" :
691702 return renderConfigTab ( {
692- formMode : state . aiAgentsFormMode ,
693- searchQuery : state . aiAgentsSearchQuery ,
694- activeSection : aiAgentsSelection . activeSection ,
695- activeSubsection : aiAgentsSelection . activeSubsection ,
696- onFormModeChange : ( mode ) => ( state . aiAgentsFormMode = mode ) ,
697- onSearchChange : ( query ) => ( state . aiAgentsSearchQuery = query ) ,
698- onSectionChange : ( section ) => {
699- state . aiAgentsActiveSection = section ;
700- state . aiAgentsActiveSubsection = null ;
701- } ,
702- onSubsectionChange : ( section ) => ( state . aiAgentsActiveSubsection = section ) ,
703+ ...buildScopedConfigTabOverrides ( {
704+ formMode : state . aiAgentsFormMode ,
705+ searchQuery : state . aiAgentsSearchQuery ,
706+ selection : aiAgentsSelection ,
707+ setFormMode : ( mode ) => ( state . aiAgentsFormMode = mode ) ,
708+ setSearchQuery : ( query ) => ( state . aiAgentsSearchQuery = query ) ,
709+ setActiveSection : ( section ) => ( state . aiAgentsActiveSection = section ) ,
710+ setActiveSubsection : ( section ) => ( state . aiAgentsActiveSubsection = section ) ,
711+ } ) ,
703712 navRootLabel : "AI & Agents" ,
704713 includeSections : [ ...AI_AGENTS_SECTION_KEYS ] ,
705714 } ) ;
@@ -1387,20 +1396,20 @@ export function renderApp(state: AppViewState) {
13871396 } ,
13881397 onSelectPanel : ( panel ) => {
13891398 state . agentsPanel = panel ;
1390- if ( panel === "files" && resolvedAgentId ) {
1391- if ( state . agentFilesList ?. agentId !== resolvedAgentId ) {
1392- state . agentFilesList = null ;
1393- state . agentFilesError = null ;
1394- state . agentFileActive = null ;
1395- state . agentFileContents = { } ;
1396- state . agentFileDrafts = { } ;
1397- void loadAgentFiles ( state , resolvedAgentId ) ;
1398- }
1399+ if (
1400+ panel === "files" &&
1401+ resolvedAgentId &&
1402+ state . agentFilesList ?. agentId !== resolvedAgentId
1403+ ) {
1404+ state . agentFilesList = null ;
1405+ state . agentFilesError = null ;
1406+ state . agentFileActive = null ;
1407+ state . agentFileContents = { } ;
1408+ state . agentFileDrafts = { } ;
1409+ void loadAgentFiles ( state , resolvedAgentId ) ;
13991410 }
1400- if ( panel === "skills" ) {
1401- if ( resolvedAgentId ) {
1402- void loadAgentSkills ( state , resolvedAgentId ) ;
1403- }
1411+ if ( panel === "skills" && resolvedAgentId ) {
1412+ void loadAgentSkills ( state , resolvedAgentId ) ;
14041413 }
14051414 if ( panel === "tools" && resolvedAgentId ) {
14061415 if (
0 commit comments