codetether-agent 4.7.0-a-002.4

A2A-native AI coding agent for the CodeTether ecosystem
Documentation
use crate::swarm::SubTask;
use std::collections::{HashMap, HashSet};

pub(super) struct DependencyGraph<'a> {
    pub ids: HashSet<&'a str>,
    pub edges: HashMap<&'a str, Vec<&'a str>>,
}

impl<'a> DependencyGraph<'a> {
    pub fn from_subtasks(subtasks: &'a [SubTask]) -> Self {
        let ids = subtasks.iter().map(|subtask| subtask.id.as_str()).collect();
        let edges = subtasks
            .iter()
            .map(|subtask| (subtask.id.as_str(), dependencies(subtask)))
            .collect();
        Self { ids, edges }
    }
}

fn dependencies(subtask: &SubTask) -> Vec<&str> {
    subtask.dependencies.iter().map(String::as_str).collect()
}