Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

import git, add terminal state

yzlind8c2d1c70778
diff --git a/metagpt/tools/libs/__init__.py b/metagpt/tools/libs/__init__.py
index f21307724..f2ae30f03 100644
--- a/metagpt/tools/libs/__init__.py
+++ b/metagpt/tools/libs/__init__.py
@@ -15,6 +15,7 @@ from metagpt.tools.libs import (
file_manager,
browser,
deployer,
+ git,
)
from metagpt.tools.libs.env import get_env, set_get_env_entry, default_get_env, get_env_description
@@ -29,6 +30,7 @@ _ = (
file_manager,
browser,
deployer,
+ git,
get_env,
get_env_description,
set_get_env_entry,
diff --git a/metagpt/tools/libs/git.py b/metagpt/tools/libs/git.py
index ac9e68bd8..ac9713f01 100644
--- a/metagpt/tools/libs/git.py
+++ b/metagpt/tools/libs/git.py
@@ -12,7 +12,7 @@ from metagpt.tools.tool_registry import register_tool
from metagpt.utils.git_repository import GitRepository
-@register_tool(tags=["git"])
+# @register_tool(tags=["git"])
async def git_clone(url: str, output_dir: str | Path = None) -> Path:
"""
Clones a Git repository from the given URL.
diff --git a/metagpt/tools/libs/terminal.py b/metagpt/tools/libs/terminal.py
index dc395e89b..845de8a09 100644
--- a/metagpt/tools/libs/terminal.py
+++ b/metagpt/tools/libs/terminal.py
@@ -28,10 +28,16 @@ class Terminal:
stderr=subprocess.STDOUT,
text=True,
bufsize=1, # Line buffered
- executable="/bin/bash"
+ executable="/bin/bash",
)
self.stdout_queue = Queue()
+ self._check_state()
+
+ def _check_state(self):
+ """Check the state of the terminal, e.g. the current directory of the terminal process. Useful for agent to understand."""
+ print("The terminal is at:", self.run_command("pwd"))
+
def run_command(self, cmd: str, daemon=False) -> str:
"""
Executes a specified command in the terminal and streams the output back in real time.