From fc10b2359e417b50f5d2967fce96d664b0d1ebce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 22:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=9D=A1=E7=9B=AE=E6=8A=95=E5=BD=B1=E7=9A=84=E4=B8=8A=E6=B8=B8?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=BB=9F=E4=B8=80=E8=B5=B0=E8=84=B1?= =?UTF-8?q?=E6=95=8F=E4=B8=8E=E9=99=90=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 限长,避免单条事件突破声明的事件通道预算 --- .../src/agent/thread_manager/wire/items.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/thread_manager/wire/items.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/thread_manager/wire/items.rs index 906039e40..cec623fb7 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/thread_manager/wire/items.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/thread_manager/wire/items.rs @@ -366,8 +366,8 @@ fn item_changes(root: &Path, item: &Value) -> Vec { 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::>() @@ -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, }, })