Add CLIRuntime implementation for local command execution (#8264)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
Co-authored-by: Engel Nyst <engel.nyst@gmail.com>
This commit is contained in:
Robert Brennan
2025-05-22 23:03:22 -04:00
committed by GitHub
parent f7cdf4720f
commit 50d4c79094
39 changed files with 1564 additions and 138 deletions

View File

@@ -32,7 +32,6 @@ from openhands.events.action import (
Action,
AgentFinishAction,
AgentThinkAction,
BrowseURLAction,
CmdRunAction,
FileReadAction,
MCPAction,
@@ -45,6 +44,9 @@ from openhands.events.tool import ToolCallMetadata
def grep_to_cmdrun(
pattern: str, path: str | None = None, include: str | None = None
) -> str:
# NOTE: This function currently relies on `rg` (ripgrep).
# `rg` may not be installed when using CLIRuntime or LocalRuntime.
# TODO: Implement a fallback to `grep` if `rg` is not available.
"""Convert grep tool arguments to a shell command string.
Args:
@@ -75,6 +77,9 @@ def grep_to_cmdrun(
def glob_to_cmdrun(pattern: str, path: str = '.') -> str:
# NOTE: This function currently relies on `rg` (ripgrep).
# `rg` may not be installed when using CLIRuntime or LocalRuntime
# TODO: Implement a fallback to `find` if `rg` is not available.
"""Convert glob tool arguments to a shell command string.
Args: