@@ -132,6 +132,9 @@ import { ConfigureToolSets, UserToolSetsContributions } from './tools/toolSetsCo
132132import { ChatViewsWelcomeHandler } from './viewsWelcome/chatViewsWelcomeHandler.js' ;
133133import { ChatWidgetService } from './chatWidgetService.js' ;
134134
135+ const toolReferenceNameEnumValues : string [ ] = [ ] ;
136+ const toolReferenceNameEnumDescriptions : string [ ] = [ ] ;
137+
135138// Register configuration
136139const configurationRegistry = Registry . as < IConfigurationRegistry > ( ConfigurationExtensions . Configuration ) ;
137140configurationRegistry . registerConfiguration ( {
@@ -298,6 +301,10 @@ configurationRegistry.registerConfiguration({
298301 default : { } ,
299302 markdownDescription : nls . localize ( 'chat.tools.eligibleForAutoApproval' , 'Controls which tools are eligible for automatic approval. Tools set to \'false\' will always present a confirmation and will never offer the option to auto-approve. The default behavior (or setting a tool to \'true\') may result in the tool offering auto-approval options.' ) ,
300303 type : 'object' ,
304+ propertyNames : {
305+ enum : toolReferenceNameEnumValues ,
306+ enumDescriptions : toolReferenceNameEnumDescriptions ,
307+ } ,
301308 additionalProperties : {
302309 type : 'boolean' ,
303310 } ,
@@ -921,6 +928,43 @@ class ChatAgentSettingContribution extends Disposable implements IWorkbenchContr
921928 }
922929}
923930
931+ class ToolReferenceNamesContribution extends Disposable implements IWorkbenchContribution {
932+
933+ static readonly ID = 'workbench.contrib.toolReferenceNames' ;
934+
935+ constructor (
936+ @ILanguageModelToolsService private readonly _languageModelToolsService : ILanguageModelToolsService ,
937+ ) {
938+ super ( ) ;
939+ this . _updateToolReferenceNames ( ) ;
940+ this . _register ( this . _languageModelToolsService . onDidChangeTools ( ( ) => this . _updateToolReferenceNames ( ) ) ) ;
941+ }
942+
943+ private _updateToolReferenceNames ( ) : void {
944+ const tools =
945+ Array . from ( this . _languageModelToolsService . getTools ( ) )
946+ . filter ( ( tool ) : tool is typeof tool & { toolReferenceName : string } => typeof tool . toolReferenceName === 'string' )
947+ . sort ( ( a , b ) => a . toolReferenceName . localeCompare ( b . toolReferenceName ) ) ;
948+ toolReferenceNameEnumValues . length = 0 ;
949+ toolReferenceNameEnumDescriptions . length = 0 ;
950+ for ( const tool of tools ) {
951+ toolReferenceNameEnumValues . push ( tool . toolReferenceName ) ;
952+ toolReferenceNameEnumDescriptions . push ( nls . localize (
953+ 'chat.toolReferenceName.description' ,
954+ "{0} - {1}" ,
955+ tool . toolReferenceName ,
956+ tool . userDescription || tool . displayName
957+ ) ) ;
958+ }
959+ configurationRegistry . notifyConfigurationSchemaUpdated ( {
960+ id : 'chatSidebar' ,
961+ properties : {
962+ [ ChatConfiguration . EligibleForAutoApproval ] : { }
963+ }
964+ } ) ;
965+ }
966+ }
967+
924968AccessibleViewRegistry . register ( new ChatTerminalOutputAccessibleView ( ) ) ;
925969AccessibleViewRegistry . register ( new ChatResponseAccessibleView ( ) ) ;
926970AccessibleViewRegistry . register ( new PanelChatAccessibilityHelp ( ) ) ;
@@ -1025,6 +1069,7 @@ registerWorkbenchContribution2(ChatTeardownContribution.ID, ChatTeardownContribu
10251069registerWorkbenchContribution2 ( ChatStatusBarEntry . ID , ChatStatusBarEntry , WorkbenchPhase . BlockRestore ) ;
10261070registerWorkbenchContribution2 ( BuiltinToolsContribution . ID , BuiltinToolsContribution , WorkbenchPhase . Eventually ) ;
10271071registerWorkbenchContribution2 ( ChatAgentSettingContribution . ID , ChatAgentSettingContribution , WorkbenchPhase . AfterRestored ) ;
1072+ registerWorkbenchContribution2 ( ToolReferenceNamesContribution . ID , ToolReferenceNamesContribution , WorkbenchPhase . AfterRestored ) ;
10281073registerWorkbenchContribution2 ( ChatEditingEditorAccessibility . ID , ChatEditingEditorAccessibility , WorkbenchPhase . AfterRestored ) ;
10291074registerWorkbenchContribution2 ( ChatEditingEditorOverlay . ID , ChatEditingEditorOverlay , WorkbenchPhase . AfterRestored ) ;
10301075registerWorkbenchContribution2 ( SimpleBrowserOverlay . ID , SimpleBrowserOverlay , WorkbenchPhase . AfterRestored ) ;
0 commit comments