π OpenHands: AI-Driven Development
Upgrade `openhands-aci` to v0.1.2 (#5397)
Ryan H. Tranc5117bc48d85
diff --git a/openhands/runtime/action_execution_server.py b/openhands/runtime/action_execution_server.pyindex b48a9b55a6..26b728284e 100644--- a/openhands/runtime/action_execution_server.py+++ b/openhands/runtime/action_execution_server.py@@ -9,8 +9,10 @@ import argparseimport asyncioimport base64import io+import jsonimport mimetypesimport os+import reimport shutilimport tempfileimport time@@ -199,6 +201,26 @@ class ActionExecutor:obs: IPythonRunCellObservation = await _jupyter_plugin.run(action)obs.content = obs.content.rstrip()+ matches = re.findall(+ r'<oh_aci_output>(.*?)</oh_aci_output>', obs.content, re.DOTALL+ )+ if matches:+ results = []+ for match in matches:+ try:+ result_dict = json.loads(match)+ results.append(+ result_dict.get('formatted_output_and_error', '')+ )+ except json.JSONDecodeError:+ # Handle JSON decoding errors if necessary+ results.append(+ f"Invalid JSON in 'openhands-aci' output: {match}"+ )++ # Combine the results (e.g., join them) or handle them as required+ obs.content = '\n'.join(results)+if action.include_extra:obs.content += (f'\n[Jupyter current working directory: {self.bash_session.pwd}]'diff --git a/poetry.lock b/poetry.lockindex 5eb49683b9..03b64cee12 100644--- a/poetry.lock+++ b/poetry.lock@@ -1,4 +1,4 @@-# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.+# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand.[[package]]name = "aenum"@@ -5483,13 +5483,13 @@ numpy = {version = ">=1.26.0", markers = "python_version >= \"3.12\""}[[package]]name = "openhands-aci"-version = "0.1.1"+version = "0.1.2"description = "An Agent-Computer Interface (ACI) designed for software development agents OpenHands."optional = falsepython-versions = "<4.0,>=3.12"files = [- {file = "openhands_aci-0.1.1-py3-none-any.whl", hash = "sha256:8831f97b887571005dca0d70a9f6f0a4f9feb35d3d41f499e70d72b5fb68a599"},- {file = "openhands_aci-0.1.1.tar.gz", hash = "sha256:705b74a12a8f428e64295b5de125f553500f62ef5ab3a5a6284d8fcf638025e6"},+ {file = "openhands_aci-0.1.2-py3-none-any.whl", hash = "sha256:a2fcae7a2f1047d516d6862742c7a2f8ea988c6a58295599bc305c99b8d53067"},+ {file = "openhands_aci-0.1.2.tar.gz", hash = "sha256:c3c91aa3f13554159168b44a7f86bf333da30067fa6370a46ed785bf4240631b"},][package.dependencies]@@ -10087,4 +10087,4 @@ testing = ["coverage[toml]", "zope.event", "zope.testing"][metadata]lock-version = "2.0"python-versions = "^3.12"-content-hash = "56a80082afb76e518239060855598921d94a0373123b2d9222cf8c7b6238b7ad"+content-hash = "1b42dcc42b1dae014b1951246781a850c95ce2d6fdaab45f8b62f5a04ebd5e53"diff --git a/pyproject.toml b/pyproject.tomlindex a098aa81a6..576c27d6dc 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -64,7 +64,7 @@ modal = "^0.66.26"runloop-api-client = "0.10.0"pygithub = "^2.5.0"joblib = "*"-openhands-aci = "^0.1.1"+openhands-aci = "^0.1.2"python-socketio = "^5.11.4"redis = "^5.2.0"diff --git a/tests/unit/test_agent_skill.py b/tests/unit/test_agent_skill.pyindex 6079eb659a..63745f4dd2 100644--- a/tests/unit/test_agent_skill.py+++ b/tests/unit/test_agent_skill.py@@ -715,87 +715,3 @@ def test_parse_pptx(tmp_path):'Hello, this is the second test PPTX slide.\n\n')assert output == expected_output, f'Expected output does not match. Got: {output}'---# =============================================================================---def test_file_editor_view(tmp_path):- # generate a random directory- random_dir = tmp_path / 'dir_1'- random_dir.mkdir()- # create a file in the directory- random_file = random_dir / 'a.txt'- random_file.write_text('Line 1\nLine 2\nLine 3\nLine 4\nLine 5')- random_dir_2 = tmp_path / 'dir_2'- random_dir_2.mkdir()- random_file_2 = random_dir_2 / 'b.txt'- random_file_2.write_text('Line 1\nLine 2\nLine 3\nLine 4\nLine 5')-- from openhands.runtime.plugins.agent_skills.agentskills import file_editor-- # view the file- result = file_editor(command='view', path=str(random_file))- print('\n', result)- assert result is not None- assert (- result.split('\n')- == f"""Here's the result of running `cat -n` on {random_file}:- 1\tLine 1- 2\tLine 2- 3\tLine 3- 4\tLine 4- 5\tLine 5-""".split('\n')- )-- # view the directory- result = file_editor(command='view', path=str(tmp_path))- print('\n', result)- assert result is not None- assert (- result.strip().split('\n')- == f"""Here's the files and directories up to 2 levels deep in {tmp_path}, excluding hidden items:-{tmp_path}-{tmp_path}/dir_2-{tmp_path}/dir_2/b.txt-{tmp_path}/dir_1-{tmp_path}/dir_1/a.txt-""".strip().split('\n')- )---def test_file_editor_create(tmp_path):- # generate a random directory- random_dir = tmp_path / 'dir_1'- random_dir.mkdir()- # create a file in the directory- random_file = random_dir / 'a.txt'-- from openhands.runtime.plugins.agent_skills.agentskills import file_editor-- # view an unexist file- result = file_editor(command='view', path=str(random_file))- print(result)- assert result is not None- assert (- result- == f'ERROR:\nInvalid `path` parameter: {random_file}. The path {random_file} does not exist. Please provide a valid path.'- )-- # create a file- result = file_editor(command='create', path=str(random_file), file_text='Line 6')- print(result)- assert result is not None- assert result == f'File created successfully at: {random_file}'-- # view again- result = file_editor(command='view', path=str(random_file))- print(result)- assert result is not None- assert (- result.strip().split('\n')- == f"""Here's the result of running `cat -n` on {random_file}:- 1\tLine 6-""".strip().split('\n')- )