feat: add browser automation tool via agent-browser CLI

Integrate agent-browser CLI as a lightweight browser automation tool.
Instead of embedding browser dependencies, this wraps the external
agent-browser binary via exec.Command, keeping PicoClaw lean.

Changes:
- Add BrowserTool (pkg/tools/browser.go) wrapping agent-browser CLI
- Add BrowserConfig to config with enabled, session, headless, timeout, cdp_port
- Register browser tool conditionally in agent loop
- Add unit tests for argument building, command splitting, error handling

The tool accepts a single 'command' parameter and delegates to agent-browser.
Default CDP port is 9222. Zero new Go dependencies - all stdlib imports.
This commit is contained in:
Danieldd28
2026-02-16 22:38:02 +07:00
parent 13e4028d42
commit e20ac34f35
4 changed files with 405 additions and 1 deletions
+10
View File
@@ -84,6 +84,16 @@ func createToolRegistry(workspace string, restrict bool, cfg *config.Config, msg
}
registry.Register(tools.NewWebFetchTool(50000))
// Browser automation tool (agent-browser CLI)
if cfg.Tools.Browser.Enabled {
registry.Register(tools.NewBrowserTool(tools.BrowserToolOptions{
Session: cfg.Tools.Browser.Session,
Headless: cfg.Tools.Browser.Headless,
Timeout: cfg.Tools.Browser.Timeout,
CDPPort: cfg.Tools.Browser.CDPPort,
}))
}
// Hardware tools (I2C, SPI) - Linux only, returns error on other platforms
registry.Register(tools.NewI2CTool())
registry.Register(tools.NewSPITool())