@@ -908,6 +908,8 @@ describe("OpenCodeAdapterV2", () => {
908908 "my.server_with_underscores" : { status : "connected" } ,
909909 ambiguous : { status : "connected" } ,
910910 ambiguous_server : { status : "connected" } ,
911+ code : { status : "connected" } ,
912+ apply : { status : "connected" } ,
911913 } ,
912914 } ;
913915 } ,
@@ -972,17 +974,50 @@ describe("OpenCodeAdapterV2", () => {
972974 } ,
973975 } ) ,
974976 ) ;
977+ for ( const tool of [ "code_search" , "apply_patch" ] ) {
978+ yield * Effect . promise ( ( ) =>
979+ nativeEvents . push ( {
980+ type : "message.part.updated" ,
981+ properties : {
982+ sessionID : nativeSessionId ,
983+ part : {
984+ id : `native-${ tool } ` ,
985+ sessionID : nativeSessionId ,
986+ messageID : "mcp-assistant" ,
987+ type : "tool" ,
988+ callID : `native-${ tool } ` ,
989+ tool,
990+ state : {
991+ status : "completed" ,
992+ input : { query : "needle" , filePath : "local.ts" } ,
993+ title : `Native ${ tool } ` ,
994+ metadata : { } ,
995+ output : "done" ,
996+ time : { start : 1 , end : 2 } ,
997+ } ,
998+ } ,
999+ } ,
1000+ } ) ,
1001+ ) ;
1002+ }
9751003 yield * Effect . promise ( ( ) =>
9761004 nativeEvents . push ( {
9771005 type : "session.compacted" ,
9781006 properties : { sessionID : nativeSessionId } ,
9791007 } ) ,
9801008 ) ;
981- const items = ( yield * Fiber . join ( received ) ) . flatMap ( ( event ) =>
982- event . type === "turn_item.updated" && event . turnItem . type === "dynamic_tool"
983- ? [ event . turnItem ]
984- : [ ] ,
1009+ const allItems = ( yield * Fiber . join ( received ) ) . flatMap ( ( event ) =>
1010+ event . type === "turn_item.updated" ? [ event . turnItem ] : [ ] ,
1011+ ) ;
1012+ assert . equal (
1013+ allItems . find ( ( item ) => item . title === "Native code_search" ) ?. type ,
1014+ "web_search" ,
1015+ ) ;
1016+ assert . equal (
1017+ allItems . find ( ( item ) => item . title === "Native apply_patch" ) ?. type ,
1018+ "file_change" ,
9851019 ) ;
1020+ const items = allItems . filter ( ( item ) => item . type === "dynamic_tool" ) ;
9861021 assert . deepEqual (
9871022 items . slice ( 0 , 3 ) . map ( ( item ) => item . status ) ,
9881023 [ "running" , "completed" , "failed" ] ,
0 commit comments