@o-lang/olang 1.2.37 → 1.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/runtime/RuntimeAPI.js +32 -16
package/package.json
CHANGED
|
@@ -870,28 +870,44 @@ _validateInputs(inputs) {
|
|
|
870
870
|
const isAfrican = ['yo', 'ig', 'ha', 'sw', 'zu', 'am', 'om', 'ff', 'so', 'sn'].includes(lang);
|
|
871
871
|
const isFinancial = ['transfer', 'payment', 'withdrawal', 'deposit', 'financial_action'].includes(capability);
|
|
872
872
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
873
|
+
// ✅ DECOUPLED: Check legal context via standardized signals (not UI fields)
|
|
874
|
+
const intent = this.context.__verified_intent || {};
|
|
875
|
+
const signals = intent.context_signals || {};
|
|
876
|
+
|
|
877
|
+
const isLegalContext =
|
|
878
|
+
// Signal 1: Explicit scope declaration
|
|
879
|
+
intent.scope === 'legal_analysis_only' ||
|
|
880
|
+
|
|
881
|
+
// Signal 2: Standardized context signals (server-mapped, UI-agnostic)
|
|
882
|
+
signals.isLegalDocument === true ||
|
|
883
|
+
signals.documentCategory === 'contract' ||
|
|
884
|
+
signals.documentCategory === 'nda' ||
|
|
885
|
+
signals.documentCategory === 'agreement' ||
|
|
886
|
+
signals.documentCategory === 'legal' ||
|
|
887
|
+
|
|
888
|
+
// Signal 3: Semantic fallback (works even if signals missing)
|
|
889
|
+
(typeof text === 'string' && /clause|term|agreement|contract|obligation|penalty|damages|breach|party|shall|herein/i.test(text));
|
|
880
890
|
|
|
881
891
|
// ✅ NEW: Check contextual allowlist if in legal context
|
|
882
892
|
if (isLegalContext && this.context.__verified_intent?.contextual_allowlist) {
|
|
883
893
|
const allowlist = this.context.__verified_intent.contextual_allowlist;
|
|
884
894
|
const triggerWord = match ? match[0].toLowerCase() : '';
|
|
885
895
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
896
|
+
// Inside the contextual allowlist check in _validateInputs:
|
|
897
|
+
const allowed = allowlist.some(rule => {
|
|
898
|
+
// Check if this pattern's capability matches the rule's trigger
|
|
899
|
+
const triggerMatch =
|
|
900
|
+
triggerWord.includes(rule.trigger.toLowerCase()) ||
|
|
901
|
+
capability.toLowerCase().includes(rule.trigger.toLowerCase()); // ← Handle capability-level triggers
|
|
902
|
+
|
|
903
|
+
if (triggerMatch) {
|
|
904
|
+
// Check if required legal keywords are present
|
|
905
|
+
return rule.requires.some(keyword =>
|
|
906
|
+
text.toLowerCase().includes(keyword.toLowerCase())
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
return false;
|
|
910
|
+
});
|
|
895
911
|
|
|
896
912
|
if (allowed) {
|
|
897
913
|
// ✅ AUDIT LOG: Contextual allowlist bypass
|