From 26377702d335261fb5e307038e0f829ab9a42fb1 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 14 Mar 2026 16:34:58 +0300 Subject: Fix: view_img, exec commands --- tools.go | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'tools.go') diff --git a/tools.go b/tools.go index 1a2f095..ad245a2 100644 --- a/tools.go +++ b/tools.go @@ -518,9 +518,18 @@ func runCmd(args map[string]string) []byte { case "capture_and_view", "screenshot_and_view": // capture and view screenshot return captureWindowAndView(args) + case "view_img": + // view_img - view image for multimodal + return []byte(tools.FsViewImg(rest, "")) case "browser": // browser [args...] - Playwright browser automation return runBrowserCommand(rest, args) + case "mkdir", "ls", "cat", "pwd", "cd", "cp", "mv", "rm", "sed", "grep", "head", "tail", "wc", "sort", "uniq", "echo", "time", "stat", "go", "find", "file": + // File operations and shell commands - use ExecChain which has whitelist + return executeCommand(args) + case "git": + // git has its own whitelist in FsGit + return []byte(tools.FsGit(rest, "")) default: // Unknown subcommand - return help to remind user of available commands return []byte(getHelp(nil)) @@ -667,13 +676,13 @@ func getHelp(args []string) string { # File operations ls [path] - list files in directory cat - read file content - see - view image file + view_img - view image file write - write content to file stat - get file info rm - delete file cp - copy file mv - move/rename file - mkdir - create directory + mkdir [-p] - create directory (use full path) pwd - print working directory cd - change directory sed 's/old/new/[g]' [file] - text replacement @@ -747,12 +756,12 @@ Use: run "command" to execute.` Examples: run "cat readme.md" run "cat -b image.png" (base64 output)` - case "see": - return `see + case "view_img": + return `view_img View an image file for multimodal analysis. Supports: png, jpg, jpeg, gif, webp, svg Example: - run "see screenshot.png"` + run "view_img screenshot.png"` case "write": return `write [content] Write content to a file. @@ -812,6 +821,14 @@ Use: run "command" to execute.` Print working directory. Example: run "pwd"` + case "mkdir": + return `mkdir [-p] + Create a directory (use full path). + Options: + -p, --parents create parent directories as needed + Examples: + run "mkdir /full/path/myfolder" + run "mkdir -p /full/path/to/nested/folder"` case "sed": return `sed 's/old/new/[g]' [file] Stream editor for text replacement. -- cgit v1.2.3