Add team tasks: several agents in one worktree sharing a board

This commit is contained in:
Ian Gulliver
2026-10-18 08:48:57 -07:00
parent 7f62df19d2
commit 6bcde13b2f
31 changed files with 1392 additions and 439 deletions
+34 -1
View File
@@ -62,7 +62,14 @@ func Validate(def api.WorkflowDefinition) error {
}
seen[s.Name] = true
if strings.TrimSpace(s.Model) == "" {
switch {
case s.Agents != nil && strings.TrimSpace(s.Model) != "":
problems = append(problems, fmt.Sprintf("%s: model can't be given with agents, which name their own", where))
case s.Agents != nil:
for _, p := range TeamProblems(*s.Agents) {
problems = append(problems, fmt.Sprintf("%s: %s", where, p))
}
case strings.TrimSpace(s.Model) == "":
problems = append(problems, fmt.Sprintf("%s: model is required", where))
}
@@ -103,6 +110,32 @@ func Validate(def api.WorkflowDefinition) error {
return nil
}
func TeamProblems(members []api.TeamMember) []string {
problems := []string{}
if len(members) < 2 {
problems = append(problems, "a team needs at least two agents")
}
seen := map[string]bool{}
for i, mem := range members {
where := fmt.Sprintf("agent %d (%q)", i+1, mem.Name)
p := nameProblem(mem.Name)
if p != "" {
problems = append(problems, fmt.Sprintf("%s: name %s", where, p))
}
if seen[mem.Name] {
problems = append(problems, fmt.Sprintf("%s: another agent has the same name", where))
}
seen[mem.Name] = true
if strings.TrimSpace(mem.Model) == "" {
problems = append(problems, fmt.Sprintf("%s: model is required", where))
}
if strings.TrimSpace(mem.Prompt) == "" {
problems = append(problems, fmt.Sprintf("%s: prompt is empty", where))
}
}
return problems
}
func graphProblems(def api.WorkflowDefinition) []string {
problems := []string{}
finals := []string{}