diff --git a/openhands/agenthub/codeact_agent/tools/str_replace_editor.py b/openhands/agenthub/codeact_agent/tools/str_replace_editor.py index d55b0d21c8..fc4999ece0 100644 --- a/openhands/agenthub/codeact_agent/tools/str_replace_editor.py +++ b/openhands/agenthub/codeact_agent/tools/str_replace_editor.py @@ -6,7 +6,10 @@ _DETAILED_STR_REPLACE_EDITOR_DESCRIPTION = """Custom editing tool for viewing, c * The `create` command cannot be used if the specified `path` already exists as a file * If a `command` generates a long output, it will be truncated and marked with `` * The `undo_edit` command will revert the last edit made to the file at `path` - +* All commands that include line numbers are 1-indexed +* The `insert` command will insert a string after a specific line number in the file. Note that if you want to insert a string at the start of the file (line 1), you should use `insert_line=0`, and it will inserted *after* 0, so it will be on line 1. +* The `view` command will show the file's contents in the indicated line number range, 1-indexed. +* The line numbers are added by the tool as an aid for you, they are not part of the file. Before using this tool: 1. Use the view tool to understand the file's contents and context @@ -17,6 +20,7 @@ When making edits: - Ensure the edit results in idiomatic, correct code - Do not leave the code in a broken state - Always use absolute file paths (starting with /) + - Do not add line numbers to the `new_str` or `old_str` parameters CRITICAL REQUIREMENTS FOR USING THIS TOOL: @@ -88,7 +92,7 @@ def create_str_replace_editor_tool( 'type': 'string', }, 'insert_line': { - 'description': 'Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.', + 'description': 'Required parameter of `insert` command. The `new_str` will be inserted AFTER the line number `insert_line` of `path`. 0 is an allowed value for this parameter because it means the line before the first line of the file.', 'type': 'integer', }, 'view_range': { diff --git a/poetry.lock b/poetry.lock index c7b6b7dff9..e9f07377b1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -2871,7 +2871,7 @@ grpcio = {version = ">=1.49.1,<2.0dev", optional = true, markers = "python_versi grpcio-status = {version = ">=1.49.1,<2.0.dev0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""} proto-plus = [ {version = ">=1.25.0,<2.0.0dev", markers = "python_version >= \"3.13\""}, - {version = ">=1.22.3,<2.0.0dev", markers = "python_version < \"3.13\""}, + {version = ">=1.22.3,<2.0.0dev"}, ] protobuf = ">=3.19.5,<3.20.0 || >3.20.0,<3.20.1 || >3.20.1,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4.21.3 || >4.21.3,<4.21.4 || >4.21.4,<4.21.5 || >4.21.5,<6.0.0.dev0" requests = ">=2.18.0,<3.0.0.dev0" @@ -6090,14 +6090,14 @@ voice-helpers = ["numpy (>=2.0.2)", "sounddevice (>=0.5.1)"] [[package]] name = "openhands-aci" -version = "0.2.12" +version = "0.2.13" description = "An Agent-Computer Interface (ACI) designed for software development agents OpenHands." optional = false python-versions = "<4.0,>=3.12" groups = ["main"] files = [ - {file = "openhands_aci-0.2.12-py3-none-any.whl", hash = "sha256:8e7ffbca65049c5c31c8360892695ac3db1af4d59705d7d42283c0c0925ca452"}, - {file = "openhands_aci-0.2.12.tar.gz", hash = "sha256:04500e1bb300ab4de2992c36c17f3234001655920424bdec3796e6fa5c706785"}, + {file = "openhands_aci-0.2.13-py3-none-any.whl", hash = "sha256:f95447b23b5b66dd8f6be6c112f25c4fbe8d916d4b178864fa2ffbc8522e4367"}, + {file = "openhands_aci-0.2.13.tar.gz", hash = "sha256:a34a73a5d2a5230a096578b71b98af2d2724e6ea47db6dec61b3f981e8cc3b38"}, ] [package.dependencies] @@ -8570,7 +8570,7 @@ description = "C version of reader, parser and emitter for ruamel.yaml derived f optional = false python-versions = ">=3.9" groups = ["main"] -markers = "python_version < \"3.13\" and platform_python_implementation == \"CPython\"" +markers = "platform_python_implementation == \"CPython\" and python_version == \"3.12\"" files = [ {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:11f891336688faf5156a36293a9c362bdc7c88f03a8a027c2c1d8e0bcde998e5"}, {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:a606ef75a60ecf3d924613892cc603b154178ee25abb3055db5062da811fd969"}, @@ -9962,7 +9962,7 @@ description = "A language and compiler for custom Deep Learning operations" optional = false python-versions = "*" groups = ["evaluation"] -markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version < \"3.13\"" +markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\" and python_version == \"3.12\"" files = [ {file = "triton-3.0.0-1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e1efef76935b2febc365bfadf74bcb65a6f959a9872e5bddf44cc9e0adce1e1a"}, {file = "triton-3.0.0-1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:5ce8520437c602fb633f1324cc3871c47bee3b67acf9756c1a66309b60e3216c"}, @@ -11249,4 +11249,4 @@ cffi = ["cffi (>=1.11)"] [metadata] lock-version = "2.1" python-versions = "^3.12,<3.14" -content-hash = "3289d4f57295bf215347f6c2ad766788e8530bb18708cb81851dcbbf809a4457" +content-hash = "e939bc50fd07aabf4d7bff3736ceba793a6490e6c68422233ac4ce7fe2bb302d" diff --git a/pyproject.toml b/pyproject.toml index e65d9a29db..b82c3e1e30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,7 @@ runloop-api-client = "0.32.0" libtmux = ">=0.37,<0.40" pygithub = "^2.5.0" joblib = "*" -openhands-aci = "0.2.12" +openhands-aci = "0.2.13" python-socketio = "^5.11.4" redis = "^5.2.0" sse-starlette = "^2.1.3" diff --git a/tests/runtime/test_aci_edit.py b/tests/runtime/test_aci_edit.py index 5a516d2031..d8a8417a28 100644 --- a/tests/runtime/test_aci_edit.py +++ b/tests/runtime/test_aci_edit.py @@ -437,7 +437,7 @@ def test_insert_invalid_line(temp_dir, runtime_cls, run_as_openhands): obs = runtime.run_action(action) logger.info(obs, extra={'msg_type': 'OBSERVATION'}) assert 'Invalid `insert_line` parameter' in obs.content - assert 'It should be within the range of lines of the file' in obs.content + assert 'It should be within the range of allowed values' in obs.content finally: _close_test_runtime(runtime)