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,32 @@
|
||||
package skills
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// 技能描述在本仓库里几乎都是中文(SKILL.md 的 frontmatter),而 PromptSection 的
|
||||
// 预算 maxPromptChars 是字节数:按字节切会在尾部留下半个中文字,这段是要进 system
|
||||
// prompt 发给模型的。
|
||||
func TestPromptSectionTruncationKeepsUTF8(t *testing.T) {
|
||||
var sk []Skill
|
||||
for i := 0; i < 200; i++ {
|
||||
sk = append(sk, Skill{
|
||||
Name: fmt.Sprintf("技能%03d", i),
|
||||
Description: strings.Repeat("用于演示中文描述的截断位置", 20),
|
||||
})
|
||||
}
|
||||
out := PromptSection(sk)
|
||||
if len(out) <= maxPromptChars {
|
||||
t.Skip("没造出溢出场景,用例无效")
|
||||
}
|
||||
if !utf8.ValidString(out) {
|
||||
t.Errorf("技能列表截断后含非法 UTF-8,切点附近:%q",
|
||||
out[maxPromptChars-20:min(len(out), maxPromptChars+30)])
|
||||
}
|
||||
if !strings.Contains(out, "skill list truncated") {
|
||||
t.Error("截断标记丢了——用户与模型都不知道这份列表不是全量")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user