Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion astrbot/core/astr_agent_tool_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
FileUploadTool,
FileWriteTool,
GrepTool,
LocalExecuteShellTool,
LocalPythonTool,
PythonTool,
ShellSessionTool,
)
from astrbot.core.tools.message_tools import SendMessageToUserTool
from astrbot.core.utils.astrbot_path import get_astrbot_temp_path
Expand Down Expand Up @@ -224,14 +226,16 @@ def _get_runtime_computer_tools(
)
return tools
if runtime == "local":
shell_tool = tool_mgr.get_builtin_tool(ExecuteShellTool)
shell_tool = LocalExecuteShellTool()
shell_session_tool = tool_mgr.get_builtin_tool(ShellSessionTool)
python_tool = tool_mgr.get_builtin_tool(LocalPythonTool)
read_tool = tool_mgr.get_builtin_tool(FileReadTool)
write_tool = tool_mgr.get_builtin_tool(FileWriteTool)
edit_tool = tool_mgr.get_builtin_tool(FileEditTool)
grep_tool = tool_mgr.get_builtin_tool(GrepTool)
return {
shell_tool.name: shell_tool,
shell_session_tool.name: shell_session_tool,
python_tool.name: python_tool,
read_tool.name: read_tool,
write_tool.name: write_tool,
Expand Down
11 changes: 9 additions & 2 deletions astrbot/core/astr_main_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@
GrepTool,
ListSkillCandidatesTool,
ListSkillReleasesTool,
LocalExecuteShellTool,
LocalPythonTool,
PromoteSkillCandidateTool,
PythonTool,
RollbackSkillReleaseTool,
RunBrowserSkillTool,
ShellSessionTool,
SyncSkillReleaseTool,
)
from astrbot.core.tools.cron_tools import FutureTaskTool
Expand Down Expand Up @@ -430,7 +432,8 @@ def _apply_local_env_tools(req: ProviderRequest, plugin_context: Context) -> Non
if req.func_tool is None:
req.func_tool = ToolSet()
tool_mgr = plugin_context.get_llm_tool_manager()
req.func_tool.add_tool(tool_mgr.get_builtin_tool(ExecuteShellTool))
req.func_tool.add_tool(LocalExecuteShellTool())
req.func_tool.add_tool(tool_mgr.get_builtin_tool(ShellSessionTool))
req.func_tool.add_tool(tool_mgr.get_builtin_tool(LocalPythonTool))
req.func_tool.add_tool(tool_mgr.get_builtin_tool(FileReadTool))
req.func_tool.add_tool(tool_mgr.get_builtin_tool(FileWriteTool))
Expand All @@ -450,7 +453,11 @@ def _build_local_mode_prompt() -> str:
return (
"You have access to the host local environment and can execute shell commands and Python code. "
f"Current operating system: {system_name}. "
f"{shell_hint}"
f"{shell_hint} "
"Local shell commands automatically return a managed session when they "
"outlive the initial wait. Use `astrbot_shell_session` to list, poll, "
"write to, interrupt, or terminate those sessions. Do not add `&`, "
"`nohup`, or another detachment wrapper for ordinary long-running commands."
)


Expand Down
Loading
Loading