@@ -73,14 +73,14 @@ function directoryState() {
7373}
7474
7575describe ( "bootstrapDirectory" , ( ) => {
76- test ( "marks a loading directory partial during bootstrap and complete after success " , async ( ) => {
76+ test ( "uses legacy MCP endpoints while refreshing a v1 directory " , async ( ) => {
7777 const mcpReads : string [ ] = [ ]
7878 const [ store , setStore ] = directoryState ( )
7979
8080 await bootstrapDirectory ( {
8181 directory : "/project" ,
8282 scope : ServerScope . local ,
83- mcp : false ,
83+ mcp : true ,
8484 global : {
8585 config : { } satisfies Config ,
8686 path : { state : "" , config : "" , worktree : "/project" , directory : "/project" , home : "/home" } ,
@@ -90,6 +90,7 @@ describe("bootstrapDirectory", () => {
9090 sdk : {
9191 app : { agents : async ( ) => ( { data : [ { name : "build" , mode : "primary" } ] } ) } ,
9292 config : { get : async ( ) => ( { data : { } } ) } ,
93+ session : { status : async ( ) => ( { data : { } } ) } ,
9394 vcs : { get : async ( ) => ( { data : undefined } ) } ,
9495 command : {
9596 list : async ( ) => {
@@ -106,6 +107,14 @@ describe("bootstrapDirectory", () => {
106107 return { data : { } }
107108 } ,
108109 } ,
110+ experimental : {
111+ resource : {
112+ list : async ( ) => {
113+ mcpReads . push ( "resource" )
114+ return { data : { } }
115+ } ,
116+ } ,
117+ } ,
109118 provider : { list : async ( ) => ( { data : { all : [ ] , connected : [ ] , default : { } } } ) } ,
110119 } as unknown as OpencodeClient ,
111120 api,
@@ -115,14 +124,15 @@ describe("bootstrapDirectory", () => {
115124 loadSessions ( ) { } ,
116125 translate : ( key ) => key ,
117126 queryClient : new QueryClient ( ) ,
127+ protocol : Promise . resolve ( "v1" ) ,
118128 } )
119129
120130 expect ( store . status ) . toBe ( "partial" )
121131
122132 await new Promise ( ( resolve ) => setTimeout ( resolve , 80 ) )
123133
124134 expect ( store . status ) . toBe ( "complete" )
125- expect ( mcpReads ) . toEqual ( [ ] )
135+ expect ( mcpReads . sort ( ) ) . toEqual ( [ "command" , "resource" , "status" ] )
126136 } )
127137} )
128138
0 commit comments