assetIds/localPaths 与 sliceCount 的类型错回显改用 not_text_repr

- ImportAccountAssetsField::not_string_array 与 GenerateImageError::SliceCountInvalid 原来把整个值 to_string() 后嵌进错误,MCP 预检又原样回给调用方,超大数组会整份被反射
- 改用共享的 not_text_repr(120 字符截断),与其它「给错类型」的回显同一口径

验证:cargo fmt --check 通过
This commit is contained in:
2026-10-01 17:52:06 +08:00
parent 6a4efa15ee
commit 0354fd353c
@@ -799,7 +799,7 @@ fn import_account_asset_string_array(
};
let values = value
.as_array()
.ok_or_else(|| field.not_string_array(value.to_string()))?;
.ok_or_else(|| field.not_string_array(not_text_repr(value)))?;
if values.len() > DIRECT_TOOL_BRIDGE_MAX_RESOURCE_PAGE_SIZE {
return Err(field.too_many(DIRECT_TOOL_BRIDGE_MAX_RESOURCE_PAGE_SIZE));
}
@@ -3064,7 +3064,7 @@ pub(in crate::agent) fn generate_image_input(
})
.map(|count| count as usize)
.ok_or_else(|| GenerateImageError::SliceCountInvalid {
got: value.to_string(),
got: not_text_repr(value),
})
})
.transpose()?;