Skip to content

Commit d8cb989

Browse files
RoyLinRoyLin
authored andcommitted
style: apply cargo fmt to orchestrator module
1 parent ab742f8 commit d8cb989

2 files changed

Lines changed: 30 additions & 27 deletions

File tree

core/src/orchestrator/agent.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ impl AgentOrchestrator {
7272
}
7373

7474
/// Create an orchestrator backed by a real Agent with custom config.
75-
pub fn from_agent_with_config(
76-
agent: Arc<crate::Agent>,
77-
config: OrchestratorConfig,
78-
) -> Self {
75+
pub fn from_agent_with_config(agent: Arc<crate::Agent>, config: OrchestratorConfig) -> Self {
7976
let (event_tx, _) = broadcast::channel(config.event_buffer_size);
8077

8178
Self {

core/src/orchestrator/wrapper.rs

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ pub struct SubAgentWrapper {
2020
activity: Arc<RwLock<SubAgentActivity>>,
2121
/// Shared map of live sessions; wrapper registers its session here so
2222
/// `AgentOrchestrator::complete_external_task()` can reach it.
23-
session_registry: Arc<RwLock<std::collections::HashMap<String, Arc<crate::agent_api::AgentSession>>>>,
23+
session_registry:
24+
Arc<RwLock<std::collections::HashMap<String, Arc<crate::agent_api::AgentSession>>>>,
2425
}
2526

2627
impl SubAgentWrapper {
@@ -32,7 +33,9 @@ impl SubAgentWrapper {
3233
control_rx: mpsc::Receiver<ControlSignal>,
3334
state: Arc<RwLock<SubAgentState>>,
3435
activity: Arc<RwLock<SubAgentActivity>>,
35-
session_registry: Arc<RwLock<std::collections::HashMap<String, Arc<crate::agent_api::AgentSession>>>>,
36+
session_registry: Arc<
37+
RwLock<std::collections::HashMap<String, Arc<crate::agent_api::AgentSession>>>,
38+
>,
3639
) -> Self {
3740
Self {
3841
id,
@@ -197,16 +200,16 @@ impl SubAgentWrapper {
197200
step += 1;
198201
*self.activity.write().await = SubAgentActivity::Idle;
199202
let tool_start = std::time::Instant::now();
200-
let _ =
201-
self.event_tx
202-
.send(OrchestratorEvent::ToolExecutionCompleted {
203-
id: self.id.clone(),
204-
tool_id: id,
205-
tool_name: name,
206-
result: tool_out,
207-
exit_code,
208-
duration_ms: tool_start.elapsed().as_millis() as u64,
209-
});
203+
let _ = self
204+
.event_tx
205+
.send(OrchestratorEvent::ToolExecutionCompleted {
206+
id: self.id.clone(),
207+
tool_id: id,
208+
tool_name: name,
209+
result: tool_out,
210+
exit_code,
211+
duration_ms: tool_start.elapsed().as_millis() as u64,
212+
});
210213
let _ = self.event_tx.send(OrchestratorEvent::SubAgentProgress {
211214
id: self.id.clone(),
212215
step,
@@ -241,11 +244,13 @@ impl SubAgentWrapper {
241244
session_id,
242245
success,
243246
}) => {
244-
let _ = self.event_tx.send(OrchestratorEvent::ExternalTaskCompleted {
245-
id: self.id.clone(),
246-
task_id,
247-
success,
248-
});
247+
let _ = self
248+
.event_tx
249+
.send(OrchestratorEvent::ExternalTaskCompleted {
250+
id: self.id.clone(),
251+
task_id,
252+
success,
253+
});
249254
let _ = session_id;
250255
}
251256
Some(AgentEvent::End { text, .. }) => {
@@ -257,10 +262,12 @@ impl SubAgentWrapper {
257262
}
258263
// Forward all other events as internal events for observability.
259264
Some(event) => {
260-
let _ = self.event_tx.send(OrchestratorEvent::SubAgentInternalEvent {
261-
id: self.id.clone(),
262-
event,
263-
});
265+
let _ = self
266+
.event_tx
267+
.send(OrchestratorEvent::SubAgentInternalEvent {
268+
id: self.id.clone(),
269+
event,
270+
});
264271
}
265272
None => break, // stream closed
266273
}
@@ -310,8 +317,7 @@ impl SubAgentWrapper {
310317

311318
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
312319

313-
*self.activity.write().await =
314-
SubAgentActivity::RequestingLlm { message_count: 3 };
320+
*self.activity.write().await = SubAgentActivity::RequestingLlm { message_count: 3 };
315321

316322
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
317323

0 commit comments

Comments
 (0)