修复:线程条目投影的上游字符串统一走脱敏与限长

- FunctionCall.name 原来既不脱敏也不截断,改为走 detail_text(脱敏 + THREAD_DETAIL_MAX_CHARS)
- McpToolCall.tool 原来只脱敏不截断,改为 detail_text
- CommandExecution.status、McpToolCall.status、ThreadItem::Other.raw_type、ThreadFileChange.kind 原来原样拷贝,统一按 THREAD_DETAIL_MAX_CHARS 限长,避免单条事件突破声明的事件通道预算
This commit is contained in:
2026-10-02 22:31:05 +08:00
parent 80afa2a139
commit fc10b2359e
@@ -366,8 +366,8 @@ fn item_changes(root: &Path, item: &Value) -> Vec<ThreadFileChange> {
kind: change
.get("kind")
.and_then(Value::as_str)
.unwrap_or("update")
.to_string(),
.map(|kind| bounded(kind, THREAD_DETAIL_MAX_CHARS))
.unwrap_or_else(|| "update".to_string()),
})
})
.collect::<Vec<_>>()
@@ -430,8 +430,8 @@ pub(crate) fn thread_item_from_value(
name: item
.get("name")
.and_then(Value::as_str)
.unwrap_or_default()
.to_string(),
.map(|name| detail_text(root, name))
.unwrap_or_default(),
arguments: field_text(root, item, "arguments").unwrap_or_default(),
at,
},
@@ -455,7 +455,7 @@ pub(crate) fn thread_item_from_value(
status: item
.get("status")
.and_then(Value::as_str)
.map(str::to_string),
.map(|status| bounded(status, THREAD_DETAIL_MAX_CHARS)),
exit_code: item.get("exitCode").and_then(Value::as_i64),
at,
},
@@ -471,7 +471,7 @@ pub(crate) fn thread_item_from_value(
.and_then(Value::as_str)
.map(str::trim)
.filter(|tool| !tool.is_empty())
.map(|tool| sanitize_detail_text(root, tool))
.map(|tool| detail_text(root, tool))
.unwrap_or_default(),
arguments: field_text(root, item, "arguments").unwrap_or_default(),
output: ["result", "error"]
@@ -480,7 +480,7 @@ pub(crate) fn thread_item_from_value(
status: item
.get("status")
.and_then(Value::as_str)
.map(str::to_string),
.map(|status| bounded(status, THREAD_DETAIL_MAX_CHARS)),
at,
},
"webSearch" => ThreadItem::WebSearch {
@@ -497,7 +497,7 @@ pub(crate) fn thread_item_from_value(
"contextCompaction" => ThreadItem::ContextCompaction { item_id, at },
other => ThreadItem::Other {
item_id,
raw_type: other.to_string(),
raw_type: bounded(other, THREAD_DETAIL_MAX_CHARS),
at,
},
})