feat: AutoZero 通用 Agent 框架(从 AutoGo 五阶段拆分完成)
llm(三协议 Provider)/ session(JSONL 持久化)/ tools(Registry、围栏、 builtin、computer)/ cdp(browser)/ skills / mcp / agent(循环、两级压缩、 编排、审批门控)+ 底座 jsonl/textx/execx/diag/scratch/spill/imagecache。 产品装配代码(config 桥接、schedule 工具、memory/plan/retro/prompt) 留在 AutoGo,宿主接入方式见 MIGRATION.md。
This commit is contained in:
commit
d5dac5a6fc
140 files changed
+26497
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestDiscoveredInstructionsSection:按路径去重、限制总量,并渲染成可读段落。
|
||||
func TestDiscoveredInstructionsSection(t *testing.T) {
|
||||
a := &Agent{}
|
||||
a.AddInstructions("/repo/sub/AGENTS.md", "SUB-RULES")
|
||||
a.AddInstructions("/repo/sub/AGENTS.md", "SUB-RULES")
|
||||
sec := a.InstructionsSection()
|
||||
if strings.Count(sec, "SUB-RULES") != 1 {
|
||||
t.Fatalf("dedupe failed: %q", sec)
|
||||
}
|
||||
if !strings.Contains(sec, "discovered for the subtree") || !strings.Contains(sec, "AGENTS.md") {
|
||||
t.Fatalf("section shape: %q", sec)
|
||||
}
|
||||
|
||||
for i := 0; i < maxDiscoveredFiles+4; i++ {
|
||||
a.AddInstructions(fmt.Sprintf("/repo/s%d/AGENTS.md", i), "X")
|
||||
}
|
||||
if len(a.discoveredInstructions) != maxDiscoveredFiles {
|
||||
t.Fatalf("files = %d, want cap %d", len(a.discoveredInstructions), maxDiscoveredFiles)
|
||||
}
|
||||
if got := a.InstructionsSection(); strings.Count(got, "X") > maxDiscoveredFiles {
|
||||
t.Fatalf("cap not applied to rendered section")
|
||||
}
|
||||
|
||||
// 空 agent 不产生额外 system 文本。
|
||||
empty := &Agent{}
|
||||
if got := empty.InstructionsSection(); got != "" {
|
||||
t.Fatalf("empty section = %q", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user