openhands-tools 1.49.6__tar.gz → 1.50.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/PKG-INFO +2 -2
  2. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/delegate/impl.py +3 -0
  3. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/editor.py +13 -0
  4. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/encoding.py +73 -0
  5. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/task/manager.py +4 -0
  6. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands_tools.egg-info/PKG-INFO +2 -2
  7. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands_tools.egg-info/requires.txt +1 -1
  8. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/pyproject.toml +2 -2
  9. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/__init__.py +0 -0
  10. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/apply_patch/__init__.py +0 -0
  11. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/apply_patch/core.py +0 -0
  12. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/apply_patch/definition.py +0 -0
  13. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/ask_oracle/__init__.py +0 -0
  14. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/ask_oracle/definition.py +0 -0
  15. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/ask_oracle/impl.py +0 -0
  16. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/browser_use/__init__.py +0 -0
  17. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/browser_use/definition.py +0 -0
  18. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/browser_use/event_storage.py +0 -0
  19. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/browser_use/impl.py +0 -0
  20. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/browser_use/logging_fix.py +0 -0
  21. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/browser_use/recording.py +0 -0
  22. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/browser_use/server.py +0 -0
  23. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/delegate/__init__.py +0 -0
  24. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/delegate/definition.py +0 -0
  25. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/delegate/visualizer.py +0 -0
  26. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/__init__.py +0 -0
  27. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/definition.py +0 -0
  28. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/exceptions.py +0 -0
  29. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/impl.py +0 -0
  30. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/__init__.py +0 -0
  31. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/config.py +0 -0
  32. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/constants.py +0 -0
  33. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/diff.py +0 -0
  34. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/file_cache.py +0 -0
  35. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/history.py +0 -0
  36. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/file_editor/utils/shell.py +0 -0
  37. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/__init__.py +0 -0
  38. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/edit/__init__.py +0 -0
  39. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/edit/definition.py +0 -0
  40. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/edit/impl.py +0 -0
  41. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/file_change.py +0 -0
  42. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/list_directory/__init__.py +0 -0
  43. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/list_directory/definition.py +0 -0
  44. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/list_directory/impl.py +0 -0
  45. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/read_file/__init__.py +0 -0
  46. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/read_file/definition.py +0 -0
  47. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/read_file/impl.py +0 -0
  48. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/write_file/__init__.py +0 -0
  49. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/write_file/definition.py +0 -0
  50. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/gemini/write_file/impl.py +0 -0
  51. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/glob/__init__.py +0 -0
  52. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/glob/definition.py +0 -0
  53. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/glob/impl.py +0 -0
  54. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/grep/__init__.py +0 -0
  55. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/grep/definition.py +0 -0
  56. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/grep/impl.py +0 -0
  57. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/planning_file_editor/__init__.py +0 -0
  58. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/planning_file_editor/definition.py +0 -0
  59. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/planning_file_editor/impl.py +0 -0
  60. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/__init__.py +0 -0
  61. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/default.py +0 -0
  62. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/gemini.py +0 -0
  63. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/gpt5.py +0 -0
  64. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/planning.py +0 -0
  65. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/subagents/bash_runner.md +0 -0
  66. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/subagents/code_explorer.md +0 -0
  67. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/subagents/default.md +0 -0
  68. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/subagents/web_researcher.md +0 -0
  69. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/preset/task_outcome.py +0 -0
  70. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/py.typed +0 -0
  71. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/task/__init__.py +0 -0
  72. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/task/definition.py +0 -0
  73. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/task/impl.py +0 -0
  74. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/task_tracker/__init__.py +0 -0
  75. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/task_tracker/definition.py +0 -0
  76. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/__init__.py +0 -0
  77. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/constants.py +0 -0
  78. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/definition.py +0 -0
  79. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/descriptions.py +0 -0
  80. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/env.py +0 -0
  81. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/impl.py +0 -0
  82. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/metadata.py +0 -0
  83. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/__init__.py +0 -0
  84. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/factory.py +0 -0
  85. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/interface.py +0 -0
  86. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/subprocess_terminal.py +0 -0
  87. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/terminal_session.py +0 -0
  88. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/tmux_pane_pool.py +0 -0
  89. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/tmux_terminal.py +0 -0
  90. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/terminal/windows_terminal.py +0 -0
  91. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/timeout_policy.py +0 -0
  92. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/utils/__init__.py +0 -0
  93. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/utils/command.py +0 -0
  94. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/terminal/utils/escape_filter.py +0 -0
  95. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/tom_consult/__init__.py +0 -0
  96. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/tom_consult/definition.py +0 -0
  97. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/tom_consult/executor.py +0 -0
  98. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/utils/__init__.py +0 -0
  99. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/utils/timeout.py +0 -0
  100. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/workflow/__init__.py +0 -0
  101. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/workflow/definition.py +0 -0
  102. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands/tools/workflow/impl.py +0 -0
  103. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands_tools.egg-info/SOURCES.txt +0 -0
  104. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands_tools.egg-info/dependency_links.txt +0 -0
  105. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/openhands_tools.egg-info/top_level.txt +0 -0
  106. {openhands_tools-1.49.6 → openhands_tools-1.50.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-tools
3
- Version: 1.49.6
3
+ Version: 1.50.1
4
4
  Summary: OpenHands Tools - Runtime tools for AI agents
5
5
  Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
6
  Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
@@ -10,7 +10,7 @@ Requires-Python: >=3.12
10
10
  Requires-Dist: openhands-sdk
11
11
  Requires-Dist: tree-sitter>=0.24
12
12
  Requires-Dist: tree-sitter-bash>=0.23
13
- Requires-Dist: binaryornot>=0.4.4
13
+ Requires-Dist: binaryornot>=0.6.0
14
14
  Requires-Dist: cachetools
15
15
  Requires-Dist: libtmux>=0.53.0
16
16
  Requires-Dist: pydantic>=2.11.7
@@ -220,6 +220,9 @@ class DelegateExecutor(ToolExecutor):
220
220
  "visualizer": sub_visualizer,
221
221
  "hook_config": factory.definition.hooks,
222
222
  "persistence_dir": subagents_persistence_dir,
223
+ "_parent_llm_call_context": (
224
+ parent_conversation.get_llm_call_context()
225
+ ),
223
226
  }
224
227
 
225
228
  if factory.definition.max_iteration_per_run is not None:
@@ -722,6 +722,12 @@ class FileEditor:
722
722
  # Check file type - allow image files
723
723
  file_extension = path.suffix.lower()
724
724
  if is_binary(str(path)) and file_extension not in IMAGE_EXTENSIONS:
725
+ # binaryornot samples only the first chunk, so a non-UTF-8 (e.g.
726
+ # cp1251) or non-ASCII text file can be misclassified as binary.
727
+ # Decode the whole file with the encoding the editor will use and
728
+ # accept it if it is clean text.
729
+ if self._is_decodable_text(path):
730
+ return
725
731
  raise FileValidationError(
726
732
  path=str(path),
727
733
  reason=(
@@ -730,6 +736,13 @@ class FileEditor:
730
736
  ),
731
737
  )
732
738
 
739
+ def _is_decodable_text(self, path: Path) -> bool:
740
+ """Return True if the file decodes as clean text in a known encoding.
741
+
742
+ Used to override binaryornot misclassification of non-UTF-8 text files.
743
+ """
744
+ return self._encoding_manager.resolve_text_encoding(path) is not None
745
+
733
746
  @with_encoding
734
747
  def read_file(
735
748
  self,
@@ -3,6 +3,7 @@
3
3
  import functools
4
4
  import inspect
5
5
  import os
6
+ import re
6
7
  from pathlib import Path
7
8
  from typing import TYPE_CHECKING
8
9
 
@@ -14,6 +15,26 @@ if TYPE_CHECKING:
14
15
  from openhands.tools.file_editor.impl import FileEditor
15
16
 
16
17
 
18
+ # Control bytes that never appear in ordinary text files.
19
+ BINARY_CONTROL_CHARS = re.compile(r"[\x00-\x08\x0e-\x1f\x7f]")
20
+
21
+ # Candidate codecs for whole-file decoding when the detector cannot resolve a
22
+ # file's encoding. Short non-UTF-8 files fall below the detector's confidence
23
+ # threshold and are reported as the default encoding, so the detected value
24
+ # alone is not enough to recover them. Ordered most to least likely for source
25
+ # files; the detector's own guess is tried first when it is one of these.
26
+ TEXT_DECODE_CANDIDATES = ("utf-8", "cp1252", "latin-1", "cp1251")
27
+
28
+ # charset_normalizer reports some codecs under IANA names; map them to the
29
+ # Python codec names used above so their guesses decode correctly.
30
+ TEXT_DECODE_ALIASES = {
31
+ "windows-1251": "cp1251",
32
+ "windows-1252": "cp1252",
33
+ "iso-8859-1": "latin-1",
34
+ "iso-8859-15": "latin-1",
35
+ }
36
+
37
+
17
38
  class EncodingManager:
18
39
  """Manages file encodings across multiple operations to ensure consistency."""
19
40
 
@@ -70,6 +91,50 @@ class EncodingManager:
70
91
 
71
92
  return encoding
72
93
 
94
+ def _best_guess_encoding(self, path: Path) -> str | None:
95
+ """Return charset_normalizer's guess when it is a codec we trust.
96
+
97
+ Short non-UTF-8 files score below ``confidence_threshold`` even when
98
+ the guess is correct, so the raw guess is worth trying — but only when
99
+ it names a common codec, since the detector also proposes exotic
100
+ candidates (e.g. cp1006 for latin-1 text) that decode to mojibake.
101
+ """
102
+ try:
103
+ sample_size = min(os.path.getsize(path), 1024 * 1024)
104
+ with open(path, "rb") as f:
105
+ raw_data = f.read(sample_size)
106
+ except OSError:
107
+ return None
108
+ guess = charset_normalizer.detect(raw_data) or {}
109
+ encoding = guess.get("encoding")
110
+ if not encoding:
111
+ return None
112
+ normalized = str(encoding).lower().replace("_", "-")
113
+ if normalized in TEXT_DECODE_ALIASES:
114
+ return TEXT_DECODE_ALIASES[normalized]
115
+ return normalized if normalized in TEXT_DECODE_CANDIDATES else None
116
+
117
+ def _recover_encoding(self, path: Path) -> str | None:
118
+ """Return a codec that decodes ``path`` to control-byte-free text."""
119
+ candidates = (self._best_guess_encoding(path), *TEXT_DECODE_CANDIDATES)
120
+ for candidate in dict.fromkeys(c for c in candidates if c):
121
+ try:
122
+ text = path.read_text(encoding=candidate)
123
+ except (OSError, UnicodeDecodeError, LookupError):
124
+ continue
125
+ if BINARY_CONTROL_CHARS.search(text) is None:
126
+ return candidate
127
+ return None
128
+
129
+ def resolve_text_encoding(self, path: Path) -> str | None:
130
+ """Return an encoding that decodes ``path`` to clean text, else None."""
131
+ encoding = self.get_encoding(path)
132
+ try:
133
+ text = path.read_text(encoding=encoding)
134
+ except (UnicodeDecodeError, LookupError):
135
+ return None
136
+ return encoding if BINARY_CONTROL_CHARS.search(text) is None else None
137
+
73
138
  def get_encoding(self, path: Path) -> str:
74
139
  """Get encoding for a file, using cache or detecting if necessary.
75
140
  Args:
@@ -94,6 +159,14 @@ class EncodingManager:
94
159
  # No valid cache entry, detect encoding
95
160
  encoding = self.detect_encoding(path)
96
161
 
162
+ # The detector reports the default encoding for short non-UTF-8 files
163
+ # that fall below its confidence threshold. Recover a decodable
164
+ # encoding so reads and validation agree on the same codec.
165
+ if encoding == self.default_encoding:
166
+ recovered = self._recover_encoding(path)
167
+ if recovered is not None:
168
+ encoding = recovered
169
+
97
170
  # Cache the result with current modification time
98
171
  self._encoding_cache[path_str] = (encoding, current_mtime)
99
172
  return encoding
@@ -219,6 +219,9 @@ class TaskManager:
219
219
  persistence_dir=self._persistence_dir,
220
220
  conversation_id=conversation_id,
221
221
  hook_config=factory.definition.hooks,
222
+ _parent_llm_call_context=(
223
+ self.parent_conversation.get_llm_call_context()
224
+ ),
222
225
  delete_on_close=True,
223
226
  observability_metadata=self._delegate_observability_metadata(
224
227
  task_id=resume, subagent_type=subagent_type, link=link
@@ -321,6 +324,7 @@ class TaskManager:
321
324
  max_iteration_per_run=max_iteration_per_run,
322
325
  max_budget_per_run=max_budget_per_run,
323
326
  hook_config=hook_config,
327
+ _parent_llm_call_context=parent.get_llm_call_context(),
324
328
  delete_on_close=True,
325
329
  prompt_cache_key=str(parent.state.id),
326
330
  observability_metadata=self._delegate_observability_metadata(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-tools
3
- Version: 1.49.6
3
+ Version: 1.50.1
4
4
  Summary: OpenHands Tools - Runtime tools for AI agents
5
5
  Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
6
  Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
@@ -10,7 +10,7 @@ Requires-Python: >=3.12
10
10
  Requires-Dist: openhands-sdk
11
11
  Requires-Dist: tree-sitter>=0.24
12
12
  Requires-Dist: tree-sitter-bash>=0.23
13
- Requires-Dist: binaryornot>=0.4.4
13
+ Requires-Dist: binaryornot>=0.6.0
14
14
  Requires-Dist: cachetools
15
15
  Requires-Dist: libtmux>=0.53.0
16
16
  Requires-Dist: pydantic>=2.11.7
@@ -1,7 +1,7 @@
1
1
  openhands-sdk
2
2
  tree-sitter>=0.24
3
3
  tree-sitter-bash>=0.23
4
- binaryornot>=0.4.4
4
+ binaryornot>=0.6.0
5
5
  cachetools
6
6
  libtmux>=0.53.0
7
7
  pydantic>=2.11.7
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "openhands-tools"
3
- version = "1.49.6"
3
+ version = "1.50.1"
4
4
  description = "OpenHands Tools - Runtime tools for AI agents"
5
5
 
6
6
  requires-python = ">=3.12"
@@ -8,7 +8,7 @@ dependencies = [
8
8
  "openhands-sdk",
9
9
  "tree-sitter>=0.24",
10
10
  "tree-sitter-bash>=0.23",
11
- "binaryornot>=0.4.4",
11
+ "binaryornot>=0.6.0",
12
12
  "cachetools",
13
13
  "libtmux>=0.53.0",
14
14
  "pydantic>=2.11.7",