Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
refactor: use unified get_media_dir() to get media path
Shiniese84c4ba7609ad
diff --git a/nanobot/agent/tools/filesystem.py b/nanobot/agent/tools/filesystem.pyindex a0e470fa9..e3a8fecaf 100644--- a/nanobot/agent/tools/filesystem.py+++ b/nanobot/agent/tools/filesystem.py@@ -7,6 +7,7 @@ from typing import Anyfrom nanobot.agent.tools.base import Toolfrom nanobot.utils.helpers import build_image_content_blocks, detect_image_mime+from nanobot.config.paths import get_media_dirdef _resolve_path(@@ -21,8 +22,7 @@ def _resolve_path(p = workspace / presolved = p.resolve()if allowed_dir:- from nanobot.config.paths import get_runtime_subdir- media_path = get_runtime_subdir("media").resolve()+ media_path = get_media_dir().resolve()all_dirs = [allowed_dir] + [media_path] + (extra_allowed_dirs or [])if not any(_is_under(resolved, d) for d in all_dirs):raise PermissionError(f"Path {path} is outside allowed directory {allowed_dir}")diff --git a/nanobot/agent/tools/shell.py b/nanobot/agent/tools/shell.pyindex 77803e8b3..c987a5f99 100644--- a/nanobot/agent/tools/shell.py+++ b/nanobot/agent/tools/shell.py@@ -10,6 +10,7 @@ from typing import Anyfrom loguru import loggerfrom nanobot.agent.tools.base import Tool+from nanobot.config.paths import get_media_dirclass ExecTool(Tool):@@ -184,9 +185,7 @@ class ExecTool(Tool):except Exception:continue- from nanobot.config.paths import get_runtime_subdir- media_path = get_runtime_subdir("media").resolve()-+ media_path = get_media_dir().resolve()if (p.is_absolute()and cwd_path not in p.parentsand p != cwd_path