enable list_dir tool, delete unused code, add env for ToolConfig

This commit is contained in:
lxowalle 2026-03-04 18:11:54 +08:00
parent 081f2276cc
commit e316ac74c1
3 changed files with 21 additions and 31 deletions

View file

@ -381,7 +381,7 @@
"enabled": true "enabled": true
}, },
"list_dir": { "list_dir": {
"enabled": false "enabled": true
}, },
"message": { "message": {
"enabled": true "enabled": true

View file

@ -562,7 +562,7 @@ type GLMSearchConfig struct {
} }
type WebToolsConfig struct { type WebToolsConfig struct {
ToolConfig ToolConfig ` env:"PICOCLAW_TOOLS_WEB_"`
Brave BraveConfig ` json:"brave"` Brave BraveConfig ` json:"brave"`
Tavily TavilyConfig ` json:"tavily"` Tavily TavilyConfig ` json:"tavily"`
DuckDuckGo DuckDuckGoConfig ` json:"duckduckgo"` DuckDuckGo DuckDuckGoConfig ` json:"duckduckgo"`
@ -575,28 +575,28 @@ type WebToolsConfig struct {
} }
type CronToolsConfig struct { type CronToolsConfig struct {
ToolConfig ToolConfig ` env:"PICOCLAW_TOOLS_CRON_"`
ExecTimeoutMinutes int `json:"exec_timeout_minutes" env:"PICOCLAW_TOOLS_CRON_EXEC_TIMEOUT_MINUTES"` // 0 means no timeout ExecTimeoutMinutes int `env:"PICOCLAW_TOOLS_CRON_EXEC_TIMEOUT_MINUTES" json:"exec_timeout_minutes"` // 0 means no timeout
} }
type ExecConfig struct { type ExecConfig struct {
ToolConfig ToolConfig ` env:"PICOCLAW_TOOLS_EXEC_"`
EnableDenyPatterns bool `json:"enable_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_ENABLE_DENY_PATTERNS"` EnableDenyPatterns bool `env:"PICOCLAW_TOOLS_EXEC_ENABLE_DENY_PATTERNS" json:"enable_deny_patterns"`
CustomDenyPatterns []string `json:"custom_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_CUSTOM_DENY_PATTERNS"` CustomDenyPatterns []string `env:"PICOCLAW_TOOLS_EXEC_CUSTOM_DENY_PATTERNS" json:"custom_deny_patterns"`
CustomAllowPatterns []string `json:"custom_allow_patterns" env:"PICOCLAW_TOOLS_EXEC_CUSTOM_ALLOW_PATTERNS"` CustomAllowPatterns []string `env:"PICOCLAW_TOOLS_EXEC_CUSTOM_ALLOW_PATTERNS" json:"custom_allow_patterns"`
} }
type SkillsToolsConfig struct { type SkillsToolsConfig struct {
ToolConfig ToolConfig ` env:"PICOCLAW_TOOLS_SKILLS_"`
Registries SkillsRegistriesConfig ` json:"registries"` Registries SkillsRegistriesConfig ` json:"registries"`
MaxConcurrentSearches int `json:"max_concurrent_searches" env:"PICOCLAW_SKILLS_MAX_CONCURRENT_SEARCHES"` MaxConcurrentSearches int `env:"PICOCLAW_TOOLS_SKILLS_MAX_CONCURRENT_SEARCHES" json:"max_concurrent_searches"`
SearchCache SearchCacheConfig ` json:"search_cache"` SearchCache SearchCacheConfig ` json:"search_cache"`
} }
type MediaCleanupConfig struct { type MediaCleanupConfig struct {
ToolConfig ToolConfig ` env:"PICOCLAW_MEDIA_CLEANUP_"`
MaxAge int `json:"max_age_minutes" env:"PICOCLAW_MEDIA_CLEANUP_MAX_AGE"` MaxAge int `env:"PICOCLAW_MEDIA_CLEANUP_MAX_AGE" json:"max_age_minutes"`
Interval int `json:"interval_minutes" env:"PICOCLAW_MEDIA_CLEANUP_INTERVAL"` Interval int `env:"PICOCLAW_MEDIA_CLEANUP_INTERVAL" json:"interval_minutes"`
} }
type ToolsConfig struct { type ToolsConfig struct {
@ -609,7 +609,6 @@ type ToolsConfig struct {
MediaCleanup MediaCleanupConfig `json:"media_cleanup"` MediaCleanup MediaCleanupConfig `json:"media_cleanup"`
MCP MCPConfig `json:"mcp"` MCP MCPConfig `json:"mcp"`
AppendFile ToolConfig `json:"append_file"` AppendFile ToolConfig `json:"append_file"`
CronTool ToolConfig `json:"cron_tool"`
EditFile ToolConfig `json:"edit_file"` EditFile ToolConfig `json:"edit_file"`
ExecTool ToolConfig `json:"exec_tool"` ExecTool ToolConfig `json:"exec_tool"`
FindSkills ToolConfig `json:"find_skills"` FindSkills ToolConfig `json:"find_skills"`
@ -622,7 +621,6 @@ type ToolsConfig struct {
SPI ToolConfig `json:"spi"` SPI ToolConfig `json:"spi"`
Subagent ToolConfig `json:"subagent"` Subagent ToolConfig `json:"subagent"`
WebFetch ToolConfig `json:"web_fetch"` WebFetch ToolConfig `json:"web_fetch"`
WebSearch ToolConfig `json:"web_search"`
WriteFile ToolConfig `json:"write_file"` WriteFile ToolConfig `json:"write_file"`
} }
@ -893,8 +891,6 @@ func (t *ToolsConfig) IsToolEnabled(name string) bool {
return t.Subagent.Enabled return t.Subagent.Enabled
case "web_fetch": case "web_fetch":
return t.WebFetch.Enabled return t.WebFetch.Enabled
case "web_search":
return t.WebSearch.Enabled
case "write_file": case "write_file":
return t.WriteFile.Enabled return t.WriteFile.Enabled
default: default:

View file

@ -391,9 +391,6 @@ func DefaultConfig() *Config {
AppendFile: ToolConfig{ AppendFile: ToolConfig{
Enabled: true, Enabled: true,
}, },
CronTool: ToolConfig{
Enabled: true,
},
EditFile: ToolConfig{ EditFile: ToolConfig{
Enabled: true, Enabled: true,
}, },
@ -410,7 +407,7 @@ func DefaultConfig() *Config {
Enabled: true, Enabled: true,
}, },
ListDir: ToolConfig{ ListDir: ToolConfig{
Enabled: false, Enabled: true,
}, },
Message: ToolConfig{ Message: ToolConfig{
Enabled: true, Enabled: true,
@ -430,9 +427,6 @@ func DefaultConfig() *Config {
WebFetch: ToolConfig{ WebFetch: ToolConfig{
Enabled: true, Enabled: true,
}, },
WebSearch: ToolConfig{
Enabled: true,
},
WriteFile: ToolConfig{ WriteFile: ToolConfig{
Enabled: true, Enabled: true,
}, },