Converted all external tool calling to async
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::sync::Mutex;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::broadcast;
|
||||
|
||||
use crate::agents::pool::StoryAgent;
|
||||
@@ -83,7 +83,7 @@ pub(crate) fn count_turns_in_log(path: &Path) -> u64 {
|
||||
/// Turns and budget are counted from the **current session's** log file
|
||||
/// only — prior sessions are excluded so that restart counts from earlier
|
||||
/// runs do not accumulate against the limits.
|
||||
pub(super) fn check_agent_limits(
|
||||
pub(super) async fn check_agent_limits(
|
||||
agents: &Mutex<HashMap<String, StoryAgent>>,
|
||||
project_root: &Path,
|
||||
) -> Vec<(String, TerminationReason)> {
|
||||
@@ -94,10 +94,7 @@ pub(super) fn check_agent_limits(
|
||||
|
||||
// Snapshot running agents: (key, story_id, agent_name, tx, log_session_id).
|
||||
let running: Vec<RunningAgentSnapshot> = {
|
||||
let lock = match agents.lock() {
|
||||
Ok(l) => l,
|
||||
Err(_) => return Vec::new(),
|
||||
};
|
||||
let lock = agents.lock().await;
|
||||
lock.iter()
|
||||
.filter(|(_, agent)| agent.status == AgentStatus::Running)
|
||||
.map(|(key, agent)| {
|
||||
|
||||
Reference in New Issue
Block a user