Skip to content

Commit 5adbc12

Browse files
ericdalloeca-agent
andcommitted
Change chat/update from notification to request
State-modifying operations that persist to DB should use request semantics so the client gets acknowledgment. This aligns chat/update with chat/clear, chat/delete, chat/fork, etc. - Use receive-request + eventually instead of receive-notification - Return {} from update-chat (consistent with other chat operations) - Update protocol docs to reflect request semantics 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev>
1 parent 85da33c commit 5adbc12

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

docs/protocol.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,12 +1707,12 @@ _Response:_
17071707
interface ChatDeleteResponse {}
17081708
```
17091709

1710-
### Chat update (️)
1710+
### Chat update (️)
17111711

1712-
A client notification to update chat metadata like title.
1713-
Server will broadcast the change to all connected clients via `chat/contentReceived` with metadata content.
1712+
A client request to update chat metadata like title.
1713+
Server will persist the change, broadcast to all connected clients via `chat/contentReceived` with metadata content, and return an empty response.
17141714

1715-
_Notification:_
1715+
_Request:_
17161716

17171717
* method: `chat/update`
17181718
* params: `ChatUpdateParams` defined as follows:
@@ -1731,6 +1731,12 @@ interface ChatUpdateParams {
17311731
}
17321732
```
17331733

1734+
_Response:_
1735+
1736+
```typescript
1737+
interface ChatUpdateResponse {}
1738+
```
1739+
17341740
### Chat selected agent changed (➡️)
17351741

17361742
A client notification for server telling the user selected a different agent in chat.

src/eca/features/chat.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,8 @@
11531153
{:chat-id chat-id
11541154
:role "system"
11551155
:content {:type :metadata :title title}})
1156-
(db/update-workspaces-cache! @db* metrics)))
1156+
(db/update-workspaces-cache! @db* metrics))
1157+
{})
11571158

11581159
(defn rollback-chat
11591160
"Remove messages from chat in db until content-id matches.

src/eca/server.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@
115115
(defmethod jsonrpc.server/receive-request "chat/fork" [_ components params]
116116
(eventually (handlers/chat-fork (with-config components) params)))
117117

118-
(defmethod jsonrpc.server/receive-notification "chat/update" [_ components params]
119-
(async-notify (handlers/chat-update (with-config components) params)))
118+
(defmethod jsonrpc.server/receive-request "chat/update" [_ components params]
119+
(eventually (handlers/chat-update (with-config components) params)))
120120

121121
(defmethod jsonrpc.server/receive-notification "mcp/stopServer" [_ components params]
122122
(async-notify (handlers/mcp-stop-server (with-config components) params)))

0 commit comments

Comments
 (0)