Add team tasks: several agents in one worktree sharing a board
This commit is contained in:
@@ -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{}
|
||||
|
||||
Reference in New Issue
Block a user