Accept structured bridge decision context
This commit is contained in:
@@ -825,6 +825,20 @@ function contextGuardrailText(value = '') {
|
||||
return cleanMultiline(obj.summary || obj.description || obj.notes || obj.brief || obj.text || '', 3000);
|
||||
}
|
||||
|
||||
function decisionContextFrom(source = {}) {
|
||||
const obj = objectFrom(source);
|
||||
return objectFrom(
|
||||
obj.decisionContext
|
||||
|| obj.decision_context
|
||||
|| obj.rankerContext
|
||||
|| obj.ranker_context
|
||||
|| obj.handoffContext
|
||||
|| obj.handoff_context
|
||||
|| obj.bridgeContext
|
||||
|| obj.bridge_context
|
||||
);
|
||||
}
|
||||
|
||||
function guardrailTextItems(value = [], maxItems = 8) {
|
||||
return cleanFlexibleTextList(value, maxItems, 260).filter(item => /\b(avoid|no|do not|don't|dont|must not|never|non-goal|non goal|not yet|out of scope|defer|hold for later|set aside|probably noise|park|do not let this become|don't let this become|not a dashboard|dashboard swamp)\b/i.test(item));
|
||||
}
|
||||
@@ -862,13 +876,19 @@ function cleanDecisionContext(input = {}) {
|
||||
const constraintsLens = conceptMapLenses.constraints || conceptMapLenses.boundaries || conceptMapLenses.scope;
|
||||
const assumptionsLens = conceptMapLenses.assumptions || conceptMapLenses.unknowns || conceptMapLenses.openQuestions;
|
||||
const structuredContext = objectFrom(input.context);
|
||||
const envelopeContext = decisionContextFrom(envelope);
|
||||
const featureSetContext = decisionContextFrom(featureSet);
|
||||
const artifactContext = decisionContextFrom(artifact);
|
||||
const conceptMapContext = decisionContextFrom(conceptMap);
|
||||
const snapshotContext = decisionContextFrom(snapshot);
|
||||
const inputDecisionContext = decisionContextFrom(input);
|
||||
const contextSources = [
|
||||
input.decisionContext,
|
||||
envelope.decisionContext,
|
||||
featureSet.decisionContext,
|
||||
artifact.decisionContext,
|
||||
conceptMap.decisionContext,
|
||||
snapshot.decisionContext,
|
||||
inputDecisionContext,
|
||||
envelopeContext,
|
||||
featureSetContext,
|
||||
artifactContext,
|
||||
conceptMapContext,
|
||||
snapshotContext,
|
||||
structuredContext,
|
||||
envelope.context,
|
||||
conceptMap.context,
|
||||
@@ -878,6 +898,12 @@ function cleanDecisionContext(input = {}) {
|
||||
];
|
||||
const textContextGuardrails = guardrailsFromContextText([
|
||||
contextGuardrailText(input.context || ''),
|
||||
contextGuardrailText(inputDecisionContext),
|
||||
contextGuardrailText(envelopeContext),
|
||||
contextGuardrailText(featureSetContext),
|
||||
contextGuardrailText(artifactContext),
|
||||
contextGuardrailText(conceptMapContext),
|
||||
contextGuardrailText(snapshotContext),
|
||||
contextGuardrailText(envelope.context || ''),
|
||||
contextGuardrailText(featureSet.context || ''),
|
||||
contextGuardrailText(artifact.context || ''),
|
||||
|
||||
Reference in New Issue
Block a user