mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-06 03:18:59 +08:00
Release v0.1.0 agent topology and runtime refresh
This commit is contained in:
@@ -46,7 +46,7 @@ func TestSubagentProfileStoreNormalization(t *testing.T) {
|
||||
|
||||
func TestSubagentManagerSpawnRejectsDisabledProfile(t *testing.T) {
|
||||
workspace := t.TempDir()
|
||||
manager := NewSubagentManager(nil, workspace, nil, nil)
|
||||
manager := NewSubagentManager(nil, workspace, nil)
|
||||
manager.SetRunFunc(func(ctx context.Context, task *SubagentTask) (string, error) {
|
||||
return "ok", nil
|
||||
})
|
||||
@@ -74,7 +74,7 @@ func TestSubagentManagerSpawnRejectsDisabledProfile(t *testing.T) {
|
||||
|
||||
func TestSubagentManagerSpawnResolvesProfileByRole(t *testing.T) {
|
||||
workspace := t.TempDir()
|
||||
manager := NewSubagentManager(nil, workspace, nil, nil)
|
||||
manager := NewSubagentManager(nil, workspace, nil)
|
||||
store := manager.ProfileStore()
|
||||
if store == nil {
|
||||
t.Fatalf("expected profile store to be available")
|
||||
@@ -234,3 +234,44 @@ func TestSubagentProfileStoreIncludesNodeMainBranchProfiles(t *testing.T) {
|
||||
t.Fatalf("expected node-managed delete to fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubagentProfileStoreExcludesLocalNodeMainBranchProfile(t *testing.T) {
|
||||
runtimecfg.Set(config.DefaultConfig())
|
||||
t.Cleanup(func() {
|
||||
runtimecfg.Set(config.DefaultConfig())
|
||||
nodes.DefaultManager().Remove("local")
|
||||
})
|
||||
|
||||
cfg := config.DefaultConfig()
|
||||
cfg.Agents.Router.Enabled = true
|
||||
cfg.Agents.Router.MainAgentID = "main"
|
||||
cfg.Agents.Subagents["main"] = config.SubagentConfig{
|
||||
Enabled: true,
|
||||
Type: "router",
|
||||
SystemPromptFile: "agents/main/AGENT.md",
|
||||
}
|
||||
runtimecfg.Set(cfg)
|
||||
|
||||
nodes.DefaultManager().Upsert(nodes.NodeInfo{
|
||||
ID: "local",
|
||||
Name: "Local",
|
||||
Online: true,
|
||||
})
|
||||
|
||||
store := NewSubagentProfileStore(t.TempDir())
|
||||
if profile, ok, err := store.Get(nodeBranchAgentID("local")); err != nil {
|
||||
t.Fatalf("get failed: %v", err)
|
||||
} else if ok {
|
||||
t.Fatalf("expected local node branch profile to be excluded, got %+v", profile)
|
||||
}
|
||||
|
||||
items, err := store.List()
|
||||
if err != nil {
|
||||
t.Fatalf("list failed: %v", err)
|
||||
}
|
||||
for _, item := range items {
|
||||
if item.AgentID == nodeBranchAgentID("local") {
|
||||
t.Fatalf("local node branch profile should not appear in list")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user