From 59f9b66360130bf59cfa49996e9fef6f3f2e8b53 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Fri, 1 May 2026 00:15:55 +0800 Subject: [PATCH] feat(workspace): initialize Rust workspace with core services and dependencies --- Cargo.toml | 2 +- libs/agent/chat/service.rs | 3 ++- libs/git/ssh/mod.rs | 3 ++- libs/room/src/message.rs | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b759e9c..584a274 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -143,7 +143,7 @@ clap = "4.6.0" time = "0.3.47" chrono = "0.4.44" tracing = "0.1.44" -tracing-subscriber = { version = "0.3.23", features = ["env-filter", "json"] } +tracing-subscriber = { version = "0.3.23", features = ["env-filter", "json", "tracing-log"] } tracing-opentelemetry = "0.32.1" tonic = "0.14.5" tonic-build = "0.14.5" diff --git a/libs/agent/chat/service.rs b/libs/agent/chat/service.rs index 2ae3d6d..465c13a 100644 --- a/libs/agent/chat/service.rs +++ b/libs/agent/chat/service.rs @@ -662,7 +662,8 @@ impl ChatService { match rx.try_recv() { Ok(tc) => { let args_display = if tc.arguments.len() > 100 { - format!("{}...", &tc.arguments[..100]) + let end = tc.arguments.char_indices().map(|(i, _)| i).take_while(|&i| i <= 100).last().unwrap_or(100); + format!("{}...", &tc.arguments[..end]) } else { tc.arguments.clone() }; diff --git a/libs/git/ssh/mod.rs b/libs/git/ssh/mod.rs index 9d3044a..a4f0fc0 100644 --- a/libs/git/ssh/mod.rs +++ b/libs/git/ssh/mod.rs @@ -58,7 +58,8 @@ impl SSHHandle { } let preview = if private_key_content.len() > 100 { - format!("{}...", &private_key_content[..100]) + let end = private_key_content.char_indices().map(|(i, _)| i).take_while(|&i| i <= 100).last().unwrap_or(100); + format!("{}...", &private_key_content[..end]) } else { private_key_content.clone() }; diff --git a/libs/room/src/message.rs b/libs/room/src/message.rs index a8660b2..652d3db 100644 --- a/libs/room/src/message.rs +++ b/libs/room/src/message.rs @@ -213,7 +213,8 @@ impl RoomService { }; let preview = if content.len() > 50 { - format!("{}...", &content[..50]) + let end = content.char_indices().map(|(i, _)| i).take_while(|&i| i <= 50).last().unwrap_or(50); + format!("{}...", &content[..end]) } else { content.clone() };