@@ -232,12 +232,9 @@ func (m *model) renderMessageEvent(event agent.Event) string {
232232// renderToolCallEvent renders a tool call event to a string.
233233func (m * model ) renderToolCallEvent (event agent.Event ) string {
234234 var args struct {
235- Path string `json:"path"`
236- Command string `json:"command"`
237- Timeout int `json:"timeout"`
238- OldText string `json:"oldText"`
239- NewText string `json:"newText"`
240- ReplaceAll bool `json:"replaceAll"`
235+ Path string `json:"path"`
236+ Command string `json:"command"`
237+ Timeout int `json:"timeout"`
241238 }
242239 _ = json .Unmarshal ([]byte (event .ToolInput ), & args )
243240
@@ -250,31 +247,7 @@ func (m *model) renderToolCallEvent(event agent.Event) string {
250247 return toolMessageStyle .Render (m .mustRenderToolCallMarkdown (message ))
251248 }
252249
253- if event .Tool == "edit" {
254- message := fmt .Sprintf ("edit %s\n ```diff\n %s\n ```" , args .Path , renderEditDiff (args .OldText , args .NewText ))
255- if args .ReplaceAll {
256- message = fmt .Sprintf ("edit %s (all occurrences)\n ```diff\n %s\n ```" , args .Path , renderEditDiff (args .OldText , args .NewText ))
257- }
258- return toolMessageStyle .Render (m .mustRenderToolCallMarkdown (message ))
259- }
260-
261- input := args .Path
262- if input == "" {
263- input = string (event .ToolInput )
264- }
265- return toolMessageStyle .Render (m .mustRenderToolCallMarkdown (fmt .Sprintf ("%s %s" , event .Tool , input )))
266- }
267-
268- // renderEditDiff renders the text replacement as a compact diff.
269- func renderEditDiff (oldText , newText string ) string {
270- var b strings.Builder
271- for _ , line := range strings .Split (oldText , "\n " ) {
272- fmt .Fprintf (& b , "-%s\n " , line )
273- }
274- for _ , line := range strings .Split (newText , "\n " ) {
275- fmt .Fprintf (& b , "+%s\n " , line )
276- }
277- return strings .TrimSuffix (b .String (), "\n " )
250+ return toolMessageStyle .Render (m .mustRenderToolCallMarkdown (args .Path ))
278251}
279252
280253// mustRenderMarkdown renders a string as markdown using the default style. It panics
0 commit comments