|
58 | 58 | "claude-sonnet-4" {}}} |
59 | 59 | "ollama" {:url "http://localhost:11434" |
60 | 60 | :urlEnv "OLLAMA_API_URL"}} |
| 61 | + :behavior {"agent" {:systemPromptFile "prompts/agent_behavior.md" |
| 62 | + :disabledTools ["eca_preview_file_change"]} |
| 63 | + "plan" {:systemPromptFile "prompts/plan_behavior.md" |
| 64 | + :disabledTools ["eca_edit_file" "eca_write_file" "eca_move_file"] |
| 65 | + :toolCall {:approval {:deny {"eca_shell_command" |
| 66 | + {:argsMatchers {"command" [".*>.*", |
| 67 | + ".*\\|\\s*(tee|dd|xargs).*", |
| 68 | + ".*\\b(sed|awk|perl)\\s+.*-i.*", |
| 69 | + ".*\\b(rm|mv|cp|touch|mkdir)\\b.*", |
| 70 | + ".*git\\s+(add|commit|push).*", |
| 71 | + ".*npm\\s+install.*", |
| 72 | + ".*-c\\s+[\"'].*open.*[\"']w[\"'].*", |
| 73 | + ".*bash.*-c.*>.*"]}}}}}}} |
61 | 74 | :defaultModel nil |
62 | 75 | :rules [] |
63 | 76 | :commands [] |
64 | | - :nativeTools {:filesystem {:enabled true} |
65 | | - :shell {:enabled true |
66 | | - :excludeCommands []} |
67 | | - :editor {:enabled true}} |
68 | 77 | :disabledTools [] |
69 | 78 | :toolCall {:approval {:byDefault "ask" |
70 | 79 | :allow {"eca_preview_file_change" {} |
|
83 | 92 | :repoMap {:maxTotalEntries 800 |
84 | 93 | :maxEntriesPerDir 50}}}) |
85 | 94 |
|
| 95 | +(def ^:private fallback-behavior "agent") |
| 96 | + |
| 97 | +(defn validate-behavior-name |
| 98 | + "Validates if a behavior exists in config. Returns the behavior if valid, |
| 99 | + or the fallback behavior if not." |
| 100 | + [behavior config] |
| 101 | + (if (contains? (:behavior config) behavior) |
| 102 | + behavior |
| 103 | + (do (logger/warn logger-tag (format "Unknown behavior '%s' specified, falling back to '%s'" |
| 104 | + behavior fallback-behavior)) |
| 105 | + fallback-behavior))) |
| 106 | + |
86 | 107 | (defn get-env [env] (System/getenv env)) |
87 | 108 | (defn get-property [property] (System/getProperty property)) |
88 | 109 |
|
|
197 | 218 | {:kebab-case |
198 | 219 | [[:providers]] |
199 | 220 | :stringfy |
200 | | - [[:providers] |
| 221 | + [[:behavior] |
| 222 | + [:providers] |
201 | 223 | [:providers :ANY :models] |
202 | 224 | [:toolCall :approval :allow] |
203 | 225 | [:toolCall :approval :allow :ANY :argsMatchers] |
|
207 | 229 | [:toolCall :approval :deny :ANY :argsMatchers] |
208 | 230 | [:customTools] |
209 | 231 | [:customTools :ANY :schema :properties] |
210 | | - [:mcpServers]]}) |
| 232 | + [:mcpServers] |
| 233 | + ;; Behavior-specific toolCall |
| 234 | + [:behavior :ANY :toolCall :approval :allow] |
| 235 | + [:behavior :ANY :toolCall :approval :allow :ANY :argsMatchers] |
| 236 | + [:behavior :ANY :toolCall :approval :ask] |
| 237 | + [:behavior :ANY :toolCall :approval :ask :ANY :argsMatchers] |
| 238 | + [:behavior :ANY :toolCall :approval :deny] |
| 239 | + [:behavior :ANY :toolCall :approval :deny :ANY :argsMatchers]]}) |
211 | 240 |
|
212 | 241 | (defn all [db] |
213 | 242 | (let [initialization-config @initialization-config* |
|
0 commit comments