Skip to content

Commit 36a0deb

Browse files
author
zk
committed
chore: apply auto-fixes (fmt + clippy)
1 parent c8e38e3 commit 36a0deb

13 files changed

Lines changed: 44 additions & 58 deletions

File tree

crates/aionui-ai-agent/src/factory/acp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@ mod tests {
622622
"conv-acp",
623623
Arc::new(BroadcastEventBus::new(16)),
624624
)
625-
.await
626-
.expect("resolved command spec");
625+
.await
626+
.expect("resolved command spec");
627627

628628
let expected = std::fs::canonicalize(runtime.path().join("bin").join("npx")).expect("canonical path");
629629
assert_eq!(spec.command, expected);

crates/aionui-ai-agent/src/factory/aionrs.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use aionui_api_types::{
99
use aionui_common::AppError;
1010
use aionui_db::IMcpServerRepository;
1111
use aionui_db::models::McpServerRow;
12-
use aionui_runtime::ensure_runtime_command_with_reporter;
1312
use aionui_realtime::EventBroadcaster;
13+
use aionui_runtime::ensure_runtime_command_with_reporter;
1414
use tracing::{debug, info, warn};
1515

1616
use crate::agent_task::AgentInstance;
@@ -59,14 +59,13 @@ pub(super) async fn build(
5959

6060
let mut extra_mcp_servers = resolve_mcp_servers(&overrides, &ctx.conversation_id);
6161
if let Some(repo) = deps.mcp_server_repo.as_ref() {
62-
for (name, config) in
63-
load_user_mcp_servers(
64-
repo.as_ref(),
65-
overrides.mcp_server_ids.as_deref(),
66-
&ctx.conversation_id,
67-
deps.broadcaster.clone(),
68-
)
69-
.await
62+
for (name, config) in load_user_mcp_servers(
63+
repo.as_ref(),
64+
overrides.mcp_server_ids.as_deref(),
65+
&ctx.conversation_id,
66+
deps.broadcaster.clone(),
67+
)
68+
.await
7069
{
7170
extra_mcp_servers.entry(name).or_insert(config);
7271
}
@@ -443,7 +442,8 @@ async fn session_server_to_mcp_server_config(
443442
return Err("stdio: missing command".to_owned());
444443
}
445444
let entries: Vec<(String, String)> = env.iter().map(|(k, v)| (k.clone(), v.clone())).collect();
446-
let (command, args, env) = ensure_stdio_launch(command, args, &entries, conversation_id, broadcaster).await?;
445+
let (command, args, env) =
446+
ensure_stdio_launch(command, args, &entries, conversation_id, broadcaster).await?;
447447
Ok(McpServerConfig {
448448
transport: TransportType::Stdio,
449449
command: Some(command),
@@ -621,9 +621,9 @@ fn guide_mcp_to_config(
621621
#[cfg(test)]
622622
mod tests {
623623
use super::*;
624+
use aionui_realtime::BroadcastEventBus;
624625
use std::ffi::OsString;
625626
use std::sync::{Mutex, OnceLock};
626-
use aionui_realtime::BroadcastEventBus;
627627

628628
fn path_test_lock() -> &'static Mutex<()> {
629629
static LOCK: OnceLock<Mutex<()>> = OnceLock::new();

crates/aionui-ai-agent/src/runtime_status.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use aionui_api_types::{
55
RuntimeStatusScopeKind, WebSocketMessage,
66
};
77
use aionui_realtime::EventBroadcaster;
8-
use aionui_runtime::{
9-
NodeRuntimeFailureKind, NodeRuntimeProgress, SharedNodeRuntimeProgressReporter,
10-
};
8+
use aionui_runtime::{NodeRuntimeFailureKind, NodeRuntimeProgress, SharedNodeRuntimeProgressReporter};
119

1210
pub(crate) fn conversation_runtime_reporter(
1311
broadcaster: Arc<dyn EventBroadcaster>,

crates/aionui-mcp/src/routes.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ async fn test_connection(
145145
let transport = McpServerTransport::from(req.transport);
146146
let result = state
147147
.connection_test_service
148-
.test_connection_with_runtime_scope(&req.name, &transport, req.runtime_scope_id.as_deref().or(req.id.as_deref()))
148+
.test_connection_with_runtime_scope(
149+
&req.name,
150+
&transport,
151+
req.runtime_scope_id.as_deref().or(req.id.as_deref()),
152+
)
149153
.await;
150154
if let Some(server_id) = req.id.as_deref() {
151155
state.config_service.persist_test_result(server_id, &result).await?;

crates/aionui-runtime/src/node_runtime/managed.rs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ pub async fn install_and_validate_with_reporter(
6666
let spec = platform_spec().inspect_err(|error| {
6767
emit_progress(
6868
reporter,
69-
NodeRuntimeProgress::failed(
70-
NodeRuntimeFailureKind::UnsupportedPlatform,
71-
error.to_string(),
72-
),
69+
NodeRuntimeProgress::failed(NodeRuntimeFailureKind::UnsupportedPlatform, error.to_string()),
7370
);
7471
})?;
7572
let runtime_root = cache::node_runtime_root()
@@ -322,7 +319,10 @@ async fn install_archive(
322319

323320
emit_progress(
324321
reporter,
325-
NodeRuntimeProgress::extracting(format!("extracting managed Node runtime into {}", runtime_root.display())),
322+
NodeRuntimeProgress::extracting(format!(
323+
"extracting managed Node runtime into {}",
324+
runtime_root.display()
325+
)),
326326
);
327327
match spec.archive_ext {
328328
"tar.gz" => extract_tar_gz(&archive_path, runtime_root)?,
@@ -551,10 +551,7 @@ fn reqwest_error(stage: &str, url: &str, error: &reqwest::Error) -> NodeRuntimeE
551551
}
552552

553553
fn timeout_error(stage: &str, url: &str, timeout: Duration) -> NodeRuntimeError {
554-
NodeRuntimeError::managed_invalid(format!(
555-
"{stage} timed out after {}s for {url}",
556-
timeout.as_secs()
557-
))
554+
NodeRuntimeError::managed_invalid(format!("{stage} timed out after {}s for {url}", timeout.as_secs()))
558555
}
559556

560557
fn download_progress_message(url: &str, downloaded_bytes: u64, total_bytes: Option<u64>) -> String {
@@ -583,7 +580,8 @@ fn classify_error(error: &NodeRuntimeError) -> (NodeRuntimeFailureKind, Option<u
583580
if message.contains("unsupported") {
584581
return (NodeRuntimeFailureKind::UnsupportedPlatform, None);
585582
}
586-
if message.contains("validate") || message.contains("executable missing") || message.contains("entrypoint missing") {
583+
if message.contains("validate") || message.contains("executable missing") || message.contains("entrypoint missing")
584+
{
587585
return (NodeRuntimeFailureKind::ValidationFailed, None);
588586
}
589587
if message.contains("download") || message.contains("extract") || message.contains("connect failed") {
@@ -595,17 +593,11 @@ fn classify_error(error: &NodeRuntimeError) -> (NodeRuntimeFailureKind, Option<u
595593
fn parse_http_status(message: &str) -> Option<u16> {
596594
let marker = "http ";
597595
let start = message.find(marker)? + marker.len();
598-
let digits: String = message[start..]
599-
.chars()
600-
.take_while(|ch| ch.is_ascii_digit())
601-
.collect();
596+
let digits: String = message[start..].chars().take_while(|ch| ch.is_ascii_digit()).collect();
602597
digits.parse::<u16>().ok()
603598
}
604599

605-
fn install_error(
606-
error: NodeRuntimeError,
607-
reporter: Option<&dyn NodeRuntimeProgressReporter>,
608-
) -> NodeRuntimeError {
600+
fn install_error(error: NodeRuntimeError, reporter: Option<&dyn NodeRuntimeProgressReporter>) -> NodeRuntimeError {
609601
let (kind, status_code) = classify_error(&error);
610602
emit_progress(
611603
reporter,
@@ -617,10 +609,7 @@ fn install_error(
617609
error
618610
}
619611

620-
fn validation_error(
621-
error: NodeRuntimeError,
622-
reporter: Option<&dyn NodeRuntimeProgressReporter>,
623-
) -> NodeRuntimeError {
612+
fn validation_error(error: NodeRuntimeError, reporter: Option<&dyn NodeRuntimeProgressReporter>) -> NodeRuntimeError {
624613
emit_progress(
625614
reporter,
626615
NodeRuntimeProgress::failed(NodeRuntimeFailureKind::ValidationFailed, error.to_string()),

crates/aionui-runtime/src/node_runtime/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ async fn cached_managed_runtime_unreported() -> Option<ResolvedNodeRuntime> {
158158
cached_managed_runtime(None).await
159159
}
160160

161-
async fn cached_managed_runtime(
162-
reporter: Option<&dyn NodeRuntimeProgressReporter>,
163-
) -> Option<ResolvedNodeRuntime> {
161+
async fn cached_managed_runtime(reporter: Option<&dyn NodeRuntimeProgressReporter>) -> Option<ResolvedNodeRuntime> {
164162
let cached = managed_runtime_cache().lock().await.clone()?;
165163

166164
match managed::validate_managed_runtime(&cached.root, reporter).await {

crates/aionui-system/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ pub mod client_pref;
44
pub mod model_fetcher;
55
pub mod protocol;
66
pub mod provider;
7-
pub mod runtime_prepare;
87
pub mod routes;
8+
pub mod runtime_prepare;
99
pub mod settings;
1010
pub mod sysinfo;
1111
pub mod version;
@@ -15,7 +15,7 @@ pub use client_pref::ClientPrefService;
1515
pub use model_fetcher::ModelFetchService;
1616
pub use protocol::ProtocolDetectionService;
1717
pub use provider::ProviderService;
18-
pub use runtime_prepare::RuntimePrepareService;
1918
pub use routes::{SystemRouterState, settings_routes, system_routes};
19+
pub use runtime_prepare::RuntimePrepareService;
2020
pub use settings::SettingsService;
2121
pub use version::VersionCheckService;

crates/aionui-system/src/runtime_prepare.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ impl RuntimePrepareService {
2121
Self { broadcaster }
2222
}
2323

24-
pub async fn ensure_node_runtime(
25-
&self,
26-
scope: RuntimeStatusScope,
27-
) -> Result<EnsureNodeRuntimeResponse, AppError> {
24+
pub async fn ensure_node_runtime(&self, scope: RuntimeStatusScope) -> Result<EnsureNodeRuntimeResponse, AppError> {
2825
let reporter = self.runtime_reporter(scope);
2926
ensure_node_runtime_with_reporter(Some(reporter.as_ref()))
3027
.await

crates/aionui-system/tests/model_fetch_routes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use aionui_db::{
2020
};
2121
use aionui_realtime::BroadcastEventBus;
2222
use aionui_system::{
23-
ClientPrefService, ModelFetchService, ProtocolDetectionService, ProviderService, SettingsService,
24-
RuntimePrepareService, SystemRouterState, VersionCheckService, system_routes,
23+
ClientPrefService, ModelFetchService, ProtocolDetectionService, ProviderService, RuntimePrepareService,
24+
SettingsService, SystemRouterState, VersionCheckService, system_routes,
2525
};
2626

2727
// ---------------------------------------------------------------------------

crates/aionui-system/tests/protocol_detection_routes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use aionui_db::{
1818
SqliteClientPreferenceRepository, SqliteProviderRepository, SqliteSettingsRepository, init_database_memory,
1919
};
2020
use aionui_system::{
21-
ClientPrefService, ModelFetchService, ProtocolDetectionService, ProviderService, SettingsService,
22-
RuntimePrepareService, SystemRouterState, VersionCheckService, system_routes,
21+
ClientPrefService, ModelFetchService, ProtocolDetectionService, ProviderService, RuntimePrepareService,
22+
SettingsService, SystemRouterState, VersionCheckService, system_routes,
2323
};
2424

2525
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)