diff --git a/codex-launcher_3.11.8_all.deb b/codex-launcher_3.11.8_all.deb index 126ad27..ca32847 100644 Binary files a/codex-launcher_3.11.8_all.deb and b/codex-launcher_3.11.8_all.deb differ diff --git a/src/translate-proxy.py b/src/translate-proxy.py index ecb13a2..4b740b6 100755 --- a/src/translate-proxy.py +++ b/src/translate-proxy.py @@ -2350,7 +2350,7 @@ def _normalize_tool_args(raw_args): except json.JSONDecodeError: return raw_args -_XML_TC_RE = re.compile(r'exec_command(.*?)', re.DOTALL) +_XML_TC_RE = re.compile(r'<(\w+)(?:_command)?>(.*?)', re.DOTALL) _XML_ARG_VALUE_RE = re.compile(r'\s*') _PAREN_TC_RE = re.compile( diff --git a/tests/test_translate_proxy.py b/tests/test_translate_proxy.py index b4fa828..42b72e2 100644 --- a/tests/test_translate_proxy.py +++ b/tests/test_translate_proxy.py @@ -6,6 +6,7 @@ Uses only stdlib unittest + unittest.mock (zero pip dependencies). """ import json +import os import sys import time import unittest @@ -19,7 +20,7 @@ import importlib _spec = importlib.util.spec_from_file_location( "translate_proxy", - r"C:\dev\Codex-Launcher---Any-AI-Porovider\src\translate-proxy.py", + os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "src", "translate-proxy.py"), ) tp = importlib.util.module_from_spec(_spec) _spec.loader.exec_module(tp) @@ -121,36 +122,33 @@ class TestExtractXmlToolCalls(unittest.TestCase): self.assertEqual(tp._extract_xml_tool_calls("just plain text"), []) def test_single_tool_call(self): - # Regex: (\w+)(.*?) - # Format: NAME>CONTENT - text = 'bash>echo hi' + text = 'echo hi' results = tp._extract_xml_tool_calls(text) self.assertEqual(len(results), 1) - self.assertEqual(results[0]["name"], "bash") + self.assertEqual(results[0]["name"], "exec_command") self.assertIn("call_id", results[0]) self.assertTrue(results[0]["call_id"].startswith("xml_")) def test_multiple_tool_calls(self): text = ( - 'bash>echo hi' - 'edit>test.py' + 'echo hi' + 'test.py' ) results = tp._extract_xml_tool_calls(text) self.assertEqual(len(results), 2) - self.assertEqual(results[0]["name"], "bash") - self.assertEqual(results[1]["name"], "edit") + self.assertEqual(results[0]["name"], "exec_command") + self.assertEqual(results[1]["name"], "exec_command") def test_json_args(self): - text = 'tool>{"key": "value"}' + text = '{"key": "value"}' results = tp._extract_xml_tool_calls(text) self.assertEqual(len(results), 1) - self.assertEqual(results[0]["name"], "tool") + self.assertEqual(results[0]["name"], "exec_command") args = json.loads(results[0]["args"]) - # JSON parsing of XML content may vary - just check result exists self.assertIn("args", results[0]) def test_code_fenced_args(self): - text = 'tool>{"a": 1}' + text = '{"a": 1}' results = tp._extract_xml_tool_calls(text) self.assertEqual(len(results), 1)