use std::collections::BTreeMap; use crate::agent::actions::Plan; #[derive(Clone)] pub struct ScheduledTasks {} impl ScheduledTasks { pub fn new() -> Self { Self {} } pub async fn handle( &self, task: &str, _properties: BTreeMap, ) -> anyhow::Result<()> { // Get plan let plan = Plan::new(); let tasks = plan.tasks().await?; // For task for task in tasks { // Check idempotency rules if !task.should_run().await? { tracing::debug!(task = task.id(), "skipping run"); continue; } // Run task if not valid tracing::info!(task = task.id(), "executing task"); task.execute().await?; } Ok(()) } }