Files
Agent-System/internal/intent/expectation_plan_test.go
T
WeiCHENandCursor 24478ec383 feat(intent): Phase 5 V2 shadow gray flags and IntentPlan execution
Add env-based feature flags (intent_v2_shadow/decision, multi_intent,
workflow_intents), V1/V2 shadow diff reporting, expectation_plus_new plan
building, ranked-frame L2 conflict gate, and coordinator sequential query
plan execution with confirm-step deferral.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00

53 lines
1.7 KiB
Go

package intent_test
import (
"context"
"testing"
"chat-agent-system/internal/bizdev"
"chat-agent-system/internal/intent"
)
func TestExpectationPlusNewPlan_AffirmAndQueryReg(t *testing.T) {
intent.SetFeatureFlagsForTest(intent.FeatureFlags{MultiIntentEnabled: true})
defer intent.ResetFeatureFlagsForTest()
rec := intent.NewRecognizer()
ctx := &intent.ContextSnapshot{
CurrentStage: string(bizdev.StageV01_Triage),
PendingExpectation: &intent.PendingExpectation{
ExpectedIntent: intent.IntentAdvanceStage,
AllowAffirmative: true,
DefaultOption: &intent.ExpectationOption{
OptionID: "1",
Title: "推进到 V0.5",
Intent: intent.IntentAdvanceStage,
Slots: map[string]string{intent.SlotTargetStage: "V0.5_feasibility"},
},
},
}
res, err := rec.Recognize(context.Background(), "好,请先查法规", ctx)
if err != nil {
t.Fatalf("recognize: %v", err)
}
if res.TopIntent.Intent != intent.IntentQueryRegulations {
t.Fatalf("expected QUERY_REGULATIONS top, got %s", res.TopIntent.Intent)
}
if res.IntentPlan == nil {
t.Fatal("expected intent_plan for expectation_plus_new")
}
if len(res.IntentPlan.Steps) != 2 {
t.Fatalf("expected 2 steps, got %d", len(res.IntentPlan.Steps))
}
if res.IntentFrameV2 == nil || res.IntentFrameV2.Relation != intent.RelationExpectationPlusNew {
t.Errorf("expected relation expectation_plus_new, got %+v", res.IntentFrameV2)
}
if res.IntentPlan.Steps[0].Frame.LegacyIntent != intent.IntentAdvanceStage {
t.Errorf("step1 want ADVANCE_STAGE got %s", res.IntentPlan.Steps[0].Frame.LegacyIntent)
}
if res.IntentPlan.Steps[1].Frame.LegacyIntent != intent.IntentQueryRegulations {
t.Errorf("step2 want QUERY_REGULATIONS got %s", res.IntentPlan.Steps[1].Frame.LegacyIntent)
}
}