@@ -56,6 +56,7 @@ suite('PromptHeaderAutocompletion', () => {
5656 { id : 'mae-4' , name : 'MAE 4' , vendor : 'olama' , version : '1.0' , family : 'mae' , modelPickerCategory : undefined , extension : new ExtensionIdentifier ( 'a.b' ) , isUserSelectable : true , maxInputTokens : 8192 , maxOutputTokens : 1024 , capabilities : { agentMode : true , toolCalling : true } , isDefaultForLocation : { [ ChatAgentLocation . Chat ] : true } } satisfies ILanguageModelChatMetadata ,
5757 { id : 'mae-4.1' , name : 'MAE 4.1' , vendor : 'copilot' , version : '1.0' , family : 'mae' , modelPickerCategory : undefined , extension : new ExtensionIdentifier ( 'a.b' ) , isUserSelectable : true , maxInputTokens : 8192 , maxOutputTokens : 1024 , capabilities : { agentMode : true , toolCalling : true } , isDefaultForLocation : { [ ChatAgentLocation . Chat ] : true } } satisfies ILanguageModelChatMetadata ,
5858 { id : 'gpt-4' , name : 'GPT 4' , vendor : 'openai' , version : '1.0' , family : 'gpt' , modelPickerCategory : undefined , extension : new ExtensionIdentifier ( 'a.b' ) , isUserSelectable : true , maxInputTokens : 8192 , maxOutputTokens : 1024 , capabilities : { agentMode : false , toolCalling : true } , isDefaultForLocation : { [ ChatAgentLocation . Chat ] : true } } satisfies ILanguageModelChatMetadata ,
59+ { id : 'bg-agent-model' , name : 'BG Agent Model' , vendor : 'copilot' , version : '1.0' , family : 'bg' , modelPickerCategory : undefined , extension : new ExtensionIdentifier ( 'a.b' ) , isUserSelectable : true , maxInputTokens : 8192 , maxOutputTokens : 1024 , capabilities : { agentMode : true , toolCalling : true } , isDefaultForLocation : { [ ChatAgentLocation . Chat ] : true } , targetChatSessionType : 'background' } satisfies ILanguageModelChatMetadata ,
5960 ] ;
6061
6162 instaService . stub ( ILanguageModelsService , {
@@ -361,6 +362,33 @@ suite('PromptHeaderAutocompletion', () => {
361362 { label : 'true' , result : 'disable-model-invocation: true' } ,
362363 ] . sort ( sortByLabel ) ) ;
363364 } ) ;
365+
366+ test ( 'exclude models with targetChatSessionType from agent model completions' , async ( ) => {
367+ const content = [
368+ '---' ,
369+ 'description: "Test"' ,
370+ 'model: |' ,
371+ '---' ,
372+ ] . join ( '\n' ) ;
373+
374+ const actual = await getCompletions ( content , PromptsType . agent ) ;
375+ const labels = actual . map ( a => a . label ) ;
376+ // BG Agent Model has targetChatSessionType set, so it should be excluded
377+ assert . ok ( ! labels . includes ( 'BG Agent Model (copilot)' ) , 'Models with targetChatSessionType should be excluded from agent model completions' ) ;
378+ } ) ;
379+
380+ test ( 'exclude models with targetChatSessionType from agent model array completions' , async ( ) => {
381+ const content = [
382+ '---' ,
383+ 'description: "Test"' ,
384+ 'model: [|]' ,
385+ '---' ,
386+ ] . join ( '\n' ) ;
387+
388+ const actual = await getCompletions ( content , PromptsType . agent ) ;
389+ const labels = actual . map ( a => a . label ) ;
390+ assert . ok ( ! labels . includes ( 'BG Agent Model (copilot)' ) , 'Models with targetChatSessionType should be excluded from agent model array completions' ) ;
391+ } ) ;
364392 } ) ;
365393
366394 suite ( 'claude agent header completions' , ( ) => {
@@ -546,5 +574,18 @@ suite('PromptHeaderAutocompletion', () => {
546574 { label : 'GPT 4 (openai)' , result : 'model: GPT 4 (openai)' } ,
547575 ] . sort ( sortByLabel ) ) ;
548576 } ) ;
577+
578+ test ( 'exclude models with targetChatSessionType from prompt model completions' , async ( ) => {
579+ const content = [
580+ '---' ,
581+ 'description: "Test"' ,
582+ 'model: |' ,
583+ '---' ,
584+ ] . join ( '\n' ) ;
585+
586+ const actual = await getCompletions ( content , PromptsType . prompt ) ;
587+ const labels = actual . map ( a => a . label ) ;
588+ assert . ok ( ! labels . includes ( 'BG Agent Model (copilot)' ) , 'Models with targetChatSessionType should be excluded from prompt model completions' ) ;
589+ } ) ;
549590 } ) ;
550591} ) ;
0 commit comments