Skip to content

Commit 0208572

Browse files
committed
docs
1 parent 2c29d24 commit 0208572

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

docs/protocol.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ _Notification:_
235235

236236
## Code Assistant Features
237237

238-
=== "Chat: simple"
238+
=== "Chat: text"
239239

240240
Example of a basic chat conversation with only texts:
241241

@@ -248,19 +248,51 @@ _Notification:_
248248
C->>+S: chat/prompt
249249
Note over C,S: User sends: Hello there!
250250
S--)C: chat/contentReceived (system: start)
251-
Note right of S: Parse contexts,<br/>renew login,<br/>prepare prompt
251+
S--)C: chat/contentReceived (user: "hello there!")
252+
Note right of S: Prepare prompt with all<br/>available contexts and tools.
252253
S->>+L: Send prompt
253254
S->>-C: chat/prompt
254-
Note over C,S: Request sent to LLM
255+
Note over C,S: Success: sent to LLM
255256
loop LLM streaming
256-
Note right of L: Returns first `Hel`,<br/>then `lo`, etc
257+
Note right of L: Returns first `H`,<br/>then `i!`, etc
257258
L--)S: Stream data
258259
S--)C: chat/contentReceived (assistant: text)
259260
260261
end
261262
L->>-S: Finish response
262263
S->>C: chat/contentReceived (system: finished)
263264
```
265+
266+
=== "Chat: tool call"
267+
268+
Example of a tool call loop LLM interaction:
269+
270+
```mermaid
271+
sequenceDiagram
272+
autonumber
273+
participant C as Client / Editor
274+
participant S as ECA Server
275+
participant L as LLM
276+
C->>S: chat/prompt
277+
Note over C,S: ...<br/>Same as text flow
278+
S->>+L: Send prompt with<br/>available tools
279+
loop LLM streaming / calling tools
280+
Note right of L: Returns first `will`,<br/>then `check`, etc
281+
L--)S: Stream data
282+
S--)C: chat/contentReceived (assistant: text)
283+
S--)C: chat/contentReceived (toolCallPrepare: name + args)
284+
L->>-S: Finish response:<br/>needs tool call<br/>'eca_directory_tree'
285+
S->>C: chat/contentReceived (toolCallRun)<br/>Ask user if should call tool
286+
C--)S: chat/toolCallApprove
287+
S->>C: chat/contentReceived (toolCallRunning)
288+
Note right of S: Call tool and get result
289+
S->>C: chat/contentReceived (toolCalled)
290+
S->>+L: Send previous prompt +<br/>LLM response +<br/>tool call result
291+
Note right of L: Stream response
292+
end
293+
L->>-S: Finish response
294+
S->>C: chat/contentReceived (system: finished)
295+
```
264296

265297
### Chat Prompt (↩️)
266298

0 commit comments

Comments
 (0)