style: format seluruh workspace dengan cargo fmt

Menyeragamkan format kode sesuai rustfmt (126 file). Sebelumnya
lefthook pre-commit 'cargo fmt --check' akan gagal pada commit apa pun.
This commit is contained in:
asepharyana
2026-08-27 22:10:28 +07:00
parent 884b19ccb5
commit 7b0b53671f
127 changed files with 1271 additions and 1156 deletions
@@ -112,10 +112,7 @@ impl Tool for ParallelDelegate {
dirs.iter()
.filter_map(|d| {
let directive = d.get("directive").and_then(|v| v.as_str())?;
let access_str = d
.get("access")
.and_then(|v| v.as_str())
.unwrap_or("write");
let access_str = d.get("access").and_then(|v| v.as_str()).unwrap_or("write");
let access = match access_str {
"read" => AccessTier::Read,
"full" => AccessTier::Full,
@@ -162,12 +159,7 @@ impl Tool for ParallelDelegate {
);
debug!(agent_index = i, access = ?access, "spawning parallel agent");
let handle = spawn_subagent(
subagent_ctx,
directive.clone(),
*access,
ctx.clone(),
);
let handle = spawn_subagent(subagent_ctx, directive.clone(), *access, ctx.clone());
handles.push((i, handle));
}
@@ -181,11 +173,7 @@ impl Tool for ParallelDelegate {
}
Ok(Err(e)) => {
warn!(agent_index = i, error = %e, "parallel agent failed");
results.push((
i,
directives[i].0.clone(),
format!("[ERROR] {e}"),
));
results.push((i, directives[i].0.clone(), format!("[ERROR] {e}")));
}
Err(e) => {
warn!(agent_index = i, error = ?e, "parallel agent panicked");
@@ -201,7 +189,8 @@ impl Tool for ParallelDelegate {
// Consolidate results
if synthesize && results.len() > 1 {
let rt = tokio::runtime::Runtime::new()?;
let consolidated = rt.block_on(consolidate_results(&results, &base_url, &api_key, &model))?;
let consolidated =
rt.block_on(consolidate_results(&results, &base_url, &api_key, &model))?;
Ok(format!(
"## Parallel Delegation Complete\n\n**Task:** {task}\n**Parallel agents:** {}\n\n{}",
results.len(),
@@ -213,7 +202,10 @@ impl Tool for ParallelDelegate {
results.len()
);
for (i, directive, result) in &results {
output.push_str(&format!("---\n### Agent {}: {}\n\n{}\n", i, directive, result));
output.push_str(&format!(
"---\n### Agent {}: {}\n\n{}\n",
i, directive, result
));
}
Ok(output)
}
@@ -234,9 +226,8 @@ async fn auto_split_task(
Some(base_url.to_string()),
);
let sys_msg = zesdex_domain::core::ChatMessage::system(
format!(
"You are a task decomposition expert. Split the following task into {max_parallel} \
let sys_msg = zesdex_domain::core::ChatMessage::system(format!(
"You are a task decomposition expert. Split the following task into {max_parallel} \
independent sub-tasks that can run in parallel. Each sub-task must be self-contained \
and produce useful output independently.\n\n\
Output your response as a JSON array of objects, each with:\n\
@@ -244,15 +235,16 @@ async fn auto_split_task(
- \"access\": one of \"read\", \"write\", or \"full\"\n\n\
IMPORTANT: Return ONLY valid JSON, no other text. Example:\n\
[{{\"directive\": \"Create the User model with fields...\", \"access\": \"write\"}}]"
)
);
));
let user_msg =
zesdex_domain::core::ChatMessage::user(format!("Task: {task}\n\nSplit into {max_parallel} parallel directives:"));
let user_msg = zesdex_domain::core::ChatMessage::user(format!(
"Task: {task}\n\nSplit into {max_parallel} parallel directives:"
));
use zesdex_application::ports::ProviderService;
match client
.chat(&[sys_msg, user_msg], None, Some(2048), Some(0.4)).await
.chat(&[sys_msg, user_msg], None, Some(2048), Some(0.4))
.await
{
Ok((response, _)) => {
let text = response.content.unwrap_or_default();
@@ -320,10 +312,7 @@ fn fallback_split(task: &str, max_parallel: usize) -> Vec<(String, AccessTier)>
}
if task.contains("test") || task.contains("unit") {
directives.push((
format!("Write unit tests for: {task}"),
AccessTier::Read,
));
directives.push((format!("Write unit tests for: {task}"), AccessTier::Read));
}
if directives.is_empty() {
@@ -370,7 +359,10 @@ async fn consolidate_results(
));
use zesdex_application::ports::ProviderService;
match client.chat(&[sys_msg, user_msg], None, Some(2048), Some(0.3)).await {
match client
.chat(&[sys_msg, user_msg], None, Some(2048), Some(0.3))
.await
{
Ok((response, _)) => Ok(response.content.unwrap_or_else(|| summary.clone())),
Err(e) => {
warn!(error = %e, "consolidation LLM call failed, using raw concatenation");