package intent // ResolveEffectiveIntent 灰度期解析有效路由意图(intent_v2_decision 开启且档位允许时使用 V2 帧) func ResolveEffectiveIntent(res *IntentRecognitionResult) IntentType { if res == nil || res.TopIntent == nil { return IntentCasualChat } flags := CurrentFeatureFlags() if !flags.IntentV2Decision || res.IntentFrameV2 == nil { return res.TopIntent.Intent } if res.V2Shadow != nil && !res.V2Shadow.DecisionEligible { return res.TopIntent.Intent } v2Intent := res.IntentFrameV2.LegacyIntent if v2Intent == "" { v2Intent = LegacyIntentFromFrame(res.IntentFrameV2) } if v2Intent == "" { return res.TopIntent.Intent } return v2Intent } // RankedFrameConflictRequiresClarification L2 二次门禁:RankedFrames 存在写/读冲突时强制澄清 func RankedFrameConflictRequiresClarification(res *IntentRecognitionResult) bool { if res == nil || res.RankedFrames == nil { return false } flags := CurrentFeatureFlags() if !flags.IntentV2Decision { return false } for _, c := range res.RankedFrames.Conflicts { if c.Kind == "write_vs_query" { return true } } return false }