@@ -14,6 +14,7 @@ import { logger } from '../utils/logger'
1414import type { SuggestionItem } from '../components/suggestion-menu'
1515import type { SlashCommand } from '../data/slash-commands'
1616import type { Prettify } from '../types/utils'
17+ import type { AgentMode } from '../utils/constants'
1718import type { LocalAgentInfo } from '../utils/local-agent-registry'
1819import type { FileTreeNode } from '@codebuff/common/util/file'
1920
@@ -542,6 +543,7 @@ interface SuggestionEngineOptions {
542543 localAgents : LocalAgentInfo [ ]
543544 fileTree : FileTreeNode [ ]
544545 disableAgentSuggestions ?: boolean
546+ currentAgentMode ?: AgentMode
545547}
546548
547549export const useSuggestionEngine = ( {
@@ -551,6 +553,7 @@ export const useSuggestionEngine = ({
551553 localAgents,
552554 fileTree,
553555 disableAgentSuggestions = false ,
556+ currentAgentMode,
554557} : SuggestionEngineOptions ) : SuggestionEngineResult => {
555558 const deferredInput = useDeferredValue ( inputValue )
556559 const slashCacheRef = useRef < Map < string , MatchedSlashCommand [ ] > > (
@@ -675,14 +678,23 @@ export const useSuggestionEngine = ({
675678 } , [ mentionContext , filePaths ] )
676679
677680 const slashSuggestionItems = useMemo < SuggestionItem [ ] > ( ( ) => {
678- return slashMatches . map ( ( command ) => ( {
679- id : command . id ,
680- label : command . label ,
681- labelHighlightIndices : command . labelHighlightIndices ,
682- description : command . description ,
683- descriptionHighlightIndices : command . descriptionHighlightIndices ,
684- } ) )
685- } , [ slashMatches ] )
681+ return slashMatches . map ( ( command ) => {
682+ // Check if this is a mode command and if it's the current mode
683+ const modeMatch = command . id . match ( / ^ m o d e : ( d e f a u l t | m a x | p l a n ) $ / i)
684+ const isCurrentMode =
685+ modeMatch && currentAgentMode ?. toLowerCase ( ) === modeMatch [ 1 ]
686+
687+ return {
688+ id : command . id ,
689+ label : command . label ,
690+ labelHighlightIndices : command . labelHighlightIndices ,
691+ description : isCurrentMode
692+ ? `${ command . description } (current)`
693+ : command . description ,
694+ descriptionHighlightIndices : command . descriptionHighlightIndices ,
695+ }
696+ } )
697+ } , [ slashMatches , currentAgentMode ] )
686698
687699 const agentSuggestionItems = useMemo < SuggestionItem [ ] > ( ( ) => {
688700 return agentMatches . map ( ( agent ) => ( {
0 commit comments