Skip to content

Commit ae04afb

Browse files
committed
Fix option to set default chat behavior from config via chat defaultBehavior.
Fixes #71
1 parent 12bda5d commit ae04afb

File tree

7 files changed

+20
-11
lines changed

7 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Fix option to set default chat behavior from config via `chat defaultBehavior`. #71
6+
57
## 0.32.1
68

79
- Fix support for models with `/` in the name like Openrouter ones.

docs/configuration.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ There are multiples ways to configure ECA:
1313
`~/.config/eca/config.json`
1414
```javascript
1515
{
16-
"chatBehavior": "agent"
16+
"chat" : {
17+
"defaultBehavior": "plan"
18+
}
1719
}
1820
```
1921

@@ -24,7 +26,9 @@ There are multiples ways to configure ECA:
2426
`.eca/config.json`
2527
```javascript
2628
{
27-
"chatBehavior": "agent"
29+
"chat" : {
30+
"defaultBehavior": "plan"
31+
}
2832
}
2933
```
3034

@@ -36,7 +40,9 @@ There are multiples ways to configure ECA:
3640

3741
```javascript
3842
"initializationOptions": {
39-
"chatBehavior": "agent"
43+
"chat" : {
44+
"defaultBehavior": "plan"
45+
}
4046
}
4147
```
4248

@@ -185,7 +191,8 @@ There are 3 possible ways to configure rules following this order of priority:
185191
disabled?: boolean;
186192
}};
187193
chat?: {
188-
welcomeMessage: string;
194+
defaultBehavior?: string;
195+
welcomeMessage?: string;
189196
};
190197
agentFileRelativePath: string;
191198
index?: {
@@ -226,6 +233,7 @@ There are 3 possible ways to configure rules following this order of priority:
226233
"mcpTimeoutSeconds" : 60,
227234
"mcpServers" : {},
228235
"chat" : {
236+
"defaultBehavior": "agent"
229237
"welcomeMessage" : "Welcome to ECA!\n\nType '/' for commands\n\n"
230238
},
231239
"agentFileRelativePath": "AGENT.md"

integration-test/integration/initialize_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
:chatWelcomeMessage "Welcome to ECA!\n\nType '/' for commands\n\n"}
3434
(eca/request! (fixture/initialize-request
3535
{:initializationOptions (merge fixture/default-init-options
36-
{:chatBehavior "plan"})})))))
36+
{:chat {:defaultBehavior "plan"}})})))))
3737

3838
(testing "initialized notification"
3939
(eca/notify! (fixture/initialized-notification)))

src/eca/config.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
:disabledTools []
5858
:mcpTimeoutSeconds 60
5959
:mcpServers {}
60-
:chat {:welcomeMessage "Welcome to ECA!\n\nType '/' for commands\n\n"}
60+
:chat {:defaultBehavior "agent"
61+
:welcomeMessage "Welcome to ECA!\n\nType '/' for commands\n\n"}
6162
:agentFileRelativePath "AGENT.md"
6263
:index {:ignoreFiles [{:type :gitignore}]
6364
:repoMap {:maxTotalEntries 800

src/eca/db.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
:client-capabilities {}
2323
:chats {}
2424
:chat-behaviors ["agent" "plan"]
25-
:chat-default-behavior "agent"
2625
:models {}
2726
:auth {}
2827
:mcp-clients {}})

src/eca/features/chat.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@
354354
rules (f.rules/all config (:workspace-folders db))
355355
refined-contexts (f.context/raw-contexts->refined contexts db config)
356356
repo-map* (delay (f.index/repo-map db config {:as-string? true}))
357-
instructions (f.prompt/build-instructions refined-contexts rules repo-map* (or behavior (:chat-default-behavior db)) config)
357+
instructions (f.prompt/build-instructions refined-contexts rules repo-map* (or behavior (-> config :chat :defaultBehavior)) config)
358358
chat-ctx {:chat-id chat-id
359359
:request-id request-id
360360
:contexts contexts

src/eca/handlers.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,13 @@
5858
(swap! db* assoc
5959
:client-info (:client-info params)
6060
:workspace-folders (:workspace-folders params)
61-
:client-capabilities (:capabilities params)
62-
:chat-default-behavior (or (-> params :initialization-options :chat-behavior) (:chat-default-behavior @db*)))
61+
:client-capabilities (:capabilities params))
6362
(initialize-models! db* config)
6463
(db/load-db-from-cache! db*)
6564
{:models (sort (keys (:models @db*)))
6665
:chat-default-model (f.chat/default-model @db* config)
6766
:chat-behaviors (:chat-behaviors @db*)
68-
:chat-default-behavior (:chat-default-behavior @db*)
67+
:chat-default-behavior (:defaultBehavior (:chat config))
6968
:chat-welcome-message (:welcomeMessage (:chat config))})))
7069

7170
(defn initialized [{:keys [db* messenger config]}]

0 commit comments

Comments
 (0)