@@ -56,8 +56,8 @@ All messages are JSON with a `type` field indicating the message type:
5656
5757``` json
5858{
59- "type" : " execute_command " ,
60- "command_id " : " uuid-here" ,
59+ "type" : " exec " ,
60+ "request_id " : " uuid-here" ,
6161 "command" : " ls -la" ,
6262 "timeout_secs" : 300 ,
6363 "env" : {},
@@ -130,8 +130,8 @@ All messages are JSON with a `type` field indicating the message type:
130130
131131``` json
132132{
133- "type" : " execute_command " ,
134- "command_id " : " 550e8400-e29b-41d4-a716-446655440000" ,
133+ "type" : " exec " ,
134+ "request_id " : " 550e8400-e29b-41d4-a716-446655440000" ,
135135 "command" : " python script.py" ,
136136 "timeout_secs" : 300 ,
137137 "env" : {
@@ -142,7 +142,7 @@ All messages are JSON with a `type` field indicating the message type:
142142```
143143
144144** Fields** :
145- - ` command_id ` : Unique identifier for tracking this command
145+ - ` request_id ` : Unique identifier for tracking this request
146146- ` command ` : Shell command to execute
147147- ` timeout_secs ` : Maximum execution time (default: 300)
148148- ` env ` : Environment variables (optional)
@@ -155,7 +155,7 @@ All messages are JSON with a `type` field indicating the message type:
155155``` json
156156{
157157 "type" : " command_output" ,
158- "command_id " : " 550e8400-e29b-41d4-a716-446655440000" ,
158+ "request_id " : " 550e8400-e29b-41d4-a716-446655440000" ,
159159 "stdout" : " output text..." ,
160160 "stderr" : " " ,
161161 "exit_code" : 0 ,
@@ -170,88 +170,99 @@ All messages are JSON with a `type` field indicating the message type:
170170``` json
171171{
172172 "type" : " command_error" ,
173- "command_id " : " 550e8400-e29b-41d4-a716-446655440000" ,
173+ "request_id " : " 550e8400-e29b-41d4-a716-446655440000" ,
174174 "error" : " command not found"
175175}
176176```
177177
178- ### Interactive Shell (PTY)
178+ ### Interactive Session (PTY)
179179
180- #### StartShell
180+ #### StartSession
181181** Direction** : Agent → Daemon
182- ** Purpose** : Start an interactive shell session
182+ ** Purpose** : Start an interactive session
183183
184184``` json
185185{
186- "type" : " start_shell " ,
186+ "type" : " start_session " ,
187187 "session_id" : " 550e8400-e29b-41d4-a716-446655440001" ,
188188 "rows" : 24 ,
189189 "cols" : 80 ,
190190 "term" : " xterm-256color"
191191}
192192```
193193
194- #### ShellStarted
194+ #### SessionStarted
195195** Direction** : Daemon → Agent
196- ** Purpose** : Acknowledge shell started
196+ ** Purpose** : Acknowledge session started
197197
198198``` json
199199{
200- "type" : " shell_started " ,
200+ "type" : " session_started " ,
201201 "session_id" : " 550e8400-e29b-41d4-a716-446655440001" ,
202202 "success" : true ,
203203 "error" : null
204204}
205205```
206206
207- #### ShellInput
207+ #### SessionInput
208208** Direction** : Agent → Daemon
209- ** Purpose** : Send user input to shell
209+ ** Purpose** : Send user input to session
210210
211211``` json
212212{
213- "type" : " shell_input " ,
213+ "type" : " session_input " ,
214214 "session_id" : " 550e8400-e29b-41d4-a716-446655440001" ,
215215 "data" : " bHMgLWxhCg=="
216216}
217217```
218218
219219** Note** : ` data ` is base64-encoded bytes
220220
221- #### ShellOutput
221+ #### SessionOutput
222222** Direction** : Daemon → Agent
223- ** Purpose** : Stream shell output back to agent
223+ ** Purpose** : Stream session output back to agent
224224
225225``` json
226226{
227- "type" : " shell_output " ,
227+ "type" : " session_output " ,
228228 "session_id" : " 550e8400-e29b-41d4-a716-446655440001" ,
229229 "data" : " ZmlsZTEgIGZpbGUyICBmaWxlMwo="
230230}
231231```
232232
233233** Note** : ` data ` is base64-encoded bytes
234234
235- #### ShellResize
235+ #### SessionResize
236236** Direction** : Agent → Daemon
237237** Purpose** : Resize terminal window
238238
239239``` json
240240{
241- "type" : " shell_resize " ,
241+ "type" : " session_resize " ,
242242 "session_id" : " 550e8400-e29b-41d4-a716-446655440001" ,
243243 "rows" : 50 ,
244244 "cols" : 120
245245}
246246```
247247
248- #### ShellExit
248+ #### SessionClose
249+ ** Direction** : Agent → Daemon
250+ ** Purpose** : Close session
251+
252+ ``` json
253+ {
254+ "type" : " session_close" ,
255+ "session_id" : " 550e8400-e29b-41d4-a716-446655440001"
256+ }
257+ ```
258+
259+ #### SessionExit
249260** Direction** : Daemon → Agent
250- ** Purpose** : Shell session terminated
261+ ** Purpose** : Session terminated
251262
252263``` json
253264{
254- "type" : " shell_exit " ,
265+ "type" : " session_exit " ,
255266 "session_id" : " 550e8400-e29b-41d4-a716-446655440001" ,
256267 "exit_code" : 0
257268}
@@ -367,25 +378,25 @@ All messages are JSON with a `type` field indicating the message type:
367378
368379### Request/Response (Command Execution)
369380
370- 1 . Agent generates unique ` command_id `
371- 2 . Agent registers oneshot channel for this command
381+ 1 . Agent generates unique ` request_id `
382+ 2 . Agent registers oneshot channel for this request
3723833 . Agent sends ` ExecuteCommand ` message
3733844 . Daemon executes and sends back ` CommandOutput `
3743855 . Agent resolves channel, Python receives result
375386
376387** Concurrency** : Multiple commands can execute in parallel
377388
378- ### Streaming (Shell Sessions)
389+ ### Streaming (Interactive Sessions)
379390
3803911 . Agent generates unique ` session_id `
3813922 . Agent registers mpsc channel for this session
382- 3 . Agent sends ` StartShell ` message
393+ 3 . Agent sends ` StartSession ` message
3833944 . Daemon starts PTY and begins streaming output
384- 5 . Agent sends ` ShellInput ` as user types
385- 6 . Daemon sends ` ShellOutput ` continuously
386- 7 . Session ends with ` ShellExit `
395+ 5 . Agent sends ` SessionInput ` as user types
396+ 6 . Daemon sends ` SessionOutput ` continuously
397+ 7 . Session ends with ` SessionExit `
387398
388- ** Concurrency** : Multiple shell sessions per daemon supported
399+ ** Concurrency** : Multiple sessions per daemon supported
389400
390401### Chunked Transfer (File Download)
391402
@@ -413,7 +424,7 @@ All messages are JSON with a `type` field indicating the message type:
413424 - Agent detects closed connection
414425 - Registry removes daemon
415426 - All pending commands fail
416- - Shell sessions terminate
427+ - Terminate
417428```
418429
419430## Heartbeat & Connection Monitoring
@@ -434,4 +445,4 @@ All messages are JSON with a `type` field indicating the message type:
434445
435446See ` server/src/protocol.rs ` for the complete Rust implementation using serde for JSON serialization.
436447
437- Binary data (shell I/O, file chunks) is base64-encoded for JSON compatibility.
448+ Binary data (session I/O, file chunks) is base64-encoded for JSON compatibility.
0 commit comments