@@ -17,7 +17,7 @@ import { SkillsEditor } from './SkillsEditor'
1717import { VersionSelectDialog } from './VersionSelectDialog'
1818import { MemoryPluginConfig } from './MemoryPluginConfig'
1919import { settingsApi } from '@/api/settings'
20- import { useMutation , useQueryClient } from '@tanstack/react-query'
20+ import { useQuery , useMutation , useQueryClient } from '@tanstack/react-query'
2121import { useServerHealth } from '@/hooks/useServerHealth'
2222import { parseJsonc , hasJsoncComments } from '@/lib/jsonc'
2323import { showToast } from '@/lib/toast'
@@ -77,6 +77,12 @@ export function OpenCodeConfigManager() {
7777 const skillsRef = useRef < HTMLButtonElement > ( null )
7878 const mcpRef = useRef < HTMLButtonElement > ( null )
7979
80+ const { data : managedSkills = [ ] } = useQuery ( {
81+ queryKey : [ 'managed-skills' ] ,
82+ queryFn : ( ) => settingsApi . listManagedSkills ( ) ,
83+ staleTime : 5 * 60 * 1000 ,
84+ } )
85+
8086 const scrollToSection = ( ref : React . RefObject < HTMLButtonElement | null > ) => {
8187 if ( ref . current ) {
8288 ref . current . scrollIntoView ( {
@@ -563,7 +569,7 @@ export function OpenCodeConfigManager() {
563569 < div className = "bg-card border border-border rounded-lg overflow-hidden min-w-0 mb-6" >
564570 < button
565571 ref = { agentsMdRef }
566- className = "w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
572+ className = { cn ( "w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0" , expandedSections . agentsMd ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50" ) }
567573 onClick = { ( ) => {
568574 const isExpanding = ! expandedSections . agentsMd
569575 setExpandedSections ( prev => ( { ...prev , agentsMd : isExpanding } ) )
@@ -620,7 +626,7 @@ export function OpenCodeConfigManager() {
620626 < div className = "bg-card border border-border rounded-lg overflow-hidden min-w-0" >
621627 < button
622628 ref = { commandsRef }
623- className = "w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
629+ className = { cn ( "w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0" , expandedSections . commands ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50" ) }
624630 onClick = { ( ) => {
625631 const isExpanding = ! expandedSections . commands
626632 setExpandedSections ( prev => ( { ...prev , commands : isExpanding } ) )
@@ -657,7 +663,7 @@ export function OpenCodeConfigManager() {
657663 < div className = "bg-card border border-border rounded-lg overflow-hidden min-w-0" >
658664 < button
659665 ref = { agentsRef }
660- className = "w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
666+ className = { cn ( "w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0" , expandedSections . agents ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50" ) }
661667 onClick = { ( ) => {
662668 const isExpanding = ! expandedSections . agents
663669 setExpandedSections ( prev => ( { ...prev , agents : isExpanding } ) )
@@ -694,7 +700,7 @@ export function OpenCodeConfigManager() {
694700 < div className = "bg-card border border-border rounded-lg overflow-hidden min-w-0" >
695701 < button
696702 ref = { skillsRef }
697- className = "w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
703+ className = { cn ( "w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0" , expandedSections . skills ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50" ) }
698704 onClick = { ( ) => {
699705 const isExpanding = ! expandedSections . skills
700706 setExpandedSections ( prev => ( { ...prev , skills : isExpanding } ) )
@@ -706,33 +712,34 @@ export function OpenCodeConfigManager() {
706712 < div className = "flex items-center gap-3 min-w-0" >
707713 < h4 className = "text-sm font-medium truncate" > Skills</ h4 >
708714 < span className = "text-xs text-muted-foreground" >
709- { ( selectedConfig . content ?. skills ?. paths ?. length ?? 0 ) + ( selectedConfig . content ?. skills ?. urls ?. length ?? 0 ) } configured
715+ { managedSkills . length + ( selectedConfig . content ?. skills ?. paths ?. length ?? 0 ) + ( selectedConfig . content ?. skills ?. urls ?. length ?? 0 ) } configured
710716 </ span >
711717 </ div >
712718 < ChevronDown className = { `h-4 w-4 transition-transform ${ expandedSections . skills ? 'rotate-90' : '' } ` } />
713719 </ button >
714- < div className = { `${ expandedSections . skills ? 'block' : 'hidden' } border-t border-border` } >
715- < div className = "p-4 max-h-[50vh] overflow-y-auto" >
716- < SkillsEditor
717- skills = { selectedConfig . content ?. skills }
718- onChange = { ( skills ) => {
719- const paths = skills ?. paths ?. filter ( Boolean )
720- const urls = skills ?. urls ?. filter ( Boolean )
721- const updatedContent = {
722- ...selectedConfig . content ,
723- skills : ( paths ?. length || urls ?. length ) ? { paths : paths ?. length ? paths : undefined , urls : urls ?. length ? urls : undefined } : undefined
724- }
725- updateConfigContent ( selectedConfig . name , updatedContent )
726- } }
727- />
720+ < div className = { `${ expandedSections . skills ? 'block' : 'hidden' } border-t border-border` } >
721+ < div className = "p-4 max-h-[50vh] overflow-y-auto" >
722+ < SkillsEditor
723+ skills = { selectedConfig . content ?. skills }
724+ managedSkills = { managedSkills }
725+ onChange = { ( skills ) => {
726+ const paths = skills ?. paths ?. filter ( Boolean )
727+ const urls = skills ?. urls ?. filter ( Boolean )
728+ const updatedContent = {
729+ ...selectedConfig . content ,
730+ skills : ( paths ?. length || urls ?. length ) ? { paths : paths ?. length ? paths : undefined , urls : urls ?. length ? urls : undefined } : undefined
731+ }
732+ updateConfigContent ( selectedConfig . name , updatedContent )
733+ } }
734+ />
735+ </ div >
728736 </ div >
729- </ div >
730737 </ div >
731738
732739 < div className = "bg-card border border-border rounded-lg overflow-hidden min-w-0" >
733740 < button
734741 ref = { mcpRef }
735- className = "w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
742+ className = { cn ( "w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0" , expandedSections . mcp ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50" ) }
736743 onClick = { ( ) => {
737744 const isExpanding = ! expandedSections . mcp
738745 setExpandedSections ( prev => ( { ...prev , mcp : isExpanding } ) )
0 commit comments