MCPcopy Create free account
hub / github.com/Noumena-Network/code / parseXmlReason

Function parseXmlReason

src/utils/permissions/yoloClassifier.ts:592–598  ·  view source on GitHub ↗

* Parse XML reason: ... * Strips thinking content first to avoid matching tags inside reasoning.

(text: string)

Source from the content-addressed store, hash-verified

590 * Strips thinking content first to avoid matching tags inside reasoning.
591 */
592function parseXmlReason(text: string): string | null {
593 const matches = [
594 ...stripThinking(text).matchAll(/<reason>([\s\S]*?)<\/reason>/g),
595 ]
596 if (matches.length === 0) return null
597 return matches[0]![1]!.trim()
598}
599
600/**
601 * Parse XML thinking content: <thinking>...</thinking>

Callers 1

classifyYoloActionXmlFunction · 0.85

Calls 1

stripThinkingFunction · 0.85

Tested by

no test coverage detected