refactor: stabilize runtime and unify config

This commit is contained in:
lpf
2026-03-14 21:40:12 +08:00
parent 60eee65fec
commit 341e578c9f
75 changed files with 3081 additions and 1627 deletions

View File

@@ -0,0 +1,30 @@
package config
import "testing"
func TestNormalizedViewProjectsCoreAndRuntime(t *testing.T) {
cfg := DefaultConfig()
cfg.Agents.Router.Enabled = true
cfg.Agents.Subagents["coder"] = SubagentConfig{
Enabled: true,
Role: "coding",
SystemPromptFile: "agents/coder/AGENT.md",
Tools: SubagentToolsConfig{Allowlist: []string{"shell"}},
Runtime: SubagentRuntimeConfig{Provider: "openai"},
}
view := cfg.NormalizedView()
if view.Core.DefaultProvider != "openai" || view.Core.DefaultModel != "gpt-5.4" {
t.Fatalf("unexpected default model projection: %+v", view.Core)
}
subcfg, ok := view.Core.Subagents["coder"]
if !ok {
t.Fatalf("expected normalized subagent")
}
if subcfg.Prompt != "agents/coder/AGENT.md" || subcfg.Provider != "openai" {
t.Fatalf("unexpected normalized subagent: %+v", subcfg)
}
if !view.Runtime.Router.Enabled || view.Runtime.Router.Strategy != "rules_first" {
t.Fatalf("unexpected runtime router: %+v", view.Runtime.Router)
}
}