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>
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
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
|
|
}
|