@@ -16,6 +16,7 @@ import {
1616 type Managed设置 ,
1717 type ModelInfo ,
1818} from "../src/index.js" ;
19+ import type { Model } from "../src/generated/rpc.js" ;
1920import { CopilotSession } from "../src/session.js" ;
2021import { defaultJoinSessionPermissionHandler } from "../src/types.js" ;
2122
@@ -2984,7 +2985,32 @@ describe("CopilotClient", () => {
29842985 } ) ;
29852986 } ) ;
29862987
2987- describe ( "onListModels" , ( ) => {
2988+ describe ( "model listing" , ( ) => {
2989+ it ( "preserves synthetic model identifiers and picker metadata through models.list" , async ( ) => {
2990+ const models : Model [ ] = [
2991+ {
2992+ id : "hydrafusion" ,
2993+ name : "HydraFusion" ,
2994+ capabilities : { } ,
2995+ modelPickerCategory : "powerful" ,
2996+ } ,
2997+ {
2998+ id : "hydrafusion-max" ,
2999+ name : "HydraFusion Max" ,
3000+ capabilities : { } ,
3001+ modelPickerCategory : "powerful" ,
3002+ } ,
3003+ ] ;
3004+ const sendRequest = vi . fn ( ) . mockResolvedValue ( { models } ) ;
3005+ const client = new CopilotClient ( ) ;
3006+ ( client as any ) . connection = { sendRequest } ;
3007+
3008+ const result = await client . rpc . models . list ( { } ) ;
3009+
3010+ expect ( sendRequest ) . toHaveBeenCalledWith ( "models.list" , { } ) ;
3011+ expect ( result . models ) . toEqual ( models ) ;
3012+ } ) ;
3013+
29883014 it ( "calls onListModels handler instead of RPC when provided" , async ( ) => {
29893015 const customModels : ModelInfo [ ] = [
29903016 {
0 commit comments