refactor(instruction): remove project instruction handling and related tests

This commit is contained in:
mlogclub
2026-04-18 10:54:36 +08:00
parent 19848d031b
commit 9a677a6265
12 changed files with 9 additions and 157 deletions
@@ -56,7 +56,7 @@ func NewAgentFactory() *AgentFactory {
return &AgentFactory{
chatModelFactory: NewChatModelFactory(),
toolFactory: NewToolFactory(),
instructionService: runtimeinstruction.NewService(nil, nil, nil, nil, nil),
instructionService: runtimeinstruction.NewService(nil, nil, nil, nil),
handlerService: NewAgentHandlerService(nil),
}
}
@@ -14,8 +14,7 @@ func TestAgentHandlerServiceBuildWithCollectorOnly(t *testing.T) {
handlers, err := service.Build(context.Background(), BuildAgentHandlersInput{
Collector: collector,
InstructionSummary: einocallbacks.InstructionTraceSummary{
SectionTitles: []string{"项目级规则", "系统治理规则"},
HasProjectRule: true,
SectionTitles: []string{"系统治理规则"},
HasGovernanceRule: true,
},
})
@@ -25,10 +24,10 @@ func TestAgentHandlerServiceBuildWithCollectorOnly(t *testing.T) {
if len(handlers) != 1 {
t.Fatalf("expected 1 handler, got %d", len(handlers))
}
if !collector.Data.Instruction.HasProjectRule || !collector.Data.Instruction.HasGovernanceRule {
if !collector.Data.Instruction.HasGovernanceRule {
t.Fatalf("instruction summary was not written to collector: %#v", collector.Data.Instruction)
}
if len(collector.Data.Instruction.SectionTitles) != 2 {
if len(collector.Data.Instruction.SectionTitles) != 1 {
t.Fatalf("unexpected section titles: %#v", collector.Data.Instruction.SectionTitles)
}
}
@@ -15,7 +15,6 @@ import (
func buildInstructionTraceSummary(summary runtimeinstruction.AssemblySummary) einocallbacks.InstructionTraceSummary {
return einocallbacks.InstructionTraceSummary{
SectionTitles: append([]string(nil), summary.SectionTitles...),
HasProjectRule: summary.HasProjectRule,
HasGovernanceRule: summary.HasGovernanceRule,
HasAgentRule: summary.HasAgentRule,
HasSkillRule: summary.HasSkillRule,
@@ -8,8 +8,7 @@ import (
func TestBuildInstructionTraceSummary(t *testing.T) {
got := buildInstructionTraceSummary(runtimeinstruction.AssemblySummary{
SectionTitles: []string{"项目级规则", "当前技能上下文"},
HasProjectRule: true,
SectionTitles: []string{"系统治理规则", "当前技能上下文"},
HasGovernanceRule: true,
HasAgentRule: true,
HasSkillRule: true,
@@ -19,7 +18,7 @@ func TestBuildInstructionTraceSummary(t *testing.T) {
if len(got.SectionTitles) != 2 {
t.Fatalf("unexpected section titles: %#v", got.SectionTitles)
}
if !got.HasProjectRule || !got.HasGovernanceRule || !got.HasAgentRule || !got.HasSkillRule {
if !got.HasGovernanceRule || !got.HasAgentRule || !got.HasSkillRule {
t.Fatalf("unexpected summary flags: %#v", got)
}
if got.HasToolRule {