fix(exec) fail close on invalid deny pattern (#781)

* fix(exec) fail close on invalid deny pattern

* fix: error check

* resolve conflicts
This commit is contained in:
Mauro authored and GitHub committed 2026-02-28 16:24:26 +08:00
1 parent 6c8866de6f
commit 172e6ebe5f
6 files changed
+77 -22

No files matched your search

+7 -1
View File
@@ -1,6 +1,7 @@
package agent
import (
"log"
"os"
"path/filepath"
"strings"
@@ -51,7 +52,12 @@ func NewAgentInstance(
toolsRegistry.Register(tools.NewReadFileTool(workspace, restrict))
toolsRegistry.Register(tools.NewWriteFileTool(workspace, restrict))
toolsRegistry.Register(tools.NewListDirTool(workspace, restrict))
toolsRegistry.Register(tools.NewExecToolWithConfig(workspace, restrict, cfg))
execTool, err := tools.NewExecToolWithConfig(workspace, restrict, cfg)
if err != nil {
log.Fatalf("Critical error: unable to initialize exec tool: %v", err)
}
toolsRegistry.Register(execTool)
toolsRegistry.Register(tools.NewEditFileTool(workspace, restrict))
toolsRegistry.Register(tools.NewAppendFileTool(workspace, restrict))