@@ -14,6 +14,7 @@ import {
1414 type GitHubTelemetryNotification ,
1515 type ModelInfo ,
1616} from "../src/index.js" ;
17+ import type { Model } from "../src/generated/rpc.js" ;
1718import { CopilotSession } from "../src/session.js" ;
1819import { defaultJoinSessionPermissionHandler } from "../src/types.js" ;
1920
@@ -2854,7 +2855,32 @@ describe("CopilotClient", () => {
28542855 } ) ;
28552856 } ) ;
28562857
2857- describe ( "onListModels" , ( ) => {
2858+ describe ( "model listing" , ( ) => {
2859+ it ( "preserves synthetic model identifiers and picker metadata through models.list" , async ( ) => {
2860+ const models : Model [ ] = [
2861+ {
2862+ id : "hydrafusion" ,
2863+ name : "HydraFusion" ,
2864+ capabilities : { } ,
2865+ modelPickerCategory : "powerful" ,
2866+ } ,
2867+ {
2868+ id : "hydrafusion-max" ,
2869+ name : "HydraFusion Max" ,
2870+ capabilities : { } ,
2871+ modelPickerCategory : "powerful" ,
2872+ } ,
2873+ ] ;
2874+ const sendRequest = vi . fn ( ) . mockResolvedValue ( { models } ) ;
2875+ const client = new CopilotClient ( ) ;
2876+ ( client as any ) . connection = { sendRequest } ;
2877+
2878+ const result = await client . rpc . models . list ( { } ) ;
2879+
2880+ expect ( sendRequest ) . toHaveBeenCalledWith ( "models.list" , { } ) ;
2881+ expect ( result . models ) . toEqual ( models ) ;
2882+ } ) ;
2883+
28582884 it ( "calls onListModels handler instead of RPC when provided" , async ( ) => {
28592885 const customModels : ModelInfo [ ] = [
28602886 {
0 commit comments