Refine agent config schema and prompt file loading

This commit is contained in:
lpf
2026-03-06 13:56:38 +08:00
parent 1fec90643b
commit 2bc71870db
16 changed files with 483 additions and 250 deletions

View File

@@ -122,11 +122,12 @@ func TestSubagentProfileStoreReadsProfilesFromRuntimeConfig(t *testing.T) {
cfg := config.DefaultConfig()
cfg.Agents.Subagents["coder"] = config.SubagentConfig{
Enabled: true,
DisplayName: "Code Agent",
Role: "coding",
SystemPrompt: "write code",
MemoryNamespace: "code-ns",
Enabled: true,
DisplayName: "Code Agent",
Role: "coding",
SystemPrompt: "write code",
SystemPromptFile: "agents/coder/AGENT.md",
MemoryNamespace: "code-ns",
Tools: config.SubagentToolsConfig{
Allowlist: []string{"read_file", "shell"},
},
@@ -154,6 +155,9 @@ func TestSubagentProfileStoreReadsProfilesFromRuntimeConfig(t *testing.T) {
if profile.Name != "Code Agent" || profile.Role != "coding" {
t.Fatalf("unexpected profile fields: %+v", profile)
}
if profile.SystemPromptFile != "agents/coder/AGENT.md" {
t.Fatalf("expected system_prompt_file from config, got: %s", profile.SystemPromptFile)
}
if len(profile.ToolAllowlist) != 2 {
t.Fatalf("expected merged allowlist, got: %v", profile.ToolAllowlist)
}