stream_enrich: document Write absence; skip -0 count in Edit summary
This commit is contained in:
parent
0e4b69dd20
commit
d4215c09c8
1 changed files with 14 additions and 5 deletions
|
|
@ -273,6 +273,12 @@ fn is_rich_tool(name: &str) -> bool {
|
|||
///
|
||||
/// Returns `None` for tools whose body is inherently client-side (markdown
|
||||
/// rendering, DOM forms) or that have no body at all.
|
||||
///
|
||||
/// **`Write` is intentionally absent**: its `content` field can be megabytes
|
||||
/// and is one-sided (no `old_string` to diff against), making it too large to
|
||||
/// inline in every SSE event. The flat `"Write /path"` summary row is
|
||||
/// sufficient — the operator can open the file directly if they need to inspect
|
||||
/// the written content.
|
||||
fn rich_tool_body(name: &str, input: &Value) -> Option<(String, &'static str)> {
|
||||
match name {
|
||||
// Edit diff: old lines prefixed `- `, new lines prefixed `+ `.
|
||||
|
|
@ -396,19 +402,22 @@ fn fmt_builtin_tool(name: &str, short: &str, input: &Value) -> String {
|
|||
"Read" | "Write" => format!("{short} {}", sv(input, "file_path")),
|
||||
"Edit" => {
|
||||
let path = sv(input, "file_path");
|
||||
let old_n = input
|
||||
let old = input
|
||||
.get("old_string")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("")
|
||||
.lines()
|
||||
.count();
|
||||
.unwrap_or("");
|
||||
let new_n = input
|
||||
.get("new_string")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("")
|
||||
.lines()
|
||||
.count();
|
||||
format!("{short} {path} · -{old_n} +{new_n}")
|
||||
if old.is_empty() {
|
||||
format!("{short} {path} · +{new_n}")
|
||||
} else {
|
||||
let old_n = old.lines().count();
|
||||
format!("{short} {path} · -{old_n} +{new_n}")
|
||||
}
|
||||
}
|
||||
"Glob" | "Grep" => format!("{short} {}", sv(input, "pattern")),
|
||||
"Bash" => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue