Skip to content

Commit e3bdff4

Browse files
committed
allow non workspace chat
1 parent dbd5bfb commit e3bdff4

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Add support for global rules.
66
- Fix origin field of tool calls.
7+
- Allow chat communication with no workspace opened.
78

89
## 0.3.1
910

docs/protocol.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ interface ClientCapabilities {
133133
}
134134
}
135135

136-
type ChatBehavior = 'agent' | 'ask';
136+
type ChatBehavior = 'agent' | 'chat';
137137
```
138138

139139
_Response:_
@@ -149,7 +149,7 @@ interface InitializeResult {
149149
/*
150150
* Default model used by server.
151151
*/
152-
defaultModel: ChatModel;
152+
chatDefaultModel: ChatModel;
153153

154154
/*
155155
* The chat behaviors available.

src/eca/features/tools/mcp.clj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[cheshire.core :as json]
44
[clojure.java.io :as io]
55
[clojure.string :as string]
6+
[eca.config :as config]
67
[eca.logger :as logger]
78
[eca.shared :as shared])
89
(:import
@@ -45,11 +46,16 @@
4546
b (if env
4647
(.env b (update-keys env name))
4748
b)
48-
pb-init-args []]
49+
pb-init-args []
50+
;; TODO we are hard coding the first workspace
51+
work-dir (or (some-> workspaces
52+
first
53+
:uri
54+
shared/uri->filename)
55+
(config/get-property "user.home"))]
4956
(proxy [StdioClientTransport] [(.build b)]
5057
(getProcessBuilder [] (-> (ProcessBuilder. ^List pb-init-args)
51-
;; TODO we are hard coding the first workspace
52-
(.directory (io/file (shared/uri->filename (:uri (first workspaces))))))))))
58+
(.directory (io/file work-dir)))))))
5359

5460
(defn ^:private ->client ^McpSyncClient [transport config]
5561
(-> (McpClient/sync transport)

src/eca/features/tools/shell.clj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[babashka.fs :as fs]
44
[clojure.java.shell :as shell]
55
[clojure.string :as string]
6+
[eca.config :as config]
67
[eca.features.tools.util :as tools.util]
78
[eca.logger :as logger]
89
[eca.shared :as shared]))
@@ -21,7 +22,11 @@
2122
["commmand" (constantly (not (contains? exclude-cmds (first command-args)))) (format "Cannot run command '%s' because it is excluded by eca config."
2223
(first command-args))]])
2324
(let [work-dir (or (some-> user-work-dir fs/canonicalize str)
24-
(shared/uri->filename (:uri (first (:workspace-folders db)))))
25+
(some-> (:workspace-folders db)
26+
first
27+
:uri
28+
shared/uri->filename)
29+
(config/get-property "user.home"))
2530
command-and-opts (concat [] command-args [:dir work-dir])
2631
_ (logger/debug logger-tag "Running command:" command-and-opts)
2732
result (try

0 commit comments

Comments
 (0)