fix(confidence-engine): scope episode closure authority
This commit is contained in:
@@ -65,6 +65,45 @@ export function isUserConfirmationOfNoRemainingUncertainty(answer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ── Pure: decision-closure authority question predicate ───────────
|
||||
|
||||
/**
|
||||
* Determines whether a question explicitly asks the user whether any
|
||||
* material uncertainty remains at the parent-decision level — i.e. the
|
||||
* question grants closure authority when answered with confirmation.
|
||||
*
|
||||
* Bounded to the decision_threshold sufficiency-confirmation semantic family.
|
||||
* Focused questions (supplier, budget, etc.) do NOT match even if they
|
||||
* receive a confirming answer.
|
||||
*
|
||||
* Returns true only for:
|
||||
* - "Is there anything else material that could change which option is better?"
|
||||
* (the canonical product template)
|
||||
* - Questions using the closure-family pattern:
|
||||
* <remaining-uncertainty-phrase> + <closure-action-phrase>
|
||||
* (e.g. "remaining material uncertainty preventing this decision from being closed")
|
||||
*/
|
||||
export function isDecisionClosureAuthorityQuestion(question) {
|
||||
const text = String(question || "");
|
||||
const lower = text.toLowerCase();
|
||||
|
||||
// Direct match for the canonical decision_threshold sufficiency confirmation template
|
||||
if (/change which option (is |was )?better/i.test(lower)) return true;
|
||||
|
||||
// Closure-family pattern: "remaining-uncertainty" + "closure-action" conjunction
|
||||
const hasRemainingUncertainty = /any(?:thing)?\s+(?:else\s+)?(?:material\s+)?uncertain(?:ty|ces)/i.test(lower);
|
||||
if (!hasRemainingUncertainty) return false;
|
||||
|
||||
const hasClosureAction = /\b(closure|close[sd]?|resolve[d]?)\b/i.test(lower);
|
||||
if (hasClosureAction) return true;
|
||||
|
||||
// "remaining material uncertainty" + decision-referencing words
|
||||
const hasDecisionRef = /(?:decision|deciding|disposition)\b/i.test(lower);
|
||||
if (hasDecisionRef) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ── Pure: unresolved predicate ─────────────────────────────────
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user