@o-lang/olang 1.2.5 → 1.2.6
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 +43 -9
package/package.json
CHANGED
|
@@ -585,7 +585,7 @@ class RuntimeAPI {
|
|
|
585
585
|
break;
|
|
586
586
|
}
|
|
587
587
|
|
|
588
|
-
|
|
588
|
+
case 'action': {
|
|
589
589
|
// 🔒 Interpolate workflow variables first
|
|
590
590
|
let action = this._safeInterpolate(
|
|
591
591
|
step.actionRaw,
|
|
@@ -633,15 +633,49 @@ class RuntimeAPI {
|
|
|
633
633
|
const rawResult = await runResolvers(action);
|
|
634
634
|
const unwrapped = this._unwrapResolverResult(rawResult);
|
|
635
635
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
636
|
+
// 🔒 KERNEL-ENFORCED: Block LLM hallucinations BEFORE saving to context
|
|
637
|
+
// Detect LLM resolver by action pattern (comprehensive coverage)
|
|
638
|
+
const isLLMAction = action.toLowerCase().includes('groq') ||
|
|
639
|
+
action.toLowerCase().includes('openai') ||
|
|
640
|
+
action.toLowerCase().includes('anthropic') ||
|
|
641
|
+
action.toLowerCase().includes('claude') ||
|
|
642
|
+
action.toLowerCase().includes('gpt') ||
|
|
643
|
+
action.toLowerCase().includes('gemini') ||
|
|
644
|
+
action.toLowerCase().includes('google') ||
|
|
645
|
+
action.toLowerCase().includes('llama') ||
|
|
646
|
+
action.toLowerCase().includes('meta') ||
|
|
647
|
+
action.toLowerCase().includes('mistral') ||
|
|
648
|
+
action.toLowerCase().includes('mixtral') ||
|
|
649
|
+
action.toLowerCase().includes('cohere') ||
|
|
650
|
+
action.toLowerCase().includes('huggingface') ||
|
|
651
|
+
action.toLowerCase().includes('hugging-face') ||
|
|
652
|
+
action.toLowerCase().includes('together') ||
|
|
653
|
+
action.toLowerCase().includes('perplexity') ||
|
|
654
|
+
action.toLowerCase().includes('fireworks') ||
|
|
655
|
+
action.toLowerCase().includes('bedrock') ||
|
|
656
|
+
action.toLowerCase().includes('azure') ||
|
|
657
|
+
action.toLowerCase().includes('ollama') ||
|
|
658
|
+
action.toLowerCase().includes('replicate') ||
|
|
659
|
+
action.toLowerCase().includes('deepseek') ||
|
|
660
|
+
action.toLowerCase().includes('qwen') ||
|
|
661
|
+
action.toLowerCase().includes('falcon') ||
|
|
662
|
+
action.toLowerCase().includes('phi') ||
|
|
663
|
+
action.toLowerCase().includes('gemma') ||
|
|
664
|
+
action.toLowerCase().includes('stablelm') ||
|
|
665
|
+
action.toLowerCase().includes('yi') ||
|
|
666
|
+
action.toLowerCase().includes('dbrx') ||
|
|
667
|
+
action.toLowerCase().includes('command') ||
|
|
668
|
+
action.toLowerCase().includes('llm'); // Catch-all fallback
|
|
669
|
+
|
|
670
|
+
// Extract actual text from resolver output (your llm-groq returns { response: "...", ... })
|
|
671
|
+
const llmText = unwrapped?.response || // ✅ Primary field for @o-lang/llm-groq
|
|
672
|
+
unwrapped?.text ||
|
|
673
|
+
unwrapped?.content ||
|
|
674
|
+
unwrapped?.answer ||
|
|
675
|
+
(typeof unwrapped === 'string' ? unwrapped : null);
|
|
642
676
|
|
|
643
|
-
if (isLLMAction && typeof
|
|
644
|
-
const safetyCheck = this._validateLLMOutput(
|
|
677
|
+
if (isLLMAction && typeof llmText === 'string') {
|
|
678
|
+
const safetyCheck = this._validateLLMOutput(llmText, action);
|
|
645
679
|
if (!safetyCheck.passed) {
|
|
646
680
|
throw new Error(
|
|
647
681
|
`[O-Lang SAFETY] LLM hallucinated unauthorized capability:\n` +
|