@@ -97,9 +97,7 @@ afterEach(() =>
9797 . forEach ( ( dispose ) => dispose ( ) ) ,
9898)
9999
100- function fixture (
101- input : { session ?: Commit ; agents ?: Agent [ ] ; config ?: ConfigModel ; defaultAgent ?: string ; preferred ?: string } = { } ,
102- ) {
100+ function fixture ( input : { session ?: Commit ; agents ?: Agent [ ] ; config ?: ConfigModel ; preferred ?: string } = { } ) {
103101 const directory = `/selection-test/${ crypto . randomUUID ( ) } `
104102
105103 // SAFETY: fixture transitions clear the route as well as selecting session IDs.
@@ -110,7 +108,6 @@ function fixture(
110108 route : { id : "ses_a" as string | undefined } ,
111109 agents : input . agents ?? [ agent ( "build" ) , agent ( "plan" ) ] ,
112110 config : input . config ,
113- defaultAgent : input . defaultAgent ,
114111 sessions : Object . fromEntries ( [ [ "ses_a" , input . session ] ] ) ,
115112 providers : [ { id : "provider" , name : "Provider" , package : "@ai-sdk/test" , activation : "enabled" } ] ,
116113 models : [ "a" , "b" , "c" ] . map ( ( id ) => ( {
@@ -152,10 +149,7 @@ function fixture(
152149 location : {
153150 agent : { list : ( ) => state . agents } ,
154151 config : {
155- list : ( ) =>
156- state . configLoaded
157- ? [ { type : "document" , info : { model : state . config , default_agent : state . defaultAgent } } ]
158- : undefined ,
152+ list : ( ) => ( state . configLoaded ? [ { type : "document" , info : { model : state . config } } ] : undefined ) ,
159153 sync : async ( ) => {
160154 configLoads . push ( state . connection )
161155 } ,
@@ -227,33 +221,25 @@ function selection(local: ReturnType<typeof useLocal>) {
227221}
228222
229223test ( "restores durable agents even when the agent selector is hidden" , ( ) => {
230- const f = fixture ( { session : durable ( "b" , "high" , "plan" ) , defaultAgent : "build" } )
224+ const f = fixture ( { session : durable ( "b" , "high" , "plan" ) } )
231225 f . set ( "visible" , false )
232226 const { local } = f . mount ( )
233227 expect ( local . agent . visible ( ) ) . toBe ( false )
234228 expect ( selection ( local ) ) . toEqual ( { agent : "plan" , model : "b" , variant : "high" } )
235229} )
236230
237- test . each ( [ true , false ] ) ( "new sessions use the configured default with picker visibility %s" , ( visible ) => {
238- const f = fixture ( { agents : [ agent ( "build " ) , agent ( "plan " ) , agent ( "custom " ) ] , defaultAgent : "custom" } )
231+ test . each ( [ true , false ] ) ( "new sessions use the server-selected default with picker visibility %s" , ( visible ) => {
232+ const f = fixture ( { agents : [ agent ( "custom " ) , agent ( "build " ) , agent ( "plan " ) ] } )
239233 f . set ( "route" , "id" , undefined )
240234 f . set ( "visible" , visible )
241235 const { local } = f . mount ( )
242236 expect ( local . agent . current ( ) ?. name ) . toBe ( "custom" )
243237 f . set ( "visible" , ! visible )
244238 expect ( local . agent . current ( ) ?. name ) . toBe ( "custom" )
245239 local . agent . set ( "plan" )
246- f . set ( "defaultAgent" , "build" )
247240 expect ( local . agent . current ( ) ?. name ) . toBe ( "plan" )
248241} )
249242
250- test ( "unavailable configured default agents retain the build fallback" , ( ) => {
251- const f = fixture ( { defaultAgent : "missing" } )
252- f . set ( "route" , "id" , undefined )
253- const { local } = f . mount ( )
254- expect ( local . agent . current ( ) ?. name ) . toBe ( "build" )
255- } )
256-
257243test ( "waits for initial configuration and reloads it after reconnecting" , ( ) => {
258244 const f = fixture ( { config : "provider/b" } )
259245 f . set ( "configLoaded" , false )
0 commit comments