The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(cli): reuse storage tool-call strip patterns in _strip_reasoning_tags
kshitijk4poor41c17d9b5e12
diff --git a/hermes_cli/cli_render.py b/hermes_cli/cli_render.pyindex aacff161fd2..0a0bf3b5ac4 100644--- a/hermes_cli/cli_render.py+++ b/hermes_cli/cli_render.py@@ -59,21 +59,10 @@ def _strip_reasoning_tags(text: str) -> str:r'(?:(?<=^)|(?<=[\n\r.!?:]))[ \t]*<function\b[^>]*\bname\s*=[^>]*>(?:(?:(?!</function>).)*)</function>\s*','', cleaned, flags=re.DOTALL | re.IGNORECASE,)- cleaned = re.sub(- r'</(?:(?:[\w.-]+:)?(?:tool_call|tool_calls|tool_result|function_call|function_calls|function))>\s*', '', cleaned,- flags=re.IGNORECASE,- )- # Unclosed calls are unrecoverable (#101899), but stray argument markup- # only identifies fragment lines (#102303). Keep inline prose and later- # lines while still removing a line-ending fragment like wait</arg_value>.- cleaned = re.sub(- r'(?:^|\n)[ \t]*<(?:[\w.-]+:)?(?:tool_call|tool_calls|tool_result|function_call|function_calls)\b[^>]*>.*$'- r'|(?:^|\n)[ \t]*</?arg_(?:key|value)\b[^\n]*'- r'|(?:^|\n)[^\n<]*</arg_(?:key|value)>[ \t\r]*(?=\n|$)',- '',- cleaned,- flags=re.DOTALL | re.IGNORECASE,- )+ # Stray closers and cut tool-call fragments share storage's compiled patterns (#101899, #102303).+ from agent.agent_runtime_helpers import _STRAY_TOOL_CALL_CLOSER_PATTERN, _UNTERMINATED_TOOL_CALL_PATTERN+ cleaned = _STRAY_TOOL_CALL_CLOSER_PATTERN.sub('', cleaned)+ cleaned = _UNTERMINATED_TOOL_CALL_PATTERN.sub('', cleaned)return cleaned.strip()