@@ -472,18 +472,29 @@ fn emit_hosted_tool_start<F>(
472472 }
473473}
474474
475+ struct HostedToolResultEvent < ' a > {
476+ id : & ' a str ,
477+ name : & ' a str ,
478+ input : & ' a serde_json:: Value ,
479+ output : Option < serde_json:: Value > ,
480+ status : Option < String > ,
481+ }
482+
475483fn emit_hosted_tool_result < F > (
476484 emit : & F ,
477485 emitted_tool_results : & mut HashSet < String > ,
478486 session_cwd : & std:: path:: Path ,
479- id : & str ,
480- name : & str ,
481- input : & serde_json:: Value ,
482- output : Option < serde_json:: Value > ,
483- status : Option < String > ,
487+ event : HostedToolResultEvent < ' _ > ,
484488) where
485489 F : Fn ( QueryEvent ) ,
486490{
491+ let HostedToolResultEvent {
492+ id,
493+ name,
494+ input,
495+ output,
496+ status,
497+ } = event;
487498 if !emitted_tool_results. insert ( id. to_string ( ) ) {
488499 return ;
489500 }
@@ -901,11 +912,13 @@ pub async fn query(
901912 & emit,
902913 & mut emitted_hosted_tool_results,
903914 & session. cwd ,
904- & id,
905- & name,
906- & input,
907- output,
908- status,
915+ HostedToolResultEvent {
916+ id : & id,
917+ name : & name,
918+ input : & input,
919+ output,
920+ status,
921+ } ,
909922 ) ;
910923 }
911924 Ok ( StreamEvent :: ToolCallInputDelta {
@@ -1059,11 +1072,13 @@ pub async fn query(
10591072 & emit,
10601073 & mut emitted_hosted_tool_results,
10611074 & session. cwd ,
1062- & id,
1063- & name,
1064- & input,
1065- output. clone ( ) ,
1066- status. clone ( ) ,
1075+ HostedToolResultEvent {
1076+ id : & id,
1077+ name : & name,
1078+ input : & input,
1079+ output : output. clone ( ) ,
1080+ status : status. clone ( ) ,
1081+ } ,
10671082 ) ;
10681083 }
10691084 }
@@ -1095,11 +1110,13 @@ pub async fn query(
10951110 & emit,
10961111 & mut emitted_hosted_tool_results,
10971112 & session. cwd ,
1098- & id,
1099- & name,
1100- & input,
1101- None ,
1102- Some ( "completed" . to_string ( ) ) ,
1113+ HostedToolResultEvent {
1114+ id : & id,
1115+ name : & name,
1116+ input : & input,
1117+ output : None ,
1118+ status : Some ( "completed" . to_string ( ) ) ,
1119+ } ,
11031120 ) ;
11041121 }
11051122
0 commit comments