Details (original message): Integrate the Agent-Squad engine: squadadapter maps RoleRegistry/RulePlanner/BackendResolver/ProgressSink/HITL onto the unified Run and event model (step subagents, plan updates, deliverable artifacts, confirmation cards); step-wise engine driving loop; model routing respects profile routes with layered resolver + integration tests; context assembly observation flows to run.completed; mock outputs and e2e coverage.
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package squadadapter
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"agent-squad/squad"
|
|
)
|
|
|
|
func TestMapPlanAndStatus(t *testing.T) {
|
|
p := &squad.WorkflowPlan{Title: "示例编排", Steps: []squad.StepSpec{
|
|
{ID: "s1", Title: "梳理", Status: "completed"},
|
|
{ID: "s2", Title: "成文", Status: "running"},
|
|
{ID: "s3", Title: "终审", Status: "skipped"},
|
|
{ID: "s4", Title: "待办", Status: "pending"},
|
|
}}
|
|
snap := mapPlan(p)
|
|
if snap.Title != "示例编排" || len(snap.Steps) != 4 {
|
|
t.Fatalf("snapshot: %+v", snap)
|
|
}
|
|
want := []string{"done", "in_progress", "skipped", "pending"}
|
|
for i, w := range want {
|
|
if snap.Steps[i].Status != w {
|
|
t.Errorf("step %d: want %s got %s", i, w, snap.Steps[i].Status)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestBuiltinRolesValid(t *testing.T) {
|
|
reg := squad.NewRoleRegistry()
|
|
for _, r := range builtinRoles() {
|
|
if err := reg.Register(r); err != nil {
|
|
t.Errorf("role %s invalid: %v", r.Role, err)
|
|
}
|
|
if r.Backend != "agent-system" {
|
|
t.Errorf("role %s backend: %s", r.Role, r.Backend)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestIsHoldStatus(t *testing.T) {
|
|
for _, s := range []string{"waiting_human", "awaiting_confirmation", "awaiting_clarification", "quality_review"} {
|
|
if !isHoldStatus(s) {
|
|
t.Errorf("%s should be hold", s)
|
|
}
|
|
}
|
|
for _, s := range []string{"completed", "executing", "failed"} {
|
|
if isHoldStatus(s) {
|
|
t.Errorf("%s should not be hold", s)
|
|
}
|
|
}
|
|
}
|