Skip to content

Commit 0df3670

Browse files
authored
Update __init__.py
1 parent 0684edf commit 0df3670

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

‎python_agent_harness/tools/__init__.py‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from .edit import Edit
1111
from .edit_mac import EditMac
1212
from .filesystem import GlobTool, Grep, Insert, Mkdir, Read, Write
13+
from .glob_mac import GlobMac
14+
from .grep_mac import GrepMac
1315
from .mcp import MCPTool, mcp_tools_from_manager, normalize_mcp_result
1416
from .planexit import PlanExit
1517
from .question import Question
@@ -25,8 +27,10 @@
2527
"Bash",
2628
"Edit",
2729
"EditMac",
30+
"GlobMac",
2831
"GlobTool",
2932
"Grep",
33+
"GrepMac",
3034
"Insert",
3135
"MCPTool",
3236
"Mkdir",
@@ -43,15 +47,18 @@
4347

4448
def default_registry() -> Registry:
4549
reg = Registry()
46-
# macOS's BSD patch rejects well-formed hunks that GNU patch accepts,
47-
# so macOS uses EditMac (pure-Python diff applier); Linux keeps the
48-
# patch-binary Edit. Both register under the name "Edit".
49-
edit_tool = EditMac() if sys.platform == "darwin" else Edit()
50+
# macOS lacks GNU `patch`, `tree`, and PCRE-enabled git — use
51+
# pure-Python / POSIX-compatible Mac variants that register under
52+
# the same tool names so callers are platform-independent.
53+
_mac = sys.platform == "darwin"
54+
edit_tool = EditMac() if _mac else Edit()
55+
glob_tool = GlobMac() if _mac else GlobTool()
56+
grep_tool = GrepMac() if _mac else Grep()
5057
for tool in (
5158
AgentTool(),
5259
TodoWrite(),
53-
GlobTool(),
54-
Grep(),
60+
glob_tool,
61+
grep_tool,
5562
Read(),
5663
Insert(),
5764
edit_tool,

0 commit comments

Comments
 (0)