feat: add ask_permission config option to ExecConfig (default: true)

This commit is contained in:
anthrodjear 2026-05-05 06:16:44 +03:00
parent 4c74b13c6d
commit 8feb6892af
3 changed files with 23 additions and 5 deletions

View file

@ -762,11 +762,12 @@ type CronToolsConfig struct {
type ExecConfig struct {
ToolConfig ` envPrefix:"PICOCLAW_TOOLS_EXEC_"`
EnableDenyPatterns bool ` json:"enable_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_ENABLE_DENY_PATTERNS"`
AllowRemote bool ` json:"allow_remote" env:"PICOCLAW_TOOLS_EXEC_ALLOW_REMOTE"`
CustomDenyPatterns []string ` json:"custom_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_CUSTOM_DENY_PATTERNS"`
CustomAllowPatterns []string ` json:"custom_allow_patterns" env:"PICOCLAW_TOOLS_EXEC_CUSTOM_ALLOW_PATTERNS"`
TimeoutSeconds int ` json:"timeout_seconds" env:"PICOCLAW_TOOLS_EXEC_TIMEOUT_SECONDS"` // 0 means use default (60s)
EnableDenyPatterns bool `json:"enable_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_ENABLE_DENY_PATTERNS"`
AllowRemote bool `json:"allow_remote" env:"PICOCLAW_TOOLS_EXEC_ALLOW_REMOTE"`
CustomDenyPatterns []string `json:"custom_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_CUSTOM_DENY_PATTERNS"`
CustomAllowPatterns []string `json:"custom_allow_patterns" env:"PICOCLAW_TOOLS_EXEC_CUSTOM_ALLOW_PATTERNS"`
TimeoutSeconds int `json:"timeout_seconds" env:"PICOCLAW_TOOLS_EXEC_TIMEOUT_SECONDS"` // 0 means use default (60s)
AskPermission bool `json:"ask_permission"` // NEW
}
type SkillsToolsConfig struct {

View file

@ -2432,3 +2432,19 @@ func testChannelsConfigWithTokens() ChannelsConfig {
}
return channels
}
func TestToolsConfig_IsToolEnabled_ExecAskPermission(t *testing.T) {
cfg := &ToolsConfig{
Exec: ExecConfig{
ToolConfig: ToolConfig{
Enabled: true,
},
AskPermission: true,
},
}
// Verify AskPermission field exists and is accessible
if !cfg.Exec.AskPermission {
t.Error("Expected AskPermission to be true")
}
}

View file

@ -369,6 +369,7 @@ func DefaultConfig() *Config {
EnableDenyPatterns: true,
AllowRemote: true,
TimeoutSeconds: 60,
AskPermission: true, // NEW: enable permission prompts by default
},
Skills: SkillsToolsConfig{
ToolConfig: ToolConfig{