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, }, })