Skip to content

Commit e52bf9f

Browse files
committed
refactor(agent): add visual separation in logs output
- change result arrow from ↳ to → - add blank line after tool results for clearer separation - makes it easier to see where one tool operation ends and text begins
1 parent 95f2fb6 commit e52bf9f

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/commands/agent_run.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -773,12 +773,14 @@ fn print_event(event: &serde_json::Value, tool_map: &mut HashMap<String, ToolInf
773773
.unwrap_or("?");
774774

775775
if is_error {
776-
println!(" {}: error ({} bytes)", tool_name, content_len);
776+
println!(" {}: error ({} bytes)", tool_name, content_len);
777777
} else {
778-
println!(" {}: ok ({} bytes)", tool_name, content_len);
778+
println!(" {}: ok ({} bytes)", tool_name, content_len);
779779
}
780780
}
781781
}
782+
// blank line after tool results for visual separation
783+
println!();
782784
}
783785
}
784786
"system" => {
@@ -966,17 +968,19 @@ mod tests {
966968

967969
if is_error {
968970
output.push_str(&format!(
969-
" {}: error ({} bytes)\n",
971+
" {}: error ({} bytes)\n",
970972
tool_name, content_len
971973
));
972974
} else {
973975
output.push_str(&format!(
974-
" {}: ok ({} bytes)\n",
976+
" {}: ok ({} bytes)\n",
975977
tool_name, content_len
976978
));
977979
}
978980
}
979981
}
982+
// blank line after tool results
983+
output.push('\n');
980984
}
981985
output
982986
}
@@ -1106,7 +1110,7 @@ mod tests {
11061110
]
11071111
}
11081112
});
1109-
assert_eq!(format_event(&event), " ?: ok (19 bytes)\n");
1113+
assert_eq!(format_event(&event), " ?: ok (19 bytes)\n\n");
11101114
}
11111115

11121116
#[test]
@@ -1137,7 +1141,7 @@ mod tests {
11371141
});
11381142
assert_eq!(
11391143
format_event_with_map(&tool_result, &mut tool_map),
1140-
" Bash: ok (19 bytes)\n"
1144+
" Bash: ok (19 bytes)\n\n"
11411145
);
11421146
}
11431147

@@ -1157,7 +1161,7 @@ mod tests {
11571161
]
11581162
}
11591163
});
1160-
assert_eq!(format_event(&event), " ?: error (13 bytes)\n");
1164+
assert_eq!(format_event(&event), " ?: error (13 bytes)\n\n");
11611165
}
11621166

11631167
#[test]

0 commit comments

Comments
 (0)