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
feat(tools): enhance ExecTool with enable flag and custom deny_patterns
angleyanalbedo746d7f5415b4
diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.pyindex ca9a06e4a..bf40214dd 100644--- a/nanobot/agent/loop.py+++ b/nanobot/agent/loop.py@@ -117,12 +117,14 @@ class AgentLoop:allowed_dir = self.workspace if self.restrict_to_workspace else Nonefor cls in (ReadFileTool, WriteFileTool, EditFileTool, ListDirTool):self.tools.register(cls(workspace=self.workspace, allowed_dir=allowed_dir))- self.tools.register(ExecTool(- working_dir=str(self.workspace),- timeout=self.exec_config.timeout,- restrict_to_workspace=self.restrict_to_workspace,- path_append=self.exec_config.path_append,- ))+ if self.exec_config.enable:+ self.tools.register(ExecTool(+ working_dir=str(self.workspace),+ timeout=self.exec_config.timeout,+ restrict_to_workspace=self.restrict_to_workspace,+ path_append=self.exec_config.path_append,+ deny_patterns=self.exec_config.deny_patterns,+ ))self.tools.register(WebSearchTool(api_key=self.brave_api_key, proxy=self.web_proxy))self.tools.register(WebFetchTool(proxy=self.web_proxy))self.tools.register(MessageTool(send_callback=self.bus.publish_outbound))diff --git a/nanobot/config/schema.py b/nanobot/config/schema.pyindex 8cfcad672..a1d6ed416 100644--- a/nanobot/config/schema.py+++ b/nanobot/config/schema.py@@ -305,9 +305,10 @@ class WebToolsConfig(Base):class ExecToolConfig(Base):"""Shell exec tool configuration."""+ enable: bool = Truetimeout: int = 60path_append: str = ""-+ deny_patterns: list[str] | None = Noneclass MCPServerConfig(Base):"""MCP server connection configuration (stdio or HTTP)."""