@@ -2080,7 +2080,7 @@ where
20802080 play_notification_bell ( !allowed) ;
20812081 }
20822082
2083- self . print_tool_description ( tool, allowed) . await ?;
2083+ self . print_tool_descriptions ( tool, allowed) . await ?;
20842084
20852085 if allowed {
20862086 tool. accepted = true ;
@@ -2101,22 +2101,13 @@ where
21012101 }
21022102
21032103 // Execute the requested tools.
2104- let terminal_width = self . terminal_width ( ) ;
21052104 let mut tool_results = vec ! [ ] ;
21062105
21072106 for tool in tool_uses {
21082107 let mut tool_telemetry = self . tool_use_telemetry_events . entry ( tool. id . clone ( ) ) ;
21092108 tool_telemetry = tool_telemetry. and_modify ( |ev| ev. is_accepted = true ) ;
21102109
21112110 let tool_start = std:: time:: Instant :: now ( ) ;
2112- queue ! (
2113- self . output,
2114- style:: SetForegroundColor ( Color :: Cyan ) ,
2115- style:: Print ( format!( "\n {}...\n " , tool. tool. display_name_action( ) ) ) ,
2116- style:: SetForegroundColor ( Color :: DarkGrey ) ,
2117- style:: Print ( format!( "{}\n " , "▔" . repeat( terminal_width) ) ) ,
2118- style:: SetForegroundColor ( Color :: Reset ) ,
2119- ) ?;
21202111 let invoke_result = tool. tool . invoke ( & self . ctx , & mut self . output ) . await ;
21212112
21222113 if self . interactive && self . spinner . is_some ( ) {
@@ -2131,14 +2122,18 @@ where
21312122
21322123 let tool_time = std:: time:: Instant :: now ( ) . duration_since ( tool_start) ;
21332124 let tool_time = format ! ( "{}.{}" , tool_time. as_secs( ) , tool_time. subsec_millis( ) ) ;
2125+ const CONTINUATION_LINE : & str = " ⋮ " ;
21342126
21352127 match invoke_result {
21362128 Ok ( result) => {
21372129 debug ! ( "tool result output: {:#?}" , result) ;
21382130 execute ! (
21392131 self . output,
2132+ style:: Print ( CONTINUATION_LINE ) ,
2133+ style:: Print ( "\n " ) ,
21402134 style:: SetForegroundColor ( Color :: Green ) ,
2141- style:: Print ( format!( "🟢 Completed in {}s" , tool_time) ) ,
2135+ style:: SetAttribute ( Attribute :: Bold ) ,
2136+ style:: Print ( format!( " ● Completed in {}s" , tool_time) ) ,
21422137 style:: SetForegroundColor ( Color :: Reset ) ,
21432138 style:: Print ( "\n " ) ,
21442139 ) ?;
@@ -2154,9 +2149,11 @@ where
21542149 error ! ( ?err, "An error occurred processing the tool" ) ;
21552150 execute ! (
21562151 self . output,
2152+ style:: Print ( CONTINUATION_LINE ) ,
2153+ style:: Print ( "\n " ) ,
21572154 style:: SetAttribute ( Attribute :: Bold ) ,
21582155 style:: SetForegroundColor ( Color :: Red ) ,
2159- style:: Print ( format!( "🔴 Execution failed after {}s:\n " , tool_time) ) ,
2156+ style:: Print ( format!( " ● Execution failed after {}s:\n " , tool_time) ) ,
21602157 style:: SetAttribute ( Attribute :: Reset ) ,
21612158 style:: SetForegroundColor ( Color :: Red ) ,
21622159 style:: Print ( & err) ,
@@ -2644,25 +2641,32 @@ where
26442641 } ;
26452642 }
26462643
2647- async fn print_tool_description ( & mut self , tool_use : & QueuedTool , trusted : bool ) -> Result < ( ) , ChatError > {
2648- let terminal_width = self . terminal_width ( ) ;
2644+ async fn print_tool_descriptions ( & mut self , tool_use : & QueuedTool , trusted : bool ) -> Result < ( ) , ChatError > {
2645+ const TOOL_BULLET : & str = " ● " ;
2646+ const CONTINUATION_LINE : & str = " ⋮ " ;
2647+
26492648 queue ! (
26502649 self . output,
2651- style:: SetForegroundColor ( Color :: Green ) ,
2652- style:: Print ( format!( "[Tool Request{}] " , if trusted { " - Trusted" } else { "" } ) ) ,
2653- style:: SetForegroundColor ( Color :: Cyan ) ,
2654- style:: Print ( format!( "{}\n " , tool_use. tool. display_name( ) ) ) ,
2655- style:: SetForegroundColor ( Color :: Reset ) ,
2656- style:: SetForegroundColor ( Color :: DarkGrey ) ,
2657- style:: Print ( format!( "{}\n " , "▔" . repeat( terminal_width) ) ) ,
2658- style:: SetForegroundColor ( Color :: Reset ) ,
2650+ style:: SetForegroundColor ( Color :: Magenta ) ,
2651+ style:: Print ( format!(
2652+ "🛠️ Using tool: {} {}\n " ,
2653+ tool_use. tool. display_name( ) ,
2654+ if trusted { "(trusted)" . dark_green( ) } else { "" . reset( ) }
2655+ ) ) ,
2656+ style:: SetForegroundColor ( Color :: Reset )
26592657 ) ?;
2658+ queue ! ( self . output, style:: Print ( CONTINUATION_LINE ) ) ?;
2659+ queue ! ( self . output, style:: Print ( "\n " ) ) ?;
2660+ queue ! ( self . output, style:: Print ( TOOL_BULLET ) ) ?;
2661+
2662+ self . output . flush ( ) ?;
2663+
26602664 tool_use
26612665 . tool
26622666 . queue_description ( & self . ctx , & mut self . output )
26632667 . await
26642668 . map_err ( |e| ChatError :: Custom ( format ! ( "failed to print tool: {}" , e) . into ( ) ) ) ?;
2665- queue ! ( self . output , style :: Print ( " \n " ) ) ? ;
2669+
26662670 Ok ( ( ) )
26672671 }
26682672
0 commit comments